Code cleanup

This commit is contained in:
Clownacy 2019-08-23 00:30:33 +00:00
parent 32c55a66fd
commit 6f71f2405d
8 changed files with 122 additions and 129 deletions

View file

@ -137,8 +137,8 @@ static void ActBossChar_Core_Mini(NPCHAR *npc)
npc->bits |= NPC_SHOOTABLE;
// Fallthrough
case 101:
npc->x += (npc->tgt_x - npc->x) / 16;
npc->y += (npc->tgt_y - npc->y) / 16;
npc->x += (npc->tgt_x - npc->x) / 0x10;
npc->y += (npc->tgt_y - npc->y) / 0x10;
if (++npc->act_wait > 50)
npc->ani_no = 0;
@ -168,8 +168,8 @@ static void ActBossChar_Core_Mini(NPCHAR *npc)
npc->tgt_y = npc->y + (Random(-4, 4) * 0x200);
// Fallthrough
case 131:
npc->x += (npc->tgt_x - npc->x) / 16;
npc->y += (npc->tgt_y - npc->y) / 16;
npc->x += (npc->tgt_x - npc->x) / 0x10;
npc->y += (npc->tgt_y - npc->y) / 0x10;
if (++npc->act_wait > 50)
{
@ -190,8 +190,8 @@ static void ActBossChar_Core_Mini(NPCHAR *npc)
break;
case 140:
npc->x += (npc->tgt_x - npc->x) / 16;
npc->y += (npc->tgt_y - npc->y) / 16;
npc->x += (npc->tgt_x - npc->x) / 0x10;
npc->y += (npc->tgt_y - npc->y) / 0x10;
break;
case 200:
@ -224,14 +224,17 @@ static void ActBossChar_Core_Hit(NPCHAR *npc)
npc->x = gBoss[0].x;
npc->y = gBoss[0].y - 0x4000;
break;
case 1:
npc->x = gBoss[0].x + 0x3800;
npc->y = gBoss[0].y;
break;
case 2:
npc->x = gBoss[0].x + 0x800;
npc->y = gBoss[0].y + 0x4000;
break;
case 3:
npc->x = gBoss[0].x - 0x3800;
npc->y = gBoss[0].y + 0x800;
@ -423,7 +426,7 @@ void ActBossChar_Core(void)
// Fallthrough
case 221:
++npc->act_wait;
SetNpChar(199, gMC.x + (Random(-50, 150) * 0x200 * 2), gMC.y + (Random(-0xA0, 0xA0) * 0x200), 0, 0, 0, 0, 0x100);
SetNpChar(199, gMC.x + (Random(-50, 150) * 0x200 * 2), gMC.y + (Random(-160, 160) * 0x200), 0, 0, 0, 0, 0x100);
gMC.xm -= 0x20;
gMC.cond |= 0x20;

View file

@ -532,18 +532,23 @@ void ActBossChar_Undead(void)
case 230:
npc->act_no = 231;
npc->act_wait = 0;
gBoss[3].act_no = 30;
gBoss[8].bits |= NPC_INVULNERABLE;
gBoss[9].bits |= NPC_INVULNERABLE;
gBoss[10].bits |= NPC_INVULNERABLE;
gBoss[11].bits |= NPC_SHOOTABLE;
PlaySoundObject(25, 1);
SetNpChar(285, gBoss[3].x - 0x2000, gBoss[3].y, 0, 0, 0, 0, 0x100);
SetNpChar(285, gBoss[3].x - 0x2000, gBoss[3].y, 0, 0, 0x400, 0, 0x100);
SetNpChar(285, gBoss[3].x, gBoss[3].y - 0x2000, 0, 0, 0, 0, 0x100);
SetNpChar(285, gBoss[3].x, gBoss[3].y - 0x2000, 0, 0, 0x400, 0, 0x100);
SetNpChar(285, gBoss[3].x, gBoss[3].y + 0x2000, 0, 0, 0, 0, 0x100);
SetNpChar(285, gBoss[3].x, gBoss[3].y + 0x2000, 0, 0, 0x400, 0, 0x100);
life = npc->life;
bShock = TRUE;
// Fallthrough
@ -719,12 +724,16 @@ void ActBossChar_Undead(void)
npc->y += npc->ym;
ActBossCharA_Face(&gBoss[3]);
ActBossCharA_Head(&gBoss[4]);
ActBossCharA_Tail(&gBoss[5]);
ActBossCharA_Mini(&gBoss[1]);
ActBossCharA_Mini(&gBoss[2]);
ActBossCharA_Mini(&gBoss[6]);
ActBossCharA_Mini(&gBoss[7]);
ActBossCharA_Hit(&gBoss[8]);
ActBossCharA_Hit(&gBoss[9]);
ActBossCharA_Hit(&gBoss[10]);

View file

@ -117,13 +117,13 @@ static void ActBossChar_Body(NPCHAR *npc)
npc->rect = rc[npc->ani_no];
}
static void ActBossChar_HITAI(NPCHAR *npc)
static void ActBossChar_HITAI(NPCHAR *npc) // "Hitai" = "forehead" or "brow" (according to Google Translate, anyway)
{
npc->x = gBoss[0].x;
npc->y = gBoss[0].y - 0x5800;
}
static void ActBossChar_HARA(NPCHAR *npc)
static void ActBossChar_HARA(NPCHAR *npc) // "Hara" = "belly" or "stomach" (according to Google Translate, anyway)
{
npc->x = gBoss[0].x;
npc->y = gBoss[0].y;
@ -373,8 +373,8 @@ void ActBossChar_Ballos(void)
for (i = 0; i < 0x100; i += 0x40)
{
SetNpChar(342, npc->x, npc->y, 0, 0, i, npc, 0x5A);
SetNpChar(342, npc->x, npc->y, 0, 0, i + 544, npc, 0x5A);
SetNpChar(342, npc->x, npc->y, 0, 0, i, npc, 90);
SetNpChar(342, npc->x, npc->y, 0, 0, i + 544, npc, 90);
}
SetNpChar(343, npc->x, npc->y, 0, 0, 0, npc, 0x18);
@ -641,6 +641,7 @@ void ActBossChar_Ballos(void)
gBoss[3].cond = 0;
gBoss[4].cond = 0;
gBoss[5].cond = 0;
DeleteNpCharCode(350, 1);
DeleteNpCharCode(348, 1);
}

View file

@ -147,7 +147,7 @@ void ActBossChar_Frog(void)
boss->ani_no = 3;
boss->cond = 0x80;
boss->rect = rcRight[0];
gBoss[1].cond = -112;
gBoss[1].cond = 0x90;
gBoss[1].code_event = 1000;
gBoss[2].cond = 0x80;
gBoss[1].damage = 5;

View file

@ -192,7 +192,7 @@ void ActBossChar_Omega()
SetQuake(2);
gBoss[0].y -= 0x200;
if (!(++gBoss[0].act_wait % 4))
if (++gBoss[0].act_wait % 4 == 0)
PlaySoundObject(26, 1);
if (gBoss[0].act_wait == 48)
@ -273,7 +273,7 @@ void ActBossChar_Omega()
if (gBoss[0].count2 == 1)
gBoss[0].damage = 20;
if (!gBoss[0].count2)
if (gBoss[0].count2 == 0)
{
PlaySoundObject(102, 0);
PlaySoundObject(12, 1);
@ -303,7 +303,7 @@ void ActBossChar_Omega()
SetQuake(2);
gBoss[0].y += 0x200;
if (!(++gBoss[0].act_wait % 4))
if (++gBoss[0].act_wait % 4 == 0)
PlaySoundObject(26, 1);
if (gBoss[0].act_wait == 48)
@ -319,7 +319,7 @@ void ActBossChar_Omega()
gBoss[0].act_wait = 0;
gBoss[0].act_no = 30;
gBoss[0].x = gBoss[0].tgt_x + (Random(-64, 64) << 9);
gBoss[0].x = gBoss[0].tgt_x + (Random(-0x40, 0x40) * 0x200);
gBoss[0].y = gBoss[0].tgt_y;
}
break;
@ -351,7 +351,7 @@ void ActBossChar_Omega()
if (gBoss[0].act_wait < 30 && !(gBoss[0].act_wait % 5))
{
SetNpChar(48, gBoss[0].x, gBoss[0].y - 0x2000, Random(-0x155, 0x155), -0x333, 0, NULL, 0x100);
SetNpChar(48, gBoss[0].x, gBoss[0].y - 0x2000, Random(-341, 341), -0x333, 0, NULL, 0x100);
PlaySoundObject(39, 1);
}
break;
@ -422,10 +422,10 @@ void ActBossChar_Omega()
case 150:
SetQuake(2);
if (!(++gBoss[0].act_wait % 12))
if (++gBoss[0].act_wait % 12 == 0)
PlaySoundObject(52, 1);
SetDestroyNpChar(gBoss[0].x + (Random(-48, 48) << 9), gBoss[0].y + (Random(-48, 24) << 9), 1, 1);
SetDestroyNpChar(gBoss[0].x + (Random(-0x30, 0x30) * 0x200), gBoss[0].y + (Random(-0x30, 0x18) * 0x200), 1, 1);
if (gBoss[0].act_wait > 100)
{
@ -449,9 +449,6 @@ void ActBossChar_Omega()
gBoss[5].cond = 0;
}
break;
default:
break;
}
RECT rect[4] = {
@ -472,7 +469,7 @@ void ActBossChar_Omega()
ActBoss01_12();
ActBoss01_5();
if (!gBoss[0].life && gBoss[0].act_no < 150)
if (gBoss[0].life == 0 && gBoss[0].act_no < 150)
{
gBoss[0].act_no = 150;
gBoss[0].act_wait = 0;

View file

@ -74,7 +74,7 @@ void ActBossChar_Press(void)
case 30:
npc->act_no = 31;
npc->ani_no = 2;
npc->x = 81920;
npc->x = 0x14000;
npc->y = 0x8000;
// Fallthrough
case 31:

View file

@ -324,7 +324,7 @@ void ActBossChar_Twin(void)
break;
case 20:
if (--npc->tgt_x <= 112)
if (--npc->tgt_x <= 0x70)
{
npc->act_no = 100;
npc->act_wait = 0;
@ -341,40 +341,28 @@ void ActBossChar_Twin(void)
{
++npc->count1;
}
else if (npc->act_wait < 120)
{
npc->count1 += 2;
}
else if (npc->act_wait < npc->count2)
{
npc->count1 += 4;
}
else if (npc->act_wait < npc->count2 + 40)
{
npc->count1 += 2;
}
else if (npc->act_wait < npc->count2 + 60)
{
++npc->count1;
}
else
{
if (npc->act_wait < 120)
{
npc->count1 += 2;
}
else
{
if (npc->act_wait < npc->count2)
{
npc->count1 += 4;
}
else
{
if (npc->act_wait < npc->count2 + 40)
{
npc->count1 += 2;
}
else
{
if (npc->act_wait < npc->count2 + 60)
{
++npc->count1;
}
else
{
npc->act_wait = 0;
npc->act_no = 110;
npc->count2 = Random(400, 700);
break;
}
}
}
}
npc->act_wait = 0;
npc->act_no = 110;
npc->count2 = Random(400, 700);
break;
}
if (npc->count1 > 0x3FF)
@ -387,51 +375,39 @@ void ActBossChar_Twin(void)
{
--npc->count1;
}
else if (npc->act_wait < 60)
{
npc->count1 -= 2;
}
else if (npc->act_wait < npc->count2)
{
npc->count1 -= 4;
}
else if (npc->act_wait < npc->count2 + 40)
{
npc->count1 -= 2;
}
else if (npc->act_wait < npc->count2 + 60)
{
--npc->count1;
}
else
{
if (npc->act_wait < 60)
if (npc->life < 300)
{
npc->count1 -= 2;
npc->act_wait = 0;
npc->act_no = 400;
gBoss[2].act_no = 400;
gBoss[4].act_no = 400;
}
else
{
if (npc->act_wait < npc->count2)
{
npc->count1 -= 4;
}
else
{
if (npc->act_wait < npc->count2 + 40)
{
npc->count1 -= 2;
}
else
{
if (npc->act_wait < npc->count2 + 60)
{
--npc->count1;
}
else
{
if (npc->life < 300)
{
npc->act_wait = 0;
npc->act_no = 400;
gBoss[2].act_no = 400;
gBoss[4].act_no = 400;
}
else
{
npc->act_wait = 0;
npc->act_no = 100;
npc->count2 = Random(400, 700);
}
break;
}
}
}
npc->act_wait = 0;
npc->act_no = 100;
npc->count2 = Random(400, 700);
}
break;
}
if (npc->count1 <= 0)
@ -453,41 +429,29 @@ void ActBossChar_Twin(void)
{
++npc->count1;
}
else if (npc->act_wait < 120)
{
npc->count1 += 2;
}
else if (npc->act_wait < 500)
{
npc->count1 += 4;
}
else if (npc->act_wait < 540)
{
npc->count1 += 2;
}
else if (npc->act_wait < 560)
{
++npc->count1;
}
else
{
if (npc->act_wait < 120)
{
npc->count1 += 2;
}
else
{
if (npc->act_wait < 500)
{
npc->count1 += 4;
}
else
{
if (npc->act_wait < 540)
{
npc->count1 += 2;
}
else
{
if (npc->act_wait < 560)
{
++npc->count1;
}
else
{
npc->act_no = 100;
npc->act_wait = 0;
gBoss[2].act_no = 100;
gBoss[4].act_no = 100;
break;
}
}
}
}
npc->act_no = 100;
npc->act_wait = 0;
gBoss[2].act_no = 100;
gBoss[4].act_no = 100;
break;
}
if (npc->count1 > 0x3FF)

View file

@ -230,7 +230,6 @@ static void ActBossChar03_02(NPCHAR *npc)
npc->act_no = 11;
npc->act_wait = 30 * npc->ani_no + 30;
// Fallthrough
case 11:
if (npc->act_wait)
{
@ -511,6 +510,7 @@ void ActBossChar_MonstX(void)
npc->size = 3;
npc->code_event = 1000;
npc->ani_no = 0;
gBoss[1].cond = 0x80;
gBoss[1].size = 3;
gBoss[1].direct = 0;
@ -519,8 +519,10 @@ void ActBossChar_MonstX(void)
gBoss[1].view.back = 0x3000;
gBoss[1].view.bottom = 0x3000;
gBoss[1].bits = NPC_IGNORE_SOLIDITY;
gBoss[2] = gBoss[1];
gBoss[2].direct = 2;
gBoss[3].cond = 0x80;
gBoss[3].life = 60;
gBoss[3].size = 3; // Redundant: this get overwritten a few lines later
@ -537,14 +539,18 @@ void ActBossChar_MonstX(void)
gBoss[3].hit.bottom = 0xA00;
gBoss[3].bits = NPC_IGNORE_SOLIDITY;
gBoss[3].tgt_x = 0;
gBoss[4] = gBoss[3];
gBoss[4].tgt_x = 1;
gBoss[5] = gBoss[3];
gBoss[5].tgt_x = 2;
gBoss[5].life = 100;
gBoss[6] = gBoss[3];
gBoss[6].tgt_x = 3;
gBoss[6].life = 100;
gBoss[7].cond = 0x80;
gBoss[7].x = 0x100000;
gBoss[7].y = 0x19000;
@ -560,6 +566,7 @@ void ActBossChar_MonstX(void)
gBoss[7].bits = NPC_IGNORE_SOLIDITY;
gBoss[7].size = 3;
gBoss[7].ani_no = 0;
gBoss[9].cond = 0x80;
gBoss[9].act_no = 0;
gBoss[9].direct = 1;
@ -576,8 +583,10 @@ void ActBossChar_MonstX(void)
gBoss[9].hit.bottom = 0x2000;
gBoss[9].bits = (NPC_SOLID_SOFT | NPC_INVULNERABLE | NPC_IGNORE_SOLIDITY | NPC_REAR_AND_TOP_DONT_HURT);
gBoss[9].size = 3;
gBoss[10] = gBoss[9];
gBoss[10].x = 0x108000;
gBoss[11] = gBoss[9];
gBoss[11].direct = 3;
gBoss[11].x = 0xF8000;
@ -586,8 +595,10 @@ void ActBossChar_MonstX(void)
gBoss[11].view.bottom = 0x1000;
gBoss[11].hit.top = 0x2000;
gBoss[11].hit.bottom = 0x1000;
gBoss[12] = gBoss[11];
gBoss[12].x = 0x108000;
gBoss[13] = gBoss[9];
gBoss[13].cond = 0x80;
gBoss[13].view.top = 0x2000;
@ -597,24 +608,28 @@ void ActBossChar_MonstX(void)
gBoss[13].count1 = 9;
gBoss[13].ani_no = 0;
gBoss[13].bits = NPC_IGNORE_SOLIDITY;
gBoss[14] = gBoss[13];
gBoss[14].view.front = 0x5400;
gBoss[14].view.back = 0x3C00;
gBoss[14].count1 = 10;
gBoss[14].ani_no = 1;
gBoss[14].bits = NPC_IGNORE_SOLIDITY;
gBoss[15] = gBoss[13];
gBoss[15].view.top = 0x2000;
gBoss[15].view.bottom = 0x2000;
gBoss[15].count1 = 11;
gBoss[15].ani_no = 2;
gBoss[15].bits = NPC_IGNORE_SOLIDITY;
gBoss[16] = gBoss[15];
gBoss[16].view.front = 0x5400;
gBoss[16].view.back = 0x3C00;
gBoss[16].count1 = 12;
gBoss[16].ani_no = 3;
gBoss[16].bits = NPC_IGNORE_SOLIDITY;
npc->act_no = 2;
break;
@ -836,12 +851,16 @@ void ActBossChar_MonstX(void)
ActBossChar03_01(&gBoss[10]);
ActBossChar03_01(&gBoss[11]);
ActBossChar03_01(&gBoss[12]);
npc->x += ((gBoss[11].x + gBoss[10].x + gBoss[9].x + gBoss[12].x) / 4 - npc->x) / 16;
ActBossChar03_face(&gBoss[7]);
ActBossChar03_02(&gBoss[13]);
ActBossChar03_02(&gBoss[14]);
ActBossChar03_02(&gBoss[15]);
ActBossChar03_02(&gBoss[16]);
ActBossChar03_03(&gBoss[1]);
ActBossChar03_03(&gBoss[2]);