Merge pull request #62 from Clownacy/master

Made TextScr.cpp as ASM-accurate as possible for now, and added a bugfix
This commit is contained in:
Cucky 2019-02-12 08:36:15 -05:00 committed by GitHub
commit f302c55978
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 429 additions and 388 deletions

View file

@ -1,2 +1,5 @@
Main.cpp : void SystemTask()
Pixel intended for the second alternate up key to be the plus key, Japanese keyboards have the plus key where the semi-colon key is, causing errors on other keyboard layouts)
SelStage.cpp : int StageSelectLoop(int *p_event)
The screencap that serves as the menu's background was being drawn with transparency enabled. This can cause moving sprites (like the text) to leave a trail.

View file

@ -165,7 +165,12 @@ int StageSelectLoop(int *p_event)
if (tscRet == 2)
return 2;
#ifdef FIX_BUGS
PutBitmap4(&rcView, 0, 0, &rcView, 10);
#else
// The original accidentally drew the screencap with transparency enabled
PutBitmap3(&rcView, 0, 0, &rcView, 10);
#endif
PutStageSelectObject();
PutTextScript();

View file

@ -34,6 +34,8 @@
#define TSC_BUFFER_SIZE 0x5000
#define TEXT_LEFT (WINDOW_WIDTH / 2 - 108)
TEXT_SCRIPT gTS;
int gNumberTextScript[4];
@ -42,7 +44,7 @@ char text[0x100];
RECT gRect_line = {0, 0, 216, 16};
//Initialize and end tsc
bool InitTextScript2()
BOOL InitTextScript2()
{
//Clear flags
gTS.mode = 0;
@ -57,7 +59,11 @@ bool InitTextScript2()
//Allocate script buffer
gTS.data = (char*)malloc(TSC_BUFFER_SIZE);
return gTS.data != nullptr;
if (gTS.data == NULL)
return FALSE;
else
return TRUE;
}
void EndTextScript()
@ -77,15 +83,18 @@ void EncryptionBinaryData2(uint8_t *pData, int size)
int val1;
int half = size / 2;
if (pData[half])
val1 = -pData[half];
else
if (pData[half] == 0)
val1 = -7;
else
val1 = (pData[half] % 256) * -1;
for (int i = 0; i < size; i++)
{
int work = pData[i];
work += val1;
if (i != half)
pData[i] += val1;
pData[i] = work % 256;
}
}
@ -162,14 +171,16 @@ void GetTextScriptPath(char *path)
//Get 4 digit number from TSC data
int GetTextScriptNo(int a)
{
return gTS.data[a + 3] - 48
+ 10 * gTS.data[a + 2] - 480
+ 100 * gTS.data[a + 1] - 4800
+ 1000 * gTS.data[a] - 48000;
int b = 0;
b += (gTS.data[a++] - '0') * 1000;
b += (gTS.data[a++] - '0') * 100;
b += (gTS.data[a++] - '0') * 10;
b += gTS.data[a] - '0';
return b;
}
//Start TSC event
bool StartTextScript(int no)
BOOL StartTextScript(int no)
{
//Reset state
gTS.mode = 1;
@ -185,34 +196,41 @@ bool StartTextScript(int no)
gMC.shock = 0;
gTS.rcText = {WINDOW_WIDTH / 2 - 108, WINDOW_HEIGHT - 56, WINDOW_WIDTH + 108, WINDOW_HEIGHT - 8};
gTS.rcText.left = TEXT_LEFT;
gTS.rcText.top = WINDOW_HEIGHT - 56;
gTS.rcText.right = WINDOW_WIDTH + 108;
gTS.rcText.bottom = gTS.rcText.top + 48;
/* This is present in the Linux port, but not the Windows version (1.0.0.6, at least)
//Clear text lines
for (int i = 0; i < 4; i++)
{
gTS.ypos_line[i] = 16 * i;
CortBox2(&gRect_line, 0x000000, i + 30);
memset(&text[i * 0x40], 0, 0x40);
}
}*/
//Find where event starts
for (gTS.p_read = 0; ; gTS.p_read++)
gTS.p_read = 0;
while (1)
{
//Check if we are still in the proper range
if (!gTS.data[gTS.p_read])
return false;
if (gTS.data[gTS.p_read] == '\0')
return FALSE;
//Check if we are at an event
if (gTS.data[gTS.p_read] != '#')
continue;
if (gTS.data[gTS.p_read] == '#')
{
//Check if this is our event
int event_no = GetTextScriptNo(++gTS.p_read);
if (no == event_no)
break;
if (no < event_no)
return false;
return FALSE;
}
++gTS.p_read;
}
//Advance until new-line
@ -220,10 +238,10 @@ bool StartTextScript(int no)
++gTS.p_read;
++gTS.p_read;
return true;
return TRUE;
}
bool JumpTextScript(int no)
BOOL JumpTextScript(int no)
{
//Set state
gTS.mode = 1;
@ -242,23 +260,26 @@ bool JumpTextScript(int no)
}
//Find where event starts
for (gTS.p_read = 0; ; gTS.p_read++)
gTS.p_read = 0;
while(1)
{
//Check if we are still in the proper range
if (!gTS.data[gTS.p_read])
return false;
if (gTS.data[gTS.p_read] == '\0')
return FALSE;
//Check if we are at an event
if (gTS.data[gTS.p_read] != '#')
continue;
if (gTS.data[gTS.p_read] == '#')
{
//Check if this is our event
int event_no = GetTextScriptNo(++gTS.p_read);
if (no == event_no)
break;
if (no < event_no)
return false;
return FALSE;
}
++gTS.p_read;
}
//Advance until new-line
@ -266,7 +287,7 @@ bool JumpTextScript(int no)
++gTS.p_read;
++gTS.p_read;
return true;
return TRUE;
}
//End event
@ -282,7 +303,7 @@ void StopTextScript()
//Prepare a new line
void CheckNewLine()
{
if (gTS.ypos_line[gTS.line % 4] == 48)
if (gTS.ypos_line[gTS.line % 4] == '0')
{
gTS.mode = 3;
g_GameFlags |= 4;
@ -305,24 +326,24 @@ void SetNumberTextScript(int index)
int b;
char str[5];
bool bZero = false;
BOOL bZero = false;
int offset = 0;
//Trim leading zeroes
for (int i = 0; i < 3; i++)
{
if (a / table[i] || bZero)
if (a / table[i] || bZero != FALSE)
{
//Do whatever the fuck this is
b = a / table[i];
str[offset] = b + 0x30;
bZero = true;
str[offset] = (char)b + '0';
bZero = TRUE;
a -= b * table[i];
++offset;
}
}
//Set last digit of string, and add null terminator
str[offset] = a + 0x30;
str[offset] = a + '0';
str[offset + 1] = 0;
//Append number to line
@ -336,7 +357,7 @@ void SetNumberTextScript(int index)
//Check if should move to next line (prevent a memory overflow, come on guys, this isn't a leftover of pixel trying to make text wrapping)
gTS.p_write += strlen(str);
if (gTS.p_write > 34)
if (gTS.p_write >= 35)
{
gTS.p_write = 0;
gTS.line++;
@ -362,18 +383,22 @@ void ClearTextLine()
//Draw textbox and whatever else
void PutTextScript()
{
if (gTS.mode && (gTS.flags & 1))
{
if (gTS.mode == 0)
return;
if ((gTS.flags & 1) == 0)
return;
//Set textbox position
if (gTS.flags & 0x20)
{
gTS.rcText.top = 32;
gTS.rcText.bottom = 80;
gTS.rcText.bottom = gTS.rcText.top + 48;
}
else
{
gTS.rcText.top = WINDOW_HEIGHT - 56;
gTS.rcText.bottom = WINDOW_HEIGHT - 8;
gTS.rcText.bottom = gTS.rcText.top + 48;
}
//Draw textbox
@ -383,21 +408,21 @@ void PutTextScript()
RECT rcFrame2 = {0, 8, 244, 16};
RECT rcFrame3 = {0, 16, 244, 24};
PutBitmap3(&grcFull, gTS.rcText.left - 14, gTS.rcText.top - 10, &rcFrame1, 26);
PutBitmap3(&grcFull, WINDOW_WIDTH / 2 - 122, gTS.rcText.top - 10, &rcFrame1, 26);
int i;
for (i = 1; i < 7; i++)
PutBitmap3(&grcFull, gTS.rcText.left - 14, 8 * i + gTS.rcText.top - 10, &rcFrame2, 26);
PutBitmap3(&grcFull, gTS.rcText.left - 14, 8 * i + gTS.rcText.top - 10, &rcFrame3, 26);
PutBitmap3(&grcFull, WINDOW_WIDTH / 2 - 122, 8 * i + gTS.rcText.top - 10, &rcFrame2, 26);
PutBitmap3(&grcFull, WINDOW_WIDTH / 2 - 122, 8 * i + gTS.rcText.top - 10, &rcFrame3, 26);
}
//Draw face picture
RECT rcFace;
rcFace.left = 48 * (gTS.face % 6);
rcFace.top = 48 * (gTS.face / 6);
rcFace.right = 48 * (gTS.face % 6) + 48;
rcFace.bottom = 48 * (gTS.face / 6) + 48;
rcFace.right = rcFace.left + 48;
rcFace.bottom = rcFace.top + 48;
if (gTS.face_x < (gTS.rcText.left << 9))
if (gTS.face_x < (TEXT_LEFT * 0x200))
gTS.face_x += 0x1000;
PutBitmap3(&gTS.rcText, gTS.face_x / 0x200, gTS.rcText.top - 3, &rcFace, 27);
@ -409,14 +434,14 @@ void PutTextScript()
text_offset = 0;
for (int i = 0; i < 4; i++)
PutBitmap3(&gTS.rcText, text_offset + gTS.rcText.left, gTS.offsetY + gTS.ypos_line[i] + gTS.rcText.top, &gRect_line, i + 30);
PutBitmap3(&gTS.rcText, text_offset + TEXT_LEFT, gTS.offsetY + gTS.ypos_line[i] + gTS.rcText.top, &gRect_line, i + 30);
//Draw NOD cursor
if ((gTS.wait_beam++ % 20 > 12) && gTS.mode == 2)
{
RECT rect;
rect.left = gTS.rcText.left + text_offset + 6 * gTS.p_write;
rect.top = gTS.rcText.top + gTS.ypos_line[gTS.line % 4] + gTS.offsetY;
rect.left = TEXT_LEFT + text_offset + 6 * gTS.p_write;
rect.top = gTS.ypos_line[gTS.line % 4] + gTS.rcText.top + gTS.offsetY;
rect.right = rect.left + 5;
rect.bottom = rect.top + 11;
CortBox(&rect, 0xFFFFFE);
@ -442,21 +467,21 @@ void PutTextScript()
++gTS.item_y;
RECT rect;
if (gTS.item >= 1000)
if (gTS.item < 1000)
{
rect.left = 32 * ((gTS.item - 1000) % 8);
rect.right = 32 * ((gTS.item - 1000) % 8) + 32;
rect.top = 16 * ((gTS.item - 1000) / 8);
rect.bottom = 16 * ((gTS.item - 1000) / 8) + 16;
PutBitmap3(&grcFull, (WINDOW_WIDTH - 40) / 2, gTS.item_y, &rect, 8);
rect.left = 16 * (gTS.item % 16);
rect.right = rect.left + 16;
rect.top = 16 * (gTS.item / 16);
rect.bottom = rect.top + 16;
PutBitmap3(&grcFull, (WINDOW_WIDTH - 24) / 2, gTS.item_y, &rect, 12);
}
else
{
rect.left = 16 * (gTS.item % 16);
rect.right = 16 * (gTS.item % 16) + 16;
rect.top = 16 * (gTS.item / 16);
rect.bottom = 16 * (gTS.item / 16) + 16;
PutBitmap3(&grcFull, (WINDOW_WIDTH - 24) / 2, gTS.item_y, &rect, 12);
rect.left = 32 * ((gTS.item - 1000) % 8);
rect.right = rect.left + 32;
rect.top = 16 * ((gTS.item - 1000) / 8);
rect.bottom = rect.top + 16;
PutBitmap3(&grcFull, (WINDOW_WIDTH - 40) / 2, gTS.item_y, &rect, 8);
}
}
@ -467,24 +492,23 @@ void PutTextScript()
if (gTS.mode == 6)
{
int i;
if (gTS.wait > 1)
i = WINDOW_HEIGHT - 96;
if (gTS.wait < 2)
i = (WINDOW_HEIGHT - 96) + (2 - gTS.wait) * 4;
else
i = WINDOW_HEIGHT - 88 - gTS.wait * 4;
i = WINDOW_HEIGHT - 96;
PutBitmap3(&grcFull, (WINDOW_WIDTH + 112) / 2, i, &rect_yesno, 26);
if (gTS.wait == 16)
PutBitmap3(&grcFull, 41 * gTS.select + (WINDOW_WIDTH + 102) / 2, WINDOW_HEIGHT - 86, &rect_cur, 26);
}
}
}
//Parse TSC
int TextScriptProc()
{
RECT rcSymbol = {64, 48, 72, 56};
bool bExit;
BOOL bExit;
switch (gTS.mode)
{
@ -502,111 +526,11 @@ int TextScriptProc()
//Parsing time
int w, x, y, z;
bExit = false;
bExit = FALSE;
while (!bExit)
while (bExit == FALSE)
{
if (gTS.data[gTS.p_read] != '<')
{
if (gTS.data[gTS.p_read] == '\r')
{
//Go to new-line
gTS.p_read += 2;
gTS.p_write = 0;
if (gTS.flags & 1)
{
++gTS.line;
CheckNewLine();
}
}
else if (gTS.flags & 0x10)
{
//SAT/CAT/TUR printing
for (x = gTS.p_read; ; x++)
{
//Break if reaches command, or new-line
if (gTS.data[x] == '<' || gTS.data[x] == '\r')
break;
//Skip if SHIFT-JIS
if (gTS.data[x] & 0x80)
++x;
}
//Get text to copy
char str[72];
int length = x - gTS.p_read;
memcpy(str, &gTS.data[gTS.p_read], length);
str[length] = 0;
gTS.p_write = x;
//Print text
PutText2(0, 0, str, 0xFFFFFE, gTS.line % 4 + 30);
sprintf(&text[gTS.line % 4 * 0x40], str);
//Check if should move to next line (prevent a memory overflow, come on guys, this isn't a leftover of pixel trying to make text wrapping)
gTS.p_read += length;
if (gTS.p_write > 34)
CheckNewLine();
bExit = true;
}
else
{
//Get text to print
char c[3];
c[0] = gTS.data[gTS.p_read];
if (!(c[0] & 0x80))
{
c[1] = 0;
}
else
{
c[1] = gTS.data[gTS.p_read + 1];
c[2] = 0;
}
//Print text
if (c[0] == '=')
{
Surface2Surface(6 * gTS.p_write, 2, &rcSymbol, gTS.line % 4 + 30, 26);
}
else
{
PutText2(6 * gTS.p_write, 0, c, 0xFFFFFE, gTS.line % 4 + 30);
}
strcat(&text[gTS.line % 4 * 0x40], c);
PlaySoundObject(2, 1);
gTS.wait_beam = 0;
//Offset read and write positions
if (!(c[0] & 0x80))
{
gTS.p_read++;
gTS.p_write++;
}
else
{
gTS.p_read += 2;
gTS.p_write += 2;
}
if (gTS.p_write > 34)
{
CheckNewLine();
gTS.p_write = 0;
++gTS.line;
CheckNewLine();
}
bExit = true;
}
}
else
if (gTS.data[gTS.p_read] == '<')
{
if (IS_COMMAND('E','N','D'))
{
@ -614,7 +538,7 @@ int TextScriptProc()
gMC.cond &= ~1;
g_GameFlags |= 3;
gTS.face = 0;
bExit = true;
bExit = TRUE;
}
else if (IS_COMMAND('L','I','+'))
{
@ -724,7 +648,7 @@ int TextScriptProc()
{
x = GetTextScriptNo(gTS.p_read + 4);
y = GetTextScriptNo(gTS.p_read + 9);
SetMyCharPosition(x << 13, y << 13);
SetMyCharPosition(x * 0x200 * 0x10, y * 0x200 * 0x10);
gTS.p_read += 13;
}
else if (IS_COMMAND('H','M','C'))
@ -784,7 +708,7 @@ int TextScriptProc()
{
gTS.mode = 2;
gTS.p_read += 4;
bExit = true;
bExit = TRUE;
}
else if (IS_COMMAND('C','L','R'))
{
@ -799,41 +723,41 @@ int TextScriptProc()
if (gTS.flags & 0x40)
gTS.flags |= 0x10;
gTS.p_read += 4;
bExit = true;
bExit = TRUE;
}
else if (IS_COMMAND('M','S','2'))
{
ClearTextLine();
gTS.flags |= 0x21;
gTS.flags &= ~0x12;
gTS.flags |= 0x21;
if (gTS.flags & 0x40)
gTS.flags |= 0x10;
gTS.face = 0;
gTS.p_read += 4;
bExit = true;
bExit = TRUE;
}
else if (IS_COMMAND('M','S','3'))
{
ClearTextLine();
gTS.flags |= 0x23;
gTS.flags &= ~0x10;
gTS.flags |= 0x23;
if (gTS.flags & 0x40)
gTS.flags |= 0x10;
gTS.p_read += 4;
bExit = true;
bExit = TRUE;
}
else if (IS_COMMAND('W','A','I'))
{
gTS.mode = 4;
gTS.wait_next = GetTextScriptNo(gTS.p_read + 4);
gTS.p_read += 8;
bExit = true;
bExit = TRUE;
}
else if (IS_COMMAND('W','A','S'))
{
gTS.mode = 7;
gTS.p_read += 4;
bExit = true;
bExit = TRUE;
}
else if (IS_COMMAND('T','U','R'))
{
@ -868,7 +792,7 @@ int TextScriptProc()
PlaySoundObject(5, 1);
gTS.wait = 0;
gTS.select = 0;
bExit = true;
bExit = TRUE;
}
else if (IS_COMMAND('F','L','J'))
{
@ -959,7 +883,7 @@ int TextScriptProc()
else if (IS_COMMAND('S','P','S'))
{
SetNoise(2, x);
gTS.p_read += 8;
gTS.p_read += 4;
}
else if (IS_COMMAND('C','P','S'))
{
@ -983,7 +907,7 @@ int TextScriptProc()
StartFadeIn(z);
gTS.mode = 5;
gTS.p_read += 8;
bExit = true;
bExit = TRUE;
}
else if (IS_COMMAND('F','A','O'))
{
@ -991,7 +915,7 @@ int TextScriptProc()
StartFadeOut(z);
gTS.mode = 5;
gTS.p_read += 8;
bExit = true;
bExit = TRUE;
}
else if (IS_COMMAND('M','N','A'))
{
@ -1043,23 +967,27 @@ int TextScriptProc()
else if (IS_COMMAND('M','L','P'))
{
gTS.p_read += 4;
bExit = true;
bExit = TRUE;
int tscRet = MiniMapLoop();
if (tscRet == 0)
switch (MiniMapLoop())
{
case 0:
return 0;
if (tscRet == 2)
case 2:
return 2;
}
}
else if (IS_COMMAND('S','L','P'))
{
bExit = true;
bExit = TRUE;
int selRet = StageSelectLoop(&z);
if (selRet == 0)
switch (StageSelectLoop(&z))
{
case 0:
return 0;
if (selRet == 2)
case 2:
return 2;
}
JumpTextScript(z);
g_GameFlags &= ~3;
@ -1112,7 +1040,7 @@ int TextScriptProc()
x = GetTextScriptNo(gTS.p_read + 9);
y = GetTextScriptNo(gTS.p_read + 14);
z = GetTextScriptNo(gTS.p_read + 19);
SetNpChar(w, x << 13, y << 13, 0, 0, z, 0, 0x100);
SetNpChar(w, x * 0x200 * 0x10, y * 0x200 * 0x10, 0, 0, z, 0, 0x100);
gTS.p_read += 23;
}
else if (IS_COMMAND('M','N','P'))
@ -1121,7 +1049,7 @@ int TextScriptProc()
x = GetTextScriptNo(gTS.p_read + 9);
y = GetTextScriptNo(gTS.p_read + 14);
z = GetTextScriptNo(gTS.p_read + 19);
MoveNpChar(w, x << 13, y << 13, z);
MoveNpChar(w, x * 0x200 * 0x10, y * 0x200 * 0x10, z);
gTS.p_read += 23;
}
else if (IS_COMMAND('S','M','P'))
@ -1185,20 +1113,20 @@ int TextScriptProc()
else if (IS_COMMAND('F','A','C'))
{
z = GetTextScriptNo(gTS.p_read + 4);
if (gTS.face != z)
if (gTS.face != (signed char)z)
{
gTS.face = z;
gTS.face_x = (gTS.rcText.left - 48) << 9;
gTS.face = (signed char)z;
gTS.face_x = (WINDOW_WIDTH / 2 - 156) * 0x200;
}
gTS.p_read += 8;
}
else if (IS_COMMAND('F','A','C'))
{
z = GetTextScriptNo(gTS.p_read + 4);
if (gTS.face != z)
if (gTS.face != (signed char)z)
{
gTS.face = z;
gTS.face_x = (gTS.rcText.left - 48) << 9;
gTS.face = (signed char)z;
gTS.face_x = (WINDOW_WIDTH / 2 - 156) * 0x200;
}
gTS.p_read += 8;
}
@ -1234,13 +1162,17 @@ int TextScriptProc()
}
else if (IS_COMMAND('X','X','1'))
{
bExit = true;
bExit = TRUE;
z = GetTextScriptNo(gTS.p_read + 4);
int islRet = Scene_DownIsland(z);
if (islRet == 0)
switch (Scene_DownIsland(z))
{
case 0:
return 0;
if (islRet == 2)
case 2:
return 2;
}
gTS.p_read += 8;
}
else if (IS_COMMAND('E','S','C'))
@ -1254,6 +1186,107 @@ int TextScriptProc()
return 1;
}
}
else
{
if (gTS.data[gTS.p_read] == '\r')
{
//Go to new-line
gTS.p_read += 2;
gTS.p_write = 0;
if (gTS.flags & 1)
{
++gTS.line;
CheckNewLine();
}
}
else if (gTS.flags & 0x10)
{
//SAT/CAT/TUR printing
x = gTS.p_read;
//Break if reaches command, or new-line
while (gTS.data[x] != '<' && gTS.data[x] != '\r')
{
//Skip if SHIFT-JIS
if (gTS.data[x] & 0x80)
++x;
++x;
}
//Get text to copy
char str[72];
int length = x - gTS.p_read;
memcpy(str, &gTS.data[gTS.p_read], length);
str[length] = 0;
gTS.p_write = x;
//Print text
PutText2(0, 0, str, 0xFFFFFE, gTS.line % 4 + 30);
sprintf(&text[gTS.line % 4 * 0x40], str);
//Check if should move to next line (prevent a memory overflow, come on guys, this isn't a leftover of pixel trying to make text wrapping)
gTS.p_read += length;
if (gTS.p_write >= 35)
CheckNewLine();
bExit = TRUE;
}
else
{
//Get text to print
char c[3];
c[0] = gTS.data[gTS.p_read];
if (c[0] & 0x80)
{
c[1] = gTS.data[gTS.p_read + 1];
c[2] = 0;
}
else
{
c[1] = 0;
}
//Print text
if (c[0] == '=')
{
Surface2Surface(6 * gTS.p_write, 2, &rcSymbol, gTS.line % 4 + 30, 26);
}
else
{
PutText2(6 * gTS.p_write, 0, c, 0xFFFFFE, gTS.line % 4 + 30);
}
strcat(&text[gTS.line % 4 * 0x40], c);
PlaySoundObject(2, 1);
gTS.wait_beam = 0;
//Offset read and write positions
if (c[0] & 0x80)
{
gTS.p_read += 2;
gTS.p_write += 2;
}
else
{
gTS.p_read++;
gTS.p_write++;
}
if (gTS.p_write >= 35)
{
CheckNewLine();
gTS.p_write = 0;
++gTS.line;
CheckNewLine();
}
bExit = TRUE;
}
}
}
break;
@ -1276,35 +1309,39 @@ int TextScriptProc()
break;
case 4: //WAI
if (gTS.wait_next != 9999)
{
if (gTS.wait_next == 9999)
break;
if (gTS.wait != 9999)
++gTS.wait;
if (gTS.wait >= gTS.wait_next)
{
if (gTS.wait < gTS.wait_next)
break;
gTS.mode = 1;
gTS.wait_beam = 0;
}
}
break;
case 5: //FAI/FAO
if (!GetFadeActive())
{
if (GetFadeActive())
break;
gTS.mode = 1;
gTS.wait_beam = 0;
}
break;
case 7: //WAS
if (gMC.flag & 8)
{
if ((gMC.flag & 8) == 0)
break;
gTS.mode = 1;
gTS.wait_beam = 0;
}
break;
case 6: //YNJ
if (gTS.wait >= 16)
if (gTS.wait < 16)
{
gTS.wait++;
}
else
{
//Select option
if (gKeyTrg & gKeyOk)
@ -1334,16 +1371,12 @@ int TextScriptProc()
PlaySoundObject(1, 1);
}
}
else
{
gTS.wait++;
}
break;
}
if (gTS.mode)
g_GameFlags |= 4;
else
if (gTS.mode == 0)
g_GameFlags &= ~4;
else
g_GameFlags |= 4;
return 1;
}

View file

@ -54,13 +54,13 @@ struct TEXT_SCRIPT
uint8_t wait_beam;
};
bool InitTextScript2();
BOOL InitTextScript2();
void EndTextScript();
void EncryptionBinaryData2(uint8_t *pData, int size);
bool LoadTextScript2(const char *name);
bool LoadTextScript_Stage(char *name);
void GetTextScriptPath(char *path);
bool StartTextScript(int no);
BOOL StartTextScript(int no);
void StopTextScript();
void PutTextScript();
int TextScriptProc();