Stage.cpp cleanup

This commit is contained in:
Clownacy 2019-11-14 00:23:50 +00:00
parent e4ff51dc83
commit 156e47438c
3 changed files with 29 additions and 27 deletions

View file

@ -130,17 +130,19 @@ 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)
{ {
//Move character BOOL bError;
char path_dir[20];
char path[MAX_PATH];
// Move character
SetMyCharPosition(x * 0x10 * 0x200, y * 0x10 * 0x200); SetMyCharPosition(x * 0x10 * 0x200, y * 0x10 * 0x200);
BOOL bError = FALSE; bError = FALSE;
//Get path // Get path
char path_dir[20];
strcpy(path_dir, "Stage"); strcpy(path_dir, "Stage");
//Load tileset // Load tileset
char path[MAX_PATH];
sprintf(path, "%s\\Prt%s", path_dir, gTMT[no].parts); sprintf(path, "%s\\Prt%s", path_dir, gTMT[no].parts);
if (!ReloadBitmap_File(path, SURFACE_ID_LEVEL_TILESET)) if (!ReloadBitmap_File(path, SURFACE_ID_LEVEL_TILESET))
bError = TRUE; bError = TRUE;
@ -149,30 +151,30 @@ BOOL TransferStage(int no, int w, int x, int y)
if (!LoadAttributeData(path)) if (!LoadAttributeData(path))
bError = TRUE; bError = TRUE;
//Load tilemap // Load tilemap
sprintf(path, "%s\\%s.pxm", path_dir, gTMT[no].map); sprintf(path, "%s\\%s.pxm", path_dir, gTMT[no].map);
if (!LoadMapData2(path)) if (!LoadMapData2(path))
bError = TRUE; bError = TRUE;
//Load NPCs // Load NPCs
sprintf(path, "%s\\%s.pxe", path_dir, gTMT[no].map); sprintf(path, "%s\\%s.pxe", path_dir, gTMT[no].map);
if (!LoadEvent(path)) if (!LoadEvent(path))
bError = TRUE; bError = TRUE;
//Load script // Load script
sprintf(path, "%s\\%s.tsc", path_dir, gTMT[no].map); sprintf(path, "%s\\%s.tsc", path_dir, gTMT[no].map);
if (!LoadTextScript_Stage(path)) if (!LoadTextScript_Stage(path))
bError = TRUE; bError = TRUE;
//Load background // Load background
sprintf(path, "%s", gTMT[no].back); sprintf(path, "%s", gTMT[no].back);
if (!InitBack(path, gTMT[no].bkType)) if (!InitBack(path, gTMT[no].bkType))
bError = TRUE; bError = TRUE;
//Get path // Get path
strcpy(path_dir, "Npc"); strcpy(path_dir, "Npc");
//Load NPC sprite sheets // Load NPC sprite sheets
sprintf(path, "%s\\Npc%s", path_dir, gTMT[no].npc); sprintf(path, "%s\\Npc%s", path_dir, gTMT[no].npc);
if (!ReloadBitmap_File(path, SURFACE_ID_LEVEL_SPRITESET_1)) if (!ReloadBitmap_File(path, SURFACE_ID_LEVEL_SPRITESET_1))
bError = TRUE; bError = TRUE;
@ -184,7 +186,7 @@ BOOL TransferStage(int no, int w, int x, int y)
if (bError) if (bError)
return FALSE; return FALSE;
//Load map name // Load map name
ReadyMapName(gTMT[no].name); ReadyMapName(gTMT[no].name);
StartTextScript(w); StartTextScript(w);
@ -196,12 +198,12 @@ BOOL TransferStage(int no, int w, int x, int y)
InitBossChar(gTMT[no].boss_no); InitBossChar(gTMT[no].boss_no);
ResetFlash(); ResetFlash();
gStageNo = no; gStageNo = no;
return TRUE; return TRUE;
} }
//Music // Music
const char *gMusicTable[42] = const char *gMusicTable[42] = {
{
"XXXX", "XXXX",
"WANPAKU", "WANPAKU",
"ANZEN", "ANZEN",
@ -226,7 +228,7 @@ const char *gMusicTable[42] =
"ACCESS", "ACCESS",
"IRONH", "IRONH",
"GRAND", "GRAND",
"Curly", // Uses the original filename instead of the internal 8.3 one "Curly", // Uses the original filename instead of the internal allcaps one
"OSIDE", "OSIDE",
"REQUIEM", "REQUIEM",
"WANPAK2", "WANPAK2",
@ -255,30 +257,30 @@ void ChangeMusic(MusicID no)
if (no != MUS_SILENCE && no == gMusicNo) if (no != MUS_SILENCE && no == gMusicNo)
return; return;
//Stop and keep track of old song // Stop and keep track of old song
gOldPos = GetOrganyaPosition(); gOldPos = GetOrganyaPosition();
gOldNo = gMusicNo; gOldNo = gMusicNo;
StopOrganyaMusic(); StopOrganyaMusic();
//Load .org // Load .org
LoadOrganya(gMusicTable[no]); LoadOrganya(gMusicTable[no]);
//Reset position, volume, and then play the song // Reset position, volume, and then play the song
ChangeOrganyaVolume(100); ChangeOrganyaVolume(100);
SetOrganyaPosition(0); SetOrganyaPosition(0);
PlayOrganyaMusic(); PlayOrganyaMusic();
gMusicNo = no; gMusicNo = no;
} }
void ReCallMusic() void ReCallMusic(void)
{ {
//Stop old song // Stop old song
StopOrganyaMusic(); StopOrganyaMusic();
//Load .org that was playing before // Load .org that was playing before
LoadOrganya(gMusicTable[gOldNo]); LoadOrganya(gMusicTable[gOldNo]);
//Reset position, volume, and then play the song // Reset position, volume, and then play the song
SetOrganyaPosition(gOldPos); SetOrganyaPosition(gOldPos);
ChangeOrganyaVolume(100); ChangeOrganyaVolume(100);
PlayOrganyaMusic(); PlayOrganyaMusic();

View file

@ -65,4 +65,4 @@ extern MusicID gMusicNo;
BOOL TransferStage(int no, int w, int x, int y); BOOL TransferStage(int no, int w, int x, int y);
void ChangeMusic(MusicID no); void ChangeMusic(MusicID no);
void ReCallMusic(); void ReCallMusic(void);

View file

@ -1,5 +1,5 @@
#pragma once #pragma once
void InitStar(); void InitStar(void);
void ActStar(); void ActStar(void);
void PutStar(int fx, int fy); void PutStar(int fx, int fy);