Skip to content

Commit

Permalink
fix crash when the quickload y/n is ack'ed within the same frame
Browse files Browse the repository at this point in the history
Fixes #14.

Originally the game faked the Escape key being pressed to force menus
to be opened, so I changed that to be a specific variable.

Next, MNU_Dialog has changed to a ternary return: yes, no, no-answer.
This pulls the input handling into one place. Also, I think perhaps the
custom draw callback was intended to have different call phases. Needs
careful testing to verify my changes.

Also I turned back on demo record/play because I needed to check the
change with regards to the menu loop showing menus.
  • Loading branch information
jonof committed Oct 3, 2020
1 parent 64be212 commit 25d0010
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 76 deletions.
24 changes: 12 additions & 12 deletions src/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -1630,7 +1630,7 @@ NewLevel(VOID)
if (DemoModeMenuInit)
{
DemoModeMenuInit = FALSE;
KEY_PRESSED(KEYSC_ESC) = TRUE;
ForceMenus = TRUE;
}
}

Expand Down Expand Up @@ -2206,7 +2206,7 @@ MenuLevel(VOID)
// go to ordering menu only if shareware
if (FinishAnim)
{
KEY_PRESSED(KEYSC_ESC) = 1;
ForceMenus = TRUE;
ControlPanelType = ct_ordermenu;
FinishAnim = 0;
}
Expand Down Expand Up @@ -2266,7 +2266,7 @@ MenuLevel(VOID)
// force the use of menus at all time
if (!UsingMenus && !ConPanel)
{
KEY_PRESSED(KEYSC_ESC) = TRUE;
ForceMenus = TRUE;
MNU_CheckForMenusAnyKey();
}

Expand Down Expand Up @@ -3904,7 +3904,7 @@ int app_main(int argc, char const * const argv[])
}
}
else
if (FALSE && Bstrncasecmp(arg, "dr", 2) == 0)
if (Bstrncasecmp(arg, "dr", 2) == 0)
{
//NumSyncBytes = 8;
DemoRecording = TRUE;
Expand All @@ -3919,7 +3919,7 @@ int app_main(int argc, char const * const argv[])
}
}
else
if (FALSE && Bstrncasecmp(arg, "dp", 2) == 0)
if (Bstrncasecmp(arg, "dp", 2) == 0)
{
DemoPlaying = TRUE;
DemoRecording = FALSE;
Expand Down Expand Up @@ -4572,7 +4572,7 @@ FunctionKeys(PLAYERp pp)
KEY_PRESSED(KEYSC_F2) = 0;
if (!TEST(pp->Flags, PF_DEAD))
{
KEY_PRESSED(KEYSC_ESC) = 1;
ForceMenus = TRUE;
ControlPanelType = ct_savemenu;
}
}
Expand All @@ -4583,7 +4583,7 @@ FunctionKeys(PLAYERp pp)
KEY_PRESSED(KEYSC_F3) = 0;
if (!TEST(pp->Flags, PF_DEAD))
{
KEY_PRESSED(KEYSC_ESC) = 1;
ForceMenus = TRUE;
ControlPanelType = ct_loadmenu;
}
}
Expand All @@ -4595,7 +4595,7 @@ FunctionKeys(PLAYERp pp)
KEY_PRESSED(KEYSC_F6) = 0;
if (!TEST(pp->Flags, PF_DEAD))
{
KEY_PRESSED(KEYSC_ESC) = 1;
ForceMenus = TRUE;
ControlPanelType = ct_savemenu;
QuickSaveMode = TRUE;
}
Expand All @@ -4615,7 +4615,7 @@ FunctionKeys(PLAYERp pp)
else
{
KB_ClearKeysDown();
KEY_PRESSED(KEYSC_ESC) = 1;
ForceMenus = TRUE;
ControlPanelType = ct_quickloadmenu;
}
}
Expand All @@ -4628,7 +4628,7 @@ FunctionKeys(PLAYERp pp)
if (KEY_PRESSED(KEYSC_F4))
{
KEY_PRESSED(KEYSC_F4) = 0;
KEY_PRESSED(KEYSC_ESC) = 1;
ForceMenus = TRUE;
ControlPanelType = ct_soundmenu;
}

Expand Down Expand Up @@ -4674,7 +4674,7 @@ FunctionKeys(PLAYERp pp)
if (KEY_PRESSED(KEYSC_F10))
{
KEY_PRESSED(KEYSC_F10) = 0;
KEY_PRESSED(KEYSC_ESC) = 1;
ForceMenus = TRUE;
ControlPanelType = ct_quitmenu;
}

Expand Down Expand Up @@ -4743,7 +4743,7 @@ VOID PauseKey(PLAYERp pp)
}
else
{
KEY_PRESSED(KEYSC_ESC) = 1;
ForceMenus = TRUE;
ControlPanelType = ct_quickloadmenu;
}
}
Expand Down
Loading

0 comments on commit 25d0010

Please sign in to comment.