shithub: cstory

Download patch

ref: f08c1c3aa6d3f54192b7d1aed63c72523d320558
parent: 1042d3fcf2d713ba1485d9ffb6cb6202a0406fea
author: Clownacy <[email protected]>
date: Mon Feb 18 08:24:10 EST 2019

Added some bugfixes and cleanup

--- a/src/NpcAct000.cpp
+++ b/src/NpcAct000.cpp
@@ -123,9 +123,15 @@
 		if (npc->x <= 0x9FFF)
 			npc->cond = 0;
 
+#ifdef FIX_BUGS
+		//Limit speed
+		if (npc->xm < -0x5FF)
+			npc->xm = -0x5FF;
+#else
 		//Limit speed (except pixel applied it to the X position)
 		if (npc->x < -0x5FF)
 			npc->x = -0x5FF;
+#endif
 
 		//Bounce off walls
 		if (npc->flag & 1)
--- a/src/NpcAct080.cpp
+++ b/src/NpcAct080.cpp
@@ -57,7 +57,7 @@
 				npc->ani_no = 1;
 				npc->ani_wait = 0;
 				npc->act_no = 2;
-				npc->bits &= ~0x20u;
+				npc->bits &= ~0x20;
 			}
 
 			if (gMC.x >= npc->x)
@@ -91,15 +91,15 @@
 					npc->xm = 0x400;
 			}
 
-			if (gMC.x >= npc->x)
+			if (gMC.x < npc->x)
 			{
-				npc->direct = 2;
-				npc->xm = 0x100;
+				npc->direct = 0;
+				npc->xm = -0x100;
 			}
 			else
 			{
-				npc->direct = 0;
-				npc->xm = -0x100;
+				npc->direct = 2;
+				npc->xm = 0x100;
 			}
 
 			break;
@@ -150,10 +150,17 @@
 	if (npc->xm < -0x400)
 		npc->xm = -0x400;
 
+#ifdef FIX_BUGS
 	if (npc->ym > 0x5FF)
+		npc->ym = 0x5FF;
+	if (npc->ym < -0x5FF)
+		npc->ym = -0x5FF;
+#else
+	if (npc->ym > 0x5FF)
 		npc->xm = 0x5FF;
 	if (npc->ym < -0x5FF)
 		npc->xm = -0x5FF;
+#endif
 
 	npc->x += npc->xm;
 	npc->y += npc->ym;