Basic DEHACKED-to-DECORATE converter

Any utility that assists in the creation of mods, assets, etc, go here.

Basic DEHACKED-to-DECORATE converter

Postby 3saster » Sat Jun 23, 2018 10:42 am

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/1PpLIowXrpn3esDI5R6RL-k2QsmUFABUW/view?usp=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 allExpand view
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 :)
User avatar
3saster
 
Joined: 11 May 2018
Location: Canada

Re: Basic DEHACKED-to-DECORATE converter

Postby Gez » Sun Jun 24, 2018 5:28 pm

That's pretty cool. Would you be interested in turning this into a function in SLADE 3?
Gez
 
 
 
Joined: 06 Jul 2007

Re: Basic DEHACKED-to-DECORATE converter

Postby 3saster » Sun Jun 24, 2018 11:46 pm

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
User avatar
3saster
 
Joined: 11 May 2018
Location: Canada

Re: Basic DEHACKED-to-DECORATE converter

Postby Gez » Mon Jun 25, 2018 5:46 am

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.
Gez
 
 
 
Joined: 06 Jul 2007

Re: Basic DEHACKED-to-DECORATE converter

Postby 3saster » Tue Jun 26, 2018 8:18 pm

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
3saster
 
Joined: 11 May 2018
Location: Canada

Re: Basic DEHACKED-to-DECORATE converter

Postby SiFi270 » Sun Nov 25, 2018 2:05 pm

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
SiFi270
 
Joined: 10 Feb 2015
Location: Does anyone put a serious answer here?

Re: Basic DEHACKED-to-DECORATE converter

Postby NeuralStunner » Tue Jan 08, 2019 6:05 pm

I've wanted something like this for a long time. (I hope it supports oooooooold DEH patches that WHackEd refuses to load...)
User avatar
NeuralStunner
Cuddly but Packin'
 
 
 
Joined: 21 Jul 2009
Location: Indiana, USA
Discord: NeuralStunner#1293
Operating System: Windows Vista/7 64-bit

Re: Basic DEHACKED-to-DECORATE converter

Postby TDRR » Wed Jan 09, 2019 4:30 pm

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
TDRR
putting jelly on this hot dog
 
Joined: 11 Mar 2018
Location: Venezuela

Re: Basic DEHACKED-to-DECORATE converter

Postby Graf Zahl » Fri Jan 11, 2019 12:35 pm

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
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Basic DEHACKED-to-DECORATE converter

Postby 3saster » Fri Jan 11, 2019 8:38 pm

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
3saster
 
Joined: 11 May 2018
Location: Canada

Re: Basic DEHACKED-to-DECORATE converter

Postby Graf Zahl » Mon Jan 14, 2019 12:58 pm

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.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany


Return to Editors / Asset Manipulation

Who is online

Users browsing this forum: No registered users and 0 guests