Use player name prefixed with "[D] " for the dummy name

This commit is contained in:
heinrich5991 2020-08-25 16:22:03 +02:00
parent 5d83e9177f
commit bfe7b3cbeb
6 changed files with 33 additions and 6 deletions

View file

@ -177,6 +177,7 @@ public:
//
virtual const char *PlayerName() = 0;
virtual const char *DummyName() = 0;
virtual const char *ErrorString() = 0;
virtual const char *LatestVersion() = 0;
virtual bool ConnectionProblems() = 0;

View file

@ -1076,6 +1076,29 @@ const char *CClient::PlayerName()
return "nameless tee";
}
const char *CClient::DummyName()
{
if(g_Config.m_ClDummyName[0])
{
return g_Config.m_ClDummyName;
}
const char *pBase = 0;
if(g_Config.m_PlayerName[0])
{
pBase = g_Config.m_PlayerName;
}
else if(g_Config.m_SteamName[0])
{
pBase = g_Config.m_SteamName;
}
if(pBase)
{
str_format(m_aDummyNameBuf, sizeof(m_aDummyNameBuf), "[D] %s", pBase);
return m_aDummyNameBuf;
}
return "brainless tee";
}
const char *CClient::ErrorString()
{
return m_NetClient[CLIENT_MAIN].ErrorString();

View file

@ -173,6 +173,8 @@ class CClient : public IClient, public CDemoPlayer::IListener
char m_aDDNetInfoTmp[64];
std::shared_ptr<CGetFile> m_pDDNetInfoTask;
char m_aDummyNameBuf[16];
// time
CSmoothTime m_GameTime[2];
CSmoothTime m_PredictedTime;
@ -323,6 +325,7 @@ public:
virtual void Quit();
virtual const char *PlayerName();
virtual const char *DummyName();
virtual const char *ErrorString();
const char *LoadMap(const char *pName, const char *pFilename, SHA256_DIGEST *pWantedSha256, unsigned WantedCrc);

View file

@ -298,7 +298,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
if(m_Dummy)
{
pName = g_Config.m_ClDummyName;
pNameFallback = "";
pNameFallback = Client()->DummyName();
pClan = g_Config.m_ClDummyClan;
pCountry = &g_Config.m_ClDummyCountry;
}

View file

@ -660,7 +660,7 @@ void CGameClient::OnRender()
if(Client()->DummyConnected()) {
if(m_CheckInfo[1] == 0) {
if(
str_comp(m_aClients[m_LocalIDs[1]].m_aName, g_Config.m_ClDummyName) ||
str_comp(m_aClients[m_LocalIDs[1]].m_aName, Client()->DummyName()) ||
str_comp(m_aClients[m_LocalIDs[1]].m_aClan, g_Config.m_ClDummyClan) ||
m_aClients[m_LocalIDs[1]].m_Country != g_Config.m_ClDummyCountry ||
str_comp(m_aClients[m_LocalIDs[1]].m_aSkinName, g_Config.m_ClDummySkin) ||
@ -1972,7 +1972,7 @@ void CGameClient::SendDummyInfo(bool Start)
if(Start)
{
CNetMsg_Cl_StartInfo Msg;
Msg.m_pName = g_Config.m_ClDummyName;
Msg.m_pName = Client()->DummyName();
Msg.m_pClan = g_Config.m_ClDummyClan;
Msg.m_Country = g_Config.m_ClDummyCountry;
Msg.m_pSkin = g_Config.m_ClDummySkin;
@ -1987,7 +1987,7 @@ void CGameClient::SendDummyInfo(bool Start)
else
{
CNetMsg_Cl_ChangeInfo Msg;
Msg.m_pName = g_Config.m_ClDummyName;
Msg.m_pName = Client()->DummyName();
Msg.m_pClan = g_Config.m_ClDummyClan;
Msg.m_Country = g_Config.m_ClDummyCountry;
Msg.m_pSkin = g_Config.m_ClDummySkin;

View file

@ -111,8 +111,8 @@ MACRO_CONFIG_INT(UiCloseWindowAfterChangingSetting, ui_close_window_after_changi
MACRO_CONFIG_INT(GfxNoclip, gfx_noclip, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Disable clipping")
// dummy
MACRO_CONFIG_STR(ClDummyName, dummy_name, 16, "brainless tee", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Name of the Dummy")
MACRO_CONFIG_STR(ClDummyClan, dummy_clan, 12, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Clan of the Dummy")
MACRO_CONFIG_STR(ClDummyName, dummy_name, 16, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Name of the dummy")
MACRO_CONFIG_STR(ClDummyClan, dummy_clan, 12, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Clan of the dummy")
MACRO_CONFIG_INT(ClDummyCountry, dummy_country, -1, -1, 1000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Country of the Dummy")
MACRO_CONFIG_INT(ClDummyUseCustomColor, dummy_use_custom_color, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Toggles usage of custom colors")
MACRO_CONFIG_COL(ClDummyColorBody, dummy_color_body, 65408, CFGFLAG_CLIENT|CFGFLAG_SAVE|CFGFLAG_COLLIGHT, "Dummy body color")