shithub: cstory

Download patch

ref: f8f46fc1e422219a216d8ab7ebbe34f76c52bc87
parent: 8a569b127f58dbc508a2f69029776bf7a64fa1a8
author: Clownacy <Clownacy@users.noreply.github.com>
date: Mon Apr 8 12:50:28 EDT 2019

Made Star.cpp ASM-accurate

--- a/src/Star.cpp
+++ b/src/Star.cpp
@@ -63,26 +63,27 @@
 	{
 		if (i)
 		{
-			if (star[i - 1].x >= star[i].x)
-				star[i].xm += 0x80;
-			else
+			if (star[i - 1].x < star[i].x)
 				star[i].xm -= 0x80;
-			
-			if (star[i - 1].y >= star[i].y)
-				star[i].ym += 0xAA;
 			else
+				star[i].xm += 0x80;
+			
+			if (star[i - 1].y < star[i].y)
 				star[i].ym -= 0xAA;
+			else
+				star[i].ym += 0xAA;
 		}
 		else
 		{
-			if (gMC.x >= star[0].x)
-				star[0].xm += 0x80;
+			if (gMC.x < star[i].x)
+				star[i].xm -= 0x80;
 			else
-				star[0].xm -= 0x80;
-			if (gMC.y >= star[0].y)
-				star[0].ym += 0xAA;
+				star[i].xm += 0x80;
+
+			if (gMC.y < star[i].y)
+				star[i].ym -= 0xAA;
 			else
-				star[0].ym -= 0xAA;
+				star[i].ym += 0xAA;
 		}
 		
 		if (star[i].xm > 0xA00)
@@ -89,14 +90,17 @@
 			star[i].xm = 0xA00;
 		if (star[i].xm < -0xA00)
 			star[i].xm = -0xA00;
+
 		if (star[i].ym > 0xA00)
 			star[i].ym = 0xA00;
 		if (star[i].ym < -0xA00)
 			star[i].ym = -0xA00;
+
 		if (star[i].xm > 0xA00)
 			star[i].xm = 0xA00;
 		if (star[i].xm < -0xA00)
 			star[i].xm = -0xA00;
+
 		if (star[i].ym > 0xA00)
 			star[i].ym = 0xA00;
 		if (star[i].ym < -0xA00)
@@ -105,7 +109,7 @@
 		star[i].x += star[i].xm;
 		star[i].y += star[i].ym;
 		
-		if (gMC.star > i && (gMC.equip & 0x80) && (g_GameFlags & 2) && a == i)
+		if (i < gMC.star && (gMC.equip & 0x80) && (g_GameFlags & 2) && a == i)
 			SetBullet(45, star[a].x, star[a].y, 0);
 	}
 }
@@ -118,12 +122,15 @@
 		{192, 16, 200, 24},
 	};
 	
-	if (!(gMC.cond & 2) && (gMC.equip & 0x80))
+	if (gMC.cond & 2)
+		return;
+
+	if ((gMC.equip & 0x80) == 0)
+		return;
+
+	for (int i = 0; i < 3; i++)
 	{
-		for (int i = 0; i < 3; i++)
-		{
-			if (gMC.star > i)
-				PutBitmap3(&grcGame, star[i].x / 0x200 - fx / 0x200 - 4, star[i].y / 0x200 - fy / 0x200 - 4, &rc[i], SURFACE_ID_MY_CHAR);
-		}
+		if (i < gMC.star)
+			PutBitmap3(&grcGame, star[i].x / 0x200 - fx / 0x200 - 4, star[i].y / 0x200 - fy / 0x200 - 4, &rc[i], SURFACE_ID_MY_CHAR);
 	}
 }