Skip to content
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
71 changes: 71 additions & 0 deletions soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2266,6 +2266,7 @@ static const char* colorSchemes[2] = {
"N64",
"Gamecube",
};
static const char* capeTypes[4] = { "None", "Cape", "Scarf", "Hips" };

void CosmeticsEditorWindow::ApplyDungeonKeyColors() {
// Keyring
Expand Down Expand Up @@ -2467,6 +2468,76 @@ void CosmeticsEditorWindow::DrawElement() {
UIWidgets::Separator(true, true, 2.0f, 2.0f);

DrawCosmeticGroup(COSMETICS_GROUP_LINK);
ImGui::Text("Cape and Scarf");

UIWidgets::CVarCombobox("Type", CVAR_COSMETIC("DefaultCapeType"), capeTypes,
UIWidgets::ComboboxOptions()
.DefaultIndex(CAPE_NONE)
.Color(THEME_COLOR)
.LabelPosition(UIWidgets::LabelPositions::Near)
.ComponentAlignment(UIWidgets::ComponentAlignments::Right));

if (UIWidgets::CVarSliderFloat("Length", CVAR_COSMETIC("Link.Cape.Length.Value"),
UIWidgets::FloatSliderOptions()
.Format("%.1f")
.Min(0.5f)
.Max(9.5f)
.DefaultValue(3.5f)
.Step(0.1f)
.Size(ImVec2(300.0f, 0.0f))
.Color(THEME_COLOR))) {
CVarSetInteger(CVAR_COSMETIC("Link.Cape.Length.Changed"), 1);
}

if (UIWidgets::CVarSliderFloat("Shoulder Width", CVAR_COSMETIC("Link.Cape.Shoulder.Value"),
UIWidgets::FloatSliderOptions()
.Format("%.1f")
.Min(1.0f)
.Max(20.0f)
.DefaultValue(10.0f)
.Step(0.1f)
.Size(ImVec2(300.0f, 0.0f))
.Color(THEME_COLOR))) {
CVarSetInteger(CVAR_COSMETIC("Link.Cape.Shoulder.Changed"), 1);
}

if (UIWidgets::CVarSliderFloat("Back Push", CVAR_COSMETIC("Link.Cape.Backpush.Value"),
UIWidgets::FloatSliderOptions()
.Format("%.1f")
.Min(-10.0f)
.Max(0.0f)
.DefaultValue(-9.0f)
.Step(0.1f)
.Size(ImVec2(300.0f, 0.0f))
.Color(THEME_COLOR))) {
CVarSetInteger(CVAR_COSMETIC("Link.Cape.Backpush.Changed"), 1);
}

if (UIWidgets::CVarSliderFloat("Side Sway Magnitude", CVAR_COSMETIC("Link.Cape.Sway.Value"),
UIWidgets::FloatSliderOptions()
.Format("%.1f")
.Min(-20.0f)
.Max(0.0f)
.DefaultValue(0.0f)
.Step(0.1f)
.Size(ImVec2(300.0f, 0.0f))
.Color(THEME_COLOR))) {
CVarSetInteger(CVAR_COSMETIC("Link.Cape.Sway.Changed"), 1);
}

if (UIWidgets::CVarSliderFloat("Gravity Force", CVAR_COSMETIC("Link.Cape.Gravity.Value"),
UIWidgets::FloatSliderOptions()
.Format("%.1f")
.Min(-15.0f)
.Max(-0.5f)
.DefaultValue(-2.5f)
.Step(0.1f)
.Size(ImVec2(300.0f, 0.0f))
.Color(THEME_COLOR))) {
CVarSetInteger(CVAR_COSMETIC("Link.Cape.Gravity.Changed"), 1);
}

UIWidgets::Separator(true, true, 2.0f, 2.0f);
DrawCosmeticGroup(COSMETICS_GROUP_GLOVES);
DrawCosmeticGroup(COSMETICS_GROUP_MIRRORSHIELD);
DrawCosmeticGroup(COSMETICS_GROUP_EQUIPMENT);
Expand Down
7 changes: 7 additions & 0 deletions soh/soh/Enhancements/cosmetics/cosmeticsTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,10 @@ typedef enum {
HIDDEN,
ANCHOR_TO_LIFE_METER,
} PosType;

typedef enum {
CAPE_NONE,
CAPE_CAPE,
CAPE_SCARF,
CAPE_HIPS,
} DefaultCapeStyle;
13 changes: 10 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 @@ -101,6 +101,7 @@ static u16 sVerticesMap[GANON_MANT_NUM_STRANDS * GANON_MANT_NUM_JOINTS] = {
static u8 sMaskTex[MANT_TEX_WIDTH * MANT_TEX_HEIGHT] = { { 0 } };

#include "overlays/ovl_En_Ganon_Mant/ovl_En_Ganon_Mant.h"
#include <soh/Enhancements/cosmetics/cosmeticsTypes.h>

void EnGanonMant_Init(Actor* thisx, PlayState* play) {
EnGanonMant* this = (EnGanonMant*)thisx;
Expand Down Expand Up @@ -178,6 +179,12 @@ void EnGanonMant_UpdateStrand(PlayState* play, EnGanonMant* this, Vec3f* root, V
Vec3f sideSwayOffset;

delta.y = 0;

if (CVarGetInteger(CVAR_COSMETIC("DefaultCapeType"), 0) != CAPE_NONE) {
jointLength = CVarGetFloat(CVAR_COSMETIC("Link.Cape.Length.Value"), 3.5f);
CVarGetFloat(CVAR_COSMETIC("Link.Cape.Length.Value"), 3.5f);
}

if (this->actor.params == 0x23) {
// Pushes all the strands away from the actor
delta.x = 0.0f;
Expand All @@ -189,9 +196,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 @@ -358,7 +365,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
31 changes: 31 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 @@ -33,6 +33,7 @@
#include "soh/frame_interpolation.h"
#include "soh/OTRGlobals.h"
#include "soh/ResourceManagerHelpers.h"
#include <overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.h>

#include <string.h>
#include <stdlib.h>
Expand Down Expand Up @@ -10834,6 +10835,7 @@ static void (*sStartModeFuncs[PLAYER_START_MODE_MAX])(PlayState* play, Player* t
};

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 @@ -10964,6 +10966,9 @@ 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 Player_ApproachZeroBinang(s16* pValue) {
Expand Down Expand Up @@ -12618,6 +12623,32 @@ void Player_DrawGameplay(PlayState* play, Player* this, s32 lod, Gfx* cullDList,
}
}

sLinkCape->backPush = CVarGetFloat(CVAR_COSMETIC("Link.Cape.Backpush.Value"), -9.0f);
sLinkCape->backSwayMagnitude = 0.0f;
sLinkCape->sideSwayMagnitude = CVarGetFloat(CVAR_COSMETIC("Link.Cape.Sway.Value"), 0.0f);
sLinkCape->minDist = CVarGetFloat(CVAR_COSMETIC("Link.Cape.Shoulder.Value"), 10.0f);
sLinkCape->gravity = CVarGetFloat(CVAR_COSMETIC("Link.Cape.Gravity.Value"), -2.5f);

sLinkCape->actor.world.pos = this->actor.world.pos;

if (CVarGetInteger(CVAR_COSMETIC("DefaultCapeType"), 0) == CAPE_CAPE) {
sLinkCape->rightForearmPos = this->bodyPartsPos[PLAYER_BODYPART_R_SHOULDER];
sLinkCape->leftForearmPos = this->bodyPartsPos[PLAYER_BODYPART_L_SHOULDER];
} else if (CVarGetInteger(CVAR_COSMETIC("DefaultCapeType"), 0) == CAPE_SCARF) {
sLinkCape->rightForearmPos = this->bodyPartsPos[PLAYER_BODYPART_R_SHOULDER];
sLinkCape->leftForearmPos = this->bodyPartsPos[PLAYER_BODYPART_HEAD];
} else if (CVarGetInteger(CVAR_COSMETIC("DefaultCapeType"), 0) == CAPE_HIPS) {
sLinkCape->rightForearmPos = this->bodyPartsPos[PLAYER_BODYPART_L_SHIN];
sLinkCape->leftForearmPos = this->bodyPartsPos[PLAYER_BODYPART_TORSO];
} 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