summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2010-04-18 16:40:14 +0000
committerSimon Howard2010-04-18 16:40:14 +0000
commit8069d8a0fdf30516cb6eff6d6a9e2990061f95c1 (patch)
treeb09643d363098adcc7e874025e00d21e8ce9dcc3
parent0c0d4ed517a8a9559f96e92ef105e52eb01be1ee (diff)
downloadchocolate-doom-8069d8a0fdf30516cb6eff6d6a9e2990061f95c1.tar.gz
chocolate-doom-8069d8a0fdf30516cb6eff6d6a9e2990061f95c1.tar.bz2
chocolate-doom-8069d8a0fdf30516cb6eff6d6a9e2990061f95c1.zip
Add -hhever command line parameter to select patch version number.
Subversion-branch: /branches/raven-branch Subversion-revision: 1902
-rw-r--r--src/heretic/deh_frame.c11
-rw-r--r--src/heretic/deh_htic.c67
-rw-r--r--src/heretic/deh_htic.h1
3 files changed, 69 insertions, 10 deletions
diff --git a/src/heretic/deh_frame.c b/src/heretic/deh_frame.c
index 8d9a8fdf..6d7f6c3b 100644
--- a/src/heretic/deh_frame.c
+++ b/src/heretic/deh_frame.c
@@ -186,17 +186,10 @@ DEH_BEGIN_MAPPING(state_mapping, state_t)
DEH_MAPPING("Unknown 2", misc2)
DEH_END_MAPPING
-// When a HHE patch is first loaded, we must apply a small change
-// to the states[] table. The table was changed between 1.0 and
-// 1.3 to add two extra frames to the player "burning death"
-// animation.
-// If we are using an HHE patch, the table must behave like the
-// Heretic 1.0 table. We must therefore change the table to cut
-// these out again.
-
static void DEH_FrameInit(void)
{
- states[S_PLAY_FDTH18].nextstate = S_NULL;
+ // Bit of a hack here:
+ DEH_HereticInit();
}
static void *DEH_FrameStart(deh_context_t *context, char *line)
diff --git a/src/heretic/deh_htic.c b/src/heretic/deh_htic.c
index ff5d02ac..40fa5765 100644
--- a/src/heretic/deh_htic.c
+++ b/src/heretic/deh_htic.c
@@ -24,11 +24,15 @@
//
//-----------------------------------------------------------------------------
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+
#include "deh_defs.h"
#include "deh_main.h"
#include "deh_htic.h"
#include "info.h"
+#include "m_argv.h"
char *deh_signatures[] =
{
@@ -37,6 +41,11 @@ char *deh_signatures[] =
NULL
};
+static char *hhe_versions[] =
+{
+ "1.0", "1.2", "1.3"
+};
+
// Version number for patches.
deh_hhe_version_t deh_hhe_version = deh_hhe_1_0;
@@ -72,9 +81,65 @@ deh_section_t *deh_section_types[] =
NULL
};
+static void SetHHEVersionByName(char *name)
+{
+ int i;
+
+ for (i=0; i<arrlen(hhe_versions); ++i)
+ {
+ if (!strcmp(hhe_versions[i], name))
+ {
+ deh_hhe_version = i;
+ return;
+ }
+ }
+
+ fprintf(stderr, "Unknown Heretic version: %s\n", name);
+ fprintf(stderr, "Valid versions:\n");
+
+ for (i=0; i<arrlen(hhe_versions); ++i)
+ {
+ fprintf(stderr, "\t%s\n", hhe_versions[i]);
+ }
+}
+
+// Initialize Heretic(HHE)-specific dehacked bits.
+
+void DEH_HereticInit(void)
+{
+ int i;
+
+ //!
+ // @arg <version>
+ //
+ // Select the Heretic version number that was used to generate the
+ // HHE patch to be loaded. Patches for each of the Vanilla
+ // Heretic versions (1.0, 1.2, 1.3) can be loaded, but the correct
+ // version number must be specified.
+
+ i = M_CheckParm("-hhever");
+
+ if (i > 0)
+ {
+ SetHHEVersionByName(myargv[i + 1]);
+ }
+
+ // For v1.0 patches, we must apply a slight change to the states[]
+ // table. The table was changed between 1.0 and 1.3 to add two extra
+ // frames to the player "burning death" animation.
+ //
+ // If we are using a v1.0 patch, we must change the table to cut
+ // these out again.
+
+ if (deh_hhe_version < deh_hhe_1_2)
+ {
+ states[S_PLAY_FDTH18].nextstate = S_NULL;
+ }
+}
+
int DEH_MapHereticFrameNumber(int frame)
{
- if (deh_hhe_version < deh_hhe_1_0)
+ if (deh_hhe_version < deh_hhe_1_2)
{
// Between Heretic 1.0 and 1.2, two new frames
// were added to the "states" table, to extend the "flame death"
diff --git a/src/heretic/deh_htic.h b/src/heretic/deh_htic.h
index 199ad2fe..f006c149 100644
--- a/src/heretic/deh_htic.h
+++ b/src/heretic/deh_htic.h
@@ -50,6 +50,7 @@ typedef enum
#define DEH_HERETIC_NUMMOBJTYPES (NUMMOBJTYPES - 2)
+void DEH_HereticInit(void);
int DEH_MapHereticFrameNumber(int frame);
extern deh_hhe_version_t deh_hhe_version;