ScummVM API documentation
gamelogic.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 WAYNESWORLD_GAMELOGIC_H
23 #define WAYNESWORLD_GAMELOGIC_H
24 
25 #include "common/serializer.h"
26 #include "waynesworld/waynesworld.h"
27 
28 namespace WaynesWorld {
29 
30 class GameLogic {
31 public:
33  ~GameLogic();
34  void initVariables();
35  int handleVerbPickUp();
36  int handleVerbUse();
37  void handleVerbTalkTo();
38  int handleVerbPush();
39  int handleVerbPull();
40  int handleVerbOpen();
41  int handleVerbClose();
42  void handleVerbExtremeCloseupOf();
43  int handleVerbGive();
44  void handleDialogReply(int index, int x, int y);
45  bool handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
46  void refreshRoomBackground(int roomNum);
47  void updateRoomAnimations();
48  void handleRoomEvent(int eventNum);
49  int getActorScaleFromY(int actorY);
50  void setPizzathonStatus(int flagNum);
51  void r38_atrap();
52  void handlePizzathon();
53  void handleHypnosisCutscene();
54  void showEnding();
55 
56 public:
57  byte _r0_flags;
58  int _r0_pizzathonChoiceCtr;
59  bool _r0_pizzathonChoicesUsed[15];
60  int _r0_pizzathonIdeasCtr;
61  byte _r1_flags1;
62  byte _r1_flags2;
63  bool _r1_tongueTrickActive;
64  int _r1_tongueTrickCtr;
65  byte _r2_flags;
66  byte _r2_backgroundValue1;
67  byte _r2_backgroundValue2;
68  byte _r4_flags;
69  byte _r5_flags;
70  byte _r6_flags;
71  byte _r7_flags;
72  byte _r8_flags;
73  byte _r9_flags;
74  byte _r9_dialogFlag;
75  byte _r10_flags;
76  int _r10_selectedItemToBuy;
77  byte _r11_flags;
78  byte _r12_flags;
79  int _r12_talkObjectNumber;
80  byte _r13_flags;
81  byte _r17_dialogCtr;
82  byte _r17_eventFlag;
83  byte _r19_flags;
84  int _r19_garthSpriteX;
85  int _r19_wayneSpriteX;
86  byte _r20_flags;
87  int _r24_mazeHoleNumber;
88  int _r24_mazeRoomNumber;
89  int _r25_holeIndex;
90  byte _r29_flags;
91  byte _r30_flags;
92  byte _r31_flags;
93  bool _r31_askedQuestions[25];
94  int _r31_categoryIndex;
95  bool _r31_categorySelected;
96  int _r31_correctAnswerChoice;
97  int _r31_currentPlayer;
98  int _r31_questionIndex;
99  int _r31_questionsAsked;
100  int _r31_scores[3];
101  byte _r32_flags;
102  byte _r34_flags;
103  byte _r35_flags;
104  byte _r36_flags;
105  byte _r37_flags;
106  int _r37_safeCombinationCurrentNumber;
107  int _r37_safeCombinationDirection;
108  int _r37_safeCombinationIndex;
109  int _r37_safeCombinationLockIndex;
110  byte _r38_flags;
111  byte _r39_flags;
112  bool _didScratchTicket = false;
113  byte _pizzathonListFlags1;
114  byte _pizzathonListFlags2;
115 
116  int _menuGameState = 0;
117  WWSurface *_menuOffSprite = nullptr;
118  WWSurface *_menuOnSprite = nullptr;
119  WWSurface *_menuSurface = nullptr;
120  bool _menuQuitVisible = false;
121  int _menuIsSaveLoad = 0;
122 
123  // protected:
124 public://DEBUG So logic functions can be called from the engine class for testing
125  WaynesWorldEngine *_vm;
126 
127  void displayExtremeCloseupOfPizzathonList();
128  void displayExtremeCloseupOfSign15();
129  void displayExtremeCloseupOfObjectPictures22();
130  void displayExtremeCloseupOfMemo();
131  void displayExtremeCloseupOfSewerMap();
132  void displayExtremeCloseupOfBillboard1();
133  void displayExtremeCloseupOfBillboard2();
134 
135  int r0_handleVerbPickUp();
136  int r0_handleVerbUse();
137  int r0_handleVerbOpen();
138  bool r0_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
139  void r0_refreshRoomBackground();
140  void r0_handleRoomEvent1();
141  void r0_handleRoomEvent2();
142  void r0_handleRoomEvent3();
143  void r0_updatePizzathonDialogChoices(int selectedDialogChoice);
144 
145  int r1_handleVerbPickUp();
146  int r1_handleVerbUse();
147  void r1_handleVerbTalkTo();
148  int r1_handleVerbPush();
149  int r1_handleVerbPull();
150  int r1_handleVerbOpen();
151  int r1_handleVerbClose();
152  bool r1_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
153  void r1_refreshRoomBackground();
154  void r1_handleRoomEvent(bool startTongueTrick);
155  void r1_initRoomAnimations();
156  void r1_uninitRoomAnimations();
157  void r1_updateRoomAnimations();
158  void r1_useDayOldDonutWithMachine();
159  void r1_checkDrGadget();
160  void r1_pullScreen();
161  void r1_pullLever();
162  void r1_openSafe();
163  void r1_closeSafe();
164  void r1_drGadgetLeaves();
165 
166  int r2_handleVerbPickUp();
167  int r2_handleVerbUse();
168  void r2_handleVerbTalkTo();
169  int r2_handleVerbGive();
170  bool r2_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
171  void r2_refreshRoomBackground();
172  void r2_giveCandyBarToBikerGang();
173  void r2_handleDialogSelect369();
174  void r2_handleDialogSelect385();
175 
176  int r3_handleVerbPickUp();
177  int r3_handleVerbUse();
178  void r3_handleVerbTalkTo();
179  bool r3_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
180  void r3_refreshRoomBackground();
181 
182  int r4_handleVerbPickUp();
183  int r4_handleVerbUse();
184  void r4_handleVerbTalkTo();
185  int r4_handleVerbOpen();
186  bool r4_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
187  void r4_refreshRoomBackground();
188  void r4_handleRoomEvent();
189  void r4_initRoomAnimations();
190  void r4_uninitRoomAnimations();
191  void r4_updateRoomAnimations();
192  int r4_useCheesePizzaWithCastle();
193  int r4_useDrumstickWithCastleDoor();
194  void r4_useChainWithObject(bool arg6, bool arg8);
195  int r4_useTubeWithShade();
196 
197  int r5_handleVerbPickUp();
198  int r5_handleVerbUse();
199  int r5_handleVerbPush();
200  int r5_handleVerbOpen();
201  bool r5_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
202  void r5_refreshRoomBackground();
203  void r5_handleCassandra(const char *filename, int startFrame, int maxFrame, int startX, int startY, int targetX, int targetY, int width, int height, int totalSpeed, bool refreshBackground);
204  void r5_handleRoomEvent();
205 
206  int r6_handleVerbPickUp();
207  int r6_handleVerbUse();
208  int r6_handleVerbPull();
209  int r6_handleVerbOpen();
210  int r6_handleVerbGive();
211  bool r6_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
212  void r6_refreshRoomBackground();
213  void r6_handleRoomEvent1();
214  void r6_handleRoomEvent2();
215  void r6_handleRoomEvent3();
216  void r6_handleRoomEvent4();
217  void r6_initRoomAnimations();
218  void r6_uninitRoomAnimations();
219  void r6_updateRoomAnimations();
220  void r6_useRopeWithBeam();
221  void r6_useHockeyStickWithRope();
222  void r6_useSeat();
223  void r6_pullRope();
224  void r6_giveLuckySausageToDog();
225 
226  int r7_handleVerbPickUp();
227  int r7_handleVerbUse();
228  void r7_handleVerbTalkTo();
229  int r7_handleVerbPush();
230  int r7_handleVerbOpen();
231  void r7_refreshRoomBackground();
232  void r7_initRoomAnimations();
233  void r7_uninitRoomAnimations();
234  void r7_updateRoomAnimations();
235  void r7_openCloseFrontDoor(bool isOpen);
236 
237  int r8_handleVerbPickUp();
238  int r8_handleVerbUse();
239  int r8_handleVerbOpen();
240  int r8_handleVerbClose();
241  bool r8_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
242  void r8_refreshRoomBackground();
243  void r8_initRoomAnimations();
244  void r8_updateRoomAnimations();
245  void r8_handleRoomEvent1();
246  void r8_handleRoomEvent2();
247  void r8_handleRoomEvent3();
248  void r8_handleRoomEvent4();
249  void r8_openCloseDoor(bool isOpen);
250  void r8_openCloseCabinetDoor1(bool isOpen);
251  void r8_openCloseCabinetDoor2(bool isOpen);
252 
253  int r9_handleVerbPickUp();
254  int r9_handleVerbUse();
255  void r9_handleVerbTalkTo();
256  int r9_handleVerbPush();
257  int r9_handleVerbGive();
258  bool r9_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
259  void r9_refreshRoomBackground();
260  void r9_initRoomAnimations();
261  void r9_uninitRoomAnimations();
262  void r9_updateRoomAnimations();
263  void r9_giveCoatOrTopHatToMan();
264 
265  int r10_handleVerbPickUp();
266  int r10_handleVerbUse();
267  void r10_handleVerbTalkTo();
268  int r10_handleVerbPush();
269  int r10_handleVerbOpen();
270  int r10_handleVerbGive();
271  bool r10_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
272  void r10_refreshRoomBackground();
273  void r10_handleVerbPickUpCandyBar();
274  void r10_handleVerbPickUpTicket();
275  void r10_handleVerbPickUpGum();
276  void r10_handleVerbGiveWinningTicketToSalesgirl();
277  void r10_buyItem();
278  void r10_handleVerbPickUpJawbreakers();
279  void r10_refreshObject(int value);
280 
281  int r11_handleVerbPickUp();
282  int r11_handleVerbUse();
283  int r11_handleVerbPush();
284  void r11_refreshRoomBackground();
285  void r11_initRoomAnimations();
286  void r11_uninitRoomAnimations();
287  void r11_updateRoomAnimations();
288  void r11_pickUpExtensionCord();
289  void r11_usePlungersWithLampPost();
290  void r11_useExtensionCordWithOutlet();
291  void r11_useSuckCutWithExtensionCord();
292  void r11_useSuckCutWithFountain();
293  void r11_useCar1();
294  void r11_useCar2();
295 
296  int r12_handleVerbPickUp();
297  int r12_handleVerbUse();
298  void r12_handleVerbTalkTo();
299  int r12_handleVerbGive();
300  bool r12_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
301  void r12_refreshRoomBackground();
302  void r12_talkToLawyer();
303  void r12_givePotatoChipToCecil();
304 
305  int r13_handleVerbPickUp();
306  int r13_handleVerbUse();
307  void r13_handleVerbTalkTo();
308  int r13_handleVerbGive();
309  bool r13_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
310  void r13_refreshRoomBackground();
311  void r13_giveTicketToRomeToPepe();
312  void r13_handleDialogSelect183();
313  void r13_handleRoomEvent();
314 
315  int r14_handleVerbPickUp();
316  int r14_handleVerbUse();
317  void r14_refreshRoomBackground();
318 
319  bool r15_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
320 
321  void r16_refreshRoomBackground();
322 
323  int r17_handleVerbUse();
324  void r17_handleVerbTalkTo();
325  bool r17_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
326  void r17_refreshRoomBackground();
327  void r17_handleRoomEvent1();
328  void r17_handleRoomEvent2();
329  void r17_handleRoomEvent3();
330 
331  void r18_refreshRoomBackground();
332  void r18_initRoomAnimations();
333  void r18_uninitRoomAnimations();
334  void r18_updateRoomAnimations();
335 
336  void r19_handleVerbTalkTo();
337  bool r19_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
338  void r19_refreshRoomBackground();
339  void r19_handleRoomEvent();
340 
341  void r20_refreshRoomBackground();
342  void r20_handleRoomEvent();
343 
344  void r22_refreshRoomBackground();
345 
346  int r24_handleVerbUse();
347  void r24_refreshRoomBackground();
348  void r24_handleRoomEvent(int wayneLadderX, int wayneX, int wayneLadderY, int ladderBottomY, int climbCtrMax, int ceilingIndex);
349  void r24_climbLadder(int wayneX, int wayneLadderX, int wayneLadderY, int ladderTopY, int ceilingIndex);
350  void r24_useMazeHole(int holeIndex);
351 
352  int r25_handleVerbUse();
353  void r25_refreshRoomBackground();
354  void r25_updateMazeRoomHole(int mazeRoomNumber);
355 
356  int r28_handleVerbUse();
357  bool r28_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
358  void r28_refreshRoomBackground();
359  void r28_handleRoomEvent1();
360  void r28_handleRoomEvent2();
361 
362  int r29_handleVerbPickUp();
363  int r29_handleVerbUse();
364  void r29_refreshRoomBackground();
365  void r29_handleRoomEvent();
366  void r29_initRoomAnimations();
367  void r29_uninitRoomAnimations();
368  void r29_updateRoomAnimations();
369 
370  int r30_handleVerbPickUp();
371  int r30_handleVerbUse();
372  bool r30_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
373  void r30_refreshRoomBackground();
374  void r30_handleRoomEvent1();
375  void r30_handleRoomEvent2();
376  void r30_runLudwigCutscene();
377  void r30_talkToCecil();
378 
379  int r31_handleVerbUse();
380  bool r31_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
381  void r31_refreshRoomBackground();
382  void r31_handleRoomEvent1();
383  void r31_handleRoomEvent2();
384  void r31_handleRoomEvent3();
385  void r31_handleRoomEvent4();
386  void r31_handleRoomEvent5();
387  void r31_correctAnswerSelected();
388  void r31_wrongAnswerSelected();
389  void r31_useBuzzer();
390  void r31_playTalkAnim(int index);
391  void r31_drawMBuzzer();
392  void r31_drawDBuzzer();
393  void r31_displayCategories();
394  void r31_runBabeoff();
395  void r31_drawCurrentPlayerScore();
396  void r31_buildQuestionDialogChoices(int categoryIndex, int questionIndex);
397 
398  int r32_handleVerbPickUp();
399  int r32_handleVerbUse();
400  void r32_handleVerbTalkTo();
401  int r32_handleVerbOpen();
402  bool r32_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
403  void r32_refreshRoomBackground();
404  void r32_handleRoomEvent();
405  void r32_initRoomAnimations();
406  void r32_uninitRoomAnimations();
407  void r32_updateRoomAnimations();
408  void r32_pickUpMemo();
409 
410  void r33_refreshRoomBackground();
411 
412  int r34_handleVerbPickUp();
413  int r34_handleVerbUse();
414  void r34_handleVerbTalkTo();
415  int r34_handleVerbOpen();
416  int r34_handleVerbClose();
417  bool r34_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
418  void r34_refreshRoomBackground();
419  void r34_initRoomAnimations();
420  void r34_uninitRoomAnimations();
421  void r34_updateRoomAnimations();
422 
423  int r35_handleVerbUse();
424  void r35_handleVerbTalkTo();
425  bool r35_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
426  void r35_refreshRoomBackground();
427  void r35_useSetOfKeysWithJailCells();
428  void r35_talkToCassandra();
429 
430  int r36_handleVerbPickUp();
431  int r36_handleVerbUse();
432  void r36_refreshRoomBackground();
433  void r36_handleRoomEvent();
434  void r36_initRoomAnimations();
435  void r36_uninitRoomAnimations();
436  void r36_updateRoomAnimations();
437 
438  int r37_handleVerbPickUp();
439  int r37_handleVerbUse();
440  int r37_handleVerbPush();
441  int r37_handleVerbPull();
442  void r37_refreshRoomBackground();
443  void r37_climbEnterLadderDown();
444  void r37_climbExitLadderUp();
445  void r37_climbLadderDown();
446  void r37_climbLadderUp();
447  void r37_pushPullSafeLock(bool isPull);
448  void r37_pullHandle();
449 
450  int r38_handleVerbUse();
451  int r38_handleVerbPull();
452  void r38_refreshRoomBackground();
453  void r38_initRoomAnimations();
454  void r38_uninitRoomAnimations();
455  void r38_updateRoomAnimations();
456  void r38_useCassandra();
457  void r38_pullRag();
458 
459  int r39_handleVerbUse();
460  int r39_handleVerbOpen();
461  void r39_refreshRoomBackground();
462  void r39_useSquirtGunWithHinges();
463  void r39_useExit39();
464  void r39_useExit();
465 
466  void menuDrawSoundEnabled();
467  void menuDrawMusicEnabled();
468  void closeSaveLoadMenu();
469  void toggleSoundEnabled();
470  void toggleMusicEnabled();
471  void menuSaveLoadMenu(bool isLoad);
472  void synchronize(Common::Serializer &s);
473  bool saveSavegame(int slot, const Common::String *desc);
474  bool loadSavegame(int slot, bool rstSave = false);
475  void handleGameMenu();
476  void menuQuitGame();
477  void menuExit();
478  void closeQuitMenu();
479 };
480 
481 } // End of namespace WaynesWorld
482 
483 #endif // WAYNESWORLD_GAMELOGIC_H
Definition: str.h:59
Definition: graphics.h:30
Definition: gamelogic.h:30
Definition: detection.h:25
Definition: waynesworld.h:112
Definition: serializer.h:79