More NPCs

This commit is contained in:
Clownacy 2019-01-29 20:12:49 +00:00
parent 76cb99342a
commit 25b58cc072
9 changed files with 745 additions and 11 deletions

View file

@ -67,6 +67,7 @@ SOURCES = \
NpcAct060 \ NpcAct060 \
NpcAct080 \ NpcAct080 \
NpcAct100 \ NpcAct100 \
NpcAct120 \
NpcAct140 \ NpcAct140 \
NpcAct200 \ NpcAct200 \
NpcAct280 \ NpcAct280 \

View file

@ -9,7 +9,7 @@ void ActNpc003(NPCHAR *npc);
void ActNpc004(NPCHAR *npc); void ActNpc004(NPCHAR *npc);
void ActNpc005(NPCHAR *npc); void ActNpc005(NPCHAR *npc);
void ActNpc006(NPCHAR *npc); void ActNpc006(NPCHAR *npc);
void ActNpc007(NPCHAR *npc);
void ActNpc008(NPCHAR *npc); void ActNpc008(NPCHAR *npc);
void ActNpc015(NPCHAR *npc); void ActNpc015(NPCHAR *npc);
@ -22,10 +22,15 @@ void ActNpc021(NPCHAR *npc);
void ActNpc022(NPCHAR *npc); void ActNpc022(NPCHAR *npc);
void ActNpc023(NPCHAR *npc); void ActNpc023(NPCHAR *npc);
void ActNpc025(NPCHAR *npc);
void ActNpc029(NPCHAR *npc);
void ActNpc030(NPCHAR *npc); void ActNpc030(NPCHAR *npc);
void ActNpc032(NPCHAR *npc); void ActNpc032(NPCHAR *npc);
void ActNpc034(NPCHAR *npc);
void ActNpc037(NPCHAR *npc); void ActNpc037(NPCHAR *npc);
void ActNpc039(NPCHAR *npc); void ActNpc039(NPCHAR *npc);
@ -45,9 +50,17 @@ void ActNpc065(NPCHAR *npc);
void ActNpc073(NPCHAR *npc); void ActNpc073(NPCHAR *npc);
void ActNpc083(NPCHAR *npc); void ActNpc083(NPCHAR *npc);
void ActNpc084(NPCHAR *npc);
void ActNpc085(NPCHAR *npc);
void ActNpc086(NPCHAR *npc);
void ActNpc087(NPCHAR *npc);
void ActNpc116(NPCHAR *npc);
void ActNpc119(NPCHAR *npc); void ActNpc119(NPCHAR *npc);
void ActNpc125(NPCHAR *npc);
void ActNpc151(NPCHAR *npc); void ActNpc151(NPCHAR *npc);
void ActNpc211(NPCHAR *npc); void ActNpc211(NPCHAR *npc);

View file

@ -620,6 +620,88 @@ void ActNpc006(NPCHAR *npc)
npc->rect = rcLeft[npc->ani_no]; npc->rect = rcLeft[npc->ani_no];
} }
//Basil
void ActNpc007(NPCHAR *npc)
{
RECT rcLeft[3];
RECT rcRight[3];
rcLeft[0] = {256, 64, 288, 80};
rcLeft[1] = {256, 80, 288, 96};
rcLeft[2] = {256, 96, 288, 112};
rcRight[0] = {288, 64, 320, 80};
rcRight[1] = {288, 80, 320, 96};
rcRight[2] = {288, 96, 320, 112};
switch (npc->act_no)
{
case 0:
npc->x = gMC.x;
if (npc->direct == 0)
npc->act_no = 1;
else
npc->act_no = 2;
break;
case 1:
npc->xm -= 0x40;
if (npc->x < gMC.x - 0x18000)
npc->act_no = 2;
if (npc->flag & 1)
{
npc->xm = 0;
npc->act_no = 2;
}
break;
case 2:
npc->xm += 0x40;
if (npc->x > gMC.x + 0x18000)
npc->act_no = 1;
if (npc->flag & 4)
{
npc->xm = 0;
npc->act_no = 1;
}
break;
}
if (npc->xm >= 0)
npc->direct = 2;
else
npc->direct = 0;
if (npc->xm > 0x5FF)
npc->xm = 0x5FF;
if (npc->xm < -0x5FF)
npc->xm = -0x5FF;
npc->x += npc->xm;
if (++npc->ani_wait > 1)
{
npc->ani_wait = 0;
++npc->ani_no;
}
if (npc->ani_no > 2)
npc->ani_no = 0;
if (npc->direct == 0)
npc->rect = rcLeft[npc->ani_no];
else
npc->rect = rcRight[npc->ani_no];
}
//Beetle (Follows you, Egg Corridor) //Beetle (Follows you, Egg Corridor)
void ActNpc008(NPCHAR *npc) void ActNpc008(NPCHAR *npc)
{ {

View file

@ -108,6 +108,166 @@ void ActNpc023(NPCHAR *npc)
npc->rect = rect[npc->ani_no]; npc->rect = rect[npc->ani_no];
} }
// Egg Corridor lift
void ActNpc025(NPCHAR *npc)
{
RECT rcLeft[2];
rcLeft[0] = {256, 64, 288, 80};
rcLeft[1] = {256, 80, 288, 96};
switch (npc->act_no)
{
case 0:
npc->act_no = 1;
npc->ani_no = 0;
npc->ani_wait = 0;
npc->x += 0x1000;
// Fallthrough
case 1:
if (++npc->act_wait > 150)
{
npc->act_wait = 0;
++npc->act_no;
}
break;
case 2:
if (++npc->act_wait > 0x40)
{
npc->act_wait = 0;
++npc->act_no;
}
else
{
npc->y -= 0x200;
}
break;
case 3:
if (++npc->act_wait > 150)
{
npc->act_wait = 0;
++npc->act_no;
}
break;
case 4:
if (++npc->act_wait > 0x40)
{
npc->act_wait = 0;
++npc->act_no;
}
else
{
npc->y -= 0x200;
}
break;
case 5:
if (++npc->act_wait > 150)
{
npc->act_wait = 0;
++npc->act_no;
}
break;
case 6:
if (++npc->act_wait > 0x40)
{
npc->act_wait = 0;
++npc->act_no;
}
else
{
npc->y += 0x200;
}
break;
case 7:
if (++npc->act_wait > 150)
{
npc->act_wait = 0;
++npc->act_no;
}
break;
case 8:
if (++npc->act_wait > 0x40)
{
npc->act_wait = 0;
npc->act_no = 1;
}
else
{
npc->y += 0x200;
}
break;
}
switch ( npc->act_no )
{
case 2:
case 4:
case 6:
case 8:
if (++npc->ani_wait > 1)
{
npc->ani_wait = 0;
++npc->ani_no;
}
if (npc->ani_no > 1)
npc->ani_no = 0;
break;
}
npc->rect = rcLeft[npc->ani_no];
}
//Cthulhu
void ActNpc029(NPCHAR *npc)
{
RECT rcLeft[2];
RECT rcRight[2];
rcLeft[0] = {0, 192, 16, 216};
rcLeft[1] = {16, 192, 32, 216};
rcRight[0] = {0, 216, 16, 240};
rcRight[1] = {16, 216, 32, 240};
switch (npc->act_no)
{
case 0:
npc->act_no = 1;
npc->ani_no = 0;
npc->ani_wait = 0;
// Fallthrough
case 1:
if (npc->x - 0x6000 < gMC.x && npc->x + 0x6000 > gMC.x && npc->y - 0x6000 < gMC.y && npc->y + 0x2000 > gMC.y)
npc->ani_no = 1;
else
npc->ani_no = 0;
break;
}
if (npc->direct == 0)
npc->rect = rcLeft[npc->ani_no];
else
npc->rect = rcRight[npc->ani_no];
}
//Gunsmith //Gunsmith
void ActNpc030(NPCHAR *npc) void ActNpc030(NPCHAR *npc)
{ {
@ -188,6 +348,21 @@ void ActNpc032(NPCHAR *npc)
npc->rect = rect[npc->ani_no]; npc->rect = rect[npc->ani_no];
} }
// Bed
void ActNpc034(NPCHAR *npc)
{
RECT rcLeft[1];
RECT rcRight[1];
rcLeft[0] = {192, 48, 224, 64};
rcRight[0] = {192, 184, 224, 200};
if (npc->direct == 0)
npc->rect = rcLeft[0];
else
npc->rect = rcRight[0];
}
//Signpost //Signpost
void ActNpc037(NPCHAR *npc) void ActNpc037(NPCHAR *npc)
{ {

360
src/NpcAct080.cpp Normal file
View file

@ -0,0 +1,360 @@
#include "WindowsWrapper.h"
#include "NpcAct.h"
#include "MyChar.h"
#include "NpChar.h"
#include "Game.h"
#include "Sound.h"
#include "Back.h"
#include "Triangle.h"
#include "Caret.h"
//Igor (cutscene)
void ActNpc083(NPCHAR *npc)
{
RECT rcLeft[8];
RECT rcRight[8];
rcLeft[0] = {0, 0, 40, 40};
rcLeft[1] = {40, 0, 80, 40};
rcLeft[2] = {80, 0, 120, 40};
rcLeft[3] = {0, 0, 40, 40};
rcLeft[4] = {120, 0, 160, 40};
rcLeft[5] = {0, 0, 40, 40};
rcLeft[6] = {160, 0, 200, 40};
rcLeft[7] = {200, 0, 240, 40};
rcRight[0] = {0, 40, 40, 80};
rcRight[1] = {40, 40, 80, 80};
rcRight[2] = {80, 40, 120, 80};
rcRight[3] = {0, 40, 40, 80};
rcRight[4] = {120, 40, 160, 80};
rcRight[5] = {0, 40, 40, 80};
rcRight[6] = {160, 40, 200, 80};
rcRight[7] = {200, 40, 240, 80};
switch (npc->act_no)
{
case 0:
npc->xm = 0;
npc->act_no = 1;
npc->ani_no = 0;
npc->ani_wait = 0;
// Fallthrough
case 1:
if (++npc->ani_wait > 5)
{
npc->ani_wait = 0;
++npc->ani_no;
}
if (npc->ani_no > 1)
npc->ani_no = 0;
break;
case 2:
npc->act_no = 3;
npc->ani_no = 2;
npc->ani_wait = 0;
// Fallthrough
case 3:
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;
break;
case 4:
npc->xm = 0;
npc->act_no = 5;
npc->act_wait = 0;
npc->ani_no = 6;
// Fallthrough
case 5:
if (++npc->act_wait > 10)
{
npc->act_wait = 0;
npc->act_no = 6;
npc->ani_no = 7;
PlaySoundObject(70, 1);
}
break;
case 6:
if (++npc->act_wait > 8)
{
npc->act_no = 0;
npc->ani_no = 0;
}
break;
case 7:
npc->act_no = 1;
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];
}
//Basu projectile (Egg Corridor)
void ActNpc084(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[4];
rect_left[0] = {48, 48, 64, 64};
rect_left[1] = {64, 48, 80, 64};
rect_left[2] = {48, 64, 64, 80};
rect_left[3] = {64, 64, 80, 80};
if (++npc->ani_wait > 2)
{
npc->ani_wait = 0;
++npc->ani_no;
}
if (npc->ani_no > 3)
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;
}
}
// Terminal
void ActNpc085(NPCHAR *npc)
{
RECT rcLeft[3];
RECT rcRight[3];
rcLeft[0] = {256, 96, 272, 120};
rcLeft[1] = {256, 96, 272, 120};
rcLeft[2] = {272, 96, 288, 120};
rcRight[0] = {256, 96, 272, 120};
rcRight[1] = {288, 96, 304, 120};
rcRight[2] = {304, 96, 320, 120};
switch(npc->act_no)
{
case 0:
npc->ani_no = 0;
if (npc->x - 0x1000 < gMC.x && npc->x + 0x1000 > gMC.x && npc->y - 0x2000 < gMC.y && npc->y + 0x1000 > gMC.y)
{
PlaySoundObject(43, 1);
npc->act_no = 1;
}
break;
case 1:
if (++npc->ani_no > 2)
npc->ani_no = 1;
break;
}
if (npc->direct == 0)
npc->rect = rcLeft[npc->ani_no];
else
npc->rect = rcRight[npc->ani_no];
}
// Missile
void ActNpc086(NPCHAR *npc)
{
RECT rect1[2];
RECT rect3[2];
RECT rcLast[1];
rect1[0] = {0, 80, 16, 96};
rect1[1] = {16, 80, 32, 96};
rect3[0] = {0, 112, 16, 128};
rect3[1] = {16, 112, 32, 128};
rcLast[0] = {16, 0, 32, 16};
if (npc->direct == 0)
{
if (++npc->ani_wait > 2)
{
npc->ani_wait = 0;
++npc->ani_no;
}
if (npc->ani_no > 1)
npc->ani_no = 0;
}
if (gBack.type == 5 || gBack.type == 6)
{
if (npc->act_no == 0)
{
npc->act_no = 1;
npc->ym = Random(-0x20, 0x20);
npc->xm = Random(0x7F, 0x100);
}
npc->xm -= 8;
if (npc->x < 0xA000)
npc->cond = 0;
if (npc->x < -0x600)
npc->x = -0x600;
if (npc->flag & 1)
npc->xm = 0x100;
if (npc->flag & 2)
npc->ym = 0x40;
if (npc->flag & 8)
npc->ym = -0x40;
npc->x += npc->xm;
npc->y += npc->ym;
}
switch (npc->exp)
{
case 1:
npc->rect = rect1[npc->ani_no];
break;
case 3:
npc->rect = rect3[npc->ani_no];
break;
}
if (npc->direct == 0)
++npc->count1;
if (npc->count1 > 550)
npc->cond = 0;
if (npc->count1 > 500 && npc->count1 / 2 % 2)
npc->rect.right = 0;
if (npc->count1 > 547)
npc->rect = rcLast[0];;
}
// Heart
void ActNpc087(NPCHAR *npc)
{
RECT rect2[5];
RECT rect6[2];
RECT rcLast[1];
rect2[0] = {32, 80, 48, 96};
rect2[1] = {48, 80, 64, 96};
rect6[0] = {64, 80, 80, 96};
rect6[1] = {80, 80, 96, 96};
rcLast[0] = {16, 0, 32, 16};
if (npc->direct == 0)
{
if (++npc->ani_wait > 2)
{
npc->ani_wait = 0;
++npc->ani_no;
}
if (npc->ani_no > 1)
npc->ani_no = 0;
}
if (gBack.type == 5 || gBack.type == 6)
{
if (npc->act_no == 0)
{
npc->act_no = 1;
npc->ym = Random(-0x20, 0x20);
npc->xm = Random(0x7F, 0x100);
}
npc->xm -= 8;
if (npc->x < 0xA000)
npc->cond = 0;
if (npc->x < -0x600)
npc->x = -0x600;
if (npc->flag & 1)
npc->xm = 0x100;
if (npc->flag & 2)
npc->ym = 0x40;
if (npc->flag & 8)
npc->ym = -0x40;
npc->x += npc->xm;
npc->y += npc->ym;
}
switch (npc->exp)
{
case 2:
npc->rect = rect2[npc->ani_no];
break;
case 6:
npc->rect = rect6[npc->ani_no];
break;
}
if (npc->direct == 0)
++npc->count1;
if (npc->count1 > 550)
npc->cond = 0;
if (npc->count1 > 500 && npc->count1 / 2 % 2)
npc->rect.right = 0;
if (npc->count1 > 547)
npc->rect = rcLast[0];
}

View file

@ -9,6 +9,16 @@
#include "Back.h" #include "Back.h"
#include "Triangle.h" #include "Triangle.h"
//Red petals
void ActNpc116(NPCHAR *npc)
{
RECT rc[1];
rc[0] = {272, 184, 320, 200};
npc->rect = rc[0];
}
//Table and chair //Table and chair
void ActNpc119(NPCHAR *npc) void ActNpc119(NPCHAR *npc)
{ {

37
src/NpcAct120.cpp Normal file
View file

@ -0,0 +1,37 @@
#include "WindowsWrapper.h"
#include "NpcAct.h"
#include "MyChar.h"
#include "NpChar.h"
#include "Game.h"
#include "Sound.h"
#include "Back.h"
#include "Triangle.h"
//Hidden item
void ActNpc125(NPCHAR *npc)
{
if (npc->life < 990)
{
SetDestroyNpChar(npc->x, npc->y, npc->view.back, 8);
PlaySoundObject(70, 1);
if (npc->direct)
SetNpChar(86, npc->x, npc->y, 0, 0, 2, 0, 0);
else
SetNpChar(87, npc->x, npc->y, 0, 0, 2, 0, 0);
npc->cond = 0;
}
RECT rc[2];
rc[0] = {0, 96, 16, 112};
rc[1] = {16, 96, 32, 112};
if (npc->direct == 0)
npc->rect = rc[0];
else
npc->rect = rc[1];
}

56
src/NpcAct140.cpp Normal file
View file

@ -0,0 +1,56 @@
#include "WindowsWrapper.h"
#include "NpcAct.h"
#include "MyChar.h"
#include "NpChar.h"
#include "Game.h"
#include "Sound.h"
#include "Back.h"
#include "Triangle.h"
//Blue robot (standing)
void ActNpc151(NPCHAR *npc)
{
RECT rcLeft[2];
RECT rcRight[2];
rcLeft[0] = {192, 0, 208, 16};
rcLeft[1] = {208, 0, 224, 16};
rcRight[0] = {192, 16, 208, 32};
rcRight[1] = {208, 16, 224, 32};
switch (npc->act_no)
{
case 0:
npc->act_no = 1;
npc->ani_no = 0;
npc->ani_wait = 0;
// Fallthrough
case 1:
if (Random(0, 100) == 0)
{
npc->act_no = 2;
npc->act_wait = 0;
npc->ani_no = 1;
}
break;
case 2:
if (++npc->act_wait > 16)
{
npc->act_no = 1;
npc->ani_no = 0;
}
break;
}
if (npc->direct == 0)
npc->rect = rcLeft[npc->ani_no];
else
npc->rect = rcRight[npc->ani_no];
}

View file

@ -63,7 +63,7 @@ NPCFUNCTION gpNpcFuncTbl[361] =
ActNpc004, ActNpc004,
ActNpc005, ActNpc005,
ActNpc006, ActNpc006,
nullptr, ActNpc007,
ActNpc008, ActNpc008,
nullptr, nullptr,
nullptr, nullptr,
@ -81,16 +81,16 @@ NPCFUNCTION gpNpcFuncTbl[361] =
ActNpc022, ActNpc022,
ActNpc023, ActNpc023,
nullptr, nullptr,
ActNpc025,
nullptr, nullptr,
nullptr, nullptr,
nullptr, nullptr,
nullptr, ActNpc029,
nullptr,
ActNpc030, ActNpc030,
nullptr, nullptr,
ActNpc032, ActNpc032,
nullptr, nullptr,
nullptr, ActNpc034,
nullptr, nullptr,
nullptr, nullptr,
ActNpc037, ActNpc037,
@ -140,6 +140,10 @@ NPCFUNCTION gpNpcFuncTbl[361] =
nullptr, nullptr,
nullptr, nullptr,
ActNpc083, ActNpc083,
ActNpc084,
ActNpc085,
ActNpc086,
ActNpc087,
nullptr, nullptr,
nullptr, nullptr,
nullptr, nullptr,
@ -168,11 +172,7 @@ NPCFUNCTION gpNpcFuncTbl[361] =
nullptr, nullptr,
nullptr, nullptr,
nullptr, nullptr,
nullptr, ActNpc116,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr, nullptr,
nullptr, nullptr,
ActNpc119, ActNpc119,
@ -181,7 +181,7 @@ NPCFUNCTION gpNpcFuncTbl[361] =
nullptr, nullptr,
nullptr, nullptr,
nullptr, nullptr,
nullptr, ActNpc125,
nullptr, nullptr,
nullptr, nullptr,
nullptr, nullptr,