add hud_nameinfo; welder text on client

This commit is contained in:
pierow 2023-08-22 23:47:27 -04:00
parent 60c4e0901c
commit dbf3b84ab7
3 changed files with 17 additions and 7 deletions

View file

@ -226,6 +226,7 @@ void CHud :: Init( void )
CVAR_CREATE("hud_minimapnamesRed", "255", FCVAR_ARCHIVE);
CVAR_CREATE("hud_minimapnamesGreen", "255", FCVAR_ARCHIVE);
CVAR_CREATE("hud_minimapnamesBlue", "255", FCVAR_ARCHIVE);
CVAR_CREATE("hud_nameinfo", "1", FCVAR_ARCHIVE);
m_pSpriteList = NULL;

View file

@ -2079,16 +2079,10 @@ void CBasePlayer::UpdateStatusBar()
if ( g_pGameRules->PlayerRelationship( this, pEntity ) == GR_TEAMMATE )
{
int theLevel = 1;
bool hasWelder = 0;
AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(pEntity);
if(thePlayer)
{
theLevel = thePlayer->GetExperienceLevel();
//TODO:change out for icon in statusbar rendering code or localize.
hasWelder = thePlayer->GetHasItem("weapon_welder");
if (hasWelder) {
strcat(sbuf1, " [Welder]");
}
}
//newSBarState[ SBAR_ID_TARGETHEALTH ] = 100 * (pEntity->pev->health / pEntity->pev->max_health);

View file

@ -5435,9 +5435,24 @@ bool AvHHud::GetEntityInfoString(int inEntityID, string& outEntityInfoString, bo
// Do this client side so the extra chars don't need to be transmitted. Welder handled server side in UpdateStatusBar.
if (theEntity->curstate.team == theTeam)
{
if (g_PlayerExtraInfo[theEntity->index].extra & WEAPON_WELDER)
{
if (CVAR_GET_FLOAT("hud_nameinfo") == 1)
outEntityInfoString += " [Welder]";
else if (CVAR_GET_FLOAT("hud_nameinfo") == 2.0f)
outEntityInfoString += " [Weld]";
else if (CVAR_GET_FLOAT("hud_nameinfo") == 3.0f)
outEntityInfoString += " [W]";
}
if (GetHasUpgrade(theEntity->curstate.iuser4, MASK_PARASITED))
{
outEntityInfoString += " [Parasited]";
if (CVAR_GET_FLOAT("hud_nameinfo") == 1)
outEntityInfoString += " [Parasited]";
else if (CVAR_GET_FLOAT("hud_nameinfo") == 2.0f)
outEntityInfoString += " [Para]";
else if (CVAR_GET_FLOAT("hud_nameinfo") == 3.0f)
outEntityInfoString += " [P]";
}
}