From 600ac5db6bf147ab689763a672e3f2ec0a9ac6b3 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 27 Sep 2013 22:54:23 +0000 Subject: Translate HHE thing numbers according to patch exe version number, as our mobjinfo table contains an extra entry. Subversion-branch: /branches/v2-branch Subversion-revision: 2688 --- src/heretic/deh_thing.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/heretic/deh_thing.c') diff --git a/src/heretic/deh_thing.c b/src/heretic/deh_thing.c index dbb239e4..63fd381e 100644 --- a/src/heretic/deh_thing.c +++ b/src/heretic/deh_thing.c @@ -66,21 +66,24 @@ DEH_END_MAPPING static void *DEH_ThingStart(deh_context_t *context, char *line) { - int thing_number = 0; + int orig_thing_number = 0, thing_number = 0; mobjinfo_t *mobj; - if (sscanf(line, "Thing %i", &thing_number) != 1) + if (sscanf(line, "Thing %i", &orig_thing_number) != 1) { DEH_Warning(context, "Parse error on section start"); return NULL; } - // HHE thing numbers are indexed from 1 - --thing_number; + // Translate to the correct thing number based on the exe version this + // patch was made for. Subtract one because HHE thing numbers are + // indexed from 1. + + thing_number = DEH_MapHereticThingType(orig_thing_number - 1); if (thing_number < 0 || thing_number >= DEH_HERETIC_NUMMOBJTYPES) { - DEH_Warning(context, "Invalid thing number: %i", thing_number); + DEH_Warning(context, "Invalid thing number: %i", orig_thing_number); return NULL; } -- cgit v1.2.3