Remove stat board columns configuration variable

This commit is contained in:
Nikita Zyuzin 2015-05-21 03:06:31 +04:00
parent 42759e8909
commit 246bb7eabf
3 changed files with 59 additions and 106 deletions

View file

@ -121,16 +121,13 @@ void CDetailedStats::OnMessage(int MsgType, void *pRawMsg)
void CDetailedStats::OnRender()
{
// auto stat screenshot stuff
if(g_Config.m_ClDsStatScreenshot)
{
if(m_ScreenshotTime < 0 && m_pClient->m_Snap.m_pGameInfoObj && m_pClient->m_Snap.m_pGameInfoObj->m_GameStateFlags&GAMESTATEFLAG_GAMEOVER)
m_ScreenshotTime = time_get()+time_freq()*3;
m_ScreenshotTime = time_get() + time_freq() * 3;
if(m_ScreenshotTime > -1 && m_ScreenshotTime < time_get())
m_Active = true;
if(!m_ScreenshotTaken && m_ScreenshotTime > -1 && m_ScreenshotTime+time_freq()/5 < time_get())
if(!m_ScreenshotTaken && m_ScreenshotTime > -1 && m_ScreenshotTime + time_freq() / 5 < time_get())
{
AutoStatScreenshot();
m_ScreenshotTaken = true;
@ -184,31 +181,19 @@ void CDetailedStats::RenderGlobalStats()
}
for(i = 0; i < 9; i++)
if(g_Config.m_ClDsStatboardInfos & (1<<i))
{
if((1<<i) == (DETAILED_STATS_BESTSPREE))
w += 140;
else
w += 100;
}
{
if(i == 7) // Best Spree
w += 140;
else
w += 100;
}
if(m_pClient->m_Snap.m_pGameInfoObj && m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags&GAMEFLAG_FLAGS && g_Config.m_ClDsStatboardInfos&DETAILED_STATS_FLAGCAPTURES)
if(m_pClient->m_Snap.m_pGameInfoObj && m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags&GAMEFLAG_FLAGS)
w += 100;
bool aDisplayWeapon[NUM_WEAPONS] = {false};
if(g_Config.m_ClDsStatboardInfos & DETAILED_STATS_WEAPS)
{
w += 10;
for(i=0; i<NumPlayers; i++)
{
const CGameClient::CClientStats pStats = m_pClient->m_aStats[apPlayers[i]->m_ClientID];
for(int j=0; j<NUM_WEAPONS; j++)
aDisplayWeapon[j] = aDisplayWeapon[j] || pStats.m_aFragsWith[j] || pStats.m_aDeathsFrom[j];
}
for(i=0; i<NUM_WEAPONS; i++)
if(aDisplayWeapon[i])
w += 80;
}
w += 10;
for(i=0; i<NUM_WEAPONS - 1; i++) // No katana
w += 80;
float x = Width/2-w/2;
float y = 200.0f;
@ -228,36 +213,29 @@ void CDetailedStats::RenderGlobalStats()
TextRender()->Text(0, x+10, y-5, 24.0f, Localize("Name"), -1);
const char *apHeaders[] = { Localize("Frags"), Localize("Deaths"), Localize("Suicides"), Localize("Ratio"), Localize("Net"), Localize("FPM"), Localize("Spree"), Localize("Best spree"), Localize("Grabs") };
for(i = 0; i < 9; i++)
if(g_Config.m_ClDsStatboardInfos & (1<<i))
{
if(1<<i == DETAILED_STATS_BESTSPREE)
px += 40.0f;
tw = TextRender()->TextWidth(0, 24.0f, apHeaders[i], -1);
TextRender()->Text(0, x+px-tw, y-5, 24.0f, apHeaders[i], -1);
px += 100;
}
if(g_Config.m_ClDsStatboardInfos & DETAILED_STATS_WEAPS)
{
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
Graphics()->QuadsBegin();
for(i = 0, px-=40; i < NUM_WEAPONS; i++)
{
if(!aDisplayWeapon[i])
continue;
RenderTools()->SelectSprite(g_pData->m_Weapons.m_aId[i].m_pSpriteBody);
if(i == 0)
RenderTools()->DrawSprite(x+px, y+10, g_pData->m_Weapons.m_aId[i].m_VisualSize*0.8);
else
RenderTools()->DrawSprite(x+px, y+10, g_pData->m_Weapons.m_aId[i].m_VisualSize);
px += 80;
}
Graphics()->QuadsEnd();
px += 40;
if(i == 7) // Best Spree
px += 40.0f;
tw = TextRender()->TextWidth(0, 24.0f, apHeaders[i], -1);
TextRender()->Text(0, x+px-tw, y-5, 24.0f, apHeaders[i], -1);
px += 100;
}
if(m_pClient->m_Snap.m_pGameInfoObj && m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags&GAMEFLAG_FLAGS && g_Config.m_ClDsStatboardInfos&DETAILED_STATS_FLAGCAPTURES)
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
Graphics()->QuadsBegin();
for(i = 0, px-=40; i < NUM_WEAPONS - 1; i++) // No katana
{
RenderTools()->SelectSprite(g_pData->m_Weapons.m_aId[i].m_pSpriteBody);
if(i == 0)
RenderTools()->DrawSprite(x+px, y+10, g_pData->m_Weapons.m_aId[i].m_VisualSize*0.8);
else
RenderTools()->DrawSprite(x+px, y+10, g_pData->m_Weapons.m_aId[i].m_VisualSize);
px += 80;
}
Graphics()->QuadsEnd();
px += 40;
if(m_pClient->m_Snap.m_pGameInfoObj && m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags&GAMEFLAG_FLAGS)
{
px -= 40;
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
@ -303,12 +281,6 @@ void CDetailedStats::RenderGlobalStats()
RenderTools()->RenderTee(CAnimState::GetIdle(), &Teeinfo, EMOTE_NORMAL, vec2(1,0), vec2(x+28, y+28+TeeOffset));
char aBuf[128];
if(g_Config.m_ClDsStatId)
{
str_format(aBuf, sizeof(aBuf), "%d", pInfo->m_ClientID);
TextRender()->Text(0, x, y, FontSize, aBuf, -1);
}
CTextCursor Cursor;
tw = TextRender()->TextWidth(0, FontSize, m_pClient->m_aClients[pInfo->m_ClientID].m_aName, -1);
TextRender()->SetCursor(&Cursor, x+64, y, FontSize, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
@ -317,28 +289,28 @@ void CDetailedStats::RenderGlobalStats()
px = 325;
if(g_Config.m_ClDsStatboardInfos & DETAILED_STATS_FRAGS)
// DETAILED_STATS_FRAGS
{
str_format(aBuf, sizeof(aBuf), "%d", Stats.m_Frags);
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
TextRender()->Text(0, x-tw+px, y, FontSize, aBuf, -1);
px += 100;
}
if(g_Config.m_ClDsStatboardInfos & DETAILED_STATS_DEATHS)
// DETAILED_STATS_DEATHS
{
str_format(aBuf, sizeof(aBuf), "%d", Stats.m_Deaths);
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
TextRender()->Text(0, x-tw+px, y, FontSize, aBuf, -1);
px += 100;
}
if(g_Config.m_ClDsStatboardInfos & DETAILED_STATS_SUICIDES)
// DETAILED_STATS_SUICIDES
{
str_format(aBuf, sizeof(aBuf), "%d", Stats.m_Suicides);
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
TextRender()->Text(0, x-tw+px, y, FontSize, aBuf, -1);
px += 100;
}
if(g_Config.m_ClDsStatboardInfos & DETAILED_STATS_RATIO)
// DETAILED_STATS_RATIO
{
if(Stats.m_Deaths == 0)
str_format(aBuf, sizeof(aBuf), "--");
@ -348,14 +320,14 @@ void CDetailedStats::RenderGlobalStats()
TextRender()->Text(0, x-tw+px, y, FontSize, aBuf, -1);
px += 100;
}
if(g_Config.m_ClDsStatboardInfos & DETAILED_STATS_NET)
// DETAILED_STATS_NET
{
str_format(aBuf, sizeof(aBuf), "%+d", Stats.m_Frags-Stats.m_Deaths);
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
TextRender()->Text(0, x-tw+px, y, FontSize, aBuf, -1);
px += 100;
}
if(g_Config.m_ClDsStatboardInfos & DETAILED_STATS_FPM)
// DETAILED_STATS_FPM
{
float Fpm = (float)(Stats.m_Frags*60)/((float)(Client()->GameTick()-Stats.m_JoinDate)/Client()->GameTickSpeed());
str_format(aBuf, sizeof(aBuf), "%.1f", Fpm);
@ -363,14 +335,14 @@ void CDetailedStats::RenderGlobalStats()
TextRender()->Text(0, x-tw+px, y, FontSize, aBuf, -1);
px += 100;
}
if(g_Config.m_ClDsStatboardInfos & DETAILED_STATS_SPREE)
// DETAILED_STATS_SPREE
{
str_format(aBuf, sizeof(aBuf), "%d", Stats.m_CurrentSpree);
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
TextRender()->Text(0, x-tw+px, y, FontSize, aBuf, -1);
px += 100;
}
if(g_Config.m_ClDsStatboardInfos & DETAILED_STATS_BESTSPREE)
// DETAILED_STATS_BESTSPREE
{
px += 40;
str_format(aBuf, sizeof(aBuf), "%d", Stats.m_BestSpree);
@ -378,24 +350,21 @@ void CDetailedStats::RenderGlobalStats()
TextRender()->Text(0, x-tw+px, y, FontSize, aBuf, -1);
px += 100;
}
if(m_pClient->m_Snap.m_pGameInfoObj && m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags&GAMEFLAG_FLAGS && g_Config.m_ClDsStatboardInfos&DETAILED_STATS_FLAGGRABS)
if(m_pClient->m_Snap.m_pGameInfoObj && m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags&GAMEFLAG_FLAGS)
{
str_format(aBuf, sizeof(aBuf), "%d", Stats.m_FlagGrabs);
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
TextRender()->Text(0, x-tw+px, y, FontSize, aBuf, -1);
px += 100;
}
for(i = 0, px=px-40; i < NUM_WEAPONS; i++)
for(i = 0, px=px-40; i < NUM_WEAPONS - 1; i++) // No katana
{
if(!aDisplayWeapon[i])
continue;
str_format(aBuf, sizeof(aBuf), "%d/%d", Stats.m_aFragsWith[i], Stats.m_aDeathsFrom[i]);
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
TextRender()->Text(0, x+px-tw/2, y, FontSize, aBuf, -1);
px += 80;
}
if(m_pClient->m_Snap.m_pGameInfoObj && m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags&GAMEFLAG_FLAGS && g_Config.m_ClDsStatboardInfos&DETAILED_STATS_FLAGCAPTURES)
if(m_pClient->m_Snap.m_pGameInfoObj && m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags&GAMEFLAG_FLAGS)
{
str_format(aBuf, sizeof(aBuf), "%d", Stats.m_FlagCaptures);
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);

View file

@ -1,34 +1,20 @@
#include <game/client/component.h>
enum {
DETAILED_STATS_FRAGS=1,
DETAILED_STATS_DEATHS=2,
DETAILED_STATS_SUICIDES=4,
DETAILED_STATS_RATIO=8,
DETAILED_STATS_NET=16,
DETAILED_STATS_FPM=32,
DETAILED_STATS_SPREE=64,
DETAILED_STATS_BESTSPREE=128,
DETAILED_STATS_FLAGGRABS=256,
DETAILED_STATS_WEAPS=512,
DETAILED_STATS_FLAGCAPTURES=1024,
};
class CDetailedStats: public CComponent
{
private:
bool m_Active;
bool m_ScreenshotTaken;
int64 m_ScreenshotTime;
static void ConKeyStats(IConsole::IResult *pResult, void *pUserData);
void RenderGlobalStats();
void AutoStatScreenshot();
private:
bool m_Active;
bool m_ScreenshotTaken;
int64 m_ScreenshotTime;
static void ConKeyStats(IConsole::IResult *pResult, void *pUserData);
void RenderGlobalStats();
void AutoStatScreenshot();
public:
CDetailedStats();
virtual void OnReset();
virtual void OnConsoleInit();
virtual void OnRender();
virtual void OnMessage(int MsgType, void *pRawMsg);
bool IsActive();
public:
CDetailedStats();
virtual void OnReset();
virtual void OnConsoleInit();
virtual void OnRender();
virtual void OnMessage(int MsgType, void *pRawMsg);
bool IsActive();
};

View file

@ -69,10 +69,8 @@ MACRO_CONFIG_STR(ClDDNetMapServer, cl_ddnet_maps_server, 100, "maps.ddnet.tw", C
MACRO_CONFIG_STR(ClLanguagefile, cl_languagefile, 255, "", CFGFLAG_CLIENT|CFGFLAG_SAVE, "What language file to use")
MACRO_CONFIG_INT(ClShowNewSkins, cl_show_new_skins, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show new skins ingame")
MACRO_CONFIG_INT(ClShowCustomSkins, cl_show_custom_skins, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show custom skins ingame")
MACRO_CONFIG_INT(ClDsStatboardInfos, ds_statboard_infos, 495, 1, 1023, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Mask of infos to display on the global statboard")
MACRO_CONFIG_INT(ClDsStatId, ds_stat_id, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show player id in statboards")
MACRO_CONFIG_INT(ClDsStatScreenshot, tc_stat_screenshot, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Automatically take game over statboard screenshot")
MACRO_CONFIG_INT(ClDsStatScreenshotMax, tc_stat_screenshot_max, 10, 0, 1000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Maximum number of automatically created statboard screenshots (0 = no limit)")
MACRO_CONFIG_INT(ClDsStatScreenshot, cl_detailed_stats_screenshot, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Automatically take game over statboard screenshot")
MACRO_CONFIG_INT(ClDsStatScreenshotMax, cl_detailed_stats_screenshot_max, 10, 0, 1000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Maximum number of automatically created statboard screenshots (0 = no limit)")
MACRO_CONFIG_INT(ClDefaultZoom, cl_default_zoom, 10, 0, 20, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Default zoom level (10 default, min 0, max 20)")