X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmap%2FArea.h;h=d839e96c0688b3fbf91657bb152ef5e52a03db0d;hb=1907ca03c5e865c4d398170042aa384c67ffff29;hp=e2b6a1ede7a0a0dcbde2c8502bfd8df3b4180a41;hpb=be3b4e75c82b6e9d2b5c4300138d490ec1a4932a;p=l2e.git diff --git a/src/map/Area.h b/src/map/Area.h index e2b6a1e..d839e96 100644 --- a/src/map/Area.h +++ b/src/map/Area.h @@ -16,27 +16,46 @@ namespace map { +/// Defines a rectangular section of a map. +/// Tiles are rendered ltr with a row break each width tiles. +/// Missing tiles in the last row are possible but don't fool yourself. class Area { +public: + static const int TYPE_ID = 601; + public: Area(); ~Area() { } public: + /// Get the width in tiles. int Width() const { return width; } + /// Get the height in tiles. int Height() const { return numTiles / width + (numTiles % width ? 1 : 0); } + /// Get the size in tiles. geometry::Vector Size() const { return geometry::Vector(Width(), Height()); } - const Tile &TileAt(const geometry::Vector &) const; + /// Get a tile by tile coordinates (not pixel coordinates!). + Tile *TileAt(const geometry::Vector &); + const Tile *TileAt(const geometry::Vector &) const; + + /// Get the default battle background for this area. + SDL_Surface *BattleBackground() { return battlebg; } void Render(SDL_Surface *dest, const graphics::Sprite *tileset, const geometry::Vector &offset) const; + void RenderDebug(SDL_Surface *dest, const graphics::Sprite *tileset, const geometry::Vector &offset) const; + + static void CreateTypeDescription(); + static void Construct(void *); // temporary setters public: - void SetTiles(const Tile *t, int num) { tiles = t; numTiles = num; } + void SetTiles(Tile *t, int num) { tiles = t; numTiles = num; } void SetWidth(int w) { width = w; } private: - const Tile *tiles; + SDL_Surface *battlebg; + Tile *tiles; int numTiles; int width;