diff --git a/data/scripts/cutscene/introAssembly/script_PlayerGetSword.inc b/data/scripts/cutscene/introAssembly/script_PlayerGetSword.inc index ebabde5d..812f5e39 100644 --- a/data/scripts/cutscene/introAssembly/script_PlayerGetSword.inc +++ b/data/scripts/cutscene/introAssembly/script_PlayerGetSword.inc @@ -3,7 +3,7 @@ SCRIPT_START script_PlayerGetSword SetInventoryValue ITEM_SMITH_SWORD, 0x0001 CallWithArg PutItemAnySlot, ITEM_SMITH_SWORD PlaySound SFX_ITEM_GET - CallWithArg SetPlayerAnimation2, 0x0000045f + CallWithArg SetPlayerAnimation2, ANIM_GET_ITEM_SWORD Call WaitForPlayerAnim MessageFromTargetPos TEXT_ITEM_GET, 0x01, 0x000e WaitUntilTextboxCloses diff --git a/data/scripts/cutscene/outro/script_PlayerGetGreenCap.inc b/data/scripts/cutscene/outro/script_PlayerGetGreenCap.inc index 85ba5972..a1249100 100644 --- a/data/scripts/cutscene/outro/script_PlayerGetGreenCap.inc +++ b/data/scripts/cutscene/outro/script_PlayerGetGreenCap.inc @@ -2,7 +2,7 @@ SCRIPT_START script_PlayerGetGreenCap BeginBlock Call sub_08094BE0 - CallWithArg SetPlayerAnimation2, 0x0000045b + CallWithArg SetPlayerAnimation2, ANIM_GET_ITEM_BIG_NOCAP PlaySound SFX_ITEM_GET EndBlock Call WaitForPlayerAnim @@ -10,7 +10,7 @@ SCRIPT_START script_PlayerGetGreenCap SetSyncFlag 0x00000008 BeginBlock CallWithArg ResetPlayerFlag, PL_NO_CAP - CallWithArg SetPlayerAnimation2, 0x000008e4 + CallWithArg SetPlayerAnimation2, ANIM_GET_NEWCAP EndBlock Call WaitForPlayerAnim SetAnimationState 0x0004 diff --git a/data/scripts/cutscene/takeover/script_PlayerAtTakeover.inc b/data/scripts/cutscene/takeover/script_PlayerAtTakeover.inc index aea96906..423e3ed9 100644 --- a/data/scripts/cutscene/takeover/script_PlayerAtTakeover.inc +++ b/data/scripts/cutscene/takeover/script_PlayerAtTakeover.inc @@ -7,11 +7,11 @@ SCRIPT_START script_PlayerAtTakeover _0807EDD4 0x0168, 0x0058 SetAnimationState 0x0004 DoPostScriptAction 0x0000 - CallWithArg SetPlayerAnimation2, 0x000003c5 + CallWithArg SetPlayerAnimation2, ANIM_EZLO_SEARCH Call WaitForPlayerAnim MessageFromTargetPos TEXT_VAATI, 0x18, 0x000c WaitUntilTextboxCloses - CallWithArg SetPlayerAnimation2, 0x000003c9 + CallWithArg SetPlayerAnimation2, ANIM_EZLO_LEAVE_LEFT Call WaitForPlayerAnim SetAnimationState 0x0004 DoPostScriptAction 0x0000 diff --git a/data/scripts/dhc/script_PlayerStonesFall.inc b/data/scripts/dhc/script_PlayerStonesFall.inc index b2a41dd6..adafc6cd 100644 --- a/data/scripts/dhc/script_PlayerStonesFall.inc +++ b/data/scripts/dhc/script_PlayerStonesFall.inc @@ -3,7 +3,7 @@ SCRIPT_START script_PlayerStonesFall EndBlock SetAnimationState 0x0004 DoPostScriptAction 0x0000 - CallWithArg SetPlayerAnimation2, 0x000003c5 + CallWithArg SetPlayerAnimation2, ANIM_EZLO_SEARCH Call WaitForPlayerAnim SetSyncFlag 0x00000004 Call SetPlayerActionNormal diff --git a/data/scripts/mtCrenel/script_PlayerGetWhiteSword.inc b/data/scripts/mtCrenel/script_PlayerGetWhiteSword.inc index 2989fde6..3054711b 100644 --- a/data/scripts/mtCrenel/script_PlayerGetWhiteSword.inc +++ b/data/scripts/mtCrenel/script_PlayerGetWhiteSword.inc @@ -3,7 +3,7 @@ SCRIPT_START script_PlayerGetWhiteSword SetInventoryValue ITEM_GREEN_SWORD, 0x0001 CallWithArg PutItemAnySlot, ITEM_GREEN_SWORD PlaySound SFX_ITEM_GET - CallWithArg SetPlayerAnimation2, 0x000001e2 + CallWithArg SetPlayerAnimation2, ANIM_GET_WHITE_SWORD Call WaitForPlayerAnim MessageNoOverlap TEXT_ITEM_GET, 0x02 WaitUntilTextboxCloses diff --git a/data/scripts/sanctuary/script_PlayerPickUpFinalSword.inc b/data/scripts/sanctuary/script_PlayerPickUpFinalSword.inc index 7ef157da..43f188e8 100644 --- a/data/scripts/sanctuary/script_PlayerPickUpFinalSword.inc +++ b/data/scripts/sanctuary/script_PlayerPickUpFinalSword.inc @@ -2,7 +2,7 @@ SCRIPT_START script_PlayerPickUpFinalSword CallWithArg sub_08095E7C, script_CutsceneMiscObjectSwordCharge11 PlaySound SFX_1D3 - CallWithArg SetPlayerAnimation2, 0x000008e3 + CallWithArg SetPlayerAnimation2, ANIM_GET_LAST_SWORD Call sub_08096028 Wait 0x0078 SetSyncFlag 0x00020000 diff --git a/data/scripts/sanctuary/script_PlayerPickUpSword.inc b/data/scripts/sanctuary/script_PlayerPickUpSword.inc index c873fa4e..fff8a063 100644 --- a/data/scripts/sanctuary/script_PlayerPickUpSword.inc +++ b/data/scripts/sanctuary/script_PlayerPickUpSword.inc @@ -1,7 +1,7 @@ @ Player at Sanctuary pick up sword SCRIPT_START script_PlayerPickUpSword PlaySound SFX_1D3 - CallWithArg SetPlayerAnimation2, 0x000008bf + CallWithArg SetPlayerAnimation2, ANIM_GET_NEW_SWORD Call sub_08096028 Wait 0x003c SetSyncFlag 0x00020000 diff --git a/data/scripts/unused/script_08016482.inc b/data/scripts/unused/script_08016482.inc index 70f9b944..7ffcc08a 100644 --- a/data/scripts/unused/script_08016482.inc +++ b/data/scripts/unused/script_08016482.inc @@ -14,7 +14,7 @@ SCRIPT_START script_08016482 DisablePlayerControl SetPlayerAction 0x00005408 StartPlayerScript script_08016384 - SetPlayerAnimation 0x03a0 + SetPlayerAnimation ANIM_FALL_ON_BACK _0807E8E4_0 _0807E8E4_1 _0807E8E4_2 diff --git a/include/area.h b/include/area.h index ce25c8df..a21ee5b0 100644 --- a/include/area.h +++ b/include/area.h @@ -6,6 +6,16 @@ #define MAX_ROOMS 64 +typedef enum { + PT_TREESTUMP, + PT_ROCK, + PT_2, + PT_DUNGEON, + PT_JAR, + PT_5, + PT_TOD, +} PortalTypes; + typedef struct { u16 pixel_width; u16 pixel_height; diff --git a/include/player.h b/include/player.h index 147ec5cb..eec1fc9e 100644 --- a/include/player.h +++ b/include/player.h @@ -95,6 +95,12 @@ typedef enum { CONTROL_DISABLED, } PlayerControlMode; +typedef enum { + DIR_DIAGONAL = 0x4, + DIR_NOT_MOVING_CHECK = 0x80, + DIR_NONE = 0xff, +} PlayerDirections; + typedef enum { PL_BUSY = 0x1, PL_FLAGS2 = 0x2, @@ -125,6 +131,8 @@ typedef enum { PL_SWORD_THRUST = 0x8000000, PL_USE_OCARINA = 0x10000000, PL_CLIMBING = 0x20000000, + PL_FLAGS40000000 = 0x40000000, + PL_FLAGS80000000 = 0x80000000, } PlayerFlags; enum PlayerItemId { @@ -274,6 +282,167 @@ typedef enum { SWORD_MOVE_LOW_BEAM, } SwordMove; +typedef enum { + ANIM_DEFAULT = 0x100, + ANIM_WALK = 0x104, + ANIM_SWORD = 0x108, + ANIM_BOUNCE = 0x114, + ANIM_SPINATTACK = 0x124, + ANIM_GREATSPIN = 0x128, + ANIM_ROLLATTACK_SPIN = 0x12c, + ANIM_ROLLATTACK_SLIDE = 0x130, + ANIM_ROLLATTACK_END = 0x134, + ANIM_SHIELD_PULLOUT = 0x158, + ANIM_SHIELD_WALK = 0x160, + ANIM_SHIELD = 0x164, + ANIM_SWORD_CHARGE = 0x168, + ANIM_SWORD_CHARGE_WALK = 0x16c, + ANIM_SWORD_CHARGE_BUMP = 0x170, + ANIM_DOWN_THRUST = 0x174, + ANIM_FALL = 0x1b8, + ANIM_GET_ITEM_BIG = 0x1b9, + ANIM_FALL_MINISH = 0x1ba, + ANIM_DIE1 = 0x1bc, + ANIM_GET_WHITE_SWORD = 0x1e2, + ANIM_BOW_PULLOUT = 0x21c, + ANIM_TRAPPED = 0x25c, + ANIM_BOW_SHOOT = 0x27c, + ANIM_BOW_CHARGE = 0x280, + ANIM_BOW_WALK = 0x284, + ANIM_ROCS_CAPE = 0x288, + ANIM_SWIM_STILL = 0x28c, + ANIM_SWIM_MOVE = 0x290, + ANIM_FROZEN = 0x294, + ANIM_DASH = 0x298, + ANIM_ELECTROCUTED = 0x29c, + ANIM_ROLL = 0x2ac, + ANIM_DIE2 = 0x2bd, + ANIM_DIVE = 0x2be, + ANIM_IN_LAVA = 0x2c1, + ANIM_PORTAL = 0x2c2, + ANIM_PORTAL_SHRINK = 0x2c3, + ANIM_DROWN_RESPAWN = 0x2ce, + ANIM_CLIMB1_UP = 0x2cf, + ANIM_CLIMB2_UP = 0x2d0, + ANIM_CLIMB1_DOWN = 0x2d1, + ANIM_CLIMB2_DOWN = 0x2d2, + ANIM_CLIMB_FROM_TOP = 0x2d3, + ANIM_CLIMB_LEFT = 0x2d4, + ANIM_CLIMB_RIGHT = 0x2d5, + ANIM_CLIMB_TO_TOP = 0x2d6, + ANIM_BOTTLE_DRINK = 0x2df, + ANIM_GET_ITEM_SMALL = 0x2e0, + ANIM_PICKUP = 0x338, + ANIM_PUSH = 0x33c, + ANIM_PULL = 0x340, + ANIM_THROW = 0x344, + ANIM_CARRY = 0x348, + ANIM_PULL2 = 0x34c, + ANIM_CARRY_STAND = 0x350, + ANIM_GRAB = 0x378, + ANIM_FALL_ON_BACK = 0x3a0, + ANIM_LAUNCHED = 0x3c0, + ANIM_EZLO_SEARCH = 0x3c5, + ANIM_EZLO_APPEAR_LEFT = 0x3c6, + ANIM_EZLO_EYES_UP = 0x3c7, + ANIM_EZLO_HEAD_DOWN = 0x3c8, + ANIM_EZLO_LEAVE_LEFT = 0x3c9, + ANIM_EZLO_APPEAR_RIGHT = 0x3ca, + ANIM_EZLO_EYES_MIDDLE = 0x3cc, + ANIM_EZLO_LEAVE_RIGHT = 0x3cd, + ANIM_DEFAULT_NOCAP = 0x400, + ANIM_WALK_NOCAP = 0x404, + ANIM_SWORD_NOCAP = 0x408, + ANIM_SHIELD_PULLOUT_NOCAP = 0x40c, + ANIM_SHIELD_WALK_NOCAP = 0x410, + ANIM_SHIELD_NOCAP = 0x414, + ANIM_BOUNCE_NOCAP = 0x418, + ANIM_HOP_NOCAP = 0x41c, + ANIM_JUMP_NOCAP = 0x420, + ANIM_LAND_NOCAP = 0x424, + ANIM_ROLL_NOCAP = 0x438, + ANIM_DROWN_NOCAP = 0x44c, + ANIM_FALL_NOCAP = 0x458, + ANIM_DIE1_NOCAP = 0x459, + ANIM_DIE2_NOCAP = 0x45a, + ANIM_GET_ITEM_BIG_NOCAP = 0x45b, + ANIM_GET_ITEM_SMALL_NOCAP = 0x45e, + ANIM_GET_ITEM_SWORD = 0x45f, + ANIM_GUSTJAR_PULLOUT = 0x500, + ANIM_GUSTJAR_SUCK = 0x504, + ANIM_MOLEMITTS_FLOOR = 0x508, + ANIM_MOLEMITTS_DIG = 0x50c, + ANIM_GUSTJAR_END = 0x510, + ANIM_GUSTJAR_BLOW = 0x514, + ANIM_GUSTJAR_WALK = 0x518, + ANIM_MOLEMITTS_CLANG = 0x51c, + ANIM_MOLEMITTS_MISS = 0x520, + ANIM_GUSTJAR_524 = 0x524, + ANIM_ENTER_POT = 0x52c, + ANIM_IN_POT = 0x530, + ANIM_LANTERN_LIGHT = 0x600, + ANIM_LANTERN_ON = 0x604, + ANIM_LANTERN = 0x608, + ANIM_LANTERN_BURN = 0x60c, + ANIM_BOTTLE_POUR = 0x610, + ANIM_BOTTLE_SWING = 0x614, + ANIM_BOTTLE_SWING_END = 0x618, + ANIM_FALL_IN_HOLE = 0x61c, + ANIM_IN_HOLE = 0x620, + ANIM_SPRING_JUMP = 0x624, + ANIM_CANE = 0x628, + ANIM_PARACHUTE_ACTIVATE = 0x700, + ANIM_BOOMERANG_MAGIC = 0x704, + ANIM_PARACHUTE = 0x708, + ANIM_MINECART_PAUSE = 0x70c, + ANIM_MINECART = 0x710, + ANIM_DROWN = 0x72c, + ANIM_PARACHUTE_FALL = 0x730, + ANIM_PUT_ON_EZLO = 0x734, + ANIM_SLEEP = 0x736, + ANIM_WAKEUP = 0x737, + ANIM_PORTAL_ACTIVATE = 0x738, + ANIM_SLEEP_NOCAP = 0x73a, + ANIM_WAKEUP_NOCAP = 0x73b, + ANIM_GROW = 0x73c, + ANIM_HOP = 0x80c, + ANIM_JUMP = 0x810, + ANIM_BOOMERANG = 0x818, + ANIM_LAND = 0x820, + ANIM_MOLDWORM_CAPTURED = 0x8b0, + ANIM_GET_NEW_SWORD = 0x8bf, + ANIM_OCARINA = 0x8e1, + ANIM_GET_LAST_SWORD = 0x8e3, + ANIM_GET_NEWCAP = 0x8e4, + ANIM_PICKUP_NOCAP = 0x928, + ANIM_CARRY_STAND_NOCAP = 0x92c, + ANIM_THROW_NOCAP = 0x930, + ANIM_CARRY_NOCAP = 0x934, + ANIM_PUSH_NOCAP = 0x93c, + ANIM_PULL_NOCAP = 0x944, + ANIM_GRAB_NOCAP = 0x948, + ANIM_FALL_IN_HOLE_NOCAP = 0x950, + ANIM_IN_HOLE_NOCAP = 0x954, + ANIM_SWORD_MINISH = 0xc00, + ANIM_WALK_MINISH = 0xc04, + ANIM_ROLL_MINISH = 0xc08, + ANIM_SWIM_MINISH = 0xc0c, + ANIM_DASH_MINISH = 0xc10, + ANIM_DASH_CHARGE_MINISH = 0xc14, + ANIM_BOUNCE_MINISH = 0xc18, + ANIM_DROWN_MINISH = 0xc19, + ANIM_DIE1_MINISH = 0xc1a, + ANIM_DIE2_MINISH = 0xc1b, + ANIM_DIVE_MINISH = 0xc1c, +} PlayerAnimation; + +typedef enum { + PAS_NORTH, + PAS_EAST, + PAS_SOUTH, + PAS_WEST, +} PlayerAnimationState; + typedef struct { /*0x00*/ u8 prevAnim; /*0x01*/ u8 grab_status; @@ -303,7 +472,8 @@ typedef struct { /*0x1c*/ u8 field_0x1c; /*0x1d*/ u8 gustJarSpeed; /*0x1e*/ u8 dash_state; - /*0x1f*/ u8 field_0x1f[3]; + /*0x1f*/ u8 field_0x1f[2]; + /*0x21*/ u8 bow_state; /*0x22*/ u16 tilePosition; /*0x24*/ u16 tileType; /*0x26*/ u8 swim_state; /**< Is the player swimming? 0x80 for diving */ diff --git a/include/sound.h b/include/sound.h index f62768ad..749a1268 100644 --- a/include/sound.h +++ b/include/sound.h @@ -168,7 +168,7 @@ typedef enum { SFX_FALL_HOLE, SFX_86, SFX_PLY_DIE, - SFX_88, + SFX_GRAB, SFX_BARREL_RELEASE, SFX_BARREL_ENTER, SFX_BARREL_ROLL, @@ -295,7 +295,7 @@ typedef enum { SFX_PLACE_OBJ, SFX_105, SFX_106, - SFX_107, + SFX_ITEM_GLOVES_AIR, SFX_108, SFX_ITEM_GET, SFX_10A, diff --git a/src/beanstalkSubtask.c b/src/beanstalkSubtask.c index 41dd45c3..a183d3bd 100644 --- a/src/beanstalkSubtask.c +++ b/src/beanstalkSubtask.c @@ -170,7 +170,7 @@ u32 UpdatePlayerCollision(void) { u32 index; const s16* ptr1; const s16* ptr2; - s32 tmp1; + s32 framestate; u32 tmp2; u32 tmp3; // There are some weird assignment necessary to access gPlayerEntity.animationState correctly. @@ -178,18 +178,18 @@ u32 UpdatePlayerCollision(void) { u32 animationState2; u32 animationState3; - if (gPlayerState.framestate == 0) { - tmp1 = gPlayerState.framestate_last; + if (gPlayerState.framestate == PL_STATE_IDLE) { + framestate = gPlayerState.framestate_last; } else { - tmp1 = gPlayerState.framestate; + framestate = gPlayerState.framestate; } - switch (tmp1) { - case 3: + switch (framestate) { + case PL_STATE_GUSTJAR: return 0; - case 0x12: + case PL_STATE_DIE: return 0; - case 0x16: + case PL_STATE_DROWN: return 0; } @@ -198,7 +198,7 @@ u32 UpdatePlayerCollision(void) { } else { direction = gPlayerState.direction; } - if (((direction & 0x83) == 0) && (gPlayerState.field_0xa == 0)) { + if (((direction & (DIR_NOT_MOVING_CHECK | 0x3)) == 0) && (gPlayerState.field_0xa == 0)) { index = sub_0807BDB8(&gPlayerEntity, direction >> 2); if (index != 0xff && (gRoomControls.scroll_flags & 4) == 0) { ptr1 = &gUnk_080B4490[index * 2]; @@ -254,10 +254,11 @@ u32 UpdatePlayerCollision(void) { if (gPlayerState.field_0xa != 0) { return 0; } - if ((Direction8FromAnimationState(gPlayerEntity.animationState)) - gPlayerState.direction != 0) { + if ((Direction8FromAnimationState(gPlayerEntity.animationState)) - gPlayerState.direction != + DirectionNorth) { return 0; } - if ((gPlayerEntity.direction & 0x80) != 0) { + if ((gPlayerEntity.direction & DIR_NOT_MOVING_CHECK) != 0) { return 0; } if (sub_080B1B44(position, gPlayerEntity.collisionLayer) != 0xf) { @@ -356,7 +357,8 @@ u32 UpdatePlayerCollision(void) { return 0; } #endif - if ((Direction8FromAnimationState(gPlayerEntity.animationState)) - gPlayerState.direction != 0) { + if ((Direction8FromAnimationState(gPlayerEntity.animationState)) - gPlayerState.direction != + DirectionNorth) { return 0; } if ((gPlayerEntity.direction & 0x80) != 0) { @@ -415,7 +417,7 @@ u32 UpdatePlayerCollision(void) { if ((animationState1 & 0xff) != 0) { return 0; } - if (((gPlayerState.field_0x35 | gPlayerState.direction) & 0x80) != 0) { + if (((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) != 0) { return 0; } if ((gPlayerEntity.frame & 2) == 0) { @@ -555,7 +557,7 @@ u32 UpdatePlayerCollision(void) { if (animationState3 == 0) { return 0; } - if (((gPlayerState.field_0x35 | gPlayerState.direction) & 0x80) != 0) { + if (((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) != 0) { return 0; } if ((gPlayerEntity.frame & 1) == 0) { @@ -574,7 +576,7 @@ u32 UpdatePlayerCollision(void) { if ((animationState2) != 4) { return 0; } - if (((gPlayerState.field_0x35 | gPlayerState.direction) & 0x80) != 0) { + if (((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) != 0) { return 0; } if ((gPlayerEntity.frame & 1) == 0) { @@ -595,7 +597,8 @@ bool32 sub_0801A2B0(LayerStruct* layer, u32 position, u32 collisionType) { u16 temp4; uVar1 = gUnk_080B4488[gPlayerEntity.animationState >> 1]; - if ((((gPlayerState.field_0x35 | gPlayerState.direction) & 0x80) == 0) && ((gPlayerEntity.frame & 1) != 0)) { + if ((((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) == 0) && + ((gPlayerEntity.frame & 1) != 0)) { position = (u16)(position - (-uVar1)); // necessary for match temp4 = sub_080B1B54(GetTileType(position, gPlayerEntity.collisionLayer)); switch (temp4) { @@ -712,18 +715,18 @@ bool32 sub_0801A4F8(void) { if (GetInventoryValue(ITEM_POWER_BRACELETS) != 1) { return FALSE; } - if ((gPlayerState.direction & 0x80) != 0) { + if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) != 0) { return FALSE; } if (gPlayerState.direction != gPlayerEntity.direction) { return FALSE; } - tmp = (((gPlayerEntity.direction + 4) & 0x18) >> 3); + tmp = (((gPlayerEntity.direction + 4) & DirectionWest) >> 3); if ((gUnk_080B44A0[tmp] & gPlayerEntity.collisions) == 0) { return FALSE; } } else { - if (((gPlayerState.field_0x35 | gPlayerState.direction) & 0x80) != 0) { + if (((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) != 0) { return FALSE; } if ((gPlayerEntity.frame & 1) == 0) { diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c index 86d5d1db..aeeed7f6 100644 --- a/src/enemy/acroBandits.c +++ b/src/enemy/acroBandits.c @@ -445,7 +445,7 @@ void AcroBandit_Type1Action4(Entity* this) { } } - if (this->direction & 0xf) + if (this->direction & (0x3 | DirectionEast | DIR_DIAGONAL)) this->spriteSettings.flipX = (this->direction >> 4 ^ 1); ProcessMovement0(this); @@ -486,7 +486,7 @@ void AcroBandit_Type1Action6(Entity* this) { this->action = 7; dir = fallDirections[this->field_0x74.HALF.LO * 5 + this->type2]; this->direction = dir; - if (dir >= 0x10) { + if (dir >= DirectionSouth) { this->spriteSettings.flipX = 1; } else { this->spriteSettings.flipX = 0; @@ -570,7 +570,7 @@ static void sub_080322E8(Entity* this) { } } else { u8 tmp = this->direction; - if (tmp & 0xF) { + if (tmp & (0x3 | DirectionEast | DIR_DIAGONAL)) { tmp >>= 4; tmp ^= 1; if (tmp != this->spriteSettings.flipX) { diff --git a/src/enemy/beetle.c b/src/enemy/beetle.c index ace73b7f..451d9aea 100644 --- a/src/enemy/beetle.c +++ b/src/enemy/beetle.c @@ -105,7 +105,8 @@ void sub_080218CC(Entity* this) { if (this->subAction == 0) { this->subAction = 1; this->spriteSettings.draw = 1; - this->direction = ((sub_08049F84(this, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) & 0x1f; + this->direction = ((sub_08049F84(this, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) & + (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest); this->speed = 0x100; this->zVelocity = Q_16_16(1.125); } @@ -244,9 +245,9 @@ void sub_08021B64(Entity* this) { this->zVelocity = Q_16_16(1.0); ((u8*)&this->field_0x86)[1] = 0; if (gPlayerEntity.direction != 0xff) { - this->direction = 0x10 ^ gPlayerEntity.direction; + this->direction = DirectionSouth ^ gPlayerEntity.direction; } else { - this->direction = (gPlayerEntity.animationState << 2) ^ 0x10; + this->direction = (gPlayerEntity.animationState << 2) ^ DirectionSouth; } InitializeAnimation(this, 5); } else { diff --git a/src/enemy/bladeTrap.c b/src/enemy/bladeTrap.c index 86fe70d0..5f8306bd 100644 --- a/src/enemy/bladeTrap.c +++ b/src/enemy/bladeTrap.c @@ -10,18 +10,20 @@ #include "room.h" #include "object.h" +#define DIR_NOT_MOVING_CHECK 0x80 + void BladeTrap(Entity* this) { if (this->action == 0) { this->action = 1; this->child = GetCurrentRoomProperty(this->type); UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD); } - if (!(this->direction & 0x80)) { + if (!(this->direction & DIR_NOT_MOVING_CHECK)) { LinearMoveUpdate(this); } if (!(--this->field_0x74.HWORD)) { - if (!(this->direction & 0x80)) { + if (!(this->direction & DIR_NOT_MOVING_CHECK)) { EnqueueSFX(SFX_METAL_CLINK); } UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD); diff --git a/src/enemy/bobomb.c b/src/enemy/bobomb.c index bfc8f092..ad7ceff0 100644 --- a/src/enemy/bobomb.c +++ b/src/enemy/bobomb.c @@ -62,7 +62,7 @@ void Bobomb_OnCollision(Entity* this) { this->zVelocity = Q_16_16(1.5); this->speed = 0; this->field_0x80.HALF.HI = 1; - InitializeAnimation(this, this->direction >> 4 | 6); + InitializeAnimation(this, this->direction >> 4 | IdleWest); break; } } @@ -123,7 +123,7 @@ void sub_0802C83C(Entity* this) { } else { this->field_0x82.HALF.LO = 2; this->timer = 120; - InitializeAnimation(this, (this->direction >> 4) | 6); + InitializeAnimation(this, (this->direction >> 4) | IdleWest); COLLISION_OFF(this); this->hitType = 0x6e; } @@ -147,7 +147,7 @@ void sub_0802C8D8(Entity* this) { this->action = 1; this->timer = 60; this->subtimer = 0; - this->direction = (Random() & 0x18) | 4; + this->direction = (Random() & 0x18) | DIR_DIAGONAL; this->carryFlags = 0; this->gustJarFlags = 0x12; this->field_0x82.HALF.LO = 0; @@ -163,7 +163,7 @@ void sub_0802C91C(Entity* this) { if (this->field_0x82.HALF.LO) { if (this->collisions != COL_NONE) { sub_0800417E(this, this->collisions); - InitializeAnimation(this, (this->direction >> 4) | 2); + InitializeAnimation(this, (this->direction >> 4) | IdleEast); } if (--this->timer == 0) { sub_0802CBC4(this); @@ -180,7 +180,7 @@ void sub_0802C91C(Entity* this) { } if (--this->timer == 0) { this->timer = 60; - this->direction = (this->direction + 8) & 0x1c; + this->direction = (this->direction + 8) & (DirectionWest | DIR_DIAGONAL); InitializeAnimation(this, this->direction >> 4); } } @@ -196,7 +196,7 @@ void sub_0802C9D0(Entity* this) { this->spritePriority.b1 = 0; this->field_0x82.HALF.HI = 1; sub_0802CC18(this); - InitializeAnimation(this, (this->direction >> 4) | 6); + InitializeAnimation(this, (this->direction >> 4) | IdleWest); GetNextFrame(this); } @@ -210,7 +210,7 @@ void sub_0802CA10(Entity* this) { } } else { this->field_0x82.HALF.HI = 2; - this->direction = (((gPlayerEntity.animationState) << 2) | 4) & 0x1c; + this->direction = (((gPlayerEntity.animationState) << 2) | IdleSouth) & (DIR_DIAGONAL | DirectionWest); sub_0802CC18(this); GetNextFrame(this); } @@ -234,8 +234,8 @@ void sub_0802CA94(Entity* this) { this->speed = 0; this->field_0x82.HALF.HI = 0; this->field_0x80.HALF.HI = 0; - this->direction = ((gPlayerEntity.animationState << 2) | 4) & 0x1c; - InitializeAnimation(this, (this->direction >> 4) | 6); + this->direction = ((gPlayerEntity.animationState << 2) | IdleSouth) & (DirectionWest | DIR_DIAGONAL); + InitializeAnimation(this, (this->direction >> 4) | IdleWest); } void sub_0802CAF8(Entity* this) { @@ -264,7 +264,7 @@ void sub_0802CB68(Entity* this) { this->action = 1; this->subAction = 0; this->direction = Random() & 0x18; - this->direction |= 4; + this->direction |= IdleSouth; COLLISION_ON(this); if (this->field_0x82.HALF.LO) { this->timer = 200; diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c index 96dbcba4..ab856221 100644 --- a/src/enemy/bombPeahat.c +++ b/src/enemy/bombPeahat.c @@ -141,10 +141,10 @@ void sub_0802A9A8(Entity* this) { this->field_0x82.HWORD = 1; if (this->field_0x80.HALF.LO) { this->x.HALF.HI = gRoomControls.scroll_x - 0x10; - this->direction = 8; + this->direction = DirectionEast; } else { this->x.HALF.HI = gRoomControls.scroll_x + 0x100; - this->direction = 0x18; + this->direction = DirectionWest; } this->y.HALF.HI = gRoomControls.scroll_y + 0x40; this->timer = 128; @@ -221,7 +221,7 @@ void sub_0802AAC0(Entity* this) { #ifndef EU this->field_0x78.HALF.LO = 0; this->field_0x78.HALF.HI = 4; - this->direction = 0xff; + this->direction = DIR_NONE; #endif InitializeAnimation(this, 0); } diff --git a/src/enemy/businessScrub.c b/src/enemy/businessScrub.c index 70467401..a1704040 100644 --- a/src/enemy/businessScrub.c +++ b/src/enemy/businessScrub.c @@ -79,7 +79,7 @@ void BusinessScrub_Action0(Entity* this) { this->field_0x78.HWORD = this->x.HALF.HI; this->field_0x7a.HWORD = this->y.HALF.HI; this->animationState = 0; - this->direction = 0x10; + this->direction = DirectionSouth; sub_08028E9C(this); if ((*(u8*)this->field_0x7c.WORD & 1) || CheckFlags(this->field_0x86.HWORD)) { this->action = 4; @@ -455,8 +455,8 @@ void sub_080290FC(Entity* this) { if (this->timer != 0) { this->timer--; if ((this->timer < 16) && ((this->timer & 1) == 0)) { - s32 sVar3 = ((this->direction & 0x10) != 0) ? -1 : 1; - if ((this->direction & 8) != 0) { + s32 sVar3 = (this->direction & DirectionSouth) ? -1 : 1; + if (this->direction & DirectionEast) { this->x.HALF.HI += ((this->timer & 8) != 0) ? -sVar3 : sVar3; } else { this->y.HALF.HI += ((this->timer & 8) != 0) ? sVar3 : -sVar3; diff --git a/src/enemy/businessScrubPrologue.c b/src/enemy/businessScrubPrologue.c index aeaa5f6f..657d9d0b 100644 --- a/src/enemy/businessScrubPrologue.c +++ b/src/enemy/businessScrubPrologue.c @@ -66,7 +66,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; diff --git a/src/enemy/chaser.c b/src/enemy/chaser.c index 895c13f1..40f365c2 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 ab565a0d..2ea26212 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -554,7 +554,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 ca4f3585..6611126b 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 7e0ee931..9fe5532b 100644 --- a/src/enemy/enemy4D.c +++ b/src/enemy/enemy4D.c @@ -108,7 +108,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/eyegore.c b/src/enemy/eyegore.c index f0c8efd5..1409dd50 100644 --- a/src/enemy/eyegore.c +++ b/src/enemy/eyegore.c @@ -146,7 +146,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; @@ -198,7 +198,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); @@ -242,7 +242,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 { @@ -266,7 +266,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 db1bf3da..3eb404a1 100644 --- a/src/enemy/fireballGuy.c +++ b/src/enemy/fireballGuy.c @@ -117,7 +117,7 @@ void sub_08045524(Entity* this) { this->zVelocity = Q_16_16(1.75); tmp = sub_0804A024(this, 1, 8); - if (tmp != 0xff && (Random() & 3) == 0) { + if (tmp != DIR_NONE && (Random() & 3) == 0) { this->timer = Random() & 3; this->direction = DirectionRound(tmp); } else { diff --git a/src/enemy/gyorgMale.c b/src/enemy/gyorgMale.c index 20f09035..275d0ab1 100644 --- a/src/enemy/gyorgMale.c +++ b/src/enemy/gyorgMale.c @@ -164,8 +164,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 18976674..122ac212 100644 --- a/src/enemy/helmasaur.c +++ b/src/enemy/helmasaur.c @@ -215,9 +215,9 @@ void sub_0802BE80(Entity* this) { } void sub_0802BEBC(Entity* this) { - this->direction ^= 0x10; + this->direction ^= DirectionSouth; ProcessMovement2(this); - this->direction ^= 0x10; + this->direction ^= DirectionSouth; if (!sub_080044EC(this, Q_16_16(0.125))) { sub_0802C1C0(this); } diff --git a/src/enemy/lakituCloud.c b/src/enemy/lakituCloud.c index 6e2c7091..23ff2274 100644 --- a/src/enemy/lakituCloud.c +++ b/src/enemy/lakituCloud.c @@ -89,7 +89,7 @@ void sub_0803CD6C(Entity* this) { void sub_0803CDA8(Entity* this) { UpdateAnimationSingleFrame(this); - if ((this->direction & 0x80) == 0) { + if (!(this->direction & DIR_NOT_MOVING_CHECK)) { LinearMoveUpdate(this); } @@ -123,7 +123,7 @@ void sub_0803CE14(Entity* this) { UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD); direction = this->direction; - if (direction & 0x80) { + if (direction & DIR_NOT_MOVING_CHECK) { return; } diff --git a/src/enemy/leever.c b/src/enemy/leever.c index 87f8dc9a..2cfe61cd 100644 --- a/src/enemy/leever.c +++ b/src/enemy/leever.c @@ -73,7 +73,8 @@ void Leever_Idle(Entity* this) { if (Leever_PlayerInRange(this, Random() & 0x1f)) { this->action = 2; this->spriteSettings.draw = TRUE; - this->direction = (GetFacingDirection(this, gUnk_020000B0) + gLeeverDrift[Random() & 1]) & 0x1f; + this->direction = + (GetFacingDirection(this, gUnk_020000B0) + gLeeverDrift[Random() & 1]) & (0x3 | DirectionNorthWest); InitializeAnimation(this, LeeverAnimation_DigUp); UpdateSpriteForCollisionLayer(this); } else { diff --git a/src/enemy/madderpillar.c b/src/enemy/madderpillar.c index ad81c2d4..9a443e8e 100644 --- a/src/enemy/madderpillar.c +++ b/src/enemy/madderpillar.c @@ -369,16 +369,16 @@ void sub_08029EEC(Entity* this) { void sub_08029F0C(Entity* this) { switch (this->direction >> 3) { - case 0: + case 0: // UP this->field_0x78.HWORD = this->y.HALF.HI - 0x10; break; - case 1: + case 1: // RIGHT this->field_0x78.HWORD = this->x.HALF.HI + 0x10; break; - case 2: + case 2: // DOWN this->field_0x78.HWORD = this->y.HALF.HI + 0x10; break; - case 3: + case 3: // LEFT this->field_0x78.HWORD = this->x.HALF.HI - 0x10; break; } @@ -386,25 +386,25 @@ void sub_08029F0C(Entity* this) { bool32 sub_08029F48(Entity* this) { switch (this->direction >> 3) { - case 0: + case 0: // UP if (this->y.HALF.HI <= this->field_0x78.HWORD) { this->y.HALF.HI = this->field_0x78.HWORD; return TRUE; } break; - case 1: + case 1: // RIGHT if (this->x.HALF.HI >= this->field_0x78.HWORD) { this->x.HALF.HI = this->field_0x78.HWORD; return TRUE; } break; - case 2: + case 2: // DOWN if (this->y.HALF.HI >= this->field_0x78.HWORD) { this->y.HALF.HI = this->field_0x78.HWORD; return TRUE; } break; - case 3: + case 3: // LEFT if (this->x.HALF.HI <= this->field_0x78.HWORD) { this->x.HALF.HI = this->field_0x78.HWORD; return TRUE; diff --git a/src/enemy/mazaalBracelet.c b/src/enemy/mazaalBracelet.c index d21e8636..9180ae73 100644 --- a/src/enemy/mazaalBracelet.c +++ b/src/enemy/mazaalBracelet.c @@ -509,7 +509,7 @@ void sub_0803A8B8(Entity* this) { this->action = 0x10; this->timer = 30; - this->direction = 0; + this->direction = DirectionNorth; this->speed = 0x80; ptr = gUnk_080CED6C; @@ -553,7 +553,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); @@ -1225,7 +1225,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 a6a9ad92..1a027a87 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 facad891..3d0daa83 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 7b5ead2a..a6ba87da 100644 --- a/src/enemy/peahat.c +++ b/src/enemy/peahat.c @@ -182,7 +182,8 @@ void Peahat_ChargeStart(Entity* this) { this->action = 3; this->timer = 120; this->speed = 192; - this->direction = (GetFacingDirection(this, gUnk_020000B0) + gUnk_080CA5D4[Random() & 1]) & 0x1f; + this->direction = + (GetFacingDirection(this, gUnk_020000B0) + gUnk_080CA5D4[Random() & 1]) & (0x3 | DirectionNorthWest); } } else { sub_080205F8(this); @@ -226,6 +227,8 @@ void Peahat_ChargeEnd(Entity* this) { } } +#define DIR_NONE 0xff + void Peahat_Stunned(Entity* this) { switch (this->animationState) { default: @@ -236,7 +239,7 @@ void Peahat_Stunned(Entity* this) { this->hitType = 0x71; } - if (this->direction == 0xff) + if (this->direction == DIR_NONE) this->direction = this->knockbackDirection; ProcessMovement0(this); @@ -364,7 +367,7 @@ void sub_08020604(Entity* this) { this->direction = sub_08049EE4(this); } else { this->direction += this->field_0x80.HALF.LO; - this->direction &= 0x1f; + this->direction &= (0x3 | DirectionNorthWest); } } diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c index b395ba9e..d0299a3e 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 63ef70b4..c7bfafce 100644 --- a/src/enemy/puffstool.c +++ b/src/enemy/puffstool.c @@ -338,7 +338,7 @@ void sub_080255AC(Entity* this) { } tmp -= 7; - this->direction = (GetFacingDirection(ent, this) + tmp) & 0x1f; + this->direction = (GetFacingDirection(ent, this) + tmp) & (0x3 | DirectionNorthWest); } if (this->field_0x78.HWORD == 0) { @@ -378,7 +378,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 f55a3c34..e064cfeb 100644 --- a/src/enemy/rollobite.c +++ b/src/enemy/rollobite.c @@ -39,7 +39,7 @@ void Rollobite_OnCollision(Entity* this) { if (this->hitType == 34 && this->health != 0xff) { this->action = 4; this->zVelocity = Q_16_16(2.0); - this->direction = 0xff; + this->direction = DIR_NONE; this->health = 0xff; this->hitType = 35; InitializeAnimation(this, this->animationState + 8); @@ -49,7 +49,7 @@ void Rollobite_OnCollision(Entity* this) { if (this->action == 4 || this->action == 5) { this->action = 4; this->timer = 180; - this->direction = 0xff; + this->direction = DIR_NONE; InitializeAnimation(this, this->animationState + 0x10); } } @@ -74,7 +74,7 @@ void Rollobite_OnGrabbed(Entity* this) { if (this->subAction < 3 && !sub_0806F520(this)) { this->action = 4; COLLISION_ON(this); - this->direction = 0xff; + this->direction = DIR_NONE; InitializeAnimation(this, this->animationState + 0x10); } else { gUnk_080CA6A4[this->subAction](this); @@ -107,7 +107,7 @@ void sub_080207A8(Entity* this) { COLLISION_ON(this); this->spritePriority.b0 = 4; this->gustJarState &= 0xfb; - this->direction ^= 0x10; + this->direction ^= DirectionSouth; this->zVelocity = Q_16_16(1.5); this->speed = 0x80; InitializeAnimation(this, this->animationState + 0x10); @@ -193,7 +193,7 @@ void Rollobite_RolledUp(Entity* this) { if (unk == 1) EnqueueSFX(SFX_PLACE_OBJ); - if ((this->direction & 0x80) == 0) + if (!(this->direction & DIR_NOT_MOVING_CHECK)) ProcessMovement2(this); } } @@ -248,8 +248,8 @@ void sub_08020A7C(Entity* this) { if (sub_08049FA0(this) == 0) { int tmp = DirectionRoundUp(sub_08049EE4(this)); - if ((state ^ 0x10) == tmp) - state ^= 0x10; + if ((state ^ DirectionSouth) == tmp) + state ^= DirectionSouth; } this->direction = state; diff --git a/src/enemy/ropeGolden.c b/src/enemy/ropeGolden.c index b5d0f886..32535b12 100644 --- a/src/enemy/ropeGolden.c +++ b/src/enemy/ropeGolden.c @@ -131,7 +131,7 @@ void sub_08038304(Entity* this) { } this->field_0x7a.HALF.LO = this->field_0x78.HALF.HI; this->field_0x78.HALF.HI = cVar2; - this->direction = (this->direction + cVar2) & 0x18; + this->direction = (this->direction + cVar2) & DirectionWest; } else { this->direction = this->field_0x78.HALF.LO; } diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c index 39a8e586..ab1b3c0f 100644 --- a/src/enemy/rupeeLike.c +++ b/src/enemy/rupeeLike.c @@ -218,7 +218,7 @@ void sub_08029688(Entity* this) { void sub_0802969C(Entity* this) { u32 bVar1; - if ((this->direction & 0xf) != 0) { + if (this->direction & (0x3 | DIR_DIAGONAL | DirectionEast)) { bVar1 = this->direction >> 4; if (bVar1 != this->animationState) { diff --git a/src/enemy/sensorBladeTrap.c b/src/enemy/sensorBladeTrap.c index 627a75bb..87fea681 100644 --- a/src/enemy/sensorBladeTrap.c +++ b/src/enemy/sensorBladeTrap.c @@ -42,16 +42,16 @@ void sub_0802BA18(Entity* this) { this->direction = direction; switch (direction >> 3) { - case 0: + case 0: // UP this->field_0x7a.HWORD = this->y.HALF.HI - this->field_0x7c.HALF.HI; break; - case 1: + case 1: // RIGHT this->field_0x7a.HWORD = this->x.HALF.HI + this->field_0x7c.HALF.LO; break; - case 2: + case 2: // DOWN this->field_0x7a.HWORD = this->y.HALF.HI + this->field_0x7c.HALF.HI; break; - case 3: + case 3: // LEFT this->field_0x7a.HWORD = this->x.HALF.HI - this->field_0x7c.HALF.LO; break; } @@ -62,19 +62,19 @@ void sub_0802BA8C(Entity* this) { sub_0802BB10(this); } else { switch (this->direction >> 3) { - case 0: + case 0: // UP if (this->field_0x7a.HWORD >= this->y.HALF.HI) sub_0802BB10(this); break; - case 1: + case 1: // RIGHT if (this->field_0x7a.HWORD <= this->x.HALF.HI) sub_0802BB10(this); break; - case 2: + case 2: // DOWN if (this->field_0x7a.HWORD <= this->y.HALF.HI) sub_0802BB10(this); break; - case 3: + case 3: // LEFT if (this->field_0x7a.HWORD >= this->x.HALF.HI) sub_0802BB10(this); break; @@ -91,7 +91,7 @@ void sub_0802BAFC(Entity* this) { void sub_0802BB10(Entity* this) { this->action = 3; this->speed = 0xc0; - this->direction = this->direction ^ 0x10; + this->direction = this->direction ^ DirectionSouth; EnqueueSFX(SFX_METAL_CLINK); } diff --git a/src/enemy/smallPesto.c b/src/enemy/smallPesto.c index 490da140..1997c4df 100644 --- a/src/enemy/smallPesto.c +++ b/src/enemy/smallPesto.c @@ -91,8 +91,8 @@ void sub_08031714(Entity* this) { if (sub_08049FA0(this) == 0 && (this->subtimer & 1) != 0) { this->direction = sub_08049EE4(this); } else { - this->direction += 0x18; - this->direction = ((Random() & 0xe) + this->direction) & 0x1f; + this->direction += DirectionWest; + this->direction = ((Random() & 0xe) + this->direction) & (0x3 | DirectionNorthWest); } sub_080317E0(this); } diff --git a/src/enemy/spark.c b/src/enemy/spark.c index 26ea7c79..91efe2ff 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 29c2584f..0a6765b5 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 36deab65..6cb42502 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/tektite.c b/src/enemy/tektite.c index 04b9769c..02a1c4ba 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 b6ffdca9..fa967d18 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 7095b875..e1075076 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 3a99ae35..bcc53034 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 98aff7a5..6cdc7ef8 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 b6a257eb..50144071 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 5e3ccd6b..6b58c2af 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 7a0af279..1c4e74ac 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; diff --git a/src/enterPortalSubtask.c b/src/enterPortalSubtask.c index 379ee2e7..3bac0702 100644 --- a/src/enterPortalSubtask.c +++ b/src/enterPortalSubtask.c @@ -179,8 +179,8 @@ void Subtask_PortalCutscene_0(void) { gScreen.bg1.yOffset = 0; controls->scroll_y = 0; portalId = gArea.portal_type; - if ((portalId == 2) && (gUI.roomControls.area != 2)) { - portalId = 3; + if ((portalId == PT_2) && (gUI.roomControls.area != 2)) { + portalId = PT_DUNGEON; } ptr = &gUnk_080D4138[portalId]; LoadPaletteGroup(ptr->paletteGroup); @@ -247,19 +247,19 @@ void RespawnAsMinish(void) { bool32 sub_0804AD18(void) { switch (gArea.portal_type) { - case 0: - case 1: - case 2: + case PT_TREESTUMP: + case PT_ROCK: + case PT_2: if (!CheckGlobalFlag(ENTRANCE_0 + gArea.portal_type)) { return FALSE; } // else: return TRUE implicitely, because it's stored in r0. But does not match if returning explicitely. break; - case 6: + case PT_TOD: return FALSE; - case 3: - case 4: - case 5: + case PT_DUNGEON: + case PT_JAR: + case PT_5: default: return FALSE; } diff --git a/src/item/itemBow.c b/src/item/itemBow.c index 7714734f..ca2cc809 100644 --- a/src/item/itemBow.c +++ b/src/item/itemBow.c @@ -4,14 +4,14 @@ void sub_08075DF4(ItemBehavior*, u32); void sub_08075E40(ItemBehavior*, u32); -void sub_08075EC0(ItemBehavior*, u32); +void ItemBowShoot(ItemBehavior*, u32); void sub_08075F38(ItemBehavior*, u32); void sub_08075F84(ItemBehavior*, u32); void sub_08075D88(ItemBehavior*, u32); void ItemBow(ItemBehavior* this, u32 index) { static void (*const stateFuncs[])(ItemBehavior*, u32) = { - sub_08075DF4, sub_08075E40, sub_08075EC0, sub_08075F38, sub_08075F84, sub_08075D88, + sub_08075DF4, sub_08075E40, ItemBowShoot, sub_08075F38, sub_08075F84, sub_08075D88, }; stateFuncs[this->stateID](this, index); } @@ -22,14 +22,14 @@ void sub_08075DF4(ItemBehavior* this, u32 index) { sub_0806F948(&gPlayerEntity); sub_08077BB8(this); sub_08077D38(this, index); - gPlayerState.field_0x1f[2] = 1; + gPlayerState.bow_state = 1; } else { DeleteItemBehavior(this, index); } } void sub_08075E40(ItemBehavior* this, u32 index) { - if (gPlayerState.field_0x1f[2] != 0) { + if (gPlayerState.bow_state != 0) { if ((gPlayerState.attack_status & 0x80) == 0) { UpdateItemAnim(this); if ((this->playerFrame & 0x80) != 0) { @@ -43,24 +43,24 @@ void sub_08075E40(ItemBehavior* this, u32 index) { return; } } - gPlayerState.field_0x1f[2] = 0; + gPlayerState.bow_state = 0; DeleteItemBehavior(this, index); } -void sub_08075EC0(ItemBehavior* this, u32 index) { +void ItemBowShoot(ItemBehavior* this, u32 index) { u8 arrowCount; - s32 iVar2; + s32 isShooting; arrowCount = gSave.stats.arrowCount; - iVar2 = IsItemActive(this); - if (iVar2 != 0 && arrowCount != 0) { - if (((gPlayerState.attack_status & 0x80) != 0) || (gPlayerState.field_0x1f[2] == 0)) { - gPlayerState.field_0x1f[2] = 0; + isShooting = IsItemActive(this); + if (isShooting && arrowCount != 0) { + if (((gPlayerState.attack_status & 0x80) != 0) || (gPlayerState.bow_state == 0)) { + gPlayerState.bow_state = 0; DeleteItemBehavior(this, index); } } else { gPlayerState.field_0xa = (8 >> index) | gPlayerState.field_0xa; - SetItemAnim(this, 0x27c); + SetItemAnim(this, ANIM_BOW_SHOOT); this->animPriority = 0xf; this->priority |= 0xf; this->stateID = 3; @@ -68,19 +68,19 @@ void sub_08075EC0(ItemBehavior* this, u32 index) { } void sub_08075F38(ItemBehavior* this, u32 index) { - if (((gPlayerState.attack_status & 0x80) == 0) && (gPlayerState.field_0x1f[2] != 0)) { + if (((gPlayerState.attack_status & 0x80) == 0) && (gPlayerState.bow_state != 0)) { UpdateItemAnim(this); if ((this->playerFrame & 1) != 0) { this->stateID = 4; } } else { - gPlayerState.field_0x1f[2] = 0; + gPlayerState.bow_state = 0; DeleteItemBehavior(this, index); } } void sub_08075F84(ItemBehavior* this, u32 index) { - if (((gPlayerState.attack_status & 0x80) == 0) && (gPlayerState.field_0x1f[2] != 0)) { + if (((gPlayerState.attack_status & 0x80) == 0) && (gPlayerState.bow_state != 0)) { if (GetInventoryValue(ITEM_ARROW_BUTTERFLY) == 1) { sub_08077E3C(this, 5); } else { @@ -90,6 +90,6 @@ void sub_08075F84(ItemBehavior* this, u32 index) { return; } } - gPlayerState.field_0x1f[2] = 0; + gPlayerState.bow_state = 0; DeleteItemBehavior(this, index); } diff --git a/src/item/itemGustJar.c b/src/item/itemGustJar.c index c567f197..3ac37366 100644 --- a/src/item/itemGustJar.c +++ b/src/item/itemGustJar.c @@ -36,7 +36,7 @@ void sub_08076E60(ItemBehavior* this, u32 index) { } if ((this->playerFrame & 0x80) != 0) { this->stateID = 2; - SetItemAnim(this, 0x504); + SetItemAnim(this, ANIM_GUSTJAR_SUCK); gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> index); playerItem = CreatePlayerItem(PLAYER_ITEM_GUST, 0, 0, 0); if (playerItem != NULL) { @@ -64,12 +64,12 @@ void sub_08076EC8(ItemBehavior* this, u32 index) { } if (gPlayerEntity.subAction == 0x1b) { - animIndex = 0x524; + animIndex = ANIM_GUSTJAR_524; } else { - if (gPlayerState.direction & 0x80) { - animIndex = 0x504; + if (gPlayerState.direction & DIR_NOT_MOVING_CHECK) { + animIndex = ANIM_GUSTJAR_SUCK; } else { - animIndex = 0x518; + animIndex = ANIM_GUSTJAR_WALK; } } @@ -100,7 +100,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) { gPlayerState.field_0x1c = 1; gPlayerState.field_0xa &= ~(8 >> index); this->stateID = 2; - SetItemAnim(this, 0x504); + SetItemAnim(this, ANIM_GUSTJAR_SUCK); item = CreatePlayerItem(PLAYER_ITEM_GUST, 0, 0, 0); if (item) { item->parent = player; @@ -108,7 +108,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) { return; } else { gPlayerState.field_0x1c = 6; - SetItemAnim(this, 0x510); + SetItemAnim(this, ANIM_GUSTJAR_END); return; } } else { @@ -155,7 +155,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) { return; break; case 7: - SetItemAnim(this, 0x514); + SetItemAnim(this, ANIM_GUSTJAR_BLOW); gPlayerState.field_0x1c = 3; gPlayerState.gustJarSpeed = 0; return; @@ -163,7 +163,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) { case 2: default: gPlayerState.field_0x1c = 3; - SetItemAnim(this, 0x514); + SetItemAnim(this, ANIM_GUSTJAR_BLOW); return; case 0: break; diff --git a/src/item/itemJarEmpty.c b/src/item/itemJarEmpty.c index cf4b06ec..6296dc67 100644 --- a/src/item/itemJarEmpty.c +++ b/src/item/itemJarEmpty.c @@ -27,7 +27,7 @@ void sub_08077534(ItemBehavior* this, u32 index) { this->timer = gSave.stats.bottles[tmp - ITEM_BOTTLE1]; switch (this->timer) { case ITEM_BOTTLE_EMPTY: - SetItemAnim(this, 0x614); + SetItemAnim(this, ANIM_BOTTLE_SWING); return; case ITEM_BOTTLE_BUTTER: case ITEM_BOTTLE_MILK: @@ -43,22 +43,22 @@ void sub_08077534(ItemBehavior* this, u32 index) { this->stateID = 3; gPlayerEntity.animationState = 4; gPlayerEntity.spriteSettings.flipX = 0; - SetItemAnim(this, 0x2df); + SetItemAnim(this, ANIM_BOTTLE_DRINK); break; case BOTTLE_CHARM_NAYRU: case BOTTLE_CHARM_FARORE: case BOTTLE_CHARM_DIN: default: this->stateID = 3; - SetItemAnim(this, 0x610); + SetItemAnim(this, ANIM_BOTTLE_POUR); break; } gPlayerEntity.flags &= ~ENT_COLLIDE; } void sub_08077618(ItemBehavior* this, u32 index) { - if ((this->playerFrame & 0x80) != 0) { - SetItemAnim(this, 0x618); + if (this->playerFrame & 0x80) { + SetItemAnim(this, ANIM_BOTTLE_SWING_END); this->stateID++; } else { UpdateItemAnim(this); diff --git a/src/item/itemLantern.c b/src/item/itemLantern.c index 4e9902a0..070d9a89 100644 --- a/src/item/itemLantern.c +++ b/src/item/itemLantern.c @@ -104,7 +104,7 @@ void sub_08075B54(ItemBehavior* this, u32 index) { object->x.HALF.HI = tmp[0] + object->x.HALF.HI; object->y.HALF.HI = tmp[1] + object->y.HALF.HI; } - SetItemAnim(this, 0x60c); + SetItemAnim(this, ANIM_LANTERN_BURN); bVar1 = (8 >> (index)); gPlayerState.field_0xa |= bVar1; gPlayerState.keepFacing |= bVar1; diff --git a/src/item/itemMoleMitts.c b/src/item/itemMoleMitts.c index ee3aaa1b..aa063eff 100644 --- a/src/item/itemMoleMitts.c +++ b/src/item/itemMoleMitts.c @@ -34,7 +34,7 @@ void sub_08077130(ItemBehavior* this, u32 index) { iVar1 = sub_080774A0(); if (iVar1 != 0) { if (this->timer == 0) { - SetItemAnim(this, 0x50c); + SetItemAnim(this, ANIM_MOLEMITTS_DIG); this->stateID = 2; if (iVar1 == 0x56) { if ((gPlayerEntity.animationState & 2) != 0) { @@ -45,7 +45,7 @@ void sub_08077130(ItemBehavior* this, u32 index) { } } } else { - SetItemAnim(this, 0x508); + SetItemAnim(this, ANIM_MOLEMITTS_FLOOR); this->stateID = 1; } } else { @@ -71,9 +71,9 @@ void sub_080771C8(ItemBehavior* this, u32 index) { } if ((this->playerFrame & 0x10) != 0) { if (sub_0800875A(&gPlayerEntity, 0xd, this) == 0) { - SetItemAnim(this, 0x520); + SetItemAnim(this, ANIM_MOLEMITTS_MISS); this->stateID = 3; - SoundReq(SFX_107); + SoundReq(SFX_ITEM_GLOVES_AIR); } else { if (this->subtimer != 0xff) { object = CreateObjectWithParent(&gPlayerEntity, OBJECT_1F, 0, this->field_0x2[1]); @@ -140,7 +140,7 @@ void sub_080772A8(ItemBehavior* this, u32 index) { SoundReq(SFX_108); CreateObjectWithParent(&gPlayerEntity, MOLE_MITTS_PARTICLE, this->playerFrame, 0); } else { - SetItemAnim(this, 0x51c); + SetItemAnim(this, ANIM_MOLEMITTS_CLANG); effect = CreateFx(&gPlayerEntity, FX_STARS_STRIKE, 0); if (effect != NULL) { effect->animationState = this->playerAnimationState; diff --git a/src/item/itemPegasusBoots.c b/src/item/itemPegasusBoots.c index 7b487cee..1f4aa52a 100644 --- a/src/item/itemPegasusBoots.c +++ b/src/item/itemPegasusBoots.c @@ -67,11 +67,11 @@ void sub_080768F8(ItemBehavior* this, u32 index) { bVar1 |= bVar2; if (bVar1 == 0) { gPlayerState.dash_state = 1; - gPlayerState.field_0x1f[2] = bVar1; - if ((gPlayerState.flags & PL_MINISH) == 0) { + gPlayerState.bow_state = bVar1; + if (!(gPlayerState.flags & PL_MINISH)) { this->timer = 0x10; } else { - gPlayerState.animation = 0xc14; + gPlayerState.animation = ANIM_DASH_CHARGE_MINISH; } sub_08077D38(this, index); sub_08076964(this, index); @@ -104,7 +104,7 @@ void sub_08076964(ItemBehavior* this, u32 index) { if (HasSwordEquipped() && (gPlayerState.flags & PL_MINISH) == 0 && (gPlayerState.skills & SKILL_DASH_ATTACK) != 0) { gPlayerState.lastSwordMove = SWORD_MOVE_DASH; - SetItemAnim(this, 0x298); + SetItemAnim(this, ANIM_DASH); entity = CreatePlayerItemWithParent(this, PLAYER_ITEM_DASH_SWORD); if (entity != NULL) { if (ItemIsSword(gSave.stats.itemButtons[SLOT_A]) != 0) { @@ -115,11 +115,11 @@ void sub_08076964(ItemBehavior* this, u32 index) { entity->field_0x68.HALF.LO = uVar3; return; } - } else if ((gPlayerState.flags & PL_MINISH) == 0) { - SetItemAnim(this, 0x104); + } else if (!(gPlayerState.flags & PL_MINISH)) { + SetItemAnim(this, ANIM_WALK); return; } else { - gPlayerState.animation = 0xc10; + gPlayerState.animation = ANIM_DASH_MINISH; return; } } else { @@ -136,7 +136,7 @@ void sub_08076A88(ItemBehavior* this, u32 index) { u8* ptr; if ((IsItemActive(this) != 0) && (gPlayerState.dash_state != 0)) { - if ((gPlayerState.flags & PL_MINISH) == 0) { + if (!(gPlayerState.flags & PL_MINISH)) { gPlayerEntity.speed = 0x300; } else { gPlayerEntity.speed = 0x280; @@ -148,7 +148,7 @@ void sub_08076A88(ItemBehavior* this, u32 index) { gPlayerEntity.subAction = 0; COLLISION_OFF(&gPlayerEntity); gPlayerState.field_0x38 = 0; - gPlayerState.direction = 0xff; + gPlayerState.direction = DIR_NONE; return; } this->subtimer = 1; @@ -157,12 +157,13 @@ void sub_08076A88(ItemBehavior* this, u32 index) { ptr = gUnk_0811BE38; if ((*(u16*)&ptr[(gPlayerEntity.animationState & 0xfe)] & gPlayerState.playerInput.heldInput) == 0) { this->direction = (this->playerAnimationState & 0xe) * 4; - if ((gPlayerState.direction != 0xff) && (gPlayerState.direction != this->direction)) { - if (((gPlayerState.direction - this->direction) & 0x1f) < 0x10) { + if ((gPlayerState.direction != DIR_NONE) && (gPlayerState.direction != this->direction)) { + if (((gPlayerState.direction - this->direction) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | + DirectionSouth | DirectionWest)) < DirectionSouth) { this->direction = this->direction + 2; } this->direction--; - this->direction &= 0x1f; + this->direction &= 0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest; } gPlayerState.direction = this->direction; UpdateItemAnim(this); diff --git a/src/item/itemRocsCape.c b/src/item/itemRocsCape.c index dee55950..cfb165a3 100644 --- a/src/item/itemRocsCape.c +++ b/src/item/itemRocsCape.c @@ -69,7 +69,7 @@ void sub_08076758(ItemBehavior* this, u32 index) { gPlayerEntity.field_0x7a.HWORD = 2; gPlayerEntity.zVelocity = Q_16_16(2.0); gPlayerState.jump_status |= 0x10; - gPlayerState.animation = 0x288; + gPlayerState.animation = ANIM_ROCS_CAPE; SoundReq(SFX_172); } } else { diff --git a/src/item/itemSword.c b/src/item/itemSword.c index 5598e0d7..f27e0f2b 100644 --- a/src/item/itemSword.c +++ b/src/item/itemSword.c @@ -31,7 +31,7 @@ void sub_08075338(ItemBehavior* this, u32 index) { if (gPlayerState.flags & PL_MINISH) { this->priority |= 0x80; sub_08077D38(this, index); - gPlayerState.animation = 0xc00; + gPlayerState.animation = ANIM_SWORD_MINISH; SoundReq(SFX_PLY_VO1); return; } @@ -80,7 +80,7 @@ void sub_08075338(ItemBehavior* this, u32 index) { this->priority |= 0x80; gPlayerState.lastSwordMove = SWORD_MOVE_ROLL; gPlayerState.flags |= PL_SWORD_THRUST; - SetItemAnim(this, 0x130); + SetItemAnim(this, ANIM_ROLLATTACK_SLIDE); SoundReq(SFX_PLY_VO3); return; } @@ -150,7 +150,7 @@ void sub_08075580(ItemBehavior* this, u32 index) { } else { this->timer = 0x50; } - SetItemAnim(this, 0x168); + SetItemAnim(this, ANIM_SWORD_CHARGE); CreateObject(SWORD_PARTICLE, 0, 0); return; } @@ -190,10 +190,10 @@ void sub_08075694(ItemBehavior* this, u32 index) { if (gPlayerState.flags & PL_SWORD_THRUST) { gPlayerState.flags &= ~PL_SWORD_THRUST; gPlayerState.flags &= ~PL_ROLLING; - SetItemAnim(this, 300); + SetItemAnim(this, ANIM_ROLLATTACK_SPIN); } else { gPlayerState.lastSwordMove = SWORD_MOVE_SPIN; - SetItemAnim(this, 0x124); + SetItemAnim(this, ANIM_SPINATTACK); } gPlayerState.field_0xa = (8 >> index) | gPlayerState.field_0xa; this->stateID = 4; @@ -220,7 +220,7 @@ void sub_08075738(ItemBehavior* this, u32 index) { } if ((gPlayerState.sword_state & 0x10) != 0) { - if ((gPlayerState.direction & 0x80) == 0) { + if (!(gPlayerState.direction & DIR_NOT_MOVING_CHECK)) { this->direction = gPlayerState.direction; } gPlayerEntity.direction = this->direction; @@ -252,7 +252,7 @@ void sub_08075738(ItemBehavior* this, u32 index) { this->timer = 1; this->subtimer = 1; gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> index); - SetItemAnim(this, 0x128); + SetItemAnim(this, ANIM_GREATSPIN); } if ((this->playerFrame & 0x80) != 0) { @@ -298,7 +298,7 @@ void sub_08075900(ItemBehavior* this, u32 index) { } else { if (this->timer != 0) { if (--this->timer == 0) { - SetItemAnim(this, 0x134); + SetItemAnim(this, ANIM_ROLLATTACK_END); } gPlayerEntity.direction = (gPlayerEntity.animationState >> 1) << 3; gPlayerEntity.speed = 0x300; diff --git a/src/item/itemTryPickupObject.c b/src/item/itemTryPickupObject.c index 8a1bd692..994e9e2d 100644 --- a/src/item/itemTryPickupObject.c +++ b/src/item/itemTryPickupObject.c @@ -25,9 +25,9 @@ void sub_08076088(ItemBehavior* this, Entity* param_2, u32 param_3) { this->field_0x18 = param_2; if ((gPlayerState.flags & PL_NO_CAP)) { - SetItemAnim(this, 0x928); + SetItemAnim(this, ANIM_PICKUP_NOCAP); } else { - SetItemAnim(this, 0x338); + SetItemAnim(this, ANIM_PICKUP); } gPlayerState.heldObject = 3; gPlayerState.framestate = 4; @@ -108,12 +108,12 @@ void ItemPickupCheck(ItemBehavior* this, u32 index) { this->animPriority = 6; gPlayerState.field_0xa = (8 >> index) | gPlayerState.field_0xa; gPlayerState.keepFacing = (8 >> index) | gPlayerState.keepFacing; - if ((gPlayerState.flags & PL_NO_CAP) == 0) { - SetItemAnim(this, 0x378); + if (!(gPlayerState.flags & PL_NO_CAP)) { + SetItemAnim(this, ANIM_GRAB); } else { - SetItemAnim(this, 0x948); + SetItemAnim(this, ANIM_GRAB_NOCAP); } - SoundReq(SFX_88); + SoundReq(SFX_GRAB); break; default: break; @@ -172,10 +172,10 @@ void sub_08076518(ItemBehavior* this, u32 index) { this->field_0x18 = NULL; this->stateID++; this->animPriority = 0x0f; - if ((gPlayerState.flags & PL_NO_CAP) != 0) { - SetItemAnim(this, 0x930); + if (gPlayerState.flags & PL_NO_CAP) { + SetItemAnim(this, ANIM_THROW_NOCAP); } else { - SetItemAnim(this, 0x344); + SetItemAnim(this, ANIM_THROW); } gPlayerState.field_0xa |= 8 >> index; gPlayerState.keepFacing |= 8 >> index; diff --git a/src/itemDefinitions.c b/src/itemDefinitions.c index c6a8567b..0550f3e9 100644 --- a/src/itemDefinitions.c +++ b/src/itemDefinitions.c @@ -4,38 +4,38 @@ const ItemDefinition gItemDefinitions[] = { [ITEM_NONE] = { TRUE, 1, CREATE_ITEM_0, PLAYER_ITEM_NONE, 0, 0, FALSE, FALSE }, - [ITEM_SMITH_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE }, - [ITEM_GREEN_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE }, - [ITEM_RED_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE }, - [ITEM_BLUE_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE }, - [ITEM_UNUSED_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE }, - [ITEM_FOURSWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE }, + [ITEM_SMITH_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, ANIM_SWORD, 6, TRUE, TRUE }, + [ITEM_GREEN_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, ANIM_SWORD, 6, TRUE, TRUE }, + [ITEM_RED_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, ANIM_SWORD, 6, TRUE, TRUE }, + [ITEM_BLUE_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, ANIM_SWORD, 6, TRUE, TRUE }, + [ITEM_UNUSED_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, ANIM_SWORD, 6, TRUE, TRUE }, + [ITEM_FOURSWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, ANIM_SWORD, 6, TRUE, TRUE }, [ITEM_BOMBS] = { TRUE, 3, CREATE_ITEM_4, PLAYER_ITEM_BOMB, 0, 3, FALSE, FALSE }, [ITEM_REMOTE_BOMBS] = { TRUE, 3, CREATE_ITEM_4, PLAYER_ITEM_BOMB, 0, 3, FALSE, FALSE }, - [ITEM_BOW] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOW, 540, 3, FALSE, FALSE }, - [ITEM_LIGHT_ARROW] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOW, 540, 3, FALSE, FALSE }, - [ITEM_BOOMERANG] = { TRUE, 5, CREATE_ITEM_3, PLAYER_ITEM_BOOMERANG, 2072, 3, FALSE, FALSE }, - [ITEM_MAGIC_BOOMERANG] = { TRUE, 5, CREATE_ITEM_3, PLAYER_ITEM_BOOMERANG, 1796, 3, FALSE, FALSE }, - [ITEM_SHIELD] = { FALSE, 1, CREATE_ITEM_3, PLAYER_ITEM_SHIELD, 344, 2, FALSE, FALSE }, - [ITEM_MIRROR_SHIELD] = { TRUE, 1, CREATE_ITEM_3, PLAYER_ITEM_SHIELD, 344, 2, FALSE, FALSE }, + [ITEM_BOW] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOW, ANIM_BOW_PULLOUT, 3, FALSE, FALSE }, + [ITEM_LIGHT_ARROW] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOW, ANIM_BOW_PULLOUT, 3, FALSE, FALSE }, + [ITEM_BOOMERANG] = { TRUE, 5, CREATE_ITEM_3, PLAYER_ITEM_BOOMERANG, ANIM_BOOMERANG, 3, FALSE, FALSE }, + [ITEM_MAGIC_BOOMERANG] = { TRUE, 5, CREATE_ITEM_3, PLAYER_ITEM_BOOMERANG, ANIM_BOOMERANG_MAGIC, 3, FALSE, FALSE }, + [ITEM_SHIELD] = { FALSE, 1, CREATE_ITEM_3, PLAYER_ITEM_SHIELD, ANIM_SHIELD_PULLOUT, 2, FALSE, FALSE }, + [ITEM_MIRROR_SHIELD] = { TRUE, 1, CREATE_ITEM_3, PLAYER_ITEM_SHIELD, ANIM_SHIELD_PULLOUT, 2, FALSE, FALSE }, #ifdef EU - [ITEM_LANTERN_OFF] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, 1536, 6, FALSE, FALSE }, - [ITEM_LANTERN_ON] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, 1536, 6, FALSE, FALSE }, + [ITEM_LANTERN_OFF] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, ANIM_LANTERN_LIGHT, 6, FALSE, FALSE }, + [ITEM_LANTERN_ON] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, ANIM_LANTERN_LIGHT, 6, FALSE, FALSE }, #else - [ITEM_LANTERN_OFF] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, 1536, 2, FALSE, FALSE }, - [ITEM_LANTERN_ON] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, 1536, 2, FALSE, FALSE }, + [ITEM_LANTERN_OFF] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, ANIM_LANTERN_LIGHT, 2, FALSE, FALSE }, + [ITEM_LANTERN_ON] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, ANIM_LANTERN_LIGHT, 2, FALSE, FALSE }, #endif - [ITEM_GUST_JAR] = { TRUE, 6, CREATE_ITEM_3, PLAYER_ITEM_GUST_JAR, 1280, 2, FALSE, FALSE }, - [ITEM_PACCI_CANE] = { TRUE, 4, CREATE_ITEM_3, PLAYER_ITEM_PACCI_CANE, 1576, 6, TRUE, FALSE }, + [ITEM_GUST_JAR] = { TRUE, 6, CREATE_ITEM_3, PLAYER_ITEM_GUST_JAR, ANIM_GUSTJAR_PULLOUT, 2, FALSE, FALSE }, + [ITEM_PACCI_CANE] = { TRUE, 4, CREATE_ITEM_3, PLAYER_ITEM_PACCI_CANE, ANIM_CANE, 6, TRUE, FALSE }, [ITEM_MOLE_MITTS] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_NONE2, 0, 2, TRUE, FALSE }, - [ITEM_ROCS_CAPE] = { TRUE, 1, CREATE_ITEM_1, PLAYER_ITEM_NONE3, 2060, 0, FALSE, FALSE }, - [ITEM_PEGASUS_BOOTS] = { TRUE, CREATE_ITEM_1, PLAYER_ITEM_SWORD, 12, 260, 6, FALSE, FALSE }, - [ITEM_FIRE_ROD] = { TRUE, 4, CREATE_ITEM_3, PLAYER_ITEM_CELL_OVERWRITE_SET, 260, 6, FALSE, FALSE }, - [ITEM_OCARINA] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_NONE, 2273, 6, FALSE, FALSE }, + [ITEM_ROCS_CAPE] = { TRUE, 1, CREATE_ITEM_1, PLAYER_ITEM_NONE3, ANIM_HOP, 0, FALSE, FALSE }, + [ITEM_PEGASUS_BOOTS] = { TRUE, 1, CREATE_ITEM_1, PLAYER_ITEM_DASH_SWORD, ANIM_WALK, 6, FALSE, FALSE }, + [ITEM_FIRE_ROD] = { TRUE, 4, CREATE_ITEM_3, PLAYER_ITEM_CELL_OVERWRITE_SET, ANIM_WALK, 6, FALSE, FALSE }, + [ITEM_OCARINA] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_NONE, ANIM_OCARINA, 6, FALSE, FALSE }, [ITEM_ORB_GREEN] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_NULLED2, 0, 1, TRUE, TRUE }, [ITEM_ORB_BLUE] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_NULLED, 0, 1, TRUE, TRUE }, [ITEM_ORB_RED] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_CELL_OVERWRITE_SET2, 0, 1, TRUE, TRUE }, - [ITEM_TRY_PICKUP_OBJECT] = { TRUE, 2, CREATE_ITEM_3, PLAYER_ITEM_HELD_OBJECT, 832, 4, FALSE, TRUE }, + [ITEM_TRY_PICKUP_OBJECT] = { TRUE, 2, CREATE_ITEM_3, PLAYER_ITEM_HELD_OBJECT, ANIM_PULL, 4, FALSE, TRUE }, [ITEM_BOTTLE1] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOTTLE, 0, 6, TRUE, FALSE }, [ITEM_BOTTLE2] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOTTLE, 0, 6, TRUE, FALSE }, [ITEM_BOTTLE3] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOTTLE, 0, 6, TRUE, FALSE }, diff --git a/src/manager/minishPortalManager.c b/src/manager/minishPortalManager.c index 47307dea..21855b00 100644 --- a/src/manager/minishPortalManager.c +++ b/src/manager/minishPortalManager.c @@ -34,7 +34,7 @@ void MinishPortalManager_Main(MinishPortalManager* this) { gArea.portal_type = super->type; if (!CheckGlobalFlag(EZERO_1ST)) { gArea.portal_mode = 1; - gArea.portal_type = 5; + gArea.portal_type = PT_5; } else { if ((gPlayerState.flags & PL_USE_PORTAL) && gPlayerState.jump_status == 0) { gArea.portal_mode = 2; @@ -83,7 +83,7 @@ void CreateMagicSparkles(u32 baseX, u32 baseY, u32 layer) { } bool32 PortalReadyForMinish(void) { - if ((gPlayerState.flags & PL_MINISH) && gPlayerState.attachedBeetleCount == 0 && (gArea.portal_type != 0x6) && + if ((gPlayerState.flags & PL_MINISH) && gPlayerState.attachedBeetleCount == 0 && (gArea.portal_type != PT_TOD) && (gPlayerState.heldObject == 0)) { switch (gPlayerState.framestate) { case PL_STATE_IDLE: diff --git a/src/movement.c b/src/movement.c index 6e87133b..51e95932 100644 --- a/src/movement.c +++ b/src/movement.c @@ -2080,7 +2080,7 @@ bool32 MoveNorthWest(Entity* this, s32 radius, s32 angle, u32 collisionType) { bool32 ProcessMovement0(Entity* this) { bool32 result; - if ((this->direction & 0x80) == 0) { + if (!(this->direction & DIR_NOT_MOVING_CHECK)) { CalculateEntityTileCollisions(this, this->direction, 0); result = ProcessMovementInternal(this, this->speed, this->direction, 0); } else { @@ -2092,7 +2092,7 @@ bool32 ProcessMovement0(Entity* this) { bool32 ProcessMovement1(Entity* this) { bool32 result; - if ((this->direction & 0x80) == 0) { + if (!(this->direction & DIR_NOT_MOVING_CHECK)) { CalculateEntityTileCollisions(this, this->direction, 1); result = ProcessMovementInternal(this, this->speed, this->direction, 1); } else { @@ -2104,7 +2104,7 @@ bool32 ProcessMovement1(Entity* this) { bool32 ProcessMovement2(Entity* this) { bool32 result; - if ((this->direction & 0x80) == 0) { + if (!(this->direction & DIR_NOT_MOVING_CHECK)) { CalculateEntityTileCollisions(this, this->direction, 2); result = ProcessMovementInternal(this, this->speed, this->direction, 2); } else { @@ -2116,7 +2116,7 @@ bool32 ProcessMovement2(Entity* this) { bool32 ProcessMovement10(Entity* this) { bool32 result; - if ((this->direction & 0x80) == 0) { + if (!(this->direction & DIR_NOT_MOVING_CHECK)) { CalculateEntityTileCollisions(this, this->direction, 10); result = ProcessMovementInternal(this, this->speed, this->direction, 10); } else { @@ -2128,7 +2128,7 @@ bool32 ProcessMovement10(Entity* this) { bool32 ProcessMovement12(Entity* this) { bool32 result; - if ((this->direction & 0x80) == 0) { + if (!(this->direction & DIR_NOT_MOVING_CHECK)) { CalculateEntityTileCollisions(this, this->direction, 12); result = ProcessMovementInternal(this, this->speed, this->direction, 12); } else { @@ -2140,7 +2140,7 @@ bool32 ProcessMovement12(Entity* this) { bool32 ProcessMovement0_custom(Entity* this, u32 direction, u32 speed) { bool32 result; - if ((direction & 0x80) == 0) { + if (!(direction & DIR_NOT_MOVING_CHECK)) { CalculateEntityTileCollisions(this, direction, 0); result = ProcessMovementInternal(this, speed, direction, 0); } else { @@ -2152,7 +2152,7 @@ bool32 ProcessMovement0_custom(Entity* this, u32 direction, u32 speed) { bool32 ProcessMovement3(Entity* this) { bool32 result; - if (((this->direction & 0x80) == 0) && (sub_080AF0C8(this) == 0)) { + if (!(this->direction & DIR_NOT_MOVING_CHECK) && !sub_080AF0C8(this)) { CalculateEntityTileCollisions(this, this->direction, 3); result = ProcessMovementInternal(this, this->speed, this->direction, 3); } else { @@ -2165,25 +2165,29 @@ bool32 sub_080AF0C8(Entity* this) { u32 tileType = GetTileTypeByEntity(this); switch (tileType) { case 0x87: - if (((this->direction + 7) & 0x1f) < 0x10) { + if (((this->direction + 7) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | + DirectionWest)) < DirectionSouth) { this->collisions = COL_NORTH_ANY; return TRUE; } break; case 0x8a: - if (((this->direction - 1) & 0x1f) < 0x10) { + if (((this->direction - 1) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | + DirectionWest)) < DirectionSouth) { this->collisions = COL_EAST_ANY; return TRUE; } break; case 0x88: - if (((this->direction - 9) & 0x1f) < 0x10) { + if (((this->direction - 9) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | + DirectionWest)) < DirectionSouth) { this->collisions = COL_SOUTH_ANY; return TRUE; } break; case 0x89: - if (((this->direction - 0x11) & 0x1f) < 0x10) { + if (((this->direction - 0x11) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | + DirectionWest)) < DirectionSouth) { this->collisions = COL_WEST_ANY; return TRUE; } @@ -2195,7 +2199,7 @@ bool32 sub_080AF0C8(Entity* this) { bool32 ProcessMovement4(Entity* this) { bool32 result; - if ((this->direction & 0x80) == 0) { + if (!(this->direction & DIR_NOT_MOVING_CHECK)) { CalculateEntityTileCollisions(this, this->direction, 4); result = ProcessMovementInternal(this, this->speed, this->direction, 4); } else { @@ -2207,7 +2211,7 @@ bool32 ProcessMovement4(Entity* this) { bool32 ProcessMovement5(Entity* this) { bool32 result; - if ((this->direction & 0x80) == 0) { + if (!(this->direction & DIR_NOT_MOVING_CHECK)) { CalculateEntityTileCollisions(this, this->direction, 5); result = ProcessMovementInternal(this, this->speed, this->direction, 5); } else { @@ -2231,7 +2235,7 @@ void Knockback2(Entity* this) { bool32 ProcessMovement6(Entity* this) { bool32 result; - if ((this->direction & 0x80) == 0) { + if (!(this->direction & DIR_NOT_MOVING_CHECK)) { CalculateEntityTileCollisions(this, this->direction, 6); result = ProcessMovementInternal(this, this->speed, this->direction, 6); } else { @@ -2243,7 +2247,7 @@ bool32 ProcessMovement6(Entity* this) { bool32 ProcessMovement6_custom(Entity* this, u32 direction, u32 speed) { bool32 result; - if ((direction & 0x80) == 0) { + if (!(direction & DIR_NOT_MOVING_CHECK)) { CalculateEntityTileCollisions(this, direction, 6); result = ProcessMovementInternal(this, speed, direction, 6); } else { diff --git a/src/npc/npc23.c b/src/npc/npc23.c index 846c1bde..2a64ef15 100644 --- a/src/npc/npc23.c +++ b/src/npc/npc23.c @@ -206,12 +206,12 @@ void sub_08066570(Entity* this) { direction = GetFacingDirection(this, &gPlayerEntity); cond = TRUE; - dir2 = (direction & 0x18); - dir1 = (this->direction & 0x18); - tmp = 0x18; + dir2 = (direction & DirectionWest); + dir1 = (this->direction & DirectionWest); + tmp = DirectionWest; if (dir1 == dir2) { - dir1 = (direction + 5) & 7; - dir2 = (this->direction + 5) & 7; + dir1 = (direction + 5) & (0x3 | DirectionNorthEast); + dir2 = (this->direction + 5) & (0x3 | DirectionNorthEast); if (dir2 < 3 && dir1 < 3) { cond = FALSE; } diff --git a/src/object/book.c b/src/object/book.c index 31d07e34..36f76c6a 100644 --- a/src/object/book.c +++ b/src/object/book.c @@ -222,7 +222,7 @@ void Book_Action5(BookEntity* this) { u32 sub_0809B688(Entity* this) { u32 ret = EntityInRectRadius(this, &gPlayerEntity, 6, 12); - if (ret == 1 && gPlayerState.direction != 16) { + if (ret == 1 && gPlayerState.direction != DirectionSouth) { ret = 0; } diff --git a/src/object/chuchuBossCutscene.c b/src/object/chuchuBossCutscene.c index 564c420b..235a1f91 100644 --- a/src/object/chuchuBossCutscene.c +++ b/src/object/chuchuBossCutscene.c @@ -53,7 +53,7 @@ void ChuchuBossCutscene_Action3(Entity* this) { GetNextFrame(this); if (--this->timer == 0) { this->action++; - this->direction = 0; + this->direction = DirectionNorth; this->speed = 0x100; this->zVelocity = Q_16_16(2.0); this->spriteOrientation.flipY = 0; diff --git a/src/object/crenelBeanSprout.c b/src/object/crenelBeanSprout.c index f40e7de2..a9d500cd 100644 --- a/src/object/crenelBeanSprout.c +++ b/src/object/crenelBeanSprout.c @@ -138,7 +138,7 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) { if (super->parent->action == 2) { switch (super->parent->subAction) { case 1: - if ((gPlayerState.direction & 0x80) != 0) { + if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) != 0) { InitializeAnimation(super, 4); } else { GetNextFrame(super); @@ -161,7 +161,7 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) { } else { gPlayerState.mobility |= 0x80; gPlayerState.heldObject = 5; - if ((gPlayerState.direction & 0x80) != 0) { + if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) != 0) { InitializeAnimation(super, (super->type >> 1) + 3); } else { GetNextFrame(super); diff --git a/src/object/fileScreenObjects.c b/src/object/fileScreenObjects.c index 0b346a52..42afe6f5 100644 --- a/src/object/fileScreenObjects.c +++ b/src/object/fileScreenObjects.c @@ -43,7 +43,7 @@ static void FileScreenObjects_Type15(FileScreenObjectsEntity*); static void FileScreenObjects_Type18(FileScreenObjectsEntity*); static void FileScreenObjects_Type19(FileScreenObjectsEntity*); static void FileScreenObjects_Type21(FileScreenObjectsEntity*); -static void FileScreenObjects_Type23_Action1(FileScreenObjectsEntity*); +static void FileScreenObjects_Type23_LinkPreview(FileScreenObjectsEntity*); static void FileScreenObjects_Type23_Init(FileScreenObjectsEntity*); typedef struct { @@ -86,7 +86,7 @@ void FileScreenObjects(FileScreenObjectsEntity* this) { void FileScreenObjects_Type23(FileScreenObjectsEntity* this) { static void (*const FileScreenObjects_Type23_Actions[])(FileScreenObjectsEntity*) = { FileScreenObjects_Type23_Init, - FileScreenObjects_Type23_Action1, + FileScreenObjects_Type23_LinkPreview, }; FileScreenObjects_Type23_Actions[super->action](this); } @@ -99,7 +99,7 @@ void FileScreenObjects_Type23_Init(FileScreenObjectsEntity* this) { super->action = 1; } -void FileScreenObjects_Type23_Action1(FileScreenObjectsEntity* this) { +void FileScreenObjects_Type23_LinkPreview(FileScreenObjectsEntity* this) { u32 var0; u32 offset; @@ -114,9 +114,9 @@ void FileScreenObjects_Type23_Action1(FileScreenObjectsEntity* this) { if (super->type2 != gMapDataBottomSpecial.unk6) { super->type2 = gMapDataBottomSpecial.unk6; - this->unk_68 = CheckGlobalFlag(EZERO_1ST) == 0 ? 0x400 : 0x100; + this->unk_68 = CheckGlobalFlag(EZERO_1ST) == 0 ? ANIM_DEFAULT_NOCAP : ANIM_DEFAULT; this->unk_70 = 4; - super->animationState = 2; + super->animationState = PAS_SOUTH; offset = gUnk_08133368[GetPlayerPalette(TRUE) - 22] & 0xFFFFFF; LoadPalettes(&gGlobalGfxAndPalettes[offset], 31, 1); } @@ -125,16 +125,16 @@ void FileScreenObjects_Type23_Action1(FileScreenObjectsEntity* this) { if (gInput.heldKeys & L_BUTTON) { switch (gInput.newKeys) { case DPAD_UP: - super->animationState = 0; + super->animationState = PAS_NORTH; break; case DPAD_RIGHT: - super->animationState = 1; + super->animationState = PAS_EAST; break; case DPAD_DOWN: - super->animationState = 2; + super->animationState = PAS_SOUTH; break; case DPAD_LEFT: - super->animationState = 3; + super->animationState = PAS_WEST; break; case B_BUTTON: this->unk_70 = this->unk_70 ? 0 : 4; diff --git a/src/object/graveyardKey.c b/src/object/graveyardKey.c index 3a4d664c..bef307ed 100644 --- a/src/object/graveyardKey.c +++ b/src/object/graveyardKey.c @@ -90,10 +90,10 @@ void GraveyardKey_Init(Entity* this, const struct_gUnk_08123FB0* param_2) { this->y.HALF.HI -= param_2->y; this->z.WORD = 0; this->timer = param_2->timer; - if ((this->direction & 0x80)) { + if ((this->direction & DIR_NOT_MOVING_CHECK)) { dir = this->direction; - if (dir == 0x81) { - this->direction = (((gPlayerEntity.animationState * 4 + (Random() & 3)) - 2) & 0x1f) ^ 0x10; + if (dir == (DIR_NOT_MOVING_CHECK | 0x1)) { + this->direction = (((gPlayerEntity.animationState * 4 + (Random() & 3)) - 2) & 0x1f) ^ DirectionSouth; } } UpdateSpriteForCollisionLayer(this); diff --git a/src/object/jarPortal.c b/src/object/jarPortal.c index 5c5fdc2d..90aaf6a0 100644 --- a/src/object/jarPortal.c +++ b/src/object/jarPortal.c @@ -122,9 +122,9 @@ void sub_0808C01C(JarPortalEntity* this, u32 r1) { gArea.portal_x = super->x.HALF.HI; gArea.portal_y = super->y.HALF.HI; gArea.portal_exit_dir = 2; - type = 4; + type = PT_JAR; if (r1 != 0) - type = 2; + type = PT_2; gArea.portal_type = type; if (r1 == 1) { if ((gPlayerState.flags & PL_USE_PORTAL) && (gPlayerState.jump_status == 0)) { diff --git a/src/object/keyStealingTakkuri.c b/src/object/keyStealingTakkuri.c index 5d5f02ba..8a5a40b1 100644 --- a/src/object/keyStealingTakkuri.c +++ b/src/object/keyStealingTakkuri.c @@ -477,7 +477,7 @@ void sub_0809E1F0(KeyStealingTakkuriEntity* this) { void sub_0809E210(KeyStealingTakkuriEntity* this) { gPlayerEntity.animationState = GetAnimationStateForDirection8(GetFacingDirection(&gPlayerEntity, super)) & 0xfe; - gPlayerState.animation = 0x100; + gPlayerState.animation = ANIM_DEFAULT; } void sub_0809E238(KeyStealingTakkuriEntity* this) { diff --git a/src/object/lilypadLarge.c b/src/object/lilypadLarge.c index 9b380797..5c1e9949 100644 --- a/src/object/lilypadLarge.c +++ b/src/object/lilypadLarge.c @@ -551,7 +551,7 @@ void sub_08085E74(LilypadLargeEntity* this) { gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; gPlayerEntity.direction = super->direction; - gPlayerState.animation = 0x100; + gPlayerState.animation = ANIM_DEFAULT; gRoomControls.camera_target = super; if (gPlayerState.item != NULL) { DeleteEntity(gPlayerState.item); diff --git a/src/object/lockedDoor.c b/src/object/lockedDoor.c index 6f1812ac..43d04047 100644 --- a/src/object/lockedDoor.c +++ b/src/object/lockedDoor.c @@ -271,7 +271,7 @@ void sub_080836DC(Entity* this, u32 unk_0, u32 unk_1) { SetTile(0x4022, unk_1, this->collisionLayer); this->timer = 7; this->spriteSettings.draw = 1; - this->direction = (unk_0 << 3) ^ 0x10; + this->direction = (unk_0 << 3) ^ DirectionSouth; tmp = &gUnk_0811F688[unk_0]; if (this->type2 != 2) { this->x.HALF.HI += tmp->x; diff --git a/src/object/minecart.c b/src/object/minecart.c index ffdef749..73cf2e51 100644 --- a/src/object/minecart.c +++ b/src/object/minecart.c @@ -11,7 +11,7 @@ typedef struct { Entity base; - u8 filler[0x1C]; + u8 filler[28]; MinecartData* minecartData; } MinecartEntity; diff --git a/src/object/smoke.c b/src/object/smoke.c index 06de5ca1..bffaa8b8 100644 --- a/src/object/smoke.c +++ b/src/object/smoke.c @@ -52,7 +52,7 @@ void sub_0808A484(Entity* this) { this->action = 1; this->spriteSettings.draw = TRUE; this->speed = 0x40; - this->direction = 6; + this->direction = DirectionNorthEast | 0x2; this->spriteRendering.b3 = 1; this->spritePriority.b0 = 0; this->spriteOrientation.flipY = 1; diff --git a/src/object/specialFx.c b/src/object/specialFx.c index 37614788..3a5ca962 100644 --- a/src/object/specialFx.c +++ b/src/object/specialFx.c @@ -48,7 +48,7 @@ const struct_0811F960 gUnk_0811F960[] = { {0x5, 0x1, 0x00, SFX_NONE}, {0x0, 0x0, 0x00, SFX_164}, {0x0, 0x1, 0x14, SFX_1A8}, - {0x0, 0x1, 0x10, SFX_88}, + {0x0, 0x1, 0x10, SFX_GRAB}, {0x0, 0x0, 0x00, SFX_NONE}, {0x0, 0x0, 0x00, SFX_NONE}, {0x0, 0x0, 0x00, SFX_NONE}, @@ -87,9 +87,9 @@ const struct_0811F960 gUnk_0811F960[] = { {0x0, 0x1, 0x00, SFX_1B4}, {0x0, 0x1, 0x13, SFX_164}, {0x0, 0x1, 0x00, SFX_NONE}, - {0x0, 0x1, 0x10, SFX_88}, - {0x0, 0x1, 0x10, SFX_88}, - {0x0, 0x1, 0x10, SFX_88}, + {0x0, 0x1, 0x10, SFX_GRAB}, + {0x0, 0x1, 0x10, SFX_GRAB}, + {0x0, 0x1, 0x10, SFX_GRAB}, {0x0, 0x1, 0x00, SFX_NONE}, {0x0, 0x1, 0x00, SFX_NONE}, {0x0, 0x0, 0x00, SFX_11D}, diff --git a/src/object/swordParticle.c b/src/object/swordParticle.c index a2fc8110..63415fb6 100644 --- a/src/object/swordParticle.c +++ b/src/object/swordParticle.c @@ -69,15 +69,15 @@ void SwordParticle_Action1(SwordParticleEntity* this) { u32 tmp2; if (super->type2 != 0) { - if ((gPlayerState.field_0x1f[2] == 0) || ((gPlayerState.attack_status & 0x80) != 0)) { + if ((gPlayerState.bow_state == 0) || ((gPlayerState.attack_status & 0x80) != 0)) { DeleteThisEntity(); } - if (gPlayerState.field_0x1f[2] >= 0x50) { + if (gPlayerState.bow_state >= 0x50) { super->spriteSettings.draw = 1; - tmp1 = gPlayerState.field_0x1f[2]; + tmp1 = gPlayerState.bow_state; ptr = gUnk_081217D8; } else { - if (gPlayerState.field_0x1f[2] != 0) { + if (gPlayerState.bow_state != 0) { super->spriteSettings.draw = 0; return; } diff --git a/src/objectUtils.c b/src/objectUtils.c index 172e2afc..f891b1b6 100644 --- a/src/objectUtils.c +++ b/src/objectUtils.c @@ -321,7 +321,7 @@ void UpdateRailMovement(Entity* this, u16** param_2, u16* param_3) { ptr = ptr + (u32)ptr[1] * -3; } if (*ptr == 0xff) { - this->direction = 0xff; + this->direction = DIR_NONE; this->speed = 0; } else { this->direction = (u8)*ptr; diff --git a/src/physics.c b/src/physics.c index 63f29f14..f3f554fd 100644 --- a/src/physics.c +++ b/src/physics.c @@ -245,17 +245,21 @@ bool32 sub_0806F8DC(Entity* ent) { return TRUE; } +#define CDIR_DIAGONAL 1 +#define CDirectionSouth 4 +#define CDirectionWest 6 + u32 sub_0806F948(Entity* ent) { - u32 v1; - if (gPlayerState.direction == 0xFF) + u32 direction; + if (gPlayerState.direction == DIR_NONE) return ent->animationState; - v1 = gPlayerState.direction / 4; - if ((v1 & 1) && !(((v1 + 1) - ent->animationState) & 4)) { + direction = gPlayerState.direction / 4; + if ((direction & CDIR_DIAGONAL) && !(((direction + 1) - ent->animationState) & CDirectionSouth)) { return ent->animationState; } else { - ent->spriteSettings.flipX = v1 > 4; - ent->animationState = v1 & 6; + ent->spriteSettings.flipX = direction > CDirectionSouth; + ent->animationState = direction & CDirectionWest; } return ent->animationState; } diff --git a/src/player.c b/src/player.c index b22572a3..e7c5f0d1 100644 --- a/src/player.c +++ b/src/player.c @@ -48,8 +48,6 @@ #define FALL_DAMAGE 2 -#define DEFAULT_ANIM 0x100 - static EntityAction PlayerInit; static EntityAction PlayerNormal; // static EntityAction PlayerInit; @@ -129,7 +127,7 @@ static EntityAction PlayerTalkEzlo_Leave; // PLAYER_PUSH static EntityAction PlayerPushInit; static EntityAction PlayerPushUpdate; -static EntityAction sub_08071B60; +static EntityAction PlayerPushEnd; // PLAYER_MINISHDIE static EntityAction PlayerMinishDieInit; @@ -198,7 +196,7 @@ static EntityAction sub_08072F94; static EntityAction sub_08073094; // PLAYER_USEENTRANCE -static EntityAction sub_080731D8; +static EntityAction PlayerUseStairs; static EntityAction sub_080732D0; static EntityAction sub_0807332C; static EntityAction sub_080733BC; @@ -354,7 +352,7 @@ static void PlayerInit(Entity* this) { this->hitbox = (Hitbox*)&gPlayerHitbox; this->spriteIndex = 1; #ifndef EU - gPlayerState.animation = DEFAULT_ANIM; + gPlayerState.animation = ANIM_DEFAULT; #endif sub_0806FDA0(this); LoadSwapGFX(this, 1, 2); @@ -398,7 +396,7 @@ static void PlayerNormal(Entity* this) { if ((this->animationState >> 1) + 92 == this->animIndex && (u16)this->spriteIndex == 2) UpdateAnimationSingleFrame(&gPlayerEntity); else - gPlayerState.animation = 604; + gPlayerState.animation = ANIM_TRAPPED; sub_0806F948(&gPlayerEntity); ResetActiveItems(); UpdateActiveItems(this); @@ -420,7 +418,7 @@ static void PlayerNormal(Entity* this) { return; } if (!gPlayerState.swim_state && (gPlayerState.jump_status & 0xC0) == 0) { - if (gPlayerState.shield_status || gPlayerState.field_0x1f[2]) { + if (gPlayerState.shield_status || gPlayerState.bow_state) { this->speed = SHIELDING_SPEED; } else { if (gPlayerState.sword_state) { @@ -505,7 +503,7 @@ static void PlayerNormal(Entity* this) { this->speed = gPlayerState.jump_status & 0x20; sub_08008926(this); } else { - this->direction = 0xff; + this->direction = DIR_NONE; } } UpdatePlayerMovement(); @@ -537,14 +535,14 @@ static void PlayerNormal(Entity* this) { this->direction = gPlayerState.direction; if (gPlayerState.flags & PL_BURNING) { this->speed = BURNING_SPEED; - if ((gPlayerState.direction & 0x80) != 0) + if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) != 0) this->direction = 4 * (this->animationState & 0xE); DeleteClones(); } } } v13 = 0; - if ((((gPlayerState.field_0x7 | this->direction) & 0x80) | gPlayerState.field_0xa) == 0 && + if ((((gPlayerState.field_0x7 | this->direction) & DIR_NOT_MOVING_CHECK) | gPlayerState.field_0xa) == 0 && (gPlayerState.field_0x7 & 0x10) == 0) { v13 = 1; if (this->knockbackDuration == 0 && @@ -580,7 +578,7 @@ static void PlayerFall(Entity* this) { PlayerFallUpdate, }; - gPlayerState.direction = 0xFF; + gPlayerState.direction = DIR_NONE; gPlayerState.pushedObject = 0x80; gPlayerState.framestate = PL_STATE_FALL; @@ -596,11 +594,11 @@ static void PlayerFallInit(Entity* this) { gPlayerState.jump_status = 0; if (gPlayerState.flags & PL_MINISH) - gPlayerState.animation = 0x1ba; + gPlayerState.animation = ANIM_FALL_MINISH; else if (gPlayerState.flags & PL_NO_CAP) - gPlayerState.animation = 0x458; + gPlayerState.animation = ANIM_FALL_NOCAP; else - gPlayerState.animation = 0x1b8; + gPlayerState.animation = ANIM_FALL; this->subAction++; COLLISION_OFF(this); @@ -649,10 +647,10 @@ static void PlayerBounceInit(Entity* this) { if (!(gPlayerState.flags & PL_MINISH)) { this->zVelocity = BOUNCE_SPEED_Z; - gPlayerState.animation = 0x114; + gPlayerState.animation = ANIM_BOUNCE; InitScreenShake(16, 0); } else { - gPlayerState.animation = 0xc18; + gPlayerState.animation = ANIM_BOUNCE_MINISH; this->zVelocity = (BOUNCE_SPEED_Z * 3) / 4; } @@ -701,7 +699,7 @@ static void PlayerBounceUpdate(Entity* this) { this->subAction++; if (!(gPlayerState.flags & PL_MINISH)) - gPlayerState.animation = DEFAULT_ANIM; + gPlayerState.animation = ANIM_DEFAULT; } static void sub_08070E7C(Entity* this) { @@ -736,7 +734,7 @@ static void sub_08070EDC(Entity* this) { if ((gPlayerState.flags & PL_MINISH) == 0) ResolvePlayerAnimation(); else - gPlayerState.animation = 0xc18; + gPlayerState.animation = ANIM_BOUNCE_MINISH; } static void sub_08070f24(Entity* this) { @@ -781,15 +779,15 @@ static void PlayerItemGetInit(Entity* this) { u32 anim; if (gPlayerState.flags & PL_NO_CAP) { if (sub_080542AC(gPlayerState.field_0x38)) { - anim = 0x45e; + anim = ANIM_GET_ITEM_SMALL_NOCAP; } else { - anim = 0x45b; + anim = ANIM_GET_ITEM_BIG_NOCAP; } } else { if (sub_080542AC(gPlayerState.field_0x38)) { - anim = 0x2e0; + anim = ANIM_GET_ITEM_SMALL; } else { - anim = 0x1b9; + anim = ANIM_GET_ITEM_BIG; } } gPlayerState.animation = anim; @@ -849,9 +847,9 @@ static void PlayerJumpInit(Entity* this) { if ((gPlayerState.flags & PL_MINISH) == 0) { ResetActiveItems(); if (gPlayerState.flags & PL_NO_CAP) { - gPlayerState.animation = 0x420; + gPlayerState.animation = ANIM_JUMP_NOCAP; } else { - gPlayerState.animation = 0x810; + gPlayerState.animation = ANIM_JUMP; } } } @@ -911,9 +909,9 @@ static void sub_08071130(Entity* this) { if (((gPlayerState.heldObject | gPlayerState.keepFacing) == 0) && ((gPlayerState.flags & PL_MINISH) == 0)) { if (gPlayerState.flags & PL_NO_CAP) { - gPlayerState.animation = 0x424; + gPlayerState.animation = ANIM_LAND_NOCAP; } else { - gPlayerState.animation = 0x820; + gPlayerState.animation = ANIM_LAND; } this->animIndex = 0xff; } @@ -955,7 +953,7 @@ static void PlayerDrownInit(Entity* this) { if (gPlayerState.flags & PL_MINISH) { this->timer = 60; - gPlayerState.animation = 0xc19; + gPlayerState.animation = ANIM_DROWN_MINISH; SoundReq(SFX_WATER_SPLASH); } else { if (!(gPlayerState.flags & PL_FLAGS10000)) @@ -964,9 +962,9 @@ static void PlayerDrownInit(Entity* this) { CreateFx(this, FX_WATER_SPLASH, 0); if (!(gPlayerState.flags & PL_NO_CAP)) - gPlayerState.animation = 0x72c; + gPlayerState.animation = ANIM_DROWN; else - gPlayerState.animation = 0x44c; + gPlayerState.animation = ANIM_DROWN_NOCAP; } ResetActiveItems(); } @@ -983,7 +981,7 @@ static void sub_080712F0(Entity* this) { temp = TRUE; } else if ((this->frame & ANIM_DONE) != 0) { if (this->animIndex != 0xce) - gPlayerState.animation = 0x2ce; + gPlayerState.animation = ANIM_DROWN_RESPAWN; else temp = TRUE; } @@ -1017,7 +1015,7 @@ static void PlayerUsePortal(Entity* this) { if ((gInput.newKeys & (B_BUTTON | R_BUTTON)) == 0) return; - if (AreaIsDungeon() || gArea.portal_type == 3) { + if (AreaIsDungeon() || gArea.portal_type == PT_DUNGEON) { this->subAction = 7; this->timer = 30; SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 16); @@ -1033,7 +1031,6 @@ static void PortalJumpOnUpdate(Entity* this) { COLLISION_OFF(this); this->knockbackDuration = 0; - x = gArea.portal_x; y = gArea.portal_y; @@ -1051,27 +1048,27 @@ static void PortalJumpOnUpdate(Entity* this) { this->subAction = 1; this->animationState = IdleSouth; this->spriteSettings.flipX = FALSE; - if (gArea.portal_type == 4) { - gPlayerState.animation = 0x52c; + if (gArea.portal_type == PT_JAR) { + gPlayerState.animation = ANIM_ENTER_POT; } } this->timer = 8; - if (gArea.portal_type != 3) { + if (gArea.portal_type != PT_DUNGEON) { this->spritePriority.b0 = 3; } } static void PortalStandUpdate(Entity* this) { switch (gArea.portal_type) { - case 4: - case 5: + case PT_JAR: + case PT_5: sub_0806F948(&gPlayerEntity); break; } - if ((gPlayerState.direction & 0x84) == 0) { + if ((gPlayerState.direction & (DIR_NOT_MOVING_CHECK | DIR_DIAGONAL)) == 0) { if (this->direction != gPlayerState.direction) { this->timer = 8; } @@ -1083,7 +1080,7 @@ static void PortalStandUpdate(Entity* this) { this->action = PLAYER_MINISH; this->subAction = 7; this->subtimer = 0; - gPlayerState.animation = (gPlayerState.flags & PL_NO_CAP) ? 0x41C : 0x80C; + gPlayerState.animation = (gPlayerState.flags & PL_NO_CAP) ? ANIM_HOP_NOCAP : ANIM_HOP; gPlayerState.flags &= ~PL_USE_PORTAL; return; } @@ -1092,7 +1089,7 @@ static void PortalStandUpdate(Entity* this) { this->timer = 8; } - if (gArea.portal_type == 4) { + if (gArea.portal_type == PT_JAR) { if (this->frame == 0) { UpdateAnimationSingleFrame(this); return; @@ -1108,7 +1105,7 @@ static void PortalActivateInit(Entity* this) { gPauseMenuOptions.disabled = 1; this->subAction = 3; this->subtimer = 30; - gPlayerState.animation = 0x738; + gPlayerState.animation = ANIM_PORTAL_ACTIVATE; CreateObjectWithParent(this, EZLO_CAP, 1, 0); PutAwayItems(); SetPlayerEventPriority(); @@ -1132,7 +1129,7 @@ static void PortalShrinkInit(Entity* this) { *(u32*)&this->field_0x80.HWORD = 0x100; *(u32*)&this->cutsceneBeh = 0x100; SetAffineInfo(this, 0x100, 0x100, 0); - gPlayerState.animation = 0x2c3; + gPlayerState.animation = ANIM_PORTAL_SHRINK; gPlayerState.flags |= PL_MINISH; SoundReq(SFX_PLY_SHRINKING); } @@ -1219,12 +1216,12 @@ static void PortalEnterUpdate(Entity* this) { this->spriteSettings.draw = FALSE; - if (gArea.portal_type == 3) { + if (gArea.portal_type == PT_DUNGEON) { if (--this->subtimer == 0) sub_080717F8(this); return; } - if (gArea.portal_type == 6) + if (gArea.portal_type == PT_TOD) DoExitTransition(&gUnk_0813AB58); else gArea.portal_in_use = TRUE; @@ -1300,9 +1297,9 @@ static void PlayerTalkEzlo_Init(Entity* this) { this->subAction++; if (this->animationState == IdleEast) { - gPlayerState.animation = 0x3ca; + gPlayerState.animation = ANIM_EZLO_APPEAR_RIGHT; } else { - gPlayerState.animation = 0x3c6; + gPlayerState.animation = ANIM_EZLO_APPEAR_LEFT; } this->spriteSettings.flipX = 0; @@ -1323,9 +1320,9 @@ static void PlayerTalkEzlo_CreateMessage(Entity* this) { this->child = CreateObjectWithParent(this, EZLO_CAP, 0, 0); if (this->child != NULL) { if (this->animationState == IdleEast) { - gPlayerState.animation = 0x3cc; + gPlayerState.animation = ANIM_EZLO_EYES_MIDDLE; } else { - gPlayerState.animation = 0x3c7; + gPlayerState.animation = ANIM_EZLO_EYES_UP; } DisplayEzloMessage(); } @@ -1333,15 +1330,15 @@ static void PlayerTalkEzlo_CreateMessage(Entity* this) { } static void PlayerTalkEzlo_MessageIdle(Entity* this) { - u32 temp; + u32 rightOrLeft; if ((gMessage.doTextBox & 0x7f) == 0) { this->subAction++; if ((gPlayerState.flags & PL_MINISH) == 0) { if (this->animationState == IdleEast) - gPlayerState.animation = 0x3cd; + gPlayerState.animation = ANIM_EZLO_LEAVE_RIGHT; else - gPlayerState.animation = 0x3c9; + gPlayerState.animation = ANIM_EZLO_LEAVE_LEFT; } else { reset_priority(); PlayerMinishSetNormalAndCollide(); @@ -1353,18 +1350,18 @@ static void PlayerTalkEzlo_MessageIdle(Entity* this) { return; if (this->animationState == IdleEast) - temp = 4; + rightOrLeft = 4; else - temp = 0; + rightOrLeft = 0; if (this->child->timer != 0) { - if ((u8)(temp + 200) != this->animIndex) { - gPlayerState.animation = temp + 0x3c8; + if ((u8)(rightOrLeft + 200) != this->animIndex) { + gPlayerState.animation = rightOrLeft + ANIM_EZLO_HEAD_DOWN; return; } } else { - if ((u8)(temp + 199) != this->animIndex) { - gPlayerState.animation = temp + 0x3c7; + if ((u8)(rightOrLeft + 199) != this->animIndex) { + gPlayerState.animation = rightOrLeft + ANIM_EZLO_EYES_UP; return; } } @@ -1388,7 +1385,7 @@ static void PlayerPush(Entity* this) { static EntityAction* const sPlayerPushStates[] = { PlayerPushInit, PlayerPushUpdate, - sub_08071B60, + PlayerPushEnd, }; gPlayerState.framestate = PL_STATE_PUSH; @@ -1455,7 +1452,7 @@ static void PlayerPushUpdate(Entity* this) { UpdatePlayerMovement(); } -static void sub_08071B60(Entity* this) { +static void PlayerPushEnd(Entity* this) { gPlayerState.pushedObject = 2; gPlayerState.flags &= ~PL_BUSY; this->type = 0; @@ -1463,8 +1460,8 @@ static void sub_08071B60(Entity* this) { PlayerWaitForScroll(this); // Final push? this->subtimer = 6; - if ((gPlayerState.flags & PL_MINISH) == 0) { - gPlayerState.animation = 0x104; + if (!(gPlayerState.flags & PL_MINISH)) { + gPlayerState.animation = ANIM_WALK; this->spriteIndex = 3; InitAnimationForceUpdate(this, (this->animationState >> 1) + 0x3c); } @@ -1484,16 +1481,16 @@ static void PlayerMinishDie(Entity* this) { } static void PlayerMinishDieInit(Entity* this) { - u32 temp; + u32 deathAnim; if (gPlayerState.flags & (PL_CAPTURED | PL_DISABLE_ITEMS)) return; if (GravityUpdate(this, GRAVITY_RATE)) { if (gPlayerState.flags & PL_NO_CAP) - gPlayerState.animation = 0x420; + gPlayerState.animation = ANIM_JUMP_NOCAP; else - gPlayerState.animation = 0x810; + gPlayerState.animation = ANIM_JUMP; return; } @@ -1505,11 +1502,11 @@ static void PlayerMinishDieInit(Entity* this) { RespawnPlayer(); this->action = PLAYER_MINISHDIE; } - temp = 0xc1a; + deathAnim = ANIM_DIE1_MINISH; } else { - temp = (gPlayerState.flags & PL_NO_CAP) ? 0x459 : 0x1bc; + deathAnim = (gPlayerState.flags & PL_NO_CAP) ? ANIM_DIE1_NOCAP : ANIM_DIE1; } - gPlayerState.animation = temp; + gPlayerState.animation = deathAnim; gPlayerState.flags &= ~(PL_PARACHUTE | PL_MOLDWORM_RELEASED | PL_ROLLING | PL_FROZEN | PL_BURNING | PL_DISABLE_ITEMS | PL_BUSY); @@ -1527,12 +1524,12 @@ static void PlayerMinishDieInit(Entity* this) { static void sub_08071CAC(Entity* this) { UpdateAnimationSingleFrame(this); if (this->frame & ANIM_DONE) { - u32 temp; + u32 deathAnim; if ((gPlayerState.flags & PL_MINISH) == 0) - temp = (gPlayerState.flags & PL_NO_CAP) ? 0x45a : 0x2bd; + deathAnim = (gPlayerState.flags & PL_NO_CAP) ? ANIM_DIE2_NOCAP : ANIM_DIE2; else - temp = 0xc1b; - gPlayerState.animation = temp; + deathAnim = ANIM_DIE2_MINISH; + gPlayerState.animation = deathAnim; this->subAction = 2; this->timer = 240; @@ -1560,7 +1557,7 @@ static void sub_08071D04(Entity* this) { ModHealth(deltaHealth); this->subAction = 3; gPlayerState.field_0x3c = 0; - this->direction = 0xff; + this->direction = DIR_NONE; this->speed = 0; this->zVelocity = Q_16_16(1.5); gPlayerState.jump_status = 1; @@ -1598,10 +1595,10 @@ static void sub_08071DD0(Entity* this) { if (gPlayerState.field_0x39 != 0) { gPlayerState.field_0x39 = 0; this->subAction = 2; - gPlayerState.animation = DEFAULT_ANIM; + gPlayerState.animation = ANIM_DEFAULT; } else { this->subAction = 1; - gPlayerState.animation = 0x114; + gPlayerState.animation = ANIM_BOUNCE; } } @@ -1661,13 +1658,13 @@ static void PlayerEmptyBottleInit(Entity* this) { this->subAction++; switch (gPlayerState.field_0x38) { case 0x20: - gPlayerState.animation = 0x614; + gPlayerState.animation = ANIM_BOTTLE_SWING; break; case 0x21 ... 0x25: - gPlayerState.animation = 0x2df; + gPlayerState.animation = ANIM_BOTTLE_DRINK; break; default: - gPlayerState.animation = 0x610; + gPlayerState.animation = ANIM_BOTTLE_POUR; SetInventoryValue(gPlayerState.field_0x38, 2); break; } @@ -1695,7 +1692,7 @@ static void PlayerFrozenInit(Entity* this) { COLLISION_OFF(this); this->timer = 120; this->subAction++; - gPlayerState.animation = 0x294; + gPlayerState.animation = ANIM_FROZEN; PutAwayItems(); SoundReq(SFX_195); } @@ -1790,12 +1787,12 @@ static void sub_08072100(Entity* this) { this->subAction = 1; COLLISION_OFF(this); if (gPlayerState.field_0x39) - this->direction = 0xff; + this->direction = DIR_NONE; if (gPlayerState.flags & PL_NO_CAP) { - gPlayerState.animation = 0x404; + gPlayerState.animation = ANIM_WALK_NOCAP; } else { - gPlayerState.animation = 0x104; + gPlayerState.animation = ANIM_WALK; } ResetActiveItems(); sub_08072168(this); @@ -1839,9 +1836,9 @@ static void sub_08072214(Entity* this) { this->timer = gPlayerState.field_0x38; this->direction = Direction8FromAnimationState(AnimationStateFlip180(this->animationState)); if ((gPlayerState.flags & PL_NO_CAP) == 0) { - gPlayerState.animation = 0x34c; + gPlayerState.animation = ANIM_PULL2; } else { - gPlayerState.animation = 0x944; + gPlayerState.animation = ANIM_PULL_NOCAP; } gPlayerState.flags |= PL_BUSY; sub_08072260(this); @@ -1854,9 +1851,9 @@ static void sub_08072260(Entity* this) { if (--this->timer == 0) { gPlayerState.flags &= ~PL_BUSY; if ((gPlayerState.flags & PL_NO_CAP) == 0) { - gPlayerState.animation = 0x34c; + gPlayerState.animation = ANIM_PULL2; } else { - gPlayerState.animation = 0x944; + gPlayerState.animation = ANIM_PULL_NOCAP; } this->knockbackDuration = 0; SetPlayerActionNormal(); @@ -1886,7 +1883,7 @@ static void PlayerLavaInit(Entity* this) { if (ent != NULL) { ent->child = this; } - gPlayerState.animation = 0x114; + gPlayerState.animation = ANIM_BOUNCE; } else { this->spriteSettings.draw = 0; this->subAction = 3; @@ -1909,7 +1906,7 @@ static void sub_08072354(Entity* this) { this->knockbackDuration = 0; this->subAction = 2; this->timer = 60; - gPlayerState.animation = 0x2c1; + gPlayerState.animation = ANIM_IN_LAVA; gPlayerState.flags &= ~PL_BURNING; UpdateSpriteForCollisionLayer(this); CreateFx(this, FX_LAVA_SPLASH, 0); @@ -1948,7 +1945,7 @@ static void sub_08072454(Entity* this) { static void sub_0807246C(Entity* this) { this->subAction = 1; this->timer = gPlayerState.field_0x38; - gPlayerState.animation = 0x3c0; + gPlayerState.animation = ANIM_LAUNCHED; SoundReq(SFX_PLY_VO7); } @@ -1989,9 +1986,9 @@ static void sub_080724DC(Entity* this) { this->subAction = 1; if (gRoomVars.field_0x0 == 0) { if (gPlayerState.flags & PL_MINISH) { - gPlayerState.animation = 0xc18; + gPlayerState.animation = ANIM_BOUNCE_MINISH; } else { - gPlayerState.animation = 0x104; + gPlayerState.animation = ANIM_WALK; } this->direction = Direction8FromAnimationState(this->animationState); } @@ -2033,7 +2030,7 @@ static void PlayerRoll(Entity* this) { } static void PlayerRollInit(Entity* this) { - u32 temp; + u32 playerFlags; if ((gPlayerState.flags & PL_MOLDWORM_RELEASED) == 0) { sub_0806F948(&gPlayerEntity); @@ -2042,16 +2039,16 @@ static void PlayerRollInit(Entity* this) { this->subAction = 1; this->timer = 0; ResetActiveItems(); - temp = gPlayerState.flags; + playerFlags = gPlayerState.flags; if (gPlayerState.flags & PL_MINISH) { this->spritePriority.b1 = 0; - gPlayerState.animation = 0xc08; + gPlayerState.animation = ANIM_ROLL_MINISH; } else { this->hurtType = 0x1e; - if (temp & 8) { - gPlayerState.animation = 0x438; + if (playerFlags & PL_NO_CAP) { + gPlayerState.animation = ANIM_ROLL_NOCAP; } else { - gPlayerState.animation = 0x2ac; + gPlayerState.animation = ANIM_ROLL; } } gPlayerState.flags |= PL_ROLLING; @@ -2185,9 +2182,9 @@ static void PlayerInHoleInit(Entity* this) { this->timer = 0; gPlayerState.flags |= PL_IN_HOLE; if (gPlayerState.flags & PL_NO_CAP) { - gPlayerState.animation = 0x950; + gPlayerState.animation = ANIM_FALL_IN_HOLE_NOCAP; } else { - gPlayerState.animation = 0x61c; + gPlayerState.animation = ANIM_FALL_IN_HOLE; if (GetTileIndex(COORD_TO_TILE(this), this->collisionLayer) == 0x4020) { this->timer = 1; } @@ -2205,15 +2202,15 @@ static void PlayerInHoleUpdate(Entity* this) { this->subAction = 3; this->timer = 40; this->spritePriority.b1 = 1; - gPlayerState.animation = 0x624; + gPlayerState.animation = ANIM_SPRING_JUMP; return; } this->subAction = 2; if (gPlayerState.flags & PL_NO_CAP) { - gPlayerState.animation = 0x954; + gPlayerState.animation = ANIM_IN_HOLE_NOCAP; } else { - gPlayerState.animation = 0x620; + gPlayerState.animation = ANIM_IN_HOLE; } } else { UpdateAnimationSingleFrame(this); @@ -2221,7 +2218,7 @@ static void PlayerInHoleUpdate(Entity* this) { } static void sub_08072ACC(Entity* this) { - if (gPlayerState.direction == 0xff) { + if (gPlayerState.direction == DIR_NONE) { this->subtimer = 0; } else if (this->subtimer > 7) { COLLISION_ON(this); @@ -2273,7 +2270,7 @@ static void sub_08072B5C(Entity* this) { temp <<= 12; this->zVelocity = temp; this->speed = Q_8_8(1.0); - gPlayerState.animation = 0x810; + gPlayerState.animation = ANIM_JUMP; SoundReq(SFX_PLY_JUMP); } @@ -2313,7 +2310,7 @@ static void sub_08072CC0(Entity* this) { this->subtimer = (gPlayerState.field_0x3a >> 2) + 1; this->direction = gPlayerState.field_0x39; this->speed = 0x400; - gPlayerState.animation = 0x524; + gPlayerState.animation = ANIM_GUSTJAR_524; gPlayerState.heldObject = 0; } @@ -2330,7 +2327,7 @@ static void sub_08072CFC(Entity* this) { } this->zVelocity = gPlayerState.field_0x38 << 0xc; this->speed = 0x200; - gPlayerState.animation = 0x810; + gPlayerState.animation = ANIM_JUMP; this->timer = 5; this->subtimer = 0; ResetActiveItems(); @@ -2415,9 +2412,9 @@ static void sub_08072D54(Entity* this) { } } else { if ((gPlayerState.flags & PL_NO_CAP)) { - gPlayerState.animation = 0x424; + gPlayerState.animation = ANIM_LAND_NOCAP; } else { - gPlayerState.animation = 0x820; + gPlayerState.animation = ANIM_LAND; } this->timer = 6; this->subAction = 3; @@ -2451,14 +2448,14 @@ static void PlayerClimb(Entity* this) { this->action = PLAYER_CLIMB; this->subAction = 0; this->y.HALF.LO = 0; - gPlayerState.animation = 0x2cf; + gPlayerState.animation = ANIM_CLIMB1_UP; } } } } static void sub_08072F94(Entity* this) { - u32 bVar1; + u32 direction; switch (gPlayerState.floor_type) { default: @@ -2469,43 +2466,43 @@ static void sub_08072F94(Entity* this) { case SURFACE_CLIMB_WALL: case SURFACE_2C: this->spritePriority.b1 = 0; - bVar1 = gPlayerState.direction; - if ((gPlayerState.direction & 0x80) == 0) { + direction = gPlayerState.direction; + if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) == 0) { this->direction = gPlayerState.direction; - if ((gPlayerState.direction == 8) || (gPlayerState.direction == 0x18)) { + if ((gPlayerState.direction == DirectionEast) || (gPlayerState.direction == DirectionWest)) { if (gPlayerState.floor_type == SURFACE_LADDER) { return; } if ((this->frame & 0x10)) { - gPlayerState.animation = 0x2d4; + gPlayerState.animation = ANIM_CLIMB_LEFT; } else { - gPlayerState.animation = 0x2d5; + gPlayerState.animation = ANIM_CLIMB_RIGHT; } sub_08073094(this); } else { - if ((gPlayerState.floor_type == SURFACE_LADDER) && ((bVar1 & 7) != 0)) { - this->direction = (bVar1 + 8) & 0x10; + if ((gPlayerState.floor_type == SURFACE_LADDER) && ((direction & (DIR_DIAGONAL | 0x3)) != 0)) { + this->direction = (direction + 8) & DirectionSouth; } - if (this->direction & 0x10) { + if (this->direction & DirectionSouth) { if (this->frame & 0x10) { - gPlayerState.animation = 0x2d1; + gPlayerState.animation = ANIM_CLIMB1_DOWN; } else { - gPlayerState.animation = 0x2d2; + gPlayerState.animation = ANIM_CLIMB2_DOWN; } } else { if (this->frame & 0x10) { - gPlayerState.animation = 0x2cf; + gPlayerState.animation = ANIM_CLIMB1_UP; } else { - gPlayerState.animation = 0x2d0; + gPlayerState.animation = ANIM_CLIMB2_UP; } } } this->subAction++; } else { if (this->frame & 0x10) { - gPlayerState.animation = 0x2d4; + gPlayerState.animation = ANIM_CLIMB_LEFT; } else { - gPlayerState.animation = 0x2d5; + gPlayerState.animation = ANIM_CLIMB_RIGHT; } } break; @@ -2564,7 +2561,7 @@ static void sub_08073094(Entity* this) { static void PlayerUseEntrance(Entity* this) { static EntityAction* const sPlayerUseEntranceStates[] = { - sub_080731D8, + PlayerUseStairs, sub_080732D0, sub_0807332C, sub_080733BC, @@ -2575,7 +2572,7 @@ static void PlayerUseEntrance(Entity* this) { sPlayerUseEntranceStates[this->subAction](this); } -static void sub_080731D8(Entity* this) { +static void PlayerUseStairs(Entity* this) { COLLISION_OFF(this); this->speed = 0x40; this->animationState = IdleNorth; @@ -2605,9 +2602,9 @@ static void sub_080731D8(Entity* this) { SetZeldaFollowTarget(this); } if (gPlayerState.flags & PL_NO_CAP) { - gPlayerState.animation = 1028; + gPlayerState.animation = ANIM_WALK_NOCAP; } else { - gPlayerState.animation = 260; + gPlayerState.animation = ANIM_WALK; } gRoomControls.camera_target = NULL; DeleteClones(); @@ -2636,19 +2633,20 @@ static void sub_0807332C(Entity* this) { if (gPlayerState.field_0x39 == 7) { this->direction = IdleNorth; } else { - this->direction = 28; + this->direction = DirectionNorthWest; } if ((this->x.HALF.HI & 0xF) != 0xF) { if (gPlayerState.field_0x39 == 7) { this->animationState = IdleEast; - this->direction = 4; + this->direction = DIR_DIAGONAL; } else { - this->animationState = 6; + this->animationState = IdleWest; if (this->direction <= DirectionWest) { LinearMoveUpdate(this); return; } - this->direction = (this->direction - 1) & 0x1F; + this->direction = (this->direction - 1) & + (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest); } LinearMoveUpdate(this); return; @@ -2702,7 +2700,7 @@ static void PlayerParachute(Entity* this) { } static void sub_08073468(Entity* this) { - gPlayerState.animation = 1792; + gPlayerState.animation = ANIM_PARACHUTE_ACTIVATE; gPlayerState.jump_status = 0; this->zVelocity = Q_16_16(-1.0); this->subAction++; @@ -2732,7 +2730,7 @@ static void sub_08073504(Entity* this) { *((u32*)&this->field_0x80.HWORD) = this->direction << 8; this->field_0x86.HALF.HI = 0; this->field_0x86.HALF.LO = 0; - gPlayerState.animation = 1800; + gPlayerState.animation = ANIM_PARACHUTE; if (gPlayerState.field_0x38 == 1) { COLLISION_OFF(this); this->subAction = 6; @@ -2752,14 +2750,14 @@ static void sub_08073584(Entity* this) { gPlayerState.jump_status |= 0x40; PlayerSetNormalAndCollide(); DoJump(this); - gPlayerState.animation = 1840; + gPlayerState.animation = ANIM_PARACHUTE_FALL; return; } gUnk_0200AF00.rActionPlayerState = R_ACTION_CANCEL; if (sub_0807A2F8(0)) { this->subAction++; - this->direction = 4 * (this->animationState & 6); + this->direction = 4 * (this->animationState & IdleWest); COLLISION_OFF(this); return; } @@ -2769,21 +2767,23 @@ static void sub_08073584(Entity* this) { else this->speed = 0x80; - if ((gPlayerState.direction & 0x80) == 0) { + if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) == 0) { if (this->direction != gPlayerState.direction) { - if (((this->direction - gPlayerState.direction) & 0x1F) < 0x10) + if (((this->direction - gPlayerState.direction) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | + DirectionSouth | DirectionWest)) < DirectionSouth) *(u32*)&this->field_0x80 -= 0x20; else *(u32*)&this->field_0x80 += 0x20; } } - this->direction = (*(u32*)&this->field_0x80 >> 8) & 0x1F; + this->direction = (*(u32*)&this->field_0x80 >> 8) & + (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest); UpdatePlayerMovement(); state = 4 * this->animationState; dir = this->direction; - if (this->animationState == 0) { + if (this->animationState == IdleNorth) { state = (state + 8) & 0x1F; - dir = (dir + 8) & 0x1F; + dir = (dir + 8) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest); } if (state - 7 > dir) { @@ -2801,7 +2801,8 @@ static void sub_08073584(Entity* this) { this->animationState = state; idx = 0; state = gPlayerState.direction >> 2; - if (!this->field_0x86.HALF.HI || ((gPlayerState.direction & 0x80) == 0 && this->animationState != state)) { + if (!this->field_0x86.HALF.HI || + ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) == 0 && this->animationState != state)) { static const u16 sAnims1[] = { 0x0708, 0x071C, @@ -2809,7 +2810,7 @@ static void sub_08073584(Entity* this) { 0x0714, }; - if ((gPlayerState.direction & 0x80) == 0) { + if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) == 0) { if (this->animationState != state) { if (this->animationState == (state ^ 4)) { idx = 2; @@ -2893,7 +2894,7 @@ static void sub_0807380C(Entity* this) { }; if ((gRoomTransition.frameCount & 3) == 0) { - u32 tmp = (this->animationState + 2) & 6; + u32 tmp = (this->animationState + 2) & IdleWest; this->animationState = tmp; this->direction = 4 * tmp; } @@ -2919,7 +2920,7 @@ void sub_08073884(Entity* this) { }; if ((gRoomTransition.frameCount & 1) == 0) { - u32 tmp = (this->animationState + 2) & 6; + u32 tmp = (this->animationState + 2) & IdleWest; this->animationState = tmp; this->direction = 4 * tmp; } @@ -2943,10 +2944,10 @@ static void DoJump(Entity* this) { } static void sub_08073924(Entity* this) { - if ((gPlayerState.flags & PL_ROLLING) == 0 && (this->z.HALF.HI & 0x8000) && !gPlayerState.field_0xa) { + if (!(gPlayerState.flags & PL_ROLLING) && (this->z.HALF.HI & 0x8000) && !gPlayerState.field_0xa) { gPlayerState.jump_status = 0x40; - gPlayerState.direction = 0xff; - this->direction = 0xff; + gPlayerState.direction = DIR_NONE; + this->direction = DIR_NONE; PutAwayItems(); sub_08073968(this); } @@ -2959,13 +2960,13 @@ static void sub_08073968(Entity* this) { CheckPlayerVelocity(); if ((gPlayerState.heldObject | gPlayerState.keepFacing) == 0) { if (gPlayerState.flags & PL_NO_CAP) { - gPlayerState.animation = 1052; + gPlayerState.animation = ANIM_HOP_NOCAP; } else { if ((gPlayerState.flags & PL_MINISH) == 0) { if (gPlayerState.flags & PL_ENTER_MINECART) { - gPlayerState.animation = 2064; + gPlayerState.animation = ANIM_JUMP; } else { - gPlayerState.animation = 2060; + gPlayerState.animation = ANIM_HOP; } } } @@ -2999,9 +3000,9 @@ static void sub_080739EC(Entity* this) { if ((gPlayerState.jump_status & 0x20) && this->zVelocity == 0) { this->zVelocity = Q_16_16(2.5); this->timer = 10; - this->direction = 0xff; + this->direction = DIR_NONE; gPlayerState.jump_status += 2; - gPlayerState.animation = 372; + gPlayerState.animation = ANIM_DOWN_THRUST; ResetPlayerVelocity(); return; } @@ -3040,9 +3041,9 @@ static void sub_08073AD4(Entity* this) { } gPlayerState.jump_status = tmp + 1; if (gPlayerState.flags & PL_NO_CAP) - gPlayerState.animation = 1060; + gPlayerState.animation = ANIM_LAND_NOCAP; else - gPlayerState.animation = 2080; + gPlayerState.animation = ANIM_LAND; SoundReq(SFX_PLY_LAND); } @@ -3104,7 +3105,7 @@ static void sub_08073C80(Entity* this) { static const Hitbox sMinishHitbox = { 0, -1, { 3, 2, 2, 3 }, 2, 2 }; gPlayerState.flags |= PL_MINISH; - gPlayerState.animation = 3096; + gPlayerState.animation = ANIM_BOUNCE_MINISH; this->spriteSettings.draw = 3; this->spritePriority.b1 = 3; this->spriteSettings.shadow = 0; @@ -3174,7 +3175,7 @@ static void sub_08073D20(Entity* this) { UpdatePlayerMovement(); } else { this->direction = gPlayerState.direction; - if ((gPlayerState.direction & 0x80) == 0) { + if (!(gPlayerState.direction & DIR_NOT_MOVING_CHECK)) { gPlayerState.framestate = PL_STATE_WALK; UpdatePlayerMovement(); } @@ -3228,7 +3229,7 @@ static void sub_08073F4C(Entity* this) { *(u32*)&this->cutsceneBeh.HWORD = 1152; this->spriteRendering.b0 = 3; sub_08074018(this); - gPlayerState.animation = 1852; + gPlayerState.animation = ANIM_GROW; } } @@ -3271,7 +3272,7 @@ static void sub_08074060(Entity* this) { this->subtimer = 0; this->subAction++; this->zVelocity = Q_16_16(2.0); - gPlayerState.animation = 2060; + gPlayerState.animation = ANIM_HOP; sub_0805EC60(this); } else { UpdateAnimationSingleFrame(this); @@ -3430,7 +3431,7 @@ void SurfaceAction_14(Entity* this) { sub_08074808(this); spd = this->speed; this->speed = 0x300; - this->direction = 16; + this->direction = DirectionSouth; gPlayerState.field_0xa |= 0x80; LinearMoveUpdate(this); this->speed = spd; @@ -3688,10 +3689,10 @@ void SurfaceAction_AutoLadder(Entity* this) { gPlayerState.swim_state = 0; this->collisionFlags &= ~4; if ((this->y.HALF.HI & 0xF) <= 7) { - gPlayerState.animation = 723; + gPlayerState.animation = ANIM_CLIMB_FROM_TOP; this->direction = DirectionSouth; } else { - gPlayerState.animation = 726; + gPlayerState.animation = ANIM_CLIMB_TO_TOP; this->direction = DirectionNorth; } ResetActiveItems(); @@ -3810,15 +3811,15 @@ static void sub_08074C68(Entity* this) { } } else { this->spriteSettings.draw = 1; - this->animationState = 0; + this->animationState = IdleNorth; this->spritePriority.b1 = 0; this->subAction = 2; this->field_0x68.HALF.LO = 1; sub_0807DD64(this); if (!gPlayerState.field_0x39) - gPlayerState.animation = 1850; + gPlayerState.animation = ANIM_SLEEP_NOCAP; else - gPlayerState.animation = 1846; + gPlayerState.animation = ANIM_SLEEP; SetFade(FADE_IN_OUT | FADE_INSTANT, 0x100); } } @@ -3844,23 +3845,23 @@ void sub_08074D34(Entity* this, ScriptExecutionContext* ctx) { break; case 0x1: if (gPlayerState.flags & PL_NO_CAP) - gPlayerState.animation = 0x400; + gPlayerState.animation = ANIM_DEFAULT_NOCAP; else - gPlayerState.animation = DEFAULT_ANIM; + gPlayerState.animation = ANIM_DEFAULT; break; case 0x2: if (gPlayerState.flags & PL_NO_CAP) - gPlayerState.animation = 1028; + gPlayerState.animation = ANIM_WALK_NOCAP; else - gPlayerState.animation = 260; + gPlayerState.animation = ANIM_WALK; break; case 0x4: break; case 0x8: if (gPlayerState.flags & PL_NO_CAP) - gPlayerState.animation = 1052; + gPlayerState.animation = ANIM_HOP_NOCAP; else - gPlayerState.animation = 2060; + gPlayerState.animation = ANIM_HOP; this->zVelocity = Q_16_16(1.5); break; case 0x10: @@ -3933,10 +3934,10 @@ void sub_08074F44(Entity* this) { if (((fixme*)&gPlayerEntity)->e) DeleteEntity(((fixme*)&gPlayerEntity)->e); if (!gPlayerState.field_0x39) { - gPlayerState.animation = 1851; + gPlayerState.animation = ANIM_WAKEUP_NOCAP; gPlayerState.flags |= PL_NO_CAP; } else { - gPlayerState.animation = 1847; + gPlayerState.animation = ANIM_WAKEUP; } } @@ -3951,9 +3952,9 @@ void sub_08074F8C(Entity* this) { this->timer = 8; this->animationState = IdleSouth; if (!gPlayerState.field_0x39) { - gPlayerState.animation = 1024; + gPlayerState.animation = ANIM_DEFAULT_NOCAP; } else { - gPlayerState.animation = DEFAULT_ANIM; + gPlayerState.animation = ANIM_DEFAULT; } } } @@ -3971,9 +3972,9 @@ void sub_0807501C(Entity* this) { if (--this->timer == 0) { this->animationState = gPlayerState.field_0x3a; if (!gPlayerState.field_0x39) { - gPlayerState.animation = 1052; + gPlayerState.animation = ANIM_HOP_NOCAP; } else { - gPlayerState.animation = 2060; + gPlayerState.animation = ANIM_HOP; } this->spritePriority.b1 = 1; this->direction = Direction8FromAnimationState(this->animationState); @@ -3991,10 +3992,10 @@ void sub_0807508C(Entity* this) { LinearMoveUpdate(this); } else { if (!gPlayerState.field_0x39) { - gPlayerState.animation = 1024; + gPlayerState.animation = ANIM_DEFAULT_NOCAP; } else { gPlayerState.flags &= ~PL_NO_CAP; - gPlayerState.animation = DEFAULT_ANIM; + gPlayerState.animation = ANIM_DEFAULT; } if (--this->timer == 0) { this->animationState = IdleSouth; @@ -4018,8 +4019,8 @@ void sub_080750F4(Entity* this) { void sub_08075110(Entity* this) { this->field_0x68.HALF.LO++; this->subtimer = this->animationState; - this->animationState = 0; - gPlayerState.animation = 1844; + this->animationState = IdleNorth; + gPlayerState.animation = ANIM_PUT_ON_EZLO; gPlayerState.flags &= ~PL_NO_CAP; } @@ -4043,7 +4044,7 @@ void sub_0807513C(Entity* this) { void sub_0807518C(Entity* this) { if (--this->timer == 0) { this->field_0x68.HALF.LO++; - gPlayerState.animation = 969; + gPlayerState.animation = ANIM_EZLO_LEAVE_LEFT; } } @@ -4053,7 +4054,7 @@ void sub_080751B4(Entity* this) { this->animationState = IdleSouth; this->subAction = 1; this->field_0x68.HALF.LO = 0; - gPlayerState.animation = DEFAULT_ANIM; + gPlayerState.animation = ANIM_DEFAULT; } } diff --git a/src/playerItem.c b/src/playerItem.c index b5248f8a..f6fbd5bf 100644 --- a/src/playerItem.c +++ b/src/playerItem.c @@ -105,7 +105,7 @@ void ItemInit(Entity* this) { } else { this->spriteVramOffset = definition->gfx & 0x3ff; } - if (this->animationState == 0) { + if (this->animationState == IdleNorth) { this->animationState = gPlayerEntity.animationState & 6; } diff --git a/src/playerItem/playerItemBoomerang.c b/src/playerItem/playerItemBoomerang.c index be166131..b8b9229d 100644 --- a/src/playerItem/playerItemBoomerang.c +++ b/src/playerItem/playerItemBoomerang.c @@ -148,8 +148,9 @@ void PlayerItemBoomerang_Action2(PlayerItemBoomerangEntity* this) { bool32 uVar6; sub_0801B804(this); - if ((this->unk_68 == 12) && (this->unk_80 == 0) && ((gPlayerState.direction & 0x80) == 0)) { - if (((this->unk_82.HALF.HI - gPlayerState.direction) & 0x1f) > 0x10) { + if ((this->unk_68 == 12) && (this->unk_80 == 0) && !(gPlayerState.direction & DIR_NOT_MOVING_CHECK)) { + if (((this->unk_82.HALF.HI - gPlayerState.direction) & + (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest)) > DirectionSouth) { this->unk_82.HWORD += 0x40; this->unk_82.HALF.HI &= 0x1f; super->direction = this->unk_82.HALF.HI; diff --git a/src/playerItem/playerItemBow.c b/src/playerItem/playerItemBow.c index dc53f306..061e0a69 100644 --- a/src/playerItem/playerItemBow.c +++ b/src/playerItem/playerItemBow.c @@ -210,16 +210,16 @@ void PlayerItemBow_Action1(PlayerItemBowEntity* this) { } } else { - if ((PlayerItemBowEntity*)gPlayerState.item != this || (gPlayerState.field_0x1f[2] == 0)) { + if ((PlayerItemBowEntity*)gPlayerState.item != this || (gPlayerState.bow_state == 0)) { if ((PlayerItemBowEntity*)gPlayerState.item == this) { gPlayerState.item = 0; } - gPlayerState.field_0x1f[2] = 0; + gPlayerState.bow_state = 0; DeleteThisEntity(); } - if ((this->unk_68 == 0xa) && (gPlayerState.field_0x1f[2] != 0)) { - if (gPlayerState.field_0x1f[2] < 0x78) { - gPlayerState.field_0x1f[2]++; + if ((this->unk_68 == 0xa) && (gPlayerState.bow_state != 0)) { + if (gPlayerState.bow_state < 0x78) { + gPlayerState.bow_state++; } else { super->hurtType = 0x0e; } diff --git a/src/playerUtils.c b/src/playerUtils.c index 7514488c..e707618f 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -378,7 +378,7 @@ void ResetActiveItems() { gPlayerState.moleMittsState = 0; gPlayerState.field_0x1c = 0; - gPlayerState.field_0x1f[2] = 0; + gPlayerState.bow_state = 0; gPlayerState.grab_status = 0; gPlayerState.itemAnimPriority = 0; gPlayerState.dash_state = 0; @@ -495,7 +495,7 @@ Entity* sub_08077CF8(u32 id, u32 type, u32 type2, u32 unk) { } void sub_08077D38(ItemBehavior* this, u32 index) { - u32 r6; + u32 anim; ItemDefinition* ptr; gPlayerState.field_0xa |= 8 >> index; @@ -510,16 +510,16 @@ void sub_08077D38(ItemBehavior* this, u32 index) { if ((gPlayerState.flags & PL_NO_CAP)) { switch (this->behaviorId) { case 0x1b: - r6 = 0x948; + anim = ANIM_GRAB_NOCAP; break; case 1: - r6 = 0x408; + anim = ANIM_SWORD_NOCAP; break; case 0xd: - r6 = 0x40c; + anim = ANIM_SHIELD_PULLOUT_NOCAP; break; } - SetItemAnim(this, r6); + SetItemAnim(this, anim); } else { SetItemAnim(this, ptr->frameIndex); } @@ -588,8 +588,8 @@ void DeleteItemBehavior(ItemBehavior* this, u32 index) { } bool32 sub_08077EC8(ItemBehavior* this) { - if ((gPlayerState.sword_state & 8) != 0) { - SetItemAnim(this, 0x170); + if (gPlayerState.sword_state & 8) { + SetItemAnim(this, ANIM_SWORD_CHARGE_BUMP); this->timer = 0x28; this->stateID = 7; this->animPriority = 6; @@ -1043,15 +1043,15 @@ void DetermineRButtonInteraction(void) { } bool32 sub_080782C0(void) { - u8 tmp; + u8 framestate; Entity* entity; if (gPlayerState.framestate == PL_STATE_IDLE) { - tmp = gPlayerState.framestate_last; + framestate = gPlayerState.framestate_last; } else { - tmp = gPlayerState.framestate; + framestate = gPlayerState.framestate; } - switch (tmp) { + switch (framestate) { case PL_STATE_SWORD: case PL_STATE_GUSTJAR: case PL_STATE_C: @@ -1363,7 +1363,7 @@ void ClearPlayerState(void) { gPlayerState.dash_state = 0; gPlayerState.field_0x1f[0] = 0; gPlayerState.field_0x1f[1] = 0; - gPlayerState.field_0x1f[2] = 0; + gPlayerState.bow_state = 0; gPlayerState.tilePosition = 0; gPlayerState.tileType = 0; gPlayerState.swim_state = 0; @@ -1490,7 +1490,7 @@ bool32 CheckQueuedAction(void) { // this doesnt seem to have any real function where its used void CheckPlayerVelocity(void) { u32 angle = gPlayerState.direction; - if ((angle & 0x80) != 0) { + if ((angle & DIR_NOT_MOVING_CHECK) != 0) { ResetPlayerVelocity(); } else { gPlayerState.vel_x = gSineTable[angle * 8]; @@ -1576,9 +1576,10 @@ void sub_08079064(Entity* this) { if (gPlayerState.itemAnimPriority < maxAnimPriority) { gPlayerState.animation = animIndex; } else if ((gPlayerState.swim_state & 0x80) != 0) { - gPlayerState.animation = 0x2be; + gPlayerState.animation = ANIM_DIVE; } else { - if (gPlayerState.animation == 0x608 || gPlayerState.animation == 0x104 || gPlayerState.animation == 0x404) { + if (gPlayerState.animation == ANIM_LANTERN || gPlayerState.animation == ANIM_WALK || + gPlayerState.animation == ANIM_WALK_NOCAP) { sub_080790E4(this); } } @@ -1616,9 +1617,9 @@ void sub_080790E4(Entity* this) { gPlayerState.field_0x35 = this->animationState; gPlayerState.framestate = PL_STATE_PUSH; if ((gPlayerState.flags & PL_NO_CAP) != 0) { - gPlayerState.animation = 0x93c; + gPlayerState.animation = ANIM_PUSH_NOCAP; } else { - gPlayerState.animation = 0x33c; + gPlayerState.animation = ANIM_PUSH; } } @@ -1672,7 +1673,7 @@ void PlayerMinishSetNormalAndCollide(void) { gPlayerEntity.action = PLAYER_MINISH; gPlayerEntity.subAction = 1; gPlayerEntity.collisionFlags &= 0xfb; - gPlayerState.animation = 0xc18; + gPlayerState.animation = ANIM_BOUNCE_MINISH; gPlayerState.flags &= ~(PL_BUSY | PL_DROWNING | PL_DISABLE_ITEMS | PL_IN_HOLE | PL_MOLDWORM_RELEASED | PL_PARACHUTE); gPlayerState.swim_state = 0; @@ -1752,7 +1753,7 @@ code_3: void sub_08079520(Entity* this) { s32 tmp = gPlayerState.direction; - if (tmp < 0x80) { + if (tmp < DIR_NOT_MOVING_CHECK) { this->direction = gPlayerState.direction; } else { this->direction = (this->animationState >> 1) << 3; @@ -1773,7 +1774,7 @@ bool32 sub_08079550(void) { if (gDiggingCaveEntranceTransition.isDiggingCave == 0) { if ((gPlayerState.dash_state == 0 || (gPlayerState.flags & PL_BURNING)) && (gPlayerState.swim_state != 0 || (gPlayerState.sword_state & 0x40) || - gPlayerEntity.direction != gPlayerState.direction || (gPlayerEntity.direction & 0x80))) { + gPlayerEntity.direction != gPlayerState.direction || (gPlayerEntity.direction & DIR_NOT_MOVING_CHECK))) { gPlayerEntity.subtimer = 0; return FALSE; } @@ -1865,72 +1866,74 @@ void sub_080797EC(void) { if ((gPlayerState.flags & PL_NO_CAP) != 0) { if (gPlayerState.heldObject != 0) { - animation = 0x934; + animation = ANIM_CARRY_NOCAP; } else if (gPlayerState.shield_status != 0) { - animation = 0x410; - } else if (gPlayerState.field_0x1f[2] == 0) { + animation = ANIM_SHIELD_WALK_NOCAP; + } else if (gPlayerState.bow_state == 0) { if (gPlayerState.swim_state != 0) { - animation = 0x290; + animation = ANIM_SWIM_MOVE; } else { - animation = 0x16c; + animation = ANIM_SWORD_CHARGE_WALK; if ((gPlayerState.sword_state & 0x48) != 0) { gPlayerState.prevAnim = 0x6c; return; } else if (gPlayerState.sword_state == 0) { - if (gPlayerState.framestate == 0) { - gPlayerState.framestate = 1; + if (gPlayerState.framestate == PL_STATE_IDLE) { + gPlayerState.framestate = PL_STATE_WALK; } - animation = 0x404; + animation = ANIM_WALK_NOCAP; } else { - animation = 0x16c; + animation = ANIM_SWORD_CHARGE_WALK; if (sub_080793E4(0)) { if (sub_080B1B44(GetPlayerTilePos(), gPlayerEntity.collisionLayer) != 0xff) { gPlayerState.sword_state &= ~8; - animation = 0x170; + animation = ANIM_SWORD_CHARGE_BUMP; } } } } } else { - animation = 0x284; + animation = ANIM_BOW_WALK; } } else { if (gPlayerState.field_0x1c != 0) { return; } else if (gPlayerState.heldObject != 0) { - animation = 0x348; + animation = ANIM_CARRY; } else if (gPlayerState.dash_state != 0) { - animation = 0x298; + animation = ANIM_DASH; } else if ((gPlayerState.flags & PL_IN_MINECART) != 0) { - animation = 0x710; + animation = ANIM_MINECART; } else if (gPlayerState.shield_status != 0) { - animation = 0x160; - } else if (gPlayerState.field_0x1f[2] != 0) { - animation = 0x284; + animation = ANIM_SHIELD_WALK; + } else if (gPlayerState.bow_state != 0) { + animation = ANIM_BOW_WALK; } else { if (gPlayerState.swim_state != 0) { - animation = 0x290; + animation = ANIM_SWIM_MOVE; } else { - animation = 0x16c; + animation = ANIM_SWORD_CHARGE_WALK; if ((gPlayerState.sword_state & 0x48) != 0) { gPlayerState.prevAnim = 0x6c; return; } else if (gPlayerState.sword_state != 0) { - animation = 0x16c; + animation = ANIM_SWORD_CHARGE_WALK; if (sub_080793E4(0)) { if (sub_080B1B44(GetPlayerTilePos(), (u32)gPlayerEntity.collisionLayer) != 0xff) { gPlayerState.sword_state &= ~8; - animation = 0x170; + animation = ANIM_SWORD_CHARGE_BUMP; } } } else { - if (gPlayerState.framestate == 0) { - gPlayerState.framestate = 1; + if (gPlayerState.framestate == PL_STATE_IDLE) { + gPlayerState.framestate = PL_STATE_WALK; } if ((gPlayerState.flags & PL_USE_LANTERN) != 0) { - animation = 0x608; + animation = ANIM_LANTERN; } else { - animation = 0x104; + // Change to test animations I guess + animation = ANIM_WALK; + // animation = 12; } } } @@ -1949,19 +1952,19 @@ void ResolvePlayerAnimation(void) { u32 anim; if ((gPlayerState.flags & PL_NO_CAP) != 0) { if (gPlayerState.heldObject != 0) { - anim = 0x92c; + anim = ANIM_CARRY_STAND_NOCAP; } else { if ((gPlayerState.field_0x1c | gPlayerState.moleMittsState) != 0) { return; } if ((gPlayerState.flags & PL_CONVEYOR_PUSHED) != 0) { - anim = 0x810; + anim = ANIM_JUMP; } else if (gPlayerState.shield_status != 0) { - anim = 0x414; - } else if (gPlayerState.field_0x1f[2] != 0) { - anim = 0x280; + anim = ANIM_SHIELD_NOCAP; + } else if (gPlayerState.bow_state != 0) { + anim = ANIM_BOW_CHARGE; } else if (gPlayerState.swim_state != 0) { - anim = 0x28c; + anim = ANIM_SWIM_STILL; } else { if ((gPlayerState.sword_state & 0x48) != 0) { return; @@ -1972,54 +1975,54 @@ void ResolvePlayerAnimation(void) { } if ((gPlayerState.flags & PL_USE_PORTAL) != 0) { switch (gArea.portal_type) { - case 5: - anim = 0x400; + case PT_5: + anim = ANIM_DEFAULT_NOCAP; break; - case 4: - anim = 0x100; + case PT_JAR: + anim = ANIM_DEFAULT; break; default: - anim = 0x2c2; + anim = ANIM_PORTAL; break; } } else { - anim = 0x400; + anim = ANIM_DEFAULT_NOCAP; } } else { - anim = 0x168; + anim = ANIM_SWORD_CHARGE; } } } } else { if (gPlayerState.heldObject != 0) { - anim = 0x350; + anim = ANIM_CARRY_STAND; } else { if ((gPlayerState.field_0x1c | gPlayerState.moleMittsState) != 0) { return; } if ((gPlayerState.flags & PL_MOLDWORM_CAPTURED) != 0) { - anim = 0x8b0; + anim = ANIM_MOLDWORM_CAPTURED; } else if ((gPlayerState.flags & PL_CONVEYOR_PUSHED) != 0) { - anim = 0x810; + anim = ANIM_JUMP; } else if (gPlayerState.dash_state != 0) { - anim = 0x298; + anim = ANIM_DASH; } else if ((gPlayerState.flags & PL_IN_MINECART) != 0) { - anim = 0x70c; + anim = ANIM_MINECART_PAUSE; } else if (gPlayerState.shield_status != 0) { - anim = 0x164; - } else if (gPlayerState.field_0x1f[2] != 0) { - anim = 0x280; + anim = ANIM_SHIELD; + } else if (gPlayerState.bow_state != 0) { + anim = ANIM_BOW_CHARGE; } else if (gPlayerState.swim_state != 0) { - anim = 0x28c; + anim = ANIM_SWIM_STILL; } else { if ((gPlayerState.sword_state & 0x48) != 0) { return; } if ((gPlayerState.flags & PL_USE_PORTAL) != 0) { - anim = (gArea.portal_type == 4) ? 0x530 : 0x2c2; + anim = (gArea.portal_type == PT_JAR) ? ANIM_IN_POT : ANIM_PORTAL; } else { if (gPlayerState.sword_state != 0) { - anim = 0x168; + anim = ANIM_SWORD_CHARGE; } else { if (gPlayerState.attack_status != 0) { return; @@ -2028,9 +2031,9 @@ void ResolvePlayerAnimation(void) { if (gActiveItems[ACTIVE_ITEM_LANTERN].animPriority != 0) { return; } - anim = 0x604; + anim = ANIM_LANTERN_ON; } else { - anim = 0x100; + anim = ANIM_DEFAULT; } } } @@ -2071,8 +2074,8 @@ bool32 sub_08079B24(void) { } if ((gPlayerState.jump_status & 0x41) == 0) { gPlayerState.jump_status = 0x41; - gPlayerEntity.direction = 0xff; - gPlayerState.direction = 0xff; + gPlayerEntity.direction = DIR_NONE; + gPlayerState.direction = DIR_NONE; return TRUE; } else { return TRUE; @@ -2659,7 +2662,7 @@ bool32 sub_0807AC54(Entity* this) { this->action = 0x1d; this->subAction = 0; this->y.HALF.LO = 0; - gPlayerState.animation = 0x2cf; + gPlayerState.animation = ANIM_CLIMB1_UP; return TRUE; case SURFACE_AUTO_LADDER: this->x.HALF.HI = (this->x.HALF.HI & 0xfff0) | 8; @@ -2749,7 +2752,7 @@ void PlayerUpdateSwimming(Entity* this) { ModHealth(-2); SoundReq(SFX_PLY_VO6); } - if ((this->direction & 0x80) != 0) { + if (this->direction & DIR_NOT_MOVING_CHECK) { if ((gRoomTransition.frameCount & 0xf) == 0) { CreateRandomWaterTrace(this, 4); } @@ -2824,21 +2827,21 @@ u32 GetSwordBeam(void) { } void sub_0807B068(Entity* entity) { - if ((gPlayerState.dash_state | gPlayerState.attack_status) == 0) { - if (gPlayerState.swim_state != 0) { - if ((gPlayerState.swim_state & 0x80) != 0) { - gPlayerState.animation = 0xc1c; + if (!(gPlayerState.dash_state | gPlayerState.attack_status)) { + if (gPlayerState.swim_state) { + if (gPlayerState.swim_state & 0x80) { + gPlayerState.animation = ANIM_DIVE_MINISH; } else { - gPlayerState.animation = 0xc0c; + gPlayerState.animation = ANIM_SWIM_MINISH; } } else { - if ((gPlayerState.direction & 0x80) != 0) { - if (gPlayerState.animation != 0xc18) { - gPlayerState.animation = 0xc18; + if (gPlayerState.direction & DIR_NOT_MOVING_CHECK) { + if (gPlayerState.animation != ANIM_BOUNCE_MINISH) { + gPlayerState.animation = ANIM_BOUNCE_MINISH; } } else { - if (gPlayerState.animation != 0xc04) { - gPlayerState.animation = 0xc04; + if (gPlayerState.animation != ANIM_WALK_MINISH) { + gPlayerState.animation = ANIM_WALK_MINISH; } } } @@ -2902,7 +2905,7 @@ void sub_0807B1EC(PlayerEntity* this) { if (--super->timer == 0) { this->unk_6e++; super->zVelocity = Q_16_16(1.0); - gPlayerState.animation = 0x2c2; + gPlayerState.animation = ANIM_PORTAL; } } diff --git a/src/projectile/boneProjectile.c b/src/projectile/boneProjectile.c index 069249ab..5593b602 100644 --- a/src/projectile/boneProjectile.c +++ b/src/projectile/boneProjectile.c @@ -88,7 +88,7 @@ void sub_080A82D8(Entity* this) { this->action = 4; COLLISION_OFF(this); this->zVelocity = Q_16_16(1.0); - this->direction ^= 0x10; + this->direction ^= DirectionSouth; this->speed = 0x80; } diff --git a/src/projectile/fireProjectile.c b/src/projectile/fireProjectile.c index 2d5cddc7..833930f0 100644 --- a/src/projectile/fireProjectile.c +++ b/src/projectile/fireProjectile.c @@ -24,7 +24,7 @@ void FireProjectile_Init(Entity* this) { InitializeAnimation(this, this->direction >> 3); } else { this->action = 2; - InitializeAnimation(this, this->direction >> 3 | 4); + InitializeAnimation(this, this->direction >> 3 | IdleSouth); EnqueueSFX(SFX_15E); } } @@ -41,7 +41,7 @@ void FireProjectile_Action1(Entity* this) { if (this->spriteSettings.draw == 1) { CopyPosition(parent, this); if (this->timer != 0) { - direction = parent->direction & 0x18; + direction = parent->direction & DirectionWest; this->direction = direction; this->timer = 0; InitializeAnimation(this, direction >> 3); diff --git a/src/projectile/gyorgTail.c b/src/projectile/gyorgTail.c index 56cc8372..0ed9e396 100644 --- a/src/projectile/gyorgTail.c +++ b/src/projectile/gyorgTail.c @@ -264,7 +264,7 @@ void sub_080AC6F0(Entity* this) { u32 uVar4; u32 tmp; - uVar4 = this->direction & 0x1f; + uVar4 = this->direction & (0x3 | DirectionNorthWest); uVar1 = this->direction >> 5; iVar3 = uVar1 * 3; tmp = gUnk_0812A9C0[this->animationState] - uVar1 * 3; diff --git a/src/projectile/iceProjectile.c b/src/projectile/iceProjectile.c index fb429e49..1ad42525 100644 --- a/src/projectile/iceProjectile.c +++ b/src/projectile/iceProjectile.c @@ -24,7 +24,7 @@ void IceProjectile_Init(Entity* this) { InitializeAnimation(this, this->direction >> 3); } else { this->action = 2; - InitializeAnimation(this, this->direction >> 3 | 4); + InitializeAnimation(this, this->direction >> 3 | IdleSouth); EnqueueSFX(SFX_160); } } @@ -43,7 +43,7 @@ void IceProjectile_Action1(Entity* this) { if (this->spriteSettings.draw == 1) { CopyPosition(parent, this); if (this->timer != 0) { - direction = parent->direction & 0x18; + direction = parent->direction & DirectionWest; this->direction = direction; this->timer = 0; InitializeAnimation(this, direction >> 3); diff --git a/src/projectile/v3TennisBallProjectile.c b/src/projectile/v3TennisBallProjectile.c index c703592e..f731832b 100644 --- a/src/projectile/v3TennisBallProjectile.c +++ b/src/projectile/v3TennisBallProjectile.c @@ -36,7 +36,7 @@ void V3TennisBallProjectile_OnCollision(Entity* this) { this->speed += 0x80 * 2; this->child = this->contactedEntity; if (sub_080ACB40(this)) { - this->direction = 0; + this->direction = DirectionNorth; } else { this->direction = this->knockbackDirection; } @@ -53,7 +53,7 @@ void V3TennisBallProjectile_OnCollision(Entity* this) { void V3TennisBallProjectile_Init(Entity* this) { this->action = 1; - this->direction = 0x10; + this->direction = DirectionSouth; this->z.HALF.HI = -4; this->child = NULL; InitializeAnimation(this, 7); diff --git a/src/projectile/windProjectile.c b/src/projectile/windProjectile.c index d07eeb6e..e3ce3d57 100644 --- a/src/projectile/windProjectile.c +++ b/src/projectile/windProjectile.c @@ -24,7 +24,7 @@ void WindProjectile_Init(Entity* this) { InitializeAnimation(this, this->direction >> 3); } else { this->action = 2; - InitializeAnimation(this, this->direction >> 3 | 4); + InitializeAnimation(this, this->direction >> 3 | IdleSouth); EnqueueSFX(SFX_15F); } } @@ -40,7 +40,7 @@ void WindProjectile_Action1(Entity* this) { } else { if (this->spriteSettings.draw == 1) { CopyPosition(parent, this); - direction = (parent->direction + 4) & 0x18; + direction = (parent->direction + 4) & DirectionWest; if (this->timer != 0) { this->direction = direction; this->animationState = direction >> 2; diff --git a/src/script.c b/src/script.c index 2a116567..2306dd85 100644 --- a/src/script.c +++ b/src/script.c @@ -1582,25 +1582,25 @@ void sub_0807F1A0(Entity* entity, ScriptExecutionContext* context) { void sub_0807F1C4(Entity* entity, ScriptExecutionContext* context) { if (gPlayerState.flags & PL_NO_CAP) { - gPlayerState.animation = 0x459; + gPlayerState.animation = ANIM_DIE1_NOCAP; } else { - gPlayerState.animation = 0x1bc; + gPlayerState.animation = ANIM_DIE1; } } void sub_0807F1E8(Entity* entity, ScriptExecutionContext* context) { if (gPlayerState.flags & PL_NO_CAP) { - gPlayerState.animation = 0x45a; + gPlayerState.animation = ANIM_DIE2_NOCAP; } else { - gPlayerState.animation = 0x2bd; + gPlayerState.animation = ANIM_DIE2; } } void sub_0807F210(Entity* entity, ScriptExecutionContext* context) { if (gPlayerState.flags & PL_NO_CAP) { - gPlayerState.animation = 0x41c; + gPlayerState.animation = ANIM_HOP_NOCAP; } else { - gPlayerState.animation = 0x80c; + gPlayerState.animation = ANIM_HOP; } } diff --git a/src/sound.c b/src/sound.c index f888af22..a6dc0444 100644 --- a/src/sound.c +++ b/src/sound.c @@ -958,7 +958,7 @@ const Song gSongTable[] = { [SFX_FALL_HOLE] = { &sfxFallHole, MUSIC_PLAYER_04, MUSIC_PLAYER_04 }, [SFX_86] = { &sfx86, MUSIC_PLAYER_0F, MUSIC_PLAYER_0F }, [SFX_PLY_DIE] = { &sfxPlyDie, MUSIC_PLAYER_1D, MUSIC_PLAYER_1D }, - [SFX_88] = { &sfx88, MUSIC_PLAYER_1C, MUSIC_PLAYER_1C }, + [SFX_GRAB] = { &sfx88, MUSIC_PLAYER_1C, MUSIC_PLAYER_1C }, [SFX_BARREL_RELEASE] = { &sfxBarrelRelease, MUSIC_PLAYER_1B, MUSIC_PLAYER_1B }, [SFX_BARREL_ENTER] = { &sfxBarrelEnter, MUSIC_PLAYER_1A, MUSIC_PLAYER_1A }, [SFX_BARREL_ROLL] = { &sfxBarrelRoll, MUSIC_PLAYER_19, MUSIC_PLAYER_19 }, @@ -1089,7 +1089,7 @@ const Song gSongTable[] = { [SFX_PLACE_OBJ] = { &sfx104, MUSIC_PLAYER_0D, MUSIC_PLAYER_0D }, [SFX_105] = { &sfx105, MUSIC_PLAYER_1E, MUSIC_PLAYER_1E }, [SFX_106] = { &sfx106, MUSIC_PLAYER_0B, MUSIC_PLAYER_0B }, - [SFX_107] = { &sfx107, MUSIC_PLAYER_0A, MUSIC_PLAYER_0A }, + [SFX_ITEM_GLOVES_AIR] = { &sfx107, MUSIC_PLAYER_0A, MUSIC_PLAYER_0A }, [SFX_108] = { &sfx108, MUSIC_PLAYER_09, MUSIC_PLAYER_09 }, [SFX_ITEM_GET] = { &sfx109, MUSIC_PLAYER_1E, MUSIC_PLAYER_1E }, [SFX_10A] = { &sfx10A, MUSIC_PLAYER_08, MUSIC_PLAYER_08 },