SFVehicle.SFCar

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
//=============================================================================
// Spatial Fear
// Name: SFCar
// Description: Vehicle with Car-like physics; cannot turn without velocity
//
// Author: Gert Jen Peltenburg
//=============================================================================
class SFCar expands SFVehicle;

simulated function InterpretControls(bool bJustFired,bool bFire,bool bJustAltFired,bool bAltFire,
                           float aVehicleSpeedControl,float aTurretTurn,float aVehicleTurn,
                           float aVehicleUp,float aTurretUp,bool bJustJumped,bool bJustDucked)
{
 local float NewDesiredSpeed;

 if(aVehicleTurn<0)
  controlinputYaw = (aVehicleTurn/16384.0)*YawLeftRate;
 else
  controlinputYaw = (aVehicleTurn/16384.0)*YawRightRate;
  
 NewDesiredSpeed = 0;
 
 if(aVehicleSpeedControl<0)
  NewDesiredSpeed = MinSpeed/16384.0*abs(aVehicleSpeedControl);
 
 if(aVehicleSpeedControl>0)
  NewDesiredSpeed = MaxSpeed/16384.0*abs(aVehicleSpeedControl);

 DesiredSpeed = NewDesiredSpeed;
}

// Basically the same code as the boat: a SFCar cannot turn in-place either
simulated function RotationPhysics(float DeltaTime)
{
 local rotator NewRotation;
 local rotator NewDesiredRotation;
 local float compensationYaw,compensationPitch,compensationRoll; // not using rotator because these values are generally<1
 local float steeringfactor;
 
 if(DeltaTime<=0)
  return;
  
 if(!bPhysics)
  return;
   
 steeringfactor = deltatime*CurrentSpeed/MaxSpeed;
  
 PreviousRotation = CurrentRotation;
 CurrentRotation.Roll=normalizeangle(CurrentRotation.Roll);
 CurrentRotation.Pitch=normalizeangle(CurrentRotation.Pitch);
 CurrentRotation.Yaw=normalizeangle(CurrentRotation.Yaw);
 
 StabilizedRotation = CurrentRotation;
  
 if(currentcontroller != None) {  
  compensationYaw=ControlInputYaw;
  compensationPitch=ControlInputPitch;
  compensationRoll=ControlInputRoll; 

  StabilizedRotation.Roll += compensationRoll*steeringfactor;
  StabilizedRotation.Pitch += compensationPitch*steeringfactor;
  StabilizedRotation.Yaw += compensationYaw*steeringfactor;

  StabilizedRotation.Roll = normalizeangle(StabilizedRotation.Roll);  
  StabilizedRotation.Pitch = normalizeangle(StabilizedRotation.Pitch);  
  StabilizedRotation.Yaw = normalizeangle(StabilizedRotation.Yaw);  
 } 

 NewRotation=StabilizedRotation;
 
 // if CurrentRotation will change, play rotatingsound

 CurrentRotation = NewRotation; 
}

defaultproperties
{
     bBot_ShowVehicleLocation=True
     Armor=40
     InitialHitPoints=60
     FullHitPoints=60
     PhysicalRotationRate=(Pitch=16384,Yaw=16384,Roll=16384)
     Elasticity=0.000000
     bDamageTriggered=True
}

class file time: 12/7/2003 3:58:26 PM - creation time: 12/7/2003 4:03:44 PM
Created with UnCodeX