Removed all trailing spaces and added newline at EOF (when not present)
Also changed a "linux" to "Linux" Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
This commit is contained in:
parent
1f055ccfe8
commit
960fa6f456
53 changed files with 954 additions and 954 deletions
|
@ -119,7 +119,7 @@ void read_Config(){
|
|||
}
|
||||
if (CharsToLong(config.attack) == 0){
|
||||
buttonxz->setonly();
|
||||
} else {
|
||||
} else {
|
||||
buttonzx->setonly();
|
||||
}
|
||||
if (CharsToLong(config.okay) == 0){
|
||||
|
@ -144,7 +144,7 @@ void write_Config(Fl_Widget*, void*){
|
|||
LongToChars(movegt->value(), config.move);
|
||||
LongToChars(buttonzx->value(), config.attack);
|
||||
LongToChars(okayattack->value(), config.okay);
|
||||
|
||||
|
||||
LongToChars(displaychoice->value(), config.display);
|
||||
LongToChars(joychoice->value(), config.useJoy);
|
||||
for(char i =0;i<8;i++){
|
||||
|
@ -158,28 +158,28 @@ void write_Config(Fl_Widget*, void*){
|
|||
}
|
||||
int main(int argc, char* argv[]){
|
||||
Fl_Window *mainw = new Fl_Window(400, 380, "DoConfig - Doukutsu Monogatari Settings");
|
||||
|
||||
|
||||
Fl_Group *movegroup = new Fl_Group(10, 10, 185, 50);
|
||||
movegroup->box(FL_THIN_DOWN_BOX);
|
||||
movear = new Fl_Radio_Round_Button(10, 10, 185, 20, "Arrows for Movement");
|
||||
movear->setonly();
|
||||
movegt = new Fl_Radio_Round_Button(10, 40, 185, 20, "<>? for Movement");
|
||||
movegroup->end();
|
||||
|
||||
|
||||
Fl_Group *buttongroup = new Fl_Group(10, 70, 185, 50);
|
||||
buttongroup->box(FL_THIN_DOWN_BOX);
|
||||
buttonxz = new Fl_Radio_Round_Button(10, 70, 185, 20, "Z=Jump; X=Attack");
|
||||
buttonxz->setonly();
|
||||
buttonzx = new Fl_Radio_Round_Button(10, 100, 185, 20, "X=Jump; Z=Attack");
|
||||
buttongroup->end();
|
||||
|
||||
|
||||
Fl_Group *okaygroup = new Fl_Group(205, 10, 185, 50);
|
||||
okaygroup->box(FL_THIN_DOWN_BOX);
|
||||
okayjump = new Fl_Radio_Round_Button(205, 10, 185, 20, "Jump=Okay");
|
||||
okayjump->setonly();
|
||||
okayattack = new Fl_Radio_Round_Button(205, 40, 185, 20, "Attack=Okay");
|
||||
okaygroup->end();
|
||||
|
||||
|
||||
displaychoice = new Fl_Choice(205, 70, 185, 20);
|
||||
Fl_Menu_Item screens[] = {
|
||||
{"Fullscreen 16-bit"},
|
||||
|
@ -191,7 +191,7 @@ int main(int argc, char* argv[]){
|
|||
displaychoice->menu(screens);
|
||||
joychoice = new Fl_Check_Button(205, 100, 185, 20, "Use Joypad");
|
||||
joychoice->callback(&activatejoy);
|
||||
|
||||
|
||||
joystuffcontainer = new Fl_Group(10, 130, 380, 200);
|
||||
joystuffcontainer->box(FL_THIN_DOWN_BOX);
|
||||
for(char i=0;i<8;i++){
|
||||
|
@ -222,17 +222,17 @@ int main(int argc, char* argv[]){
|
|||
labelmap->label("Map:");
|
||||
labelmap->align(FL_ALIGN_RIGHT);
|
||||
labelmap->end();
|
||||
|
||||
|
||||
joystuffcontainer->end();
|
||||
|
||||
|
||||
Fl_Button *okaybutton = new Fl_Button(10, 340, 185, 30, "Okay");
|
||||
okaybutton->callback(&write_Config);
|
||||
Fl_Button *cancelbutton = new Fl_Button(205, 340, 185, 30, "Cancel");
|
||||
cancelbutton->callback(&quit);
|
||||
|
||||
|
||||
mainw->end();
|
||||
mainw->show(argc, argv);
|
||||
|
||||
|
||||
read_Config();
|
||||
Fl::option(Fl::OPTION_VISIBLE_FOCUS, false);
|
||||
return Fl::run();
|
||||
|
|
52
src/Back.cpp
52
src/Back.cpp
|
@ -101,7 +101,7 @@ void PutBack(int fx, int fy)
|
|||
{
|
||||
RECT rect = {0, 0, gBack.partsW, gBack.partsH};
|
||||
RECT rcSkyFiller = {106, 0, 255, 88};
|
||||
|
||||
|
||||
switch (gBack.type)
|
||||
{
|
||||
case 0:
|
||||
|
@ -111,7 +111,7 @@ void PutBack(int fx, int fy)
|
|||
PutBitmap4(&grcGame, x, y, &rect, SURFACE_ID_LEVEL_BACKGROUND);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 1:
|
||||
for (int y = -(fy / 0x400 % gBack.partsH); y < WINDOW_HEIGHT; y += gBack.partsH)
|
||||
{
|
||||
|
@ -119,7 +119,7 @@ void PutBack(int fx, int fy)
|
|||
PutBitmap4(&grcGame, x, y, &rect, SURFACE_ID_LEVEL_BACKGROUND);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 2:
|
||||
for (int y = -(fy / 0x200 % gBack.partsH); y < WINDOW_HEIGHT; y += gBack.partsH)
|
||||
{
|
||||
|
@ -127,7 +127,7 @@ void PutBack(int fx, int fy)
|
|||
PutBitmap4(&grcGame, x, y, &rect, SURFACE_ID_LEVEL_BACKGROUND);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 5:
|
||||
for (int y = -gBack.partsH; y < WINDOW_HEIGHT; y += gBack.partsH)
|
||||
{
|
||||
|
@ -135,7 +135,7 @@ void PutBack(int fx, int fy)
|
|||
PutBitmap4(&grcGame, x, y, &rect, SURFACE_ID_LEVEL_BACKGROUND);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 6:
|
||||
case 7:
|
||||
//Sky
|
||||
|
@ -149,7 +149,7 @@ void PutBack(int fx, int fy)
|
|||
PutBitmap4(&grcGame, x, y, &rcSkyFiller, SURFACE_ID_LEVEL_BACKGROUND);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
rect.top = 0;
|
||||
rect.bottom = 88;
|
||||
rect.left = 0;
|
||||
|
@ -162,45 +162,45 @@ void PutBack(int fx, int fy)
|
|||
rect.left = gBack.fx / 2;
|
||||
rect.right = 320;
|
||||
PutBitmap4(&grcGame, 0, 88 + (WINDOW_HEIGHT - 240), &rect, SURFACE_ID_LEVEL_BACKGROUND);
|
||||
|
||||
|
||||
rect.left = 0;
|
||||
for (int i = 0; i < ((WINDOW_WIDTH - 1) / 320) + 1; i++)
|
||||
PutBitmap4(&grcGame, (320 * (i + 1)) - gBack.fx / 2 % 320, 88 + (WINDOW_HEIGHT - 240), &rect, SURFACE_ID_LEVEL_BACKGROUND);
|
||||
|
||||
|
||||
//Cloud layer 2
|
||||
rect.top = 123;
|
||||
rect.bottom = 146;
|
||||
rect.left = gBack.fx % 320;
|
||||
rect.right = 320;
|
||||
PutBitmap4(&grcGame, 0, 123 + (WINDOW_HEIGHT - 240), &rect, SURFACE_ID_LEVEL_BACKGROUND);
|
||||
|
||||
|
||||
rect.left = 0;
|
||||
for (int i = 0; i < ((WINDOW_WIDTH - 1) / 320) + 1; i++)
|
||||
PutBitmap4(&grcGame, (320 * (i + 1)) - gBack.fx % 320, 123 + (WINDOW_HEIGHT - 240), &rect, SURFACE_ID_LEVEL_BACKGROUND);
|
||||
|
||||
|
||||
//Cloud layer 3
|
||||
rect.top = 146;
|
||||
rect.bottom = 176;
|
||||
rect.left = 2 * gBack.fx % 320;
|
||||
rect.right = 320;
|
||||
PutBitmap4(&grcGame, 0, 146 + (WINDOW_HEIGHT - 240), &rect, SURFACE_ID_LEVEL_BACKGROUND);
|
||||
|
||||
|
||||
rect.left = 0;
|
||||
for (int i = 0; i < ((WINDOW_WIDTH - 1) / 320) + 1; i++)
|
||||
PutBitmap4(&grcGame, (320 * (i + 1)) - 2 * gBack.fx % 320, 146 + (WINDOW_HEIGHT - 240), &rect, SURFACE_ID_LEVEL_BACKGROUND);
|
||||
|
||||
|
||||
//Cloud layer 4
|
||||
rect.top = 176;
|
||||
rect.bottom = 240;
|
||||
rect.left = 4 * gBack.fx % 320;
|
||||
rect.right = 320;
|
||||
PutBitmap4(&grcGame, 0, 176 + (WINDOW_HEIGHT - 240), &rect, SURFACE_ID_LEVEL_BACKGROUND);
|
||||
|
||||
|
||||
rect.left = 0;
|
||||
for (int i = 0; i < ((WINDOW_WIDTH - 1) / 320) + 1; i++)
|
||||
PutBitmap4(&grcGame, (320 * (i + 1)) - 4 * gBack.fx % 320, 176 + (WINDOW_HEIGHT - 240), &rect, SURFACE_ID_LEVEL_BACKGROUND);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
@ -226,17 +226,17 @@ void PutFront(int fx, int fy)
|
|||
x_2 = x_1 + (((WINDOW_WIDTH + 31) >> 5) + 1);
|
||||
y_1 = 0;
|
||||
y_2 = y_1 + 32;
|
||||
|
||||
|
||||
for (y = y_1; y < y_2; y++)
|
||||
{
|
||||
ypos = (y * 0x20 * 0x200) / 0x200 - fy / 0x200 + gWaterY / 0x200;
|
||||
|
||||
|
||||
if (ypos < -32)
|
||||
continue;
|
||||
|
||||
if (ypos > WINDOW_HEIGHT)
|
||||
break;
|
||||
|
||||
|
||||
for (x = x_1; x < x_2; x++)
|
||||
{
|
||||
xpos = (x * 0x20 * 0x200) / 0x200 - fx / 0x200;
|
||||
|
@ -247,49 +247,49 @@ void PutFront(int fx, int fy)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Draw black bars
|
||||
if (!(g_GameFlags & 8)) //Detect if credits are running
|
||||
{
|
||||
const bool fromFocus = (gStageNo == 31); //Get if we should only draw around a 320x240 area of the focus point
|
||||
|
||||
|
||||
//Get focus rect
|
||||
int focusX = gFrame.x + (WINDOW_WIDTH << 8) - (320 << 8);
|
||||
int focusY = gFrame.y + (WINDOW_HEIGHT << 8) - (240 << 8);
|
||||
int focusR = focusX + (320 << 9);
|
||||
int focusB = focusY + (240 << 9);
|
||||
|
||||
|
||||
//Get borders
|
||||
const int barLeft = fromFocus ? focusX : -0x1000;
|
||||
const int barTop = fromFocus ? focusY : -0x1000;
|
||||
|
||||
|
||||
const int barRight = fromFocus ? focusR : (gMap.width << 13) - 0x1000;
|
||||
const int barBottom = fromFocus ? focusB : (gMap.length << 13) - 0x1000;
|
||||
|
||||
|
||||
//Draw bars
|
||||
RECT barRect;
|
||||
|
||||
|
||||
//Left
|
||||
barRect.left = 0;
|
||||
barRect.top = 0;
|
||||
barRect.right = (barLeft - gFrame.x) >> 9;
|
||||
barRect.bottom = WINDOW_HEIGHT;
|
||||
CortBox(&barRect, 0x000000);
|
||||
|
||||
|
||||
//Top
|
||||
barRect.left = 0;
|
||||
barRect.top = 0;
|
||||
barRect.right = WINDOW_WIDTH;
|
||||
barRect.bottom = (barTop - gFrame.y) >> 9;
|
||||
CortBox(&barRect, 0x000000);
|
||||
|
||||
|
||||
//Right
|
||||
barRect.left = (barRight - gFrame.x) >> 9;
|
||||
barRect.top = 0;
|
||||
barRect.right = WINDOW_WIDTH;
|
||||
barRect.bottom = WINDOW_HEIGHT;
|
||||
CortBox(&barRect, 0x000000);
|
||||
|
||||
|
||||
//Bottom
|
||||
barRect.left = 0;
|
||||
barRect.top = (barBottom - gFrame.y) >> 9;
|
||||
|
|
36
src/Boss.cpp
36
src/Boss.cpp
|
@ -48,20 +48,20 @@ void PutBossChar(int fx, int fy)
|
|||
else
|
||||
{
|
||||
a = 0;
|
||||
|
||||
|
||||
if (gBoss[b].bits & npc_showDamage && gBoss[b].damage_view)
|
||||
{
|
||||
SetValueView(&gBoss[b].x, &gBoss[b].y, gBoss[b].damage_view);
|
||||
gBoss[b].damage_view = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int side;
|
||||
if (gBoss[b].direct == 0)
|
||||
side = gBoss[b].view.front;
|
||||
else
|
||||
side = gBoss[b].view.back;
|
||||
|
||||
|
||||
PutBitmap3(
|
||||
&grcGame,
|
||||
(gBoss[b].x - side) / 0x200 - fx / 0x200 + a,
|
||||
|
@ -111,7 +111,7 @@ void HitBossBullet()
|
|||
&& gBoss[bos].y - gBoss[bos].hit.top < gBul[bul].y + gBul[bul].blockYL
|
||||
&& gBoss[bos].y + gBoss[bos].hit.bottom > gBul[bul].y - gBul[bul].blockYL)
|
||||
bHit = TRUE;
|
||||
|
||||
|
||||
if (bHit)
|
||||
{
|
||||
//Damage boss
|
||||
|
@ -121,13 +121,13 @@ void HitBossBullet()
|
|||
bos_ = 0;
|
||||
else
|
||||
bos_ = bos;
|
||||
|
||||
|
||||
gBoss[bos_].life -= gBul[bul].damage;
|
||||
|
||||
|
||||
if (gBoss[bos_].life < 1)
|
||||
{
|
||||
gBoss[bos_].life = bos_;
|
||||
|
||||
|
||||
if ((gMC.cond & 0x80) && gBoss[bos_].bits & npc_eventDie)
|
||||
{
|
||||
StartTextScript(gBoss[bos_].code_event);
|
||||
|
@ -135,7 +135,7 @@ void HitBossBullet()
|
|||
else
|
||||
{
|
||||
PlaySoundObject(gBoss[bos_].destroy_voice, 1);
|
||||
|
||||
|
||||
switch (gBoss[bos_].size)
|
||||
{
|
||||
case 1:
|
||||
|
@ -148,7 +148,7 @@ void HitBossBullet()
|
|||
SetDestroyNpChar(gBoss[bos_].x, gBoss[bos_].y, gBoss[bos_].view.back, 16);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
gBoss[bos_].cond = 0;
|
||||
}
|
||||
}
|
||||
|
@ -161,12 +161,12 @@ void HitBossBullet()
|
|||
SetCaret(gBul[bul].x, gBul[bul].y, 11, 0);
|
||||
PlaySoundObject(gBoss[bos_].hit_voice, 1);
|
||||
}
|
||||
|
||||
|
||||
gBoss[bos].shock = 8;
|
||||
gBoss[bos_].shock = 8;
|
||||
gBoss[bos_].damage_view -= gBul[bul].damage;
|
||||
}
|
||||
|
||||
|
||||
if (--gBul[bul].life < 1)
|
||||
gBul[bul].cond = 0;
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ void ActBossChar()
|
|||
code_char = gBoss[0].code_char;
|
||||
|
||||
gpBossFuncTbl[code_char]();
|
||||
|
||||
|
||||
for (bos = 0; bos < BOSS_MAX; bos++)
|
||||
{
|
||||
if (gBoss[bos].shock)
|
||||
|
@ -258,7 +258,7 @@ void HitBossMap()
|
|||
offx[13] = 0;
|
||||
offx[14] = 1;
|
||||
offx[15] = 2;
|
||||
|
||||
|
||||
offy[0] = 0;
|
||||
offy[1] = 0;
|
||||
offy[2] = 1;
|
||||
|
@ -275,7 +275,7 @@ void HitBossMap()
|
|||
offy[13] = -1;
|
||||
offy[14] = -1;
|
||||
offy[15] = -1;
|
||||
|
||||
|
||||
for (b = 0; b < BOSS_MAX; b++)
|
||||
{
|
||||
int judg;
|
||||
|
@ -288,7 +288,7 @@ void HitBossMap()
|
|||
|
||||
if (gBoss[b].size >= 3)
|
||||
{
|
||||
judg = 16;
|
||||
judg = 16;
|
||||
x = gBoss[b].x / 0x10 / 0x200;
|
||||
y = gBoss[b].y / 0x10 / 0x200;
|
||||
}
|
||||
|
@ -298,12 +298,12 @@ void HitBossMap()
|
|||
x = gBoss[b].x / 0x10 / 0x200;
|
||||
y = gBoss[b].y / 0x10 / 0x200;
|
||||
}
|
||||
|
||||
|
||||
gBoss[b].flag = 0;
|
||||
for (j = 0; j < judg; j++)
|
||||
{
|
||||
atrb[j] = GetAttribute(x + offx[j], y + offy[j]);
|
||||
|
||||
|
||||
switch (atrb[j])
|
||||
{
|
||||
case 0x44:
|
||||
|
@ -381,4 +381,4 @@ void HitBossMap()
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -720,4 +720,4 @@ void ActBossChar_Ballos(void)
|
|||
ActBossChar_Body(&gBoss[3]);
|
||||
ActBossChar_HITAI(&gBoss[4]);
|
||||
ActBossChar_HARA(&gBoss[5]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -209,4 +209,4 @@ void ActBossChar_Ironhead(void)
|
|||
{
|
||||
npc->rect = rc[npc->ani_no];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ static void ActBoss01_12()
|
|||
for (i = 1; i < 3; ++i)
|
||||
{
|
||||
gBoss[i].y = (gBoss[0].y + gBoss[i + 2].y - 0x1000) / 2;
|
||||
|
||||
|
||||
if (gBoss[i].direct == 0)
|
||||
{
|
||||
gBoss[i].x = gBoss[0].x - 0x2000;
|
||||
|
|
|
@ -229,4 +229,4 @@ void ActBossChar_Press(void)
|
|||
{
|
||||
npc->rect = rc[npc->ani_no];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -561,4 +561,4 @@ void ActBossChar_Twin(void)
|
|||
|
||||
RECT rc = {0, 0, 0, 0};
|
||||
npc->rect = rc;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -864,4 +864,4 @@ void ActBossChar_MonstX(void)
|
|||
gBoss[11].act_no = 300;
|
||||
gBoss[12].act_no = 300;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ int JudgeHitBulletBlock(int x, int y, BULLET *bul)
|
|||
&& bul->y - bul->blockYL < (0x10 * y + 8) * 0x200
|
||||
&& bul->y + bul->blockYL> (0x10 * y - 8) * 0x200)
|
||||
hit |= 0x200;
|
||||
|
||||
|
||||
if (hit && (bul->bbits & 0x60) && GetAttribute(x, y) == 0x43)
|
||||
{
|
||||
if (!(bul->bbits & 0x40))
|
||||
|
@ -41,7 +41,7 @@ int JudgeHitBulletBlock(int x, int y, BULLET *bul)
|
|||
SetNpChar(4, x * 0x200 * 0x10, y * 0x200 * 0x10, Random(-0x200, 0x200), Random(-0x200, 0x200), 0, 0, 256);
|
||||
ShiftMapParts(x, y);
|
||||
}
|
||||
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ int JudgeHitBulletBlock2(int x, int y, uint8_t *atrb, BULLET *bul)
|
|||
int workX;
|
||||
int workY;
|
||||
int hit = 0;
|
||||
|
||||
|
||||
int block[4];
|
||||
if (bul->bbits & 0x40)
|
||||
{
|
||||
|
@ -77,10 +77,10 @@ int JudgeHitBulletBlock2(int x, int y, uint8_t *atrb, BULLET *bul)
|
|||
++atrb;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
workX = (0x10 * x + 8) * 0x200;
|
||||
workY = (0x10 * y + 8) * 0x200;
|
||||
|
||||
|
||||
//Left wall
|
||||
if (block[0] && block[2])
|
||||
{
|
||||
|
@ -97,7 +97,7 @@ int JudgeHitBulletBlock2(int x, int y, uint8_t *atrb, BULLET *bul)
|
|||
if (bul->x - bul->blockXL < workX && bul->y + bul->blockYL > workY + 0x600)
|
||||
hit |= 1;
|
||||
}
|
||||
|
||||
|
||||
//Right wall
|
||||
if (block[1] && block[3])
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ int JudgeHitBulletBlock2(int x, int y, uint8_t *atrb, BULLET *bul)
|
|||
if (bul->y - bul->blockYL < workY && bul->x + bul->blockXL > workX + 0x600)
|
||||
hit |= 2;
|
||||
}
|
||||
|
||||
|
||||
//Ground
|
||||
if (block[2] && block[3])
|
||||
{
|
||||
|
@ -148,7 +148,7 @@ int JudgeHitBulletBlock2(int x, int y, uint8_t *atrb, BULLET *bul)
|
|||
if (bul->y + bul->blockYL > workY && bul->x + bul->blockXL > workX + 0x600)
|
||||
hit |= 8;
|
||||
}
|
||||
|
||||
|
||||
//Clip
|
||||
if (bul->bbits & 8)
|
||||
{
|
||||
|
@ -165,7 +165,7 @@ int JudgeHitBulletBlock2(int x, int y, uint8_t *atrb, BULLET *bul)
|
|||
{
|
||||
Vanish(bul);
|
||||
}
|
||||
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
|
@ -323,7 +323,7 @@ void HitBulletMap()
|
|||
|
||||
x = gBul[i].x / 0x10 / 0x200;
|
||||
y = gBul[i].y / 0x10 / 0x200;
|
||||
|
||||
|
||||
//Get surrounding tiles
|
||||
offx[0] = 0;
|
||||
offx[1] = 1;
|
||||
|
@ -333,15 +333,15 @@ void HitBulletMap()
|
|||
offy[1] = 0;
|
||||
offy[2] = 1;
|
||||
offy[3] = 1;
|
||||
|
||||
|
||||
atrb[0] = GetAttribute(x, y);
|
||||
atrb[1] = GetAttribute(x + 1, y);
|
||||
atrb[2] = GetAttribute(x, y + 1);
|
||||
atrb[3] = GetAttribute(x + 1, y + 1);
|
||||
|
||||
|
||||
//Clear hit tiles
|
||||
gBul[i].flag = 0;
|
||||
|
||||
|
||||
if (gBul[i].bbits & 4)
|
||||
{
|
||||
// For some reason a 'continue' just doesn't produce the same assembly
|
||||
|
@ -396,7 +396,7 @@ void HitBulletMap()
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gBul[i].flag |= JudgeHitBulletBlock2(x, y, atrb, &gBul[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ int CountArmsBullet(int arms_code)
|
|||
if (gBul[i].cond & 0x80 && (gBul[i].code_bullet + 2) / 3 == arms_code)
|
||||
++count;
|
||||
}
|
||||
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ int CountBulletNum(int bullet_code)
|
|||
if (gBul[i].cond & 0x80 && gBul[i].code_bullet == bullet_code)
|
||||
++count;
|
||||
}
|
||||
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ void PutBullet(int fx, int fy)
|
|||
for (i = 0; i < BULLET_MAX; i++)
|
||||
{
|
||||
if (gBul[i].cond & 0x80)
|
||||
{
|
||||
{
|
||||
switch (gBul[i].direct)
|
||||
{
|
||||
case 0:
|
||||
|
@ -142,7 +142,7 @@ void PutBullet(int fx, int fy)
|
|||
y = gBul[i].y - gBul[i].view.back;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
PutBitmap3(&grcGame, x / 0x200 - fx / 0x200, y / 0x200 - fy / 0x200, &gBul[i].rect, SURFACE_ID_BULLET);
|
||||
}
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ void ActBullet_PoleStar(BULLET *bul, int level)
|
|||
if (bul->act_no == 0)
|
||||
{
|
||||
bul->act_no = 1;
|
||||
|
||||
|
||||
//Set speed
|
||||
switch (bul->direct)
|
||||
{
|
||||
|
@ -403,7 +403,7 @@ void ActBullet_PoleStar(BULLET *bul, int level)
|
|||
bul->ym = 0x1000;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//Set hitbox
|
||||
switch (level)
|
||||
{
|
||||
|
@ -507,12 +507,12 @@ void ActBullet_FireBall(BULLET *bul, int level)
|
|||
bBreak = TRUE;
|
||||
if (bul->flag & 1 && bul->flag & 4)
|
||||
bBreak = TRUE;
|
||||
|
||||
|
||||
if (!bul->direct && bul->flag & 1)
|
||||
bul->direct = 2;
|
||||
if (bul->direct == 2 && bul->flag & 4)
|
||||
bul->direct = 0;
|
||||
|
||||
|
||||
if (bBreak)
|
||||
{
|
||||
bul->cond = 0;
|
||||
|
@ -524,7 +524,7 @@ void ActBullet_FireBall(BULLET *bul, int level)
|
|||
if (bul->act_no == 0)
|
||||
{
|
||||
bul->act_no = 1;
|
||||
|
||||
|
||||
switch (bul->direct)
|
||||
{
|
||||
case 0:
|
||||
|
@ -532,17 +532,17 @@ void ActBullet_FireBall(BULLET *bul, int level)
|
|||
break;
|
||||
case 1:
|
||||
bul->xm = gMC.xm;
|
||||
|
||||
|
||||
if (gMC.xm < 0)
|
||||
bul->direct = 0;
|
||||
else
|
||||
bul->direct = 2;
|
||||
|
||||
|
||||
if (gMC.direct == 0)
|
||||
bul->xm -= 0x80;
|
||||
else
|
||||
bul->xm += 0x80;
|
||||
|
||||
|
||||
bul->ym = -0x5FF;
|
||||
break;
|
||||
case 2:
|
||||
|
@ -569,14 +569,14 @@ void ActBullet_FireBall(BULLET *bul, int level)
|
|||
bul->xm = 0x400;
|
||||
else if (bul->flag & 4)
|
||||
bul->xm = -0x400;
|
||||
|
||||
|
||||
bul->ym += 85;
|
||||
if (bul->ym > 0x3FF)
|
||||
bul->ym = 0x3FF;
|
||||
|
||||
|
||||
bul->x += bul->xm;
|
||||
bul->y += bul->ym;
|
||||
|
||||
|
||||
if (bul->flag & 0xD)
|
||||
PlaySoundObject(34, 1);
|
||||
}
|
||||
|
@ -598,14 +598,14 @@ void ActBullet_FireBall(BULLET *bul, int level)
|
|||
SET_RECT(rect_right2[0], 224, 16, 240, 32)
|
||||
SET_RECT(rect_right2[1], 208, 16, 224, 32)
|
||||
SET_RECT(rect_right2[2], 192, 16, 208, 32)
|
||||
|
||||
|
||||
bul->ani_no++;
|
||||
|
||||
|
||||
if (level == 1)
|
||||
{
|
||||
if (bul->ani_no > 3)
|
||||
bul->ani_no = 0;
|
||||
|
||||
|
||||
if (bul->direct == 0)
|
||||
bul->rect = rect_left1[bul->ani_no];
|
||||
else
|
||||
|
@ -615,12 +615,12 @@ void ActBullet_FireBall(BULLET *bul, int level)
|
|||
{
|
||||
if (bul->ani_no > 2)
|
||||
bul->ani_no = 0;
|
||||
|
||||
|
||||
if (bul->direct == 0)
|
||||
bul->rect = rect_left2[bul->ani_no];
|
||||
else
|
||||
bul->rect = rect_right2[bul->ani_no];
|
||||
|
||||
|
||||
if (level == 2)
|
||||
SetNpChar(129, bul->x, bul->y, 0, -0x200, bul->ani_no, 0, 0x100);
|
||||
else
|
||||
|
@ -676,9 +676,9 @@ void ActBullet_MachineGun(BULLET *bul, int level)
|
|||
move = 0x1000;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
bul->act_no = 1;
|
||||
|
||||
|
||||
switch (bul->direct)
|
||||
{
|
||||
case 0:
|
||||
|
@ -703,7 +703,7 @@ void ActBullet_MachineGun(BULLET *bul, int level)
|
|||
{
|
||||
bul->x += bul->xm;
|
||||
bul->y += bul->ym;
|
||||
|
||||
|
||||
switch (level)
|
||||
{
|
||||
case 1:
|
||||
|
@ -808,7 +808,7 @@ void ActBullet_Missile(BULLET *bul, int level)
|
|||
}
|
||||
|
||||
static unsigned int inc;
|
||||
|
||||
|
||||
switch (++inc % 3)
|
||||
{
|
||||
case 0:
|
||||
|
@ -945,7 +945,7 @@ void ActBullet_Bom(BULLET *bul, int level)
|
|||
{
|
||||
case 0:
|
||||
bul->act_no = 1;
|
||||
|
||||
|
||||
switch (level)
|
||||
{
|
||||
case 1:
|
||||
|
@ -958,7 +958,7 @@ void ActBullet_Bom(BULLET *bul, int level)
|
|||
bul->act_wait = 5;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
PlaySoundObject(44, 1);
|
||||
// Fallthrough
|
||||
case 1:
|
||||
|
@ -979,7 +979,7 @@ void ActBullet_Bom(BULLET *bul, int level)
|
|||
SetDestroyNpCharUp(bul->x + (Random(-40, 40) << 9), bul->y + (Random(-40, 40) << 9), bul->enemyXL, 2);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (--bul->act_wait < 0)
|
||||
bul->cond = 0;
|
||||
break;
|
||||
|
@ -2424,4 +2424,4 @@ BOOL IsActiveSomeBullet(void)
|
|||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,25 +36,25 @@ void ActCaret01(CARET *crt)
|
|||
{80, 24, 88, 32},
|
||||
{88, 24, 96, 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 == 0)
|
||||
crt->rect = rcLeft[crt->ani_no];
|
||||
else
|
||||
|
@ -100,7 +100,7 @@ void ActCaret02(CARET *crt)
|
|||
|
||||
crt->rect = rect_left[crt->ani_no];
|
||||
break;
|
||||
|
||||
|
||||
case 2:
|
||||
if (++crt->ani_wait > 2)
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ void ActCaret02(CARET *crt)
|
|||
|
||||
crt->rect = rect_right[crt->ani_no];
|
||||
break;
|
||||
|
||||
|
||||
case 1:
|
||||
crt->rect = rect_up[++crt->ani_wait / 2 % 3];
|
||||
|
||||
|
@ -132,14 +132,14 @@ void ActCaret03(CARET *crt)
|
|||
{32, 48, 48, 64},
|
||||
{48, 48, 64, 64},
|
||||
};
|
||||
|
||||
|
||||
if (++crt->ani_wait > 2)
|
||||
{
|
||||
crt->ani_wait = 0;
|
||||
if (++crt->ani_no > 3)
|
||||
crt->cond = 0;
|
||||
}
|
||||
|
||||
|
||||
crt->rect = rect[crt->ani_no];
|
||||
}
|
||||
|
||||
|
@ -255,7 +255,7 @@ void ActCaret09(CARET *crt)
|
|||
|
||||
if (crt->ani_wait == 32)
|
||||
crt->cond = 0;
|
||||
|
||||
|
||||
if (crt->direct == 0)
|
||||
crt->rect = rcLeft;
|
||||
else
|
||||
|
@ -275,7 +275,7 @@ void ActCaret10(CARET *crt)
|
|||
};
|
||||
|
||||
++crt->ani_wait;
|
||||
|
||||
|
||||
if (crt->direct == 0)
|
||||
{
|
||||
if (crt->ani_wait < 20)
|
||||
|
@ -292,7 +292,7 @@ void ActCaret10(CARET *crt)
|
|||
if (crt->ani_wait == 80)
|
||||
crt->cond = 0;
|
||||
}
|
||||
|
||||
|
||||
if (crt->direct == 0)
|
||||
crt->rect = rcLeft[crt->ani_wait / 2 % 2];
|
||||
else
|
||||
|
@ -310,10 +310,10 @@ void ActCaret11(CARET *crt)
|
|||
crt->xm = 2 * GetCos(deg);
|
||||
crt->ym = 2 * GetSin(deg);
|
||||
}
|
||||
|
||||
|
||||
crt->x += crt->xm;
|
||||
crt->y += crt->ym;
|
||||
|
||||
|
||||
RECT rcRight[7] = {
|
||||
{56, 8, 64, 16},
|
||||
{64, 8, 72, 16},
|
||||
|
@ -330,7 +330,7 @@ void ActCaret11(CARET *crt)
|
|||
if (++crt->ani_no > 6)
|
||||
crt->cond = 0;
|
||||
}
|
||||
|
||||
|
||||
crt->rect = rcRight[crt->ani_no];
|
||||
}
|
||||
|
||||
|
@ -340,14 +340,14 @@ void ActCaret12(CARET *crt)
|
|||
{112, 0, 144, 32},
|
||||
{144, 0, 176, 32},
|
||||
};
|
||||
|
||||
|
||||
if (++crt->ani_wait > 2)
|
||||
{
|
||||
crt->ani_wait = 0;
|
||||
if (++crt->ani_no > 1)
|
||||
crt->cond = 0;
|
||||
}
|
||||
|
||||
|
||||
crt->rect = rcLeft[crt->ani_no];
|
||||
}
|
||||
|
||||
|
@ -357,24 +357,24 @@ void ActCaret13(CARET *crt)
|
|||
{56, 24, 64, 32},
|
||||
{0, 0, 0, 0},
|
||||
};
|
||||
|
||||
|
||||
if (crt->act_no == 0)
|
||||
{
|
||||
crt->act_no = 1;
|
||||
|
||||
|
||||
switch (crt->direct)
|
||||
{
|
||||
case 0:
|
||||
crt->xm = Random(-0x600, 0x600);
|
||||
crt->ym = Random(-0x200, 0x200);
|
||||
break;
|
||||
|
||||
|
||||
case 1:
|
||||
crt->ym = -0x200 * Random(1, 3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch (crt->direct)
|
||||
{
|
||||
case 0:
|
||||
|
@ -382,15 +382,15 @@ void ActCaret13(CARET *crt)
|
|||
crt->ym = 4 * crt->ym / 5;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
crt->x += crt->xm;
|
||||
crt->y += crt->ym;
|
||||
|
||||
|
||||
if (++crt->ani_wait > 20)
|
||||
crt->cond = 0;
|
||||
|
||||
crt->rect = rcLeft[crt->ani_wait / 2 % 2];
|
||||
|
||||
|
||||
if (crt->direct == 5)
|
||||
crt->x -= 0x800;
|
||||
}
|
||||
|
|
|
@ -15,41 +15,41 @@ bool LoadConfigData(CONFIG *conf)
|
|||
{
|
||||
//Clear old config data
|
||||
memset(conf, 0, sizeof(CONFIG));
|
||||
|
||||
|
||||
//Get path
|
||||
char path[PATH_LENGTH];
|
||||
sprintf(path, "%s/%s", gModulePath, "Config.dat");
|
||||
|
||||
|
||||
//Open file
|
||||
FILE *fp = fopen(path, "rb");
|
||||
if (fp == NULL)
|
||||
return false;
|
||||
|
||||
|
||||
//Read data
|
||||
//Read the version id and font name
|
||||
fread(conf->proof, sizeof(conf->proof), 1, fp);
|
||||
fread(conf->font_name, sizeof(conf->font_name), 1, fp);
|
||||
|
||||
|
||||
//Read control settings
|
||||
conf->move_button_mode = File_ReadLE32(fp);
|
||||
conf->attack_button_mode = File_ReadLE32(fp);
|
||||
conf->ok_button_mode = File_ReadLE32(fp);
|
||||
|
||||
|
||||
//Read display mode (320x240, 640x480, 24-bit fullscreen, 32-bit fullscreen) TODO: add more things?
|
||||
conf->display_mode = File_ReadLE32(fp);
|
||||
|
||||
|
||||
//Read joystick configuration (if enabled, and mappings)
|
||||
conf->bJoystick = File_ReadLE32(fp);
|
||||
for (int button = 0; button < 8; button++)
|
||||
conf->joystick_button[button] = File_ReadLE32(fp);
|
||||
|
||||
|
||||
//Close file
|
||||
fclose(fp);
|
||||
|
||||
|
||||
//Check if version is correct, return that it succeeded
|
||||
if (!strcmp(conf->proof, "DOUKUTSU20041206"))
|
||||
return true;
|
||||
|
||||
|
||||
//If not, return that it failed
|
||||
return false;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ void DefaultConfigData(CONFIG *conf)
|
|||
{
|
||||
//Claer old config data
|
||||
memset(conf, 0, sizeof(CONFIG));
|
||||
|
||||
|
||||
//Reset joystick settings (as these can't simply be set to 0)
|
||||
conf->bJoystick = 1;
|
||||
conf->joystick_button[0] = 2;
|
||||
|
|
30
src/Draw.cpp
30
src/Draw.cpp
|
@ -100,21 +100,21 @@ BOOL StartDirectDraw(int lMagnification, int lColourDepth)
|
|||
magnification = 1;
|
||||
fullscreen = false;
|
||||
break;
|
||||
|
||||
|
||||
case 1:
|
||||
magnification = 2;
|
||||
fullscreen = false;
|
||||
break;
|
||||
|
||||
|
||||
case 2:
|
||||
magnification = 2;
|
||||
fullscreen = true;
|
||||
SDL_SetWindowFullscreen(gWindow, SDL_WINDOW_FULLSCREEN);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ void EndDirectDraw()
|
|||
{
|
||||
//Quit sub-system
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
|
||||
|
||||
//Release all surfaces
|
||||
for (int i = 0; i < SURFACE_ID_MAX; i++)
|
||||
ReleaseSurface(i);
|
||||
|
@ -319,7 +319,7 @@ static BOOL LoadBitmap_File(const char *name, Surface_Ids surf_no, bool create_s
|
|||
{
|
||||
char path[PATH_LENGTH];
|
||||
SDL_RWops *fp;
|
||||
|
||||
|
||||
//Attempt to load PBM
|
||||
sprintf(path, "%s/%s.pbm", gDataPath, name);
|
||||
fp = SDL_RWFromFile(path, "rb");
|
||||
|
@ -337,7 +337,7 @@ static BOOL LoadBitmap_File(const char *name, Surface_Ids surf_no, bool create_s
|
|||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Attempt to load BMP
|
||||
sprintf(path, "%s/%s.bmp", gDataPath, name);
|
||||
fp = SDL_RWFromFile(path, "rb");
|
||||
|
@ -347,7 +347,7 @@ static BOOL LoadBitmap_File(const char *name, Surface_Ids surf_no, bool create_s
|
|||
if (LoadBitmap(fp, surf_no, create_surface))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
printf("Failed to open file %s\n", name);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ static BOOL LoadBitmap_Resource(const char *res, Surface_Ids surf_no, bool creat
|
|||
{
|
||||
size_t size;
|
||||
const unsigned char *data = FindResource(res, "BITMAP", &size);
|
||||
|
||||
|
||||
if (data)
|
||||
{
|
||||
SDL_RWops *fp = SDL_RWFromConstMem(data, size);
|
||||
|
@ -365,7 +365,7 @@ static BOOL LoadBitmap_Resource(const char *res, Surface_Ids surf_no, bool creat
|
|||
if (LoadBitmap(fp, surf_no, create_surface))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
printf("Failed to open resource %s\n", res);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -443,19 +443,19 @@ static void DrawBitmap(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_
|
|||
SDL_Rect clipRect = RectToSDLRectScaled(rcView);
|
||||
|
||||
SDL_Rect frameRect = RectToSDLRectScaled(rect);
|
||||
|
||||
|
||||
//Get dest rect
|
||||
SDL_Rect destRect = {x * magnification, y * magnification, frameRect.w, frameRect.h};
|
||||
|
||||
|
||||
//Set cliprect
|
||||
SDL_RenderSetClipRect(gRenderer, &clipRect);
|
||||
|
||||
|
||||
SDL_SetTextureBlendMode(surf[surf_no].texture, transparent ? SDL_BLENDMODE_BLEND : SDL_BLENDMODE_NONE);
|
||||
|
||||
//Draw to screen
|
||||
if (SDL_RenderCopy(gRenderer, surf[surf_no].texture, &frameRect, &destRect) < 0)
|
||||
printf("Failed to draw texture %d\nSDL Error: %s\n", surf_no, SDL_GetError());
|
||||
|
||||
|
||||
//Undo cliprect
|
||||
SDL_RenderSetClipRect(gRenderer, NULL);
|
||||
}
|
||||
|
@ -490,7 +490,7 @@ void CortBox(RECT *rect, uint32_t col)
|
|||
{
|
||||
//Get rect
|
||||
SDL_Rect destRect = RectToSDLRectScaled(rect);
|
||||
|
||||
|
||||
//Set colour and draw
|
||||
const unsigned char col_red = col & 0x0000FF;
|
||||
const unsigned char col_green = (col & 0x00FF00) >> 8;
|
||||
|
|
|
@ -47,7 +47,7 @@ void PutStripper()
|
|||
//Draw text
|
||||
RECT rc = {0, 16 * s, 320, 16 * s + 16};
|
||||
PutBitmap3(&grcFull, (Strip[s].x + ((WINDOW_WIDTH - 320) << 8)) / 0x200, Strip[s].y / 0x200, &rc, SURFACE_ID_CREDIT_CAST);
|
||||
|
||||
|
||||
//Draw character
|
||||
rc.left = 24 * (Strip[s].cast % 13);
|
||||
rc.right = rc.left + 24;
|
||||
|
@ -71,7 +71,7 @@ void SetStripper(int x, int y, const char *text, int cast)
|
|||
Strip[s].y = y;
|
||||
Strip[s].cast = cast;
|
||||
strcpy(Strip[s].str, text);
|
||||
|
||||
|
||||
//Draw text
|
||||
RECT rc = {0, 16 * s, 320, 16 * s + 16};
|
||||
CortBox2(&rc, 0, SURFACE_ID_CREDIT_CAST);
|
||||
|
@ -103,13 +103,13 @@ void ActionIllust()
|
|||
case 0: //Off-screen to the left
|
||||
Illust.x = -0x14000;
|
||||
break;
|
||||
|
||||
|
||||
case 1: //Move in from the left
|
||||
Illust.x += 0x5000;
|
||||
if (Illust.x > 0)
|
||||
Illust.x = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 2: //Move out from the right
|
||||
Illust.x -= 0x5000;
|
||||
if (Illust.x < -0x14000)
|
||||
|
@ -161,7 +161,7 @@ bool StartCreditScript()
|
|||
free(Credit.pData);
|
||||
Credit.pData = NULL;
|
||||
}
|
||||
|
||||
|
||||
//Open file
|
||||
char path[PATH_LENGTH];
|
||||
sprintf(path, "%s/%s", gDataPath, "Credit.tsc");
|
||||
|
@ -190,21 +190,21 @@ bool StartCreditScript()
|
|||
// The original game forgot to close the file
|
||||
fclose(fp);
|
||||
#endif
|
||||
|
||||
|
||||
//Reset credits
|
||||
Credit.offset = 0;
|
||||
Credit.wait = 0;
|
||||
Credit.mode = 1;
|
||||
Illust.x = -0x14000;
|
||||
Illust.act_no = 0;
|
||||
|
||||
|
||||
//Modify cliprect
|
||||
grcGame.left = WINDOW_WIDTH / 2;
|
||||
// These three are non-vanilla: for wide/tallscreen support
|
||||
grcGame.right = ((WINDOW_WIDTH - 320) / 2) + 320;
|
||||
grcGame.top = (WINDOW_HEIGHT - 240) / 2;
|
||||
grcGame.bottom = ((WINDOW_HEIGHT - 240) / 2) + 240;
|
||||
|
||||
|
||||
//Reload casts
|
||||
if (!ReloadBitmap_File("casts", SURFACE_ID_CASTS))
|
||||
return false;
|
||||
|
@ -230,14 +230,14 @@ void ActionCredit_Read()
|
|||
{
|
||||
//Get character
|
||||
uint8_t character = Credit.pData[Credit.offset];
|
||||
|
||||
|
||||
int a, b, len;
|
||||
switch (character)
|
||||
{
|
||||
case '[': //Create cast
|
||||
//Get the range for the cast text
|
||||
a = ++Credit.offset;
|
||||
|
||||
|
||||
while (Credit.pData[a] != ']')
|
||||
{
|
||||
if (IsShiftJIS(Credit.pData[a]))
|
||||
|
@ -245,32 +245,32 @@ void ActionCredit_Read()
|
|||
else
|
||||
a++;
|
||||
}
|
||||
|
||||
|
||||
len = a - Credit.offset;
|
||||
|
||||
|
||||
//Copy the text to the cast text
|
||||
char text[40];
|
||||
memcpy(text, &Credit.pData[Credit.offset], a - Credit.offset);
|
||||
text[len] = 0;
|
||||
|
||||
|
||||
//Get cast id
|
||||
Credit.offset = a + 1;
|
||||
len = GetScriptNumber(&Credit.pData[a + 1]);
|
||||
|
||||
|
||||
//Create cast object
|
||||
SetStripper(Credit.start_x, (WINDOW_HEIGHT << 9) + 0x1000, text, len);
|
||||
|
||||
|
||||
//Change offset
|
||||
Credit.offset += 4;
|
||||
return;
|
||||
|
||||
|
||||
case 'j': //Jump to label
|
||||
//Get number
|
||||
b = GetScriptNumber(&Credit.pData[++Credit.offset]);
|
||||
|
||||
|
||||
//Change offset
|
||||
Credit.offset += 4;
|
||||
|
||||
|
||||
//Jump to specific label
|
||||
while (Credit.offset < Credit.size)
|
||||
{
|
||||
|
@ -291,21 +291,21 @@ void ActionCredit_Read()
|
|||
++Credit.offset;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
|
||||
|
||||
case '~': //Start fading out music
|
||||
++Credit.offset;
|
||||
SetOrganyaFadeout();
|
||||
return;
|
||||
|
||||
|
||||
case 'f': //Flag jump
|
||||
//Read numbers XXXX:YYYY
|
||||
a = GetScriptNumber(&Credit.pData[++Credit.offset]);
|
||||
Credit.offset += 5;
|
||||
b = GetScriptNumber(&Credit.pData[Credit.offset]);
|
||||
Credit.offset += 4;
|
||||
|
||||
|
||||
//If flag is set
|
||||
if (GetNPCFlag(a))
|
||||
{
|
||||
|
@ -330,29 +330,29 @@ void ActionCredit_Read()
|
|||
}
|
||||
}
|
||||
return;
|
||||
|
||||
|
||||
case '+': //Change casts x-position
|
||||
Credit.start_x = GetScriptNumber(&Credit.pData[++Credit.offset]) << 9;
|
||||
Credit.offset += 4;
|
||||
return;
|
||||
|
||||
|
||||
case '-': //Wait for X amount of frames
|
||||
Credit.wait = GetScriptNumber(&Credit.pData[++Credit.offset]);
|
||||
Credit.offset += 4;
|
||||
Credit.mode = 2;
|
||||
return;
|
||||
|
||||
|
||||
case '/': //Stop credits
|
||||
Credit.mode = 0;
|
||||
return;
|
||||
|
||||
|
||||
case '!': //Change music
|
||||
a = GetScriptNumber(&Credit.pData[++Credit.offset]);
|
||||
Credit.offset += 4;
|
||||
ChangeMusic(a);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//Progress through file
|
||||
++Credit.offset;
|
||||
}
|
||||
|
@ -395,19 +395,19 @@ int Scene_DownIsland(int mode)
|
|||
RECT rc_frame = {(WINDOW_WIDTH - 160) / 2, (WINDOW_HEIGHT - 80) / 2, (WINDOW_WIDTH + 160) / 2, (WINDOW_HEIGHT + 80) / 2};
|
||||
RECT rc_sky = {0, 0, 160, 80};
|
||||
RECT rc_ground = {160, 48, 320, 80};
|
||||
|
||||
|
||||
//Setup island
|
||||
RECT rc_sprite = {160, 0, 200, 24};
|
||||
|
||||
|
||||
ISLAND_SPRITE sprite;
|
||||
sprite.x = 0x15000;
|
||||
sprite.y = 0x8000;
|
||||
|
||||
|
||||
for (int wait = 0; wait < 900; wait++)
|
||||
{
|
||||
//Get pressed keys
|
||||
GetTrg();
|
||||
|
||||
|
||||
//Escape menu
|
||||
if (gKey & 0x8000)
|
||||
{
|
||||
|
@ -417,14 +417,14 @@ int Scene_DownIsland(int mode)
|
|||
if (escRet == 2)
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case 0:
|
||||
//Move down
|
||||
sprite.y += 0x33;
|
||||
break;
|
||||
|
||||
|
||||
case 1:
|
||||
if (wait >= 350)
|
||||
{
|
||||
|
@ -455,19 +455,19 @@ int Scene_DownIsland(int mode)
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//Draw scene
|
||||
CortBox(&grcFull, 0);
|
||||
PutBitmap3(&rc_frame, 80 + (WINDOW_WIDTH - 320) / 2, 80 + (WINDOW_HEIGHT - 240) / 2, &rc_sky, SURFACE_ID_LEVEL_SPRITESET_1);
|
||||
PutBitmap3(&rc_frame, sprite.x / 0x200 - 20 + (WINDOW_WIDTH - 320) / 2, sprite.y / 512 - 12 + (WINDOW_HEIGHT - 240) / 2, &rc_sprite, SURFACE_ID_LEVEL_SPRITESET_1);
|
||||
PutBitmap3(&rc_frame, 80 + (WINDOW_WIDTH - 320) / 2, 128 + (WINDOW_HEIGHT - 240) / 2, &rc_ground, SURFACE_ID_LEVEL_SPRITESET_1);
|
||||
PutTimeCounter(16, 8);
|
||||
|
||||
|
||||
//Draw window
|
||||
PutFramePerSecound();
|
||||
if (!Flip_SystemTask())
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
int Call_Escape()
|
||||
{
|
||||
RECT rc = {0, 128, 208, 144};
|
||||
|
||||
|
||||
while (1)
|
||||
{
|
||||
//Get pressed keys
|
||||
GetTrg();
|
||||
|
||||
|
||||
if (gKeyTrg & KEY_ESCAPE) //Escape is pressed, quit game
|
||||
{
|
||||
gKeyTrg = 0;
|
||||
|
@ -31,7 +31,7 @@ int Call_Escape()
|
|||
gKeyTrg = 0;
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
//Draw screen
|
||||
CortBox(&grcFull, 0x000000);
|
||||
PutBitmap3(&grcFull, (WINDOW_WIDTH - 208) / 2, (WINDOW_HEIGHT - 16) / 2, &rc, SURFACE_ID_TEXT_BOX);
|
||||
|
@ -44,6 +44,6 @@ int Call_Escape()
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
32
src/Fade.cpp
32
src/Fade.cpp
|
@ -47,7 +47,7 @@ void StartFadeOut(signed char dir)
|
|||
gFade.count = 0;
|
||||
gFade.dir = dir;
|
||||
gFade.bMask = FALSE;
|
||||
|
||||
|
||||
for (int y = 0; y < FADE_HEIGHT; y++)
|
||||
{
|
||||
for (int x = 0; x < FADE_WIDTH; x++)
|
||||
|
@ -67,7 +67,7 @@ void StartFadeIn(signed char dir)
|
|||
gFade.count = 0;
|
||||
gFade.dir = dir;
|
||||
gFade.bMask = TRUE;
|
||||
|
||||
|
||||
for (y = 0; y < FADE_HEIGHT; y++)
|
||||
{
|
||||
for (x = 0; x < FADE_WIDTH; x++)
|
||||
|
@ -100,7 +100,7 @@ void ProcFade()
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 2:
|
||||
for (y = 0; y < FADE_HEIGHT; y++)
|
||||
{
|
||||
|
@ -111,7 +111,7 @@ void ProcFade()
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 1:
|
||||
for (y = 0; y < FADE_HEIGHT; y++)
|
||||
{
|
||||
|
@ -122,7 +122,7 @@ void ProcFade()
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 3:
|
||||
for (y = 0; y < FADE_HEIGHT; y++)
|
||||
{
|
||||
|
@ -133,7 +133,7 @@ void ProcFade()
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 4:
|
||||
for (y = 0; y < (FADE_HEIGHT / 2); y++)
|
||||
{
|
||||
|
@ -169,7 +169,7 @@ void ProcFade()
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
for (y = 0; y < FADE_HEIGHT; y++)
|
||||
{
|
||||
for (x = 0; x < FADE_WIDTH; x++)
|
||||
|
@ -178,7 +178,7 @@ void ProcFade()
|
|||
++gFade.ani_no[y][x];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (++gFade.count > ((FADE_WIDTH > FADE_HEIGHT) ? FADE_WIDTH : FADE_HEIGHT) + 16)
|
||||
{
|
||||
gFade.bMask = TRUE;
|
||||
|
@ -189,7 +189,7 @@ void ProcFade()
|
|||
|
||||
case 1:
|
||||
gFade.bMask = FALSE;
|
||||
|
||||
|
||||
switch (gFade.dir)
|
||||
{
|
||||
case 0:
|
||||
|
@ -202,7 +202,7 @@ void ProcFade()
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 2:
|
||||
for (y = 0; y < FADE_HEIGHT; y++)
|
||||
{
|
||||
|
@ -213,7 +213,7 @@ void ProcFade()
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 1:
|
||||
for (y = 0; y < FADE_HEIGHT; y++)
|
||||
{
|
||||
|
@ -224,7 +224,7 @@ void ProcFade()
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 3:
|
||||
for (y = 0; y < FADE_HEIGHT; y++)
|
||||
{
|
||||
|
@ -235,7 +235,7 @@ void ProcFade()
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 4:
|
||||
for (y = 0; y < (FADE_HEIGHT / 2); y++)
|
||||
{
|
||||
|
@ -271,7 +271,7 @@ void ProcFade()
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
for (y = 0; y < FADE_HEIGHT; y++)
|
||||
{
|
||||
for (x = 0; x < FADE_WIDTH; x++)
|
||||
|
@ -280,7 +280,7 @@ void ProcFade()
|
|||
--gFade.ani_no[y][x];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (++gFade.count > ((FADE_WIDTH > FADE_HEIGHT) ? FADE_WIDTH : FADE_HEIGHT) + 16)
|
||||
gFade.mode = 0;
|
||||
|
||||
|
@ -293,7 +293,7 @@ void PutFade()
|
|||
RECT rect;
|
||||
rect.top = 0;
|
||||
rect.bottom = 16;
|
||||
|
||||
|
||||
if (gFade.bMask)
|
||||
{
|
||||
CortBox(&grcGame, mask_color);
|
||||
|
|
|
@ -121,10 +121,10 @@ void SetFramePosition(int fx, int fy)
|
|||
//Move frame position
|
||||
int16_t map_w, map_l;
|
||||
GetMapData(0, &map_w, &map_l);
|
||||
|
||||
|
||||
gFrame.x = fx;
|
||||
gFrame.y = fy;
|
||||
|
||||
|
||||
//Keep in bounds
|
||||
if (gFrame.x / 0x200 < 0)
|
||||
gFrame.x = 0;
|
||||
|
@ -142,19 +142,19 @@ void SetFrameMyChar()
|
|||
//Move frame position
|
||||
int mc_x, mc_y;
|
||||
GetMyCharPosition(&mc_x, &mc_y);
|
||||
|
||||
|
||||
int16_t map_w, map_l;
|
||||
GetMapData(0, &map_w, &map_l);
|
||||
|
||||
|
||||
gFrame.x = mc_x - (WINDOW_WIDTH << 8);
|
||||
gFrame.y = mc_y - (WINDOW_HEIGHT << 8);
|
||||
|
||||
|
||||
//Keep in bounds
|
||||
if (gFrame.x / 0x200 < 0)
|
||||
gFrame.x = 0;
|
||||
if (gFrame.y / 0x200 < 0)
|
||||
gFrame.y = 0;
|
||||
|
||||
|
||||
if (gFrame.x > ((((map_w - 1) * 0x10) - WINDOW_WIDTH)) * 0x200)
|
||||
gFrame.x = (((map_w - 1) * 0x10) - WINDOW_WIDTH) * 0x200;
|
||||
if (gFrame.y > ((((map_l - 1) * 0x10) - WINDOW_HEIGHT)) * 0x200)
|
||||
|
|
164
src/Game.cpp
164
src/Game.cpp
|
@ -60,7 +60,7 @@ void PutNumber4(int x, int y, int value, bool bZero)
|
|||
{
|
||||
//Define rects
|
||||
RECT rcClient = grcFull;
|
||||
|
||||
|
||||
RECT rect[10] = {
|
||||
{0, 56, 8, 64},
|
||||
{8, 56, 16, 64},
|
||||
|
@ -73,14 +73,14 @@ void PutNumber4(int x, int y, int value, bool bZero)
|
|||
{64, 56, 72, 64},
|
||||
{72, 56, 80, 64},
|
||||
};
|
||||
|
||||
|
||||
//Digits
|
||||
int tbl[4] = {1000, 100, 10, 1};
|
||||
|
||||
|
||||
//Limit value
|
||||
if ( value > 9999 )
|
||||
value = 9999;
|
||||
|
||||
|
||||
//Go through number and draw digits
|
||||
int offset = 0;
|
||||
int sw = 0;
|
||||
|
@ -88,18 +88,18 @@ void PutNumber4(int x, int y, int value, bool bZero)
|
|||
{
|
||||
//Get the digit that this is
|
||||
int a = 0;
|
||||
|
||||
|
||||
while (tbl[offset] <= value)
|
||||
{
|
||||
value -= tbl[offset];
|
||||
++a;
|
||||
++sw;
|
||||
}
|
||||
|
||||
|
||||
//Draw digit
|
||||
if ((bZero && offset == 2) || sw != 0 || offset == 3 )
|
||||
PutBitmap3(&rcClient, x + 8 * offset, y, &rect[a], SURFACE_ID_TEXT_BOX);
|
||||
|
||||
|
||||
//Go to next digit
|
||||
++offset;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ int ModeOpening()
|
|||
TransferStage(72, 100, 3, 3);
|
||||
SetFrameTargetMyChar(16);
|
||||
SetFadeMask();
|
||||
|
||||
|
||||
//Reset cliprect and flags
|
||||
grcGame.left = 0;
|
||||
//Non-vanilla: these three lines are widescreen-related(?)
|
||||
|
@ -126,18 +126,18 @@ int ModeOpening()
|
|||
grcGame.bottom = WINDOW_HEIGHT;
|
||||
|
||||
g_GameFlags = 3;
|
||||
|
||||
|
||||
CutNoise();
|
||||
|
||||
|
||||
unsigned int wait = 0;
|
||||
while (wait < 500)
|
||||
{
|
||||
//Increase timer
|
||||
++wait;
|
||||
|
||||
|
||||
//Get pressed keys
|
||||
GetTrg();
|
||||
|
||||
|
||||
//Escape menu
|
||||
if (gKey & KEY_ESCAPE)
|
||||
{
|
||||
|
@ -147,11 +147,11 @@ int ModeOpening()
|
|||
if (escRet == 2)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
//Skip intro if OK is pressed
|
||||
if (gKey & gKeyOk)
|
||||
break;
|
||||
|
||||
|
||||
//Update everything
|
||||
ActNpChar();
|
||||
ActBossChar();
|
||||
|
@ -166,10 +166,10 @@ int ModeOpening()
|
|||
ActCaret();
|
||||
MoveFrame3();
|
||||
ProcFade();
|
||||
|
||||
|
||||
//Draw everything
|
||||
CortBox(&grcFull, 0x000000);
|
||||
|
||||
|
||||
int frame_x, frame_y;
|
||||
GetFramePosition(&frame_x, &frame_y);
|
||||
PutBack(frame_x, frame_y);
|
||||
|
@ -181,24 +181,24 @@ int ModeOpening()
|
|||
PutFront(frame_x, frame_y);
|
||||
PutCaret(frame_x, frame_y);
|
||||
PutFade();
|
||||
|
||||
|
||||
//Update Text Script
|
||||
int tscRet = TextScriptProc();
|
||||
if (tscRet == 0)
|
||||
return 0;
|
||||
if (tscRet == 2)
|
||||
return 1;
|
||||
|
||||
|
||||
PutMapName(false);
|
||||
PutTextScript();
|
||||
PutFramePerSecound();
|
||||
|
||||
|
||||
if (!Flip_SystemTask())
|
||||
return 0;
|
||||
|
||||
|
||||
++gCounter;
|
||||
}
|
||||
|
||||
|
||||
wait = SDL_GetTicks();
|
||||
while (SDL_GetTicks() < wait + 500)
|
||||
{
|
||||
|
@ -215,13 +215,13 @@ int ModeTitle()
|
|||
//Set rects
|
||||
RECT rcTitle = {0, 0, 144, 32};
|
||||
RECT rcPixel = {0, 0, 160, 16};
|
||||
|
||||
|
||||
RECT rcNew = {144, 0, 192, 16};
|
||||
RECT rcContinue = {144, 16, 192, 32};
|
||||
|
||||
|
||||
RECT rcVersion = {152, 80, 208, 88};
|
||||
RECT rcPeriod = {152, 88, 208, 96};
|
||||
|
||||
|
||||
//Character rects
|
||||
RECT rcMyChar[4] = {
|
||||
{0, 16, 16, 32},
|
||||
|
@ -236,45 +236,45 @@ int ModeTitle()
|
|||
{0, 112, 16, 128},
|
||||
{32, 112, 48, 128},
|
||||
};
|
||||
|
||||
|
||||
RECT rcToroko[4] = {
|
||||
{64, 80, 80, 96},
|
||||
{80, 80, 96, 96},
|
||||
{64, 80, 80, 96},
|
||||
{96, 80, 112, 96},
|
||||
};
|
||||
|
||||
|
||||
RECT rcKing[4] = {
|
||||
{224, 48, 240, 64},
|
||||
{288, 48, 304, 64},
|
||||
{224, 48, 240, 64},
|
||||
{304, 48, 320, 64},
|
||||
};
|
||||
|
||||
|
||||
RECT rcSu[4] = {
|
||||
{0, 16, 16, 32},
|
||||
{32, 16, 48, 32},
|
||||
{0, 16, 16, 32},
|
||||
{48, 16, 64, 32},
|
||||
};
|
||||
|
||||
|
||||
//Reset everything
|
||||
InitCaret();
|
||||
InitStar();
|
||||
CutNoise();
|
||||
|
||||
|
||||
//Create variables
|
||||
int anime = 0;
|
||||
int char_type = 0;
|
||||
int time_counter = 0;
|
||||
unsigned long back_color = GetCortBoxColor(RGB(0x20, 0x20, 0x20));
|
||||
|
||||
|
||||
//Set state
|
||||
bContinue = IsProfile();
|
||||
|
||||
|
||||
//Set character
|
||||
time_counter = LoadTimeCounter();
|
||||
|
||||
|
||||
if (time_counter && time_counter < 18000)
|
||||
char_type = 1;
|
||||
if (time_counter && time_counter < 15000)
|
||||
|
@ -283,7 +283,7 @@ int ModeTitle()
|
|||
char_type = 3;
|
||||
if (time_counter && time_counter < 9000)
|
||||
char_type = 4;
|
||||
|
||||
|
||||
//Set music to character's specific music
|
||||
switch (char_type)
|
||||
{
|
||||
|
@ -303,7 +303,7 @@ int ModeTitle()
|
|||
ChangeMusic(mus_CaveStory);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//Reset cliprect, flags, and give the player the nikumaru counter
|
||||
grcGame.left = 0;
|
||||
//Non-vanilla: these three lines are widescreen-related(?)
|
||||
|
@ -313,26 +313,26 @@ int ModeTitle()
|
|||
|
||||
g_GameFlags = 0;
|
||||
gMC.equip |= 0x100;
|
||||
|
||||
|
||||
//Start loop
|
||||
unsigned int wait = 0;
|
||||
|
||||
|
||||
while (true)
|
||||
{
|
||||
//Don't accept selection for 10 frames
|
||||
if (wait < 10)
|
||||
++wait;
|
||||
|
||||
|
||||
//Get pressed keys
|
||||
GetTrg();
|
||||
|
||||
|
||||
//Quit when OK is pressed
|
||||
if (wait >= 10)
|
||||
{
|
||||
if (gKeyTrg & gKeyOk)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (gKey & KEY_ESCAPE)
|
||||
{
|
||||
int escRet = Call_Escape();
|
||||
|
@ -341,45 +341,45 @@ int ModeTitle()
|
|||
if (escRet == 2)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
//Move cursor
|
||||
if ((gKeyDown | gKeyUp) & gKeyTrg)
|
||||
{
|
||||
PlaySoundObject(1, 1);
|
||||
bContinue = !bContinue;
|
||||
}
|
||||
|
||||
|
||||
//Update carets
|
||||
ActCaret();
|
||||
|
||||
|
||||
//Animate character cursor
|
||||
if ( ++anime >= 40 )
|
||||
anime = 0;
|
||||
|
||||
|
||||
//Draw title
|
||||
CortBox(&grcGame, back_color);
|
||||
|
||||
|
||||
//Draw version
|
||||
PutBitmap3(&grcGame, (WINDOW_WIDTH - 120) / 2, WINDOW_HEIGHT - 24, &rcVersion, SURFACE_ID_TEXT_BOX);
|
||||
PutBitmap3(&grcGame, (WINDOW_WIDTH - 8) / 2, WINDOW_HEIGHT - 24, &rcPeriod, SURFACE_ID_TEXT_BOX);
|
||||
|
||||
|
||||
int v1, v2, v3, v4;
|
||||
GetCompileVersion(&v1, &v2, &v3, &v4);
|
||||
PutNumber4((WINDOW_WIDTH - 40) / 2, WINDOW_HEIGHT - 24, v1, 0);
|
||||
PutNumber4((WINDOW_WIDTH - 8) / 2, WINDOW_HEIGHT - 24, v2, 0);
|
||||
PutNumber4((WINDOW_WIDTH + 24) / 2, WINDOW_HEIGHT - 24, v3, 0);
|
||||
PutNumber4((WINDOW_WIDTH + 56) / 2, WINDOW_HEIGHT - 24, v4, 0);
|
||||
|
||||
|
||||
//Draw main title
|
||||
PutBitmap3(&grcGame, (WINDOW_WIDTH - 144) / 2, 40, &rcTitle, SURFACE_ID_TITLE);
|
||||
PutBitmap3(&grcGame, (WINDOW_WIDTH - 48) / 2, (WINDOW_HEIGHT + 16) / 2, &rcNew, SURFACE_ID_TITLE);
|
||||
PutBitmap3(&grcGame, (WINDOW_WIDTH - 48) / 2, (WINDOW_HEIGHT + 56) / 2, &rcContinue, SURFACE_ID_TITLE);
|
||||
PutBitmap3(&grcGame, (WINDOW_WIDTH - 160) / 2, WINDOW_HEIGHT - 48, &rcPixel, SURFACE_ID_PIXEL);
|
||||
|
||||
|
||||
//Draw character cursor
|
||||
RECT char_rc;
|
||||
Surface_Ids char_surf;
|
||||
|
||||
|
||||
switch ( char_type )
|
||||
{
|
||||
case 0:
|
||||
|
@ -403,30 +403,30 @@ int ModeTitle()
|
|||
char_surf = SURFACE_ID_NPC_REGU;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
int char_y;
|
||||
if (bContinue == 1)
|
||||
char_y = (WINDOW_HEIGHT + 54) / 2;
|
||||
else
|
||||
char_y = (WINDOW_HEIGHT + 14) / 2;
|
||||
|
||||
|
||||
PutBitmap3(&grcGame, (WINDOW_WIDTH - 88) / 2, char_y, &char_rc, char_surf);
|
||||
|
||||
|
||||
//Draw carets
|
||||
PutCaret(0, 0);
|
||||
|
||||
|
||||
if (time_counter)
|
||||
PutTimeCounter(16, 8);
|
||||
|
||||
|
||||
PutFramePerSecound();
|
||||
|
||||
|
||||
if (!Flip_SystemTask())
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
PlaySoundObject(18, 1);
|
||||
ChangeMusic(0);
|
||||
|
||||
|
||||
//Black screen when option is selected
|
||||
wait = SDL_GetTicks();
|
||||
while (SDL_GetTicks() < wait + 1000)
|
||||
|
@ -436,7 +436,7 @@ int ModeTitle()
|
|||
if (!Flip_SystemTask())
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
@ -448,12 +448,12 @@ int ModeAction()
|
|||
unsigned long color = GetCortBoxColor(RGB(0, 0, 0x20));
|
||||
|
||||
bool swPlay = true;
|
||||
|
||||
|
||||
//Reset stuff
|
||||
gCounter = 0;
|
||||
grcGame.left = 0;
|
||||
g_GameFlags = 3;
|
||||
|
||||
|
||||
//Initialize everything
|
||||
InitMyChar();
|
||||
InitNpChar();
|
||||
|
@ -468,14 +468,14 @@ int ModeAction()
|
|||
StartMapping();
|
||||
InitFlags();
|
||||
InitBossLife();
|
||||
|
||||
|
||||
if ((bContinue && LoadProfile(NULL)) || InitializeGame())
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
//Get pressed keys
|
||||
GetTrg();
|
||||
|
||||
|
||||
//Escape menu
|
||||
if (gKey & KEY_ESCAPE)
|
||||
{
|
||||
|
@ -485,14 +485,14 @@ int ModeAction()
|
|||
if (escRet == 2)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (swPlay & 1 && g_GameFlags & 1)
|
||||
{
|
||||
if (g_GameFlags & 2)
|
||||
ActMyChar(true);
|
||||
else
|
||||
ActMyChar(false);
|
||||
|
||||
|
||||
ActStar();
|
||||
ActNpChar();
|
||||
ActBossChar();
|
||||
|
@ -513,20 +513,20 @@ int ModeAction()
|
|||
ActCaret();
|
||||
MoveFrame3();
|
||||
ActFlash(frame_x, frame_y);
|
||||
|
||||
|
||||
if (g_GameFlags & 2)
|
||||
AnimationMyChar(true);
|
||||
else
|
||||
AnimationMyChar(false);
|
||||
}
|
||||
|
||||
|
||||
if (g_GameFlags & 8)
|
||||
{
|
||||
ActionCredit();
|
||||
ActionIllust();
|
||||
ActionStripper();
|
||||
}
|
||||
|
||||
|
||||
ProcFade();
|
||||
CortBox(&grcFull, color);
|
||||
GetFramePosition(&frame_x, &frame_y);
|
||||
|
@ -545,14 +545,14 @@ int ModeAction()
|
|||
PutValueView(frame_x, frame_y);
|
||||
PutBossLife();
|
||||
PutFade();
|
||||
|
||||
|
||||
if (!(g_GameFlags & 4))
|
||||
{
|
||||
//Open inventory
|
||||
if (gKeyTrg & gKeyItem)
|
||||
{
|
||||
BackupSurface(SURFACE_ID_SCREEN_GRAB, &grcGame);
|
||||
|
||||
|
||||
switch (CampLoop())
|
||||
{
|
||||
case 0:
|
||||
|
@ -560,13 +560,13 @@ int ModeAction()
|
|||
case 2:
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
gMC.cond &= ~1;
|
||||
}
|
||||
else if (gMC.equip & 2 && gKeyTrg & gKeyMap)
|
||||
{
|
||||
BackupSurface(SURFACE_ID_SCREEN_GRAB, &grcGame);
|
||||
|
||||
|
||||
switch (MiniMapLoop())
|
||||
{
|
||||
case 0:
|
||||
|
@ -576,7 +576,7 @@ int ModeAction()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (g_GameFlags & 2)
|
||||
{
|
||||
if (gKeyTrg & gKeyArms)
|
||||
|
@ -593,10 +593,10 @@ int ModeAction()
|
|||
if (tscRet == 2)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
PutMapName(false);
|
||||
PutTimeCounter(16, 8);
|
||||
|
||||
|
||||
if (g_GameFlags & 2)
|
||||
{
|
||||
PutMyLife(true);
|
||||
|
@ -604,22 +604,22 @@ int ModeAction()
|
|||
PutMyAir((WINDOW_WIDTH - 80) / 2, (WINDOW_HEIGHT - 32) / 2);
|
||||
PutActiveArmsList();
|
||||
}
|
||||
|
||||
|
||||
if (g_GameFlags & 8)
|
||||
{
|
||||
PutIllust();
|
||||
PutStripper();
|
||||
}
|
||||
|
||||
|
||||
PutTextScript();
|
||||
|
||||
|
||||
PutFramePerSecound();
|
||||
if (!Flip_SystemTask())
|
||||
break;
|
||||
++gCounter;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -629,14 +629,14 @@ bool Game()
|
|||
{
|
||||
char path[PATH_LENGTH];
|
||||
sprintf(path, "%s/npc.tbl", gDataPath);
|
||||
|
||||
|
||||
if (LoadNpcTable(path))
|
||||
{
|
||||
InitTextScript2();
|
||||
InitSkipFlags();
|
||||
InitMapData2();
|
||||
InitCreditScript();
|
||||
|
||||
|
||||
int mode = 1;
|
||||
while (mode)
|
||||
{
|
||||
|
@ -647,7 +647,7 @@ bool Game()
|
|||
if (mode == 3)
|
||||
mode = ModeAction();
|
||||
}
|
||||
|
||||
|
||||
EndMapData();
|
||||
EndTextScript();
|
||||
ReleaseNpcTable();
|
||||
|
@ -658,6 +658,6 @@ bool Game()
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,14 +34,14 @@ bool CheckFileExists(const char *name)
|
|||
{
|
||||
char path[PATH_LENGTH];
|
||||
sprintf(path, "%s/%s", gModulePath, name);
|
||||
|
||||
|
||||
FILE *file = fopen(path, "rb");
|
||||
if (file)
|
||||
{
|
||||
fclose(file);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ BOOL LoadGenericData()
|
|||
int pt_size;
|
||||
|
||||
MakeSurface_Resource("PIXEL", SURFACE_ID_PIXEL);
|
||||
|
||||
|
||||
bError = FALSE;
|
||||
if (!MakeSurface_File("MyChar", SURFACE_ID_MY_CHAR))
|
||||
bError = TRUE;
|
||||
|
@ -188,9 +188,9 @@ BOOL LoadGenericData()
|
|||
bError = TRUE;
|
||||
if (!MakeSurface_File("Fade", SURFACE_ID_FADE))
|
||||
bError = TRUE;
|
||||
|
||||
|
||||
MakeSurface_Resource("CREDIT01", SURFACE_ID_CREDITS_IMAGE);
|
||||
|
||||
|
||||
if (bError)
|
||||
{
|
||||
return FALSE;
|
||||
|
|
|
@ -31,16 +31,16 @@ bool InitDirectInput()
|
|||
{
|
||||
//Open first available joystick
|
||||
SDL_InitSubSystem(SDL_INIT_JOYSTICK);
|
||||
|
||||
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
joystick = SDL_JoystickOpen(i);
|
||||
|
||||
|
||||
//Break as soon as a joystick is properly opened
|
||||
if (joystick)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ bool GetJoystickStatus(JOYSTICK_STATUS *pStatus)
|
|||
{
|
||||
//Clear status
|
||||
memset(pStatus, 0, sizeof(JOYSTICK_STATUS));
|
||||
|
||||
|
||||
if (joystick)
|
||||
{
|
||||
int32_t x = SDL_JoystickGetAxis(joystick, 0);
|
||||
|
@ -57,17 +57,17 @@ bool GetJoystickStatus(JOYSTICK_STATUS *pStatus)
|
|||
pStatus->bRight = x >= JOYSTICK_DEADZONE;
|
||||
pStatus->bUp = y <= -JOYSTICK_DEADZONE;
|
||||
pStatus->bDown = y >= JOYSTICK_DEADZONE;
|
||||
|
||||
|
||||
int numButtons = SDL_JoystickNumButtons(joystick);
|
||||
if (numButtons > 32)
|
||||
numButtons = 32;
|
||||
|
||||
|
||||
for (int button = 0; button < numButtons; button++)
|
||||
pStatus->bButton[button] = SDL_JoystickGetButton(joystick, button) != 0;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
110
src/Main.cpp
110
src/Main.cpp
|
@ -78,17 +78,17 @@ int GetFramePerSecound()
|
|||
base_tick = SDL_GetTicks();
|
||||
need_new_base_tick = false;
|
||||
}
|
||||
|
||||
|
||||
current_tick = SDL_GetTicks();
|
||||
++current_frame;
|
||||
|
||||
|
||||
if ( base_tick + 1000 <= current_tick )
|
||||
{
|
||||
base_tick += 1000;
|
||||
frames_this_second = current_frame;
|
||||
current_frame = 0;
|
||||
}
|
||||
|
||||
|
||||
return frames_this_second;
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ int main(int argc, char *argv[])
|
|||
strcpy(gModulePath, SDL_GetBasePath());
|
||||
if (gModulePath[strlen(gModulePath) - 1] == '/' || gModulePath[strlen(gModulePath) - 1] == '\\')
|
||||
gModulePath[strlen(gModulePath) - 1] = '\0'; //String cannot end in slash or stuff will probably break (original does this through a windows.h provided function)
|
||||
|
||||
|
||||
//Get path of the data folder
|
||||
strcpy(gDataPath, gModulePath);
|
||||
strcat(gDataPath, "/data");
|
||||
|
@ -114,10 +114,10 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
//Load configuration
|
||||
CONFIG config;
|
||||
|
||||
|
||||
if (!LoadConfigData(&config))
|
||||
DefaultConfigData(&config);
|
||||
|
||||
|
||||
//Apply keybinds
|
||||
//Swap X and Z buttons
|
||||
if (config.attack_button_mode)
|
||||
|
@ -133,7 +133,7 @@ int main(int argc, char *argv[])
|
|||
gKeyJump = KEY_Z;
|
||||
gKeyShot = KEY_X;
|
||||
}
|
||||
|
||||
|
||||
//Swap Okay and Cancel buttons
|
||||
if (config.ok_button_mode)
|
||||
{
|
||||
|
@ -148,14 +148,14 @@ int main(int argc, char *argv[])
|
|||
gKeyOk = gKeyJump;
|
||||
gKeyCancel = gKeyShot;
|
||||
}
|
||||
|
||||
|
||||
//Swap left and right weapon switch keys
|
||||
if (CheckFileExists("s_reverse"))
|
||||
{
|
||||
gKeyArms = KEY_ARMSREV;
|
||||
gKeyArmsRev = KEY_ARMS;
|
||||
}
|
||||
|
||||
|
||||
//Alternate movement keys
|
||||
if (config.move_button_mode)
|
||||
{
|
||||
|
@ -174,7 +174,7 @@ int main(int argc, char *argv[])
|
|||
gKeyRight = KEY_RIGHT;
|
||||
gKeyDown = KEY_DOWN;
|
||||
}
|
||||
|
||||
|
||||
//Set gamepad inputs
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
|
@ -183,38 +183,38 @@ int main(int argc, char *argv[])
|
|||
case 1:
|
||||
gJoystickButtonTable[i] = gKeyJump;
|
||||
break;
|
||||
|
||||
|
||||
case 2:
|
||||
gJoystickButtonTable[i] = gKeyShot;
|
||||
break;
|
||||
|
||||
|
||||
case 3:
|
||||
gJoystickButtonTable[i] = gKeyArms;
|
||||
break;
|
||||
|
||||
|
||||
case 6:
|
||||
gJoystickButtonTable[i] = gKeyArmsRev;
|
||||
break;
|
||||
|
||||
|
||||
case 4:
|
||||
gJoystickButtonTable[i] = gKeyItem;
|
||||
break;
|
||||
|
||||
|
||||
case 5:
|
||||
gJoystickButtonTable[i] = gKeyMap;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RECT unused_rect = {0, 0, 320, 240};
|
||||
|
||||
//Load cursor
|
||||
size_t size;
|
||||
const unsigned char *data = FindResource("CURSOR_NORMAL", "CURSOR", &size);
|
||||
|
||||
|
||||
if (data)
|
||||
{
|
||||
SDL_RWops *fp = SDL_RWFromConstMem(data, size);
|
||||
|
@ -240,7 +240,7 @@ int main(int argc, char *argv[])
|
|||
int windowWidth;
|
||||
int windowHeight;
|
||||
int colourDepth;
|
||||
|
||||
|
||||
switch (config.display_mode)
|
||||
{
|
||||
case 1:
|
||||
|
@ -256,10 +256,10 @@ int main(int argc, char *argv[])
|
|||
windowWidth = WINDOW_WIDTH * 2;
|
||||
windowHeight = WINDOW_HEIGHT * 2;
|
||||
}
|
||||
|
||||
|
||||
//Create window
|
||||
gWindow = SDL_CreateWindow(lpWindowName, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, windowWidth, windowHeight, 0);
|
||||
|
||||
|
||||
if (gWindow)
|
||||
{
|
||||
if (config.display_mode == 1)
|
||||
|
@ -268,19 +268,19 @@ int main(int argc, char *argv[])
|
|||
StartDirectDraw(1, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 0:
|
||||
case 3:
|
||||
case 4:
|
||||
//Set window dimensions
|
||||
windowWidth = WINDOW_WIDTH * 2;
|
||||
windowHeight = WINDOW_HEIGHT * 2;
|
||||
|
||||
|
||||
//Create window
|
||||
gWindow = SDL_CreateWindow(lpWindowName, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, windowWidth, windowHeight, 0);
|
||||
|
||||
|
||||
if (gWindow)
|
||||
{
|
||||
//Set colour depth
|
||||
|
@ -296,30 +296,30 @@ int main(int argc, char *argv[])
|
|||
colourDepth = 32;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
StartDirectDraw(2, colourDepth);
|
||||
|
||||
|
||||
fullscreen = true;
|
||||
SDL_ShowCursor(0);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//Create window
|
||||
|
||||
|
||||
|
||||
|
||||
if (gWindow)
|
||||
{
|
||||
//Check debug things
|
||||
if (CheckFileExists("fps"))
|
||||
bFps = true;
|
||||
|
||||
|
||||
#ifndef WINDOWS
|
||||
//Load icon
|
||||
size_t size;
|
||||
const unsigned char *data = FindResource("ICON_MINI", "ICON", &size);
|
||||
|
||||
|
||||
if (data)
|
||||
{
|
||||
SDL_RWops *fp = SDL_RWFromConstMem(data, size);
|
||||
|
@ -341,34 +341,34 @@ int main(int argc, char *argv[])
|
|||
//Set rects
|
||||
RECT loading_rect = {0, 0, 64, 8};
|
||||
RECT clip_rect = {0, 0, windowWidth, windowHeight};
|
||||
|
||||
|
||||
//Load the "LOADING" text
|
||||
MakeSurface_File("Loading", SURFACE_ID_LOADING);
|
||||
|
||||
|
||||
//Draw loading screen
|
||||
CortBox(&clip_rect, 0x000000);
|
||||
PutBitmap3(&clip_rect, (WINDOW_WIDTH - 64) / 2, (WINDOW_HEIGHT - 8) / 2, &loading_rect, SURFACE_ID_LOADING);
|
||||
|
||||
|
||||
//Draw to screen
|
||||
if (Flip_SystemTask())
|
||||
{
|
||||
//Initialize sound
|
||||
InitDirectSound();
|
||||
|
||||
|
||||
//Initialize joystick
|
||||
if (config.bJoystick && InitDirectInput())
|
||||
{
|
||||
ResetJoystickStatus();
|
||||
gbUseJoystick = true;
|
||||
}
|
||||
|
||||
|
||||
//Initialize stuff
|
||||
InitTextObject(config.font_name);
|
||||
InitTriangleTable();
|
||||
|
||||
|
||||
//Run game code
|
||||
Game();
|
||||
|
||||
|
||||
//End stuff
|
||||
EndDirectSound();
|
||||
EndTextObject();
|
||||
|
@ -381,7 +381,7 @@ int main(int argc, char *argv[])
|
|||
SDL_Quit();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
SDL_Quit();
|
||||
return 0;
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ void InactiveWindow()
|
|||
StopOrganyaMusic();
|
||||
SleepNoise();
|
||||
}
|
||||
|
||||
|
||||
PlaySoundObject(7, 0);
|
||||
}
|
||||
|
||||
|
@ -414,12 +414,12 @@ void ActiveWindow()
|
|||
void JoystickProc()
|
||||
{
|
||||
JOYSTICK_STATUS status;
|
||||
|
||||
|
||||
if (GetJoystickStatus(&status))
|
||||
{
|
||||
//Clear held buttons
|
||||
gKey &= (KEY_ESCAPE | KEY_F2 | KEY_F1);
|
||||
|
||||
|
||||
//Set movement buttons
|
||||
if (status.bLeft)
|
||||
gKey |= gKeyLeft;
|
||||
|
@ -429,7 +429,7 @@ void JoystickProc()
|
|||
gKey |= gKeyUp;
|
||||
if (status.bDown)
|
||||
gKey |= gKeyDown;
|
||||
|
||||
|
||||
//Set held buttons
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
|
@ -450,18 +450,18 @@ bool SystemTask()
|
|||
{
|
||||
//Handle window events
|
||||
bool focusGained = true;
|
||||
|
||||
|
||||
while (SDL_PollEvent(NULL) || !focusGained)
|
||||
{
|
||||
SDL_Event event;
|
||||
SDL_WaitEvent(&event);
|
||||
|
||||
|
||||
switch (event.type)
|
||||
{
|
||||
case SDL_QUIT:
|
||||
return false;
|
||||
break;
|
||||
|
||||
|
||||
case SDL_WINDOWEVENT:
|
||||
switch (event.window.event)
|
||||
{
|
||||
|
@ -469,22 +469,22 @@ bool SystemTask()
|
|||
focusGained = true;
|
||||
ActiveWindow();
|
||||
break;
|
||||
|
||||
|
||||
case SDL_WINDOWEVENT_FOCUS_LOST:
|
||||
focusGained = false;
|
||||
InactiveWindow();
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case SDL_DROPFILE:
|
||||
LoadProfile(event.drop.file);
|
||||
SDL_free(event.drop.file);
|
||||
break;
|
||||
|
||||
|
||||
case SDL_KEYDOWN:
|
||||
case SDL_KEYUP:
|
||||
#ifdef FIX_BUGS
|
||||
|
@ -552,7 +552,7 @@ bool SystemTask()
|
|||
|
||||
case SDL_SCANCODE_SEMICOLON:
|
||||
DO_KEY_PRESS(KEY_PLUS)
|
||||
|
||||
|
||||
case SDL_SCANCODE_F5:
|
||||
gbUseJoystick = false;
|
||||
break;
|
||||
|
@ -621,7 +621,7 @@ bool SystemTask()
|
|||
|
||||
case SDLK_SEMICOLON:
|
||||
DO_KEY_PRESS(KEY_PLUS)
|
||||
|
||||
|
||||
case SDLK_F5:
|
||||
gbUseJoystick = false;
|
||||
break;
|
||||
|
@ -630,10 +630,10 @@ bool SystemTask()
|
|||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Run joystick code
|
||||
if (gbUseJoystick)
|
||||
JoystickProc();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -78,10 +78,10 @@ void ReadyMapName(const char *str)
|
|||
|
||||
str = (char*)presentText;
|
||||
}
|
||||
|
||||
|
||||
//Copy map's name to the MapName
|
||||
strcpy(gMapName.name, str);
|
||||
|
||||
|
||||
//Draw the text to the surface
|
||||
a = (int)strlen(gMapName.name);
|
||||
|
||||
|
@ -125,7 +125,7 @@ void StartMapName()
|
|||
void RestoreMapName()
|
||||
{
|
||||
int len = (int)strlen(gMapName.name);
|
||||
|
||||
|
||||
CortBox2(&rc, 0, SURFACE_ID_ROOM_NAME);
|
||||
PutText2((160 - 6 * len) / 2 + 6, 1, gMapName.name, RGB(0x11, 0x00, 0x22), SURFACE_ID_ROOM_NAME);
|
||||
PutText2((160 - 6 * len) / 2 + 6, 0, gMapName.name, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_ROOM_NAME);
|
||||
|
|
|
@ -29,7 +29,7 @@ void WriteMiniMapLine(int line)
|
|||
{242, 24, 243, 25},
|
||||
{243, 24, 244, 25},
|
||||
};
|
||||
|
||||
|
||||
for (x = 0; x < gMap.width; x++)
|
||||
{
|
||||
a = GetAttribute(x, line);
|
||||
|
@ -84,12 +84,12 @@ int MiniMapLoop()
|
|||
RECT my_rect = {0, 57, 1, 58};
|
||||
int my_x = (gMC.x / 0x200 + 8) / 16;
|
||||
int my_y = (gMC.y / 0x200 + 8) / 16;
|
||||
|
||||
|
||||
RECT rcView;
|
||||
for (f = 0; f <= 8; f++)
|
||||
{
|
||||
GetTrg();
|
||||
|
||||
|
||||
if (gKey & KEY_ESCAPE)
|
||||
{
|
||||
switch (Call_Escape())
|
||||
|
@ -100,9 +100,9 @@ int MiniMapLoop()
|
|||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PutBitmap4(&grcGame, 0, 0, &grcGame, SURFACE_ID_SCREEN_GRAB);
|
||||
|
||||
|
||||
rcView.left = (WINDOW_WIDTH / 2) - gMap.width * f / 8 / 2;
|
||||
rcView.right = (WINDOW_WIDTH / 2) + gMap.width * f / 8 / 2;
|
||||
rcView.top = (WINDOW_HEIGHT / 2) - gMap.length * f / 8 / 2;
|
||||
|
@ -110,12 +110,12 @@ int MiniMapLoop()
|
|||
|
||||
PutMapName(true);
|
||||
CortBox(&rcView, 0);
|
||||
|
||||
|
||||
PutFramePerSecound();
|
||||
if (!Flip_SystemTask())
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
RECT rcMiniMap;
|
||||
rcMiniMap.left = 0;
|
||||
rcMiniMap.right = gMap.width;
|
||||
|
@ -125,16 +125,16 @@ int MiniMapLoop()
|
|||
rcView.right = --rcView.left + gMap.width + 2;
|
||||
rcView.bottom = --rcView.top + gMap.length + 2;
|
||||
CortBox2(&rcMiniMap, 0, SURFACE_ID_MAP);
|
||||
|
||||
|
||||
int line = 0;
|
||||
uint8_t my_wait = 0;
|
||||
while (true)
|
||||
{
|
||||
GetTrg();
|
||||
|
||||
|
||||
if ((gKeyCancel | gKeyOk) & gKeyTrg)
|
||||
break;
|
||||
|
||||
|
||||
if (gKey & KEY_ESCAPE)
|
||||
{
|
||||
switch (Call_Escape())
|
||||
|
@ -145,10 +145,10 @@ int MiniMapLoop()
|
|||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PutBitmap4(&grcGame, 0, 0, &grcGame, SURFACE_ID_SCREEN_GRAB);
|
||||
CortBox(&rcView, 0);
|
||||
|
||||
|
||||
if (line < gMap.length)
|
||||
{
|
||||
WriteMiniMapLine(line);
|
||||
|
@ -161,17 +161,17 @@ int MiniMapLoop()
|
|||
}
|
||||
|
||||
PutBitmap3(&grcGame, rcView.left + 1, rcView.top + 1, &rcMiniMap, SURFACE_ID_MAP);
|
||||
|
||||
|
||||
PutMapName(true);
|
||||
|
||||
|
||||
if (++my_wait / 8 % 2)
|
||||
PutBitmap3(&grcGame, my_x + rcView.left + 1, my_y + rcView.top + 1, &my_rect, SURFACE_ID_TEXT_BOX);
|
||||
|
||||
|
||||
PutFramePerSecound();
|
||||
if (!Flip_SystemTask())
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
for (f = 8; f >= -1; --f)
|
||||
{
|
||||
GetTrg();
|
||||
|
|
132
src/MyChar.cpp
132
src/MyChar.cpp
|
@ -87,28 +87,28 @@ void AnimationMyChar(bool bKey)
|
|||
else if (gKey & gKeyUp && (gKeyRight | gKeyLeft) & gKey && bKey)
|
||||
{
|
||||
gMC.cond |= 4;
|
||||
|
||||
|
||||
if (++gMC.ani_wait > 4)
|
||||
{
|
||||
gMC.ani_wait = 0;
|
||||
if (++gMC.ani_no == 7 || gMC.ani_no == 9)
|
||||
PlaySoundObject(24, 1);
|
||||
}
|
||||
|
||||
|
||||
if (gMC.ani_no > 9 || gMC.ani_no < 6)
|
||||
gMC.ani_no = 6;
|
||||
}
|
||||
else if ((gKeyRight | gKeyLeft) & gKey && bKey)
|
||||
{
|
||||
gMC.cond |= 4;
|
||||
|
||||
|
||||
if (++gMC.ani_wait > 4)
|
||||
{
|
||||
gMC.ani_wait = 0;
|
||||
if (++gMC.ani_no == 2 || gMC.ani_no == 4)
|
||||
PlaySoundObject(24, 1);
|
||||
}
|
||||
|
||||
|
||||
if (gMC.ani_no > 4 || gMC.ani_no < 1)
|
||||
gMC.ani_no = 1;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ void AnimationMyChar(bool bKey)
|
|||
{
|
||||
if (gMC.cond & 4)
|
||||
PlaySoundObject(24, 1);
|
||||
|
||||
|
||||
gMC.cond &= ~4;
|
||||
gMC.ani_no = 5;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ void AnimationMyChar(bool bKey)
|
|||
{
|
||||
if (gMC.cond & 4)
|
||||
PlaySoundObject(24, 1);
|
||||
|
||||
|
||||
gMC.cond &= ~4;
|
||||
gMC.ani_no = 0;
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ void AnimationMyChar(bool bKey)
|
|||
{
|
||||
gMC.ani_no = 1;
|
||||
}
|
||||
|
||||
|
||||
if (gMC.direct)
|
||||
gMC.rect = rcRight[gMC.ani_no];
|
||||
else
|
||||
|
@ -170,13 +170,13 @@ void PutMyChar(int fx, int fy)
|
|||
gMC.rect_arms.right = gMC.rect_arms.left + 24;
|
||||
gMC.rect_arms.top = 96 * (gArmsData[gSelectedArms].code / 13);
|
||||
gMC.rect_arms.bottom = gMC.rect_arms.top + 16;
|
||||
|
||||
|
||||
if (gMC.direct == 2)
|
||||
{
|
||||
gMC.rect_arms.top += 16;
|
||||
gMC.rect_arms.bottom += 16;
|
||||
}
|
||||
|
||||
|
||||
int arms_offset_y;
|
||||
if (gMC.up)
|
||||
{
|
||||
|
@ -194,10 +194,10 @@ void PutMyChar(int fx, int fy)
|
|||
{
|
||||
arms_offset_y = 0;
|
||||
}
|
||||
|
||||
|
||||
if (gMC.ani_no == 1 || gMC.ani_no == 3 || gMC.ani_no == 6 || gMC.ani_no == 8)
|
||||
++gMC.rect_arms.top;
|
||||
|
||||
|
||||
if (gMC.direct)
|
||||
PutBitmap3(
|
||||
&grcGame,
|
||||
|
@ -212,7 +212,7 @@ void PutMyChar(int fx, int fy)
|
|||
(gMC.y - gMC.view.top) / 0x200 - fy / 0x200 + arms_offset_y,
|
||||
&gMC.rect_arms,
|
||||
SURFACE_ID_ARMS);
|
||||
|
||||
|
||||
if (!((gMC.shock >> 1) & 1))
|
||||
{
|
||||
//Draw player
|
||||
|
@ -222,15 +222,15 @@ void PutMyChar(int fx, int fy)
|
|||
rect.top += 32;
|
||||
rect.bottom += 32;
|
||||
}
|
||||
|
||||
|
||||
PutBitmap3(&grcGame, (gMC.x - gMC.view.left) / 0x200 - fx / 0x200, (gMC.y - gMC.view.top) / 0x200 - fy / 0x200, &rect, SURFACE_ID_MY_CHAR);
|
||||
|
||||
|
||||
//Draw airtank
|
||||
RECT rcBubble[2] = {
|
||||
{56, 96, 80, 120},
|
||||
{80, 96, 104, 120},
|
||||
};
|
||||
|
||||
|
||||
++gMC.bubble;
|
||||
if (gMC.equip & 0x10 && gMC.flag & 0x100)
|
||||
PutBitmap3(&grcGame, gMC.x / 0x200 - 12 - fx / 0x200, gMC.y / 0x200 - 12 - fy / 0x200, &rcBubble[(gMC.bubble >> 1) & 1], SURFACE_ID_CARET);
|
||||
|
@ -252,7 +252,7 @@ void ActMyChar_Normal(bool bKey)
|
|||
int dash1;
|
||||
int dash2;
|
||||
int resist;
|
||||
|
||||
|
||||
if (gMC.flag & 0x100)
|
||||
{
|
||||
max_dash = 0x196;
|
||||
|
@ -273,20 +273,20 @@ void ActMyChar_Normal(bool bKey)
|
|||
dash2 = 0x20;
|
||||
resist = 0x33;
|
||||
}
|
||||
|
||||
|
||||
//Don't create "?" effect
|
||||
gMC.ques = 0;
|
||||
|
||||
|
||||
//If can't control player, stop boosting
|
||||
if (!bKey)
|
||||
gMC.boost_sw = 0;
|
||||
|
||||
|
||||
//Movement on the ground
|
||||
if (gMC.flag & 8 || gMC.flag & 0x10 || gMC.flag & 0x20)
|
||||
{
|
||||
//Stop boosting and refuel
|
||||
gMC.boost_sw = 0;
|
||||
|
||||
|
||||
if (gMC.equip & 1)
|
||||
{
|
||||
gMC.boost_cnt = 50;
|
||||
|
@ -299,7 +299,7 @@ void ActMyChar_Normal(bool bKey)
|
|||
{
|
||||
gMC.boost_cnt = 0;
|
||||
}
|
||||
|
||||
|
||||
//Move in direction held
|
||||
if (bKey)
|
||||
{
|
||||
|
@ -311,7 +311,7 @@ void ActMyChar_Normal(bool bKey)
|
|||
gMC.xm -= dash1;
|
||||
if (gKey & gKeyRight && gMC.xm < max_dash)
|
||||
gMC.xm += dash1;
|
||||
|
||||
|
||||
if (gKey & gKeyLeft)
|
||||
gMC.direct = 0;
|
||||
if (gKey & gKeyRight)
|
||||
|
@ -324,7 +324,7 @@ void ActMyChar_Normal(bool bKey)
|
|||
gMC.ques = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Friction
|
||||
if (!(gMC.cond & 0x20))
|
||||
{
|
||||
|
@ -358,7 +358,7 @@ void ActMyChar_Normal(bool bKey)
|
|||
if (gMC.ym > 0x100)
|
||||
gMC.ym /= 2;
|
||||
}
|
||||
|
||||
|
||||
//Booster 2.0
|
||||
if (gMC.equip & 0x20)
|
||||
{
|
||||
|
@ -394,19 +394,19 @@ void ActMyChar_Normal(bool bKey)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Move left and right
|
||||
if ( gKey & gKeyLeft && gMC.xm > -max_dash )
|
||||
gMC.xm -= dash2;
|
||||
if ( gKey & gKeyRight && gMC.xm < max_dash )
|
||||
gMC.xm += dash2;
|
||||
|
||||
|
||||
if ( gKey & gKeyLeft )
|
||||
gMC.direct = 0;
|
||||
if ( gKey & gKeyRight )
|
||||
gMC.direct = 2;
|
||||
}
|
||||
|
||||
|
||||
//Slow down when stopped boosting (Booster 2.0)
|
||||
if (gMC.equip & 0x20 && gMC.boost_sw && (!(gKey & gKeyJump) || !gMC.boost_cnt))
|
||||
{
|
||||
|
@ -415,19 +415,19 @@ void ActMyChar_Normal(bool bKey)
|
|||
else if (gMC.boost_sw == 2)
|
||||
gMC.ym /= 2;
|
||||
}
|
||||
|
||||
|
||||
//Stop boosting
|
||||
if (!gMC.boost_cnt || !(gKey & gKeyJump))
|
||||
gMC.boost_sw = 0;
|
||||
}
|
||||
|
||||
|
||||
//Jumping
|
||||
if ( bKey )
|
||||
{
|
||||
//Look up and down
|
||||
gMC.up = (gKey & gKeyUp) != 0;
|
||||
gMC.down = gKey & gKeyDown && !(gMC.flag & 8);
|
||||
|
||||
|
||||
if (gKeyTrg & gKeyJump
|
||||
&& (gMC.flag & 8 || gMC.flag & 0x10 || gMC.flag & 0x20)
|
||||
&& !(gMC.flag & 0x2000))
|
||||
|
@ -436,15 +436,15 @@ void ActMyChar_Normal(bool bKey)
|
|||
PlaySoundObject(15, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Stop interacting when moved
|
||||
if (bKey && (gKeyShot | gKeyJump | gKeyUp | gKeyRight | gKeyLeft) & gKey)
|
||||
gMC.cond &= ~1;
|
||||
|
||||
|
||||
//Booster losing fuel
|
||||
if (gMC.boost_sw && gMC.boost_cnt)
|
||||
--gMC.boost_cnt;
|
||||
|
||||
|
||||
//Wind / current forces
|
||||
if (gMC.flag & 0x1000)
|
||||
gMC.xm -= 0x88;
|
||||
|
@ -454,7 +454,7 @@ void ActMyChar_Normal(bool bKey)
|
|||
gMC.xm += 0x88;
|
||||
if (gMC.flag & 0x8000)
|
||||
gMC.ym += 0x55;
|
||||
|
||||
|
||||
//Booster 2.0 forces and effects
|
||||
if (gMC.equip & 0x20 && gMC.boost_sw)
|
||||
{
|
||||
|
@ -463,13 +463,13 @@ void ActMyChar_Normal(bool bKey)
|
|||
//Go up when going into a wall
|
||||
if (gMC.flag & 5)
|
||||
gMC.ym = -0x100;
|
||||
|
||||
|
||||
//Move in direction facing
|
||||
if (!gMC.direct)
|
||||
gMC.xm -= 0x20;
|
||||
if (gMC.direct == 2)
|
||||
gMC.xm += 0x20;
|
||||
|
||||
|
||||
//Boost particles (and sound)
|
||||
if (gKeyTrg & gKeyJump || gMC.boost_cnt % 3 == 1)
|
||||
{
|
||||
|
@ -477,7 +477,7 @@ void ActMyChar_Normal(bool bKey)
|
|||
SetCaret(gMC.x + 0x400, gMC.y + 0x400, 7, 2);
|
||||
if (gMC.direct == 2)
|
||||
SetCaret(gMC.x - 0x400, gMC.y + 0x400, 7, 0);
|
||||
|
||||
|
||||
PlaySoundObject(113, 1);
|
||||
}
|
||||
}
|
||||
|
@ -485,7 +485,7 @@ void ActMyChar_Normal(bool bKey)
|
|||
{
|
||||
//Move upwards
|
||||
gMC.ym -= 0x20;
|
||||
|
||||
|
||||
//Boost particles (and sound)
|
||||
if (gKeyTrg & gKeyJump || gMC.boost_cnt % 3 == 1)
|
||||
{
|
||||
|
@ -510,13 +510,13 @@ void ActMyChar_Normal(bool bKey)
|
|||
{
|
||||
//Upwards force
|
||||
gMC.ym -= 0x20;
|
||||
|
||||
|
||||
if (!(gMC.boost_cnt % 3))
|
||||
{
|
||||
SetCaret(gMC.x, gMC.hit.bottom / 2 + gMC.y, 7, 3);
|
||||
PlaySoundObject(113, 1);
|
||||
}
|
||||
|
||||
|
||||
//Bounce off of ceiling
|
||||
if (gMC.flag & 2)
|
||||
gMC.ym = 0x200;
|
||||
|
@ -531,7 +531,7 @@ void ActMyChar_Normal(bool bKey)
|
|||
{
|
||||
gMC.ym += gravity1;
|
||||
}
|
||||
|
||||
|
||||
//Keep player on slopes
|
||||
if (bKey && !(gKeyTrg & gKeyJump))
|
||||
{
|
||||
|
@ -546,7 +546,7 @@ void ActMyChar_Normal(bool bKey)
|
|||
if (gMC.flag & 8 && gMC.flag & 0x20000 && gMC.flag & 0x40000)
|
||||
gMC.ym = 0x400;
|
||||
}
|
||||
|
||||
|
||||
//Limit speed
|
||||
if (!(gMC.flag & 0x100) || gMC.flag & 0xF000)
|
||||
{
|
||||
|
@ -570,7 +570,7 @@ void ActMyChar_Normal(bool bKey)
|
|||
if (gMC.ym > 0x2FF)
|
||||
gMC.ym = 0x2FF;
|
||||
}
|
||||
|
||||
|
||||
//Water splashing
|
||||
if (!gMC.sprash && gMC.flag & 0x100)
|
||||
{
|
||||
|
@ -579,14 +579,14 @@ void ActMyChar_Normal(bool bKey)
|
|||
dir = 2;
|
||||
else
|
||||
dir = 0;
|
||||
|
||||
|
||||
if (gMC.flag & 8 || gMC.ym <= 0x200)
|
||||
{
|
||||
if (gMC.xm > 0x200 || gMC.xm < -0x200)
|
||||
{
|
||||
for (int a = 0; a < 8; a++)
|
||||
SetNpChar(73, gMC.x + (Random(-8, 8) << 9), gMC.y, gMC.xm + Random(-0x200, 0x200), Random(-0x200, 0x80), dir, 0, 0);
|
||||
|
||||
|
||||
PlaySoundObject(56, 1);
|
||||
}
|
||||
}
|
||||
|
@ -594,20 +594,20 @@ void ActMyChar_Normal(bool bKey)
|
|||
{
|
||||
for (int a = 0; a < 8; a++)
|
||||
SetNpChar(73, gMC.x + (Random(-8, 8) << 9), gMC.y, gMC.xm + Random(-0x200, 0x200), Random(-0x200, 0x80) - gMC.ym / 2, dir, 0, 0);
|
||||
|
||||
|
||||
PlaySoundObject(56, 1);
|
||||
}
|
||||
|
||||
|
||||
gMC.sprash = 1;
|
||||
}
|
||||
|
||||
|
||||
if (!(gMC.flag & 0x100))
|
||||
gMC.sprash = 0;
|
||||
|
||||
|
||||
//Spike damage
|
||||
if (gMC.flag & 0x400)
|
||||
DamageMyChar(10);
|
||||
|
||||
|
||||
//Camera
|
||||
if (gMC.direct)
|
||||
{
|
||||
|
@ -640,10 +640,10 @@ void ActMyChar_Normal(bool bKey)
|
|||
if (gMC.index_y < -0x200)
|
||||
gMC.index_y += 0x200;
|
||||
}
|
||||
|
||||
|
||||
gMC.tgt_x = gMC.x + gMC.index_x;
|
||||
gMC.tgt_y = gMC.y + gMC.index_y;
|
||||
|
||||
|
||||
//Change position
|
||||
if (gMC.xm > resist || gMC.xm < -resist)
|
||||
gMC.x += gMC.xm;
|
||||
|
@ -798,12 +798,12 @@ void AirProcess()
|
|||
{
|
||||
//Drown
|
||||
StartTextScript(41);
|
||||
|
||||
|
||||
if (gMC.direct)
|
||||
SetCaret(gMC.x, gMC.y, 8, 2);
|
||||
else
|
||||
SetCaret(gMC.x, gMC.y, 8, 0);
|
||||
|
||||
|
||||
gMC.cond &= ~0x80;
|
||||
}
|
||||
}
|
||||
|
@ -812,7 +812,7 @@ void AirProcess()
|
|||
{
|
||||
gMC.air = 1000;
|
||||
}
|
||||
|
||||
|
||||
if ( gMC.flag & 0x100 )
|
||||
{
|
||||
gMC.air_get = 60;
|
||||
|
@ -830,7 +830,7 @@ void ActMyChar(bool bKey)
|
|||
{
|
||||
if (gMC.exp_wait)
|
||||
--gMC.exp_wait;
|
||||
|
||||
|
||||
if (gMC.shock)
|
||||
{
|
||||
--gMC.shock;
|
||||
|
@ -840,7 +840,7 @@ void ActMyChar(bool bKey)
|
|||
SetValueView(&gMC.x, &gMC.y, gMC.exp_count);
|
||||
gMC.exp_count = 0;
|
||||
}
|
||||
|
||||
|
||||
switch (gMC.unit)
|
||||
{
|
||||
case 0:
|
||||
|
@ -848,15 +848,15 @@ void ActMyChar(bool bKey)
|
|||
AirProcess();
|
||||
ActMyChar_Normal(bKey);
|
||||
break;
|
||||
|
||||
|
||||
case 1:
|
||||
ActMyChar_Stream(bKey);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
gMC.cond &= ~0x20;
|
||||
}
|
||||
}
|
||||
|
@ -904,16 +904,16 @@ void SetMyCharDirect(uint8_t dir)
|
|||
case 3:
|
||||
gMC.cond |= 1;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
gMC.cond &= ~1;
|
||||
|
||||
|
||||
if (dir < 10)
|
||||
{
|
||||
gMC.direct = dir;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < NPC_MAX; i++)
|
||||
{
|
||||
if (gNPC[i].code_event == dir)
|
||||
|
@ -927,7 +927,7 @@ void SetMyCharDirect(uint8_t dir)
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
gMC.xm = 0;
|
||||
AnimationMyChar(false);
|
||||
}
|
||||
|
@ -959,7 +959,7 @@ void SetNoise(int no, int freq)
|
|||
{
|
||||
noise_freq = freq;
|
||||
noise_no = no;
|
||||
|
||||
|
||||
if (no == 1)
|
||||
{
|
||||
ChangeSoundFrequency(40, noise_freq);
|
||||
|
@ -1001,4 +1001,4 @@ void SleepNoise()
|
|||
PlaySoundObject(40, 0);
|
||||
PlaySoundObject(41, 0);
|
||||
PlaySoundObject(58, 0);
|
||||
}
|
||||
}
|
||||
|
|
236
src/MycHit.cpp
236
src/MycHit.cpp
|
@ -34,7 +34,7 @@ void PutlittleStar()
|
|||
int JudgeHitMyCharBlock(int x, int y)
|
||||
{
|
||||
int hit = 0;
|
||||
|
||||
|
||||
//Left wall
|
||||
if (gMC.y - gMC.hit.top < (2 * (2 * y + 1) - 1) << 11
|
||||
&& gMC.y + gMC.hit.bottom > (2 * (2 * y - 1) + 1) << 11
|
||||
|
@ -43,17 +43,17 @@ int JudgeHitMyCharBlock(int x, int y)
|
|||
{
|
||||
//Clip
|
||||
gMC.x = ((2 * x + 1) << 12) + gMC.hit.left;
|
||||
|
||||
|
||||
//Halt momentum
|
||||
if (gMC.xm < -0x180)
|
||||
gMC.xm = -0x180;
|
||||
if (!(gKey & gKeyLeft) && gMC.xm < 0)
|
||||
gMC.xm = 0;
|
||||
|
||||
|
||||
//Set that a left wall was hit
|
||||
hit |= 1;
|
||||
}
|
||||
|
||||
|
||||
//Right wall
|
||||
if (gMC.y - gMC.hit.top < (2 * (2 * y + 1) - 1) << 11
|
||||
&& gMC.y + gMC.hit.bottom > (2 * (2 * y - 1) + 1) << 11
|
||||
|
@ -62,17 +62,17 @@ int JudgeHitMyCharBlock(int x, int y)
|
|||
{
|
||||
//Clip
|
||||
gMC.x = ((2 * x - 1) << 12) - gMC.hit.right;
|
||||
|
||||
|
||||
//Halt momentum
|
||||
if (gMC.xm > 0x180)
|
||||
gMC.xm = 0x180;
|
||||
if (!(gKey & gKeyRight) && gMC.xm > 0)
|
||||
gMC.xm = 0;
|
||||
|
||||
|
||||
//Set that a right wall was hit
|
||||
hit |= 4;
|
||||
}
|
||||
|
||||
|
||||
//Ceiling
|
||||
if (gMC.x - gMC.hit.right < ((2 * x + 1) << 12) - 0x600
|
||||
&& gMC.x + gMC.hit.right > ((2 * x - 1) << 12) + 0x600
|
||||
|
@ -81,17 +81,17 @@ int JudgeHitMyCharBlock(int x, int y)
|
|||
{
|
||||
//Clip
|
||||
gMC.y = ((2 * y + 1) << 12) + gMC.hit.top;
|
||||
|
||||
|
||||
//Halt momentum
|
||||
if (!(gMC.cond & 2) && gMC.ym < -0x200)
|
||||
PutlittleStar();
|
||||
if (gMC.ym < 0)
|
||||
gMC.ym = 0;
|
||||
|
||||
|
||||
//Set that a ceiling was hit
|
||||
hit |= 2;
|
||||
}
|
||||
|
||||
|
||||
//Floor
|
||||
if (gMC.x - gMC.hit.right < ((2 * x + 1) << 12) - 0x600
|
||||
&& gMC.x + gMC.hit.right > ((2 * x - 1) << 12) + 0x600
|
||||
|
@ -100,24 +100,24 @@ int JudgeHitMyCharBlock(int x, int y)
|
|||
{
|
||||
//Clip
|
||||
gMC.y = ((2 * y - 1) << 12) - gMC.hit.bottom;
|
||||
|
||||
|
||||
//Halt momentum
|
||||
if (gMC.ym > 0x400)
|
||||
PlaySoundObject(23, 1);
|
||||
if (gMC.ym > 0)
|
||||
gMC.ym = 0;
|
||||
|
||||
|
||||
//Set that a floor was hit
|
||||
hit |= 8;
|
||||
}
|
||||
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
int JudgeHitMyCharTriangleA(int x, int y)
|
||||
{
|
||||
int hit = 0;
|
||||
|
||||
|
||||
if (gMC.x < (2 * x + 1) << 12
|
||||
&& gMC.x > (2 * x - 1) << 12
|
||||
&& gMC.y - gMC.hit.top < (y << 13) - (-0x2000 * x + gMC.x) / 2 + 0x800
|
||||
|
@ -125,24 +125,24 @@ int JudgeHitMyCharTriangleA(int x, int y)
|
|||
{
|
||||
//Clip
|
||||
gMC.y = (y << 13) - (-0x2000 * x + gMC.x) / 2 + 0x800 + gMC.hit.top;
|
||||
|
||||
|
||||
//Halt momentum
|
||||
if (!(gMC.cond & 2) && gMC.ym < -0x200)
|
||||
PutlittleStar();
|
||||
if (gMC.ym < 0)
|
||||
gMC.ym = 0;
|
||||
|
||||
|
||||
//Set that hit a ceiling
|
||||
hit |= 2;
|
||||
}
|
||||
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
int JudgeHitMyCharTriangleB(int x, int y)
|
||||
{
|
||||
int hit = 0;
|
||||
|
||||
|
||||
if (gMC.x < (2 * x + 1) << 12
|
||||
&& gMC.x > (2 * x - 1) << 12
|
||||
&& gMC.y - gMC.hit.top < (y << 13) - (-0x2000 * x + gMC.x) / 2 - 0x800
|
||||
|
@ -150,24 +150,24 @@ int JudgeHitMyCharTriangleB(int x, int y)
|
|||
{
|
||||
//Clip
|
||||
gMC.y = (y << 13) - (-0x2000 * x + gMC.x) / 2 - 0x800 + gMC.hit.top;
|
||||
|
||||
|
||||
//Halt momentum
|
||||
if (!(gMC.cond & 2) && gMC.ym < -0x200)
|
||||
PutlittleStar();
|
||||
if (gMC.ym < 0)
|
||||
gMC.ym = 0;
|
||||
|
||||
|
||||
//Set that hit a ceiling
|
||||
hit |= 2;
|
||||
}
|
||||
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
int JudgeHitMyCharTriangleC(int x, int y)
|
||||
{
|
||||
int hit = 0;
|
||||
|
||||
|
||||
if (gMC.x < (2 * x + 1) << 12
|
||||
&& gMC.x > (2 * x - 1) << 12
|
||||
&& gMC.y - gMC.hit.top < (y << 13) + (-0x2000 * x + gMC.x) / 2 - 0x800
|
||||
|
@ -175,24 +175,24 @@ int JudgeHitMyCharTriangleC(int x, int y)
|
|||
{
|
||||
//Clip
|
||||
gMC.y = (y << 13) + (-0x2000 * x + gMC.x) / 2 - 0x800 + gMC.hit.top;
|
||||
|
||||
|
||||
//Halt momentum
|
||||
if (!(gMC.cond & 2) && gMC.ym < -0x200)
|
||||
PutlittleStar();
|
||||
if (gMC.ym < 0)
|
||||
gMC.ym = 0;
|
||||
|
||||
|
||||
//Set that hit a ceiling
|
||||
hit |= 2;
|
||||
}
|
||||
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
int JudgeHitMyCharTriangleD(int x, int y)
|
||||
{
|
||||
int hit = 0;
|
||||
|
||||
|
||||
if (gMC.x < (2 * x + 1) << 12
|
||||
&& gMC.x > (2 * x - 1) << 12
|
||||
&& gMC.y - gMC.hit.top < (y << 13) + (-0x2000 * x + gMC.x) / 2 + 0x800
|
||||
|
@ -200,24 +200,24 @@ int JudgeHitMyCharTriangleD(int x, int y)
|
|||
{
|
||||
//Clip
|
||||
gMC.y = (y << 13) + (-0x2000 * x + gMC.x) / 2 + 0x800 + gMC.hit.top;
|
||||
|
||||
|
||||
//Halt momentum
|
||||
if (!(gMC.cond & 2) && gMC.ym < -0x200)
|
||||
PutlittleStar();
|
||||
if (gMC.ym < 0)
|
||||
gMC.ym = 0;
|
||||
|
||||
|
||||
//Set that hit a ceiling
|
||||
hit |= 2;
|
||||
}
|
||||
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
int JudgeHitMyCharTriangleE(int x, int y)
|
||||
{
|
||||
int hit = 0x10000;
|
||||
|
||||
|
||||
if (gMC.x < (2 * x + 1) << 12
|
||||
&& gMC.x > (2 * x - 1) << 12
|
||||
&& gMC.y + gMC.hit.bottom > (y << 13) + (-0x2000 * x + gMC.x) / 2 - 0x800
|
||||
|
@ -225,24 +225,24 @@ int JudgeHitMyCharTriangleE(int x, int y)
|
|||
{
|
||||
//Clip
|
||||
gMC.y = (y << 13) + (-0x2000 * x + gMC.x) / 2 - 0x800 - gMC.hit.bottom;
|
||||
|
||||
|
||||
//Halt momentum
|
||||
if (gMC.ym > 0x400)
|
||||
PlaySoundObject(23, 1);
|
||||
if (gMC.ym > 0)
|
||||
gMC.ym = 0;
|
||||
|
||||
|
||||
//Set that hit this slope
|
||||
hit = 0x10028;
|
||||
}
|
||||
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
int JudgeHitMyCharTriangleF(int x, int y)
|
||||
{
|
||||
int hit = 0x20000;
|
||||
|
||||
|
||||
if (gMC.x < (2 * x + 1) << 12
|
||||
&& gMC.x > (2 * x - 1) << 12
|
||||
&& gMC.y + gMC.hit.bottom > (y << 13) + (-0x2000 * x + gMC.x) / 2 + 0x800
|
||||
|
@ -250,24 +250,24 @@ int JudgeHitMyCharTriangleF(int x, int y)
|
|||
{
|
||||
//Clip
|
||||
gMC.y = (y << 13) + (-0x2000 * x + gMC.x) / 2 + 0x800 - gMC.hit.bottom;
|
||||
|
||||
|
||||
//Halt momentum
|
||||
if (gMC.ym > 0x400)
|
||||
PlaySoundObject(23, 1);
|
||||
if (gMC.ym > 0)
|
||||
gMC.ym = 0;
|
||||
|
||||
|
||||
//Set that hit this slope
|
||||
hit = 0x20028;
|
||||
}
|
||||
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
int JudgeHitMyCharTriangleG(int x, int y)
|
||||
{
|
||||
int hit = 0x40000;
|
||||
|
||||
|
||||
if (gMC.x < (2 * x + 1) << 12
|
||||
&& gMC.x > (2 * x - 1) << 12
|
||||
&& gMC.y + gMC.hit.bottom > (y << 13) - (-0x2000 * x + gMC.x) / 2 + 0x800
|
||||
|
@ -275,24 +275,24 @@ int JudgeHitMyCharTriangleG(int x, int y)
|
|||
{
|
||||
//Clip
|
||||
gMC.y = (y << 13) - (-0x2000 * x + gMC.x) / 2 + 0x800 - gMC.hit.bottom;
|
||||
|
||||
|
||||
//Halt momentum
|
||||
if (gMC.ym > 0x400)
|
||||
PlaySoundObject(23, 1);
|
||||
if (gMC.ym > 0)
|
||||
gMC.ym = 0;
|
||||
|
||||
|
||||
//Set that hit this slope
|
||||
hit = 0x40018;
|
||||
}
|
||||
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
int JudgeHitMyCharTriangleH(int x, int y)
|
||||
{
|
||||
int hit = 0x80000;
|
||||
|
||||
|
||||
if (gMC.x < (2 * x + 1) << 12
|
||||
&& gMC.x > (2 * x - 1) << 12
|
||||
&& gMC.y + gMC.hit.bottom > (y << 13) - (-0x2000 * x + gMC.x) / 2 - 0x800
|
||||
|
@ -300,56 +300,56 @@ int JudgeHitMyCharTriangleH(int x, int y)
|
|||
{
|
||||
//Clip
|
||||
gMC.y = (y << 13) - (-0x2000 * x + gMC.x) / 2 - 0x800 - gMC.hit.bottom;
|
||||
|
||||
|
||||
//Halt momentum
|
||||
if (gMC.ym > 0x400)
|
||||
PlaySoundObject(23, 1);
|
||||
if (gMC.ym > 0)
|
||||
gMC.ym = 0;
|
||||
|
||||
|
||||
//Set that hit this slope
|
||||
hit = 0x80018;
|
||||
}
|
||||
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
int JudgeHitMyCharWater(int x, int y)
|
||||
{
|
||||
int hit = 0;
|
||||
|
||||
|
||||
if (gMC.x - gMC.hit.right < ((2 * x + 1) << 12) - 0x600
|
||||
&& gMC.x + gMC.hit.right > ((2 * x - 1) << 12) + 0x600
|
||||
&& gMC.y - gMC.hit.top < ((2 * y + 1) << 12) - 0x600
|
||||
&& gMC.y + gMC.hit.bottom > y << 13)
|
||||
hit = 0x100;
|
||||
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
int JudgeHitMyCharDamage(int x, int y)
|
||||
{
|
||||
int hit = 0;
|
||||
|
||||
|
||||
if (gMC.x - 0x800 < (4 * x + 1) << 11
|
||||
&& gMC.x + 0x800 > (4 * x - 1) << 11
|
||||
&& gMC.y - 0x800 < (y << 13) + 0x600
|
||||
&& gMC.y + 0x800 > (y << 13) - 0x600)
|
||||
hit = 0x400;
|
||||
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
int JudgeHitMyCharDamageW(int x, int y)
|
||||
{
|
||||
int hit = 0;
|
||||
|
||||
|
||||
if (gMC.x - 0x800 < (4 * x + 1) << 11
|
||||
&& gMC.x + 0x800 > (4 * x - 1) << 11
|
||||
&& gMC.y - 0x800 < (y << 13) + 0x600
|
||||
&& gMC.y + 0x800 > (y << 13) - 0x600)
|
||||
hit = 0xD00;
|
||||
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
|
@ -361,7 +361,7 @@ int JudgeHitMyCharVectLeft(int x, int y)
|
|||
&& gMC.y - gMC.hit.top < (4 * (2 * y + 1) - 1) << 10
|
||||
&& gMC.y + gMC.hit.bottom > (4 * (2 * y - 1) + 1) << 10)
|
||||
hit = 0x1000;
|
||||
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
|
@ -373,7 +373,7 @@ int JudgeHitMyCharVectUp(int x, int y)
|
|||
&& gMC.y - gMC.hit.top < (4 * (2 * y + 1) - 1) << 10
|
||||
&& gMC.y + gMC.hit.bottom > (4 * (2 * y - 1) + 1) << 10)
|
||||
hit = 0x2000;
|
||||
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
|
@ -385,7 +385,7 @@ int JudgeHitMyCharVectRight(int x, int y)
|
|||
&& gMC.y - gMC.hit.top < (4 * (2 * y + 1) - 1) << 10
|
||||
&& gMC.y + gMC.hit.bottom > (4 * (2 * y - 1) + 1) << 10)
|
||||
hit = 0x4000;
|
||||
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
|
@ -397,7 +397,7 @@ int JudgeHitMyCharVectDown(int x, int y)
|
|||
&& gMC.y - gMC.hit.top < (4 * (2 * y + 1) - 1) << 10
|
||||
&& gMC.y + gMC.hit.bottom > (4 * (2 * y - 1) + 1) << 10)
|
||||
hit = 0x8000;
|
||||
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
|
@ -405,7 +405,7 @@ void HitMyCharMap()
|
|||
{
|
||||
int x = gMC.x / 0x2000;
|
||||
int y = gMC.y / 0x2000;
|
||||
|
||||
|
||||
int offy[4];
|
||||
int offx[4];
|
||||
offx[0] = 0;
|
||||
|
@ -416,19 +416,19 @@ void HitMyCharMap()
|
|||
offy[1] = 0;
|
||||
offy[2] = 1;
|
||||
offy[3] = 1;
|
||||
|
||||
|
||||
uint8_t atrb[4];
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
atrb[i] = GetAttribute(x + offx[i], y + offy[i]);
|
||||
|
||||
|
||||
switch (atrb[i])
|
||||
{
|
||||
//Water
|
||||
case 0x02:
|
||||
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
//Block
|
||||
case 0x05:
|
||||
case 0x41:
|
||||
|
@ -436,144 +436,144 @@ void HitMyCharMap()
|
|||
case 0x46:
|
||||
gMC.flag |= JudgeHitMyCharBlock(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
//Spikes
|
||||
case 0x42:
|
||||
gMC.flag |= JudgeHitMyCharDamage(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
//Slopes
|
||||
case 0x50:
|
||||
gMC.flag |= JudgeHitMyCharTriangleA(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x51:
|
||||
gMC.flag |= JudgeHitMyCharTriangleB(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x52:
|
||||
gMC.flag |= JudgeHitMyCharTriangleC(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x53:
|
||||
gMC.flag |= JudgeHitMyCharTriangleD(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x54:
|
||||
gMC.flag |= JudgeHitMyCharTriangleE(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x55:
|
||||
gMC.flag |= JudgeHitMyCharTriangleF(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x56:
|
||||
gMC.flag |= JudgeHitMyCharTriangleG(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x57:
|
||||
gMC.flag |= JudgeHitMyCharTriangleH(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
//Water and water blocks
|
||||
case 0x60:
|
||||
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x61:
|
||||
gMC.flag |= JudgeHitMyCharBlock(x + offx[i], y + offy[i]);
|
||||
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
//Water spikes
|
||||
case 0x62:
|
||||
gMC.flag |= JudgeHitMyCharDamageW(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
//Water slopes
|
||||
case 0x70:
|
||||
gMC.flag |= JudgeHitMyCharTriangleA(x + offx[i], y + offy[i]);
|
||||
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x71:
|
||||
gMC.flag |= JudgeHitMyCharTriangleB(x + offx[i], y + offy[i]);
|
||||
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x72:
|
||||
gMC.flag |= JudgeHitMyCharTriangleC(x + offx[i], y + offy[i]);
|
||||
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x73:
|
||||
gMC.flag |= JudgeHitMyCharTriangleD(x + offx[i], y + offy[i]);
|
||||
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x74:
|
||||
gMC.flag |= JudgeHitMyCharTriangleE(x + offx[i], y + offy[i]);
|
||||
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x75:
|
||||
gMC.flag |= JudgeHitMyCharTriangleF(x + offx[i], y + offy[i]);
|
||||
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x76:
|
||||
gMC.flag |= JudgeHitMyCharTriangleG(x + offx[i], y + offy[i]);
|
||||
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x77:
|
||||
gMC.flag |= JudgeHitMyCharTriangleH(x + offx[i], y + offy[i]);
|
||||
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
//Wind
|
||||
case 0x80:
|
||||
gMC.flag |= JudgeHitMyCharVectLeft(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x81:
|
||||
gMC.flag |= JudgeHitMyCharVectUp(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x82:
|
||||
gMC.flag |= JudgeHitMyCharVectRight(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x83:
|
||||
gMC.flag |= JudgeHitMyCharVectDown(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
//Water current
|
||||
case 0xA0:
|
||||
gMC.flag |= JudgeHitMyCharVectLeft(x + offx[i], y + offy[i]);
|
||||
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
case 0xA1:
|
||||
gMC.flag |= JudgeHitMyCharVectUp(x + offx[i], y + offy[i]);
|
||||
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
case 0xA2:
|
||||
gMC.flag |= JudgeHitMyCharVectRight(x + offx[i], y + offy[i]);
|
||||
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
case 0xA3:
|
||||
gMC.flag |= JudgeHitMyCharVectDown(x + offx[i], y + offy[i]);
|
||||
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (gMC.y > gWaterY + 0x800)
|
||||
gMC.flag |= 0x100;
|
||||
}
|
||||
|
@ -581,7 +581,7 @@ void HitMyCharMap()
|
|||
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
|
||||
|
@ -591,7 +591,7 @@ int JudgeHitMyCharNPC(NPCHAR *npc)
|
|||
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
|
||||
|
@ -601,7 +601,7 @@ int JudgeHitMyCharNPC(NPCHAR *npc)
|
|||
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
|
||||
|
@ -611,7 +611,7 @@ int JudgeHitMyCharNPC(NPCHAR *npc)
|
|||
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
|
||||
|
@ -651,7 +651,7 @@ int JudgeHitMyCharNPC3(NPCHAR *npc)
|
|||
&& gMC.y - 0x400 < npc->y + npc->hit.bottom)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -660,28 +660,28 @@ 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 = (float)v1;
|
||||
|
||||
|
||||
if (npc->y <= gMC.y)
|
||||
v2 = (long double)(gMC.y - npc->y);
|
||||
else
|
||||
v2 = (long double)(npc->y - gMC.y);
|
||||
|
||||
|
||||
float fx2 = (float)npc->hit.back;
|
||||
if (0.0 == fx1)
|
||||
fx1 = 1.0;
|
||||
if (0.0 == fx2)
|
||||
fx2 = 1.0;
|
||||
|
||||
|
||||
float fy1 = (float)v2;
|
||||
float fy2 = (float)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)
|
||||
|
@ -693,7 +693,7 @@ int JudgeHitMyCharNPC4(NPCHAR *npc)
|
|||
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 )
|
||||
|
@ -717,15 +717,15 @@ int JudgeHitMyCharNPC4(NPCHAR *npc)
|
|||
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;
|
||||
|
@ -745,7 +745,7 @@ int JudgeHitMyCharNPC4(NPCHAR *npc)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
|
@ -754,7 +754,7 @@ void HitMyCharNpChar()
|
|||
if ((gMC.cond & 0x80) && !(gMC.cond & 2))
|
||||
{
|
||||
int hit;
|
||||
|
||||
|
||||
for (int i = 0; i < NPC_MAX; i++)
|
||||
{
|
||||
if (gNPC[i].cond & 0x80)
|
||||
|
@ -773,7 +773,7 @@ void HitMyCharNpChar()
|
|||
{
|
||||
hit = JudgeHitMyCharNPC3(&gNPC[i]);
|
||||
}
|
||||
|
||||
|
||||
//Special NPCs (pickups)
|
||||
if (hit && gNPC[i].code_char == 1)
|
||||
{
|
||||
|
@ -781,25 +781,25 @@ void HitMyCharNpChar()
|
|||
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))
|
||||
{
|
||||
|
@ -819,7 +819,7 @@ void HitMyCharNpChar()
|
|||
DamageMyChar(gNPC[i].damage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Interaction
|
||||
if (!(g_GameFlags & 4) && hit && gMC.cond & 1 && gNPC[i].bits & npc_interact)
|
||||
{
|
||||
|
@ -829,7 +829,7 @@ void HitMyCharNpChar()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Create question mark when NPC hasn't been interacted with
|
||||
if (gMC.ques)
|
||||
SetCaret(gMC.x, gMC.y, 9, 0);
|
||||
|
@ -859,13 +859,13 @@ void HitMyCharBoss()
|
|||
{
|
||||
hit = JudgeHitMyCharNPC3(&gBoss[b]);
|
||||
}
|
||||
|
||||
|
||||
if (!(g_GameFlags & 4) && hit && gBoss[b].bits & npc_eventTouch)
|
||||
{
|
||||
StartTextScript(gBoss[b].code_event);
|
||||
gMC.ques = 0;
|
||||
}
|
||||
|
||||
|
||||
if (gBoss[b].bits & npc_rearTop)
|
||||
{
|
||||
if (hit & 4 && gBoss[b].xm < 0)
|
||||
|
@ -877,7 +877,7 @@ void HitMyCharBoss()
|
|||
{
|
||||
DamageMyChar(gBoss[b].damage);
|
||||
}
|
||||
|
||||
|
||||
if (!(g_GameFlags & 4) && hit && (gMC.cond & 1) && gBoss[b].bits & npc_interact)
|
||||
{
|
||||
StartTextScript(gBoss[b].code_event);
|
||||
|
@ -886,8 +886,8 @@ void HitMyCharBoss()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (gMC.ques)
|
||||
SetCaret(gMC.x, gMC.y, 9, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,15 +41,15 @@ void AddExpMyChar(int x)
|
|||
{
|
||||
int lv = gArmsData[gSelectedArms].level - 1;
|
||||
int arms_code = gArmsData[gSelectedArms].code;
|
||||
|
||||
|
||||
gArmsData[gSelectedArms].exp += x;
|
||||
|
||||
|
||||
if (lv == 2)
|
||||
{
|
||||
if (gArmsData[gSelectedArms].exp >= gArmsLevelTable[0].exp[3 * arms_code + 2])
|
||||
{
|
||||
gArmsData[gSelectedArms].exp = gArmsLevelTable[0].exp[3 * arms_code + 2];
|
||||
|
||||
|
||||
if (gMC.equip & 0x80)
|
||||
{
|
||||
if (gMC.star < 3)
|
||||
|
@ -65,18 +65,18 @@ void AddExpMyChar(int x)
|
|||
{
|
||||
++gArmsData[gSelectedArms].level;
|
||||
gArmsData[gSelectedArms].exp = 0;
|
||||
|
||||
|
||||
if (gArmsData[gSelectedArms].code != 13)
|
||||
{
|
||||
PlaySoundObject(27, 1);
|
||||
SetCaret(gMC.x, gMC.y, 10, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
++lv;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (gArmsData[gSelectedArms].code == 13)
|
||||
{
|
||||
gMC.exp_wait = 10;
|
||||
|
@ -111,17 +111,17 @@ void DamageMyChar(int damage)
|
|||
if (gMC.unit != 1)
|
||||
gMC.ym = -0x400;
|
||||
gMC.life -= damage;
|
||||
|
||||
|
||||
//Lose a whimsical star
|
||||
if (gMC.equip & 0x80 && gMC.star > 0)
|
||||
--gMC.star;
|
||||
|
||||
|
||||
//Lose experience
|
||||
if (gMC.equip & 4)
|
||||
gArmsData[gSelectedArms].exp -= damage;
|
||||
else
|
||||
gArmsData[gSelectedArms].exp -= 2 * damage;
|
||||
|
||||
|
||||
while (gArmsData[gSelectedArms].exp < 0)
|
||||
{
|
||||
if (gArmsData[gSelectedArms].level <= 1)
|
||||
|
@ -135,10 +135,10 @@ void DamageMyChar(int damage)
|
|||
SetCaret(gMC.x, gMC.y, 10, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Tell player how much damage was taken
|
||||
SetValueView(&gMC.x, &gMC.y, -damage);
|
||||
|
||||
|
||||
//Death
|
||||
if (gMC.life <= 0)
|
||||
{
|
||||
|
@ -172,7 +172,7 @@ void AddBulletMyChar(int no, int val)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Super Missile Launcher
|
||||
for (int a = 0; a < ARMS_MAX; a++)
|
||||
{
|
||||
|
@ -209,12 +209,12 @@ void PutArmsEnergy(bool flash)
|
|||
RECT rcLv = {80, 80, 96, 88};
|
||||
RECT rcView = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
|
||||
RECT rcNone = {80, 48, 96, 56};
|
||||
|
||||
|
||||
if (gArmsEnergyX > 16)
|
||||
gArmsEnergyX -= 2;
|
||||
if (gArmsEnergyX < 16)
|
||||
gArmsEnergyX += 2;
|
||||
|
||||
|
||||
//Draw max ammo
|
||||
if (gArmsData[gSelectedArms].max_num)
|
||||
{
|
||||
|
@ -226,40 +226,40 @@ void PutArmsEnergy(bool flash)
|
|||
PutBitmap3(&rcView, gArmsEnergyX + 48, 16, &rcNone, SURFACE_ID_TEXT_BOX);
|
||||
PutBitmap3(&rcView, gArmsEnergyX + 48, 24, &rcNone, SURFACE_ID_TEXT_BOX);
|
||||
}
|
||||
|
||||
|
||||
//Draw experience and ammo
|
||||
if (!flash || !((gMC.shock >> 1) & 1))
|
||||
{
|
||||
PutBitmap3(&rcView, gArmsEnergyX + 32, 24, &rcPer, SURFACE_ID_TEXT_BOX);
|
||||
PutBitmap3(&rcView, gArmsEnergyX, 32, &rcLv, SURFACE_ID_TEXT_BOX);
|
||||
PutNumber4(gArmsEnergyX - 8, 32, gArmsData[gSelectedArms].level, 0);
|
||||
|
||||
|
||||
RECT rcExpBox = {0, 72, 40, 80};
|
||||
RECT rcExpVal = {0, 80, 0, 88};
|
||||
RECT rcExpMax = {40, 72, 80, 80};
|
||||
RECT rcExpFlash = {40, 80, 80, 88};
|
||||
|
||||
|
||||
int lv = gArmsData[gSelectedArms].level - 1;
|
||||
int arms_code = gArmsData[gSelectedArms].code;
|
||||
int exp_now = gArmsData[gSelectedArms].exp;
|
||||
int exp_next = gArmsLevelTable[0].exp[lv + 3 * arms_code];
|
||||
|
||||
|
||||
PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpBox, SURFACE_ID_TEXT_BOX);
|
||||
|
||||
|
||||
if (lv != 2 || gArmsData[gSelectedArms].exp != gArmsLevelTable[0].exp[3 * arms_code + 2])
|
||||
{
|
||||
if (exp_next)
|
||||
rcExpVal.right += 40 * exp_now / exp_next;
|
||||
else
|
||||
rcExpVal.right = 0;
|
||||
|
||||
|
||||
PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpVal, SURFACE_ID_TEXT_BOX);
|
||||
}
|
||||
else
|
||||
{
|
||||
PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpMax, SURFACE_ID_TEXT_BOX);
|
||||
}
|
||||
|
||||
|
||||
static int add_flash = true;
|
||||
if (gMC.exp_wait && ((add_flash++ >> 1) & 1))
|
||||
PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpFlash, SURFACE_ID_TEXT_BOX);
|
||||
|
@ -272,14 +272,14 @@ void PutActiveArmsList()
|
|||
|
||||
int arms_num;
|
||||
for (arms_num = 0; gArmsData[arms_num].code != 0; ++arms_num);
|
||||
|
||||
|
||||
if (arms_num)
|
||||
{
|
||||
for (int a = 0; a < arms_num; a++)
|
||||
{
|
||||
//Get X position to draw at
|
||||
int x = 16 * (a - gSelectedArms) + gArmsEnergyX;
|
||||
|
||||
|
||||
if (x >= 8)
|
||||
{
|
||||
if (x >= 24)
|
||||
|
@ -289,12 +289,12 @@ void PutActiveArmsList()
|
|||
{
|
||||
x += 16 * (arms_num + 3);
|
||||
}
|
||||
|
||||
|
||||
if (8 * (2 * (arms_num + 3) + 1) <= x)
|
||||
x += 16 * (-3 - arms_num);
|
||||
if (x < 72 && x >= 24)
|
||||
x -= 48;
|
||||
|
||||
|
||||
//Draw icon
|
||||
rect.left = 16 * gArmsData[a].code;
|
||||
rect.right = rect.left + 16;
|
||||
|
@ -308,22 +308,22 @@ void PutMyLife(bool flash)
|
|||
RECT rcCase = {0, 40, 232, 48};
|
||||
RECT rcLife = {0, 24, 232, 32};
|
||||
RECT rcBr = {0, 32, 232, 40};
|
||||
|
||||
|
||||
if (!flash || !((gMC.shock >> 1) & 1))
|
||||
{
|
||||
if (gMC.lifeBr < gMC.life)
|
||||
gMC.lifeBr = gMC.life;
|
||||
|
||||
|
||||
if (gMC.lifeBr <= gMC.life)
|
||||
gMC.lifeBr_count = 0;
|
||||
else if (++gMC.lifeBr_count > 30)
|
||||
--gMC.lifeBr;
|
||||
|
||||
|
||||
//Draw bar
|
||||
rcCase.right = 64;
|
||||
rcLife.right = 40 * gMC.life / gMC.max_life - 1;
|
||||
rcBr.right = 40 * gMC.lifeBr / gMC.max_life - 1;
|
||||
|
||||
|
||||
PutBitmap3(&grcGame, 16, 40, &rcCase, SURFACE_ID_TEXT_BOX);
|
||||
PutBitmap3(&grcGame, 40, 40, &rcBr, SURFACE_ID_TEXT_BOX);
|
||||
PutBitmap3(&grcGame, 40, 40, &rcLife, SURFACE_ID_TEXT_BOX);
|
||||
|
@ -343,7 +343,7 @@ void PutMyAir(int x, int y)
|
|||
//Draw how much air is left
|
||||
if (gMC.air_get % 6 <= 3)
|
||||
PutNumber4(x + 32, y, gMC.air / 10, 0);
|
||||
|
||||
|
||||
//Draw "AIR" text
|
||||
if (gMC.air % 30 <= 10)
|
||||
PutBitmap3(&grcGame, x, y, &rcAir[1], SURFACE_ID_TEXT_BOX);
|
||||
|
@ -367,7 +367,7 @@ void PutTimeCounter(int x, int y)
|
|||
{
|
||||
if (time_count < 300000)
|
||||
++time_count;
|
||||
|
||||
|
||||
if (time_count % 30 <= 10)
|
||||
PutBitmap3(&grcGame, x, y, &rcTime[1], SURFACE_ID_TEXT_BOX);
|
||||
else
|
||||
|
@ -377,7 +377,7 @@ void PutTimeCounter(int x, int y)
|
|||
{
|
||||
PutBitmap3(&grcGame, x, y, &rcTime[0], SURFACE_ID_TEXT_BOX);
|
||||
}
|
||||
|
||||
|
||||
//Draw time
|
||||
PutNumber4(x, y, time_count / 3000, false);
|
||||
PutNumber4(x + 20, y, time_count / 50 % 60, true);
|
||||
|
@ -397,11 +397,11 @@ bool SaveTimeCounter()
|
|||
//Quit if player doesn't have the Nikumaru Counter
|
||||
if (!(gMC.equip & 0x100))
|
||||
return true;
|
||||
|
||||
|
||||
//Get last time
|
||||
char path[PATH_LENGTH];
|
||||
sprintf(path, "%s/290.rec", gModulePath);
|
||||
|
||||
|
||||
FILE *fp = fopen(path, "rb");
|
||||
if (fp)
|
||||
{
|
||||
|
@ -421,25 +421,25 @@ bool SaveTimeCounter()
|
|||
p[1] -= rec.random[0];
|
||||
p[2] -= rec.random[0];
|
||||
p[3] -= (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? (rec.random[0] >> 1) : (rec.random[0]);
|
||||
|
||||
|
||||
//If this is faster than our new time, quit
|
||||
if (rec.counter[0] < time_count)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//Save new time
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
rec.counter[i] = time_count;
|
||||
rec.random[i] = Random(0, 250) + i;
|
||||
|
||||
|
||||
uint8_t *p = (uint8_t*)&rec.counter[i];
|
||||
p[0] += (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? (rec.random[i]) : (rec.random[i] >> 1);
|
||||
p[1] += rec.random[i];
|
||||
p[2] += rec.random[i];
|
||||
p[3] += (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? (rec.random[i] >> 1) : (rec.random[i]);
|
||||
}
|
||||
|
||||
|
||||
fp = fopen(path, "wb");
|
||||
if (fp == NULL)
|
||||
return false;
|
||||
|
@ -460,13 +460,13 @@ int LoadTimeCounter()
|
|||
//Open file
|
||||
char path[PATH_LENGTH];
|
||||
sprintf(path, "%s/290.rec", gModulePath);
|
||||
|
||||
|
||||
FILE *fp = fopen(path, "rb");
|
||||
if (!fp)
|
||||
return 0;
|
||||
|
||||
|
||||
REC rec;
|
||||
|
||||
|
||||
//Read data
|
||||
rec.counter[0] = File_ReadLE32(fp);
|
||||
rec.counter[1] = File_ReadLE32(fp);
|
||||
|
@ -477,7 +477,7 @@ int LoadTimeCounter()
|
|||
rec.random[2] = fgetc(fp);
|
||||
rec.random[3] = fgetc(fp);
|
||||
fclose(fp);
|
||||
|
||||
|
||||
//Decode from checksum
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
|
@ -487,7 +487,7 @@ int LoadTimeCounter()
|
|||
p[2] -= rec.random[i];
|
||||
p[3] -= (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? (rec.random[i] >> 1) : (rec.random[i]);
|
||||
}
|
||||
|
||||
|
||||
//Verify checksum's result
|
||||
if (rec.counter[0] == rec.counter[1] && rec.counter[0] == rec.counter[2])
|
||||
{
|
||||
|
|
|
@ -197,10 +197,10 @@ void SetExpObjects(int x, int y, int exp)
|
|||
break;
|
||||
++n;
|
||||
}
|
||||
|
||||
|
||||
if (n == NPC_MAX)
|
||||
break;
|
||||
|
||||
|
||||
memset(&gNPC[n], 0, sizeof(NPCHAR));
|
||||
|
||||
if (exp < 20)
|
||||
|
@ -389,7 +389,7 @@ void ChangeNpCharByEvent(int code_event, int code_char, int dir)
|
|||
gNPC[n].ani_wait = 0;
|
||||
gNPC[n].xm = 0;
|
||||
gNPC[n].ym = 0;
|
||||
|
||||
|
||||
if (dir != 5)
|
||||
{
|
||||
if (dir == 4)
|
||||
|
@ -404,7 +404,7 @@ void ChangeNpCharByEvent(int code_event, int code_char, int dir)
|
|||
gNPC[n].direct = dir;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gpNpcFuncTbl[code_char](&gNPC[n]);
|
||||
}
|
||||
}
|
||||
|
@ -431,7 +431,7 @@ void ChangeCheckableNpCharByEvent(int code_event, int code_char, int dir)
|
|||
gNPC[n].ani_wait = 0;
|
||||
gNPC[n].xm = 0;
|
||||
gNPC[n].ym = 0;
|
||||
|
||||
|
||||
if (dir != 5)
|
||||
{
|
||||
if (dir == 4)
|
||||
|
@ -446,7 +446,7 @@ void ChangeCheckableNpCharByEvent(int code_event, int code_char, int dir)
|
|||
gNPC[n].direct = dir;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gpNpcFuncTbl[code_char](&gNPC[n]);
|
||||
}
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ void SetNpCharActionNo(int code_event, int act_no, int dir)
|
|||
if ((gNPC[n].cond & 0x80) && gNPC[n].code_event == code_event)
|
||||
{
|
||||
gNPC[n].act_no = act_no;
|
||||
|
||||
|
||||
if (dir != 5)
|
||||
{
|
||||
if (dir == 4)
|
||||
|
@ -487,7 +487,7 @@ void MoveNpChar(int code_event, int x, int y, int dir)
|
|||
{
|
||||
gNPC[n].x = x;
|
||||
gNPC[n].y = y;
|
||||
|
||||
|
||||
if (dir != 5)
|
||||
{
|
||||
if (dir == 4)
|
||||
|
@ -511,7 +511,7 @@ void BackStepMyChar(int code_event)
|
|||
{
|
||||
gMC.cond &= ~1;
|
||||
gMC.ym = -0x200;
|
||||
|
||||
|
||||
if (code_event)
|
||||
{
|
||||
if (code_event == 2)
|
||||
|
@ -566,11 +566,11 @@ void DeleteNpCharCode(int code, bool bSmoke)
|
|||
{
|
||||
gNPC[n].cond = 0;
|
||||
SetNPCFlag(gNPC[n].code_flag);
|
||||
|
||||
|
||||
if (bSmoke)
|
||||
{
|
||||
PlaySoundObject(gNPC[n].destroy_voice, 1);
|
||||
|
||||
|
||||
switch (gNPC[n].size)
|
||||
{
|
||||
case 2:
|
||||
|
@ -601,7 +601,7 @@ BOOL IsNpCharCode(int code)
|
|||
if ((gNPC[i].cond & 0x80) && gNPC[i].code_char == code)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -612,7 +612,7 @@ BOOL GetNpCharAlive(int code_event)
|
|||
if ((gNPC[i].cond & 0x80) && gNPC[i].code_event == code_event)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -624,6 +624,6 @@ int CountAliveNpChar()
|
|||
if (gNPC[n].cond & 0x80)
|
||||
++count;
|
||||
}
|
||||
|
||||
|
||||
return count;
|
||||
}
|
||||
|
|
|
@ -542,35 +542,35 @@ void ActNpc006(NPCHAR *npc)
|
|||
{
|
||||
case 0: //Init
|
||||
npc->act_no = 1;
|
||||
|
||||
|
||||
if (npc->direct == 0)
|
||||
npc->act_no = 1;
|
||||
else
|
||||
npc->act_no = 3;
|
||||
break;
|
||||
|
||||
|
||||
case 1:
|
||||
//Accelerate to the left
|
||||
npc->xm -= 0x10;
|
||||
if (npc->xm < -0x400)
|
||||
npc->xm = -0x400;
|
||||
|
||||
|
||||
//Move
|
||||
if (npc->shock)
|
||||
npc->x += npc->xm / 2;
|
||||
else
|
||||
npc->x += npc->xm;
|
||||
|
||||
|
||||
//Animate
|
||||
if (++npc->ani_wait > 1)
|
||||
{
|
||||
npc->ani_wait = 0;
|
||||
++npc->ani_no;
|
||||
}
|
||||
|
||||
|
||||
if (npc->ani_no > 2)
|
||||
npc->ani_no = 1;
|
||||
|
||||
|
||||
//Stop when hitting a wall
|
||||
if (npc->flag & 1)
|
||||
{
|
||||
|
@ -581,7 +581,7 @@ void ActNpc006(NPCHAR *npc)
|
|||
npc->direct = 2;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 2:
|
||||
//Wait 60 frames then move to the right
|
||||
if (++npc->act_wait > 60)
|
||||
|
@ -591,29 +591,29 @@ void ActNpc006(NPCHAR *npc)
|
|||
npc->ani_no = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 3:
|
||||
//Accelerate to the right
|
||||
npc->xm += 0x10;
|
||||
if (npc->xm > 0x400)
|
||||
npc->xm = 0x400;
|
||||
|
||||
|
||||
//Move
|
||||
if (npc->shock)
|
||||
npc->x += npc->xm / 2;
|
||||
else
|
||||
npc->x += npc->xm;
|
||||
|
||||
|
||||
//Animate
|
||||
if (++npc->ani_wait > 1)
|
||||
{
|
||||
npc->ani_wait = 0;
|
||||
++npc->ani_no;
|
||||
}
|
||||
|
||||
|
||||
if (npc->ani_no > 2)
|
||||
npc->ani_no = 1;
|
||||
|
||||
|
||||
//Stop when hitting a wall
|
||||
if (npc->flag & 4)
|
||||
{
|
||||
|
@ -624,7 +624,7 @@ void ActNpc006(NPCHAR *npc)
|
|||
npc->direct = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 4:
|
||||
//Wait 60 frames then move to the left
|
||||
if (++npc->act_wait > 60)
|
||||
|
@ -635,7 +635,7 @@ void ActNpc006(NPCHAR *npc)
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//Set framerect
|
||||
if (npc->direct == 0)
|
||||
npc->rect = rcLeft[npc->ani_no];
|
||||
|
|
|
@ -93,7 +93,7 @@ void ActNpc040(NPCHAR *npc)
|
|||
npc->ani_no = 6;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (npc->direct == 0)
|
||||
npc->rect = rcLeft[npc->ani_no];
|
||||
else
|
||||
|
@ -825,17 +825,17 @@ void ActNpc048(NPCHAR *npc)
|
|||
npc->ym = -0x100;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (npc->direct == 2)
|
||||
{
|
||||
npc->bits &= ~npc_shootable;
|
||||
npc->bits |= npc_invulnerable;
|
||||
}
|
||||
|
||||
|
||||
npc->ym += 5;
|
||||
npc->y += npc->ym;
|
||||
npc->x += npc->xm;
|
||||
|
||||
|
||||
RECT rcLeft[2] = {
|
||||
{288, 88, 304, 104},
|
||||
{304, 88, 320, 104},
|
||||
|
@ -845,20 +845,20 @@ void ActNpc048(NPCHAR *npc)
|
|||
{288, 104, 304, 120},
|
||||
{304, 104, 320, 120},
|
||||
};
|
||||
|
||||
|
||||
if (++npc->ani_wait > 2)
|
||||
{
|
||||
npc->ani_wait = 0;
|
||||
if (++npc->ani_no > 1)
|
||||
npc->ani_no = 0;
|
||||
}
|
||||
|
||||
|
||||
if (++npc->act_wait > 750)
|
||||
{
|
||||
SetCaret(npc->x, npc->y, 2, 0);
|
||||
npc->cond = 0;
|
||||
}
|
||||
|
||||
|
||||
if (npc->direct == 0)
|
||||
npc->rect = rcLeft[npc->ani_no];
|
||||
else
|
||||
|
|
|
@ -577,7 +577,7 @@ void ActNpc127(NPCHAR *npc)
|
|||
if (++npc->ani_no > 2)
|
||||
npc->cond = 0;
|
||||
}
|
||||
|
||||
|
||||
if (npc->direct == 0)
|
||||
npc->rect = rcH[npc->ani_no];
|
||||
else
|
||||
|
@ -618,11 +618,11 @@ void ActNpc128(NPCHAR *npc)
|
|||
{224, 32, 232, 40},
|
||||
{224, 40, 232, 48},
|
||||
};
|
||||
|
||||
|
||||
if (npc->act_no == 0)
|
||||
{
|
||||
npc->act_no = 1;
|
||||
|
||||
|
||||
if (npc->direct == 0 || npc->direct == 2)
|
||||
{
|
||||
npc->view.front = 0x800;
|
||||
|
@ -634,10 +634,10 @@ void ActNpc128(NPCHAR *npc)
|
|||
npc->view.top = 0x800;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (++npc->ani_no > 4)
|
||||
npc->cond = 0;
|
||||
|
||||
|
||||
switch (npc->direct)
|
||||
{
|
||||
case 0:
|
||||
|
@ -678,16 +678,16 @@ void ActNpc129(NPCHAR *npc)
|
|||
{0xC0, 0x50, 0xD0, 0x60},
|
||||
{0xD0, 0x50, 0xE0, 0x60},
|
||||
};
|
||||
|
||||
|
||||
if (++npc->ani_wait > 1)
|
||||
{
|
||||
npc->ani_wait = 0;
|
||||
if (++npc->ani_no > 2)
|
||||
npc->cond = 0;
|
||||
}
|
||||
|
||||
|
||||
npc->y += npc->ym;
|
||||
|
||||
|
||||
npc->rect = rect[3 * npc->direct + npc->ani_no];
|
||||
}
|
||||
|
||||
|
|
|
@ -1115,13 +1115,13 @@ void ActNpc150(NPCHAR *npc)
|
|||
{160, 16, 176, 32},
|
||||
{112, 16, 128, 32},
|
||||
};
|
||||
|
||||
|
||||
switch (npc->act_no)
|
||||
{
|
||||
case 0:
|
||||
npc->act_no = 1;
|
||||
npc->ani_no = 0;
|
||||
|
||||
|
||||
if (npc->direct > 10)
|
||||
{
|
||||
npc->x = gMC.x;
|
||||
|
@ -1171,7 +1171,7 @@ void ActNpc150(NPCHAR *npc)
|
|||
|
||||
if (npc->ani_no > 6)
|
||||
npc->ani_no = 3;
|
||||
|
||||
|
||||
if (npc->direct == 0)
|
||||
npc->x -= 0x200;
|
||||
else
|
||||
|
@ -1202,7 +1202,7 @@ void ActNpc150(NPCHAR *npc)
|
|||
npc->x += 0x100;
|
||||
else
|
||||
npc->x -= 0x100;
|
||||
|
||||
|
||||
if (++npc->ani_wait > 8)
|
||||
{
|
||||
npc->ani_wait = 0;
|
||||
|
@ -1250,12 +1250,12 @@ void ActNpc150(NPCHAR *npc)
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (npc->direct == 0)
|
||||
npc->rect = rcLeft[npc->ani_no];
|
||||
else
|
||||
npc->rect = rcRight[npc->ani_no];
|
||||
|
||||
|
||||
if (npc->act_no == 21)
|
||||
{
|
||||
npc->rect.bottom = npc->act_wait / 4 + npc->rect.top;
|
||||
|
@ -1263,7 +1263,7 @@ void ActNpc150(NPCHAR *npc)
|
|||
if (npc->act_wait / 2 % 2)
|
||||
++npc->rect.left;
|
||||
}
|
||||
|
||||
|
||||
if (gMC.equip & 0x40)
|
||||
{
|
||||
npc->rect.top += 32;
|
||||
|
|
|
@ -573,7 +573,7 @@ void ActNpc184(NPCHAR *npc)
|
|||
{64, 64, 96, 96},
|
||||
{32, 64, 64, 96},
|
||||
};
|
||||
|
||||
|
||||
switch (npc->act_no)
|
||||
{
|
||||
case 0:
|
||||
|
@ -618,16 +618,16 @@ void ActNpc184(NPCHAR *npc)
|
|||
npc->act_no = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (++npc->ani_wait > 10)
|
||||
{
|
||||
npc->ani_wait = 0;
|
||||
++npc->ani_no;
|
||||
}
|
||||
|
||||
|
||||
if (npc->ani_no > 3)
|
||||
npc->ani_no = 0;
|
||||
|
||||
|
||||
npc->rect = rc[npc->ani_no];
|
||||
}
|
||||
|
||||
|
@ -684,7 +684,7 @@ void ActNpc186(NPCHAR *npc)
|
|||
{80, 48, 96, 64},
|
||||
{64, 48, 80, 64},
|
||||
};
|
||||
|
||||
|
||||
switch (npc->act_no)
|
||||
{
|
||||
case 0:
|
||||
|
@ -717,16 +717,16 @@ void ActNpc186(NPCHAR *npc)
|
|||
++npc->act_wait;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (++npc->ani_wait > 10)
|
||||
{
|
||||
npc->ani_wait = 0;
|
||||
++npc->ani_no;
|
||||
}
|
||||
|
||||
|
||||
if (npc->ani_no > 3)
|
||||
npc->ani_no = 0;
|
||||
|
||||
|
||||
npc->rect = rc[npc->ani_no];
|
||||
}
|
||||
|
||||
|
@ -962,7 +962,7 @@ void ActNpc190(NPCHAR *npc)
|
|||
{192, 32, 208, 48},
|
||||
{208, 32, 224, 48},
|
||||
};
|
||||
|
||||
|
||||
switch (npc->act_no)
|
||||
{
|
||||
case 0:
|
||||
|
@ -984,7 +984,7 @@ void ActNpc190(NPCHAR *npc)
|
|||
npc->ani_no = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
npc->rect = rect[npc->ani_no];
|
||||
}
|
||||
|
||||
|
@ -1067,7 +1067,7 @@ void ActNpc191(NPCHAR *npc)
|
|||
npc->y += npc->ym;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
gWaterY = npc->y;
|
||||
npc->rect.right = 0;
|
||||
npc->rect.bottom = 0;
|
||||
|
|
|
@ -1086,7 +1086,7 @@ void ActNpc267(NPCHAR *npc)
|
|||
|
||||
if (npc->act_no >= 512)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1095,7 +1095,7 @@ void ActNpc267(NPCHAR *npc)
|
|||
if (npc->act_no != 102 && npc->act_no != 103 && Random(0, 3) == 2)
|
||||
SetNpChar(270, npc->x + (Random(-0x10, 0x10) * 0x200), npc->y + (Random(-8, 4) * 0x200), npc->xm, 0, 3, 0, 0x100);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
SetNpChar(270, npc->x + (Random(-0x10, 0x10) * 0x200), npc->y - (((336 - npc->act_wait) / 8) * 0x200), Random(-0x200, 0x200), 2 * Random(-0x200, 0), 3, 0, 0xAA);
|
||||
SetNpChar(270, npc->x + (Random(-0x10, 0x10) * 0x200), npc->y - ((336 - npc->act_wait) / 8 * 0x200), Random(-0x200, 0x200), 2 * Random(-0x200, 0), 3, 0, 0xAA);
|
||||
|
@ -2130,7 +2130,7 @@ void ActNpc278(NPCHAR *npc)
|
|||
npc->x += npc->xm;
|
||||
npc->y += npc->ym;
|
||||
|
||||
|
||||
|
||||
switch (npc->code_event)
|
||||
{
|
||||
case 200:
|
||||
|
|
|
@ -1475,7 +1475,7 @@ void ActNpc295(NPCHAR *npc)
|
|||
{32, 96, 104, 0x80},
|
||||
{104, 96, 144, 0x80},
|
||||
};
|
||||
|
||||
|
||||
switch (npc->act_no)
|
||||
{
|
||||
case 0:
|
||||
|
|
|
@ -150,7 +150,7 @@ void ActNpc302(NPCHAR *npc)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (i == 0x200)
|
||||
{
|
||||
npc->cond = 0;
|
||||
|
@ -181,7 +181,7 @@ void ActNpc303(NPCHAR *npc)
|
|||
{216, 168, 232, 184},
|
||||
{232, 168, 248, 184},
|
||||
};
|
||||
|
||||
|
||||
if (npc->pNpc == NULL)
|
||||
return;
|
||||
|
||||
|
@ -198,12 +198,12 @@ void ActNpc303(NPCHAR *npc)
|
|||
}
|
||||
|
||||
npc->y = npc->pNpc->y;
|
||||
|
||||
|
||||
//Animation
|
||||
npc->ani_no = 0;
|
||||
if (npc->pNpc->ani_no == 3 || npc->pNpc->ani_no == 5)
|
||||
npc->y -= 0x200;
|
||||
|
||||
|
||||
//Set framerect
|
||||
if (npc->direct == 0)
|
||||
npc->rect = rcLeft[npc->ani_no];
|
||||
|
@ -220,7 +220,7 @@ void ActNpc304(NPCHAR *npc)
|
|||
{48, 176, 72, 192},
|
||||
{72, 176, 96, 192},
|
||||
};
|
||||
|
||||
|
||||
switch (npc->act_no)
|
||||
{
|
||||
case 0:
|
||||
|
@ -243,14 +243,14 @@ void ActNpc304(NPCHAR *npc)
|
|||
npc->ani_wait = 0;
|
||||
++npc->ani_no;
|
||||
}
|
||||
|
||||
|
||||
if (npc->ani_no > 3)
|
||||
npc->ani_no = 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
npc->rect = rc[npc->ani_no];
|
||||
}
|
||||
|
||||
|
@ -266,7 +266,7 @@ void ActNpc305(NPCHAR *npc)
|
|||
{160, 160, 176, 176},
|
||||
{176, 160, 192, 176},
|
||||
};
|
||||
|
||||
|
||||
switch (npc->act_no)
|
||||
{
|
||||
case 0:
|
||||
|
@ -274,19 +274,19 @@ void ActNpc305(NPCHAR *npc)
|
|||
npc->y -= 0x2000;
|
||||
npc->ani_wait = Random(0, 6);
|
||||
//Fallthrough
|
||||
|
||||
|
||||
case 1:
|
||||
if (++npc->ani_wait > 6)
|
||||
{
|
||||
npc->ani_wait = 0;
|
||||
++npc->ani_no;
|
||||
}
|
||||
|
||||
|
||||
if (npc->ani_no > 1)
|
||||
npc->ani_no = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (npc->direct == 0)
|
||||
npc->rect = rcLeft[npc->ani_no];
|
||||
else
|
||||
|
@ -305,7 +305,7 @@ void ActNpc306(NPCHAR *npc)
|
|||
{160, 152, 200, 184},
|
||||
{200, 152, 240, 184},
|
||||
};
|
||||
|
||||
|
||||
switch (npc->act_no)
|
||||
{
|
||||
case 0:
|
||||
|
@ -330,7 +330,7 @@ void ActNpc306(NPCHAR *npc)
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (npc->direct == 0)
|
||||
npc->rect = rcLeft[npc->ani_no];
|
||||
else
|
||||
|
@ -349,7 +349,7 @@ void ActNpc307(NPCHAR *npc)
|
|||
{0, 48, 16, 64},
|
||||
{16, 48, 32, 64},
|
||||
};
|
||||
|
||||
|
||||
switch (npc->act_no)
|
||||
{
|
||||
case 0:
|
||||
|
@ -375,12 +375,12 @@ void ActNpc307(NPCHAR *npc)
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (gMC.x < npc->x)
|
||||
npc->direct = 0;
|
||||
else
|
||||
npc->direct = 2;
|
||||
|
||||
|
||||
if (npc->direct == 0)
|
||||
npc->rect = rcLeft[npc->ani_no];
|
||||
else
|
||||
|
|
|
@ -371,7 +371,7 @@ void ActNpc324(NPCHAR *npc)
|
|||
npc->act_no = 0;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Heavy Press lightning
|
||||
|
@ -508,15 +508,15 @@ void ActNpc326(NPCHAR *npc)
|
|||
npc->ym += 0x40;
|
||||
if (npc->ym > 0x5FF)
|
||||
npc->ym = 0x5FF;
|
||||
|
||||
|
||||
npc->y += npc->ym;
|
||||
|
||||
|
||||
if (++npc->act_wait > 50)
|
||||
{
|
||||
npc->act_no = 30;
|
||||
npc->act_wait = 0;
|
||||
npc->ani_no = 6;
|
||||
|
||||
|
||||
if (npc->direct == 0)
|
||||
SetNpChar(327, npc->x, npc->y - 0x2000, 0, 0, 0, npc, 0x100);
|
||||
else
|
||||
|
@ -550,7 +550,7 @@ void ActNpc326(NPCHAR *npc)
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
RECT rcItoh[8] = {
|
||||
{0, 128, 16, 152},
|
||||
{16, 128, 32, 152},
|
||||
|
@ -572,7 +572,7 @@ void ActNpc326(NPCHAR *npc)
|
|||
{224, 128, 240, 152},
|
||||
{32, 152, 48, 176},
|
||||
};
|
||||
|
||||
|
||||
if (npc->direct == 0)
|
||||
npc->rect = rcItoh[npc->ani_no];
|
||||
else
|
||||
|
@ -586,15 +586,15 @@ void ActNpc327(NPCHAR *npc)
|
|||
{240, 80, 256, 96},
|
||||
{256, 80, 272, 96},
|
||||
};
|
||||
|
||||
|
||||
++npc->act_wait;
|
||||
|
||||
|
||||
switch (npc->act_no)
|
||||
{
|
||||
case 0:
|
||||
if (npc->act_wait < 4)
|
||||
npc->y -= 0x400;
|
||||
|
||||
|
||||
if (npc->pNpc->ani_no == 7)
|
||||
{
|
||||
npc->ani_no = 1;
|
||||
|
@ -603,7 +603,7 @@ void ActNpc327(NPCHAR *npc)
|
|||
npc->tgt_y = npc->y;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 1:
|
||||
if (npc->act_wait < 48)
|
||||
{
|
||||
|
@ -617,10 +617,10 @@ void ActNpc327(NPCHAR *npc)
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (npc->act_wait > 70)
|
||||
npc->cond = 0;
|
||||
|
||||
|
||||
npc->rect = rc[npc->ani_no];
|
||||
}
|
||||
|
||||
|
@ -638,7 +638,7 @@ void ActNpc329(NPCHAR *npc)
|
|||
{48, 0, 64, 16},
|
||||
{64, 0, 80, 16},
|
||||
};
|
||||
|
||||
|
||||
if (++npc->ani_wait / 2 % 2)
|
||||
npc->rect = rc[0];
|
||||
else
|
||||
|
@ -1136,5 +1136,5 @@ void ActNpc339(NPCHAR *npc)
|
|||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1489,7 +1489,7 @@ void ActNpc352(NPCHAR *npc)
|
|||
npc->ani_no = 0;
|
||||
npc->count1 = npc->direct / 100;
|
||||
npc->direct %= 100;
|
||||
|
||||
|
||||
//Set surfaces / offset
|
||||
switch (npc->count1)
|
||||
{
|
||||
|
@ -1503,7 +1503,7 @@ void ActNpc352(NPCHAR *npc)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
switch (npc->count1)
|
||||
{
|
||||
case 2:
|
||||
|
@ -1515,7 +1515,7 @@ void ActNpc352(NPCHAR *npc)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//Balrog
|
||||
if (npc->count1 == 9)
|
||||
{
|
||||
|
@ -1523,7 +1523,7 @@ void ActNpc352(NPCHAR *npc)
|
|||
npc->view.front = 0x2800;
|
||||
npc->x -= 0x200;
|
||||
}
|
||||
|
||||
|
||||
//Spawn King's sword
|
||||
if (!npc->count1)
|
||||
SetNpChar(145, 0, 0, 0, 0, 2, npc, 0x100);
|
||||
|
@ -1532,18 +1532,18 @@ void ActNpc352(NPCHAR *npc)
|
|||
npc->ym += 0x40;
|
||||
if (npc->ym > 0x5FF)
|
||||
npc->ym = 0x5FF;
|
||||
|
||||
|
||||
if (npc->flag & 8)
|
||||
{
|
||||
npc->ym = 0;
|
||||
npc->act_no = 2;
|
||||
npc->ani_no = 1;
|
||||
}
|
||||
|
||||
|
||||
npc->y += npc->ym;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
RECT rc[28] = {
|
||||
{304, 48, 320, 64},
|
||||
{224, 48, 240, 64},
|
||||
|
@ -1574,7 +1574,7 @@ void ActNpc352(NPCHAR *npc)
|
|||
{48, 16, 64, 32},
|
||||
{48, 0, 64, 16}
|
||||
};
|
||||
|
||||
|
||||
npc->rect = rc[npc->ani_no + 2 * npc->count1];
|
||||
}
|
||||
|
||||
|
@ -1981,6 +1981,6 @@ void ActNpc360(NPCHAR *npc)
|
|||
npc->x -= 0x1000;
|
||||
npc->y -= 0x1000;
|
||||
}
|
||||
|
||||
|
||||
npc->rect = rc;
|
||||
}
|
||||
|
|
142
src/NpcHit.cpp
142
src/NpcHit.cpp
|
@ -24,7 +24,7 @@ void JadgeHitNpCharBlock(NPCHAR *npc, int x, int y)
|
|||
npc->x = ((2 * x + 1) << 12) + npc->hit.back;
|
||||
hit |= 1;
|
||||
}
|
||||
|
||||
|
||||
if (npc->y - npc->hit.top < ((2 * y + 1) << 12) - 0x600
|
||||
&& npc->y + npc->hit.bottom > ((2 * y - 1) << 12) + 0x600
|
||||
&& npc->hit.back + npc->x > (2 * x - 1) << 12
|
||||
|
@ -33,7 +33,7 @@ void JadgeHitNpCharBlock(NPCHAR *npc, int x, int y)
|
|||
npc->x = ((2 * x - 1) << 12) - npc->hit.back;
|
||||
hit |= 4;
|
||||
}
|
||||
|
||||
|
||||
if (npc->x - npc->hit.back < ((2 * x + 1) << 12) - 0x600
|
||||
&& npc->hit.back + npc->x > ((2 * x - 1) << 12) + 0x600
|
||||
&& npc->y - npc->hit.top < (2 * y + 1) << 12
|
||||
|
@ -43,7 +43,7 @@ void JadgeHitNpCharBlock(NPCHAR *npc, int x, int y)
|
|||
npc->ym = 0;
|
||||
hit |= 2;
|
||||
}
|
||||
|
||||
|
||||
if (npc->x - npc->hit.back < ((2 * x + 1) << 12) - 0x600
|
||||
&& npc->hit.back + npc->x > ((2 * x - 1) << 12) + 0x600
|
||||
&& npc->y + npc->hit.bottom > (2 * y - 1) << 12
|
||||
|
@ -53,14 +53,14 @@ void JadgeHitNpCharBlock(NPCHAR *npc, int x, int y)
|
|||
npc->ym = 0;
|
||||
hit |= 8;
|
||||
}
|
||||
|
||||
|
||||
npc->flag |= hit;
|
||||
}
|
||||
|
||||
void JudgeHitNpCharTriangleA(NPCHAR *npc, int x, int y)
|
||||
{
|
||||
int hit = 0;
|
||||
|
||||
|
||||
if (npc->x < (2 * x + 1) << 12
|
||||
&& npc->x > (2 * x - 1) << 12
|
||||
&& npc->y - npc->hit.top < (y << 13) - (-0x2000 * x + npc->x) / 2 + 0x800
|
||||
|
@ -68,22 +68,22 @@ void JudgeHitNpCharTriangleA(NPCHAR *npc, int x, int y)
|
|||
{
|
||||
//Clip
|
||||
npc->y = npc->hit.top + (y << 13) - (-0x2000 * x + npc->x) / 2 + 0x800;
|
||||
|
||||
|
||||
//Halt momentum
|
||||
if (npc->ym < 0)
|
||||
npc->ym = 0;
|
||||
|
||||
|
||||
//Set that hit a ceiling
|
||||
hit = 2;
|
||||
}
|
||||
|
||||
|
||||
npc->flag |= hit;
|
||||
}
|
||||
|
||||
void JudgeHitNpCharTriangleB(NPCHAR *npc, int x, int y)
|
||||
{
|
||||
int hit = 0;
|
||||
|
||||
|
||||
if (npc->x < (2 * x + 1) << 12
|
||||
&& npc->x > (2 * x - 1) << 12
|
||||
&& npc->y - npc->hit.top < (y << 13) - (-0x2000 * x + npc->x) / 2 - 0x800
|
||||
|
@ -91,22 +91,22 @@ void JudgeHitNpCharTriangleB(NPCHAR *npc, int x, int y)
|
|||
{
|
||||
//Clip
|
||||
npc->y = npc->hit.top + (y << 13) - (-0x2000 * x + npc->x) / 2 - 0x800;
|
||||
|
||||
|
||||
//Halt momentum
|
||||
if (npc->ym < 0)
|
||||
npc->ym = 0;
|
||||
|
||||
|
||||
//Set that hit a ceiling
|
||||
hit = 2;
|
||||
}
|
||||
|
||||
|
||||
npc->flag |= hit;
|
||||
}
|
||||
|
||||
void JudgeHitNpCharTriangleC(NPCHAR *npc, int x, int y)
|
||||
{
|
||||
int hit = 0;
|
||||
|
||||
|
||||
if (npc->x < (2 * x + 1) << 12
|
||||
&& npc->x > (2 * x - 1) << 12
|
||||
&& npc->y - npc->hit.top < (y << 13) + (-0x2000 * x + npc->x) / 2 - 0x800
|
||||
|
@ -114,22 +114,22 @@ void JudgeHitNpCharTriangleC(NPCHAR *npc, int x, int y)
|
|||
{
|
||||
//Clip
|
||||
npc->y = npc->hit.top + (y << 13) + (-0x2000 * x + npc->x) / 2 - 0x800;
|
||||
|
||||
|
||||
//Halt momentum
|
||||
if (npc->ym < 0)
|
||||
npc->ym = 0;
|
||||
|
||||
|
||||
//Set that hit a ceiling
|
||||
hit = 2;
|
||||
}
|
||||
|
||||
|
||||
npc->flag |= hit;
|
||||
}
|
||||
|
||||
void JudgeHitNpCharTriangleD(NPCHAR *npc, int x, int y)
|
||||
{
|
||||
int hit = 0;
|
||||
|
||||
|
||||
if (npc->x < (2 * x + 1) << 12
|
||||
&& npc->x > (2 * x - 1) << 12
|
||||
&& npc->y - npc->hit.top < (y << 13) + (-0x2000 * x + npc->x) / 2 + 0x800
|
||||
|
@ -137,15 +137,15 @@ void JudgeHitNpCharTriangleD(NPCHAR *npc, int x, int y)
|
|||
{
|
||||
//Clip
|
||||
npc->y = npc->hit.top + (y << 13) + (-0x2000 * x + npc->x) / 2 + 0x800;
|
||||
|
||||
|
||||
//Halt momentum
|
||||
if (npc->ym < 0)
|
||||
npc->ym = 0;
|
||||
|
||||
|
||||
//Set that hit a ceiling
|
||||
hit = 2;
|
||||
}
|
||||
|
||||
|
||||
npc->flag |= hit;
|
||||
}
|
||||
|
||||
|
@ -160,15 +160,15 @@ void JudgeHitNpCharTriangleE(NPCHAR *npc, int x, int y)
|
|||
{
|
||||
//Clip
|
||||
npc->y = (y << 13) + (-0x2000 * x + npc->x) / 2 - 0x800 - npc->hit.bottom;
|
||||
|
||||
|
||||
//Halt momentum
|
||||
if (npc->ym > 0)
|
||||
npc->ym = 0;
|
||||
|
||||
|
||||
//Set that hit this slope
|
||||
hit = 0x10028;
|
||||
}
|
||||
|
||||
|
||||
npc->flag |= hit;
|
||||
}
|
||||
|
||||
|
@ -183,15 +183,15 @@ void JudgeHitNpCharTriangleF(NPCHAR *npc, int x, int y)
|
|||
{
|
||||
//Clip
|
||||
npc->y = (y << 13) + (-0x2000 * x + npc->x) / 2 + 0x800 - npc->hit.bottom;
|
||||
|
||||
|
||||
//Halt momentum
|
||||
if (npc->ym > 0)
|
||||
npc->ym = 0;
|
||||
|
||||
|
||||
//Set that hit this slope
|
||||
hit = 0x20028;
|
||||
}
|
||||
|
||||
|
||||
npc->flag |= hit;
|
||||
}
|
||||
|
||||
|
@ -206,15 +206,15 @@ void JudgeHitNpCharTriangleG(NPCHAR *npc, int x, int y)
|
|||
{
|
||||
//Clip
|
||||
npc->y = (y << 13) - (-0x2000 * x + npc->x) / 2 + 0x800 - npc->hit.bottom;
|
||||
|
||||
|
||||
//Halt momentum
|
||||
if (npc->ym > 0)
|
||||
npc->ym = 0;
|
||||
|
||||
|
||||
//Set that hit this slope
|
||||
hit = 0x40018;
|
||||
}
|
||||
|
||||
|
||||
npc->flag |= hit;
|
||||
}
|
||||
|
||||
|
@ -229,28 +229,28 @@ void JudgeHitNpCharTriangleH(NPCHAR *npc, int x, int y)
|
|||
{
|
||||
//Clip
|
||||
npc->y = (y << 13) - (-0x2000 * x + npc->x) / 2 - 0x800 - npc->hit.bottom;
|
||||
|
||||
|
||||
//Halt momentum
|
||||
if (npc->ym > 0)
|
||||
npc->ym = 0;
|
||||
|
||||
|
||||
//Set that hit this slope
|
||||
hit = 0x80018;
|
||||
}
|
||||
|
||||
|
||||
npc->flag |= hit;
|
||||
}
|
||||
|
||||
void JudgeHitNpCharWater(NPCHAR *npc, int x, int y)
|
||||
{
|
||||
int hit = 0;
|
||||
|
||||
|
||||
if (npc->x - npc->hit.back < (4 * (2 * x + 1) - 1) << 10
|
||||
&& npc->hit.back + npc->x > (4 * (2 * x - 1) + 1) << 10
|
||||
&& npc->y - npc->hit.top < (4 * (2 * y + 1) - 1) << 10
|
||||
&& npc->y + npc->hit.bottom > (4 * (2 * y - 1) + 1) << 10)
|
||||
hit = 0x100;
|
||||
|
||||
|
||||
npc->flag |= hit;
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,7 @@ void HitNpCharMap()
|
|||
{
|
||||
int offy[9];
|
||||
int offx[9];
|
||||
|
||||
|
||||
offx[0] = 0;
|
||||
offx[1] = 1;
|
||||
offx[2] = 0;
|
||||
|
@ -268,7 +268,7 @@ void HitNpCharMap()
|
|||
offx[6] = 2;
|
||||
offx[7] = 0;
|
||||
offx[8] = 1;
|
||||
|
||||
|
||||
offy[0] = 0;
|
||||
offy[1] = 0;
|
||||
offy[2] = 1;
|
||||
|
@ -278,7 +278,7 @@ void HitNpCharMap()
|
|||
offy[6] = 2;
|
||||
offy[7] = 2;
|
||||
offy[8] = 2;
|
||||
|
||||
|
||||
for (int i = 0; i < NPC_MAX; i++)
|
||||
{
|
||||
if ((gNPC[i].cond & 0x80) && !(gNPC[i].bits & 8))
|
||||
|
@ -296,9 +296,9 @@ void HitNpCharMap()
|
|||
x = (gNPC[i].x - 0x1000) / 0x2000;
|
||||
y = (gNPC[i].y - 0x1000) / 0x2000;
|
||||
}
|
||||
|
||||
|
||||
gNPC[i].flag = 0;
|
||||
|
||||
|
||||
for (int j = 0; j < judg; j++)
|
||||
{
|
||||
switch (GetAttribute(x + offx[j], y + offy[j]))
|
||||
|
@ -309,7 +309,7 @@ void HitNpCharMap()
|
|||
case 0x62:
|
||||
JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
break;
|
||||
|
||||
|
||||
//Block
|
||||
case 0x03:
|
||||
case 0x05:
|
||||
|
@ -317,7 +317,7 @@ void HitNpCharMap()
|
|||
case 0x43:
|
||||
JadgeHitNpCharBlock(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
break;
|
||||
|
||||
|
||||
//Water block
|
||||
case 0x04:
|
||||
case 0x61:
|
||||
|
@ -325,89 +325,89 @@ void HitNpCharMap()
|
|||
JadgeHitNpCharBlock(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
break;
|
||||
|
||||
|
||||
//No NPC block
|
||||
case 0x44:
|
||||
if (!(gNPC[i].bits & npc_ignore44))
|
||||
JadgeHitNpCharBlock(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
break;
|
||||
|
||||
|
||||
//Slopes
|
||||
case 0x50:
|
||||
JudgeHitNpCharTriangleA(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x51:
|
||||
JudgeHitNpCharTriangleB(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x52:
|
||||
JudgeHitNpCharTriangleC(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x53:
|
||||
JudgeHitNpCharTriangleD(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x54:
|
||||
JudgeHitNpCharTriangleE(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x55:
|
||||
JudgeHitNpCharTriangleF(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x56:
|
||||
JudgeHitNpCharTriangleG(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x57:
|
||||
JudgeHitNpCharTriangleH(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
break;
|
||||
|
||||
|
||||
//Water slopes
|
||||
case 0x70:
|
||||
JudgeHitNpCharTriangleA(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x71:
|
||||
JudgeHitNpCharTriangleB(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x72:
|
||||
JudgeHitNpCharTriangleC(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x73:
|
||||
JudgeHitNpCharTriangleD(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x74:
|
||||
JudgeHitNpCharTriangleE(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x75:
|
||||
JudgeHitNpCharTriangleF(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x76:
|
||||
JudgeHitNpCharTriangleG(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x77:
|
||||
JudgeHitNpCharTriangleH(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (gNPC[i].y > gWaterY + 0x800)
|
||||
gNPC[i].flag |= 0x100;
|
||||
}
|
||||
|
@ -418,7 +418,7 @@ void LoseNpChar(NPCHAR *npc, bool bVanish)
|
|||
{
|
||||
//Play death sound
|
||||
PlaySoundObject(npc->destroy_voice, 1);
|
||||
|
||||
|
||||
//Create smoke
|
||||
switch (npc->size)
|
||||
{
|
||||
|
@ -432,13 +432,13 @@ void LoseNpChar(NPCHAR *npc, bool bVanish)
|
|||
SetDestroyNpChar(npc->x, npc->y, npc->view.back, 12);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//Create drop
|
||||
if (npc->exp)
|
||||
{
|
||||
int v3 = Random(1, 5);
|
||||
char v4;
|
||||
|
||||
|
||||
if (v3 == 1)
|
||||
{
|
||||
if (npc->exp <= 6)
|
||||
|
@ -451,10 +451,10 @@ void LoseNpChar(NPCHAR *npc, bool bVanish)
|
|||
SetExpObjects(npc->x, npc->y, npc->exp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Set flag
|
||||
SetNPCFlag(npc->code_flag);
|
||||
|
||||
|
||||
//Create value view
|
||||
if (!(npc->bits & npc_showDamage))
|
||||
{
|
||||
|
@ -493,14 +493,14 @@ void HitNpCharBullet()
|
|||
&& gNPC[n].y - gNPC[n].hit.top < gBul[b].y + gBul[b].blockYL
|
||||
&& gNPC[n].y + gNPC[n].hit.bottom > gBul[b].y - gBul[b].blockYL)
|
||||
bHit = true;
|
||||
|
||||
|
||||
if (bHit)
|
||||
{
|
||||
//Damage NPC
|
||||
if (gNPC[n].bits & npc_shootable)
|
||||
{
|
||||
gNPC[n].life -= gBul[b].damage;
|
||||
|
||||
|
||||
if (gNPC[n].life > 0)
|
||||
{
|
||||
if (gNPC[n].shock < 14)
|
||||
|
@ -511,17 +511,17 @@ void HitNpCharBullet()
|
|||
PlaySoundObject(gNPC[n].hit_voice, 1);
|
||||
gNPC[n].shock = 16;
|
||||
}
|
||||
|
||||
|
||||
if (gNPC[n].bits & npc_showDamage)
|
||||
gNPC[n].damage_view -= gBul[b].damage;
|
||||
}
|
||||
else
|
||||
{
|
||||
gNPC[n].life = 0;
|
||||
|
||||
|
||||
if (gNPC[n].bits & npc_showDamage)
|
||||
gNPC[n].damage_view -= gBul[b].damage;
|
||||
|
||||
|
||||
if ((gMC.cond & 0x80) && gNPC[n].bits & npc_eventDie)
|
||||
StartTextScript(gNPC[n].code_event);
|
||||
else
|
||||
|
@ -542,12 +542,12 @@ void HitNpCharBullet()
|
|||
gBul[b].life = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
--gBul[b].life;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (gNPC[n].cond & 8)
|
||||
LoseNpChar(&gNPC[n], true);
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ bool LoadNpcTable(const char *path)
|
|||
fread(&gNpcTable[n].hit, 4, 1, fp);
|
||||
for (long n = 0; n < num; n++) //view
|
||||
fread(&gNpcTable[n].view, 4, 1, fp);
|
||||
|
||||
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ bool OrganyaNoteAlloc(uint16_t alloc)
|
|||
info.tdata[j].wave_no = 0;
|
||||
info.tdata[j].note_list = NULL;
|
||||
info.tdata[j].note_p = new NOTELIST[alloc];
|
||||
|
||||
|
||||
if(info.tdata[j].note_p == NULL)
|
||||
{
|
||||
for(int i = 0; i < MAXTRACK; i++)
|
||||
|
@ -66,7 +66,7 @@ bool OrganyaNoteAlloc(uint16_t alloc)
|
|||
(info.tdata[j].note_p + i)->y = KEYDUMMY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(int j = 0; j < MAXMELODY; j++)
|
||||
MakeOrganyaWave(j, info.tdata[j].wave_no, info.tdata[j].pipi);
|
||||
//for(int j = 0; j < MAXDRAM; j++)
|
||||
|
@ -119,29 +119,29 @@ bool MakeSoundObject8(int8_t *wavep, int8_t track, int8_t pipi)
|
|||
{
|
||||
size_t wave_size = oct_wave[j].wave_size;
|
||||
size_t data_size = pipi ? wave_size * oct_wave[j].oct_size : wave_size;
|
||||
|
||||
|
||||
//Create sound buffer
|
||||
lpORGANBUFFER[track][j][k] = new SOUNDBUFFER(data_size);
|
||||
|
||||
|
||||
//Get wave data
|
||||
uint8_t *wp = new uint8_t[data_size];
|
||||
uint8_t *wp_sub = wp;
|
||||
size_t wav_tp = 0;
|
||||
|
||||
|
||||
for (size_t i = 0; i < data_size; i++)
|
||||
{
|
||||
uint8_t work = *(wavep+wav_tp);
|
||||
work += 0x80;
|
||||
|
||||
|
||||
*wp_sub = work;
|
||||
|
||||
|
||||
wav_tp += 0x100 / wave_size;
|
||||
if (wav_tp >= 0x100)
|
||||
wav_tp -= 0x100;
|
||||
|
||||
|
||||
wp_sub++;
|
||||
}
|
||||
|
||||
|
||||
//Copy wave data to sound buffer
|
||||
uint8_t *buf;
|
||||
lpORGANBUFFER[track][j][k]->Lock(&buf, NULL);
|
||||
|
@ -151,7 +151,7 @@ bool MakeSoundObject8(int8_t *wavep, int8_t track, int8_t pipi)
|
|||
delete[] wp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ void ChangeOrganFrequency(uint8_t key, int8_t track, int32_t a)
|
|||
}
|
||||
}
|
||||
|
||||
int16_t pan_tbl[13] = {0, 43, 86, 129, 172, 215, 256, 297, 340, 383, 426, 469, 512};
|
||||
int16_t pan_tbl[13] = {0, 43, 86, 129, 172, 215, 256, 297, 340, 383, 426, 469, 512};
|
||||
uint8_t old_key[MAXTRACK] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
|
||||
uint8_t key_on[MAXTRACK] = {0};
|
||||
uint8_t key_twin[MAXTRACK] = {0};
|
||||
|
@ -197,10 +197,10 @@ void PlayOrganObject(uint8_t key, int mode, int8_t track, int32_t freq)
|
|||
lpORGANBUFFER[track][old_key[track] / 12][key_twin[track]]->SetCurrentPosition(0);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 1:
|
||||
break;
|
||||
|
||||
|
||||
case 2:
|
||||
if (old_key[track] != 0xFF)
|
||||
{
|
||||
|
@ -208,7 +208,7 @@ void PlayOrganObject(uint8_t key, int mode, int8_t track, int32_t freq)
|
|||
old_key[track] = 0xFF;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case -1:
|
||||
if (old_key[track] == 0xFF)
|
||||
{
|
||||
|
@ -222,7 +222,7 @@ void PlayOrganObject(uint8_t key, int mode, int8_t track, int32_t freq)
|
|||
lpORGANBUFFER[track][old_key[track] / 12][key_twin[track]]->Play(false);
|
||||
key_twin[track]++;
|
||||
if(key_twin[track] == 2)
|
||||
key_twin[track] = 0;
|
||||
key_twin[track] = 0;
|
||||
lpORGANBUFFER[track][key / 12][key_twin[track]]->Play(true);
|
||||
}
|
||||
else
|
||||
|
@ -230,7 +230,7 @@ void PlayOrganObject(uint8_t key, int mode, int8_t track, int32_t freq)
|
|||
lpORGANBUFFER[track][old_key[track]/12][key_twin[track]]->Play(false);
|
||||
key_twin[track]++;
|
||||
if(key_twin[track] == 2)
|
||||
key_twin[track] = 0;
|
||||
key_twin[track] = 0;
|
||||
ChangeOrganFrequency(key % 12, track, freq);
|
||||
lpORGANBUFFER[track][key / 12][key_twin[track]]->Play(true);
|
||||
old_key[track] = key;
|
||||
|
@ -281,7 +281,7 @@ bool MakeOrganyaWave(int8_t track, int8_t wave_no, int8_t pipi)
|
|||
printf("WARNING: track %d has out-of-range wave_no %d\n", track, wave_no);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
ReleaseOrganyaObject(track);
|
||||
MakeSoundObject8(wave_data[wave_no], track, pipi);
|
||||
return true;
|
||||
|
@ -347,44 +347,44 @@ void OrganyaPlayData()
|
|||
PlayOrganObject(play_np[i]->y,-1,i,info.tdata[i].freq);
|
||||
now_leng[i] = play_np[i]->length;
|
||||
}
|
||||
|
||||
|
||||
if(play_np[i]->pan != PANDUMMY)
|
||||
ChangeOrganPan(play_np[i]->y,play_np[i]->pan, i);
|
||||
if(play_np[i]->volume != VOLDUMMY)
|
||||
gTrackVol[i] = play_np[i]->volume;
|
||||
|
||||
|
||||
play_np[i] = play_np[i]->to;
|
||||
}
|
||||
|
||||
|
||||
if (now_leng[i] == 0 )
|
||||
PlayOrganObject(0, 2, i, info.tdata[i].freq);
|
||||
|
||||
|
||||
if (now_leng[i] > 0)
|
||||
now_leng[i]--;
|
||||
|
||||
|
||||
if (play_np[i])
|
||||
ChangeOrganVolume(play_np[i]->y, gOrgVolume * gTrackVol[i] / 0x7F, i);
|
||||
}
|
||||
|
||||
|
||||
for(int i = MAXMELODY; i < MAXTRACK; i++)
|
||||
{
|
||||
if (play_np[i] != NULL && play_p == play_np[i]->x)
|
||||
{
|
||||
if (play_np[i]->y != KEYDUMMY)
|
||||
PlayDramObject(play_np[i]->y,1,i-MAXMELODY);
|
||||
|
||||
|
||||
if(play_np[i]->pan != PANDUMMY)
|
||||
ChangeDramPan(play_np[i]->pan,i-MAXMELODY);
|
||||
if(play_np[i]->volume != VOLDUMMY)
|
||||
gTrackVol[i] = play_np[i]->volume;
|
||||
|
||||
|
||||
play_np[i] = play_np[i]->to;
|
||||
}
|
||||
|
||||
|
||||
if (play_np[i])
|
||||
ChangeDramVolume(gOrgVolume * gTrackVol[i] / 0x7F, i - MAXMELODY);
|
||||
}
|
||||
|
||||
|
||||
//Looping
|
||||
play_p++;
|
||||
if(play_p >= info.end_x)
|
||||
|
@ -402,7 +402,7 @@ void SetPlayPointer(int32_t x)
|
|||
while (play_np[i] != NULL && play_np[i]->x < x)
|
||||
play_np[i] = play_np[i]->to;
|
||||
}
|
||||
|
||||
|
||||
play_p = x;
|
||||
}
|
||||
|
||||
|
@ -444,14 +444,14 @@ void LoadOrganya(const char *name)
|
|||
printf("Failed to open .org, invalid version %s", pass_check);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//Set song information
|
||||
info.wait = READ_LE16(p);
|
||||
info.line = *p++;
|
||||
info.dot = *p++;
|
||||
info.repeat_x = READ_LE32(p);
|
||||
info.end_x = READ_LE32(p);
|
||||
|
||||
|
||||
for (int i = 0; i < 16; i++) {
|
||||
info.tdata[i].freq = READ_LE16(p);
|
||||
info.tdata[i].wave_no = *p++;
|
||||
|
@ -525,7 +525,7 @@ void LoadOrganya(const char *name)
|
|||
|
||||
//Reset position
|
||||
SetPlayPointer(0);
|
||||
|
||||
|
||||
//Set as loaded
|
||||
info.loaded = true;
|
||||
}
|
||||
|
@ -555,7 +555,7 @@ bool ChangeOrganyaVolume(signed int volume)
|
|||
gOrgVolume = volume;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -563,11 +563,11 @@ void StopOrganyaMusic()
|
|||
{
|
||||
//Stop timer
|
||||
OrganyaEndTimer();
|
||||
|
||||
|
||||
//Stop notes
|
||||
for (int i = 0; i < MAXMELODY; i++)
|
||||
PlayOrganObject(0, 2, i, 0);
|
||||
|
||||
|
||||
memset(old_key, 255, sizeof(old_key));
|
||||
memset(key_on, 0, sizeof(key_on));
|
||||
memset(key_twin, 0, sizeof(key_twin));
|
||||
|
@ -585,21 +585,21 @@ bool bEndTimer = false;
|
|||
int OrganyaPlayTimer(void *ptr)
|
||||
{
|
||||
SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH);
|
||||
|
||||
|
||||
//Set time for next step to play
|
||||
uint32_t NextTick = SDL_GetTicks() + info.wait;
|
||||
|
||||
|
||||
while (bEndTimer == false)
|
||||
{
|
||||
if (info.loaded)
|
||||
{
|
||||
//Play music
|
||||
OrganyaPlayData();
|
||||
|
||||
|
||||
//Wait until this step is over
|
||||
while (NextTick > SDL_GetTicks())
|
||||
SDL_Delay(1);
|
||||
|
||||
|
||||
//Get time for next step to play
|
||||
while (NextTick <= SDL_GetTicks())
|
||||
NextTick += info.wait;
|
||||
|
@ -610,7 +610,7 @@ int OrganyaPlayTimer(void *ptr)
|
|||
SDL_Delay(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -639,10 +639,10 @@ void EndOrganya()
|
|||
{
|
||||
//End timer
|
||||
OrganyaEndTimer();
|
||||
|
||||
|
||||
//Release everything related to org
|
||||
OrganyaReleaseNote();
|
||||
|
||||
|
||||
for (int i = 0; i < MAXMELODY; i++)
|
||||
ReleaseOrganyaObject(i);
|
||||
}
|
||||
|
|
|
@ -31,11 +31,11 @@ bool IsProfile()
|
|||
{
|
||||
char path[PATH_LENGTH];
|
||||
sprintf(path, "%s/%s", gModulePath, gDefaultName);
|
||||
|
||||
|
||||
FILE *fp = fopen(path, "rb");
|
||||
if (fp == NULL)
|
||||
return false;
|
||||
|
||||
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
|
@ -44,19 +44,19 @@ bool SaveProfile(const char *name)
|
|||
{
|
||||
//Get path
|
||||
char path[PATH_LENGTH];
|
||||
|
||||
|
||||
if (name)
|
||||
sprintf(path, "%s/%s", gModulePath, name);
|
||||
else
|
||||
sprintf(path, "%s/%s", gModulePath, gDefaultName);
|
||||
|
||||
|
||||
//Open file
|
||||
PROFILE profile;
|
||||
|
||||
|
||||
FILE *fp = fopen(path, "wb");
|
||||
if (fp == NULL)
|
||||
return false;
|
||||
|
||||
|
||||
//Set up profile
|
||||
memset(&profile, 0, sizeof(PROFILE));
|
||||
memcpy(profile.code, gProfileCode, sizeof(profile.code));
|
||||
|
@ -79,7 +79,7 @@ bool SaveProfile(const char *name)
|
|||
memcpy(profile.permitstage, gPermitStage, sizeof(profile.permitstage));
|
||||
memcpy(profile.permit_mapping, gMapping, sizeof(profile.permit_mapping));
|
||||
memcpy(profile.flags, gFlagNPC, sizeof(profile.flags));
|
||||
|
||||
|
||||
//Write to file
|
||||
fwrite(profile.code, 8, 1, fp);
|
||||
File_WriteLE32(profile.stage, fp);
|
||||
|
@ -114,7 +114,7 @@ bool SaveProfile(const char *name)
|
|||
fwrite(profile.permit_mapping, 0x80, 1, fp);
|
||||
fwrite("FLAG", 4, 1, fp);
|
||||
fwrite(profile.flags, 1000, 1, fp);
|
||||
|
||||
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
|
@ -123,19 +123,19 @@ bool LoadProfile(const char *name)
|
|||
{
|
||||
//Get path
|
||||
char path[PATH_LENGTH];
|
||||
|
||||
|
||||
if (name)
|
||||
strcpy(path, name);
|
||||
else
|
||||
sprintf(path, "%s/%s", gModulePath, gDefaultName);
|
||||
|
||||
|
||||
//Open file
|
||||
PROFILE profile;
|
||||
|
||||
|
||||
FILE *fp = fopen(path, "rb");
|
||||
if (fp == NULL)
|
||||
return false;
|
||||
|
||||
|
||||
//Check header code
|
||||
fread(profile.code, 8, 1, fp);
|
||||
if (memcmp(profile.code, gProfileCode, 8))
|
||||
|
@ -145,7 +145,7 @@ bool LoadProfile(const char *name)
|
|||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//Read data
|
||||
fseek(fp, 0, SEEK_SET); //Pixel epic redundant code 😎😎😎
|
||||
fread(profile.code, 8, 1, fp);
|
||||
|
@ -182,7 +182,7 @@ bool LoadProfile(const char *name)
|
|||
fread(profile.FLAG, 4, 1, fp);
|
||||
fread(profile.flags, 1000, 1, fp);
|
||||
fclose(fp);
|
||||
|
||||
|
||||
//Set things
|
||||
gSelectedArms = profile.select_arms;
|
||||
gSelectedItem = profile.select_item;
|
||||
|
@ -193,13 +193,13 @@ bool LoadProfile(const char *name)
|
|||
memcpy(gPermitStage, profile.permitstage, sizeof(gPermitStage));
|
||||
memcpy(gMapping, profile.permit_mapping, sizeof(gMapping));
|
||||
memcpy(gFlagNPC, profile.flags, sizeof(gFlagNPC));
|
||||
|
||||
|
||||
//Load stage
|
||||
ChangeMusic(profile.music);
|
||||
InitMyChar();
|
||||
if (!TransferStage(profile.stage, 0, 0, 1))
|
||||
return false;
|
||||
|
||||
|
||||
//Set character properties
|
||||
gMC.equip = profile.equip;
|
||||
gMC.unit = profile.unit;
|
||||
|
@ -212,12 +212,12 @@ bool LoadProfile(const char *name)
|
|||
gMC.lifeBr = profile.life;
|
||||
gMC.x = profile.x;
|
||||
gMC.y = profile.y;
|
||||
|
||||
|
||||
gMC.rect_arms.left = 24 * (gArmsData[gSelectedArms].code % 10);
|
||||
gMC.rect_arms.right = gMC.rect_arms.left + 24;
|
||||
gMC.rect_arms.top = 32 * (gArmsData[gSelectedArms].code / 10);
|
||||
gMC.rect_arms.bottom = gMC.rect_arms.top + 16;
|
||||
|
||||
|
||||
//Reset stuff
|
||||
ClearFade();
|
||||
SetFrameMyChar();
|
||||
|
|
|
@ -196,4 +196,4 @@ int StageSelectLoop(int *p_event)
|
|||
while (Flip_SystemTask());
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ void ShootBullet_PoleStar(int level)
|
|||
bul_no = 6;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (CountArmsBullet(2) > 1)
|
||||
return;
|
||||
|
||||
|
@ -150,7 +150,7 @@ void ShootBullet_PoleStar(int level)
|
|||
SetCaret(gMC.x + 0x1800, gMC.y + 0x600, 3, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (level == 3)
|
||||
PlaySoundObject(49, 1);
|
||||
else
|
||||
|
@ -181,7 +181,7 @@ void ShootBullet_FireBall(int level)
|
|||
bul_no = 9;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (gKeyTrg & gKeyShot)
|
||||
{
|
||||
if (!UseArmsEnergy(1))
|
||||
|
@ -229,7 +229,7 @@ void ShootBullet_FireBall(int level)
|
|||
SetCaret(gMC.x + 0x1800, gMC.y + 0x400, 3, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PlaySoundObject(34, 1);
|
||||
}
|
||||
}
|
||||
|
@ -254,10 +254,10 @@ void ShootBullet_Machinegun1(int level)
|
|||
bul_no = 12;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (!(gKey & gKeyShot))
|
||||
gMC.rensha = 6;
|
||||
|
||||
|
||||
if (gKey & gKeyShot)
|
||||
{
|
||||
if (++gMC.rensha < 6)
|
||||
|
@ -268,7 +268,7 @@ void ShootBullet_Machinegun1(int level)
|
|||
if (!UseArmsEnergy(1))
|
||||
{
|
||||
PlaySoundObject(37, 1);
|
||||
|
||||
|
||||
if (empty == 0)
|
||||
{
|
||||
SetCaret(gMC.x, gMC.y, 16, 0);
|
||||
|
@ -283,7 +283,7 @@ void ShootBullet_Machinegun1(int level)
|
|||
{
|
||||
if (level == 3)
|
||||
gMC.ym += 0x100;
|
||||
|
||||
|
||||
if (gMC.direct == 0)
|
||||
{
|
||||
SetBullet(bul_no, gMC.x - 0x600, gMC.y - 0x1000, 1);
|
||||
|
@ -301,7 +301,7 @@ void ShootBullet_Machinegun1(int level)
|
|||
{
|
||||
if (gMC.ym > 0)
|
||||
gMC.ym /= 2;
|
||||
|
||||
|
||||
if (gMC.ym > -0x400)
|
||||
{
|
||||
gMC.ym -= 0x200;
|
||||
|
@ -309,7 +309,7 @@ void ShootBullet_Machinegun1(int level)
|
|||
gMC.ym = -0x400;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (gMC.direct == 0)
|
||||
{
|
||||
SetBullet(bul_no, gMC.x - 0x600, gMC.y + 0x1000, 3);
|
||||
|
@ -334,7 +334,7 @@ void ShootBullet_Machinegun1(int level)
|
|||
SetCaret(gMC.x + 0x1800, gMC.y + 0x600, 3, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (level == 3)
|
||||
PlaySoundObject(49, 1);
|
||||
else
|
||||
|
@ -344,7 +344,7 @@ void ShootBullet_Machinegun1(int level)
|
|||
else
|
||||
{
|
||||
static int wait = 0;
|
||||
|
||||
|
||||
++wait;
|
||||
if (gMC.equip & 8)
|
||||
{
|
||||
|
@ -354,7 +354,7 @@ void ShootBullet_Machinegun1(int level)
|
|||
ChargeArmsEnergy(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if (wait > 4)
|
||||
{
|
||||
|
@ -383,7 +383,7 @@ void ShootBullet_Missile(int level, BOOL bSuper)
|
|||
bul_no = 30;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
switch (level)
|
||||
{
|
||||
case 1:
|
||||
|
@ -413,7 +413,7 @@ void ShootBullet_Missile(int level, BOOL bSuper)
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -429,7 +429,7 @@ void ShootBullet_Missile(int level, BOOL bSuper)
|
|||
bul_no = 15;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
switch (level)
|
||||
{
|
||||
case 1:
|
||||
|
@ -460,7 +460,7 @@ void ShootBullet_Missile(int level, BOOL bSuper)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (gKeyTrg & gKeyShot)
|
||||
{
|
||||
if (level < 3)
|
||||
|
@ -1037,19 +1037,19 @@ void ShootBullet()
|
|||
{
|
||||
if (empty)
|
||||
--empty;
|
||||
|
||||
|
||||
//Only let the player shoot every 4 frames
|
||||
static int soft_rensha;
|
||||
if (soft_rensha)
|
||||
--soft_rensha;
|
||||
|
||||
|
||||
if (gKeyTrg & gKeyShot)
|
||||
{
|
||||
if (soft_rensha)
|
||||
return;
|
||||
soft_rensha = 4;
|
||||
}
|
||||
|
||||
|
||||
//Run functions
|
||||
if (gMC.cond & 2)
|
||||
return;
|
||||
|
|
|
@ -33,28 +33,28 @@ SOUNDBUFFER::SOUNDBUFFER(size_t bufSize)
|
|||
{
|
||||
//Lock audio buffer
|
||||
SDL_LockAudioDevice(audioDevice);
|
||||
|
||||
|
||||
//Set parameters
|
||||
size = bufSize;
|
||||
|
||||
|
||||
playing = false;
|
||||
looping = false;
|
||||
looped = false;
|
||||
|
||||
|
||||
frequency = 0.0;
|
||||
volume = 1.0;
|
||||
volume_l = 1.0;
|
||||
volume_r = 1.0;
|
||||
samplePosition = 0.0;
|
||||
|
||||
|
||||
//Create waveform buffer
|
||||
data = new uint8_t[bufSize];
|
||||
memset(data, 0x80, bufSize);
|
||||
|
||||
|
||||
//Add to buffer list
|
||||
this->next = soundBuffers;
|
||||
soundBuffers = this;
|
||||
|
||||
|
||||
//Unlock audio buffer
|
||||
SDL_UnlockAudioDevice(audioDevice);
|
||||
}
|
||||
|
@ -63,11 +63,11 @@ SOUNDBUFFER::~SOUNDBUFFER()
|
|||
{
|
||||
//Lock audio buffer
|
||||
SDL_LockAudioDevice(audioDevice);
|
||||
|
||||
|
||||
//Free buffer
|
||||
if (data)
|
||||
delete[] data;
|
||||
|
||||
|
||||
//Remove from buffer list
|
||||
for (SOUNDBUFFER **soundBuffer = &soundBuffers; *soundBuffer != NULL; soundBuffer = &(*soundBuffer)->next)
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ SOUNDBUFFER::~SOUNDBUFFER()
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Unlock audio buffer
|
||||
SDL_UnlockAudioDevice(audioDevice);
|
||||
}
|
||||
|
@ -163,25 +163,25 @@ void SOUNDBUFFER::Mix(float *buffer, size_t frames)
|
|||
for (size_t i = 0; i < frames; ++i)
|
||||
{
|
||||
const double freqPosition = frequency / FREQUENCY; //This is added to position at the end
|
||||
|
||||
|
||||
//Get the in-between sample this is (linear interpolation)
|
||||
const float sample1 = ((looped || ((size_t)samplePosition) >= 1) ? data[(size_t)samplePosition] : 128.0f);
|
||||
const float sample2 = ((looping || (((size_t)samplePosition) + 1) < size) ? data[(((size_t)samplePosition) + 1) % size] : 128.0f);
|
||||
|
||||
|
||||
//Interpolate sample
|
||||
const float subPos = (float)std::fmod(samplePosition, 1.0);
|
||||
const float sampleA = sample1 + (sample2 - sample1) * subPos;
|
||||
|
||||
|
||||
//Convert sample to float32
|
||||
const float sampleConvert = (sampleA - 128.0f) / 128.0f;
|
||||
|
||||
|
||||
//Mix
|
||||
*buffer++ += (float)(sampleConvert * volume * volume_l);
|
||||
*buffer++ += (float)(sampleConvert * volume * volume_r);
|
||||
|
||||
|
||||
//Increment position
|
||||
samplePosition += freqPosition;
|
||||
|
||||
|
||||
if (samplePosition >= size)
|
||||
{
|
||||
if (looping)
|
||||
|
@ -211,7 +211,7 @@ void AudioCallback(void *userdata, Uint8 *stream, int len)
|
|||
//Clear stream
|
||||
for (size_t i = 0; i < frames * 2; ++i)
|
||||
buffer[i] = 0.0f;
|
||||
|
||||
|
||||
//Mix sounds to primary buffer
|
||||
for (SOUNDBUFFER *sound = soundBuffers; sound != NULL; sound = sound->next)
|
||||
sound->Mix(buffer, frames);
|
||||
|
@ -224,10 +224,10 @@ bool InitDirectSound()
|
|||
{
|
||||
//Init sound
|
||||
SDL_InitSubSystem(SDL_INIT_AUDIO);
|
||||
|
||||
|
||||
//Open audio device
|
||||
SDL_AudioSpec want, have;
|
||||
|
||||
|
||||
//Set specifications we want
|
||||
SDL_memset(&want, 0, sizeof(want));
|
||||
want.freq = FREQUENCY;
|
||||
|
@ -237,16 +237,16 @@ bool InitDirectSound()
|
|||
want.callback = AudioCallback;
|
||||
|
||||
audioDevice = SDL_OpenAudioDevice(NULL, 0, &want, &have, 0);
|
||||
|
||||
|
||||
if (audioDevice == 0)
|
||||
{
|
||||
printf("Failed to open audio device\nSDL Error: %s\n", SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//Unpause audio device
|
||||
SDL_PauseAudioDevice(audioDevice, 0);
|
||||
|
||||
|
||||
//Start organya
|
||||
StartOrganya();
|
||||
return true;
|
||||
|
@ -256,10 +256,10 @@ void EndDirectSound()
|
|||
{
|
||||
//Quit sub-system
|
||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||
|
||||
|
||||
//Close audio device
|
||||
SDL_CloseAudioDevice(audioDevice);
|
||||
|
||||
|
||||
//End organya
|
||||
EndOrganya();
|
||||
}
|
||||
|
|
16
src/Sound.h
16
src/Sound.h
|
@ -10,31 +10,31 @@ class SOUNDBUFFER
|
|||
public:
|
||||
SOUNDBUFFER(size_t bufSize);
|
||||
~SOUNDBUFFER();
|
||||
|
||||
|
||||
void Release();
|
||||
|
||||
|
||||
void Lock(uint8_t **buffer, size_t *size);
|
||||
void Unlock();
|
||||
|
||||
|
||||
void SetCurrentPosition(uint32_t dwNewPosition);
|
||||
void SetFrequency(uint32_t dwFrequency);
|
||||
void SetVolume(int32_t lVolume);
|
||||
void SetPan(int32_t lPan);
|
||||
void Play(bool bLooping);
|
||||
void Stop();
|
||||
|
||||
|
||||
void Mix(float *buffer, size_t frames);
|
||||
|
||||
|
||||
SOUNDBUFFER *next;
|
||||
|
||||
|
||||
private:
|
||||
uint8_t *data;
|
||||
size_t size;
|
||||
|
||||
|
||||
bool playing;
|
||||
bool looping;
|
||||
bool looped;
|
||||
|
||||
|
||||
double frequency;
|
||||
double volume;
|
||||
double volume_l;
|
||||
|
|
|
@ -133,13 +133,13 @@ BOOL TransferStage(int no, int w, int x, int y)
|
|||
{
|
||||
//Move character
|
||||
SetMyCharPosition(x << 13, y << 13);
|
||||
|
||||
|
||||
BOOL bError = FALSE;
|
||||
|
||||
|
||||
//Get path
|
||||
char path_dir[20];
|
||||
strcpy(path_dir, "Stage");
|
||||
|
||||
|
||||
//Load tileset
|
||||
char path[PATH_LENGTH];
|
||||
sprintf(path, "%s/Prt%s", path_dir, gTMT[no].parts);
|
||||
|
@ -149,7 +149,7 @@ BOOL TransferStage(int no, int w, int x, int y)
|
|||
sprintf(path, "%s/%s.pxa", path_dir, gTMT[no].parts);
|
||||
if (!LoadAttributeData(path))
|
||||
bError = TRUE;
|
||||
|
||||
|
||||
//Load tilemap
|
||||
sprintf(path, "%s/%s.pxm", path_dir, gTMT[no].map);
|
||||
if (!LoadMapData2(path))
|
||||
|
@ -164,24 +164,24 @@ BOOL TransferStage(int no, int w, int x, int y)
|
|||
sprintf(path, "%s/%s.tsc", path_dir, gTMT[no].map);
|
||||
if (!LoadTextScript_Stage(path))
|
||||
bError = TRUE;
|
||||
|
||||
|
||||
//Load background
|
||||
strcpy(path, gTMT[no].back);
|
||||
if (!InitBack(path, gTMT[no].bkType))
|
||||
bError = TRUE;
|
||||
|
||||
|
||||
//Get path
|
||||
strcpy(path_dir, "Npc");
|
||||
|
||||
|
||||
//Load NPC sprite sheets
|
||||
sprintf(path, "%s/Npc%s", path_dir, gTMT[no].npc);
|
||||
if (!ReloadBitmap_File(path, SURFACE_ID_LEVEL_SPRITESET_1))
|
||||
bError = TRUE;
|
||||
|
||||
|
||||
sprintf(path, "%s/Npc%s", path_dir, gTMT[no].boss);
|
||||
if (!ReloadBitmap_File(path, SURFACE_ID_LEVEL_SPRITESET_2))
|
||||
bError = TRUE;
|
||||
|
||||
|
||||
if (bError)
|
||||
{
|
||||
printf("Failed to load stage %d\n", no);
|
||||
|
@ -191,7 +191,7 @@ BOOL TransferStage(int no, int w, int x, int y)
|
|||
{
|
||||
//Load map name
|
||||
ReadyMapName(gTMT[no].name);
|
||||
|
||||
|
||||
StartTextScript(w);
|
||||
SetFrameMyChar();
|
||||
ClearBullet();
|
||||
|
@ -203,7 +203,7 @@ BOOL TransferStage(int no, int w, int x, int y)
|
|||
gStageNo = no;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -270,10 +270,10 @@ void ChangeMusic(int no)
|
|||
gOldPos = GetOrganyaPosition();
|
||||
gOldNo = gMusicNo;
|
||||
StopOrganyaMusic();
|
||||
|
||||
|
||||
//Load .org
|
||||
LoadOrganya(gMusicTable[no]);
|
||||
|
||||
|
||||
//Reset position, volume, and then play the song
|
||||
ChangeOrganyaVolume(100);
|
||||
SetOrganyaPosition(0);
|
||||
|
@ -286,10 +286,10 @@ void ReCallMusic()
|
|||
{
|
||||
//Stop old song
|
||||
StopOrganyaMusic();
|
||||
|
||||
|
||||
//Load .org that was playing before
|
||||
LoadOrganya(gMusicTable[gOldNo]);
|
||||
|
||||
|
||||
//Reset position, volume, and then play the song
|
||||
SetOrganyaPosition(gOldPos);
|
||||
ChangeOrganyaVolume(100);
|
||||
|
|
24
src/Star.cpp
24
src/Star.cpp
|
@ -31,24 +31,24 @@ void InitStar()
|
|||
{
|
||||
//Clear stars
|
||||
memset(star, 0, sizeof(star));
|
||||
|
||||
|
||||
//Position
|
||||
star[0].x = gMC.x;
|
||||
star[0].y = gMC.y;
|
||||
|
||||
|
||||
star[1].x = gMC.x;
|
||||
star[1].y = gMC.y;
|
||||
|
||||
|
||||
star[2].x = gMC.x;
|
||||
star[2].y = gMC.y;
|
||||
|
||||
|
||||
//Speed
|
||||
star[0].xm = 0x400;
|
||||
star[0].ym = -0x200;
|
||||
|
||||
|
||||
star[1].xm = -0x200;
|
||||
star[1].ym = 0x400;
|
||||
|
||||
|
||||
star[2].xm = 0x200;
|
||||
star[2].ym = 0x200;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ void ActStar()
|
|||
static int a;
|
||||
a++;
|
||||
a %= 3;
|
||||
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (i)
|
||||
|
@ -67,7 +67,7 @@ void ActStar()
|
|||
star[i].xm -= 0x80;
|
||||
else
|
||||
star[i].xm += 0x80;
|
||||
|
||||
|
||||
if (star[i - 1].y < star[i].y)
|
||||
star[i].ym -= 0xAA;
|
||||
else
|
||||
|
@ -85,7 +85,7 @@ void ActStar()
|
|||
else
|
||||
star[i].ym += 0xAA;
|
||||
}
|
||||
|
||||
|
||||
if (star[i].xm > 0xA00)
|
||||
star[i].xm = 0xA00;
|
||||
if (star[i].xm < -0xA00)
|
||||
|
@ -105,10 +105,10 @@ void ActStar()
|
|||
star[i].ym = 0xA00;
|
||||
if (star[i].ym < -0xA00)
|
||||
star[i].ym = -0xA00;
|
||||
|
||||
|
||||
star[i].x += star[i].xm;
|
||||
star[i].y += star[i].ym;
|
||||
|
||||
|
||||
if (i < gMC.star && (gMC.equip & 0x80) && (g_GameFlags & 2) && a == i)
|
||||
SetBullet(45, star[a].x, star[a].y, 0);
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ void PutStar(int fx, int fy)
|
|||
{192, 8, 200, 16},
|
||||
{192, 16, 200, 24},
|
||||
};
|
||||
|
||||
|
||||
if (gMC.cond & 2)
|
||||
return;
|
||||
|
||||
|
|
|
@ -10,49 +10,49 @@ struct TEXT_SCRIPT
|
|||
{
|
||||
//Path (reload when exit teleporter menu/inventory)
|
||||
char path[PATH_LENGTH];
|
||||
|
||||
|
||||
//Script buffer
|
||||
int size;
|
||||
char *data;
|
||||
|
||||
|
||||
//Mode (ex. NOD, WAI)
|
||||
signed char mode;
|
||||
|
||||
|
||||
//Flags
|
||||
signed char flags;
|
||||
|
||||
|
||||
//Current positions (read position in buffer, x position in line)
|
||||
unsigned int p_read;
|
||||
unsigned int p_write;
|
||||
|
||||
|
||||
//Current line to write to
|
||||
int line;
|
||||
|
||||
|
||||
//Line y positions
|
||||
int ypos_line[4];
|
||||
|
||||
|
||||
//Event stuff
|
||||
int wait;
|
||||
int wait_next;
|
||||
int next_event;
|
||||
|
||||
|
||||
//Yes/no selected
|
||||
signed char select;
|
||||
|
||||
|
||||
//Current face
|
||||
int face;
|
||||
int face_x;
|
||||
|
||||
|
||||
//Current item
|
||||
int item;
|
||||
int item_y;
|
||||
|
||||
|
||||
//Text rect
|
||||
RECT rcText;
|
||||
|
||||
|
||||
//..?
|
||||
int offsetY;
|
||||
|
||||
|
||||
//NOD cursor blink
|
||||
uint8_t wait_beam;
|
||||
};
|
||||
|
@ -66,4 +66,4 @@ void GetTextScriptPath(char *path);
|
|||
BOOL StartTextScript(int no);
|
||||
void StopTextScript();
|
||||
void PutTextScript();
|
||||
int TextScriptProc();
|
||||
int TextScriptProc();
|
||||
|
|
|
@ -17,7 +17,7 @@ void InitTriangleTable()
|
|||
{
|
||||
gSin[i] = (int)(sin(i * 6.2831998 / 256.0) * 512.0);
|
||||
}
|
||||
|
||||
|
||||
//Tangent
|
||||
for (i = 0; i < 0x21; ++i)
|
||||
{
|
||||
|
@ -118,6 +118,6 @@ uint8_t GetArktan(int x, int y)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
//This was originally some sort of POSIX standard thing? leftover from the linux port
|
||||
//This was originally some sort of POSIX standard thing? leftover from the Linux port
|
||||
|
|
|
@ -38,7 +38,7 @@ void SetValueView(int *px, int *py, int value)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (i == VALUEVIEW_MAX)
|
||||
{
|
||||
index = gVVIndex++;
|
||||
|
@ -55,7 +55,7 @@ void SetValueView(int *px, int *py, int value)
|
|||
gVV[index].value += value;
|
||||
value = gVV[index].value;
|
||||
}
|
||||
|
||||
|
||||
//Get if negative or not
|
||||
if (value < 0)
|
||||
{
|
||||
|
@ -66,10 +66,10 @@ void SetValueView(int *px, int *py, int value)
|
|||
{
|
||||
minus = FALSE;
|
||||
}
|
||||
|
||||
|
||||
//Get width
|
||||
v = value;
|
||||
|
||||
|
||||
if (value > 999)
|
||||
width = 40;
|
||||
else if (value > 99)
|
||||
|
@ -78,7 +78,7 @@ void SetValueView(int *px, int *py, int value)
|
|||
width = 24;
|
||||
else
|
||||
width = 16;
|
||||
|
||||
|
||||
//Set properties
|
||||
gVV[index].flag = TRUE;
|
||||
gVV[index].px = px;
|
||||
|
@ -87,7 +87,7 @@ void SetValueView(int *px, int *py, int value)
|
|||
gVV[index].rect.top = 8 * index;
|
||||
gVV[index].rect.right = 40;
|
||||
gVV[index].rect.bottom = 8 * (index + 1);
|
||||
|
||||
|
||||
RECT rect[20] = {
|
||||
{0, 56, 8, 64},
|
||||
{8, 56, 16, 64},
|
||||
|
@ -110,13 +110,13 @@ void SetValueView(int *px, int *py, int value)
|
|||
{64, 64, 72, 72},
|
||||
{72, 64, 80, 72},
|
||||
};
|
||||
|
||||
|
||||
//Get digits
|
||||
dig[0] = 1;
|
||||
dig[1] = 10;
|
||||
dig[2] = 100;
|
||||
dig[3] = 1000;
|
||||
|
||||
|
||||
for (i = 3; i >= 0; i--)
|
||||
{
|
||||
fig[i] = 0;
|
||||
|
@ -126,20 +126,20 @@ void SetValueView(int *px, int *py, int value)
|
|||
++fig[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sw = FALSE;
|
||||
|
||||
|
||||
RECT rcPlus = {32, 48, 40, 56};
|
||||
RECT rcMinus = {40, 48, 48, 56};
|
||||
|
||||
|
||||
//Draw value
|
||||
CortBox2(&gVV[index].rect, 0x000000, SURFACE_ID_VALUE_VIEW);
|
||||
|
||||
|
||||
if (minus)
|
||||
Surface2Surface(gVV[index].rect.left, gVV[index].rect.top, &rcMinus, SURFACE_ID_VALUE_VIEW, SURFACE_ID_TEXT_BOX);
|
||||
else
|
||||
Surface2Surface(gVV[index].rect.left, gVV[index].rect.top, &rcPlus, SURFACE_ID_VALUE_VIEW, SURFACE_ID_TEXT_BOX);
|
||||
|
||||
|
||||
for (i = 3; i >= 0; i--)
|
||||
{
|
||||
if (sw == FALSE && i != 0 && fig[i] == 0)
|
||||
|
|
Loading…
Add table
Reference in a new issue