Use dec for actionDelay in a lot of entities

This commit is contained in:
Elliptic Ellipsis 2022-03-25 22:52:17 +00:00
parent 16ffc97541
commit 6125bec49b
30 changed files with 378 additions and 387 deletions

View File

@ -165,9 +165,10 @@ void AcroBandit_Type0Action0(Entity* this) {
void AcroBandit_Type0Action1(Entity* this) {
u32 rand;
s32 x, y;
s32 x;
s32 y;
if (this->timer) {
if (this->timer != 0) {
this->timer--;
} else {
if (sub_08049FDC(this, 1)) {
@ -302,12 +303,12 @@ void AcroBandit_Type0Action6(Entity* this) {
}
void AcroBandit_Type0Action7(Entity* this) {
if ((this->timer & 0xf) == 0) {
if (this->timer == 0x50) {
if ((this->timer & 0xF) == 0) {
if (this->timer == 80) {
DeleteEntity(this);
} else {
this->action = 1;
this->timer = 0xb4;
this->timer = 180;
}
}
}
@ -315,7 +316,7 @@ void AcroBandit_Type0Action7(Entity* this) {
void AcroBandit_Type0Action8(Entity* this) {
if (this->frame & ANIM_DONE) {
this->action = 1;
this->timer = 0xb4;
this->timer = 180;
this->spriteSettings.draw = 0;
} else {
GetNextFrame(this);

View File

@ -199,7 +199,7 @@ void sub_08030338(ArmosEntity* this) {
return;
}
super->action = 6;
super->timer = 0x1a;
super->timer = 26;
super->speed = 0x300;
super->direction = 0x10;
return;

View File

@ -133,7 +133,7 @@ void sub_0803E6E0(BallChainSoldierEntity* this) {
if ((s8)this->unk_7e <= 0) {
this->unk_7e = 0;
super->action = 6;
super->timer = 0x1e;
super->timer = 30;
InitAnimationForceUpdate(super, super->animationState + 0x20);
}
}
@ -162,7 +162,7 @@ void sub_0803E75C(BallChainSoldierEntity* this) {
this->unk_7e += 5;
} else {
super->action = 8;
super->timer = 0x1e;
super->timer = 30;
InitScreenShake(8, 0);
}
}
@ -178,7 +178,7 @@ void sub_0803E7CC(BallChainSoldierEntity* this) {
this->unk_7e -= 2;
if (this->unk_7e <= 0xa) {
super->action = 0xa;
super->timer = 0x5a;
super->timer = 90;
super->direction = DirectionFromAnimationState(super->animationState);
this->unk_7c = 0;
this->unk_7f = 0xfe;
@ -189,7 +189,7 @@ void sub_0803E7CC(BallChainSoldierEntity* this) {
}
void sub_0803E818(BallChainSoldierEntity* this) {
if (super->timer) {
if (super->timer != 0) {
if (--super->timer == 0) {
COLLISION_ON(super->child);
sub_0803E94C(this, 0);

View File

@ -34,7 +34,7 @@ void Beetle_OnCollision(Entity* this) {
Beetle_OnTick(this);
} else {
this->action = 5;
this->timer = 0xb4;
this->timer = 180;
this->subtimer = 0;
COLLISION_OFF(this);
this->spritePriority.b0 = 3;
@ -166,7 +166,7 @@ void sub_08021A64(Entity* this) {
if (!sub_08021D00(this)) {
if (--this->timer == 0) {
this->action = 2;
this->timer = (Random() & 0x1f) + 0x1e;
this->timer = (Random() & 0x1F) + 30;
InitializeAnimation(this, 0);
}
@ -190,14 +190,14 @@ void sub_08021A64(Entity* this) {
void sub_08021AD8(Entity* this) {
GetNextFrame(this);
if (this->frame & 1) {
if (this->timer) {
if (this->timer != 0) {
u32 tmp;
this->timer = 0;
tmp = sub_08049F84(this, 1);
if (tmp == 0xff) {
this->action = 2;
this->timer = '\b';
this->timer = 8;
InitializeAnimation(this, 0);
return;
}
@ -223,7 +223,8 @@ void sub_08021B64(Entity* this) {
this->z.WORD = 0;
InitializeAnimation(this, 2);
} else {
int iVar4 = 1;
s32 iVar4 = 1;
if (gPlayerState.framestate != PL_STATE_JUMP && gPlayerState.framestate != PL_STATE_CAPE) {
if (sub_0807953C())
iVar4 = this->type * 3 + 8;

View File

@ -145,7 +145,7 @@ void Bobomb_OnDeath(Entity* this) {
void sub_0802C8D8(Entity* this) {
this->action = 1;
this->timer = 0x3c;
this->timer = 60;
this->subtimer = 0;
this->direction = (Random() & 0x18) | 4;
this->carryFlags = 0;
@ -271,7 +271,7 @@ void sub_0802CB68(Entity* this) {
this->speed = 0x200;
InitializeAnimation(this, (this->direction >> 4) | 2);
} else {
this->timer = 0x3c;
this->timer = 60;
this->speed = 0x80;
InitializeAnimation(this, this->direction >> 4);
}

View File

@ -126,11 +126,11 @@ void sub_0802A9A8(Entity* this) {
if (this->subtimer) {
this->subtimer--;
} else {
if (this->timer) {
if (this->timer != 0) {
if (--this->timer == 0) {
this->action = 2;
this->subAction = 0;
this->timer = 0x40;
this->timer = 64;
sub_0802ACDC(this, 8);
}
} else {
@ -147,7 +147,7 @@ void sub_0802A9A8(Entity* this) {
this->direction = 0x18;
}
this->y.HALF.HI = gRoomControls.scroll_y + 0x40;
this->timer = 0x80;
this->timer = 128;
sub_0802ADDC(this);
}
sub_0802AC40(this);
@ -160,7 +160,7 @@ void sub_0802AA40(Entity* this) {
sub_0802ACDC(this, 8);
this->field_0x7a.HALF.HI++;
}
if (this->timer) {
if (this->timer != 0) {
this->timer--;
} else {
Entity* ent = this->child;
@ -178,7 +178,7 @@ void sub_0802AA40(Entity* this) {
this->speed = 0x180;
this->field_0x7a.HALF.HI = 0;
ent->field_0x80.HALF.LO = 1;
ent->timer = 0x96;
ent->timer = 150;
}
}
}
@ -215,7 +215,7 @@ void sub_0802AAC0(Entity* this) {
#endif
} else {
this->action = 4;
this->timer = 0xc0;
this->timer = 192;
this->subtimer = 4;
this->field_0x80.HALF.LO ^= 1;
#ifndef EU
@ -236,8 +236,8 @@ void sub_0802AB40(Entity* this) {
this->speed = 0;
InitializeAnimation(this, this->type + 1);
} else {
this->timer = 0xc0;
this->subtimer = 0x4;
this->timer = 192;
this->subtimer = 4;
this->field_0x80.HALF.LO ^= 1;
}
} else if (--this->subtimer == 0) {
@ -289,7 +289,7 @@ void sub_0802AC08(Entity* this) {
if (this->frame & ANIM_DONE) {
this->action = 2;
this->subAction = 0;
this->timer = 0x40;
this->timer = 64;
this->speed = 0xc0;
sub_0802ACDC(this, 8);
sub_0802ADDC(this);
@ -373,7 +373,7 @@ void sub_0802AD54(Entity* this) {
if (this->field_0x80.HALF.HI) {
if (this->child == NULL || this->child->next == NULL) {
this->action = 4;
this->timer = 0xc0;
this->timer = 192;
this->subtimer = 4;
this->field_0x80.HALF.LO ^= 1;
}
@ -399,7 +399,7 @@ void sub_0802ADDC(Entity* this) {
void sub_0802AE24(Entity* this) {
this->action = 1;
this->timer = 0xf0;
this->timer = 240;
this->zVelocity = Q_16_16(0.5);
this->hitbox = (Hitbox*)&gUnk_080CD174;
this->collisionFlags = 3;
@ -564,7 +564,7 @@ void sub_0802B048(Entity* this) {
action = this->action;
if (action != 4 && this->field_0x80.HALF.LO) {
if (this->timer) {
if (this->timer != 0) {
if (--this->timer == 0) {
this->subtimer = 0x50;
this->field_0x82.HWORD = 0;
@ -580,7 +580,7 @@ void sub_0802B048(Entity* this) {
sub_0805EC60(this);
this->action = 4;
this->hitbox = (Hitbox*)&gUnk_080CD17C;
this->timer = 0xf;
this->timer = 15;
this->spriteSettings.draw = 0;
COLLISION_ON(this);
this->field_0x7a.HALF.HI = 0;
@ -614,7 +614,7 @@ void sub_0802B1A0(Entity* this) {
void sub_0802B1BC(Entity* this) {
Entity* ent;
if (this->timer) {
if (this->timer != 0) {
this->timer--;
}
@ -643,7 +643,7 @@ void sub_0802B1BC(Entity* this) {
void sub_0802B1BC(Entity* this) {
Entity* ent;
if (this->timer) {
if (this->timer != 0) {
this->timer--;
}

View File

@ -32,7 +32,7 @@ void sub_0803C6DC(BowMoblinEntity*);
void sub_0803C714(BowMoblinEntity*);
void sub_0803C634(BowMoblinEntity*);
u32 sub_0803C6F8(BowMoblinEntity*);
u32 sub_0803C568(BowMoblinEntity*);
bool32 sub_0803C568(BowMoblinEntity*);
void sub_0803C664(BowMoblinEntity*);
void (*const BowMoblin_Functions[])(Entity*);
@ -82,9 +82,9 @@ void sub_0803C1E0(BowMoblinEntity* this) {
this->unk_0x7a = 0;
this->unk_0x82 = 1;
if (super->timer) {
if (super->timer != 0) {
super->animationState = super->type2 << 1;
super->timer = 0x1e;
super->timer = 30;
super->speed = 0x80;
super->direction = super->type2 << 3;
sub_0803C690(this);
@ -111,7 +111,7 @@ void sub_0803C234(BowMoblinEntity* this) {
sub_0803C4B0(this);
}
} else if (sub_0803C6F8(this)) {
} else if (sub_0803C6F8(this) != 0) {
sub_0800417E(super, super->collisions);
super->animationState = ((super->direction + 4) & 0x18) >> 2;
this->unk_0x83++;
@ -124,7 +124,6 @@ void sub_0803C234(BowMoblinEntity* this) {
}
void sub_0803C2DC(BowMoblinEntity* this) {
u32 res;
u32 timer = --super->timer;
if (timer == 0) {
super->action = 3;
@ -132,11 +131,11 @@ void sub_0803C2DC(BowMoblinEntity* this) {
this->unk_0x80 = timer;
super->animationState = 0x10;
sub_0803C4B0(this);
} else if (res = sub_0803C568(this), res) {
} else if (sub_0803C568(this)) {
this->unk_0x7b |= 0x1;
}
if (super->subtimer > 0xb) {
if (super->subtimer > 11) {
if (this->unk_0x7b != 0) {
sub_0803C5F0(this);
}
@ -166,7 +165,7 @@ void sub_0803C344(BowMoblinEntity* this) {
super->action = 2;
super->speed = 0;
tmp = Random() & 0x7;
super->timer = (tmp << 1) + tmp + 0x40;
super->timer = 3 * tmp + 64;
break;
}
case 4: {
@ -180,7 +179,7 @@ void sub_0803C344(BowMoblinEntity* this) {
this->unk_0x82 = 1;
super->speed = 0x80;
tmp = (Random() & 0x7);
super->timer = (tmp << 1) + tmp + 0x22;
super->timer = 3 * tmp + 34;
break;
}
}
@ -213,6 +212,7 @@ void sub_0803C400(BowMoblinEntity* this) {
}
} else {
Entity* projectile;
switch (++super->timer) {
case 1:
super->direction = super->animationState << 2;
@ -252,13 +252,13 @@ void sub_0803C4B0(BowMoblinEntity* this) {
dir += gUnk_080CFFAC[Random() & 0xf];
} else {
dir += gUnk_080CFFAC[Random() & 0x7];
super->timer += 0x10;
super->timer += 16;
this->unk_0x83--;
}
dir = (super->direction = (dir + 4) & 0x18) >> 2;
}
} else {
super->timer = 0xc;
super->timer = 12;
super->speed = super->subtimer;
dir = super->direction >> 2;
}
@ -268,13 +268,13 @@ void sub_0803C4B0(BowMoblinEntity* this) {
}
}
u32 sub_0803C568(BowMoblinEntity* this) {
bool32 sub_0803C568(BowMoblinEntity* this) {
if (this->unk_0x81 == 0) {
Entity* ent = sub_08049DF4(1);
if (ent != NULL) {
if (this->unk_0x82 == 2) {
if (sub_0806FC80(super, ent, 0x30)) {
return 1;
return TRUE;
}
}
@ -282,13 +282,13 @@ u32 sub_0803C568(BowMoblinEntity* this) {
u32 direction = (GetFacingDirection(super, ent) + 4) & 0x18;
direction = direction >> 2;
if (direction == super->animationState) {
return 1;
return TRUE;
}
}
}
}
return 0;
return FALSE;
}
void sub_0803C5C4(BowMoblinEntity* this) {
@ -319,13 +319,13 @@ void sub_0803C634(BowMoblinEntity* this) {
super->direction = super->animationState << 2;
this->unk_0x83 = 0;
sub_0803C664(this);
super->timer <<= 1;
super->timer *= 2;
this->unk_0x82 = 4;
}
void sub_0803C664(BowMoblinEntity* this) {
super->action = 3;
super->timer = 0x20;
super->timer = 32;
super->subtimer = 0;
this->unk_0x80 = 0;
this->unk_0x7b = 0;
@ -402,7 +402,7 @@ void (*const gUnk_080CFF90[])(BowMoblinEntity*) = {
};
const s8 gUnk_080CFFA4[8] = {
0x18, 0x20, 0x30, 0x40, 0x60, 0x6c, 0x78, 0x91,
24, 32, 48, 64, 96, 108, 120, 145,
};
const s8 gUnk_080CFFAC[16] = {

View File

@ -58,7 +58,7 @@ void BusinessScrub_OnCollision(Entity* this) {
if (this->hitType == 1 && (this->contactFlags & 0x7f) == 0x42) {
this->action = 3;
this->subAction = 0;
this->timer = 0x28;
this->timer = 40;
COLLISION_OFF(this);
sub_080290E0(this, 4);
pEVar1 = CreateFx(this, FX_BUSH, 0);
@ -82,7 +82,7 @@ void sub_08028994(Entity* this) {
sub_08028E9C(this);
if ((*(u8*)this->field_0x7c.WORD & 1) || CheckFlags(this->field_0x86.HWORD)) {
this->action = 4;
this->timer = 0x78;
this->timer = 120;
this->spritePriority.b1 = 1;
sub_0802925C(this);
sub_080290E0(this, 0);
@ -96,7 +96,7 @@ void sub_08028994(Entity* this) {
}
void sub_08028A48(Entity* this) {
if (this->timer) {
if (this->timer != 0) {
this->timer--;
} else if (sub_08028F98(this, 0)) {
sub_08029078(this);
@ -114,8 +114,8 @@ void sub_08028A74(Entity* this) {
unk = 1;
if (this->frame & ANIM_DONE) {
this->subAction = 1;
this->timer = 0x3c;
this->subtimer = 0x10;
this->timer = 60;
this->subtimer = 16;
sub_08028FDC(this);
sub_080290E0(this, 1);
}
@ -124,7 +124,7 @@ void sub_08028A74(Entity* this) {
unk = 1;
if (--this->timer == 0) {
this->subAction = 2;
this->timer = 0x20;
this->timer = 32;
this->subtimer = 0;
sub_08028FDC(this);
sub_080290E0(this, 2);
@ -152,7 +152,7 @@ void sub_08028A74(Entity* this) {
unk = 2;
if (this->frame & ANIM_DONE) {
this->subAction = 4;
this->timer = 0x50;
this->timer = 80;
sub_080290E0(this, 1);
}
break;
@ -161,13 +161,13 @@ void sub_08028A74(Entity* this) {
if (--this->timer == 0) {
if (sub_08028F98(this, 0)) {
this->subAction = 1;
this->timer = 0x3c;
this->subtimer = 0x10;
this->timer = 60;
this->subtimer = 16;
sub_08028FDC(this);
} else {
sub_08028FFC(this);
this->subAction = 0;
this->timer = 0x50;
this->timer = 80;
this->subtimer = 0;
}
return;
@ -178,7 +178,7 @@ void sub_08028A74(Entity* this) {
if (!sub_08028F98(this, unk)) {
sub_08028FFC(this);
this->subAction = 0;
this->timer = 0x50;
this->timer = 80;
this->subtimer = 0;
}
}
@ -203,7 +203,7 @@ void sub_08028BC4(Entity* this) {
if (this->frame & ANIM_DONE) {
this->action = 4;
this->subAction = 0;
this->timer = 0x1e;
this->timer = 30;
this->subtimer = 5;
sub_080290E0(this, 0);
iVar1 = Create0x68FX(this, FX_STARS);
@ -227,7 +227,7 @@ void sub_08028F0C(Entity*);
void sub_08028C84(Entity* this) {
if (--this->timer == 0) {
this->timer = 0x30;
this->timer = 48;
if (this->subtimer) {
if (--this->subtimer == 0) {
sub_0804AA1C(this);
@ -292,7 +292,7 @@ void sub_08028CE8(Entity* this) {
sub_0800445C(this);
this->action = 4;
this->timer = 0x30;
this->timer = 48;
sub_080290E0(this, 0);
}
@ -370,7 +370,7 @@ void sub_08028F0C(Entity* this) {
this->direction = (GetAnimationState(this) << 3);
sub_080290E0(this, 3);
this->field_0x80.HALF.LO = 1;
this->timer = 0x20;
this->timer = 32;
this->subtimer = 0;
if (sub_08029198(offer)) {
dialog = offer->field_0x6;
@ -452,12 +452,13 @@ void sub_080290E0(Entity* this, u32 param_2) {
void sub_080290FC(Entity* this) {
if (this->timer != 0) {
if (--this->timer < 0x10 && (this->timer & 1) == 0) {
s32 sVar3 = (this->direction & 0x10) ? -1 : 1;
if ((this->direction & 8)) {
this->x.HALF.HI += (this->timer & 8) ? -sVar3 : sVar3;
this->timer--;
if ((this->timer < 16) && ((this->timer & 1) == 0)) {
s32 sVar3 = ((this->direction & 0x10) != 0) ? -1 : 1;
if ((this->direction & 8) != 0) {
this->x.HALF.HI += ((this->timer & 8) != 0) ? -sVar3 : sVar3;
} else {
this->y.HALF.HI += (this->timer & 8) ? sVar3 : -sVar3;
this->y.HALF.HI += ((this->timer & 8) != 0) ? sVar3 : -sVar3;
}
}
}

View File

@ -44,7 +44,7 @@ void BusinessScrubPrologue_OnCollision(BusinessScrubPrologueEntity* this) {
if ((super->contactFlags & 0x7f) == 0x42) {
super->action = 4;
super->subAction = 0;
super->timer = 0x28;
super->timer = 40;
super->flags &= ~ENT_COLLIDE;
sub_08046030(this, 4);
ent = CreateFx(super, FX_BUSH, 0);
@ -69,7 +69,7 @@ void sub_08045C3C(BusinessScrubPrologueEntity* this) {
super->animationState = 0;
super->direction = 0x10;
super->action = 5;
super->timer = 0x78;
super->timer = 120;
super->spritePriority.b1 = 1;
super->spriteSettings.draw = 1;
sub_08046030(this, 0);
@ -80,7 +80,7 @@ void sub_08045C3C(BusinessScrubPrologueEntity* this) {
void sub_08045CA4(BusinessScrubPrologueEntity* this) {
super->spriteSettings.draw = 0;
if (super->timer) {
if (super->timer != 0) {
super->timer--;
} else if (sub_08045F54(this, 0)) {
sub_08045FF0(this);
@ -102,8 +102,8 @@ void sub_08045CE0(BusinessScrubPrologueEntity* this) {
r6 = 1;
if (super->frame & ANIM_DONE) {
super->subAction = 1;
super->timer = 0x3c;
super->subtimer = 0x10;
super->timer = 60;
super->subtimer = 16;
sub_08045F98(this);
sub_08046030(this, 1);
}
@ -112,7 +112,7 @@ void sub_08045CE0(BusinessScrubPrologueEntity* this) {
r6 = 1;
if (--super->timer == 0) {
super->subAction = 2;
super->timer = 0x20;
super->timer = 32;
super->subtimer = 0;
sub_08045F98(this);
sub_08046030(this, 2);
@ -135,7 +135,7 @@ void sub_08045CE0(BusinessScrubPrologueEntity* this) {
r6 = 2;
if (super->frame & ANIM_DONE) {
super->subAction = 4;
super->timer = 0x50;
super->timer = 80;
sub_08046030(this, 1);
}
break;
@ -144,12 +144,12 @@ void sub_08045CE0(BusinessScrubPrologueEntity* this) {
if (--super->timer == 0) {
if (sub_08045F54(this, 0)) {
super->subAction = 1;
super->timer = 0x3c;
super->subtimer = 0x10;
super->timer = 60;
super->subtimer = 16;
sub_08045F98(this);
} else {
sub_08045FA0(this);
super->timer = 0x50;
super->timer = 80;
super->subtimer = 0;
}
}
@ -210,7 +210,7 @@ void sub_08045ED4(BusinessScrubPrologueEntity* this) {
void sub_08045EDC(BusinessScrubPrologueEntity* this) {
if (super->subAction == 0) {
super->subAction++;
super->timer = 0x20;
super->timer = 32;
super->subtimer = 0;
sub_08045F98(this);
sub_08046030(this, 2);
@ -283,8 +283,8 @@ void sub_08046030(BusinessScrubPrologueEntity* this, u32 arg2) {
}
void sub_0804604C(BusinessScrubPrologueEntity* this) {
if (super->timer) {
if (--super->timer <= 0xf) {
if (super->timer != 0) {
if (--super->timer <= 15) {
super->spriteOffsetY = gUnk_080D1A3E[super->timer];
}
}

View File

@ -30,7 +30,7 @@ void sub_0802B530(Entity* this) {
}
void sub_0802B540(Entity* this) {
if (this->timer) {
if (this->timer != 0) {
this->timer--;
} else {
u32 direction = sub_0804A024(this, 1, 0xc);

View File

@ -174,7 +174,7 @@ void sub_0801F0C8(Entity* this) {
GetNextFrame(this);
if (this->frame & ANIM_DONE) {
this->action = 3;
this->timer = (Random() & 3) + 0xc;
this->timer = (Random() & 3) + 12;
this->subtimer = Random();
this->direction = sub_08049F84(this, 1);
COLLISION_ON(this);
@ -198,7 +198,7 @@ void sub_0801F12C(Entity* this) {
this->action = 4;
Chuchu_JumpAtPlayer(this);
} else if (PlayerInRange(this, 1, 0x48)) {
this->timer = (Random() & 3) + 0xc;
this->timer = (Random() & 3) + 12;
} else {
sub_0801F328(this);
}
@ -253,7 +253,7 @@ void sub_0801F270(Entity* this) {
if (sub_0801FBD0(this))
return;
if (--this->timer)
if (--this->timer != 0)
return;
if (this->field_0x80.HALF.HI == 0) {
@ -298,7 +298,7 @@ void sub_0801F340(Entity* this) {
void sub_0801F360(Entity* this) {
this->action = 7;
this->timer = (Random() & 0x38) + 0xb4;
this->timer = (Random() & 0x38) + 180;
this->subtimer = Random();
this->direction = sub_08049F84(this, 1);
this->spritePriority.b1 = 2;

View File

@ -125,7 +125,7 @@ void sub_0803298C(CrowEntity* this) {
super->action = 2;
this->unk_84 = 0;
super->timer = 0x10;
super->timer = 16;
this->unk_81 = 2;
sub_08032AF4(this);
}
@ -168,7 +168,7 @@ void sub_08032A48(CrowEntity* this) {
void sub_08032AB0(CrowEntity* this) {
u32 dir;
if (--super->timer)
if (--super->timer != 0)
return;
this->unk_80 = super->direction;
@ -200,13 +200,13 @@ void sub_08032B38(CrowEntity* this) {
u32 temp;
switch (this->unk_84) {
case 0:
if (super->timer & 1) {
if ((super->timer & 1) != 0) {
super->z.HALF.HI--;
}
if (--super->timer == 0) {
this->unk_84 = 1;
super->timer = 0x18;
super->timer = 24;
COLLISION_ON(super);
this->unk_81 = 2;
sub_08032AF4(this);

View File

@ -103,7 +103,7 @@ void sub_08038DC0(CuccoAggrEntity* this) {
void sub_08038DD8(CuccoAggrEntity* this) {
super->subAction = 1;
super->timer = 0x10;
super->timer = 16;
super->subtimer = gUnk_080CF7BC[super->type];
COLLISION_OFF(super);
super->spritePriority.b1 = 0;
@ -126,7 +126,7 @@ void sub_08038E18(CuccoAggrEntity* this) {
}
if (--super->timer == 0) {
super->timer = 0x10;
super->timer = 16;
super->spriteSettings.flipX ^= (Random() & 1);
CuccoAggr_CreateFx(this);
}

View File

@ -60,11 +60,11 @@ void sub_0802209C(Entity* this) {
if (this->timer == 0) {
if (CheckPlayerProximity(this->field_0x78.HWORD, this->field_0x7a.HWORD, 0x10, 0x10)) {
this->action = 2;
this->timer = 0x12;
this->timer = 18;
InitializeAnimation(this, this->type2 + 4);
}
} else {
this->timer = this->timer - 1;
this->timer--;
}
}
@ -80,7 +80,7 @@ void sub_080220F0(Entity* this) {
u32 i;
this->action = 4;
this->timer = 0x78;
this->timer = 120;
this->damage = 0;
off = gUnk_080CB76C[this->type2];
for (i = 0; i < 6; i++, off++) {
@ -109,7 +109,7 @@ void sub_08022198(Entity* this) {
GetNextFrame(this);
if (this->frame & ANIM_DONE) {
this->action = 1;
this->timer = 0x5a;
this->timer = 90;
}
}

View File

@ -184,7 +184,7 @@ void Enemy4D_Action5(Enemy4DEntity* this) {
if ((tmp * 0x1000000) < 1) {
this->unk_7e = 0;
super->action = 6;
super->timer = 0x0f;
super->timer = 15;
InitAnimationForceUpdate(super, super->animationState + 0x20);
}
}
@ -218,7 +218,7 @@ void Enemy4D_Action7(Enemy4DEntity* this) {
this->unk_7e += 5;
} else {
super->action = 8;
super->timer = 0x1e;
super->timer = 30;
InitScreenShake(8, 0);
}
}
@ -235,7 +235,7 @@ void Enemy4D_Action9(Enemy4DEntity* this) {
tmp = this->unk_7e = this->unk_7e - 2;
if (tmp < 0xb) {
super->action = 0xa;
super->timer = 0x3c;
super->timer = 60;
super->direction = super->animationState << 3;
this->unk_7c = 0;
this->unk_7f = 0xfe;

View File

@ -111,7 +111,7 @@ void sub_08040B9C(Enemy50Entity* this) {
super->flags |= 0x80;
super->health = 0xff;
super->action = 0xa;
super->timer = 0x3c;
super->timer = 60;
}
this->unk_7a = super->health;
}
@ -210,7 +210,7 @@ void Enemy50_Init(Enemy50Entity* this) {
void Enemy50_Action1(Enemy50Entity* this) {
if (sub_080411E8(this)) {
super->action = 2;
super->timer = 0x0f;
super->timer = 15;
}
}
@ -276,7 +276,7 @@ void Enemy50_Action6(Enemy50Entity* this) {
ProcessMovement1(super);
} else {
super->action = 7;
super->timer = 0x1e;
super->timer = 30;
}
}
}

View File

@ -85,7 +85,7 @@ void Enemy64_Init(Enemy64Entity* this) {
super->child = tail;
super->action = 1;
super->subAction = 0;
super->timer = 0x3c;
super->timer = 60;
super->direction = 0xc0;
super->animationState = 0xc0;
super->speed = 0x300;
@ -193,7 +193,7 @@ void Enemy64_Action2_SubAction2(Enemy64Entity* this) {
gRoomControls.origin_y + 0x80),
((((uVar3 + 2) & 0x1c) - (super->direction >> 3)) & 0xf) == 8)) {
super->subAction = 4;
super->timer = 0x3c;
super->timer = 60;
super->subtimer = 7;
}
sub_08049944(this);
@ -210,7 +210,7 @@ void Enemy64_Action2_SubAction3(Enemy64Entity* this) {
if (super->timer == 0) {
if ((uVar2 >> 0x18 & 0x1f) == 0) {
super->subAction = 4;
super->timer = 0x5a;
super->timer = 90;
}
} else {
if (sub_08049A8C(this)) {
@ -234,9 +234,9 @@ void Enemy64_Action2_SubAction4(Enemy64Entity* this) {
super->speed += 0x40;
} else {
super->subAction = 3;
super->timer = 0xa;
super->timer = 10;
}
} else if (super->timer == 0x50) {
} else if (super->timer == 80) {
Entity* enemy = CreateEnemy(GYORG_MALE_EYE, Random() & 3);
if (enemy != NULL) {
enemy->parent = super;
@ -277,7 +277,7 @@ void Enemy64_Action3_SubAction0(Enemy64Entity* this) {
void Enemy64_Action3_SubAction1(Enemy64Entity* this) {
if (EntityWithinDistance(super, gRoomControls.origin_x + 0xa8, gRoomControls.origin_y + 0x80, 0x28)) {
super->subAction = 2;
super->timer = 0x2d;
super->timer = 45;
this->unk_74 = gUnk_080D29B8[Random() & 7] << 0x18 >> 0x18;
this->unk_76 = super->direction << 8;
}
@ -290,7 +290,7 @@ void Enemy64_Action3_SubAction2(Enemy64Entity* this) {
sub_08049998(this, ((0x100 - super->direction) & 0xff) << 8);
if (--super->timer == 0) {
super->subAction = 3;
super->timer = 0x1e;
super->timer = 30;
}
}
@ -312,7 +312,7 @@ void Enemy64_Action4_SubAction0(Enemy64Entity* this) {
if (PlayerCanBeMoved() && gPlayerEntity.z.HALF.HI == 0) {
SetPlayerControl(CONTROL_2);
super->subAction = 2;
super->timer = 0x1e;
super->timer = 30;
} else {
super->subAction = 1;
}
@ -331,7 +331,7 @@ void Enemy64_Action4_SubAction1(Enemy64Entity* this) {
void Enemy64_Action4_SubAction2(Enemy64Entity* this) {
if (--super->timer == 0) {
super->subAction = 3;
super->timer = 0xb4;
super->timer = 180;
super->speed = 0x100;
super->direction -= 0x40;
}
@ -341,7 +341,7 @@ void Enemy64_Action4_SubAction2(Enemy64Entity* this) {
void Enemy64_Action4_SubAction3(Enemy64Entity* this) {
sub_08049AB0(this);
if (--super->timer == 0) {
super->timer = 0x1e;
super->timer = 30;
super->subAction = 4;
super->speed = 0x400;
super->direction = super->animationState;
@ -389,7 +389,7 @@ void Enemy64_Action4_SubAction5(Enemy64Entity* this) {
void Enemy64_Action4_SubAction6(Enemy64Entity* this) {
if (gFadeControl.active == 0) {
super->subAction = 7;
super->timer = 0xa0;
super->timer = 160;
SoundReq(SFX_SECRET);
SetFlag(0x7c);
SetPlayerControl(CONTROL_1);
@ -399,19 +399,19 @@ void Enemy64_Action4_SubAction6(Enemy64Entity* this) {
void Enemy64_Action4_SubAction7(Enemy64Entity* this) {
if (--super->timer == 0) {
DeleteThisEntity();
} else if (super->timer == 0x10) {
} else if (super->timer == 16) {
sub_0807B7D8(0x36, 0xca, 1);
SetTile(0x4081, 0xca, 2);
SoundReq(SFX_HEART_GET);
} else if (super->timer == 0x18) {
} else if (super->timer == 24) {
sub_0807B7D8(0x36, 0x8a, 1);
SetTile(0x4081, 0x8a, 2);
SoundReq(SFX_HEART_GET);
} else if (super->timer == 0x20) {
} else if (super->timer == 32) {
sub_0807B7D8(0x36, 0x4a, 1);
SetTile(0x4081, 0x4a, 2);
SoundReq(SFX_HEART_GET);
} else if (super->timer == 0x28) {
} else if (super->timer == 40) {
sub_0807B7D8(0x36, 10, 1);
SetTile(0x4081, 10, 2);
SoundReq(SFX_HEART_GET);
@ -461,7 +461,7 @@ void sub_080499F0(Enemy64Entity* this) {
}
bool32 sub_08049A8C(Enemy64Entity* this) {
if (--super->timer == 0 && (Random() & 0xf) != 0) {
if ((--super->timer == 0) && ((Random() & 0xf) != 0)) {
return TRUE;
} else {
return FALSE;

View File

@ -174,7 +174,7 @@ void Eyegore_Action2(EyegoreEntity* this) {
} else {
if (sub_08049FDC(super, 1)) {
super->action = 3;
super->timer = 0x3c;
super->timer = 60;
super->direction = (CalculateDirectionTo(super->x.HALF.HI + super->hitbox->offset_x,
super->y.HALF.HI + super->hitbox->offset_y,
gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI) +
@ -469,7 +469,7 @@ void sub_08031250(EyegoreEntity* this) {
void sub_08031320(EyegoreEntity* this) {
super->action = 2;
super->flags &= ~ENT_COLLIDE;
super->timer = 0x1e;
super->timer = 30;
super->hitbox = (Hitbox*)&gUnk_080FD308;
InitializeAnimation(super, 10);
}

View File

@ -121,7 +121,7 @@ void sub_08045524(Entity* this) {
this->timer = Random() & 3;
this->direction = DirectionRound(tmp);
} else {
if (this->timer) {
if (this->timer != 0) {
this->timer--;
return;
}

View File

@ -136,7 +136,7 @@ void sub_08039DD8(FlyingSkullEntity* this) {
if (EntityWithinDistance(super, ent->x.HALF.HI, ent->y.HALF.HI, 0x30)) {
if (super->type == 1) {
super->action = 3;
super->timer = 0x1e;
super->timer = 30;
} else {
ent = CreateEnemy(STALFOS, super->type - 2);
if (ent != NULL) {

View File

@ -172,10 +172,9 @@ void Ghini_Action1(GhiniEntity* this) {
void Ghini_Action2(GhiniEntity* this) {
if (sub_0803F5A8(this) == 0) {
sub_0803F50C(this);
} else {
if (--super->timer == 0) {
} else if (--super->timer == 0) {
super->action = 3;
super->timer = 0x1e;
super->timer = 30;
if (sub_08049DF4(1) != NULL) {
super->direction = GetFacingDirection(super, gUnk_020000B0);
} else {
@ -185,7 +184,6 @@ void Ghini_Action2(GhiniEntity* this) {
InitializeAnimation(super, super->animationState + 1);
}
}
}
void Ghini_Action3(GhiniEntity* this) {
GetNextFrame(super);
@ -223,8 +221,7 @@ void Ghini_Action6(GhiniEntity* this) {
if (sub_0803F5A8(this) == 0) {
sub_0803F51C(this);
} else {
if (sub_08049DF4(1) != NULL) {
} else if (sub_08049DF4(1) != NULL) {
tmp = super->timer + 1;
super->timer = tmp;
if ((tmp & gUnk_080D0970[tmp * 0x1000000 >> 0x1e]) == 0) {
@ -235,8 +232,7 @@ void Ghini_Action6(GhiniEntity* this) {
GetNextFrame(super);
} else {
super->action = 7;
super->timer = 0x1e;
}
super->timer = 30;
}
}
@ -331,14 +327,12 @@ bool32 sub_0803F5A8(GhiniEntity* this) {
bool32 sub_0803F5D4(GhiniEntity* this) {
if (this->unk_7c != 0) {
this->unk_7c--;
} else {
if ((sub_08049FDC(super, 1)) &&
} else if ((sub_08049FDC(super, 1)) &&
((sub_0806FD54(super) ||
((0xf < (s16)gArea.lightLevel && (EntityInRectRadius(super, gUnk_020000B0, 0x70, 0x48))))))) {
sub_0803F630(this);
return TRUE;
}
}
return FALSE;
}

View File

@ -20,8 +20,7 @@ typedef struct {
u16 field_0x78;
u16 field_0x7a;
u8 field_0x7c;
u8 field_0x7d;
u8 filler2[2];
u8 filler2[3];
Entity* field_0x80;
Entity* field_0x84;
} GibdoEntity;
@ -32,11 +31,11 @@ void sub_08037B10(GibdoEntity*);
void sub_0803797C(GibdoEntity*);
void sub_080379BC(GibdoEntity*);
void Gibdo_MoveObjectsToStalfos(GibdoEntity*, Entity*);
u32 sub_08037810(GibdoEntity*);
bool32 sub_08037810(GibdoEntity*);
void sub_080377B0(GibdoEntity*);
u32 sub_080378B0(GibdoEntity*);
u32 sub_08037914(GibdoEntity*);
u32 sub_080379EC(GibdoEntity*);
bool32 sub_080378B0(GibdoEntity*);
bool32 sub_08037914(GibdoEntity*);
bool32 sub_080379EC(GibdoEntity*);
void sub_08037A58(GibdoEntity*);
void sub_08037ACC(GibdoEntity*);
void Gibdo_CreateObjects(GibdoEntity*);
@ -56,13 +55,12 @@ void Gibdo_OnTick(GibdoEntity* this) {
}
void Gibdo_OnCollision(GibdoEntity* this) {
u8 x;
if (super->contactFlags == 0x87) {
if (super->action == 0x6) {
sub_08037ACC(this);
}
super->action = 0x8;
super->timer = 0x3c;
super->timer = 60;
COLLISION_OFF(super);
Gibdo_CreateObjects(this);
} else {
@ -71,12 +69,14 @@ void Gibdo_OnCollision(GibdoEntity* this) {
sub_08037A14(this);
} else {
if ((u8)(super->action - 1) < 2) {
u8 dir;
super->action = 1;
x = DirectionRoundUp(DirectionTurnAround(super->knockbackDirection));
super->direction = x;
super->animationState = x >> 3;
dir = DirectionRoundUp(DirectionTurnAround(super->knockbackDirection));
super->direction = dir;
super->animationState = dir >> 3;
InitAnimationForceUpdate(super, super->animationState);
if (sub_08037810(this) != 0) {
if (sub_08037810(this)) {
super->timer = 4;
}
}
@ -103,66 +103,58 @@ void sub_08037558(GibdoEntity* this) {
}
void sub_08037580(GibdoEntity* this) {
if (sub_08037810(this) == 0) {
if (!(--this->field_0x74)) {
if (!sub_08037810(this)) {
if (--this->field_0x74 == 0) {
sub_080377B0(this);
}
}
}
void sub_080375A4(GibdoEntity* this) {
if (sub_080378B0(this) == 0) {
if (sub_08037810(this) == 0) {
if (!(--this->field_0x74)) {
if (!sub_080378B0(this) && !sub_08037810(this)) {
if (--this->field_0x74 == 0) {
sub_08037794(this);
} else {
UpdateAnimationSingleFrame(super);
if (ProcessMovement0(super) == 0) {
if (!(--super->subtimer)) {
if (!ProcessMovement0(super)) {
if (--super->subtimer == 0) {
sub_080379BC(this);
}
}
}
}
}
}
void sub_080375F8(GibdoEntity* this) {
if (sub_080378B0(this) == 0) {
if (!(--super->timer)) {
if (!sub_080378B0(this) && (--super->timer == 0)) {
super->action = 4;
super->timer = 0x18;
super->timer = 24;
InitAnimationForceUpdate(super, super->animationState + 4);
}
}
}
void sub_08037624(GibdoEntity* this) {
if (sub_080378B0(this) == 0) {
if (sub_08037914(this) == 0) {
if (!(--this->field_0x74)) {
if (!sub_080378B0(this) && !sub_08037914(this)) {
if (--this->field_0x74 == 0) {
sub_08037794(this);
} else {
UpdateAnimationSingleFrame(super);
UpdateAnimationSingleFrame(super);
if (ProcessMovement0(super) == 0) {
if (!(--super->subtimer)) {
if (!ProcessMovement0(super)) {
if (--super->subtimer == 0) {
sub_080379BC(this);
}
} else {
if (!(--super->timer)) {
} else if (--super->timer == 0) {
sub_0803797C(this);
}
}
}
}
}
}
void sub_08037690(GibdoEntity* this) {
UpdateAnimationSingleFrame(super);
if ((super->frame & ANIM_DONE) != 0) {
this->field_0x77 = 0x14;
this->field_0x77 = 20;
sub_08037794(this);
} else {
if ((super->frame & 1) != 0) {
@ -173,14 +165,13 @@ void sub_08037690(GibdoEntity* this) {
}
void sub_080376D0(GibdoEntity* this) {
u8* x;
if (sub_080379EC(this) == 0) {
if (!sub_080379EC(this)) {
ResetPlayerItem();
gPlayerState.mobility = gPlayerState.mobility | 0x80;
gPlayerState.field_0xa = gPlayerState.field_0xa | 0x80;
CopyPositionAndSpriteOffset(&gPlayerEntity, super);
UpdateAnimationSingleFrame(super);
if ((super->frame & 0x1) != 0) {
if ((super->frame & 1) != 0) {
if (--this->field_0x7c == 0) {
sub_08037A58(this);
} else {
@ -200,12 +191,12 @@ void sub_0803773C(GibdoEntity* this) {
// Turn into Stalfos
void sub_0803775C(GibdoEntity* this) {
Entity* x;
if (!(--super->timer)) {
x = CreateEnemy(STALFOS, 0);
if (x != 0) {
sub_0804A4E4(super, x);
Gibdo_MoveObjectsToStalfos(this, x);
Entity* stalfos;
if (--super->timer == 0) {
stalfos = CreateEnemy(STALFOS, 0);
if (stalfos != NULL) {
sub_0804A4E4(super, stalfos);
Gibdo_MoveObjectsToStalfos(this, stalfos);
}
DeleteEntity(super);
}
@ -213,40 +204,41 @@ void sub_0803775C(GibdoEntity* this) {
void sub_08037794(GibdoEntity* this) {
super->action = 1;
this->field_0x74 = 0x1e;
this->field_0x74 = 30;
super->hitType = 0x26;
InitAnimationForceUpdate(super, super->animationState);
}
void sub_080377B0(GibdoEntity* this) {
u32 r1;
u32 r2;
u32 rand1;
u32 rand2;
super->action = 2;
super->subtimer = 8;
r1 = Random();
this->field_0x74 = (r1 & 0x38) + 0x78;
rand1 = Random();
this->field_0x74 = (rand1 & 0x38) + 120;
super->speed = 0x40;
r2 = Random();
if (!sub_08049FA0(super) && (r2 & 3)) {
rand2 = Random();
if (!sub_08049FA0(super) && ((rand2 & 3) != 0)) {
super->direction = DirectionRoundUp(sub_08049EE4(super));
} else {
super->direction = DirectionRound(r2);
super->direction = DirectionRound(rand2);
}
super->animationState = super->direction / 8;
InitAnimationForceUpdate(super, super->animationState + 4);
}
u32 sub_08037810(GibdoEntity* this) {
u32 x;
u32 y;
bool32 sub_08037810(GibdoEntity* this) {
u32 dir;
if (this->field_0x76 == 0) {
if (sub_08049FDC(super, 1) != 0) {
if (EntityWithinDistance(super, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x40) != 0) {
x = GetFacingDirection(super, gUnk_020000B0);
if (((x - super->direction + 6) & 0x1f) <= 0xc) {
if (sub_08049FDC(super, 1) &&
EntityWithinDistance(super, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x40)) {
dir = GetFacingDirection(super, gUnk_020000B0);
if (((dir - super->direction + 6) & 0x1f) <= 0xc) {
super->action = 3;
super->timer = 0x18;
super->subtimer = 0x8;
super->timer = 24;
super->subtimer = 8;
super->speed = 0xc0;
super->direction = DirectionRoundUp(GetFacingDirection(super, gUnk_020000B0));
super->animationState = super->direction >> 3;
@ -254,58 +246,57 @@ u32 sub_08037810(GibdoEntity* this) {
this->field_0x78 = gUnk_020000B0->x.HALF.HI;
this->field_0x7a = gUnk_020000B0->y.HALF.HI;
InitAnimationForceUpdate(super, super->animationState);
return 1;
}
return TRUE;
}
}
} else {
this->field_0x76--;
}
return 0;
return FALSE;
}
u32 sub_080378B0(GibdoEntity* this) {
bool32 sub_080378B0(GibdoEntity* this) {
if (this->field_0x77 == 0) {
if (sub_08049DF4(1) != 0) {
if (sub_08049DF4(1) != NULL) {
if (sub_0804A044(super, gUnk_020000B0, 0xa) == super->direction)
if (EntityWithinDistance(super, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x18) != 0) {
if (EntityWithinDistance(super, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x18)) {
super->action = 5;
super->speed = 0x100;
InitAnimationForceUpdate(super, super->animationState + 8);
return 1;
return TRUE;
}
}
} else {
this->field_0x77--;
}
return 0;
return FALSE;
}
u32 sub_08037914(GibdoEntity* this) {
if (sub_08049FDC(super, 1) != 0) {
if (EntityWithinDistance(gUnk_020000B0, this->field_0x78, this->field_0x7a, 0x28) == 0) {
bool32 sub_08037914(GibdoEntity* this) {
if (sub_08049FDC(super, 1)) {
if (!EntityWithinDistance(gUnk_020000B0, this->field_0x78, this->field_0x7a, 0x28)) {
this->field_0x78 = gUnk_020000B0->x.HALF_U.HI;
this->field_0x7a = gUnk_020000B0->y.HALF_U.HI;
sub_0803797C(this);
return 0;
return FALSE;
}
if (EntityWithinDistance(super, this->field_0x78, this->field_0x7a, 0x8) == 0) {
return 0;
if (!EntityWithinDistance(super, this->field_0x78, this->field_0x7a, 0x8)) {
return FALSE;
}
this->field_0x76 = 0x3c;
this->field_0x76 = 60;
}
sub_08037794(this);
return 1;
return TRUE;
}
void sub_0803797C(GibdoEntity* this) {
u32 m;
super->timer = 0x18;
super->timer = 24;
super->subtimer = 8;
m = super->direction =
(CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, this->field_0x78, this->field_0x7a) + 4) & 0x18;
;
m = m / 8;
m >>= 3;
if (m != super->animationState) {
super->animationState = m;
InitAnimationForceUpdate(super, m + 4);
@ -313,29 +304,30 @@ void sub_0803797C(GibdoEntity* this) {
}
void sub_080379BC(GibdoEntity* this) {
u32 r;
super->timer = 0x18;
super->subtimer = 0x8;
r = Random();
super->animationState = ((super->animationState + (r & 2)) - 1) & 3;
u32 rand;
super->timer = 24;
super->subtimer = 8;
rand = Random();
super->animationState = ((super->animationState + (rand & 2)) - 1) & 3;
super->direction = DirectionFromAnimationState(super->animationState);
InitAnimationForceUpdate(super, super->animationState + 4);
}
u32 sub_080379EC(GibdoEntity* this) {
bool32 sub_080379EC(GibdoEntity* this) {
if (sub_0807953C() != 0) {
if (!(--super->timer)) {
if (--super->timer == 0) {
sub_08037A58(this);
return 1;
return TRUE;
}
}
return 0;
return FALSE;
}
void sub_08037A14(GibdoEntity* this) {
super->action = 6;
super->timer = 0x18;
super->spritePriority.b0 = (super->spritePriority.b0 & (super->timer - 0x20));
super->timer = 24;
super->spritePriority.b0 &= super->timer - 32;
super->spritePriority.b0 |= 3;
super->flags2 &= 0xfe;
this->field_0x7c = 5;
@ -357,14 +349,14 @@ void sub_08037A58(GibdoEntity* this) {
super->knockbackDirection = DirectionFromAnimationState(super->animationState) ^ 0x10;
super->knockbackDuration = 8;
super->knockbackSpeed = 0x180;
this->field_0x76 = 0x3c;
this->field_0x76 = 60;
InitAnimationForceUpdate(super, super->animationState + 0x10);
}
void sub_08037ACC(GibdoEntity* this) {
gPlayerState.flags &= ~PL_DISABLE_ITEMS;
COLLISION_ON(&gPlayerEntity);
gPlayerEntity.iframes = 0x1e;
gPlayerEntity.iframes = 30;
gPlayerEntity.knockbackDirection = DirectionFromAnimationState(super->animationState);
gPlayerEntity.knockbackDuration = 4;
gPlayerEntity.knockbackSpeed = 0x180;
@ -372,63 +364,67 @@ void sub_08037ACC(GibdoEntity* this) {
// Damage player maybe?
void sub_08037B10(GibdoEntity* this) {
u32 h;
u32 health;
gPlayerEntity.iframes = 0xc;
h = ModHealth(-8);
health = ModHealth(-8);
SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6);
if (h == 0) {
if (health == 0) {
sub_08037A58(this);
this->field_0x76 = 0xf0;
this->field_0x76 = 240;
}
}
void Gibdo_CreateObjects(GibdoEntity* this) {
Entity* E;
E = CreateObject(OBJECT_2A, 3, 0);
if (E != 0) {
E->type2 = super->timer;
E->spritePriority.b0 = 3;
E->spriteOffsetX = 0;
E->spriteOffsetY = 0xfc;
E->parent = super;
Entity* object;
object = CreateObject(OBJECT_2A, 3, 0);
if (object != NULL) {
object->type2 = super->timer;
object->spritePriority.b0 = 3;
object->spriteOffsetX = 0;
object->spriteOffsetY = 0xfc;
object->parent = super;
}
this->field_0x80 = E;
E = CreateObject(OBJECT_2A, 3, 0);
if (E != 0) {
E->type2 = super->timer;
E->spritePriority.b0 = 3;
E->spriteOffsetX = 0xfd;
E->spriteOffsetY = 0xf8;
E->parent = super;
this->field_0x80 = object;
object = CreateObject(OBJECT_2A, 3, 0);
if (object != NULL) {
object->type2 = super->timer;
object->spritePriority.b0 = 3;
object->spriteOffsetX = 0xfd;
object->spriteOffsetY = 0xf8;
object->parent = super;
}
this->field_0x84 = E;
E = CreateObject(OBJECT_2A, 3, 0);
if (E != 0) {
E->type2 = super->timer;
E->spritePriority.b0 = 3;
E->spriteOffsetX = 0x5;
E->spriteOffsetY = 0xf5;
E->parent = super;
this->field_0x84 = object;
object = CreateObject(OBJECT_2A, 3, 0);
if (object != NULL) {
object->type2 = super->timer;
object->spritePriority.b0 = 3;
object->spriteOffsetX = 0x5;
object->spriteOffsetY = 0xf5;
object->parent = super;
}
super->child = E;
super->child = object;
}
void Gibdo_MoveObjectsToStalfos(GibdoEntity* this, Entity* that) {
Entity* ent = this->field_0x80;
if (ent != NULL) {
ent->timer = 0xf;
ent->timer = 15;
ent->parent = that;
}
ent = this->field_0x84;
if (ent != NULL) {
ent->timer = 0xf;
ent->timer = 15;
ent->parent = that;
}
ent = super->child;
if (ent != NULL) {
ent->timer = 0xf;
ent->timer = 15;
ent->parent = that;
}
}

View File

@ -87,8 +87,8 @@ void Gleerok_OnDeath(GleerokEntity* this) {
gScreen.controls.layerFXControl = 0x1442;
SoundReq(SFX_EVAPORATE);
} else {
++super->timer;
if ((super->timer & 0xf) == 0) {
super->timer++;
if ((super->timer & 0xF) == 0) {
this->unk_75++;
this->unk_74--;
gScreen.controls.alphaBlend = this->unk_74 | (this->unk_75 << 8);
@ -434,7 +434,7 @@ void sub_0802D714(GleerokEntity* this) {
((GleerokEntity*)(super->child))->unk_84 = heap;
}
heap->ent2->timer = 0x18;
heap->ent2->timer = 24;
}
void sub_0802D77C(GleerokEntity* this) {
@ -449,7 +449,7 @@ void sub_0802D77C(GleerokEntity* this) {
super->subtimer = 0;
super->timer = 0;
super->subAction = 4;
this->unk_84->ent2->timer = 0xc;
this->unk_84->ent2->timer = 12;
}
void sub_0802D7B4(GleerokEntity* this) {
@ -459,7 +459,7 @@ void sub_0802D7B4(GleerokEntity* this) {
super->timer = 0;
super->action = 1;
super->subAction = 0;
this->unk_84->ent2->timer = 0x18;
this->unk_84->ent2->timer = 24;
gRoomControls.camera_target = &gPlayerEntity;
#ifndef EU
gPlayerState.controlMode = CONTROL_1;
@ -730,10 +730,10 @@ void sub_0802DC1C(GleerokEntity* this) {
}
void sub_0802DCE0(GleerokEntity* this) {
if (this->unk_84->ent2->timer != 0xc) {
if (this->unk_84->ent2->timer != 12) {
super->direction = GetFacingDirection(super, &gPlayerEntity);
if (this->unk_84->filler[0x15] == super->direction) {
this->unk_84->ent2->timer = 0xc;
this->unk_84->ent2->timer = 12;
this->unk_82 = 4;
super->subtimer = 0;
} else {
@ -870,7 +870,7 @@ void sub_0802DDD8(GleerokEntity* this) {
super->timer &= 0xfe;
}
this->unk_84->ent2->timer = 0xc;
this->unk_84->ent2->timer = 12;
} else {
super->subAction = 0;
this->unk_84->ent2->timer = 0;
@ -903,7 +903,7 @@ void sub_0802DFC0(GleerokEntity* this) {
if (this->unk_7b) {
COLLISION_ON(super);
super->type2 = 1;
this->unk_84->ent2->timer = 0x18;
this->unk_84->ent2->timer = 24;
SoundReq(SFX_BOSS_HIT);
}
}
@ -1100,7 +1100,7 @@ void sub_0802E300(GleerokEntity* this) {
((GleerokEntity*)super->child)->unk_84 = heap;
}
heap->ent2->timer = 0x18;
heap->ent2->timer = 24;
} else {
if ((gRoomTransition.frameCount & 0xf) == 0) {
CreateProjectileWithParent(super, GLEEROK_PROJECTILE, 0x3);
@ -1202,7 +1202,7 @@ NONMATCH("asm/non_matching/gleerok/sub_0802E518.inc", void sub_0802E518(GleerokE
heap->entities[index]->y.WORD -= result << 8;
}
if (heap->ent2->timer == 0x18) {
if (heap->ent2->timer == 24) {
r7 = (heap->filler[0x15] >> 3) << 2;
if (heap->filler[0x2d] > 0xc) {
r7 += 3;

View File

@ -77,8 +77,8 @@ void GyorgChild_OnGrabbed_Action3(GyorgChildEntity* this) {
void GyorgChild_Action0(GyorgChildEntity* this) {
static const s8 gUnk_080D1EA0[] = {
0x50, 0x1, 0x40, 0x1, 0x30, 0x1, 0x20, 0x1, 0x10, 0x1, 0,
0, 0x10, -0x1, 0x20, -0x1, 0x30, -0x1, 0x40, -0x1, 0x50, -0x1,
80, 1, 64, 1, 48, 0x1, 32, 1, 16, 1, 0,
0, 16, -1, 32, -1, 48, -1, 64, -1, 80, -1,
};
super->gustJarFlags = 1;
super->spriteOrientation.flipY = 3;

View File

@ -392,7 +392,7 @@ void sub_08046E68(GyorgMaleEntity* this) {
sub_08047EA4(this, ((0x100 - super->direction) & 0xFF) << 8);
} else {
super->subAction = 4;
super->timer = 0x3F;
super->timer = 63;
super->subtimer = 1;
super->direction = (gUnk_080D1B70[Random() & 1] + tmp) & 0xC0;
sub_08047D88(this);
@ -404,7 +404,7 @@ const u16 gUnk_080D1B74[0x10] = { 0x20, 0x40, 0x60, 0x80, 0xA0, 0xC0, 0xE0, 0x1
void sub_08046EF4(GyorgMaleEntity* this) {
if (--super->timer == 0) {
super->timer = 0x7F;
super->timer = 127;
super->direction ^= 0x80;
}
super->speed = gUnk_080D1B74[(super->timer >> 3) & 0xF];
@ -926,7 +926,7 @@ void sub_08047B84(GyorgMaleEntity* this) {
void sub_08047BA4(GyorgMaleEntity* this) {
super->subAction = 1;
super->timer = 0x78;
super->timer = 120;
super->subtimer = 0;
if (gRoomControls.origin_x + 0x200 < super->x.HALF.HI) {
this->unk_76 = 0x78;
@ -968,17 +968,17 @@ void sub_08047BF0(GyorgMaleEntity* this) {
}
} else {
super->timer--;
if (super->timer == 0x5A) {
if (super->timer == 90) {
tmp = super->child;
tmp->spriteSettings.draw = 0;
CreateFx(tmp, FX_GIANT_EXPLOSION4, 0);
} else {
if (super->timer == 0x3C) {
if (super->timer == 60) {
tmp = super->child->child;
tmp->spriteSettings.draw = 0;
CreateFx(tmp, FX_GIANT_EXPLOSION4, 0);
} else {
if (super->timer == 0x1E) {
if (super->timer == 30) {
tmp = super->child->child->child;
tmp->spriteSettings.draw = 0;
CreateFx(tmp, FX_GIANT_EXPLOSION4, 0);

View File

@ -82,7 +82,7 @@ void GyorgMaleEye_Action1(GyorgMaleEyeEntity* this) {
if ((super->frame & ANIM_DONE) != 0) {
super->action = 2;
super->flags |= 0x80;
super->timer = 0x2d;
super->timer = 45;
}
}

View File

@ -179,7 +179,7 @@ void sub_0802BE18(Entity* this) {
UpdateAnimationVariableFrames(this, 2);
if (--this->timer == 0) {
this->action = 4;
this->timer = 0x1e;
this->timer = 30;
this->speed = 0x300;
} else {
sub_0802C18C(this);
@ -224,8 +224,8 @@ void sub_0802BEBC(Entity* this) {
}
void sub_0802BEEC(Entity* this) {
if (this->timer) {
if ((--this->timer & 0x1f) == 0) {
if (this->timer != 0) {
if ((--this->timer & 0x1F) == 0) {
this->animationState ^= 2;
this->direction = this->animationState << 3;
InitializeAnimation(this, this->animationState + 4);

View File

@ -23,11 +23,11 @@ static void (*const Keaton_Functions[])(Entity*) = {
Keaton_OnTick, Keaton_OnCollision, GenericKnockback, GenericDeath, GenericConfused, Keaton_OnGrabbed,
};
u32 sub_080325E8(Entity* this);
bool32 sub_080325E8(Entity* this);
void sub_08032650(Entity* this);
void sub_0803269C(Entity* this, u32 direction);
void sub_080326FC(Entity* this);
u32 sub_0803271C(Entity* this);
bool32 sub_0803271C(Entity* this);
void sub_08032740(Entity* this);
void sub_0803275C(Entity* this);
void sub_08032784(Entity* this);
@ -52,7 +52,7 @@ void Keaton_OnCollision(Entity* this) {
if (this->action != 3 && this->action != 4) {
this->action = 3;
this->timer = 0xC;
this->timer = 12;
this->direction = DirectionTurnAround(DirectionRoundUp(this->knockbackDirection));
InitAnimationForceUpdate(this, this->direction >> 3);
} else if (this->contactFlags == 0xCC) {
@ -78,22 +78,20 @@ void sub_08032468(Entity* this) {
}
void sub_0803248C(Entity* this) {
if (sub_080325E8(this) == 0) {
if (sub_0803271C(this) == 0) {
if (!sub_080325E8(this) && !sub_0803271C(this)) {
this->timer--;
if (this->timer == 0) {
sub_08032650(this);
}
if (ProcessMovement0(this) == 0) {
if (!ProcessMovement0(this)) {
this->timer = 1;
}
UpdateAnimationSingleFrame(this);
}
}
}
void sub_080324CC(Entity* this) {
if (sub_080325E8(this) == 0) {
if (!sub_080325E8(this)) {
UpdateAnimationSingleFrame(this);
if (this->frame & ANIM_DONE) {
sub_080326FC(this);
@ -149,32 +147,31 @@ void sub_08032574(Entity* this) {
void sub_080325C4(Entity* this) {
this->timer--;
if ((this->timer == 0) && (sub_080325E8(this) == 0)) {
if ((this->timer == 0) && !sub_080325E8(this)) {
sub_08032784(this);
}
}
u32 sub_080325E8(Entity* this) {
if (((sub_08049FA0(this) != 0) && (sub_08049FDC(this, 1) != 0)) &&
if ((sub_08049FA0(this) && sub_08049FDC(this, 1)) &&
(EntityInRectRadius(this, gUnk_020000B0, 0x68, 0x40) != 0)) {
if (((GetFacingDirection(this, gUnk_020000B0) - (DirectionRound(this->frame)) + 2) & 0x1F) < 5) {
this->action = 3;
this->timer = 0xC;
this->timer = 12;
this->direction = DirectionRound(this->frame);
return 1;
return TRUE;
}
}
return 0;
return FALSE;
}
void sub_08032650(Entity* this) {
static const u8 gUnk_080CE7E0[] = { 60, 60, 90, 90, 90, 90, 120, 120, 120, 120, 120, 120, 120, 120, 150, 150 };
u32 uVar3;
u32 rand = Random();
uVar3 = Random();
this->timer = gUnk_080CE7E0[uVar3 & 0xf];
if (!((sub_08049FA0(this) == 0) && ((uVar3 >> 8 & 1) == 0))) {
this->direction = DirectionRound(uVar3 >> 0x10);
this->timer = gUnk_080CE7E0[rand & 0xF];
if (!((sub_08049FA0(this) == 0) && ((rand >> 8 & 1) == 0))) {
this->direction = DirectionRound(rand >> 0x10);
} else {
this->direction = DirectionRoundUp(sub_08049EE4(this));
}
@ -205,13 +202,14 @@ void sub_080326FC(Entity* this) {
this->field_0x74.HWORD = gUnk_080CE7F0[Random() & 0xF];
}
u32 sub_0803271C(Entity* this) {
bool32 sub_0803271C(Entity* this) {
this->field_0x74.HWORD--;
if (this->field_0x74.HWORD == 0) {
sub_08032784(this);
return 1;
return TRUE;
} else {
return FALSE;
}
return 0;
}
void sub_08032740(Entity* this) {
@ -223,7 +221,7 @@ void sub_08032740(Entity* this) {
void sub_0803275C(Entity* this) {
this->action = 5;
this->timer = 0x2D;
this->timer = 45;
this->speed = 0x80;
InitAnimationForceUpdate(this, this->animationState);
sub_0803269C(this, this->direction);

View File

@ -649,7 +649,7 @@ static void PlayerBounceInit(Entity* this) {
this->timer = gPlayerState.field_0x38;
this->spriteIndex = 1;
if ((gPlayerState.flags & PL_MINISH) == 0) {
if (!(gPlayerState.flags & PL_MINISH)) {
this->zVelocity = BOUNCE_SPEED_Z;
gPlayerState.animation = 0x114;
InitScreenShake(16, 0);
@ -702,7 +702,7 @@ static void PlayerBounceUpdate(Entity* this) {
this->timer = 8;
this->subAction++;
if ((gPlayerState.flags & PL_MINISH) == 0)
if (!(gPlayerState.flags & PL_MINISH))
gPlayerState.animation = DEFAULT_ANIM;
}
@ -956,16 +956,16 @@ static void PlayerDrownInit(Entity* this) {
this->spritePriority.b1 = 0;
if (gPlayerState.flags & PL_MINISH) {
this->timer = 0x3c;
this->timer = 60;
gPlayerState.animation = 0xc19;
SoundReq(SFX_WATER_SPLASH);
} else {
if ((gPlayerState.flags & PL_FLAGS10000) == 0)
if (!(gPlayerState.flags & PL_FLAGS10000))
sub_08004168(this);
CreateFx(this, FX_WATER_SPLASH, 0);
if ((gPlayerState.flags & PL_NO_CAP) == 0)
if (!(gPlayerState.flags & PL_NO_CAP))
gPlayerState.animation = 0x72c;
else
gPlayerState.animation = 0x44c;
@ -980,7 +980,7 @@ static void sub_080712F0(Entity* this) {
temp = FALSE;
if ((gPlayerState.flags & PL_MINISH) != 0) {
if (gPlayerState.flags & PL_MINISH) {
if (--this->timer == 0)
temp = TRUE;
} else if ((this->frame & ANIM_DONE) != 0) {
@ -990,9 +990,7 @@ static void sub_080712F0(Entity* this) {
temp = TRUE;
}
if (temp == FALSE)
return;
if (temp) {
this->knockbackDuration = 0;
this->iframes = 32;
this->spritePriority.b1 = 1;
@ -1000,6 +998,7 @@ static void sub_080712F0(Entity* this) {
gPlayerState.flags &= ~PL_DROWNING;
RespawnPlayer();
}
}
static void PlayerUsePortal(Entity* this) {
static EntityAction* const sPlayerUsePortalStates[] = {
@ -1014,7 +1013,7 @@ static void PlayerUsePortal(Entity* this) {
if ((this->subAction == 7) || (this->subAction < 3))
return;
if ((gPlayerState.flags & PL_USE_PORTAL) == 0)
if (!(gPlayerState.flags & PL_USE_PORTAL))
return;
if ((gInput.newKeys & (B_BUTTON | R_BUTTON)) == 0)
@ -1538,7 +1537,7 @@ static void sub_08071CAC(Entity* this) {
gPlayerState.animation = temp;
this->subAction = 2;
this->timer = 0xf0;
this->timer = 240;
SoundReq(SFX_PLY_VO7);
}
}
@ -1761,16 +1760,17 @@ static void sub_08072064(Entity* this) {
static void sub_08072098(Entity* this) {
UpdateAnimationSingleFrame(this);
if (this->timer != 0)
if (this->timer-- != 0)
if (this->timer != 0) {
if (this->timer-- != 0) {
return;
else
;
else if ((this->frame & ANIM_DONE) == 0)
}
} else if ((this->frame & ANIM_DONE) == 0) {
return;
}
if (this->health != 0)
if (this->health != 0) {
COLLISION_ON(this);
}
SetPlayerActionNormal();
}
@ -1910,7 +1910,7 @@ static void sub_08072354(Entity* this) {
this->spritePriority.b1 = 0;
this->knockbackDuration = 0;
this->subAction = 2;
this->timer = 0x3c;
this->timer = 60;
gPlayerState.animation = 0x2c1;
gPlayerState.flags &= ~PL_BURNING;
UpdateSpriteForCollisionLayer(this);
@ -2067,7 +2067,7 @@ static void PlayerRollInit(Entity* this) {
static void PlayerRollUpdate(Entity* this) {
if (((gPlayerState.flags & (PL_ROLLING | PL_MOLDWORM_CAPTURED)) != PL_ROLLING) ||
((gPlayerState.flags & PL_MOLDWORM_RELEASED) == 0 && (this->iframes != 0) && (this->contactFlags & 0x80))) {
(!(gPlayerState.flags & PL_MOLDWORM_RELEASED) && (this->iframes != 0) && (this->contactFlags & 0x80))) {
gPlayerState.flags &= ~PL_ROLLING;
if (CheckQueuedAction())
return;
@ -2077,11 +2077,11 @@ static void PlayerRollUpdate(Entity* this) {
}
this->direction = Direction8FromAnimationState(AnimationStateIdle(this->animationState));
if (((gPlayerState.flags & PL_MINISH) == 0) && (this->timer-- == 0)) {
if (!(gPlayerState.flags & PL_MINISH) && (this->timer-- == 0)) {
CreateFx(&gPlayerEntity, FX_DASH, 0x40);
this->timer = 4;
}
if ((gPlayerState.flags & PL_FLAGS2) == 0) {
if (!(gPlayerState.flags & PL_FLAGS2)) {
UpdateFloorType();
}
if (CheckQueuedAction()) {
@ -2127,7 +2127,7 @@ static void PlayerRollUpdate(Entity* this) {
CheckPlayerVelocity();
UpdatePlayerMovement();
}
if (((this->frame & 0x10) == 0) && ((gPlayerState.flags & PL_MINISH) == 0)) {
if (((this->frame & 0x10) == 0) && !(gPlayerState.flags & PL_MINISH)) {
// dont take damage
this->hurtType = 0;
}
@ -2152,12 +2152,12 @@ static void PlayerWaitForScroll(Entity* this) {
if (gPlayerState.swim_state != 0)
this->speed = 0;
if ((gPlayerState.flags & PL_HIDDEN) == 0)
if (!(gPlayerState.flags & PL_HIDDEN))
gPlayerEntity.spriteSettings.draw = 3;
if ((gPlayerState.flags & PL_MINISH) == 0)
if (!(gPlayerState.flags & PL_MINISH))
gPlayerEntity.spritePriority.b1 = 1;
if ((gRoomControls.scroll_flags & 4) == 0) {
if (!(gRoomControls.scroll_flags & 4)) {
if (gPlayerState.flags & PL_HIDDEN)
COLLISION_ON(this);
ResetPlayerAnimationAndAction();
@ -2205,7 +2205,7 @@ static void PlayerInHoleUpdate(Entity* this) {
if (this->frame & ANIM_DONE) {
if (this->timer == 1) {
this->subAction = 3;
this->timer = 0x28;
this->timer = 40;
this->spritePriority.b1 = 1;
gPlayerState.animation = 0x624;
return;
@ -2244,7 +2244,7 @@ static void sub_08072ACC(Entity* this) {
static void sub_08072B5C(Entity* this) {
u32 temp;
sub_080042BA(this, ((0x28 - this->timer) >> 4) + 1);
sub_080042BA(this, ((40 - this->timer) >> 4) + 1);
sub_0806F948(this);
if (this->timer != 0) {
this->timer--;

View File

@ -2201,7 +2201,7 @@ void sub_0807B1A8(PlayerEntity* this) {
void sub_0807B1DC(PlayerEntity* this) {
this->unk_6e++;
super->timer = 0x1e;
super->timer = 30;
}
void sub_0807B1EC(PlayerEntity* this) {
@ -2220,7 +2220,7 @@ void sub_0807B21C(PlayerEntity* this) {
GravityUpdate(super, Q_8_8(8.0));
}
if (super->zVelocity < -Q_16_16(0.5)) {
super->timer = 0x78;
super->timer = 120;
super->subtimer = 0;
this->unk_6e++;
this->unk_68 = super->z.WORD;
@ -2236,7 +2236,7 @@ void sub_0807B264(PlayerEntity* this) {
tmp <<= 0x10;
super->z.WORD = this->unk_68 + tmp;
if (--super->timer == 0) {
super->timer = 0x50;
super->timer = 80;
super->zVelocity = Q_16_16(0.5);
this->unk_6e++;
#ifndef EU