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

DeusEx.MultiMover


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
//=============================================================================
// MultiMover.
//=============================================================================
class MultiMover expands Mover;

// Lets you specify four different sequences of up to four keyframes each.
// Each sequence can be triggered independently (like for an elevator or a crane)

var() int SeqKey1[4];
var() int SeqKey2[4];
var() int SeqKey3[4];
var() int SeqKey4[4];
var() float SeqTime1[4];
var() float SeqTime2[4];
var() float SeqTime3[4];
var() float SeqTime4[4];
var() bool bReverseKeyframes;
var bool bIsMoving;
var int LastSeq;
var int CurrentSeq;
var int i;      // why can't I put this in the state?

function int SeqKeys(int seq, int which)
{
    switch (seq)
    {
        case 0: return SeqKey1[which];
        case 1: return SeqKey2[which];
        case 2: return SeqKey3[which];
        case 3: return SeqKey4[which];
    }

    return -1;
}

function float SeqTimes(int seq, int which)
{
    switch (seq)
    {
        case 0: return SeqTime1[which];
        case 1: return SeqTime2[which];
        case 2: return SeqTime3[which];
        case 3: return SeqTime4[which];
    }

    return -1;
}

function BeginPlay()
{
    Super.BeginPlay();
    bIsMoving = False;
    LastSeq = -1;
    CurrentSeq = -1;
}

function SetSeq(int seqnum)
{
    if (bIsMoving)
        return;

    if (CurrentSeq != seqnum)
    {
        LastSeq = CurrentSeq;
        CurrentSeq = seqnum;
        GotoState('MultiMover', 'Close');
    }
}

auto state() MultiMover
{
    // stub out InterpolateEnd so it doesn't use the intermediate keyframes
    function InterpolateEnd(actor Other)
    {
    }

// reverse the previous sequence (if any) before playing the new one
Close:
    bIsMoving = True;
    if ((LastSeq > 0) && (bReverseKeyframes))
    {
        PlaySound(ClosingSound);
        AmbientSound = MoveAmbientSound;
        for (i=3; i>=0; i--)
            if (SeqKeys(LastSeq, i) >= 0)
                if (SeqKeys(LastSeq, i) != KeyNum)
                {
                    InterpolateTo(SeqKeys(LastSeq, i), SeqTimes(LastSeq, i));
                    FinishInterpolation();
                }

        AmbientSound = None;
        FinishedClosing();
    }

Open:
    PlaySound(OpeningSound);
    AmbientSound = MoveAmbientSound;
    for (i=0; i<4; i++)
        if (SeqKeys(CurrentSeq, i) >= 0)
            if (SeqKeys(CurrentSeq, i) != KeyNum)
            {
                InterpolateTo(SeqKeys(CurrentSeq, i), SeqTimes(CurrentSeq, i));
                FinishInterpolation();
            }

    AmbientSound = None;
    FinishedOpening();
    bIsMoving = False;
    Stop;
}

defaultproperties
{
     SeqKey1(0)=-1
     SeqKey1(1)=-1
     SeqKey1(2)=-1
     SeqKey1(3)=-1
     SeqKey2(0)=-1
     SeqKey2(1)=-1
     SeqKey2(2)=-1
     SeqKey2(3)=-1
     SeqKey3(0)=-1
     SeqKey3(1)=-1
     SeqKey3(2)=-1
     SeqKey3(3)=-1
     SeqKey4(0)=-1
     SeqKey4(1)=-1
     SeqKey4(2)=-1
     SeqKey4(3)=-1
     bReverseKeyframes=True
     LastSeq=-1
     CurrentSeq=-1
     InitialState=MultiMover
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Mon 8/11/2021 16:22:52.000 - Creation time: Mon 8/11/2021 16:31:29.895 - Created with UnCodeX