A tile map.
|
Public Types |
enum | BlockType {
BLOCKTYPE_NONE = -1,
BLOCKTYPE_WALL,
BLOCKTYPE_CHARACTER,
BLOCKTYPE_MONSTER,
NB_BLOCKTYPES
} |
Public Member Functions |
| Map (int width, int height, int tileWidth, int tileHeight) |
| Constructor, taking map and tile size as parameters.
|
| ~Map () |
| Destructor.
|
void | initializeOverlays () |
| Initialize map overlays.
|
void | update (int ticks=1) |
| Updates animations.
|
void | draw (Graphics *graphics, int scrollX, int scrollY) |
| Draws the map to the given graphics output.
|
void | drawCollision (Graphics *graphics, int scrollX, int scrollY) |
| Visualizes collision layer for debugging.
|
void | addLayer (MapLayer *layer) |
| Adds a layer to this map.
|
void | addTileset (Tileset *tileset) |
| Adds a tileset to this map.
|
Tileset * | getTilesetWithGid (int gid) const |
| Finds the tile set that a tile with the given global id is part of.
|
MetaTile * | getMetaTile (int x, int y) const |
| Get tile reference.
|
void | blockTile (int x, int y, BlockType type) |
| Marks a tile as occupied.
|
bool | getWalk (int x, int y, char walkmask=BLOCKMASK_WALL) const |
| Gets walkability for a tile with a blocking bitmask.
|
int | getWidth () const |
| Returns the width of this map.
|
int | getHeight () const |
| Returns the height of this map.
|
int | getTileWidth () const |
| Returns the tile width of this map.
|
int | getTileHeight () const |
| Returns the tile height used by this map.
|
Path | findPath (int startX, int startY, int destX, int destY, unsigned char walkmask, int maxCost=20) |
| Find a path from one location to the next.
|
SpriteIterator | addSprite (Sprite *sprite) |
| Adds a sprite to the map.
|
void | removeSprite (SpriteIterator iterator) |
| Removes a sprite from the map.
|
void | addParticleEffect (const std::string &effectFile, int x, int y) |
| Adds a particle effect.
|
void | initializeParticleEffects (Particle *particleEngine) |
| Initializes all added particle effects.
|
void | addAnimation (int gid, TileAnimation *animation) |
| Adds a tile animation to the map.
|
TileAnimation * | getAnimationForGid (int gid) |
| Gets the tile animation for a specific gid.
|
Private Member Functions |
void | drawOverlay (Graphics *graphics, float scrollX, float scrollY, int detail) |
| Draws the overlay graphic to the given graphics output.
|
bool | contains (int x, int y) const |
| Tells whether the given coordinates fall within the map boundaries.
|
Private Attributes |
int * | mOccupation [NB_BLOCKTYPES] |
int | mWidth |
int | mHeight |
int | mTileWidth |
int | mTileHeight |
int | mMaxTileHeight |
MetaTile * | mMetaTiles |
Layers | mLayers |
Tilesets | mTilesets |
Sprites | mSprites |
int | mOnClosedList |
int | mOnOpenList |
std::list< AmbientOverlay * > | mOverlays |
float | mLastScrollX |
float | mLastScrollY |
std::list< ParticleEffectData > | particleEffects |
std::map< int, TileAnimation * > | mTileAnimations |
Static Private Attributes |
static const unsigned char | BLOCKMASK_WALL = 0x80 |
| Blockmasks for different entities.
|
static const unsigned char | BLOCKMASK_CHARACTER = 0x01 |
static const unsigned char | BLOCKMASK_MONSTER = 0x02 |
Classes |
struct | ParticleEffectData |
void Map::draw |
( |
Graphics * |
graphics, |
|
|
int |
scrollX, |
|
|
int |
scrollY | |
|
) |
| | |
Draws the map to the given graphics output.
This method draws all layers, sprites and overlay effects.
TODO: For efficiency reasons, this method could take into account the clipping rectangle set on the Graphics object. However, currently the map is always drawn full-screen.
Definition at line 262 of file map.cpp.