More NPCs
This commit is contained in:
parent
0824a0fb12
commit
e5c40c5163
4 changed files with 432 additions and 6 deletions
|
@ -160,7 +160,8 @@ void ActNpc154(NPCHAR *npc);
|
|||
void ActNpc155(NPCHAR *npc);
|
||||
void ActNpc156(NPCHAR *npc);
|
||||
void ActNpc157(NPCHAR *npc);
|
||||
|
||||
void ActNpc158(NPCHAR *npc);
|
||||
void ActNpc159(NPCHAR *npc);
|
||||
void ActNpc160(NPCHAR *npc);
|
||||
void ActNpc161(NPCHAR *npc);
|
||||
void ActNpc162(NPCHAR *npc);
|
||||
|
@ -168,6 +169,10 @@ void ActNpc163(NPCHAR *npc);
|
|||
void ActNpc164(NPCHAR *npc);
|
||||
void ActNpc165(NPCHAR *npc);
|
||||
void ActNpc166(NPCHAR *npc);
|
||||
void ActNpc167(NPCHAR *npc);
|
||||
|
||||
void ActNpc173(NPCHAR *npc);
|
||||
void ActNpc174(NPCHAR *npc);
|
||||
|
||||
void ActNpc192(NPCHAR *npc);
|
||||
void ActNpc193(NPCHAR *npc);
|
||||
|
|
|
@ -1818,3 +1818,130 @@ void ActNpc157(NPCHAR *npc)
|
|||
|
||||
npc->rect = rect[0];
|
||||
}
|
||||
|
||||
//Fish Missile
|
||||
void ActNpc158(NPCHAR *npc)
|
||||
{
|
||||
RECT rect[8];
|
||||
|
||||
rect[0] = {0, 224, 16, 240};
|
||||
rect[1] = {16, 224, 32, 240};
|
||||
rect[2] = {32, 224, 48, 240};
|
||||
rect[3] = {48, 224, 64, 240};
|
||||
rect[4] = {64, 224, 80, 240};
|
||||
rect[5] = {80, 224, 96, 240};
|
||||
rect[6] = {96, 224, 112, 240};
|
||||
rect[7] = {112, 224, 128, 240};
|
||||
|
||||
switch (npc->act_no)
|
||||
{
|
||||
case 0:
|
||||
npc->act_no = 1;
|
||||
|
||||
switch (npc->direct)
|
||||
{
|
||||
case 0:
|
||||
npc->count1 = 0xA0;
|
||||
break;
|
||||
case 1:
|
||||
npc->count1 = 0xE0;
|
||||
break;
|
||||
case 2:
|
||||
npc->count1 = 0x20;
|
||||
break;
|
||||
case 3:
|
||||
npc->count1 = 0x60;
|
||||
break;
|
||||
}
|
||||
// Fallthrough
|
||||
case 1:
|
||||
npc->xm = 2 * GetCos(npc->count1);
|
||||
npc->ym = 2 * GetSin(npc->count1);
|
||||
npc->y += npc->ym;
|
||||
npc->x += npc->xm;
|
||||
const int dir = GetArktan(npc->x - gMC.x, npc->y - gMC.y);
|
||||
|
||||
if (dir < npc->count1)
|
||||
{
|
||||
if (npc->count1 - dir < 0x80)
|
||||
--npc->count1;
|
||||
else
|
||||
++npc->count1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dir - npc->count1 < 0x80)
|
||||
++npc->count1;
|
||||
else
|
||||
--npc->count1;
|
||||
}
|
||||
|
||||
if (npc->count1 > 0xFF)
|
||||
npc->count1 -= 0x100;
|
||||
if (npc->count1 < 0)
|
||||
npc->count1 += 0x100;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (++npc->ani_wait > 2)
|
||||
{
|
||||
npc->ani_wait = 0;
|
||||
SetCaret(npc->x, npc->y, 7, 4);
|
||||
}
|
||||
|
||||
npc->ani_no = (npc->count1 + 0x10) / 0x20;
|
||||
|
||||
if (npc->ani_no > 7)
|
||||
npc->ani_no = 7;
|
||||
|
||||
npc->rect = rect[npc->ani_no];
|
||||
}
|
||||
|
||||
//Monster X (defeated)
|
||||
void ActNpc159(NPCHAR *npc)
|
||||
{
|
||||
RECT rect[1];
|
||||
|
||||
rect[0] = {144, 128, 192, 200};
|
||||
|
||||
switch (npc->act_no)
|
||||
{
|
||||
case 0:
|
||||
npc->act_no = 1;
|
||||
|
||||
for (int i = 0; i < 8; ++i)
|
||||
SetNpChar(4, npc->x + (Random(-16, 16) * 0x200), npc->y + (Random(-16, 16) * 0x200), Random(-341, 341), Random(-341, 341), 0, 0, 0x100);
|
||||
// Fallthrough
|
||||
case 1:
|
||||
if (++npc->act_wait > 50)
|
||||
{
|
||||
npc->act_no = 2;
|
||||
npc->xm = -0x100;
|
||||
}
|
||||
|
||||
if (npc->act_wait / 2 % 2)
|
||||
npc->x += 0x200;
|
||||
else
|
||||
npc->x -= 0x200;
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
++npc->act_wait;
|
||||
npc->ym += 0x40;
|
||||
|
||||
if (npc->y > 0x50000)
|
||||
npc->cond = 0;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
npc->y += npc->ym;
|
||||
npc->x += npc->xm;
|
||||
|
||||
npc->rect = rect[0];
|
||||
|
||||
if (npc->act_wait % 8 == 1)
|
||||
SetNpChar(4, npc->x + (Random(-16, 16) * 0x200), npc->y + (Random(-16, 16) * 0x200), Random(-341, 341), Random(-341, 341), 0, 0, 0x100);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "Back.h"
|
||||
#include "Triangle.h"
|
||||
#include "Frame.h"
|
||||
#include "Caret.h"
|
||||
|
||||
//Puu Black
|
||||
void ActNpc160(NPCHAR *npc)
|
||||
|
@ -466,3 +467,296 @@ void ActNpc166(NPCHAR *npc)
|
|||
|
||||
npc->rect = rcLeft[npc->ani_no];
|
||||
}
|
||||
|
||||
//Professor Booster (falling)
|
||||
void ActNpc167(NPCHAR *npc)
|
||||
{
|
||||
RECT rect[3];
|
||||
|
||||
rect[0] = {304, 0, 320, 16};
|
||||
rect[1] = {304, 16, 320, 32};
|
||||
rect[2] = {0, 0, 0, 0};
|
||||
|
||||
switch (npc->act_no)
|
||||
{
|
||||
case 0:
|
||||
npc->act_no = 1;
|
||||
npc->ani_no = 1;
|
||||
break;
|
||||
case 10:
|
||||
npc->ani_no = 0;
|
||||
|
||||
npc->ym += 0x40;
|
||||
if (npc->ym > 0x5FF)
|
||||
npc->ym = 0x5FF;
|
||||
|
||||
npc->y += npc->ym;
|
||||
break;
|
||||
case 20:
|
||||
npc->act_no = 21;
|
||||
npc->act_wait = 0;
|
||||
npc->ani_no = 0;
|
||||
PlaySoundObject(29, 1);
|
||||
// Fallthrough
|
||||
case 21:
|
||||
if (++npc->ani_no > 2)
|
||||
npc->ani_no = 1;
|
||||
|
||||
if (++npc->act_wait > 100)
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
SetNpChar(4, npc->x + (Random(-12, 12) * 0x200), npc->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
|
||||
|
||||
npc->cond = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
npc->rect = rect[npc->ani_no];
|
||||
}
|
||||
|
||||
//Gaudi (armoured)
|
||||
void ActNpc173(NPCHAR *npc)
|
||||
{
|
||||
RECT rcLeft[4];
|
||||
RECT rcRight[4];
|
||||
|
||||
rcLeft[0] = {0, 128, 24, 152};
|
||||
rcLeft[1] = {24, 128, 48, 152};
|
||||
rcLeft[2] = {48, 128, 72, 152};
|
||||
rcLeft[3] = {72, 128, 96, 152};
|
||||
|
||||
rcRight[0] = {0, 152, 24, 176};
|
||||
rcRight[1] = {24, 152, 48, 176};
|
||||
rcRight[2] = {48, 152, 72, 176};
|
||||
rcRight[3] = {72, 152, 96, 176};
|
||||
|
||||
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->tgt_x = npc->x;
|
||||
npc->act_no = 1;
|
||||
// Fallthrough
|
||||
case 1:
|
||||
npc->ani_no = 0;
|
||||
npc->xm = 0;
|
||||
|
||||
if (npc->act_wait < 5)
|
||||
{
|
||||
++npc->act_wait;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gMC.x > npc->x - 0x18000 && gMC.x < npc->x + 0x18000 && gMC.y > npc->y - 0x14000 && gMC.y < npc->y + 0x14000)
|
||||
{
|
||||
npc->act_no = 10;
|
||||
npc->act_wait = 0;
|
||||
npc->ani_no = 1;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 10:
|
||||
if (++npc->act_wait > 3)
|
||||
{
|
||||
if (++npc->count1 == 3)
|
||||
{
|
||||
PlaySoundObject(30, 1);
|
||||
npc->count1 = 0;
|
||||
npc->act_no = 25;
|
||||
npc->act_wait = 0;
|
||||
npc->ani_no = 2;
|
||||
npc->ym = -0x600;
|
||||
|
||||
if (npc->tgt_x > npc->x)
|
||||
npc->xm = 0x80;
|
||||
else
|
||||
npc->xm = -0x80;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaySoundObject(30, 1);
|
||||
npc->act_no = 20;
|
||||
npc->ani_no = 2;
|
||||
npc->ym = -0x200;
|
||||
|
||||
if (npc->tgt_x > npc->x)
|
||||
npc->xm = 0x200;
|
||||
else
|
||||
npc->xm = -0x200;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 20:
|
||||
++npc->act_wait;
|
||||
|
||||
if (npc->flag & 8)
|
||||
{
|
||||
PlaySoundObject(23, 1);
|
||||
npc->ani_no = 1;
|
||||
npc->act_no = 30;
|
||||
npc->act_wait = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 25:
|
||||
if (++npc->act_wait == 30 || npc->act_wait == 40)
|
||||
{
|
||||
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(174, npc->x, npc->y, xm, ym, 0, 0, 0x100);
|
||||
|
||||
PlaySoundObject(39, 1);
|
||||
npc->ani_no = 3;
|
||||
|
||||
gCurlyShoot_wait = Random(80, 100);
|
||||
gCurlyShoot_x = npc->x;
|
||||
gCurlyShoot_y = npc->y;
|
||||
}
|
||||
|
||||
if (npc->act_wait == 35 || npc->act_wait == 45)
|
||||
npc->ani_no = 2;
|
||||
|
||||
if (npc->flag & 8)
|
||||
{
|
||||
PlaySoundObject(23, 1);
|
||||
npc->ani_no = 1;
|
||||
npc->act_no = 30;
|
||||
npc->act_wait = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 30:
|
||||
npc->xm = 7 * npc->xm / 8;
|
||||
|
||||
if (++npc->act_wait > 3)
|
||||
{
|
||||
npc->ani_no = 0;
|
||||
npc->act_no = 1;
|
||||
npc->act_wait = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
npc->ym += 51;
|
||||
|
||||
if (gMC.x < npc->x)
|
||||
npc->direct = 0;
|
||||
else
|
||||
npc->direct = 2;
|
||||
|
||||
if (npc->ym > 0x5FF)
|
||||
npc->ym = 0x5FF;
|
||||
if ( npc->ym < -0x5FFu )
|
||||
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];
|
||||
|
||||
if (npc->life <= 985)
|
||||
{
|
||||
SetDestroyNpChar(npc->x, npc->y, 0, 2);
|
||||
npc->code_char = 154;
|
||||
npc->act_no = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Armoured-Gaudi projectile
|
||||
void ActNpc174(NPCHAR *npc)
|
||||
{
|
||||
RECT rect_left[3];
|
||||
|
||||
bool bHit;
|
||||
switch (npc->act_no)
|
||||
{
|
||||
case 0:
|
||||
if (npc->direct == 2)
|
||||
npc->act_no = 2;
|
||||
// Fallthrough
|
||||
case 1:
|
||||
npc->x += npc->xm;
|
||||
npc->y += npc->ym;
|
||||
|
||||
bHit = false;
|
||||
|
||||
if (npc->flag & 1)
|
||||
{
|
||||
bHit = true;
|
||||
npc->xm = 0x200;
|
||||
}
|
||||
|
||||
if (npc->flag & 4)
|
||||
{
|
||||
bHit = true;
|
||||
npc->xm = -0x200;
|
||||
}
|
||||
|
||||
if (npc->flag & 2)
|
||||
{
|
||||
bHit = true;
|
||||
npc->ym = 0x200;
|
||||
}
|
||||
|
||||
if (npc->flag & 8)
|
||||
{
|
||||
bHit = true;
|
||||
npc->ym = -0x200;
|
||||
}
|
||||
|
||||
if (bHit)
|
||||
{
|
||||
npc->act_no = 2;
|
||||
++npc->count1;
|
||||
PlaySoundObject(31, 1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
npc->ym += 0x40;
|
||||
|
||||
npc->x += npc->xm;
|
||||
npc->y += npc->ym;
|
||||
|
||||
if (npc->flag & 8)
|
||||
{
|
||||
if (++npc->count1 > 1)
|
||||
{
|
||||
SetCaret(npc->x, npc->y, 2, 0);
|
||||
npc->cond = 0;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (npc->ym > 0x5FF)
|
||||
npc->ym = 0x5FF;
|
||||
if (npc->ym < -0x5FF)
|
||||
npc->ym = -0x5FF;
|
||||
|
||||
rect_left[0] = {120, 80, 136, 96};
|
||||
rect_left[1] = {136, 80, 152, 96};
|
||||
rect_left[2] = {152, 80, 168, 96};
|
||||
|
||||
if (++npc->ani_no > 2)
|
||||
npc->ani_no = 0;
|
||||
|
||||
npc->rect = rect_left[npc->ani_no];
|
||||
}
|
||||
|
|
|
@ -214,8 +214,8 @@ NPCFUNCTION gpNpcFuncTbl[361] =
|
|||
ActNpc155,
|
||||
ActNpc156,
|
||||
ActNpc157,
|
||||
nullptr,
|
||||
nullptr,
|
||||
ActNpc158,
|
||||
ActNpc159,
|
||||
ActNpc160,
|
||||
ActNpc161,
|
||||
ActNpc162,
|
||||
|
@ -223,14 +223,14 @@ NPCFUNCTION gpNpcFuncTbl[361] =
|
|||
ActNpc164,
|
||||
ActNpc165,
|
||||
ActNpc166,
|
||||
ActNpc167,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
ActNpc173,
|
||||
ActNpc174,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
|
Loading…
Add table
Reference in a new issue