Moved to own branch

This commit is contained in:
Patrick12115 2024-01-29 20:10:14 -05:00
parent 3e91d5565a
commit 417b434738
3 changed files with 72 additions and 2 deletions

View File

@ -23,6 +23,8 @@
#include "src/overlays/actors/ovl_En_Tp/z_en_tp.h"
#include "src/overlays/actors/ovl_En_Firefly/z_en_firefly.h"
#include "src/overlays/actors/ovl_En_Xc/z_en_xc.h"
#include "objects/object_link_boy/object_link_boy.h"
#include "objects/object_link_child/object_link_child.h"
extern "C" {
#include <z64.h>
@ -687,6 +689,28 @@ void RegisterMirrorModeHandler() {
});
}
void RegisterPatchChildHylianSHieldHandler() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
if ((CVarGetInteger("gRotateScaleChildHylianShield", 0) && LINK_IS_CHILD) &&
(gSaveContext.equips.buttonItems[0] == ITEM_SWORD_KOKIRI)) {
ResourceMgr_PatchGfxByName(gLinkAdultHylianShieldSwordAndSheathNearDL, "childHylianShield1", 82,
gsSPDisplayListOTRFilePath(gLinkChildSwordAndSheathNearDL));
ResourceMgr_PatchGfxByName(gLinkAdultHylianShieldSwordAndSheathNearDL, "childHylianShield2", 83,
gsSPEndDisplayList());
} else {
ResourceMgr_UnpatchGfxByName(gLinkAdultHylianShieldSwordAndSheathNearDL, "childHylianShield1");
ResourceMgr_UnpatchGfxByName(gLinkAdultHylianShieldSwordAndSheathNearDL, "childHylianShield2");
}
if ((CVarGetInteger("gRotateScaleChildHylianShield", 0) && LINK_IS_CHILD) &&
(gSaveContext.equips.buttonItems[0] == ITEM_NONE || gSaveContext.equips.buttonItems[0] == ITEM_STICK)) {
ResourceMgr_PatchGfxByName(gLinkAdultHylianShieldSwordAndSheathNearDL, "childHylianShield3", 82,
gsSPEndDisplayList());
} else {
ResourceMgr_UnpatchGfxByName(gLinkAdultHylianShieldSwordAndSheathNearDL, "childHylianShield3");
}
});
}
f32 triforcePieceScale;
void RegisterTriforceHunt() {

View File

@ -1337,6 +1337,12 @@ void DrawCheatsMenu() {
UIWidgets::Tooltip("Prevents the Deku Shield from burning on contact with fire");
UIWidgets::PaddedEnhancementCheckbox("Shield with Two-Handed Weapons", "gShieldTwoHanded", true, false);
UIWidgets::Tooltip("This allows you to put up your shield with any two-handed weapon in hand except for Deku Sticks");
UIWidgets::PaddedEnhancementCheckbox("Hold Hylian Shield as Child Link", "gChildHoldsHylianShield", true, false);
UIWidgets::Tooltip("Allows Child Link to hold the Hylian Shield the same way as the rest of the shields.");
if (CVarGetInteger("gChildHoldsHylianShield", 0) == 1) {
UIWidgets::PaddedEnhancementCheckbox("Rotate and Scale Child Hylian Shield", "gRotateScaleChildHylianShield", true, false);
UIWidgets::Tooltip("Rotates and scales the hylian shield for Child Link, so that it is the same orientation as the other shields. May not work properly with some mods.");
}
UIWidgets::Spacer(2.0f);
ImGui::Text("Deku Sticks:");
UIWidgets::EnhancementCombobox("gDekuStickCheat", DekuStickCheat, DEKU_STICK_NORMAL);

View File

@ -580,7 +580,11 @@ s32 func_8008E9C4(Player* this) {
}
s32 Player_IsChildWithHylianShield(Player* this) {
return gSaveContext.linkAge != 0 && (this->currentShield == PLAYER_SHIELD_HYLIAN);
if (CVarGetInteger("gChildHoldsHylianShield", 0)) {
return 0;
} else {
return gSaveContext.linkAge != 0 && (this->currentShield == PLAYER_SHIELD_HYLIAN);
}
}
s32 Player_ActionToModelGroup(Player* this, s32 actionParam) {
@ -600,7 +604,11 @@ void Player_SetModelsForHoldingShield(Player* this) {
if ((CVarGetInteger("gShieldTwoHanded", 0) && (this->heldItemAction != PLAYER_IA_DEKU_STICK) ||
!Player_HoldsTwoHandedWeapon(this)) && !Player_IsChildWithHylianShield(this)) {
this->rightHandType = PLAYER_MODELTYPE_RH_SHIELD;
this->rightHandDLists = &sPlayerDListGroups[PLAYER_MODELTYPE_RH_SHIELD][gSaveContext.linkAge];
if (LINK_IS_CHILD && (CVarGetInteger("gChildHoldsHylianShield", 0)) && (this->currentShield == PLAYER_SHIELD_HYLIAN)) {
this->rightHandDLists = &sPlayerDListGroups[PLAYER_MODELTYPE_RH_SHIELD][0];
} else {
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) {
@ -622,6 +630,10 @@ void Player_SetModels(Player* this, s32 modelGroup) {
this->rightHandType = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_RIGHT_HAND];
this->rightHandDLists = &sPlayerDListGroups[this->rightHandType][gSaveContext.linkAge];
if (LINK_IS_CHILD && CVarGetInteger("gChildHoldsHylianShield", 0) &&
this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD && this->currentShield == PLAYER_SHIELD_HYLIAN) {
this->rightHandDLists = &sPlayerDListGroups[this->rightHandType][0];
}
if (CVarGetInteger("gBowSlingShotAmmoFix", 0) && this->rightHandType == 11) { // If holding Bow/Slingshot
this->rightHandDLists = &sPlayerDListGroups[this->rightHandType][Player_HoldsSlingshot(this)];
}
@ -630,6 +642,13 @@ void Player_SetModels(Player* this, s32 modelGroup) {
this->sheathType = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_SHEATH];
this->sheathDLists = &sPlayerDListGroups[this->sheathType][gSaveContext.linkAge];
if (CVarGetInteger("gRotateScaleChildHylianShield", 0)) {
if (LINK_IS_CHILD && this->sheathType == PLAYER_MODELTYPE_SHEATH_18 && this->currentShield == PLAYER_SHIELD_HYLIAN &&
((gSaveContext.equips.buttonItems[0] == ITEM_SWORD_KOKIRI || gSaveContext.equips.buttonItems[0] == ITEM_NONE || gSaveContext.equips.buttonItems[0] == ITEM_STICK))) {
this->sheathDLists = &sPlayerDListGroups[this->sheathType][0];
}
}
// Waist
this->waistDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][4]][gSaveContext.linkAge];
@ -1188,6 +1207,27 @@ void func_8008F87C(PlayState* play, Player* this, SkelAnime* skelAnime, Vec3f* p
s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
Player* this = (Player*)thisx;
if (CVarGetInteger("gChildHoldsHylianShield", 0) && CVarGetInteger("gRotateScaleChildHylianShield", 0) &&
LINK_IS_CHILD) {
if (limbIndex == PLAYER_LIMB_SHEATH) {
if ((this->currentShield == PLAYER_SHIELD_HYLIAN &&
(gSaveContext.equips.buttonItems[0] == ITEM_SWORD_KOKIRI ||
gSaveContext.equips.buttonItems[0] == ITEM_NONE ||
gSaveContext.equips.buttonItems[0] == ITEM_STICK)) &&
((this->sheathType == PLAYER_MODELTYPE_SHEATH_18) ||
(this->sheathType == PLAYER_MODELTYPE_SHEATH_19))) {
Matrix_Translate(218, 0, 62, MTXMODE_APPLY);
Matrix_Scale(0.8, 0.8, 0.8, MTXMODE_APPLY);
}
}
if (limbIndex == PLAYER_LIMB_R_HAND) {
if (this->currentShield == PLAYER_SHIELD_HYLIAN && sRightHandType == PLAYER_MODELTYPE_RH_SHIELD &&
gSaveContext.equips.buttonItems[0] == ITEM_SWORD_KOKIRI) {
Matrix_Scale(0.8, 0.8, 0.8, MTXMODE_APPLY);
}
}
}
if (limbIndex == PLAYER_LIMB_ROOT) {
sLeftHandType = this->leftHandType;
sRightHandType = this->rightHandType;