## XIII
Class XIIIPawn

source: C:\XIII\XIII\Classes\XIIIPawn.uc

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Pawn
             |
             +--XIII.XIIIPawn

Direct Known Subclasses:BaseSoldier, Plongeur_USA01, FakeXIIIPawn, MitraillGuard, XIIICorpse, XIIICorpseStaticMesh, XIIIPlayerPawn

class XIIIPawn
extends Engine.Pawn

    //-----------------------------------------------------------
    //
    //-----------------------------------------------------------

Variables
`XIIILeftHand` | `LHand` Left Hand of the character (holding corpses/prisoners)
`float` | `LastJumpSoundTime` Used to avoid playing Jump sound to often (Event PlayJump is called more than once, too touchy to debug now).
`float` | `LastLandSoundTime` Used to avoid playing landed sound to often in case of physics crazyness
`int` | `MaxHealth` Player in flashback
`bool` | `bIsInCine` Player in flashback
`bool` | `bSearchable` Can we search the body ?
`float` | `fDrownCount` Left Hand of the character (holding corpses/prisoners)

States
Prisonner, Grabbed, BodyDropped, Dying

Function Summary
`void` | `AddVelocity(vector NewVelocity)`
    //_____________________________________________________________________________
`bool` | `BeingGrabbed()`
    //_____________________________________________________________________________
    // ELR Used for being grabbed by someone (Here we are alive (taken as prisonner)
    // Redefined in Dying state for grabbing corpses.
`bool` | `CanGrabCorpse(optional XIIIPawn)`
    //_____________________________________________________________________________
`bool` | `CanSplash()`
    //_____________________________________________________________________________
`bool` | `CanStun(optional XIIIPawn)`
    //_____________________________________________________________________________
`bool` | `CanTakePrisonner(optional XIIIPawn)`
    //_____________________________________________________________________________
`void` | `ChangedWeapon()`
    //_____________________________________________________________________________
    // Just changed to pendingWeapon
`void` | `CheckMaluses()`
    //_____________________________________________________________________________
    // ELR used to Check Maluses for Low Health on located body parts, now just used by LHand to grab corpses/hostages
`void` | `ChunkUp(int Damage)`
    //_____________________________________________________________________________
    // To be sure we do get Get Rid of destruction of the body.
`void` | `DBAnim(bool b)`
    //_____________________________________________________________________________
    exec
`void` | `DBAnimStatus(name St)`
    //_____________________________________________________________________________
    exec
`void` | `DBAutoAim(bool b)`
    //_____________________________________________________________________________
    exec
`void` | `DBCartoon(bool b)`
    //_____________________________________________________________________________
    exec
`void` | `DBPawnAnim(bool b)`
    //_____________________________________________________________________________
    exec
`simulated` | `DisplayDebug(Canvas C, out float, out float)`
    //_____________________________________________________________________________
    // ELR Add some info to the ShowDebug Exec
`void` | `DoJump(bool bUpdating)`
    //_____________________________________________________________________________
    //Player Jumped
    // ELR Added bAllowJump (Pawn Grabbed)
`Powerups` | `FindPowerUpItemName(string DesiredName)`
    //_____________________________________________________________________________
`Powerups` | `FindPowerUpItemNameForTrigger(name DesiredName)`
    //_____________________________________________________________________________
`XIIIDocuments` | `FindXXDoc(int NumPerso)`
    //_____________________________________________________________________________
    // Used for Menu (unable to access AllActors in Object SubClass, must be Actor SubClass).
`void` | `Gasp()`
    //_____________________________________________________________________________
`DamageLocations` | `GetDamageLocation(vector HitLoc, vector HitDir)`
    //_____________________________________________________________________________
    // ELR CheckDamageLocation
`int` | `GetDamageSide(vector HitLocation)`
    //_____________________________________________________________________________
    // ELR CheckDamageLocation
`name` | `GetItemBoneFor(Inventory I)`
    //_____________________________________________________________________________
`name` | `GetWeaponBoneFor(Inventory I)`
    //_____________________________________________________________________________
`void` | `GoHooking(Hook H)`
    //_____________________________________________________________________________
    // ELR Player is hooking
`void` | `Heal(int H)`
    //_____________________________________________________________________________
    // ELR to heal
`float` | `HealthPercent()`
    //_____________________________________________________________________________
`bool` | `IsDead()`
    //_____________________________________________________________________________
    // ELR Already dead if any body part HS
`bool` | `IsWounded()`
    //_____________________________________________________________________________
    // ELR To test if wounded
`void` | `JumpOffPawn()`
    //_____________________________________________________________________________
    // Also, non-players will jump off pawns immediately
    // ELR Decrease Z speed.
`void` | `KilledBy(Pawn EventInstigator)`
    //_____________________________________________________________________________
    // ::DBUG::
`simulated` | `LandedSpecial(optional bool)`
    //_____________________________________________________________________________
    // Landed modded to have body in the right place.
`simulated` | `NextItem()`
    //_____________________________________________________________________________
    // The player/bot wants to select next item
`simulated` | `PlayLandSound()`
    //_____________________________________________________________________________
    // Land sounds are footStepSounds w/ negative velocity to warn the Harmonix Script that it is a land
`simulated` | `ReduceMyCylinder()`
    //_____________________________________________________________________________
`void` | `ServerChangedItem(Powerups OldItem, Powerups I)`
    //_____________________________________________________________________________
`void` | `ServerChangedWeapon(Weapon OldWeapon, Weapon W)`
    //_____________________________________________________________________________
`void` | `SetBreatheOn()`
    //_____________________________________________________________________________
`void` | `SetGroundSpeed(float SpeedFactor)`
    //_____________________________________________________________________________
`void` | `SpawnCadavre()`
    //_____________________________________________________________________________
`void` | `TD(int ammount)`
    //_____________________________________________________________________________
    // ELR ::DBUG:: To check damages effects
`void` | `TakeDrowningDamage()`
    //_____________________________________________________________________________
    // ELR
`void` | `TakeFallingDamage()`
    //_____________________________________________________________________________
    // ELR Executed in Landed()
`bool` | `UnGrabbed(vector Loc, vector Dir)`
    //_____________________________________________________________________________

State Prisonner Function Summary
`void` | `EndState()`
`void` | `BeginState()`
`bool` | `UnGrabbed(vector Loc, vector Dir)`

State Grabbed Function Summary
`void` | `EndState()`
`void` | `BeginState()`
`bool` | `UnGrabbed(vector Loc, vector Dir)`
`void` | `AnimEnd(int Channel)`

State BodyDropped Function Summary
`bool` | `BeingGrabbed()`
`void` | `PlayFiring(float Rate, name FiringMode)`
`void` | `PlayReLoading(float Rate, name FiringMode)`
`void` | `PlaySwitchingWeapon(float Rate, name FiringMode)`
`void` | `PlaySearchCorpse()`
`void` | `PlayOpenDoor()`
`void` | `PlayWaiting()`

State Dying Function Summary
`void` | `LieStill()`
`void` | `Landed(vector HitNormal)`
`void` | `BeginState()`
`bool` | `BeingGrabbed()`
`void` | `Timer()`
`void` | `PlayFiring(float Rate, name FiringMode)`
`void` | `PlayReLoading(float Rate, name FiringMode)`
`void` | `PlaySwitchingWeapon(float Rate, name FiringMode)`
`void` | `PlaySearchCorpse()`
`void` | `PlayOpenDoor()`
`void` | `PlayWaiting()`

Source Code

    00001	//-----------------------------------------------------------
    00002	//
    00003	//-----------------------------------------------------------
    00004	class XIIIPawn extends Pawn
    00005	  native;
    00006
    00007	var XIIILeftHand LHand;   // Left Hand of the character (holding corpses/prisoners)
    00008	var float fDrownCount;
    00009	var bool bSearchable;     // Can we search the body ?
    00010	var bool bIsInCine;       // Player in flashback
    00011	var int MaxHealth;
    00012	var(Cine_Behavior) int GameOverGoal;
    00013	var(Events) name EventOnGrab;
    00014
    00015	var float LastLandSoundTime;  // Used to avoid playing landed sound to often in case of physics crazyness
    00016	var float LastJumpSoundTime;  // Used to avoid playing Jump sound to often (Event PlayJump is called more than once, too touchy to debug now).
    00017
    00018	//_____________________________________________________________________________
    00019	// ELR Replicate things
    00020	replication
    00021	{
    00022	    // functions the client should send to the server.
    00023	    reliable if( Role<ROLE_Authority )
    00024	      ServerChangedItem;
    00025	}
    00026
    00027	/*
    00028	//_____________________________________________________________________________
    00029	exec function DBAnimStatus( name St )
    00030	{
    00031	    SetAnimStatus(St);
    00032	}
    00033
    00034	//_____________________________________________________________________________
    00035	exec function DBCartoon( bool b )
    00036	{
    00037	    bDBCartoon = b;
    00038	}
    00039	//_____________________________________________________________________________
    00040	exec function DBAnim( bool b )
    00041	{
    00042	    bDBAnim = b;
    00043	}
    00044	//_____________________________________________________________________________
    00045	exec function DBPawnAnim( bool b )
    00046	{
    00047	    local XIIIpawn P;
    00048
    00049	    foreach allactors(class'XIIIPawn', P)
    00050	      if ( (p != none) && !P.IsPlayerPawn() )
    00051	        P.bDBAnim = b;
    00052	}
    00053
    00054	//_____________________________________________________________________________
    00055	exec function DBAutoAim( bool b )
    00056	{
    00057	    bDBShowAutoAim = b;
    00058	}
    00059	*/
    00060	//_____________________________________________________________________________
    00061	// ELR ::DBUG:: To check damages effects
    00062	exec function TD( int ammount)
    00063	//exec function TD( int loc, int ammount)
    00064	{
    00065	      TakeDamage( ammount, self, Location, vect(0,0,0), class'DTFisted');
    00066	}
    00067
    00068	//_____________________________________________________________________________
    00069	// ELR
    00070	simulated event PostBeginPlay()
    00071	{
    00072	    Super(Pawn).PostBeginPlay();
    00073	    SetTimer( 1.0, false );
    00074	    EnableChannelNotify(FIRINGCHANNEL, 1);
    00075	    if ( bBoss )
    00076	      MaxHealth = Health;
    00077	    SplashTime = Level.TimeSeconds; // to avoid pawn spawning underwater to have their Splash
    00078	}
    00079
    00080	//_____________________________________________________________________________
    00081	simulated event Destroyed()
    00082	{
    00083	//    Log(self$" destroyed");
    00084	    if ( MyBloodPool != none )
    00085	      MyBloodPool.destroy();
    00086	    Super.Destroyed();
    00087	}
    00088
    00089	//_____________________________________________________________________________
    00090	// called once at the beginning for initialization
    00091	simulated event Timer()
    00092	{
    00093	    if ( bIsDead || IsDead() )
    00094	      return;
    00095
    00096	    if ( bPaf )
    00097	    {
    00098	      bPaf=false;
    00099	      AnimBlendToAlpha(FIRINGCHANNEL+2,0,0.1);
    00100	    }
    00101
    00102	    if ( (Shadow!=none) && Level.bLonePlayer && (XIIIGameInfo(Level.Game).MapInfo != none) )
    00103	    {
    00104	      Shadow.MaxTraceDistance = XIIIGameInfo(Level.Game).MapInfo.MaxTraceDistance;
    00105	      Shadow.ShadowIntensity = XIIIGameInfo(Level.Game).MapInfo.ShadowIntensity;
    00106	      Shadow.ShadowMaxDist = XIIIGameInfo(Level.Game).MapInfo.ShadowMaxDist;
    00107	      Shadow.ShadowTransDist = XIIIGameInfo(Level.Game).MapInfo.ShadowTransDist;
    00108	    }
    00109	    ChangeAnimation();
    00110	}
    00111
    00112	//_____________________________________________________________________________
    00113	simulated function PlayTakeHit(vector HitLoc, int Damage, class<DamageType> damageType)
    00114	{
    00115	    super.PlayTakeHit(HitLoc, Damage, damageType);
    00116	    if( ( !bIsDead && !IsDead() ) && ( bIsPafable ) )
    00117	    {
    00118	      bPaf = true;
    00119	      if ( !bIsCrouched )
    00120	      {
    00121	        Switch(WeaponMode)
    00122	        {
    00123	          Case 'FM_Snipe':
    00124	            PlayAnim('PafSniper',,0.1,FIRINGCHANNEL+2); break;
    00125	          Case 'FM_1H':
    00126	          Case 'FM_44Alt':
    00127	            PlayAnim('PafPistolet',,0.1,FIRINGCHANNEL+2); break;
    00128	          Case 'FM_2H':
    00129	          Case 'FM_M16':
    00130	          Case 'FM_ARAlt':
    00131	          Case 'FM_ShotGunAlt':
    00132	          Case 'FM_HarpoonAlt':
    00133	            PlayAnim('PafGun',,0.1,FIRINGCHANNEL+2); break;
    00134	          Case 'FM_Bazook':
    00135	          Case 'FM_BazookAlt':
    00136	            PlayAnim('PafBazooka',,0.1,FIRINGCHANNEL+2); break;
    00137	          Case 'FM_2HHeavy':
    00138	            PlayAnim('PafM60',,0.1,FIRINGCHANNEL+2); break;
    00139	          Case 'FM_Fists':
    00140	          Case 'FM_Throw':
    00141	          Case 'FM_Stun':
    00142	          default:
    00143	            PlayAnim('PafNeutre',,0.1,FIRINGCHANNEL+2); break;
    00144	        }
    00145	      }
    00146	      else
    00147	      {
    00148	        Switch(WeaponMode)
    00149	        {
    00150	          Case 'FM_Snipe':
    00151	            PlayAnim('PafSniperAccroupi',,0.1,FIRINGCHANNEL+2); break;
    00152	          Case 'FM_1H':
    00153	          Case 'FM_44Alt':
    00154	            PlayAnim('PafPistoletAccroupi',,0.1,FIRINGCHANNEL+2); break;
    00155	          Case 'FM_Throw':
    00156	            PlayAnim('DeathBuste0',,0.1,FIRINGCHANNEL+2); break;
    00157	          Case 'FM_2H':
    00158	          Case 'FM_M16':
    00159	          Case 'FM_ARAlt':
    00160	          Case 'FM_ShotGunAlt':
    00161	          Case 'FM_HarpoonAlt':
    00162	            PlayAnim('PafGunAccroupi',,0.1,FIRINGCHANNEL+2); break;
    00163	          Case 'FM_Bazook':
    00164	          Case 'FM_BazookAlt':
    00165	            PlayAnim('PafBazookaAccroupi',,0.1,FIRINGCHANNEL+2); break;
    00166	          Case 'FM_2HHeavy':
    00167	            PlayAnim('PafM60Accroupi',,0.1,FIRINGCHANNEL+2); break;
    00168	          Case 'FM_Fists':
    00169	          Case 'FM_Stun':
    00170	          Default:
    00171	            PlayAnim('PafNeutreAccroupi',,0.1,FIRINGCHANNEL+2); break;
    00172	        }
    00173	      }
    00174	      AnimBlendParams(FIRINGCHANNEL+2,0.2 + 0.6*FRand(),0,0);
    00175	      SetTimer( 0.2, false );
    00176	    }
    00177	}
    00178
    00179	//_____________________________________________________________________________
    00180	// ELR Add some info to the ShowDebug Exec
    00181	simulated function DisplayDebug(Canvas C, out float YL, out float YPos)
    00182	{
    00183	    Super.DisplayDebug(C, YL, YPos);
    00184
    00185	    C.DrawText("ALLIANCE="$Alliance@"VISIBILITY "$Visibility);
    00186	    YPos += YL;
    00187	    C.SetPos(4,YPos);
    00188	    C.DrawText("Health "$Health@"bHaveOnlyOneHandFree="$bHaveOnlyOneHandFree@"GroundSpeed="$GroundSpeed);
    00189	    YPos += YL;
    00190	    C.SetPos(4,YPos);
    00191	}
    00192
    00193	//_____________________________________________________________________________
    00194	// ELR CheckDamageLocation
    00195	function DamageLocations GetDamageLocation( vector HitLoc , vector HitDir)
    00196	{
    00197	    local Vector Offset;
    00198	    local float HeadOffsetZ;
    00199
    00200	    if ( bIsDead ) return LOC_Body;
    00201
    00202	    if ( LastBoneHit == 'X Head' )
    00203	      return LOC_Head;
    00204	    if ( LastBoneHit == 'X Spine1' )
    00205	      return LOC_Body;
    00206
    00207	    // Use the hitlocation to determine where the pawn is hit
    00208	    // Transform the worldspace hitlocation into objectspace
    00209	    // In objectspace, X is front to back Y is side to side, and Z is top to bottom
    00210	    // Inspired from DX (Thanx to the scripter that gave the offset formula to a newB:)
    00211	    Offset = (HitLoc - Location) << Rotation;
    00212	    headOffsetZ = CollisionHeight * 0.75;
    00213
    00214	    if ( Offset.Z > HeadOffsetZ )
    00215	    {
    00216	      return LOC_HeadSide;
    00217	    }
    00218	    else
    00219	    {
    00220	      return LOC_Body;
    00221	    }
    00222	}
    00223
    00224	//_____________________________________________________________________________
    00225	// ELR CheckDamageLocation
    00226	function int GetDamageSide( vector HitLocation )
    00227	{
    00228	    local int i;
    00229	    local vector offset;
    00230
    00231	    // Use the hitlocation to determine where the pawn is hit
    00232	    // Transform the worldspace hitlocation into objectspace
    00233	    // In objectspace, X is front to back Y is side to side, and Z is top to bottom
    00234	    offset = (HitLocation - Location) << Rotation;
    00235
// Log("GetDamageSide Offset="$Offset$" hitLocation="$hitLocation" Location="$Location); 00236 00237 if (offset.y >= 0) i+=1; 00238 if (offset.z >= 0.5 * CollisionHeight) i+=2; 00239 if (offset.x <= -0.7 * CollisionRadius) i+=4; // from behind 00240 else if ( (offset.x < 0.0) && (offset.z > 0.95 * CollisionHeight) ) i+=4; // from above 00241 00242 // The result returned is : 00243 // - Back Upper shot >=6 00244 // - Back shot >=4 00245 // - Front Shot <4 00246 return i; 00247 } 00248 00249 //_____________________________________________________________________________ 00250 // ELR Already dead if any body part HS 00251 function bool IsDead() 00252 { 00253 Local int i, j; 00254 00255 if (Controller == none) 00256 return true; 00257 00258 if ( Health <= 0 ) 00259 return true; 00260 00261 return false; 00262 } 00263 00264 //_____________________________________________________________________________ 00265 // ELR To test if wounded 00266 function bool IsWounded() 00267 { 00268 if ( Health < default.Health ) 00269 return true; 00270 } 00271 00272 //_____________________________________________________________________________ 00273 simulated function float HealthPercent() 00274 { 00275 if ( IsDead() || bIsDead ) 00276 return 0; 00277 if ( bBoss ) 00278 return fMax(1.0, (100.0 * Health / MaxHealth)); 00279 else 00280 return fMax(1.0, (100.0 * Health / default.Health)); 00281 } 00282 00283 //_____________________________________________________________________________ 00284 // ::DBUG:: 00285 function KilledBy( pawn EventInstigator ) 00286 { 00287 local Controller Killer; 00288 00289 //Log(self@"killed by"@EventInstigator); 00290 Health = 0; 00291 if ( EventInstigator != None ) 00292 Killer = EventInstigator.Controller; 00293 Died( Killer, class'DTSuicided', Location ); 00294 } 00295 00296 //_____________________________________________________________________________ 00297 // ELR Take Damage with Damage Location 00298 function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, class<DamageType> damageType) 00299 { 00300 local int actualDamage; 00301 local bool bAlreadyDead; 00302 local Controller Killer; 00303 local DamageLocations Loc; 00304 local vector HitLocCode; 00305 local vector DeathMomentum; 00306 local float f; 00307 local color C; 00308 00309 if ( Role < ROLE_Authority ) 00310 { 00311 log(self$" client damage type "$damageType$" by "$instigatedBy); 00312 return; 00313 } 00314 if ( Level.bLonePlayer && Level.Game.bGameEnded ) 00315 return; 00316 00317 // Log(self$"TakeDamage momentum="$momentum); 00318 bAlreadyDead = bIsDead; 00319 00320 if (Physics == PHYS_None) 00321 SetMovementPhysics(); 00322 if (Physics == PHYS_Walking) 00323 momentum.Z = FMax(momentum.Z, 0.4 * VSize(momentum)); 00324 if ( instigatedBy == self ) 00325 momentum *= 0.6; 00326 DeathMomentum = momentum/Mass; 00327 momentum=vect(0,0,0); // ELR No more weapon momentum now 00328 00329 // Get Damage Location 00330 // ELR need the hit normal to have accurate head shots, don't have so use the instigator location (bad for area damages but well...) 00331 // Log(self@"InstigatedBy="$instigatedBy); 00332 00333 Loc = GetDamageLocation( HitLocation, Location - instigatedBy.Location ); 00334 00335 // DebugLog(" > "$self@"takedamage "$Damage$" type "$damageType$" location="$Loc@"in state"@GetStateName()); 00336 00337 if ((damageType==class'DTGunned') || (damageType==class'DTShotGunned') || (damageType==class'DTPierced') || (damageType==class'DTSniped') || (damageType==class'DTBladeCut') || (damageType==class'DTH2HBlade') ) 00338 { 00339 // Log("Possible HeadShot, Loc="$Loc); 00340 if ( Loc == LOC_HeadSide ) 00341 { 00342 if (damageType != class'DTH2HBlade') 00343 return; // Near but Missed the head ! 00344 else 00345 Loc = LOC_Head; // force HeadShots w/ H2H use of TKnives 00346 } 00347 if ( Loc == LOC_Head ) 00348 { 00349 if ( XIIIWeapon(InstigatedBy.Weapon).bHaveScope || class<XIIIDamageType>(DamageType).default.bAllowHeadShotSFXTrigger ) 00350 DamageType = Class'XIII.DTHeadShot'; // Used for HeadShotSFXTrigger 00351 if ( fRand() > (1.25 - XIIIPawn(instigatedBy).Skill*0.25) ) 00352 return; // For Low level enemis lower the headshot probabilities 00353 } 00354 } 00355 00356 // Handle stunning skill here 00357 if ( (damagetype == Class'XIII.DTFisted') && (GetDamageside(HitLocation)>=6) && (instigatedBy.FindInventoryKind('StunningSkill')!=none) ) 00358 { 00359 damagetype = class'XIII.DTStunned'; 00360 } 00361 00362 // If stun increase damage to be sure we kill 00363 if ( bCanBeStunned && ((damagetype==Class'XIII.DTStunned') || (damagetype==Class'XIII.DTSureStunned')) ) 00364 { 00365 Damage += 2000; 00366 Loc = LOC_Head; 00367 } 00368 00369 // DTFisted should be DTStunned but don't kil on first hit, only to prevent Dying Event triggered. 00370 // if ( (damagetype == Class'XIII.DTFisted') || (damagetype == Class'XIII.DTCouDCross') ) 00371 // damagetype = class'XIII.DTStunned'; 00372 00373 HitLocCode = vect(1,0,0) * Loc; // HitLodCode.x contain the Location in order to use it in armor absorption 00374 00375 // Log(self@"takedamage HitLocCode="$HitLocCode@"damagetype="$damagetype); 00376 00377 // Armor/var. Absorption 00378 if ( class<XIIIDamageType>(DamageType).default.bGlobalDamages ) 00379 { // damage head & body location, thus damage all armors 00380 actualDamage = Level.Game.ReduceDamage(2*Damage/5, self, instigatedBy, vect(0,0,0), Momentum, DamageType) 00381 + Level.Game.ReduceDamage(3*Damage/5, self, instigatedBy, vect(1,0,0), Momentum, DamageType); 00382 } 00383 else // only damage the real location. 00384 actualDamage = Level.Game.ReduceDamage(Damage, self, instigatedBy, HitLocCode, Momentum, DamageType); 00385 00386 if ( Loc == LOC_Head ) 00387 Health -= ActualDamage*HeadShotFactor; 00388 else 00389 Health -= ActualDamage; 00390 00391 if ( HitLocation == vect(0,0,0) ) 00392 HitLocation = Location; 00393 00394 if ( bAlreadyDead ) 00395 { 00396 Warn(self$" took regular damage "$damagetype$" from "$instigatedby$" while already dead at "$Level.TimeSeconds); 00397 return; 00398 } 00399 00400 if ( bCanBeStunned && (DamageType == class'XIII.DTSureStunned') && IsDead() ) 00401 { // we had been stunned by deco weapon, if player did it flash the player's view 00402 if ( instigatedBy.IsLocallyControlled() ) 00403 { 00404 if ( Level.GetPlateforme() == 3 ) 00405 { 00406 C.R = 244; 00407 C.B = 150; 00408 } 00409 else 00410 { 00411 C.B = 244; 00412 C.R = 150; 00413 } 00414 C.G = 195; 00415 C.A = 255; 00416 Playercontroller(instigatedBy.controller).ClientHighLight(C, 0.5); 00417 XIIIPlayercontroller(instigatedBy.controller).ClientTargetHighLight(150, 0.4, 0.5); 00418 } 00419 } 00420 00421 if ( IsDead() ) 00422 { // Pawn died 00423 if ( Controller != None ) 00424 { 00425 Controller.NotifyTakeHit(instigatedBy, HitLocCode, actualDamage, DamageType, Momentum); 00426 Controller.Enemy = instigatedBy; 00427 } 00428 if ( instigatedBy != None ) 00429 Killer = instigatedBy.Controller; // ::FIXME:: what if killer died before killing you 00430 if ( bPhysicsAnimUpdate ) 00431 TearOffMomentum = momentum; 00432 AddVelocity( DeathMomentum ); 00433 Died(Killer, damageType, HitLocCode); 00434 00435 // Log("DYING PlayingSound "$DeathSound[int(f)]); 00436 if ( !IsPlayerPawn() ) 00437 { 00438 if ( class<XIIIDamageType>(DamageType).default.bBloodSplash ) 00439 { 00440 if ( (Level.Game != none) && (Level.Game.GoreLevel == 0) ) 00441 spawn(class'BloodSplash', self,, HitLocation, rotator(HitLocation - (InstigatedBy.Location + InstigatedBy.EyePosition()))); 00442 } 00443 if ( class<XIIIDamageType>(DamageType).default.bSPawnDeathOnomatop ) 00444 MyDeathOno = Spawn(class'DeathOnomatopEmitter', self,, location + 92 * vect(0,0,1)); 00445 f = frand()*4; 00446 // PlaySound(DeathSound[int(f)]); 00447 } 00448 // Log("DYING Velocity after Died() == "$Velocity$" Physics="$Physics); 00449 } 00450 else 00451 { // Still Alive 00452 // AddVelocity( momentum ); 00453 00454 PlayHit(actualDamage, HitLocCode, damageType, Momentum); 00455 // Log("TakeDamage ClientViewFeedBackSetUp"); 00456 if ( (XIIIPlayerController(controller) != none) && (instigatedBy.Weapon != none) && (Level.GetPlateforme() != 31) && (Level.GetPlateforme() != 3) ) 00457 XIIIPlayerController(controller).ClientViewFeedBackSetUp(class<XIIIWeapon>(instigatedBy.Weapon.class)); 00458 00459 CheckMaluses(); 00460 if ( Controller != None ) 00461 Controller.NotifyTakeHit(instigatedBy, HitLocCode, actualDamage, DamageType, Momentum); 00462 } 00463 // MakeNoise(1.0); 00464 } 00465 00466 //_____________________________________________________________________________ 00467 function PlayHit(float Damage, vector HitLocation, class<DamageType> damageType, vector Momentum) 00468 { 00469 // local vector BloodOffset, Mo; 00470 local int param3; 00471 local sound S; 00472 00473 // DebugLog(self@"PlayHit hHitSound="$hHitSound@"DamageType="$DamageType@"SndType="$DamageType.default.SoundType); 00474 00475 if ( (Damage <= 0) && !Controller.bGodMode ) 00476 return; 00477 00478 if ( IsPlayerPawn() ) 00479 PlaySound(hHitSound, DamageType.default.SoundType, Damage, int(bIsDead) ); 00480 else if ( (DamageType.default.SoundType == 8) || (DamageType.default.SoundType == 9) ) 00481 PlaySound(hHitSound, DamageType.default.SoundType, Damage); 00482 00483 if ( Health <= 0 ) 00484 { 00485 if ( PhysicsVolume.bDestructive && (PhysicsVolume.ExitActor != None) ) 00486 Spawn(PhysicsVolume.ExitActor); 00487 return; 00488 } 00489 if ( Level.TimeSeconds - LastPainTime > 0.1 ) 00490 { 00491 PlayTakeHit(HitLocation,Damage,damageType); 00492 LastPainTime = Level.TimeSeconds; 00493 BaffeCount ++; 00494 } 00495 } 00496 00497 //_____________________________________________________________________________ 00498 // ELR 00499 function Died(Controller Killer, class<DamageType> damageType, vector HitLocCode) 00500 { 00501 local Controller Other; 00502 local int i; 00503 local inventory Kapio; 00504 00505 PawnKiller = Killer.Pawn; 00506 00507 // Log(self@"Died in state"@GetStateName()@"controller in state"@Controller.GetStateName()@"damageType="@damageType); 00508 00509 HitDamageType = DamageType; 00510 // if ( class<XIIIDamageType>(HitDamageType).default.bDieInSilencePlease ) 00511 // Log(self$" Died in silence"); 00512 00513 if ( bDeleteMe ) 00514 return; // Already destroyed 00515 00516 if ( Level.Game.PreventDeath(self, Killer, damageType, HitLocCode) ) 00517 { 00518 Health = max(Health, 1); // mutator should set this higher 00519 return; 00520 } 00521 00522 // ELR Leave controlled actor 00523 if (MitraillTop(ControlledActor) != none) 00524 MitraillTop(ControlledActor).LeaveControl(); 00525 if ( Weapon != none ) 00526 Weapon.NotifyOwnerKilled(Killer); 00527 00528 // ELR 00529 ShouldCrouch(false); 00530 00531 Health = Min(0, Health); 00532 00533 /* 00534 if ( MyHead != none ) 00535 { 00536 // DetachFromBone( MyHead ); 00537 MyHead.Destroy(); 00538 } 00539 */ 00540 00541 /* for ( Other=Level.ControllerList; Other!=None; Other=Other.nextController ) 00542 Other.Killed(Killer, self, damageType); */ // Replaced by NotifyKilled call in gameinfo 00543 Level.Game.Killed(Killer, Controller, self, damageType); 00544 00545 // ELR Characters that are stunned MUST NOT Cause their event 00546 if ( bCauseEventOnStun || ((DamageType != class'DTFisted') && (DamageType != class'DTCouDCross') && (DamageType != class'DTStunned') && (DamageType != class'DTSureStunned') && (DamageType != class'DTDropAfterStun')) ) 00547 { 00548 if ( Killer != None ) 00549 TriggerEvent(Event, self, Killer.Pawn); 00550 else 00551 TriggerEvent(Event, self, None); 00552 } 00553 00554 Velocity.Z *= 1.3; 00555 if ( IsHumanControlled() ) 00556 if( !Controller.bIsBot ) 00557 PlayerController(Controller).ForceDeathUpdate(); 00558 00559 TakeHitLocation = HitLocCode; 00560 00561 // DONT Set bTear off instead of play anim instead everything wrong for on-line 00562 if ( Level.NetMode == NM_StandAlone ) 00563 bTearOff = true; 00564 else 00565 PlayDying(DamageType, HitLocCode); // HitLocCode instead of HitLocation 00566 00567 bIsDead = true; 00568 SetBoneDirection( FIRINGBLENDBONE, rot(0,0,0), vect(0,0,0), 0.0 ); 00569 00570 if ( Level.Game.bGameEnded ) 00571 return; 00572 if ( !bPhysicsAnimUpdate && (RemoteRole == ROLE_AutonomousProxy) ) 00573 ClientDying(DamageType, HitLocCode); 00574 00575 // ELR no more physics anim update for deads 00576 // bPhysicsAnimUpdate = false; 00577 // Log("DamageType="$DamageType$"HitLocCode="$HitLocCode); 00578 if ( (fRand() < 0.7) 00579 || (DamageType == class'DTStunned') 00580 || (DamageType == class'DTSureStunned') 00581 || (DamageType == class'DTHeadShot') 00582 || (HitLocCode.X == 0) ) 00583 { 00584 Kapio = Inventory; 00585 while (Kapio != none) 00586 { 00587 if ( Kapio.IsA('Beret') || Kapio.IsA('BeretJungle') || Kapio.IsA('BeretSnow') ) 00588 { 00589 Kapio.NotifyOwnerKilled(Killer); 00590 break; 00591 } 00592 Kapio = Kapio.Inventory; 00593 } 00594 } 00595 } 00596 00597 //_____________________________________________________________________________ 00598 // To be sure we do get Get Rid of destruction of the body. 00599 function ChunkUp(int Damage) 00600 { 00601 XIIIGameInfo(Level.Game).DropInventory(self); 00602 // Super.ChunkUp(Damage); 00603 } 00604 00605 //_____________________________________________________________________________ 00606 // ELR to heal 00607 function Heal(int H) 00608 { 00609 Local int i; 00610 00611 // log("Heal called w/ ammount="$H); 00612 Health = Min(Default.Health, Health+H); 00613 // CheckMaluses(); // no need in this now that we don't have any negative fx for low health 00614 } 00615 00616 //_____________________________________________________________________________ 00617 // ELR used to Check Maluses for Low Health on located body parts, now just used by LHand to grab corpses/hostages 00618 function CheckMaluses() 00619 { 00620 if ( (LHand != none) && (LHand.pOnShoulder != none) ) 00621 { 00622 bAllowJump = false; 00623 bCanCrouch = false; 00624 ShouldCrouch(false); 00625 } 00626 else 00627 { 00628 bAllowJump = default.bAllowJump; 00629 bCanCrouch = true; 00630 } 00631 } 00632 00633 //_____________________________________________________________________________ 00634 function SetGroundSpeed(float SpeedFactor) 00635 { 00636 local float NewSpeed; 00637 //Log("]]] SetGroundSpeed call for "$self$" SpeedFactorLimit="$SpeedFactorLimit); 00638 if ( SpeedFactor < 1.0 ) 00639 NewSpeed = default.Groundspeed * SpeedFactor * SpeedFactorLimit; 00640 else 00641 NewSpeed = default.Groundspeed * SpeedFactorLimit; 00642 00643 NewSpeed = max(NewSpeed, 5.0); // To avoid GroundSpeed=0, pb in checkbob 00644 if ( GroundSpeed != NewSpeed ) 00645 GroundSpeed = NewSpeed; // ELR for on-line do this to avoid bNetDirtied each frame 00646 // Debuglog(">> SetGroundSpeed w/ SpeedFactor="$SpeedFactor$" SpeedFactorLimit="$SpeedFactorLimit$" GroundSpeed set to "$GroundSpeed); 00647 } 00648 00649 //_____________________________________________________________________________ 00650 // Just changed to pendingWeapon 00651 function ChangedWeapon() 00652 { 00653 local Weapon OldWeapon; 00654 local Powerups OldItem; 00655 local bool bWeaponMode; 00656 00657 if ( XIIIPlayerController(controller) != none ) 00658 { 00659 XIIIPlayerController(controller).bWeaponMode = XIIIPlayerController(controller).bWaitforWeaponMode; 00660 bWeaponMode = XIIIPlayerController(controller).bWeaponMode; 00661 if ( !bWeaponMode ) 00662 { // Item mode, should chek we really have an item to select 00663 if ( (SelectedItem == none) && (PendingItem == none) ) 00664 { 00665 if ( !XIIIPlayerController(controller).bWeaponBlock ) 00666 Warn("!@! ChangeWeapon to item mode but no Pending nor Selected Item"); 00667 XIIIPlayerController(controller).NextWeapon(); 00668 if ( PendingWeapon != none ) 00669 PendingWeapon.BringUp(); // May happen if bWeaponBlock 00670 return; 00671 } 00672 } 00673 } 00674 else 00675 { 00676 bWeaponMode=true; 00677 } 00678 00679 /* if ( bWeaponMode ) 00680 { 00681 Log(">>> Changed Weapon w/ "$Weapon$" for "$PendingWeapon); 00682 // Log(" > PendingWeapon Role="$PendingWeapon.Role@"ReMoteRole="$PendingWeapon.RemoteRole); 00683 } 00684 else 00685 { 00686 Log(">>> Changed Item w/ "$SelectedItem$" for "$PendingItem); 00687 // Log(" > PendingItem Role="$PendingItem.Role@"ReMoteRole="$PendingItem.RemoteRole); 00688 } */ 00689 00690 if ( bWeaponMode ) 00691 { 00692 OldWeapon = Weapon; 00693 00694 if ( (XIIIPlayerController(controller)!=none) && XIIIPlayerController(controller).bWeaponBlock ) 00695 { 00696 Weapon = none; 00697 return; 00698 } 00699 00700 if ( (PendingWeapon==none) || (Weapon == PendingWeapon) ) 00701 { 00702 // Log(" > Weapon="$Weapon@"in state"@Weapon.GetStateName()); 00703 if ( Weapon == None ) 00704 { 00705 Controller.SwitchToBestWeapon(); 00706 return; 00707 } 00708 // else if ( Weapon.IsInState('DownWeapon') ) 00709 // Weapon.GotoState('Idle'); 00710 Weapon.Instigator = self; 00711 PendingWeapon = None; 00712 if ( (Weapon != None) && (Level.NetMode == NM_Client) ) 00713 { 00714 Weapon.bChangeWeapon = false; 00715 Weapon.BringUp(); 00716 } 00717 ServerChangedWeapon(OldWeapon, Weapon); 00718 Weapon.AttachToPawn(self); 00719 return; 00720 } 00721 // ELR Modif here to allow noweapon states 00722 if ( (PendingWeapon == None) && (XIIIPlayerController(controller)!=none) && !XIIIPlayerController(controller).bWeaponBlock ) 00723 PendingWeapon = Weapon; 00724 00725 Weapon = PendingWeapon; 00726 if ( (Weapon != None) && (Level.NetMode == NM_Client) ) 00727 { 00728 Weapon.bChangeWeapon = false; 00729 Weapon.BringUp(); 00730 } 00731 PendingWeapon = None; 00732 Weapon.Instigator = self; 00733 ServerChangedWeapon(OldWeapon, Weapon); 00734 Weapon.AttachToPawn(self); 00735 if ( Controller != none ) 00736 Controller.ChangedWeapon(); 00737 } 00738 else 00739 { 00740 OldItem = SelectedItem; 00741 00742 if ( (XIIIPlayerController(controller)!=none) && XIIIPlayerController(controller).bWeaponBlock ) 00743 return; 00744 00745 if ( (PendingItem==none) || (SelectedItem == PendingItem) ) 00746 { 00747 // Log(" > SelectedItem="$SelectedItem@"in state"@SelectedItem.GetStateName()); 00748 if ( SelectedItem == None ) 00749 { 00750 XIIIPlayerController(Controller).cNextItem(); 00751 return; 00752 } 00753 SelectedItem.Instigator = self; 00754 PendingItem = None; 00755 if ( (SelectedItem != None) && (Level.NetMode == NM_Client) ) 00756 { 00757 XIIIItems(SelectedItem).bChangeItem = false; 00758 XIIIItems(SelectedItem).BringUp(); 00759 } 00760 ServerChangedItem(OldItem, SelectedItem); 00761 return; 00762 } 00763 if ( ( PendingItem == None ) && !XIIIPlayerController(controller).bWeaponBlock ) 00764 PendingItem = SelectedItem; 00765 00766 SelectedItem = PendingItem; 00767 if ( (SelectedItem != None) && (Level.NetMode == NM_Client) ) 00768 { 00769 XIIIItems(SelectedItem).bChangeItem = false; 00770 XIIIItems(SelectedItem).BringUp(); 00771 } 00772 PendingItem = None; 00773 SelectedItem.Instigator = self; 00774 ServerChangedItem(OldItem, SelectedItem); 00775 if ( Controller != None ) 00776 Controller.ChangedWeapon(); 00777 00778 } 00779 PlayWaiting(); // ELR to update wating animation function of the weapon/item in hand 00780 } 00781 00782 //_____________________________________________________________________________ 00783 function ServerChangedWeapon(Weapon OldWeapon, Weapon W) 00784 { 00785 // Log("ServerChangedWeapon w/ OldWeapon="$OldWeapon$" & Weapon="$W@"Owner="$W.Owner); 00786 00787 if ( SelectedItem != None ) 00788 { 00789 SelectedItem.SetDefaultDisplayProperties(); 00790 SelectedItem.DetachFromPawn(self); 00791 } 00792 // Super.ServerChangedWeapon(OldWeapon, W); 00793 if ( OldWeapon != None ) 00794 { 00795 OldWeapon.SetDefaultDisplayProperties(); 00796 OldWeapon.DetachFromPawn(self); 00797 } 00798 if ( Weapon != OldWeapon ) 00799 { // ELR Be sure that if old weapon is != oldweapon we don't keep it attached (may happen after throwing last grenade on-line for ex) 00800 Weapon.SetDefaultDisplayProperties(); 00801 Weapon.DetachFromPawn(self); 00802 } 00803 Weapon = W; 00804 if ( Weapon == None ) 00805 return; 00806 00807 if ( Weapon != None ) 00808 { 00809 //log("ServerChangedWeapon: Attaching Weapon to actor bone."); 00810 Weapon.AttachToPawn(self); 00811 } 00812 00813 Weapon.SetRelativeLocation(Weapon.Default.RelativeLocation); 00814 Weapon.SetRelativeRotation(Weapon.Default.RelativeRotation); 00815 if ( OldWeapon == Weapon ) 00816 { 00817 // if ( Weapon.IsInState('DownWeapon') ) 00818 Weapon.BringUp(); 00819 // Inventory.OwnerEvent('ChangedWeapon'); // tell inventory that weapon changed (in case any effect was being applied) 00820 return; 00821 } 00822 // else if ( Level.Game != None ) 00823 // MakeNoise(0.1 * Level.Game.Difficulty); 00824 // Inventory.OwnerEvent('ChangedWeapon'); // tell inventory that weapon changed (in case any effect was being applied) 00825 00826 // PlayWeaponSwitch(W); // Check utility of this (now in ThirdPersonActor of weapon) 00827 Weapon.BringUp(); 00828 } 00829 00830 //_____________________________________________________________________________ 00831 function ServerChangedItem(PowerUps OldItem, PowerUps I) 00832 { 00833 // Log("ServerChangedItem w/ OldItem="$OldItem$" & Item="$I@"Owner="$I.Owner); 00834 00835 if ( OldItem != None ) 00836 { 00837 OldItem.SetDefaultDisplayProperties(); 00838 OldItem.DetachFromPawn(self); 00839 } 00840 if ( Weapon != none ) 00841 { 00842 Weapon.SetDefaultDisplayProperties(); 00843 Weapon.DetachFromPawn(self); 00844 } 00845 SelectedItem = I; 00846 if ( SelectedItem == None ) 00847 return; 00848 00849 if ( SelectedItem != None ) 00850 { 00851 //log("ServerChangedWeapon: Attaching Weapon to actor bone."); 00852 SelectedItem.AttachToPawn(self); 00853 } 00854 00855 SelectedItem.SetRelativeLocation(SelectedItem.Default.RelativeLocation); 00856 SelectedItem.SetRelativeRotation(SelectedItem.Default.RelativeRotation); 00857 00858 if ( OldItem == SelectedItem ) 00859 { 00860 // Log("Calling BringUp from OldItem == SelectedItem for "$XIIIItems(SelectedItem)); 00861 XIIIItems(SelectedItem).BringUp(); 00862 // Inventory.OwnerEvent('ChangedItem'); // tell inventory that weapon changed (in case any effect was being applied) 00863 return; 00864 } 00865 // else if ( Level.Game != None ) 00866 // MakeNoise(0.1 * Level.Game.Difficulty); 00867 00868 // Inventory.OwnerEvent('ChangedItem'); // tell inventory that weapon changed (in case any effect was being applied) 00869 00870 // PlayWeaponSwitch(W); // ::TODO:: Check utility of this 00871 // Log("Calling BringUp from OldItem != SelectedItem for "$XIIIItems(SelectedItem)); 00872 XIIIItems(SelectedItem).BringUp(); 00873 } 00874 00875 //_____________________________________________________________________________ 00876 // The player/bot wants to select next item 00877 simulated function NextItem() 00878 { 00879 local Inventory Inv; 00880 00881 // Log(">> NextItem Call SelectedItem="$SelectedItem); 00882 00883 if (SelectedItem==None) 00884 { 00885 SelectedItem = Inventory.SelectNext(); 00886 if ( SelectedItem != none ) 00887 { 00888 if ( XIIIPlayerController(controller).bWeaponMode ) 00889 XIIIPlayerController(controller).SwitchWeaponMode(); 00890 SelectedItem.Activate(); 00891 // Log(">> Selected Item="$SelectedItem); 00892 } 00893 Return; 00894 } 00895 00896 if ( XIIIPlayerController(controller).bWeaponMode ) 00897 { 00898 XIIIPlayerController(controller).SwitchWeaponMode(); 00899 if ( SelectedItem != none) 00900 { 00901 SelectedItem.Activate(); 00902 // Log(">> Selected Item="$SelectedItem); 00903 return; // ELR First time we hide weapon and keep old selected item 00904 } 00905 } 00906 00907 if (SelectedItem.Inventory!=None) 00908 SelectedItem = SelectedItem.Inventory.SelectNext(); 00909 else 00910 SelectedItem = Inventory.SelectNext(); 00911 00912 if ( SelectedItem == None ) 00913 SelectedItem = Inventory.SelectNext(); 00914 00915 if ( SelectedItem == None ) 00916 { // switch back to weapons if no items left in inventory 00917 XIIIPlayercontroller(controller).NextWeapon(); 00918 ChangedWeapon(); 00919 return; 00920 } 00921 00922 SelectedItem.Activate(); 00923 // Log(">> Selected Item="$SelectedItem); 00924 } 00925 00926 //_____________________________________________________________________________ 00927 function PowerUps FindPowerUpItemName(string DesiredName) 00928 { 00929 local Inventory Inv; 00930 00931 // Log("FindPowerUpItemName "$DesiredName); 00932 for( Inv=Inventory; Inv!=None; Inv=Inv.Inventory ) 00933 if (PowerUps(Inv) != none) 00934 { 00935 if (caps(Inv.ItemName) == caps(DesiredName)) 00936 return PowerUps(Inv); 00937 if ( (Keys(Inv) != none) && (caps(Keys(Inv).KeyCodeName) == caps(DesiredName)) ) 00938 return PowerUps(Inv); 00939 } 00940 return None; 00941 } 00942 00943 //_____________________________________________________________________________ 00944 function PowerUps FindPowerUpItemNameForTrigger(name DesiredName) 00945 { 00946 local Inventory Inv; 00947 00948 // Log("FindPowerUpItemNameForTrigger "$DesiredName); 00949 for( Inv=Inventory; Inv!=None; Inv=Inv.Inventory ) 00950 { 00951 // Log(" testing item "$Inv); 00952 if (PowerUps(Inv) != none) 00953 { 00954 if ( caps(Inv.ItemName) == caps(DesiredName) ) 00955 return PowerUps(Inv); 00956 if ( (EventItem(Inv) != none) && (caps(EventItem(Inv).Event) == caps(DesiredName)) ) 00957 return PowerUps(Inv); 00958 if ( (Keys(Inv) != none) && (caps(Keys(Inv).KeyCodeName) == caps(DesiredName)) ) 00959 return PowerUps(Inv); 00960 if ( (Keys(Inv) != none) && (caps(Keys(Inv).Event) == caps(DesiredName)) ) 00961 return PowerUps(Inv); 00962 } 00963 } 00964 return None; 00965 } 00966 00967 //_____________________________________________________________________________ 00968 function name GetWeaponBoneFor(Inventory I) 00969 { 00970 return 'X R Hand'; 00971 } 00972 00973 //_____________________________________________________________________________ 00974 function name GetItemBoneFor(Inventory I) 00975 { 00976 return 'X R Hand'; // ELR Used to be left hand but finally as items are handled the same way as weapons... 00977 } 00978 00979 //_____________________________________________________________________________ 00980 event BreathTimer() 00981 { 00982 // log("BreathTimer call DrownTimer="$DrownTimer@"UnderWaterTime="$UnderWaterTime); 00983 if ( bIsDead || (Level.NetMode == NM_Client) ) 00984 return; 00985 00986 if ( !HeadVolume.bWaterVolume ) 00987 { 00988 DrownTimer += 10.0*DTimerStep; 00989 if (DrownTimer >= UnderWaterTime) 00990 { 00991 bDrawBreathtimer = false; 00992 BreathTime = -1.0; 00993 } 00994 else 00995 BreathTime = DTimerStep; 00996 } 00997 else 00998 { 00999 TakeDrowningDamage(); 01000 BreathTime = DTimerStep; 01001 } 01002 01003 // Player SFXs 01004 if ( HeadVolume.bWaterVolume ) 01005 { 01006 if ( UnderWaterSFX == none ) 01007 { 01008 UnderWaterSFX = Spawn(class'UnderWaterBreathEmitter',self); 01009 UnderWaterSFX.SetOwner(self); 01010 } 01011 if ( UnderWaterSFX != none ) 01012 { 01013 UnderWaterSFX.Emitters[0].StartLocationOffset = (EyePosition() - (vect(0,0,8) >> Controller.rotation) + vector(Controller.Rotation) * 20.0) << Rotation; 01014 if ( UnderWaterSFX.TriggerParticle() && IsPlayerPawn() ) 01015 PlaySound(hBubbleSound); 01016 } 01017 } 01018 } 01019 01020 //_____________________________________________________________________________ 01021 // ELR 01022 function TakeDrowningDamage() 01023 { 01024 if ( Level.bLonePlayer && Level.Game.bGameEnded ) 01025 return; 01026 01027 DrownTimer -= DTimerStep; 01028 01029 if ( (fDrownCount <= 0.0) && ((Drowntimer/4.0-2.5) <= -0.5) ) 01030 { 01031 fDrownCount = fMax(0.25, -1.0 / (Drowntimer/4.0-2.5)); 01032 } 01033 else if ( (Drowntimer/4.0-2.5) > -0.5 ) 01034 fDrownCount = 0.0; 01035 01036 if ( fDrownCount > 0.0 ) 01037 { 01038 fDrownCount -= DTimerStep; 01039 if ( (fDrownCount <= 0.0) && IsLocallyControlled() ) 01040 { 01041 PlayerController(Controller).ClientFilter( 01042 class'Canvas'.Static.MakeColor(128,0,0,255), 01043 class'Canvas'.Static.MakeColor(128,128,128,255), 01044 1.0/DTimerStep 01045 ); 01046 XIIIPlayerController(Controller).ClientTargetHighLight( 0, 0, DTimerStep); 01047 } 01048 if ( UnderWaterSFX != none ) 01049 { 01050 UnderWaterSFX.Emitters[0].StartLocationOffset = (EyePosition() - (vect(0,0,8) >> Controller.rotation) + vector(Controller.Rotation) * 20.0) << Rotation; 01051 if ( UnderWaterSFX.TriggerParticle() && IsPlayerPawn() ) 01052 PlaySound(hBubbleSound); 01053 } 01054 } 01055 01056 if (DrownTimer <= -6.0) 01057 { 01058 TakeDamage(25000, self, Location, vect(0,0,0), class'DTDrowned'); // Die Scum !! 01059 if ( DrowningSFX == none ) 01060 DrowningSFX = Spawn(class'DrowningEmitter',self,, Location); 01061 } 01062 } 01063 01064 //_____________________________________________________________________________ 01065 function Gasp() 01066 { 01067 } 01068 01069 //_____________________________________________________________________________ 01070 function SetBreatheOn() 01071 { 01072 // log("SetBreatheOn call"); 01073 if ( FindInventoryKind('BreathSkill') != None ) 01074 { 01075 UnderWaterTime = default.UnderWaterTime * 2; 01076 DrownTimer = min(DrownTimer, UnderWaterTime); 01077 BreathTime = DTimerStep; 01078 } 01079 else 01080 UnderWaterTime = default.UnderWaterTime; 01081 } 01082 01083 //_____________________________________________________________________________ 01084 // ELR 01085 event HeadVolumeChange(PhysicsVolume newHeadVolume) 01086 { 01087 if ( (Level.NetMode == NM_Client) || (Controller == None) ) 01088 return; 01089 01090 SetBreatheOn(); // Security/Anti-bug purpose // ::TODO:: Check if may be removed 01091 01092 //Log("@@@ "$self$" have HeadVolume"$HeadVolume@"newHeadVolume="$newHeadVolume@"Location="$Location); 01093 if ( HeadVolume.bWaterVolume ) 01094 { 01095 if (!newHeadVolume.bWaterVolume) 01096 { 01097 if ( IsPlayerPawn() && (BreathTime > 0) && (BreathTime < 8) ) 01098 Gasp(); 01099 BreathTime = DTimerStep; 01100 DrownTimer += 2.0*DTimerStep; 01101 if ( IsPlayerPawn() ) 01102 PlaySound(hSwimmingSound, 0); 01103 //Log("@@@ hSwimmingSound param 0"); 01104 } 01105 } 01106 else 01107 { 01108 if ( newHeadVolume.bWaterVolume ) 01109 { 01110 BreathTime = 0.5; 01111 bDrawBreathtimer = true; 01112 DrownTimer = min(UnderWaterTime, Drowntimer); 01113 if ( IsPlayerPawn() ) 01114 PlaySound(hSwimmingSound, 1); 01115 //Log("@@@ hSwimmingSound param 1"); 01116 } 01117 } 01118 } 01119 01120 //_____________________________________________________________________________ 01121 function bool CanSplash() 01122 { 01123 if ( Level.TimeSeconds - SplashTime > 1.0) 01124 { 01125 SplashTime = Level.TimeSeconds; 01126 return true; 01127 } 01128 return false; 01129 } 01130 01131 //_____________________________________________________________________________ 01132 // ELR Executed in Landed() 01133 function TakeFallingDamage() 01134 { 01135 if ( Level.bLonePlayer && Level.Game.bGameEnded ) 01136 return; 01137 // ::DBUG:: 01138 // Log(self$" TakeFallingDamage() Velocity.z="$Velocity.z$" JumpZ="$JumpZ@"damage="$-0.3 * (Velocity.Z + 400 + JumpZ)); 01139 01140 // 1rst Banque level = Velocity.z = -1400 = Not Dead. 01141 // 2nd Banque level = Velocity.z = -1705 = Death. 01142 // Jump off a tble = Velocity.z = -573 = nothing. 01143 01144 // if ( Base != none ) 01145 // Velocity += Base.Velocity; 01146 if (Velocity.Z < -1.4 * JumpZ) // 420 * 1.4 = 588 01147 { 01148 if (Velocity.Z <= - 400 - JumpZ) // Velocity.z < -820 01149 { 01150 if ( (Velocity.Z < -1200 - JumpZ) && !Controller.bGodMode ) 01151 TakeDamage(1000, self, Location, vect(0,0,0), class'Fell'); 01152 else if ( Role == ROLE_Authority ) 01153 { 01154 TakeDamage(-0.3 * (Velocity.Z + 400 + JumpZ), self, Location + vect(-20,0,-20), vect(0,0,0), class'DTFell'); 01155 } 01156 } 01157 } 01158 } 01159 01160 //_____________________________________________________________________________ 01161 event Landed(vector HitNormal) 01162 { 01163 local float fNoise; 01164 01165 if ( (bIsDead || IsDead()) && !bIsInCine ) 01166 { 01167 // Log("LANDED Global"); 01168 LandedSpecial(); 01169 return; 01170 } 01171 TakeFallingDamage(); 01172 if ( Health > 0 ) 01173 PlayLanded(Velocity.Z); 01174 fNoise = fmin(1.0, -0.3*Velocity.Z/JumpZ); 01175 if ( bIsCrouched || (XIIIPlayerController(Controller) != none) && XIIIPlayerController(Controller).bHooked ) 01176 fNoise /= 3.0; 01177 //Log("LANDED MakeNoise of "$fNoise@"for velocity="$Velocity.z@"& JumpZ="$JumpZ); 01178 MakeNoise(fNoise); 01179 bJustLanded = true; 01180 if ( bIsCrouched ) 01181 Visibility = CrouchedVisibility; 01182 else 01183 Visibility = default.Visibility; 01184 if ( LastLandSoundTime < Level.TimeSeconds - 0.333 ) 01185 { 01186 LastLandSoundTime = Level.TimeSeconds; 01187 PlayLandSound(); 01188 } 01189 // XIIIPlayerController(Controller).vWeaponFeedBack = vect(0,0.01,0)*Velocity.z; 01190 // bJumpFeedBack = true; 01191 } 01192 01193 //_____________________________________________________________________________ 01194 // Land sounds are footStepSounds w/ negative velocity to warn the Harmonix Script that it is a land 01195 simulated function PlayLandSound() 01196 { 01197 local material M; 01198 local actor A; 01199 local vector HitLoc, HitNorm; 01200 local bool bSilent; 01201 01202 bSilent = (FindInventoryKind('SilentWalkSkill')!=none); 01203 01204 if ( LastCollidedMaterial == none ) 01205 A = Trace(HitLoc, HitNorm, Location - (CollisionHeight + CollisionRadius) * vect(0,0,1), location, true, vect(0,0,0), M); 01206 else 01207 M = LastCollidedMaterial; 01208 // log(self@"PlayFootStep && make noise using M="$M@"play sound"@M.XIIIFootstepSound@"& Make noise"@M.NoiseLoudness); 01209 Instigator = self; 01210 if (M != none) 01211 { 01212 if ( Level.bReplaceHXScripts ) 01213 { 01214 if ( IsPlayerPawn() ) 01215 PlaySndXIIIStep(M.XIIISndStep, -(vsize(velocity)), SoundStepCategory, bSilent ); 01216 else 01217 PlaySndPNJStep(M.PNJSndStep, -(vsize(velocity)), SoundStepCategory, bSilent ); 01218 } 01219 else 01220 { 01221 if ( IsPlayerPawn() ) 01222 PlaySound(M.XIIIFootstepSound, -int(vsize(velocity)), SoundStepCategory, int(bSilent) ); 01223 else 01224 PlaySound(M.FootstepSound, -int(vsize(velocity)), SoundStepCategory, int(bSilent) ); 01225 } 01226 } 01227 } 01228 01229 //_____________________________________________________________________________ 01230 // ELR Player is hooking 01231 function GoHooking(Hook H) 01232 { 01233 XIIIPlayerController(Controller).GoHooking(H); 01234 } 01235 01236 //_____________________________________________________________________________ 01237 // ELR Used for being grabbed by someone (Here we are alive (taken as prisonner) 01238 // Redefined in Dying state for grabbing corpses. 01239 function bool BeingGrabbed() 01240 { 01241 Controller.gotostate('otage'); 01242 bInvulnerableBody = false; 01243 GotoState('Prisonner'); 01244 Velocity = Vect(0,0,0); 01245 Acceleration = Vect(0,0,0); 01246 TriggerEvent(EventOnGrab, self, Instigator); 01247 return true; 01248 } 01249 01250 //_____________________________________________________________________________ 01251 function bool UnGrabbed(vector Loc, vector Dir) 01252 { 01253 // Controller.settimer(0.5,false); 01254 return false; 01255 } 01256 01257 //_____________________________________________________________________________ 01258 // Base change - if new base is pawn or decoration, damage based on relative mass and old velocity 01259 // ELR Modified to stun paws we fall on. 01260 singular event BaseChange() 01261 { 01262 local float decorMass; 01263 01264 if ( bInterpolating ) 01265 return; 01266 if ( Level.bLonePlayer && Level.Game.bGameEnded ) 01267 return; 01268 01269 if ( XIIIPawn(Base) != None ) 01270 { 01271 if ( XIIIPawn(Base).bStunnedIfJumpedOn && (vSize(Base.Location - Location) > 0.95*(Base.CollisionHeight+CollisionHeight)) ) 01272 { 01273 //Log("Stun from above, speed ="$Velocity.z); 01274 if ( !XIIIPawn(Base).bIsDead && (Velocity.Z < -180.0) ) 01275 { 01276 playsound(hStunFromAboveSound); 01277 MakeNoise(0.157); 01278 Spawn(class'StunningJumpEmitter',self,,Location - vect(0,0,0.7)*CollisionHeight + vector(rotation)*CollisionRadius, rotation); 01279 } 01280 Base.TakeDamage( (1-Velocity.Z/400)* Mass/Base.Mass, Self,Location,0.5 * Velocity , class'DTSureStunned'); 01281 } 01282 JumpOffPawn(); 01283 } 01284 else if ( (Decoration(Base) != None) && (Velocity.Z < -400) ) 01285 { 01286 decorMass = FMax(Decoration(Base).Mass, 1); 01287 Base.TakeDamage((-2* Mass/decorMass * Velocity.Z/400), Self, Location, 0.5 * Velocity, class'Crushed'); 01288 } 01289 } 01290 01291 //_____________________________________________________________________________ 01292 // Also, non-players will jump off pawns immediately 01293 // ELR Decrease Z speed. 01294 function JumpOffPawn() 01295 { 01296 Velocity += (100 + default.CollisionRadius) * VRand(); 01297 // Velocity.Z = 200 + CollisionHeight; 01298 Velocity.Z = 1 + default.CollisionHeight; 01299 SetPhysics(PHYS_Falling); 01300 // bNoJumpAdjust = true; 01301 Controller.SetFall(); 01302 MakeNoise(0.15); 01303 } 01304 01305 //_____________________________________________________________________________ 01306 function CreateInventory(class<Inventory> InventoryClass) 01307 { 01308 local Inventory Inv; 01309 01310 // InventoryClass = Level.Game.BaseMutator.GetInventoryClass(InventoryClassName); 01311 if (InventoryClass!=None) //&& (FindInventoryType(InventoryClass)==None) ) 01312 { 01313 Inv = spawn(InventoryClass); 01314 if( Inv != None ) 01315 { 01316 Inv.GiveTo(self); 01317 Inv.PickupFunction(self); 01318 } 01319 } 01320 } 01321 01322 /* 01323 //_____________________________________________________________________________ 01324 // Used for Menu (unable to access AllActors in Object SubClass, must be Actor SubClass). 01325 function FindXIIIDoc(out array<string> doctext, out array<string> docinfo) 01326 { 01327 local XIIIDocuments d; 01328 local int i; 01329 01330 i=0; 01331 foreach AllActors(class'XIIIDocuments', d) 01332 { 01333 if (d.PersoNum == 13) 01334 { 01335 Doctext[i] = d.ItemName; 01336 Docinfo[i] = d.Information; 01337 i++; 01338 } 01339 } 01340 } 01341 01342 //_____________________________________________________________________________ 01343 // Used for Menu (unable to access AllActors in Object SubClass, must be Actor SubClass). 01344 function XIIIDocuments FindXXDoc(int NumPerso) 01345 { 01346 local XIIIDocuments d; 01347 01348 foreach AllActors(class'XIIIDocuments', d) 01349 { 01350 if (d.PersoNum == NumPerso) 01351 return d; 01352 } 01353 return none; 01354 } 01355 */ 01356 01357 //_____________________________________________________________________________ 01358 function bool CanGrabCorpse(optional XIIIPawn P) 01359 { 01360 // Log("CanGrabCorpse "$P@"Physics="$P.Physics); 01361 01362 if ( !Level.bLonePlayer || bHaveOnlyOneHandFree || (Physics == PHYS_Ladder) || bIsCrouched ) 01363 return false; 01364 01365 if ( (P != none) && (!P.bCanBeGrabbed || (P.Physics != PHYS_none)) ) 01366 return false; 01367 01368 if ( XIIIPlayerController(Controller).bHooked ) 01369 return false; 01370 01371 if ( XIIIPlayerController(Controller).bWeaponMode != XIIIPlayerController(Controller).bWaitForWeaponMode ) 01372 return false; // switching Weapons <-> Items, not allow pick (prevent potential bug) 01373 01374 if ( !XIIIPlayerController(Controller).bWeaponMode ) 01375 { 01376 if ( (XIIIItems(SelectedItem).IHand!=IH_2H) && ((XIIIItems(PendingItem)==none) || (XIIIItems(PendingItem).IHand!=IH_2H) ) ) 01377 return true; 01378 } 01379 01380 if ( XIIIPlayerController(Controller).bWeaponMode ) 01381 { 01382 if ( Weapon.IsInState('Reloading') ) 01383 return false; 01384 if ( (XIIIWeapon(Weapon).WHand != WHA_2HShot) && (XIIIWeapon(Weapon).WHand != WHA_Deco) && ((PendingWeapon == none) || ((XIIIWeapon(PendingWeapon).WHand != WHA_2HShot) && (XIIIWeapon(PendingWeapon).WHand != WHA_Deco))) ) 01385 return true; 01386 } 01387 return false; 01388 } 01389 01390 //_____________________________________________________________________________ 01391 function bool CanTakePrisonner(optional XIIIPawn P) 01392 { 01393 if ( !Level.bLonePlayer || bHaveOnlyOneHandFree || (Physics == PHYS_Ladder) || bIsCrouched ) 01394 return false; 01395 01396 if ( XIIIPlayerController(Controller).bHooked ) 01397 return false; 01398 01399 if ( XIIIPlayerController(Controller).bWeaponMode != XIIIPlayerController(Controller).bWaitForWeaponMode ) 01400 return false ; // switching Weapons <-> Items, not allow pick (prevent potential bug) 01401 01402 if ( XIIIPlayerController(Controller).bWeaponMode ) 01403 { 01404 if ( Weapon == none ) 01405 return false; 01406 if ( Weapon.IsInState('Reloading') ) 01407 return false; 01408 if ( (XIIIWeapon(Weapon).WHand == WHA_2HShot) || (XIIIWeapon(Weapon).WHand == WHA_Deco) ) 01409 return false; 01410 if ( (PendingWeapon != none) && ((XIIIWeapon(PendingWeapon).WHand == WHA_2HShot) || (XIIIWeapon(PendingWeapon).WHand == WHA_Deco)) ) 01411 return false; 01412 } 01413 if ( !XIIIPlayerController(Controller).bWeaponMode ) 01414 { 01415 if ( SelectedItem == none ) 01416 return false; 01417 if ( (PendingItem != none) && XIIIItems(PendingItem).IHand != IH_1H ) 01418 return false; 01419 if ( !XIIIPlayerController(Controller).bWeaponMode && (XIIIItems(SelectedItem).IHand != IH_1H) ) 01420 return false; 01421 } 01422 01423 if ( (P != none) && !P.bCanBeGrabbed ) 01424 return false; 01425 if ( P.bTearOff ) 01426 return false; 01427 01428 if ( vector(Rotation) dot vector(P.Rotation) > 0 ) 01429 return true; 01430 else 01431 return false; 01432 } 01433 01434 //_____________________________________________________________________________ 01435 function bool CanStun(optional XIIIPawn P) 01436 { 01437 return false; 01438 } 01439 01440 //_____________________________________________________________________________ 01441 //Player Jumped 01442 // ELR Added bAllowJump (Pawn Grabbed) 01443 function DoJump( bool bUpdating ) 01444 { 01445 if ( !bIsCrouched && !bWantsToCrouch && ((Physics == PHYS_Walking) || (Physics == PHYS_Ladder) || (Physics == PHYS_Spider)) ) 01446 { 01447 /* // ELR No use in XIII 01448 if ( Role == ROLE_Authority ) 01449 { 01450 if ( (Level.Game != None) && (Level.Game.Difficulty > 0) ) 01451 MakeNoise(0.1 * Level.Game.Difficulty); 01452 if ( bCountJumps && (Inventory != None) ) 01453 Inventory.OwnerEvent('Jumped'); 01454 } */ 01455 if ( Physics == PHYS_Spider ) 01456 Velocity = JumpZ * Floor; 01457 else if ( bAllowJump ) 01458 { 01459 Velocity.Z = JumpZ; 01460 bJumpImpulse = true; 01461 // PlayJumpImpulse(); 01462 } 01463 else 01464 Velocity.Z = JumpZ/100.0; // ELR Only small jump to have visual (else maybe thought of a bug or pb with jump button) 01465 if ( (Base != None) && !Base.bWorldGeometry ) 01466 { // Try to stay on Base for platforms moving horizontaly 01467 Velocity.X += Base.Velocity.X; 01468 Velocity.Y += Base.Velocity.Y; 01469 } 01470 // Velocity.Z += (Base.Velocity.Z * 0.5); 01471 SetPhysics(PHYS_Falling); 01472 PlaySound(hJumpSound); 01473 } 01474 Visibility = default.Visibility; 01475 } 01476 01477 //_____________________________________________________________________________ 01478 function SpawnCadavre() 01479 { 01480 Controller.Destroy(); 01481 } 01482 01483 //_____________________________________________________________________________ 01484 function AddVelocity( vector NewVelocity) 01485 { 01486 // Log("AddVelocity of "$NewVelocity$" for "$self$" in state "$GetStateName()); 01487 01488 // if ( bIgnoreForces ) 01489 // return; 01490 if ( (Physics == PHYS_Walking) 01491 || (((Physics == PHYS_Ladder) || (Physics == PHYS_Spider)) && (NewVelocity.Z > Default.JumpZ)) ) 01492 SetPhysics(PHYS_Falling); 01493 if ( (Velocity.Z > 380) && (NewVelocity.Z > 0) ) 01494 NewVelocity.Z *= 0.5; 01495 Velocity += NewVelocity; 01496 // Log("AddVelocity of "$NewVelocity$" for "$self$" in state "$GetStateName()$" now Velocity="$Velocity); 01497 } 01498 01499 //_____________________________________________________________________________ 01500 simulated function ReduceMyCylinder() 01501 { 01502 local float OldHeight, OldRadius; 01503 local vector OldLocation; 01504 01505 // Log(self@"ReduceMyCylinder"); 01506 SetCollision(false,False,False); 01507 OldHeight = CollisionHeight; 01508 OldRadius = CollisionRadius; 01509 // ELR Only modification, increase collisionradius of carcasses from 1.5 to 1.7x 01510 // SetCollisionSize(1.7 * Default.CollisionRadius, CarcassCollisionHeight); 01511 SetCollisionSize(1, CarcassCollisionHeight); 01512 // PrePivot = vect(0,0,1) * ((OldHeight - CollisionHeight) - vSize(Floor cross vect(0,0,1))*1.7 * Default.CollisionRadius); // FIXME - changing prepivot isn't safe w/ static meshes 01513 PrePivot = vect(0,0,1) * (OldHeight - CollisionHeight); 01514 OldLocation = Location; 01515 if ( !SetLocation(OldLocation - PrePivot) ) 01516 { 01517 Log("### BIG BUG Can't setup a corpse ("$self$") place..."); 01518 } 01519 PrePivot = PrePivot + vect(0,0,5); 01520 SetCollisionSize(1.7 * Default.CollisionRadius, CarcassCollisionHeight); 01521 SetCollision(True,False,False); 01522 // Log(self@" ReduceMyCylinder, H="$CollisionHeight@"R="$CollisionRadius); 01523 } 01524 01525 //_____________________________________________________________________________ 01526 // Landed modded to have body in the right place. 01527 simulated function LandedSpecial(optional bool bForceStop) 01528 { 01529 local rotator finalRot; 01530 local vector X,Y,Z; 01531 local vector HitLoc, HitNorm; 01532 local Actor A; 01533 01534 if ( !bForceStop ) 01535 { 01536 A = Trace(HitLoc, HitNorm, Location - vect(0,0,1)*(8+default.CollisionHeight+default.CollisionRadius), Location + vect(0,0,1)*(8+default.CollisionHeight+default.CollisionRadius), true, vect(1,1,0)+vect(0,0,1)*Default.CollisionHeight); 01537 // if ( FastTrace(Location - vect(0,0,1.5)*default.CollisionHeight, Location) ) 01538 if ( A == none ) 01539 { // there is no obstacle below body, try falling to avoid body hanging by nothing 01540 // Log(self@"LandedSpecial Trying to make the body fall further"); 01541 SetCollisionSize(1.0, Default.CollisionHeight); 01542 PrePivot = vect(0,0,0); 01543 SetPhysics(PHYS_Spider); // Trick to keep the PHYS_Falling in the c++Code. 01544 return; 01545 } 01546 else if ( XIIIPawn(A) != none ) 01547 { // kinda jump off pawn 01548 Velocity += (100 + default.CollisionRadius) * VRand(); 01549 Velocity.Z = 1 + default.CollisionHeight; 01550 SetPhysics(PHYS_Spider); 01551 if ( Controller != none ) 01552 Controller.SetFall(); 01553 // MakeNoise(0.15); 01554 return; 01555 } 01556 } 01557 // Log(self@"LandedSpecial should have hit floor"@A); 01558 // SetCollisionSize(Default.CollisionRadius, default.CollisionHeight); 01559 MakeNoise(0.208); // should be around 4m for default hearing threshold of 1500 01560 ReduceMyCylinder(); 01561 SetPhysics(PHYS_None); // Set physics BEFORE Else floor will be wrong 01562 A = Trace(HitLoc, HitNorm, Location - vect(0,0,1)*(8+CollisionRadius+CollisionHeight), Location, false, vect(0,0,0)); 01563 if ( A != none ) 01564 { 01565 GetAxes(Rotation, X,Y,Z); 01566 Z = HitNorm; 01567 Y = Z cross X; 01568 X = Y cross Z; 01569 FinalRot = OrthoRotation(X,Y,Z); 01570 setRotation(finalRot); 01571 PrePivot = (vect(0,0,1) * default.CollisionHeight) >> Rotation; 01572 // Log("Location="$Location@"HitLoc="$HitLoc); 01573 PrePivot -= vect(0,0,1)*(Location.z - HitLoc.z - 5); 01574 } 01575 } 01576 01577 //_____________________________________________________________________________ 01578 state Dying 01579 { 01580 function PlayTakeHit(vector HitLoc, int Damage, class<DamageType> damageType) {} 01581 event AnimEnd(int Channel) {} 01582 function PlayWaiting() {} 01583 function PlayOpenDoor() {} 01584 function PlaySearchCorpse() {} 01585 event PlayJump() {} 01586 event PlayLandingAnimation(float ImpactVel) {} 01587 function PlaySwitchingWeapon(float Rate, name FiringMode) {} 01588 function PlayReLoading(float Rate, name FiringMode) {} 01589 function PlayFiring(float Rate, name FiringMode) {} 01590 event SetAnimAction(name NewAnimAction) {} 01591 01592 event Touch( Actor Other ) 01593 { 01594 // Log("TOUCH Dying "$Other@"Base="$Base); 01595 if ( Other == Base ) // dropped in a lift 01596 { 01597 LandedSpecial(true); 01598 Velocity = vect(0,0,0); 01599 // SetPhysics(PHYS_None); // Set physics BEFORE Else floor will be wrong 01600 SetBase(Other); 01601 } 01602 } 01603 01604 event Timer2() 01605 { // Setup by Player when Searchcorpse on self 01606 if ( (Shadow != none) && !IsAnimating() ) 01607 { 01608 if ( LastRenderTime < Level.TimeSeconds - 0.3 ) 01609 { 01610 // Log("Keep shadow dynamic"); 01611 SetTimer2(1.0, false); 01612 } 01613 else 01614 { 01615 // Log("Setting shadow Static"); 01616 Shadow.bShadowIsStatic = true; 01617 } 01618 } 01619 } 01620 function Timer() 01621 { // ELR Disappear in multi, not in solo 01622 // log(self@"Dying Timer"); 01623 if ( !bSearchable ) 01624 { 01625 bSearchable = true; 01626 SetTimer(4.0, false); 01627 return; 01628 } 01629 if ( (MyBloodPool == none) && class<XIIIDamageType>(HitDamageType).default.bSpawnBloodFX ) 01630 { 01631 if ( (Level.Game != none) && (Level.Game.GoreLevel == 0) ) 01632 MyBloodPool = spawn(class'Bloodflow', self,, Location - (CollisionHeight-8) * vect(0,0,1), rotator(vect(0,0,-1))); 01633 } 01634 01635 if ( Level.bLonePlayer ) 01636 { 01637 if ( bDestroyWhenDead ) 01638 { 01639 if ( 01640 ((Level.TimeSeconds - LastRenderTime) > DelayBeforeDestroyWhenDead) 01641 && (vSize(PawnKiller.Location - Location) > DistanceBeforeDestroyWhenDead) 01642 ) 01643 { 01644 if ( MyBloodPool != none ) MyBloodPool.destroy(); 01645 if (Shadow != none) 01646 { 01647 Shadow.Destroy(); 01648 Shadow = none; 01649 } 01650 Destroy(); 01651 } 01652 else 01653 SetTimer(1.0, false); 01654 } 01655 else 01656 { 01657 if ( (Shadow != none) && !IsAnimating() ) 01658 { 01659 if ( LastRenderTime < Level.TimeSeconds - 0.3 ) 01660 { 01661 RecomputeBoundingVolume(false); 01662 SetTimer2(1.0, false); 01663 } 01664 else 01665 { 01666 RecomputeBoundingVolume(true); 01667 Shadow.bShadowIsStatic = true; 01668 } 01669 } 01670 else 01671 SetTimer2(1.0, false); 01672 } 01673 return; 01674 } 01675 01676 /* if ( !PlayerCanSeeMe() ) 01677 { 01678 if ( MyBloodPool != none ) MyBloodPool.destroy(); 01679 Destroy(); 01680 } 01681 else 01682 SetTimer(1.0,false); 01683 */ 01684 } 01685 01686 function bool BeingGrabbed() 01687 { 01688 // Landed(vect(0,0,1)); 01689 LieStill(); 01690 GotoState('Grabbed'); 01691 if ( MyBloodPool != none ) 01692 MyBloodPool.GotoState(''); 01693 return True; 01694 } 01695 01696 function BeginState() 01697 { 01698 // Log("Dying BeginState, should be setting timer to 2.0"); 01699 Buoyancy = 20.0; 01700 01701 enable('tick'); 01702 bForceInUniverse = false; 01703 RefreshDisplaying(); 01704 01705 if ( bTearOff && (Level.NetMode == NM_DedicatedServer) ) 01706 LifeSpan = 1.0; 01707 SetTimer(2.0, false); 01708 01709 SetPhysics(PHYS_Falling); 01710 bInvulnerableBody = true; 01711 01712 if ( Controller != None ) 01713 { 01714 if( Controller.bIsPlayer ) 01715 Controller.PawnDied(); 01716 else 01717 SpawnCadavre(); 01718 if (controller != none) 01719 Controller.bControlAnimations = true; 01720 } 01721 } 01722 01723 function Landed(vector HitNormal) 01724 { 01725 // local float OldHeight; 01726 01727 // Log("LANDED Dying State"); 01728 // Log(self@"Landed in DyingState"); 01729 LandedSpecial(); 01730 /* 01731 if ( FastTrace(Location - vect(0,0,1.2)*default.CollisionHeight, Location) ) 01732 { // there is no obstacle below body, try falling to avoid body hanging by nothing 01733 // Log(self@"Trying to make the body fall further (Landed)"); 01734 SetCollisionSize(10.0, Default.CollisionHeight); 01735 SetPhysics(PHYS_Spider); // Trick to keep the PHYS_Falling in the c++Code. 01736 return; 01737 } 01738 else 01739 { 01740 // Log(self@"should have hit floor (Landed)"); 01741 SetCollisionSize(Default.CollisionRadius, Default.CollisionHeight); 01742 ReduceCylinder(); 01743 } 01744 01745 SetPhysics(PHYS_None); // Set physics BEFORE Else floor will be wrong 01746 GetAxes(Rotation, X,Y,Z); 01747 // Log(self@"GetAxes result : X="$X@"Y="$Y@"Z="$Z); 01748 Z = Floor; 01749 Y = Z cross X; 01750 X = Y cross Z; 01751 // Log(self@"New ortho : X="$X@"Y="$Y@"W="$W); 01752 FinalRot = OrthoRotation(X,Y,Z); 01753 setRotation(finalRot); 01754 */ 01755 // PlaySound(hBodyFallSound); 01756 /* 01757 finalRot = Rotation; 01758 finalRot.Roll = 0; 01759 finalRot.Pitch = 0; 01760 setRotation(finalRot); 01761 */ 01762 } 01763 01764 function LieStill() 01765 { 01766 if ( !bThumped ) 01767 LandThump(); 01768 // if ( CollisionHeight != CarcassCollisionHeight ) 01769 // ReduceCylinder(); // ELR Now made in Landed 01770 } 01771 01772 function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, class<DamageType> damageType) 01773 { 01774 LOCAL bool bKilled; 01775 01776 if ( Level.bLonePlayer && !Level.Game.bGameEnded ) 01777 { 01778 if ( DamageType.default.bCanKillStunnedCorspes ) 01779 { 01780 bKilled = (Health<=0) && ((DamageType != class'DTFisted') && (DamageType != class'DTCouDCross') && (DamageType != class'DTStunned') && (DamageType != class'DTSureStunned') && (DamageType != class'DTDropAfterStun')); 01781 if ( ( instigatedBy.IsPlayerPawn() && ( (GameOver==GO_TakeDamageFromPlayer) || ( GameOver==GO_KillByPlayer && bKilled ) ) ) || ( GameOver==GO_AnyDeath && bKilled ) ) 01782 { 01783 Log("DEAD Taking deadly damages w/ GameOver type != GO_Never"); 01784 if ( GameOverGoal>=0) 01785 { 01786 if (GameOverGoal>=90) 01787 { 01788 XIIIGameInfo(Level.Game).MapInfo.SetGoalComplete(GameOverGoal); 01789 } 01790 else 01791 if ( XIIIGameInfo(Level.Game).MapInfo.Objectif[GameOverGoal].bPrimary ) 01792 { 01793 XIIIGameInfo(Level.Game).MapInfo.SetGoalComplete(GameOverGoal); 01794 } 01795 } 01796 else 01797 Level.Game.EndGame( PlayerReplicationInfo, "GoalIncomplete" ); 01798 } 01799 } 01800 } 01801 /* 01802 if ( bInvulnerableBody ) 01803 return; 01804 if (Damage > 300) 01805 ChunkUp(Damage); 01806 */ 01807 } 01808 01809 01810 Begin: 01811 Sleep(0.5); 01812 bInvulnerableBody=false; 01813 // ELR Added LieStill there 0.5 seconds after state beginning because we don't want the col cyl staying big a long time 01814 LieStill(); 01815 } 01816 01817 //_____________________________________________________________________________ 01818 // Dropped to ground after holding corpse/Prisonner 01819 state BodyDropped 01820 { 01821 function PlayTakeHit(vector HitLoc, int Damage, class<DamageType> damageType) {} 01822 event AnimEnd(int Channel) {} 01823 function PlayWaiting() {} 01824 function PlayOpenDoor() {} 01825 function PlaySearchCorpse() {} 01826 event PlayJump() {} 01827 event PlayLandingAnimation(float ImpactVel) {} 01828 function PlaySwitchingWeapon(float Rate, name FiringMode) {} 01829 function PlayReLoading(float Rate, name FiringMode) {} 01830 function PlayFiring(float Rate, name FiringMode) {} 01831 event SetAnimAction(name NewAnimAction) {} 01832 // function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, class<DamageType> damageType) {} 01833 event PhysicsVolumeChange( PhysicsVolume NewVolume ) 01834 { 01835 // Log(self@"PhysicsVolumeChange"); 01836 Buoyancy = 20.0; 01837 SetPhysics(PHYS_Falling); 01838 } 01839 event Touch( Actor Other ) 01840 { 01841 // Log("TOUCH BodyDropped "$Other@"Base="$Base); 01842 if ( Other == Base ) // dropped in a lift 01843 { 01844 LandedSpecial(true); 01845 Velocity = vect(0,0,0); 01846 // SetPhysics(PHYS_None); // Set physics BEFORE Else floor will be wrong 01847 SetBase(Other); 01848 } 01849 } 01850 01851 event Timer2() 01852 { // Setup by Player when Searchcorpse on self 01853 if ( (Shadow != none) && !IsAnimating() ) 01854 { 01855 if ( LastRenderTime < Level.TimeSeconds - 0.3 ) 01856 { 01857 // Log("Keep shadow dynamic"); 01858 SetTimer2(1.0, false); 01859 } 01860 else 01861 { 01862 // Log("Setting shadow Static"); 01863 Shadow.bShadowIsStatic = true; 01864 } 01865 } 01866 } 01867 01868 event BeginState() 01869 { 01870 // Log(self@"LyingStill BeginState"); 01871 Buoyancy = 20.0; 01872 SetPhysics(PHYS_Falling); 01873 } 01874 event Landed(vector HitNormal) 01875 { 01876 // local rotator finalRot; 01877 // local float OldHeight; 01878 // local vector X,Y,Z; 01879 01880 // Log("LANDED BodyDropped State"); 01881 // ReduceCylinder(); 01882 LandedSpecial(); 01883 /* 01884 if ( FastTrace(Location - vect(0,0,1.2)*default.CollisionHeight, Location) ) 01885 { // there is no obstacle below body, try falling to avoid body hanging by nothing 01886 // Log(self@"Trying to make the body fall further (LyingStillLanded)"); 01887 SetCollisionSize(1.0, CarcassCollisionHeight); 01888 SetPhysics(PHYS_Spider); // Trick to keep the PHYS_Falling in the c++Code. 01889 return; 01890 } 01891 else 01892 { 01893 // Log(self@"should have hit floor (LyingStillLanded)"); 01894 SetCollisionSize(1.7 * Default.CollisionRadius, CarcassCollisionHeight); 01895 } 01896 01897 SetPhysics(PHYS_None); // Set physics BEFORE Else floor will be wrong 01898 GetAxes(Rotation, X,Y,Z); 01899 Z = Floor; 01900 Y = Z cross X; 01901 X = Y cross Z; 01902 FinalRot = OrthoRotation(X,Y,Z); 01903 setRotation(finalRot); 01904 */ 01905 // PlaySound(hBodyFallSound); 01906 Shadow.bShadowIsStatic = false; 01907 SetTimer2(1.0, false); 01908 } 01909 function bool BeingGrabbed() 01910 { 01911 GotoState('Grabbed'); 01912 return True; 01913 } 01914 function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, class<DamageType> damageType) 01915 { 01916 LOCAL bool bKilled; 01917 01918 if ( Level.bLonePlayer && !Level.Game.bGameEnded ) 01919 { 01920 if ( DamageType.default.bCanKillStunnedCorspes ) 01921 { 01922 bKilled = (Health<=0) && ((DamageType != class'DTFisted') && (DamageType != class'DTCouDCross') && (DamageType != class'DTStunned') && (DamageType != class'DTSureStunned') && (DamageType != class'DTDropAfterStun')); 01923 if ( PawnName~="galbrain" ) 01924 log ("-=>"@PawnName@bKilled); 01925 if ( ( instigatedBy.IsPlayerPawn() && ( (GameOver==GO_TakeDamageFromPlayer) || ( GameOver==GO_KillByPlayer && bKilled ) ) ) || ( GameOver==GO_AnyDeath && bKilled ) ) 01926 { 01927 Log("DEAD Taking deadly damages w/ GameOver type != GO_Never"); 01928 if ( GameOverGoal>=0) 01929 { 01930 if (GameOverGoal>=90) 01931 { 01932 XIIIGameInfo(Level.Game).MapInfo.SetGoalComplete(GameOverGoal); 01933 } 01934 else 01935 if ( XIIIGameInfo(Level.Game).MapInfo.Objectif[GameOverGoal].bPrimary ) 01936 { 01937 XIIIGameInfo(Level.Game).MapInfo.SetGoalComplete(GameOverGoal); 01938 } 01939 } 01940 else 01941 Level.Game.EndGame( PlayerReplicationInfo, "GoalIncomplete" ); 01942 } 01943 } 01944 } 01945 /* 01946 if ( bInvulnerableBody ) 01947 return; 01948 if (Damage > 300) 01949 ChunkUp(Damage); 01950 */ 01951 } 01952 } 01953 01954 //_____________________________________________________________________________ 01955 // ELR 01956 // ::TODO:: Check if leaving the corpse invisible on the ground until it is dropped 01957 // to a new location can not cause Bugs (else will have to make it follow his grabber). 01958 State Grabbed 01959 { 01960 ignores Trigger, Bump, HitWall, HeadVolumeChange, PhysicsVolumeChange, Falling, PainTimer, TakeDamage; 01961 01962 function AnimEnd(int Channel) 01963 { 01964 Super.AnimEnd(Channel); 01965 } 01966 01967 function bool UnGrabbed(vector Loc, vector Dir) 01968 { 01969 local vector vT; 01970 01971 SetCollisionSize(1.0, CarcassCollisionHeight); 01972 PrePivot = vect(0,0,1) * (default.CollisionHeight - CarcassCollisionHeight); 01973 vT = Dir; vT.Z = 0.0; 01974 if ( !SetLocation(Loc) ) 01975 if ( !SetLocation(Loc+0.5*CollisionRadius*vT) ) 01976 if ( !SetLocation(Loc-0.5*CollisionRadius*vT) ) 01977 { 01978 Log("BIG BUG CAN'T DROP BODY THERE !!!!!!!!! CHANGE THE BODY DROP TESTS"); 01979 //destroy(); 01980 } 01981 Setrotation(rotator(vT)); 01982 Velocity = vT*50; 01983 GotoState('BodyDropped'); 01984 // SetPhysics(PHYS_Falling); 01985 // Landed(vect(0,0,1)); 01986 return true; 01987 } 01988 01989 function BeginState() 01990 { 01991 Disable('tick'); 01992 if ( !IsPlayerPawn() ) 01993 { 01994 // Log("^^^ Cancelling RecomputeBoundingVolume for "$self); 01995 RecomputeBoundingVolume(false); 01996 } 01997 DTMemorize = DrawType; 01998 SetDrawType(DT_None); 01999 bBlockZeroExtentTraces=false; 02000 bBlockNonZeroExtentTraces=false; 02001 if (Shadow != none) 02002 { 02003 Shadow.Destroy(); 02004 Shadow = none; 02005 } 02006 } 02007 02008 function EndState() 02009 { 02010 Enable('tick'); 02011 SetDrawType(DTMemorize); 02012 bBlockZeroExtentTraces=true; 02013 bBlockNonZeroExtentTraces=true; 02014 if ( bActorShadows && (Shadow == None) ) 02015 { 02016 Shadow = Spawn(class'ShadowProjector',Self,'',Location); 02017 if ( (Shadow!=none) && (XIIIGameInfo(Level.Game).MapInfo != none) ) 02018 { 02019 Shadow.MaxTraceDistance = XIIIGameInfo(Level.Game).MapInfo.MaxTraceDistance; 02020 Shadow.ShadowIntensity = XIIIGameInfo(Level.Game).MapInfo.ShadowIntensity; 02021 Shadow.ShadowMaxDist = XIIIGameInfo(Level.Game).MapInfo.ShadowMaxDist; 02022 Shadow.ShadowTransDist = XIIIGameInfo(Level.Game).MapInfo.ShadowTransDist; 02023 } 02024 } 02025 } 02026 } 02027 02028 //_____________________________________________________________________________ 02029 // ELR 02030 State Prisonner 02031 { 02032 ignores Trigger, Bump, HitWall, HeadVolumeChange, PhysicsVolumeChange, Falling, PainTimer; 02033 02034 function bool UnGrabbed(vector Loc, vector Dir) 02035 { 02036 local vector vT, hitLoc, HitNorm; 02037 local float OldHeight, OldRadius; 02038 local actor A; 02039 02040 // must check we don't drop below ground 02041 A = Trace(HitLoc, HitNorm, Loc - vect(0,0,1)*CollisionHeight, Loc + vect(0,0,1)*CollisionHeight, false); 02042 if ( A != none ) 02043 { 02044 // Log("UNGRAB Trace="$A); 02045 Loc = HitLoc + vect(0,0,8) + vect(0,0,1)*(CollisionHeight + (1.0-HitNorm.Z)*CollisionRadius); 02046 } 02047 vT = Dir; vT.Z = 0.0; 02048 if ( !SetLocation(Loc) ) 02049 if ( !SetLocation(Loc+0.5*30*vT) ) 02050 if ( !SetLocation(Loc-0.5*30*vT) ) 02051 { 02052 Log("BIG BUG CAN'T DROP BODY THERE !!!!!!!!! CHANGE THE BODY DROP TESTS"); 02053 //destroy(); 02054 } 02055 // SetCollisionSize(default.collisionRadius, default.CollisionHeight); 02056 // Log("Dropped body at Loc="$Location@"Wanted="$Loc); 02057 Setrotation(rotator(vT)); 02058 Velocity = vT*50.0; 02059 SetCollision(true,false,false); 02060 // Controller.SetTimer(0.5,false); 02061 GotoState(''); 02062 TakeDamage( 2000, self, Location, vect(0,0,0) , class'DTDropAfterStun'); 02063 return true; 02064 } 02065 function BeginState() 02066 { 02067 Disable('tick'); 02068 // PlayGrabbed(); 02069 DTMemorize = DrawType; 02070 SetDrawType(DT_None); 02071 SetCollision(false,false,false); 02072 // log(self$" begin prisonner state, anim="$AnimSequence); 02073 bBlockZeroExtentTraces=false; 02074 bBlockNonZeroExtentTraces=false; 02075 if (Shadow != none) 02076 { 02077 Shadow.Destroy(); 02078 Shadow = none; 02079 } 02080 } 02081 function EndState() 02082 { 02083 Enable('tick'); 02084 SetDrawType(DTMemorize); 02085 // log(self$" End prisonner state, anim="$AnimSequence); 02086 bBlockZeroExtentTraces=true; 02087 bBlockNonZeroExtentTraces=true; 02088 if(bActorShadows && (Shadow==None) ) 02089 { 02090 Shadow = Spawn(class'ShadowProjector',Self,'',Location); 02091 if ( (Shadow!=none) && (XIIIGameInfo(Level.Game).MapInfo != none) ) 02092 { 02093 Shadow.MaxTraceDistance = XIIIGameInfo(Level.Game).MapInfo.MaxTraceDistance; 02094 Shadow.ShadowIntensity = XIIIGameInfo(Level.Game).MapInfo.ShadowIntensity; 02095 Shadow.ShadowMaxDist = XIIIGameInfo(Level.Game).MapInfo.ShadowMaxDist; 02096 Shadow.ShadowTransDist = XIIIGameInfo(Level.Game).MapInfo.ShadowTransDist; 02097 } 02098 } 02099 } 02100 } 02101 02102 /* 02103 //_____________________________________________________________________________ 02104 //function ControlSpine1Rotation() 02105 simulated function ControlSpineRotation(bool bPlayer) 02106 { 02107 local rotator R,S; 02108 local vector X,Y,Z; 02109 02110 if ( !IsInState('Dying') && (bPlayer || !IsPlayerPawn()) && bEnableSpineControl) 02111 { 02112 if ( bPlayer ) 02113 GetAxes(Controller.Rotation, X,Y,Z); 02114 else 02115 { 02116 if ( Controller.focus != none ) 02117 GetAxes(rotator(Controller.focus.Location - Location), X,Y,Z); 02118 else 02119 GetAxes(rotator(Controller.FocalPoint - Location), X,Y,Z); 02120 } 02121 02122 if ( Controller.Rotation.Pitch == 0 ) 02123 R = OrthoRotation(Z,-X,-Y); 02124 else 02125 R = OrthoRotation(Z,X,-Y); 02126 } 02127 else 02128 { 02129 // Old solution 02130 // R = GetBoneRotation('X Pelvis'); 02131 // NewSolution 02132 GetAxes(Rotation, X,Y,Z); 02133 if ( Rotation.Pitch == 0 ) 02134 R = OrthoRotation(Z,-X,-Y); 02135 else 02136 R = OrthoRotation(Z,X,-Y); 02137 } 02138 R.Pitch = Max(9000, R.Pitch); 02139 rSpineRotation = R; 02140 // if ( bEnableSpineControl ) 02141 SetBoneDirection( FIRINGBLENDBONE, rSpineRotation,, 1.0 ); 02142 // else 02143 // SetBoneDirection( FIRINGBLENDBONE, rot(0,0,0), vect(0,0,0), 0.0 ); 02144 // if ( Controller.bControlAnimations ) 02145 // log("==(ControlSpineRotation)"@self@"SET rSpineRotation="$rSpineRotation@"Role="$Role); 02146 } 02147 */ 02148 02149 //_____________________________________________________________________________ 02150 // 02151 simulated event Tick(float DT) 02152 { 02153 if ( ((Controller != none) && Controller.bControlAnimations) || (Controller == none) || bIsDead ) 02154 { 02155 SetBoneDirection( FIRINGBLENDBONE, rot(0,0,0), vect(0,0,0), 0.0 ); 02156 return; 02157 } 02158 02159 if (MyOldAcceleration != Acceleration) 02160 { 02161 if (MyOldAcceleration == vect(0,0,0)) // Start to move 02162 { 02163 if ( bDBAnim ) Log("@@ Tick == Animation Start Moving"); 02164 bMoving=true; 02165 } 02166 else if ( Acceleration == vect(0,0,0) ) // Stopped moving 02167 { 02168 if ( bDBAnim ) Log("@@ Tick == Animation Stop Moving"); 02169 02170 if ( bMoving && (Physics == PHYS_Walking) ) 02171 PlayEndStep(); 02172 02173 bMoving=false; 02174 } 02175 } 02176 MyOldAcceleration = Acceleration; 02177 } 02178 02179 //_____________________________________________________________________________ 02180 simulated function PlayLanded(float impactVel) 02181 { 02182 local float landVol; 02183 local material M; 02184 local actor A; 02185 local vector HitLoc, HitNorm; 02186 local bool bSilent; 02187 02188 if ( bDBAnim ) Log("@@ PlayLanded call for "$self@"w/bPhysicsAnimUpdate="$bPhysicsAnimUpdate); 02189 //default - do nothing (keep playing existing animation) 02190 landVol = impactVel/JumpZ; 02191 landVol = 0.005 * Mass * landVol * landVol; 02192 // PlaySound(Land, SLOT_Interact, FMin(20, landVol)); 02193 // if ( !bPhysicsAnimUpdate || !bMoving ) 02194 if ( !bPhysicsAnimUpdate ) 02195 PlayLandingAnimation(impactvel); 02196 // ChangeAnimation(); 02197 } 02198 02199 //_____________________________________________________________________________ 02200 simulated event ChangeAnimation() 02201 { 02202 if ( bDBAnim ) Log("@@ Change anim call for "$self); 02203 02204 if ( (Controller != None) && Controller.bControlAnimations ) 02205 { 02206 return; 02207 } 02208 // player animation - set up new idle and moving animations 02209 02210 PlayWaiting(); 02211 PlayMoving(); 02212 } 02213 02214 //_____________________________________________________________________________ 02215 // sent by the beginstate of active state for weapon 02216 simulated function SetFiringMode(name FM) 02217 { 02218 if ( bDBAnim ) Log("### SetFiringMode "$FM); 02219 02220 WeaponMode = FM; 02221 PlayWaiting(); 02222 PlayMoving(); 02223 bChangingWeapon=false; 02224 bReloadingWeapon=false; 02225 AnimEnd(FIRINGCHANNEL); // Stop the changing weapon anim using the FIRINGCHANNEL 02226 } 02227 02228 //_____________________________________________________________________________ 02229 simulated event AnimEnd(int Channel) 02230 { 02231 if ( bDBAnim ) Log("@@ AnimEnd w/channel="$Channel$" call for "$self); 02232 02233 if ( (Controller != none) && Controller.bControlAnimations ) 02234 { 02235 AnimBlendToAlpha(Channel,0,0.1); 02236 return; 02237 } 02238 02239 if (Physics == PHYS_Ladder) 02240 { 02241 PlayWaiting(); 02242 return; 02243 } 02244 02245 if ( Channel == FIRINGCHANNEL ) 02246 { 02247 bRndAnimM16 = true; 02248 02249 // FIRINGCHANNEL used for upper body (firing weapons, etc.) 02250 02251 if ( Role < ROLE_Authority ) 02252 { 02253 PlayWaiting(); 02254 PlayMoving(); 02255 } 02256 if ( bReloadingWeapon || !bChangingWeapon ) 02257 { 02258 AnimBlendToAlpha(FIRINGCHANNEL,0,0.2); 02259 } 02260 else 02261 { 02262 if ( bChangingWeapon ) 02263 { 02264 Switch(WeaponMode) 02265 { 02266 Case 'FM_Bazook': 02267 Case 'FM_BazookAlt': 02268 Case 'FM_2H': 02269 Case 'FM_M16': 02270 Case 'FM_ARAlt': 02271 Case 'FM_ShotGunAlt': 02272 Case 'FM_HarpoonAlt': 02273 PlayAnim('SearchGun',,0.15,FIRINGCHANNEL); break; 02274 Case 'FM_2HHeavy': 02275 PlayAnim('SearchGatling',,0.15,FIRINGCHANNEL); break; 02276 Default: 02277 PlayAnim('SearchPistol',,0.15,FIRINGCHANNEL); Break; 02278 } 02279 bReloadingWeapon=false; 02280 } 02281 else 02282 { 02283 if ( !bMoving ) 02284 PlayWaiting(); 02285 else 02286 PlayMoving(); 02287 } 02288 } 02289 } 02290 else 02291 { 02292 if ( !bMoving ) 02293 PlayWaiting(); 02294 else 02295 PlayMoving(); 02296 } 02297 } 02298 02299 //_____________________________________________________________________________ 02300 simulated function PlayWaiting() 02301 { 02302 if ( bDBAnim ) Log("--@ PlayWaiting call for "$self); 02303 02304 if ( (Controller != None) && Controller.bControlAnimations ) 02305 return; 02306 02307 if ( Physics == PHYS_Ladder ) 02308 { 02309 PlayAnim('WaitEchelle',,0.25); 02310 return; 02311 } 02312 else if ( Physics == PHYS_Swimming ) 02313 { 02314 PlayAnim('Swim',,0.25); 02315 return; 02316 } 02317 else if ( Physics == PHYS_Falling ) 02318 PlayJump(); 02319 else if ( bIsCrouched ) 02320 PlayAnim('WaitAccroupi',,0.25); 02321 else if ( AnimStatus =='Alert' ) 02322 PlayAnim('WaitAlerteNeutre',,0.25); 02323 else 02324 PlayAnim('WaitNeutre',,0.25); 02325 02326 02327 if ( bIsCrouched ) 02328 { 02329 Switch(WeaponMode) 02330 { 02331 Case 'FM_Snipe': 02332 WaitWeaponAnim='SniperWait'; Break; 02333 Case 'FM_1H': 02334 Case 'FM_44Alt': 02335 Case 'FM_Throw': 02336 WaitWeaponAnim='WaitPistoletAccroupi'; break; 02337 Case 'FM_2H': 02338 Case 'FM_M16': 02339 Case 'FM_ARAlt': 02340 Case 'FM_ShotGunAlt': 02341 Case 'FM_HarpoonAlt': 02342 WaitWeaponAnim='WaitFusilAccroupi'; break; 02343 Case 'FM_Bazook': 02344 Case 'FM_BazookAlt': 02345 WaitWeaponAnim='WaitBazooka'; break; 02346 Case 'FM_2HHeavy': 02347 WaitWeaponAnim='WaitGatling'; break; 02348 Default: 02349 WaitWeaponAnim='WaitNeutreAccroupi'; break; 02350 } 02351 } 02352 else 02353 { 02354 if ( AnimStatus =='Alert' ) 02355 { 02356 Switch(WeaponMode) 02357 { 02358 Case 'FM_Snipe': 02359 WaitWeaponAnim='SniperWait'; Break; 02360 Case 'FM_1H': 02361 Case 'FM_44Alt': 02362 WaitWeaponAnim='WaitPistoletAlerte2'; Break; 02363 Case 'FM_Throw': 02364 WaitWeaponAnim='WaitCouteauAlerte'; Break; 02365 Case 'FM_2H': 02366 Case 'FM_M16': 02367 Case 'FM_ARAlt': 02368 Case 'FM_ShotGunAlt': 02369 Case 'FM_HarpoonAlt': 02370 WaitWeaponAnim='WaitKalashAlerte'; Break; 02371 Case 'FM_Bazook': 02372 Case 'FM_BazookAlt': 02373 WaitWeaponAnim='WaitBazooka'; Break; 02374 Case 'FM_2HHeavy': 02375 WaitWeaponAnim='WaitGatling'; Break; 02376 Default: 02377 WaitWeaponAnim = 'WaitNeutreAlerte'; Break; 02378 } 02379 } 02380 else 02381 { 02382 Switch(WeaponMode) 02383 { 02384 Case 'FM_Snipe': 02385 WaitWeaponAnim='WaitSniperAlerte'; break; 02386 Case 'FM_1H': 02387 Case 'FM_44Alt': 02388 Case 'FM_Throw': 02389 WaitWeaponAnim='WaitPistolet'; break; 02390 Case 'FM_2H': 02391 Case 'FM_M16': 02392 Case 'FM_ARAlt': 02393 Case 'FM_ShotGunAlt': 02394 Case 'FM_HarpoonAlt': 02395 WaitWeaponAnim='WaitKalash'; break; 02396 Case 'FM_Bazook': 02397 Case 'FM_BazookAlt': 02398 WaitWeaponAnim='WaitBazooka'; break; 02399 Case 'FM_2HHeavy': 02400 WaitWeaponAnim='WaitGatling'; break; 02401 Default: 02402 WaitWeaponAnim = 'WaitNeutre'; break; 02403 } 02404 } 02405 } 02406 02407 PlayAnim(WaitWeaponAnim,,0.25,12); 02408 AnimBlendParams(12,1.0,0.0,0.0,FIRINGBLENDBONE); 02409 } 02410 02411 //_____________________________________________________________________________ 02412 simulated function PlayMoving() 02413 { 02414 if ( bDBAnim ) Log("--@ PlayMoving call for "$self@"in physics"@Physics); 02415 02416 if ( Physics == PHYS_Ladder ) 02417 { 02418 AnimateLadder(); 02419 return; 02420 } 02421 else if ( Physics == PHYS_Swimming ) 02422 { 02423 AnimateSwimming(); 02424 return; 02425 } 02426 02427 if ( (Physics == PHYS_None) || ((Controller != None) && Controller.bPreparingMove) ) 02428 { 02429 // bot is preparing move - not really moving 02430 PlayWaiting(); 02431 return; 02432 } 02433 if ( Physics == PHYS_Falling ) 02434 { 02435 PlayJump(); 02436 } 02437 if ( Physics != PHYS_Ladder ) 02438 { 02439 if ( bIsCrouched ) 02440 AnimateCrouchWalking(); 02441 else if ( bIsWalking ) 02442 AnimateWalking(); 02443 else 02444 AnimateRunning(); 02445 } 02446 } 02447 02448 /*//_____________________________________________________________________________ 02449 simulated function PlayLadder() 02450 { 02451 if (Velocity == vect(0,0,0) ) 02452 PlayAnim('WaitEchelle',,0.25); 02453 else if ( Velocity.z > 0 ) 02454 PlayAnim('ClimbUp',,0.25); 02455 else 02456 PlayAnim('ClimbDown',,0.25); 02457 AnimBlendToAlpha(SUBWEAPONCHANNEL,0,0.1); 02458 }*/ 02459 02460 //_____________________________________________________________________________ 02461 simulated function PlayOpenDoor() 02462 { 02463 if ( bDBAnim ) Log("--@ PlayOpenDoor call for "$self); 02464 PlayAnim('OpenDoor',,0.1,FIRINGCHANNEL); 02465 } 02466 02467 //_____________________________________________________________________________ 02468 simulated function PlaySearchCorpse() 02469 { 02470 if ( bDBAnim ) Log("--@ PlayOpenDoor call for "$self); 02471 PlayAnim('SearchGround',,0.1,FIRINGCHANNEL); 02472 } 02473 02474 //_____________________________________________________________________________ 02475 simulated event PlayJump() 02476 { 02477 local vector XY; 02478 02479 if ( bDBAnim ) 02480 Log("--@"@Level.TimeSeconds@" PlayJump call for "$self); 02481 02482 if ( (Level.NetMode == NM_Client) && !IsLocallyControlled() && (LastJumpSoundTime < Level.TimeSeconds - 1.0) ) 02483 { 02484 // Log(" @"@Level.TimeSeconds@" PlayJump Play sound"); 02485 LastJumpSoundTime = Level.TimeSeconds; 02486 PlaySound(hJumpSound); // play jump sound on clients 02487 } 02488 /* if ( bJumpImpulse ) 02489 { 02490 PlayAnim('ImpulsionJump',,0.0) ; 02491 bJumpImpulse = false; 02492 } 02493 else 02494 {*/ 02495 XY = Velocity; 02496 XY.z = 0.0; 02497 if ( vSize(XY) < 30.0 ) 02498 PlayAnim('JumpUp',,0.50); 02499 else 02500 PlayAnim('Jump',,0.50); 02501 // } 02502 } 02503 02504 //_____________________________________________________________________________ 02505 simulated event PlayLandingAnimation(float ImpactVel) 02506 { 02507 if ( (Controller != None) && Controller.bControlAnimations ) 02508 return; 02509 02510 if ( bIsDead || IsDead() ) 02511 return; 02512 02513 if ( bDBAnim ) Log("--@ PlayLandingAnimation call for "$self); 02514 02515 AnimateCrouchWalking(); 02516 02517 if( velocity.x + velocity.y > 70 ) 02518 { 02519 PlayAnim('WaitAccroupi',,0.25); 02520 SetTimer( 0.3,false ); 02521 } 02522 else 02523 { 02524 PlayAnim('WaitAccroupi',,0.15); 02525 SetTimer( 0.3,false ); 02526 } 02527 } 02528 02529 //_____________________________________________________________________________ 02530 simulated event PlayDying(class<DamageType> DamageType, vector HitLoc) 02531 { 02532 if ( bDBAnim ) Log("--@ PlayDying call for "$self@"HitLocCode="$HitLoc); 02533 02534 bPlayedDeath = true; 02535 if ( bPhysicsAnimUpdate ) 02536 { 02537 bTearOff = true; 02538 bReplicateMovement = false; 02539 } 02540 // Velocity += TearOffMomentum; 02541 SetPhysics(PHYS_Falling); 02542 02543 AnimBlendToAlpha(FIRINGCHANNEL,0,0.1); 02544 //AnimBlendToAlpha(FIRINGCHANNEL+2,0,0.1);//suppression du paf 02545 02546 PlayDyingAnim(DamageType,HitLoc); 02547 GotoState('Dying'); 02548 } 02549 02550 //_____________________________________________________________________________ 02551 simulated function PlayDyingAnim(class<DamageType> DamageType, vector HitLoc) 02552 { 02553 local name DeathAnim; 02554 02555 DeathAnim='DeathTete'; // default 02556 02557 if ( bIsCrouched ) 02558 DeathAnim = 'deathaccroupi'; 02559 else if ( DamageType == class'DTDropAfterStun' ) 02560 { 02561 DeathAnim = 'deathotage'; 02562 } 02563 else if ( (DamageType == class'DTStunned') || (DamageType == class'DTSureStunned') ) 02564 DeathAnim = 'deathassomme'; 02565 else 02566 { 02567 if( HitLoc.X == 0 ) 02568 { 02569 switch( 1 ) 02570 // switch( int(fRand()*2) ) 02571 { 02572 case 0: DeathAnim='DeathTete'; break; 02573 case 1: DeathAnim='DeathTete2'; break; 02574 case 2: DeathAnim='DeathTete'; break; 02575 } 02576 } 02577 else 02578 { 02579 switch( int(fRand()*8) ) 02580 { 02581 case 0: DeathAnim='DeathEpauleGauche'; break; 02582 case 1: DeathAnim='DeathChevilleGauche'; break; 02583 case 2: DeathAnim='DeathChevilleDroite'; break; 02584 case 3: DeathAnim='DeathBuste3'; break; 02585 case 4: DeathAnim='DeathDos'; break; 02586 case 5: DeathAnim='DeathVentre' ; break; 02587 case 6: DeathAnim='DeathBuste0'; break; 02588 case 7: DeathAnim='DeathBuste2' ; break; 02589 case 8: DeathAnim='DeathTete2'; break; 02590 } 02591 } 02592 } 02593 02594 if ( DamageType == class'DTDropAfterStun' ) 02595 { 02596 PlayAnim(DeathAnim,1.0,0); 02597 PlayAnim(DeathAnim,1.0,0,FIRINGCHANNEL+2); 02598 EnableChannelNotify(FIRINGCHANNEL+2, 0); 02599 } 02600 else 02601 { 02602 PlayAnim(DeathAnim,1.0,0.15); 02603 PlayAnim(DeathAnim,1.0,0.15,FIRINGCHANNEL+2); 02604 EnableChannelNotify(FIRINGCHANNEL+2, 0); 02605 } 02606 02607 if ( bDBAnim ) 02608 Log("### PlayDyingAnim call for "$self@" HitLoc="$HitLoc@"anim="@DeathAnim); 02609 } 02610 02611 //_____________________________________________________________________________ 02612 simulated function PlaySwitchingWeapon(float Rate, name FiringMode) 02613 { 02614 if ( bDBAnim ) Log("--@ PlaySwitchingWeapon call for "$self@"w/FiringMode="$FiringMode); 02615 02616 if ( bIsDead ) 02617 return; 02618 02619 WeaponMode = FiringMode; 02620 bChangingWeapon = true; 02621 bWeaponFiring = false; 02622 AnimBlendParams(FIRINGCHANNEL,1.0,0,0,FIRINGBLENDBONE); 02623 02624 Switch(WeaponMode) 02625 { 02626 Case 'FM_Bazook': 02627 Case 'FM_BazookAlt': 02628 Case 'FM_2H': 02629 Case 'FM_M16': 02630 Case 'FM_ARAlt': 02631 Case 'FM_ShotGunAlt': 02632 Case 'FM_HarpoonAlt': 02633 AnimAction = 'SearchGun'; break; 02634 Case 'FM_2HHeavy': 02635 AnimAction = 'SearchGatling'; break; 02636 Default: 02637 AnimAction = 'SearchPistol'; break; 02638 } 02639 02640 PlayAnim(AnimAction,Rate,0.15,FIRINGCHANNEL); 02641 } 02642 02643 //_____________________________________________________________________________ 02644 simulated function PlayReLoading(float Rate, name FiringMode) 02645 { 02646 if ( bDBAnim ) Log("--@ PlayReLoading call for "$self@"w/FiringMode="$FiringMode); 02647 02648 if ( bIsDead ) 02649 return; 02650 02651 WeaponMode = FiringMode; 02652 bReloadingWeapon = true; 02653 bWeaponFiring = false; 02654 AnimBlendParams(FIRINGCHANNEL,1.0,0,0,FIRINGBLENDBONE); 02655 AnimBlendToAlpha(FIRINGCHANNEL,1.0, 0.001 ); 02656 02657 Switch(WeaponMode) 02658 { 02659 Case 'FM_Snipe': 02660 if ( bIsCrouched ) 02661 AnimAction = 'ReloadGunAccroupi'; 02662 else 02663 AnimAction = 'ReLoadGun'; 02664 break; 02665 Case 'FM_Bazook': 02666 AnimAction = 'ReloadBazooka'; break; 02667 Case 'FM_2H': 02668 Case 'FM_M16': 02669 if ( bIsCrouched ) 02670 AnimAction = 'ReloadGunAccroupi'; 02671 else 02672 AnimAction = 'ReLoadGun'; 02673 break; 02674 Case 'FM_2HHeavy': 02675 AnimAction = 'ReLoadGatling'; break; 02676 Default: 02677 if ( bIsCrouched ) 02678 AnimAction = 'ReloadPistolAccroupi'; 02679 else 02680 AnimAction = 'ReLoadPistol'; 02681 break; 02682 } 02683 PlayAnim(AnimAction,Rate,0.15,FIRINGCHANNEL); 02684 } 02685 02686 //_____________________________________________________________________________ 02687 simulated function PlayFiring(float Rate, name FiringMode) 02688 { 02689 if ( bDBAnim ) 02690 Log("--@ PlayFiring call for "$self@"w/FiringMode="$FiringMode); 02691 02692 WeaponMode = FiringMode; 02693 bWeaponFiring=true; 02694 AnimBlendParams(FIRINGCHANNEL,1.0,0,0,FIRINGBLENDBONE); 02695 AnimBlendToAlpha(FIRINGCHANNEL,1.0, 0.001 ); 02696 02697 if ( !bIsCrouched ) 02698 { 02699 Switch(WeaponMode) 02700 { 02701 Case 'FM_Fists': 02702 if ( fRand() < 0.500 ) 02703 AnimAction = 'HandDRetour'; 02704 else 02705 AnimAction = 'HandGRetour'; 02706 break; 02707 Case 'FM_BazookAlt': 02708 AnimAction='FireAltBazookaRetour'; break; 02709 Case 'FM_Snipe': 02710 AnimAction='SniperC'; break; 02711 Case 'FM_1H': 02712 AnimAction = 'PistoletRetour'; break; 02713 Case 'FM_Throw': 02714 AnimAction = 'ThrowRetour'; break; 02715 Case 'FM_2H': 02716 AnimAction = 'GunRetour'; break; 02717 Case 'FM_ShotGunAlt': 02718 AnimAction = 'FireAltGunRetour'; break; 02719 Case 'FM_HarpoonAlt': 02720 AnimAction = 'FireAltHarponRetour'; break; 02721 Case 'FM_Bazook': 02722 AnimAction = 'BazookaRetour'; break; 02723 Case 'FM_2HHeavy': 02724 AnimAction = 'GatlingRetour'; break; 02725 Case 'FM_Stun': 02726 AnimAction = 'DecoRetour'; break; 02727 Case 'FM_ARAlt': 02728 AnimAction = 'FireAltM16Retour'; break; 02729 Case 'FM_44Alt': 02730 AnimAction = 'FireAltMagnumRetour'; break; 02731 Case 'FM_M16': 02732 if ( bRndAnimM16 ) 02733 { 02734 AnimM16 = int(fRand()*2); 02735 bRndAnimM16 = false; 02736 } 02737 if( AnimM16 == 0 ) 02738 AnimAction = 'RetourKalash'; 02739 else 02740 AnimAction = 'GunRetour'; 02741 break; 02742 Default: 02743 AnimAction = 'HandDRetour'; break; 02744 } 02745 } 02746 else 02747 { 02748 Switch(WeaponMode) 02749 { 02750 Case 'FM_Fists': 02751 if ( fRand() < 0.500 ) 02752 AnimAction = 'HandDRetour'; 02753 else 02754 AnimAction = 'HandGRetour'; 02755 break; 02756 Case 'FM_BazookAlt': 02757 AnimAction='HandDRetour'; break; 02758 Case 'FM_Snipe': 02759 AnimAction='SniperC'; break; 02760 Case 'FM_1H': 02761 AnimAction = 'PistoletRetour'; break; 02762 Case 'FM_Throw': 02763 AnimAction = 'ThrowRetourAccroupi'; break; 02764 Case 'FM_2H': 02765 Case 'FM_M16': 02766 Case 'FM_HarpoonAlt': 02767 AnimAction = 'GunRetourAccroupi'; break; 02768 Case 'FM_ShotGunAlt': 02769 AnimAction = 'HandDRetour'; break; 02770 Case 'FM_Bazook': 02771 AnimAction = 'BazookaRetour'; break; 02772 Case 'FM_2HHeavy': 02773 AnimAction = 'GatlingRetour'; break; 02774 Case 'FM_Stun': 02775 AnimAction = 'DecoRetour'; break; 02776 Default: 02777 AnimAction = 'HandDRetour'; break; 02778 } 02779 } 02780 02781 PlayAnim(AnimAction,Rate,0.03,FIRINGCHANNEL); 02782 } 02783 02784 /* 02785 //_____________________________________________________________________________ 02786 simulated function PlayJumpImpulse() 02787 { 02788 if ( bDBAnim ) Log("@@@ PlayJumpImpulse call for "$self); 02789 PlayAnim('ImpulsionJump'); 02790 } 02791 */ 02792 02793 //_____________________________________________________________________________ 02794 simulated function AnimateCrouchWalking() 02795 { 02796 TurnLeftAnim = 'RotationGAccroupi'; 02797 TurnRightAnim = 'RotationDAccroupi'; 02798 MovementAnims[0] = 'WalkAccroupi'; 02799 MovementAnims[1] = 'StrafeGaccroupi'; 02800 MovementAnims[2] = 'MarcheArrAccroupi'; 02801 MovementAnims[3] = 'StrafeDaccroupi'; 02802 MovementAnimRate[0] = 1.0; 02803 MovementAnimRate[1] = 1.0; 02804 MovementAnimRate[2] = 1.0; 02805 MovementAnimRate[3] = 1.0; 02806 02807 Switch(WeaponMode) 02808 { 02809 Case'FM_Snipe': 02810 WeaponAnim='SniperWait'; break; 02811 Case 'FM_1H': 02812 WeaponAnim='WalkPistoletAccroupi'; break; 02813 Case 'FM_2H': 02814 Case 'FM_M16': 02815 Case 'FM_ShotGunAlt': 02816 Case 'FM_HarpoonAlt': 02817 WeaponAnim='RunGunAccroupi'; break; 02818 Case 'FM_Bazook': 02819 Case 'FM_BazookAlt': 02820 WeaponAnim='RunBazook'; break; 02821 Case 'FM_2HHeavy': 02822 WeaponAnim='WaitGatling'; break; 02823 Case 'FM_Fists': 02824 Case 'FM_Throw': 02825 Default: 02826 WeaponAnim='WalkAccroupi'; 02827 } 02828 02829 if ( bDBAnim ) Log("--@ AnimateCrouchWalking call for "$self@"WeaponMode="$WeaponMode@"WeaponAnim="$WeaponAnim); 02830 } 02831 02832 //_____________________________________________________________________________ 02833 simulated function AnimateLadder() 02834 { 02835 TurnLeftAnim = 'WaitEchelle'; 02836 TurnRightAnim = 'WaitEchelle'; 02837 MovementAnims[0] = 'ClimbUp'; 02838 MovementAnims[1] = 'WaitEchelle'; 02839 MovementAnims[2] = 'ClimbDown'; 02840 MovementAnims[3] = 'WaitEchelle'; 02841 MovementAnimRate[0] = 1.0; 02842 MovementAnimRate[1] = 1.0; 02843 MovementAnimRate[2] = 1.0; 02844 MovementAnimRate[3] = 1.0; 02845 02846 if ( bDBAnim ) Log("--@ AnimateLadder call for "$self@"WeaponMode="$WeaponMode@"WeaponAnim="$WeaponAnim); 02847 } 02848 02849 //_____________________________________________________________________________ 02850 simulated function AnimateSwimming() 02851 { 02852 TurnLeftAnim = 'Swim'; 02853 TurnRightAnim = 'Swim'; 02854 MovementAnims[0] = 'Swim'; 02855 MovementAnims[1] = 'Swim'; 02856 MovementAnims[2] = 'Swim'; 02857 MovementAnims[3] = 'Swim'; 02858 MovementAnimRate[0] = 1.0; 02859 MovementAnimRate[1] = 1.0; 02860 MovementAnimRate[2] = 1.0; 02861 MovementAnimRate[3] = 1.0; 02862 02863 if ( bDBAnim ) Log("--@ AnimateSwimming call for "$self@"WeaponMode="$WeaponMode@"WeaponAnim="$WeaponAnim); 02864 } 02865 02866 //_____________________________________________________________________________ 02867 simulated function AnimateWalking() 02868 { 02869 TurnLeftAnim = 'RotationG'; 02870 TurnRightAnim = 'RotationD'; 02871 MovementAnims[0] = 'Walk'; 02872 MovementAnims[1] = 'StrafeG'; 02873 MovementAnims[2] = 'MarcheArrStandar'; 02874 MovementAnims[3] = 'StrafeD'; 02875 MovementAnimRate[0] = 1.0; 02876 MovementAnimRate[1] = 1.0; 02877 MovementAnimRate[2] = 1.0; 02878 MovementAnimRate[3] = 1.0; 02879 02880 if ( AnimStatus =='Alert' ) 02881 { 02882 Switch(WeaponMode) 02883 { 02884 Case 'FM_Snipe': 02885 WeaponAnim='SniperWait'; break; 02886 Case 'FM_1H': 02887 WeaponAnim='WaitPistoletAlerte2'; break; 02888 Case 'FM_Throw': 02889 WeaponAnim='WaitCouteauAlerte'; break; 02890 Case 'FM_2H': 02891 Case 'FM_M16': 02892 Case 'FM_ShotGunAlt': 02893 Case 'FM_HarpoonAlt': 02894 WeaponAnim='WaitKalashAlerte'; break; 02895 Case 'FM_Bazook': 02896 Case 'FM_BazookAlt': 02897 WeaponAnim='WaitBazooka'; break; 02898 Case 'FM_2HHeavy': 02899 WeaponAnim='WaitGatling'; break; 02900 Case 'FM_Fists': 02901 Default: 02902 WeaponAnim = 'WaitNeutreAlerte'; break; 02903 } 02904 MovementAnims[0] = 'WalkAlerte'; 02905 } 02906 else 02907 { 02908 Switch(WeaponMode) 02909 { 02910 Case 'FM_Snipe': 02911 WeaponAnim='WaitSniperAlerte'; break; 02912 Case 'FM_2H': 02913 Case 'FM_M16': 02914 Case 'FM_ShotGunAlt': 02915 Case 'FM_HarpoonAlt': 02916 WeaponAnim='WaitKalash'; break; 02917 Case 'FM_Bazook': 02918 Case 'FM_BazookAlt': 02919 WeaponAnim='RunBazook'; break; 02920 Case 'FM_2HHeavy': 02921 WeaponAnim='WalkGatling'; break; 02922 Case 'FM_Fists': 02923 Case 'FM_1H': 02924 Case 'FM_Throw': 02925 Default: 02926 WeaponAnim='Walk'; break; 02927 } 02928 } 02929 02930 if ( bDBAnim ) Log("--@ AnimateWalking call for "$self@"WeaponMode="$WeaponMode@"WeaponAnim="$WeaponAnim); 02931 } 02932 02933 //_____________________________________________________________________________ 02934 simulated function AnimateRunning() 02935 { 02936 TurnLeftAnim = 'RotationG'; 02937 TurnRightAnim = 'RotationD'; 02938 MovementAnims[0] = 'Run'; 02939 MovementAnims[1] = 'StrafeGspeed'; 02940 MovementAnims[2] = 'BackPaddle'; 02941 MovementAnims[3] = 'StrafeDspeed'; 02942 MovementAnimRate[0] = 1.0; 02943 MovementAnimRate[1] = 1.0; 02944 MovementAnimRate[2] = 1.0; 02945 MovementAnimRate[3] = 1.0; 02946 02947 if ( AnimStatus =='Alert' ) 02948 { 02949 Switch(WeaponMode) 02950 { 02951 Case 'FM_Snipe': 02952 WeaponAnim='SniperWait'; break; 02953 Case 'FM_1H': 02954 WeaponAnim='RunPistoletAlerte'; break; 02955 Case 'FM_2H': 02956 Case 'FM_M16': 02957 Case 'FM_ShotGunAlt': 02958 Case 'FM_HarpoonAlt': 02959 WeaponAnim='WaitKalashAlerte'; break; 02960 Case 'FM_Bazook': 02961 Case 'FM_BazookAlt': 02962 WeaponAnim='WaitBazooka'; break; 02963 Case 'FM_2HHeavy': 02964 WeaponAnim='WaitGatling'; break; 02965 Case 'FM_Throw': 02966 Case 'FM_Fists': 02967 Default: 02968 WeaponAnim='Run'; break; 02969 } 02970 } 02971 else 02972 { 02973 Switch(WeaponMode) 02974 { 02975 Case 'FM_Snipe': 02976 WeaponAnim='SniperWait'; Break; 02977 Case 'FM_Fists': 02978 WeaponAnim='Run'; Break; 02979 Case 'FM_1H': 02980 WeaponAnim='RunPistolet'; Break; 02981 Case 'FM_Throw': 02982 WeaponAnim='Run'; Break; 02983 Case 'FM_2H': 02984 Case 'FM_M16': 02985 Case 'FM_ShotGunAlt': 02986 Case 'FM_HarpoonAlt': 02987 WeaponAnim='WaitKalashAlerte'; Break; 02988 case 'FM_Bazook': 02989 Case 'FM_BazookAlt': 02990 WeaponAnim='WalkBazook'; Break; 02991 case 'FM_2HHeavy': 02992 WeaponAnim='RunGatling'; Break; 02993 Default: 02994 WeaponAnim='Run'; Break; 02995 } 02996 } 02997 02998 if ( bDBAnim ) Log("--@ AnimateRunning call for "$self@"WeaponMode="$WeaponMode@"WeaponAnim="$WeaponAnim); 02999 } 03000 03001 //_____________________________________________________________________________ 03002 simulated event SetAnimAction(name NewAnimAction) 03003 { 03004 if ( bDBAnim ) 03005 Log("@@ SetAnimAction call for "$self@"w/ NewAnimAction="$NewAnimAction); 03006 03007 AnimBlendParams(FIRINGCHANNEL,1.0,0,0,FIRINGBLENDBONE); 03008 PlayAnim(NewAnimAction,1.0,0.15, FIRINGCHANNEL); 03009 AnimAction=''; 03010 } 03011 03012 //_____________________________________________________________________________ 03013 simulated function PlaySwimSound() 03014 { 03015 PlaySound(hNotifSwimSound, int(vsize(velocity)) ); 03016 } 03017 03018 //_____________________________________________________________________________ 03019 Simulated function PlayFootladder() 03020 { 03021 local bool bSilent; 03022 03023 bSilent = (FindInventoryKind('SilentWalkSkill')!=none); 03024 if ( LadderVolume(PhysicsVolume) != none ) 03025 { 03026 // Log("PlayFootladder sound "$LadderVolume(PhysicsVolume).hFootLadderSound$" default="$class'LadderVolume'.default.hFootLadderSound); 03027 if ( LadderVolume(PhysicsVolume).hFootLadderSound != none ) 03028 PlaySound(LadderVolume(PhysicsVolume).hFootLadderSound, int(vsize(velocity)), SoundStepCategory, int(bSilent) ); 03029 else 03030 PlaySound(hLadderSound, int(vsize(velocity)), SoundStepCategory, int(bSilent) ); 03031 } 03032 } 03033 03034 //_____________________________________________________________________________ 03035 simulated function PlayEndStep() 03036 { 03037 /* Don't do anything for pawns other than player 03038 local material M; 03039 local actor A; 03040 local vector HitLoc, HitNorm; 03041 local int MemSoundStepCategory; 03042 03043 if (base == none) 03044 return; 03045 03046 A = Trace(HitLoc, HitNorm, Location - (CollisionHeight + CollisionRadius) * vect(0,0,1), location, true, vect(0,0,0), M); 03047 03048 if ( TerrainInfo(A) != none ) 03049 { 03050 if( Level.bReplaceHXScripts ) 03051 PlaySndPNJStep( TerrainInfo(A).PNJSndStep, vsize(velocity), -2, false ); 03052 else 03053 PlaySound(TerrainInfo(A).FootstepSound, int(vsize(velocity)), -2, 0 ); 03054 Instigator = self; 03055 if ( bIsWalking ) 03056 MakeNoise(TerrainInfo(A).NoiseLoudness / 5.0); 03057 else 03058 MakeNoise(TerrainInfo(A).NoiseLoudness); 03059 } 03060 else if (M != none) 03061 { 03062 if( Level.bReplaceHXScripts ) 03063 PlaySndPNJStep( M.PNJSndStep, vsize(velocity), -2, false ); 03064 else 03065 PlaySound(M.FootstepSound, int(vsize(velocity)), -2, 0 ); 03066 Instigator = self; 03067 if ( bIsWalking ) 03068 MakeNoise(M.NoiseLoudness / 5.0); 03069 else 03070 MakeNoise(M.NoiseLoudness); 03071 } 03072 // else 03073 // log("FootStepSound not played !! HitActor="$A@"M="$M); 03074 */ 03075 } 03076 03077 //_____________________________________________________________________________ 03078 simulated function PlayFootStep() 03079 { 03080 local material M; 03081 // local actor A; 03082 // local vector HitLoc, HitNorm; 03083 // local int MemSoundStepCategory; 03084 03085 if ( (base == none) || !bMoving ) 03086 return; 03087 03088 // A = Trace(HitLoc, HitNorm, Location - (CollisionHeight + CollisionRadius) * vect(0,0,1), location, true, vect(0,0,0), M); 03089 M = LastCollidedMaterial; 03090 /* if ( TerrainInfo(A) != none ) 03091 { 03092 if( Level.bReplaceHXScripts ) 03093 PlaySndPNJStep( TerrainInfo(A).PNJSndStep, vsize(velocity), SoundStepCategory, false ); 03094 else 03095 PlaySound(TerrainInfo(A).FootstepSound, int(vsize(velocity)), SoundStepCategory, 0 ); 03096 Instigator = self; 03097 if ( bIsWalking ) 03098 MakeNoise(TerrainInfo(A).NoiseLoudness / 5.0); 03099 else 03100 MakeNoise(TerrainInfo(A).NoiseLoudness); 03101 } 03102 else */ 03103 if (M != none) 03104 { 03105 if( Level.bReplaceHXScripts ) 03106 PlaySndPNJStep( M.PNJSndStep, vsize(velocity), SoundStepCategory, false ); 03107 else 03108 PlaySound(M.FootstepSound, int(vsize(velocity)), SoundStepCategory, 0 ); 03109 Instigator = self; 03110 // ELR Cancel Use of M.NoiseLoudness to allow players 'hear' them by six sense always 03111 /* 03112 03113 if ( bIsWalking ) 03114 MakeNoise(M.NoiseLoudness / 5.0); 03115 else 03116 MakeNoise(M.NoiseLoudness);*/ 03117 MakeNoise(1.0); 03118 } 03119 // else 03120 // log("FootStepSound not played !! HitActor="$A@"M="$M); 03121 } 03122 03123 simulated function SNDNot00() { PlaySound(hSNDNotSound[0]); } 03124 simulated function SNDNot01() { PlaySound(hSNDNotSound[1]); } 03125 simulated function SNDNot02() { PlaySound(hSNDNotSound[2]); } 03126 simulated function SNDNot03() { PlaySound(hSNDNotSound[3]); } 03127 simulated function SNDNot04() { PlaySound(hSNDNotSound[4]); } 03128 simulated function SNDNot05() { PlaySound(hSNDNotSound[5]); } 03129 simulated function SNDNot06() { PlaySound(hSNDNotSound[6]); } 03130 simulated function SNDNot07() { PlaySound(hSNDNotSound[7]); } 03131 simulated function SNDNot08() { PlaySound(hSNDNotSound[8]); } 03132 simulated function SNDNot09() { PlaySound(hSNDNotSound[9]); } 03133 03134 simulated function SNDNot10() { PlaySound(hSNDNotSound[10]); } 03135 simulated function SNDNot11() { PlaySound(hSNDNotSound[11]); } 03136 simulated function SNDNot12() { PlaySound(hSNDNotSound[12]); } 03137 simulated function SNDNot13() { PlaySound(hSNDNotSound[13]); } 03138 simulated function SNDNot14() { PlaySound(hSNDNotSound[14]); } 03139 simulated function SNDNot15() { PlaySound(hSNDNotSound[15]); } 03140 simulated function SNDNot16() { PlaySound(hSNDNotSound[16]); } 03141 simulated function SNDNot17() { PlaySound(hSNDNotSound[17]); } 03142 simulated function SNDNot18() { PlaySound(hSNDNotSound[18]); } 03143 simulated function SNDNot19() { PlaySound(hSNDNotSound[19]); } 03144 03145 simulated function SNDNot20() { PlaySound(hSNDNotSound[20]); } 03146 simulated function SNDNot21() { PlaySound(hSNDNotSound[21]); } 03147 simulated function SNDNot22() { PlaySound(hSNDNotSound[22]); } 03148 simulated function SNDNot23() { PlaySound(hSNDNotSound[23]); } 03149 simulated function SNDNot24() { PlaySound(hSNDNotSound[24]); } 03150 simulated function SNDNot25() { PlaySound(hSNDNotSound[25]); } 03151 simulated function SNDNot26() { PlaySound(hSNDNotSound[26]); } 03152 simulated function SNDNot27() { PlaySound(hSNDNotSound[27]); } 03153 simulated function SNDNot28() { PlaySound(hSNDNotSound[28]); } 03154 simulated function SNDNot29() { PlaySound(hSNDNotSound[29]); } 03155 03156 // hBodyFallSound=Sound'XIIIsound.SpecActions.BodyFallGen' 03157 03158 03159 defaultproperties 03160 { 03161 GameOverGoal=-1 03162 bCanJump=True 03163 bCanWalkOffLedges=True 03164 bSpineControl=True 03165 bDBCartoon=True 03166 bAllowJump=True 03167 bIsPafable=True 03168 bCanBeGrabbed=True 03169 bStunnedIfJumpedOn=True 03170 GroundSpeed=472.000000 03171 AirControl=0.350000 03172 WalkingPct=0.500000 03173 CrouchingPct=0.300000 03174 PawnName="Someone" 03175 BaseEyeHeight=60.000000 03176 EyeHeight=50.000000 03177 CrouchHeight=48.000000 03178 Health=150 03179 UnderWaterTime=19.000000 03180 CarcassCollisionHeight=20.000000 03181 WeaponAnim="Run" 03182 WaitWeaponAnim="Run" 03183 bPhysicsAnimUpdate=True 03184 MovementAnims(0)="Run" 03185 MovementAnims(1)="StrafeGSpeed" 03186 MovementAnims(2)="BackPaddle" 03187 MovementAnims(3)="StrafeDSpeed" 03188 TurnLeftAnim="RotationG" 03189 TurnRightAnim="RotationD" 03190 Alliance="'" 03191 SpeedFactorLimit=1.000000 03192 DrownTimer=30.000000 03193 DTimerStep=0.250000 03194 WeaponMode="FM_Fists" 03195 CrouchedVisibility=85 03196 hStunFromAboveSound=Sound'XIIIsound.SpecActions.LeonFall' 03197 hJumpSound=Sound'XIIIsound.PNJ.PNJJump' 03198 hHitSound=Sound'XIIIsound.Impacts__ImpFlesh.ImpFlesh__hPlayImpFlesh' 03199 hLadderSound=Sound'XIIIsound.SpecActions__LadderClimb.LadderClimb__hXIIIClimbLadder' 03200 hCrouchSound=Sound'XIIIsound.XIIIPerso.XIIICrouch1' 03201 hUnCrouchSound=Sound'XIIIsound.XIIIPerso.XIIICrouch2' 03202 hSNDNotSound(0)=Sound'XIIIsound.PNJ.SNDNot00' 03203 hSNDNotSound(1)=Sound'XIIIsound.PNJ.SNDNot01' 03204 hSNDNotSound(2)=Sound'XIIIsound.PNJ.SNDNot02' 03205 hSNDNotSound(3)=Sound'XIIIsound.PNJ.SNDNot03' 03206 hSNDNotSound(4)=Sound'XIIIsound.PNJ.SNDNot04' 03207 hSNDNotSound(5)=Sound'XIIIsound.PNJ.SNDNot05' 03208 hSNDNotSound(6)=Sound'XIIIsound.PNJ.SNDNot06' 03209 hSNDNotSound(7)=Sound'XIIIsound.PNJ.SNDNot07' 03210 hSNDNotSound(8)=Sound'XIIIsound.PNJ.SNDNot08' 03211 hSNDNotSound(9)=Sound'XIIIsound.PNJ.SNDNot09' 03212 hSNDNotSound(10)=Sound'XIIIsound.PNJ.SNDNot10' 03213 hSNDNotSound(11)=Sound'XIIIsound.PNJ.SNDNot11' 03214 hSNDNotSound(12)=Sound'XIIIsound.PNJ.SNDNot12' 03215 hSNDNotSound(13)=Sound'XIIIsound.PNJ.SNDNot13' 03216 hSNDNotSound(14)=Sound'XIIIsound.PNJ.SNDNot14' 03217 hSwimmingSound=Sound'XIIIsound.XIIIPerso__XIIISwim.XIIISwim__hIsUnderWater' 03218 hNotifSwimSound=Sound'XIIIsound.PNJ__PNJSwim.PNJSwim__hPlongeur' 03219 hBubbleSound=Sound'XIIIsound.XIIIPerso__XIIISwim.XIIISwim__hBubbles' 03220 bRndAnimM16=True 03221 HeadShotFactor=3.000000 03222 bStasis=False 03223 bActorShadows=True 03224 CollisionHeight=75.000000 03225 Buoyancy=99.000000 03226 }

End Source Code