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)
float HUD_Radar_InputEvent(int bInputType, float nPrimary, float nSecondary)
{
TC(int, bInputType);
- if(!hud_panel_radar_maximized || !hud_panel_radar_mouse ||
- autocvar__hud_configure || mv_active)
+ if(!hud_panel_radar_maximized || !hud_panel_radar_mouse || autocvar__hud_configure || mv_active)
return false;
if(bInputType == 3)
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);
+
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 ( nPrimary == K_ESCAPE && bInputType == 0 )
+ else if (nPrimary == K_ESCAPE && key_pressed)
{
HUD_Radar_Hide_Maximized();
}
if ( STAT(HEALTH) <= 0 )
{
// Show scoreboard
- if ( bInputType < 2 )
+ con_keys = findkeysforcommand("+showscores", 0);
+ keys = tokenize(con_keys);
+ for (i = 0; i < keys; ++i)
{
- con_keys = findkeysforcommand("+showscores", 0);
- keys = tokenize(con_keys);
- for (i = 0; i < keys; ++i)
+ if ( nPrimary == stof(argv(i)) )
{
- if ( nPrimary == stof(argv(i)) )
- {
- hud_panel_radar_temp_hidden = bInputType == 0;
- return false;
- }
+ hud_panel_radar_temp_hidden = key_pressed;
+ return false;
}
}
}
- else if ( bInputType == 0 )
+ else if (key_pressed)
HUD_Radar_Hide_Maximized();
return false;