shithub: cstory

Download patch

ref: c2f6ccdeb6cc2f2a60661da507c201d0f93b9ed8
parent: 264d555073dd108e4c62d23b8b961749e34fa7e8
parent: bd280414ea192b82b2ca8f9dfd9330f6e92eba61
author: Clownacy <[email protected]>
date: Fri Apr 3 21:49:39 EDT 2020

Merge branch 'accurate' into portable

--- a/src/BossAlmo1.cpp
+++ b/src/BossAlmo1.cpp
@@ -1,5 +1,7 @@
 #include "BossAlmo1.h"
 
+#include <stddef.h>
+
 #include "WindowsWrapper.h"
 
 #include "Boss.h"
--- a/src/BossAlmo2.cpp
+++ b/src/BossAlmo2.cpp
@@ -1,5 +1,7 @@
 #include "BossAlmo2.h"
 
+#include <stddef.h>
+
 #include "WindowsWrapper.h"
 
 #include "Boss.h"
@@ -610,7 +612,7 @@
 			for (i = 0; i < 100; ++i)
 				SetNpChar(4, npc->x + (Random(-128, 128) * 0x200), npc->y + (Random(-64, 64) * 0x200), Random(-128, 128) * 0x200, Random(-128, 128) * 0x200, 0, NULL, 0);
 
-			DeleteNpCharCode(282, 1);
+			DeleteNpCharCode(282, TRUE);
 			gBoss[11].bits &= ~NPC_SHOOTABLE;
 
 			for (i = 0; i < 12; ++i)
@@ -663,8 +665,8 @@
 				for (i = 0; i < 20; ++i)
 					gBoss[i].cond = 0;
 
-				DeleteNpCharCode(158, 1);
-				DeleteNpCharCode(301, 1);
+				DeleteNpCharCode(158, TRUE);
+				DeleteNpCharCode(301, TRUE);
 			}
 
 			break;
--- a/src/BossBallos.cpp
+++ b/src/BossBallos.cpp
@@ -1,5 +1,7 @@
 #include "BossBallos.h"
 
+#include <stddef.h>
+
 #include "WindowsWrapper.h"
 
 #include "Boss.h"
@@ -469,7 +471,7 @@
 			npc->act_wait = 0;
 			npc->xm = 0;
 			npc->ym = 0;
-			DeleteNpCharCode(339, 0);
+			DeleteNpCharCode(339, FALSE);
 			// Fallthrough
 		case 401:
 			npc->y += ((159 * 0x200) - npc->y) / 8;
@@ -674,8 +676,8 @@
 				gBoss[4].cond = 0;
 				gBoss[5].cond = 0;
 
-				DeleteNpCharCode(350, 1);
-				DeleteNpCharCode(348, 1);
+				DeleteNpCharCode(350, TRUE);
+				DeleteNpCharCode(348, TRUE);
 			}
 
 			break;
--- a/src/BossIronH.cpp
+++ b/src/BossIronH.cpp
@@ -167,9 +167,9 @@
 			for (i = 0; i < 0x20; ++i)
 				SetNpChar(4, npc->x + (Random(-128, 128) * 0x200), npc->y + (Random(-64, 64) * 0x200), Random(-128, 128) * 0x200, Random(-128, 128) * 0x200, 0, NULL, 0x100);
 
-			DeleteNpCharCode(197, 1);
-			DeleteNpCharCode(271, 1);
-			DeleteNpCharCode(272, 1);
+			DeleteNpCharCode(197, TRUE);
+			DeleteNpCharCode(271, TRUE);
+			DeleteNpCharCode(272, TRUE);
 			// Fallthrough
 		case 1001:
 			npc->tgt_x -= 1 * 0x200;
--- a/src/BossOhm.cpp
+++ b/src/BossOhm.cpp
@@ -1,6 +1,6 @@
 #include "BossOhm.h"
 
-#include <string.h>
+#include <stddef.h>
 
 #include "WindowsWrapper.h"
 
@@ -381,7 +381,7 @@
 				gBoss[0].count1 = 0;
 			}
 
-			if (gBoss[0].act_wait < 30 && !(gBoss[0].act_wait % 5))
+			if (gBoss[0].act_wait < 30 && gBoss[0].act_wait % 5 == 0)
 			{
 				SetNpChar(48, gBoss[0].x, gBoss[0].y - (16 * 0x200), Random(-341, 341), -0x333, 0, NULL, 0x100);
 				PlaySoundObject(39, 1);
@@ -518,6 +518,6 @@
 		gBoss[0].act_wait = 0;
 		gBoss[0].damage = 0;
 		gBoss[5].damage = 0;
-		DeleteNpCharCode(48, 1);
+		DeleteNpCharCode(48, TRUE);
 	}
 }
--- a/src/BossPress.cpp
+++ b/src/BossPress.cpp
@@ -152,8 +152,8 @@
 			npc->act_wait = 0;
 			npc->count1 = 0;
 
-			DeleteNpCharCode(325, 1);
-			DeleteNpCharCode(330, 1);
+			DeleteNpCharCode(325, TRUE);
+			DeleteNpCharCode(330, TRUE);
 			// Fallthrough
 		case 501:
 			if (++npc->act_wait % 0x10 == 0)
--- a/src/BossTwinD.cpp
+++ b/src/BossTwinD.cpp
@@ -524,7 +524,7 @@
 		case 1020:
 			if (++gBoss[0].act_wait > 50)
 			{
-				DeleteNpCharCode(211, 1);
+				DeleteNpCharCode(211, TRUE);
 				gBoss[0].cond = 0;
 				gBoss[1].cond = 0;
 				gBoss[2].cond = 0;
--- a/src/BossX.cpp
+++ b/src/BossX.cpp
@@ -1,5 +1,7 @@
 #include "BossX.h"
 
+#include <stddef.h>
+
 #include "WindowsWrapper.h"
 
 #include "Boss.h"
@@ -259,7 +261,7 @@
 					break;
 			}
 
-			SetNpChar(158, npc->x + x, npc->y + y, 0, 0, direct, 0, 0x100);
+			SetNpChar(158, npc->x + x, npc->y + y, 0, 0, direct, NULL, 0x100);
 			PlaySoundObject(39, 1);
 			npc->act_wait = 120;
 
@@ -858,7 +860,7 @@
 				for (i = 0; i < 20; ++i)
 					gBoss[i].cond = 0;
 
-				DeleteNpCharCode(158, 1);
+				DeleteNpCharCode(158, TRUE);
 				SetNpChar(159, npc->x, npc->y - (24 * 0x200), 0, 0, 0, NULL, 0);
 			}
 
--- a/src/Bullet.cpp
+++ b/src/Bullet.cpp
@@ -100,53 +100,72 @@
 	}
 }
 
-BULLET_TABLE gBulTbl[46] =
-{
+BULLET_TABLE gBulTbl[46] = {
+	// Null
 	{0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0}},
+	// Snake
 	{4, 1, 20, 36, 4, 4, 2, 2, {8, 8, 8, 8}},
 	{6, 1, 23, 36, 4, 4, 2, 2, {8, 8, 8, 8}},
 	{8, 1, 30, 36, 4, 4, 2, 2, {8, 8, 8, 8}},
+	// Polar Star
 	{1, 1, 8, 32, 6, 6, 2, 2, {8, 8, 8, 8}},
 	{2, 1, 12, 32, 6, 6, 2, 2, {8, 8, 8, 8}},
 	{4, 1, 16, 32, 6, 6, 2, 2, {8, 8, 8, 8}},
+	// Fireball
 	{2, 2, 100, 8, 8, 16, 4, 2, {8, 8, 8, 8}},
 	{3, 2, 100, 8, 4, 4, 4, 2, {8, 8, 8, 8}},
 	{3, 2, 100, 8, 4, 4, 4, 2, {8, 8, 8, 8}},
+	// Machine Gun
 	{2, 1, 20, 32, 2, 2, 2, 2, {8, 8, 8, 8}},
 	{4, 1, 20, 32, 2, 2, 2, 2, {8, 8, 8, 8}},
 	{6, 1, 20, 32, 2, 2, 2, 2, {8, 8, 8, 8}},
+	// Missile Launcher
 	{0, 10, 50, 40, 2, 2, 2, 2, {8, 8, 8, 8}},
 	{0, 10, 70, 40, 4, 4, 4, 4, {8, 8, 8, 8}},
 	{0, 10, 90, 40, 4, 4, 0, 0, {8, 8, 8, 8}},
+	// Missile Launcher explosion
 	{1, 100, 100, 20, 16, 16, 0, 0, {0, 0, 0, 0}},
 	{1, 100, 100, 20, 16, 16, 0, 0, {0, 0, 0, 0}},
 	{1, 100, 100, 20, 16, 16, 0, 0, {0, 0, 0, 0}},
+	// Bubbler
 	{1, 1, 20, 8, 2, 2, 2, 2, {4, 4, 4, 4}},
 	{2, 1, 20, 8, 2, 2, 2, 2, {4, 4, 4, 4}},
 	{2, 1, 20, 8, 4, 4, 4, 4, {4, 4, 4, 4}},
+	// Bubbler level 3 thorns
 	{3, 1, 32, 32, 2, 2, 2, 2, {4, 4, 4, 4}},
+	// Blade slashes
 	{0, 100, 0, 36, 8, 8, 8, 8, {12, 12, 12, 12}},
+	// Falling spike that deals 127 damage
 	{127, 1, 2, 4, 8, 4, 8, 4, {0, 0, 0, 0}},
+	// Blade
 	{15, 1, 30, 36, 8, 8, 4, 2, {8, 8, 8, 8}},
 	{6, 3, 18, 36, 10, 10, 4, 2, {12, 12, 12, 12}},
 	{1, 100, 30, 36, 6, 6, 4, 4, {12, 12, 12, 12}},
+	// Super Missile Launcher
 	{0, 10, 30, 40, 2, 2, 2, 2, {8, 8, 8, 8}},
 	{0, 10, 40, 40, 4, 4, 4, 4, {8, 8, 8, 8}},
 	{0, 10, 40, 40, 4, 4, 0, 0, {8, 8, 8, 8}},
+	// Super Missile Launcher explosion
 	{2, 100, 100, 20, 12, 12, 0, 0, {0, 0, 0, 0}},
 	{2, 100, 100, 20, 12, 12, 0, 0, {0, 0, 0, 0}},
 	{2, 100, 100, 20, 12, 12, 0, 0, {0, 0, 0, 0}},
+	// Nemesis
 	{4, 4, 20, 32, 4, 4, 3, 3, {8, 8, 24, 8}},
 	{4, 2, 20, 32, 2, 2, 2, 2, {8, 8, 24, 8}},
 	{1, 1, 20, 32, 2, 2, 2, 2, {8, 8, 24, 8}},
+	// Spur
 	{4, 4, 30, 64, 6, 6, 3, 3, {8, 8, 8, 8}},
 	{8, 8, 30, 64, 6, 6, 3, 3, {8, 8, 8, 8}},
 	{12, 12, 30, 64, 6, 6, 3, 3, {8, 8, 8, 8}},
+	// Spur trail
 	{3, 100, 30, 32, 6, 6, 3, 3, {4, 4, 4, 4}},
 	{6, 100, 30, 32, 6, 6, 3, 3, {4, 4, 4, 4}},
 	{11, 100, 30, 32, 6, 6, 3, 3, {4, 4, 4, 4}},
+	// Curly's Nemesis
 	{4, 4, 20, 32, 4, 4, 3, 3, {8, 8, 24, 8}},
+	// Screen-nuke that kills all enemies
 	{0, 4, 4, 4, 0, 0, 0, 0, {0, 0, 0, 0}},
+	// Whimsical Star
 	{1, 1, 1, 36, 1, 1, 1, 1, {1, 1, 1, 1}}
 };
 
@@ -2258,6 +2277,7 @@
 
 			switch (gBul[i].code_bullet)
 			{
+				// Snake
 				case 1:
 					ActBullet_Frontia1(&gBul[i]);
 					break;
@@ -2267,6 +2287,8 @@
 				case 3:
 					ActBullet_Frontia2(&gBul[i], 3);
 					break;
+
+				// Polar Star
 				case 4:
 					ActBullet_PoleStar(&gBul[i], 1);
 					break;
@@ -2276,6 +2298,8 @@
 				case 6:
 					ActBullet_PoleStar(&gBul[i], 3);
 					break;
+
+				// Fireball
 				case 7:
 					ActBullet_FireBall(&gBul[i], 1);
 					break;
@@ -2285,6 +2309,8 @@
 				case 9:
 					ActBullet_FireBall(&gBul[i], 3);
 					break;
+
+				// Machine Gun
 				case 10:
 					ActBullet_MachineGun(&gBul[i], 1);
 					break;
@@ -2294,6 +2320,8 @@
 				case 12:
 					ActBullet_MachineGun(&gBul[i], 3);
 					break;
+
+				// Missile Launcher
 				case 13:
 					ActBullet_Missile(&gBul[i], 1);
 					break;
@@ -2303,6 +2331,8 @@
 				case 15:
 					ActBullet_Missile(&gBul[i], 3);
 					break;
+
+				// Missile Launcher explosion
 				case 16:
 					ActBullet_Bom(&gBul[i], 1);
 					break;
@@ -2312,6 +2342,8 @@
 				case 18:
 					ActBullet_Bom(&gBul[i], 3);
 					break;
+
+				// Bubbler
 				case 19:
 					ActBullet_Bubblin1(&gBul[i]);
 					break;
@@ -2321,15 +2353,23 @@
 				case 21:
 					ActBullet_Bubblin3(&gBul[i]);
 					break;
+
+				// Bubbler level 3 spines
 				case 22:
 					ActBullet_Spine(&gBul[i]);
 					break;
+
+				// Blade slashes
 				case 23:
 					ActBullet_Edge(&gBul[i]);
 					break;
+
+				// Falling spike that deals 127 damage
 				case 24:
 					ActBullet_Drop(&gBul[i]);
 					break;
+
+				// Blade
 				case 25:
 					ActBullet_Sword1(&gBul[i]);
 					break;
@@ -2339,6 +2379,8 @@
 				case 27:
 					ActBullet_Sword3(&gBul[i]);
 					break;
+
+				// Super Missile Launcher
 				case 28:
 					ActBullet_SuperMissile(&gBul[i], 1);
 					break;
@@ -2348,6 +2390,8 @@
 				case 30:
 					ActBullet_SuperMissile(&gBul[i], 3);
 					break;
+
+				// Super Missile Launcher explosion
 				case 31:
 					ActBullet_SuperBom(&gBul[i], 1);
 					break;
@@ -2357,6 +2401,8 @@
 				case 33:
 					ActBullet_SuperBom(&gBul[i], 3);
 					break;
+
+				// Nemesis
 				case 34:	// Identical to case 43
 					ActBullet_Nemesis(&gBul[i], 1);
 					break;
@@ -2366,6 +2412,8 @@
 				case 36:
 					ActBullet_Nemesis(&gBul[i], 3);
 					break;
+
+				// Spur
 				case 37:
 					ActBullet_Spur(&gBul[i], 1);
 					break;
@@ -2375,6 +2423,8 @@
 				case 39:
 					ActBullet_Spur(&gBul[i], 3);
 					break;
+
+				// Spur trail
 				case 40:
 					ActBullet_SpurTail(&gBul[i], 1);
 					break;
@@ -2384,12 +2434,18 @@
 				case 42:
 					ActBullet_SpurTail(&gBul[i], 3);
 					break;
+
+				// Curly's Nemesis
 				case 43:	// Identical to case 34
 					ActBullet_Nemesis(&gBul[i], 1);
 					break;
+
+				// Screen-nuke that kills all enemies
 				case 44:
 					ActBullet_EnemyClear(&gBul[i]);
 					break;
+
+				// Whimsical Star
 				case 45:
 					ActBullet_Star(&gBul[i]);
 					break;
--- a/src/NpcAct000.cpp
+++ b/src/NpcAct000.cpp
@@ -1314,8 +1314,8 @@
 				npc->ani_no = 3;
 				npc->ym = -0x800;
 				npc->bits |= NPC_IGNORE_SOLIDITY;
-				DeleteNpCharCode(150, 0);
-				DeleteNpCharCode(117, 0);
+				DeleteNpCharCode(150, FALSE);
+				DeleteNpCharCode(117, FALSE);
 				SetNpChar(355, 0, 0, 0, 0, 0, npc, 0x100);
 				SetNpChar(355, 0, 0, 0, 0, 1, npc, 0x100);
 			}
--- a/src/NpcAct160.cpp
+++ b/src/NpcAct160.cpp
@@ -51,7 +51,7 @@
 
 			if (npc->flag & 8)
 			{
-				DeleteNpCharCode(161, 1);
+				DeleteNpCharCode(161, TRUE);
 
 				for (i = 0; i < 4; ++i)
 					SetNpChar(4, npc->x + (Random(-12, 12) * 0x200), npc->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, NULL, 0x100);
@@ -245,7 +245,7 @@
 	switch (npc->act_no)
 	{
 		case 0:
-			DeleteNpCharCode(161, 1);
+			DeleteNpCharCode(161, TRUE);
 			PlaySoundObject(72, 1);
 
 			for (i = 0; i < 10; ++i)
@@ -315,7 +315,7 @@
 			if (++npc->count1 < 60)
 				break;
 
-			DeleteNpCharCode(161, 1);
+			DeleteNpCharCode(161, TRUE);
 			npc->cond = 0;
 
 			break;
--- a/src/NpcAct240.cpp
+++ b/src/NpcAct240.cpp
@@ -778,7 +778,7 @@
 			npc->xm = 0;
 			npc->ym = 0;
 
-			DeleteNpCharCode(252, 1);
+			DeleteNpCharCode(252, TRUE);
 
 			SetNpChar(4, npc->x, npc->y, 0, 0, 0, NULL, 0x100);
 			SetNpChar(4, npc->x, npc->y, 0, 0, 0, NULL, 0x100);
--- a/src/NpcAct260.cpp
+++ b/src/NpcAct260.cpp
@@ -1003,7 +1003,7 @@
 			break;
 
 		case 500:
-			DeleteNpCharCode(269, 1);
+			DeleteNpCharCode(269, TRUE);
 			npc->bits &= ~NPC_SHOOTABLE;
 			npc->ani_no = 4;
 			npc->ym += 0x20;
--- a/src/NpcAct280.cpp
+++ b/src/NpcAct280.cpp
@@ -116,7 +116,7 @@
 		case 21:
 			if (++npc->act_wait > 250)
 			{
-				DeleteNpCharCode(270, 0);
+				DeleteNpCharCode(270, FALSE);
 				npc->act_no = 22;
 			}
 
@@ -689,7 +689,7 @@
 			npc->view.top = 16 * 0x200;
 			npc->view.back = 16 * 0x200;
 			npc->view.front = 16 * 0x200;
-			DeleteNpCharCode(257, 1);
+			DeleteNpCharCode(257, TRUE);
 			break;
 
 		case 20:
--- a/src/NpcAct300.cpp
+++ b/src/NpcAct300.cpp
@@ -1339,7 +1339,7 @@
 			npc->ani_no = 8;
 			npc->tgt_x = npc->x;
 			npc->damage = 0;
-			DeleteNpCharCode(315, 1);
+			DeleteNpCharCode(315, TRUE);
 			// Fallthrough
 		case 501:
 			npc->ym += 0x20;
--- a/src/TextScr.cpp
+++ b/src/TextScr.cpp
@@ -1098,7 +1098,7 @@
 					else if (IS_COMMAND('D','N','A'))
 					{
 						z = GetTextScriptNo(gTS.p_read + 4);
-						DeleteNpCharCode(z, 1);
+						DeleteNpCharCode(z, TRUE);
 						gTS.p_read += 8;
 					}
 					else if (IS_COMMAND('B','O','A'))