ScummVM API documentation
grid.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 QUEEN_GRID_H
23#define QUEEN_GRID_H
24
25#include "common/util.h"
26#include "queen/structs.h"
27
28namespace Queen {
29
30enum GridScreen {
31 GS_ROOM = 0,
32 GS_PANEL = 1,
33 GS_COUNT = 2
34};
35
36class QueenEngine;
37
38class Grid {
39public:
40
41 Grid(QueenEngine *vm);
42 ~Grid();
43
45 void readDataFrom(uint16 numObjects, uint16 numRooms, byte *&ptr);
46
48 void setZone(GridScreen screen, uint16 zoneNum, uint16 x1, uint16 y1, uint16 x2, uint16 y2);
49
51 void setZone(GridScreen screen, uint16 zoneNum, const Box &box);
52
54 uint16 findZoneForPos(GridScreen screen, uint16 x, uint16 y) const;
55
57 uint16 findAreaForPos(GridScreen screen, uint16 x, uint16 y) const;
58
60 void clear(GridScreen screen);
61
63 void setupNewRoom(uint16 room, uint16 firstRoomObjNum);
64
66 void setupPanel();
67
69 void drawZones();
70
72 const Box *zone(GridScreen screen, uint16 index) const;
73
75 Verb findVerbUnderCursor(int16 cursorx, int16 cursory) const;
76
78 uint16 findObjectUnderCursor(int16 cursorx, int16 cursory) const;
79
81 uint16 findObjectNumber(uint16 zoneNum) const;
82
84 uint16 findScale(uint16 x, uint16 y) const;
85
87 Area *area(int room, int num) const { return &_area[room][num]; }
88
90 uint16 areaMax(int room) const { return _areaMax[room]; }
91
93 uint16 objMax(int room) const { return _objMax[room]; }
94
95 void saveState(byte *&ptr);
96 void loadState(uint32 ver, byte *&ptr);
97
98 enum {
99 MAX_ZONES_NUMBER = 32,
100 MAX_AREAS_NUMBER = 11
101 };
102
103
104private:
105
106 struct ZoneSlot {
107 bool valid;
108 Box box;
109 };
110
112 ZoneSlot _zones[GS_COUNT][MAX_ZONES_NUMBER];
113
115 int16 *_objMax;
116
118 int16 *_areaMax;
119
121 Area (*_area)[MAX_AREAS_NUMBER];
122
124 uint16 _numRoomAreas;
125
127 Box *_objectBox;
128
129 QueenEngine *_vm;
130};
131
132
133} // End of namespace Queen
134
135#endif
Definition: grid.h:38
void clear(GridScreen screen)
clear the zones for current room
uint16 findAreaForPos(GridScreen screen, uint16 x, uint16 y) const
find the area number containing the specified point
uint16 findObjectNumber(uint16 zoneNum) const
get the object for the specified zone number
void setupNewRoom(uint16 room, uint16 firstRoomObjNum)
setup objects zones for the specified room
uint16 areaMax(int room) const
returns the number of areas in this room
Definition: grid.h:90
void setupPanel()
setup panel zones
const Box * zone(GridScreen screen, uint16 index) const
retuns a reference to the specified zone
uint16 findZoneForPos(GridScreen screen, uint16 x, uint16 y) const
find the zone number containing the specified point
void drawZones()
draw the zones for current room (debug only)
Verb findVerbUnderCursor(int16 cursorx, int16 cursory) const
get the verb for the specified cursor position
Area * area(int room, int num) const
returns a reference to the specfied room area
Definition: grid.h:87
uint16 findObjectUnderCursor(int16 cursorx, int16 cursory) const
get the object for the specified cursor position
uint16 findScale(uint16 x, uint16 y) const
get scale for the specified position
void setZone(GridScreen screen, uint16 zoneNum, uint16 x1, uint16 y1, uint16 x2, uint16 y2)
defines a new zone
void setZone(GridScreen screen, uint16 zoneNum, const Box &box)
defines a new zone
uint16 objMax(int room) const
returns the number of objects in this room
Definition: grid.h:93
void readDataFrom(uint16 numObjects, uint16 numRooms, byte *&ptr)
read areas data from specified stream
Definition: queen.h:87
Definition: bankman.h:28
Definition: structs.h:77
Definition: structs.h:30