summaryrefslogtreecommitdiff
path: root/src/doom
diff options
context:
space:
mode:
authorSimon Howard2014-03-23 02:57:36 -0400
committerSimon Howard2014-03-23 02:57:36 -0400
commitb295df80fe09802a774f9ef05d126f5139a383fa (patch)
treea18bec756f1ac5a444ccb18c4cd55a8013933768 /src/doom
parent3ac445e219bbfd2caa252a3896d65c8555bcf9d8 (diff)
downloadchocolate-doom-b295df80fe09802a774f9ef05d126f5139a383fa.tar.gz
chocolate-doom-b295df80fe09802a774f9ef05d126f5139a383fa.tar.bz2
chocolate-doom-b295df80fe09802a774f9ef05d126f5139a383fa.zip
doom: Add initial support for versions < v1.9.
Add -gameversion options for v1.666, v1.7, v1.8. Set demo and savegame headers appropriately depending on version. Also add an enum entry for Doom v1.2 but no code support for it yet.
Diffstat (limited to 'src/doom')
-rw-r--r--src/doom/d_main.c15
-rw-r--r--src/doom/g_game.c28
-rw-r--r--src/doom/g_game.h1
-rw-r--r--src/doom/p_saveg.c11
4 files changed, 41 insertions, 14 deletions
diff --git a/src/doom/d_main.c b/src/doom/d_main.c
index e0bd1d26..5f7e2051 100644
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -659,13 +659,15 @@ static char *GetGameName(char *gamename)
if (deh_sub != banners[i])
{
- // Has been replaced
- // We need to expand via printf to include the Doom version
- // number
+ int version;
+
+ // Has been replaced.
+ // We need to expand via printf to include the Doom version number
// We also need to cut off spaces to get the basic name
gamename = Z_Malloc(strlen(deh_sub) + 10, PU_STATIC, 0);
- sprintf(gamename, deh_sub, DOOM_VERSION / 100, DOOM_VERSION % 100);
+ version = G_VanillaVersionCode();
+ sprintf(gamename, deh_sub, version / 100, version % 100);
while (gamename[0] != '\0' && isspace(gamename[0]))
strcpy(gamename, gamename+1);
@@ -854,6 +856,9 @@ static struct
char *cmdline;
GameVersion_t version;
} gameversions[] = {
+ {"Doom 1.666", "1.666", exe_doom_1_666},
+ {"Doom 1.7/1.7a", "1.7", exe_doom_1_7},
+ {"Doom 1.8", "1.8", exe_doom_1_8},
{"Doom 1.9", "1.9", exe_doom_1_9},
{"Hacx", "hacx", exe_hacx},
{"Ultimate Doom", "ultimate", exe_ultimate},
@@ -925,6 +930,8 @@ static void InitGameVersion(void)
// original
gameversion = exe_doom_1_9;
+
+ // TODO: Detect IWADs earlier than Doom v1.9.
}
else if (gamemode == retail)
{
diff --git a/src/doom/g_game.c b/src/doom/g_game.c
index 6ceb1cbb..4a814871 100644
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -1961,8 +1961,26 @@ void G_RecordDemo (char *name)
demorecording = true;
}
-
-
+
+// Get the demo version code appropriate for the version set in gameversion.
+int G_VanillaVersionCode(void)
+{
+ switch (gameversion)
+ {
+ case exe_doom_1_2:
+ I_Error("Doom 1.2 does not have a version code!");
+ case exe_doom_1_666:
+ return 106;
+ case exe_doom_1_7:
+ return 107;
+ case exe_doom_1_8:
+ return 108;
+ case exe_doom_1_9:
+ default: // All other versions are variants on v1.9:
+ return 109;
+ }
+}
+
void G_BeginRecording (void)
{
int i;
@@ -1989,7 +2007,7 @@ void G_BeginRecording (void)
}
else
{
- *demo_p++ = DOOM_VERSION;
+ *demo_p++ = G_VanillaVersionCode();
}
*demo_p++ = gameskill;
@@ -2067,7 +2085,7 @@ void G_DoPlayDemo (void)
demoversion = *demo_p++;
- if (demoversion == DOOM_VERSION)
+ if (demoversion == G_VanillaVersionCode())
{
longtics = false;
}
@@ -2086,7 +2104,7 @@ void G_DoPlayDemo (void)
" See: http://doomworld.com/files/patches.shtml\n"
" This appears to be %s.";
- I_Error(message, demoversion, DOOM_VERSION,
+ I_Error(message, demoversion, G_VanillaVersionCode(),
DemoVersionDescription(demoversion));
}
diff --git a/src/doom/g_game.h b/src/doom/g_game.h
index 46c80bd8..42cc5f64 100644
--- a/src/doom/g_game.h
+++ b/src/doom/g_game.h
@@ -80,6 +80,7 @@ boolean G_Responder (event_t* ev);
void G_ScreenShot (void);
void G_DrawMouseSpeedBox(void);
+int G_VanillaVersionCode(void);
extern int vanilla_savegame_limit;
extern int vanilla_demo_limit;
diff --git a/src/doom/p_saveg.c b/src/doom/p_saveg.c
index 968120c0..7dd386a3 100644
--- a/src/doom/p_saveg.c
+++ b/src/doom/p_saveg.c
@@ -37,6 +37,7 @@
// State.
#include "doomstat.h"
+#include "g_game.h"
#include "r_state.h"
#define SAVEGAME_EOF 0x1d
@@ -1361,8 +1362,8 @@ void P_WriteSaveGameHeader(char *description)
for (; i<SAVESTRINGSIZE; ++i)
saveg_write8(0);
- memset (name,0,sizeof(name));
- sprintf (name,"version %i",DOOM_VERSION);
+ memset(name, 0, sizeof(name));
+ sprintf(name, "version %i", G_VanillaVersionCode());
for (i=0; i<VERSIONSIZE; ++i)
saveg_write8(name[i]);
@@ -1398,11 +1399,11 @@ boolean P_ReadSaveGameHeader(void)
for (i=0; i<VERSIONSIZE; ++i)
read_vcheck[i] = saveg_read8();
- memset (vcheck,0,sizeof(vcheck));
- sprintf (vcheck,"version %i",DOOM_VERSION);
+ memset(vcheck, 0, sizeof(vcheck));
+ sprintf(vcheck, "version %i", G_VanillaVersionCode());
if (strcmp(read_vcheck, vcheck) != 0)
return false; // bad version
-
+
gameskill = saveg_read8();
gameepisode = saveg_read8();
gamemap = saveg_read8();