Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Ryath

Editing map names in Heretic

Recommended Posts

So we all know how the clunky process of changing map names in Doom (graphic lumps for the names on the intermission screen and a DeHackEd patch for the ones on the automap). Heretic, on the other hand, seems to have simplified things by cutting out the graphic lumps -- so instead everything needs to be done with a HHE patch.

 

Unfortunately, I can't get HHE to run on any computer I've tried it on. It just freezes the moment it starts up. In lieu of HHE, I've resorted to looking at other vanilla Heretic WADs that replace map names and then using their HHE patches as a template. I've been able to replace the automap names of all the maps in the first two episodes, as well as the titles of the first three episodes. Problem is I can't find the locations (the actual number values) of the remaining strings I need to edit. And weirder, I haven't found any Heretic WADs that replace the intermission map names -- just the automap ones.

 

So my question, I guess, has three parts.

1) Does anyone know how to edit all the map names for Heretic? Or maybe know of a chart that outlines all the relevant strings? Or even just a Heretic WAD that has all new map names I could look at to figure it out?

2) Is it possible to replace the intermission map names? I don't see any reason why it wouldn't be, but I also don't understand why I wouldn't have found anyone who's done it.

3) Is anyone familiar enough with HHE to know why it would be freezing on startup?

Share this post


Link to post

If you want to make it work in vanilla, HHE is still your best bet, unless you want to screw around with something wacky like a hex editor and IPS patches (which most players might not know how to use unless they're also into the ROMhacking scene, and won't be supported in Chocolate Heretic the way HHE is).  Have you tried running HHE via DOSBox?  It's a DOS program so if you've got anything newer than Windows XP that's your best bet for running it.  You'll want to have an install of Heretic in the directory you mount as your DOSBox drive too so that HHE can read from/write to it.

 

Although I will note, HHE never supported Shadow of the Serpent Riders entirely right.  I think map names should all be editable with the SotSR INI that's out there but I can't guarantee you this 100% without checking.  Regardless, there are also limitations to what your string lengths can be since you're replacing fixed data in the EXE.

 

Various ports have their own ways of defining stuff.  There's ZMAPINFO for (G)ZDoom and Doomsday has its own map definition format as well that I've used before in my WADs but I'd have to open one up and dig around in it again to remember exactly what I did for that.  Not sure about other ports but those are the major relevant ones for Heretic at the moment, anyway.

Share this post


Link to post

yeah MAPINFO / ZMAPINFO is the way to go for altering map names and intermission stuff, HHE should only be used for Vanilla targeted projects.

 

Here's an example of the .HHE file from Hump-mini:
 

Spoiler

Patch File for HHE v1.1

Heretic version = 10
Patch format = 1


Text 1240 5
CANAL


Text 1260 19
THE DOORWAY TO HELL


Text 1280 10
COAST TOWN


Text 1304 9
THE WHARF


Text 1328 12
RESURRECTION


Text 1348 15
THE BLACK HEART


Text 1372 17
THE INNER SANCTUM


Text 1392 16
TOMB OF XERXES I


Text 1412 5
NEXUS


Text 1436 13
TWISTED SPIRE


Text 1456 5
NEXUS


Text 1480 5
NEXUS


Text 1508 5
NEXUS


Text 1532 17
CAVE OF DAMNATION


Text 1556 13
CULTIST CRYPT


Text 1580 9
DEEP BLUE


Text 1604 11
DANKE SCHON


Text 1632 16
PRAEVUS SMELTERY


Text 7096 17
SHORES OF PRAEVUS


Text 7116 8
BADLANDS


Text 4016 301
the horrific screams of the iron
liches and their minions fade away
as you leave the coast of praevus.
entering the hinterland, something
is not right. This place too reeks
of the foul offal of D'Sparil.
Clutching your possessions close,
you trek deep through the mountain
passes, no turning back now...
up ahead, a strange shape looms
over the horizon, gripping you
with fear, and casting an ominous
shadow across your path.
What unspeakable horrors could be
lurking there? You step forwards,
heading for the twisted spire...


Text 4536 505
the view from the throne is indeed
more glorious than you imagined.
the screams of capured enemies
a discordant symphony to your ear.
those who stood in your way:
destroyed.
the great feast lasts for weeks
songs are sung of your heorism,
but in the night, you still hear
the horrific screams of the fallen,
those who were lost along the way.
do we deserve this feast and joy?
when they knew only pain and death
and a cold, shallow grave.
it is a bittersweet time for you,
so many bright lives cut short...

 

@Mikolah made this .HHE file (which is just a text file) and I just edited it. I think you can just use notepad to create these .hhe files, then rename the filename from .txt to .hhe

 

The list of strings is here (the 4 digit numbers are the identifiers):
https://github.com/chocolate-doom/chocolate-doom/blob/master/src/heretic/deh_htext.c#L47
Each string has a 4 digit identifier, as well as a number indicating the length of the title. Map titles cannot exceed the length of the original title (unless the original title was shorter than the nearest multiple of 4, in which case you could go as long as the next multiple of 4 .... iirc).

The numbers indicating length must be exactly correct or the whole thing will fail to parse and/or you'll get errors.

 

 

Vanilla modding is very fiddly and complex, I would certainly advise using MAPINFO for map info unless you're specifically making a mod for chocolate heretic.
I attached the .hhe file from hump-mini

HUMP_mini.zip

Share this post


Link to post
4 hours ago, Ryath said:

And weirder, I haven't found any Heretic WADs that replace the intermission map names -- just the automap ones.

Are you sure they aren't the same thing?

 

Looking at the Heretic source code, there's only one table of level names, in AM_MAP.C.

char *LevelNames[] =
{
	// EPISODE 1 - THE CITY OF THE DAMNED
	"E1M1:  THE DOCKS",
 	"E1M2:  THE DUNGEONS",
 	"E1M3:  THE GATEHOUSE",
 	"E1M4:  THE GUARD TOWER",
 	"E1M5:  THE CITADEL",
 	"E1M6:  THE CATHEDRAL",
 	"E1M7:  THE CRYPTS",
 	"E1M8:  HELL'S MAW",
 	"E1M9:  THE GRAVEYARD",
	// EPISODE 2 - HELL'S MAW
	"E2M1:  THE CRATER",
 	"E2M2:  THE LAVA PITS",
 	"E2M3:  THE RIVER OF FIRE",
 	"E2M4:  THE ICE GROTTO",
 	"E2M5:  THE CATACOMBS",
 	"E2M6:  THE LABYRINTH",
 	"E2M7:  THE GREAT HALL",
 	"E2M8:  THE PORTALS OF CHAOS",
 	"E2M9:  THE GLACIER",
	// EPISODE 3 - THE DOME OF D'SPARIL
 	"E3M1:  THE STOREHOUSE",
 	"E3M2:  THE CESSPOOL",
 	"E3M3:  THE CONFLUENCE",
 	"E3M4:  THE AZURE FORTRESS",
 	"E3M5:  THE OPHIDIAN LAIR",
 	"E3M6:  THE HALLS OF FEAR",
 	"E3M7:  THE CHASM",
 	"E3M8:  D'SPARIL'S KEEP",
 	"E3M9:  THE AQUIFER",
	// EPISODE 4: THE OSSUARY
	"E4M1:  CATAFALQUE",
	"E4M2:  BLOCKHOUSE",
	"E4M3:  AMBULATORY",
	"E4M4:  SEPULCHER",
	"E4M5:  GREAT STAIR",
	"E4M6:  HALLS OF THE APOSTATE",
	"E4M7:  RAMPARTS OF PERDITION",
	"E4M8:  SHATTERED BRIDGE",
	"E4M9:  MAUSOLEUM",
	// EPISODE 5: THE STAGNANT DEMESNE
	"E5M1:  OCHRE CLIFFS",
	"E5M2:  RAPIDS",
	"E5M3:  QUAY",
	"E5M4:  COURTYARD",
	"E5M5:  HYDRATYR",
	"E5M6:  COLONNADE",
	"E5M7:  FOETID MANSE",
	"E5M8:  FIELD OF JUDGEMENT",
	"E5M9:  SKEIN OF D'SPARIL"
};

(Interesting little detail: there are two spaces between "ExMy:" and the level name. It's not "E1M1: The Docks", it's "E1M1:  The Docks".)

 

For the intermission (or, interlude as Raven apparently called it), you have these functions in IN_LUDE.C:

void IN_DrawOldLevel(void)
{
	int i;
	int x;

	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);

and

void IN_DrawYAH(void)
{
	int i;
	int x;

	x = 160-MN_TextAWidth("NOW ENTERING:")/2;
	MN_DrTextA("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);

and also

oid IN_DrawSingleStats(void)
{
	int x;
	static int sounds;

	IN_DrTextB("KILLS", 50, 65);
	IN_DrTextB("ITEMS", 50, 90);
	IN_DrTextB("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);

and more like this.

 

Now it's important to take a look at this little +7 that has been tacked on.

LevelNames[(gameepisode-1)*9+prevmap-1]+7

Now for those here who do not have some programming knowledge, a character string in C is just an array of characters that continue until reaching a zero. (Not the zero character, but the value 0, null.) Here it says to take the character string, such as "E1M1:  The Docks", but to skip the first seven characters. (And these seven characters are "ExMy:  ", don't forget about the two spaces thing.)

 

So, based on this, if you want to change the strings, then change the automap name, as that's the one thing that'll get used. And don't forget to put two spaces!

Share this post


Link to post
6 hours ago, riderr3 said:

As I know Hump Mini have some HHE examples

https://www.doomworld.com/idgames/levels/heretic/g-i/humpmini

Heh, that's the exact WAD I used for the template I mentioned! It doesn't have an Episode 3, which is why I got stuck at that point.

 

5 hours ago, ETTiNGRiNDER said:

If you want to make it work in vanilla, HHE is still your best bet, unless you want to screw around with something wacky like a hex editor and IPS patches (which most players might not know how to use unless they're also into the ROMhacking scene, and won't be supported in Chocolate Heretic the way HHE is).  Have you tried running HHE via DOSBox?  It's a DOS program so if you've got anything newer than Windows XP that's your best bet for running it.  You'll want to have an install of Heretic in the directory you mount as your DOSBox drive too so that HHE can read from/write to it.

 

Although I will note, HHE never supported Shadow of the Serpent Riders entirely right.  I think map names should all be editable with the SotSR INI that's out there but I can't guarantee you this 100% without checking.  Regardless, there are also limitations to what your string lengths can be since you're replacing fixed data in the EXE.

Yep, I ran HHE in DOSBox and that's where I was having the freezing problem. Before it starts up, though, it says that my HERETIC.EXE is not the expected file size, so maybe that's what's causing it to choke? Is this because I have SotSR?

 

5 hours ago, Gez said:

Are you sure they aren't the same thing?

...

So, based on this, if you want to change the strings, then change the automap name, as that's the one thing that'll get used. And don't forget to put two spaces!

It did occur to me at one point that they might be drawn from the same string. (My guess wasn't that it ignored the first 7 characters but that the double space was some kind of indicator to ignore everything before it. So I was close!) But I noticed when I loaded up Hump Mini or my own HHE patch that the automap names would display correctly but the intermission names were still the default IWAD ones. I fired it up again just now to make sure I wasn't crazy. On the automap, the first map is "E1M1:  Ramparts". Hit the exit switch and... "The Docks".

 

Could I be doing something wrong in the way I'm using the HHE patch?

Share this post


Link to post

I haven't used the original dos HHE, so I might be wrong, but as far as I understand there's either a different HHE version required for the Shadow of the Serpent Riders .exe. 

Also, here's a .hhe with all 3 episodes: https://hastebin.com/wigefatifu.hhe

 

EDIT: hastebin seems broken, i'll just attach the file

hhetest.zip

Edited by Mikolah

Share this post


Link to post
7 hours ago, Ryath said:

But I noticed when I loaded up Hump Mini or my own HHE patch that the automap names would display correctly but the intermission names were still the default IWAD ones.

Strange. Can you open HERETIC.EXE in a hex editor and search for the strings "THE DOCKS", see if it occurs twice? It wouldn't match the source code but it's possible the compiler would have duplicated the table.

Share this post


Link to post
8 hours ago, Ryath said:

Yep, I ran HHE in DOSBox and that's where I was having the freezing problem. Before it starts up, though, it says that my HERETIC.EXE is not the expected file size, so maybe that's what's causing it to choke? Is this because I have SotSR?

Very likely, though I would've expected it to quit instead of freeze.  Make sure your HHE.INI uses the values listed near the top of this page (and that the offsets aren't being given in the file more than once with different values, i.e. remove the old Heretic v1.0 ones).

http://ettingrinder.youfailit.net/heretic-hhe.html

If it still has problems when given those settings, then I can only reiterate to make sure that it can actually access the HERETIC.EXE file.

Share this post


Link to post
20 hours ago, Mikolah said:

I haven't used the original dos HHE, so I might be wrong, but as far as I understand there's either a different HHE version required for the Shadow of the Serpent Riders .exe. 

Also, here's a .hhe with all 3 episodes: hhetest.zip

Thank you! That's a huge help. Any chance you could upload one with all five of the episode titles as well? (I've been able to find the correct text offsets for Episode 1-3 but I can't seem to locate 4 and 5.

 

15 hours ago, Gez said:

Strange. Can you open HERETIC.EXE in a hex editor and search for the strings "THE DOCKS", see if it occurs twice? It wouldn't match the source code but it's possible the compiler would have duplicated the table.

Gave it a look and nope -- it appears just once. Out of curiosity, if you folks load up humpmini.hhe for example, are you telling me you don't see the original map names on the intermission screen?

 

14 hours ago, ETTiNGRiNDER said:

Very likely, though I would've expected it to quit instead of freeze.  Make sure your HHE.INI uses the values listed near the top of this page (and that the offsets aren't being given in the file more than once with different values, i.e. remove the old Heretic v1.0 ones).

http://ettingrinder.youfailit.net/heretic-hhe.html

If it still has problems when given those settings, then I can only reiterate to make sure that it can actually access the HERETIC.EXE file.

Yeah, I'm a big dumb idiot. Those new values fixed it. It runs fine now, though all the text offsets it gives seem to be... incorrect? Are these the Heretic 1.0 values you're talking about? It gives The Docks as 1252:

hhe3.png.4fdc47c2be4135bca84f85806e840a5c.png

 

But if I create that HHE file, it causes an error when trying to load it with Choco. However, the 1240 offset given by everyone else works fine.

 

hhe2.png.7e7d5b038cdab4b5bb2050391a6ef47f.png

Share this post


Link to post
5 hours ago, Ryath said:

Gave it a look and nope -- it appears just once. Out of curiosity, if you folks load up humpmini.hhe for example, are you telling me you don't see the original map names on the intermission screen?

Can't check it at the moment.

 

But I just don't understand how it happens. The string occurs only once in the exe, so if it's replaced it should be replaced everywhere. It just doesn't make sense that something that exists in memory at only one place can turn into two different values. That's some quantum entanglement shit.

 

What if instead of using HHE you just use a hex editor directly, and you rename THE DOCKS there to something else. Like THE DUCKS. (Or THE DICKS. Whichever you find funnier.) Then play the game normally and does THE DOCKS still reappear?

Share this post


Link to post

@Gez

I just went investigating and am unsurprised to report that it's a Chocolate Heretic inaccuracy.  In vanilla, changing the map name does indeed alter both automap and intermission name with one string.

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×