ScummVM API documentation
polygons.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * Definition of POLYGON structure and functions in POLYGONS.C
21 */
22
23#ifndef TINSEL_POLYGONS_H // prevent multiple includes
24#define TINSEL_POLYGONS_H
25
26#include "tinsel/dw.h" // for SCNHANDLE
27#include "tinsel/scene.h" // for PPOLY and REEL
28
29namespace Tinsel {
30
31
32// Polygon Types
33enum PTYPE {
34 // Tinsel 2 Polygon type list
35 TEST,
36 BLOCK, EFFECT, PATH, REFER, TAG,
37 EX_BLOCK, EX_EFFECT, EX_PATH, EX_REFER, EX_TAG,
38 // Extra polygon types from Tinsel v1
39 EXIT, EX_EXIT,
40 // Extra polygon types from Tinsel v3
41 SCALE, EX_SCALE, SHAPE
42};
43
44// subtype
45enum {
46 NORMAL = 0,
47 NODE = 1 // For paths
48};
49
50// tagFlags
51enum {
52 POINTING = 0x01,
53 TAGWANTED = 0x02,
54 FOLLOWCURSOR = 0x04
55};
56
57// tagState
58enum TSTATE {
59 TAG_OFF, TAG_ON
60};
61
62// pointState
63enum PSTATE {
64 PS_NO_POINT, PS_NOT_POINTING, PS_POINTING
65};
66
67
68enum {
69 NOPOLY = -1
70};
71
73 bool bDead;
74 short xoff, yoff; // Polygon offset
75};
76
77/*-------------------------------------------------------------------------*/
78
79bool IsInPolygon(int xt, int yt, HPOLYGON p);
80HPOLYGON InPolygon(int xt, int yt, PTYPE type);
81void BlockingCorner(HPOLYGON poly, int *x, int *y, int tarx, int tary);
82void FindBestPoint(HPOLYGON path, int *x, int *y, int *line);
83bool IsAdjacentPath(HPOLYGON path1, HPOLYGON path2);
84HPOLYGON GetPathOnTheWay(HPOLYGON from, HPOLYGON to);
85int NearestEndNode(HPOLYGON path, int x, int y);
86int NearEndNode(HPOLYGON spath, HPOLYGON dpath);
87int NearestNodeWithin(HPOLYGON npath, int x, int y);
88void NearestCorner(int *x, int *y, HPOLYGON spath, HPOLYGON dpath);
89bool IsPolyCorner(HPOLYGON hPath, int x, int y);
90int GetScale(HPOLYGON path, int y);
91int GetBrightness(HPOLYGON hPath, int y);
92void getNpathNode(HPOLYGON npath, int node, int *px, int *py);
93SCNHANDLE GetPolyFilm(HPOLYGON p);
94void GetPolyNode(HPOLYGON hp, int *pNodeX, int *pNodeY);
95SCNHANDLE GetPolyScript(HPOLYGON p);
96REEL GetPolyReelType(HPOLYGON p);
97int32 GetPolyZfactor(HPOLYGON p);
98int numNodes(HPOLYGON pp);
99void RebootDeadTags();
100void DisableBlock(int block);
101void EnableBlock(int block);
102void DisableEffect(int effect);
103void EnableEffect(int effect);
104void DisablePath(int path);
105void EnablePath(int path);
106void DisableRefer(int refer);
107void EnableRefer(int refer);
108HPOLYGON GetTagHandle(int tagno);
109void DisableTag(CORO_PARAM, int tag);
110void EnableTag(CORO_PARAM, int tag);
111void DisableExit(int exitno);
112void EnableExit(int exitno);
113HPOLYGON FirstPathPoly();
114HPOLYGON GetPolyHandle(int i);
115void InitPolygons(SCNHANDLE ph, int numPoly, bool bRestart);
116void DropPolygons();
117
118
119void SaveDeadPolys(bool *sdp);
120void RestoreDeadPolys(bool *sdp);
121void SavePolygonStuff(POLY_VOLATILE *sps);
122void RestorePolygonStuff(POLY_VOLATILE *sps);
123
124/*-------------------------------------------------------------------------*/
125
126PTYPE PolyType(HPOLYGON hp); // ->type
127int PolySubtype(HPOLYGON hp); // ->subtype
128int PolyCenterX(HPOLYGON hp); // ->pcenterx
129int PolyCenterY(HPOLYGON hp); // ->pcentery
130int PolyCornerX(HPOLYGON hp, int n); // ->cx[n]
131int PolyCornerY(HPOLYGON hp, int n); // ->cy[n]
132PSTATE PolyPointState(HPOLYGON hp); // ->pointState
133TSTATE PolyTagState(HPOLYGON hp); // ->tagState
134
135void SetPolyPointState(HPOLYGON hp, PSTATE ps); // ->pointState
136void SetPolyTagState(HPOLYGON hp, TSTATE ts); // ->tagState
137void SetPolyTagHandle(HPOLYGON hp, SCNHANDLE th);// ->oTagHandle
138
139void MaxPolygons(int maxPolys);
140
141int GetTagPolyId(HPOLYGON hp);
142void GetTagTag(HPOLYGON hp, SCNHANDLE *hTagText, int *tagX, int *tagY);
143void SetPolyPointedTo(HPOLYGON hp, bool bPointedTo);
144bool PolyIsPointedTo(HPOLYGON hp);
145void SetPolyTagWanted(HPOLYGON hp, bool bTagWanted, bool bCursor, SCNHANDLE hOverrideTag);
146bool PolyTagIsWanted(HPOLYGON hp);
147bool PolyTagFollowsCursor(HPOLYGON hp);
148SCNHANDLE GetPolyTagHandle(HPOLYGON hp);
149bool IsTagPolygon(int tagno);
150void GetPolyMidBottom(HPOLYGON hp, int *pX, int *pY);
151int PathCount();
152void MovePolygon(PTYPE ptype, int id, int x, int y);
153void MovePolygonTo(PTYPE ptype, int id, int x, int y);
154
155void NotebookPolyEntry(Common::Point c0, Common::Point c1, Common::Point c2, Common::Point c3);
156void NotebookPolyNextPage(Common::Point c0, Common::Point c1, Common::Point c2, Common::Point c3);
157void NotebookPolyPrevPage(Common::Point c0, Common::Point c1, Common::Point c2, Common::Point c3);
158
159/*-------------------------------------------------------------------------*/
160
161void UpdateGroundPlane();
162
163enum class NoteBookPoly {
164 CLUE_0 = 0,
165 CLUE_1 = 1,
166 CLUE_2 = 2,
167 CLUE_3 = 3,
168 CLUE_4 = 4,
169 CLUE_5 = 5,
170 CLUE_6 = 6,
171 CLUE_7 = 7,
172 MAIN,
173 NEXT,
174 PREV,
175 NONE
176};
177
179public:
180 virtual ~NoteBookPolygons() {}
181 virtual void setPolygon(NoteBookPoly polyKind, const Common::Point &c0, const Common::Point &c1, const Common::Point &c2, const Common::Point &c3) = 0;
182 virtual void pushPolygon(const Common::Point &c0, const Common::Point &c1, const Common::Point &c2, const Common::Point &c3) = 0;
183
184 virtual NoteBookPoly mostSpecificHit(const Common::Point &point) const = 0;
185 virtual int lineHit(const Common::Point &point) const = 0;
186 virtual bool isInsideNotebook(const Common::Point &point) const = 0;
187};
188
189NoteBookPolygons *instantiateNoteBookPolygons();
190
191} // End of namespace Tinsel
192
193#endif /* TINSEL_POLYGONS_H */
Definition: polygons.h:178
#define CORO_PARAM
Definition: coroutines.h:107
Definition: actors.h:36
SCALE
Definition: scene.h:62
uint32 SCNHANDLE
Definition: dw.h:31
int HPOLYGON
Definition: dw.h:34
REEL
Definition: scene.h:70
Definition: rect.h:144
Definition: polygons.h:72