shithub: cstory

Download patch

ref: 04c2f4c0551db498459c93b8fa3ee1924b5d150d
parent: ab4763d2a3720fdcf43d644b39952b58eb37a377
author: Clownacy <Clownacy@users.noreply.github.com>
date: Fri Nov 15 20:22:50 EST 2019

Clean-up BossPress.cpp

--- a/src/BossPress.cpp
+++ b/src/BossPress.cpp
@@ -26,15 +26,15 @@
 			npc->direct = 2;
 			npc->x = 0;
 			npc->y = 0;
-			npc->view.front = 0x5000;
-			npc->view.top = 0x7800;
-			npc->view.back = 0x5000;
-			npc->view.bottom = 0x7800;
+			npc->view.front = 40 * 0x200;
+			npc->view.top = 60 * 0x200;
+			npc->view.back = 40 * 0x200;
+			npc->view.bottom = 60 * 0x200;
 			npc->hit_voice = 54;
-			npc->hit.front = 0x6200;
-			npc->hit.top = 0x7800;
-			npc->hit.back = 0x5000;
-			npc->hit.bottom = 0x6000;
+			npc->hit.front = 49 * 0x200;
+			npc->hit.top = 60 * 0x200;
+			npc->hit.back = 40 * 0x200;
+			npc->hit.bottom = 48 * 0x200;
 			npc->bits = (NPC_IGNORE_SOLIDITY | NPC_SOLID_HARD | NPC_EVENT_WHEN_KILLED | NPC_SHOW_DAMAGE);
 			npc->size = 3;
 			npc->damage = 10;
@@ -52,21 +52,21 @@
 
 		case 10:
 			npc->act_no = 11;
-			npc->x = 0x14000;
-			npc->y = 0x9400;
+			npc->x = 160 * 0x200;
+			npc->y = 74 * 0x200;
 			break;
 
 		case 20:
 			npc->damage = 0;
 			npc->act_no = 21;
-			npc->x = 0x14000;
-			npc->y = 0x33A00;
+			npc->x = 160 * 0x200;
+			npc->y = 413 * 0x200;
 			npc->bits &= ~NPC_SOLID_HARD;
 			gBoss[1].cond = 0;
 			gBoss[2].cond = 0;
 			// Fallthrough
 		case 21:
-			if ((++npc->act_wait % 0x10) == 0)
+			if (++npc->act_wait % 0x10 == 0)
 				SetDestroyNpChar(npc->x + (Random(-40, 40) * 0x200), npc->y + (Random(-60, 60) * 0x200), 1, 1);
 
 			break;
@@ -74,15 +74,15 @@
 		case 30:
 			npc->act_no = 31;
 			npc->ani_no = 2;
-			npc->x = 0x14000;
-			npc->y = 0x8000;
+			npc->x = 160 * 0x200;
+			npc->y = 64 * 0x200;
 			// Fallthrough
 		case 31:
-			npc->y += 0x800;
+			npc->y += 4 * 0x200;
 
-			if (npc->y >= 0x33A00)
+			if (npc->y >= 413 * 0x200)
 			{
-				npc->y = 0x33A00;
+				npc->y = 413 * 0x200;
 				npc->ani_no = 0;
 				npc->act_no = 20;
 				PlaySoundObject(44, 1);
@@ -90,7 +90,7 @@
 				for (i = 0; i < 5; ++i)
 				{
 					x = npc->x + (Random(-40, 40) * 0x200);
-					SetNpChar(4, x, npc->y + 0x7800, 0, 0, 0, 0, 0x100);
+					SetNpChar(4, x, npc->y + (60 * 0x200), 0, 0, 0, NULL, 0x100);
 				}
 
 			}
@@ -103,10 +103,10 @@
 			npc->act_wait = -100;
 
 			gBoss[1].cond = 0x80;
-			gBoss[1].hit.front = 0x1C00;
-			gBoss[1].hit.back = 0x1C00;
-			gBoss[1].hit.top = 0x1000;
-			gBoss[1].hit.bottom = 0x1000;
+			gBoss[1].hit.front = 14 * 0x200;
+			gBoss[1].hit.back = 14 * 0x200;
+			gBoss[1].hit.top = 8 * 0x200;
+			gBoss[1].hit.bottom = 8 * 0x200;
 			gBoss[1].bits = (NPC_INVULNERABLE | NPC_IGNORE_SOLIDITY);
 
 			gBoss[2] = gBoss[1];
@@ -113,15 +113,15 @@
 
 			gBoss[3].cond = 0x90;
 			gBoss[3].bits |= NPC_SHOOTABLE;
-			gBoss[3].hit.front = 0xC00;
-			gBoss[3].hit.back = 0xC00;
-			gBoss[3].hit.top = 0x1000;
-			gBoss[3].hit.bottom = 0x1000;
+			gBoss[3].hit.front = 6 * 0x200;
+			gBoss[3].hit.back = 6 * 0x200;
+			gBoss[3].hit.top = 8 * 0x200;
+			gBoss[3].hit.bottom = 8 * 0x200;
 
-			SetNpChar(325, npc->x, npc->y + 0x7800, 0, 0, 0, 0, 0x100);
+			SetNpChar(325, npc->x, npc->y + (60 * 0x200), 0, 0, 0, NULL, 0x100);
 			// Fallthrough
 		case 101:
-			if (npc->count2 > 1 && npc->life < 70 * npc->count2)
+			if (npc->count2 > 1 && npc->life < npc->count2 * 70)
 			{
 				--npc->count2;
 
@@ -134,15 +134,15 @@
 			}
 
 			if (++npc->act_wait == 81 || npc->act_wait == 241)
-				SetNpChar(323, 0x6000, 0x1E000, 0, 0, 1, 0, 0x100);
+				SetNpChar(323, 48 * 0x200, 240 * 0x200, 0, 0, 1, NULL, 0x100);
 
 			if (npc->act_wait == 1 || npc->act_wait == 161)
-				SetNpChar(323, 0x22000, 0x1E000, 0, 0, 1, 0, 0x100);
+				SetNpChar(323, 272 * 0x200, 240 * 0x200, 0, 0, 1, NULL, 0x100);
 
 			if (npc->act_wait >= 300)
 			{
 				npc->act_wait = 0;
-				SetNpChar(325, npc->x, npc->y + 0x7800, 0, 0, 0, 0, 0x100);
+				SetNpChar(325, npc->x, npc->y + (60 * 0x200), 0, 0, 0, NULL, 0x100);
 			}
 
 			break;
@@ -158,7 +158,7 @@
 			DeleteNpCharCode(330, 1);
 			// Fallthrough
 		case 501:
-			if ((++npc->act_wait % 0x10) == 0)
+			if (++npc->act_wait % 0x10 == 0)
 			{
 				PlaySoundObject(12, 1);
 				SetDestroyNpChar(npc->x + (Random(-40, 40) * 0x200), npc->y + (Random(-60, 60) * 0x200), 1, 1);
@@ -171,6 +171,7 @@
 
 			if (npc->act_wait > 100)
 				npc->act_no = 510;
+
 			break;
 
 		case 510:
@@ -178,7 +179,7 @@
 			npc->damage = 0x7F;
 			npc->y += npc->ym;
 
-			if (npc->count1 == 0 && npc->y > 0x14000)
+			if (npc->count1 == 0 && npc->y > 160 * 0x200)
 			{
 				npc->count1 = 1;
 				npc->ym = -0x200;
@@ -187,25 +188,25 @@
 				for (i = 0; i < 7; ++i)
 				{
 					ChangeMapParts(i + 7, 14, 0);
-					SetDestroyNpChar((i + 7) * 0x200 * 0x10, 0x1C000, 0, 0);
+					SetDestroyNpChar((i + 7) * 0x200 * 0x10, 224 * 0x200, 0, 0);
 					PlaySoundObject(12, 1);
 				}
 			}
 
-			if (npc->y > 0x3C000)
+			if (npc->y > 480 * 0x200)
 				npc->act_no = 520;
 
 			break;
 	}
 
-	gBoss[1].x = npc->x - 0x3000;
-	gBoss[1].y = npc->y + 0x6800;
+	gBoss[1].x = npc->x - (24 * 0x200);
+	gBoss[1].y = npc->y + (52 * 0x200);
 
-	gBoss[2].x = npc->x + 0x3000;
-	gBoss[2].y = npc->y + 0x6800;
+	gBoss[2].x = npc->x + (24 * 0x200);
+	gBoss[2].y = npc->y + (52 * 0x200);
 
 	gBoss[3].x = npc->x;
-	gBoss[3].y = npc->y + 0x5000;
+	gBoss[3].y = npc->y + (40 * 0x200);
 
 	RECT rc[3] = {
 		{0, 0, 80, 120},
@@ -219,7 +220,7 @@
 		{160, 120, 240, 240},
 	};
 
-	if (npc->shock)
+	if (npc->shock != 0)
 	{
 		if (++flash / 2 % 2)
 			npc->rect = rc[npc->ani_no];