ScummVM API documentation
events.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 VOYEUR_EVENTS_H
23 #define VOYEUR_EVENTS_H
24 
25 #include "common/scummsys.h"
26 #include "common/list.h"
27 #include "graphics/surface.h"
28 #include "voyeur/files.h"
29 
30 namespace Voyeur {
31 
32 class VoyeurEngine;
33 class EventsManager;
34 class CMapResource;
35 
36 #define GAME_FRAME_RATE 50
37 #define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE)
38 
39 typedef void (EventsManager::*EventMethodPtr)();
40 
41 class IntNode {
42 public:
43  EventMethodPtr _intFunc;
44  uint16 _curTime;
45  uint16 _timeReset;
46  uint32 _flags;
47 
48  IntNode();
49  IntNode(uint16 curTime, uint16 timeReset, uint16 flags);
50 };
51 
52 class IntData {
53 public:
54  bool _flipWait;
55  int _flashTimer;
56  int _flashStep;
57  bool _hasPalette;
58  bool _skipFading;
59  int _palStartIndex;
60  int _palEndIndex;
61  byte *_palette;
62 
63  IntData();
64 };
65 
67 private:
68  VoyeurEngine *_vm;
69  bool _counterFlag;
70  bool _cursorBlinked;
71  uint32 _gameCounter;
72  uint32 _priorFrameTime;
73  uint32 _recordBlinkCounter; // Original field was called _joe :)
74  Common::List<IntNode *> _intNodes;
75  Common::Point _mousePos;
76 
77  void resetEvents();
78  void mainVoyeurIntFunc();
79  void checkForNextFrameCounter();
80  void voyeurTimer();
81  void videoTimer();
82  void vDoFadeInt();
83  void vDoCycleInt();
84  void fadeIntFunc();
85  void addIntNode(IntNode *node);
86  void deleteIntNode(IntNode *node);
87 
91  void showMousePosition();
92 public:
93  IntData _gameData;
94  IntData &_intPtr;
95  IntNode _fadeIntNode;
96  IntNode _fade2IntNode;
97  IntNode _cycleIntNode;
98  IntNode _evIntNode;
99  IntNode _mainIntNode;
100  int _cycleStatus;
101  int _fadeFirstCol, _fadeLastCol;
102  int _fadeCount;
103  int _fadeStatus;
104 
105  bool _leftClick, _rightClick;
106  bool _mouseClicked, _newMouseClicked;
107  bool _newLeftClick, _newRightClick;
108 
109  int _videoDead;
110  int _cycleTime[4];
111  byte *_cycleNext[4];
112  VInitCycleResource *_cyclePtr;
113 
115 
116  void setMousePos(const Common::Point &p) { _mousePos = p; }
117  void startMainClockInt();
118  void sWaitFlip();
119  void vInitColor();
120 
121  void delay(int cycles);
122  void delayClick(int cycles);
123  void pollEvents();
124  void startFade(CMapResource *cMap);
125  void addFadeInt();
126 
127  void setCursor(PictureResource *pic);
128  void setCursor(byte *cursorData, int width, int height, int keyColor);
129  void setCursorColor(int idx, int mode);
130  void showCursor();
131  void hideCursor();
132  Common::Point getMousePos() { return _mousePos; }
133  uint32 getGameCounter() const { return _gameCounter; }
134  void getMouseInfo();
135  void startCursorBlink();
136  void incrementTime(int amt);
137 
138  void stopEvidDim();
139 
140  Common::String getEvidString(int eventIndex);
141 };
142 
143 } // End of namespace Voyeur
144 
145 #endif /* VOYEUR_EVENTS_H */
Definition: voyeur.h:78
Definition: str.h:59
Definition: list.h:44
Definition: files.h:421
Definition: files.h:279
Definition: events.h:52
Definition: events.h:41
Definition: rect.h:144
Definition: files.h:437
Definition: animation.h:38
Definition: events.h:66