RuneI
Class RunePlayerProxy

source: c:\runehov\RuneI\Classes\RunePlayerProxy.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Keypoint
         |
         +--Engine.AnimationProxy
            |
            +--RuneI.RunePlayerProxy
Direct Known Subclasses:None

class RunePlayerProxy
extends Engine.AnimationProxy

//============================================================================= // RunePlayerProxy. //=============================================================================
Variables
 int DoStowIndex
 enum DoStowType_e
 Inventory PendingItem
 byte PendingSwitchWeapon
 Name TorsoAnim
 Name TorsoIntroAnim
 Name TorsoLoop
           Used for special attack types
 Weapon curWeapon
 int index
 Weapon newWeapon
 Weapon nextWeapon
 Weapon stowWeapon

States
EdgeHanging, PlayerRopeClimbing, Uninterrupted, Pain, Throwing, Defending, Attacking, PickingUp, Switching, Idle

Function Summary
 void AcquireInventory(Inventory item)
     
//=========================================================================
//
// AcquireInventory
//
//=========================================================================
 bool CanPickup(Inventory item)
     
//=============================================================================
//
// CanPickUp
//
//=============================================================================
 void ClearSwipeArray()
     
//=============================================================================
//
// ClearSwipeArray
//
// ClearSwipeArray Notify
//=============================================================================
 void DoStow()
     
//=============================================================================
//
// DoStow
//
//=============================================================================
 name GetGroup(name sequence)
     
//=============================================================================
//
// GetGroup
//
//=============================================================================
 int GetStowIndex(Weapon weapon)
     
//=============================================================================
//
// GetStowIndex
//
//=============================================================================
 void InventorySpecial1()
     
//=============================================================================
//
// InventorySpecial1
//
// Generic inventory notify, passes it onto the inventory item in Ragnar's hand
//=============================================================================
 void InventorySpecial2()
     
//=============================================================================
//
// InventorySpecial2
//
// Generic inventory notify, passes it onto the inventory item in Ragnar's hand
//=============================================================================
 void InventorySpecial3()
     
//=============================================================================
//
// InventorySpecial3
//
// Generic inventory notify, passes it onto the inventory item in Ragnar's hand
//=============================================================================
 void PostBeginPlay()
     
//=============================================================================
//
// PostBeginPlay
//
//=============================================================================
 void ProxyDonePickup()
     
//=============================================================================
//
// ProxyDonePickup
//
//=============================================================================
 void ProxyDropWeapon()
     
//=============================================================================
//
// ProxyDropWeapon
//
//=============================================================================
 void ProxyPickup()
     
//=============================================================================
//
// ProxyPickup
//
//=============================================================================
 void ProxyStowWeapon(int type)
     
//=============================================================================
//
// ProxyStowWeapon
//
//=============================================================================
 void ProxyThrowWeapon()
     
//=============================================================================
//
// ProxyThrowWeapon
//
//=============================================================================
 void RetrieveLastHeldWeapon()
     
//=============================================================================
//
// RetrieveLastHeldWeapon
//
//=============================================================================
 void RopeClimb()
     
//=============================================================================
//
// RopeClimb
//
// RopeClimb Notify
//=============================================================================
 void SwimSplash()
     
//=============================================================================
//
// SwimSplash
//
// Splash notify
//=============================================================================
 void SwipeEffectCombo()
     
//=============================================================================
//
// SwipeEffectCombo
//
// Swipe Effect Notify
//=============================================================================
 void SwipeEffectEnd()
     
//=============================================================================
//
// SwipeEffectEnd
//
// Swipe Effect Notify
//=============================================================================
 void SwipeEffectStart()
     
//=============================================================================
//
// SwipeEffectStart
//
// Swipe Effect Notify
//=============================================================================
 void SwitchWeapon(byte F)
     
//=============================================================================
//
// SwitchWeapon
//
// The player wants to switch to a given weapon number
//
// 1 - Fists
// 2 - Sword
// 3 - Hammer
// 4 - Axe
//=============================================================================
 void SyncAnimation(float tween)
     
//=============================================================================
//
// SyncAnimation
//
// Tries to sync the current proxy anim to the master anim
//=============================================================================
 void ThrowGhost()
     
//=============================================================================
//
// ThrowGhost
//
// Notify for Throw powerup
//=============================================================================
 bool Use()
     
//=============================================================================
//
// Use
//
//=============================================================================
 void UseNotify()
     
//=============================================================================
//
// UseNotify
//
// Notify used by animations to specify when the use should occur
//=============================================================================
 bool WantsToPickup(Inventory item)
     
//=============================================================================
//
// WantsToPickup
//
//=============================================================================
 void WeaponActivate()
     
//=============================================================================
//
// WeaponActivate
//
//=============================================================================
 void WeaponDeactivate()
     
//=============================================================================
//
// WeaponDeactivate
//
// Swipe Effect Notify
//=============================================================================


State EdgeHanging Function Summary


State PlayerRopeClimbing Function Summary


State Uninterrupted Function Summary
 bool CanGotoPainState()
 bool CanPickup(Inventory item)
     
//==========================================================================
 void TryTweenAnim(Name anim, optional float)
 void TryLoopAnim(Name anim, optional float, optional float)
 void TryPlayAnim(Name anim, optional float, optional float)


State Pain Function Summary
 bool CanPickup(Inventory item)
     
//==========================================================================
 bool CanGotoPainState()
 void TryTweenAnim(Name anim, optional float)
 void TryLoopAnim(Name anim, optional float, optional float)
 void TryPlayAnim(Name anim, optional float, optional float)


State Throwing Function Summary
 void DoThrow()
     
//=========================================================================
 void PlayThrowAnim()
     
//=========================================================================
 bool CanPickup(Inventory item)
     
//==========================================================================
 void TryTweenAnim(Name anim, optional float)
 void TryLoopAnim(Name anim, optional float, optional float)
 void TryPlayAnim(Name anim, optional float, optional float)


State Defending Function Summary
 void SwitchWeapon(byte F)
     
//=========================================================================
 void PlayDefendIdle()
     
//=========================================================================
 void PlayDefend()
     
//=========================================================================
 void EndState()
     
//=========================================================================
 void AnimEnd()
 void BeginState()
     
//=========================================================================
 bool CanPickup(Inventory item)
     
//==========================================================================
 void TryTweenAnim(Name anim, optional float)
 void TryLoopAnim(Name anim, optional float, optional float)
 void TryPlayAnim(Name anim, optional float, optional float)


State Attacking Function Summary
 void PlayAttack(float tween)
     
//=========================================================================
 bool Defend()
     
//=========================================================================
 bool Attack()
     
//=========================================================================
 void StopAttack()
     
//=========================================================================
 void EndState()
     
//=========================================================================
 void BeginState()
     
//=========================================================================
 bool CanPickup(Inventory item)
     
//==========================================================================
 void TryTweenAnim(Name anim, optional float)
 void TryLoopAnim(Name anim, optional float, optional float)
 void TryPlayAnim(Name anim, optional float, optional float)


State PickingUp Function Summary
 void FindPickupItem()
     
//=========================================================================
 bool CanPickup(Inventory item)
     
//=========================================================================
 bool CanGotoPainState()
 void EndState()
 void TryTweenAnim(Name anim, optional float)
 void TryLoopAnim(Name anim, optional float, optional float)
 void TryPlayAnim(Name anim, optional float, optional float)


State Switching Function Summary
 bool CanPickup(Inventory item)
     
//==========================================================================
 bool CanGotoPainState()
 void TryTweenAnim(Name anim, optional float)
 void TryLoopAnim(Name anim, optional float, optional float)
 void TryPlayAnim(Name anim, optional float, optional float)


State Idle Function Summary
 bool Throw()
     
//=========================================================================
 bool Defend()
     
//=========================================================================
 bool Attack()
     
//=========================================================================
 bool Use()
     
//=========================================================================
 bool CanPickup(Inventory item)
     
//=========================================================================
 void SwitchWeapon(byte F)
     
//=========================================================================



Source Code


00001	//=============================================================================
00002	// RunePlayerProxy.
00003	//=============================================================================
00004	class RunePlayerProxy expands AnimationProxy;
00005	
00006	var enum DoStowType_e
00007	{
00008		DST_NONE,
00009		DST_STOW,
00010		DST_RETRIEVE,
00011		DST_PICKUP,
00012		DST_SWAP
00013	} DoStowType;
00014	
00015	var int DoStowIndex;
00016	
00017	var Weapon curWeapon;
00018	var Weapon newWeapon;
00019	var Weapon nextWeapon;
00020	var Weapon stowWeapon;
00021	var int index;
00022	var byte PendingSwitchWeapon;
00023	
00024	var Inventory PendingItem;
00025	
00026	var Name TorsoAnim;
00027	var Name TorsoIntroAnim;
00028	var Name TorsoLoop; // Used for special attack types
00029	
00030	//var Actor PowerEffect;
00031	
00032	
00033	//=============================================================================
00034	//
00035	// PostBeginPlay
00036	//
00037	//=============================================================================
00038	
00039	function PostBeginPlay()
00040	{
00041		Super.PostBeginPlay();
00042		PendingSwitchWeapon = 0;
00043		
00044	//	SetTimer(0.1, true);
00045	}
00046	
00047	
00048	// Pass frame notifies to weapon
00049	simulated event FrameNotify(int framepassed)
00050	{
00051		if (Owner != None && RunePlayer(Owner).Weapon != None)
00052			RunePlayer(Owner).Weapon.FrameNotify(framepassed);
00053	}
00054	
00055	//=============================================================================
00056	//
00057	// GetGroup
00058	//
00059	//=============================================================================
00060	
00061	function name GetGroup(name sequence)
00062	{
00063		if(RunePlayer(Owner).Weapon != None)
00064		{ // This only returns MoveAttack for forward and backward motions (which override the lower-body)
00065			if(sequence == RunePlayer(Owner).Weapon.A_AttackA)						return('MoveAttack');
00066			else if(sequence == RunePlayer(Owner).Weapon.A_AttackB)					return('MoveAttack');
00067			else if(sequence == RunePlayer(Owner).Weapon.A_AttackC)					return('MoveAttack');
00068			else if(sequence == RunePlayer(Owner).Weapon.A_AttackD)					return('MoveAttack');
00069			else if(sequence == RunePlayer(Owner).Weapon.A_AttackAReturn)			return('MoveAttack');
00070			else if(sequence == RunePlayer(Owner).Weapon.A_AttackBReturn)			return('MoveAttack');
00071			else if(sequence == RunePlayer(Owner).Weapon.A_AttackCReturn)			return('MoveAttack');
00072			else if(sequence == RunePlayer(Owner).Weapon.A_AttackDReturn)			return('MoveAttack');
00073			else if(sequence == RunePlayer(Owner).Weapon.A_AttackBackupA)			return('MoveAttack');
00074			else if(sequence == RunePlayer(Owner).Weapon.A_AttackBackupAReturn)		return('MoveAttack');
00075			else if(sequence == RunePlayer(Owner).Weapon.A_AttackBackupB)			return('MoveAttack');
00076			else if(sequence == RunePlayer(Owner).Weapon.A_AttackBackupBReturn)		return('MoveAttack');
00077		}
00078		else
00079			return(sequence);
00080	}
00081	
00082	//=========================================================================
00083	//
00084	// AcquireInventory
00085	//
00086	//=========================================================================
00087	
00088	function AcquireInventory(Inventory item)
00089	{
00090		local int joint;
00091	
00092		// Trigger any events when the item is picked up
00093		item.FireEvent(item.Event);
00094		item.Event = ''; // Clear out the event on this item 
00095		
00096		// Attach the item to the appropriate joint
00097		if(item.IsA('Weapon'))
00098		{
00099			RunePlayer(Owner).InstantStow();
00100			RunePlayer(Owner).SelectWeapon(Weapon(item));
00101			RunePlayer(Owner).Weapon = Weapon(item);
00102	
00103			curWeapon = RunePlayer(Owner).Weapon;		
00104			newWeapon = Weapon(item);
00105	
00106			if(item.IsA('NonStow'))
00107			{
00108				stowWeapon = None;
00109			}
00110			else
00111			{
00112				stowWeapon = RunePlayer(Owner).GetStowedWeapon(GetStowIndex(newWeapon));
00113			}
00114	
00115			if(curWeapon != None && curWeapon.A_Defend == 'None')
00116			{ // This weapon just picked up cannot be used with a shield
00117				RunePlayer(Owner).DropShield();
00118			}
00119	
00120			// Picked up a weapon underwater, instantly stow it
00121			if(Owner.IsInState('PlayerSwimming'))
00122			{
00123				RunePlayer(Owner).InstantStow();
00124			}
00125		}
00126		else if(item.IsA('Shield'))
00127		{
00128			RunePlayer(Owner).DropShield();
00129			RunePlayer(Owner).Shield = Shield(item);
00130		
00131			joint = RunePlayer(Owner).JointNamed(RunePlayer(Owner).ShieldJoint);
00132			if(joint != 0)
00133			{
00134				RunePlayer(Owner).AttachActorToJoint(RunePlayer(Owner).Shield, joint);
00135			}
00136		}
00137		else if(item.IsA('Runes'))
00138		{
00139			item.GotoState('Activated'); // TODO:  Finish Pickup functionality	
00140		}
00141		else if(item.IsA('Pickup'))
00142		{
00143	//		Pickup(item).PickupFunction(Pawn(Owner));	// The pickup function is called by AcquireInventory
00144		}
00145	}
00146	
00147	//=============================================================================
00148	//
00149	// SyncAnimation
00150	//
00151	// Tries to sync the current proxy anim to the master anim
00152	//=============================================================================
00153	
00154	function SyncAnimation(float tween)
00155	{
00156		local Name UpperName;
00157	
00158		if(!RunePlayer(Owner).bIsCrouching)
00159		{
00160			if(RunePlayer(Owner).Velocity.X * RunePlayer(Owner).Velocity.X + RunePlayer(Owner).Velocity.Y * RunePlayer(Owner).Velocity.Y < 1000)
00161			{ // Waiting
00162				if(RunePlayer(Owner).Weapon==None)
00163				{ // Exploration mode
00164					UpperName = 'neutral_idle';
00165				}
00166				else
00167				{ // Combat Mode
00168					UpperName = RunePlayer(Owner).Weapon.A_Idle;
00169				}
00170	/*
00171				if(RunePlayer(Owner).Shield == None)
00172				{
00173					if(RunePlayer(Owner).Weapon == None)
00174					{ // Idle, no shield, no weapon
00175						UpperName = 'IDL_ALL_breathe1_AN0N';		
00176					}
00177					else
00178					{ // Idle, no shield, with a weapon
00179						UpperName = 'IDL_ALL_breathe1_AA0N';
00180					}
00181				}
00182				else
00183				{
00184					if(RunePlayer(Owner).Weapon == None)
00185					{ // Idle, with a shield, no weapon
00186						UpperName = 'IDL_ALL_breathe1_AN0S';		
00187					}
00188					else
00189					{ // Idle with both a shield and a weapon
00190						UpperName = 'IDL_ALL_breathe1_AA0S';
00191					}
00192				}
00193	*/
00194			}
00195			else
00196			{ // Running	
00197				if(RunePlayer(Owner).Shield == None)
00198				{
00199					if(RunePlayer(Owner).Weapon == None)
00200					{ // Run, no shield, no weapon
00201						UpperName = 'MOV_ALL_run1_AN0N';
00202					}
00203					else
00204					{ // Run, no shield, with a weapon
00205						UpperName = 'MOV_ALL_run1_AA0N';
00206					}
00207				}
00208				else
00209				{
00210					if(RunePlayer(Owner).Weapon == None)
00211					{ // Run, with a shield, no weapon
00212						UpperName = 'MOV_ALL_run1_AN0S';
00213					}
00214					else
00215					{ // Run, with both a shield and a weapon
00216						UpperName = 'MOV_ALL_run1_AA0S';
00217					}
00218				}
00219			}
00220		}
00221		else
00222		{ // Crouching
00223			if(RunePlayer(Owner).Velocity.X * RunePlayer(Owner).Velocity.X + RunePlayer(Owner).Velocity.Y * RunePlayer(Owner).Velocity.Y < 1000)
00224			{ // Waiting
00225				if(RunePlayer(Owner).Shield == None)
00226				{
00227					if(RunePlayer(Owner).Weapon == None)
00228					{ // Idle, no shield, no weapon
00229						UpperName = 'IDL_ALL_crbreathe1_AN0N';		
00230					}
00231					else
00232					{ // Idle, no shield, with a weapon
00233						UpperName = 'IDL_ALL_crbreathe1_AA0N';
00234					}
00235				}
00236				else
00237				{
00238					if(RunePlayer(Owner).Weapon == None)
00239					{ // Idle, with a shield, no weapon
00240						UpperName = 'IDL_ALL_crbreathe1_AN0S';		
00241					}
00242					else
00243					{ // Idle with both a shield and a weapon
00244						UpperName = 'IDL_ALL_crbreathe1_AA0S';
00245					}
00246				}
00247			}
00248			else
00249			{ // Running	
00250				if(RunePlayer(Owner).Shield == None)
00251				{
00252					if(RunePlayer(Owner).Weapon == None)
00253					{ // Run, no shield, no weapon
00254						UpperName = 'MOV_ALL_crrun1_AN0N';
00255					}
00256					else
00257					{ // Run, no shield, with a weapon
00258						UpperName = 'MOV_ALL_crrun1_AA0N';
00259					}
00260				}
00261				else
00262				{
00263					if(RunePlayer(Owner).Weapon == None)
00264					{ // Run, with a shield, no weapon
00265						UpperName = 'MOV_ALL_crrun1_AN0S';
00266					}
00267					else
00268					{ // Run, with both a shield and a weapon
00269						UpperName = 'MOV_ALL_crrun1_AA0S';
00270					}
00271				}
00272			}
00273		}
00274	
00275		PlayAnim(UpperName, 1.0, tween);
00276	}
00277	
00278	//----- Animation Playing Functions -----
00279	
00280	//=============================================================================
00281	//
00282	// ProxyStowWeapon
00283	//
00284	//=============================================================================
00285	
00286	function ProxyStowWeapon(int type)
00287	{
00288		DoStowIndex = type;
00289	
00290		if(!RunePlayer(Owner).bIsCrouching)
00291		{
00292			if(type == 0)
00293			{
00294				PlayAnim('IDL_ALL_sstow1_AA0S', 1.0, 0.1);
00295			}
00296			else if(type == 1)
00297			{
00298				PlayAnim('IDL_ALL_hstow1_AA0S', 1.0, 0.1);
00299			}
00300			else if(type == 2)
00301			{
00302				PlayAnim('IDL_ALL_xstow1_AA0S', 1.0, 0.1);
00303			}
00304			else
00305			{
00306				PlayAnim('IDL_ALL_drop1_AA0S', 1.0, 0.1);		
00307			}
00308		}
00309		else
00310		{
00311			if(type == 0)
00312			{
00313				PlayAnim('IDL_ALL_crsstow1_AA0N', 1.0, 0.1);
00314			}
00315			else if(type == 1)
00316			{
00317				PlayAnim('IDL_ALL_crhstow1_AA0N', 1.0, 0.1);
00318			}
00319			else if(type == 2)
00320			{
00321				PlayAnim('IDL_ALL_crxstow1_AA0N', 1.0, 0.1);
00322			}
00323			else
00324			{
00325				PlayAnim('IDL_ALL_crdrop1_AA0N', 1.0, 0.1);		
00326			}
00327		}
00328	}
00329	
00330	//=============================================================================
00331	//
00332	// ProxyDropWeapon
00333	//
00334	//=============================================================================
00335	
00336	function ProxyDropWeapon()
00337	{
00338		if(!RunePlayer(Owner).bIsCrouching)
00339		{
00340			PlayAnim('IDL_ALL_drop1_AA0S', 1.0, 0.1);		
00341		}
00342		else
00343		{
00344			PlayAnim('IDL_ALL_crdrop1_AA0S', 1.0, 0.1);		
00345		}
00346	}
00347	
00348	//=============================================================================
00349	//
00350	// ProxyPickup
00351	//
00352	//=============================================================================
00353	
00354	function ProxyPickup()
00355	{
00356		local float deltaZ;
00357		local name anim;
00358	
00359		deltaZ = (PendingItem.GetJointPos(0).Z - RunePlayer(Owner).Location.Z);
00360	
00361		if(PendingItem.IsA('Stein'))
00362		{ // FOOD TEST
00363			anim = 'DrinkLow';
00364			BlendAnimSequence = 'DrinkHigh';
00365	
00366			BlendAnimAlpha = (deltaZ + 40) / 85;
00367			if(BlendAnimAlpha < 0)
00368				BlendAnimAlpha = 0;
00369			else if(BlendAnimAlpha < 0)
00370				BlendAnimAlpha = 0;
00371	
00372			RunePlayer(Owner).BlendAnimSequence = BlendAnimSequence;
00373			RunePlayer(Owner).BlendAnimAlpha = BlendAnimAlpha;
00374		}
00375		else if(PendingItem.IsA('Food'))
00376		{
00377			anim = 'EatLow';
00378			BlendAnimSequence = 'EatHigh';
00379	
00380			BlendAnimAlpha = (deltaZ + 40) / 85;
00381			if(BlendAnimAlpha < 0)
00382				BlendAnimAlpha = 0;
00383			else if(BlendAnimAlpha < 0)
00384				BlendAnimAlpha = 0;
00385	
00386			RunePlayer(Owner).BlendAnimSequence = BlendAnimSequence;
00387			RunePlayer(Owner).BlendAnimAlpha = BlendAnimAlpha;
00388		}
00389		else if(PendingItem.IsA('Sword') 
00390			&& (PendingItem.Rotation.Roll & 65535) > 12000 && (PendingItem.Rotation.Roll & 65535) < 20000)
00391		{ // Pickup a sword that is pointing downward (stuck in something... such as a body)
00392			if(deltaZ <= -14)
00393			{ // Low, no blend
00394				anim = 'SwordPullOutLow';
00395			}
00396			else if(deltaZ >= 14)
00397			{ // Overhead, no blend
00398				anim = 'SwordPullOutHigh';
00399			}
00400			else
00401			{ // Blend to fit the desired pickup location
00402				anim = 'SwordPullOutLow';
00403				
00404				BlendAnimSequence = 'SwordPullOutLow';
00405				BlendAnimAlpha = (deltaZ + 14) / 28;
00406				RunePlayer(Owner).BlendAnimSequence = BlendAnimSequence;
00407				RunePlayer(Owner).BlendAnimAlpha = BlendAnimAlpha;
00408			}
00409		}
00410		else if(PendingItem.IsA('Shield') || PendingItem.IsA('Runes'))
00411		{ // Shields and Runes are picked up with the left hand
00412			// Blend to fit the desired pickup location (-40, 45)
00413			if(RunePlayer(Owner).Weapon == None)
00414			{ // Neutral
00415				anim = 'PickupGroundLeft'; 
00416				BlendAnimSequence = 'PickupHighLeft';
00417			}
00418			else
00419			{
00420				anim = RunePlayer(Owner).Weapon.A_PickupGroundLeft;
00421				BlendAnimSequence = RunePlayer(Owner).Weapon.A_PickupHighLeft;
00422			}
00423	
00424			BlendAnimAlpha = (deltaZ + 40) / 85;
00425			RunePlayer(Owner).BlendAnimSequence = BlendAnimSequence;
00426			RunePlayer(Owner).BlendAnimAlpha = BlendAnimAlpha;
00427		}
00428		else if(PendingItem.IsA('Weapon'))
00429		{
00430			if(deltaZ <= -40)
00431			{ // On the ground, no blend
00432				anim = 'PickupGround';
00433			}
00434			else if(deltaZ >= 45)
00435			{ // Overhead, no blend
00436				anim = 'PickupOverhead';
00437			}
00438			else
00439			{ // Blend to fit the desired pickup location
00440				anim = 'PickupWaist';
00441				
00442				if(deltaZ < 0)
00443				{
00444					BlendAnimSequence = 'PickupGround';
00445					BlendAnimAlpha = (-deltaZ) / 40;
00446					RunePlayer(Owner).BlendAnimSequence = 'PickupGround';
00447					RunePlayer(Owner).BlendAnimAlpha = (-deltaZ) / 40;
00448				}
00449				else
00450				{
00451					BlendAnimSequence = 'PickupOverhead';
00452					BlendAnimAlpha = deltaZ / 45;
00453					RunePlayer(Owner).BlendAnimSequence = 'PickupOverhead';
00454					RunePlayer(Owner).BlendAnimAlpha = deltaZ / 45;
00455				}
00456			}
00457		}
00458	
00459		PlayAnim(anim, 1.0, 0.1);		
00460		RunePlayer(Owner).TryPlayTorsoAnim(anim, 1.0, 0.1);
00461	}
00462	
00463	//=============================================================================
00464	//
00465	// ProxyDonePickup
00466	//
00467	//=============================================================================
00468	
00469	function ProxyDonePickup()
00470	{
00471		// Destroy blend info
00472		BlendAnimSequence = '';
00473		BlendAnimAlpha = 0;
00474		RunePlayer(Owner).BlendAnimSequence = '';
00475		RunePlayer(Owner).BlendAnimAlpha = 0;
00476	}
00477	
00478	//=============================================================================
00479	//
00480	// ProxyThrowWeapon
00481	//
00482	//=============================================================================
00483	
00484	function ProxyThrowWeapon()
00485	{
00486	}
00487	
00488	//=============================================================================
00489	//
00490	// ThrowGhost
00491	//
00492	// Notify for Throw powerup
00493	//=============================================================================
00494	function ThrowGhost()
00495	{
00496		if (!RunePlayer(Owner).IsAnimating() || RunePlayer(Owner).AnimSequence != 'ghostthrow')
00497			RunePlayer(Owner).ThrowGhost();
00498	}
00499	
00500	//=============================================================================
00501	//
00502	// SwitchWeapon
00503	//
00504	// The player wants to switch to a given weapon number
00505	//
00506	// 1 - Fists
00507	// 2 - Sword
00508	// 3 - Hammer
00509	// 4 - Axe
00510	//=============================================================================
00511	
00512	function SwitchWeapon(byte F)
00513	{
00514		PendingSwitchWeapon = F;
00515	}
00516	
00517	
00518	//=============================================================================
00519	//
00520	// WeaponActivate
00521	//
00522	//=============================================================================
00523	
00524	function WeaponActivate()
00525	{
00526		local Weapon Weapon;
00527	
00528		Weapon = RunePlayer(Owner).Weapon;
00529		if(Weapon != None)
00530		{
00531			RunePlayer(Owner).WeaponActivate();
00532			RunePlayer(Owner).Weapon.PlaySwipeSound();
00533	
00534			// Call WeaponFire based upon the attack
00535			if(AnimSequence == Weapon.A_AttackA || AnimSequence == Weapon.A_AttackStandA 
00536				|| AnimSequence == Weapon.A_AttackBackupA || AnimSequence == Weapon.A_AttackStrafeRight
00537				|| AnimSequence == Weapon.A_AttackStrafeLeft)
00538			{
00539				RunePlayer(Owner).Weapon.WeaponFire(0);
00540			}
00541			else if(AnimSequence == Weapon.A_AttackB || AnimSequence == Weapon.A_AttackStandB || AnimSequence == Weapon.A_AttackBackupB)
00542				RunePlayer(Owner).Weapon.WeaponFire(1);
00543			else if(AnimSequence == Weapon.A_AttackC)
00544				RunePlayer(Owner).Weapon.WeaponFire(2);
00545			else if(AnimSequence == Weapon.A_AttackD)
00546				RunePlayer(Owner).Weapon.WeaponFire(3);
00547		}
00548	}
00549	
00550	//=============================================================================
00551	//
00552	// WeaponDeactivate
00553	//
00554	// Swipe Effect Notify
00555	//=============================================================================
00556	
00557	function WeaponDeactivate()
00558	{
00559		if(RunePlayer(Owner).Weapon != None)
00560		{
00561			RunePlayer(Owner).WeaponDeactivate();
00562	//		RunePlayer(Owner).Weapon.FinishAttack();
00563		}
00564	}
00565	
00566	//=============================================================================
00567	//
00568	// SwipeEffectStart
00569	//
00570	// Swipe Effect Notify
00571	//=============================================================================
00572	
00573	function SwipeEffectStart()
00574	{
00575		if(RunePlayer(Owner).Weapon != None)
00576		{
00577			RunePlayer(Owner).Weapon.EnableSwipeTrail();
00578		}
00579	}
00580	
00581	//=============================================================================
00582	//
00583	// SwipeEffectEnd
00584	//
00585	// Swipe Effect Notify
00586	//=============================================================================
00587	
00588	function SwipeEffectEnd()
00589	{
00590		if(RunePlayer(Owner).Weapon != None)
00591		{
00592			RunePlayer(Owner).Weapon.DisableSwipeTrail();
00593		}
00594	}
00595	
00596	
00597	//=============================================================================
00598	//
00599	// SwipeEffectCombo
00600	//
00601	// Swipe Effect Notify
00602	//=============================================================================
00603	
00604	function SwipeEffectCombo()
00605	{
00606	}
00607	
00608	//=============================================================================
00609	//
00610	// ClearSwipeArray
00611	//
00612	// ClearSwipeArray Notify
00613	//=============================================================================
00614	
00615	function ClearSwipeArray()
00616	{
00617		WeaponActivate();
00618	}
00619	
00620	//=============================================================================
00621	//
00622	// RopeClimb
00623	//
00624	// RopeClimb Notify
00625	//=============================================================================
00626	
00627	function RopeClimb()
00628	{
00629		Owner.PlaySound(RunePlayer(Owner).RopeClimbSound[Rand(3)], SLOT_Interact, 
00630			1.0, false, 1200, FRand() * 0.08 + 0.96);
00631	}
00632	
00633	//=============================================================================
00634	//
00635	// SwimSplash
00636	//
00637	// Splash notify
00638	//=============================================================================
00639	
00640	function SwimSplash()
00641	{
00642		local vector loc;
00643	
00644		if(RunePlayer(Owner).bSurfaceSwimming)
00645		{
00646			loc = Owner.GetJointPos(Owner.JointNamed('rwrist')) + vect(0, 0, 4);
00647			Spawn(class'Ripple2',,, loc);
00648			loc = Owner.GetJointPos(Owner.JointNamed('lwrist')) + vect(0, 0, 4);
00649			Spawn(class'Ripple2',,, loc);
00650		}
00651		else
00652		{
00653		}
00654	}
00655	
00656	//=============================================================================
00657	//
00658	// DoStow
00659	//
00660	//=============================================================================
00661	
00662	function DoStow()
00663	{
00664		local vector v;
00665	
00666		if(DoStowType == DST_NONE)
00667		{
00668			return;
00669		}
00670		else if(DoStowType == DST_STOW)
00671		{ // Stow
00672			if(RunePlayer(Owner).Weapon != None)
00673			{
00674				if(RunePlayer(Owner).Weapon.IsA('NonStow'))
00675				{
00676					// Play Weapon Drop Sound
00677					RunePlayer(Owner).PlaySound(RunePlayer(Owner).WeaponDropSound, SLOT_Talk, 1.0, false, 1200, FRand() * 0.08 + 0.96);
00678					RunePlayer(Owner).DropWeapon();
00679				}
00680				else
00681				{
00682					RunePlayer(Owner).StowWeapon(None);
00683				}
00684			}
00685		}
00686		else if(DoStowType == DST_RETRIEVE)
00687		{ // Retrieve
00688			RunePlayer(Owner).RetrieveWeapon(DoStowIndex);
00689		}	
00690		else if(DoStowType == DST_PICKUP && PendingItem != None)
00691		{ // Pickup		
00692			if(PendingItem.IsA('Weapon') || PendingItem.IsA('Shield') || PendingItem.IsA('Runes'))
00693			{ // Send a touch message to the object we are about to pick up,
00694			  // The actual pickup and attaching is handled in AcquireInventory
00695				PendingItem.Touch(RunePlayer(Owner));
00696			}
00697			else if(PendingItem.IsA('Food'))
00698			{
00699				PendingItem = PendingItem.SpawnCopy(RunePlayer(Owner));
00700	
00701				// NOTE:  Touch for food is handled in the notify (when they are actually activated)
00702				RunePlayer(Owner).AttachActorToJoint(PendingItem, RunePlayer(Owner).JointNamed(RunePlayer(Owner).WeaponJoint));
00703				PendingItem.SetOwner(RunePlayer(Owner));
00704				PendingItem.PlaySound(Food(PendingItem).UseSound);
00705			}
00706		}		
00707		else if(DoStowType == DST_SWAP)
00708		{ // Swap current weapon with the next available weapon of type
00709			if(RunePlayer(Owner).Weapon != None)
00710			{ // Stow the current weapon, swap it with the next weapon, and then retrieve the next weapon
00711				RunePlayer(Owner).StowWeapon(None);
00712				RunePlayer(Owner).SwapStowToNext(DoStowIndex);
00713				RunePlayer(Owner).RetrieveWeapon(DoStowIndex);
00714			}
00715		}
00716	}
00717	
00718	//=============================================================================
00719	//
00720	// InventorySpecial1
00721	//
00722	// Generic inventory notify, passes it onto the inventory item in Ragnar's hand
00723	//=============================================================================
00724	
00725	function InventorySpecial1()
00726	{
00727		local actor A;
00728	
00729		if(RunePlayer(Owner).Weapon != None)
00730			RunePlayer(Owner).Weapon.InventorySpecial1();
00731		else
00732		{
00733			A = Owner.ActorAttachedTo(Owner.JointNamed(RunePlayer(Owner).WeaponJoint));
00734	
00735			if(A != None)
00736			{
00737				if(A.IsA('Inventory'))
00738					Inventory(A).InventorySpecial1();
00739				else if(A.IsA('DiscardedHealth'))
00740					DiscardedHealth(A).InventorySpecial1();
00741			}
00742		}
00743	}
00744	
00745	//=============================================================================
00746	//
00747	// InventorySpecial2
00748	//
00749	// Generic inventory notify, passes it onto the inventory item in Ragnar's hand
00750	//=============================================================================
00751	
00752	function InventorySpecial2()
00753	{
00754		local actor A;
00755	
00756		if(RunePlayer(Owner).Weapon != None)
00757			RunePlayer(Owner).Weapon.InventorySpecial2();
00758		else
00759		{
00760			A = Owner.ActorAttachedTo(Owner.JointNamed(RunePlayer(Owner).WeaponJoint));
00761	
00762			if(A != None)
00763			{
00764				if(A.IsA('Inventory'))
00765					Inventory(A).InventorySpecial2();
00766				else if(A.IsA('DiscardedHealth'))
00767					DiscardedHealth(A).InventorySpecial2();
00768			}
00769		}
00770	}
00771	
00772	//=============================================================================
00773	//
00774	// InventorySpecial3
00775	//
00776	// Generic inventory notify, passes it onto the inventory item in Ragnar's hand
00777	//=============================================================================
00778	
00779	function InventorySpecial3()
00780	{
00781		local actor A;
00782	
00783		if(RunePlayer(Owner).Weapon != None)
00784			RunePlayer(Owner).Weapon.InventorySpecial3();
00785		else
00786		{
00787			A = Owner.ActorAttachedTo(Owner.JointNamed(RunePlayer(Owner).WeaponJoint));
00788	
00789			if(A != None)
00790			{
00791				if(A.IsA('Inventory'))
00792					Inventory(A).InventorySpecial3();
00793				else if(A.IsA('DiscardedHealth'))
00794					DiscardedHealth(A).InventorySpecial3();
00795			}
00796		}
00797	}
00798	
00799	//=============================================================================
00800	//
00801	// UseNotify
00802	//
00803	// Notify used by animations to specify when the use should occur
00804	//=============================================================================
00805	
00806	function UseNotify()
00807	{
00808		if(RunePlayer(Owner).UseActor != None)
00809			RunePlayer(Owner).UseActor.UseTrigger(RunePlayer(Owner));
00810	
00811		RunePlayer(Owner).UseActor = None;
00812	}
00813	
00814	// ----- Utility Functions -----
00815	
00816	//=============================================================================
00817	//
00818	// GetStowIndex
00819	//
00820	//=============================================================================
00821	
00822	function int GetStowIndex(Weapon weapon)
00823	{
00824		return(Weapon.MeleeType);
00825	}
00826	
00827	//=============================================================================
00828	//
00829	// Use
00830	//
00831	//=============================================================================
00832	
00833	function bool Use()
00834	{
00835		return(false);
00836	}
00837	
00838	//=============================================================================
00839	//
00840	// CanPickUp
00841	//
00842	//=============================================================================
00843	
00844	function bool CanPickup(Inventory item)
00845	{
00846		return(false);
00847	}
00848	
00849	//=============================================================================
00850	//
00851	// WantsToPickup
00852	//
00853	//=============================================================================
00854	
00855	function bool WantsToPickup(Inventory item)
00856	{
00857		local Weapon cur, next, stow;
00858	
00859	/*		
00860		if(RunePlayer(Owner).Physics != PHYS_Walking 
00861			|| (RunePlayer(Owner).Velocity.X * RunePlayer(Owner).Velocity.X + RunePlayer(Owner).Velocity.Y * RunePlayer(Owner).Velocity.Y >= 1000))
00862		{ // Test:  Only allow RunePlayer(Owner) to pick things up if he's standing still and on the ground
00863			return(false);
00864		}
00865	*/
00866		if(item.IsA('Weapon') && !item.IsA('InvisibleWeapon'))
00867		{
00868			cur = RunePlayer(Owner).Weapon;		
00869			next = Weapon(item);
00870	
00871			if (RunePlayer(Owner).BodyPartMissing(BODYPART_RARM1))
00872				return false;
00873	
00874			// Disallow if item already held
00875			if (RunePlayer(Owner).FindInventoryType(item.Class) != None)
00876				return false;
00877	
00878			stow = RunePlayer(Owner).GetStowedWeapon(GetStowIndex(next));
00879	
00880			if(stow != None)
00881			{
00882				if(stow.IsA(next.Class.Name))
00883				{ // Don't pick up a weapon if it's identical to a stowed weapon
00884					return(false);
00885				}
00886			}
00887	
00888			if(cur == None)
00889			{
00890				return(true);
00891			}
00892	
00893			if(cur.IsA(next.Class.Name))
00894			{ // Don't pick up a weapon if it's identical to the current weapon
00895				return(false);
00896			}
00897			
00898			return(true);
00899		}
00900		else if(item.IsA('Shield'))
00901		{
00902			if (RunePlayer(Owner).BodyPartMissing(BODYPART_LARM1))
00903				return false;
00904	
00905			if(RunePlayer(Owner).Weapon != None && RunePlayer(Owner).Weapon.A_Defend == 'None')
00906			{ // Current weapon held cannot be used with a shield
00907				return(false);
00908			}
00909	
00910			if(RunePlayer(Owner).Shield != None && RunePlayer(Owner).Shield.IsA('MagicShield'))
00911				return(false); // Cannot swap magic shields for other shields
00912	
00913			return(RunePlayer(Owner).Shield == None || Shield(item).Health > RunePlayer(Owner).Shield.Health);
00914		}	
00915		else if(item.IsA('Runes'))
00916		{
00917			return(Runes(item).PawnWantsRune(Pawn(Owner)));
00918		}
00919		else if(item.IsA('Food'))
00920		{
00921			if(RunePlayer(Owner).Health < RunePlayer(Owner).MaxHealth ||
00922				RunePlayer(Owner).BodyPartMissing(BODYPART_LARM1) ||
00923				RunePlayer(Owner).BodyPartMissing(BODYPART_RARM1))
00924				return(true);
00925		}
00926			
00927		return(false);
00928	}
00929	
00930	//=============================================================================
00931	//
00932	// RetrieveLastHeldWeapon
00933	//
00934	//=============================================================================
00935	
00936	function RetrieveLastHeldWeapon()
00937	{
00938		if(RunePlayer(Owner).LastHeldWeapon == None)
00939			return;
00940	
00941		if(RunePlayer(Owner).LastHeldWeapon.IsA('NonStow'))
00942			return;
00943	
00944		PendingSwitchWeapon = 0;
00945		index = GetStowIndex(RunePlayer(Owner).LastHeldWeapon);
00946	
00947		RunePlayer(Owner).LastHeldWeapon = None;
00948	
00949		GotoState('Switching');
00950	}
00951	
00952	// ----- Proxy States -----
00953	
00954	//-----------------------------------------------------------------------------
00955	//
00956	// Idle
00957	//
00958	//-----------------------------------------------------------------------------
00959	
00960	auto state Idle
00961	{
00962		//=========================================================================
00963		//
00964		// SwitchWeapon
00965		//
00966		// The player wants to switch to a given weapon number
00967		//
00968		// 1 - Fists
00969		// 2 - Sword
00970		// 3 - Hammer
00971		// 4 - Axe
00972		//=========================================================================
00973		
00974		function SwitchWeapon(byte F)
00975		{
00976			PendingSwitchWeapon = 0;
00977			if(F <= 4)
00978			{
00979				index = F - 2; // Subtract 2 because FISTS are weapon #1
00980	
00981				GotoState('Switching');
00982			}
00983		}
00984	
00985		//=========================================================================
00986		//
00987		// CanPickUp
00988		//
00989		// This CanPickUp is called when RunePlayer(Owner) touches a pickupable object,
00990		// so bAutoPickup is checked first
00991		//=========================================================================
00992	
00993		function bool CanPickup(Inventory item)
00994		{
00995			local Weapon cur, next, stow;
00996	
00997			if(!Level.Game.bAutoPickup && !Owner.IsInState('PlayerSwimming'))
00998			{ // Auto weapon pickup if autopickup is set, or if swimming
00999				return(false);	
01000			}
01001	
01002			if(item.IsA('Weapon') && !item.IsA('InvisibleWeapon'))
01003			{
01004				cur = RunePlayer(Owner).Weapon;
01005				next = Weapon(item);
01006	
01007				stow = RunePlayer(Owner).GetStowedWeapon(GetStowIndex(next));
01008	
01009				// Disallow if item already held
01010				if (RunePlayer(Owner).FindInventoryType(item.Class) != None)
01011					return false;
01012	
01013				// Don't allow picking up non-stow items while swimming
01014				if(Owner.IsInState('PlayerSwimming') && item.IsA('NonStow'))
01015					return(false);
01016	
01017				if(cur == None)
01018				{
01019					return(true);
01020				}
01021				else if(cur != None && item.IsA('NonStow'))
01022				{
01023					return(false);
01024				}
01025	
01026				return(true);
01027			}
01028			else if(item.IsA('Shield'))
01029			{
01030				if(RunePlayer(Owner).Weapon != None && RunePlayer(Owner).Weapon.A_Defend == 'None')
01031				{ // Current weapon held cannot be used with a shield
01032					return(false);
01033				}
01034	
01035				if(RunePlayer(Owner).Shield != None && RunePlayer(Owner).Shield.IsA('MagicShield'))
01036					return(false); // Cannot swap magic shields
01037	
01038				return(RunePlayer(Owner).Shield == None || Shield(item).Health > RunePlayer(Owner).Shield.Health);
01039			}	
01040			else if(item.IsA('Runes'))
01041			{
01042				return(Runes(item).PawnWantsRune(Pawn(Owner)));
01043			}
01044			else if(item.IsA('Food'))
01045			{
01046				return(RunePlayer(Owner).Health < RunePlayer(Owner).MaxHealth);
01047			}
01048	
01049			return(false);
01050		}
01051	
01052		//=========================================================================
01053		//
01054		// Use
01055		//
01056		//=========================================================================
01057	
01058		function bool Use()
01059		{
01060			GotoState('PickingUp');
01061			return(true);
01062		}
01063		
01064		//=========================================================================
01065		//
01066		// Attack
01067		//
01068		// Normal Attack (Double click attack is handled inside the attack state)
01069		// TODO:  Move this out of the idle and make it univeral (??)
01070		//=========================================================================
01071		
01072		function bool Attack()
01073		{
01074			local float dp;
01075			local vector X, Y, Z;
01076			local bool bRight;
01077			local int i;
01078	
01079			TorsoIntroAnim = 'None';
01080			TorsoLoop = 'None';
01081	
01082			if(RunePlayer(Owner).Weapon == None || RunePlayer(Owner).Weapon.A_AttackA == 'None')
01083				return(false);
01084	
01085			// Determine the direction the player is attempting to move
01086			GetAxes(RunePlayer(Owner).Rotation, X, Y, Z);
01087			dp = vector(RunePlayer(Owner).Rotation) dot Normal(RunePlayer(Owner).Acceleration);
01088	
01089			if(Normal(RunePlayer(Owner).Acceleration) dot Y >= 0)
01090			{
01091				bRight = true;
01092			}
01093			else
01094			{
01095				bRight = false;
01096			}
01097	
01098			if(RunePlayer(Owner).bIsCrouching)
01099			{ // Crouch attack
01100				if(dp < 0.9 && dp > -0.9)
01101				{ // Strafing
01102					if(bRight)
01103					{ // Strafe right
01104					TorsoAnim = RunePlayer(Owner).Weapon.A_AttackStrafeRight;
01105					}
01106					else
01107					{ // Strafe left
01108					TorsoAnim = RunePlayer(Owner).Weapon.A_AttackStrafeLeft;
01109					}
01110				}
01111				else
01112					TorsoAnim = RunePlayer(Owner).Weapon.A_AttackStrafeRight;
01113	
01114				GotoState('Attacking');
01115				return(true);
01116			}
01117	
01118			if(RunePlayer(Owner).Velocity.X * RunePlayer(Owner).Velocity.X + RunePlayer(Owner).Velocity.Y * RunePlayer(Owner).Velocity.Y < 1000)
01119			{ // Standing Still
01120				TorsoAnim = RunePlayer(Owner).Weapon.A_AttackStandA;		
01121			}
01122			else if(dp > 0.9)
01123			{ // Distinctly forward
01124				if(RunePlayer(Owner).AnimSequence == RunePlayer(Owner).Weapon.A_Jump)
01125				{ // Jump Attack and moving forward results in a special spin attack
01126					TorsoAnim = RunePlayer(Owner).Weapon.A_JumpAttack;
01127					
01128					GotoState('Attacking');
01129					return(true);			
01130				}
01131				else
01132				{
01133					TorsoAnim = RunePlayer(Owner).Weapon.A_AttackA;		
01134				}
01135			}
01136			else if(dp < -0.9)
01137			{ // Distinctly backward
01138				TorsoAnim = RunePlayer(Owner).Weapon.A_AttackBackupA;
01139			}
01140			else if(bRight)
01141			{ // Strafe right
01142				TorsoAnim = RunePlayer(Owner).Weapon.A_AttackStrafeRight;
01143			}
01144			else
01145			{ // Strafe left
01146				TorsoAnim = RunePlayer(Owner).Weapon.A_AttackStrafeLeft;
01147			}
01148			
01149			// If berserking, play a random berserk yell (if an enemy is nearby)
01150			if(RunePlayer(Owner).bBloodLust && RunePlayer(Owner).LookTarget != None
01151				&& RunePlayer(Owner).LookTarget.IsA('Pawn'))
01152			{
01153				i = Rand(6);
01154				RunePlayer(Owner).PlaySound(RunePlayer(Owner).BerserkYellSound[i], 
01155					SLOT_Talk, 1.0, false, 1200, FRand() * 0.08 + 0.96);			
01156			}	
01157	
01158			GotoState('Attacking');
01159	
01160			return(true);
01161		}
01162		
01163		//=========================================================================
01164		//
01165		// Defend
01166		// 
01167		//=========================================================================
01168		
01169		function bool Defend()
01170		{
01171			if(RunePlayer(Owner).Shield != None)
01172			{
01173				GotoState('Defending');
01174				return(true);
01175			}
01176			else
01177				return(false);
01178		}
01179	
01180		//=========================================================================
01181		//
01182		// Throw
01183		//
01184		//=========================================================================
01185		
01186		function bool Throw()
01187		{
01188			GotoState('Throwing');
01189			return(true);
01190		}
01191	
01192	begin:
01193		if(RunePlayer(Owner).bAltFire == 1 && RunePlayer(Owner).Shield != None)
01194		{
01195			GotoState('Defending');
01196		}
01197		else if(PendingSwitchWeapon != 0)
01198		{
01199			SwitchWeapon(PendingSwitchWeapon);
01200		}
01201	}
01202	
01203	//-----------------------------------------------------------------------------
01204	//
01205	// Switching
01206	//
01207	//-----------------------------------------------------------------------------
01208	
01209	state Switching
01210	{
01211		function TryPlayAnim(Name anim, optional float rate, optional float tween) {}
01212		function TryLoopAnim(Name anim, optional float rate, optional float tween) {}
01213		function TryTweenAnim(Name anim, optional float tween) {}
01214	
01215		function bool CanGotoPainState()
01216		{
01217			return(false);
01218		}
01219	
01220		//==========================================================================
01221		//
01222		// CanPickUp
01223		//
01224		//==========================================================================
01225	
01226		function bool CanPickup(Inventory item)
01227		{
01228			return(false);
01229		}
01230		
01231	begin:			
01232		curWeapon = RunePlayer(Owner).Weapon;
01233		newWeapon = RunePlayer(Owner).GetStowedWeapon(index);
01234		nextWeapon = RunePlayer(Owner).GetNextWeapon(curWeapon);
01235		RunePlayer(Owner).LastHeldWeapon = None;
01236	
01237		if(curWeapon != None && GetStowIndex(curWeapon) == index && nextWeapon != None
01238			&& nextWeapon != curWeapon && newWeapon != None)
01239		{ // Swap between weapons of similar types
01240			DoStowType = DST_SWAP;
01241			ProxyStowWeapon(index);
01242			FinishAnim();
01243	
01244			// Activate the current weapon	
01245			RunePlayer(Owner).Weapon.GotoState('Active');
01246	
01247			goto('done');
01248		}
01249		else if(curWeapon != None)
01250		{
01251			if(index >= 0)
01252			{ // Real weapon (not fists)
01253				if(newWeapon == None)
01254				{ // No weapon of type was stowed
01255					goto('done');
01256				}
01257			}
01258	
01259			DoStowType = DST_STOW;
01260			ProxyStowWeapon(GetStowIndex(curWeapon));
01261			FinishAnim();
01262		}		
01263	
01264		if(index == -1)
01265		{ // Fists (no weapon)
01266			RunePlayer(Owner).Weapon = None;
01267			goto('done');
01268		}
01269	
01270		if(newWeapon != None)
01271		{
01272			DoStowType = DST_RETRIEVE;
01273			ProxyStowWeapon(index);
01274			FinishAnim();
01275		}
01276	
01277		// Retrieve the current weapon	
01278		if(RunePlayer(Owner).Weapon != None)
01279			RunePlayer(Owner).Weapon.GotoState('Active');
01280	
01281	done:		
01282		if(RunePlayer(Owner).Weapon != None && RunePlayer(Owner).Weapon.A_Defend == 'None')
01283		{ // This weapon just switched to cannot be used with a shield
01284			RunePlayer(Owner).DropShield();
01285		}
01286	
01287		if(Owner.Region.Zone.bWaterZone)
01288			RunePlayer(Owner).InstantStow(); // Disallow switching weapons while jumping into water
01289		
01290		RunePlayer(Owner).SetMovementMode(); // Set combat or exploration mode
01291	
01292		SyncAnimation(0.3);
01293		GotoState('Idle');
01294	}
01295	
01296	//-----------------------------------------------------------------------------
01297	//
01298	// PickingUp
01299	//
01300	//-----------------------------------------------------------------------------
01301	
01302	state PickingUp
01303	{
01304		function TryPlayAnim(Name anim, optional float rate, optional float tween) {}
01305		function TryLoopAnim(Name anim, optional float rate, optional float tween) {}
01306		function TryTweenAnim(Name anim, optional float tween) {}
01307	
01308		function EndState()
01309		{
01310		}
01311	
01312		function bool CanGotoPainState()
01313		{
01314			return(false);
01315		}
01316		
01317		//=========================================================================
01318		//
01319		// CanPickUp
01320		//
01321		//=========================================================================
01322	
01323		function bool CanPickup(Inventory item)
01324		{
01325			return(item == PendingItem);
01326		}
01327	
01328		//=========================================================================
01329		//
01330		// FindPickupItem
01331		// 
01332		//=========================================================================
01333	
01334		function FindPickupItem()
01335		{
01336			PendingItem = None;
01337			
01338			if(RunePlayer(Owner).UseActor.Owner != None)
01339			{
01340				return;
01341			}
01342	
01343			PendingItem = Inventory(RunePlayer(Owner).UseActor);
01344		}
01345	
01346	
01347	begin:
01348		FindPickupItem();
01349		RunePlayer(Owner).LastHeldWeapon = None;
01350		if(PendingItem != None)
01351		{ // Retrieve the current item
01352			PendingItem.LifeSpan = 0; // This item is about to be picked up, so it shouldn't go away
01353			PendingItem.Style = Default.Style; // Item could possibly be in fade-out alpha blend mode
01354				
01355			RunePlayer(Owner).UninterruptedAnim = 'None';
01356			RunePlayer(Owner).GotoState('Uninterrupted'); // Don't allow the lower-body to move while picking up		
01357	
01358			if(PendingItem.IsA('Food'))
01359			{ // Save the last weapon in RunePlayer(Owner)'s hand to switch back after eating food
01360				RunePlayer(Owner).LastHeldWeapon = RunePlayer(Owner).Weapon;
01361			}
01362	
01363			if(RunePlayer(Owner).Weapon != None && !PendingItem.IsA('Shield') && !PendingItem.IsA('Runes'))
01364			{ // If RunePlayer(Owner) has a weapon in his hand, stow it (or drop a weapon if it's a non-stow)
01365			  // No need to stow the weapon if picking up a shield or rune, which are done left-handed
01366				if(RunePlayer(Owner).Weapon.IsA('NonStow'))
01367					RunePlayer(Owner).LastHeldWeapon = None;
01368	
01369				DoStowType = DST_STOW;
01370				ProxyStowWeapon(GetStowIndex(RunePlayer(Owner).Weapon));
01371				FinishAnim();
01372			}
01373	
01374			// Pickup the new item		
01375			DoStowType = DST_PICKUP;
01376			RunePlayer(Owner).PlaySound(RunePlayer(Owner).WeaponPickupSound, SLOT_Talk, 1.0, false, 1200, FRand() * 0.08 + 0.96);
01377			ProxyPickup();
01378			FinishAnim();
01379			ProxyDonePickup();
01380			PendingItem = None;
01381			RunePlayer(Owner).GotoState('PlayerWalking');	
01382		}
01383	
01384		RunePlayer(Owner).SetMovementMode(); // Set combat or exploration mode
01385	
01386		if(RunePlayer(Owner).LastHeldWeapon == None)
01387		{
01388			SyncAnimation(0.4);
01389			GotoState('Idle');
01390		}
01391		else
01392			RetrieveLastHeldWeapon();
01393	}
01394	
01395	
01396	//-----------------------------------------------------------------------------
01397	//
01398	// Attacking
01399	//
01400	//-----------------------------------------------------------------------------
01401	
01402	state Attacking
01403	{
01404		function TryPlayAnim(Name anim, optional float rate, optional float tween) {}
01405		function TryLoopAnim(Name anim, optional float rate, optional float tween) {}
01406		function TryTweenAnim(Name anim, optional float tween) {}
01407	
01408		//==========================================================================
01409		//
01410		// CanPickUp
01411		//
01412		//==========================================================================
01413	
01414		function bool CanPickup(Inventory item)
01415		{
01416			return(false);
01417		}
01418	
01419		//=========================================================================
01420		//
01421		// BeginState
01422		//
01423		//=========================================================================
01424	
01425		function BeginState()
01426		{
01427			SwipeEffectStart(); // Guarantee that the swipe effect is turned on
01428		}
01429	
01430		//=========================================================================
01431		//
01432		// EndState
01433		//
01434		//=========================================================================
01435	
01436		function EndState()
01437		{
01438			WeaponDeactivate(); // Guarantee that the weapon is cold
01439			SwipeEffectEnd(); // Guarantee that the swipe effect is turned off
01440		}
01441	
01442		//=========================================================================
01443		//
01444		// StopAttack
01445		//
01446		//=========================================================================
01447		
01448		function StopAttack()
01449		{		
01450			WeaponDeactivate();
01451			SyncAnimation(0.3);
01452			SwipeEffectEnd(); // Guarantee that the swipe effect is turned off
01453			
01454			GotoState('Idle');
01455		}
01456	
01457		//=========================================================================
01458		//
01459		// Attack
01460		//
01461		// In the middle of an attack.  Can only combo if the attack allows it
01462		// Also controls taking over the player control for certain attacks
01463		//=========================================================================
01464	
01465		function bool Attack()
01466		{			
01467			if(RunePlayer(Owner).bIsCrouching)
01468				return(false); // No combos when crouching
01469	
01470			if(RunePlayer(Owner).Weapon == None)
01471				return(false);
01472	
01473			if(AnimSequence == RunePlayer(Owner).Weapon.A_AttackStandA && RunePlayer(Owner).Weapon.A_AttackStandB != 'None')
01474				TorsoAnim = RunePlayer(Owner).Weapon.A_AttackStandB;
01475			else if(AnimSequence == RunePlayer(Owner).Weapon.A_AttackA && RunePlayer(Owner).Weapon.A_AttackB != 'None')
01476				TorsoAnim = RunePlayer(Owner).Weapon.A_AttackB;
01477			else if(AnimSequence == RunePlayer(Owner).Weapon.A_AttackB && RunePlayer(Owner).Weapon.A_AttackC != 'None')
01478				TorsoAnim = RunePlayer(Owner).Weapon.A_AttackC;
01479			else if(AnimSequence == RunePlayer(Owner).Weapon.A_AttackC && RunePlayer(Owner).Weapon.A_AttackD != 'None')
01480				TorsoAnim = RunePlayer(Owner).Weapon.A_AttackD;
01481			else if(AnimSequence == RunePlayer(Owner).Weapon.A_AttackBackupA && RunePlayer(Owner).Weapon.A_AttackBackupB != 'None')
01482				TorsoAnim = RunePlayer(Owner).Weapon.A_AttackBackupB;
01483	
01484	
01485			return(true);
01486		}
01487	
01488		//=========================================================================
01489		//
01490		// Defend
01491		// 
01492		// Defending is not allowed in the middle of an attack
01493		//=========================================================================
01494	
01495		function bool Defend()
01496		{
01497			return(true);
01498		}
01499	
01500		//=========================================================================
01501		//
01502		// PlayAttack
01503		// 
01504		//=========================================================================
01505	
01506		function PlayAttack(float tween)
01507		{
01508			PlayAnim(TorsoAnim, 1.0, tween);
01509			RunePlayer(Owner).TryPlayTorsoAnim(TorsoAnim, 1.0, tween);
01510		}
01511	
01512	begin:
01513	doattack:
01514		if(RunePlayer(Owner).Weapon != None)
01515		{
01516	//CJR		if(TorsoAnim != RunePlayer(Owner).Weapon.A_JumpAttack)
01517	//CJR			RunePlayer(Owner).SpeedScale = SS_Other;
01518	
01519			PlayAttack(0.1); // Attack A
01520			Sleep(0.1); // Time to tween to the attack
01521			WeaponActivate(); // Activate the weapon for the attack (AFTER the tween)
01522			TorsoAnim = 'None';
01523			FinishAnim();
01524			WeaponDeactivate();
01525	
01526			if(TorsoAnim != 'None')
01527			{ // Combo B
01528				PlayAttack(0.0); // Attack B
01529				TorsoAnim = 'None';
01530				FinishAnim();
01531				WeaponDeactivate();
01532	
01533				if(TorsoAnim != 'None')
01534				{ // Combo C
01535					PlayAttack(0.0); // Attack C
01536					TorsoAnim = 'None';
01537					FinishAnim();
01538					WeaponDeactivate();
01539	
01540					if(TorsoAnim != 'None')
01541					{ // Combo D
01542						PlayAttack(0.0); // Attack D
01543						TorsoAnim = 'None';
01544						FinishAnim();
01545						WeaponDeactivate();
01546	
01547						if(RunePlayer(Owner).Weapon.A_AttackDReturn != 'None')
01548						{ // Return C
01549							TorsoAnim = RunePlayer(Owner).Weapon.A_AttackDReturn;
01550							PlayAttack(0.0);
01551							TorsoAnim = 'None';
01552							FinishAnim();
01553						}
01554					}
01555					else if(RunePlayer(Owner).Weapon.A_AttackCReturn != 'None')
01556					{ // Return C
01557						TorsoAnim = RunePlayer(Owner).Weapon.A_AttackCReturn;
01558						PlayAttack(0.0);
01559						TorsoAnim = 'None';
01560						FinishAnim();
01561					}
01562				}
01563				else if(AnimSequence == RunePlayer(Owner).Weapon.A_AttackB && RunePlayer(Owner).Weapon.A_AttackBReturn != 'None')
01564				{ // Return B
01565					TorsoAnim = RunePlayer(Owner).Weapon.A_AttackBReturn;
01566					PlayAttack(0.0);
01567					TorsoAnim = 'None';
01568					FinishAnim();
01569				}
01570				else if(AnimSequence == RunePlayer(Owner).Weapon.A_AttackBackupB && RunePlayer(Owner).Weapon.A_AttackBackupBReturn != 'None')
01571				{ // Backup Return B
01572					TorsoAnim = RunePlayer(Owner).Weapon.A_AttackBackupBReturn;
01573					PlayAttack(0.0);
01574					TorsoAnim = 'None';
01575					FinishAnim();
01576				}
01577				else if(AnimSequence == RunePlayer(Owner).Weapon.A_AttackStandB && RunePlayer(Owner).Weapon.A_AttackStandBReturn != 'None')
01578				{ // Stand Return B
01579					TorsoAnim = RunePlayer(Owner).Weapon.A_AttackStandBReturn;
01580					PlayAttack(0.0);
01581					TorsoAnim = 'None';
01582					FinishAnim();
01583				}
01584			}
01585			else if(AnimSequence == RunePlayer(Owner).Weapon.A_AttackA && RunePlayer(Owner).Weapon.A_AttackAReturn != 'None')
01586			{ // Return A
01587				TorsoAnim = RunePlayer(Owner).Weapon.A_AttackAReturn;
01588				PlayAttack(0.0);
01589				TorsoAnim = 'None';
01590				FinishAnim();
01591			}
01592			else if(AnimSequence == RunePlayer(Owner).Weapon.A_AttackBackupA && RunePlayer(Owner).Weapon.A_AttackBackupAReturn != 'None')
01593			{ // Backup Return A
01594				TorsoAnim = RunePlayer(Owner).Weapon.A_AttackBackupAReturn;
01595				PlayAttack(0.0);
01596				TorsoAnim = 'None';
01597				FinishAnim();
01598			}
01599			else if(AnimSequence == RunePlayer(Owner).Weapon.A_AttackStandA && RunePlayer(Owner).Weapon.A_AttackStandAReturn != 'None')
01600			{ // Stand Return A
01601				TorsoAnim = RunePlayer(Owner).Weapon.A_AttackStandAReturn;
01602				PlayAttack(0.0);
01603				TorsoAnim = 'None';
01604				FinishAnim();
01605			}
01606			
01607			WeaponDeactivate();
01608			RunePlayer(Owner).SetMovementMode();
01609		}
01610	
01611	done:
01612		SyncAnimation(0.01);
01613		GotoState('Idle');
01614	}
01615	
01616	//-----------------------------------------------------------------------------
01617	//
01618	// Defending
01619	//
01620	//-----------------------------------------------------------------------------
01621	
01622	state Defending
01623	{
01624		function TryPlayAnim(Name anim, optional float rate, optional float tween) {}
01625		function TryLoopAnim(Name anim, optional float rate, optional float tween) {}
01626		function TryTweenAnim(Name anim, optional float tween) {}
01627	
01628		//==========================================================================
01629		//
01630		// CanPickUp
01631		//
01632		//==========================================================================
01633	
01634		function bool CanPickup(Inventory item)
01635		{
01636			return(false);
01637		}
01638	
01639		//=========================================================================
01640		//
01641		// BeginState
01642		// 
01643		//=========================================================================
01644	
01645		function BeginState()
01646		{
01647			PlayDefend();
01648			RunePlayer(Owner).ActivateShield(true);
01649		}
01650	
01651		function AnimEnd()
01652		{	
01653			local name anim;
01654	
01655			if(RunePlayer(Owner).Weapon == None)
01656			{ // Neutral
01657				anim = 'neutral_defendTo';
01658			}
01659			else
01660			{ // Weapon-specific
01661				anim = RunePlayer(Owner).Weapon.A_Defend;
01662			}
01663	
01664			if(AnimSequence == anim)
01665				PlayDefendIdle();
01666		}
01667	
01668		//=========================================================================
01669		//
01670		// EndState
01671		// 
01672		//=========================================================================
01673	
01674		function EndState()
01675		{
01676			RunePlayer(Owner).ActivateShield(false);
01677		}
01678	
01679		//=========================================================================
01680		//
01681		// PlayDefend
01682		//
01683		//=========================================================================
01684	
01685		function PlayDefend()
01686		{
01687			local name anim;
01688	
01689			if(RunePlayer(Owner).Weapon == None)
01690			{ // Neutral
01691				anim = 'h3_defendTO';
01692			}
01693			else
01694			{ // Weapon-specific
01695				anim = RunePlayer(Owner).Weapon.A_Defend;
01696			}
01697	
01698			PlayAnim(anim, 1.5, 0.01);
01699	
01700			// Only play the anim on the legs if Ragnar isn't crouching
01701			if(!RunePlayer(Owner).bIsCrouching)
01702				RunePlayer(Owner).TryPlayTorsoAnim(anim, 1.0, 0.08); 
01703		}
01704	
01705		//=========================================================================
01706		//
01707		// PlayDefendIdle
01708		//
01709		//=========================================================================
01710	
01711		function PlayDefendIdle()
01712		{
01713			if(RunePlayer(Owner).Weapon == None)
01714			{
01715				if(RunePlayer(Owner).bIsCrouching)
01716					LoopAnim('crouch_defendidle', 1.0, 0.1);
01717				else
01718					LoopAnim('h3_defendIdle', 1.0, 0.1);
01719			}
01720			else
01721			{
01722				LoopAnim(RunePlayer(Owner).Weapon.A_DefendIdle, 1.0, 0.1);
01723			}
01724		}
01725	
01726		//=========================================================================
01727		//
01728		// SwitchWeapon
01729		// 
01730		//=========================================================================
01731	
01732		function SwitchWeapon(byte F)
01733		{
01734			PendingSwitchWeapon = 0;
01735			if(F <= 4)
01736			{
01737				index = F - 2; // Subtract 2 because FISTS are weapon #1
01738				
01739				GotoState('Switching');
01740			}
01741		}
01742		
01743	begin:
01744		if(RunePlayer(Owner).bAltFire == 1 && RunePlayer(Owner).Shield != None)
01745		{
01746			Sleep(0.01);
01747			goto('begin');
01748		}
01749	
01750		RunePlayer(Owner).ActivateShield(false);
01751		SyncAnimation(0.15);	
01752		GotoState('Idle');
01753	}
01754	
01755	//-----------------------------------------------------------------------------
01756	//
01757	// Throwing
01758	//
01759	//-----------------------------------------------------------------------------
01760	
01761	state Throwing
01762	{
01763		function TryPlayAnim(Name anim, optional float rate, optional float tween) {}
01764		function TryLoopAnim(Name anim, optional float rate, optional float tween) {}
01765		function TryTweenAnim(Name anim, optional float tween) {}
01766	
01767		//==========================================================================
01768		//
01769		// CanPickUp
01770		//
01771		//==========================================================================
01772	
01773		function bool CanPickup(Inventory item)
01774		{
01775			return(false);
01776		}
01777	
01778		//=========================================================================
01779		//
01780		// PlayThrowAnim
01781		// 
01782		//=========================================================================
01783	
01784		function PlayThrowAnim()
01785		{
01786			PlayAnim(RunePlayer(Owner).Weapon.A_Throw, 1.0, 0.1);		
01787			RunePlayer(Owner).TryPlayTorsoAnim(RunePlayer(Owner).Weapon.A_Throw, 1.0, 0.1);
01788		}
01789	
01790		//=========================================================================
01791		//
01792		// DoThrow
01793		// 
01794		//=========================================================================
01795		
01796		function DoThrow()
01797		{
01798			RunePlayer(Owner).ThrowWeapon();
01799		}
01800	
01801	begin:
01802		PlayThrowAnim();
01803		FinishAnim();
01804	
01805		RunePlayer(Owner).SetMovementMode(); // Set combat or exploration mode
01806	
01807		SyncAnimation(0.15);
01808		
01809		GotoState('Idle');
01810	}
01811	
01812	//=============================================================================
01813	//
01814	// Pain
01815	//
01816	//=============================================================================
01817	
01818	state Pain
01819	{
01820		function TryPlayAnim(Name anim, optional float rate, optional float tween) {}
01821		function TryLoopAnim(Name anim, optional float rate, optional float tween) {}
01822		function TryTweenAnim(Name anim, optional float tween) {}
01823	
01824		function bool CanGotoPainState()
01825		{
01826			return(false);
01827		}
01828	
01829		//==========================================================================
01830		//
01831		// CanPickUp
01832		//
01833		//==========================================================================
01834	
01835		function bool CanPickup(Inventory item)
01836		{
01837			return(false);
01838		}
01839	
01840	Begin:
01841		Sleep(RunePlayer(Owner).PainDelay);
01842	
01843		// Make certain that RunePlayer(Owner)'s movement type is proper, because painstate is
01844		// pre-emptive and the movement type could be in a bizarre state when pain is inflicted
01845		RunePlayer(Owner).SetMovementMode();
01846		SyncAnimation(0.08);
01847		GotoState('Idle');
01848	}
01849	
01850	//=============================================================================
01851	//
01852	// Uninterrupted
01853	//
01854	//=============================================================================
01855	
01856	state Uninterrupted
01857	{
01858		function TryPlayAnim(Name anim, optional float rate, optional float tween) {}
01859		function TryLoopAnim(Name anim, optional float rate, optional float tween) {}
01860		function TryTweenAnim(Name anim, optional float tween) {}
01861	
01862		//==========================================================================
01863		//
01864		// CanPickUp
01865		//
01866		//==========================================================================
01867	
01868		function bool CanPickup(Inventory item)
01869		{
01870			return(false);
01871		}
01872	
01873		function bool CanGotoPainState()
01874		{
01875			return(false);
01876		}
01877	
01878		simulated function AnimEnd()
01879		{
01880			GotoState('Idle');
01881		}
01882	
01883	begin:
01884	}
01885	
01886	//=============================================================================
01887	//
01888	// PlayerRopeClimbing
01889	//
01890	//=============================================================================
01891	
01892	state PlayerRopeClimbing
01893	{
01894		ignores TryPlayAnim, TryLoopAnim, TryTweenAnim, SwitchWeapon;
01895	
01896	begin:
01897	}
01898	
01899	//=============================================================================
01900	//
01901	// EdgeHanging
01902	//
01903	//=============================================================================
01904	
01905	state EdgeHanging
01906	{
01907		ignores SwitchWeapon, Attack, Defend, Use, Throw;
01908	
01909	begin:
01910	}
01911	
01912	//=============================================================================
01913	//
01914	// Debug
01915	//
01916	//=============================================================================
01917	
01918	simulated function Debug(Canvas canvas, int mode)
01919	{
01920		local vector pos1, pos2;	// testing sweep
01921		local vector offset;
01922		local actor A,BestActor;
01923		local float score,BestScore;
01924		local int X,Y;
01925	
01926		Super.Debug(canvas, mode);
01927	
01928		Canvas.DrawText("RunePlayerProxy:");
01929		Canvas.CurY -= 8;
01930	}
01931	
01932	defaultproperties
01933	{
01934	}

End Source Code