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 00211 00212 00213 00214 00215 00216 00217 00218 00219 00220 00221 00222 00223 00224 00225 00226 00227 00228 00229 00230 00231 00232 00233 00234 00235 00236 00237 00238 00239 00240 00241 00242 00243 00244 00245 00246 00247 00248 00249 00250 00251 00252 |
//================================================================== // class: UIProjector // file: UIProjector.uc // author: Raven // game: For 227 Unreal 1 patch // description: projects decal onto BSP surface //================================================================== class UIProjector extends UIFX config; #exec TEXTURE IMPORT NAME=UIProjectorIcon FILE="Textures\projector.pcx" GROUP=Icons LODSET=2 FLAGS=2 enum ESizeType { ST_Normal, // decal will not change size ST_Grow, // decal will grow ST_Shrink // decal will shrink }; var(UIProjector_Size) ESizeType SizeType; // how decal size should be affected by distance var(UIProjector_Size) bool bDistanceSizing; // should decal change it's size with distance var(UIProjector_Size) float ProjectorScale; // base projected texture scale var(UIProjector_Size) float ProjectorScaleModifier; // scale modifier (for growing/shrinking while moving up/dn) var(UIProjector_Size) float MinSize; // min decal size (used by bDistanceSizing) var(UIProjector_Size) float MaxSize; // max max size (used by bDistanceSizing) var(UIProjector_Size) float RandomScaleMin; // min decal size (used by bRandomScale) var(UIProjector_Size) float RandomScaleMax; // max max size var(UIProjector_Size) bool bRandomScale; // will make size random var(UIProjector) ERenderStyle ProjectorRenderStyle; // projector render style var(UIProjector) bool bStaticProjector; /* bStaticProjector can make static projector form most of the states (except ContinousUpdate and StaticProjector). So if you don't need to update you projector all the time (for instance flashlight decal) please set it to true. */ var(UIProjector) float ProjectorRefreshTime; // how often projected texture will be refreshed var(UIProjector) float ProjectionDistance; // max Z distance from the bottom var(UIProjector) texture ProjectorTexture; // projected texture var(UIProjector) vector ProjectionOffset; // offset from base location var(UIProjector) rotator ProjectorRotationModifier; // additional rotation var(UIProjector) bool bNoRotation; // updates everything except rotation var(UIProjector) actor TracedActor; // acto which rotation/location should projector fallow var(UIProjector) bool bTraceActor; // should track actors location/rotation (if you want to track actors rotation set bStaticProjector to false) // usses TracedActor var(UIProjector) int ProjectableSurfaces; // count of surfaces on which decalw ill be visible var(UIProjector_Rotator) bool TraceRotation; // will trace rotation var(UIProjector_Rotator) bool bUpdateYaw; // will update yaw var(UIProjector_Rotator) bool bUpdateRoll; // will update roll var(UIProjector_Rotator) bool bUpdatePitch; // will update pitch var(UIProjector_Rotator) bool bReplaceOldRotation; // replaces old rotation, with new one var(UIProjector_Rotator) bool bApplyHitNormal; // should always be true var(UIProjector_Flicker) float ActiveTime; // how long will remain active var(UIProjector_Flicker) float InActiveTime; // how long will remain inactive var(UIProjector_Flicker) bool bRandom; // should stay active/inactive randomly var(UIProjector_Flicker) float RandomModifier; // random modifier var(UIProjector_Flicker) bool bOn; // is on or off - works in states: /* TriggerControl if bon=true, then projector turns on when triggered, and off when untriggered if bon=false, then projector turns off when triggered, and on when untriggered TriggerToggle should be on at the beginning Flicker should be on at the beginning */ var(Advanced) bool bLogWarnings; // should log all errors and warnings var bool bAttached; // not-replicated, client side variable used in state Flicker. var UIProjectorDecal ProjectorDecal; // stores decal (client side) var globalconfig bool bProjectorEnabled; // config variable. Describes if projectors are available //function SetToEnd(bool bToDo){ bTimeToEnd=bToDo; } //============================================================================= // returns sizing type //============================================================================= simulated function int GetSizeType() { if (SizeType == ST_Normal) return 0; else if (SizeType == ST_Grow) return 1; else return 2; } //============================================================================= // checks main variables //============================================================================= simulated function BeginPlay() { if (ProjectorRefreshTime <= 0 || ProjectorTexture == none || ProjectorScale <= 0) Destroy(); if (bTraceActor && TracedActor == none) Destroy(); } //============================================================================= // spawn decal //============================================================================= simulated function OnStart(optional bool bUseOld) { local vector HitNormal,HitLocation,ProjStart, ProjEnd; local rotator tmprot; if (Level.NetMode == NM_DedicatedServer) return; if (bTraceActor) ProjStart = TracedActor.Location; else ProjStart = Location; if (bNoRotation) { ProjEnd=ProjStart - (vect(0,0,1)*ProjectionDistance); } else { if (!bTraceActor) ProjEnd=vector(Rotation)*ProjectionDistance; else { if (TracedActor != none) ProjEnd=vector(TracedActor.Rotation)*ProjectionDistance>>TracedActor.Rotation; } } if (bTraceActor) tmprot=TracedActor.Rotation; else tmprot=Rotation; if (Trace(HitLocation, HitNormal, ProjEnd, ProjStart) == none) { if (bLogWarnings) log(self$": WARNING - can not trace BSP!",'UIProjector'); Destroy(); } if (!bUseOld) { ProjectorDecal=Spawn(class'UIProjectorDecal',,,HitLocation+ProjectionOffset,tmprot+ProjectorRotationModifier); ProjectorDecal.RemoteRole = ROLE_None; } ProjectorDecal.BeginUpdate(self, HitNormal); ProjectorDecal.Style=ProjectorRenderStyle; } //============================================================================= // re-creates decal //============================================================================= simulated function OnRecall() { if (ProjectorDecal != none) return; OnStart(); } //============================================================================= // destroys decal //============================================================================= simulated function OnEnd() { if (Level.NetMode != NM_DedicatedServer) { if (ProjectorDecal == none) return; if (ProjectorDecal != none) ProjectorDecal.Destroy(); ProjectorDecal=none; } } //============================================================================= // Updates decal //============================================================================= simulated function OnCall() { if (ProjectorDecal != none) { ProjectorDecal.DecalUpdate(self); } } //============================================================================= // Updates once only //============================================================================= simulated state() StaticProjector { Begin: OnRecall(); OnCall(); } //============================================================================= // Keeps updating //============================================================================= simulated state() ContinousUpdate { Begin: OnRecall(); Loop: OnCall(); Sleep(ProjectorRefreshTime); GoTo('Loop'); } //============================================================================= // Flickers //============================================================================= simulated state() Flicker { simulated function Timer() { if (bAttached) { bAttached=false; if (ProjectorDecal != none) ProjectorDecal.DetachDecal(); if (bRandom) SetTimer(InActiveTime+(FRand() * RandomModifier), false); else SetTimer(InActiveTime, false); } else { bAttached=true; if (ProjectorDecal != none) ProjectorDecal.DecalUpdate(self); if (bRandom) SetTimer(ActiveTime+(FRand() * RandomModifier), false); else SetTimer(ActiveTime, false); } } Begin: if ( Level.NetMode == NM_DedicatedServer ) Stop; // If on dedicated server, go to sleep mode. OnStart(); SetTimer(InActiveTime, false); Loop: if (bAttached) { OnCall(); } Sleep(ProjectorRefreshTime); if (!bStaticProjector) GoTo('Loop'); } defaultproperties { SizeType=ST_Grow ProjectorScale=1.000000 ProjectorScaleModifier=0.000005 MinSize=0.200000 MaxSize=4.000000 ProjectorRenderStyle=STY_Modulated ProjectorRefreshTime=0.100000 ProjectionDistance=1024.000000 ProjectableSurfaces=8 bReplaceOldRotation=True bApplyHitNormal=True ActiveTime=0.050000 InActiveTime=0.030000 bRandom=True RandomModifier=0.600000 bOn=True bProjectorEnabled=True bHidden=True bNoDelete=True RemoteRole=ROLE_SimulatedProxy InitialState="ContinousUpdate" bDirectional=True Style=STY_Masked Texture=Texture'UnrealShare.Icons.UIProjectorIcon' DrawScale=0.500000 } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |