summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2006-03-24 20:40:08 +0000
committerSimon Howard2006-03-24 20:40:08 +0000
commit9d32e513a5cfa0b75a349f628cf5f89d4384fd26 (patch)
treec7ac5afa4afb393ba46d67303f93cb4ca046ea30 /src
parent79bd9a77c532183fcb38f63e99eb85a2a22a8096 (diff)
downloadchocolate-doom-9d32e513a5cfa0b75a349f628cf5f89d4384fd26.tar.gz
chocolate-doom-9d32e513a5cfa0b75a349f628cf5f89d4384fd26.tar.bz2
chocolate-doom-9d32e513a5cfa0b75a349f628cf5f89d4384fd26.zip
Call W_GenerateHashTable to generate the lumpname hashtable. Do
not constantly look up MAP01 to see if this is a store demo. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 438
Diffstat (limited to 'src')
-rw-r--r--src/d_main.c22
-rw-r--r--src/w_wad.h17
2 files changed, 28 insertions, 11 deletions
diff --git a/src/d_main.c b/src/d_main.c
index c0f50a3d..353dcbd4 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: d_main.c 429 2006-03-23 17:43:15Z fraggle $
+// $Id: d_main.c 438 2006-03-24 20:40:08Z 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 429 2006-03-23 17:43:15Z fraggle $";
+static const char rcsid[] = "$Id: d_main.c 438 2006-03-24 20:40:08Z fraggle $";
#define BGCOLOR 7
#define FGCOLOR 8
@@ -292,7 +292,9 @@ FILE* debugfile;
boolean advancedemo;
+// Store demo, do not accept any inputs
+boolean storedemo;
char wadfile[1024]; // primary wad file
@@ -361,9 +363,8 @@ void D_ProcessEvents (void)
event_t* ev;
// IF STORE DEMO, DO NOT ACCEPT INPUT
- if ( ( gamemode == commercial )
- && (W_CheckNumForName("map01")<0) )
- return;
+ if (storedemo)
+ return;
while ((ev = D_PopEvent()) != NULL)
{
@@ -1516,6 +1517,10 @@ void D_DoomMain (void)
D_AddFile (file);
printf(DEH_String("Playing demo %s.lmp.\n"),myargv[p+1]);
}
+
+ // Generate the WAD hash table. Speed things up a bit.
+
+ W_GenerateHashTable();
IdentifyVersion();
InitGameVersion();
@@ -1657,6 +1662,13 @@ void D_DoomMain (void)
printf (DEH_String("ST_Init: Init status bar.\n"));
ST_Init ();
+ // If Doom II without a MAP01 lump, this is a store demo.
+ // Moved this here so that MAP01 isn't constantly looked up
+ // in the main loop.
+
+ if (gamemode == commercial && W_CheckNumForName("map01") < 0)
+ storedemo = true;
+
// start the apropriate game based on parms
p = M_CheckParm ("-record");
diff --git a/src/w_wad.h b/src/w_wad.h
index 548c2a54..659c0b40 100644
--- a/src/w_wad.h
+++ b/src/w_wad.h
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: w_wad.h 362 2006-02-03 18:41:26Z fraggle $
+// $Id: w_wad.h 438 2006-03-24 20:40:08Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -44,7 +44,6 @@ typedef struct
char identification[4];
int numlumps;
int infotableofs;
-
} wadinfo_t;
@@ -53,20 +52,26 @@ typedef struct
int filepos;
int size;
char name[8];
-
} filelump_t;
//
// WADFILE I/O related stuff.
//
-typedef struct
+
+typedef struct lumpinfo_s lumpinfo_t;
+
+struct lumpinfo_s
{
char name[8];
FILE *handle;
int position;
int size;
void *cache;
-} lumpinfo_t;
+
+ // Used for hash table lookups
+
+ lumpinfo_t *next;
+};
extern void** lumpcache;
@@ -85,7 +90,7 @@ void W_ReadLump (int lump, void *dest);
void* W_CacheLumpNum (int lump, int tag);
void* W_CacheLumpName (char* name, int tag);
-
+void W_GenerateHashTable(void);
#endif