rupeeLike.c OK

This commit is contained in:
theo3
2020-07-23 22:48:16 -07:00
parent f4320b6fcd
commit 2d286c0b34
37 changed files with 477 additions and 1022 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ void sub_0802A84C(Entity* this) {
}
void sub_0802A8AC(Entity *this) {
*((u8 *)&this->field_0x80 + 1) = 0;
this->field_0x80.HALF.HI = 0;
if (this->entityType.form < 2) {
InitializeAnimation(this, 0);
}
+2 -2
View File
@@ -11,7 +11,7 @@ extern void sub_0801ECFC();
extern u32 sub_0806F520();
extern void sub_0806F4E8();
extern void sub_0806F3E4();
extern void InitializeAnimationAnimation();
extern void UpdateAnimationVariableFrames();
extern void sub_0804A720();
extern u32 Random();
extern void sub_0801ED14();
@@ -75,7 +75,7 @@ void sub_0801EB7C(Entity* ent) {
void sub_0801EB84(Entity* ent) {
ent->flags = ent->flags & 127;
InitializeAnimationAnimation(ent, 2);
UpdateAnimationVariableFrames(ent, 2);
}
void nullsub_3() {
+281
View File
@@ -0,0 +1,281 @@
#include "global.h"
#include "entity.h"
#include "enemy.h"
#include "functions.h"
#include "structures.h"
#include "link.h"
extern void sub_080293DC(Entity*);
extern void sub_080296D8(Entity*);
extern void sub_08029770(Entity*);
extern void sub_080297F0(Entity*);
extern void sub_080296C8(Entity*);
extern void sub_0802969C(Entity*);
extern void (*const gUnk_080CCC00[])(Entity*);
extern void (*const gUnk_080CCC18[])(Entity*);
extern void (*const gUnk_080CCC3C[])(Entity*);
extern u8 gUnk_080CCC34[];
extern u8 gUnk_080CCC47[];
extern BoundingBox gUnk_080FD260;
void RupeeLike(Entity* this) {
u32 uVar1;
if (this->entityType.parameter == 0) {
uVar1 = sub_080043E8(this);
if (uVar1 != 0) {
if (this->action == 4) {
sub_080296D8(this);
}
sub_08001290(this, uVar1);
} else {
gUnk_080CCC00[GetNextFunction(this)](this);
SetChildOffset(this, 0, 1, -0x10);
}
} else {
sub_080293DC(this);
}
}
void sub_08029300(Entity* this) {
gUnk_080CCC18[this->action](this);
}
void sub_08029318(Entity* this) {
if (this->damageType == 0x8e) {
sub_08029770(this);
} else {
if (this->action == 4) {
sub_080296D8(this);
}
if (*(u8*)(*(u32*)&this->field_0x4c + 8) == 1) {
if (this->action == 2) {
InitializeAnimation(this, 0);
InitializeAnimation(this->attachedEntity, 4);
}
this->action = 4;
this->actionDelay = 0x3c;
this->field_0xf = 0;
this->field_0x82.HALF.HI = 0x41;
this->flags2 &= 0xfc;
this->field_0x80.HALF.LO = gLinkEntity.spritePriority.b1;
sub_08004488(0x104);
} else {
if (this->field_0x43 != 0) {
sub_0804A9FC(this, 0x1c);
}
}
}
sub_0804AA30(this, gUnk_080CCC00);
}
void sub_080293B4(Entity* this) {
CreateDeathFx(this, 0xff, gUnk_080CCC34[this->cutsceneBeh.HALF.LO * 3 + this->entityType.form]);
}
void nullsub_141() {
}
void sub_080293DC(Entity* this) {
CopyPositionAndSpriteOffset(this->parent, this);
this->y.HALF.HI++;
this->height.HALF.HI--;
gUnk_080CCC3C[this->action](this);
}
void sub_0802940C(Entity* this) {
Entity* ent;
ent = CreateEnemy(0x17, this->entityType.form);
if (ent != NULL) {
sub_0804A720(this);
ent->parent = this;
ent->entityType.parameter = 1;
this->attachedEntity = ent;
this->field_0x80.HALF.HI = 0;
this->cutsceneBeh.HALF.LO = 0;
this->field_0x82.HALF.LO = this->palette.b.b0;
sub_080297F0(this);
}
}
void sub_0802944C(Entity* this) {
sub_080296C8(this);
if ((this->field_0x80.HALF.HI != 0) && sub_08049FDC(this, 1)) {
sub_08029770(this);
}
}
void sub_08029474(Entity* this) {
u32 bVar1;
sub_080296C8(this);
if (this->frames.b.f3) {
this->action = 3;
this->actionDelay = 8;
bVar1 = GetFacingDirection(this, &gLinkEntity);
this->direction = bVar1;
this->animationState = (bVar1 << 0x18) >> 0x1c;
InitializeAnimation(this, this->animationState);
InitializeAnimation(this->attachedEntity, this->animationState + 4);
} else {
if (this->frames.all == 1) {
this->frames.all = 0;
this->flags |= 0x80;
}
}
}
void sub_080294D4(Entity* this) {
if (sub_08049FDC(this, 1) != 0) {
if (--this->actionDelay == 0) {
this->actionDelay = 8;
sub_08004596(this, GetFacingDirection(this, &gLinkEntity));
sub_0802969C(this);
}
sub_080AEF88(this);
sub_080296C8(this);
} else {
this->action = 6;
this->flags &= 0x7f;
InitializeAnimation(this, 3);
InitializeAnimation(this->attachedEntity, 7);
}
}
extern s8 gUnk_080CCC44[];
void sub_0802953C(Entity* this) {
u8* pbVar3;
sub_080296C8(this);
sub_080296C8(this);
if (sub_0807953C() != 0) {
this->field_0xf++;
}
if (this->actionDelay != 0) {
this->actionDelay--;
}
if (((this->field_0xf > 0x2d) || (gUnk_02002A40.stats.rupees == 0)) && (this->actionDelay == 0)) {
sub_080296D8(this);
} else {
sub_08077B2C();
gLinkState.field_0x1a[0] |= 0x80;
PositionRelative(this, &gLinkEntity, 0, 0x10000);
pbVar3 = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex);
gLinkEntity.spriteOffsetX = pbVar3[0];
gLinkEntity.spriteOffsetY = pbVar3[1] - 1;
gLinkEntity.spritePriority.b1 = 0;
if (--this->field_0x82.HALF.HI == 0) {
this->field_0x82.HALF.HI = 0x41;
if (gUnk_02002A40.stats.rupees != 0) {
ModRupees(gUnk_080CCC44[this->entityType.form]);
this->cutsceneBeh.HALF.LO = 1;
}
}
}
}
void sub_08029610(Entity* this) {
if (--this->field_0xf == 0) {
this->action = 3;
this->actionDelay = 1;
}
sub_080296C8(this);
}
void sub_08029630(Entity* this) {
sub_080296C8(this);
if ((this->frames.b.f3) != 0) {
this->field_0x80.HALF.HI = 1;
this->attachedEntity->spriteSettings.b.draw = FALSE;
sub_080297F0(this);
}
}
void sub_08029660(Entity* this) {
u32 temp;
this->action = 1;
this->spriteIndex = 0xd1;
temp = gUnk_080CCC47[this->entityType.form];
this->palette.b.b0 = temp;
}
void sub_08029688(Entity* this) {
if (this->parent->field_0x4 == NULL) {
DeleteEntity(this);
}
}
void sub_0802969C(Entity* this) {
u32 bVar1;
if ((this->direction & 0xf) != 0) {
bVar1 = this->direction >> 4;
if (bVar1 != this->animationState) {
this->animationState = bVar1;
InitializeAnimation(this, bVar1);
InitializeAnimation(this->attachedEntity, bVar1 + 4);
}
}
}
void sub_080296C8(Entity* this) {
GetNextFrame(this);
GetNextFrame(this->attachedEntity);
}
void sub_080296D8(Entity* this) {
gLinkState.jumpStatus = 0x41;
gLinkState.flags.all &= 0xffffffef;
gLinkEntity.flags |= 0x80;
gLinkEntity.field_0x20 = 0x18000;
gLinkEntity.hurtBlinkTime = 0xa6;
gLinkEntity.height.HALF.HI = -2;
gLinkEntity.direction = gLinkEntity.animationState << 2;
gLinkEntity.spritePriority.b1 = this->field_0x80.HALF.LO;
gLinkEntity.spriteOffsetY = 0;
gLinkEntity.nonPlanarMovement = 0x140;
this->action = 5;
this->field_0xf = 0x3c;
this->flags2 |= 3;
if ((s8)this->hurtBlinkTime == 0) {
this->hurtBlinkTime = 0xf4;
}
}
void sub_08029770(Entity* this) {
u32 temp;
if (LoadFixedGFX(this, 0x73) != 0) {
this->action = 2;
this->flags = this->flags & 0x7f;
this->spriteIndex = 0xd1;
this->spritePriority.b1 = 3;
temp = this->field_0x82.HALF.LO;
this->palette.b.b0 = temp;
this->damageType = 0x8d;
this->boundingBox = &gUnk_080FD260;
InitializeAnimation(this, 2);
this->attachedEntity->spriteSettings.b.draw = TRUE;
InitializeAnimation(this->attachedEntity, 6);
sub_080A29BC(this);
}
}
void sub_080297F0(Entity* this) {
u32 temp;
this->action = 1;
this->actionDelay = 0x78;
this->flags = this->flags | 0x80;
this->spriteSettings.b.draw = TRUE;
this->damageType = 0x8e;
sub_080AE068(this);
this->spriteIndex = 0x143;
temp = gUnk_080CCC47[this->entityType.form];
this->palette.b.b0 = temp;
this->spriteVramOffset = 9;
InitializeAnimation(this, 0x54);
}
+108
View File
@@ -0,0 +1,108 @@
#include "global.h"
#include "entity.h"
#include "enemy.h"
#include "functions.h"
#include "flags.h"
extern void sub_08038168(Entity*);
extern void (*const gUnk_080CF4A0)(Entity*);
extern void (*const gUnk_080CF4B8[])(Entity*);
void TektiteGolden(Entity *this)
{
EnemyFunctionHandler(this, &gUnk_080CF4A0);
SetChildOffset(this, 0, 1, -0x10);
}
void sub_08037EE8(Entity* this)
{
gUnk_080CF4B8[this->action](this);
}
void sub_08037F00(Entity *this)
{
u32 uVar1;
if (this->field_0x43 != 0) {
sub_0804A9FC(this,0x1c);
}
sub_0804AA30(this, &gUnk_080CF4A0);
if (this->bitfield == 0x94) {
this->action = 1;
this->previousActionFlag = 0;
this->actionDelay = 0x14;
this->field_0xf = 0;
this->field_0x80.HALF.LO = 0;
uVar1 = this->height.HALF.HI;
if (uVar1 != 0) {
this->field_0x20 >>= 2;
}
else {
this->field_0x20 = uVar1;
}
InitializeAnimation(this,0);
}
}
void sub_08037F58(Entity *this)
{
u32 uVar1;
if ((this->field_0x3a & 2) == 0) {
SetGlobalFlag(this->entityType.parameter);
}
if ((this->entityType).form != 0) {
uVar1 = 0x59;
}
else {
uVar1 = 0x58;
}
CreateDeathFx(this, 0xff, uVar1);
}
void sub_08037F84(Entity *this)
{
sub_08001242();
if (this->height.HALF.HI != 0) {
sub_08003FC4(this, 0x3000);
}
}
void sub_08037FA0(Entity *this)
{
if (CheckGlobalFlag(this->entityType.parameter)) {
DeleteThisEntity();
}
sub_0804A720(this);
this->action = 1;
this->previousActionFlag = 0;
this->actionDelay = (Random() & 0x1f) + 0x20;
this->field_0xf = 0;
this->field_0x80.HALF.LO = 0;
InitializeAnimation(this,0);
}
void sub_08037Fe0(Entity *this)
{
UpdateAnimationVariableFrames(this, 2);
if (this->actionDelay != 0) {
this->actionDelay--;
}
else if (this->field_0xf != 0) {
if ((this->frames.b.f3) != 0) {
this->action = 2;
this->actionDelay = 6;
this->field_0xf = 0;
this->field_0x20 = 0x38000;
sub_08038168(this);
InitializeAnimation(this, 2);
}
}
else if ((this->frames.b.f3) != 0) {
this->field_0xf = 0x40;
InitializeAnimation(this, 1);
}
}
+1 -1
View File
@@ -57,7 +57,7 @@ void sub_08018CBC(Entity *this)
this->action = 2;
this->spriteSettings.b.draw = 1;
this->spriteIndex = 0xa6;
this->palette = 0x33;
this->palette.raw = 0x33;
this->spriteVramOffset = 0;
(this->entityType).form = gLinkState.field_0x1d[0] - 1;
this->actionDelay = gUnk_080B3DE0[(this->entityType).form * 2];
+4 -4
View File
@@ -90,9 +90,9 @@ void sub_080600F0(Entity* this) {
u32 uVar1;
u32 uVar2;
uVar2 = this->field_0x80;
if (this->field_0x80 < 8) {
if ((this->field_0x82 & 1) != 0) {
uVar2 = this->field_0x80.HWORD;
if (this->field_0x80.HWORD < 8) {
if ((this->field_0x82.HWORD & 1) != 0) {
uVar2 = (uVar2 & 0xfc) + (this->field_0xf >> 1);
} else {
uVar2 = (uVar2 & 0xfc) + (this->animationState >> 1);
@@ -102,7 +102,7 @@ void sub_080600F0(Entity* this) {
if (uVar2 != this->animIndex) {
InitAnimationForceUpdate(this, uVar2);
}
if ((this->field_0x82 & 4) != 0) {
if ((this->field_0x82.HWORD & 4) != 0) {
uVar1 = 2;
} else {
uVar1 = 1;
+2 -2
View File
@@ -63,7 +63,7 @@ void sub_08069428(Entity* this, s32 offsetX, bool32 createFx65);
void sub_080693D0(Entity* this) {
sub_0807DD94(this, 0);
if (this->animIndex == 8) {
u32 var0 = this->field_0x82 & 0xF;
u32 var0 = this->field_0x82.HWORD & 0xF;
bool32 createFx65 = ((-var0) | var0) >> 0x1F; // = !var0
if (this->frames.all == 1) {
@@ -121,7 +121,7 @@ void sub_080694EC(Entity* this) {
anim = 2;
if (!CheckKinstoneFused(47)) anim = 8;
InitAnimationForceUpdate(this, anim);
this->field_0x80 = anim;
this->field_0x80.HWORD = anim;
}
void Goron_Fusion(Entity* this) {
+2 -2
View File
@@ -157,8 +157,8 @@ void sub_080661BC(Entity *this)
if (this->animIndex == 0xc) {
UpdateAnimationSingleFrame(this);
if ((this->frames.b.f3) != 0) {
this->field_0x80 = GetAnimationState(this) + 8;
InitAnimationForceUpdate(this, this->field_0x80);
this->field_0x80.HWORD = GetAnimationState(this) + 8;
InitAnimationForceUpdate(this, this->field_0x80.HWORD);
}
}
else {
+1 -1
View File
@@ -41,7 +41,7 @@ void sub_0806A1F8(Entity *this)
void sub_0806A234(Entity *this)
{
sub_0807DD94(this, 0);
if ((this->field_0x82 & 4) != 0) {
if ((this->field_0x82.HWORD & 4) != 0) {
if ((gUnk_030010A0 & 7) == 0) {
sub_0806A26C(this);
}
+6 -6
View File
@@ -109,27 +109,27 @@ void sub_08066DE4(Entity* ent) {
void sub_08066E08(Entity* ent) {
InitAnimationForceUpdate(ent, 0x50);
ent->field_0x80 = ent->animIndex;
ent->field_0x80.HWORD = ent->animIndex;
}
void sub_08066E20(Entity* ent) {
InitAnimationForceUpdate(ent, 0x44);
ent->field_0x80 = ent->animIndex;
ent->field_0x80.HWORD = ent->animIndex;
}
void sub_08066E38(Entity* ent) {
InitAnimationForceUpdate(ent, 0x48);
ent->field_0x80 = ent->animIndex;
ent->field_0x80.HWORD = ent->animIndex;
}
void sub_08066E50(Entity* ent) {
InitAnimationForceUpdate(ent, 0x4C);
ent->field_0x80 = ent->animIndex;
ent->field_0x80.HWORD = ent->animIndex;
}
void sub_08066E68(Entity* ent) {
InitAnimationForceUpdate(ent, 0x54);
ent->field_0x80 = ent->animIndex;
ent->field_0x80.HWORD = ent->animIndex;
}
void sub_08066E80(Entity* ent, u8* param_2) {
@@ -172,7 +172,7 @@ void sub_08066E80(Entity* ent, u8* param_2) {
return;
}
}
ent->field_0x80 = ent->animIndex;
ent->field_0x80.HWORD = ent->animIndex;
gUnk_02033280[6] = 0;
}
+1 -1
View File
@@ -11,7 +11,7 @@ void Object1C(Entity *this)
if (this->action == 0) {
this->action = 1;
}
iVar1 = CheckRectOnScreen(this->field_0x80, this->field_0x82, 0x10, 0x10);
iVar1 = CheckRectOnScreen(this->field_0x80.HWORD, this->field_0x82.HWORD, 0x10, 0x10);
if (iVar1 == 0) {
this->parent->field_0x20 &= ~(1 << this->entityType.parameter);
DeleteThisEntity();
+3 -3
View File
@@ -19,14 +19,14 @@ void sub_080A0EB0(Entity* ent) {
ent->action = 1;
tilePos = COORD_TO_TILE(ent);
ent->field_0x80 = tilePos;
SetTile(16509, ent->field_0x80, 1);
ent->field_0x80.HWORD = tilePos;
SetTile(16509, ent->field_0x80.HWORD, 1);
}
void sub_080A0EF0(Entity* ent) {
s32 tileIndex;
tileIndex = GetTileType(ent->field_0x80, 1);
tileIndex = GetTileType(ent->field_0x80.HWORD, 1);
if (tileIndex != 0x407D) {
sub_08078B48();
gLinkEntity.x.WORD = ent->x.WORD;