bool QuickMenu_InputEvent(int bInputType, float nPrimary, float nSecondary)
{
TC(int, bInputType);
- // we only care for keyboard events
- if(bInputType == 2)
- return false;
if(!QuickMenu_IsOpened() || autocvar__hud_configure || mv_active)
return false;
return true;
}
+ if(bInputType == 2)
+ return false;
+
+ // at this point bInputType can only be 0 or 1 (key pressed or released)
+ bool key_pressed = (bInputType == 0);
+
// allow console bind to work
string con_keys = findkeysforcommand("toggleconsole", 0);
int keys = tokenize(con_keys); // findkeysforcommand returns data for this
hit_con_bind = true;
}
- if(bInputType == 0) {
+ if(key_pressed)
+ {
if(nPrimary == K_ALT) hudShiftState |= S_ALT;
if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
}
- else if(bInputType == 1) {
+ else
+ {
if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
if(nPrimary == K_ESCAPE)
{
- if (bInputType == 1)
+ if (!key_pressed)
return true;
QuickMenu_Close();
}
else if(nPrimary >= '0' && nPrimary <= '9')
{
- if (bInputType == 1)
+ if (!key_pressed)
return true;
QuickMenu_Page_ActiveEntry(stof(chr2str(nPrimary)));
}
if(nPrimary == K_MOUSE1)
{
- if(bInputType == 0) // key pressed
+ if(key_pressed)
mouseClicked |= S_MOUSE1;
- else if(bInputType == 1) // key released
+ else
mouseClicked -= (mouseClicked & S_MOUSE1);
}
else if(nPrimary == K_MOUSE2)
{
- if(bInputType == 0) // key pressed
+ if(key_pressed)
mouseClicked |= S_MOUSE2;
- else if(bInputType == 1) // key released
+ else
mouseClicked -= (mouseClicked & S_MOUSE2);
}
else if(hit_con_bind)