ref: f204e14291040b4dc054c83ccf81b3e57257ab15
parent: 243942c0167f4582073749ebdbfc29eaa8755fab
parent: 960fa6f456a85714196c9e77fa2af69b762ec05b
author: Clownacy <Clownacy@users.noreply.github.com>
date: Tue May 7 06:03:00 EDT 2019
Merge pull request #18 from GabrielRavier/fixTrailingSpacesAndAddNewLinesAtEndOfFile Fix trailing spaces and add newlines at end of file
--- a/DoConfig/DoConfig.cpp
+++ b/DoConfig/DoConfig.cpp
@@ -119,7 +119,7 @@
}
if (CharsToLong(config.attack) == 0){
buttonxz->setonly();
- } else {
+ } else {
buttonzx->setonly();
}
if (CharsToLong(config.okay) == 0){
@@ -144,7 +144,7 @@
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,7 +158,7 @@
}
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");
@@ -165,7 +165,7 @@
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");
@@ -172,7 +172,7 @@
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");
@@ -179,7 +179,7 @@
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 @@
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 @@
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();
--- a/src/Back.cpp
+++ b/src/Back.cpp
@@ -101,7 +101,7 @@
{
RECT rect = {0, 0, gBack.partsW, gBack.partsH};
RECT rcSkyFiller = {106, 0, 255, 88};
-
+
switch (gBack.type)
{
case 0:
@@ -111,7 +111,7 @@
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 @@
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 @@
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 @@
PutBitmap4(&grcGame, x, y, &rect, SURFACE_ID_LEVEL_BACKGROUND);
}
break;
-
+
case 6:
case 7:
//Sky
@@ -149,7 +149,7 @@
PutBitmap4(&grcGame, x, y, &rcSkyFiller, SURFACE_ID_LEVEL_BACKGROUND);
}
}
-
+
rect.top = 0;
rect.bottom = 88;
rect.left = 0;
@@ -162,11 +162,11 @@
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;
@@ -173,11 +173,11 @@
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;
@@ -184,11 +184,11 @@
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;
@@ -195,12 +195,12 @@
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 @@
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,28 +247,28 @@
}
}
-
+
//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;
@@ -275,7 +275,7 @@
barRect.right = (barLeft - gFrame.x) >> 9;
barRect.bottom = WINDOW_HEIGHT;
CortBox(&barRect, 0x000000);
-
+
//Top
barRect.left = 0;
barRect.top = 0;
@@ -282,7 +282,7 @@
barRect.right = WINDOW_WIDTH;
barRect.bottom = (barTop - gFrame.y) >> 9;
CortBox(&barRect, 0x000000);
-
+
//Right
barRect.left = (barRight - gFrame.x) >> 9;
barRect.top = 0;
@@ -289,7 +289,7 @@
barRect.right = WINDOW_WIDTH;
barRect.bottom = WINDOW_HEIGHT;
CortBox(&barRect, 0x000000);
-
+
//Bottom
barRect.left = 0;
barRect.top = (barBottom - gFrame.y) >> 9;
--- a/src/Boss.cpp
+++ b/src/Boss.cpp
@@ -48,7 +48,7 @@
else
{
a = 0;
-
+
if (gBoss[b].bits & npc_showDamage && gBoss[b].damage_view)
{
SetValueView(&gBoss[b].x, &gBoss[b].y, gBoss[b].damage_view);
@@ -55,13 +55,13 @@
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 @@
&& 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 @@
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 @@
else
{
PlaySoundObject(gBoss[bos_].destroy_voice, 1);
-
+
switch (gBoss[bos_].size)
{
case 1:
@@ -148,7 +148,7 @@
SetDestroyNpChar(gBoss[bos_].x, gBoss[bos_].y, gBoss[bos_].view.back, 16);
break;
}
-
+
gBoss[bos_].cond = 0;
}
}
@@ -161,12 +161,12 @@
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 @@
code_char = gBoss[0].code_char;
gpBossFuncTbl[code_char]();
-
+
for (bos = 0; bos < BOSS_MAX; bos++)
{
if (gBoss[bos].shock)
@@ -258,7 +258,7 @@
offx[13] = 0;
offx[14] = 1;
offx[15] = 2;
-
+
offy[0] = 0;
offy[1] = 0;
offy[2] = 1;
@@ -275,7 +275,7 @@
offy[13] = -1;
offy[14] = -1;
offy[15] = -1;
-
+
for (b = 0; b < BOSS_MAX; b++)
{
int judg;
@@ -288,7 +288,7 @@
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 @@
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 @@
}
}
}
-}
\ No newline at end of file
+}
--- a/src/BossBallos.cpp
+++ b/src/BossBallos.cpp
@@ -720,4 +720,4 @@
ActBossChar_Body(&gBoss[3]);
ActBossChar_HITAI(&gBoss[4]);
ActBossChar_HARA(&gBoss[5]);
-}
\ No newline at end of file
+}
--- a/src/BossIronH.cpp
+++ b/src/BossIronH.cpp
@@ -209,4 +209,4 @@
{
npc->rect = rc[npc->ani_no];
}
-}
\ No newline at end of file
+}
--- a/src/BossOhm.cpp
+++ b/src/BossOhm.cpp
@@ -23,7 +23,7 @@
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;
--- a/src/BossPress.cpp
+++ b/src/BossPress.cpp
@@ -229,4 +229,4 @@
{
npc->rect = rc[npc->ani_no];
}
-}
\ No newline at end of file
+}
--- a/src/BossTwinD.cpp
+++ b/src/BossTwinD.cpp
@@ -561,4 +561,4 @@
RECT rc = {0, 0, 0, 0};
npc->rect = rc;
-}
\ No newline at end of file
+}
--- a/src/BossX.cpp
+++ b/src/BossX.cpp
@@ -864,4 +864,4 @@
gBoss[11].act_no = 300;
gBoss[12].act_no = 300;
}
-}
\ No newline at end of file
+}
--- a/src/BulHit.cpp
+++ b/src/BulHit.cpp
@@ -30,7 +30,7 @@
&& 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 @@
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 workX;
int workY;
int hit = 0;
-
+
int block[4];
if (bul->bbits & 0x40)
{
@@ -77,10 +77,10 @@
++atrb;
}
}
-
+
workX = (0x10 * x + 8) * 0x200;
workY = (0x10 * y + 8) * 0x200;
-
+
//Left wall
if (block[0] && block[2])
{
@@ -97,7 +97,7 @@
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 @@
if (bul->y - bul->blockYL < workY && bul->x + bul->blockXL > workX + 0x600)
hit |= 2;
}
-
+
//Ground
if (block[2] && block[3])
{
@@ -148,7 +148,7 @@
if (bul->y + bul->blockYL > workY && bul->x + bul->blockXL > workX + 0x600)
hit |= 8;
}
-
+
//Clip
if (bul->bbits & 8)
{
@@ -165,7 +165,7 @@
{
Vanish(bul);
}
-
+
return hit;
}
@@ -323,7 +323,7 @@
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 @@
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 @@
break;
}
}
-
+
gBul[i].flag |= JudgeHitBulletBlock2(x, y, atrb, &gBul[i]);
}
}
--- a/src/Bullet.cpp
+++ b/src/Bullet.cpp
@@ -78,7 +78,7 @@
if (gBul[i].cond & 0x80 && (gBul[i].code_bullet + 2) / 3 == arms_code)
++count;
}
-
+
return count;
}
@@ -90,7 +90,7 @@
if (gBul[i].cond & 0x80 && gBul[i].code_bullet == bullet_code)
++count;
}
-
+
return count;
}
@@ -122,7 +122,7 @@
for (i = 0; i < BULLET_MAX; i++)
{
if (gBul[i].cond & 0x80)
- {
+ {
switch (gBul[i].direct)
{
case 0:
@@ -142,7 +142,7 @@
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 @@
if (bul->act_no == 0)
{
bul->act_no = 1;
-
+
//Set speed
switch (bul->direct)
{
@@ -403,7 +403,7 @@
bul->ym = 0x1000;
break;
}
-
+
//Set hitbox
switch (level)
{
@@ -507,12 +507,12 @@
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 @@
if (bul->act_no == 0)
{
bul->act_no = 1;
-
+
switch (bul->direct)
{
case 0:
@@ -532,17 +532,17 @@
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 @@
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 @@
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 @@
{
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 @@
move = 0x1000;
break;
}
-
+
bul->act_no = 1;
-
+
switch (bul->direct)
{
case 0:
@@ -703,7 +703,7 @@
{
bul->x += bul->xm;
bul->y += bul->ym;
-
+
switch (level)
{
case 1:
@@ -808,7 +808,7 @@
}
static unsigned int inc;
-
+
switch (++inc % 3)
{
case 0:
@@ -945,7 +945,7 @@
{
case 0:
bul->act_no = 1;
-
+
switch (level)
{
case 1:
@@ -958,7 +958,7 @@
bul->act_wait = 5;
break;
}
-
+
PlaySoundObject(44, 1);
// Fallthrough
case 1:
@@ -979,7 +979,7 @@
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 @@
}
return FALSE;
-}
\ No newline at end of file
+}
--- a/src/Caret.cpp
+++ b/src/Caret.cpp
@@ -36,7 +36,7 @@
{80, 24, 88, 32},
{88, 24, 96, 32},
};
-
+
if (!crt->act_no)
{
crt->act_no = 1;
@@ -43,11 +43,11 @@
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;
@@ -54,7 +54,7 @@
if (++crt->ani_no > 3)
crt->cond = 0;
}
-
+
if (crt->direct == 0)
crt->rect = rcLeft[crt->ani_no];
else
@@ -100,7 +100,7 @@
crt->rect = rect_left[crt->ani_no];
break;
-
+
case 2:
if (++crt->ani_wait > 2)
{
@@ -113,7 +113,7 @@
crt->rect = rect_right[crt->ani_no];
break;
-
+
case 1:
crt->rect = rect_up[++crt->ani_wait / 2 % 3];
@@ -132,7 +132,7 @@
{32, 48, 48, 64},
{48, 48, 64, 64},
};
-
+
if (++crt->ani_wait > 2)
{
crt->ani_wait = 0;
@@ -139,7 +139,7 @@
if (++crt->ani_no > 3)
crt->cond = 0;
}
-
+
crt->rect = rect[crt->ani_no];
}
@@ -255,7 +255,7 @@
if (crt->ani_wait == 32)
crt->cond = 0;
-
+
if (crt->direct == 0)
crt->rect = rcLeft;
else
@@ -275,7 +275,7 @@
};
++crt->ani_wait;
-
+
if (crt->direct == 0)
{
if (crt->ani_wait < 20)
@@ -292,7 +292,7 @@
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 @@
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 @@
if (++crt->ani_no > 6)
crt->cond = 0;
}
-
+
crt->rect = rcRight[crt->ani_no];
}
@@ -340,7 +340,7 @@
{112, 0, 144, 32},
{144, 0, 176, 32},
};
-
+
if (++crt->ani_wait > 2)
{
crt->ani_wait = 0;
@@ -347,7 +347,7 @@
if (++crt->ani_no > 1)
crt->cond = 0;
}
-
+
crt->rect = rcLeft[crt->ani_no];
}
@@ -357,11 +357,11 @@
{56, 24, 64, 32},
{0, 0, 0, 0},
};
-
+
if (crt->act_no == 0)
{
crt->act_no = 1;
-
+
switch (crt->direct)
{
case 0:
@@ -368,13 +368,13 @@
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 @@
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;
}
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -15,41 +15,41 @@
{
//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 @@
{
//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;
--- a/src/Draw.cpp
+++ b/src/Draw.cpp
@@ -100,12 +100,12 @@
magnification = 1;
fullscreen = false;
break;
-
+
case 1:
magnification = 2;
fullscreen = false;
break;
-
+
case 2:
magnification = 2;
fullscreen = true;
@@ -112,9 +112,9 @@
SDL_SetWindowFullscreen(gWindow, SDL_WINDOW_FULLSCREEN);
break;
}
-
+
}
-
+
return TRUE;
}
@@ -122,7 +122,7 @@
{
//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 @@
{
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 @@
return TRUE;
}
}
-
+
//Attempt to load BMP
sprintf(path, "%s/%s.bmp", gDataPath, name);
fp = SDL_RWFromFile(path, "rb");
@@ -347,7 +347,7 @@
if (LoadBitmap(fp, surf_no, create_surface))
return TRUE;
}
-
+
printf("Failed to open file %s\n", name);
return FALSE;
}
@@ -356,7 +356,7 @@
{
size_t size;
const unsigned char *data = FindResource(res, "BITMAP", &size);
-
+
if (data)
{
SDL_RWops *fp = SDL_RWFromConstMem(data, size);
@@ -365,7 +365,7 @@
if (LoadBitmap(fp, surf_no, create_surface))
return TRUE;
}
-
+
printf("Failed to open resource %s\n", res);
return FALSE;
}
@@ -443,19 +443,19 @@
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 @@
{
//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;
--- a/src/Ending.cpp
+++ b/src/Ending.cpp
@@ -47,7 +47,7 @@
//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 @@
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 @@
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 @@
free(Credit.pData);
Credit.pData = NULL;
}
-
+
//Open file
char path[PATH_LENGTH];
sprintf(path, "%s/%s", gDataPath, "Credit.tsc");
@@ -190,7 +190,7 @@
// The original game forgot to close the file
fclose(fp);
#endif
-
+
//Reset credits
Credit.offset = 0;
Credit.wait = 0;
@@ -197,7 +197,7 @@
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
@@ -204,7 +204,7 @@
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,7 +230,7 @@
{
//Get character
uint8_t character = Credit.pData[Credit.offset];
-
+
int a, b, len;
switch (character)
{
@@ -237,7 +237,7 @@
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 @@
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,14 +291,14 @@
++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]);
@@ -305,7 +305,7 @@
Credit.offset += 5;
b = GetScriptNumber(&Credit.pData[Credit.offset]);
Credit.offset += 4;
-
+
//If flag is set
if (GetNPCFlag(a))
{
@@ -330,22 +330,22 @@
}
}
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;
@@ -352,7 +352,7 @@
ChangeMusic(a);
return;
}
-
+
//Progress through file
++Credit.offset;
}
@@ -395,19 +395,19 @@
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,7 +417,7 @@
if (escRet == 2)
return 2;
}
-
+
switch (mode)
{
case 0:
@@ -424,7 +424,7 @@
//Move down
sprite.y += 0x33;
break;
-
+
case 1:
if (wait >= 350)
{
@@ -455,7 +455,7 @@
}
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);
@@ -462,12 +462,12 @@
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;
}
--- a/src/Escape.cpp
+++ b/src/Escape.cpp
@@ -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 @@
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 @@
return 0;
}
}
-
+
return 0;
}
--- a/src/Fade.cpp
+++ b/src/Fade.cpp
@@ -47,7 +47,7 @@
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 @@
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 @@
}
}
break;
-
+
case 2:
for (y = 0; y < FADE_HEIGHT; y++)
{
@@ -111,7 +111,7 @@
}
}
break;
-
+
case 1:
for (y = 0; y < FADE_HEIGHT; y++)
{
@@ -122,7 +122,7 @@
}
}
break;
-
+
case 3:
for (y = 0; y < FADE_HEIGHT; y++)
{
@@ -133,7 +133,7 @@
}
}
break;
-
+
case 4:
for (y = 0; y < (FADE_HEIGHT / 2); y++)
{
@@ -169,7 +169,7 @@
}
break;
}
-
+
for (y = 0; y < FADE_HEIGHT; y++)
{
for (x = 0; x < FADE_WIDTH; x++)
@@ -178,7 +178,7 @@
++gFade.ani_no[y][x];
}
}
-
+
if (++gFade.count > ((FADE_WIDTH > FADE_HEIGHT) ? FADE_WIDTH : FADE_HEIGHT) + 16)
{
gFade.bMask = TRUE;
@@ -189,7 +189,7 @@
case 1:
gFade.bMask = FALSE;
-
+
switch (gFade.dir)
{
case 0:
@@ -202,7 +202,7 @@
}
}
break;
-
+
case 2:
for (y = 0; y < FADE_HEIGHT; y++)
{
@@ -213,7 +213,7 @@
}
}
break;
-
+
case 1:
for (y = 0; y < FADE_HEIGHT; y++)
{
@@ -224,7 +224,7 @@
}
}
break;
-
+
case 3:
for (y = 0; y < FADE_HEIGHT; y++)
{
@@ -235,7 +235,7 @@
}
}
break;
-
+
case 4:
for (y = 0; y < (FADE_HEIGHT / 2); y++)
{
@@ -271,7 +271,7 @@
}
break;
}
-
+
for (y = 0; y < FADE_HEIGHT; y++)
{
for (x = 0; x < FADE_WIDTH; x++)
@@ -280,7 +280,7 @@
--gFade.ani_no[y][x];
}
}
-
+
if (++gFade.count > ((FADE_WIDTH > FADE_HEIGHT) ? FADE_WIDTH : FADE_HEIGHT) + 16)
gFade.mode = 0;
@@ -293,7 +293,7 @@
RECT rect;
rect.top = 0;
rect.bottom = 16;
-
+
if (gFade.bMask)
{
CortBox(&grcGame, mask_color);
--- a/src/Frame.cpp
+++ b/src/Frame.cpp
@@ -121,10 +121,10 @@
//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 @@
//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)
--- a/src/Game.cpp
+++ b/src/Game.cpp
@@ -60,7 +60,7 @@
{
//Define rects
RECT rcClient = grcFull;
-
+
RECT rect[10] = {
{0, 56, 8, 64},
{8, 56, 16, 64},
@@ -73,14 +73,14 @@
{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,7 +88,7 @@
{
//Get the digit that this is
int a = 0;
-
+
while (tbl[offset] <= value)
{
value -= tbl[offset];
@@ -95,11 +95,11 @@
++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 @@
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 @@
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 @@
if (escRet == 2)
return 1;
}
-
+
//Skip intro if OK is pressed
if (gKey & gKeyOk)
break;
-
+
//Update everything
ActNpChar();
ActBossChar();
@@ -166,10 +166,10 @@
ActCaret();
MoveFrame3();
ProcFade();
-
+
//Draw everything
CortBox(&grcFull, 0x000000);
-
+
int frame_x, frame_y;
GetFramePosition(&frame_x, &frame_y);
PutBack(frame_x, frame_y);
@@ -181,7 +181,7 @@
PutFront(frame_x, frame_y);
PutCaret(frame_x, frame_y);
PutFade();
-
+
//Update Text Script
int tscRet = TextScriptProc();
if (tscRet == 0)
@@ -188,17 +188,17 @@
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 @@
//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,7 +236,7 @@
{0, 112, 16, 128},
{32, 112, 48, 128},
};
-
+
RECT rcToroko[4] = {
{64, 80, 80, 96},
{80, 80, 96, 96},
@@ -243,7 +243,7 @@
{64, 80, 80, 96},
{96, 80, 112, 96},
};
-
+
RECT rcKing[4] = {
{224, 48, 240, 64},
{288, 48, 304, 64},
@@ -250,7 +250,7 @@
{224, 48, 240, 64},
{304, 48, 320, 64},
};
-
+
RECT rcSu[4] = {
{0, 16, 16, 32},
{32, 16, 48, 32},
@@ -257,24 +257,24 @@
{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 @@
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 @@
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,19 +313,19 @@
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)
{
@@ -332,7 +332,7 @@
if (gKeyTrg & gKeyOk)
break;
}
-
+
if (gKey & KEY_ESCAPE)
{
int escRet = Call_Escape();
@@ -341,7 +341,7 @@
if (escRet == 2)
return 1;
}
-
+
//Move cursor
if ((gKeyDown | gKeyUp) & gKeyTrg)
{
@@ -348,21 +348,21 @@
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);
@@ -369,17 +369,17 @@
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 @@
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 @@
if (!Flip_SystemTask())
return 0;
}
-
+
return 3;
}
@@ -448,12 +448,12 @@
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,7 +468,7 @@
StartMapping();
InitFlags();
InitBossLife();
-
+
if ((bContinue && LoadProfile(NULL)) || InitializeGame())
{
while (true)
@@ -475,7 +475,7 @@
{
//Get pressed keys
GetTrg();
-
+
//Escape menu
if (gKey & KEY_ESCAPE)
{
@@ -485,7 +485,7 @@
if (escRet == 2)
return 1;
}
-
+
if (swPlay & 1 && g_GameFlags & 1)
{
if (g_GameFlags & 2)
@@ -492,7 +492,7 @@
ActMyChar(true);
else
ActMyChar(false);
-
+
ActStar();
ActNpChar();
ActBossChar();
@@ -513,13 +513,13 @@
ActCaret();
MoveFrame3();
ActFlash(frame_x, frame_y);
-
+
if (g_GameFlags & 2)
AnimationMyChar(true);
else
AnimationMyChar(false);
}
-
+
if (g_GameFlags & 8)
{
ActionCredit();
@@ -526,7 +526,7 @@
ActionIllust();
ActionStripper();
}
-
+
ProcFade();
CortBox(&grcFull, color);
GetFramePosition(&frame_x, &frame_y);
@@ -545,7 +545,7 @@
PutValueView(frame_x, frame_y);
PutBossLife();
PutFade();
-
+
if (!(g_GameFlags & 4))
{
//Open inventory
@@ -552,7 +552,7 @@
if (gKeyTrg & gKeyItem)
{
BackupSurface(SURFACE_ID_SCREEN_GRAB, &grcGame);
-
+
switch (CampLoop())
{
case 0:
@@ -560,13 +560,13 @@
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 @@
}
}
}
-
+
if (g_GameFlags & 2)
{
if (gKeyTrg & gKeyArms)
@@ -593,10 +593,10 @@
if (tscRet == 2)
return 1;
}
-
+
PutMapName(false);
PutTimeCounter(16, 8);
-
+
if (g_GameFlags & 2)
{
PutMyLife(true);
@@ -604,15 +604,15 @@
PutMyAir((WINDOW_WIDTH - 80) / 2, (WINDOW_HEIGHT - 32) / 2);
PutActiveArmsList();
}
-
+
if (g_GameFlags & 8)
{
PutIllust();
PutStripper();
}
-
+
PutTextScript();
-
+
PutFramePerSecound();
if (!Flip_SystemTask())
break;
@@ -619,7 +619,7 @@
++gCounter;
}
}
-
+
return 0;
}
@@ -629,7 +629,7 @@
{
char path[PATH_LENGTH];
sprintf(path, "%s/npc.tbl", gDataPath);
-
+
if (LoadNpcTable(path))
{
InitTextScript2();
@@ -636,7 +636,7 @@
InitSkipFlags();
InitMapData2();
InitCreditScript();
-
+
int mode = 1;
while (mode)
{
@@ -647,7 +647,7 @@
if (mode == 3)
mode = ModeAction();
}
-
+
EndMapData();
EndTextScript();
ReleaseNpcTable();
@@ -658,6 +658,6 @@
return false;
}
}
-
+
return true;
-}
\ No newline at end of file
+}
--- a/src/Generic.cpp
+++ b/src/Generic.cpp
@@ -34,7 +34,7 @@
{
char path[PATH_LENGTH];
sprintf(path, "%s/%s", gModulePath, name);
-
+
FILE *file = fopen(path, "rb");
if (file)
{
@@ -41,7 +41,7 @@
fclose(file);
return true;
}
-
+
return false;
}
--- a/src/GenericLoad.cpp
+++ b/src/GenericLoad.cpp
@@ -160,7 +160,7 @@
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 @@
bError = TRUE;
if (!MakeSurface_File("Fade", SURFACE_ID_FADE))
bError = TRUE;
-
+
MakeSurface_Resource("CREDIT01", SURFACE_ID_CREDITS_IMAGE);
-
+
if (bError)
{
return FALSE;
--- a/src/Input.cpp
+++ b/src/Input.cpp
@@ -31,16 +31,16 @@
{
//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 @@
{
//Clear status
memset(pStatus, 0, sizeof(JOYSTICK_STATUS));
-
+
if (joystick)
{
int32_t x = SDL_JoystickGetAxis(joystick, 0);
@@ -57,17 +57,17 @@
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;
}
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -78,10 +78,10 @@
base_tick = SDL_GetTicks();
need_new_base_tick = false;
}
-
+
current_tick = SDL_GetTicks();
++current_frame;
-
+
if ( base_tick + 1000 <= current_tick )
{
base_tick += 1000;
@@ -88,7 +88,7 @@
frames_this_second = current_frame;
current_frame = 0;
}
-
+
return frames_this_second;
}
@@ -98,7 +98,7 @@
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 @@
{
//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 @@
gKeyJump = KEY_Z;
gKeyShot = KEY_X;
}
-
+
//Swap Okay and Cancel buttons
if (config.ok_button_mode)
{
@@ -148,7 +148,7 @@
gKeyOk = gKeyJump;
gKeyCancel = gKeyShot;
}
-
+
//Swap left and right weapon switch keys
if (CheckFileExists("s_reverse"))
{
@@ -155,7 +155,7 @@
gKeyArms = KEY_ARMSREV;
gKeyArmsRev = KEY_ARMS;
}
-
+
//Alternate movement keys
if (config.move_button_mode)
{
@@ -174,7 +174,7 @@
gKeyRight = KEY_RIGHT;
gKeyDown = KEY_DOWN;
}
-
+
//Set gamepad inputs
for (int i = 0; i < 8; i++)
{
@@ -183,38 +183,38 @@
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 windowWidth;
int windowHeight;
int colourDepth;
-
+
switch (config.display_mode)
{
case 1:
@@ -256,10 +256,10 @@
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,9 +268,9 @@
StartDirectDraw(1, 0);
break;
}
-
+
break;
-
+
case 0:
case 3:
case 4:
@@ -277,10 +277,10 @@
//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,9 +296,9 @@
colourDepth = 32;
break;
}
-
+
StartDirectDraw(2, colourDepth);
-
+
fullscreen = true;
SDL_ShowCursor(0);
break;
@@ -305,21 +305,21 @@
}
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,20 +341,20 @@
//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())
{
@@ -361,14 +361,14 @@
ResetJoystickStatus();
gbUseJoystick = true;
}
-
+
//Initialize stuff
InitTextObject(config.font_name);
InitTriangleTable();
-
+
//Run game code
Game();
-
+
//End stuff
EndDirectSound();
EndTextObject();
@@ -381,7 +381,7 @@
SDL_Quit();
return -1;
}
-
+
SDL_Quit();
return 0;
}
@@ -394,7 +394,7 @@
StopOrganyaMusic();
SleepNoise();
}
-
+
PlaySoundObject(7, 0);
}
@@ -414,12 +414,12 @@
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 @@
gKey |= gKeyUp;
if (status.bDown)
gKey |= gKeyDown;
-
+
//Set held buttons
for (int i = 0; i < 8; i++)
{
@@ -450,18 +450,18 @@
{
//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 @@
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 @@
case SDL_SCANCODE_SEMICOLON:
DO_KEY_PRESS(KEY_PLUS)
-
+
case SDL_SCANCODE_F5:
gbUseJoystick = false;
break;
@@ -621,7 +621,7 @@
case SDLK_SEMICOLON:
DO_KEY_PRESS(KEY_PLUS)
-
+
case SDLK_F5:
gbUseJoystick = false;
break;
@@ -630,10 +630,10 @@
#endif
}
}
-
+
//Run joystick code
if (gbUseJoystick)
JoystickProc();
-
+
return true;
}
--- a/src/MapName.cpp
+++ b/src/MapName.cpp
@@ -78,10 +78,10 @@
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 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);
--- a/src/MiniMap.cpp
+++ b/src/MiniMap.cpp
@@ -29,7 +29,7 @@
{242, 24, 243, 25},
{243, 24, 244, 25},
};
-
+
for (x = 0; x < gMap.width; x++)
{
a = GetAttribute(x, line);
@@ -84,12 +84,12 @@
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 @@
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 @@
PutMapName(true);
CortBox(&rcView, 0);
-
+
PutFramePerSecound();
if (!Flip_SystemTask())
return 0;
}
-
+
RECT rcMiniMap;
rcMiniMap.left = 0;
rcMiniMap.right = gMap.width;
@@ -125,16 +125,16 @@
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 @@
return 2;
}
}
-
+
PutBitmap4(&grcGame, 0, 0, &grcGame, SURFACE_ID_SCREEN_GRAB);
CortBox(&rcView, 0);
-
+
if (line < gMap.length)
{
WriteMiniMapLine(line);
@@ -161,17 +161,17 @@
}
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();
--- a/src/MyChar.cpp
+++ b/src/MyChar.cpp
@@ -87,7 +87,7 @@
else if (gKey & gKeyUp && (gKeyRight | gKeyLeft) & gKey && bKey)
{
gMC.cond |= 4;
-
+
if (++gMC.ani_wait > 4)
{
gMC.ani_wait = 0;
@@ -94,7 +94,7 @@
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;
}
@@ -101,7 +101,7 @@
else if ((gKeyRight | gKeyLeft) & gKey && bKey)
{
gMC.cond |= 4;
-
+
if (++gMC.ani_wait > 4)
{
gMC.ani_wait = 0;
@@ -108,7 +108,7 @@
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 @@
{
if (gMC.cond & 4)
PlaySoundObject(24, 1);
-
+
gMC.cond &= ~4;
gMC.ani_no = 5;
}
@@ -124,7 +124,7 @@
{
if (gMC.cond & 4)
PlaySoundObject(24, 1);
-
+
gMC.cond &= ~4;
gMC.ani_no = 0;
}
@@ -145,7 +145,7 @@
{
gMC.ani_no = 1;
}
-
+
if (gMC.direct)
gMC.rect = rcRight[gMC.ani_no];
else
@@ -170,13 +170,13 @@
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 @@
{
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 @@
(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 @@
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 @@
int dash1;
int dash2;
int resist;
-
+
if (gMC.flag & 0x100)
{
max_dash = 0x196;
@@ -273,20 +273,20 @@
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 @@
{
gMC.boost_cnt = 0;
}
-
+
//Move in direction held
if (bKey)
{
@@ -311,7 +311,7 @@
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 @@
gMC.ques = 1;
}
}
-
+
//Friction
if (!(gMC.cond & 0x20))
{
@@ -358,7 +358,7 @@
if (gMC.ym > 0x100)
gMC.ym /= 2;
}
-
+
//Booster 2.0
if (gMC.equip & 0x20)
{
@@ -394,19 +394,19 @@
}
}
}
-
+
//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,12 +415,12 @@
else if (gMC.boost_sw == 2)
gMC.ym /= 2;
}
-
+
//Stop boosting
if (!gMC.boost_cnt || !(gKey & gKeyJump))
gMC.boost_sw = 0;
}
-
+
//Jumping
if ( bKey )
{
@@ -427,7 +427,7 @@
//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 @@
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 @@
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 @@
//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 @@
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 @@
{
//Move upwards
gMC.ym -= 0x20;
-
+
//Boost particles (and sound)
if (gKeyTrg & gKeyJump || gMC.boost_cnt % 3 == 1)
{
@@ -510,13 +510,13 @@
{
//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 @@
{
gMC.ym += gravity1;
}
-
+
//Keep player on slopes
if (bKey && !(gKeyTrg & gKeyJump))
{
@@ -546,7 +546,7 @@
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 @@
if (gMC.ym > 0x2FF)
gMC.ym = 0x2FF;
}
-
+
//Water splashing
if (!gMC.sprash && gMC.flag & 0x100)
{
@@ -579,7 +579,7 @@
dir = 2;
else
dir = 0;
-
+
if (gMC.flag & 8 || gMC.ym <= 0x200)
{
if (gMC.xm > 0x200 || gMC.xm < -0x200)
@@ -586,7 +586,7 @@
{
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 @@
{
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 @@
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 @@
{
//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 @@
{
gMC.air = 1000;
}
-
+
if ( gMC.flag & 0x100 )
{
gMC.air_get = 60;
@@ -830,7 +830,7 @@
{
if (gMC.exp_wait)
--gMC.exp_wait;
-
+
if (gMC.shock)
{
--gMC.shock;
@@ -840,7 +840,7 @@
SetValueView(&gMC.x, &gMC.y, gMC.exp_count);
gMC.exp_count = 0;
}
-
+
switch (gMC.unit)
{
case 0:
@@ -848,15 +848,15 @@
AirProcess();
ActMyChar_Normal(bKey);
break;
-
+
case 1:
ActMyChar_Stream(bKey);
break;
-
+
default:
break;
}
-
+
gMC.cond &= ~0x20;
}
}
@@ -904,16 +904,16 @@
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 @@
}
break;
}
-
+
gMC.xm = 0;
AnimationMyChar(false);
}
@@ -959,7 +959,7 @@
{
noise_freq = freq;
noise_no = no;
-
+
if (no == 1)
{
ChangeSoundFrequency(40, noise_freq);
@@ -1001,4 +1001,4 @@
PlaySoundObject(40, 0);
PlaySoundObject(41, 0);
PlaySoundObject(58, 0);
-}
\ No newline at end of file
+}
--- a/src/MycHit.cpp
+++ b/src/MycHit.cpp
@@ -34,7 +34,7 @@
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 @@
{
//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 @@
{
//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 @@
{
//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,17 +100,17 @@
{
//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;
}
@@ -117,7 +117,7 @@
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,17 +125,17 @@
{
//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;
}
@@ -142,7 +142,7 @@
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,17 +150,17 @@
{
//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;
}
@@ -167,7 +167,7 @@
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,17 +175,17 @@
{
//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;
}
@@ -192,7 +192,7 @@
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,17 +200,17 @@
{
//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;
}
@@ -217,7 +217,7 @@
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,17 +225,17 @@
{
//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;
}
@@ -242,7 +242,7 @@
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,17 +250,17 @@
{
//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;
}
@@ -267,7 +267,7 @@
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,17 +275,17 @@
{
//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;
}
@@ -292,7 +292,7 @@
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,17 +300,17 @@
{
//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;
}
@@ -317,13 +317,13 @@
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;
}
@@ -330,13 +330,13 @@
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;
}
@@ -343,13 +343,13 @@
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 @@
&& 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 @@
&& 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 @@
&& 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 @@
&& 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 @@
{
int x = gMC.x / 0x2000;
int y = gMC.y / 0x2000;
-
+
int offy[4];
int offx[4];
offx[0] = 0;
@@ -416,12 +416,12 @@
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
@@ -428,7 +428,7 @@
case 0x02:
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
break;
-
+
//Block
case 0x05:
case 0x41:
@@ -436,144 +436,144 @@
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 @@
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 @@
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 @@
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 @@
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 @@
&& gMC.y - 0x400 < npc->y + npc->hit.bottom)
return 1;
}
-
+
return 0;
}
@@ -660,28 +660,28 @@
//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 @@
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 @@
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 @@
}
}
}
-
+
return hit;
}
@@ -754,7 +754,7 @@
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 @@
{
hit = JudgeHitMyCharNPC3(&gNPC[i]);
}
-
+
//Special NPCs (pickups)
if (hit && gNPC[i].code_char == 1)
{
@@ -781,7 +781,7 @@
AddExpMyChar(gNPC[i].exp);
gNPC[i].cond = 0;
}
-
+
if (hit && gNPC[i].code_char == 86)
{
PlaySoundObject(42, 1);
@@ -788,7 +788,7 @@
AddBulletMyChar(gNPC[i].code_event, gNPC[i].exp);
gNPC[i].cond = 0;
}
-
+
if (hit && gNPC[i].code_char == 87)
{
PlaySoundObject(20, 1);
@@ -795,11 +795,11 @@
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 @@
DamageMyChar(gNPC[i].damage);
}
}
-
+
//Interaction
if (!(g_GameFlags & 4) && hit && gMC.cond & 1 && gNPC[i].bits & npc_interact)
{
@@ -829,7 +829,7 @@
}
}
}
-
+
//Create question mark when NPC hasn't been interacted with
if (gMC.ques)
SetCaret(gMC.x, gMC.y, 9, 0);
@@ -859,13 +859,13 @@
{
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 @@
{
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 @@
}
}
}
-
+
if (gMC.ques)
SetCaret(gMC.x, gMC.y, 9, 0);
}
-}
\ No newline at end of file
+}
--- a/src/MycParam.cpp
+++ b/src/MycParam.cpp
@@ -41,15 +41,15 @@
{
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,7 +65,7 @@
{
++gArmsData[gSelectedArms].level;
gArmsData[gSelectedArms].exp = 0;
-
+
if (gArmsData[gSelectedArms].code != 13)
{
PlaySoundObject(27, 1);
@@ -72,11 +72,11 @@
SetCaret(gMC.x, gMC.y, 10, 0);
}
}
-
+
++lv;
}
}
-
+
if (gArmsData[gSelectedArms].code == 13)
{
gMC.exp_wait = 10;
@@ -111,17 +111,17 @@
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 @@
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 @@
break;
}
}
-
+
//Super Missile Launcher
for (int a = 0; a < ARMS_MAX; a++)
{
@@ -209,12 +209,12 @@
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,7 +226,7 @@
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))
{
@@ -233,19 +233,19 @@
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)
@@ -252,7 +252,7 @@
rcExpVal.right += 40 * exp_now / exp_next;
else
rcExpVal.right = 0;
-
+
PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpVal, SURFACE_ID_TEXT_BOX);
}
else
@@ -259,7 +259,7 @@
{
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,7 +272,7 @@
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++)
@@ -279,7 +279,7 @@
{
//Get X position to draw at
int x = 16 * (a - gSelectedArms) + gArmsEnergyX;
-
+
if (x >= 8)
{
if (x >= 24)
@@ -289,12 +289,12 @@
{
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 @@
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 @@
//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 @@
{
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 @@
{
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 @@
//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,18 +421,18 @@
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];
@@ -439,7 +439,7 @@
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 @@
//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 @@
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 @@
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])
{
--- a/src/NpChar.cpp
+++ b/src/NpChar.cpp
@@ -197,10 +197,10 @@
break;
++n;
}
-
+
if (n == NPC_MAX)
break;
-
+
memset(&gNPC[n], 0, sizeof(NPCHAR));
if (exp < 20)
@@ -389,7 +389,7 @@
gNPC[n].ani_wait = 0;
gNPC[n].xm = 0;
gNPC[n].ym = 0;
-
+
if (dir != 5)
{
if (dir == 4)
@@ -404,7 +404,7 @@
gNPC[n].direct = dir;
}
}
-
+
gpNpcFuncTbl[code_char](&gNPC[n]);
}
}
@@ -431,7 +431,7 @@
gNPC[n].ani_wait = 0;
gNPC[n].xm = 0;
gNPC[n].ym = 0;
-
+
if (dir != 5)
{
if (dir == 4)
@@ -446,7 +446,7 @@
gNPC[n].direct = dir;
}
}
-
+
gpNpcFuncTbl[code_char](&gNPC[n]);
}
}
@@ -459,7 +459,7 @@
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 @@
{
gNPC[n].x = x;
gNPC[n].y = y;
-
+
if (dir != 5)
{
if (dir == 4)
@@ -511,7 +511,7 @@
{
gMC.cond &= ~1;
gMC.ym = -0x200;
-
+
if (code_event)
{
if (code_event == 2)
@@ -566,11 +566,11 @@
{
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 @@
if ((gNPC[i].cond & 0x80) && gNPC[i].code_char == code)
return TRUE;
}
-
+
return FALSE;
}
@@ -612,7 +612,7 @@
if ((gNPC[i].cond & 0x80) && gNPC[i].code_event == code_event)
return TRUE;
}
-
+
return FALSE;
}
@@ -624,6 +624,6 @@
if (gNPC[n].cond & 0x80)
++count;
}
-
+
return count;
}
--- a/src/NpcAct000.cpp
+++ b/src/NpcAct000.cpp
@@ -542,25 +542,25 @@
{
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)
{
@@ -567,10 +567,10 @@
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 @@
npc->direct = 2;
}
break;
-
+
case 2:
//Wait 60 frames then move to the right
if (++npc->act_wait > 60)
@@ -591,19 +591,19 @@
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)
{
@@ -610,10 +610,10 @@
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 @@
npc->direct = 0;
}
break;
-
+
case 4:
//Wait 60 frames then move to the left
if (++npc->act_wait > 60)
@@ -635,7 +635,7 @@
}
break;
}
-
+
//Set framerect
if (npc->direct == 0)
npc->rect = rcLeft[npc->ani_no];
--- a/src/NpcAct040.cpp
+++ b/src/NpcAct040.cpp
@@ -93,7 +93,7 @@
npc->ani_no = 6;
break;
}
-
+
if (npc->direct == 0)
npc->rect = rcLeft[npc->ani_no];
else
@@ -825,17 +825,17 @@
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,7 +845,7 @@
{288, 104, 304, 120},
{304, 104, 320, 120},
};
-
+
if (++npc->ani_wait > 2)
{
npc->ani_wait = 0;
@@ -852,13 +852,13 @@
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
--- a/src/NpcAct120.cpp
+++ b/src/NpcAct120.cpp
@@ -577,7 +577,7 @@
if (++npc->ani_no > 2)
npc->cond = 0;
}
-
+
if (npc->direct == 0)
npc->rect = rcH[npc->ani_no];
else
@@ -618,11 +618,11 @@
{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 @@
npc->view.top = 0x800;
}
}
-
+
if (++npc->ani_no > 4)
npc->cond = 0;
-
+
switch (npc->direct)
{
case 0:
@@ -678,7 +678,7 @@
{0xC0, 0x50, 0xD0, 0x60},
{0xD0, 0x50, 0xE0, 0x60},
};
-
+
if (++npc->ani_wait > 1)
{
npc->ani_wait = 0;
@@ -685,9 +685,9 @@
if (++npc->ani_no > 2)
npc->cond = 0;
}
-
+
npc->y += npc->ym;
-
+
npc->rect = rect[3 * npc->direct + npc->ani_no];
}
--- a/src/NpcAct140.cpp
+++ b/src/NpcAct140.cpp
@@ -1115,13 +1115,13 @@
{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 @@
if (npc->ani_no > 6)
npc->ani_no = 3;
-
+
if (npc->direct == 0)
npc->x -= 0x200;
else
@@ -1202,7 +1202,7 @@
npc->x += 0x100;
else
npc->x -= 0x100;
-
+
if (++npc->ani_wait > 8)
{
npc->ani_wait = 0;
@@ -1250,12 +1250,12 @@
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 @@
if (npc->act_wait / 2 % 2)
++npc->rect.left;
}
-
+
if (gMC.equip & 0x40)
{
npc->rect.top += 32;
--- a/src/NpcAct180.cpp
+++ b/src/NpcAct180.cpp
@@ -573,7 +573,7 @@
{64, 64, 96, 96},
{32, 64, 64, 96},
};
-
+
switch (npc->act_no)
{
case 0:
@@ -618,16 +618,16 @@
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 @@
{80, 48, 96, 64},
{64, 48, 80, 64},
};
-
+
switch (npc->act_no)
{
case 0:
@@ -717,16 +717,16 @@
++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 @@
{192, 32, 208, 48},
{208, 32, 224, 48},
};
-
+
switch (npc->act_no)
{
case 0:
@@ -984,7 +984,7 @@
npc->ani_no = 0;
break;
}
-
+
npc->rect = rect[npc->ani_no];
}
@@ -1067,7 +1067,7 @@
npc->y += npc->ym;
break;
}
-
+
gWaterY = npc->y;
npc->rect.right = 0;
npc->rect.bottom = 0;
--- a/src/NpcAct260.cpp
+++ b/src/NpcAct260.cpp
@@ -1086,7 +1086,7 @@
if (npc->act_no >= 512)
{
-
+
}
else
{
@@ -1095,7 +1095,7 @@
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 @@
npc->x += npc->xm;
npc->y += npc->ym;
-
+
switch (npc->code_event)
{
case 200:
--- a/src/NpcAct280.cpp
+++ b/src/NpcAct280.cpp
@@ -1475,7 +1475,7 @@
{32, 96, 104, 0x80},
{104, 96, 144, 0x80},
};
-
+
switch (npc->act_no)
{
case 0:
--- a/src/NpcAct300.cpp
+++ b/src/NpcAct300.cpp
@@ -150,7 +150,7 @@
break;
}
}
-
+
if (i == 0x200)
{
npc->cond = 0;
@@ -181,7 +181,7 @@
{216, 168, 232, 184},
{232, 168, 248, 184},
};
-
+
if (npc->pNpc == NULL)
return;
@@ -198,12 +198,12 @@
}
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 @@
{48, 176, 72, 192},
{72, 176, 96, 192},
};
-
+
switch (npc->act_no)
{
case 0:
@@ -243,7 +243,7 @@
npc->ani_wait = 0;
++npc->ani_no;
}
-
+
if (npc->ani_no > 3)
npc->ani_no = 2;
break;
@@ -250,7 +250,7 @@
default:
break;
}
-
+
npc->rect = rc[npc->ani_no];
}
@@ -266,7 +266,7 @@
{160, 160, 176, 176},
{176, 160, 192, 176},
};
-
+
switch (npc->act_no)
{
case 0:
@@ -274,7 +274,7 @@
npc->y -= 0x2000;
npc->ani_wait = Random(0, 6);
//Fallthrough
-
+
case 1:
if (++npc->ani_wait > 6)
{
@@ -281,12 +281,12 @@
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 @@
{160, 152, 200, 184},
{200, 152, 240, 184},
};
-
+
switch (npc->act_no)
{
case 0:
@@ -330,7 +330,7 @@
}
break;
}
-
+
if (npc->direct == 0)
npc->rect = rcLeft[npc->ani_no];
else
@@ -349,7 +349,7 @@
{0, 48, 16, 64},
{16, 48, 32, 64},
};
-
+
switch (npc->act_no)
{
case 0:
@@ -375,12 +375,12 @@
}
break;
}
-
+
if (gMC.x < npc->x)
npc->direct = 0;
else
npc->direct = 2;
-
+
if (npc->direct == 0)
npc->rect = rcLeft[npc->ani_no];
else
--- a/src/NpcAct320.cpp
+++ b/src/NpcAct320.cpp
@@ -371,7 +371,7 @@
npc->act_no = 0;
break;
- }
+ }
}
//Heavy Press lightning
@@ -508,15 +508,15 @@
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 @@
break;
}
-
+
RECT rcItoh[8] = {
{0, 128, 16, 152},
{16, 128, 32, 152},
@@ -572,7 +572,7 @@
{224, 128, 240, 152},
{32, 152, 48, 176},
};
-
+
if (npc->direct == 0)
npc->rect = rcItoh[npc->ani_no];
else
@@ -586,15 +586,15 @@
{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 @@
npc->tgt_y = npc->y;
}
break;
-
+
case 1:
if (npc->act_wait < 48)
{
@@ -617,10 +617,10 @@
}
break;
}
-
+
if (npc->act_wait > 70)
npc->cond = 0;
-
+
npc->rect = rc[npc->ani_no];
}
@@ -638,7 +638,7 @@
{48, 0, 64, 16},
{64, 0, 80, 16},
};
-
+
if (++npc->ani_wait / 2 % 2)
npc->rect = rc[0];
else
@@ -1136,5 +1136,5 @@
}
break;
- }
+ }
}
--- a/src/NpcAct340.cpp
+++ b/src/NpcAct340.cpp
@@ -1489,7 +1489,7 @@
npc->ani_no = 0;
npc->count1 = npc->direct / 100;
npc->direct %= 100;
-
+
//Set surfaces / offset
switch (npc->count1)
{
@@ -1503,7 +1503,7 @@
default:
break;
}
-
+
switch (npc->count1)
{
case 2:
@@ -1515,7 +1515,7 @@
default:
break;
}
-
+
//Balrog
if (npc->count1 == 9)
{
@@ -1523,7 +1523,7 @@
npc->view.front = 0x2800;
npc->x -= 0x200;
}
-
+
//Spawn King's sword
if (!npc->count1)
SetNpChar(145, 0, 0, 0, 0, 2, npc, 0x100);
@@ -1532,7 +1532,7 @@
npc->ym += 0x40;
if (npc->ym > 0x5FF)
npc->ym = 0x5FF;
-
+
if (npc->flag & 8)
{
npc->ym = 0;
@@ -1539,11 +1539,11 @@
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 @@
{48, 16, 64, 32},
{48, 0, 64, 16}
};
-
+
npc->rect = rc[npc->ani_no + 2 * npc->count1];
}
@@ -1981,6 +1981,6 @@
npc->x -= 0x1000;
npc->y -= 0x1000;
}
-
+
npc->rect = rc;
}
--- a/src/NpcHit.cpp
+++ b/src/NpcHit.cpp
@@ -24,7 +24,7 @@
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 @@
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 @@
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,7 +53,7 @@
npc->ym = 0;
hit |= 8;
}
-
+
npc->flag |= hit;
}
@@ -60,7 +60,7 @@
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,15 +68,15 @@
{
//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;
}
@@ -83,7 +83,7 @@
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,15 +91,15 @@
{
//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;
}
@@ -106,7 +106,7 @@
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,15 +114,15 @@
{
//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;
}
@@ -129,7 +129,7 @@
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 @@
{
//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 @@
{
//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 @@
{
//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 @@
{
//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,15 +229,15 @@
{
//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;
}
@@ -244,13 +244,13 @@
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 @@
{
int offy[9];
int offx[9];
-
+
offx[0] = 0;
offx[1] = 1;
offx[2] = 0;
@@ -268,7 +268,7 @@
offx[6] = 2;
offx[7] = 0;
offx[8] = 1;
-
+
offy[0] = 0;
offy[1] = 0;
offy[2] = 1;
@@ -278,7 +278,7 @@
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 @@
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 @@
case 0x62:
JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
break;
-
+
//Block
case 0x03:
case 0x05:
@@ -317,7 +317,7 @@
case 0x43:
JadgeHitNpCharBlock(&gNPC[i], x + offx[j], y + offy[j]);
break;
-
+
//Water block
case 0x04:
case 0x61:
@@ -325,82 +325,82 @@
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]);
@@ -407,7 +407,7 @@
break;
}
}
-
+
if (gNPC[i].y > gWaterY + 0x800)
gNPC[i].flag |= 0x100;
}
@@ -418,7 +418,7 @@
{
//Play death sound
PlaySoundObject(npc->destroy_voice, 1);
-
+
//Create smoke
switch (npc->size)
{
@@ -432,13 +432,13 @@
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 @@
SetExpObjects(npc->x, npc->y, npc->exp);
}
}
-
+
//Set flag
SetNPCFlag(npc->code_flag);
-
+
//Create value view
if (!(npc->bits & npc_showDamage))
{
@@ -493,7 +493,7 @@
&& 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
@@ -500,7 +500,7 @@
if (gNPC[n].bits & npc_shootable)
{
gNPC[n].life -= gBul[b].damage;
-
+
if (gNPC[n].life > 0)
{
if (gNPC[n].shock < 14)
@@ -511,7 +511,7 @@
PlaySoundObject(gNPC[n].hit_voice, 1);
gNPC[n].shock = 16;
}
-
+
if (gNPC[n].bits & npc_showDamage)
gNPC[n].damage_view -= gBul[b].damage;
}
@@ -518,10 +518,10 @@
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 @@
gBul[b].life = 0;
continue;
}
-
+
--gBul[b].life;
}
}
}
-
+
if (gNPC[n].cond & 8)
LoseNpChar(&gNPC[n], true);
}
--- a/src/NpcTbl.cpp
+++ b/src/NpcTbl.cpp
@@ -46,7 +46,7 @@
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;
}
--- a/src/Organya.cpp
+++ b/src/Organya.cpp
@@ -41,7 +41,7 @@
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 @@
(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 @@
{
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 @@
delete[] wp;
}
}
-
+
return true;
}
@@ -167,7 +167,7 @@
}
}
-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 @@
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 @@
old_key[track] = 0xFF;
}
break;
-
+
case -1:
if (old_key[track] == 0xFF)
{
@@ -222,7 +222,7 @@
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 @@
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 @@
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,25 +347,25 @@
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)
@@ -372,19 +372,19 @@
{
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 @@
while (play_np[i] != NULL && play_np[i]->x < x)
play_np[i] = play_np[i]->to;
}
-
+
play_p = x;
}
@@ -444,7 +444,7 @@
printf("Failed to open .org, invalid version %s", pass_check);
return;
}
-
+
//Set song information
info.wait = READ_LE16(p);
info.line = *p++;
@@ -451,7 +451,7 @@
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 @@
//Reset position
SetPlayPointer(0);
-
+
//Set as loaded
info.loaded = true;
}
@@ -555,7 +555,7 @@
gOrgVolume = volume;
return true;
}
-
+
return false;
}
@@ -563,11 +563,11 @@
{
//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,10 +585,10 @@
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)
@@ -595,11 +595,11 @@
{
//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 @@
SDL_Delay(1);
}
}
-
+
return 0;
}
@@ -639,10 +639,10 @@
{
//End timer
OrganyaEndTimer();
-
+
//Release everything related to org
OrganyaReleaseNote();
-
+
for (int i = 0; i < MAXMELODY; i++)
ReleaseOrganyaObject(i);
}
--- a/src/Profile.cpp
+++ b/src/Profile.cpp
@@ -31,11 +31,11 @@
{
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 @@
{
//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 @@
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 @@
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 @@
{
//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 @@
#endif
return false;
}
-
+
//Read data
fseek(fp, 0, SEEK_SET); //Pixel epic redundant code 😎😎😎
fread(profile.code, 8, 1, fp);
@@ -182,7 +182,7 @@
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 @@
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 @@
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();
--- a/src/SelStage.cpp
+++ b/src/SelStage.cpp
@@ -196,4 +196,4 @@
while (Flip_SystemTask());
return 0;
-}
\ No newline at end of file
+}
--- a/src/Shoot.cpp
+++ b/src/Shoot.cpp
@@ -99,7 +99,7 @@
bul_no = 6;
break;
}
-
+
if (CountArmsBullet(2) > 1)
return;
@@ -150,7 +150,7 @@
SetCaret(gMC.x + 0x1800, gMC.y + 0x600, 3, 0);
}
}
-
+
if (level == 3)
PlaySoundObject(49, 1);
else
@@ -181,7 +181,7 @@
bul_no = 9;
break;
}
-
+
if (gKeyTrg & gKeyShot)
{
if (!UseArmsEnergy(1))
@@ -229,7 +229,7 @@
SetCaret(gMC.x + 0x1800, gMC.y + 0x400, 3, 0);
}
}
-
+
PlaySoundObject(34, 1);
}
}
@@ -254,10 +254,10 @@
bul_no = 12;
break;
}
-
+
if (!(gKey & gKeyShot))
gMC.rensha = 6;
-
+
if (gKey & gKeyShot)
{
if (++gMC.rensha < 6)
@@ -268,7 +268,7 @@
if (!UseArmsEnergy(1))
{
PlaySoundObject(37, 1);
-
+
if (empty == 0)
{
SetCaret(gMC.x, gMC.y, 16, 0);
@@ -283,7 +283,7 @@
{
if (level == 3)
gMC.ym += 0x100;
-
+
if (gMC.direct == 0)
{
SetBullet(bul_no, gMC.x - 0x600, gMC.y - 0x1000, 1);
@@ -301,7 +301,7 @@
{
if (gMC.ym > 0)
gMC.ym /= 2;
-
+
if (gMC.ym > -0x400)
{
gMC.ym -= 0x200;
@@ -309,7 +309,7 @@
gMC.ym = -0x400;
}
}
-
+
if (gMC.direct == 0)
{
SetBullet(bul_no, gMC.x - 0x600, gMC.y + 0x1000, 3);
@@ -334,7 +334,7 @@
SetCaret(gMC.x + 0x1800, gMC.y + 0x600, 3, 0);
}
}
-
+
if (level == 3)
PlaySoundObject(49, 1);
else
@@ -344,7 +344,7 @@
else
{
static int wait = 0;
-
+
++wait;
if (gMC.equip & 8)
{
@@ -354,7 +354,7 @@
ChargeArmsEnergy(1);
}
}
- else
+ else
{
if (wait > 4)
{
@@ -383,7 +383,7 @@
bul_no = 30;
break;
}
-
+
switch (level)
{
case 1:
@@ -413,7 +413,7 @@
break;
}
-
+
}
else
{
@@ -429,7 +429,7 @@
bul_no = 15;
break;
}
-
+
switch (level)
{
case 1:
@@ -460,7 +460,7 @@
break;
}
}
-
+
if (gKeyTrg & gKeyShot)
{
if (level < 3)
@@ -1037,12 +1037,12 @@
{
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)
@@ -1049,7 +1049,7 @@
return;
soft_rensha = 4;
}
-
+
//Run functions
if (gMC.cond & 2)
return;
--- a/src/Sound.cpp
+++ b/src/Sound.cpp
@@ -33,28 +33,28 @@
{
//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 @@
{
//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 @@
break;
}
}
-
+
//Unlock audio buffer
SDL_UnlockAudioDevice(audioDevice);
}
@@ -163,25 +163,25 @@
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 @@
//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 @@
{
//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 @@
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 @@
{
//Quit sub-system
SDL_QuitSubSystem(SDL_INIT_AUDIO);
-
+
//Close audio device
SDL_CloseAudioDevice(audioDevice);
-
+
//End organya
EndOrganya();
}
--- a/src/Sound.h
+++ b/src/Sound.h
@@ -10,12 +10,12 @@
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);
@@ -22,19 +22,19 @@
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;
--- a/src/Stage.cpp
+++ b/src/Stage.cpp
@@ -133,13 +133,13 @@
{
//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 @@
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 @@
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 @@
{
//Load map name
ReadyMapName(gTMT[no].name);
-
+
StartTextScript(w);
SetFrameMyChar();
ClearBullet();
@@ -203,7 +203,7 @@
gStageNo = no;
return TRUE;
}
-
+
return FALSE;
}
@@ -270,10 +270,10 @@
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 @@
{
//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);
--- a/src/Star.cpp
+++ b/src/Star.cpp
@@ -31,24 +31,24 @@
{
//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 @@
static int a;
a++;
a %= 3;
-
+
for (int i = 0; i < 3; i++)
{
if (i)
@@ -67,7 +67,7 @@
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 @@
else
star[i].ym += 0xAA;
}
-
+
if (star[i].xm > 0xA00)
star[i].xm = 0xA00;
if (star[i].xm < -0xA00)
@@ -105,10 +105,10 @@
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 @@
{192, 8, 200, 16},
{192, 16, 200, 24},
};
-
+
if (gMC.cond & 2)
return;
--- a/src/TextScr.h
+++ b/src/TextScr.h
@@ -10,49 +10,49 @@
{
//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 @@
BOOL StartTextScript(int no);
void StopTextScript();
void PutTextScript();
-int TextScriptProc();
\ No newline at end of file
+int TextScriptProc();
--- a/src/Triangle.cpp
+++ b/src/Triangle.cpp
@@ -17,7 +17,7 @@
{
gSin[i] = (int)(sin(i * 6.2831998 / 256.0) * 512.0);
}
-
+
//Tangent
for (i = 0; i < 0x21; ++i)
{
@@ -118,6 +118,6 @@
}
}
}
-
+
return a;
-}
\ No newline at end of file
+}
--- a/src/Types.h
+++ b/src/Types.h
@@ -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
--- a/src/ValueView.cpp
+++ b/src/ValueView.cpp
@@ -38,7 +38,7 @@
break;
}
}
-
+
if (i == VALUEVIEW_MAX)
{
index = gVVIndex++;
@@ -55,7 +55,7 @@
gVV[index].value += value;
value = gVV[index].value;
}
-
+
//Get if negative or not
if (value < 0)
{
@@ -66,10 +66,10 @@
{
minus = FALSE;
}
-
+
//Get width
v = value;
-
+
if (value > 999)
width = 40;
else if (value > 99)
@@ -78,7 +78,7 @@
width = 24;
else
width = 16;
-
+
//Set properties
gVV[index].flag = TRUE;
gVV[index].px = px;
@@ -87,7 +87,7 @@
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 @@
{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 @@
++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)