| 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 00253 00254 00255 00256 00257 00258 00259 00260 00261 00262 00263 00264 00265 00266 00267 00268 00269 00270 00271 00272 00273 00274 00275 00276 00277 00278 00279 00280 00281 00282 00283 00284 00285 00286 00287 00288 00289 00290 00291 00292 00293 00294 00295 00296 00297 00298 00299 00300 00301 00302 00303 00304 00305 00306 00307 00308 00309 00310 00311 00312 00313 00314 00315 00316 00317 00318 00319 00320 00321 00322 00323 00324 00325 00326 00327 00328 00329 00330 00331 00332 00333 00334 00335 00336 00337 00338 00339 00340 00341 00342 00343 00344 00345 00346 00347 00348 00349 00350 00351 00352 00353 00354 00355 00356 00357 00358 00359 00360 00361 00362 00363 00364 00365 00366 00367 00368 00369 00370 00371 00372 00373 00374 00375 00376 00377 00378 00379 00380 00381 00382 00383 00384 00385 00386 00387 00388 00389 00390 00391 00392 00393 00394 00395 00396 00397 00398 00399 00400 00401 00402 |
//----------------------------------------------------------- // Copyright 2007, Infinity Impossible // // Skin code based upon Lotus's CustomUT skin shaders, code and shaders // used with permission. //----------------------------------------------------------- class UTMT_Pawn extends UTPawn; struct ReplacementMaterial { var string MaterialName; var MaterialInterface ReplacementMaterial; }; /** * Replace these skins, if they are used on a model, with the correct * materials. This is used for replacing the Iron Guard first person * arm materials with instances of the root character material used by * all other character models. */ var array<ReplacementMaterial> SkinReplacementMaterials; /** * If this is set, then the red and blue teams will not be transformed as per * the TeamInfo transform data (see UTMT_TeamInfo), but their original skins * will be used instead. */ var bool bUseOriginalRedAndBlueSkins; var MaterialInterface ShieldBeltMultiTeamMaterial; var array< class<Actor> > MultiTransInEffects; var array< class<Actor> > MultiTransOutEffects; var array<LinearColor> MultiTranslocateColor; var class<UTCustomChar_Data> CustomCharClass; var class<DamageType> ChangeTeamDamageClass; /** * @return True if we are allowed to perform reskinning using shaders, i.e. * we are not using the original red and blue skins. */ simulated function bool ReSkinningAllowed() { local bool bOnRedOrBlue; bOnRedOrBlue = (GetTeamNum() == 0 || GetTeamNum() == 1); return !(bOnRedOrBlue && bUseOriginalRedAndBlueSkins); } simulated function NotifyTeamChanged() { super.NotifyTeamChanged(); if(WorldInfo.NetMode != NM_DedicatedServer && ReSkinningAllowed() ) { DoSkinning(); } } simulated function MaterialInterface GetReplacementSkinMaterial(MaterialInterface Mat) { local int i; for(i = 0; i < SkinReplacementMaterials.Length; ++i) if(SkinReplacementMaterials[i].MaterialName ~= string(Mat)) Mat = SkinReplacementMaterials[i].ReplacementMaterial; return Mat; } /** * Here we replace the base materials of players for those with color changing * parameters. */ simulated function DoSkinning() { local MaterialInstanceConstant OldMIC; local MaterialInterface OldMat; local int i; local int j; local UTMT_TeamInfo MultiTeamInfo; if(GetTeam() != None) { MultiTeamInfo = UTMT_TeamInfo(WorldInfo.GRI.Teams[GetTeamNum()]); if(MultiTeamInfo != None) { for(i = 0; i < BodyMaterialInstances.Length; ++i) { OldMIC = BodyMaterialInstances[i]; MultiTeamInfo.TransformCharacterMaterial(OldMIC); } for(i = 0; i < ArrayCount(ArmsMesh); ++i) { for(j = 0; j < ArmsMesh[i].Materials.Length; ++j) { OldMat = ArmsMesh[i].GetMaterial(j); OldMat = GetReplacementSkinMaterial(OldMat); OldMIC = new class'MaterialInstanceConstant'; OldMIC.SetParent(OldMat); ArmsMesh[i].SetMaterial(j, OldMIC); MultiTeamInfo.TransformCharacterMaterial(OldMIC); } } } else { WarnInternal("Could not perform color transform on Pawn because teaminfo was not a subclass of UTMT_TeamInfo"); } } } /** * Same as the function in UTPawn, but uses the MultiTransInEffects array. Edit: 1-4-2008 Brian Alexander Changes: removed if (MultiTransInEffects.Length >= TeamNum) and replaced with if ( MultiTransInEffects[TeamNum] != none) */ function SpawnTransEffect(int TeamNum) { if (MultiTransInEffects[TeamNum] != none) { Spawn(MultiTransInEffects[TeamNum],self,,Location + GetCollisionHeight() * vect(0,0,0.75)); } } /** * Same as the function in UTPawn, but uses the MultiTransOutEffects array. Edit: 1-4-2008 Brian Alexander Changes: removed ASSSERT and replaced with if ( MultiTransoutEffects[TeamNum] == None ) */ function DoTranslocateOut(Vector PrevLocation, int TeamNum) { local UTEmit_TransLocateOut TLEffect; if ( MultiTransoutEffects[TeamNum] == None ) { super.DoTranslocateOut(PrevLocation,TeamNum); return; } TLEffect = UTEmit_TranslocateOut( Spawn(MultiTransoutEffects[TeamNum], self,, PrevLocation, rotator(Location - PrevLocation)) ); if (TLEffect != none && TLEffect.CollisionComponent != none) TLEffect.CollisionComponent.SetActorCollision(true, false); } /** * Same as the function in UTPawn, but uses the MultiTranslocateColor array. */ function PlayTeleportEffect(bool bOut, bool bSound) { local int TeamNum, TransCamIndx; local UTPlayerController PC; if ( (PlayerReplicationInfo != None) && (PlayerReplicationInfo.Team != None) ) { TeamNum = PlayerReplicationInfo.Team.TeamIndex; } if ( !bSpawnIn && (WorldInfo.TimeSeconds - SpawnTime < UTGame(WorldInfo.Game).SpawnProtectionTime) ) { bSpawnIn = true; SetBodyMatColor( SpawnProtectionColor, UTGame(WorldInfo.Game).SpawnProtectionTime ); SpawnTransEffect(TeamNum); if (bSound) { PlaySound(SpawnSound); } } else { SetBodyMatColor( MultiTranslocateColor[TeamNum], 1.0 ); SpawnTransEffect(TeamNum); if (bSound) { PlaySound(TeleportSound); } } if (bOut) { PC = UTPlayerController(Controller); if (PC != None) { if ( !WorldInfo.Game.bTeamGame || PlayerReplicationInfo == None || PlayerReplicationInfo.Team == None || PlayerReplicationInfo.Team.TeamIndex > 1 ) { TransCamIndx = 2; } else { TransCamIndx = TeamNum; } PC.ClientPlayCameraAnim(TransCameraAnim[TransCamIndx], 1.0f); } } super(GamePawn).PlayTeleportEffect( bOut, bSound ); } /** * Same as in UTPawn, except that it looks at the current gametype's HUDType * class for GetColor() to colorise the beacons. */ simulated event PostRenderFor(PlayerController PC, Canvas Canvas, vector CameraPosition, vector CameraDir) { local float TextXL, XL, YL, Dist; local vector ScreenLoc; local LinearColor TeamColor; local Color TextColor; local string ScreenName; local UTWeapon Weap; local UTPlayerReplicationInfo PRI; local UTMT_TeamHUD HUD; HUD = UTMT_TeamHUD(PC.MyHUD); if(HUD == None) WarnInternal("Gametype is not using a subclass of UTMT_HUD"); screenLoc = Canvas.Project(Location + GetCollisionHeight()*vect(0,0,1)); // make sure not clipped out if (screenLoc.X < 0 || screenLoc.X >= Canvas.ClipX || screenLoc.Y < 0 || screenLoc.Y >= Canvas.ClipY) { return; } PRI = UTPlayerReplicationInfo(PlayerReplicationInfo); if ( !WorldInfo.GRI.OnSameTeam(self, PC) ) { // maybe change to action music if close enough if ( WorldInfo.TimeSeconds - LastPostRenderTraceTime > 0.5 ) { if ( !UTPlayerController(PC).AlreadyInActionMusic() && (VSize(CameraPosition - Location) < VSize(PC.ViewTarget.Location - Location)) && !IsInvisible() ) { // check whether close enough to crosshair if ( (Abs(screenLoc.X - 0.5*Canvas.ClipX) < 0.1 * Canvas.ClipX) && (Abs(screenLoc.Y - 0.5*Canvas.ClipY) < 0.1 * Canvas.ClipY) ) { // periodically make sure really visible using traces if ( FastTrace(Location, CameraPosition,, true) || FastTrace(Location+GetCollisionHeight()*vect(0,0,1), CameraPosition,, true) ) { UTPlayerController(PC).ClientMusicEvent(0);; } } } LastPostRenderTraceTime = WorldInfo.TimeSeconds + 0.2*FRand(); } return; } // make sure not behind weapon if ( UTPawn(PC.Pawn) != None ) { Weap = UTWeapon(UTPawn(PC.Pawn).Weapon); if ( (Weap != None) && Weap.CoversScreenSpace(screenLoc, Canvas) ) { return; } } else if ( (UTVehicle_Hoverboard(PC.Pawn) != None) && UTVehicle_Hoverboard(PC.Pawn).CoversScreenSpace(screenLoc, Canvas) ) { return; } // periodically make sure really visible using traces if ( WorldInfo.TimeSeconds - LastPostRenderTraceTime > 0.5 ) { LastPostRenderTraceTime = WorldInfo.TimeSeconds + 0.2*FRand(); bPostRenderTraceSucceeded = FastTrace(Location, CameraPosition) || FastTrace(Location+GetCollisionHeight()*vect(0,0,1), CameraPosition); } if ( !bPostRenderTraceSucceeded ) { return; } HUD.GetMultiTeamColor( GetTeam(), TeamColor, TextColor); Dist = VSize(CameraPosition - Location); if ( Dist < TeamBeaconPlayerInfoMaxDist ) { ScreenName = PlayerReplicationInfo.GetPlayerAlias(); Canvas.StrLen(ScreenName, TextXL, YL); XL = Max( TextXL, 24 * Canvas.ClipX/1024 * (1 + 2*Square((TeamBeaconPlayerInfoMaxDist-Dist)/TeamBeaconPlayerInfoMaxDist))); } else { XL = Canvas.ClipX * 16 * TeamBeaconPlayerInfoMaxDist/(Dist * 1024); YL = 0; } HUD.static.DrawBackground(ScreenLoc.X-0.7*XL,ScreenLoc.Y-1.8*YL,1.4*XL,1.9*YL, TeamColor, Canvas); if ( (PRI != None) && (Dist < TeamBeaconPlayerInfoMaxDist) ) { Canvas.DrawColor = TextColor; Canvas.SetPos(ScreenLoc.X-0.5*TextXL,ScreenLoc.Y-1.2*YL); Canvas.DrawTextClipped(ScreenName, true); } if ( (HUD != None) && !HUD.bCrosshairOnFriendly && (Abs(screenLoc.X - 0.5*Canvas.ClipX) < 0.1 * Canvas.ClipX) && (screenLoc.Y <= 0.5*Canvas.ClipY) ) { // check if top to bottom crosses center of screen screenLoc = Canvas.Project(Location - GetCollisionHeight()*vect(0,0,1)); if ( screenLoc.Y >= 0.5*Canvas.ClipY ) { HUD.bCrosshairOnFriendly = true; } } } simulated function SetOverlayMaterial(MaterialInterface NewOverlay) { if( (NewOverlay!= None) && string(NewOverlay) ~= string(ShieldBeltMultiTeamMaterial)) { SetTeamShieldMaterialInstanceColor(NewOverlay); } super.SetOverlayMaterial(NewOverlay); } simulated function MaterialInterface GetShieldMaterialInstance(bool bTeamGame) { if(bTeamGame && ReSkinningAllowed()) return ShieldBeltMultiTeamMaterial; else return super.GetShieldMaterialInstance(bTeamGame); } simulated function SetTeamShieldMaterialInstanceColor(MaterialInterface ShieldMaterial) { local UTMT_TeamInfo MultiTeamInfo; local LinearColor ShieldColor; local MaterialInstanceConstant ShieldMIC; if(ReSkinningAllowed()) { MultiTeamInfo = UTMT_TeamInfo(GetTeam()); if(MultiTeamInfo != None) { ShieldColor = MultiTeamInfo.GetShieldBeltColor(); ShieldMIC = MaterialInstanceConstant(ShieldMaterial); if(ShieldMIC != None) ShieldMIC.SetVectorParameterValue('BeltColor', ShieldColor); } } } function PlayerChangedTeam() { Died( none, ChangeTeamDamageClass, Location ); } /*exec function TestHue(float H, float R, float G, float B) { UTMT_TeamInfo(GetTeam()).CharacterTeamColorTransforms[GetTeamNum()].Hue = H; UTMT_TeamInfo(GetTeam()).CharacterTeamColorTransforms[GetTeamNum()].R = R; UTMT_TeamInfo(GetTeam()).CharacterTeamColorTransforms[GetTeamNum()].G = G; UTMT_TeamInfo(GetTeam()).CharacterTeamColorTransforms[GetTeamNum()].B = B; DoSkinning(); }*/ defaultproperties { bUseOriginalRedAndBlueSkins=True MultiTranslocateColor(0)=(R=20.000000,G=0.000000,B=0.000000,A=1.000000) MultiTranslocateColor(1)=(R=0.000000,G=0.000000,B=20.000000,A=1.000000) MultiTranslocateColor(2)=(R=0.000000,G=20.000000,B=0.000000,A=1.000000) MultiTranslocateColor(3)=(R=20.000000,G=20.000000,B=0.000000,A=1.000000) CustomCharClass=Class'UTGame.UTCustomChar_Data' ChangeTeamDamageClass=Class'UTMultiTeam.UTMT_DmgType_ChangedTeam' } |
| Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
| previous class next class | frames no frames | |||||