stuff
This commit is contained in:
parent
17b0b503a9
commit
4fb84866a5
8 changed files with 383 additions and 103 deletions
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include "Caret.h"
|
#include "Caret.h"
|
||||||
#include "Draw.h"
|
#include "Draw.h"
|
||||||
|
#include "Game.h"
|
||||||
|
|
||||||
#define CARET_MAX 0x40
|
#define CARET_MAX 0x40
|
||||||
CARET gCrt[CARET_MAX];
|
CARET gCrt[CARET_MAX];
|
||||||
|
@ -18,6 +19,61 @@ void ActCaret00(CARET *crt)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ActCaret01(CARET *crt)
|
||||||
|
{
|
||||||
|
RECT rcLeft[4];
|
||||||
|
RECT rcRight[4];
|
||||||
|
|
||||||
|
rcLeft[0] = {0, 64, 8, 72};
|
||||||
|
rcLeft[1] = {8, 64, 16, 72};
|
||||||
|
rcLeft[2] = {16, 64, 24, 72};
|
||||||
|
rcLeft[3] = {24, 64, 32, 72};
|
||||||
|
|
||||||
|
rcRight[0] = {64, 24, 72, 32};
|
||||||
|
rcRight[1] = {72, 24, 80, 32};
|
||||||
|
rcRight[2] = {80, 24, 88, 32};
|
||||||
|
rcRight[3] = {88, 24, 92, 32};
|
||||||
|
|
||||||
|
if (!crt->act_no)
|
||||||
|
{
|
||||||
|
crt->act_no = 1;
|
||||||
|
crt->xm = Random(-0x400, 0x400);
|
||||||
|
crt->ym = Random(-0x400, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
crt->ym += 0x40;
|
||||||
|
crt->x += crt->xm;
|
||||||
|
crt->y += crt->ym;
|
||||||
|
|
||||||
|
if (++crt->ani_wait > 5)
|
||||||
|
{
|
||||||
|
crt->ani_wait = 0;
|
||||||
|
if (++crt->ani_no > 3)
|
||||||
|
crt->cond = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (crt->direct)
|
||||||
|
crt->rect = rcRight[crt->ani_no];
|
||||||
|
else
|
||||||
|
crt->rect = rcLeft[crt->ani_no];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void ActCaret09(CARET *crt)
|
||||||
|
{
|
||||||
|
if (++crt->ani_wait <= 4)
|
||||||
|
crt->y -= 0x800;
|
||||||
|
if (crt->ani_wait == 32 )
|
||||||
|
crt->cond = 0;
|
||||||
|
|
||||||
|
if (crt->direct)
|
||||||
|
crt->rect = {48, 64, 64, 80};
|
||||||
|
else
|
||||||
|
crt->rect = {0, 80, 16, 96};
|
||||||
|
}
|
||||||
|
|
||||||
//Tables
|
//Tables
|
||||||
CARET_TABLE gCaretTable[18] =
|
CARET_TABLE gCaretTable[18] =
|
||||||
{
|
{
|
||||||
|
@ -45,7 +101,7 @@ typedef void (*CARETFUNCTION)(CARET*);
|
||||||
CARETFUNCTION gpCaretFuncTbl[] =
|
CARETFUNCTION gpCaretFuncTbl[] =
|
||||||
{
|
{
|
||||||
&ActCaret00,
|
&ActCaret00,
|
||||||
nullptr, //&ActCaret01,
|
&ActCaret01,
|
||||||
nullptr, //&ActCaret02,
|
nullptr, //&ActCaret02,
|
||||||
nullptr, //&ActCaret03,
|
nullptr, //&ActCaret03,
|
||||||
nullptr, //&ActCaret04,
|
nullptr, //&ActCaret04,
|
||||||
|
@ -53,7 +109,7 @@ CARETFUNCTION gpCaretFuncTbl[] =
|
||||||
nullptr, //&ActCaret04,
|
nullptr, //&ActCaret04,
|
||||||
nullptr, //&ActCaret07,
|
nullptr, //&ActCaret07,
|
||||||
nullptr, //&ActCaret08,
|
nullptr, //&ActCaret08,
|
||||||
nullptr, //&ActCaret09,
|
&ActCaret09,
|
||||||
nullptr, //&ActCaret10,
|
nullptr, //&ActCaret10,
|
||||||
nullptr, //&ActCaret11,
|
nullptr, //&ActCaret11,
|
||||||
nullptr, //&ActCaret12,
|
nullptr, //&ActCaret12,
|
||||||
|
@ -61,16 +117,19 @@ CARETFUNCTION gpCaretFuncTbl[] =
|
||||||
nullptr, //&ActCaret14,
|
nullptr, //&ActCaret14,
|
||||||
nullptr, //&ActCaret15,
|
nullptr, //&ActCaret15,
|
||||||
nullptr, //&ActCaret16,
|
nullptr, //&ActCaret16,
|
||||||
nullptr //&ActCaret17
|
nullptr, //&ActCaret17
|
||||||
};
|
};
|
||||||
|
|
||||||
void ActCaret()
|
void ActCaret()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < CARET_MAX; i++)
|
for (int i = 0; i < CARET_MAX; i++)
|
||||||
{
|
{
|
||||||
if (gCrt[i].cond & 0x80 && gpCaretFuncTbl[gCrt[i].code] != nullptr)
|
if ((gCrt[i].cond & 0x80) && gpCaretFuncTbl[gCrt[i].code] != nullptr)
|
||||||
|
{
|
||||||
|
printf("ActCaret%02d\n", gCrt[i].code);
|
||||||
gpCaretFuncTbl[gCrt[i].code](&gCrt[i]);
|
gpCaretFuncTbl[gCrt[i].code](&gCrt[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PutCaret(int fx, int fy)
|
void PutCaret(int fx, int fy)
|
||||||
|
@ -93,7 +152,7 @@ void SetCaret(int x, int y, int code, int dir)
|
||||||
{
|
{
|
||||||
for (int c = 0; c < CARET_MAX; c++)
|
for (int c = 0; c < CARET_MAX; c++)
|
||||||
{
|
{
|
||||||
if (gCrt[c].cond)
|
if (!gCrt[c].cond)
|
||||||
{
|
{
|
||||||
memset(&gCrt[c], 0, sizeof(CARET));
|
memset(&gCrt[c], 0, sizeof(CARET));
|
||||||
gCrt[c].cond = 0x80;
|
gCrt[c].cond = 0x80;
|
||||||
|
|
|
@ -309,7 +309,7 @@ void PutBitmap4(RECT *rcView, int x, int y, RECT *rect, int surf_no) //No Transp
|
||||||
void Surface2Surface(int x, int y, RECT *rect, int to, int from)
|
void Surface2Surface(int x, int y, RECT *rect, int to, int from)
|
||||||
{
|
{
|
||||||
//Get rects
|
//Get rects
|
||||||
SDL_Rect rcSet = {x * gWindowScale, y * gWindowScale, (x + rect->right - rect->left) * gWindowScale, (y + rect->bottom - rect->top) * gWindowScale};
|
SDL_Rect rcSet = {x * gWindowScale, y * gWindowScale, (rect->right - rect->left) * gWindowScale, (rect->bottom - rect->top) * gWindowScale};
|
||||||
SDL_Rect frameRect = RectToSDLRect(rect);
|
SDL_Rect frameRect = RectToSDLRect(rect);
|
||||||
frameRect = {frameRect.x * gWindowScale, frameRect.y * gWindowScale, frameRect.w * gWindowScale, frameRect.h * gWindowScale};
|
frameRect = {frameRect.x * gWindowScale, frameRect.y * gWindowScale, frameRect.w * gWindowScale, frameRect.h * gWindowScale};
|
||||||
|
|
||||||
|
|
|
@ -89,8 +89,8 @@ void SetFrameMyChar()
|
||||||
int16_t map_w, map_l;
|
int16_t map_w, map_l;
|
||||||
GetMapData(0, &map_w, &map_l);
|
GetMapData(0, &map_w, &map_l);
|
||||||
|
|
||||||
gFrame.x = mc_x - (WINDOW_WIDTH << 9);
|
gFrame.x = mc_x - (WINDOW_WIDTH << 8);
|
||||||
gFrame.y = mc_y - (WINDOW_HEIGHT << 9);
|
gFrame.y = mc_y - (WINDOW_HEIGHT << 8);
|
||||||
|
|
||||||
//Keep in bounds
|
//Keep in bounds
|
||||||
if (gFrame.x <= -0x200)
|
if (gFrame.x <= -0x200)
|
||||||
|
|
|
@ -136,12 +136,12 @@ int ModeOpening()
|
||||||
ActBack();
|
ActBack();
|
||||||
ResetMyCharFlag();
|
ResetMyCharFlag();
|
||||||
HitMyCharMap();
|
HitMyCharMap();
|
||||||
//HitMyCharNpChar();
|
HitMyCharNpChar();
|
||||||
//HitMyCharBoss();
|
//HitMyCharBoss();
|
||||||
HitNpCharMap();
|
HitNpCharMap();
|
||||||
//HitBossMap();
|
//HitBossMap();
|
||||||
//HitBossBullet();
|
//HitBossBullet();
|
||||||
//ActCaret();
|
ActCaret();
|
||||||
MoveFrame3();
|
MoveFrame3();
|
||||||
ProcFade();
|
ProcFade();
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ int ModeOpening()
|
||||||
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);
|
||||||
//PutCaret(frame_x, frame_y);
|
PutCaret(frame_x, frame_y);
|
||||||
PutFade();
|
PutFade();
|
||||||
|
|
||||||
//Update Text Script
|
//Update Text Script
|
||||||
|
@ -471,7 +471,7 @@ int ModeAction()
|
||||||
ActBack();
|
ActBack();
|
||||||
ResetMyCharFlag();
|
ResetMyCharFlag();
|
||||||
HitMyCharMap();
|
HitMyCharMap();
|
||||||
//HitMyCharNpChar();
|
HitMyCharNpChar();
|
||||||
//HitMyCharBoss();
|
//HitMyCharBoss();
|
||||||
HitNpCharMap();
|
HitNpCharMap();
|
||||||
//HitBossMap();
|
//HitBossMap();
|
||||||
|
|
261
src/MycHit.cpp
261
src/MycHit.cpp
|
@ -3,10 +3,13 @@
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
#include "MyChar.h"
|
#include "MyChar.h"
|
||||||
|
#include "NpChar.h"
|
||||||
#include "Map.h"
|
#include "Map.h"
|
||||||
#include "Sound.h"
|
#include "Sound.h"
|
||||||
#include "Caret.h"
|
#include "Caret.h"
|
||||||
#include "Back.h"
|
#include "Back.h"
|
||||||
|
#include "Game.h"
|
||||||
|
#include "TextScr.h"
|
||||||
#include "KeyControl.h"
|
#include "KeyControl.h"
|
||||||
|
|
||||||
void ResetMyCharFlag()
|
void ResetMyCharFlag()
|
||||||
|
@ -565,3 +568,261 @@ void HitMyCharMap()
|
||||||
if (gMC.y > gWaterY + 0x800)
|
if (gMC.y > gWaterY + 0x800)
|
||||||
gMC.flag |= 0x100;
|
gMC.flag |= 0x100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int JudgeHitMyCharNPC(NPCHAR *npc)
|
||||||
|
{
|
||||||
|
int hit = 0;
|
||||||
|
|
||||||
|
if (gMC.y - gMC.hit.top < npc->y + npc->hit.bottom - 0x600
|
||||||
|
&& gMC.y + gMC.hit.bottom > npc->y - npc->hit.top + 0x600
|
||||||
|
&& gMC.x - gMC.hit.right < npc->x + npc->hit.back
|
||||||
|
&& gMC.x - gMC.hit.right > npc->x)
|
||||||
|
{
|
||||||
|
if (gMC.xm < 0x200)
|
||||||
|
gMC.xm += 0x200;
|
||||||
|
hit |= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gMC.y - gMC.hit.top < npc->y + npc->hit.bottom - 0x600
|
||||||
|
&& gMC.y + gMC.hit.bottom > npc->y - npc->hit.top + 0x600
|
||||||
|
&& gMC.x + gMC.hit.right - 0x200 > npc->x - npc->hit.back
|
||||||
|
&& gMC.x + gMC.hit.right - 0x200 < npc->x)
|
||||||
|
{
|
||||||
|
if (gMC.xm > -0x200)
|
||||||
|
gMC.xm -= 0x200;
|
||||||
|
hit |= 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gMC.x - gMC.hit.right < npc->x + npc->hit.back - 0x600
|
||||||
|
&& gMC.x + gMC.hit.right > npc->x - npc->hit.back + 0x600
|
||||||
|
&& gMC.y - gMC.hit.top < npc->y + npc->hit.bottom
|
||||||
|
&& gMC.y - gMC.hit.top > npc->y)
|
||||||
|
{
|
||||||
|
if (gMC.ym < 0)
|
||||||
|
gMC.ym = 0;
|
||||||
|
hit |= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gMC.x - gMC.hit.right < npc->x + npc->hit.back - 0x600
|
||||||
|
&& gMC.x + gMC.hit.right > npc->x - npc->hit.back + 0x600
|
||||||
|
&& gMC.y + gMC.hit.bottom > npc->y - npc->hit.top
|
||||||
|
&& gMC.hit.bottom + gMC.y < npc->y + 0x600)
|
||||||
|
{
|
||||||
|
if (npc->bits & npc_bouncy)
|
||||||
|
{
|
||||||
|
gMC.ym = npc->ym - 0x200;
|
||||||
|
hit |= 8;
|
||||||
|
}
|
||||||
|
else if (!(gMC.flag & 8) && gMC.ym > npc->ym)
|
||||||
|
{
|
||||||
|
gMC.y = npc->y - npc->hit.top - gMC.hit.bottom + 0x200;
|
||||||
|
gMC.ym = npc->ym;
|
||||||
|
gMC.x += npc->xm;
|
||||||
|
hit |= 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hit;
|
||||||
|
}
|
||||||
|
|
||||||
|
int JudgeHitMyCharNPC3(NPCHAR *npc)
|
||||||
|
{
|
||||||
|
if (npc->direct)
|
||||||
|
{
|
||||||
|
if (gMC.x + 0x400 > npc->x - npc->hit.back
|
||||||
|
&& gMC.x - 0x400 < npc->x + npc->hit.front
|
||||||
|
&& gMC.y + 0x400 > npc->y - npc->hit.top
|
||||||
|
&& gMC.y - 0x400 < npc->y + npc->hit.bottom)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (gMC.x + 0x400 > npc->x - npc->hit.front
|
||||||
|
&& gMC.x - 0x400 < npc->x + npc->hit.back
|
||||||
|
&& gMC.y + 0x400 > npc->y - npc->hit.top
|
||||||
|
&& gMC.y - 0x400 < npc->y + npc->hit.bottom)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int JudgeHitMyCharNPC4(NPCHAR *npc)
|
||||||
|
{
|
||||||
|
//TODO: comment this
|
||||||
|
int hit = 0;
|
||||||
|
long double v1, v2;
|
||||||
|
|
||||||
|
if (npc->x <= gMC.x)
|
||||||
|
v1 = (long double)(gMC.x - npc->x);
|
||||||
|
else
|
||||||
|
v1 = (long double)(npc->x - gMC.x);
|
||||||
|
|
||||||
|
float fx1 = v1;
|
||||||
|
|
||||||
|
if (npc->y <= gMC.y)
|
||||||
|
v2 = (long double)(gMC.y - npc->y);
|
||||||
|
else
|
||||||
|
v2 = (long double)(npc->y - gMC.y);
|
||||||
|
|
||||||
|
float fx2 = (long double)npc->hit.back;
|
||||||
|
if (0.0 == fx1)
|
||||||
|
fx1 = 1.0;
|
||||||
|
if (0.0 == fx2)
|
||||||
|
fx2 = 1.0;
|
||||||
|
|
||||||
|
float fy1 = v2;
|
||||||
|
float fy2 = (long double)npc->hit.top;
|
||||||
|
|
||||||
|
if (fy1 / fx1 <= fy2 / fx2)
|
||||||
|
{
|
||||||
|
if (gMC.y - gMC.hit.top < npc->y + npc->hit.bottom && gMC.y + gMC.hit.bottom > npc->y - npc->hit.top)
|
||||||
|
{
|
||||||
|
if (gMC.x - gMC.hit.right < npc->x + npc->hit.back && gMC.x - gMC.hit.right > npc->x)
|
||||||
|
{
|
||||||
|
if ( gMC.xm < npc->xm )
|
||||||
|
gMC.xm = npc->xm;
|
||||||
|
gMC.x = npc->hit.back + npc->x + gMC.hit.right;
|
||||||
|
hit |= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gMC.x + gMC.hit.right > npc->x - npc->hit.back && gMC.hit.right + gMC.x < npc->x)
|
||||||
|
{
|
||||||
|
if ( gMC.xm > npc->xm )
|
||||||
|
gMC.xm = npc->xm;
|
||||||
|
gMC.x = npc->x - npc->hit.back - gMC.hit.right;
|
||||||
|
hit |= 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (gMC.x - gMC.hit.right < npc->x + npc->hit.back && gMC.x + gMC.hit.right > npc->x - npc->hit.back)
|
||||||
|
{
|
||||||
|
if (gMC.y - gMC.hit.top < npc->y + npc->hit.bottom && gMC.y - gMC.hit.top > npc->y)
|
||||||
|
{
|
||||||
|
if (gMC.ym >= npc->ym)
|
||||||
|
{
|
||||||
|
if (gMC.ym < 0)
|
||||||
|
gMC.ym = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gMC.y = npc->hit.bottom + npc->y + gMC.hit.top + 0x200;
|
||||||
|
gMC.ym = npc->ym;
|
||||||
|
}
|
||||||
|
|
||||||
|
hit |= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gMC.y + gMC.hit.bottom > npc->y - npc->hit.top && gMC.hit.bottom + gMC.y < npc->y + 0x600)
|
||||||
|
{
|
||||||
|
if (gMC.ym - npc->ym > 0x400)
|
||||||
|
PlaySoundObject(23, 1);
|
||||||
|
|
||||||
|
if (gMC.unit == 1)
|
||||||
|
{
|
||||||
|
gMC.y = npc->y - npc->hit.top - gMC.hit.bottom + 0x200;
|
||||||
|
hit |= 8;
|
||||||
|
}
|
||||||
|
else if (npc->bits & npc_bouncy)
|
||||||
|
{
|
||||||
|
gMC.ym = npc->ym - 0x200;
|
||||||
|
hit |= 8;
|
||||||
|
}
|
||||||
|
else if (!(gMC.flag & 8) && gMC.ym > npc->ym)
|
||||||
|
{
|
||||||
|
gMC.y = npc->y - npc->hit.top - gMC.hit.bottom + 0x200;
|
||||||
|
gMC.ym = npc->ym;
|
||||||
|
gMC.x += npc->xm;
|
||||||
|
hit |= 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return hit;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HitMyCharNpChar()
|
||||||
|
{
|
||||||
|
if ((gMC.cond & 0x80) && !(gMC.cond & 2))
|
||||||
|
{
|
||||||
|
int hit;
|
||||||
|
|
||||||
|
for (int i = 0; i < NPC_MAX; i++)
|
||||||
|
{
|
||||||
|
if (gNPC[i].cond & 0x80)
|
||||||
|
{
|
||||||
|
if (gNPC[i].bits & npc_solidSoft)
|
||||||
|
{
|
||||||
|
hit = JudgeHitMyCharNPC(&gNPC[i]);
|
||||||
|
gMC.flag |= hit;
|
||||||
|
}
|
||||||
|
else if (gNPC[i].bits & npc_solidHard)
|
||||||
|
{
|
||||||
|
hit = JudgeHitMyCharNPC4(&gNPC[i]);
|
||||||
|
gMC.flag |= hit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hit = JudgeHitMyCharNPC3(&gNPC[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Special NPCs (pickups)
|
||||||
|
if (hit && gNPC[i].code_char == 1)
|
||||||
|
{
|
||||||
|
PlaySoundObject(14, 1);
|
||||||
|
//AddExpMyChar(gNPC[i].exp);
|
||||||
|
gNPC[i].cond = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hit && gNPC[i].code_char == 86)
|
||||||
|
{
|
||||||
|
PlaySoundObject(42, 1);
|
||||||
|
//AddBulletMyChar(gNPC[i].code_event, gNPC[i].exp);
|
||||||
|
gNPC[i].cond = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hit && gNPC[i].code_char == 87)
|
||||||
|
{
|
||||||
|
PlaySoundObject(20, 1);
|
||||||
|
//AddLifeMyChar(gNPC[i].exp);
|
||||||
|
gNPC[i].cond = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Run event on contact
|
||||||
|
if (!(g_GameFlags & 4) && hit && gNPC[i].bits & npc_eventTouch)
|
||||||
|
StartTextScript(gNPC[i].code_event);
|
||||||
|
|
||||||
|
//NPC damage
|
||||||
|
if (g_GameFlags & 2 && !(gNPC[i].bits & npc_interact))
|
||||||
|
{
|
||||||
|
if (gNPC[i].bits & npc_rearTop)
|
||||||
|
{
|
||||||
|
//if (hit & 4 && gNPC[i].xm < 0)
|
||||||
|
// DamageMyChar(gNPC[i].damage);
|
||||||
|
//if (hit & 1 && gNPC[i].xm > 0)
|
||||||
|
// DamageMyChar(gNPC[i].damage);
|
||||||
|
//if (hit & 8 && gNPC[i].ym < 0)
|
||||||
|
// DamageMyChar(gNPC[i].damage);
|
||||||
|
//if (hit & 2 && gNPC[i].ym > 0)
|
||||||
|
// DamageMyChar(gNPC[i].damage);
|
||||||
|
}
|
||||||
|
else if (hit && gNPC[i].damage && !(g_GameFlags & 4))
|
||||||
|
{
|
||||||
|
//DamageMyChar(gNPC[i].damage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Interaction
|
||||||
|
if (!(g_GameFlags & 4) && hit && gMC.cond & 1 && gNPC[i].bits & npc_interact)
|
||||||
|
{
|
||||||
|
StartTextScript(gNPC[i].code_event);
|
||||||
|
gMC.xm = 0;
|
||||||
|
gMC.ques = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Create question mark when NPC hasn't been interacted with
|
||||||
|
if (gMC.ques)
|
||||||
|
SetCaret(gMC.x, gMC.y, 9, 0);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
void ResetMyCharFlag();
|
void ResetMyCharFlag();
|
||||||
void HitMyCharMap();
|
void HitMyCharMap();
|
||||||
|
void HitMyCharNpChar();
|
||||||
|
|
|
@ -197,6 +197,8 @@ int gMusicNo;
|
||||||
|
|
||||||
void ChangeMusic(int no)
|
void ChangeMusic(int no)
|
||||||
{
|
{
|
||||||
|
if (!no || no != gMusicNo)
|
||||||
|
{
|
||||||
//Stop and keep track of old song
|
//Stop and keep track of old song
|
||||||
gOldPos = GetOrganyaPosition();
|
gOldPos = GetOrganyaPosition();
|
||||||
gOldNo = gMusicNo;
|
gOldNo = gMusicNo;
|
||||||
|
@ -210,6 +212,7 @@ void ChangeMusic(int no)
|
||||||
SetOrganyaPosition(0);
|
SetOrganyaPosition(0);
|
||||||
PlayOrganyaMusic();
|
PlayOrganyaMusic();
|
||||||
gMusicNo = no;
|
gMusicNo = no;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReCallMusic()
|
void ReCallMusic()
|
||||||
|
|
112
src/TextScr.cpp
112
src/TextScr.cpp
|
@ -19,6 +19,8 @@
|
||||||
#include "Organya.h"
|
#include "Organya.h"
|
||||||
#include "Game.h"
|
#include "Game.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
|
||||||
|
|
||||||
#define TSC_BUFFER_SIZE 0x5000
|
#define TSC_BUFFER_SIZE 0x5000
|
||||||
|
|
||||||
TEXT_SCRIPT gTS;
|
TEXT_SCRIPT gTS;
|
||||||
|
@ -540,9 +542,7 @@ int TextScriptProc()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gTS.data[gTS.p_read + 1] == 'E' &&
|
if (IS_COMMAND('E','N','D'))
|
||||||
gTS.data[gTS.p_read + 2] == 'N' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == 'D')
|
|
||||||
{
|
{
|
||||||
gTS.mode = 0;
|
gTS.mode = 0;
|
||||||
gMC.cond &= ~1;
|
gMC.cond &= ~1;
|
||||||
|
@ -550,9 +550,7 @@ int TextScriptProc()
|
||||||
gTS.face = 0;
|
gTS.face = 0;
|
||||||
bExit = true;
|
bExit = true;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'T' &&
|
else if (IS_COMMAND('T','R','A'))
|
||||||
gTS.data[gTS.p_read + 2] == 'R' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == 'A')
|
|
||||||
{
|
{
|
||||||
int z = GetTextScriptNo(gTS.p_read + 4);
|
int z = GetTextScriptNo(gTS.p_read + 4);
|
||||||
int w = GetTextScriptNo(gTS.p_read + 9);
|
int w = GetTextScriptNo(gTS.p_read + 9);
|
||||||
|
@ -561,41 +559,31 @@ int TextScriptProc()
|
||||||
if (!TransferStage(z, w, x, y))
|
if (!TransferStage(z, w, x, y))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'F' &&
|
else if (IS_COMMAND('F','L','+'))
|
||||||
gTS.data[gTS.p_read + 2] == 'L' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == '+')
|
|
||||||
{
|
{
|
||||||
int z = GetTextScriptNo(gTS.p_read + 4);
|
int z = GetTextScriptNo(gTS.p_read + 4);
|
||||||
SetNPCFlag(z);
|
SetNPCFlag(z);
|
||||||
gTS.p_read += 8;
|
gTS.p_read += 8;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'F' &&
|
else if (IS_COMMAND('F','L','-'))
|
||||||
gTS.data[gTS.p_read + 2] == 'L' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == '-')
|
|
||||||
{
|
{
|
||||||
int z = GetTextScriptNo(gTS.p_read + 4);
|
int z = GetTextScriptNo(gTS.p_read + 4);
|
||||||
CutNPCFlag(z);
|
CutNPCFlag(z);
|
||||||
gTS.p_read += 8;
|
gTS.p_read += 8;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'S' &&
|
else if (IS_COMMAND('S','K','+'))
|
||||||
gTS.data[gTS.p_read + 2] == 'K' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == '+')
|
|
||||||
{
|
{
|
||||||
int z = GetTextScriptNo(gTS.p_read + 4);
|
int z = GetTextScriptNo(gTS.p_read + 4);
|
||||||
SetSkipFlag(z);
|
SetSkipFlag(z);
|
||||||
gTS.p_read += 8;
|
gTS.p_read += 8;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'S' &&
|
else if (IS_COMMAND('S','K','-'))
|
||||||
gTS.data[gTS.p_read + 2] == 'K' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == '-')
|
|
||||||
{
|
{
|
||||||
int z = GetTextScriptNo(gTS.p_read + 4);
|
int z = GetTextScriptNo(gTS.p_read + 4);
|
||||||
CutSkipFlag(z);
|
CutSkipFlag(z);
|
||||||
gTS.p_read += 8;
|
gTS.p_read += 8;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'K' &&
|
else if (IS_COMMAND('K','E','Y'))
|
||||||
gTS.data[gTS.p_read + 2] == 'E' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == 'Y')
|
|
||||||
{
|
{
|
||||||
g_GameFlags &= ~2;
|
g_GameFlags &= ~2;
|
||||||
g_GameFlags |= 1;
|
g_GameFlags |= 1;
|
||||||
|
@ -603,39 +591,29 @@ int TextScriptProc()
|
||||||
gMC.shock = 0;
|
gMC.shock = 0;
|
||||||
gTS.p_read += 4;
|
gTS.p_read += 4;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'P' &&
|
else if (IS_COMMAND('P','R','I'))
|
||||||
gTS.data[gTS.p_read + 2] == 'R' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == 'I')
|
|
||||||
{
|
{
|
||||||
g_GameFlags &= ~3;
|
g_GameFlags &= ~3;
|
||||||
gMC.shock = 0;
|
gMC.shock = 0;
|
||||||
gTS.p_read += 4;
|
gTS.p_read += 4;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'F' &&
|
else if (IS_COMMAND('F','R','E'))
|
||||||
gTS.data[gTS.p_read + 2] == 'R' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == 'E')
|
|
||||||
{
|
{
|
||||||
g_GameFlags |= 3;
|
g_GameFlags |= 3;
|
||||||
gTS.p_read += 4;
|
gTS.p_read += 4;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'N' &&
|
else if (IS_COMMAND('N','O','D'))
|
||||||
gTS.data[gTS.p_read + 2] == 'O' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == 'D')
|
|
||||||
{
|
{
|
||||||
gTS.mode = 2;
|
gTS.mode = 2;
|
||||||
gTS.p_read += 4;
|
gTS.p_read += 4;
|
||||||
bExit = true;
|
bExit = true;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'C' &&
|
else if (IS_COMMAND('C','L','R'))
|
||||||
gTS.data[gTS.p_read + 2] == 'L' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == 'R')
|
|
||||||
{
|
{
|
||||||
ClearTextLine();
|
ClearTextLine();
|
||||||
gTS.p_read += 4;
|
gTS.p_read += 4;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'M' &&
|
else if (IS_COMMAND('M','S','G'))
|
||||||
gTS.data[gTS.p_read + 2] == 'S' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == 'G')
|
|
||||||
{
|
{
|
||||||
ClearTextLine();
|
ClearTextLine();
|
||||||
gTS.flags |= 0x03;
|
gTS.flags |= 0x03;
|
||||||
|
@ -645,9 +623,7 @@ int TextScriptProc()
|
||||||
gTS.p_read += 4;
|
gTS.p_read += 4;
|
||||||
bExit = true;
|
bExit = true;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'M' &&
|
else if (IS_COMMAND('M','S','2'))
|
||||||
gTS.data[gTS.p_read + 2] == 'S' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == '2')
|
|
||||||
{
|
{
|
||||||
ClearTextLine();
|
ClearTextLine();
|
||||||
gTS.flags |= 0x21;
|
gTS.flags |= 0x21;
|
||||||
|
@ -658,9 +634,7 @@ int TextScriptProc()
|
||||||
gTS.p_read += 4;
|
gTS.p_read += 4;
|
||||||
bExit = true;
|
bExit = true;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'M' &&
|
else if (IS_COMMAND('M','S','3'))
|
||||||
gTS.data[gTS.p_read + 2] == 'S' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == '3')
|
|
||||||
{
|
{
|
||||||
ClearTextLine();
|
ClearTextLine();
|
||||||
gTS.flags |= 0x23;
|
gTS.flags |= 0x23;
|
||||||
|
@ -670,39 +644,29 @@ int TextScriptProc()
|
||||||
gTS.p_read += 4;
|
gTS.p_read += 4;
|
||||||
bExit = true;
|
bExit = true;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'W' &&
|
else if (IS_COMMAND('W','A','I'))
|
||||||
gTS.data[gTS.p_read + 2] == 'A' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == 'I')
|
|
||||||
{
|
{
|
||||||
gTS.mode = 4;
|
gTS.mode = 4;
|
||||||
gTS.wait_next = GetTextScriptNo(gTS.p_read + 4);
|
gTS.wait_next = GetTextScriptNo(gTS.p_read + 4);
|
||||||
gTS.p_read += 8;
|
gTS.p_read += 8;
|
||||||
bExit = true;
|
bExit = true;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'T' &&
|
else if (IS_COMMAND('T','U','R'))
|
||||||
gTS.data[gTS.p_read + 2] == 'U' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == 'R')
|
|
||||||
{
|
{
|
||||||
gTS.p_read += 4;
|
gTS.p_read += 4;
|
||||||
gTS.flags |= 0x10;
|
gTS.flags |= 0x10;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'S' &&
|
else if (IS_COMMAND('S','A','T'))
|
||||||
gTS.data[gTS.p_read + 2] == 'A' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == 'T')
|
|
||||||
{
|
{
|
||||||
gTS.p_read += 4;
|
gTS.p_read += 4;
|
||||||
gTS.flags |= 0x40;
|
gTS.flags |= 0x40;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'C' &&
|
else if (IS_COMMAND('C','A','T'))
|
||||||
gTS.data[gTS.p_read + 2] == 'A' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == 'T')
|
|
||||||
{
|
{
|
||||||
gTS.p_read += 4;
|
gTS.p_read += 4;
|
||||||
gTS.flags |= 0x40;
|
gTS.flags |= 0x40;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'F' &&
|
else if (IS_COMMAND('F','L','J'))
|
||||||
gTS.data[gTS.p_read + 2] == 'L' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == 'J')
|
|
||||||
{
|
{
|
||||||
int x = GetTextScriptNo(gTS.p_read + 4);
|
int x = GetTextScriptNo(gTS.p_read + 4);
|
||||||
int z = GetTextScriptNo(gTS.p_read + 9);
|
int z = GetTextScriptNo(gTS.p_read + 9);
|
||||||
|
@ -712,9 +676,7 @@ int TextScriptProc()
|
||||||
else
|
else
|
||||||
gTS.p_read += 13;
|
gTS.p_read += 13;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'S' &&
|
else if (IS_COMMAND('S','K','J'))
|
||||||
gTS.data[gTS.p_read + 2] == 'K' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == 'J')
|
|
||||||
{
|
{
|
||||||
int x = GetTextScriptNo(gTS.p_read + 4);
|
int x = GetTextScriptNo(gTS.p_read + 4);
|
||||||
int z = GetTextScriptNo(gTS.p_read + 9);
|
int z = GetTextScriptNo(gTS.p_read + 9);
|
||||||
|
@ -724,9 +686,7 @@ int TextScriptProc()
|
||||||
else
|
else
|
||||||
gTS.p_read += 13;
|
gTS.p_read += 13;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'F' &&
|
else if (IS_COMMAND('F','A','I'))
|
||||||
gTS.data[gTS.p_read + 2] == 'A' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == 'I')
|
|
||||||
{
|
{
|
||||||
int z = GetTextScriptNo(gTS.p_read + 4);
|
int z = GetTextScriptNo(gTS.p_read + 4);
|
||||||
StartFadeIn(z);
|
StartFadeIn(z);
|
||||||
|
@ -734,9 +694,7 @@ int TextScriptProc()
|
||||||
gTS.p_read += 8;
|
gTS.p_read += 8;
|
||||||
bExit = true;
|
bExit = true;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'F' &&
|
else if (IS_COMMAND('F','A','O'))
|
||||||
gTS.data[gTS.p_read + 2] == 'A' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == 'O')
|
|
||||||
{
|
{
|
||||||
int z = GetTextScriptNo(gTS.p_read + 4);
|
int z = GetTextScriptNo(gTS.p_read + 4);
|
||||||
StartFadeOut(z);
|
StartFadeOut(z);
|
||||||
|
@ -744,31 +702,29 @@ int TextScriptProc()
|
||||||
gTS.p_read += 8;
|
gTS.p_read += 8;
|
||||||
bExit = true;
|
bExit = true;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'M' &&
|
else if (IS_COMMAND('M','N','A'))
|
||||||
gTS.data[gTS.p_read + 2] == 'N' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == 'A')
|
|
||||||
{
|
{
|
||||||
StartMapName();
|
StartMapName();
|
||||||
gTS.p_read += 4;
|
gTS.p_read += 4;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'C' &&
|
else if (IS_COMMAND('S','O','U'))
|
||||||
gTS.data[gTS.p_read + 2] == 'M' &&
|
{
|
||||||
gTS.data[gTS.p_read + 3] == 'U')
|
int z = GetTextScriptNo(gTS.p_read + 4);
|
||||||
|
PlaySoundObject(z, 1);
|
||||||
|
gTS.p_read += 8;
|
||||||
|
}
|
||||||
|
else if (IS_COMMAND('C','M','U'))
|
||||||
{
|
{
|
||||||
int z = GetTextScriptNo(gTS.p_read + 4);
|
int z = GetTextScriptNo(gTS.p_read + 4);
|
||||||
ChangeMusic(z);
|
ChangeMusic(z);
|
||||||
gTS.p_read += 8;
|
gTS.p_read += 8;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'F' &&
|
else if (IS_COMMAND('F','M','U'))
|
||||||
gTS.data[gTS.p_read + 2] == 'M' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == 'U')
|
|
||||||
{
|
{
|
||||||
SetOrganyaFadeout();
|
SetOrganyaFadeout();
|
||||||
gTS.p_read += 4;
|
gTS.p_read += 4;
|
||||||
}
|
}
|
||||||
else if (gTS.data[gTS.p_read + 1] == 'R' &&
|
else if (IS_COMMAND('R','M','U'))
|
||||||
gTS.data[gTS.p_read + 2] == 'M' &&
|
|
||||||
gTS.data[gTS.p_read + 3] == 'U')
|
|
||||||
{
|
{
|
||||||
ReCallMusic();
|
ReCallMusic();
|
||||||
gTS.p_read += 4;
|
gTS.p_read += 4;
|
||||||
|
|
Loading…
Add table
Reference in a new issue