From d8d20b0c1a63a05f7b798a81bb2027f71ebea90b Mon Sep 17 00:00:00 2001 From: Nikita Zyuzin Date: Thu, 21 May 2015 13:41:59 +0400 Subject: [PATCH] Rename detailed_stats to statboard --- src/engine/client/client.cpp | 6 +-- .../{detailed_stats.cpp => statboard.cpp} | 45 ++++++++++++------- .../{detailed_stats.h => statboard.h} | 4 +- src/game/client/gameclient.cpp | 11 +++-- src/game/client/gameclient.h | 2 +- src/game/variables.h | 4 +- 6 files changed, 42 insertions(+), 30 deletions(-) rename src/game/client/components/{detailed_stats.cpp => statboard.cpp} (91%) rename src/game/client/components/{detailed_stats.h => statboard.h} (87%) diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index e1e5ff72d..1b484dff0 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -2894,7 +2894,7 @@ void CClient::AutoScreenshot_Start() void CClient::AutoStatScreenshot_Start() { - if(g_Config.m_ClDsStatScreenshot) + if(g_Config.m_ClStatboardScreenshot) { Graphics()->TakeScreenshot("auto/stats/autoscreen"); m_AutoStatScreenshotRecycle = true; @@ -2919,11 +2919,11 @@ void CClient::AutoStatScreenshot_Cleanup() { if(m_AutoStatScreenshotRecycle) { - if(g_Config.m_ClDsStatScreenshotMax) + if(g_Config.m_ClStatboardScreenshotMax) { // clean up auto taken screens CFileCollection AutoScreens; - AutoScreens.Init(Storage(), "screenshots/auto/stats", "autoscreen", ".png", g_Config.m_ClDsStatScreenshotMax); + AutoScreens.Init(Storage(), "screenshots/auto/stats", "autoscreen", ".png", g_Config.m_ClStatboardScreenshotMax); } m_AutoStatScreenshotRecycle = false; } diff --git a/src/game/client/components/detailed_stats.cpp b/src/game/client/components/statboard.cpp similarity index 91% rename from src/game/client/components/detailed_stats.cpp rename to src/game/client/components/statboard.cpp index 60b3374a6..99206eaf6 100644 --- a/src/game/client/components/detailed_stats.cpp +++ b/src/game/client/components/statboard.cpp @@ -5,17 +5,17 @@ #include #include #include -#include #include +#include -CDetailedStats::CDetailedStats() +CStatboard::CStatboard() { m_Active = false; m_ScreenshotTaken = false; m_ScreenshotTime = -1; } -void CDetailedStats::OnReset() +void CStatboard::OnReset() { for(int i=0; im_aStats[i].Reset(); @@ -24,22 +24,22 @@ void CDetailedStats::OnReset() m_ScreenshotTime = -1; } -void CDetailedStats::ConKeyStats(IConsole::IResult *pResult, void *pUserData) +void CStatboard::ConKeyStats(IConsole::IResult *pResult, void *pUserData) { - ((CDetailedStats *)pUserData)->m_Active = pResult->GetInteger(0) != 0; + ((CStatboard *)pUserData)->m_Active = pResult->GetInteger(0) != 0; } -void CDetailedStats::OnConsoleInit() +void CStatboard::OnConsoleInit() { Console()->Register("+statboard", "", CFGFLAG_CLIENT, ConKeyStats, this, "Show stats"); } -bool CDetailedStats::IsActive() +bool CStatboard::IsActive() { return m_Active; } -void CDetailedStats::OnMessage(int MsgType, void *pRawMsg) +void CStatboard::OnMessage(int MsgType, void *pRawMsg) { if(MsgType == NETMSGTYPE_SV_KILLMSG) { @@ -119,9 +119,9 @@ void CDetailedStats::OnMessage(int MsgType, void *pRawMsg) } } -void CDetailedStats::OnRender() +void CStatboard::OnRender() { - if(g_Config.m_ClDsStatScreenshot) + if(g_Config.m_ClStatboardScreenshot) { 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; @@ -138,7 +138,7 @@ void CDetailedStats::OnRender() RenderGlobalStats(); } -void CDetailedStats::RenderGlobalStats() +void CStatboard::RenderGlobalStats() { //clear motd if it is active if(m_pClient->m_pMotd->IsActive()) @@ -191,9 +191,17 @@ void CDetailedStats::RenderGlobalStats() if(m_pClient->m_Snap.m_pGameInfoObj && m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags&GAMEFLAG_FLAGS) w += 100; + bool aDisplayWeapon[NUM_WEAPONS] = {false}; w += 10; - for(i=0; im_aStats[apPlayers[i]->m_ClientID]; + for(int j=0; jTextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id); Graphics()->QuadsBegin(); - for(i = 0, px-=40; i < NUM_WEAPONS - 1; i++) // No katana + 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); @@ -357,8 +367,11 @@ void CDetailedStats::RenderGlobalStats() TextRender()->Text(0, x-tw+px, y, FontSize, aBuf, -1); px += 100; } - for(i = 0, px=px-40; i < NUM_WEAPONS - 1; i++) // No katana + for(i = 0, px=px-40; i < NUM_WEAPONS; i++) { + 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); @@ -375,7 +388,7 @@ void CDetailedStats::RenderGlobalStats() } } -void CDetailedStats::AutoStatScreenshot() +void CStatboard::AutoStatScreenshot() { if(Client()->State() != IClient::STATE_DEMOPLAYBACK) Client()->AutoStatScreenshot_Start(); diff --git a/src/game/client/components/detailed_stats.h b/src/game/client/components/statboard.h similarity index 87% rename from src/game/client/components/detailed_stats.h rename to src/game/client/components/statboard.h index 7e47109f0..35bf9a1d3 100644 --- a/src/game/client/components/detailed_stats.h +++ b/src/game/client/components/statboard.h @@ -1,6 +1,6 @@ #include -class CDetailedStats: public CComponent +class CStatboard: public CComponent { private: bool m_Active; @@ -11,7 +11,7 @@ class CDetailedStats: public CComponent void AutoStatScreenshot(); public: - CDetailedStats(); + CStatboard(); virtual void OnReset(); virtual void OnConsoleInit(); virtual void OnRender(); diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 7e110956e..73067f66c 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -35,7 +35,6 @@ #include "components/countryflags.h" #include "components/damageind.h" #include "components/debughud.h" -#include "components/detailed_stats.h" #include "components/effects.h" #include "components/emoticon.h" #include "components/flow.h" @@ -54,6 +53,7 @@ #include "components/skins.h" #include "components/sounds.h" #include "components/spectator.h" +#include "components/statboard.h" #include "components/voting.h" #include @@ -81,7 +81,7 @@ static CDebugHud gs_DebugHud; static CControls gs_Controls; static CEffects gs_Effects; static CScoreboard gs_Scoreboard; -static CDetailedStats gs_DetailedStats; +static CStatboard gs_Statboard; static CSounds gs_Sounds; static CEmoticon gs_Emoticon; static CDamageInd gsDamageInd; @@ -148,7 +148,7 @@ void CGameClient::OnConsoleInit() m_pMapimages = &::gs_MapImages; m_pVoting = &::gs_Voting; m_pScoreboard = &::gs_Scoreboard; - m_pDetailedStats = &::gs_DetailedStats; + m_pStatboard = &::gs_Statboard; m_pItems = &::gs_Items; m_pMapLayersBackGround = &::gs_MapLayersBackGround; m_pMapLayersForeGround = &::gs_MapLayersForeGround; @@ -191,7 +191,7 @@ void CGameClient::OnConsoleInit() m_All.Add(&gs_Broadcast); m_All.Add(&gs_DebugHud); m_All.Add(&gs_Scoreboard); - m_All.Add(&gs_DetailedStats); + m_All.Add(&gs_Statboard); m_All.Add(m_pMotd); m_All.Add(m_pMenus); m_All.Add(m_pGameConsole); @@ -844,8 +844,7 @@ void CGameClient::OnStartGame() { if(Client()->State() != IClient::STATE_DEMOPLAYBACK) Client()->DemoRecorder_HandleAutoStart(); - for(int i = 0; i < MAX_CLIENTS; i++) - m_aStats[i].Reset(); + m_pStatboard->OnReset(); } void CGameClient::OnFlagGrab(int TeamID) diff --git a/src/game/client/gameclient.h b/src/game/client/gameclient.h index 951d9d452..9ffda4211 100644 --- a/src/game/client/gameclient.h +++ b/src/game/client/gameclient.h @@ -340,7 +340,7 @@ public: class CMapImages *m_pMapimages; class CVoting *m_pVoting; class CScoreboard *m_pScoreboard; - class CDetailedStats *m_pDetailedStats; + class CStatboard *m_pStatboard; class CItems *m_pItems; class CMapLayers *m_pMapLayersBackGround; class CMapLayers *m_pMapLayersForeGround; diff --git a/src/game/variables.h b/src/game/variables.h index 0ef6aef89..e0c47b43e 100644 --- a/src/game/variables.h +++ b/src/game/variables.h @@ -69,8 +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(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(ClStatboardScreenshot, cl_statboard_screenshot, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Automatically take game over statboard screenshot") +MACRO_CONFIG_INT(ClStatboardScreenshotMax, cl_statboard_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)")