Add and apply the enum_ESCRETURN enum

Restored from the original source code, as it survived in the Linux
port's debug data.
This commit is contained in:
Clownacy 2020-01-06 19:16:57 +00:00
parent b5ad6f5154
commit c838e8ebcb
8 changed files with 104 additions and 78 deletions

View file

@ -446,10 +446,11 @@ int CampLoop(void)
{
switch (Call_Escape(ghWnd))
{
case 0:
return 0; // Quit game
case 2:
return 2; // Go to game intro
case enum_ESCRETURN_exit:
return enum_ESCRETURN_exit; // Quit game
case enum_ESCRETURN_restart:
return enum_ESCRETURN_restart; // Go to game intro
}
}
@ -458,10 +459,11 @@ int CampLoop(void)
switch (TextScriptProc())
{
case 0:
return 0; // Quit game
case 2:
return 2; // Go to game intro
case enum_ESCRETURN_exit:
return enum_ESCRETURN_exit; // Quit game
case enum_ESCRETURN_restart:
return enum_ESCRETURN_restart; // Go to game intro
}
// Get currently displayed image
@ -489,13 +491,13 @@ int CampLoop(void)
}
if (!Flip_SystemTask(ghWnd))
return 0; // Quit game
return enum_ESCRETURN_exit; // Quit game
}
// Resume original script
LoadTextScript_Stage(old_script_path);
gArmsEnergyX = 32; // Displays weapon rotation animation in case the weapon was changed
return 1; // Go to game
return enum_ESCRETURN_continue; // Go to game
}
BOOL CheckItem(long a)

View file

@ -466,10 +466,11 @@ int Scene_DownIsland(HWND hWnd, int mode)
{
switch (Call_Escape(hWnd))
{
case 0:
return 0;
case 2:
return 2;
case enum_ESCRETURN_exit:
return enum_ESCRETURN_exit;
case enum_ESCRETURN_restart:
return enum_ESCRETURN_restart;
}
}
@ -515,8 +516,8 @@ int Scene_DownIsland(HWND hWnd, int mode)
// Draw window
PutFramePerSecound();
if (!Flip_SystemTask(hWnd))
return 0;
return enum_ESCRETURN_exit;
}
return 1;
return enum_ESCRETURN_continue;
}

View file

@ -19,17 +19,17 @@ int Call_Escape(HWND hWnd)
if (gKeyTrg & KEY_ESCAPE) // Escape is pressed, quit game
{
gKeyTrg = 0;
return 0;
return enum_ESCRETURN_exit;
}
if (gKeyTrg & KEY_F1) // F1 is pressed, continue
{
gKeyTrg = 0;
return 1;
return enum_ESCRETURN_continue;
}
if (gKeyTrg & KEY_F2) // F2 is pressed, reset
{
gKeyTrg = 0;
return 2;
return enum_ESCRETURN_restart;
}
// Draw screen
@ -41,9 +41,9 @@ int Call_Escape(HWND hWnd)
{
// Quit if window is closed
gKeyTrg = 0;
return 0;
return enum_ESCRETURN_exit;
}
}
return 0;
return enum_ESCRETURN_exit;
}

View file

@ -2,4 +2,11 @@
#include "WindowsWrapper.h"
enum enum_ESCRETURN
{
enum_ESCRETURN_exit,
enum_ESCRETURN_continue,
enum_ESCRETURN_restart
};
int Call_Escape(HWND hWnd);

View file

@ -152,9 +152,10 @@ int ModeOpening(HWND hWnd)
{
switch (Call_Escape(ghWnd))
{
case 0:
case enum_ESCRETURN_exit:
return 0;
case 2:
case enum_ESCRETURN_restart:
return 1;
}
}
@ -195,9 +196,10 @@ int ModeOpening(HWND hWnd)
// Update Text Script
switch (TextScriptProc())
{
case 0:
case enum_ESCRETURN_exit:
return 0;
case 2:
case enum_ESCRETURN_restart:
return 1;
}
@ -362,9 +364,10 @@ int ModeTitle(HWND hWnd)
{
switch (Call_Escape(ghWnd))
{
case 0:
case enum_ESCRETURN_exit:
return 0;
case 2:
case enum_ESCRETURN_restart:
return 1;
}
}
@ -525,9 +528,10 @@ int ModeAction(HWND hWnd)
{
switch (Call_Escape(ghWnd))
{
case 0:
case enum_ESCRETURN_exit:
return 0;
case 2:
case enum_ESCRETURN_restart:
return 1;
}
}
@ -605,9 +609,10 @@ int ModeAction(HWND hWnd)
switch (CampLoop())
{
case 0:
case enum_ESCRETURN_exit:
return 0;
case 2:
case enum_ESCRETURN_restart:
return 1;
}
@ -619,9 +624,10 @@ int ModeAction(HWND hWnd)
switch (MiniMapLoop())
{
case 0:
case enum_ESCRETURN_exit:
return 0;
case 2:
case enum_ESCRETURN_restart:
return 1;
}
}
@ -639,9 +645,10 @@ int ModeAction(HWND hWnd)
{
switch (TextScriptProc())
{
case 0:
case enum_ESCRETURN_exit:
return 0;
case 2:
case enum_ESCRETURN_restart:
return 1;
}
}

View file

@ -96,10 +96,11 @@ int MiniMapLoop(void)
{
switch (Call_Escape(ghWnd))
{
case 0:
return 0;
case 2:
return 2;
case enum_ESCRETURN_exit:
return enum_ESCRETURN_exit;
case enum_ESCRETURN_restart:
return enum_ESCRETURN_restart;
}
}
@ -115,7 +116,7 @@ int MiniMapLoop(void)
PutFramePerSecound();
if (!Flip_SystemTask(ghWnd))
return 0;
return enum_ESCRETURN_exit;
}
rcMiniMap.left = 0;
@ -140,10 +141,11 @@ int MiniMapLoop(void)
{
switch (Call_Escape(ghWnd))
{
case 0:
return 0;
case 2:
return 2;
case enum_ESCRETURN_exit:
return enum_ESCRETURN_exit;
case enum_ESCRETURN_restart:
return enum_ESCRETURN_restart;
}
}
@ -172,7 +174,7 @@ int MiniMapLoop(void)
PutFramePerSecound();
if (!Flip_SystemTask(ghWnd))
return 0;
return enum_ESCRETURN_exit;
}
for (f = 8; f >= -1; --f)
@ -183,10 +185,11 @@ int MiniMapLoop(void)
{
switch (Call_Escape(ghWnd))
{
case 0:
return 0;
case 2:
return 2;
case enum_ESCRETURN_exit:
return enum_ESCRETURN_exit;
case enum_ESCRETURN_restart:
return enum_ESCRETURN_restart;
}
}
@ -202,10 +205,10 @@ int MiniMapLoop(void)
PutFramePerSecound();
if (!Flip_SystemTask(ghWnd))
return 0;
return enum_ESCRETURN_exit;
}
return 1;
return enum_ESCRETURN_continue;
}
BOOL IsMapping(void)

View file

@ -174,10 +174,11 @@ int StageSelectLoop(int *p_event)
{
switch (Call_Escape(ghWnd))
{
case 0:
return 0;
case 2:
return 2;
case enum_ESCRETURN_exit:
return enum_ESCRETURN_exit;
case enum_ESCRETURN_restart:
return enum_ESCRETURN_restart;
}
}
@ -185,10 +186,11 @@ int StageSelectLoop(int *p_event)
switch (TextScriptProc())
{
case 0:
return 0;
case 2:
return 2;
case enum_ESCRETURN_exit:
return enum_ESCRETURN_exit;
case enum_ESCRETURN_restart:
return enum_ESCRETURN_restart;
}
#ifdef FIX_BUGS
@ -210,16 +212,16 @@ int StageSelectLoop(int *p_event)
StopTextScript();
LoadTextScript_Stage(old_script_path);
*p_event = 0;
return 1;
return enum_ESCRETURN_continue;
}
PutFramePerSecound();
if (!Flip_SystemTask(ghWnd))
return 0;
return enum_ESCRETURN_exit;
}
LoadTextScript_Stage(old_script_path);
*p_event = gPermitStage[gSelectedStage].event;
return 1;
return enum_ESCRETURN_continue;
}

View file

@ -12,6 +12,7 @@
#include "CommonDefines.h"
#include "Draw.h"
#include "Ending.h"
#include "Escape.h"
#include "Fade.h"
#include "Flags.h"
#include "Flash.h"
@ -719,7 +720,7 @@ int TextScriptProc(void)
if (!TransferStage(z, w, x, y))
{
MessageBoxA(ghWnd, "\x83\x58\x83\x65\x81\x5B\x83\x57\x82\xCC\x93\xC7\x82\xDD\x8D\x9E\x82\xDD\x82\xC9\x8E\xB8\x94\x73", "\x83\x47\x83\x89\x81\x5B", MB_OK); // 'ステージの読み込みに失敗' and 'エラー' ('Failed to load stage' and 'Error') in Shift-JIS
return 0;
return enum_ESCRETURN_exit;
}
}
else if (IS_COMMAND('M','O','V'))
@ -1054,10 +1055,11 @@ int TextScriptProc(void)
switch (MiniMapLoop())
{
case 0:
return 0;
case 2:
return 2;
case enum_ESCRETURN_exit:
return enum_ESCRETURN_exit;
case enum_ESCRETURN_restart:
return enum_ESCRETURN_restart;
}
}
else if (IS_COMMAND('S','L','P'))
@ -1066,10 +1068,11 @@ int TextScriptProc(void)
switch (StageSelectLoop(&z))
{
case 0:
return 0;
case 2:
return 2;
case enum_ESCRETURN_exit:
return enum_ESCRETURN_exit;
case enum_ESCRETURN_restart:
return enum_ESCRETURN_restart;
}
JumpTextScript(z);
@ -1251,24 +1254,25 @@ int TextScriptProc(void)
switch (Scene_DownIsland(ghWnd, z))
{
case 0:
return 0;
case 2:
return 2;
case enum_ESCRETURN_exit:
return enum_ESCRETURN_exit;
case enum_ESCRETURN_restart:
return enum_ESCRETURN_restart;
}
gTS.p_read += 8;
}
else if (IS_COMMAND('E','S','C'))
{
return 2;
return enum_ESCRETURN_restart;
}
else
{
char str_0[0x40];
sprintf(str_0, "\x95\x73\x96\xBE\x82\xCC\x83\x52\x81\x5B\x83\x68:<%c%c%c", gTS.data[gTS.p_read + 1], gTS.data[gTS.p_read + 2], gTS.data[gTS.p_read + 3]); // '不明のコード:<%c%c%c' (Unknown code:<%c%c%c) in Shift-JIS
MessageBoxA(NULL, str_0, "\x83\x47\x83\x89\x81\x5B", MB_OK); // 'エラー' (Error) in Shift-JIS
return 0;
return enum_ESCRETURN_exit;
}
}
else
@ -1468,7 +1472,7 @@ int TextScriptProc(void)
else
g_GameFlags |= 4;
return 1;
return enum_ESCRETURN_continue;
}
void RestoreTextScript(void)