XIII
Class XIIIGameInfo

source: C:\XIII\XIII\Classes\XIIIGameInfo.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Info
         |
         +--Engine.GameInfo
            |
            +--XIII.XIIIGameInfo
Direct Known Subclasses:XIIIMPGameInfo

class XIIIGameInfo
extends Engine.GameInfo

//----------------------------------------------------------- // //-----------------------------------------------------------
Variables
 int CheckpointNumber
           Indicates the checkpoint number we last reached (0 = map start)
 MapInfo MapInfo
           Contain the MapInfo if it's there
 PlatForm PlateForme
           Current Game System running on
 PlayerName, PlayerClass
           Indicates the checkpoint number we last reached (0 = map start)
 int PlayerTeam
           Indicates the checkpoint number we last reached (0 = map start)
 name StartSpotEvent
           My be used by the mapinfo to know where we loaded the game (initialization of the map).
 EndGameTypes XIIIEndGameType
           Contain the MapInfo if it's there
 bool bRocketArena
           Contain the MapInfo if it's there
 sound hEndGameSound
           Contain the MapInfo if it's there

States
PendingEndGame

Function Summary
 void AddDefaultInventory(Pawn PlayerPawn)
     
//_____________________________________________________________________________
// Spawn any default inventory for the player.
 bool CheckEndGame(PlayerReplicationInfo Winner, string Reason)
     
//_____________________________________________________________________________
 void DiscardInventory(Pawn Other)
     
//_____________________________________________________________________________
// ELR drop inventory when dead
 void DropInventory(Pawn other)
     
//_____________________________________________________________________________
// ELR when corpse chunked up.
 void EndGame(PlayerReplicationInfo Winner, string Reason)
     
//_____________________________________________________________________________
// ELR GameEnded in solo mode = GameOver
 void PostBeginPlay()
     
//_____________________________________________________________________________
// ELR Check PF
 void ProcessServerTravel(string URL, bool bItems)
     
/* ProcessServerTravel()
 Optional handling of ServerTravel for network games.
*/
 void RestartPlayer(Controller aPlayer)
     
//_____________________________________________________________________________
 void SetLonePlayer()
     
//_____________________________________________________________________________
 bool ShouldRespawn(Pickup Other)
     
//_____________________________________________________________________________
// Return whether an item should respawn.


State PendingEndGame Function Summary
 void EndGame(PlayerReplicationInfo Winner, string Reason)



Source Code


00001	//-----------------------------------------------------------
00002	//
00003	//-----------------------------------------------------------
00004	class XIIIGameInfo extends GameInfo;
00005	
00006	enum PlatForm
00007	{
00008	  PF_PC,
00009	  PF_PS2,
00010	  PF_XBOX,
00011	  PF_GC,
00012	};
00013	var config PlatForm PlateForme;   // Current Game System running on
00014	var MapInfo MapInfo;              // Contain the MapInfo if it's there
00015	var bool bRocketArena;
00016	
00017	enum EndGameTypes
00018	{
00019	  EGT_MultiDeath,
00020	  EGT_SoloDeath,
00021	  EGT_AntiGoal,
00022	  EGT_Falling,
00023	  EGT_Success,
00024	};
00025	var EndGameTypes XIIIEndGameType;
00026	var sound hEndGameSound;
00027	
00028	var name StartSpotEvent;          // My be used by the mapinfo to know where we loaded the game (initialization of the map).
00029	var int CheckpointNumber;         // Indicates the checkpoint number we last reached (0 = map start)
00030	VAR string PlayerName, PlayerClass;
00031	VAR int PlayerTeam;
00032	
00033	//_____________________________________________________________________________
00034	// ELR Check PF
00035	function PostBeginPlay()
00036	{
00037	    log("###"@self@"PostBeginPlay");
00038	
00039	    Super.PostBeginPlay();
00040	}
00041	
00042	
00043	
00044	//_____________________________________________________________________________
00045	function SetLonePlayer()
00046	{
00047	    Level.bLonePlayer=true;
00048	}
00049	
00050	//_____________________________________________________________________________
00051	/* Initialize the game.
00052	 The GameInfo's InitGame() function is called before any other scripts (including
00053	 PreBeginPlay() ), and is used by the GameInfo to initialize parameters and spawn
00054	 its helper classes.
00055	 Warning: this is called before actors' PreBeginPlay.
00056	*/
00057	event InitGame( string Options, out string Error )
00058	{
00059	    SetLonePlayer();
00060	
00061	    PlayerName = ParseOption( Options, "Name" );
00062	    PlayerClass = ParseOption( Options, "Class" );
00063	    PlayerTeam = GetIntOption( Options, "Team", 0 );
00064	
00065	    log("### InitGame Options"@Options@"bLonePlayer="$Level.bLonePlayer);
00066	
00067	    Super.InitGame(Options, Error);
00068	    if (Level.bLonePlayer)
00069	    {
00070	      if ( GameRulesModifiers == None )
00071	        GameRulesModifiers = Spawn(class'XIIISoloGameRules');
00072	      else
00073	        GameRulesModifiers.AddGameRules(Spawn(class'XIIISoloGameRules'));
00074	    }
00075	/*
00076	    else
00077	    {
00078	      if ( GameRulesModifiers == None )
00079	        GameRulesModifiers = Spawn(class'XIIIMJGameRules');
00080	      else
00081	        GameRulesModifiers.AddGameRules(Spawn(class'XIIIMJGameRules'));
00082	    }
00083	*/
00084	}
00085	
00086	//_____________________________________________________________________________
00087	event PlayerController Login( string Portal, string Options, out string Error)
00088	{
00089	    local PlayerController PC;
00090	
00091	    log("### Login Portal"@Portal@"Options"@Options);
00092	    PC = Super.Login(Portal, Options, Error);
00093	    if ( Level.bLonePlayer )
00094	      RestartPlayer(PC); // Must do this because PC.Pawn must exist when exiting Login for loading games
00095	    return PC;
00096	}
00097	
00098	//_____________________________________________________________________________
00099	function RestartPlayer( Controller aPlayer )
00100	{
00101	    local NavigationPoint startSpot;
00102	    local bool foundStart;
00103	    local int TeamNum,i;
00104	    local class<Pawn> DefaultPlayerClass;
00105	    local XIIIPlayerPawn XPP;
00106	
00107	    log("### Restarting Player"@aPlayer);
00108	
00109	    if( bRestartLevel && Level.NetMode!=NM_DedicatedServer && Level.NetMode!=NM_ListenServer )
00110	    {
00111	      log("  # returning because bRestartLevel="$bRestartLevel@"and we are not a server");
00112	      return;
00113	    }
00114	
00115	    if ( (aPlayer.PlayerReplicationInfo == None) || (aPlayer.PlayerReplicationInfo.Team == None) )
00116	      TeamNum = 255;
00117	    else
00118	      TeamNum = aPlayer.PlayerReplicationInfo.Team.TeamIndex;
00119	
00120	    startSpot = FindPlayerStart(aPlayer, TeamNum);
00121	    if( startSpot == None )
00122	    {
00123	      log(" Player start not found!!!");
00124	      return;
00125	    }
00126	
00127	/*
00128	    if ( (aPlayer.PlayerReplicationInfo.Team != None)
00129	      && ((aPlayer.PawnClass == None) || !aPlayer.PlayerReplicationInfo.Team.BelongsOnTeam(aPlayer.PawnClass)) )
00130	           aPlayer.PawnClass = class<Pawn>(DynamicLoadObject(aPlayer.PlayerReplicationInfo.Team.DefaultPlayerClassName, class'Class'));
00131	
00132	*/
00133	    // In solo games default player class is always XIIIPlayerPawn
00134	    aPlayer.PawnClass = class<Pawn>(DynamicLoadObject(DefaultPlayerClassName, class'Class'));
00135	
00136	    if ( (aPlayer.Pawn==none) && (aPlayer.PawnClass != None) )
00137	      aPlayer.Pawn = Spawn(aPlayer.PawnClass,,,StartSpot.Location,StartSpot.Rotation);
00138	
00139	    log("  # Giving pawn"@aPlayer.Pawn);
00140	    if( aPlayer.Pawn==None )
00141	    {
00142	//      DefaultPlayerClass = class<Pawn>(DynamicLoadObject(GetDefaultPlayerClassName(aPlayer), class'Class'));
00143	      // In solo games default player class is always
00144	      DefaultPlayerClass = class<Pawn>(DynamicLoadObject(DefaultPlayerClassName, class'Class'));
00145	      aPlayer.Pawn = Spawn(DefaultPlayerClass,,,StartSpot.Location,StartSpot.Rotation);
00146	    }
00147	    if ( aPlayer.Pawn == None )
00148	    {
00149	      log("Couldn't spawn player of type "$aPlayer.PawnClass$" at "$StartSpot);
00150	      aPlayer.GotoState('Dead');
00151	      return;
00152	    }
00153	
00154	    aPlayer.Possess(aPlayer.Pawn);
00155	    aPlayer.PawnClass = aPlayer.Pawn.Class;
00156	
00157	    PlayTeleportEffect(aPlayer, true, true);
00158	    aPlayer.ClientSetRotation(aPlayer.Pawn.Rotation);
00159	/* Moved to AcceptInventory.
00160	    AddDefaultInventory(aPlayer.Pawn);
00161	*/
00162	//    if ( !bInventorySetUp && (aPlayer.Pawn!=none) )
00163	//      AcceptInventory(aPlayer.Pawn);
00164	    Log("  # TRIGGERING StartSpot.Event="$StartSpot.Event);
00165	    StartSpotEvent = StartSpot.Event;
00166	    TriggerEvent( StartSpot.Event, StartSpot, aPlayer.Pawn);
00167	}
00168	
00169	//_____________________________________________________________________________
00170	// got rid of duplicates item after changing map/loading there
00171	event AcceptInventory(pawn PlayerPawn)
00172	{
00173	    local XIIIThingsToSave S;
00174	    local XIIISaveGameTrigger T;
00175	    local XIIIPlayerPawn P;
00176	    local int i;
00177	    local inventory Inv, AmmoInv;
00178	    local mapinfo MI;
00179	
00180	    log("### Accepting Inventory for "$PlayerPawn);
00181	    if ( PlayerPawn.Weapon.bIsSlave )
00182	      PlayerPawn.Weapon = PlayerPawn.Weapon.SlaveOf;
00183	    Log("  # PlayerPawn.Weapon="$PlayerPawn.Weapon@"Slave ?"@PlayerPawn.Weapon.bIsSlave);
00184	
00185	    foreach allactors(class'MapInfo', MI)
00186	      break;
00187	
00188	    P = XIIIPlayerPawn(PlayerPawn);
00189	//    XIIICheatManager(PlayerController(PlayerPawn.Controller).CheatManager).LogInventory();
00190	
00191	    Log("  # Setting min health (health="$P.Health$") default="$P.default.health@"setting to "$Max(P.Default.Health * 0.25, P.Health));
00192	    P.Health = Max(P.Default.Health * 0.25 + 1, P.Health);
00193	    if (P!= none)
00194	    {
00195	      S = XIIIThingsToSave(P.FindInventoryType(class'XIIIThingsToSave'));
00196	
00197	      if (S!=none)
00198	      {
00199	        Log("  # found XIIIThingsToSave who have Tag "$S.XIIISaveGameTriggerTag);
00200	        // Get back the player's HP
00201	        P.Health = Max(P.Health, S.Health);
00202	        P.SpeedFactorLimit = S.SpeedFactorLimit;
00203	        CheckpointNumber = S.CheckpointNumber;
00204	        if (S.SoundToLaunch != none)
00205	        {
00206	            log("  # Launching music "$S.SoundToLaunch);
00207	            PlayMusic(S.SoundToLaunch);
00208	        }
00209	
00210	        // Get rid of the save trigger that were used to bring us back here
00211	        foreach allactors(class'XIIISaveGameTrigger', T, S.XIIISaveGameTriggerTag)
00212	          break;
00213	        if ( T != none )
00214	        {
00215	          T.CleanMap();
00216	          for ( i=0; i<S.ObjectivesState.Length ; i++ )
00217	          {
00218	            MI.Objectif[i].bCompleted = S.ObjectivesState[i].bCompleted;
00219	            MI.Objectif[i].bPrimary = S.ObjectivesState[i].bPrimary;
00220	            MI.Objectif[i].bAntiGoal = S.ObjectivesState[i].bAntiGoal;
00221	          }
00222	          log("  # Cleaning Map, updating Objectives & Destroying "$T$" because tag matches loaded game XIIISaveGameTriggerTag");
00223	          T.Destroy();
00224	        }
00225	        else
00226	        {
00227	          log("  # had not found any XIIISaveGameTrigger w/ correct tag");
00228	        }
00229	        S.Destroy();
00230	      }
00231	      else
00232	        Log("  # Cannot find XIIIThingsToSave");
00233	    }
00234	
00235	    //default accept all inventory except default weapon (spawned explicitly)
00236	    AddDefaultInventory(PlayerPawn);
00237	    bInventorySetUp = true;
00238	    log("### bInventorySetUp"@bInventorySetUp);
00239	
00240	    // Here we must make sure ammo is after weapon in inventory list.
00241	    Log("  # Checking Dual Weapons...");
00242	    Inv = PlayerPawn.Inventory;
00243	    while ( Inv != none )
00244	    {
00245	      if ( XIIIWeapon(Inv) != none )
00246	      { // Found weapon, must find ammo linked and reinsert it after else save/loading pb will happen
00247	        if ( XIIIWeapon(Inv).bIsSlave )
00248	        { // Slave has been setup by giveto because bInventorySetUp was false, now check if we really have skill
00249	          if ( PlayerPawn.CanHoldDualWeapons() )
00250	          { // have skill, just put the dual weapon in place
00251	            PlayerPawn.InsertInventory(XIIIWeapon(Inv), XIIIWeapon(Inv).SlaveOf);
00252	          }
00253	          else
00254	          { // have two weapons but notallowed to handle them, remove dual
00255	            XIIIWeapon(Inv).SlaveOf.MySlave = none;
00256	            XIIIWeapon(Inv).SlaveOf.bHaveSlave = false;
00257	            XIIIWeapon(Inv).SlaveOf.bEnableSlave = false;
00258	            Inv.Destroy();
00259	          }
00260	        }
00261	        AmmoInv = XIIIWeapon(Inv).AmmoType;
00262	        Log("  # BEF AmmoInv="$AmmoInv@"("$Ammunition(AmmoInv).AmmoAmount$")");
00263	        PlayerPawn.DeleteInventory(AmmoInv);
00264	        AmmoInv.GiveTo(PlayerPawn);
00265	        XIIIWeapon(Inv).AmmoType = Ammunition(AmmoInv);
00266	        Log("  # AFT AmmoInv="$AmmoInv@"("$Ammunition(AmmoInv).AmmoAmount$")");
00267	      }
00268	      Inv=Inv.Inventory;
00269	    }
00270	
00271	    Log("  # PlayerPawn.Weapon="$PlayerPawn.Weapon@"Slave ?"@PlayerPawn.Weapon.bIsSlave);
00272	    if ( PlayerPawn.Weapon != none )
00273	    {
00274	      if ( PlayerPawn.Weapon.bIsSlave )
00275	      {
00276	        if ( PlayerPawn.Weapon.Silencer != none )
00277	          PlayerPawn.Weapon.Silencer.Destroy();
00278	        PlayerPawn.Weapon.PutDown();
00279	        PlayerPawn.Weapon = PlayerPawn.Weapon.SlaveOf;
00280	      }
00281	      PlayerPawn.Weapon.BringUp();
00282	    }
00283	
00284	    // Reset/Give the player his left hand
00285	    XIIIPlayerPawn(PlayerPawn).LHand = XIIILeftHand(PlayerPawn.FindInventoryType(class'XIIILeftHand'));
00286	    if ( XIIIPlayerPawn(PlayerPawn).LHand == none )
00287	    {
00288	      XIIIPlayerPawn(PlayerPawn).LHand = Spawn(class'XIIILeftHand',PlayerPawn);
00289	      XIIIPlayerPawn(PlayerPawn).LHand.GiveTo(PlayerPawn);
00290	      XIIIPlayerPawn(PlayerPawn).LHand.Instigator=PlayerPawn;
00291	    }
00292	}
00293	
00294	//_____________________________________________________________________________
00295	// Spawn any default inventory for the player.
00296	function AddDefaultInventory( pawn PlayerPawn )
00297	{
00298	    local Weapon newWeapon;
00299	    local class<Weapon> WeapClass;
00300	
00301	    //log("### AddDefaultInventory call for"@PlayerPawn);
00302	    // Spawn default weapon.
00303	    WeapClass = BaseMutator.GetDefaultWeapon();
00304	    //log("  # WeapClass"@WeapClass);
00305	    newWeapon = Weapon(PlayerPawn.FindInventoryType(WeapClass));
00306	    if ( NewWeapon != none )
00307	    {
00308	      NewWeapon.Destroy();
00309	      NewWeapon = none;
00310	    }
00311	    if( (WeapClass!=None) && (newWeapon == None) )
00312	    {
00313	      newWeapon = Spawn(WeapClass,,,PlayerPawn.Location);
00314	      //log("  # newWeapon"@newWeapon);
00315	      if( newWeapon != None )
00316	      {
00317	        newWeapon.GiveTo(PlayerPawn);
00318	        newWeapon.BringUp();
00319	        newWeapon.bCanThrow = false; // don't allow default weapon to be thrown out
00320	      }
00321	    }
00322	    SetPlayerDefaults(PlayerPawn);
00323	}
00324	
00325	//_____________________________________________________________________________
00326	// ELR drop inventory when dead
00327	function DiscardInventory( Pawn Other )
00328	{
00329	// Do nothing, corpse searching
00330	    local actor dropped;
00331	    local inventory Inv;
00332	    local float speed;
00333	    local rotator tRot;
00334	
00335	    for( Inv=Other.Inventory; Inv!=None; Inv=Inv.Inventory )
00336	    {
00337	      if ( (Fists(Inv)!=none) || (FistsAmmo(Inv)!=none) || (XIIILeftHand(Inv)!=none) )
00338	        Inv.Destroy();
00339	
00340	      if( inv.IsA('MarioSuperBonus') )
00341	          inv.Destroy();
00342	    }
00343	}
00344	
00345	//_____________________________________________________________________________
00346	// ELR when corpse chunked up.
00347	function DropInventory( Pawn other )
00348	{
00349	    Super.DiscardInventory(other);
00350	}
00351	
00352	//_____________________________________________________________________________
00353	function bool CheckEndGame(PlayerReplicationInfo Winner, string Reason)
00354	{
00355	//    local Controller P;
00356	
00357	    if ( (GameRulesModifiers != None) && !GameRulesModifiers.CheckEndGame(Winner, Reason) )
00358	      return false;
00359	
00360	    // all player cameras focus on winner or final scene (picked by gamerules)
00361	    // ELR Get rid of this, do it after GameEndedMode is set.
00362	/*    for ( P=Level.ControllerList; P!=None; P=P.NextController )
00363	    {
00364	      P.ClientGameEnded();
00365	      P.GotoState('GameEnded');
00366	    } */
00367	    return true;
00368	}
00369	
00370	//_____________________________________________________________________________
00371	// ELR GameEnded in solo mode = GameOver
00372	function EndGame( PlayerReplicationInfo Winner, string Reason )
00373	{
00374	    local Controller P;
00375	    local int N;
00376	    local string GameOver;
00377	    local XIIIPlayerController XPC;
00378	
00379	    N = InStr(Reason, ":");
00380	    if (N != -1)
00381	    {
00382	      GameOver = Mid(Reason,N+1);
00383	      Reason = Left(Reason,N);
00384	    }
00385	
00386	    if (GameOver == "")
00387	    {
00388	      GameOver = class'XIII.XIIIEndGameMessage'.default.GoalInCompleteMsg;
00389	    }
00390	
00391	    // don't end game if not really ready
00392	    if ( !CheckEndGame(Winner, Reason) )
00393	    {
00394	      bOverTime = true;
00395	      return;
00396	    }
00397	
00398	    if (XIIIGameInfo(Level.Game).MapInfo != none)
00399	      XPC = XIIIGameInfo(Level.Game).MapInfo.XIIIController;
00400	
00401	    bGameEnded = true;
00402	    TriggerEvent('EndGame', self, None);
00403	    if ( Reason=="PlayerKilled" )
00404	    {
00405	      if ( XPC != none )
00406	        XPC.MyHUD.LocalizedMessage( class'XIIIEndGameMessage', 1, XPC.PlayerReplicationInfo );
00407	//      Level.Game.BroadCastLocalizedMessage(class'XIIIEndGameMessage', 1, winner);
00408	      if ( Level.bLonePlayer )
00409	        XIIIEndGameType = EGT_SoloDeath;
00410	      else
00411	        XIIIEndGameType = EGT_MultiDeath;
00412	    }
00413	    else if ( Reason=="PlayerFalling" )
00414	    {
00415	      if ( XPC != none )
00416	        XPC.MyHUD.LocalizedMessage( class'XIIIEndGameMessage', 4, XPC.PlayerReplicationInfo);
00417	//      Level.Game.BroadCastLocalizedMessage(class'XIIIEndGameMessage', 4, winner);
00418	      XIIIEndGameType = EGT_Falling;
00419	    }
00420	    else if ( Reason=="GoalIncomplete" )
00421	    {
00422	      if ( XPC != none )
00423	        XPC.MyHUD.LocalizedMessage( class'XIIIEndGameMessage', 3, XPC.PlayerReplicationInfo, none, self, GameOver );
00424	      XIIIEndGameType = EGT_AntiGoal;
00425	    }
00426	    else if ( Reason=="GoalComplete" )
00427	    {
00428	      if ( XPC != none )
00429	        XPC.MyHUD.LocalizedMessage( class'XIIIMissionCompletedMessage', 0, XPC.PlayerReplicationInfo, none, self, MapInfo.MessageMissionSuccess ); //
00430	//      XPC.MyHUD.LocalizedMessage(class'XIIIMissionCompletedMessage', 2, winner);
00431	      XIIIEndGameType = EGT_Success;
00432	    }
00433	
00434	
00435	    if ( Reason=="GoalIncomplete" )
00436	    { // wait 2 seconds before locking game
00437	      gotoState('PendingEndGame');
00438	      return;
00439	    }
00440	
00441	    // do this now instead of in CheckEndGame to have XIIIEndGameType initialized.
00442	    for ( P=Level.ControllerList; P!=None; P=P.NextController )
00443	    {
00444	      P.ClientGameEnded();
00445	      P.GotoState('GameEnded');
00446	//    Log("PlayingSound hEndGameSound="$hEndGameSound$" w/ XIIIEndGameType="$XIIIEndGameType);
00447	      if ( P.Pawn.IsPlayerPawn() )
00448	        P.Pawn.PlaySound(hEndGameSound, int(XIIIEndGameType));
00449	    }
00450	    EndLogging(Reason);
00451	//    Log("Game Ended w/ XIIIEndGameType="$XIIIEndGameType);
00452	}
00453	
00454	
00455	//_____________________________________________________________________________
00456	/* ProcessServerTravel()
00457	 Optional handling of ServerTravel for network games.
00458	*/
00459	function ProcessServerTravel( string URL, bool bItems )
00460	{
00461	    local playercontroller P, LocalPlayer;
00462	    local inventory Obj;
00463	
00464	    if (StatLog != None)
00465	    {
00466	      StatLog.LogGameEnd("mapchange");
00467	      StatLog.StopLog();
00468	      StatLog.Destroy();
00469	      StatLog = None;
00470	    }
00471	
00472	    // Notify clients we're switching level and give them time to receive.
00473	    // We call PreClientTravel directly on any local PlayerPawns (ie listen server)
00474	    log("ProcessServerTravel:"@URL);
00475	    foreach DynamicActors( class'PlayerController', P )
00476	      if( NetConnection( P.Player)!=None )
00477	        P.ClientTravel( URL, TRAVEL_Relative, bItems );
00478	      else
00479	      {
00480	        LocalPlayer = P;
00481	        P.PreClientTravel();
00482	      }
00483	
00484	    if ( (Level.NetMode == NM_ListenServer) && (LocalPlayer != None) )
00485	      Level.NextURL = Level.NextURL$"?Skin="$LocalPlayer.GetDefaultURL("Skin")
00486	        $"?Face="$LocalPlayer.GetDefaultURL("Face")
00487	        $"?Team="$LocalPlayer.GetDefaultURL("Team")
00488	        $"?Name="$LocalPlayer.GetDefaultURL("Name")
00489	        $"?Class="$LocalPlayer.GetDefaultURL("Class");
00490	
00491	    // First reset inventory to what is allowed when exiting the map
00492	    // Just keep Skills and docs.
00493	    if ( (MapInfo != none) && !MapInfo.NextMapKeepInventory )
00494	    {
00495	      Log(" > Don't keep inventory for next map");
00496	      foreach allactors(class'inventory', Obj)
00497	      {
00498	        if ( (Obj != none) && (Obj.Owner == LocalPlayer.Pawn) )
00499	        if ( (Weapon(Obj)!=none) || (Armor(Obj)!=none) || (Ammunition(Obj)!=none) || (XIIIItems(Obj)!=none) )
00500	          Obj.Destroy();
00501	      }
00502	      LocalPlayer.Pawn.Health = LocalPlayer.Pawn.default.Health;
00503	    }
00504	
00505	//    if( Level.bLonePlayer )
00506	//      Level.NextSwitchCountdown = 6.0;
00507	//    else if( Level.NetMode!=NM_DedicatedServer && Level.NetMode!=NM_ListenServer )
00508	      Level.NextSwitchCountdown = 0.0;
00509	}
00510	
00511	//_____________________________________________________________________________
00512	// Return whether an item should respawn.
00513	function bool ShouldRespawn( Pickup Other )
00514	{
00515	    if( Level.bLonePlayer )
00516	      return false;
00517	
00518	    if( Other.MyMarker == none )
00519	        return false;
00520	
00521	    return Other.ReSpawnTime!=0.0;
00522	}
00523	
00524	//_____________________________________________________________________________
00525	// ELR In solo should just send a single message.
00526	function BroadcastDeathMessage(Controller Killer, Controller Other, class<DamageType> damageType)
00527	{
00528	    local string S;
00529	
00530	    S = ParseKillMessage(XIIIPawn(Killer.Pawn).PawnName, "XIII", class<XIIIDamageType>(DamageType).Static.SoloDeathMessage(Killer, Other));
00531	    Playercontroller(Other).ClientMessage(S, 'Death');
00532	}
00533	
00534	//_____________________________________________________________________________
00535	function int ReduceDamage( int Damage, pawn injured, pawn instigatedBy, vector HitLocation, vector Momentum, class<DamageType> DamageType )
00536	{
00537	    local int OriginalDamage;
00538	    local Inventory I;
00539	    local int ArmorDamage;
00540	
00541	    OriginalDamage = Damage;
00542	
00543	    if ( (XIIIPawn(Injured).LHand != none) && XIIIPawn(Injured).LHand.bActive && !XIIIPawn(Injured).LHand.pOnShoulder.bIsDead && (XIIIPawn(Injured).GetDamageSide(HitLocation) < 4) && DamageType.default.bArmorStops)
00544	      Damage *= 0.5; // Having an ostage reduce front damage by half.
00545	
00546	    if( injured.PhysicsVolume.bNeutralZone )
00547	      Damage = 0;
00548	    else if ( injured.InGodMode() ) // God mode
00549	      Damage = 0;
00550	    else if ( (injured.Inventory != None) && (damage > 0) && DamageType.default.bArmorStops ) //then check if carrying armor
00551	    {
00552	      if ( Injured.Vest != none )
00553	        Damage = Injured.Vest.ArmorAbsorbDamage(Damage, DamageType, HitLocation);
00554	      if ( Injured.Helm != none )
00555	        Damage = Injured.Helm.ArmorAbsorbDamage(Damage, DamageType, HitLocation);
00556	    }
00557	
00558	    if ( GameRulesModifiers != None )
00559	      return GameRulesModifiers.NetDamage( OriginalDamage, Damage,injured,instigatedBy,HitLocation,Momentum,DamageType );
00560	
00561	    return Damage;
00562	}
00563	
00564	//_____________________________________________________________________________
00565	state PendingEndGame
00566	{
00567	    Event BeginState()
00568	    {
00569	      SetTimer(2.0, false);
00570	    }
00571	    Event Timer()
00572	    {
00573	      local Controller P;
00574	
00575	      // do this now instead of in CheckEndGame to have XIIIEndGameType initialized.
00576	      for ( P=Level.ControllerList; P!=None; P=P.NextController )
00577	      {
00578	        P.ClientGameEnded();
00579	        P.GotoState('GameEnded');
00580	        if ( P.Pawn.IsPlayerPawn() )
00581	          P.Pawn.PlaySound(hEndGameSound, int(XIIIEndGameType));
00582	      }
00583	      EndLogging("GoalIncomplete");
00584	      gotostate('');
00585	    }
00586	    function EndGame( PlayerReplicationInfo Winner, string Reason )
00587	    {
00588	      return;
00589	    }
00590	}
00591	
00592	
00593	
00594	defaultproperties
00595	{
00596	     hEndGameSound=Sound'XIIIsound.Interface__EndMap.EndMap__hEndMap'
00597	     bRestartLevel=False
00598	     DefaultPlayerClassName="XIII.XIIIPlayerPawn"
00599	     HUDType="XIII.XIIIBaseHUD"
00600	     GameName="Solo Game"
00601	     MutatorClass="XIII.XIIISoloMutator"
00602	     PlayerControllerClassName="XIII.XIIIPlayerController"
00603	}

End Source Code