Merge pull request #78 from Clownacy/master

Made more files ASM-accurate
This commit is contained in:
Cucky 2019-04-08 17:51:12 -04:00 committed by GitHub
commit 99265f73af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 1781 additions and 1601 deletions

View file

@ -105,11 +105,15 @@ static void ActBossChar_Core_Tail(NPCHAR *npc)
npc->rect = rect[npc->ani_no]; npc->rect = rect[npc->ani_no];
if (npc->act_no == 51) if (npc->act_no == 51)
npc->rect.bottom = npc->act_wait + npc->rect.top; npc->rect.bottom = npc->rect.top + npc->act_wait;
} }
static void ActBossChar_Core_Mini(NPCHAR *npc) static void ActBossChar_Core_Mini(NPCHAR *npc)
{ {
unsigned char deg;
int ym;
int xm;
RECT rect[3] = { RECT rect[3] = {
{256, 0, 320, 40}, {256, 0, 320, 40},
{256, 40, 320, 80}, {256, 40, 320, 80},
@ -176,9 +180,10 @@ static void ActBossChar_Core_Mini(NPCHAR *npc)
if (npc->act_wait == 1 || npc->act_wait == 3) if (npc->act_wait == 1 || npc->act_wait == 3)
{ {
const unsigned char deg = GetArktan(npc->x - gMC.x, npc->y - gMC.y) + Random(-2, 2); deg = GetArktan(npc->x - gMC.x, npc->y - gMC.y);
const int ym = 2 * GetSin(deg); deg += (unsigned char)Random(-2, 2);
const int xm = 2 * GetCos(deg); ym = 2 * GetSin(deg);
xm = 2 * GetCos(deg);
SetNpChar(178, npc->x, npc->y, xm, ym, 0, 0, 0x100); SetNpChar(178, npc->x, npc->y, xm, ym, 0, 0, 0x100);
PlaySoundObject(39, 1); PlaySoundObject(39, 1);
} }
@ -200,7 +205,7 @@ static void ActBossChar_Core_Mini(NPCHAR *npc)
npc->xm += 0x20; npc->xm += 0x20;
npc->x += npc->xm; npc->x += npc->xm;
if (npc->x > (gMap.width * 0x2000) + 0x4000) if (npc->x > (gMap.width * 0x200 * 0x10) + (2 * 0x200 * 0x10))
npc->cond = 0; npc->cond = 0;
break; break;
@ -237,25 +242,32 @@ static void ActBossChar_Core_Hit(NPCHAR *npc)
void ActBossChar_Core(void) void ActBossChar_Core(void)
{ {
unsigned char deg;
int ym;
int xm;
int i;
static unsigned char flash; static unsigned char flash;
bool bShock = false; NPCHAR *npc = gBoss;
switch (gBoss[0].act_no) BOOL bShock = FALSE;
switch (npc->act_no)
{ {
case 0: case 0:
gBoss[0].act_no = 10; npc->act_no = 10;
gBoss[0].exp = 1; npc->exp = 1;
gBoss[0].cond = 0x80; npc->cond = 0x80;
gBoss[0].bits = 0x800C; npc->bits = 0x800C;
gBoss[0].life = 650; npc->life = 650;
gBoss[0].hit_voice = 114; npc->hit_voice = 114;
gBoss[0].x = 0x9A000; npc->x = 0x9A000;
gBoss[0].y = 0x1C000; npc->y = 0x1C000;
gBoss[0].xm = 0; npc->xm = 0;
gBoss[0].ym = 0; npc->ym = 0;
gBoss[0].code_event = 1000; npc->code_event = 1000;
gBoss[0].bits |= 0x200; npc->bits |= 0x200;
gBoss[4].cond = 0x80; gBoss[4].cond = 0x80;
gBoss[4].act_no = 10; gBoss[4].act_no = 10;
@ -301,74 +313,74 @@ void ActBossChar_Core(void)
gBoss[1].hit.bottom = 0x2000; gBoss[1].hit.bottom = 0x2000;
gBoss[1].view.front = 0x4000; gBoss[1].view.front = 0x4000;
gBoss[1].view.top = 0x2800; gBoss[1].view.top = 0x2800;
gBoss[1].x = gBoss[0].x - 0x1000; gBoss[1].x = npc->x - 0x1000;
gBoss[1].y = gBoss[0].y - 0x8000; gBoss[1].y = npc->y - 0x8000;
gBoss[2] = gBoss[1]; gBoss[2] = gBoss[1];
gBoss[2].x = gBoss[0].x + 0x2000; gBoss[2].x = npc->x + 0x2000;
gBoss[2].y = gBoss[0].y; gBoss[2].y = npc->y;
gBoss[3] = gBoss[1]; gBoss[3] = gBoss[1];
gBoss[3].x = gBoss[0].x - 0x1000; gBoss[3].x = npc->x - 0x1000;
gBoss[3].y = gBoss[0].y + 0x8000; gBoss[3].y = npc->y + 0x8000;
gBoss[6] = gBoss[1]; gBoss[6] = gBoss[1];
gBoss[6].x = gBoss[0].x - 0x6000; gBoss[6].x = npc->x - 0x6000;
gBoss[6].y = gBoss[0].y - 0x4000; gBoss[6].y = npc->y - 0x4000;
gBoss[7] = gBoss[1]; gBoss[7] = gBoss[1];
gBoss[7].x = gBoss[0].x - 0x6000; gBoss[7].x = npc->x - 0x6000;
gBoss[7].y = gBoss[0].y + 0x4000; gBoss[7].y = npc->y + 0x4000;
break; break;
case 200: case 200:
gBoss[0].act_no = 201; npc->act_no = 201;
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[11].bits &= ~0x20; gBoss[11].bits &= ~0x20;
gSuperYpos = 0; gSuperYpos = 0;
CutNoise(); CutNoise();
// Fallthrough // Fallthrough
case 201: case 201:
gBoss[0].tgt_x = gMC.x; npc->tgt_x = gMC.x;
gBoss[0].tgt_y = gMC.y; npc->tgt_y = gMC.y;
if (++gBoss[0].act_wait > 400) if (++npc->act_wait > 400)
{ {
++gBoss[0].count1; ++npc->count1;
PlaySoundObject(115, 1); PlaySoundObject(115, 1);
if (gBoss[0].count1 > 3) if (npc->count1 > 3)
{ {
gBoss[0].count1 = 0; npc->count1 = 0;
gBoss[0].act_no = 220; npc->act_no = 220;
gBoss[4].ani_no = 0; gBoss[4].ani_no = 0;
gBoss[5].ani_no = 0; gBoss[5].ani_no = 0;
bShock = true; bShock = TRUE;
} }
else else
{ {
gBoss[0].act_no = 210; npc->act_no = 210;
gBoss[4].ani_no = 0; gBoss[4].ani_no = 0;
gBoss[5].ani_no = 0; gBoss[5].ani_no = 0;
bShock = true; bShock = TRUE;
} }
} }
break; break;
case 210: case 210:
gBoss[0].act_no = 211; npc->act_no = 211;
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].count2 = gBoss[0].life; npc->count2 = npc->life;
gBoss[11].bits |= 0x20; gBoss[11].bits |= 0x20;
// Fallthrough // Fallthrough
case 211: case 211:
gBoss[0].tgt_x = gMC.x; npc->tgt_x = gMC.x;
gBoss[0].tgt_y = gMC.y; npc->tgt_y = gMC.y;
if (gBoss[0].shock) if (npc->shock)
{ {
if ((++flash >> 1) % 2) if (++flash / 2 % 2)
{ {
gBoss[4].ani_no = 0; gBoss[4].ani_no = 0;
gBoss[5].ani_no = 0; gBoss[5].ani_no = 0;
@ -385,43 +397,43 @@ void ActBossChar_Core(void)
gBoss[5].ani_no = 0; gBoss[5].ani_no = 0;
} }
if (++gBoss[0].act_wait % 100 == 1) if (++npc->act_wait % 100 == 1)
{ {
gCurlyShoot_wait = Random(80, 100); gCurlyShoot_wait = Random(80, 100);
gCurlyShoot_x = gBoss[11].x; gCurlyShoot_x = gBoss[11].x;
gCurlyShoot_y = gBoss[11].y; gCurlyShoot_y = gBoss[11].y;
} }
if (gBoss[0].act_wait < 200 && gBoss[0].act_wait % 20 == 1) if (npc->act_wait < 200 && npc->act_wait % 20 == 1)
SetNpChar(179, gBoss[0].x + (Random(-0x30, -0x10) * 0x200), gBoss[0].y + (Random(-0x40, 0x40) * 0x200), 0, 0, 0, 0, 0x100); SetNpChar(179, npc->x + (Random(-0x30, -0x10) * 0x200), npc->y + (Random(-0x40, 0x40) * 0x200), 0, 0, 0, 0, 0x100);
if (gBoss[0].act_wait > 400 || gBoss[0].life < gBoss[0].count2 - 200) if (npc->act_wait > 400 || npc->life < npc->count2 - 200)
{ {
gBoss[0].act_no = 200; npc->act_no = 200;
gBoss[4].ani_no = 2; gBoss[4].ani_no = 2;
gBoss[5].ani_no = 0; gBoss[5].ani_no = 0;
bShock = true; bShock = TRUE;
} }
break; break;
case 220: case 220:
gBoss[0].act_no = 221; npc->act_no = 221;
gBoss[0].act_wait = 0; npc->act_wait = 0;
gSuperYpos = 1; gSuperYpos = 1;
gBoss[11].bits |= 0x20u; gBoss[11].bits |= 0x20u;
SetQuake(100); SetQuake(100);
SetNoise(1, 1000); SetNoise(1, 1000);
// Fallthrough // Fallthrough
case 221: case 221:
++gBoss[0].act_wait; ++npc->act_wait;
SetNpChar(199, gMC.x + (Random(-50, 150) * 0x400), gMC.y + (Random(-0xA0, 0xA0) * 0x200), 0, 0, 0, 0, 0x100); SetNpChar(199, gMC.x + (Random(-50, 150) * 0x200 * 2), gMC.y + (Random(-0xA0, 0xA0) * 0x200), 0, 0, 0, 0, 0x100);
gMC.xm -= 0x20; gMC.xm -= 0x20;
gMC.cond |= 0x20; gMC.cond |= 0x20;
if (gBoss[0].shock) if (npc->shock)
{ {
if ((++flash >> 1) % 2) if (++flash / 2 % 2)
{ {
gBoss[4].ani_no = 0; gBoss[4].ani_no = 0;
gBoss[5].ani_no = 0; gBoss[5].ani_no = 0;
@ -438,21 +450,21 @@ void ActBossChar_Core(void)
gBoss[5].ani_no = 0; gBoss[5].ani_no = 0;
} }
if (gBoss[0].act_wait == 300 || gBoss[0].act_wait == 350 || gBoss[0].act_wait == 400) if (npc->act_wait == 300 || npc->act_wait == 350 || npc->act_wait == 400)
{ {
const unsigned char deg = GetArktan(gBoss[0].x - gMC.x, gBoss[0].y - gMC.y); deg = GetArktan(npc->x - gMC.x, npc->y - gMC.y);
const int ym = 3 * GetSin(deg); ym = 3 * GetSin(deg);
const int xm = 3 * GetCos(deg); xm = 3 * GetCos(deg);
SetNpChar(218, gBoss[0].x - 0x5000, gBoss[0].y, xm, ym, 0, 0, 0x100); SetNpChar(218, npc->x - 0x5000, npc->y, xm, ym, 0, 0, 0x100);
PlaySoundObject(101, 1); PlaySoundObject(101, 1);
} }
if ( gBoss[0].act_wait > 400 ) if ( npc->act_wait > 400 )
{ {
gBoss[0].act_no = 200; npc->act_no = 200;
gBoss[4].ani_no = 2; gBoss[4].ani_no = 2;
gBoss[5].ani_no = 0; gBoss[5].ani_no = 0;
bShock = true; bShock = TRUE;
} }
break; break;
@ -460,10 +472,10 @@ void ActBossChar_Core(void)
case 500: case 500:
CutNoise(); CutNoise();
gBoss[0].act_no = 501; npc->act_no = 501;
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].xm = 0; npc->xm = 0;
gBoss[0].ym = 0; npc->ym = 0;
gBoss[4].ani_no = 2; gBoss[4].ani_no = 2;
gBoss[5].ani_no = 0; gBoss[5].ani_no = 0;
gBoss[1].act_no = 200; gBoss[1].act_no = 200;
@ -474,36 +486,36 @@ void ActBossChar_Core(void)
SetQuake(20); SetQuake(20);
for (int i = 0; i < 0x20; ++i) for (i = 0; i < 0x20; ++i)
SetNpChar(4, gBoss[0].x + (Random(-0x80, 0x80) * 0x200), gBoss[0].y + (Random(-0x40, 0x40) * 0x200), Random(-0x80, 0x80) * 0x200, Random(-0x80, 0x80) * 0x200, 0, 0, 0x100); SetNpChar(4, npc->x + (Random(-0x80, 0x80) * 0x200), npc->y + (Random(-0x40, 0x40) * 0x200), Random(-0x80, 0x80) * 0x200, Random(-0x80, 0x80) * 0x200, 0, 0, 0x100);
for (int i = 0; i < 12; ++i) for (i = 0; i < 12; ++i)
gBoss[i].bits &= ~0x24; gBoss[i].bits &= ~0x24;
// Fallthrough // Fallthrough
case 501: case 501:
if (++gBoss[0].act_wait % 16) if (++npc->act_wait % 16)
SetNpChar(4, gBoss[0].x + (Random(-0x40, 0x40) * 0x200), gBoss[0].y + (Random(-0x20, 0x20) * 0x200), Random(-0x80, 0x80) * 0x200, Random(-0x80, 0x80) * 0x200, 0, 0, 0x100); SetNpChar(4, npc->x + (Random(-0x40, 0x40) * 0x200), npc->y + (Random(-0x20, 0x20) * 0x200), Random(-0x80, 0x80) * 0x200, Random(-0x80, 0x80) * 0x200, 0, 0, 0x100);
if (gBoss[0].act_wait / 2 % 2) if (npc->act_wait / 2 % 2)
gBoss[0].x -= 0x200; npc->x -= 0x200;
else else
gBoss[0].x += 0x200; npc->x += 0x200;
if (gBoss[0].x < 0x7E000) if (npc->x < 0x7E000)
gBoss[0].x += 0x80; npc->x += 0x80;
else else
gBoss[0].x -= 0x80; npc->x -= 0x80;
if (gBoss[0].y < 0x16000) if (npc->y < 0x16000)
gBoss[0].y += 0x80; npc->y += 0x80;
else else
gBoss[0].y -= 0x80; npc->y -= 0x80;
break; break;
case 600: case 600:
gBoss[0].act_no = 601; npc->act_no = 601;
gBoss[4].act_no = 50; gBoss[4].act_no = 50;
gBoss[5].act_no = 50; gBoss[5].act_no = 50;
gBoss[8].bits &= ~4; gBoss[8].bits &= ~4;
@ -512,10 +524,10 @@ void ActBossChar_Core(void)
gBoss[11].bits &= ~4; gBoss[11].bits &= ~4;
// Fallthrough // Fallthrough
case 601: case 601:
if (++gBoss[0].act_wait / 2 % 2) if (++npc->act_wait / 2 % 2)
gBoss[0].x -= 0x800; npc->x -= 0x800;
else else
gBoss[0].x += 0x800; npc->x += 0x800;
break; break;
} }
@ -532,13 +544,13 @@ void ActBossChar_Core(void)
PlaySoundObject(26, 1); PlaySoundObject(26, 1);
for (int i = 0; i < 8; ++i) for (i = 0; i < 8; ++i)
SetNpChar(4, gBoss[4].x + (Random(-0x20, 0x10) * 0x200), gBoss[4].y, Random(-0x200, 0x200), Random(-0x100, 0x100), 0, 0, 0x100); SetNpChar(4, gBoss[4].x + (Random(-0x20, 0x10) * 0x200), gBoss[4].y, Random(-0x200, 0x200), Random(-0x100, 0x100), 0, 0, 0x100);
} }
if (gBoss[0].act_no >= 200 && gBoss[0].act_no < 300) if (npc->act_no >= 200 && npc->act_no < 300)
{ {
switch (gBoss[0].act_wait) switch (npc->act_wait)
{ {
case 80: case 80:
gBoss[1].act_no = 120; gBoss[1].act_no = 120;
@ -557,29 +569,29 @@ void ActBossChar_Core(void)
break; break;
} }
if (gBoss[0].x < gBoss[0].tgt_x + 0x14000) if (npc->x < npc->tgt_x + 0x14000)
gBoss[0].xm += 4; npc->xm += 4;
if (gBoss[0].x > gBoss[0].tgt_x + 0x14000) if (npc->x > npc->tgt_x + 0x14000)
gBoss[0].xm -= 4; npc->xm -= 4;
if (gBoss[0].y < gBoss[0].tgt_y) if (npc->y < npc->tgt_y)
gBoss[0].ym += 4; npc->ym += 4;
if (gBoss[0].y > gBoss[0].tgt_y) if (npc->y > npc->tgt_y)
gBoss[0].ym -= 4; npc->ym -= 4;
} }
if (gBoss[0].xm > 0x80) if (npc->xm > 0x80)
gBoss[0].xm = 0x80; npc->xm = 0x80;
if (gBoss[0].xm < -0x80) if (npc->xm < -0x80)
gBoss[0].xm = -0x80; npc->xm = -0x80;
if (gBoss[0].ym > 0x80) if (npc->ym > 0x80)
gBoss[0].ym = 0x80; npc->ym = 0x80;
if (gBoss[0].ym < -0x80) if (npc->ym < -0x80)
gBoss[0].ym = -0x80; npc->ym = -0x80;
gBoss[0].x += gBoss[0].xm; npc->x += npc->xm;
gBoss[0].y += gBoss[0].ym; npc->y += npc->ym;
ActBossChar_Core_Face(&gBoss[4]); ActBossChar_Core_Face(&gBoss[4]);

View file

@ -138,10 +138,10 @@ static void ActBossCharA_Face(NPCHAR *npc)
if (++npc->act_wait > 300) if (++npc->act_wait > 300)
npc->act_wait = 0; npc->act_wait = 0;
if (npc->act_wait > 250 && (npc->act_wait & 0xF) == 1) if (npc->act_wait > 250 && (npc->act_wait % 0x10) == 1)
PlaySoundObject(26, 1); PlaySoundObject(26, 1);
if (npc->act_wait > 250 && (npc->act_wait & 0xF) == 7) if (npc->act_wait > 250 && (npc->act_wait % 0x10) == 7)
{ {
SetNpChar(293, npc->x, npc->y, 0, 0, 0, 0, 0x80); SetNpChar(293, npc->x, npc->y, 0, 0, 0, 0, 0x80);
PlaySoundObject(101, 1); PlaySoundObject(101, 1);
@ -172,14 +172,17 @@ static void ActBossCharA_Face(NPCHAR *npc)
static void ActBossCharA_Mini(NPCHAR *npc) static void ActBossCharA_Mini(NPCHAR *npc)
{ {
int deg;
RECT rect[3] = { RECT rect[3] = {
{256, 0, 320, 40}, {256, 0, 320, 40},
{256, 40, 320, 80}, {256, 40, 320, 80},
{256, 80, 320, 120}, {256, 80, 320, 120},
}; };
if (npc->cond) if (npc->cond == 0)
{ return;
npc->life = 1000; npc->life = 1000;
switch (npc->act_no) switch (npc->act_no)
@ -192,28 +195,28 @@ static void ActBossCharA_Mini(NPCHAR *npc)
npc->ani_no = 0; npc->ani_no = 0;
npc->bits &= ~0x20; npc->bits &= ~0x20;
++npc->count2; ++npc->count2;
npc->count2 &= 0xFF; npc->count2 %= 0x100;
break; break;
case 10: case 10:
npc->ani_no = 0; npc->ani_no = 0;
npc->bits &= ~0x20; npc->bits &= ~0x20;
npc->count2 += 2; npc->count2 += 2;
npc->count2 &= 0xFF; npc->count2 %= 0x100;
break; break;
case 20: case 20:
npc->ani_no = 1; npc->ani_no = 1;
npc->bits &= ~0x20; npc->bits &= ~0x20;
npc->count2 += 2; npc->count2 += 2;
npc->count2 &= 0xFF; npc->count2 %= 0x100;
break; break;
case 30: case 30:
npc->ani_no = 0; npc->ani_no = 0;
npc->bits &= ~0x20; npc->bits &= ~0x20;
npc->count2 += 4; npc->count2 += 4;
npc->count2 &= 0xFF; npc->count2 %= 0x100;
break; break;
case 200: case 200:
@ -227,7 +230,7 @@ static void ActBossCharA_Mini(NPCHAR *npc)
npc->x += npc->xm; npc->x += npc->xm;
if (npc->x > (gMap.width + 2) * 0x2000) if (npc->x > (gMap.width * 0x200 * 0x10) + (2 * 0x200 * 0x10))
npc->cond = 0; npc->cond = 0;
break; break;
@ -235,19 +238,16 @@ static void ActBossCharA_Mini(NPCHAR *npc)
if (npc->act_no < 50) if (npc->act_no < 50)
{ {
int deg;
if (npc->count1) if (npc->count1)
deg = npc->count2 + 0x80; deg = npc->count2 + 0x80;
else else
deg = npc->count2 + 0x180; deg = npc->count2 + 0x180;
npc->x = npc->pNpc->x + 0x30 * GetCos(deg / 2) - 0x1000; npc->x = npc->pNpc->x - 0x1000 + 0x30 * GetCos(deg / 2);
npc->y = npc->pNpc->y + 0x50 * GetSin(deg / 2); npc->y = npc->pNpc->y + 0x50 * GetSin(deg / 2);
} }
npc->rect = rect[npc->ani_no]; npc->rect = rect[npc->ani_no];
}
} }
static void ActBossCharA_Hit(NPCHAR *npc) static void ActBossCharA_Hit(NPCHAR *npc)
@ -278,26 +278,32 @@ static void ActBossCharA_Hit(NPCHAR *npc)
void ActBossChar_Undead(void) void ActBossChar_Undead(void)
{ {
int i;
int x;
int y;
static int life; static int life;
static unsigned char flash; static unsigned char flash;
NPCHAR *npc = gBoss;
BOOL bShock = FALSE; BOOL bShock = FALSE;
switch (gBoss[0].act_no) switch (npc->act_no)
{ {
case 1: case 1:
gBoss[0].act_no = 10; npc->act_no = 10;
gBoss[0].exp = 1; npc->exp = 1;
gBoss[0].cond = 0x80; npc->cond = 0x80;
gBoss[0].bits = 0x800C; npc->bits = 0x800C;
gBoss[0].life = 700; npc->life = 700;
gBoss[0].hit_voice = 114; npc->hit_voice = 114;
gBoss[0].x = 0x4A000; npc->x = 0x4A000;
gBoss[0].y = 0xF000; npc->y = 0xF000;
gBoss[0].xm = 0; npc->xm = 0;
gBoss[0].ym = 0; npc->ym = 0;
gBoss[0].code_event = 1000; npc->code_event = 1000;
gBoss[0].bits |= 0x200; npc->bits |= 0x200;
gBoss[3].cond = 0x80; gBoss[3].cond = 0x80;
gBoss[3].act_no = 0; gBoss[3].act_no = 0;
@ -346,7 +352,7 @@ void ActBossChar_Undead(void)
gBoss[1].hit.bottom = 0x2000; gBoss[1].hit.bottom = 0x2000;
gBoss[1].view.front = 0x4000; gBoss[1].view.front = 0x4000;
gBoss[1].view.top = 0x2800; gBoss[1].view.top = 0x2800;
gBoss[1].pNpc = gBoss; gBoss[1].pNpc = npc;
gBoss[2] = gBoss[1]; gBoss[2] = gBoss[1];
gBoss[2].count2 = 0x80; gBoss[2].count2 = 0x80;
@ -358,22 +364,22 @@ void ActBossChar_Undead(void)
gBoss[7].count1 = 1; gBoss[7].count1 = 1;
gBoss[7].count2 = 0x80; gBoss[7].count2 = 0x80;
life = gBoss[0].life; life = npc->life;
break; break;
case 15: case 15:
gBoss[0].act_no = 16; npc->act_no = 16;
bShock = TRUE; bShock = TRUE;
gBoss[0].direct = 0; npc->direct = 0;
gBoss[3].act_no = 10; gBoss[3].act_no = 10;
gBoss[4].ani_no = 0; gBoss[4].ani_no = 0;
break; break;
case 20: case 20:
gBoss[0].act_no = 210; npc->act_no = 210;
bShock = TRUE; bShock = TRUE;
gBoss[0].direct = 0; npc->direct = 0;
gBoss[1].act_no = 5; gBoss[1].act_no = 5;
gBoss[2].act_no = 5; gBoss[2].act_no = 5;
gBoss[6].act_no = 5; gBoss[6].act_no = 5;
@ -381,8 +387,8 @@ void ActBossChar_Undead(void)
break; break;
case 200: case 200:
gBoss[0].act_no = 201; npc->act_no = 201;
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[3].act_no = 0; gBoss[3].act_no = 0;
gBoss[4].ani_no = 2; gBoss[4].ani_no = 2;
gBoss[5].ani_no = 0; gBoss[5].ani_no = 0;
@ -395,43 +401,43 @@ void ActBossChar_Undead(void)
bShock = TRUE; bShock = TRUE;
// Fallthrough // Fallthrough
case 201: case 201:
++gBoss[0].act_wait; ++npc->act_wait;
if ((gBoss[0].direct == 2 || gBoss[0].ani_no > 0 || gBoss[0].life < 200) && gBoss[0].act_wait > 200) if ((npc->direct == 2 || npc->ani_no > 0 || npc->life < 200) && npc->act_wait > 200)
{ {
++gBoss[0].count1; ++npc->count1;
PlaySoundObject(115, 1); PlaySoundObject(115, 1);
if (gBoss[0].life < 200) if (npc->life < 200)
{ {
gBoss[0].act_no = 230; npc->act_no = 230;
} }
else else
{ {
if ( gBoss[0].count1 <= 2 ) if (npc->count1 > 2)
gBoss[0].act_no = 210; npc->act_no = 220;
else else
gBoss[0].act_no = 220; npc->act_no = 210;
} }
} }
break; break;
case 210: case 210:
gBoss[0].act_no = 211; npc->act_no = 211;
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[3].act_no = 10; gBoss[3].act_no = 10;
gBoss[8].bits |= 4; gBoss[8].bits |= 4;
gBoss[9].bits |= 4; gBoss[9].bits |= 4;
gBoss[10].bits |= 4; gBoss[10].bits |= 4;
gBoss[11].bits |= 0x20; gBoss[11].bits |= 0x20;
life = gBoss[0].life; life = npc->life;
bShock = TRUE; bShock = TRUE;
// Fallthrough // Fallthrough
case 211: case 211:
++flash; ++flash;
if (gBoss[0].shock && (flash >> 1) & 1) if (npc->shock && flash / 2 % 2)
{ {
gBoss[4].ani_no = 1; gBoss[4].ani_no = 1;
gBoss[5].ani_no = 1; gBoss[5].ani_no = 1;
@ -442,31 +448,31 @@ void ActBossChar_Undead(void)
gBoss[5].ani_no = 0; gBoss[5].ani_no = 0;
} }
if (++gBoss[0].act_wait % 100 == 1) if (++npc->act_wait % 100 == 1)
{ {
gCurlyShoot_wait = Random(80, 100); gCurlyShoot_wait = Random(80, 100);
gCurlyShoot_x = gBoss[11].x; gCurlyShoot_x = gBoss[11].x;
gCurlyShoot_y = gBoss[11].y; gCurlyShoot_y = gBoss[11].y;
} }
if (gBoss[0].act_wait < 300) if (npc->act_wait < 300)
{ {
if (gBoss[0].act_wait % 120 == 1) if (npc->act_wait % 120 == 1)
SetNpChar(288, gBoss[0].x - 0x4000, gBoss[0].y - 0x2000, 0, 0, 1, 0, 0x20); SetNpChar(288, npc->x - 0x4000, npc->y - 0x2000, 0, 0, 1, 0, 0x20);
if (gBoss[0].act_wait % 120 == 61) if (npc->act_wait % 120 == 61)
SetNpChar(288, gBoss[0].x - 0x4000, gBoss[0].y + 0x2000, 0, 0, 3, 0, 0x20); SetNpChar(288, npc->x - 0x4000, npc->y + 0x2000, 0, 0, 3, 0, 0x20);
} }
if (gBoss[0].life < life - 50 || gBoss[0].act_wait > 400) if (npc->life < life - 50 || npc->act_wait > 400)
gBoss[0].act_no = 200; npc->act_no = 200;
break; break;
case 220: case 220:
gBoss[0].act_no = 221; npc->act_no = 221;
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].count1 = 0; npc->count1 = 0;
gSuperYpos = 1; gSuperYpos = 1;
gBoss[3].act_no = 20; gBoss[3].act_no = 20;
gBoss[8].bits |= 4; gBoss[8].bits |= 4;
@ -474,15 +480,12 @@ void ActBossChar_Undead(void)
gBoss[10].bits |= 4; gBoss[10].bits |= 4;
gBoss[11].bits |= 0x20; gBoss[11].bits |= 0x20;
SetQuake(100); SetQuake(100);
life = gBoss[0].life; life = npc->life;
bShock = TRUE; bShock = TRUE;
// Fallthrough // Fallthrough
case 221: case 221:
if (++gBoss[0].act_wait % 40 == 1) if (++npc->act_wait % 40 == 1)
{ {
int x;
int y;
switch (Random(0, 3)) switch (Random(0, 3))
{ {
case 0: case 0:
@ -510,7 +513,7 @@ void ActBossChar_Undead(void)
++flash; ++flash;
if (gBoss[0].shock && (flash >> 1) & 1) if (npc->shock && flash / 2 % 2)
{ {
gBoss[4].ani_no = 1; gBoss[4].ani_no = 1;
gBoss[5].ani_no = 1; gBoss[5].ani_no = 1;
@ -521,14 +524,14 @@ void ActBossChar_Undead(void)
gBoss[5].ani_no = 0; gBoss[5].ani_no = 0;
} }
if (gBoss[0].life < life - 150 || gBoss[0].act_wait > 400 || gBoss[0].life < 200) if (npc->life < life - 150 || npc->act_wait > 400 || npc->life < 200)
gBoss[0].act_no = 200; npc->act_no = 200;
break; break;
case 230: case 230:
gBoss[0].act_no = 231; npc->act_no = 231;
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[3].act_no = 30; gBoss[3].act_no = 30;
gBoss[8].bits |= 4; gBoss[8].bits |= 4;
gBoss[9].bits |= 4; gBoss[9].bits |= 4;
@ -541,13 +544,13 @@ void ActBossChar_Undead(void)
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, 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, 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, 0x400, 0, 0x100);
life = gBoss[0].life; life = npc->life;
bShock = TRUE; bShock = TRUE;
// Fallthrough // Fallthrough
case 231: case 231:
++flash; ++flash;
if (gBoss[0].shock && (flash >> 1) & 1) if (npc->shock && flash / 2 % 2)
{ {
gBoss[4].ani_no = 1; gBoss[4].ani_no = 1;
gBoss[5].ani_no = 1; gBoss[5].ani_no = 1;
@ -558,27 +561,27 @@ void ActBossChar_Undead(void)
gBoss[5].ani_no = 0; gBoss[5].ani_no = 0;
} }
if (++gBoss[0].act_wait % 100 == 1) if (++npc->act_wait % 100 == 1)
{ {
gCurlyShoot_wait = Random(80, 100); gCurlyShoot_wait = Random(80, 100);
gCurlyShoot_x = gBoss[11].x; gCurlyShoot_x = gBoss[11].x;
gCurlyShoot_y = gBoss[11].y; gCurlyShoot_y = gBoss[11].y;
} }
if (gBoss[0].act_wait % 120 == 1) if (npc->act_wait % 120 == 1)
SetNpChar(288, gBoss[0].x - 0x4000, gBoss[0].y - 0x2000, 0, 0, 1, 0, 0x20); SetNpChar(288, npc->x - 0x4000, npc->y - 0x2000, 0, 0, 1, 0, 0x20);
if (gBoss[0].act_wait % 120 == 61) if (npc->act_wait % 120 == 61)
SetNpChar(288, gBoss[0].x - 0x4000, gBoss[0].y + 0x2000, 0, 0, 3, 0, 0x20); SetNpChar(288, npc->x - 0x4000, npc->y + 0x2000, 0, 0, 3, 0, 0x20);
break; break;
case 500: case 500:
CutNoise(); CutNoise();
gBoss[0].act_no = 501; npc->act_no = 501;
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].xm = 0; npc->xm = 0;
gBoss[0].ym = 0; npc->ym = 0;
gBoss[3].act_no = 0; gBoss[3].act_no = 0;
gBoss[4].ani_no = 2; gBoss[4].ani_no = 2;
gBoss[5].ani_no = 0; gBoss[5].ani_no = 0;
@ -588,26 +591,28 @@ void ActBossChar_Undead(void)
gBoss[7].act_no = 5; gBoss[7].act_no = 5;
SetQuake(20); SetQuake(20);
for (int i = 0; i < 100; ++i) for (i = 0; i < 100; ++i)
SetNpChar(4, gBoss[0].x + (Random(-0x80, 0x80) * 0x200), gBoss[0].y + (Random(-0x40, 0x40) * 0x200), Random(-0x80, 0x80) * 0x200, Random(-0x80, 0x80) * 0x200, 0, 0, 0); SetNpChar(4, npc->x + (Random(-0x80, 0x80) * 0x200), npc->y + (Random(-0x40, 0x40) * 0x200), Random(-0x80, 0x80) * 0x200, Random(-0x80, 0x80) * 0x200, 0, 0, 0);
DeleteNpCharCode(282, 1); DeleteNpCharCode(282, 1);
gBoss[11].bits &= ~0x20; gBoss[11].bits &= ~0x20;
for (int i = 0; i < 12; ++i) for (i = 0; i < 12; ++i)
gBoss[i].bits &= ~4; gBoss[i].bits &= ~4;
// Fallthrough // Fallthrough
case 501: case 501:
if (++gBoss[0].act_wait & 0xF) ++npc->act_wait;
SetNpChar(4, gBoss[0].x + (Random(-0x40, 0x40) * 0x200), gBoss[0].y + (Random(-0x20, 0x20) * 0x200), Random(-0x80, 0x80) * 0x200, Random(-0x80, 0x80) * 0x200, 0, 0, 0x100);
gBoss[0].x += 0x40; if (npc->act_wait % 0x10)
gBoss[0].y += 0x80; SetNpChar(4, npc->x + (Random(-0x40, 0x40) * 0x200), npc->y + (Random(-0x20, 0x20) * 0x200), Random(-0x80, 0x80) * 0x200, Random(-0x80, 0x80) * 0x200, 0, 0, 0x100);
if (gBoss[0].act_wait > 200) npc->x += 0x40;
npc->y += 0x80;
if (npc->act_wait > 200)
{ {
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].act_no = 1000; npc->act_no = 1000;
} }
break; break;
@ -615,7 +620,9 @@ void ActBossChar_Undead(void)
case 1000: case 1000:
SetQuake(100); SetQuake(100);
if (++gBoss[0].act_wait % 8 == 0) ++gBoss[0].act_wait;
if (gBoss[0].act_wait % 8 == 0)
PlaySoundObject(44, 1); PlaySoundObject(44, 1);
SetDestroyNpChar(gBoss[0].x + (Random(-0x48, 0x48) * 0x200), gBoss[0].y + (Random(-0x40, 0x40) * 0x200), 1, 1); SetDestroyNpChar(gBoss[0].x + (Random(-0x48, 0x48) * 0x200), gBoss[0].y + (Random(-0x40, 0x40) * 0x200), 1, 1);
@ -633,9 +640,11 @@ void ActBossChar_Undead(void)
case 1001: case 1001:
SetQuake(40); SetQuake(40);
if (++gBoss[0].act_wait > 50) ++gBoss[0].act_wait;
if (gBoss[0].act_wait > 50)
{ {
for (int i = 0; i < 20; ++i) for (i = 0; i < 20; ++i)
gBoss[i].cond = 0; gBoss[i].cond = 0;
DeleteNpCharCode(158, 1); DeleteNpCharCode(158, 1);
@ -649,80 +658,65 @@ void ActBossChar_Undead(void)
{ {
SetQuake(20); SetQuake(20);
if (gBoss[0].act_no == 201) if (npc->act_no == 201)
{ gBoss[1].act_no = gBoss[2].act_no = gBoss[6].act_no = gBoss[7].act_no = 10;
gBoss[7].act_no = 10;
gBoss[6].act_no = 10;
gBoss[2].act_no = 10;
gBoss[1].act_no = 10;
}
if (gBoss[0].act_no == 221) if (npc->act_no == 221)
{ gBoss[1].act_no = gBoss[2].act_no = gBoss[6].act_no = gBoss[7].act_no = 20;
gBoss[7].act_no = 20;
gBoss[6].act_no = 20;
gBoss[2].act_no = 20;
gBoss[1].act_no = 20;
}
if (gBoss[0].act_no == 231) if (npc->act_no == 231)
{ gBoss[1].act_no = gBoss[2].act_no = gBoss[6].act_no = gBoss[7].act_no = 30;
gBoss[7].act_no = 30;
gBoss[6].act_no = 30;
gBoss[2].act_no = 30;
gBoss[1].act_no = 30;
}
PlaySoundObject(26, 1); PlaySoundObject(26, 1);
for (int i = 0; i < 8; ++i) for (i = 0; i < 8; ++i)
SetNpChar(4, gBoss[4].x + (Random(-0x20, 0x10) * 0x200), gBoss[4].y, Random(-0x200, 0x200), Random(-0x100, 0x100), 0, 0, 0x100); SetNpChar(4, gBoss[4].x + (Random(-0x20, 0x10) * 0x200), gBoss[4].y, Random(-0x200, 0x200), Random(-0x100, 0x100), 0, 0, 0x100);
} }
if (gBoss[0].act_no >= 200 && gBoss[0].act_no < 300) if (npc->act_no >= 200 && npc->act_no < 300)
{ {
if (gBoss[0].x < 0x18000) if (npc->x < 0x18000)
gBoss[0].direct = 2; npc->direct = 2;
if (gBoss[0].x > (gMap.width - 4) * 0x2000) if (npc->x > (gMap.width - 4) * 0x2000)
gBoss[0].direct = 0; npc->direct = 0;
if (gBoss[0].direct == 0) if (npc->direct == 0)
gBoss[0].xm -= 4; npc->xm -= 4;
else else
gBoss[0].xm += 4; npc->xm += 4;
} }
switch (gBoss[0].act_no) switch (npc->act_no)
{ {
case 201: case 201:
case 211: case 211:
case 221: case 221:
case 231: case 231:
if (++gBoss[0].count2 == 150) if (++npc->count2 == 150)
{ {
gBoss[0].count2 = 0; npc->count2 = 0;
SetNpChar(282, (gMap.width * 0x2000) + 0x40, (Random(-1, 3) + 10) * 0x2000, 0, 0, 0, 0, 0x30); SetNpChar(282, (gMap.width * 0x200 * 0x10) + 0x40, (Random(-1, 3) + 10) * 0x2000, 0, 0, 0, 0, 0x30);
} }
else if (gBoss[0].count2 == 75) else if (npc->count2 == 75)
{ {
SetNpChar(282, (gMap.width * 0x2000) + 0x40, (Random(-3, 0) + 3) * 0x2000, 0, 0, 0, 0, 0x30); SetNpChar(282, (gMap.width * 0x200 * 0x10) + 0x40, (Random(-3, 0) + 3) * 0x2000, 0, 0, 0, 0, 0x30);
} }
break; break;
} }
if (gBoss[0].xm > 0x80) if (npc->xm > 0x80)
gBoss[0].xm = 0x80; npc->xm = 0x80;
if (gBoss[0].xm < -0x80) if (npc->xm < -0x80)
gBoss[0].xm = -0x80; npc->xm = -0x80;
if (gBoss[0].ym > 0x80) if (npc->ym > 0x80)
gBoss[0].ym = 0x80; npc->ym = 0x80;
if (gBoss[0].ym < -0x80) if (npc->ym < -0x80)
gBoss[0].ym = -0x80; npc->ym = -0x80;
gBoss[0].x += gBoss[0].xm; npc->x += npc->xm;
gBoss[0].y += gBoss[0].ym; npc->y += npc->ym;
ActBossCharA_Face(&gBoss[3]); ActBossCharA_Face(&gBoss[3]);
ActBossCharA_Head(&gBoss[4]); ActBossCharA_Head(&gBoss[4]);

View file

@ -64,7 +64,7 @@ static void ActBossChar_Eye(NPCHAR *npc)
--npc->ani_no; --npc->ani_no;
} }
if ( npc->ani_no <= 0 ) if (npc->ani_no <= 0)
npc->act_no = 202; npc->act_no = 202;
break; break;
@ -90,10 +90,10 @@ static void ActBossChar_Eye(NPCHAR *npc)
if (npc->act_no >= 0 && npc->act_no < 300) if (npc->act_no >= 0 && npc->act_no < 300)
{ {
if (npc->ani_no == 3) if (npc->ani_no != 3)
npc->bits |= 0x20;
else
npc->bits &= ~0x20; npc->bits &= ~0x20;
else
npc->bits |= 0x20;
} }
if (npc->direct == 0) if (npc->direct == 0)
@ -133,25 +133,31 @@ void ActBossChar_Ballos(void)
{ {
static unsigned char flash; static unsigned char flash;
switch (gBoss[0].act_no) int i;
int x;
int y;
NPCHAR *npc = gBoss;
switch (npc->act_no)
{ {
case 0: case 0:
gBoss[0].act_no = 1; npc->act_no = 1;
gBoss[0].cond = 0x80; npc->cond = 0x80;
gBoss[0].exp = 1; npc->exp = 1;
gBoss[0].direct = 0; npc->direct = 0;
gBoss[0].x = 0x28000; npc->x = 0x28000;
gBoss[0].y = -0x8000; npc->y = -0x8000;
gBoss[0].hit_voice = 54; npc->hit_voice = 54;
gBoss[0].hit.front = 0x4000; npc->hit.front = 0x4000;
gBoss[0].hit.top = 0x6000; npc->hit.top = 0x6000;
gBoss[0].hit.back = 0x4000; npc->hit.back = 0x4000;
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 = 0; npc->damage = 0;
gBoss[0].code_event = 1000; npc->code_event = 1000;
gBoss[0].life = 800; npc->life = 800;
gBoss[1].cond = 0x90; gBoss[1].cond = 0x90;
gBoss[1].direct = 0; gBoss[1].direct = 0;
@ -196,39 +202,42 @@ void ActBossChar_Ballos(void)
break; break;
case 100: case 100:
gBoss[0].act_no = 101; npc->act_no = 101;
gBoss[0].ani_no = 0; npc->ani_no = 0;
gBoss[0].x = gMC.x; npc->x = gMC.x;
SetNpChar(333, gMC.x, 0x26000, 0, 0, 2, 0, 0x100); SetNpChar(333, gMC.x, 0x26000, 0, 0, 2, 0, 0x100);
gBoss[0].act_wait = 0; npc->act_wait = 0;
// Fallthrough // Fallthrough
case 101: case 101:
if (++gBoss[0].act_wait > 30) if (++npc->act_wait > 30)
gBoss[0].act_no = 102; npc->act_no = 102;
break; break;
case 102: case 102:
gBoss[0].ym += 0x40; npc->ym += 0x40;
if (gBoss[0].ym > 0xC00) if (npc->ym > 0xC00)
gBoss[0].ym = 0xC00; npc->ym = 0xC00;
gBoss[0].y += gBoss[0].ym; npc->y += npc->ym;
if (gBoss[0].y > 0x26000 - gBoss[0].hit.bottom) if (npc->y > 0x26000 - npc->hit.bottom)
{ {
gBoss[0].y = 0x26000 - gBoss[0].hit.bottom; npc->y = 0x26000 - npc->hit.bottom;
gBoss[0].ym = 0; npc->ym = 0;
gBoss[0].act_no = 103; npc->act_no = 103;
gBoss[0].act_wait = 0; npc->act_wait = 0;
SetQuake2(30); SetQuake2(30);
PlaySoundObject(44, 1); PlaySoundObject(44, 1);
if ( gMC.y > gBoss[0].y + 0x6000 && gMC.x < gBoss[0].x + 0x3000 && gMC.x > gBoss[0].x - 0x3000 ) if ( gMC.y > npc->y + 0x6000 && gMC.x < npc->x + 0x3000 && gMC.x > npc->x - 0x3000 )
DamageMyChar(16); DamageMyChar(16);
for (int i = 0; i < 0x10; ++i) for (i = 0; i < 0x10; ++i)
SetNpChar(4, gBoss[0].x + (Random(-40, 40) * 0x200), gBoss[0].y + 0x5000, 0, 0, 0, 0, 0x100); {
x = npc->x + (Random(-40, 40) * 0x200);
SetNpChar(4, x, npc->y + 0x5000, 0, 0, 0, 0, 0x100);
}
if (gMC.flag & 8) if (gMC.flag & 8)
gMC.ym = -0x200; gMC.ym = -0x200;
@ -237,9 +246,9 @@ void ActBossChar_Ballos(void)
break; break;
case 103: case 103:
if (++gBoss[0].act_wait == 50) if (++npc->act_wait == 50)
{ {
gBoss[0].act_no = 104; npc->act_no = 104;
gBoss[1].act_no = 100; gBoss[1].act_no = 100;
gBoss[2].act_no = 100; gBoss[2].act_no = 100;
} }
@ -247,56 +256,56 @@ void ActBossChar_Ballos(void)
break; break;
case 200: case 200:
gBoss[0].act_no = 201; npc->act_no = 201;
gBoss[0].count1 = 0; npc->count1 = 0;
// Fallthrough // Fallthrough
case 201: case 201:
gBoss[0].act_no = 203; npc->act_no = 203;
gBoss[0].xm = 0; npc->xm = 0;
++gBoss[0].count1; ++npc->count1;
gBoss[0].hit.bottom = 0x6000; npc->hit.bottom = 0x6000;
gBoss[0].damage = 0; npc->damage = 0;
if (gBoss[0].count1 % 3) if (npc->count1 % 3 == 0)
gBoss[0].act_wait = 50; npc->act_wait = 150;
else else
gBoss[0].act_wait = 150; npc->act_wait = 50;
// Fallthrough // Fallthrough
case 203: case 203:
if (--gBoss[0].act_wait <= 0) if (--npc->act_wait <= 0)
{ {
gBoss[0].act_no = 204; npc->act_no = 204;
gBoss[0].ym = -0xC00; npc->ym = -0xC00;
if (gMC.x > gBoss[0].x) if (npc->x < gMC.x)
gBoss[0].xm = 0x200; npc->xm = 0x200;
else else
gBoss[0].xm = -0x200; npc->xm = -0x200;
} }
break; break;
case 204: case 204:
if (gBoss[0].x < 0xA000) if (npc->x < 0xA000)
gBoss[0].xm = 0x200; npc->xm = 0x200;
if (gBoss[0].x > 0x44000) if (npc->x > 0x44000)
gBoss[0].xm = -0x200; npc->xm = -0x200;
gBoss[0].ym += 0x55; npc->ym += 0x55;
if (gBoss[0].ym > 0xC00) if (npc->ym > 0xC00)
gBoss[0].ym = 0xC00; npc->ym = 0xC00;
gBoss[0].x += gBoss[0].xm; npc->x += npc->xm;
gBoss[0].y += gBoss[0].ym; npc->y += npc->ym;
if (gBoss[0].y > 0x26000 - gBoss[0].hit.bottom) if (npc->y > 0x26000 - npc->hit.bottom)
{ {
gBoss[0].y = 0x26000 - gBoss[0].hit.bottom; npc->y = 0x26000 - npc->hit.bottom;
gBoss[0].ym = 0; npc->ym = 0;
gBoss[0].act_no = 201; npc->act_no = 201;
gBoss[0].act_wait = 0; npc->act_wait = 0;
if (gMC.y > gBoss[0].y + 0x7000) if (gMC.y > npc->y + 0x7000)
DamageMyChar(16); DamageMyChar(16);
if (gMC.flag & 8) if (gMC.flag & 8)
@ -304,44 +313,50 @@ void ActBossChar_Ballos(void)
SetQuake2(30); SetQuake2(30);
PlaySoundObject(26, 1); PlaySoundObject(26, 1);
SetNpChar(332, gBoss[0].x - 0x1800, gBoss[0].y + 0x6800, 0, 0, 0, 0, 0x100); SetNpChar(332, npc->x - 0x1800, npc->y + 0x6800, 0, 0, 0, 0, 0x100);
SetNpChar(332, gBoss[0].x + 0x1800, gBoss[0].y + 0x6800, 0, 0, 2, 0, 0x100); SetNpChar(332, npc->x + 0x1800, npc->y + 0x6800, 0, 0, 2, 0, 0x100);
PlaySoundObject(44, 1); PlaySoundObject(44, 1);
for (int i = 0; i < 0x10; ++i) for (i = 0; i < 0x10; ++i)
SetNpChar(4, gBoss[0].x + (Random(-40, 40) * 0x200), gBoss[0].y + 0x5000, 0, 0, 0, 0, 0x100); {
x = npc->x + (Random(-40, 40) * 0x200);
SetNpChar(4, x, npc->y + 0x5000, 0, 0, 0, 0, 0x100);
}
} }
break; break;
case 220: case 220:
gBoss[0].act_no = 221; npc->act_no = 221;
gBoss[0].life = 1200; npc->life = 1200;
gBoss[1].act_no = 200; gBoss[1].act_no = 200;
gBoss[2].act_no = 200; gBoss[2].act_no = 200;
gBoss[0].xm = 0; npc->xm = 0;
gBoss[0].ani_no = 0; npc->ani_no = 0;
gBoss[0].shock = 0; npc->shock = 0;
flash = 0; flash = 0;
// Fallthrough // Fallthrough
case 221: case 221:
gBoss[0].ym += 0x40; npc->ym += 0x40;
if (gBoss[0].ym > 0xC00) if (npc->ym > 0xC00)
gBoss[0].ym = 0xC00; npc->ym = 0xC00;
gBoss[0].y += gBoss[0].ym; npc->y += npc->ym;
if (gBoss[0].y > 0x26000 - gBoss[0].hit.bottom) if (npc->y > 0x26000 - npc->hit.bottom)
{ {
gBoss[0].y = 0x26000 - gBoss[0].hit.bottom; npc->y = 0x26000 - npc->hit.bottom;
gBoss[0].ym = 0; npc->ym = 0;
gBoss[0].act_no = 222; npc->act_no = 222;
gBoss[0].act_wait = 0; npc->act_wait = 0;
SetQuake2(30); SetQuake2(30);
PlaySoundObject(26, 1); PlaySoundObject(26, 1);
for (int i = 0; i < 0x10; ++i) for (i = 0; i < 0x10; ++i)
SetNpChar(4, gBoss[0].x + (Random(-40, 40) * 0x200), gBoss[0].y + 0x5000, 0, 0, 0, 0, 0x100); {
x = npc->x + (Random(-40, 40) * 0x200);
SetNpChar(4, x, npc->y + 0x5000, 0, 0, 0, 0, 0x100);
}
if (gMC.flag & 8) if (gMC.flag & 8)
gMC.ym = -0x200; gMC.ym = -0x200;
@ -350,234 +365,248 @@ void ActBossChar_Ballos(void)
break; break;
case 300: case 300:
gBoss[0].act_no = 301; npc->act_no = 301;
gBoss[0].act_wait = 0; npc->act_wait = 0;
for (int i = 0; i < 0x100; i += 0x40) for (i = 0; i < 0x100; i += 0x40)
{ {
SetNpChar(342, gBoss[0].x, gBoss[0].y, 0, 0, i, gBoss, 0x5A); SetNpChar(342, npc->x, npc->y, 0, 0, i, npc, 0x5A);
SetNpChar(342, gBoss[0].x, gBoss[0].y, 0, 0, i + 544, gBoss, 0x5A); SetNpChar(342, npc->x, npc->y, 0, 0, i + 544, npc, 0x5A);
} }
SetNpChar(343, gBoss[0].x, gBoss[0].y, 0, 0, 0, gBoss, 0x18); SetNpChar(343, npc->x, npc->y, 0, 0, 0, npc, 0x18);
SetNpChar(344, gBoss[0].x - 0x3000, gBoss[0].y - 0x4800, 0, 0, 0, gBoss, 0x20); SetNpChar(344, npc->x - 0x3000, npc->y - 0x4800, 0, 0, 0, npc, 0x20);
SetNpChar(344, gBoss[0].x + 0x3000, gBoss[0].y - 0x4800, 0, 0, 2, gBoss, 0x20); SetNpChar(344, npc->x + 0x3000, npc->y - 0x4800, 0, 0, 2, npc, 0x20);
// Fallthrough // Fallthrough
case 301: case 301:
gBoss[0].y += (0x1C200 - gBoss[0].y) / 8; npc->y += (0x1C200 - npc->y) / 8;
if (++gBoss[0].act_wait > 50) if (++npc->act_wait > 50)
{ {
gBoss[0].act_no = 310; npc->act_no = 310;
gBoss[0].act_wait = 0; npc->act_wait = 0;
} }
break; break;
case 311: case 311:
gBoss[0].direct = 0; npc->direct = 0;
gBoss[0].xm = -0x3AA; npc->xm = -0x3AA;
gBoss[0].ym = 0; npc->ym = 0;
gBoss[0].x += gBoss[0].xm; npc->x += npc->xm;
if (gBoss[0].x < 0xDE00) if (npc->x < 0xDE00)
{ {
gBoss[0].x = 0xDE00; npc->x = 0xDE00;
gBoss[0].act_no = 312; npc->act_no = 312;
} }
break; break;
case 312: case 312:
gBoss[0].direct = 1; npc->direct = 1;
gBoss[0].ym = -0x3AA; npc->ym = -0x3AA;
gBoss[0].xm = 0; npc->xm = 0;
gBoss[0].y += gBoss[0].ym; npc->y += npc->ym;
if (gBoss[0].y < 0xDE00) if (npc->y < 0xDE00)
{ {
gBoss[0].y = 0xDE00; npc->y = 0xDE00;
gBoss[0].act_no = 313; npc->act_no = 313;
} }
break; break;
case 313: case 313:
gBoss[0].direct = 2; npc->direct = 2;
gBoss[0].xm = 0x3AA; npc->xm = 0x3AA;
gBoss[0].ym = 0; npc->ym = 0;
gBoss[0].x += gBoss[0].xm; npc->x += npc->xm;
if (gBoss[0].x > 0x40200) if (npc->x > 0x40200)
{ {
gBoss[0].x = 0x40200; npc->x = 0x40200;
gBoss[0].act_no = 314; npc->act_no = 314;
} }
if (gBoss[0].count1) if (npc->count1)
--gBoss[0].count1; --npc->count1;
if (gBoss[0].count1 == 0 && gBoss[0].x > 0x26000 && gBoss[0].x < 0x2A000) if (npc->count1 == 0 && npc->x > 0x26000 && npc->x < 0x2A000)
gBoss[0].act_no = 400; npc->act_no = 400;
break; break;
case 314: case 314:
gBoss[0].direct = 3; npc->direct = 3;
gBoss[0].ym = 0x3AA; npc->ym = 0x3AA;
gBoss[0].xm = 0; npc->xm = 0;
gBoss[0].y += gBoss[0].ym; npc->y += npc->ym;
if (gBoss[0].y > 0x1C200) if (npc->y > 0x1C200)
{ {
gBoss[0].y = 0x1C200; npc->y = 0x1C200;
gBoss[0].act_no = 311; npc->act_no = 311;
} }
break; break;
case 400: case 400:
gBoss[0].act_no = 401; npc->act_no = 401;
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].xm = 0; npc->xm = 0;
gBoss[0].ym = 0; npc->ym = 0;
DeleteNpCharCode(339, 0); DeleteNpCharCode(339, 0);
// Fallthrough // Fallthrough
case 401: case 401:
gBoss[0].y += (0x13E00 - gBoss[0].y) / 8; npc->y += (0x13E00 - npc->y) / 8;
if (++gBoss[0].act_wait > 50) if (++npc->act_wait > 50)
{ {
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].act_no = 410; npc->act_no = 410;
for (int i = 0; i < 0x100; i += 0x20) for (i = 0; i < 0x100; i += 0x20)
SetNpChar(346, gBoss[0].x, gBoss[0].y, 0, 0, i, gBoss, 0x50); SetNpChar(346, npc->x, npc->y, 0, 0, i, npc, 0x50);
SetNpChar(343, gBoss[0].x, gBoss[0].y, 0, 0, 0, gBoss, 0x18); SetNpChar(343, npc->x, npc->y, 0, 0, 0, npc, 0x18);
SetNpChar(344, gBoss[0].x - 0x3000, gBoss[0].y - 0x4800, 0, 0, 0, gBoss, 0x20); SetNpChar(344, npc->x - 0x3000, npc->y - 0x4800, 0, 0, 0, npc, 0x20);
SetNpChar(344, gBoss[0].x + 0x3000, gBoss[0].y - 0x4800, 0, 0, 2, gBoss, 0x20); SetNpChar(344, npc->x + 0x3000, npc->y - 0x4800, 0, 0, 2, npc, 0x20);
} }
break; break;
case 410: case 410:
if (++gBoss[0].act_wait > 50) if (++npc->act_wait > 50)
{ {
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].act_no = 411; npc->act_no = 411;
} }
break; break;
case 411: case 411:
if (++gBoss[0].act_wait % 30 == 1) if (++npc->act_wait % 30 == 1)
SetNpChar(348, (2 * (gBoss[0].act_wait / 30) + 2) << 13, 0x2A000, 0, 0, 0, 0, 0x180); {
x = (2 * (npc->act_wait / 30) + 2) * 0x10 * 0x200;
SetNpChar(348, x, 0x2A000, 0, 0, 0, 0, 0x180);
}
if (gBoss[0].act_wait / 3 & 1) if (npc->act_wait / 3 % 2)
PlaySoundObject(26, 1); PlaySoundObject(26, 1);
if (gBoss[0].act_wait > 540) if (npc->act_wait > 540)
gBoss[0].act_no = 420; npc->act_no = 420;
break; break;
case 420: case 420:
gBoss[0].act_no = 421; npc->act_no = 421;
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].ani_wait = 0; npc->ani_wait = 0;
SetQuake2(30); SetQuake2(30);
PlaySoundObject(35, 1); PlaySoundObject(35, 1);
gBoss[1].act_no = 102; gBoss[1].act_no = 102;
gBoss[2].act_no = 102; gBoss[2].act_no = 102;
for (int i = 0; i < 0x100; ++i) for (i = 0; i < 0x100; ++i)
SetNpChar(4, gBoss[0].x + (Random(-60, 60) * 0x200), gBoss[0].y + (Random(-60, 60) * 0x200), 0, 0, 0, 0, 0); {
x = npc->x + (Random(-60, 60) * 0x200);
y = npc->y + (Random(-60, 60) * 0x200);
SetNpChar(4, x, y, 0, 0, 0, 0, 0);
}
// Fallthrough // Fallthrough
case 421: case 421:
if (++gBoss[0].ani_wait > 500) if (++npc->ani_wait > 500)
{ {
gBoss[0].ani_wait = 0; npc->ani_wait = 0;
gBoss[0].act_no = 422; npc->act_no = 422;
} }
break; break;
case 422: case 422:
if (++gBoss[0].ani_wait > 200) if (++npc->ani_wait > 200)
{ {
gBoss[0].ani_wait = 0; npc->ani_wait = 0;
gBoss[0].act_no = 423; npc->act_no = 423;
} }
break; break;
case 423: case 423:
if (++gBoss[0].ani_wait > 20) if (++npc->ani_wait > 20)
{ {
gBoss[0].ani_wait = 0; npc->ani_wait = 0;
gBoss[0].act_no = 424; npc->act_no = 424;
} }
break; break;
case 424: case 424:
if (++gBoss[0].ani_wait > 200) if (++npc->ani_wait > 200)
{ {
gBoss[0].ani_wait = 0; npc->ani_wait = 0;
gBoss[0].act_no = 425; npc->act_no = 425;
} }
break; break;
case 425: case 425:
if (++gBoss[0].ani_wait > 500) if (++npc->ani_wait > 500)
{ {
gBoss[0].ani_wait = 0; npc->ani_wait = 0;
gBoss[0].act_no = 426; npc->act_no = 426;
} }
break; break;
case 426: case 426:
if (++gBoss[0].ani_wait > 200) if (++npc->ani_wait > 200)
{ {
gBoss[0].ani_wait = 0; npc->ani_wait = 0;
gBoss[0].act_no = 427; npc->act_no = 427;
} }
break; break;
case 427: case 427:
if (++gBoss[0].ani_wait > 20) if (++npc->ani_wait > 20)
{ {
gBoss[0].ani_wait = 0; npc->ani_wait = 0;
gBoss[0].act_no = 428; npc->act_no = 428;
} }
break; break;
case 428: case 428:
if (++gBoss[0].ani_wait > 200) if (++npc->ani_wait > 200)
{ {
gBoss[0].ani_wait = 0; npc->ani_wait = 0;
gBoss[0].act_no = 421; npc->act_no = 421;
} }
break; break;
case 1000: case 1000:
gBoss[0].act_no = 1001; npc->act_no = 1001;
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[1].act_no = 300; gBoss[1].act_no = 300;
gBoss[2].act_no = 300; gBoss[2].act_no = 300;
gBoss[1].act_no &= ~0x41;
gBoss[2].act_no &= ~0x41;
gBoss[0].bits &= ~0x41; gBoss[0].bits &= ~0x41;
gBoss[3].bits &= ~0x41; gBoss[3].bits &= ~0x41;
gBoss[4].bits &= ~0x41; gBoss[4].bits &= ~0x41;
gBoss[5].bits &= ~0x41; gBoss[5].bits &= ~0x41;
// Fallthrough // Fallthrough
case 1001: case 1001:
if (++gBoss[0].act_wait % 12 == 0) ++gBoss[0].act_wait;
if (gBoss[0].act_wait % 12 == 0)
PlaySoundObject(44, 1); PlaySoundObject(44, 1);
SetDestroyNpChar(gBoss[0].x + (Random(-60, 60) * 0x200), gBoss[0].y + (Random(-60, 60) * 0x200), 1, 1); SetDestroyNpChar(gBoss[0].x + (Random(-60, 60) * 0x200), gBoss[0].y + (Random(-60, 60) * 0x200), 1, 1);
@ -595,7 +624,9 @@ void ActBossChar_Ballos(void)
case 1002: case 1002:
SetQuake2(40); SetQuake2(40);
if (++gBoss[0].act_wait == 50) ++gBoss[0].act_wait;
if (gBoss[0].act_wait == 50)
{ {
gBoss[0].cond = 0; gBoss[0].cond = 0;
gBoss[1].cond = 0; gBoss[1].cond = 0;
@ -610,62 +641,78 @@ void ActBossChar_Ballos(void)
break; break;
} }
if (gBoss[0].act_no > 420 && gBoss[0].act_no < 500) if (npc->act_no > 420 && npc->act_no < 500)
{ {
gBoss[3].bits |= 0x20; gBoss[3].bits |= 0x20;
gBoss[4].bits |= 0x20; gBoss[4].bits |= 0x20;
gBoss[5].bits |= 0x20; gBoss[5].bits |= 0x20;
if (++gBoss[0].act_wait > 300) if (++npc->act_wait > 300)
{ {
gBoss[0].act_wait = 0; npc->act_wait = 0;
if (gMC.x > gBoss[0].x) if (gMC.x > npc->x)
{ {
for (int i = 0; i < 8; ++i) for (i = 0; i < 8; ++i)
SetNpChar(350, ((Random(-4, 4) + 156) * 0x2000) / 4, (Random(8, 68) * 0x2000) / 4, 0, 0, 0, 0, 0x100); {
x = ((Random(-4, 4) + 156) * 0x200 * 0x10) / 4;
y = (Random(8, 68) * 0x200 * 0x10) / 4;
SetNpChar(350, x, y, 0, 0, 0, 0, 0x100);
}
} }
else else
{ {
for (int i = 0; i < 8; ++i) for (i = 0; i < 8; ++i)
SetNpChar(350, (Random(-4, 4) * 0x2000) / 4, (Random(8, 68) * 0x2000) / 4, 0, 0, 2, 0, 0x100); {
x = (Random(-4, 4) * 0x200 * 0x10) / 4;
y = (Random(8, 68) * 0x200 * 0x10) / 4;
SetNpChar(350, x, y, 0, 0, 2, 0, 0x100);
}
} }
} }
if (gBoss[0].act_wait == 270 || gBoss[0].act_wait == 280 || gBoss[0].act_wait == 290) if (npc->act_wait == 270 || npc->act_wait == 280 || npc->act_wait == 290)
{ {
SetNpChar(353, gBoss[0].x, gBoss[0].y - 0x6800, 0, 0, 1, 0, 0x100); SetNpChar(353, npc->x, npc->y - 0x6800, 0, 0, 1, 0, 0x100);
PlaySoundObject(39, 1); PlaySoundObject(39, 1);
for (int i = 0; i < 4; ++i) for (i = 0; i < 4; ++i)
SetNpChar(4, gBoss[0].x, gBoss[0].y - 0x6800, 0, 0, 0, 0, 0x100); SetNpChar(4, npc->x, npc->y - 0x6800, 0, 0, 0, 0, 0x100);
} }
if (gBoss[0].life > 500) if (npc->life > 500)
{ {
if (Random(0, 10) == 2) if (Random(0, 10) == 2)
SetNpChar(270, gBoss[0].x + (Random(-40, 40) * 0x200), gBoss[0].y + (Random(0, 40) * 0x200), 0, 0, 3, 0, 0); {
x = npc->x + (Random(-40, 40) * 0x200);
y = npc->y + (Random(0, 40) * 0x200);
SetNpChar(270, x, y, 0, 0, 3, 0, 0);
}
} }
else else
{ {
if (Random(0, 4) == 2) if (Random(0, 4) == 2)
SetNpChar(270, gBoss[0].x + (Random(-40, 40) * 0x200), gBoss[0].y + (Random(0, 40) * 0x200), 0, 0, 3, 0, 0); {
x = npc->x + (Random(-40, 40) * 0x200);
y = npc->y + (Random(0, 40) * 0x200);
SetNpChar(270, x, y, 0, 0, 3, 0, 0);
}
} }
} }
if (gBoss[0].shock) if (npc->shock)
{ {
if ((++flash >> 1) & 1) if (++flash / 2 % 2)
gBoss[3].ani_no = 0;
else
gBoss[3].ani_no = 1; gBoss[3].ani_no = 1;
else
gBoss[3].ani_no = 0;
} }
else else
{ {
gBoss[3].ani_no = 0; gBoss[3].ani_no = 0;
} }
if (gBoss[0].act_no > 420) if (npc->act_no > 420)
gBoss[3].ani_no += 2; gBoss[3].ani_no += 2;
ActBossChar_Eye(&gBoss[1]); ActBossChar_Eye(&gBoss[1]);

View file

@ -12,6 +12,7 @@
static void ActBossChar02_01(void) static void ActBossChar02_01(void)
{ {
NPCHAR *boss;
int minus; int minus;
if (gBoss[0].direct == 0) if (gBoss[0].direct == 0)
@ -19,65 +20,77 @@ static void ActBossChar02_01(void)
else else
minus = -1; minus = -1;
boss = &gBoss[1];
switch (gBoss[0].ani_no) switch (gBoss[0].ani_no)
{ {
case 0: case 0:
gBoss[1].hit_voice = 52; boss->hit_voice = 52;
gBoss[1].hit.front = 0x2000; boss->hit.front = 0x2000;
gBoss[1].hit.top = 0x2000; boss->hit.top = 0x2000;
gBoss[1].hit.back = 0x2000; boss->hit.back = 0x2000;
gBoss[1].hit.bottom = 0x2000; boss->hit.bottom = 0x2000;
gBoss[1].size = 3; boss->size = 3;
gBoss[1].bits = 4; boss->bits = 4;
break; break;
case 1: case 1:
gBoss[1].x = gBoss[0].x + -0x3000 * minus; boss->x = gBoss[0].x + -0x3000 * minus;
gBoss[1].y = gBoss[0].y - 0x3000; boss->y = gBoss[0].y - 0x3000;
break; break;
case 2: case 2:
gBoss[1].x = gBoss[0].x + -0x3000 * minus; boss->x = gBoss[0].x + -0x3000 * minus;
gBoss[1].y = gBoss[0].y - 0x2800; boss->y = gBoss[0].y - 0x2800;
break; break;
case 3: case 3:
case 4: case 4:
gBoss[1].x = gBoss[0].x + -0x3000 * minus; boss->x = gBoss[0].x + -0x3000 * minus;
gBoss[1].y = gBoss[0].y - 0x2000; boss->y = gBoss[0].y - 0x2000;
break; break;
case 5: case 5:
gBoss[1].x = gBoss[0].x + -0x3000 * minus; boss->x = gBoss[0].x + -0x3000 * minus;
gBoss[1].y = gBoss[0].y - 0x5600; boss->y = gBoss[0].y - 0x5600;
break; break;
} }
} }
static void ActBossChar02_02(void) static void ActBossChar02_02(void)
{ {
if (gBoss[0].ani_no) NPCHAR *boss = &gBoss[2];
switch (gBoss[0].ani_no)
{ {
if (gBoss[0].ani_no > 0 && gBoss[0].ani_no <= 5) case 0:
{ boss->hit_voice = 52;
gBoss[2].x = gBoss[0].x; boss->hit.front = 0x3000;
gBoss[2].y = gBoss[0].y; boss->hit.top = 0x2000;
} boss->hit.back = 0x3000;
} boss->hit.bottom = 0x2000;
else boss->size = 3;
{ boss->bits = 4;
gBoss[2].hit_voice = 52; break;
gBoss[2].hit.front = 0x3000;
gBoss[2].hit.top = 0x2000; case 1:
gBoss[2].hit.back = 0x3000; case 2:
gBoss[2].hit.bottom = 0x2000; case 3:
gBoss[2].size = 3; case 4:
gBoss[2].bits = 4; case 5:
boss->x = gBoss[0].x;
boss->y = gBoss[0].y;
break;
} }
} }
void ActBossChar_Frog(void) void ActBossChar_Frog(void)
{ {
int i;
unsigned char deg;
int ym;
int xm;
RECT rcLeft[9] = { RECT rcLeft[9] = {
{0, 0, 0, 0}, {0, 0, 0, 0},
{0, 48, 80, 112}, {0, 48, 80, 112},
@ -102,220 +115,220 @@ void ActBossChar_Frog(void)
{120, 24, 160, 48}, {120, 24, 160, 48},
}; };
switch (gBoss[0].act_no) NPCHAR *boss = gBoss;
switch (boss->act_no)
{ {
case 0: case 0:
gBoss->x = 0xC000; boss->x = 0xC000;
gBoss->y = 0x19000; boss->y = 0x19000;
gBoss->direct = 2; boss->direct = 2;
gBoss->view.front = 0x6000; boss->view.front = 0x6000;
gBoss->view.top = 0x6000; boss->view.top = 0x6000;
gBoss->view.back = 0x4000; boss->view.back = 0x4000;
gBoss->view.bottom = 0x2000; boss->view.bottom = 0x2000;
gBoss->hit_voice = 52; boss->hit_voice = 52;
gBoss->hit.front = 0x3000; boss->hit.front = 0x3000;
gBoss->hit.top = 0x2000; boss->hit.top = 0x2000;
gBoss->hit.back = 0x3000; boss->hit.back = 0x3000;
gBoss->hit.bottom = 0x2000; boss->hit.bottom = 0x2000;
gBoss->size = 3; boss->size = 3;
gBoss->exp = 1; boss->exp = 1;
gBoss->code_event = 1000; boss->code_event = 1000;
gBoss->bits |= 0x8200; boss->bits |= 0x8200;
gBoss->life = 300; boss->life = 300;
break; break;
case 10: case 10:
gBoss->act_no = 11; boss->act_no = 11;
gBoss->ani_no = 3; boss->ani_no = 3;
gBoss->cond = 0x80; boss->cond = 0x80;
gBoss->rect = rcRight[0]; boss->rect = rcRight[0];
gBoss[1].cond = -112; gBoss[1].cond = -112;
gBoss[1].code_event = 1000; gBoss[1].code_event = 1000;
gBoss[2].cond = 0x80; gBoss[2].cond = 0x80;
gBoss[1].damage = 5; gBoss[1].damage = 5;
gBoss[2].damage = 5; gBoss[2].damage = 5;
for (int i = 0; i < 8; ++i) for (i = 0; i < 8; ++i)
SetNpChar(4, gBoss->x + (Random(-12, 12) * 0x200), gBoss->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100); SetNpChar(4, boss->x + (Random(-12, 12) * 0x200), boss->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
break; break;
case 20: case 20:
gBoss->act_no = 21; boss->act_no = 21;
gBoss->act_wait = 0; boss->act_wait = 0;
// Fallthrough // Fallthrough
case 21: case 21:
if (++gBoss->act_wait / 2 % 2) if (++boss->act_wait / 2 % 2)
gBoss->ani_no = 3; boss->ani_no = 3;
else else
gBoss->ani_no = 0; boss->ani_no = 0;
break; break;
case 100: case 100:
gBoss->act_no = 101; boss->act_no = 101;
gBoss->act_wait = 0; boss->act_wait = 0;
gBoss->ani_no = 1; boss->ani_no = 1;
gBoss->xm = 0; boss->xm = 0;
// Fallthrough // Fallthrough
case 101: case 101:
if (++gBoss->act_wait > 50) if (++boss->act_wait > 50)
{ {
gBoss->act_no = 102; boss->act_no = 102;
gBoss->ani_wait = 0; boss->ani_wait = 0;
gBoss->ani_no = 2; boss->ani_no = 2;
} }
break; break;
case 102: case 102:
if (++gBoss->ani_wait > 10) if (++boss->ani_wait > 10)
{ {
gBoss->act_no = 103; boss->act_no = 103;
gBoss->ani_wait = 0; boss->ani_wait = 0;
gBoss->ani_no = 1; boss->ani_no = 1;
} }
break; break;
case 103: case 103:
if (++gBoss->ani_wait > 4) if (++boss->ani_wait > 4)
{ {
gBoss->act_no = 104; boss->act_no = 104;
gBoss->ani_no = 5; boss->ani_no = 5;
gBoss->ym = -0x400; boss->ym = -0x400;
PlaySoundObject(25, 1); PlaySoundObject(25, 1);
if (gBoss->direct == 0) if (boss->direct == 0)
gBoss->xm = -0x200; boss->xm = -0x200;
else else
gBoss->xm = 0x200; boss->xm = 0x200;
gBoss->view.top = 0x8000; boss->view.top = 0x8000;
gBoss->view.bottom = 0x3000; boss->view.bottom = 0x3000;
} }
break; break;
case 104: case 104:
if (gBoss->direct == 0 && gBoss->flag & 1) if (boss->direct == 0 && boss->flag & 1)
{ {
gBoss->direct = 2; boss->direct = 2;
gBoss->xm = 0x200; boss->xm = 0x200;
} }
if (gBoss->direct == 2 && gBoss->flag & 4) if (boss->direct == 2 && boss->flag & 4)
{ {
gBoss->direct = 0; boss->direct = 0;
gBoss->xm = -0x200; boss->xm = -0x200;
} }
if (gBoss->flag & 8) if (boss->flag & 8)
{ {
PlaySoundObject(26, 1); PlaySoundObject(26, 1);
SetQuake(30); SetQuake(30);
gBoss->act_no = 100; boss->act_no = 100;
gBoss->ani_no = 1; boss->ani_no = 1;
gBoss->view.top = 0x6000; boss->view.top = 0x6000;
gBoss->view.bottom = 0x2000; boss->view.bottom = 0x2000;
if (gBoss->direct == 0 && gBoss->x < gMC.x) if (boss->direct == 0 && boss->x < gMC.x)
{ {
gBoss->direct = 2; boss->direct = 2;
gBoss->act_no = 110; boss->act_no = 110;
} }
if (gBoss->direct == 2 && gBoss->x > gMC.x) if (boss->direct == 2 && boss->x > gMC.x)
{ {
gBoss->direct = 0; boss->direct = 0;
gBoss->act_no = 110; boss->act_no = 110;
} }
SetNpChar(110, Random(4, 16) * 0x2000, Random(0, 4) * 0x2000, 0, 0, 4, 0, 0x80); SetNpChar(110, Random(4, 16) * 0x2000, Random(0, 4) * 0x2000, 0, 0, 4, 0, 0x80);
for (int i = 0; i < 4; ++i) for (i = 0; i < 4; ++i)
SetNpChar(4, gBoss->x + (Random(-12, 12) * 0x200), gBoss->y + gBoss->hit.bottom, Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100); SetNpChar(4, boss->x + (Random(-12, 12) * 0x200), boss->y + boss->hit.bottom, Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
} }
break; break;
case 110: case 110:
gBoss->ani_no = 1; boss->ani_no = 1;
gBoss->act_wait = 0; boss->act_wait = 0;
gBoss->act_no = 111; boss->act_no = 111;
// Fallthrough // Fallthrough
case 111: case 111:
++gBoss->act_wait; ++boss->act_wait;
gBoss->xm = 8 * gBoss->xm / 9; boss->xm = 8 * boss->xm / 9;
if (gBoss->act_wait > 50) if (boss->act_wait > 50)
{ {
gBoss->ani_no = 2; boss->ani_no = 2;
gBoss->ani_wait = 0; boss->ani_wait = 0;
gBoss->act_no = 112; boss->act_no = 112;
} }
break; break;
case 112: case 112:
if (++gBoss->ani_wait > 4) if (++boss->ani_wait > 4)
{ {
gBoss->act_no = 113; boss->act_no = 113;
gBoss->act_wait = 0; boss->act_wait = 0;
gBoss->ani_no = 3; boss->ani_no = 3;
gBoss->count1 = 16; boss->count1 = 16;
gBoss[1].bits |= 0x20; gBoss[1].bits |= 0x20;
gBoss->tgt_x = gBoss->life; boss->tgt_x = boss->life;
} }
break; break;
case 113: case 113:
if (gBoss->shock) if (boss->shock)
{ {
if (gBoss->count2++ / 2 % 2) if (boss->count2++ / 2 % 2)
gBoss->ani_no = 4; boss->ani_no = 4;
else else
gBoss->ani_no = 3; boss->ani_no = 3;
} }
else else
{ {
gBoss->count2 = 0; boss->count2 = 0;
gBoss->ani_no = 3; boss->ani_no = 3;
} }
gBoss->xm = 10 * gBoss->xm / 11; boss->xm = 10 * boss->xm / 11;
if (++gBoss->act_wait > 16) if (++boss->act_wait > 16)
{ {
gBoss->act_wait = 0; boss->act_wait = 0;
--gBoss->count1; --boss->count1;
unsigned char deg; if (boss->direct == 0)
deg = GetArktan(boss->x - 0x4000 - gMC.x, boss->y - 0x1000 - gMC.y);
if (gBoss->direct == 0)
deg = GetArktan(gBoss->x - 0x4000 - gMC.x, gBoss->y - 0x1000 - gMC.y);
else else
deg = GetArktan(gBoss->x + 0x4000 - gMC.x, gBoss->y - 0x1000 - gMC.y); deg = GetArktan(boss->x + 0x4000 - gMC.x, boss->y - 0x1000 - gMC.y);
deg += Random(-16, 16); deg += (unsigned char)Random(-16, 16);
int ym = GetSin(deg); ym = GetSin(deg);
int xm = GetCos(deg); xm = GetCos(deg);
if (gBoss->direct == 0) if (boss->direct == 0)
SetNpChar(108, gBoss->x - 0x4000, gBoss->y - 0x1000, xm, ym, 0, 0, 0x100); SetNpChar(108, boss->x - 0x4000, boss->y - 0x1000, xm, ym, 0, 0, 0x100);
else else
SetNpChar(108, gBoss->x + 0x4000, gBoss->y - 0x1000, xm, ym, 0, 0, 0x100); SetNpChar(108, boss->x + 0x4000, boss->y - 0x1000, xm, ym, 0, 0, 0x100);
PlaySoundObject(39, 1); PlaySoundObject(39, 1);
if (gBoss->count1 == 0 || gBoss->life < gBoss->tgt_x - 90) if (boss->count1 == 0 || boss->life < boss->tgt_x - 90)
{ {
gBoss->act_no = 114; boss->act_no = 114;
gBoss->act_wait = 0; boss->act_wait = 0;
gBoss->ani_no = 2; boss->ani_no = 2;
gBoss->ani_wait = 0; boss->ani_wait = 0;
gBoss[1].bits &= ~0x20; gBoss[1].bits &= ~0x20;
} }
} }
@ -323,186 +336,186 @@ void ActBossChar_Frog(void)
break; break;
case 114: case 114:
if (++gBoss->ani_wait > 10) if (++boss->ani_wait > 10)
{ {
if (++gBoss[1].count1 > 2) if (++gBoss[1].count1 > 2)
{ {
gBoss[1].count1 = 0; gBoss[1].count1 = 0;
gBoss->act_no = 120; boss->act_no = 120;
} }
else else
{ {
gBoss->act_no = 100; boss->act_no = 100;
} }
gBoss->ani_wait = 0; boss->ani_wait = 0;
gBoss->ani_no = 1; boss->ani_no = 1;
} }
break; break;
case 120: case 120:
gBoss->act_no = 121; boss->act_no = 121;
gBoss->act_wait = 0; boss->act_wait = 0;
gBoss->ani_no = 1; boss->ani_no = 1;
gBoss->xm = 0; boss->xm = 0;
// Fallthrough // Fallthrough
case 121: case 121:
if (++gBoss->act_wait > 50) if (++boss->act_wait > 50)
{ {
gBoss->act_no = 122; boss->act_no = 122;
gBoss->ani_wait = 0; boss->ani_wait = 0;
gBoss->ani_no = 2; boss->ani_no = 2;
} }
break; break;
case 122: case 122:
if (++gBoss->ani_wait > 20) if (++boss->ani_wait > 20)
{ {
gBoss->act_no = 123; boss->act_no = 123;
gBoss->ani_wait = 0; boss->ani_wait = 0;
gBoss->ani_no = 1; boss->ani_no = 1;
} }
break; break;
case 123: case 123:
if (++gBoss->ani_wait > 4) if (++boss->ani_wait > 4)
{ {
gBoss->act_no = 124; boss->act_no = 124;
gBoss->ani_no = 5; boss->ani_no = 5;
gBoss->ym = -0xA00; boss->ym = -0xA00;
gBoss->view.top = 0x8000; boss->view.top = 0x8000;
gBoss->view.bottom = 0x3000; boss->view.bottom = 0x3000;
PlaySoundObject(25, 1); PlaySoundObject(25, 1);
} }
break; break;
case 124: case 124:
if (gBoss->flag & 8) if (boss->flag & 8)
{ {
PlaySoundObject(26, 1); PlaySoundObject(26, 1);
SetQuake(60); SetQuake(60);
gBoss->act_no = 100; boss->act_no = 100;
gBoss->ani_no = 1; boss->ani_no = 1;
gBoss->view.top = 0x6000; boss->view.top = 0x6000;
gBoss->view.bottom = 0x2000; boss->view.bottom = 0x2000;
for (int i = 0; i < 2; ++i) for (i = 0; i < 2; ++i)
SetNpChar(104, Random(4, 16) * 0x2000, Random(0, 4) * 0x2000, 0, 0, 4, 0, 0x80); SetNpChar(104, Random(4, 16) * 0x2000, Random(0, 4) * 0x2000, 0, 0, 4, 0, 0x80);
for (int i = 0; i < 6; ++i) for (i = 0; i < 6; ++i)
SetNpChar(110, Random(4, 16) * 0x2000, Random(0, 4) * 0x2000, 0, 0, 4, 0, 0x80); SetNpChar(110, Random(4, 16) * 0x2000, Random(0, 4) * 0x2000, 0, 0, 4, 0, 0x80);
for (int i = 0; i < 8; ++i) for (i = 0; i < 8; ++i)
SetNpChar(4, gBoss->x + (Random(-12, 12) * 0x200), gBoss->y + gBoss->hit.bottom, Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100); SetNpChar(4, boss->x + (Random(-12, 12) * 0x200), boss->y + boss->hit.bottom, Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
if (gBoss->direct == 0 && gMC.x > gBoss->x) if (boss->direct == 0 && boss->x < gMC.x)
{ {
gBoss->direct = 2; boss->direct = 2;
gBoss->act_no = 110; boss->act_no = 110;
} }
if ( gBoss->direct == 2 && gMC.x < gBoss->x) if (boss->direct == 2 && boss->x > gMC.x)
{ {
gBoss->direct = 0; boss->direct = 0;
gBoss->act_no = 110; boss->act_no = 110;
} }
} }
break; break;
case 130: case 130:
gBoss->act_no = 131; boss->act_no = 131;
gBoss->ani_no = 3; boss->ani_no = 3;
gBoss->act_wait = 0; boss->act_wait = 0;
gBoss->xm = 0; boss->xm = 0;
PlaySoundObject(72, 1); PlaySoundObject(72, 1);
for (int i = 0; i < 8; ++i) for (i = 0; i < 8; ++i)
SetNpChar(4, gBoss->x + (Random(-12, 12) * 0x200), gBoss->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100); SetNpChar(4, boss->x + (Random(-12, 12) * 0x200), boss->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
gBoss[1].cond = 0; gBoss[1].cond = 0;
gBoss[2].cond = 0; gBoss[2].cond = 0;
// Fallthrough // Fallthrough
case 131: case 131:
if (++gBoss->act_wait % 5 == 0) if (++boss->act_wait % 5 == 0)
SetNpChar(4, gBoss->x + (Random(-12, 12) * 0x200), gBoss->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100); SetNpChar(4, boss->x + (Random(-12, 12) * 0x200), boss->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
if (gBoss->act_wait / 2 % 2) if (boss->act_wait / 2 % 2)
gBoss->x -= 0x200; boss->x -= 0x200;
else else
gBoss->x += 0x200; boss->x += 0x200;
if (gBoss->act_wait > 100) if (boss->act_wait > 100)
{ {
gBoss->act_wait = 0; boss->act_wait = 0;
gBoss->act_no = 132; boss->act_no = 132;
} }
break; break;
case 132: case 132:
if (++gBoss->act_wait / 2 % 2) if (++boss->act_wait / 2 % 2)
{ {
gBoss->view.front = 0x2800; boss->view.front = 0x2800;
gBoss->view.top = 0x1800; boss->view.top = 0x1800;
gBoss->view.back = 0x2800; boss->view.back = 0x2800;
gBoss->view.bottom = 0x1800; boss->view.bottom = 0x1800;
gBoss->ani_no = 6; boss->ani_no = 6;
} }
else else
{ {
gBoss->view.front = 0x6000; boss->view.front = 0x6000;
gBoss->view.top = 0x6000; boss->view.top = 0x6000;
gBoss->view.back = 0x4000; boss->view.back = 0x4000;
gBoss->view.bottom = 0x2000; boss->view.bottom = 0x2000;
gBoss->ani_no = 3; boss->ani_no = 3;
} }
if (gBoss->act_wait % 9 == 0) if (boss->act_wait % 9 == 0)
SetNpChar(4, gBoss->x + (Random(-12, 12) * 0x200), gBoss->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100); SetNpChar(4, boss->x + (Random(-12, 12) * 0x200), boss->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
if (gBoss->act_wait > 150) if (boss->act_wait > 150)
{ {
gBoss->act_no = 140; boss->act_no = 140;
gBoss->hit.bottom = 0x1800; boss->hit.bottom = 0x1800;
} }
break; break;
case 140: case 140:
gBoss->act_no = 141; boss->act_no = 141;
// Fallthrough // Fallthrough
case 141: case 141:
if (gBoss->flag & 8) if (boss->flag & 8)
{ {
gBoss->act_no = 142; boss->act_no = 142;
gBoss->act_wait = 0; boss->act_wait = 0;
gBoss->ani_no = 7; boss->ani_no = 7;
} }
break; break;
case 142: case 142:
if (++gBoss->act_wait > 30) if (++boss->act_wait > 30)
{ {
gBoss->ani_no = 8; boss->ani_no = 8;
gBoss->ym = -0xA00; boss->ym = -0xA00;
gBoss->bits |= 8; boss->bits |= 8;
gBoss->act_no = 143; boss->act_no = 143;
} }
break; break;
case 143: case 143:
gBoss->ym = -0xA00; boss->ym = -0xA00;
if (gBoss->y < 0) if (boss->y < 0)
{ {
gBoss->cond = 0; boss->cond = 0;
PlaySoundObject(26, 1); PlaySoundObject(26, 1);
SetQuake(30); SetQuake(30);
} }
@ -510,17 +523,17 @@ void ActBossChar_Frog(void)
break; break;
} }
gBoss->ym += 0x40; boss->ym += 0x40;
if (gBoss->ym > 0x5FF) if (boss->ym > 0x5FF)
gBoss->ym = 0x5FF; boss->ym = 0x5FF;
gBoss->x += gBoss->xm; boss->x += boss->xm;
gBoss->y += gBoss->ym; boss->y += boss->ym;
if (gBoss->direct == 0) if (boss->direct == 0)
gBoss->rect = rcLeft[gBoss->ani_no]; boss->rect = rcLeft[boss->ani_no];
else else
gBoss->rect = rcRight[gBoss->ani_no]; boss->rect = rcRight[boss->ani_no];
ActBossChar02_01(); ActBossChar02_01();
ActBossChar02_02(); ActBossChar02_02();

View file

@ -10,161 +10,166 @@
void ActBossChar_Ironhead(void) void ActBossChar_Ironhead(void)
{ {
switch (gBoss[0].act_no) static unsigned char flash;
int i;
NPCHAR *npc = gBoss;
switch (npc->act_no)
{ {
case 0: case 0:
gBoss[0].cond = 0x80; npc->cond = 0x80;
gBoss[0].exp = 1; npc->exp = 1;
gBoss[0].direct = 2; npc->direct = 2;
gBoss[0].act_no = 100; npc->act_no = 100;
gBoss[0].x = 0x14000; npc->x = 0x14000;
gBoss[0].y = 0x10000; npc->y = 0x10000;
gBoss[0].view.front = 0x5000; npc->view.front = 0x5000;
gBoss[0].view.top = 0x1800; npc->view.top = 0x1800;
gBoss[0].view.back = 0x3000; npc->view.back = 0x3000;
gBoss[0].view.bottom = 0x1800; npc->view.bottom = 0x1800;
gBoss[0].hit_voice = 54; npc->hit_voice = 54;
gBoss[0].hit.front = 0x2000; npc->hit.front = 0x2000;
gBoss[0].hit.top = 0x1400; npc->hit.top = 0x1400;
gBoss[0].hit.back = 0x2000; npc->hit.back = 0x2000;
gBoss[0].hit.bottom = 0x1400; npc->hit.bottom = 0x1400;
gBoss[0].bits = 0x8228; npc->bits = 0x8228;
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 = 400; npc->life = 400;
break; break;
case 100: case 100:
gBoss[0].act_no = 101; npc->act_no = 101;
gBoss[0].bits &= ~0x20; npc->bits &= ~0x20;
gBoss[0].act_wait = 0; npc->act_wait = 0;
// Fallthrough // Fallthrough
case 101: case 101:
if (++gBoss[0].act_wait > 50) if (++npc->act_wait > 50)
{ {
gBoss[0].act_no = 250; npc->act_no = 250;
gBoss[0].act_wait = 0; npc->act_wait = 0;
} }
if (gBoss[0].act_wait % 4 == 0) if (npc->act_wait % 4 == 0)
SetNpChar(197, Random(15, 18) * 0x2000, Random(2, 13) * 0x2000, 0, 0, 0, 0, 0x100); SetNpChar(197, Random(15, 18) * 0x2000, Random(2, 13) * 0x2000, 0, 0, 0, 0, 0x100);
break; break;
case 250: case 250:
gBoss[0].act_no = 251; npc->act_no = 251;
if (gBoss[0].direct == 2) if (npc->direct == 2)
{ {
gBoss[0].x = 0x1E000; npc->x = 0x1E000;
gBoss[0].y = gMC.y; npc->y = gMC.y;
} }
else else
{ {
gBoss[0].x = 0x5A000; npc->x = 0x5A000;
gBoss[0].y = Random(2, 13) * 0x2000; npc->y = Random(2, 13) * 0x2000;
} }
gBoss[0].tgt_x = gBoss[0].x; npc->tgt_x = npc->x;
gBoss[0].tgt_y = gBoss[0].y; npc->tgt_y = npc->y;
gBoss[0].ym = Random(-0x200, 0x200); npc->ym = Random(-0x200, 0x200);
gBoss[0].xm = Random(-0x200, 0x200); npc->xm = Random(-0x200, 0x200);
gBoss[0].bits |= 0x20; npc->bits |= 0x20;
// Fallthrough // Fallthrough
case 251: case 251:
if (gBoss[0].direct == 2) if (npc->direct == 2)
{ {
gBoss[0].tgt_x += 0x400; npc->tgt_x += 0x400;
} }
else else
{ {
gBoss[0].tgt_x -= 0x200; npc->tgt_x -= 0x200;
if (gMC.y > gBoss[0].tgt_y) if (npc->tgt_y < gMC.y)
gBoss[0].tgt_y += 0x200; npc->tgt_y += 0x200;
else else
gBoss[0].tgt_y -= 0x200; npc->tgt_y -= 0x200;
} }
if (gBoss[0].tgt_x > gBoss[0].x) if (npc->x < npc->tgt_x)
gBoss[0].xm += 8; npc->xm += 8;
else else
gBoss[0].xm -= 8; npc->xm -= 8;
if (gBoss[0].tgt_y > gBoss[0].y) if (npc->y < npc->tgt_y)
gBoss[0].ym += 8; npc->ym += 8;
else else
gBoss[0].ym -= 8; npc->ym -= 8;
if (gBoss[0].ym > 0x200) if (npc->ym > 0x200)
gBoss[0].ym = 0x200; npc->ym = 0x200;
if (gBoss[0].ym < -0x200) if (npc->ym < -0x200)
gBoss[0].ym = -0x200; npc->ym = -0x200;
gBoss[0].x += gBoss[0].xm; npc->x += npc->xm;
gBoss[0].y += gBoss[0].ym; npc->y += npc->ym;
if (gBoss[0].direct == 2) if (npc->direct == 2)
{ {
if (gBoss[0].x > 0x5A000) if (npc->x > 0x5A000)
{ {
gBoss[0].direct = 0; npc->direct = 0;
gBoss[0].act_no = 100; npc->act_no = 100;
} }
} }
else else
{ {
if (gBoss[0].x < 0x22000) if (npc->x < 0x22000)
{ {
gBoss[0].direct = 2; npc->direct = 2;
gBoss[0].act_no = 100; npc->act_no = 100;
} }
} }
if (gBoss[0].direct == 0 && (++gBoss[0].act_wait == 300 || gBoss[0].act_wait == 310 || gBoss[0].act_wait == 320)) if (npc->direct == 0 && (++npc->act_wait == 300 || npc->act_wait == 310 || npc->act_wait == 320))
{ {
PlaySoundObject(39, 1); PlaySoundObject(39, 1);
SetNpChar(198, gBoss[0].x + 0x1400, gBoss[0].y + 0x200, Random(-3, 0) * 0x200, Random(-3, 3) * 0x200, 2, 0, 0x100); SetNpChar(198, npc->x + 0x1400, npc->y + 0x200, Random(-3, 0) * 0x200, Random(-3, 3) * 0x200, 2, 0, 0x100);
} }
if (++gBoss[0].ani_wait > 2) if (++npc->ani_wait > 2)
{ {
gBoss[0].ani_wait = 0; npc->ani_wait = 0;
++gBoss[0].ani_no; ++npc->ani_no;
} }
if (gBoss[0].ani_no > 7) if (npc->ani_no > 7)
gBoss[0].ani_no = 0; npc->ani_no = 0;
break; break;
case 1000: case 1000:
gBoss[0].bits &= ~0x20; npc->bits &= ~0x20;
gBoss[0].ani_no = 8; npc->ani_no = 8;
gBoss[0].damage = 0; npc->damage = 0;
gBoss[0].act_no = 1001; npc->act_no = 1001;
gBoss[0].tgt_x = gBoss[0].x; npc->tgt_x = npc->x;
gBoss[0].tgt_y = gBoss[0].y; npc->tgt_y = npc->y;
SetQuake(20); SetQuake(20);
for (int i = 0; i < 0x20; ++i) for (i = 0; i < 0x20; ++i)
SetNpChar(4, gBoss[0].x + (Random(-0x80, 0x80) * 0x200), gBoss[0].y + (Random(-0x40, 0x40) * 0x200), Random(-0x80, 0x80) * 0x200, Random(-0x80, 0x80) * 0x200, 0, 0, 0x100); SetNpChar(4, npc->x + (Random(-0x80, 0x80) * 0x200), npc->y + (Random(-0x40, 0x40) * 0x200), Random(-0x80, 0x80) * 0x200, Random(-0x80, 0x80) * 0x200, 0, 0, 0x100);
DeleteNpCharCode(197, 1); DeleteNpCharCode(197, 1);
DeleteNpCharCode(271, 1); DeleteNpCharCode(271, 1);
DeleteNpCharCode(272, 1); DeleteNpCharCode(272, 1);
// Fallthrough // Fallthrough
case 1001: case 1001:
gBoss[0].tgt_x -= 0x200; npc->tgt_x -= 0x200;
gBoss[0].x = gBoss[0].tgt_x + (Random(-1, 1) * 0x200); npc->x = npc->tgt_x + (Random(-1, 1) * 0x200);
gBoss[0].y = gBoss[0].tgt_y + (Random(-1, 1) * 0x200); npc->y = npc->tgt_y + (Random(-1, 1) * 0x200);
if (++gBoss[0].act_wait % 4 == 0) if (++npc->act_wait % 4 == 0)
SetNpChar(4, gBoss[0].x + (Random(-0x80, 0x80) * 0x200), gBoss[0].y + (Random(-0x40, 0x40) * 0x200), Random(-0x80, 0x80) * 0x200, Random(-0x80, 0x80) * 0x200, 0, 0, 0x100); SetNpChar(4, npc->x + (Random(-0x80, 0x80) * 0x200), npc->y + (Random(-0x40, 0x40) * 0x200), Random(-0x80, 0x80) * 0x200, Random(-0x80, 0x80) * 0x200, 0, 0, 0x100);
break; break;
} }
@ -193,17 +198,15 @@ void ActBossChar_Ironhead(void)
{256, 48, 320, 72}, {256, 48, 320, 72},
}; };
if (gBoss[0].shock) if (npc->shock)
{ {
static unsigned char flash; if (++flash / 2 % 2)
npc->rect = rc[npc->ani_no];
if ((++flash >> 1) % 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];
} }
} }

View file

@ -9,7 +9,7 @@
static struct static struct
{ {
bool flag; BOOL flag;
int *pLife; int *pLife;
int max; int max;
int br; int br;
@ -18,33 +18,32 @@ static struct
void InitBossLife(void) void InitBossLife(void)
{ {
gBL.flag = false; gBL.flag = FALSE;
} }
bool StartBossLife(int code_event) BOOL StartBossLife(int code_event)
{ {
for (int i = 0; i < 0x200; ++i) int i = 0;
{ while (i < 0x200 && gNPC[i].code_event != code_event)
if (gNPC[i].code_event == code_event) ++i;
{
gBL.flag = true; if (i == 0x200)
return FALSE;
gBL.flag = TRUE;
gBL.max = gNPC[i].life; gBL.max = gNPC[i].life;
gBL.br = gNPC[i].life; gBL.br = gNPC[i].life;
gBL.pLife = &gNPC[i].life; gBL.pLife = &gNPC[i].life;
return true; return TRUE;
}
}
return false;
} }
bool StartBossLife2(void) BOOL StartBossLife2(void)
{ {
gBL.flag = true; gBL.flag = TRUE;
gBL.max = gBoss[0].life; gBL.max = gBoss[0].life;
gBL.br = gBoss[0].life; gBL.br = gBoss[0].life;
gBL.pLife = &gBoss[0].life; gBL.pLife = &gBoss[0].life;
return true; return TRUE;
} }
void PutBossLife(void) void PutBossLife(void)
@ -55,20 +54,26 @@ void PutBossLife(void)
RECT rcLife = {0, 24, 0, 32}; RECT rcLife = {0, 24, 0, 32};
RECT rcBr = {0, 32, 232, 40}; RECT rcBr = {0, 32, 232, 40};
if (gBL.flag) if (gBL.flag == FALSE)
return;
if (*gBL.pLife < 1)
{ {
if (*gBL.pLife >= 1) gBL.flag = FALSE;
}
else
{ {
rcLife.right = 198 * *gBL.pLife / gBL.max; rcLife.right = 198 * *gBL.pLife / gBL.max;
if (gBL.br <= *gBL.pLife) if (gBL.br > *gBL.pLife)
{
if (++gBL.count > 30)
--gBL.br;
}
else
{ {
gBL.count = 0; gBL.count = 0;
} }
else if (++gBL.count > 30)
{
--gBL.br;
}
rcBr.right = 198 * gBL.br / gBL.max; rcBr.right = 198 * gBL.br / gBL.max;
@ -78,9 +83,4 @@ void PutBossLife(void)
PutBitmap3(&grcGame, (WINDOW_WIDTH - 176) / 2, WINDOW_HEIGHT - 16, &rcLife, SURFACE_ID_TEXT_BOX); PutBitmap3(&grcGame, (WINDOW_WIDTH - 176) / 2, WINDOW_HEIGHT - 16, &rcLife, SURFACE_ID_TEXT_BOX);
PutBitmap3(&grcGame, (WINDOW_WIDTH - 240) / 2, WINDOW_HEIGHT - 16, &rcText, SURFACE_ID_TEXT_BOX); PutBitmap3(&grcGame, (WINDOW_WIDTH - 240) / 2, WINDOW_HEIGHT - 16, &rcText, SURFACE_ID_TEXT_BOX);
} }
else
{
gBL.flag = false;
}
}
} }

View file

@ -1,6 +1,8 @@
#pragma once #pragma once
#include "WindowsWrapper.h"
void InitBossLife(void); void InitBossLife(void);
bool StartBossLife(int code_event); BOOL StartBossLife(int code_event);
bool StartBossLife2(void); BOOL StartBossLife2(void);
void PutBossLife(void); void PutBossLife(void);

View file

@ -13,41 +13,45 @@
#include "NpChar.h" #include "NpChar.h"
#include "Sound.h" #include "Sound.h"
void ActBoss01_12() static void ActBoss01_12()
{ {
int i;
RECT rcLeft[1] = {80, 56, 104, 72}; RECT rcLeft[1] = {80, 56, 104, 72};
RECT rcRight[1] = {104, 56, 128, 72}; RECT rcRight[1] = {104, 56, 128, 72};
for (int i = 1; i <= 2; i++) for (i = 1; i < 3; ++i)
{ {
gBoss[i].y = (gBoss[i].y + gBoss[i + 2].y - 0x1000) / 2; gBoss[i].y = (gBoss[0].y + gBoss[i + 2].y - 0x1000) / 2;
if (gBoss[i].direct) if (gBoss[i].direct == 0)
{ {
gBoss[i].rect = rcRight[gBoss[i].count2]; gBoss[i].x = gBoss[0].x - 0x2000;
gBoss[i].x = gBoss[0].x + 0x2000; gBoss[i].rect = rcLeft[gBoss[i].ani_no];
} }
else else
{ {
gBoss[i].rect = rcLeft[gBoss[i].count2]; gBoss[i].rect = rcRight[gBoss[i].ani_no];
gBoss[i].x = gBoss[0].x - 0x2000; gBoss[i].x = gBoss[0].x + 0x2000;
} }
} }
} }
void ActBoss01_34() static void ActBoss01_34()
{ {
int i;
RECT rcLeft[2] = { RECT rcLeft[2] = {
{0, 56, 40, 88}, {0, 56, 40, 88},
{40, 56, 80, 88}, {40, 56, 80, 88},
}; };
RECT rcRight[2] = { RECT rcRight[2] = {
{ 0, 88, 40, 120 }, {0, 88, 40, 120},
{ 40, 88, 80, 120 }, {40, 88, 80, 120},
}; };
for (int i = 3; i <= 4; i++) for (i = 3; i < 5; ++i)
{ {
switch (gBoss[i].act_no) switch (gBoss[i].act_no)
{ {
@ -55,41 +59,44 @@ void ActBoss01_34()
gBoss[i].act_no = 1; gBoss[i].act_no = 1;
// Fallthrough // Fallthrough
case 1: case 1:
gBoss[i].y = gBoss[0].y;
if (i == 3) if (i == 3)
gBoss[i].x = gBoss[0].x - 0x2000; gBoss[i].x = gBoss[0].x - 0x2000;
if (i == 4) if (i == 4)
gBoss[i].x = gBoss[0].x + 0x2000; gBoss[i].x = gBoss[0].x + 0x2000;
gBoss[i].y = gBoss[0].y;
break; break;
case 3: case 3:
gBoss[i].tgt_y = gBoss[0].y + 0x3000;
if (i == 3) if (i == 3)
gBoss[i].x = gBoss[0].x - 0x2000; gBoss[i].x = gBoss[0].x - 0x2000;
if (i == 4) if (i == 4)
gBoss[i].x = gBoss[0].x + 0x2000; gBoss[i].x = gBoss[0].x + 0x2000;
gBoss[i].tgt_y = gBoss[0].y + 0x3000;
gBoss[i].y += (gBoss[i].tgt_y - gBoss[i].y) / 2; gBoss[i].y += (gBoss[i].tgt_y - gBoss[i].y) / 2;
break; break;
default:
break;
} }
gBoss[i].count2 = !((gBoss[i].flag & 8) && gBoss[i].y > gBoss[i].tgt_y); if ((gBoss[i].flag & 8) || gBoss[i].y <= gBoss[i].tgt_y)
gBoss[i].ani_no = 0;
else
gBoss[i].ani_no = 1;
if (gBoss[i].direct == 0) if (gBoss[i].direct == 0)
gBoss[i].rect = rcLeft[gBoss[i].count2]; gBoss[i].rect = rcLeft[gBoss[i].ani_no];
else else
gBoss[i].rect = rcRight[gBoss[i].count2]; gBoss[i].rect = rcRight[gBoss[i].ani_no];
} }
} }
void ActBoss01_5() static void ActBoss01_5()
{ {
if (gBoss[5].act_no == 0) switch (gBoss[5].act_no)
{ {
case 0:
gBoss[5].bits |= npc_solidSoft | npc_ignoreSolid; gBoss[5].bits |= npc_solidSoft | npc_ignoreSolid;
gBoss[5].hit.front = 0x2800; gBoss[5].hit.front = 0x2800;
@ -98,12 +105,11 @@ void ActBoss01_5()
gBoss[5].hit.bottom = 0x2000; gBoss[5].hit.bottom = 0x2000;
gBoss[5].act_no = 1; gBoss[5].act_no = 1;
} // Fallthrough
case 1:
if (gBoss[5].act_no == 1)
{
gBoss[5].x = gBoss[0].x; gBoss[5].x = gBoss[0].x;
gBoss[5].y = gBoss[0].y; gBoss[5].y = gBoss[0].y;
break;
} }
} }
@ -120,8 +126,8 @@ void ActBossChar_Omega()
gBoss[0].view.back = 0x5000; gBoss[0].view.back = 0x5000;
gBoss[0].view.bottom = 0x2000; gBoss[0].view.bottom = 0x2000;
gBoss[0].tgt_x = 0x1B6000; gBoss[0].tgt_x = gBoss[0].x;
gBoss[0].tgt_y = 0x20000; gBoss[0].tgt_y = gBoss[0].y;
gBoss[0].hit_voice = 52; gBoss[0].hit_voice = 52;
@ -145,7 +151,7 @@ void ActBossChar_Omega()
gBoss[1].bits = npc_ignoreSolid; gBoss[1].bits = npc_ignoreSolid;
memcpy(&gBoss[2], &gBoss[1], sizeof(gBoss[2])); gBoss[2] = gBoss[1];
gBoss[1].direct = 0; gBoss[1].direct = 0;
gBoss[2].direct = 2; gBoss[2].direct = 2;
@ -166,10 +172,12 @@ void ActBossChar_Omega()
gBoss[3].bits = npc_ignoreSolid; gBoss[3].bits = npc_ignoreSolid;
gBoss[3].x = gBoss[0].x - 0x2000;
gBoss[3].y = gBoss[0].y; gBoss[3].y = gBoss[0].y;
gBoss[3].direct = 0; gBoss[3].direct = 0;
memcpy(&gBoss[4], &gBoss[3], sizeof(gBoss[4])); gBoss[4] = gBoss[3];
gBoss[4].direct = 2; gBoss[4].direct = 2;
gBoss[3].x = gBoss[0].x + 0x2000; gBoss[3].x = gBoss[0].x + 0x2000;
gBoss[5].cond = 0x80; gBoss[5].cond = 0x80;
@ -184,16 +192,17 @@ void ActBossChar_Omega()
SetQuake(2); SetQuake(2);
gBoss[0].y -= 0x200; gBoss[0].y -= 0x200;
if (!(++gBoss[0].act_wait & 3)) if (!(++gBoss[0].act_wait % 4))
PlaySoundObject(26, 1); PlaySoundObject(26, 1);
if (gBoss[0].act_wait >= 48) if (gBoss[0].act_wait == 48)
{ {
gBoss[0].act_no = 40;
gBoss[0].act_wait = 0; gBoss[0].act_wait = 0;
gBoss[0].act_no = 40;
if (gBoss[0].life > 280)
break;
if (gBoss[0].life <= 280)
{
gBoss[0].act_no = 110; gBoss[0].act_no = 110;
gBoss[0].bits |= npc_shootable; gBoss[0].bits |= npc_shootable;
@ -205,11 +214,10 @@ void ActBossChar_Omega()
gBoss[4].act_no = 3; gBoss[4].act_no = 3;
gBoss[5].hit.top = 0x2000; gBoss[5].hit.top = 0x2000;
} }
}
break; break;
case 40: case 40:
if (++gBoss[0].act_wait >= 48) if (++gBoss[0].act_wait == 48)
{ {
gBoss[0].act_wait = 0; gBoss[0].act_wait = 0;
gBoss[0].act_no = 50; gBoss[0].act_no = 50;
@ -239,7 +247,7 @@ void ActBossChar_Omega()
case 60: //Shoot out of mouth case 60: //Shoot out of mouth
if (++gBoss[0].act_wait > 20 && gBoss[0].act_wait < 80 && !(gBoss[0].act_wait % 3)) if (++gBoss[0].act_wait > 20 && gBoss[0].act_wait < 80 && !(gBoss[0].act_wait % 3))
{ {
if (Random(0, 9) <= 7) if (Random(0, 9) < 8)
SetNpChar(48, gBoss[0].x, gBoss[0].y - 0x2000, Random(-0x100, 0x100), -0x333, 0, NULL, 0x100); SetNpChar(48, gBoss[0].x, gBoss[0].y - 0x2000, Random(-0x100, 0x100), -0x333, 0, NULL, 0x100);
else else
SetNpChar(48, gBoss[0].x, gBoss[0].y - 0x2000, Random(-0x100, 0x100), -0x333, 2, NULL, 0x100); SetNpChar(48, gBoss[0].x, gBoss[0].y - 0x2000, Random(-0x100, 0x100), -0x333, 2, NULL, 0x100);
@ -247,7 +255,7 @@ void ActBossChar_Omega()
PlaySoundObject(39, 1); PlaySoundObject(39, 1);
} }
if (gBoss[0].act_wait >= 200 || CountArmsBullet(6)) if (gBoss[0].act_wait == 200 || CountArmsBullet(6))
{ {
gBoss[0].count1 = 0; gBoss[0].count1 = 0;
gBoss[0].act_no = 70; gBoss[0].act_no = 70;
@ -267,7 +275,7 @@ void ActBossChar_Omega()
if (!gBoss[0].count2) if (!gBoss[0].count2)
{ {
PlaySoundObject(102, 1); PlaySoundObject(102, 0);
PlaySoundObject(12, 1); PlaySoundObject(12, 1);
gBoss[0].act_no = 80; gBoss[0].act_no = 80;
@ -284,7 +292,7 @@ void ActBossChar_Omega()
break; break;
case 80: case 80:
if (++gBoss[0].act_wait >= 48) if (++gBoss[0].act_wait == 48)
{ {
gBoss[0].act_wait = 0; gBoss[0].act_wait = 0;
gBoss[0].act_no = 90; gBoss[0].act_no = 90;
@ -295,10 +303,10 @@ void ActBossChar_Omega()
SetQuake(2); SetQuake(2);
gBoss[0].y += 0x200; gBoss[0].y += 0x200;
if (!(++gBoss[0].act_wait & 3)) if (!(++gBoss[0].act_wait % 4))
PlaySoundObject(26, 1); PlaySoundObject(26, 1);
if (gBoss[0].act_wait >= 48) if (gBoss[0].act_wait == 48)
{ {
gBoss[0].act_wait = 0; gBoss[0].act_wait = 0;
gBoss[0].act_no = 100; gBoss[0].act_no = 100;
@ -306,7 +314,7 @@ void ActBossChar_Omega()
break; break;
case 100: //Move to proper position for coming out of the ground case 100: //Move to proper position for coming out of the ground
if (++gBoss[0].act_wait >= 120) if (++gBoss[0].act_wait == 120)
{ {
gBoss[0].act_wait = 0; gBoss[0].act_wait = 0;
gBoss[0].act_no = 30; gBoss[0].act_no = 30;
@ -333,7 +341,7 @@ void ActBossChar_Omega()
break; break;
case 120: case 120:
if (++gBoss[0].act_wait >= 50 || CountArmsBullet(6)) if (++gBoss[0].act_wait == 50 || CountArmsBullet(6))
{ {
gBoss[0].act_no = 130; gBoss[0].act_no = 130;
PlaySoundObject(102, 1); PlaySoundObject(102, 1);
@ -368,7 +376,7 @@ void ActBossChar_Omega()
gBoss[0].ym = -0x5FF; gBoss[0].ym = -0x5FF;
PlaySoundObject(102, 1); PlaySoundObject(102, 0);
PlaySoundObject(12, 1); PlaySoundObject(12, 1);
PlaySoundObject(25, 1); PlaySoundObject(25, 1);
@ -470,14 +478,6 @@ void ActBossChar_Omega()
gBoss[0].act_wait = 0; gBoss[0].act_wait = 0;
gBoss[0].damage = 0; gBoss[0].damage = 0;
gBoss[5].damage = 0; gBoss[5].damage = 0;
DeleteNpCharCode(48, 1);
for (int i = 0; i < NPC_MAX; i++)
{
if (gNPC[i].cond & 0x80)
{
if (gNPC[i].code_char == 48)
gNPC[i].cond = 0;
}
}
} }
} }

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];
} }
} }

View file

@ -12,6 +12,8 @@
static void ActBossCharT_DragonBody(NPCHAR *npc) static void ActBossCharT_DragonBody(NPCHAR *npc)
{ {
unsigned char deg;
RECT rcLeft[3] = { RECT rcLeft[3] = {
{0, 0, 40, 40}, {0, 0, 40, 40},
{40, 0, 80, 40}, {40, 0, 80, 40},
@ -24,17 +26,16 @@ static void ActBossCharT_DragonBody(NPCHAR *npc)
{80, 40, 120, 80}, {80, 40, 120, 80},
}; };
unsigned char deg;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:
deg = npc->count1 + (npc->pNpc->count1 / 4); deg = ((npc->pNpc->count1 / 4) + npc->count1) % 0x100;
npc->act_no = 10; npc->act_no = 10;
npc->x += npc->pNpc->x + npc->pNpc->tgt_x * GetCos(deg); npc->x += npc->pNpc->x + GetCos(deg) * npc->pNpc->tgt_x;
npc->y += npc->pNpc->y + npc->pNpc->tgt_y * GetSin(deg); npc->y += npc->pNpc->y + GetSin(deg) * npc->pNpc->tgt_y;
// Fallthrough // Fallthrough
case 10: case 10:
if (gMC.x < npc->x) if (npc->x > gMC.x)
npc->direct = 0; npc->direct = 0;
else else
npc->direct = 2; npc->direct = 2;
@ -42,13 +43,13 @@ static void ActBossCharT_DragonBody(NPCHAR *npc)
break; break;
case 100: case 100:
deg = npc->count1 + (npc->pNpc->count1 / 4); deg = ((npc->pNpc->count1 / 4) + npc->count1) % 0x100;
npc->tgt_x = npc->pNpc->x + npc->pNpc->tgt_x * GetCos(deg); npc->tgt_x = npc->pNpc->x + GetCos(deg) * npc->pNpc->tgt_x;
npc->tgt_y = npc->pNpc->y + npc->pNpc->tgt_y * GetSin(deg); npc->tgt_y = npc->pNpc->y + GetSin(deg) * npc->pNpc->tgt_y;
npc->x += (npc->tgt_x - npc->x) / 8; npc->x += (npc->tgt_x - npc->x) / 8;
npc->y += (npc->tgt_y - npc->y) / 8; npc->y += (npc->tgt_y - npc->y) / 8;
if (gMC.x < npc->x) if (npc->x > gMC.x)
npc->direct = 0; npc->direct = 0;
else else
npc->direct = 2; npc->direct = 2;
@ -60,13 +61,13 @@ static void ActBossCharT_DragonBody(NPCHAR *npc)
npc->bits &= ~0x20; npc->bits &= ~0x20;
// Fallthrough // Fallthrough
case 1001: case 1001:
deg = npc->count1 + (npc->pNpc->count1 / 4); deg = ((npc->pNpc->count1 / 4) + npc->count1) % 0x100;
npc->tgt_x = npc->pNpc->x + npc->pNpc->tgt_x * GetCos(deg); npc->tgt_x = npc->pNpc->x + GetCos(deg) * npc->pNpc->tgt_x;
npc->tgt_y = npc->pNpc->y + npc->pNpc->tgt_y * GetSin(deg); npc->tgt_y = npc->pNpc->y + GetSin(deg) * npc->pNpc->tgt_y;
npc->x += (npc->tgt_x - npc->x) / 8; npc->x += (npc->tgt_x - npc->x) / 8;
npc->y += (npc->tgt_y - npc->y) / 8; npc->y += (npc->tgt_y - npc->y) / 8;
if (npc->pNpc->x < npc->x) if (npc->x > npc->pNpc->x)
npc->direct = 0; npc->direct = 0;
else else
npc->direct = 2; npc->direct = 2;
@ -91,6 +92,10 @@ static void ActBossCharT_DragonBody(NPCHAR *npc)
static void ActBossCharT_DragonHead(NPCHAR *npc) static void ActBossCharT_DragonHead(NPCHAR *npc)
{ {
unsigned char deg;
int ym;
int xm;
RECT rcLeft[4] = { RECT rcLeft[4] = {
{0, 80, 40, 112}, {0, 80, 40, 112},
{40, 80, 80, 112}, {40, 80, 80, 112},
@ -171,9 +176,10 @@ static void ActBossCharT_DragonHead(NPCHAR *npc)
case 220: case 220:
if (++npc->act_wait % 8 == 1) if (++npc->act_wait % 8 == 1)
{ {
const unsigned char deg = GetArktan(npc->x - gMC.x, npc->y - gMC.y) + Random(-6, 6); deg = GetArktan(npc->x - gMC.x, npc->y - gMC.y);
const int ym = GetSin(deg); deg += (unsigned char)Random(-6, 6);
const int xm = GetCos(deg); ym = GetSin(deg);
xm = GetCos(deg);
if (npc->direct == 0) if (npc->direct == 0)
SetNpChar(202, npc->x - 0x1000, npc->y, xm, ym, 0, 0, 0x100); SetNpChar(202, npc->x - 0x1000, npc->y, xm, ym, 0, 0, 0x100);
@ -215,9 +221,10 @@ static void ActBossCharT_DragonHead(NPCHAR *npc)
if (npc->act_wait > 20 && npc->act_wait % 32 == 1) if (npc->act_wait > 20 && npc->act_wait % 32 == 1)
{ {
const unsigned char deg = GetArktan(npc->x - gMC.x, npc->y - gMC.y) + Random(-6, 6); deg = GetArktan(npc->x - gMC.x, npc->y - gMC.y);
const int ym = GetSin(deg); deg += (unsigned char)Random(-6, 6);
const int xm = GetCos(deg); ym = GetSin(deg);
xm = GetCos(deg);
if (npc->direct == 0) if (npc->direct == 0)
SetNpChar(202, npc->x - 0x1000, npc->y, xm, ym, 0, 0, 0x100); SetNpChar(202, npc->x - 0x1000, npc->y, xm, ym, 0, 0, 0x100);
@ -252,34 +259,37 @@ static void ActBossCharT_DragonHead(NPCHAR *npc)
void ActBossChar_Twin(void) void ActBossChar_Twin(void)
{ {
switch (gBoss[0].act_no) NPCHAR *npc = gBoss;
switch (npc->act_no)
{ {
case 0: case 0:
gBoss[0].cond = 0x80; npc->cond = 0x80;
gBoss[0].direct = 0; npc->direct = 0;
gBoss[0].act_no = 10; npc->act_no = 10;
gBoss[0].exp = 0; npc->exp = 0;
gBoss[0].x = 0x14000; npc->x = 0x14000;
gBoss[0].y = 0x10000; npc->y = 0x10000;
gBoss[0].view.front = 0x1000; npc->view.front = 0x1000;
gBoss[0].view.top = 0x1000; npc->view.top = 0x1000;
gBoss[0].view.back = 0x10000; npc->view.back = 0x10000;
gBoss[0].view.bottom = 0x1000; npc->view.bottom = 0x1000;
gBoss[0].hit_voice = 54; npc->hit_voice = 54;
gBoss[0].hit.front = 0x1000; npc->hit.front = 0x1000;
gBoss[0].hit.top = 0x1000; npc->hit.top = 0x1000;
gBoss[0].hit.back = 0x1000; npc->hit.back = 0x1000;
gBoss[0].hit.bottom = 0x1000; npc->hit.bottom = 0x1000;
gBoss[0].bits = 8; npc->bits = 8;
gBoss[0].bits |= 0x200; npc->bits |= 0x200;
gBoss[0].size = 3; npc->size = 3;
gBoss[0].damage = 0; npc->damage = 0;
gBoss[0].code_event = 1000; npc->code_event = 1000;
gBoss[0].life = 500; npc->life = 500;
gBoss[0].count2 = Random(700, 1200); npc->count2 = Random(700, 1200);
gBoss[0].tgt_x = 180; npc->tgt_x = 180;
gBoss[0].tgt_y = 61; npc->tgt_y = 61;
gBoss[2].cond = 0x80;
gBoss[2].view.back = 0x2800; gBoss[2].view.back = 0x2800;
gBoss[2].view.front = 0x2800; gBoss[2].view.front = 0x2800;
gBoss[2].view.top = 0x2000; gBoss[2].view.top = 0x2000;
@ -290,7 +300,7 @@ void ActBossChar_Twin(void)
gBoss[2].hit.bottom = 0x1400; gBoss[2].hit.bottom = 0x1400;
gBoss[2].bits = 12; gBoss[2].bits = 12;
gBoss[2].pNpc = &gBoss[3]; gBoss[2].pNpc = &gBoss[3];
gBoss[2].cond = 0x90; gBoss[2].cond |= 0x10;
gBoss[2].damage = 10; gBoss[2].damage = 10;
gBoss[3].cond = 0x80; gBoss[3].cond = 0x80;
@ -303,7 +313,7 @@ void ActBossChar_Twin(void)
gBoss[3].hit.top = 0x400; gBoss[3].hit.top = 0x400;
gBoss[3].hit.bottom = 0x2000; gBoss[3].hit.bottom = 0x2000;
gBoss[3].bits = 8; gBoss[3].bits = 8;
gBoss[3].pNpc = gBoss; gBoss[3].pNpc = npc;
gBoss[3].damage = 10; gBoss[3].damage = 10;
gBoss[4] = gBoss[2]; gBoss[4] = gBoss[2];
@ -314,10 +324,10 @@ void ActBossChar_Twin(void)
break; break;
case 20: case 20:
if (--gBoss[0].tgt_x <= 112) if (--npc->tgt_x <= 112)
{ {
gBoss[0].act_no = 100; npc->act_no = 100;
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[2].act_no = 100; gBoss[2].act_no = 100;
gBoss[4].act_no = 100; gBoss[4].act_no = 100;
gBoss[3].act_no = 100; gBoss[3].act_no = 100;
@ -327,39 +337,39 @@ void ActBossChar_Twin(void)
break; break;
case 100: case 100:
if (++gBoss[0].act_wait < 100) if (++npc->act_wait < 100)
{ {
++gBoss[0].count1; ++npc->count1;
} }
else else
{ {
if (gBoss[0].act_wait < 120) if (npc->act_wait < 120)
{ {
gBoss[0].count1 += 2; npc->count1 += 2;
} }
else else
{ {
if (gBoss[0].act_wait < gBoss[0].count2) if (npc->act_wait < npc->count2)
{ {
gBoss[0].count1 += 4; npc->count1 += 4;
} }
else else
{ {
if (gBoss[0].act_wait < gBoss[0].count2 + 40) if (npc->act_wait < npc->count2 + 40)
{ {
gBoss[0].count1 += 2; npc->count1 += 2;
} }
else else
{ {
if (gBoss[0].act_wait < gBoss[0].count2 + 60) if (npc->act_wait < npc->count2 + 60)
{ {
++gBoss[0].count1; ++npc->count1;
} }
else else
{ {
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].act_no = 110; npc->act_no = 110;
gBoss[0].count2 = Random(400, 700); npc->count2 = Random(400, 700);
break; break;
} }
} }
@ -367,54 +377,54 @@ void ActBossChar_Twin(void)
} }
} }
if (gBoss[0].count1 > 0x3FF) if (npc->count1 > 0x3FF)
gBoss[0].count1 -= 0x400; npc->count1 -= 0x400;
break; break;
case 110: case 110:
if (++gBoss[0].act_wait < 20) if (++npc->act_wait < 20)
{ {
--gBoss[0].count1; --npc->count1;
} }
else else
{ {
if (gBoss[0].act_wait < 60) if (npc->act_wait < 60)
{ {
gBoss[0].count1 -= 2; npc->count1 -= 2;
} }
else else
{ {
if (gBoss[0].act_wait < gBoss[0].count2) if (npc->act_wait < npc->count2)
{ {
gBoss[0].count1 -= 4; npc->count1 -= 4;
} }
else else
{ {
if (gBoss[0].act_wait < gBoss[0].count2 + 40) if (npc->act_wait < npc->count2 + 40)
{ {
gBoss[0].count1 -= 2; npc->count1 -= 2;
} }
else else
{ {
if (gBoss[0].act_wait < gBoss[0].count2 + 60) if (npc->act_wait < npc->count2 + 60)
{ {
--gBoss[0].count1; --npc->count1;
} }
else else
{ {
if (gBoss[0].life < 300) if (npc->life < 300)
{ {
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].act_no = 400; npc->act_no = 400;
gBoss[2].act_no = 400; gBoss[2].act_no = 400;
gBoss[4].act_no = 400; gBoss[4].act_no = 400;
} }
else else
{ {
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].act_no = 100; npc->act_no = 100;
gBoss[0].count2 = Random(400, 700); npc->count2 = Random(400, 700);
} }
break; break;
@ -424,53 +434,53 @@ void ActBossChar_Twin(void)
} }
} }
if (gBoss[0].count1 <= 0) if (npc->count1 <= 0)
gBoss[0].count1 += 0x400; npc->count1 += 0x400;
break; break;
case 400: case 400:
if (++gBoss[0].act_wait > 100) if (++npc->act_wait > 100)
{ {
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].act_no = 401; npc->act_no = 401;
} }
break; break;
case 401: case 401:
if (++gBoss[0].act_wait < 100) if (++npc->act_wait < 100)
{ {
++gBoss[0].count1; ++npc->count1;
} }
else else
{ {
if (gBoss[0].act_wait < 120) if (npc->act_wait < 120)
{ {
gBoss[0].count1 += 2; npc->count1 += 2;
} }
else else
{ {
if (gBoss[0].act_wait < 500) if (npc->act_wait < 500)
{ {
gBoss[0].count1 += 4; npc->count1 += 4;
} }
else else
{ {
if (gBoss[0].act_wait < 540) if (npc->act_wait < 540)
{ {
gBoss[0].count1 += 2; npc->count1 += 2;
} }
else else
{ {
if (gBoss[0].act_wait < 560) if (npc->act_wait < 560)
{ {
++gBoss[0].count1; ++npc->count1;
} }
else else
{ {
gBoss[0].act_no = 100; npc->act_no = 100;
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[2].act_no = 100; gBoss[2].act_no = 100;
gBoss[4].act_no = 100; gBoss[4].act_no = 100;
break; break;
@ -480,48 +490,48 @@ void ActBossChar_Twin(void)
} }
} }
if ( gBoss[0].count1 > 0x3FF ) if ( npc->count1 > 0x3FF )
gBoss[0].count1 -= 0x400; npc->count1 -= 0x400;
break; break;
case 1000: case 1000:
gBoss[0].act_no = 1001; npc->act_no = 1001;
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[2].act_no = 1000; gBoss[2].act_no = 1000;
gBoss[3].act_no = 1000; gBoss[3].act_no = 1000;
gBoss[4].act_no = 1000; gBoss[4].act_no = 1000;
gBoss[5].act_no = 1000; gBoss[5].act_no = 1000;
SetDestroyNpChar(gBoss[0].x, gBoss[0].y, gBoss[0].view.back, 40); SetDestroyNpChar(npc->x, npc->y, npc->view.back, 40);
break; // Fallthrough
case 1001: case 1001:
if (++gBoss[0].act_wait > 100) if (++npc->act_wait > 100)
gBoss[0].act_no = 1010; npc->act_no = 1010;
SetNpChar(4, gBoss[0].x + (Random(-0x80, 0x80) * 0x200), gBoss[0].y + (Random(-70, 70) * 0x200), 0, 0, 0, 0, 0x100); SetNpChar(4, npc->x + (Random(-0x80, 0x80) * 0x200), npc->y + (Random(-70, 70) * 0x200), 0, 0, 0, 0, 0x100);
break; break;
case 1010: case 1010:
gBoss[0].count1 += 4; npc->count1 += 4;
if (gBoss[0].count1 > 0x3FF) if (npc->count1 > 0x3FF)
gBoss[0].count1 -= 0x400; npc->count1 -= 0x400;
if (gBoss[0].tgt_x > 8) if (npc->tgt_x > 8)
--gBoss[0].tgt_x; --npc->tgt_x;
if (gBoss[0].tgt_y > 0) if (npc->tgt_y > 0)
--gBoss[0].tgt_y; --npc->tgt_y;
if (gBoss[0].tgt_x < -8) if (npc->tgt_x < -8)
++gBoss[0].tgt_x; ++npc->tgt_x;
if (gBoss[0].tgt_y < 0) if (npc->tgt_y < 0)
++gBoss[0].tgt_y; ++npc->tgt_y;
if (gBoss[0].tgt_y == 0) if (npc->tgt_y == 0)
{ {
gBoss[0].act_no = 1020; npc->act_no = 1020;
gBoss[0].act_wait = 0; npc->act_wait = 0;
SetFlash(gBoss[0].x, gBoss[0].y, 1); SetFlash(gBoss[0].x, gBoss[0].y, 1);
PlaySoundObject(35, 1); PlaySoundObject(35, 1);
} }
@ -550,5 +560,5 @@ void ActBossChar_Twin(void)
ActBossCharT_DragonBody(&gBoss[5]); ActBossCharT_DragonBody(&gBoss[5]);
RECT rc = {0, 0, 0, 0}; RECT rc = {0, 0, 0, 0};
gBoss[0].rect = rc; npc->rect = rc;
} }

View file

@ -186,16 +186,16 @@ static void ActBossChar03_01(NPCHAR *npc)
if ((npc->act_no == 103 || npc->act_no == 203) && npc->act_wait % 4 == 1) if ((npc->act_no == 103 || npc->act_no == 203) && npc->act_wait % 4 == 1)
PlaySoundObject(111, 1); PlaySoundObject(111, 1);
if (npc->act_no < 100 || gMC.y >= npc->y + 0x800 || gMC.y <= npc->y - 0x800) if (npc->act_no >= 100 && gMC.y < npc->y + 0x800 && gMC.y > npc->y - 0x800)
{
npc->damage = 0;
npc->bits &= ~0x80;
}
else
{ {
npc->damage = 10; npc->damage = 10;
npc->bits |= 0x80; npc->bits |= 0x80;
} }
else
{
npc->damage = 0;
npc->bits &= ~0x80;
}
if (npc->xm > 0x400) if (npc->xm > 0x400)
npc->xm = 0x400; npc->xm = 0x400;
@ -212,6 +212,8 @@ static void ActBossChar03_01(NPCHAR *npc)
static void ActBossChar03_02(NPCHAR *npc) static void ActBossChar03_02(NPCHAR *npc)
{ {
int direct;
RECT rect[4] = { RECT rect[4] = {
{0, 128, 72, 160}, {0, 128, 72, 160},
{72, 128, 144, 160}, {72, 128, 144, 160},
@ -219,12 +221,15 @@ static void ActBossChar03_02(NPCHAR *npc)
{72, 160, 144, 192}, {72, 160, 144, 192},
}; };
int x;
int y;
switch (npc->act_no) switch (npc->act_no)
{ {
case 10: case 10:
npc->act_no = 11; npc->act_no = 11;
npc->act_wait = 30 * npc->ani_no + 30; npc->act_wait = 30 * npc->ani_no + 30;
break; // Fallthrough
case 11: case 11:
if (npc->act_wait) if (npc->act_wait)
@ -233,10 +238,6 @@ static void ActBossChar03_02(NPCHAR *npc)
} }
else else
{ {
int x;
int y;
int direct;
switch (npc->ani_no) switch (npc->ani_no)
{ {
case 0: case 0:
@ -348,19 +349,23 @@ static void ActBossChar03_03(NPCHAR *npc)
if (npc->direct == 0) if (npc->direct == 0)
{ {
npc->rect = rcLeft; npc->rect = rcLeft;
npc->x = gBoss[0].x - npc->tgt_x - 0x3000; npc->x = gBoss[0].x - 0x3000 - npc->tgt_x;
npc->y = gBoss[0].y; npc->y = gBoss[0].y;
} }
else else
{ {
npc->rect = rcRight; npc->rect = rcRight;
npc->x = gBoss[0].x + npc->tgt_x + 0x3000; npc->x = gBoss[0].x + 0x3000 + npc->tgt_x;
npc->y = gBoss[0].y; npc->y = gBoss[0].y;
} }
} }
static void ActBossChar03_04(NPCHAR *npc) static void ActBossChar03_04(NPCHAR *npc)
{ {
unsigned char deg;
int ym;
int xm;
RECT rect[8] = { RECT rect[8] = {
{0, 192, 16, 208}, {0, 192, 16, 208},
{16, 192, 32, 208}, {16, 192, 32, 208},
@ -385,7 +390,10 @@ static void ActBossChar03_04(NPCHAR *npc)
npc->bits |= 0x20; npc->bits |= 0x20;
// Fallthrough // Fallthrough
case 11: case 11:
npc->ani_no = npc->act_wait < 16 && npc->act_wait / 2 % 2; if (npc->act_wait < 16 && npc->act_wait / 2 % 2)
npc->ani_no = 1;
else
npc->ani_no = 0;
if (npc->act_wait) if (npc->act_wait)
{ {
@ -393,9 +401,10 @@ static void ActBossChar03_04(NPCHAR *npc)
} }
else else
{ {
const unsigned char deg = GetArktan(npc->x - gMC.x, npc->y - gMC.y) + Random(-2, 2); deg = GetArktan(npc->x - gMC.x, npc->y - gMC.y);
const int ym = 3 * GetSin(deg); deg += (unsigned char)Random(-2, 2);
const int xm = 3 * GetCos(deg); ym = 3 * GetSin(deg);
xm = 3 * GetCos(deg);
SetNpChar(156, npc->x, npc->y, xm, ym, 0, 0, 0x100); SetNpChar(156, npc->x, npc->y, xm, ym, 0, 0, 0x100);
PlaySoundObject(39, 1); PlaySoundObject(39, 1);
npc->act_wait = 40; npc->act_wait = 40;
@ -429,6 +438,8 @@ static void ActBossChar03_04(NPCHAR *npc)
static void ActBossChar03_face(NPCHAR *npc) static void ActBossChar03_face(NPCHAR *npc)
{ {
static unsigned char flash;
RECT rect[3] = { RECT rect[3] = {
{216, 0, 320, 48}, {216, 0, 320, 48},
{216, 48, 320, 96}, {216, 48, 320, 96},
@ -450,9 +461,7 @@ static void ActBossChar03_face(NPCHAR *npc)
case 11: case 11:
if (gBoss[0].shock) if (gBoss[0].shock)
{ {
static unsigned char flash; if (flash++ / 2 % 2)
if ((flash++ >> 1) & 1)
npc->ani_no = 1; npc->ani_no = 1;
else else
npc->ani_no = 0; npc->ani_no = 0;
@ -476,28 +485,32 @@ static void ActBossChar03_face(NPCHAR *npc)
void ActBossChar_MonstX(void) void ActBossChar_MonstX(void)
{ {
switch (gBoss[0].act_no) int i;
NPCHAR *npc = gBoss;
switch (npc->act_no)
{ {
case 0: case 0:
gBoss[0].life = 1; npc->life = 1;
gBoss[0].x = -0x28000; npc->x = -0x28000;
break; break;
case 1: case 1:
gBoss[0].life = 700; npc->life = 700;
gBoss[0].exp = 1; npc->exp = 1;
gBoss[0].act_no = 1; npc->act_no = 1;
gBoss[0].x = 0x100000; npc->x = 0x100000;
gBoss[0].y = 102400; npc->y = 102400;
gBoss[0].hit_voice = 54; npc->hit_voice = 54;
gBoss[0].hit.front = 0x3000; npc->hit.front = 0x3000;
gBoss[0].hit.top = 0x3000; npc->hit.top = 0x3000;
gBoss[0].hit.back = 0x3000; npc->hit.back = 0x3000;
gBoss[0].hit.bottom = 0x3000; npc->hit.bottom = 0x3000;
gBoss[0].bits = 0x8208; npc->bits = 0x8208;
gBoss[0].size = 3; npc->size = 3;
gBoss[0].code_event = 1000; npc->code_event = 1000;
gBoss[0].ani_no = 0; npc->ani_no = 0;
gBoss[1].cond = 0x80; gBoss[1].cond = 0x80;
gBoss[1].size = 3; gBoss[1].size = 3;
gBoss[1].direct = 0; gBoss[1].direct = 0;
@ -510,6 +523,7 @@ void ActBossChar_MonstX(void)
gBoss[2].direct = 2; gBoss[2].direct = 2;
gBoss[3].cond = 0x80; gBoss[3].cond = 0x80;
gBoss[3].life = 60; gBoss[3].life = 60;
gBoss[3].size = 3; // Redundant: this get overwriten a few lines later
gBoss[3].hit_voice = 54; gBoss[3].hit_voice = 54;
gBoss[3].destroy_voice = 71; gBoss[3].destroy_voice = 71;
gBoss[3].size = 2; gBoss[3].size = 2;
@ -601,186 +615,186 @@ void ActBossChar_MonstX(void)
gBoss[16].count1 = 12; gBoss[16].count1 = 12;
gBoss[16].ani_no = 3; gBoss[16].ani_no = 3;
gBoss[16].bits = 8; gBoss[16].bits = 8;
gBoss[0].act_no = 2; npc->act_no = 2;
break; break;
case 10: case 10:
gBoss[0].act_no = 11; npc->act_no = 11;
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].count1 = 0; npc->count1 = 0;
// Fallthrough // Fallthrough
case 11: case 11:
if (++gBoss[0].act_wait > 100) if (++npc->act_wait > 100)
{ {
gBoss[0].act_wait = 0; npc->act_wait = 0;
if (gMC.x < gBoss[0].x) if (npc->x > gMC.x)
gBoss[0].act_no = 100; npc->act_no = 100;
else else
gBoss[0].act_no = 200; npc->act_no = 200;
} }
break; break;
case 100: case 100:
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].act_no = 101; npc->act_no = 101;
++gBoss[0].count1; ++npc->count1;
// Fallthrough // Fallthrough
case 101: case 101:
if (++gBoss[0].act_wait == 4) if (++npc->act_wait == 4)
gBoss[9].act_no = 100; gBoss[9].act_no = 100;
if (gBoss[0].act_wait == 8) if (npc->act_wait == 8)
gBoss[10].act_no = 100; gBoss[10].act_no = 100;
if (gBoss[0].act_wait == 10) if (npc->act_wait == 10)
gBoss[11].act_no = 100; gBoss[11].act_no = 100;
if (gBoss[0].act_wait == 12) if (npc->act_wait == 12)
gBoss[12].act_no = 100; gBoss[12].act_no = 100;
if (gBoss[0].act_wait > 120 && gBoss[0].count1 > 2) if (npc->act_wait > 120 && npc->count1 > 2)
gBoss[0].act_no = 300; npc->act_no = 300;
if (gBoss[0].act_wait > 121 && gMC.x > gBoss[0].x) if (npc->act_wait > 121 && gMC.x > npc->x)
gBoss[0].act_no = 200; npc->act_no = 200;
break; break;
case 200: case 200:
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].act_no = 201; npc->act_no = 201;
++gBoss[0].count1; ++npc->count1;
// Fallthrough // Fallthrough
case 201: case 201:
if (++gBoss[0].act_wait == 4) if (++npc->act_wait == 4)
gBoss[9].act_no = 200; gBoss[9].act_no = 200;
if (gBoss[0].act_wait == 8) if (npc->act_wait == 8)
gBoss[10].act_no = 200; gBoss[10].act_no = 200;
if (gBoss[0].act_wait == 10) if (npc->act_wait == 10)
gBoss[11].act_no = 200; gBoss[11].act_no = 200;
if (gBoss[0].act_wait == 12) if (npc->act_wait == 12)
gBoss[12].act_no = 200; gBoss[12].act_no = 200;
if (gBoss[0].act_wait > 120 && gBoss[0].count1 > 2) if (npc->act_wait > 120 && npc->count1 > 2)
gBoss[0].act_no = 400; npc->act_no = 400;
if (gBoss[0].act_wait > 121 && gMC.x < gBoss[0].x) if (npc->act_wait > 121 && gMC.x < npc->x)
gBoss[0].act_no = 100; npc->act_no = 100;
break; break;
case 300: case 300:
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].act_no = 301; npc->act_no = 301;
// Fallthrough // Fallthrough
case 301: case 301:
if (++gBoss[0].act_wait == 4) if (++npc->act_wait == 4)
gBoss[9].act_no = 300; gBoss[9].act_no = 300;
if (gBoss[0].act_wait == 8) if (npc->act_wait == 8)
gBoss[10].act_no = 300; gBoss[10].act_no = 300;
if (gBoss[0].act_wait == 10) if (npc->act_wait == 10)
gBoss[11].act_no = 300; gBoss[11].act_no = 300;
if (gBoss[0].act_wait == 12) if (npc->act_wait == 12)
gBoss[12].act_no = 300; gBoss[12].act_no = 300;
if (gBoss[0].act_wait > 50) if (npc->act_wait > 50)
{ {
if (gBoss[3].cond || gBoss[4].cond || gBoss[5].cond || gBoss[6].cond) if (gBoss[3].cond == 0 && gBoss[4].cond == 0 && gBoss[5].cond == 0 && gBoss[6].cond == 0)
gBoss[0].act_no = 500; npc->act_no = 600;
else else
gBoss[0].act_no = 600; npc->act_no = 500;
} }
break; break;
case 400: case 400:
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].act_no = 401; npc->act_no = 401;
// Fallthrough // Fallthrough
case 401: case 401:
if (++gBoss[0].act_wait == 4) if (++npc->act_wait == 4)
gBoss[9].act_no = 400; gBoss[9].act_no = 400;
if (gBoss[0].act_wait == 8) if (npc->act_wait == 8)
gBoss[10].act_no = 400; gBoss[10].act_no = 400;
if (gBoss[0].act_wait == 10) if (npc->act_wait == 10)
gBoss[11].act_no = 400; gBoss[11].act_no = 400;
if (gBoss[0].act_wait == 12) if (npc->act_wait == 12)
gBoss[12].act_no = 400; gBoss[12].act_no = 400;
if (gBoss[0].act_wait > 50) if (npc->act_wait > 50)
{ {
if (gBoss[3].cond || gBoss[4].cond || gBoss[5].cond || gBoss[6].cond) if (gBoss[3].cond == 0 && gBoss[4].cond == 0 && gBoss[5].cond == 0 && gBoss[6].cond == 0)
gBoss[0].act_no = 500; npc->act_no = 600;
else else
gBoss[0].act_no = 600; npc->act_no = 500;
} }
break; break;
case 500: case 500:
gBoss[0].act_no = 501; npc->act_no = 501;
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[1].act_no = 10; gBoss[1].act_no = 10;
gBoss[2].act_no = 10; gBoss[2].act_no = 10;
// Fallthrough // Fallthrough
case 501: case 501:
if (++gBoss[0].act_wait > 300) if (++npc->act_wait > 300)
{ {
gBoss[0].act_no = 502; npc->act_no = 502;
gBoss[0].act_wait = 0; npc->act_wait = 0;
} }
if (gBoss[3].cond == 0 && gBoss[4].cond == 0 && gBoss[5].cond == 0 && gBoss[6].cond == 0) if (gBoss[3].cond == 0 && gBoss[4].cond == 0 && gBoss[5].cond == 0 && gBoss[6].cond == 0)
{ {
gBoss[0].act_no = 502; npc->act_no = 502;
gBoss[0].act_wait = 0; npc->act_wait = 0;
} }
break; break;
case 502: case 502:
gBoss[0].act_no = 503; npc->act_no = 503;
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].count1 = 0; npc->count1 = 0;
gBoss[1].act_no = 20; gBoss[1].act_no = 20;
gBoss[2].act_no = 20; gBoss[2].act_no = 20;
// Fallthrough // Fallthrough
case 503: case 503:
if (++gBoss[0].act_wait > 50) if (++npc->act_wait > 50)
{ {
if (gMC.x < gBoss[0].x) if (npc->x > gMC.x)
gBoss[0].act_no = 100; npc->act_no = 100;
else else
gBoss[0].act_no = 200; npc->act_no = 200;
} }
break; break;
case 600: case 600:
gBoss[0].act_no = 601; npc->act_no = 601;
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].count2 = gBoss[0].life; npc->count2 = npc->life;
gBoss[1].act_no = 30; gBoss[1].act_no = 30;
gBoss[2].act_no = 30; gBoss[2].act_no = 30;
// Fallthrough // Fallthrough
case 601: case 601:
++gBoss[0].act_wait; ++npc->act_wait;
if (gBoss[0].life < gBoss[0].count2 - 200 || gBoss[0].act_wait > 300) if (npc->life < npc->count2 - 200 || npc->act_wait > 300)
{ {
gBoss[0].act_no = 602; npc->act_no = 602;
gBoss[0].act_wait = 0; npc->act_wait = 0;
} }
break; break;
case 602: case 602:
gBoss[0].act_no = 603; npc->act_no = 603;
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].count1 = 0; npc->count1 = 0;
gBoss[1].act_no = 40; gBoss[1].act_no = 40;
gBoss[2].act_no = 40; gBoss[2].act_no = 40;
break; // Fallthrough
case 603: case 603:
if (++gBoss[0].act_wait > 50) if (++npc->act_wait > 50)
{ {
if (gMC.x < gBoss[0].x) if (npc->x > gMC.x)
gBoss[0].act_no = 100; npc->act_no = 100;
else else
gBoss[0].act_no = 200; npc->act_no = 200;
} }
break; break;
@ -788,16 +802,16 @@ void ActBossChar_MonstX(void)
case 1000: case 1000:
SetQuake(2); SetQuake(2);
if (++gBoss[0].act_wait % 8 == 0) if (++npc->act_wait % 8 == 0)
PlaySoundObject(52, 1); PlaySoundObject(52, 1);
SetDestroyNpChar(gBoss[0].x + (Random(-0x48, 0x48) * 0x200), gBoss[0].y + (Random(-0x40, 0x40) * 0x200), 1, 1); SetDestroyNpChar(npc->x + (Random(-0x48, 0x48) * 0x200), npc->y + (Random(-0x40, 0x40) * 0x200), 1, 1);
if (gBoss[0].act_wait > 100) if (npc->act_wait > 100)
{ {
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].act_no = 1001; npc->act_no = 1001;
SetFlash(gBoss[0].x, gBoss[0].y, 1); SetFlash(npc->x, npc->y, 1);
PlaySoundObject(35, 1); PlaySoundObject(35, 1);
} }
@ -806,13 +820,13 @@ void ActBossChar_MonstX(void)
case 1001: case 1001:
SetQuake(40); SetQuake(40);
if (++gBoss[0].act_wait > 50) if (++npc->act_wait > 50)
{ {
for (int i = 0; i < 20; ++i) for (i = 0; i < 20; ++i)
gBoss[i].cond = 0; gBoss[i].cond = 0;
DeleteNpCharCode(158, 1); DeleteNpCharCode(158, 1);
SetNpChar(159, gBoss[0].x, gBoss[0].y - 0x3000, 0, 0, 0, 0, 0); SetNpChar(159, npc->x, npc->y - 0x3000, 0, 0, 0, 0, 0);
} }
break; break;
@ -822,7 +836,7 @@ void ActBossChar_MonstX(void)
ActBossChar03_01(&gBoss[10]); ActBossChar03_01(&gBoss[10]);
ActBossChar03_01(&gBoss[11]); ActBossChar03_01(&gBoss[11]);
ActBossChar03_01(&gBoss[12]); ActBossChar03_01(&gBoss[12]);
gBoss[0].x += ((gBoss[11].x + gBoss[10].x + gBoss[9].x + gBoss[12].x) / 4 - gBoss[0].x) / 16; npc->x += ((gBoss[11].x + gBoss[10].x + gBoss[9].x + gBoss[12].x) / 4 - npc->x) / 16;
ActBossChar03_face(&gBoss[7]); ActBossChar03_face(&gBoss[7]);
ActBossChar03_02(&gBoss[13]); ActBossChar03_02(&gBoss[13]);
ActBossChar03_02(&gBoss[14]); ActBossChar03_02(&gBoss[14]);
@ -840,11 +854,11 @@ void ActBossChar_MonstX(void)
if (gBoss[6].cond) if (gBoss[6].cond)
ActBossChar03_04(&gBoss[6]); ActBossChar03_04(&gBoss[6]);
if (gBoss[0].life == 0 && gBoss[0].act_no < 1000) if (npc->life == 0 && npc->act_no < 1000)
{ {
gBoss[0].act_no = 1000; npc->act_no = 1000;
gBoss[0].act_wait = 0; npc->act_wait = 0;
gBoss[0].shock = 0x96; npc->shock = 0x96;
gBoss[9].act_no = 300; gBoss[9].act_no = 300;
gBoss[10].act_no = 300; gBoss[10].act_no = 300;
gBoss[11].act_no = 300; gBoss[11].act_no = 300;

View file

@ -5,7 +5,7 @@
#include "WindowsWrapper.h" #include "WindowsWrapper.h"
unsigned char gFlagNPC[1000]; unsigned char gFlagNPC[1000];
unsigned char gSkipFlag[0x40]; unsigned char gSkipFlag[8];
//Flag inits //Flag inits
void InitFlags() void InitFlags()

View file

@ -3,7 +3,7 @@
#include "WindowsWrapper.h" #include "WindowsWrapper.h"
extern unsigned char gFlagNPC[1000]; extern unsigned char gFlagNPC[1000];
extern unsigned char gSkipFlag[0x40]; extern unsigned char gSkipFlag[8];
void InitFlags(); void InitFlags();
void InitSkipFlags(); void InitSkipFlags();

View file

@ -5,47 +5,105 @@
#include "CommonDefines.h" #include "CommonDefines.h"
#include "Draw.h" #include "Draw.h"
#include "WindowsWrapper.h"
MAP_NAME gMapName; MAP_NAME gMapName;
RECT rc = { 0, 0, 160, 12 }; RECT rc = { 0, 0, 160, 12 };
void ReadyMapName(const char *str) void ReadyMapName(const char *str)
{ {
int a;
//Handle "Studio Pixel presents" text in the intro
unsigned char presentText[24] = {
#ifdef JAPANESE
// "ŠJ”­ŽºPixel presents"
0x8A-1, // ŠJ
0x4A-1,
0x94-1, // ”­
0xAD-1,
0x8E-1, // Žº
0xBA-1,
'P'-1,
'i'-1,
'x'-1,
'e'-1,
'l'-1,
' '-1,
'p'-1,
'r'-1,
'e'-1,
's'-1,
'e'-1,
'n'-1,
't'-1,
's'-1,
#else
// " Studio Pixel presents"
' '-1,
' '-1,
'S'-1,
't'-1,
'u'-1,
'd'-1,
'i'-1,
'o'-1,
' '-1,
'P'-1,
'i'-1,
'x'-1,
'e'-1,
'l'-1,
' '-1,
'p'-1,
'r'-1,
'e'-1,
's'-1,
'e'-1,
'n'-1,
't'-1,
's'-1,
#endif
0xFF
};
//Reset map name flags //Reset map name flags
gMapName.flag = 0; gMapName.flag = 0;
gMapName.wait = 0; gMapName.wait = 0;
//Handle "Studio Pixel presents" text in the intro
#ifdef JAPANESE
char presentText[24] = "ŠJ”­ŽºPixel presents";
#else
char presentText[24] = " Studio Pixel presents";
#endif
if (!strcmp(str, "u")) if (!strcmp(str, "u"))
{ {
/*for (i = 0; i < strlen(presentText); i++) //No need for this, we aren't encrypting the text for (a = 0; a < (int)sizeof(presentText); ++a)
++studio_pixel_presents_string[i];*/ presentText[a] = presentText[a] + 1;
str = presentText;
str = (char*)presentText;
} }
//Copy map's name to the MapName //Copy map's name to the MapName
strcpy(gMapName.name, str); strcpy(gMapName.name, str);
//Draw the text to the surface //Draw the text to the surface
int len = (int)strlen(gMapName.name); a = (int)strlen(gMapName.name);
CortBox2(&rc, 0, SURFACE_ID_ROOM_NAME); CortBox2(&rc, 0, SURFACE_ID_ROOM_NAME);
PutText2((-6 * len + 160) / 2 + 6, 1, gMapName.name, RGB(0x11, 0x00, 0x22), SURFACE_ID_ROOM_NAME); PutText2((160 - 6 * a) / 2 + 6, 1, gMapName.name, RGB(0x11, 0x00, 0x22), SURFACE_ID_ROOM_NAME);
PutText2((-6 * len + 160) / 2 + 6, 0, gMapName.name, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_ROOM_NAME); PutText2((160 - 6 * a) / 2 + 6, 0, gMapName.name, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_ROOM_NAME);
} }
void PutMapName(bool bMini) void PutMapName(BOOL bMini)
{ {
// 'unused_rect' isn't the original name. The Linux port optimised this out, so there's no name for it.
RECT unused_rect = {0, 0, 160, 16};
if (bMini) if (bMini)
{ {
//Map system //Map system
RECT rcBack = {0, 7, WINDOW_WIDTH, 24}; RECT rcBack;
rcBack.left = 0;
rcBack.right = WINDOW_WIDTH;
rcBack.top = 7;
rcBack.bottom = 24;
CortBox(&rcBack, 0x000000); CortBox(&rcBack, 0x000000);
PutBitmap3(&grcGame, (WINDOW_WIDTH - 172) / 2, 10, &rc, SURFACE_ID_ROOM_NAME); PutBitmap3(&grcGame, (WINDOW_WIDTH - 172) / 2, 10, &rc, SURFACE_ID_ROOM_NAME);
} }
@ -69,6 +127,6 @@ void RestoreMapName()
int len = (int)strlen(gMapName.name); int len = (int)strlen(gMapName.name);
CortBox2(&rc, 0, SURFACE_ID_ROOM_NAME); CortBox2(&rc, 0, SURFACE_ID_ROOM_NAME);
PutText2((-6 * len + 160) / 2 + 6, 1, gMapName.name, RGB(0x11, 0x00, 0x22), SURFACE_ID_ROOM_NAME); PutText2((160 - 6 * len) / 2 + 6, 1, gMapName.name, RGB(0x11, 0x00, 0x22), SURFACE_ID_ROOM_NAME);
PutText2((-6 * len + 160) / 2 + 6, 0, gMapName.name, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_ROOM_NAME); PutText2((160 - 6 * len) / 2 + 6, 0, gMapName.name, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_ROOM_NAME);
} }

View file

@ -1,5 +1,7 @@
#pragma once #pragma once
#include "WindowsWrapper.h"
struct MAP_NAME struct MAP_NAME
{ {
int flag; int flag;
@ -8,6 +10,6 @@ struct MAP_NAME
}; };
void ReadyMapName(const char *str); void ReadyMapName(const char *str);
void PutMapName(bool bMini); void PutMapName(BOOL bMini);
void StartMapName(); void StartMapName();
void RestoreMapName(); void RestoreMapName();

View file

@ -61,14 +61,26 @@ void MakeWaveTables(void)
BOOL MakePixelWaveData(const PIXTONEPARAMETER *ptp, unsigned char *pData) BOOL MakePixelWaveData(const PIXTONEPARAMETER *ptp, unsigned char *pData)
{ {
int i;
double dEnvelope;
double dPitch;
double dMain;
double dVolume;
double d1;
double d2;
double d3;
int a;
int b;
int c;
int d;
signed char envelopeTable[0x100];
// The Linux port added a cute optimisation here, where MakeWaveTables is only called once during the game's execution // The Linux port added a cute optimisation here, where MakeWaveTables is only called once during the game's execution
MakeWaveTables(); MakeWaveTables();
signed char envelopeTable[0x100]; memset(envelopeTable, 0, sizeof(envelopeTable));
memset(envelopeTable, 0, 0x100);
int i = 0; i = 0;
double dEnvelope;
dEnvelope = ptp->initial; dEnvelope = ptp->initial;
while (i < ptp->pointAx) while (i < ptp->pointAx)
@ -102,13 +114,9 @@ BOOL MakePixelWaveData(const PIXTONEPARAMETER *ptp, unsigned char *pData)
++i; ++i;
} }
double dPitch = ptp->oPitch.offset; dPitch = ptp->oPitch.offset;
double dMain = ptp->oMain.offset; dMain = ptp->oMain.offset;
double dVolume = ptp->oVolume.offset; dVolume = ptp->oVolume.offset;
double d1;
double d2;
double d3;
if (ptp->oMain.num == 0.0) if (ptp->oMain.num == 0.0)
d1 = 0.0; d1 = 0.0;
@ -127,10 +135,10 @@ BOOL MakePixelWaveData(const PIXTONEPARAMETER *ptp, unsigned char *pData)
for (i = 0; i < ptp->size; ++i) for (i = 0; i < ptp->size; ++i)
{ {
const int a = (int)dMain % 256; a = (int)dMain % 256;
const int b = (int)dPitch % 256; b = (int)dPitch % 256;
const int c = (int)dVolume % 256; c = (int)dVolume % 256;
const int d = (int)((double)(i * 0x100) / ptp->size); d = (int)((double)(i * 0x100) / ptp->size);
pData[i] = gWaveModelTable[ptp->oMain.model][a] pData[i] = gWaveModelTable[ptp->oMain.model][a]
* ptp->oMain.top * ptp->oMain.top
/ 64 / 64

View file

@ -63,40 +63,44 @@ void ActStar()
{ {
if (i) if (i)
{ {
if (star[i - 1].x >= star[i].x) if (star[i - 1].x < star[i].x)
star[i].xm += 0x80;
else
star[i].xm -= 0x80; star[i].xm -= 0x80;
if (star[i - 1].y >= star[i].y)
star[i].ym += 0xAA;
else else
star[i].xm += 0x80;
if (star[i - 1].y < star[i].y)
star[i].ym -= 0xAA; star[i].ym -= 0xAA;
else
star[i].ym += 0xAA;
} }
else else
{ {
if (gMC.x >= star[0].x) if (gMC.x < star[i].x)
star[0].xm += 0x80; star[i].xm -= 0x80;
else else
star[0].xm -= 0x80; star[i].xm += 0x80;
if (gMC.y >= star[0].y)
star[0].ym += 0xAA; if (gMC.y < star[i].y)
star[i].ym -= 0xAA;
else else
star[0].ym -= 0xAA; star[i].ym += 0xAA;
} }
if (star[i].xm > 0xA00) if (star[i].xm > 0xA00)
star[i].xm = 0xA00; star[i].xm = 0xA00;
if (star[i].xm < -0xA00) if (star[i].xm < -0xA00)
star[i].xm = -0xA00; star[i].xm = -0xA00;
if (star[i].ym > 0xA00) if (star[i].ym > 0xA00)
star[i].ym = 0xA00; star[i].ym = 0xA00;
if (star[i].ym < -0xA00) if (star[i].ym < -0xA00)
star[i].ym = -0xA00; star[i].ym = -0xA00;
if (star[i].xm > 0xA00) if (star[i].xm > 0xA00)
star[i].xm = 0xA00; star[i].xm = 0xA00;
if (star[i].xm < -0xA00) if (star[i].xm < -0xA00)
star[i].xm = -0xA00; star[i].xm = -0xA00;
if (star[i].ym > 0xA00) if (star[i].ym > 0xA00)
star[i].ym = 0xA00; star[i].ym = 0xA00;
if (star[i].ym < -0xA00) if (star[i].ym < -0xA00)
@ -105,7 +109,7 @@ void ActStar()
star[i].x += star[i].xm; star[i].x += star[i].xm;
star[i].y += star[i].ym; star[i].y += star[i].ym;
if (gMC.star > i && (gMC.equip & 0x80) && (g_GameFlags & 2) && a == i) if (i < gMC.star && (gMC.equip & 0x80) && (g_GameFlags & 2) && a == i)
SetBullet(45, star[a].x, star[a].y, 0); SetBullet(45, star[a].x, star[a].y, 0);
} }
} }
@ -118,12 +122,15 @@ void PutStar(int fx, int fy)
{192, 16, 200, 24}, {192, 16, 200, 24},
}; };
if (!(gMC.cond & 2) && (gMC.equip & 0x80)) if (gMC.cond & 2)
{ return;
if ((gMC.equip & 0x80) == 0)
return;
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
if (gMC.star > i) if (i < gMC.star)
PutBitmap3(&grcGame, star[i].x / 0x200 - fx / 0x200 - 4, star[i].y / 0x200 - fy / 0x200 - 4, &rc[i], SURFACE_ID_MY_CHAR); PutBitmap3(&grcGame, star[i].x / 0x200 - fx / 0x200 - 4, star[i].y / 0x200 - fy / 0x200 - 4, &rc[i], SURFACE_ID_MY_CHAR);
} }
}
} }

View file

@ -9,6 +9,8 @@ int16_t gTan[0x21];
void InitTriangleTable() void InitTriangleTable()
{ {
int i; int i;
float a;
float b;
//Sine //Sine
for (i = 0; i < 0x100; ++i) for (i = 0; i < 0x100; ++i)
@ -19,9 +21,9 @@ void InitTriangleTable()
//Tangent //Tangent
for (i = 0; i < 0x21; ++i) for (i = 0; i < 0x21; ++i)
{ {
float a = (float)(i * 6.2831855 / 256.0); a = (float)(i * 6.2831855f / 256.0f);
float b = sinf(a) / cosf(a); b = sinf(a) / cosf(a);
gTan[i] = (int16_t)(b * 8192.0); gTan[i] = (int16_t)(b * 8192.0f);
} }
} }
@ -63,7 +65,7 @@ uint8_t GetArktan(int x, int y)
} }
else else
{ {
if (-y < x) if (x > -y)
{ {
k = (-y * 0x2000) / x; k = (-y * 0x2000) / x;
while (k > gTan[a]) while (k > gTan[a])