ScummVM API documentation
motion_control.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 TITANIC_MOTION_CONTROL_H
23 #define TITANIC_MOTION_CONTROL_H
24 
25 #include "titanic/star_control/fmatrix.h"
26 
27 namespace Titanic {
28 
29 class CCamera;
30 class CErrorCode;
31 class FMatrix;
32 class FVector;
33 class SimpleFile;
34 
36  double _initialVelocity;
37  double _minVelocity;
38  double _maxVelocity;
39  double _velocity;
40  double _acceleration;
41  double _rotationX;
42  double _rotationY;
43  double _rotationZ;
44 };
45 
50 private:
51  CCamera *_owner;
52  FVector _vector;
53 public:
54  CCallbackHandler(CCamera *owner, const FVector &v) : _owner(owner), _vector(v) {
55  }
56 
60  void apply();
61 };
62 
64 protected:
65  double _currVelocity;
66  double _incVelocity;
67  double _incAcceleration;
68  double _minVelocity;
69  double _maxVelocity;
70  double _rotationX;
71  double _rotationY;
72  double _rotationZ;
73 public:
74  int _lockCounter;
75  CCallbackHandler *_callback;
76 public:
77  CMotionControl(const CNavigationInfo *src);
78  virtual ~CMotionControl();
79 
80  virtual void setMotion(const CNavigationInfo *src);
81  virtual void getMotion(CNavigationInfo *dest);
82 
86  virtual void clear();
90  virtual void reset();
91 
95  virtual void setCallback(CCallbackHandler *callback);
99  virtual void accelerate();
100 
104  virtual void deccelerate();
105 
109  virtual void fullSpeed();
110 
114  virtual void stop();
115 
120  virtual void transitionBetweenPosOrients(const FVector &oldPos, const FVector &newPos,
121  const FMatrix &oldOrientation, const FMatrix &newOrientation) {}
122 
126  virtual void moveTo(const FVector &srcV, const FVector &destV, const FMatrix &orientation) {}
127 
132  virtual void transitionBetweenOrientations(const FVector &v1, const FVector &v2, const FVector &v3, const FMatrix &m) {}
133 
137  virtual void updatePosition(CErrorCode &errorCode, FVector &pos, FMatrix &orientation) {}
138 
142  virtual void load(SimpleFile *file, int version = 0);
143 
147  virtual void save(SimpleFile *file, int indent);
148 
152  void incLockCount();
153 
157  void decLockCount();
158 
162  bool isLocked() const { return _lockCounter > 0; }
163 };
164 
165 } // End of namespace Titanic
166 
167 #endif /* TITANIC_MOTION_CONTROL_H */
Definition: fmatrix.h:35
virtual void moveTo(const FVector &srcV, const FVector &destV, const FMatrix &orientation)
Definition: motion_control.h:126
Definition: motion_control.h:49
Definition: error_code.h:27
Definition: simple_file.h:49
Definition: camera.h:42
Definition: arm.h:30
virtual void transitionBetweenOrientations(const FVector &v1, const FVector &v2, const FVector &v3, const FMatrix &m)
Definition: motion_control.h:132
bool isLocked() const
Definition: motion_control.h:162
virtual void transitionBetweenPosOrients(const FVector &oldPos, const FVector &newPos, const FMatrix &oldOrientation, const FMatrix &newOrientation)
Definition: motion_control.h:120
Definition: motion_control.h:63
Definition: motion_control.h:35
virtual void updatePosition(CErrorCode &errorCode, FVector &pos, FMatrix &orientation)
Definition: motion_control.h:137
Definition: fvector.h:36