From: terencehill Date: Sun, 27 Dec 2020 23:13:22 +0000 (+0100) Subject: Remove some bInputType checks that now are redundant in HUD_Minigame_InputEvent X-Git-Tag: xonotic-v0.8.5~597^2~8 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=59e98611b7133bd00d85b938816478e0aff6b50b;p=xonotic%2Fxonotic-data.pk3dir.git Remove some bInputType checks that now are redundant in HUD_Minigame_InputEvent --- diff --git a/qcsrc/common/minigames/cl_minigames_hud.qc b/qcsrc/common/minigames/cl_minigames_hud.qc index 861e01be3..49a73dcc4 100644 --- a/qcsrc/common/minigames/cl_minigames_hud.qc +++ b/qcsrc/common/minigames/cl_minigames_hud.qc @@ -626,14 +626,17 @@ float HUD_Minigame_InputEvent(float bInputType, float nPrimary, float nSecondary return false; } - if(bInputType == 0) { + // at this point bInputType can only be 0 or 1 (key pressed or released) + bool key_pressed = (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; if(nPrimary == K_MOUSE1) mouseClicked |= S_MOUSE1; if(nPrimary == K_MOUSE2) mouseClicked |= S_MOUSE2; } - 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); @@ -651,10 +654,10 @@ float HUD_Minigame_InputEvent(float bInputType, float nPrimary, float nSecondary return false; } - if ( active_minigame && ( bInputType == 0 || bInputType == 1 ) ) + if ( active_minigame ) { string device = ""; - string action = bInputType == 0 ? "pressed" : "released"; + string action = key_pressed ? "pressed" : "released"; if ( nPrimary >= K_MOUSE1 && nPrimary <= K_MOUSE16 ) { if ( HUD_mouse_over(HUD_PANEL(MINIGAMEBOARD)) ) @@ -668,7 +671,7 @@ float HUD_Minigame_InputEvent(float bInputType, float nPrimary, float nSecondary return true; } - if ( bInputType == 0 ) + if ( key_pressed ) { if ( nPrimary == K_MOUSE1 && HUD_MinigameMenu_activeitem && HUD_mouse_over(HUD_PANEL(MINIGAMEMENU)) )