Botpack
Class WarHeadLauncher

source: e:\games\UnrealTournament\Botpack\Classes\WarheadLauncher.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Inventory
         |
         +--Engine.Weapon
            |
            +--Botpack.TournamentWeapon
               |
               +--Botpack.WarHeadLauncher
Direct Known Subclasses:None

class WarHeadLauncher
extends Botpack.TournamentWeapon

//============================================================================= // WarHeadLauncher //=============================================================================
Variables
 GuidedWarShell GuidedShell
 PlayerPawn GuidingPawn
 int Scroll
 rotator StartRotation
 bCanFire, bShowStatic

States
Finishing, Guiding

Function Summary
 void AltFire(float Value)
 bool ClientAltFire(float Value)
 
simulated
PlayFiring()
 
simulated
PostRender(Canvas Canvas)
 float RateSelf(out int)
 void SetWeaponStay()
 float SuggestAttackStyle()
     
// return delta to combat style
 void setHand(float Hand)


State Finishing Function Summary
 void BeginState()


State Guiding Function Summary
 void EndState()
 void BeginState()
 void AltFire(float Value)
 void Fire(float Value)



Source Code


00001	//=============================================================================
00002	// WarHeadLauncher
00003	//=============================================================================
00004	class WarHeadLauncher extends TournamentWeapon;
00005	
00006	#exec MESH IMPORT  MESH=WarHead ANIVFILE=MODELS\war_a.3D DATAFILE=MODELS\war_d.3D X=0 Y=0 Z=0 
00007	#exec MESH ORIGIN MESH=WarHead X=0 Y=-210 Z=-50 YAW=64 PITCH=16  ROLL=-62
00008	#exec MESH SEQUENCE MESH=WarHead SEQ=All         STARTFRAME=0   NUMFRAMES=35
00009	#exec MESH SEQUENCE MESH=WarHead SEQ=Select      STARTFRAME=0   NUMFRAMES=15
00010	#exec MESH SEQUENCE MESH=WarHead SEQ=Still       STARTFRAME=15  NUMFRAMES=1
00011	#exec MESH SEQUENCE MESH=WarHead SEQ=Idle        STARTFRAME=15  NUMFRAMES=5
00012	#exec MESH SEQUENCE MESH=WarHead SEQ=Down        STARTFRAME=20  NUMFRAMES=7
00013	#exec MESH SEQUENCE MESH=WarHead SEQ=Fire        STARTFRAME=28  NUMFRAMES=7
00014	#exec TEXTURE IMPORT NAME=Jwarhead1 FILE=MODELS\warh1.PCX GROUP=Skins LODSET=2
00015	#exec TEXTURE IMPORT NAME=Jwarhead2 FILE=MODELS\warh2.PCX GROUP=Skins LODSET=2
00016	#exec TEXTURE IMPORT NAME=Jwarhead3 FILE=MODELS\warh3.PCX GROUP=Skins LODSET=2
00017	#exec TEXTURE IMPORT NAME=Jwarhead4 FILE=MODELS\warh4.PCX GROUP=Skins LODSET=2
00018	#exec MESHMAP SCALE MESHMAP=WarHead X=0.006 Y=0.006 Z=0.012
00019	#exec MESHMAP SETTEXTURE MESHMAP=WarHead NUM=0 TEXTURE=Jwarhead1
00020	#exec MESHMAP SETTEXTURE MESHMAP=WarHead NUM=1 TEXTURE=Jwarhead2
00021	#exec MESHMAP SETTEXTURE MESHMAP=WarHead NUM=2 TEXTURE=Jwarhead3
00022	#exec MESHMAP SETTEXTURE MESHMAP=WarHead NUM=3 TEXTURE=Jwarhead4
00023	
00024	#exec MESH IMPORT MESH=WHPick ANIVFILE=MODELS\WHPick_a.3D DATAFILE=MODELS\WHPick_d.3D X=0 Y=0 Z=0
00025	#exec MESH ORIGIN MESH=WHPick X=150 Y=-10 Z=0 YAW=0 ROLL=-64
00026	#exec MESH SEQUENCE MESH=WHPick SEQ=All         STARTFRAME=0   NUMFRAMES=1
00027	#exec MESH SEQUENCE MESH=WHPick SEQ=Still       STARTFRAME=0   NUMFRAMES=1
00028	#exec TEXTURE IMPORT NAME=Jwhpick1 FILE=MODELS\whpick.PCX GROUP=Skins LODSET=2
00029	#exec MESHMAP SCALE MESHMAP=WHPick X=0.1 Y=0.1 Z=0.2
00030	#exec MESHMAP SETTEXTURE MESHMAP=WHPick NUM=1 TEXTURE=Jwhpick1
00031	
00032	#exec MESH IMPORT MESH=WHHand ANIVFILE=MODELS\WHpick_a.3D DATAFILE=MODELS\WHpick_d.3D X=0 Y=0 Z=0
00033	#exec MESH ORIGIN MESH=WHHand X=-150 Y=-110 Z=0 YAW=0 ROLL=-64
00034	#exec MESH SEQUENCE MESH=WHHand SEQ=All         STARTFRAME=0   NUMFRAMES=1
00035	#exec MESH SEQUENCE MESH=WHHand SEQ=Still       STARTFRAME=0   NUMFRAMES=1
00036	#exec MESHMAP SCALE MESHMAP=WHHand X=0.05 Y=0.05 Z=0.1
00037	#exec MESHMAP SETTEXTURE MESHMAP=WHHand NUM=1 TEXTURE=JWHPick1
00038	
00039	#exec TEXTURE IMPORT NAME=Readout FILE=MODELS\data.PCX GROUP="Icons" FLAGS=2 MIPS=OFF
00040	#exec TEXTURE IMPORT NAME=GuidedX FILE=MODELS\crshair.PCX GROUP="Icons" FLAGS=2 MIPS=OFF
00041	
00042	#exec AUDIO IMPORT FILE="Sounds\Warhead\warheadshot.wav" NAME="WarheadShot" GROUP=Redeemer
00043	#exec AUDIO IMPORT FILE="Sounds\Warhead\warheadpickup.wav" NAME="WarheadPickup" GROUP=Redeemer
00044	
00045	#exec TEXTURE IMPORT NAME=IconWarH FILE=TEXTURES\HUD\WpnRdeem.PCX GROUP="Icons" MIPS=OFF
00046	#exec TEXTURE IMPORT NAME=UseWarH FILE=TEXTURES\HUD\UseRdeem.PCX GROUP="Icons" MIPS=OFF
00047	
00048	var GuidedWarShell GuidedShell;
00049	var int Scroll;
00050	var PlayerPawn GuidingPawn;
00051	var bool	bGuiding, bCanFire, bShowStatic;
00052	var rotator StartRotation;
00053	
00054	replication
00055	{
00056		// Things the server should send to the client.
00057		reliable if( bNetOwner && (Role==ROLE_Authority) )
00058			bGuiding, bShowStatic;
00059	}
00060	
00061	function SetWeaponStay()
00062	{
00063		bWeaponStay = false; // redeemer never stays
00064	}
00065	
00066	simulated function PostRender( canvas Canvas )
00067	{
00068		local int i, numReadouts, OldClipX, OldClipY;
00069		local float XScale;
00070	
00071		bOwnsCrossHair = ( bGuiding || bShowStatic );
00072	
00073		if ( !bGuiding )
00074		{
00075			if ( !bShowStatic )
00076				return;
00077	
00078			Canvas.SetPos( 0, 0);
00079			Canvas.Style = ERenderStyle.STY_Normal;
00080			Canvas.DrawIcon(Texture'LadrStatic.Static_a00', FMax(Canvas.ClipX, Canvas.ClipY)/256.0);
00081			if ( Owner.IsA('PlayerPawn') )
00082				PlayerPawn(Owner).ViewTarget = None;
00083			return;
00084		}
00085		GuidedShell.PostRender(Canvas);
00086		OldClipX = Canvas.ClipX;
00087		OldClipY = Canvas.ClipY;
00088		XScale = FMax(0.5, int(Canvas.ClipX/640.0));
00089		Canvas.SetPos( 0.5 * OldClipX - 128 * XScale, 0.5 * OldClipY - 128 * XScale );
00090		if ( Level.bHighDetailMode )
00091			Canvas.Style = ERenderStyle.STY_Translucent;
00092		else
00093			Canvas.Style = ERenderStyle.STY_Normal;
00094		Canvas.DrawIcon(Texture'GuidedX', XScale);
00095	
00096		numReadouts = OldClipY/128 + 2;
00097		for ( i = 0; i < numReadouts; i++ )
00098		{ 
00099			Canvas.SetPos(1,Scroll + i * 128);
00100			Scroll--;
00101			if ( Scroll < -128 )
00102				Scroll = 0;
00103			Canvas.DrawIcon(Texture'Readout', 1.0);
00104		}
00105	}	
00106	
00107	function float RateSelf( out int bUseAltMode )
00108	{
00109		local Pawn P, E;
00110		local Bot O;
00111	
00112		O = Bot(Owner);
00113		if ( (O == None) || (AmmoType.AmmoAmount <=0) || (O.Enemy == None) )
00114			return -2;
00115	
00116		bUseAltMode = 0;
00117		E = O.Enemy;
00118	
00119		for ( P=Level.PawnList; P!=None; P=P.NextPawn )
00120			if ( P.bIsPlayer && (P != O) && (P != E)
00121				&& (!Level.Game.bTeamGame || (O.PlayerReplicationInfo.Team != P.PlayerReplicationInfo.Team))
00122				&& (VSize(E.Location - P.Location) < 650) 
00123				&& (!Level.Game.IsA('TeamGamePlus') || TeamGamePlus(Level.Game).PriorityObjective(O) < 2)
00124				&& FastTrace(P.Location, E.Location) )
00125			{
00126				if ( VSize(E.Location - O.Location) > 500 )
00127					return 2.0;
00128				else
00129					return 1.0;
00130			}
00131	
00132		return 0.35;
00133	}
00134	
00135	// return delta to combat style
00136	function float SuggestAttackStyle()
00137	{
00138		return -1.0;
00139	}
00140	
00141	simulated function PlayFiring()
00142	{
00143		PlayAnim( 'Fire', 0.3 );		
00144		PlayOwnedSound(FireSound, SLOT_None,4.0*Pawn(Owner).SoundDampening);
00145	}
00146	
00147	function setHand(float Hand)
00148	{
00149		if ( Hand == 2 )
00150		{
00151			bHideWeapon = true;
00152			return;
00153		}
00154		else
00155			bHideWeapon = false;
00156	
00157		PlayerViewOffset.Y = Default.PlayerViewOffset.Y;
00158		PlayerViewOffset.X = Default.PlayerViewOffset.X;
00159		PlayerViewOffset.Z = Default.PlayerViewOffset.Z;
00160		
00161		PlayerViewOffset *= 100; //scale since network passes vector components as ints
00162	}
00163	
00164	function AltFire( float Value )
00165	{
00166		if ( !Owner.IsA('PlayerPawn') )
00167		{
00168			Fire(Value);
00169			return;
00170		}
00171	
00172		if (AmmoType.UseAmmo(1))
00173		{
00174			PlayerPawn(Owner).ShakeView(ShakeTime, ShakeMag, ShakeVert);
00175			bPointing=True;
00176			Pawn(Owner).PlayRecoil(FiringSpeed);
00177			PlayFiring();
00178			GuidedShell = GuidedWarShell(ProjectileFire(AltProjectileClass, ProjectileSpeed, bWarnTarget));
00179			GuidedShell.SetOwner(Owner);
00180			PlayerPawn(Owner).ViewTarget = GuidedShell;
00181			GuidedShell.Guider = PlayerPawn(Owner);
00182			ClientAltFire(0);
00183			GotoState('Guiding');
00184		}
00185	}
00186	
00187	simulated function bool ClientAltFire( float Value )
00188	{
00189		if ( bCanClientFire && ((Role == ROLE_Authority) || (AmmoType == None) || (AmmoType.AmmoAmount > 0)) )
00190		{
00191			if ( Affector != None )
00192				Affector.FireEffect();
00193			PlayOwnedSound(FireSound, SLOT_None,4.0*Pawn(Owner).SoundDampening);
00194			return true;
00195		}
00196		return false;
00197	}
00198	
00199	State Guiding
00200	{
00201		function Fire ( float Value )
00202		{
00203			if ( !bCanFire )
00204				return;
00205			if ( GuidedShell != None )
00206				GuidedShell.Explode(GuidedShell.Location,Vect(0,0,1));
00207			bCanClientFire = true;
00208	
00209			GotoState('Finishing');
00210		}
00211	
00212		function AltFire ( float Value )
00213		{
00214			Fire(Value);
00215		}
00216	
00217		function BeginState()
00218		{
00219			Scroll = 0;
00220			bGuiding = true;
00221			bCanFire = false;
00222			if ( Owner.IsA('PlayerPawn') )
00223			{
00224				GuidingPawn = PlayerPawn(Owner);
00225				StartRotation = PlayerPawn(Owner).ViewRotation;
00226				PlayerPawn(Owner).ClientAdjustGlow(-0.2,vect(200,0,0));
00227			}
00228		}
00229	
00230		function EndState()
00231		{
00232			bGuiding = false;
00233			if ( GuidingPawn != None )
00234			{
00235				GuidingPawn.ClientAdjustGlow(0.2,vect(-200,0,0));
00236				GuidingPawn.ClientSetRotation(StartRotation);
00237				GuidingPawn = None;
00238			}
00239		}
00240	
00241	
00242	Begin:
00243		Sleep(1.0);
00244		bCanFire = true;
00245	}
00246	
00247	State Finishing
00248	{
00249		ignores Fire, AltFire;
00250	
00251		function BeginState()
00252		{
00253			bShowStatic = true;
00254		}
00255	
00256	Begin:
00257		Sleep(0.3);
00258		bShowStatic = false;
00259		Sleep(1.0);
00260		GotoState('Idle');
00261	}
00262	
00263	defaultproperties
00264	{
00265	     WeaponDescription="Classification: Thermonuclear Device\n\nPrimary Fire: Launches a huge yet slow moving missile that, upon striking a solid surface, will explode and send out a gigantic shock wave, instantly pulverizing anyone or anything within its colossal radius, including yourself.\n\nSecondary Fire: Take control of the missile and fly it anywhere.  You can press the primary fire button to explode the missile early.\n\nTechniques: Remember that while this rocket is being piloted you are a sitting duck.  If an opponent manages to hit your incoming Redeemer missile while it's in the air, the missile will explode harmlessly."
00266	     InstFlash=-0.400000
00267	     InstFog=(X=950.000000,Y=650.000000,Z=290.000000)
00268	     AmmoName=Class'Botpack.WarHeadAmmo'
00269	     ReloadCount=1
00270	     PickupAmmoCount=1
00271	     bWarnTarget=True
00272	     bAltWarnTarget=True
00273	     bSplashDamage=True
00274	     bSpecialIcon=True
00275	     FiringSpeed=1.000000
00276	     FireOffset=(X=18.000000,Z=-10.000000)
00277	     ProjectileClass=Class'Botpack.WarShell'
00278	     AltProjectileClass=Class'Botpack.GuidedWarshell'
00279	     shakemag=350.000000
00280	     shaketime=0.200000
00281	     shakevert=7.500000
00282	     AIRating=1.000000
00283	     RefireRate=0.250000
00284	     AltRefireRate=0.250000
00285	     FireSound=Sound'Botpack.Redeemer.WarheadShot'
00286	     SelectSound=Sound'Botpack.Redeemer.WarheadPickup'
00287	     DeathMessage="%o was vaporized by %k's %w!!"
00288	     NameColor=(G=128,B=128)
00289	     AutoSwitchPriority=10
00290	     InventoryGroup=10
00291	     PickupMessage="You got the Redeemer."
00292	     ItemName="Redeemer"
00293	     RespawnTime=60.000000
00294	     PlayerViewOffset=(X=1.800000,Y=1.000000,Z=-1.890000)
00295	     PlayerViewMesh=LodMesh'Botpack.WarHead'
00296	     BobDamping=0.975000
00297	     PickupViewMesh=LodMesh'Botpack.WHPick'
00298	     ThirdPersonMesh=LodMesh'Botpack.WHHand'
00299	     StatusIcon=Texture'Botpack.Icons.UseWarH'
00300	     PickupSound=Sound'UnrealShare.Pickups.WeaponPickup'
00301	     Icon=Texture'Botpack.Icons.UseWarH'
00302	     Mesh=LodMesh'Botpack.WHPick'
00303	     bNoSmooth=False
00304	     CollisionRadius=45.000000
00305	     CollisionHeight=23.000000
00306	}

End Source Code