summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinmmar <herwig.orlich@gmail.com>2023-09-17 20:44:14 +0200
committerReinmmar <herwig.orlich@gmail.com>2023-09-17 20:44:14 +0200
commite994fab66a6ef731908b0655f3c8d2bbb8b4ac5d (patch)
tree8457616a93b0990019a4705e02972b39481de34b
parente8639051babd5a27745284f41fb60650bd08a976 (diff)
Uuuh... A lot of animations in an enum
-rw-r--r--data/scripts/cutscene/introAssembly/script_PlayerGetSword.inc2
-rw-r--r--data/scripts/cutscene/outro/script_PlayerGetGreenCap.inc4
-rw-r--r--data/scripts/cutscene/takeover/script_PlayerAtTakeover.inc4
-rw-r--r--data/scripts/dhc/script_PlayerStonesFall.inc2
-rw-r--r--data/scripts/mtCrenel/script_PlayerGetWhiteSword.inc2
-rw-r--r--data/scripts/sanctuary/script_PlayerPickUpFinalSword.inc2
-rw-r--r--data/scripts/sanctuary/script_PlayerPickUpSword.inc2
-rw-r--r--data/scripts/unused/script_08016482.inc2
-rw-r--r--include/player.h114
-rw-r--r--src/player.c260
-rw-r--r--src/playerUtils.c106
-rw-r--r--src/script.c12
12 files changed, 312 insertions, 200 deletions
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..6df39b0f 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 FALL_ON_BACK
_0807E8E4_0
_0807E8E4_1
_0807E8E4_2
diff --git a/include/player.h b/include/player.h
index 15197f98..d8dcd6b1 100644
--- a/include/player.h
+++ b/include/player.h
@@ -276,6 +276,120 @@ typedef enum {
SWORD_MOVE_LOW_BEAM,
} SwordMove;
+typedef enum {
+ ANIM_DEFAULT = 0x100,
+ ANIM_DOOR = 0x104,
+ ANIM_BOUNCE = 0x114,
+ ANIM_SHIELD = 0x160,
+ ANIM_SHIELD_END = 0x164,
+ ANIM_SWORD_CHARGE_END = 0x168,
+ ANIM_SWORD_CHARGE = 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_TRAPPED_BY_GHINI = 0x25c,
+ ANIM_BOW_END = 0x280,
+ ANIM_BOW = 0x284,
+ ANIM_SWIM_END = 0x28c,
+ ANIM_SWIM = 0x290,
+ ANIM_FROZEN = 0x294,
+ ANIM_DASH = 0x298,
+ ANIM_ROLL = 0x2ac,
+ ANIM_DIE2 = 0x2bd,
+ ANIM_DIVE = 0x2be,
+ ANIM_IN_LAVA = 0x2c1,
+ ANIM_PORTAL = 0x2c2,
+ ANIM_PORTAL_SHRINK = 0x2c3,
+ ANIM_DROWN_END = 0x2ce,
+ // I literally can't tell the difference in the following
+ ANIM_CLIMB = 0x2cf,
+ ANIM_CLIMB2 = 0x2d0,
+ ANIM_CLIMB3 = 0x2d1,
+ ANIM_CLIMB4 = 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_PUSH = 0x33c,
+ ANIM_PULL = 0x34c,
+ ANIM_CARRY = 0x348,
+ ANIM_CARRY_END = 0x350,
+ ANIM_FALL_ON_BACK = 0x3a0,
+ ANIM_3C0 = 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_DOOR_NOCAP = 0x404,
+ ANIM_SHIELD_NOCAP = 0x410,
+ ANIM_SHIELD_END_NOCAP = 0x414,
+ ANIM_PORTAL_LEAVE_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_524 = 0x524,
+ ANIM_ENTER_POT = 0x52c,
+ ANIM_LANTERN_END = 0x604,
+ ANIM_LANTERN = 0x608,
+ ANIM_BOTTLE_EMPTY = 0x610,
+ ANIM_BOTTLE_SWING = 0x614,
+ ANIM_FALL_IN_HOLE = 0x61c,
+ ANIM_IN_HOLE = 0x620,
+ ANIM_ROLL_IN_HOLE = 0x624,
+ ANIM_PARACHUTE = 0x700,
+ ANIM_PARACHUTE2 = 0x708,
+ ANIM_MINECART_END = 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_73C = 0x73c,
+ ANIM_PORTAL_LEAVE = 0x80c,
+ ANIM_JUMP = 0x810,
+ ANIM_LAND = 0x820,
+ ANIM_MOLDWORM_CAPTURED = 0x8b0,
+ ANIM_GET_NEW_SWORD = 0x8bf,
+ ANIM_GET_LAST_SWORD = 0x8e3,
+ ANIM_GET_NEWCAP = 0x8e4,
+ ANIM_CARRY_END_NOCAP = 0x92c,
+ ANIM_CARRY_NOCAP = 0x934,
+ ANIM_PUSH_NOCAP = 0x93c,
+ ANIM_PULL_NOCAP = 0x944,
+ ANIM_FALL_IN_HOLE_NOCAP = 0x950,
+ ANIM_IN_HOLE_NOCAP = 0x954,
+ ANIM_WALK_MINISH = 0xc04,
+ ANIM_ROLL_MINISH = 0xc08,
+ ANIM_SWIM_MINISH = 0xc0c,
+ ANIM_BOUNCE_MINISH = 0xc18,
+ ANIM_DROWN_MINISH = 0xc19,
+ ANIM_DIE1_MINISH = 0xc1a,
+ ANIM_DIE2_MINISH = 0xc1b,
+ ANIM_C1C = 0xc1c,
+} PlayerAnimation;
+
typedef struct {
/*0x00*/ u8 prevAnim;
/*0x01*/ u8 grab_status;
diff --git a/src/player.c b/src/player.c
index b22572a3..de8fa5eb 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;
@@ -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_BY_GHINI;
sub_0806F948(&gPlayerEntity);
ResetActiveItems();
UpdateActiveItems(this);
@@ -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_END;
else
temp = TRUE;
}
@@ -1052,7 +1050,7 @@ static void PortalJumpOnUpdate(Entity* this) {
this->animationState = IdleSouth;
this->spriteSettings.flipX = FALSE;
if (gArea.portal_type == 4) {
- gPlayerState.animation = 0x52c;
+ gPlayerState.animation = ANIM_ENTER_POT;
}
}
@@ -1083,7 +1081,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_PORTAL_LEAVE_NOCAP : ANIM_PORTAL_LEAVE;
gPlayerState.flags &= ~PL_USE_PORTAL;
return;
}
@@ -1108,7 +1106,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 +1130,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);
}
@@ -1300,9 +1298,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 +1321,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 +1331,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 +1351,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 +1386,7 @@ static void PlayerPush(Entity* this) {
static EntityAction* const sPlayerPushStates[] = {
PlayerPushInit,
PlayerPushUpdate,
- sub_08071B60,
+ PlayerPushEnd,
};
gPlayerState.framestate = PL_STATE_PUSH;
@@ -1455,7 +1453,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;
@@ -1464,7 +1462,7 @@ static void sub_08071B60(Entity* this) {
// Final push?
this->subtimer = 6;
if ((gPlayerState.flags & PL_MINISH) == 0) {
- gPlayerState.animation = 0x104;
+ gPlayerState.animation = ANIM_DOOR;
this->spriteIndex = 3;
InitAnimationForceUpdate(this, (this->animationState >> 1) + 0x3c);
}
@@ -1484,16 +1482,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 +1503,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 +1525,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;
@@ -1598,10 +1596,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 +1659,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_EMPTY;
SetInventoryValue(gPlayerState.field_0x38, 2);
break;
}
@@ -1695,7 +1693,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);
}
@@ -1793,9 +1791,9 @@ static void sub_08072100(Entity* this) {
this->direction = 0xff;
if (gPlayerState.flags & PL_NO_CAP) {
- gPlayerState.animation = 0x404;
+ gPlayerState.animation = ANIM_DOOR_NOCAP;
} else {
- gPlayerState.animation = 0x104;
+ gPlayerState.animation = ANIM_DOOR;
}
ResetActiveItems();
sub_08072168(this);
@@ -1839,9 +1837,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_PULL;
} else {
- gPlayerState.animation = 0x944;
+ gPlayerState.animation = ANIM_PULL_NOCAP;
}
gPlayerState.flags |= PL_BUSY;
sub_08072260(this);
@@ -1854,9 +1852,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_PULL;
} else {
- gPlayerState.animation = 0x944;
+ gPlayerState.animation = ANIM_PULL_NOCAP;
}
this->knockbackDuration = 0;
SetPlayerActionNormal();
@@ -1886,7 +1884,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 +1907,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 +1946,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_3C0;
SoundReq(SFX_PLY_VO7);
}
@@ -1989,9 +1987,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_DOOR;
}
this->direction = Direction8FromAnimationState(this->animationState);
}
@@ -2033,7 +2031,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 +2040,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 = 0x3a0;
}
}
gPlayerState.flags |= PL_ROLLING;
@@ -2185,9 +2183,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 +2203,15 @@ static void PlayerInHoleUpdate(Entity* this) {
this->subAction = 3;
this->timer = 40;
this->spritePriority.b1 = 1;
- gPlayerState.animation = 0x624;
+ gPlayerState.animation = ANIM_ROLL_IN_HOLE;
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);
@@ -2273,7 +2271,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 +2311,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_524;
gPlayerState.heldObject = 0;
}
@@ -2330,7 +2328,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 +2413,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,7 +2449,7 @@ static void PlayerClimb(Entity* this) {
this->action = PLAYER_CLIMB;
this->subAction = 0;
this->y.HALF.LO = 0;
- gPlayerState.animation = 0x2cf;
+ gPlayerState.animation = ANIM_CLIMB;
}
}
}
@@ -2477,9 +2475,9 @@ static void sub_08072F94(Entity* this) {
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 {
@@ -2488,24 +2486,24 @@ static void sub_08072F94(Entity* this) {
}
if (this->direction & 0x10) {
if (this->frame & 0x10) {
- gPlayerState.animation = 0x2d1;
+ gPlayerState.animation = ANIM_CLIMB3;
} else {
- gPlayerState.animation = 0x2d2;
+ gPlayerState.animation = ANIM_CLIMB4;
}
} else {
if (this->frame & 0x10) {
- gPlayerState.animation = 0x2cf;
+ gPlayerState.animation = ANIM_CLIMB;
} else {
- gPlayerState.animation = 0x2d0;
+ gPlayerState.animation = ANIM_CLIMB2;
}
}
}
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;
@@ -2605,9 +2603,9 @@ static void sub_080731D8(Entity* this) {
SetZeldaFollowTarget(this);
}
if (gPlayerState.flags & PL_NO_CAP) {
- gPlayerState.animation = 1028;
+ gPlayerState.animation = ANIM_DOOR_NOCAP;
} else {
- gPlayerState.animation = 260;
+ gPlayerState.animation = ANIM_DOOR;
}
gRoomControls.camera_target = NULL;
DeleteClones();
@@ -2702,7 +2700,7 @@ static void PlayerParachute(Entity* this) {
}
static void sub_08073468(Entity* this) {
- gPlayerState.animation = 1792;
+ gPlayerState.animation = ANIM_PARACHUTE;
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_PARACHUTE2;
if (gPlayerState.field_0x38 == 1) {
COLLISION_OFF(this);
this->subAction = 6;
@@ -2752,7 +2750,7 @@ static void sub_08073584(Entity* this) {
gPlayerState.jump_status |= 0x40;
PlayerSetNormalAndCollide();
DoJump(this);
- gPlayerState.animation = 1840;
+ gPlayerState.animation = ANIM_PARACHUTE_FALL;
return;
}
@@ -2959,13 +2957,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_PORTAL_LEAVE_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_PORTAL_LEAVE;
}
}
}
@@ -3001,7 +2999,7 @@ static void sub_080739EC(Entity* this) {
this->timer = 10;
this->direction = 0xff;
gPlayerState.jump_status += 2;
- gPlayerState.animation = 372;
+ gPlayerState.animation = ANIM_DOWN_THRUST;
ResetPlayerVelocity();
return;
}
@@ -3040,9 +3038,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 +3102,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;
@@ -3228,7 +3226,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_73C;
}
}
@@ -3271,7 +3269,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_PORTAL_LEAVE;
sub_0805EC60(this);
} else {
UpdateAnimationSingleFrame(this);
@@ -3688,10 +3686,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();
@@ -3816,9 +3814,9 @@ static void sub_08074C68(Entity* this) {
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 +3842,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_DOOR_NOCAP;
else
- gPlayerState.animation = 260;
+ gPlayerState.animation = ANIM_DOOR;
break;
case 0x4:
break;
case 0x8:
if (gPlayerState.flags & PL_NO_CAP)
- gPlayerState.animation = 1052;
+ gPlayerState.animation = ANIM_PORTAL_LEAVE_NOCAP;
else
- gPlayerState.animation = 2060;
+ gPlayerState.animation = ANIM_PORTAL_LEAVE;
this->zVelocity = Q_16_16(1.5);
break;
case 0x10:
@@ -3933,10 +3931,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 +3949,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 +3969,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_PORTAL_LEAVE_NOCAP;
} else {
- gPlayerState.animation = 2060;
+ gPlayerState.animation = ANIM_PORTAL_LEAVE;
}
this->spritePriority.b1 = 1;
this->direction = Direction8FromAnimationState(this->animationState);
@@ -3991,10 +3989,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;
@@ -4019,7 +4017,7 @@ void sub_08075110(Entity* this) {
this->field_0x68.HALF.LO++;
this->subtimer = this->animationState;
this->animationState = 0;
- gPlayerState.animation = 1844;
+ gPlayerState.animation = ANIM_PUT_ON_EZLO;
gPlayerState.flags &= ~PL_NO_CAP;
}
@@ -4043,7 +4041,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 +4051,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/playerUtils.c b/src/playerUtils.c
index 7df365a9..97767102 100644
--- a/src/playerUtils.c
+++ b/src/playerUtils.c
@@ -1576,9 +1576,9 @@ 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_DOOR || gPlayerState.animation == ANIM_DOOR_NOCAP) {
sub_080790E4(this);
}
}
@@ -1616,9 +1616,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 +1672,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;
@@ -1865,14 +1865,14 @@ 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;
+ animation = ANIM_SHIELD_NOCAP;
} else if (gPlayerState.field_0x1f[2] == 0) {
if (gPlayerState.swim_state != 0) {
- animation = 0x290;
+ animation = ANIM_SWIM;
} else {
- animation = 0x16c;
+ animation = ANIM_SWORD_CHARGE;
if ((gPlayerState.sword_state & 0x48) != 0) {
gPlayerState.prevAnim = 0x6c;
return;
@@ -1880,47 +1880,47 @@ void sub_080797EC(void) {
if (gPlayerState.framestate == PL_STATE_IDLE) {
gPlayerState.framestate = PL_STATE_WALK;
}
- animation = 0x404;
+ animation = ANIM_DOOR_NOCAP;
} else {
- animation = 0x16c;
+ animation = ANIM_SWORD_CHARGE;
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;
}
} 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;
+ animation = ANIM_SHIELD;
} else if (gPlayerState.field_0x1f[2] != 0) {
- animation = 0x284;
+ animation = ANIM_BOW;
} else {
if (gPlayerState.swim_state != 0) {
- animation = 0x290;
+ animation = ANIM_SWIM;
} else {
- animation = 0x16c;
+ animation = ANIM_SWORD_CHARGE;
if ((gPlayerState.sword_state & 0x48) != 0) {
gPlayerState.prevAnim = 0x6c;
return;
} else if (gPlayerState.sword_state != 0) {
- animation = 0x16c;
+ animation = ANIM_SWORD_CHARGE;
if (sub_080793E4(0)) {
if (sub_080B1B44(GetPlayerTilePos(), (u32)gPlayerEntity.collisionLayer) != 0xff) {
gPlayerState.sword_state &= ~8;
- animation = 0x170;
+ animation = ANIM_SWORD_CHARGE_BUMP;
}
}
} else {
@@ -1928,9 +1928,9 @@ void sub_080797EC(void) {
gPlayerState.framestate = PL_STATE_WALK;
}
if ((gPlayerState.flags & PL_USE_LANTERN) != 0) {
- animation = 0x608;
+ animation = ANIM_LANTERN;
} else {
- animation = 0x104;
+ animation = ANIM_DOOR;
}
}
}
@@ -1949,19 +1949,19 @@ void ResolvePlayerAnimation(void) {
u32 anim;
if ((gPlayerState.flags & PL_NO_CAP) != 0) {
if (gPlayerState.heldObject != 0) {
- anim = 0x92c;
+ anim = ANIM_CARRY_END_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;
+ anim = ANIM_SHIELD_END_NOCAP;
} else if (gPlayerState.field_0x1f[2] != 0) {
- anim = 0x280;
+ anim = ANIM_BOW_END;
} else if (gPlayerState.swim_state != 0) {
- anim = 0x28c;
+ anim = ANIM_SWIM_END;
} else {
if ((gPlayerState.sword_state & 0x48) != 0) {
return;
@@ -1973,44 +1973,44 @@ void ResolvePlayerAnimation(void) {
if ((gPlayerState.flags & PL_USE_PORTAL) != 0) {
switch (gArea.portal_type) {
case 5:
- anim = 0x400;
+ anim = ANIM_DEFAULT_NOCAP;
break;
case 4:
- anim = 0x100;
+ 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_END;
}
}
}
} else {
if (gPlayerState.heldObject != 0) {
- anim = 0x350;
+ anim = ANIM_CARRY_END;
} 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_END;
} else if (gPlayerState.shield_status != 0) {
- anim = 0x164;
+ anim = ANIM_SHIELD_END;
} else if (gPlayerState.field_0x1f[2] != 0) {
- anim = 0x280;
+ anim = ANIM_BOW_END;
} else if (gPlayerState.swim_state != 0) {
- anim = 0x28c;
+ anim = ANIM_SWIM_END;
} else {
if ((gPlayerState.sword_state & 0x48) != 0) {
return;
@@ -2019,7 +2019,7 @@ void ResolvePlayerAnimation(void) {
anim = (gArea.portal_type == 4) ? 0x530 : 0x2c2;
} else {
if (gPlayerState.sword_state != 0) {
- anim = 0x168;
+ anim = ANIM_SWORD_CHARGE_END;
} else {
if (gPlayerState.attack_status != 0) {
return;
@@ -2028,9 +2028,9 @@ void ResolvePlayerAnimation(void) {
if (gActiveItems[ACTIVE_ITEM_LANTERN].animPriority != 0) {
return;
}
- anim = 0x604;
+ anim = ANIM_LANTERN_END;
} else {
- anim = 0x100;
+ anim = ANIM_DEFAULT;
}
}
}
@@ -2659,7 +2659,7 @@ bool32 sub_0807AC54(Entity* this) {
this->action = 0x1d;
this->subAction = 0;
this->y.HALF.LO = 0;
- gPlayerState.animation = 0x2cf;
+ gPlayerState.animation = ANIM_CLIMB;
return TRUE;
case SURFACE_AUTO_LADDER:
this->x.HALF.HI = (this->x.HALF.HI & 0xfff0) | 8;
@@ -2827,18 +2827,18 @@ 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;
+ gPlayerState.animation = ANIM_C1C;
} else {
- gPlayerState.animation = 0xc0c;
+ gPlayerState.animation = ANIM_SWIM_MINISH;
}
} else {
if ((gPlayerState.direction & 0x80) != 0) {
- if (gPlayerState.animation != 0xc18) {
- gPlayerState.animation = 0xc18;
+ 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 +2902,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/script.c b/src/script.c
index 2a116567..c3f6329b 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_PORTAL_LEAVE_NOCAP;
} else {
- gPlayerState.animation = 0x80c;
+ gPlayerState.animation = ANIM_PORTAL_LEAVE;
}
}