summaryrefslogtreecommitdiff
path: root/src/doom
diff options
context:
space:
mode:
Diffstat (limited to 'src/doom')
-rw-r--r--src/doom/d_main.c86
-rw-r--r--src/doom/d_net.c24
-rw-r--r--src/doom/doomstat.h1
-rw-r--r--src/doom/m_menu.c2
-rw-r--r--src/doom/p_setup.c12
-rw-r--r--src/doom/p_spec.c5
-rw-r--r--src/doom/r_data.c20
7 files changed, 102 insertions, 48 deletions
diff --git a/src/doom/d_main.c b/src/doom/d_main.c
index fed6a1b4..69dd6e9f 100644
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -122,8 +122,6 @@ int startmap;
boolean autostart;
int startloadgame;
-FILE* debugfile;
-
boolean advancedemo;
// Store demo, do not accept any inputs
@@ -424,14 +422,6 @@ void D_DoomLoop (void)
if (demorecording)
G_BeginRecording ();
- if (M_CheckParm ("-debugfile"))
- {
- char filename[20];
- sprintf (filename,"debug%i.txt",consoleplayer);
- printf ("debug output to: %s\n",filename);
- debugfile = fopen (filename,"w");
- }
-
TryRunTics();
I_SetWindowTitle(gamedescription);
@@ -611,8 +601,12 @@ void D_StartTitle (void)
// These are from the original source: some of them are perhaps
// not used in any dehacked patches
-static char *banners[] =
+static char *banners[] =
{
+ // doom2.wad
+ " "
+ "DOOM 2: Hell on Earth v%i.%i"
+ " ",
// doom1.wad
" "
"DOOM Shareware Startup v%i.%i"
@@ -629,10 +623,6 @@ static char *banners[] =
" "
"The Ultimate DOOM Startup v%i.%i"
" ",
- // doom2.wad
- " "
- "DOOM 2: Hell on Earth v%i.%i"
- " ",
// tnt.wad
" "
"DOOM 2: TNT - Evilution v%i.%i"
@@ -833,6 +823,18 @@ static boolean CheckChex(char *iwadname)
chex_iwadname));
}
+// Check if the IWAD file is the Hacx IWAD.
+// Returns true if this is hacx.wad.
+
+static boolean CheckHacx(char *iwadname)
+{
+ char *hacx_iwadname = "hacx.wad";
+
+ return (strlen(iwadname) > strlen(hacx_iwadname)
+ && !strcasecmp(iwadname + strlen(iwadname) - strlen(hacx_iwadname),
+ hacx_iwadname));
+}
+
// print title for every printed line
char title[128];
@@ -903,6 +905,7 @@ static struct
GameVersion_t version;
} gameversions[] = {
{"Doom 1.9", "1.9", exe_doom_1_9},
+ {"Hacx", "hacx", exe_hacx},
{"Ultimate Doom", "ultimate", exe_ultimate},
{"Final Doom", "final", exe_final},
{"Chex Quest", "chex", exe_chex},
@@ -960,6 +963,12 @@ static void InitGameVersion(void)
gameversion = exe_chex;
}
+ else if (CheckHacx(iwadfile))
+ {
+ // hacx exe: identified by iwad filename
+
+ gameversion = exe_hacx;
+ }
else if (gamemode == shareware || gamemode == registered)
{
// original
@@ -1060,6 +1069,20 @@ static void D_Endoom(void)
I_Endoom(endoom);
}
+static void LoadHacxDeh(void)
+{
+ // If this is the HACX IWAD, we need to load the DEHACKED lump.
+
+ if (gameversion == exe_hacx)
+ {
+ if (!DEH_LoadLumpByName("DEHACKED"))
+ {
+ I_Error("DEHACKED lump not found. Please check that this is the "
+ "Hacx v1.2 IWAD.");
+ }
+ }
+}
+
//
// D_DoomMain
//
@@ -1097,6 +1120,21 @@ void D_DoomMain (void)
}
//!
+ // @category net
+ //
+ // Query the Internet master server for a global list of active
+ // servers.
+ //
+
+ if (M_CheckParm("-search"))
+ {
+ printf("\nSearching for servers on Internet ...\n");
+ p = NET_MasterQuery(NET_QueryPrintCallback, NULL);
+ printf("\n%i server(s) found.\n", p);
+ exit(0);
+ }
+
+ //!
// @arg <address>
// @category net
//
@@ -1109,6 +1147,7 @@ void D_DoomMain (void)
if (p > 0)
{
NET_QueryAddress(myargv[p+1]);
+ exit(0);
}
//!
@@ -1117,8 +1156,13 @@ void D_DoomMain (void)
// Search the local LAN for running servers.
//
- if (M_CheckParm("-search"))
- NET_LANQuery();
+ if (M_CheckParm("-localsearch"))
+ {
+ printf("\nSearching for servers on local LAN ...\n");
+ p = NET_LANQuery(NET_QueryPrintCallback, NULL);
+ printf("\n%i server(s) found.\n", p);
+ exit(0);
+ }
#endif
@@ -1365,6 +1409,7 @@ void D_DoomMain (void)
D_IdentifyVersion();
InitGameVersion();
LoadChexDeh();
+ LoadHacxDeh();
D_SetGameDescription();
SetSaveGameDir(iwadfile);
@@ -1443,10 +1488,9 @@ void D_DoomMain (void)
p = M_CheckParm ("-timer");
- if (p && p < myargc-1 && deathmatch)
+ if (p && p < myargc-1)
{
timelimit = atoi(myargv[p+1]);
- printf("timer: %i\n", timelimit);
}
//!
@@ -1458,10 +1502,8 @@ void D_DoomMain (void)
p = M_CheckParm ("-avg");
- if (p && p < myargc-1 && deathmatch)
+ if (p && p < myargc-1)
{
- DEH_printf("Austin Virtual Gaming: Levels will end "
- "after 20 minutes\n");
timelimit = 20;
}
diff --git a/src/doom/d_net.c b/src/doom/d_net.c
index 05d1875f..b307d97f 100644
--- a/src/doom/d_net.c
+++ b/src/doom/d_net.c
@@ -499,6 +499,7 @@ boolean D_InitNetGame(net_connect_data_t *connect_data,
if (i > 0)
{
addr = NET_FindLANServer();
+ NET_SV_RegisterWithMaster();
if (addr == NULL)
{
@@ -617,12 +618,22 @@ void D_CheckNetGame (void)
// Show players here; the server might have specified a time limit
- if (timelimit > 0)
+ if (timelimit > 0 && deathmatch)
{
- DEH_printf("Levels will end after %d minute", timelimit);
- if (timelimit > 1)
- printf("s");
- printf(".\n");
+ // Gross hack to work like Vanilla:
+
+ if (timelimit == 20 && M_CheckParm("-avg"))
+ {
+ DEH_printf("Austin Virtual Gaming: Levels will end "
+ "after 20 minutes\n");
+ }
+ else
+ {
+ DEH_printf("Levels will end after %d minute", timelimit);
+ if (timelimit > 1)
+ printf("s");
+ printf(".\n");
+ }
}
}
@@ -634,9 +645,6 @@ void D_CheckNetGame (void)
//
void D_QuitNetGame (void)
{
- if (debugfile)
- fclose (debugfile);
-
#ifdef FEATURE_MULTIPLAYER
NET_SV_Shutdown();
diff --git a/src/doom/doomstat.h b/src/doom/doomstat.h
index 15a8d743..237234d8 100644
--- a/src/doom/doomstat.h
+++ b/src/doom/doomstat.h
@@ -255,7 +255,6 @@ extern int maxammo[NUMAMMO];
// File handling stuff.
extern char * savegamedir;
extern char basedefault[1024];
-extern FILE* debugfile;
// if true, load all graphics at level load
extern boolean precache;
diff --git a/src/doom/m_menu.c b/src/doom/m_menu.c
index a6f7bbfb..3bb4baa3 100644
--- a/src/doom/m_menu.c
+++ b/src/doom/m_menu.c
@@ -762,6 +762,8 @@ void M_DrawReadThis1(void)
switch (gameversion)
{
case exe_doom_1_9:
+ case exe_hacx:
+
if (gamemode == commercial)
{
// Doom 2
diff --git a/src/doom/p_setup.c b/src/doom/p_setup.c
index 7d9d4318..3fc95cab 100644
--- a/src/doom/p_setup.c
+++ b/src/doom/p_setup.c
@@ -755,17 +755,7 @@ P_SetupLevel
// Make sure all sounds are stopped before Z_FreeTags.
S_Start ();
-
-#if 0 // UNUSED
- if (debugfile)
- {
- Z_FreeTags (PU_LEVEL, INT_MAX);
- Z_FileDumpHeap (debugfile);
- }
- else
-#endif
- Z_FreeTags (PU_LEVEL, PU_PURGELEVEL-1);
-
+ Z_FreeTags (PU_LEVEL, PU_PURGELEVEL-1);
// UNUSED W_Profile ();
P_InitThinkers ();
diff --git a/src/doom/p_spec.c b/src/doom/p_spec.c
index 37beb850..fa3ec335 100644
--- a/src/doom/p_spec.c
+++ b/src/doom/p_spec.c
@@ -1389,10 +1389,9 @@ void P_SpawnSpecials (void)
if (W_CheckNumForName(DEH_String("texture2")) >= 0)
episode = 2;
-
// See if -TIMER was specified.
- if (timelimit > 0)
+ if (timelimit > 0 && deathmatch)
{
levelTimer = true;
levelTimeCount = timelimit * 60 * TICRATE;
@@ -1401,7 +1400,7 @@ void P_SpawnSpecials (void)
{
levelTimer = false;
}
-
+
// Init special SECTORs.
sector = sectors;
for (i=0 ; i<numsectors ; i++, sector++)
diff --git a/src/doom/r_data.c b/src/doom/r_data.c
index b999e916..505f1ff7 100644
--- a/src/doom/r_data.c
+++ b/src/doom/r_data.c
@@ -413,6 +413,7 @@ R_GetColumn
static void GenerateTextureHashTable(void)
{
+ texture_t **rover;
int i;
int key;
@@ -429,12 +430,25 @@ static void GenerateTextureHashTable(void)
textures[i]->index = i;
- // Hook into hash table
+ // Vanilla Doom does a linear search of the texures array
+ // and stops at the first entry it finds. If there are two
+ // entries with the same name, the first one in the array
+ // wins. The new entry must therefore be added at the end
+ // of the hash chain, so that earlier entries win.
key = W_LumpNameHash(textures[i]->name) % numtextures;
- textures[i]->next = textures_hashtable[key];
- textures_hashtable[key] = textures[i];
+ rover = &textures_hashtable[key];
+
+ while (*rover != NULL)
+ {
+ rover = &(*rover)->next;
+ }
+
+ // Hook into hash table
+
+ textures[i]->next = NULL;
+ *rover = textures[i];
}
}