FRig
This commit is contained in:
parent
042e90dbef
commit
be3056c8bb
4 changed files with 338 additions and 5 deletions
|
@ -12,11 +12,13 @@ void ActNpc006(NPCHAR *npc);
|
|||
void ActNpc007(NPCHAR *npc);
|
||||
void ActNpc008(NPCHAR *npc);
|
||||
|
||||
void ActNpc012(NPCHAR *npc);
|
||||
|
||||
void ActNpc015(NPCHAR *npc);
|
||||
void ActNpc016(NPCHAR *npc);
|
||||
void ActNpc017(NPCHAR *npc);
|
||||
void ActNpc018(NPCHAR *npc);
|
||||
|
||||
void ActNpc019(NPCHAR *npc);
|
||||
void ActNpc020(NPCHAR *npc);
|
||||
void ActNpc021(NPCHAR *npc);
|
||||
void ActNpc022(NPCHAR *npc);
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
#include "MyChar.h"
|
||||
#include "NpChar.h"
|
||||
#include "Game.h"
|
||||
#include "Map.h"
|
||||
#include "Sound.h"
|
||||
#include "Frame.h"
|
||||
#include "Back.h"
|
||||
#include "Triangle.h"
|
||||
|
||||
|
@ -805,6 +807,230 @@ void ActNpc008(NPCHAR *npc)
|
|||
//Balrog (cutscene)
|
||||
void ActNpc012(NPCHAR *npc)
|
||||
{
|
||||
int x, y;
|
||||
switch (npc->act_no)
|
||||
{
|
||||
case 0:
|
||||
if (npc->direct == 4)
|
||||
{
|
||||
if (npc->x <= gMC.x)
|
||||
npc->direct = 2;
|
||||
else
|
||||
npc->direct = 0;
|
||||
}
|
||||
npc->act_no = 1;
|
||||
npc->ani_no = 0;
|
||||
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;
|
||||
case 10:
|
||||
if (npc->direct == 4)
|
||||
{
|
||||
if (npc->x <= gMC.x)
|
||||
npc->direct = 2;
|
||||
else
|
||||
npc->direct = 0;
|
||||
}
|
||||
npc->act_no = 11;
|
||||
npc->ani_no = 2;
|
||||
npc->act_wait = 0;
|
||||
npc->tgt_x = 0;
|
||||
case 11:
|
||||
if ( ++npc->act_wait > 30 )
|
||||
{
|
||||
npc->act_no = 12;
|
||||
npc->act_wait = 0;
|
||||
npc->ani_no = 3;
|
||||
npc->ym = -0x800;
|
||||
npc->bits |= npc_ignoreSolid;
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
if (npc->flag & 5)
|
||||
npc->xm = 0;
|
||||
if (npc->y < 0)
|
||||
{
|
||||
npc->code_char = 0;
|
||||
PlaySoundObject(26, 1);
|
||||
SetQuake(30);
|
||||
}
|
||||
break;
|
||||
case 20:
|
||||
if (npc->direct == 4)
|
||||
{
|
||||
if (npc->x <= gMC.x)
|
||||
npc->direct = 2;
|
||||
else
|
||||
npc->direct = 0;
|
||||
}
|
||||
npc->act_no = 21;
|
||||
npc->ani_no = 5;
|
||||
npc->act_wait = 0;
|
||||
npc->count1 = 0;
|
||||
for (int i = 0; i < 4; i++)
|
||||
SetNpChar(4, npc->x + (Random(-12, 12) << 9), npc->y + (Random(-12, 12) << 9), Random(-0x155, 0x155), Random(-0x600, 0), 0, 0, 0x100);
|
||||
PlaySoundObject(72, 1);
|
||||
case 21:
|
||||
npc->tgt_x = 1;
|
||||
if (npc->flag & 8)
|
||||
++npc->act_wait;
|
||||
if (++npc->count1 / 2 & 1)
|
||||
npc->x += 0x200;
|
||||
else
|
||||
npc->x -= 0x200;
|
||||
if (npc->act_wait > 100)
|
||||
{
|
||||
npc->act_no = 11;
|
||||
npc->act_wait = 0;
|
||||
npc->ani_no = 2;
|
||||
}
|
||||
npc->ym += 0x20;
|
||||
if (npc->ym > 0x5FF)
|
||||
npc->ym = 0x5FF;
|
||||
break;
|
||||
case 30:
|
||||
npc->ani_no = 4;
|
||||
if (++npc->act_wait > 100)
|
||||
{
|
||||
npc->act_no = 0;
|
||||
npc->ani_no = 0;
|
||||
}
|
||||
break;
|
||||
case 40:
|
||||
if (npc->direct == 4)
|
||||
{
|
||||
if (npc->x <= gMC.x)
|
||||
npc->direct = 2;
|
||||
else
|
||||
npc->direct = 0;
|
||||
}
|
||||
npc->act_no = 41;
|
||||
npc->act_wait = 0;
|
||||
npc->ani_no = 5;
|
||||
case 41:
|
||||
if (++npc->ani_wait / 2 & 1)
|
||||
npc->ani_no = 5;
|
||||
else
|
||||
npc->ani_no = 6;
|
||||
break;
|
||||
case 42:
|
||||
if (npc->direct == 4)
|
||||
{
|
||||
if (npc->x <= gMC.x)
|
||||
npc->direct = 2;
|
||||
else
|
||||
npc->direct = 0;
|
||||
}
|
||||
npc->act_no = 43;
|
||||
npc->act_wait = 0;
|
||||
npc->ani_no = 6;
|
||||
case 43:
|
||||
if (++npc->ani_wait / 2 & 1)
|
||||
npc->ani_no = 7;
|
||||
else
|
||||
npc->ani_no = 6;
|
||||
break;
|
||||
case 50:
|
||||
npc->ani_no = 8;
|
||||
npc->xm = 0;
|
||||
break;
|
||||
case 60:
|
||||
npc->act_no = 61;
|
||||
npc->ani_no = 9;
|
||||
npc->ani_wait = 0;
|
||||
case 61:
|
||||
if (++npc->ani_wait > 3)
|
||||
{
|
||||
npc->ani_wait = 0;
|
||||
if (++npc->ani_no == 10 || npc->ani_no == 11)
|
||||
PlaySoundObject(23, 1);
|
||||
}
|
||||
if (npc->ani_no > 12)
|
||||
npc->ani_no = 9;
|
||||
if (npc->direct)
|
||||
npc->xm = 0x200;
|
||||
else
|
||||
npc->xm = -0x200;
|
||||
break;
|
||||
case 70:
|
||||
npc->act_no = 71;
|
||||
npc->act_wait = 64;
|
||||
PlaySoundObject(29, 1);
|
||||
npc->ani_no = 13;
|
||||
case 71:
|
||||
if (!--npc->act_wait)
|
||||
npc->cond = 0;
|
||||
break;
|
||||
case 80:
|
||||
npc->count1 = 0;
|
||||
npc->act_no = 81;
|
||||
case 81:
|
||||
if (++npc->count1 / 2 & 1)
|
||||
npc->x += 0x200;
|
||||
else
|
||||
npc->x -= 0x200;
|
||||
npc->ani_no = 5;
|
||||
npc->xm = 0;
|
||||
npc->ym += 32;
|
||||
break;
|
||||
case 100:
|
||||
npc->act_no = 101;
|
||||
npc->act_wait = 0;
|
||||
npc->ani_no = 2;
|
||||
case 101:
|
||||
if (++npc->act_wait > 20)
|
||||
{
|
||||
npc->act_no = 102;
|
||||
npc->act_wait = 0;
|
||||
npc->ani_no = 3;
|
||||
npc->ym = -0x800;
|
||||
npc->bits |= npc_ignoreSolid;
|
||||
DeleteNpCharCode(150, 0);
|
||||
DeleteNpCharCode(117, 0);
|
||||
SetNpChar(355, 0, 0, 0, 0, 0, npc, 0x100);
|
||||
SetNpChar(355, 0, 0, 0, 0, 1, npc, 0x100);
|
||||
}
|
||||
break;
|
||||
case 102:
|
||||
x = npc->x / 0x2000;
|
||||
y = npc->y / 0x2000;
|
||||
if (y >= 0 && y <= 34 && ChangeMapParts(x, y, 0))
|
||||
{
|
||||
ChangeMapParts(x - 1, y, 0);
|
||||
ChangeMapParts(x + 1, y, 0);
|
||||
PlaySoundObject(44, 1);
|
||||
SetQuake2(10);
|
||||
}
|
||||
if (npc->y < -0x4000)
|
||||
{
|
||||
npc->code_char = 0;
|
||||
SetQuake(30);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (npc->tgt_x && !Random(0, 10))
|
||||
SetNpChar(4, npc->x + (Random(-12, 12) << 9), npc->y + (Random(-12, 12) << 9), Random(-0x155, 0x155), Random(-0x600, 0), 0, 0, 0x100);
|
||||
|
||||
if (npc->ym > 0x5FF)
|
||||
npc->ym = 0x5FF;
|
||||
npc->x += npc->xm;
|
||||
npc->y += npc->ym;
|
||||
|
||||
RECT rect_left[14];
|
||||
RECT rect_right[14];
|
||||
|
||||
|
@ -837,6 +1063,18 @@ void ActNpc012(NPCHAR *npc)
|
|||
rect_right[11] = {40, 72, 80, 96};
|
||||
rect_right[12] = {0, 24, 40, 48};
|
||||
rect_right[13] = {280, 24, 320, 48};
|
||||
|
||||
if (npc->direct)
|
||||
npc->rect = rect_right[npc->ani_no];
|
||||
else
|
||||
npc->rect = rect_left[npc->ani_no];
|
||||
|
||||
if (npc->act_no == 71)
|
||||
{
|
||||
npc->rect.bottom = npc->act_wait / 2 + npc->rect.top;
|
||||
if (npc->act_wait & 1)
|
||||
++npc->rect.left;
|
||||
}
|
||||
}
|
||||
|
||||
//Chest (closed)
|
||||
|
@ -1049,7 +1287,7 @@ void ActNpc018(NPCHAR *npc)
|
|||
break;
|
||||
|
||||
case 1:
|
||||
for (int i = 0; i < 4; ++i)
|
||||
for (int i = 0; i < 4; i++)
|
||||
SetNpChar(4, npc->x, npc->y, Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
|
||||
|
||||
npc->act_no = 0;
|
||||
|
@ -1057,3 +1295,80 @@ void ActNpc018(NPCHAR *npc)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Balrog (burst)
|
||||
void ActNpc019(NPCHAR *npc)
|
||||
{
|
||||
switch ( npc->act_no )
|
||||
{
|
||||
case 0:
|
||||
for (int i = 0; i < 16; i++)
|
||||
SetNpChar(4, npc->x, npc->y, Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
|
||||
npc->y += 0x1400;
|
||||
npc->act_no = 1;
|
||||
npc->ani_no = 3;
|
||||
npc->ym = -0x100;
|
||||
PlaySoundObject(12, 1);
|
||||
PlaySoundObject(26, 1);
|
||||
SetQuake(30);
|
||||
case 1:
|
||||
npc->ym += 0x10;
|
||||
if (npc->ym > 0 && npc->flag & 8)
|
||||
{
|
||||
npc->act_no = 2;
|
||||
npc->ani_no = 2;
|
||||
npc->act_wait = 0;
|
||||
PlaySoundObject(26, 1);
|
||||
SetQuake(30);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (++npc->act_wait > 16)
|
||||
{
|
||||
npc->act_no = 3;
|
||||
npc->ani_no = 0;
|
||||
npc->ani_wait = 0;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (Random(0, 100) == 0)
|
||||
{
|
||||
npc->act_no = 4;
|
||||
npc->act_wait = 0;
|
||||
npc->ani_no = 1;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (++npc->act_wait > 16)
|
||||
{
|
||||
npc->act_no = 3;
|
||||
npc->ani_no = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (npc->ym > 0x5FF)
|
||||
npc->ym = 0x5FF;
|
||||
if (npc->ym < -0x5FF)
|
||||
npc->ym = -0x5FF;
|
||||
npc->x += npc->xm;
|
||||
npc->y += npc->ym;
|
||||
|
||||
RECT rect_left[4];
|
||||
RECT rect_right[4];
|
||||
rect_left[0] = {0, 0, 40, 24};
|
||||
rect_left[1] = {160, 0, 200, 24};
|
||||
rect_left[2] = {80, 0, 120, 24};
|
||||
rect_left[3] = {120, 0, 160, 24};
|
||||
rect_right[0] = {0, 24, 40, 48};
|
||||
rect_right[1] = {160, 24, 200, 48};
|
||||
rect_right[2] = {80, 24, 120, 48};
|
||||
rect_right[3] = {120, 24, 160, 48};
|
||||
|
||||
if (npc->direct)
|
||||
npc->rect = rect_right[npc->ani_no];
|
||||
else
|
||||
npc->rect = rect_left[npc->ani_no];
|
||||
}
|
||||
|
|
|
@ -68,14 +68,14 @@ NPCFUNCTION gpNpcFuncTbl[361] =
|
|||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
ActNpc012,
|
||||
nullptr,
|
||||
nullptr,
|
||||
ActNpc015,
|
||||
ActNpc016,
|
||||
ActNpc017,
|
||||
ActNpc018,
|
||||
nullptr,
|
||||
ActNpc019,
|
||||
ActNpc020,
|
||||
ActNpc021,
|
||||
ActNpc022,
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "MycParam.h"
|
||||
#include "Flags.h"
|
||||
#include "Profile.h"
|
||||
#include "Map.h"
|
||||
#include "MapName.h"
|
||||
#include "KeyControl.h"
|
||||
#include "NpChar.h"
|
||||
|
@ -983,6 +984,21 @@ int TextScriptProc()
|
|||
MoveNpChar(w, x << 13, y << 13, z);
|
||||
gTS.p_read += 23;
|
||||
}
|
||||
else if (IS_COMMAND('S','M','P'))
|
||||
{
|
||||
x = GetTextScriptNo(gTS.p_read + 4);
|
||||
y = GetTextScriptNo(gTS.p_read + 9);
|
||||
ShiftMapParts(x, y);
|
||||
gTS.p_read += 13;
|
||||
}
|
||||
else if (IS_COMMAND('C','M','P'))
|
||||
{
|
||||
x = GetTextScriptNo(gTS.p_read + 4);
|
||||
y = GetTextScriptNo(gTS.p_read + 9);
|
||||
z = GetTextScriptNo(gTS.p_read + 14);
|
||||
ChangeMapParts(x, y, z);
|
||||
gTS.p_read += 18;
|
||||
}
|
||||
else if (IS_COMMAND('M','Y','D'))
|
||||
{
|
||||
z = GetTextScriptNo(gTS.p_read + 4);
|
||||
|
|
Loading…
Add table
Reference in a new issue