torque Torque Game Engine Documentation
TGE Version 1.5.2

Projectile Class Reference

#include <projectile.h>

Inheritance diagram for Projectile:

Inheritance graph
[legend]

Detailed Description

Base class for all projectiles.


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
}

Public Member Functions

F32 getUpdatePriority (CameraScopeQuery *focusObject, U32 updateMask, S32 updateSkips)
 This returns a value which is used to prioritize which objects need to be updated.
 Projectile ()
 ~Projectile ()
 DECLARE_CONOBJECT (Projectile)
virtual bool calculateImpact (float simTime, Point3F &pointOfImpact, float &impactTime)

Static Public Member Functions

static void initPersistFields ()
 Register dynamic fields in a subclass of ConsoleObject.

Static Public Attributes

static U32 smProjectileWarpTicks

Protected Member Functions

void registerLights (LightManager *lm, bool lightingScene)
 Called to register the object's lights, if any, with the LightManager.
bool onAdd ()
 Called when the object is added to the sim.
void onRemove ()
 Called when the object is removed from the sim.
bool onNewDataBlock (GameBaseData *dptr)
 Called when a new datablock is set.
void processTick (const Move *move)
 Processes a move event and updates object state once every 32 milliseconds.
void advanceTime (F32 dt)
 Advances simulation time for animations.
void interpolateTick (F32 delta)
 Interpolates between tick events.
virtual void onCollision (const Point3F &p, const Point3F &n, SceneObject *)
 What to do once this projectile collides with something.
virtual void explode (const Point3F &p, const Point3F &n, const U32 collideType)
 What to do when this projectile explodes.
Point3F getVelocity () const
 Returns the velocity of the projectile.
void emitParticles (const Point3F &, const Point3F &, const Point3F &, const U32)
void updateSound ()
void prepModelView (SceneState *state)
bool prepRenderImage (SceneState *state, const U32 stateKey, const U32 startZone, const bool modifyBaseZoneState=false)
 Called when the SceneGraph is ready for the registration of RenderImages.
void renderObject (SceneState *state, SceneRenderImage *image)
 Called when the object is supposed to render itself.
bool pointInWater (const Point3F &point)
 Tests to see if a point is in water.
U32 packUpdate (NetConnection *conn, U32 mask, BitStream *stream)
 Instructs this object to pack its state for transfer over the network.
void unpackUpdate (NetConnection *conn, BitStream *stream)
 Instructs this object to read state data previously packed with packUpdate.

Protected Attributes

ProjectileDatamDataBlock
ParticleEmittermParticleEmitter
ParticleEmittermParticleWaterEmitter
AUDIOHANDLE mSoundHandle
Point3F mCurrPosition
Point3F mCurrVelocity
S32 mSourceObjectId
S32 mSourceObjectSlot
U32 mCurrTick
 Current time in ticks.
SimObjectPtr< ShapeBasemSourceObject
 Actual pointer to the source object, times out after SourceIdTimeoutTicks.
TSShapeInstancemProjectileShape
TSThreadmActivateThread
TSThreadmMaintainThread
Point3F mLastRenderPos
LightInfo mLight
bool mHidden
 set by the derived class, if true, projectile doesn't render
F32 mFadeValue
 set in processTick, interpolation between fadeDelay and lifetime in data block
Point3F mWarpStart
Point3F mWarpEnd
U32 mWarpTicksRemaining
Point3F mCurrDeltaBase
Point3F mCurrBackDelta
Point3F mExplosionPosition
Point3F mExplosionNormal
U32 mCollideHitType

Static Protected Attributes

static const U32 csmStaticCollisionMask
static const U32 csmDynamicCollisionMask
static const U32 csmDamageableMask

Private Types

typedef GameBase Parent


Member Typedef Documentation

typedef GameBase Projectile::Parent [private]

Reimplemented from GameBase.


Member Enumeration Documentation

Enumerator:
SourceIdTimeoutTicks 
DeleteWaitTime  500 ms delete timeout (for network transmission delays)
ExcessVelDirBits 
MaxLivingTicks 

Enumerator:
BounceMask 
ExplosionMask 
NextFreeMask 


Constructor & Destructor Documentation

Projectile::Projectile (  ) 

Projectile::~Projectile (  ) 


Member Function Documentation

void Projectile::registerLights ( LightManager lm,
bool  lightingScene 
) [protected, virtual]

Called to register the object's lights, if any, with the LightManager.

Parameters:
lm LightManager to put lights into.
lightingScene True if we're currently calculating lighting information.

Reimplemented from SimObject.

bool Projectile::onAdd (  )  [protected, virtual]

Called when the object is added to the sim.

Reimplemented from GameBase.

void Projectile::onRemove (  )  [protected, virtual]

Called when the object is removed from the sim.

Reimplemented from GameBase.

bool Projectile::onNewDataBlock ( GameBaseData dptr  )  [protected, virtual]

Called when a new datablock is set.

This allows subclasses to appropriately handle new datablocks.

See also:
setDataBlock()
Parameters:
dptr New datablock

Reimplemented from GameBase.

void Projectile::processTick ( const Move move  )  [protected, virtual]

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

This takes place both on the client and server, every 32 milliseconds (1 tick).

See also:
ProcessList
Parameters:
move Move event corresponding to this tick, or NULL.

Reimplemented from GameBase.

void Projectile::advanceTime ( F32  dt  )  [protected, virtual]

Advances simulation time for animations.

This is called every frame.

Parameters:
dt Time since last advance call

Reimplemented from GameBase.

void Projectile::interpolateTick ( F32  delta  )  [protected, virtual]

Interpolates between tick events.

This takes place on the CLIENT ONLY.

Parameters:
delta Time since last call to interpolate

Reimplemented from GameBase.

virtual void Projectile::onCollision ( const Point3F p,
const Point3F n,
SceneObject  
) [protected, virtual]

What to do once this projectile collides with something.

virtual void Projectile::explode ( const Point3F p,
const Point3F n,
const U32  collideType 
) [protected, virtual]

What to do when this projectile explodes.

Point3F Projectile::getVelocity (  )  const [protected, virtual]

Returns the velocity of the projectile.

Reimplemented from SceneObject.

void Projectile::emitParticles ( const Point3F ,
const Point3F ,
const Point3F ,
const   U32 
) [protected]

void Projectile::updateSound (  )  [protected]

void Projectile::prepModelView ( SceneState state  )  [protected]

bool Projectile::prepRenderImage ( SceneState state,
const U32  stateKey,
const U32  startZone,
const bool  modifyBaseZoneState = false 
) [protected, virtual]

Called when the SceneGraph is ready for the registration of RenderImages.

See also:
SceneState
Parameters:
state SceneState
stateKey State key of the current SceneState
startZone Base zone index
modifyBaseZoneState If true, the object needs to modify the zone state.

Reimplemented from SceneObject.

void Projectile::renderObject ( SceneState state,
SceneRenderImage image 
) [protected, virtual]

Called when the object is supposed to render itself.

Parameters:
state Current rendering state.
See also:
SceneState
Parameters:
image Image associated with this object to render.
See also:
SceneRenderImage

Reimplemented from SceneObject.

bool Projectile::pointInWater ( const Point3F point  )  [protected]

Tests to see if a point is in water.

U32 Projectile::packUpdate ( NetConnection conn,
U32  mask,
BitStream stream 
) [protected, virtual]

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

Parameters:
conn Net connection being used
mask Mask indicating fields to transmit.
stream Bitstream to pack data to
Returns:
Any bits which were not dealt with. The value is stored by the networking system. Don't set bits you weren't passed.

Reimplemented from GameBase.

void Projectile::unpackUpdate ( NetConnection conn,
BitStream stream 
) [protected, virtual]

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

Parameters:
conn Net connection being used
stream stream to read from

Reimplemented from GameBase.

F32 Projectile::getUpdatePriority ( CameraScopeQuery focusObject,
U32  updateMask,
S32  updateSkips 
) [virtual]

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

In NetObject, our returned priority is 0.1 * updateSkips, so that less recently updated objects are more likely to be updated.

In subclasses, this can be adjusted. For instance, ShapeBase provides priority based on proximity to the camera.

Parameters:
focusObject Information from a previous call to onCameraScopeQuery.
updateMask Current update mask.
updateSkips Number of ticks we haven't been updated for.
Returns:
A floating point value indicating priority. These are typically < 5.0.

Reimplemented from GameBase.

Projectile::DECLARE_CONOBJECT ( Projectile   ) 

static void Projectile::initPersistFields (  )  [static]

Register dynamic fields in a subclass of ConsoleObject.

See also:
addField(), addFieldV(), addDepricatedField(), addGroup(), endGroup()

Reimplemented from GameBase.

virtual bool Projectile::calculateImpact ( float  simTime,
Point3F pointOfImpact,
float &  impactTime 
) [virtual]


Field Documentation

Reimplemented from GameBase.

Current time in ticks.

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

bool Projectile::mHidden [protected]

set by the derived class, if true, projectile doesn't render

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

const U32 Projectile::csmStaticCollisionMask [static, protected]

const U32 Projectile::csmDynamicCollisionMask [static, protected]

const U32 Projectile::csmDamageableMask [static, protected]




All Rights Reserved GarageGames.com, Inc. 1999-2005
Auto-magically Generated with Doxygen