add wip alternatecenterkeys for css linux gamers

This commit is contained in:
rtldg 2021-10-11 03:04:37 +00:00
parent c5d4679c9a
commit a0a2cce04a

View File

@ -124,6 +124,7 @@ float gF_AngleDiff[MAXPLAYERS+1];
bool gB_Late = false; bool gB_Late = false;
char gS_HintPadding[MAX_HINT_SIZE]; char gS_HintPadding[MAX_HINT_SIZE];
bool gB_AlternateCenterKeys[MAXPLAYERS+1]; // use for css linux gamers
// hud handle // hud handle
Handle gH_HUD = null; Handle gH_HUD = null;
@ -412,11 +413,35 @@ public void OnClientPutInServer(int client)
gI_LastScrollCount[client] = 0; gI_LastScrollCount[client] = 0;
gI_ScrollCount[client] = 0; gI_ScrollCount[client] = 0;
gB_FirstPrint[client] = false; gB_FirstPrint[client] = false;
gB_AlternateCenterKeys[client] = false;
if(IsFakeClient(client)) if(IsFakeClient(client))
{ {
SDKHook(client, SDKHook_PostThinkPost, PostThinkPost); SDKHook(client, SDKHook_PostThinkPost, PostThinkPost);
} }
else
{
if (gEV_Type != Engine_CSGO)
{
CreateTimer(5.0, Timer_QueryWindowsCvar, GetClientSerial(client), TIMER_FLAG_NO_MAPCHANGE);
}
}
}
public Action Timer_QueryWindowsCvar(Handle timer, any data)
{
int client = GetClientFromSerial(data);
if (client > 0)
{
QueryClientConVar(client, "windows_speaker_config", OnWindowsCvarQueried);
}
}
public void OnWindowsCvarQueried(QueryCookie cookie, int client, ConVarQueryResult result, const char[] cvarName, const char[] cvarValue, any value)
{
gB_AlternateCenterKeys[client] = (result == ConVarQuery_NotFound);
PrintToChat(client, "gB_AlternateCenterKeys[client] = %d", gB_AlternateCenterKeys[client]);
} }
public void PostThinkPost(int client) public void PostThinkPost(int client)
@ -1684,11 +1709,23 @@ void UpdateCenterKeys(int client)
} }
char sCenterText[80]; char sCenterText[80];
if (gB_AlternateCenterKeys[client])
{
FormatEx(sCenterText, sizeof(sCenterText), " %s  %s\n%s %s %s\n%s  %s  %s\n %s  %s",
(buttons & IN_JUMP) > 0? "J":"_", (buttons & IN_DUCK) > 0? "C":"_",
(fAngleDiff > 0) ? "<":" ", (buttons & IN_FORWARD) > 0 ? "W":" _", (fAngleDiff < 0) ? ">":"",
(buttons & IN_MOVELEFT) > 0? "A":"_", (buttons & IN_BACK) > 0? "S":"_", (buttons & IN_MOVERIGHT) > 0? "D":"_",
(buttons & IN_LEFT) > 0? "L":" ", (buttons & IN_RIGHT) > 0? "R":" ");
}
else
{
FormatEx(sCenterText, sizeof(sCenterText), " %s  %s\n%s %s %s\n%s  %s  %s\n %s  %s", FormatEx(sCenterText, sizeof(sCenterText), " %s  %s\n%s %s %s\n%s  %s  %s\n %s  %s",
(buttons & IN_JUMP) > 0? "":"", (buttons & IN_DUCK) > 0? "":"", (buttons & IN_JUMP) > 0? "":"", (buttons & IN_DUCK) > 0? "":"",
(fAngleDiff > 0) ? "<":" ", (buttons & IN_FORWARD) > 0 ? "":"", (fAngleDiff < 0) ? ">":"", (fAngleDiff > 0) ? "<":" ", (buttons & IN_FORWARD) > 0 ? "":"", (fAngleDiff < 0) ? ">":"",
(buttons & IN_MOVELEFT) > 0? "":"", (buttons & IN_BACK) > 0? "":"", (buttons & IN_MOVERIGHT) > 0? "":"", (buttons & IN_MOVELEFT) > 0? "":"", (buttons & IN_BACK) > 0? "":"", (buttons & IN_MOVERIGHT) > 0? "":"",
(buttons & IN_LEFT) > 0? "":" ", (buttons & IN_RIGHT) > 0? "":" "); (buttons & IN_LEFT) > 0? "":" ", (buttons & IN_RIGHT) > 0? "":" ");
}
int style = (gB_Replay && Shavit_IsReplayEntity(target))? Shavit_GetReplayBotStyle(target):Shavit_GetBhopStyle(target); int style = (gB_Replay && Shavit_IsReplayEntity(target))? Shavit_GetReplayBotStyle(target):Shavit_GetBhopStyle(target);