Sign in to follow this  
Followers 0

Hacking DOOM.EXE to add one more animation and switch

If you search through DOOM.EXE with a hexadecimal editor, you'll find the switch and animation lists in the same format as Boom's SWITCHES and ANIMATED. Each of them has an empty padding at the end, the same length as a switch or animation entry. If I remember correctly, I managed to add one more switch in hacked vanilla Doom by replacing the empty padding with a new entry. Were there any side effects, other than Doom exiting with an error if the WAD lacked the specified entry in TEXTUREx?

Share this post


Link to post

How about you edit an example and we all test it?

Share this post


Link to post

The empty entry at the end of the table is a termination marker. Whether it works to put meaningful data there depends on the following memory containing proper data to be interpreted as a termination marker as well.

For switches it may work because the value to be tested is 0.

For animations, though, the value is -1, so it will try to create animations from random data. Most likely this will fail and since the animations code is a lot more robust than the switch code you may get away with it.

Obviously it's a completely nonportable hack that would limit any mod using it to the vanilla EXE and therefore kill 99.9% of the potential user base.

Share this post


Link to post

There's really no reason to hack the EXE to get extra animations and switches in vanilla. For wall textures and switches, you can just make an existing texture wider and put your custom patches in this extra space, and use the X offsets on your sidedefs to make the appropriate portion of the texture appear (though you may need to split long lines, as the texture obviously won't tile correctly). Final Doom used this trick.

Animated flats can't be added this way, but all versions of Doom define SWATER1-SWATER4, but none actually use it, so you can use this if you want a custom animated flat. Remember, for flats to work in PWADs, there must be an F_END marker after your flats and there must not be an F_START marker (some WAD utilities add an FF_START marker for clarity, but this is not needed).

Share this post


Link to post

There's no reason to add other animations in vanilla at all. Not when we have a thousand source ports out there. You want to map for vanilla? Then work with the limits instead of trying to hack your way past them. Isn't that the point of mapping for vanilla? That you have strict limits that bound what you can do and let you concentrate on the essential instead of getting bogged down in superfluous details?

It really isn't better in any way to use a hacky "vanilla-compatible (if you use a hex editor and follow these steps)" system than a port with features designed to do what you want in a clean, convenient, and transparent way.

Share this post


Link to post

Graf Zahl said:
Obviously it's a completely nonportable hack that would limit any mod using it to the vanilla EXE and therefore kill 99.9% of the potential user base.

Not necessarily, since an author would include a SWITCHES lump in the WAD for Boom and up.

Foxpup said:
There's really no reason to hack the EXE to get extra animations and switches in vanilla. For wall textures and switches, you can just make an existing texture wider and put your custom patches in this extra space, and use the X offsets on your sidedefs to make the appropriate portion of the texture appear (though you may need to split long lines, as the texture obviously won't tile correctly).

Yeah, but that's more annoying than an extra switch where you don't have to mess much with texture alignment.

Share this post


Link to post
myk said:

Yeah, but that's more annoying than an extra switch where you don't have to mess much with texture alignment.


does not make sense

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0