some angle diff arrows in keys

WHICH I CAN'T SEE IF IT LOOKS GOOD BECAUSE THE CHARACTERS DON'T SHOW ON LINUX
This commit is contained in:
rtldg 2021-04-02 18:31:14 +00:00
parent 7d6d906060
commit 3750c8edeb

View File

@ -117,6 +117,9 @@ float gF_ConnectTime[MAXPLAYERS+1];
bool gB_FirstPrint[MAXPLAYERS+1];
int gI_PreviousSpeed[MAXPLAYERS+1];
int gI_ZoneSpeedLimit[MAXPLAYERS+1];
float gF_Angle[MAXPLAYERS+1];
float gF_PreviousAngle[MAXPLAYERS+1];
float gF_AngleDiff[MAXPLAYERS+1];
bool gB_Late = false;
@ -382,9 +385,30 @@ public void Shavit_OnStyleConfigLoaded(int styles)
}
}
void MakeAngleDiff(int client, float newAngle)
{
gF_PreviousAngle[client] = gF_Angle[client];
gF_Angle[client] = newAngle;
// stolen from btimes
float fAngleDiff = newAngle - gF_PreviousAngle[client];
if (fAngleDiff > 180)
{
fAngleDiff -= 360;
}
else if(fAngleDiff < -180)
{
fAngleDiff += 360;
}
gF_AngleDiff[client] = fAngleDiff;
}
public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float vel[3], float angles[3], TimerStatus status, int track, int style, stylesettings_t stylsettings)
{
gI_Buttons[client] = buttons;
MakeAngleDiff(client, angles[1]);
for(int i = 1; i <= MaxClients; i++)
{
@ -423,10 +447,18 @@ public void PostThinkPost(int client)
{
int buttons = GetClientButtons(client);
if(gI_Buttons[client] != buttons)
float ang[3];
GetClientEyeAngles(client, ang);
if(gI_Buttons[client] != buttons || ang[1] != gF_Angle[client])
{
gI_Buttons[client] = buttons;
if (ang[1] != gF_Angle[client])
{
MakeAngleDiff(client, ang[1]);
}
for(int i = 1; i <= MaxClients; i++)
{
if(i != client && (IsValidClient(i) && GetSpectatorTarget(i, i) == client))
@ -1584,10 +1616,12 @@ void UpdateKeyOverlay(int client, Panel panel, bool &draw)
FormatEx(sPanelLine, 64, " %d%s%d\n", gI_ScrollCount[target], (gI_ScrollCount[target] > 9)? " ":" ", gI_LastScrollCount[target]);
}
Format(sPanelLine, 128, "%s%s %s\n   %s\n%s  %s  %s\n %s  %s", sPanelLine,
float fAngleDiff = IsValidClient(target) ? gF_AngleDiff[target] : 0.0;
Format(sPanelLine, 128, "%s%s %s\n%s  %s  %s\n%s  %s  %s\n %s  %s", sPanelLine,
(buttons & IN_JUMP) > 0? "":"", (buttons & IN_DUCK) > 0? "":"",
(buttons & IN_FORWARD) > 0? "":"", (buttons & IN_MOVELEFT) > 0? "":"",
(buttons & IN_BACK) > 0? "":"", (buttons & IN_MOVERIGHT) > 0? "":"",
(fAngleDiff > 0) ? "":" ", (buttons & IN_FORWARD) > 0 ? "":"", (fAngleDiff < 0) ? "":" ",
(buttons & IN_MOVELEFT) > 0? "":"", (buttons & IN_BACK) > 0? "":"", (buttons & IN_MOVERIGHT) > 0? "":"",
(buttons & IN_LEFT) > 0? "":" ", (buttons & IN_RIGHT) > 0? "":" ");
panel.DrawItem(sPanelLine, ITEMDRAW_RAWLINE);
@ -1632,12 +1666,13 @@ void UpdateCenterKeys(int client)
}
int buttons = IsValidClient(target) ? gI_Buttons[target] : Shavit_GetReplayButtons(target);
float fAngleDiff = IsValidClient(target) ? gF_AngleDiff[target] : 0.0;
char sCenterText[64];
FormatEx(sCenterText, 64, " %s  %s\n   %s\n%s  %s  %s\n %s  %s",
FormatEx(sCenterText, 64, " %s  %s\n%s  %s  %s\n%s  %s  %s\n %s  %s",
(buttons & IN_JUMP) > 0? "":"", (buttons & IN_DUCK) > 0? "":"",
(buttons & IN_FORWARD) > 0? "":"", (buttons & IN_MOVELEFT) > 0? "":"",
(buttons & IN_BACK) > 0? "":"", (buttons & IN_MOVERIGHT) > 0? "":"",
(fAngleDiff > 0) ? "":" ", (buttons & IN_FORWARD) > 0 ? "":"", (fAngleDiff < 0) ? "":" ",
(buttons & IN_MOVELEFT) > 0? "":"", (buttons & IN_BACK) > 0? "":"", (buttons & IN_MOVERIGHT) > 0? "":"",
(buttons & IN_LEFT) > 0? "":" ", (buttons & IN_RIGHT) > 0? "":" ");
int style = (Shavit_IsReplayEntity(target))? Shavit_GetReplayBotStyle(target):Shavit_GetBhopStyle(target);
@ -1650,7 +1685,7 @@ void UpdateCenterKeys(int client)
char autobhop[4];
Shavit_GetStyleSetting(style, "autobhop", autobhop, 4);
if(gB_BhopStats && !StringToInt(autobhop))
if(gB_BhopStats && !StringToInt(autobhop) && IsValidClient(target))
{
Format(sCenterText, 64, "%s\n  %d %d", sCenterText, gI_ScrollCount[target], gI_LastScrollCount[target]);
}