summaryrefslogtreecommitdiff
path: root/src/heretic/deh_htic.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/heretic/deh_htic.c')
-rw-r--r--src/heretic/deh_htic.c67
1 files changed, 66 insertions, 1 deletions
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"