Main Page Modules Namespaces C++ Classes Compound List File List Index
TNL: Zap::Projectile Class Reference

# Zap::Projectile Class Reference

`#include <projectile.h>`

Inheritance diagram for Zap::Projectile:

## Public Types

enum | { CompressedVelocityMax = 2047, InitialMask = BIT(0), ExplodedMask = BIT(1) }

## Public Member Functions

| Projectile (U32 type=ProjectilePhaser, Point pos=Point(), Point vel=Point(), U32 liveTime=0, GameObject *shooter=NULL)
U32 | packUpdate (GhostConnection *connection, U32 updateMask, BitStream *stream)
| Write the object's state to a packet.
void | unpackUpdate (GhostConnection *connection, BitStream *stream)
| Unpack data written by packUpdate().
void | handleCollision (GameObject *theObject, Point collisionPoint)
void | idle (GameObject::IdleCallPath path)
void | explode (GameObject *hitObject, Point p)
virtual Point | getRenderVel ()
virtual Point | getActualVel ()
void | render ()
| TNL_DECLARE_CLASS (Projectile)

## Data Fields

Point | pos
Point | velocity
U32 | mTimeRemaining
U32 | mType
bool | collided
bool | alive
SafePtr< GameObject > | mShooter

## Member Enumeration Documentation

anonymous enum

Enumerator:

  CompressedVelocityMax |
  InitialMask |
  ExplodedMask |

## Constructor & Destructor Documentation

Zap::Projectile::Projectile | ( | U32 | type = `ProjectilePhaser`,
|  | Point | pos = `Point()`,
|  | Point | vel = `Point()`,
|  | U32 | liveTime = `0`,
|  | GameObject * | shooter = `NULL` |
| ) |  |  |

## Member Function Documentation

U32 Zap::Projectile::packUpdate | ( | GhostConnection * | connection,
|  | U32 | updateMask,
|  | BitStream * | stream |
| ) |  |  | `[virtual]`

Write the object's state to a packet.

packUpdate is called on an object when it is to be written into a packet stream for transmission to the client. The updateMask parameter contains the out-of-date state mask for the object. The initial update mask for any object to a client will always be 0xFFFFFFFF, signifying that all states are out of date. It is often useful to check for this mask, to write one-time initialization information for that object.

Reimplemented from TNL::NetObject.

void Zap::Projectile::unpackUpdate | ( | GhostConnection * | connection,
|  | BitStream * | stream |
| ) |  |  | `[virtual]`

Unpack data written by packUpdate().

unpackUpdate is called on the client to read an update out of a packet's bit stream. Because the update mask is not encoded by the network system directly, each unpack update function will have to determine from the bit stream which states are being updated.

Reimplemented from TNL::NetObject.

void Zap::Projectile::handleCollision | ( | GameObject * | theObject,
|  | Point | collisionPoint |
| ) |  |  |

void Zap::Projectile::idle | ( | GameObject::IdleCallPath | path | ) | `[virtual]`

Reimplemented from Zap::GameObject.

void Zap::Projectile::explode | ( | GameObject * | hitObject,
|  | Point | p |
| ) |  |  |

virtual Point Zap::Projectile::getRenderVel | ( |  | ) | `[inline, virtual]`

Reimplemented from Zap::GameObject.

virtual Point Zap::Projectile::getActualVel | ( |  | ) | `[inline, virtual]`

Reimplemented from Zap::GameObject.

void Zap::Projectile::render | ( |  | ) | `[virtual]`

Reimplemented from Zap::GameObject.

Zap::Projectile::TNL_DECLARE_CLASS | ( | Projectile |  | ) |

## Field Documentation

Point Zap::Projectile::pos

Point Zap::Projectile::velocity

U32 Zap::Projectile::mTimeRemaining

U32 Zap::Projectile::mType

bool Zap::Projectile::collided

bool Zap::Projectile::alive

SafePtr<GameObject> Zap::Projectile::mShooter