[DECORATE] Underwater options
Moderator: GZDoom Developers
[DECORATE] Underwater options
Hello,
I've tried to make some objects which change behaviour on undewater using A_JumpIf, but I miss some global variables that should help the editing. With the actual code, we must make objects that call A_JumpIf always. So, the idea is creating some Underwater options, maybe to put into the MAPINFO lump (or DECORATE, if you do prefer, then we could do different configs to varius objects). Here they are:
UnderwaterEffect = [x]
can be 0, 1, 2, 3 according to how much the object is submerge (just like in A_JumpIf)
UnderwaterFlags = [flags]
we could add some flags, such as FLOATBOB or LOWGRAVITY, to make some desired effects.
UnderwaterGravity = [factor]
the multiplied gravity factor for underwater effect (0.5 for example)
With this, we could make monsters that float only underwater (for example: a fish)
Hope this should help!
EDIT: or the addition of the following flags should also help:
+UNDERWATER.FLOATBOB
+UNDERWATER.LOWGRAVITY
etc.
So, the only variable to be added should be UnderwaterEffect [x]
I've tried to make some objects which change behaviour on undewater using A_JumpIf, but I miss some global variables that should help the editing. With the actual code, we must make objects that call A_JumpIf always. So, the idea is creating some Underwater options, maybe to put into the MAPINFO lump (or DECORATE, if you do prefer, then we could do different configs to varius objects). Here they are:
UnderwaterEffect = [x]
can be 0, 1, 2, 3 according to how much the object is submerge (just like in A_JumpIf)
UnderwaterFlags = [flags]
we could add some flags, such as FLOATBOB or LOWGRAVITY, to make some desired effects.
UnderwaterGravity = [factor]
the multiplied gravity factor for underwater effect (0.5 for example)
With this, we could make monsters that float only underwater (for example: a fish)
Hope this should help!
EDIT: or the addition of the following flags should also help:
+UNDERWATER.FLOATBOB
+UNDERWATER.LOWGRAVITY
etc.
So, the only variable to be added should be UnderwaterEffect [x]
- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [DECORATE] Underwater options
The only thing here that might have a chance is the gravity. The rest is 'no'd.
- Cutmanmike
- Posts: 11354
- Joined: Mon Oct 06, 2003 3:41 pm
- Operating System Version (Optional): Windows 10
- Location: United Kingdom
- Contact:
Re: [DECORATE] Underwater options
Actually that's a good idea, but how does gravity work underwater right now? I.e if I dropped an imp in the water he wouldn't sink to the bottom would he?
- FuzzballFox
- Posts: 1905
- Joined: Thu Jan 24, 2008 10:19 am
- Location: Hampshire UK
Re: [DECORATE] Underwater options
Could be used for different viscosities in liquids..."Blood is thicker than water" as the saying goes...;DCutmanmike wrote:Actually that's a good idea, but how does gravity work underwater right now? I.e if I dropped an imp in the water he wouldn't sink to the bottom would he?
- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [DECORATE] Underwater options
Cutmanmike wrote:Actually that's a good idea, but how does gravity work underwater right now? I.e if I dropped an imp in the water he wouldn't sink to the bottom would he?
It doesn't use gravity but a different (hardcoded) value called SINK_SPEED.
Re: [DECORATE] Underwater options
If underwater gravity is a negative value, the object will move up, I guess... so, when it surpass the water surface, it will be affected by normal gravity... so it would be like the real force on water, woudn't?
-
CaptainToenail
- Posts: 3975
- Joined: Fri Jul 06, 2007 9:16 am
Re: [DECORATE] Underwater options
Are you trying to make objects such as boxes and barrels float in water? If so, you could use ThrustThingZ in combination with A_JumpIf(waterlevel and possibly A_Stop when it reaches the surface
Re: [DECORATE] Underwater options
Yes, but the problem is if we make this on monsters, A_JumpIf should be used every time; it will interrupt the monster activity for sure. For barrels it is quite easy. Thanks for the tip anyway.
- David Ferstat
- Posts: 1113
- Joined: Wed Jul 16, 2003 8:53 am
- Location: Perth, Western Australia
- Contact:
Re: [DECORATE] Underwater options
Graf, what's involved in exposing SINK_SPEED to ACS?Graf Zahl wrote:Cutmanmike wrote:Actually that's a good idea, but how does gravity work underwater right now? I.e if I dropped an imp in the water he wouldn't sink to the bottom would he?
It doesn't use gravity but a different (hardcoded) value called SINK_SPEED.
- David Ferstat
- Posts: 1113
- Joined: Wed Jul 16, 2003 8:53 am
- Location: Perth, Western Australia
- Contact:
Re: [DECORATE] Underwater options
Sorry for the bump, but I think Graf missed my question.:
Graf, what's involved in exposing SINK_SPEED to ACS?
Graf, what's involved in exposing SINK_SPEED to ACS?