From 2cc9dcd19360982899322ad878315a3eedee7a36 Mon Sep 17 00:00:00 2001 From: LittlePlanetCD Date: Sun, 1 Sep 2024 23:23:33 -0500 Subject: [PATCH] fix Word 1 spacing & add Case 0 (it was missing) --- RSDKv3/Script.cpp | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/RSDKv3/Script.cpp b/RSDKv3/Script.cpp index e7ea813e..e1ac5965 100644 --- a/RSDKv3/Script.cpp +++ b/RSDKv3/Script.cpp @@ -3112,6 +3112,40 @@ void ProcessScript(int scriptCodeStart, int jumpTableStart, byte scriptSub) switch (scriptEng.operands[3]) { default: break; + case 0: // Draw Word 1 (but aligned from the right instead of left) + charID = 0; + for (charID = 0;; ++charID) { + int nextChar = titleCardText[charID + 1]; + if (nextChar == '-' || !nextChar) + break; + } + + while (charID >= 0) { + int character = titleCardText[charID]; + if (character == ' ') + character = -1; // special space char + if (character == '-') + character = 0; + if (character >= '0' && character <= '9') + character -= 22; + if (character > '9' && character < 'f') + character -= 'A'; + + if (character <= -1) { + scriptEng.operands[1] -= scriptEng.operands[5] + scriptEng.operands[6]; // spaceWidth + spacing + } + else { + character += scriptEng.operands[0]; + spriteFrame = &scriptFrames[scriptInfo->frameListOffset + character]; + + scriptEng.operands[1] -= spriteFrame->width + scriptEng.operands[6]; + + DrawSprite(scriptEng.operands[1] + spriteFrame->pivotX, scriptEng.operands[2] + spriteFrame->pivotY, + spriteFrame->width, spriteFrame->height, spriteFrame->sprX, spriteFrame->sprY, scriptInfo->spriteSheetID); + } + charID--; + } + break; case 1: // Draw Word 1 charID = 0; @@ -3121,7 +3155,7 @@ void ProcessScript(int scriptCodeStart, int jumpTableStart, byte scriptSub) if (scriptEng.operands[4] == 1 && titleCardText[charID] != 0) { int character = titleCardText[charID]; if (character == ' ') - character = 0; + character = -1; if (character == '-') character = 0; if (character >= '0' && character <= '9') @@ -3147,7 +3181,7 @@ void ProcessScript(int scriptCodeStart, int jumpTableStart, byte scriptSub) while (titleCardText[charID] != 0 && titleCardText[charID] != '-') { int character = titleCardText[charID]; if (character == ' ') - character = 0; + character = -1; if (character == '-') character = 0; if (character > '/' && character < ':')