Difference between revisions of "Env fade"

From Valve Developer Community
Jump to: navigation, search
(Image added)
(Reverted to previous version)
 
Line 1: Line 1:
{{otherlang2
+
{{lang|Env fade}}
|ru=env_fade:ru
+
[[File:env_fade.png|left|link=]]{{base point|env_fade}} It controls screen fades to or from a solid color.  Add '''Duration''' and '''Hold Time''' together for the total time this entity will be in effect.
}}
 
  
{{base point|env_fade}}  
+
{{code class|CEnvFade|EnvFade.cpp}}
  
==Entity description==
+
{{clr}}
[[File:env_fade.png|left|link=]]
 
It controls screen fades. Screen fades are used to blend regular game imagery to or from a solid color.  Add '''duration''' and '''holdtime''' together for the total time this entity will be in effect.
 
The modulate flag on <code>env_fade</code> uses a different kind of blending to achieve the fade. The normal fade does a straight weighted blend between the screen and the fading color (i.e. the fade color becomes a more/less opaque overlay over the scene). Modulate actually attenuates the screen colors in RGB with the fade color. So you could, for example, remove all of the red and blue from a scene with modulate and be left with a green overlay - well, sort of night vision anyway. The fade color for that would be pure green with modulate.{{clr}}
 
  
== Keyvalues ==
+
==ConVars/Commands==
{{KV|Duration (seconds)|string|The time that it will take to fade the screen in or out.}}
+
{{varcom|start}}
{{KV|Hold Fade (seconds)|string|The time to hold the faded in/out state.}}
+
{{varcom|fadein|float int int int 0|Time (seconds), Red, Green, Blue, {{todo}}|Makes the screen black (or the specified color), then fades to the normal view. {{todo|Why is the last number required?}}}}
{{KV|Fade Alpha|integer|Alpha of the fade, where 0 {{=}} fully transparent and 255 {{=}} fully opaque.}}
+
{{varcom|fadeout|float int int int 0|Time (seconds), Red, Green, Blue, {{todo}}|Fades the screen to black (or the specified color). {{todo|Why is the last number required?}}}}
{{KV|Fade Color (R G B)|color255|Fade color.}}
+
{{varcom|end}}
{{KV|Reverse Fade Duration (seconds)|float|The duration of the reverse fade.|since=P2}}
 
{{KV Targetname}}
 
  
== Flags ==  
+
==Flags==  
[[File:Env fade flag 4.jpg|thumb|150px|right|The Flags menu will show this for Flag 4 (Turn off SmartEdit and type spawnflags 4).]]
+
*1: Fade From - Screen fades ''from'' the specified color instead of ''to'' it.
* 1 : Fade From
+
*2: Modulate - Uses attenuation blending to achieve the fade. The normal fade does a straight weighted blend between the screen and the fading color. Modulate actually attenuates the RGB channels. For example, a color of <code>0 255 0</code> would mute the red and blue channels and create a green nightvision-type effect.
:Essentially a "fade in," where the screen begins from an opaque color.  
+
*4: Triggering player only {{not in FGD}} - Only affects the screen of the {{ent|!activator}}. <code>!activator</code> is probably the easiest to reach through a [[trigger]] entity. If not checked, the fade will apply to all players.
* 2 : Modulate
+
*8: Stay Out - Fade remains indefinitely until another fade deactivates it.
:Use attenuation blending, see [[#Entity Description|Entity Description]].
+
 
* 4 : Triggering player only  
+
==Keyvalues==
:Only affect activator.
+
{{KV|Duration (seconds) (duration)|string|The time that it will take to fade the screen in or out.}}
:{{note|This flag exists in all Source games, but isn't listed in the FGD, if you don't want to edit the FGD to get it, just add 4 to your current spawnflags.}}
+
{{KV|Hold Fade (seconds) (holdtime)|string|The time to hold the faded in/out state.}}
* 8 : Stay Out
+
{{KV|Fade Alpha (renderamt)|integer|Alpha of the fade, where 0 {{=}} fully transparent and 255 {{=}} fully opaque.}}
:The fade remains indefinitely until another fade deactivates it. This prevents the ondeath-fadeout used in Portal 2.
+
{{KV|Fade Color (R G B) (rendercolor)|color255|Fade color.}}
 +
{{KV|Reverse Fade Duration (seconds) (ReverseFadeDuration)|float|The duration of the reverse fade.|since=P2}}
 +
{{KV BaseEntity|css=1}}
  
 
==Inputs==
 
==Inputs==
 
{{IO|Fade|Start the screen fade.}}
 
{{IO|Fade|Start the screen fade.}}
 
{{IO|FadeReverse|Begin doing the reverse of the current fade.|since=P2}}
 
{{IO|FadeReverse|Begin doing the reverse of the current fade.|since=P2}}
{{I Targetname}}
+
{{IO|Alpha|nofgd=1|Changes '''Fade Alpha'''.}}
 +
{{IO|Color|nofgd=1|Changes '''Fade Color'''.}}
 +
{{I BaseEntity|prel4d=1}}
  
 
==Outputs==
 
==Outputs==
{{IO|OnBeginFade|Fired when the fade has begun. {{activator|activator}}}}
+
{{IO|OnBeginFade|Fired when the fade has begun.}}
{{O Targetname}}
+
{{O BaseEntity|l4d=1}}
  
 
[[Category:GUI Entities]]
 
[[Category:GUI Entities]]

Latest revision as of 16:26, 20 November 2018

Русский 
Env fade.png
env_fade is a point entity available in all Source games. It controls screen fades to or from a solid color. Add Duration and Hold Time together for the total time this entity will be in effect.

In code, it is represented by class CEnvFade, defined in EnvFade.cpp.

ConVars/Commands

ConVar/CommandParameters or default valueDescriptorEffect
fadeinfloat int int int 0Time (seconds), Red, Green, Blue, To doMakes the screen black (or the specified color), then fades to the normal view. To do: Why is the last number required?
fadeoutfloat int int int 0Time (seconds), Red, Green, Blue, To doFades the screen to black (or the specified color). To do: Why is the last number required?

Flags

  • 1: Fade From - Screen fades from the specified color instead of to it.
  • 2: Modulate - Uses attenuation blending to achieve the fade. The normal fade does a straight weighted blend between the screen and the fading color. Modulate actually attenuates the RGB channels. For example, a color of 0 255 0 would mute the red and blue channels and create a green nightvision-type effect.
  • 4: Triggering player only !FGD - Only affects the screen of the !activator. !activator is probably the easiest to reach through a trigger entity. If not checked, the fade will apply to all players.
  • 8: Stay Out - Fade remains indefinitely until another fade deactivates it.

Keyvalues

Duration (seconds) (duration) <string>
The time that it will take to fade the screen in or out.
Hold Fade (seconds) (holdtime) <string>
The time to hold the faded in/out state.
Fade Alpha (renderamt) <integer>
Alpha of the fade, where 0 = fully transparent and 255 = fully opaque.
Fade Color (R G B) (rendercolor) <color255>
Fade color.
Reverse Fade Duration (seconds) (ReverseFadeDuration) <float> (New with Portal 2)
The duration of the reverse fade.

Base:

Classname (classname) <string>
The classname defines the type of entity. Classnames can be changed using AddOutput, which will influence how the engine deals with the entity in certain circumstances.
Name (targetname) <string>
The name that other entities refer to this entity by.
Global Entity Name (globalname) <string>
Name by which this entity is linked to another entity in a different map. When the player transitions to a new map, entities in the new map with globalnames matching entities in the previous map will have the previous map's state copied over their state.
Parent (parentname) <targetname>
Specifies a movement parent. An entity will maintain its initial offset from its parent. An attachment point can be added to the end of the name, separated by a comma. Every entity can be parented, even point entities. Entities which are parented will be forced to transition to the next map, such as from a trigger_transition. Some entities which aren't intended to be parented may not function correctly. phys_constraint can be used as a workaround to parenting.
Origin (X Y Z) (origin) <coordinates>
The position of this entity's center in the world. Rotating entities typically rotate around their origin.
Pitch Yaw Roll (X Y Z) (angles) <angle>
This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.
Note:This works on brush entities, although Hammer doesn't show the new angles.
Flags (spawnflags) <integer>
Toggles features of an entity, its specific number is determined by the combination of flags added.
Response Contexts (ResponseContext) <string>
Pre-defined response system contexts for this entity. Format is key:value,key:value,.... Contexts may be filtered.
Effects (effects) <integer> !FGD
Combination of effect flags to use.
Local Time (ltime) <float> !FGD
The local time of the entity, independent of the global clock. Used mainly for physics calculations.
Next Think (nextthink) <float> !FGD
Amount of time before the entity thinks again.
Hammer ID (hammerid) <integer> !FGD
The entity's Hammer ID. Mainly used by plugins and debugging commands, such as ent_keyvalue. Can be manually assigned with the "hammerid" or "id" keyvalue. Entities spawned at run-time are not assigned any Hammer ID.
Disable for Xbox 360 (disableX360) <boolean> (New with Left 4 Dead 2) !FGD
If Yes, disables this entity on the Xbox 360 version of Source.
Entity Scripts (vscripts) <scriptlist> (New with Left 4 Dead 2)
Space delimited list of VScript files (without file extension) that are executed after all entities have spawned. The scripts are all executed in the same script scope, later ones overwriting any identical variables and functions.
Script think function (thinkfunction) <string> (New with Left 4 Dead 2)
Name of a function in this entity's script which will be called automatically every 100 milliseconds (ten times a second) for the duration of the script. It can be used to create timers or to simulate autonomous behavior. The return value (if present) will set the time until the next call. Try to avoid expensive operations in this function, as it may cause performance problems.
Lag Compensation (LagCompensate) <boolean> (New with Left 4 Dead 2) !FGD
Set to Yes to lag compensate this entity. Should be used very sparingly!
Is Automatic-Aim Target (is_autoaim_target) <boolean> (New with Counter-Strike: Global Offensive) !FGD
If set to 1, this entity will slow down aiming movement for consoles and joystick controllers when the entity is under the crosshairs.

Inputs

Fade
Start the screen fade.
FadeReverse  (New with Portal 2)
Begin doing the reverse of the current fade.
Alpha  !FGD
Changes Fade Alpha.
Color  !FGD
Changes Fade Color.

Base:

Kill
Removes this entity and any entities parented to it from the world.
KillHierarchy
Functions the same as Kill, although this entity and any entities parented to it are killed on the same frame, being marginally faster than Kill.
SetParent  <string>
Move with this entity. See Entity Hierarchy (parenting).
SetParentAttachment  <string>
Change this entity to attach to a specific attachment point on its parent. The entity will teleport so that the position of its root bone matches that of the attachment. Entities must be parented before being sent this input.
SetParentAttachmentMaintainOffset  <string>
As above, but without teleporting. The entity retains its position relative to the attachment at the time of the input being received.
ClearParent
Removes this entity from the the movement hierarchy, leaving it free to move independently.
AddOutput  <string>
Evaluates a keyvalue/output on this entity.
Format: <key> <value>
Format: <output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire, -1 means infinite>
FireUser1 to FireUser4
Fire the OnUser outputs; see User Inputs and Outputs.
Use  !FGD
Same as a player invoking +use; may not do anything. Can also be invoked by creating an output that does not specify an input.
This input is not included in Valve's FGDs.
DispatchEffect  <string> !FGD
Dispatches a special effect from the entity's origin. Removed and replaced entirely by the particle system since <Left 4 Dead>.
DispatchResponse  <string> !FGD
Dispatches a response to the entity. See Response and Concept.
AddContext  <string>
Adds to the entity's list of response contexts. Format is <key>:<value>.
RemoveContext  <string>
Remove a context from this entity's list. The name should match the key of an existing context.
ClearContext  <string>
Removes all contexts from this entity's list.
RunScriptFile  <script> (New with Left 4 Dead 2)
Execute a VScript file from disk, without file extension. The script contents are merged with the script scope of the receiving entity.
RunScriptCode  <string> (New with Left 4 Dead 2)
Execute a string of VScript source code in the scope of the entity receiving the input. String quotation may be needed when fired via console.
Bug:  In <Left 4 Dead 2>, the code is executed in the script scope of the entity that fires the output, not the one receiving the input.
Warning: Never try to pass string parameters to a script function with this input. It will corrupt the VMF structure because of the nested quotation marks, which then must be removed manually with a text editor.
CallScriptFunction  <string> (New with Left 4 Dead 2) !FGD
Execute a VScript function in the scope of the receiving entity.
SetLocalOrigin  <coordinates> (New with Alien Swarm) !FGD
Send this entity to a spot in the map. If the entity is parented to something, it will be offset from the parent by this amount.
SetLocalAngles  <angles> (New with Alien Swarm) !FGD
Set this entity's angles.

Outputs

OnBeginFade
Fired when the fade has begun.

Base:

OnUser1 to OnUser4
These outputs each fire in response to the firing of the like-numbered FireUser1 to FireUser4 Input; see User Inputs and Outputs.
OnKilled  (Only in the Left 4 Dead series)
This output fires when the entity is killed and removed from the game.