diff --git a/addons/sourcemod/scripting/include/shavit/hud.inc b/addons/sourcemod/scripting/include/shavit/hud.inc index bed1469f4..6800879be 100644 --- a/addons/sourcemod/scripting/include/shavit/hud.inc +++ b/addons/sourcemod/scripting/include/shavit/hud.inc @@ -58,6 +58,7 @@ #define HUD2_VELOCITYDIFFERENCE (1 << 13) #define HUD2_USPSILENCER (1 << 14) // spawns usps with a silencer on #define HUD2_GLOCKBURST (1 << 15) // spawns glocks with burst +#define HUD2_CENTERKEYS (1 << 16) // CSGO option to toggle whether !keys is shown as center-text or in that panel thing. #define HUD_DEFAULT (HUD_MASTER|HUD_CENTER|HUD_ZONEHUD|HUD_OBSERVE|HUD_TOPLEFT|HUD_SYNC|HUD_TIMELEFT|HUD_2DVEL|HUD_SPECTATORS) #define HUD_DEFAULT2 (HUD2_PERFS) diff --git a/addons/sourcemod/scripting/shavit-hud.sp b/addons/sourcemod/scripting/shavit-hud.sp index dbe3e1188..d28ea9ad5 100644 --- a/addons/sourcemod/scripting/shavit-hud.sp +++ b/addons/sourcemod/scripting/shavit-hud.sp @@ -764,6 +764,13 @@ Action ShowHUDMenu(int client, int item) menu.AddItem(sInfo, sHudItem); } + if (gEV_Type == Engine_CSGO) + { + FormatEx(sInfo, 16, "@%d", HUD2_CENTERKEYS); + FormatEx(sHudItem, 64, "%T", "HudCenterKeys", client); + menu.AddItem(sInfo, sHudItem); + } + menu.ExitButton = true; menu.DisplayAt(client, item, MENU_TIME_FOREVER); @@ -1077,7 +1084,13 @@ void TriggerHUDUpdate(int client, bool keysonly = false) // keysonly because CS: UpdateTopLeftHUD(client, true); } - UpdateCenterKeys(client); + bool draw_keys = HUD1Enabled(gI_HUDSettings[client], HUD_KEYOVERLAY); + bool center_keys = HUD2Enabled(gI_HUD2Settings[client], HUD2_CENTERKEYS); + + if (draw_keys && center_keys) + { + UpdateCenterKeys(client); + } if(IsSource2013(gEV_Type)) { @@ -1086,7 +1099,7 @@ void TriggerHUDUpdate(int client, bool keysonly = false) // keysonly because CS: UpdateKeyHint(client); } } - else if ((gI_HUDSettings[client] & HUD_SPECTATORS) > 0 + else if (((gI_HUDSettings[client] & HUD_SPECTATORS) > 0 || (draw_keys && !center_keys)) && (!gB_Zones || !Shavit_IsClientCreatingZone(client)) && (GetClientMenu(client, null) == MenuSource_None || GetClientMenu(client, null) == MenuSource_RawPanel) ) @@ -1094,8 +1107,11 @@ void TriggerHUDUpdate(int client, bool keysonly = false) // keysonly because CS: bool bShouldDraw = false; Panel pHUD = new Panel(); - //UpdateKeyOverlay(client, pHUD, bShouldDraw); - //pHUD.DrawItem("", ITEMDRAW_RAWLINE); + if (!center_keys) + { + UpdateKeyOverlay(client, pHUD, bShouldDraw); + pHUD.DrawItem("", ITEMDRAW_RAWLINE); + } UpdateSpectatorList(client, pHUD, bShouldDraw); diff --git a/addons/sourcemod/translations/shavit-hud.phrases.txt b/addons/sourcemod/translations/shavit-hud.phrases.txt index 47928712d..4db0d39df 100644 --- a/addons/sourcemod/translations/shavit-hud.phrases.txt +++ b/addons/sourcemod/translations/shavit-hud.phrases.txt @@ -100,6 +100,10 @@ "#format" "{1:d}" "en" "(Speed Limit: {1})" } + "HudCenterKeys" + { + "en" "!keys in the center" + } // ---------- Menus ---------- // "HUDMenuTitle" {