hoa_map::MapMode Class Reference

Handles the game execution while the player is exploring maps. More...

#include <map.h>

Inheritance diagram for hoa_map::MapMode:

Inheritance graph
[legend]
Collaboration diagram for hoa_map::MapMode:

Collaboration graph
[legend]
List of all members.

Lua Access Functions

These methods exist not to allow outside C++ classes to access map data, but instead to allow Lua to make function calls to examine and modify the map's state. All of these methods are bound in the implementation of the MapMode::BindToLua() function.

void _AddGroundObject (private_map::MapObject *obj)
void _AddPassObject (private_map::MapObject *obj)
void _AddSkyObject (private_map::MapObject *obj)
void _AddZone (private_map::MapZone *zone)
private_map::VirtualSprite_GetCameraFocus () const
uint16 _GetGeneratedObjectID ()
uint8 _GetMapState () const
uint32 _GetTimeElapsed () const
void _SetCameraFocus (private_map::VirtualSprite *sprite)
void _SetMapState (uint8 state)
static bool _IsShowingDialogueIcons ()
static void _ShowDialogueIcons (bool state)

Public Member Functions

void Draw ()
 Handles the drawing of everything on the map and makes sub-draw function calls as appropriate.
 MapMode (std::string filename)
void Reset ()
 Resets appropriate class members. Called whenever the MapMode object is made the active game mode.
void Update ()
 Updates the game and calls various sub-update functions depending on the state of map mode.
 ~MapMode ()

Private Member Functions

void _CalculateDrawInfo ()
 Calculates information about how to draw the next map frame.
bool _DetectCollision (private_map::VirtualSprite *sprite)
 Determines if a map sprite's position is invalid because of a collision.
private_map::MapObject_FindNearestObject (const private_map::VirtualSprite *sprite)
 Finds the nearest interactable object within a certain distance.
void _FindPath (const private_map::VirtualSprite *sprite, std::vector< private_map::PathNode > &path, const private_map::PathNode &dest)
 Finds a path from a sprite's current position to a destination.
void _HandleInputDialogue ()
 Handles user input when the map is in the dialogue state.
void _HandleInputExplore ()
 Handles user input when the map is in the explore state.
void _Load ()
 Loads all map data as specified in the Lua file that defines the map.
void _LoadTiles ()
 A helper function to MapMode::_Load, handles all operations on loading tilesets and tile images.

Private Attributes

std::map< uint16, private_map::MapObject * > _all_objects
 A map containing pointers to all of the sprites on a map. This map does not include a pointer to the MapMode::_camera nor MapMode::_virtual_focus sprites. The map key is used as the sprite's unique identifier for the map. Keys 1000 and above are reserved for map sprites that correspond to the character's party.
std::vector< hoa_video::AnimatedImage * > _animated_tile_images
 Contains all of the animated tile images used on the map. The purpose of this vector is to easily update all tile animations without stepping through the _tile_images vector, which contains both still and animated images.
private_map::VirtualSprite_camera
 A pointer to the map sprite that the map camera will focus on.
private_map::DialogueManager_dialogue_manager
 This keeps a pointer to the active dialogue.
private_map::MapFrame _draw_info
 Retains information needed to correctly draw the next map frame.
std::vector< hoa_global::GlobalEnemy_enemies
 A container for the various foes which may appear on this map. These enemies do not have their stats set, but rather are kept at their base level stats. The stats are initialized just before a battle begins, and then passed to battle mode to use.
std::vector< private_map::MapObject * > _ground_objects
 A container for all of the map objects located on the ground layer. The ground object layer is where most objects and sprites exist in Allacrost.
hoa_system::SystemTimer _intro_timer
 A timer used for when the player first enters the map This timer is set to 7000 ms (7 seconds) and is used to display the map's location graphic and name at the top center of the screen. The graphic and text are faded in for the first two seconds, drawn opaquely for the next three seconds, and faded out in the final two seconds.
uint16 _lastID
 Keeps the last generated objectID.
hoa_video::StillImage _location_graphic
 Holds an image that represents an outline of the location, used primarily in MenuMode.
std::string _map_filename
 The name of the script file that contains the map.
std::vector< std::vector<
uint32 > > 
_map_grid
 A 2D vector indicating which spots on the map sprites may walk on. This vector is kept seperate from the vector of tiles because each tile has 4 walkable uint32 bitflags associated with it. Note that sprite objects may come in various sizes, so not all sprites may fit through a narrow passage way.
hoa_utils::ustring _map_name
 The name of the map, as it will be read by the player in the game.
hoa_script::ReadScriptDescriptor _map_script
 The interface to the file which contains all the map's stored data and subroutines. This class generally performs a large amount of communication with this script continuously. The script remains open for as long as the MapMode object exists.
uint8 _map_state
 Indicates the current state that the map is in, such as when a dialogue is taking place.
std::vector< hoa_audio::MusicDescriptor_music
 The music that the map will need to make use of.
uint16 _num_grid_cols
uint16 _num_grid_rows
 The number of elements in the map grid The number of map grid rows and columns is always equal to twice that of the number of tile rows and tile columns.
uint16 _num_tile_cols
 The number of tile rows in the map. This number must be greater than or equal to 32 for the map to be valid.
uint16 _num_tile_rows
 The number of tile rows in the map. This number must be greater than or equal to 24 for the map to be valid.
std::vector< private_map::MapObject * > _pass_objects
 A container for all of the map objects located on the pass layer. The pass object layer is named so because objects on this layer can both be walked under or above by objects in the ground object layer. A good example of an object that would typically go on this layer would be a bridge. This layer usually has very few objects for the map. Also, objects on this layer are unaffected by the maps context. In other words, these objects are always drawn on the screen, regardless of the current context that the player is in.
std::vector< private_map::MapObject * > _sky_objects
 A container for all of the map objects located on the sky layer. The sky object layer contains the last series of elements that are drawn on a map. These objects exist high in the sky above all other tiles and objects. Translucent clouds can make good use of this object layer, for instance.
std::vector< hoa_audio::SoundDescriptor_sounds
 The sounds that the map needs available to it.
std::vector< std::vector<
MapTile > > 
_tile_grid
 A 2D vector that contains all of the map's tile objects.
std::vector< hoa_video::ImageDescriptor * > _tile_images
 Contains the images for all map tiles, both still and animate.
uint32 _time_elapsed
 The time elapsed since the last Update() call to MapMode.
ScriptObject _update_function
 A script function which assists with the MapMode::Update method The most common operation that this script function performs is to check trigger conditions that cause map events to occur.
private_map::VirtualSprite_virtual_focus
 A "virtual sprite" that can serve as a focus point for the camera. This sprite is not visible to the player nor does it have any collision detection properties. Usually, the camera focuses on the player's sprite rather than this object, but it is useful for scripted sequences and other things.
std::vector< private_map::MapZone * > _zones
 Container for map zones, used for various purposes such as spawning of enemies.

Static Private Attributes

static MapMode_current_map
 A reference to the current instance of MapMode This is used for callbacks from Lua, as well as for map objects to be able to refer to the map that they exist in.
static MapMode_loading_map
 A reference to the instance of MapMode which most recently had its constructor called This is not the same as _current_map, and this pointer should only be used in conjunction with loading code. The pointer is only updated when the MapMode constructor is called.
static bool _show_dialogue_icons
 Indicates if dialogue icons should be drawn or not.

Friends

void BindEngineToLua ()
 Contains the binding code which makes the C++ engine available to Lua This method should only be called once. It must be called after the ScriptEngine is initialized, otherwise the application will crash.
class private_map::ActionPathMove
class private_map::DialogueManager
class private_map::EnemySprite
class private_map::EnemyZone
class private_map::MapDialogue
class private_map::MapFrame
class private_map::MapObject
class private_map::MapSprite
class private_map::PhysicalObject
class private_map::SpriteAction
class private_map::VirtualSprite

Detailed Description

Handles the game execution while the player is exploring maps.

****************************************************************************

This class contains all of the structures that together compose each map, as well as some other information. The methods provided by this class are those methods that are either commonly used, or require high performance. Each map has a Lua script file in which the map data is permanently retained and various script subroutines exist that modify the map's behavior. Keep in mind that this class alone does not represent all of the data nor all of the code that is used in a particular map, as the map's Lua file may retain some of this information to itself.

Maps are composed by a series of tiles and objects. Tiles are 32x32 pixel squares that are adjacent to one another on a map, and together make up the map's background environment. Objects are variable sized entities that are usually living, animated creatures (sprites), but may be something static such as a large tree. Tiles and objects are drawn in multiple interwieving layers to emulate a 3D environment for the game.

Note:
Although the drawing coordinates are in terms of 32x32 tiles, the rest of the map follows a 16x16 grid for collision detection, pathfinding, etc. Because the positions of map objects are defined in terms of this 16x16 grid, that means that when drawing the images, the position must be converted to the 32x32 grid.

Definition at line 270 of file map.h.


Constructor & Destructor Documentation

hoa_map::MapMode::MapMode ( std::string  filename  ) 

hoa_map::MapMode::~MapMode (  ) 

Definition at line 100 of file map.cpp.

References _dialogue_manager, _ground_objects, _map_script, _music, _pass_objects, _sky_objects, _sounds, _tile_images, _virtual_focus, hoa_script::ReadScriptDescriptor::CloseFile(), and hoa_map::MAP_DEBUG.

Here is the call graph for this function:


Member Function Documentation

void hoa_map::MapMode::_AddGroundObject ( private_map::MapObject obj  )  [private]

Definition at line 1215 of file map.cpp.

References _all_objects, _ground_objects, and hoa_map::private_map::MapObject::object_id.

Referenced by hoa_map::private_map::EnemyZone::AddEnemy().

void hoa_map::MapMode::_AddPassObject ( private_map::MapObject obj  )  [private]

Definition at line 1222 of file map.cpp.

References _all_objects, _pass_objects, and hoa_map::private_map::MapObject::object_id.

void hoa_map::MapMode::_AddSkyObject ( private_map::MapObject obj  )  [private]

Definition at line 1229 of file map.cpp.

References _all_objects, _sky_objects, and hoa_map::private_map::MapObject::object_id.

void hoa_map::MapMode::_AddZone ( private_map::MapZone zone  )  [private]

Definition at line 1234 of file map.cpp.

References _zones.

void hoa_map::MapMode::_CalculateDrawInfo (  )  [private]

Calculates information about how to draw the next map frame.

Definition at line 956 of file map.cpp.

References _camera, _draw_info, _num_grid_cols, _num_grid_rows, _num_tile_cols, _num_tile_rows, hoa_map::private_map::MapFrame::bottom_edge, hoa_map::private_map::MapObject::ComputeXLocation(), hoa_map::private_map::MapObject::ComputeYLocation(), hoa_utils::FloorToFloatMultiple(), hoa_video::GameVideo::GetPixelSize(), hoa_map::private_map::HALF_SCREEN_COLS, hoa_map::private_map::HALF_SCREEN_ROWS, hoa_map::private_map::HALF_TILE_COLS, hoa_map::private_map::HALF_TILE_ROWS, hoa_utils::IsFloatInRange(), hoa_utils::IsOddNumber(), hoa_map::private_map::MapFrame::left_edge, hoa_map::private_map::MapFrame::num_draw_cols, hoa_map::private_map::MapFrame::num_draw_rows, hoa_map::private_map::MapFrame::right_edge, hoa_map::private_map::SCREEN_COLS, hoa_map::private_map::SCREEN_ROWS, hoa_map::private_map::MapFrame::starting_col, hoa_map::private_map::MapFrame::starting_row, hoa_map::private_map::TILE_COLS, hoa_map::private_map::TILE_ROWS, hoa_map::private_map::MapFrame::tile_x_start, hoa_map::private_map::MapFrame::tile_y_start, hoa_map::private_map::MapFrame::top_edge, hoa_video::VideoManager, hoa_map::private_map::MapObject::x_offset, hoa_map::private_map::MapObject::x_position, hoa_map::private_map::MapObject::y_offset, and hoa_map::private_map::MapObject::y_position.

Referenced by Draw().

Here is the call graph for this function:

bool hoa_map::MapMode::_DetectCollision ( private_map::VirtualSprite sprite  )  [private]

Determines if a map sprite's position is invalid because of a collision.

Parameters:
sprite A pointer to the map sprite to check
Returns:
True if a collision was detected, false if one was not
This method is invoked by the map sprite who wishes to check for its own collision. The collision detection is performed agains three types of obstacles:

  1. Boundary conditions: where the sprite has walked off the map
  2. Tile collisions: where the sprite's collision rectangle overlaps with an unwalkable map grid tile.
  3. Object collision: where the sprite's collision rectangle overlaps that of another object's, where the object is in the same draw layer and context as the original sprite.

Note:
This function does not check if the MapSprite argument has its no_collision member set to false, but it does check that of the other MapObjects.

Definition at line 674 of file map.cpp.

References _ground_objects, _map_grid, _num_grid_cols, _num_grid_rows, hoa_map::private_map::MapObject::coll_half_width, hoa_map::private_map::MapObject::coll_height, hoa_map::private_map::MapObject::ComputeXLocation(), hoa_map::private_map::MapObject::ComputeYLocation(), hoa_map::private_map::MapObject::context, hoa_map::private_map::MapObject::no_collision, and hoa_map::private_map::VirtualSprite::sky_object.

Referenced by hoa_map::private_map::EnemyZone::Update().

Here is the call graph for this function:

MapObject * hoa_map::MapMode::_FindNearestObject ( const private_map::VirtualSprite sprite  )  [private]

Finds the nearest interactable object within a certain distance.

Parameters:
*sprite The sprite who is trying to find its nearest object.
Returns:
A pointer to the nearest interactable map object, or NULL if no such object was found.
An interactable object must be in the same context as the function argument is. For an object to be valid, it's collision rectangle must be no greater than 3 grid elements from the sprite's "calling" axis, and th

Definition at line 574 of file map.cpp.

References _all_objects, hoa_map::private_map::MapObject::coll_half_width, hoa_map::private_map::MapObject::coll_height, hoa_map::private_map::MapObject::ComputeXLocation(), hoa_map::private_map::MapObject::ComputeYLocation(), hoa_map::private_map::MapObject::context, hoa_map::private_map::VirtualSprite::direction, hoa_map::private_map::FACING_EAST, hoa_map::private_map::FACING_NORTH, hoa_map::private_map::FACING_SOUTH, hoa_map::private_map::FACING_WEST, and hoa_map::MAP_DEBUG.

Referenced by _HandleInputExplore().

Here is the call graph for this function:

void hoa_map::MapMode::_FindPath ( const private_map::VirtualSprite sprite,
std::vector< private_map::PathNode > &  path,
const private_map::PathNode dest 
) [private]

Finds a path from a sprite's current position to a destination.

Parameters:
sprite A pointer of the sprite to find the path for
path A reference to a vector of PathNode objects to store the path
dest The destination coordinates
This algorithm uses the A* algorithm to find a path from a source to a destination. This function ignores the position of all other objects and only concerns itself with which map grid elements are walkable.

Note:
If an error is detected, the function will return an empty path argument.

private_map::VirtualSprite* hoa_map::MapMode::_GetCameraFocus (  )  const [inline, private]

Definition at line 558 of file map.h.

References _camera.

uint16 hoa_map::MapMode::_GetGeneratedObjectID (  )  [private]

Definition at line 1207 of file map.cpp.

References _lastID.

Referenced by hoa_map::private_map::EnemyZone::AddEnemy().

uint8 hoa_map::MapMode::_GetMapState (  )  const [inline, private]

Definition at line 552 of file map.h.

References _map_state.

uint32 hoa_map::MapMode::_GetTimeElapsed (  )  const [inline, private]

Definition at line 555 of file map.h.

References _time_elapsed.

void hoa_map::MapMode::_HandleInputDialogue (  )  [private]

Handles user input when the map is in the dialogue state.

void hoa_map::MapMode::_HandleInputExplore (  )  [private]

Handles user input when the map is in the explore state.

Definition at line 475 of file map.cpp.

References _camera, _dialogue_manager, _FindNearestObject(), _location_graphic, _map_name, _map_state, hoa_input::GameInput::ConfirmPress(), hoa_map::private_map::VirtualSprite::current_action, hoa_map::private_map::DIALOGUE, hoa_input::GameInput::DownState(), hoa_map::private_map::EAST, hoa_map::private_map::VirtualSprite::GetCurrentDialogue(), hoa_map::private_map::VirtualSprite::GetDirection(), hoa_video::StillImage::GetFilename(), hoa_map::private_map::VirtualSprite::HasDialogue(), hoa_input::InputManager, hoa_input::GameInput::LeftState(), hoa_input::GameInput::MenuPress(), hoa_mode_manager::ModeManager, hoa_map::private_map::VirtualSprite::moving, hoa_map::private_map::VirtualSprite::NextDialogue(), hoa_map::private_map::NORTH, hoa_map::private_map::NORTHEAST, hoa_map::private_map::NORTHWEST, hoa_mode_manager::GameModeManager::Push(), hoa_input::GameInput::RightState(), hoa_map::private_map::VirtualSprite::SaveState(), hoa_map::private_map::DialogueManager::SetCurrentDialogue(), hoa_map::private_map::VirtualSprite::SetDirection(), hoa_map::private_map::SOUTH, hoa_map::private_map::SOUTHEAST, hoa_map::private_map::SOUTHWEST, hoa_map::private_map::SPRITE_TYPE, hoa_input::GameInput::UpState(), hoa_map::private_map::VIRTUAL_TYPE, and hoa_map::private_map::WEST.

Referenced by Update().

Here is the call graph for this function:

static bool hoa_map::MapMode::_IsShowingDialogueIcons (  )  [inline, static, private]

Definition at line 564 of file map.h.

References _show_dialogue_icons.

Referenced by hoa_map::private_map::VirtualSprite::Draw().

void hoa_map::MapMode::_Load (  )  [private]

Loads all map data as specified in the Lua file that defines the map.

Definition at line 157 of file map.cpp.

References _enemies, _LoadTiles(), _location_graphic, _map_filename, _map_name, _map_script, _music, _num_grid_cols, _num_grid_rows, _num_tile_cols, _num_tile_rows, _sounds, _update_function, hoa_video::StillImage::GetFilename(), hoa_script::ReadScriptDescriptor::GetLuaState(), hoa_script::ReadScriptDescriptor::GetTableSize(), hoa_video::ImageDescriptor::Load(), hoa_utils::MakeUnicodeString(), hoa_script::ReadScriptDescriptor::OpenFile(), hoa_script::ReadScriptDescriptor::ReadFunctionPointer(), hoa_script::ReadScriptDescriptor::ReadInt(), hoa_script::ReadScriptDescriptor::ReadIntVector(), hoa_script::ReadScriptDescriptor::ReadString(), hoa_script::ReadScriptDescriptor::ReadStringVector(), and hoa_video::StillImage::SetFilename().

Here is the call graph for this function:

void hoa_map::MapMode::_LoadTiles (  )  [private]

A helper function to MapMode::_Load, handles all operations on loading tilesets and tile images.

Definition at line 239 of file map.cpp.

References _animated_tile_images, _map_grid, _map_script, _num_grid_rows, _num_tile_cols, _num_tile_rows, _tile_grid, _tile_images, hoa_video::AnimatedImage::AddFrame(), hoa_script::ReadScriptDescriptor::CloseFile(), hoa_script::ReadScriptDescriptor::CloseTable(), hoa_script::ScriptDescriptor::GetFilename(), hoa_script::ReadScriptDescriptor::GetTableSize(), hoa_video::GameVideo::LoadMultiImageFromNumberElements(), hoa_script::ReadScriptDescriptor::OpenFile(), hoa_script::ReadScriptDescriptor::OpenTable(), hoa_script::ReadScriptDescriptor::ReadIntVector(), hoa_script::ReadScriptDescriptor::ReadStringVector(), hoa_script::ReadScriptDescriptor::ReadUIntVector(), hoa_video::AnimatedImage::SetDimensions(), hoa_map::private_map::TILES_PER_TILESET, and hoa_video::VideoManager.

Referenced by _Load().

Here is the call graph for this function:

void hoa_map::MapMode::_SetCameraFocus ( private_map::VirtualSprite sprite  )  [inline, private]

Definition at line 549 of file map.h.

References _camera.

void hoa_map::MapMode::_SetMapState ( uint8  state  )  [inline, private]

Definition at line 546 of file map.h.

References _map_state.

static void hoa_map::MapMode::_ShowDialogueIcons ( bool  state  )  [inline, static, private]

Definition at line 561 of file map.h.

References _show_dialogue_icons.

void hoa_map::MapMode::Draw (  )  [virtual]

Handles the drawing of everything on the map and makes sub-draw function calls as appropriate.

Implements hoa_mode_manager::GameMode.

Definition at line 1100 of file map.cpp.

References _CalculateDrawInfo(), _dialogue_manager, _draw_info, _ground_objects, _intro_timer, _location_graphic, _map_name, _map_state, _pass_objects, _sky_objects, _tile_grid, _tile_images, hoa_map::private_map::DIALOGUE, hoa_map::private_map::DialogueManager::Draw(), hoa_video::GameVideo::DrawImage(), hoa_video::GameVideo::DrawText(), hoa_system::SystemTimer::GetTimeExpired(), hoa_system::SystemTimer::IsFinished(), hoa_video::GameVideo::Move(), hoa_video::GameVideo::MoveRelative(), hoa_map::private_map::MapFrame::num_draw_cols, hoa_map::private_map::MapFrame::num_draw_rows, hoa_video::GameVideo::PopState(), hoa_video::GameVideo::PushState(), hoa_video::Color::SetAlpha(), hoa_video::GameVideo::SetCoordSys(), hoa_video::GameVideo::SetDrawFlags(), hoa_video::GameVideo::SetTextColor(), hoa_map::private_map::MapFrame::starting_col, hoa_map::private_map::MapFrame::starting_row, hoa_map::private_map::MapFrame::tile_x_start, hoa_map::private_map::MapFrame::tile_y_start, hoa_video::VIDEO_BLEND, hoa_video::VIDEO_NO_BLEND, hoa_video::VIDEO_X_CENTER, hoa_video::VIDEO_Y_CENTER, and hoa_video::VideoManager.

Here is the call graph for this function:

void hoa_map::MapMode::Reset (  )  [virtual]

Resets appropriate class members. Called whenever the MapMode object is made the active game mode.

Implements hoa_mode_manager::GameMode.

Definition at line 136 of file map.cpp.

References _current_map, _intro_timer, _music, hoa_system::SystemTimer::Run(), hoa_map::private_map::SCREEN_COLS, hoa_map::private_map::SCREEN_ROWS, hoa_video::GameVideo::SetCoordSys(), hoa_video::GameVideo::SetDrawFlags(), hoa_video::GameVideo::SetFont(), hoa_video::VIDEO_X_CENTER, hoa_video::VIDEO_Y_BOTTOM, and hoa_video::VideoManager.

Here is the call graph for this function:

void hoa_map::MapMode::Update (  )  [virtual]

Updates the game and calls various sub-update functions depending on the state of map mode.

Implements hoa_mode_manager::GameMode.

Definition at line 430 of file map.cpp.

References _animated_tile_images, _dialogue_manager, _ground_objects, _HandleInputExplore(), _map_state, _pass_objects, _sky_objects, _time_elapsed, _update_function, _zones, hoa_map::private_map::DIALOGUE, hoa_map::private_map::EXPLORE, hoa_system::GameSystem::GetUpdateTime(), hoa_system::SystemManager, and hoa_map::private_map::DialogueManager::Update().

Here is the call graph for this function:


Friends And Related Function Documentation

void BindEngineToLua (  )  [friend]

Contains the binding code which makes the C++ engine available to Lua This method should only be called once. It must be called after the ScriptEngine is initialized, otherwise the application will crash.

Definition at line 55 of file defs.cpp.

friend class private_map::ActionPathMove [friend]

Definition at line 280 of file map.h.

friend class private_map::DialogueManager [friend]

Definition at line 277 of file map.h.

friend class private_map::EnemySprite [friend]

Definition at line 276 of file map.h.

friend class private_map::EnemyZone [friend]

Definition at line 281 of file map.h.

friend class private_map::MapDialogue [friend]

Definition at line 278 of file map.h.

friend class private_map::MapFrame [friend]

Definition at line 271 of file map.h.

friend class private_map::MapObject [friend]

Definition at line 272 of file map.h.

friend class private_map::MapSprite [friend]

Definition at line 275 of file map.h.

friend class private_map::PhysicalObject [friend]

Definition at line 273 of file map.h.

friend class private_map::SpriteAction [friend]

Definition at line 279 of file map.h.

friend class private_map::VirtualSprite [friend]

Definition at line 274 of file map.h.


Member Data Documentation

std::map<uint16, private_map::MapObject*> hoa_map::MapMode::_all_objects [private]

A map containing pointers to all of the sprites on a map. This map does not include a pointer to the MapMode::_camera nor MapMode::_virtual_focus sprites. The map key is used as the sprite's unique identifier for the map. Keys 1000 and above are reserved for map sprites that correspond to the character's party.

Definition at line 392 of file map.h.

Referenced by _AddGroundObject(), _AddPassObject(), _AddSkyObject(), _FindNearestObject(), and hoa_map::private_map::DialogueManager::Draw().

std::vector<hoa_video::AnimatedImage*> hoa_map::MapMode::_animated_tile_images [private]

Contains all of the animated tile images used on the map. The purpose of this vector is to easily update all tile animations without stepping through the _tile_images vector, which contains both still and animated images.

Note:
The elements in this vector point to the same AnimatedImages that are pointed to by _tile_images. Therefore, this vector should not have delete invoked on its elements, since delete is already invoked on _tile_images.

Definition at line 446 of file map.h.

Referenced by _LoadTiles(), and Update().

private_map::VirtualSprite* hoa_map::MapMode::_camera [private]

A pointer to the map sprite that the map camera will focus on.

Note:
Note that this member is a pointer to a map sprite, not a map object. However, this does not mean that the camera is not able to focus on non-sprite map objects. The MapMode::_virtual_focus member can be used to emulate that focus.

Definition at line 426 of file map.h.

Referenced by _CalculateDrawInfo(), _GetCameraFocus(), _HandleInputExplore(), _SetCameraFocus(), and hoa_map::private_map::EnemySprite::Update().

MapMode * hoa_map::MapMode::_current_map [static, private]

A reference to the current instance of MapMode This is used for callbacks from Lua, as well as for map objects to be able to refer to the map that they exist in.

Definition at line 303 of file map.h.

Referenced by hoa_map::private_map::DialogueManager::Draw(), hoa_map::private_map::MapObject::DrawHelper(), hoa_map::private_map::ActionPathMove::Execute(), Reset(), hoa_map::private_map::EnemyZone::Update(), hoa_map::private_map::EnemySprite::Update(), hoa_map::private_map::VirtualSprite::Update(), and hoa_map::private_map::DialogueManager::Update().

private_map::DialogueManager* hoa_map::MapMode::_dialogue_manager [private]

This keeps a pointer to the active dialogue.

Definition at line 455 of file map.h.

Referenced by _HandleInputExplore(), Draw(), Update(), and ~MapMode().

private_map::MapFrame hoa_map::MapMode::_draw_info [private]

Retains information needed to correctly draw the next map frame.

Definition at line 353 of file map.h.

Referenced by _CalculateDrawInfo(), Draw(), and hoa_map::private_map::MapObject::DrawHelper().

std::vector<hoa_global::GlobalEnemy> hoa_map::MapMode::_enemies [private]

A container for the various foes which may appear on this map. These enemies do not have their stats set, but rather are kept at their base level stats. The stats are initialized just before a battle begins, and then passed to battle mode to use.

Definition at line 467 of file map.h.

Referenced by _Load(), and hoa_map::private_map::EnemySprite::AddEnemy().

std::vector<private_map::MapObject*> hoa_map::MapMode::_ground_objects [private]

A container for all of the map objects located on the ground layer. The ground object layer is where most objects and sprites exist in Allacrost.

Definition at line 401 of file map.h.

Referenced by _AddGroundObject(), _DetectCollision(), Draw(), Update(), and ~MapMode().

hoa_system::SystemTimer hoa_map::MapMode::_intro_timer [private]

A timer used for when the player first enters the map This timer is set to 7000 ms (7 seconds) and is used to display the map's location graphic and name at the top center of the screen. The graphic and text are faded in for the first two seconds, drawn opaquely for the next three seconds, and faded out in the final two seconds.

Definition at line 319 of file map.h.

Referenced by Draw(), and Reset().

uint16 hoa_map::MapMode::_lastID [private]

Keeps the last generated objectID.

Definition at line 396 of file map.h.

Referenced by _GetGeneratedObjectID().

MapMode * hoa_map::MapMode::_loading_map [static, private]

A reference to the instance of MapMode which most recently had its constructor called This is not the same as _current_map, and this pointer should only be used in conjunction with loading code. The pointer is only updated when the MapMode constructor is called.

Definition at line 309 of file map.h.

Referenced by hoa_map::private_map::EnemySprite::AddEnemy(), and hoa_map::private_map::MapDialogue::AddText().

hoa_video::StillImage hoa_map::MapMode::_location_graphic [private]

Holds an image that represents an outline of the location, used primarily in MenuMode.

Definition at line 328 of file map.h.

Referenced by _HandleInputExplore(), _Load(), and Draw().

std::string hoa_map::MapMode::_map_filename [private]

The name of the script file that contains the map.

Definition at line 322 of file map.h.

Referenced by _Load().

std::vector<std::vector<uint32> > hoa_map::MapMode::_map_grid [private]

A 2D vector indicating which spots on the map sprites may walk on. This vector is kept seperate from the vector of tiles because each tile has 4 walkable uint32 bitflags associated with it. Note that sprite objects may come in various sizes, so not all sprites may fit through a narrow passage way.

Definition at line 385 of file map.h.

Referenced by _DetectCollision(), and _LoadTiles().

hoa_utils::ustring hoa_map::MapMode::_map_name [private]

The name of the map, as it will be read by the player in the game.

Definition at line 325 of file map.h.

Referenced by _HandleInputExplore(), _Load(), and Draw().

hoa_script::ReadScriptDescriptor hoa_map::MapMode::_map_script [private]

The interface to the file which contains all the map's stored data and subroutines. This class generally performs a large amount of communication with this script continuously. The script remains open for as long as the MapMode object exists.

Definition at line 359 of file map.h.

Referenced by _Load(), _LoadTiles(), hoa_map::private_map::MapDialogue::AddText(), and ~MapMode().

uint8 hoa_map::MapMode::_map_state [private]

Indicates the current state that the map is in, such as when a dialogue is taking place.

Definition at line 331 of file map.h.

Referenced by _GetMapState(), _HandleInputExplore(), _SetMapState(), Draw(), hoa_map::private_map::DialogueManager::Update(), and Update().

std::vector<hoa_audio::MusicDescriptor> hoa_map::MapMode::_music [private]

The music that the map will need to make use of.

Definition at line 449 of file map.h.

Referenced by _Load(), Reset(), and ~MapMode().

uint16 hoa_map::MapMode::_num_grid_cols [private]

Definition at line 350 of file map.h.

Referenced by _CalculateDrawInfo(), _DetectCollision(), and _Load().

uint16 hoa_map::MapMode::_num_grid_rows [private]

The number of elements in the map grid The number of map grid rows and columns is always equal to twice that of the number of tile rows and tile columns.

Definition at line 350 of file map.h.

Referenced by _CalculateDrawInfo(), _DetectCollision(), _Load(), and _LoadTiles().

uint16 hoa_map::MapMode::_num_tile_cols [private]

The number of tile rows in the map. This number must be greater than or equal to 32 for the map to be valid.

Definition at line 344 of file map.h.

Referenced by _CalculateDrawInfo(), _Load(), and _LoadTiles().

uint16 hoa_map::MapMode::_num_tile_rows [private]

The number of tile rows in the map. This number must be greater than or equal to 24 for the map to be valid.

Definition at line 339 of file map.h.

Referenced by _CalculateDrawInfo(), _Load(), and _LoadTiles().

std::vector<private_map::MapObject*> hoa_map::MapMode::_pass_objects [private]

A container for all of the map objects located on the pass layer. The pass object layer is named so because objects on this layer can both be walked under or above by objects in the ground object layer. A good example of an object that would typically go on this layer would be a bridge. This layer usually has very few objects for the map. Also, objects on this layer are unaffected by the maps context. In other words, these objects are always drawn on the screen, regardless of the current context that the player is in.

Definition at line 411 of file map.h.

Referenced by _AddPassObject(), Draw(), Update(), and ~MapMode().

bool hoa_map::MapMode::_show_dialogue_icons [static, private]

Indicates if dialogue icons should be drawn or not.

Definition at line 312 of file map.h.

Referenced by _IsShowingDialogueIcons(), and _ShowDialogueIcons().

std::vector<private_map::MapObject*> hoa_map::MapMode::_sky_objects [private]

A container for all of the map objects located on the sky layer. The sky object layer contains the last series of elements that are drawn on a map. These objects exist high in the sky above all other tiles and objects. Translucent clouds can make good use of this object layer, for instance.

Definition at line 418 of file map.h.

Referenced by _AddSkyObject(), Draw(), Update(), and ~MapMode().

std::vector<hoa_audio::SoundDescriptor> hoa_map::MapMode::_sounds [private]

The sounds that the map needs available to it.

Definition at line 452 of file map.h.

Referenced by _Load(), and ~MapMode().

std::vector<std::vector<MapTile> > hoa_map::MapMode::_tile_grid [private]

A 2D vector that contains all of the map's tile objects.

Definition at line 377 of file map.h.

Referenced by _LoadTiles(), and Draw().

std::vector<hoa_video::ImageDescriptor*> hoa_map::MapMode::_tile_images [private]

Contains the images for all map tiles, both still and animate.

Definition at line 437 of file map.h.

Referenced by _LoadTiles(), Draw(), and ~MapMode().

uint32 hoa_map::MapMode::_time_elapsed [private]

The time elapsed since the last Update() call to MapMode.

Definition at line 334 of file map.h.

Referenced by _GetTimeElapsed(), hoa_map::private_map::VirtualSprite::Update(), hoa_map::private_map::DialogueManager::Update(), and Update().

ScriptObject hoa_map::MapMode::_update_function [private]

A script function which assists with the MapMode::Update method The most common operation that this script function performs is to check trigger conditions that cause map events to occur.

Definition at line 365 of file map.h.

Referenced by _Load(), and Update().

private_map::VirtualSprite* hoa_map::MapMode::_virtual_focus [private]

A "virtual sprite" that can serve as a focus point for the camera. This sprite is not visible to the player nor does it have any collision detection properties. Usually, the camera focuses on the player's sprite rather than this object, but it is useful for scripted sequences and other things.

Definition at line 434 of file map.h.

Referenced by ~MapMode().

std::vector<private_map::MapZone*> hoa_map::MapMode::_zones [private]

Container for map zones, used for various purposes such as spawning of enemies.

Definition at line 458 of file map.h.

Referenced by _AddZone(), and Update().


The documentation for this class was generated from the following files:
Generated on Fri Jul 6 23:14:41 2007 for Hero of Allacrost by  doxygen 1.5.1