DDRace Settings-tab

Checkbox for DDRace Scoreboard
This commit is contained in:
XXLTomate 2011-02-14 21:58:16 +01:00 committed by GreYFoXGTi
parent 39687efbcb
commit f0201597c6
5 changed files with 34 additions and 11 deletions

View file

@ -202,6 +202,7 @@ MACRO_CONFIG_INT(ClRaceGhost, cl_race_ghost, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAV
MACRO_CONFIG_INT(ClRaceShowGhost, cl_race_show_ghost, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show ghost",-1)
MACRO_CONFIG_INT(ClRaceSaveGhost, cl_race_save_ghost, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Save ghost",-1)
MACRO_CONFIG_INT(SvGlobalBantime, sv_global_ban_time, 60, 0, 1440, CFGFLAG_SERVER, "The time a client gets banned if the ban server reports it. 0 to disable", 4)
MACRO_CONFIG_INT(ClDDRaceScoreBoard, cl_ddrace_scoreboard, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Enable DDRace Scoreboard ", -1)
// these might need some fine tuning
MACRO_CONFIG_INT(SvChatPenalty, sv_chat_penalty, 250, 50, 1000, CFGFLAG_SERVER, "chatscore will be increased by this on every message, and decremented by 1 on every tick.", 3)
MACRO_CONFIG_INT(SvChatThreshold, sv_chat_threshold, 1000, 50, 10000 , CFGFLAG_SERVER, "if chatscore exceeds this, the player will be muted for sv_spam_mute_duration seconds", 3)

View file

@ -228,6 +228,7 @@ class CMenus : public CComponent
void RenderSettingsControls(CUIRect MainView);
void RenderSettingsGraphics(CUIRect MainView);
void RenderSettingsSound(CUIRect MainView);
void RenderSettingsDDRace(CUIRect MainView);
void RenderSettings(CUIRect MainView);
void SetActive(bool Active);

View file

@ -669,6 +669,20 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
MainView.HSplitTop(20.0f, 0, &MainView);
}
}
void CMenus::RenderSettingsDDRace(CUIRect MainView)
{
CUIRect Button;
MainView.VSplitLeft(300.0f, &MainView, 0);
static int s_SndEnable = g_Config.m_ClDDRaceScoreBoard;
MainView.HSplitTop(20.0f, &Button, &MainView);
if(DoButton_CheckBox(&g_Config.m_ClDDRaceScoreBoard, Localize("Use DDRace Scoreboard"), g_Config.m_ClDDRaceScoreBoard, &Button))
{
g_Config.m_ClDDRaceScoreBoard ^= 1;
}
}
class CLanguage
{
@ -829,7 +843,8 @@ void CMenus::RenderSettings(CUIRect MainView)
Localize("Player"),
Localize("Controls"),
Localize("Graphics"),
Localize("Sound")};
Localize("Sound"),
Localize("DDRace")};
int NumTabs = (int)(sizeof(aTabs)/sizeof(*aTabs));
@ -853,6 +868,8 @@ void CMenus::RenderSettings(CUIRect MainView)
RenderSettingsGraphics(MainView);
else if(s_SettingsPage == 4)
RenderSettingsSound(MainView);
else if(s_SettingsPage == 5)
RenderSettingsDDRace(MainView);
if(m_NeedRestartGraphics || m_NeedRestartSound)
UI()->DoLabel(&RestartWarning, Localize("You must restart the game for all settings to take effect."), 15.0f, -1);

View file

@ -25,8 +25,12 @@ CScoreboard::CScoreboard()
void CScoreboard::ConKeyScoreboard(IConsole::IResult *pResult, void *pUserData, int ClientID)
{
CScoreboard *pSelf = (CScoreboard *)pUserData;
pSelf->Client()->GetServerInfo(&pSelf->m_pServerInfo);
pSelf->m_GametypeRace = str_find_nocase(pSelf->m_pServerInfo.m_aGameType, GAMETYPES_RACE);
if (g_Config.m_ClDDRaceScoreBoard)
pSelf->m_DDRaceScoreBoard = str_find_nocase(pSelf->m_pServerInfo.m_aGameType, GAMETYPES_RACE);
else
pSelf->m_DDRaceScoreBoard = false;
pSelf->m_Active = pResult->GetInteger(0) != 0;
}
@ -108,7 +112,7 @@ void CScoreboard::RenderSpectators(float x, float y, float w)
{
if(Count)
str_append(aBuffer, ", ", sizeof(aBuffer));
if(m_GametypeRace)
if(m_DDRaceScoreBoard)
if (g_Config.m_ClShowIDs)
{
char aId[4];
@ -153,7 +157,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
float tw = TextRender()->TextWidth(0, 48, pTitle, -1);
TextRender()->Text(0, x+10, y, 48, pTitle, -1);
if(!m_GametypeRace)
if(!m_DDRaceScoreBoard)
if(m_pClient->m_Snap.m_pGameobj)
{
char aBuf[128];
@ -167,7 +171,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
// render headlines
TextRender()->Text(0, x+10, y, 24.0f, Localize("Score"), -1);
if(m_GametypeRace)
if(m_DDRaceScoreBoard)
{
TextRender()->Text(0, x+125+Offset, y, 24.0f, Localize("Name"), -1);
TextRender()->Text(0, x+w-75, y, 24.0f, Localize("Ping"), -1);
@ -214,7 +218,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
float FontSizeResize = FontSize;
float Width;
if(m_GametypeRace)
if(m_DDRaceScoreBoard)
{
const float ScoreWidth = 150.0f;
const float PingWidth = 60.0f;
@ -286,7 +290,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
float size = 64.0f;
IGraphics::CQuadItem QuadItem;
if(m_GametypeRace)
if(m_DDRaceScoreBoard)
QuadItem = IGraphics::CQuadItem(x+55+DataOffset, y-15, size/2, size);
else
QuadItem = IGraphics::CQuadItem(x+55, y-15, size/2, size);
@ -297,7 +301,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
CTeeRenderInfo TeeInfo = m_pClient->m_aClients[pInfo->m_ClientID].m_RenderInfo;
TeeInfo.m_Size *= TeeSizeMod;
if(m_GametypeRace)
if(m_DDRaceScoreBoard)
RenderTools()->RenderTee(CAnimState::GetIdle(), &TeeInfo, EMOTE_NORMAL, vec2(1,0), vec2(x+50+DataOffset, y+28+TeeOffset));
else
RenderTools()->RenderTee(CAnimState::GetIdle(), &TeeInfo, EMOTE_NORMAL, vec2(1,0), vec2(x+90, y+28+TeeOffset));
@ -346,7 +350,7 @@ void CScoreboard::OnRender()
Graphics()->MapScreen(0, 0, Width, Height);
float w;
if(m_GametypeRace)
if(m_DDRaceScoreBoard)
w = 750.0f;
else
w = 650.0f;

View file

@ -16,7 +16,7 @@ class CScoreboard : public CComponent
bool m_Active;
CServerInfo m_pServerInfo;
bool m_GametypeRace;
bool m_DDRaceScoreBoard;
public:
CScoreboard();