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.
26 #include "GameScript.h"
28 #include "TileOverlay.h"
30 //special container types
31 #define IE_CONTAINER_PILE 4
33 class GEM_EXPORT TileMap
{
35 std::vector
< TileOverlay
*> overlays
;
36 std::vector
< TileOverlay
*> rain_overlays
;
37 std::vector
< Door
*> doors
;
38 std::vector
< Container
*> containers
;
39 std::vector
< InfoPoint
*> infoPoints
;
40 std::vector
< TileObject
*> tiles
;
46 Door
* AddDoor(const char* ID
, const char* Name
, unsigned int Flags
,
47 int ClosedIndex
, unsigned short* indices
, int count
,
48 Gem_Polygon
* open
, Gem_Polygon
* closed
);
49 //gets door by active region (click target)
50 Door
* GetDoor(const Point
&position
) const;
51 //gets door by activation position (spell target)
52 Door
* GetDoorByPosition(const Point
&position
) const;
53 Door
* GetDoor(unsigned int idx
) const;
54 Door
* GetDoor(const char* Name
) const;
55 size_t GetDoorCount() { return doors
.size(); }
56 //update doors for a new overlay
59 /* type is an optional filter for container type*/
60 void AddContainer(Container
*c
);
61 //gets container by active region (click target)
62 Container
* GetContainer(const Point
&position
, int type
=-1) const;
63 //gets container by activation position (spell target)
64 Container
* GetContainerByPosition(const Point
&position
, int type
=-1) const;
65 Container
* GetContainer(const char* Name
) const;
66 Container
* GetContainer(unsigned int idx
) const;
67 /* cleans up empty heaps, returns 1 if container removed*/
68 int CleanupContainer(Container
*container
);
69 size_t GetContainerCount() const { return containers
.size(); }
71 InfoPoint
* AddInfoPoint(const char* Name
, unsigned short Type
,
72 Gem_Polygon
* outline
);
73 InfoPoint
* GetInfoPoint(const Point
&position
, bool detectable
) const;
74 InfoPoint
* GetInfoPoint(const char* Name
) const;
75 InfoPoint
* GetInfoPoint(unsigned int idx
) const;
76 InfoPoint
* GetTravelTo(const char* Destination
) const;
77 InfoPoint
* AdjustNearestTravel(Point
&p
);
78 size_t GetInfoPointCount() const { return infoPoints
.size(); }
80 TileObject
* AddTile(const char* ID
, const char* Name
, unsigned int Flags
,
81 unsigned short* openindices
, int opencount
,unsigned short* closeindices
, int closecount
);
82 TileObject
* GetTile(unsigned int idx
);
83 TileObject
* GetTile(const char* Name
);
84 size_t GetTileCount() { return tiles
.size(); }
87 void AddOverlay(TileOverlay
* overlay
);
88 void AddRainOverlay(TileOverlay
* overlay
);
89 void DrawOverlays(Region screen
, int rain
);
90 void DrawFogOfWar(ieByte
* explored_mask
, ieByte
* visible_mask
, Region viewport
);
93 int XCellCount
, YCellCount
;