Core.Object | +--Engine.Actor | +--UMS1_6.UMS | +--UMS1_6.UMSModule | +--UMSSmoothCamera.UMSSmoothCamera
SmoothCamera
FindSmoothCamera(string CameraName)
00001 class UMSSmoothCamera expands UMSModule; 00002 00003 function bool runCommand(string Script[20]) 00004 { 00005 switch(Script[0]) 00006 { 00007 case "Camera": 00008 return ExecuteCameraAction(Script); 00009 break; 00010 } 00011 00012 return false; 00013 } 00014 00015 function bool ExecuteCameraAction(string Script[20]) 00016 { 00017 local SmoothCamera TargetCamera; 00018 00019 //find the camera 00020 TargetCamera = FindSmoothCamera(Script[1]); 00021 00022 switch(Script[2]) 00023 { 00024 case "SmoothPan": 00025 ExecuteSmoothPan(TargetCamera, Script); 00026 return true; 00027 break; 00028 case "SmoothDolly": 00029 ExecuteSmoothDolly(TargetCamera, Script); 00030 return true; 00031 break; 00032 } 00033 return false; 00034 } 00035 00036 function ExecuteSmoothPan(SmoothCamera TargetCamera, string Script[20]) 00037 { 00038 local actor PanTarget; 00039 local vector TargetVector; 00040 local rotator TargetRotation; 00041 local float Time; 00042 local float AccelTime; 00043 local bool bAccel; 00044 local bool bDecel; 00045 00046 bAccel = true; 00047 bDecel = true; 00048 00049 //to something, or not to something, that is the question 00050 if(Script[3] ~= "to") 00051 { 00052 //If no name after to, use the value in ScriptVectors 00053 if(Script[4] ~= "Accelerate") 00054 { 00055 bDecel = false; 00056 PanTarget = NONE; 00057 } 00058 else if(Script[4] ~= "Decelerate") 00059 { 00060 bAccel = false; 00061 PanTarget = NONE; 00062 } 00063 else if(Script[4] == "") 00064 { 00065 PanTarget = NONE; 00066 } 00067 else 00068 { 00069 PanTarget = FindActor(Script[4]); 00070 if(Script[5] ~= "Accelerate") 00071 bDecel = false; 00072 if(Script[5] ~= "Decelerate") 00073 bAccel = false; 00074 } 00075 00076 if(PanTarget != NONE) 00077 TargetVector = PanTarget.Location; 00078 else 00079 TargetVector = currentScriptVector; 00080 00081 TargetRotation = rotator(TargetVector - TargetCamera.Location); 00082 } 00083 else 00084 { 00085 TargetRotation = TargetCamera.Rotation + currentScriptRotator; 00086 if(Script[3] ~= "Accelerate") 00087 bDecel = false; 00088 if(Script[3] ~= "Decelerate") 00089 bAccel = false; 00090 } 00091 00092 Time = currentScriptVal; 00093 AccelTime = currentScriptVal2; 00094 00095 TargetCamera.DoSmoothPan(TargetRotation, PanTarget, Time, AccelTime, bAccel, bDecel); 00096 } 00097 00098 function ExecuteSmoothDolly(SmoothCamera TargetCamera, string Script[20]) 00099 { 00100 local actor TargetActor; 00101 local vector TargetLocation; 00102 local float Time; 00103 local float AccelTime; 00104 local bool bAccel; 00105 local bool bDecel; 00106 00107 bAccel = true; 00108 bDecel = true; 00109 00110 if(Script[3] ~= "to") 00111 { 00112 if(Script[4] ~= "Accelerate") 00113 { 00114 bDecel = false; 00115 TargetActor = NONE; 00116 } 00117 else if(Script[4] ~= "Decelerate") 00118 { 00119 bAccel = false; 00120 TargetActor = NONE; 00121 } 00122 else if (Script[4] == "") 00123 { 00124 TargetActor = NONE; 00125 } 00126 else 00127 { 00128 TargetActor = FindActor(Script[4]); 00129 if(Script[5] ~= "Accelerate") 00130 bDecel = false; 00131 if(Script[5] ~= "Decelerate") 00132 bAccel = false; 00133 } 00134 00135 //Check for no target. 00136 if(TargetActor == NONE) 00137 TargetLocation = currentScriptVector; 00138 else 00139 TargetLocation = TargetActor.Location; 00140 } 00141 else 00142 { 00143 TargetLocation = TargetCamera.Location + currentScriptVector; 00144 if(Script[3] ~= "Accelerate") 00145 bDecel = false; 00146 if(Script[3] ~= "Decelerate") 00147 bAccel = false; 00148 } 00149 00150 Time = currentScriptVal; 00151 AccelTime = currentScriptVal2; 00152 00153 log(Self$": Dollying to"@Script[4]@"in"@Time@"seconds."); 00154 00155 TargetCamera.DoSmoothDolly(TargetLocation, TargetActor, Time, AccelTime, bAccel, bDecel); 00156 } 00157 00158 function SmoothCamera FindSmoothCamera(string CameraName) 00159 { 00160 local SmoothCamera M; 00161 00162 foreach AllActors(class'SmoothCamera', M) 00163 if (CameraName ~= string(M.Tag) || CameraName ~= string(M.Name)) 00164 return M; 00165 //If there is no matching pawn, return none. 00166 return NONE; 00167 } 00168 00169 defaultproperties 00170 { 00171 }