]> git.localhorst.tv Git - l2e.git/blob - src/map/Tile.h
implemented map tile anmation
[l2e.git] / src / map / Tile.h
1 #ifndef MAP_TILE_H_
2 #define MAP_TILE_H_
3
4 #include "../math/Vector.h"
5
6 #include <SDL.h>
7
8 namespace map {
9
10 class Tile {
11
12 public:
13         static const int TYPE_ID = 603;
14
15 public:
16         Tile();
17         ~Tile() { }
18
19 public:
20         enum Flag {
21                 BLOCK_NORTH = 0x01,
22                 BLOCK_EAST = 0x02,
23                 BLOCK_SOUTH = 0x04,
24                 BLOCK_WEST = 0x08,
25                 LADDER = 0x10,
26         };
27
28         SDL_Surface *BattleBackground() { return battlebg; }
29
30         const math::Vector<int> &Offset() const { return offset; }
31
32         bool BlocksNorth() const { return flags & BLOCK_NORTH; }
33         bool BlocksEast() const { return flags & BLOCK_EAST; }
34         bool BlocksSouth() const { return flags & BLOCK_SOUTH; }
35         bool BlocksWest() const { return flags & BLOCK_WEST; }
36
37         bool IsLadder() const { return flags & LADDER; }
38
39         int NumFrames() const { return frames; }
40
41         static void CreateTypeDescription();
42         static void Construct(void *);
43
44 // temporary setters
45 public:
46         Tile &SetOffset(const math::Vector<int> &o) { offset = o; return *this; }
47         Tile &SetFlags(Uint32 f) { flags = f; return *this; }
48
49 private:
50         SDL_Surface *battlebg;
51         math::Vector<int> offset;
52         int flags;
53         int frames;
54
55 };
56
57 }
58
59 #endif