Added the NPCs for the first room of the Labyrinth
This commit is contained in:
parent
34427c242a
commit
e1d8d30d3c
3 changed files with 338 additions and 4 deletions
|
@ -149,7 +149,9 @@ void ActNpc143(NPCHAR *npc);
|
|||
void ActNpc144(NPCHAR *npc);
|
||||
void ActNpc145(NPCHAR *npc);
|
||||
void ActNpc146(NPCHAR *npc);
|
||||
|
||||
void ActNpc147(NPCHAR *npc);
|
||||
void ActNpc148(NPCHAR *npc);
|
||||
void ActNpc149(NPCHAR *npc);
|
||||
void ActNpc150(NPCHAR *npc);
|
||||
void ActNpc151(NPCHAR *npc);
|
||||
|
||||
|
|
|
@ -746,6 +746,338 @@ void ActNpc146(NPCHAR *npc)
|
|||
npc->rect = rect[npc->ani_no];
|
||||
}
|
||||
|
||||
//Critter (purple)
|
||||
void ActNpc147(NPCHAR *npc)
|
||||
{
|
||||
RECT rcLeft[6];
|
||||
RECT rcRight[6];
|
||||
|
||||
rcLeft[0] = {0, 96, 16, 112};
|
||||
rcLeft[1] = {16, 96, 32, 112};
|
||||
rcLeft[2] = {32, 96, 48, 112};
|
||||
rcLeft[3] = {48, 96, 64, 112};
|
||||
rcLeft[4] = {64, 96, 80, 112};
|
||||
rcLeft[5] = {80, 96, 96, 112};
|
||||
|
||||
rcRight[0] = {0, 112, 16, 128};
|
||||
rcRight[1] = {16, 112, 32, 128};
|
||||
rcRight[2] = {32, 112, 48, 128};
|
||||
rcRight[3] = {48, 112, 64, 128};
|
||||
rcRight[4] = {64, 112, 80, 128};
|
||||
rcRight[5] = {80, 112, 96, 128};
|
||||
|
||||
switch (npc->act_no)
|
||||
{
|
||||
case 0:
|
||||
npc->y += 0x600;
|
||||
npc->act_no = 1;
|
||||
// Fallthrough
|
||||
case 1:
|
||||
if (npc->act_wait >= 8 && gMC.x > npc->x - 0xC000 && gMC.x < npc->x + 0xC000 && gMC.y > npc->y - 0xC000 && gMC.y < npc->y + 0x4000)
|
||||
{
|
||||
if (gMC.x < npc->x)
|
||||
npc->direct = 0;
|
||||
else
|
||||
npc->direct = 2;
|
||||
|
||||
npc->ani_no = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (npc->act_wait < 8)
|
||||
++npc->act_wait;
|
||||
|
||||
npc->ani_no = 0;
|
||||
}
|
||||
|
||||
if (npc->shock)
|
||||
{
|
||||
npc->act_no = 2;
|
||||
npc->ani_no = 0;
|
||||
npc->act_wait = 0;
|
||||
}
|
||||
|
||||
if (npc->act_wait >= 8 && gMC.x > npc->x - 0x6000 && gMC.x < npc->x + 0x6000 && gMC.y > npc->y - 0xC000 && gMC.y < npc->y + 0x4000)
|
||||
{
|
||||
npc->act_no = 2;
|
||||
npc->ani_no = 0;
|
||||
npc->act_wait = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (++npc->act_wait > 8)
|
||||
{
|
||||
npc->act_no = 3;
|
||||
npc->ani_no = 2;
|
||||
npc->ym = -0x5FF;
|
||||
PlaySoundObject(30, 1);
|
||||
|
||||
if (gMC.x < npc->x)
|
||||
npc->direct = 0;
|
||||
else
|
||||
npc->direct = 2;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (npc->ym > 0x100)
|
||||
{
|
||||
npc->tgt_y = npc->y;
|
||||
npc->act_no = 4;
|
||||
npc->ani_no = 3;
|
||||
npc->act_wait = 0;
|
||||
npc->act_wait = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if (gMC.x > npc->x)
|
||||
npc->direct = 2;
|
||||
else
|
||||
npc->direct = 0;
|
||||
|
||||
++npc->act_wait;
|
||||
|
||||
if (npc->flag & 7 || npc->act_wait > 60)
|
||||
{
|
||||
npc->damage = 3;
|
||||
npc->act_no = 5;
|
||||
npc->ani_no = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (npc->act_wait % 4 == 1)
|
||||
PlaySoundObject(109, 1);
|
||||
|
||||
if (npc->flag & 8)
|
||||
npc->ym = -0x200;
|
||||
|
||||
if (npc->act_wait % 30 == 6)
|
||||
{
|
||||
const unsigned char deg = GetArktan(npc->x - gMC.x, npc->y - gMC.y) + Random(-6, 6);
|
||||
const int ym = 3 * GetSin(deg);
|
||||
const int xm = 3 * GetCos(deg);
|
||||
SetNpChar(148, npc->x, npc->y, xm, ym, 0, 0, 0x100);
|
||||
PlaySoundObject(39, 1);
|
||||
}
|
||||
|
||||
if (++npc->ani_wait > 0)
|
||||
{
|
||||
npc->ani_wait = 0;
|
||||
++npc->ani_no;
|
||||
}
|
||||
|
||||
if (npc->ani_no > 5)
|
||||
npc->ani_no = 3;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
if (npc->flag & 8)
|
||||
{
|
||||
npc->damage = 2;
|
||||
npc->xm = 0;
|
||||
npc->act_wait = 0;
|
||||
npc->ani_no = 0;
|
||||
npc->act_no = 1;
|
||||
PlaySoundObject(23, 1);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (npc->act_no == 4)
|
||||
{
|
||||
if (npc->tgt_y < npc->y)
|
||||
npc->ym -= 0x10;
|
||||
else
|
||||
npc->ym += 0x10;
|
||||
|
||||
if (npc->ym > 0x200)
|
||||
npc->ym = 0x200;
|
||||
if (npc->ym < -0x200)
|
||||
npc->ym = -0x200;
|
||||
|
||||
if (npc->xm > 0x200)
|
||||
npc->xm = 0x200;
|
||||
if (npc->xm < -0x200)
|
||||
npc->xm = -0x200;
|
||||
}
|
||||
else
|
||||
{
|
||||
npc->ym += 0x20;
|
||||
if (npc->ym > 0x5FF)
|
||||
npc->ym = 0x5FF;
|
||||
}
|
||||
|
||||
npc->x += npc->xm;
|
||||
npc->y += npc->ym;
|
||||
|
||||
if (npc->direct == 0)
|
||||
npc->rect = rcLeft[npc->ani_no];
|
||||
else
|
||||
npc->rect = rcRight[npc->ani_no];
|
||||
}
|
||||
|
||||
//Purple Critter's projectile
|
||||
void ActNpc148(NPCHAR *npc)
|
||||
{
|
||||
if (npc->flag & 0xFF)
|
||||
{
|
||||
SetCaret(npc->x, npc->y, 2, 0);
|
||||
npc->cond = 0;
|
||||
}
|
||||
|
||||
npc->y += npc->ym;
|
||||
npc->x += npc->xm;
|
||||
|
||||
RECT rect_left[2];
|
||||
|
||||
rect_left[0] = {96, 96, 104, 104};
|
||||
rect_left[1] = {104, 96, 112, 104};
|
||||
|
||||
if (++npc->ani_no > 1)
|
||||
npc->ani_no = 0;
|
||||
|
||||
npc->rect = rect_left[npc->ani_no];
|
||||
|
||||
if (++npc->count1 > 300)
|
||||
{
|
||||
SetCaret(npc->x, npc->y, 2, 0);
|
||||
npc->cond = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//Moving block
|
||||
void ActNpc149(NPCHAR *npc)
|
||||
{
|
||||
switch (npc->act_no)
|
||||
{
|
||||
case 0:
|
||||
npc->x += 0x1000;
|
||||
npc->y += 0x1000;
|
||||
|
||||
if (npc->direct == 0)
|
||||
npc->act_no = 10;
|
||||
else
|
||||
npc->act_no = 20;
|
||||
|
||||
npc->xm = 0;
|
||||
npc->ym = 0;
|
||||
|
||||
npc->bits |= 0x40;
|
||||
break;
|
||||
|
||||
case 10:
|
||||
npc->bits &= ~0x80;
|
||||
npc->damage = 0;
|
||||
|
||||
if (gMC.x < npc->x + 0x3200 && gMC.x > npc->x - 0x32000 && gMC.y < npc->y + 0x3200 && gMC.y > npc->y - 0x3200)
|
||||
{
|
||||
npc->act_no = 11;
|
||||
npc->act_wait = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 11:
|
||||
if (++npc->act_wait % 10 == 6)
|
||||
PlaySoundObject(107, 1);
|
||||
|
||||
if (npc->flag & 1)
|
||||
{
|
||||
npc->xm = 0;
|
||||
npc->direct = 2;
|
||||
npc->act_no = 20;
|
||||
SetQuake(10);
|
||||
PlaySoundObject(26, 1);
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
SetNpChar(4, npc->x - 0x2000, npc->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gMC.flag & 1)
|
||||
{
|
||||
npc->bits |= 0x80;
|
||||
npc->damage = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
npc->bits &= ~0x80;
|
||||
npc->damage = 0;
|
||||
}
|
||||
|
||||
npc->xm -= 0x20;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 20:
|
||||
npc->bits &= ~0x80;
|
||||
npc->damage = 0;
|
||||
|
||||
if (gMC.x > npc->x - 0x3200 && gMC.x < npc->x + 0x32000 && gMC.y < npc->y + 0x3200 && gMC.y > npc->y - 0x3200)
|
||||
{
|
||||
npc->act_no = 21;
|
||||
npc->act_wait = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 21:
|
||||
if (++npc->act_wait % 10 == 6)
|
||||
PlaySoundObject(107, 1);
|
||||
|
||||
if (npc->flag & 4)
|
||||
{
|
||||
npc->xm = 0;
|
||||
npc->direct = 0;
|
||||
npc->act_no = 10;
|
||||
SetQuake(10);
|
||||
PlaySoundObject(26, 1);
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
SetNpChar(4, npc->x + 0x2000, npc->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gMC.flag & 4)
|
||||
{
|
||||
npc->bits |= 0x80;
|
||||
npc->damage = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
npc->bits &= ~0x80;
|
||||
npc->damage = 0;
|
||||
}
|
||||
|
||||
npc->xm += 0x20;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (npc->xm > 0x200)
|
||||
npc->xm = 0x200;
|
||||
if (npc->xm < -0x200)
|
||||
npc->xm = -0x200;
|
||||
|
||||
npc->x += npc->xm;
|
||||
|
||||
RECT rect[1];
|
||||
|
||||
rect[0] = {16, 0, 48, 32};
|
||||
|
||||
npc->rect = rect[0];
|
||||
}
|
||||
|
||||
//Quote
|
||||
void ActNpc150(NPCHAR *npc)
|
||||
{
|
||||
|
|
|
@ -203,9 +203,9 @@ NPCFUNCTION gpNpcFuncTbl[361] =
|
|||
ActNpc144,
|
||||
ActNpc145,
|
||||
ActNpc146,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
ActNpc147,
|
||||
ActNpc148,
|
||||
ActNpc149,
|
||||
ActNpc150,
|
||||
ActNpc151,
|
||||
nullptr,
|
||||
|
|
Loading…
Add table
Reference in a new issue