From 68fcc5921b022a2ea2a251c1d8d58da696aef21f Mon Sep 17 00:00:00 2001 From: Jordan Longstaff Date: Mon, 14 Oct 2024 01:41:30 -0400 Subject: [PATCH] Fix text speed enhancement with slowed down text (#4072) * Correct behaviour of text speed enhancement The text speed enhancement increases the size of the text crawl in the number of characters displayed in each step. This messes up certain parts of dialogue that were meant to be displayed in a certain way (like Ganondorf's "Heh heh heh..."), and in places where the text crawl is meant to be slower than normal, it just looks clunky. The text crawl speed enhancement is a wonderful feature, but smoothing out should be easily doable, and is a more correct implementation. * Fix text speed for normal text * Flatten if statements --- soh/src/code/z_message_PAL.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/soh/src/code/z_message_PAL.c b/soh/src/code/z_message_PAL.c index 4e1dc8692..4736f95a7 100644 --- a/soh/src/code/z_message_PAL.c +++ b/soh/src/code/z_message_PAL.c @@ -835,6 +835,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { u16 i; u16 sfxHi; u16 charTexIdx; + int gTextSpeed; Font* font = &play->msgCtx.font; Gfx* gfx = *gfxP; @@ -1115,11 +1116,17 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { break; } } - if (msgCtx->textDelayTimer == 0) { - msgCtx->textDrawPos = i + CVarGetInteger(CVAR_ENHANCEMENT("TextSpeed"), 1); + + gTextSpeed = CVarGetInteger(CVAR_ENHANCEMENT("TextSpeed"), 1); + if (msgCtx->textDelay == 0) { + msgCtx->textDrawPos = i + gTextSpeed; + } else if (msgCtx->textDelayTimer == 0) { + msgCtx->textDrawPos = i + 1; msgCtx->textDelayTimer = msgCtx->textDelay; + } else if (msgCtx->textDelayTimer <= gTextSpeed) { + msgCtx->textDelayTimer = 0; } else { - msgCtx->textDelayTimer--; + msgCtx->textDelayTimer -= gTextSpeed; } *gfxP = gfx; }