shithub: cstory

Download patch

ref: 098647f7fd6bfad8ac47bca2686b908d5c4b431a
parent: 8a860c57f366dd33439abed266b7d2cf485492cf
author: Clownacy <Clownacy@users.noreply.github.com>
date: Mon Jan 6 23:39:14 EST 2020

More-accurate TextScr.cpp variable arrangement

--- a/src/TextScr.cpp
+++ b/src/TextScr.cpp
@@ -41,7 +41,6 @@
 
 TEXT_SCRIPT gTS;
 
-int gNumberTextScript[4];
 char text[4][0x40];
 
 RECT gRect_line = {0, 0, 216, 16};
@@ -88,6 +87,7 @@
 
 	// Release buffers
 	ReleaseSurface(SURFACE_ID_TEXT_BOX);
+
 	for (i = 0; i < 4; ++i)
 		ReleaseSurface((SurfaceID)(SURFACE_ID_TEXT_LINE1 + i));
 }
@@ -95,12 +95,14 @@
 // Decrypt .tsc
 void EncryptionBinaryData2(unsigned char *pData, long size)
 {
-	int val1;
-	int work;
 	int i;
+	int work;
+
 	int half;
+	int val1;
 
 	half = size / 2;
+
 	if (pData[half] == 0)
 		val1 = -7;
 	else
@@ -119,8 +121,8 @@
 // Load generic .tsc
 BOOL LoadTextScript2(const char *name)
 {
-	char path[MAX_PATH];
 	FILE *fp;
+	char path[MAX_PATH];
 
 	// Get path
 	sprintf(path, "%s\\%s", gDataPath, name);
@@ -151,8 +153,8 @@
 // Load stage .tsc
 BOOL LoadTextScript_Stage(const char *name)
 {
-	char path[MAX_PATH];
 	FILE *fp;
+	char path[MAX_PATH];
 	long head_size;
 	long body_size;
 
@@ -300,6 +302,7 @@
 
 	// Find where event starts
 	gTS.p_read = 0;
+
 	while(1)
 	{
 		// Check if we are still in the proper range
@@ -324,6 +327,7 @@
 	// Advance until new-line
 	while (gTS.data[gTS.p_read] != '\n')
 		++gTS.p_read;
+
 	++gTS.p_read;
 
 	return TRUE;
@@ -351,15 +355,17 @@
 	}
 }
 
+int gNumberTextScript[4];
+
 // Type a number into the text buffer
 void SetNumberTextScript(int index)
 {
+	char str[5];
+	BOOL bZero;
 	int a;
 	int b;
-	int i;
-	BOOL bZero;
 	int offset;
-	char str[5];
+	int i;
 
 	// Get digit table
 	int table[3];
@@ -429,15 +435,7 @@
 // Draw textbox and whatever else
 void PutTextScript(void)
 {
-	RECT rcFace;
-	RECT rcItemBox1;
-	RECT rcItemBox2;
-	RECT rcItemBox3;
-	RECT rcItemBox4;
-	RECT rcItemBox5;
 	int i;
-	RECT rect_yesno;
-	RECT rect_cur;
 	RECT rect;
 	int text_offset;
 
@@ -473,6 +471,7 @@
 	}
 
 	// Draw face picture
+	RECT rcFace;
 	rcFace.left = (gTS.face % 6) * 48;
 	rcFace.top = (gTS.face / 6) * 48;
 	rcFace.right = rcFace.left + 48;
@@ -522,11 +521,11 @@
 	}
 
 	// Draw GIT
-	SET_RECT(rcItemBox1, 0, 0, 72, 16)
-	SET_RECT(rcItemBox2, 0, 8, 72, 24)
-	SET_RECT(rcItemBox3, 240, 0, 244, 8)
-	SET_RECT(rcItemBox4, 240, 8, 244, 16)
-	SET_RECT(rcItemBox5, 240, 16, 244, 24)
+	RECT rcItemBox1 = {0, 0, 72, 16};
+	RECT rcItemBox2 = {0, 8, 72, 24};
+	RECT rcItemBox3 = {240, 0, 244, 8};
+	RECT rcItemBox4 = {240, 8, 244, 16};
+	RECT rcItemBox5 = {240, 16, 244, 24};
 
 	if (gTS.item != 0)
 	{
@@ -559,8 +558,8 @@
 	}
 
 	// Draw Yes / No selection
-	SET_RECT(rect_yesno, 152, 48, 244, 80)
-	SET_RECT(rect_cur, 112, 88, 128, 104)
+	RECT rect_yesno = {152, 48, 244, 80};
+	RECT rect_cur = {112, 88, 128, 104};
 
 	if (gTS.mode == 6)
 	{
@@ -578,11 +577,12 @@
 // Parse TSC
 int TextScriptProc(void)
 {
-	BOOL bExit;
-	char c[3];
-	int w, x, y, z;
 	int i;
+	char c[3];
 	char str[72];
+	int w, x, y, z;
+
+	BOOL bExit;
 
 	RECT rcSymbol = {64, 48, 72, 56};
 
--- a/vs2003/CSE2.vcproj
+++ b/vs2003/CSE2.vcproj
@@ -349,7 +349,7 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
-						CompileAs="1"/>
+						CompileAs="0"/>
 				</FileConfiguration>
 			</File>
 			<File