## XIII
Class XIIILeftHand

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

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Inventory
             |
             +--XIII.XIIILeftHand

Direct Known Subclasses:None

class XIIILeftHand
extends Engine.Inventory

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

Variables
`PlayerViewOffsetCorpse,` | `PlayerViewOffsetPrisonner` the pawn in hand (corpse or prisonner)
`InventoryAttachment` | `TheHeldBody` the pawn in hand (corpse or prisonner)
`bool` | `bActive` if the hand is active (corpse or prisonner)
`sound` | `hCatchBodySound` the pawn in hand (corpse or prisonner)
`sound` | `hCatchPrisonnerSound` the pawn in hand (corpse or prisonner)
`sound` | `hReleaseBodySound` the pawn in hand (corpse or prisonner)
`sound` | `hReleaseGoodPrisonnerSound` the pawn in hand (corpse or prisonner)
`sound` | `hReleasePrisonnerSound` the pawn in hand (corpse or prisonner)
`mCorpse,` | `mPrisonner` the pawn in hand (corpse or prisonner)
`XIIIPawn` | `pOnShoulder` the pawn in hand (corpse or prisonner)

States
UnGrabbing, Holding, Grabbing

Function Summary
`void` | `GrabPawn(XIIIPawn P)`
    //_____________________________________________________________________________
`Powerups` | `SelectNext()`
    //_____________________________________________________________________________
    // Select first activatable powerup.
    simulated
`void` | `UnGrabPawn()`
    //_____________________________________________________________________________

State UnGrabbing Function Summary
`void` | `PlayUnGrabbing()`
`void` | `PlayMoving()`
`void` | `PlayWaiting()`
`void` | `PlayGrabbing()`
    //_____________________________________________________________________________
`void` | `GrabPawn(XIIIPawn P)`
`void` | `UnGrabPawn()`

State Holding Function Summary
`void` | `GrabPawn(XIIIPawn P)`

State Grabbing Function Summary
`void` | `GrabPawn(XIIIPawn P)`
`void` | `UnGrabPawn()`

Source Code

    00001	//-----------------------------------------------------------
    00002	//
    00003	//-----------------------------------------------------------
    00004	class XIIILeftHand extends Inventory;
    00005
    00006	var bool bActive;           // if the hand is active (corpse or prisonner)
    00007	var XIIIPawn pOnShoulder;   // the pawn in hand (corpse or prisonner)
    00008
    00009	var sound hCatchPrisonnerSound;
    00010	var sound hReleasePrisonnerSound;
    00011	var sound hCatchBodySound;
    00012	var sound hReleaseBodySound;
    00013	var sound hReleaseGoodPrisonnerSound;
    00014
    00015	var mesh mCorpse, mPrisonner;
    00016	var inventoryAttachment TheHeldBody;
    00017
    00018	var vector PlayerViewOffsetCorpse, PlayerViewOffsetPrisonner;
    00019
    00020	//_____________________________________________________________________________
    00021	simulated event RenderOverlays( canvas Canvas )
    00022	{
    00023	    if ( (Instigator == None) || (Instigator.Controller == None))
    00024	      return;
    00025	    SetLocation( Instigator.Location + Instigator.CalcDrawOffset(self) );
    00026	    SetRotation( Instigator.GetViewRotation() );
    00027	//    Canvas.DrawActor(self, false);
    00028	    SetBase(Pawn(Owner).Controller);
    00029	}
    00030
    00031	/*
    00032	//_____________________________________________________________________________
    00033	// Select first activatable powerup.
    00034	simulated function Powerups SelectNext()
    00035	{
    00036	//    Log("  > SelectNext for "$self@"call, inventory="$Inventory);
    00037	    if ( Inventory != None )
    00038	      return Inventory.SelectNext();
    00039	    else
    00040	      return None;
    00041	}
    00042	*/
    00043
    00044	//_____________________________________________________________________________
    00045	function GrabPawn(XIIIPawn P)
    00046	{
    00047	    if ( (pOnShoulder != none) || (P == none) )
    00048	      return;
    00049
    00050	//    Log("--> GrabPawn called");
    00051	    pOnShoulder = P;
    00052	    if ( pOnShoulder.bIsDead )
    00053	      Mesh = mCorpse;
    00054	    else
    00055	      Mesh = mPrisonner;
    00056
    00057	    TheHeldBody = spawn(class'HeldBody',self);
    00058	    TheHeldBody.Mesh = pOnShoulder.Mesh;
    00059	    if ( (pOnShoulder.Skins.Length != 0) && (pOnShoulder.Skins[0] != none) )
    00060	      TheHeldBody.Skins[0] = pOnShoulder.Skins[0];
    00061
    00062	    AttachToBone(TheHeldBody,'Box01');
    00063
    00064	    pOnShoulder.Instigator = Pawn(Owner);
    00065	    pOnShoulder.BeingGrabbed();
    00066	    if ( pOnShoulder.bIsDead )
    00067	    {
    00068	      XIIIPawn(instigator).bPrisonner=false;
    00069	      Instigator.PlayRolloffSound(hCatchBodySound, self);
    00070	      PlayerViewOffset = PlayerViewOffsetCorpse;
    00071	    }
    00072	    else
    00073	    {
    00074	      XIIIPawn(instigator).bPrisonner=true;
    00075	      Instigator.PlayRolloffSound(hCatchPrisonnerSound, self);
    00076	      PlayerViewOffset = PlayerViewOffsetPrisonner;
    00077	    }
    00078	    XIIIPawn(Owner).bHaveOnlyOneHandFree=true;
    00079
    00080	    PlayGrabbing();
    00081	    bActive=true;
    00082
    00083	    GotoState('Grabbing');
    00084	}
    00085
    00086	//_____________________________________________________________________________
    00087	function UnGrabPawn()
    00088	{
    00089	//    Log("--> UnGrabPawn called");
    00090
    00091	// ELR distinction between ungrabing corpse or prisoner is made in pawn functions upon current state
    00092	    if ( !pOnShoulder.bIsDead )
    00093	    {
    00094	      if ( pOnShoulder.GameOver == GO_Never )
    00095	        Instigator.PlayRolloffSound(hReleasePrisonnerSound, self);
    00096	      else
    00097	        Instigator.PlayRolloffSound(hReleaseGoodPrisonnerSound, self);
    00098	    }
    00099
    00100	    PlayUnGrabbing();
    00101
    00102	    TheHeldBody.GotoState('UnGrabbed');
    00103
    00104	    GotoState('UnGrabbing');
    00105	    XIIIPawn(instigator).bPrisonner=false;
    00106	    XIIIPawn(Owner).bHaveOnlyOneHandFree=false;
    00107	}
    00108
    00109	//_____________________________________________________________________________
    00110	state Grabbing
    00111	{
    00112	    event BeginState()
    00113	    {
    00114	      bHidden = false;
    00115	      RefreshDisplaying();
    00116	//      TheHeldBody.bHidden = true;
    00117	//      TheHeldBody.RefreshDisplaying();
    00118	    }
    00119	    function UnGrabPawn();
    00120	    function GrabPawn(XIIIPawn P);
    00121	    event AnimEnd(int channel)
    00122	    {
    00123	      PlayWaiting();
    00124	      GotoState('Holding');
    00125	    }
    00126	}
    00127
    00128	//_____________________________________________________________________________
    00129	state Holding
    00130	{
    00131	    function GrabPawn(XIIIPawn P);
    00132	    event AnimEnd(int channel)
    00133	    {
    00134	      if ( (fRand() < 0.1) && !pOnShoulder.bIsDead )
    00135	        PlayMoving();
    00136	      else
    00137	        PlayWaiting();
    00138	    }
    00139	}
    00140
    00141	//_____________________________________________________________________________
    00142	state UnGrabbing
    00143	{
    00144	    function UnGrabPawn();
    00145	    function GrabPawn(XIIIPawn P);
    00146	    event AnimEnd(int channel)
    00147	    {
    00148	      bActive = false;
    00149	      bHidden = true;
    00150	      RefreshDisplaying();
    00151	      if ( pOnShoulder != none )
    00152	      {
    00153	        if ( pOnShoulder.bIsDead )
    00154	        {
    00155	          Instigator.PlayRolloffSound(hReleaseBodySound, self);
    00156	          pOnShoulder.UnGrabbed(Instigator.Location - vect(0,0,50), vector(rotation));
    00157	        }
    00158	        else
    00159	        {
    00160	          pOnShoulder.UnGrabbed(Instigator.Location - vect(0,0,50), vector(rotation));
    00161	        }
    00162	        if ( Mover(Instigator.Base) != none )
    00163	          pOnShoulder.SetBase(Instigator.Base);
    00164	        pOnShoulder = none;
    00165	      }
    00166	      XIIIPawn(Owner).CheckMaluses();
    00167	      GotoState('');
    00168	    }
    00169	}
    00170
    00171	//_____________________________________________________________________________
    00172	function PlayGrabbing()
    00173	{
    00174	    PlayAnim('Select');
    00175	    if ( pOnShoulder.bIsDead && (TheHeldBody != none) )
    00176	      TheHeldBody.PlayAnim('CadavreSelect');
    00177	    else
    00178	      TheHeldBody.PlayAnim('OtageSelect');
    00179	}
    00180
    00181	function PlayWaiting()
    00182	{
    00183	    PlayAnim('Wait');
    00184
    00185	//    log("pOnShoulder="$pOnShoulder@"TheHeldBody="$TheHeldBody);
    00186
    00187	    if ( pOnShoulder.bIsDead && (TheHeldBody != none) )
    00188	      TheHeldBody.PlayAnim('CadavreWait');
    00189	    else
    00190	      TheHeldBody.PlayAnim('OtageWait');
    00191	}
    00192
    00193	function PlayMoving()
    00194	{
    00195	    PlayAnim('Mov');
    00196	    TheHeldBody.PlayAnim('OtageMov');
    00197	}
    00198
    00199	function PlayUnGrabbing()
    00200	{
    00201	    if ( pOnShoulder.bIsDead && (TheHeldBody != none) )
    00202	    {
    00203	      PlayAnim('Down');
    00204	      TheHeldBody.PlayAnim('CadavreDown');
    00205	    }
    00206	    else
    00207	    {
    00208	      PlayAnim('DownKill');
    00209	      TheHeldBody.PlayAnim('OtageDownKill');
    00210	    }
    00211	}
    00212
    00213	event FPSThrowNote()
    00214	{
    00215	    Instigator.PlayRolloffSound(hReleaseBodySound, self);
    00216	}
    00217	event FPSKillNote()
    00218	{
    00219	    Instigator.PlayRolloffSound(hReleasePrisonnerSound, self);
    00220	}
    00221	event FPSStunNote()
    00222	{
    00223	    Instigator.PlayRolloffSound(hReleasePrisonnerSound, self);
    00224	}
    00225
    00226	//    bSpecialDelayFov=true
    00227
    00228
    00229	defaultproperties
    00230	{
    00231	     hCatchPrisonnerSound=Sound'XIIIsound.SpecActions__Hostage.Hostage__hHostageIn'
    00232	     hReleasePrisonnerSound=Sound'XIIIsound.SpecActions__Hostage.Hostage__hHostageOut'
    00233	     hCatchBodySound=Sound'XIIIsound.SpecActions.BodyCatch'
    00234	     hReleaseBodySound=Sound'XIIIsound.SpecActions.BodyThrow'
    00235	     hReleaseGoodPrisonnerSound=Sound'XIIIsound.SpecActions__Hostage.Hostage__hHostageOutKiTuPas'
    00236	     mCorpse=SkeletalMesh'XIIIArmes.fpsCadavreM'
    00237
mPrisonner=SkeletalMesh'XIIIArmes.fpsOtageM' 00238 PlayerViewOffsetCorpse=(X=6.000000,Y=2.500000,Z=-6.000000) 00239 PlayerViewOffsetPrisonner=(X=5.000000,Y=4.500000,Z=-7.500000) 00240 PlayerViewOffset=(X=6.000000,Y=2.500000,Z=-5.000000) 00241 bDelayDisplay=True 00242 bIgnoreDynLight=False 00243 DrawType=DT_Mesh 00244 Mesh=SkeletalMesh'XIIIArmes.fpsCadavreM' 00245 DrawScale=0.300000 00246 }

End Source Code