More NPCs

Cemetery done (minus Ma Pignon of course)
This commit is contained in:
Clownacy 2019-01-30 18:13:23 +00:00
parent 4f7db164d6
commit 74bdbf86ca
6 changed files with 560 additions and 4 deletions

View file

@ -73,6 +73,7 @@ SOURCES = \
NpcAct120 \ NpcAct120 \
NpcAct140 \ NpcAct140 \
NpcAct200 \ NpcAct200 \
NpcAct260 \
NpcAct280 \ NpcAct280 \
NpcAct300 \ NpcAct300 \
NpcAct340 \ NpcAct340 \

View file

@ -49,6 +49,7 @@ void ActNpc062(NPCHAR *npc);
void ActNpc064(NPCHAR *npc); void ActNpc064(NPCHAR *npc);
void ActNpc065(NPCHAR *npc); void ActNpc065(NPCHAR *npc);
void ActNpc069(NPCHAR *npc);
void ActNpc070(NPCHAR *npc); void ActNpc070(NPCHAR *npc);
void ActNpc071(NPCHAR *npc); void ActNpc071(NPCHAR *npc);
void ActNpc072(NPCHAR *npc); void ActNpc072(NPCHAR *npc);
@ -59,6 +60,8 @@ void ActNpc076(NPCHAR *npc);
void ActNpc077(NPCHAR *npc); void ActNpc077(NPCHAR *npc);
void ActNpc078(NPCHAR *npc); void ActNpc078(NPCHAR *npc);
void ActNpc079(NPCHAR *npc); void ActNpc079(NPCHAR *npc);
void ActNpc080(NPCHAR *npc);
void ActNpc081(NPCHAR *npc);
void ActNpc083(NPCHAR *npc); void ActNpc083(NPCHAR *npc);
void ActNpc084(NPCHAR *npc); void ActNpc084(NPCHAR *npc);
@ -78,6 +81,8 @@ void ActNpc151(NPCHAR *npc);
void ActNpc211(NPCHAR *npc); void ActNpc211(NPCHAR *npc);
void ActNpc278(NPCHAR *npc);
void ActNpc298(NPCHAR *npc); void ActNpc298(NPCHAR *npc);
void ActNpc299(NPCHAR *npc); void ActNpc299(NPCHAR *npc);
void ActNpc300(NPCHAR *npc); void ActNpc300(NPCHAR *npc);

View file

@ -660,6 +660,142 @@ void ActNpc065(NPCHAR *npc)
npc->rect = rect_right[npc->ani_no]; npc->rect = rect_right[npc->ani_no];
} }
//Sparkle
void ActNpc069(NPCHAR *npc)
{
RECT rcLeft[6];
RECT rcRight[6];
rcLeft[0] = {48, 0, 64, 16};
rcLeft[1] = {64, 0, 80, 16};
rcLeft[2] = {80, 0, 96, 16};
rcLeft[3] = {96, 0, 112, 16};
rcLeft[4] = {48, 0, 64, 16};
rcLeft[5] = {112, 0, 128, 16};
rcRight[0] = {48, 16, 64, 32};
rcRight[1] = {64, 16, 80, 32};
rcRight[2] = {80, 16, 96, 32};
rcRight[3] = {96, 16, 112, 32};
rcRight[4] = {48, 16, 64, 32};
rcRight[5] = {112, 16, 128, 32};
switch (npc->act_no)
{
case 0:
npc->act_no = 1;
npc->ani_no = 0;
npc->ani_wait = 0;
npc->xm = 0;
// Fallthrough
case 1:
if (Random(0, 100) == 1)
{
npc->act_no = 2;
npc->act_wait = 0;
npc->ani_no = 1;
}
else
{
if (Random(0, 150) == 1)
{
if (npc->direct == 0)
npc->direct = 2;
else
npc->direct = 0;
}
if (Random(0, 150) == 1)
{
npc->act_no = 3;
npc->act_wait = 50;
npc->ani_no = 0;
}
}
break;
case 2:
if (++npc->act_wait > 8)
{
npc->act_no = 1;
npc->ani_no = 0;
}
break;
case 3:
npc->act_no = 4;
npc->ani_no = 2;
npc->ani_wait = 0;
// Fallthrough
case 4:
if (--npc->act_wait == 0)
npc->act_no = 0;
if (++npc->ani_wait > 2)
{
npc->ani_wait = 0;
++npc->ani_no;
}
if (npc->ani_no > 4)
npc->ani_no = 2;
if (npc->flag & 1)
{
npc->direct = 2;
npc->xm = 0x200;
}
if (npc->flag & 4)
{
npc->direct = 0;
npc->xm = -0x200;
}
if (npc->direct == 0)
npc->xm = -0x100u;
else
npc->xm = 0x100;
break;
case 5:
if (npc->flag & 8)
npc->act_no = 0;
break;
}
switch (npc->act_no)
{
case 1:
case 2:
case 4:
if (npc->shock)
{
npc->ym = -0x200;
npc->ani_no = 5;
npc->act_no = 5;
}
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 = rcLeft[npc->ani_no];
else
npc->rect = rcRight[npc->ani_no];
}
//Sparkle //Sparkle
void ActNpc070(NPCHAR *npc) void ActNpc070(NPCHAR *npc)
{ {

View file

@ -10,6 +10,298 @@
#include "Triangle.h" #include "Triangle.h"
#include "Caret.h" #include "Caret.h"
//Gravekeeper
void ActNpc080(NPCHAR *npc)
{
RECT rcLeft[7];
RECT rcRight[7];
rcLeft[0] = {0, 64, 24, 88};
rcLeft[1] = {24, 64, 48, 88};
rcLeft[2] = {0, 64, 24, 88};
rcLeft[3] = {48, 64, 72, 88};
rcLeft[4] = {72, 64, 96, 88};
rcLeft[5] = {96, 64, 120, 88};
rcLeft[6] = {120, 64, 144, 88};
rcRight[0] = {0, 88, 24, 112};
rcRight[1] = {24, 88, 48, 112};
rcRight[2] = {0, 88, 24, 112};
rcRight[3] = {48, 88, 72, 112};
rcRight[4] = {72, 88, 96, 112};
rcRight[5] = {96, 88, 120, 112};
rcRight[6] = {120, 88, 144, 112};
switch (npc->act_no)
{
case 0:
npc->bits &= ~0x20;
npc->act_no = 1;
npc->damage = 0;
npc->hit.front = 0x800;
// Fallthrough
case 1:
npc->ani_no = 0;
if (npc->x - 0x10000 < gMC.x && npc->x + 0x10000 > gMC.x && npc->y - 0x6000 < gMC.y && npc->y + 0x4000 > gMC.y)
{
npc->ani_wait = 0;
npc->act_no = 2;
}
if (npc->shock)
{
npc->ani_no = 1;
npc->ani_wait = 0;
npc->act_no = 2;
npc->bits &= ~0x20u;
}
if (gMC.x >= npc->x)
npc->direct = 2;
else
npc->direct = 0;
break;
case 2:
if (++npc->ani_wait > 6)
{
npc->ani_wait = 0;
++npc->ani_no;
}
if (npc->ani_no > 3)
npc->ani_no = 0;
if (npc->x - 0x2000 < gMC.x && npc->x + 0x2000 > gMC.x)
{
npc->hit.front = 0x2400;
npc->act_wait = 0;
npc->act_no = 3;
npc->bits |= 0x20;
PlaySoundObject(34, 1);
if (npc->direct == 0)
npc->xm = -0x400;
else
npc->xm = 0x400;
}
if (gMC.x >= npc->x)
{
npc->direct = 2;
npc->xm = 0x100;
}
else
{
npc->direct = 0;
npc->xm = -0x100;
}
break;
case 3:
npc->xm = 0;
if (++npc->act_wait > 40)
{
npc->act_wait = 0;
npc->act_no = 4;
PlaySoundObject(106, 1);
}
npc->ani_no = 4;
break;
case 4:
npc->damage = 10;
if (++npc->act_wait > 2)
{
npc->act_wait = 0;
npc->act_no = 5;
}
npc->ani_no = 5;
break;
case 5:
npc->ani_no = 6;
if (++npc->act_wait > 60)
npc->act_no = 0;
break;
}
if (npc->xm < 0 && npc->flag & 1)
npc->xm = 0;
if (npc->xm > 0 && npc->flag & 4)
npc->xm = 0;
npc->ym += 0x20;
if (npc->xm > 0x400)
npc->xm = 0x400;
if (npc->xm < -0x400)
npc->xm = -0x400;
if (npc->ym > 0x5FF)
npc->xm = 0x5FF;
if (npc->ym < -0x5FF)
npc->xm = -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];
}
//Giant pignon
void ActNpc081(NPCHAR *npc)
{
RECT rcLeft[6];
RECT rcRight[6];
rcLeft[0] = {144, 64, 168, 88};
rcLeft[1] = {168, 64, 192, 88};
rcLeft[2] = {192, 64, 216, 88};
rcLeft[3] = {216, 64, 240, 88};
rcLeft[4] = {144, 64, 168, 88};
rcLeft[5] = {240, 64, 264, 88};
rcRight[0] = {144, 88, 168, 112};
rcRight[1] = {168, 88, 192, 112};
rcRight[2] = {192, 88, 216, 112};
rcRight[3] = {216, 88, 240, 112};
rcRight[4] = {144, 88, 168, 112};
rcRight[5] = {240, 88, 264, 112};
switch (npc->act_no)
{
case 0:
npc->act_no = 1;
npc->ani_no = 0;
npc->ani_wait = 0;
npc->xm = 0;
// Fallthrough
case 1:
if (Random(0, 100) == 1)
{
npc->act_no = 2;
npc->act_wait = 0;
npc->ani_no = 1;
}
else
{
if (Random(0, 150) == 1)
{
if (npc->direct == 0)
npc->direct = 2;
else
npc->direct = 0;
}
if (Random(0, 150) == 1)
{
npc->act_no = 3;
npc->act_wait = 50;
npc->ani_no = 0;
}
}
break;
case 2:
if (++npc->act_wait > 8)
{
npc->act_no = 1;
npc->ani_no = 0;
}
break;
case 3:
npc->act_no = 4;
npc->ani_no = 2;
npc->ani_wait = 0;
// Fallthrough
case 4:
if (--npc->act_wait == 0)
npc->act_no = 0;
if (++npc->ani_wait > 2)
{
npc->ani_wait = 0;
++npc->ani_no;
}
if (npc->ani_no > 4)
npc->ani_no = 2;
if (npc->flag & 1)
{
npc->direct = 2;
npc->xm = 0x200;
}
if (npc->flag & 4)
{
npc->direct = 0;
npc->xm = -0x200;
}
if (npc->direct == 0)
npc->xm = -0x100;
else
npc->xm = 0x100;
break;
case 5:
if (npc->flag & 8)
npc->act_no = 0;
break;
}
switch (npc->act_no)
{
case 1:
case 2:
case 4:
if (npc->shock )
{
npc->ym = -0x200;
npc->ani_no = 5;
npc->act_no = 5;
if (npc->x >= gMC.x)
npc->xm = -0x100;
else
npc->xm = 0x100;
}
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 = rcLeft[npc->ani_no];
else
npc->rect = rcRight[npc->ani_no];
}
//Igor (cutscene) //Igor (cutscene)
void ActNpc083(NPCHAR *npc) void ActNpc083(NPCHAR *npc)
{ {

122
src/NpcAct260.cpp Normal file
View file

@ -0,0 +1,122 @@
#include "WindowsWrapper.h"
#include "NpcAct.h"
#include "MyChar.h"
#include "NpChar.h"
#include "Game.h"
#include "Sound.h"
#include "Back.h"
#include "Triangle.h"
//Little family
void ActNpc278(NPCHAR *npc)
{
RECT rcMama[2];
RECT rcPapa[2];
RECT rcKodomo[2];
rcPapa[0] = {0, 120, 8, 128};
rcPapa[1] = {8, 120, 16, 128};
rcMama[0] = {16, 120, 24, 128};
rcMama[1] = {24, 120, 32, 128};
rcKodomo[0] = {32, 120, 40, 128};
rcKodomo[1] = {40, 120, 48, 128};
switch (npc->act_no)
{
case 0:
npc->act_no = 1;
npc->ani_no = 0;
npc->ani_wait = 0;
npc->xm = 0;
// Fallthrough
case 1:
if (Random(0, 60) == 1)
{
npc->act_no = 2;
npc->act_wait = 0;
npc->ani_no = 1;
}
if (Random(0, 60) == 1)
{
npc->act_no = 10;
npc->act_wait = 0;
npc->ani_no = 1;
}
break;
case 2:
if (++npc->act_wait > 8)
{
npc->act_no = 1;
npc->ani_no = 0;
}
break;
case 10:
npc->act_no = 11;
npc->act_wait = Random(0, 16);
npc->ani_no = 0;
npc->ani_wait = 0;
if (Random(0, 9) % 2)
npc->direct = 0;
else
npc->direct = 2;
// Fallthrough
case 11:
if (npc->direct == 0 && (npc->flag & 1))
npc->direct = 2;
else if ( npc->direct == 2 && npc->flag & 4 )
npc->direct = 0;
if (npc->direct == 0)
npc->xm = -0x100;
else
npc->xm = 0x100;
if (++npc->ani_wait > 4)
{
npc->ani_wait = 0;
++npc->ani_no;
}
if (npc->ani_no > 1)
npc->ani_no = 0;
if (++npc->act_wait > 0x20)
npc->act_no = 0;
break;
}
npc->ym += 0x20;
if (npc->ym > 0x5FF)
npc->ym = 0x5FF;
npc->x += npc->xm;
npc->y += npc->ym;
switch (npc->code_event)
{
case 200:
npc->rect = rcPapa[npc->ani_no];
break;
case 210:
npc->rect = rcMama[npc->ani_no];
break;
default:
npc->rect = rcKodomo[npc->ani_no];
break;
}
}

View file

@ -125,7 +125,7 @@ NPCFUNCTION gpNpcFuncTbl[361] =
nullptr, nullptr,
nullptr, nullptr,
nullptr, nullptr,
nullptr, ActNpc069,
ActNpc070, ActNpc070,
ActNpc071, ActNpc071,
ActNpc072, ActNpc072,
@ -136,8 +136,8 @@ NPCFUNCTION gpNpcFuncTbl[361] =
ActNpc077, ActNpc077,
ActNpc078, ActNpc078,
ActNpc079, ActNpc079,
nullptr, ActNpc080,
nullptr, ActNpc081,
nullptr, nullptr,
ActNpc083, ActNpc083,
ActNpc084, ActNpc084,
@ -334,7 +334,7 @@ NPCFUNCTION gpNpcFuncTbl[361] =
nullptr, nullptr,
nullptr, nullptr,
nullptr, nullptr,
nullptr, ActNpc278,
nullptr, nullptr,
nullptr, nullptr,
nullptr, nullptr,