shithub: cstory

Download patch

ref: a94d9a4367c5d08e769b9c35a8d366cfcd8d7bec
parent: f04872b91bf98edcce130faf9756e1fc71eb2ede
author: Clownacy <[email protected]>
date: Mon May 13 10:20:24 EDT 2019

Made NpcAct100.cpp ASM-accurate

See #74. Finally, I figured out what might be causing the register
differences. Considering how long this NPC's code is, it makes sense
that there might be some vestigial checks.

--- a/src/NpcAct100.cpp
+++ b/src/NpcAct100.cpp
@@ -1352,8 +1352,18 @@
 			break;
 
 		case 3:
-			// TODO: This code is being problematic, and
-			// assembling with the wrong registers.
+			if (0)
+			{
+				// There used to be an if here that didn't do anything, but the compiler optimised it out.
+				// We only know this was here because empty ifs mess with the register usage.
+				// Since there's no code, we have no idea what the original condition actually was.
+			}
+
+			if (0)
+			{
+				// Another empty if
+			}
+
 			npc->act_no = 4;
 			npc->ani_no = 1;
 			npc->ani_wait = 0;
@@ -1382,9 +1392,15 @@
 			npc->ani_no = 5;
 			SetDestroyNpChar(npc->x, npc->y, npc->view.back, 8);
 			break;
-			// End of wrong-reg code
 
 		case 6:
+			if (0)
+			{
+				// There used to be an if here that didn't do anything, but the compiler optimised it out.
+				// We only know this was here because empty ifs mess with the register usage.
+				// Since there's no code, we have no idea what the original condition actually was.
+			}
+
 			npc->ani_no = 5;
 			break;