ScummVM API documentation
arcade.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 GNAP_ARCADE_H
23 #define GNAP_ARCADE_H
24 
25 #include "gnap/debugger.h"
26 
27 namespace Gnap {
28 
29 class GnapEngine;
30 class CutScene;
31 
33  int _currSequenceId;
34  int _closerSequenceId;
35  int _passedSequenceId;
36  int _splashSequenceId;
37  int _collisionSequenceId;
38  int _prevId;
39  int _currId;
40  int _laneNum;
41 };
42 
43 struct ObstacleDef {
44  int _sequenceId;
45  int _ticks;
46 };
47 
48 class Scene49: public Scene {
49 public:
50  Scene49(GnapEngine *vm);
51  ~Scene49() override {}
52 
53  int init() override;
54  void updateHotspots() override;
55  void run() override;
56  void updateAnimations() override;
57  void updateAnimationsCb() override {};
58 
59 private:
60  int _scoreBarPos;
61  int _scoreLevel;
62  bool _scoreBarFlash;
63  int _obstacleIndex;
64  Scene49Obstacle _obstacles[5];
65  int _truckSequenceId;
66  int _truckId;
67  int _truckLaneNum;
68 
69  void checkObstacles();
70  void updateObstacle(int id);
71  void increaseScore(int amount);
72  void decreaseScore(int amount);
73  void refreshScoreBar();
74  void clearObstacle(int index);
75 };
76 
77 /*****************************************************************************/
78 
79 class Scene50: public Scene {
80 public:
81  Scene50(GnapEngine *vm);
82  ~Scene50() override {}
83 
84  int init() override;
85  void updateHotspots() override;
86  void run() override;
87  void updateAnimations() override;
88  void updateAnimationsCb() override {};
89 
90 private:
91  bool _fightDone;
92  int _timesPlayed;
93  int _timesPlayedModifier;
94  int _attackCounter;
95  int _roundNum;
96  int _timeRemaining;
97  int _leftTongueRoundsWon;
98  int _rightTongueRoundsWon;
99  int _leftTongueEnergyBarPos;
100  int _rightTongueEnergyBarPos;
101  int _leftTongueSequenceId;
102  int _leftTongueId;
103  int _leftTongueNextSequenceId;
104  int _leftTongueNextId;
105  int _leftTongueNextIdCtr;
106  int _rightTongueSequenceId;
107  int _rightTongueId;
108  int _rightTongueNextSequenceId;
109  int _rightTongueNextId;
110  int _rightTongueNextIdCtr;
111  int _leftTongueEnergy;
112  int _rightTongueEnergy;
113 
114  bool tongueWinsRound(int tongueNum);
115  void playWinAnim(int tongueNum, bool fightOver);
116  void delayTicks();
117  void initRound();
118  bool updateCountdown();
119  void drawCountdown(int value);
120  void playTonguesIdle();
121  void playRoundAnim(int roundNum);
122  bool updateEnergyBars(int newLeftBarPos, int newRightBarPos);
123  void waitForAnim(int animationIndex);
124  int checkInput();
125  int getRightTongueAction();
126  int getRightTongueActionTicks();
127  int getLeftTongueNextId();
128  int getRightTongueNextId();
129  void playWinBadgeAnim(int tongueNum);
130 };
131 
132 /*****************************************************************************/
133 
134 struct Scene51Item {
135  int _currSequenceId;
136  int _droppedSequenceId;
137  int _x, _y;
138  int _collisionX;
139  bool _canCatch;
140  bool _isCollision;
141  int _x2;
142  int _id;
143 };
144 
145 class Scene51: public Scene {
146 public:
147  Scene51(GnapEngine *vm);
148  ~Scene51() override {}
149 
150  int init() override;
151  void updateHotspots() override;
152  void run() override;
153  void updateAnimations() override {};
154  void updateAnimationsCb() override {};
155 
156 private:
157  bool _dropLoseCash;
158 
159  int _cashAmount;
160  int _digits[4];
161  int _digitSequenceIds[4];
162  int _guySequenceId;
163  int _guyNextSequenceId;
164  int _itemsCaughtCtr;
165  int _dropSpeedTicks;
166  int _nextDropItemKind;
167  int _itemInsertX;
168  int _itemInsertDirection;
169  int _platypusSequenceId;
170  int _platypusNextSequenceId;
171  int _platypusJumpSequenceId;
172  int _itemsCtr;
173  int _itemsCtr1;
174  int _itemsCtr2;
175 
176  Scene51Item _items[6];
177 
178  void clearItem(Scene51Item *item);
179  void dropNextItem();
180  void updateItemAnimations();
181  int checkCollision(int sequenceId);
182  void updateItemAnimation(Scene51Item *item, int index);
183  void removeCollidedItems();
184  int itemIsCaught(Scene51Item *item);
185  bool isJumpingRight(int sequenceId);
186  bool isJumpingLeft(int sequenceId);
187  bool isJumping(int sequenceId);
188  void waitForAnim(int animationIndex);
189  int getPosRight(int sequenceId);
190  int getPosLeft(int sequenceId);
191  void playIntroAnim();
192  void updateGuyAnimation();
193  int incCashAmount(int sequenceId);
194  void winMinigame();
195  void playCashAppearAnim();
196  void updateCash(int amount);
197  void drawDigit(int digit, int position);
198  void initCashDisplay();
199 };
200 
201 /*****************************************************************************/
202 
203 class Scene52: public Scene {
204 public:
205  Scene52(GnapEngine *vm);
206  ~Scene52() override {}
207 
208  int init() override;
209  void updateHotspots() override;
210  void run() override;
211  void updateAnimations() override {};
212  void updateAnimationsCb() override {};
213 
214 private:
215  int _liveAlienRows;
216  int _gameScore;
217  bool _soundToggle;
218  int _arcadeScreenBottom;
219  int _shipsLeft;
220  int _shieldSpriteIds[3];
221  int _shieldPosX[3];
222  int _shipPosX;
223  int _shipCannonPosX, _shipCannonPosY;
224  bool _shipCannonFiring;
225  bool _shipCannonFired;
226  int _shipCannonWidth, _shipCannonHeight;
227  int _shipCannonTopY;
228  int _shipMidX, _shipMidY;
229  bool _shipFlag;
230  bool _aliensInitialized;
231  int _alienSpeed, _alienDirection;
232  int _alienWidth, _alienHeight;
233  int _alienLeftX, _alienTopY;
234  int _alienRowDownCtr;
235  int _alienRowKind[8];
236  int _alienRowAnims[8];
237  int _alienRowIds[8];
238  int _alienRowXOfs[8];
239  int _alienCannonFired[3];
240  int _alienCannonPosX[3];
241  int _alienCannonPosY[3];
242  int _alienCannonSequenceIds[3];
243  int _alienCannonIds[3];
244  bool _alienWave, _alienSingle;
245  int _alienCounter;
246  bool _bottomAlienFlag;
247  int _aliensCount;
248  int _items[8][5];
249  int _nextUfoSequenceId, _ufoSequenceId;
250 
251  void update();
252  void initShipCannon(int bottomY);
253  void initAlienCannons();
254  void fireShipCannon(int posX);
255  void fireAlienCannon();
256  int getFreeShipCannon();
257  int getFreeAlienCannon();
258  void updateShipCannon();
259  void updateAlienCannons();
260  void initAliens();
261  void initAlienRowKind(int rowNum, int alienKind);
262  void insertAlienRow(int rowNum);
263  void insertAlienRowAliens(int rowNum);
264  void updateAlienRow(int rowNum);
265  void moveDownAlienRow();
266  int updateHitAlien();
267  int getHitAlienNum(int rowNum);
268  int alienCannonHitShip(int cannonNum);
269  int alienCannonHitShield(int cannonNum);
270  bool shipCannonHitShield(int cannonNum);
271  bool shipCannonHitAlien();
272  void shipExplode();
273  bool checkAlienRow(int rowNum);
274  void updateAlienRowXOfs();
275  void initAlienSize();
276  void playSound();
277  void updateAliens();
278  void updateAlien(int rowNum);
279  void loseShip();
280  void initShields();
281  void initAnims();
282  void drawScore(int score);
283 };
284 
285 } // End of namespace Gnap
286 
287 #endif // GNAP_ARCADE_H
Definition: arcade.h:134
Definition: arcade.h:32
Definition: arcade.h:203
Definition: arcade.h:145
Definition: arcade.h:48
Definition: character.h:25
Definition: gnap.h:222
Definition: arcade.h:43
Definition: arcade.h:79
Definition: scenecore.h:31