XIDCine
Class CineHook

source: C:\XIII\XIDCine\Classes\CineHook.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--XIDCine.CineHook
Direct Known Subclasses:None

class CineHook
extends Engine.Actor

//----------------------------------------------------------- // //-----------------------------------------------------------
Variables
 bool ActivatedByAltFire
           used for playing animation chain (firing then down then selectcommande)
 bool ActivatedByDuck
           used for playing animation chain (firing then down then selectcommande)
 bool ActivatedByFire
           used for playing animation chain (firing then down then selectcommande)
 bool ActivatedByJump
           used for playing animation chain (firing then down then selectcommande)
 int AnimState
           used for playing animation chain (firing then down then selectcommande)
 HookUpSpeed, HookDownSpeed
           Speed we are climbing/dropping while hooked
 float HookLength
           Position on the Rope to the HookPoint
 vector HookPointPosition
           Hooking point
 float MaxHookLength
           Max Lenght of the Hook Rope
 HookProjectile MyHook
 HookLink MyLink
 Texture PotHookIcon
           Icon to use to display the potential hook points on screen
 array PotentialHP
           Array of potentials HP in the level
 Pawn User
           used for playing animation chain (firing then down then selectcommande)
 bGoUp, bGoDown
           Speed we are climbing/dropping while hooked
 bool bHooked
           used for playing right animations
 sound hHookClik
           Icon to use to display the potential hook points on screen
 sound hHookEndSound
           Icon to use to display the potential hook points on screen
 sound hHookFireSound
           Icon to use to display the potential hook points on screen
 sound hHookMoveSound
           Icon to use to display the potential hook points on screen
 sound hHookReleaseSound
           Icon to use to display the potential hook points on screen

States
HookInUse, for, Activated

Function Summary
 
simulated
CastHook(HookPoint PotHookPoint)
     
//_____________________________________________________________________________
 void ReduceRopeLength(float DT)
     
//	SetTimer(0.25, false);
//	bHooked=true;
//	PlayUsing();
//	GotoState('HookInUse');
}



State HookInUse Function Summary


State for Function Summary
 void Activate()
     
{
	if (MyHook != none)
		MyHook.Destroy();
	if (MyLink != none)
		MyLink.Destroy();
	Disable('tick');
	GoToState('Idle');
	StopSound(hHookMoveSound);
	PlayRolloffSound(hHookReleaseSound,self);
	if (AnimState != 0)
		TweenDown();
	else
		PlayDown();
	bHooked=false;
}

 void Release()
     
{
	if ( (HookLength<(100+vSize(HookPointPosition - Pawn(Owner).Location))) && (HookLength < MaxHookLength) )
	{
		HookLength += (DT * HookDownSpeed);
		if (HookLength > MaxHookLength)
			HookLength = MaxHookLength;
	}
}

 void IncreaseRopeLength(float DT)
     
"$self@"Instigator="$Instigator);
      PlaySelect();
      InitPotentialTargets();
      bHidden = false;
      RefreshDisplaying();
    }
}



State Activated Function Summary



Source Code


00001	//-----------------------------------------------------------
00002	//
00003	//-----------------------------------------------------------
00004	class CineHook extends Actor;
00005	
00006	/*var HookPoint PotHookPoint;     // If there is a Hookpoint in the Crosshair
00007	
00008	var HookProjectile MyHook;
00009	var HookLink MyLink;
00010	//var FreeHookLink MyFHLink;
00011	
00012	var vector HookPointPosition;           // Hooking point
00013	var float HookLength;           // Position on the Rope to the HookPoint
00014	var float MaxHookLength;        // Max Lenght of the Hook Rope
00015	var float HookUpSpeed, HookDownSpeed;   // Speed we are climbing/dropping while hooked
00016	var bool bGoUp, bGoDown;
00017	
00018	var array<hookpoint> PotentialHP;   // Array of potentials HP in the level
00019	var texture PotHookIcon;            // Icon to use to display the potential hook points on screen
00020	
00021	var sound hHookMoveSound;
00022	var sound hHookEndSound;
00023	var sound hHookFireSound;
00024	var sound hHookReleaseSound;
00025	var sound hHookClik;
00026	
00027	var bool bHooked;               // used for playing right animations
00028	var int AnimState;              // used for playing animation chain (firing then down then selectcommande)
00029	
00030	var bool ActivatedByJump;
00031	var bool ActivatedByDuck;
00032	var bool ActivatedByAltFire;
00033	var bool ActivatedByFire;
00034	
00035	VAR Pawn User;
00036	//_____________________________________________________________________________
00037	Simulated function CastHook(HookPoint PotHookPoint)
00038	{
00039		HookPointPosition = PotHookPoint.Location;
00040		HookLength = VSize(HookPointPosition - User.Location ) + 50.0;
00041	//	MaxHookLength = PotHookPoint.RopeLength;
00042	//	if ( MaxHookLength < HookLength )
00043	//		return;
00044	
00045		MyHook=Spawn(class'CineHookProjectile',,, Owner.Location + Instigator.CalcDrawOffset(self),Rotator(HookPointPosition-Location));
00046		if (MyHook != none)
00047		{
00048			MyHook.SetOwner(self);
00049			MyLink=Spawn(class'HookLink',,, Owner.Location + Instigator.CalcDrawOffset(self),Rotator(HookPointPosition-Location));
00050			if (MyLink != none)
00051			{
00052				MyLink.HStart=self;
00053				MyLink.HEnd=MyHook;
00054				MyLink.LinkIndex = 0;
00055			}
00056		}
00057		PlayRolloffSound(hHookFireSound, self);
00058		XIIIPawn(Owner).GoHooking(self);
00059	//	SetTimer(0.25, false);
00060	//	bHooked=true;
00061	//	PlayUsing();
00062	//	GotoState('HookInUse');
00063	}
00064	
00065	FUNCTION ReduceRopeLength(float DT)
00066	{
00067		if ( HookLength>150 )
00068		{
00069			HookLength = vSize(HookPointPosition - Pawn(Owner).Location); // don't allow teleports
00070			HookLength -= (DT * HookUpSpeed);
00071			if ( HookLength<150 )
00072				HookLength = 150;
00073		}
00074	}
00075	
00076	//_____________________________________________________________________________
00077	
00078	STATE Activated
00079	{
00080	    simulated function BeginState()
00081	    {
00082	      Instigator = Pawn(Owner);
00083	      if ( DBHook ) Log("  > Activated BeginState for "$self@"Instigator="$Instigator);
00084	      PlaySelect();
00085	      InitPotentialTargets();
00086	      bHidden = false;
00087	      RefreshDisplaying();
00088	    }
00089	}
00090	
00091	FUNCTION IncreaseRopeLength(float DT)
00092	{
00093		if ( (HookLength<(100+vSize(HookPointPosition - Pawn(Owner).Location))) && (HookLength < MaxHookLength) )
00094		{
00095			HookLength += (DT * HookDownSpeed);
00096			if (HookLength > MaxHookLength)
00097				HookLength = MaxHookLength;
00098		}
00099	}
00100	
00101	FUNCTION Release()
00102	{
00103		if (MyHook != none)
00104			MyHook.Destroy();
00105		if (MyLink != none)
00106			MyLink.Destroy();
00107		Disable('tick');
00108		GoToState('Idle');
00109		StopSound(hHookMoveSound);
00110		PlayRolloffSound(hHookReleaseSound,self);
00111		if (AnimState != 0)
00112			TweenDown();
00113		else
00114			PlayDown();
00115		bHooked=false;
00116	}
00117	
00118	FUNCTION Activate()
00119	{
00120		SetTimer(0.25, false);
00121		PlaySound(hHookClik);
00122	}
00123	
00124	//_____________________________________________________________________________
00125	// In Use
00126	STATE HookInUse
00127	{
00128	
00129	//_____________________________________________________________________________
00130	simulated function TweenDown()
00131	{
00132	//    Log(self@"TweenDown, bHooked="$bHooked@"AnimState="$AnimState);
00133	    if ( AnimState == 1 )
00134	    {
00135	      bHooked=false;
00136	      PlaySelect();
00137	      AnimState = 0;
00138	    }
00139	    else
00140	    {
00141	      PlayAnim('DownCommande',3.0,0.2);
00142	      AnimState = 3;
00143	    }
00144	}
00145	
00146	//_____________________________________________________________________________
00147	simulated function PlayIdle()
00148	{
00149	//    Log(self@"PlayIdle, bHooked="$bHooked);
00150	    if ( bHooked )
00151	    {
00152	      PlayAnim('WaitCommande',1.0);
00153	    }
00154	    else
00155	      PlayAnim('Wait', 1.0);
00156	}
00157	
00158	//_____________________________________________________________________________
00159	simulated function PlayUsing()
00160	{
00161	//    Log(self@"PlayUsing");
00162	    PlayAnim('Fire', 2.0);
00163	    AnimState = 1;
00164	}
00165	
00166	//_____________________________________________________________________________
00167	simulated function PlayClimbUp()
00168	{
00169	//    Log(self@"PlayClimbUp");
00170	    if ( AnimState == 0 )
00171	      PlayAnim('ClimbUp', 2.0);
00172	}
00173	//_____________________________________________________________________________
00174	simulated function PlayClimbDown()
00175	{
00176	//    Log(self@"PlayClimbDown");
00177	    if ( AnimState == 0 )
00178	      PlayAnim('ClimbDown', 2.0);
00179	}
00180	//_____________________________________________________________________________
00181	simulated function PlayStop()
00182	{
00183	//    Log(self@"PlayStop");
00184	    PlayAnim('Stop', 2.0);
00185	}
00186	
00187	    InventoryGroup=5
00188	    bCanHaveMultipleCopies=true
00189	    bAutoActivate=True
00190	    bActivatable=True
00191	    ExpireMessage="Hook was used."
00192	    bDisplayableInv=True
00193	    Charge=1
00194	    ItemName="HOOK"
00195	    PlayerViewOffset=(X=5.00,Y=6.00,Z=-5.80)
00196	    BobDamping=0.975000
00197	    PickupClassName="XIII.HookPick"
00198	    HookUpSpeed=150.0
00199	    HookDownSpeed=300.0
00200	    IHand=IH_2H
00201	    PotHookIcon=texture'XIIIMenu.Hand_GrapplePoint'
00202	    Icon=texture'XIIIMenu.GrappinIcon'
00203	    CrossHair=Texture'XIIIMenu.MireGrappin'
00204	    hSelectItemSound=Sound'XIIIsound.SpecActions.HookSel'
00205	    hHookMoveSound=Sound'XIIIsound.SpecActions.HookMov'
00206	    hHookEndSound=Sound'XIIIsound.SpecActions.HookEnd'
00207	    hHookFireSound=sound'XIIIsound.SpecActions.HookFire'
00208	    hHookReleaseSound=Sound'XIIIsound.SpecActions.HookLet'
00209	    hHookClik=Sound'XIIIsound.SpecActions.HookClick'
00210	    bHooked=false
00211	    AnimState=0
00212		LifeSpan=+00140.000000
00213		NetPriority=+00002.500000
00214		MyDamageType=class'DamageType'
00215		RemoteRole=ROLE_SimulatedProxy
00216		TossZ=+100.0
00217	*/
00218	
00219	
00220	defaultproperties
00221	{
00222	     bNetTemporary=True
00223	     bReplicateInstigator=True
00224	     bUnlit=True
00225	     bGameRelevant=True
00226	     bCollideActors=True
00227	     bCollideWorld=True
00228	     Physics=PHYS_Projectile
00229	     DrawType=DT_StaticMesh
00230	     StaticMesh=StaticMesh'MeshArmesPickup.grappin'
00231	     DrawScale=0.600000
00232	}

End Source Code