Basic DEHACKED-to-DECORATE converter

Any utility that assists in the creation of mods, assets, etc, go here. For example: Ultimate Doom Builder, Slade, WadSmoosh, Oblige, etc.
Forum rules
The Projects forums are ONLY for YOUR PROJECTS! If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
Post Reply
User avatar
3saster
Posts: 199
Joined: Fri May 11, 2018 2:39 pm
Location: Canada

Basic DEHACKED-to-DECORATE converter

Post by 3saster »

So after finding myself converting many DEHACKED files to DECORATE to allow better mod support, I realized how long, annoying, and error-prone it is to manually do it from scratch. Thus, I went about writing a simple program where you can drag a dehacked file and receive a corresponding decorate file in return.

Here is the program and its source code: https://drive.google.com/file/d/1PpLIow ... sp=sharing
Don't stare too hard at the source code, it has been a VERY long time since I did much coding, so the code is kind of a mess (also not really sure why I wrote it in C++). I will hopefully rewrite it entirely at some point in the future.

To use it, simply drag the dehacked file onto the exe. You can also call it from the command line. It will output a decorate file and a log file describing how the operation went.
  • Only processes the thing, weapon, and state changes at the moment. Stuff like strings, sounds, or ammo are intentionally left to the dehacked file. As such, it meant to be used alongside the dehacked file, not instead of.
  • Does not yet do MBF-style parameters; will likely incorporate this later once I figure out how that works.
  • It is rather basic in checking codepointers; it will always just write "A_(name of codepointer)" unless it is null. Thus invalid codepointers such as A_Suicide or A_Scratch may end up in the output file. You should check/run the decorate file to possibly correct these mistakes for now, I will hopefully deal with this later.
  • Output actors are based on using inheritance and replacement to only change modified properties.
  • Tends to duplicate certain states (i.e. Missile state writes the See state explicitly once before the "goto See" line). Doesn't affect behavior, but I'll try to fix it later.
  • Because adding a state to a thing means removing it from another in dehacked, the output file will often have a lot of extraneous actors, as both things have technically been modified (see below). It's hard to tell what is and isn't extraneous without playing the wad first, so you may want to figure out and remove the extraneous actors.
As an example, here is the output from Scythe 2's dehacked file (note the last three actors are extraneous and can be safely removed)

Code: Select all

Actor DH_WolfensteinSS : WolfensteinSS replaces WolfensteinSS 84
{
	Health 250
	Speed 16
	PainChance 30
	Translation 2
	SeeSound "grunt/sight"
	DeathSound "grunt/death"
	States
	{
	Spawn:
		PLAY AB 10 A_Look
		goto Spawn
	See:
		PLAY AABBCCDD 1 A_Chase
		goto See
	Pain:
		PLAY G 3 
		PLAY G 3 A_Pain
		PLAY AABBCCDD 1 A_Chase
		goto See
	Missile:
		PLAY E 2 A_FaceTarget
		PLAY F 1 Bright A_BspiAttack
		PLAY E 2 A_FaceTarget
		PLAY F 1 Bright A_BspiAttack
		PLAY E 2 A_FaceTarget
		PLAY F 1 Bright A_BspiAttack
		PLAY AABBCCDD 1 A_Chase
		goto See
	Death:
		PLAY H 10 
		PLAY I 10 A_Scream
		PLAY J 10 A_Fall
		PLAY K 10 
		PLAY N -1 
		stop
	XDeath:
		PLAY O 5 
		PLAY P 5 A_XScream
		PLAY Q 5 A_Fall
		PLAY RSTUV 5 
		PLAY W -1 
		stop
	Raise:
		PLAY MKJIH 5 
		PLAY AABBCCDD 1 A_Chase
		goto See
	}
}

Actor DH_CommanderKeen : CommanderKeen replaces CommanderKeen 72
{
	Health 2500
	Speed 8
	Radius 20
	Height 64
	PainChance 30
	Mass 400
	-SPAWNCEILING
	+FLOAT
	SeeSound "baron/sight"
	PainSound "demon/pain"
	DeathSound "baron/death"
	ActiveSound "demon/active"
	States
	{
	Spawn:
		KEEN A 10 Bright A_Look
		goto Spawn
	See:
		KEEN ABCD 3 Bright A_Chase
		goto See
	Pain:
		KEEN H 8 Bright 
		KEEN A 3 Bright A_Pain
		KEEN ABCD 3 Bright A_Chase
		goto See
	Missile:
		KEEN EF 6 Bright A_FaceTarget
		KEEN G 1 Bright A_FatAttack1
		KEEN G 1 Bright A_FatAttack2
		KEEN G 1 Bright A_FatAttack3
		KEEN G 1 Bright A_FaceTarget
		KEEN GG 1 Bright A_SkelMissile
		KEEN G 8 Bright A_SkelMissile
		KEEN ABCD 3 Bright A_Chase
		goto See
	Death:
		KEEN I 5 Bright 
		KEEN J 5 Bright A_Scream
		KEEN K 5 Bright 
		KEEN L 5 Bright A_Fall
		KEEN MNOPQ 5 Bright 
		KEEN R 5 Bright A_BossDeath
		KEEN R 1 Bright 
		stop
	}
}

Actor DH_BossEye : BossEye replaces BossEye 89
{
	States
	{
	Spawn:
		KEEN C 3 Bright A_Chase
		KEEN DAB 3 Bright A_Chase
		goto Spawn
	See:
		KEEN DAB 3 Bright A_Chase
		KEEN C 3 Bright A_Chase
		goto See
	}
}

Actor DH_SpawnShot : SpawnShot replaces SpawnShot -1
{
	States
	{
	Spawn:
		KEEN J 5 Bright A_Scream
		KEEN K 5 Bright 
		KEEN L 5 Bright A_Fall
		KEEN MNOPQ 5 Bright 
		KEEN R 5 Bright A_BossDeath
		KEEN R 1 Bright 
		stop
	}
}

Actor DH_SpawnFire : SpawnFire replaces SpawnFire -1
{
	States
	{
	Spawn:
		KEEN F 6 Bright A_FaceTarget
		KEEN G 1 Bright A_FatAttack1
		KEEN G 1 Bright A_FatAttack2
		KEEN G 1 Bright A_FatAttack3
		KEEN G 1 Bright A_FaceTarget
		KEEN GG 1 Bright A_SkelMissile
		KEEN G 8 Bright A_SkelMissile
	State_774:
		KEEN ABCD 3 Bright A_Chase
		goto State_774
	}
}
Even if the code is a mess, as is the program is fairly useful already, so hopefully you guys get some use out of it. Report any bugs/missing stuff to me, I will try to fix them, but be aware I don't have a lot of time atm, so it may be slow. If anyone wants to modify the code for any reason, be my guest :)
Gez
 
 
Posts: 17833
Joined: Fri Jul 06, 2007 3:22 pm

Re: Basic DEHACKED-to-DECORATE converter

Post by Gez »

That's pretty cool. Would you be interested in turning this into a function in SLADE 3?
User avatar
3saster
Posts: 199
Joined: Fri May 11, 2018 2:39 pm
Location: Canada

Re: Basic DEHACKED-to-DECORATE converter

Post by 3saster »

I might take a look at that, how exactly would that done? I don't really know much about how SLADE works internally. It might also be better suited to stand-alone, as dehacked is dependent on a doom base, something SLADE isn't. I might look into it though
Gez
 
 
Posts: 17833
Joined: Fri Jul 06, 2007 3:22 pm

Re: Basic DEHACKED-to-DECORATE converter

Post by Gez »

Basically, replace all file manipulations (iostream, fstream) by MemChunk read/writes, move the base tables to the res folder (slade.pk3) and access them through App::archiveManager().programResourceArchive()->entryAtPath(<where you put them>).

Put the code in a subdirectory of MainEditor, and call the conversion function from a console command like done here. If all works, then opening an archive (including a zip file) with a dehacked lump in it, then selecting said dehacked lump and typing the conversion console command should create a decorate lump with the converted code. For increased niceties the conversion option could be added to the context menu when a dehacked lump is selected, but that's not necessary.
User avatar
3saster
Posts: 199
Joined: Fri May 11, 2018 2:39 pm
Location: Canada

Re: Basic DEHACKED-to-DECORATE converter

Post by 3saster »

Alright, when I have time I'll clone the branch and give it a try. Hopefully that'll be some time this week. Would you be the person to ask questions for how this works?
User avatar
SiFi270
Posts: 451
Joined: Tue Feb 10, 2015 2:51 am
Location: Does anyone put a serious answer here?

Re: Basic DEHACKED-to-DECORATE converter

Post by SiFi270 »

When something's originally a pickup, but DeHacked has taken the "can be picked up" property from it, then converting it to Decorate with this program removes the "SPECIAL" flag, but this isn't the same, as stated here. Does anyone know what kind of flag or property could be used instead?

If I'm confusing people again, it may help if you try making a version of Operation Rheingold with the DeHackEd converted to Decorate, and then at the very beginning of either version, go straight ahead into the bathroom and try to walk over the dead nazi found in there. Because he replaces the yellow skull, he can be picked up in the converted version, when he's supposed to be a solid object in the original. Then the problem I described above may make more sense.
User avatar
NeuralStunner
 
 
Posts: 12325
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Basic DEHACKED-to-DECORATE converter

Post by NeuralStunner »

I've wanted something like this for a long time. (I hope it supports oooooooold DEH patches that WHackEd refuses to load...)
User avatar
TDRR
Posts: 815
Joined: Sun Mar 11, 2018 4:15 pm
Operating System Version (Optional): Manjaro/Win 8.1
Graphics Processor: Intel (Modern GZDoom)
Location: Venezuela

Re: Basic DEHACKED-to-DECORATE converter

Post by TDRR »

NeuralStunner wrote:I've wanted something like this for a long time. (I hope it supports oooooooold DEH patches that WHackEd refuses to load...)
If you mean binary patches, no.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Basic DEHACKED-to-DECORATE converter

Post by Graf Zahl »

It also doesn't support ZDoom's more "advanced" features, at least the last time I tried it didn't well convert The Chosen's patch. But is this really important? The number of this types of mods is rather small. This type of Dehacked patch had roughly two years to thrive before it got superseded by real DECORATE.
User avatar
3saster
Posts: 199
Joined: Fri May 11, 2018 2:39 pm
Location: Canada

Re: Basic DEHACKED-to-DECORATE converter

Post by 3saster »

I oughtta revisit this, I was not happy with current version and would like to redo it. I should look through boom's source code and see the specifics this time, this version was written by experimentation with Whacked4 and Eternity's DeHacked documentation, IIRC.
Graf Zahl wrote:It also doesn't support ZDoom's more "advanced" features, at least the last time I tried it didn't well convert The Chosen's patch. But is this really important? The number of this types of mods is rather small. This type of Dehacked patch had roughly two years to thrive before it got superseded by real DECORATE.
I wasn't even aware that ZDoom had extended DeHacked, because if it's gonna be a ZDoom project, you might as well write it in DECORATE/ZScript, DeHacked is a pain in the ass. The main purpose of the converter was two-fold: to easily see what exactly was changed through DeHacked, and to allow Boom/Vanilla maps that make minor changes/additions to monsters & weapons to play nice with mods (Scythe 2, Ancient Aliens, Deus Vult 2, etc). Something like The Chosen doesn't make sense to play with mods anyway, being a TC and all.

If I can have a converter successfully convert Valiant's DeHacked to DECORATE, I'd be happy with it. Anything needed beyond that is superfluous and not important, as far as I'm concerned. That being said, if it can accomplish the Valiant conversion, I will publish it on GitHub; I would have published it before, but as I said I'm not happy with it.
NeuralStunner wrote:I've wanted something like this for a long time. (I hope it supports oooooooold DEH patches that WHackEd refuses to load...)
This was primarily intended for Boom/Vanilla maps that work in ZDoom by themselves. If it doesn't work in ZDoom normally, consider it beyond the scope of this converter.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Basic DEHACKED-to-DECORATE converter

Post by Graf Zahl »

3saster wrote: I wasn't even aware that ZDoom had extended DeHacked, because if it's gonna be a ZDoom project, you might as well write it in DECORATE/ZScript, DeHacked is a pain in the ass.
It may be hard to believe right now, but there was a time - back before 2004, when there was no DECORATE and anyone wanting to create some more advanced stuff was basically forced to use Dehacked. That said, The Chosen was probably the most complex projects ever made with this and this really doesn't warrant a capable converter.
mrPron
Posts: 10
Joined: Tue Jan 04, 2022 3:04 pm
Graphics Processor: nVidia with Vulkan support

Re: Basic DEHACKED-to-DECORATE converter

Post by mrPron »

Hello everyone.
Converting from DEHACKED to DECORATE I had a several questions:
1. How to interpret "Missile damage" field? "zdoom.org/wiki/Actor_properties" does not contain such a property. Is it "Damage" or "ExplosionDamage" or something else?
2. Is the "INFLOAT" flag outdated? Should I ignore it or replace it with something?
3. The "BOUNCES" flag = "BounceType Doom"?
4. The "TRANSLUCENT" flag is just "RenderStyle Translucent" or should I also set the value for "Alpha"?
5. Should I replace "A_Fall" with "A_NoBlocking", or should I leave "A_Fall"?

Edited:
OK. On the Wiki I found in the page related to "ZDoom codepointer extensions" a mention of "Missile Damage" as "The amount of damage dealt by the MonsterRail". Also newer page "A_MonsterRail" said, that it is "The amount of damage this attack inflicts is specified with the calling actor's Damage property". So I suppose that "Missile Damage" in DEHACKED is "Damage property" in DECORATE.
But I still don't figure out what the heck is "INFLOAT". If it's a flag, then why isn't it in the "Actor flags" page in Wiki? It's not a "FLOAT" flag, because it already presence in DEHACKED.
Post Reply

Return to “Creation, Conversion, and Editing”