SFWeapon.SFPrybar

00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
//=============================================================================
// Spatial Fear
// Class: SFPrybar
// Descripton: Subclasses of SFweapon
//				Implements the SFPrybar melee weapon.
//
// Author: Markus Nuebel
//=============================================================================

class SFPrybar extends SFWeapon;

#exec AUDIO IMPORT FILE="Sounds\PrybarFire.WAV" NAME="PrybarFire" GROUP="Prybar"
#exec AUDIO IMPORT FILE="Sounds\PrybarHitFlesh.WAV" NAME="PrybarhitFlesh" GROUP="Prybar"
#exec AUDIO IMPORT FILE="Sounds\PrybarHitHard.WAV" NAME="PrybarHitHard" GROUP="Prybar"
#exec AUDIO IMPORT FILE="Sounds\PrybarHitSoft.WAV" NAME="PrybarHitSoft" GROUP="Prybar"
#exec AUDIO IMPORT FILE="Sounds\PrybarSelect.WAV" NAME="PrybarSelect" GROUP="Prybar"

// First Person model

#exec MESH IMPORT MESH=SFPrym ANIVFILE=MODELS\SFPrym_a.3d DATAFILE=MODELS\SFPrym_d.3d X=0 Y=0 Z=0
#exec MESH ORIGIN MESH=SFPrym X=0 Y=0 Z=0

#exec MESH SEQUENCE MESH=SFPrym SEQ=All    STARTFRAME=0 NUMFRAMES=57
#exec MESH SEQUENCE MESH=SFPrym SEQ=select STARTFRAME=0 NUMFRAMES=11
#exec MESH SEQUENCE MESH=SFPrym SEQ=down   STARTFRAME=11 NUMFRAMES=11
#exec MESH SEQUENCE MESH=SFPrym SEQ=still  STARTFRAME=24 NUMFRAMES=1
//#exec MESH SEQUENCE MESH=SFPrym SEQ=still  STARTFRAME=22 NUMFRAMES=1
#exec MESH SEQUENCE MESH=SFPrym SEQ=still2 STARTFRAME=23 NUMFRAMES=1
#exec MESH SEQUENCE MESH=SFPrym SEQ=fire1  STARTFRAME=24 NUMFRAMES=11
#exec MESH SEQUENCE MESH=SFPrym SEQ=fire2  STARTFRAME=35 NUMFRAMES=11 rate=15
#exec MESH SEQUENCE MESH=SFPrym SEQ=getuse STARTFRAME=46 NUMFRAMES=11 rate=12

#exec TEXTURE IMPORT NAME=JSFPrym1 FILE=TEXTURES\SFPrym1.PCX GROUP=Skins FLAGS=2
#exec TEXTURE IMPORT NAME=JSFPrym2 FILE=TEXTURES\SFPrym2.PCX GROUP=Skins FLAGS=2

#exec MESHMAP NEW   MESHMAP=SFPrym MESH=SFPrym
#exec MESHMAP SCALE MESHMAP=SFPrym X=0.1 Y=0.1 Z=0.2

#exec MESHMAP SETTEXTURE MESHMAP=SFPrym NUM=1 TEXTURE=JSFPrym1
#exec MESHMAP SETTEXTURE MESHMAP=SFPrym NUM=2 TEXTURE=JSFPrym2


// Pickup Model
#exec MESH IMPORT MESH=SFPrypick ANIVFILE=MODELS\SFPrypick_a.3d DATAFILE=MODELS\SFPrypick_d.3d X=0 Y=0 Z=0
#exec MESH ORIGIN MESH=SFPrypick X=0 Y=0 Z=0 

#exec MESH SEQUENCE MESH=SFPrypick SEQ=All          STARTFRAME=0 NUMFRAMES=1

#exec MESHMAP NEW   MESHMAP=SFPrypick MESH=SFPrypick
#exec MESHMAP SCALE MESHMAP=SFPrypick X=0.1 Y=0.1 Z=0.2

#exec MESHMAP SETTEXTURE MESHMAP=SFPrypick NUM=1 TEXTURE=JSFPrym1

// 3rd Person Model
#exec MESH IMPORT MESH=SFPry3p ANIVFILE=MODELS\SFPrypick_a.3d DATAFILE=MODELS\SFPrypick_d.3d X=0 Y=0 Z=0
#exec MESH ORIGIN MESH=SFPry3p X=0 Y=0 Z=0

#exec MESH SEQUENCE MESH=SFPry3p SEQ=All          STARTFRAME=0 NUMFRAMES=1

#exec MESHMAP NEW   MESHMAP=SFPry3p MESH=SFPrypick
#exec MESHMAP SCALE MESHMAP=SFPry3p X=0.08 Y=0.08 Z=0.16

#exec MESHMAP SETTEXTURE MESHMAP=SFPry3p NUM=1 TEXTURE=JSFPrym1

var (SpatialFear) Sound FleshHitSound; // Sound played when a pawn was hit
var (SpatialFear) Sound OtherHitSound; // Sound played when a something other than a wall or a pawn was hit
var (SpatialFear) Sound WallHitSound; // Sound played when a wall was hit
var bool m_bPlayGetKeyAnim; // Private: Flag to play the getuse animation on AnimEnd

// Overwritten here, because we do not use the ammo logic
function Fire( float Value )
{
	GotoState('NormalFire');
	bPointing=True;
	bCanClientFire = true;
	Pawn(Owner).PlayRecoil(m_fCurrentRate);
	ClientFire(value);
	// No trace here
	//TraceFire(0.0);
}

simulated function PlayFiring()
{
	PlaySound(FireSound, SLOT_None, Pawn(Owner).SoundDampening*3.0);
	PlayAnim( 'Fire1', m_fCurrentRate, 0.04 );
}

// Overwritten here, because we do not use the ammo logic
function AltFire( float Value )
{
	GotoState('AltFiring');
	Pawn(Owner).PlayRecoil(m_fCurrentRate);
	bCanClientFire = true;
	bPointing=True;
	ClientAltFire(value);
	// No trace here
	// TraceFire(0.0);
}

simulated function PlayAltFiring()
{
	PlaySound(FireSound, SLOT_None, Pawn(Owner).SoundDampening*3.0);
	PlayAnim( 'Fire2', m_fAltCurrentRate, 0.04 );
}

simulated function PlayUseKeyHit()
{
	PlayAnim( 'getuse', m_fCurrentRate, 0.03 );
}

// Retrieves the angle between the two given vectors in radians
function float getAngle(vector vecFirst, vector vecSecond)
{
	return Normal(vecFirst) dot Normal(vecSecond);
}

state NormalFire
{
	ignores Fire, AltFire;

	// Simplified ProcessTraceHit, that handles a normal trace hit.
	// Does not spawn a shellcase !!
	function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z)
	{

		if ( (Other!=self) && (Other != None) )
		{
			// Hit something
			if ( !Other.bIsPawn && !Other.IsA('Carcass') )
			{
				spawn(class'SFPrybarHit',,,HitLocation+HitNormal, Rotator(HitNormal));
			}

			Other.TakeDamage(fAltDamage, Pawn(Owner), HitLocation, fMomentum*X, MyDamageType);
			if(Other.IsA('Pawn'))
			{
				PlaySound(FleshHitSound, SLOT_None, Pawn(Owner).SoundDampening*3.0);
			}
			else if(Other.IsA('Brush'))
			{
				PlaySound(WallHitSound, SLOT_None, Pawn(Owner).SoundDampening*3.0);
			}
			else
			{
				PlaySound(OtherHitSound, SLOT_None, Pawn(Owner).SoundDampening*3.0);
			}
		}
	}


Begin:
	Sleep(0.5);
	TraceFire(0.0);
	ShakePrimary();
//	if ( Pawn(Owner).bFire == 0 )
//		Finish();
	FinishAnim();
//	Goto('Begin');
}

////////////////////////////////////////////////////////

state AltFiring
{
	ignores Fire, AltFire;

	// Simplified ProcessTraceHit, that handles a normal trace hit.
	// Does not spawn a shellcase !!
	function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z)
	{
		if ( (Other!=self) && (Other != None) )
		{
			// Hit something
			if ( !Other.bIsPawn && !Other.IsA('Carcass') )
			{
				spawn(class'SFPrybarHit',,,HitLocation+HitNormal, Rotator(HitNormal));
			}
			Other.TakeDamage(fAltDamage, Pawn(Owner), HitLocation, fAltMomentum*X, MyDamageType);
			if(Other.IsA('Pawn'))
				PlaySound(FleshHitSound, SLOT_None, Pawn(Owner).SoundDampening*3.0);
			else if(Other.IsA('Brush'))
				PlaySound(WallHitSound, SLOT_None, Pawn(Owner).SoundDampening*3.0);
			else
				PlaySound(OtherHitSound, SLOT_None, Pawn(Owner).SoundDampening*3.0);
		}
	}

Begin:
	Sleep(0.5);
	ShakeSecondary();
	TraceFire(0.0);
	FinishAnim();
	Finish();
}

state Idle
{
	function AnimEnd()
	{
		PlayIdleAnim();
	}

Begin:
	bPointing=False;
	if ( Pawn(Owner).bFire!=0 )
		Fire(0.0);
	PlayIdleAnim();
}

simulated function PlayIdleAnim()
{
	if ( Mesh != PickupViewMesh )
		PlayAnim( 'Still', 1.0, 0.02 );
}

function Actor MeleeTargetting(out vector HitLoc, out vector HitNorm)
{
	local vector End, X, Y, Z, Start;
	local actor Other;

	// Get vectors for where the player is aiming on each axis
	GetAxes(Pawn(Owner).ViewRotation, X, Y, Z);
	// Calculate starting location
	Start = Owner.Location + CalcDrawOffset() + FireOffset.X * X
		  + FireOffset.Y * Y + FireOffset.Z * Z;
	AdjustedAim = Pawn(Owner).AdjustAim(1000000, Start, AimError, False, False);
	// Using an arbitrary range of 100 UUs
	End = Owner.Location + (MaxTargetRange * vector(AdjustedAim));
	Other = Pawn(Owner).TraceShot(HitLoc, HitNorm, End, Start);

	return Other;

}

function bool checkUseKeyHit()
{
	local vector End, X, Y, Z, Start,  HitLoc, HitNorm;
	local actor Other;

	// Get vectors for where the player is aiming on each axis
	GetAxes(Pawn(Owner).ViewRotation, X, Y, Z);
	// Calculate starting location
	Start = Owner.Location + CalcDrawOffset() + FireOffset.X * X
		  + FireOffset.Y * Y + FireOffset.Z * Z;
	AdjustedAim = Pawn(Owner).AdjustAim(1000000, Start, AimError, False, False);
	// Using an arbitrary range of 100 UUs
	End = Owner.Location + (MaxTargetRange * vector(AdjustedAim));
	Other = Pawn(Owner).TraceShot(HitLoc, HitNorm, End, Start);

	if(None == Other)
		return false;

	return Other.IsA('SFUseKeyTrigger');

}


// Do the hit
function TraceFire( float Accuracy )
{
	local vector X,Y,Z;
	local Actor oAct;
	local float fAngle, fAngleLimit;
	local vector vecHitLoc, vecHitNorm;
	local Pawn	oPawn;
	local bool bHit;

	// Some inits
	bHit		=false;
	fAngleLimit =0.8;
	oPawn		= Pawn(Owner);

	// Make some sound
	Owner.MakeNoise(Pawn(Owner).SoundDampening);
	// Get the player rotation
	GetAxes(Pawn(Owner).ViewRotation,X,Y,Z);
	/*
	// Roll out the damage wave
	foreach VisibleActors(class'Actor', oAct, float(MaxTargetRange), Owner.Location)
	{
		if(None != oAct)
		{
			if(!oPawn.bHidden)
			{
				fAngle	= getAngle(X, oAct.Location-Owner.Location);
				if(fAngle > fAngleLimit)
				{
					vecHitNorm	= Normal(Owner.Location - oAct.Location);
					vecHitLoc	= oAct.Location + vecHitNorm*oAct.CollisionRadius;

					ProcessTraceHit(oAct, vecHitLoc, vecHitNorm, X,Y,Z);
					bHit = True;
					return;
				}
			}
		}
	}
	*/
	oAct = MeleeTargetting(vecHitLoc, vecHitNorm);
	if(None != oAct)
	{
//		vecHitNorm	= Normal(Owner.Location - oAct.Location);
//		vecHitLoc	= oAct.Location + vecHitNorm*oAct.CollisionRadius;
		ProcessTraceHit(oAct, vecHitLoc, vecHitNorm, X,Y,Z);
	}

}

//     InstFlash=-0.300000
//     InstFog=(X=200.000000,Y=100.000000)

defaultproperties
{
     FleshHitSound=Sound'SFWeapon.Prybar.PrybarhitFlesh'
     OtherHitSound=Sound'SFWeapon.Prybar.PrybarHitSoft'
     WallHitSound=Sound'SFWeapon.Prybar.PrybarHitHard'
     MaxTargetRange=90
     MaxTargetRangeAlt=90
     fNormalRate=0.272700
     fDesiredRate=0.500000
     fAltDesiredRate=0.500000
     fDamage=25.000000
     fAltDamage=30.000000
     Icon=Texture'SfResource1.Icons.PrybarIco'
     fMomentum=500.000000
     bShake=True
     ShakeMagAlt=150.000000
     ShakeTimeAlt=0.200000
     ShakeVertAlt=3.000000
     WeaponDescription="Classification: Prybar\nMechanical instrument used for in a variety of duties.  It also has a 'gravitational assist' method for opening difficult containers.\nWARNING:  Not to be used on fellow humans."
     bCanThrow=False
     bOwnsCrosshair=True
     bMeleeWeapon=True
     FireOffset=(X=25.000000)
     MyDamageType=slashed
     AltDamageType=slashed
     shakemag=150.000000
     shaketime=0.200000
     shakevert=3.000000
     RefireRate=1.000000
     AltRefireRate=1.000000
     FireSound=Sound'SFWeapon.Prybar.PrybarFire'
     SelectSound=Sound'SFWeapon.Prybar.PrybarSelect'
     AutoSwitchPriority=1
     InventoryGroup=1
     ItemName="Prybar"
     PlayerViewOffset=(X=5.000000,Y=-3.400000,Z=-2.400000)
     PlayerViewMesh=LodMesh'SFWeapon.SFPrym'
     PlayerViewScale=0.200000
     BobDamping=0.965000
     PickupViewMesh=LodMesh'SFWeapon.SFPrypick'
     ThirdPersonMesh=LodMesh'SFWeapon.SFPry3p'
     Mesh=LodMesh'SFWeapon.SFPrypick'
     bNoSmooth=False
     CollisionRadius=20.000000
     CollisionHeight=5.000000
     Mass=10.000000
}

class file time: 12/7/2003 3:58:26 PM - creation time: 12/7/2003 4:03:45 PM
Created with UnCodeX