Level Class Reference

#include <Level.h>

List of all members.

Public Member Functions

 Level ()
 ~Level ()
void reset ()
bool update ()
void draw ()
void levelLoad (std::string filenamebase)
void registerObject (Object *o)
void registerTile (Tile *t, int h, int w)
std::vector< Object * > & getObjects ()
TilegetTile (int w, int h)
void deleteObject (Object *o)
void scheduleDelete (Object *o)
int getHeight ()
int getWidth ()
ObjectgetObject (std::string id)
Mix_Music * getMusic ()
void setMusic (Mix_Music *music)
Mix_Chunk * getSound (std::string filename)
void loadSound (std::string filename)
PlayergetPlayer ()
void setCutScene (bool cutScene)
void setCutSceneText (std::string text)
void addScore (int score)
void drawHUD ()

Static Public Member Functions

static Levelinstance ()

Static Public Attributes

static const int tileHeight = 32
static const int tileWidth = 32

Private Member Functions

void loadObjects ()
void readTextures (std::string extension)
void readObjects (std::string dir)
void levelTextureLoad (std::string filenamebase)
void levelObjectLoad (std::string filenamebase)
void levelSpecsLoad (std::string filenamebase)
void addObject (Object *o, std::vector< Object * > &vec)
Uint32 loadPixelFile (std::string filename)

Private Attributes

int _height
int _width
std::string _filenamebase
bool _cutScene
std::string _cutSceneText
int _score
Player_player
std::vector< Object * > _objects
std::vector< Tile * > _tiles
std::vector< Object * > _drawnObjects
std::vector< Object * > _deleteQueue
std::queue< Object * > _addQueue
std::map< std::string, Object * > _ids
Mix_Music * _music
std::map< std::string, Mix_Chunk * > _sounds
Background_background

Static Private Attributes

static Level_instance = NULL
static Uint32 WALKBEHIND = 0
static Uint32 WALKINTO = 0
static Uint32 WALKINFRONT = 0
static std::map< Uint32, Sprite * > TEXTURES
static std::map< Uint32, std::string > OBJECTS
static bool _objectsLoaded = false


Detailed Description

Definition at line 22 of file Level.h.


Constructor & Destructor Documentation

Level::Level  ) 
 

Definition at line 25 of file Level.cpp.

References _instance, and loadObjects().

Referenced by instance().

Level::~Level  ) 
 

Definition at line 35 of file Level.cpp.

References _objects, and _tiles.


Member Function Documentation

void Level::addObject Object o,
std::vector< Object * > &  vec
[private]
 

Definition at line 431 of file Level.cpp.

References _drawnObjects, _ids, Object::getDepth(), and Object::id().

Referenced by levelObjectLoad().

void Level::addScore int  score  )  [inline]
 

Definition at line 58 of file Level.h.

References _score.

Referenced by Enemy::die(), and AddScoreCommand::execute().

void Level::deleteObject Object o  ) 
 

Definition at line 471 of file Level.cpp.

References _drawnObjects, and _objects.

Referenced by update().

void Level::draw  ) 
 

Definition at line 359 of file Level.cpp.

References _background, _drawnObjects, and Background::draw().

Referenced by main().

void Level::drawHUD  ) 
 

Definition at line 377 of file Level.cpp.

References _player, Sprite::draw(), Person::getHealth(), Sprite::loadSprite(), Sprite::SCREEN, and Sprite::width().

int Level::getHeight  )  [inline]
 

Definition at line 39 of file Level.h.

References _height.

Referenced by Background::draw().

Mix_Music* Level::getMusic  )  [inline]
 

Definition at line 48 of file Level.h.

References _music.

Object * Level::getObject std::string  id  ) 
 

Definition at line 453 of file Level.cpp.

References _ids.

Referenced by AddHealthCommand::AddHealthCommand(), AimCommand::AimCommand(), CrouchCommand::CrouchCommand(), FollowPlayerCommand::FollowPlayerCommand(), FollowPlayerInRangeCommand::FollowPlayerInRangeCommand(), JumpCommand::JumpCommand(), JumpResetCommand::JumpResetCommand(), levelSpecsLoad(), MoveCommand::MoveCommand(), SetCameraCommand::SetCameraCommand(), SetControlCommand::SetControlCommand(), SetDoorLockCommand::SetDoorLockCommand(), ShootCommand::ShootCommand(), ShootInRangeCommand::ShootInRangeCommand(), StopPersonCommand::StopPersonCommand(), and TurnCommand::TurnCommand().

std::vector< Object* >& Level::getObjects  )  [inline]
 

Definition at line 35 of file Level.h.

References _objects.

Referenced by CollisionHandler::ObjsColliding().

Player* Level::getPlayer  )  [inline]
 

Definition at line 52 of file Level.h.

References _player.

Referenced by AimCommand::AimCommand(), ShootInRangeCommand::execute(), FollowPlayerInRangeCommand::execute(), and FollowPlayerCommand::execute().

Mix_Chunk * Level::getSound std::string  filename  ) 
 

Definition at line 484 of file Level.cpp.

References _sounds.

Tile* Level::getTile int  w,
int  h
[inline]
 

Definition at line 36 of file Level.h.

References _tiles, and _width.

Referenced by CollisionHandler::ObjsColliding().

int Level::getWidth  )  [inline]
 

Definition at line 40 of file Level.h.

References _width.

Referenced by Background::draw().

Level * Level::instance  )  [static]
 

Definition at line 458 of file Level.cpp.

References _instance, and Level().

Referenced by AddHealthCommand::AddHealthCommand(), AimCommand::AimCommand(), Bullet::collide(), CrouchCommand::CrouchCommand(), Person::die(), Enemy::die(), Background::draw(), ShootInRangeCommand::execute(), SetCutSceneCommand::execute(), PlaySoundCommand::execute(), PlayMusicCommand::execute(), FollowPlayerInRangeCommand::execute(), FollowPlayerCommand::execute(), CutSceneTextCommand::execute(), AddScoreCommand::execute(), FollowPlayerCommand::FollowPlayerCommand(), FollowPlayerInRangeCommand::FollowPlayerInRangeCommand(), JumpCommand::JumpCommand(), JumpResetCommand::JumpResetCommand(), MoveCommand::MoveCommand(), CollisionHandler::ObjsColliding(), PlayMusicCommand::PlayMusicCommand(), PlaySoundCommand::PlaySoundCommand(), SetCameraCommand::SetCameraCommand(), SetControlCommand::SetControlCommand(), SetDoorLockCommand::SetDoorLockCommand(), Person::shoot(), ShootCommand::ShootCommand(), ShootInRangeCommand::ShootInRangeCommand(), StopPersonCommand::StopPersonCommand(), TurnCommand::TurnCommand(), and Bullet::update().

void Level::levelLoad std::string  filenamebase  ) 
 

Definition at line 177 of file Level.cpp.

References _filenamebase, _ids, _player, Screen::instance(), levelObjectLoad(), levelSpecsLoad(), levelTextureLoad(), Control::registerController(), and Screen::registerFollowObj().

Referenced by main().

void Level::levelObjectLoad std::string  filenamebase  )  [private]
 

Definition at line 217 of file Level.cpp.

References _height, _ids, _objects, _width, addObject(), Object::id(), glfuncs::load_image(), Object::loadObject(), OBJECTS, tileHeight, and tileWidth.

Referenced by levelLoad().

void Level::levelSpecsLoad std::string  filenamebase  )  [private]
 

Definition at line 198 of file Level.cpp.

References List::empty(), List::firstList(), getObject(), Object::load(), Parser::parse(), and List::rest().

Referenced by levelLoad().

void Level::levelTextureLoad std::string  filenamebase  )  [private]
 

Definition at line 262 of file Level.cpp.

References _background, _height, _tiles, _width, glfuncs::load_image(), registerTile(), Object::setCollidable(), Object::setDepth(), TEXTURES, tileHeight, tileWidth, WALKBEHIND, WALKINFRONT, and WALKINTO.

Referenced by levelLoad().

void Level::loadObjects  )  [private]
 

Definition at line 67 of file Level.cpp.

References _objectsLoaded, loadPixelFile(), readObjects(), readTextures(), WALKBEHIND, WALKINFRONT, and WALKINTO.

Referenced by Level().

Uint32 Level::loadPixelFile std::string  filename  )  [private]
 

Definition at line 86 of file Level.cpp.

References glfuncs::instance(), and glfuncs::load_image().

Referenced by loadObjects().

void Level::loadSound std::string  filename  ) 
 

Definition at line 490 of file Level.cpp.

References _sounds.

Referenced by PlaySoundCommand::PlaySoundCommand().

void Level::readObjects std::string  dir  )  [private]
 

Definition at line 96 of file Level.cpp.

References glfuncs::instance(), glfuncs::load_image(), and OBJECTS.

Referenced by loadObjects().

void Level::readTextures std::string  extension  )  [private]
 

Definition at line 137 of file Level.cpp.

References glfuncs::instance(), glfuncs::load_image(), Sprite::loadSprite(), and TEXTURES.

Referenced by loadObjects().

void Level::registerObject Object o  ) 
 

Definition at line 410 of file Level.cpp.

References _addQueue.

Referenced by Person::shoot().

void Level::registerTile Tile t,
int  h,
int  w
 

Definition at line 415 of file Level.cpp.

References _drawnObjects, _tiles, _width, Object::collidable(), and Object::getDepth().

Referenced by levelTextureLoad().

void Level::reset  ) 
 

Definition at line 43 of file Level.cpp.

References _addQueue, _deleteQueue, _drawnObjects, _ids, _objects, and _tiles.

Referenced by main().

void Level::scheduleDelete Object o  ) 
 

Definition at line 466 of file Level.cpp.

References _deleteQueue.

Referenced by Bullet::collide(), Person::die(), and Bullet::update().

void Level::setCutScene bool  cutScene  ) 
 

Definition at line 479 of file Level.cpp.

References _cutScene.

Referenced by SetCutSceneCommand::execute().

void Level::setCutSceneText std::string  text  )  [inline]
 

Definition at line 56 of file Level.h.

References _cutSceneText.

Referenced by CutSceneTextCommand::execute().

void Level::setMusic Mix_Music *  music  )  [inline]
 

Definition at line 49 of file Level.h.

References _music.

Referenced by PlayMusicCommand::PlayMusicCommand().

bool Level::update  ) 
 

Definition at line 321 of file Level.cpp.

References _deleteQueue, _player, and deleteObject().

Referenced by main().


Member Data Documentation

std::queue< Object* > Level::_addQueue [private]
 

Definition at line 103 of file Level.h.

Referenced by registerObject(), and reset().

Background* Level::_background [private]
 

Definition at line 107 of file Level.h.

Referenced by draw(), and levelTextureLoad().

bool Level::_cutScene [private]
 

Definition at line 84 of file Level.h.

Referenced by setCutScene().

std::string Level::_cutSceneText [private]
 

Definition at line 85 of file Level.h.

Referenced by setCutSceneText().

std::vector< Object* > Level::_deleteQueue [private]
 

Definition at line 102 of file Level.h.

Referenced by reset(), scheduleDelete(), and update().

std::vector< Object* > Level::_drawnObjects [private]
 

Definition at line 101 of file Level.h.

Referenced by addObject(), deleteObject(), draw(), registerTile(), and reset().

std::string Level::_filenamebase [private]
 

Definition at line 81 of file Level.h.

Referenced by levelLoad().

int Level::_height [private]
 

Definition at line 78 of file Level.h.

Referenced by getHeight(), levelObjectLoad(), and levelTextureLoad().

std::map<std::string,Object*> Level::_ids [private]
 

Definition at line 104 of file Level.h.

Referenced by addObject(), getObject(), levelLoad(), levelObjectLoad(), and reset().

Level * Level::_instance = NULL [static, private]
 

Definition at line 87 of file Level.h.

Referenced by instance(), and Level().

Mix_Music* Level::_music [private]
 

Definition at line 105 of file Level.h.

Referenced by getMusic(), and setMusic().

std::vector< Object* > Level::_objects [private]
 

Definition at line 99 of file Level.h.

Referenced by deleteObject(), getObjects(), levelObjectLoad(), reset(), and ~Level().

bool Level::_objectsLoaded = false [static, private]
 

Definition at line 109 of file Level.h.

Referenced by loadObjects().

Player* Level::_player [private]
 

Definition at line 97 of file Level.h.

Referenced by drawHUD(), getPlayer(), levelLoad(), and update().

int Level::_score [private]
 

Definition at line 95 of file Level.h.

Referenced by addScore().

std::map< std::string, Mix_Chunk* > Level::_sounds [private]
 

Definition at line 106 of file Level.h.

Referenced by getSound(), and loadSound().

std::vector< Tile* > Level::_tiles [private]
 

Definition at line 100 of file Level.h.

Referenced by getTile(), levelTextureLoad(), registerTile(), reset(), and ~Level().

int Level::_width [private]
 

Definition at line 79 of file Level.h.

Referenced by getTile(), getWidth(), levelObjectLoad(), levelTextureLoad(), and registerTile().

map< Uint32, string > Level::OBJECTS [static, private]
 

Definition at line 93 of file Level.h.

Referenced by levelObjectLoad(), and readObjects().

map< Uint32, Sprite * > Level::TEXTURES [static, private]
 

Definition at line 92 of file Level.h.

Referenced by levelTextureLoad(), and readTextures().

const int Level::tileHeight = 32 [static]
 

Definition at line 42 of file Level.h.

Referenced by levelObjectLoad(), levelTextureLoad(), and CollisionHandler::ObjsColliding().

const int Level::tileWidth = 32 [static]
 

Definition at line 43 of file Level.h.

Referenced by levelObjectLoad(), levelTextureLoad(), and CollisionHandler::ObjsColliding().

Uint32 Level::WALKBEHIND = 0 [static, private]
 

Definition at line 89 of file Level.h.

Referenced by levelTextureLoad(), and loadObjects().

Uint32 Level::WALKINFRONT = 0 [static, private]
 

Definition at line 91 of file Level.h.

Referenced by levelTextureLoad(), and loadObjects().

Uint32 Level::WALKINTO = 0 [static, private]
 

Definition at line 90 of file Level.h.

Referenced by levelTextureLoad(), and loadObjects().


The documentation for this class was generated from the following files:
Generated on Sat Apr 22 15:05:21 2006 for ProjectX by  doxygen 1.4.6-NO