ref: 4e8266581900848341b43e72b8d8c6ff6f5535c0
parent: d7033994ac1012fb8a9b6842f3b26d71e9cfd0ca
author: Clownacy <Clownacy@users.noreply.github.com>
date: Sun Nov 17 11:18:06 EST 2019
Clean-up Boss.cpp
--- a/src/Boss.cpp
+++ b/src/Boss.cpp
@@ -42,15 +42,15 @@
{
if (gBoss[b].cond & 0x80)
{
- if (gBoss[b].shock)
+ if (gBoss[b].shock != 0)
{
- a = 2 * (gBoss[b].shock / 2 % 2) - 1;
+ a = ((gBoss[b].shock / 2 % 2) * 2) - 1;
}
else
{
a = 0;
- if (gBoss[b].bits & NPC_SHOW_DAMAGE && gBoss[b].damage_view)
+ if (gBoss[b].bits & NPC_SHOW_DAMAGE && gBoss[b].damage_view != 0)
{
SetValueView(&gBoss[b].x, &gBoss[b].y, gBoss[b].damage_view);
gBoss[b].damage_view = 0;
@@ -65,8 +65,8 @@
PutBitmap3(
&grcGame,
- (gBoss[b].x - side) / 0x200 - fx / 0x200 + a,
- (gBoss[b].y - gBoss[b].view.top) / 0x200 - fy / 0x200,
+ ((gBoss[b].x - side) / 0x200) - (fx / 0x200) + a,
+ ((gBoss[b].y - gBoss[b].view.top) / 0x200) - (fy / 0x200),
&gBoss[b].rect,
SURFACE_ID_LEVEL_SPRITESET_2);
}
@@ -78,7 +78,7 @@
gBoss[0].act_no = a;
}
-void HitBossBullet()
+void HitBossBullet(void)
{
BOOL bHit;
int bul;
@@ -87,12 +87,12 @@
for (bos = 0; bos < BOSS_MAX; ++bos)
{
- if ((gBoss[bos].cond & 0x80) == 0)
+ if (!(gBoss[bos].cond & 0x80))
continue;
for (bul = 0; bul < BULLET_MAX; ++bul)
{
- if ((gBul[bul].cond & 0x80) == 0)
+ if (!(gBul[bul].cond & 0x80))
continue;
if (gBul[bul].damage == -1)
@@ -129,7 +129,7 @@
{
gBoss[bos_].life = bos_;
- if ((gMC.cond & 0x80) && gBoss[bos_].bits & NPC_EVENT_WHEN_KILLED)
+ if (gMC.cond & 0x80 && gBoss[bos_].bits & NPC_EVENT_WHEN_KILLED)
{
StartTextScript(gBoss[bos_].code_event);
}
@@ -168,7 +168,9 @@
gBoss[bos_].damage_view -= gBul[bul].damage;
}
- if (--gBul[bul].life < 1)
+ --gBul[bul].life;
+
+ if (gBul[bul].life < 1)
gBul[bul].cond = 0;
}
else if (gBul[bul].code_bullet == 13
@@ -182,7 +184,7 @@
}
else
{
- if ((gBul[bul].bbits & 0x10) == 0)
+ if (!(gBul[bul].bbits & 0x10))
{
SetCaret(gBul[bul].x, gBul[bul].y, 2, 2);
PlaySoundObject(31, 1);
@@ -195,7 +197,7 @@
}
}
-void ActBossChar_0()
+void ActBossChar_0(void)
{
;
}
@@ -214,12 +216,12 @@
ActBossChar_Ballos
};
-void ActBossChar()
+void ActBossChar(void)
{
int bos;
int code_char;
- if ((gBoss[0].cond & 0x80) == 0)
+ if (!(gBoss[0].cond & 0x80))
return;
code_char = gBoss[0].code_char;
@@ -231,7 +233,7 @@
--gBoss[bos].shock;
}
-void HitBossMap()
+void HitBossMap(void)
{
int offx[16];
int offy[16];
@@ -279,7 +281,7 @@
{
int judg;
- if ((gBoss[b].cond & 0x80) == 0)
+ if (!(gBoss[b].cond & 0x80))
continue;
if (gBoss[b].bits & NPC_IGNORE_SOLIDITY)
--- a/src/Boss.h
+++ b/src/Boss.h
@@ -11,6 +11,6 @@
void InitBossChar(int code);
void PutBossChar(int fx, int fy);
void SetBossCharActNo(int a);
-void HitBossBullet();
-void ActBossChar();
-void HitBossMap();
+void HitBossBullet(void);
+void ActBossChar(void);
+void HitBossMap(void);