From c33c1fa07680ef07540fb1c48a323bdc816e3e77 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 6 Feb 2010 15:54:13 +0000 Subject: Fix Heretic/Hexen "noise" sound debug cheats. Subversion-branch: /branches/raven-branch Subversion-revision: 1850 --- src/heretic/s_sound.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/heretic') diff --git a/src/heretic/s_sound.c b/src/heretic/s_sound.c index bdd24594..be4ae0e3 100644 --- a/src/heretic/s_sound.c +++ b/src/heretic/s_sound.c @@ -550,8 +550,16 @@ void S_GetChannelInfo(SoundInfo_t * s) c->priority = channel[i].priority; c->name = S_sfx[c->id].name; c->mo = channel[i].mo; - c->distance = P_AproxDistance(c->mo->x - viewx, c->mo->y - viewy) - >> FRACBITS; + + if (c->mo != NULL) + { + c->distance = P_AproxDistance(c->mo->x - viewx, c->mo->y - viewy) + >> FRACBITS; + } + else + { + c->distance = 0; + } } } -- cgit v1.2.3 From abb5f33199e6fe036d068b5a5f59e58e1505eb8e Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 7 Feb 2010 00:59:56 +0000 Subject: Add back unused phoenix rod object, frames, and dummy action pointer. These were in Heretic 1.0 but were later removed. Also add comments to info.h noting fire-death frames that were added Heretic 1.0. This is necessary for HHE support. Subversion-branch: /branches/raven-branch Subversion-revision: 1854 --- src/heretic/info.c | 35 +++++++++++++++++++++++++++++++++++ src/heretic/info.h | 8 ++++++-- src/heretic/p_pspr.c | 11 +++++++++++ 3 files changed, 52 insertions(+), 2 deletions(-) (limited to 'src/heretic') diff --git a/src/heretic/info.c b/src/heretic/info.c index e566222c..4848ede9 100644 --- a/src/heretic/info.c +++ b/src/heretic/info.c @@ -95,6 +95,7 @@ void A_InitPhoenixPL2(); void A_FirePhoenixPL2(); void A_ShutdownPhoenixPL2(); void A_PhoenixPuff(); +void A_RemovedPhoenixPuff(); void A_FlameEnd(); void A_FloatPuff(); void A_FireCrossbowPL1(); @@ -663,6 +664,9 @@ state_t states[NUMSTATES] = { {SPR_FX08, 32773, 4, NULL, S_PHOENIXFXI1_7, 0, 0}, // S_PHOENIXFXI1_6 {SPR_FX08, 32774, 4, NULL, S_PHOENIXFXI1_8, 0, 0}, // S_PHOENIXFXI1_7 {SPR_FX08, 32775, 4, NULL, S_NULL, 0, 0}, // S_PHOENIXFXI1_8 + {SPR_FX08, 32776, 8, NULL, S_PHOENIXFXIX_1, 0, 0 }, // S_PHOENIXFXIX_1 + {SPR_FX08, 32777, 8, A_RemovedPhoenixFunc, S_PHOENIXFXIX_2, 0, 0 }, // S_PHOENIXFXIX_2 + {SPR_FX08, 32778, 8, NULL, S_NULL, 0, 0 }, // S_PHOENIXFXIX_3 {SPR_FX04, 1, 4, NULL, S_PHOENIXPUFF2, 0, 0}, // S_PHOENIXPUFF1 {SPR_FX04, 2, 4, NULL, S_PHOENIXPUFF3, 0, 0}, // S_PHOENIXPUFF2 {SPR_FX04, 3, 4, NULL, S_PHOENIXPUFF4, 0, 0}, // S_PHOENIXPUFF3 @@ -3727,6 +3731,37 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF2_THRUGHOST | MF2_NOTELEPORT // flags2 }, + // The following thing is present in the mobjinfo table from Heretic 1.0, + // but not in Heretic 1.3 (ie. it was removed). It has been re-inserted + // here to support HHE patches. + + { // MT_PHOENIXFX_REMOVED + -1, // doomednum + S_PHOENIXFXIX_1, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // crashstate + S_PHOENIXFXIX_3, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 2 * FRACUNIT, // radius + 4 * FRACUNIT, // height + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOBLOCKMAP | MF_MISSILE | MF_DROPOFF | MF_NOGRAVITY, // flags + MF2_NOTELEPORT // flags2 + }, + { // MT_PHOENIXPUFF -1, // doomednum S_PHOENIXPUFF1, // spawnstate diff --git a/src/heretic/info.h b/src/heretic/info.h index f9581298..16b6aedc 100644 --- a/src/heretic/info.h +++ b/src/heretic/info.h @@ -653,6 +653,9 @@ typedef enum S_PHOENIXFXI1_6, S_PHOENIXFXI1_7, S_PHOENIXFXI1_8, + S_PHOENIXFXIX_1, // [ States in Heretic 1.0 that were removed + S_PHOENIXFXIX_2, + S_PHOENIXFXIX_3, // ] S_PHOENIXPUFF1, S_PHOENIXPUFF2, S_PHOENIXPUFF3, @@ -773,8 +776,8 @@ typedef enum S_PLAY_FDTH16, S_PLAY_FDTH17, S_PLAY_FDTH18, - S_PLAY_FDTH19, - S_PLAY_FDTH20, + S_PLAY_FDTH19, // < These two frames were not present in the Heretic + S_PLAY_FDTH20, // < 1.0 executable (fire death animation was extended) S_BLOODYSKULL1, S_BLOODYSKULL2, S_BLOODYSKULL3, @@ -1470,6 +1473,7 @@ typedef enum MT_GOLDWANDPUFF2, MT_WPHOENIXROD, MT_PHOENIXFX1, + MT_PHOENIXFX_REMOVED, // In Heretic 1.0, but removed. MT_PHOENIXPUFF, MT_PHOENIXFX2, MT_MISC15, diff --git a/src/heretic/p_pspr.c b/src/heretic/p_pspr.c index 7f9660ac..bd47c9a1 100644 --- a/src/heretic/p_pspr.c +++ b/src/heretic/p_pspr.c @@ -1650,6 +1650,17 @@ void A_PhoenixPuff(mobj_t * actor) puff->momz = 0; } +// +// This function was present in the Heretic 1.0 executable for the +// removed "secondary phoenix flash" object (MT_PHOENIXFX_REMOVED). +// The purpose of this object is unknown, as is this function. +// + +void A_RemovedPhoenixFunc(mobj_t *actor) +{ + I_Error("Action function invoked for removed Phoenix action!"); +} + //---------------------------------------------------------------------------- // // PROC A_InitPhoenixPL2 -- cgit v1.2.3 From b786d601aeaaa20167f408be56f7e8d13ecc2f8c Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 7 Feb 2010 02:04:12 +0000 Subject: Oops. Subversion-branch: /branches/raven-branch Subversion-revision: 1855 --- src/heretic/info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/heretic') diff --git a/src/heretic/info.c b/src/heretic/info.c index 4848ede9..7149220e 100644 --- a/src/heretic/info.c +++ b/src/heretic/info.c @@ -95,7 +95,7 @@ void A_InitPhoenixPL2(); void A_FirePhoenixPL2(); void A_ShutdownPhoenixPL2(); void A_PhoenixPuff(); -void A_RemovedPhoenixPuff(); +void A_RemovedPhoenixFunc(); void A_FlameEnd(); void A_FloatPuff(); void A_FireCrossbowPL1(); -- cgit v1.2.3 From f04325260a5a95ca4c60c3b57762e48beedc381e Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 7 Feb 2010 03:02:01 +0000 Subject: Move sound structure and ammo definitions into headers. Add #ifndef guards around info.h. Subversion-branch: /branches/raven-branch Subversion-revision: 1857 --- src/heretic/doomdef.h | 1 + src/heretic/info.h | 7 ++++++- src/heretic/p_inter.c | 2 +- src/heretic/s_sound.c | 5 ++--- src/heretic/sounds.h | 5 +++++ 5 files changed, 15 insertions(+), 5 deletions(-) (limited to 'src/heretic') diff --git a/src/heretic/doomdef.h b/src/heretic/doomdef.h index 3f976c3d..aa1d0c0d 100644 --- a/src/heretic/doomdef.h +++ b/src/heretic/doomdef.h @@ -581,6 +581,7 @@ extern boolean singletics; // debug flag to cancel adaptiveness extern boolean DebugSound; // debug flag for displaying sound info extern int maxammo[NUMAMMO]; +extern int GetWeaponAmmo[NUMWEAPONS]; extern boolean demoplayback; extern int skytexture; diff --git a/src/heretic/info.h b/src/heretic/info.h index 16b6aedc..236826cb 100644 --- a/src/heretic/info.h +++ b/src/heretic/info.h @@ -21,7 +21,9 @@ // 02111-1307, USA. // //----------------------------------------------------------------------------- -// generated by multigen + +#ifndef HERETIC_INFO_H +#define HERETIC_INFO_H typedef enum { @@ -1579,3 +1581,6 @@ typedef struct } mobjinfo_t; extern mobjinfo_t mobjinfo[NUMMOBJTYPES]; + +#endif /* #ifndef HERETIC_INFO_H */ + diff --git a/src/heretic/p_inter.c b/src/heretic/p_inter.c index fba6d215..3587a95d 100644 --- a/src/heretic/p_inter.c +++ b/src/heretic/p_inter.c @@ -54,7 +54,7 @@ int maxammo[NUMAMMO] = { 150 // mace }; -static int GetWeaponAmmo[NUMWEAPONS] = { +int GetWeaponAmmo[NUMWEAPONS] = { 0, // staff 25, // gold wand 10, // crossbow diff --git a/src/heretic/s_sound.c b/src/heretic/s_sound.c index be4ae0e3..8e0be9f1 100644 --- a/src/heretic/s_sound.c +++ b/src/heretic/s_sound.c @@ -33,6 +33,8 @@ #include "r_local.h" #include "p_local.h" +#include "sounds.h" + #include "w_wad.h" #include "z_zone.h" @@ -55,9 +57,6 @@ int mus_lumpnum; void *mus_sndptr; byte *soundCurve; -extern sfxinfo_t S_sfx[]; -extern musicinfo_t S_music[]; - int snd_MaxVolume = 10; int snd_MusicVolume = 10; int snd_Channels = 16; diff --git a/src/heretic/sounds.h b/src/heretic/sounds.h index 707185c0..e50a6ad6 100644 --- a/src/heretic/sounds.h +++ b/src/heretic/sounds.h @@ -27,6 +27,8 @@ #ifndef __SOUNDSH__ #define __SOUNDSH__ +#include "i_sound.h" + #define MAX_SND_DIST 1600 #define MAX_CHANNELS 16 @@ -291,4 +293,7 @@ typedef enum NUMSFX } sfxenum_t; +extern sfxinfo_t S_sfx[]; +extern musicinfo_t S_music[]; + #endif -- cgit v1.2.3 From 6a92bc54be4081c8821ca110947133b5f1f8516b Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 7 Feb 2010 03:04:29 +0000 Subject: Initial code for HHE patch support. Subversion-branch: /branches/raven-branch Subversion-revision: 1858 --- src/heretic/Makefile.am | 11 +++- src/heretic/deh_ammo.c | 122 ++++++++++++++++++++++++++++++++++++++ src/heretic/deh_frame.c | 131 +++++++++++++++++++++++++++++++++++++++++ src/heretic/deh_htic.c | 85 +++++++++++++++++++++++++++ src/heretic/deh_htic.h | 45 ++++++++++++++ src/heretic/deh_sound.c | 118 +++++++++++++++++++++++++++++++++++++ src/heretic/deh_thing.c | 149 +++++++++++++++++++++++++++++++++++++++++++++++ src/heretic/deh_weapon.c | 130 +++++++++++++++++++++++++++++++++++++++++ 8 files changed, 790 insertions(+), 1 deletion(-) create mode 100644 src/heretic/deh_ammo.c create mode 100644 src/heretic/deh_frame.c create mode 100644 src/heretic/deh_htic.c create mode 100644 src/heretic/deh_htic.h create mode 100644 src/heretic/deh_sound.c create mode 100644 src/heretic/deh_thing.c create mode 100644 src/heretic/deh_weapon.c (limited to 'src/heretic') diff --git a/src/heretic/Makefile.am b/src/heretic/Makefile.am index 2a2f8245..3fdd3ff7 100644 --- a/src/heretic/Makefile.am +++ b/src/heretic/Makefile.am @@ -55,5 +55,14 @@ EXTRA_DIST= \ i_sound.c \ i_ibm.c -libheretic_a_SOURCES=$(SOURCE_FILES) +FEATURE_DEHACKED_SOURCE_FILES = \ +deh_ammo.c \ +deh_frame.c \ +deh_htic.c \ +deh_sound.c \ +deh_thing.c \ +deh_weapon.c + +libheretic_a_SOURCES=$(SOURCE_FILES) \ + $(FEATURE_DEHACKED_SOURCE_FILES) diff --git a/src/heretic/deh_ammo.c b/src/heretic/deh_ammo.c new file mode 100644 index 00000000..fe86c757 --- /dev/null +++ b/src/heretic/deh_ammo.c @@ -0,0 +1,122 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2005 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +//----------------------------------------------------------------------------- +// +// Parses "Ammo" sections in dehacked files +// +//----------------------------------------------------------------------------- + +#include +#include +#include + +#include "doomdef.h" +#include "doomtype.h" +#include "deh_defs.h" +#include "deh_io.h" +#include "deh_main.h" +#include "p_local.h" + +static void *DEH_AmmoStart(deh_context_t *context, char *line) +{ + int ammo_number = 0; + + if (sscanf(line, "Ammo %i", &ammo_number) != 1) + { + DEH_Warning(context, "Parse error on section start"); + return NULL; + } + + if (ammo_number < 0 || ammo_number >= NUMAMMO) + { + DEH_Warning(context, "Invalid ammo number: %i", ammo_number); + return NULL; + } + + return &maxammo[ammo_number]; +} + +static void DEH_AmmoParseLine(deh_context_t *context, char *line, void *tag) +{ + char *variable_name, *value; + int ivalue; + int ammo_number; + + if (tag == NULL) + return; + + ammo_number = ((int *) tag) - maxammo; + + // Parse the assignment + + if (!DEH_ParseAssignment(line, &variable_name, &value)) + { + // Failed to parse + + DEH_Warning(context, "Failed to parse assignment"); + return; + } + + ivalue = atoi(value); + + if (!strcasecmp(variable_name, "Per ammo")) + { + // Heretic doesn't have a "per clip" ammo array, instead + // it is per weapon. However, the weapon number lines + // up with the ammo number if we add one. + + GetWeaponAmmo[ammo_number + 1] = ivalue; + } + else if (!strcasecmp(variable_name, "Max ammo")) + { + maxammo[ammo_number] = ivalue; + } + else + { + DEH_Warning(context, "Field named '%s' not found", variable_name); + } +} + +static void DEH_AmmoMD5Hash(md5_context_t *context) +{ + int i; + + for (i=0; i +#include + +#include "doomtype.h" +#include "info.h" + +#include "deh_defs.h" +#include "deh_io.h" +#include "deh_main.h" +#include "deh_mapping.h" +#include "deh_htic.h" + +DEH_BEGIN_MAPPING(state_mapping, state_t) + DEH_MAPPING("Sprite number", sprite) + DEH_MAPPING("Sprite subnumber", frame) + DEH_MAPPING("Duration", tics) + DEH_MAPPING("Next frame", nextstate) + DEH_MAPPING("Unknown 1", misc1) + DEH_MAPPING("Unknown 2", misc2) + DEH_UNSUPPORTED_MAPPING("Action pointer") +DEH_END_MAPPING + +static void *DEH_FrameStart(deh_context_t *context, char *line) +{ + int frame_number = 0; + int mapped_frame_number; + state_t *state; + + if (sscanf(line, "Frame %i", &frame_number) != 1) + { + DEH_Warning(context, "Parse error on section start"); + return NULL; + } + + // Map the HHE frame number (which assumes a Heretic 1.0 state table) + // to the internal frame number (which is is the Heretic 1.3 state table): + + mapped_frame_number = DEH_MapHereticFrameNumber(frame_number); + + if (mapped_frame_number < 0 || mapped_frame_number >= DEH_HERETIC_NUMSTATES) + { + DEH_Warning(context, "Invalid frame number: %i", frame_number); + return NULL; + } + + state = &states[mapped_frame_number]; + + return state; +} + +static void DEH_FrameParseLine(deh_context_t *context, char *line, void *tag) +{ + state_t *state; + char *variable_name, *value; + int ivalue; + + if (tag == NULL) + return; + + state = (state_t *) tag; + + // Parse the assignment + + if (!DEH_ParseAssignment(line, &variable_name, &value)) + { + // Failed to parse + + DEH_Warning(context, "Failed to parse assignment"); + return; + } + + // all values are integers + + ivalue = atoi(value); + + // "Next frame" numbers need to undergo mapping. + + if (!strcasecmp(variable_name, "Next frame")) + { + ivalue = DEH_MapHereticFrameNumber(ivalue); + } + + DEH_SetMapping(context, &state_mapping, state, variable_name, ivalue); +} + +static void DEH_FrameMD5Sum(md5_context_t *context) +{ + int i; + + for (i=0; i +#include "deh_defs.h" +#include "deh_main.h" +#include "info.h" + +char *deh_signatures[] = +{ + "Patch File for HHE v1.1", + NULL +}; + +// deh_ammo.c: +extern deh_section_t deh_section_ammo; +// deh_frame.c: +extern deh_section_t deh_section_frame; +// deh_ptr.c: +extern deh_section_t deh_section_pointer; +// deh_sound.c +extern deh_section_t deh_section_sound; +// deh_text.c: +extern deh_section_t deh_section_text; +// deh_thing.c: +extern deh_section_t deh_section_thing; +// deh_weapon.c: +extern deh_section_t deh_section_weapon; + +// +// List of section types: +// + +deh_section_t *deh_section_types[] = +{ + &deh_section_ammo, + &deh_section_frame, +// &deh_section_pointer, TODO + &deh_section_sound, +// &deh_section_text, TODO + &deh_section_thing, + &deh_section_weapon, + NULL +}; + +// HHE only worked with Heretic 1.0 and unfortunately was never updated +// to support Heretic 1.3. Between Heretic 1.0 and 1.3, two new frames +// were added to the "states" table, to extend the "flame death" +// animation displayed when the player is killed by fire. Therefore, +// we must map the HHE frame numbers (which assume a Heretic 1.0 frame +// table) to corresponding indexes for the Heretic 1.3 frame table. + +int DEH_MapHereticFrameNumber(int frame) +{ + if (frame >= S_PLAY_FDTH19) + { + frame = (frame - S_PLAY_FDTH19) + S_BLOODYSKULL1; + } + + return frame; +} + diff --git a/src/heretic/deh_htic.h b/src/heretic/deh_htic.h new file mode 100644 index 00000000..fefcf818 --- /dev/null +++ b/src/heretic/deh_htic.h @@ -0,0 +1,45 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2010 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +//----------------------------------------------------------------------------- +// +// Common header for Heretic dehacked (HHE) support. +// +//----------------------------------------------------------------------------- + +#ifndef DEH_HTIC_H +#define DEH_HTIC_H + +#include "info.h" + +// HHE doesn't know about the last two states in the state table, so +// these are considered invalid. + +#define DEH_HERETIC_NUMSTATES (NUMSTATES - 2) + +// It also doesn't know about the last two things in the mobjinfo table +// (which correspond to the states above) + +#define DEH_HERETIC_NUMMOBJTYPES (NUMMOBJTYPES - 2) + +int DEH_MapHereticFrameNumber(int frame); + +#endif /* #ifndef DEH_HTIC_H */ + diff --git a/src/heretic/deh_sound.c b/src/heretic/deh_sound.c new file mode 100644 index 00000000..d1f266dd --- /dev/null +++ b/src/heretic/deh_sound.c @@ -0,0 +1,118 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2005 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +//----------------------------------------------------------------------------- +// +// Parses "Sound" sections in dehacked files +// +//----------------------------------------------------------------------------- + +#include +#include + +#include "doomfeatures.h" +#include "doomtype.h" +#include "deh_defs.h" +#include "deh_main.h" +#include "deh_mapping.h" + +#include "doomdef.h" +#include "i_sound.h" + +#include "sounds.h" + +DEH_BEGIN_MAPPING(sound_mapping, sfxinfo_t) + DEH_MAPPING_STRING("Name", name) + DEH_UNSUPPORTED_MAPPING("Special") + DEH_MAPPING("Value", priority) + DEH_MAPPING("Unknown 1", usefulness) + DEH_UNSUPPORTED_MAPPING("Unknown 2") + DEH_UNSUPPORTED_MAPPING("Unknown 3") + DEH_MAPPING("One/Two", numchannels) +DEH_END_MAPPING + +static void *DEH_SoundStart(deh_context_t *context, char *line) +{ + int sound_number = 0; + + if (sscanf(line, "Sound %i", &sound_number) != 1) + { + DEH_Warning(context, "Parse error on section start"); + return NULL; + } + + if (sound_number < 0 || sound_number >= NUMSFX) + { + DEH_Warning(context, "Invalid sound number: %i", sound_number); + return NULL; + } + + if (sound_number >= DEH_VANILLA_NUMSFX) + { + DEH_Warning(context, "Attempt to modify SFX %i. This will cause " + "problems in Vanilla dehacked.", sound_number); + } + + return &S_sfx[sound_number]; +} + +static void DEH_SoundParseLine(deh_context_t *context, char *line, void *tag) +{ + sfxinfo_t *sfx; + char *variable_name, *value; + + if (tag == NULL) + return; + + sfx = (sfxinfo_t *) tag; + + // Parse the assignment + + if (!DEH_ParseAssignment(line, &variable_name, &value)) + { + // Failed to parse + DEH_Warning(context, "Failed to parse assignment"); + return; + } + + // Set the field value: + + if (!strcasecmp(variable_name, "Name")) + { + DEH_SetStringMapping(context, &sound_mapping, sfx, + variable_name, value); + } + else + { + DEH_SetMapping(context, &sound_mapping, sfx, + variable_name, atoi(value)); + } +} + +deh_section_t deh_section_sound = +{ + "Sound", + NULL, + DEH_SoundStart, + DEH_SoundParseLine, + NULL, + NULL, +}; + diff --git a/src/heretic/deh_thing.c b/src/heretic/deh_thing.c new file mode 100644 index 00000000..fe94f3b8 --- /dev/null +++ b/src/heretic/deh_thing.c @@ -0,0 +1,149 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2005 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +//----------------------------------------------------------------------------- +// +// Parses "Thing" sections in dehacked files +// +//----------------------------------------------------------------------------- + +#include +#include + +#include "doomtype.h" + +#include "deh_defs.h" +#include "deh_main.h" +#include "deh_mapping.h" +#include "deh_htic.h" + +#include "info.h" + +DEH_BEGIN_MAPPING(thing_mapping, mobjinfo_t) + DEH_MAPPING("ID #", doomednum) + DEH_MAPPING("Initial frame", spawnstate) + DEH_MAPPING("Hit points", spawnhealth) + DEH_MAPPING("First moving frame", seestate) + DEH_MAPPING("Alert sound", seesound) + DEH_MAPPING("Reaction time", reactiontime) + DEH_MAPPING("Attack sound", attacksound) + DEH_MAPPING("Injury frame", painstate) + DEH_MAPPING("Pain chance", painchance) + DEH_MAPPING("Pain sound", painsound) + DEH_MAPPING("Close attack frame", meleestate) + DEH_MAPPING("Far attack frame", missilestate) + DEH_MAPPING("Burning frame", crashstate) + DEH_MAPPING("Death frame", deathstate) + DEH_MAPPING("Exploding frame", xdeathstate) + DEH_MAPPING("Death sound", deathsound) + DEH_MAPPING("Speed", speed) + DEH_MAPPING("Width", radius) + DEH_MAPPING("Height", height) + DEH_MAPPING("Mass", mass) + DEH_MAPPING("Missile damage", damage) + DEH_MAPPING("Action sound", activesound) + DEH_MAPPING("Bits 1", flags) + DEH_MAPPING("Bits 2", flags2) +DEH_END_MAPPING + +static void *DEH_ThingStart(deh_context_t *context, char *line) +{ + int thing_number = 0; + mobjinfo_t *mobj; + + if (sscanf(line, "Thing %i", &thing_number) != 1) + { + DEH_Warning(context, "Parse error on section start"); + return NULL; + } + + // HHE thing numbers are indexed from 1 + --thing_number; + + if (thing_number < 0 || thing_number >= DEH_HERETIC_NUMMOBJTYPES) + { + DEH_Warning(context, "Invalid thing number: %i", thing_number); + return NULL; + } + + mobj = &mobjinfo[thing_number]; + + return mobj; +} + +static void DEH_ThingParseLine(deh_context_t *context, char *line, void *tag) +{ + mobjinfo_t *mobj; + char *variable_name, *value; + int ivalue; + + if (tag == NULL) + return; + + mobj = (mobjinfo_t *) tag; + + // Parse the assignment + + if (!DEH_ParseAssignment(line, &variable_name, &value)) + { + // Failed to parse + + DEH_Warning(context, "Failed to parse assignment"); + return; + } + + // all values are integers + + ivalue = atoi(value); + + // If the value to be set is a frame, the frame number must + // undergo transformation from a Heretic 1.0 index to a + // Heretic 1.3 index. + + if (strstr(variable_name, "frame") != NULL) + { + ivalue = DEH_MapHereticFrameNumber(ivalue); + } + + // Set the field value + + DEH_SetMapping(context, &thing_mapping, mobj, variable_name, ivalue); +} + +static void DEH_ThingMD5Sum(md5_context_t *context) +{ + int i; + + for (i=0; i +#include +#include + +#include "doomtype.h" + +#include "doomdef.h" + +#include "deh_defs.h" +#include "deh_main.h" +#include "deh_mapping.h" +#include "deh_htic.h" + +DEH_BEGIN_MAPPING(weapon_mapping, weaponinfo_t) + DEH_MAPPING("Ammo type", ammo) + DEH_MAPPING("Deselect frame", upstate) + DEH_MAPPING("Select frame", downstate) + DEH_MAPPING("Bobbing frame", readystate) + DEH_MAPPING("Shooting frame", atkstate) + DEH_MAPPING("Firing frame", holdatkstate) + DEH_MAPPING("Unknown frame", flashstate) +DEH_END_MAPPING + +static void *DEH_WeaponStart(deh_context_t *context, char *line) +{ + int weapon_number = 0; + + if (sscanf(line, "Weapon %i", &weapon_number) != 1) + { + DEH_Warning(context, "Parse error on section start"); + return NULL; + } + + if (weapon_number < 0 || weapon_number >= NUMWEAPONS * 2) + { + DEH_Warning(context, "Invalid weapon number: %i", weapon_number); + return NULL; + } + + // Because of the tome of power, we have two levels of weapons: + + if (weapon_number < NUMWEAPONS) + { + return &wpnlev1info[weapon_number]; + } + else + { + return &wpnlev2info[weapon_number - NUMWEAPONS]; + } +} + +static void DEH_WeaponParseLine(deh_context_t *context, char *line, void *tag) +{ + char *variable_name, *value; + weaponinfo_t *weapon; + int ivalue; + + if (tag == NULL) + return; + + weapon = (weaponinfo_t *) tag; + + if (!DEH_ParseAssignment(line, &variable_name, &value)) + { + // Failed to parse + + DEH_Warning(context, "Failed to parse assignment"); + return; + } + + ivalue = atoi(value); + + // If this is a frame field, we need to map from Heretic 1.0 frame + // numbers to Heretic 1.3 frame numbers. + + if (strstr(variable_name, "frame") != NULL) + { + ivalue = DEH_MapHereticFrameNumber(ivalue); + } + + DEH_SetMapping(context, &weapon_mapping, weapon, variable_name, ivalue); +} + +static void DEH_WeaponMD5Sum(md5_context_t *context) +{ + int i; + + for (i=0; i #include "doomtype.h" +#include "m_misc.h" #include "deh_defs.h" #include "deh_main.h" @@ -117,7 +118,7 @@ static void DEH_ThingParseLine(deh_context_t *context, char *line, void *tag) // undergo transformation from a Heretic 1.0 index to a // Heretic 1.3 index. - if (strstr(variable_name, "frame") != NULL) + if (M_StrCaseStr(variable_name, "frame") != NULL) { ivalue = DEH_MapHereticFrameNumber(ivalue); } diff --git a/src/heretic/deh_weapon.c b/src/heretic/deh_weapon.c index 1daae766..28a90c68 100644 --- a/src/heretic/deh_weapon.c +++ b/src/heretic/deh_weapon.c @@ -29,6 +29,7 @@ #include #include "doomtype.h" +#include "m_misc.h" #include "doomdef.h" @@ -99,7 +100,7 @@ static void DEH_WeaponParseLine(deh_context_t *context, char *line, void *tag) // If this is a frame field, we need to map from Heretic 1.0 frame // numbers to Heretic 1.3 frame numbers. - if (strstr(variable_name, "frame") != NULL) + if (M_StrCaseStr(variable_name, "frame") != NULL) { ivalue = DEH_MapHereticFrameNumber(ivalue); } -- cgit v1.2.3 From b83a1ed02c6f22ebbced208b02bb59ff94bed941 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 8 Feb 2010 19:13:34 +0000 Subject: Add HHE 1.0 header signature to list of accepted signatures. Subversion-branch: /branches/raven-branch Subversion-revision: 1862 --- src/heretic/deh_htic.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/heretic') diff --git a/src/heretic/deh_htic.c b/src/heretic/deh_htic.c index 11e73075..ca1c6d5c 100644 --- a/src/heretic/deh_htic.c +++ b/src/heretic/deh_htic.c @@ -31,6 +31,7 @@ char *deh_signatures[] = { + "Patch File for HHE v1.0", "Patch File for HHE v1.1", NULL }; -- cgit v1.2.3 From 9769464ecf7ae3c92c628deed8164b61f567923a Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 8 Feb 2010 19:16:27 +0000 Subject: Call DEH_Init on Heretic startup so that patches will be loaded. Subversion-branch: /branches/raven-branch Subversion-revision: 1864 --- src/heretic/d_main.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/heretic') diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c index 10f5fd3e..ddcbca20 100644 --- a/src/heretic/d_main.c +++ b/src/heretic/d_main.c @@ -33,6 +33,7 @@ #include "config.h" #include "ct_chat.h" #include "doomdef.h" +#include "deh_main.h" #include "d_iwad.h" #include "i_endoom.h" #include "i_joystick.h" @@ -890,6 +891,11 @@ void D_DoomMain(void) printf("Z_Init: Init zone memory allocation daemon.\n"); Z_Init(); +#ifdef FEATURE_DEHACKED + printf("DEH_Init: Init Dehacked support.\n"); + DEH_Init(); +#endif + printf("W_Init: Init WADfiles.\n"); iwadfile = D_FindIWAD(IWAD_MASK_HERETIC, &gamemission); -- cgit v1.2.3 From 08e0b1471b357ae22a632d1752919d973db8983e Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 8 Feb 2010 19:18:48 +0000 Subject: Move action function prototypes in info.c into separate p_action.h header. Add table of action functions along with their location in the Heretic 1.0 executable, so that the "Action pointer" frame property can be set. Subversion-branch: /branches/raven-branch Subversion-revision: 1865 --- src/heretic/Makefile.am | 1 + src/heretic/deh_frame.c | 181 ++++++++++++++++++++++++++++++++++++++++++++++-- src/heretic/info.c | 129 +--------------------------------- src/heretic/p_action.h | 160 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 338 insertions(+), 133 deletions(-) create mode 100644 src/heretic/p_action.h (limited to 'src/heretic') diff --git a/src/heretic/Makefile.am b/src/heretic/Makefile.am index 3fdd3ff7..081ca989 100644 --- a/src/heretic/Makefile.am +++ b/src/heretic/Makefile.am @@ -20,6 +20,7 @@ info.c info.h \ in_lude.c \ m_random.c m_random.h \ mn_menu.c \ + p_action.h \ p_ceilng.c \ p_doors.c \ p_enemy.c \ diff --git a/src/heretic/deh_frame.c b/src/heretic/deh_frame.c index 7dfb5aab..6ec62ae7 100644 --- a/src/heretic/deh_frame.c +++ b/src/heretic/deh_frame.c @@ -36,6 +36,145 @@ #include "deh_mapping.h" #include "deh_htic.h" +#include "p_action.h" + +// Offsets of action pointers within the Heretic 1.0 executable. +// (Seriously Greg, was this really necessary? What was wrong with the +// "copying action pointer from another frame" technique used in dehacked?) + +static const struct +{ + int offset; + void (*func)(); +} action_ptrs[] = { + { 0, NULL }, + { 69200, A_Look }, + { 69328, A_Chase }, + { 69872, A_FaceTarget }, + { 69984, A_Pain }, + { 70016, A_DripBlood }, + { 70160, A_KnightAttack }, + { 70304, A_ImpExplode }, + { 70480, A_BeastPuff }, + { 70592, A_ImpMeAttack }, + { 70672, A_ImpMsAttack }, + { 70880, A_ImpMsAttack2 }, + { 70976, A_ImpDeath }, + { 71024, A_ImpXDeath1 }, + { 71072, A_ImpXDeath2 }, + { 71376, A_ChicAttack }, + { 71456, A_ChicLook }, + { 71488, A_ChicChase }, + { 71520, A_ChicPain }, + { 71568, A_Feathers }, + { 71808, A_MummyAttack }, + { 71920, A_MummyAttack2 }, + { 72016, A_MummyFX1Seek }, + { 72048, A_MummySoul }, + { 72096, A_Sor1Pain }, + { 72144, A_Sor1Chase }, + { 72192, A_Srcr1Attack }, + { 72480, A_SorcererRise }, + { 72816, A_Srcr2Decide }, + { 72896, A_Srcr2Attack }, + { 73120, A_BlueSpark }, + { 73232, A_GenWizard }, + { 73392, A_Sor2DthInit }, + { 73424, A_Sor2DthLoop }, + { 73456, A_SorZap }, + { 73488, A_SorRise }, + { 73520, A_SorDSph }, + { 73552, A_SorDExp }, + { 73584, A_SorDBon }, + { 73616, A_SorSightSnd }, + { 73648, A_MinotaurAtk1 }, + { 73760, A_MinotaurDecide }, + { 74032, A_MinotaurCharge }, + { 74112, A_MinotaurAtk2 }, + { 74352, A_MinotaurAtk3 }, + { 74528, A_MntrFloorFire }, + { 74640, A_BeastAttack }, + { 74752, A_HeadAttack }, + { 75168, A_WhirlwindSeek }, + { 75328, A_HeadIceImpact }, + { 75488, A_HeadFireGrow }, + { 75632, A_SnakeAttack }, + { 75712, A_SnakeAttack2 }, + { 75792, A_ClinkAttack }, + { 75872, A_GhostOff }, + { 75888, A_WizAtk1 }, + { 75920, A_WizAtk2 }, + { 75952, A_WizAtk3 }, + { 76144, A_Scream }, + { 76400, A_NoBlocking }, + { 76784, A_Explode }, + { 76896, A_PodPain }, + { 77056, A_RemovePod }, + { 77104, A_MakePod }, + { 77344, A_BossDeath }, + { 77472, A_ESound }, + { 77520, A_SpawnTeleGlitter }, + { 77600, A_SpawnTeleGlitter2 }, + { 77680, A_AccTeleGlitter }, + { 77728, A_InitKeyGizmo }, + { 77824, A_VolcanoSet }, + { 77856, A_VolcanoBlast }, + { 78080, A_VolcBallImpact }, + { 78288, A_SkullPop }, + { 78448, A_CheckSkullFloor }, + { 78480, A_CheckSkullDone }, + { 78512, A_FreeTargMobj }, + { 78608, A_AddPlayerCorpse }, + { 78704, A_FlameSnd }, + { 78736, A_HideThing }, + { 78752, A_UnHideThing }, + { 81952, A_RestoreArtifact }, + { 82048, A_RestoreSpecialThing1 }, + { 82128, A_RestoreSpecialThing2 }, + { 108432, A_ContMobjSound }, + { 111168, A_WeaponReady }, + { 111568, A_BeakReady }, + { 111696, A_ReFire }, + { 111760, A_Lower }, + { 111856, A_BeakRaise }, + { 111920, A_Raise }, + { 112272, A_BeakAttackPL1 }, + { 112448, A_BeakAttackPL2 }, + { 112640, A_StaffAttackPL1 }, + { 112784, A_StaffAttackPL2 }, + { 112928, A_FireBlasterPL1 }, + { 113072, A_FireBlasterPL2 }, + { 113152, A_FireGoldWandPL1 }, + { 113296, A_FireGoldWandPL2 }, + { 113760, A_FireMacePL1 }, + { 113904, A_MacePL1Check }, + { 114032, A_MaceBallImpact }, + { 114192, A_MaceBallImpact2 }, + { 114624, A_FireMacePL2 }, + { 114752, A_DeathBallImpact }, + { 115088, A_SpawnRippers }, + { 115232, A_FireCrossbowPL1 }, + { 115312, A_FireCrossbowPL2 }, + { 115456, A_BoltSpark }, + { 115568, A_FireSkullRodPL1 }, + { 115648, A_FireSkullRodPL2 }, + { 115776, A_SkullRodPL2Seek }, + { 115808, A_AddPlayerRain }, + { 115984, A_SkullRodStorm }, + { 116272, A_RainImpact }, + { 116336, A_HideInCeiling }, + { 116368, A_FirePhoenixPL1 }, + { 116480, A_RemovedPhoenixFunc }, + { 116496, A_PhoenixPuff }, + { 116720, A_InitPhoenixPL2 }, + { 116736, A_FirePhoenixPL2 }, + { 117104, A_ShutdownPhoenixPL2 }, + { 117120, A_FlameEnd }, + { 117152, A_FloatPuff }, + { 117184, A_GauntletAttack }, + { 117648, A_Light0 } +}; + DEH_BEGIN_MAPPING(state_mapping, state_t) DEH_MAPPING("Sprite number", sprite) DEH_MAPPING("Sprite subnumber", frame) @@ -43,7 +182,6 @@ DEH_BEGIN_MAPPING(state_mapping, state_t) DEH_MAPPING("Next frame", nextstate) DEH_MAPPING("Unknown 1", misc1) DEH_MAPPING("Unknown 2", misc2) - DEH_UNSUPPORTED_MAPPING("Action pointer") DEH_END_MAPPING // When a HHE patch is first loaded, we must apply a small change @@ -87,6 +225,22 @@ static void *DEH_FrameStart(deh_context_t *context, char *line) return state; } +static boolean GetActionPointerForOffset(int offset, void **result) +{ + int i; + + for (i=0; iaction = func; } + else + { + // "Next frame" numbers need to undergo mapping. - DEH_SetMapping(context, &state_mapping, state, variable_name, ivalue); + if (!strcasecmp(variable_name, "Next frame")) + { + ivalue = DEH_MapHereticFrameNumber(ivalue); + } + + DEH_SetMapping(context, &state_mapping, state, variable_name, ivalue); + } } static void DEH_FrameMD5Sum(md5_context_t *context) diff --git a/src/heretic/info.c b/src/heretic/info.c index 7149220e..b6dd921f 100644 --- a/src/heretic/info.c +++ b/src/heretic/info.c @@ -22,7 +22,7 @@ // //----------------------------------------------------------------------------- #include "doomdef.h" -// generated by multigen +#include "p_action.h" char *sprnames[] = { "IMPX","ACLO","PTN1","SHLD","SHD2","BAGH","SPMP","INVS","PTN2","SOAR", @@ -41,133 +41,6 @@ char *sprnames[] = { NULL }; -void A_FreeTargMobj(); -void A_RestoreSpecialThing1(); -void A_RestoreSpecialThing2(); -void A_HideThing(); -void A_UnHideThing(); -void A_RestoreArtifact(); -void A_Scream(); -void A_Explode(); -void A_PodPain(); -void A_RemovePod(); -void A_MakePod(); -void A_InitKeyGizmo(); -void A_VolcanoSet(); -void A_VolcanoBlast(); -void A_BeastPuff(); -void A_VolcBallImpact(); -void A_SpawnTeleGlitter(); -void A_SpawnTeleGlitter2(); -void A_AccTeleGlitter(); -void A_Light0(); -void A_WeaponReady(); -void A_Lower(); -void A_Raise(); -void A_StaffAttackPL1(); -void A_ReFire(); -void A_StaffAttackPL2(); -void A_BeakReady(); -void A_BeakRaise(); -void A_BeakAttackPL1(); -void A_BeakAttackPL2(); -void A_GauntletAttack(); -void A_FireBlasterPL1(); -void A_FireBlasterPL2(); -void A_SpawnRippers(); -void A_FireMacePL1(); -void A_FireMacePL2(); -void A_MacePL1Check(); -void A_MaceBallImpact(); -void A_MaceBallImpact2(); -void A_DeathBallImpact(); -void A_FireSkullRodPL1(); -void A_FireSkullRodPL2(); -void A_SkullRodPL2Seek(); -void A_AddPlayerRain(); -void A_HideInCeiling(); -void A_SkullRodStorm(); -void A_RainImpact(); -void A_FireGoldWandPL1(); -void A_FireGoldWandPL2(); -void A_FirePhoenixPL1(); -void A_InitPhoenixPL2(); -void A_FirePhoenixPL2(); -void A_ShutdownPhoenixPL2(); -void A_PhoenixPuff(); -void A_RemovedPhoenixFunc(); -void A_FlameEnd(); -void A_FloatPuff(); -void A_FireCrossbowPL1(); -void A_FireCrossbowPL2(); -void A_BoltSpark(); -void A_Pain(); -void A_NoBlocking(); -void A_AddPlayerCorpse(); -void A_SkullPop(); -void A_FlameSnd(); -void A_CheckBurnGone(); -void A_CheckSkullFloor(); -void A_CheckSkullDone(); -void A_Feathers(); -void A_ChicLook(); -void A_ChicChase(); -void A_ChicPain(); -void A_FaceTarget(); -void A_ChicAttack(); -void A_Look(); -void A_Chase(); -void A_MummyAttack(); -void A_MummyAttack2(); -void A_MummySoul(); -void A_ContMobjSound(); -void A_MummyFX1Seek(); -void A_BeastAttack(); -void A_SnakeAttack(); -void A_SnakeAttack2(); -void A_HeadAttack(); -void A_BossDeath(); -void A_HeadIceImpact(); -void A_HeadFireGrow(); -void A_WhirlwindSeek(); -void A_ClinkAttack(); -void A_WizAtk1(); -void A_WizAtk2(); -void A_WizAtk3(); -void A_GhostOff(); -void A_ImpMeAttack(); -void A_ImpMsAttack(); -void A_ImpMsAttack2(); -void A_ImpDeath(); -void A_ImpXDeath1(); -void A_ImpXDeath2(); -void A_ImpExplode(); -void A_KnightAttack(); -void A_DripBlood(); -void A_Sor1Chase(); -void A_Sor1Pain(); -void A_Srcr1Attack(); -void A_SorZap(); -void A_SorcererRise(); -void A_SorRise(); -void A_SorSightSnd(); -void A_Srcr2Decide(); -void A_Srcr2Attack(); -void A_Sor2DthInit(); -void A_SorDSph(); -void A_Sor2DthLoop(); -void A_SorDExp(); -void A_SorDBon(); -void A_BlueSpark(); -void A_GenWizard(); -void A_MinotaurAtk1(); -void A_MinotaurDecide(); -void A_MinotaurAtk2(); -void A_MinotaurAtk3(); -void A_MinotaurCharge(); -void A_MntrFloorFire(); -void A_ESound(); - state_t states[NUMSTATES] = { {SPR_IMPX, 0, -1, NULL, S_NULL, 0, 0}, // S_NULL {SPR_ACLO, 4, 1050, A_FreeTargMobj, S_NULL, 0, 0}, // S_FREETARGMOBJ diff --git a/src/heretic/p_action.h b/src/heretic/p_action.h new file mode 100644 index 00000000..8d8e383c --- /dev/null +++ b/src/heretic/p_action.h @@ -0,0 +1,160 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 1993-1996 Id Software, Inc. +// Copyright(C) 1993-2008 Raven Software +// Copyright(C) 2008 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +//----------------------------------------------------------------------------- +// +// External definitions for action pointer functions. +// +//----------------------------------------------------------------------------- + +#ifndef HERETIC_P_ACTION_H +#define HERETIC_P_ACTION_H + +void A_FreeTargMobj(); +void A_RestoreSpecialThing1(); +void A_RestoreSpecialThing2(); +void A_HideThing(); +void A_UnHideThing(); +void A_RestoreArtifact(); +void A_Scream(); +void A_Explode(); +void A_PodPain(); +void A_RemovePod(); +void A_MakePod(); +void A_InitKeyGizmo(); +void A_VolcanoSet(); +void A_VolcanoBlast(); +void A_BeastPuff(); +void A_VolcBallImpact(); +void A_SpawnTeleGlitter(); +void A_SpawnTeleGlitter2(); +void A_AccTeleGlitter(); +void A_Light0(); +void A_WeaponReady(); +void A_Lower(); +void A_Raise(); +void A_StaffAttackPL1(); +void A_ReFire(); +void A_StaffAttackPL2(); +void A_BeakReady(); +void A_BeakRaise(); +void A_BeakAttackPL1(); +void A_BeakAttackPL2(); +void A_GauntletAttack(); +void A_FireBlasterPL1(); +void A_FireBlasterPL2(); +void A_SpawnRippers(); +void A_FireMacePL1(); +void A_FireMacePL2(); +void A_MacePL1Check(); +void A_MaceBallImpact(); +void A_MaceBallImpact2(); +void A_DeathBallImpact(); +void A_FireSkullRodPL1(); +void A_FireSkullRodPL2(); +void A_SkullRodPL2Seek(); +void A_AddPlayerRain(); +void A_HideInCeiling(); +void A_SkullRodStorm(); +void A_RainImpact(); +void A_FireGoldWandPL1(); +void A_FireGoldWandPL2(); +void A_FirePhoenixPL1(); +void A_InitPhoenixPL2(); +void A_FirePhoenixPL2(); +void A_ShutdownPhoenixPL2(); +void A_PhoenixPuff(); +void A_RemovedPhoenixFunc(); +void A_FlameEnd(); +void A_FloatPuff(); +void A_FireCrossbowPL1(); +void A_FireCrossbowPL2(); +void A_BoltSpark(); +void A_Pain(); +void A_NoBlocking(); +void A_AddPlayerCorpse(); +void A_SkullPop(); +void A_FlameSnd(); +void A_CheckBurnGone(); +void A_CheckSkullFloor(); +void A_CheckSkullDone(); +void A_Feathers(); +void A_ChicLook(); +void A_ChicChase(); +void A_ChicPain(); +void A_FaceTarget(); +void A_ChicAttack(); +void A_Look(); +void A_Chase(); +void A_MummyAttack(); +void A_MummyAttack2(); +void A_MummySoul(); +void A_ContMobjSound(); +void A_MummyFX1Seek(); +void A_BeastAttack(); +void A_SnakeAttack(); +void A_SnakeAttack2(); +void A_HeadAttack(); +void A_BossDeath(); +void A_HeadIceImpact(); +void A_HeadFireGrow(); +void A_WhirlwindSeek(); +void A_ClinkAttack(); +void A_WizAtk1(); +void A_WizAtk2(); +void A_WizAtk3(); +void A_GhostOff(); +void A_ImpMeAttack(); +void A_ImpMsAttack(); +void A_ImpMsAttack2(); +void A_ImpDeath(); +void A_ImpXDeath1(); +void A_ImpXDeath2(); +void A_ImpExplode(); +void A_KnightAttack(); +void A_DripBlood(); +void A_Sor1Chase(); +void A_Sor1Pain(); +void A_Srcr1Attack(); +void A_SorZap(); +void A_SorcererRise(); +void A_SorRise(); +void A_SorSightSnd(); +void A_Srcr2Decide(); +void A_Srcr2Attack(); +void A_Sor2DthInit(); +void A_SorDSph(); +void A_Sor2DthLoop(); +void A_SorDExp(); +void A_SorDBon(); +void A_BlueSpark(); +void A_GenWizard(); +void A_MinotaurAtk1(); +void A_MinotaurDecide(); +void A_MinotaurAtk2(); +void A_MinotaurAtk3(); +void A_MinotaurCharge(); +void A_MntrFloorFire(); +void A_ESound(); + +#endif /* #ifndef HERETIC_P_ACTION_H */ + -- cgit v1.2.3 From 56412813c70ba44a6f6a74cee5bf460ca6a31402 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 8 Feb 2010 21:14:30 +0000 Subject: Add Heretic implementation of HHE "Text" section, add DEH_String() around appropriate strings to allow string replacements. Subversion-branch: /branches/raven-branch Subversion-revision: 1867 --- src/heretic/Makefile.am | 1 + src/heretic/am_map.c | 7 +- src/heretic/ct_chat.c | 11 +- src/heretic/d_main.c | 72 ++-- src/heretic/deh_htext.c | 903 ++++++++++++++++++++++++++++++++++++++++++++++++ src/heretic/deh_htic.c | 6 +- src/heretic/f_finale.c | 23 +- src/heretic/g_game.c | 13 +- src/heretic/in_lude.c | 67 ++-- src/heretic/mn_menu.c | 52 +-- src/heretic/p_spec.c | 40 +-- src/heretic/p_switch.c | 5 +- src/heretic/p_user.c | 3 +- src/heretic/r_data.c | 38 +- src/heretic/r_draw.c | 49 +-- src/heretic/r_plane.c | 3 +- src/heretic/r_things.c | 14 +- src/heretic/sb_bar.c | 120 +++---- 18 files changed, 1184 insertions(+), 243 deletions(-) create mode 100644 src/heretic/deh_htext.c (limited to 'src/heretic') diff --git a/src/heretic/Makefile.am b/src/heretic/Makefile.am index 081ca989..e56ee806 100644 --- a/src/heretic/Makefile.am +++ b/src/heretic/Makefile.am @@ -59,6 +59,7 @@ i_ibm.c FEATURE_DEHACKED_SOURCE_FILES = \ deh_ammo.c \ deh_frame.c \ +deh_htext.c \ deh_htic.c \ deh_sound.c \ deh_thing.c \ diff --git a/src/heretic/am_map.c b/src/heretic/am_map.c index 99a8e206..aae30cc9 100644 --- a/src/heretic/am_map.c +++ b/src/heretic/am_map.c @@ -27,6 +27,7 @@ #include #include "doomdef.h" +#include "deh_str.h" #include "i_video.h" #include "m_controls.h" #include "p_local.h" @@ -408,7 +409,7 @@ void AM_loadPics(void) sprintf(namebuf, "AMMNUM%d", i); marknums[i] = W_CacheLumpName(namebuf, PU_STATIC); }*/ - maplump = W_CacheLumpName("AUTOPAGE", PU_STATIC); + maplump = W_CacheLumpName(DEH_String("AUTOPAGE"), PU_STATIC); } /*void AM_unloadPics(void) @@ -1473,6 +1474,7 @@ void AM_drawCrosshair(int color) void AM_Drawer(void) { + char *level_name; int numepisodes; if (!automapactive) @@ -1505,7 +1507,8 @@ void AM_Drawer(void) if (gameepisode <= numepisodes && gamemap < 10) { - MN_DrTextA(LevelNames[(gameepisode - 1) * 9 + gamemap - 1], 20, 145); + level_name = LevelNames[(gameepisode - 1) * 9 + gamemap - 1]; + MN_DrTextA(DEH_String(level_name), 20, 145); } // I_Update(); // V_MarkRect(f_x, f_y, f_w, f_h); diff --git a/src/heretic/ct_chat.c b/src/heretic/ct_chat.c index 75fa6035..958d1fff 100644 --- a/src/heretic/ct_chat.c +++ b/src/heretic/ct_chat.c @@ -29,6 +29,7 @@ #include #include "doomdef.h" #include "doomkeys.h" +#include "deh_str.h" #include "p_local.h" #include "s_sound.h" #include "v_video.h" @@ -115,7 +116,7 @@ void CT_Init(void) memset(plr_lastmsg[i], 0, MESSAGESIZE); memset(chat_msg[i], 0, MESSAGESIZE); } - FontABaseLump = W_GetNumForName("FONTA_S") + 1; + FontABaseLump = W_GetNumForName(DEH_String("FONTA_S")) + 1; return; } @@ -300,7 +301,7 @@ void CT_Ticker(void) CT_AddChar(i, 0); // set the end of message character if (numplayers > 2) { - strcpy(plr_lastmsg[i], CT_FromPlrText[i]); + strcpy(plr_lastmsg[i], DEH_String(CT_FromPlrText[i])); strcat(plr_lastmsg[i], chat_msg[i]); } else @@ -320,13 +321,13 @@ void CT_Ticker(void) if (numplayers > 1) { P_SetMessage(&players[consoleplayer], - "-MESSAGE SENT-", true); + DEH_String("-MESSAGE SENT-"), true); S_StartSound(NULL, sfx_chat); } else { P_SetMessage(&players[consoleplayer], - "THERE ARE NO OTHER PLAYERS IN THE GAME!", + DEH_String("THERE ARE NO OTHER PLAYERS IN THE GAME!"), true); S_StartSound(NULL, sfx_chat); } @@ -376,7 +377,7 @@ void CT_Drawer(void) x += patch->width; } } - V_DrawPatch(x, 10, W_CacheLumpName("FONTA59", PU_CACHE)); + V_DrawPatch(x, 10, W_CacheLumpName(DEH_String("FONTA59"), PU_CACHE)); BorderTopRefresh = true; UpdateState |= I_MESSAGES; } diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c index ddcbca20..52e4239f 100644 --- a/src/heretic/d_main.c +++ b/src/heretic/d_main.c @@ -185,12 +185,12 @@ void D_Display(void) { if (!netgame) { - V_DrawPatch(160, viewwindowy + 5, W_CacheLumpName("PAUSED", + V_DrawPatch(160, viewwindowy + 5, W_CacheLumpName(DEH_String("PAUSED"), PU_CACHE)); } else { - V_DrawPatch(160, 70, W_CacheLumpName("PAUSED", PU_CACHE)); + V_DrawPatch(160, 70, W_CacheLumpName(DEH_String("PAUSED"), PU_CACHE)); } } // Handle player messages @@ -316,7 +316,7 @@ void D_PageDrawer(void) V_DrawRawScreen(W_CacheLumpName(pagename, PU_CACHE)); if (demosequence == 1) { - V_DrawPatch(4, 160, W_CacheLumpName("ADVISOR", PU_CACHE)); + V_DrawPatch(4, 160, W_CacheLumpName(DEH_String("ADVISOR"), PU_CACHE)); } UpdateState |= I_FULLSCRN; } @@ -348,45 +348,45 @@ void D_DoAdvanceDemo(void) case 0: pagetic = 210; gamestate = GS_DEMOSCREEN; - pagename = "TITLE"; + pagename = DEH_String("TITLE"); S_StartSong(mus_titl, false); break; case 1: pagetic = 140; gamestate = GS_DEMOSCREEN; - pagename = "TITLE"; + pagename = DEH_String("TITLE"); break; case 2: BorderNeedRefresh = true; UpdateState |= I_FULLSCRN; - G_DeferedPlayDemo("demo1"); + G_DeferedPlayDemo(DEH_String("demo1")); break; case 3: pagetic = 200; gamestate = GS_DEMOSCREEN; - pagename = "CREDIT"; + pagename = DEH_String("CREDIT"); break; case 4: BorderNeedRefresh = true; UpdateState |= I_FULLSCRN; - G_DeferedPlayDemo("demo2"); + G_DeferedPlayDemo(DEH_String("demo2")); break; case 5: pagetic = 200; gamestate = GS_DEMOSCREEN; if (gamemode == shareware) { - pagename = "ORDER"; + pagename = DEH_String("ORDER"); } else { - pagename = "CREDIT"; + pagename = DEH_String("CREDIT"); } break; case 6: BorderNeedRefresh = true; UpdateState |= I_FULLSCRN; - G_DeferedPlayDemo("demo3"); + G_DeferedPlayDemo(DEH_String("demo3")); break; } } @@ -639,7 +639,7 @@ void initStartup(void) // Blit main screen textScreen = TXT_GetScreenData(); - loading = W_CacheLumpName("LOADING", PU_CACHE); + loading = W_CacheLumpName(DEH_String("LOADING"), PU_CACHE); memcpy(textScreen, loading, 4000); // Print version string @@ -699,7 +699,7 @@ void tprintf(char *msg, int initflag) // haleyjd: moved up, removed WATCOMC code void CleanExit(void) { - printf("Exited from HERETIC.\n"); + printf(DEH_String("Exited from HERETIC.\n")); exit(1); } @@ -783,7 +783,7 @@ static void D_Endoom(void) return; } - endoom_data = W_CacheLumpName("ENDTEXT", PU_STATIC); + endoom_data = W_CacheLumpName(DEH_String("ENDTEXT"), PU_STATIC); I_Endoom(endoom_data); } @@ -848,7 +848,7 @@ void D_DoomMain(void) // // init subsystems // - printf("V_Init: allocate screens.\n"); + printf(DEH_String("V_Init: allocate screens.\n")); V_Init(); // Check for -CDROM @@ -873,7 +873,7 @@ void D_DoomMain(void) if (cdrom) { - M_SetConfigDir("c:\\heretic.cd\\"); + M_SetConfigDir(DEH_String("c:\\heretic.cd")); } else { @@ -881,14 +881,14 @@ void D_DoomMain(void) } // Load defaults before initing other systems - printf("M_LoadDefaults: Load system defaults.\n"); + printf(DEH_String("M_LoadDefaults: Load system defaults.\n")); D_BindVariables(); M_SetConfigFilenames("heretic.cfg", PROGRAM_PREFIX "heretic.cfg"); M_LoadDefaults(); I_AtExit(M_SaveDefaults, false); - printf("Z_Init: Init zone memory allocation daemon.\n"); + printf(DEH_String("Z_Init: Init zone memory allocation daemon.\n")); Z_Init(); #ifdef FEATURE_DEHACKED @@ -896,7 +896,7 @@ void D_DoomMain(void) DEH_Init(); #endif - printf("W_Init: Init WADfiles.\n"); + printf(DEH_String("W_Init: Init WADfiles.\n")); iwadfile = D_FindIWAD(IWAD_MASK_HERETIC, &gamemission); @@ -933,12 +933,12 @@ void D_DoomMain(void) } if (p && p < myargc - 1) { - sprintf(file, "%s.lmp", myargv[p + 1]); + sprintf(file, DEH_String("%s.lmp"), myargv[p + 1]); D_AddFile(file); - printf("Playing demo %s.lmp.\n", myargv[p + 1]); + printf(DEH_String("Playing demo %s.lmp.\n"), myargv[p + 1]); } - if (W_CheckNumForName("E2M1") == -1) + if (W_CheckNumForName(DEH_String("E2M1")) == -1) { gamemode = shareware; gamedescription = "Heretic (shareware)"; @@ -966,54 +966,54 @@ void D_DoomMain(void) // smsg[0] = 0; if (deathmatch) - status("DeathMatch..."); + status(DEH_String("DeathMatch...")); if (nomonsters) - status("No Monsters..."); + status(DEH_String("No Monsters...")); if (respawnparm) - status("Respawning..."); + status(DEH_String("Respawning...")); if (autostart) { char temp[64]; - sprintf(temp, "Warp to Episode %d, Map %d, Skill %d ", + sprintf(temp, DEH_String("Warp to Episode %d, Map %d, Skill %d "), startepisode, startmap, startskill + 1); status(temp); } wadprintf(); // print the added wadfiles - tprintf("MN_Init: Init menu system.\n", 1); + tprintf(DEH_String("MN_Init: Init menu system.\n"), 1); MN_Init(); CT_Init(); - tprintf("R_Init: Init Heretic refresh daemon.", 1); - hprintf("Loading graphics"); + tprintf(DEH_String("R_Init: Init Heretic refresh daemon."), 1); + hprintf(DEH_String("Loading graphics")); R_Init(); tprintf("\n", 0); - tprintf("P_Init: Init Playloop state.\n", 1); - hprintf("Init game engine."); + tprintf(DEH_String("P_Init: Init Playloop state.\n"), 1); + hprintf(DEH_String("Init game engine.")); P_Init(); IncThermo(); - tprintf("I_Init: Setting up machine state.\n", 1); + tprintf(DEH_String("I_Init: Setting up machine state.\n"), 1); I_CheckIsScreensaver(); I_InitTimer(); I_InitJoystick(); IncThermo(); - tprintf("S_Init: Setting up sound.\n", 1); + tprintf(DEH_String("S_Init: Setting up sound.\n"), 1); S_Init(); //IO_StartupTimer(); S_Start(); - tprintf("D_CheckNetGame: Checking network game status.\n", 1); - hprintf("Checking network game status."); + tprintf(DEH_String("D_CheckNetGame: Checking network game status.\n"), 1); + hprintf(DEH_String("Checking network game status.")); D_CheckNetGame(); IncThermo(); // haleyjd: removed WATCOMC - tprintf("SB_Init: Loading patches.\n", 1); + tprintf(DEH_String("SB_Init: Loading patches.\n"), 1); SB_Init(); IncThermo(); diff --git a/src/heretic/deh_htext.c b/src/heretic/deh_htext.c new file mode 100644 index 00000000..9075e610 --- /dev/null +++ b/src/heretic/deh_htext.c @@ -0,0 +1,903 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2005-2010 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +//----------------------------------------------------------------------------- +// +// Parses Text substitution sections in dehacked files +// +//----------------------------------------------------------------------------- + +#include +#include + +#include "doomtype.h" +#include "dstrings.h" + +#include "z_zone.h" + +#include "deh_defs.h" +#include "deh_io.h" +#include "deh_main.h" + +// +// Ok, Greg, the action pointers thing was bad enough, but this really +// takes the biscuit. Why does HHE's text replacement address strings +// by offset??!! The dehacked way was much nicer, why change it? +// +// Anyway, this is the Heretic 1.0 string table, which can be seen in +// HHE. This is the string and its offset from the start of the +// text section. Not all the strings are here; this is a redacted list +// that contains just the strings we support. +// + +static const struct +{ + unsigned int offset; + char *string; +} +string_table[] = +{ + { 0, NULL }, + { 4, NULL }, + { 64, NULL }, + { 104, NULL }, + { 160, NULL }, + { 200, NULL }, + { 220, NULL }, + { 228, "PLAYPAL" }, + { 236, NULL }, + { 244, NULL }, + { 252, NULL }, + { 272, NULL }, + { 288, NULL }, + { 296, NULL }, + { 316, NULL }, + { 332, NULL }, + { 372, NULL }, + { 436, NULL }, + { 504, NULL }, + { 536, NULL }, + { 544, NULL }, + { 560, NULL }, + { 576, NULL }, + { 584, "ENDTEXT" }, + { 592, NULL }, + { 612, NULL }, + { 640, NULL }, + { 664, NULL }, + { 712, NULL }, + { 744, NULL }, + { 764, NULL }, + { 808, NULL }, + { 820, NULL }, + { 828, NULL }, + { 840, NULL }, + { 876, NULL }, + { 884, NULL }, + { 908, NULL }, + { 952, NULL }, + { 992, NULL }, + { 1028, NULL }, + { 1036, NULL }, + { 1048, NULL }, + { 1088, NULL }, + { 1128, NULL }, + { 1160, NULL }, + { 1192, NULL }, + { 1212, NULL }, + { 1240, "E1M1: THE DOCKS" }, + { 1260, "E1M2: THE DUNGEONS" }, + { 1280, "E1M3: THE GATEHOUSE" }, + { 1304, "E1M4: THE GUARD TOWER" }, + { 1328, "E1M5: THE CITADEL" }, + { 1348, "E1M6: THE CATHEDRAL" }, + { 1372, "E1M7: THE CRYPTS" }, + { 1392, "E1M8: HELL'S MAW" }, + { 1412, "E1M9: THE GRAVEYARD" }, + { 1436, "E2M1: THE CRATER" }, + { 1456, "E2M2: THE LAVA PITS" }, + { 1480, "E2M3: THE RIVER OF FIRE" }, + { 1508, "E2M4: THE ICE GROTTO" }, + { 1532, "E2M5: THE CATACOMBS" }, + { 1556, "E2M6: THE LABYRINTH" }, + { 1580, "E2M7: THE GREAT HALL" }, + { 1604, "E2M8: THE PORTALS OF CHAOS" }, + { 1632, "E2M9: THE GLACIER" }, + { 1652, "E3M1: THE STOREHOUSE" }, + { 1676, "E3M2: THE CESSPOOL" }, + { 1696, "E3M3: THE CONFLUENCE" }, + { 1720, "E3M4: THE AZURE FORTRESS" }, + { 1748, "E3M5: THE OPHIDIAN LAIR" }, + { 1776, "E3M6: THE HALLS OF FEAR" }, + { 1804, "E3M7: THE CHASM" }, + { 1824, "E3M8: D'SPARIL'S KEEP" }, + { 1848, "E3M9: THE AQUIFER" }, + { 1868, "AUTOPAGE" }, + { 1880, "FOLLOW MODE ON" }, + { 1896, "FOLLOW MODE OFF" }, + { 1912, "GREEN: " }, + { 1936, "YELLOW: " }, + { 1948, "RED: " }, + { 1956, "BLUE: " }, + { 1964, "FONTA_S" }, + { 1972, "-MESSAGE SENT-" }, + { 1988, "THERE ARE NO OTHER PLAYERS IN THE GAME!" }, + { 2028, "FONTA59" }, + { 2036, "PAUSED" }, + { 2044, NULL }, + { 2056, NULL }, + { 2072, "ADVISOR" }, + { 2080, "TITLE" }, + { 2088, "demo1" }, + { 2096, "CREDIT" }, + { 2104, "demo2" }, + { 2112, "ORDER" }, + { 2120, "demo3" }, + { 2128, NULL }, + { 2140, NULL }, + { 2168, "hticsav%c.hsg" }, + { 2184, "heretic.wad" }, + { 2196, NULL }, + { 2212, NULL }, + { 2228, NULL }, + { 2240, "heretic.cfg" }, + { 2252, NULL }, + { 2264, NULL }, + { 2284, NULL }, + { 2304, "Exited from HERETIC.\n" }, + { 2328, NULL }, + { 2340, NULL }, + { 2352, NULL }, + { 2364, NULL }, + { 2372, NULL }, + { 2388, NULL }, + { 2404, NULL }, + { 2412, "c:\\heretic.cd" }, + { 2428, NULL }, + { 2436, NULL }, + { 2444, NULL }, + { 2464, NULL }, + { 2496, NULL }, + { 2508, NULL }, + { 2520, NULL }, + { 2528, "Playing demo %s.lmp.\n" }, + { 2552, NULL }, + { 2564, NULL }, + { 2572, NULL }, + { 2584, NULL }, + { 2592, "V_Init: allocate screens.\n" }, + { 2620, "M_LoadDefaults: Load system defaults.\n" }, + { 2660, "Z_Init: Init zone memory allocation daemon.\n" }, + { 2708, "W_Init: Init WADfiles.\n" }, + { 2732, "E2M1" }, + { 2740, "LOADING" }, + { 2748, "DeathMatch..." }, + { 2764, "No Monsters..." }, + { 2780, "Respawning..." }, + { 2796, "Warp to Episode %d, Map %d, Skill %d " }, + { 2836, "MN_Init: Init menu system.\n" }, + { 2864, "R_Init: Init Heretic refresh daemon." }, + { 2904, "Loading graphics" }, + { 2924, "P_Init: Init Playloop state." }, + { 2956, "Init game engine." }, + { 2976, "I_Init: Setting up machine state.\n" }, + { 3012, "D_CheckNetGame: Checking network game status.\n" }, + { 3060, "Checking network game status." }, + { 3092, "SB_Init: Loading patches.\n" }, + { 3120, NULL }, + { 3128, NULL }, + { 3140, NULL }, + { 3184, NULL }, + { 3220, NULL }, + { 3256, NULL }, + { 3280, NULL }, + { 3304, NULL }, + { 3320, NULL }, + { 3352, "PLAYER 1 HAS LEFT THE GAME" }, + { 3380, NULL }, + { 3432, NULL }, + { 3464, NULL }, + { 3508, NULL }, + { 3548, NULL }, + { 3600, NULL }, + { 3624, NULL }, + { 3664, NULL }, + { 3696, NULL }, + { 3736, "NET GAME" }, + { 3748, "SAVE GAME" }, + { 3760, "Only %i deathmatch spots, 4 required" }, + { 3800, "version %i" }, + { 3812, NULL }, + { 3828, NULL }, + { 3856, NULL }, + { 3872, NULL }, + { 3896, "GAME SAVED" }, + { 3908, "SKY1" }, + { 3916, "SKY2" }, + { 3924, "SKY3" }, + { 3932, NULL }, + { 3940, NULL }, + { 3976, NULL }, + { 3996, NULL }, + { 4016, E1TEXT }, + { 4536, E2TEXT }, + { 5068, E3TEXT }, + { 5632, "FLOOR25" }, + { 5640, "FLATHUH1" }, + { 5652, "FLTWAWA2" }, + { 5664, "FONTA_S" }, + { 5672, "FINAL1" }, + { 5680, "FINAL2" }, + { 5688, "E2PAL" }, + { 5696, "E2END" }, + { 5704, "PLAYPAL" }, + { 5712, "ORDER" }, + { 5720, "IMPX" }, + { 5728, "ACLO" }, + { 5736, "PTN1" }, + { 5744, "SHLD" }, + { 5752, "SHD2" }, + { 5760, "BAGH" }, + { 5768, "SPMP" }, + { 5776, "INVS" }, + { 5784, "PTN2" }, + { 5792, "SOAR" }, + { 5800, "INVU" }, + { 5808, "PWBK" }, + { 5816, "EGGC" }, + { 5824, "EGGM" }, + { 5832, "FX01" }, + { 5840, "SPHL" }, + { 5848, "TRCH" }, + { 5856, "FBMB" }, + { 5864, "XPL1" }, + { 5872, "ATLP" }, + { 5880, "PPOD" }, + { 5888, "AMG1" }, + { 5896, "SPSH" }, + { 5904, "LVAS" }, + { 5912, "SLDG" }, + { 5920, "SKH1" }, + { 5928, "SKH2" }, + { 5936, "SKH3" }, + { 5944, "SKH4" }, + { 5952, "CHDL" }, + { 5960, "SRTC" }, + { 5968, "SMPL" }, + { 5976, "STGS" }, + { 5984, "STGL" }, + { 5992, "STCS" }, + { 6000, "STCL" }, + { 6008, "KFR1" }, + { 6016, "BARL" }, + { 6024, "BRPL" }, + { 6032, "MOS1" }, + { 6040, "MOS2" }, + { 6048, "WTRH" }, + { 6056, "HCOR" }, + { 6064, "KGZ1" }, + { 6072, "KGZB" }, + { 6080, "KGZG" }, + { 6088, "KGZY" }, + { 6096, "VLCO" }, + { 6104, "VFBL" }, + { 6112, "VTFB" }, + { 6120, "SFFI" }, + { 6128, "TGLT" }, + { 6136, "TELE" }, + { 6144, "STFF" }, + { 6152, "PUF3" }, + { 6160, "PUF4" }, + { 6168, "BEAK" }, + { 6176, "WGNT" }, + { 6184, "GAUN" }, + { 6192, "PUF1" }, + { 6200, "WBLS" }, + { 6208, "BLSR" }, + { 6216, "FX18" }, + { 6224, "FX17" }, + { 6232, "WMCE" }, + { 6240, "MACE" }, + { 6248, "FX02" }, + { 6256, "WSKL" }, + { 6264, "HROD" }, + { 6272, "FX00" }, + { 6280, "FX20" }, + { 6288, "FX21" }, + { 6296, "FX22" }, + { 6304, "FX23" }, + { 6312, "GWND" }, + { 6320, "PUF2" }, + { 6328, "WPHX" }, + { 6336, "PHNX" }, + { 6344, "FX04" }, + { 6352, "FX08" }, + { 6360, "FX09" }, + { 6368, "WBOW" }, + { 6376, "CRBW" }, + { 6384, "FX03" }, + { 6392, "BLOD" }, + { 6400, "PLAY" }, + { 6408, "FDTH" }, + { 6416, "BSKL" }, + { 6424, "CHKN" }, + { 6432, "MUMM" }, + { 6440, "FX15" }, + { 6448, "BEAS" }, + { 6456, "FRB1" }, + { 6464, "SNKE" }, + { 6472, "SNFX" }, + { 6480, "HEAD" }, + { 6488, "FX05" }, + { 6496, "FX06" }, + { 6504, "FX07" }, + { 6512, "CLNK" }, + { 6520, "WZRD" }, + { 6528, "FX11" }, + { 6536, "FX10" }, + { 6544, "KNIG" }, + { 6552, "SPAX" }, + { 6560, "RAXE" }, + { 6568, "SRCR" }, + { 6576, "FX14" }, + { 6584, "SOR2" }, + { 6592, "SDTH" }, + { 6600, "FX16" }, + { 6608, "MNTR" }, + { 6616, "FX12" }, + { 6624, "FX13" }, + { 6632, "AKYY" }, + { 6640, "BKYY" }, + { 6648, "CKYY" }, + { 6656, "AMG2" }, + { 6664, "AMM1" }, + { 6672, "AMM2" }, + { 6680, "AMC1" }, + { 6688, "AMC2" }, + { 6696, "AMS1" }, + { 6704, "AMS2" }, + { 6712, "AMP1" }, + { 6720, "AMP2" }, + { 6728, "AMB1" }, + { 6736, "AMB2" }, + { 6768, "PLAYPAL" }, + { 6776, "MAPE1" }, + { 6784, "MAPE2" }, + { 6792, "MAPE3" }, + { 6800, "IN_X" }, + { 6808, "IN_YAH" }, + { 6816, "FONTB16" }, + { 6824, "FONTB_S" }, + { 6832, "FONTB13" }, + { 6840, "FONTB15" }, + { 6848, "FONTB05" }, + { 6856, "FACEA0" }, + { 6864, "FACEB0" }, + { 6872, NULL }, + { 6896, NULL }, + { 6940, "FLOOR16" }, + { 6948, "FINISHED" }, + { 6960, "NOW ENTERING:" }, + { 6976, "KILLS" }, + { 6984, "ITEMS" }, + { 6992, "SECRETS" }, + { 7000, "TIME" }, + { 7008, "BONUS" }, + { 7016, "SECRET" }, + { 7024, "TOTAL" }, + { 7032, "VICTIMS" }, + { 7044, "NEW GAME" }, + { 7056, "OPTIONS" }, + { 7064, "GAME FILES" }, + { 7076, "INFO" }, + { 7084, "QUIT GAME" }, + { 7096, "CITY OF THE DAMNED" }, + { 7116, "HELL'S MAW" }, + { 7128, "THE DOME OF D'SPARIL" }, + { 7152, "LOAD GAME" }, + { 7164, "SAVE GAME" }, + { 7176, "THOU NEEDETH A WET-NURSE" }, + { 7204, "YELLOWBELLIES-R-US" }, + { 7224, "BRINGEST THEM ONETH" }, + { 7244, "THOU ART A SMITE-MEISTER" }, + { 7272, "BLACK PLAGUE POSSESSES THEE" }, + { 7300, "END GAME" }, + { 7312, "MESSAGES : " }, + { 7324, "MOUSE SENSITIVITY" }, + { 7344, "MORE..." }, + { 7352, "SCREEN SIZE" }, + { 7364, "SFX VOLUME" }, + { 7376, "MUSIC VOLUME" }, + { 7392, "M_SKL00" }, + { 7400, "FONTA_S" }, + { 7408, "FONTB_S" }, + { 7416, "ARE YOU SURE YOU WANT TO QUIT?" }, + { 7448, "ARE YOU SURE YOU WANT TO END THE GAME?" }, + { 7488, "DO YOU WANT TO QUICKSAVE THE GAME NAMED" }, + { 7528, "DO YOU WANT TO QUICKLOAD THE GAME NAMED" }, + { 7572, "M_SLCTR1" }, + { 7584, "M_SLCTR2" }, + { 7596, "M_HTIC" }, + { 7604, NULL }, + { 7632, "hticsav%d.hsg" }, + { 7652, "M_FSLOT" }, + { 7668, "MESSAGES ON" }, + { 7680, "MESSAGES OFF" }, + { 7696, "YOU CAN'T START A NEW GAME FROM WITHIN A NETGAME!" }, + { 7748, "ONLY AVAILABLE IN THE REGISTERED VERSION" }, + { 7792, "PLAYPAL" }, + { 7800, "QUICKSAVING...." }, + { 7816, "QUICKLOADING...." }, + { 7836, "CHOOSE A QUICKSAVE SLOT" }, + { 7860, "CHOOSE A QUICKLOAD SLOT" }, + { 7884, "TITLE" }, + { 7892, "M_SLDLT" }, + { 7900, "M_SLDMD1" }, + { 7912, "M_SLDMD2" }, + { 7924, "M_SLDRT" }, + { 7932, "M_SLDKB" }, + { 7940, NULL }, + { 7968, NULL }, + { 7992, NULL }, + { 8020, NULL }, + { 8028, NULL }, + { 8056, NULL }, + { 8076, NULL }, + { 8088, NULL }, + { 8104, NULL }, + { 8116, NULL }, + { 8128, NULL }, + { 8136, NULL }, + { 8148, NULL }, + { 8164, NULL }, + { 8180, NULL }, + { 8192, NULL }, + { 8204, NULL }, + { 8220, NULL }, + { 8232, NULL }, + { 8248, NULL }, + { 8264, NULL }, + { 8276, NULL }, + { 8292, NULL }, + { 8308, NULL }, + { 8320, NULL }, + { 8328, NULL }, + { 8340, NULL }, + { 8352, NULL }, + { 8364, NULL }, + { 8376, NULL }, + { 8392, NULL }, + { 8408, NULL }, + { 8424, NULL }, + { 8436, NULL }, + { 8448, NULL }, + { 8460, NULL }, + { 8472, NULL }, + { 8488, NULL }, + { 8504, NULL }, + { 8520, NULL }, + { 8536, NULL }, + { 8548, NULL }, + { 8560, NULL }, + { 8572, NULL }, + { 8584, NULL }, + { 8596, NULL }, + { 8612, NULL }, + { 8624, NULL }, + { 8648, NULL }, + { 8660, NULL }, + { 8668, NULL }, + { 8680, NULL }, + { 8708, NULL }, + { 8720, NULL }, + { 8728, NULL }, + { 8740, NULL }, + { 8752, NULL }, + { 8764, NULL }, + { 8788, NULL }, + { 8800, NULL }, + { 8812, NULL }, + { 8824, NULL }, + { 8848, NULL }, + { 8880, NULL }, + { 8888, NULL }, + { 8896, NULL }, + { 8916, NULL }, + { 8968, "HRTIC00.pcx" }, + { 8980, NULL }, + { 9016, "SCREEN SHOT" }, + { 9028, "YOU NEED A BLUE KEY TO OPEN THIS DOOR" }, + { 9068, "YOU NEED A YELLOW KEY TO OPEN THIS DOOR" }, + { 9108, "YOU NEED A GREEN KEY TO OPEN THIS DOOR" }, + { 9148, NULL }, + { 9172, NULL }, + { 9220, NULL }, + { 9244, "CRYSTAL VIAL" }, + { 9260, "SILVER SHIELD" }, + { 9276, "ENCHANTED SHIELD" }, + { 9296, "BAG OF HOLDING" }, + { 9312, "MAP SCROLL" }, + { 9324, "BLUE KEY" }, + { 9336, "YELLOW KEY" }, + { 9348, "GREEN KEY" }, + { 9360, "QUARTZ FLASK" }, + { 9376, "WINGS OF WRATH" }, + { 9392, "RING OF INVINCIBILITY" }, + { 9416, "TOME OF POWER" }, + { 9432, "SHADOWSPHERE" }, + { 9448, "MORPH OVUM" }, + { 9460, "MYSTIC URN" }, + { 9472, "TORCH" }, + { 9480, "TIME BOMB OF THE ANCIENTS" }, + { 9508, "CHAOS DEVICE" }, + { 9524, "WAND CRYSTAL" }, + { 9540, "CRYSTAL GEODE" }, + { 9556, "MACE SPHERES" }, + { 9572, "PILE OF MACE SPHERES" }, + { 9596, "ETHEREAL ARROWS" }, + { 9612, "QUIVER OF ETHEREAL ARROWS" }, + { 9640, "CLAW ORB" }, + { 9652, "ENERGY ORB" }, + { 9664, "LESSER RUNES" }, + { 9680, "GREATER RUNES" }, + { 9696, "FLAME ORB" }, + { 9708, "INFERNO ORB" }, + { 9720, "FIREMACE" }, + { 9732, "ETHEREAL CROSSBOW" }, + { 9752, "DRAGON CLAW" }, + { 9764, "HELLSTAFF" }, + { 9776, "PHOENIX ROD" }, + { 9788, "GAUNTLETS OF THE NECROMANCER" }, + { 9820, NULL }, + { 9860, NULL }, + { 9892, NULL }, + { 9940, NULL }, + { 9972, NULL }, + { 10012, NULL }, + { 10052, NULL }, + { 10080, NULL }, + { 10088, "FLTWAWA1" }, + { 10100, "FLTFLWW1" }, + { 10112, "FLTLAVA1" }, + { 10124, "FLATHUH1" }, + { 10136, "FLTSLUD1" }, + { 10152, NULL }, + { 10192, NULL }, + { 10236, NULL }, + { 10248, NULL }, + { 10284, NULL }, + { 10320, NULL }, + { 10360, NULL }, + { 10392, NULL }, + { 10444, "PLAYPAL" }, + { 10452, NULL }, + { 10488, NULL }, + { 10508, NULL }, + { 10556, NULL }, + { 10596, "PNAMES" }, + { 10604, "TEXTURE1" }, + { 10616, "TEXTURE2" }, + { 10628, "S_END" }, + { 10636, "S_START" }, + { 10644, NULL }, + { 10684, NULL }, + { 10728, "F_START" }, + { 10736, "F_END" }, + { 10744, "COLORMAP" }, + { 10756, "\nR_InitTextures " }, + { 10776, "R_InitFlats\n" }, + { 10792, "R_InitSpriteLumps " }, + { 10812, NULL }, + { 10844, NULL }, + { 10880, NULL }, + { 10912, NULL }, + { 10948, "TINTTAB" }, + { 10956, NULL }, + { 10984, "FLOOR04" }, + { 10992, "FLAT513" }, + { 11000, "bordt" }, + { 11008, "bordb" }, + { 11016, "bordl" }, + { 11024, "bordr" }, + { 11032, "bordtl" }, + { 11040, "bordtr" }, + { 11048, "bordbr" }, + { 11056, "bordbl" }, + { 11064, "R_InitData " }, + { 11076, "R_InitPointToAngle\n" }, + { 11096, "R_InitTables " }, + { 11112, "R_InitPlanes\n" }, + { 11128, "R_InitLightTables " }, + { 11148, "R_InitSkyMap\n" }, + { 11164, "F_SKY1" }, + { 11172, NULL }, + { 11200, NULL }, + { 11232, NULL }, + { 11272, NULL }, + { 11312, NULL }, + { 11348, NULL }, + { 11380, NULL }, + { 11404, NULL }, + { 11436, NULL }, + { 11492, NULL }, + { 11548, NULL }, + { 11616, NULL }, + { 11684, NULL }, + { 11748, NULL }, + { 11792, NULL }, + { 11840, NULL }, + { 11896, NULL }, + { 11936, NULL }, + { 11980, NULL }, + { 12028, NULL }, + { 12072, NULL }, + { 12120, "LTFACE" }, + { 12128, "RTFACE" }, + { 12136, "BARBACK" }, + { 12144, "INVBAR" }, + { 12152, "CHAIN" }, + { 12160, "STATBAR" }, + { 12168, "LIFEBAR" }, + { 12176, "LIFEGEM2" }, + { 12188, "LIFEGEM0" }, + { 12200, "LTFCTOP" }, + { 12208, "RTFCTOP" }, + { 12216, "ARTIBOX" }, + { 12224, "SELECTBOX" }, + { 12236, "INVGEML1" }, + { 12248, "INVGEML2" }, + { 12260, "INVGEMR1" }, + { 12272, "INVGEMR2" }, + { 12284, "BLACKSQ" }, + { 12292, "ARMCLEAR" }, + { 12304, "CHAINBACK" }, + { 12320, "NEGNUM" }, + { 12328, "FONTB16" }, + { 12336, "SMALLIN0" }, + { 12348, "PLAYPAL" }, + { 12356, "SPINBK0" }, + { 12364, "SPFLY0" }, + { 12372, "LAME" }, + { 12408, "NAME" }, + { 12416, "MO.T" }, + { 12424, "MO.X" }, + { 12432, "MO.Y" }, + { 12448, "DIST" }, + { 12456, "------" }, + { 12472, "GOD1" }, + { 12480, "GOD2" }, + { 12488, "useartia" }, + { 12500, "ykeyicon" }, + { 12512, "gkeyicon" }, + { 12524, "bkeyicon" }, + { 12536, "GOD MODE ON" }, + { 12548, "GOD MODE OFF" }, + { 12564, "NO CLIPPING ON" }, + { 12580, "NO CLIPPING OFF" }, + { 12596, "ALL WEAPONS" }, + { 12608, "POWER OFF" }, + { 12620, "POWER ON" }, + { 12632, "FULL HEALTH" }, + { 12644, "ALL KEYS" }, + { 12656, "SOUND DEBUG ON" }, + { 12672, "SOUND DEBUG OFF" }, + { 12688, "TICKER ON" }, + { 12700, "TICKER OFF" }, + { 12712, "CHOOSE AN ARTIFACT ( A - J )" }, + { 12744, "HOW MANY ( 1 - 9 )" }, + { 12764, "YOU GOT IT" }, + { 12776, "BAD INPUT" }, + { 12788, "LEVEL WARP" }, + { 12800, "CHICKEN OFF" }, + { 12812, "CHICKEN ON" }, + { 12824, "MASSACRE" }, + { 12836, "CHEATER - YOU DON'T DESERVE WEAPONS" }, + { 12872, "TRYING TO CHEAT, EH? NOW YOU DIE!" }, + { 12908, "Bad V_DrawPatch" }, + { 12924, NULL }, + { 12960, NULL }, + { 12968, NULL }, + { 12976, NULL }, + { 13020, NULL }, + { 13048, NULL }, + { 13076, NULL }, + { 13104, NULL }, + { 13136, NULL }, + { 13168, NULL }, + { 13196, NULL }, + { 13240, NULL }, + { 13272, NULL }, + { 13296, NULL }, + { 13312, NULL }, + { 13324, NULL }, + { 13364, NULL }, + { 13408, NULL }, + { 13460, NULL }, + { 13492, NULL }, + { 13516, NULL }, + { 13560, NULL }, + { 13612, NULL }, + { 13664, NULL }, + { 13700, NULL }, + { 13744, NULL }, + { 13796, NULL }, + { 13848, NULL }, + { 13884, NULL }, + { 13940, NULL }, + { 13996, NULL }, + { 14040, NULL }, + { 14084, NULL }, + { 14140, NULL }, + { 14148, NULL }, + { 14164, NULL }, + { 14184, NULL }, + { 14192, NULL }, + { 14212, NULL }, + { 14256, NULL }, + { 14272, NULL }, + { 14284, NULL }, + { 14300, NULL }, + { 14312, NULL }, + { 14324, NULL }, + { 14348, NULL }, + { 14360, NULL }, + { 14372, NULL }, + { 14380, NULL }, + { 14392, NULL }, + { 14432, NULL }, + { 14444, NULL }, + { 14472, NULL }, + { 14496, NULL }, + { 14516, NULL }, + { 14536, NULL }, + { 14548, NULL }, + { 14560, NULL }, + { 14572, NULL }, + { 14580, NULL }, + { 14588, NULL }, + { 14596, NULL }, + { 14604, NULL }, + { 14612, NULL }, + { 14620, NULL }, + { 14636, NULL }, + { 14660, NULL }, + { 14704, NULL }, + { 14748, NULL }, + { 14760, NULL }, + { 14768, NULL }, +}; + +static boolean GetStringByOffset(unsigned int offset, char **result) +{ + int i; + + for (i=0; i MaxStringLength(strlen(orig_text))) + { + DEH_Error(context, "Replacement string is longer than the maximum " + "possible in heretic.exe"); + } + else + { + // Success. + + DEH_AddStringReplacement(orig_text, repl_text); + + return NULL; + } + + // Failure. + + Z_Free(repl_text); + + return NULL; +} + +static void DEH_TextParseLine(deh_context_t *context, char *line, void *tag) +{ + // not used +} + +deh_section_t deh_section_heretic_text = +{ + "Text", + NULL, + DEH_TextStart, + DEH_TextParseLine, + NULL, + NULL, +}; + diff --git a/src/heretic/deh_htic.c b/src/heretic/deh_htic.c index ca1c6d5c..59c426ef 100644 --- a/src/heretic/deh_htic.c +++ b/src/heretic/deh_htic.c @@ -44,8 +44,8 @@ extern deh_section_t deh_section_frame; extern deh_section_t deh_section_pointer; // deh_sound.c extern deh_section_t deh_section_sound; -// deh_text.c: -extern deh_section_t deh_section_text; +// deh_htext.c: +extern deh_section_t deh_section_heretic_text; // deh_thing.c: extern deh_section_t deh_section_thing; // deh_weapon.c: @@ -61,7 +61,7 @@ deh_section_t *deh_section_types[] = &deh_section_frame, // &deh_section_pointer, TODO &deh_section_sound, -// &deh_section_text, TODO + &deh_section_heretic_text, &deh_section_thing, &deh_section_weapon, NULL diff --git a/src/heretic/f_finale.c b/src/heretic/f_finale.c index 03806214..27b33e96 100644 --- a/src/heretic/f_finale.c +++ b/src/heretic/f_finale.c @@ -26,6 +26,7 @@ #include #include "doomdef.h" +#include "deh_str.h" #include "i_swap.h" #include "i_video.h" #include "s_sound.h" @@ -72,30 +73,30 @@ void F_StartFinale(void) switch (gameepisode) { case 1: - finaleflat = "FLOOR25"; + finaleflat = DEH_String("FLOOR25"); finaletext = e1text; break; case 2: - finaleflat = "FLATHUH1"; + finaleflat = DEH_String("FLATHUH1"); finaletext = e2text; break; case 3: - finaleflat = "FLTWAWA2"; + finaleflat = DEH_String("FLTWAWA2"); finaletext = e3text; break; case 4: - finaleflat = "FLOOR28"; + finaleflat = DEH_String("FLOOR28"); finaletext = e4text; break; case 5: - finaleflat = "FLOOR08"; + finaleflat = DEH_String("FLOOR08"); finaletext = e5text; break; } finalestage = 0; finalecount = 0; - FontABaseLump = W_GetNumForName("FONTA_S") + 1; + FontABaseLump = W_GetNumForName(DEH_String("FONTA_S")) + 1; // S_ChangeMusic(mus_victor, true); S_StartSong(mus_cptd, true); @@ -277,8 +278,8 @@ void F_DemonScroll(void) { return; } - p1 = W_CacheLumpName("FINAL1", PU_LEVEL); - p2 = W_CacheLumpName("FINAL2", PU_LEVEL); + p1 = W_CacheLumpName(DEH_String("FINAL1"), PU_LEVEL); + p2 = W_CacheLumpName(DEH_String("FINAL2"), PU_LEVEL); if (finalecount < 70) { memcpy(I_VideoBuffer, p1, SCREENHEIGHT * SCREENWIDTH); @@ -319,8 +320,8 @@ void F_DrawUnderwater(void) { underwawa = true; memset((byte *) 0xa0000, 0, SCREENWIDTH * SCREENHEIGHT); - I_SetPalette(W_CacheLumpName("E2PAL", PU_CACHE)); - V_DrawRawScreen(W_CacheLumpName("E2END", PU_CACHE)); + I_SetPalette(W_CacheLumpName(DEH_String("E2PAL"), PU_CACHE)); + V_DrawRawScreen(W_CacheLumpName(DEH_String("E2END"), PU_CACHE)); } paused = false; MenuActive = false; @@ -328,7 +329,7 @@ void F_DrawUnderwater(void) break; case 2: - V_DrawRawScreen(W_CacheLumpName("TITLE", PU_CACHE)); + V_DrawRawScreen(W_CacheLumpName(DEH_String("TITLE"), PU_CACHE)); //D_StartTitle(); // go to intro/demo mode. } } diff --git a/src/heretic/g_game.c b/src/heretic/g_game.c index a256b63b..4d1e63c3 100644 --- a/src/heretic/g_game.c +++ b/src/heretic/g_game.c @@ -28,6 +28,7 @@ #include #include "doomdef.h" #include "doomkeys.h" +#include "deh_str.h" #include "i_timer.h" #include "i_system.h" #include "m_controls.h" @@ -862,11 +863,11 @@ void G_Ticker(void) { if (netgame) { - strcpy(savedescription, "NET GAME"); + strcpy(savedescription, DEH_String("NET GAME")); } else { - strcpy(savedescription, "SAVE GAME"); + strcpy(savedescription, DEH_String("SAVE GAME")); } } savegameslot = @@ -1320,7 +1321,7 @@ void G_DoLoadGame(void) save_p = savebuffer + SAVESTRINGSIZE; // Skip the description field memset(vcheck, 0, sizeof(vcheck)); - sprintf(vcheck, "version %i", HERETIC_VERSION); + sprintf(vcheck, DEH_String("version %i"), HERETIC_VERSION); if (strcmp((char *) save_p, vcheck) != 0) { // Bad version return; @@ -1449,11 +1450,11 @@ void G_InitNew(skill_t skill, int episode, int map) // Set the sky map if (episode > 5) { - skytexture = R_TextureNumForName("SKY1"); + skytexture = R_TextureNumForName(DEH_String("SKY1")); } else { - skytexture = R_TextureNumForName(skyLumpNames[episode - 1]); + skytexture = R_TextureNumForName(DEH_String(skyLumpNames[episode - 1])); } // @@ -1694,7 +1695,7 @@ void G_DoSaveGame(void) SV_Open(name); SV_Write(description, SAVESTRINGSIZE); memset(verString, 0, sizeof(verString)); - sprintf(verString, "version %i", HERETIC_VERSION); + sprintf(verString, DEH_String("version %i"), HERETIC_VERSION); SV_Write(verString, VERSIONSIZE); SV_WriteByte(gameskill); SV_WriteByte(gameepisode); diff --git a/src/heretic/in_lude.c b/src/heretic/in_lude.c index 33b75956..084cd5c3 100644 --- a/src/heretic/in_lude.c +++ b/src/heretic/in_lude.c @@ -30,6 +30,7 @@ */ #include "doomdef.h" +#include "deh_str.h" #include "s_sound.h" #include "i_system.h" #include "i_video.h" @@ -161,7 +162,7 @@ extern void AM_Stop(void); void IN_Start(void) { - I_SetPalette(W_CacheLumpName("PLAYPAL", PU_CACHE)); + I_SetPalette(W_CacheLumpName(DEH_String("PLAYPAL"), PU_CACHE)); IN_LoadPics(); IN_InitStats(); intermission = true; @@ -308,26 +309,26 @@ static void IN_LoadUnloadPics(void (*callback)(char *lumpname, switch (gameepisode) { case 1: - callback("MAPE1", 0, &patchINTERPIC); + callback(DEH_String("MAPE1"), 0, &patchINTERPIC); break; case 2: - callback("MAPE2", 0, &patchINTERPIC); + callback(DEH_String("MAPE2"), 0, &patchINTERPIC); break; case 3: - callback("MAPE3", 0, &patchINTERPIC); + callback(DEH_String("MAPE3"), 0, &patchINTERPIC); break; default: break; } - callback("IN_X", 0, &patchBEENTHERE); - callback("IN_YAH", 0, &patchGOINGTHERE); - callback("FONTB13", 0, &FontBNegative); + callback(DEH_String("IN_X"), 0, &patchBEENTHERE); + callback(DEH_String("IN_YAH"), 0, &patchGOINGTHERE); + callback(DEH_String("FONTB13"), 0, &FontBNegative); - callback("FONTB15", 0, &FontBSlash); - callback("FONTB05", 0, &FontBPercent); + callback(DEH_String("FONTB15"), 0, &FontBSlash); + callback(DEH_String("FONTB05"), 0, &FontBPercent); - FontBLumpBase = W_GetNumForName("FONTB16"); + FontBLumpBase = W_GetNumForName(DEH_String("FONTB16")); for (i = 0; i < 10; i++) { @@ -355,9 +356,9 @@ static void LoadLumpCallback(char *lumpname, int lumpnum, patch_t **ptr) void IN_LoadPics(void) { - FontBLump = W_GetNumForName("FONTB_S") + 1; - patchFaceOkayBase = W_GetNumForName("FACEA0"); - patchFaceDeadBase = W_GetNumForName("FACEB0"); + FontBLump = W_GetNumForName(DEH_String("FONTB_S")) + 1; + patchFaceOkayBase = W_GetNumForName(DEH_String("FACEA0")); + patchFaceDeadBase = W_GetNumForName(DEH_String("FACEB0")); IN_LoadUnloadPics(LoadLumpCallback); } @@ -580,7 +581,7 @@ void IN_DrawStatBack(void) byte *src; byte *dest; - src = W_CacheLumpName("FLOOR16", PU_CACHE); + src = W_CacheLumpName(DEH_String("FLOOR16"), PU_CACHE); dest = I_VideoBuffer; for (y = 0; y < SCREENHEIGHT; y++) @@ -612,8 +613,8 @@ void IN_DrawOldLevel(void) x = 160 - MN_TextBWidth(LevelNames[(gameepisode - 1) * 9 + prevmap - 1] + 7) / 2; IN_DrTextB(LevelNames[(gameepisode - 1) * 9 + prevmap - 1] + 7, x, 3); - x = 160 - MN_TextAWidth("FINISHED") / 2; - MN_DrTextA("FINISHED", x, 25); + x = 160 - MN_TextAWidth(DEH_String("FINISHED")) / 2; + MN_DrTextA(DEH_String("FINISHED"), x, 25); if (prevmap == 9) { @@ -660,8 +661,8 @@ void IN_DrawYAH(void) int i; int x; - x = 160 - MN_TextAWidth("NOW ENTERING:") / 2; - MN_DrTextA("NOW ENTERING:", x, 10); + x = 160 - MN_TextAWidth(DEH_String("NOW ENTERING:")) / 2; + MN_DrTextA(DEH_String("NOW ENTERING:"), x, 10); x = 160 - MN_TextBWidth(LevelNames[(gameepisode - 1) * 9 + gamemap - 1] + 7) / 2; IN_DrTextB(LevelNames[(gameepisode - 1) * 9 + gamemap - 1] + 7, x, 20); @@ -698,15 +699,15 @@ void IN_DrawSingleStats(void) int x; static int sounds; - IN_DrTextB("KILLS", 50, 65); - IN_DrTextB("ITEMS", 50, 90); - IN_DrTextB("SECRETS", 50, 115); + IN_DrTextB(DEH_String("KILLS"), 50, 65); + IN_DrTextB(DEH_String("ITEMS"), 50, 90); + IN_DrTextB(DEH_String("SECRETS"), 50, 115); x = 160 - MN_TextBWidth(LevelNames[(gameepisode - 1) * 9 + prevmap - 1] + 7) / 2; IN_DrTextB(LevelNames[(gameepisode - 1) * 9 + prevmap - 1] + 7, x, 3); - x = 160 - MN_TextAWidth("FINISHED") / 2; - MN_DrTextA("FINISHED", x, 25); + x = 160 - MN_TextAWidth(DEH_String("FINISHED")) / 2; + MN_DrTextA(DEH_String("FINISHED"), x, 25); if (intertime < 30) { @@ -757,13 +758,13 @@ void IN_DrawSingleStats(void) if (gamemode != retail || gameepisode <= 3) { - IN_DrTextB("TIME", 85, 160); + IN_DrTextB(DEH_String("TIME"), 85, 160); IN_DrawTime(155, 160, hours, minutes, seconds); } else { - x = 160 - MN_TextAWidth("NOW ENTERING:") / 2; - MN_DrTextA("NOW ENTERING:", x, 160); + x = 160 - MN_TextAWidth(DEH_String("NOW ENTERING:")) / 2; + MN_DrTextA(DEH_String("NOW ENTERING:"), x, 160); x = 160 - MN_TextBWidth(LevelNames[(gameepisode - 1) * 9 + gamemap - 1] + 7) / 2; @@ -787,14 +788,14 @@ void IN_DrawCoopStats(void) static int sounds; - IN_DrTextB("KILLS", 95, 35); - IN_DrTextB("BONUS", 155, 35); - IN_DrTextB("SECRET", 232, 35); + IN_DrTextB(DEH_String("KILLS"), 95, 35); + IN_DrTextB(DEH_String("BONUS"), 155, 35); + IN_DrTextB(DEH_String("SECRET"), 232, 35); x = 160 - MN_TextBWidth(LevelNames[(gameepisode - 1) * 9 + prevmap - 1] + 7) / 2; IN_DrTextB(LevelNames[(gameepisode - 1) * 9 + prevmap - 1] + 7, x, 3); - x = 160 - MN_TextAWidth("FINISHED") / 2; - MN_DrTextA("FINISHED", x, 25); + x = 160 - MN_TextAWidth(DEH_String("FINISHED")) / 2; + MN_DrTextA(DEH_String("FINISHED"), x, 25); ypos = 50; for (i = 0; i < MAXPLAYERS; i++) @@ -845,8 +846,8 @@ void IN_DrawDMStats(void) xpos = 90; ypos = 55; - IN_DrTextB("TOTAL", 265, 30); - MN_DrTextA("VICTIMS", 140, 8); + IN_DrTextB(DEH_String("TOTAL"), 265, 30); + MN_DrTextA(DEH_String("VICTIMS"), 140, 8); for (i = 0; i < 7; i++) { MN_DrTextA(KillersText[i], 10, 80 + 9 * i); diff --git a/src/heretic/mn_menu.c b/src/heretic/mn_menu.c index 33024a96..2b380234 100644 --- a/src/heretic/mn_menu.c +++ b/src/heretic/mn_menu.c @@ -25,6 +25,8 @@ // MN_menu.c #include + +#include "deh_str.h" #include "doomdef.h" #include "doomkeys.h" #include "i_system.h" @@ -73,7 +75,7 @@ typedef struct { ItemType_t type; char *text; - boolean(*func) (int option); + boolean(*func) (int option); int option; MenuType_t menu; } MenuItem_t; @@ -305,7 +307,7 @@ void MN_Init(void) InitFonts(); MenuActive = false; messageson = true; - SkullBaseLump = W_GetNumForName("M_SKL00"); + SkullBaseLump = W_GetNumForName(DEH_String("M_SKL00")); if (gamemode == retail) { // Add episodes 4 and 5 to the menu @@ -322,8 +324,8 @@ void MN_Init(void) static void InitFonts(void) { - FontABaseLump = W_GetNumForName("FONTA_S") + 1; - FontBBaseLump = W_GetNumForName("FONTB_S") + 1; + FontABaseLump = W_GetNumForName(DEH_String("FONTA_S")) + 1; + FontBBaseLump = W_GetNumForName(DEH_String("FONTB_S")) + 1; } //--------------------------------------------------------------------------- @@ -476,14 +478,16 @@ void MN_Drawer(void) int x; int y; MenuItem_t *item; + char *message; char *selName; if (MenuActive == false) { if (askforquit) { - MN_DrTextA(QuitEndMsg[typeofask - 1], 160 - - MN_TextAWidth(QuitEndMsg[typeofask - 1]) / 2, 80); + message = DEH_String(QuitEndMsg[typeofask - 1]); + + MN_DrTextA(message, 160 - MN_TextAWidth(message) / 2, 80); if (typeofask == 3) { MN_DrTextA(SlotText[quicksave - 1], 160 - @@ -525,13 +529,13 @@ void MN_Drawer(void) { if (item->type != ITT_EMPTY && item->text) { - MN_DrTextB(item->text, x, y); + MN_DrTextB(DEH_String(item->text), x, y); } y += ITEM_HEIGHT; item++; } y = CurrentMenu->y + (CurrentItPos * ITEM_HEIGHT) + SELECTOR_YOFFSET; - selName = MenuTime & 16 ? "M_SLCTR1" : "M_SLCTR2"; + selName = DEH_String(MenuTime & 16 ? "M_SLCTR1" : "M_SLCTR2"); V_DrawPatch(x + SELECTOR_XOFFSET, y, W_CacheLumpName(selName, PU_CACHE)); } @@ -548,7 +552,7 @@ static void DrawMainMenu(void) int frame; frame = (MenuTime / 3) % 18; - V_DrawPatch(88, 0, W_CacheLumpName("M_HTIC", PU_CACHE)); + V_DrawPatch(88, 0, W_CacheLumpName(DEH_String("M_HTIC"), PU_CACHE)); V_DrawPatch(40, 10, W_CacheLumpNum(SkullBaseLump + (17 - frame), PU_CACHE)); V_DrawPatch(232, 10, W_CacheLumpNum(SkullBaseLump + frame, PU_CACHE)); @@ -597,7 +601,11 @@ static void DrawFilesMenu(void) static void DrawLoadMenu(void) { - MN_DrTextB("LOAD GAME", 160 - MN_TextBWidth("LOAD GAME") / 2, 10); + char *title; + + title = DEH_String("LOAD GAME"); + + MN_DrTextB(title, 160 - MN_TextBWidth(title) / 2, 10); if (!slottextloaded) { MN_LoadSlotText(); @@ -613,7 +621,11 @@ static void DrawLoadMenu(void) static void DrawSaveMenu(void) { - MN_DrTextB("SAVE GAME", 160 - MN_TextBWidth("SAVE GAME") / 2, 10); + char *title; + + title = DEH_String("SAVE GAME"); + + MN_DrTextB(title, 160 - MN_TextBWidth(title) / 2, 10); if (!slottextloaded) { MN_LoadSlotText(); @@ -675,7 +687,7 @@ static void DrawFileSlots(Menu_t * menu) y = menu->y; for (i = 0; i < 6; i++) { - V_DrawPatch(x, y, W_CacheLumpName("M_FSLOT", PU_CACHE)); + V_DrawPatch(x, y, W_CacheLumpName(DEH_String("M_FSLOT"), PU_CACHE)); if (SlotStatus[i]) { MN_DrTextA(SlotText[i], x + 5, y + 5); @@ -796,11 +808,11 @@ static boolean SCMessages(int option) messageson ^= 1; if (messageson) { - P_SetMessage(&players[consoleplayer], "MESSAGES ON", true); + P_SetMessage(&players[consoleplayer], DEH_String("MESSAGES ON"), true); } else { - P_SetMessage(&players[consoleplayer], "MESSAGES OFF", true); + P_SetMessage(&players[consoleplayer], DEH_String("MESSAGES OFF"), true); } S_StartSound(NULL, sfx_chat); return true; @@ -1460,7 +1472,7 @@ boolean MN_Responder(event_t * event) if (CurrentMenu->items[i].text) { if (toupper(charTyped) - == toupper(CurrentMenu->items[i].text[0])) + == toupper(DEH_String(CurrentMenu->items[i].text)[0])) { CurrentItPos = i; return (true); @@ -1628,13 +1640,13 @@ static void DrawSlider(Menu_t * menu, int item, int width, int slot) x = menu->x + 24; y = menu->y + 2 + (item * ITEM_HEIGHT); - V_DrawPatch(x - 32, y, W_CacheLumpName("M_SLDLT", PU_CACHE)); + V_DrawPatch(x - 32, y, W_CacheLumpName(DEH_String("M_SLDLT"), PU_CACHE)); for (x2 = x, count = width; count--; x2 += 8) { - V_DrawPatch(x2, y, W_CacheLumpName(count & 1 ? "M_SLDMD1" - : "M_SLDMD2", PU_CACHE)); + V_DrawPatch(x2, y, W_CacheLumpName(DEH_String(count & 1 ? "M_SLDMD1" + : "M_SLDMD2"), PU_CACHE)); } - V_DrawPatch(x2, y, W_CacheLumpName("M_SLDRT", PU_CACHE)); + V_DrawPatch(x2, y, W_CacheLumpName(DEH_String("M_SLDRT"), PU_CACHE)); V_DrawPatch(x + 4 + slot * 8, y + 7, - W_CacheLumpName("M_SLDKB", PU_CACHE)); + W_CacheLumpName(DEH_String("M_SLDKB"), PU_CACHE)); } diff --git a/src/heretic/p_spec.c b/src/heretic/p_spec.c index 6227237b..49c067fa 100644 --- a/src/heretic/p_spec.c +++ b/src/heretic/p_spec.c @@ -25,6 +25,7 @@ // P_Spec.c #include "doomdef.h" +#include "deh_str.h" #include "i_system.h" #include "i_timer.h" #include "m_random.h" @@ -204,18 +205,12 @@ struct int type; } TerrainTypeDefs[] = { - { - "FLTWAWA1", FLOOR_WATER}, - { - "FLTFLWW1", FLOOR_WATER}, - { - "FLTLAVA1", FLOOR_LAVA}, - { - "FLATHUH1", FLOOR_LAVA}, - { - "FLTSLUD1", FLOOR_SLUDGE}, - { - "END", -1} + { "FLTWAWA1", FLOOR_WATER }, + { "FLTFLWW1", FLOOR_WATER }, + { "FLTLAVA1", FLOOR_LAVA }, + { "FLATHUH1", FLOOR_LAVA }, + { "FLTSLUD1", FLOOR_SLUDGE }, + { "END", -1 } }; mobj_t LavaInflictor; @@ -266,35 +261,40 @@ void P_InitTerrainTypes(void) void P_InitPicAnims(void) { + char *startname; + char *endname; int i; lastanim = anims; for (i = 0; animdefs[i].istexture != -1; i++) { + startname = DEH_String(animdefs[i].startname); + endname = DEH_String(animdefs[i].endname); + if (animdefs[i].istexture) { // Texture animation - if (R_CheckTextureNumForName(animdefs[i].startname) == -1) + if (R_CheckTextureNumForName(startname) == -1) { // Texture doesn't exist continue; } - lastanim->picnum = R_TextureNumForName(animdefs[i].endname); - lastanim->basepic = R_TextureNumForName(animdefs[i].startname); + lastanim->picnum = R_TextureNumForName(endname); + lastanim->basepic = R_TextureNumForName(startname); } else { // Flat animation - if (W_CheckNumForName(animdefs[i].startname) == -1) + if (W_CheckNumForName(startname) == -1) { // Flat doesn't exist continue; } - lastanim->picnum = R_FlatNumForName(animdefs[i].endname); - lastanim->basepic = R_FlatNumForName(animdefs[i].startname); + lastanim->picnum = R_FlatNumForName(endname); + lastanim->basepic = R_FlatNumForName(startname); } lastanim->istexture = animdefs[i].istexture; lastanim->numpics = lastanim->picnum - lastanim->basepic + 1; if (lastanim->numpics < 2) { I_Error("P_InitPicAnims: bad cycle from %s to %s", - animdefs[i].startname, animdefs[i].endname); + startname, endname); } lastanim->speed = animdefs[i].speed; lastanim++; @@ -1132,7 +1132,7 @@ void P_SpawnSpecials(void) int episode; episode = 1; - if (W_CheckNumForName("texture2") >= 0) + if (W_CheckNumForName(DEH_String("texture2")) >= 0) episode = 2; // diff --git a/src/heretic/p_switch.c b/src/heretic/p_switch.c index cef6a74b..2ec758b6 100644 --- a/src/heretic/p_switch.c +++ b/src/heretic/p_switch.c @@ -23,6 +23,7 @@ //----------------------------------------------------------------------------- #include "doomdef.h" +#include "deh_str.h" #include "i_system.h" #include "p_local.h" #include "s_sound.h" @@ -129,9 +130,9 @@ void P_InitSwitchList(void) if (alphSwitchList[i].episode <= episode) { switchlist[index++] = - R_TextureNumForName(alphSwitchList[i].name1); + R_TextureNumForName(DEH_String(alphSwitchList[i].name1)); switchlist[index++] = - R_TextureNumForName(alphSwitchList[i].name2); + R_TextureNumForName(DEH_String(alphSwitchList[i].name2)); } } } diff --git a/src/heretic/p_user.c b/src/heretic/p_user.c index 63368bab..16dbed49 100644 --- a/src/heretic/p_user.c +++ b/src/heretic/p_user.c @@ -27,6 +27,7 @@ #include #include "doomdef.h" +#include "deh_str.h" #include "m_random.h" #include "p_local.h" #include "s_sound.h" @@ -394,7 +395,7 @@ void P_DeathThink(player_t * player) { if (player == &players[consoleplayer]) { - I_SetPalette((byte *) W_CacheLumpName("PLAYPAL", PU_CACHE)); + I_SetPalette(W_CacheLumpName(DEH_String("PLAYPAL"), PU_CACHE)); inv_ptr = 0; curpos = 0; newtorch = 0; diff --git a/src/heretic/r_data.c b/src/heretic/r_data.c index ee005248..b55e6dfc 100644 --- a/src/heretic/r_data.c +++ b/src/heretic/r_data.c @@ -316,12 +316,17 @@ void R_InitTextures(void) int offset, maxoff, maxoff2; int numtextures1, numtextures2; int *directory; + char *texture1, *texture2, *pnames; + + texture1 = DEH_String("TEXTURE1"); + texture2 = DEH_String("TEXTURE2"); + pnames = DEH_String("PNAMES"); // // load the patch names from pnames.lmp // name[8] = 0; - names = W_CacheLumpName("PNAMES", PU_STATIC); + names = W_CacheLumpName(pnames, PU_STATIC); nummappatches = LONG(*((int *) names)); name_p = names + 4; patchlookup = Z_Malloc(nummappatches * sizeof(*patchlookup), PU_STATIC, NULL); @@ -330,21 +335,21 @@ void R_InitTextures(void) strncpy(name, name_p + i * 8, 8); patchlookup[i] = W_CheckNumForName(name); } - W_ReleaseLumpName("PNAMES"); + W_ReleaseLumpName(pnames); // // load the map texture definitions from textures.lmp // - maptex = maptex1 = W_CacheLumpName("TEXTURE1", PU_STATIC); + maptex = maptex1 = W_CacheLumpName(texture1, PU_STATIC); numtextures1 = LONG(*maptex); - maxoff = W_LumpLength(W_GetNumForName("TEXTURE1")); + maxoff = W_LumpLength(W_GetNumForName(texture1)); directory = maptex + 1; - if (W_CheckNumForName("TEXTURE2") != -1) + if (W_CheckNumForName(texture2) != -1) { - maptex2 = W_CacheLumpName("TEXTURE2", PU_STATIC); + maptex2 = W_CacheLumpName(texture2, PU_STATIC); numtextures2 = LONG(*maptex2); - maxoff2 = W_LumpLength(W_GetNumForName("TEXTURE2")); + maxoff2 = W_LumpLength(W_GetNumForName(texture2)); } else { @@ -358,8 +363,11 @@ void R_InitTextures(void) // Init the startup thermometer at this point... // { + int start, end; int spramount; - spramount = W_GetNumForName("S_END") - W_GetNumForName("S_START") + 1; + start = W_GetNumForName(DEH_String("S_START")); + end = W_GetNumForName(DEH_String("S_END")); + spramount = end - start + 1; InitThermo(spramount + numtextures + 6); } @@ -427,10 +435,10 @@ void R_InitTextures(void) Z_Free(patchlookup); - W_ReleaseLumpName("TEXTURE1"); + W_ReleaseLumpName(texture1); if (maptex2) { - W_ReleaseLumpName("TEXTURE2"); + W_ReleaseLumpName(texture2); } // @@ -463,8 +471,8 @@ void R_InitFlats(void) { int i; - firstflat = W_GetNumForName("F_START") + 1; - lastflat = W_GetNumForName("F_END") - 1; + firstflat = W_GetNumForName(DEH_String("F_START")) + 1; + lastflat = W_GetNumForName(DEH_String("F_END")) - 1; numflats = lastflat - firstflat + 1; // translation table for global animation @@ -489,8 +497,8 @@ void R_InitSpriteLumps(void) int i; patch_t *patch; - firstspritelump = W_GetNumForName("S_START") + 1; - lastspritelump = W_GetNumForName("S_END") - 1; + firstspritelump = W_GetNumForName(DEH_String("S_START")) + 1; + lastspritelump = W_GetNumForName(DEH_String("S_END")) - 1; numspritelumps = lastspritelump - firstspritelump + 1; spritewidth = Z_Malloc(numspritelumps * sizeof(fixed_t), PU_STATIC, 0); spriteoffset = Z_Malloc(numspritelumps * sizeof(fixed_t), PU_STATIC, 0); @@ -527,7 +535,7 @@ void R_InitColormaps(void) // load in the light tables // 256 byte align tables // - lump = W_GetNumForName("COLORMAP"); + lump = W_GetNumForName(DEH_String("COLORMAP")); length = W_LumpLength(lump); colormaps = Z_Malloc(length, PU_STATIC, 0); W_ReadLump(lump, colormaps); diff --git a/src/heretic/r_draw.c b/src/heretic/r_draw.c index 5a20b50a..88653df1 100644 --- a/src/heretic/r_draw.c +++ b/src/heretic/r_draw.c @@ -24,6 +24,7 @@ // R_draw.c #include "doomdef.h" +#include "deh_str.h" #include "r_local.h" #include "i_video.h" #include "v_video.h" @@ -386,11 +387,11 @@ void R_DrawViewBorder(void) if (gamemode == shareware) { - src = W_CacheLumpName("FLOOR04", PU_CACHE); + src = W_CacheLumpName(DEH_String("FLOOR04"), PU_CACHE); } else { - src = W_CacheLumpName("FLAT513", PU_CACHE); + src = W_CacheLumpName(DEH_String("FLAT513"), PU_CACHE); } dest = I_VideoBuffer; @@ -409,24 +410,26 @@ void R_DrawViewBorder(void) } for (x = viewwindowx; x < viewwindowx + viewwidth; x += 16) { - V_DrawPatch(x, viewwindowy - 4, W_CacheLumpName("bordt", PU_CACHE)); - V_DrawPatch(x, viewwindowy + viewheight, W_CacheLumpName("bordb", - PU_CACHE)); + V_DrawPatch(x, viewwindowy - 4, + W_CacheLumpName(DEH_String("bordt"), PU_CACHE)); + V_DrawPatch(x, viewwindowy + viewheight, + W_CacheLumpName(DEH_String("bordb"), PU_CACHE)); } for (y = viewwindowy; y < viewwindowy + viewheight; y += 16) { - V_DrawPatch(viewwindowx - 4, y, W_CacheLumpName("bordl", PU_CACHE)); - V_DrawPatch(viewwindowx + viewwidth, y, W_CacheLumpName("bordr", - PU_CACHE)); + V_DrawPatch(viewwindowx - 4, y, + W_CacheLumpName(DEH_String("bordl"), PU_CACHE)); + V_DrawPatch(viewwindowx + viewwidth, y, + W_CacheLumpName(DEH_String("bordr"), PU_CACHE)); } - V_DrawPatch(viewwindowx - 4, viewwindowy - 4, W_CacheLumpName("bordtl", - PU_CACHE)); + V_DrawPatch(viewwindowx - 4, viewwindowy - 4, + W_CacheLumpName(DEH_String("bordtl"), PU_CACHE)); V_DrawPatch(viewwindowx + viewwidth, viewwindowy - 4, - W_CacheLumpName("bordtr", PU_CACHE)); + W_CacheLumpName(DEH_String("bordtr"), PU_CACHE)); V_DrawPatch(viewwindowx + viewwidth, viewwindowy + viewheight, - W_CacheLumpName("bordbr", PU_CACHE)); + W_CacheLumpName(DEH_String("bordbr"), PU_CACHE)); V_DrawPatch(viewwindowx - 4, viewwindowy + viewheight, - W_CacheLumpName("bordbl", PU_CACHE)); + W_CacheLumpName(DEH_String("bordbl"), PU_CACHE)); } /* @@ -450,11 +453,11 @@ void R_DrawTopBorder(void) if (gamemode == shareware) { - src = W_CacheLumpName("FLOOR04", PU_CACHE); + src = W_CacheLumpName(DEH_String("FLOOR04"), PU_CACHE); } else { - src = W_CacheLumpName("FLAT513", PU_CACHE); + src = W_CacheLumpName(DEH_String("FLAT513"), PU_CACHE); } dest = I_VideoBuffer; @@ -476,20 +479,20 @@ void R_DrawTopBorder(void) for (x = viewwindowx; x < viewwindowx + viewwidth; x += 16) { V_DrawPatch(x, viewwindowy - 4, - W_CacheLumpName("bordt", PU_CACHE)); + W_CacheLumpName(DEH_String("bordt"), PU_CACHE)); } - V_DrawPatch(viewwindowx - 4, viewwindowy, W_CacheLumpName("bordl", - PU_CACHE)); + V_DrawPatch(viewwindowx - 4, viewwindowy, + W_CacheLumpName(DEH_String("bordl"), PU_CACHE)); V_DrawPatch(viewwindowx + viewwidth, viewwindowy, - W_CacheLumpName("bordr", PU_CACHE)); + W_CacheLumpName(DEH_String("bordr"), PU_CACHE)); V_DrawPatch(viewwindowx - 4, viewwindowy + 16, - W_CacheLumpName("bordl", PU_CACHE)); + W_CacheLumpName(DEH_String("bordl"), PU_CACHE)); V_DrawPatch(viewwindowx + viewwidth, viewwindowy + 16, - W_CacheLumpName("bordr", PU_CACHE)); + W_CacheLumpName(DEH_String("bordr"), PU_CACHE)); V_DrawPatch(viewwindowx - 4, viewwindowy - 4, - W_CacheLumpName("bordtl", PU_CACHE)); + W_CacheLumpName(DEH_String("bordtl"), PU_CACHE)); V_DrawPatch(viewwindowx + viewwidth, viewwindowy - 4, - W_CacheLumpName("bordtr", PU_CACHE)); + W_CacheLumpName(DEH_String("bordtr"), PU_CACHE)); } } diff --git a/src/heretic/r_plane.c b/src/heretic/r_plane.c index e35e2931..cc86b118 100644 --- a/src/heretic/r_plane.c +++ b/src/heretic/r_plane.c @@ -25,6 +25,7 @@ #include #include "doomdef.h" +#include "deh_str.h" #include "i_system.h" #include "r_local.h" @@ -90,7 +91,7 @@ fixed_t cachedystep[SCREENHEIGHT]; void R_InitSkyMap(void) { - skyflatnum = R_FlatNumForName("F_SKY1"); + skyflatnum = R_FlatNumForName(DEH_String("F_SKY1")); skytexturemid = 200 * FRACUNIT; skyiscale = FRACUNIT; } diff --git a/src/heretic/r_things.c b/src/heretic/r_things.c index 6302303e..e5ff4b4b 100644 --- a/src/heretic/r_things.c +++ b/src/heretic/r_things.c @@ -25,6 +25,7 @@ #include #include #include "doomdef.h" +#include "deh_str.h" #include "i_swap.h" #include "i_system.h" #include "r_local.h" @@ -154,7 +155,7 @@ void R_InstallSpriteLump(int lump, unsigned frame, unsigned rotation, void R_InitSpriteDefs(char **namelist) { char **check; - int i, l, intname, frame, rotation; + int i, l, frame, rotation; int start, end; // count the number of sprite names @@ -176,17 +177,16 @@ void R_InitSpriteDefs(char **namelist) // Just compare 4 characters as ints for (i = 0; i < numsprites; i++) { - spritename = namelist[i]; + spritename = DEH_String(namelist[i]); memset(sprtemp, -1, sizeof(sprtemp)); maxframe = -1; - intname = *(int *) namelist[i]; // // scan the lumps, filling in the frames for whatever is found // for (l = start + 1; l < end; l++) - if (*(int *) lumpinfo[l].name == intname) + if (!strncasecmp(lumpinfo[l].name, spritename, 4)) { frame = lumpinfo[l].name[4] - 'A'; rotation = lumpinfo[l].name[5] - '0'; @@ -209,7 +209,7 @@ void R_InitSpriteDefs(char **namelist) if (gamemode == shareware) continue; I_Error("R_InitSprites: No lumps found for sprite %s", - namelist[i]); + spritename); } maxframe++; @@ -219,7 +219,7 @@ void R_InitSpriteDefs(char **namelist) { case -1: // no rotations were found for that frame at all I_Error("R_InitSprites: No patches found for %s frame %c", - namelist[i], frame + 'A'); + spritename, frame + 'A'); case 0: // only the first rotation is needed break; @@ -228,7 +228,7 @@ void R_InitSpriteDefs(char **namelist) if (sprtemp[frame].lump[rotation] == -1) I_Error ("R_InitSprites: Sprite %s frame %c is missing rotations", - namelist[i], frame + 'A'); + spritename, frame + 'A'); } } diff --git a/src/heretic/sb_bar.c b/src/heretic/sb_bar.c index 77bd40c2..3a90c000 100644 --- a/src/heretic/sb_bar.c +++ b/src/heretic/sb_bar.c @@ -25,6 +25,7 @@ // SB_bar.c #include "doomdef.h" +#include "deh_str.h" #include "i_video.h" #include "m_cheat.h" #include "m_misc.h" @@ -196,53 +197,53 @@ void SB_Init(void) int i; int startLump; - PatchLTFACE = W_CacheLumpName("LTFACE", PU_STATIC); - PatchRTFACE = W_CacheLumpName("RTFACE", PU_STATIC); - PatchBARBACK = W_CacheLumpName("BARBACK", PU_STATIC); - PatchINVBAR = W_CacheLumpName("INVBAR", PU_STATIC); - PatchCHAIN = W_CacheLumpName("CHAIN", PU_STATIC); + PatchLTFACE = W_CacheLumpName(DEH_String("LTFACE"), PU_STATIC); + PatchRTFACE = W_CacheLumpName(DEH_String("RTFACE"), PU_STATIC); + PatchBARBACK = W_CacheLumpName(DEH_String("BARBACK"), PU_STATIC); + PatchINVBAR = W_CacheLumpName(DEH_String("INVBAR"), PU_STATIC); + PatchCHAIN = W_CacheLumpName(DEH_String("CHAIN"), PU_STATIC); if (deathmatch) { - PatchSTATBAR = W_CacheLumpName("STATBAR", PU_STATIC); + PatchSTATBAR = W_CacheLumpName(DEH_String("STATBAR"), PU_STATIC); } else { - PatchSTATBAR = W_CacheLumpName("LIFEBAR", PU_STATIC); + PatchSTATBAR = W_CacheLumpName(DEH_String("LIFEBAR"), PU_STATIC); } if (!netgame) { // single player game uses red life gem - PatchLIFEGEM = W_CacheLumpName("LIFEGEM2", PU_STATIC); + PatchLIFEGEM = W_CacheLumpName(DEH_String("LIFEGEM2"), PU_STATIC); } else { - PatchLIFEGEM = W_CacheLumpNum(W_GetNumForName("LIFEGEM0") + PatchLIFEGEM = W_CacheLumpNum(W_GetNumForName(DEH_String("LIFEGEM0")) + consoleplayer, PU_STATIC); } - PatchLTFCTOP = W_CacheLumpName("LTFCTOP", PU_STATIC); - PatchRTFCTOP = W_CacheLumpName("RTFCTOP", PU_STATIC); - PatchSELECTBOX = W_CacheLumpName("SELECTBOX", PU_STATIC); - PatchINVLFGEM1 = W_CacheLumpName("INVGEML1", PU_STATIC); - PatchINVLFGEM2 = W_CacheLumpName("INVGEML2", PU_STATIC); - PatchINVRTGEM1 = W_CacheLumpName("INVGEMR1", PU_STATIC); - PatchINVRTGEM2 = W_CacheLumpName("INVGEMR2", PU_STATIC); - PatchBLACKSQ = W_CacheLumpName("BLACKSQ", PU_STATIC); - PatchARMCLEAR = W_CacheLumpName("ARMCLEAR", PU_STATIC); - PatchCHAINBACK = W_CacheLumpName("CHAINBACK", PU_STATIC); - startLump = W_GetNumForName("IN0"); + PatchLTFCTOP = W_CacheLumpName(DEH_String("LTFCTOP"), PU_STATIC); + PatchRTFCTOP = W_CacheLumpName(DEH_String("RTFCTOP"), PU_STATIC); + PatchSELECTBOX = W_CacheLumpName(DEH_String("SELECTBOX"), PU_STATIC); + PatchINVLFGEM1 = W_CacheLumpName(DEH_String("INVGEML1"), PU_STATIC); + PatchINVLFGEM2 = W_CacheLumpName(DEH_String("INVGEML2"), PU_STATIC); + PatchINVRTGEM1 = W_CacheLumpName(DEH_String("INVGEMR1"), PU_STATIC); + PatchINVRTGEM2 = W_CacheLumpName(DEH_String("INVGEMR2"), PU_STATIC); + PatchBLACKSQ = W_CacheLumpName(DEH_String("BLACKSQ"), PU_STATIC); + PatchARMCLEAR = W_CacheLumpName(DEH_String("ARMCLEAR"), PU_STATIC); + PatchCHAINBACK = W_CacheLumpName(DEH_String("CHAINBACK"), PU_STATIC); + startLump = W_GetNumForName(DEH_String("IN0")); for (i = 0; i < 10; i++) { PatchINumbers[i] = W_CacheLumpNum(startLump + i, PU_STATIC); } - PatchNEGATIVE = W_CacheLumpName("NEGNUM", PU_STATIC); - FontBNumBase = W_GetNumForName("FONTB16"); - startLump = W_GetNumForName("SMALLIN0"); + PatchNEGATIVE = W_CacheLumpName(DEH_String("NEGNUM"), PU_STATIC); + FontBNumBase = W_GetNumForName(DEH_String("FONTB16")); + startLump = W_GetNumForName(DEH_String("SMALLIN0")); for (i = 0; i < 10; i++) { PatchSmNumbers[i] = W_CacheLumpNum(startLump + i, PU_STATIC); } - playpalette = W_GetNumForName("PLAYPAL"); - spinbooklump = W_GetNumForName("SPINBK0"); - spinflylump = W_GetNumForName("SPFLY0"); + playpalette = W_GetNumForName(DEH_String("PLAYPAL")); + spinbooklump = W_GetNumForName(DEH_String("SPINBK0")); + spinflylump = W_GetNumForName(DEH_String("SPFLY0")); } //--------------------------------------------------------------------------- @@ -311,7 +312,7 @@ static void DrINumber(signed int val, int x, int y) { if (val < -9) { - V_DrawPatch(x + 1, y + 1, W_CacheLumpName("LAME", PU_CACHE)); + V_DrawPatch(x + 1, y + 1, W_CacheLumpName(DEH_String("LAME"), PU_CACHE)); } else { @@ -458,7 +459,7 @@ static void DrawSoundInfo(void) if (leveltime & 16) { - MN_DrTextA("*** SOUND DEBUG INFO ***", xPos[0], 20); + MN_DrTextA(DEH_String("*** SOUND DEBUG INFO ***"), xPos[0], 20); } S_GetChannelInfo(&s); if (s.channelCount == 0) @@ -466,13 +467,13 @@ static void DrawSoundInfo(void) return; } x = 0; - MN_DrTextA("NAME", xPos[x++], 30); - MN_DrTextA("MO.T", xPos[x++], 30); - MN_DrTextA("MO.X", xPos[x++], 30); - MN_DrTextA("MO.Y", xPos[x++], 30); - MN_DrTextA("ID", xPos[x++], 30); - MN_DrTextA("PRI", xPos[x++], 30); - MN_DrTextA("DIST", xPos[x++], 30); + MN_DrTextA(DEH_String("NAME"), xPos[x++], 30); + MN_DrTextA(DEH_String("MO.T"), xPos[x++], 30); + MN_DrTextA(DEH_String("MO.X"), xPos[x++], 30); + MN_DrTextA(DEH_String("MO.Y"), xPos[x++], 30); + MN_DrTextA(DEH_String("ID"), xPos[x++], 30); + MN_DrTextA(DEH_String("PRI"), xPos[x++], 30); + MN_DrTextA(DEH_String("DIST"), xPos[x++], 30); for (i = 0; i < s.channelCount; i++) { c = &s.chan[i]; @@ -480,7 +481,7 @@ static void DrawSoundInfo(void) y = 40 + i * 10; if (c->mo == NULL) { // Channel is unused - MN_DrTextA("------", xPos[0], y); + MN_DrTextA(DEH_String("------"), xPos[0], y); continue; } sprintf(text, "%s", c->name); @@ -570,8 +571,10 @@ void SB_Drawer(void) V_DrawPatch(0, 158, PatchBARBACK); if (players[consoleplayer].cheats & CF_GODMODE) { - V_DrawPatch(16, 167, W_CacheLumpName("GOD1", PU_CACHE)); - V_DrawPatch(287, 167, W_CacheLumpName("GOD2", PU_CACHE)); + V_DrawPatch(16, 167, + W_CacheLumpName(DEH_String("GOD1"), PU_CACHE)); + V_DrawPatch(287, 167, + W_CacheLumpName(DEH_String("GOD2"), PU_CACHE)); } oldhealth = -1; } @@ -776,8 +779,10 @@ void DrawMainBar(void) if (ArtifactFlash) { V_DrawPatch(180, 161, PatchBLACKSQ); - V_DrawPatch(182, 161, W_CacheLumpNum(W_GetNumForName("useartia") - + ArtifactFlash - 1, PU_CACHE)); + + temp = W_GetNumForName(DEH_String("useartia")) + ArtifactFlash - 1; + + V_DrawPatch(182, 161, W_CacheLumpNum(temp, PU_CACHE)); ArtifactFlash--; oldarti = -1; // so that the correct artifact fills in after the flash UpdateState |= I_STATBAR; @@ -789,7 +794,7 @@ void DrawMainBar(void) if (CPlayer->readyArtifact > 0) { V_DrawPatch(179, 160, - W_CacheLumpName(patcharti[CPlayer->readyArtifact], + W_CacheLumpName(DEH_String(patcharti[CPlayer->readyArtifact]), PU_CACHE)); DrSmallNumber(CPlayer->inventory[inv_ptr].count, 201, 182); } @@ -839,15 +844,15 @@ void DrawMainBar(void) { if (CPlayer->keys[key_yellow]) { - V_DrawPatch(153, 164, W_CacheLumpName("ykeyicon", PU_CACHE)); + V_DrawPatch(153, 164, W_CacheLumpName(DEH_String("ykeyicon"), PU_CACHE)); } if (CPlayer->keys[key_green]) { - V_DrawPatch(153, 172, W_CacheLumpName("gkeyicon", PU_CACHE)); + V_DrawPatch(153, 172, W_CacheLumpName(DEH_String("gkeyicon"), PU_CACHE)); } if (CPlayer->keys[key_blue]) { - V_DrawPatch(153, 180, W_CacheLumpName("bkeyicon", PU_CACHE)); + V_DrawPatch(153, 180, W_CacheLumpName(DEH_String("bkeyicon"), PU_CACHE)); } oldkeys = playerkeys; UpdateState |= I_STATBAR; @@ -861,7 +866,7 @@ void DrawMainBar(void) { DrINumber(temp, 109, 162); V_DrawPatch(111, 172, - W_CacheLumpName(ammopic[CPlayer->readyweapon - 1], + W_CacheLumpName(DEH_String(ammopic[CPlayer->readyweapon - 1]), PU_CACHE)); } oldammo = temp; @@ -887,6 +892,7 @@ void DrawMainBar(void) void DrawInventoryBar(void) { + char *patch; int i; int x; @@ -899,10 +905,9 @@ void DrawInventoryBar(void) if (CPlayer->inventorySlotNum > x + i && CPlayer->inventory[x + i].type != arti_none) { - V_DrawPatch(50 + i * 31, 160, - W_CacheLumpName(patcharti - [CPlayer->inventory[x + i].type], - PU_CACHE)); + patch = DEH_String(patcharti[CPlayer->inventory[x + i].type]); + + V_DrawPatch(50 + i * 31, 160, W_CacheLumpName(patch, PU_CACHE)); DrSmallNumber(CPlayer->inventory[x + i].count, 69 + i * 31, 182); } } @@ -921,6 +926,7 @@ void DrawInventoryBar(void) void DrawFullScreenStuff(void) { + char *patch; int i; int x; int temp; @@ -950,10 +956,9 @@ void DrawFullScreenStuff(void) { if (CPlayer->readyArtifact > 0) { - V_DrawTLPatch(286, 170, W_CacheLumpName("ARTIBOX", PU_CACHE)); - V_DrawPatch(286, 170, - W_CacheLumpName(patcharti[CPlayer->readyArtifact], - PU_CACHE)); + patch = DEH_String(patcharti[CPlayer->readyArtifact]); + V_DrawTLPatch(286, 170, W_CacheLumpName(DEH_String("ARTIBOX"), PU_CACHE)); + V_DrawPatch(286, 170, W_CacheLumpName(patch, PU_CACHE)); DrSmallNumber(CPlayer->inventory[inv_ptr].count, 307, 192); } } @@ -962,15 +967,14 @@ void DrawFullScreenStuff(void) x = inv_ptr - curpos; for (i = 0; i < 7; i++) { - V_DrawTLPatch(50 + i * 31, 168, W_CacheLumpName("ARTIBOX", - PU_CACHE)); + V_DrawTLPatch(50 + i * 31, 168, + W_CacheLumpName(DEH_String("ARTIBOX"), PU_CACHE)); if (CPlayer->inventorySlotNum > x + i && CPlayer->inventory[x + i].type != arti_none) { + patch = DEH_String(patcharti[CPlayer->inventory[x + i].type]); V_DrawPatch(50 + i * 31, 168, - W_CacheLumpName(patcharti - [CPlayer->inventory[x + i].type], - PU_CACHE)); + W_CacheLumpName(patch, PU_CACHE)); DrSmallNumber(CPlayer->inventory[x + i].count, 69 + i * 31, 190); } -- cgit v1.2.3 From d76bed743c72bfccf5cbbc18dcd9cdb1e75935b3 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 18 Apr 2010 14:30:06 +0000 Subject: Add some DEH_String() calls where appropriate. Subversion-branch: /branches/raven-branch Subversion-revision: 1894 --- src/heretic/in_lude.c | 6 +++--- src/heretic/mn_menu.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/heretic') diff --git a/src/heretic/in_lude.c b/src/heretic/in_lude.c index 084cd5c3..3c382814 100644 --- a/src/heretic/in_lude.c +++ b/src/heretic/in_lude.c @@ -850,7 +850,7 @@ void IN_DrawDMStats(void) MN_DrTextA(DEH_String("VICTIMS"), 140, 8); for (i = 0; i < 7; i++) { - MN_DrTextA(KillersText[i], 10, 80 + 9 * i); + MN_DrTextA(DEH_String(KillersText[i]), 10, 80 + 9 * i); } if (intertime < 20) { @@ -941,7 +941,7 @@ void IN_DrawTime(int x, int y, int h, int m, int s) if (h) { IN_DrawNumber(h, x, y, 2); - IN_DrTextB(":", x + 26, y); + IN_DrTextB(DEH_String(":"), x + 26, y); } x += 34; if (m || h) @@ -951,7 +951,7 @@ void IN_DrawTime(int x, int y, int h, int m, int s) x += 34; if (s) { - IN_DrTextB(":", x - 8, y); + IN_DrTextB(DEH_String(":"), x - 8, y); IN_DrawNumber(s, x, y, 2); } } diff --git a/src/heretic/mn_menu.c b/src/heretic/mn_menu.c index 2b380234..955e0124 100644 --- a/src/heretic/mn_menu.c +++ b/src/heretic/mn_menu.c @@ -492,14 +492,14 @@ void MN_Drawer(void) { MN_DrTextA(SlotText[quicksave - 1], 160 - MN_TextAWidth(SlotText[quicksave - 1]) / 2, 90); - MN_DrTextA("?", 160 + + MN_DrTextA(DEH_String("?"), 160 + MN_TextAWidth(SlotText[quicksave - 1]) / 2, 90); } if (typeofask == 4) { MN_DrTextA(SlotText[quickload - 1], 160 - MN_TextAWidth(SlotText[quickload - 1]) / 2, 90); - MN_DrTextA("?", 160 + + MN_DrTextA(DEH_String("?"), 160 + MN_TextAWidth(SlotText[quickload - 1]) / 2, 90); } UpdateState |= I_FULLSCRN; @@ -706,11 +706,11 @@ static void DrawOptionsMenu(void) { if (messageson) { - MN_DrTextB("ON", 196, 50); + MN_DrTextB(DEH_String("ON"), 196, 50); } else { - MN_DrTextB("OFF", 196, 50); + MN_DrTextB(DEH_String("OFF"), 196, 50); } DrawSlider(&OptionsMenu, 3, 10, mouseSensitivity); } -- cgit v1.2.3 From 53ba7baf5191bb16ccfaa2aafd81f11cb210ecca Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 18 Apr 2010 14:51:28 +0000 Subject: Add deh_hhe_version variable to specify version of executable used to generate HHE patch. Refine DEH_MapHereticFrameNumber based on patch version. Subversion-branch: /branches/raven-branch Subversion-revision: 1895 --- src/heretic/deh_htic.c | 38 +++++++++++++++++++++++++++++--------- src/heretic/deh_htic.h | 13 +++++++++++++ 2 files changed, 42 insertions(+), 9 deletions(-) (limited to 'src/heretic') diff --git a/src/heretic/deh_htic.c b/src/heretic/deh_htic.c index 59c426ef..ff5d02ac 100644 --- a/src/heretic/deh_htic.c +++ b/src/heretic/deh_htic.c @@ -27,6 +27,7 @@ #include #include "deh_defs.h" #include "deh_main.h" +#include "deh_htic.h" #include "info.h" char *deh_signatures[] = @@ -36,6 +37,10 @@ char *deh_signatures[] = NULL }; +// Version number for patches. + +deh_hhe_version_t deh_hhe_version = deh_hhe_1_0; + // deh_ammo.c: extern deh_section_t deh_section_ammo; // deh_frame.c: @@ -67,18 +72,33 @@ deh_section_t *deh_section_types[] = NULL }; -// HHE only worked with Heretic 1.0 and unfortunately was never updated -// to support Heretic 1.3. Between Heretic 1.0 and 1.3, two new frames -// were added to the "states" table, to extend the "flame death" -// animation displayed when the player is killed by fire. Therefore, -// we must map the HHE frame numbers (which assume a Heretic 1.0 frame -// table) to corresponding indexes for the Heretic 1.3 frame table. - int DEH_MapHereticFrameNumber(int frame) { - if (frame >= S_PLAY_FDTH19) + if (deh_hhe_version < deh_hhe_1_0) { - frame = (frame - S_PLAY_FDTH19) + S_BLOODYSKULL1; + // Between Heretic 1.0 and 1.2, two new frames + // were added to the "states" table, to extend the "flame death" + // animation displayed when the player is killed by fire. Therefore, + // we must map Heretic 1.0 frame numbers to corresponding indexes + // for our state table. + + if (frame >= S_PLAY_FDTH19) + { + frame = (frame - S_PLAY_FDTH19) + S_BLOODYSKULL1; + } + } + else + { + // After Heretic 1.2, three unused frames were removed from the + // states table, unused phoenix rod frames. Our state table includes + // these missing states for backwards compatibility. We must therefore + // adjust frame numbers for v1.2/v1.3 to corresponding indexes for + // our state table. + + if (frame >= S_PHOENIXFXIX_1) + { + frame = (frame - S_PHOENIXFXIX_1) + S_PHOENIXPUFF1; + } } return frame; diff --git a/src/heretic/deh_htic.h b/src/heretic/deh_htic.h index fefcf818..199ad2fe 100644 --- a/src/heretic/deh_htic.h +++ b/src/heretic/deh_htic.h @@ -29,6 +29,17 @@ #include "info.h" +// HHE executable version. Loading HHE patches is (unfortunately) +// dependent on the version of the Heretic executable used to make them. + +typedef enum +{ + deh_hhe_1_0, + deh_hhe_1_2, + deh_hhe_1_3, + deh_hhe_num_versions +} deh_hhe_version_t; + // HHE doesn't know about the last two states in the state table, so // these are considered invalid. @@ -41,5 +52,7 @@ int DEH_MapHereticFrameNumber(int frame); +extern deh_hhe_version_t deh_hhe_version; + #endif /* #ifndef DEH_HTIC_H */ -- cgit v1.2.3 From bc4a39b2fe3f0883a7826fa998de6ea9825efada Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 18 Apr 2010 14:52:43 +0000 Subject: Add new action pointer lookup table, and find offset based on patch executable version. Subversion-branch: /branches/raven-branch Subversion-revision: 1897 --- src/heretic/deh_frame.c | 270 ++++++++++++++++++++++++------------------------ 1 file changed, 136 insertions(+), 134 deletions(-) (limited to 'src/heretic') diff --git a/src/heretic/deh_frame.c b/src/heretic/deh_frame.c index 6ec62ae7..8d9a8fdf 100644 --- a/src/heretic/deh_frame.c +++ b/src/heretic/deh_frame.c @@ -38,141 +38,143 @@ #include "p_action.h" +typedef struct +{ + int offsets[deh_hhe_num_versions]; + void (*func)(); +} hhe_action_pointer_t; + // Offsets of action pointers within the Heretic 1.0 executable. // (Seriously Greg, was this really necessary? What was wrong with the // "copying action pointer from another frame" technique used in dehacked?) -static const struct -{ - int offset; - void (*func)(); -} action_ptrs[] = { - { 0, NULL }, - { 69200, A_Look }, - { 69328, A_Chase }, - { 69872, A_FaceTarget }, - { 69984, A_Pain }, - { 70016, A_DripBlood }, - { 70160, A_KnightAttack }, - { 70304, A_ImpExplode }, - { 70480, A_BeastPuff }, - { 70592, A_ImpMeAttack }, - { 70672, A_ImpMsAttack }, - { 70880, A_ImpMsAttack2 }, - { 70976, A_ImpDeath }, - { 71024, A_ImpXDeath1 }, - { 71072, A_ImpXDeath2 }, - { 71376, A_ChicAttack }, - { 71456, A_ChicLook }, - { 71488, A_ChicChase }, - { 71520, A_ChicPain }, - { 71568, A_Feathers }, - { 71808, A_MummyAttack }, - { 71920, A_MummyAttack2 }, - { 72016, A_MummyFX1Seek }, - { 72048, A_MummySoul }, - { 72096, A_Sor1Pain }, - { 72144, A_Sor1Chase }, - { 72192, A_Srcr1Attack }, - { 72480, A_SorcererRise }, - { 72816, A_Srcr2Decide }, - { 72896, A_Srcr2Attack }, - { 73120, A_BlueSpark }, - { 73232, A_GenWizard }, - { 73392, A_Sor2DthInit }, - { 73424, A_Sor2DthLoop }, - { 73456, A_SorZap }, - { 73488, A_SorRise }, - { 73520, A_SorDSph }, - { 73552, A_SorDExp }, - { 73584, A_SorDBon }, - { 73616, A_SorSightSnd }, - { 73648, A_MinotaurAtk1 }, - { 73760, A_MinotaurDecide }, - { 74032, A_MinotaurCharge }, - { 74112, A_MinotaurAtk2 }, - { 74352, A_MinotaurAtk3 }, - { 74528, A_MntrFloorFire }, - { 74640, A_BeastAttack }, - { 74752, A_HeadAttack }, - { 75168, A_WhirlwindSeek }, - { 75328, A_HeadIceImpact }, - { 75488, A_HeadFireGrow }, - { 75632, A_SnakeAttack }, - { 75712, A_SnakeAttack2 }, - { 75792, A_ClinkAttack }, - { 75872, A_GhostOff }, - { 75888, A_WizAtk1 }, - { 75920, A_WizAtk2 }, - { 75952, A_WizAtk3 }, - { 76144, A_Scream }, - { 76400, A_NoBlocking }, - { 76784, A_Explode }, - { 76896, A_PodPain }, - { 77056, A_RemovePod }, - { 77104, A_MakePod }, - { 77344, A_BossDeath }, - { 77472, A_ESound }, - { 77520, A_SpawnTeleGlitter }, - { 77600, A_SpawnTeleGlitter2 }, - { 77680, A_AccTeleGlitter }, - { 77728, A_InitKeyGizmo }, - { 77824, A_VolcanoSet }, - { 77856, A_VolcanoBlast }, - { 78080, A_VolcBallImpact }, - { 78288, A_SkullPop }, - { 78448, A_CheckSkullFloor }, - { 78480, A_CheckSkullDone }, - { 78512, A_FreeTargMobj }, - { 78608, A_AddPlayerCorpse }, - { 78704, A_FlameSnd }, - { 78736, A_HideThing }, - { 78752, A_UnHideThing }, - { 81952, A_RestoreArtifact }, - { 82048, A_RestoreSpecialThing1 }, - { 82128, A_RestoreSpecialThing2 }, - { 108432, A_ContMobjSound }, - { 111168, A_WeaponReady }, - { 111568, A_BeakReady }, - { 111696, A_ReFire }, - { 111760, A_Lower }, - { 111856, A_BeakRaise }, - { 111920, A_Raise }, - { 112272, A_BeakAttackPL1 }, - { 112448, A_BeakAttackPL2 }, - { 112640, A_StaffAttackPL1 }, - { 112784, A_StaffAttackPL2 }, - { 112928, A_FireBlasterPL1 }, - { 113072, A_FireBlasterPL2 }, - { 113152, A_FireGoldWandPL1 }, - { 113296, A_FireGoldWandPL2 }, - { 113760, A_FireMacePL1 }, - { 113904, A_MacePL1Check }, - { 114032, A_MaceBallImpact }, - { 114192, A_MaceBallImpact2 }, - { 114624, A_FireMacePL2 }, - { 114752, A_DeathBallImpact }, - { 115088, A_SpawnRippers }, - { 115232, A_FireCrossbowPL1 }, - { 115312, A_FireCrossbowPL2 }, - { 115456, A_BoltSpark }, - { 115568, A_FireSkullRodPL1 }, - { 115648, A_FireSkullRodPL2 }, - { 115776, A_SkullRodPL2Seek }, - { 115808, A_AddPlayerRain }, - { 115984, A_SkullRodStorm }, - { 116272, A_RainImpact }, - { 116336, A_HideInCeiling }, - { 116368, A_FirePhoenixPL1 }, - { 116480, A_RemovedPhoenixFunc }, - { 116496, A_PhoenixPuff }, - { 116720, A_InitPhoenixPL2 }, - { 116736, A_FirePhoenixPL2 }, - { 117104, A_ShutdownPhoenixPL2 }, - { 117120, A_FlameEnd }, - { 117152, A_FloatPuff }, - { 117184, A_GauntletAttack }, - { 117648, A_Light0 } +static hhe_action_pointer_t action_pointers[] = { + { { 77680, 80144, 80208 }, A_AccTeleGlitter }, + { { 78608, 81104, 81168 }, A_AddPlayerCorpse }, + { { 115808, 118000, 118240 }, A_AddPlayerRain }, + { { 112272, 114480, 114720 }, A_BeakAttackPL1 }, + { { 112448, 114656, 114896 }, A_BeakAttackPL2 }, + { { 111856, 114176, 114416 }, A_BeakRaise }, + { { 111568, 113888, 114128 }, A_BeakReady }, + { { 74640, 77120, 77184 }, A_BeastAttack }, + { { 70480, 72992, 73056 }, A_BeastPuff }, + { { 73120, 75600, 75664 }, A_BlueSpark }, + { { 115456, 117648, 117888 }, A_BoltSpark }, + { { 77344, 79808, 79872 }, A_BossDeath }, + { { 69328, 71856, 71920 }, A_Chase }, + { { 0, 80976, 81040 }, A_CheckBurnGone }, + { { 78480, 80944, 81008 }, A_CheckSkullDone }, + { { 78448, 80912, 80976 }, A_CheckSkullFloor }, + { { 71376, 73888, 73952 }, A_ChicAttack }, + { { 71488, 74000, 74064 }, A_ChicChase }, + { { 71456, 73968, 74032 }, A_ChicLook }, + { { 71520, 74032, 74096 }, A_ChicPain }, + { { 75792, 78208, 78272 }, A_ClinkAttack }, + { { 108432, 110816, 111056 }, A_ContMobjSound }, + { { 114752, 116944, 117184 }, A_DeathBallImpact }, + { { 70016, 72528, 72592 }, A_DripBlood }, + { { 77472, 79936, 80000 }, A_ESound }, + { { 76784, 79248, 79312 }, A_Explode }, + { { 69872, 72400, 72464 }, A_FaceTarget }, + { { 71568, 74080, 74144 }, A_Feathers }, + { { 112928, 115136, 115376 }, A_FireBlasterPL1 }, + { { 113072, 115280, 115520 }, A_FireBlasterPL2 }, + { { 115232, 117424, 117664 }, A_FireCrossbowPL1 }, + { { 115312, 117504, 117744 }, A_FireCrossbowPL2 }, + { { 113152, 115360, 115600 }, A_FireGoldWandPL1 }, + { { 113296, 115504, 115744 }, A_FireGoldWandPL2 }, + { { 113760, 115968, 116208 }, A_FireMacePL1 }, + { { 114624, 116816, 117056 }, A_FireMacePL2 }, + { { 116368, 118544, 118784 }, A_FirePhoenixPL1 }, + { { 116736, 118896, 119136 }, A_FirePhoenixPL2 }, + { { 115568, 117760, 118000 }, A_FireSkullRodPL1 }, + { { 115648, 117840, 118080 }, A_FireSkullRodPL2 }, + { { 117120, 119280, 119520 }, A_FlameEnd }, + { { 78704, 81200, 81264 }, A_FlameSnd }, + { { 117152, 119312, 119552 }, A_FloatPuff }, + { { 78512, 81008, 81072 }, A_FreeTargMobj }, + { { 117184, 119344, 119584 }, A_GauntletAttack }, + { { 73232, 75712, 75776 }, A_GenWizard }, + { { 75872, 78304, 78368 }, A_GhostOff }, + { { 74752, 77232, 77296 }, A_HeadAttack }, + { { 75488, 77984, 78048 }, A_HeadFireGrow }, + { { 75328, 77824, 77888 }, A_HeadIceImpact }, + { { 116336, 118512, 118752 }, A_HideInCeiling }, + { { 78736, 81232, 81296 }, A_HideThing }, + { { 70976, 73488, 73552 }, A_ImpDeath }, + { { 70304, 72816, 72880 }, A_ImpExplode }, + { { 70592, 73104, 73168 }, A_ImpMeAttack }, + { { 70672, 73184, 73248 }, A_ImpMsAttack }, + { { 70880, 73392, 73456 }, A_ImpMsAttack2 }, + { { 71024, 73536, 73600 }, A_ImpXDeath1 }, + { { 71072, 73584, 73648 }, A_ImpXDeath2 }, + { { 77728, 80192, 80256 }, A_InitKeyGizmo }, + { { 116720, 118880, 119120 }, A_InitPhoenixPL2 }, + { { 70160, 72672, 72736 }, A_KnightAttack }, + { { 117648, 119824, 120064 }, A_Light0 }, + { { 69200, 71728, 71792 }, A_Look }, + { { 111760, 114080, 114320 }, A_Lower }, + { { 114032, 116224, 116464 }, A_MaceBallImpact }, + { { 114192, 116384, 116624 }, A_MaceBallImpact2 }, + { { 113904, 116112, 116352 }, A_MacePL1Check }, + { { 77104, 79568, 79632 }, A_MakePod }, + { { 73648, 76128, 76192 }, A_MinotaurAtk1 }, + { { 74112, 76592, 76656 }, A_MinotaurAtk2 }, + { { 74352, 76832, 76896 }, A_MinotaurAtk3 }, + { { 74032, 76512, 76576 }, A_MinotaurCharge }, + { { 73760, 76240, 76304 }, A_MinotaurDecide }, + { { 74528, 77008, 77072 }, A_MntrFloorFire }, + { { 71808, 74288, 74352 }, A_MummyAttack }, + { { 71920, 74400, 74464 }, A_MummyAttack2 }, + { { 72016, 74496, 74560 }, A_MummyFX1Seek }, + { { 72048, 74528, 74592 }, A_MummySoul }, + { { 76400, 78832, 78896 }, A_NoBlocking }, + { { 69984, 72496, 72560 }, A_Pain }, + { { 116496, 118656, 118896 }, A_PhoenixPuff }, + { { 76896, 79360, 79424 }, A_PodPain }, + { { 116272, 118448, 118688 }, A_RainImpact }, + { { 111920, 114240, 114480 }, A_Raise }, + { { 111696, 114016, 114256 }, A_ReFire }, + { { 77056, 79520, 79584 }, A_RemovePod }, + { { 116480, 0, 0 }, A_RemovedPhoenixFunc }, + { { 81952, 84464, 84528 }, A_RestoreArtifact }, + { { 82048, 84544, 84608 }, A_RestoreSpecialThing1 }, + { { 82128, 84592, 84656 }, A_RestoreSpecialThing2 }, + { { 76144, 78576, 78640 }, A_Scream }, + { { 117104, 119264, 119504 }, A_ShutdownPhoenixPL2 }, + { { 78288, 80752, 80816 }, A_SkullPop }, + { { 115776, 117968, 118208 }, A_SkullRodPL2Seek }, + { { 115984, 118176, 118416 }, A_SkullRodStorm }, + { { 75632, 78048, 78112 }, A_SnakeAttack }, + { { 75712, 78128, 78192 }, A_SnakeAttack2 }, + { { 72144, 74624, 74688 }, A_Sor1Chase }, + { { 72096, 74576, 74640 }, A_Sor1Pain }, + { { 73392, 75872, 75936 }, A_Sor2DthInit }, + { { 73424, 75904, 75968 }, A_Sor2DthLoop }, + { { 73584, 76064, 76128 }, A_SorDBon }, + { { 73552, 76032, 76096 }, A_SorDExp }, + { { 73520, 76000, 76064 }, A_SorDSph }, + { { 73488, 75968, 76032 }, A_SorRise }, + { { 73616, 76096, 76160 }, A_SorSightSnd }, + { { 73456, 75936, 76000 }, A_SorZap }, + { { 72480, 74960, 75024 }, A_SorcererRise }, + { { 115088, 117280, 117520 }, A_SpawnRippers }, + { { 77520, 79984, 80048 }, A_SpawnTeleGlitter }, + { { 77600, 80064, 80128 }, A_SpawnTeleGlitter2 }, + { { 72192, 74672, 74736 }, A_Srcr1Attack }, + { { 72896, 75376, 75440 }, A_Srcr2Attack }, + { { 72816, 75296, 75360 }, A_Srcr2Decide }, + { { 112640, 114848, 115088 }, A_StaffAttackPL1 }, + { { 112784, 114992, 115232 }, A_StaffAttackPL2 }, + { { 78752, 81248, 81312 }, A_UnHideThing }, + { { 78080, 80544, 80608 }, A_VolcBallImpact }, + { { 77856, 80320, 80384 }, A_VolcanoBlast }, + { { 77824, 80288, 80352 }, A_VolcanoSet }, + { { 111168, 113488, 113728 }, A_WeaponReady }, + { { 75168, 77664, 77728 }, A_WhirlwindSeek }, + { { 75888, 78320, 78384 }, A_WizAtk1 }, + { { 75920, 78352, 78416 }, A_WizAtk2 }, + { { 75952, 78384, 78448 }, A_WizAtk3 }, }; DEH_BEGIN_MAPPING(state_mapping, state_t) @@ -229,11 +231,11 @@ static boolean GetActionPointerForOffset(int offset, void **result) { int i; - for (i=0; i= 0; ++i) + { + if ((unsigned int) string_list[i] == offset) + { + return true; + } + } + + return false; +} + static boolean GetStringByOffset(unsigned int offset, char **result) { int i; - for (i=0; ikeys[key_blue]) { - P_SetMessage(player, TXT_NEEDBLUEKEY, false); + P_SetMessage(player, DEH_String(TXT_NEEDBLUEKEY), false); S_StartSound(NULL, sfx_plroof); return; } @@ -245,7 +246,7 @@ void EV_VerticalDoor(line_t * line, mobj_t * thing) } if (!player->keys[key_yellow]) { - P_SetMessage(player, TXT_NEEDYELLOWKEY, false); + P_SetMessage(player, DEH_String(TXT_NEEDYELLOWKEY), false); S_StartSound(NULL, sfx_plroof); return; } @@ -258,7 +259,7 @@ void EV_VerticalDoor(line_t * line, mobj_t * thing) } if (!player->keys[key_green]) { - P_SetMessage(player, TXT_NEEDGREENKEY, false); + P_SetMessage(player, DEH_String(TXT_NEEDGREENKEY), false); S_StartSound(NULL, sfx_plroof); return; } diff --git a/src/heretic/p_inter.c b/src/heretic/p_inter.c index 3587a95d..afdb37f2 100644 --- a/src/heretic/p_inter.c +++ b/src/heretic/p_inter.c @@ -25,6 +25,7 @@ // P_inter.c #include "doomdef.h" +#include "deh_str.h" #include "i_system.h" #include "i_timer.h" #include "m_random.h" @@ -580,21 +581,21 @@ void P_TouchSpecialThing(mobj_t * special, mobj_t * toucher) { return; } - P_SetMessage(player, TXT_ITEMHEALTH, false); + P_SetMessage(player, DEH_String(TXT_ITEMHEALTH), false); break; case SPR_SHLD: // Item_Shield1 if (!P_GiveArmor(player, 1)) { return; } - P_SetMessage(player, TXT_ITEMSHIELD1, false); + P_SetMessage(player, DEH_String(TXT_ITEMSHIELD1), false); break; case SPR_SHD2: // Item_Shield2 if (!P_GiveArmor(player, 2)) { return; } - P_SetMessage(player, TXT_ITEMSHIELD2, false); + P_SetMessage(player, DEH_String(TXT_ITEMSHIELD2), false); break; case SPR_BAGH: // Item_BagOfHolding if (!player->backpack) @@ -610,21 +611,21 @@ void P_TouchSpecialThing(mobj_t * special, mobj_t * toucher) P_GiveAmmo(player, am_crossbow, AMMO_CBOW_WIMPY); P_GiveAmmo(player, am_skullrod, AMMO_SKRD_WIMPY); P_GiveAmmo(player, am_phoenixrod, AMMO_PHRD_WIMPY); - P_SetMessage(player, TXT_ITEMBAGOFHOLDING, false); + P_SetMessage(player, DEH_String(TXT_ITEMBAGOFHOLDING), false); break; case SPR_SPMP: // Item_SuperMap if (!P_GivePower(player, pw_allmap)) { return; } - P_SetMessage(player, TXT_ITEMSUPERMAP, false); + P_SetMessage(player, DEH_String(TXT_ITEMSUPERMAP), false); break; // Keys case SPR_BKYY: // Key_Blue if (!player->keys[key_blue]) { - P_SetMessage(player, TXT_GOTBLUEKEY, false); + P_SetMessage(player, DEH_String(TXT_GOTBLUEKEY), false); } P_GiveKey(player, key_blue); sound = sfx_keyup; @@ -636,7 +637,7 @@ void P_TouchSpecialThing(mobj_t * special, mobj_t * toucher) case SPR_CKYY: // Key_Yellow if (!player->keys[key_yellow]) { - P_SetMessage(player, TXT_GOTYELLOWKEY, false); + P_SetMessage(player, DEH_String(TXT_GOTYELLOWKEY), false); } sound = sfx_keyup; P_GiveKey(player, key_yellow); @@ -648,7 +649,7 @@ void P_TouchSpecialThing(mobj_t * special, mobj_t * toucher) case SPR_AKYY: // Key_Green if (!player->keys[key_green]) { - P_SetMessage(player, TXT_GOTGREENKEY, false); + P_SetMessage(player, DEH_String(TXT_GOTGREENKEY), false); } sound = sfx_keyup; P_GiveKey(player, key_green); @@ -662,70 +663,70 @@ void P_TouchSpecialThing(mobj_t * special, mobj_t * toucher) case SPR_PTN2: // Arti_HealingPotion if (P_GiveArtifact(player, arti_health, special)) { - P_SetMessage(player, TXT_ARTIHEALTH, false); + P_SetMessage(player, DEH_String(TXT_ARTIHEALTH), false); P_SetDormantArtifact(special); } return; case SPR_SOAR: // Arti_Fly if (P_GiveArtifact(player, arti_fly, special)) { - P_SetMessage(player, TXT_ARTIFLY, false); + P_SetMessage(player, DEH_String(TXT_ARTIFLY), false); P_SetDormantArtifact(special); } return; case SPR_INVU: // Arti_Invulnerability if (P_GiveArtifact(player, arti_invulnerability, special)) { - P_SetMessage(player, TXT_ARTIINVULNERABILITY, false); + P_SetMessage(player, DEH_String(TXT_ARTIINVULNERABILITY), false); P_SetDormantArtifact(special); } return; case SPR_PWBK: // Arti_TomeOfPower if (P_GiveArtifact(player, arti_tomeofpower, special)) { - P_SetMessage(player, TXT_ARTITOMEOFPOWER, false); + P_SetMessage(player, DEH_String(TXT_ARTITOMEOFPOWER), false); P_SetDormantArtifact(special); } return; case SPR_INVS: // Arti_Invisibility if (P_GiveArtifact(player, arti_invisibility, special)) { - P_SetMessage(player, TXT_ARTIINVISIBILITY, false); + P_SetMessage(player, DEH_String(TXT_ARTIINVISIBILITY), false); P_SetDormantArtifact(special); } return; case SPR_EGGC: // Arti_Egg if (P_GiveArtifact(player, arti_egg, special)) { - P_SetMessage(player, TXT_ARTIEGG, false); + P_SetMessage(player, DEH_String(TXT_ARTIEGG), false); P_SetDormantArtifact(special); } return; case SPR_SPHL: // Arti_SuperHealth if (P_GiveArtifact(player, arti_superhealth, special)) { - P_SetMessage(player, TXT_ARTISUPERHEALTH, false); + P_SetMessage(player, DEH_String(TXT_ARTISUPERHEALTH), false); P_SetDormantArtifact(special); } return; case SPR_TRCH: // Arti_Torch if (P_GiveArtifact(player, arti_torch, special)) { - P_SetMessage(player, TXT_ARTITORCH, false); + P_SetMessage(player, DEH_String(TXT_ARTITORCH), false); P_SetDormantArtifact(special); } return; case SPR_FBMB: // Arti_FireBomb if (P_GiveArtifact(player, arti_firebomb, special)) { - P_SetMessage(player, TXT_ARTIFIREBOMB, false); + P_SetMessage(player, DEH_String(TXT_ARTIFIREBOMB), false); P_SetDormantArtifact(special); } return; case SPR_ATLP: // Arti_Teleport if (P_GiveArtifact(player, arti_teleport, special)) { - P_SetMessage(player, TXT_ARTITELEPORT, false); + P_SetMessage(player, DEH_String(TXT_ARTITELEPORT), false); P_SetDormantArtifact(special); } return; @@ -736,84 +737,84 @@ void P_TouchSpecialThing(mobj_t * special, mobj_t * toucher) { return; } - P_SetMessage(player, TXT_AMMOGOLDWAND1, false); + P_SetMessage(player, DEH_String(TXT_AMMOGOLDWAND1), false); break; case SPR_AMG2: // Ammo_GoldWandHefty if (!P_GiveAmmo(player, am_goldwand, special->health)) { return; } - P_SetMessage(player, TXT_AMMOGOLDWAND2, false); + P_SetMessage(player, DEH_String(TXT_AMMOGOLDWAND2), false); break; case SPR_AMM1: // Ammo_MaceWimpy if (!P_GiveAmmo(player, am_mace, special->health)) { return; } - P_SetMessage(player, TXT_AMMOMACE1, false); + P_SetMessage(player, DEH_String(TXT_AMMOMACE1), false); break; case SPR_AMM2: // Ammo_MaceHefty if (!P_GiveAmmo(player, am_mace, special->health)) { return; } - P_SetMessage(player, TXT_AMMOMACE2, false); + P_SetMessage(player, DEH_String(TXT_AMMOMACE2), false); break; case SPR_AMC1: // Ammo_CrossbowWimpy if (!P_GiveAmmo(player, am_crossbow, special->health)) { return; } - P_SetMessage(player, TXT_AMMOCROSSBOW1, false); + P_SetMessage(player, DEH_String(TXT_AMMOCROSSBOW1), false); break; case SPR_AMC2: // Ammo_CrossbowHefty if (!P_GiveAmmo(player, am_crossbow, special->health)) { return; } - P_SetMessage(player, TXT_AMMOCROSSBOW2, false); + P_SetMessage(player, DEH_String(TXT_AMMOCROSSBOW2), false); break; case SPR_AMB1: // Ammo_BlasterWimpy if (!P_GiveAmmo(player, am_blaster, special->health)) { return; } - P_SetMessage(player, TXT_AMMOBLASTER1, false); + P_SetMessage(player, DEH_String(TXT_AMMOBLASTER1), false); break; case SPR_AMB2: // Ammo_BlasterHefty if (!P_GiveAmmo(player, am_blaster, special->health)) { return; } - P_SetMessage(player, TXT_AMMOBLASTER2, false); + P_SetMessage(player, DEH_String(TXT_AMMOBLASTER2), false); break; case SPR_AMS1: // Ammo_SkullRodWimpy if (!P_GiveAmmo(player, am_skullrod, special->health)) { return; } - P_SetMessage(player, TXT_AMMOSKULLROD1, false); + P_SetMessage(player, DEH_String(TXT_AMMOSKULLROD1), false); break; case SPR_AMS2: // Ammo_SkullRodHefty if (!P_GiveAmmo(player, am_skullrod, special->health)) { return; } - P_SetMessage(player, TXT_AMMOSKULLROD2, false); + P_SetMessage(player, DEH_String(TXT_AMMOSKULLROD2), false); break; case SPR_AMP1: // Ammo_PhoenixRodWimpy if (!P_GiveAmmo(player, am_phoenixrod, special->health)) { return; } - P_SetMessage(player, TXT_AMMOPHOENIXROD1, false); + P_SetMessage(player, DEH_String(TXT_AMMOPHOENIXROD1), false); break; case SPR_AMP2: // Ammo_PhoenixRodHefty if (!P_GiveAmmo(player, am_phoenixrod, special->health)) { return; } - P_SetMessage(player, TXT_AMMOPHOENIXROD2, false); + P_SetMessage(player, DEH_String(TXT_AMMOPHOENIXROD2), false); break; // Weapons @@ -822,7 +823,7 @@ void P_TouchSpecialThing(mobj_t * special, mobj_t * toucher) { return; } - P_SetMessage(player, TXT_WPNMACE, false); + P_SetMessage(player, DEH_String(TXT_WPNMACE), false); sound = sfx_wpnup; break; case SPR_WBOW: // Weapon_Crossbow @@ -830,7 +831,7 @@ void P_TouchSpecialThing(mobj_t * special, mobj_t * toucher) { return; } - P_SetMessage(player, TXT_WPNCROSSBOW, false); + P_SetMessage(player, DEH_String(TXT_WPNCROSSBOW), false); sound = sfx_wpnup; break; case SPR_WBLS: // Weapon_Blaster @@ -838,7 +839,7 @@ void P_TouchSpecialThing(mobj_t * special, mobj_t * toucher) { return; } - P_SetMessage(player, TXT_WPNBLASTER, false); + P_SetMessage(player, DEH_String(TXT_WPNBLASTER), false); sound = sfx_wpnup; break; case SPR_WSKL: // Weapon_SkullRod @@ -846,7 +847,7 @@ void P_TouchSpecialThing(mobj_t * special, mobj_t * toucher) { return; } - P_SetMessage(player, TXT_WPNSKULLROD, false); + P_SetMessage(player, DEH_String(TXT_WPNSKULLROD), false); sound = sfx_wpnup; break; case SPR_WPHX: // Weapon_PhoenixRod @@ -854,7 +855,7 @@ void P_TouchSpecialThing(mobj_t * special, mobj_t * toucher) { return; } - P_SetMessage(player, TXT_WPNPHOENIXROD, false); + P_SetMessage(player, DEH_String(TXT_WPNPHOENIXROD), false); sound = sfx_wpnup; break; case SPR_WGNT: // Weapon_Gauntlets @@ -862,7 +863,7 @@ void P_TouchSpecialThing(mobj_t * special, mobj_t * toucher) { return; } - P_SetMessage(player, TXT_WPNGAUNTLETS, false); + P_SetMessage(player, DEH_String(TXT_WPNGAUNTLETS), false); sound = sfx_wpnup; break; default: diff --git a/src/heretic/sb_bar.c b/src/heretic/sb_bar.c index 3a90c000..51bd3b9c 100644 --- a/src/heretic/sb_bar.c +++ b/src/heretic/sb_bar.c @@ -1055,11 +1055,11 @@ static void CheatGodFunc(player_t * player, Cheat_t * cheat) player->cheats ^= CF_GODMODE; if (player->cheats & CF_GODMODE) { - P_SetMessage(player, TXT_CHEATGODON, false); + P_SetMessage(player, DEH_String(TXT_CHEATGODON), false); } else { - P_SetMessage(player, TXT_CHEATGODOFF, false); + P_SetMessage(player, DEH_String(TXT_CHEATGODOFF), false); } SB_state = -1; } @@ -1069,11 +1069,11 @@ static void CheatNoClipFunc(player_t * player, Cheat_t * cheat) player->cheats ^= CF_NOCLIP; if (player->cheats & CF_NOCLIP) { - P_SetMessage(player, TXT_CHEATNOCLIPON, false); + P_SetMessage(player, DEH_String(TXT_CHEATNOCLIPON), false); } else { - P_SetMessage(player, TXT_CHEATNOCLIPOFF, false); + P_SetMessage(player, DEH_String(TXT_CHEATNOCLIPOFF), false); } } @@ -1106,7 +1106,7 @@ static void CheatWeaponsFunc(player_t * player, Cheat_t * cheat) { player->ammo[i] = player->maxammo[i]; } - P_SetMessage(player, TXT_CHEATWEAPONS, false); + P_SetMessage(player, DEH_String(TXT_CHEATWEAPONS), false); } static void CheatPowerFunc(player_t * player, Cheat_t * cheat) @@ -1114,12 +1114,12 @@ static void CheatPowerFunc(player_t * player, Cheat_t * cheat) if (player->powers[pw_weaponlevel2]) { player->powers[pw_weaponlevel2] = 0; - P_SetMessage(player, TXT_CHEATPOWEROFF, false); + P_SetMessage(player, DEH_String(TXT_CHEATPOWEROFF), false); } else { P_UseArtifact(player, arti_tomeofpower); - P_SetMessage(player, TXT_CHEATPOWERON, false); + P_SetMessage(player, DEH_String(TXT_CHEATPOWERON), false); } } @@ -1133,7 +1133,7 @@ static void CheatHealthFunc(player_t * player, Cheat_t * cheat) { player->health = player->mo->health = MAXHEALTH; } - P_SetMessage(player, TXT_CHEATHEALTH, false); + P_SetMessage(player, DEH_String(TXT_CHEATHEALTH), false); } static void CheatKeysFunc(player_t * player, Cheat_t * cheat) @@ -1144,7 +1144,7 @@ static void CheatKeysFunc(player_t * player, Cheat_t * cheat) player->keys[key_green] = true; player->keys[key_blue] = true; playerkeys = 7; // Key refresh flags - P_SetMessage(player, TXT_CHEATKEYS, false); + P_SetMessage(player, DEH_String(TXT_CHEATKEYS), false); } static void CheatSoundFunc(player_t * player, Cheat_t * cheat) @@ -1152,11 +1152,11 @@ static void CheatSoundFunc(player_t * player, Cheat_t * cheat) DebugSound = !DebugSound; if (DebugSound) { - P_SetMessage(player, TXT_CHEATSOUNDON, false); + P_SetMessage(player, DEH_String(TXT_CHEATSOUNDON), false); } else { - P_SetMessage(player, TXT_CHEATSOUNDOFF, false); + P_SetMessage(player, DEH_String(TXT_CHEATSOUNDOFF), false); } } @@ -1165,11 +1165,11 @@ static void CheatTickerFunc(player_t * player, Cheat_t * cheat) DisplayTicker = !DisplayTicker; if (DisplayTicker) { - P_SetMessage(player, TXT_CHEATTICKERON, false); + P_SetMessage(player, DEH_String(TXT_CHEATTICKERON), false); } else { - P_SetMessage(player, TXT_CHEATTICKEROFF, false); + P_SetMessage(player, DEH_String(TXT_CHEATTICKEROFF), false); } I_DisplayFPSDots(DisplayTicker); @@ -1177,12 +1177,12 @@ static void CheatTickerFunc(player_t * player, Cheat_t * cheat) static void CheatArtifact1Func(player_t * player, Cheat_t * cheat) { - P_SetMessage(player, TXT_CHEATARTIFACTS1, false); + P_SetMessage(player, DEH_String(TXT_CHEATARTIFACTS1), false); } static void CheatArtifact2Func(player_t * player, Cheat_t * cheat) { - P_SetMessage(player, TXT_CHEATARTIFACTS2, false); + P_SetMessage(player, DEH_String(TXT_CHEATARTIFACTS2), false); } static void CheatArtifact3Func(player_t * player, Cheat_t * cheat) @@ -1210,7 +1210,7 @@ static void CheatArtifact3Func(player_t * player, Cheat_t * cheat) P_GiveArtifact(player, i, NULL); } } - P_SetMessage(player, TXT_CHEATARTIFACTS3, false); + P_SetMessage(player, DEH_String(TXT_CHEATARTIFACTS3), false); } else if (type > arti_none && type < NUMARTIFACTS && count > 0 && count < 10) @@ -1218,18 +1218,18 @@ static void CheatArtifact3Func(player_t * player, Cheat_t * cheat) if (gamemode == shareware && (type == arti_superhealth || type == arti_teleport)) { - P_SetMessage(player, TXT_CHEATARTIFACTSFAIL, false); + P_SetMessage(player, DEH_String(TXT_CHEATARTIFACTSFAIL), false); return; } for (i = 0; i < count; i++) { P_GiveArtifact(player, type, NULL); } - P_SetMessage(player, TXT_CHEATARTIFACTS3, false); + P_SetMessage(player, DEH_String(TXT_CHEATARTIFACTS3), false); } else { // Bad input - P_SetMessage(player, TXT_CHEATARTIFACTSFAIL, false); + P_SetMessage(player, DEH_String(TXT_CHEATARTIFACTSFAIL), false); } } @@ -1246,7 +1246,7 @@ static void CheatWarpFunc(player_t * player, Cheat_t * cheat) if (D_ValidEpisodeMap(gamemission, gamemode, episode, map)) { G_DeferedInitNew(gameskill, episode, map); - P_SetMessage(player, TXT_CHEATWARP, false); + P_SetMessage(player, DEH_String(TXT_CHEATWARP), false); } } @@ -1258,19 +1258,19 @@ static void CheatChickenFunc(player_t * player, Cheat_t * cheat) { if (P_UndoPlayerChicken(player)) { - P_SetMessage(player, TXT_CHEATCHICKENOFF, false); + P_SetMessage(player, DEH_String(TXT_CHEATCHICKENOFF), false); } } else if (P_ChickenMorphPlayer(player)) { - P_SetMessage(player, TXT_CHEATCHICKENON, false); + P_SetMessage(player, DEH_String(TXT_CHEATCHICKENON), false); } } static void CheatMassacreFunc(player_t * player, Cheat_t * cheat) { P_Massacre(); - P_SetMessage(player, TXT_CHEATMASSACRE, false); + P_SetMessage(player, DEH_String(TXT_CHEATMASSACRE), false); } static void CheatIDKFAFunc(player_t * player, Cheat_t * cheat) @@ -1285,11 +1285,11 @@ static void CheatIDKFAFunc(player_t * player, Cheat_t * cheat) player->weaponowned[i] = false; } player->pendingweapon = wp_staff; - P_SetMessage(player, TXT_CHEATIDKFA, true); + P_SetMessage(player, DEH_String(TXT_CHEATIDKFA), true); } static void CheatIDDQDFunc(player_t * player, Cheat_t * cheat) { P_DamageMobj(player->mo, NULL, player->mo, 10000); - P_SetMessage(player, TXT_CHEATIDDQD, true); + P_SetMessage(player, DEH_String(TXT_CHEATIDDQD), true); } -- cgit v1.2.3 From 8069d8a0fdf30516cb6eff6d6a9e2990061f95c1 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 18 Apr 2010 16:40:14 +0000 Subject: Add -hhever command line parameter to select patch version number. Subversion-branch: /branches/raven-branch Subversion-revision: 1902 --- src/heretic/deh_frame.c | 11 ++------ src/heretic/deh_htic.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++- src/heretic/deh_htic.h | 1 + 3 files changed, 69 insertions(+), 10 deletions(-) (limited to 'src/heretic') 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 #include +#include + #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 + // + // 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; -- cgit v1.2.3 From 38c31575d255e1b2ff71f9de2c4d16664e8fb1e9 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 18 Apr 2010 17:15:20 +0000 Subject: Add WAD merging command line options to Heretic. Subversion-branch: /branches/raven-branch Subversion-revision: 1903 --- src/heretic/d_main.c | 127 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) (limited to 'src/heretic') diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c index 52e4239f..5fa2d5f9 100644 --- a/src/heretic/d_main.c +++ b/src/heretic/d_main.c @@ -46,6 +46,7 @@ #include "m_controls.h" #include "p_local.h" #include "s_sound.h" +#include "w_merge.h" #include "v_video.h" #define STARTUP_WINDOW_X 17 @@ -908,6 +909,132 @@ void D_DoomMain(void) D_AddFile(iwadfile); +#ifdef FEATURE_WAD_MERGE + + // Merged PWADs are loaded first, because they are supposed to be + // modified IWADs. + + //! + // @arg + // @category mod + // + // Simulates the behavior of deutex's -merge option, merging a PWAD + // into the main IWAD. Multiple files may be specified. + // + + p = M_CheckParm("-merge"); + + if (p > 0) + { + for (p = p + 1; p + // @category mod + // + // Simulates the behavior of NWT's -merge option. Multiple files + // may be specified. + + p = M_CheckParm("-nwtmerge"); + + if (p > 0) + { + for (p = p + 1; p + // @category mod + // + // Simulates the behavior of NWT's -af option, merging flats into + // the main IWAD directory. Multiple files may be specified. + // + + p = M_CheckParm("-af"); + + if (p > 0) + { + for (p = p + 1; p + // @category mod + // + // Simulates the behavior of NWT's -as option, merging sprites + // into the main IWAD directory. Multiple files may be specified. + // + + p = M_CheckParm("-as"); + + if (p > 0) + { + for (p = p + 1; p + // @category mod + // + // Equivalent to "-af -as ". + // + + p = M_CheckParm("-aa"); + + if (p > 0) + { + for (p = p + 1; p