]> git.localhorst.tv Git - l2e.git/blobdiff - src/map/Map.cpp
implemented map tile anmation
[l2e.git] / src / map / Map.cpp
index aeec93cae8b1354a43ad61cda7144a1a13940b2e..60c319d4a8d8c8fc6a4c0a974c3129ac3a4d176f 100644 (file)
@@ -6,11 +6,12 @@
 #include "../graphics/Sprite.h"
 #include "../loader/Interpreter.h"
 #include "../loader/TypeDescription.h"
+#include "../math/Vector.h"
 #include "../sdl/utility.h"
 
 #include <stdexcept>
 
-using geometry::Vector;
+using math::Vector;
 using graphics::Sprite;
 using loader::FieldDescription;
 using loader::Interpreter;
@@ -76,7 +77,7 @@ const Tile *Map::TileAt(const Vector<int> &offset) const {
        }
 }
 
-Trigger *Map::TriggerAt(const geometry::Vector<int> &offset) {
+Trigger *Map::TriggerAt(const math::Vector<int> &offset) {
        // TODO: add support for multiple triggers on a tile?
        Vector<int> coords(TileCoordinates(offset));
        for (Trigger *i(triggers); i != triggers + numTriggers; ++i) {
@@ -87,7 +88,7 @@ Trigger *Map::TriggerAt(const geometry::Vector<int> &offset) {
        return 0;
 }
 
-SDL_Surface *Map::BattleBackgroundAt(const geometry::Vector<int> &position) {
+SDL_Surface *Map::BattleBackgroundAt(const math::Vector<int> &position) {
        Tile *tile(TileAt(position));
        if (tile && tile->BattleBackground()) {
                return tile->BattleBackground();
@@ -104,12 +105,15 @@ Vector<int> Map::TileCoordinates(const Vector<int> &position) const {
 }
 
 
-void Map::Render(SDL_Surface *dest, const Vector<int> &inOffset) const {
+void Map::Render(
+               SDL_Surface *dest,
+               const Vector<int> &inOffset,
+               unsigned int frame) const {
        // TODO: skip invisible areas
        for (int i(0); i < numAreas; ++i) {
                const Area &area(areas[i]);
                Vector<int> offset(inOffset + Vector<int>::FromIndex(i, width) * area.Size() * tileset->Size());
-               area.Render(dest, tileset, offset);
+               area.Render(dest, tileset, offset, frame);
        }
 }