Remove code built on incorrect assumptions about UI events.
That is, remove code for closing menus with the key that's bound to open them. As it turns out, UIEvent.keystring isn't 1:1 with key binds for a command. This SEEMINGLY worked since the Demolitionist Menu is by default bound to Q, and pressing Q does send an UIEvent to the menu with the string "Q". But if, for example, the menu had been bound to Tab, this would fall apart because then the key string sent is " " (a literal tab character). If there is a way to do this properly, I don't know about it. I've looked everywhere in GZDoom's code for a solution, something that would let me do what I need, but alas, there is nothing there. Better to get rid of this in its entirety than keep the flaky code in the mod until someone with a special setup that breaks it shows up to complain.
This commit is contained in:
parent
48f8a75362
commit
5488bfce5d
7 changed files with 41 additions and 69 deletions
|
|
@ -470,28 +470,28 @@ SWWM_HELPTXT =
|
|||
"\cxDemolitionist Menu - Basic Controls\c-\n"
|
||||
"\cx———————————————————————————————————\c-\n"
|
||||
"\n"
|
||||
"\cf%s:\c- Open/Close Demolitionist menu\n"
|
||||
"\cfPageUp/PageDown:\c- Switch tabs\n"
|
||||
"\cfEsc:\c- Close Demolitionist menu\n"
|
||||
"\cfPageUp, PageDown:\c- Switch tabs\n"
|
||||
"\cfF1:\c- Open/Close help tab\n"
|
||||
"\n"
|
||||
"\cxMission Tab - Controls\c-\n"
|
||||
"\cx——————————————————————\c-\n"
|
||||
"\n"
|
||||
"\cfUp/Down:\c- Scroll\n"
|
||||
"\cfLeft/Right:\c- Switch through entries\n"
|
||||
"\cfUp, Down:\c- Scroll\n"
|
||||
"\cfLeft, Right:\c- Switch through entries\n"
|
||||
"\n"
|
||||
"\cxStats Tab - Controls\c-\n"
|
||||
"\cx————————————————————\c-\n"
|
||||
"\n"
|
||||
"\cfUp/Down:\c- Scroll\n"
|
||||
"\cfLeft/Right:\c- Switch section\n"
|
||||
"\cfUp, Down:\c- Scroll\n"
|
||||
"\cfLeft, Right:\c- Switch section\n"
|
||||
"\n"
|
||||
"\cxInventory Tab - Controls\c-\n"
|
||||
"\cx————————————————————————\c-\n"
|
||||
"\n"
|
||||
"\cfArrow Keys:\c- Navigate\n"
|
||||
"\cfEnter/Left Click:\c- Use selected item\n"
|
||||
"\cfBackspace/Right Click:\c- Drop selected item\n"
|
||||
"\cfEnter, Left Click:\c- Use selected item\n"
|
||||
"\cfBackspace, Right Click:\c- Drop selected item\n"
|
||||
"\n"
|
||||
"\cxKeychain Tab - Controls\c-\n"
|
||||
"\cx———————————————————————\c-\n"
|
||||
|
|
@ -501,41 +501,41 @@ SWWM_HELPTXT =
|
|||
"\cxLibrary Tab - Controls (Main)\c-\n"
|
||||
"\cx—————————————————————————————\c-\n"
|
||||
"\n"
|
||||
"\cfUp/Down:\c- Scroll through entries\n"
|
||||
"\cfLeft/Right:\c- Switch category\n"
|
||||
"\cfEnter/Left Click:\c- Open entry\n"
|
||||
"\cfUp, Down:\c- Scroll through entries\n"
|
||||
"\cfLeft, Right:\c- Switch category\n"
|
||||
"\cfEnter, Left Click:\c- Open entry\n"
|
||||
"\n"
|
||||
"\cxLibrary Tab - Controls (Entry Open)\c-\n"
|
||||
"\cx———————————————————————————————————\c-\n"
|
||||
"\n"
|
||||
"\cfUp/Down:\c- Scroll\n"
|
||||
"\cfUp, Down:\c- Scroll\n"
|
||||
"\cfBackspace:\c- Return to entry list\n"
|
||||
"\n"
|
||||
"\cxStore Tab - Controls (Buying)\c-\n"
|
||||
"\cx—————————————————————————————\c-\n"
|
||||
"\n"
|
||||
"\cfArrow Keys:\c- Navigate\n"
|
||||
"\cfEnter/Left Click:\c- Buy\n"
|
||||
"\cfBackspace/Right Click:\c- Switch to selling\n"
|
||||
"\cfEnter, Left Click:\c- Buy\n"
|
||||
"\cfBackspace, Right Click:\c- Switch to selling\n"
|
||||
"\n"
|
||||
"\cxStore Tab - Controls (Selling)\c-\n"
|
||||
"\cx——————————————————————————————\c-\n"
|
||||
"\n"
|
||||
"\cfArrow Keys:\c- Navigate\n"
|
||||
"\cfEnter/Left Click:\c- Sell\n"
|
||||
"\cfBackspace/Right Click:\c- Switch to buying\n"
|
||||
"\cfEnter, Left Click:\c- Sell\n"
|
||||
"\cfBackspace, Right Click:\c- Switch to buying\n"
|
||||
"\n"
|
||||
"\cxMessages Tab - Controls\c-\n"
|
||||
"\cx———————————————————————\c-\n"
|
||||
"\n"
|
||||
"\cfUp/Down:\c- Scroll";
|
||||
"\cfUp, Down:\c- Scroll";
|
||||
SWWM_GAMETAB = "Games";
|
||||
SWWM_PICKGAME = "Choose a game";
|
||||
SWWM_GAMETITLE_MADCATGAME = "Boot Test";
|
||||
// Wallbuster menu
|
||||
SWWM_BUSTERTITLE = "Wallbuster - Easy Reload Menu";
|
||||
SWWM_BUSTERKEYS =
|
||||
"\cfLeft/Right:\c- Select Ammo Type\n"
|
||||
"\cfLeft, Right:\c- Select Ammo Type\n"
|
||||
"\cfDown:\c- Add Ammo\n"
|
||||
"\cfUp:\c- Remove Ammo\n"
|
||||
"\cfPage Down:\c- Add 5 Ammo\n"
|
||||
|
|
|
|||
|
|
@ -429,7 +429,7 @@ SWWM_HELPTXT =
|
|||
"\cxMenú de Demolicionista - Controles Básicos\c-\n"
|
||||
"\cx——————————————————————————————————————————\c-\n"
|
||||
"\n"
|
||||
"\cf%s:\c- Abrir/Cerrar menú de Demolicionista\n"
|
||||
"\cfEsc:\c- Cerrar menú de Demolicionista\n"
|
||||
"\cfRePág/AvPág:\c- Cambiar pestaña\n"
|
||||
"\cfF1:\c- Abrir/Cerrar pestaña de ayuda\n"
|
||||
"\n"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
[default]
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r316 \cu(Sat 13 Aug 11:59:44 CEST 2022)\c-";
|
||||
SWWM_SHORTVER="\cw1.3pre r316 \cu(2022-08-13 11:59:44)\c-";
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r317 \cu(Sat 13 Aug 14:28:09 CEST 2022)\c-";
|
||||
SWWM_SHORTVER="\cw1.3pre r317 \cu(2022-08-13 14:28:09)\c-";
|
||||
|
|
|
|||
|
|
@ -605,26 +605,29 @@ extend Class SWWMHandler
|
|||
|
||||
override bool InputProcess( InputEvent e )
|
||||
{
|
||||
if ( (e.Type == InputEvent.TYPE_KeyDown) && (e.KeyChar >= 0x61) && (e.KeyChar <= 0x7A) )
|
||||
if ( e.Type != InputEvent.TYPE_KeyDown ) return false;
|
||||
// F
|
||||
if ( e.KeyChar == 0x66 )
|
||||
{
|
||||
// F
|
||||
if ( e.KeyChar == 0x66 )
|
||||
let demo = Demolitionist(players[consoleplayer].mo);
|
||||
let gone = PlayerGone(players[consoleplayer].mo);
|
||||
if ( (demo && (demo.Health <= 0) && (demo.deadtimer > 40))
|
||||
|| (gone && (gone.Health <= 0) && (gone.deadtimer > 40)) )
|
||||
{
|
||||
let demo = Demolitionist(players[consoleplayer].mo);
|
||||
let gone = PlayerGone(players[consoleplayer].mo);
|
||||
if ( (demo && (demo.Health <= 0) && (demo.deadtimer > 40))
|
||||
|| (gone && (gone.Health <= 0) && (gone.deadtimer > 40)) )
|
||||
// pay respects
|
||||
int numf = Random[FInTheChat](1,6);
|
||||
for ( int i=0; i<numf; i++ )
|
||||
{
|
||||
// pay respects
|
||||
int numf = Random[FInTheChat](1,6);
|
||||
for ( int i=0; i<numf; i++ )
|
||||
{
|
||||
let f = PayRespects.PressF();
|
||||
StatusBar.AttachMessage(f,0,layer:StatusBar.HUDMSGLayer_OverHUD);
|
||||
}
|
||||
let f = PayRespects.PressF();
|
||||
StatusBar.AttachMessage(f,0,layer:StatusBar.HUDMSGLayer_OverHUD);
|
||||
}
|
||||
}
|
||||
if ( CheatInput(e) ) return true;
|
||||
}
|
||||
// cheats
|
||||
if ( (e.KeyChar >= 0x61) && (e.KeyChar <= 0x7A) )
|
||||
{
|
||||
if ( CheatInput(e) )
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,9 +45,6 @@ Class DemolitionistMenu : GenericMenu
|
|||
int muns;
|
||||
// other text
|
||||
String clockstr, munstr;
|
||||
// menu keybind
|
||||
int ikey[2];
|
||||
String mkey[2];
|
||||
// for checks (duh)
|
||||
Array<MenuTransaction> checklist;
|
||||
int lasttuid;
|
||||
|
|
@ -173,9 +170,6 @@ Class DemolitionistMenu : GenericMenu
|
|||
ws.y = round(th);
|
||||
origin = (int(ss.x-ws.x)/2,int(ss.y-ws.y)/2);
|
||||
MenuSound("menu/demoopen");
|
||||
[ikey[0], ikey[1]] = Bindings.GetKeysForCommand("event swwmdemomenu");
|
||||
mkey[0] = Bindings.NameKeys(ikey[0],0);
|
||||
mkey[1] = Bindings.NameKeys(ikey[1],0);
|
||||
tmsg = StringTable.Localize("$SWWM_MAINCONTROLS");
|
||||
tmsgtic = MenuTime()+50;
|
||||
lasttuid = Random[TUID]();
|
||||
|
|
@ -448,12 +442,6 @@ Class DemolitionistMenu : GenericMenu
|
|||
kcode = 0;
|
||||
break;
|
||||
}
|
||||
if( (ikey[0] && (ev.keystring == mkey[0])) || (ikey[1] && (ev.keystring == mkey[1])) )
|
||||
{
|
||||
isclosing = true;
|
||||
MenuSound("menu/democlose");
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case UIEvent.Type_WheelDown:
|
||||
tabs[curtab].MouseInput((curmouse/hs)-origin,MB_WHEELDOWN);
|
||||
|
|
|
|||
|
|
@ -9,11 +9,7 @@ Class DemolitionistHelpTab : DemolitionistMenuTab
|
|||
{
|
||||
title = StringTable.Localize("$SWWM_HELPTAB");
|
||||
bHidden = true;
|
||||
String kstr;
|
||||
if ( master.mkey[1] != "" ) kstr = master.mkey[0].."/"..master.mkey[1];
|
||||
else kstr = master.mkey[0];
|
||||
String str = String.Format(StringTable.Localize("$SWWM_HELPTXT"),kstr);
|
||||
mtext = new("DemolitionistMenuTextBox").Init(master,str);
|
||||
mtext = new("DemolitionistMenuTextBox").Init(master,StringTable.Localize("$SWWM_HELPTXT"));
|
||||
return Super.Init(master);
|
||||
}
|
||||
override void OnDestroy()
|
||||
|
|
|
|||
|
|
@ -262,21 +262,6 @@ Class WallbusterReloadMenu : GenericMenu
|
|||
return false;
|
||||
}
|
||||
|
||||
override bool OnInputEvent( InputEvent ev )
|
||||
{
|
||||
if ( ev.type == InputEvent.Type_KeyDown )
|
||||
{
|
||||
String cmd = Bindings.GetBinding(ev.keyscan);
|
||||
// treat as closing the menu without doing anything
|
||||
if ( cmd ~== "+reload" )
|
||||
{
|
||||
MenuEvent(MKEY_BACK,false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
override bool OnUiEvent( UIEvent ev )
|
||||
{
|
||||
int y;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue