CObject Class Reference

#include <structs.h>

Collaboration diagram for CObject:

Collaboration graph
[legend]
List of all members.

Detailed Description

This class represents the basic game world object entity. All game world objects are of this class, including tanks, powerups, and projectiles. The class contains link pointers which allow objects to be connected in a bi-directional linked-list structure.

Todo:
Remove default constructor in favor of a constructor which specifies a particular iType member and parent CWorld object.

Definition at line 134 of file structs.h.

Public Member Functions

 CObject (void)
 default constructor
 CObject (int typeID, CWorld *ThisWorld)
 standard constructor
int Draw (void)
 draw this object on the screen
void StartAnimating (void)
 start an object's animation
void StopAnimating (void)
 stop an object's animation
void SetBB (float left, float right, float bottom, float top)
 set this object's bounding box

Public Attributes

CWorldParentWorld
 the CWorld object that this object is part of
Vector Position
 this object's world-coordinate position in 2D space
Vector OldPosition
Vector Acceleration
 this object's 2D acceleration vector
Vector Velocity
 this object's 2D velocity vector
CObjectPrevious
 a link to the previous CObject when this object is in a linked list
CObjectNext
 a link to the next CObject when this object is in a linked list
CObjectOwner
 a link to another CObject which 'owns' this object
float fBBLeft
 left edge of this object's bounding box
float fBBRight
 right edge of this object's bounding box
float fBBBottom
 top edge of this object's bounding box
float fBBTop
 bottom edge of this object's bounding box
float fDrawLeft
 left edge of this object's texture map area
float fDrawRight
 right edge of this object's texture map area
float fDrawBottom
 bottom edge of this object's texture map area
float fDrawTop
 top edge of this object's texture map area
float fAngle
 Z axis angle of this object in relation to the playfield.
float fSubAngle
 auxilliary angle used to keep track of a tank's turret
int iOwnCount
 the number of objects this object 'owns'
int iType
 a type ID representing this objects type (e.g. super-bullet)
int iHealth
 the amount of health this object has
int iDamage
 the amount of damage this object will do when damaging another object
int iLives
 the amount of remaining 'rest' lives the player has
int iTint
 the tint color of this object, used to mark an object's ownership
int iRemovalEffects
 the total number of effects to create when the object is removed
int iRemovalEffect [8]
 the effect to put in this object's place when it's removed (health == 0)
int iRemovalSound
 the sound to play when this object is removed
int iDamageSound
 the sound to play when this object is damaged
bool iInput [8]
 an array representing the objects 'input' for use with tank control
int iTexture
 a texture ID representing the texture map that should be drawn for this object
int iWeapon
 the weapon this player/NPC is wielding
int iAmmo
 the number of rounds of ammunition this object is carrying (-1 == infinity)
bool bCheckedForCollision
 a progress flag reset each time through the collision routines
bool bDying
 object has no health, but is still playing it's outro animation
bool bVisible
 whether or not the object should be drawn to the screen
int iCreationAnim
int iCreationAnimSpeed
int iNormalAnim
int iNormalAnimSpeed
int iRemovalAnim
int iRemovalAnimSpeed
Uint32 iAnimSpeed [3]
bool bAnimCycle
bool bAnimating
int iCurrentFrame
Uint32 iAnimTimeStamp
int iLingerTime

Protected Attributes

CGeometryGeometry
 a pointer to the geometry used to represent this object
CEffectEffects
 a pointer to the effects that are attached to this object


Constructor & Destructor Documentation

CObject::CObject ( void   ) 

Create a CObject class object with default parameters.

Definition at line 674 of file structs.cpp.

References ANIM_CYCLE_CYCLE, ANIMID_NULL, bAnimating, bAnimCycle, bCheckedForCollision, bDying, bVisible, DEFAULT_ANGLE, DEFAULT_BB_BOTTOM, DEFAULT_BB_LEFT, DEFAULT_BB_RIGHT, DEFAULT_BB_TOP, DEFAULT_DAMAGE, DEFAULT_DRAW_BOTTOM, DEFAULT_DRAW_LEFT, DEFAULT_DRAW_RIGHT, DEFAULT_DRAW_TOP, DEFAULT_HEALTH, DEFAULT_LINGER_TIME, DEFAULT_LIVES, DEFAULT_SUB_ANGLE, Effects, fAngle, fBBBottom, fBBLeft, fBBRight, fBBTop, fDrawBottom, fDrawLeft, fDrawRight, fDrawTop, fSubAngle, Geometry, iAmmo, iAnimTimeStamp, iCreationAnim, iCreationAnimSpeed, iCurrentFrame, iDamage, iDamageSound, iHealth, iInput, iLingerTime, iLives, iNormalAnim, iNormalAnimSpeed, iOwnCount, iRemovalAnim, iRemovalAnimSpeed, iRemovalEffects, iRemovalSound, iTexture, iTint, iType, iWeapon, Next, Owner, ParentWorld, Previous, SOUNDID_NULL, TEXID_NULL, TINTID_NULL, TYPEID_NULL, and WEAPONID_PEA_SHOT.

CObject::CObject ( int  typeID,
CWorld ThisWorld 
)

Creates a CWorld class object, specifying the objects type via the iType member, and the world to which this object will belong using the ParentWorld member.

Definition at line 741 of file structs.cpp.

References ANIM_CYCLE_CYCLE, ANIMID_NULL, bAnimating, bAnimCycle, bCheckedForCollision, bDying, bVisible, DEFAULT_ANGLE, DEFAULT_BB_BOTTOM, DEFAULT_BB_LEFT, DEFAULT_BB_RIGHT, DEFAULT_BB_TOP, DEFAULT_DAMAGE, DEFAULT_DRAW_BOTTOM, DEFAULT_DRAW_LEFT, DEFAULT_DRAW_RIGHT, DEFAULT_DRAW_TOP, DEFAULT_HEALTH, DEFAULT_LINGER_TIME, DEFAULT_LIVES, DEFAULT_SUB_ANGLE, Effects, fAngle, fBBBottom, fBBLeft, fBBRight, fBBTop, fDrawBottom, fDrawLeft, fDrawRight, fDrawTop, fSubAngle, Geometry, iAmmo, iAnimTimeStamp, iCreationAnim, iCreationAnimSpeed, iCurrentFrame, iDamage, iDamageSound, iHealth, iInput, iLingerTime, iLives, iNormalAnim, iNormalAnimSpeed, iOwnCount, iRemovalAnim, iRemovalAnimSpeed, iRemovalEffects, iRemovalSound, iTexture, iTint, iType, iWeapon, Next, Owner, ParentWorld, Previous, SOUNDID_NULL, TEXID_BOUNCY_SHOT, TEXID_CRATE, TEXID_HEAT_SEEKER, TEXID_LAND_MINE, TEXID_NULL, TEXID_PEA_SHOT, TEXID_POWERUP_BS, TEXID_POWERUP_HEALTH, TEXID_POWERUP_HS, TEXID_POWERUP_LM, TEXID_POWERUP_PS, TEXID_POWERUP_SB, TEXID_SUPER_BULLET, TEXID_TANK, TEXID_TNT_BLOCK, TEXID_WALL_BLOCK, TINTID_NULL, TYPEID_BOUNCY_SHOT, TYPEID_HEAT_SEEKER, TYPEID_LAND_MINE, TYPEID_PEA_SHOT, TYPEID_POWERUP_BS, TYPEID_POWERUP_HEALTH, TYPEID_POWERUP_HS, TYPEID_POWERUP_LM, TYPEID_POWERUP_PS, TYPEID_POWERUP_SB, TYPEID_SUPER_BULLET, TYPEID_TANK, TYPEID_TNT_BLOCK, TYPEID_WALL_BLOCK, TYPEID_WOOD_BLOCK, WEAPONID_NULL, and WEAPONID_PEA_SHOT.


Member Function Documentation

int CObject::Draw ( void   ) 

Draw this object on the screen, based on the object's member data. If enabled, draw a bounding box around the object to help visualize the boundary used for collision-detection.

Definition at line 928 of file structs.cpp.

References ANIMID_CRATECRUSH, bAnimating, DRAW_BOUNDING_BOXES, fAngle, fBBBottom, fBBLeft, fBBRight, fBBTop, fDrawBottom, fDrawLeft, fDrawRight, fDrawTop, GetFrame(), GetTexture(), iCurrentFrame, iTint, Position, TINTID_ARMYBROWN, TINTID_ARMYGREEN, TINTID_BLUE, TINTID_GREEN, TINTID_NULL, TINTID_ORANGE, TINTID_PURPLE, TINTID_RED, TINTID_YELLOW, Vector::x, and Vector::y.

Referenced by DrawObjects().

Here is the call graph for this function:

Here is the caller graph for this function:

void CObject::StartAnimating ( void   ) 

Set the object's animation flag so that the animation routines update this object, advancing it's frame based on the objects delay variable. The drawing routines will now draw this object's current animation frame.

Definition at line 1011 of file structs.cpp.

References bAnimating, iAnimTimeStamp, iCurrentFrame, CWorld::iCurrentTime, and ParentWorld.

void CObject::StopAnimating ( void   ) 

Set the object's animation flag so that the animation routines ignore this object. The drawing routines will now draw this object's normal texture.

Definition at line 1024 of file structs.cpp.

References bAnimating.

void CObject::SetBB ( float  left,
float  right,
float  bottom,
float  top 
)

The parameters passed to this function represent lines defining the extents of the bounding box surrounding this object. For example, the fBBTop member defines the y-coordinate of the line defining the top of this objects bounding box.

Definition at line 1037 of file structs.cpp.

References fBBBottom, fBBLeft, fBBRight, and fBBTop.


Member Data Documentation

CGeometry* CObject::Geometry [protected]

Definition at line 137 of file structs.h.

Referenced by CObject().

CEffect* CObject::Effects [protected]

Definition at line 138 of file structs.h.

Referenced by CObject().

CWorld* CObject::ParentWorld

Definition at line 140 of file structs.h.

Referenced by CObject(), GameLogicFire(), PlayGame(), RemoveDeadObjects(), and StartAnimating().

Vector CObject::Position

Definition at line 141 of file structs.h.

Referenced by DamageRadius(), DoCollisions(), Draw(), DrawGLScene(), GameLogicFire(), InitGame(), CWorld::LoadLevel(), PhysicsReflect(), PhysicsStop(), PhysicsUpdate(), PlayGame(), ProcessTileCollisions(), and RemoveDeadObjects().

Vector CObject::OldPosition

Definition at line 142 of file structs.h.

Referenced by PhysicsStop(), and PhysicsUpdate().

Vector CObject::Acceleration

Definition at line 143 of file structs.h.

Vector CObject::Velocity

Definition at line 144 of file structs.h.

Referenced by DamageRadius(), GameLogicFire(), PhysicsReflect(), PhysicsStop(), RemoveDeadObjects(), and UpdateBody().

CObject* CObject::Previous

Definition at line 145 of file structs.h.

Referenced by CWorld::AddObject(), CObject(), and CWorld::RemoveObject().

CObject* CObject::Next

Definition at line 146 of file structs.h.

Referenced by CWorld::AddObject(), CObject(), DamageRadius(), DoCollisions(), DrawObjects(), PhysicsUpdate(), RemoveDeadObjects(), CWorld::RemoveObject(), and UpdateAnimation().

CObject* CObject::Owner

Definition at line 147 of file structs.h.

Referenced by CObject(), GameLogicFire(), RemoveDeadObjects(), and CWorld::RemoveObject().

float CObject::fBBLeft

Definition at line 148 of file structs.h.

Referenced by CObject(), DoCollisions(), Draw(), ProcessTileCollisions(), and SetBB().

float CObject::fBBRight

Definition at line 149 of file structs.h.

Referenced by CObject(), DoCollisions(), Draw(), ProcessTileCollisions(), and SetBB().

float CObject::fBBBottom

Definition at line 150 of file structs.h.

Referenced by CObject(), DoCollisions(), Draw(), ProcessTileCollisions(), and SetBB().

float CObject::fBBTop

Definition at line 151 of file structs.h.

Referenced by CObject(), DoCollisions(), Draw(), ProcessTileCollisions(), and SetBB().

float CObject::fDrawLeft

Definition at line 152 of file structs.h.

Referenced by CObject(), and Draw().

float CObject::fDrawRight

Definition at line 153 of file structs.h.

Referenced by CObject(), and Draw().

float CObject::fDrawBottom

Definition at line 154 of file structs.h.

Referenced by CObject(), and Draw().

float CObject::fDrawTop

Definition at line 155 of file structs.h.

Referenced by CObject(), and Draw().

float CObject::fAngle

Definition at line 156 of file structs.h.

Referenced by CObject(), Draw(), GameLogicFire(), InitGame(), PhysicsUpdate(), PlayGame(), and UpdateBody().

float CObject::fSubAngle

Definition at line 157 of file structs.h.

Referenced by CObject(), GameLogicFire(), InitGame(), and PhysicsUpdate().

int CObject::iOwnCount

Definition at line 158 of file structs.h.

Referenced by CObject(), GameLogicFire(), PhysicsUpdate(), RemoveDeadObjects(), and CWorld::RemoveObject().

int CObject::iType

Definition at line 159 of file structs.h.

Referenced by CObject(), Collide(), DamageRadius(), GameLogicEquip(), PhysicsReflect(), RemoveDeadObjects(), and UpdateBody().

int CObject::iHealth

Definition at line 160 of file structs.h.

Referenced by CObject(), Collide(), DamageRadius(), DrawGLScene(), DrawHUD(), GameLogicDamage(), GameLogicDamageVal(), GameLogicEquip(), InitGame(), PlayGame(), ProcessTileCollisions(), and RemoveDeadObjects().

int CObject::iDamage

Definition at line 161 of file structs.h.

Referenced by CObject(), GameLogicDamage(), and RemoveDeadObjects().

int CObject::iLives

Definition at line 162 of file structs.h.

Referenced by CObject().

int CObject::iTint

Definition at line 163 of file structs.h.

Referenced by CObject(), Draw(), GameLogicFire(), and InitGame().

int CObject::iRemovalEffects

Definition at line 164 of file structs.h.

Referenced by CObject(), GameLogicFire(), InitGame(), CWorld::LoadLevel(), and RemoveDeadObjects().

int CObject::iRemovalEffect[8]

Definition at line 165 of file structs.h.

Referenced by GameLogicFire(), InitGame(), CWorld::LoadLevel(), and RemoveDeadObjects().

int CObject::iRemovalSound

Definition at line 166 of file structs.h.

Referenced by CObject(), GameLogicFire(), CWorld::LoadLevel(), and RemoveDeadObjects().

int CObject::iDamageSound

Definition at line 167 of file structs.h.

Referenced by CObject(), GameLogicDamage(), GameLogicDamageVal(), GameLogicFire(), InitGame(), and CWorld::LoadLevel().

bool CObject::iInput[8]

Definition at line 168 of file structs.h.

Referenced by CObject(), PhysicsUpdate(), PlayGame(), and RemoveDeadObjects().

int CObject::iTexture

Definition at line 169 of file structs.h.

Referenced by CObject(), and GameLogicFire().

int CObject::iWeapon

Definition at line 170 of file structs.h.

Referenced by CObject(), DrawHUD(), GameLogicEquip(), and GameLogicFire().

int CObject::iAmmo

Definition at line 171 of file structs.h.

Referenced by CObject(), GameLogicEquip(), GameLogicFire(), and PlayGame().

bool CObject::bCheckedForCollision

Definition at line 172 of file structs.h.

Referenced by CObject(), and DoCollisions().

bool CObject::bDying

Definition at line 173 of file structs.h.

Referenced by CObject().

bool CObject::bVisible

Definition at line 174 of file structs.h.

Referenced by CObject(), DrawObjects(), and RemoveDeadObjects().

int CObject::iCreationAnim

Definition at line 177 of file structs.h.

Referenced by CObject().

int CObject::iCreationAnimSpeed

Definition at line 178 of file structs.h.

Referenced by CObject().

int CObject::iNormalAnim

Definition at line 179 of file structs.h.

Referenced by CObject(), InitGame(), and UpdateAnimation().

int CObject::iNormalAnimSpeed

Definition at line 180 of file structs.h.

Referenced by CObject(), InitGame(), and UpdateAnimation().

int CObject::iRemovalAnim

Definition at line 181 of file structs.h.

Referenced by CObject(), InitGame(), CWorld::LoadLevel(), and RemoveDeadObjects().

int CObject::iRemovalAnimSpeed

Definition at line 182 of file structs.h.

Referenced by CObject(), and InitGame().

Uint32 CObject::iAnimSpeed[3]

Definition at line 183 of file structs.h.

bool CObject::bAnimCycle

Definition at line 184 of file structs.h.

Referenced by CObject(), and UpdateAnimation().

bool CObject::bAnimating

Definition at line 185 of file structs.h.

Referenced by CObject(), Draw(), StartAnimating(), StopAnimating(), and UpdateAnimation().

int CObject::iCurrentFrame

Definition at line 186 of file structs.h.

Referenced by CObject(), Draw(), StartAnimating(), and UpdateAnimation().

Uint32 CObject::iAnimTimeStamp

Definition at line 187 of file structs.h.

Referenced by CObject(), StartAnimating(), and UpdateAnimation().

int CObject::iLingerTime

Definition at line 188 of file structs.h.

Referenced by CObject(), InitGame(), and RemoveDeadObjects().

 

Copyright Windsor Schmidt 2006 - All rights reserved.