Projectile

Engine/source/T3D/projectile.h

Base class for all projectiles.

More...

Public Types

enum
ProjectileConstants {
  SourceIdTimeoutTicks = 7
  DeleteWaitTime = 500
  ExcessVelDirBits = 7
  MaxLivingTicks = 4095
}
enum
UpdateMasks {
  BounceMask = Parent::NextFreeMask
  ExplosionMask = Parent::NextFreeMask << 1
  NextFreeMask = Parent::NextFreeMask << 2
}

Private Types

Parent 

Private Static Functions

bool
_setInitialPosition(void * object, const char * index, const char * data)
bool
_setInitialVelocity(void * object, const char * index, const char * data)

Public Functions

Advances simulation time for animations.

bool
calculateImpact(F32 simTime, Point3F & pointOfImpact, F32 & impactTime)
explode(const Point3F & p, const Point3F & n, const U32 collideType)

What to do when this projectile explodes.

getUpdatePriority(CameraScopeQuery * focusObject, U32 updateMask, S32 updateSkips)

This returns a value which is used to prioritize which objects need to be updated.

Gets the velocity of the object.

Interpolates between tick events.

bool

Called when the object is added to the sim.

What to do once this projectile collides with something.

bool
onNewDataBlock(GameBaseData * dptr, bool reload)

Called when a new datablock is set.

Called when the object is removed from the sim.

packUpdate(NetConnection * conn, U32 mask, BitStream * stream)

Instructs this object to pack its state for transfer over the network.

bool

Called when the SceneManager is ready for the registration of render instances.

Processes a move event and updates object state once every 32 milliseconds.

Updates velocity and position, and performs collision testing.

Instructs this object to read state data previously packed with packUpdate.

Public Static Functions

Protected Functions

submitLights(LightManager * lm, bool staticLighting)

Submit lights to the light manager passed in.

Detailed Description

Base class for all projectiles.

Public Types

ProjectileConstants

Enumerator

SourceIdTimeoutTicks = 7
DeleteWaitTime = 500

500 ms delete timeout (for network transmission delays)

ExcessVelDirBits = 7
MaxLivingTicks = 4095
UpdateMasks

Enumerator

BounceMask = Parent::NextFreeMask
ExplosionMask = Parent::NextFreeMask << 1
NextFreeMask = Parent::NextFreeMask << 2

Private Types

typedef GameBase Parent 

Protected Static Attributes

const U32 csmDamageableMask 
const U32 csmDynamicCollisionMask 
const U32 csmStaticCollisionMask 
U32 smProjectileWarpTicks 

Protected Attributes

TSThread * mActivateThread 
U32 mCollideHitType 
Point3F mCurrBackDelta 
Point3F mCurrDeltaBase 
Point3F mCurrPosition 
U32 mCurrTick 

Current time in ticks.

Point3F mCurrVelocity 
ProjectileData * mDataBlock 
Point3F mExplosionNormal 
Point3F mExplosionPosition 
F32 mFadeValue 

set in processTick, interpolation between fadeDelay and lifetime in data block

bool mHasExploded 

Prevent rendering, lighting, and duplicate explosions.

Point3F mInitialPosition 
Point3F mInitialVelocity 
LightInfo * mLight 
LightState mLightState 
TSThread * mMaintainThread 
SimObjectPtr< ParticleEmitter > mParticleEmitter 
SimObjectPtr< ParticleEmitter > mParticleWaterEmitter 
PhysicsWorld * mPhysicsWorld 
TSShapeInstance * mProjectileShape 
SFXSource * mSound 
SimObjectPtr< ShapeBase > mSourceObject 

Actual pointer to the source object, times out after SourceIdTimeoutTicks.

S32 mSourceObjectId 
S32 mSourceObjectSlot 
Point3F mWarpEnd 
Point3F mWarpStart 
U32 mWarpTicksRemaining 

Public Attributes

U32 dynamicCollisionMask 
bool ignoreSourceTimeout 
U32 staticCollisionMask 

Private Static Functions

_setInitialPosition(void * object, const char * index, const char * data)

_setInitialVelocity(void * object, const char * index, const char * data)

Public Functions

Projectile()

~Projectile()

advanceTime(F32 dt)

Reimplemented from: ProcessObject

calculateImpact(F32 simTime, Point3F & pointOfImpact, F32 & impactTime)

DECLARE_CONOBJECT(Projectile )

emitParticles(const Point3F & , const Point3F & , const Point3F & , const U32)

explode(const Point3F & p, const Point3F & n, const U32 collideType)

What to do when this projectile explodes.

Reimplemented by: afxProjectile

getUpdatePriority(CameraScopeQuery * focusObject, U32 updateMask, S32 updateSkips)

Reimplemented from: GameBase

getVelocity()

Reimplemented from: SceneObject

interpolateTick(F32 delta)

Reimplemented from: GameBase

onAdd()

Reimplemented from: GameBase

onCollision(const Point3F & p, const Point3F & n, SceneObject * )

What to do once this projectile collides with something.

onNewDataBlock(GameBaseData * dptr, bool reload)

Reimplemented from: GameBase

onRemove()

Reimplemented from: GameBase

packUpdate(NetConnection * conn, U32 mask, BitStream * stream)

Reimplemented from: GameBase

pointInWater(const Point3F & point)

prepBatchRender(SceneRenderState * state)

prepRenderImage(SceneRenderState * state)

Reimplemented from: SceneObject

processTick(const Move * move)

Reimplemented from: GameBase

setInitialPosition(const Point3F & pos)

setInitialVelocity(const Point3F & vel)

simulate(F32 dt)

Updates velocity and position, and performs collision testing.

unpackUpdate(NetConnection * conn, BitStream * stream)

Reimplemented from: GameBase

updateSound()

Public Static Functions

initPersistFields()

Protected Functions

getLight()

Reimplemented from: ISceneLight

submitLights(LightManager * lm, bool staticLighting)

Reimplemented from: ISceneLight