Made Stage.cpp ASM-accurate
This commit is contained in:
parent
666269029d
commit
f8d4ae7014
6 changed files with 66 additions and 61 deletions
|
@ -614,6 +614,18 @@ addr = 0x41FE70
|
|||
name = "PlaySoundObject"
|
||||
addr = 0x420640
|
||||
|
||||
[[func]]
|
||||
name = "TransferStage"
|
||||
addr = 0x420BE0
|
||||
|
||||
[[func]]
|
||||
name = "ChangeMusic"
|
||||
addr = 0x420EE0
|
||||
|
||||
[[func]]
|
||||
name = "ReCallMusic"
|
||||
addr = 0x420F50
|
||||
|
||||
[[func]]
|
||||
name = "InitStar"
|
||||
addr = 0x420FA0
|
||||
|
|
|
@ -53,14 +53,14 @@ void SetUniqueParameter(NPCHAR *npc)
|
|||
npc->view.bottom = gNpcTable[code].view.bottom << 9;
|
||||
}
|
||||
|
||||
bool LoadEvent(const char *path_event)
|
||||
BOOL LoadEvent(const char *path_event)
|
||||
{
|
||||
char path[PATH_LENGTH];
|
||||
sprintf(path, "%s/%s", gDataPath, path_event);
|
||||
|
||||
FILE *fp = fopen(path, "rb");
|
||||
if (fp == NULL)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
//Read "PXE" check
|
||||
char code[4];
|
||||
|
@ -71,7 +71,7 @@ bool LoadEvent(const char *path_event)
|
|||
// The original game forgot to close the file here
|
||||
fclose(fp);
|
||||
#endif
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//Get amount of NPCs
|
||||
|
@ -128,7 +128,7 @@ bool LoadEvent(const char *path_event)
|
|||
}
|
||||
|
||||
fclose(fp);
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void SetNpChar(int code_char, int x, int y, int xm, int ym, int dir, NPCHAR *npc, int start_index)
|
||||
|
@ -235,7 +235,7 @@ void SetExpObjects(int x, int y, int exp)
|
|||
}
|
||||
}
|
||||
|
||||
bool SetBulletObject(int x, int y, int val)
|
||||
BOOL SetBulletObject(int x, int y, int val)
|
||||
{
|
||||
int tamakazu_ari[10];
|
||||
|
||||
|
@ -254,7 +254,7 @@ bool SetBulletObject(int x, int y, int val)
|
|||
}
|
||||
|
||||
if (!t)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
n = Random(1, 10 * t);
|
||||
int bullet_no = tamakazu_ari[n % t];
|
||||
|
@ -272,14 +272,14 @@ bool SetBulletObject(int x, int y, int val)
|
|||
gNPC[n].bits = gNpcTable[gNPC[n].code_char].bits;
|
||||
gNPC[n].exp = val;
|
||||
SetUniqueParameter(&gNPC[n]);
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool SetLifeObject(int x, int y, int val)
|
||||
BOOL SetLifeObject(int x, int y, int val)
|
||||
{
|
||||
for (int n = 0x100; n < NPC_MAX; n++)
|
||||
{
|
||||
|
@ -294,11 +294,11 @@ bool SetLifeObject(int x, int y, int val)
|
|||
gNPC[n].bits = gNpcTable[gNPC[n].code_char].bits;
|
||||
gNPC[n].exp = val;
|
||||
SetUniqueParameter(&gNPC[n]);
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void VanishNpChar(NPCHAR *npc)
|
||||
|
|
|
@ -83,13 +83,13 @@ extern int gSuperXpos;
|
|||
extern int gSuperYpos;
|
||||
|
||||
void InitNpChar();
|
||||
bool LoadEvent(const char *path_event);
|
||||
BOOL LoadEvent(const char *path_event);
|
||||
void SetNpChar(int code_char, int x, int y, int xm, int ym, int dir, NPCHAR *npc, int start_index);
|
||||
void SetDestroyNpChar(int x, int y, int w, int num);
|
||||
void SetDestroyNpCharUp(int x, int y, int w, int num);
|
||||
void SetExpObjects(int x, int y, int exp);
|
||||
bool SetBulletObject(int x, int y, int val);
|
||||
bool SetLifeObject(int x, int y, int val);
|
||||
BOOL SetBulletObject(int x, int y, int val);
|
||||
BOOL SetLifeObject(int x, int y, int val);
|
||||
void VanishNpChar(NPCHAR *npc);
|
||||
void PutNpChar(int fx, int fy);
|
||||
void ActNpChar();
|
||||
|
|
|
@ -132,7 +132,7 @@ const STAGE_TABLE gTMT[95] = {
|
|||
BOOL TransferStage(int no, int w, int x, int y)
|
||||
{
|
||||
//Move character
|
||||
SetMyCharPosition(x << 13, y << 13);
|
||||
SetMyCharPosition(x * 0x10 * 0x200, y * 0x10 * 0x200);
|
||||
|
||||
BOOL bError = FALSE;
|
||||
|
||||
|
@ -166,7 +166,7 @@ BOOL TransferStage(int no, int w, int x, int y)
|
|||
bError = TRUE;
|
||||
|
||||
//Load background
|
||||
strcpy(path, gTMT[no].back);
|
||||
sprintf(path, "%s", gTMT[no].back);
|
||||
if (!InitBack(path, gTMT[no].bkType))
|
||||
bError = TRUE;
|
||||
|
||||
|
@ -183,12 +183,8 @@ BOOL TransferStage(int no, int w, int x, int y)
|
|||
bError = TRUE;
|
||||
|
||||
if (bError)
|
||||
{
|
||||
printf("Failed to load stage %d\n", no);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//Load map name
|
||||
ReadyMapName(gTMT[no].name);
|
||||
|
||||
|
@ -204,9 +200,6 @@ BOOL TransferStage(int no, int w, int x, int y)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//Music
|
||||
const char *gMusicTable[42] =
|
||||
{
|
||||
|
@ -264,8 +257,9 @@ int gMusicNo;
|
|||
|
||||
void ChangeMusic(int no)
|
||||
{
|
||||
if (!no || no != gMusicNo)
|
||||
{
|
||||
if (no && no == gMusicNo)
|
||||
return;
|
||||
|
||||
//Stop and keep track of old song
|
||||
gOldPos = GetOrganyaPosition();
|
||||
gOldNo = gMusicNo;
|
||||
|
@ -280,7 +274,6 @@ void ChangeMusic(int no)
|
|||
PlayOrganyaMusic();
|
||||
gMusicNo = no;
|
||||
}
|
||||
}
|
||||
|
||||
void ReCallMusic()
|
||||
{
|
||||
|
|
|
@ -112,7 +112,7 @@ void EncryptionBinaryData2(uint8_t *pData, int size)
|
|||
}
|
||||
|
||||
//Load generic .tsc
|
||||
bool LoadTextScript2(const char *name)
|
||||
BOOL LoadTextScript2(const char *name)
|
||||
{
|
||||
//Get path
|
||||
char path[260];
|
||||
|
@ -120,12 +120,12 @@ bool LoadTextScript2(const char *name)
|
|||
|
||||
gTS.size = GetFileSizeLong(path);
|
||||
if (gTS.size == -1)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
//Open file
|
||||
FILE *fp = fopen(path, "rb");
|
||||
if (fp == NULL)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
//Read data
|
||||
fread(gTS.data, 1, gTS.size, fp);
|
||||
|
@ -137,11 +137,11 @@ bool LoadTextScript2(const char *name)
|
|||
|
||||
//Decrypt data
|
||||
EncryptionBinaryData2((uint8_t*)gTS.data, gTS.size);
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//Load stage .tsc
|
||||
bool LoadTextScript_Stage(const char *name)
|
||||
BOOL LoadTextScript_Stage(const char *name)
|
||||
{
|
||||
//Open Head.tsc
|
||||
char path[PATH_LENGTH];
|
||||
|
@ -149,11 +149,11 @@ bool LoadTextScript_Stage(const char *name)
|
|||
|
||||
long head_size = GetFileSizeLong(path);
|
||||
if (head_size == -1)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
FILE *fp = fopen(path, "rb");
|
||||
if (fp == NULL)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
//Read Head.tsc
|
||||
fread(gTS.data, 1, head_size, fp);
|
||||
|
@ -166,11 +166,11 @@ bool LoadTextScript_Stage(const char *name)
|
|||
|
||||
long body_size = GetFileSizeLong(path);
|
||||
if (body_size == -1)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
fp = fopen(path, "rb");
|
||||
if (fp == NULL)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
//Read stage's tsc
|
||||
fread(&gTS.data[head_size], 1, body_size, fp);
|
||||
|
@ -181,7 +181,7 @@ bool LoadTextScript_Stage(const char *name)
|
|||
//Set parameters
|
||||
gTS.size = head_size + body_size;
|
||||
strcpy(gTS.path, name);
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//Get current path
|
||||
|
|
|
@ -60,8 +60,8 @@ struct TEXT_SCRIPT
|
|||
BOOL InitTextScript2();
|
||||
void EndTextScript();
|
||||
void EncryptionBinaryData2(uint8_t *pData, int size);
|
||||
bool LoadTextScript2(const char *name);
|
||||
bool LoadTextScript_Stage(const char *name);
|
||||
BOOL LoadTextScript2(const char *name);
|
||||
BOOL LoadTextScript_Stage(const char *name);
|
||||
void GetTextScriptPath(char *path);
|
||||
BOOL StartTextScript(int no);
|
||||
void StopTextScript();
|
||||
|
|
Loading…
Add table
Reference in a new issue