X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmap%2FMap.h;fp=src%2Fmap%2FMap.h;h=b751d5ece04f97b33a431b6f8df78e8024ba24e7;hb=fb9bd716a1740e41efbb08a3bfa42e441d64c693;hp=a985d8491f44928335ba06a618677d095da6079f;hpb=d1e76d7a2834c8441a11c70ff1dea66fee6be6c6;p=l2e.git diff --git a/src/map/Map.h b/src/map/Map.h index a985d84..b751d5e 100644 --- a/src/map/Map.h +++ b/src/map/Map.h @@ -1,5 +1,5 @@ /* - * Map.h + * Map.h * * Created on: Sep 29, 2012 * Author: holy @@ -17,6 +17,15 @@ namespace map { +/// Represents a single map in the game. +/// Maps are made up of uniform areas of tiles. +/// The looks of a tile is defined by the Tileset() sprite with Tile::Offset() +/// as the column and row in the sprite. +/// Maps can be propulated with triggers and entities. Those are or use with +/// MapState and are not handled by the map itself. +/// Positions are expressed either as pixel or tile coordinates depending on +/// function purpose with (0|0) being the top left corner and positive values +/// extending to the right and down respectively. class Map { public: @@ -24,19 +33,31 @@ public: ~Map() { } public: + /// The sprite used as the tileset. const graphics::Sprite *Tileset() const { return tileset; } + /// Returns the Area at given pixel coordinates or 0 if off the map. Area *AreaAt(const geometry::Vector &); const Area *AreaAt(const geometry::Vector &) const; + /// Returns the Tile at given pixel coordinates or 0 if off the map. Tile *TileAt(const geometry::Vector &); const Tile *TileAt(const geometry::Vector &) const; + /// Returns the Trigger at given pixel coordinates or 0 if off the map. + /// Multiple triggers are not supported. The first one found is returned. Trigger *TriggerAt(const geometry::Vector &); + /// The battle background image for this map if neither the tile nor the + /// area has one specified. SDL_Surface *BattleBackgroundAt(const geometry::Vector &); + /// Convert coordinates pixel to tile. geometry::Vector TileCoordinates(const geometry::Vector &) const; Entity *EntitiesBegin() { return entities; } Entity *EntitiesEnd() { return entities + numEntities; } + /// Render the map. + /// Entities are not rendered by this function. void Render(SDL_Surface *dest, const geometry::Vector &offset) const; + /// Render a debugging overlay that includes collision and trigger + /// information. void RenderDebug(SDL_Surface *dest, const geometry::Vector &offset) const; static void CreateTypeDescription();