Rename detailed_stats to statboard

This commit is contained in:
Nikita Zyuzin 2015-05-21 13:41:59 +04:00
parent 246bb7eabf
commit d8d20b0c1a
6 changed files with 42 additions and 30 deletions

View file

@ -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;
}

View file

@ -5,17 +5,17 @@
#include <game/generated/client_data.h>
#include <game/client/gameclient.h>
#include <game/client/animstate.h>
#include <game/client/components/detailed_stats.h>
#include <game/client/components/motd.h>
#include <game/client/components/statboard.h>
CDetailedStats::CDetailedStats()
CStatboard::CStatboard()
{
m_Active = false;
m_ScreenshotTaken = false;
m_ScreenshotTime = -1;
}
void CDetailedStats::OnReset()
void CStatboard::OnReset()
{
for(int i=0; i<MAX_CLIENTS; i++)
m_pClient->m_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; i<NUM_WEAPONS - 1; i++) // No katana
w += 80;
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] = pStats.m_aFragsWith[j] || pStats.m_aDeathsFrom[j];
}
for(i=0; i<NUM_WEAPONS; i++)
if(aDisplayWeapon[i])
w += 80;
float x = Width/2-w/2;
float y = 200.0f;
@ -223,8 +231,10 @@ void CDetailedStats::RenderGlobalStats()
Graphics()->TextureSet(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();

View file

@ -1,6 +1,6 @@
#include <game/client/component.h>
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();

View file

@ -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 <base/system.h>
@ -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)

View file

@ -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;

View file

@ -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)")