summaryrefslogtreecommitdiff
path: root/src/map.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-05 19:42:09 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-05 19:42:09 +0300
commit101ba08f997bd1912da32abe778cdc3305048380 (patch)
treeafa32264727644f3c42a2d77903132d39cb4a012 /src/map.h
parent8db4a7da23c36718152ca29cfb067bcfc759a92f (diff)
downloadmanaplus-101ba08f997bd1912da32abe778cdc3305048380.tar.gz
manaplus-101ba08f997bd1912da32abe778cdc3305048380.tar.bz2
manaplus-101ba08f997bd1912da32abe778cdc3305048380.tar.xz
manaplus-101ba08f997bd1912da32abe778cdc3305048380.zip
Separate map class to map and maplayer.
Diffstat (limited to 'src/map.h')
-rw-r--r--src/map.h265
1 files changed, 0 insertions, 265 deletions
diff --git a/src/map.h b/src/map.h
index e157628cc..5b79ec8f5 100644
--- a/src/map.h
+++ b/src/map.h
@@ -28,14 +28,11 @@
#include "position.h"
#include "properties.h"
-#include <list>
#include <string>
#include <vector>
class Animation;
class AmbientLayer;
-class Graphics;
-class GraphicsVertexes;
class MapLayer;
class Particle;
class SimpleAnimation;
@@ -44,24 +41,8 @@ class SpecialLayer;
class MapItem;
class ObjectsLayer;
-class ImageVertexes;
-
typedef std::vector<Tileset*> Tilesets;
typedef std::vector<MapLayer*> Layers;
-typedef std::vector<ImageVertexes*> MepRowImages;
-
-class MapRowVertexes
-{
- public:
- MapRowVertexes()
- {
- images.reserve(30);
- }
-
- ~MapRowVertexes();
-
- MepRowImages images;
-};
/**
* A meta tile stores additional information about a location on a tile map.
@@ -87,25 +68,6 @@ struct MetaTile
unsigned char blockmask; /**< Blocking properties of this tile */
};
-class MapObject
-{
- public:
- MapObject(int type0, std::string data0)
- {
- type = type0;
- data = data0;
- }
-
- int type;
- std::string data;
-};
-
-class MapObjectList
-{
- public:
- std::vector<MapObject> objects;
-};
-
/**
* Animation cycle of a tile image which changes the map accordingly.
*/
@@ -124,114 +86,6 @@ class TileAnimation
};
/**
- * A map layer. Stores a grid of tiles and their offset, and implements layer
- * rendering.
- */
-class MapLayer: public ConfigListener
-{
- public:
- friend class Map;
-
- /**
- * Constructor, taking layer origin, size and whether this layer is the
- * fringe layer. The fringe layer is the layer that draws the actors.
- * There can be only one fringe layer per map.
- */
- MapLayer(int x, int y, int width, int height, bool isFringeLayer);
-
- /**
- * Destructor.
- */
- ~MapLayer();
-
- /**
- * Set tile image, with x and y in layer coordinates.
- */
- void setTile(int x, int y, Image *img);
-
- /**
- * Set tile image with x + y * width already known.
- */
- void setTile(int index, Image *img)
- { mTiles[index] = img; }
-
- /**
- * Draws this layer to the given graphics context. The coordinates are
- * expected to be in map range and will be translated to local layer
- * coordinates and clipped to the layer's dimensions.
- *
- * The given actors are only drawn when this layer is the fringe
- * layer.
- */
- void draw(Graphics *graphics,
- int startX, int startY,
- int endX, int endY,
- int scrollX, int scrollY,
- int mDebugFlags) const;
-
- void drawOGL(Graphics *graphics);
-
- void drawSDL(Graphics *graphics);
-
- void updateOGL(Graphics *graphics,
- int startX, int startY,
- int endX, int endY,
- int scrollX, int scrollY,
- int mDebugFlags);
-
- void updateSDL(Graphics *graphics,
- int startX, int startY,
- int endX, int endY,
- int scrollX, int scrollY,
- int mDebugFlags);
-
- void drawFringe(Graphics *graphics,
- int startX, int startY,
- int endX, int endY,
- int scrollX, int scrollY,
- const Actors *actors,
- int mDebugFlags, int yFix) const;
-
- bool isFringeLayer() const
- { return mIsFringeLayer; }
-
- void setSpecialLayer(SpecialLayer *val)
- { mSpecialLayer = val; }
-
- void setTempLayer(SpecialLayer *val)
- { mTempLayer = val; }
-
- int getWidth() const
- { return mWidth; }
-
- int getHeight() const
- { return mHeight; }
-
-// void setTileInfo(int x, int y, int width, int cnt);
-
-// void getTileInfo(int x, int y, int &width, int &cnt) const;
-
- void optionChanged(const std::string &value);
-
- int getTileDrawWidth(Image *img, int endX, int &width) const;
-
-// void initTileInfo();
-
- private:
- int mX, mY;
- int mWidth, mHeight;
- bool mIsFringeLayer; /**< Whether the actors are drawn. */
- bool mHighlightAttackRange;
- Image **mTiles;
-// int *mTilesWidth;
-// int *mTilesCount;
- SpecialLayer *mSpecialLayer;
- SpecialLayer *mTempLayer;
- typedef std::vector<MapRowVertexes*> MapRows;
- MapRows mTempRows;
-};
-
-/**
* A tile map.
*/
class Map : public Properties, public ConfigListener
@@ -614,123 +468,4 @@ class Map : public Properties, public ConfigListener
bool mBeingOpacity;
};
-
-class SpecialLayer
-{
- public:
- friend class Map;
- friend class MapLayer;
-
- SpecialLayer(int width, int height, bool drawSprites = false);
-
- ~SpecialLayer();
-
- void draw(Graphics *graphics, int startX, int startY,
- int endX, int endY, int scrollX, int scrollY);
-
- MapItem* getTile(int x, int y) const;
-
- void setTile(int x, int y, MapItem* item);
-
- void setTile(int x, int y, int type);
-
- void addRoad(Path road);
-
- void clean();
-
- void itemDraw(Graphics *graphics, int x, int y,
- int scrollX, int scrollY);
-
- private:
- int mWidth, mHeight;
- bool mDrawSprites;
- MapItem **mTiles;
-};
-
-class MapItem
-{
- public:
- friend class Map;
- friend class MapLayer;
-
- enum ItemType
- {
- EMPTY = 0,
- HOME = 1,
- ROAD = 2,
- CROSS = 3,
- ARROW_UP = 4,
- ARROW_DOWN = 5,
- ARROW_LEFT = 6,
- ARROW_RIGHT = 7,
- PORTAL = 8,
- MUSIC = 9,
- ATTACK = 10,
- PRIORITY = 11,
- IGNORE_ = 12,
- SEPARATOR = 13
- };
-
- MapItem();
-
- MapItem(int type);
-
- MapItem(int type, std::string comment);
-
- MapItem(int type, std::string comment, int x, int y);
-
- ~MapItem();
-
- int getType() const
- { return mType; }
-
- void setType(int type);
-
- void setPos(int x, int y);
-
- int getX() const
- { return mX; }
-
- int getY() const
- { return mY; }
-
- std::string &getComment()
- { return mComment; }
-
- void setComment(std::string comment)
- { mComment = comment; }
-
- std::string &getName()
- { return mName; }
-
- void setName(std::string name)
- { mName = name; }
-
- void draw(Graphics *graphics, int x, int y, int dx, int dy);
-
- private:
- int mType;
- Image *mImage;
- std::string mComment;
- std::string mName;
- int mX;
- int mY;
-};
-
-class ObjectsLayer
-{
- public:
- ObjectsLayer(unsigned width, unsigned height);
- ~ObjectsLayer();
-
- void addObject(std::string name, int type, unsigned x, unsigned y,
- unsigned dx, unsigned dy);
-
- MapObjectList *getAt(unsigned x, unsigned y);
- private:
- MapObjectList **mTiles;
- unsigned mWidth;
- unsigned mHeight;
-};
-
#endif