Added some TSC commands and BossLife.cpp
This commit is contained in:
parent
8954e9aaca
commit
5c8f80e611
6 changed files with 141 additions and 5 deletions
1
Makefile
1
Makefile
|
@ -41,6 +41,7 @@ endif
|
|||
SOURCES = \
|
||||
ArmsItem \
|
||||
Back \
|
||||
BossLife \
|
||||
BulHit \
|
||||
Bullet \
|
||||
Caret \
|
||||
|
|
84
src/BossLife.cpp
Normal file
84
src/BossLife.cpp
Normal file
|
@ -0,0 +1,84 @@
|
|||
#include "BossLife.h"
|
||||
|
||||
#include "Draw.h"
|
||||
#include "NpChar.h"
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
static struct
|
||||
{
|
||||
bool flag;
|
||||
int *pLife;
|
||||
int max;
|
||||
int br;
|
||||
int count;
|
||||
} gBL;
|
||||
|
||||
void InitBossLife(void)
|
||||
{
|
||||
gBL.flag = false;
|
||||
}
|
||||
|
||||
bool StartBossLife(int code_event)
|
||||
{
|
||||
for (int i = 0; i < 0x200; ++i)
|
||||
{
|
||||
if (gNPC[i].code_event == code_event)
|
||||
{
|
||||
gBL.flag = true;
|
||||
gBL.max = gNPC[i].life;
|
||||
gBL.br = gNPC[i].life;
|
||||
gBL.pLife = &gNPC[i].life;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool StartBossLife2(void)
|
||||
{
|
||||
// TODO uncomment me when Boss.cpp is done!
|
||||
// gBL.flag = true;
|
||||
// gBL.max = gBoss[0].life;
|
||||
// gBL.br = gBoss[0].life;
|
||||
// gBL.pLife = &gBoss[0].life;
|
||||
return true;
|
||||
}
|
||||
|
||||
void PutBossLife(void)
|
||||
{
|
||||
RECT rcText = {0, 48, 32, 56};
|
||||
RECT rcBox1 = {0, 0, 244, 8};
|
||||
RECT rcBox2 = {0, 16, 244, 24};
|
||||
RECT rcLife = {0, 24, 0, 32};
|
||||
RECT rcBr = {0, 32, 232, 40};
|
||||
|
||||
if (gBL.flag)
|
||||
{
|
||||
if (*gBL.pLife >= 1)
|
||||
{
|
||||
rcLife.right = 198 * *gBL.pLife / gBL.max;
|
||||
|
||||
if (gBL.br <= *gBL.pLife)
|
||||
{
|
||||
gBL.count = 0;
|
||||
}
|
||||
else if (++gBL.count > 30)
|
||||
{
|
||||
--gBL.br;
|
||||
}
|
||||
|
||||
rcBr.right = 198 * gBL.br / gBL.max;
|
||||
|
||||
PutBitmap3(&grcGame, 32, 220, &rcBox1, SURFACE_ID_TEXT_BOX);
|
||||
PutBitmap3(&grcGame, 32, 228, &rcBox2, SURFACE_ID_TEXT_BOX);
|
||||
PutBitmap3(&grcGame, 72, 224, &rcBr, SURFACE_ID_TEXT_BOX);
|
||||
PutBitmap3(&grcGame, 72, 224, &rcLife, SURFACE_ID_TEXT_BOX);
|
||||
PutBitmap3(&grcGame, 40, 224, &rcText, SURFACE_ID_TEXT_BOX);
|
||||
}
|
||||
else
|
||||
{
|
||||
gBL.flag = false;
|
||||
}
|
||||
}
|
||||
}
|
6
src/BossLife.h
Normal file
6
src/BossLife.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
void InitBossLife(void);
|
||||
bool StartBossLife(int code_event);
|
||||
bool StartBossLife2(void);
|
||||
void PutBossLife(void);
|
|
@ -37,6 +37,7 @@
|
|||
#include "Draw.h"
|
||||
#include "Ending.h"
|
||||
#include "Flash.h"
|
||||
#include "BossLife.h"
|
||||
|
||||
int g_GameFlags;
|
||||
int gCounter;
|
||||
|
@ -103,7 +104,7 @@ int ModeOpening()
|
|||
//InitStar();
|
||||
InitFade();
|
||||
InitFlash();
|
||||
//InitBossLife();
|
||||
InitBossLife();
|
||||
ChangeMusic(0);
|
||||
TransferStage(72, 100, 3, 3);
|
||||
SetFrameTargetMyChar(16);
|
||||
|
@ -441,7 +442,7 @@ int ModeAction()
|
|||
//ClearPermitStage();
|
||||
//StartMapping();
|
||||
InitFlags();
|
||||
//InitBossLife();
|
||||
InitBossLife();
|
||||
|
||||
if ((bContinue && LoadProfile(NULL)) || InitializeGame())
|
||||
{
|
||||
|
@ -517,7 +518,7 @@ int ModeAction()
|
|||
PutFlash();
|
||||
PutCaret(frame_x, frame_y);
|
||||
PutValueView(frame_x, frame_y);
|
||||
//PutBossLife();
|
||||
PutBossLife();
|
||||
PutFade();
|
||||
|
||||
if (!(g_GameFlags & 4))
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "ValueView.h"
|
||||
#include "Stage.h"
|
||||
#include "Game.h"
|
||||
#include "BossLife.h"
|
||||
|
||||
const char *gDefaultName = "Profile.dat";
|
||||
const char *gProfileCode = "Do041220";
|
||||
|
@ -130,7 +131,7 @@ bool LoadProfile(char *name)
|
|||
ClearFade();
|
||||
SetFrameMyChar();
|
||||
SetFrameTargetMyChar(16);
|
||||
//InitBossLife();
|
||||
InitBossLife();
|
||||
CutNoise();
|
||||
//InitStar();
|
||||
ClearValueView();
|
||||
|
@ -154,7 +155,7 @@ bool InitializeGame()
|
|||
ClearFade();
|
||||
SetFrameMyChar();
|
||||
SetFrameTargetMyChar(16);
|
||||
//InitBossLife();
|
||||
InitBossLife();
|
||||
CutNoise();
|
||||
ClearValueView();
|
||||
//gCurlyShoot_wait = 0;
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include "Sound.h"
|
||||
#include "Organya.h"
|
||||
#include "Game.h"
|
||||
#include "Map.h"
|
||||
#include "BossLife.h"
|
||||
|
||||
#define IS_COMMAND(c1, c2, c3) gTS.data[gTS.p_read + 1] == c1 && gTS.data[gTS.p_read + 2] == c2 && gTS.data[gTS.p_read + 3] == c3
|
||||
|
||||
|
@ -840,6 +842,16 @@ int TextScriptProc()
|
|||
else
|
||||
gTS.p_read += 13;
|
||||
}
|
||||
else if (IS_COMMAND('I','T','J'))
|
||||
{
|
||||
x = GetTextScriptNo(gTS.p_read + 4);
|
||||
z = GetTextScriptNo(gTS.p_read + 9);
|
||||
|
||||
if (CheckItem(x))
|
||||
JumpTextScript(z);
|
||||
else
|
||||
gTS.p_read += 13;
|
||||
}
|
||||
else if (IS_COMMAND('S','S','S'))
|
||||
{
|
||||
x = GetTextScriptNo(gTS.p_read + 4);
|
||||
|
@ -968,6 +980,37 @@ int TextScriptProc()
|
|||
SetNpChar(w, x << 13, y << 13, 0, 0, z, 0, 0x100);
|
||||
gTS.p_read += 23;
|
||||
}
|
||||
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('B','S','L'))
|
||||
{
|
||||
z = GetTextScriptNo(gTS.p_read + 4);
|
||||
|
||||
if (z)
|
||||
StartBossLife(z);
|
||||
else
|
||||
StartBossLife2();
|
||||
|
||||
gTS.p_read += 8;
|
||||
}
|
||||
else if (IS_COMMAND('M','Y','D'))
|
||||
{
|
||||
z = GetTextScriptNo(gTS.p_read + 4);
|
||||
SetMyCharDirect(z);
|
||||
gTS.p_read += 8;
|
||||
}
|
||||
else if (IS_COMMAND('M','Y','B'))
|
||||
{
|
||||
z = GetTextScriptNo(gTS.p_read + 4);
|
||||
BackStepMyChar(z);
|
||||
gTS.p_read += 8;
|
||||
}
|
||||
else if (IS_COMMAND('M','N','P'))
|
||||
{
|
||||
w = GetTextScriptNo(gTS.p_read + 4);
|
||||
|
|
Loading…
Add table
Reference in a new issue