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
//=============================================================================
// 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() actor DollyWith;
    var() float EaseIntime;
    var() int bReversePitch;
    var() int bReverseYaw;
    var() int bReverseRoll;

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

struct Interpolator
{
    var() int bDone;
    var() float _value;
    var() float _remainingTime;
    var() float _totalTime;
    var() float _speed;
    var() float _acceleration;
};

// 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    PlayerScriptTag;        // Tag of sequence that player's pawn should use during sequence
var()   name    NextSceneTag;           // The tag of the next scenemanager to execute when this one finishes
var()   name    EventStart;             // Fired when the scene starts
var()   name    EventEnd;               // Fired when the scene ends
var()   bool    bHideHUD;               // Hide the HUD while the scene runs?

// These vars are set by the SceneManager in it's Tick function.  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
var     transient Interpolator RotInterpolator;     // Interpolation helper for rotations
var     transient vector CameraShake;               // The SubActionCameraShake effect fills this var in each frame
var     transient vector DollyOffset;               // How far away we are from the actor we are locked to
var     transient bool      bAbortCinematic;

// Native functions
native function float GetTotalSceneTime();
native function AbortScene();

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

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

    //
    // Misc set up
    //

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

function Trigger( actor Other, Pawn EventInstigator )
{
    bIsRunning = true;
    bIsSceneStarted = false;
    Disable( 'Trigger' );
}

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

    // Figure out who our viewer is.
    Viewer = None;
    if( Affect==AFFECT_Actor )
        Viewer = AffectedActor;
    else
    {
        for( P = Level.ControllerList ; P != None ; P = P.nextController )
            if( P.IsA('PlayerController')  )
            {
                Viewer = P;
                OldPawn = PlayerController(Viewer).Pawn;
                if ( OldPawn != None )
                {
                    OldPawn.Velocity = vect(0,0,0);
                    OldPawn.Acceleration = vect(0,0,0);
                    PlayerController(Viewer).UnPossess();
                    if ( PlayerScriptTag != 'None' )
                    {
                        ForEach DynamicActors( class'AIScript', S, PlayerScriptTag )
                            break;
                        if ( S != None )
                            S.TakeOver(OldPawn);
                    }
                }
                PlayerController(Viewer).bViewingMatineeCinematic = true;
                PlayerController(Viewer).StartInterpolation();
                PlayerController(Viewer).MyHud.bHideHUD = bHideHUD;
                break;
            }
    }
    Viewer.StartInterpolation();
    
    TriggerEvent( EventStart, Self, None);
    Level.Game.SceneStarted( Self, None );
}

event SceneEnded()      // Called from C++ when the scene ends.
{
    bIsSceneStarted = false;

    if( Affect==AFFECT_ViewportCamera )
    {
        if ( PlayerController(Viewer) != None )
        {
            if ( OldPawn != None )
                PlayerController(Viewer).Possess( OldPawn );
            PlayerController(Viewer).bViewingMatineeCinematic = false;
            PlayerController(Viewer).bInterpolating = false;
            PlayerController(Viewer).MyHud.bHideHUD = false;
        }
    }
    Viewer.FinishedInterpolation();
    Enable( 'Trigger' );
    
    TriggerEvent( EventEnd, Self, None);
    Level.Game.SceneEnded( Self, None );
}

defaultproperties
{
     bHideHUD=Wahr
     Texture=Texture'Engine.S_SceneManager'
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Fr 30.3.2007 08:43:36.000 - Creation time: Mo 16.4.2007 11:20:52.937 - Created with UnCodeX