diff --git a/binaries/data/config/default.cfg b/binaries/data/config/default.cfg index 7657dc8406..5cd11d94a5 100644 --- a/binaries/data/config/default.cfg +++ b/binaries/data/config/default.cfg @@ -30,6 +30,9 @@ pauseonfocusloss = true ; Default player name to use in multiplayer ; playername = "anonymous" +; Default server name or IP to use in multiplayer +multiplayerserver = "127.0.0.1" + ; Force a particular resolution. (If these are 0, the default is ; to keep the current desktop resolution in fullscreen mode or to ; use 1024x768 in windowed mode.) @@ -241,7 +244,7 @@ hotkey.selection.group.add.9 = "Shift+9" ; > SESSION CONTROLS hotkey.session.kill = Delete ; Destroy selected units -hotkey.session.attack = Ctrl ; Modifier to force attack instead of another action +hotkey.session.attack = Ctrl ; Modifier to force attack instead of another action hotkey.session.garrison = Ctrl ; Modifier to garrison when clicking on building hotkey.session.queue = Shift ; Modifier to queue unit orders instead of replacing hotkey.session.batchtrain = Shift ; Modifier to train units in batches diff --git a/binaries/data/mods/public/gui/gamesetup/gamesetup_mp.xml b/binaries/data/mods/public/gui/gamesetup/gamesetup_mp.xml index addabb4af2..c5c9a16726 100644 --- a/binaries/data/mods/public/gui/gamesetup/gamesetup_mp.xml +++ b/binaries/data/mods/public/gui/gamesetup/gamesetup_mp.xml @@ -40,7 +40,9 @@ - 127.0.0.1 + 3 100%-33 103 100%-3 diff --git a/source/gui/scripting/ScriptFunctions.cpp b/source/gui/scripting/ScriptFunctions.cpp index 3eb253847f..75e5fb64ac 100644 --- a/source/gui/scripting/ScriptFunctions.cpp +++ b/source/gui/scripting/ScriptFunctions.cpp @@ -179,6 +179,12 @@ std::wstring GetDefaultPlayerName(void* UNUSED(cbdata)) return name; } +std::wstring GetDefaultMPServer(void* UNUSED(cbdata)) +{ + std::wstring server = g_MPServer.FromUTF8(); + return server; +} + void StartNetworkGame(void* UNUSED(cbdata)) { ENSURE(g_NetServer); @@ -634,6 +640,7 @@ void GuiScriptingInit(ScriptInterface& scriptInterface) scriptInterface.RegisterFunction("SetCursor"); scriptInterface.RegisterFunction("GetPlayerID"); scriptInterface.RegisterFunction("GetDefaultPlayerName"); + scriptInterface.RegisterFunction("GetDefaultMPServer"); scriptInterface.RegisterFunction("OpenURL"); scriptInterface.RegisterFunction("RestartInAtlas"); scriptInterface.RegisterFunction("AtlasIsAvailable"); diff --git a/source/ps/GameSetup/Config.cpp b/source/ps/GameSetup/Config.cpp index 052563a053..866c2d2457 100644 --- a/source/ps/GameSetup/Config.cpp +++ b/source/ps/GameSetup/Config.cpp @@ -35,6 +35,7 @@ bool g_NoGLVBO = false; bool g_PauseOnFocusLoss = false; CStr g_PlayerName = ""; +CStr g_MPServer = ""; bool g_Shadows = false; bool g_ShadowPCF = false; @@ -86,9 +87,10 @@ static void LoadGlobals() CFG_GET_USER_VAL("novbo", Bool, g_NoGLVBO); CFG_GET_USER_VAL("pauseonfocusloss", Bool, g_PauseOnFocusLoss); CFG_GET_USER_VAL("playername", String, g_PlayerName); + CFG_GET_USER_VAL("multiplayerserver", String, g_MPServer); CFG_GET_USER_VAL("shadows", Bool, g_Shadows); CFG_GET_USER_VAL("shadowpcf", Bool, g_ShadowPCF); - + CFG_GET_USER_VAL("waternormals",Bool, g_WaterNormal); CFG_GET_USER_VAL("waterrealdepth",Bool, g_WaterRealDepth); CFG_GET_USER_VAL("waterfoam",Bool, g_WaterFoam); @@ -109,9 +111,9 @@ static void LoadGlobals() float musicGain = 0.5f; float ambientGain = 0.5f; float actionGain = 0.5f; - int bufferCount = 50; - unsigned long bufferSize = 65536; - + int bufferCount = 50; + unsigned long bufferSize = 65536; + CFG_GET_USER_VAL("sound.mastergain", Float, gain); CFG_GET_USER_VAL("sound.musicgain", Float, musicGain); CFG_GET_USER_VAL("sound.ambientgain", Float, ambientGain); @@ -120,7 +122,7 @@ static void LoadGlobals() CFG_GET_USER_VAL("sound.bufferCount", Int, bufferCount); CFG_GET_USER_VAL("sound.bufferSize", UnsignedLong, bufferSize); - if ( g_SoundManager ) { + if (g_SoundManager) { g_SoundManager->SetMasterGain(gain); g_SoundManager->SetMusicGain(musicGain); g_SoundManager->SetAmbientGain(ambientGain); diff --git a/source/ps/GameSetup/Config.h b/source/ps/GameSetup/Config.h index a34e09be19..4485af4715 100644 --- a/source/ps/GameSetup/Config.h +++ b/source/ps/GameSetup/Config.h @@ -47,6 +47,9 @@ extern bool g_PauseOnFocusLoss; // default player name to use in multiplayer extern CStr g_PlayerName; +// default server name or IP to use in multiplayer +extern CStr g_MPServer; + // flag to switch on shadows extern bool g_Shadows;