Merge branch 'accurate' into portable

This commit is contained in:
Clownacy 2020-01-06 19:39:36 +00:00
commit df9dc3e22d
8 changed files with 104 additions and 78 deletions

View file

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

View file

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

View file

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

View file

@ -1,3 +1,10 @@
#pragma once #pragma once
enum enum_ESCRETURN
{
enum_ESCRETURN_exit,
enum_ESCRETURN_continue,
enum_ESCRETURN_restart
};
int Call_Escape(void); int Call_Escape(void);

View file

@ -155,9 +155,10 @@ int ModeOpening()
{ {
switch (Call_Escape()) switch (Call_Escape())
{ {
case 0: case enum_ESCRETURN_exit:
return 0; return 0;
case 2:
case enum_ESCRETURN_restart:
return 1; return 1;
} }
} }
@ -198,9 +199,10 @@ int ModeOpening()
// Update Text Script // Update Text Script
switch (TextScriptProc()) switch (TextScriptProc())
{ {
case 0: case enum_ESCRETURN_exit:
return 0; return 0;
case 2:
case enum_ESCRETURN_restart:
return 1; return 1;
} }
@ -365,9 +367,10 @@ int ModeTitle(void)
{ {
switch (Call_Escape()) switch (Call_Escape())
{ {
case 0: case enum_ESCRETURN_exit:
return 0; return 0;
case 2:
case enum_ESCRETURN_restart:
return 1; return 1;
} }
} }
@ -528,9 +531,10 @@ int ModeAction(void)
{ {
switch (Call_Escape()) switch (Call_Escape())
{ {
case 0: case enum_ESCRETURN_exit:
return 0; return 0;
case 2:
case enum_ESCRETURN_restart:
return 1; return 1;
} }
} }
@ -608,9 +612,10 @@ int ModeAction(void)
switch (CampLoop()) switch (CampLoop())
{ {
case 0: case enum_ESCRETURN_exit:
return 0; return 0;
case 2:
case enum_ESCRETURN_restart:
return 1; return 1;
} }
@ -622,9 +627,10 @@ int ModeAction(void)
switch (MiniMapLoop()) switch (MiniMapLoop())
{ {
case 0: case enum_ESCRETURN_exit:
return 0; return 0;
case 2:
case enum_ESCRETURN_restart:
return 1; return 1;
} }
} }
@ -642,9 +648,10 @@ int ModeAction(void)
{ {
switch (TextScriptProc()) switch (TextScriptProc())
{ {
case 0: case enum_ESCRETURN_exit:
return 0; return 0;
case 2:
case enum_ESCRETURN_restart:
return 1; return 1;
} }
} }

View file

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

View file

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

View file

@ -12,6 +12,7 @@
#include "CommonDefines.h" #include "CommonDefines.h"
#include "Draw.h" #include "Draw.h"
#include "Ending.h" #include "Ending.h"
#include "Escape.h"
#include "Fade.h" #include "Fade.h"
#include "Flags.h" #include "Flags.h"
#include "Flash.h" #include "Flash.h"
@ -724,7 +725,7 @@ int TextScriptProc(void)
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", "Failed to load stage", NULL); SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", "Failed to load stage", NULL);
#endif #endif
return 0; return enum_ESCRETURN_exit;
} }
} }
else if (IS_COMMAND('M','O','V')) else if (IS_COMMAND('M','O','V'))
@ -1059,10 +1060,11 @@ int TextScriptProc(void)
switch (MiniMapLoop()) switch (MiniMapLoop())
{ {
case 0: case enum_ESCRETURN_exit:
return 0; return enum_ESCRETURN_exit;
case 2:
return 2; case enum_ESCRETURN_restart:
return enum_ESCRETURN_restart;
} }
} }
else if (IS_COMMAND('S','L','P')) else if (IS_COMMAND('S','L','P'))
@ -1071,10 +1073,11 @@ int TextScriptProc(void)
switch (StageSelectLoop(&z)) switch (StageSelectLoop(&z))
{ {
case 0: case enum_ESCRETURN_exit:
return 0; return enum_ESCRETURN_exit;
case 2:
return 2; case enum_ESCRETURN_restart:
return enum_ESCRETURN_restart;
} }
JumpTextScript(z); JumpTextScript(z);
@ -1256,17 +1259,18 @@ int TextScriptProc(void)
switch (Scene_DownIsland(z)) switch (Scene_DownIsland(z))
{ {
case 0: case enum_ESCRETURN_exit:
return 0; return enum_ESCRETURN_exit;
case 2:
return 2; case enum_ESCRETURN_restart:
return enum_ESCRETURN_restart;
} }
gTS.p_read += 8; gTS.p_read += 8;
} }
else if (IS_COMMAND('E','S','C')) else if (IS_COMMAND('E','S','C'))
{ {
return 2; return enum_ESCRETURN_restart;
} }
else else
{ {
@ -1279,7 +1283,7 @@ int TextScriptProc(void)
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", str_0, NULL); SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", str_0, NULL);
#endif #endif
return 0; return enum_ESCRETURN_exit;
} }
} }
else else
@ -1479,7 +1483,7 @@ int TextScriptProc(void)
else else
g_GameFlags |= 4; g_GameFlags |= 4;
return 1; return enum_ESCRETURN_continue;
} }
void RestoreTextScript(void) void RestoreTextScript(void)