From c9d5b3d03afbdf613f8c84f390b3646bafdaaec0 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Mon, 13 May 2019 20:43:43 +0100 Subject: [PATCH] Made Ending.cpp ASM-accurate --- msvc2003/devilution/comparer-config.toml | 64 +++++ src/ArmsItem.cpp | 4 +- src/Ending.cpp | 310 +++++++++++++---------- src/Ending.h | 6 +- src/Game.cpp | 16 +- src/Generic.cpp | 20 +- src/Generic.h | 8 +- src/Main.cpp | 4 +- src/Main.h | 2 +- src/MiniMap.cpp | 12 +- src/Profile.cpp | 6 +- src/SelStage.cpp | 4 +- src/TextScr.cpp | 5 +- 13 files changed, 287 insertions(+), 174 deletions(-) diff --git a/msvc2003/devilution/comparer-config.toml b/msvc2003/devilution/comparer-config.toml index e7f532c5..82146f47 100644 --- a/msvc2003/devilution/comparer-config.toml +++ b/msvc2003/devilution/comparer-config.toml @@ -355,6 +355,70 @@ addr = 0x40AD60 name = "DefaultConfigData" addr = 0x40AE30 +[[func]] +name = "ActionStripper" +addr = 0x40CF90 + +[[func]] +name = "PutStripper" +addr = 0x40D010 + +[[func]] +name = "SetStripper" +addr = 0x40D150 + +[[func]] +name = "RestoreStripper" +addr = 0x40D240 + +[[func]] +name = "ActionIllust" +addr = 0x40D2D0 + +[[func]] +name = "PutIllust" +addr = 0x40D350 + +[[func]] +name = "ReloadIllust" +addr = 0x40D3A0 + +[[func]] +name = "InitCreditScript" +addr = 0x40D3E0 + +[[func]] +name = "ReleaseCreditScript" +addr = 0x40D410 + +[[func]] +name = "StartCreditScript" +addr = 0x40D440 + +[[func]] +name = "ActionCredit" +addr = 0x40D5C0 + +[[func]] +name = "ActionCredit_Read" +addr = 0x40D620 + +[[func]] +name = "GetScriptNumber" +addr = 0x40DB00 + +[[func]] +name = "SetCreditIllust" +addr = 0x40DB40 + +[[func]] +name = "CutCreditIllust" +addr = 0x40DB60 + +[[func]] +name = "Scene_DownIsland" +addr = 0x40DB70 + [[func]] name = "Call_Escape" addr = 0x40DD70 diff --git a/src/ArmsItem.cpp b/src/ArmsItem.cpp index e947a133..2791ad00 100644 --- a/src/ArmsItem.cpp +++ b/src/ArmsItem.cpp @@ -391,7 +391,7 @@ int CampLoop() if (gKeyTrg & KEY_ESCAPE) { - switch (Call_Escape(hWnd)) + switch (Call_Escape(ghWnd)) { case 0: return 0; @@ -433,7 +433,7 @@ int CampLoop() } } - if (!Flip_SystemTask(hWnd)) + if (!Flip_SystemTask(ghWnd)) return 0; } diff --git a/src/Ending.cpp b/src/Ending.cpp index 5dda8473..3ab2cefd 100644 --- a/src/Ending.cpp +++ b/src/Ending.cpp @@ -39,20 +39,27 @@ void ActionStripper() // Draw casts void PutStripper() { + RECT rc; + for (int s = 0; s < MAX_STRIP; s++) { if (Strip[s].flag & 0x80) { // Draw text - RECT rc = {0, 16 * s, 320, 16 * s + 16}; - PutBitmap3(&grcFull, (Strip[s].x + ((WINDOW_WIDTH - 320) << 8)) / 0x200, Strip[s].y / 0x200, &rc, SURFACE_ID_CREDIT_CAST); + rc.left = 0; + rc.right = 320; + rc.top = s * 0x10; + rc.bottom = rc.top + 0x10; + + PutBitmap3(&grcFull, (Strip[s].x / 0x200) + ((WINDOW_WIDTH - 320) / 2), (Strip[s].y / 0x200), &rc, SURFACE_ID_CREDIT_CAST); // Draw character rc.left = 24 * (Strip[s].cast % 13); rc.right = rc.left + 24; rc.top = 24 * (Strip[s].cast / 13); rc.bottom = rc.top + 24; - PutBitmap3(&grcFull, (Strip[s].x + ((WINDOW_WIDTH - 320) << 8)) / 0x200 - 24, Strip[s].y / 0x200 - 8, &rc, SURFACE_ID_CASTS); + + PutBitmap3(&grcFull, (Strip[s].x / 0x200) + ((WINDOW_WIDTH - 320) / 2) - 24, (Strip[s].y / 0x200) - 8, &rc, SURFACE_ID_CASTS); } } } @@ -60,34 +67,47 @@ void PutStripper() // Create a cast object void SetStripper(int x, int y, const char *text, int cast) { - for (int s = 0; s < MAX_STRIP; s++) - { - if (!(Strip[s].flag & 0x80)) - { - // Initialize cast property - Strip[s].flag = 0x80; - Strip[s].x = x; - Strip[s].y = y; - Strip[s].cast = cast; - strcpy(Strip[s].str, text); + RECT rc; + int s; - // Draw text - RECT rc = {0, 16 * s, 320, 16 * s + 16}; - CortBox2(&rc, 0, SURFACE_ID_CREDIT_CAST); - PutText2(0, 16 * s, text, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_CREDIT_CAST); + for (s = 0; s < MAX_STRIP; s++) + if (!(Strip[s].flag & 0x80)) break; - } - } + + if (s == MAX_STRIP) + return; + + // Initialize cast property + Strip[s].flag = 0x80; + Strip[s].x = x; + Strip[s].y = y; + Strip[s].cast = cast; + strcpy(Strip[s].str, text); + + // Draw text + rc.left = 0; + rc.right = 320; + rc.top = s * 0x10; + rc.bottom = rc.top + 0x10; + + CortBox2(&rc, 0, SURFACE_ID_CREDIT_CAST); + PutText2(0, rc.top, text, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_CREDIT_CAST); } // Regenerate cast text void RestoreStripper() { + RECT rc; + for (int s = 0; s < MAX_STRIP; s++) { if (Strip[s].flag & 0x80) { - RECT rc = {0, 16 * s, 320, 16 * s + 16}; + rc.left = 0; + rc.right = 320; + rc.top = s * 0x10; + rc.bottom = rc.top + 0x10; + CortBox2(&rc, 0, SURFACE_ID_CREDIT_CAST); PutText2(0, rc.top, Strip[s].str, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_CREDIT_CAST); } @@ -121,8 +141,13 @@ void ActionIllust() void PutIllust() { RECT rcIllust = {0, 0, 160, 240}; +#if WINDOW_WIDTH != 320 || WINDOW_HEIGHT != 240 + // Widescreen edit RECT rcClip = {(WINDOW_WIDTH - 320) / 2, 0, WINDOW_WIDTH, WINDOW_HEIGHT}; - PutBitmap3(&rcClip, (Illust.x + ((WINDOW_WIDTH - 320) << 8)) / 0x200, (WINDOW_HEIGHT - 240) / 2, &rcIllust, SURFACE_ID_CREDITS_IMAGE); + PutBitmap3(&rcClip, (Illust.x / 0x200) + ((WINDOW_WIDTH - 320) / 2), (WINDOW_HEIGHT - 240) / 2, &rcIllust, SURFACE_ID_CREDITS_IMAGE); +#else + PutBitmap3(&grcFull, (Illust.x / 0x200) + ((WINDOW_WIDTH - 320) / 2), (WINDOW_HEIGHT - 240) / 2, &rcIllust, SURFACE_ID_CREDITS_IMAGE); +#endif } // Load illustration @@ -151,8 +176,10 @@ void ReleaseCreditScript() } } +const char *credit_script = "Credit.tsc"; + // Start playing credits -bool StartCreditScript() +BOOL StartCreditScript() { // Clear previously existing credits data if (Credit.pData) @@ -163,22 +190,22 @@ bool StartCreditScript() // Open file char path[PATH_LENGTH]; - sprintf(path, "%s/%s", gDataPath, "Credit.tsc"); + sprintf(path, "%s/%s", gDataPath, credit_script); Credit.size = GetFileSizeLong(path); if (Credit.size == -1) - return false; + return FALSE; // Allocate buffer data Credit.pData = (char*)malloc(Credit.size); if (Credit.pData == NULL) - return false; + return FALSE; FILE *fp = fopen(path, "rb"); if (fp == NULL) { - printf("Couldn't open %s", path); - return false; + free(Credit.pData); + return FALSE; } // Read data @@ -199,98 +226,97 @@ bool StartCreditScript() // Modify cliprect grcGame.left = WINDOW_WIDTH / 2; +#if WINDOW_WIDTH != 320 || WINDOW_HEIGHT != 240 // These three are non-vanilla: for wide/tallscreen support grcGame.right = ((WINDOW_WIDTH - 320) / 2) + 320; grcGame.top = (WINDOW_HEIGHT - 240) / 2; grcGame.bottom = ((WINDOW_HEIGHT - 240) / 2) + 240; +#endif // Reload casts if (!ReloadBitmap_File("casts", SURFACE_ID_CASTS)) - return false; + return FALSE; // Clear casts memset(Strip, 0, sizeof(Strip)); - return true; + return TRUE; } // Get number from text (4 digit) int GetScriptNumber(const char *text) { - return 1000 * text[0] - 48000 + - 100 * text[1] - 4800 + - 10 * text[2] - 480 + - text[3] - 48; + return (text[0] - '0') * 1000 + + (text[1] - '0') * 100 + + (text[2] - '0') * 10 + + text[3] - '0'; } // Parse credits void ActionCredit_Read() { - while (Credit.offset < Credit.size) - { - // Get character - unsigned char character = Credit.pData[Credit.offset]; + int a, b, len; + char text[40]; - int a, b, len; - switch (character) + while (1) + { + if (Credit.offset >= Credit.size) + break; + + switch (Credit.pData[Credit.offset]) { case '[': // Create cast // Get the range for the cast text - a = ++Credit.offset; + ++Credit.offset; + + a = Credit.offset; while (Credit.pData[a] != ']') { if (IsShiftJIS(Credit.pData[a])) a += 2; else - a++; + a += 1; } len = a - Credit.offset; // Copy the text to the cast text - char text[40]; - memcpy(text, &Credit.pData[Credit.offset], a - Credit.offset); + memcpy(text, &Credit.pData[Credit.offset], len); text[len] = 0; // Get cast id - Credit.offset = a + 1; - len = GetScriptNumber(&Credit.pData[a + 1]); + Credit.offset = a; + len = GetScriptNumber(&Credit.pData[++Credit.offset]); // Create cast object - SetStripper(Credit.start_x, (WINDOW_HEIGHT << 9) + 0x1000, text, len); + SetStripper(Credit.start_x, (WINDOW_HEIGHT * 0x200) + (8 * 0x200), text, len); // Change offset Credit.offset += 4; return; - case 'j': // Jump to label - // Get number - b = GetScriptNumber(&Credit.pData[++Credit.offset]); - - // Change offset + case '-': // Wait for X amount of frames + ++Credit.offset; + Credit.wait = GetScriptNumber(&Credit.pData[Credit.offset]); Credit.offset += 4; + Credit.mode = 2; + return; - // Jump to specific label - while (Credit.offset < Credit.size) - { - if (Credit.pData[Credit.offset] == 'l') - { - // What is this - a = GetScriptNumber(&Credit.pData[++Credit.offset]); - Credit.offset += 4; - if (b == a) - return; - } - else if (IsShiftJIS(Credit.pData[Credit.offset])) - { - Credit.offset += 2; - } - else - { - ++Credit.offset; - } - } + case '+': // Change casts x-position + ++Credit.offset; + Credit.start_x = GetScriptNumber(&Credit.pData[Credit.offset]) * 0x200; + Credit.offset += 4; + return; + case '/': // Stop credits + Credit.mode = 0; + return; + + case '!': // Change music + ++Credit.offset; + a = GetScriptNumber(&Credit.pData[Credit.offset]); + Credit.offset += 4; + ChangeMusic(a); return; case '~': // Start fading out music @@ -298,9 +324,46 @@ void ActionCredit_Read() SetOrganyaFadeout(); return; + case 'j': // Jump to label + ++Credit.offset; + + // Get number + b = GetScriptNumber(&Credit.pData[Credit.offset]); + + // Change offset + Credit.offset += 4; + + // Jump to specific label + if (1) + { + while (Credit.offset < Credit.size) + { + if (Credit.pData[Credit.offset] == 'l') + { + // What is this + a = GetScriptNumber(&Credit.pData[++Credit.offset]); + Credit.offset += 4; + if (b == a) + break; + } + else if (IsShiftJIS(Credit.pData[Credit.offset])) + { + Credit.offset += 2; + } + else + { + ++Credit.offset; + } + } + } + + return; + case 'f': // Flag jump + ++Credit.offset; + // Read numbers XXXX:YYYY - a = GetScriptNumber(&Credit.pData[++Credit.offset]); + a = GetScriptNumber(&Credit.pData[Credit.offset]); Credit.offset += 5; b = GetScriptNumber(&Credit.pData[Credit.offset]); Credit.offset += 4; @@ -316,7 +379,7 @@ void ActionCredit_Read() a = GetScriptNumber(&Credit.pData[++Credit.offset]); Credit.offset += 4; if (b == a) - return; + break; } else if (IsShiftJIS(Credit.pData[Credit.offset])) { @@ -330,47 +393,30 @@ void ActionCredit_Read() } return; - case '+': // Change casts x-position - Credit.start_x = GetScriptNumber(&Credit.pData[++Credit.offset]) << 9; - Credit.offset += 4; - return; - - case '-': // Wait for X amount of frames - Credit.wait = GetScriptNumber(&Credit.pData[++Credit.offset]); - Credit.offset += 4; - Credit.mode = 2; - return; - - case '/': // Stop credits - Credit.mode = 0; - return; - - case '!': // Change music - a = GetScriptNumber(&Credit.pData[++Credit.offset]); - Credit.offset += 4; - ChangeMusic(a); - return; + default: + // Progress through file + ++Credit.offset; + break; } - - // Progress through file - ++Credit.offset; } } // Update credits void ActionCredit() { - if (Credit.offset < Credit.size) + if (Credit.offset >= Credit.size) + return; + + // Update script, or if waiting, decrement the wait value + switch (Credit.mode) { - // Update script, or if waiting, decrement the wait value - if (Credit.mode == 1) - { + case 1: ActionCredit_Read(); - } - else if (Credit.mode == 2 && --Credit.wait <= 0) - { - Credit.mode = 1; - } + break; + + case 2: + if (--Credit.wait <= 0) + Credit.mode = 1; } } @@ -388,7 +434,7 @@ void CutCreditIllust() } // Scene of the island falling -int Scene_DownIsland(int mode) +int Scene_DownIsland(int hWnd, int mode) { // Setup background RECT rc_frame = {(WINDOW_WIDTH - 160) / 2, (WINDOW_HEIGHT - 80) / 2, (WINDOW_WIDTH + 160) / 2, (WINDOW_HEIGHT + 80) / 2}; @@ -410,11 +456,13 @@ int Scene_DownIsland(int mode) // Escape menu if (gKey & 0x8000) { - int escRet = Call_Escape(hWnd); - if (escRet == 0) - return 0; - if (escRet == 2) - return 2; + switch (Call_Escape(hWnd)) + { + case 0: + return 0; + case 2: + return 2; + } } switch (mode) @@ -425,33 +473,27 @@ int Scene_DownIsland(int mode) break; case 1: - if (wait >= 350) - { - if (wait >= 500) - { - if (wait >= 600) - { - // End scene - if (wait == 750) - wait = 900; - } - else - { - // Move down slow - sprite.y += 0xC; - } - } - else - { - // Move down slower - sprite.y += 0x19; - } - } - else + if (wait < 350) { // Move down at normal speed sprite.y += 0x33; } + else if (wait < 500) + { + // Move down slower + sprite.y += 0x19; + } + else if (wait < 600) + { + // Move down slow + sprite.y += 0xC; + } + else if (wait == 750) + { + // End scene + wait = 900; + } + break; } diff --git a/src/Ending.h b/src/Ending.h index 3c38ae2b..4a745ce4 100644 --- a/src/Ending.h +++ b/src/Ending.h @@ -1,5 +1,7 @@ #pragma once +#include "WindowsWrapper.h" + struct CREDIT { int size; @@ -42,8 +44,8 @@ void PutIllust(); void ReloadIllust(int a); void InitCreditScript(); void ReleaseCreditScript(); -bool StartCreditScript(); +BOOL StartCreditScript(); void ActionCredit(); void SetCreditIllust(int a); void CutCreditIllust(); -int Scene_DownIsland(int mode); +int Scene_DownIsland(int hWnd, int mode); diff --git a/src/Game.cpp b/src/Game.cpp index 0a5f761c..82b5aa36 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(hWnd); + int escRet = Call_Escape(ghWnd); if (escRet == 0) return 0; if (escRet == 2) @@ -193,7 +193,7 @@ int ModeOpening() PutTextScript(); PutFramePerSecound(); - if (!Flip_SystemTask(hWnd)) + if (!Flip_SystemTask(ghWnd)) return 0; ++gCounter; @@ -204,7 +204,7 @@ int ModeOpening() { CortBox(&grcGame, 0x000000); PutFramePerSecound(); - if (!Flip_SystemTask(hWnd)) + if (!Flip_SystemTask(ghWnd)) return 0; } return 2; @@ -335,7 +335,7 @@ int ModeTitle() if (gKey & KEY_ESCAPE) { - int escRet = Call_Escape(hWnd); + int escRet = Call_Escape(ghWnd); if (escRet == 0) return 0; if (escRet == 2) @@ -420,7 +420,7 @@ int ModeTitle() PutFramePerSecound(); - if (!Flip_SystemTask(hWnd)) + if (!Flip_SystemTask(ghWnd)) return 0; } @@ -433,7 +433,7 @@ int ModeTitle() { CortBox(&grcGame, 0); PutFramePerSecound(); - if (!Flip_SystemTask(hWnd)) + if (!Flip_SystemTask(ghWnd)) return 0; } @@ -479,7 +479,7 @@ int ModeAction() // Escape menu if (gKey & KEY_ESCAPE) { - int escRet = Call_Escape(hWnd); + int escRet = Call_Escape(ghWnd); if (escRet == 0) return 0; if (escRet == 2) @@ -614,7 +614,7 @@ int ModeAction() PutTextScript(); PutFramePerSecound(); - if (!Flip_SystemTask(hWnd)) + if (!Flip_SystemTask(ghWnd)) break; ++gCounter; } diff --git a/src/Generic.cpp b/src/Generic.cpp index b996ade8..72873bd4 100644 --- a/src/Generic.cpp +++ b/src/Generic.cpp @@ -2,16 +2,18 @@ #include +#include "WindowsWrapper.h" + #include "CommonDefines.h" #include "Tags.h" -bool GetCompileVersion(int *v1, int *v2, int *v3, int *v4) +BOOL GetCompileVersion(int *v1, int *v2, int *v3, int *v4) { *v1 = 1; *v2 = 0; *v3 = 0; *v4 = 6; - return true; + return TRUE; } long GetFileSizeLong(const char *path) @@ -29,7 +31,7 @@ long GetFileSizeLong(const char *path) return len; } -bool CheckFileExists(const char *name) +BOOL CheckFileExists(const char *name) { char path[PATH_LENGTH]; sprintf(path, "%s/%s", gModulePath, name); @@ -38,17 +40,17 @@ bool CheckFileExists(const char *name) if (file) { fclose(file); - return true; + return TRUE; } - return false; + return FALSE; } -bool IsShiftJIS(unsigned char c) +BOOL IsShiftJIS(unsigned char c) { if (c > 0x80 && c < 0xA0) - return true; + return TRUE; if (c < 0xE0 || c >= 0xF0) - return false; - return true; + return FALSE; + return TRUE; } diff --git a/src/Generic.h b/src/Generic.h index 175df9a4..191b38d7 100644 --- a/src/Generic.h +++ b/src/Generic.h @@ -1,6 +1,8 @@ #pragma once -bool GetCompileVersion(int *v1, int *v2, int *v3, int *v4); +#include "WindowsWrapper.h" + +BOOL GetCompileVersion(int *v1, int *v2, int *v3, int *v4); long GetFileSizeLong(const char *path); -bool CheckFileExists(const char *name); -bool IsShiftJIS(unsigned char c); +BOOL CheckFileExists(const char *name); +BOOL IsShiftJIS(unsigned char c); diff --git a/src/Main.cpp b/src/Main.cpp index d6590f6a..02c28b53 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -32,7 +32,7 @@ char gDataPath[PATH_LENGTH]; int gJoystickButtonTable[8]; -int hWnd; // Placeholder until we restore the WinAPI code +int ghWnd; // Placeholder until we restore the WinAPI code bool gbUseJoystick = false; bool bFps = false; @@ -350,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(hWnd)) + if (Flip_SystemTask(ghWnd)) { // Initialize sound InitDirectSound(); diff --git a/src/Main.h b/src/Main.h index 793c36e6..4213ccfe 100644 --- a/src/Main.h +++ b/src/Main.h @@ -1,6 +1,6 @@ #pragma once -extern int hWnd; +extern int ghWnd; void PutFramePerSecound(); int GetFramePerSecound(); diff --git a/src/MiniMap.cpp b/src/MiniMap.cpp index d0cf5ab7..6759886f 100644 --- a/src/MiniMap.cpp +++ b/src/MiniMap.cpp @@ -95,7 +95,7 @@ int MiniMapLoop() if (gKey & KEY_ESCAPE) { - switch (Call_Escape(hWnd)) + switch (Call_Escape(ghWnd)) { case 0: return 0; @@ -115,7 +115,7 @@ int MiniMapLoop() CortBox(&rcView, 0); PutFramePerSecound(); - if (!Flip_SystemTask(hWnd)) + if (!Flip_SystemTask(ghWnd)) return 0; } @@ -139,7 +139,7 @@ int MiniMapLoop() if (gKey & KEY_ESCAPE) { - switch (Call_Escape(hWnd)) + switch (Call_Escape(ghWnd)) { case 0: return 0; @@ -170,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(hWnd)) + if (!Flip_SystemTask(ghWnd)) return 0; } @@ -180,7 +180,7 @@ int MiniMapLoop() if (gKey & KEY_ESCAPE) { - switch (Call_Escape(hWnd)) + switch (Call_Escape(ghWnd)) { case 0: return 0; @@ -200,7 +200,7 @@ int MiniMapLoop() CortBox(&rcView, 0); PutFramePerSecound(); - if (!Flip_SystemTask(hWnd)) + if (!Flip_SystemTask(ghWnd)) return 0; } diff --git a/src/Profile.cpp b/src/Profile.cpp index 56d63925..07d8e4ae 100644 --- a/src/Profile.cpp +++ b/src/Profile.cpp @@ -254,12 +254,12 @@ BOOL InitializeGame() InitFlags(); if (!TransferStage(13, 200, 10, 8)) { - // TODO - restore this when hWnd is available + // TODO - restore this when ghWnd is available /*#if defined(NONPORTABLE) && defined(WINDOWS) #ifdef JAPANESE - MessageBoxA(hWnd, "ステージの読み込みに失敗", "エラー", MB_OK); + MessageBoxA(ghWnd, "ステージの読み込みに失敗", "エラー", MB_OK); #else - MessageBoxA(hWnd, "Failed to load stage", "Error", MB_OK); + MessageBoxA(ghWnd, "Failed to load stage", "Error", MB_OK); #endif #else*/ #ifdef JAPANESE diff --git a/src/SelStage.cpp b/src/SelStage.cpp index 25cbff45..35d5c2d4 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(hWnd); + int escRet = Call_Escape(ghWnd); if (escRet == 0) return 0; if (escRet == 2) @@ -193,7 +193,7 @@ int StageSelectLoop(int *p_event) PutFramePerSecound(); } - while (Flip_SystemTask(hWnd)); + while (Flip_SystemTask(ghWnd)); return 0; } diff --git a/src/TextScr.cpp b/src/TextScr.cpp index ab8dc9a8..b5a7bad7 100644 --- a/src/TextScr.cpp +++ b/src/TextScr.cpp @@ -21,6 +21,7 @@ #include "Game.h" #include "Generic.h" #include "KeyControl.h" +#include "Main.h" #include "Map.h" #include "MapName.h" #include "MiniMap.h" @@ -682,7 +683,7 @@ int TextScriptProc() SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", "Failed to load stage", NULL); #endif - //MessageBoxA(hWnd, "ステージの読み込みに失敗", "エラー", 0); + //MessageBoxA(ghWnd, "ステージの読み込みに失敗", "エラー", 0); return 0; } } @@ -1207,7 +1208,7 @@ int TextScriptProc() bExit = TRUE; z = GetTextScriptNo(gTS.p_read + 4); - switch (Scene_DownIsland(z)) + switch (Scene_DownIsland(ghWnd, z)) { case 0: return 0;