Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

U2.ImpactHandler


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
//=============================================================================
// ImpactHandler.uc
// $Author: Mfox $
// $Date: 1/05/03 8:46p $
// $Revision: 24 $
//=============================================================================

class ImpactHandler extends Object
	abstract
	native;

#exec OBJ LOAD FILE=..\Sounds\U2WeaponsA.uax

// NOTE: U2DamageType.uc handles spewing blood for Pawns and PlayerPawns, so blood effects for TT_Skin should be disabled

struct native TMaterialSounds // list must be terminated with TT_Default definition
{
	var() Material.ETextureType TextureType;
	var() sound ImpactSound;
	var() sound RicochetSound; // optional as long as ImpactSound is specified
	// not implmented: Volume Range
	// not implmented: Pitch Range
	// not implmented: Odds -- of this sound being used (to support multiple sounds for the same type)
};


struct native TMaterialEffects // list must be terminated with TT_Default definition
{
	var() Material.ETextureType TextureType;
	var() Texture DecalTexture;
	var() float DecalScale;
	var() class<Actor> HitEffectClass;
	var() ParticleGenerator ParticleEffect;
	var() float RicochetProbability;
	var() float RicochetIncidenceThreshold;	// surface normal dot projectile direction normal must be less than one minus this value.  (0=any angle bounces, 1=nothing bounces)
	var() int MaxRicochetCount;
	var() float RicochetDamping;
	var() float RicochetSpreadAngle;
	var() float Lifespan;					//optional, used for ParticleEffect and HitEffectClass actors
	// not implmented: Odds -- of this decal/effect being used (to support multiple effects for the same type)
};


var() array<TMaterialSounds> MaterialSounds;
var() array<TMaterialEffects> MaterialEffects;
var() class<U2Projectile> RicochetProjectile;
var() float ReturnDefaultEffectOdds;

static native final function Sound GetImpactSound( Material.ETextureType TextureType, bool bRicochet );
static native final function HandleImpact( Actor Source, vector HitDirection, Material.CheckResult Hit, bool bImpactSound );
static native final function Init( Actor ContextActor );

// optional TextureType passed in on client-side in multiplayer only (optimization to avoid replicating CheckResult)
static function TraceImpact( U2Weapon Source, Material.CheckResult Hit )
{
	// caller is on either the client or the server, no need to implement replication or spawn a new ImpactHandler
	// we pass vect(0,0,0) instead of vector(Pawn(Weapon.Owner).GetViewRotation()) because the viewrotation could differ on the client and the server
	if( (Source.Level.Game.GameFlags & U2GameInfo.GF_NOIMPACTS) == 0 )
		HandleImpact( Source, vect(0,0,0), Hit, true );
}


static function ProjectileImpact( U2Projectile Source, Material.CheckResult Hit, bool bImpactSound )
{
	// caller is on either the client or the server, no need to implement replication or spawn a new ImpactHandler
	if( (Source.Level.Game.GameFlags & U2GameInfo.GF_NOIMPACTS) == 0 )
		HandleImpact( Source, Normal( Source.Velocity ), Hit, bImpactSound );
}


static function ParticleImpact( ParticleGenerator Source, ParticleHandle P, Material.CheckResult Hit )
{
	// caller is on either the client or the server, no need to implement replication or spawn a new ImpactHandler
	if( (Source.Level.Game.GameFlags & U2GameInfo.GF_NOIMPACTS) == 0 )
		HandleImpact( Source, Normal( class'ParticleGenerator'.static.ParticleGetVelocity(P) ), Hit, true );
}


static function Sound DetermineImpactSound( Actor Source, Material.CheckResult Hit, bool bRicochet )
{
	//2002.12.19 (mdf) warning fix
	if( Source != None && (Source.Level.Game.GameFlags & U2GameInfo.GF_NOIMPACTS) == 0 )
		return GetImpactSound( class'Material'.static.GetHitTextureType( Hit ), bRicochet );
		
	return None;
}


function ForceClassToExist()
{
	local Class C;
	C = class'U2Decal';
	C = class'ProjectileSoundProxy';
}

defaultproperties
{
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: sk 3-1-2016 10:38:42.000 - Creation time: sk 3-1-2016 10:48:39.573 - Created with UnCodeX