From bb58e40a23c68f51f396babe10db7a6e62cf67f3 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 5 Dec 2008 23:34:04 +0000 Subject: Auto-select the game type based on detected IWADs. If IWADs from multiple games are detected, pop up a dialog box to prompt the user to select a game to configure. Subversion-branch: /branches/raven-branch Subversion-revision: 1408 --- src/setup/mode.c | 137 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 118 insertions(+), 19 deletions(-) (limited to 'src/setup/mode.c') diff --git a/src/setup/mode.c b/src/setup/mode.c index 4fc1b8b9..d5a396ac 100644 --- a/src/setup/mode.c +++ b/src/setup/mode.c @@ -22,9 +22,11 @@ #include #include "config.h" +#include "textscreen.h" #include "doomtype.h" #include "d_mode.h" +#include "d_iwad.h" #include "i_system.h" #include "m_argv.h" #include "m_config.h" @@ -44,19 +46,48 @@ GameMission_t gamemission; typedef struct { + char *label; GameMission_t mission; + int mask; char *name; char *config_file; char *extra_config_file; } mission_config_t; -static mission_config_t config_files[] = +// Default mission to fall back on, if no IWADs are found at all: + +#define DEFAULT_MISSION (&mission_configs[0]) + +static mission_config_t mission_configs[] = { - { doom, "doom", "default.cfg", PROGRAM_PREFIX "doom.cfg" }, - { heretic, "heretic", "heretic.cfg", PROGRAM_PREFIX "heretic.cfg" }, - { hexen, "hexen", "hexen.cfg", PROGRAM_PREFIX "hexen.cfg" }, + { + "Doom", + doom, + IWAD_MASK_DOOM, + "doom", + "default.cfg", + PROGRAM_PREFIX "doom.cfg" + }, + { + "Heretic", + heretic, + IWAD_MASK_HERETIC, + "heretic", + "heretic.cfg", + PROGRAM_PREFIX "heretic.cfg" + }, + { + "Hexen", + hexen, + IWAD_MASK_HEXEN, + "hexen", + "hexen.cfg", + PROGRAM_PREFIX "hexen.cfg" + } }; +static GameSelectCallback game_selected_callback; + // Miscellaneous variables that aren't used in setup. static int showMessages = 1; @@ -123,18 +154,85 @@ static mission_config_t *GetMissionForName(char *name) { int i; - for (i=0; i 0) + if (p > 0) { mission_name = myargv[p + 1]; - } - else - { - mission_name = "doom"; - } - config = GetMissionForName(mission_name); + config = GetMissionForName(mission_name); + + if (config == NULL) + { + I_Error("Invalid parameter - '%s'", mission_name); + } - if (config == NULL) + SetMission(config); + callback(); + } + else { - I_Error("Invalid parameter - '%s'", mission_name); + OpenGameSelectDialog(callback); } - - SetMission(config); } -- cgit v1.2.3