ScummVM API documentation
cursor.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  * Clipping rectangle defines
21  */
22 
23 #ifndef TINSEL_CURSOR_H // prevent multiple includes
24 #define TINSEL_CURSOR_H
25 
26 #include "common/frac.h"
27 #include "tinsel/anim.h"
28 #include "tinsel/dw.h" // for SCNHANDLE
29 
30 namespace Tinsel {
31 
32 struct IMAGE;
33 struct FREEL;
34 struct MULTI_INIT;
35 struct FILM;
36 struct OBJECT;
37 
38 #define MAX_TRAILERS 10
39 
40 class Cursor {
41 public:
42  Cursor();
43  virtual ~Cursor() {}
44  void AdjustCursorXY(int deltaX, int deltaY);
45  void SetCursorXY(int x, int y);
46  void SetCursorScreenXY(int newx, int newy);
47  void GetCursorXY(int *x, int *y, bool absolute);
48  bool GetCursorXYNoWait(int *x, int *y, bool absolute);
49  bool isCursorShown();
50 
51  void RestoreMainCursor();
52  void SetTempCursor(SCNHANDLE pScript);
53  void DwHideCursor();
54  void UnHideCursor();
55  void HideCursorProcess();
56  void AnimateProcess();
57  void FreezeCursor();
58  void DoFreezeCursor(bool bFreeze);
59  void HideCursorTrails();
60  void UnHideCursorTrails();
61  void DelAuxCursor();
62  void SetAuxCursor(SCNHANDLE hFilm);
63  void DwInitCursor(SCNHANDLE bfilm);
64  void DropCursor();
65  void RestartCursor();
66  void RebootCursor();
67  void StartCursorFollowed();
68  void EndCursorFollowed();
69  void InitCurObj();
70  void InitCurPos();
71  void DoCursorMove();
72 
73  bool CursorIsFrozen() { return _frozenCursor; }
74  int NumTrails() { return _numTrails; }
75  bool IsHidden() { return _hiddenCursor; }
76  bool ShouldBeHidden() { return _hiddenCursor || _tempHiddenCursor; }
77  bool HasReelData() { return _cursorFilm != 0; }
78 
79  bool _cursorProcessesStopped; // Set by DropCursor() at the end of a scene
80  // - causes cursor processes to do nothing
81  // Reset when main cursor has re-initialized
82 
83  bool _cursorProcessesRestarted; // When main cursor has been bWhoa-ed, it waits
84  // for this to be true.
85  // Main cursor sets this to true after a re-start
86 
87 private:
88  void InitCurTrailObj(int i, int x, int y);
89  bool GetDriverPosition(int *x, int *y);
90 
91  OBJECT *_mainCursor; // Main cursor object
92  OBJECT *_auxCursor; // Auxiliary cursor object
93 
94  ANIM _mainCursorAnim; // Main cursor animation structure
95  ANIM _auxCursorAnim; // Auxiliary cursor animation structure
96 
97  bool _hiddenCursor; // Set when cursor is hidden
98  bool _hiddenTrails; // Set when cursor trails are hidden
99  bool _tempHiddenCursor; // Set when cursor is hidden
100 
101  bool _frozenCursor; // Set when cursor position is frozen
102 
103  frac_t _iterationSize;
104 
105  SCNHANDLE _cursorFilm; // Handle to cursor reel data
106 
107  int _numTrails;
108  int _nextTrail;
109 
110  // Auxillary cursor image's animation offsets
111  short _auxCursorOffsetX;
112  short _auxCursorOffsetY;
113 
114  struct {
115  ANIM trailAnim; // Animation structure
116  OBJECT *trailObj; // This trailer's object
117  } _trailData[MAX_TRAILERS];
118 
119  int _lastCursorX, _lastCursorY;
120 };
121 
122 } // End of namespace Tinsel
123 
124 #endif // TINSEL_CURSOR_H
uint32 SCNHANDLE
Definition: dw.h:31
Definition: anim.h:33
Definition: cursor.h:40
Definition: object.h:73
Definition: actors.h:36
int32 frac_t
Definition: frac.h:52