ScummVM API documentation
segmap.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 */
21
22#ifndef TOLTECS_SEGMAP_H
23#define TOLTECS_SEGMAP_H
24
25#include "common/array.h"
26
27#include "toltecs/screen.h"
28
29namespace Toltecs {
30
31struct ScriptWalk {
32 int16 y, x;
33 int16 y1, x1, y2, x2;
34 int16 yerror, xerror;
35 int16 mulValue;
36 int16 scaling;
37};
38
40 int16 x, y;
41 int16 width, height;
42 int16 priority;
43 Graphics::Surface *surface;
44};
45
47public:
50
51 void load(byte *source);
52
53 int16 findPathRectAtPoint(int16 x, int16 y);
54 void adjustPathPoint(int16 &x, int16 &y);
55
56 void findPath(int16 *pointsArray, int16 destX, int16 destY, int16 sourceX, int16 sourceY);
57
58 int8 getScalingAtPoint(int16 x, int16 y);
59 void getRgbModifiertAtPoint(int16 x, int16 y, int16 id, byte &r, byte &g, byte &b);
60
61 void addMasksToRenderQueue();
62
63//protected:
64public: // for debugging purposes
65
67 int16 x1, y1, x2, y2;
68 };
69
71 int16 y, x;
72 int16 height, width;
73 byte id;
74 byte a, b, c;
75 inline bool isPointInside(int16 px, int16 py) {
76 return py >= y && py <= y + height && px >= x && px <= x + width;
77 }
78 };
79
80 struct PathPoint {
81 int16 y, x;
82
83 PathPoint() : x(0), y(0) {}
84 };
85
89
90 ToltecsEngine *_vm;
91
92 SegmapMaskRectArray _maskRects;
93 byte *_maskRectData;
94
95 SegmapPathRectArray _pathRects;
96 SegmapInfoRectArray _infoRects;
97
98 int16 _deadEndPathRects[1000];
99 uint _deadEndPathRectsCount;
100
101 int16 _closedPathRects[1000];
102 uint _closedPathRectsCount;
103
104 PathPoint _pathNodes[1000];
105 int16 _pathNodesCount;
106
107 int16 findNextPathRect(int16 srcRectIndex, int16 destX, int16 destY);
108
109 void loadSegmapMaskRectSurface(byte *maskData, SegmapMaskRect &maskRect);
110 void freeSegmapMaskRectSurfaces();
111
112};
113
114} // End of namespace Toltecs
115
116#endif /* TOLTECS_SEGMAP_H */
Definition: segmap.h:46
Definition: toltecs.h:104
Definition: surface.h:67
Definition: segmap.h:31
Definition: segmap.h:39
Definition: segmap.h:80