2010-11-20 10:37:14 +00:00
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */
2016-04-30 18:11:26 +00:00
# include "SDL.h" // SDL_VIDEO_DRIVER_X11
2008-08-27 15:48:50 +00:00
2011-08-31 11:56:04 +00:00
# include <base/tl/string.h>
2010-05-29 07:25:38 +00:00
# include <base/math.h>
2008-08-27 15:48:50 +00:00
2011-04-13 18:00:54 +00:00
# include <engine/engine.h>
2010-05-29 07:25:38 +00:00
# include <engine/graphics.h>
2010-09-16 11:32:56 +00:00
# include <engine/storage.h>
2010-05-29 07:25:38 +00:00
# include <engine/textrender.h>
2015-04-18 19:17:27 +00:00
# include <engine/updater.h>
2010-05-29 07:25:38 +00:00
# include <engine/shared/config.h>
2010-09-16 11:32:56 +00:00
# include <engine/shared/linereader.h>
2008-08-27 15:48:50 +00:00
2010-05-29 07:25:38 +00:00
# include <game/generated/protocol.h>
# include <game/generated/client_data.h>
2008-08-27 15:48:50 +00:00
2011-04-13 18:00:54 +00:00
# include <game/client/components/sounds.h>
2010-05-29 07:25:38 +00:00
# include <game/client/ui.h>
# include <game/client/render.h>
# include <game/client/gameclient.h>
# include <game/client/animstate.h>
# include <game/localization.h>
2008-08-27 15:48:50 +00:00
2010-05-29 07:25:38 +00:00
# include "binds.h"
2015-05-11 10:21:34 +00:00
# include "camera.h"
2011-03-16 20:31:55 +00:00
# include "countryflags.h"
2010-05-29 07:25:38 +00:00
# include "menus.h"
# include "skins.h"
2008-08-27 15:48:50 +00:00
2010-05-29 07:25:38 +00:00
CMenusKeyBinder CMenus : : m_Binder ;
2008-10-20 23:10:00 +00:00
2010-05-29 07:25:38 +00:00
CMenusKeyBinder : : CMenusKeyBinder ( )
2008-10-20 23:10:00 +00:00
{
2010-05-29 07:25:38 +00:00
m_TakeKey = false ;
m_GotKey = false ;
2019-04-28 17:22:19 +00:00
m_Modifier = 0 ;
2008-10-20 23:10:00 +00:00
}
2010-05-29 07:25:38 +00:00
bool CMenusKeyBinder : : OnInput ( IInput : : CEvent Event )
2008-10-20 23:10:00 +00:00
{
2010-05-29 07:25:38 +00:00
if ( m_TakeKey )
2008-10-20 23:10:00 +00:00
{
2019-04-28 17:22:19 +00:00
int TriggeringEvent = ( Event . m_Key = = KEY_MOUSE_1 ) ? IInput : : FLAG_PRESS : IInput : : FLAG_RELEASE ;
if ( Event . m_Flags & TriggeringEvent )
2008-10-20 23:10:00 +00:00
{
2010-05-29 07:25:38 +00:00
m_Key = Event ;
m_GotKey = true ;
m_TakeKey = false ;
2019-04-28 17:22:19 +00:00
int Mask = CBinds : : GetModifierMask ( Input ( ) ) ;
m_Modifier = 0 ;
while ( ! ( Mask & 1 ) )
{
Mask > > = 1 ;
m_Modifier + + ;
}
if ( CBinds : : ModifierMatchesKey ( m_Modifier , Event . m_Key ) )
m_Modifier = 0 ;
2008-10-20 23:10:00 +00:00
}
return true ;
}
2010-05-29 07:25:38 +00:00
2008-10-20 23:10:00 +00:00
return false ;
}
2011-04-01 17:36:44 +00:00
void CMenus : : RenderSettingsGeneral ( CUIRect MainView )
2008-08-27 15:48:50 +00:00
{
2019-07-18 23:58:49 +00:00
# if defined(CONF_FAMILY_WINDOWS)
2019-07-18 23:53:27 +00:00
bool CheckSettings = false ;
static int s_ClShowConsole = g_Config . m_ClShowConsole ;
2019-07-18 23:58:49 +00:00
# endif
2019-07-18 23:53:27 +00:00
2011-04-01 17:36:44 +00:00
char aBuf [ 128 ] ;
2014-06-27 23:07:41 +00:00
CUIRect Label , Button , Left , Right , Game , Client , AutoReconnect ;
2018-01-25 19:00:35 +00:00
MainView . HSplitTop ( 180.0f , & Game , & Client ) ;
Client . HSplitTop ( 160.0f , & Client , & AutoReconnect ) ;
2008-08-27 15:48:50 +00:00
2011-04-01 17:36:44 +00:00
// game
2010-05-29 07:25:38 +00:00
{
2011-04-01 17:36:44 +00:00
// headline
Game . HSplitTop ( 30.0f , & Label , & Game ) ;
UI ( ) - > DoLabelScaled ( & Label , Localize ( " Game " ) , 20.0f , - 1 ) ;
Game . Margin ( 5.0f , & Game ) ;
Game . VSplitMid ( & Left , & Right ) ;
Left . VSplitRight ( 5.0f , & Left , 0 ) ;
Right . VMargin ( 5.0f , & Right ) ;
2009-06-15 08:15:53 +00:00
2011-04-01 17:36:44 +00:00
// dynamic camera
Left . HSplitTop ( 20.0f , & Button , & Left ) ;
2018-02-22 19:38:26 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClDyncam , Localize ( " Dynamic Camera " ) , g_Config . m_ClDyncam , & Button ) )
g_Config . m_ClDyncam ^ = 1 ;
2008-08-27 15:48:50 +00:00
2011-04-01 17:36:44 +00:00
// weapon pickup
Left . HSplitTop ( 5.0f , 0 , & Left ) ;
Left . HSplitTop ( 20.0f , & Button , & Left ) ;
2010-05-29 07:25:38 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClAutoswitchWeapons , Localize ( " Switch weapon on pickup " ) , g_Config . m_ClAutoswitchWeapons , & Button ) )
g_Config . m_ClAutoswitchWeapons ^ = 1 ;
2014-06-16 11:29:18 +00:00
// weapon out of ammo autoswitch
Left . HSplitTop ( 5.0f , 0 , & Left ) ;
Left . HSplitTop ( 20.0f , & Button , & Left ) ;
if ( DoButton_CheckBox ( & g_Config . m_ClAutoswitchWeaponsOutOfAmmo , Localize ( " Switch weapon when out of ammo " ) , g_Config . m_ClAutoswitchWeaponsOutOfAmmo , & Button ) )
g_Config . m_ClAutoswitchWeaponsOutOfAmmo ^ = 1 ;
2014-09-21 13:08:25 +00:00
// weapon reset on death
Left . HSplitTop ( 5.0f , 0 , & Left ) ;
Left . HSplitTop ( 20.0f , & Button , & Left ) ;
if ( DoButton_CheckBox ( & g_Config . m_ClResetWantedWeaponOnDeath , Localize ( " Reset wanted weapon on death " ) , g_Config . m_ClResetWantedWeaponOnDeath , & Button ) )
2015-08-27 18:26:05 +00:00
g_Config . m_ClResetWantedWeaponOnDeath ^ = 1 ;
2014-09-21 13:08:25 +00:00
2012-01-09 22:29:15 +00:00
// chat messages
2014-09-21 13:08:25 +00:00
Right . HSplitTop ( 5.0f , 0 , & Right ) ;
Right . HSplitTop ( 20.0f , & Button , & Right ) ;
2012-01-09 22:29:15 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClShowChatFriends , Localize ( " Show only chat messages from friends " ) , g_Config . m_ClShowChatFriends , & Button ) )
g_Config . m_ClShowChatFriends ^ = 1 ;
2011-04-01 17:36:44 +00:00
// name plates
2014-09-23 17:06:25 +00:00
Right . HSplitTop ( 5.0f , 0 , & Right ) ;
2011-04-01 17:36:44 +00:00
Right . HSplitTop ( 20.0f , & Button , & Right ) ;
2010-05-29 07:25:38 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClNameplates , Localize ( " Show name plates " ) , g_Config . m_ClNameplates , & Button ) )
g_Config . m_ClNameplates ^ = 1 ;
2008-08-27 15:48:50 +00:00
2011-01-04 12:11:01 +00:00
if ( g_Config . m_ClNameplates )
2008-08-27 15:48:50 +00:00
{
2011-04-01 17:36:44 +00:00
Right . HSplitTop ( 2.5f , 0 , & Right ) ;
Right . HSplitTop ( 20.0f , & Label , & Right ) ;
Right . HSplitTop ( 20.0f , & Button , & Right ) ;
str_format ( aBuf , sizeof ( aBuf ) , " %s: %i " , Localize ( " Name plates size " ) , g_Config . m_ClNameplatesSize ) ;
UI ( ) - > DoLabelScaled ( & Label , aBuf , 13.0f , - 1 ) ;
2011-01-04 12:11:01 +00:00
Button . HMargin ( 2.0f , & Button ) ;
g_Config . m_ClNameplatesSize = ( int ) ( DoScrollbarH ( & g_Config . m_ClNameplatesSize , & Button , g_Config . m_ClNameplatesSize / 100.0f ) * 100.0f + 0.1f ) ;
2011-04-01 17:36:44 +00:00
Right . HSplitTop ( 20.0f , & Button , & Right ) ;
if ( DoButton_CheckBox ( & g_Config . m_ClNameplatesTeamcolors , Localize ( " Use team colors for name plates " ) , g_Config . m_ClNameplatesTeamcolors , & Button ) )
g_Config . m_ClNameplatesTeamcolors ^ = 1 ;
2015-06-21 22:34:10 +00:00
Right . HSplitTop ( 5.0f , 0 , & Right ) ;
Right . HSplitTop ( 20.0f , & Button , & Right ) ;
if ( DoButton_CheckBox ( & g_Config . m_ClNameplatesClan , Localize ( " Show clan above name plates " ) , g_Config . m_ClNameplatesClan , & Button ) )
g_Config . m_ClNameplatesClan ^ = 1 ;
}
2015-06-29 00:06:27 +00:00
if ( g_Config . m_ClNameplatesClan )
{
Right . HSplitTop ( 2.5f , 0 , & Right ) ;
Right . HSplitTop ( 20.0f , & Label , & Right ) ;
Right . HSplitTop ( 20.0f , & Button , & Right ) ;
str_format ( aBuf , sizeof ( aBuf ) , " %s: %i " , Localize ( " Clan plates size " ) , g_Config . m_ClNameplatesClanSize ) ;
UI ( ) - > DoLabelScaled ( & Label , aBuf , 13.0f , - 1 ) ;
Button . HMargin ( 2.0f , & Button ) ;
g_Config . m_ClNameplatesClanSize = ( int ) ( DoScrollbarH ( & g_Config . m_ClNameplatesClanSize , & Button , g_Config . m_ClNameplatesClanSize / 100.0f ) * 100.0f + 0.1f ) ;
}
2011-03-16 20:31:55 +00:00
}
2010-05-29 07:25:38 +00:00
2011-04-01 17:36:44 +00:00
// client
2011-03-16 20:31:55 +00:00
{
2011-04-01 17:36:44 +00:00
// headline
Client . HSplitTop ( 30.0f , & Label , & Client ) ;
UI ( ) - > DoLabelScaled ( & Label , Localize ( " Client " ) , 20.0f , - 1 ) ;
Client . Margin ( 5.0f , & Client ) ;
Client . VSplitMid ( & Left , & Right ) ;
Left . VSplitRight ( 5.0f , & Left , 0 ) ;
Right . VMargin ( 5.0f , & Right ) ;
2010-05-29 07:25:38 +00:00
2020-09-03 12:08:26 +00:00
// skip main menu
Left . HSplitTop ( 5.0f , 0 , & Left ) ;
Left . HSplitTop ( 20.0f , & Button , & Left ) ;
if ( DoButton_CheckBox ( & g_Config . m_ClSkipStartMenu , Localize ( " Skip the main menu " ) , g_Config . m_ClSkipStartMenu , & Button ) )
2020-09-10 18:14:47 +00:00
g_Config . m_ClSkipStartMenu ^ = 1 ;
2020-09-03 12:08:26 +00:00
2011-04-01 17:36:44 +00:00
// auto demo settings
{
2020-09-03 12:08:26 +00:00
Left . HSplitTop ( 5.0f , 0 , & Left ) ;
2011-04-01 17:36:44 +00:00
Left . HSplitTop ( 20.0f , & Button , & Left ) ;
if ( DoButton_CheckBox ( & g_Config . m_ClAutoDemoRecord , Localize ( " Automatically record demos " ) , g_Config . m_ClAutoDemoRecord , & Button ) )
g_Config . m_ClAutoDemoRecord ^ = 1 ;
Right . HSplitTop ( 20.0f , & Button , & Right ) ;
2015-07-01 14:45:41 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClAutoScreenshot , Localize ( " Automatically take game over screenshot " ) , g_Config . m_ClAutoScreenshot , & Button ) )
2011-04-01 17:36:44 +00:00
g_Config . m_ClAutoScreenshot ^ = 1 ;
Left . HSplitTop ( 10.0f , 0 , & Left ) ;
Left . HSplitTop ( 20.0f , & Label , & Left ) ;
Button . VSplitRight ( 20.0f , & Button , 0 ) ;
char aBuf [ 64 ] ;
if ( g_Config . m_ClAutoDemoMax )
str_format ( aBuf , sizeof ( aBuf ) , " %s: %i " , Localize ( " Max demos " ) , g_Config . m_ClAutoDemoMax ) ;
else
2017-10-20 20:45:12 +00:00
str_format ( aBuf , sizeof ( aBuf ) , " %s: %s " , Localize ( " Max demos " ) , " ∞ " ) ;
2011-04-01 17:36:44 +00:00
UI ( ) - > DoLabelScaled ( & Label , aBuf , 13.0f , - 1 ) ;
Left . HSplitTop ( 20.0f , & Button , 0 ) ;
Button . HMargin ( 2.0f , & Button ) ;
g_Config . m_ClAutoDemoMax = static_cast < int > ( DoScrollbarH ( & g_Config . m_ClAutoDemoMax , & Button , g_Config . m_ClAutoDemoMax / 1000.0f ) * 1000.0f + 0.1f ) ;
Right . HSplitTop ( 10.0f , 0 , & Right ) ;
Right . HSplitTop ( 20.0f , & Label , & Right ) ;
Button . VSplitRight ( 20.0f , & Button , 0 ) ;
if ( g_Config . m_ClAutoScreenshotMax )
str_format ( aBuf , sizeof ( aBuf ) , " %s: %i " , Localize ( " Max Screenshots " ) , g_Config . m_ClAutoScreenshotMax ) ;
else
2017-10-20 20:45:12 +00:00
str_format ( aBuf , sizeof ( aBuf ) , " %s: %s " , Localize ( " Max Screenshots " ) , " ∞ " ) ;
2011-04-01 17:36:44 +00:00
UI ( ) - > DoLabelScaled ( & Label , aBuf , 13.0f , - 1 ) ;
Right . HSplitTop ( 20.0f , & Button , 0 ) ;
Button . HMargin ( 2.0f , & Button ) ;
g_Config . m_ClAutoScreenshotMax = static_cast < int > ( DoScrollbarH ( & g_Config . m_ClAutoScreenshotMax , & Button , g_Config . m_ClAutoScreenshotMax / 1000.0f ) * 1000.0f + 0.1f ) ;
}
2014-06-16 13:43:11 +00:00
Left . HSplitTop ( 20.0f , 0 , & Left ) ;
Left . HSplitTop ( 20.0f , & Label , & Left ) ;
Button . VSplitRight ( 20.0f , & Button , 0 ) ;
char aBuf [ 64 ] ;
2017-06-02 19:33:45 +00:00
if ( g_Config . m_ClRefreshRate )
str_format ( aBuf , sizeof ( aBuf ) , " %s: %i Hz " , Localize ( " Refresh Rate " ) , g_Config . m_ClRefreshRate ) ;
2014-06-16 13:43:11 +00:00
else
2017-10-20 20:45:12 +00:00
str_format ( aBuf , sizeof ( aBuf ) , " %s: %s " , Localize ( " Refresh Rate " ) , " ∞ " ) ;
2014-06-16 13:43:11 +00:00
UI ( ) - > DoLabelScaled ( & Label , aBuf , 13.0f , - 1 ) ;
Left . HSplitTop ( 20.0f , & Button , 0 ) ;
Button . HMargin ( 2.0f , & Button ) ;
2017-06-02 19:33:45 +00:00
g_Config . m_ClRefreshRate = static_cast < int > ( DoScrollbarH ( & g_Config . m_ClRefreshRate , & Button , g_Config . m_ClRefreshRate / 10000.0f ) * 10000.0f + 0.1f ) ;
2015-05-21 10:26:50 +00:00
2015-08-26 10:40:50 +00:00
# if defined(CONF_FAMILY_WINDOWS)
2015-08-27 23:18:45 +00:00
Left . HSplitTop ( 20.0f , 0 , & Left ) ;
2015-08-26 10:40:50 +00:00
Left . HSplitTop ( 20.0f , & Button , & Left ) ;
if ( DoButton_CheckBox ( & g_Config . m_ClShowConsole , Localize ( " Show console window " ) , g_Config . m_ClShowConsole , & Button ) )
2019-07-18 23:53:27 +00:00
{
2015-08-26 10:40:50 +00:00
g_Config . m_ClShowConsole ^ = 1 ;
2019-07-18 23:53:27 +00:00
CheckSettings = true ;
}
2019-07-19 00:06:33 +00:00
if ( CheckSettings )
m_NeedRestartGeneral = s_ClShowConsole ! = g_Config . m_ClShowConsole ;
2015-08-26 10:40:50 +00:00
# endif
2015-05-21 12:34:20 +00:00
// auto statboard screenshot
2015-05-21 10:26:50 +00:00
{
Right . HSplitTop ( 20.0f , 0 , & Right ) ; //
Right . HSplitTop ( 20.0f , 0 , & Right ) ; // Make some distance so it looks more natural
Right . HSplitTop ( 20.0f , & Button , & Right ) ;
if ( DoButton_CheckBox ( & g_Config . m_ClAutoStatboardScreenshot ,
2015-07-01 14:45:41 +00:00
Localize ( " Automatically take statboard screenshot " ) ,
2015-05-21 10:26:50 +00:00
g_Config . m_ClAutoStatboardScreenshot , & Button ) )
{
g_Config . m_ClAutoStatboardScreenshot ^ = 1 ;
}
Right . HSplitTop ( 10.0f , 0 , & Right ) ;
Right . HSplitTop ( 20.0f , & Label , & Right ) ;
Button . VSplitRight ( 20.0f , & Button , 0 ) ;
if ( g_Config . m_ClAutoStatboardScreenshotMax )
str_format ( aBuf , sizeof ( aBuf ) , " %s: %i " , Localize ( " Max Screenshots " ) , g_Config . m_ClAutoStatboardScreenshotMax ) ;
else
2017-10-20 20:45:12 +00:00
str_format ( aBuf , sizeof ( aBuf ) , " %s: %s " , Localize ( " Max Screenshots " ) , " ∞ " ) ;
2015-05-21 10:26:50 +00:00
UI ( ) - > DoLabelScaled ( & Label , aBuf , 13.0f , - 1 ) ;
Right . HSplitTop ( 20.0f , & Button , 0 ) ;
Button . HMargin ( 2.0f , & Button ) ;
g_Config . m_ClAutoStatboardScreenshotMax =
static_cast < int > ( DoScrollbarH ( & g_Config . m_ClAutoStatboardScreenshotMax ,
& Button ,
g_Config . m_ClAutoStatboardScreenshotMax / 1000.0f ) * 1000.0f + 0.1f ) ;
}
2017-04-26 03:10:31 +00:00
// auto statboard csv
{
Right . HSplitTop ( 20.0f , 0 , & Right ) ; //
Right . HSplitTop ( 20.0f , 0 , & Right ) ; // Make some distance so it looks more natural
Right . HSplitTop ( 20.0f , & Button , & Right ) ;
2018-03-13 20:59:07 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClAutoCSV ,
2017-04-26 03:10:31 +00:00
Localize ( " Automatically create statboard csv " ) ,
g_Config . m_ClAutoCSV , & Button ) )
{
g_Config . m_ClAutoCSV ^ = 1 ;
}
Right . HSplitTop ( 10.0f , 0 , & Right ) ;
Right . HSplitTop ( 20.0f , & Label , & Right ) ;
Button . VSplitRight ( 20.0f , & Button , 0 ) ;
2018-03-13 20:59:07 +00:00
if ( g_Config . m_ClAutoCSVMax )
2017-04-26 03:10:31 +00:00
str_format ( aBuf , sizeof ( aBuf ) , " %s: %i " , Localize ( " Max CSVs " ) , g_Config . m_ClAutoCSVMax ) ;
else
2017-10-20 20:45:12 +00:00
str_format ( aBuf , sizeof ( aBuf ) , " %s: %s " , Localize ( " Max CSVs " ) , " ∞ " ) ;
2017-04-26 03:10:31 +00:00
UI ( ) - > DoLabelScaled ( & Label , aBuf , 13.0f , - 1 ) ;
Right . HSplitTop ( 20.0f , & Button , 0 ) ;
Button . HMargin ( 2.0f , & Button ) ;
g_Config . m_ClAutoCSVMax =
static_cast < int > ( DoScrollbarH ( & g_Config . m_ClAutoCSVMax ,
& Button ,
g_Config . m_ClAutoCSVMax / 1000.0f ) * 1000.0f + 0.1f ) ;
}
2011-04-01 17:36:44 +00:00
}
2011-03-16 20:31:55 +00:00
}
2010-05-29 07:25:38 +00:00
2011-04-01 17:36:44 +00:00
void CMenus : : RenderSettingsPlayer ( CUIRect MainView )
2011-03-16 20:31:55 +00:00
{
2014-04-26 18:29:42 +00:00
CUIRect Button , Label , Dummy ;
2011-03-16 20:31:55 +00:00
MainView . HSplitTop ( 10.0f , 0 , & MainView ) ;
2008-08-27 15:48:50 +00:00
2020-08-20 10:19:03 +00:00
char * pName = g_Config . m_PlayerName ;
const char * pNameFallback = Client ( ) - > PlayerName ( ) ;
char * pClan = g_Config . m_PlayerClan ;
int * pCountry = & g_Config . m_PlayerCountry ;
2014-04-26 18:29:42 +00:00
2015-08-28 18:44:07 +00:00
if ( m_Dummy )
2014-04-26 18:29:42 +00:00
{
2020-08-20 10:19:03 +00:00
pName = g_Config . m_ClDummyName ;
2020-08-25 14:22:03 +00:00
pNameFallback = Client ( ) - > DummyName ( ) ;
2020-08-20 10:19:03 +00:00
pClan = g_Config . m_ClDummyClan ;
pCountry = & g_Config . m_ClDummyCountry ;
2014-04-26 18:29:42 +00:00
}
2011-03-16 20:31:55 +00:00
// player name
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
Button . VSplitLeft ( 80.0f , & Label , & Button ) ;
Button . VSplitLeft ( 150.0f , & Button , 0 ) ;
char aBuf [ 128 ] ;
str_format ( aBuf , sizeof ( aBuf ) , " %s: " , Localize ( " Name " ) ) ;
2019-07-08 21:06:26 +00:00
UI ( ) - > DoLabelScaled ( & Label , aBuf , 14.0f , - 1 ) ;
2011-03-16 20:31:55 +00:00
static float s_OffsetName = 0.0f ;
2020-08-20 10:19:03 +00:00
if ( DoEditBox ( pName , & Button , pName , sizeof ( g_Config . m_PlayerName ) , 14.0f , & s_OffsetName , false , CUI : : CORNER_ALL , pNameFallback ) )
2014-04-28 13:34:56 +00:00
{
2015-08-28 18:44:07 +00:00
if ( m_Dummy )
2014-04-28 13:19:57 +00:00
m_NeedSendDummyinfo = true ;
else
m_NeedSendinfo = true ;
2014-04-28 13:34:56 +00:00
}
2011-03-16 20:31:55 +00:00
// player clan
MainView . HSplitTop ( 5.0f , 0 , & MainView ) ;
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
Button . VSplitLeft ( 80.0f , & Label , & Button ) ;
2020-08-20 10:19:03 +00:00
Button . VSplitLeft ( 200.0f , & Button , & Dummy ) ;
2011-03-16 20:31:55 +00:00
Button . VSplitLeft ( 150.0f , & Button , 0 ) ;
str_format ( aBuf , sizeof ( aBuf ) , " %s: " , Localize ( " Clan " ) ) ;
2019-07-08 21:06:26 +00:00
UI ( ) - > DoLabelScaled ( & Label , aBuf , 14.0f , - 1 ) ;
2011-03-16 20:31:55 +00:00
static float s_OffsetClan = 0.0f ;
2020-08-20 10:19:03 +00:00
if ( DoEditBox ( pClan , & Button , pClan , sizeof ( g_Config . m_PlayerClan ) , 14.0f , & s_OffsetClan ) )
2014-04-28 13:34:56 +00:00
{
2015-08-28 18:44:07 +00:00
if ( m_Dummy )
2014-04-28 13:19:57 +00:00
m_NeedSendDummyinfo = true ;
else
m_NeedSendinfo = true ;
2014-04-28 13:34:56 +00:00
}
2011-03-16 20:31:55 +00:00
2020-08-20 10:19:03 +00:00
if ( DoButton_CheckBox ( & m_Dummy , Localize ( " Dummy settings " ) , m_Dummy , & Dummy ) )
{
m_Dummy ^ = 1 ;
}
2018-02-13 02:44:43 +00:00
static bool s_ListBoxUsed = false ;
2020-08-20 10:19:03 +00:00
if ( UI ( ) - > ActiveItem ( ) = = pClan | | UI ( ) - > ActiveItem ( ) = = pName )
2018-02-13 02:44:43 +00:00
s_ListBoxUsed = false ;
2011-03-16 20:31:55 +00:00
// country flag selector
MainView . HSplitTop ( 20.0f , 0 , & MainView ) ;
static float s_ScrollValue = 0.0f ;
int OldSelected = - 1 ;
2020-08-23 17:40:17 +00:00
UiDoListboxStart ( & s_ScrollValue , & MainView , 50.0f , Localize ( " Country / Region " ) , " " , m_pClient - > m_pCountryFlags - > Num ( ) , 6 , OldSelected , s_ScrollValue ) ;
2010-05-29 07:25:38 +00:00
2011-03-16 20:31:55 +00:00
for ( int i = 0 ; i < m_pClient - > m_pCountryFlags - > Num ( ) ; + + i )
{
2011-06-29 20:27:32 +00:00
const CCountryFlags : : CCountryFlag * pEntry = m_pClient - > m_pCountryFlags - > GetByIndex ( i ) ;
2020-08-20 10:19:03 +00:00
if ( pEntry - > m_CountryCode = = * pCountry )
2011-03-16 20:31:55 +00:00
OldSelected = i ;
2010-05-29 07:25:38 +00:00
2018-02-13 02:44:43 +00:00
CListboxItem Item = UiDoListboxNextItem ( & pEntry - > m_CountryCode , OldSelected = = i , s_ListBoxUsed ) ;
2011-03-16 20:31:55 +00:00
if ( Item . m_Visible )
2008-08-27 15:48:50 +00:00
{
2011-07-31 00:04:46 +00:00
CUIRect Label ;
Item . m_Rect . Margin ( 5.0f , & Item . m_Rect ) ;
Item . m_Rect . HSplitBottom ( 10.0f , & Item . m_Rect , & Label ) ;
2011-03-16 20:31:55 +00:00
float OldWidth = Item . m_Rect . w ;
2011-04-04 18:37:12 +00:00
Item . m_Rect . w = Item . m_Rect . h * 2 ;
2011-03-16 20:31:55 +00:00
Item . m_Rect . x + = ( OldWidth - Item . m_Rect . w ) / 2.0f ;
2019-04-26 21:47:34 +00:00
ColorRGBA Color ( 1.0f , 1.0f , 1.0f , 1.0f ) ;
2012-01-08 17:16:38 +00:00
m_pClient - > m_pCountryFlags - > Render ( pEntry - > m_CountryCode , & Color , Item . m_Rect . x , Item . m_Rect . y , Item . m_Rect . w , Item . m_Rect . h ) ;
if ( pEntry - > m_Texture ! = - 1 )
UI ( ) - > DoLabel ( & Label , pEntry - > m_aCountryCodeString , 10.0f , 0 ) ;
2008-08-27 15:48:50 +00:00
}
2011-03-16 20:31:55 +00:00
}
2010-05-29 07:25:38 +00:00
2018-02-13 02:44:43 +00:00
bool Clicked = false ;
const int NewSelected = UiDoListboxEnd ( & s_ScrollValue , 0 , & Clicked ) ;
if ( Clicked )
s_ListBoxUsed = true ;
2011-03-16 20:31:55 +00:00
if ( OldSelected ! = NewSelected )
{
2020-08-20 10:19:03 +00:00
* pCountry = m_pClient - > m_pCountryFlags - > GetByIndex ( NewSelected ) - > m_CountryCode ;
2015-08-28 18:44:07 +00:00
if ( m_Dummy )
2014-04-28 13:19:57 +00:00
m_NeedSendDummyinfo = true ;
else
m_NeedSendinfo = true ;
2011-03-16 20:31:55 +00:00
}
}
2010-05-29 07:25:38 +00:00
2011-04-01 17:36:44 +00:00
void CMenus : : RenderSettingsTee ( CUIRect MainView )
2011-03-16 20:31:55 +00:00
{
2018-07-24 15:26:39 +00:00
CUIRect Button , Label , Button2 , Dummy , DummyLabel , SkinList , QuickSearch , QuickSearchClearButton , SkinPrefix , SkinPrefixLabel ;
2016-05-07 13:59:58 +00:00
2018-07-24 15:26:39 +00:00
static float s_ClSkinPrefix = 0.0f ;
2016-05-07 13:59:58 +00:00
2013-12-26 17:02:37 +00:00
static bool s_InitSkinlist = true ;
2011-03-16 20:31:55 +00:00
MainView . HSplitTop ( 10.0f , 0 , & MainView ) ;
2010-05-29 07:25:38 +00:00
2015-08-06 20:16:33 +00:00
char * Skin = g_Config . m_ClPlayerSkin ;
int * UseCustomColor = & g_Config . m_ClPlayerUseCustomColor ;
2019-05-15 16:05:19 +00:00
unsigned * ColorBody = & g_Config . m_ClPlayerColorBody ;
unsigned * ColorFeet = & g_Config . m_ClPlayerColorFeet ;
2014-04-26 18:29:42 +00:00
2015-08-28 18:44:07 +00:00
if ( m_Dummy )
2014-04-26 18:29:42 +00:00
{
2015-08-06 20:16:33 +00:00
Skin = g_Config . m_ClDummySkin ;
UseCustomColor = & g_Config . m_ClDummyUseCustomColor ;
ColorBody = & g_Config . m_ClDummyColorBody ;
ColorFeet = & g_Config . m_ClDummyColorFeet ;
2014-04-26 18:29:42 +00:00
}
2011-03-16 20:31:55 +00:00
// skin info
2014-04-26 18:29:42 +00:00
const CSkins : : CSkin * pOwnSkin = m_pClient - > m_pSkins - > Get ( m_pClient - > m_pSkins - > Find ( Skin ) ) ;
2011-03-16 20:31:55 +00:00
CTeeRenderInfo OwnSkinInfo ;
2014-04-26 18:29:42 +00:00
if ( * UseCustomColor )
2011-03-16 20:31:55 +00:00
{
OwnSkinInfo . m_Texture = pOwnSkin - > m_ColorTexture ;
2020-06-18 16:59:21 +00:00
OwnSkinInfo . m_ColorBody = color_cast < ColorRGBA > ( ColorHSLA ( * ColorBody ) . UnclampLighting ( ) ) ;
OwnSkinInfo . m_ColorFeet = color_cast < ColorRGBA > ( ColorHSLA ( * ColorFeet ) . UnclampLighting ( ) ) ;
2011-03-16 20:31:55 +00:00
}
else
{
OwnSkinInfo . m_Texture = pOwnSkin - > m_OrgTexture ;
2019-04-26 12:06:32 +00:00
OwnSkinInfo . m_ColorBody = ColorRGBA ( 1.0f , 1.0f , 1.0f ) ;
OwnSkinInfo . m_ColorFeet = ColorRGBA ( 1.0f , 1.0f , 1.0f ) ;
2011-03-16 20:31:55 +00:00
}
OwnSkinInfo . m_Size = 50.0f * UI ( ) - > Scale ( ) ;
2010-05-29 07:25:38 +00:00
2011-03-16 20:31:55 +00:00
MainView . HSplitTop ( 20.0f , & Label , & MainView ) ;
2014-04-26 18:29:42 +00:00
Label . VSplitLeft ( 280.0f , & Label , & Dummy ) ;
2011-03-16 20:31:55 +00:00
Label . VSplitLeft ( 230.0f , & Label , 0 ) ;
2018-12-23 21:56:45 +00:00
Dummy . VSplitLeft ( 170.0f , & Dummy , & SkinPrefix ) ;
SkinPrefix . VSplitLeft ( 120.0f , & SkinPrefix , 0 ) ;
2011-03-16 20:31:55 +00:00
char aBuf [ 128 ] ;
str_format ( aBuf , sizeof ( aBuf ) , " %s: " , Localize ( " Your skin " ) ) ;
UI ( ) - > DoLabelScaled ( & Label , aBuf , 14.0f , - 1 ) ;
2014-08-17 03:34:16 +00:00
Dummy . HSplitTop ( 20.0f , & DummyLabel , & Dummy ) ;
2018-07-06 09:24:57 +00:00
if ( DoButton_CheckBox ( & m_Dummy , Localize ( " Dummy settings " ) , m_Dummy , & DummyLabel ) )
2014-04-26 18:29:42 +00:00
{
2015-08-28 18:44:07 +00:00
m_Dummy ^ = 1 ;
2014-04-26 18:29:42 +00:00
}
2014-08-17 03:34:16 +00:00
Dummy . HSplitTop ( 20.0f , & DummyLabel , & Dummy ) ;
2017-07-24 21:48:26 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClVanillaSkinsOnly , Localize ( " Vanilla skins only " ) , g_Config . m_ClVanillaSkinsOnly , & DummyLabel ) )
2014-08-17 03:34:16 +00:00
{
2015-08-28 18:44:07 +00:00
g_Config . m_ClVanillaSkinsOnly ^ = 1 ;
2018-07-25 12:13:07 +00:00
s_InitSkinlist = true ;
2016-05-07 13:59:58 +00:00
}
2017-07-24 21:48:26 +00:00
Dummy . HSplitTop ( 20.0f , & DummyLabel , & Dummy ) ;
2018-07-24 15:26:39 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClFatSkins , Localize ( " Fat skins (DDFat) " ) , g_Config . m_ClFatSkins , & DummyLabel ) )
2017-07-24 21:48:26 +00:00
{
g_Config . m_ClFatSkins ^ = 1 ;
}
2018-07-25 06:16:57 +00:00
2018-07-24 15:26:39 +00:00
SkinPrefix . HSplitTop ( 20.0f , & SkinPrefixLabel , & SkinPrefix ) ;
2018-07-25 06:16:57 +00:00
UI ( ) - > DoLabelScaled ( & SkinPrefixLabel , Localize ( " Skin prefix " ) , 14.0f , - 1 ) ;
2018-07-24 15:26:39 +00:00
SkinPrefix . HSplitTop ( 20.0f , & SkinPrefixLabel , & SkinPrefix ) ;
2018-09-20 05:48:14 +00:00
{
static int s_ClearButton = 0 ;
DoClearableEditBox ( g_Config . m_ClSkinPrefix , & s_ClearButton , & SkinPrefixLabel , g_Config . m_ClSkinPrefix , sizeof ( g_Config . m_ClSkinPrefix ) , 14.0f , & s_ClSkinPrefix ) ;
}
2017-07-24 21:48:26 +00:00
2018-07-25 06:16:57 +00:00
SkinPrefix . HSplitTop ( 2.0f , 0 , & SkinPrefix ) ;
{
2020-08-08 11:02:59 +00:00
static const char * s_aSkinPrefixes [ ] = { " kitty " , " santa " } ;
2018-07-25 06:16:57 +00:00
for ( unsigned i = 0 ; i < sizeof ( s_aSkinPrefixes ) / sizeof ( s_aSkinPrefixes [ 0 ] ) ; i + + )
{
const char * pPrefix = s_aSkinPrefixes [ i ] ;
CUIRect Button ;
2018-09-20 05:50:17 +00:00
SkinPrefix . HSplitTop ( 20.0f , & Button , & SkinPrefix ) ;
2018-07-25 06:16:57 +00:00
Button . HMargin ( 2.0f , & Button ) ;
2018-09-20 05:48:14 +00:00
if ( DoButton_Menu ( & s_aSkinPrefixes [ i ] , pPrefix , 0 , & Button ) )
2018-07-25 06:16:57 +00:00
{
2018-09-20 05:48:14 +00:00
str_copy ( g_Config . m_ClSkinPrefix , pPrefix , sizeof ( g_Config . m_ClSkinPrefix ) ) ;
2018-07-25 06:16:57 +00:00
}
}
}
2017-07-24 21:48:26 +00:00
2014-08-17 03:34:16 +00:00
Dummy . HSplitTop ( 20.0f , & DummyLabel , & Dummy ) ;
2011-03-16 20:31:55 +00:00
MainView . HSplitTop ( 50.0f , & Label , & MainView ) ;
Label . VSplitLeft ( 230.0f , & Label , 0 ) ;
2019-04-26 21:47:34 +00:00
RenderTools ( ) - > DrawUIRect ( & Label , ColorRGBA ( 1.0f , 1.0f , 1.0f , 0.25f ) , CUI : : CORNER_ALL , 10.0f ) ;
2011-03-16 20:31:55 +00:00
RenderTools ( ) - > RenderTee ( CAnimState : : GetIdle ( ) , & OwnSkinInfo , 0 , vec2 ( 1 , 0 ) , vec2 ( Label . x + 30.0f , Label . y + 28.0f ) ) ;
Label . VSplitLeft ( 70.0f , 0 , & Label ) ;
2014-04-26 18:29:42 +00:00
UI ( ) - > DoLabelScaled ( & Label , Skin , 14.0f , - 1 , 150.0f ) ;
2011-03-16 20:31:55 +00:00
// custom colour selector
MainView . HSplitTop ( 20.0f , 0 , & MainView ) ;
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
2013-12-26 17:02:37 +00:00
Button . VSplitMid ( & Button , & Button2 ) ;
2014-04-26 18:29:42 +00:00
if ( DoButton_CheckBox ( & ColorBody , Localize ( " Custom colors " ) , * UseCustomColor , & Button ) )
2011-03-16 20:31:55 +00:00
{
2014-04-26 18:29:42 +00:00
* UseCustomColor = * UseCustomColor ? 0 : 1 ;
2015-08-28 18:44:07 +00:00
if ( m_Dummy )
2014-04-28 13:19:57 +00:00
m_NeedSendDummyinfo = true ;
else
m_NeedSendinfo = true ;
2011-03-16 20:31:55 +00:00
}
2010-05-29 07:25:38 +00:00
2011-03-16 20:31:55 +00:00
MainView . HSplitTop ( 5.0f , 0 , & MainView ) ;
MainView . HSplitTop ( 82.5f , & Label , & MainView ) ;
2014-04-26 18:29:42 +00:00
if ( * UseCustomColor )
2011-03-16 20:31:55 +00:00
{
CUIRect aRects [ 2 ] ;
Label . VSplitMid ( & aRects [ 0 ] , & aRects [ 1 ] ) ;
aRects [ 0 ] . VSplitRight ( 10.0f , & aRects [ 0 ] , 0 ) ;
aRects [ 1 ] . VSplitLeft ( 10.0f , 0 , & aRects [ 1 ] ) ;
2010-05-29 07:25:38 +00:00
2020-06-27 13:08:35 +00:00
unsigned * paColors [ 2 ] = { ColorBody , ColorFeet } ;
const char * paParts [ ] = { Localize ( " Body " ) , Localize ( " Feet " ) } ;
2010-05-29 07:25:38 +00:00
2011-03-16 20:31:55 +00:00
for ( int i = 0 ; i < 2 ; i + + )
2008-08-27 15:48:50 +00:00
{
2011-03-16 20:31:55 +00:00
aRects [ i ] . HSplitTop ( 20.0f , & Label , & aRects [ i ] ) ;
UI ( ) - > DoLabelScaled ( & Label , paParts [ i ] , 14.0f , - 1 ) ;
2020-06-27 13:08:35 +00:00
aRects [ i ] . VSplitLeft ( 10.0f , 0 , & aRects [ i ] ) ;
2011-03-16 20:31:55 +00:00
aRects [ i ] . HSplitTop ( 2.5f , 0 , & aRects [ i ] ) ;
2020-06-27 13:08:35 +00:00
unsigned PrevColor = * paColors [ i ] ;
RenderHSLScrollbars ( & aRects [ i ] , paColors [ i ] ) ;
2010-05-29 07:25:38 +00:00
2020-06-27 13:08:35 +00:00
if ( PrevColor ! = * paColors [ i ] )
2014-04-28 13:19:57 +00:00
{
2015-08-28 18:44:07 +00:00
if ( m_Dummy )
2014-04-28 13:19:57 +00:00
m_NeedSendDummyinfo = true ;
else
m_NeedSendinfo = true ;
}
2010-05-29 07:25:38 +00:00
}
2011-03-16 20:31:55 +00:00
}
2009-10-27 14:38:53 +00:00
2011-03-16 20:31:55 +00:00
// skin selector
MainView . HSplitTop ( 20.0f , 0 , & MainView ) ;
2016-02-12 17:52:10 +00:00
MainView . HSplitTop ( 230.0f , & SkinList , & MainView ) ;
2011-03-16 20:31:55 +00:00
static sorted_array < const CSkins : : CSkin * > s_paSkinList ;
static float s_ScrollValue = 0.0f ;
if ( s_InitSkinlist )
{
s_paSkinList . clear ( ) ;
for ( int i = 0 ; i < m_pClient - > m_pSkins - > Num ( ) ; + + i )
2009-10-27 14:38:53 +00:00
{
2011-03-16 20:31:55 +00:00
const CSkins : : CSkin * s = m_pClient - > m_pSkins - > Get ( i ) ;
2016-02-12 17:52:10 +00:00
// filter quick search
2016-02-14 18:51:49 +00:00
if ( g_Config . m_ClSkinFilterString [ 0 ] ! = ' \0 ' & & ! str_find_nocase ( s - > m_aName , g_Config . m_ClSkinFilterString ) )
2016-02-12 17:52:10 +00:00
continue ;
2011-03-16 20:31:55 +00:00
// no special skins
2014-11-07 01:20:36 +00:00
if ( ( s - > m_aName [ 0 ] = = ' x ' & & s - > m_aName [ 1 ] = = ' _ ' ) )
2010-05-29 07:25:38 +00:00
continue ;
2016-02-12 17:52:10 +00:00
2018-07-25 12:13:07 +00:00
// vanilla skins only
if ( g_Config . m_ClVanillaSkinsOnly & & ! s - > m_IsVanilla )
continue ;
2011-03-16 20:31:55 +00:00
s_paSkinList . add ( s ) ;
}
s_InitSkinlist = false ;
}
2010-05-29 07:25:38 +00:00
2011-03-16 20:31:55 +00:00
int OldSelected = - 1 ;
2016-02-12 17:52:10 +00:00
UiDoListboxStart ( & s_InitSkinlist , & SkinList , 50.0f , Localize ( " Skins " ) , " " , s_paSkinList . size ( ) , 4 , OldSelected , s_ScrollValue ) ;
2011-03-16 20:31:55 +00:00
for ( int i = 0 ; i < s_paSkinList . size ( ) ; + + i )
{
const CSkins : : CSkin * s = s_paSkinList [ i ] ;
if ( s = = 0 )
continue ;
2010-05-29 07:25:38 +00:00
2014-04-26 18:29:42 +00:00
if ( str_comp ( s - > m_aName , Skin ) = = 0 )
2011-03-16 20:31:55 +00:00
OldSelected = i ;
2010-05-29 07:25:38 +00:00
2011-03-16 20:31:55 +00:00
CListboxItem Item = UiDoListboxNextItem ( & s_paSkinList [ i ] , OldSelected = = i ) ;
2014-10-05 20:26:47 +00:00
char aBuf [ 128 ] ;
2011-03-16 20:31:55 +00:00
if ( Item . m_Visible )
2008-08-27 15:48:50 +00:00
{
2019-05-09 22:25:48 +00:00
CTeeRenderInfo Info = OwnSkinInfo ;
Info . m_Texture = * UseCustomColor ? s - > m_ColorTexture : s - > m_OrgTexture ;
2011-03-16 20:31:55 +00:00
Item . m_Rect . HSplitTop ( 5.0f , 0 , & Item . m_Rect ) ; // some margin from the top
2019-05-09 22:25:48 +00:00
RenderTools ( ) - > RenderTee ( CAnimState : : GetIdle ( ) , & Info , 0 , vec2 ( 1.0f , 0.0f ) , vec2 ( Item . m_Rect . x + 30 , Item . m_Rect . y + Item . m_Rect . h / 2 ) ) ;
2010-05-29 07:25:38 +00:00
2014-10-05 20:26:47 +00:00
Item . m_Rect . VSplitLeft ( 60.0f , 0 , & Item . m_Rect ) ;
str_format ( aBuf , sizeof ( aBuf ) , " %s " , s - > m_aName ) ;
RenderTools ( ) - > UI ( ) - > DoLabelScaled ( & Item . m_Rect , aBuf , 12.0f , - 1 , Item . m_Rect . w ) ;
2011-03-16 20:31:55 +00:00
if ( g_Config . m_Debug )
2009-10-27 14:38:53 +00:00
{
2019-04-26 12:06:32 +00:00
ColorRGBA BloodColor = * UseCustomColor ? color_cast < ColorRGBA > ( ColorHSLA ( * ColorBody ) ) : s - > m_BloodColor ;
2012-08-12 10:41:50 +00:00
Graphics ( ) - > TextureClear ( ) ;
2011-03-16 20:31:55 +00:00
Graphics ( ) - > QuadsBegin ( ) ;
Graphics ( ) - > SetColor ( BloodColor . r , BloodColor . g , BloodColor . b , 1.0f ) ;
IGraphics : : CQuadItem QuadItem ( Item . m_Rect . x , Item . m_Rect . y , 12.0f , 12.0f ) ;
Graphics ( ) - > QuadsDrawTL ( & QuadItem , 1 ) ;
Graphics ( ) - > QuadsEnd ( ) ;
2009-10-27 14:38:53 +00:00
}
2008-08-27 15:48:50 +00:00
}
2010-05-29 07:25:38 +00:00
}
2008-10-20 23:38:23 +00:00
2011-03-16 20:31:55 +00:00
const int NewSelected = UiDoListboxEnd ( & s_ScrollValue , 0 ) ;
if ( OldSelected ! = NewSelected )
{
2015-08-06 20:16:33 +00:00
mem_copy ( Skin , s_paSkinList [ NewSelected ] - > m_aName , sizeof ( g_Config . m_ClPlayerSkin ) ) ;
2015-08-28 18:44:07 +00:00
if ( m_Dummy )
2014-04-28 13:19:57 +00:00
m_NeedSendDummyinfo = true ;
else
m_NeedSendinfo = true ;
2010-05-29 07:25:38 +00:00
}
2016-02-12 17:52:10 +00:00
// render quick search
{
MainView . HSplitBottom ( ms_ButtonHeight , & MainView , & QuickSearch ) ;
QuickSearch . VSplitLeft ( 240.0f , & QuickSearch , 0 ) ;
QuickSearch . HSplitTop ( 5.0f , 0 , & QuickSearch ) ;
2018-03-13 20:59:07 +00:00
const char * pSearchLabel = " \xEE \xA2 \xB6 " ;
TextRender ( ) - > SetCurFont ( TextRender ( ) - > GetFont ( TEXT_FONT_ICON_FONT ) ) ;
2019-01-06 05:42:57 +00:00
TextRender ( ) - > SetRenderFlags ( ETextRenderFlags : : TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags : : TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags : : TEXT_RENDER_FLAG_NO_Y_BEARING | ETextRenderFlags : : TEXT_RENDER_FLAG_NO_OVERSIZE ) ;
2016-02-12 17:52:10 +00:00
UI ( ) - > DoLabelScaled ( & QuickSearch , pSearchLabel , 14.0f , - 1 ) ;
2020-07-15 19:10:13 +00:00
float wSearch = TextRender ( ) - > TextWidth ( 0 , 14.0f , pSearchLabel , - 1 , - 1.0f ) ;
2018-03-13 20:59:07 +00:00
TextRender ( ) - > SetRenderFlags ( 0 ) ;
TextRender ( ) - > SetCurFont ( NULL ) ;
2016-02-12 17:52:10 +00:00
QuickSearch . VSplitLeft ( wSearch , 0 , & QuickSearch ) ;
QuickSearch . VSplitLeft ( 5.0f , 0 , & QuickSearch ) ;
QuickSearch . VSplitLeft ( QuickSearch . w - 15.0f , & QuickSearch , & QuickSearchClearButton ) ;
2018-09-20 05:43:05 +00:00
static int s_ClearButton = 0 ;
2016-02-12 17:52:10 +00:00
static float Offset = 0.0f ;
2017-07-24 16:05:19 +00:00
if ( Input ( ) - > KeyPress ( KEY_F ) & & ( Input ( ) - > KeyIsPressed ( KEY_LCTRL ) | | Input ( ) - > KeyIsPressed ( KEY_RCTRL ) ) )
UI ( ) - > SetActiveItem ( & g_Config . m_ClSkinFilterString ) ;
2018-09-20 05:43:05 +00:00
if ( DoClearableEditBox ( & g_Config . m_ClSkinFilterString , & s_ClearButton , & QuickSearch , g_Config . m_ClSkinFilterString , sizeof ( g_Config . m_ClSkinFilterString ) , 14.0f , & Offset , false , CUI : : CORNER_ALL , Localize ( " Search " ) ) )
2016-02-12 17:52:10 +00:00
s_InitSkinlist = true ;
}
2008-08-27 15:48:50 +00:00
}
2011-04-01 17:36:44 +00:00
2010-05-29 07:25:38 +00:00
typedef void ( * pfnAssignFuncCallback ) ( CConfiguration * pConfig , int Value ) ;
2008-08-27 15:48:50 +00:00
2010-05-29 07:25:38 +00:00
typedef struct
2008-10-05 18:27:20 +00:00
{
2010-05-29 07:25:38 +00:00
CLocConstString m_Name ;
const char * m_pCommand ;
int m_KeyId ;
2019-04-28 13:32:14 +00:00
int m_Modifier ;
2010-05-29 07:25:38 +00:00
} CKeyInfo ;
2008-10-05 18:27:20 +00:00
2010-05-29 07:25:38 +00:00
static CKeyInfo gs_aKeys [ ] =
2008-08-27 15:48:50 +00:00
{
2019-04-28 13:32:14 +00:00
{ " Move left " , " +left " , 0 , 0 } , // Localize - these strings are localized within CLocConstString
{ " Move right " , " +right " , 0 , 0 } ,
{ " Jump " , " +jump " , 0 , 0 } ,
{ " Fire " , " +fire " , 0 , 0 } ,
{ " Hook " , " +hook " , 0 , 0 } ,
{ " Hook collisions " , " +showhookcoll " , 0 , 0 } ,
{ " Pause " , " say /pause " , 0 , 0 } ,
{ " Kill " , " kill " , 0 , 0 } ,
{ " Zoom in " , " zoom+ " , 0 , 0 } ,
{ " Zoom out " , " zoom- " , 0 , 0 } ,
{ " Default zoom " , " zoom " , 0 , 0 } ,
{ " Show others " , " say /showothers " , 0 , 0 } ,
{ " Show all " , " say /showall " , 0 , 0 } ,
{ " Toggle dyncam " , " toggle cl_dyncam 0 1 " , 0 , 0 } ,
{ " Toggle dummy " , " toggle cl_dummy 0 1 " , 0 , 0 } ,
{ " Toggle ghost " , " toggle cl_race_show_ghost 0 1 " , 0 , 0 } ,
{ " Dummy copy " , " toggle cl_dummy_copy_moves 0 1 " , 0 , 0 } ,
{ " Hammerfly dummy " , " toggle cl_dummy_hammer 0 1 " , 0 , 0 } ,
{ " Hammer " , " +weapon1 " , 0 , 0 } ,
{ " Pistol " , " +weapon2 " , 0 , 0 } ,
{ " Shotgun " , " +weapon3 " , 0 , 0 } ,
{ " Grenade " , " +weapon4 " , 0 , 0 } ,
2019-11-22 14:37:18 +00:00
{ " Laser " , " +weapon5 " , 0 , 0 } ,
2019-04-28 13:32:14 +00:00
{ " Next weapon " , " +nextweapon " , 0 , 0 } ,
{ " Prev. weapon " , " +prevweapon " , 0 , 0 } ,
{ " Vote yes " , " vote yes " , 0 , 0 } ,
{ " Vote no " , " vote no " , 0 , 0 } ,
{ " Chat " , " +show_chat; chat all " , 0 , 0 } ,
{ " Team chat " , " +show_chat; chat team " , 0 , 0 } ,
{ " Converse " , " +show_chat; chat all /c " , 0 , 0 } ,
{ " Show chat " , " +show_chat " , 0 , 0 } ,
{ " Emoticon " , " +emote " , 0 , 0 } ,
{ " Spectator mode " , " +spectate " , 0 , 0 } ,
{ " Spectate next " , " spectate_next " , 0 , 0 } ,
{ " Spectate previous " , " spectate_previous " , 0 , 0 } ,
{ " Console " , " toggle_local_console " , 0 , 0 } ,
{ " Remote console " , " toggle_remote_console " , 0 , 0 } ,
{ " Screenshot " , " screenshot " , 0 , 0 } ,
{ " Scoreboard " , " +scoreboard " , 0 , 0 } ,
{ " Statboard " , " +statboard " , 0 , 0 } ,
{ " Lock team " , " say /lock " , 0 , 0 } ,
{ " Show entities " , " toggle cl_overlay_entities 0 100 " , 0 , 0 } ,
{ " Show HUD " , " toggle cl_showhud 0 1 " , 0 , 0 } ,
2008-10-05 18:27:20 +00:00
} ;
2011-04-06 19:15:58 +00:00
2019-12-02 08:08:56 +00:00
/* This is for scripts/languages to work, don't remove!
Localize ( " Move left " ) ; Localize ( " Move right " ) ; Localize ( " Jump " ) ; Localize ( " Fire " ) ; Localize ( " Hook " ) ;
Localize ( " Hook collisions " ) ; Localize ( " Pause " ) ; Localize ( " Kill " ) ; Localize ( " Zoom in " ) ; Localize ( " Zoom out " ) ;
Localize ( " Default zoom " ) ; Localize ( " Show others " ) ; Localize ( " Show all " ) ; Localize ( " Toggle dyncam " ) ;
Localize ( " Toggle dummy " ) ; Localize ( " Toggle ghost " ) ; Localize ( " Dummy copy " ) ; Localize ( " Hammerfly dummy " ) ;
Localize ( " Hammer " ) ; Localize ( " Pistol " ) ; Localize ( " Shotgun " ) ; Localize ( " Grenade " ) ; Localize ( " Laser " ) ;
Localize ( " Next weapon " ) ; Localize ( " Prev. weapon " ) ; Localize ( " Vote yes " ) ; Localize ( " Vote no " ) ;
Localize ( " Chat " ) ; Localize ( " Team chat " ) ; Localize ( " Converse " ) ; Localize ( " Show chat " ) ; Localize ( " Emoticon " ) ;
Localize ( " Spectator mode " ) ; Localize ( " Spectate next " ) ; Localize ( " Spectate previous " ) ; Localize ( " Console " ) ;
Localize ( " Remote console " ) ; Localize ( " Screenshot " ) ; Localize ( " Scoreboard " ) ; Localize ( " Statboard " ) ;
Localize ( " Lock team " ) ; Localize ( " Show entities " ) ; Localize ( " Show HUD " ) ;
2010-08-08 22:35:37 +00:00
*/
2008-10-05 18:27:20 +00:00
2010-05-29 07:25:38 +00:00
const int g_KeyCount = sizeof ( gs_aKeys ) / sizeof ( CKeyInfo ) ;
2008-08-27 15:48:50 +00:00
2017-07-22 15:35:30 +00:00
void CMenus : : UiDoGetButtons ( int Start , int Stop , CUIRect View , CUIRect ScopeView )
2008-10-05 18:27:20 +00:00
{
2017-07-22 15:35:30 +00:00
for ( int i = Start ; i < Stop ; i + + )
2008-08-27 15:48:50 +00:00
{
2010-05-29 07:25:38 +00:00
CKeyInfo & Key = gs_aKeys [ i ] ;
CUIRect Button , Label ;
View . HSplitTop ( 20.0f , & Button , & View ) ;
2011-04-01 15:57:04 +00:00
Button . VSplitLeft ( 135.0f , & Label , & Button ) ;
2010-05-29 07:25:38 +00:00
2017-07-22 20:43:20 +00:00
if ( Button . y > = ScopeView . y & & Button . y + Button . h < = ScopeView . y + ScopeView . h )
2008-10-05 18:27:20 +00:00
{
2017-07-22 20:43:20 +00:00
char aBuf [ 64 ] ;
str_format ( aBuf , sizeof ( aBuf ) , " %s: " , ( const char * ) Key . m_Name ) ;
UI ( ) - > DoLabelScaled ( & Label , aBuf , 13.0f , - 1 ) ;
2019-04-28 17:22:19 +00:00
int OldId = Key . m_KeyId , OldModifier = Key . m_Modifier , NewModifier ;
int NewId = DoKeyReader ( ( void * ) & gs_aKeys [ i ] . m_Name , & Button , OldId , OldModifier , & NewModifier ) ;
if ( NewId ! = OldId | | NewModifier ! = OldModifier )
2017-07-22 20:43:20 +00:00
{
if ( OldId ! = 0 | | NewId = = 0 )
2019-04-28 17:22:19 +00:00
m_pClient - > m_pBinds - > Bind ( OldId , " " , false , OldModifier ) ;
2017-07-22 20:43:20 +00:00
if ( NewId ! = 0 )
2019-04-28 17:22:19 +00:00
m_pClient - > m_pBinds - > Bind ( NewId , gs_aKeys [ i ] . m_pCommand , false , NewModifier ) ;
2017-07-22 20:43:20 +00:00
}
2008-10-05 18:27:20 +00:00
}
2017-07-22 20:43:20 +00:00
2015-05-31 20:40:38 +00:00
View . HSplitTop ( 2.0f , 0 , & View ) ;
2008-10-05 18:27:20 +00:00
}
}
2008-08-27 15:48:50 +00:00
2010-05-29 07:25:38 +00:00
void CMenus : : RenderSettingsControls ( CUIRect MainView )
2008-10-05 18:27:20 +00:00
{
2017-07-22 20:31:14 +00:00
char aBuf [ 128 ] ;
2008-08-27 15:48:50 +00:00
// this is kinda slow, but whatever
2010-05-29 07:25:38 +00:00
for ( int i = 0 ; i < g_KeyCount ; i + + )
2019-04-28 13:32:14 +00:00
gs_aKeys [ i ] . m_KeyId = gs_aKeys [ i ] . m_Modifier = 0 ;
2010-05-29 07:25:38 +00:00
2019-04-28 13:32:14 +00:00
for ( int Mod = 0 ; Mod < CBinds : : MODIFIER_COUNT ; Mod + + )
2008-08-27 15:48:50 +00:00
{
2019-04-28 13:32:14 +00:00
for ( int KeyId = 0 ; KeyId < KEY_LAST ; KeyId + + )
{
const char * pBind = m_pClient - > m_pBinds - > Get ( KeyId , Mod ) ;
if ( ! pBind [ 0 ] )
continue ;
2010-05-29 07:25:38 +00:00
2019-04-28 13:32:14 +00:00
for ( int i = 0 ; i < g_KeyCount ; i + + )
if ( str_comp ( pBind , gs_aKeys [ i ] . m_pCommand ) = = 0 )
{
gs_aKeys [ i ] . m_KeyId = KeyId ;
gs_aKeys [ i ] . m_Modifier = Mod ;
break ;
}
}
2008-08-27 15:48:50 +00:00
}
2008-10-05 18:27:20 +00:00
2017-07-22 11:41:18 +00:00
// controls in a scrollable listbox
static int s_ControlsList = 0 ;
static int s_SelectedControl = - 1 ;
static float s_ScrollValue = 0 ;
int OldSelected = s_SelectedControl ;
UiDoListboxStart ( & s_ControlsList , & MainView , 475.0f , Localize ( " Controls " ) , " " , 1 , 1 , s_SelectedControl , s_ScrollValue ) ;
2010-05-29 07:25:38 +00:00
CUIRect MovementSettings , WeaponSettings , VotingSettings , ChatSettings , MiscSettings , ResetButton ;
2017-07-22 11:41:18 +00:00
CListboxItem Item = UiDoListboxNextItem ( & OldSelected , false , false ) ;
Item . m_Rect . HSplitTop ( 10.0f , 0 , & Item . m_Rect ) ;
Item . m_Rect . VSplitMid ( & MovementSettings , & VotingSettings ) ;
2010-05-29 07:25:38 +00:00
// movement settings
2008-10-05 15:59:36 +00:00
{
2011-12-04 17:06:48 +00:00
MovementSettings . VMargin ( 5.0f , & MovementSettings ) ;
2017-09-03 17:23:59 +00:00
MovementSettings . HSplitTop ( 515.0f , & MovementSettings , & WeaponSettings ) ;
2019-04-26 21:47:34 +00:00
RenderTools ( ) - > DrawUIRect ( & MovementSettings , ColorRGBA ( 1 , 1 , 1 , 0.25f ) , CUI : : CORNER_ALL , 10.0f ) ;
2014-10-28 15:42:26 +00:00
MovementSettings . VMargin ( 10.0f , & MovementSettings ) ;
2010-05-29 07:25:38 +00:00
2020-07-15 19:42:48 +00:00
TextRender ( ) - > Text ( 0 , MovementSettings . x , MovementSettings . y + ( 14.0f + 5.0f + 10.0f - 14.0f * UI ( ) - > Scale ( ) ) / 2.f , 14.0f * UI ( ) - > Scale ( ) , Localize ( " Movement " ) , - 1.0f ) ;
2010-05-29 07:25:38 +00:00
MovementSettings . HSplitTop ( 14.0f + 5.0f + 10.0f , 0 , & MovementSettings ) ;
2008-08-27 15:48:50 +00:00
{
2010-05-29 07:25:38 +00:00
CUIRect Button , Label ;
MovementSettings . HSplitTop ( 20.0f , & Button , & MovementSettings ) ;
2017-07-22 20:31:14 +00:00
Button . VSplitLeft ( 160.0f , & Label , & Button ) ;
str_format ( aBuf , sizeof ( aBuf ) , " %s: %i " , Localize ( " Mouse sens. " ) , g_Config . m_InpMousesens ) ;
UI ( ) - > DoLabel ( & Label , aBuf , 14.0f * UI ( ) - > Scale ( ) , - 1 ) ;
Button . HMargin ( 2.0f , & Button ) ;
2019-04-26 19:36:49 +00:00
int NewValue = ( int ) ( DoScrollbarH ( & g_Config . m_InpMousesens , & Button , ( minimum ( g_Config . m_InpMousesens , 500 ) - 1 ) / 500.0f ) * 500.0f ) + 1 ;
2017-07-22 20:31:14 +00:00
if ( g_Config . m_InpMousesens < 500 | | NewValue < 500 )
2019-04-26 19:36:49 +00:00
g_Config . m_InpMousesens = minimum ( NewValue , 500 ) ;
2017-07-22 20:31:14 +00:00
MovementSettings . HSplitTop ( 20.0f , 0 , & MovementSettings ) ;
}
{
CUIRect Button , Label ;
MovementSettings . HSplitTop ( 20.0f , & Button , & MovementSettings ) ;
Button . VSplitLeft ( 160.0f , & Label , & Button ) ;
str_format ( aBuf , sizeof ( aBuf ) , " %s: %i " , Localize ( " UI mouse s. " ) , g_Config . m_UiMousesens ) ;
UI ( ) - > DoLabel ( & Label , aBuf , 14.0f * UI ( ) - > Scale ( ) , - 1 ) ;
2010-05-29 07:25:38 +00:00
Button . HMargin ( 2.0f , & Button ) ;
2019-04-26 19:36:49 +00:00
int NewValue = ( int ) ( DoScrollbarH ( & g_Config . m_UiMousesens , & Button , ( minimum ( g_Config . m_UiMousesens , 500 ) - 1 ) / 500.0f ) * 500.0f ) + 1 ;
2017-07-22 20:31:14 +00:00
if ( g_Config . m_UiMousesens < 500 | | NewValue < 500 )
2019-04-26 19:36:49 +00:00
g_Config . m_UiMousesens = minimum ( NewValue , 500 ) ;
2010-05-29 07:25:38 +00:00
MovementSettings . HSplitTop ( 20.0f , 0 , & MovementSettings ) ;
2008-08-27 15:48:50 +00:00
}
2010-05-29 07:25:38 +00:00
2017-09-03 17:23:59 +00:00
UiDoGetButtons ( 0 , 18 , MovementSettings , MainView ) ;
2008-10-05 18:27:20 +00:00
2008-10-05 15:59:36 +00:00
}
2010-05-29 07:25:38 +00:00
// weapon settings
2008-10-05 18:27:20 +00:00
{
2010-05-29 07:25:38 +00:00
WeaponSettings . HSplitTop ( 10.0f , 0 , & WeaponSettings ) ;
2017-07-22 11:41:18 +00:00
WeaponSettings . HSplitTop ( 190.0f , & WeaponSettings , & ResetButton ) ;
2019-04-26 21:47:34 +00:00
RenderTools ( ) - > DrawUIRect ( & WeaponSettings , ColorRGBA ( 1 , 1 , 1 , 0.25f ) , CUI : : CORNER_ALL , 10.0f ) ;
2014-10-28 15:42:26 +00:00
WeaponSettings . VMargin ( 10.0f , & WeaponSettings ) ;
2010-05-29 07:25:38 +00:00
2020-07-15 19:42:48 +00:00
TextRender ( ) - > Text ( 0 , WeaponSettings . x , WeaponSettings . y + ( 14.0f + 5.0f + 10.0f - 14.0f * UI ( ) - > Scale ( ) ) / 2.f , 14.0f * UI ( ) - > Scale ( ) , Localize ( " Weapon " ) , - 1.0f ) ;
2010-05-29 07:25:38 +00:00
WeaponSettings . HSplitTop ( 14.0f + 5.0f + 10.0f , 0 , & WeaponSettings ) ;
2017-09-03 17:23:59 +00:00
UiDoGetButtons ( 18 , 25 , WeaponSettings , MainView ) ;
2008-10-05 18:27:20 +00:00
}
2011-08-11 08:59:14 +00:00
2011-04-06 19:15:58 +00:00
// defaults
{
ResetButton . HSplitTop ( 10.0f , 0 , & ResetButton ) ;
2017-07-22 11:41:18 +00:00
ResetButton . HSplitTop ( 40.0f , & ResetButton , 0 ) ;
2019-04-26 21:47:34 +00:00
RenderTools ( ) - > DrawUIRect ( & ResetButton , ColorRGBA ( 1 , 1 , 1 , 0.25f ) , CUI : : CORNER_ALL , 10.0f ) ;
2011-04-06 19:15:58 +00:00
ResetButton . HMargin ( 10.0f , & ResetButton ) ;
ResetButton . VMargin ( 30.0f , & ResetButton ) ;
2011-12-04 17:06:48 +00:00
ResetButton . HSplitTop ( 20.0f , & ResetButton , 0 ) ;
2011-04-06 19:15:58 +00:00
static int s_DefaultButton = 0 ;
if ( DoButton_Menu ( ( void * ) & s_DefaultButton , Localize ( " Reset to defaults " ) , 0 , & ResetButton ) )
m_pClient - > m_pBinds - > SetDefaults ( ) ;
}
2011-08-11 08:59:14 +00:00
2010-05-29 07:25:38 +00:00
// voting settings
2008-10-05 18:27:20 +00:00
{
2011-12-04 17:06:48 +00:00
VotingSettings . VMargin ( 5.0f , & VotingSettings ) ;
2017-07-22 11:41:18 +00:00
VotingSettings . HSplitTop ( 80.0f , & VotingSettings , & ChatSettings ) ;
2019-04-26 21:47:34 +00:00
RenderTools ( ) - > DrawUIRect ( & VotingSettings , ColorRGBA ( 1 , 1 , 1 , 0.25f ) , CUI : : CORNER_ALL , 10.0f ) ;
2014-04-28 20:12:50 +00:00
VotingSettings . VMargin ( 10.0f , & VotingSettings ) ;
2010-05-29 07:25:38 +00:00
2020-07-15 19:42:48 +00:00
TextRender ( ) - > Text ( 0 , VotingSettings . x , VotingSettings . y + ( 14.0f + 5.0f + 10.0f - 14.0f * UI ( ) - > Scale ( ) ) / 2.f , 14.0f * UI ( ) - > Scale ( ) , Localize ( " Voting " ) , - 1.0f ) ;
2010-05-29 07:25:38 +00:00
2017-07-22 11:41:18 +00:00
VotingSettings . HSplitTop ( 14.0f + 5.0f + 10.0f , 0 , & VotingSettings ) ;
2017-09-03 17:23:59 +00:00
UiDoGetButtons ( 25 , 27 , VotingSettings , MainView ) ;
2008-10-05 18:27:20 +00:00
}
2010-05-29 07:25:38 +00:00
// chat settings
2008-10-05 18:27:20 +00:00
{
2010-05-29 07:25:38 +00:00
ChatSettings . HSplitTop ( 10.0f , 0 , & ChatSettings ) ;
2017-07-22 11:41:18 +00:00
ChatSettings . HSplitTop ( 125.0f , & ChatSettings , & MiscSettings ) ;
2019-04-26 21:47:34 +00:00
RenderTools ( ) - > DrawUIRect ( & ChatSettings , ColorRGBA ( 1 , 1 , 1 , 0.25f ) , CUI : : CORNER_ALL , 10.0f ) ;
2014-04-26 18:29:42 +00:00
ChatSettings . VMargin ( 10.0f , & ChatSettings ) ;
2010-05-29 07:25:38 +00:00
2020-07-15 19:42:48 +00:00
TextRender ( ) - > Text ( 0 , ChatSettings . x , ChatSettings . y + ( 14.0f + 5.0f + 10.0f - 14.0f * UI ( ) - > Scale ( ) ) / 2.f , 14.0f * UI ( ) - > Scale ( ) , Localize ( " Chat " ) , - 1.0f ) ;
2010-05-29 07:25:38 +00:00
2017-07-22 11:41:18 +00:00
ChatSettings . HSplitTop ( 14.0f + 5.0f + 10.0f , 0 , & ChatSettings ) ;
2017-09-03 17:23:59 +00:00
UiDoGetButtons ( 27 , 31 , ChatSettings , MainView ) ;
2008-10-05 18:27:20 +00:00
}
2010-05-29 07:25:38 +00:00
// misc settings
2008-10-05 18:27:20 +00:00
{
2010-05-29 07:25:38 +00:00
MiscSettings . HSplitTop ( 10.0f , 0 , & MiscSettings ) ;
2017-07-22 11:41:18 +00:00
MiscSettings . HSplitTop ( 300.0f , & MiscSettings , 0 ) ;
2019-04-26 21:47:34 +00:00
RenderTools ( ) - > DrawUIRect ( & MiscSettings , ColorRGBA ( 1 , 1 , 1 , 0.25f ) , CUI : : CORNER_ALL , 10.0f ) ;
2014-04-26 18:29:42 +00:00
MiscSettings . VMargin ( 10.0f , & MiscSettings ) ;
2010-05-29 07:25:38 +00:00
2020-07-15 19:42:48 +00:00
TextRender ( ) - > Text ( 0 , MiscSettings . x , MiscSettings . y + ( 14.0f + 5.0f + 10.0f - 14.0f * UI ( ) - > Scale ( ) ) / 2.f , 14.0f * UI ( ) - > Scale ( ) , Localize ( " Miscellaneous " ) , - 1.0f ) ;
2010-05-29 07:25:38 +00:00
2017-07-22 11:41:18 +00:00
MiscSettings . HSplitTop ( 14.0f + 5.0f + 10.0f , 0 , & MiscSettings ) ;
2017-09-03 17:23:59 +00:00
UiDoGetButtons ( 31 , 43 , MiscSettings , MainView ) ;
2008-10-05 18:27:20 +00:00
}
2010-05-29 07:25:38 +00:00
2017-07-22 11:41:18 +00:00
UiDoListboxEnd ( & s_ScrollValue , 0 ) ;
2008-08-27 15:48:50 +00:00
}
2010-05-29 07:25:38 +00:00
void CMenus : : RenderSettingsGraphics ( CUIRect MainView )
2008-08-27 15:48:50 +00:00
{
2016-05-10 15:43:27 +00:00
CUIRect Button , Label ;
2010-05-29 07:25:38 +00:00
char aBuf [ 128 ] ;
2010-10-16 09:24:42 +00:00
bool CheckSettings = false ;
2010-05-29 07:25:38 +00:00
2008-08-27 15:48:50 +00:00
static const int MAX_RESOLUTIONS = 256 ;
2010-05-29 07:25:38 +00:00
static CVideoMode s_aModes [ MAX_RESOLUTIONS ] ;
2015-08-24 20:46:28 +00:00
static int s_NumNodes = Graphics ( ) - > GetVideoModes ( s_aModes , MAX_RESOLUTIONS , g_Config . m_GfxScreen ) ;
2010-10-16 09:24:42 +00:00
static int s_GfxScreenWidth = g_Config . m_GfxScreenWidth ;
static int s_GfxScreenHeight = g_Config . m_GfxScreenHeight ;
static int s_GfxColorDepth = g_Config . m_GfxColorDepth ;
2010-12-08 00:55:13 +00:00
static int s_GfxVsync = g_Config . m_GfxVsync ;
static int s_GfxFsaaSamples = g_Config . m_GfxFsaaSamples ;
2020-08-29 10:10:38 +00:00
static int s_GfxOpenGLVersion = ( g_Config . m_GfxOpenGLMajor = = 3 & & g_Config . m_GfxOpenGLMinor = = 3 ) | | g_Config . m_GfxOpenGLMajor > = 4 ;
2017-10-10 13:35:20 +00:00
static int s_GfxEnableTextureUnitOptimization = g_Config . m_GfxEnableTextureUnitOptimization ;
static int s_GfxUsePreinitBuffer = g_Config . m_GfxUsePreinitBuffer ;
2020-04-07 20:37:46 +00:00
static int s_GfxHighdpi = g_Config . m_GfxHighdpi ;
2010-05-29 07:25:38 +00:00
CUIRect ModeList ;
MainView . VSplitLeft ( 300.0f , & MainView , & ModeList ) ;
2008-08-27 15:48:50 +00:00
// draw allmodes switch
2010-05-29 07:25:38 +00:00
ModeList . HSplitTop ( 20 , & Button , & ModeList ) ;
if ( DoButton_CheckBox ( & g_Config . m_GfxDisplayAllModes , Localize ( " Show only supported " ) , g_Config . m_GfxDisplayAllModes ^ 1 , & Button ) )
2008-08-27 15:48:50 +00:00
{
2010-05-29 07:25:38 +00:00
g_Config . m_GfxDisplayAllModes ^ = 1 ;
2015-08-24 20:46:28 +00:00
s_NumNodes = Graphics ( ) - > GetVideoModes ( s_aModes , MAX_RESOLUTIONS , g_Config . m_GfxScreen ) ;
2008-08-27 15:48:50 +00:00
}
2010-05-29 07:25:38 +00:00
// display mode list
static float s_ScrollValue = 0 ;
int OldSelected = - 1 ;
2011-06-01 17:27:36 +00:00
int G = gcd ( s_GfxScreenWidth , s_GfxScreenHeight ) ;
str_format ( aBuf , sizeof ( aBuf ) , " %s: %dx%d %d bit (%d:%d) " , Localize ( " Current " ) , s_GfxScreenWidth , s_GfxScreenHeight , s_GfxColorDepth , s_GfxScreenWidth / G , s_GfxScreenHeight / G ) ;
2010-05-29 07:25:38 +00:00
UiDoListboxStart ( & s_NumNodes , & ModeList , 24.0f , Localize ( " Display Modes " ) , aBuf , s_NumNodes , 1 , OldSelected , s_ScrollValue ) ;
for ( int i = 0 ; i < s_NumNodes ; + + i )
2008-08-27 15:48:50 +00:00
{
2010-05-29 07:25:38 +00:00
const int Depth = s_aModes [ i ] . m_Red + s_aModes [ i ] . m_Green + s_aModes [ i ] . m_Blue > 16 ? 24 : 16 ;
if ( g_Config . m_GfxColorDepth = = Depth & &
g_Config . m_GfxScreenWidth = = s_aModes [ i ] . m_Width & &
g_Config . m_GfxScreenHeight = = s_aModes [ i ] . m_Height )
2008-08-27 15:48:50 +00:00
{
2010-05-29 07:25:38 +00:00
OldSelected = i ;
2008-08-27 15:48:50 +00:00
}
2010-05-29 07:25:38 +00:00
CListboxItem Item = UiDoListboxNextItem ( & s_aModes [ i ] , OldSelected = = i ) ;
if ( Item . m_Visible )
2008-08-27 15:48:50 +00:00
{
2011-06-01 17:27:36 +00:00
int G = gcd ( s_aModes [ i ] . m_Width , s_aModes [ i ] . m_Height ) ;
str_format ( aBuf , sizeof ( aBuf ) , " %dx%d %d bit (%d:%d) " , s_aModes [ i ] . m_Width , s_aModes [ i ] . m_Height , Depth , s_aModes [ i ] . m_Width / G , s_aModes [ i ] . m_Height / G ) ;
2010-12-14 00:20:47 +00:00
UI ( ) - > DoLabelScaled ( & Item . m_Rect , aBuf , 16.0f , - 1 ) ;
2008-08-27 15:48:50 +00:00
}
}
2010-05-29 07:25:38 +00:00
const int NewSelected = UiDoListboxEnd ( & s_ScrollValue , 0 ) ;
if ( OldSelected ! = NewSelected )
{
const int Depth = s_aModes [ NewSelected ] . m_Red + s_aModes [ NewSelected ] . m_Green + s_aModes [ NewSelected ] . m_Blue > 16 ? 24 : 16 ;
g_Config . m_GfxColorDepth = Depth ;
g_Config . m_GfxScreenWidth = s_aModes [ NewSelected ] . m_Width ;
g_Config . m_GfxScreenHeight = s_aModes [ NewSelected ] . m_Height ;
2016-04-30 17:19:19 +00:00
# if defined(SDL_VIDEO_DRIVER_X11)
2016-04-30 15:59:58 +00:00
Graphics ( ) - > Resize ( g_Config . m_GfxScreenWidth , g_Config . m_GfxScreenHeight ) ;
2016-04-30 17:19:19 +00:00
# else
CheckSettings = true ;
# endif
2010-05-29 07:25:38 +00:00
}
2008-08-27 15:48:50 +00:00
// switches
2012-06-27 09:46:11 +00:00
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
if ( DoButton_CheckBox ( & g_Config . m_GfxBorderless , Localize ( " Borderless window " ) , g_Config . m_GfxBorderless , & Button ) )
{
2016-04-29 22:34:12 +00:00
Client ( ) - > ToggleWindowBordered ( ) ;
2012-06-27 09:46:11 +00:00
}
2010-05-29 07:25:38 +00:00
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
if ( DoButton_CheckBox ( & g_Config . m_GfxFullscreen , Localize ( " Fullscreen " ) , g_Config . m_GfxFullscreen , & Button ) )
2008-08-27 15:48:50 +00:00
{
2016-04-29 22:34:12 +00:00
Client ( ) - > ToggleFullscreen ( ) ;
2008-08-27 15:48:50 +00:00
}
2010-05-29 07:25:38 +00:00
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
2017-08-08 17:53:16 +00:00
str_format ( aBuf , sizeof ( aBuf ) , " %s (%s) " , Localize ( " V-Sync " ) , Localize ( " may cause delay " ) ) ;
if ( DoButton_CheckBox ( & g_Config . m_GfxVsync , aBuf , g_Config . m_GfxVsync , & Button ) )
2009-01-21 20:55:07 +00:00
{
2016-04-29 22:34:12 +00:00
Client ( ) - > ToggleWindowVSync ( ) ;
}
if ( Graphics ( ) - > GetNumScreens ( ) > 1 )
{
int NumScreens = Graphics ( ) - > GetNumScreens ( ) ;
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
int Screen_MouseButton = DoButton_CheckBox_Number ( & g_Config . m_GfxScreen , Localize ( " Screen " ) , g_Config . m_GfxScreen , & Button ) ;
if ( Screen_MouseButton = = 1 ) //inc
{
Client ( ) - > SwitchWindowScreen ( ( g_Config . m_GfxScreen + 1 ) % NumScreens ) ;
s_NumNodes = Graphics ( ) - > GetVideoModes ( s_aModes , MAX_RESOLUTIONS , g_Config . m_GfxScreen ) ;
}
else if ( Screen_MouseButton = = 2 ) //dec
{
Client ( ) - > SwitchWindowScreen ( ( g_Config . m_GfxScreen - 1 + NumScreens ) % NumScreens ) ;
s_NumNodes = Graphics ( ) - > GetVideoModes ( s_aModes , MAX_RESOLUTIONS , g_Config . m_GfxScreen ) ;
}
2009-01-21 20:55:07 +00:00
}
2008-08-27 15:48:50 +00:00
2010-05-29 07:25:38 +00:00
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
2017-08-08 17:53:16 +00:00
str_format ( aBuf , sizeof ( aBuf ) , " %s (%s) " , Localize ( " FSAA samples " ) , Localize ( " may cause delay " ) ) ;
int GfxFsaaSamples_MouseButton = DoButton_CheckBox_Number ( & g_Config . m_GfxFsaaSamples , aBuf , g_Config . m_GfxFsaaSamples , & Button ) ;
2016-04-29 22:34:12 +00:00
if ( GfxFsaaSamples_MouseButton = = 1 ) //inc
2008-08-27 15:48:50 +00:00
{
2010-05-29 07:25:38 +00:00
g_Config . m_GfxFsaaSamples = ( g_Config . m_GfxFsaaSamples + 1 ) % 17 ;
2010-10-16 09:24:42 +00:00
CheckSettings = true ;
2008-08-27 15:48:50 +00:00
}
2014-10-19 16:01:03 +00:00
else if ( GfxFsaaSamples_MouseButton = = 2 ) //dec
2016-04-29 22:34:12 +00:00
{
g_Config . m_GfxFsaaSamples = ( g_Config . m_GfxFsaaSamples - 1 + 17 ) % 17 ;
CheckSettings = true ;
}
2015-05-20 20:23:58 +00:00
2010-05-29 07:25:38 +00:00
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
if ( DoButton_CheckBox ( & g_Config . m_GfxHighDetail , Localize ( " High Detail " ) , g_Config . m_GfxHighDetail , & Button ) )
g_Config . m_GfxHighDetail ^ = 1 ;
2008-08-27 15:48:50 +00:00
2017-10-10 13:35:20 +00:00
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
2020-08-29 10:10:38 +00:00
bool IsNewOpenGL = ( g_Config . m_GfxOpenGLMajor = = 3 & & g_Config . m_GfxOpenGLMinor = = 3 ) | | g_Config . m_GfxOpenGLMajor > = 4 ;
if ( DoButton_CheckBox ( & g_Config . m_GfxOpenGLMajor , Localize ( " Use OpenGL 3.3 (experimental) " ) , IsNewOpenGL , & Button ) )
2017-10-10 13:35:20 +00:00
{
CheckSettings = true ;
2020-08-29 10:10:38 +00:00
if ( IsNewOpenGL )
{
2020-09-02 05:53:03 +00:00
g_Config . m_GfxOpenGLMajor = 3 ;
g_Config . m_GfxOpenGLMinor = 0 ;
2020-08-29 10:10:38 +00:00
g_Config . m_GfxOpenGLPatch = 0 ;
IsNewOpenGL = false ;
}
else
{
g_Config . m_GfxOpenGLMajor = 3 ;
g_Config . m_GfxOpenGLMinor = 3 ;
g_Config . m_GfxOpenGLPatch = 0 ;
IsNewOpenGL = true ;
}
2017-10-10 13:35:20 +00:00
}
2020-08-29 10:10:38 +00:00
if ( IsNewOpenGL )
2017-10-10 13:35:20 +00:00
{
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
if ( DoButton_CheckBox ( & g_Config . m_GfxUsePreinitBuffer , Localize ( " Preinit VBO (iGPUs only) " ) , g_Config . m_GfxUsePreinitBuffer , & Button ) )
{
CheckSettings = true ;
g_Config . m_GfxUsePreinitBuffer ^ = 1 ;
}
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
if ( DoButton_CheckBox ( & g_Config . m_GfxEnableTextureUnitOptimization , Localize ( " Multiple texture units (disable for MacOS) " ) , g_Config . m_GfxEnableTextureUnitOptimization , & Button ) )
{
CheckSettings = true ;
g_Config . m_GfxEnableTextureUnitOptimization ^ = 1 ;
}
}
2019-04-21 16:20:53 +00:00
2020-04-07 20:37:46 +00:00
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
if ( DoButton_CheckBox ( & g_Config . m_GfxHighdpi , Localize ( " Use high DPI " ) , g_Config . m_GfxHighdpi , & Button ) )
{
CheckSettings = true ;
g_Config . m_GfxHighdpi ^ = 1 ;
}
2010-12-08 00:55:13 +00:00
// check if the new settings require a restart
if ( CheckSettings )
{
if ( s_GfxScreenWidth = = g_Config . m_GfxScreenWidth & &
s_GfxScreenHeight = = g_Config . m_GfxScreenHeight & &
s_GfxColorDepth = = g_Config . m_GfxColorDepth & &
s_GfxVsync = = g_Config . m_GfxVsync & &
s_GfxFsaaSamples = = g_Config . m_GfxFsaaSamples & &
2020-08-29 10:10:38 +00:00
s_GfxOpenGLVersion = = ( int ) IsNewOpenGL & &
2017-10-10 13:35:20 +00:00
s_GfxUsePreinitBuffer = = g_Config . m_GfxUsePreinitBuffer & &
2020-04-07 20:37:46 +00:00
s_GfxEnableTextureUnitOptimization = = g_Config . m_GfxEnableTextureUnitOptimization & &
s_GfxHighdpi = = g_Config . m_GfxHighdpi )
2010-12-08 00:55:13 +00:00
m_NeedRestartGraphics = false ;
else
m_NeedRestartGraphics = true ;
2010-10-16 09:24:42 +00:00
}
2016-05-10 15:43:27 +00:00
MainView . HSplitTop ( 20.0f , & Label , & MainView ) ;
Label . VSplitLeft ( 130.0f , & Label , & Button ) ;
2017-09-07 18:51:46 +00:00
if ( g_Config . m_GfxRefreshRate )
str_format ( aBuf , sizeof ( aBuf ) , " %s: %i Hz " , Localize ( " Refresh Rate " ) , g_Config . m_GfxRefreshRate ) ;
else
2017-10-20 20:45:12 +00:00
str_format ( aBuf , sizeof ( aBuf ) , " %s: %s " , Localize ( " Refresh Rate " ) , " ∞ " ) ;
2016-05-10 15:43:27 +00:00
UI ( ) - > DoLabelScaled ( & Label , aBuf , 14.0f , - 1 ) ;
Button . HMargin ( 2.0f , & Button ) ;
2019-04-26 19:36:49 +00:00
int NewRefreshRate = static_cast < int > ( DoScrollbarH ( & g_Config . m_GfxRefreshRate , & Button , ( minimum ( g_Config . m_GfxRefreshRate , 1000 ) ) / 1000.0f ) * 1000.0f + 0.1f ) ;
2018-03-02 02:29:02 +00:00
if ( g_Config . m_GfxRefreshRate < = 1000 | | NewRefreshRate < 1000 )
g_Config . m_GfxRefreshRate = NewRefreshRate ;
2016-05-10 15:43:27 +00:00
2010-05-29 07:25:38 +00:00
CUIRect Text ;
MainView . HSplitTop ( 20.0f , 0 , & MainView ) ;
MainView . HSplitTop ( 20.0f , & Text , & MainView ) ;
2009-10-27 14:38:53 +00:00
//text.VSplitLeft(15.0f, 0, &text);
2010-12-14 00:20:47 +00:00
UI ( ) - > DoLabelScaled ( & Text , Localize ( " UI Color " ) , 14.0f , - 1 ) ;
2020-06-27 13:08:35 +00:00
RenderHSLScrollbars ( & MainView , & g_Config . m_UiColor , true ) ;
2008-08-27 15:48:50 +00:00
}
2010-05-29 07:25:38 +00:00
void CMenus : : RenderSettingsSound ( CUIRect MainView )
2008-08-27 15:48:50 +00:00
{
2010-05-29 07:25:38 +00:00
CUIRect Button ;
2011-04-01 15:57:04 +00:00
MainView . VSplitMid ( & MainView , 0 ) ;
2010-12-08 00:55:13 +00:00
static int s_SndEnable = g_Config . m_SndEnable ;
2010-10-16 09:24:42 +00:00
static int s_SndRate = g_Config . m_SndRate ;
2010-05-29 07:25:38 +00:00
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
if ( DoButton_CheckBox ( & g_Config . m_SndEnable , Localize ( " Use sounds " ) , g_Config . m_SndEnable , & Button ) )
2008-08-27 15:48:50 +00:00
{
2010-05-29 07:25:38 +00:00
g_Config . m_SndEnable ^ = 1 ;
2011-04-13 18:00:54 +00:00
if ( g_Config . m_SndEnable )
2011-06-27 21:26:01 +00:00
{
2015-10-16 17:31:01 +00:00
if ( g_Config . m_SndMusic & & Client ( ) - > State ( ) = = IClient : : STATE_OFFLINE )
2012-01-06 18:38:40 +00:00
m_pClient - > m_pSounds - > Play ( CSounds : : CHN_MUSIC , SOUND_MENU , 1.0f ) ;
2011-06-27 21:26:01 +00:00
}
2011-04-13 18:00:54 +00:00
else
m_pClient - > m_pSounds - > Stop ( SOUND_MENU ) ;
2011-03-27 10:12:50 +00:00
m_NeedRestartSound = g_Config . m_SndEnable & & ( ! s_SndEnable | | s_SndRate ! = g_Config . m_SndRate ) ;
2008-08-27 15:48:50 +00:00
}
2010-05-29 07:25:38 +00:00
if ( ! g_Config . m_SndEnable )
2008-08-27 15:48:50 +00:00
return ;
2010-05-29 07:25:38 +00:00
2011-04-13 18:00:54 +00:00
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
if ( DoButton_CheckBox ( & g_Config . m_SndMusic , Localize ( " Play background music " ) , g_Config . m_SndMusic , & Button ) )
{
g_Config . m_SndMusic ^ = 1 ;
2012-04-19 23:50:16 +00:00
if ( Client ( ) - > State ( ) = = IClient : : STATE_OFFLINE )
{
if ( g_Config . m_SndMusic )
m_pClient - > m_pSounds - > Play ( CSounds : : CHN_MUSIC , SOUND_MENU , 1.0f ) ;
else
m_pClient - > m_pSounds - > Stop ( SOUND_MENU ) ;
}
2011-04-13 18:00:54 +00:00
}
2010-05-29 07:25:38 +00:00
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
if ( DoButton_CheckBox ( & g_Config . m_SndNonactiveMute , Localize ( " Mute when not active " ) , g_Config . m_SndNonactiveMute , & Button ) )
g_Config . m_SndNonactiveMute ^ = 1 ;
2013-10-08 15:23:00 +00:00
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
2014-03-22 09:24:10 +00:00
if ( DoButton_CheckBox ( & g_Config . m_SndGame , Localize ( " Enable game sounds " ) , g_Config . m_SndGame , & Button ) )
g_Config . m_SndGame ^ = 1 ;
2014-10-25 23:00:30 +00:00
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
if ( DoButton_CheckBox ( & g_Config . m_SndGun , Localize ( " Enable gun sound " ) , g_Config . m_SndGun , & Button ) )
g_Config . m_SndGun ^ = 1 ;
2017-06-06 16:58:23 +00:00
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
if ( DoButton_CheckBox ( & g_Config . m_SndLongPain , Localize ( " Enable long pain sound (used when shooting in freeze) " ) , g_Config . m_SndLongPain , & Button ) )
g_Config . m_SndLongPain ^ = 1 ;
2014-03-22 09:24:10 +00:00
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
if ( DoButton_CheckBox ( & g_Config . m_SndServerMessage , Localize ( " Enable server message sound " ) , g_Config . m_SndServerMessage , & Button ) )
g_Config . m_SndServerMessage ^ = 1 ;
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
if ( DoButton_CheckBox ( & g_Config . m_SndChat , Localize ( " Enable regular chat sound " ) , g_Config . m_SndChat , & Button ) )
2013-10-08 15:23:00 +00:00
g_Config . m_SndChat ^ = 1 ;
2014-05-04 16:35:37 +00:00
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
if ( DoButton_CheckBox ( & g_Config . m_SndTeamChat , Localize ( " Enable team chat sound " ) , g_Config . m_SndTeamChat , & Button ) )
g_Config . m_SndTeamChat ^ = 1 ;
2013-10-21 00:16:45 +00:00
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
2014-03-22 09:24:10 +00:00
if ( DoButton_CheckBox ( & g_Config . m_SndHighlight , Localize ( " Enable highlighted chat sound " ) , g_Config . m_SndHighlight , & Button ) )
g_Config . m_SndHighlight ^ = 1 ;
2013-10-21 00:16:45 +00:00
2013-02-24 18:43:09 +00:00
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
if ( DoButton_CheckBox ( & g_Config . m_ClThreadsoundloading , Localize ( " Threaded sound loading " ) , g_Config . m_ClThreadsoundloading , & Button ) )
g_Config . m_ClThreadsoundloading ^ = 1 ;
2008-08-27 15:48:50 +00:00
// sample rate box
{
2010-05-29 07:25:38 +00:00
char aBuf [ 64 ] ;
str_format ( aBuf , sizeof ( aBuf ) , " %d " , g_Config . m_SndRate ) ;
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
2010-12-14 00:20:47 +00:00
UI ( ) - > DoLabelScaled ( & Button , Localize ( " Sample rate " ) , 14.0f , - 1 ) ;
2011-04-01 15:57:04 +00:00
Button . VSplitLeft ( 190.0f , 0 , & Button ) ;
2010-05-29 15:53:57 +00:00
static float Offset = 0.0f ;
DoEditBox ( & g_Config . m_SndRate , & Button , aBuf , sizeof ( aBuf ) , 14.0f , & Offset ) ;
2019-04-26 19:36:49 +00:00
g_Config . m_SndRate = maximum ( 1 , str_toint ( aBuf ) ) ;
2011-03-27 10:12:50 +00:00
m_NeedRestartSound = ! s_SndEnable | | s_SndRate ! = g_Config . m_SndRate ;
2008-08-27 15:48:50 +00:00
}
2010-05-29 07:25:38 +00:00
2008-08-27 15:48:50 +00:00
// volume slider
{
2010-05-29 07:25:38 +00:00
CUIRect Button , Label ;
MainView . HSplitTop ( 5.0f , & Button , & MainView ) ;
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
2011-04-01 15:57:04 +00:00
Button . VSplitLeft ( 190.0f , & Label , & Button ) ;
2010-05-29 07:25:38 +00:00
Button . HMargin ( 2.0f , & Button ) ;
2010-12-14 00:20:47 +00:00
UI ( ) - > DoLabelScaled ( & Label , Localize ( " Sound volume " ) , 14.0f , - 1 ) ;
2010-05-29 07:25:38 +00:00
g_Config . m_SndVolume = ( int ) ( DoScrollbarH ( & g_Config . m_SndVolume , & Button , g_Config . m_SndVolume / 100.0f ) * 100.0f ) ;
2008-08-27 15:48:50 +00:00
}
2014-10-12 15:02:47 +00:00
// volume slider map sounds
{
CUIRect Button , Label ;
MainView . HSplitTop ( 5.0f , & Button , & MainView ) ;
MainView . HSplitTop ( 20.0f , & Button , & MainView ) ;
Button . VSplitLeft ( 190.0f , & Label , & Button ) ;
Button . HMargin ( 2.0f , & Button ) ;
2014-12-14 16:16:44 +00:00
UI ( ) - > DoLabelScaled ( & Label , Localize ( " Map sound volume " ) , 14.0f , - 1 ) ;
2014-10-23 13:53:23 +00:00
g_Config . m_SndMapSoundVolume = ( int ) ( DoScrollbarH ( & g_Config . m_SndMapSoundVolume , & Button , g_Config . m_SndMapSoundVolume / 100.0f ) * 100.0f ) ;
2014-10-12 15:02:47 +00:00
}
2008-08-27 15:48:50 +00:00
}
2010-07-09 22:55:42 +00:00
class CLanguage
2009-06-15 08:15:53 +00:00
{
2010-07-09 22:55:42 +00:00
public :
CLanguage ( ) { }
2011-07-12 18:33:53 +00:00
CLanguage ( const char * n , const char * f , int Code ) : m_Name ( n ) , m_FileName ( f ) , m_CountryCode ( Code ) { }
2010-05-29 07:25:38 +00:00
string m_Name ;
string m_FileName ;
2011-07-12 18:33:53 +00:00
int m_CountryCode ;
2010-05-29 07:25:38 +00:00
2010-07-09 22:55:42 +00:00
bool operator < ( const CLanguage & Other ) { return m_Name < Other . m_Name ; }
2009-06-15 08:15:53 +00:00
} ;
2010-09-16 11:32:56 +00:00
void LoadLanguageIndexfile ( IStorage * pStorage , IConsole * pConsole , sorted_array < CLanguage > * pLanguages )
2008-08-27 15:48:50 +00:00
{
2010-10-06 21:07:35 +00:00
IOHANDLE File = pStorage - > OpenFile ( " languages/index.txt " , IOFLAG_READ , IStorage : : TYPE_ALL ) ;
2010-09-16 11:32:56 +00:00
if ( ! File )
{
pConsole - > Print ( IConsole : : OUTPUT_LEVEL_ADDINFO , " localization " , " couldn't open index file " ) ;
2009-06-15 08:15:53 +00:00
return ;
2010-09-16 11:32:56 +00:00
}
2011-04-13 18:37:12 +00:00
2011-02-10 11:07:00 +00:00
char aOrigin [ 128 ] ;
2011-07-12 18:33:53 +00:00
char aReplacement [ 128 ] ;
2010-09-16 11:32:56 +00:00
CLineReader LineReader ;
LineReader . Init ( File ) ;
char * pLine ;
while ( ( pLine = LineReader . Get ( ) ) )
{
if ( ! str_length ( pLine ) | | pLine [ 0 ] = = ' # ' ) // skip empty lines and comments
continue ;
2011-04-13 18:37:12 +00:00
2011-02-10 11:07:00 +00:00
str_copy ( aOrigin , pLine , sizeof ( aOrigin ) ) ;
2011-07-12 18:33:53 +00:00
pLine = LineReader . Get ( ) ;
if ( ! pLine )
2010-09-16 11:32:56 +00:00
{
pConsole - > Print ( IConsole : : OUTPUT_LEVEL_ADDINFO , " localization " , " unexpected end of index file " ) ;
break ;
}
2011-04-13 18:37:12 +00:00
2011-07-12 18:33:53 +00:00
if ( pLine [ 0 ] ! = ' = ' | | pLine [ 1 ] ! = ' = ' | | pLine [ 2 ] ! = ' ' )
{
char aBuf [ 128 ] ;
str_format ( aBuf , sizeof ( aBuf ) , " malform replacement for index '%s' " , aOrigin ) ;
pConsole - > Print ( IConsole : : OUTPUT_LEVEL_ADDINFO , " localization " , aBuf ) ;
( void ) LineReader . Get ( ) ;
continue ;
}
str_copy ( aReplacement , pLine + 3 , sizeof ( aReplacement ) ) ;
pLine = LineReader . Get ( ) ;
if ( ! pLine )
2010-09-16 11:32:56 +00:00
{
pConsole - > Print ( IConsole : : OUTPUT_LEVEL_ADDINFO , " localization " , " unexpected end of index file " ) ;
break ;
}
2011-04-13 18:37:12 +00:00
2011-07-12 18:33:53 +00:00
if ( pLine [ 0 ] ! = ' = ' | | pLine [ 1 ] ! = ' = ' | | pLine [ 2 ] ! = ' ' )
2010-09-16 11:32:56 +00:00
{
char aBuf [ 128 ] ;
2011-02-10 11:07:00 +00:00
str_format ( aBuf , sizeof ( aBuf ) , " malform replacement for index '%s' " , aOrigin ) ;
2010-09-16 11:32:56 +00:00
pConsole - > Print ( IConsole : : OUTPUT_LEVEL_ADDINFO , " localization " , aBuf ) ;
continue ;
}
2011-04-13 18:37:12 +00:00
2010-09-16 11:32:56 +00:00
char aFileName [ 128 ] ;
2011-02-10 11:07:00 +00:00
str_format ( aFileName , sizeof ( aFileName ) , " languages/%s.txt " , aOrigin ) ;
2011-07-12 18:33:53 +00:00
pLanguages - > add ( CLanguage ( aReplacement , aFileName , str_toint ( pLine + 3 ) ) ) ;
2010-09-16 11:32:56 +00:00
}
io_close ( File ) ;
2009-06-15 08:15:53 +00:00
}
2010-12-12 18:20:30 +00:00
void CMenus : : RenderLanguageSelection ( CUIRect MainView )
2009-06-15 08:15:53 +00:00
{
2011-04-13 18:37:12 +00:00
static int s_LanguageList = 0 ;
2010-05-29 07:25:38 +00:00
static int s_SelectedLanguage = 0 ;
2010-07-09 22:55:42 +00:00
static sorted_array < CLanguage > s_Languages ;
2010-05-29 07:25:38 +00:00
static float s_ScrollValue = 0 ;
if ( s_Languages . size ( ) = = 0 )
2008-08-27 15:48:50 +00:00
{
2011-07-12 18:33:53 +00:00
s_Languages . add ( CLanguage ( " English " , " " , 826 ) ) ;
2010-09-16 11:32:56 +00:00
LoadLanguageIndexfile ( Storage ( ) , Console ( ) , & s_Languages ) ;
2010-05-29 07:25:38 +00:00
for ( int i = 0 ; i < s_Languages . size ( ) ; i + + )
if ( str_comp ( s_Languages [ i ] . m_FileName , g_Config . m_ClLanguagefile ) = = 0 )
2009-06-15 08:15:53 +00:00
{
2010-05-29 07:25:38 +00:00
s_SelectedLanguage = i ;
2009-06-15 08:15:53 +00:00
break ;
}
}
2010-05-29 07:25:38 +00:00
int OldSelected = s_SelectedLanguage ;
2010-12-12 18:20:30 +00:00
UiDoListboxStart ( & s_LanguageList , & MainView , 24.0f , Localize ( " Language " ) , " " , s_Languages . size ( ) , 1 , s_SelectedLanguage , s_ScrollValue ) ;
for ( sorted_array < CLanguage > : : range r = s_Languages . all ( ) ; ! r . empty ( ) ; r . pop_front ( ) )
{
CListboxItem Item = UiDoListboxNextItem ( & r . front ( ) ) ;
if ( Item . m_Visible )
2011-07-12 18:33:53 +00:00
{
CUIRect Rect ;
Item . m_Rect . VSplitLeft ( Item . m_Rect . h * 2.0f , & Rect , & Item . m_Rect ) ;
Rect . VMargin ( 6.0f , & Rect ) ;
Rect . HMargin ( 3.0f , & Rect ) ;
2019-04-26 21:47:34 +00:00
ColorRGBA Color ( 1.0f , 1.0f , 1.0f , 1.0f ) ;
2012-01-08 17:16:38 +00:00
m_pClient - > m_pCountryFlags - > Render ( r . front ( ) . m_CountryCode , & Color , Rect . x , Rect . y , Rect . w , Rect . h ) ;
2011-07-12 18:33:53 +00:00
Item . m_Rect . HSplitTop ( 2.0f , 0 , & Item . m_Rect ) ;
2015-07-09 00:08:14 +00:00
UI ( ) - > DoLabelScaled ( & Item . m_Rect , r . front ( ) . m_Name , 16.0f , - 1 ) ;
2011-07-12 18:33:53 +00:00
}
2010-12-12 18:20:30 +00:00
}
s_SelectedLanguage = UiDoListboxEnd ( & s_ScrollValue , 0 ) ;
if ( OldSelected ! = s_SelectedLanguage )
{
str_copy ( g_Config . m_ClLanguagefile , s_Languages [ s_SelectedLanguage ] . m_FileName , sizeof ( g_Config . m_ClLanguagefile ) ) ;
g_Localization . Load ( s_Languages [ s_SelectedLanguage ] . m_FileName , Storage ( ) , Console ( ) ) ;
}
}
2010-05-29 07:25:38 +00:00
void CMenus : : RenderSettings ( CUIRect MainView )
2008-08-27 15:48:50 +00:00
{
// render background
2010-10-16 09:27:49 +00:00
CUIRect Temp , TabBar , RestartWarning ;
2010-05-29 07:25:38 +00:00
MainView . VSplitRight ( 120.0f , & MainView , & TabBar ) ;
2019-03-24 22:15:38 +00:00
RenderTools ( ) - > DrawUIRect ( & MainView , ms_ColorTabbarActive , CUI : : CORNER_B , 10.0f ) ;
2015-03-08 17:51:13 +00:00
MainView . Margin ( 10.0f , & MainView ) ;
MainView . HSplitBottom ( 15.0f , & MainView , & RestartWarning ) ;
2010-05-29 07:25:38 +00:00
TabBar . HSplitTop ( 50.0f , & Temp , & TabBar ) ;
2019-03-24 22:15:38 +00:00
RenderTools ( ) - > DrawUIRect ( & Temp , ms_ColorTabbarActive , CUI : : CORNER_BR , 10.0f ) ;
2010-05-29 07:25:38 +00:00
MainView . HSplitTop ( 10.0f , 0 , & MainView ) ;
CUIRect Button ;
const char * aTabs [ ] = {
2011-04-01 17:36:44 +00:00
Localize ( " Language " ) ,
2010-05-29 07:25:38 +00:00
Localize ( " General " ) ,
Localize ( " Player " ) ,
2011-04-01 17:36:44 +00:00
( " Tee " ) ,
2014-07-07 13:47:11 +00:00
Localize ( " HUD " ) ,
2010-05-29 07:25:38 +00:00
Localize ( " Controls " ) ,
Localize ( " Graphics " ) ,
2011-04-09 20:45:34 +00:00
Localize ( " Sound " ) ,
2014-06-27 23:07:41 +00:00
Localize ( " DDNet " )
2014-04-26 18:29:42 +00:00
} ;
2010-05-29 07:25:38 +00:00
int NumTabs = ( int ) ( sizeof ( aTabs ) / sizeof ( * aTabs ) ) ;
for ( int i = 0 ; i < NumTabs ; i + + )
2008-08-27 15:48:50 +00:00
{
2010-05-29 07:25:38 +00:00
TabBar . HSplitTop ( 10 , & Button , & TabBar ) ;
TabBar . HSplitTop ( 26 , & Button , & TabBar ) ;
2019-11-17 17:11:33 +00:00
if ( DoButton_MenuTab ( aTabs [ i ] , aTabs [ i ] , g_Config . m_UiSettingsPage = = i , & Button , CUI : : CORNER_R ) )
g_Config . m_UiSettingsPage = i ;
2008-08-27 15:48:50 +00:00
}
2010-05-29 07:25:38 +00:00
MainView . Margin ( 10.0f , & MainView ) ;
2019-11-17 17:11:33 +00:00
if ( g_Config . m_UiSettingsPage = = SETTINGS_LANGUAGE )
2011-04-01 17:36:44 +00:00
RenderLanguageSelection ( MainView ) ;
2019-11-17 17:11:33 +00:00
else if ( g_Config . m_UiSettingsPage = = SETTINGS_GENERAL )
2011-04-01 17:36:44 +00:00
RenderSettingsGeneral ( MainView ) ;
2019-11-17 17:11:33 +00:00
else if ( g_Config . m_UiSettingsPage = = SETTINGS_PLAYER )
2011-04-01 17:36:44 +00:00
RenderSettingsPlayer ( MainView ) ;
2019-11-17 17:11:33 +00:00
else if ( g_Config . m_UiSettingsPage = = SETTINGS_TEE )
2011-04-01 17:36:44 +00:00
RenderSettingsTee ( MainView ) ;
2019-11-17 17:11:33 +00:00
else if ( g_Config . m_UiSettingsPage = = SETTINGS_HUD )
2014-07-07 13:47:11 +00:00
RenderSettingsHUD ( MainView ) ;
2019-11-17 17:11:33 +00:00
else if ( g_Config . m_UiSettingsPage = = SETTINGS_CONTROLS )
2014-07-07 13:47:11 +00:00
RenderSettingsControls ( MainView ) ;
2019-11-17 17:11:33 +00:00
else if ( g_Config . m_UiSettingsPage = = SETTINGS_GRAPHICS )
2014-07-07 13:47:11 +00:00
RenderSettingsGraphics ( MainView ) ;
2019-11-17 17:11:33 +00:00
else if ( g_Config . m_UiSettingsPage = = SETTINGS_SOUND )
2014-07-07 13:47:11 +00:00
RenderSettingsSound ( MainView ) ;
2019-11-17 17:11:33 +00:00
else if ( g_Config . m_UiSettingsPage = = SETTINGS_DDNET )
2016-05-07 13:59:13 +00:00
RenderSettingsDDNet ( MainView ) ;
2010-05-29 07:25:38 +00:00
2015-03-08 17:51:13 +00:00
if ( m_NeedRestartUpdate )
{
TextRender ( ) - > TextColor ( 1.0f , 0.4f , 0.4f , 1.0f ) ;
2015-06-26 18:44:55 +00:00
UI ( ) - > DoLabelScaled ( & RestartWarning , Localize ( " DDNet Client needs to be restarted to complete update! " ) , 14.0f , - 1 ) ;
2015-03-08 17:51:13 +00:00
TextRender ( ) - > TextColor ( 1.0f , 1.0f , 1.0f , 1.0f ) ;
}
2019-07-18 23:53:27 +00:00
else if ( m_NeedRestartGeneral | | m_NeedRestartSkins | | m_NeedRestartGraphics | | m_NeedRestartSound | | m_NeedRestartDDNet )
2015-03-08 17:51:13 +00:00
UI ( ) - > DoLabelScaled ( & RestartWarning , Localize ( " You must restart the game for all settings to take effect. " ) , 14.0f , - 1 ) ;
2008-08-27 15:48:50 +00:00
}
2017-03-06 09:24:00 +00:00
2020-06-27 13:08:35 +00:00
ColorHSLA CMenus : : RenderHSLScrollbars ( CUIRect * pRect , unsigned int * pColor , bool Alpha )
{
ColorHSLA Color ( * pColor , Alpha ) ;
CUIRect Button , Label ;
2020-06-27 13:08:47 +00:00
char aBuf [ 32 ] ;
2020-06-27 13:08:35 +00:00
float * paComponent [ ] = { & Color . h , & Color . s , & Color . l , & Color . a } ;
const char * aLabels [ ] = { Localize ( " Hue " ) , Localize ( " Sat. " ) , Localize ( " Lht. " ) , Localize ( " Alpha " ) } ;
for ( int i = 0 ; i < 3 + Alpha ; i + + )
{
pRect - > HSplitTop ( 20.0f , & Button , pRect ) ;
Button . VSplitLeft ( 10.0f , 0 , & Button ) ;
Button . VSplitLeft ( 100.0f , & Label , & Button ) ;
Button . HMargin ( 2.0f , & Button ) ;
2020-06-27 17:40:04 +00:00
str_format ( aBuf , sizeof ( aBuf ) , " %s: %03d " , aLabels [ i ] , ( int ) ( * paComponent [ i ] * 255 ) ) ;
2020-06-27 13:08:47 +00:00
UI ( ) - > DoLabelScaled ( & Label , aBuf , 14.0f , - 1 ) ;
2020-06-27 13:08:35 +00:00
* paComponent [ i ] = DoScrollbarH ( & ( ( char * ) pColor ) [ i ] , & Button , * paComponent [ i ] ) ;
}
2020-06-27 17:40:04 +00:00
* pColor = Color . Pack ( Alpha ) ;
2020-06-27 13:08:35 +00:00
return Color ;
}
2014-07-07 13:47:11 +00:00
void CMenus : : RenderSettingsHUD ( CUIRect MainView )
2011-04-09 06:41:31 +00:00
{
2017-02-27 20:56:22 +00:00
static int pIDP1 = 0 , pIDP2 = 0 ;
2017-02-27 20:38:24 +00:00
static int Page = 1 ;
2017-03-10 17:49:39 +00:00
CUIRect Left , Right , HUD , Messages , Button , Label , Weapon , Laser , Page1Tab , Page2Tab , Enable , Heart ;
2011-04-09 06:41:31 +00:00
2014-12-14 16:16:44 +00:00
MainView . HSplitTop ( 150.0f , & HUD , & MainView ) ;
2014-04-15 20:10:46 +00:00
HUD . HSplitTop ( 30.0f , & Label , & HUD ) ;
2020-07-15 19:10:13 +00:00
float tw = TextRender ( ) - > TextWidth ( 0 , 20.0f , Localize ( " HUD " ) , - 1 , - 1.0f ) ;
2017-03-22 11:09:50 +00:00
Label . VSplitLeft ( tw + 10.0f , & Label , & Page1Tab ) ;
2017-02-27 20:38:24 +00:00
Page1Tab . VSplitLeft ( 60.0f , & Page1Tab , 0 ) ;
Page1Tab . VSplitLeft ( 30.0f , & Page1Tab , & Page2Tab ) ;
2014-04-15 20:10:46 +00:00
UI ( ) - > DoLabelScaled ( & Label , Localize ( " HUD " ) , 20.0f , - 1 ) ;
2017-02-27 20:38:24 +00:00
if ( DoButton_MenuTab ( ( void * ) & pIDP1 , " 1 " , Page = = 1 , & Page1Tab , 5 ) )
Page = 1 ;
if ( DoButton_MenuTab ( ( void * ) & pIDP2 , " 2 " , Page = = 2 , & Page2Tab , 10 ) )
Page = 2 ;
2014-04-15 20:10:46 +00:00
HUD . Margin ( 5.0f , & HUD ) ;
HUD . VSplitMid ( & Left , & Right ) ;
Left . VSplitRight ( 5.0f , & Left , 0 ) ;
Right . VMargin ( 5.0f , & Right ) ;
2017-02-27 20:38:24 +00:00
if ( Page = = 1 )
2011-04-09 06:41:31 +00:00
{
2017-02-27 20:38:24 +00:00
// show hud1
Left . HSplitTop ( 20.0f , & Button , & Left ) ;
if ( DoButton_CheckBox ( & g_Config . m_ClShowhud , Localize ( " Show ingame HUD " ) , g_Config . m_ClShowhud , & Button ) )
g_Config . m_ClShowhud ^ = 1 ;
2011-04-09 06:41:31 +00:00
2017-02-27 20:38:24 +00:00
Left . HSplitTop ( 20.0f , & Button , & Left ) ;
2018-03-13 20:59:07 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClDDRaceScoreBoard , Localize ( " Use DDRace Scoreboard " ) , g_Config . m_ClDDRaceScoreBoard , & Button ) )
2017-02-27 20:38:24 +00:00
{
g_Config . m_ClDDRaceScoreBoard ^ = 1 ;
}
2011-04-09 06:41:31 +00:00
2017-02-27 20:38:24 +00:00
Left . HSplitTop ( 20.0f , & Button , & Left ) ;
2018-03-13 20:59:07 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClShowIDs , Localize ( " Show client IDs in Scoreboard " ) , g_Config . m_ClShowIDs , & Button ) )
2017-02-27 20:38:24 +00:00
{
g_Config . m_ClShowIDs ^ = 1 ;
}
2011-04-09 06:41:31 +00:00
2017-02-27 20:38:24 +00:00
Right . HSplitTop ( 20.0f , & Button , & Right ) ;
2018-03-13 20:59:07 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClShowhudScore , Localize ( " Show score " ) , g_Config . m_ClShowhudScore , & Button ) )
2017-02-27 20:38:24 +00:00
{
g_Config . m_ClShowhudScore ^ = 1 ;
}
2011-04-09 06:41:31 +00:00
2017-02-27 20:38:24 +00:00
Right . HSplitTop ( 20.0f , & Button , & Right ) ;
2018-03-13 20:59:07 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClShowhudHealthAmmo , Localize ( " Show health + ammo " ) , g_Config . m_ClShowhudHealthAmmo , & Button ) )
2017-02-27 20:38:24 +00:00
{
g_Config . m_ClShowhudHealthAmmo ^ = 1 ;
}
2011-04-09 06:41:31 +00:00
2017-02-27 20:38:24 +00:00
Left . HSplitTop ( 20.0f , & Button , & Left ) ;
2018-03-13 20:59:07 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClShowChat , Localize ( " Show chat " ) , g_Config . m_ClShowChat , & Button ) )
2017-02-27 20:38:24 +00:00
{
g_Config . m_ClShowChat ^ = 1 ;
}
2011-04-09 06:41:31 +00:00
2017-02-27 20:38:24 +00:00
Right . HSplitTop ( 20.0f , & Button , & Right ) ;
2018-03-13 20:59:07 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClChatTeamColors , Localize ( " Show names in chat in team colors " ) , g_Config . m_ClChatTeamColors , & Button ) )
2014-07-07 13:47:11 +00:00
{
2017-02-27 20:38:24 +00:00
g_Config . m_ClChatTeamColors ^ = 1 ;
2014-07-07 13:47:11 +00:00
}
2017-02-27 20:38:24 +00:00
2014-07-07 13:47:11 +00:00
Left . HSplitTop ( 20.0f , & Button , & Left ) ;
2018-03-13 20:59:07 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClShowKillMessages , Localize ( " Show kill messages " ) , g_Config . m_ClShowKillMessages , & Button ) )
2017-02-27 20:38:24 +00:00
{
g_Config . m_ClShowKillMessages ^ = 1 ;
}
Right . HSplitTop ( 20.0f , & Button , & Right ) ;
2018-03-13 20:59:07 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClShowVotesAfterVoting , Localize ( " Show votes window after voting " ) , g_Config . m_ClShowVotesAfterVoting , & Button ) )
2017-02-27 20:38:24 +00:00
{
g_Config . m_ClShowVotesAfterVoting ^ = 1 ;
}
MainView . HSplitTop ( 170.0f , & Messages , & MainView ) ;
Messages . HSplitTop ( 30.0f , & Label , & Messages ) ;
Label . VSplitMid ( & Label , & Button ) ;
UI ( ) - > DoLabelScaled ( & Label , Localize ( " Messages " ) , 20.0f , - 1 ) ;
Messages . Margin ( 5.0f , & Messages ) ;
Messages . VSplitMid ( & Left , & Right ) ;
Left . VSplitRight ( 5.0f , & Left , 0 ) ;
Right . VMargin ( 5.0f , & Right ) ;
{
char aBuf [ 64 ] ;
Left . HSplitTop ( 20.0f , & Label , & Left ) ;
Label . VSplitRight ( 50.0f , & Label , & Button ) ;
UI ( ) - > DoLabelScaled ( & Label , Localize ( " System message " ) , 16.0f , - 1 ) ;
{
static int s_DefaultButton = 0 ;
2018-03-13 20:59:07 +00:00
if ( DoButton_Menu ( & s_DefaultButton , Localize ( " Reset " ) , 0 , & Button ) )
2017-03-04 14:43:49 +00:00
{
2019-04-25 16:49:27 +00:00
ColorHSLA HSL = color_cast < ColorHSLA > ( ColorRGBA ( 1.0f , 1.0f , 0.5f ) ) ;
2019-07-02 12:54:06 +00:00
g_Config . m_ClMessageSystemColor = HSL . Pack ( false ) ;
2017-02-27 20:38:24 +00:00
}
}
2019-04-25 16:49:27 +00:00
2020-06-27 13:08:35 +00:00
ColorHSLA SMColor = RenderHSLScrollbars ( & Left , & g_Config . m_ClMessageSystemColor ) ;
2014-07-07 13:47:11 +00:00
2017-02-27 20:38:24 +00:00
Left . HSplitTop ( 10.0f , & Label , & Left ) ;
2015-05-20 20:23:58 +00:00
2019-04-25 16:49:27 +00:00
ColorRGBA rgb = color_cast < ColorRGBA > ( SMColor ) ;
2019-04-26 22:34:20 +00:00
TextRender ( ) - > TextColor ( rgb ) ;
2014-07-07 13:47:11 +00:00
2020-08-20 10:19:03 +00:00
char aName [ 16 ] ;
str_copy ( aName , Client ( ) - > PlayerName ( ) , sizeof ( aName ) ) ;
str_format ( aBuf , sizeof ( aBuf ) , " *** '%s' entered and joined the spectators " , aName ) ;
2020-07-15 19:10:13 +00:00
while ( TextRender ( ) - > TextWidth ( 0 , 12.0f , aBuf , - 1 , - 1.0f ) > Label . w )
2017-02-27 20:38:24 +00:00
{
2020-08-20 10:19:03 +00:00
aName [ str_length ( aName ) - 1 ] = 0 ;
str_format ( aBuf , sizeof ( aBuf ) , " *** '%s' entered and joined the spectators " , aName ) ;
2017-02-27 20:38:24 +00:00
}
UI ( ) - > DoLabelScaled ( & Label , aBuf , 12.0f , - 1 ) ;
TextRender ( ) - > TextColor ( 1.0f , 1.0f , 1.0f , 1.0f ) ;
Left . HSplitTop ( 20.0f , 0 , & Left ) ;
2014-07-07 13:47:11 +00:00
}
{
2017-02-27 20:38:24 +00:00
char aBuf [ 64 ] ;
Right . HSplitTop ( 20.0f , & Label , & Right ) ;
Label . VSplitRight ( 50.0f , & Label , & Button ) ;
UI ( ) - > DoLabelScaled ( & Label , Localize ( " Highlighted message " ) , 16.0f , - 1 ) ;
{
static int s_DefaultButton = 0 ;
2018-03-13 20:59:07 +00:00
if ( DoButton_Menu ( & s_DefaultButton , Localize ( " Reset " ) , 0 , & Button ) )
2017-03-04 14:43:49 +00:00
{
2019-04-25 16:49:27 +00:00
ColorHSLA HSL = color_cast < ColorHSLA > ( ColorRGBA ( 1.0f , 0.5f , 0.5f ) ) ;
2019-07-02 12:54:06 +00:00
g_Config . m_ClMessageHighlightColor = HSL . Pack ( false ) ;
2017-03-04 14:43:49 +00:00
}
2014-07-07 13:47:11 +00:00
}
2019-04-25 16:49:27 +00:00
2020-06-27 13:08:35 +00:00
ColorHSLA HMColor = RenderHSLScrollbars ( & Right , & g_Config . m_ClMessageHighlightColor ) ;
2019-04-25 16:49:27 +00:00
2017-02-27 20:38:24 +00:00
Right . HSplitTop ( 10.0f , & Label , & Right ) ;
TextRender ( ) - > TextColor ( 0.75f , 0.5f , 0.75f , 1.0f ) ;
2020-07-15 19:10:13 +00:00
float tw = TextRender ( ) - > TextWidth ( 0 , 12.0f , Localize ( " Spectator " ) , - 1 , - 1.0f ) ;
2017-02-27 20:38:24 +00:00
Label . VSplitLeft ( tw , & Label , & Button ) ;
UI ( ) - > DoLabelScaled ( & Label , Localize ( " Spectator " ) , 12.0f , - 1 ) ;
2019-04-25 16:49:27 +00:00
ColorRGBA rgb = color_cast < ColorRGBA > ( HMColor ) ;
2019-04-26 22:34:20 +00:00
TextRender ( ) - > TextColor ( rgb ) ;
2020-08-20 10:19:03 +00:00
char aName [ 16 ] ;
str_copy ( aName , Client ( ) - > PlayerName ( ) , sizeof ( aName ) ) ;
str_format ( aBuf , sizeof ( aBuf ) , " : %s: %s " , aName , Localize ( " Look out! " ) ) ;
2020-07-15 19:10:13 +00:00
while ( TextRender ( ) - > TextWidth ( 0 , 12.0f , aBuf , - 1 , - 1.0f ) > Button . w )
2017-02-27 20:38:24 +00:00
{
2020-08-20 10:19:03 +00:00
aName [ str_length ( aName ) - 1 ] = 0 ;
str_format ( aBuf , sizeof ( aBuf ) , " : %s: %s " , aName , Localize ( " Look out! " ) ) ;
2017-02-27 20:38:24 +00:00
}
UI ( ) - > DoLabelScaled ( & Button , aBuf , 12.0f , - 1 ) ;
2014-07-07 13:47:11 +00:00
2017-02-27 20:38:24 +00:00
TextRender ( ) - > TextColor ( 1.0f , 1.0f , 1.0f , 1.0f ) ;
Right . HSplitTop ( 20.0f , 0 , & Right ) ;
}
2014-07-07 13:47:11 +00:00
{
2017-02-27 20:38:24 +00:00
char aBuf [ 64 ] ;
Left . HSplitTop ( 20.0f , & Label , & Left ) ;
Label . VSplitRight ( 50.0f , & Label , & Button ) ;
UI ( ) - > DoLabelScaled ( & Label , Localize ( " Team message " ) , 16.0f , - 1 ) ;
{
static int s_DefaultButton = 0 ;
2018-03-13 20:59:07 +00:00
if ( DoButton_Menu ( & s_DefaultButton , Localize ( " Reset " ) , 0 , & Button ) )
2017-03-04 14:43:49 +00:00
{
2019-04-25 16:49:27 +00:00
ColorHSLA HSL = color_cast < ColorHSLA > ( ColorRGBA ( 0.65f , 1.0f , 0.65f ) ) ;
2019-07-02 12:54:06 +00:00
g_Config . m_ClMessageTeamColor = HSL . Pack ( false ) ;
2017-02-27 20:38:24 +00:00
}
2014-07-07 13:47:11 +00:00
}
2019-04-25 16:49:27 +00:00
2020-06-27 13:08:35 +00:00
ColorHSLA TMColor = RenderHSLScrollbars ( & Left , & g_Config . m_ClMessageTeamColor ) ;
2014-07-07 13:47:11 +00:00
2017-02-27 20:38:24 +00:00
Left . HSplitTop ( 10.0f , & Label , & Left ) ;
2014-07-07 13:47:11 +00:00
2019-04-25 16:49:27 +00:00
ColorRGBA rgbn = CalculateNameColor ( TMColor ) ;
2019-04-26 22:34:20 +00:00
TextRender ( ) - > TextColor ( rgbn ) ;
2020-07-15 19:10:13 +00:00
float tw = TextRender ( ) - > TextWidth ( 0 , 12.0f , Localize ( " Player " ) , - 1 , - 1.0f ) ;
2017-02-27 20:38:24 +00:00
Label . VSplitLeft ( tw , & Label , & Button ) ;
UI ( ) - > DoLabelScaled ( & Label , Localize ( " Player " ) , 12.0f , - 1 ) ;
2014-07-07 13:47:11 +00:00
2019-04-25 16:49:27 +00:00
ColorRGBA rgb = color_cast < ColorRGBA > ( TMColor ) ;
2019-04-26 22:34:20 +00:00
TextRender ( ) - > TextColor ( rgb ) ;
2017-02-27 20:38:24 +00:00
str_format ( aBuf , sizeof ( aBuf ) , " : %s! " , Localize ( " We will win " ) ) ;
UI ( ) - > DoLabelScaled ( & Button , aBuf , 12.0f , - 1 ) ;
2014-07-07 13:47:11 +00:00
2017-02-27 20:38:24 +00:00
TextRender ( ) - > TextColor ( 1.0f , 1.0f , 1.0f , 1.0f ) ;
Left . HSplitTop ( 20.0f , 0 , & Left ) ;
}
2017-02-27 20:39:06 +00:00
{
char aBuf [ 64 ] ;
Right . HSplitTop ( 20.0f , & Label , & Right ) ;
Label . VSplitRight ( 50.0f , & Label , & Button ) ;
2020-07-15 19:10:13 +00:00
float twh = TextRender ( ) - > TextWidth ( 0 , 16.0f , Localize ( " Friend message " ) , - 1 , - 1.0f ) ;
2017-02-27 20:56:22 +00:00
Label . VSplitLeft ( twh + 5.0f , & Label , & Enable ) ;
Enable . VSplitLeft ( 20.0f , & Enable , 0 ) ;
2017-10-27 23:21:32 +00:00
UI ( ) - > DoLabelScaled ( & Label , Localize ( " Friend message " ) , 16.0f , - 1 ) ;
2017-02-27 20:39:06 +00:00
{
static int s_DefaultButton = 0 ;
2018-03-13 20:59:07 +00:00
if ( DoButton_Menu ( & s_DefaultButton , Localize ( " Reset " ) , 0 , & Button ) )
2019-07-02 12:54:06 +00:00
g_Config . m_ClMessageFriendColor = ColorHSLA ( 0 , 1 , 145 / 255.0f ) . Pack ( false ) ;
2017-02-27 20:39:06 +00:00
}
2017-02-27 20:56:22 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClMessageFriend , " " , g_Config . m_ClMessageFriend , & Enable ) )
{
g_Config . m_ClMessageFriend ^ = 1 ;
}
2020-06-27 13:08:35 +00:00
ColorHSLA FMColor = RenderHSLScrollbars ( & Right , & g_Config . m_ClMessageFriendColor ) ;
2017-02-27 20:39:06 +00:00
Right . HSplitTop ( 10.0f , & Label , & Right ) ;
2019-04-25 16:49:27 +00:00
ColorRGBA rgbf = color_cast < ColorRGBA > ( FMColor ) ;
2019-04-26 22:34:20 +00:00
TextRender ( ) - > TextColor ( rgbf ) ;
2020-07-15 19:10:13 +00:00
float hw = TextRender ( ) - > TextWidth ( 0 , 12.0f , " ♥ " , - 1 , - 1.0f ) ;
2017-03-10 17:49:39 +00:00
Label . VSplitLeft ( hw , & Heart , & Label ) ;
UI ( ) - > DoLabelScaled ( & Heart , " ♥ " , 12.0f , - 1 ) ;
TextRender ( ) - > TextColor ( 0.8f , 0.8f , 0.8f , 1.0f ) ;
2020-07-15 19:10:13 +00:00
float tw = TextRender ( ) - > TextWidth ( 0 , 12.0f , Localize ( " Friend " ) , - 1 , - 1.0f ) ;
2017-02-27 20:39:06 +00:00
Label . VSplitLeft ( tw , & Label , & Button ) ;
2017-03-10 17:49:39 +00:00
UI ( ) - > DoLabelScaled ( & Label , Localize ( " Friend " ) , 12.0f , - 1 ) ;
2017-02-27 20:39:06 +00:00
2020-06-27 13:08:35 +00:00
ColorRGBA rgb = color_cast < ColorRGBA > ( FMColor ) ;
2019-04-26 22:34:20 +00:00
TextRender ( ) - > TextColor ( rgb ) ;
2017-03-10 17:49:39 +00:00
str_format ( aBuf , sizeof ( aBuf ) , " : %s " , Localize ( " Hi o/ " ) ) ;
2017-02-27 20:39:06 +00:00
UI ( ) - > DoLabelScaled ( & Button , aBuf , 12.0f , - 1 ) ;
TextRender ( ) - > TextColor ( 1.0f , 1.0f , 1.0f , 1.0f ) ;
Right . HSplitTop ( 20.0f , 0 , & Right ) ;
}
2014-07-07 13:47:11 +00:00
{
2017-02-27 20:38:24 +00:00
char aBuf [ 64 ] ;
Left . HSplitTop ( 20.0f , & Label , & Left ) ;
Label . VSplitRight ( 50.0f , & Label , & Button ) ;
UI ( ) - > DoLabelScaled ( & Label , Localize ( " Normal message " ) , 16.0f , - 1 ) ;
{
static int s_DefaultButton = 0 ;
2018-03-13 20:59:07 +00:00
if ( DoButton_Menu ( & s_DefaultButton , Localize ( " Reset " ) , 0 , & Button ) )
2017-03-04 14:43:49 +00:00
{
2019-04-25 16:49:27 +00:00
ColorHSLA HSL = color_cast < ColorHSLA > ( ColorRGBA ( 1.0f , 1.0f , 1.0f ) ) ;
2019-07-02 12:54:06 +00:00
g_Config . m_ClMessageColor = HSL . Pack ( false ) ;
2017-02-27 20:38:24 +00:00
}
2014-07-07 13:47:11 +00:00
}
2019-04-25 16:49:27 +00:00
2020-06-27 13:08:35 +00:00
ColorHSLA MColor = RenderHSLScrollbars ( & Left , & g_Config . m_ClMessageColor ) ;
2019-04-25 16:49:27 +00:00
2017-02-27 20:38:24 +00:00
Left . HSplitTop ( 10.0f , & Label , & Left ) ;
2014-07-07 13:47:11 +00:00
2017-02-27 20:38:24 +00:00
TextRender ( ) - > TextColor ( 0.8f , 0.8f , 0.8f , 1.0f ) ;
2020-07-15 19:10:13 +00:00
float tw = TextRender ( ) - > TextWidth ( 0 , 12.0f , Localize ( " Player " ) , - 1 , - 1.0f ) ;
2017-02-27 20:38:24 +00:00
Label . VSplitLeft ( tw , & Label , & Button ) ;
UI ( ) - > DoLabelScaled ( & Label , Localize ( " Player " ) , 12.0f , - 1 ) ;
2014-07-07 13:47:11 +00:00
2019-04-25 16:49:27 +00:00
ColorRGBA rgb = color_cast < ColorRGBA > ( MColor ) ;
2019-04-26 22:34:20 +00:00
TextRender ( ) - > TextColor ( rgb ) ;
2017-02-27 20:38:24 +00:00
str_format ( aBuf , sizeof ( aBuf ) , " : %s :D " , Localize ( " Hello and welcome " ) ) ;
UI ( ) - > DoLabelScaled ( & Button , aBuf , 12.0f , - 1 ) ;
2014-07-07 13:47:11 +00:00
2017-02-27 20:38:24 +00:00
TextRender ( ) - > TextColor ( 1.0f , 1.0f , 1.0f , 1.0f ) ;
}
2020-08-05 10:39:13 +00:00
{
char aBuf [ 64 ] ;
Right . HSplitTop ( 20.0f , & Label , & Right ) ;
Label . VSplitRight ( 50.0f , & Label , & Button ) ;
str_format ( aBuf , sizeof ( aBuf ) , " %s (echo) " , Localize ( " Client message " ) ) ;
UI ( ) - > DoLabelScaled ( & Label , aBuf , 16.0f , - 1 ) ;
{
static int s_DefaultButton = 0 ;
if ( DoButton_Menu ( & s_DefaultButton , Localize ( " Reset " ) , 0 , & Button ) )
{
ColorHSLA HSL = color_cast < ColorHSLA > ( ColorRGBA ( 0.5f , 0.78f , 1.0f ) ) ;
g_Config . m_ClMessageClientColor = HSL . Pack ( false ) ;
}
}
ColorHSLA CMColor = RenderHSLScrollbars ( & Right , & g_Config . m_ClMessageClientColor ) ;
Right . HSplitTop ( 10.0f , & Label , & Right ) ;
ColorRGBA rgb = color_cast < ColorRGBA > ( CMColor ) ;
TextRender ( ) - > TextColor ( rgb ) ;
UI ( ) - > DoLabelScaled ( & Label , " *** Dynamic camera activated " , 12.0f , - 1 ) ;
TextRender ( ) - > TextColor ( 1.0f , 1.0f , 1.0f , 1.0f ) ;
Right . HSplitTop ( 20.0f , 0 , & Right ) ;
}
2014-07-07 13:47:11 +00:00
}
2017-02-27 20:38:24 +00:00
else if ( Page = = 2 )
2014-07-07 13:47:11 +00:00
{
2017-02-27 20:38:24 +00:00
Left . HSplitTop ( 220.0f , & Laser , & Left ) ;
//RenderTools()->DrawUIRect(&Laser, vec4(1.0f, 1.0f, 1.0f, 0.1f), CUI::CORNER_ALL, 5.0f);
//Laser.Margin(10.0f, &Laser);
2014-07-07 13:47:11 +00:00
Laser . HSplitTop ( 30.0f , & Label , & Laser ) ;
2020-07-15 19:10:13 +00:00
Label . VSplitLeft ( TextRender ( ) - > TextWidth ( 0 , 20.0f , Localize ( " Laser " ) , - 1 , - 1.0f ) + 5.0f , & Label , & Weapon ) ;
2014-07-07 13:47:11 +00:00
UI ( ) - > DoLabelScaled ( & Label , Localize ( " Laser " ) , 20.0f , - 1 ) ;
Laser . HSplitTop ( 20.0f , & Label , & Laser ) ;
Label . VSplitLeft ( 5.0f , 0 , & Label ) ;
Label . VSplitRight ( 50.0f , & Label , & Button ) ;
UI ( ) - > DoLabelScaled ( & Label , Localize ( " Inner color " ) , 16.0f , - 1 ) ;
{
static int s_DefaultButton = 0 ;
2018-03-13 20:59:07 +00:00
if ( DoButton_Menu ( & s_DefaultButton , Localize ( " Reset " ) , 0 , & Button ) )
2017-03-04 14:43:49 +00:00
{
2019-04-25 16:49:27 +00:00
ColorHSLA HSL = color_cast < ColorHSLA > ( ColorRGBA ( 0.5f , 0.5f , 1.0f ) ) ;
2019-07-02 12:54:06 +00:00
g_Config . m_ClLaserInnerColor = HSL . Pack ( false ) ;
2014-07-07 13:47:11 +00:00
}
}
2020-06-27 13:08:35 +00:00
ColorHSLA LIColor = RenderHSLScrollbars ( & Laser , & g_Config . m_ClLaserInnerColor ) ;
2019-04-25 16:49:27 +00:00
2014-07-07 13:47:11 +00:00
Laser . HSplitTop ( 10.0f , 0 , & Laser ) ;
Laser . HSplitTop ( 20.0f , & Label , & Laser ) ;
Label . VSplitLeft ( 5.0f , 0 , & Label ) ;
Label . VSplitRight ( 50.0f , & Label , & Button ) ;
UI ( ) - > DoLabelScaled ( & Label , Localize ( " Outline color " ) , 16.0f , - 1 ) ;
{
static int s_DefaultButton = 0 ;
2018-03-13 20:59:07 +00:00
if ( DoButton_Menu ( & s_DefaultButton , Localize ( " Reset " ) , 0 , & Button ) )
2017-03-04 14:43:49 +00:00
{
2019-04-25 16:49:27 +00:00
ColorHSLA HSL = color_cast < ColorHSLA > ( ColorRGBA ( 0.075f , 0.075f , 0.25f ) ) ;
2019-07-02 12:54:06 +00:00
g_Config . m_ClLaserOutlineColor = HSL . Pack ( false ) ;
2014-07-07 13:47:11 +00:00
}
}
2020-06-27 13:08:35 +00:00
ColorHSLA LOColor = RenderHSLScrollbars ( & Laser , & g_Config . m_ClLaserOutlineColor ) ;
2019-04-25 16:49:27 +00:00
2014-07-07 13:47:11 +00:00
Weapon . VSplitLeft ( 30.0f , 0 , & Weapon ) ;
2019-04-25 16:49:27 +00:00
ColorRGBA RGB ;
2014-07-07 13:47:11 +00:00
vec2 From = vec2 ( Weapon . x , Weapon . y + Weapon . h / 2.0f ) ;
vec2 Pos = vec2 ( Weapon . x + Weapon . w - 10.0f , Weapon . y + Weapon . h / 2.0f ) ;
vec2 Out , Border ;
Graphics ( ) - > BlendNormal ( ) ;
2012-08-12 10:41:50 +00:00
Graphics ( ) - > TextureClear ( ) ;
2014-07-07 13:47:11 +00:00
Graphics ( ) - > QuadsBegin ( ) ;
// do outline
2020-06-27 13:08:35 +00:00
RGB = color_cast < ColorRGBA > ( LOColor ) ;
2019-04-26 22:11:15 +00:00
ColorRGBA OuterColor ( RGB . r , RGB . g , RGB . b , 1.0f ) ;
2014-07-07 13:47:11 +00:00
Graphics ( ) - > SetColor ( RGB . r , RGB . g , RGB . b , 1.0f ) ; // outline
Out = vec2 ( 0.0f , - 1.0f ) * ( 3.15f ) ;
IGraphics : : CFreeformItem Freeform (
From . x - Out . x , From . y - Out . y ,
From . x + Out . x , From . y + Out . y ,
Pos . x - Out . x , Pos . y - Out . y ,
Pos . x + Out . x , Pos . y + Out . y ) ;
Graphics ( ) - > QuadsDrawFreeform ( & Freeform , 1 ) ;
2015-05-20 20:23:58 +00:00
// do inner
2020-06-27 13:08:35 +00:00
RGB = color_cast < ColorRGBA > ( LIColor ) ;
2019-04-26 22:11:15 +00:00
ColorRGBA InnerColor ( RGB . r , RGB . g , RGB . b , 1.0f ) ;
2014-07-07 13:47:11 +00:00
Out = vec2 ( 0.0f , - 1.0f ) * ( 2.25f ) ;
Graphics ( ) - > SetColor ( InnerColor . r , InnerColor . g , InnerColor . b , 1.0f ) ; // center
Freeform = IGraphics : : CFreeformItem (
From . x - Out . x , From . y - Out . y ,
From . x + Out . x , From . y + Out . y ,
Pos . x - Out . x , Pos . y - Out . y ,
Pos . x + Out . x , Pos . y + Out . y ) ;
Graphics ( ) - > QuadsDrawFreeform ( & Freeform , 1 ) ;
Graphics ( ) - > QuadsEnd ( ) ;
// render head
{
Graphics ( ) - > BlendNormal ( ) ;
Graphics ( ) - > TextureSet ( g_pData - > m_aImages [ IMAGE_PARTICLES ] . m_Id ) ;
Graphics ( ) - > QuadsBegin ( ) ;
int Sprites [ ] = { SPRITE_PART_SPLAT01 , SPRITE_PART_SPLAT02 , SPRITE_PART_SPLAT03 } ;
RenderTools ( ) - > SelectSprite ( Sprites [ time_get ( ) % 3 ] ) ;
Graphics ( ) - > QuadsSetRotation ( time_get ( ) ) ;
Graphics ( ) - > SetColor ( OuterColor . r , OuterColor . g , OuterColor . b , 1.0f ) ;
IGraphics : : CQuadItem QuadItem ( Pos . x , Pos . y , 24 , 24 ) ;
Graphics ( ) - > QuadsDraw ( & QuadItem , 1 ) ;
Graphics ( ) - > SetColor ( InnerColor . r , InnerColor . g , InnerColor . b , 1.0f ) ;
QuadItem = IGraphics : : CQuadItem ( Pos . x , Pos . y , 20 , 20 ) ;
Graphics ( ) - > QuadsDraw ( & QuadItem , 1 ) ;
Graphics ( ) - > QuadsEnd ( ) ;
}
// draw laser weapon
Graphics ( ) - > TextureSet ( g_pData - > m_aImages [ IMAGE_GAME ] . m_Id ) ;
Graphics ( ) - > QuadsBegin ( ) ;
2019-11-22 14:37:18 +00:00
RenderTools ( ) - > SelectSprite ( SPRITE_WEAPON_LASER_BODY ) ;
2014-07-07 13:47:11 +00:00
RenderTools ( ) - > DrawSprite ( Weapon . x , Weapon . y + Weapon . h / 2.0f , 60.0f ) ;
Graphics ( ) - > QuadsEnd ( ) ;
}
/*
Left . VSplitLeft ( 20.0f , 0 , & Left ) ;
Left . HSplitTop ( 20.0f , & Label , & Left ) ;
Button . VSplitRight ( 20.0f , & Button , 0 ) ;
char aBuf [ 64 ] ;
2018-03-13 20:59:07 +00:00
if ( g_Config . m_ClReconnectTimeout = = 1 )
2014-07-07 13:47:11 +00:00
{
2016-05-01 09:12:07 +00:00
str_format ( aBuf , sizeof ( aBuf ) , " %s %i %s " , Localize ( " Wait before try for " ) , g_Config . m_ClReconnectTimeout , Localize ( " second " ) ) ;
2014-07-07 13:47:11 +00:00
}
else
{
2016-05-01 09:12:07 +00:00
str_format ( aBuf , sizeof ( aBuf ) , " %s %i %s " , Localize ( " Wait before try for " ) , g_Config . m_ClReconnectTimeout , Localize ( " seconds " ) ) ;
2014-07-07 13:47:11 +00:00
}
UI ( ) - > DoLabelScaled ( & Label , aBuf , 13.0f , - 1 ) ;
Left . HSplitTop ( 20.0f , & Button , 0 ) ;
Button . HMargin ( 2.0f , & Button ) ;
2016-05-01 09:12:07 +00:00
g_Config . m_ClReconnectTimeout = static_cast < int > ( DoScrollbarH ( & g_Config . m_ClReconnectTimeout , & Button , g_Config . m_ClReconnectTimeout / 120.0f ) * 120.0f ) ;
2018-03-13 20:59:07 +00:00
if ( g_Config . m_ClReconnectTimeout < 5 )
2016-05-01 09:12:07 +00:00
g_Config . m_ClReconnectTimeout = 5 ; */
2014-07-07 13:47:11 +00:00
}
2016-05-07 13:59:13 +00:00
void CMenus : : RenderSettingsDDNet ( CUIRect MainView )
2014-07-07 13:47:11 +00:00
{
2015-08-27 07:10:13 +00:00
CUIRect Button , Left , Right , LeftLeft , Demo , Gameplay , Miscellaneous , Label , Background ;
2011-04-09 06:41:31 +00:00
2016-05-07 13:59:13 +00:00
bool CheckSettings = false ;
static int s_InpMouseOld = g_Config . m_InpMouseOld ;
2014-12-14 16:16:44 +00:00
MainView . HSplitTop ( 100.0f , & Demo , & MainView ) ;
2011-04-09 06:41:31 +00:00
2014-04-15 20:10:46 +00:00
Demo . HSplitTop ( 30.0f , & Label , & Demo ) ;
UI ( ) - > DoLabelScaled ( & Label , Localize ( " Demo " ) , 20.0f , - 1 ) ;
Demo . Margin ( 5.0f , & Demo ) ;
Demo . VSplitMid ( & Left , & Right ) ;
Left . VSplitRight ( 5.0f , & Left , 0 ) ;
Right . VMargin ( 5.0f , & Right ) ;
Left . HSplitTop ( 20.0f , & Button , & Left ) ;
if ( DoButton_CheckBox ( & g_Config . m_ClAutoRaceRecord , Localize ( " Save the best demo of each race " ) , g_Config . m_ClAutoRaceRecord , & Button ) )
2011-04-17 17:14:49 +00:00
{
2014-04-15 20:10:46 +00:00
g_Config . m_ClAutoRaceRecord ^ = 1 ;
2011-04-17 17:14:49 +00:00
}
2013-08-30 07:50:05 +00:00
2019-05-20 21:55:40 +00:00
{
2019-05-21 21:59:57 +00:00
CUIRect Button , Label ;
Left . HSplitTop ( 20.0f , & Button , & Left ) ;
2019-06-05 17:17:55 +00:00
Button . VSplitLeft ( 160.0f , & LeftLeft , & Button ) ;
2019-05-21 21:59:57 +00:00
2019-06-05 17:17:55 +00:00
Button . VSplitLeft ( 140.0f , & Label , & Button ) ;
2019-05-21 21:59:57 +00:00
Button . HMargin ( 2.0f , & Button ) ;
char aBuf [ 256 ] ;
2019-06-05 17:17:55 +00:00
str_format ( aBuf , sizeof ( aBuf ) , Localize ( " Default length: %d " ) , g_Config . m_ClReplayLength ) ;
2019-05-21 21:59:57 +00:00
UI ( ) - > DoLabelScaled ( & Label , aBuf , 14.0f , - 1 ) ;
2019-06-05 17:17:55 +00:00
int NewValue = ( int ) ( DoScrollbarH ( & g_Config . m_ClReplayLength , & Button , ( minimum ( g_Config . m_ClReplayLength , 600 ) - 10 ) / 590.0f ) * 590.0f ) + 10 ;
if ( g_Config . m_ClReplayLength < 600 | | NewValue < 600 )
g_Config . m_ClReplayLength = minimum ( NewValue , 600 ) ;
2019-05-21 21:59:57 +00:00
2019-06-05 17:17:55 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClReplays , Localize ( " Enable replays " ) , g_Config . m_ClReplays , & LeftLeft ) )
2019-05-21 15:21:53 +00:00
{
2019-06-05 17:17:55 +00:00
g_Config . m_ClReplays ^ = 1 ;
if ( ! g_Config . m_ClReplays )
2019-05-21 21:59:57 +00:00
{
// stop recording and remove the tmp demo file
Client ( ) - > DemoRecorder_Stop ( RECORDER_REPLAYS , true ) ;
}
else
{
// start recording
Client ( ) - > DemoRecorder_HandleAutoStart ( ) ;
}
2019-05-21 15:21:53 +00:00
}
2019-05-20 21:55:40 +00:00
}
2014-04-15 20:10:46 +00:00
Right . HSplitTop ( 20.0f , & Button , & Right ) ;
if ( DoButton_CheckBox ( & g_Config . m_ClRaceGhost , Localize ( " Ghost " ) , g_Config . m_ClRaceGhost , & Button ) )
2013-10-09 14:02:23 +00:00
{
2014-04-15 20:10:46 +00:00
g_Config . m_ClRaceGhost ^ = 1 ;
2013-10-09 14:02:23 +00:00
}
2014-12-14 16:16:44 +00:00
if ( g_Config . m_ClRaceGhost )
2013-10-15 16:08:06 +00:00
{
2014-12-14 16:16:44 +00:00
Right . HSplitTop ( 20.0f , & Button , & Right ) ;
if ( DoButton_CheckBox ( & g_Config . m_ClRaceShowGhost , Localize ( " Show ghost " ) , g_Config . m_ClRaceShowGhost , & Button ) )
{
g_Config . m_ClRaceShowGhost ^ = 1 ;
}
2013-10-15 16:08:06 +00:00
2014-12-14 16:16:44 +00:00
Right . HSplitTop ( 20.0f , & Button , & Right ) ;
if ( DoButton_CheckBox ( & g_Config . m_ClRaceSaveGhost , Localize ( " Save ghost " ) , g_Config . m_ClRaceSaveGhost , & Button ) )
{
g_Config . m_ClRaceSaveGhost ^ = 1 ;
}
2013-11-02 02:09:56 +00:00
}
2020-06-28 08:20:07 +00:00
MainView . HSplitTop ( 310.0f , & Gameplay , & MainView ) ;
2014-04-15 20:10:46 +00:00
Gameplay . HSplitTop ( 30.0f , & Label , & Gameplay ) ;
UI ( ) - > DoLabelScaled ( & Label , Localize ( " Gameplay " ) , 20.0f , - 1 ) ;
Gameplay . Margin ( 5.0f , & Gameplay ) ;
Gameplay . VSplitMid ( & Left , & Right ) ;
Left . VSplitRight ( 5.0f , & Left , 0 ) ;
Right . VMargin ( 5.0f , & Right ) ;
2013-11-02 02:09:56 +00:00
{
2014-05-01 15:44:35 +00:00
CUIRect Button , Label ;
Left . HSplitTop ( 20.0f , & Button , & Left ) ;
2014-05-01 16:17:39 +00:00
Button . VSplitLeft ( 120.0f , & Label , & Button ) ;
2014-05-01 15:44:35 +00:00
Button . HMargin ( 2.0f , & Button ) ;
UI ( ) - > DoLabelScaled ( & Label , Localize ( " Overlay entities " ) , 14.0f , - 1 ) ;
g_Config . m_ClOverlayEntities = ( int ) ( DoScrollbarH ( & g_Config . m_ClOverlayEntities , & Button , g_Config . m_ClOverlayEntities / 100.0f ) * 100.0f ) ;
2013-11-02 02:09:56 +00:00
}
2019-10-02 11:54:52 +00:00
{
CUIRect Button , Label ;
Left . HSplitTop ( 20.0f , & Button , & Left ) ;
Button . VSplitMid ( & LeftLeft , & Button ) ;
Button . VSplitLeft ( 50.0f , & Label , & Button ) ;
Button . HMargin ( 2.0f , & Button ) ;
UI ( ) - > DoLabelScaled ( & Label , Localize ( " Size " ) , 14.0f , - 1 ) ;
g_Config . m_ClTextEntitiesSize = ( int ) ( DoScrollbarH ( & g_Config . m_ClTextEntitiesSize , & Button , g_Config . m_ClTextEntitiesSize / 100.0f ) * 100.0f ) ;
if ( DoButton_CheckBox ( & g_Config . m_ClTextEntities , Localize ( " Show text entities " ) , g_Config . m_ClTextEntities , & LeftLeft ) )
{
g_Config . m_ClTextEntities ^ = 1 ;
}
}
2013-11-14 15:23:15 +00:00
{
2014-05-17 21:00:52 +00:00
CUIRect Button , Label ;
Left . HSplitTop ( 20.0f , & Button , & Left ) ;
2014-05-24 22:59:52 +00:00
Button . VSplitMid ( & LeftLeft , & Button ) ;
2015-01-03 02:13:21 +00:00
Button . VSplitLeft ( 50.0f , & Label , & Button ) ;
2014-05-17 21:00:52 +00:00
Button . HMargin ( 2.0f , & Button ) ;
2014-05-24 22:59:52 +00:00
UI ( ) - > DoLabelScaled ( & Label , Localize ( " Alpha " ) , 14.0f , - 1 ) ;
2014-05-17 21:00:52 +00:00
g_Config . m_ClShowOthersAlpha = ( int ) ( DoScrollbarH ( & g_Config . m_ClShowOthersAlpha , & Button , g_Config . m_ClShowOthersAlpha / 100.0f ) * 100.0f ) ;
2014-05-24 22:59:52 +00:00
2020-06-28 08:20:07 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClShowOthers , Localize ( " Show others " ) , g_Config . m_ClShowOthers = = 1 , & LeftLeft ) )
2014-05-24 22:59:52 +00:00
{
2020-06-28 08:20:07 +00:00
g_Config . m_ClShowOthers = g_Config . m_ClShowOthers ! = 1 ? 1 : 0 ;
2014-05-24 22:59:52 +00:00
}
2013-11-14 15:23:15 +00:00
}
2020-06-28 08:20:07 +00:00
Left . HSplitTop ( 20.0f , & Button , & Left ) ;
bool ShowOwnTeam = g_Config . m_ClShowOthers = = 2 ;
if ( DoButton_CheckBox ( & ShowOwnTeam , Localize ( " Show others (own team only) " ) , ShowOwnTeam , & Button ) )
{
g_Config . m_ClShowOthers = g_Config . m_ClShowOthers ! = 2 ? 2 : 0 ;
}
2014-04-15 20:10:46 +00:00
Left . HSplitTop ( 20.0f , & Button , & Left ) ;
2014-04-26 18:29:42 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClShowQuads , Localize ( " Show quads " ) , g_Config . m_ClShowQuads , & Button ) )
2014-01-15 14:25:13 +00:00
{
2014-04-15 20:10:46 +00:00
g_Config . m_ClShowQuads ^ = 1 ;
2014-01-15 14:25:13 +00:00
}
2015-01-03 02:13:21 +00:00
Right . HSplitTop ( 20.0f , & Label , & Right ) ;
Label . VSplitLeft ( 130.0f , & Label , & Button ) ;
char aBuf [ 64 ] ;
str_format ( aBuf , sizeof ( aBuf ) , " %s: %i " , Localize ( " Default zoom " ) , g_Config . m_ClDefaultZoom ) ;
UI ( ) - > DoLabelScaled ( & Label , aBuf , 14.0f , - 1 ) ;
//Right.HSplitTop(20.0f, &Button, 0);
Button . HMargin ( 2.0f , & Button ) ;
g_Config . m_ClDefaultZoom = static_cast < int > ( DoScrollbarH ( & g_Config . m_ClDefaultZoom , & Button , g_Config . m_ClDefaultZoom / 20.0f ) * 20.0f + 0.1f ) ;
2015-06-21 16:00:09 +00:00
Right . HSplitTop ( 20.0f , & Label , & Right ) ;
Label . VSplitLeft ( 130.0f , & Label , & Button ) ;
str_format ( aBuf , sizeof ( aBuf ) , " %s: %i " , Localize ( " AntiPing limit " ) , g_Config . m_ClAntiPingLimit ) ;
UI ( ) - > DoLabelScaled ( & Label , aBuf , 14.0f , - 1 ) ;
//Right.HSplitTop(20.0f, &Button, 0);
Button . HMargin ( 2.0f , & Button ) ;
g_Config . m_ClAntiPingLimit = static_cast < int > ( DoScrollbarH ( & g_Config . m_ClAntiPingLimit , & Button , g_Config . m_ClAntiPingLimit / 200.0f ) * 200.0f + 0.1f ) ;
2014-04-15 20:10:46 +00:00
Right . HSplitTop ( 20.0f , & Button , & Right ) ;
2014-12-08 12:49:39 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClAntiPing , Localize ( " AntiPing " ) , g_Config . m_ClAntiPing , & Button ) )
2014-01-13 23:25:25 +00:00
{
2014-04-15 20:10:46 +00:00
g_Config . m_ClAntiPing ^ = 1 ;
2014-01-13 23:25:25 +00:00
}
2014-12-14 16:16:44 +00:00
if ( g_Config . m_ClAntiPing )
2014-03-21 13:01:14 +00:00
{
2014-12-14 16:16:44 +00:00
Right . HSplitTop ( 20.0f , & Button , & Right ) ;
if ( DoButton_CheckBox ( & g_Config . m_ClAntiPingPlayers , Localize ( " AntiPing: predict other players " ) , g_Config . m_ClAntiPingPlayers , & Button ) )
{
g_Config . m_ClAntiPingPlayers ^ = 1 ;
}
2014-03-21 13:01:14 +00:00
2014-12-14 16:16:44 +00:00
Right . HSplitTop ( 20.0f , & Button , & Right ) ;
if ( DoButton_CheckBox ( & g_Config . m_ClAntiPingWeapons , Localize ( " AntiPing: predict weapons " ) , g_Config . m_ClAntiPingWeapons , & Button ) )
{
g_Config . m_ClAntiPingWeapons ^ = 1 ;
}
2014-03-28 12:39:30 +00:00
2014-12-14 16:16:44 +00:00
Right . HSplitTop ( 20.0f , & Button , & Right ) ;
if ( DoButton_CheckBox ( & g_Config . m_ClAntiPingGrenade , Localize ( " AntiPing: predict grenade paths " ) , g_Config . m_ClAntiPingGrenade , & Button ) )
{
g_Config . m_ClAntiPingGrenade ^ = 1 ;
}
2014-05-06 14:25:00 +00:00
}
2014-12-14 16:16:44 +00:00
else
2014-09-29 19:13:35 +00:00
{
2014-12-14 16:16:44 +00:00
Right . HSplitTop ( 60.0f , 0 , & Right ) ;
2014-09-29 19:13:35 +00:00
}
2020-06-28 08:20:07 +00:00
Right . HSplitTop ( 20.0f , 0 , & Right ) ;
2014-04-15 20:10:46 +00:00
Left . HSplitTop ( 20.0f , & Button , & Left ) ;
2017-05-14 10:03:09 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClShowHookCollOther , Localize ( " Show other players' hook collision lines " ) , g_Config . m_ClShowHookCollOther , & Button ) )
2014-04-10 18:33:05 +00:00
{
2017-05-14 10:03:09 +00:00
g_Config . m_ClShowHookCollOther ^ = 1 ;
2014-04-10 18:33:05 +00:00
}
2014-04-26 19:00:14 +00:00
Left . HSplitTop ( 20.0f , & Button , & Left ) ;
2014-04-26 19:11:00 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClShowDirection , Localize ( " Show other players' key presses " ) , g_Config . m_ClShowDirection , & Button ) )
2014-04-26 19:00:14 +00:00
{
g_Config . m_ClShowDirection ^ = 1 ;
}
2015-06-21 22:34:10 +00:00
Left . HSplitTop ( 20.0f , & Button , & Left ) ;
2016-05-07 13:59:13 +00:00
if ( DoButton_CheckBox ( & g_Config . m_InpMouseOld , Localize ( " Old mouse mode " ) , g_Config . m_InpMouseOld , & Button ) )
{
g_Config . m_InpMouseOld ^ = 1 ;
CheckSettings = true ;
}
if ( CheckSettings )
2019-07-19 00:06:33 +00:00
m_NeedRestartDDNet = s_InpMouseOld ! = g_Config . m_InpMouseOld ;
2015-06-21 22:34:10 +00:00
2013-08-30 07:50:05 +00:00
CUIRect aRects [ 2 ] ;
2014-04-15 20:10:46 +00:00
Left . HSplitTop ( 5.0f , & Button , & Left ) ;
2019-10-02 11:54:52 +00:00
Right . HSplitTop ( 25.0f , & Button , & Right ) ;
2014-04-15 20:10:46 +00:00
aRects [ 0 ] = Left ;
aRects [ 1 ] = Right ;
2013-08-30 07:50:05 +00:00
aRects [ 0 ] . VSplitRight ( 10.0f , & aRects [ 0 ] , 0 ) ;
aRects [ 1 ] . VSplitLeft ( 10.0f , 0 , & aRects [ 1 ] ) ;
2020-06-27 13:08:35 +00:00
unsigned * paColors [ 2 ] = { & g_Config . m_ClBackgroundColor , & g_Config . m_ClBackgroundEntitiesColor } ;
const char * paParts [ 2 ] = { Localize ( " Background (regular) " ) , Localize ( " Background (entities) " ) } ;
2013-08-30 07:50:05 +00:00
for ( int i = 0 ; i < 2 ; i + + )
{
aRects [ i ] . HSplitTop ( 20.0f , & Label , & aRects [ i ] ) ;
UI ( ) - > DoLabelScaled ( & Label , paParts [ i ] , 14.0f , - 1 ) ;
2020-06-27 13:08:35 +00:00
aRects [ i ] . VSplitLeft ( 10.0f , 0 , & aRects [ i ] ) ;
2013-08-30 07:50:05 +00:00
aRects [ i ] . HSplitTop ( 2.5f , 0 , & aRects [ i ] ) ;
2020-06-27 13:08:35 +00:00
RenderHSLScrollbars ( & aRects [ i ] , paColors [ i ] ) ;
2013-08-30 07:50:05 +00:00
}
2016-05-03 22:24:54 +00:00
2015-08-27 07:10:13 +00:00
{
2015-08-27 14:20:16 +00:00
static float s_Map = 0.0f ;
aRects [ 1 ] . HSplitTop ( 25.0f , & Background , & aRects [ 1 ] ) ;
2015-08-27 07:10:13 +00:00
Background . HSplitTop ( 20.0f , & Background , 0 ) ;
2015-08-27 14:20:16 +00:00
Background . VSplitLeft ( 100.0f , & Label , & Left ) ;
UI ( ) - > DoLabelScaled ( & Label , Localize ( " Map " ) , 14.0f , - 1 ) ;
2015-08-28 18:26:39 +00:00
DoEditBox ( g_Config . m_ClBackgroundEntities , & Left , g_Config . m_ClBackgroundEntities , sizeof ( g_Config . m_ClBackgroundEntities ) , 14.0f , & s_Map ) ;
2015-08-27 14:20:16 +00:00
aRects [ 1 ] . HSplitTop ( 20.0f , & Button , 0 ) ;
2015-08-28 18:26:39 +00:00
if ( DoButton_CheckBox ( & g_Config . m_ClBackgroundShowTilesLayers , Localize ( " Show tiles layers from BG map " ) , g_Config . m_ClBackgroundShowTilesLayers , & Button ) )
2015-08-27 07:10:13 +00:00
{
g_Config . m_ClBackgroundShowTilesLayers ^ = 1 ;
}
}
2016-05-03 22:24:54 +00:00
2014-04-15 20:10:46 +00:00
MainView . HSplitTop ( 30.0f , & Label , & Miscellaneous ) ;
UI ( ) - > DoLabelScaled ( & Label , Localize ( " Miscellaneous " ) , 20.0f , - 1 ) ;
2014-04-27 22:23:04 +00:00
Miscellaneous . VMargin ( 5.0f , & Miscellaneous ) ;
2014-04-15 20:10:46 +00:00
Miscellaneous . VSplitMid ( & Left , & Right ) ;
Left . VSplitRight ( 5.0f , & Left , 0 ) ;
Right . VMargin ( 5.0f , & Right ) ;
2014-05-24 19:46:42 +00:00
2015-01-19 23:21:28 +00:00
Left . HSplitTop ( 20.0f , & Button , & Left ) ;
if ( DoButton_CheckBox ( & g_Config . m_ClHttpMapDownload , Localize ( " Try fast HTTP map download first " ) , g_Config . m_ClHttpMapDownload , & Button ) )
{
g_Config . m_ClHttpMapDownload ^ = 1 ;
}
2017-09-03 15:36:51 +00:00
// Updater
2018-12-04 16:59:42 +00:00
# if defined(CONF_AUTOUPDATE)
2015-03-05 21:09:14 +00:00
{
Left . HSplitTop ( 20.0f , & Label , & Left ) ;
bool NeedUpdate = str_comp ( Client ( ) - > LatestVersion ( ) , " 0 " ) ;
char aBuf [ 256 ] ;
2015-04-18 19:17:27 +00:00
int State = Updater ( ) - > GetCurrentState ( ) ;
2015-03-08 17:51:13 +00:00
2017-09-03 15:36:51 +00:00
// Update Button
2015-04-18 19:17:27 +00:00
if ( NeedUpdate & & State < = IUpdater : : CLEAN )
2015-03-05 21:09:14 +00:00
{
2015-06-26 18:44:55 +00:00
str_format ( aBuf , sizeof ( aBuf ) , Localize ( " DDNet %s is available: " ) , Client ( ) - > LatestVersion ( ) ) ;
2020-07-15 19:10:13 +00:00
Label . VSplitLeft ( TextRender ( ) - > TextWidth ( 0 , 14.0f , aBuf , - 1 , - 1.0f ) + 10.0f , & Label , & Button ) ;
2015-03-13 15:49:52 +00:00
Button . VSplitLeft ( 100.0f , & Button , 0 ) ;
2015-03-05 21:09:14 +00:00
static int s_ButtonUpdate = 0 ;
2015-06-26 18:44:55 +00:00
if ( DoButton_Menu ( & s_ButtonUpdate , Localize ( " Update now " ) , 0 , & Button ) )
2015-04-18 19:17:27 +00:00
Updater ( ) - > InitiateUpdate ( ) ;
2015-03-05 21:09:14 +00:00
}
2015-04-18 19:17:27 +00:00
else if ( State > = IUpdater : : GETTING_MANIFEST & & State < IUpdater : : NEED_RESTART )
2015-06-26 18:44:55 +00:00
str_format ( aBuf , sizeof ( aBuf ) , Localize ( " Updating... " ) ) ;
2017-03-04 14:43:49 +00:00
else if ( State = = IUpdater : : NEED_RESTART )
{
2015-06-26 18:44:55 +00:00
str_format ( aBuf , sizeof ( aBuf ) , Localize ( " DDNet Client updated! " ) ) ;
2015-03-08 17:51:13 +00:00
m_NeedRestartUpdate = true ;
}
2015-03-05 21:09:14 +00:00
else
2015-03-14 09:45:11 +00:00
{
2015-06-26 18:44:55 +00:00
str_format ( aBuf , sizeof ( aBuf ) , Localize ( " No updates available " ) ) ;
2020-07-15 19:10:13 +00:00
Label . VSplitLeft ( TextRender ( ) - > TextWidth ( 0 , 14.0f , aBuf , - 1 , - 1.0f ) + 10.0f , & Label , & Button ) ;
2015-03-14 09:45:11 +00:00
Button . VSplitLeft ( 100.0f , & Button , 0 ) ;
static int s_ButtonUpdate = 0 ;
2015-06-26 18:44:55 +00:00
if ( DoButton_Menu ( & s_ButtonUpdate , Localize ( " Check now " ) , 0 , & Button ) )
2015-03-14 09:45:11 +00:00
{
2017-09-03 15:36:51 +00:00
Client ( ) - > RequestDDNetInfo ( ) ;
2015-03-14 09:45:11 +00:00
}
}
2015-03-08 17:51:13 +00:00
UI ( ) - > DoLabelScaled ( & Label , aBuf , 14.0f , - 1 ) ;
TextRender ( ) - > TextColor ( 1.0f , 1.0f , 1.0f , 1.0f ) ;
2015-03-05 21:09:14 +00:00
}
2015-03-13 14:13:19 +00:00
# endif
2014-08-17 17:10:08 +00:00
{
2016-10-03 11:56:15 +00:00
static int s_ButtonTimeout = 0 ;
2014-08-17 17:10:08 +00:00
Right . HSplitTop ( 20.0f , & Button , & Right ) ;
2016-10-03 11:56:15 +00:00
if ( DoButton_Menu ( & s_ButtonTimeout , Localize ( " New random timeout code " ) , 0 , & Button ) )
{
Client ( ) - > GenerateTimeoutSeed ( ) ;
}
2014-08-17 17:10:08 +00:00
}
2011-04-09 06:41:31 +00:00
}