From 8f9e309452fed4c25e9d3634bafb1584e38d6d33 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 20 Mar 2022 23:42:01 +0100 Subject: [PATCH] Doc (partially) player model and anim code data (#1143) * Doc (partially) player model and anim data * `Player_OverrideLimbDrawPause` -> `func_80091880` * Enum comments: use hex * Change `D_80853914` to 1D array, change accesses to use new macro `PLAYER_ANIM_BY_GROUP_AND_TYPE` * `PLAYER_ANIM_BY_GROUP_AND_TYPE` -> `GET_PLAYER_ANIM` --- include/variables.h | 2 +- include/z64player.h | 117 +++ src/code/z_player_lib.c | 359 +++++--- .../actors/ovl_Arms_Hook/z_arms_hook.c | 2 +- .../actors/ovl_En_Torch2/z_en_torch2.c | 2 +- src/overlays/actors/ovl_En_Zl2/z_en_zl2.c | 2 +- .../actors/ovl_player_actor/z_player.c | 782 +++++++++++------- 7 files changed, 849 insertions(+), 417 deletions(-) diff --git a/include/variables.h b/include/variables.h index dab9ea19a0..621081b91e 100644 --- a/include/variables.h +++ b/include/variables.h @@ -77,7 +77,7 @@ extern MapData gMapDataTable; extern s16 gSpoilingItems[3]; extern s16 gSpoilingItemReverts[3]; extern FlexSkeletonHeader* gPlayerSkelHeaders[2]; -extern u8 gPlayerModelTypes[][5]; +extern u8 gPlayerModelTypes[PLAYER_MODELGROUP_MAX][PLAYER_MODELGROUPENTRY_MAX]; extern Gfx* D_80125DE8[]; extern Gfx* D_80125E08[]; extern Gfx* D_80125E18[]; diff --git a/include/z64player.h b/include/z64player.h index 0f78004d7f..d9c626259d 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -212,6 +212,123 @@ typedef enum { /* 3 */ PLAYER_DOORTYPE_FAKE } PlayerDoorType; +typedef enum { + /* 0x00 */ PLAYER_MODELGROUP_0, // unused (except with the `func_80091880` bug) + /* 0x01 */ PLAYER_MODELGROUP_CHILD_HYLIAN_SHIELD, // kokiri/master sword, shield not in hand + /* 0x02 */ PLAYER_MODELGROUP_SWORD, // kokiri/master sword and possibly shield + /* 0x03 */ PLAYER_MODELGROUP_DEFAULT, // non-specific models, for items that don't have particular link models + /* 0x04 */ PLAYER_MODELGROUP_4, // unused, same as PLAYER_MODELGROUP_DEFAULT + /* 0x05 */ PLAYER_MODELGROUP_BGS, // biggoron sword + /* 0x06 */ PLAYER_MODELGROUP_BOW_SLINGSHOT, // bow/slingshot + /* 0x07 */ PLAYER_MODELGROUP_EXPLOSIVES, // bombs, bombchus, same as PLAYER_MODELGROUP_DEFAULT + /* 0x08 */ PLAYER_MODELGROUP_BOOMERANG, + /* 0x09 */ PLAYER_MODELGROUP_HOOKSHOT, + /* 0x0A */ PLAYER_MODELGROUP_10, // stick/fishing pole (which are drawn separately) + /* 0x0B */ PLAYER_MODELGROUP_HAMMER, + /* 0x0C */ PLAYER_MODELGROUP_OCARINA, // ocarina + /* 0x0D */ PLAYER_MODELGROUP_OOT, // ocarina of time + /* 0x0E */ PLAYER_MODELGROUP_BOTTLE, // bottles (drawn separately) + /* 0x0F */ PLAYER_MODELGROUP_15, // "last used" + /* 0x10 */ PLAYER_MODELGROUP_MAX +} PlayerModelGroup; + +typedef enum { + /* 0x00 */ PLAYER_MODELGROUPENTRY_ANIM, + /* 0x01 */ PLAYER_MODELGROUPENTRY_LEFT_HAND, + /* 0x02 */ PLAYER_MODELGROUPENTRY_RIGHT_HAND, + /* 0x03 */ PLAYER_MODELGROUPENTRY_SHEATH, + /* 0x04 */ PLAYER_MODELGROUPENTRY_WAIST, + /* 0x05 */ PLAYER_MODELGROUPENTRY_MAX +} PlayerModelGroupEntry; + +typedef enum { + // left hand + /* 0x00 */ PLAYER_MODELTYPE_LH_OPEN, // empty open hand + /* 0x01 */ PLAYER_MODELTYPE_LH_CLOSED, // empty closed hand + /* 0x02 */ PLAYER_MODELTYPE_LH_SWORD, // holding kokiri/master sword + /* 0x03 */ PLAYER_MODELTYPE_3, // unused, same as PLAYER_MODELTYPE_LH_SWORD + /* 0x04 */ PLAYER_MODELTYPE_LH_BGS, // holding bgs/broken giant knife (child: master sword) + /* 0x05 */ PLAYER_MODELTYPE_LH_HAMMER, // holding hammer (child: empty hand) + /* 0x06 */ PLAYER_MODELTYPE_LH_BOOMERANG, // holding boomerang (adult: empty hand) + /* 0x07 */ PLAYER_MODELTYPE_LH_BOTTLE, // holding bottle (bottle drawn separately) + // right hand + /* 0x08 */ PLAYER_MODELTYPE_RH_OPEN, // empty open hand + /* 0x09 */ PLAYER_MODELTYPE_RH_CLOSED, // empty closed hand + /* 0x0A */ PLAYER_MODELTYPE_RH_SHIELD, // holding a shield (including no shield) + /* 0x0B */ PLAYER_MODELTYPE_RH_BOW_SLINGSHOT, // holding bow/slingshot + /* 0x0C */ PLAYER_MODELTYPE_12, // unused, same as PLAYER_MODELTYPE_RH_BOW_SLINGSHOT + /* 0x0D */ PLAYER_MODELTYPE_RH_OCARINA, // holding ocarina (child: fairy ocarina, adult: OoT) + /* 0x0E */ PLAYER_MODELTYPE_RH_OOT, // holding OoT + /* 0x0F */ PLAYER_MODELTYPE_RH_HOOKSHOT, // holding hookshot (child: empty hand) + // sheath + /* 0x10 */ PLAYER_MODELTYPE_SHEATH_16, // sheathed kokiri/master sword? + /* 0x11 */ PLAYER_MODELTYPE_SHEATH_17, // empty sheath? + /* 0x12 */ PLAYER_MODELTYPE_SHEATH_18, // sword sheathed and shield on back? + /* 0x13 */ PLAYER_MODELTYPE_SHEATH_19, // empty sheath and shield on back? + // waist + /* 0x14 */ PLAYER_MODELTYPE_WAIST, + /* 0x15 */ PLAYER_MODELTYPE_MAX, + /* 0xFF */ PLAYER_MODELTYPE_RH_FF = 0xFF // disable shield collider, cutscene-specific +} PlayerModelType; + +typedef enum { + /* 0x00 */ PLAYER_ANIMTYPE_0, + /* 0x01 */ PLAYER_ANIMTYPE_1, + /* 0x02 */ PLAYER_ANIMTYPE_2, + /* 0x03 */ PLAYER_ANIMTYPE_3, + /* 0x04 */ PLAYER_ANIMTYPE_4, + /* 0x05 */ PLAYER_ANIMTYPE_5, + /* 0x06 */ PLAYER_ANIMTYPE_MAX +} PlayerAnimType; + +typedef enum { + /* 0x00 */ PLAYER_ANIMGROUP_0, + /* 0x01 */ PLAYER_ANIMGROUP_1, + /* 0x02 */ PLAYER_ANIMGROUP_2, + /* 0x03 */ PLAYER_ANIMGROUP_3, + /* 0x04 */ PLAYER_ANIMGROUP_4, + /* 0x05 */ PLAYER_ANIMGROUP_5, + /* 0x06 */ PLAYER_ANIMGROUP_6, + /* 0x07 */ PLAYER_ANIMGROUP_7, + /* 0x08 */ PLAYER_ANIMGROUP_8, + /* 0x09 */ PLAYER_ANIMGROUP_9, + /* 0x0A */ PLAYER_ANIMGROUP_10, + /* 0x0B */ PLAYER_ANIMGROUP_11, + /* 0x0C */ PLAYER_ANIMGROUP_12, + /* 0x0D */ PLAYER_ANIMGROUP_13, + /* 0x0E */ PLAYER_ANIMGROUP_14, + /* 0x0F */ PLAYER_ANIMGROUP_15, + /* 0x10 */ PLAYER_ANIMGROUP_16, + /* 0x11 */ PLAYER_ANIMGROUP_17, + /* 0x12 */ PLAYER_ANIMGROUP_18, + /* 0x13 */ PLAYER_ANIMGROUP_19, + /* 0x14 */ PLAYER_ANIMGROUP_20, + /* 0x15 */ PLAYER_ANIMGROUP_21, + /* 0x16 */ PLAYER_ANIMGROUP_22, + /* 0x17 */ PLAYER_ANIMGROUP_23, + /* 0x18 */ PLAYER_ANIMGROUP_24, + /* 0x19 */ PLAYER_ANIMGROUP_25, + /* 0x1A */ PLAYER_ANIMGROUP_26, + /* 0x1B */ PLAYER_ANIMGROUP_27, + /* 0x1C */ PLAYER_ANIMGROUP_28, + /* 0x1D */ PLAYER_ANIMGROUP_29, + /* 0x1E */ PLAYER_ANIMGROUP_30, + /* 0x1F */ PLAYER_ANIMGROUP_31, + /* 0x20 */ PLAYER_ANIMGROUP_32, + /* 0x21 */ PLAYER_ANIMGROUP_33, + /* 0x22 */ PLAYER_ANIMGROUP_34, + /* 0x23 */ PLAYER_ANIMGROUP_35, + /* 0x24 */ PLAYER_ANIMGROUP_36, + /* 0x25 */ PLAYER_ANIMGROUP_37, + /* 0x26 */ PLAYER_ANIMGROUP_38, + /* 0x27 */ PLAYER_ANIMGROUP_39, + /* 0x28 */ PLAYER_ANIMGROUP_40, + /* 0x29 */ PLAYER_ANIMGROUP_41, + /* 0x2A */ PLAYER_ANIMGROUP_42, + /* 0x2B */ PLAYER_ANIMGROUP_43, + /* 0x2C */ PLAYER_ANIMGROUP_44, + /* 0x2D */ PLAYER_ANIMGROUP_MAX +} PlayerAnimGroup; #define LIMB_BUF_COUNT(limbCount) ((ALIGN16((limbCount) * sizeof(Vec3s)) + sizeof(Vec3s) - 1) / sizeof(Vec3s)) #define PLAYER_LIMB_BUF_COUNT LIMB_BUF_COUNT(PLAYER_LIMB_MAX) diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 74ce5ba997..1b75efbedf 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -25,9 +25,74 @@ s16 sBootData[PLAYER_BOOTS_MAX][17] = { }; // Used to map action params to model groups -u8 sActionModelGroups[] = { - 3, 15, 10, 2, 2, 5, 10, 11, 6, 6, 6, 6, 6, 6, 6, 6, 9, 9, 7, 7, 8, 3, 3, 6, 3, 3, 3, 3, 12, 13, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, +u8 sActionModelGroups[PLAYER_AP_MAX] = { + /* PLAYER_AP_NONE */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_LAST_USED */ PLAYER_MODELGROUP_15, + /* PLAYER_AP_FISHING_POLE */ PLAYER_MODELGROUP_10, + /* PLAYER_AP_SWORD_MASTER */ PLAYER_MODELGROUP_SWORD, + /* PLAYER_AP_SWORD_KOKIRI */ PLAYER_MODELGROUP_SWORD, + /* PLAYER_AP_SWORD_BGS */ PLAYER_MODELGROUP_BGS, + /* PLAYER_AP_STICK */ PLAYER_MODELGROUP_10, + /* PLAYER_AP_HAMMER */ PLAYER_MODELGROUP_HAMMER, + /* PLAYER_AP_BOW */ PLAYER_MODELGROUP_BOW_SLINGSHOT, + /* PLAYER_AP_BOW_FIRE */ PLAYER_MODELGROUP_BOW_SLINGSHOT, + /* PLAYER_AP_BOW_ICE */ PLAYER_MODELGROUP_BOW_SLINGSHOT, + /* PLAYER_AP_BOW_LIGHT */ PLAYER_MODELGROUP_BOW_SLINGSHOT, + /* PLAYER_AP_BOW_0C */ PLAYER_MODELGROUP_BOW_SLINGSHOT, + /* PLAYER_AP_BOW_0D */ PLAYER_MODELGROUP_BOW_SLINGSHOT, + /* PLAYER_AP_BOW_0E */ PLAYER_MODELGROUP_BOW_SLINGSHOT, + /* PLAYER_AP_SLINGSHOT */ PLAYER_MODELGROUP_BOW_SLINGSHOT, + /* PLAYER_AP_HOOKSHOT */ PLAYER_MODELGROUP_HOOKSHOT, + /* PLAYER_AP_LONGSHOT */ PLAYER_MODELGROUP_HOOKSHOT, + /* PLAYER_AP_BOMB */ PLAYER_MODELGROUP_EXPLOSIVES, + /* PLAYER_AP_BOMBCHU */ PLAYER_MODELGROUP_EXPLOSIVES, + /* PLAYER_AP_BOOMERANG */ PLAYER_MODELGROUP_BOOMERANG, + /* PLAYER_AP_MAGIC_SPELL_15 */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_MAGIC_SPELL_16 */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_MAGIC_SPELL_17 */ PLAYER_MODELGROUP_BOW_SLINGSHOT, + /* PLAYER_AP_FARORES_WIND */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_NAYRUS_LOVE */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_DINS_FIRE */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_NUT */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_OCARINA_FAIRY */ PLAYER_MODELGROUP_OCARINA, + /* PLAYER_AP_OCARINA_TIME */ PLAYER_MODELGROUP_OOT, + /* PLAYER_AP_BOTTLE */ PLAYER_MODELGROUP_BOTTLE, + /* PLAYER_AP_BOTTLE_FISH */ PLAYER_MODELGROUP_BOTTLE, + /* PLAYER_AP_BOTTLE_FIRE */ PLAYER_MODELGROUP_BOTTLE, + /* PLAYER_AP_BOTTLE_BUG */ PLAYER_MODELGROUP_BOTTLE, + /* PLAYER_AP_BOTTLE_POE */ PLAYER_MODELGROUP_BOTTLE, + /* PLAYER_AP_BOTTLE_BIG_POE */ PLAYER_MODELGROUP_BOTTLE, + /* PLAYER_AP_BOTTLE_LETTER */ PLAYER_MODELGROUP_BOTTLE, + /* PLAYER_AP_BOTTLE_POTION_RED */ PLAYER_MODELGROUP_BOTTLE, + /* PLAYER_AP_BOTTLE_POTION_BLUE */ PLAYER_MODELGROUP_BOTTLE, + /* PLAYER_AP_BOTTLE_POTION_GREEN */ PLAYER_MODELGROUP_BOTTLE, + /* PLAYER_AP_BOTTLE_MILK */ PLAYER_MODELGROUP_BOTTLE, + /* PLAYER_AP_BOTTLE_MILK_HALF */ PLAYER_MODELGROUP_BOTTLE, + /* PLAYER_AP_BOTTLE_FAIRY */ PLAYER_MODELGROUP_BOTTLE, + /* PLAYER_AP_LETTER_ZELDA */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_WEIRD_EGG */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_CHICKEN */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_BEAN */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_POCKET_EGG */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_POCKET_CUCCO */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_COJIRO */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_ODD_MUSHROOM */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_ODD_POTION */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_SAW */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_SWORD_BROKEN */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_PRESCRIPTION */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_FROG */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_EYEDROPS */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_CLAIM_CHECK */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_MASK_KEATON */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_MASK_SKULL */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_MASK_SPOOKY */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_MASK_BUNNY */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_MASK_GORON */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_MASK_ZORA */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_MASK_GERUDO */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_MASK_TRUTH */ PLAYER_MODELGROUP_DEFAULT, + /* PLAYER_AP_LENS */ PLAYER_MODELGROUP_DEFAULT, }; TextTriggerEntry sTextTriggers[] = { @@ -38,68 +103,134 @@ TextTriggerEntry sTextTriggers[] = { }; // Used to map model groups to model types for [animation, left hand, right hand, sheath, waist] -u8 gPlayerModelTypes[][5] = { - { 2, 0, 10, 16, 20 }, { 1, 2, 9, 19, 20 }, { 1, 2, 10, 17, 20 }, { 0, 0, 8, 18, 20 }, - { 0, 0, 8, 18, 20 }, { 3, 4, 9, 19, 20 }, { 4, 1, 11, 18, 20 }, { 5, 0, 8, 18, 20 }, - { 0, 6, 8, 18, 20 }, { 4, 0, 15, 18, 20 }, { 3, 1, 9, 18, 20 }, { 3, 5, 9, 18, 20 }, - { 0, 0, 13, 18, 20 }, { 0, 0, 14, 18, 20 }, { 0, 7, 8, 18, 20 }, { 0, 2, 8, 19, 20 }, +u8 gPlayerModelTypes[PLAYER_MODELGROUP_MAX][PLAYER_MODELGROUPENTRY_MAX] = { + /* PLAYER_MODELGROUP_0 */ + { PLAYER_ANIMTYPE_2, PLAYER_MODELTYPE_LH_OPEN, PLAYER_MODELTYPE_RH_SHIELD, PLAYER_MODELTYPE_SHEATH_16, + PLAYER_MODELTYPE_WAIST }, + /* PLAYER_MODELGROUP_CHILD_HYLIAN_SHIELD */ + { PLAYER_ANIMTYPE_1, PLAYER_MODELTYPE_LH_SWORD, PLAYER_MODELTYPE_RH_CLOSED, PLAYER_MODELTYPE_SHEATH_19, + PLAYER_MODELTYPE_WAIST }, + /* PLAYER_MODELGROUP_SWORD */ + { PLAYER_ANIMTYPE_1, PLAYER_MODELTYPE_LH_SWORD, PLAYER_MODELTYPE_RH_SHIELD, PLAYER_MODELTYPE_SHEATH_17, + PLAYER_MODELTYPE_WAIST }, + /* PLAYER_MODELGROUP_DEFAULT */ + { PLAYER_ANIMTYPE_0, PLAYER_MODELTYPE_LH_OPEN, PLAYER_MODELTYPE_RH_OPEN, PLAYER_MODELTYPE_SHEATH_18, + PLAYER_MODELTYPE_WAIST }, + /* PLAYER_MODELGROUP_4 */ + { PLAYER_ANIMTYPE_0, PLAYER_MODELTYPE_LH_OPEN, PLAYER_MODELTYPE_RH_OPEN, PLAYER_MODELTYPE_SHEATH_18, + PLAYER_MODELTYPE_WAIST }, + /* PLAYER_MODELGROUP_BGS */ + { PLAYER_ANIMTYPE_3, PLAYER_MODELTYPE_LH_BGS, PLAYER_MODELTYPE_RH_CLOSED, PLAYER_MODELTYPE_SHEATH_19, + PLAYER_MODELTYPE_WAIST }, + /* PLAYER_MODELGROUP_BOW_SLINGSHOT */ + { PLAYER_ANIMTYPE_4, PLAYER_MODELTYPE_LH_CLOSED, PLAYER_MODELTYPE_RH_BOW_SLINGSHOT, PLAYER_MODELTYPE_SHEATH_18, + PLAYER_MODELTYPE_WAIST }, + /* PLAYER_MODELGROUP_EXPLOSIVES */ + { PLAYER_ANIMTYPE_5, PLAYER_MODELTYPE_LH_OPEN, PLAYER_MODELTYPE_RH_OPEN, PLAYER_MODELTYPE_SHEATH_18, + PLAYER_MODELTYPE_WAIST }, + /* PLAYER_MODELGROUP_BOOMERANG */ + { PLAYER_ANIMTYPE_0, PLAYER_MODELTYPE_LH_BOOMERANG, PLAYER_MODELTYPE_RH_OPEN, PLAYER_MODELTYPE_SHEATH_18, + PLAYER_MODELTYPE_WAIST }, + /* PLAYER_MODELGROUP_HOOKSHOT */ + { PLAYER_ANIMTYPE_4, PLAYER_MODELTYPE_LH_OPEN, PLAYER_MODELTYPE_RH_HOOKSHOT, PLAYER_MODELTYPE_SHEATH_18, + PLAYER_MODELTYPE_WAIST }, + /* PLAYER_MODELGROUP_10 */ + { PLAYER_ANIMTYPE_3, PLAYER_MODELTYPE_LH_CLOSED, PLAYER_MODELTYPE_RH_CLOSED, PLAYER_MODELTYPE_SHEATH_18, + PLAYER_MODELTYPE_WAIST }, + /* PLAYER_MODELGROUP_HAMMER */ + { PLAYER_ANIMTYPE_3, PLAYER_MODELTYPE_LH_HAMMER, PLAYER_MODELTYPE_RH_CLOSED, PLAYER_MODELTYPE_SHEATH_18, + PLAYER_MODELTYPE_WAIST }, + /* PLAYER_MODELGROUP_OCARINA */ + { PLAYER_ANIMTYPE_0, PLAYER_MODELTYPE_LH_OPEN, PLAYER_MODELTYPE_RH_OCARINA, PLAYER_MODELTYPE_SHEATH_18, + PLAYER_MODELTYPE_WAIST }, + /* PLAYER_MODELGROUP_OOT */ + { PLAYER_ANIMTYPE_0, PLAYER_MODELTYPE_LH_OPEN, PLAYER_MODELTYPE_RH_OOT, PLAYER_MODELTYPE_SHEATH_18, + PLAYER_MODELTYPE_WAIST }, + /* PLAYER_MODELGROUP_BOTTLE */ + { PLAYER_ANIMTYPE_0, PLAYER_MODELTYPE_LH_BOTTLE, PLAYER_MODELTYPE_RH_OPEN, PLAYER_MODELTYPE_SHEATH_18, + PLAYER_MODELTYPE_WAIST }, + /* PLAYER_MODELGROUP_15 */ + { PLAYER_ANIMTYPE_0, PLAYER_MODELTYPE_LH_SWORD, PLAYER_MODELTYPE_RH_OPEN, PLAYER_MODELTYPE_SHEATH_19, + PLAYER_MODELTYPE_WAIST }, }; -Gfx* D_80125CE8[] = { +Gfx* D_80125CE8[PLAYER_SHIELD_MAX * 4] = { + // PLAYER_SHIELD_NONE gLinkAdultRightHandClosedNearDL, gLinkChildRightHandClosedNearDL, gLinkAdultRightHandClosedFarDL, gLinkChildRightHandClosedFarDL, + // PLAYER_SHIELD_DEKU gLinkAdultRightHandClosedNearDL, gLinkChildRightFistAndDekuShieldNearDL, gLinkAdultRightHandClosedFarDL, gLinkChildRightFistAndDekuShieldFarDL, + // PLAYER_SHIELD_HYLIAN gLinkAdultRightHandHoldingHylianShieldNearDL, gLinkChildRightHandClosedNearDL, gLinkAdultRightHandHoldingHylianShieldFarDL, gLinkChildRightHandClosedFarDL, + // PLAYER_SHIELD_MIRROR gLinkAdultRightHandHoldingMirrorShieldNearDL, gLinkChildRightHandClosedNearDL, gLinkAdultRightHandHoldingMirrorShieldFarDL, gLinkChildRightHandClosedFarDL, }; -Gfx* D_80125D28[] = { - gLinkAdultMasterSwordAndSheathNearDL, gLinkChildSwordAndSheathNearDL, - gLinkAdultMasterSwordAndSheathFarDL, gLinkChildSwordAndSheathFarDL, - gLinkAdultMasterSwordAndSheathNearDL, gLinkChildDekuShieldSwordAndSheathNearDL, - gLinkAdultMasterSwordAndSheathFarDL, gLinkChildDekuShieldSwordAndSheathFarDL, - gLinkAdultHylianShieldSwordAndSheathNearDL, gLinkChildHylianShieldSwordAndSheathNearDL, - gLinkAdultHylianShieldSwordAndSheathFarDL, gLinkChildHylianShieldSwordAndSheathFarDL, - gLinkAdultMirrorShieldSwordAndSheathNearDL, gLinkChildSwordAndSheathNearDL, - gLinkAdultMirrorShieldSwordAndSheathFarDL, gLinkChildSwordAndSheathFarDL, +Gfx* D_80125D28[PLAYER_SHIELD_MAX * 4] = { + // PLAYER_SHIELD_NONE + gLinkAdultMasterSwordAndSheathNearDL, + gLinkChildSwordAndSheathNearDL, + gLinkAdultMasterSwordAndSheathFarDL, + gLinkChildSwordAndSheathFarDL, + // PLAYER_SHIELD_DEKU + gLinkAdultMasterSwordAndSheathNearDL, + gLinkChildDekuShieldSwordAndSheathNearDL, + gLinkAdultMasterSwordAndSheathFarDL, + gLinkChildDekuShieldSwordAndSheathFarDL, + // PLAYER_SHIELD_HYLIAN + gLinkAdultHylianShieldSwordAndSheathNearDL, + gLinkChildHylianShieldSwordAndSheathNearDL, + gLinkAdultHylianShieldSwordAndSheathFarDL, + gLinkChildHylianShieldSwordAndSheathFarDL, + // PLAYER_SHIELD_MIRROR + gLinkAdultMirrorShieldSwordAndSheathNearDL, + gLinkChildSwordAndSheathNearDL, + gLinkAdultMirrorShieldSwordAndSheathFarDL, + gLinkChildSwordAndSheathFarDL, }; Gfx* D_80125D68[] = { NULL, NULL, NULL, NULL, NULL, gLinkChildDekuShieldWithMatrixDL, NULL, gLinkChildDekuShieldWithMatrixDL, }; -Gfx* D_80125D88[] = { +Gfx* D_80125D88[(PLAYER_SHIELD_MAX + 2) * 4] = { + // PLAYER_SHIELD_NONE gLinkAdultSheathNearDL, gLinkChildSheathNearDL, gLinkAdultSheathFarDL, gLinkChildSheathFarDL, + // PLAYER_SHIELD_DEKU gLinkAdultSheathNearDL, gLinkChildDekuShieldAndSheathNearDL, gLinkAdultSheathFarDL, gLinkChildDekuShieldAndSheathFarDL, + // PLAYER_SHIELD_HYLIAN gLinkAdultHylianShieldAndSheathNearDL, gLinkChildHylianShieldAndSheathNearDL, gLinkAdultHylianShieldAndSheathFarDL, gLinkChildHylianShieldAndSheathFarDL, + // PLAYER_SHIELD_MIRROR gLinkAdultMirrorShieldAndSheathNearDL, gLinkChildSheathNearDL, gLinkAdultMirrorShieldAndSheathFarDL, gLinkChildSheathFarDL, + // PLAYER_SHIELD_NONE (child, no sword) NULL, NULL, NULL, NULL, + // PLAYER_SHIELD_DEKU (child, no sword) gLinkAdultSheathNearDL, gLinkChildDekuShieldWithMatrixDL, gLinkAdultSheathNearDL, @@ -107,10 +238,16 @@ Gfx* D_80125D88[] = { }; Gfx* D_80125DE8[] = { - gLinkAdultLeftHandHoldingBgsNearDL, gLinkChildLeftHandHoldingMasterSwordDL, - gLinkAdultLeftHandHoldingBgsFarDL, gLinkChildLeftHandHoldingMasterSwordDL, - gLinkAdultHandHoldingBrokenGiantsKnifeDL, gLinkChildLeftHandHoldingMasterSwordDL, - gLinkAdultHandHoldingBrokenGiantsKnifeFarDL, gLinkChildLeftHandHoldingMasterSwordDL, + // biggoron sword + gLinkAdultLeftHandHoldingBgsNearDL, + gLinkChildLeftHandHoldingMasterSwordDL, + gLinkAdultLeftHandHoldingBgsFarDL, + gLinkChildLeftHandHoldingMasterSwordDL, + // broken giant knife + gLinkAdultHandHoldingBrokenGiantsKnifeDL, + gLinkChildLeftHandHoldingMasterSwordDL, + gLinkAdultHandHoldingBrokenGiantsKnifeFarDL, + gLinkChildLeftHandHoldingMasterSwordDL, }; Gfx* D_80125E08[] = { @@ -258,10 +395,28 @@ Gfx* sHoldingFirstPersonWeaponDLs[] = { }; // Indexed by model types (left hand, right hand, sheath or waist) -Gfx** sPlayerDListGroups[] = { - D_80125E08, D_80125E18, D_80125E38, D_80125E28, D_80125DE8, D_80125EE8, D_80125EF8, - D_80125F08, D_80125E48, D_80125E58, D_80125CE8, D_80125E68, D_80125EA8, D_80125EB8, - D_80125EC8, D_80125ED8, D_80125E78, D_80125E88, D_80125D28, D_80125D88, D_80125E98, +Gfx** sPlayerDListGroups[PLAYER_MODELTYPE_MAX] = { + /* PLAYER_MODELTYPE_LH_OPEN */ D_80125E08, + /* PLAYER_MODELTYPE_LH_CLOSED */ D_80125E18, + /* PLAYER_MODELTYPE_LH_SWORD */ D_80125E38, + /* PLAYER_MODELTYPE_3 */ D_80125E28, + /* PLAYER_MODELTYPE_LH_BGS */ D_80125DE8, + /* PLAYER_MODELTYPE_LH_HAMMER */ D_80125EE8, + /* PLAYER_MODELTYPE_LH_BOOMERANG */ D_80125EF8, + /* PLAYER_MODELTYPE_LH_BOTTLE */ D_80125F08, + /* PLAYER_MODELTYPE_RH_OPEN */ D_80125E48, + /* PLAYER_MODELTYPE_RH_CLOSED */ D_80125E58, + /* PLAYER_MODELTYPE_RH_SHIELD */ D_80125CE8, + /* PLAYER_MODELTYPE_RH_BOW_SLINGSHOT */ D_80125E68, + /* PLAYER_MODELTYPE_12 */ D_80125EA8, + /* PLAYER_MODELTYPE_RH_OCARINA */ D_80125EB8, + /* PLAYER_MODELTYPE_RH_OOT */ D_80125EC8, + /* PLAYER_MODELTYPE_RH_HOOKSHOT */ D_80125ED8, + /* PLAYER_MODELTYPE_SHEATH_16 */ D_80125E78, + /* PLAYER_MODELTYPE_SHEATH_17 */ D_80125E88, + /* PLAYER_MODELTYPE_SHEATH_18 */ D_80125D28, + /* PLAYER_MODELTYPE_SHEATH_19 */ D_80125D88, + /* PLAYER_MODELTYPE_WAIST */ D_80125E98, }; Gfx gCullBackDList[] = { @@ -277,8 +432,8 @@ Gfx gCullFrontDList[] = { Vec3f* sCurBodyPartPos; s32 sDListsLodOffset; Vec3f sGetItemRefPos; -s32 D_80160014; -s32 D_80160018; +s32 sLeftHandType; +s32 sRightHandType; void Player_SetBootData(GlobalContext* globalCtx, Player* this) { s32 currentBoots; @@ -348,8 +503,9 @@ s32 Player_IsChildWithHylianShield(Player* this) { s32 Player_ActionToModelGroup(Player* this, s32 actionParam) { s32 modelGroup = sActionModelGroups[actionParam]; - if ((modelGroup == 2) && Player_IsChildWithHylianShield(this)) { - return 1; + if ((modelGroup == PLAYER_MODELGROUP_SWORD) && Player_IsChildWithHylianShield(this)) { + // child, using kokiri sword with hylian shield equipped + return PLAYER_MODELGROUP_CHILD_HYLIAN_SHIELD; } else { return modelGroup; } @@ -359,29 +515,33 @@ void Player_SetModelsForHoldingShield(Player* this) { if ((this->stateFlags1 & PLAYER_STATE1_22) && ((this->itemActionParam < 0) || (this->itemActionParam == this->heldItemActionParam))) { if (!Player_HoldsTwoHandedWeapon(this) && !Player_IsChildWithHylianShield(this)) { - this->rightHandType = 10; - this->rightHandDLists = &sPlayerDListGroups[10][(void)0, gSaveContext.linkAge]; - if (this->sheathType == 18) { - this->sheathType = 16; - } else if (this->sheathType == 19) { - this->sheathType = 17; + this->rightHandType = PLAYER_MODELTYPE_RH_SHIELD; + this->rightHandDLists = &sPlayerDListGroups[PLAYER_MODELTYPE_RH_SHIELD][(void)0, gSaveContext.linkAge]; + if (this->sheathType == PLAYER_MODELTYPE_SHEATH_18) { + this->sheathType = PLAYER_MODELTYPE_SHEATH_16; + } else if (this->sheathType == PLAYER_MODELTYPE_SHEATH_19) { + this->sheathType = PLAYER_MODELTYPE_SHEATH_17; } this->sheathDLists = &sPlayerDListGroups[this->sheathType][(void)0, gSaveContext.linkAge]; - this->modelAnimType = 2; + this->modelAnimType = PLAYER_ANIMTYPE_2; this->itemActionParam = -1; } } } void Player_SetModels(Player* this, s32 modelGroup) { - this->leftHandType = gPlayerModelTypes[modelGroup][1]; - this->rightHandType = gPlayerModelTypes[modelGroup][2]; - this->sheathType = gPlayerModelTypes[modelGroup][3]; + this->leftHandType = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_LEFT_HAND]; + this->rightHandType = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_RIGHT_HAND]; + this->sheathType = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_SHEATH]; - this->leftHandDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][1]][(void)0, gSaveContext.linkAge]; - this->rightHandDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][2]][(void)0, gSaveContext.linkAge]; - this->sheathDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][3]][(void)0, gSaveContext.linkAge]; - this->waistDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][4]][(void)0, gSaveContext.linkAge]; + this->leftHandDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_LEFT_HAND]] + [(void)0, gSaveContext.linkAge]; + this->rightHandDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_RIGHT_HAND]] + [(void)0, gSaveContext.linkAge]; + this->sheathDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_SHEATH]] + [(void)0, gSaveContext.linkAge]; + this->waistDLists = + &sPlayerDListGroups[gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_WAIST]][(void)0, gSaveContext.linkAge]; Player_SetModelsForHoldingShield(this); } @@ -389,14 +549,14 @@ void Player_SetModels(Player* this, s32 modelGroup) { void Player_SetModelGroup(Player* this, s32 modelGroup) { this->modelGroup = modelGroup; - if (modelGroup == 1) { - this->modelAnimType = 0; + if (modelGroup == PLAYER_MODELGROUP_CHILD_HYLIAN_SHIELD) { + this->modelAnimType = PLAYER_ANIMTYPE_0; } else { - this->modelAnimType = gPlayerModelTypes[modelGroup][0]; + this->modelAnimType = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_ANIM]; } - if ((this->modelAnimType < 3) && (this->currentShield == PLAYER_SHIELD_NONE)) { - this->modelAnimType = 0; + if ((this->modelAnimType < PLAYER_ANIMTYPE_3) && (this->currentShield == PLAYER_SHIELD_NONE)) { + this->modelAnimType = PLAYER_ANIMTYPE_0; } Player_SetModels(this, modelGroup); @@ -519,7 +679,7 @@ s32 Player_HasMirrorShieldEquipped(GlobalContext* globalCtx) { s32 Player_HasMirrorShieldSetToDraw(GlobalContext* globalCtx) { Player* this = GET_PLAYER(globalCtx); - return (this->rightHandType == 10) && (this->currentShield == PLAYER_SHIELD_MIRROR); + return (this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD) && (this->currentShield == PLAYER_SHIELD_MIRROR); } s32 Player_ActionToMagicSpell(Player* this, s32 actionParam) { @@ -694,8 +854,8 @@ Color_RGB8 sGauntletColors[] = { }; Gfx* sBootDListGroups[][2] = { - { gLinkAdultLeftIronBootDL, gLinkAdultRightIronBootDL }, - { gLinkAdultLeftHoverBootDL, gLinkAdultRightHoverBootDL }, + /* PLAYER_BOOTS_IRON */ { gLinkAdultLeftIronBootDL, gLinkAdultRightIronBootDL }, + /* PLAYER_BOOTS_HOVER */ { gLinkAdultLeftHoverBootDL, gLinkAdultRightHoverBootDL }, }; void Player_DrawImpl(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic, @@ -747,10 +907,12 @@ void Player_DrawImpl(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTabl gSPDisplayList(POLY_OPA_DISP++, gLinkAdultLeftGauntletPlate1DL); gSPDisplayList(POLY_OPA_DISP++, gLinkAdultRightGauntletPlate1DL); - gSPDisplayList(POLY_OPA_DISP++, - (D_80160014 == 0) ? gLinkAdultLeftGauntletPlate2DL : gLinkAdultLeftGauntletPlate3DL); - gSPDisplayList(POLY_OPA_DISP++, - (D_80160018 == 8) ? gLinkAdultRightGauntletPlate2DL : gLinkAdultRightGauntletPlate3DL); + gSPDisplayList(POLY_OPA_DISP++, (sLeftHandType == PLAYER_MODELTYPE_LH_OPEN) + ? gLinkAdultLeftGauntletPlate2DL + : gLinkAdultLeftGauntletPlate3DL); + gSPDisplayList(POLY_OPA_DISP++, (sRightHandType == PLAYER_MODELTYPE_RH_OPEN) + ? gLinkAdultRightGauntletPlate2DL + : gLinkAdultRightGauntletPlate3DL); } if (boots != 0) { @@ -881,8 +1043,8 @@ s32 Player_OverrideLimbDrawGameplayCommon(GlobalContext* globalCtx, s32 limbInde Player* this = (Player*)thisx; if (limbIndex == PLAYER_LIMB_ROOT) { - D_80160014 = this->leftHandType; - D_80160018 = this->rightHandType; + sLeftHandType = this->leftHandType; + sRightHandType = this->rightHandType; // `sCurBodyPartPos` is incremented before each usage, so it starts at index -1. // What determines if a limb corresponds to a body part is whether or not it has a non-NULL `dList`. @@ -957,40 +1119,42 @@ s32 Player_OverrideLimbDrawGameplayDefault(GlobalContext* globalCtx, s32 limbInd if (limbIndex == PLAYER_LIMB_L_HAND) { Gfx** dLists = this->leftHandDLists; - if ((D_80160014 == 4) && (gSaveContext.swordHealth <= 0.0f)) { + if ((sLeftHandType == PLAYER_MODELTYPE_LH_BGS) && (gSaveContext.swordHealth <= 0.0f)) { dLists += 4; - } else if ((D_80160014 == 6) && (this->stateFlags1 & PLAYER_STATE1_25)) { + } else if ((sLeftHandType == PLAYER_MODELTYPE_LH_BOOMERANG) && (this->stateFlags1 & PLAYER_STATE1_25)) { dLists = &D_80125E08[gSaveContext.linkAge]; - D_80160014 = 0; - } else if ((this->leftHandType == 0) && (this->actor.speedXZ > 2.0f) && + sLeftHandType = PLAYER_MODELTYPE_LH_OPEN; + } else if ((this->leftHandType == PLAYER_MODELTYPE_LH_OPEN) && (this->actor.speedXZ > 2.0f) && !(this->stateFlags1 & PLAYER_STATE1_27)) { dLists = &D_80125E18[gSaveContext.linkAge]; - D_80160014 = 1; + sLeftHandType = PLAYER_MODELTYPE_LH_CLOSED; } *dList = dLists[sDListsLodOffset]; } else if (limbIndex == PLAYER_LIMB_R_HAND) { Gfx** dLists = this->rightHandDLists; - if (D_80160018 == 10) { + if (sRightHandType == PLAYER_MODELTYPE_RH_SHIELD) { dLists += this->currentShield * 4; - } else if ((this->rightHandType == 8) && (this->actor.speedXZ > 2.0f) && + } else if ((this->rightHandType == PLAYER_MODELTYPE_RH_OPEN) && (this->actor.speedXZ > 2.0f) && !(this->stateFlags1 & PLAYER_STATE1_27)) { dLists = &D_80125E58[gSaveContext.linkAge]; - D_80160018 = 9; + sRightHandType = PLAYER_MODELTYPE_RH_CLOSED; } *dList = dLists[sDListsLodOffset]; } else if (limbIndex == PLAYER_LIMB_SHEATH) { Gfx** dLists = this->sheathDLists; - if ((this->sheathType == 18) || (this->sheathType == 19)) { + if ((this->sheathType == PLAYER_MODELTYPE_SHEATH_18) || (this->sheathType == PLAYER_MODELTYPE_SHEATH_19)) { dLists += this->currentShield * 4; if (!LINK_IS_ADULT && (this->currentShield < PLAYER_SHIELD_HYLIAN) && (gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KOKIRI)) { - dLists += 16; + dLists += PLAYER_SHIELD_MAX * 4; } - } else if (!LINK_IS_ADULT && ((this->sheathType == 16) || (this->sheathType == 17)) && + } else if (!LINK_IS_ADULT && + ((this->sheathType == PLAYER_MODELTYPE_SHEATH_16) || + (this->sheathType == PLAYER_MODELTYPE_SHEATH_17)) && (gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KOKIRI)) { dLists = D_80125D68; } @@ -1298,7 +1462,7 @@ void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx** func_80090A28(this, spE4); func_800906D4(globalCtx, this, spE4); - } else if ((*dList != NULL) && (this->leftHandType == 7)) { + } else if ((*dList != NULL) && (this->leftHandType == PLAYER_MODELTYPE_LH_BOTTLE)) { Color_RGB8* bottleColor = &sBottleColors[Player_ActionToBottle(this, this->itemActionParam)]; OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2710); @@ -1339,9 +1503,10 @@ void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx** } else if (limbIndex == PLAYER_LIMB_R_HAND) { Actor* heldActor = this->heldActor; - if (this->rightHandType == 0xFF) { + if (this->rightHandType == PLAYER_MODELTYPE_RH_FF) { Matrix_Get(&this->shieldMf); - } else if ((this->rightHandType == 11) || (this->rightHandType == 12)) { + } else if ((this->rightHandType == PLAYER_MODELTYPE_RH_BOW_SLINGSHOT) || + (this->rightHandType == PLAYER_MODELTYPE_12)) { BowStringData* stringData = &sBowStringData[gSaveContext.linkAge]; OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2783); @@ -1382,7 +1547,7 @@ void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx** Matrix_Pop(); CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2809); - } else if ((this->actor.scale.y >= 0.0f) && (this->rightHandType == 10)) { + } else if ((this->actor.scale.y >= 0.0f) && (this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD)) { Matrix_Get(&this->shieldMf); func_80090604(globalCtx, this, &this->shieldQuad, D_80126154); } @@ -1427,7 +1592,8 @@ void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx** } } else if (this->actor.scale.y >= 0.0f) { if (limbIndex == PLAYER_LIMB_SHEATH) { - if ((this->rightHandType != 10) && (this->rightHandType != 0xFF)) { + if ((this->rightHandType != PLAYER_MODELTYPE_RH_SHIELD) && + (this->rightHandType != PLAYER_MODELTYPE_RH_FF)) { if (Player_IsChildWithHylianShield(this)) { func_80090604(globalCtx, this, &this->shieldQuad, D_8012619C); } @@ -1471,39 +1637,42 @@ u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime) { sizeof(Vec3s[PLAYER_LIMB_BUF_COUNT]); } -u8 D_801261F8[] = { 2, 2, 5 }; +u8 D_801261F8[] = { PLAYER_MODELGROUP_SWORD, PLAYER_MODELGROUP_SWORD, PLAYER_MODELGROUP_BGS }; s32 Player_OverrideLimbDrawPause(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* arg) { - u8* ptr = arg; - u8 modelGroup = D_801261F8[ptr[0] - 1]; + u8* playerSwordAndShield = arg; + //! @bug `playerSwordAndShield[0]` can be 0 (no sword), which indexes `D_801261F8[-1]`. The result + //! happens to be 0 (`PLAYER_MODELGROUP_0`) in vanilla, but weird values are likely to cause a crash + u8 modelGroup = D_801261F8[playerSwordAndShield[0] - 1]; s32 type; s32 dListOffset = 0; Gfx** dLists; - if ((modelGroup == 2) && !LINK_IS_ADULT && (ptr[1] == 2)) { - modelGroup = 1; + if ((modelGroup == PLAYER_MODELGROUP_SWORD) && !LINK_IS_ADULT && + (playerSwordAndShield[1] == PLAYER_SHIELD_HYLIAN)) { + modelGroup = PLAYER_MODELGROUP_CHILD_HYLIAN_SHIELD; } if (limbIndex == PLAYER_LIMB_L_HAND) { - type = gPlayerModelTypes[modelGroup][1]; - D_80160014 = type; - if ((type == 4) && (gSaveContext.swordHealth <= 0.0f)) { + type = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_LEFT_HAND]; + sLeftHandType = type; + if ((type == PLAYER_MODELTYPE_LH_BGS) && (gSaveContext.swordHealth <= 0.0f)) { dListOffset = 4; } } else if (limbIndex == PLAYER_LIMB_R_HAND) { - type = gPlayerModelTypes[modelGroup][2]; - D_80160018 = type; - if (type == 10) { - dListOffset = ptr[1] * 4; + type = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_RIGHT_HAND]; + sRightHandType = type; + if (type == PLAYER_MODELTYPE_RH_SHIELD) { + dListOffset = playerSwordAndShield[1] * 4; } } else if (limbIndex == PLAYER_LIMB_SHEATH) { - type = gPlayerModelTypes[modelGroup][3]; - if ((type == 18) || (type == 19)) { - dListOffset = ptr[1] * 4; + type = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_SHEATH]; + if ((type == PLAYER_MODELTYPE_SHEATH_18) || (type == PLAYER_MODELTYPE_SHEATH_19)) { + dListOffset = playerSwordAndShield[1] * 4; } } else if (limbIndex == PLAYER_LIMB_WAIST) { - type = gPlayerModelTypes[modelGroup][4]; + type = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_WAIST]; } else { return 0; } @@ -1522,7 +1691,7 @@ void Player_DrawPauseImpl(GlobalContext* globalCtx, void* gameplayKeep, void* li (PAUSE_EQUIP_PLAYER_WIDTH / 2) << 2, (PAUSE_EQUIP_PLAYER_HEIGHT / 2) << 2, G_MAXZ / 2, 0 }; static Lights1 lights1 = gdSPDefLights1(80, 80, 80, 255, 255, 255, 84, 84, 172); static Vec3f lightDir = { 89.8f, 0.0f, 89.8f }; - u8 sp12C[2]; + u8 playerSwordAndShield[2]; Gfx* opaRef; Gfx* xluRef; u16 perspNorm; @@ -1588,8 +1757,8 @@ void Player_DrawPauseImpl(GlobalContext* globalCtx, void* gameplayKeep, void* li gSPMatrix(POLY_OPA_DISP++, lookAtMtx, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION); - sp12C[0] = sword; - sp12C[1] = shield; + playerSwordAndShield[0] = sword; + playerSwordAndShield[1] = shield; Matrix_SetTranslateRotateYXZ(pos->x, pos->y, pos->z, rot); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); @@ -1608,7 +1777,7 @@ void Player_DrawPauseImpl(GlobalContext* globalCtx, void* gameplayKeep, void* li gSPSegment(POLY_OPA_DISP++, 0x0C, gCullBackDList); Player_DrawImpl(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, tunic, boots, 0, - Player_OverrideLimbDrawPause, NULL, &sp12C); + Player_OverrideLimbDrawPause, NULL, &playerSwordAndShield); gSPEndDisplayList(POLY_OPA_DISP++); gSPEndDisplayList(POLY_XLU_DISP++); diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index b9c5a17a90..c44b505d10 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -305,7 +305,7 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) { f32 sp5C; f32 sp58; - if ((player->actor.draw != NULL) && (player->rightHandType == 15)) { + if ((player->actor.draw != NULL) && (player->rightHandType == PLAYER_MODELTYPE_RH_HOOKSHOT)) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_arms_hook.c", 850); if ((ArmsHook_Shoot != this->actionFunc) || (this->timer <= 0)) { diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index 22d87d12a0..1ab893127f 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -97,7 +97,7 @@ void EnTorch2_Init(Actor* thisx, GlobalContext* globalCtx2) { sInput.cur.stick_x = sInput.cur.stick_y = 0; this->currentShield = PLAYER_SHIELD_HYLIAN; this->heldItemActionParam = this->heldItemId = PLAYER_AP_SWORD_MASTER; - Player_SetModelGroup(this, 2); + Player_SetModelGroup(this, PLAYER_MODELGROUP_SWORD); globalCtx->playerInit(this, globalCtx, &gDarkLinkSkel); this->actor.naviEnemyId = 0x26; this->cylinder.base.acFlags = AC_ON | AC_TYPE_PLAYER; diff --git a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c index d753dfcc27..111047a9c4 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c @@ -545,7 +545,7 @@ void EnZl2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve { Player* player = GET_PLAYER(globalCtx); Matrix_Push(); - if (player->rightHandType == 0xFF) { + if (player->rightHandType == PLAYER_MODELTYPE_RH_FF) { Matrix_Put(&player->shieldMf); Matrix_Translate(180.0f, 979.0f, -375.0f, MTXMODE_APPLY); Matrix_RotateZYX(-0x5DE7, -0x53E9, 0x3333, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index df28236a5c..0a9f630cf3 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -622,229 +622,324 @@ static GetItemEntry sGetItemTable[] = { GET_ITEM_NONE, }; -static LinkAnimationHeader* D_80853914[] = { - &gPlayerAnim_003240, &gPlayerAnim_003238, &gPlayerAnim_003238, - &gPlayerAnim_002BE0, &gPlayerAnim_003240, &gPlayerAnim_003240, -}; +#define GET_PLAYER_ANIM(group, type) D_80853914[group * PLAYER_ANIMTYPE_MAX + type] -static LinkAnimationHeader* D_8085392C[] = { - &gPlayerAnim_003290, &gPlayerAnim_003268, &gPlayerAnim_003268, - &gPlayerAnim_002BF8, &gPlayerAnim_003290, &gPlayerAnim_003290, -}; - -static LinkAnimationHeader* D_80853944[] = { - &gPlayerAnim_003140, &gPlayerAnim_002B38, &gPlayerAnim_003138, - &gPlayerAnim_002B40, &gPlayerAnim_003140, &gPlayerAnim_003140, -}; - -static LinkAnimationHeader* D_8085395C[] = { - &gPlayerAnim_002E98, &gPlayerAnim_0029E8, &gPlayerAnim_002E98, - &gPlayerAnim_0029F0, &gPlayerAnim_002E98, &gPlayerAnim_002E98, -}; - -static LinkAnimationHeader* D_80853974[] = { - &gPlayerAnim_002FB0, &gPlayerAnim_002FA8, &gPlayerAnim_002FB0, - &gPlayerAnim_002A40, &gPlayerAnim_002FB0, &gPlayerAnim_002FB0, -}; - -static LinkAnimationHeader* D_8085398C[] = { - &gPlayerAnim_003220, &gPlayerAnim_002590, &gPlayerAnim_002590, - &gPlayerAnim_002BC0, &gPlayerAnim_003220, &gPlayerAnim_003220, -}; - -static LinkAnimationHeader* D_808539A4[] = { - &gPlayerAnim_003230, &gPlayerAnim_0025D0, &gPlayerAnim_0025D0, - &gPlayerAnim_002BD0, &gPlayerAnim_003230, &gPlayerAnim_003230, -}; - -static LinkAnimationHeader* D_808539BC[] = { - &gPlayerAnim_002BB0, &gPlayerAnim_0031F8, &gPlayerAnim_0031F8, - &gPlayerAnim_002BB0, &gPlayerAnim_002BB0, &gPlayerAnim_002BB0, -}; - -static LinkAnimationHeader* D_808539D4[] = { - &gPlayerAnim_003088, &gPlayerAnim_002A70, &gPlayerAnim_002A70, - &gPlayerAnim_003088, &gPlayerAnim_003088, &gPlayerAnim_003088, -}; - -static LinkAnimationHeader* D_808539EC[] = { - &gPlayerAnim_002750, &gPlayerAnim_002748, &gPlayerAnim_002748, - &gPlayerAnim_002750, &gPlayerAnim_002750, &gPlayerAnim_002750, -}; - -static LinkAnimationHeader* D_80853A04[] = { - &gPlayerAnim_002330, &gPlayerAnim_002330, &gPlayerAnim_002330, - &gPlayerAnim_002330, &gPlayerAnim_002330, &gPlayerAnim_002330, -}; - -static LinkAnimationHeader* D_80853A1C[] = { - &gPlayerAnim_002760, &gPlayerAnim_002758, &gPlayerAnim_002758, - &gPlayerAnim_002760, &gPlayerAnim_002760, &gPlayerAnim_002760, -}; - -static LinkAnimationHeader* D_80853A34[] = { - &gPlayerAnim_002338, &gPlayerAnim_002338, &gPlayerAnim_002338, - &gPlayerAnim_002338, &gPlayerAnim_002338, &gPlayerAnim_002338, -}; - -static LinkAnimationHeader* D_80853A4C[] = { - &gPlayerAnim_002E08, &gPlayerAnim_002E00, &gPlayerAnim_002E00, - &gPlayerAnim_002E08, &gPlayerAnim_002E08, &gPlayerAnim_002E08, -}; - -static LinkAnimationHeader* D_80853A64[] = { - &gPlayerAnim_003028, &gPlayerAnim_003020, &gPlayerAnim_003020, - &gPlayerAnim_003028, &gPlayerAnim_003028, &gPlayerAnim_003028, -}; - -static LinkAnimationHeader* D_80853A7C[] = { - &gPlayerAnim_003170, &gPlayerAnim_003168, &gPlayerAnim_003168, - &gPlayerAnim_003170, &gPlayerAnim_003170, &gPlayerAnim_003170, -}; - -static LinkAnimationHeader* D_80853A94[] = { - &gPlayerAnim_003038, &gPlayerAnim_003030, &gPlayerAnim_003030, - &gPlayerAnim_002A68, &gPlayerAnim_003038, &gPlayerAnim_003038, -}; - -static LinkAnimationHeader* D_80853AAC[] = { - &gPlayerAnim_002FC0, &gPlayerAnim_002FB8, &gPlayerAnim_002FB8, - &gPlayerAnim_002FC8, &gPlayerAnim_002FC0, &gPlayerAnim_002FC0, -}; - -static LinkAnimationHeader* D_80853AC4[] = { - &gPlayerAnim_003278, &gPlayerAnim_003270, &gPlayerAnim_003270, - &gPlayerAnim_002BE8, &gPlayerAnim_003278, &gPlayerAnim_003278, -}; - -static LinkAnimationHeader* D_80853ADC[] = { - &gPlayerAnim_003288, &gPlayerAnim_003280, &gPlayerAnim_003280, - &gPlayerAnim_002BF0, &gPlayerAnim_003288, &gPlayerAnim_003288, -}; - -static LinkAnimationHeader* D_80853AF4[] = { - &gPlayerAnim_002EB8, &gPlayerAnim_002EA0, &gPlayerAnim_002EA0, - &gPlayerAnim_002EB8, &gPlayerAnim_0026C8, &gPlayerAnim_002EB8, -}; - -static LinkAnimationHeader* D_80853B0C[] = { - &gPlayerAnim_002ED8, &gPlayerAnim_002ED0, &gPlayerAnim_002ED0, - &gPlayerAnim_002ED8, &gPlayerAnim_0026D0, &gPlayerAnim_002ED8, -}; - -static LinkAnimationHeader* D_80853B24[] = { - &gPlayerAnim_002EB0, &gPlayerAnim_002EA8, &gPlayerAnim_002EA8, - &gPlayerAnim_002EB0, &gPlayerAnim_002EB0, &gPlayerAnim_002EB0, -}; - -static LinkAnimationHeader* D_80853B3C[] = { - &gPlayerAnim_003190, &gPlayerAnim_003188, &gPlayerAnim_003188, - &gPlayerAnim_002B68, &gPlayerAnim_003190, &gPlayerAnim_003190, -}; - -static LinkAnimationHeader* D_80853B54[] = { - &gPlayerAnim_003178, &gPlayerAnim_002568, &gPlayerAnim_002568, - &gPlayerAnim_002B58, &gPlayerAnim_003178, &gPlayerAnim_003178, -}; - -static LinkAnimationHeader* D_80853B6C[] = { - &gPlayerAnim_003180, &gPlayerAnim_002570, &gPlayerAnim_002570, - &gPlayerAnim_002B60, &gPlayerAnim_003180, &gPlayerAnim_003180, -}; - -static LinkAnimationHeader* D_80853B84[] = { - &gPlayerAnim_002D60, &gPlayerAnim_002D58, &gPlayerAnim_002D58, - &gPlayerAnim_002D60, &gPlayerAnim_002D60, &gPlayerAnim_002D60, -}; - -static LinkAnimationHeader* D_80853B9C[] = { - &gPlayerAnim_002BB8, &gPlayerAnim_003218, &gPlayerAnim_003218, - &gPlayerAnim_002BB8, &gPlayerAnim_002BB8, &gPlayerAnim_002BB8, -}; - -static LinkAnimationHeader* D_80853BB4[] = { - &gPlayerAnim_002BC8, &gPlayerAnim_003228, &gPlayerAnim_003228, - &gPlayerAnim_002BC8, &gPlayerAnim_002BC8, &gPlayerAnim_002BC8, -}; - -static LinkAnimationHeader* D_80853BCC[] = { - &gPlayerAnim_0031C8, &gPlayerAnim_0031C0, &gPlayerAnim_0031C0, - &gPlayerAnim_0031C8, &gPlayerAnim_0031C8, &gPlayerAnim_0031C8, -}; - -static LinkAnimationHeader* D_80853BE4[] = { - &gPlayerAnim_003118, &gPlayerAnim_003110, &gPlayerAnim_003110, - &gPlayerAnim_003118, &gPlayerAnim_003118, &gPlayerAnim_003118, -}; - -static LinkAnimationHeader* D_80853BFC[] = { - &gPlayerAnim_002DE8, &gPlayerAnim_002DE8, &gPlayerAnim_002DE8, - &gPlayerAnim_002DE8, &gPlayerAnim_002DE8, &gPlayerAnim_002DE8, -}; - -static LinkAnimationHeader* D_80853C14[] = { - &gPlayerAnim_002E30, &gPlayerAnim_002E18, &gPlayerAnim_002E18, - &gPlayerAnim_002E30, &gPlayerAnim_002E30, &gPlayerAnim_002E30, -}; - -static LinkAnimationHeader* D_80853C2C[] = { - &gPlayerAnim_002E40, &gPlayerAnim_002E38, &gPlayerAnim_002E38, - &gPlayerAnim_002E40, &gPlayerAnim_002E40, &gPlayerAnim_002E40, -}; - -static LinkAnimationHeader* D_80853C44[] = { - &gPlayerAnim_002E28, &gPlayerAnim_002E20, &gPlayerAnim_002E20, - &gPlayerAnim_002E28, &gPlayerAnim_002E28, &gPlayerAnim_002E28, -}; - -static LinkAnimationHeader* D_80853C5C[] = { - &gPlayerAnim_0030C8, &gPlayerAnim_0030C0, &gPlayerAnim_0030C0, - &gPlayerAnim_0030C8, &gPlayerAnim_0030C8, &gPlayerAnim_0030C8, -}; - -static LinkAnimationHeader* D_80853C74[] = { - &gPlayerAnim_0030D8, &gPlayerAnim_0030D0, &gPlayerAnim_0030D0, - &gPlayerAnim_0030D8, &gPlayerAnim_0030D8, &gPlayerAnim_0030D8, -}; - -static LinkAnimationHeader* D_80853C8C[] = { - &gPlayerAnim_0030B8, &gPlayerAnim_0030B0, &gPlayerAnim_0030B0, - &gPlayerAnim_0030B8, &gPlayerAnim_0030B8, &gPlayerAnim_0030B8, -}; - -static LinkAnimationHeader* D_80853CA4[] = { - &gPlayerAnim_002F20, &gPlayerAnim_002F18, &gPlayerAnim_002F18, - &gPlayerAnim_002F20, &gPlayerAnim_002F20, &gPlayerAnim_002F20, -}; - -static LinkAnimationHeader* D_80853CBC[] = { - &gPlayerAnim_002FF0, &gPlayerAnim_002FE8, &gPlayerAnim_002FE8, - &gPlayerAnim_002FF0, &gPlayerAnim_002FF0, &gPlayerAnim_002FF0, -}; - -static LinkAnimationHeader* D_80853CD4[] = { - &gPlayerAnim_003010, &gPlayerAnim_003008, &gPlayerAnim_003008, - &gPlayerAnim_003010, &gPlayerAnim_003010, &gPlayerAnim_003010, -}; - -static LinkAnimationHeader* D_80853CEC[] = { - &gPlayerAnim_003000, &gPlayerAnim_002FF8, &gPlayerAnim_002FF8, - &gPlayerAnim_003000, &gPlayerAnim_003000, &gPlayerAnim_003000, -}; - -static LinkAnimationHeader* D_80853D04[] = { - &gPlayerAnim_002EF0, &gPlayerAnim_002EE8, &gPlayerAnim_002EE8, - &gPlayerAnim_002EF8, &gPlayerAnim_002EF0, &gPlayerAnim_002EF0, -}; - -static LinkAnimationHeader* D_80853D1C[] = { - &gPlayerAnim_0031E0, &gPlayerAnim_0031D8, &gPlayerAnim_0031D8, - &gPlayerAnim_0031E8, &gPlayerAnim_0031E0, &gPlayerAnim_0031E0, -}; - -static LinkAnimationHeader* D_80853D34[] = { - &gPlayerAnim_003468, &gPlayerAnim_003438, &gPlayerAnim_003438, - &gPlayerAnim_003468, &gPlayerAnim_003468, &gPlayerAnim_003468, +static LinkAnimationHeader* D_80853914[PLAYER_ANIMGROUP_MAX * PLAYER_ANIMTYPE_MAX] = { + /* PLAYER_ANIMGROUP_0 */ + &gPlayerAnim_003240, + &gPlayerAnim_003238, + &gPlayerAnim_003238, + &gPlayerAnim_002BE0, + &gPlayerAnim_003240, + &gPlayerAnim_003240, + /* PLAYER_ANIMGROUP_1 */ + &gPlayerAnim_003290, + &gPlayerAnim_003268, + &gPlayerAnim_003268, + &gPlayerAnim_002BF8, + &gPlayerAnim_003290, + &gPlayerAnim_003290, + /* PLAYER_ANIMGROUP_2 */ + &gPlayerAnim_003140, + &gPlayerAnim_002B38, + &gPlayerAnim_003138, + &gPlayerAnim_002B40, + &gPlayerAnim_003140, + &gPlayerAnim_003140, + /* PLAYER_ANIMGROUP_3 */ + &gPlayerAnim_002E98, + &gPlayerAnim_0029E8, + &gPlayerAnim_002E98, + &gPlayerAnim_0029F0, + &gPlayerAnim_002E98, + &gPlayerAnim_002E98, + /* PLAYER_ANIMGROUP_4 */ + &gPlayerAnim_002FB0, + &gPlayerAnim_002FA8, + &gPlayerAnim_002FB0, + &gPlayerAnim_002A40, + &gPlayerAnim_002FB0, + &gPlayerAnim_002FB0, + /* PLAYER_ANIMGROUP_5 */ + &gPlayerAnim_003220, + &gPlayerAnim_002590, + &gPlayerAnim_002590, + &gPlayerAnim_002BC0, + &gPlayerAnim_003220, + &gPlayerAnim_003220, + /* PLAYER_ANIMGROUP_6 */ + &gPlayerAnim_003230, + &gPlayerAnim_0025D0, + &gPlayerAnim_0025D0, + &gPlayerAnim_002BD0, + &gPlayerAnim_003230, + &gPlayerAnim_003230, + /* PLAYER_ANIMGROUP_7 */ + &gPlayerAnim_002BB0, + &gPlayerAnim_0031F8, + &gPlayerAnim_0031F8, + &gPlayerAnim_002BB0, + &gPlayerAnim_002BB0, + &gPlayerAnim_002BB0, + /* PLAYER_ANIMGROUP_8 */ + &gPlayerAnim_003088, + &gPlayerAnim_002A70, + &gPlayerAnim_002A70, + &gPlayerAnim_003088, + &gPlayerAnim_003088, + &gPlayerAnim_003088, + /* PLAYER_ANIMGROUP_9 */ + &gPlayerAnim_002750, + &gPlayerAnim_002748, + &gPlayerAnim_002748, + &gPlayerAnim_002750, + &gPlayerAnim_002750, + &gPlayerAnim_002750, + /* PLAYER_ANIMGROUP_10 */ + &gPlayerAnim_002330, + &gPlayerAnim_002330, + &gPlayerAnim_002330, + &gPlayerAnim_002330, + &gPlayerAnim_002330, + &gPlayerAnim_002330, + /* PLAYER_ANIMGROUP_11 */ + &gPlayerAnim_002760, + &gPlayerAnim_002758, + &gPlayerAnim_002758, + &gPlayerAnim_002760, + &gPlayerAnim_002760, + &gPlayerAnim_002760, + /* PLAYER_ANIMGROUP_12 */ + &gPlayerAnim_002338, + &gPlayerAnim_002338, + &gPlayerAnim_002338, + &gPlayerAnim_002338, + &gPlayerAnim_002338, + &gPlayerAnim_002338, + /* PLAYER_ANIMGROUP_13 */ + &gPlayerAnim_002E08, + &gPlayerAnim_002E00, + &gPlayerAnim_002E00, + &gPlayerAnim_002E08, + &gPlayerAnim_002E08, + &gPlayerAnim_002E08, + /* PLAYER_ANIMGROUP_14 */ + &gPlayerAnim_003028, + &gPlayerAnim_003020, + &gPlayerAnim_003020, + &gPlayerAnim_003028, + &gPlayerAnim_003028, + &gPlayerAnim_003028, + /* PLAYER_ANIMGROUP_15 */ + &gPlayerAnim_003170, + &gPlayerAnim_003168, + &gPlayerAnim_003168, + &gPlayerAnim_003170, + &gPlayerAnim_003170, + &gPlayerAnim_003170, + /* PLAYER_ANIMGROUP_16 */ + &gPlayerAnim_003038, + &gPlayerAnim_003030, + &gPlayerAnim_003030, + &gPlayerAnim_002A68, + &gPlayerAnim_003038, + &gPlayerAnim_003038, + /* PLAYER_ANIMGROUP_17 */ + &gPlayerAnim_002FC0, + &gPlayerAnim_002FB8, + &gPlayerAnim_002FB8, + &gPlayerAnim_002FC8, + &gPlayerAnim_002FC0, + &gPlayerAnim_002FC0, + /* PLAYER_ANIMGROUP_18 */ + &gPlayerAnim_003278, + &gPlayerAnim_003270, + &gPlayerAnim_003270, + &gPlayerAnim_002BE8, + &gPlayerAnim_003278, + &gPlayerAnim_003278, + /* PLAYER_ANIMGROUP_19 */ + &gPlayerAnim_003288, + &gPlayerAnim_003280, + &gPlayerAnim_003280, + &gPlayerAnim_002BF0, + &gPlayerAnim_003288, + &gPlayerAnim_003288, + /* PLAYER_ANIMGROUP_20 */ + &gPlayerAnim_002EB8, + &gPlayerAnim_002EA0, + &gPlayerAnim_002EA0, + &gPlayerAnim_002EB8, + &gPlayerAnim_0026C8, + &gPlayerAnim_002EB8, + /* PLAYER_ANIMGROUP_21 */ + &gPlayerAnim_002ED8, + &gPlayerAnim_002ED0, + &gPlayerAnim_002ED0, + &gPlayerAnim_002ED8, + &gPlayerAnim_0026D0, + &gPlayerAnim_002ED8, + /* PLAYER_ANIMGROUP_22 */ + &gPlayerAnim_002EB0, + &gPlayerAnim_002EA8, + &gPlayerAnim_002EA8, + &gPlayerAnim_002EB0, + &gPlayerAnim_002EB0, + &gPlayerAnim_002EB0, + /* PLAYER_ANIMGROUP_23 */ + &gPlayerAnim_003190, + &gPlayerAnim_003188, + &gPlayerAnim_003188, + &gPlayerAnim_002B68, + &gPlayerAnim_003190, + &gPlayerAnim_003190, + /* PLAYER_ANIMGROUP_24 */ + &gPlayerAnim_003178, + &gPlayerAnim_002568, + &gPlayerAnim_002568, + &gPlayerAnim_002B58, + &gPlayerAnim_003178, + &gPlayerAnim_003178, + /* PLAYER_ANIMGROUP_25 */ + &gPlayerAnim_003180, + &gPlayerAnim_002570, + &gPlayerAnim_002570, + &gPlayerAnim_002B60, + &gPlayerAnim_003180, + &gPlayerAnim_003180, + /* PLAYER_ANIMGROUP_26 */ + &gPlayerAnim_002D60, + &gPlayerAnim_002D58, + &gPlayerAnim_002D58, + &gPlayerAnim_002D60, + &gPlayerAnim_002D60, + &gPlayerAnim_002D60, + /* PLAYER_ANIMGROUP_27 */ + &gPlayerAnim_002BB8, + &gPlayerAnim_003218, + &gPlayerAnim_003218, + &gPlayerAnim_002BB8, + &gPlayerAnim_002BB8, + &gPlayerAnim_002BB8, + /* PLAYER_ANIMGROUP_28 */ + &gPlayerAnim_002BC8, + &gPlayerAnim_003228, + &gPlayerAnim_003228, + &gPlayerAnim_002BC8, + &gPlayerAnim_002BC8, + &gPlayerAnim_002BC8, + /* PLAYER_ANIMGROUP_29 */ + &gPlayerAnim_0031C8, + &gPlayerAnim_0031C0, + &gPlayerAnim_0031C0, + &gPlayerAnim_0031C8, + &gPlayerAnim_0031C8, + &gPlayerAnim_0031C8, + /* PLAYER_ANIMGROUP_30 */ + &gPlayerAnim_003118, + &gPlayerAnim_003110, + &gPlayerAnim_003110, + &gPlayerAnim_003118, + &gPlayerAnim_003118, + &gPlayerAnim_003118, + /* PLAYER_ANIMGROUP_31 */ + &gPlayerAnim_002DE8, + &gPlayerAnim_002DE8, + &gPlayerAnim_002DE8, + &gPlayerAnim_002DE8, + &gPlayerAnim_002DE8, + &gPlayerAnim_002DE8, + /* PLAYER_ANIMGROUP_32 */ + &gPlayerAnim_002E30, + &gPlayerAnim_002E18, + &gPlayerAnim_002E18, + &gPlayerAnim_002E30, + &gPlayerAnim_002E30, + &gPlayerAnim_002E30, + /* PLAYER_ANIMGROUP_33 */ + &gPlayerAnim_002E40, + &gPlayerAnim_002E38, + &gPlayerAnim_002E38, + &gPlayerAnim_002E40, + &gPlayerAnim_002E40, + &gPlayerAnim_002E40, + /* PLAYER_ANIMGROUP_34 */ + &gPlayerAnim_002E28, + &gPlayerAnim_002E20, + &gPlayerAnim_002E20, + &gPlayerAnim_002E28, + &gPlayerAnim_002E28, + &gPlayerAnim_002E28, + /* PLAYER_ANIMGROUP_35 */ + &gPlayerAnim_0030C8, + &gPlayerAnim_0030C0, + &gPlayerAnim_0030C0, + &gPlayerAnim_0030C8, + &gPlayerAnim_0030C8, + &gPlayerAnim_0030C8, + /* PLAYER_ANIMGROUP_36 */ + &gPlayerAnim_0030D8, + &gPlayerAnim_0030D0, + &gPlayerAnim_0030D0, + &gPlayerAnim_0030D8, + &gPlayerAnim_0030D8, + &gPlayerAnim_0030D8, + /* PLAYER_ANIMGROUP_37 */ + &gPlayerAnim_0030B8, + &gPlayerAnim_0030B0, + &gPlayerAnim_0030B0, + &gPlayerAnim_0030B8, + &gPlayerAnim_0030B8, + &gPlayerAnim_0030B8, + /* PLAYER_ANIMGROUP_38 */ + &gPlayerAnim_002F20, + &gPlayerAnim_002F18, + &gPlayerAnim_002F18, + &gPlayerAnim_002F20, + &gPlayerAnim_002F20, + &gPlayerAnim_002F20, + /* PLAYER_ANIMGROUP_39 */ + &gPlayerAnim_002FF0, + &gPlayerAnim_002FE8, + &gPlayerAnim_002FE8, + &gPlayerAnim_002FF0, + &gPlayerAnim_002FF0, + &gPlayerAnim_002FF0, + /* PLAYER_ANIMGROUP_40 */ + &gPlayerAnim_003010, + &gPlayerAnim_003008, + &gPlayerAnim_003008, + &gPlayerAnim_003010, + &gPlayerAnim_003010, + &gPlayerAnim_003010, + /* PLAYER_ANIMGROUP_41 */ + &gPlayerAnim_003000, + &gPlayerAnim_002FF8, + &gPlayerAnim_002FF8, + &gPlayerAnim_003000, + &gPlayerAnim_003000, + &gPlayerAnim_003000, + /* PLAYER_ANIMGROUP_42 */ + &gPlayerAnim_002EF0, + &gPlayerAnim_002EE8, + &gPlayerAnim_002EE8, + &gPlayerAnim_002EF8, + &gPlayerAnim_002EF0, + &gPlayerAnim_002EF0, + /* PLAYER_ANIMGROUP_43 */ + &gPlayerAnim_0031E0, + &gPlayerAnim_0031D8, + &gPlayerAnim_0031D8, + &gPlayerAnim_0031E8, + &gPlayerAnim_0031E0, + &gPlayerAnim_0031E0, + /* PLAYER_ANIMGROUP_44 */ + &gPlayerAnim_003468, + &gPlayerAnim_003438, + &gPlayerAnim_003438, + &gPlayerAnim_003468, + &gPlayerAnim_003468, + &gPlayerAnim_003468, }; static LinkAnimationHeader* D_80853D4C[][3] = { @@ -1012,16 +1107,54 @@ static void (*D_80853FE8[])(GlobalContext* globalCtx, Player* this) = { func_80833770, func_80833770, func_80833770, func_80833770, }; -static struct_808540F4 D_808540F4[] = { - { &gPlayerAnim_002F50, 12 }, { &gPlayerAnim_003080, 6 }, { &gPlayerAnim_002C68, 8 }, { &gPlayerAnim_003090, 8 }, - { &gPlayerAnim_002A20, 8 }, { &gPlayerAnim_002F30, 10 }, { &gPlayerAnim_002C58, 7 }, { &gPlayerAnim_002C60, 11 }, - { &gPlayerAnim_002F50, 12 }, { &gPlayerAnim_003078, 4 }, { &gPlayerAnim_003058, 4 }, { &gPlayerAnim_002F38, 4 }, - { &gPlayerAnim_0024E0, 5 }, { &gPlayerAnim_002F48, 13 }, +typedef enum { + /* 0 */ PLAYER_D_808540F4_0, + /* 1 */ PLAYER_D_808540F4_1, + /* 2 */ PLAYER_D_808540F4_2, + /* 3 */ PLAYER_D_808540F4_3, + /* 4 */ PLAYER_D_808540F4_4, + /* 5 */ PLAYER_D_808540F4_5, + /* 6 */ PLAYER_D_808540F4_6, + /* 7 */ PLAYER_D_808540F4_7, + /* 8 */ PLAYER_D_808540F4_8, + /* 9 */ PLAYER_D_808540F4_9, + /* 10 */ PLAYER_D_808540F4_10, + /* 11 */ PLAYER_D_808540F4_11, + /* 12 */ PLAYER_D_808540F4_12, + /* 13 */ PLAYER_D_808540F4_13, + /* 14 */ PLAYER_D_808540F4_MAX +} PlayerD_808540F4Index; + +static struct_808540F4 D_808540F4[PLAYER_D_808540F4_MAX] = { + /* PLAYER_D_808540F4_0 */ { &gPlayerAnim_002F50, 12 }, + /* PLAYER_D_808540F4_1 */ { &gPlayerAnim_003080, 6 }, + /* PLAYER_D_808540F4_2 */ { &gPlayerAnim_002C68, 8 }, + /* PLAYER_D_808540F4_3 */ { &gPlayerAnim_003090, 8 }, + /* PLAYER_D_808540F4_4 */ { &gPlayerAnim_002A20, 8 }, + /* PLAYER_D_808540F4_5 */ { &gPlayerAnim_002F30, 10 }, + /* PLAYER_D_808540F4_6 */ { &gPlayerAnim_002C58, 7 }, + /* PLAYER_D_808540F4_7 */ { &gPlayerAnim_002C60, 11 }, + /* PLAYER_D_808540F4_8 */ { &gPlayerAnim_002F50, 12 }, + /* PLAYER_D_808540F4_9 */ { &gPlayerAnim_003078, 4 }, + /* PLAYER_D_808540F4_10 */ { &gPlayerAnim_003058, 4 }, + /* PLAYER_D_808540F4_11 */ { &gPlayerAnim_002F38, 4 }, + /* PLAYER_D_808540F4_12 */ { &gPlayerAnim_0024E0, 5 }, + /* PLAYER_D_808540F4_13 */ { &gPlayerAnim_002F48, 13 }, }; -static s8 D_80854164[][6] = { - { 8, -5, -3, -6, 8, 11 }, { 5, 0, -1, 4, 5, 9 }, { 3, 1, 0, 2, 3, 9 }, - { 6, -4, -2, 7, 6, 10 }, { 8, -5, -3, -6, 8, 11 }, { 8, -5, -3, -6, 8, 11 }, +static s8 D_80854164[PLAYER_ANIMTYPE_MAX][PLAYER_ANIMTYPE_MAX] = { + { PLAYER_D_808540F4_8, -PLAYER_D_808540F4_5, -PLAYER_D_808540F4_3, -PLAYER_D_808540F4_6, PLAYER_D_808540F4_8, + PLAYER_D_808540F4_11 }, + { PLAYER_D_808540F4_5, PLAYER_D_808540F4_0, -PLAYER_D_808540F4_1, PLAYER_D_808540F4_4, PLAYER_D_808540F4_5, + PLAYER_D_808540F4_9 }, + { PLAYER_D_808540F4_3, PLAYER_D_808540F4_1, PLAYER_D_808540F4_0, PLAYER_D_808540F4_2, PLAYER_D_808540F4_3, + PLAYER_D_808540F4_9 }, + { PLAYER_D_808540F4_6, -PLAYER_D_808540F4_4, -PLAYER_D_808540F4_2, PLAYER_D_808540F4_7, PLAYER_D_808540F4_6, + PLAYER_D_808540F4_10 }, + { PLAYER_D_808540F4_8, -PLAYER_D_808540F4_5, -PLAYER_D_808540F4_3, -PLAYER_D_808540F4_6, PLAYER_D_808540F4_8, + PLAYER_D_808540F4_11 }, + { PLAYER_D_808540F4_8, -PLAYER_D_808540F4_5, -PLAYER_D_808540F4_3, -PLAYER_D_808540F4_6, PLAYER_D_808540F4_8, + PLAYER_D_808540F4_11 }, }; static ExplosiveInfo sExplosiveInfos[] = { @@ -1598,7 +1731,7 @@ void func_808332F4(Player* this, GlobalContext* globalCtx) { } static LinkAnimationHeader* func_80833338(Player* this) { - return D_80853914[this->modelAnimType]; + return GET_PLAYER_ANIM(PLAYER_ANIMGROUP_0, this->modelAnimType); } s32 func_80833350(Player* this) { @@ -1625,12 +1758,12 @@ void func_808333FC(Player* this, s32 arg1) { LinkAnimationHeader* func_80833438(Player* this) { if (this->unk_890 != 0) { - return D_8085395C[this->modelAnimType]; + return GET_PLAYER_ANIM(PLAYER_ANIMGROUP_3, this->modelAnimType); } else if (!(this->stateFlags1 & (PLAYER_STATE1_27 | PLAYER_STATE1_29)) && (this->currentBoots == PLAYER_BOOTS_IRON)) { - return D_80853974[this->modelAnimType]; + return GET_PLAYER_ANIM(PLAYER_ANIMGROUP_4, this->modelAnimType); } else { - return D_80853944[this->modelAnimType]; + return GET_PLAYER_ANIM(PLAYER_ANIMGROUP_2, this->modelAnimType); } } @@ -1642,7 +1775,7 @@ LinkAnimationHeader* func_808334E4(Player* this) { if (func_808334B4(this)) { return &gPlayerAnim_002638; } else { - return D_808539A4[this->modelAnimType]; + return GET_PLAYER_ANIM(PLAYER_ANIMGROUP_6, this->modelAnimType); } } @@ -1650,7 +1783,7 @@ LinkAnimationHeader* func_80833528(Player* this) { if (func_808334B4(this)) { return &gPlayerAnim_002630; } else { - return D_8085398C[this->modelAnimType]; + return GET_PLAYER_ANIM(PLAYER_ANIMGROUP_5, this->modelAnimType); } } @@ -1658,7 +1791,7 @@ LinkAnimationHeader* func_8083356C(Player* this) { if (func_8002DD78(this)) { return &gPlayerAnim_0026E8; } else { - return D_80853B3C[this->modelAnimType]; + return GET_PLAYER_ANIM(PLAYER_ANIMGROUP_23, this->modelAnimType); } } @@ -1666,7 +1799,7 @@ LinkAnimationHeader* func_808335B0(Player* this) { if (func_808334B4(this)) { return &gPlayerAnim_002620; } else { - return D_80853B6C[this->modelAnimType]; + return GET_PLAYER_ANIM(PLAYER_ANIMGROUP_25, this->modelAnimType); } } @@ -1674,7 +1807,7 @@ LinkAnimationHeader* func_808335F4(Player* this) { if (func_808334B4(this)) { return &gPlayerAnim_002618; } else { - return D_80853B54[this->modelAnimType]; + return GET_PLAYER_ANIM(PLAYER_ANIMGROUP_24, this->modelAnimType); } } @@ -1687,22 +1820,22 @@ void func_80833638(Player* this, PlayerFunc82C arg1) { void func_80833664(GlobalContext* globalCtx, Player* this, s8 actionParam) { LinkAnimationHeader* current = this->skelAnime.animation; - LinkAnimationHeader** iter = &D_80853914[this->modelAnimType]; + LinkAnimationHeader** iter = D_80853914 + this->modelAnimType; u32 i; this->stateFlags1 &= ~(PLAYER_STATE1_3 | PLAYER_STATE1_24); - for (i = 0; i < 45; i++) { + for (i = 0; i < PLAYER_ANIMGROUP_MAX; i++) { if (current == *iter) { break; } - iter += 6; + iter += PLAYER_ANIMTYPE_MAX; } func_8083399C(globalCtx, this, actionParam); - if (i < 45) { - this->skelAnime.animation = D_80853914[i * 6 + this->modelAnimType]; + if (i < PLAYER_ANIMGROUP_MAX) { + this->skelAnime.animation = GET_PLAYER_ANIM(i, this->modelAnimType); } } @@ -1958,17 +2091,17 @@ void func_808340DC(Player* this, GlobalContext* globalCtx) { f32 phi_f0; s32 sp38; s8 sp37; - s32 temp; + s32 nextAnimType; sp37 = Player_ItemToActionParam(this->heldItemId); func_80833638(this, func_80834A2C); - temp = gPlayerModelTypes[this->nextModelGroup][0]; - sp38 = D_80854164[gPlayerModelTypes[this->modelGroup][0]][temp]; + nextAnimType = gPlayerModelTypes[this->nextModelGroup][PLAYER_MODELGROUPENTRY_ANIM]; + sp38 = D_80854164[gPlayerModelTypes[this->modelGroup][PLAYER_MODELGROUPENTRY_ANIM]][nextAnimType]; if ((sp37 == PLAYER_AP_BOTTLE) || (sp37 == PLAYER_AP_BOOMERANG) || ((sp37 == PLAYER_AP_NONE) && ((this->heldItemActionParam == PLAYER_AP_BOTTLE) || (this->heldItemActionParam == PLAYER_AP_BOOMERANG)))) { - sp38 = (sp37 == PLAYER_AP_NONE) ? -13 : 13; + sp38 = (sp37 == PLAYER_AP_NONE) ? -PLAYER_D_808540F4_13 : PLAYER_D_808540F4_13; } this->unk_15A = ABS(sp38); @@ -2189,7 +2322,8 @@ s32 func_808349DC(Player* this, GlobalContext* globalCtx) { s32 func_80834A2C(Player* this, GlobalContext* globalCtx) { if (LinkAnimation_Update(globalCtx, &this->skelAnime2) || ((Player_ItemToActionParam(this->heldItemId) == this->heldItemActionParam) && - (D_80853614 = (D_80853614 || ((this->modelAnimType != 3) && (globalCtx->shootingGalleryStatus == 0)))))) { + (D_80853614 = (D_80853614 || + ((this->modelAnimType != PLAYER_ANIMTYPE_3) && (globalCtx->shootingGalleryStatus == 0)))))) { func_80833638(this, D_80853EDC[this->heldItemActionParam]); this->unk_834 = 0; this->unk_6AC = 0; @@ -2242,7 +2376,7 @@ s32 func_80834C74(Player* this, GlobalContext* globalCtx) { if (D_80853614 || LinkAnimation_Update(globalCtx, &this->skelAnime2)) { func_80833638(this, D_80853EDC[this->heldItemActionParam]); - LinkAnimation_PlayLoop(globalCtx, &this->skelAnime2, D_80853914[this->modelAnimType]); + LinkAnimation_PlayLoop(globalCtx, &this->skelAnime2, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_0, this->modelAnimType)); this->unk_6AC = 0; this->func_82C(this, globalCtx); return 0; @@ -2274,7 +2408,7 @@ s32 func_80834D2C(Player* this, GlobalContext* globalCtx) { if (this->stateFlags1 & PLAYER_STATE1_23) { func_80832284(globalCtx, this, &gPlayerAnim_003380); } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !func_80833B54(this)) { - func_80832284(globalCtx, this, D_80853914[this->modelAnimType]); + func_80832284(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_0, this->modelAnimType)); } return 1; @@ -2726,7 +2860,7 @@ void func_80835EFC(Player* this) { void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item) { s8 actionParam; s32 temp; - s32 nextType; + s32 nextAnimType; actionParam = Player_ItemToActionParam(item); @@ -2810,9 +2944,11 @@ void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item) { if ((actionParam != this->heldItemActionParam) || ((this->heldActor == 0) && (Player_ActionToExplosive(this, actionParam) >= 0))) { this->nextModelGroup = Player_ActionToModelGroup(this, actionParam); - nextType = gPlayerModelTypes[this->nextModelGroup][0]; + nextAnimType = gPlayerModelTypes[this->nextModelGroup][PLAYER_MODELGROUPENTRY_ANIM]; if ((this->heldItemActionParam >= 0) && (Player_ActionToMagicSpell(this, actionParam) < 0) && - (item != this->heldItemId) && (D_80854164[gPlayerModelTypes[this->modelGroup][0]][nextType] != 0)) { + (item != this->heldItemId) && + (D_80854164[gPlayerModelTypes[this->modelGroup][PLAYER_MODELGROUPENTRY_ANIM]][nextAnimType] != + PLAYER_D_808540F4_0)) { this->heldItemId = item; this->stateFlags1 |= PLAYER_STATE1_8; } else { @@ -3527,7 +3663,7 @@ void func_80837C0C(GlobalContext* globalCtx, Player* this, s32 arg2, f32 arg3, f this->linearVelocity = 3.0f; this->actor.velocity.y = 6.0f; - func_80832C2C(globalCtx, this, D_8085395C[this->modelAnimType]); + func_80832C2C(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_3, this->modelAnimType)); func_80832698(this, NA_SE_VO_LI_DAMAGE_S); } else { this->actor.speedXZ = arg3; @@ -4230,13 +4366,13 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) { : (LINK_IS_ADULT ? KNOB_ANIM_ADULT_R : KNOB_ANIM_CHILD_R); if (door->animStyle == KNOB_ANIM_ADULT_L) { - sp5C = D_808539EC[this->modelAnimType]; + sp5C = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_9, this->modelAnimType); } else if (door->animStyle == KNOB_ANIM_CHILD_L) { - sp5C = D_80853A04[this->modelAnimType]; + sp5C = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_10, this->modelAnimType); } else if (door->animStyle == KNOB_ANIM_ADULT_R) { - sp5C = D_80853A1C[this->modelAnimType]; + sp5C = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_11, this->modelAnimType); } else { - sp5C = D_80853A34[this->modelAnimType]; + sp5C = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_12, this->modelAnimType); } func_80835C58(globalCtx, this, func_80845EF8, 0); @@ -4411,7 +4547,7 @@ void func_8083A0F4(GlobalContext* globalCtx, Player* this) { anim = &gPlayerAnim_003060; } else { func_80835C58(globalCtx, this, func_80846050, 0); - anim = D_80853A4C[this->modelAnimType]; + anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_13, this->modelAnimType); } func_80832264(globalCtx, this, anim); @@ -4828,7 +4964,7 @@ s32 func_8083B040(Player* this, GlobalContext* globalCtx) { this->exchangeItemId = sp2C; if (this->unk_84F < 0) { - func_80832B0C(globalCtx, this, D_80853C14[this->modelAnimType]); + func_80832B0C(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_32, this->modelAnimType)); } else { func_80832264(globalCtx, this, D_80854548[this->unk_84F]); } @@ -5033,7 +5169,8 @@ s32 func_8083BBA0(Player* this, GlobalContext* globalCtx) { void func_8083BC04(Player* this, GlobalContext* globalCtx) { func_80835C58(globalCtx, this, func_80844708, 0); - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, D_80853A94[this->modelAnimType], 1.25f * D_808535E8); + LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, + GET_PLAYER_ANIM(PLAYER_ANIMGROUP_16, this->modelAnimType), 1.25f * D_808535E8); } s32 func_8083BC7C(Player* this, GlobalContext* globalCtx) { @@ -5105,14 +5242,14 @@ void func_8083BF50(Player* this, GlobalContext* globalCtx) { } if (sp30 < 14.0f) { - anim = D_80853AC4[this->modelAnimType]; + anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_18, this->modelAnimType); sp30 = 11.0f - sp30; if (sp30 < 0.0f) { sp30 = 1.375f * -sp30; } sp30 /= 11.0f; } else { - anim = D_80853ADC[this->modelAnimType]; + anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_19, this->modelAnimType); sp30 = 26.0f - sp30; if (sp30 < 0.0f) { sp30 = 2 * -sp30; @@ -5184,7 +5321,7 @@ s32 func_8083C2B0(Player* this, GlobalContext* globalCtx) { if (!Player_IsChildWithHylianShield(this)) { Player_SetModelsForHoldingShield(this); - anim = D_80853AF4[this->modelAnimType]; + anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_20, this->modelAnimType); } else { anim = &gPlayerAnim_002400; } @@ -5320,7 +5457,7 @@ void func_8083C858(Player* this, GlobalContext* globalCtx) { } func_80835C58(globalCtx, this, func, 1); - func_80832BE8(globalCtx, this, D_80853944[this->modelAnimType]); + func_80832BE8(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_2, this->modelAnimType)); this->unk_89C = 0; this->unk_864 = this->unk_868 = 0.0f; @@ -5393,7 +5530,7 @@ void func_8083CB2C(Player* this, s16 yaw, GlobalContext* globalCtx) { void func_8083CB94(Player* this, GlobalContext* globalCtx) { func_80835C58(globalCtx, this, func_80840DE4, 1); - func_80832BE8(globalCtx, this, D_8085392C[this->modelAnimType]); + func_80832BE8(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_1, this->modelAnimType)); } void func_8083CBF0(Player* this, s16 yaw, GlobalContext* globalCtx) { @@ -5406,7 +5543,7 @@ void func_8083CBF0(Player* this, s16 yaw, GlobalContext* globalCtx) { void func_8083CC9C(Player* this, GlobalContext* globalCtx) { func_80835C58(globalCtx, this, func_8084193C, 1); - func_80832BE8(globalCtx, this, D_80853B6C[this->modelAnimType]); + func_80832BE8(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_25, this->modelAnimType)); this->unk_868 = 0.0f; } @@ -5420,8 +5557,8 @@ void func_8083CD54(GlobalContext* globalCtx, Player* this, s16 yaw) { func_80835C58(globalCtx, this, func_80841BA8, 1); this->unk_87E = 1200; this->unk_87E *= D_808535E8; - LinkAnimation_Change(globalCtx, &this->skelAnime, D_80853B84[this->modelAnimType], 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, - -6.0f); + LinkAnimation_Change(globalCtx, &this->skelAnime, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_26, this->modelAnimType), 1.0f, + 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f); } void func_8083CE0C(Player* this, GlobalContext* globalCtx) { @@ -5430,9 +5567,9 @@ void func_8083CE0C(Player* this, GlobalContext* globalCtx) { func_80835C58(globalCtx, this, func_80840BC8, 1); if (this->unk_870 < 0.5f) { - anim = D_80853BB4[this->modelAnimType]; + anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_28, this->modelAnimType); } else { - anim = D_80853B9C[this->modelAnimType]; + anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_27, this->modelAnimType); } func_80832264(globalCtx, this, anim); @@ -5441,7 +5578,7 @@ void func_8083CE0C(Player* this, GlobalContext* globalCtx) { void func_8083CEAC(Player* this, GlobalContext* globalCtx) { func_80835C58(globalCtx, this, func_80840450, 1); - func_80832B0C(globalCtx, this, D_808539BC[this->modelAnimType]); + func_80832B0C(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_7, this->modelAnimType)); this->unk_850 = 1; } @@ -6014,7 +6151,7 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { s32 sp24 = this->itemActionParam; this->itemActionParam = PLAYER_AP_NONE; - this->modelAnimType = 0; + this->modelAnimType = PLAYER_ANIMTYPE_0; this->heldItemActionParam = this->itemActionParam; func_80836898(globalCtx, this, func_8083A0F4); @@ -6047,7 +6184,7 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { void func_8083EA94(Player* this, GlobalContext* globalCtx) { func_80835C58(globalCtx, this, func_80846578, 1); - func_80832264(globalCtx, this, D_80853BCC[this->modelAnimType]); + func_80832264(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_29, this->modelAnimType)); } s32 func_8083EAF0(Player* this, Actor* actor) { @@ -6065,7 +6202,7 @@ s32 func_8083EB44(Player* this, GlobalContext* globalCtx) { if (!func_80835644(globalCtx, this, this->heldActor)) { if (!func_8083EAF0(this, this->heldActor)) { func_80835C58(globalCtx, this, func_808464B0, 1); - func_80832264(globalCtx, this, D_80853BE4[this->modelAnimType]); + func_80832264(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_30, this->modelAnimType)); } else { func_8083EA94(this, globalCtx); } @@ -6433,7 +6570,7 @@ void func_8083FAB8(Player* this, GlobalContext* globalCtx) { void func_8083FB14(Player* this, GlobalContext* globalCtx) { func_80835C58(globalCtx, this, func_8084B9E4, 0); this->stateFlags2 |= PLAYER_STATE2_4; - func_80832264(globalCtx, this, D_80853C5C[this->modelAnimType]); + func_80832264(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_35, this->modelAnimType)); } void func_8083FB7C(Player* this, GlobalContext* globalCtx) { @@ -6783,8 +6920,8 @@ void func_808409CC(GlobalContext* globalCtx, Player* this) { } else { sp34 = Rand_ZeroOne() * 5.0f; if (sp34 < 4) { - if (((sp34 != 0) && (sp34 != 3)) || - ((this->rightHandType == 10) && ((sp34 == 3) || (Player_GetMeleeWeaponHeld(this) != 0)))) { + if (((sp34 != 0) && (sp34 != 3)) || ((this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD) && + ((sp34 == 3) || (Player_GetMeleeWeaponHeld(this) != 0)))) { if ((sp34 == 0) && Player_HoldsTwoHandedWeapon(this)) { sp34 = 4; } @@ -6793,7 +6930,7 @@ void func_808409CC(GlobalContext* globalCtx, Player* this) { } } animPtr = &D_80853D7C[sp38][0]; - if (this->modelAnimType != 1) { + if (this->modelAnimType != PLAYER_ANIMTYPE_1) { animPtr = &D_80853D7C[sp38][1]; } anim = *animPtr; @@ -6963,7 +7100,8 @@ void func_80841138(Player* this, GlobalContext* globalCtx) { if (this->unk_864 < 1.0f) { temp1 = R_UPDATE_RATE * 0.5f; func_8084029C(this, REG(35) / 1000.0f); - LinkAnimation_LoadToJoint(globalCtx, &this->skelAnime, D_80853BFC[this->modelAnimType], this->unk_868); + LinkAnimation_LoadToJoint(globalCtx, &this->skelAnime, + GET_PLAYER_ANIM(PLAYER_ANIMGROUP_31, this->modelAnimType), this->unk_868); this->unk_864 += 1 * temp1; if (this->unk_864 >= 1.0f) { this->unk_864 = 1.0f; @@ -6974,7 +7112,8 @@ void func_80841138(Player* this, GlobalContext* globalCtx) { if (temp2 < 0.0f) { temp1 = 1.0f; func_8084029C(this, (REG(35) / 1000.0f) + ((REG(36) / 1000.0f) * this->linearVelocity)); - LinkAnimation_LoadToJoint(globalCtx, &this->skelAnime, D_80853BFC[this->modelAnimType], this->unk_868); + LinkAnimation_LoadToJoint(globalCtx, &this->skelAnime, + GET_PLAYER_ANIM(PLAYER_ANIMGROUP_31, this->modelAnimType), this->unk_868); } else { temp1 = (REG(37) / 1000.0f) * temp2; if (temp1 < 1.0f) { @@ -6983,7 +7122,8 @@ void func_80841138(Player* this, GlobalContext* globalCtx) { temp1 = 1.0f; func_8084029C(this, 1.2f + ((REG(38) / 1000.0f) * temp2)); } - LinkAnimation_LoadToMorph(globalCtx, &this->skelAnime, D_80853BFC[this->modelAnimType], this->unk_868); + LinkAnimation_LoadToMorph(globalCtx, &this->skelAnime, + GET_PLAYER_ANIM(PLAYER_ANIMGROUP_31, this->modelAnimType), this->unk_868); LinkAnimation_LoadToJoint(globalCtx, &this->skelAnime, &gPlayerAnim_002DD0, this->unk_868 * (16.0f / 29.0f)); } @@ -7099,8 +7239,8 @@ void func_808417FC(Player* this, GlobalContext* globalCtx) { void func_80841860(GlobalContext* globalCtx, Player* this) { f32 frame; - LinkAnimationHeader* sp38 = D_80853914[this->modelAnimType + 144]; - LinkAnimationHeader* sp34 = D_80853914[this->modelAnimType + 150]; + LinkAnimationHeader* sp38 = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_24, this->modelAnimType); + LinkAnimationHeader* sp34 = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_25, this->modelAnimType); this->skelAnime.animation = sp38; @@ -7214,11 +7354,13 @@ void func_80841CC4(Player* this, s32 arg1, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->unk_89C, target, 400); - if ((this->modelAnimType == 3) || ((this->unk_89C == 0) && (this->unk_6C4 <= 0.0f))) { + if ((this->modelAnimType == PLAYER_ANIMTYPE_3) || ((this->unk_89C == 0) && (this->unk_6C4 <= 0.0f))) { if (arg1 == 0) { - LinkAnimation_LoadToJoint(globalCtx, &this->skelAnime, D_8085392C[this->modelAnimType], this->unk_868); + LinkAnimation_LoadToJoint(globalCtx, &this->skelAnime, + GET_PLAYER_ANIM(PLAYER_ANIMGROUP_1, this->modelAnimType), this->unk_868); } else { - LinkAnimation_LoadToMorph(globalCtx, &this->skelAnime, D_8085392C[this->modelAnimType], this->unk_868); + LinkAnimation_LoadToMorph(globalCtx, &this->skelAnime, + GET_PLAYER_ANIM(PLAYER_ANIMGROUP_1, this->modelAnimType), this->unk_868); } return; } @@ -7243,10 +7385,12 @@ void func_80841CC4(Player* this, s32 arg1, GlobalContext* globalCtx) { } if (arg1 == 0) { - LinkAnimation_BlendToJoint(globalCtx, &this->skelAnime, D_8085392C[this->modelAnimType], this->unk_868, anim, + LinkAnimation_BlendToJoint(globalCtx, &this->skelAnime, + GET_PLAYER_ANIM(PLAYER_ANIMGROUP_1, this->modelAnimType), this->unk_868, anim, this->unk_868, rate, this->blendTable); } else { - LinkAnimation_BlendToMorph(globalCtx, &this->skelAnime, D_8085392C[this->modelAnimType], this->unk_868, anim, + LinkAnimation_BlendToMorph(globalCtx, &this->skelAnime, + GET_PLAYER_ANIM(PLAYER_ANIMGROUP_1, this->modelAnimType), this->unk_868, anim, this->unk_868, rate, this->blendTable); } } @@ -7259,7 +7403,8 @@ void func_80841EE4(Player* this, GlobalContext* globalCtx) { temp1 = R_UPDATE_RATE * 0.5f; func_8084029C(this, REG(35) / 1000.0f); - LinkAnimation_LoadToJoint(globalCtx, &this->skelAnime, D_8085392C[this->modelAnimType], this->unk_868); + LinkAnimation_LoadToJoint(globalCtx, &this->skelAnime, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_1, this->modelAnimType), + this->unk_868); this->unk_864 += 1 * temp1; if (this->unk_864 >= 1.0f) { @@ -7437,11 +7582,11 @@ s32 func_8084269C(GlobalContext* globalCtx, Player* this) { } void func_8084279C(Player* this, GlobalContext* globalCtx) { - func_80832CB0(globalCtx, this, D_80853C2C[this->modelAnimType]); + func_80832CB0(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_33, this->modelAnimType)); if (DECR(this->unk_850) == 0) { if (!func_8083B040(this, globalCtx)) { - func_8083A098(this, D_80853C44[this->modelAnimType], globalCtx); + func_8083A098(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_34, this->modelAnimType), globalCtx); } this->actor.flags &= ~ACTOR_FLAG_8; @@ -7666,7 +7811,7 @@ void func_80843188(Player* this, GlobalContext* globalCtx) { if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { if (!Player_IsChildWithHylianShield(this)) { - func_80832284(globalCtx, this, D_80853B0C[this->modelAnimType]); + func_80832284(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_21, this->modelAnimType)); } this->unk_850 = 1; this->unk_84F = 0; @@ -7733,7 +7878,7 @@ void func_80843188(Player* this, GlobalContext* globalCtx) { if (this->itemActionParam < 0) { func_8008EC70(this); } - func_8083A098(this, D_80853B24[this->modelAnimType], globalCtx); + func_8083A098(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_22, this->modelAnimType), globalCtx); } func_8002F7DC(&this->actor, NA_SE_IT_SHIELD_REMOVE); @@ -7768,7 +7913,7 @@ void func_808435C4(Player* this, GlobalContext* globalCtx) { func_80835C58(globalCtx, this, func_80843188, 1); this->stateFlags1 |= PLAYER_STATE1_22; Player_SetModelsForHoldingShield(this); - anim = D_80853AF4[this->modelAnimType]; + anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_20, this->modelAnimType); frames = Animation_GetLastFrame(anim); LinkAnimation_Change(globalCtx, &this->skelAnime, anim, 1.0f, frames, frames, ANIMMODE_ONCE, 0.0f); } @@ -8097,7 +8242,7 @@ void func_8084411C(Player* this, GlobalContext* globalCtx) { } this->actor.world.pos.y += this->wallHeight; func_8083A5C4(globalCtx, this, this->actor.wallPoly, this->wallDistance, - D_80853CBC[this->modelAnimType]); + GET_PLAYER_ANIM(PLAYER_ANIMGROUP_39, this->modelAnimType)); this->actor.shape.rot.y = this->currentYaw += 0x8000; this->stateFlags1 |= PLAYER_STATE1_13; } @@ -8106,7 +8251,7 @@ void func_8084411C(Player* this, GlobalContext* globalCtx) { } } } else { - LinkAnimationHeader* anim = D_80853A64[this->modelAnimType]; + LinkAnimationHeader* anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_14, this->modelAnimType); s32 sp3C; if (this->stateFlags2 & PLAYER_STATE2_19) { @@ -8121,7 +8266,7 @@ void func_8084411C(Player* this, GlobalContext* globalCtx) { anim = &gPlayerAnim_002538; func_80833C3C(this); } else if (this->fallDistance <= 80) { - anim = D_80853A7C[this->modelAnimType]; + anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_15, this->modelAnimType); } else if ((this->fallDistance < 800) && (this->unk_84B[this->unk_846] == 0) && !(this->stateFlags1 & PLAYER_STATE1_11)) { func_8083BC04(this, globalCtx); @@ -8131,7 +8276,7 @@ void func_8084411C(Player* this, GlobalContext* globalCtx) { sp3C = func_80843E64(globalCtx, this); if (sp3C > 0) { - func_8083A098(this, D_80853A64[this->modelAnimType], globalCtx); + func_8083A098(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_14, this->modelAnimType), globalCtx); this->skelAnime.endFrame = 8.0f; if (sp3C == 1) { this->unk_850 = 10; @@ -8194,7 +8339,7 @@ void func_80844708(Player* this, GlobalContext* globalCtx) { } } - func_80832264(globalCtx, this, D_80853AAC[this->modelAnimType]); + func_80832264(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_17, this->modelAnimType)); this->linearVelocity = -this->linearVelocity; func_808429B4(globalCtx, 33267, 3, 12); func_8083264C(this, 255, 20, 150, 0); @@ -9084,8 +9229,9 @@ void Player_InitCommon(Player* this, GlobalContext* globalCtx, FlexSkeletonHeade this->currentYaw = this->actor.world.rot.y; func_80834644(globalCtx, this); - SkelAnime_InitLink(globalCtx, &this->skelAnime, skelHeader, D_80853914[this->modelAnimType], 9, this->jointTable, - this->morphTable, PLAYER_LIMB_MAX); + SkelAnime_InitLink(globalCtx, &this->skelAnime, skelHeader, + GET_PLAYER_ANIM(PLAYER_ANIMGROUP_0, this->modelAnimType), 9, this->jointTable, this->morphTable, + PLAYER_LIMB_MAX); this->skelAnime.baseTransl = D_80854730; SkelAnime_InitLink(globalCtx, &this->skelAnime2, skelHeader, func_80833338(this), 9, this->jointTable2, this->morphTable2, PLAYER_LIMB_MAX); @@ -10930,7 +11076,7 @@ void func_8084B9E4(Player* this, GlobalContext* globalCtx) { Vec3f sp44; Vec3f sp38; - anim = D_80853C74[this->modelAnimType]; + anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_36, this->modelAnimType); this->stateFlags2 |= PLAYER_STATE2_0 | PLAYER_STATE2_6 | PLAYER_STATE2_8; if (func_80832CB0(globalCtx, this, anim)) { @@ -10953,7 +11099,7 @@ void func_8084B9E4(Player* this, GlobalContext* globalCtx) { if (temp1 > 0) { func_8083FAB8(this, globalCtx); } else if (temp1 == 0) { - func_8083F72C(this, D_80853C8C[this->modelAnimType], globalCtx); + func_8083F72C(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_37, this->modelAnimType), globalCtx); } else { this->stateFlags2 |= PLAYER_STATE2_4; } @@ -10985,7 +11131,7 @@ void func_8084BBE4(Player* this, GlobalContext* globalCtx) { if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { // clang-format off - anim = (this->unk_84F > 0) ? &gPlayerAnim_002F28 : D_80853CD4[this->modelAnimType]; func_80832284(globalCtx, this, anim); + anim = (this->unk_84F > 0) ? &gPlayerAnim_002F28 : GET_PLAYER_ANIM(PLAYER_ANIMGROUP_40, this->modelAnimType); func_80832284(globalCtx, this, anim); // clang-format on } else if (this->unk_84F == 0) { if (this->skelAnime.animation == &gPlayerAnim_002F10) { @@ -11010,9 +11156,9 @@ void func_8084BBE4(Player* this, GlobalContext* globalCtx) { func_80837268(this, &sp3C, &sp3A, 0.0f, globalCtx); if (this->unk_847[this->unk_846] >= 0) { if (this->unk_84F > 0) { - anim = D_80853CA4[this->modelAnimType]; + anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_38, this->modelAnimType); } else { - anim = D_80853CEC[this->modelAnimType]; + anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_41, this->modelAnimType); } func_8083A9B8(this, anim, globalCtx); return; @@ -11666,7 +11812,7 @@ void func_8084D610(Player* this, GlobalContext* globalCtx) { sp32 = this->actor.shape.rot.y; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - func_8083A098(this, D_80853A7C[this->modelAnimType], globalCtx); + func_8083A098(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_15, this->modelAnimType), globalCtx); func_808328A0(this); } } else { @@ -12456,9 +12602,9 @@ void func_8084F390(Player* this, GlobalContext* globalCtx) { if (Math_AsymStepToF(&this->linearVelocity, sp50, sp4C, sp48) && (sp50 == 0)) { LinkAnimationHeader* anim; if (this->unk_84F == 0) { - anim = D_80853D04[this->modelAnimType]; + anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_42, this->modelAnimType); } else { - anim = D_80853D1C[this->modelAnimType]; + anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_43, this->modelAnimType); } func_8083A098(this, anim, globalCtx); } @@ -12799,7 +12945,7 @@ void func_808502D0(Player* this, GlobalContext* globalCtx) { func_80832318(this); this->skelAnime.moveFlags = 0; - if ((sp3C == &gPlayerAnim_002908) && (this->modelAnimType != 3)) { + if ((sp3C == &gPlayerAnim_002908) && (this->modelAnimType != PLAYER_ANIMTYPE_3)) { sp3C = &gPlayerAnim_002AC8; } @@ -13492,7 +13638,7 @@ void func_808515A4(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg return; } - anim = D_80853D34[this->modelAnimType]; + anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_44, this->modelAnimType); if ((this->unk_446 == 6) || (this->unk_446 == 0x2E)) { func_80832264(globalCtx, this, anim); @@ -13816,7 +13962,7 @@ void func_808521B8(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg } void func_808521F4(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80832B0C(globalCtx, this, D_80853D34[this->modelAnimType]); + func_80832B0C(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_44, this->modelAnimType)); func_80832210(this); } @@ -13868,9 +14014,9 @@ void func_80852388(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg } if ((this->unk_850 != 0) && (globalCtx->csCtx.frames >= 900)) { - this->rightHandType = 0; + this->rightHandType = PLAYER_MODELTYPE_LH_OPEN; } else { - this->rightHandType = 0xFF; + this->rightHandType = PLAYER_MODELTYPE_RH_FF; } } @@ -13977,8 +14123,8 @@ void func_808526EC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg func_80851294(globalCtx, this, D_80855208[linkAge]); - if (this->rightHandType != 0xFF) { - this->rightHandType = 0xFF; + if (this->rightHandType != PLAYER_MODELTYPE_RH_FF) { + this->rightHandType = PLAYER_MODELTYPE_RH_FF; return; }