From 1e16e2bd9dd7c0bf4d870a4084e21bef4ed0abe3 Mon Sep 17 00:00:00 2001 From: PurpleHato <47987542+PurpleHato@users.noreply.github.com> Date: Fri, 12 Jan 2024 20:39:33 +0100 Subject: [PATCH 1/2] ADD: Cape --- soh/soh/SohMenuBar.cpp | 13 +++++++++- .../ovl_En_Ganon_Mant/z_en_ganon_mant.c | 11 +++++--- .../actors/ovl_player_actor/z_player.c | 25 +++++++++++++++++++ 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index 7c1f51cf1c8..f89cfd4745a 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -104,6 +104,7 @@ static const char* imguiScaleOptions[4] = { "Small", "Normal", "Large", "X-Large "OHKO" }; static const char* timeTravelOptions[3] = { "Disabled", "Ocarina of Time", "Any Ocarina" }; + static const char* capeTypes[3] = { "None", "Cape", "Scarf" }; extern "C" SaveContext gSaveContext; @@ -967,7 +968,17 @@ void DrawEnhancementsMenu() { UIWidgets::Tooltip("Turns Bunny Hood invisible while still maintaining its effects."); UIWidgets::PaddedEnhancementCheckbox("Disable HUD Heart animations", "gNoHUDHeartAnimation", true, false); UIWidgets::Tooltip("Disables the beating animation of the hearts on the HUD."); - + UIWidgets::PaddedSeparator(true, true, 2.0f, 2.0f); + UIWidgets::PaddedText("Link's Cape", true, false); + UIWidgets::EnhancementCombobox("gLinkCape", capeTypes, 0); + UIWidgets::Tooltip("Gives Link Ganondorf's cape\nTime to get some drip"); + + if (CVarGetInteger("gLinkCape", 0) != 0) { + UIWidgets::PaddedEnhancementSliderFloat("Cape Length: %d", "##Cape_Length", "gLinkCapeLength", 0.5f, 9.5f, "", 3.5f, true, true, false, true); + UIWidgets::PaddedEnhancementSliderFloat("Cape Shoulders Width: %d", "##Cape_Width", "gLinkCapeWidth", 1.0f, 20.0f, "", 10.0f, true, true, false, true); + UIWidgets::PaddedEnhancementSliderFloat("Cape Side Sway Magnitude: %d", "##Cape_sideSwayMagnitude", "gLinkCapesideSwayMagnitude", -20.0f, 0.0f, "", 0.0f, true, true, false, true); + UIWidgets::PaddedEnhancementSliderFloat("Cape Gravity: %d", "##Cape_Gravity", "gLinkCapeGravity", -15.0f, -0.5f, "", -2.5f, true, true, false, true); + } ImGui::EndMenu(); } UIWidgets::PaddedEnhancementCheckbox("Disable LOD", "gDisableLOD", true, false); diff --git a/soh/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c b/soh/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c index 0fc08ba4aff..a52de816d15 100644 --- a/soh/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c +++ b/soh/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c @@ -176,6 +176,11 @@ void EnGanonMant_UpdateStrand(PlayState* play, EnGanonMant* this, Vec3f* root, V Vec3f sideSwayOffset; delta.y = 0; + + if (CVarGetInteger("gLinkCape", 0) != 0) { + jointLength = CVarGetFloat("gLinkCapeLength", 3.5f); + } + if (this->actor.params == 0x23) { // Pushes all the strands away from the actor delta.x = 0.0f; @@ -187,9 +192,9 @@ void EnGanonMant_UpdateStrand(PlayState* play, EnGanonMant* this, Vec3f* root, V (pos + i)->z += posStep.z; } // Set length - jointLength = 6.5f; + jointLength; } else { - jointLength = 9.5f; + jointLength; } for (i = 0; i < GANON_MANT_NUM_JOINTS; i++, pos++, vel++, rot++, nextPos++) { @@ -356,7 +361,7 @@ void EnGanonMant_Update(Actor* thisx, PlayState* play) { this->attachShouldersTimer -= 1.0f; } - this->actor.shape.rot.y = ganon->actor.shape.rot.y; + this->actor.shape.rot.y = GET_PLAYER(play)->actor.shape.rot.y; if (this->tearTimer != 0) { this->tearTimer--; diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index 523e7cf113d..69c711ebc7b 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -30,6 +30,7 @@ #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/Enhancements/randomizer/randomizer_grotto.h" #include "soh/frame_interpolation.h" +#include #include #include @@ -9976,6 +9977,7 @@ static void (*D_80854738[])(PlayState* play, Player* this) = { }; static Vec3f D_80854778 = { 0.0f, 50.0f, 0.0f }; +EnGanonMant* sLinkCape; void Player_Init(Actor* thisx, PlayState* play2) { Player* this = (Player*)thisx; @@ -10103,6 +10105,8 @@ void Player_Init(Actor* thisx, PlayState* play2) { Map_SavePlayerInitialInfo(play); MREG(64) = 0; + + sLinkCape = (EnGanonMant*)Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_EN_GANON_MANT, 0.0f, 0.0f, 0.0f, 0, 0, 0, 1); } void func_808471F4(s16* pValue) { @@ -11666,6 +11670,27 @@ void Player_DrawGameplay(PlayState* play, Player* this, s32 lod, Gfx* cullDList, } } + sLinkCape->backPush = -9.0f; + sLinkCape->backSwayMagnitude = 0.0f; + sLinkCape->sideSwayMagnitude = CVarGetFloat("gLinkCapesideSwayMagnitude", 0.0f); + sLinkCape->minDist = CVarGetFloat("gLinkCapeWidth", 10.0f); + sLinkCape->gravity = CVarGetFloat("gLinkCapeGravity", -2.5f); + + sLinkCape->actor.world.pos = this->actor.world.pos; + + if (CVarGetInteger("gLinkCape", 0) == 1) { + sLinkCape->rightForearmPos = this->bodyPartsPos[PLAYER_BODYPART_R_SHOULDER]; + sLinkCape->leftForearmPos = this->bodyPartsPos[PLAYER_BODYPART_L_SHOULDER]; + } else if (CVarGetInteger("gLinkCape", 0) == 2) { + sLinkCape->rightForearmPos = this->bodyPartsPos[PLAYER_BODYPART_R_SHOULDER]; + sLinkCape->leftForearmPos = this->bodyPartsPos[PLAYER_BODYPART_HEAD]; + } + + sLinkCape->rightForearmPos.y += 2; + sLinkCape->leftForearmPos.y += 2; + + sLinkCape->minY = this->actor.world.pos.y - 0.1f; + CLOSE_DISPS(play->state.gfxCtx); } From 5a8124c77ff7b4e49ae1600fe6414ec979f2459b Mon Sep 17 00:00:00 2001 From: PurpleHato <47987542+PurpleHato@users.noreply.github.com> Date: Fri, 12 Jan 2024 21:36:32 +0100 Subject: [PATCH 2/2] Fix Crash --- soh/src/overlays/actors/ovl_player_actor/z_player.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index 69c711ebc7b..9c84a33452c 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -11685,6 +11685,9 @@ void Player_DrawGameplay(PlayState* play, Player* this, s32 lod, Gfx* cullDList, sLinkCape->rightForearmPos = this->bodyPartsPos[PLAYER_BODYPART_R_SHOULDER]; sLinkCape->leftForearmPos = this->bodyPartsPos[PLAYER_BODYPART_HEAD]; } + else { + return; + } sLinkCape->rightForearmPos.y += 2; sLinkCape->leftForearmPos.y += 2;