## XIII
Class XIIIMoverVarTime

source: C:\XIII\XIII\Classes\XIIIMoverVarTime.uc

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Mover
             |
             +--XIII.XIIIMover
                |
                +--XIII.XIIIMoverVarTime

Direct Known Subclasses:None

class XIIIMoverVarTime
extends XIII.XIIIMover

    //-----------------------------------------------------------
    //
    //-----------------------------------------------------------

Function Summary
`void` | `InterpolateTo(byte NewKeyNum, float Seconds)`
    //____________________________________________________________________
`void` | `PostBeginPlay()`
    //____________________________________________________________________

Source Code

    00001	//-----------------------------------------------------------
    00002	//
    00003	//-----------------------------------------------------------
    00004	class XIIIMoverVarTime extends XIIIMover;
    00005
    00006	var(XIIIMover) float fVarMoveTime[8];
    00007	var(XIIIMover) StaticMesh VarStaticMesh[8];
    00008
    00009	//____________________________________________________________________
    00010	function PostBeginPlay()
    00011	{
    00012	    local int i;
    00013
    00014	    Super.PostBeginPlay();
    00015	    for (i=0;i<8;i++)
    00016	      if ( fVarMoveTime[i] == 0.0 )
    00017	        fVarMoveTime[i] = Movetime;
    00018
    00019	}
    00020
    00021	//____________________________________________________________________
    00022	function InterpolateTo( byte NewKeyNum, float Seconds )
    00023	{
    00024	//    Log("XIIIMoverVarTime InterpolateTo from"@KeyNum@"to"@NewKeyNum);
    00025	    NewKeyNum = Clamp( NewKeyNum, 0, ArrayCount(KeyPos)-1 );
    00026	    if( NewKeyNum==PrevKeyNum && KeyNum!=PrevKeyNum )
    00027	    {
    00028	      // Reverse the movement smoothly.
    00029	      PhysAlpha = 1.0 - PhysAlpha;
    00030	      OldPos    = BasePos + KeyPos[KeyNum];
    00031	      OldRot    = BaseRot + KeyRot[KeyNum];
    00032	    }
    00033	    else
    00034	    {
    00035	      // Start a new movement.
    00036	      OldPos    = Location;
    00037	      OldRot    = Rotation;
    00038	      PhysAlpha = 0.0;
    00039	    }
    00040
    00041	    // Setup physics.
    00042	    SetPhysics(PHYS_MovingBrush);
    00043	    bInterpolating   = true;
    00044	//    PhysRate         = 1.0 / FMax(Seconds, 0.005);
    00045	//    log("use varmovetime of "$fVarMoveTime[ KeyNum ] );
    00046	    if ( NewKeyNum == KeyNum-1 ) // Going backward
    00047	    {
    00048	      PhysRate = 1.0 / FMax( fVarMoveTime[ NewKeyNum ], 0.005);
    00049	    }
    00050	    else // Going forward
    00051	    {
    00052	      PhysRate = 1.0 / FMax( fVarMoveTime[ KeyNum ], 0.005);
    00053	    }
    00054	    if ( VarStaticMesh[KeyNum] != none )
    00055	      StaticMesh = VarStaticMesh[KeyNum];
    00056	    PrevKeyNum       = KeyNum;
    00057	    KeyNum           = NewKeyNum;
    00058
    00059	    ClientUpdate++;
    00060	    SimOldPos = OldPos;
    00061	    SimOldRotYaw = OldRot.Yaw;
    00062	    SimOldRotPitch = OldRot.Pitch;
    00063	    SimOldRotRoll = OldRot.Roll;
    00064	    SimInterpolate.X = 100 * PhysAlpha;
    00065	    SimInterpolate.Y = 100 * FMax(0.01, PhysRate);
    00066	    SimInterpolate.Z = 256 * PrevKeyNum + KeyNum;
    00067	}
    00068
    00069
    00070
    00071	defaultproperties
    00072	{
    00073	}

End Source Code