ScummVM API documentation
camera_process.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 ULTIMA8_WORLD_CAMERAPROCESS_H
23 #define ULTIMA8_WORLD_CAMERAPROCESS_H
24 
25 #include "ultima/ultima8/kernel/process.h"
26 #include "ultima/ultima8/usecode/intrinsics.h"
27 #include "ultima/ultima8/misc/classtype.h"
28 #include "ultima/ultima8/misc/point3.h"
29 
30 namespace Ultima {
31 namespace Ultima8 {
32 
41 class CameraProcess : public Process {
42 public:
43  CameraProcess();
44  CameraProcess(uint16 itemnum); // Follow item/Do nothing
45  CameraProcess(const Point3 &p); // Goto location
46  CameraProcess(const Point3 &p, int32 time); // Scroll to location
47 
48  ~CameraProcess() override;
49 
50  ENABLE_RUNTIME_CLASSTYPE()
51 
52  void run() override;
53 
54  // You will notice that this isn't the same as how Item::GetLerped works
55  Point3 GetLerped(int32 factor, bool noupdate = false);
56 
60  uint16 findRoof(int32 factor);
61 
69  void moveToLocation(int32 x, int32 y, int32 z);
70  void moveToLocation(const Point3 &p);
71 
72  INTRINSIC(I_setCenterOn);
73  INTRINSIC(I_moveTo);
74  INTRINSIC(I_scrollTo);
75  INTRINSIC(I_startQuake);
76  INTRINSIC(I_stopQuake);
77  INTRINSIC(I_getCameraX);
78  INTRINSIC(I_getCameraY);
79  INTRINSIC(I_getCameraZ);
80 
81  static Point3 GetCameraLocation();
82  static CameraProcess *GetCameraProcess() {
83  return _camera;
84  }
85 
91  static uint16 SetCameraProcess(CameraProcess *);
92  static void ResetCameraProcess();
93 
94  static void SetEarthquake(int32 e) {
95  _earthquake = e;
96  if (!e) _eqX = _eqY = 0;
97  }
98 
100  void itemMoved();
101 
102  void terminate() override; // Terminate NOW!
103 
104  bool loadData(Common::ReadStream *rs, uint32 version);
105  void saveData(Common::WriteStream *ws) override;
106 
107  uint16 getTrackedItem() const {
108  return _itemNum;
109  }
110 
111 private:
112  Point3 _s;
113  Point3 _e;
114  int32 _time;
115  int32 _elapsed;
116  uint16 _itemNum;
117 
118  int32 _lastFrameNum;
119 
120  static CameraProcess *_camera;
121  static int32 _earthquake;
122  static int32 _eqX, _eqY;
123 };
124 
125 } // End of namespace Ultima8
126 } // End of namespace Ultima
127 
128 #endif
Definition: stream.h:77
static uint16 SetCameraProcess(CameraProcess *)
Definition: process.h:34
void saveData(Common::WriteStream *ws) override
save Process data
Definition: point3.h:28
Definition: camera_process.h:41
Definition: detection.h:27
void moveToLocation(int32 x, int32 y, int32 z)
void terminate() override
terminate the process. This wakes up all processes waiting for it.
Definition: stream.h:385
uint16 findRoof(int32 factor)