SetupWishCore: fixed table lookup being out of bounds for the wisest pcs
[gemrb.git] / gemrb / core / Polygon.h
blob505a91f94be179dbb0ec968f594f5598c2613535
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.
19 #ifndef POLYGON_H
20 #define POLYGON_H
22 #include "RGBAColor.h"
23 #include "exports.h"
24 #include "globals.h"
26 #include "Region.h"
28 #include <list>
30 class GEM_EXPORT Trapezoid {
31 public:
32 int y1, y2;
33 int left_edge, right_edge;
36 class GEM_EXPORT Gem_Polygon {
37 public:
38 Gem_Polygon(Point* points, unsigned int count, Region *bbox = NULL);
39 ~Gem_Polygon(void);
40 Region BBox;
41 Point* points;
42 unsigned int count;
43 std::list<Trapezoid> trapezoids;
44 bool PointIn(const Point &p) const;
45 bool PointIn(int x, int y) const;
46 void RecalcBBox();
47 void ComputeTrapezoids();
50 // wall polygons are used to render area wallgroups
51 // wall polygons never create a surface
52 //ALWAYSCOVER wallpolygon blocks everything that it covers
53 //BASELINE means there is a baseline, the loader makes the distinction
54 //between first edge is base line/separate baseline
55 //DITHER means the polygon only dithers what it covers
57 #define WF_ALWAYSCOVER 0
58 #define WF_BASELINE 1
59 #define WF_DITHER 2
60 //this is used only externally, but converted to baseline on load time
61 #define WF_HOVER 4
62 // cover animations
63 #define WF_COVERANIMS 8
64 // door polygons are not always drawn
65 #define WF_DISABLED 0x80
67 class GEM_EXPORT Wall_Polygon: public Gem_Polygon {
68 public:
69 Wall_Polygon(Point *points,int count,Region *bbox) : Gem_Polygon(points,count,bbox) {}
70 //is the point above the baseline
71 bool PointCovered(const Point &p) const;
72 bool PointCovered(int x, int y) const;
73 ieDword GetPolygonFlag() const { return wall_flag; }
74 void SetPolygonFlag(ieDword flg) { wall_flag=flg; }
75 void SetBaseline(const Point &a, const Point &b);
76 public:
77 ieDword wall_flag;
78 Point base0, base1;
81 #endif