Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MOD] Add a cape/scarf to Link #45

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion soh/soh/SohMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down
11 changes: 8 additions & 3 deletions soh/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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++) {
Expand Down Expand Up @@ -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--;
Expand Down
28 changes: 28 additions & 0 deletions soh/src/overlays/actors/ovl_player_actor/z_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.h>

#include <string.h>
#include <stdlib.h>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -11666,6 +11670,30 @@ 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];
}
else {
return;
}

sLinkCape->rightForearmPos.y += 2;
sLinkCape->leftForearmPos.y += 2;

sLinkCape->minY = this->actor.world.pos.y - 0.1f;

CLOSE_DISPS(play->state.gfxCtx);
}

Expand Down
Loading