News SF.net Project Frequently Asked Questions Documentation Downloads Mailing Lists How to Contribute

SourceForge.net Logo

Changing the way games are made and played.

Zap::GameObject class Reference

Zap::GameObject Class Reference

#include <gameObject.h>

Inheritance diagram for Zap::GameObject:

TNL::NetObject TNL::Object Zap::Barrier Zap::EngineeredObject Zap::ForceField Zap::GameType Zap::GoalZone Zap::HuntersNexusObject Zap::MoveObject Zap::Projectile Zap::Teleporter

Public Types

enum  IdleCallPath {
  ServerIdleMainLoop,
  ServerIdleControlFromClient,
  ClientIdleMainRemote,
  ClientIdleControlMain,
  ClientIdleControlReplay
}

Public Member Functions

 GameObject ()
 ~GameObject ()
void addToGame (Game *theGame)
virtual void onAddedToGame (Game *theGame)
void removeFromGame ()
GamegetGame ()
void deleteObject (U32 deleteTimeInterval=0)
U32 getCreationTime ()
bool isInDatabase ()
void setExtent (Rect &extentRect)
Rect getExtent ()
S32 getTeam ()
void findObjects (U32 typeMask, Vector< GameObject * > &fillVector, Rect &extents)
GameObjectfindObjectLOS (U32 typeMask, U32 stateIndex, Point rayStart, Point rayEnd, float &collisionTime, Point &collisionNormal)
bool isControlled ()
void setControllingClient (GameConnection *c)
void setOwner (GameConnection *c)
GameConnectiongetControllingClient ()
GameConnectiongetOwner ()
U32 getObjectTypeMask ()
F32 getUpdatePriority (NetObject *scopeObject, U32 updateMask, S32 updateSkips)
 Called to determine the relative update priority of an object.

virtual S32 getRenderSortValue ()
virtual void render ()
virtual void render (U32 layerIndex)
 render is called twice for every object that is in the render list.

virtual bool getCollisionPoly (Vector< Point > &polyPoints)
virtual bool getCollisionCircle (U32 stateIndex, Point &point, float &radius)
Rect getBounds (U32 stateIndex)
const MovegetCurrentMove ()
const MovegetLastMove ()
void setCurrentMove (const Move &theMove)
void setLastMove (const Move &theMove)
virtual void idle (IdleCallPath path)
virtual void writeControlState (BitStream *stream)
virtual void readControlState (BitStream *stream)
virtual F32 getHealth ()
virtual bool isDestroyed ()
virtual void controlMoveReplayComplete ()
void writeCompressedVelocity (Point &vel, U32 max, BitStream *stream)
void readCompressedVelocity (Point &vel, U32 max, BitStream *stream)
virtual Point getRenderPos ()
virtual Point getActualPos ()
virtual Point getRenderVel ()
virtual Point getActualVel ()
virtual void setActualPos (Point p)
virtual bool collide (GameObject *hitObject)
void radiusDamage (Point pos, F32 innerRad, F32 outerRad, U32 typemask, DamageInfo &info, F32 force=2000.f)
virtual void damageObject (DamageInfo *damageInfo)
bool onGhostAdd (GhostConnection *theConnection)
 onGhostAdd is called on the client side of a connection after the constructor and after the first call to unpackUpdate (the initial call).

void disableCollision ()
void enableCollision ()
void addToDatabase ()
void removeFromDatabase ()
bool isCollisionEnabled ()
virtual void processArguments (S32 argc, const char **argv)
void setScopeAlways ()

Protected Attributes

U32 mObjectTypeMask
Move mLastMove
 the move for the previous update

Move mCurrentMove
 The move for the current update.

S32 mTeam

Private Types

typedef NetObject Parent

Private Attributes

GamemGame
U32 mLastQueryId
U32 mCreationTime
SafePtr< GameConnectionmControllingClient
SafePtr< GameConnectionmOwner
U32 mDisableCollisionCount
bool mInDatabase
Rect extent

Friends

class GridDatabase

Member Typedef Documentation

typedef NetObject Zap::GameObject::Parent [private]
 

Reimplemented from TNL::NetObject.

Reimplemented in Zap::CTFGameType, Zap::EngineeredObject, Zap::ForceFieldProjector, Zap::Turret, Zap::FlagItem, Zap::GoalZone, Zap::HuntersGameType, Zap::HuntersFlagItem, Zap::HuntersNexusObject, Zap::PickupItem, Zap::GrenadeProjectile, Zap::Mine, Zap::RabbitGameType, Zap::Ship, Zap::SoccerGameType, and Zap::SoccerBallItem.


Member Enumeration Documentation

enum Zap::GameObject::IdleCallPath
 

Enumeration values:
ServerIdleMainLoop 
ServerIdleControlFromClient 
ClientIdleMainRemote 
ClientIdleControlMain 
ClientIdleControlReplay 


Constructor & Destructor Documentation

Zap::GameObject::GameObject  ) 
 

Zap::GameObject::~GameObject  )  [inline]
 


Member Function Documentation

void Zap::GameObject::addToGame Game theGame  ) 
 

virtual void Zap::GameObject::onAddedToGame Game theGame  )  [virtual]
 

Reimplemented in Zap::Barrier, Zap::Turret, Zap::FlagItem, Zap::GameType, Zap::GoalZone, Zap::HuntersNexusObject, Zap::SoccerBallItem, and Zap::Teleporter.

void Zap::GameObject::removeFromGame  ) 
 

Game* Zap::GameObject::getGame  )  [inline]
 

void Zap::GameObject::deleteObject U32  deleteTimeInterval = 0  ) 
 

U32 Zap::GameObject::getCreationTime  )  [inline]
 

bool Zap::GameObject::isInDatabase  )  [inline]
 

void Zap::GameObject::setExtent Rect extentRect  ) 
 

Rect Zap::GameObject::getExtent  )  [inline]
 

S32 Zap::GameObject::getTeam  )  [inline]
 

void Zap::GameObject::findObjects U32  typeMask,
Vector< GameObject * > &  fillVector,
Rect extents
 

GameObject* Zap::GameObject::findObjectLOS U32  typeMask,
U32  stateIndex,
Point  rayStart,
Point  rayEnd,
float &  collisionTime,
Point collisionNormal
 

bool Zap::GameObject::isControlled  )  [inline]
 

void Zap::GameObject::setControllingClient GameConnection c  ) 
 

void Zap::GameObject::setOwner GameConnection c  ) 
 

GameConnection* Zap::GameObject::getControllingClient  ) 
 

GameConnection* Zap::GameObject::getOwner  ) 
 

U32 Zap::GameObject::getObjectTypeMask  )  [inline]
 

F32 Zap::GameObject::getUpdatePriority NetObject *  scopeObject,
U32  updateMask,
S32  updateSkips
[virtual]
 

Called to determine the relative update priority of an object.

All objects that are in scope and that have out of date states are queried and sorted by priority before being updated. If there is not enough room in a single packet for all out of date objects, the skipped objects will have an incremented updateSkips the next time that connection prepares to send a packet. Typically the update priority is scaled by updateSkips so that as data becomes stale, it becomes more of a priority to update.

Reimplemented from TNL::NetObject.

virtual S32 Zap::GameObject::getRenderSortValue  )  [inline, virtual]
 

Reimplemented in Zap::Barrier, Zap::ForceField, Zap::GoalZone, and Zap::HuntersNexusObject.

virtual void Zap::GameObject::render  )  [virtual]
 

Reimplemented in Zap::ForceField, Zap::ForceFieldProjector, Zap::Turret, Zap::GoalZone, Zap::HuntersNexusObject, Zap::Item, Zap::Projectile, Zap::Ship, and Zap::Teleporter.

virtual void Zap::GameObject::render U32  layerIndex  )  [virtual]
 

render is called twice for every object that is in the render list.

By default GameObject will call the render() method one time (when layerIndex == 0).

Reimplemented in Zap::Barrier.

virtual bool Zap::GameObject::getCollisionPoly Vector< Point > &  polyPoints  )  [virtual]
 

Reimplemented in Zap::Barrier, Zap::ForceField, Zap::ForceFieldProjector, Zap::Turret, Zap::GoalZone, and Zap::HuntersNexusObject.

virtual bool Zap::GameObject::getCollisionCircle U32  stateIndex,
Point point,
float &  radius
[virtual]
 

Reimplemented in Zap::MoveObject.

Rect Zap::GameObject::getBounds U32  stateIndex  ) 
 

const Move& Zap::GameObject::getCurrentMove  )  [inline]
 

const Move& Zap::GameObject::getLastMove  )  [inline]
 

void Zap::GameObject::setCurrentMove const Move theMove  )  [inline]
 

void Zap::GameObject::setLastMove const Move theMove  )  [inline]
 

virtual void Zap::GameObject::idle IdleCallPath  path  )  [virtual]
 

Reimplemented in Zap::Turret, Zap::GrenadeProjectile, Zap::Mine, and Zap::Ship.

virtual void Zap::GameObject::writeControlState BitStream *  stream  )  [virtual]
 

Reimplemented in Zap::Ship.

virtual void Zap::GameObject::readControlState BitStream *  stream  )  [virtual]
 

Reimplemented in Zap::Ship.

virtual F32 Zap::GameObject::getHealth  )  [inline, virtual]
 

Reimplemented in Zap::EngineeredObject, and Zap::Ship.

virtual bool Zap::GameObject::isDestroyed  )  [inline, virtual]
 

Reimplemented in Zap::EngineeredObject, and Zap::Ship.

virtual void Zap::GameObject::controlMoveReplayComplete  )  [virtual]
 

Reimplemented in Zap::Ship.

void Zap::GameObject::writeCompressedVelocity Point vel,
U32  max,
BitStream *  stream
 

void Zap::GameObject::readCompressedVelocity Point vel,
U32  max,
BitStream *  stream
 

virtual Point Zap::GameObject::getRenderPos  )  [virtual]
 

Reimplemented in Zap::MoveObject.

virtual Point Zap::GameObject::getActualPos  )  [virtual]
 

Reimplemented in Zap::MoveObject.

virtual Point Zap::GameObject::getRenderVel  )  [inline, virtual]
 

Reimplemented in Zap::MoveObject, and Zap::Projectile.

virtual Point Zap::GameObject::getActualVel  )  [inline, virtual]
 

Reimplemented in Zap::MoveObject, and Zap::Projectile.

virtual void Zap::GameObject::setActualPos Point  p  )  [virtual]
 

Reimplemented in Zap::Item, and Zap::Ship.

virtual bool Zap::GameObject::collide GameObject hitObject  )  [inline, virtual]
 

Reimplemented in Zap::Barrier, Zap::EngineeredObject, Zap::ForceField, Zap::FlagItem, Zap::GoalZone, Zap::HuntersFlagItem, Zap::HuntersNexusObject, Zap::Item, Zap::PickupItem, Zap::MoveObject, Zap::GrenadeProjectile, Zap::Mine, and Zap::SoccerBallItem.

void Zap::GameObject::radiusDamage Point  pos,
F32  innerRad,
F32  outerRad,
U32  typemask,
DamageInfo info,
F32  force = 2000.f
 

virtual void Zap::GameObject::damageObject DamageInfo damageInfo  )  [virtual]
 

Reimplemented in Zap::EngineeredObject, Zap::GrenadeProjectile, Zap::Mine, Zap::Ship, and Zap::SoccerBallItem.

bool Zap::GameObject::onGhostAdd GhostConnection theConnection  )  [virtual]
 

onGhostAdd is called on the client side of a connection after the constructor and after the first call to unpackUpdate (the initial call).

Returning true signifies no error - returning false causes the connection to abort.

Reimplemented from TNL::NetObject.

void Zap::GameObject::disableCollision  )  [inline]
 

void Zap::GameObject::enableCollision  )  [inline]
 

void Zap::GameObject::addToDatabase  ) 
 

void Zap::GameObject::removeFromDatabase  ) 
 

bool Zap::GameObject::isCollisionEnabled  )  [inline]
 

virtual void Zap::GameObject::processArguments S32  argc,
const char **  argv
[virtual]
 

Reimplemented in Zap::EngineeredObject, Zap::FlagItem, Zap::GameType, Zap::GoalZone, Zap::HuntersGameType, Zap::HuntersNexusObject, Zap::Item, Zap::RabbitGameType, Zap::Ship, Zap::SoccerBallItem, and Zap::Teleporter.

void Zap::GameObject::setScopeAlways  ) 
 


Friends And Related Function Documentation

friend class GridDatabase [friend]
 


Field Documentation

Game* Zap::GameObject::mGame [private]
 

U32 Zap::GameObject::mLastQueryId [private]
 

U32 Zap::GameObject::mCreationTime [private]
 

SafePtr<GameConnection> Zap::GameObject::mControllingClient [private]
 

SafePtr<GameConnection> Zap::GameObject::mOwner [private]
 

Reimplemented in Zap::EngineeredObject.

U32 Zap::GameObject::mDisableCollisionCount [private]
 

bool Zap::GameObject::mInDatabase [private]
 

Rect Zap::GameObject::extent [private]
 

U32 Zap::GameObject::mObjectTypeMask [protected]
 

Move Zap::GameObject::mLastMove [protected]
 

the move for the previous update

Move Zap::GameObject::mCurrentMove [protected]
 

The move for the current update.

S32 Zap::GameObject::mTeam [protected]