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
29namespace Common {
30class WriteStream;
31}
32
33namespace QDEngine {
34
35class qdCamera;
36
37const int QD_NO_SHADOW_ALPHA = -1;
38const int QD_SHADOW_ALPHA_MIN = 0;
39const int QD_SHADOW_ALPHA_MAX = 255;
40
42class qdGridZone : public qdNamedObject, public qdContour {
43public:
44 qdGridZone();
45 qdGridZone(const qdGridZone &gz);
46
47 qdGridZone &operator = (const qdGridZone &gz);
48
50
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);
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
128private:
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: stream.h:745
Definition: stream.h:77
Контур.
Definition: qd_contour.h:39
Зона на сетке сцены.
Definition: qd_grid_zone.h:42
bool save_script(Common::WriteStream &fh, int indent=0) const
Запись данных в скрипт.
bool load_script(const xml::tag *p)
Загрузка данных из скрипта.
bool init()
Инициализация данных, вызывается при старте и перезапуске игры.
@ ZONE_EXIT_FLAG
т.н. "зона выхода" - при наведении на нее мышью курсор меняется
Definition: qd_grid_zone.h:64
bool load_data(Common::SeekableReadStream &fh, int saveVersion)
Загрузка данных из сэйва.
status_change
Команды для изменения состояния зоны в триггерах.
Definition: qd_grid_zone.h:52
@ ZONE_ON
включить зону
Definition: qd_grid_zone.h:56
@ ZONE_TOGGLE
переключить зону
Definition: qd_grid_zone.h:58
@ ZONE_OFF
выключить зону
Definition: qd_grid_zone.h:54
bool save_data(Common::WriteStream &fh) const
Запись данных в сэйв.
int named_object_type() const
Возвращает тип объекта.
Definition: qd_grid_zone.h:67
Поименованный объект.
Definition: qd_named_object.h:70
XML тег.
Definition: xml_tag.h:33
Definition: algorithm.h:29
Базовый класс для игровых ресурсов.
Definition: console.h:28