Skip to content

Commit

Permalink
Some more minor settings menu fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
def- committed Aug 28, 2015
1 parent 865d509 commit ed49e32
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 21 deletions.
1 change: 1 addition & 0 deletions src/game/client/components/menus.cpp
Expand Up @@ -89,6 +89,7 @@ CMenus::CMenus()
m_DDRacePage = PAGE_BROWSER;

m_DemoPlayerState = DEMOPLAYER_NONE;
m_Dummy = false;
}

vec4 CMenus::ButtonColorMul(const void *pID)
Expand Down
1 change: 1 addition & 0 deletions src/game/client/components/menus.h
Expand Up @@ -324,6 +324,7 @@ class CMenus : public CComponent
int DoButton_CheckBox_DontCare(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
sorted_array<CDemoItem> m_lDemos;
void DemolistPopulate();
bool m_Dummy;

// Ghost
struct CGhostItem
Expand Down
33 changes: 15 additions & 18 deletions src/game/client/components/menus_settings.cpp
Expand Up @@ -252,13 +252,11 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
CUIRect Button, Label, Dummy;
MainView.HSplitTop(10.0f, 0, &MainView);

static bool s_Dummy = false;

char *Name = g_Config.m_PlayerName;
char *Clan = g_Config.m_PlayerClan;
int *Country = &g_Config.m_PlayerCountry;

if(s_Dummy)
if(m_Dummy)
{
Name = g_Config.m_ClDummyName;
Clan = g_Config.m_ClDummyClan;
Expand All @@ -276,15 +274,15 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
static float s_OffsetName = 0.0f;
if(DoEditBox(Name, &Button, Name, sizeof(g_Config.m_PlayerName), 14.0f, &s_OffsetName))
{
if(s_Dummy)
if(m_Dummy)
m_NeedSendDummyinfo = true;
else
m_NeedSendinfo = true;
}

if(DoButton_CheckBox(&g_Config.m_ClShowKillMessages, Localize("Dummy settings"), s_Dummy, &Dummy))
if(DoButton_CheckBox(&g_Config.m_ClShowKillMessages, Localize("Dummy settings"), m_Dummy, &Dummy))
{
s_Dummy ^= 1;
m_Dummy ^= 1;
}

// player clan
Expand All @@ -297,7 +295,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
static float s_OffsetClan = 0.0f;
if(DoEditBox(Clan, &Button, Clan, sizeof(g_Config.m_PlayerClan), 14.0f, &s_OffsetClan))
{
if(s_Dummy)
if(m_Dummy)
m_NeedSendDummyinfo = true;
else
m_NeedSendinfo = true;
Expand Down Expand Up @@ -335,7 +333,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
if(OldSelected != NewSelected)
{
*Country = m_pClient->m_pCountryFlags->GetByIndex(NewSelected)->m_CountryCode;
if(s_Dummy)
if(m_Dummy)
m_NeedSendDummyinfo = true;
else
m_NeedSendinfo = true;
Expand All @@ -348,13 +346,12 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
static bool s_InitSkinlist = true;
MainView.HSplitTop(10.0f, 0, &MainView);

static bool s_Dummy = false;
char *Skin = g_Config.m_ClPlayerSkin;
int *UseCustomColor = &g_Config.m_ClPlayerUseCustomColor;
int *ColorBody = &g_Config.m_ClPlayerColorBody;
int *ColorFeet = &g_Config.m_ClPlayerColorFeet;

if(s_Dummy)
if(m_Dummy)
{
Skin = g_Config.m_ClDummySkin;
UseCustomColor = &g_Config.m_ClDummyUseCustomColor;
Expand Down Expand Up @@ -388,16 +385,16 @@ void CMenus::RenderSettingsTee(CUIRect MainView)

Dummy.HSplitTop(20.0f, &DummyLabel, &Dummy);

if(DoButton_CheckBox(&g_Config.m_ClShowKillMessages, Localize("Dummy settings"), s_Dummy, &DummyLabel))
if(DoButton_CheckBox(&g_Config.m_ClShowKillMessages, Localize("Dummy settings"), m_Dummy, &DummyLabel))
{
s_Dummy ^= 1;
m_Dummy ^= 1;
}

Dummy.HSplitTop(20.0f, &DummyLabel, &Dummy);

if(DoButton_CheckBox(&g_Config.m_ClShowNewSkins, Localize("Show new skins ingame"), g_Config.m_ClShowNewSkins, &DummyLabel))
if(DoButton_CheckBox(&g_Config.m_ClVanillaSkinsOnly, Localize("Vanilla Skins only"), !g_Config.m_ClVanillaSkinsOnly, &DummyLabel))
{
g_Config.m_ClShowNewSkins ^= 1;
g_Config.m_ClVanillaSkinsOnly ^= 1;
m_NeedRestartSkins = true;
}

Expand All @@ -418,7 +415,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
if(DoButton_CheckBox(&ColorBody, Localize("Custom colors"), *UseCustomColor, &Button))
{
*UseCustomColor = *UseCustomColor?0:1;
if(s_Dummy)
if(m_Dummy)
m_NeedSendDummyinfo = true;
else
m_NeedSendinfo = true;
Expand Down Expand Up @@ -470,7 +467,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)

if(PrevColor != Color)
{
if(s_Dummy)
if(m_Dummy)
m_NeedSendDummyinfo = true;
else
m_NeedSendinfo = true;
Expand Down Expand Up @@ -553,7 +550,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
if(OldSelected != NewSelected)
{
mem_copy(Skin, s_paSkinList[NewSelected]->m_aName, sizeof(g_Config.m_ClPlayerSkin));
if(s_Dummy)
if(m_Dummy)
m_NeedSendDummyinfo = true;
else
m_NeedSendinfo = true;
Expand All @@ -578,7 +575,7 @@ static CKeyInfo gs_aKeys[] =
{ "Fire", "+fire", 0 },
{ "Hook", "+hook", 0 },
{ "Hook Collisions", "+showhookcoll", 0 },
{ "Toggle Dynamic Camera", "toggle cl_dyncam 0 1", 0 },
{ "Toggle DynCam", "toggle cl_dyncam 0 1", 0 },
{ "Hammer", "+weapon1", 0 },
{ "Pistol", "+weapon2", 0 },
{ "Shotgun", "+weapon3", 0 },
Expand Down
2 changes: 1 addition & 1 deletion src/game/client/components/skins.cpp
Expand Up @@ -18,7 +18,7 @@ const char* vanillaSkins[] = {"bluekitty.png", "bluestripe.png", "brownbear.png"

int CSkins::SkinScan(const char *pName, int IsDir, int DirType, void *pUser)
{
if(!g_Config.m_ClShowNewSkins)
if(g_Config.m_ClVanillaSkinsOnly)
{
bool found = false;
for(unsigned int i = 0; i < sizeof(vanillaSkins) / sizeof(vanillaSkins[0]); i++)
Expand Down
3 changes: 1 addition & 2 deletions src/game/variables.h
Expand Up @@ -72,8 +72,7 @@ MACRO_CONFIG_STR(ClDDNetUpdateServer, cl_ddnet_update_server, 100, "update.ddnet
MACRO_CONFIG_STR(ClDDNetMapServer, cl_ddnet_maps_server, 100, "maps.ddnet.tw", CFGFLAG_CLIENT|CFGFLAG_SAVE, "Server to use to download maps")

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(ClVanillaSkinsOnly, cl_vanilla_skins_only, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Only show skins available in Vanilla Teeworlds")
MACRO_CONFIG_INT(ClAutoStatboardScreenshot, cl_auto_statboard_screenshot, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Automatically take game over statboard screenshot")
MACRO_CONFIG_INT(ClAutoStatboardScreenshotMax, cl_auto_statboard_screenshot_max, 10, 0, 1000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Maximum number of automatically created statboard screenshots (0 = no limit)")

Expand Down

0 comments on commit ed49e32

Please sign in to comment.