option whether to draw !keys in the center or menu for csgo

This commit is contained in:
rtldg 2022-01-11 07:54:31 +00:00
parent e1e404714b
commit f474a944ae
3 changed files with 25 additions and 4 deletions

View File

@ -58,6 +58,7 @@
#define HUD2_VELOCITYDIFFERENCE (1 << 13) #define HUD2_VELOCITYDIFFERENCE (1 << 13)
#define HUD2_USPSILENCER (1 << 14) // spawns usps with a silencer on #define HUD2_USPSILENCER (1 << 14) // spawns usps with a silencer on
#define HUD2_GLOCKBURST (1 << 15) // spawns glocks with burst #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_DEFAULT (HUD_MASTER|HUD_CENTER|HUD_ZONEHUD|HUD_OBSERVE|HUD_TOPLEFT|HUD_SYNC|HUD_TIMELEFT|HUD_2DVEL|HUD_SPECTATORS)
#define HUD_DEFAULT2 (HUD2_PERFS) #define HUD_DEFAULT2 (HUD2_PERFS)

View File

@ -764,6 +764,13 @@ Action ShowHUDMenu(int client, int item)
menu.AddItem(sInfo, sHudItem); 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.ExitButton = true;
menu.DisplayAt(client, item, MENU_TIME_FOREVER); menu.DisplayAt(client, item, MENU_TIME_FOREVER);
@ -1077,7 +1084,13 @@ void TriggerHUDUpdate(int client, bool keysonly = false) // keysonly because CS:
UpdateTopLeftHUD(client, true); UpdateTopLeftHUD(client, true);
} }
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); UpdateCenterKeys(client);
}
if(IsSource2013(gEV_Type)) if(IsSource2013(gEV_Type))
{ {
@ -1086,7 +1099,7 @@ void TriggerHUDUpdate(int client, bool keysonly = false) // keysonly because CS:
UpdateKeyHint(client); 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)) && (!gB_Zones || !Shavit_IsClientCreatingZone(client))
&& (GetClientMenu(client, null) == MenuSource_None || GetClientMenu(client, null) == MenuSource_RawPanel) && (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; bool bShouldDraw = false;
Panel pHUD = new Panel(); Panel pHUD = new Panel();
//UpdateKeyOverlay(client, pHUD, bShouldDraw); if (!center_keys)
//pHUD.DrawItem("", ITEMDRAW_RAWLINE); {
UpdateKeyOverlay(client, pHUD, bShouldDraw);
pHUD.DrawItem("", ITEMDRAW_RAWLINE);
}
UpdateSpectatorList(client, pHUD, bShouldDraw); UpdateSpectatorList(client, pHUD, bShouldDraw);

View File

@ -100,6 +100,10 @@
"#format" "{1:d}" "#format" "{1:d}"
"en" "(Speed Limit: {1})" "en" "(Speed Limit: {1})"
} }
"HudCenterKeys"
{
"en" "!keys in the center"
}
// ---------- Menus ---------- // // ---------- Menus ---------- //
"HUDMenuTitle" "HUDMenuTitle"
{ {