summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Dubé <159546+serprex@users.noreply.github.com>2026-05-29 02:50:02 +0000
committerGitHub <noreply@github.com>2026-05-29 02:50:02 +0000
commitd09cd4ffcda23d0413bca2f943a0d91961f93e8b (patch)
tree097f58481cafa43206fa487084ade480a1b5a043
parenta57cdc6f775e147b12469e10cd9835ba2e57fc09 (diff)
Fix sword scaling (#6558)
Don't apply transforms when scale 1.0, adjust translation to be gradual
-rw-r--r--soh/src/code/z_player_lib.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c
index 79bf0bfb6..89faa95ad 100644
--- a/soh/src/code/z_player_lib.c
+++ b/soh/src/code/z_player_lib.c
@@ -1316,12 +1316,14 @@ s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx**
if (limbIndex == PLAYER_LIMB_HEAD) {
if (CVarGetInteger(CVAR_COSMETIC("Link.HeadScale.Changed"), 0)) {
f32 scale = CVarGetFloat(CVAR_COSMETIC("Link.HeadScale.Value"), 1.0f);
- Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
- if (scale > 1.2f) {
- Matrix_Translate(-((LINK_IS_ADULT ? 320.0f : 200.0f) * scale), 0.0f, 0.0f, MTXMODE_APPLY);
- } else if (scale < 1.0f) {
- Matrix_Translate((LINK_IS_ADULT ? 3600.0f : 2900.0f) * ABS(scale - 1.0f), 0.0f, 0.0f,
- MTXMODE_APPLY);
+ if (scale != 1.0f) {
+ Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
+ if (scale > 1.2f) {
+ Matrix_Translate(-((LINK_IS_ADULT ? 320.0f : 200.0f) * scale), 0.0f, 0.0f, MTXMODE_APPLY);
+ } else if (scale < 1.0f) {
+ Matrix_Translate((LINK_IS_ADULT ? 3600.0f : 2900.0f) * ABS(scale - 1.0f), 0.0f, 0.0f,
+ MTXMODE_APPLY);
+ }
}
}
rot->x += this->headLimbRot.z;
@@ -1330,8 +1332,10 @@ s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx**
} else if (limbIndex == PLAYER_LIMB_L_HAND) {
if (CVarGetInteger(CVAR_COSMETIC("Link.SwordScale.Changed"), 0)) {
f32 scale = CVarGetFloat(CVAR_COSMETIC("Link.SwordScale.Value"), 1.0f);
- Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
- Matrix_Translate(-((LINK_IS_ADULT ? 320.0f : 200.0f) * scale), 0.0f, 0.0f, MTXMODE_APPLY);
+ if (scale != 1.0f) {
+ Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
+ Matrix_Translate(-((LINK_IS_ADULT ? 320.0f : 200.0f) * (scale - 1.0f)), 0.0f, 0.0f, MTXMODE_APPLY);
+ }
}
} else if (limbIndex == PLAYER_LIMB_UPPER) {
if (this->upperLimbYawSecondary != 0) {