Merge branch 'accurate' into portable

This commit is contained in:
Clownacy 2020-01-08 13:16:21 +00:00
commit 9cbaa0be00
57 changed files with 605 additions and 645 deletions

View file

@ -14,17 +14,18 @@
#include "Sound.h" #include "Sound.h"
#include "TextScr.h" #include "TextScr.h"
int gArmsEnergyX = 16; ARMS gArmsData[ARMS_MAX];
ITEM gItemData[ITEM_MAX];
int gSelectedArms; int gSelectedArms;
int gSelectedItem; int gSelectedItem;
ARMS gArmsData[ARMS_MAX]; static int gCampTitleY;
ITEM gItemData[ITEM_MAX];
/// True if we're in the items section of the inventory (not in the weapons section) (only relevant when the inventory is open) /// True if we're in the items section of the inventory (not in the weapons section) (only relevant when the inventory is open)
static BOOL gCampActive; static BOOL gCampActive;
static int gCampTitleY;
int gArmsEnergyX = 16;
void ClearArmsData(void) void ClearArmsData(void)
{ {
@ -175,6 +176,8 @@ BOOL SubItemData(long code)
/// Update the inventory cursor /// Update the inventory cursor
void MoveCampCursor(void) void MoveCampCursor(void)
{ {
BOOL bChange;
// Compute the current amount of weapons and items // Compute the current amount of weapons and items
int arms_num = 0; int arms_num = 0;
int item_num = 0; int item_num = 0;
@ -187,7 +190,7 @@ void MoveCampCursor(void)
return; // Empty inventory return; // Empty inventory
// True if we're currently changing cursor position // True if we're currently changing cursor position
BOOL bChange = FALSE; bChange = FALSE;
if (!gCampActive) if (!gCampActive)
{ {
@ -300,6 +303,8 @@ void MoveCampCursor(void)
/// Draw the inventory /// Draw the inventory
void PutCampObject(void) void PutCampObject(void)
{ {
static unsigned int flash;
int i; int i;
/// Rect for the current weapon /// Rect for the current weapon
@ -347,7 +352,6 @@ void PutCampObject(void)
PutBitmap3(&rcView, (WINDOW_WIDTH / 2) - 112, gCampTitleY + 52, &rcTitle2, SURFACE_ID_TEXT_BOX); PutBitmap3(&rcView, (WINDOW_WIDTH / 2) - 112, gCampTitleY + 52, &rcTitle2, SURFACE_ID_TEXT_BOX);
// Draw arms cursor // Draw arms cursor
static unsigned int flash;
++flash; ++flash;
if (gCampActive == FALSE) if (gCampActive == FALSE)
@ -410,7 +414,6 @@ void PutCampObject(void)
int CampLoop(void) int CampLoop(void)
{ {
int arms_num;
char old_script_path[MAX_PATH]; char old_script_path[MAX_PATH];
RECT rcView = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT}; RECT rcView = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
@ -428,7 +431,7 @@ int CampLoop(void)
gSelectedItem = 0; gSelectedItem = 0;
// Compute current amount of weapons // Compute current amount of weapons
arms_num = 0; int arms_num = 0;
while (gArmsData[arms_num].code != 0) while (gArmsData[arms_num].code != 0)
++arms_num; ++arms_num;

View file

@ -72,8 +72,7 @@ void ActBack(void)
void PutBack(int fx, int fy) void PutBack(int fx, int fy)
{ {
int x; int x, y;
int y;
RECT rect = {0, 0, gBack.partsW, gBack.partsH}; RECT rect = {0, 0, gBack.partsW, gBack.partsH};
switch (gBack.type) switch (gBack.type)
@ -156,17 +155,14 @@ void PutBack(int fx, int fy)
void PutFront(int fx, int fy) void PutFront(int fx, int fy)
{ {
int x; int xpos, ypos;
int y;
int xpos;
int ypos;
int x_1;
int x_2;
int y_1;
int y_2;
RECT rcWater[2] = {{0, 0, 32, 16}, {0, 16, 32, 48}}; RECT rcWater[2] = {{0, 0, 32, 16}, {0, 16, 32, 48}};
int x, y;
int x_1, x_2;
int y_1, y_2;
switch (gBack.type) switch (gBack.type)
{ {
case 3: case 3:

View file

@ -38,6 +38,8 @@ void PutBossChar(int fx, int fy)
char a = 0; char a = 0;
int b; int b;
int side;
for (b = BOSS_MAX - 1; b >= 0; --b) for (b = BOSS_MAX - 1; b >= 0; --b)
{ {
if (gBoss[b].cond & 0x80) if (gBoss[b].cond & 0x80)
@ -57,7 +59,6 @@ void PutBossChar(int fx, int fy)
} }
} }
int side;
if (gBoss[b].direct == 0) if (gBoss[b].direct == 0)
side = gBoss[b].view.front; side = gBoss[b].view.front;
else else
@ -218,8 +219,8 @@ BOSSFUNCTION gpBossFuncTbl[10] =
void ActBossChar(void) void ActBossChar(void)
{ {
int bos;
int code_char; int code_char;
int bos;
if (!(gBoss[0].cond & 0x80)) if (!(gBoss[0].cond & 0x80))
return; return;
@ -235,13 +236,12 @@ void ActBossChar(void)
void HitBossMap(void) void HitBossMap(void)
{ {
int x, y;
unsigned char atrb[16];
int judg;
int offx[16]; int offx[16];
int offy[16]; int offy[16];
unsigned char atrb[16]; int b, j;
int b;
int j;
int x;
int y;
offx[0] = 0; offx[0] = 0;
offx[1] = 1; offx[1] = 1;
@ -279,8 +279,6 @@ void HitBossMap(void)
for (b = 0; b < BOSS_MAX; ++b) for (b = 0; b < BOSS_MAX; ++b)
{ {
int judg;
if (!(gBoss[b].cond & 0x80)) if (!(gBoss[b].cond & 0x80))
continue; continue;

View file

@ -178,14 +178,14 @@ static void ActBossCharA_Face(NPCHAR *npc)
static void ActBossCharA_Mini(NPCHAR *npc) static void ActBossCharA_Mini(NPCHAR *npc)
{ {
int deg;
RECT rect[3] = { RECT rect[3] = {
{256, 0, 320, 40}, {256, 0, 320, 40},
{256, 40, 320, 80}, {256, 40, 320, 80},
{256, 80, 320, 120}, {256, 80, 320, 120},
}; };
int deg;
if (npc->cond == 0) if (npc->cond == 0)
return; return;
@ -284,16 +284,14 @@ static void ActBossCharA_Hit(NPCHAR *npc)
void ActBossChar_Undead(void) void ActBossChar_Undead(void)
{ {
int i;
int x;
int y;
static int life;
static unsigned char flash;
NPCHAR *npc = gBoss; NPCHAR *npc = gBoss;
static unsigned char flash;
BOOL bShock = FALSE; BOOL bShock = FALSE;
int x, y;
int i;
static int life;
switch (npc->act_no) switch (npc->act_no)
{ {

View file

@ -135,14 +135,12 @@ static void ActBossChar_HARA(NPCHAR *npc) // "Hara" = "belly" or "stomach" (acco
void ActBossChar_Ballos(void) void ActBossChar_Ballos(void)
{ {
static unsigned char flash;
int i;
int x;
int y;
NPCHAR *npc = gBoss; NPCHAR *npc = gBoss;
static unsigned char flash;
int i;
int x, y;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:

View file

@ -132,10 +132,9 @@ static void ActBossChar02_02(void)
// Main boss AI // Main boss AI
void ActBossChar_Frog(void) void ActBossChar_Frog(void)
{ {
int i;
unsigned char deg; unsigned char deg;
int ym; int xm, ym;
int xm; int i;
// Rects 1-4 are for when Balfrog is a frog, 5-8 for when he reverts into Balrog and goes into the ceiling // Rects 1-4 are for when Balfrog is a frog, 5-8 for when he reverts into Balrog and goes into the ceiling
RECT rcLeft[9] = { RECT rcLeft[9] = {

View file

@ -11,10 +11,9 @@
void ActBossChar_Ironhead(void) void ActBossChar_Ironhead(void)
{ {
static unsigned char flash;
int i; int i;
NPCHAR *npc = gBoss; NPCHAR *npc = gBoss;
static unsigned char flash;
switch (npc->act_no) switch (npc->act_no)
{ {

View file

@ -10,13 +10,11 @@
void ActBossChar_Press(void) void ActBossChar_Press(void)
{ {
NPCHAR *npc = gBoss;
static unsigned char flash; static unsigned char flash;
int i; int i;
int x; int x;
NPCHAR *npc = gBoss;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:

View file

@ -95,8 +95,7 @@ static void ActBossCharT_DragonBody(NPCHAR *npc)
static void ActBossCharT_DragonHead(NPCHAR *npc) static void ActBossCharT_DragonHead(NPCHAR *npc)
{ {
unsigned char deg; unsigned char deg;
int ym; int xm, ym;
int xm;
RECT rcLeft[4] = { RECT rcLeft[4] = {
{0, 80, 40, 112}, {0, 80, 40, 112},

View file

@ -212,8 +212,6 @@ static void ActBossChar03_01(NPCHAR *npc)
static void ActBossChar03_02(NPCHAR *npc) static void ActBossChar03_02(NPCHAR *npc)
{ {
int direct;
RECT rect[4] = { RECT rect[4] = {
{0, 128, 72, 160}, {0, 128, 72, 160},
{72, 128, 144, 160}, {72, 128, 144, 160},
@ -221,8 +219,8 @@ static void ActBossChar03_02(NPCHAR *npc)
{72, 160, 144, 192}, {72, 160, 144, 192},
}; };
int x; int direct;
int y; int x, y;
switch (npc->act_no) switch (npc->act_no)
{ {
@ -360,9 +358,8 @@ static void ActBossChar03_03(NPCHAR *npc)
static void ActBossChar03_04(NPCHAR *npc) static void ActBossChar03_04(NPCHAR *npc)
{ {
int xm, ym;
unsigned char deg; unsigned char deg;
int ym;
int xm;
RECT rect[8] = { RECT rect[8] = {
{0, 192, 16, 208}, {0, 192, 16, 208},
@ -436,14 +433,14 @@ static void ActBossChar03_04(NPCHAR *npc)
static void ActBossChar03_face(NPCHAR *npc) static void ActBossChar03_face(NPCHAR *npc)
{ {
static unsigned char flash;
RECT rect[3] = { RECT rect[3] = {
{216, 0, 320, 48}, {216, 0, 320, 48},
{216, 48, 320, 96}, {216, 48, 320, 96},
{216, 144, 320, 192}, {216, 144, 320, 192},
}; };
static unsigned char flash;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:
@ -484,7 +481,6 @@ static void ActBossChar03_face(NPCHAR *npc)
void ActBossChar_MonstX(void) void ActBossChar_MonstX(void)
{ {
int i; int i;
NPCHAR *npc = gBoss; NPCHAR *npc = gBoss;
switch (npc->act_no) switch (npc->act_no)

View file

@ -47,12 +47,12 @@ int JudgeHitBulletBlock(int x, int y, BULLET *bul)
int JudgeHitBulletBlock2(int x, int y, unsigned char *atrb, BULLET *bul) int JudgeHitBulletBlock2(int x, int y, unsigned char *atrb, BULLET *bul)
{ {
int i;
int workX;
int workY;
int hit = 0;
BOOL block[4]; BOOL block[4];
int workX, workY;
int hit, i;
hit = 0;
if (bul->bbits & 0x40) if (bul->bbits & 0x40)
{ {
for (i = 0; i < 4; ++i) for (i = 0; i < 4; ++i)
@ -324,12 +324,11 @@ int JudgeHitBulletTriangleH(int x, int y, BULLET *bul)
void HitBulletMap(void) void HitBulletMap(void)
{ {
int i; int x, y;
int j;
int x;
int y;
unsigned char atrb[4]; unsigned char atrb[4];
int i, j;
for (i = 0; i < BULLET_MAX; ++i) for (i = 0; i < BULLET_MAX; ++i)
{ {
int offx[4]; int offx[4];

View file

@ -12,56 +12,6 @@
#include "NpChar.h" #include "NpChar.h"
#include "Sound.h" #include "Sound.h"
BULLET_TABLE gBulTbl[46] =
{
{0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0}},
{4, 1, 20, 36, 4, 4, 2, 2, {8, 8, 8, 8}},
{6, 1, 23, 36, 4, 4, 2, 2, {8, 8, 8, 8}},
{8, 1, 30, 36, 4, 4, 2, 2, {8, 8, 8, 8}},
{1, 1, 8, 32, 6, 6, 2, 2, {8, 8, 8, 8}},
{2, 1, 12, 32, 6, 6, 2, 2, {8, 8, 8, 8}},
{4, 1, 16, 32, 6, 6, 2, 2, {8, 8, 8, 8}},
{2, 2, 100, 8, 8, 16, 4, 2, {8, 8, 8, 8}},
{3, 2, 100, 8, 4, 4, 4, 2, {8, 8, 8, 8}},
{3, 2, 100, 8, 4, 4, 4, 2, {8, 8, 8, 8}},
{2, 1, 20, 32, 2, 2, 2, 2, {8, 8, 8, 8}},
{4, 1, 20, 32, 2, 2, 2, 2, {8, 8, 8, 8}},
{6, 1, 20, 32, 2, 2, 2, 2, {8, 8, 8, 8}},
{0, 10, 50, 40, 2, 2, 2, 2, {8, 8, 8, 8}},
{0, 10, 70, 40, 4, 4, 4, 4, {8, 8, 8, 8}},
{0, 10, 90, 40, 4, 4, 0, 0, {8, 8, 8, 8}},
{1, 100, 100, 20, 16, 16, 0, 0, {0, 0, 0, 0}},
{1, 100, 100, 20, 16, 16, 0, 0, {0, 0, 0, 0}},
{1, 100, 100, 20, 16, 16, 0, 0, {0, 0, 0, 0}},
{1, 1, 20, 8, 2, 2, 2, 2, {4, 4, 4, 4}},
{2, 1, 20, 8, 2, 2, 2, 2, {4, 4, 4, 4}},
{2, 1, 20, 8, 4, 4, 4, 4, {4, 4, 4, 4}},
{3, 1, 32, 32, 2, 2, 2, 2, {4, 4, 4, 4}},
{0, 100, 0, 36, 8, 8, 8, 8, {12, 12, 12, 12}},
{127, 1, 2, 4, 8, 4, 8, 4, {0, 0, 0, 0}},
{15, 1, 30, 36, 8, 8, 4, 2, {8, 8, 8, 8}},
{6, 3, 18, 36, 10, 10, 4, 2, {12, 12, 12, 12}},
{1, 100, 30, 36, 6, 6, 4, 4, {12, 12, 12, 12}},
{0, 10, 30, 40, 2, 2, 2, 2, {8, 8, 8, 8}},
{0, 10, 40, 40, 4, 4, 4, 4, {8, 8, 8, 8}},
{0, 10, 40, 40, 4, 4, 0, 0, {8, 8, 8, 8}},
{2, 100, 100, 20, 12, 12, 0, 0, {0, 0, 0, 0}},
{2, 100, 100, 20, 12, 12, 0, 0, {0, 0, 0, 0}},
{2, 100, 100, 20, 12, 12, 0, 0, {0, 0, 0, 0}},
{4, 4, 20, 32, 4, 4, 3, 3, {8, 8, 24, 8}},
{4, 2, 20, 32, 2, 2, 2, 2, {8, 8, 24, 8}},
{1, 1, 20, 32, 2, 2, 2, 2, {8, 8, 24, 8}},
{4, 4, 30, 64, 6, 6, 3, 3, {8, 8, 8, 8}},
{8, 8, 30, 64, 6, 6, 3, 3, {8, 8, 8, 8}},
{12, 12, 30, 64, 6, 6, 3, 3, {8, 8, 8, 8}},
{3, 100, 30, 32, 6, 6, 3, 3, {4, 4, 4, 4}},
{6, 100, 30, 32, 6, 6, 3, 3, {4, 4, 4, 4}},
{11, 100, 30, 32, 6, 6, 3, 3, {4, 4, 4, 4}},
{4, 4, 20, 32, 4, 4, 3, 3, {8, 8, 24, 8}},
{0, 4, 4, 4, 0, 0, 0, 0, {0, 0, 0, 0}},
{1, 1, 1, 36, 1, 1, 1, 1, {1, 1, 1, 1}}
};
BULLET gBul[BULLET_MAX]; BULLET gBul[BULLET_MAX];
void InitBullet(void) void InitBullet(void)
@ -150,6 +100,56 @@ void PutBullet(int fx, int fy)
} }
} }
BULLET_TABLE gBulTbl[46] =
{
{0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0}},
{4, 1, 20, 36, 4, 4, 2, 2, {8, 8, 8, 8}},
{6, 1, 23, 36, 4, 4, 2, 2, {8, 8, 8, 8}},
{8, 1, 30, 36, 4, 4, 2, 2, {8, 8, 8, 8}},
{1, 1, 8, 32, 6, 6, 2, 2, {8, 8, 8, 8}},
{2, 1, 12, 32, 6, 6, 2, 2, {8, 8, 8, 8}},
{4, 1, 16, 32, 6, 6, 2, 2, {8, 8, 8, 8}},
{2, 2, 100, 8, 8, 16, 4, 2, {8, 8, 8, 8}},
{3, 2, 100, 8, 4, 4, 4, 2, {8, 8, 8, 8}},
{3, 2, 100, 8, 4, 4, 4, 2, {8, 8, 8, 8}},
{2, 1, 20, 32, 2, 2, 2, 2, {8, 8, 8, 8}},
{4, 1, 20, 32, 2, 2, 2, 2, {8, 8, 8, 8}},
{6, 1, 20, 32, 2, 2, 2, 2, {8, 8, 8, 8}},
{0, 10, 50, 40, 2, 2, 2, 2, {8, 8, 8, 8}},
{0, 10, 70, 40, 4, 4, 4, 4, {8, 8, 8, 8}},
{0, 10, 90, 40, 4, 4, 0, 0, {8, 8, 8, 8}},
{1, 100, 100, 20, 16, 16, 0, 0, {0, 0, 0, 0}},
{1, 100, 100, 20, 16, 16, 0, 0, {0, 0, 0, 0}},
{1, 100, 100, 20, 16, 16, 0, 0, {0, 0, 0, 0}},
{1, 1, 20, 8, 2, 2, 2, 2, {4, 4, 4, 4}},
{2, 1, 20, 8, 2, 2, 2, 2, {4, 4, 4, 4}},
{2, 1, 20, 8, 4, 4, 4, 4, {4, 4, 4, 4}},
{3, 1, 32, 32, 2, 2, 2, 2, {4, 4, 4, 4}},
{0, 100, 0, 36, 8, 8, 8, 8, {12, 12, 12, 12}},
{127, 1, 2, 4, 8, 4, 8, 4, {0, 0, 0, 0}},
{15, 1, 30, 36, 8, 8, 4, 2, {8, 8, 8, 8}},
{6, 3, 18, 36, 10, 10, 4, 2, {12, 12, 12, 12}},
{1, 100, 30, 36, 6, 6, 4, 4, {12, 12, 12, 12}},
{0, 10, 30, 40, 2, 2, 2, 2, {8, 8, 8, 8}},
{0, 10, 40, 40, 4, 4, 4, 4, {8, 8, 8, 8}},
{0, 10, 40, 40, 4, 4, 0, 0, {8, 8, 8, 8}},
{2, 100, 100, 20, 12, 12, 0, 0, {0, 0, 0, 0}},
{2, 100, 100, 20, 12, 12, 0, 0, {0, 0, 0, 0}},
{2, 100, 100, 20, 12, 12, 0, 0, {0, 0, 0, 0}},
{4, 4, 20, 32, 4, 4, 3, 3, {8, 8, 24, 8}},
{4, 2, 20, 32, 2, 2, 2, 2, {8, 8, 24, 8}},
{1, 1, 20, 32, 2, 2, 2, 2, {8, 8, 24, 8}},
{4, 4, 30, 64, 6, 6, 3, 3, {8, 8, 8, 8}},
{8, 8, 30, 64, 6, 6, 3, 3, {8, 8, 8, 8}},
{12, 12, 30, 64, 6, 6, 3, 3, {8, 8, 8, 8}},
{3, 100, 30, 32, 6, 6, 3, 3, {4, 4, 4, 4}},
{6, 100, 30, 32, 6, 6, 3, 3, {4, 4, 4, 4}},
{11, 100, 30, 32, 6, 6, 3, 3, {4, 4, 4, 4}},
{4, 4, 20, 32, 4, 4, 3, 3, {8, 8, 24, 8}},
{0, 4, 4, 4, 0, 0, 0, 0, {0, 0, 0, 0}},
{1, 1, 1, 36, 1, 1, 1, 1, {1, 1, 1, 1}}
};
void SetBullet(int no, int x, int y, int dir) void SetBullet(int no, int x, int y, int dir)
{ {
int i = 0; int i = 0;
@ -246,6 +246,8 @@ void ActBullet_Frontia1(BULLET *bul)
void ActBullet_Frontia2(BULLET *bul, int level) void ActBullet_Frontia2(BULLET *bul, int level)
{ {
static unsigned int inc;
if (++bul->count1 > bul->life_count) if (++bul->count1 > bul->life_count)
{ {
bul->cond = 0; bul->cond = 0;
@ -274,7 +276,6 @@ void ActBullet_Frontia2(BULLET *bul, int level)
break; break;
} }
static unsigned int inc;
++inc; ++inc;
switch (bul->direct) switch (bul->direct)
@ -372,10 +373,6 @@ void ActBullet_Frontia2(BULLET *bul, int level)
void ActBullet_PoleStar(BULLET *bul, int level) void ActBullet_PoleStar(BULLET *bul, int level)
{ {
RECT rect1[2];
RECT rect2[2];
RECT rect3[2];
if (++bul->count1 > bul->life_count) if (++bul->count1 > bul->life_count)
{ {
bul->cond = 0; bul->cond = 0;
@ -450,14 +447,20 @@ void ActBullet_PoleStar(BULLET *bul, int level)
bul->y += bul->ym; bul->y += bul->ym;
} }
SET_RECT(rect1[0], 128, 32, 144, 48) RECT rect1[2] = {
SET_RECT(rect1[1], 144, 32, 160, 48) {128, 32, 144, 48},
{144, 32, 160, 48},
};
SET_RECT(rect2[0], 160, 32, 176, 48) RECT rect2[2] = {
SET_RECT(rect2[1], 176, 32, 192, 48) {160, 32, 176, 48},
{176, 32, 192, 48},
};
SET_RECT(rect3[0], 128, 48, 144, 64) RECT rect3[2] = {
SET_RECT(rect3[1], 144, 48, 160, 64) {128, 48, 144, 64},
{144, 48, 160, 64},
};
//Set framerect //Set framerect
switch (level) switch (level)
@ -491,10 +494,6 @@ void ActBullet_PoleStar(BULLET *bul, int level)
void ActBullet_FireBall(BULLET *bul, int level) void ActBullet_FireBall(BULLET *bul, int level)
{ {
BOOL bBreak; BOOL bBreak;
RECT rect_left1[4];
RECT rect_right1[4];
RECT rect_left2[3];
RECT rect_right2[3];
if (++bul->count1 > bul->life_count) if (++bul->count1 > bul->life_count)
{ {
@ -585,23 +584,31 @@ void ActBullet_FireBall(BULLET *bul, int level)
PlaySoundObject(34, 1); PlaySoundObject(34, 1);
} }
SET_RECT(rect_left1[0], 128, 0, 144, 16) RECT rect_left1[4] = {
SET_RECT(rect_left1[1], 144, 0, 160, 16) {128, 0, 144, 16},
SET_RECT(rect_left1[2], 160, 0, 176, 16) {144, 0, 160, 16},
SET_RECT(rect_left1[3], 176, 0, 192, 16) {160, 0, 176, 16},
{176, 0, 192, 16},
};
SET_RECT(rect_right1[0], 128, 16, 144, 32) RECT rect_right1[4] = {
SET_RECT(rect_right1[1], 144, 16, 160, 32) {128, 16, 144, 32},
SET_RECT(rect_right1[2], 160, 16, 176, 32) {144, 16, 160, 32},
SET_RECT(rect_right1[3], 176, 16, 192, 32) {160, 16, 176, 32},
{176, 16, 192, 32},
};
SET_RECT(rect_left2[0], 192, 16, 208, 32) RECT rect_left2[3] = {
SET_RECT(rect_left2[1], 208, 16, 224, 32) {192, 16, 208, 32},
SET_RECT(rect_left2[2], 224, 16, 240, 32) {208, 16, 224, 32},
{224, 16, 240, 32},
};
SET_RECT(rect_right2[0], 224, 16, 240, 32) RECT rect_right2[3] = {
SET_RECT(rect_right2[1], 208, 16, 224, 32) {224, 16, 240, 32},
SET_RECT(rect_right2[2], 192, 16, 208, 32) {208, 16, 224, 32},
{192, 16, 208, 32},
};
++bul->ani_no; ++bul->ani_no;
@ -734,6 +741,8 @@ void ActBullet_Missile(BULLET *bul, int level)
{ {
BOOL bHit; BOOL bHit;
static unsigned int inc;
if (++bul->count1 > bul->life_count) if (++bul->count1 > bul->life_count)
{ {
bul->cond = 0; bul->cond = 0;
@ -810,8 +819,6 @@ void ActBullet_Missile(BULLET *bul, int level)
break; break;
} }
static unsigned int inc;
switch (++inc % 3) switch (++inc % 3)
{ {
case 0: case 0:
@ -992,8 +999,6 @@ void ActBullet_Bom(BULLET *bul, int level)
void ActBullet_Bubblin1(BULLET *bul) void ActBullet_Bubblin1(BULLET *bul)
{ {
RECT rect[4];
if (bul->flag & 0x2FF) if (bul->flag & 0x2FF)
{ {
bul->cond = 0; bul->cond = 0;
@ -1050,10 +1055,12 @@ void ActBullet_Bubblin1(BULLET *bul)
SetCaret(bul->x, bul->y, 15, 0); SetCaret(bul->x, bul->y, 15, 0);
} }
SET_RECT(rect[0], 192, 0, 200, 8) RECT rect[4] = {
SET_RECT(rect[1], 200, 0, 208, 8) {192, 0, 200, 8},
SET_RECT(rect[2], 208, 0, 216, 8) {200, 0, 208, 8},
SET_RECT(rect[3], 216, 0, 224, 8) {208, 0, 216, 8},
{216, 0, 224, 8},
};
if (++bul->ani_wait > 3) if (++bul->ani_wait > 3)
{ {
@ -1069,10 +1076,7 @@ void ActBullet_Bubblin1(BULLET *bul)
void ActBullet_Bubblin2(BULLET *bul) void ActBullet_Bubblin2(BULLET *bul)
{ {
BOOL bDelete; BOOL bDelete = FALSE;
RECT rect[4];
bDelete = FALSE;
if (bul->direct == 0 && bul->flag & 1) if (bul->direct == 0 && bul->flag & 1)
bDelete = TRUE; bDelete = TRUE;
@ -1143,10 +1147,12 @@ void ActBullet_Bubblin2(BULLET *bul)
SetCaret(bul->x, bul->y, 15, 0); SetCaret(bul->x, bul->y, 15, 0);
} }
SET_RECT(rect[0], 192, 8, 200, 16) RECT rect[4] = {
SET_RECT(rect[1], 200, 8, 208, 16) {192, 8, 200, 16},
SET_RECT(rect[2], 208, 8, 216, 16) {200, 8, 208, 16},
SET_RECT(rect[3], 216, 8, 224, 16) {208, 8, 216, 16},
{216, 8, 224, 16},
};
if (++bul->ani_wait > 3) if (++bul->ani_wait > 3)
{ {
@ -1656,6 +1662,8 @@ void ActBullet_SuperMissile(BULLET *bul, int level)
{ {
BOOL bHit; BOOL bHit;
static unsigned int inc;
if (++bul->count1 > bul->life_count) if (++bul->count1 > bul->life_count)
{ {
bul->cond = 0; bul->cond = 0;
@ -1737,8 +1745,6 @@ void ActBullet_SuperMissile(BULLET *bul, int level)
break; break;
} }
static unsigned int inc;
switch (++inc % 3) switch (++inc % 3)
{ {
case 0: case 0:

View file

@ -11,6 +11,27 @@
#define CARET_MAX 0x40 #define CARET_MAX 0x40
CARET gCrt[CARET_MAX]; CARET gCrt[CARET_MAX];
CARET_TABLE gCaretTable[18] = {
{0, 0},
{0x800, 0x800},
{0x1000, 0x1000},
{0x1000, 0x1000},
{0x1000, 0x1000},
{0x800, 0x800},
{0x1000, 0x1000},
{0x800, 0x800},
{0x1000, 0x1000},
{0x1000, 0x1000},
{0x3800, 0x1000},
{0x800, 0x800},
{0x2000, 0x2000},
{0x800, 0x800},
{0x2800, 0x2800},
{0x800, 0x800},
{0x2800, 0x800},
{0x6800, 0x800}
};
void InitCaret(void) void InitCaret(void)
{ {
memset(gCrt, 0, sizeof(gCrt)); memset(gCrt, 0, sizeof(gCrt));
@ -468,28 +489,6 @@ void ActCaret17(CARET *crt)
crt->rect = rcLeft[1]; crt->rect = rcLeft[1];
} }
// Tables
CARET_TABLE gCaretTable[18] = {
{0, 0},
{0x800, 0x800},
{0x1000, 0x1000},
{0x1000, 0x1000},
{0x1000, 0x1000},
{0x800, 0x800},
{0x1000, 0x1000},
{0x800, 0x800},
{0x1000, 0x1000},
{0x1000, 0x1000},
{0x3800, 0x1000},
{0x800, 0x800},
{0x2000, 0x2000},
{0x800, 0x800},
{0x2800, 0x2800},
{0x800, 0x800},
{0x2800, 0x800},
{0x6800, 0x800}
};
typedef void (*CARETFUNCTION)(CARET*); typedef void (*CARETFUNCTION)(CARET*);
CARETFUNCTION gpCaretFuncTbl[] = CARETFUNCTION gpCaretFuncTbl[] =
{ {

View file

@ -40,8 +40,8 @@ void ActionStripper(void)
// Draw casts // Draw casts
void PutStripper(void) void PutStripper(void)
{ {
RECT rc;
int s; int s;
RECT rc;
for (s = 0; s < MAX_STRIP; ++s) for (s = 0; s < MAX_STRIP; ++s)
{ {
@ -69,8 +69,8 @@ void PutStripper(void)
// Create a cast object // Create a cast object
void SetStripper(int x, int y, const char *text, int cast) void SetStripper(int x, int y, const char *text, int cast)
{ {
RECT rc;
int s; int s;
RECT rc;
for (s = 0; s < MAX_STRIP; ++s) for (s = 0; s < MAX_STRIP; ++s)
if (!(Strip[s].flag & 0x80)) if (!(Strip[s].flag & 0x80))
@ -99,8 +99,8 @@ void SetStripper(int x, int y, const char *text, int cast)
// Regenerate cast text // Regenerate cast text
void RestoreStripper(void) void RestoreStripper(void)
{ {
RECT rc;
int s; int s;
RECT rc;
for (s = 0; s < MAX_STRIP; ++s) for (s = 0; s < MAX_STRIP; ++s)
{ {
@ -161,6 +161,8 @@ void ReloadIllust(int a)
ReloadBitmap_Resource(name, SURFACE_ID_CREDITS_IMAGE); ReloadBitmap_Resource(name, SURFACE_ID_CREDITS_IMAGE);
} }
const char *credit_script = "Credit.tsc";
// Initialize and release credits // Initialize and release credits
void InitCreditScript(void) void InitCreditScript(void)
{ {
@ -179,11 +181,12 @@ void ReleaseCreditScript(void)
} }
} }
const char *credit_script = "Credit.tsc";
// Start playing credits // Start playing credits
BOOL StartCreditScript(void) BOOL StartCreditScript(void)
{ {
FILE *fp;
char path[MAX_PATH];
// Clear previously existing credits data // Clear previously existing credits data
if (Credit.pData != NULL) if (Credit.pData != NULL)
{ {
@ -192,7 +195,6 @@ BOOL StartCreditScript(void)
} }
// Open file // Open file
char path[MAX_PATH];
sprintf(path, "%s/%s", gDataPath, credit_script); sprintf(path, "%s/%s", gDataPath, credit_script);
Credit.size = GetFileSizeLong(path); Credit.size = GetFileSizeLong(path);
@ -204,7 +206,7 @@ BOOL StartCreditScript(void)
if (Credit.pData == NULL) if (Credit.pData == NULL)
return FALSE; return FALSE;
FILE *fp = fopen(path, "rb"); fp = fopen(path, "rb");
if (fp == NULL) if (fp == NULL)
{ {
free(Credit.pData); free(Credit.pData);
@ -441,6 +443,7 @@ void CutCreditIllust(void)
// Scene of the island falling // Scene of the island falling
int Scene_DownIsland(int mode) int Scene_DownIsland(int mode)
{ {
ISLAND_SPRITE sprite;
int wait; int wait;
// Setup background // Setup background
@ -451,7 +454,6 @@ int Scene_DownIsland(int mode)
// Setup island // Setup island
RECT rc_sprite = {160, 0, 200, 24}; RECT rc_sprite = {160, 0, 200, 24};
ISLAND_SPRITE sprite;
sprite.x = 168 * 0x200; sprite.x = 168 * 0x200;
sprite.y = 64 * 0x200; sprite.y = 64 * 0x200;

View file

@ -42,8 +42,7 @@ void ClearFade(void)
void StartFadeOut(signed char dir) void StartFadeOut(signed char dir)
{ {
int x; int x, y;
int y;
gFade.mode = 2; gFade.mode = 2;
gFade.count = 0; gFade.count = 0;
@ -62,8 +61,7 @@ void StartFadeOut(signed char dir)
void StartFadeIn(signed char dir) void StartFadeIn(signed char dir)
{ {
int x; int x, y;
int y;
gFade.mode = 1; gFade.mode = 1;
gFade.count = 0; gFade.count = 0;
@ -84,8 +82,7 @@ void StartFadeIn(signed char dir)
void ProcFade(void) void ProcFade(void)
{ {
int x; int x, y;
int y;
switch (gFade.mode) switch (gFade.mode)
{ {
@ -236,8 +233,7 @@ void ProcFade(void)
void PutFade(void) void PutFade(void)
{ {
int x; int x, y;
int y;
RECT rect; RECT rect;
rect.top = 0; rect.top = 0;

View file

@ -37,7 +37,7 @@ void SetFlash(int x, int y, int mode)
void ActFlash_Explosion(int flx, int fly) void ActFlash_Explosion(int flx, int fly)
{ {
int left, right, top, bottom; int left, top, right, bottom;
switch (flash.act_no) switch (flash.act_no)
{ {

View file

@ -112,12 +112,13 @@ void GetFramePosition(int *fx, int *fy)
void SetFramePosition(int fx, int fy) void SetFramePosition(int fx, int fy)
{ {
short map_w, map_l;
// End quake // End quake
gFrame.quake = 0; gFrame.quake = 0;
gFrame.quake2 = 0; gFrame.quake2 = 0;
// Move frame position // Move frame position
short map_w, map_l;
GetMapData(0, &map_w, &map_l); GetMapData(0, &map_w, &map_l);
gFrame.x = fx; gFrame.x = fx;
@ -186,11 +187,12 @@ void SetFramePosition(int fx, int fy)
void SetFrameMyChar(void) void SetFrameMyChar(void)
{ {
// Move frame position
int mc_x, mc_y; int mc_x, mc_y;
short map_w, map_l;
// Move frame position
GetMyCharPosition(&mc_x, &mc_y); GetMyCharPosition(&mc_x, &mc_y);
short map_w, map_l;
GetMapData(0, &map_w, &map_l); GetMapData(0, &map_w, &map_l);
gFrame.x = mc_x - ((WINDOW_WIDTH / 2) * 0x200); gFrame.x = mc_x - ((WINDOW_WIDTH / 2) * 0x200);

View file

@ -11,26 +11,28 @@
void GetCompileDate(int *year, int *month, int *day) void GetCompileDate(int *year, int *month, int *day)
{ {
int i; int i;
const char *months[13]; char strMonth[0x10];
char month_string[0x10];
months[0] = "XXX"; const char *table[13] = {
months[1] = "Jan"; "XXX",
months[2] = "Feb"; "Jan",
months[3] = "Mar"; "Feb",
months[4] = "Apr"; "Mar",
months[5] = "May"; "Apr",
months[6] = "Jun"; "May",
months[7] = "Jul"; "Jun",
months[8] = "Aug"; "Jul",
months[9] = "Sep"; "Aug",
months[10] = "Oct"; "Sep",
months[11] = "Nov"; "Oct",
months[12] = "Dec"; "Nov",
sscanf(__DATE__, "%s %d %d", month_string, day, year); // The expansion of __DATE__ is not reproductible. TODO : Think about changing this to be reproductible "Dec",
};
sscanf(__DATE__, "%s %d %d", strMonth, day, year); // The expansion of __DATE__ is not reproductible. TODO : Think about changing this to be reproductible
for (i = 0; i < 12; ++i) // This being 12 instead of 13 might be a bug, but it works anyway by accident for (i = 0; i < 12; ++i) // This being 12 instead of 13 might be a bug, but it works anyway by accident
if (!memcmp(&month_string, months[i], 3)) if (!memcmp(&strMonth, table[i], 3))
break; break;
*month = i; *month = i;
@ -131,14 +133,17 @@ BOOL IsShiftJIS(unsigned char c)
return FALSE; return FALSE;
} }
const char *extra_text = "(C)Pixel";
BOOL IsEnableBitmap(const char *path) BOOL IsEnableBitmap(const char *path)
{ {
FILE *fp;
long len;
char str[16]; char str[16];
static const char *extra_text = "(C)Pixel";
const long len = (long)strlen(extra_text); len = (long)strlen(extra_text);
FILE *fp = fopen(path, "rb"); fp = fopen(path, "rb");
if (fp == NULL) if (fp == NULL)
return FALSE; return FALSE;

View file

@ -155,9 +155,8 @@ static const PIXTONEPARAMETER gPtpTable[139] =
BOOL LoadGenericData(void) BOOL LoadGenericData(void)
{ {
char str[0x40];
BOOL bError;
int pt_size; int pt_size;
BOOL bError;
MakeSurface_Resource("PIXEL", SURFACE_ID_PIXEL); MakeSurface_Resource("PIXEL", SURFACE_ID_PIXEL);
@ -293,6 +292,8 @@ BOOL LoadGenericData(void)
pt_size += MakePixToneObject(&gPtpTable[136], 1, 3); pt_size += MakePixToneObject(&gPtpTable[136], 1, 3);
pt_size += MakePixToneObject(&gPtpTable[137], 1, 6); pt_size += MakePixToneObject(&gPtpTable[137], 1, 6);
pt_size += MakePixToneObject(&gPtpTable[138], 1, 7); pt_size += MakePixToneObject(&gPtpTable[138], 1, 7);
char str[0x40];
sprintf(str, "PixTone = %d byte", pt_size); sprintf(str, "PixTone = %d byte", pt_size);
// There must have been some kind of console print function here or something // There must have been some kind of console print function here or something
return TRUE; return TRUE;

View file

@ -27,13 +27,13 @@
char gModulePath[MAX_PATH]; char gModulePath[MAX_PATH];
char gDataPath[MAX_PATH]; char gDataPath[MAX_PATH];
int gJoystickButtonTable[8];
BOOL bFullscreen; BOOL bFullscreen;
BOOL gbUseJoystick = FALSE; BOOL gbUseJoystick = FALSE;
static BOOL bFps = FALSE; int gJoystickButtonTable[8];
static BOOL bActive = TRUE; static BOOL bActive = TRUE;
static BOOL bFps = FALSE;
static int windowWidth; static int windowWidth;
static int windowHeight; static int windowHeight;

View file

@ -17,7 +17,7 @@
MAP_DATA gMap; MAP_DATA gMap;
static const char *code_pxma = "PXM"; const char *code_pxma = "PXM";
BOOL InitMapData2(void) BOOL InitMapData2(void)
{ {
@ -27,19 +27,19 @@ BOOL InitMapData2(void)
BOOL LoadMapData2(const char *path_map) BOOL LoadMapData2(const char *path_map)
{ {
unsigned char dum; FILE *fp;
char check[3];
char path[MAX_PATH];
// Get path // Get path
char path[MAX_PATH];
sprintf(path, "%s/%s", gDataPath, path_map); sprintf(path, "%s/%s", gDataPath, path_map);
// Open file // Open file
FILE *fp = fopen(path, "rb"); fp = fopen(path, "rb");
if (fp == NULL) if (fp == NULL)
return FALSE; return FALSE;
// Make sure file begins with "PXM" // Make sure file begins with "PXM"
char check[3];
fread(check, 1, 3, fp); fread(check, 1, 3, fp);
if (memcmp(check, code_pxma, 3)) if (memcmp(check, code_pxma, 3))
@ -48,6 +48,7 @@ BOOL LoadMapData2(const char *path_map)
return FALSE; return FALSE;
} }
unsigned char dum;
fread(&dum, 1, 1, fp); fread(&dum, 1, 1, fp);
// Get width and height // Get width and height
gMap.width = File_ReadLE16(fp); gMap.width = File_ReadLE16(fp);
@ -67,11 +68,13 @@ BOOL LoadMapData2(const char *path_map)
BOOL LoadAttributeData(const char *path_atrb) BOOL LoadAttributeData(const char *path_atrb)
{ {
// Open file FILE *fp;
char path[MAX_PATH]; char path[MAX_PATH];
// Open file
sprintf(path, "%s/%s", gDataPath, path_atrb); sprintf(path, "%s/%s", gDataPath, path_atrb);
FILE *fp = fopen(path, "rb"); fp = fopen(path, "rb");
if (fp == NULL) if (fp == NULL)
return FALSE; return FALSE;
@ -105,10 +108,12 @@ void GetMapData(unsigned char **data, short *mw, short *ml)
unsigned char GetAttribute(int x, int y) unsigned char GetAttribute(int x, int y)
{ {
size_t a;
if (x < 0 || y < 0 || x >= gMap.width || y >= gMap.length) if (x < 0 || y < 0 || x >= gMap.width || y >= gMap.length)
return 0; return 0;
const size_t a = *(gMap.data + x + (y * gMap.width)); // Yes, the original code really does do this instead of a regular array access a = *(gMap.data + x + (y * gMap.width)); // Yes, the original code really does do this instead of a regular array access
return gMap.atrb[a]; return gMap.atrb[a];
} }
@ -139,21 +144,17 @@ BOOL ChangeMapParts(int x, int y, unsigned char no)
void PutStage_Back(int fx, int fy) void PutStage_Back(int fx, int fy)
{ {
int num_y; int i, j;
int put_x;
int put_y;
int i;
int j;
int offset;
int atrb;
RECT rect; RECT rect;
int num_x; int offset;
// Get range to draw // Get range to draw
num_x = ((WINDOW_WIDTH + (16 - 1)) / 16) + 1; int num_x = ((WINDOW_WIDTH + (16 - 1)) / 16) + 1;
num_y = ((WINDOW_HEIGHT + (16 - 1)) / 16) + 1; int num_y = ((WINDOW_HEIGHT + (16 - 1)) / 16) + 1;
put_x = ((fx / 0x200) + 8) / 16; int put_x = ((fx / 0x200) + 8) / 16;
put_y = ((fy / 0x200) + 8) / 16; int put_y = ((fy / 0x200) + 8) / 16;
int atrb;
for (j = put_y; j < put_y + num_y; ++j) for (j = put_y; j < put_y + num_y; ++j)
{ {
@ -180,21 +181,17 @@ void PutStage_Back(int fx, int fy)
void PutStage_Front(int fx, int fy) void PutStage_Front(int fx, int fy)
{ {
RECT rcSnack = {256, 48, 272, 64}; RECT rcSnack = {256, 48, 272, 64};
int num_y; int i, j;
int put_x;
int put_y;
int j;
int i;
int offset;
int atrb;
RECT rect; RECT rect;
int num_x; int offset;
// Get range to draw // Get range to draw
num_x = ((WINDOW_WIDTH + (16 - 1)) / 16) + 1; int num_x = ((WINDOW_WIDTH + (16 - 1)) / 16) + 1;
num_y = ((WINDOW_HEIGHT + (16 - 1)) / 16) + 1; int num_y = ((WINDOW_HEIGHT + (16 - 1)) / 16) + 1;
put_x = ((fx / 0x200) + 8) / 16; int put_x = ((fx / 0x200) + 8) / 16;
put_y = ((fy / 0x200) + 8) / 16; int put_y = ((fy / 0x200) + 8) / 16;
int atrb;
for (j = put_y; j < put_y + num_y; ++j) for (j = put_y; j < put_y + num_y; ++j)
{ {
@ -223,18 +220,20 @@ void PutStage_Front(int fx, int fy)
void PutMapDataVector(int fx, int fy) void PutMapDataVector(int fx, int fy)
{ {
int i, j;
RECT rect;
int offset;
int num_x;
int num_y; int num_y;
int put_x; int put_x;
int put_y; int put_y;
int i;
int j; static unsigned char count = 0;
int offset;
int atrb; int atrb;
RECT rect;
int num_x;
// Animate the wind // Animate the wind
static unsigned char count = 0;
count += 2; count += 2;
// Get range to draw // Get range to draw

View file

@ -129,9 +129,9 @@ void StartMapName(void)
void RestoreMapName(void) void RestoreMapName(void)
{ {
int len = (int)strlen(gMapName.name); int a = (int)strlen(gMapName.name);
CortBox2(&rc, 0, SURFACE_ID_ROOM_NAME); CortBox2(&rc, 0, SURFACE_ID_ROOM_NAME);
PutText2(((160 - (len * 6)) / 2) + 6, 1, gMapName.name, RGB(0x11, 0x00, 0x22), SURFACE_ID_ROOM_NAME); PutText2(((160 - (a * 6)) / 2) + 6, 1, gMapName.name, RGB(0x11, 0x00, 0x22), SURFACE_ID_ROOM_NAME);
PutText2(((160 - (len * 6)) / 2) + 6, 0, gMapName.name, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_ROOM_NAME); PutText2(((160 - (a * 6)) / 2) + 6, 0, gMapName.name, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_ROOM_NAME);
} }

View file

@ -14,8 +14,6 @@
#include "MyChar.h" #include "MyChar.h"
#include "Stage.h" #include "Stage.h"
char gMapping[0x80];
void WriteMiniMapLine(int line) void WriteMiniMapLine(int line)
{ {
int x; int x;
@ -77,16 +75,17 @@ void WriteMiniMapLine(int line)
int MiniMapLoop(void) int MiniMapLoop(void)
{ {
int f; int f, line;
int line;
unsigned char my_wait;
RECT rcMiniMap;
RECT rcView; RECT rcView;
RECT rcMiniMap;
int my_x;
int my_y;
unsigned char my_wait;
RECT my_rect = {0, 57, 1, 58}; RECT my_rect = {0, 57, 1, 58};
int my_x = ((gMC.x / 0x200) + 8) / 16;
int my_y = ((gMC.y / 0x200) + 8) / 16; my_x = ((gMC.x / 0x200) + 8) / 16;
my_y = ((gMC.y / 0x200) + 8) / 16;
for (f = 0; f <= 8; ++f) for (f = 0; f <= 8; ++f)
{ {
@ -211,6 +210,8 @@ int MiniMapLoop(void)
return enum_ESCRETURN_continue; return enum_ESCRETURN_continue;
} }
char gMapping[0x80];
BOOL IsMapping(void) BOOL IsMapping(void)
{ {
if (!gMapping[gStageNo]) if (!gMapping[gStageNo])

View file

@ -19,9 +19,6 @@
MYCHAR gMC; MYCHAR gMC;
int noise_no;
unsigned int noise_freq;
void InitMyChar(void) void InitMyChar(void)
{ {
memset(&gMC, 0, sizeof(MYCHAR)); memset(&gMC, 0, sizeof(MYCHAR));
@ -253,8 +250,7 @@ void ActMyChar_Normal(BOOL bKey)
int dash2; int dash2;
int resist; int resist;
int a; int a, x;
int x;
if (gMC.cond & 2) if (gMC.cond & 2)
return; return;
@ -933,6 +929,8 @@ int GetUnitMyChar(void)
void SetMyCharDirect(unsigned char dir) void SetMyCharDirect(unsigned char dir)
{ {
int i;
if (dir == 3) if (dir == 3)
{ {
gMC.cond |= 1; gMC.cond |= 1;
@ -947,8 +945,6 @@ void SetMyCharDirect(unsigned char dir)
} }
else else
{ {
int i;
for (i = 0; i < NPC_MAX; ++i) for (i = 0; i < NPC_MAX; ++i)
if (gNPC[i].code_event == dir) if (gNPC[i].code_event == dir)
break; break;
@ -990,6 +986,9 @@ void ResetCheck(void)
gMC.cond &= ~1; gMC.cond &= ~1;
} }
int noise_no;
unsigned int noise_freq;
void SetNoise(int no, int freq) void SetNoise(int no, int freq)
{ {
noise_freq = freq; noise_freq = freq;

View file

@ -409,10 +409,12 @@ int JudgeHitMyCharVectDown(int x, int y)
void HitMyCharMap(void) void HitMyCharMap(void)
{ {
int x, y;
int i; int i;
unsigned char atrb[4];
int x = gMC.x / 0x10 / 0x200; x = gMC.x / 0x10 / 0x200;
int y = gMC.y / 0x10 / 0x200; y = gMC.y / 0x10 / 0x200;
int offx[4]; int offx[4];
int offy[4]; int offy[4];
@ -427,7 +429,6 @@ void HitMyCharMap(void)
offy[2] = 1; offy[2] = 1;
offy[3] = 1; offy[3] = 1;
unsigned char atrb[4];
for (i = 0; i < 4; ++i) for (i = 0; i < 4; ++i)
{ {
atrb[i] = GetAttribute(x + offx[i], y + offy[i]); atrb[i] = GetAttribute(x + offx[i], y + offy[i]);
@ -666,13 +667,13 @@ unsigned char JudgeHitMyCharNPC3(NPCHAR *npc)
int JudgeHitMyCharNPC4(NPCHAR *npc) int JudgeHitMyCharNPC4(NPCHAR *npc)
{ {
// TODO: comment this // TODO: comment this
int hit = 0;
float fy1;
float fx1; float fx1;
float fx2; float fx2;
float fy1;
float fy2; float fy2;
int hit = 0;
if (npc->x > gMC.x) if (npc->x > gMC.x)
fx1 = (float)(npc->x - gMC.x); fx1 = (float)(npc->x - gMC.x);
else else
@ -768,7 +769,6 @@ int JudgeHitMyCharNPC4(NPCHAR *npc)
void HitMyCharNpChar(void) void HitMyCharNpChar(void)
{ {
int i; int i;
int hit = 0; int hit = 0;
if (!(gMC.cond & 0x80) || gMC.cond & 2) if (!(gMC.cond & 0x80) || gMC.cond & 2)
@ -859,7 +859,6 @@ void HitMyCharNpChar(void)
void HitMyCharBoss(void) void HitMyCharBoss(void)
{ {
int b; int b;
int hit = 0; int hit = 0;
if (!(gMC.cond & 0x80) || gMC.cond & 2) if (!(gMC.cond & 0x80) || gMC.cond & 2)

View file

@ -37,8 +37,6 @@ ARMS_LEVEL gArmsLevelTable[14] =
{{40, 60, 200}} {{40, 60, 200}}
}; };
int time_count;
void AddExpMyChar(int x) void AddExpMyChar(int x)
{ {
int lv = gArmsData[gSelectedArms].level - 1; int lv = gArmsData[gSelectedArms].level - 1;
@ -96,9 +94,11 @@ void ZeroExpMyChar(void)
BOOL IsMaxExpMyChar(void) BOOL IsMaxExpMyChar(void)
{ {
int arms_code;
if (gArmsData[gSelectedArms].level == 3) if (gArmsData[gSelectedArms].level == 3)
{ {
int arms_code = gArmsData[gSelectedArms].code; arms_code = gArmsData[gSelectedArms].code;
if (gArmsData[gSelectedArms].exp >= gArmsLevelTable[arms_code].exp[2]) if (gArmsData[gSelectedArms].exp >= gArmsLevelTable[arms_code].exp[2])
return TRUE; return TRUE;
@ -235,15 +235,7 @@ void AddMaxLifeMyChar(int val)
void PutArmsEnergy(BOOL flash) void PutArmsEnergy(BOOL flash)
{ {
RECT rcExpBox; static unsigned char add_flash;
RECT rcExpVal;
RECT rcExpMax;
RECT rcExpFlash;
int lv;
int arms_code;
int exp_now;
int exp_next;
RECT rcPer = {72, 48, 80, 56}; RECT rcPer = {72, 48, 80, 56};
RECT rcLv = {80, 80, 96, 88}; RECT rcLv = {80, 80, 96, 88};
@ -275,15 +267,15 @@ void PutArmsEnergy(BOOL flash)
PutBitmap3(&rcView, gArmsEnergyX, 32, &rcLv, SURFACE_ID_TEXT_BOX); PutBitmap3(&rcView, gArmsEnergyX, 32, &rcLv, SURFACE_ID_TEXT_BOX);
PutNumber4(gArmsEnergyX - 8, 32, gArmsData[gSelectedArms].level, FALSE); PutNumber4(gArmsEnergyX - 8, 32, gArmsData[gSelectedArms].level, FALSE);
SET_RECT(rcExpBox, 0, 72, 40, 80) RECT rcExpBox = {0, 72, 40, 80};
SET_RECT(rcExpVal, 0, 80, 0, 88) RECT rcExpVal = {0, 80, 0, 88};
SET_RECT(rcExpMax, 40, 72, 80, 80) RECT rcExpMax = {40, 72, 80, 80};
SET_RECT(rcExpFlash, 40, 80, 80, 88) RECT rcExpFlash = {40, 80, 80, 88};
lv = gArmsData[gSelectedArms].level - 1; int lv = gArmsData[gSelectedArms].level - 1;
arms_code = gArmsData[gSelectedArms].code; int arms_code = gArmsData[gSelectedArms].code;
exp_now = gArmsData[gSelectedArms].exp; int exp_now = gArmsData[gSelectedArms].exp;
exp_next = gArmsLevelTable[arms_code].exp[lv]; int exp_next = gArmsLevelTable[arms_code].exp[lv];
PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpBox, SURFACE_ID_TEXT_BOX); PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpBox, SURFACE_ID_TEXT_BOX);
@ -301,7 +293,6 @@ void PutArmsEnergy(BOOL flash)
PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpVal, SURFACE_ID_TEXT_BOX); PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpVal, SURFACE_ID_TEXT_BOX);
} }
static unsigned char add_flash;
if (gMC.exp_wait && ((add_flash++ / 2) % 2)) if (gMC.exp_wait && ((add_flash++ / 2) % 2))
PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpFlash, SURFACE_ID_TEXT_BOX); PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpFlash, SURFACE_ID_TEXT_BOX);
} }
@ -310,10 +301,9 @@ void PutActiveArmsList(void)
{ {
int x; int x;
int a; int a;
int arms_num;
RECT rect = {0, 0, 0, 16}; RECT rect = {0, 0, 0, 16};
arms_num = 0; int arms_num = 0;
while (gArmsData[arms_num].code != 0) while (gArmsData[arms_num].code != 0)
++arms_num; ++arms_num;
@ -399,6 +389,8 @@ void PutMyAir(int x, int y)
} }
} }
int time_count;
void PutTimeCounter(int x, int y) void PutTimeCounter(int x, int y)
{ {
RECT rcTime[3] = { RECT rcTime[3] = {
@ -439,20 +431,20 @@ void PutTimeCounter(int x, int y)
BOOL SaveTimeCounter(void) BOOL SaveTimeCounter(void)
{ {
unsigned char *p;
int i; int i;
unsigned char *p;
REC rec; REC rec;
FILE *fp;
char path[MAX_PATH];
// Quit if player doesn't have the Nikumaru Counter // Quit if player doesn't have the Nikumaru Counter
if (!(gMC.equip & 0x100)) if (!(gMC.equip & 0x100))
return TRUE; return TRUE;
// Get last time // Get last time
char path[MAX_PATH];
sprintf(path, "%s/290.rec", gModulePath); sprintf(path, "%s/290.rec", gModulePath);
FILE *fp = fopen(path, "rb"); fp = fopen(path, "rb");
if (fp) if (fp)
{ {
// Read data // Read data
@ -508,19 +500,19 @@ BOOL SaveTimeCounter(void)
int LoadTimeCounter(void) int LoadTimeCounter(void)
{ {
unsigned char *p;
int i; int i;
unsigned char *p;
REC rec;
FILE *fp;
char path[MAX_PATH];
// Open file // Open file
char path[MAX_PATH];
sprintf(path, "%s/290.rec", gModulePath); sprintf(path, "%s/290.rec", gModulePath);
FILE *fp = fopen(path, "rb"); fp = fopen(path, "rb");
if (!fp) if (!fp)
return 0; return 0;
REC rec;
// Read data // Read data
rec.counter[0] = File_ReadLE32(fp); rec.counter[0] = File_ReadLE32(fp);
rec.counter[1] = File_ReadLE32(fp); rec.counter[1] = File_ReadLE32(fp);
@ -548,9 +540,7 @@ int LoadTimeCounter(void)
time_count = 0; time_count = 0;
return 0; return 0;
} }
else
{
time_count = rec.counter[0]; time_count = rec.counter[0];
return time_count; return time_count;
} }
}

View file

@ -53,14 +53,13 @@ void SetUniqueParameter(NPCHAR *npc)
BOOL LoadEvent(const char *path_event) BOOL LoadEvent(const char *path_event)
{ {
int i, n;
FILE *fp; FILE *fp;
int count; int count;
int i;
int n;
EVENT eve;
char path[MAX_PATH];
char code[4]; char code[4];
EVENT eve;
char path[MAX_PATH];
sprintf(path, "%s/%s", gDataPath, path_event); sprintf(path, "%s/%s", gDataPath, path_event);
fp = fopen(path, "rb"); fp = fopen(path, "rb");
@ -195,8 +194,10 @@ void SetDestroyNpCharUp(int x, int y, int w, int num)
void SetExpObjects(int x, int y, int exp) void SetExpObjects(int x, int y, int exp)
{ {
int n;
int sub_exp; int sub_exp;
int n = 0x100;
n = 0x100;
while (exp) while (exp)
{ {
while (n < NPC_MAX && gNPC[n].cond) while (n < NPC_MAX && gNPC[n].cond)
@ -316,8 +317,10 @@ BOOL SetLifeObject(int x, int y, int val)
void VanishNpChar(NPCHAR *npc) void VanishNpChar(NPCHAR *npc)
{ {
int x = npc->x; int x, y;
int y = npc->y;
x = npc->x;
y = npc->y;
memset(npc, 0, sizeof(NPCHAR)); memset(npc, 0, sizeof(NPCHAR));
npc->count1 = 0; npc->count1 = 0;
npc->x = x; npc->x = x;
@ -335,12 +338,12 @@ void PutNpChar(int fx, int fy)
int n; int n;
signed char a = 0; signed char a = 0;
int side;
for (n = 0; n < NPC_MAX; ++n) for (n = 0; n < NPC_MAX; ++n)
{ {
if (gNPC[n].cond & 0x80) if (gNPC[n].cond & 0x80)
{ {
int side;
if (gNPC[n].shock) if (gNPC[n].shock)
{ {
a = 2 * ((gNPC[n].shock / 2) % 2) - 1; a = 2 * ((gNPC[n].shock / 2) % 2) - 1;
@ -373,12 +376,13 @@ void PutNpChar(int fx, int fy)
void ActNpChar(void) void ActNpChar(void)
{ {
int i; int i;
int code_char;
for (i = 0; i < NPC_MAX; ++i) for (i = 0; i < NPC_MAX; ++i)
{ {
if (gNPC[i].cond & 0x80) if (gNPC[i].cond & 0x80)
{ {
int code_char = gNPC[i].code_char; code_char = gNPC[i].code_char;
gpNpcFuncTbl[code_char](&gNPC[i]); gpNpcFuncTbl[code_char](&gNPC[i]);

View file

@ -917,8 +917,7 @@ void ActNpc009(NPCHAR *npc)
void ActNpc010(NPCHAR *npc) void ActNpc010(NPCHAR *npc)
{ {
unsigned char deg; unsigned char deg;
int ym; int xm, ym;
int xm;
switch (npc->act_no) switch (npc->act_no)
{ {
@ -1075,8 +1074,7 @@ void ActNpc011(NPCHAR *npc)
void ActNpc012(NPCHAR *npc) void ActNpc012(NPCHAR *npc)
{ {
int i; int i;
int x; int x, y;
int y;
switch (npc->act_no) switch (npc->act_no)
{ {
@ -1429,14 +1427,14 @@ void ActNpc013(NPCHAR *npc)
// Santa's Key // Santa's Key
void ActNpc014(NPCHAR *npc) void ActNpc014(NPCHAR *npc)
{ {
int i;
RECT rect[3] = { RECT rect[3] = {
{192, 0, 208, 16}, {192, 0, 208, 16},
{208, 0, 224, 16}, {208, 0, 224, 16},
{224, 0, 240, 16}, {224, 0, 240, 16},
}; };
int i;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:
@ -1474,14 +1472,14 @@ void ActNpc014(NPCHAR *npc)
// Chest (closed) // Chest (closed)
void ActNpc015(NPCHAR *npc) void ActNpc015(NPCHAR *npc)
{ {
int i;
RECT rcLeft[3] = { RECT rcLeft[3] = {
{240, 0, 256, 16}, {240, 0, 256, 16},
{256, 0, 272, 16}, {256, 0, 272, 16},
{272, 0, 288, 16}, {272, 0, 288, 16},
}; };
int i;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:
@ -1533,8 +1531,6 @@ void ActNpc015(NPCHAR *npc)
// Save point // Save point
void ActNpc016(NPCHAR *npc) void ActNpc016(NPCHAR *npc)
{ {
int i;
RECT rect[8] = { RECT rect[8] = {
{96, 16, 112, 32}, {96, 16, 112, 32},
{112, 16, 128, 32}, {112, 16, 128, 32},
@ -1546,6 +1542,8 @@ void ActNpc016(NPCHAR *npc)
{208, 16, 224, 32}, {208, 16, 224, 32},
}; };
int i;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:

View file

@ -1096,10 +1096,9 @@ void ActNpc035(NPCHAR *npc)
// Balrog (hover) // Balrog (hover)
void ActNpc036(NPCHAR *npc) void ActNpc036(NPCHAR *npc)
{ {
unsigned char deg;
int ym;
int xm;
int i; int i;
unsigned char deg;
int xm, ym;
switch (npc->act_no) switch (npc->act_no)
{ {

View file

@ -118,6 +118,8 @@ void ActNpc041(NPCHAR *npc)
// Sue // Sue
void ActNpc042(NPCHAR *npc) void ActNpc042(NPCHAR *npc)
{ {
int n;
RECT rcLeft[13] = { RECT rcLeft[13] = {
{0, 0, 16, 16}, {0, 0, 16, 16},
{16, 0, 32, 16}, {16, 0, 32, 16},
@ -150,8 +152,6 @@ void ActNpc042(NPCHAR *npc)
{160, 48, 176, 64}, {160, 48, 176, 64},
}; };
int n;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:
@ -870,8 +870,7 @@ void ActNpc048(NPCHAR *npc)
void ActNpc049(NPCHAR *npc) void ActNpc049(NPCHAR *npc)
{ {
unsigned char deg; unsigned char deg;
int ym; int xm, ym;
int xm;
if (npc->act_no >= 10 && npc->pNpc->code_char == 3) if (npc->act_no >= 10 && npc->pNpc->code_char == 3)
{ {
@ -1916,8 +1915,8 @@ void ActNpc058(NPCHAR *npc)
if ((++npc->count2 % 8) == 0 && npc->x < gMC.x + (160 * 0x200) && npc->x > gMC.x - (160 * 0x200)) // TODO: Maybe do something about this for widescreen if ((++npc->count2 % 8) == 0 && npc->x < gMC.x + (160 * 0x200) && npc->x > gMC.x - (160 * 0x200)) // TODO: Maybe do something about this for widescreen
{ {
unsigned char deg; unsigned char deg;
int ym;
int xm; int xm;
int ym;
deg = GetArktan(npc->x - gMC.x, npc->y - gMC.y); deg = GetArktan(npc->x - gMC.x, npc->y - gMC.y);
deg += (unsigned char)Random(-6, 6); deg += (unsigned char)Random(-6, 6);

View file

@ -199,6 +199,8 @@ void ActNpc060(NPCHAR *npc)
// King // King
void ActNpc061(NPCHAR *npc) void ActNpc061(NPCHAR *npc)
{ {
int i;
RECT rcLeft[11] = { RECT rcLeft[11] = {
{224, 32, 240, 48}, {224, 32, 240, 48},
{240, 32, 256, 48}, {240, 32, 256, 48},
@ -227,8 +229,6 @@ void ActNpc061(NPCHAR *npc)
{112, 32, 128, 48}, {112, 32, 128, 48},
}; };
int i;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:

View file

@ -877,8 +877,7 @@ void ActNpc088(NPCHAR *npc)
{ {
int i; int i;
unsigned char deg; unsigned char deg;
int xm; int xm, ym;
int ym;
RECT rcLeft[12] = { RECT rcLeft[12] = {
{0, 0, 40, 40}, {0, 0, 40, 40},

View file

@ -1068,14 +1068,14 @@ void ActNpc113(NPCHAR *npc)
// Press // Press
void ActNpc114(NPCHAR *npc) void ActNpc114(NPCHAR *npc)
{ {
int i;
RECT rcLeft[3] = { RECT rcLeft[3] = {
{144, 112, 160, 136}, {144, 112, 160, 136},
{160, 112, 176, 136}, {160, 112, 176, 136},
{176, 112, 192, 136}, {176, 112, 192, 136},
}; };
int i;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:
@ -1521,6 +1521,8 @@ void ActNpc117(NPCHAR *npc)
// Curly (boss) // Curly (boss)
void ActNpc118(NPCHAR *npc) void ActNpc118(NPCHAR *npc)
{ {
BOOL bUpper;
RECT rcLeft[9] = { RECT rcLeft[9] = {
{0, 32, 32, 56}, {0, 32, 32, 56},
{32, 32, 64, 56}, {32, 32, 64, 56},
@ -1545,7 +1547,7 @@ void ActNpc118(NPCHAR *npc)
{160, 56, 192, 80}, {160, 56, 192, 80},
}; };
BOOL bUpper = FALSE; bUpper = FALSE;
if (npc->direct == 0 && npc->x < gMC.x) if (npc->direct == 0 && npc->x < gMC.x)
bUpper = TRUE; bUpper = TRUE;

View file

@ -1090,8 +1090,7 @@ void ActNpc134(NPCHAR *npc)
void ActNpc135(NPCHAR *npc) void ActNpc135(NPCHAR *npc)
{ {
unsigned char deg; unsigned char deg;
int ym; int xm, ym;
int xm;
RECT rcLeft[2] = { RECT rcLeft[2] = {
{256, 32, 288, 64}, {256, 32, 288, 64},

View file

@ -764,9 +764,8 @@ void ActNpc146(NPCHAR *npc)
// Critter (purple) // Critter (purple)
void ActNpc147(NPCHAR *npc) void ActNpc147(NPCHAR *npc)
{ {
int xm, ym;
unsigned char deg; unsigned char deg;
int xm;
int ym;
RECT rcLeft[6] = { RECT rcLeft[6] = {
{0, 96, 16, 112}, {0, 96, 16, 112},
@ -1349,7 +1348,7 @@ void ActNpc152(NPCHAR *npc)
npc->rect = rc; npc->rect = rc;
} }
static const RECT grcKitL[21] = { const RECT grcKitL[21] = {
{0, 0, 24, 24}, {0, 0, 24, 24},
{24, 0, 48, 24}, {24, 0, 48, 24},
{48, 0, 72, 24}, {48, 0, 72, 24},
@ -1373,7 +1372,7 @@ static const RECT grcKitL[21] = {
{96, 48, 120, 72} {96, 48, 120, 72}
}; };
static const RECT grcKitR[21] = { const RECT grcKitR[21] = {
{0, 24, 24, 48}, {0, 24, 24, 48},
{24, 24, 48, 48}, {24, 24, 48, 48},
{48, 24, 72, 48}, {48, 24, 72, 48},
@ -1624,8 +1623,7 @@ void ActNpc154(NPCHAR *npc)
void ActNpc155(NPCHAR *npc) void ActNpc155(NPCHAR *npc)
{ {
unsigned char deg; unsigned char deg;
int ym; int xm, ym;
int xm;
if (npc->x > gMC.x + (((WINDOW_WIDTH / 2) + 160) * 0x200) || npc->x < gMC.x - (((WINDOW_WIDTH / 2) + 160) * 0x200) || npc->y > gMC.y + (((WINDOW_HEIGHT / 2) + 120) * 0x200) || npc->y < gMC.y - (((WINDOW_HEIGHT / 2) + 120) * 0x200)) if (npc->x > gMC.x + (((WINDOW_WIDTH / 2) + 160) * 0x200) || npc->x < gMC.x - (((WINDOW_WIDTH / 2) + 160) * 0x200) || npc->y > gMC.y + (((WINDOW_HEIGHT / 2) + 120) * 0x200) || npc->y < gMC.y - (((WINDOW_HEIGHT / 2) + 120) * 0x200))
return; return;

View file

@ -1071,8 +1071,7 @@ void ActNpc172(NPCHAR *npc)
void ActNpc173(NPCHAR *npc) void ActNpc173(NPCHAR *npc)
{ {
unsigned char deg; unsigned char deg;
int xm; int xm, ym;
int ym;
RECT rcLeft[4] = { RECT rcLeft[4] = {
{0, 128, 24, 152}, {0, 128, 24, 152},

View file

@ -19,8 +19,7 @@
// Curly AI // Curly AI
void ActNpc180(NPCHAR *npc) void ActNpc180(NPCHAR *npc)
{ {
int xx; int xx, yy;
int yy;
RECT rcLeft[11] = { RECT rcLeft[11] = {
{0, 96, 16, 112}, {0, 96, 16, 112},
@ -978,13 +977,13 @@ void ActNpc189(NPCHAR *npc)
// Broken robot // Broken robot
void ActNpc190(NPCHAR *npc) void ActNpc190(NPCHAR *npc)
{ {
int i;
RECT rect[2] = { RECT rect[2] = {
{192, 32, 208, 48}, {192, 32, 208, 48},
{208, 32, 224, 48}, {208, 32, 224, 48},
}; };
int i;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:

View file

@ -17,8 +17,7 @@
void ActNpc200(NPCHAR *npc) void ActNpc200(NPCHAR *npc)
{ {
unsigned char deg; unsigned char deg;
int ym; int xm, ym;
int xm;
RECT rcLeft[6] = { RECT rcLeft[6] = {
{0, 0, 40, 40}, {0, 0, 40, 40},
@ -475,8 +474,8 @@ void ActNpc206(NPCHAR *npc)
case 3: case 3:
switch (npc->act_wait) switch (npc->act_wait)
{ {
// Interestingly, this NPC counts down at 60 frames per second, // Interestingly, this NPC counts down at 60 frames
// while the NPC322 (Deleet), counts at 50. // per second, while NPC322 (Deleet) counts at 50.
case 60 * 0: case 60 * 0:
SetNpChar(207, npc->x + (16 * 0x200), npc->y + (4 * 0x200), 0, 0, 0, NULL, 0x100); SetNpChar(207, npc->x + (16 * 0x200), npc->y + (4 * 0x200), 0, 0, 0, NULL, 0x100);
break; break;

View file

@ -1129,11 +1129,11 @@ void ActNpc236(NPCHAR *npc)
// Gunfish projectile // Gunfish projectile
void ActNpc237(NPCHAR *npc) void ActNpc237(NPCHAR *npc)
{ {
RECT rc = {312, 32, 320, 40};
int i; int i;
BOOL bHit; BOOL bHit;
RECT rc = {312, 32, 320, 40};
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:

View file

@ -318,12 +318,14 @@ void ActNpc243(NPCHAR *npc)
// Lava drop // Lava drop
void ActNpc244(NPCHAR *npc) void ActNpc244(NPCHAR *npc)
{ {
RECT rc = {96, 0, 104, 16};
BOOL bHit;
int i; int i;
RECT rc = {96, 0, 104, 16};
npc->ym += 0x40; npc->ym += 0x40;
BOOL bHit = FALSE; bHit = FALSE;
if (npc->flag & 0xFF) if (npc->flag & 0xFF)
bHit = TRUE; bHit = TRUE;
@ -411,14 +413,14 @@ void ActNpc245(NPCHAR *npc)
// Press (proximity) // Press (proximity)
void ActNpc246(NPCHAR *npc) void ActNpc246(NPCHAR *npc)
{ {
int i;
RECT rcLeft[3] = { RECT rcLeft[3] = {
{144, 112, 160, 136}, {144, 112, 160, 136},
{160, 112, 176, 136}, {160, 112, 176, 136},
{176, 112, 192, 136}, {176, 112, 192, 136},
}; };
int i;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:
@ -504,8 +506,7 @@ void ActNpc246(NPCHAR *npc)
void ActNpc247(NPCHAR *npc) void ActNpc247(NPCHAR *npc)
{ {
unsigned char deg; unsigned char deg;
int ym; int xm, ym;
int xm;
RECT rcLeft[9] = { RECT rcLeft[9] = {
{0, 0, 16, 16}, {0, 0, 16, 16},

View file

@ -186,8 +186,7 @@ void ActNpc262(NPCHAR *npc)
void ActNpc263(NPCHAR *npc) void ActNpc263(NPCHAR *npc)
{ {
int deg; int deg;
int xm; int xm, ym;
int ym;
RECT rcLeft[9] = { RECT rcLeft[9] = {
{0, 0, 24, 32}, {0, 0, 24, 32},
@ -469,9 +468,8 @@ void ActNpc263(NPCHAR *npc)
// Doctor red wave (projectile) // Doctor red wave (projectile)
void ActNpc264(NPCHAR *npc) void ActNpc264(NPCHAR *npc)
{ {
unsigned char deg;
RECT rc = {288, 0, 304, 16}; RECT rc = {288, 0, 304, 16};
unsigned char deg;
if (npc->x < 0 || npc->x > gMap.width * 0x10 * 0x200) if (npc->x < 0 || npc->x > gMap.width * 0x10 * 0x200)
{ {
@ -597,8 +595,7 @@ void ActNpc267(NPCHAR *npc)
{40, 160, 80, 208}, {40, 160, 80, 208},
}; };
int ym; int xm, ym;
int xm;
int i; int i;
switch (npc->act_no) switch (npc->act_no)
@ -1133,8 +1130,7 @@ void ActNpc267(NPCHAR *npc)
void ActNpc268(NPCHAR *npc) void ActNpc268(NPCHAR *npc)
{ {
unsigned char deg; unsigned char deg;
int ym; int xm, ym;
int xm;
RECT rcLeft[10] = { RECT rcLeft[10] = {
{0, 0, 40, 40}, {0, 0, 40, 40},
@ -1631,8 +1627,7 @@ void ActNpc274(NPCHAR *npc)
}; };
unsigned char deg; unsigned char deg;
int ym; int xm, ym;
int xm;
switch (npc->act_no) switch (npc->act_no)
{ {
@ -1825,8 +1820,7 @@ void ActNpc276(NPCHAR *npc)
}; };
unsigned char deg; unsigned char deg;
int ym; int xm, ym;
int xm;
switch (npc->act_no) switch (npc->act_no)
{ {
@ -2158,13 +2152,13 @@ void ActNpc278(NPCHAR *npc)
// Falling block (large) // Falling block (large)
void ActNpc279(NPCHAR *npc) void ActNpc279(NPCHAR *npc)
{ {
int i;
RECT rc[2] = { RECT rc[2] = {
{0, 16, 32, 48}, {0, 16, 32, 48},
{16, 0, 32, 16}, {16, 0, 32, 16},
}; };
int i;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:

View file

@ -129,6 +129,7 @@ void ActNpc281(NPCHAR *npc)
// Mini Undead Core (active) // Mini Undead Core (active)
void ActNpc282(NPCHAR *npc) void ActNpc282(NPCHAR *npc)
{ {
// Yes, Pixel spelt this wrong (should be 'rc')
RECT tc[3] = { RECT tc[3] = {
{256, 80, 320, 120}, {256, 80, 320, 120},
{256, 0, 320, 40}, {256, 0, 320, 40},
@ -203,9 +204,7 @@ void ActNpc282(NPCHAR *npc)
// Misery (transformed) // Misery (transformed)
void ActNpc283(NPCHAR *npc) void ActNpc283(NPCHAR *npc)
{ {
int x; int x, y, direct;
int y;
int direct;
RECT rcLeft[11] = { RECT rcLeft[11] = {
{0, 64, 32, 96}, {0, 64, 32, 96},
@ -966,6 +965,7 @@ void ActNpc284(NPCHAR *npc)
void ActNpc285(NPCHAR *npc) void ActNpc285(NPCHAR *npc)
{ {
RECT rc = {232, 104, 248, 120}; RECT rc = {232, 104, 248, 120};
unsigned char deg;
if (npc->x < 0 || npc->x > gMap.width * 0x10 * 0x200) if (npc->x < 0 || npc->x > gMap.width * 0x10 * 0x200)
{ {
@ -973,8 +973,6 @@ void ActNpc285(NPCHAR *npc)
return; return;
} }
unsigned char deg;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:
@ -1422,9 +1420,7 @@ void ActNpc293(NPCHAR *npc)
// Quake + falling block generator // Quake + falling block generator
void ActNpc294(NPCHAR *npc) void ActNpc294(NPCHAR *npc)
{ {
int x; int x, y, dir;
int y;
int dir;
switch (npc->act_no) switch (npc->act_no)
{ {
@ -1567,10 +1563,7 @@ void ActNpc295(NPCHAR *npc)
// Cloud generator // Cloud generator
void ActNpc296(NPCHAR *npc) void ActNpc296(NPCHAR *npc)
{ {
int x; int x, y, dir, pri;
int y;
int dir;
int pri;
if (++npc->act_wait > 16) if (++npc->act_wait > 16)
{ {

View file

@ -35,6 +35,8 @@ void ActNpc300(NPCHAR *npc)
// Fish missile (Misery) // Fish missile (Misery)
void ActNpc301(NPCHAR *npc) void ActNpc301(NPCHAR *npc)
{ {
int dir;
RECT rect[8] = { RECT rect[8] = {
{144, 0, 160, 16}, {144, 0, 160, 16},
{160, 0, 176, 16}, {160, 0, 176, 16},
@ -46,8 +48,6 @@ void ActNpc301(NPCHAR *npc)
{192, 16, 208, 32}, {192, 16, 208, 32},
}; };
int dir;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:
@ -102,6 +102,8 @@ void ActNpc301(NPCHAR *npc)
// Camera focus marker // Camera focus marker
void ActNpc302(NPCHAR *npc) void ActNpc302(NPCHAR *npc)
{ {
int n;
switch (npc->act_no) switch (npc->act_no)
{ {
case 10: case 10:
@ -143,18 +145,16 @@ void ActNpc302(NPCHAR *npc)
if (npc->direct != 0) if (npc->direct != 0)
{ {
int i; for (n = 0xAA; n < 0x200; ++n)
for (i = 0xAA; i < 0x200; ++i)
{ {
if (gNPC[i].cond & 0x80 && gNPC[i].code_event == npc->direct) if (gNPC[n].cond & 0x80 && gNPC[n].code_event == npc->direct)
{ {
npc->pNpc = &gNPC[i]; npc->pNpc = &gNPC[n];
break; break;
} }
} }
if (i == 0x200) if (n == 0x200)
{ {
npc->cond = 0; npc->cond = 0;
break; break;
@ -401,6 +401,8 @@ void ActNpc307(NPCHAR *npc)
// Stumpy // Stumpy
void ActNpc308(NPCHAR *npc) void ActNpc308(NPCHAR *npc)
{ {
unsigned char deg;
RECT rcLeft[2] = { RECT rcLeft[2] = {
{128, 112, 144, 128}, {128, 112, 144, 128},
{144, 112, 160, 128}, {144, 112, 160, 128},
@ -411,8 +413,6 @@ void ActNpc308(NPCHAR *npc)
{144, 128, 160, 144}, {144, 128, 160, 144},
}; };
unsigned char deg;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:

View file

@ -220,7 +220,7 @@ void ActNpc322(NPCHAR *npc)
switch (npc->act_wait) switch (npc->act_wait)
{ {
// Interestingly, this NPC counts down at 50 frames per second, // Interestingly, this NPC counts down at 50 frames per second,
// while the NPC206 (the Egg Corridor Counter Bomb), counts at 60. // while NPC206 (the Egg Corridor Counter Bomb), counts at 60.
case 50 * 0: case 50 * 0:
SetNpChar(207, npc->x + (4 * 0x200), npc->y, 0, 0, 0, NULL, 0x180); SetNpChar(207, npc->x + (4 * 0x200), npc->y, 0, 0, 0, NULL, 0x180);
break; break;
@ -801,14 +801,14 @@ void ActNpc331(NPCHAR *npc)
// Ballos shockwave // Ballos shockwave
void ActNpc332(NPCHAR *npc) void ActNpc332(NPCHAR *npc)
{ {
int xm;
RECT rc[3] = { RECT rc[3] = {
{144, 96, 168, 120}, {144, 96, 168, 120},
{168, 96, 192, 120}, {168, 96, 192, 120},
{192, 96, 216, 120}, {192, 96, 216, 120},
}; };
int xm;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:

View file

@ -592,7 +592,6 @@ void ActNpc341(NPCHAR *npc)
void ActNpc342(NPCHAR *npc) void ActNpc342(NPCHAR *npc)
{ {
static int flash; static int flash;
unsigned char deg;
RECT rc[3] = { RECT rc[3] = {
{240, 48, 280, 88}, {240, 48, 280, 88},
@ -600,6 +599,8 @@ void ActNpc342(NPCHAR *npc)
{280, 48, 320, 88}, {280, 48, 320, 88},
}; };
unsigned char deg;
if (npc->act_no < 1000 && npc->pNpc->act_no >= 1000) if (npc->act_no < 1000 && npc->pNpc->act_no >= 1000)
npc->act_no = 1000; npc->act_no = 1000;
@ -905,8 +906,6 @@ void ActNpc344(NPCHAR *npc)
// Ballos skull projectile // Ballos skull projectile
void ActNpc345(NPCHAR *npc) void ActNpc345(NPCHAR *npc)
{ {
int i;
RECT rc[4] = { RECT rc[4] = {
{128, 176, 144, 192}, {128, 176, 144, 192},
{144, 176, 160, 192}, {144, 176, 160, 192},
@ -914,6 +913,8 @@ void ActNpc345(NPCHAR *npc)
{176, 176, 192, 192}, {176, 176, 192, 192},
}; };
int i;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:
@ -974,9 +975,8 @@ void ActNpc345(NPCHAR *npc)
// Ballos 4 orbiting platform // Ballos 4 orbiting platform
void ActNpc346(NPCHAR *npc) void ActNpc346(NPCHAR *npc)
{ {
unsigned char deg;
RECT rc = {240, 0, 272, 16}; RECT rc = {240, 0, 272, 16};
unsigned char deg;
if (npc->act_no < 1000 && npc->pNpc->act_no >= 1000) if (npc->act_no < 1000 && npc->pNpc->act_no >= 1000)
npc->act_no = 1000; npc->act_no = 1000;
@ -1724,9 +1724,7 @@ void ActNpc353(NPCHAR *npc)
// Invisible deathtrap wall // Invisible deathtrap wall
void ActNpc354(NPCHAR *npc) void ActNpc354(NPCHAR *npc)
{ {
int i; int i, x, y;
int x;
int y;
switch (npc->act_no) switch (npc->act_no)
{ {

View file

@ -264,15 +264,15 @@ void JudgeHitNpCharWater(NPCHAR *npc, int x, int y)
npc->flag |= hit; npc->flag |= hit;
} }
void HitNpCharMap() void HitNpCharMap(void)
{ {
int judg, x, y; int x, y;
int judg;
int offx[9]; int offx[9];
int offy[9]; int offy[9];
int i; int i, j;
int j;
offx[0] = 0; offx[0] = 0;
offx[1] = 1; offx[1] = 1;
@ -460,6 +460,8 @@ void HitNpCharMap()
void LoseNpChar(NPCHAR *npc, BOOL bVanish) void LoseNpChar(NPCHAR *npc, BOOL bVanish)
{ {
int val;
// Play death sound // Play death sound
PlaySoundObject(npc->destroy_voice, 1); PlaySoundObject(npc->destroy_voice, 1);
@ -482,8 +484,6 @@ void LoseNpChar(NPCHAR *npc, BOOL bVanish)
// Create drop // Create drop
if (npc->exp != 0) if (npc->exp != 0)
{ {
int val;
switch (Random(1, 5)) switch (Random(1, 5))
{ {
case 1: case 1:
@ -534,8 +534,7 @@ void LoseNpChar(NPCHAR *npc, BOOL bVanish)
void HitNpCharBullet(void) void HitNpCharBullet(void)
{ {
int n; int n, b;
int b;
BOOL bHit; BOOL bHit;
for (n = 0; n < NPC_MAX; ++n) for (n = 0; n < NPC_MAX; ++n)

View file

@ -10,67 +10,6 @@
#include "Generic.h" #include "Generic.h"
#include "NpcAct.h" #include "NpcAct.h"
NPC_TABLE *gNpcTable;
BOOL LoadNpcTable(const char *path)
{
FILE *fp;
int n;
int num;
size_t size;
size = GetFileSizeLong(path); // TODO - Investigate whether GetFileSizeLong actually returns an unsigned long or not
if (size == -1)
return FALSE;
num = (int)(size / 0x18);
gNpcTable = (NPC_TABLE*)malloc(num * sizeof(NPC_TABLE));
if (gNpcTable == NULL)
return FALSE;
fp = fopen(path, "rb");
if (fp == NULL)
{
free(gNpcTable);
gNpcTable = NULL;
return FALSE;
}
for (n = 0; n < num; ++n) // bits
gNpcTable[n].bits = File_ReadLE16(fp);
for (n = 0; n < num; ++n) // life
gNpcTable[n].life = File_ReadLE16(fp);
for (n = 0; n < num; ++n) // surf
fread(&gNpcTable[n].surf, 1, 1, fp);
for (n = 0; n < num; ++n) // destroy_voice
fread(&gNpcTable[n].destroy_voice, 1, 1, fp);
for (n = 0; n < num; ++n) // hit_voice
fread(&gNpcTable[n].hit_voice, 1, 1, fp);
for (n = 0; n < num; ++n) // size
fread(&gNpcTable[n].size, 1, 1, fp);
for (n = 0; n < num; ++n) // exp
gNpcTable[n].exp = File_ReadLE32(fp);
for (n = 0; n < num; ++n) // damage
gNpcTable[n].damage = File_ReadLE32(fp);
for (n = 0; n < num; ++n) // hit
fread(&gNpcTable[n].hit, 4, 1, fp);
for (n = 0; n < num; ++n) // view
fread(&gNpcTable[n].view, 4, 1, fp);
fclose(fp);
return TRUE;
}
void ReleaseNpcTable(void)
{
if (gNpcTable != NULL)
{
free(gNpcTable);
gNpcTable = NULL;
}
}
// Npc function table // Npc function table
const NPCFUNCTION gpNpcFuncTbl[361] = { const NPCFUNCTION gpNpcFuncTbl[361] = {
ActNpc000, ActNpc000,
@ -435,3 +374,64 @@ const NPCFUNCTION gpNpcFuncTbl[361] = {
ActNpc359, ActNpc359,
ActNpc360, ActNpc360,
}; };
NPC_TABLE *gNpcTable;
BOOL LoadNpcTable(const char *path)
{
FILE *fp;
int n;
size_t size;
int num;
size = GetFileSizeLong(path); // TODO - Investigate whether GetFileSizeLong actually returns an unsigned long or not
if (size == -1)
return FALSE;
num = (int)(size / 0x18);
gNpcTable = (NPC_TABLE*)malloc(num * sizeof(NPC_TABLE));
if (gNpcTable == NULL)
return FALSE;
fp = fopen(path, "rb");
if (fp == NULL)
{
free(gNpcTable);
gNpcTable = NULL;
return FALSE;
}
for (n = 0; n < num; ++n) // bits
gNpcTable[n].bits = File_ReadLE16(fp);
for (n = 0; n < num; ++n) // life
gNpcTable[n].life = File_ReadLE16(fp);
for (n = 0; n < num; ++n) // surf
fread(&gNpcTable[n].surf, 1, 1, fp);
for (n = 0; n < num; ++n) // destroy_voice
fread(&gNpcTable[n].destroy_voice, 1, 1, fp);
for (n = 0; n < num; ++n) // hit_voice
fread(&gNpcTable[n].hit_voice, 1, 1, fp);
for (n = 0; n < num; ++n) // size
fread(&gNpcTable[n].size, 1, 1, fp);
for (n = 0; n < num; ++n) // exp
gNpcTable[n].exp = File_ReadLE32(fp);
for (n = 0; n < num; ++n) // damage
gNpcTable[n].damage = File_ReadLE32(fp);
for (n = 0; n < num; ++n) // hit
fread(&gNpcTable[n].hit, 4, 1, fp);
for (n = 0; n < num; ++n) // view
fread(&gNpcTable[n].view, 4, 1, fp);
fclose(fp);
return TRUE;
}
void ReleaseNpcTable(void)
{
if (gNpcTable != NULL)
{
free(gNpcTable);
gNpcTable = NULL;
}
}

View file

@ -97,16 +97,8 @@ typedef struct OrgData
unsigned short organya_timer; unsigned short organya_timer;
ORGDATA org_data;
AudioBackend_Sound *lpORGANBUFFER[8][8][2] = {NULL}; AudioBackend_Sound *lpORGANBUFFER[8][8][2] = {NULL};
int gTrackVol[MAXTRACK];
int gOrgVolume = 100;
BOOL bFadeout = FALSE;
BOOL g_mute[MAXTRACK]; // Used by the debug Mute menu
///////////////////////////////////////////// /////////////////////////////////////////////
//■オルガーニャ■■■■■■■■■■■■/////// (Organya) //■オルガーニャ■■■■■■■■■■■■/////// (Organya)
///////////////////// /////////////////////
@ -119,7 +111,7 @@ typedef struct
short oct_size; short oct_size;
} OCTWAVE; } OCTWAVE;
static const OCTWAVE oct_wave[8] = OCTWAVE oct_wave[8] =
{ {
{ 256, 1, 4 }, // 0 Oct { 256, 1, 4 }, // 0 Oct
{ 256, 2, 8 }, // 1 Oct { 256, 2, 8 }, // 1 Oct
@ -187,7 +179,7 @@ BOOL MakeSoundObject8(signed char *wavep, signed char track, signed char pipi)
return TRUE; return TRUE;
} }
static const short freq_tbl[12] = {262, 277, 294, 311, 330, 349, 370, 392, 415, 440, 466, 494}; short freq_tbl[12] = {262, 277, 294, 311, 330, 349, 370, 392, 415, 440, 466, 494};
void ChangeOrganFrequency(unsigned char key, signed char track, long a) void ChangeOrganFrequency(unsigned char key, signed char track, long a)
{ {
@ -199,7 +191,8 @@ void ChangeOrganFrequency(unsigned char key, signed char track, long a)
AudioBackend_SetSoundFrequency(lpORGANBUFFER[track][j][i], ((oct_wave[j].wave_size * freq_tbl[key]) * oct_wave[j].oct_par) / 8 + (a - 1000)); // 1000を+αのデフォルト値とする (1000 is the default value for + α) AudioBackend_SetSoundFrequency(lpORGANBUFFER[track][j][i], ((oct_wave[j].wave_size * freq_tbl[key]) * oct_wave[j].oct_par) / 8 + (a - 1000)); // 1000を+αのデフォルト値とする (1000 is the default value for + α)
} }
const short pan_tbl[13] = {0, 43, 86, 129, 172, 215, 256, 297, 340, 383, 426, 469, 512}; BOOL g_mute[MAXTRACK]; // Used by the debug Mute menu
short pan_tbl[13] = {0, 43, 86, 129, 172, 215, 256, 297, 340, 383, 426, 469, 512};
unsigned char old_key[MAXTRACK] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; // 再生中の音 (Sound being played) unsigned char old_key[MAXTRACK] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; // 再生中の音 (Sound being played)
unsigned char key_on[MAXTRACK]; // キースイッチ (Key switch) unsigned char key_on[MAXTRACK]; // キースイッチ (Key switch)
unsigned char key_twin[MAXTRACK]; // 今使っているキー(連続時のノイズ防止の為に二つ用意) (Currently used keys (prepared for continuous noise prevention)) unsigned char key_twin[MAXTRACK]; // 今使っているキー(連続時のノイズ防止の為に二つ用意) (Currently used keys (prepared for continuous noise prevention))
@ -400,11 +393,11 @@ void PlayDramObject(unsigned char key, int mode, signed char track)
} }
} }
ORGDATA org_data;
OrgData::OrgData(void) OrgData::OrgData(void)
{ {
int i; for (int i = 0; i < MAXTRACK; i++)
for (i = 0; i < MAXTRACK; i++)
{ {
info.tdata[i].note_list = NULL; info.tdata[i].note_list = NULL;
info.tdata[i].note_p = NULL; info.tdata[i].note_p = NULL;
@ -421,8 +414,7 @@ void OrgData::InitOrgData(void)
info.repeat_x = info.dot * info.line * 0; info.repeat_x = info.dot * info.line * 0;
info.end_x = info.dot * info.line * 255; info.end_x = info.dot * info.line * 255;
int i; for (int i = 0; i < MAXTRACK; i++)
for (i = 0; i < MAXTRACK; i++)
{ {
info.tdata[i].freq = 1000; info.tdata[i].freq = 1000;
info.tdata[i].wave_no = 0; info.tdata[i].wave_no = 0;
@ -539,8 +531,8 @@ void OrgData::ReleaseNote(void)
} }
} }
static const char pass[7] = "Org-01"; char pass[7] = "Org-01";
static const char pass2[7] = "Org-02"; // Pipi char pass2[7] = "Org-02"; // Pipi
BOOL OrgData::InitMusicData(const char *path) BOOL OrgData::InitMusicData(const char *path)
{ {
@ -691,37 +683,41 @@ void OrgData::GetMusicInfo(MUSICINFO *mi)
} }
// Play data // Play data
long play_p; long PlayPos; // Called 'play_p' in the source code release
NOTELIST *play_np[MAXTRACK]; NOTELIST *np[MAXTRACK];
long now_leng[MAXMELODY]; long now_leng[MAXMELODY];
int Volume = 100;
int TrackVol[MAXTRACK];
BOOL bFadeout = FALSE;
void OrgData::PlayData(void) void OrgData::PlayData(void)
{ {
int i; int i;
// Handle fading out // Handle fading out
if (bFadeout && gOrgVolume) if (bFadeout && Volume)
gOrgVolume -= 2; Volume -= 2;
if (gOrgVolume < 0) if (Volume < 0)
gOrgVolume = 0; Volume = 0;
// メロディの再生 (Play melody) // メロディの再生 (Play melody)
for (i = 0; i < MAXMELODY; i++) for (i = 0; i < MAXMELODY; i++)
{ {
if (play_np[i] != NULL && play_p == play_np[i]->x) if (np[i] != NULL && PlayPos == np[i]->x)
{ {
if (!g_mute[i] && play_np[i]->y != KEYDUMMY) // 音が来た。 (The sound has come.) if (!g_mute[i] && np[i]->y != KEYDUMMY) // 音が来た。 (The sound has come.)
{ {
PlayOrganObject(play_np[i]->y, -1, i, info.tdata[i].freq); PlayOrganObject(np[i]->y, -1, i, info.tdata[i].freq);
now_leng[i] = play_np[i]->length; now_leng[i] = np[i]->length;
} }
if (play_np[i]->pan != PANDUMMY) if (np[i]->pan != PANDUMMY)
ChangeOrganPan(play_np[i]->y, play_np[i]->pan, i); ChangeOrganPan(np[i]->y, np[i]->pan, i);
if (play_np[i]->volume != VOLDUMMY) if (np[i]->volume != VOLDUMMY)
gTrackVol[i] = play_np[i]->volume; TrackVol[i] = np[i]->volume;
play_np[i] = play_np[i]->to; // 次の音符を指す (Points to the next note) np[i] = np[i]->to; // 次の音符を指す (Points to the next note)
} }
if (now_leng[i] == 0) if (now_leng[i] == 0)
@ -730,36 +726,36 @@ void OrgData::PlayData(void)
if (now_leng[i] > 0) if (now_leng[i] > 0)
now_leng[i]--; now_leng[i]--;
if (play_np[i]) if (np[i])
ChangeOrganVolume(play_np[i]->y, gTrackVol[i] * gOrgVolume / 0x7F, i); ChangeOrganVolume(np[i]->y, TrackVol[i] * Volume / 0x7F, i);
} }
// ドラムの再生 (Drum playback) // ドラムの再生 (Drum playback)
for (i = MAXMELODY; i < MAXTRACK; i++) for (i = MAXMELODY; i < MAXTRACK; i++)
{ {
if (play_np[i] != NULL && play_p == play_np[i]->x) // 音が来た。 (The sound has come.) if (np[i] != NULL && PlayPos == np[i]->x) // 音が来た。 (The sound has come.)
{ {
if (play_np[i]->y != KEYDUMMY && !g_mute[i]) // ならす (Tame) if (np[i]->y != KEYDUMMY && !g_mute[i]) // ならす (Tame)
PlayDramObject(play_np[i]->y, 1, i - MAXMELODY); PlayDramObject(np[i]->y, 1, i - MAXMELODY);
if (play_np[i]->pan != PANDUMMY) if (np[i]->pan != PANDUMMY)
ChangeDramPan(play_np[i]->pan, i - MAXMELODY); ChangeDramPan(np[i]->pan, i - MAXMELODY);
if (play_np[i]->volume != VOLDUMMY) if (np[i]->volume != VOLDUMMY)
gTrackVol[i] = play_np[i]->volume; TrackVol[i] = np[i]->volume;
play_np[i] = play_np[i]->to; // 次の音符を指す (Points to the next note) np[i] = np[i]->to; // 次の音符を指す (Points to the next note)
} }
if (play_np[i]) if (np[i])
ChangeDramVolume(gTrackVol[i] * gOrgVolume / 0x7F, i - MAXMELODY); ChangeDramVolume(TrackVol[i] * Volume / 0x7F, i - MAXMELODY);
} }
// Looping // Looping
play_p++; PlayPos++;
if (play_p >= info.end_x) if (PlayPos >= info.end_x)
{ {
play_p = info.repeat_x; PlayPos = info.repeat_x;
SetPlayPointer(play_p); SetPlayPointer(PlayPos);
} }
} }
@ -767,12 +763,12 @@ void OrgData::SetPlayPointer(long x)
{ {
for (int i = 0; i < MAXTRACK; i++) for (int i = 0; i < MAXTRACK; i++)
{ {
play_np[i] = info.tdata[i].note_list; np[i] = info.tdata[i].note_list;
while (play_np[i] != NULL && play_np[i]->x < x) while (np[i] != NULL && np[i]->x < x)
play_np[i] = play_np[i]->to; // 見るべき音符を設定 (Set note to watch) np[i] = np[i]->to; // 見るべき音符を設定 (Set note to watch)
} }
play_p = x; PlayPos = x;
} }
// Start and end organya // Start and end organya
@ -798,7 +794,7 @@ BOOL LoadOrganya(const char *name)
if (!org_data.InitMusicData(name)) if (!org_data.InitMusicData(name))
return FALSE; return FALSE;
gOrgVolume = 100; Volume = 100;
bFadeout = 0; bFadeout = 0;
#ifdef FIX_BUGS #ifdef FIX_BUGS
@ -814,7 +810,7 @@ void SetOrganyaPosition(unsigned int x)
return; return;
org_data.SetPlayPointer(x); org_data.SetPlayPointer(x);
gOrgVolume = 100; Volume = 100;
bFadeout = FALSE; bFadeout = FALSE;
} }
@ -823,7 +819,7 @@ unsigned int GetOrganyaPosition(void)
if (!audio_backend_initialised) if (!audio_backend_initialised)
return 0 ; return 0 ;
return play_p; return PlayPos;
} }
void PlayOrganyaMusic(void) void PlayOrganyaMusic(void)
@ -842,7 +838,7 @@ BOOL ChangeOrganyaVolume(signed int volume)
if (volume < 0 || volume > 100) if (volume < 0 || volume > 100)
return FALSE; return FALSE;
gOrgVolume = volume; Volume = volume;
return TRUE; return TRUE;
} }

View file

@ -8,11 +8,13 @@
#include "Random.h" #include "Random.h"
static signed char gWaveModelTable[6][0x100]; signed char gWaveModelTable[6][0x100];
void MakeWaveTables(void) void MakeWaveTables(void)
{ {
int i, a; int i;
int a;
// Sine wave // Sine wave
for (i = 0; i < 0x100; ++i) for (i = 0; i < 0x100; ++i)
@ -61,24 +63,28 @@ void MakeWaveTables(void)
gWaveModelTable[5][i] = (signed char)(msvc_rand() & 0xFF) / 2; gWaveModelTable[5][i] = (signed char)(msvc_rand() & 0xFF) / 2;
} }
//BOOL wave_tables_made;
BOOL MakePixelWaveData(const PIXTONEPARAMETER *ptp, unsigned char *pData) BOOL MakePixelWaveData(const PIXTONEPARAMETER *ptp, unsigned char *pData)
{ {
int i; int i;
double dEnvelope; int a, b, c, d;
double dPitch; double dPitch;
double dMain; double dMain;
double dVolume; double dVolume;
double d1;
double d2; double dEnvelope;
double d3;
int a;
int b;
int c;
int d;
signed char envelopeTable[0x100]; signed char envelopeTable[0x100];
double d1, d2, d3;
// The Linux port added a cute optimisation here, where MakeWaveTables is only called once during the game's execution // The Linux port added a cute optimisation here, where MakeWaveTables is only called once during the game's execution
//if (wave_tables_made != TRUE)
//{
MakeWaveTables(); MakeWaveTables();
// wave_tables_made = TRUE;
//}
memset(envelopeTable, 0, sizeof(envelopeTable)); memset(envelopeTable, 0, sizeof(envelopeTable));

View file

@ -41,9 +41,10 @@ BOOL IsProfile(void)
BOOL SaveProfile(const char *name) BOOL SaveProfile(const char *name)
{ {
PROFILE profile;
FILE *fp; FILE *fp;
PROFILE profile;
const char *FLAG = "FLAG"; const char *FLAG = "FLAG";
char path[MAX_PATH]; char path[MAX_PATH];
// Get path // Get path
@ -121,9 +122,9 @@ BOOL SaveProfile(const char *name)
BOOL LoadProfile(const char *name) BOOL LoadProfile(const char *name)
{ {
char path[MAX_PATH];
PROFILE profile;
FILE *fp; FILE *fp;
PROFILE profile;
char path[MAX_PATH];
// Get path // Get path
if (name != NULL) if (name != NULL)

View file

@ -14,8 +14,8 @@
PERMIT_STAGE gPermitStage[8]; PERMIT_STAGE gPermitStage[8];
static int gSelectedStage; int gSelectedStage;
static int gStageSelectTitleY; int gStageSelectTitleY;
void ClearPermitStage(void) void ClearPermitStage(void)
{ {
@ -107,6 +107,9 @@ void PutStageSelectObject(void)
{ {
static unsigned int flash; static unsigned int flash;
int i;
RECT rcStage;
RECT rcView = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT}; RECT rcView = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
RECT rcCur[2] = { RECT rcCur[2] = {
@ -116,10 +119,8 @@ void PutStageSelectObject(void)
RECT rcTitle1 = {80, 64, 144, 72}; RECT rcTitle1 = {80, 64, 144, 72};
int i;
int stage_num; int stage_num;
int stage_x; int stage_x;
RECT rcStage;
if (gStageSelectTitleY > (WINDOW_HEIGHT / 2) - 74) if (gStageSelectTitleY > (WINDOW_HEIGHT / 2) - 74)
--gStageSelectTitleY; --gStageSelectTitleY;

View file

@ -11,7 +11,6 @@
#include "Sound.h" #include "Sound.h"
int empty; int empty;
int spur_charge;
void ShootBullet_Frontia1(int level) void ShootBullet_Frontia1(int level)
{ {
@ -250,6 +249,7 @@ void ShootBullet_FireBall(int level)
void ShootBullet_Machinegun1(int level) void ShootBullet_Machinegun1(int level)
{ {
int bul_no; int bul_no;
static int wait;
if (CountArmsBullet(4) > 4) if (CountArmsBullet(4) > 4)
return; return;
@ -355,7 +355,6 @@ void ShootBullet_Machinegun1(int level)
} }
else else
{ {
static int wait = 0;
++wait; ++wait;
if (gMC.equip & 8) if (gMC.equip & 8)
@ -896,6 +895,8 @@ void ShootBullet_Nemesis(int level)
} }
} }
int spur_charge;
void ResetSpurCharge(void) void ResetSpurCharge(void)
{ {
spur_charge = 0; spur_charge = 0;
@ -906,9 +907,9 @@ void ResetSpurCharge(void)
void ShootBullet_Spur(int level) void ShootBullet_Spur(int level)
{ {
static BOOL bMax;
BOOL bShot;
int bul_no; int bul_no;
BOOL bShot;
static BOOL bMax;
bShot = FALSE; bShot = FALSE;
@ -1058,11 +1059,12 @@ void ShootBullet_Spur(int level)
void ShootBullet(void) void ShootBullet(void)
{ {
static int soft_rensha; // 'rensha' is Japanese for 'rapid-fire', apparently
if (empty != 0) if (empty != 0)
--empty; --empty;
// Only let the player shoot every 4 frames // Only let the player shoot every 4 frames
static int soft_rensha; // 'rensha' is Japanese for 'rapid-fire', apparently
if (soft_rensha != 0) if (soft_rensha != 0)
--soft_rensha; --soft_rensha;

View file

@ -113,6 +113,8 @@ BOOL InitSoundObject(LPCSTR resname, int no)
return TRUE; return TRUE;
} }
// Completely unused function for loading a .wav file as a sound effect.
// Some say that sounds heard in CS Beta footage don't sound like PixTone...
BOOL LoadSoundObject(LPCSTR file_name, int no) BOOL LoadSoundObject(LPCSTR file_name, int no)
{ {
char path[MAX_PATH]; char path[MAX_PATH];
@ -253,10 +255,9 @@ void ChangeSoundPan(int no, long pan) // 512がMAXで256がノーマル (512 is
// TODO - The stack frame for this function is inaccurate // TODO - The stack frame for this function is inaccurate
int MakePixToneObject(const PIXTONEPARAMETER *ptp, int ptp_num, int no) int MakePixToneObject(const PIXTONEPARAMETER *ptp, int ptp_num, int no)
{ {
int i;
int j;
const PIXTONEPARAMETER *ptp_pointer;
int sample_count; int sample_count;
int i, j;
const PIXTONEPARAMETER *ptp_pointer;
unsigned char *pcm_buffer; unsigned char *pcm_buffer;
unsigned char *mixed_pcm_buffer; unsigned char *mixed_pcm_buffer;

View file

@ -27,6 +27,9 @@
#endif #endif
int gStageNo; int gStageNo;
MusicID gMusicNo;
unsigned int gOldPos;
MusicID gOldNo;
const STAGE_TABLE gTMT[95] = { const STAGE_TABLE gTMT[95] = {
STAGE_ENTRY("0", "0", 4, "bk0", "Guest", "0", 0, "Null", "\x96\xB3"), // 無 STAGE_ENTRY("0", "0", 4, "bk0", "Guest", "0", 0, "Null", "\x96\xB3"), // 無
@ -128,9 +131,9 @@ const STAGE_TABLE gTMT[95] = {
BOOL TransferStage(int no, int w, int x, int y) BOOL TransferStage(int no, int w, int x, int y)
{ {
BOOL bError;
char path_dir[20];
char path[MAX_PATH]; char path[MAX_PATH];
char path_dir[20];
BOOL bError;
// Move character // Move character
SetMyCharPosition(x * 0x10 * 0x200, y * 0x10 * 0x200); SetMyCharPosition(x * 0x10 * 0x200, y * 0x10 * 0x200);
@ -246,10 +249,6 @@ const char *gMusicTable[42] = {
"WHITE" "WHITE"
}; };
MusicID gMusicNo;
unsigned int gOldPos;
MusicID gOldNo;
void ChangeMusic(MusicID no) void ChangeMusic(MusicID no)
{ {
if (no != MUS_SILENCE && no == gMusicNo) if (no != MUS_SILENCE && no == gMusicNo)

View file

@ -8,14 +8,12 @@ short gTan[0x21];
void InitTriangleTable(void) void InitTriangleTable(void)
{ {
int i; int i;
float a;
float b;
// Sine // Sine
for (i = 0; i < 0x100; ++i) for (i = 0; i < 0x100; ++i)
{
gSin[i] = (int)(sin(i * 6.2831998 / 256.0) * 512.0); gSin[i] = (int)(sin(i * 6.2831998 / 256.0) * 512.0);
}
float a, b;
// Tangent // Tangent
for (i = 0; i < 0x21; ++i) for (i = 0; i < 0x21; ++i)
@ -39,8 +37,8 @@ int GetCos(unsigned char deg)
unsigned char GetArktan(int x, int y) unsigned char GetArktan(int x, int y)
{ {
unsigned char a;
short k; short k;
unsigned char a;
x *= -1; x *= -1;
y *= -1; y *= -1;

View file

@ -19,17 +19,11 @@ void ClearValueView(void)
void SetValueView(int *px, int *py, int value) void SetValueView(int *px, int *py, int value)
{ {
int index;
BOOL minus; BOOL minus;
int v; int v;
int width;
int dig[4]; int index;
int fig[4];
BOOL sw;
int i; int i;
RECT rect[20];
RECT rcPlus;
RECT rcMinus;
for (i = 0; i < VALUEVIEW_MAX; ++i) for (i = 0; i < VALUEVIEW_MAX; ++i)
{ {
@ -77,6 +71,8 @@ void SetValueView(int *px, int *py, int value)
// Get width // Get width
v = value; v = value;
int width;
if (value > 999) if (value > 999)
width = 40; width = 40;
else if (value > 99) else if (value > 99)
@ -95,28 +91,32 @@ void SetValueView(int *px, int *py, int value)
gVV[index].rect.right = 40; gVV[index].rect.right = 40;
gVV[index].rect.bottom = 8 * (index + 1); gVV[index].rect.bottom = 8 * (index + 1);
SET_RECT(rect[0], 0, 56, 8, 64); RECT rect[20] = {
SET_RECT(rect[1], 8, 56, 16, 64); {0, 56, 8, 64},
SET_RECT(rect[2], 16, 56, 24, 64); {8, 56, 16, 64},
SET_RECT(rect[3], 24, 56, 32, 64); {16, 56, 24, 64},
SET_RECT(rect[4], 32, 56, 40, 64); {24, 56, 32, 64},
SET_RECT(rect[5], 40, 56, 48, 64); {32, 56, 40, 64},
SET_RECT(rect[6], 48, 56, 56, 64); {40, 56, 48, 64},
SET_RECT(rect[7], 56, 56, 64, 64); {48, 56, 56, 64},
SET_RECT(rect[8], 64, 56, 72, 64); {56, 56, 64, 64},
SET_RECT(rect[9], 72, 56, 80, 64); {64, 56, 72, 64},
SET_RECT(rect[10], 0, 64, 8, 72); {72, 56, 80, 64},
SET_RECT(rect[11], 8, 64, 16, 72); {0, 64, 8, 72},
SET_RECT(rect[12], 16, 64, 24, 72); {8, 64, 16, 72},
SET_RECT(rect[13], 24, 64, 32, 72); {16, 64, 24, 72},
SET_RECT(rect[14], 32, 64, 40, 72); {24, 64, 32, 72},
SET_RECT(rect[15], 40, 64, 48, 72); {32, 64, 40, 72},
SET_RECT(rect[16], 48, 64, 56, 72); {40, 64, 48, 72},
SET_RECT(rect[17], 56, 64, 64, 72); {48, 64, 56, 72},
SET_RECT(rect[18], 64, 64, 72, 72); {56, 64, 64, 72},
SET_RECT(rect[19], 72, 64, 80, 72); {64, 64, 72, 72},
{72, 64, 80, 72},
};
// Get digits // Get digits
int dig[4];
int fig[4];
dig[0] = 1; dig[0] = 1;
dig[1] = 10; dig[1] = 10;
dig[2] = 100; dig[2] = 100;
@ -133,10 +133,10 @@ void SetValueView(int *px, int *py, int value)
} }
} }
sw = FALSE; BOOL sw = FALSE;
SET_RECT(rcPlus, 32, 48, 40, 56); RECT rcPlus = {32, 48, 40, 56};
SET_RECT(rcMinus, 40, 48, 48, 56); RECT rcMinus = {40, 48, 48, 56};
// Draw value // Draw value
CortBox2(&gVV[index].rect, 0x000000, SURFACE_ID_VALUE_VIEW); CortBox2(&gVV[index].rect, 0x000000, SURFACE_ID_VALUE_VIEW);
@ -182,8 +182,8 @@ void ActValueView(void)
void PutValueView(int flx, int fly) void PutValueView(int flx, int fly)
{ {
int v;
int offset_x; int offset_x;
int v;
for (v = 0; v < VALUEVIEW_MAX; ++v) for (v = 0; v < VALUEVIEW_MAX; ++v)
{ {

View file

@ -20,10 +20,4 @@ struct RECT
long bottom; long bottom;
}; };
#define SET_RECT(rect, l, t, r, b) \
rect.left = l; \
rect.top = t; \
rect.right = r; \
rect.bottom = b;
#define MAX_PATH FILENAME_MAX #define MAX_PATH FILENAME_MAX