mapnames update

-fixed text transparency
-performance optimizations
-default to on
-renamed to hud_mapnames
This commit is contained in:
pierow 2023-09-14 20:56:02 -04:00
parent 7c60c0a1c8
commit d40e6e15bc
4 changed files with 25 additions and 18 deletions

View file

@ -221,11 +221,11 @@ void CHud :: Init( void )
CVAR_CREATE("cl_weaponswap", "2", FCVAR_ARCHIVE | FCVAR_USERINFO); CVAR_CREATE("cl_weaponswap", "2", FCVAR_ARCHIVE | FCVAR_USERINFO);
CVAR_CREATE("hud_teamhealthalert", "95", FCVAR_ARCHIVE); CVAR_CREATE("hud_teamhealthalert", "95", FCVAR_ARCHIVE);
CVAR_CREATE("hud_minimapnames", "0", FCVAR_ARCHIVE); CVAR_CREATE("hud_mapnames", "5", FCVAR_ARCHIVE);
CVAR_CREATE("hud_minimapnamesComm", "0", FCVAR_ARCHIVE); CVAR_CREATE("hud_mapnamesComm", "1", FCVAR_ARCHIVE);
CVAR_CREATE("hud_minimapnamesRed", "255", FCVAR_ARCHIVE); CVAR_CREATE("hud_mapnamesRed", "255", FCVAR_ARCHIVE);
CVAR_CREATE("hud_minimapnamesGreen", "255", FCVAR_ARCHIVE); CVAR_CREATE("hud_mapnamesGreen", "255", FCVAR_ARCHIVE);
CVAR_CREATE("hud_minimapnamesBlue", "255", FCVAR_ARCHIVE); CVAR_CREATE("hud_mapnamesBlue", "255", FCVAR_ARCHIVE);
CVAR_CREATE("hud_nameinfo", "1", FCVAR_ARCHIVE); CVAR_CREATE("hud_nameinfo", "1", FCVAR_ARCHIVE);
CVAR_CREATE("hud_drawwaypoints", "2", FCVAR_ARCHIVE); CVAR_CREATE("hud_drawwaypoints", "2", FCVAR_ARCHIVE);

View file

@ -85,6 +85,7 @@ void AvHOverviewMap::Init()
this->mMapName=""; this->mMapName="";
this->mBlinkTime=0.0f; this->mBlinkTime=0.0f;
this->mBlinkOn=false; this->mBlinkOn=false;
mMapNamesFontLoaded = false;
mLastUpdateTime = 0; mLastUpdateTime = 0;
} }
@ -441,11 +442,15 @@ void AvHOverviewMap::DrawMiniMapEntity(const DrawInfo& inDrawInfo, const Drawabl
//alien's minimap names //alien's minimap names
//if (inEntity.mIsLocalPlayer) //if (inEntity.mIsLocalPlayer)
if (CVAR_GET_FLOAT("hud_minimapnames") != 0 && ((mUser3 != AVH_USER3_COMMANDER_PLAYER) || CVAR_GET_FLOAT("hud_minimapnamesComm") != 0)) if (CVAR_GET_FLOAT("hud_mapnames") != 0 && ((mUser3 != AVH_USER3_COMMANDER_PLAYER) || CVAR_GET_FLOAT("hud_mapnamesComm") != 0))
{
if (!mMapNamesFontLoaded)
{ {
tFont.Load("sprites/nl/font_arial"); //font_arialsmall tFont.Load("sprites/nl/font_arial"); //font_arialsmall
mMapNamesFontLoaded = true;
}
//string theText; //string theText;
char bufferb[1024]; char bufferb[128];
if ((inEntity.mEntityNumber >= 1) && (inEntity.mEntityNumber <= gEngfuncs.GetMaxClients())) if ((inEntity.mEntityNumber >= 1) && (inEntity.mEntityNumber <= gEngfuncs.GetMaxClients()))
@ -458,25 +463,25 @@ void AvHOverviewMap::DrawMiniMapEntity(const DrawInfo& inDrawInfo, const Drawabl
//theText = thePlayerInfo.name; //theText = thePlayerInfo.name;
//sprintf(bufferb, "%s", theText.c_str()); //sprintf(bufferb, "%s", theText.c_str());
int tR = CVAR_GET_FLOAT("hud_minimapnamesRed"); int tR = CVAR_GET_FLOAT("hud_mapnamesRed");
int tG = CVAR_GET_FLOAT("hud_minimapnamesGreen"); int tG = CVAR_GET_FLOAT("hud_mapnamesGreen");
int tB = CVAR_GET_FLOAT("hud_minimapnamesBlue"); int tB = CVAR_GET_FLOAT("hud_mapnamesBlue");
sprintf(bufferb, "%s", thePlayerInfo.name); sprintf(bufferb, "%s", thePlayerInfo.name);
if (bufferb) { if (bufferb) {
std::string text(bufferb); std::string text(bufferb);
if (CVAR_GET_FLOAT("hud_minimapnames") >= 2) { //3 letter max if (CVAR_GET_FLOAT("hud_mapnames") >= 2) { //3 letter max
//strcpy(rgDeathNoticeList[i].szVictim, killed_with.c_str() + 2); //strcpy(rgDeathNoticeList[i].szVictim, killed_with.c_str() + 2);
//while (text.length() > 3) { //while (text.length() > 3) {
// text[3] // text[3]
//} //}
//bufferb //bufferb
text = text.substr(0, max((int)CVAR_GET_FLOAT("hud_minimapnames"), 1)); text = text.substr(0, max((int)CVAR_GET_FLOAT("hud_mapnames"), 1));
} }
tFont.DrawStringCustom(x + 12 - text.length() * 3, y - 18, text.c_str(), tR, tG, tB, 0); tFont.DrawStringCustom(x + 12 - text.length() * 3, y - 18, text.c_str(), tR, tG, tB, kRenderTransAdd);
} }
} }

View file

@ -131,6 +131,8 @@ private:
float mLastUpdateTime; float mLastUpdateTime;
bool mMapNamesFontLoaded;
}; };
#endif #endif

View file

@ -132,18 +132,18 @@ DESCRIPTION INFO_OPTIONS
{ "1.000000" } { "1.000000" }
} }
"hud_minimapnames" "hud_mapnames"
{ {
"Length of minimap names 1=unlim" "Length of minimap names 1=unlim"
{ NUMBER 0.000000 30.000000 } { NUMBER 0.000000 30.000000 }
{ "0.000000" } { "5.000000" }
} }
"hud_minimapnamesComm" "hud_mapnamesComm"
{ {
"Show names on minimap when commander" "Show names on minimap when commander"
{ BOOL } { BOOL }
{ "0" } { "1" }
} }
"cl_mutemenu" "cl_mutemenu"