summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2014-10-21 00:54:19 -0400
committerSimon Howard2014-10-21 00:54:19 -0400
commit21a41318650adf10187f8c3d0be6a05a40f7cb67 (patch)
tree83449b55985042a68dc00aa5362b36051c171ae8
parent378857f3c826f052bed2199611e13da06bddfcd7 (diff)
downloadchocolate-doom-21a41318650adf10187f8c3d0be6a05a40f7cb67.tar.gz
chocolate-doom-21a41318650adf10187f8c3d0be6a05a40f7cb67.tar.bz2
chocolate-doom-21a41318650adf10187f8c3d0be6a05a40f7cb67.zip
doom: Add -pack parameter to specify mission pack.
The main purpose for this parameter is to allow mods made for the Final Doom IWADs to be played properly with Freedoom. Chocolate Doom detects mission packs (pack_tnt/pack_plut) based on the file name. However, the Freedoom: Phase 2 IWAD contains the textures for all three Doom2-format IWADs, so can be used to play MegaWADs like Plutonia 2 that were designed to be played with plutonia.wad. Because mission pack detection is done based on filename, freedoom2.wad is handled the same as doom2.wad (a sensible default). But this means that when playing using a mod like Plutonia 2, the wrong level name is shown on the automap screen (along with eg. intermission text). To fix this we need a way to manually override the mission pack. -pack allows this to be done. It's kind of tedious that this has to be done manually but at least it can be done. Thanks chungy for the bug report/suggestion. This fixes #449.
-rw-r--r--src/doom/d_main.c52
1 files changed, 51 insertions, 1 deletions
diff --git a/src/doom/d_main.c b/src/doom/d_main.c
index c7987b90..d2520c5d 100644
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -681,6 +681,38 @@ static char *GetGameName(char *gamename)
return gamename;
}
+static void SetMissionForPackName(char *pack_name)
+{
+ int i;
+ static const struct
+ {
+ char *name;
+ int mission;
+ } packs[] = {
+ { "doom2", doom2 },
+ { "tnt", pack_tnt },
+ { "plutonia", pack_plut },
+ };
+
+ for (i = 0; i < arrlen(packs); ++i)
+ {
+ if (!strcasecmp(pack_name, packs[i].name))
+ {
+ gamemission = packs[i].mission;
+ return;
+ }
+ }
+
+ printf("Valid mission packs are:\n");
+
+ for (i = 0; i < arrlen(packs); ++i)
+ {
+ printf("\t%s\n", packs[i].name);
+ }
+
+ I_Error("Unknown mission pack name: %s", pack_name);
+}
+
//
// Find out what version of Doom is playing.
//
@@ -742,9 +774,27 @@ void D_IdentifyVersion(void)
}
else
{
- // Doom 2 of some kind.
+ int p;
+ // Doom 2 of some kind.
gamemode = commercial;
+
+ // We can manually override the gamemission that we got from the
+ // IWAD detection code. This allows us to eg. play Plutonia 2
+ // with Freedoom and get the right level names.
+
+ //!
+ // @arg <pack>
+ //
+ // Explicitly specify a Doom II "mission pack" to run as, instead of
+ // detecting it based on the filename. Valid values are: "doom2",
+ // "tnt" and "plutonia".
+ //
+ p = M_CheckParmWithArgs("-pack", 1);
+ if (p > 0)
+ {
+ SetMissionForPackName(myargv[p + 1]);
+ }
}
}