XIII
Class XIIIItems

source: C:\XIII\XIII\Classes\XIIIItems.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Inventory
         |
         +--Engine.Powerups
            |
            +--XIII.XIIIItems
Direct Known Subclasses:Chronometre, EventItem, Hook, Keys, Med, Photo, Silencer, Micro

class XIIIItems
extends Engine.Powerups

//----------------------------------------------------------- // //-----------------------------------------------------------
Variables
 Texture CrossHair
           Crosshair when using item
 float DisplayFOV
           FOV for drawing the items
 name EventCausedOnPick
           Crosshair when using item
 int IconNumber
           to display using the global texture instead of singular icons
 string MeshName
           to allow dynamic load of mesh (optimize memory)
 Texture ZCrosshair
           texture to use for Zoomed Crosshair
 Texture ZCrosshairDot
           texture to use for Zoomed Crosshair (the dot)
 bool bChangeItem
           To switch items/weapons
 bool bDrawZoomedCrosshair
           To switch items/weapons
 bool bNumberedItem
           to display number of charges in HUD
 bool bRendered
           to avoid fps item rendered before renderoverlays w/ right position
 enum eItemHand
           Crosshair when using item
 sound hDownItemSound
           Crosshair when using item
 sound hSelectItemSound
           Crosshair when using item
 string sItemName
           to display using the global texture instead of singular icons

States
for, InUse, for, Idle, DownItem, for, Activated

Function Summary
 
simulated
Activate()
     
//_____________________________________________________________________________
// Toggle Activation of selected Item.
 
simulated
AttachToPawn(Pawn P)
     
//_____________________________________________________________________________
 
simulated
BringUp()
     
//_____________________________________________________________________________
 
simulated
DisplayDebug(Canvas C, out float, out float)
     
//_____________________________________________________________________________
// ELR Add some info to the ShowDebug Exec
 
simulated
DrawZoomedCrosshair(Canvas C)
     
//_____________________________________________________________________________
 
simulated
EndUse()
     
//_____________________________________________________________________________
// ELR called in Beginstate of Downweapon
 void GiveTo(Pawn Other)
     
//_____________________________________________________________________________
// Give this inventory item to a pawn.
 void Landed(Vector HitNormal)
     
//_____________________________________________________________________________
 Powerups NextItem(Powerups CurrentChoice, Powerups CurrentItem)
     
//_____________________________________________________________________________
// Find the next Item (using the Inventory group)
 void PickupFunction(Pawn Other)
     
//_____________________________________________________________________________
// ELR
 Powerups PrevItem(Powerups CurrentChoice, Powerups CurrentItem)
     
//_____________________________________________________________________________
// Find the next Item (using the Inventory group)
 bool PutDown()
     
//_____________________________________________________________________________
 Powerups SelectNext()
     
//_____________________________________________________________________________
// Select first activatable powerup.
 bool ShouldDrawCrosshair(Canvas C)
     
//_____________________________________________________________________________
 void StaticParseDynamicLoading(LevelInfo MyLI)
     
//_____________________________________________________________________________
 void Transfer(Pawn Other)
     
//_____________________________________________________________________________
// Transfer this inventory to Player (for SearchCorpse)
 
simulated
UseMe()
     
//_____________________________________________________________________________
// ELR when in state activated & using
 
simulated
UsedUp()
     
//_____________________________________________________________________________
// This is called when a usable inventory item has used up it's charge.


State for Function Summary


State InUse Function Summary


State for Function Summary
 bool PutDown()


State Idle Function Summary


State DownItem Function Summary


State for Function Summary


State Activated Function Summary



Source Code


00001	//-----------------------------------------------------------
00002	//
00003	//-----------------------------------------------------------
00004	class XIIIItems extends Powerups;
00005	
00006	// Inventory Groups :
00007	// 0 = Medkit
00008	// 1 = FulMedKit
00009	// 2 = spec medkits (plage/beach)
00010	// 3 = Lockpick
00011	// 4 | 7 = Keys
00012	// 5 = Hook
00013	// 6 = Photo
00014	// 8 = Micro
00015	// 10-11 = Event Items
00016	
00017	var string MeshName;      // to allow dynamic load of mesh (optimize memory)
00018	var float DisplayFOV;     // FOV for drawing the items
00019	var texture CrossHair;    // Crosshair when using item
00020	var enum eItemHand
00021	{
00022	  IH_1H,
00023	  IH_2H,
00024	} IHand;
00025	
00026	var() sound hSelectItemSound;
00027	var() sound hDownItemSound;
00028	var() name EventCausedOnPick;
00029	
00030	var texture ZCrosshair;             // texture to use for Zoomed Crosshair
00031	var texture ZCrosshairDot;          // texture to use for Zoomed Crosshair (the dot)
00032	var bool bChangeItem;               // To switch items/weapons
00033	var bool bDrawZoomedCrosshair;
00034	var bool bNumberedItem;             // to display number of charges in HUD
00035	var bool bRendered;                 // to avoid fps item rendered before renderoverlays w/ right position
00036	
00037	var int IconNumber;       // to display using the global texture instead of singular icons
00038	var travel localized string sItemName;
00039	
00040	//_____________________________________________________________________________
00041	Static function StaticParseDynamicLoading(LevelInfo MyLI)
00042	{
00043	    Log("XIIIItems StaticParseDynamicLoading class="$default.class);
00044	    Super.StaticParseDynamicLoading(MyLI);
00045	    MyLI.ForcedMeshes[MyLI.ForcedMeshes.Length] =
00046	      Mesh(DynamicLoadObject(default.MeshName, class'mesh'));
00047	}
00048	
00049	//_____________________________________________________________________________
00050	simulated event PostBeginPlay()
00051	{
00052	    // Dynamic load mesh
00053	    if ( (Mesh == none) && (MeshName != "") )
00054	    {
00055	      Mesh = SkeletalMesh(DynamicLoadObject(MeshName, class'mesh'));
00056	      default.mesh = mesh;
00057	    }
00058	    // Dynamic load Attachment Static Mesh if exists
00059	    if ( (AttachmentClass != none) && (class<XIIIWeaponAttachment>(AttachmentClass) != none) && (class<XIIIWeaponAttachment>(AttachmentClass).default.StaticMeshName != "") )
00060	    {
00061	      DynamicLoadObject(class<XIIIWeaponAttachment>(AttachmentClass).default.StaticMeshName, class'StaticMesh');
00062	    }
00063	    Super.PostBeginPlay();
00064	    bRendered = false;
00065	    bHidden = true;
00066	    RefreshDisplaying();
00067	    if ( sItemName != "" )
00068	      ItemName = sItemName;
00069	}
00070	
00071	//_____________________________________________________________________________
00072	// ELR Add displayfov and bWeaponMode
00073	simulated event RenderOverlays( canvas Canvas )
00074	{
00075	//    DebugLog(Level.TimeSeconds@self$" RenderOverlays bDrawZoomedCrosshair="$bDrawZoomedCrosshair);
00076	
00077	    if ( bRendered && bHidden )
00078	    {
00079	      bHidden = false;
00080	      RefreshDisplaying();
00081	    }
00082	
00083	    if ( !XIIIPlayerController(Pawn(Owner).Controller).bWeaponMode || !XIIIPlayerController(Pawn(Owner).Controller).bWaitForWeaponMode )
00084	    {
00085	//      Log(self@"RenderOverlays Instigator="$Instigator@"Instigator.Controller="$Instigator.Controller);
00086	//      if ( (Instigator == None) || (Instigator.Controller == None))
00087	//        return;
00088	      if ( bDrawZoomedCrosshair )
00089	      {
00090	        DrawZoomedCrosshair(Canvas);
00091	      }
00092	      else
00093	      {
00094	        SetLocation( Instigator.Location + Instigator.CalcDrawOffset(self) );
00095	        SetRotation( Instigator.GetViewRotation() );
00096	//        Canvas.DrawActor(self, false, true, displayFOV);
00097	        SetBase(Pawn(Owner).Controller);
00098	      }
00099	//      DrawCrossHair(Canvas);
00100	    }
00101	}
00102	
00103	//_____________________________________________________________________________
00104	simulated function bool ShouldDrawCrosshair(Canvas C)
00105	{
00106	    return true;
00107	}
00108	
00109	//_____________________________________________________________________________
00110	simulated function DrawZoomedCrosshair(Canvas C)
00111	{
00112	    local float XSize, YSize;
00113	    local float fDrawScale;
00114	
00115	    fDrawScale = XIIIBaseHud(XIIIPlayerController(Pawn(Owner).Controller).MyHud).fDrawScale;
00116	
00117	    XSize = ZCrossHair.USize*fDrawScale;
00118	
00119	    C.SetDrawColor(255,255,255,255);
00120	    C.SetPos(0.50 * C.ClipX-0.5 - XSize, 0.50 * C.ClipY-0.5 - XSize);
00121	    C.DrawTile(ZCrossHair, XSize, XSize, 0, 0,-ZCrossHair.USize, ZCrossHair.VSize);
00122	//    C.SetPos(0.50 * C.ClipX-0.5, 0.50 * C.ClipY-0.5 - XSize);
00123	    C.DrawTile(ZCrossHair, XSize, XSize, 0, 0,ZCrossHair.USize, ZCrossHair.VSize);
00124	    C.SetPos(0.50 * C.ClipX-0.5 - XSize, 0.50 * C.ClipY-0.5);
00125	    C.DrawTile(ZCrossHair, XSize, XSize, 0, 0,-ZCrossHair.USize, -ZCrossHair.VSize);
00126	//    C.SetPos(0.50 * C.ClipX-0.5, 0.50 * C.ClipY-0.5);
00127	    C.DrawTile(ZCrossHair, XSize, XSize, 0, 0,ZCrossHair.USize, -ZCrossHair.VSize);
00128	//    C.SetPos(0.50 * C.ClipX - XSize, 0.50 * C.ClipY);
00129	//    C.DrawIcon(ZCrossHairReflet, fDrawScale);
00130	
00131	    C.SetDrawColor(255,0,0,255);
00132	    C.Style = ERenderStyle.STY_Alpha;
00133	    C.SetPos(0.50 * C.ClipX - ZCrosshairDot.USize/2.0, 0.50 * C.ClipY - ZCrosshairDot.VSize/2.0);
00134	    C.DrawIcon(ZCrosshairDot, 1.0);
00135	    C.SetDrawColor(255,255,255,255);
00136	    C.Style = ERenderStyle.STY_Alpha;
00137	    YSize=0.5*C.ClipY - XSize;
00138	    XSize=0.5*C.ClipX - XSize;
00139	    // Left Part
00140	    C.SetPos(0, 0);
00141	    C.DrawTile(ZCrossHair, XSize-0.5, C.ClipY, 230, 2, 16, 16);
00142	    // Up part
00143	    C.SetPos(XSize-0.5, 0);
00144	    C.DrawTile(ZCrossHair, C.ClipX - XSize*2.0, YSize-0.5, 230, 2, 16, 16);
00145	    // Right Part
00146	    C.SetPos(C.ClipX - XSize-0.5, 0);
00147	    C.DrawTile(ZCrossHair, XSize+0.5, C.ClipY, 230, 2, 16, 16);
00148	    //Down Part
00149	    C.SetPos(XSize-0.5, C.ClipY - YSize-0.5);
00150	    C.DrawTile(ZCrossHair, C.CLipX - XSize*2.0, YSize+0.5, 230, 2, 16, 16);
00151	
00152	    bDrawZoomedCrosshair = false;
00153	}
00154	
00155	//_____________________________________________________________________________
00156	// ELR Add some info to the ShowDebug Exec
00157	simulated function DisplayDebug(Canvas C, out float YL, out float YPos)
00158	{
00159	    local string S;
00160	    local name anim;
00161	    local float frame,rate;
00162	
00163	    C.DrawText("SELECTED ITEM="$self@"Event="$Event@"TAG="$Tag);
00164	    YPos += YL;
00165	    C.SetPos(4,YPos);
00166	//    C.DrawText("     in state="$getStateName());
00167	    C.DrawText("     STATE: "$GetStateName()$" Timer: "$TimerCounter@"bChangeItem: "$bChangeItem, false);
00168	    YPos += YL;
00169	    C.SetPos(4,YPos);
00170	    GetAnimParams(0,Anim,frame,rate);
00171	    S = "     AnimSequence "$Anim$" Frame "$frame$" Rate "$rate;
00172	    C.DrawText(S);
00173	    YPos += YL;
00174	    C.SetPos(4,YPos);
00175	}
00176	
00177	//_____________________________________________________________________________
00178	simulated function AttachToPawn(Pawn P)
00179	{
00180	    local name BoneName;
00181	
00182	    if ( ThirdPersonActor == None )
00183	    {
00184	      ThirdPersonActor = Spawn(AttachmentClass,Owner);
00185	      InventoryAttachment(ThirdPersonActor).InitFor(self);
00186	    }
00187	    BoneName = XIIIPawn(P).GetItemBoneFor(self);
00188	    if ( BoneName == '' )
00189	    {
00190	      ThirdPersonActor.SetLocation(P.Location);
00191	      ThirdPersonActor.SetBase(P);
00192	    }
00193	    else
00194	      P.AttachToBone(ThirdPersonActor,BoneName);
00195	
00196	    ThirdPersonActor.SetRelativeLocation(ThirdPersonRelativeLocation);
00197	    ThirdPersonActor.SetRelativeRotation(ThirdPersonRelativeRotation);
00198	}
00199	
00200	//_____________________________________________________________________________
00201	// Find the next Item (using the Inventory group)
00202	simulated function PowerUps PrevItem(PowerUps CurrentChoice, PowerUps CurrentItem)
00203	{
00204	    local bool bAllow2H;
00205	
00206	    DebugLog(self@"PrevItem, Inventory="$Inventory@"CurrentChoice="$CurrentChoice);
00207	
00208	    if ( (XIIIPawn(Owner).LHand != none) && XIIIPawn(Owner).LHand.bActive )
00209	      bAllow2H = false;
00210	    else
00211	      bAllow2H = true;
00212	
00213	    if ( bDisplayableInv && bActivatable && ((IHand != IH_2H) || bAllow2H) )
00214	    {
00215	      if ( (CurrentChoice == None) )
00216	      {
00217	        if ( CurrentItem == none )
00218	        {
00219	          CurrentItem = self;
00220	          CurrentChoice = self;
00221	        }
00222	        else if ( CurrentItem != self )
00223	          CurrentChoice = self;
00224	      }
00225	      else if ( InventoryGroup == CurrentChoice.InventoryGroup )
00226	      {
00227	        if ( InventoryGroup == CurrentItem.InventoryGroup )
00228	        {
00229	          if ( (GroupOffset < CurrentItem.GroupOffset)
00230	            && (GroupOffset > CurrentChoice.GroupOffset) )
00231	            CurrentChoice = self;
00232	        }
00233	        else if ( GroupOffset > CurrentChoice.GroupOffset )
00234	          CurrentChoice = self;
00235	      }
00236	      else if ( InventoryGroup > CurrentChoice.InventoryGroup )
00237	      {
00238	        if ( (InventoryGroup < CurrentItem.InventoryGroup)
00239	          || (CurrentChoice.InventoryGroup > CurrentItem.InventoryGroup) )
00240	        CurrentChoice = self;
00241	      }
00242	      else if ( (CurrentChoice.InventoryGroup > CurrentItem.InventoryGroup)
00243	        && (InventoryGroup < CurrentItem.InventoryGroup) )
00244	        CurrentChoice = self;
00245	    }
00246	    if ( Inventory == None )
00247	      return CurrentChoice;
00248	    else
00249	      return Inventory.PrevItem(CurrentChoice,CurrentItem);
00250	}
00251	
00252	//_____________________________________________________________________________
00253	// Find the next Item (using the Inventory group)
00254	simulated function PowerUps NextItem(PowerUps CurrentChoice, PowerUps CurrentItem)
00255	{
00256	    local bool bAllow2H;
00257	
00258	    DebugLog(self@"NextItem, Inventory="$Inventory@"CurrentChoice="$CurrentChoice);
00259	    if ( (XIIIPawn(Owner).LHand != none) && XIIIPawn(Owner).LHand.bActive )
00260	      bAllow2H = false;
00261	    else
00262	      bAllow2H = true;
00263	
00264	    if ( bDisplayableInv && bActivatable && ((IHand != IH_2H) || bAllow2H) )
00265	    {
00266	      if ( (CurrentChoice == None) )
00267	      {
00268	        if ( CurrentItem == none )
00269	        {
00270	          CurrentItem = self;
00271	          CurrentChoice = self;
00272	        }
00273	        else if ( CurrentItem != self )
00274	          CurrentChoice = self;
00275	      }
00276	      else if ( InventoryGroup == CurrentChoice.InventoryGroup )
00277	      {
00278	        if ( InventoryGroup == CurrentItem.InventoryGroup )
00279	        {
00280	          if ( (GroupOffset > CurrentItem.GroupOffset)
00281	            && (GroupOffset < CurrentChoice.GroupOffset) )
00282	            CurrentChoice = self;
00283	        }
00284	        else if ( GroupOffset < CurrentChoice.GroupOffset )
00285	          CurrentChoice = self;
00286	      }
00287	      else if ( InventoryGroup < CurrentChoice.InventoryGroup )
00288	      {
00289	        if ( (InventoryGroup > CurrentItem.InventoryGroup)
00290	          || (CurrentChoice.InventoryGroup < CurrentItem.InventoryGroup) )
00291	        CurrentChoice = self;
00292	      }
00293	      else if ( (CurrentChoice.InventoryGroup < CurrentItem.InventoryGroup)
00294	        && (InventoryGroup > CurrentItem.InventoryGroup) )
00295	        CurrentChoice = self;
00296	    }
00297	    if ( Inventory == None )
00298	      return CurrentChoice;
00299	    else
00300	      return Inventory.NextItem(CurrentChoice,CurrentItem);
00301	}
00302	
00303	/*
00304	//_____________________________________________________________________________
00305	// Select first activatable powerup.
00306	function Powerups SelectNext()
00307	{
00308	    local inventory I;
00309	    local int CurrentItemIndex , ItemNumber ;
00310	    local PowerUps NextItem;
00311	    local XIIIItems XI;
00312	    local XIIIItems CurrentXItem, TempItem;
00313	    local bool FirstTime, FirstMed;
00314	    local bool bAllow2H;
00315	
00316	    ItemNumber = 0;
00317	    I = Pawn(Owner).Inventory;
00318	    NextItem = none;
00319	
00320	    CurrentXItem = XIIIItems(Pawn(Owner).SelectedItem);
00321	    if ( (XIIIPawn(Owner).LHand != none) && XIIIPawn(Owner).LHand.bActive )
00322	      bAllow2H = false;
00323	    else
00324	      bAllow2H = true;
00325	
00326	//    log(" ");
00327	//    Log("----------------------------------------------");
00328	//    Log("SelectedItem="@CurrentXItem);
00329	//    Log("PendingItem="@Pawn(Owner).PendingItem);
00330	
00331	    if( Pawn(Owner).PendingItems == none )
00332	    {
00333	        if( XIIIPlayerController(Pawn(Owner).Controller).bHooked )
00334	        { // changing from weapons to items while hooked will bring back hook
00335	          I = Pawn(Owner).Inventory;
00336	          while ( I != none )
00337	          {
00338	            XI = XIIIItems(I);
00339	            if ( (XI != none) && I.bDisplayableInv && XI.bActivatable && (bAllow2H || (IHand != IH_2H)))
00340	            {
00341	              if( XI.InventoryGroup == 4 ) // diff if here
00342	              {
00343	                CurrentXItem = XI;
00344	                break;
00345	              }
00346	            }
00347	            I = I.Inventory;
00348	          }
00349	          if ( CurrentXItem != none )
00350	            FirstMed = true;
00351	          FirstTime = true;
00352	        }
00353	        else
00354	        { // change from weapons to items bring back medicine
00355	          I = Pawn(Owner).Inventory;
00356	          while ( I != none )
00357	          {
00358	            XI = XIIIItems(I);
00359	            if ( (XI != none) && I.bDisplayableInv && XI.bActivatable && (bAllow2H || (IHand != IH_2H)) )
00360	            {
00361	              if( XI.InventoryGroup == 0 )
00362	              {
00363	                CurrentXItem = XI;
00364	                break;
00365	              }
00366	              else if( XI.InventoryGroup == 1 )
00367	                CurrentXItem = XI;
00368	            }
00369	            I = I.Inventory;
00370	          }
00371	          if ( CurrentXItem != none )
00372	            FirstMed = true;
00373	          FirstTime = true;
00374	        }
00375	    }
00376	    else if( XIIIItems(Pawn(Owner).PendingItems) != XIIIItems(Pawn(Owner).SelectedItem) )
00377	      CurrentXItem = XIIIItems(Pawn(Owner).PendingItems);
00378	
00379	    if ( (CurrentXItem == none) && bActivatable )
00380	      CurrentXItem = self;
00381	
00382	    if ( CurrentXItem != none )
00383	      CurrentItemIndex = CurrentXItem.InventoryGroup;
00384	    else
00385	      CurrentItemIndex = -1;
00386	
00387	    if( ! FirstMed )
00388	    {
00389	      I = Pawn(Owner).Inventory;
00390	      while ( I != none )
00391	      {
00392	        XI = XIIIItems(I);
00393	        if ( (XI != none) && I.bDisplayableInv && XI.bActivatable && (bAllow2H || (IHand != IH_2H)) )
00394	        {
00395	          if( XI.InventoryGroup > CurrentItemIndex )
00396	          {
00397	            if( NextItem == none )
00398	              NextItem = XI;
00399	            else if( XI.InventoryGroup < NextItem.InventoryGroup )
00400	              NextItem = XI;
00401	          }
00402	          ItemNumber++;
00403	        }
00404	        I = I.Inventory;
00405	      }
00406	
00407	      if( ( NextItem == none ) && ( ItemNumber > 0 ) )
00408	      {
00409	        I = Pawn(Owner).Inventory;
00410	        CurrentItemIndex = 9999;
00411	        while ( I != none )
00412	        {
00413	          XI = XIIIItems(I);
00414	          if ( (XI != none) && I.bDisplayableInv && XI.bActivatable && (bAllow2H || (IHand != IH_2H)) )
00415	          {
00416	            if( XI.InventoryGroup < CurrentItemIndex )
00417	            {
00418	              NextItem = XI;
00419	              CurrentItemIndex = XI.InventoryGroup;
00420	            }
00421	            ItemNumber++;
00422	          }
00423	          I = I.Inventory;
00424	        }
00425	      }
00426	    }
00427	
00428	    if ( FirstMed )
00429	      NextItem = CurrentXItem;
00430	    if ( FirstTime )
00431	      Pawn(Owner).SelectedItem = NextItem;
00432	    Pawn(Owner).PendingItems = NextItem;
00433	
00434	    return NextItem;
00435	}
00436	*/
00437	
00438	//_____________________________________________________________________________
00439	// ELR
00440	function PickupFunction(Pawn Other)
00441	{
00442	    if ( bActivatable && Other.SelectedItem == None)
00443	      Other.SelectedItem = self;
00444	    if ( bActivatable && bAutoActivate && Other.bAutoActivate )
00445	      Activate();
00446	}
00447	
00448	//_____________________________________________________________________________
00449	// Give this inventory item to a pawn.
00450	function GiveTo( pawn Other )
00451	{
00452	//    Log("GIVETO (inventory)"@self@"to"@Other);
00453	
00454		// cause event on pick
00455		if (EventCausedOnPick != 'none' )
00456	        TriggerEvent(EventCausedOnPick,none,none );
00457	
00458		Super.GiveTo( Other );
00459	}
00460	
00461	//_____________________________________________________________________________
00462	// Transfer this inventory to Player (for SearchCorpse)
00463	function Transfer( pawn Other )
00464	{
00465	    local XIIIItems Dual;
00466	
00467	//    Log("TRANSFER (inventory)"@self@"to"@Other);
00468	    if ( Instigator != none )
00469	    {
00470	  		DetachFromPawn(Instigator);
00471	      Instigator.DeleteInventory(self);
00472	    }
00473	
00474	    Dual = XIIIItems(Other.FindInventoryType(class));
00475	
00476	    if ( Dual == none )
00477	    {
00478	      if ( PickupClass != none )
00479	      {
00480	        Other.PlaySound(PickupClass.default.PickupSound);
00481	        Other.ReceiveLocalizedMessage( PickupClass.default.MessageClass, 0, None, None, PickupClass );
00482	      }
00483	      GiveTo(Other);
00484	    }
00485	    else
00486	    {
00487	      if ( PickupClass != none )
00488	      {
00489	        Other.PlaySound(PickupClass.default.PickupSound);
00490	        Other.ReceiveLocalizedMessage( PickupClass.default.MessageClass, 0, None, None, PickupClass );
00491	      }
00492	      Dual.Charge += Charge;
00493	      Destroy();
00494	    }
00495	}
00496	
00497	//_____________________________________________________________________________
00498	function Landed(Vector HitNormal)
00499	{
00500	    local Pickup P;
00501	    local rotator newRot;
00502	
00503	    SetDrawType(Default.DrawType);
00504	    SetDrawScale(Default.DrawScale);
00505	    NetPriority = Default.NetPriority;
00506	    Mesh = Default.Mesh;
00507	    bRendered = false;
00508	    bHidden = true;
00509	    RefreshDisplaying();
00510	    newRot = Rotation;
00511	    newRot.pitch = 0;
00512	    bCollideWorld = false;
00513	    SetRotation(newRot);
00514	    P = Spawn(PickupClass);
00515	    if ( P != None )
00516	    {
00517	      XIIIPickup(P).InvItemName = ItemName;
00518	      P.RespawnTime = 0.0; // no respawning
00519	      P.Inventory = self;
00520	    }
00521	    else
00522	      Destroy();
00523	}
00524	
00525	//_____________________________________________________________________________
00526	simulated function bool PutDown()
00527	{
00528	    DebugLog("GLOBAL PutDown for"@self);
00529	    bChangeItem = true;
00530	    return true;
00531	}
00532	
00533	//_____________________________________________________________________________
00534	simulated function BringUp()
00535	{
00536	    DebugLog(">>> BringUp called for item"@self);
00537	
00538	    if( bActivatable )
00539	    {
00540	      if ( (Level.Game != none) && (Level.Game.StatLog != None) )
00541	        Level.Game.StatLog.LogItemActivate(Self, Pawn(Owner));
00542	//      Log("  > BringUp sending item"@self@"in state 'Activated' from '"@GetStateName()$"'");
00543	      GoToState('Activated');
00544	//      Log("  > BringUp sent item"@self@"in state"@GetStateName());
00545	      bRendered = true;
00546	//      bHidden = false;
00547	//      RefreshDisplaying();
00548	    }
00549	}
00550	
00551	//_____________________________________________________________________________
00552	// Toggle Activation of selected Item.
00553	simulated function Activate()
00554	{
00555	//    Log("@@@ Activate call for"@self);
00556	    if( bActivatable )
00557	    {
00558	      if (Level.Game.StatLog != None)
00559	        Level.Game.StatLog.LogItemActivate(Self, Pawn(Owner));
00560	      GoToState('Activated');
00561	    }
00562	}
00563	
00564	//_____________________________________________________________________________
00565	// ELR when in state activated & using
00566	simulated function UseMe()
00567	{
00568	    Pawn(Owner).PendingItem = none;
00569	}
00570	
00571	//_____________________________________________________________________________
00572	// ELR called in Beginstate of Downweapon
00573	simulated function EndUse();
00574	
00575	//_____________________________________________________________________________
00576	// This is called when a usable inventory item has used up it's charge.
00577	simulated function UsedUp()
00578	{
00579	//    Log("@@@ UsedUp for "$self);
00580	    if ( Pawn(Owner) != None )
00581	    {
00582	      bActivatable = false;
00583	      XIIIPlayercontroller(XIIIPawn(Owner).controller).cNextItem();
00584	//      Log("  @ UsedUp Next Item="$XIIIPawn(Owner).PendingItem);
00585	      if ( (XIIIPawn(Owner).PendingItem == None) || (XIIIPawn(Owner).PendingItem == self) )
00586	        XIIIPlayercontroller(XIIIPawn(Owner).controller).NextWeapon();
00587	
00588	      XIIIPawn(Owner).ChangedWeapon();
00589	      if (Level.Game.StatLog != None)
00590	        Level.Game.StatLog.LogItemDeactivate(Self, XIIIPawn(Owner));
00591	//      Instigator.ReceiveLocalizedMessage( MessageClass, 0, None, None, Self.Class );
00592	    }
00593	    Instigator.PlayRolloffSound(DeactivateSound, self);
00594	    Destroy();
00595	}
00596	
00597	//_____________________________________________________________________________
00598	state Activated
00599	{
00600	    simulated function BeginState()
00601	    {
00602	      Instigator = Pawn(Owner);
00603	      DebugLog(Level.TimeSeconds$"  > Activated BeginState for "$self@"Instigator="$Instigator);
00604	      PlaySelect();
00605	      bRendered = true;
00606	//      bHidden = false;
00607	//      RefreshDisplaying();
00608	      bChangeItem = false;
00609	    }
00610	
00611	    simulated function AnimEnd(int Channel)
00612	    {
00613	      DebugLog("  > Activated AnimEnd bChangeItem="$bChangeItem);
00614	      if ( bChangeItem )
00615	      {
00616	        GotoState('DownItem');
00617	        return;
00618	      }
00619	      GotoState('Idle');
00620	    }
00621	
00622	    simulated function Activate() {}
00623	}
00624	
00625	//_____________________________________________________________________________
00626	state DownItem
00627	{
00628	    simulated function BeginState()
00629	    {
00630	//      Log("  > DownItem BeginState for "$self);
00631	      PlayDown();
00632	      EndUse();
00633	    }
00634	
00635	    simulated function AnimEnd(int Channel)
00636	    {
00637	//      Log("DownItem AnimEnd");
00638	      bChangeItem=false;
00639	      GotoState('');
00640	      Pawn(Owner).ChangedWeapon();
00641	      if ( (Pawn(Owner).SelectedItem != self) || XIIIPlayerController(Pawn(Owner).Controller).bWeaponMode )
00642	      {
00643	        bRendered = false;
00644	        bHidden = true;
00645	        RefreshDisplaying();
00646	      }
00647	    }
00648	
00649	    simulated function Activate() {}
00650	}
00651	
00652	//_____________________________________________________________________________
00653	state Idle
00654	{
00655	    simulated function BeginState()
00656	    {
00657	      DebugLog("  > Idle BeginState for "$self);
00658	      PlayIdle();
00659	      bActive=true;
00660	    }
00661	
00662	    simulated function EndState()
00663	    {
00664	      bActive=true;
00665	    }
00666	
00667	    simulated function AnimEnd(int Channel)
00668	    {
00669	      if (Charge <=0)
00670	      {
00671	        UsedUp();
00672	        return;
00673	      }
00674	      if ( bChangeItem )
00675	      {
00676	        GotoState('DownItem');
00677	        return;
00678	      }
00679	      PlayIdle();
00680	    }
00681	
00682	    simulated function Activate()
00683	    {
00684	      if ( XIIIPawn(Owner).bHaveOnlyOneHandFree && (IHand == IH_2H) )
00685	      {
00686	        PlayerController(Pawn(owner).controller).MyHud.LocalizedMessage(class'XIIISoloMessage', 8);
00687	      }
00688	      else
00689	        GotoState('InUse');
00690	    }
00691	
00692	    simulated function bool PutDown()
00693	    {
00694	      DebugLog("IDLE PutDown for"@self);
00695	      GotoState('DownItem');
00696	      return true;
00697	    }
00698	}
00699	
00700	//_____________________________________________________________________________
00701	State InUse
00702	{
00703	    simulated function BeginState()
00704	    {
00705	      DebugLog("  > InUse BeginState for "$self);
00706	      PlayUsing();
00707	    }
00708	
00709	    simulated function Activate() {}
00710	
00711	    simulated function AnimEnd(int Channel)
00712	    {
00713	      UseMe();
00714	      if (Charge <=0)
00715	      {
00716	        UsedUp();
00717	        return;
00718	      }
00719	      if ( bChangeItem )
00720	      {
00721	        GotoState('DownItem');
00722	        return;
00723	      }
00724	      GotoState('Idle');
00725	    }
00726	}
00727	
00728	//_____________________________________________________________________________
00729	simulated function PlaySelect()
00730	{
00731	    DebugLog(self@"PlaySelect");
00732	    PlayAnim('Select',1.0);
00733	    Instigator.PlayRolloffSound(hSelectItemSound, self, 0);
00734	}
00735	
00736	//_____________________________________________________________________________
00737	simulated function PlayDown()
00738	{
00739	    DebugLog(self@"PlayDown");
00740	    PlayAnim('Down', 1.0);
00741	    Instigator.PlayRolloffSound(hDownItemSound, self);
00742	}
00743	
00744	//_____________________________________________________________________________
00745	simulated function PlayIdle()
00746	{
00747	    DebugLog(self@"PlayIdle");
00748	    PlayAnim('Wait', 1.0);
00749	}
00750	
00751	//_____________________________________________________________________________
00752	simulated function PlayUsing()
00753	{
00754	    DebugLog(self@"PlayUsing");
00755	    PlayAnim('Fire', 2.0);
00756	    Instigator.PlayRolloffSound(ActivateSound, self);
00757	}
00758	
00759	//    Icon=texture'XIIIMenu.FistsIcon'
00760	
00761	
00762	defaultproperties
00763	{
00764	     MeshName="XIIIArmes.FpsM"
00765	     DisplayFOV=50.000000
00766	     IconNumber=20
00767	     PlayerViewOffset=(X=4.000000,Y=5.000000,Z=-9.000000)
00768	     bReplicateInstigator=True
00769	     bDelayDisplay=True
00770	     bSpecialDelayFov=True
00771	     bIgnoreDynLight=False
00772	     DrawType=DT_Mesh
00773	     DrawScale=0.300000
00774	     MessageClass=Class'XIII.XIIIPickupMessage'
00775	}

End Source Code