Made BossPress.cpp ASM-accurate

This commit is contained in:
Clownacy 2019-04-08 12:16:44 +01:00
parent 9e22db16fd
commit 64dbeaa3c2

View file

@ -9,87 +9,97 @@
void ActBossChar_Press(void) void ActBossChar_Press(void)
{ {
switch (gBoss[0].act_no) static unsigned char flash;
int i;
int x;
NPCHAR *npc = gBoss;
switch (npc->act_no)
{ {
case 0: case 0:
gBoss[0].act_no = 10; npc->act_no = 10;
gBoss[0].cond = 0x80; npc->cond = 0x80;
gBoss[0].exp = 1; npc->exp = 1;
gBoss[0].direct = 2; npc->direct = 2;
gBoss[0].x = 0; npc->x = 0;
gBoss[0].y = 0; npc->y = 0;
gBoss[0].view.front = 0x5000; npc->view.front = 0x5000;
gBoss[0].view.top = 0x7800; npc->view.top = 0x7800;
gBoss[0].view.back = 0x5000; npc->view.back = 0x5000;
gBoss[0].view.bottom = 0x7800; npc->view.bottom = 0x7800;
gBoss[0].hit_voice = 54; npc->hit_voice = 54;
gBoss[0].hit.front = 0x6200; npc->hit.front = 0x6200;
gBoss[0].hit.top = 0x7800; npc->hit.top = 0x7800;
gBoss[0].hit.back = 0x5000; npc->hit.back = 0x5000;
gBoss[0].hit.bottom = 0x6000; npc->hit.bottom = 0x6000;
gBoss[0].bits = 0x8248; npc->bits = 0x8248;
gBoss[0].size = 3; npc->size = 3;
gBoss[0].damage = 10; npc->damage = 10;
gBoss[0].code_event = 1000; npc->code_event = 1000;
gBoss[0].life = 700; npc->life = 700;
break; break;
case 5: case 5:
gBoss[0].act_no = 6; npc->act_no = 6;
gBoss[0].x = 0; npc->x = 0;
gBoss[0].y = 0; npc->y = 0;
gBoss[1].cond = 0; gBoss[1].cond = 0;
gBoss[2].cond = 0; gBoss[2].cond = 0;
break; break;
case 10: case 10:
gBoss[0].act_no = 11; npc->act_no = 11;
gBoss[0].x = 0x14000; npc->x = 0x14000;
gBoss[0].y = 0x9400; npc->y = 0x9400;
break; break;
case 20: case 20:
gBoss[0].damage = 0; npc->damage = 0;
gBoss[0].act_no = 21; npc->act_no = 21;
gBoss[0].x = 0x14000; npc->x = 0x14000;
gBoss[0].y = 0x33A00; npc->y = 0x33A00;
gBoss[0].bits &= ~0x40; npc->bits &= ~0x40;
gBoss[1].cond = 0; gBoss[1].cond = 0;
gBoss[2].cond = 0; gBoss[2].cond = 0;
// Fallthrough // Fallthrough
case 21: case 21:
if ((++gBoss[0].act_wait & 0xF) == 0) if ((++npc->act_wait % 0x10) == 0)
SetDestroyNpChar(gBoss[0].x + (Random(-40, 40) * 0x200), gBoss[0].y + (Random(-60, 60) * 0x200), 1, 1); SetDestroyNpChar(npc->x + (Random(-40, 40) * 0x200), npc->y + (Random(-60, 60) * 0x200), 1, 1);
break; break;
case 30: case 30:
gBoss[0].act_no = 31; npc->act_no = 31;
gBoss[0].ani_no = 2; npc->ani_no = 2;
gBoss[0].x = 81920; npc->x = 81920;
gBoss[0].y = 0x8000; npc->y = 0x8000;
// Fallthrough // Fallthrough
case 31: case 31:
gBoss[0].y += 0x800; npc->y += 0x800;
if (gBoss[0].y >= 0x33A00) if (npc->y >= 0x33A00)
{ {
gBoss[0].y = 0x33A00; npc->y = 0x33A00;
gBoss[0].ani_no = 0; npc->ani_no = 0;
gBoss[0].act_no = 20; npc->act_no = 20;
PlaySoundObject(44, 1); PlaySoundObject(44, 1);
for (int i = 0; i < 5; ++i) for (i = 0; i < 5; ++i)
SetNpChar(4, gBoss[0].x + (Random(-40, 40) * 0x200), gBoss[0].y + 0x7800, 0, 0, 0, 0, 0x100); {
x = npc->x + (Random(-40, 40) * 0x200);
SetNpChar(4, x, npc->y + 0x7800, 0, 0, 0, 0, 0x100);
}
} }
break; break;
case 100: case 100:
gBoss[0].act_no = 101; npc->act_no = 101;
gBoss[0].count2 = 9; npc->count2 = 9;
gBoss[0].act_wait = -100; npc->act_wait = -100;
gBoss[1].cond = 0x80; gBoss[1].cond = 0x80;
gBoss[1].hit.front = 0x1C00; gBoss[1].hit.front = 0x1C00;
@ -107,31 +117,31 @@ void ActBossChar_Press(void)
gBoss[3].hit.top = 0x1000; gBoss[3].hit.top = 0x1000;
gBoss[3].hit.bottom = 0x1000; gBoss[3].hit.bottom = 0x1000;
SetNpChar(325, gBoss[0].x, gBoss[0].y + 0x7800, 0, 0, 0, 0, 0x100); SetNpChar(325, npc->x, npc->y + 0x7800, 0, 0, 0, 0, 0x100);
// Fallthrough // Fallthrough
case 101: case 101:
if (gBoss[0].count2 > 1 && gBoss[0].life < 70 * gBoss[0].count2) if (npc->count2 > 1 && npc->life < 70 * npc->count2)
{ {
--gBoss[0].count2; --npc->count2;
for (int i = 0; i < 5; ++i) for (i = 0; i < 5; ++i)
{ {
ChangeMapParts(i + 8, gBoss[0].count2, 0); ChangeMapParts(i + 8, npc->count2, 0);
SetDestroyNpChar((i + 8) * 0x2000, gBoss[0].count2 * 0x2000, 0, 4); SetDestroyNpChar((i + 8) * 0x200 * 0x10, npc->count2 * 0x200 * 0x10, 0, 4);
PlaySoundObject(12, 1); PlaySoundObject(12, 1);
} }
} }
if (++gBoss[0].act_wait == 81 || gBoss[0].act_wait == 241) if (++npc->act_wait == 81 || npc->act_wait == 241)
SetNpChar(323, 0x6000, 0x1E000, 0, 0, 1, 0, 0x100); SetNpChar(323, 0x6000, 0x1E000, 0, 0, 1, 0, 0x100);
if (gBoss[0].act_wait == 1 || gBoss[0].act_wait == 161) if (npc->act_wait == 1 || npc->act_wait == 161)
SetNpChar(323, 0x22000, 0x1E000, 0, 0, 1, 0, 0x100); SetNpChar(323, 0x22000, 0x1E000, 0, 0, 1, 0, 0x100);
if (gBoss[0].act_wait >= 300) if (npc->act_wait >= 300)
{ {
gBoss[0].act_wait = 0; npc->act_wait = 0;
SetNpChar(325, gBoss[0].x, gBoss[0].y + 0x7800, 0, 0, 0, 0, 0x100); SetNpChar(325, npc->x, npc->y + 0x7800, 0, 0, 0, 0, 0x100);
} }
break; break;
@ -139,62 +149,62 @@ void ActBossChar_Press(void)
case 500: case 500:
gBoss[3].bits &= ~0x20; gBoss[3].bits &= ~0x20;
gBoss[0].act_no = 501; npc->act_no = 501;
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].count1 = 0; npc->count1 = 0;
DeleteNpCharCode(325, 1); DeleteNpCharCode(325, 1);
DeleteNpCharCode(330, 1); DeleteNpCharCode(330, 1);
// Fallthrough // Fallthrough
case 501: case 501:
if ((++gBoss[0].act_wait & 0xF) == 0) if ((++npc->act_wait % 0x10) == 0)
{ {
PlaySoundObject(12, 1); PlaySoundObject(12, 1);
SetDestroyNpChar(gBoss[0].x + (Random(-40, 40) * 0x200), gBoss[0].y + (Random(-60, 60) * 0x200), 1, 1); SetDestroyNpChar(npc->x + (Random(-40, 40) * 0x200), npc->y + (Random(-60, 60) * 0x200), 1, 1);
} }
if (gBoss[0].act_wait == 95) if (npc->act_wait == 95)
gBoss[0].ani_no = 1; npc->ani_no = 1;
if (gBoss[0].act_wait == 98) if (npc->act_wait == 98)
gBoss[0].ani_no = 2; npc->ani_no = 2;
if (gBoss[0].act_wait > 100) if (npc->act_wait > 100)
gBoss[0].act_no = 510; npc->act_no = 510;
break; break;
case 510: case 510:
gBoss[0].ym += 0x40; npc->ym += 0x40;
gBoss[0].damage = 0x7F; npc->damage = 0x7F;
gBoss[0].y += gBoss[0].ym; npc->y += npc->ym;
if (gBoss[0].count1 == 0 && gBoss[0].y > 0x14000) if (npc->count1 == 0 && npc->y > 0x14000)
{ {
gBoss[0].count1 = 1; npc->count1 = 1;
gBoss[0].ym = -0x200; npc->ym = -0x200;
gBoss[0].damage = 0; npc->damage = 0;
for (int i = 0; i < 7; ++i) for (i = 0; i < 7; ++i)
{ {
ChangeMapParts(i + 7, 14, 0); ChangeMapParts(i + 7, 14, 0);
SetDestroyNpChar((i + 7) * 0x2000, 0x1C000, 0, 0); SetDestroyNpChar((i + 7) * 0x200 * 0x10, 0x1C000, 0, 0);
PlaySoundObject(12, 1); PlaySoundObject(12, 1);
} }
} }
if (gBoss[0].y > 0x3C000) if (npc->y > 0x3C000)
gBoss[0].act_no = 520; npc->act_no = 520;
break; break;
} }
gBoss[1].x = gBoss[0].x - 0x3000; gBoss[1].x = npc->x - 0x3000;
gBoss[1].y = gBoss[0].y + 0x6800; gBoss[1].y = npc->y + 0x6800;
gBoss[2].x = gBoss[0].x + 0x3000; gBoss[2].x = npc->x + 0x3000;
gBoss[2].y = gBoss[0].y + 0x6800; gBoss[2].y = npc->y + 0x6800;
gBoss[3].x = gBoss[0].x; gBoss[3].x = npc->x;
gBoss[3].y = gBoss[0].y + 0x5000; gBoss[3].y = npc->y + 0x5000;
RECT rc[3] = { RECT rc[3] = {
{0, 0, 80, 120}, {0, 0, 80, 120},
@ -208,17 +218,15 @@ void ActBossChar_Press(void)
{160, 120, 240, 240}, {160, 120, 240, 240},
}; };
if (gBoss[0].shock) if (npc->shock)
{ {
static unsigned char flash; if (++flash / 2 % 2)
npc->rect = rc[npc->ani_no];
if ((++flash / 2) % 2)
gBoss[0].rect = rc[gBoss[0].ani_no];
else else
gBoss[0].rect = rcDamage[gBoss[0].ani_no]; npc->rect = rcDamage[npc->ani_no];
} }
else else
{ {
gBoss[0].rect = rc[gBoss[0].ani_no]; npc->rect = rc[npc->ani_no];
} }
} }