Support for Legacy's "mist" trick

Moderator: Graf Zahl

Sussudio
Posts: 98
Joined: Tue Jul 14, 2009 21:49

Support for Legacy's "mist" trick

Post by Sussudio » Sun Sep 27, 2009 9:59


Gez
Developer
Developer
Posts: 1399
Joined: Mon Oct 22, 2007 16:47

Re: Support for Legacy's "mist" trick

Post by Gez » Sun Oct 04, 2009 9:42

Support for that trick is already there.
http://forum.zdoom.org/viewtopic.php?f=3&t=23726

The issue here is that the Legacy effects aren't emulated correctly.
Here's the xlat applied to them:

Code: Select all

/****** Legacy linetypes ******/
273 = WALK|REP,		FS_Execute(tag, 1)
274 = WALK,			FS_Execute(tag)
275 = WALK,			FS_Execute(tag, 1)
276 = USE|REP,		FS_Execute(tag)
277 = USE,			FS_Execute(tag)
278 = SHOOT|REP,	FS_Execute(tag)
279 = SHOOT,		FS_Execute(tag)
280 = 0,			Transfer_Heights (tag, 12)
281 = 0,			Sector_Set3DFloor(tag, 1, 0, 255)
282 = 0,			Static_Init(tag, 1)

// No, I haven't actually looked at these in Legacy. But these look like they
// should give results equivalent to hardware Legacy rendering.
284 = 0,			TranslucentLine (lineid, 128, 0)
285 = 0,			TranslucentLine (lineid, 192, 0)
286 = 0,			TranslucentLine (lineid,  48, 0)
287 = 0,			TranslucentLine (lineid, 128, 1)

288 = 0,    		TranslucentLine(lineid, 255, 0)
289 = 0,     		Sector_Set3DFloor(tag, 1, 1, 255)

300 = 0,     		Sector_Set3DFloor(tag, 1, 1, 127)
301 = 0,     		Sector_Set3DFloor(tag, 2, 2, 127)
302 = 0,     		Sector_Set3DFloor(tag, 3, 6, 127)
303 = 0,     		Sector_Set3DFloor(tag, 3)
304 = 0,     		Sector_Set3DFloor(tag, 2, 2, 255)
305 = 0,     		Sector_Set3DFloor(tag, 3, 2)
306 = 0,     		Sector_Set3DFloor(tag, 1)

332 = 0,			Sector_Set3DFloor(tag, 4)
Judging from the Legacy screenshot, the control sector's texture is not used. It is used in GZDoom. The map uses linetypes 281, 301 and 303. (Also 282:Create Colormaps and 273:FS Start Script One-Way Trigger; but those work).

So it looks more like a bug than a missing feature.

User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: Support for Legacy's "mist" trick

Post by Graf Zahl » Sun Oct 04, 2009 9:48

Actually, GZDoom uses the textures as should be expected. Legacy does not.

Furthermore, I never tried to make this 100% Legacy compatible. It'd be a futile undertaking considering how many bugs and cheap hacks that engine contains.

I'll have to investigate what special hack case they triggered here.

User avatar
Enjay
There is no dark side in the moon, really...
Developer
Developer
Posts: 4643
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Re: Support for Legacy's "mist" trick

Post by Enjay » Sun Oct 04, 2009 9:57

It's be a nice effect if you could manage to include it, as would the old water effect that was removed from Legacy some time ago.
However, I know that you have other priorities and I don't expect the "mist" to happen soon and, to be fair, I'd be very surprised if the water effect ever got included. Even I can see that it probably wouldn't be worth the effort. :)

User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: Support for Legacy's "mist" trick

Post by Graf Zahl » Sun Oct 04, 2009 11:21

I don't even have source that manages that water effect. I have no idea what the Legacy programmers hacked together back then. And after all they removed it for a reason (probably that it was too dependent on certain hardware or something like that.) If it had worked they wouldn't have removed it.

Gez
Developer
Developer
Posts: 1399
Joined: Mon Oct 22, 2007 16:47

Re: Support for Legacy's "mist" trick

Post by Gez » Sun Oct 04, 2009 11:31

It seems Legacy's water trick code survived at least until 1.29b16, which can be downloaded from the remood site. Browsing through the code is certainly enlightening as for why Legacy has all the bugs it's famous for... Anyway, the trick apparently involved drawing an extra plane, rippling its texture, and then playing with the colormap index of what's below it to make them brighter or darker. The code is all over the place, half of it is commented out, and half of the comments are in French. I'd guess they removed it because they couldn't make sense out of it.

The fact that it is buggy as hell may also have been a factor. While the effect is neat, try shrinking a bit your screenblocks and look what happens to it. Funny, isn't it?

But I don't think it was dependent on hardware because it worked right out the box on my laptop, who must not have much in common with whatever they used at the time...

Sussudio
Posts: 98
Joined: Tue Jul 14, 2009 21:49

Re: Support for Legacy's "mist" trick

Post by Sussudio » Tue Oct 06, 2009 10:05

That water effect kicks serious arse, and wow, works in software mode. I also remember this wad would sometimes crash Legacy after a couple of minutes or so, but guess it must have been a bad combination of hardware/os/drivers because it seems 100% stable on my current system.

jengelh
Posts: 41
Joined: Sat Jun 24, 2006 10:21
Contact:

Re: Support for Legacy's "mist" trick

Post by jengelh » Tue Oct 06, 2009 13:36

The water plane is actually an animation out of 8 flat images. You can find them in legacy.wad or something—if not, I still have them.

User avatar
Enjay
There is no dark side in the moon, really...
Developer
Developer
Posts: 4643
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Re: Support for Legacy's "mist" trick

Post by Enjay » Tue Oct 06, 2009 16:09

Yes, but it's more than that because the area under the water has a wavy refraction-like distortion effect applied to it too.

Gez
Developer
Developer
Posts: 1399
Joined: Mon Oct 22, 2007 16:47

Re: Support for Legacy's "mist" trick

Post by Gez » Tue Oct 06, 2009 18:23

Yeah, it's distorted on both axes and the light level shifts. The effect is fine; the implementation, however, is awful. Not having the code for it gives someone a better chance to replicate than having it. :P

jengelh
Posts: 41
Joined: Sat Jun 24, 2006 10:21
Contact:

Re: Support for Legacy's "mist" trick

Post by jengelh » Tue Oct 06, 2009 19:31

Random thought on visuals, not code: the IOR effect of the water seems to be almost that of Quake2. Cube may have similar math too.

User avatar
Enjay
There is no dark side in the moon, really...
Developer
Developer
Posts: 4643
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Re: Support for Legacy's "mist" trick

Post by Enjay » Tue Oct 06, 2009 19:59

I'm trying to remember how the effect was applied from a mapping point of view. Wasn't it something odd like you had to give the sector concerned a negative tag to the value of the depth of the water?

User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: Support for Legacy's "mist" trick

Post by Graf Zahl » Tue Oct 06, 2009 20:40

Yes, something like that. Typical Legacy. Why do a clean implementation if you can hack it together?

Gez
Developer
Developer
Posts: 1399
Joined: Mon Oct 22, 2007 16:47

Re: Support for Legacy's "mist" trick

Post by Gez » Tue Oct 06, 2009 22:12

Enjay wrote:I'm trying to remember how the effect was applied from a mapping point of view. Wasn't it something odd like you had to give the sector concerned a negative tag to the value of the depth of the water?
It was a placeholder solution. Probably waiting for them to come up with an idea on how to implement it properly.
HOW TO PUT WATER IN YOUR LEVELS
You can put some water in your levels, by setting a sector's tag to a negative value. The absolute value will be the sector's water height. E.g.: sector floor 0, ceiling 128, tag: -64 : water height is 64. Legacy will say something like 'level uses dck-water hack', in the console.

When the water will be finished, it will not use the sector's tag anymore. But there will probably be an in-house program that allows editing some Legacy features in your level, it will check for negative tags and convert it to the latest specs, so you can use it now without having to re-do the water in your levels later.
What they did in the end was removing the effect altogether! :P

User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: Support for Legacy's "mist" trick

Post by Graf Zahl » Sun Oct 25, 2009 17:13

I still haven't figured out how the mist trick works.

It seems to be typical Legacy. Utterly shitty code thrown together without the slightest consideration of stability and maintainability.

It's really like everything the old Legacy team did: Total crap. Logically the only features I ever ported were coded by other people or didn't need an understanding of Legacy's code.

On a related note: I had a look at the setcorona code. Again the same style: All over the place, no thought put into it, ugly as hell and totally unusable. For example, the y-offset they set for their lights seems to come out of nowhere. I have no idea what they used as the origin. Maybe the center of the sprite graphic but I'm not really sure as that code makes my head hurt, bad as it is.

Sometimes I wonder how that engine could even work to the degree it did - which wasn't very high...

Locked

Return to “Closed Feature Suggestions”