ref: 9d32e513a5cfa0b75a349f628cf5f89d4384fd26
parent: 79bd9a77c532183fcb38f63e99eb85a2a22a8096
author: Simon Howard <[email protected]>
date: Fri Mar 24 15:40:08 EST 2006
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
--- 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 @@
boolean advancedemo;
+// Store demo, do not accept any inputs
+boolean storedemo;
char wadfile[1024]; // primary wad file
@@ -361,9 +363,8 @@
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 @@
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();
@@ -1656,6 +1661,13 @@
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");
--- 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 @@
char identification[4];
int numlumps;
int infotableofs;
-
} wadinfo_t;
@@ -53,13 +52,15 @@
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;
@@ -66,9 +67,13 @@
int position;
int size;
void *cache;
-} lumpinfo_t;
+ // Used for hash table lookups
+ lumpinfo_t *next;
+};
+
+
extern void** lumpcache;
extern lumpinfo_t* lumpinfo;
extern int numlumps;
@@ -85,7 +90,7 @@
void* W_CacheLumpNum (int lump, int tag);
void* W_CacheLumpName (char* name, int tag);
-
+void W_GenerateHashTable(void);
#endif