summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2006-05-22 18:51:21 +0000
committerSimon Howard2006-05-22 18:51:21 +0000
commita94100706700ff6b29f6ff3d8a6be7daf46f4dfc (patch)
treefb38ec67eba5e7756271ba132825ee6571e2e5fe /src
parent7c18ad6ccf1461696185013b333af3c056cc5630 (diff)
downloadchocolate-doom-a94100706700ff6b29f6ff3d8a6be7daf46f4dfc.tar.gz
chocolate-doom-a94100706700ff6b29f6ff3d8a6be7daf46f4dfc.tar.bz2
chocolate-doom-a94100706700ff6b29f6ff3d8a6be7daf46f4dfc.zip
Allow specifying the full path and filename when playing back demos.
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 510
Diffstat (limited to 'src')
-rw-r--r--src/d_main.c45
1 files changed, 34 insertions, 11 deletions
diff --git a/src/d_main.c b/src/d_main.c
index 78ceac49..78781ea9 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: d_main.c 484 2006-05-19 20:01:59Z fraggle $
+// $Id: d_main.c 510 2006-05-22 18:51:21Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -184,7 +184,7 @@
//-----------------------------------------------------------------------------
-static const char rcsid[] = "$Id: d_main.c 484 2006-05-19 20:01:59Z fraggle $";
+static const char rcsid[] = "$Id: d_main.c 510 2006-05-22 18:51:21Z fraggle $";
#define BGCOLOR 7
#define FGCOLOR 8
@@ -734,10 +734,10 @@ void D_StartTitle (void)
char title[128];
-static void D_AddFile(char *filename)
+static boolean D_AddFile(char *filename)
{
printf(" adding %s\n", filename);
- W_AddFile(filename);
+ return W_AddFile(filename);
}
@@ -1342,7 +1342,8 @@ void PrintGameVersion(void)
void D_DoomMain (void)
{
int p;
- char file[256];
+ char file[256];
+ char demolumpname[9];
FindResponseFile ();
@@ -1542,9 +1543,32 @@ void D_DoomMain (void)
if (p && p < myargc-1)
{
- sprintf (file,"%s.lmp", myargv[p+1]);
- D_AddFile (file);
- printf(DEH_String("Playing demo %s.lmp.\n"),myargv[p+1]);
+ if (!strcasecmp(myargv[p+1] + strlen(myargv[p+1]) - 4, ".lmp"))
+ {
+ strcpy(file, myargv[p + 1]);
+ }
+ else
+ {
+ sprintf (file,"%s.lmp", myargv[p+1]);
+ }
+
+ if (D_AddFile (file))
+ {
+ strncpy(demolumpname, lumpinfo[numlumps - 1].name, 8);
+ demolumpname[8] = '\0';
+
+ printf("Playing demo %s.\n", file);
+ }
+ else
+ {
+ // If file failed to load, still continue trying to play
+ // the demo in the same way as Vanilla Doom. This makes
+ // tricks like "-playdemo demo1" possible.
+
+ strncpy(demolumpname, myargv[p + 1], 8);
+ demolumpname[8] = '\0';
+ }
+
}
// Generate the WAD hash table. Speed things up a bit.
@@ -1714,14 +1738,14 @@ void D_DoomMain (void)
if (p && p < myargc-1)
{
singledemo = true; // quit after one demo
- G_DeferedPlayDemo (myargv[p+1]);
+ G_DeferedPlayDemo (demolumpname);
D_DoomLoop (); // never returns
}
p = M_CheckParm ("-timedemo");
if (p && p < myargc-1)
{
- G_TimeDemo (myargv[p+1]);
+ G_TimeDemo (demolumpname);
D_DoomLoop (); // never returns
}
@@ -1738,7 +1762,6 @@ void D_DoomMain (void)
G_InitNew (startskill, startepisode, startmap);
else
D_StartTitle (); // start up intro loop
-
}
D_DoomLoop (); // never returns