ScummVM API documentation
qd_grid_zone.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 QDENGINE_QDCORE_QD_GRID_ZONE_H
23 #define QDENGINE_QDCORE_QD_GRID_ZONE_H
24 
25 #include "qdengine/parser/xml_fwd.h"
26 #include "qdengine/qdcore/qd_contour.h"
27 #include "qdengine/qdcore/qd_grid_zone_state.h"
28 
29 namespace Common {
30 class WriteStream;
31 }
32 
33 namespace QDEngine {
34 
35 class qdCamera;
36 
37 const int QD_NO_SHADOW_ALPHA = -1;
38 const int QD_SHADOW_ALPHA_MIN = 0;
39 const int QD_SHADOW_ALPHA_MAX = 255;
40 
42 class qdGridZone : public qdNamedObject, public qdContour {
43 public:
44  qdGridZone();
45  qdGridZone(const qdGridZone &gz);
46 
47  qdGridZone &operator = (const qdGridZone &gz);
48 
49  ~qdGridZone();
50 
54  ZONE_OFF = 0,
58  ZONE_TOGGLE
59  };
60 
62  enum {
64  ZONE_EXIT_FLAG = 0x01
65  };
66 
67  int named_object_type() const {
68  return QD_NAMED_OBJECT_GRID_ZONE;
69  }
70 
72  bool load_script(const xml::tag *p);
74  bool save_script(Common::WriteStream &fh, int indent = 0) const;
75 
77  bool load_data(Common::SeekableReadStream &fh, int saveVersion);
79  bool save_data(Common::WriteStream &fh) const;
80 
81  bool state() const {
82  return _state;
83  }
84  bool set_state(bool st);
85  bool toggle_state() {
86  return set_state(!_state);
87  }
88 
89  uint32 height() const {
90  return _height;
91  }
92  bool set_height(int _h);
93 
94  bool select(qdCamera *camera, bool bSelect) const;
95  bool select(bool bSelect) const;
96 
97  bool is_object_in_zone(const qdGameObject *obj) const;
98  bool is_point_in_zone(const Vect2f &vPoint) const;
99 
100  uint32 update_timer() const {
101  return _update_timer;
102  }
103 
104  qdGridZoneState *get_state(const char *state_name);
105 
107  bool init();
108 
109  bool is_any_personage_in_zone() const;
110 
111  int shadow_alpha() const {
112  return _shadow_alpha;
113  }
114  void set_shadow_alpha(int alpha) {
115  _shadow_alpha = alpha;
116  }
117 
118  uint32 shadow_color() const {
119  return _shadow_color;
120  }
121  void set_shadow_color(uint32 color) {
122  _shadow_color = color;
123  }
124  bool has_shadow() const {
125  return (_shadow_alpha != QD_NO_SHADOW_ALPHA);
126  }
127 
128 private:
129 
131  bool _state;
133  bool _initial_state;
134 
136  uint32 _shadow_color;
138 
142  int _shadow_alpha;
143 
145  uint32 _height;
146 
148  uint32 _update_timer;
149 
151  qdGridZoneState _state_on;
153  qdGridZoneState _state_off;
154 
155  bool apply_zone() const;
156 };
157 
158 } // namespace QDEngine
159 
160 #endif // QDENGINE_QDCORE_QD_GRID_ZONE_H
Базовый класс для игровых объектов.
Definition: qd_game_object.h:53
Definition: stream.h:77
Поименованный объект.
Definition: qd_named_object.h:70
Definition: xmath.h:117
включить зону
Definition: qd_grid_zone.h:56
Зона на сетке сцены.
Definition: qd_grid_zone.h:42
Definition: stream.h:745
Контур.
Definition: qd_contour.h:39
XML тег.
Definition: xml_tag.h:33
Базовый класс для игровых ресурсов.
Definition: console.h:28
int named_object_type() const
Возвращает тип объекта.
Definition: qd_grid_zone.h:67
Definition: algorithm.h:29
Definition: qd_camera.h:122
Состояние зоны на сетке сцены.
Definition: qd_grid_zone_state.h:31
status_change
Команды для изменения состояния зоны в триггерах.
Definition: qd_grid_zone.h:52