summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2014-03-29 23:56:44 -0400
committerSimon Howard2014-03-30 00:24:44 -0400
commit59a80b5a902d51d03fb079b0ec5560d450f92731 (patch)
tree5899e4adfcd126391277502bc9d18840692b008a
parent79699357c1b4dfe8db47eb43f15b7d03c9bc820f (diff)
downloadchocolate-doom-59a80b5a902d51d03fb079b0ec5560d450f92731.tar.gz
chocolate-doom-59a80b5a902d51d03fb079b0ec5560d450f92731.tar.bz2
chocolate-doom-59a80b5a902d51d03fb079b0ec5560d450f92731.zip
heretic: Make -playdemo cope with paths.
Vanilla Heretic makes you specify the demo name to play by giving the plain lump name, eg. heretic -playdemo mydemo to load mydemo.lmp. It doesn't work if you specify the extension or the full file path. As a convenience and to match the behavior of Chocolate Doom, allow paths and extensions. This fixes half of #301.
-rw-r--r--src/heretic/d_main.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c
index 7a5517f2..316a30b8 100644
--- a/src/heretic/d_main.c
+++ b/src/heretic/d_main.c
@@ -812,6 +812,7 @@ void D_DoomMain(void)
GameMission_t gamemission;
int p;
char file[256];
+ char demolumpname[9];
I_PrintBanner(PACKAGE_STRING);
@@ -1005,9 +1006,26 @@ void D_DoomMain(void)
if (p)
{
- DEH_snprintf(file, sizeof(file), "%s.lmp", myargv[p + 1]);
- D_AddFile(file);
- DEH_printf("Playing demo %s.lmp.\n", myargv[p + 1]);
+ if (!M_StringEndsWith(myargv[p + 1], ".lmp"))
+ {
+ DEH_snprintf(file, sizeof(file), "%s.lmp", myargv[p + 1]);
+ }
+ else
+ {
+ M_StringCopy(file, myargv[p + 1], sizeof(file));
+ }
+
+ if (D_AddFile(file))
+ {
+ M_StringCopy(demolumpname, lumpinfo[numlumps - 1].name,
+ sizeof(demolumpname));
+
+ DEH_printf("Playing demo %s.\n", file);
+ }
+ else
+ {
+ M_StringCopy(demolumpname, myargv[p + 1], sizeof(demolumpname));
+ }
}
if (W_CheckNumForName(DEH_String("E2M1")) == -1)
@@ -1137,14 +1155,14 @@ void D_DoomMain(void)
if (p)
{
singledemo = true; // Quit after one demo
- G_DeferedPlayDemo(myargv[p + 1]);
+ G_DeferedPlayDemo(demolumpname);
D_DoomLoop(); // Never returns
}
p = M_CheckParmWithArgs("-timedemo", 1);
if (p)
{
- G_TimeDemo(myargv[p + 1]);
+ G_TimeDemo(demolumpname);
D_DoomLoop(); // Never returns
}