ScummVM API documentation
bbdou_specialcode.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_BBDOU_BBDOU_SPECIALCODE_H
23 #define ILLUSIONS_BBDOU_BBDOU_SPECIALCODE_H
24 
25 #include "illusions/specialcode.h"
26 #include "illusions/thread.h"
27 #include "common/hashmap.h"
28 
29 namespace Illusions {
30 
31 class IllusionsEngine_BBDOU;
32 class BbdouBubble;
33 class BbdouCredits;
34 class BbdouCursor;
35 class BbdouFoodCtl;
36 class BbdouInventory;
37 struct CursorData;
38 struct VerbState;
39 
40 typedef Common::Functor1<OpCall&, void> SpecialCodeFunction;
41 
42 class BbdouSpecialCode;
43 
44 struct Struct10 {
45  uint32 _verbId;
46  uint32 _sequenceId1;
47  uint32 _sequenceId2;
48  uint32 _sequenceId3;
49 };
50 
51 class CauseThread_BBDOU : public Thread {
52 public:
53  CauseThread_BBDOU(IllusionsEngine_BBDOU *vm, uint32 threadId, uint32 callingThreadId,
54  BbdouSpecialCode *bbdou, uint32 cursorObjectId, uint32 sceneId,
55  uint32 verbId, uint32 objectId2, uint32 objectId);
56  void onNotify() override;
57  void onTerminated() override;
58 public:
59  BbdouSpecialCode *_bbdou;
60  uint32 _cursorObjectId;
61  uint32 _sceneId;
62  uint32 _verbId;
63  uint32 _objectId2;
64  uint32 _objectId;
65 };
66 
68  int16 _x;
69  uint32 _threadId;
70 };
71 
72 class RadarMicrophoneThread : public Thread {
73 public:
74  RadarMicrophoneThread(IllusionsEngine_BBDOU *vm, uint32 threadId,
75  uint32 callingThreadId, uint32 cursorObjectId);
76  int onUpdate() override;
77  void addZone(uint32 threadId);
78  void initZones();
79 public:
80  uint32 _cursorObjectId;
81  uint _zonesCount;
82  uint _currZoneIndex;
83  RadarMicrophoneZone _zones[8];
84 };
85 
86 struct ShooterStatus {
87  int gridX;
88  bool flag;
89 };
90 
92  uint32 _objectId;
93  int _interactMode;
94  ObjectInteractMode() : _objectId(0), _interactMode(0) {}
95 };
96 
98 public:
100  void setObjectInteractMode(uint32 objectId, int value);
101  int getObjectInteractMode(uint32 objectId);
102 protected:
103  ObjectInteractMode _objectVerbs[512];
104 };
105 
107 public:
109  ~BbdouSpecialCode() override;
110  void init() override;
111  void run(uint32 specialCodeId, OpCall &opCall) override;
112  void resetBeforeResumeSavegame() override;
113 public:
115  typedef Map::iterator MapIterator;
117  Map _map;
118  BbdouCursor *_cursor;
119  BbdouBubble *_bubble;
120  BbdouInventory *_inventory;
121 
122  BbdouCredits *_credits;
123 
124  // Salad
125  uint _saladCount;
126  uint32 _saladObjectIds[12];
127 
128  // Shooter
129  ShooterStatus _shooterStatus[2];
130  uint _shooterObjectIdIndex;
131 
132  BbdouFoodCtl *_foodCtl;
133 
134  ObjectInteractModeMap _objectInteractModeMap;
135 
136  // Special code interface functions
137  void spcInitCursor(OpCall &opCall);
138  void spcEnableCursor(OpCall &opCall);
139  void spcDisableCursor(OpCall &opCall);
140  void spcAddCursorSequence(OpCall &opCall);
141  void spcCursorStartHoldingObjectId(OpCall &opCall);
142  void spcCursorStopHoldingObjectId(OpCall &opCall);
143  void spcSetCursorState(OpCall &opCall);
144  void spcInitBubble(OpCall &opCall);
145  void spcSetupBubble(OpCall &opCall);
146  void spcSetObjectInteractMode(OpCall &opCall);
147  void spcInitInventory(OpCall &opCall);
148  void spcClearInventory(OpCall &opCall);
149  void spcRegisterInventoryBag(OpCall &opCall);
150  void spcRegisterInventorySlot(OpCall &opCall);
151  void spcRegisterInventoryItem(OpCall &opCall);
152  void spcOpenInventory(OpCall &opCall);
153  void spcAddInventoryItem(OpCall &opCall);
154  void spcRemoveInventoryItem(OpCall &opCall);
155  void spcHasInventoryItem(OpCall &opCall);
156  void spcCloseInventory(OpCall &opCall);
157  void spcInitConversation(OpCall &opCall);
158  void spcClearConversation(OpCall &opCall);
159  void spcClearBlockCounter(OpCall &opCall);
160  void spcResetCursor(OpCall &opCall);
161  void spcSetCursorField90(OpCall &opCall);
162  void spcFoodCtl(OpCall &opCall);
163  void spcTestFoodCtl(OpCall &opCall);
164  void spcInitMenu(OpCall &opCall);
165  void spcIsCursorHoldingObjectId(OpCall &opCall);
166  void spcInitRadarMicrophone(OpCall &opCall);
167  void spcCreditsCtl(OpCall &opCall);
168  void spcSaladCtl(OpCall &opCall);
169  void spcRunCause(OpCall &opCall);
170 
171  void playSoundEffect(int soundIndex);
172  void hideVerbBubble(uint32 objectId, VerbState *verbState);
173  void startHoldingObjectId(uint32 objectId1, uint32 holdingObjectId, bool doPlaySound);
174  void stopHoldingObjectId(uint32 objectId1, bool doPlaySound);
175  bool isHoldingObjectId(uint32 objectId);
176 
177 protected:
178  // Internal functions
179  bool testInteractModeRange(int value);
180  void setCursorControlRoutine(uint32 objectId, int num);
181  Common::Point getBackgroundCursorPos(Common::Point cursorPos);
182  void showBubble(uint32 objectId, uint32 overlappedObjectId, uint32 holdingObjectId,
183  VerbState *verbState, uint32 progResKeywordId);
184  bool findVerbId(VerbState *verbState, uint32 currOverlappedObjectId, int always0, uint32 &outVerbId);
185  void cursorInteractControlRoutine(Control *cursorControl, uint32 deltaTime);
186  void cursorCrosshairControlRoutine(Control *cursorControl, uint32 deltaTime);
187  bool testVerbId(uint32 verbId, uint32 holdingObjectId, uint32 overlappedObjectId);
188  bool getCause(uint32 sceneId, uint32 verbId, uint32 objectId2, uint32 objectId,
189  uint32 &outVerbId, uint32 &outObjectId2, uint32 &outObjectId);
190  bool runCause(Control *cursorControl, CursorData &cursorData,
191  uint32 verbId, uint32 objectId2, uint32 objectId, int soundIndex);
192  uint32 startCauseThread(uint32 cursorObjectId, uint32 sceneId, uint32 verbId, uint32 objectId2, uint32 objectId);
193  // Salad
194  void initSalad();
195  void addSalad(uint32 sequenceId);
196  // Shooter
197  bool getShooterCause(uint32 sceneId, uint32 verbId, uint32 objectId2, uint32 objectId,
198  uint32 &outSceneId, uint32 &outVerbId, uint32 &outObjectId2, uint32 &outObjectId);
199 };
200 
201 } // End of namespace Illusions
202 
203 #endif // ILLUSIONS_BBDOU_BBDOU_SPECIALCODE_H
Definition: bbdou_credits.h:41
Definition: bbdou_specialcode.h:44
Definition: bbdou_cursor.h:44
Definition: bbdou_specialcode.h:97
Definition: actor.h:34
Definition: bbdou_specialcode.h:72
Definition: thread.h:47
Definition: bbdou_specialcode.h:67
Definition: bbdou_foodctl.h:40
Definition: illusions_bbdou.h:60
Definition: rect.h:45
Definition: specialcode.h:44
Definition: bbdou_inventory.h:76
Definition: func.h:437
Definition: bbdou_cursor.h:33
Definition: bbdou_specialcode.h:51
Definition: bbdou_bubble.h:53
Definition: bbdou_specialcode.h:91
Definition: bbdou_specialcode.h:86
Definition: actor.h:180
Definition: bbdou_cursor.h:73
Definition: scriptopcodes.h:32
Definition: bbdou_specialcode.h:106