Clean-up Boss.cpp

This commit is contained in:
Clownacy 2019-11-17 16:18:06 +00:00
parent d7033994ac
commit 4e82665819
2 changed files with 21 additions and 19 deletions

View file

@ -42,15 +42,15 @@ void PutBossChar(int fx, int fy)
{ {
if (gBoss[b].cond & 0x80) 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 else
{ {
a = 0; 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); SetValueView(&gBoss[b].x, &gBoss[b].y, gBoss[b].damage_view);
gBoss[b].damage_view = 0; gBoss[b].damage_view = 0;
@ -65,8 +65,8 @@ void PutBossChar(int fx, int fy)
PutBitmap3( PutBitmap3(
&grcGame, &grcGame,
(gBoss[b].x - side) / 0x200 - fx / 0x200 + a, ((gBoss[b].x - side) / 0x200) - (fx / 0x200) + a,
(gBoss[b].y - gBoss[b].view.top) / 0x200 - fy / 0x200, ((gBoss[b].y - gBoss[b].view.top) / 0x200) - (fy / 0x200),
&gBoss[b].rect, &gBoss[b].rect,
SURFACE_ID_LEVEL_SPRITESET_2); SURFACE_ID_LEVEL_SPRITESET_2);
} }
@ -78,7 +78,7 @@ void SetBossCharActNo(int a)
gBoss[0].act_no = a; gBoss[0].act_no = a;
} }
void HitBossBullet() void HitBossBullet(void)
{ {
BOOL bHit; BOOL bHit;
int bul; int bul;
@ -87,12 +87,12 @@ void HitBossBullet()
for (bos = 0; bos < BOSS_MAX; ++bos) for (bos = 0; bos < BOSS_MAX; ++bos)
{ {
if ((gBoss[bos].cond & 0x80) == 0) if (!(gBoss[bos].cond & 0x80))
continue; continue;
for (bul = 0; bul < BULLET_MAX; ++bul) for (bul = 0; bul < BULLET_MAX; ++bul)
{ {
if ((gBul[bul].cond & 0x80) == 0) if (!(gBul[bul].cond & 0x80))
continue; continue;
if (gBul[bul].damage == -1) if (gBul[bul].damage == -1)
@ -129,7 +129,7 @@ void HitBossBullet()
{ {
gBoss[bos_].life = bos_; 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); StartTextScript(gBoss[bos_].code_event);
} }
@ -168,7 +168,9 @@ void HitBossBullet()
gBoss[bos_].damage_view -= gBul[bul].damage; gBoss[bos_].damage_view -= gBul[bul].damage;
} }
if (--gBul[bul].life < 1) --gBul[bul].life;
if (gBul[bul].life < 1)
gBul[bul].cond = 0; gBul[bul].cond = 0;
} }
else if (gBul[bul].code_bullet == 13 else if (gBul[bul].code_bullet == 13
@ -182,7 +184,7 @@ void HitBossBullet()
} }
else else
{ {
if ((gBul[bul].bbits & 0x10) == 0) if (!(gBul[bul].bbits & 0x10))
{ {
SetCaret(gBul[bul].x, gBul[bul].y, 2, 2); SetCaret(gBul[bul].x, gBul[bul].y, 2, 2);
PlaySoundObject(31, 1); PlaySoundObject(31, 1);
@ -195,7 +197,7 @@ void HitBossBullet()
} }
} }
void ActBossChar_0() void ActBossChar_0(void)
{ {
; ;
} }
@ -214,12 +216,12 @@ BOSSFUNCTION gpBossFuncTbl[10] =
ActBossChar_Ballos ActBossChar_Ballos
}; };
void ActBossChar() void ActBossChar(void)
{ {
int bos; int bos;
int code_char; int code_char;
if ((gBoss[0].cond & 0x80) == 0) if (!(gBoss[0].cond & 0x80))
return; return;
code_char = gBoss[0].code_char; code_char = gBoss[0].code_char;
@ -231,7 +233,7 @@ void ActBossChar()
--gBoss[bos].shock; --gBoss[bos].shock;
} }
void HitBossMap() void HitBossMap(void)
{ {
int offx[16]; int offx[16];
int offy[16]; int offy[16];
@ -279,7 +281,7 @@ void HitBossMap()
{ {
int judg; int judg;
if ((gBoss[b].cond & 0x80) == 0) if (!(gBoss[b].cond & 0x80))
continue; continue;
if (gBoss[b].bits & NPC_IGNORE_SOLIDITY) if (gBoss[b].bits & NPC_IGNORE_SOLIDITY)

View file

@ -11,6 +11,6 @@ extern BOSSFUNCTION gpBossFuncTbl[10];
void InitBossChar(int code); void InitBossChar(int code);
void PutBossChar(int fx, int fy); void PutBossChar(int fx, int fy);
void SetBossCharActNo(int a); void SetBossCharActNo(int a);
void HitBossBullet(); void HitBossBullet(void);
void ActBossChar(); void ActBossChar(void);
void HitBossMap(); void HitBossMap(void);