ScummVM API documentation
region.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 #ifndef SLUDGE_REGION_H
22 #define SLUDGE_REGION_H
23 
24 namespace Sludge {
25 
26 struct ObjectType;
27 
28 struct ScreenRegion {
29  int x1, y1, x2, y2, sX, sY, di;
30  ObjectType *thisType;
31 };
33 
35 public:
37  ~RegionManager();
38 
39  // Kill
40  void kill();
41 
42  // Add & remove region
43  bool addScreenRegion(int x1, int y1, int x2, int y2, int, int, int, int objectNum);
44  void removeScreenRegion(int objectNum);
45 
46  // Save & load
47  void loadRegions(Common::SeekableReadStream *stream);
48  void saveRegions(Common::WriteStream *stream);
49 
50  // Draw
51  void showBoxes();
52 
53  // Setter & getter
54  ScreenRegion *getRegionForObject(int obj);
55  ScreenRegion *getOverRegion() const { return _overRegion; }
56  void setOverRegion(ScreenRegion *newRegion) { _overRegion = newRegion; }
57  void updateOverRegion();
58  bool isRegionChanged() const { return _lastRegion != _overRegion; }
59  void updateLastRegion() { _lastRegion = _overRegion; }
60  void resetOverRegion() { _overRegion = nullptr; }
61  void resetLastRegion() { _lastRegion = nullptr; }
62 
63  // Freeze
64  void freeze(FrozenStuffStruct *frozenStuff);
65  void resotre(FrozenStuffStruct *frozenStuff);
66 
67 private:
68  SludgeEngine *_vm;
69 
70  ScreenRegionList *_allScreenRegions;
71  ScreenRegion *_overRegion;
72  ScreenRegion *_lastRegion;
73 };
74 
75 } // End of namespace Sludge
76 
77 #endif
Definition: objtypes.h:32
Definition: stream.h:77
Definition: region.h:28
Definition: region.h:34
Definition: list.h:44
Definition: stream.h:745
Definition: sludge.h:68
Definition: builtin.h:27
Definition: freeze.h:41