ScummVM API documentation
movement.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 STARK_MOVEMENT_MOVEMENT_H
23 #define STARK_MOVEMENT_MOVEMENT_H
24 
25 #include "math/vector3d.h"
26 
27 namespace Stark {
28 
29 namespace Resources {
30 class ItemVisual;
31 }
32 
33 class ResourceSerializer;
34 
38 class Movement {
39 public:
41  virtual ~Movement();
42 
43  enum MovementType {
44  kTypeWalk = 1,
45  kTypeFollowPath = 2,
46  kTypeFollowPathLight = 3,
47  kTypeTurn = 4
48  };
49 
51  static Movement *construct(uint32 type, Resources::ItemVisual *item);
52 
54  virtual uint32 getType() const = 0;
55 
59  virtual void start();
60 
64  virtual void stop(bool force = false);
65 
69  virtual void onGameLoop() = 0;
70 
74  bool hasEnded() const;
75 
79  virtual bool hasReachedDestination() const;
80 
84  virtual void saveLoad(ResourceSerializer *serializer) = 0;
85 
86 protected:
87  enum TurnDirection {
88  kTurnNone,
89  kTurnLeft,
90  kTurnRight
91  };
92 
93  const float _defaultTurnAngleSpeed; // Degrees per ms
94 
95  float computeAngleBetweenVectorsXYPlane(const Math::Vector3d &v1, const Math::Vector3d &v2) const;
96 
97  bool _ended;
98  Resources::ItemVisual *_item;
99 };
100 
101 } // End of namespace Stark
102 
103 #endif // STARK_MOVEMENT_MOVEMENT_H
Definition: item.h:139
Definition: console.h:27
Definition: movement.h:38
Definition: stateprovider.h:51