ScummVM API documentation
objectmap.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 // Object map / Object click-area module header file
23 
24 #ifndef SAGA_OBJECTMAP_H
25 #define SAGA_OBJECTMAP_H
26 
27 namespace Saga {
28 
29 
30 class HitZone {
31 private:
34 public:
35  void load(SagaEngine *vm, Common::MemoryReadStreamEndian *readStream, int index, int sceneNumber);
36 
37  int getIndex() const {
38  return _index;
39  }
40  int getNameIndex() const {
41  return _nameIndex;
42  }
43  int getSceneNumber() const {
44  return _nameIndex;
45  }
46  int getActorsEntrance() const {
47  return _scriptNumber;
48  }
49  int getScriptNumber() const {
50  return _scriptNumber;
51  }
52  int getRightButtonVerb() const {
53  return _rightButtonVerb;
54  }
55  int getFlags() const {
56  return _flags;
57  }
58  void setFlag(HitZoneFlags flag) {
59  _flags |= flag;
60  }
61  void clearFlag(HitZoneFlags flag) {
62  _flags &= ~flag;
63  }
64  int getDirection() const {
65  return ((_flags >> 4) & 0xF);
66  }
67  uint16 getHitZoneId() const {
68  return objectIndexToId(kGameObjectHitZone, _index);
69  }
70  uint16 getStepZoneId() const {
71  return objectIndexToId(kGameObjectStepZone, _index);
72  }
73  bool getSpecialPoint(Point &specialPoint) const;
74 #ifdef SAGA_DEBUG
75  void draw(SagaEngine *vm, int color); // for debugging
76 #endif
77  bool hitTest(const Point &testPoint);
78 
79 private:
80  int _flags; // Saga::HitZoneFlags
81  int _rightButtonVerb;
82  int _nameIndex;
83  int _scriptNumber;
84  int _index;
85 
86  ClickAreas _clickAreas;
87 };
88 
90 
91 class ObjectMap {
92 public:
93  ObjectMap(SagaEngine *vm) : _vm(vm) {
94  }
95  void load(const ByteArray &resourceData);
96  void clear();
97 #ifdef SAGA_DEBUG
98  void draw(const Point& testPoint, int color, int color2); // for debugging
99 #endif
100  int hitTest(const Point& testPoint);
101  HitZone *getHitZone(int16 index) {
102  if (uint(index) >= _hitZoneList.size()) {
103  return NULL;
104  }
105  return &_hitZoneList[index];
106  }
107 
108  void cmdInfo();
109 
110 private:
111  SagaEngine *_vm;
112 
113  HitZoneArray _hitZoneList;
114 };
115 
116 } // End of namespace Saga
117 
118 #endif
Definition: saga.h:497
Definition: saga.h:464
Definition: objectmap.h:30
Definition: memstream.h:103
Definition: actor.h:34
Definition: rect.h:45
Definition: objectmap.h:91