More First Cave objects (also Kazuma's shelter ones)

This commit is contained in:
Clownacy 2019-01-28 11:11:35 +00:00
parent 56d249283d
commit daa858f09c
8 changed files with 296 additions and 11 deletions

View file

@ -58,8 +58,10 @@ SOURCES = \
MycParam \
NpcAct000 \
NpcAct020 \
NpcAct040 \
NpcAct060 \
NpcAct200 \
NpcAct340 \
NpChar \
NpcHit \
NpcTbl \

View file

@ -17,10 +17,22 @@ void ActNpc018(NPCHAR *npc);
void ActNpc020(NPCHAR *npc);
void ActNpc021(NPCHAR *npc);
void ActNpc022(NPCHAR *npc);
void ActNpc023(NPCHAR *npc);
void ActNpc039(NPCHAR *npc);
void ActNpc059(NPCHAR *npc);
void ActNpc062(NPCHAR *npc);
void ActNpc032(NPCHAR *npc);
void ActNpc064(NPCHAR *npc);
void ActNpc065(NPCHAR *npc);
void ActNpc073(NPCHAR *npc);
void ActNpc211(NPCHAR *npc);
void ActNpc359(NPCHAR *npc);

View file

@ -57,6 +57,56 @@ void ActNpc021(NPCHAR *npc)
npc->rect = rect[0];
}
//Teleporter
void ActNpc022(NPCHAR *npc)
{
RECT rect[2];
rect[0] = {240, 16, 264, 48};
rect[1] = {248, 152, 272, 184};
switch (npc->act_no)
{
case 0:
npc->ani_no = 0;
break;
case 1:
if (++npc->ani_no > 1)
npc->ani_no = 0;
break;
}
npc->rect = rect[npc->ani_no];
}
//Teleporter lights
void ActNpc023(NPCHAR *npc)
{
RECT rect[8];
rect[0] = {264, 16, 288, 20};
rect[1] = {264, 20, 288, 24};
rect[2] = {264, 24, 288, 28};
rect[3] = {264, 28, 288, 32};
rect[4] = {264, 32, 288, 36};
rect[5] = {264, 36, 288, 40};
rect[6] = {264, 40, 288, 44};
rect[7] = {264, 44, 288, 48};
if (++npc->ani_wait > 1)
{
npc->ani_wait = 0;
++npc->ani_no;
}
if (npc->ani_no > 7)
npc->ani_no = 0;
npc->rect = rect[npc->ani_no];
}
//Life capsule
void ActNpc032(NPCHAR *npc)
{
@ -74,4 +124,21 @@ void ActNpc032(NPCHAR *npc)
npc->ani_no = 0;
npc->rect = rect[npc->ani_no];
}
}
//Save sign
void ActNpc039(NPCHAR *npc)
{
RECT rect[2];
rect[0] = {224, 64, 240, 80};
rect[1] = {240, 64, 256, 80};
if (npc->direct == 0)
npc->ani_no = 0;
else
npc->ani_no = 1;
npc->rect = rect[npc->ani_no];
}
>>>>>>> More First Cave objects (also Kazuma's shelter ones)

75
src/NpcAct040.cpp Normal file
View file

@ -0,0 +1,75 @@
#include "WindowsWrapper.h"
#include "NpcAct.h"
#include "MyChar.h"
#include "NpChar.h"
#include "Game.h"
#include "Sound.h"
#include "Back.h"
#include "Triangle.h"
//Eye door
void ActNpc059(NPCHAR *npc)
{
RECT rcLeft[4];
rcLeft[0] = {224, 16, 240, 40};
rcLeft[1] = {208, 80, 224, 104};
rcLeft[2] = {224, 80, 240, 104};
rcLeft[3] = {240, 80, 256, 104};
switch (npc->act_no)
{
case 0:
npc->act_no = 1;
// Fallthrough
case 1:
if (npc->x - 0x8000 < gMC.x && npc->x + 0x8000 > gMC.x && npc->y - 0x8000 < gMC.y && npc->y + 0x8000 > gMC.y)
{
npc->act_no = 2;
npc->ani_wait = 0;
}
break;
case 2:
if (++npc->ani_wait > 2)
{
npc->ani_wait = 0;
++npc->ani_no;
}
if (npc->ani_no == 2)
npc->act_no = 3;
break;
case 3:
if (npc->x - 0x8000 >= gMC.x || npc->x + 0x8000 <= gMC.x || npc->y - 0x8000 >= gMC.y || npc->y + 0x8000 <= gMC.y)
{
npc->act_no = 4;
npc->ani_wait = 0;
}
break;
case 4:
if (++npc->ani_wait > 2)
{
npc->ani_wait = 0;
--npc->ani_no;
}
if (npc->ani_no == 0)
npc->act_no = 1;
break;
}
if (npc->shock)
npc->rect = rcLeft[3];
else
npc->rect = rcLeft[npc->ani_no];
}

View file

@ -8,6 +8,75 @@
#include "Sound.h"
#include "Back.h"
#include "Triangle.h"
#include "Map.h"
//Kazuma at computer
void ActNpc062(NPCHAR *npc)
{
RECT rcLeft[3];
rcLeft[0] = {272, 192, 288, 216};
rcLeft[1] = {288, 192, 304, 216};
rcLeft[2] = {304, 192, 320, 216};
switch ( npc->act_no )
{
case 0:
npc->x -= 0x800;
npc->y += 0x2000;
npc->act_no = 1;
npc->ani_no = 0;
npc->ani_wait = 0;
// Fallthrough
case 1:
if (++npc->ani_wait > 2)
{
npc->ani_wait = 0;
++npc->ani_no;
}
if (npc->ani_no > 1)
npc->ani_no = 0;
if (Random(0, 80) == 1)
{
npc->act_no = 2;
npc->act_wait = 0;
npc->ani_no = 1;
}
if (Random(0, 120) == 10)
{
npc->act_no = 3;
npc->act_wait = 0;
npc->ani_no = 2;
}
break;
case 2:
if (++npc->act_wait > 40)
{
npc->act_no = 3;
npc->act_wait = 0;
npc->ani_no = 2;
}
break;
case 3:
if (++npc->act_wait > 80)
{
npc->act_no = 1;
npc->ani_no = 0;
}
break;
}
npc->rect = rcLeft[npc->ani_no];
}
//First Cave Critter
void ActNpc064(NPCHAR *npc)
@ -116,7 +185,6 @@ void ActNpc064(NPCHAR *npc)
npc->rect = rcRight[npc->ani_no];
}
//First Cave Bat
void ActNpc065(NPCHAR *npc)
{
@ -188,4 +256,47 @@ void ActNpc065(NPCHAR *npc)
else
npc->rect = rect_right[npc->ani_no];
}
//Water droplet
void ActNpc073(NPCHAR *npc)
{
RECT rect[5];
rect[0] = {72, 16, 74, 18};
rect[1] = {74, 16, 76, 18};
rect[2] = {76, 16, 78, 18};
rect[3] = {78, 16, 80, 18};
rect[4] = {80, 16, 82, 18};
npc->ym += 0x20;
npc->ani_no = Random(0, 4);
if (npc->ym > 0x5FF)
npc->ym = 0x5FF;
npc->x += npc->xm;
npc->y += npc->ym;
npc->rect = rect[npc->ani_no];
if (npc->direct == 2)
{
npc->rect.top += 2;
npc->rect.bottom += 2;
}
if (++npc->act_wait > 10)
{
if (npc->flag & 1)
npc->cond = 0;
if (npc->flag & 4)
npc->cond = 0;
if (npc->flag & 8)
npc->cond = 0;
if (npc->flag & 0x100)
npc->cond = 0;
}
if (npc->y > gMap.length * 0x10 * 0x200)
npc->cond = 0;
}

View file

@ -21,4 +21,3 @@ void ActNpc211(NPCHAR *npc)
npc->rect = rects[npc->code_event];
}

18
src/NpcAct340.cpp Normal file
View file

@ -0,0 +1,18 @@
#include "WindowsWrapper.h"
#include "NpcAct.h"
#include "CommonDefines.h"
#include "MyChar.h"
#include "NpChar.h"
#include "Game.h"
#include "Sound.h"
#include "Back.h"
#include "Triangle.h"
//Water droplet generator
void ActNpc359(NPCHAR *npc)
{
if (gMC.x < npc->x + (((WINDOW_WIDTH / 2) + 160) * 0x200) && gMC.x > npc->x - (((WINDOW_WIDTH / 2) + 160) * 0x200) && gMC.y < npc->y + (((WINDOW_HEIGHT / 2) + 200) * 0x200) && gMC.y > npc->y - (((WINDOW_HEIGHT / 2) + 40) * 0x200) && Random(0, 100) == 2)
SetNpChar(73, npc->x + (Random(-6, 6) * 0x200), npc->y - 0xE00, 0, 0, 0, 0, 0);
}

View file

@ -54,7 +54,7 @@ void ReleaseNpcTable()
}
//Npc function table
NPCFUNCTION gpNpcFuncTbl[] =
NPCFUNCTION gpNpcFuncTbl[361] =
{
ActNpc000,
ActNpc001,
@ -78,6 +78,8 @@ NPCFUNCTION gpNpcFuncTbl[] =
nullptr,
ActNpc020,
ActNpc021,
ActNpc022,
ActNpc023,
nullptr,
nullptr,
nullptr,
@ -93,6 +95,7 @@ NPCFUNCTION gpNpcFuncTbl[] =
nullptr,
nullptr,
nullptr,
ActNpc039,
nullptr,
nullptr,
nullptr,
@ -112,13 +115,10 @@ NPCFUNCTION gpNpcFuncTbl[] =
nullptr,
nullptr,
nullptr,
ActNpc059,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
ActNpc062,
nullptr,
ActNpc064,
ActNpc065,
@ -129,7 +129,7 @@ NPCFUNCTION gpNpcFuncTbl[] =
nullptr,
nullptr,
nullptr,
nullptr,
ActNpc073,
nullptr,
nullptr,
nullptr,
@ -415,5 +415,6 @@ NPCFUNCTION gpNpcFuncTbl[] =
nullptr,
nullptr,
nullptr,
ActNpc359,
nullptr,
};