1 /* GemRB - Infinity Engine Emulator
2 * Copyright (C) 2003 The GemRB Project
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 #include "TileOverlay.h"
27 #include "GameScript.h"
29 //special container types
30 #define IE_CONTAINER_PILE 4
32 class GEM_EXPORT TileMap
{
34 std::vector
< TileOverlay
*> overlays
;
35 std::vector
< TileOverlay
*> rain_overlays
;
36 std::vector
< Door
*> doors
;
37 std::vector
< Container
*> containers
;
38 std::vector
< InfoPoint
*> infoPoints
;
39 std::vector
< TileObject
*> tiles
;
45 Door
* AddDoor(const char* ID
, const char* Name
, unsigned int Flags
,
46 int ClosedIndex
, unsigned short* indices
, int count
,
47 Gem_Polygon
* open
, Gem_Polygon
* closed
);
48 //gets door by active region (click target)
49 Door
* GetDoor(Point
&position
);
50 //gets door by activation position (spell target)
51 Door
* GetDoorByPosition(Point
&position
);
52 Door
* GetDoor(unsigned int idx
);
53 Door
* GetDoor(const char* Name
);
54 size_t GetDoorCount() { return doors
.size(); }
55 //update doors for a new overlay
58 /* type is an optional filter for container type*/
59 void AddContainer(Container
*c
);
60 //gets container by active region (click target)
61 Container
* GetContainer(Point
&position
, int type
=-1);
62 //gets container by activation position (spell target)
63 Container
* GetContainerByPosition(Point
&position
, int type
=-1);
64 Container
* GetContainer(const char* Name
);
65 Container
* GetContainer(unsigned int idx
);
66 /* cleans up empty heaps, returns 1 if container removed*/
67 int CleanupContainer(Container
*container
);
68 size_t GetContainerCount() { return containers
.size(); }
70 InfoPoint
* AddInfoPoint(const char* Name
, unsigned short Type
,
71 Gem_Polygon
* outline
);
72 InfoPoint
* GetInfoPoint(Point
&position
, bool detectable
);
73 InfoPoint
* GetInfoPoint(const char* Name
);
74 InfoPoint
* GetInfoPoint(unsigned int idx
);
75 InfoPoint
* GetTravelTo(const char* Destination
);
76 InfoPoint
* AdjustNearestTravel(Point
&p
);
77 size_t GetInfoPointCount() { return infoPoints
.size(); }
79 TileObject
* AddTile(const char* ID
, const char* Name
, unsigned int Flags
,
80 unsigned short* openindices
, int opencount
,unsigned short* closeindices
, int closecount
);
81 TileObject
* GetTile(unsigned int idx
);
82 TileObject
* GetTile(const char* Name
);
83 size_t GetTileCount() { return tiles
.size(); }
86 void AddOverlay(TileOverlay
* overlay
);
87 void AddRainOverlay(TileOverlay
* overlay
);
88 void DrawOverlays(Region screen
, int rain
);
89 void DrawFogOfWar(ieByte
* explored_mask
, ieByte
* visible_mask
, Region viewport
);
92 int XCellCount
, YCellCount
;