Engine
Class ParticleSystem

source: c:\runehov\Engine\Classes\ParticleSystem.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.ParticleSystem
Direct Known Subclasses:Spewer, WeaponSwipe, BeamSystem, BlazeEffect, BlinkingLight, Blood, BloodSpurt, BlueTrail, Breath, BrownDust, BubbleSystem, DarkDwarfBlast, DarkDwarfExplosion, DebrisCloud, DrippingBlood, EmpathyFlash, Exploding, Explosion, FallingRocks, Fire, FireRays, GlowplantSparks, GroundDust, GroundHammerEffect, HitSpark, HitStone, HugeSplash, IceAxeEffect, KegLeak, LokiEffect, LokiHealthSystem, MechRocketEffect, MechRocketExplosion, MechRocketSmoke, MechRocketTrail, MushroomPuff, OdinEffect, PowerUp, Rain, RainSplash, Ripple, RuneSpheres, SeekerTrail, Smoke, Snow, Sparks, SparkSystem, SpiderBotExplosion, Splash, SteamBlast, StoneHammerEffect, SwipeEffect, VampireReplenish, WaterFallFog, WaterFallSpray, WeaponHelix, ZombieBreath

class ParticleSystem
extends Engine.Actor

//============================================================================= // ParticleSystem. //=============================================================================
Variables
 byte AlphaEnd
           Defines the volume that the particles are spawned
 byte AlphaStart
           Defines the volume that the particles are spawned
 byte BaseJointIndex
           TEST
 float BeamTextureScale
           If Non-zero, uses this value to maintain the beam texture coordinates
 float BeamThickness
           Number of connection points in the beam
 vector ConnectionOffset[32]
           Beam connection points -- NO MORE THAN 32 connection pts!
 vector ConnectionPoint[32]
           Beam connection points -- NO MORE THAN 32 connection pts!
 float CurrentDelay
           If true, the system ticks based upon the level tick, NOT based upon rendering
 float CurrentTime
           If true, the system ticks based upon the level tick, NOT based upon rendering
 float GravityScale
           Defines the volume that the particles are spawned
 bool HasValidCoords
           If true, the system ticks based upon the level tick, NOT based upon rendering
 bool IsLoaded
 float LastTime
           If true, the system ticks based upon the level tick, NOT based upon rendering
 float LifeSpanMax
           Defines the volume that the particles are spawned
 float LifeSpanMin
           Defines the volume that the particles are spawned
 byte NumConPts
           Number of connection points in the beam
 byte OffsetJointIndex
           TEST
 vector OldBaseLocation
           TEST
 vector OldOffsetLocation
           TEST
 byte OldParticleCount
           If true, the system ticks based upon the level tick, NOT based upon rendering
 vector OriginOffset
           Spawn particles offset from the origin by this vector
 Particle ParticleArray[64]
           MAX_PARTICLE_COUNT
 byte ParticleCount
           If true, the system ticks based upon the level tick, NOT based upon rendering
 EParticleSpriteType ParticleSpriteType
           If true, the system ticks based upon the level tick, NOT based upon rendering
 Texture ParticleTexture[4]
           If true, the system ticks based upon the level tick, NOT based upon rendering
 EParticleType ParticleType
           If true, the system ticks based upon the level tick, NOT based upon rendering
 byte PercentOffset
           Defines the volume that the particles are spawned
 float RandomDelay
           If true, the system ticks based upon the level tick, NOT based upon rendering
 float ScaleDeltaX
           Defines the volume that the particles are spawned
 float ScaleDeltaY
           Defines the volume that the particles are spawned
 float ScaleMax
           Defines the volume that the particles are spawned
 float ScaleMin
           Defines the volume that the particles are spawned
 vector ShapeVector
           Defines the volume that the particles are spawned
 float SpawnDelay
           Delay before particles begin to spawn
 float SpawnOverTime
           Delay before particles begin to spawn
 EParticleSpawnShape SpawnShape
           If true, the system ticks based upon the level tick, NOT based upon rendering
 float SwipeSpeed
           Speed at which the swipe fades out
 coords SystemCoords
           If true, the system ticks based upon the level tick, NOT based upon rendering
 float SystemLifeSpan
           If true, the system ticks based upon the level tick, NOT based upon rendering
 int TargetJointIndex
           If Non-zero, uses this value to maintain the beam texture coordinates
 vector TargetLocation
           Beam connection points -- NO MORE THAN 32 connection pts!
 float TextureChangeTime
           TEST
 vector VelocityMax
           Defines the volume that the particles are spawned
 vector VelocityMin
           Defines the volume that the particles are spawned
 float ZoneVelocityScale
           Defines the volume that the particles are spawned
 bool bAlphaFade
           Defines the volume that the particles are spawned
 bool bApplyGravity
           Defines the volume that the particles are spawned
 bool bApplyZoneVelocity
           Defines the volume that the particles are spawned
 bool bConstrainToBounds
           Defines the volume that the particles are spawned
 bool bConvergeX
           Defines the volume that the particles are spawned
 bool bConvergeY
           Defines the volume that the particles are spawned
 bool bConvergeZ
           Defines the volume that the particles are spawned
 bool bEventDeath
           If true, the system ticks based upon the level tick, NOT based upon rendering
 bool bEventParticleTick
           Beam connection points -- NO MORE THAN 32 connection pts!
 bool bEventSystemInit
           Beam connection points -- NO MORE THAN 32 connection pts!
 bool bEventSystemTick
           Beam connection points -- NO MORE THAN 32 connection pts!
 bool bOneShot
           Defines the volume that the particles are spawned
 bool bRandomTexture
           If true, the system ticks based upon the level tick, NOT based upon rendering
 bool bRelativeToSystem
           If true, the system ticks based upon the level tick, NOT based upon rendering
 bool bSpriteInEditor
           Whether to draw as sprite within editor
 bool bSystemOneShot
           Whether to draw as sprite within editor
 bool bSystemTicks
           If true, the system ticks based upon the level tick, NOT based upon rendering
 bool bTaperEndPoint
           Beam connection points -- NO MORE THAN 32 connection pts!
 bool bTaperStartPoint
           Beam connection points -- NO MORE THAN 32 connection pts!
 bool bUseTargetLocation
           Beam connection points -- NO MORE THAN 32 connection pts!
 bool bWaterOnly
           Defines the volume that the particles are spawned


Function Summary
 
simulated
debug(Canvas Canvas, int mode)



Source Code


00001	//=============================================================================
00002	// ParticleSystem.
00003	//=============================================================================
00004	class ParticleSystem expands Actor
00005		intrinsic;
00006	
00007	#exec Texture Import File=Textures\ParticleSystem.pcx Name=S_Particle Mips=Off Flags=2
00008	#exec Texture Import File=Textures\RopeSymbol.pcx Name=S_Rope Mips=Off Flags=2
00009	
00010	/* TODO:
00011			- Reorganize vars into a more logical structure
00012				* Group BOOLS
00013				* Group Specific system vars
00014	*/	
00015	
00016	const MAX_PARTICLE_COUNT = 64;
00017	
00018	var transient bool IsLoaded;
00019	var() bool bSpriteInEditor;			// Whether to draw as sprite within editor
00020	
00021	enum EParticleType
00022	{
00023		PART_Emitter,
00024		PART_SwipeEffect,
00025		PART_Generic,
00026		PART_Beam,
00027	};
00028	
00029	enum EParticleSpriteType
00030	{
00031		PSPRITE_Normal,
00032		PSPRITE_Vertical,
00033		PSPRITE_Flat,
00034		PSPRITE_QuadUV,
00035	};
00036	
00037	enum EParticleSpawnShape
00038	{
00039		PSHAPE_Ellipsoid,  // Ellipsoid defined by ShapeVector
00040		PSHAPE_Line, // Line defined by the vector ShapeVector
00041	};
00042	
00043	// Basic Particle Definition -- MUST be mirrored in UnObj.h
00044	// TODO:  Majorly optimize this structure!
00045	struct Particle
00046	{
00047		var vector Location;
00048		var vector Velocity;
00049		var FLOAT LifeSpan;
00050		var FLOAT XScale;
00051		var FLOAT YScale;
00052		var FLOAT ScaleStartX;
00053		var FLOAT ScaleStartY;
00054		var vector Alpha;		// Use a byte (or a float?)
00055		var FLOAT U0, V0;		// WeaponSwipe
00056		var FLOAT U1, V1;
00057		var vector Points[4];
00058		var BYTE Style;
00059		var BYTE TextureIndex;
00060		var BOOL Valid;
00061	};
00062	
00063	// System Variables
00064	var() bool bSystemOneShot;
00065	var() bool bSystemTicks;  // If true, the system ticks based upon the level tick, NOT based upon rendering
00066	var() bool bRelativeToSystem;
00067	var() bool bEventDeath;
00068	
00069	var() byte ParticleCount;
00070	var() Texture ParticleTexture[4];
00071	var() bool bRandomTexture;
00072	var() EParticleType ParticleType;
00073	var() EParticleSpriteType ParticleSpriteType;
00074	var() EParticleSpawnShape SpawnShape;
00075	var() float RandomDelay;
00076	
00077	var() float SystemLifeSpan;
00078	
00079	// Internal System Variables
00080	var float CurrentDelay;
00081	var byte OldParticleCount;
00082	var coords SystemCoords;
00083	var bool HasValidCoords;
00084	var float LastTime;
00085	var float CurrentTime;
00086	var Particle ParticleArray[64]; // MAX_PARTICLE_COUNT
00087	
00088	// Emitter Variables
00089	var() vector OriginOffset; // Spawn particles offset from the origin by this vector
00090	var() vector ShapeVector; // Defines the volume that the particles are spawned
00091	var() vector VelocityMin;
00092	var() vector VelocityMax;
00093	var() float ScaleMin;
00094	var() float ScaleMax;
00095	var() float ScaleDeltaX;
00096	var() float ScaleDeltaY;
00097	var() float LifeSpanMin;
00098	var() float LifeSpanMax;
00099	var() byte AlphaStart;
00100	var() byte AlphaEnd;
00101	var() byte PercentOffset;
00102	
00103	var() bool bAlphaFade;
00104	var() bool bApplyGravity;
00105	var() float GravityScale;
00106	var() bool bApplyZoneVelocity;
00107	var() float ZoneVelocityScale;
00108	var() bool bWaterOnly;
00109	var() bool bOneShot;
00110	var() bool bConvergeX;
00111	var() bool bConvergeY;
00112	var() bool bConvergeZ;
00113	var() bool bConstrainToBounds;
00114	
00115	var() float SpawnDelay; // Delay before particles begin to spawn
00116	var() float SpawnOverTime;
00117	var() float TextureChangeTime; // TEST
00118	
00119	// Swipe Variables
00120	var byte BaseJointIndex;
00121	var byte OffsetJointIndex;
00122	var vector OldBaseLocation;
00123	var vector OldOffsetLocation;
00124	var() float SwipeSpeed;	// Speed at which the swipe fades out
00125	
00126	// Beam Variables
00127	var() byte NumConPts; // Number of connection points in the beam
00128	var() float BeamThickness;
00129	var() float BeamTextureScale; // If Non-zero, uses this value to maintain the beam texture coordinates
00130	var() int TargetJointIndex;
00131	var vector ConnectionPoint[32]; // Beam connection points -- NO MORE THAN 32 connection pts!
00132	var vector ConnectionOffset[32]; // Beam connection points -- NO MORE THAN 32 connection pts!
00133	var() bool bUseTargetLocation;
00134	var() vector TargetLocation;
00135	var() bool bEventSystemInit;
00136	var() bool bEventSystemTick;
00137	var() bool bEventParticleTick;
00138	var() bool bTaperStartPoint;
00139	var() bool bTaperEndPoint;
00140	
00141	
00142	replication
00143	{
00144		unreliable if( Role==ROLE_Authority )
00145			bSystemTicks, bRelativeToSystem, bEventDeath,
00146			ParticleType, ParticleSpriteType, SpawnShape,
00147			bEventSystemInit, bEventSystemTick, bEventParticleTick,
00148			ParticleCount, ParticleTexture, bRandomTexture,
00149			RandomDelay, SystemLifeSpan,
00150			OriginOffset, ShapeVector, VelocityMin, VelocityMax,
00151			ScaleMin, ScaleMax, ScaleDeltaX, ScaleDeltaY,
00152			LifeSpanMin, LifeSpanMax, AlphaStart, AlphaEnd,
00153			PercentOffset, bAlphaFade, bApplyGravity, GravityScale,
00154			bApplyZoneVelocity, ZoneVelocityScale, bWaterOnly,
00155			bSystemOneShot, bOneShot,
00156			bConvergeX, bConvergeY, bConvergeZ,
00157			bConstrainToBounds,
00158			SpawnDelay, SpawnOverTime, TextureChangeTime;
00159	
00160			// Swipes
00161		unreliable if (Role==ROLE_Authority && ParticleType==PART_SwipeEffect)
00162			BaseJointIndex, OffsetJointIndex,
00163			OldBaseLocation, OldOffsetLocation,
00164			SwipeSpeed;
00165	
00166			// Beam
00167		unreliable if (Role==ROLE_Authority && ParticleType==PART_Beam)
00168			NumConPts, BeamThickness, BeamTextureScale,
00169			TargetJointIndex, ConnectionPoint, ConnectionOffset,
00170			bUseTargetLocation, TargetLocation,
00171			bTaperStartPoint, bTaperEndPoint;
00172	}
00173	
00174	
00175	event SystemInit()
00176	{
00177	}
00178	
00179	event SystemTick(float DeltaSeconds)
00180	{
00181	}
00182	
00183	event ParticleTick(float DeltaSeconds)
00184	{ // ParticleTick ticks ALL particles in a given ParticleSystem
00185	}
00186	
00187	
00188	simulated function debug(canvas Canvas, int mode)
00189	{
00190		Super.Debug(Canvas, mode);
00191	
00192		Canvas.DrawText("ParticleSystem:");
00193		Canvas.CurY -= 8;
00194		Canvas.DrawText("  IsLoaded:      "$IsLoaded);
00195		Canvas.CurY -= 8;
00196		Canvas.DrawText("  ParticleCount: "$ParticleCount);
00197		Canvas.CurY -= 8;
00198		Canvas.DrawText("  bStasis:      "$bStasis);
00199		Canvas.CurY -= 8;
00200	
00201		switch(ParticleType)
00202		{
00203		case PART_Emitter:
00204			Canvas.DrawText("  ParticleType:    "@"PART_Emitter");
00205			Canvas.CurY -= 8;
00206			break;
00207		case PART_Generic:
00208			Canvas.DrawText("  ParticleType:    "@"PART_Emitter");
00209			Canvas.CurY -= 8;
00210			break;
00211		case PART_SwipeEffect:
00212			Canvas.DrawText("  ParticleType:    "@"PART_SwipeEffect");
00213			Canvas.CurY -= 8;
00214			Canvas.DrawText("  BaseJointIndex:  "@BaseJointIndex);
00215			Canvas.CurY -= 8;
00216			Canvas.DrawText("  OffsetJointIndex:"@OffsetJointIndex);
00217			Canvas.CurY -= 8;
00218			Canvas.DrawText("  OldBaseLocation: "@OldBaseLocation);
00219			Canvas.CurY -= 8;
00220			Canvas.DrawText("  OldOffsetLocation"@OldOffsetLocation);
00221			Canvas.CurY -= 8;
00222			Canvas.DrawText("  SwipeSpeed:      "@SwipeSpeed);
00223			Canvas.CurY -= 8;
00224			break;
00225		case PART_Beam:
00226			Canvas.DrawText("  ParticleType:    "@"PART_Beam");
00227			Canvas.CurY -= 8;
00228			Canvas.DrawText("  NumConPts:       "@NumConPts);
00229			Canvas.CurY -= 8;
00230			Canvas.DrawText("  TargetJointIndex:"@TargetJointIndex);
00231			Canvas.CurY -= 8;
00232			Canvas.DrawText("  bUseTargetLocation:"@bUseTargetLocation);
00233			Canvas.CurY -= 8;
00234			Canvas.DrawText("  TargetLocation:    "@TargetLocation);
00235			Canvas.CurY -= 8;
00236			break;
00237		}
00238	}
00239	
00240	defaultproperties
00241	{
00242	     bStasis=True
00243	     DrawType=DT_ParticleSystem
00244	     Texture=Texture'Engine.S_Particle'
00245	}

End Source Code