From fb00bf8354efee1847cbec3370f7a34eef745d3a Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 30 Mar 2014 00:24:49 -0400 Subject: 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. --- src/strife/d_main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/strife') diff --git a/src/strife/d_main.c b/src/strife/d_main.c index edd01f87..5d8399eb 100644 --- a/src/strife/d_main.c +++ b/src/strife/d_main.c @@ -1606,21 +1606,21 @@ void D_DoomMain (void) if (p) { - if (!strcasecmp(myargv[p+1] + strlen(myargv[p+1]) - 4, ".lmp")) + // With Vanilla you have to specify the file without extension, + // but make that optional. + if (M_StringEndsWith(myargv[p + 1], ".lmp")) { M_StringCopy(file, myargv[p + 1], sizeof(file)); } else { - snprintf(file, sizeof(file), "%s.lmp", myargv[p+1]); + DEH_snprintf(file, sizeof(file), "%s.lmp", myargv[p+1]); } if (D_AddFile (file)) { M_StringCopy(demolumpname, lumpinfo[numlumps - 1].name, sizeof(demolumpname)); - - printf("Playing demo %s.\n", file); } else { @@ -1631,6 +1631,7 @@ void D_DoomMain (void) M_StringCopy(demolumpname, myargv[p + 1], sizeof(demolumpname)); } + printf("Playing demo %s.\n", file); } I_AtExit((atexit_func_t) G_CheckDemoStatus, true); -- cgit v1.2.3