User:Digiku/2.2/Fade features
FOF, PolyObject, and Colormap fading!
- 420 Light Fade: Added ability to specify fade duration in tics, rather than speed increment
- 447 Change Colormap: Instantly set a target sector's colormap, including relative adding of the current color
- 452 Change FOF Translucency: Instantly set a target FOF's alpha value
- 453 Fade FOF Translucency: Fade FOF's alpha along with collision and lighting
- 454 Stop Fading FOF
- 455 Fade Colormap: Fade target sector's colormap, including relative adding of the current color
- 456 Stop Fading Colormap
- 492 Fade PolyObject: Fade PolyObject's alpha along with collision
YouTube
Linedef Exec 420: Fade Lighting add duration timing
Type 420 Fade Lighting took an input x/tic
to change the lightlevel x times per tic.
I added the ability to specify how long the fade should last in tics. Per frame:
- I take the (percentage of duration that elapsed)
- I apply that percent to (endlightlevel - startlightlevel)
- Then I add that to the startlightlevel.
I added these flags to the special:
ML_EFFECT4
- Enable tic-based logicremoved, no reason to have thisML_TFERLINE
- Use exact light values for OpenGL. Else by default, lighting is snapped to the 32 Software levels.ML_DONTPEGBOTTOM
- Use alternate inputs. Else by default, use the old sector brightness and line length inputs.Front X Offset
: Brightness level to fade toFront Y Offset
: x/tic speed, or ifML_EFFECT4
, then duration in tics.
Example
- File:Test lightfade.wad - MAP01. Defining light fade duration by tics.
Linedef Exec 447: Change Colormap relative value calc
This rebases Linedef Exec 447 Change Colormap on !189 Colormap code overhaul and adds the following features:
ML_EFFECT3
: Calculate change relative to the target sector's current colormap (i.e., this line's RGBA values are added onto the current colormap's RGBA values)ML_EFFECT1
: Subtract RML_NOCLIMB
: Subtract GML_EFFECT2
: Subtract B
ML_DONTPEGBOTTOM
: Specify base alpha byFront X Offset
and fade/dark alpha byFront Y Offset
. Set negatives here to subtract alpha if `ML_EFFECT3 is set.ML_TFERLINE
: Use the back sidedef's colormap instead of the target sector's current colormap to calculate relative change
Linedef Exec Action: Fade FOF
Introduces Linedef Exec Action 452 Set FOF Translucency, 453 Fade FOF, 454 Stop Fade FOF.
By default, this affects the alpha level; and, as appropriate, toggles FF_EXISTS
, FF_TRANSLUCENT
, and collision flags like FF_SOLID
. Toggles exist to disable these behaviors.
Type 452: Set FOF Translucency
Front X offset
: FOF target sector tagFront Y offset
: FOF control sector tagBack X offset
: Alpha target, 1-256ML_EFFECT3
: Alpha target is relative to current FOF alpha. Negative value subtracts.
ML_NOCLIMB
: Do not handleFF_TRANSLUCENT
and appropriate culling flags likeFF_CUTLEVEL
Type 453: Fade FOF
Front X offset
: FOF target sector tagFront Y offset
: FOF control sector tagBack X offset
: Alpha target, 1-256ML_EFFECT3
: Alpha target is relative to current FOF alpha. Negative value subtracts.
Back Y offset
: Speed, x/tic, 1+. If 0, then set immediately without fade.ML_EFFECT4
: Timing is tic-based (Back Y Offset
refers to tic duration)
ML_BLOCKMONSTERS
: Do not handleFF_EXISTS
ML_NOCLIMB
: Do not handleFF_TRANSLUCENT
and appropriate culling flags likeFF_CUTLEVEL
ML_BOUNCY
: Do not handle collision flags likeFF_SOLID
orFF_SWIMMABLE
ML_EFFECT1
: No collision during fading ("ghost fade")ML_EFFECT2
: Do not handle lighting or colormapsML_TFERLINE
: Use exact alpha values in OpenGL instead of the 9 alpha levels from Software
Default behavior is to:
- Handle
FF_EXISTS
: If alpha > 0, forceFF_EXISTS
. Else, remove the flag. - Handle
FF_TRANSLUCENT
: If alpha < 256, forceFF_TRANSLUCENT
. Else, remove the flag and make opaque. - Handle collision flags: During the fade routine, set such flags as
FF_SOLID
andFF_SWIMMABLE
if they were set on spawn. They are unset when reaching the destvalue on a fade out. - Handle lighting and colormap: They fade out along with the FOF.
- Collision is always set during the fade routine. But, if ghost fade is enabled (
ML_EFFECT1
), collision is turned off during the fade routine. If fading in, it is turned on at end of fade. If fading out, it remains off.
Example
- File:Test fadefof.wad - MAP01 thru MAP10. Test fading FOFs into existence and out of existence for every type of FOF.
Type 454: Stop Fading FOF
Front X offset
: FOF target sector tagFront Y offset
: FOF control sector tagML_BLOCKMONSTERS
: Do not finalize fading collision flags; default is to do so.
Linedef Exec 455 Fade Colormap, 456 Stop Fading Colormap
Fade colors!
455 Fade Colormap Spec
ML_EFFECT3
: Calculate change relative to the target sector's current colormap (i.e., this line's RGBA values are added onto the current colormap's RGBA values)ML_EFFECT1
: Subtract RML_NOCLIMB
: Subtract GML_EFFECT2
: Subtract B
ML_DONTPEGBOTTOM
: Specify base alpha byFront X Offset
and fade/dark alpha byFront Y Offset
. Set negatives here to subtract alpha ifML_EFFECT3
is set.ML_TFERLINE
: Use the back sidedef's colormap instead of the target sector's current colormap to start fadingML_BOUNCY
: Disable behavior where fading from no colormap overrides the target sector's RGB colormap value (because by default, it's #000000, so the behavior is to initialize that to the destination colormap's RGB value but not the alpha)Front Y Offset
orBack Y Offset
: Fade speed increment, out of 256 (unlessML_DONTPEGBOTTOM
is set, then this must beBack Y Offset
)ML_EFFECT4
: Specify fade duration in tics instead.
Example
- File:Test colormap.wad - MAP01. Control colormap fading.
456 Stop Fading Colormap Spec
- Nothing! (Tagged sector stops the fade thinker)
Linedef Exec 492: Fade PolyObject
Add translucency fading for PolyObjects.
No Stop Fade special this time, because the other specials also do not have a stop mechanism.
Other tasks I performed:
- I fixed Linedef Exec 490 Set PolyObject Visible to set the correct render flags according to spawnflags.
- I added a couple flags for Linedef Exec 491 Set PolyObject Translucency
492: Fade PolyObject Spec
Front X Offset
ORFront Floor Height
: 1000-based alpha value to fade to, like Type 491ML_DONTPEGBOTTOM
: Specify raw translucency value insteadML_EFFECT3
: Calculate relative to current PolyObject alpha
Front Y Offset
: x/tic increment speed, out of 256.ML_EFFECT4
: Specify tic-based duration instead
ML_BOUNCY
: Do not handle collision flagsML_EFFECT1
: No collision during fading ("ghost fade")
Example
- File:Test polytrans.wad - MAP01. Test fading PolyObject into and out of existence.
491: Set PolyObject Translucency Spec
Front X Offset
ORFront Floor Height
: 1000-based alpha value to fade to, like Type 491ML_DONTPEGBOTTOM
: Specify raw translucency value insteadML_EFFECT3
: Calculate relative to current PolyObject alpha