Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

Engine.SceneManager


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
//=============================================================================
// SceneManager
//
// Manages a matinee scene.  Contains a list of action items that will
// be played out in order.
//=============================================================================
class SceneManager extends Info
	placeable
	native;

#exec Texture Import File=Textures\SceneManager.pcx  Name=S_SceneManager Mips=Off

// Graphics for UI
#exec Texture Import File=Textures\S_MatineeIP.pcx Name=S_MatineeIP Mips=Off MASKED=1
#exec Texture Import File=Textures\S_MatineeIPSel.pcx Name=S_MatineeIPSel Mips=Off MASKED=1
#exec Texture Import File=Textures\S_MatineeTimeMarker.pcx Name=S_MatineeTimeMarker Mips=Off MASKED=1
#exec Texture Import File=Textures\ActionCamMove.pcx  Name=S_ActionCamMove Mips=Off
#exec Texture Import File=Textures\ActionCamPause.pcx  Name=S_ActionCamPause Mips=Off
#exec Texture Import File=Textures\PathLinear.pcx  Name=S_PathLinear Mips=Off MASKED=1
#exec Texture Import File=Textures\PathBezier.pcx  Name=S_PathBezier Mips=Off MASKED=1
#exec Texture Import File=Textures\S_BezierHandle.pcx  Name=S_BezierHandle Mips=Off MASKED=1
#exec Texture Import File=Textures\SubActionIndicator.pcx  Name=SubActionIndicator Mips=Off MASKED=1

struct Orientation
{
	var() ECamOrientation	CamOrientation;
	var() actor LookAt;
	var() float EaseIntime;
	var() int bReversePitch;
	var() int bReverseYaw;
	var() int bReverseRoll;

	var int MA;
	var float PctInStart, PctInEnd, PctInDuration;
	var rotator StartingRotation;
};

// Exposed vars
var()	export	editinline	array<MatAction>	Actions;
var()	config	enum EAffect
{
	AFFECT_ViewportCamera,
	AFFECT_Actor,
} Affect;
var()	Actor	AffectedActor;			// The name of the actor which will follow the matinee path (if Affect==AFFECT_Actor)
var()	bool	bLooping;				// If this is TRUE, the path will looping endlessly
var()	bool	bCinematicView;			// Should the screen go into letterbox mode when playing this scene?
var()	name	SceneEndedPlayerFocusTag;//NEW (mdf) tag of actor player should be looking at when cutscene ends
var()	bool	PawnPhysics;			//NEW (PWC) 2002.9.21 setting this to true when in AFFECT_Actor causes the pawn to be shootable
var		float	OldFallingMaxVelocityZ;	//NEW (PWC) 2002.9.21 if using AFFECT_Actor used to restore the pawn's falling speed after scene ends
var		bool	OldbIgnoreImpactForces; //NEW (PWC) 2002.10.4 if using AFFECT_Actor used to restore the pawn's bIgnoreImpactForces after scene ends
var		EPhysics	OldPhysics;			//NEW (PWC) 2002.10.4 if using AFFECT_Actor used to restore the pawn's physics after scene ends

// These vars are set by the SceneManager in it's Tick event.  Don't mess with them directly.
var		/*transient*/ float PctSceneComplete;			// How much of the scene has finished running
var		/*transient*/ mataction	CurrentAction;			// The currently executing action
var		/*transient*/ float SceneSpeed;
var		/*transient*/ float	TotalSceneTime;				// The total time the scene will take to run (in seconds)
var		/*transient*/ Actor	Viewer;						// The actor viewing this scene (the one being affected by the actions)
var		/*transient*/ Pawn OldPawn;						// The pawn we need to repossess when scene is over
var		/*transient*/ bool bIsRunning;					// If TRUE, this scene is executing.
var		/*transient*/ bool bIsSceneStarted;				// If TRUE, the scene has been initialized and is running
var		/*transient*/ float CurrentTime;				// Keeps track of the current time using the DeltaTime passed to Tick
var		/*transient*/ array<vector> SampleLocations;	// Sampled locations for camera movement
var		/*transient*/ array<MatSubAction> SubActions;	// The list of sub actions which will execute during this scene
var		/*transient*/ Orientation CamOrientation;		// The current camera orientation
var		/*transient*/ Orientation PrevOrientation;		// The previous orientation that was set

// Native functions
native function float GetTotalSceneTime();

simulated event BeginPlay()
{
	Super.BeginPlay();

	if( Affect == AFFECT_Actor && AffectedActor == None )
		log( "SceneManager : Affected actor is NULL!" );

	//
	// Misc set up
	//

	TotalSceneTime = GetTotalSceneTime();
	bIsRunning = false;
	bIsSceneStarted = false;
}

//NEW (mdf)
function Trigger( Actor Other, Pawn EventInstigator, optional name EventName )
/*OLD
function Trigger( Actor Other, Pawn EventInstigator )
*/
{
	bIsRunning = true;
	bIsSceneStarted = false;
	Disable( 'Trigger' );
}

//NEW (arl) TriggerToggle matinee support.
state() TriggerToggle
{
	function Trigger( Actor Other, Pawn EventInstigator, optional name EventName )
	{
		if( !bIsRunning )
		{
			bIsRunning = true;
			bIsSceneStarted = false;
		}
		else
		{
			StopScene();
		}
	}
}
//OLD

// Events
event SceneStarted()	// Called from C++ when the scene starts.
{
	local Controller P;

	// Figure out who our viewer is.
	Viewer = None;
	if( Affect==AFFECT_Actor )
		Viewer = AffectedActor;
	else
	{
		for( P = Level.ControllerList ; P != None ; P = P.nextController )
//NEW (arl) -- fix for crash if cutscene is started while player is in a cutscene (or for some other reason has no pawn at the time).
			if( PlayerController(P)? && PlayerController(P).Player? )
/*OLD
			if( P.IsA('PlayerController') && (P.Pawn != None) )
*/
			{
				Viewer = P;
				OldPawn = PlayerController(Viewer).Pawn;
				OldPawn.Velocity = vect(0,0,0);
				OldPawn.Acceleration = vect(0,0,0);
				OldPawn.bPhysicsAnimUpdate = false;
				OldPawn.StopAnimating();
				OldPawn.bHidden = true; //NEW (mwp) hide the player's pawn
				Level.Game.NotifyCutSceneStart(); //NEW (mib) allows game to hide HUD, etc.
				//NEW (mdf) matinee fixes
				PlayerController(Viewer).UnPossessMatinee();
				/*OLD
				PlayerController(Viewer).UnPossess();
				*/
				
				PlayerController(Viewer).StartInterpolation();
				PlayerController(Viewer).MyHud.bHideHUD = true;
				break;
			}
	} 
	// PWC 2002.9.21 set up a controlled pawn to behave properly on matinee path
	if (PawnPhysics && Affect==AFFECT_Actor) 
	{
		OldPhysics=AffectedActor.Physics;
		Viewer.SetPhysics(PHYS_None); 
		OldbIgnoreImpactForces=AffectedActor.bIgnoreImpactForces;
		Viewer.bIgnoreImpactForces=true; 
		OldFallingMaxVelocityZ = AffectedActor.FallingMaxVelocityZ; 
		Viewer.FallingMaxVelocityZ=0;
	}
	else Viewer.SetCollision(False, False, False);
}

event SceneEnded()		// Called from C++ when the scene ends.
{
	local Actor SceneEndedPlayerFocusActor; //NEW (mdf)
	local bool bFocusActorFound;
	
	bIsSceneStarted = false;
	
	//PWC 2002.9.21 restore controlled pawn to a normal state
	if (PawnPhysics && Affect==AFFECT_Actor) 
	{
		Viewer.SetPhysics(OldPhysics); 
		Viewer.bIgnoreImpactForces=OldbIgnoreImpactForces;
		AffectedActor.FallingMaxVelocityZ = OldFallingMaxVelocityZ;
	}

	if( Affect==AFFECT_ViewportCamera )
	{
		//!!MWP (mdf) afaik we aren't using bPhysicsAnimUpdate and setting it to true could lead to unnecessary overhead
		//OldPawn.bPhysicsAnimUpdate = true;
		OldPawn.bHidden = false; //NEW (mwp) unhide the player's pawn
		Level.Game.NotifyCutSceneEnd(); //NEW (mib) allows game to retore HUD, etc.
		//NEW (mdf) matinee fixes
		PlayerController(Viewer).PossessMatinee( OldPawn );
		/*OLD
		PlayerController(Viewer).Possess( OldPawn );
		*/
		
		PlayerController(Viewer).bInterpolating = false;
		PlayerController(Viewer).MyHud.bHideHUD = false;
//NEW (mdf)
		if( SceneEndedPlayerFocusTag != '' && OldPawn != None )
		{
			foreach AllActors( class'Actor', SceneEndedPlayerFocusActor, SceneEndedPlayerFocusTag )
			{	
				PlayerController(Viewer).SetRotation( rotator( SceneEndedPlayerFocusActor.Location - OldPawn.Location ) );
				OldPawn.SetRotation( PlayerController(Viewer).Rotation );
				bFocusActorFound=True;
			}
			if( !bFocusActorFound )
				DM( "WARNING: couldn't find tag for SceneEndedPlayerFocusActor: " $ SceneEndedPlayerFocusTag );
		}
//OLD		
	}

	TriggerEvent(Event, Self, None);	// so that other actors can respond the end of a matinee scene

	Enable( 'Trigger' );
}

//NEW (mdf) hack to skip to end of scene (WARNING: this will skip all events etc.)
function StopScene()
{
	CurrentTime = TotalSceneTime+0.01;
}
//END

defaultproperties
{
	SceneSpeed=1.000000
	Texture=Texture'Engine.S_SceneManager'
     UseReticleOnEvents(0)="UseReticleText"
     UseReticleOnEvents(1)="UseReticleCorners"
     UseReticleOnEvents(2)="UseReticleTopBars"
     ProximityReticleOnEvents(0)="ProximityReticleCorners"
     ProximityReticleOnEvents(1)="ProximityReticleTopBars"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: sk 3-1-2016 10:38:40.000 - Creation time: sk 3-1-2016 10:48:41.504 - Created with UnCodeX