Added more NPCs

This commit is contained in:
Clownacy 2019-02-06 00:13:47 +00:00
parent e1d8d30d3c
commit 916e835b1f
4 changed files with 437 additions and 6 deletions

View file

@ -155,8 +155,14 @@ void ActNpc149(NPCHAR *npc);
void ActNpc150(NPCHAR *npc);
void ActNpc151(NPCHAR *npc);
void ActNpc153(NPCHAR *npc);
void ActNpc154(NPCHAR *npc);
void ActNpc155(NPCHAR *npc);
void ActNpc156(NPCHAR *npc);
void ActNpc192(NPCHAR *npc);
void ActNpc193(NPCHAR *npc);
void ActNpc194(NPCHAR *npc);
void ActNpc199(NPCHAR *npc);

View file

@ -953,7 +953,7 @@ void ActNpc148(NPCHAR *npc)
}
}
//Moving block
//Moving block (horizontal)
void ActNpc149(NPCHAR *npc)
{
switch (npc->act_no)
@ -1285,3 +1285,412 @@ void ActNpc151(NPCHAR *npc)
else
npc->rect = rcRight[npc->ani_no];
}
static const RECT grcKitL[21] = {
{0, 0, 24, 24},
{24, 0, 48, 24},
{48, 0, 72, 24},
{0, 0, 24, 24},
{72, 0, 96, 24},
{0, 0, 24, 24},
{96, 0, 120, 24},
{120, 0, 144, 24},
{144, 0, 168, 24},
{168, 0, 192, 24},
{192, 0, 216, 24},
{216, 0, 240, 24},
{240, 0, 264, 24},
{264, 0, 288, 24},
{0, 48, 24, 72},
{24, 48, 48, 72},
{48, 48, 72, 72},
{72, 48, 96, 72},
{288, 0, 312, 24},
{24, 48, 48, 72},
{96, 48, 120, 72}
};
static const RECT grcKitR[21] = {
{0, 24, 24, 48},
{24, 24, 48, 48},
{48, 24, 72, 48},
{0, 24, 24, 48},
{72, 24, 96, 48},
{0, 24, 24, 48},
{96, 24, 120, 48},
{120, 24, 144, 48},
{144, 24, 168, 48},
{168, 24, 192, 48},
{192, 24, 216, 48},
{216, 24, 240, 48},
{240, 24, 264, 48},
{264, 24, 288, 48},
{0, 72, 24, 96},
{24, 72, 48, 96},
{48, 72, 72, 96},
{72, 72, 96, 96},
{288, 24, 312, 48},
{24, 72, 48, 96},
{96, 72, 120, 96}
};
//Gaudi
void ActNpc153(NPCHAR *npc)
{
if (npc->x <= gMC.x + 0x28000 && npc->x >= gMC.x - 0x28000 && npc->y <= gMC.y + 0x1E000 && npc->y >= gMC.y - 0x1E000)
{
switch (npc->act_no)
{
case 0:
npc->act_no = 1;
npc->xm = 0;
npc->ani_no = 0;
npc->y += 0x600;
// Fallthrough
case 1:
if (Random(0, 100) == 1)
{
npc->act_no = 2;
npc->ani_no = 1;
npc->act_wait = 0;
}
if (Random(0, 100) == 1)
{
if (npc->direct == 0)
npc->direct = 2;
else
npc->direct = 0;
}
if (Random(0, 100) == 1)
npc->act_no = 10;
break;
case 2:
if ( ++npc->act_wait > 20 )
{
npc->act_no = 1;
npc->ani_no = 0;
}
break;
case 10:
npc->act_no = 11;
npc->act_wait = Random(25, 100);
npc->ani_no = 2;
npc->ani_wait = 0;
// Fallthrough
case 11:
if (++npc->ani_wait > 3)
{
npc->ani_wait = 0;
++npc->ani_no;
}
if (npc->ani_no > 5)
npc->ani_no = 2;
if (npc->direct == 0)
npc->xm = -0x200;
else
npc->xm = 0x200;
if (npc->act_wait)
{
--npc->act_wait;
}
else
{
npc->act_no = 1;
npc->ani_no = 0;
npc->xm = 0;
}
if (npc->direct == 0 && npc->flag & 1)
{
npc->ani_no = 2;
npc->ym = -0x5FF;
npc->act_no = 20;
if ((gMC.cond & 2) == 0)
PlaySoundObject(30, 1);
}
else
{
if (npc->direct == 2)
{
if (npc->flag & 4)
{
npc->ani_no = 2;
npc->ym = -0x5FF;
npc->act_no = 20;
if ((gMC.cond & 2) == 0)
PlaySoundObject(30, 1);
}
}
}
break;
case 20:
if (npc->direct == 0 && npc->flag & 1)
++npc->count1;
else if (npc->direct == 2 && npc->flag & 4)
++npc->count1;
else
npc->count1 = 0;
if (npc->count1 > 10)
{
if (npc->direct == 0)
npc->direct = 2;
else
npc->direct = 0;
}
if (npc->direct == 0)
npc->xm = -0x100;
else
npc->xm = 0x100;
if (npc->flag & 8)
{
npc->act_no = 21;
npc->ani_no = 20;
npc->act_wait = 0;
npc->xm = 0;
if ((gMC.cond & 2) == 0)
PlaySoundObject(23, 1);
}
break;
case 21:
if (++npc->act_wait > 10)
{
npc->act_no = 1;
npc->ani_no = 0;
}
break;
}
npc->ym += 0x40;
if (npc->ym > 0x5FF)
npc->ym = 0x5FF;
npc->x += npc->xm;
npc->y += npc->ym;
if (npc->direct == 0)
npc->rect = grcKitL[npc->ani_no];
else
npc->rect = grcKitR[npc->ani_no];
if (npc->life <= 985)
{
npc->code_char = 154;
npc->act_no = 0;
}
}
}
//Gaudi (dead)
void ActNpc154(NPCHAR *npc)
{
switch (npc->act_no)
{
case 0:
npc->bits &= ~0x20;
npc->bits &= ~8;
npc->damage = 0;
npc->act_no = 1;
npc->ani_no = 9;
npc->ym = -0x200;
if (npc->direct == 0)
npc->xm = 0x100;
else
npc->xm = -0x100;
PlaySoundObject(53, 1);
break;
case 1:
if (npc->flag & 8)
{
npc->ani_no = 10;
npc->ani_wait = 0;
npc->act_no = 2;
npc->act_wait = 0;
}
break;
case 2:
npc->xm = 8 * npc->xm / 9;
if (++npc->ani_wait > 3)
{
npc->ani_wait = 0;
++npc->ani_no;
}
if (npc->ani_no > 11)
npc->ani_no = 10;
if (++npc->act_wait > 50)
npc->cond |= 8;
break;
}
npc->ym += 0x20;
if (npc->ym > 0x5FF)
npc->ym = 0x5FF;
npc->x += npc->xm;
npc->y += npc->ym;
if (npc->direct == 0)
npc->rect = grcKitL[npc->ani_no];
else
npc->rect = grcKitR[npc->ani_no];
}
//Gaudi (flying)
void ActNpc155(NPCHAR *npc)
{
if (npc->x > gMC.x + 0x28000 || npc->x < gMC.x - 0x28000 || npc->y > gMC.y + 0x1E000 || npc->y < gMC.y - 0x1E000)
return;
unsigned char deg;
switch (npc->act_no)
{
case 0:
deg = Random(0, 0xFF);
npc->xm = GetCos(deg);
npc->tgt_x = npc->x + 8 * GetCos(deg + 0x40);
deg = Random(0, 0xFF);
npc->ym = GetSin(deg);
npc->tgt_y = npc->y + 8 * GetSin(deg + 0x40);
npc->act_no = 1;
npc->count1 = 120;
npc->act_wait = Random(70, 150);
npc->ani_no = 14;
// Fallthrough
case 1:
if (++npc->ani_no > 15)
npc->ani_no = 14;
if (npc->act_wait)
{
--npc->act_wait;
}
else
{
npc->act_no = 2;
npc->ani_no = 18;
}
break;
case 2:
if (++npc->ani_no > 19)
npc->ani_no = 18;
if (++npc->act_wait > 30)
{
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(156, npc->x, npc->y, xm, ym, 0, 0, 0x100);
if ((gMC.cond & 2) == 0)
PlaySoundObject(39, 1);
npc->act_no = 1;
npc->act_wait = Random(70, 150);
npc->ani_no = 14;
npc->ani_wait = 0;
}
break;
}
if (gMC.x < npc->x)
npc->direct = 0;
else
npc->direct = 2;
if (npc->tgt_x < npc->x)
npc->xm -= 0x10;
if (npc->tgt_x > npc->x)
npc->xm += 0x10;
if (npc->tgt_y < npc->y)
npc->ym -= 0x10;
if (npc->tgt_y > npc->y)
npc->ym += 0x10;
if (npc->xm > 0x200)
npc->xm = 0x200;
if (npc->xm < -0x200)
npc->xm = -0x200;
if (npc->ym > 0x200)
npc->ym = 0x200;
if (npc->ym < -0x200)
npc->ym = -0x200;
npc->x += npc->xm;
npc->y += npc->ym;
if (npc->direct == 0)
npc->rect = grcKitL[npc->ani_no];
else
npc->rect = grcKitR[npc->ani_no];
if (npc->life <= 985)
{
npc->code_char = 154;
npc->act_no = 0;
}
}
//Gaudi projectile
void ActNpc156(NPCHAR *npc)
{
RECT rect_left[3];
if (npc->flag & 0xFF)
{
SetCaret(npc->x, npc->y, 2, 0);
npc->cond = 0;
}
npc->y += npc->ym;
npc->x += npc->xm;
rect_left[0] = {96, 112, 112, 128};
rect_left[1] = {112, 112, 128, 128};
rect_left[2] = {128, 112, 144, 128};
if (++npc->ani_no > 2)
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;
}
}

View file

@ -129,6 +129,22 @@ void ActNpc193(NPCHAR *npc)
npc->rect = rc[0];
}
//Blue robot (broken)
void ActNpc194(NPCHAR *npc)
{
RECT rc[1];
rc[0] = {192, 120, 224, 128};
if (npc->act_no == 0)
{
npc->act_no = 1;
npc->y += 0x800;
}
npc->rect = rc[0];
}
//Water/wind particles
void ActNpc199(NPCHAR *npc)
{

View file

@ -209,10 +209,10 @@ NPCFUNCTION gpNpcFuncTbl[361] =
ActNpc150,
ActNpc151,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
ActNpc153,
ActNpc154,
ActNpc155,
ActNpc156,
nullptr,
nullptr,
nullptr,
@ -250,7 +250,7 @@ NPCFUNCTION gpNpcFuncTbl[361] =
nullptr,
ActNpc192,
ActNpc193,
nullptr,
ActNpc194,
nullptr,
nullptr,
nullptr,