diff --git a/src/ArmsItem.cpp b/src/ArmsItem.cpp index aba1bbea..61e57f67 100644 --- a/src/ArmsItem.cpp +++ b/src/ArmsItem.cpp @@ -129,10 +129,10 @@ BOOL AddItemData(long code) } if (i == ITEM_MAX) - return false; + return FALSE; gItemData[i].code = code; - return true; + return TRUE; } BOOL SubItemData(long code) @@ -388,7 +388,7 @@ int CampLoop() if (gKeyTrg & KEY_ESCAPE) { - switch (Call_Escape()) + switch (Call_Escape(hWnd)) { case 0: return 0; @@ -430,7 +430,7 @@ int CampLoop() } } - if (!Flip_SystemTask()) + if (!Flip_SystemTask(hWnd)) return 0; } diff --git a/src/Draw.cpp b/src/Draw.cpp index 1e1dea2f..18744f41 100644 --- a/src/Draw.cpp +++ b/src/Draw.cpp @@ -48,8 +48,10 @@ FontObject *gFont; #define FRAMERATE 20 -BOOL Flip_SystemTask() +BOOL Flip_SystemTask(int hWnd) { + (void)hWnd; + while (true) { if (!SystemTask()) diff --git a/src/Draw.h b/src/Draw.h index 9ba82618..abe3269f 100644 --- a/src/Draw.h +++ b/src/Draw.h @@ -52,7 +52,7 @@ struct SURFACE; extern SURFACE surf[SURFACE_ID_MAX]; -BOOL Flip_SystemTask(); +BOOL Flip_SystemTask(int hWnd); BOOL StartDirectDraw(int lMagnification, int lColourDepth); void EndDirectDraw(); void ReleaseSurface(int s); diff --git a/src/Ending.cpp b/src/Ending.cpp index 55949d9d..5dda8473 100644 --- a/src/Ending.cpp +++ b/src/Ending.cpp @@ -410,7 +410,7 @@ int Scene_DownIsland(int mode) // Escape menu if (gKey & 0x8000) { - int escRet = Call_Escape(); + int escRet = Call_Escape(hWnd); if (escRet == 0) return 0; if (escRet == 2) @@ -464,7 +464,7 @@ int Scene_DownIsland(int mode) // Draw window PutFramePerSecound(); - if (!Flip_SystemTask()) + if (!Flip_SystemTask(hWnd)) return 0; } diff --git a/src/Escape.cpp b/src/Escape.cpp index 99a8bdd4..bd7c80d3 100644 --- a/src/Escape.cpp +++ b/src/Escape.cpp @@ -7,7 +7,7 @@ #include "KeyControl.h" #include "Main.h" -int Call_Escape() +int Call_Escape(int hWnd) { RECT rc = {0, 128, 208, 144}; @@ -37,7 +37,7 @@ int Call_Escape() PutBitmap3(&grcFull, (WINDOW_WIDTH - 208) / 2, (WINDOW_HEIGHT - 16) / 2, &rc, SURFACE_ID_TEXT_BOX); PutFramePerSecound(); - if (!Flip_SystemTask()) + if (!Flip_SystemTask(hWnd)) { // Quit if window is closed gKeyTrg = 0; diff --git a/src/Escape.h b/src/Escape.h index b2be505f..d63213c1 100644 --- a/src/Escape.h +++ b/src/Escape.h @@ -1,3 +1,3 @@ #pragma once -int Call_Escape(); +int Call_Escape(int hWnd); diff --git a/src/Game.cpp b/src/Game.cpp index b0af8034..0a5f761c 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -141,7 +141,7 @@ int ModeOpening() // Escape menu if (gKey & KEY_ESCAPE) { - int escRet = Call_Escape(); + int escRet = Call_Escape(hWnd); if (escRet == 0) return 0; if (escRet == 2) @@ -193,7 +193,7 @@ int ModeOpening() PutTextScript(); PutFramePerSecound(); - if (!Flip_SystemTask()) + if (!Flip_SystemTask(hWnd)) return 0; ++gCounter; @@ -204,7 +204,7 @@ int ModeOpening() { CortBox(&grcGame, 0x000000); PutFramePerSecound(); - if (!Flip_SystemTask()) + if (!Flip_SystemTask(hWnd)) return 0; } return 2; @@ -335,7 +335,7 @@ int ModeTitle() if (gKey & KEY_ESCAPE) { - int escRet = Call_Escape(); + int escRet = Call_Escape(hWnd); if (escRet == 0) return 0; if (escRet == 2) @@ -420,7 +420,7 @@ int ModeTitle() PutFramePerSecound(); - if (!Flip_SystemTask()) + if (!Flip_SystemTask(hWnd)) return 0; } @@ -433,7 +433,7 @@ int ModeTitle() { CortBox(&grcGame, 0); PutFramePerSecound(); - if (!Flip_SystemTask()) + if (!Flip_SystemTask(hWnd)) return 0; } @@ -479,7 +479,7 @@ int ModeAction() // Escape menu if (gKey & KEY_ESCAPE) { - int escRet = Call_Escape(); + int escRet = Call_Escape(hWnd); if (escRet == 0) return 0; if (escRet == 2) @@ -614,7 +614,7 @@ int ModeAction() PutTextScript(); PutFramePerSecound(); - if (!Flip_SystemTask()) + if (!Flip_SystemTask(hWnd)) break; ++gCounter; } diff --git a/src/Main.cpp b/src/Main.cpp index bc136be2..d6590f6a 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -32,6 +32,7 @@ char gDataPath[PATH_LENGTH]; int gJoystickButtonTable[8]; +int hWnd; // Placeholder until we restore the WinAPI code bool gbUseJoystick = false; bool bFps = false; @@ -349,7 +350,7 @@ int main(int argc, char *argv[]) PutBitmap3(&clip_rect, (WINDOW_WIDTH - 64) / 2, (WINDOW_HEIGHT - 8) / 2, &loading_rect, SURFACE_ID_LOADING); // Draw to screen - if (Flip_SystemTask()) + if (Flip_SystemTask(hWnd)) { // Initialize sound InitDirectSound(); diff --git a/src/Main.h b/src/Main.h index 8d059ff1..793c36e6 100644 --- a/src/Main.h +++ b/src/Main.h @@ -1,4 +1,6 @@ #pragma once +extern int hWnd; + void PutFramePerSecound(); int GetFramePerSecound(); diff --git a/src/MiniMap.cpp b/src/MiniMap.cpp index 9d3800f6..d0cf5ab7 100644 --- a/src/MiniMap.cpp +++ b/src/MiniMap.cpp @@ -79,19 +79,23 @@ void WriteMiniMapLine(int line) int MiniMapLoop() { int f; + int line; + unsigned char my_wait; + + RECT rcMiniMap; + RECT rcView; RECT my_rect = {0, 57, 1, 58}; int my_x = (gMC.x / 0x200 + 8) / 16; int my_y = (gMC.y / 0x200 + 8) / 16; - RECT rcView; for (f = 0; f <= 8; f++) { GetTrg(); if (gKey & KEY_ESCAPE) { - switch (Call_Escape()) + switch (Call_Escape(hWnd)) { case 0: return 0; @@ -111,11 +115,10 @@ int MiniMapLoop() CortBox(&rcView, 0); PutFramePerSecound(); - if (!Flip_SystemTask()) + if (!Flip_SystemTask(hWnd)) return 0; } - RECT rcMiniMap; rcMiniMap.left = 0; rcMiniMap.right = gMap.width; rcMiniMap.top = 0; @@ -125,8 +128,8 @@ int MiniMapLoop() rcView.bottom = --rcView.top + gMap.length + 2; CortBox2(&rcMiniMap, 0, SURFACE_ID_MAP); - int line = 0; - unsigned char my_wait = 0; + line = 0; + my_wait = 0; while (true) { GetTrg(); @@ -136,7 +139,7 @@ int MiniMapLoop() if (gKey & KEY_ESCAPE) { - switch (Call_Escape()) + switch (Call_Escape(hWnd)) { case 0: return 0; @@ -167,7 +170,7 @@ int MiniMapLoop() PutBitmap3(&grcGame, my_x + rcView.left + 1, my_y + rcView.top + 1, &my_rect, SURFACE_ID_TEXT_BOX); PutFramePerSecound(); - if (!Flip_SystemTask()) + if (!Flip_SystemTask(hWnd)) return 0; } @@ -177,7 +180,7 @@ int MiniMapLoop() if (gKey & KEY_ESCAPE) { - switch (Call_Escape()) + switch (Call_Escape(hWnd)) { case 0: return 0; @@ -197,7 +200,7 @@ int MiniMapLoop() CortBox(&rcView, 0); PutFramePerSecound(); - if (!Flip_SystemTask()) + if (!Flip_SystemTask(hWnd)) return 0; } diff --git a/src/SelStage.cpp b/src/SelStage.cpp index 6fe62be0..25cbff45 100644 --- a/src/SelStage.cpp +++ b/src/SelStage.cpp @@ -151,7 +151,7 @@ int StageSelectLoop(int *p_event) if (gKey & KEY_ESCAPE) { - int escRet = Call_Escape(); + int escRet = Call_Escape(hWnd); if (escRet == 0) return 0; if (escRet == 2) @@ -193,7 +193,7 @@ int StageSelectLoop(int *p_event) PutFramePerSecound(); } - while (Flip_SystemTask()); + while (Flip_SystemTask(hWnd)); return 0; }