swwmgz_m/zscript/kbase/swwm_kbasetab_help.zsc
Marisa the Magician 5488bfce5d 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.
2022-08-13 14:28:09 +02:00

79 lines
1.6 KiB
Text

// I require assistance
Class DemolitionistHelpTab : DemolitionistMenuTab
{
DemolitionistMenuTextBox mtext;
bool drag;
override DemolitionistMenuTab Init( DemolitionistMenu master )
{
title = StringTable.Localize("$SWWM_HELPTAB");
bHidden = true;
mtext = new("DemolitionistMenuTextBox").Init(master,StringTable.Localize("$SWWM_HELPTXT"));
return Super.Init(master);
}
override void OnDestroy()
{
if ( mtext ) mtext.Destroy();
}
override void MenuInput( int key )
{
switch ( key )
{
case MK_DOWN:
if ( mtext.Scroll(16) ) master.MenuSound("menu/demoscroll");
break;
case MK_UP:
if ( mtext.Scroll(-16) ) master.MenuSound("menu/demoscroll");
break;
}
}
override void MouseInput( Vector2 pos, int btn )
{
switch ( btn )
{
case MB_LEFT:
// see if we're clicking the scrollbar (if it exists)
if ( mtext.scrollbar && (pos.x > (mtext.x+(mtext.w-8))) )
{
mtext.SetOffset(pos.y);
master.MenuSound("menu/demoscroll");
drag = true;
break;
}
break;
case MB_WHEELUP:
if ( mtext.Scroll(-8) ) master.MenuSound("menu/demoscroll");
break;
case MB_WHEELDOWN:
if ( mtext.Scroll(8) ) master.MenuSound("menu/demoscroll");
break;
case MB_DRAG:
if ( drag ) mtext.SetOffset(pos.y);
break;
case MB_RELEASE:
drag = false;
break;
}
}
// stop smooth scrolling for current textbox
override void OnSelect()
{
bHidden = false;
mtext.smofs = mtext.ofs;
}
override void OnDeselect()
{
bHidden = true;
mtext.smofs = mtext.ofs;
}
// very simple
override void Ticker()
{
mtext.Ticker();
}
override void Drawer( double fractic )
{
mtext.Drawer(fractic);
}
}