model docs (#3281)

This commit is contained in:
inspectredc 2023-10-27 01:38:43 +01:00 committed by GitHub
parent de430dc256
commit a6de59e09f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 322 additions and 79 deletions

View File

@ -82,7 +82,7 @@ extern "C"
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* gPlayerLeftHandBgsDLs[];
extern Gfx* gPlayerLeftHandOpenDLs[];
extern Gfx* gPlayerLeftHandClosedDLs[];

View File

@ -34,9 +34,82 @@ 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, 3,
3, 3, 3, 3, 3, 3, 3, 3
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_NONE
PLAYER_MODELGROUP_15, // PLAYER_IA_LAST_USED
PLAYER_MODELGROUP_10, // PLAYER_IA_FISHING_POLE
PLAYER_MODELGROUP_SWORD, // PLAYER_IA_SWORD_MASTER
PLAYER_MODELGROUP_SWORD, // PLAYER_IA_SWORD_KOKIRI
PLAYER_MODELGROUP_BGS, // PLAYER_IA_SWORD_BIGGORON
PLAYER_MODELGROUP_10, // PLAYER_IA_DEKU_STICK
PLAYER_MODELGROUP_HAMMER, // PLAYER_IA_HAMMER
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_FIRE
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_ICE
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_LIGHT
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_0C
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_0D
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_0E
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_SLINGSHOT
PLAYER_MODELGROUP_HOOKSHOT, // PLAYER_IA_HOOKSHOT
PLAYER_MODELGROUP_HOOKSHOT, // PLAYER_IA_LONGSHOT
PLAYER_MODELGROUP_EXPLOSIVES, // PLAYER_IA_BOMB
PLAYER_MODELGROUP_EXPLOSIVES, // PLAYER_IA_BOMBCHU
PLAYER_MODELGROUP_BOOMERANG, // PLAYER_IA_BOOMERANG
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MAGIC_SPELL_15
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MAGIC_SPELL_16
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_MAGIC_SPELL_17
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_FARORES_WIND
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_NAYRUS_LOVE
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_DINS_FIRE
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_DEKU_NUT
PLAYER_MODELGROUP_OCARINA, // PLAYER_IA_OCARINA_FAIRY
PLAYER_MODELGROUP_OOT, // PLAYER_IA_OCARINA_OF_TIME
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_FISH
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_FIRE
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_BUG
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POE
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_BIG_POE
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_RUTOS_LETTER
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POTION_RED
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POTION_BLUE
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POTION_GREEN
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_MILK_FULL
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_MILK_HALF
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_FAIRY
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_ZELDAS_LETTER
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_WEIRD_EGG
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_CHICKEN
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MAGIC_BEAN
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_POCKET_EGG
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_POCKET_CUCCO
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_COJIRO
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_ODD_MUSHROOM
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_ODD_POTION
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_POACHERS_SAW
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_BROKEN_GORONS_SWORD
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_PRESCRIPTION
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_FROG
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_EYEDROPS
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_CLAIM_CHECK
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_KEATON
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_SKULL
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_SPOOKY
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_BUNNY_HOOD
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_GORON
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_ZORA
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_GERUDO
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_TRUTH
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_LENS_OF_TRUTH
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_SHIELD_DEKU
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_SHIELD_HYLIAN
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_SHIELD_MIRROR
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_TUNIC_KOKIRI
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_TUNIC_GORON
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_TUNIC_ZORA
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_BOOTS_KOKIRI
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_BOOTS_IRON
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_BOOTS_HOVER
};
TextTriggerEntry sTextTriggers[] = {
@ -47,68 +120,208 @@ 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* sPlayerRightHandShieldDLs[] = {
Gfx* sPlayerRightHandShieldDLs[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* sSheathWithSwordDLs[] = {
Gfx* sSheathWithSwordDLs[(PLAYER_SHIELD_MAX + 2) * 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,
// PLAYER_SHIELD_NONE (child, no sword)
NULL, NULL,
NULL, NULL,
// PLAYER_SHIELD_DEKU (child, no sword)
NULL, gLinkChildDekuShieldWithMatrixDL,
NULL, gLinkChildDekuShieldWithMatrixDL,
};
Gfx* sSheathWithoutSwordDLs[] = {
Gfx* sSheathWithoutSwordDLs[(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,
@ -116,8 +329,10 @@ Gfx* sSheathWithoutSwordDLs[] = {
};
Gfx* gPlayerLeftHandBgsDLs[] = {
// Biggoron Sword
gLinkAdultLeftHandHoldingBgsNearDL, gLinkChildLeftHandHoldingMasterSwordDL,
gLinkAdultLeftHandHoldingBgsFarDL, gLinkChildLeftHandHoldingMasterSwordDL,
// Broken Giant's Knife
gLinkAdultHandHoldingBrokenGiantsKnifeDL, gLinkChildLeftHandHoldingMasterSwordDL,
gLinkAdultHandHoldingBrokenGiantsKnifeFarDL, gLinkChildLeftHandHoldingMasterSwordDL,
};
@ -267,10 +482,28 @@ Gfx* sFirstPersonRightHandHoldingWeaponDLs[] = {
};
// Indexed by model types (left hand, right hand, sheath or waist)
Gfx** sPlayerDListGroups[] = {
gPlayerLeftHandOpenDLs, gPlayerLeftHandClosedDLs, sPlayerLeftHandSwordDLs, sPlayerLeftHandSwordDLs2, gPlayerLeftHandBgsDLs, sPlayerLeftHandHammerDLs, gPlayerLeftHandBoomerangDLs,
sPlayerLeftHandBottleDLs, sPlayerRightHandOpenDLs, sPlayerRightHandClosedDLs, sPlayerRightHandShieldDLs, sPlayerRightHandBowSlingshotDLs, sPlayerRightHandBowSlingshotDLs2, sPlayerRightHandOcarinaDLs,
sPlayerRightHandOotDLs, sPlayerRightHandHookshotDLs, sSwordAndSheathDLs, sSheathDLs, sSheathWithSwordDLs, sSheathWithoutSwordDLs, sPlayerWaistDLs,
Gfx** sPlayerDListGroups[PLAYER_MODELTYPE_MAX] = {
gPlayerLeftHandOpenDLs, // PLAYER_MODELTYPE_LH_OPEN
gPlayerLeftHandClosedDLs, // PLAYER_MODELTYPE_LH_CLOSED
sPlayerLeftHandSwordDLs, // PLAYER_MODELTYPE_LH_SWORD
sPlayerLeftHandSwordDLs2, // PLAYER_MODELTYPE_LH_SWORD_2
gPlayerLeftHandBgsDLs, // PLAYER_MODELTYPE_LH_BGS
sPlayerLeftHandHammerDLs, // PLAYER_MODELTYPE_LH_HAMMER
gPlayerLeftHandBoomerangDLs, // PLAYER_MODELTYPE_LH_BOOMERANG
sPlayerLeftHandBottleDLs, // PLAYER_MODELTYPE_LH_BOTTLE
sPlayerRightHandOpenDLs, // PLAYER_MODELTYPE_RH_OPEN
sPlayerRightHandClosedDLs, // PLAYER_MODELTYPE_RH_CLOSED
sPlayerRightHandShieldDLs, // PLAYER_MODELTYPE_RH_SHIELD
sPlayerRightHandBowSlingshotDLs, // PLAYER_MODELTYPE_RH_BOW_SLINGSHOT
sPlayerRightHandBowSlingshotDLs2, // PLAYER_MODELTYPE_RH_BOW_SLINGSHOT_2
sPlayerRightHandOcarinaDLs, // PLAYER_MODELTYPE_RH_OCARINA
sPlayerRightHandOotDLs, // PLAYER_MODELTYPE_RH_OOT
sPlayerRightHandHookshotDLs, // PLAYER_MODELTYPE_RH_HOOKSHOT
sSwordAndSheathDLs, // PLAYER_MODELTYPE_SHEATH_16
sSheathDLs, // PLAYER_MODELTYPE_SHEATH_17
sSheathWithSwordDLs, // PLAYER_MODELTYPE_SHEATH_18
sSheathWithoutSwordDLs, // PLAYER_MODELTYPE_SHEATH_19
sPlayerWaistDLs, // PLAYER_MODELTYPE_WAIST
};
Gfx gCullBackDList[] = {
@ -362,8 +595,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;
}
@ -374,15 +608,15 @@ void Player_SetModelsForHoldingShield(Player* this) {
((this->itemAction < 0) || (this->itemAction == this->heldItemAction))) {
if ((CVarGetInteger("gShieldTwoHanded", 0) && (this->heldItemAction != PLAYER_IA_DEKU_STICK) ||
!Player_HoldsTwoHandedWeapon(this)) && !Player_IsChildWithHylianShield(this)) {
this->rightHandType = 10;
this->rightHandDLists = &sPlayerDListGroups[10][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][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][gSaveContext.linkAge];
this->modelAnimType = 2;
this->modelAnimType = PLAYER_ANIMTYPE_2;
this->itemAction = -1;
}
}
@ -390,11 +624,11 @@ void Player_SetModelsForHoldingShield(Player* this) {
void Player_SetModels(Player* this, s32 modelGroup) {
// Left hand
this->leftHandType = gPlayerModelTypes[modelGroup][1];
this->leftHandType = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_LEFT_HAND];
this->leftHandDLists = &sPlayerDListGroups[this->leftHandType][gSaveContext.linkAge];
// Right hand
this->rightHandType = gPlayerModelTypes[modelGroup][2];
this->rightHandType = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_RIGHT_HAND];
this->rightHandDLists = &sPlayerDListGroups[this->rightHandType][gSaveContext.linkAge];
if (CVarGetInteger("gBowSlingShotAmmoFix", 0) && this->rightHandType == 11) { // If holding Bow/Slingshot
@ -402,7 +636,7 @@ void Player_SetModels(Player* this, s32 modelGroup) {
}
// Sheath
this->sheathType = gPlayerModelTypes[modelGroup][3];
this->sheathType = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_SHEATH];
this->sheathDLists = &sPlayerDListGroups[this->sheathType][gSaveContext.linkAge];
// Waist
@ -414,14 +648,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);
@ -541,7 +775,7 @@ s32 Player_HasMirrorShieldEquipped(PlayState* play) {
s32 Player_HasMirrorShieldSetToDraw(PlayState* play) {
Player* this = GET_PLAYER(play);
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) {
@ -744,8 +978,8 @@ Color_RGB8 sGauntletColors[] = {
};
Gfx* sBootDListGroups[][2] = {
{ gLinkAdultLeftIronBootDL, gLinkAdultRightIronBootDL },
{ gLinkAdultLeftHoverBootDL, gLinkAdultRightHoverBootDL },
{ gLinkAdultLeftIronBootDL, gLinkAdultRightIronBootDL }, // PLAYER_BOOTS_IRON
{ gLinkAdultLeftHoverBootDL, gLinkAdultRightHoverBootDL }, // PLAYER_BOOTS_HOVER
};
void Player_DrawImpl(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic,
@ -828,9 +1062,9 @@ void Player_DrawImpl(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dL
gSPDisplayList(POLY_OPA_DISP++, gLinkAdultLeftGauntletPlate1DL);
gSPDisplayList(POLY_OPA_DISP++, gLinkAdultRightGauntletPlate1DL);
gSPDisplayList(POLY_OPA_DISP++,
(sLeftHandType == 0) ? gLinkAdultLeftGauntletPlate2DL : gLinkAdultLeftGauntletPlate3DL);
(sLeftHandType == PLAYER_MODELTYPE_LH_OPEN) ? gLinkAdultLeftGauntletPlate2DL : gLinkAdultLeftGauntletPlate3DL);
gSPDisplayList(POLY_OPA_DISP++,
(sRightHandType == 8) ? gLinkAdultRightGauntletPlate2DL : gLinkAdultRightGauntletPlate3DL);
(sRightHandType == PLAYER_MODELTYPE_RH_OPEN) ? gLinkAdultRightGauntletPlate2DL : gLinkAdultRightGauntletPlate3DL);
}
if (boots != 0) {
@ -1045,40 +1279,40 @@ s32 Player_OverrideLimbDrawGameplayDefault(PlayState* play, s32 limbIndex, Gfx**
if (limbIndex == PLAYER_LIMB_L_HAND) {
Gfx** dLists = this->leftHandDLists;
if ((sLeftHandType == 4) && (gSaveContext.swordHealth <= 0.0f)) {
if ((sLeftHandType == PLAYER_MODELTYPE_LH_BGS) && (gSaveContext.swordHealth <= 0.0f)) {
dLists += 4;
} else if ((sLeftHandType == 6) && (this->stateFlags1 & 0x2000000)) {
} else if ((sLeftHandType == PLAYER_MODELTYPE_LH_BOOMERANG) && (this->stateFlags1 & 0x2000000)) {
dLists = &gPlayerLeftHandOpenDLs[gSaveContext.linkAge];
sLeftHandType = 0;
} else if ((this->leftHandType == 0) && (this->actor.speedXZ > 2.0f) && !(this->stateFlags1 & 0x8000000)) {
} else if ((this->leftHandType == PLAYER_MODELTYPE_LH_OPEN) && (this->actor.speedXZ > 2.0f) && !(this->stateFlags1 & 0x8000000)) {
dLists = &gPlayerLeftHandClosedDLs[gSaveContext.linkAge];
sLeftHandType = 1;
sLeftHandType = PLAYER_MODELTYPE_LH_CLOSED;
}
*dList = ResourceMgr_LoadGfxByName(dLists[sDListsLodOffset]);
} else if (limbIndex == PLAYER_LIMB_R_HAND) {
Gfx** dLists = this->rightHandDLists;
if (sRightHandType == 10) {
if (sRightHandType == PLAYER_MODELTYPE_RH_SHIELD) {
dLists += this->currentShield * 4;
} else if ((this->rightHandType == 8) && (this->actor.speedXZ > 2.0f) && !(this->stateFlags1 & 0x8000000)) {
} else if ((this->rightHandType == PLAYER_MODELTYPE_RH_OPEN) && (this->actor.speedXZ > 2.0f) && !(this->stateFlags1 & 0x8000000)) {
dLists = &sPlayerRightHandClosedDLs[gSaveContext.linkAge];
sRightHandType = 9;
sRightHandType = PLAYER_MODELTYPE_RH_CLOSED;
}
*dList = ResourceMgr_LoadGfxByName(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 = &sSheathWithSwordDLs[16];
dLists = &sSheathWithSwordDLs[PLAYER_SHIELD_MAX * 4];
}
if (dLists[sDListsLodOffset] != NULL) {
@ -1481,7 +1715,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
func_80090A28(this, spE4);
func_800906D4(play, 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->itemAction)];
OPEN_DISPS(play->state.gfxCtx);
@ -1522,9 +1756,9 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
} 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_RH_BOW_SLINGSHOT_2)) {
s32 stringModelToUse = gSaveContext.linkAge;
if(CVarGetInteger("gBowSlingShotAmmoFix", 0)){
stringModelToUse = Player_HoldsSlingshot(this);
@ -1569,7 +1803,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
Matrix_Pop();
CLOSE_DISPS(play->state.gfxCtx);
} 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);
Player_UpdateShieldCollider(play, this, &this->shieldQuad, sRightHandLimbModelShieldQuadVertices);
}
@ -1631,7 +1865,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
}
} 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)) {
Player_UpdateShieldCollider(play, this, &this->shieldQuad, sSheathLimbModelShieldQuadVertices);
}
@ -1673,46 +1907,55 @@ u32 func_80091738(PlayState* play, u8* segment, SkelAnime* skelAnime) {
return size + 0x8800 + 0x90;
}
u8 sPauseModelGroupBySword[] = { 2, 2, 5 };
u8 sPauseModelGroupBySword[] = {
PLAYER_MODELGROUP_SWORD, // PLAYER_SWORD_KOKIRI
PLAYER_MODELGROUP_SWORD, // PLAYER_SWORD_MASTER
PLAYER_MODELGROUP_BGS, // PLAYER_SWORD_BIGGORON
};
s32 Player_OverrideLimbDrawPause(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* arg) {
u8* ptr = arg;
u8 modelGroup = sPauseModelGroupBySword[ptr[0] > 0 ? ptr[0] - 1 : 0];
u8* playerSwordAndShield = arg;
// SOH: Ensure positive value from playerSwordAndShield[] to avoid OOB array access.
// This can occur in the case where playerSwordAndShield[0] is PLAYER_SWORD_NONE
u8 modelGroup = sPauseModelGroupBySword[playerSwordAndShield[0] > 0 ? playerSwordAndShield[0] - PLAYER_SWORD_KOKIRI : 0];
s32 type;
s32 dListOffset = 0;
Gfx** dLists;
size_t ptrSize = sizeof(uint32_t);
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];
type = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_LEFT_HAND];
sLeftHandType = type;
if (ptr[0] == 0)
type = 0;
// SOH: Handle unexpected swordless case. Previously OOB array access is avoided, but we want the
// hand model-type to be set to open (otherwise it is set to holding sword model-type)
if (playerSwordAndShield[0] == PLAYER_SWORD_NONE) {
type = PLAYER_MODELTYPE_LH_OPEN;
}
if ((type == 4) && (gSaveContext.swordHealth <= 0.0f)) {
if ((type == PLAYER_MODELTYPE_LH_BGS) && (gSaveContext.swordHealth <= 0.0f)) {
dListOffset = 4;
}
} else if (limbIndex == PLAYER_LIMB_R_HAND) {
type = gPlayerModelTypes[modelGroup][2];
type = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_RIGHT_HAND];
sRightHandType = type;
if (type == 10) {
dListOffset = ptr[1] * ptrSize;
if (type == PLAYER_MODELTYPE_RH_SHIELD) {
dListOffset = playerSwordAndShield[1] * ptrSize;
}
} else if (limbIndex == PLAYER_LIMB_SHEATH) {
type = gPlayerModelTypes[modelGroup][3];
if ((type == 18) || (type == 19)) {
dListOffset = ptr[1] * ptrSize;
} else if (type == 16 && CVarGetInteger("gPauseLiveLink", 0)) {
//if (ptr[0] == 1)
type = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_SHEATH];
if ((type == PLAYER_MODELTYPE_SHEATH_18) || (type == PLAYER_MODELTYPE_SHEATH_19)) {
dListOffset = playerSwordAndShield[1] * ptrSize;
} else if (type == PLAYER_MODELTYPE_SHEATH_16 && CVarGetInteger("gPauseLiveLink", 0)) {
//if (playerSwordAndShield[0] == 1)
//dListOffset = 4;
}
} else if (limbIndex == PLAYER_LIMB_WAIST) {
type = gPlayerModelTypes[modelGroup][4];
type = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_WAIST];
if (Player_IsCustomLinkModel()) {
return 0;
@ -1750,7 +1993,7 @@ void Player_DrawPauseImpl(PlayState* play, void* seg04, void* seg06, SkelAnime*
static Vp viewport = { 128, 224, 511, 0, 128, 224, 511, 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;
Gfx* kalRef;
@ -1788,8 +2031,8 @@ void Player_DrawPauseImpl(PlayState* play, void* seg04, void* seg06, SkelAnime*
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 - ((CVarGetInteger("gPauseLiveLink", 0) && LINK_AGE_IN_YEARS == YEARS_ADULT) ? 25 : 0),
pos->y - (CVarGetInteger("gPauseTriforce", 0) ? 16 : 0), pos->z, rot);
@ -1809,7 +2052,7 @@ void Player_DrawPauseImpl(PlayState* play, void* seg04, void* seg06, SkelAnime*
gSPSegment(POLY_OPA_DISP++, 0x0C, gCullBackDList);
Player_DrawImpl(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, tunic, boots, 0,
Player_OverrideLimbDrawPause, NULL, &sp12C);
Player_OverrideLimbDrawPause, NULL, &playerSwordAndShield);
if (CVarGetInteger("gPauseTriforce", 0)) {

View File

@ -308,7 +308,7 @@ void ArmsHook_Draw(Actor* thisx, PlayState* play) {
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(play->state.gfxCtx);
if ((ArmsHook_Shoot != this->actionFunc) || (this->timer <= 0)) {

View File

@ -136,7 +136,7 @@ void EnTorch2_Init(Actor* thisx, PlayState* play2) {
sInput.cur.stick_x = sInput.cur.stick_y = 0;
this->currentShield = PLAYER_SHIELD_HYLIAN;
this->heldItemAction = this->heldItemId = PLAYER_IA_SWORD_MASTER;
Player_SetModelGroup(this, 2);
Player_SetModelGroup(this, PLAYER_MODELGROUP_SWORD);
play->playerInit(this, play, &gDarkLinkSkel);
this->actor.naviEnemyId = 0x26;
this->cylinder.base.acFlags = AC_ON | AC_TYPE_PLAYER;

View File

@ -545,7 +545,7 @@ void EnZl2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
{
Player* player = GET_PLAYER(play);
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);