summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2011-02-12 15:38:08 +0000
committerSimon Howard2011-02-12 15:38:08 +0000
commita9996b41e954d85fde5ec5188bbf6a7f4df88011 (patch)
tree113669ff889c9184aaa28224317c8b04c2c5bfeb /src
parent7d7b5087d2288fc6e2493448968f7d786043b389 (diff)
parenta366f68b2959282b22ab6f08569a253f0540745c (diff)
downloadchocolate-doom-a9996b41e954d85fde5ec5188bbf6a7f4df88011.tar.gz
chocolate-doom-a9996b41e954d85fde5ec5188bbf6a7f4df88011.tar.bz2
chocolate-doom-a9996b41e954d85fde5ec5188bbf6a7f4df88011.zip
Merge from trunk.
Subversion-branch: /branches/raven-branch Subversion-revision: 2258
Diffstat (limited to 'src')
-rw-r--r--src/d_iwad.c2
-rw-r--r--src/doom/d_main.c104
-rw-r--r--src/doom/d_net.c6
-rw-r--r--src/doom/dstrings.h9
-rw-r--r--src/doom/g_game.c12
-rw-r--r--src/doom/m_menu.c8
-rw-r--r--src/doom/p_map.c2
-rw-r--r--src/doom/p_spec.c4
-rw-r--r--src/i_system.c2
-rw-r--r--src/i_video.c24
-rw-r--r--src/m_argv.c13
-rw-r--r--src/m_argv.h4
-rw-r--r--src/m_config.c22
-rw-r--r--src/net_sdl.c4
-rw-r--r--src/net_server.c4
-rw-r--r--src/setup/display.c56
-rw-r--r--src/setup/execute.c55
-rw-r--r--src/setup/execute.h2
-rw-r--r--src/setup/mainmenu.c26
-rw-r--r--src/setup/multiplayer.c30
-rw-r--r--src/w_main.c12
21 files changed, 245 insertions, 156 deletions
diff --git a/src/d_iwad.c b/src/d_iwad.c
index 9bf53b9a..72e3e3ad 100644
--- a/src/d_iwad.c
+++ b/src/d_iwad.c
@@ -656,7 +656,7 @@ char *D_FindIWAD(int mask, GameMission_t *mission)
// @arg <file>
//
- iwadparm = M_CheckParm("-iwad");
+ iwadparm = M_CheckParmWithArgs("-iwad", 1);
if (iwadparm)
{
diff --git a/src/doom/d_main.c b/src/doom/d_main.c
index 69dd6e9f..2f116f1e 100644
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -526,7 +526,13 @@ void D_DoAdvanceDemo (void)
paused = false;
gameaction = ga_nothing;
- if (gamemode == retail && gameversion != exe_chex)
+ // The Ultimate Doom executable changed the demo sequence to add
+ // a DEMO4 demo. Final Doom was based on Ultimate, so also
+ // includes this change; however, the Final Doom IWADs do not
+ // include a DEMO4 lump, so the game bombs out with an error
+ // when it reaches this point in the demo sequence.
+
+ if (gameversion == exe_ultimate || gameversion == exe_final)
demosequence = (demosequence+1)%7;
else
demosequence = (demosequence+1)%6;
@@ -927,9 +933,9 @@ static void InitGameVersion(void)
// "ultimate" and "final".
//
- p = M_CheckParm("-gameversion");
+ p = M_CheckParmWithArgs("-gameversion", 1);
- if (p > 0)
+ if (p)
{
for (i=0; gameversions[i].description != NULL; ++i)
{
@@ -1142,9 +1148,9 @@ void D_DoomMain (void)
// address.
//
- p = M_CheckParm("-query");
+ p = M_CheckParmWithArgs("-query", 1);
- if (p > 0)
+ if (p)
{
NET_QueryAddress(myargv[p+1]);
exit(0);
@@ -1312,40 +1318,32 @@ void D_DoomMain (void)
D_AddFile(iwadfile);
modifiedgame = W_ParseCommandLine();
- // add any files specified on the command line with -file wadfile
- // to the wad list
+ //!
+ // @arg <files>
+ // @vanilla
//
- // convenience hack to allow -wart e m to add a wad file
- // prepend a tilde to the filename so wadfile will be reloadable
- p = M_CheckParm ("-wart");
+ // Load the specified PWAD files.
+ //
+
+ p = M_CheckParmWithArgs("-file", 1);
if (p)
{
- myargv[p][4] = 'p'; // big hack, change to -warp
+ // the parms after p are wadfile/lump names,
+ // until end of parms or another - preceded parm
+ modifiedgame = true; // homebrew levels
+ while (++p != myargc && myargv[p][0] != '-')
+ {
+ char *filename;
- // Map name handling.
- switch (gamemode )
- {
- case shareware:
- case retail:
- case registered:
- sprintf (file,"~"DEVMAPS"E%cM%c.wad",
- myargv[p+1][0], myargv[p+2][0]);
- printf("Warping to Episode %s, Map %s.\n",
- myargv[p+1],myargv[p+2]);
- break;
-
- case commercial:
- default:
- p = atoi (myargv[p+1]);
- if (p<10)
- sprintf (file,"~"DEVMAPS"cdata/map0%i.wad", p);
- else
- sprintf (file,"~"DEVMAPS"cdata/map%i.wad", p);
- break;
- }
- D_AddFile (file);
+ filename = D_TryFindWADByName(myargv[p]);
+
+ D_AddFile(filename);
+ }
}
+ // Debug:
+// W_PrintDirectory();
+
//!
// @arg <demo>
// @category demo
@@ -1354,7 +1352,7 @@ void D_DoomMain (void)
// Play back the demo named demo.lmp.
//
- p = M_CheckParm ("-playdemo");
+ p = M_CheckParmWithArgs ("-playdemo", 1);
if (!p)
{
@@ -1366,11 +1364,11 @@ void D_DoomMain (void)
// Play back the demo named demo.lmp, determining the framerate
// of the screen.
//
- p = M_CheckParm ("-timedemo");
+ p = M_CheckParmWithArgs("-timedemo", 1);
}
- if (p && p < myargc-1)
+ if (p)
{
if (!strcasecmp(myargv[p+1] + strlen(myargv[p+1]) - 4, ".lmp"))
{
@@ -1452,9 +1450,9 @@ void D_DoomMain (void)
// 0 disables all monsters.
//
- p = M_CheckParm ("-skill");
+ p = M_CheckParmWithArgs("-skill", 1);
- if (p && p < myargc-1)
+ if (p)
{
startskill = myargv[p+1][0]-'1';
autostart = true;
@@ -1467,9 +1465,9 @@ void D_DoomMain (void)
// Start playing on episode n (1-4)
//
- p = M_CheckParm ("-episode");
+ p = M_CheckParmWithArgs("-episode", 1);
- if (p && p < myargc-1)
+ if (p)
{
startepisode = myargv[p+1][0]-'0';
startmap = 1;
@@ -1486,9 +1484,9 @@ void D_DoomMain (void)
// For multiplayer games: exit each level after n minutes.
//
- p = M_CheckParm ("-timer");
+ p = M_CheckParmWithArgs("-timer", 1);
- if (p && p < myargc-1)
+ if (p)
{
timelimit = atoi(myargv[p+1]);
}
@@ -1502,7 +1500,7 @@ void D_DoomMain (void)
p = M_CheckParm ("-avg");
- if (p && p < myargc-1)
+ if (p)
{
timelimit = 20;
}
@@ -1515,9 +1513,9 @@ void D_DoomMain (void)
// (Doom 2)
//
- p = M_CheckParm ("-warp");
+ p = M_CheckParmWithArgs("-warp", 1);
- if (p && p < myargc-1)
+ if (p)
{
if (gamemode == commercial)
startmap = atoi (myargv[p+1]);
@@ -1561,9 +1559,9 @@ void D_DoomMain (void)
// Load the game in slot s.
//
- p = M_CheckParm ("-loadgame");
+ p = M_CheckParmWithArgs("-loadgame", 1);
- if (p && p < myargc-1)
+ if (p)
{
startloadgame = atoi(myargv[p+1]);
}
@@ -1633,24 +1631,24 @@ void D_DoomMain (void)
// Record a demo named x.lmp.
//
- p = M_CheckParm ("-record");
+ p = M_CheckParmWithArgs("-record", 1);
- if (p && p < myargc-1)
+ if (p)
{
G_RecordDemo (myargv[p+1]);
autostart = true;
}
- p = M_CheckParm ("-playdemo");
- if (p && p < myargc-1)
+ p = M_CheckParmWithArgs("-playdemo", 1);
+ if (p)
{
singledemo = true; // quit after one demo
G_DeferedPlayDemo (demolumpname);
D_DoomLoop (); // never returns
}
- p = M_CheckParm ("-timedemo");
- if (p && p < myargc-1)
+ p = M_CheckParmWithArgs("-timedemo", 1);
+ if (p)
{
G_TimeDemo (demolumpname);
D_DoomLoop (); // never returns
diff --git a/src/doom/d_net.c b/src/doom/d_net.c
index 73e7368f..dd1ec563 100644
--- a/src/doom/d_net.c
+++ b/src/doom/d_net.c
@@ -396,7 +396,7 @@ static void SaveGameSettings(net_gamesettings_t *settings,
// packets.
//
- i = M_CheckParm("-extratics");
+ i = M_CheckParmWithArgs("-extratics", 1);
if (i > 0)
settings->extratics = atoi(myargv[i+1]);
@@ -411,7 +411,7 @@ static void SaveGameSettings(net_gamesettings_t *settings,
// the amount of network bandwidth needed.
//
- i = M_CheckParm("-dup");
+ i = M_CheckParmWithArgs("-dup", 1);
if (i > 0)
settings->ticdup = atoi(myargv[i+1]);
@@ -513,7 +513,7 @@ boolean D_InitNetGame(net_connect_data_t *connect_data,
// address.
//
- i = M_CheckParm("-connect");
+ i = M_CheckParmWithArgs("-connect", 1);
if (i > 0)
{
diff --git a/src/doom/dstrings.h b/src/doom/dstrings.h
index bdc6b2ce..d47fc1af 100644
--- a/src/doom/dstrings.h
+++ b/src/doom/dstrings.h
@@ -38,15 +38,6 @@
#define SAVEGAMENAME "doomsav"
-//
-// File locations,
-// relative to current position.
-// Path names are OS-sensitive.
-//
-#define DEVMAPS "devmaps"
-#define DEVDATA "devdata"
-
-
// QuitDOOM messages
// 8 per each game type
#define NUM_QUITMESSAGES 8
diff --git a/src/doom/g_game.c b/src/doom/g_game.c
index 5d30899d..5662d3f2 100644
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -138,7 +138,7 @@ int gametic;
int levelstarttic; // gametic at level start
int totalkills, totalitems, totalsecret; // for intermission
-char demoname[32];
+char *demoname;
boolean demorecording;
boolean longtics; // cph's doom 1.91 longtics hack
boolean lowres_turn; // low resolution turning for longtics
@@ -1978,14 +1978,14 @@ void G_WriteDemoTiccmd (ticcmd_t* cmd)
//
// G_RecordDemo
//
-void G_RecordDemo (char* name)
+void G_RecordDemo (char *name)
{
int i;
int maxsize;
usergame = false;
- strcpy (demoname, name);
- strcat (demoname, ".lmp");
+ demoname = Z_Malloc(strlen(name) + 5, PU_STATIC, NULL);
+ sprintf(demoname, "%s.lmp", name);
maxsize = 0x20000;
//!
@@ -1996,8 +1996,8 @@ void G_RecordDemo (char* name)
// Specify the demo buffer size (KiB)
//
- i = M_CheckParm ("-maxdemo");
- if (i && i<myargc-1)
+ i = M_CheckParmWithArgs("-maxdemo", 1);
+ if (i)
maxsize = atoi(myargv[i+1])*1024;
demobuffer = Z_Malloc (maxsize,PU_STATIC,NULL);
demoend = demobuffer + maxsize;
diff --git a/src/doom/m_menu.c b/src/doom/m_menu.c
index 3bb4baa3..478e7f66 100644
--- a/src/doom/m_menu.c
+++ b/src/doom/m_menu.c
@@ -1442,23 +1442,23 @@ boolean M_Responder (event_t* ev)
if (ev->type == ev_joystick && joywait < I_GetTime())
{
- if (ev->data3 == -1)
+ if (ev->data3 < 0)
{
key = key_menu_up;
joywait = I_GetTime() + 5;
}
- else if (ev->data3 == 1)
+ else if (ev->data3 > 0)
{
key = key_menu_down;
joywait = I_GetTime() + 5;
}
- if (ev->data2 == -1)
+ if (ev->data2 < 0)
{
key = key_menu_left;
joywait = I_GetTime() + 2;
}
- else if (ev->data2 == 1)
+ else if (ev->data2 > 0)
{
key = key_menu_right;
joywait = I_GetTime() + 2;
diff --git a/src/doom/p_map.c b/src/doom/p_map.c
index 925e4398..78102bdf 100644
--- a/src/doom/p_map.c
+++ b/src/doom/p_map.c
@@ -1426,7 +1426,7 @@ static void SpechitOverrun(line_t *ld)
// Use the specified magic value when emulating spechit overruns.
//
- p = M_CheckParm("-spechit");
+ p = M_CheckParmWithArgs("-spechit", 1);
if (p > 0)
{
diff --git a/src/doom/p_spec.c b/src/doom/p_spec.c
index fa3ec335..90d0bb7c 100644
--- a/src/doom/p_spec.c
+++ b/src/doom/p_spec.c
@@ -1213,9 +1213,9 @@ static void DonutOverrun(fixed_t *s3_floorheight, short *s3_floorpic,
// system. The default (if this option is not specified) is to
// emulate the behavior when running under Windows 98.
- p = M_CheckParm("-donut");
+ p = M_CheckParmWithArgs("-donut", 2);
- if (p > 0 && p < myargc - 2)
+ if (p > 0)
{
// Dump of needed memory: (fixed_t)0000:0000 and (short)0000:0008
//
diff --git a/src/i_system.c b/src/i_system.c
index 18dfb415..0a856ca9 100644
--- a/src/i_system.c
+++ b/src/i_system.c
@@ -189,7 +189,7 @@ byte *I_ZoneBase (int *size)
// Specify the heap size, in MiB (default 16).
//
- p = M_CheckParm("-mb");
+ p = M_CheckParmWithArgs("-mb", 1);
if (p > 0)
{
diff --git a/src/i_video.c b/src/i_video.c
index 243663d5..9d70e88e 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -148,7 +148,7 @@ static char *window_title = "";
// This is used when we are rendering in 32-bit screen mode.
// When in a real 8-bit screen mode, screenbuffer == screen.
-static SDL_Surface *screenbuffer;
+static SDL_Surface *screenbuffer = NULL;
// palette
@@ -1625,7 +1625,7 @@ static void CheckCommandLine(void)
// Specify the screen width, in pixels.
//
- i = M_CheckParm("-width");
+ i = M_CheckParmWithArgs("-width", 1);
if (i > 0)
{
@@ -1639,7 +1639,7 @@ static void CheckCommandLine(void)
// Specify the screen height, in pixels.
//
- i = M_CheckParm("-height");
+ i = M_CheckParmWithArgs("-height", 1);
if (i > 0)
{
@@ -1653,7 +1653,7 @@ static void CheckCommandLine(void)
// Specify the color depth of the screen, in bits per pixel.
//
- i = M_CheckParm("-bpp");
+ i = M_CheckParmWithArgs("-bpp", 1);
if (i > 0)
{
@@ -1680,7 +1680,7 @@ static void CheckCommandLine(void)
// Specify the screen mode (when running fullscreen) or the window
// dimensions (when running in windowed mode).
- i = M_CheckParm("-geometry");
+ i = M_CheckParmWithArgs("-geometry", 1);
if (i > 0)
{
@@ -1851,6 +1851,14 @@ static void SetVideoMode(screen_mode_t *mode, int w, int h)
doompal = W_CacheLumpName(DEH_String("PLAYPAL"), PU_CACHE);
+ // If we are already running and in a true color mode, we need
+ // to free the screenbuffer surface before setting the new mode.
+
+ if (screenbuffer != NULL && screen != screenbuffer)
+ {
+ SDL_FreeSurface(screenbuffer);
+ }
+
// Generate lookup tables before setting the video mode.
if (mode != NULL && mode->InitMode != NULL)
@@ -1873,7 +1881,13 @@ static void SetVideoMode(screen_mode_t *mode, int w, int h)
}
else
{
+ // In windowed mode, the window can be resized while the game is
+ // running. This feature is disabled on OS X, as it adds an ugly
+ // scroll handle to the corner of the screen.
+
+#ifndef __MACOSX__
flags |= SDL_RESIZABLE;
+#endif
}
screen = SDL_SetVideoMode(w, h, screen_bpp, flags);
diff --git a/src/m_argv.c b/src/m_argv.c
index 875829bd..59381b65 100644
--- a/src/m_argv.c
+++ b/src/m_argv.c
@@ -47,13 +47,13 @@ char** myargv;
// or 0 if not present
//
-int M_CheckParm (char *check)
+int M_CheckParmWithArgs(char *check, int num_args)
{
- int i;
+ int i;
- for (i = 1;i<myargc;i++)
+ for (i = 1; i < myargc - num_args; i++)
{
- if ( !strcasecmp(check, myargv[i]) )
+ if (!strcasecmp(check, myargv[i]))
return i;
}
@@ -72,6 +72,11 @@ boolean M_ParmExists(char *check)
return M_CheckParm(check) != 0;
}
+int M_CheckParm(char *check)
+{
+ return M_CheckParmWithArgs(check, 0);
+}
+
#define MAXARGVS 100
static void LoadResponseFile(int argv_index)
diff --git a/src/m_argv.h b/src/m_argv.h
index 859f93e4..2fb76a2a 100644
--- a/src/m_argv.h
+++ b/src/m_argv.h
@@ -40,6 +40,10 @@ extern char** myargv;
// in the arg list (0 if not found).
int M_CheckParm (char* check);
+// Same as M_CheckParm, but checks that num_args arguments are available
+// following the specified argument.
+int M_CheckParmWithArgs(char *check, int num_args);
+
void M_FindResponseFile(void);
// Parameter has been specified?
diff --git a/src/m_config.c b/src/m_config.c
index cb7d449c..a0f97dc2 100644
--- a/src/m_config.c
+++ b/src/m_config.c
@@ -1204,8 +1204,18 @@ static void SaveDefaultCollection(default_collection_t *collection)
v = * (int *) defaults[i].location;
- if (defaults[i].untranslated
- && v == defaults[i].original_translated)
+ if (v == KEY_RSHIFT)
+ {
+ // Special case: for shift, force scan code for
+ // right shift, as this is what Vanilla uses.
+ // This overrides the change check below, to fix
+ // configuration files made by old versions that
+ // mistakenly used the scan code for left shift.
+
+ v = 54;
+ }
+ else if (defaults[i].untranslated
+ && v == defaults[i].original_translated)
{
// Has not been changed since the last time we
// read the config file.
@@ -1423,9 +1433,9 @@ void M_LoadDefaults (void)
// configuration file (for Doom) is named default.cfg.
//
- i = M_CheckParm ("-config");
+ i = M_CheckParmWithArgs("-config", 1);
- if (i && i<myargc-1)
+ if (i)
{
doom_defaults.filename = myargv[i+1];
printf (" default file: %s\n",doom_defaults.filename);
@@ -1446,9 +1456,9 @@ void M_LoadDefaults (void)
// configuration file for Doom is named chocolate-doom.cfg.
//
- i = M_CheckParm("-extraconfig");
+ i = M_CheckParmWithArgs("-extraconfig", 1);
- if (i && i<myargc-1)
+ if (i)
{
extra_defaults.filename = myargv[i+1];
printf(" extra configuration file: %s\n",
diff --git a/src/net_sdl.c b/src/net_sdl.c
index aa7fbd6e..6a4f24dc 100644
--- a/src/net_sdl.c
+++ b/src/net_sdl.c
@@ -170,7 +170,7 @@ static boolean NET_SDL_InitClient(void)
// the default (2342).
//
- p = M_CheckParm("-port");
+ p = M_CheckParmWithArgs("-port", 1);
if (p > 0)
port = atoi(myargv[p+1]);
@@ -196,7 +196,7 @@ static boolean NET_SDL_InitServer(void)
{
int p;
- p = M_CheckParm("-port");
+ p = M_CheckParmWithArgs("-port", 1);
if (p > 0)
port = atoi(myargv[p+1]);
diff --git a/src/net_server.c b/src/net_server.c
index f3c16c1b..ae46be4a 100644
--- a/src/net_server.c
+++ b/src/net_server.c
@@ -1119,9 +1119,9 @@ void NET_SV_SendQueryResponse(net_addr_t *addr)
// When starting a network server, specify a name for the server.
//
- p = M_CheckParm("-servername");
+ p = M_CheckParmWithArgs("-servername", 1);
- if (p > 0 && p + 1 < myargc)
+ if (p > 0)
{
querydata.description = myargv[p + 1];
}
diff --git a/src/setup/display.c b/src/setup/display.c
index fd7c0a9a..f5f190f2 100644
--- a/src/setup/display.c
+++ b/src/setup/display.c
@@ -37,6 +37,8 @@
#include "display.h"
+extern void RestartTextscreen(void);
+
typedef struct
{
char *description;
@@ -95,6 +97,7 @@ static screen_mode_t screen_modes_scaled[] =
// List of fullscreen modes generated at runtime
static screen_mode_t *screen_modes_fullscreen = NULL;
+static int num_screen_modes_fullscreen;
static int vidmode = 0;
@@ -411,6 +414,8 @@ static void BuildFullscreenModesList(void)
memcpy(m1, m2, sizeof(screen_mode_t));
memcpy(m2, &m, sizeof(screen_mode_t));
}
+
+ num_screen_modes_fullscreen = num_modes;
}
static int FindBestMode(screen_mode_t *modes)
@@ -477,7 +482,7 @@ static void GenerateModesTable(TXT_UNCAST_ARG(widget),
// Build the table
TXT_ClearTable(modes_table);
- TXT_SetColumnWidths(modes_table, 15, 15, 15);
+ TXT_SetColumnWidths(modes_table, 14, 14, 14, 14, 14);
for (i=0; modes[i].w != 0; ++i)
{
@@ -530,18 +535,6 @@ static char *win32_video_drivers[] =
"Windows GDI",
};
-// Restart the textscreen library. Used when the video_driver variable
-// is changed.
-
-static void RestartTextscreen(void)
-{
- TXT_Shutdown();
-
- SetDisplayDriver();
-
- TXT_Init();
-}
-
static void SetWin32VideoDriver(void)
{
if (!strcmp(video_driver, "windib"))
@@ -593,6 +586,8 @@ void ConfigDisplay(void)
txt_checkbox_t *fs_checkbox;
txt_checkbox_t *ar_checkbox;
txt_dropdown_list_t *bpp_selector;
+ int num_columns;
+ int window_y;
// What color depths are supported? Generate supported_bpps array
// and set selected_bpp to match the current value of screen_bpp.
@@ -612,16 +607,43 @@ void ConfigDisplay(void)
window = TXT_NewWindow("Display Configuration");
- TXT_SetWindowPosition(window, TXT_HORIZ_CENTER, TXT_VERT_TOP,
- TXT_SCREEN_W / 2, 5);
-
TXT_AddWidgets(window,
fs_checkbox = TXT_NewCheckBox("Fullscreen", &fullscreen),
ar_checkbox = TXT_NewCheckBox("Correct aspect ratio",
&aspect_ratio_correct),
NULL);
- modes_table = TXT_NewTable(3);
+ // Some machines can have lots of video modes. This tries to
+ // keep a limit of six lines by increasing the number of
+ // columns. In extreme cases, the window is moved up slightly.
+
+ BuildFullscreenModesList();
+
+ window_y = 5;
+
+ if (num_screen_modes_fullscreen <= 18)
+ {
+ num_columns = 3;
+ }
+ else if (num_screen_modes_fullscreen <= 24)
+ {
+ num_columns = 4;
+ }
+ else
+ {
+ num_columns = 5;
+ window_y -= 3;
+ }
+
+ modes_table = TXT_NewTable(num_columns);
+
+ // The window is set at a fixed vertical position. This keeps
+ // the top of the window stationary when switching between
+ // fullscreen and windowed mode (which causes the window's
+ // height to change).
+
+ TXT_SetWindowPosition(window, TXT_HORIZ_CENTER, TXT_VERT_TOP,
+ TXT_SCREEN_W / 2, window_y);
// On Windows, there is an extra control to change between
// the Windows GDI and DirectX video drivers.
diff --git a/src/setup/execute.c b/src/setup/execute.c
index 4be44149..f85b8af4 100644
--- a/src/setup/execute.c
+++ b/src/setup/execute.c
@@ -88,6 +88,42 @@ static char *TempFile(char *s)
return result;
}
+static int ArgumentNeedsEscape(char *arg)
+{
+ char *p;
+
+ for (p = arg; *p != '\0'; ++p)
+ {
+ if (isspace(*p))
+ {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+// Arguments passed to the setup tool should be passed through to the
+// game when launching a game. Calling this adds all arguments from
+// myargv to the output context.
+
+void PassThroughArguments(execute_context_t *context)
+{
+ int i;
+
+ for (i = 1; i < myargc; ++i)
+ {
+ if (ArgumentNeedsEscape(myargv[i]))
+ {
+ AddCmdLineParameter(context, "\"%s\"", myargv[i]);
+ }
+ else
+ {
+ AddCmdLineParameter(context, "%s", myargv[i]);
+ }
+ }
+}
+
execute_context_t *NewExecuteContext(void)
{
execute_context_t *result;
@@ -106,25 +142,6 @@ execute_context_t *NewExecuteContext(void)
return result;
}
-void AddConfigParameters(execute_context_t *context)
-{
- int p;
-
- p = M_CheckParm("-config");
-
- if (p > 0)
- {
- AddCmdLineParameter(context, "-config \"%s\"", myargv[p + 1]);
- }
-
- p = M_CheckParm("-extraconfig");
-
- if (p > 0)
- {
- AddCmdLineParameter(context, "-extraconfig \"%s\"", myargv[p + 1]);
- }
-}
-
void AddCmdLineParameter(execute_context_t *context, char *s, ...)
{
va_list args;
diff --git a/src/setup/execute.h b/src/setup/execute.h
index 24711a16..25f1f10a 100644
--- a/src/setup/execute.h
+++ b/src/setup/execute.h
@@ -35,7 +35,7 @@ typedef struct execute_context_s execute_context_t;
execute_context_t *NewExecuteContext(void);
void AddCmdLineParameter(execute_context_t *context, char *s, ...);
-void AddConfigParameters(execute_context_t *context);
+void PassThroughArguments(execute_context_t *context);
int ExecuteDoom(execute_context_t *context);
int FindInstalledIWADs(void);
diff --git a/src/setup/mainmenu.c b/src/setup/mainmenu.c
index ffa174de..55496010 100644
--- a/src/setup/mainmenu.c
+++ b/src/setup/mainmenu.c
@@ -156,7 +156,7 @@ static void LaunchDoom(void *unused1, void *unused2)
// Launch Doom
exec = NewExecuteContext();
- AddConfigParameters(exec);
+ PassThroughArguments(exec);
ExecuteDoom(exec);
exit(0);
@@ -297,11 +297,9 @@ static void SetIcon(void)
free(mask);
}
-//
-// Initialize and run the textscreen GUI.
-//
+// Initialize the textscreen library.
-static void RunGUI(void)
+static void InitTextscreen(void)
{
SetDisplayDriver();
@@ -313,6 +311,24 @@ static void RunGUI(void)
TXT_SetDesktopTitle(PACKAGE_NAME " Setup ver " PACKAGE_VERSION);
SetIcon();
+}
+
+// Restart the textscreen library. Used when the video_driver variable
+// is changed.
+
+void RestartTextscreen(void)
+{
+ TXT_Shutdown();
+ InitTextscreen();
+}
+
+//
+// Initialize and run the textscreen GUI.
+//
+
+static void RunGUI(void)
+{
+ InitTextscreen();
TXT_GUIMainLoop();
}
diff --git a/src/setup/multiplayer.c b/src/setup/multiplayer.c
index 0d88221f..aed89212 100644
--- a/src/setup/multiplayer.c
+++ b/src/setup/multiplayer.c
@@ -70,10 +70,10 @@ static char *iwadfile;
static char *doom_skills[] =
{
- "I'm too young to die!",
+ "I'm too young to die.",
"Hey, not too rough.",
"Hurt me plenty.",
- "Ultra-violence",
+ "Ultra-Violence.",
"NIGHTMARE!",
};
@@ -144,6 +144,7 @@ static int fast = 0;
static int respawn = 0;
static int udpport = 2342;
static int timer = 0;
+static int privateserver = 0;
static txt_dropdown_list_t *skillbutton;
static txt_button_t *warpbutton;
@@ -277,6 +278,11 @@ static void StartGame(int multiplayer)
{
AddCmdLineParameter(exec, "-timer %i", timer);
}
+
+ if (privateserver)
+ {
+ AddCmdLineParameter(exec, "-privateserver");
+ }
}
AddWADs(exec);
@@ -284,7 +290,7 @@ static void StartGame(int multiplayer)
TXT_Shutdown();
M_SaveDefaults();
- AddConfigParameters(exec);
+ PassThroughArguments(exec);
ExecuteDoom(exec);
@@ -647,14 +653,12 @@ static void StartGameMenu(char *window_title, int multiplayer)
TXT_NewCheckBox("Respawning monsters", &respawn),
TXT_NewSeparator("Advanced"),
advanced_table = TXT_NewTable(2),
- TXT_NewButton2("Add extra parameters...",
- OpenExtraParamsWindow, NULL),
NULL);
TXT_SetWindowAction(window, TXT_HORIZ_CENTER, WadWindowAction());
TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, StartGameAction(multiplayer));
- TXT_SetColumnWidths(gameopt_table, 12, 12);
+ TXT_SetColumnWidths(gameopt_table, 12, 6);
if (gamemission == doom)
{
@@ -694,13 +698,21 @@ static void StartGameMenu(char *window_title, int multiplayer)
NULL),
NULL);
- TXT_AddWidgets(advanced_table,
+ TXT_AddWidget(window,
+ TXT_NewInvertedCheckBox("Register with master server",
+ &privateserver));
+
+ TXT_AddWidgets(advanced_table,
TXT_NewLabel("UDP port"),
TXT_NewIntInputBox(&udpport, 5),
NULL);
}
- TXT_SetColumnWidths(advanced_table, 12, 12);
+ TXT_AddWidget(window,
+ TXT_NewButton2("Add extra parameters...",
+ OpenExtraParamsWindow, NULL));
+
+ TXT_SetColumnWidths(advanced_table, 12, 6);
TXT_SignalConnect(iwad_selector, "changed", UpdateWarpType, NULL);
@@ -749,7 +761,7 @@ static void DoJoinGame(void *unused1, void *unused2)
M_SaveDefaults();
- AddConfigParameters(exec);
+ PassThroughArguments(exec);
ExecuteDoom(exec);
diff --git a/src/w_main.c b/src/w_main.c
index 92a394dd..ed285498 100644
--- a/src/w_main.c
+++ b/src/w_main.c
@@ -53,7 +53,7 @@ boolean W_ParseCommandLine(void)
// into the main IWAD. Multiple files may be specified.
//
- p = M_CheckParm("-merge");
+ p = M_CheckParmWithArgs("-merge", 1);
if (p > 0)
{
@@ -81,7 +81,7 @@ boolean W_ParseCommandLine(void)
// Simulates the behavior of NWT's -merge option. Multiple files
// may be specified.
- p = M_CheckParm("-nwtmerge");
+ p = M_CheckParmWithArgs("-nwtmerge", 1);
if (p > 0)
{
@@ -108,7 +108,7 @@ boolean W_ParseCommandLine(void)
// the main IWAD directory. Multiple files may be specified.
//
- p = M_CheckParm("-af");
+ p = M_CheckParmWithArgs("-af", 1);
if (p > 0)
{
@@ -133,7 +133,7 @@ boolean W_ParseCommandLine(void)
// into the main IWAD directory. Multiple files may be specified.
//
- p = M_CheckParm("-as");
+ p = M_CheckParmWithArgs("-as", 1);
if (p > 0)
{
@@ -156,7 +156,7 @@ boolean W_ParseCommandLine(void)
// Equivalent to "-af <files> -as <files>".
//
- p = M_CheckParm("-aa");
+ p = M_CheckParmWithArgs("-aa", 1);
if (p > 0)
{
@@ -182,7 +182,7 @@ boolean W_ParseCommandLine(void)
// Load the specified PWAD files.
//
- p = M_CheckParm ("-file");
+ p = M_CheckParmWithArgs ("-file", 1);
if (p)
{
// the parms after p are wadfile/lump names,