Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
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 00182 00183 00184 00185 00186 00187 00188 00189 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202 00203 00204 00205 00206 00207 00208 00209 00210 |
//============================================================================= // BaseKFWeapon //============================================================================= // Base class for Killing Floor weapon functionality that needs native code. //============================================================================= // Killing Floor Source // Copyright (C) 2009 Tripwire Interactive LLC // - John "Ramm-Jaeger" Gibson //============================================================================= class BaseKFWeapon extends Weapon native abstract; /********************************************************************************************* Zooming ********************************************************************************************* */ // Ironsights var(Zooming) float PlayerIronSightFOV; // The fov to use for this weapon when in ironsights var bool bZoomingIn; // We are transitioning to zoomed in. When set to true native code will attempt to interpolate to the zoomed in ironsight position var bool bZoomingOut; // We are transitioning to zoomed out. When set to true native code will attempt to interpolate to the zoomed out ironsight position var(Zooming) float ZoomTime; // How long the transition to/from iron sights should take var(Zooming) rotator ZoomInRotation; // Amount to rotate to when zooming in to give the feeling of an animation playing var rotator ZoomRotInterp; // Set by the native code when zooming in/out. This is the interpolated rotation over time of the value set in ZoomInRotation var vector ZoomStartOffset; // When we start zooming what player view location is the first person weapon in. Used by the native code to calculate where to start zooming from var bool bZoomInInterrupted; // We were zooming in and it was interrupted. Used by the native code to handle smooth interpolations between zoomed positions var bool bZoomOutInterrupted; // We were zooming out and it was interrupted. Used by the native code to handle smooth interpolations between zoomed positions var float ZoomPartialTime; // How much time we have to finish a partial zoom out. Used by the native code to handle smooth interpolations between zoomed positions var rotator ZoomRotStartOffset; // When we start zooming what rotation offset is the weapon. Used by the native code to handle smooth interpolations between zoomed positions var float LastZoomOutTime; // The last time we zoomed out. Used by the native code to determine if we can go to shouldered. var(Zooming) float FastZoomOutTime; // How long to take to zoom out when we're doing a fast zoom out (i.e. when an action like reloading interupts ironsights) var bool bFastZoomOut; // The weapon is doing a fast zoom out without animating, and won't get ZoomStart/End Notifies var float ZoomStartDisplayFOV; // What is the DisplayFOV when we start zooming var(Zooming) float ZoomedDisplayFOV; // What is the DisplayFOV when zoomed in // (cpptext) // (cpptext) // (cpptext) // (cpptext) replication { reliable if(Role < ROLE_Authority) ServerZoomIn,ServerZoomOut; } /** * Handles the logic of which zoom functions to call based on if * we are a client or a server * * @param bZoomStatus which direction we are zooming */ simulated function PerformZoom(bool bZoomStatus) { if( bZoomStatus ) { if( Owner != none && Owner.Physics == PHYS_Falling && Owner.PhysicsVolume.Gravity.Z <= class'PhysicsVolume'.default.Gravity.Z ) { return; } ZoomIn(true); if( Role < ROLE_Authority) ServerZoomIn(false); } else { ZoomOut(true); if( Role < ROLE_Authority) ServerZoomOut(false); } } /** * Handles all the functionality for zooming in including * setting the parameters for the weapon, pawn, and playercontroller * * @param bAnimateTransition whether or not to animate this zoom transition */ simulated function ZoomIn(bool bAnimateTransition) { if( bAnimateTransition ) { // If the zoom out was interrupted, set the parameters for the native code to interpolate the zoom from the proper position if( bZoomingOut ) { bZoomingOut=false; // Flag so the native code knows the zoom was interupted bZoomOutInterrupted=true; // Set the zoom time relative to how far along we were when zooming out ZoomTime=default.ZoomTime - ZoomTime; // Let the native code know where/when the zoom was interrupted ZoomPartialTime=ZoomTime; ZoomStartOffset=PlayerViewOffset; ZoomRotStartOffset=ZoomRotInterp; ZoomStartDisplayFOV=DisplayFOV; } else { ZoomTime=default.ZoomTime; ZoomStartOffset=PlayerViewOffset; ZoomStartDisplayFOV=DisplayFOV; } bZoomingIn=true; } } /** * Handles calling the zoom in function on the server * * @param bAnimateTransition whether or not to animate this zoom transition */ function ServerZoomIn(bool bAnimateTransition) { ZoomIn(bAnimateTransition); } /** * Handles all the functionality for zooming out including * setting the parameters for the weapon, pawn, and playercontroller * * @param bAnimateTransition whether or not to animate this zoom transition */ simulated function ZoomOut(bool bAnimateTransition) { if( bAnimateTransition ) { // If the zoom in was interrupted, set the parameters for the native code to interpolate the zoom from the proper position if( bZoomingIn ) { bZoomingIn=false; // Flag so the native code knows the zoom was interupted bZoomInInterrupted=true; // Set the zoom time relative to how far along we were when zooming in ZoomTime=default.ZoomTime - ZoomTime; // Let the native code know where/when the zoom was interrupted ZoomPartialTime=ZoomTime; ZoomStartOffset=PlayerViewOffset; ZoomRotStartOffset=ZoomRotInterp; ZoomStartDisplayFOV=DisplayFOV; } else { ZoomTime=default.ZoomTime; } bZoomingOut=true; } else { // do a fast zoomout with no notifies bFastZoomOut = true; // If the zoom in was interrupted, set the parameters for the native code to interpolate the zoom from the proper position if( bZoomingIn ) { bZoomingIn=false; // Flag so the native code knows the zoom was interupted bZoomInInterrupted=true; // Set the zoom time relative to how far along we were when zooming in ZoomTime=default.ZoomTime - ZoomTime; // Let the native code know where/when the zoom was interrupted ZoomPartialTime=ZoomTime; ZoomStartOffset=PlayerViewOffset; ZoomRotStartOffset=ZoomRotInterp; ZoomStartDisplayFOV=DisplayFOV; } else { ZoomTime=FastZoomOutTime; } bZoomingOut=true; LastZoomOutTime=Level.TimeSeconds+ZoomTime; } } /** * Handles calling the zoom out function on the server * * @param bAnimateTransition whether or not to animate this zoom transition */ function ServerZoomOut(bool bAnimateTransition) { ZoomOut(bAnimateTransition); } /** * Called by the native code when the interpolation of the first person weapon to the zoomed position finishes */ simulated event OnZoomInFinished(){} /** * Called by the native code when the interpolation of the first person weapon from the zoomed position finishes */ simulated event OnZoomOutFinished(){} defaultproperties { PlayerIronSightFOV=75.000000 ZoomTime=0.250000 ZoomInRotation=(Pitch=-910,Roll=2910) FastZoomOutTime=0.200000 ZoomedDisplayFOV=75.000000 } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |