ScummVM API documentation
qd_animation_set.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_ANIMATION_SET_H
23#define QDENGINE_QDCORE_QD_ANIMATION_SET_H
24
25#include "qdengine/parser/xml_fwd.h"
26#include "qdengine/qdcore/qd_named_object.h"
27#include "qdengine/qdcore/qd_animation.h"
28#include "qdengine/qdcore/qd_animation_info.h"
29
30
31namespace QDEngine {
32
33
35public:
39
40 qdAnimationSet &operator = (const qdAnimationSet &set);
41
42 int named_object_type() const {
43 return QD_NAMED_OBJECT_ANIMATION_SET;
44 }
45
46 int size() const {
47 return _animations.size();
48 }
49 void resize(int sz);
50
52 int get_angle_index(float direction_angle) const;
53
55 float get_index_angle(int direction_index) const;
56
58 float adjust_angle(float angle) const;
59
60 qdAnimationInfo *get_animation_info(int index = 0);
61 qdAnimationInfo *get_animation_info(float direction_angle);
62
63 qdAnimationInfo *get_static_animation_info(int index = 0);
64 qdAnimationInfo *get_static_animation_info(float direction_angle);
65
66 qdAnimationInfo *get_start_animation_info(int index = 0);
67 qdAnimationInfo *get_start_animation_info(float direction_angle);
68
69 qdAnimationInfo *get_stop_animation_info(int index = 0);
70 qdAnimationInfo *get_stop_animation_info(float direction_angle);
71
72 qdAnimation *get_turn_animation() const;
73 qdAnimationInfo *get_turn_animation_info() {
74 return &_turn_animation;
75 }
76 void set_turn_animation(const char *animation_name) {
77 _turn_animation.set_animation_name(animation_name);
78 }
79
80 float walk_sound_frequency(int direction_index) const;
81 float walk_sound_frequency(float direction_angle) const;
82 void set_walk_sound_frequency(int direction_index, float freq);
83
84 bool load_animations(const qdNamedObject *res_owner);
85 bool free_animations(const qdNamedObject *res_owner);
87 bool register_resources(const qdNamedObject *res_owner);
89 bool unregister_resources(const qdNamedObject *res_owner);
90
91 bool scale_animations(float coeff_x, float coeff_y);
92
93 void load_script(const xml::tag *p);
94 bool save_script(Common::WriteStream &fh, int indent = 0) const;
95
96 float start_angle() const {
97 return _start_angle;
98 }
99 void set_start_angle(float v) {
100 _start_angle = v;
101 }
102
103private:
104
106
109 float _start_angle;
110
111 qdAnimationInfoVector _animations;
112 qdAnimationInfoVector _static_animations;
113 qdAnimationInfoVector _start_animations;
114 qdAnimationInfoVector _stop_animations;
115
117 qdAnimationInfo _turn_animation;
118
120 Std::vector<float> _walk_sound_frequency;
121
122 static int get_angle_index(float direction_angle, int dir_count);
123 static float get_index_angle(int index, int dir_count);
124};
125
126} // namespace QDEngine
127
128#endif // QDENGINE_QDCORE_QD_ANIMATION_SET_H
size_type size() const
Definition: array.h:316
Definition: stream.h:77
Анимация.
Definition: qd_animation.h:57
Информация об анимации.
Definition: qd_animation_info.h:34
Definition: qd_animation_set.h:34
int named_object_type() const
Возвращает тип объекта.
Definition: qd_animation_set.h:42
float get_index_angle(int direction_index) const
выдает угол походки и остановки, соответствующих индексу
int get_angle_index(float direction_angle) const
выдает индекс походки и остановки, соответствующих углу
bool register_resources(const qdNamedObject *res_owner)
Регистрация ресурсов набора в диспетчере ресурсов.
bool unregister_resources(const qdNamedObject *res_owner)
Отмена регистрации ресурсов набора в диспетчере ресурсов.
float adjust_angle(float angle) const
Возвращает ближайшее к angle направление, для которого есть анимация.
Поименованный объект.
Definition: qd_named_object.h:70
XML тег.
Definition: xml_tag.h:33
Базовый класс для игровых ресурсов.
Definition: console.h:28