shithub: cstory

Download patch

ref: 53b39cfa725c5f2f3f41c2a49dbc8ab00737337e
parent: 54d9c0ad1ab1ee3b41adddbfb157240cecf04b5d
author: Clownacy <Clownacy@users.noreply.github.com>
date: Wed Feb 27 16:56:16 EST 2019

Note some bad code

--- a/src/NpcAct100.cpp
+++ b/src/NpcAct100.cpp
@@ -204,7 +204,7 @@
 			if (npc->act_wait > 18)
 			{
 				npc->act_no = 1;
-				npc->act_no = 1;
+				npc->act_no = 1;	// Duplicate line
 			}
 
 			break;
--- a/src/NpcAct140.cpp
+++ b/src/NpcAct140.cpp
@@ -94,7 +94,7 @@
 			break;
 
 		case 10:
-			npc->bits = npc->bits;
+			npc->bits = npc->bits;	// Redundant line
 			npc->act_no = 11;
 			npc->ani_no = 0;
 			npc->ani_wait = 0;
@@ -838,7 +838,7 @@
 				npc->act_no = 4;
 				npc->ani_no = 3;
 				npc->act_wait = 0;
-				npc->act_wait = 0;
+				npc->act_wait = 0;	// Duplicate line
 			}
 
 			break;
--- a/src/NpcAct180.cpp
+++ b/src/NpcAct180.cpp
@@ -1185,7 +1185,7 @@
 	{
 		case 0:
 			npc->act_no = 1;
-			npc->y = npc->y;
+			npc->y = npc->y;	// Redundant line
 			npc->x += 0x3000;
 			break;
 	}
--- a/src/NpcAct260.cpp
+++ b/src/NpcAct260.cpp
@@ -1180,6 +1180,7 @@
 			if (npc->ani_no > 1)
 				npc->ani_no = 0;
 
+			// This line makes absolutely no sense
 			if (npc->x < gMC.x + 0xE000 && npc->x > gMC.x - 0xE000 && npc->x < gMC.x + 0x6000 && npc->x > gMC.x - 0xE000)
 				npc->act_no = 10;
 
--- a/src/Profile.cpp
+++ b/src/Profile.cpp
@@ -139,7 +139,12 @@
 	//Check header code
 	fread(profile.code, 8, 1, fp);
 	if (memcmp(profile.code, gProfileCode, 8))
+	{
+#ifdef FIX_BUGS
+		fclose(fp);	// The original game forgets to close the file
+#endif
 		return false;
+	}
 	
 	//Read data
 	fseek(fp, 0, SEEK_SET); //Pixel epic redundant code 😎😎😎