ScummVM API documentation
camera.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 ILLUSIONS_CAMERA_H
23 #define ILLUSIONS_CAMERA_H
24 
25 #include "illusions/graphics.h"
26 #include "common/rect.h"
27 #include "common/stack.h"
28 
29 namespace Illusions {
30 
31 class BackgroundInstance;
32 
33 struct CameraState {
34  int _cameraMode;
35  //field_2 dw
36  bool _paused;
37  int16 _panSpeed;
38  int _someX, _someY;
39  Common::Point _currPan;
40  int _panXShl, _panYShl;
41  WRect _bounds;
42  uint32 _panNotifyId;
43  uint32 _time28;
44  uint32 _panStartTime;
45  uint32 _pauseStartTime;
46  uint32 _time2E;
47  Common::Point _currPan2;
48  Common::Point _panTargetPoint;
49  Common::Point _trackingLimits;
50  Common::Point _centerPt;
51  uint32 _panObjectId;
52  Common::Point *_panToPositionPtr;
53  uint _pointFlags;
54  //field_4A dw
55 };
56 
58  int _cameraMode;
59  uint32 _panObjectId;
60  int16 _panSpeed;
61  Common::Point _panTargetPoint;
62  uint32 _panNotifyId;
63 };
64 
65 class Camera {
66 public:
68  void clearStack();
69  void set(Common::Point &panPoint, WidthHeight &dimensions);
70  void panCenterObject(uint32 objectId, int16 panSpeed);
71  void panTrackObject(uint32 objectId);
72  void panToPoint(Common::Point pt, int16 panSpeed, uint32 panNotifyId);
73  void panEdgeFollow(uint32 objectId, int16 panSpeed);
74  void stopPan();
75  void pause();
76  void unpause();
77  void pushCameraMode();
78  void popCameraMode();
79  void clearCameraModeStack();
80  void update(uint32 currTime);
81  void setBounds(Common::Point minPt, Common::Point maxPt);
82  void setBoundsToDimensions(WidthHeight &dimensions);
83  Common::Point getCurrentPan();
84  Common::Point getScreenOffset();
85  Common::Point getTrackingLimits();
86  bool isAtPanLimit(int limitNum);
87  void setActiveState(CameraState &state);
88  void getActiveState(CameraState &state);
89  void refreshPan(BackgroundInstance *backgroundItem, WidthHeight &dimensions);
90 protected:
91  IllusionsEngine *_vm;
92  CameraState _activeState;
94 
95  int16 _screenWidth, _screenHeight;
96  int16 _screenMidX, _screenMidY;
97  Common::Point _centerObjectTrackingLimits;
98  Common::Point _trackObjectTrackingLimits;
99  int16 _trackObjectTrackingLimitsPanSpeed;
100 
101  void updateMode1(uint32 currTime);
102  void updateMode2(uint32 currTime);
103  void updateMode3(uint32 currTime);
104  bool updatePan(uint32 currTime);
105  bool isPanFinished();
106  Common::Point getPtOffset(Common::Point pt);
107  void recalcPan(uint32 currTime);
108  bool calcPointFlags(Common::Point &pt, WRect &rect, uint &outFlags);
109  void clipPanTargetPoint();
110  void init();
111  void initDuckman();
112  void initBBDOU();
113 };
114 
115 } // End of namespace Illusions
116 
117 #endif // ILLUSIONS_CAMERA_H
Definition: graphics.h:44
Definition: actor.h:34
Definition: graphics.h:31
Definition: stack.h:43
Definition: camera.h:33
Definition: camera.h:65
Definition: rect.h:45
Definition: backgroundresource.h:183
Definition: camera.h:57
Definition: illusions.h:92