Added color for strong and weak states

This commit is contained in:
BloodWod 2021-07-20 22:39:44 +05:00
parent 2946632d7a
commit f66abb79bf
4 changed files with 27 additions and 4 deletions

View file

@ -203,7 +203,7 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
}
}
if(g_Config.m_Debug)
if(g_Config.m_Debug || g_Config.m_ClNameplatesStrongWeak)
{
CCharacter *pCharacter = m_pClient->m_GameWorld.GetCharacterByID(pPlayerInfo->m_ClientID);
if(pCharacter)
@ -212,7 +212,18 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
char aBuf[8];
str_format(aBuf, sizeof(aBuf), "⇢ %d", pCharacter->GetStrongWeakID());
float XOffset = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f) / 2.0f;
TextRender()->TextColor(rgb);
if(pCharacter->m_Weak)
{
ColorRGBA WeakStatusColor = color_cast<ColorRGBA>(ColorHSLA(g_Config.m_ClNameplatesWeakColor));
TextRender()->TextColor(WeakStatusColor);
}
else
{
ColorRGBA StrongStatusColor = color_cast<ColorRGBA>(ColorHSLA(g_Config.m_ClNameplatesStrongColor));
TextRender()->TextColor(StrongStatusColor);
}
if(pPlayerInfo->m_Local)
TextRender()->TextColor(rgb);
TextRender()->Text(0, Position.x - XOffset, YOffset, FontSize, aBuf, -1.0f);
}
}

View file

@ -2328,7 +2328,7 @@ void CGameClient::UpdatePrediction()
pDummyChar = m_GameWorld.GetCharacterByID(m_PredictedDummyID);
// update strong and weak hook
if(pLocalChar && AntiPingPlayers())
if(pLocalChar && !m_Snap.m_SpecInfo.m_Active && Client()->State() != IClient::STATE_DEMOPLAYBACK && (m_Tuning[g_Config.m_ClDummy].m_PlayerCollision || m_Tuning[g_Config.m_ClDummy].m_PlayerHooking))
{
if(m_Snap.m_aCharacters[m_Snap.m_LocalClientID].m_HasExtendedData)
{
@ -2337,7 +2337,14 @@ void CGameClient::UpdatePrediction()
ID = -1;
for(int i = 0; i < MAX_CLIENTS; i++)
if(CCharacter *pChar = m_GameWorld.GetCharacterByID(i))
aIDs[pChar->GetStrongWeakID()] = i;
{
int CurCharStrongWeakID = pChar->GetStrongWeakID();
if(pLocalChar->GetStrongWeakID() > CurCharStrongWeakID)
pChar->m_Weak = true;
else
pChar->m_Weak = false;
aIDs[CurCharStrongWeakID] = i;
}
for(int ID : aIDs)
if(ID >= 0)
m_CharOrder.GiveStrong(ID);

View file

@ -147,6 +147,8 @@ public:
CCharacter() { m_Alive = false; }
void SetTuneZone(int Zone);
bool m_Weak;
private:
// weapon info
int m_aHitObjects[10];

View file

@ -16,6 +16,9 @@ MACRO_CONFIG_INT(ClAntiPingSmooth, cl_antiping_smooth, 0, 0, 1, CFGFLAG_CLIENT |
MACRO_CONFIG_INT(ClAntiPingGunfire, cl_antiping_gunfire, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Predict gunfire and show predicted weapon physics (with cl_antiping_grenade 1 and cl_antiping_weapons 1)")
MACRO_CONFIG_INT(ClNameplates, cl_nameplates, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show name plates")
MACRO_CONFIG_INT(ClNameplatesStrongWeak, cl_nameplates_strongweak, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show strong/weak hook to players")
MACRO_CONFIG_COL(ClNameplatesStrongColor, cl_nameplates_strong_color, 65407, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Strong status color")
MACRO_CONFIG_COL(ClNameplatesWeakColor, cl_nameplates_weak_color, 6401973, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Weak status color")
MACRO_CONFIG_INT(ClAfkEmote, cl_afk_emote, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show zzz emote next to afk players")
MACRO_CONFIG_INT(ClNameplatesAlways, cl_nameplates_always, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Always show name plates disregarding of distance")
MACRO_CONFIG_INT(ClNameplatesTeamcolors, cl_nameplates_teamcolors, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Use team colors for name plates")