Clean-up NpcHit.cpp

This commit is contained in:
Clownacy 2019-11-14 02:22:16 +00:00
parent 696df90d19
commit 6862347c37
2 changed files with 13 additions and 13 deletions

View file

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

View file

@ -14,6 +14,6 @@ void JudgeHitNpCharTriangleF(NPCHAR *npc, int x, int y);
void JudgeHitNpCharTriangleG(NPCHAR *npc, int x, int y); void JudgeHitNpCharTriangleG(NPCHAR *npc, int x, int y);
void JudgeHitNpCharTriangleH(NPCHAR *npc, int x, int y); void JudgeHitNpCharTriangleH(NPCHAR *npc, int x, int y);
void JudgeHitNpCharWater(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 LoseNpChar(NPCHAR *npc, BOOL bVanish);
void HitNpCharBullet(); void HitNpCharBullet(void);