[Added] XLAT -- Dynamic (?) Tags

Moderator: Developers

XLAT -- Dynamic (?) Tags

Postby Xaser » Sun Jan 22, 2012 4:44 am

I'm trying to get Polyobjects working in Hacx, but I've hit a stumbling block with xlat that's preventing me from making mirrored poly doors work. I've got the following lines in xlat:
Code: Select allExpand view
348 = 0,   Polyobj_StartLine(tag, tag+100, 0, 0)
349 = 0,   Polyobj_StartLine(tag, tag-100, 0, 0)

The idea is to make it so polyobjects x and 100+x are mirrors of each other (e.g. 1 and 101), but ZDoom throws a syntax error when trying to use any sort of mathematical operation alongside "tag" (although it works fine with straight constants). Would it be at all possible to add support for mathematical operations to the tag var? With only a single static value usable by xlat, it's not possible to set the 'mirror' field, making this pretty much unworkable.

Without this, I'm afraid I can't progress any further on making this feature work on the ZDoom side (it's all set up in Eternity), unless there's some other way to set up polyobject line specials in Doom format. A bit frustrating that it can be stretched this close but not enough to work. :(
User avatar
Xaser
secretly a supercomputer being a government
 
Joined: 20 Jul 2003
Location: .plɹoʍɹǝʌǝu.

Re: XLAT -- Dynamic (?) Tags

Postby Gez » Sun Jan 22, 2012 5:00 am

Unfortunately, xlat uses lemon and it's crazy complicated to make lemonade out of it.

You'd be better off going the Strife support route and use ACS script 0. Look at strifehelp.acs and the Strife xlat for info.
Gez
 
Joined: 06 Jul 2007

Re: XLAT -- Dynamic (?) Tags

Postby Xaser » Sun Jan 22, 2012 5:09 am

Shortly after posting this, I ended up trying my hand at some ACS anyway and got the problem mostly solved without such attempted XLAT hacks (or is that "hacx"? :P ). Guess we can mark it as a "nice to have but probably not doable."

While we're on the topic, I'm having some slight trouble with ZDoom's handling of mirrored polyobjects -- the engine is tossing up an "EV_OpenPolyDoor: Invalid polyobj num: x" error when trying to open a door if the corresponding "pseudo-mirrored" poly is missing. Is there any way to get the engine to suppress the message? Otherwise I'd have to make a third tag range for defining non-mirrored polyobjects, which leads to a lot of copypasta on the EE side. Might have to do that anyway, though, depending on whether or not EE prints an error in this case as well.

[EDIT] Eternity doesn't seem to mind if the mirrored poly is missing (it's actually set up as a legit mirror there, though the behavior is the same in either case). I wonder if it's possible to get away with just nulling the error message in LANGUAGE, as terrible a hack as that would be. Is there a way to check if a polyobject with a certain ID exists within ACS? That'd be better, of course.

[DOUBLE-EDIT] GetPolyobjX should do. I have an odd habit of asking a question then answering it myself. :P

Finally, is it safe for Hacx to actually implement Script #0? I figured it was engine-reserved for Strife so I'm just using a high number right now (#888) for the extra effects.

Thanks, by the way. ;)
User avatar
Xaser
secretly a supercomputer being a government
 
Joined: 20 Jul 2003
Location: .plɹoʍɹǝʌǝu.

Re: XLAT -- Dynamic (?) Tags

Postby randi » Sun Jan 22, 2012 5:57 pm

Gez wrote:Unfortunately, xlat uses lemon and it's crazy complicated to make lemonade out of it.

What makes you say that? This is exactly the sort of thing that a good parser generator makes very, very easy to do. (And now it's done.)

BTW, the original xlat parser was written for bison and was later ported to lemon to make it easier to build on non-Unix boxes. (That lemon is a better generator was a minor consideration.)
User avatar
randi
Site Admin
 
Joined: 09 Jul 2003

Re: XLAT -- Dynamic (?) Tags

Postby Blzut3 » Sun Jan 22, 2012 6:44 pm

Just a thought, wouldn't division and modulo be more useful operations? Consider Polyobj_StartLine(tag%256, tag/256, 0, 0) would allow 255 poly objects to be defined with any combination of mirroring. I think this would solve Xaser's missing mirror problem too. (Alternatively tag&255 and tag>>8 of course.)
Blzut3
Pronounced: B-l-zut
 
Joined: 24 Nov 2004

Re: XLAT -- Dynamic (?) Tags

Postby Xaser » Sun Jan 22, 2012 7:26 pm

Actually, a division/modulo method might be a bit more in line with what I'm doing if I could get a certain something working on Eternity's side. Might actually make it easier in a way. ;)

What I'm actually trying to do here, for the record, is use ExtraData on Eternity's side to set up a bunch of polyobject door specials by treating the tag field as a flag-list of sorts to pass parameters. The lowest two digits are the tag and the upper three represent different special options like direction, door length, angle, etc. Interestingly, since ExtraData is a definition language rather than a scripting one, this ends up translating to having a megahuge number of lines (~10,000 or so) so I needed to write a perl script to generate the file. Talk about some serious stretching. :P

Anyhow, thanks so much for adding this, Randy. Just noticed you sneak in some more operators in the changelog as well. Guess the improved version is still on. ;)
User avatar
Xaser
secretly a supercomputer being a government
 
Joined: 20 Jul 2003
Location: .plɹoʍɹǝʌǝu.

Re: XLAT -- Dynamic (?) Tags

Postby randi » Sun Jan 22, 2012 7:27 pm

Okay, that's reasonable enough. You can now use any of xlat's existing operators with tags (with the caveat that the left-hand side must be tag and the right-hand side must be a constant.)

[Also, you are a ninja poster. :ninja:]

Is bit-wise AND good enough, or do you need modulus? The lexer being used doesn't recognize %, so it would be more work to add that. (That's not code I wrote, so I'm not sure how involved it would actually be.) Is it good enough that you can only use tag on the left of the operator? Changing that could be done, but it would be more involved, since xlat is currently set up such that all expressions can be evaluated at parse time, so the parser can do it itself and hide the details from the line translator part.
User avatar
randi
Site Admin
 
Joined: 09 Jul 2003

Re: XLAT -- Dynamic (?) Tags

Postby Xaser » Sun Jan 22, 2012 7:53 pm

Hmm, after discussing it in IRC with Blzut3 and DavidPH, I don't think it'll work yet. I'm actually trying to solve a different problem from the aforementioned mirror issue now, and it involves extracting individual digits from the tag field, e.g. (tag/10)%10, which would unfortunately require both modulus and multiple operations. That would involve diving into the rewrite, I'm afraid, since this is the only way I know of to avoid having to define Polyobject_StartLine twice in the map (one for ZDoom and one for EE), which would make my planned ExtraData helper DB2 plugin seem rather useless on its own. :P

I almost feel as if I should try and code this myself considering how special-use it is at the moment, but my only real experience with parser writing was a bit of frustrating keyboard-bashing with lex and yacc that yielded an unusable program. Think I would've preferred it if life had handed me lemon that day. :P
User avatar
Xaser
secretly a supercomputer being a government
 
Joined: 20 Jul 2003
Location: .plɹoʍɹǝʌǝu.

Re: XLAT -- Dynamic (?) Tags

Postby randi » Sun Jan 22, 2012 11:34 pm

I think what's present now should exactly fit your needs, yes?
User avatar
randi
Site Admin
 
Joined: 09 Jul 2003

Re: XLAT -- Dynamic (?) Tags

Postby Xaser » Sun Jan 22, 2012 11:38 pm

Looking at the changelog, it appears so. I'll give it a try presently.

Mighty fine thanks, sir. The Hacx team salutes you. ;)
User avatar
Xaser
secretly a supercomputer being a government
 
Joined: 20 Jul 2003
Location: .plɹoʍɹǝʌǝu.

Re: XLAT -- Dynamic (?) Tags

Postby Xaser » Mon Jan 23, 2012 1:49 am

Quick bumpdate -- I've given it a test and it indeed works just as planned. This is gonna prevent a lot of silly duplication. :)
User avatar
Xaser
secretly a supercomputer being a government
 
Joined: 20 Jul 2003
Location: .plɹoʍɹǝʌǝu.

Re: XLAT -- Dynamic (?) Tags

Postby Gez » Mon Jan 23, 2012 4:32 am

randy wrote:
Gez wrote:Unfortunately, xlat uses lemon and it's crazy complicated to make lemonade out of it.

What makes you say that? This is exactly the sort of thing that a good parser generator makes very, very easy to do. (And now it's done.)

Mostly, I don't understand how it works at all. :p

I once wanted to be able to translate thing types, so that for example thing #47 would become thing #89. This could be used to deal with some compatibility problems with conflicting doomednums.
Gez
 
Joined: 06 Jul 2007

Re: XLAT -- Dynamic (?) Tags

Postby Graf Zahl » Mon Jan 23, 2012 7:16 pm

Oh my!

This got to be one of the most useless features in ZDoom ever... :mrgreen:

Was it really worth this amount of work to add? How many people actually use Doom format maps with such extremely specialized line types.
User avatar
Graf Zahl
 
Joined: 19 Jul 2003
Location: Germany

Re: XLAT -- Dynamic (?) Tags

Postby randi » Mon Jan 23, 2012 7:23 pm

The total time spent on it was less than two hours, and it was fun, so it's really no big deal.
User avatar
randi
Site Admin
 
Joined: 09 Jul 2003

Re: XLAT -- Dynamic (?) Tags

Postby Zippy » Tue Jan 24, 2012 1:28 am

Gez wrote:
randy wrote:
Gez wrote:Unfortunately, xlat uses lemon and it's crazy complicated to make lemonade out of it.

What makes you say that? This is exactly the sort of thing that a good parser generator makes very, very easy to do. (And now it's done.)

Mostly, I don't understand how it works at all. :p
This has always been my problem. Maybe the professor who originally explained it to me was a little off the mark, or maybe the assignments just weren't the right ones. But whatever the case, it broke my spirit forever. Every look at parser generation is a reminder of sleepless times. Of nights spend strained and drained, exhausted and beaten by an unseen foe. His invisible hand strikes me from beyond the veil. And to try and glimpse him... is like staring into infinite agonies, a waking nightmare of unending pain. Tokens! Tokens screaming in the night! Can't you hear them?! Drowning in a sea of collapsing regular expressions! They're calling for me... they want to drag me under, to choke me out until I am joined with them forever in the darkness!

Oh, Light! Oh, Salvation! Keep this evil at bay!
User avatar
Zippy
Scathing political commentary!
 
Joined: 23 Mar 2005
Location: Rochester

Next

Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests