shithub: cstory

Download patch

ref: 6862347c377e98dc393ff64a47c9fe06836a4d22
parent: 696df90d19347a43c26244dea3072f196496d69d
author: Clownacy <Clownacy@users.noreply.github.com>
date: Wed Nov 13 21:22:16 EST 2019

Clean-up NpcHit.cpp

--- a/src/NpcHit.cpp
+++ b/src/NpcHit.cpp
@@ -294,9 +294,9 @@
 	offy[7] = 2;
 	offy[8] = 2;
 
-	for (i = 0; i < NPC_MAX; i++)
+	for (i = 0; i < NPC_MAX; ++i)
 	{
-		if ((gNPC[i].cond & 0x80) == 0)
+		if (!(gNPC[i].cond & 0x80))
 			continue;
 
 		if (gNPC[i].bits & NPC_IGNORE_SOLIDITY)
@@ -317,7 +317,7 @@
 
 		gNPC[i].flag = 0;
 
-		for (j = 0; j < judg; j++)
+		for (j = 0; j < judg; ++j)
 		{
 			switch (GetAttribute(x + offx[j], y + offy[j]))
 			{
@@ -480,7 +480,7 @@
 	}
 
 	// Create drop
-	if (npc->exp)
+	if (npc->exp != 0)
 	{
 		int val;
 
@@ -511,6 +511,7 @@
 			default:
 				// Spawn weapon energy
 				SetExpObjects(npc->x, npc->y, npc->exp);
+				break;
 		}
 	}
 
@@ -531,23 +532,23 @@
 	}
 }
 
-void HitNpCharBullet()
+void HitNpCharBullet(void)
 {
 	int n;
 	int b;
 	BOOL bHit;
 
-	for (n = 0; n < NPC_MAX; n++)
+	for (n = 0; n < NPC_MAX; ++n)
 	{
-		if ((gNPC[n].cond & 0x80) == 0)
+		if (!(gNPC[n].cond & 0x80))
 			continue;
 
 		if (gNPC[n].bits & NPC_SHOOTABLE && gNPC[n].bits & NPC_INTERACTABLE)
 			continue;
 
-		for (b = 0; b < BULLET_MAX; b++)
+		for (b = 0; b < BULLET_MAX; ++b)
 		{
-			if ((gBul[b].cond & 0x80) == 0)
+			if (!(gBul[b].cond & 0x80))
 				continue;
 
 			if (gBul[b].damage == -1)
@@ -611,7 +612,7 @@
 				{
 					// Strange empty case that's needed for accurate assembly
 				}
-				else if ((gBul[b].bbits & 0x10) == 0)
+				else if (!(gBul[b].bbits & 0x10))
 				{
 					// Hit invulnerable NPC
 					SetCaret((gBul[b].x + gNPC[n].x) / 2, (gBul[b].y + gNPC[n].y) / 2, 2, 2);
@@ -628,4 +629,3 @@
 			LoseNpChar(&gNPC[n], TRUE);
 	}
 }
-
--- a/src/NpcHit.h
+++ b/src/NpcHit.h
@@ -14,6 +14,6 @@
 void JudgeHitNpCharTriangleG(NPCHAR *npc, int x, int y);
 void JudgeHitNpCharTriangleH(NPCHAR *npc, int x, int y);
 void JudgeHitNpCharWater(NPCHAR *npc, int x, int y);
-void HitNpCharMap();
+void HitNpCharMap(void);
 void LoseNpChar(NPCHAR *npc, BOOL bVanish);
-void HitNpCharBullet();
+void HitNpCharBullet(void);