Skip to content

Commit

Permalink
fix Word 1 spacing & add Case 0 (it was missing)
Browse files Browse the repository at this point in the history
  • Loading branch information
LittlePlanetCD committed Sep 2, 2024
1 parent a08c065 commit 2cc9dcd
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions RSDKv3/Script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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')
Expand All @@ -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 < ':')
Expand Down

0 comments on commit 2cc9dcd

Please sign in to comment.