ScummVM API documentation
illusions_bbdou.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_BBDOU_H
23 #define ILLUSIONS_ILLUSIONS_BBDOU_H
24 
25 #include "illusions/illusions.h"
26 #include "illusions/bbdou/bbdou_triggerfunctions.h"
27 #include "common/algorithm.h"
28 #include "common/stack.h"
29 
30 namespace Illusions {
31 
32 class Dictionary;
33 class ScriptMan;
34 class ScriptStack;
35 class BBDOUVideoPlayer;
36 class BBDOUMenuKeys;
37 class BBDOUMenuSystem;
38 
39 struct ActiveScene {
40  uint32 _sceneId;
41  int _pauseCtr;
42 };
43 
44 class ActiveScenes {
45 public:
46  ActiveScenes();
47  void clear();
48  void push(uint32 sceneId);
49  void pop();
50  void pauseActiveScene();
51  void unpauseActiveScene();
52  uint getActiveScenesCount();
53  void getActiveSceneInfo(uint index, uint32 *sceneId, int *pauseCtr);
54  uint32 getCurrentScene();
55  bool isSceneActive(uint32 sceneId);
56 protected:
58 };
59 
61 public:
63 protected:
64  Common::Error run() override;
65  bool hasFeature(EngineFeature f) const override;
66 public:
67  ScriptMan *_scriptMan;
68  TriggerFunctions *_triggerFunctions;
69  Cursor *_cursor;
70 
71  ActiveScenes _activeScenes;
72  uint32 _prevSceneId;
73  uint32 _theSceneId;
74  uint32 _theThreadId;
75  uint32 _globalSceneId;
76 
77  bool _loadGameResult, _saveGameResult;
78 
79  BBDOUMenuSystem *_menuSystem;
80  BBDOUVideoPlayer *_videoPlayer;
81  BBDOUMenuKeys *_menuKeys;
82 
83  bool _walkthroughStarted;
84  bool _canResumeFromSavegame;
85 
86  void initInput();
87 
88  void initUpdateFunctions();
89  int updateScript(uint flags);
90  int updateMenuKeys(uint flags);
91 
92  bool causeIsDeclared(uint32 sceneId, uint32 verbId, uint32 objectId2, uint32 objectId);
93  void causeDeclare(uint32 verbId, uint32 objectId2, uint32 objectId, TriggerFunctionCallback *callback);
94  uint32 causeTrigger(uint32 sceneId, uint32 verbId, uint32 objectId2, uint32 objectId, uint32 callingThreadId);
95 
96  int updateVideoPlayer(uint flags);
97  void playVideo(uint32 videoId, uint32 objectId, uint32 priority, uint32 callingThreadId);
98  bool isVideoPlaying() override;
99 
100  void setDefaultTextCoords() override;
101 
102  void loadSpecialCode(uint32 resId) override;
103  void unloadSpecialCode(uint32 resId) override;
104  void notifyThreadId(uint32 &threadId) override;
105  bool testMainActorFastWalk(Control *control) override;
106  bool testMainActorCollision(Control *control) override;
107  Control *getObjectControl(uint32 objectId) override;
108  Common::Point getNamedPointPosition(uint32 namedPointId) override;
109  uint32 getPriorityFromBase(int16 priority) override;
110  uint32 getCurrentScene() override;
111  uint32 getPrevScene() override;
112 
113  bool isCursorObject(uint32 actorTypeId, uint32 objectId) override;
114  void setCursorControlRoutine(Control *control) override;
115  void placeCursorControl(Control *control, uint32 sequenceId) override;
116  void setCursorControl(Control *control) override;
117  void showCursor() override;
118  void hideCursor() override;
119  void cursorControlRoutine(Control *control, uint32 deltaTime);
120 
121  void startScriptThreadSimple(uint32 threadId, uint32 callingThreadId) override;
122  void startScriptThread(uint32 threadId, uint32 callingThreadId,
123  uint32 value8, uint32 valueC, uint32 value10);
124  void startAnonScriptThread(int32 threadId, uint32 callingThreadId,
125  uint32 value8, uint32 valueC, uint32 value10);
126  uint32 startAbortableTimerThread(uint32 duration, uint32 threadId);
127  uint32 startTimerThread(uint32 duration, uint32 threadId);
128  uint32 startAbortableThread(byte *scriptCodeIp1, byte *scriptCodeIp2, uint32 callingThreadId);
129  uint32 startTalkThread(int16 duration, uint32 objectId, uint32 talkId, uint32 sequenceId1,
130  uint32 sequenceId2, uint32 namedPointId, uint32 callingThreadId);
131  uint32 startTempScriptThread(byte *scriptCodeIp, uint32 callingThreadId,
132  uint32 value8, uint32 valueC, uint32 value10) override;
133 
134  void newScriptThread(uint32 threadId, uint32 callingThreadId, uint notifyFlags,
135  byte *scriptCodeIp, uint32 value8, uint32 valueC, uint32 value10);
136  uint32 newTimerThread(uint32 duration, uint32 callingThreadId, bool isAbortable);
137  uint32 newTempThreadId();
138 
139  bool enterScene(uint32 sceneId, uint32 threadId);
140  void exitScene(uint32 threadId);
141  void enterPause(uint32 threadId);
142  void leavePause(uint32 threadId);
143  void dumpActiveScenes(uint32 sceneId, uint32 threadId);
144 
145  void pause(uint32 callerThreadId);
146  void unpause(uint32 callerThreadId);
147 
148  void enterMenuPause();
149  void leaveMenuPause();
150 
151  void setSceneIdThreadId(uint32 theSceneId, uint32 theThreadId);
152  bool findTriggerCause(uint32 sceneId, uint32 verbId, uint32 objectId2, uint32 objectId, uint32 &codeOffs);
153  void reset();
154 
155  void loadSavegameFromScript(int16 slotNum, uint32 callingThreadId);
156  void saveSavegameFromScript(int16 slotNum, uint32 callingThreadId);
157  void activateSavegame(uint32 callingThreadId);
158  void resumeFromSavegame();
159 
160 };
161 
162 } // End of namespace Illusions
163 
164 #endif // ILLUSIONS_ILLUSIONS_H
EngineFeature
Definition: engine.h:253
Definition: menusystem_bbdou.h:42
Definition: error.h:84
Definition: bbdou_menukeys.h:38
Definition: cursor.h:30
Definition: actor.h:34
Definition: detection.h:34
Definition: bbdou_triggerfunctions.h:45
Definition: illusions_bbdou.h:39
Definition: stack.h:43
Definition: illusions_bbdou.h:60
Definition: rect.h:45
Definition: bbdou_videoplayer.h:32
Definition: illusions_bbdou.h:44
Definition: system.h:161
Definition: actor.h:180
Definition: func.h:473
Definition: illusions.h:92