Block Demolitionist Menu and keyboard cheats while paused.

This commit is contained in:
Mari the Deer 2022-08-27 22:50:52 +02:00
commit f484de9b51
3 changed files with 15 additions and 7 deletions

View file

@ -11,7 +11,7 @@ extend Class SWWMHandler
// doing it with an event because this way we can control WHEN it should be openable
if ( e.Name ~== "swwmdemomenu" )
{
if ( (gamestate != GS_LEVEL) || (players[consoleplayer].Health <= 0) || !(players[consoleplayer].mo is 'Demolitionist') )
if ( (gamestate != GS_LEVEL) || (players[consoleplayer].Health <= 0) || !(players[consoleplayer].mo is 'Demolitionist') || paused )
return;
if ( !(Menu.GetCurrentMenu() is 'DemolitionistMenu') )
Menu.SetMenu('DemolitionistMenu');
@ -572,6 +572,14 @@ extend Class SWWMHandler
override bool InputProcess( InputEvent e )
{
if ( e.Type != InputEvent.TYPE_KeyDown ) return false;
// block invprev/next inputs when paused
if ( paused )
{
String cmd = Bindings.GetBinding(e.KeyScan);
if ( (cmd ~== "invprev") || (cmd ~== "invnext") ) return true;
// skip the rest of this function
return false;
}
// F
if ( e.KeyChar == 0x66 )
{
@ -590,7 +598,7 @@ extend Class SWWMHandler
}
}
// cheats
if ( (e.KeyChar >= 0x61) && (e.KeyChar <= 0x7A) )
if ( (e.KeyChar >= 0x61) && (e.KeyChar <= 0x7A) && !paused )
{
if ( CheatInput(e) )
return true;

View file

@ -146,9 +146,9 @@ Class DemolitionistMenu : GenericMenu
{
Super.Init(parent);
Animated = DontDim = DontBlur = true;
// can't open this menu outside of the game or if dead
// can't open this menu outside of the game, if dead, or if the game is currently paused
// also can't if you're not the Demolitionist
if ( (gamestate != GS_LEVEL) || (players[consoleplayer].Health <= 0) || !(players[consoleplayer].mo is 'Demolitionist') )
if ( (gamestate != GS_LEVEL) || (players[consoleplayer].Health <= 0) || !(players[consoleplayer].mo is 'Demolitionist') || paused )
{
animtimer = -1.;
isclosing = true;
@ -316,7 +316,7 @@ Class DemolitionistMenu : GenericMenu
MenuSound("menu/democlose");
isclosing = true;
}
if ( (gamestate != GS_LEVEL) || (isclosing && (animtimer <= 0.)) )
if ( (gamestate != GS_LEVEL) || paused || (isclosing && (animtimer <= 0.)) )
{
// ded (or force close)
DoClose();