diff options
author | Simon Howard | 2009-05-14 19:45:22 +0000 |
---|---|---|
committer | Simon Howard | 2009-05-14 19:45:22 +0000 |
commit | 664c35903202a2e7c56479eff1786e952718e4df (patch) | |
tree | f8e0c53b9f27f6a7c72cdb228fb041bfe1278aaf /src | |
parent | ebc8378619e9ddca26eb7cda1f4a4f2be1e98091 (diff) | |
parent | 144849eee5804a0306d23f07a5be9877f242a1bf (diff) | |
download | chocolate-doom-664c35903202a2e7c56479eff1786e952718e4df.tar.gz chocolate-doom-664c35903202a2e7c56479eff1786e952718e4df.tar.bz2 chocolate-doom-664c35903202a2e7c56479eff1786e952718e4df.zip |
Merge from trunk. Note that src/i_sdlsound.c has not yet been merged as
it contains too many conflicts at present.
Subversion-branch: /branches/raven-branch
Subversion-revision: 1522
Diffstat (limited to 'src')
-rw-r--r-- | src/i_main.c | 23 | ||||
-rw-r--r-- | src/setup/multiplayer.c | 42 |
2 files changed, 49 insertions, 16 deletions
diff --git a/src/i_main.c b/src/i_main.c index a0b0bfd5..c1a9cb98 100644 --- a/src/i_main.c +++ b/src/i_main.c @@ -28,18 +28,6 @@ #include "SDL.h" -#include <signal.h> - -#ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#endif - -#ifdef HAVE_SCHED_SETAFFINITY -#include <unistd.h> -#include <sched.h> -#endif - #include "doomtype.h" #include "i_system.h" #include "m_argv.h" @@ -54,6 +42,9 @@ void D_DoomMain (void); #if defined(_WIN32) +#define WIN32_LEAN_AND_MEAN +#include <windows.h> + typedef BOOL WINAPI (*SetAffinityFunc)(HANDLE hProcess, DWORD_PTR mask); // This is a bit more complicated than it really needs to be. We really @@ -98,16 +89,24 @@ static void LockCPUAffinity(void) #elif defined(HAVE_SCHED_SETAFFINITY) +#include <unistd.h> +#include <sched.h> + // Unix (Linux) version: static void LockCPUAffinity(void) { +#ifdef CPU_SET cpu_set_t set; CPU_ZERO(&set); CPU_SET(0, &set); sched_setaffinity(getpid(), sizeof(set), &set); +#else + unsigned long mask = 1; + sched_setaffinity(getpid(), sizeof(mask), &mask); +#endif } #else diff --git a/src/setup/multiplayer.c b/src/setup/multiplayer.c index 2157b43c..6756e53c 100644 --- a/src/setup/multiplayer.c +++ b/src/setup/multiplayer.c @@ -43,6 +43,12 @@ typedef enum WARP_MAPxy, } warptype_t; +typedef enum +{ + JOIN_AUTO_LAN, + JOIN_ADDRESS, +} jointype_t; + // Fallback IWAD if none are found to be installed static iwad_t fallback_iwad = { "doom2.wad", doom2, commercial, "Doom II" }; @@ -118,6 +124,8 @@ static char *gamemodes[] = static char *net_player_name; static char *chat_macros[10]; +static int jointype = JOIN_ADDRESS; + static char *wads[NUM_WADS]; static char *extra_params[NUM_EXTRA_PARAMS]; static int skill = 2; @@ -629,7 +637,14 @@ static void DoJoinGame(void *unused1, void *unused2) exec = NewExecuteContext(); - AddCmdLineParameter(exec, "-connect %s", connect_address); + if (jointype == JOIN_ADDRESS) + { + AddCmdLineParameter(exec, "-connect %s", connect_address); + } + else if (jointype == JOIN_AUTO_LAN) + { + AddCmdLineParameter(exec, "-autojoin"); + } // Extra parameters come first, so that they can be used to override // the other parameters. @@ -659,18 +674,28 @@ static txt_window_action_t *JoinGameAction(void) return action; } +// When an address is entered, select "address" mode. + +static void SelectAddressJoin(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused)) +{ + jointype = JOIN_ADDRESS; +} + void JoinMultiGame(void) { txt_window_t *window; txt_table_t *gameopt_table; + txt_table_t *serveropt_table; + txt_inputbox_t *address_box; window = TXT_NewWindow("Join multiplayer game"); TXT_AddWidgets(window, gameopt_table = TXT_NewTable(2), + TXT_NewSeparator("Server"), + serveropt_table = TXT_NewTable(2), TXT_NewStrut(0, 1), TXT_NewButton2("Add extra parameters...", OpenExtraParamsWindow, NULL), - // TXT_NewButton2("Add WADs...", OpenWadsWindow, NULL), NULL); TXT_SetColumnWidths(gameopt_table, 12, 12); @@ -678,10 +703,19 @@ void JoinMultiGame(void) TXT_AddWidgets(gameopt_table, TXT_NewLabel("Game"), IWADSelector(), - TXT_NewLabel("Server address "), - TXT_NewInputBox(&connect_address, 40), NULL); + TXT_AddWidgets(serveropt_table, + TXT_NewRadioButton("Connect to address:", + &jointype, JOIN_ADDRESS), + address_box = TXT_NewInputBox(&connect_address, 30), + TXT_NewRadioButton("Auto-join LAN game", + &jointype, JOIN_AUTO_LAN), + NULL); + + TXT_SignalConnect(address_box, "changed", SelectAddressJoin, NULL); + TXT_SelectWidget(window, address_box); + TXT_SetWindowAction(window, TXT_HORIZ_CENTER, WadWindowAction()); TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, JoinGameAction()); } |