mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-01-31 07:20:14 -05:00
Option for link's models reflect the projectile weapon he's holding (Bow/Slingshot) (#2454)
* Link's models reflect the projectile weapon he's holding extracted logic from months-old PR * apply bow/slingshot model changes only if 'gBowSlingShotAmmoFix' is enabled * Apply suggestions from code review Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * whitespace --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
This commit is contained in:
parent
218971c4a9
commit
2241635ac5
@ -1120,6 +1120,8 @@ s32 Player_HasMirrorShieldEquipped(PlayState* play);
|
|||||||
s32 Player_HasMirrorShieldSetToDraw(PlayState* play);
|
s32 Player_HasMirrorShieldSetToDraw(PlayState* play);
|
||||||
s32 Player_ActionToMagicSpell(Player* player, s32 actionParam);
|
s32 Player_ActionToMagicSpell(Player* player, s32 actionParam);
|
||||||
s32 Player_HoldsHookshot(Player* player);
|
s32 Player_HoldsHookshot(Player* player);
|
||||||
|
s32 Player_HoldsBow(Player* player);
|
||||||
|
s32 Player_HoldsSlingshot(Player* player);
|
||||||
s32 func_8008F128(Player* player);
|
s32 func_8008F128(Player* player);
|
||||||
s32 Player_ActionToSword(s32 actionParam);
|
s32 Player_ActionToSword(s32 actionParam);
|
||||||
s32 Player_GetSwordHeld(Player* player);
|
s32 Player_GetSwordHeld(Player* player);
|
||||||
|
@ -380,13 +380,23 @@ void Player_SetModelsForHoldingShield(Player* this) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Player_SetModels(Player* this, s32 modelGroup) {
|
void Player_SetModels(Player* this, s32 modelGroup) {
|
||||||
|
// Left hand
|
||||||
this->leftHandType = gPlayerModelTypes[modelGroup][1];
|
this->leftHandType = gPlayerModelTypes[modelGroup][1];
|
||||||
this->rightHandType = gPlayerModelTypes[modelGroup][2];
|
this->leftHandDLists = &sPlayerDListGroups[this->leftHandType][gSaveContext.linkAge];
|
||||||
this->sheathType = gPlayerModelTypes[modelGroup][3];
|
|
||||||
|
|
||||||
this->leftHandDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][1]][gSaveContext.linkAge];
|
// Right hand
|
||||||
this->rightHandDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][2]][gSaveContext.linkAge];
|
this->rightHandType = gPlayerModelTypes[modelGroup][2];
|
||||||
this->sheathDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][3]][gSaveContext.linkAge];
|
this->rightHandDLists = &sPlayerDListGroups[this->rightHandType][gSaveContext.linkAge];
|
||||||
|
|
||||||
|
if (CVarGetInteger("gBowSlingShotAmmoFix", 0) && this->rightHandType == 11) { // If holding Bow/Slingshot
|
||||||
|
this->rightHandDLists = &sPlayerDListGroups[this->rightHandType][Player_HoldsSlingshot(this)];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sheath
|
||||||
|
this->sheathType = gPlayerModelTypes[modelGroup][3];
|
||||||
|
this->sheathDLists = &sPlayerDListGroups[this->sheathType][gSaveContext.linkAge];
|
||||||
|
|
||||||
|
// Waist
|
||||||
this->waistDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][4]][gSaveContext.linkAge];
|
this->waistDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][4]][gSaveContext.linkAge];
|
||||||
|
|
||||||
Player_SetModelsForHoldingShield(this);
|
Player_SetModelsForHoldingShield(this);
|
||||||
@ -539,6 +549,22 @@ s32 Player_HoldsHookshot(Player* this) {
|
|||||||
return (this->heldItemAction == PLAYER_IA_HOOKSHOT) || (this->heldItemAction == PLAYER_IA_LONGSHOT);
|
return (this->heldItemAction == PLAYER_IA_HOOKSHOT) || (this->heldItemAction == PLAYER_IA_LONGSHOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s32 Player_HoldsBow(Player* this) {
|
||||||
|
switch(this->heldItemAction){
|
||||||
|
case PLAYER_IA_BOW:
|
||||||
|
case PLAYER_IA_BOW_FIRE:
|
||||||
|
case PLAYER_IA_BOW_ICE:
|
||||||
|
case PLAYER_IA_BOW_LIGHT:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 Player_HoldsSlingshot(Player* this) {
|
||||||
|
return this->heldItemAction == PLAYER_IA_SLINGSHOT;
|
||||||
|
}
|
||||||
|
|
||||||
s32 func_8008F128(Player* this) {
|
s32 func_8008F128(Player* this) {
|
||||||
return Player_HoldsHookshot(this) && (this->heldActor == NULL);
|
return Player_HoldsHookshot(this) && (this->heldActor == NULL);
|
||||||
}
|
}
|
||||||
@ -1067,14 +1093,26 @@ s32 func_800902F0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s
|
|||||||
} else if (limbIndex == PLAYER_LIMB_L_FOREARM) {
|
} else if (limbIndex == PLAYER_LIMB_L_FOREARM) {
|
||||||
*dList = sArmOutDLs[gSaveContext.linkAge];
|
*dList = sArmOutDLs[gSaveContext.linkAge];
|
||||||
} else if (limbIndex == PLAYER_LIMB_L_HAND) {
|
} else if (limbIndex == PLAYER_LIMB_L_HAND) {
|
||||||
*dList = sHandOutDLs[gSaveContext.linkAge];
|
s32 handOutDlIndex = gSaveContext.linkAge;
|
||||||
|
if (CVarGetInteger("gBowSlingShotAmmoFix", 0) && LINK_IS_ADULT && Player_HoldsSlingshot(this)) {
|
||||||
|
handOutDlIndex = 1;
|
||||||
|
}
|
||||||
|
*dList = sHandOutDLs[handOutDlIndex];
|
||||||
} else if (limbIndex == PLAYER_LIMB_R_SHOULDER) {
|
} else if (limbIndex == PLAYER_LIMB_R_SHOULDER) {
|
||||||
*dList = sRightShoulderNearDLs[gSaveContext.linkAge];
|
*dList = sRightShoulderNearDLs[gSaveContext.linkAge];
|
||||||
} else if (limbIndex == PLAYER_LIMB_R_FOREARM) {
|
} else if (limbIndex == PLAYER_LIMB_R_FOREARM) {
|
||||||
*dList = D_80125F30[gSaveContext.linkAge];
|
*dList = D_80125F30[gSaveContext.linkAge];
|
||||||
} else if (limbIndex == PLAYER_LIMB_R_HAND) {
|
} else if (limbIndex == PLAYER_LIMB_R_HAND) {
|
||||||
|
s32 firstPersonWeaponIndex = gSaveContext.linkAge;
|
||||||
|
if (CVarGetInteger("gBowSlingShotAmmoFix", 0)) {
|
||||||
|
if (Player_HoldsBow(this)) {
|
||||||
|
firstPersonWeaponIndex = 0;
|
||||||
|
} else if (Player_HoldsSlingshot(this)) {
|
||||||
|
firstPersonWeaponIndex = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
*dList = Player_HoldsHookshot(this) ? gLinkAdultRightHandHoldingHookshotFarDL
|
*dList = Player_HoldsHookshot(this) ? gLinkAdultRightHandHoldingHookshotFarDL
|
||||||
: sHoldingFirstPersonWeaponDLs[gSaveContext.linkAge];
|
: sHoldingFirstPersonWeaponDLs[firstPersonWeaponIndex];
|
||||||
} else {
|
} else {
|
||||||
*dList = NULL;
|
*dList = NULL;
|
||||||
}
|
}
|
||||||
@ -1447,7 +1485,11 @@ void func_80090D20(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void
|
|||||||
if (this->rightHandType == 0xFF) {
|
if (this->rightHandType == 0xFF) {
|
||||||
Matrix_Get(&this->shieldMf);
|
Matrix_Get(&this->shieldMf);
|
||||||
} else if ((this->rightHandType == 11) || (this->rightHandType == 12)) {
|
} else if ((this->rightHandType == 11) || (this->rightHandType == 12)) {
|
||||||
BowStringData* stringData = &sBowStringData[gSaveContext.linkAge];
|
s32 stringModelToUse = gSaveContext.linkAge;
|
||||||
|
if(CVarGetInteger("gBowSlingShotAmmoFix", 0)){
|
||||||
|
stringModelToUse = Player_HoldsSlingshot(this);
|
||||||
|
}
|
||||||
|
BowStringData* stringData = &sBowStringData[stringModelToUse];
|
||||||
|
|
||||||
OPEN_DISPS(play->state.gfxCtx);
|
OPEN_DISPS(play->state.gfxCtx);
|
||||||
|
|
||||||
|
@ -4920,11 +4920,13 @@ s32 func_8083AD4C(PlayState* play, Player* this) {
|
|||||||
|
|
||||||
if (this->unk_6AD == 2) {
|
if (this->unk_6AD == 2) {
|
||||||
if (func_8002DD6C(this)) {
|
if (func_8002DD6C(this)) {
|
||||||
if (LINK_IS_ADULT) {
|
bool shouldUseBowCamera = LINK_IS_ADULT;
|
||||||
cameraMode = CAM_MODE_BOWARROW;
|
|
||||||
} else {
|
if(CVarGetInteger("gBowSlingShotAmmoFix", 0)){
|
||||||
cameraMode = CAM_MODE_SLINGSHOT;
|
shouldUseBowCamera = this->heldItemAction != PLAYER_IA_SLINGSHOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cameraMode = shouldUseBowCamera ? CAM_MODE_BOWARROW : CAM_MODE_SLINGSHOT;
|
||||||
} else {
|
} else {
|
||||||
cameraMode = CAM_MODE_BOOMERANG;
|
cameraMode = CAM_MODE_BOOMERANG;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user