From d09cd4ffcda23d0413bca2f943a0d91961f93e8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= <159546+serprex@users.noreply.github.com> Date: Fri, 29 May 2026 02:50:02 +0000 Subject: [PATCH] Fix sword scaling (#6558) Don't apply transforms when scale 1.0, adjust translation to be gradual --- soh/src/code/z_player_lib.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index 79bf0bfb6b..89faa95ad5 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) {