CWorld Class Reference

#include <structs.h>

Collaboration diagram for CWorld:

Collaboration graph
[legend]
List of all members.

Detailed Description

This class represents the world that a player is playing in. This may be better described as a 'game state' class. This class holds various state attributes such as whether or not a game is currently in progress, the current level, etc. This class also contains the master game-object list, and functions to add and remove game objects from the 'world'.

Definition at line 209 of file structs.h.

Public Member Functions

 CWorld (void)
 default constructor
int AddObject (CObject *Obj)
 add this object to the world
int RemoveObject (CObject *Obj)
 Remove this object from the world.
int LoadLevel (const char *filename)
 load a level file from disk
int AddEffect (CEffect *Effect)
 add this effect to the world
int RemoveEffect (CEffect *Effect)
 Remove this effect from the world.
void UpdateEffects (float timeDelta)
 update all the effects in the world
void DrawEffects (void)
 draw all the effects in the world

Public Attributes

gcn::Gui * GUI
 back reference to the GUI active while in game
bool bGameOver
 flag indicating whether or not the game has ended
bool bTakeInput
 flag indicating whether or not to take input from players
int iStartingState
 breaks down game sequence in to staged states
int iRenderStyle
 top-down 2D drawing, or perspective '3D' mode
float fZoomBias
 how to bias the view centering (which player)
float fFinalZoom
 the zoom amount at the point when a player dies
int iObjectCount
 the number of CObject objects in the world
int iEffectCount
 the number of PSystem objects in the world
int iNumCollisions
 the total number of collisions that have taken place
Uint32 iCurrentTime
 milliseconds since SDL was initialized
Uint32 iOldTime
 time stamp used to calculate frames-per-second figures
char * musicFile
 name of the music file to be loaded for this level
CTile tiles [MAP_SIZE *MAP_SIZE]
 tile map used to draw the background graphics
CObjectPlayer [4]
 array holding pointers to the current player-objects
CObjectObjects
 pointer to a list of CObject objects in this world
PSystemPSystems
 pointer to a list of PSystem (particle system) objects in this world
CEffectEffects
 pointer to a list of effect objects in this world (particle systems, etc.)


Constructor & Destructor Documentation

CWorld::CWorld ( void   ) 

Create a CWorld object with default parameters.

Definition at line 180 of file structs.cpp.

References bGameOver, bTakeInput, DEFAULT_RENDERSTYLE, Effects, fZoomBias, iCurrentTime, iEffectCount, iNumCollisions, iObjectCount, iOldTime, iRenderStyle, iStartingState, musicFile, NUM_PLAYERS, Objects, Player, PSystems, and STARTINGSTATE_IDLE.


Member Function Documentation

int CWorld::AddObject ( CObject Obj  ) 

Inserts this CWorld object at the beginning of the object list.

Definition at line 210 of file structs.cpp.

References iObjectCount, CObject::Next, Objects, and CObject::Previous.

Referenced by GameLogicFire(), InitGame(), and LoadLevel().

Here is the caller graph for this function:

int CWorld::RemoveObject ( CObject Obj  ) 

Definition at line 236 of file structs.cpp.

References DAS_ERROR, iObjectCount, CObject::iOwnCount, CObject::Next, Objects, CObject::Owner, and CObject::Previous.

Referenced by RemoveDeadObjects().

Here is the caller graph for this function:

int CWorld::LoadLevel ( const char *  filename  ) 

Loads a level file from disk, populating the calling CWorld object with data.

Definition at line 404 of file structs.cpp.

References AddObject(), ANIMID_CRATECRUSH, CELL_SIZE, DAS_ERROR, EFFECTID_PSYSTEM, EFFECTID_SHOCKWAVE, EFFECTID_TILEANIM, CObject::iDamageSound, CObject::iRemovalAnim, CObject::iRemovalEffect, CObject::iRemovalEffects, CObject::iRemovalSound, MAP_SIZE, musicFile, CObject::Position, SOUNDID_EXPLOSION, SOUNDID_HIT, TEXID_DIRT, TEXID_GRASS, TEXID_GRID, TEXID_ICE, TEXID_LAVA, TEXID_MUD, TEXID_NULL, TEXID_SAND, TEXID_TARMAC, TEXID_WATER, TILE_DAMAGE_LAVA, TILE_EFFECT_DAMAGE, TILEID_BLANK, TILEID_DIRT, TILEID_GRASS, TILEID_ICE, TILEID_LAVA, TILEID_MUD, TILEID_NULL, TILEID_SAND, TILEID_TARMAC, TILEID_WATER, tiles, TYPEID_POWERUP_BS, TYPEID_POWERUP_HEALTH, TYPEID_POWERUP_HS, TYPEID_POWERUP_LM, TYPEID_POWERUP_PS, TYPEID_POWERUP_SB, TYPEID_TNT_BLOCK, TYPEID_WALL_BLOCK, TYPEID_WOOD_BLOCK, Vector::x, and Vector::y.

Referenced by InitGame().

Here is the call graph for this function:

Here is the caller graph for this function:

int CWorld::AddEffect ( CEffect Effect  ) 

Inserts this CEffect object at the beginning of the effect list.

Definition at line 285 of file structs.cpp.

References Effects, iEffectCount, CEffect::Next, and CEffect::Previous.

Referenced by GameLogicFire(), PhysicsReflect(), PlayGame(), ProcessTileCollisions(), and RemoveDeadObjects().

Here is the caller graph for this function:

int CWorld::RemoveEffect ( CEffect Effect  ) 

Definition at line 312 of file structs.cpp.

References DAS_ERROR, Effects, iEffectCount, CEffect::Next, and CEffect::Previous.

Referenced by UpdateEffects().

Here is the caller graph for this function:

void CWorld::UpdateEffects ( float  timeDelta  ) 

Definition at line 357 of file structs.cpp.

References CEffect::bExpired, Effects, CEffect::Next, RemoveEffect(), and CEffect::Step().

Referenced by PlayGame().

Here is the call graph for this function:

Here is the caller graph for this function:

void CWorld::DrawEffects ( void   ) 

Definition at line 382 of file structs.cpp.

References CEffect::bExpired, CEffect::Draw(), Effects, and CEffect::Next.

Referenced by DrawGLScene().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

gcn::Gui* CWorld::GUI

Definition at line 212 of file structs.h.

bool CWorld::bGameOver

Definition at line 213 of file structs.h.

Referenced by CWorld(), and PlayGame().

bool CWorld::bTakeInput

Definition at line 214 of file structs.h.

Referenced by CWorld(), InitGame(), PlayGame(), and RemoveDeadObjects().

int CWorld::iStartingState

Definition at line 215 of file structs.h.

Referenced by CWorld(), DrawGLScene(), InitGame(), PlayGame(), and RemoveDeadObjects().

int CWorld::iRenderStyle

Definition at line 216 of file structs.h.

Referenced by CWorld(), and PlayGame().

float CWorld::fZoomBias

Definition at line 217 of file structs.h.

Referenced by CWorld(), DrawGLScene(), and InitGame().

float CWorld::fFinalZoom

Definition at line 218 of file structs.h.

Referenced by DrawGLScene().

int CWorld::iObjectCount

Definition at line 219 of file structs.h.

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

int CWorld::iEffectCount

Definition at line 220 of file structs.h.

Referenced by AddEffect(), CWorld(), and RemoveEffect().

int CWorld::iNumCollisions

Definition at line 221 of file structs.h.

Referenced by CWorld(), and DoCollisions().

Uint32 CWorld::iCurrentTime

Definition at line 222 of file structs.h.

Referenced by CWorld(), PlayGame(), CObject::StartAnimating(), and UpdateAnimation().

Uint32 CWorld::iOldTime

Definition at line 223 of file structs.h.

Referenced by CWorld().

char* CWorld::musicFile

Definition at line 224 of file structs.h.

Referenced by CWorld(), LoadLevel(), and PlayGame().

CTile CWorld::tiles[MAP_SIZE *MAP_SIZE]

Definition at line 225 of file structs.h.

Referenced by DrawTiles(), LoadLevel(), and ProcessTileCollisions().

CObject* CWorld::Player[4]

Definition at line 226 of file structs.h.

Referenced by CWorld(), DrawGLScene(), DrawHUD(), InitGame(), PhysicsUpdate(), PlayGame(), ProcessTileCollisions(), and RemoveDeadObjects().

CObject* CWorld::Objects

Definition at line 227 of file structs.h.

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

PSystem* CWorld::PSystems

Definition at line 228 of file structs.h.

Referenced by CWorld().

CEffect* CWorld::Effects

Definition at line 229 of file structs.h.

Referenced by AddEffect(), CWorld(), DrawEffects(), RemoveEffect(), and UpdateEffects().

 

Copyright Windsor Schmidt 2006 - All rights reserved.