shithub: cstory

Download patch

ref: 63e855c7fa89701ac571c7d3952a2a7875b1371d
parent: affaf25e5c26b00e2e2126b391f40e0775c30328
author: Clownacy <Clownacy@users.noreply.github.com>
date: Tue Jan 7 15:48:21 EST 2020

More-accurate NpChar.cpp variable arrangement

--- a/src/NpChar.cpp
+++ b/src/NpChar.cpp
@@ -52,14 +52,13 @@
 
 BOOL LoadEvent(const char *path_event)
 {
+	int i, n;
 	FILE *fp;
 	int count;
-	int i;
-	int n;
-	EVENT eve;
-	char path[MAX_PATH];
 	char code[4];
+	EVENT eve;
 
+	char path[MAX_PATH];
 	sprintf(path, "%s\\%s", gDataPath, path_event);
 
 	fp = fopen(path, "rb");
@@ -189,8 +188,10 @@
 
 void SetExpObjects(int x, int y, int exp)
 {
+	int n;
 	int sub_exp;
-	int n = 0x100;
+
+	n = 0x100;
 	while (exp)
 	{
 		while (n < NPC_MAX && gNPC[n].cond)
@@ -310,8 +311,10 @@
 
 void VanishNpChar(NPCHAR *npc)
 {
-	int x = npc->x;
-	int y = npc->y;
+	int x, y;
+
+	x = npc->x;
+	y = npc->y;
 	memset(npc, 0, sizeof(NPCHAR));
 	npc->count1 = 0;
 	npc->x = x;
@@ -329,12 +332,12 @@
 	int n;
 	signed char a = 0;
 
+	int side;
+
 	for (n = 0; n < NPC_MAX; ++n)
 	{
 		if (gNPC[n].cond & 0x80)
 		{
-			int side;
-
 			if (gNPC[n].shock)
 			{
 				a = 2 * ((gNPC[n].shock / 2) % 2) - 1;
@@ -367,12 +370,13 @@
 void ActNpChar(void)
 {
 	int i;
+	int code_char;
 
 	for (i = 0; i < NPC_MAX; ++i)
 	{
 		if (gNPC[i].cond & 0x80)
 		{
-			int code_char = gNPC[i].code_char;
+			code_char = gNPC[i].code_char;
 
 			gpNpcFuncTbl[code_char](&gNPC[i]);