ScummVM API documentation
illusions_duckman.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_ILLUSIONS_DUCKMAN_H
23 #define ILLUSIONS_ILLUSIONS_DUCKMAN_H
24 
25 #include "illusions/illusions.h"
26 #include "common/algorithm.h"
27 #include "common/stack.h"
28 
29 namespace Illusions {
30 
31 class Dictionary;
32 class ScriptStack;
33 class DuckmanDialogSystem;
34 class DuckmanMenuSystem;
35 class DuckmanVideoPlayer;
36 
38  int _gameState;
39  Control *_control;
40  Common::Point _position;
41  uint32 _objectId;
42  int _actorIndex;
43  int _savedActorIndex;
44  bool _field14[14];
45  Control *_currOverlappedControl;
46  uint32 _sequenceId1;
47  uint32 _sequenceId2;
48  uint32 _notifyThreadId30;
49  int16 *_op113_choiceOfsPtr;
50  int _dialogItemsCount;
51  uint32 _overlappedObjectId;
52  uint32 _field3C;
53  uint32 _field40;
54 };
55 
57  int16 x, y;
58 };
59 
61  uint32 _duration;
62  uint _pointsCount;
63  const ScreenShakerPoint *_points;
64 };
65 
66 struct ScreenShaker {
67  uint _pointsIndex;
68  uint _pointsCount;
69  bool _finished;
70  uint32 _duration;
71  uint32 _nextTime;
72  uint32 _notifyThreadId;
73  const ScreenShakerPoint *_points;
74 };
75 
76 struct OpCall;
77 
79 public:
81 protected:
82  Common::Error run() override;
83  bool hasFeature(EngineFeature f) const override;
84 public:
85 
86  uint32 _prevSceneId;
87  uint32 _theSceneId;
88  uint32 _theThreadId;
89  uint32 _globalSceneId;
90 
91  uint _activeScenesCount;
92  uint32 _activeScenes[6];
93 
94  Cursor_Duckman _cursor;
95  Control *_currWalkOverlappedControl;
96 
97  DuckmanDialogSystem *_dialogSys;
98 
99  int _savedInventoryActorIndex;
100 
101  ScreenShaker *_screenShaker;
102  DuckmanMenuSystem *_menuSystem;
103  DuckmanVideoPlayer *_videoPlayer;
104 
105  void initInput();
106 
107  void initUpdateFunctions();
108  int updateScript(uint flags);
109 
110  void startScreenShaker(uint pointsCount, uint32 duration, const ScreenShakerPoint *points, uint32 threadId);
111  void stopScreenShaker();
112  int updateScreenShaker(uint flags);
113 
114  void startFader(int duration, int minValue, int maxValue, int firstIndex, int lastIndex, uint32 threadId);
115  void updateFader() override;
116  void clearFader() override;
117  void pauseFader() override;
118  void unpauseFader() override;
119 
120  int updateVideoPlayer(uint flags);
121  void playVideo(uint32 videoId, uint32 callingThreadId);
122  bool isVideoPlaying() override;
123 
124  void setDefaultTextCoords() override;
125 
126  void loadSpecialCode(uint32 resId) override;
127  void unloadSpecialCode(uint32 resId) override;
128  void notifyThreadId(uint32 &threadId) override;
129  bool testMainActorFastWalk(Control *control) override;
130  bool testMainActorCollision(Control *control) override;
131  Control *getObjectControl(uint32 objectId) override;
132  Common::Point getNamedPointPosition(uint32 namedPointId) override;
133  uint32 getPriorityFromBase(int16 priority) override;
134  uint32 getCurrentScene() override;
135  uint32 getPrevScene() override;
136 
137  bool isCursorObject(uint32 actorTypeId, uint32 objectId) override;
138  void setCursorControlRoutine(Control *control) override;
139  void placeCursorControl(Control *control, uint32 sequenceId) override;
140  void setCursorControl(Control *control) override;
141  void showCursor() override;
142  void hideCursor() override;
143  void initCursor();
144  void setCursorActorIndex(int actorIndex, int a, int b);
145  void enableCursorVerb(int verbNum);
146  void disableCursorVerb(int verbNum);
147  void setCursorHandMode(int mode);
148  void setCursorInventoryMode(int mode, int value);
149  void startCursorHoldingObject(uint32 objectId, uint32 sequenceId);
150  void stopCursorHoldingObject();
151  void cursorControlRoutine(Control *control, uint32 deltaTime);
152 
153  void startScriptThreadSimple(uint32 threadId, uint32 callingThreadId) override;
154  void startScriptThread(uint32 threadId, uint32 callingThreadId);
155  void startScriptThread2(uint32 threadId, uint32 callingThreadId, uint32 unk);
156  uint32 startAbortableTimerThread(uint32 duration, uint32 threadId);
157  uint32 startTimerThread(uint32 duration, uint32 threadId);
158  uint32 startAbortableThread(byte *scriptCodeIp1, byte *scriptCodeIp2, uint32 callingThreadId);
159  uint32 startTalkThread(uint32 objectId, uint32 talkId, uint32 sequenceId1,
160  uint32 sequenceId2, uint32 callingThreadId);
161  uint32 startTempScriptThread(byte *scriptCodeIp, uint32 callingThreadId,
162  uint32 value8, uint32 valueC, uint32 value10) override;
163  void resumeFromSavegame(uint32 callingThreadId);
164 
165  void newScriptThread(uint32 threadId, uint32 callingThreadId, uint notifyFlags,
166  byte *scriptCodeIp);
167  uint32 newTimerThread(uint32 duration, uint32 callingThreadId, bool isAbortable);
168  uint32 newTempThreadId();
169 
170  void initActiveScenes();
171  void pushActiveScene(uint32 sceneId);
172  void popActiveScene();
173  bool loadScene(uint32 sceneId);
174  bool enterScene(uint32 sceneId, uint32 threadId);
175  void exitScene();
176  bool changeScene(uint32 sceneId, uint32 threadId, uint32 callerThreadId);
177  void enterPause(uint32 sceneId, uint32 threadId);
178  void leavePause(uint32 sceneId, uint32 threadId);
179  void dumpActiveScenes(uint32 sceneId, uint32 threadId);
180  void dumpCurrSceneFiles(uint32 sceneId, uint32 threadId);
181 
182  void pause(uint32 callerThreadId);
183  void unpause(uint32 callerThreadId);
184 
185  void setSceneIdThreadId(uint32 theSceneId, uint32 theThreadId);
186  bool findTriggerCause(uint32 sceneId, uint32 verbId, uint32 objectId2, uint32 objectId, uint32 &codeOffs);
187  void reset();
188 
189  uint32 getObjectActorTypeId(uint32 objectId);
190 
191  Common::Point convertMousePos(Common::Point mousePos);
192  void startCursorSequence();
193  int getCursorActorIndex();
194  void updateGameState2();
195  void playSoundEffect(int index);
196  bool getTriggerCause(uint32 verbId, uint32 objectId2, uint32 objectId, uint32 &outThreadId);
197  uint32 runTriggerCause(uint32 verbId, uint32 objectId2, uint32 objectId);
198  void playTriggerCauseSound(uint32 verbId, uint32 objectId2, uint32 objectId);
199 
200  bool loadSavegameFromScript(int16 slotNum, uint32 callingThreadId);
201  bool saveSavegameFromScript(int16 slotNum, uint32 callingThreadId);
202  void activateSavegame(uint32 callingThreadId);
203 
204 };
205 
206 } // End of namespace Illusions
207 
208 #endif // ILLUSIONS_ILLUSIONS_H
Definition: illusions_duckman.h:60
EngineFeature
Definition: engine.h:250
Definition: error.h:84
Definition: actor.h:34
Definition: detection.h:34
Definition: menusystem_duckman.h:55
Definition: duckman_dialog.h:36
Definition: illusions_duckman.h:37
Definition: duckman_videoplayer.h:32
Definition: rect.h:45
Definition: illusions_duckman.h:66
Definition: illusions_duckman.h:78
Definition: system.h:161
Definition: actor.h:180
Definition: scriptopcodes.h:32
Definition: illusions_duckman.h:56
Definition: illusions.h:92