diff options
| author | octorock <79596758+octorock@users.noreply.github.com> | 2023-12-29 23:04:14 +0100 |
|---|---|---|
| committer | octorock <79596758+octorock@users.noreply.github.com> | 2023-12-29 23:04:14 +0100 |
| commit | 870c08fad6576a219deca4e6f6cc46634267248e (patch) | |
| tree | b52e03255ea8a171a7129fa5b289d4f2f73d4c46 /src/enemy | |
| parent | c63a86fbcac78c1773b31383a8837a508c649971 (diff) | |
| parent | 5fb324d54a4f05ed72334938a658c94f6517cddc (diff) | |
Merge branch 'master' into enemies
Diffstat (limited to 'src/enemy')
43 files changed, 208 insertions, 200 deletions
diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c index eb2af238..46662008 100644 --- a/src/enemy/acroBandits.c +++ b/src/enemy/acroBandits.c @@ -461,7 +461,7 @@ void AcroBandit_Type1Action4(AcroBanditEntity* this) { } } - if (super->direction & 0xf) + if (super->direction & (0x3 | DirectionEast | DIR_DIAGONAL)) super->spriteSettings.flipX = (super->direction >> 4 ^ 1); ProcessMovement0(super); @@ -502,7 +502,7 @@ void AcroBandit_Type1Action6(AcroBanditEntity* this) { super->action = 7; dir = fallDirections[this->unk_74.HALF.LO * 5 + super->type2]; super->direction = dir; - if (dir >= 0x10) { + if (dir >= DirectionSouth) { super->spriteSettings.flipX = 1; } else { super->spriteSettings.flipX = 0; @@ -586,7 +586,7 @@ static void sub_080322E8(AcroBanditEntity* this) { } } else { u8 tmp = super->direction; - if (tmp & 0xF) { + if (tmp & (0x3 | DirectionEast | DIR_DIAGONAL)) { tmp >>= 4; tmp ^= 1; if (tmp != super->spriteSettings.flipX) { diff --git a/src/enemy/beetle.c b/src/enemy/beetle.c index f6650533..c567978f 100644 --- a/src/enemy/beetle.c +++ b/src/enemy/beetle.c @@ -112,7 +112,8 @@ void sub_080218CC(BeetleEntity* this) { if (super->subAction == 0) { super->subAction = 1; super->spriteSettings.draw = 1; - super->direction = ((sub_08049F84(super, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) & 0x1f; + super->direction = ((sub_08049F84(super, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) & + (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest); super->speed = 0x100; super->zVelocity = Q_16_16(1.125); } @@ -251,9 +252,9 @@ void sub_08021B64(BeetleEntity* this) { super->zVelocity = Q_16_16(1.0); this->unk_87 = 0; if (gPlayerEntity.direction != 0xff) { - super->direction = 0x10 ^ gPlayerEntity.direction; + super->direction = DirectionSouth ^ gPlayerEntity.direction; } else { - super->direction = (gPlayerEntity.animationState << 2) ^ 0x10; + super->direction = (gPlayerEntity.animationState << 2) ^ DirectionSouth; } InitializeAnimation(super, 5); } else { diff --git a/src/enemy/bladeTrap.c b/src/enemy/bladeTrap.c index 1f178dfa..4d89bc1b 100644 --- a/src/enemy/bladeTrap.c +++ b/src/enemy/bladeTrap.c @@ -16,18 +16,20 @@ typedef struct { /*0x74*/ u16 unk_74; } BladeTrapEntity; +#define DIR_NOT_MOVING_CHECK 0x80 + void BladeTrap(BladeTrapEntity* this) { if (super->action == 0) { super->action = 1; super->child = GetCurrentRoomProperty(super->type); UpdateRailMovement(super, (u16**)&super->child, &this->unk_74); } - if (!(super->direction & 0x80)) { + if (!(super->direction & DIR_NOT_MOVING_CHECK)) { LinearMoveUpdate(super); } if (!(--this->unk_74)) { - if (!(super->direction & 0x80)) { + if (!(super->direction & DIR_NOT_MOVING_CHECK)) { EnqueueSFX(SFX_METAL_CLINK); } UpdateRailMovement(super, (u16**)&super->child, &this->unk_74); diff --git a/src/enemy/bobomb.c b/src/enemy/bobomb.c index 1a35c1f4..e1c9b43b 100644 --- a/src/enemy/bobomb.c +++ b/src/enemy/bobomb.c @@ -71,7 +71,7 @@ void Bobomb_OnCollision(BobombEntity* this) { super->zVelocity = Q_16_16(1.5); super->speed = 0; this->unk_81 = 1; - InitializeAnimation(super, super->direction >> 4 | 6); + InitializeAnimation(super, super->direction >> 4 | IdleWest); break; } } @@ -132,7 +132,7 @@ void sub_0802C83C(BobombEntity* this) { } else { this->unk_82 = 2; super->timer = 120; - InitializeAnimation(super, (super->direction >> 4) | 6); + InitializeAnimation(super, (super->direction >> 4) | IdleWest); COLLISION_OFF(super); super->hitType = 0x6e; } @@ -156,7 +156,7 @@ void sub_0802C8D8(BobombEntity* this) { super->action = 1; super->timer = 60; super->subtimer = 0; - super->direction = (Random() & 0x18) | 4; + super->direction = (Random() & 0x18) | DIR_DIAGONAL; super->carryFlags = 0; super->gustJarFlags = 0x12; this->unk_82 = 0; @@ -172,7 +172,7 @@ void sub_0802C91C(BobombEntity* this) { if (this->unk_82) { if (super->collisions != COL_NONE) { sub_0800417E(super, super->collisions); - InitializeAnimation(super, (super->direction >> 4) | 2); + InitializeAnimation(super, (super->direction >> 4) | IdleEast); } if (--super->timer == 0) { sub_0802CBC4(this); @@ -189,7 +189,7 @@ void sub_0802C91C(BobombEntity* this) { } if (--super->timer == 0) { super->timer = 60; - super->direction = (super->direction + 8) & 0x1c; + super->direction = (super->direction + 8) & (DirectionWest | DIR_DIAGONAL); InitializeAnimation(super, super->direction >> 4); } } @@ -205,7 +205,7 @@ void sub_0802C9D0(BobombEntity* this) { super->spritePriority.b1 = 0; this->unk_83 = 1; sub_0802CC18(this); - InitializeAnimation(super, (super->direction >> 4) | 6); + InitializeAnimation(super, (super->direction >> 4) | IdleWest); GetNextFrame(super); } @@ -219,7 +219,7 @@ void sub_0802CA10(BobombEntity* this) { } } else { this->unk_83 = 2; - super->direction = (((gPlayerEntity.animationState) << 2) | 4) & 0x1c; + super->direction = (((gPlayerEntity.animationState) << 2) | IdleSouth) & (DIR_DIAGONAL | DirectionWest); sub_0802CC18(this); GetNextFrame(super); } @@ -243,8 +243,8 @@ void sub_0802CA94(BobombEntity* this) { super->speed = 0; this->unk_83 = 0; this->unk_81 = 0; - super->direction = ((gPlayerEntity.animationState << 2) | 4) & 0x1c; - InitializeAnimation(super, (super->direction >> 4) | 6); + super->direction = ((gPlayerEntity.animationState << 2) | IdleSouth) & (DirectionWest | DIR_DIAGONAL); + InitializeAnimation(super, (super->direction >> 4) | IdleWest); } void sub_0802CAF8(BobombEntity* this) { @@ -273,7 +273,7 @@ void sub_0802CB68(BobombEntity* this) { super->action = 1; super->subAction = 0; super->direction = Random() & 0x18; - super->direction |= 4; + super->direction |= IdleSouth; COLLISION_ON(super); if (this->unk_82) { super->timer = 200; diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c index 63a53074..0aebfaec 100644 --- a/src/enemy/bombPeahat.c +++ b/src/enemy/bombPeahat.c @@ -154,10 +154,10 @@ void sub_0802A9A8(BombPeahatEntity* this) { this->unk_82 = 1; if (this->unk_80) { super->x.HALF.HI = gRoomControls.scroll_x - 0x10; - super->direction = 8; + super->direction = DirectionEast; } else { super->x.HALF.HI = gRoomControls.scroll_x + 0x100; - super->direction = 0x18; + super->direction = DirectionWest; } super->y.HALF.HI = gRoomControls.scroll_y + 0x40; super->timer = 128; @@ -234,7 +234,7 @@ void sub_0802AAC0(BombPeahatEntity* this) { #ifndef EU this->unk_78 = 0; this->unk_79 = 4; - super->direction = 0xff; + super->direction = DIR_NONE; #endif InitializeAnimation(super, 0); } diff --git a/src/enemy/businessScrub.c b/src/enemy/businessScrub.c index d1dbd054..d516efbd 100644 --- a/src/enemy/businessScrub.c +++ b/src/enemy/businessScrub.c @@ -94,7 +94,7 @@ void BusinessScrub_Action0(BusinessScrubEntity* this) { this->unk_78 = super->x.HALF.HI; this->unk_7a = super->y.HALF.HI; super->animationState = 0; - super->direction = 0x10; + super->direction = DirectionSouth; sub_08028E9C(this); if ((*(u8*)this->unk_7c & 1) || CheckFlags(this->unk_86)) { super->action = 4; @@ -373,15 +373,15 @@ void sub_08028EDC(BusinessScrubEntity* this) { } void sub_08028F0C(BusinessScrubEntity* this) { - if (super->interactType == 2) { + if (super->interactType == INTERACTION_FUSE) { super->action = 8; - super->interactType = 0; - sub_0806F118(super); - } else if (super->interactType != 0) { + super->interactType = INTERACTION_NONE; + InitializeNPCFusion(super); + } else if (super->interactType != INTERACTION_NONE) { u16 dialog; const struct SalesOffering* offer = (const struct SalesOffering*)this->unk_7c; - super->interactType = 0; + super->interactType = INTERACTION_NONE; sub_0804AA1C(super); super->direction = (GetAnimationState(super) << 3); sub_080290E0(this, 3); @@ -470,8 +470,8 @@ void sub_080290FC(BusinessScrubEntity* this) { if (super->timer != 0) { super->timer--; if ((super->timer < 16) && ((super->timer & 1) == 0)) { - s32 sVar3 = ((super->direction & 0x10) != 0) ? -1 : 1; - if ((super->direction & 8) != 0) { + s32 sVar3 = (super->direction & DirectionSouth) ? -1 : 1; + if (super->direction & DirectionEast) { super->x.HALF.HI += ((super->timer & 8) != 0) ? -sVar3 : sVar3; } else { super->y.HALF.HI += ((super->timer & 8) != 0) ? sVar3 : -sVar3; diff --git a/src/enemy/businessScrubPrologue.c b/src/enemy/businessScrubPrologue.c index 607f38b4..1b308880 100644 --- a/src/enemy/businessScrubPrologue.c +++ b/src/enemy/businessScrubPrologue.c @@ -72,7 +72,7 @@ void sub_08045C3C(BusinessScrubPrologueEntity* this) { super->subtimer = 0; this->unk_78 = super->x.HALF.HI; this->unk_7a = super->y.HALF.HI; - super->animationState = 0; + super->animationState = IdleNorth; super->direction = 0x10; super->action = 5; super->timer = 120; @@ -81,7 +81,7 @@ void sub_08045C3C(BusinessScrubPrologueEntity* this) { sub_08046030(this, 0); sub_08095C48(super); StartCutscene(super, script_BusinessScrubIntro); - sub_0807DD50(super); + InitScriptForNPC(super); } void sub_08045CA4(BusinessScrubPrologueEntity* this) { @@ -206,7 +206,7 @@ void sub_08045E14(BusinessScrubPrologueEntity* this) { } void sub_08045EC8(BusinessScrubPrologueEntity* this) { - sub_0807DD94(super, 0); + ExecuteScriptAndHandleAnimation(super, NULL); } void sub_08045ED4(BusinessScrubPrologueEntity* this) { diff --git a/src/enemy/chaser.c b/src/enemy/chaser.c index 1f22bac4..8dcd8f80 100644 --- a/src/enemy/chaser.c +++ b/src/enemy/chaser.c @@ -34,7 +34,7 @@ void sub_0802B540(Entity* this) { this->timer--; } else { u32 direction = sub_0804A024(this, 1, 0xc); - if (direction != 0xff) { + if (direction != DIR_NONE) { this->action = 2; this->speed = 0x40; this->direction = direction; diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index c91cf858..4e828be3 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -553,7 +553,7 @@ void sub_080262A8(ChuchuBossEntity* this) { super->timer = 1; sub_080276F4(super, 6, 1); if (super->type2 == 0) { - gPlayerState.animation = 0x104; + gPlayerState.animation = ANIM_WALK; this->unk_84->unk_03 = 1; } else { this->unk_7c = 0; diff --git a/src/enemy/cuccoChickAggr.c b/src/enemy/cuccoChickAggr.c index 2431398d..133aca85 100644 --- a/src/enemy/cuccoChickAggr.c +++ b/src/enemy/cuccoChickAggr.c @@ -119,10 +119,11 @@ void sub_08022AA4(Entity* this) { if (!sub_08049FA0(this) && (rand >> 8) & 3) { this->direction = sub_08049EE4(this); } else { - this->direction = (rand >> 0x10) & 0x1f; + this->direction = + (rand >> 0x10) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest); } - if (this->direction & 0xf) + if (this->direction & (0x3 | DirectionEast | DIR_DIAGONAL)) this->spriteSettings.flipX = (this->direction >> 4) ^ 1; } @@ -144,7 +145,7 @@ void sub_08022B44(Entity* this) { this->zVelocity = Q_16_16(0.75); this->direction = GetFacingDirection(this, &gPlayerEntity); - if (this->direction & 0xf) + if (this->direction & (0x3 | DIR_DIAGONAL | DirectionEast)) this->spriteSettings.flipX = (this->direction >> 4) ^ 1; EnqueueSFX(SFX_VO_CHEEP); diff --git a/src/enemy/enemy4D.c b/src/enemy/enemy4D.c index f4ebdf70..edda3b77 100644 --- a/src/enemy/enemy4D.c +++ b/src/enemy/enemy4D.c @@ -107,7 +107,7 @@ void Enemy4D_Init(Enemy4DEntity* this) { super->child = projectile; COLLISION_ON(super); super->spriteSettings.draw = TRUE; - super->animationState = 2; + super->animationState = IdleEast; this->unk_7b = 0; this->unk_7c = 0; this->unk_7e = 0x28; diff --git a/src/enemy/enemy50.c b/src/enemy/enemy50.c index cd59db89..6cddbdc8 100644 --- a/src/enemy/enemy50.c +++ b/src/enemy/enemy50.c @@ -80,40 +80,38 @@ void Enemy50_OnCollision(Enemy50Entity* this) { sub_08041134(this); sub_0803F6EC(this); } - if (super->hitType == 0x25) { + if (super->hitType == 0x25 && super->contactFlags == 0x80) { + super->action = 8; + InitializeAnimation(super, 3); + } else { if (super->contactFlags == 0x80) { - super->action = 8; - InitializeAnimation(super, 3); - goto _08040C9C; + this->unk_7c = 0x78; + sub_08041128(this); } - } else if (super->contactFlags == 0x80) { - this->unk_7c = 0x78; - sub_08041128(this); - } - if (super->contactFlags == 0x9d) { - super->zVelocity = Q_16_16(1.5); - } - if (super->confusedTime != 0) { - super->animationState = super->knockbackDirection >> 4; - InitializeAnimation(super, super->animationState + 7); - Create0x68FX(super, FX_STARS); - } - if (super->health != this->unk_7a) { - if (super->type == 0) { + if (super->contactFlags == 0x9d) { + super->zVelocity = Q_16_16(1.5); + } + if (super->confusedTime != 0) { super->animationState = super->knockbackDirection >> 4; InitializeAnimation(super, super->animationState + 7); - } else { - if (super->iframes > 0) { - *((u8*)&super->iframes) |= 0x80; + Create0x68FX(super, FX_STARS); + } + if (super->health != this->unk_7a) { + if (super->type == 0) { + super->animationState = super->knockbackDirection >> 4; + InitializeAnimation(super, super->animationState + 7); + } else { + if (super->iframes > 0) { + *((u8*)&super->iframes) |= 0x80; + } + super->flags |= 0x80; + super->health = 0xff; + super->action = 0xa; + super->timer = 60; } - super->flags |= 0x80; - super->health = 0xff; - super->action = 0xa; - super->timer = 60; + this->unk_7a = super->health; } - this->unk_7a = super->health; } -_08040C9C: EnemyFunctionHandlerAfterCollision(super, Enemy50_Functions); } diff --git a/src/enemy/eyegore.c b/src/enemy/eyegore.c index 516bc646..04a1600f 100644 --- a/src/enemy/eyegore.c +++ b/src/enemy/eyegore.c @@ -144,7 +144,7 @@ void Eyegore_OnGrabbed(EyegoreEntity* this) { void Eyegore_Init(EyegoreEntity* this) { sub_0804A720(super); super->action = 1; - super->animationState = 2; + super->animationState = IdleEast; super->x.HALF.HI &= 0xfff0; super->y.HALF.HI = (super->y.HALF.HI & 0xfff0) + 0xc; this->unk_6d |= 8; @@ -196,7 +196,7 @@ void Eyegore_Action3(EyegoreEntity* this) { GetNextFrame(super); if ((super->frame & ANIM_DONE) != 0) { super->flags |= ENT_COLLIDE; - super->animationState = 2; + super->animationState = IdleEast; sub_08030E58(this); InitializeAnimation(super, 2); sub_08030FB4(this); @@ -240,7 +240,7 @@ void Eyegore_Action5(EyegoreEntity* this) { GetNextFrame(super); switch (super->frame & 7) { case 1: - if (super->animationState != 2) { + if (super->animationState != IdleEast) { if (super->animationState >= 3) { this->unk_7f = (super->animationState - 1) & 3; } else { @@ -264,7 +264,7 @@ void Eyegore_Action5(EyegoreEntity* this) { if (sub_08049FDC(super, 1)) { sub_08030E58(this); } else { - if (super->animationState == 2) { + if (super->animationState == IdleEast) { super->action = 6; super->flags &= ~ENT_COLLIDE; InitializeAnimation(super, 0xe); diff --git a/src/enemy/fireballGuy.c b/src/enemy/fireballGuy.c index 557163d4..6c171151 100644 --- a/src/enemy/fireballGuy.c +++ b/src/enemy/fireballGuy.c @@ -123,7 +123,7 @@ void sub_08045524(FireballGuyEntity* this) { super->zVelocity = Q_16_16(1.75); tmp = sub_0804A024(super, 1, 8); - if (tmp != 0xff && (Random() & 3) == 0) { + if (tmp != DIR_NONE && (Random() & 3) == 0) { super->timer = Random() & 3; super->direction = DirectionRound(tmp); } else { diff --git a/src/enemy/gleerok.c b/src/enemy/gleerok.c index 7047f61a..aba9307f 100644 --- a/src/enemy/gleerok.c +++ b/src/enemy/gleerok.c @@ -1134,7 +1134,7 @@ void sub_0802E300(GleerokEntity* this) { this->unk_79 &= ~0x80; heap = this->unk_84; - dir = sub_0806F5A4(GetFacingDirection(super, &gPlayerEntity)) << 3; + dir = GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) << 3; index = 0; ptr2 = &this->unk_80; tmp = 0; diff --git a/src/enemy/gyorgMale.c b/src/enemy/gyorgMale.c index 7f2192b1..8d2407f1 100644 --- a/src/enemy/gyorgMale.c +++ b/src/enemy/gyorgMale.c @@ -162,8 +162,8 @@ void sub_08046930(GyorgMaleEntity* this) { return; super->subAction = 1; super->timer = 1; - super->animationState = 0; - super->direction = 0; + super->animationState = IdleNorth; + super->direction = IdleNorth; #ifdef EU super->speed = 0x200; #else diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c index 35fb249e..51e88ab7 100644 --- a/src/enemy/helmasaur.c +++ b/src/enemy/helmasaur.c @@ -222,9 +222,9 @@ void sub_0802BE80(HelmasaurEntity* this) { } void sub_0802BEBC(HelmasaurEntity* this) { - super->direction ^= 0x10; + super->direction ^= DirectionSouth; ProcessMovement2(super); - super->direction ^= 0x10; + super->direction ^= DirectionSouth; if (!sub_080044EC(super, Q_16_16(0.125))) { sub_0802C1C0(this); } diff --git a/src/enemy/lakituCloud.c b/src/enemy/lakituCloud.c index f86690d6..89f991a3 100644 --- a/src/enemy/lakituCloud.c +++ b/src/enemy/lakituCloud.c @@ -97,7 +97,7 @@ void sub_0803CD6C(LakituCloudEntity* this) { void sub_0803CDA8(LakituCloudEntity* this) { UpdateAnimationSingleFrame(super); - if ((super->direction & 0x80) == 0) { + if (!(super->direction & DIR_NOT_MOVING_CHECK)) { LinearMoveUpdate(super); } @@ -131,7 +131,7 @@ void sub_0803CE14(LakituCloudEntity* this) { UpdateRailMovement(super, (u16**)&super->child, &this->unk_74); direction = super->direction; - if (direction & 0x80) { + if (direction & DIR_NOT_MOVING_CHECK) { return; } diff --git a/src/enemy/leever.c b/src/enemy/leever.c index d7c49b23..66e263c8 100644 --- a/src/enemy/leever.c +++ b/src/enemy/leever.c @@ -79,7 +79,8 @@ void Leever_Idle(LeeverEntity* this) { if (Leever_PlayerInRange(super, Random() & 0x1f)) { super->action = 2; super->spriteSettings.draw = TRUE; - super->direction = (GetFacingDirection(super, gUnk_020000B0) + gLeeverDrift[Random() & 1]) & 0x1f; + super->direction = + (GetFacingDirection(super, gUnk_020000B0) + gLeeverDrift[Random() & 1]) & (0x3 | DirectionNorthWest); InitializeAnimation(super, LeeverAnimation_DigUp); UpdateSpriteForCollisionLayer(super); } else { diff --git a/src/enemy/madderpillar.c b/src/enemy/madderpillar.c index 4666b7fd..85068daf 100644 --- a/src/enemy/madderpillar.c +++ b/src/enemy/madderpillar.c @@ -391,16 +391,16 @@ void sub_08029EEC(MadderpillarEntity* this) { void sub_08029F0C(MadderpillarEntity* this) { switch (super->direction >> 3) { - case 0: + case 0: // UP this->unk_78.HWORD = super->y.HALF.HI - 0x10; break; - case 1: + case 1: // RIGHT this->unk_78.HWORD = super->x.HALF.HI + 0x10; break; - case 2: + case 2: // DOWN this->unk_78.HWORD = super->y.HALF.HI + 0x10; break; - case 3: + case 3: // LEFT this->unk_78.HWORD = super->x.HALF.HI - 0x10; break; } @@ -408,25 +408,25 @@ void sub_08029F0C(MadderpillarEntity* this) { bool32 sub_08029F48(MadderpillarEntity* this) { switch (super->direction >> 3) { - case 0: + case 0: // UP if (super->y.HALF.HI <= this->unk_78.HWORD) { super->y.HALF.HI = this->unk_78.HWORD; return TRUE; } break; - case 1: + case 1: // RIGHT if (super->x.HALF.HI >= this->unk_78.HWORD) { super->x.HALF.HI = this->unk_78.HWORD; return TRUE; } break; - case 2: + case 2: // DOWN if (super->y.HALF.HI >= this->unk_78.HWORD) { super->y.HALF.HI = this->unk_78.HWORD; return TRUE; } break; - case 3: + case 3: // LEFT if (super->x.HALF.HI <= this->unk_78.HWORD) { super->x.HALF.HI = this->unk_78.HWORD; return TRUE; diff --git a/src/enemy/mazaalBracelet.c b/src/enemy/mazaalBracelet.c index 6a0228cb..64025e93 100644 --- a/src/enemy/mazaalBracelet.c +++ b/src/enemy/mazaalBracelet.c @@ -531,7 +531,7 @@ void sub_0803A8B8(Entity* this) { this->action = 0x10; this->timer = 30; - this->direction = 0; + this->direction = DirectionNorth; this->speed = 0x80; ptr = gUnk_080CED6C; @@ -575,7 +575,7 @@ void sub_0803A978(Entity* this) { sub_08004596(this, 0x10); } LinearMoveUpdate(this); - if (this->direction == 0x10) { + if (this->direction == DirectionSouth) { this->action = 0x12; this->timer = 3; COLLISION_OFF(this); @@ -1247,7 +1247,10 @@ void sub_0803B724(Entity* param_1) { void sub_0803B798(void) { gPlayerState.jump_status = 0x41; gPlayerState.field_0xa = 0; - gPlayerState.flags &= ~(0xffff0000 | PL_CAPTURED); + gPlayerState.flags &= + ~(PL_CAPTURED | PL_FLAGS10000 | PL_GYORG_FIGHT | PL_ROLLING | PL_MOLDWORM_CAPTURED | PL_IN_HOLE | + PL_MOLDWORM_RELEASED | PL_CLONING | PL_USE_LANTERN | PL_PARACHUTE | PL_CONVEYOR_PUSHED | PL_ENTER_MINECART | + PL_SWORD_THRUST | PL_USE_OCARINA | PL_CLIMBING | PL_FLAGS40000000 | PL_FLAGS80000000); gPlayerEntity.flags |= ENT_COLLIDE; gPlayerEntity.zVelocity = Q_16_16(1.5); gPlayerEntity.z.HALF.HI = -10; diff --git a/src/enemy/mazaalHead.c b/src/enemy/mazaalHead.c index 32d00bdd..12fae4c5 100644 --- a/src/enemy/mazaalHead.c +++ b/src/enemy/mazaalHead.c @@ -561,7 +561,7 @@ void sub_0803473C(Entity* this) { if (roomX + 0xe0 < this->x.HALF.HI) { return; } - this->direction = 8; + this->direction = DirectionEast; } else { if (playerX + 4 >= this->x.HALF.HI) { return; @@ -569,7 +569,7 @@ void sub_0803473C(Entity* this) { if (roomX + 0x90 > this->x.HALF.HI) { return; } - this->direction = 0x18; + this->direction = DirectionWest; } LinearMoveUpdate(this); } @@ -581,7 +581,7 @@ void sub_080347B4(Entity* this) { if (roomX + 0xe0 < this->x.HALF.HI) { return; } - this->direction = 8; + this->direction = DirectionEast; } else { if (playerX + 4 >= this->x.HALF.HI) { return; @@ -589,7 +589,7 @@ void sub_080347B4(Entity* this) { if (roomX + 0x90 > this->x.HALF.HI) { return; } - this->direction = 0x18; + this->direction = DirectionWest; } LinearMoveUpdate(this); } diff --git a/src/enemy/moldorm.c b/src/enemy/moldorm.c index 8caf1f7a..ebf72095 100644 --- a/src/enemy/moldorm.c +++ b/src/enemy/moldorm.c @@ -209,7 +209,7 @@ void sub_08022F14(Entity* this) { } this->direction += this->field_0x78.HALF.LO; - this->direction &= 0x1f; + this->direction &= DirectionNorthWest | 0x3; this->animationState = ((this->direction + 2) & 0x1c) >> 2; this->frameIndex = this->animationState; diff --git a/src/enemy/peahat.c b/src/enemy/peahat.c index d0fe6e28..353ad0d5 100644 --- a/src/enemy/peahat.c +++ b/src/enemy/peahat.c @@ -191,7 +191,8 @@ void Peahat_ChargeStart(PeahatEntity* this) { super->action = 3; super->timer = 120; super->speed = 192; - super->direction = (GetFacingDirection(super, gUnk_020000B0) + gUnk_080CA5D4[Random() & 1]) & 0x1f; + super->direction = + (GetFacingDirection(super, gUnk_020000B0) + gUnk_080CA5D4[Random() & 1]) & (0x3 | DirectionNorthWest); } } else { sub_080205F8(this); @@ -235,6 +236,8 @@ void Peahat_ChargeEnd(PeahatEntity* this) { } } +#define DIR_NONE 0xff + void Peahat_Stunned(PeahatEntity* this) { switch (super->animationState) { default: @@ -245,7 +248,7 @@ void Peahat_Stunned(PeahatEntity* this) { super->hitType = 0x71; } - if (super->direction == 0xff) + if (super->direction == DIR_NONE) super->direction = super->knockbackDirection; ProcessMovement0(super); @@ -373,7 +376,7 @@ void sub_08020604(PeahatEntity* this) { super->direction = sub_08049EE4(super); } else { super->direction += this->unk_80; - super->direction &= 0x1f; + super->direction &= (0x3 | DirectionNorthWest); } } diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c index 5d13addb..e2746415 100644 --- a/src/enemy/pesto.c +++ b/src/enemy/pesto.c @@ -387,7 +387,7 @@ void sub_080244E8(Entity* this) { if (tmp == 0) { this->field_0x80.HALF.LO++; this->timer = 12; - this->direction = 0x10; + this->direction = DirectionSouth; this->speed = tmp; this->cutsceneBeh.HALF.LO = 0; this->flags2 &= 0xfc; @@ -554,13 +554,13 @@ void sub_08024940(Entity* this) { } void sub_080249DC(Entity* this) { - u8 direction = ((this->direction + 2) & 0x1c) >> 2; + u8 direction = ((this->direction + 2) & DirectionNorthWest) >> 2; this->animationState = direction; InitializeAnimation(this, this->animationState); } void sub_080249F4(Entity* this) { - u32 direction = ((this->direction + 2) & 0x1f); + u32 direction = ((this->direction + 2) & (0x3 | DirectionNorthWest)); direction >>= 2; if (direction != this->animationState) { this->animationState = direction; @@ -770,8 +770,8 @@ void sub_08024D00(Entity* this) { this->field_0x80.HALF.LO++; this->timer = (Random() & 0xf) + 32; - this->direction += this->field_0x80.HALF.HI ? 4 : 0x1c; - this->direction &= 0x1f; + this->direction += this->field_0x80.HALF.HI ? DirectionNorthEast : DirectionNorthWest; + this->direction &= 0x3 | DirectionNorthWest; this->field_0x80.HALF.HI ^= 0x40; sub_08024A14(this, 3, 0x10); @@ -783,8 +783,8 @@ void sub_08024D00(Entity* this) { this->timer = (Random() & 0x1f) + 32; } else { if (--this->subtimer == 0) { - this->direction += this->field_0x80.HALF.HI ? 1 : 0x1f; - this->direction &= 0x1f; + this->direction += this->field_0x80.HALF.HI ? 1 : (0x3 | DirectionNorthWest); + this->direction &= 0x3 | DirectionNorthWest; this->subtimer = 16; sub_080249DC(this); diff --git a/src/enemy/puffstool.c b/src/enemy/puffstool.c index 03f8f0e8..9d085722 100644 --- a/src/enemy/puffstool.c +++ b/src/enemy/puffstool.c @@ -358,7 +358,7 @@ void sub_080255AC(Entity* this) { } tmp -= 7; - this->direction = (GetFacingDirection(entity, this) + tmp) & 0x1f; + this->direction = (GetFacingDirection(entity, this) + tmp) & (0x3 | DirectionNorthWest); } if (this->field_0x78.HWORD == 0) { @@ -398,7 +398,7 @@ void sub_080256B4(Entity* this) { this->action = 1; this->timer = (Random() & 3) + 4; this->subtimer = 30; - this->direction = (this->direction + 7 + ((s32)Random() % 7) * 4) & 0x1c; + this->direction = (this->direction + 7 + ((s32)Random() % 7) * 4) & DirectionNorthWest; this->field_0x78.HWORD = gUnk_080CC000[Random() & 0xf]; this->field_0x7a.HALF.LO = ((s32)Random() % 0x18) << 1; this->field_0x7a.HALF.HI = 0; diff --git a/src/enemy/rollobite.c b/src/enemy/rollobite.c index 2a3a7fbe..e2a19240 100644 --- a/src/enemy/rollobite.c +++ b/src/enemy/rollobite.c @@ -46,7 +46,7 @@ void Rollobite_OnCollision(RollobiteEntity* this) { if (super->hitType == 34 && super->health != 0xff) { super->action = 4; super->zVelocity = Q_16_16(2.0); - super->direction = 0xff; + super->direction = DIR_NONE; super->health = 0xff; super->hitType = 35; InitializeAnimation(super, super->animationState + 8); @@ -56,7 +56,7 @@ void Rollobite_OnCollision(RollobiteEntity* this) { if (super->action == 4 || super->action == 5) { super->action = 4; super->timer = 180; - super->direction = 0xff; + super->direction = DIR_NONE; InitializeAnimation(super, super->animationState + 0x10); } } @@ -81,7 +81,7 @@ void Rollobite_OnGrabbed(RollobiteEntity* this) { if (super->subAction < 3 && !sub_0806F520(super)) { super->action = 4; COLLISION_ON(super); - super->direction = 0xff; + super->direction = DIR_NONE; InitializeAnimation(super, super->animationState + 0x10); } else { gUnk_080CA6A4[super->subAction](this); @@ -114,7 +114,7 @@ void sub_080207A8(RollobiteEntity* this) { COLLISION_ON(super); super->spritePriority.b0 = 4; super->gustJarState &= 0xfb; - super->direction ^= 0x10; + super->direction ^= DirectionSouth; super->zVelocity = Q_16_16(1.5); super->speed = 0x80; InitializeAnimation(super, super->animationState + 0x10); @@ -200,7 +200,7 @@ void Rollobite_RolledUp(RollobiteEntity* this) { if (unk == 1) EnqueueSFX(SFX_PLACE_OBJ); - if ((super->direction & 0x80) == 0) + if (!(super->direction & DIR_NOT_MOVING_CHECK)) ProcessMovement2(super); } } @@ -255,8 +255,8 @@ void sub_08020A7C(RollobiteEntity* this) { if (sub_08049FA0(super) == 0) { int tmp = DirectionRoundUp(sub_08049EE4(super)); - if ((state ^ 0x10) == tmp) - state ^= 0x10; + if ((state ^ DirectionSouth) == tmp) + state ^= DirectionSouth; } super->direction = state; diff --git a/src/enemy/ropeGolden.c b/src/enemy/ropeGolden.c index fd9127c7..03f6c159 100644 --- a/src/enemy/ropeGolden.c +++ b/src/enemy/ropeGolden.c @@ -138,7 +138,7 @@ void sub_08038304(RopeGoldenEntity* this) { } this->unk_7a = this->unk_79; this->unk_79 = cVar2; - super->direction = (super->direction + cVar2) & 0x18; + super->direction = (super->direction + cVar2) & DirectionWest; } else { super->direction = this->unk_78; } diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c index 03a65ffe..1834d7d3 100644 --- a/src/enemy/rupeeLike.c +++ b/src/enemy/rupeeLike.c @@ -227,7 +227,7 @@ void sub_08029688(RupeeLikeEntity* this) { void sub_0802969C(RupeeLikeEntity* this) { u32 bVar1; - if ((super->direction & 0xf) != 0) { + if (super->direction & (0x3 | DIR_DIAGONAL | DirectionEast)) { bVar1 = super->direction >> 4; if (bVar1 != super->animationState) { diff --git a/src/enemy/sensorBladeTrap.c b/src/enemy/sensorBladeTrap.c index 2527a3a2..db136a3c 100644 --- a/src/enemy/sensorBladeTrap.c +++ b/src/enemy/sensorBladeTrap.c @@ -55,16 +55,16 @@ void sub_0802BA18(SensorBladeTrapEntity* this) { super->direction = direction; switch (direction >> 3) { - case 0: + case 0: // UP this->unk_7a = super->y.HALF.HI - this->unk_7e; break; - case 1: + case 1: // RIGHT this->unk_7a = super->x.HALF.HI + this->unk_7c; break; - case 2: + case 2: // DOWN this->unk_7a = super->y.HALF.HI + this->unk_7e; break; - case 3: + case 3: // LEFT this->unk_7a = super->x.HALF.HI - this->unk_7c; break; } @@ -75,19 +75,19 @@ void sub_0802BA8C(SensorBladeTrapEntity* this) { sub_0802BB10(this); } else { switch (super->direction >> 3) { - case 0: + case 0: // UP if (this->unk_7a >= super->y.HALF.HI) sub_0802BB10(this); break; - case 1: + case 1: // RIGHT if (this->unk_7a <= super->x.HALF.HI) sub_0802BB10(this); break; - case 2: + case 2: // DOWN if (this->unk_7a <= super->y.HALF.HI) sub_0802BB10(this); break; - case 3: + case 3: // LEFT if (this->unk_7a >= super->x.HALF.HI) sub_0802BB10(this); break; @@ -104,7 +104,7 @@ void sub_0802BAFC(SensorBladeTrapEntity* this) { void sub_0802BB10(SensorBladeTrapEntity* this) { super->action = 3; super->speed = 0xc0; - super->direction = super->direction ^ 0x10; + super->direction = super->direction ^ DirectionSouth; EnqueueSFX(SFX_METAL_CLINK); } diff --git a/src/enemy/smallPesto.c b/src/enemy/smallPesto.c index 74e6254c..bb17ead0 100644 --- a/src/enemy/smallPesto.c +++ b/src/enemy/smallPesto.c @@ -97,8 +97,8 @@ void sub_08031714(SmallPestoEntity* this) { if (sub_08049FA0(super) == 0 && (super->subtimer & 1) != 0) { super->direction = sub_08049EE4(super); } else { - super->direction += 0x18; - super->direction = ((Random() & 0xe) + super->direction) & 0x1f; + super->direction += DirectionWest; + super->direction = ((Random() & 0xe) + super->direction) & (0x3 | DirectionNorthWest); } sub_080317E0(this); } diff --git a/src/enemy/spark.c b/src/enemy/spark.c index 2ec43e2b..cc6d1f15 100644 --- a/src/enemy/spark.c +++ b/src/enemy/spark.c @@ -60,7 +60,7 @@ void sub_0802B35C(Entity* this) { if (--this->subtimer == 0) { this->subtimer = 120; - this->direction += is_head ? 0x08 : 0x18; + this->direction += is_head ? DirectionEast : DirectionWest; this->direction = DirectionRound(this->direction); } } else { diff --git a/src/enemy/spearMoblin.c b/src/enemy/spearMoblin.c index 57159b15..7919a6ba 100644 --- a/src/enemy/spearMoblin.c +++ b/src/enemy/spearMoblin.c @@ -176,7 +176,7 @@ void sub_08028488(Entity* this) { this->timer = (Random() & 7) * 3 + 64; break; case 4: - this->direction = (this->direction + 0x10) & 0x18; + this->direction = (this->direction + 0x10) & DirectionWest; /* fallthrough */ case 1: default: @@ -265,7 +265,7 @@ void sub_08028604(Entity* this) { this->timer = this->timer + 0x10; this->field_0x82.HALF.HI--; } - this->direction = (iVar3 + 4U) & 0x18; + this->direction = (iVar3 + 4U) & DirectionWest; iVar3 = Direction8ToAnimationState(this->direction); } } else { diff --git a/src/enemy/spikedBeetle.c b/src/enemy/spikedBeetle.c index 07dccce7..d009eab2 100644 --- a/src/enemy/spikedBeetle.c +++ b/src/enemy/spikedBeetle.c @@ -107,7 +107,7 @@ void sub_0802B7A4(Entity* this) { this->timer = gUnk_080CD314[Random() & 3]; this->speed = 0x60; sub_0802B960(this); - if (this->direction != 0xff) { + if (this->direction != DIR_NONE) { u32 animation = this->direction >> 3; if (animation != this->animationState) { this->animationState = animation & 3; diff --git a/src/enemy/stalfos.c b/src/enemy/stalfos.c index 7042dea5..98b2214e 100644 --- a/src/enemy/stalfos.c +++ b/src/enemy/stalfos.c @@ -451,24 +451,23 @@ u32 sub_08039B28(StalfosEntity* this) { const u16* ptr; const s8* ptr2; - if (super->child == NULL) { - ptr2 = &gUnk_080CF930[super->animationState * 2]; - pos = COORD_TO_TILE_OFFSET(super, -ptr2[0], -ptr2[1]); - - tileType = GetTileType(pos, (u32)super->collisionLayer); - ptr = gUnk_080CF938; - do { - if (ptr[0] != tileType) { - ptr += 2; - } else { - goto found; - } - } while (ptr[0] != 0); - } - return 0xffff; -found: - super->type2 = ptr[1]; - return pos; + if (super->child != NULL) { + return (u16)-1; + } + ptr2 = &gUnk_080CF930[super->animationState * 2]; + pos = COORD_TO_TILE_OFFSET(super, -ptr2[0], -ptr2[1]); + tileType = GetTileType(pos, (u32)super->collisionLayer); + ptr = gUnk_080CF938; + + do { + if (ptr[0] == tileType) { + super->type2 = ptr[1]; + return pos; + } + ptr += 2; + } while (ptr[0] != 0); + + return (u16)-1; } void (*const Stalfos_Functions[])(StalfosEntity*) = { diff --git a/src/enemy/tektite.c b/src/enemy/tektite.c index 62ef03a0..16c8c787 100644 --- a/src/enemy/tektite.c +++ b/src/enemy/tektite.c @@ -159,7 +159,7 @@ void sub_0802F300(Entity* this) { } else if (this->collisions != COL_NONE) { sub_0800417E(this, this->collisions); } else if ((GetTileUnderEntity(this) & 0xf0) == 0x50) { - this->direction = (this->direction + 0x10) & 0x1f; + this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest); } if (--this->timer == 0) { @@ -214,6 +214,6 @@ static void sub_0802F45C(Entity* this) { this->direction = sub_08049F84(this, 1); } else { temp = (Random() & 0xf) + 0x18; - this->direction = (temp + this->direction) & 0x1f; + this->direction = (temp + this->direction) & (0x3 | DirectionNorthWest); } } diff --git a/src/enemy/tektiteGolden.c b/src/enemy/tektiteGolden.c index 48c9d6a5..b5c024b2 100644 --- a/src/enemy/tektiteGolden.c +++ b/src/enemy/tektiteGolden.c @@ -136,7 +136,7 @@ void sub_08038048(Entity* this) { } else if (this->collisions != COL_NONE) { sub_0800417E(this, this->collisions); } else if ((GetTileUnderEntity(this) & 0xf0) == 0x50) { - this->direction = (this->direction + 0x10) & 0x1f; + this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest); } if (--this->timer == 0) { @@ -185,6 +185,6 @@ void sub_08038168(Entity* this) { this->direction = sub_08049F84(this, 1); } else { temp = (Random() & 0xf) + 0x18; - this->direction = (temp + this->direction) & 0x1f; + this->direction = (temp + this->direction) & (0x3 | DirectionNorthWest); } } diff --git a/src/enemy/vaatiBall.c b/src/enemy/vaatiBall.c index 1d52e752..7b174bc6 100644 --- a/src/enemy/vaatiBall.c +++ b/src/enemy/vaatiBall.c @@ -74,7 +74,7 @@ void sub_0804468C(Entity* this) { case 0: this->action = 1; this->timer = 1; - this->direction = (this->field_0x78.HALF.HI * 8) & 0x1f; + this->direction = (this->field_0x78.HALF.HI * 8) & (0x3 | DirectionNorthWest); this->field_0x78.HALF.LO = 0; this->field_0x82.HALF.HI = 0; this->spriteSettings.draw = 0; @@ -123,7 +123,7 @@ void sub_0804474C(Entity* this) { if (--this->timer == 0) { this->timer = 2; this->direction++; - this->direction &= 0x1f; + this->direction &= 0x3 | DirectionNorthWest; } LinearMoveUpdate(this); UpdateAnimationSingleFrame(this); @@ -253,7 +253,7 @@ void sub_080449F8(Entity* this) { this->timer = 4; this->direction++; - this->direction &= 0x1f; + this->direction &= 0x3 | DirectionNorthWest; if (vaati->field_0x80.HALF.LO == 0) vaati->field_0x74.HALF.LO = 1; break; @@ -266,9 +266,9 @@ void sub_080449F8(Entity* this) { } break; case 1: - this->direction = (this->direction + 0x10) & 0x1f; + this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest); LinearMoveUpdate(this); - this->direction = (this->direction + 0x10) & 0x1f; + this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest); this->timer = 2; break; case 3: @@ -324,7 +324,7 @@ void sub_08044B04(Entity* this) { if (--this->timer == 0) { this->timer = this->field_0x78.HALF.LO ? 4 : 2; this->direction++; - this->direction &= 0x1f; + this->direction &= 0x3 | DirectionNorthWest; } if (--this->subtimer == 0) { if (this->timer != 2) { @@ -346,11 +346,11 @@ void sub_08044B04(Entity* this) { case 1: if (--this->timer == 0) { this->timer = 6; - this->direction = (this->direction + 1) & 0x1f; + this->direction = (this->direction + 1) & (0x3 | DirectionNorthWest); if (++this->subtimer == 0x30) { u32 direction = sub_080045B4(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10); this->speed = 0; - this->direction = (direction + 16) & 0x1f; + this->direction = (direction + 16) & (0x3 | DirectionNorthWest); this->timer = 16; this->subtimer = 16; this->field_0x74.HALF.LO++; @@ -485,18 +485,18 @@ void sub_08044E74(Entity* this, u32 state) { switch (state) { case 2: this->action = 2; - this->direction += 0x18; - this->direction &= 0x1f; + this->direction += DirectionWest; + this->direction &= 0x3 | DirectionNorthWest; PositionRelative(this->parent, this, 0, Q_16_16(-16.0)); this->speed = 12288; LinearMoveUpdate(this); - this->direction += 0x8; - this->direction &= 0x1f; + this->direction += DirectionEast; + this->direction &= 0x3 | DirectionNorthWest; this->speed = 1280; LinearMoveUpdate(this); break; case 1: - this->direction = (this->direction + 8) & 0x1f; + this->direction = (this->direction + 8) & (0x3 | DirectionNorthWest); break; case 0: if (this->field_0x78.HALF.LO) { @@ -507,9 +507,9 @@ void sub_08044E74(Entity* this, u32 state) { } while (this->timer-- != 3); break; case 1: - this->direction = (this->direction + 0x10) & 0x1f; + this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest); LinearMoveUpdate(this); - this->direction = (this->direction + 0x10) & 0x1f; + this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest); break; } } else { diff --git a/src/enemy/vaatiEyesMacro.c b/src/enemy/vaatiEyesMacro.c index 8370eac3..ab831be3 100644 --- a/src/enemy/vaatiEyesMacro.c +++ b/src/enemy/vaatiEyesMacro.c @@ -232,7 +232,7 @@ void sub_0802EFB8(Entity* this) { } iVar4 = sub_080B1B44(TILE(this->x.HALF.HI, this->y.HALF.HI) + gUnk_080B4488[((uVar1) >> 3)], 1); if (iVar4 != 0) { - this->direction = 0xff; + this->direction = DIR_NONE; } else { this->timer = (rand & 3) + 1; this->direction = (uVar1 & 0x18); @@ -251,7 +251,7 @@ void sub_0802F04C(Entity* this) { return; } switch (this->direction >> 3) { - case 0: + case 0: // UP if (((oldY & 0xf) > 8) && ((this->y.HALF.HI & 0xf) < 9)) { this->timer--; oldY = (this->y.HALF.HI & 0xfff0) + 8; @@ -263,7 +263,7 @@ void sub_0802F04C(Entity* this) { return; } break; - case 1: + case 1: // RIGHT if (((oldX & 0xf) < 8) && ((this->x.HALF.HI & 0xf) >= 8)) { this->timer--; oldX = (this->x.HALF.HI & 0xfff0) + 8; @@ -275,7 +275,7 @@ void sub_0802F04C(Entity* this) { return; } break; - case 2: + case 2: // DOWN if (((oldY & 0xf) < 8) && ((this->y.HALF.HI & 0xf) >= 8)) { this->timer--; oldY = (this->y.HALF.HI & 0xfff0) + 8; @@ -287,7 +287,7 @@ void sub_0802F04C(Entity* this) { return; } break; - default: + default: // LEFT if (((oldX & 0xf) >= 9) && ((this->x.HALF.HI & 0xf) < 9)) { this->timer--; oldX = (this->x.HALF.HI & 0xfff0) + 8; diff --git a/src/enemy/vaatiProjectile.c b/src/enemy/vaatiProjectile.c index d97551e6..b2873a67 100644 --- a/src/enemy/vaatiProjectile.c +++ b/src/enemy/vaatiProjectile.c @@ -187,7 +187,7 @@ void VaatiProjectileFunction0Action5(Entity* this) { void VaatiProjectileFunction0Action6(Entity* this) { if (--this->timer == 0) { this->action = 7; - this->direction = 0x10; + this->direction = DirectionSouth; this->speed = 0x300; } sub_0803E444(this); diff --git a/src/enemy/vaatiRebornEnemy.c b/src/enemy/vaatiRebornEnemy.c index adfacb07..9dacb397 100644 --- a/src/enemy/vaatiRebornEnemy.c +++ b/src/enemy/vaatiRebornEnemy.c @@ -103,7 +103,7 @@ void VaatiRebornEnemyType0Action0(Entity* this) { this->timer = 0; this->field_0x76.HALF.LO = 0; this->spriteSettings.draw = 1; - this->direction = 0xff; + this->direction = DIR_NONE; this->spritePriority.b0 = 4; this->z.WORD = 0; this->field_0x80.HALF.LO = 2; @@ -149,12 +149,12 @@ void VaatiRebornEnemyType0Action1(Entity* this) { this->action = 2; this->field_0x74.HALF.LO = 0; this->timer = 16; - this->direction = 0xff; + this->direction = DIR_NONE; } else { if ((this->field_0x86.HALF.LO != 0) || (this->field_0x80.HALF.LO != 0)) { - this->direction = ((Random() & 0x80) >> 3) | 8; + this->direction = ((Random() & 0x80) >> 3) | DirectionEast; } else { - this->direction = 0xff; + this->direction = DIR_NONE; } } } else { @@ -165,7 +165,7 @@ void VaatiRebornEnemyType0Action1(Entity* this) { this->field_0x74.HALF.HI = this->field_0x74.HALF.LO & 0x80; this->field_0x74.HALF.LO = 0; this->timer = 192; - this->direction = 0xff; + this->direction = DIR_NONE; this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 0); } @@ -176,7 +176,7 @@ void VaatiRebornEnemyType0Action1(Entity* this) { case 0: this->action = 4; this->timer = 160; - this->direction = 0xff; + this->direction = DIR_NONE; this->cutsceneBeh.HALF.LO = 0xff; InitAnimationForceUpdate(this, 1); break; @@ -184,21 +184,21 @@ void VaatiRebornEnemyType0Action1(Entity* this) { this->action = 6; this->field_0x74.HALF.LO = 0; this->timer = 0; - this->direction = 0xff; + this->direction = DIR_NONE; break; case 3: this->action = 5; this->field_0x74.HALF.LO = 0; this->subtimer = 32; - this->direction = 0xff; + this->direction = DIR_NONE; break; case 2: this->field_0x74.HALF.LO = 0; this->timer = 32; if ((this->field_0x86.HALF.LO != 0) || (this->field_0x80.HALF.LO != 0)) { - this->direction = ((Random() & 0x80) >> 3) | 8; + this->direction = ((Random() & 0x80) >> 3) | DirectionEast; } else { - this->direction = 0xff; + this->direction = DIR_NONE; } break; } @@ -340,7 +340,7 @@ void VaatiRebornEnemyType0Action4(Entity* this) { this->action = 1; this->cutsceneBeh.HALF.LO = 0xff; this->timer = 1; - this->direction = (this->direction + 0x10) & 0x1f; + this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest); InitAnimationForceUpdate(this, 0); } else { if ((this->frame & 0x10) != 0) { @@ -369,7 +369,7 @@ void VaatiRebornEnemyType0Action5(Entity* this) { if (this->field_0x80.HALF.LO == 0) { this->action = 1; this->timer = 1; - this->direction = 0xff; + this->direction = DIR_NONE; InitAnimationForceUpdate(this, 0); return; } @@ -394,7 +394,7 @@ void VaatiRebornEnemyType0Action5(Entity* this) { this->field_0x86.HALF.HI++; this->subtimer = (Random() & 0x3f) + 64; uVar3 = GetFacingDirection(this, &gPlayerEntity); - this->direction = (uVar3 & 0x10) | 8; + this->direction = (uVar3 & 0x10) | DirectionEast; } else { this->field_0x74.HALF.LO++; this->field_0x86.HALF.HI = 0; @@ -408,7 +408,7 @@ void VaatiRebornEnemyType0Action5(Entity* this) { this->action = 1; this->field_0x74.HALF.LO = 0; this->timer = 1; - this->direction = 0xff; + this->direction = DIR_NONE; } break; } @@ -557,7 +557,7 @@ void VaatiRebornEnemyType2Action0(Entity* this) { this->field_0x74.HALF.LO = 1; this->field_0x74.HALF.HI = 0; this->spriteOffsetY = -2; - this->direction = 0xff; + this->direction = DIR_NONE; PositionRelative(source, this, 0, Q_16_16(2.0)); InitAnimationForceUpdate(this, 2); } @@ -601,7 +601,7 @@ void VaatiRebornEnemyType2Action1(Entity* this) { void VaatiRebornEnemyType3Action0(Entity* this) { this->action = 1; this->field_0x74.HALF.LO = 0; - this->direction = 0xff; + this->direction = DIR_NONE; this->spriteOffsetY = -1; InitAnimationForceUpdate(this, this->field_0x74.HALF.LO); sub_0803DC0C(this); @@ -621,7 +621,7 @@ void VaatiRebornEnemyType3Action1(Entity* this) { } else { if (this->field_0x74.HALF.LO != 0) { this->field_0x74.HALF.LO = 0; - this->direction = 0xff; + this->direction = DIR_NONE; InitAnimationForceUpdate(this, 2); } } @@ -855,7 +855,7 @@ void VaatiRebornEnemyType0PreAction(Entity* this) { this->field_0x7c = this->y; } if (this->field_0x76.HALF.LO == 0) { - if ((this->direction == 0xff) || sub_08049FA0(this)) { + if ((this->direction == DIR_NONE) || sub_08049FA0(this)) { if (this->field_0x80.HALF.LO == 0) { this->animationState = (this->animationState + 1) & 3; this->spriteOffsetX = gUnk_080D04D3[this->animationState]; @@ -863,7 +863,7 @@ void VaatiRebornEnemyType0PreAction(Entity* this) { return; } bVar1 = sub_08049EE4(this); - this->direction = (bVar1 & 0x10) | 8; + this->direction = (bVar1 & 0x10) | DirectionEast; this->field_0x76.HALF.LO = 0x10; } else { this->field_0x76.HALF.LO--; diff --git a/src/enemy/vaatiTransfigured.c b/src/enemy/vaatiTransfigured.c index 8332a9a4..2ffeb961 100644 --- a/src/enemy/vaatiTransfigured.c +++ b/src/enemy/vaatiTransfigured.c @@ -888,7 +888,7 @@ void sub_080406A0(Entity* this) { this->direction = tmp + 0x1f; } } - this->direction &= 0x1f; + this->direction &= 0x3 | DirectionNorthWest; this->field_0x86.HALF.LO = uVar5; } @@ -974,7 +974,7 @@ void sub_08040770(Entity* this) { this->direction = tmp3 + 0x1F; } } - this->direction &= 0x1F; + this->direction &= 0x3 | DirectionNorthWest; this->field_0x86.HALF.LO = tmp2; } diff --git a/src/enemy/vaatiWrath.c b/src/enemy/vaatiWrath.c index ecfaaea7..832d73ab 100644 --- a/src/enemy/vaatiWrath.c +++ b/src/enemy/vaatiWrath.c @@ -383,7 +383,7 @@ void VaatiWrathType0Action7(Entity* this) { UpdateAnimationSingleFrame(this); if (gRoomControls.origin_y + 0x48 != this->y.HALF.HI) { this->speed = 0x100; - this->direction = ((gRoomControls.origin_y + 0x48) >= this->y.HALF.HI) ? 0x10 : 0; + this->direction = ((gRoomControls.origin_y + 0x48) >= this->y.HALF.HI) ? DirectionSouth : DirectionNorth; LinearMoveUpdate(this); } else { if (--this->timer == 0) { @@ -398,7 +398,7 @@ void VaatiWrathType0Action8(Entity* this) { LinearMoveUpdate(this); if (((gRoomControls.origin_x + 0x20) > this->x.HALF.HI) || ((gRoomControls.origin_x + 0x140) < this->x.HALF.HI)) { if (0x3f < this->speed) { - this->direction ^= 0x10; + this->direction ^= DirectionSouth; } } if (--this->timer == 0) { @@ -451,7 +451,7 @@ void VaatiWrathType0ActionA(Entity* this) { if (this->field_0x7a.HALF.HI == 0xf0) { this->action = 0xb; this->subAction = 0; - this->direction = 0; + this->direction = DirectionNorth; this->speed = 0x100; this->zVelocity = Q_16_16(1.125); ChangeObjPalette(this, 0x16b); @@ -521,7 +521,7 @@ void VaatiWrathType0ActionC(Entity* this) { if (this->z.HALF.HI < -4) { this->subAction = 1; this->timer = 120; - this->direction = 0x10; + this->direction = DirectionSouth; this->speed = 0x80; } break; @@ -998,8 +998,8 @@ void sub_0804235C(Entity* this) { void VaatiWrathType0PreAction(Entity* this) { int temp; if ((gRoomTransition.field_0x38 & 2) == 0) { - if (gSave.timers[3] != 0) { - gSave.timers[3]--; + if (gSave.vaati_timer != 0) { + gSave.vaati_timer--; } else { temp = gPlayerState.framestate_last; switch (temp) { |
