So, as everyone in the Discord knows, I've been writing a quick and dirty Java program to convert a pile of DECORATE code into ZScript for me, with the intent on making it public, because, you know, there are a lot of people with projects that were written in DECORATE and could be better if they could use ZScript insread... SO HERE IT IS!
This is a Zip File containing the JAR and the (incredibly sloppy) source code, as well as a sample file to test it on.
You run it by tossing it in the command line as "java -jar <jarfile here> <.DEC File> [options]"
OR (new!) you can use the .bat file I included, which you pass a directory to, to automatically go through a while folder at once.
Upon running, it will create a (mostly accurate) rewrite of the DECORATE file, using the filename of whatever you threw in with the ".txt" or ".dec" replaced with ".zsc". (I advise against using any file names that don't have a 3 character suffix, because I was sick and lazy when I wrote the file-extension changer, and just had it replace the last 3 characters)
If you want it to output what it comes up with to the command line directly, use the "-debug" option.
If you want it to not write a file, use the "-nofile" option.
Some notes:
- This is a really sloppy program, so I make no promises about it. It shouldn't create any real problems, because it's just JAVA reading one text file and writing another, which is one of the most basic functionalities, but I'm still going to go with the usual "this is free software and I make no garuntee that it works properly" disclaimer. The worst that I think will happen though is either a) it won't run on some systems, or b) it will output bad ZScript.
- I tested this with a couple of ZDoom's built-in DECORATE files, and it worked with them, but it's very sloppy, and I didn't exactly write it to be robust. I can't say what errors the code it will output might have, but probably stuff like not having parentheses after an actor_function in the middle of a state block, or putting a semicolon in the wrong place. I CAN say that the ZScript files it outputs are accurate enough that it will save you a buttload of time when you DON'T have to rewrite the whole thing by hand, and I have a really nice butt, so...
- Oh, and this will totally fuck with your bracket placement, but it should still come up legal.
- If anyone wants to like, rewrite this thing, or improve upon it, I encourage this. I wrote this because I needed it for something, and I spiffed it up and am making it public because I know the community will benefit from having access to it. All I ask is that you like, mention that Raccoon wrote the original, or whatever.
KNOWN BUGS:
- After running this on some DECORATE files from a project, I noticed that it will sometimes stop parsing properly mid-file. This will be apparent, because it stops putting in semicolons. I'm not yet sure why, though I suspect it has something to do with a case it wasn't built for. I suggest putting the DECORATE code after wherever it stared into its own file and running the converter again, if it's too much left to just do it manually.
- - This happens less now after I patched it.
- This program does not know or compensate for "var" tags. You will have to fix those manually. I think I could get it to yank them and redo the lines when it closes the Default block as a fix.
-
- this program ignores Damage Type definitions, because I forgot to have it handle that. It would be better if it either ignored them, or spat them out as a separate thing.
- this program doesn't understand that, while it's ok to not surround things like Damagetypes
- - I have it sticking quotes around RenderStyles in most cases now.
- A_Setuservar and A_SetuserArray don't convert properly either, unless you add in ZScript to make them function like they do in DEC.
-
-
- Should snip the DOOMED numbers in the Actor declarations, but doesn't.
- Doesn't know to replace "Damage" with "DamageFunction"