From 3e5f44f8deb12840d892b3cc5d204542b05f0d78 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Fri, 22 Feb 2019 22:23:57 +0000 Subject: [PATCH] Changed some things to BOOL/BOOLEAN, for ASM-accuracy --- src/MiniMap.cpp | 10 +++++----- src/MiniMap.h | 6 ++++-- src/NpChar.cpp | 12 ++++++------ src/NpChar.h | 4 ++-- src/Stage.cpp | 26 +++++++++++++------------- src/Stage.h | 4 +++- 6 files changed, 33 insertions(+), 29 deletions(-) diff --git a/src/MiniMap.cpp b/src/MiniMap.cpp index 66cc616b..0ec39d9b 100644 --- a/src/MiniMap.cpp +++ b/src/MiniMap.cpp @@ -16,7 +16,7 @@ #include "MyChar.h" #include "Stage.h" -int8_t gMapping[0x80]; +BOOLEAN gMapping[0x80]; void WriteMiniMapLine(int line) { @@ -196,17 +196,17 @@ int MiniMapLoop() return 1; } -bool IsMapping() +BOOL IsMapping() { - return gMapping[gStageNo] != 0; + return gMapping[gStageNo]; } void StartMapping() { - memset(gMapping, 0, 0x80u); + memset(gMapping, FALSE, 0x80); } void SetMapping(int a) { - gMapping[a] = 1; + gMapping[a] = TRUE; } diff --git a/src/MiniMap.h b/src/MiniMap.h index cbeca307..2aa91de5 100644 --- a/src/MiniMap.h +++ b/src/MiniMap.h @@ -2,9 +2,11 @@ #include -extern int8_t gMapping[0x80]; +#include "WindowsWrapper.h" + +extern BOOLEAN gMapping[0x80]; int MiniMapLoop(); -bool IsMapping(); +BOOL IsMapping(); void StartMapping(); void SetMapping(int a); diff --git a/src/NpChar.cpp b/src/NpChar.cpp index 3e204386..2522b10f 100644 --- a/src/NpChar.cpp +++ b/src/NpChar.cpp @@ -594,26 +594,26 @@ void GetNpCharPosition(int *x, int *y, int i) *y = gNPC[i].y; } -bool IsNpCharCode(int code) +BOOL IsNpCharCode(int code) { for (int i = 0; i < NPC_MAX; i++) { if ((gNPC[i].cond & 0x80) && gNPC[i].code_char == code) - return true; + return TRUE; } - return false; + return FALSE; } -bool GetNpCharAlive(int code_event) +BOOL GetNpCharAlive(int code_event) { for (int i = 0; i < NPC_MAX; i++) { if ((gNPC[i].cond & 0x80) && gNPC[i].code_event == code_event) - return true; + return TRUE; } - return false; + return FALSE; } int CountAliveNpChar() diff --git a/src/NpChar.h b/src/NpChar.h index 746b04e7..43050386 100644 --- a/src/NpChar.h +++ b/src/NpChar.h @@ -101,6 +101,6 @@ void BackStepMyChar(int code_event); void DeleteNpCharEvent(int code); void DeleteNpCharCode(int code, bool bSmoke); void GetNpCharPosition(int *x, int *y, int i); -bool IsNpCharCode(int code); -bool GetNpCharAlive(int code_event); +BOOL IsNpCharCode(int code); +BOOL GetNpCharAlive(int code_event); int CountAliveNpChar(); diff --git a/src/Stage.cpp b/src/Stage.cpp index 39cad12e..e69574ee 100644 --- a/src/Stage.cpp +++ b/src/Stage.cpp @@ -129,12 +129,12 @@ const STAGE_TABLE gTMT[95] = { STAGE_ENTRY("Oside", "Clock", 6, "bkMoon", "Moon", "0", 0, "Clock Room", "ŽžŒv‰®"), }; -bool TransferStage(int no, int w, int x, int y) +BOOL TransferStage(int no, int w, int x, int y) { //Move character SetMyCharPosition(x << 13, y << 13); - bool bError = false; + BOOL bError = FALSE; //Get path char path_dir[20]; @@ -144,31 +144,31 @@ bool TransferStage(int no, int w, int x, int y) char path[PATH_LENGTH]; sprintf(path, "%s/Prt%s", path_dir, gTMT[no].parts); if (!ReloadBitmap_File(path, SURFACE_ID_LEVEL_TILESET)) - bError = true; + bError = TRUE; sprintf(path, "%s/%s.pxa", path_dir, gTMT[no].parts); if (!LoadAttributeData(path)) - bError = true; + bError = TRUE; //Load tilemap sprintf(path, "%s/%s.pxm", path_dir, gTMT[no].map); if (!LoadMapData2(path)) - bError = true; + bError = TRUE; //Load NPCs sprintf(path, "%s/%s.pxe", path_dir, gTMT[no].map); if (!LoadEvent(path)) - bError = true; + bError = TRUE; //Load script sprintf(path, "%s/%s.tsc", path_dir, gTMT[no].map); if (!LoadTextScript_Stage(path)) - bError = true; + bError = TRUE; //Load background strcpy(path, gTMT[no].back); if (!InitBack(path, gTMT[no].bkType)) - bError = true; + bError = TRUE; //Get path strcpy(path_dir, "Npc"); @@ -176,16 +176,16 @@ bool TransferStage(int no, int w, int x, int y) //Load NPC sprite sheets sprintf(path, "%s/Npc%s", path_dir, gTMT[no].npc); if (!ReloadBitmap_File(path, SURFACE_ID_LEVEL_SPRITESET_1)) - bError = true; + bError = TRUE; sprintf(path, "%s/Npc%s", path_dir, gTMT[no].boss); if (!ReloadBitmap_File(path, SURFACE_ID_LEVEL_SPRITESET_2)) - bError = true; + bError = TRUE; if (bError) { printf("Failed to load stage %d\n", no); - return false; + return FALSE; } else { @@ -201,10 +201,10 @@ bool TransferStage(int no, int w, int x, int y) InitBossChar(gTMT[no].boss_no); ResetFlash(); gStageNo = no; - return true; + return TRUE; } - return false; + return FALSE; } //Music diff --git a/src/Stage.h b/src/Stage.h index db4296d1..d0ef23cb 100644 --- a/src/Stage.h +++ b/src/Stage.h @@ -1,5 +1,7 @@ #pragma once +#include "WindowsWrapper.h" + struct STAGE_TABLE { char parts[0x20]; @@ -15,6 +17,6 @@ struct STAGE_TABLE extern int gStageNo; extern int gMusicNo; -bool TransferStage(int no, int w, int x, int y); +BOOL TransferStage(int no, int w, int x, int y); void ChangeMusic(int no); void ReCallMusic();