CLevel Class Reference

Manages a game level. More...

#include <level.h>

List of all members.

Public Types

enum  eState { ,
  kEmpty = 0, kLoaded = 1, kStarted, kRunning,
  kStopped
}
 State enums. More...

Public Member Functions

Creation methods
 CLevel ()
 Create empty.
 CLevel (CXMLNode node)
 Parase level info from xml node.
 ~CLevel ()
 Remove everything in this level.
Manage methods
bool load (CXMLNode node)
 Load in the level description from a file.
bool start ()
 Start up this level. Load in resources (map, ents, etc.) as needed and start level.
bool stop ()
 Stop this level.
void remove ()
 Delete all data pointers controlled by this level.
eState state () const
 
Returns:
The current state of this level.

bool update ()
 Update this level for one frame.
Game Entity methods
long ge_add (CGameEntity *pGameEntity)
 Add a game entity object to this level.
void ge_remove (const long id)
 Remove the GameEntity with the same id.
void ge_remove (CGameEntity *pGameEntity)
 Remove the GameEntity from the level.
CGameEntityge_ptr (const unsigned long id)
 Get a pointer to a game entity.
CGameEntityge_ptr (ENTITY *pEnt)
 Get a pointer to a game entity.
bool ge_valid_id (const unsigned long id)
 Is the id passed a valid game entity id.
int ge_count () const
 
Returns:
The number of entities

Game Entity in Focus methods.
The focus GE is under local player's control.

void ge_focus (CGameEntity *pGE)
 
Parameters:
pGE Pointer to a Game Entity

CGameEntityge_focus ()
 
Returns:
The current game entity under the local player's control

Entity Data methods
int entityData_count ()
bool entityData_load (CXMLNode node)
bool entityData_valid (const char *str)
 
Returns:
true if the str is a a key to valid entity data entry

CGameEntityDataentityData_get (const char *str)
 
Returns:
Pointer to the CGameEntityData keyed to the str, or NULL if none


Detailed Description

Manages a game level.

A level is a collection of entities (models, maps, etc.)

(c) 2007-2008 oP group Germany GbR. All rights reserved.
This source code is provided "as is" with no warranty and must not be distributed without written permission.

Author:
Doug Poston
Version:
1.3
Date:
12/28/2007

Member Enumeration Documentation

enum CLevel::eState

State enums.

Enumerator:
kEmpty  Level has nothing in it.
kLoaded  Loaded.
kStarted  Started (may need to wait a frame before running).
kRunning  Currently running.
kStopped  Stopped (can be unloaded).


Constructor & Destructor Documentation

CLevel::CLevel ( CXMLNode  node  )  [inline]

Parase level info from xml node.

Parameters:
node XML node containing level data.


Member Function Documentation

bool CLevel::load ( CXMLNode  node  ) 

Load in the level description from a file.

Parameters:
node XML node
Returns:
true if the load succeeds

bool CLevel::start (  ) 

Start up this level. Load in resources (map, ents, etc.) as needed and start level.

Returns:
false if level can't be stated

bool CLevel::stop (  ) 

Stop this level.

Returns:
false if level can't be stopped

bool CLevel::update (  ) 

Update this level for one frame.

Returns:
false if there is nothing to update

Todo:
Find a way to check if the level is actually loaded

long CLevel::ge_add ( CGameEntity pGameEntity  ) 

Add a game entity object to this level.

Parameters:
pGameEntity pointer to a game entity
Returns:
ID number if the game entity is added, otherwise a negitive number

void CLevel::ge_remove ( const long  id  ) 

Remove the GameEntity with the same id.

Parameters:
id GameEntity id

void CLevel::ge_remove ( CGameEntity pGameEntity  ) 

Remove the GameEntity from the level.

Parameters:
pGameEntity GameEntity pointer

CGameEntity * CLevel::ge_ptr ( const unsigned long  id  ) 

Get a pointer to a game entity.

Parameters:
id of the CGameEntity we are looking for.
Returns:
pointer to the CGameEntity if found, otherwise 0

CGameEntity * CLevel::ge_ptr ( ENTITY *  pEnt  ) 

Get a pointer to a game entity.

Parameters:
pEnt Pointer to the ENTITY who's structure we are looking for
Returns:
pointer to the CGameEntity if found, otherwise 0

id is stored in skill[99]

bool CLevel::ge_valid_id ( const unsigned long  id  ) 

Is the id passed a valid game entity id.

Parameters:
id of the CGameEntity we are looking for.
Returns:
true is entity id is found to be valid

int CLevel::entityData_count (  )  [inline]

Return the number of entity data entries

Returns:
Number of entity data entries

bool CLevel::entityData_load ( CXMLNode  node  ) 

Load in the entity data description from XML node

Parameters:
node Node with the entity data
Returns:
true if the load succeeds


The documentation for this class was generated from the following files:
Generated on Fri Dec 28 12:55:07 2007 for template7 by  doxygen 1.5.4