diff options
author | Simon Howard | 2014-03-30 00:24:49 -0400 |
---|---|---|
committer | Simon Howard | 2014-03-30 00:24:49 -0400 |
commit | fb00bf8354efee1847cbec3370f7a34eef745d3a (patch) | |
tree | b2ea3af9d5f714baf141dd8fdb0a65973cc0f31c /src/heretic | |
parent | 59a80b5a902d51d03fb079b0ec5560d450f92731 (diff) | |
download | chocolate-doom-fb00bf8354efee1847cbec3370f7a34eef745d3a.tar.gz chocolate-doom-fb00bf8354efee1847cbec3370f7a34eef745d3a.tar.bz2 chocolate-doom-fb00bf8354efee1847cbec3370f7a34eef745d3a.zip |
hexen: Make -playdemo cope with paths.
Vanilla Hexen 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.
Also rework the code for other games so that they're slightly more
consistent. This fixes #301.
Diffstat (limited to 'src/heretic')
-rw-r--r-- | src/heretic/d_main.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c index 316a30b8..d0fdc582 100644 --- a/src/heretic/d_main.c +++ b/src/heretic/d_main.c @@ -1006,26 +1006,30 @@ void D_DoomMain(void) if (p) { - if (!M_StringEndsWith(myargv[p + 1], ".lmp")) + // In Vanilla, the filename must be specified without .lmp, + // but make that optional. + if (M_StringEndsWith(myargv[p + 1], ".lmp")) { - DEH_snprintf(file, sizeof(file), "%s.lmp", myargv[p + 1]); + M_StringCopy(file, myargv[p + 1], sizeof(file)); } else { - M_StringCopy(file, myargv[p + 1], sizeof(file)); + DEH_snprintf(file, sizeof(file), "%s.lmp", myargv[p + 1]); } if (D_AddFile(file)) { M_StringCopy(demolumpname, lumpinfo[numlumps - 1].name, sizeof(demolumpname)); - - DEH_printf("Playing demo %s.\n", file); } else { + // The file failed to load, but copy the original arg as a + // demo name to make tricks like -playdemo demo1 possible. M_StringCopy(demolumpname, myargv[p + 1], sizeof(demolumpname)); } + + printf("Playing demo %s.\n", file); } if (W_CheckNumForName(DEH_String("E2M1")) == -1) |