ScummVM API documentation
qd_coords_animation_point.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_COORDS_ANIMATION_POINT_H
23 #define QDENGINE_QDCORE_QD_COORDS_ANIMATION_POINT_H
24 
25 #include "qdengine/parser/xml_fwd.h"
26 
27 
28 namespace QDEngine {
29 
31 public:
34 
35  static const float NO_DIRECTION;
36 
37  const Vect3f &dest_pos() const {
38  return _pos;
39  }
40  void set_dest_pos(const Vect3f &r) {
41  _pos = r;
42  }
43 
44  float direction_angle() const {
45  return _direction_angle;
46  }
47  void set_direction_angle(float ang) {
48  _direction_angle = ang;
49  }
50 
51  void start() const {
52  _passed_path_length = 0.0f;
53  }
54 
55  bool move(float &path) const {
56  _passed_path_length += path;
57  if (_passed_path_length >= _path_length) {
58  path = _passed_path_length - _path_length;
59  return true;
60  }
61  return false;
62  }
63 
64  void calc_path(const qdCoordsAnimationPoint &p, const Vect3f &shift = Vect3f(0, 0, 0)) const;
65  float passed_path() const;
66  float path_length() const {
67  return _path_length;
68  }
69 
70  void load_script(const xml::tag *p);
71  bool save_script(Common::WriteStream &fh, int indent = 0) const;
72 
74  bool load_data(Common::SeekableReadStream &fh, int save_version);
76  bool save_data(Common::WriteStream &fh) const;
77 
78 private:
79 
80  Vect3f _pos;
81  float _direction_angle;
82 
83  mutable float _path_length;
84  mutable float _passed_path_length;
85 };
86 
88 
89 } // namespace QDEngine
90 
91 #endif // QDENGINE_QDCORE_QD_COORDS_ANIMATION_POINT_H
Definition: stream.h:77
bool save_data(Common::WriteStream &fh) const
Запись данных в сэйв.
Definition: stream.h:745
bool load_data(Common::SeekableReadStream &fh, int save_version)
Загрузка данных из сэйва.
XML тег.
Definition: xml_tag.h:33
Базовый класс для игровых ресурсов.
Definition: console.h:28
Definition: qd_coords_animation_point.h:30
Definition: xmath.h:533