More NPCs, and added Flash.cpp
This commit is contained in:
parent
d1120d793b
commit
8954e9aaca
10 changed files with 897 additions and 16 deletions
1
Makefile
1
Makefile
|
@ -50,6 +50,7 @@ SOURCES = \
|
||||||
Escape \
|
Escape \
|
||||||
Fade \
|
Fade \
|
||||||
Flags \
|
Flags \
|
||||||
|
Flash \
|
||||||
Font \
|
Font \
|
||||||
Frame \
|
Frame \
|
||||||
Game \
|
Game \
|
||||||
|
|
153
src/Flash.cpp
Normal file
153
src/Flash.cpp
Normal file
|
@ -0,0 +1,153 @@
|
||||||
|
#include "Flash.h"
|
||||||
|
|
||||||
|
#include "Draw.h"
|
||||||
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
|
static struct
|
||||||
|
{
|
||||||
|
int mode;
|
||||||
|
int act_no;
|
||||||
|
bool flag;
|
||||||
|
int cnt;
|
||||||
|
int width;
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
RECT rect1;
|
||||||
|
RECT rect2;
|
||||||
|
} flash;
|
||||||
|
|
||||||
|
static unsigned long gFlashColor;
|
||||||
|
|
||||||
|
void InitFlash(void)
|
||||||
|
{
|
||||||
|
gFlashColor = 0xFEFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetFlash(int x, int y, int mode)
|
||||||
|
{
|
||||||
|
flash.act_no = 0;
|
||||||
|
flash.flag = true;
|
||||||
|
flash.x = x;
|
||||||
|
flash.y = y;
|
||||||
|
flash.mode = mode;
|
||||||
|
flash.cnt = 0;
|
||||||
|
flash.width = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ActFlash_Explosion(int flx, int fly)
|
||||||
|
{
|
||||||
|
if (flash.act_no == 0)
|
||||||
|
{
|
||||||
|
flash.cnt += 0x200;
|
||||||
|
flash.width += flash.cnt;
|
||||||
|
|
||||||
|
int right = (flash.x - flx - flash.width) / 0x200;
|
||||||
|
int left = (flash.y - fly - flash.width) / 0x200;
|
||||||
|
int top = (flash.width + flash.x - flx) / 0x200;
|
||||||
|
int bottom = (flash.width + flash.y - fly) / 0x200;
|
||||||
|
|
||||||
|
if (right < 0)
|
||||||
|
right = 0;
|
||||||
|
if (left < 0)
|
||||||
|
left = 0;
|
||||||
|
if (top > 320)
|
||||||
|
top = 320;
|
||||||
|
if (bottom > 240)
|
||||||
|
bottom = 240;
|
||||||
|
|
||||||
|
flash.rect1.left = right;
|
||||||
|
flash.rect1.right = top;
|
||||||
|
flash.rect1.top = 0;
|
||||||
|
flash.rect1.bottom = 240;
|
||||||
|
|
||||||
|
flash.rect2.left = 0;
|
||||||
|
flash.rect2.right = 320;
|
||||||
|
flash.rect2.top = left;
|
||||||
|
flash.rect2.bottom = bottom;
|
||||||
|
|
||||||
|
if (flash.width > 0xA0000)
|
||||||
|
{
|
||||||
|
flash.act_no = 1;
|
||||||
|
flash.cnt = 0;
|
||||||
|
flash.width = 0x1E000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (flash.act_no == 1)
|
||||||
|
{
|
||||||
|
flash.width -= flash.width / 8;
|
||||||
|
|
||||||
|
if ((flash.width / 0x100) == 0)
|
||||||
|
flash.flag = false;
|
||||||
|
|
||||||
|
int top = (flash.y - fly - flash.width) / 0x200;
|
||||||
|
if (top < 0)
|
||||||
|
top = 0;
|
||||||
|
|
||||||
|
int bottom = (flash.width + flash.y - fly) / 0x200;
|
||||||
|
if (bottom > 240)
|
||||||
|
bottom = 240;
|
||||||
|
|
||||||
|
flash.rect1.left = 0;
|
||||||
|
flash.rect1.right = 0;
|
||||||
|
flash.rect1.top = 0;
|
||||||
|
flash.rect1.bottom = 0;
|
||||||
|
|
||||||
|
flash.rect2.top = top;
|
||||||
|
flash.rect2.bottom = bottom;
|
||||||
|
flash.rect2.left = 0;
|
||||||
|
flash.rect2.right = 320;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ActFlash_Flash(void)
|
||||||
|
{
|
||||||
|
++flash.cnt;
|
||||||
|
|
||||||
|
flash.rect1.left = 0;
|
||||||
|
flash.rect1.right = 0;
|
||||||
|
flash.rect1.top = 0;
|
||||||
|
flash.rect1.bottom = 0;
|
||||||
|
|
||||||
|
if (flash.cnt / 2 % 2)
|
||||||
|
{
|
||||||
|
flash.rect2.top = 0;
|
||||||
|
flash.rect2.bottom = 240;
|
||||||
|
flash.rect2.left = 0;
|
||||||
|
flash.rect2.right = 320;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flash.rect2.left = 0;
|
||||||
|
flash.rect2.right = 0;
|
||||||
|
flash.rect2.top = 0;
|
||||||
|
flash.rect2.bottom = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flash.cnt > 20)
|
||||||
|
flash.flag = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ActFlash(int flx, int fly)
|
||||||
|
{
|
||||||
|
if (flash.flag)
|
||||||
|
{
|
||||||
|
if (flash.mode == 1)
|
||||||
|
ActFlash_Explosion(flx, fly);
|
||||||
|
else if (flash.mode == 2)
|
||||||
|
ActFlash_Flash();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PutFlash(void)
|
||||||
|
{
|
||||||
|
if (flash.flag)
|
||||||
|
{
|
||||||
|
CortBox(&flash.rect1, gFlashColor);
|
||||||
|
CortBox(&flash.rect2, gFlashColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResetFlash(void)
|
||||||
|
{
|
||||||
|
flash.flag = false;
|
||||||
|
}
|
9
src/Flash.h
Normal file
9
src/Flash.h
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
void InitFlash(void);
|
||||||
|
void SetFlash(int x, int y, int mode);
|
||||||
|
void ActFlash_Explosion(int flx, int fly);
|
||||||
|
void ActFlash_Flash(void);
|
||||||
|
void ActFlash(int flx, int fly);
|
||||||
|
void PutFlash(void);
|
||||||
|
void ResetFlash(void);
|
|
@ -36,6 +36,7 @@
|
||||||
#include "ValueView.h"
|
#include "ValueView.h"
|
||||||
#include "Draw.h"
|
#include "Draw.h"
|
||||||
#include "Ending.h"
|
#include "Ending.h"
|
||||||
|
#include "Flash.h"
|
||||||
|
|
||||||
int g_GameFlags;
|
int g_GameFlags;
|
||||||
int gCounter;
|
int gCounter;
|
||||||
|
@ -101,7 +102,7 @@ int ModeOpening()
|
||||||
InitCaret();
|
InitCaret();
|
||||||
//InitStar();
|
//InitStar();
|
||||||
InitFade();
|
InitFade();
|
||||||
//InitFlash();
|
InitFlash();
|
||||||
//InitBossLife();
|
//InitBossLife();
|
||||||
ChangeMusic(0);
|
ChangeMusic(0);
|
||||||
TransferStage(72, 100, 3, 3);
|
TransferStage(72, 100, 3, 3);
|
||||||
|
@ -434,7 +435,7 @@ int ModeAction()
|
||||||
InitCaret();
|
InitCaret();
|
||||||
//InitStar();
|
//InitStar();
|
||||||
InitFade();
|
InitFade();
|
||||||
//InitFlash();
|
InitFlash();
|
||||||
ClearArmsData();
|
ClearArmsData();
|
||||||
ClearItemData();
|
ClearItemData();
|
||||||
//ClearPermitStage();
|
//ClearPermitStage();
|
||||||
|
@ -485,7 +486,7 @@ int ModeAction()
|
||||||
ActBullet();
|
ActBullet();
|
||||||
ActCaret();
|
ActCaret();
|
||||||
MoveFrame3();
|
MoveFrame3();
|
||||||
//ActFlash(frame_x, frame_y);
|
ActFlash(frame_x, frame_y);
|
||||||
|
|
||||||
if (g_GameFlags & 2)
|
if (g_GameFlags & 2)
|
||||||
AnimationMyChar(true);
|
AnimationMyChar(true);
|
||||||
|
@ -513,7 +514,7 @@ int ModeAction()
|
||||||
PutMapDataVector(frame_x, frame_y);
|
PutMapDataVector(frame_x, frame_y);
|
||||||
PutStage_Front(frame_x, frame_y);
|
PutStage_Front(frame_x, frame_y);
|
||||||
PutFront(frame_x, frame_y);
|
PutFront(frame_x, frame_y);
|
||||||
//PutFlash();
|
PutFlash();
|
||||||
PutCaret(frame_x, frame_y);
|
PutCaret(frame_x, frame_y);
|
||||||
PutValueView(frame_x, frame_y);
|
PutValueView(frame_x, frame_y);
|
||||||
//PutBossLife();
|
//PutBossLife();
|
||||||
|
|
|
@ -16,7 +16,7 @@ void ActNpc015(NPCHAR *npc);
|
||||||
void ActNpc016(NPCHAR *npc);
|
void ActNpc016(NPCHAR *npc);
|
||||||
void ActNpc017(NPCHAR *npc);
|
void ActNpc017(NPCHAR *npc);
|
||||||
void ActNpc018(NPCHAR *npc);
|
void ActNpc018(NPCHAR *npc);
|
||||||
|
void ActNpc019(NPCHAR *npc);
|
||||||
void ActNpc020(NPCHAR *npc);
|
void ActNpc020(NPCHAR *npc);
|
||||||
void ActNpc021(NPCHAR *npc);
|
void ActNpc021(NPCHAR *npc);
|
||||||
void ActNpc022(NPCHAR *npc);
|
void ActNpc022(NPCHAR *npc);
|
||||||
|
@ -36,6 +36,7 @@ void ActNpc037(NPCHAR *npc);
|
||||||
void ActNpc038(NPCHAR *npc);
|
void ActNpc038(NPCHAR *npc);
|
||||||
void ActNpc039(NPCHAR *npc);
|
void ActNpc039(NPCHAR *npc);
|
||||||
|
|
||||||
|
void ActNpc041(NPCHAR *npc);
|
||||||
void ActNpc042(NPCHAR *npc);
|
void ActNpc042(NPCHAR *npc);
|
||||||
void ActNpc043(NPCHAR *npc);
|
void ActNpc043(NPCHAR *npc);
|
||||||
|
|
||||||
|
@ -46,10 +47,12 @@ void ActNpc059(NPCHAR *npc);
|
||||||
void ActNpc060(NPCHAR *npc);
|
void ActNpc060(NPCHAR *npc);
|
||||||
void ActNpc061(NPCHAR *npc);
|
void ActNpc061(NPCHAR *npc);
|
||||||
void ActNpc062(NPCHAR *npc);
|
void ActNpc062(NPCHAR *npc);
|
||||||
|
void ActNpc063(NPCHAR *npc);
|
||||||
void ActNpc064(NPCHAR *npc);
|
void ActNpc064(NPCHAR *npc);
|
||||||
void ActNpc065(NPCHAR *npc);
|
void ActNpc065(NPCHAR *npc);
|
||||||
|
void ActNpc066(NPCHAR *npc);
|
||||||
|
void ActNpc067(NPCHAR *npc);
|
||||||
|
void ActNpc068(NPCHAR *npc);
|
||||||
void ActNpc069(NPCHAR *npc);
|
void ActNpc069(NPCHAR *npc);
|
||||||
void ActNpc070(NPCHAR *npc);
|
void ActNpc070(NPCHAR *npc);
|
||||||
void ActNpc071(NPCHAR *npc);
|
void ActNpc071(NPCHAR *npc);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "Sound.h"
|
#include "Sound.h"
|
||||||
#include "Back.h"
|
#include "Back.h"
|
||||||
#include "Triangle.h"
|
#include "Triangle.h"
|
||||||
|
#include "Frame.h"
|
||||||
|
|
||||||
//Null
|
//Null
|
||||||
void ActNpc000(NPCHAR *npc)
|
void ActNpc000(NPCHAR *npc)
|
||||||
|
@ -1019,4 +1020,92 @@ void ActNpc018(NPCHAR *npc)
|
||||||
npc->rect = rect[0];
|
npc->rect = rect[0];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Balrog (burst)
|
||||||
|
void ActNpc019(NPCHAR *npc)
|
||||||
|
{
|
||||||
|
switch (npc->act_no)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
for (int i = 0; i < 0x10; ++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->y += 0x1400;
|
||||||
|
npc->act_no = 1;
|
||||||
|
npc->ani_no = 3;
|
||||||
|
npc->ym = -0x100;
|
||||||
|
PlaySoundObject(12, 1);
|
||||||
|
PlaySoundObject(26, 1);
|
||||||
|
SetQuake(30);
|
||||||
|
// Fallthrough
|
||||||
|
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 > 0x10)
|
||||||
|
{
|
||||||
|
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 > 0x10)
|
||||||
|
{
|
||||||
|
npc->act_no = 3;
|
||||||
|
npc->ani_no = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 == 0)
|
||||||
|
npc->rect = rect_left[npc->ani_no];
|
||||||
|
else
|
||||||
|
npc->rect = rect_right[npc->ani_no];
|
||||||
|
}
|
||||||
|
|
|
@ -9,7 +9,23 @@
|
||||||
#include "Back.h"
|
#include "Back.h"
|
||||||
#include "Triangle.h"
|
#include "Triangle.h"
|
||||||
|
|
||||||
// Sue
|
//Busted Door
|
||||||
|
void ActNpc041(NPCHAR *npc)
|
||||||
|
{
|
||||||
|
RECT rect[1];
|
||||||
|
|
||||||
|
rect[0] = {0, 80, 48, 112};
|
||||||
|
|
||||||
|
if (npc->act_no == 0)
|
||||||
|
{
|
||||||
|
++npc->act_no;
|
||||||
|
npc->y -= 0x2000; // Move a tile up
|
||||||
|
}
|
||||||
|
|
||||||
|
npc->rect = rect[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
//Sue
|
||||||
void ActNpc042(NPCHAR *npc)
|
void ActNpc042(NPCHAR *npc)
|
||||||
{
|
{
|
||||||
RECT rcLeft[13];
|
RECT rcLeft[13];
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
#include "Triangle.h"
|
#include "Triangle.h"
|
||||||
#include "Map.h"
|
#include "Map.h"
|
||||||
#include "CommonDefines.h"
|
#include "CommonDefines.h"
|
||||||
|
#include "Frame.h"
|
||||||
|
#include "MycParam.h"
|
||||||
|
#include "Flash.h"
|
||||||
|
|
||||||
//Toroko
|
//Toroko
|
||||||
void ActNpc060(NPCHAR *npc)
|
void ActNpc060(NPCHAR *npc)
|
||||||
|
@ -481,6 +484,142 @@ void ActNpc062(NPCHAR *npc)
|
||||||
npc->rect = rcLeft[npc->ani_no];
|
npc->rect = rcLeft[npc->ani_no];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Toroko with stick
|
||||||
|
void ActNpc063(NPCHAR *npc)
|
||||||
|
{
|
||||||
|
RECT rcLeft[8];
|
||||||
|
RECT rcRight[6];
|
||||||
|
|
||||||
|
rcLeft[0] = {64, 64, 80, 80};
|
||||||
|
rcLeft[1] = {80, 64, 96, 80};
|
||||||
|
rcLeft[2] = {64, 64, 80, 80};
|
||||||
|
rcLeft[3] = {96, 64, 112, 80};
|
||||||
|
rcLeft[4] = {112, 64, 128, 80};
|
||||||
|
rcLeft[5] = {128, 64, 144, 80};
|
||||||
|
|
||||||
|
rcRight[0] = {64, 80, 80, 96};
|
||||||
|
rcRight[1] = {80, 80, 96, 96};
|
||||||
|
rcRight[2] = {64, 80, 80, 96};
|
||||||
|
rcRight[3] = {96, 80, 112, 96};
|
||||||
|
rcRight[4] = {112, 80, 128, 96};
|
||||||
|
rcRight[5] = {128, 80, 144, 96};
|
||||||
|
|
||||||
|
switch (npc->act_no)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
npc->act_no = 1;
|
||||||
|
npc->act_wait = 0;
|
||||||
|
npc->ani_wait = 0;
|
||||||
|
npc->ym = -0x400;
|
||||||
|
// Fallthrough
|
||||||
|
case 1:
|
||||||
|
if (npc->ym > 0)
|
||||||
|
npc->bits &= ~8;
|
||||||
|
|
||||||
|
if (++npc->ani_wait > 2)
|
||||||
|
{
|
||||||
|
npc->ani_wait = 0;
|
||||||
|
++npc->ani_no;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (npc->ani_no > 3)
|
||||||
|
npc->ani_no = 0;
|
||||||
|
|
||||||
|
if (npc->direct == 0)
|
||||||
|
npc->xm = -0x100;
|
||||||
|
else
|
||||||
|
npc->xm = 0x100;
|
||||||
|
|
||||||
|
if (npc->act_wait++ && npc->flag & 8)
|
||||||
|
npc->act_no = 2;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
npc->act_no = 3;
|
||||||
|
npc->act_wait = 0;
|
||||||
|
npc->ani_no = 0;
|
||||||
|
npc->ani_wait = 0;
|
||||||
|
// Fallthrough
|
||||||
|
case 3:
|
||||||
|
if (++npc->ani_wait > 2)
|
||||||
|
{
|
||||||
|
npc->ani_wait = 0;
|
||||||
|
++npc->ani_no;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (npc->ani_no > 3)
|
||||||
|
npc->ani_no = 0;
|
||||||
|
|
||||||
|
if (++npc->act_wait > 50)
|
||||||
|
{
|
||||||
|
npc->act_wait = 40;
|
||||||
|
npc->xm = -npc->xm;
|
||||||
|
|
||||||
|
if (npc->direct == 0)
|
||||||
|
npc->direct = 2;
|
||||||
|
else
|
||||||
|
npc->direct = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (npc->act_wait > 35)
|
||||||
|
npc->bits |= 0x20;
|
||||||
|
|
||||||
|
if (npc->direct == 0)
|
||||||
|
npc->xm -= 0x40;
|
||||||
|
else
|
||||||
|
npc->xm += 0x40;
|
||||||
|
|
||||||
|
if (npc->shock)
|
||||||
|
{
|
||||||
|
npc->act_no = 4;
|
||||||
|
npc->ani_no = 4;
|
||||||
|
npc->ym = -0x400;
|
||||||
|
npc->bits &= ~0x20;
|
||||||
|
npc->damage = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
if (npc->direct == 0)
|
||||||
|
npc->xm = -0x100;
|
||||||
|
else
|
||||||
|
npc->xm = 0x100;
|
||||||
|
|
||||||
|
if (npc->act_wait++ && npc->flag & 8)
|
||||||
|
{
|
||||||
|
npc->act_no = 5;
|
||||||
|
npc->bits |= 0x2000;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
npc->xm = 0;
|
||||||
|
npc->ani_no = 5;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
npc->ym += 0x40;
|
||||||
|
|
||||||
|
if (npc->xm > 0x400)
|
||||||
|
npc->xm = 0x400;
|
||||||
|
if (npc->xm < -0x400)
|
||||||
|
npc->xm = -0x400;
|
||||||
|
|
||||||
|
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];
|
||||||
|
}
|
||||||
|
|
||||||
//First Cave Critter
|
//First Cave Critter
|
||||||
void ActNpc064(NPCHAR *npc)
|
void ActNpc064(NPCHAR *npc)
|
||||||
{
|
{
|
||||||
|
@ -660,6 +799,475 @@ void ActNpc065(NPCHAR *npc)
|
||||||
npc->rect = rect_right[npc->ani_no];
|
npc->rect = rect_right[npc->ani_no];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Misery bubble
|
||||||
|
void ActNpc066(NPCHAR *npc)
|
||||||
|
{
|
||||||
|
RECT rect[4];
|
||||||
|
|
||||||
|
rect[0] = {32, 192, 56, 216};
|
||||||
|
rect[1] = {56, 192, 80, 216};
|
||||||
|
rect[2] = {32, 216, 56, 240};
|
||||||
|
rect[3] = {56, 216, 80, 240};
|
||||||
|
|
||||||
|
switch (npc->act_no)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
for (int a = 0; a < 0x200; ++a)
|
||||||
|
{
|
||||||
|
if (gNPC[a].code_event == 1000)
|
||||||
|
{
|
||||||
|
npc->tgt_x = gNPC[a].x;
|
||||||
|
npc->tgt_y = gNPC[a].y;
|
||||||
|
npc->count1 = a;
|
||||||
|
unsigned char deg = GetArktan(npc->x - npc->tgt_x, npc->y - npc->tgt_y);
|
||||||
|
npc->xm = 2 * GetCos(deg);
|
||||||
|
npc->ym = 2 * GetSin(deg);
|
||||||
|
npc->act_no = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Fallthrough
|
||||||
|
case 1:
|
||||||
|
if (++npc->ani_wait > 1)
|
||||||
|
{
|
||||||
|
npc->ani_wait = 0;
|
||||||
|
++npc->ani_no;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (npc->ani_no > 1)
|
||||||
|
npc->ani_no = 0;
|
||||||
|
|
||||||
|
if (npc->tgt_x > npc->x - 0x600 && npc->tgt_x < npc->x + 0x600 && npc->tgt_y > npc->y - 0x600 && npc->tgt_y < npc->y + 0x600)
|
||||||
|
{
|
||||||
|
npc->act_no = 2;
|
||||||
|
npc->ani_no = 2;
|
||||||
|
gNPC[npc->count1].cond = 0;
|
||||||
|
PlaySoundObject(21, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
npc->xm -= 0x20;
|
||||||
|
npc->ym -= 0x20;
|
||||||
|
|
||||||
|
if (npc->xm < -0x5FF)
|
||||||
|
npc->xm = -0x5FF;
|
||||||
|
if (npc->ym < -0x5FF)
|
||||||
|
npc->ym = -0x5FF;
|
||||||
|
|
||||||
|
if (npc->y < -0x1000)
|
||||||
|
npc->cond = 0;
|
||||||
|
|
||||||
|
if (++npc->ani_wait > 3)
|
||||||
|
{
|
||||||
|
npc->ani_wait = 0;
|
||||||
|
++npc->ani_no;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (npc->ani_no > 3)
|
||||||
|
npc->ani_no = 2;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
npc->x += npc->xm;
|
||||||
|
npc->y += npc->ym;
|
||||||
|
|
||||||
|
npc->rect = rect[npc->ani_no];
|
||||||
|
}
|
||||||
|
|
||||||
|
//Misery (floating)
|
||||||
|
void ActNpc067(NPCHAR *npc)
|
||||||
|
{
|
||||||
|
switch (npc->act_no)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
npc->act_no = 1;
|
||||||
|
npc->tgt_x = npc->x;
|
||||||
|
npc->tgt_y = npc->y;
|
||||||
|
npc->ani_no = 0;
|
||||||
|
PlaySoundObject(29, 1);
|
||||||
|
// Fallthrough
|
||||||
|
case 1:
|
||||||
|
npc->x = npc->tgt_x + (Random(-1, 1) * 0x200);
|
||||||
|
|
||||||
|
if (++npc->act_wait == 0x20)
|
||||||
|
npc->act_no = 10;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 10:
|
||||||
|
npc->act_no = 11;
|
||||||
|
npc->act_wait = 0;
|
||||||
|
npc->ani_no = 0;
|
||||||
|
npc->ym = 0x200;
|
||||||
|
// Fallthrough
|
||||||
|
|
||||||
|
case 11:
|
||||||
|
if (npc->tgt_y < npc->y)
|
||||||
|
npc->ym -= 0x10;
|
||||||
|
if (npc->tgt_y > npc->y)
|
||||||
|
npc->ym += 0x10;
|
||||||
|
|
||||||
|
if (npc->ym > 0x100)
|
||||||
|
npc->ym = 0x100;
|
||||||
|
if (npc->ym < -0x100)
|
||||||
|
npc->ym = -0x100;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 13:
|
||||||
|
npc->ani_no = 1;
|
||||||
|
|
||||||
|
npc->ym += 0x40;
|
||||||
|
if (npc->ym > 0x5FF)
|
||||||
|
npc->ym = 0x5FF;
|
||||||
|
|
||||||
|
if (npc->flag & 8)
|
||||||
|
{
|
||||||
|
PlaySoundObject(23, 1);
|
||||||
|
npc->ym = 0;
|
||||||
|
npc->act_no = 14;
|
||||||
|
npc->bits |= 8;
|
||||||
|
npc->ani_no = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 15:
|
||||||
|
npc->act_no = 16;
|
||||||
|
npc->act_wait = 0;
|
||||||
|
npc->ani_no = 4;
|
||||||
|
// Fallthrough
|
||||||
|
case 16:
|
||||||
|
if (++npc->act_wait == 30)
|
||||||
|
{
|
||||||
|
PlaySoundObject(21, 1);
|
||||||
|
SetNpChar(66, npc->x, npc->y - 0x2000, 0, 0, 0, npc, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (npc->act_wait == 50)
|
||||||
|
npc->act_no = 14;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 20:
|
||||||
|
npc->act_no = 21;
|
||||||
|
npc->ani_no = 0;
|
||||||
|
npc->ym = 0;
|
||||||
|
npc->bits |= 8;
|
||||||
|
// Fallthrough
|
||||||
|
case 21:
|
||||||
|
npc->ym -= 0x20;
|
||||||
|
|
||||||
|
if (npc->y < -0x1000)
|
||||||
|
npc->cond = 0;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 25:
|
||||||
|
npc->act_no = 26;
|
||||||
|
npc->act_wait = 0;
|
||||||
|
npc->ani_no = 5;
|
||||||
|
npc->ani_wait = 0;
|
||||||
|
// Fallthrough
|
||||||
|
case 26:
|
||||||
|
if (++npc->ani_no > 7)
|
||||||
|
npc->ani_no = 5;
|
||||||
|
|
||||||
|
if (++npc->act_wait == 30)
|
||||||
|
{
|
||||||
|
PlaySoundObject(101, 1);
|
||||||
|
SetFlash(0, 0, 2);
|
||||||
|
npc->act_no = 27;
|
||||||
|
npc->ani_no = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 27:
|
||||||
|
if (++npc->act_wait == 50)
|
||||||
|
npc->act_no = 14;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
npc->x += npc->xm;
|
||||||
|
npc->y += npc->ym;
|
||||||
|
|
||||||
|
RECT rcLeft[8];
|
||||||
|
RECT rcRight[8];
|
||||||
|
|
||||||
|
rcLeft[0] = {80, 0, 96, 16};
|
||||||
|
rcLeft[1] = {96, 0, 112, 16};
|
||||||
|
rcLeft[2] = {112, 0, 128, 16};
|
||||||
|
rcLeft[3] = {128, 0, 144, 16};
|
||||||
|
rcLeft[4] = {144, 0, 160, 16};
|
||||||
|
rcLeft[5] = {160, 0, 176, 16};
|
||||||
|
rcLeft[6] = {176, 0, 192, 16};
|
||||||
|
rcLeft[7] = {144, 0, 160, 16};
|
||||||
|
|
||||||
|
rcRight[0] = {80, 16, 96, 32};
|
||||||
|
rcRight[1] = {96, 16, 112, 32};
|
||||||
|
rcRight[2] = {112, 16, 128, 32};
|
||||||
|
rcRight[3] = {128, 16, 144, 32};
|
||||||
|
rcRight[4] = {144, 16, 160, 32};
|
||||||
|
rcRight[5] = {160, 16, 176, 32};
|
||||||
|
rcRight[6] = {176, 16, 192, 32};
|
||||||
|
rcRight[7] = {144, 16, 160, 32};
|
||||||
|
|
||||||
|
if (npc->act_no == 11)
|
||||||
|
{
|
||||||
|
if (npc->ani_wait)
|
||||||
|
{
|
||||||
|
--npc->ani_wait;
|
||||||
|
npc->ani_no = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Random(0, 100) == 1)
|
||||||
|
npc->ani_wait = 30;
|
||||||
|
|
||||||
|
npc->ani_no = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (npc->act_no == 14)
|
||||||
|
{
|
||||||
|
if (npc->ani_wait)
|
||||||
|
{
|
||||||
|
--npc->ani_wait;
|
||||||
|
npc->ani_no = 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Random(0, 100) == 1)
|
||||||
|
npc->ani_wait = 30;
|
||||||
|
|
||||||
|
npc->ani_no = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (npc->direct == 0)
|
||||||
|
npc->rect = rcLeft[npc->ani_no];
|
||||||
|
else
|
||||||
|
npc->rect = rcRight[npc->ani_no];
|
||||||
|
|
||||||
|
if (npc->act_no == 1 && npc->ani_wait < 32)
|
||||||
|
npc->rect.bottom = ++npc->ani_wait / 2 + npc->rect.bottom - 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Balrog (running)
|
||||||
|
void ActNpc068(NPCHAR *npc)
|
||||||
|
{
|
||||||
|
switch (npc->act_no)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
npc->act_no = 1;
|
||||||
|
npc->ani_no = 0;
|
||||||
|
npc->act_wait = 30;
|
||||||
|
|
||||||
|
if (gMC.x < npc->x)
|
||||||
|
npc->direct = 0;
|
||||||
|
else
|
||||||
|
npc->direct = 2;
|
||||||
|
// Fallthrough
|
||||||
|
case 1:
|
||||||
|
if (--npc->act_wait == 0)
|
||||||
|
{
|
||||||
|
npc->act_no = 2;
|
||||||
|
++npc->count1;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
npc->act_no = 3;
|
||||||
|
npc->act_wait = 0;
|
||||||
|
npc->ani_no = 1;
|
||||||
|
npc->ani_wait = 0;
|
||||||
|
// Fallthrough
|
||||||
|
case 3:
|
||||||
|
if (++npc->ani_wait > 3)
|
||||||
|
{
|
||||||
|
npc->ani_wait = 0;
|
||||||
|
|
||||||
|
if (++npc->ani_no == 2 || npc->ani_no == 4)
|
||||||
|
PlaySoundObject(23, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (npc->ani_no > 4)
|
||||||
|
npc->ani_no = 1;
|
||||||
|
|
||||||
|
if (npc->direct == 0)
|
||||||
|
npc->xm -= 0x10;
|
||||||
|
else
|
||||||
|
npc->xm += 0x10;
|
||||||
|
|
||||||
|
if (npc->act_wait >= 8 && gMC.x > npc->x - 0x1800 && gMC.x < npc->x + 0x1800 && gMC.y > npc->y - 0x1800 && gMC.y < npc->y + 0x1000)
|
||||||
|
{
|
||||||
|
npc->act_no = 10;
|
||||||
|
npc->ani_no = 5;
|
||||||
|
gMC.cond |= 2;
|
||||||
|
DamageMyChar(2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++npc->act_wait;
|
||||||
|
|
||||||
|
if (npc->flag & 5 || npc->act_wait > 75)
|
||||||
|
{
|
||||||
|
npc->act_no = 9;
|
||||||
|
npc->ani_no = 0;
|
||||||
|
}
|
||||||
|
else if ((npc->count1 % 3) == 0 && npc->act_wait > 25)
|
||||||
|
{
|
||||||
|
npc->act_no = 4;
|
||||||
|
npc->ani_no = 7;
|
||||||
|
npc->ym = -0x400;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
if (npc->flag & 8)
|
||||||
|
{
|
||||||
|
npc->act_no = 9;
|
||||||
|
npc->ani_no = 8;
|
||||||
|
SetQuake(30);
|
||||||
|
PlaySoundObject(26, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (npc->act_wait >= 8 && gMC.x > npc->x - 0x1800 && gMC.x < npc->x + 0x1800 && gMC.y > npc->y - 0x1800 && gMC.y < npc->y + 0x1000)
|
||||||
|
{
|
||||||
|
npc->act_no = 10;
|
||||||
|
npc->ani_no = 5;
|
||||||
|
gMC.cond |= 2;
|
||||||
|
DamageMyChar(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 9:
|
||||||
|
npc->xm = 4 * npc->xm / 5;
|
||||||
|
|
||||||
|
if (npc->xm == 0)
|
||||||
|
npc->act_no = 0;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 10:
|
||||||
|
gMC.x = npc->x;
|
||||||
|
gMC.y = npc->y;
|
||||||
|
|
||||||
|
npc->xm = 4 * npc->xm / 5;
|
||||||
|
|
||||||
|
if (npc->xm == 0)
|
||||||
|
{
|
||||||
|
npc->act_no = 11;
|
||||||
|
npc->act_wait = 0;
|
||||||
|
npc->ani_no = 5;
|
||||||
|
npc->ani_wait = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 11:
|
||||||
|
gMC.x = npc->x;
|
||||||
|
gMC.y = npc->y;
|
||||||
|
|
||||||
|
if (++npc->ani_wait > 2)
|
||||||
|
{
|
||||||
|
npc->ani_wait = 0;
|
||||||
|
++npc->ani_no;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (npc->ani_no > 6)
|
||||||
|
npc->ani_no = 5;
|
||||||
|
|
||||||
|
if (++npc->act_wait > 100)
|
||||||
|
npc->act_no = 20;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 20:
|
||||||
|
PlaySoundObject(25, 1);
|
||||||
|
gMC.cond &= ~2;
|
||||||
|
|
||||||
|
if (npc->direct == 0)
|
||||||
|
{
|
||||||
|
gMC.x += 0x800;
|
||||||
|
gMC.y -= 0x1000;
|
||||||
|
gMC.xm = 0x5FF;
|
||||||
|
gMC.ym = -0x200u;
|
||||||
|
gMC.direct = 2;
|
||||||
|
npc->direct = 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gMC.x -= 0x800;
|
||||||
|
gMC.y -= 0x1000;
|
||||||
|
gMC.xm = -0x5FFu;
|
||||||
|
gMC.ym = -0x200u;
|
||||||
|
gMC.direct = 0;
|
||||||
|
npc->direct = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
npc->act_no = 21;
|
||||||
|
npc->act_wait = 0;
|
||||||
|
npc->ani_no = 7;
|
||||||
|
// Fallthrough
|
||||||
|
case 21:
|
||||||
|
if (++npc->act_wait >= 50)
|
||||||
|
npc->act_no = 0;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
npc->ym += 0x20;
|
||||||
|
|
||||||
|
if (npc->xm < -0x400)
|
||||||
|
npc->xm = -0x400;
|
||||||
|
if (npc->xm > 0x400)
|
||||||
|
npc->xm = 0x400;
|
||||||
|
|
||||||
|
if (npc->ym > 0x5FF)
|
||||||
|
npc->ym = 0x5FF;
|
||||||
|
|
||||||
|
npc->x += npc->xm;
|
||||||
|
npc->y += npc->ym;
|
||||||
|
|
||||||
|
RECT rect_left[9];
|
||||||
|
RECT rect_right[9];
|
||||||
|
|
||||||
|
rect_left[0] = {0, 0, 40, 24};
|
||||||
|
rect_left[1] = {0, 48, 40, 72};
|
||||||
|
rect_left[2] = {0, 0, 40, 24};
|
||||||
|
rect_left[3] = {40, 48, 80, 72};
|
||||||
|
rect_left[4] = {0, 0, 40, 24};
|
||||||
|
rect_left[5] = {80, 48, 120, 72};
|
||||||
|
rect_left[6] = {120, 48, 160, 72};
|
||||||
|
rect_left[7] = {120, 0, 160, 24};
|
||||||
|
rect_left[8] = {80, 0, 120, 24};
|
||||||
|
|
||||||
|
rect_right[0] = {0, 24, 40, 48};
|
||||||
|
rect_right[1] = {0, 72, 40, 96};
|
||||||
|
rect_right[2] = {0, 24, 40, 48};
|
||||||
|
rect_right[3] = {40, 72, 80, 96};
|
||||||
|
rect_right[4] = {0, 24, 40, 48};
|
||||||
|
rect_right[5] = {80, 72, 120, 96};
|
||||||
|
rect_right[6] = {120, 72, 160, 96};
|
||||||
|
rect_right[7] = {120, 24, 160, 48};
|
||||||
|
rect_right[8] = {80, 24, 120, 48};
|
||||||
|
|
||||||
|
if (npc->direct == 0)
|
||||||
|
npc->rect = rect_left[npc->ani_no];
|
||||||
|
else
|
||||||
|
npc->rect = rect_right[npc->ani_no];
|
||||||
|
}
|
||||||
|
|
||||||
//Sparkle
|
//Sparkle
|
||||||
void ActNpc069(NPCHAR *npc)
|
void ActNpc069(NPCHAR *npc)
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,7 +75,7 @@ NPCFUNCTION gpNpcFuncTbl[361] =
|
||||||
ActNpc016,
|
ActNpc016,
|
||||||
ActNpc017,
|
ActNpc017,
|
||||||
ActNpc018,
|
ActNpc018,
|
||||||
nullptr,
|
ActNpc019,
|
||||||
ActNpc020,
|
ActNpc020,
|
||||||
ActNpc021,
|
ActNpc021,
|
||||||
ActNpc022,
|
ActNpc022,
|
||||||
|
@ -97,7 +97,7 @@ NPCFUNCTION gpNpcFuncTbl[361] =
|
||||||
ActNpc038,
|
ActNpc038,
|
||||||
ActNpc039,
|
ActNpc039,
|
||||||
nullptr,
|
nullptr,
|
||||||
nullptr,
|
ActNpc041,
|
||||||
ActNpc042,
|
ActNpc042,
|
||||||
ActNpc043,
|
ActNpc043,
|
||||||
nullptr,
|
nullptr,
|
||||||
|
@ -119,12 +119,12 @@ NPCFUNCTION gpNpcFuncTbl[361] =
|
||||||
ActNpc060,
|
ActNpc060,
|
||||||
ActNpc061,
|
ActNpc061,
|
||||||
ActNpc062,
|
ActNpc062,
|
||||||
nullptr,
|
ActNpc063,
|
||||||
ActNpc064,
|
ActNpc064,
|
||||||
ActNpc065,
|
ActNpc065,
|
||||||
nullptr,
|
ActNpc066,
|
||||||
nullptr,
|
ActNpc067,
|
||||||
nullptr,
|
ActNpc068,
|
||||||
ActNpc069,
|
ActNpc069,
|
||||||
ActNpc070,
|
ActNpc070,
|
||||||
ActNpc071,
|
ActNpc071,
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "ValueView.h"
|
#include "ValueView.h"
|
||||||
#include "Back.h"
|
#include "Back.h"
|
||||||
#include "Stage.h"
|
#include "Stage.h"
|
||||||
|
#include "Flash.h"
|
||||||
|
|
||||||
#ifdef JAPANESE
|
#ifdef JAPANESE
|
||||||
#define STAGE_ENTRY(parts, map, bkType, back, npc, boss, boss_no, name_en, name_jp) {parts, map, bkType, back, npc, boss, boss_no, name_jp}
|
#define STAGE_ENTRY(parts, map, bkType, back, npc, boss, boss_no, name_en, name_jp) {parts, map, bkType, back, npc, boss, boss_no, name_jp}
|
||||||
|
@ -195,7 +196,7 @@ bool TransferStage(int no, int w, int x, int y)
|
||||||
ClearValueView();
|
ClearValueView();
|
||||||
ResetQuake();
|
ResetQuake();
|
||||||
//InitBossChar(gTMT[no].boss_no);
|
//InitBossChar(gTMT[no].boss_no);
|
||||||
//ResetFlash();
|
ResetFlash();
|
||||||
gStageNo = no;
|
gStageNo = no;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue