Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
LittlePlanetCD committed Sep 2, 2024
2 parents 787675d + 2cc9dcd commit 6f267af
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 @@ -3115,6 +3115,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 @@ -3124,7 +3158,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 @@ -3150,7 +3184,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 6f267af

Please sign in to comment.