aboutsummaryrefslogtreecommitdiff
path: root/engines/gnap/scenes/arcade.h
blob: 9c8ddd9913f922a93d57849342cc5bcd514b1179 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 */

#ifndef GNAP_ARCADE_H
#define GNAP_ARCADE_H

#include "gnap/debugger.h"

namespace Gnap {

class GnapEngine;
class CutScene;

struct Scene49Obstacle {
	int _currSequenceId;
	int _closerSequenceId;
	int _passedSequenceId;
	int _splashSequenceId;
	int _collisionSequenceId;
	int _prevId;
	int _currId;
	int _laneNum;
};

struct ObstacleDef {
	int _sequenceId;
	int _ticks;
};

class Scene49: public Scene {
public:
	Scene49(GnapEngine *vm);
	~Scene49() {}

	virtual int init();
	virtual void updateHotspots();
	virtual void run();
	virtual void updateAnimations();
	virtual void updateAnimationsCb() {};

private:
	int _scoreBarPos;
	int _scoreLevel;
	bool _scoreBarFlash;
	int _obstacleIndex;
	Scene49Obstacle _obstacles[5];
	int _truckSequenceId;
	int _truckId;
	int _truckLaneNum;

	void checkObstacles();
	void updateObstacle(int id);
	void increaseScore(int amount);
	void decreaseScore(int amount);
	void refreshScoreBar();
	void clearObstacle(int index);
};

/*****************************************************************************/

class Scene50: public Scene {
public:
	Scene50(GnapEngine *vm);
	~Scene50() {}

	virtual int init();
	virtual void updateHotspots();
	virtual void run();
	virtual void updateAnimations();
	virtual void updateAnimationsCb() {};

private:
	bool _fightDone;
	int _timesPlayed;
	int _timesPlayedModifier;
	int _attackCounter;
	int _roundNum;
	int _timeRemaining;
	int _leftTongueRoundsWon;
	int _rightTongueRoundsWon;
	int _leftTongueEnergyBarPos;
	int _rightTongueEnergyBarPos;
	int _leftTongueSequenceId;
	int _leftTongueId;
	int _leftTongueNextSequenceId;
	int _leftTongueNextId;
	int _leftTongueNextIdCtr;
	int _rightTongueSequenceId;
	int _rightTongueId;
	int _rightTongueNextSequenceId;
	int _rightTongueNextId;
	int _rightTongueNextIdCtr;
	int _leftTongueEnergy;
	int _rightTongueEnergy;

	bool tongueWinsRound(int tongueNum);
	void playWinAnim(int tongueNum, bool fightOver);
	void delayTicks();
	void initRound();
	bool updateCountdown();
	void drawCountdown(int value);
	void playTonguesIdle();
	void playRoundAnim(int roundNum);
	bool updateEnergyBars(int newLeftBarPos, int newRightBarPos);
	void waitForAnim(int animationIndex);
	int checkInput();
	int getRightTongueAction();
	int getRightTongueActionTicks();
	int getLeftTongueNextId();
	int getRightTongueNextId();
	void playWinBadgeAnim(int tongueNum);
};

/*****************************************************************************/

struct Scene51Item {
	int _currSequenceId;
	int _droppedSequenceId;
	int _x, _y;
	int _collisionX;
	bool _canCatch;
	bool _isCollision;
	int _x2;
	int _id;
};

class Scene51: public Scene {
public:
	Scene51(GnapEngine *vm);
	~Scene51() {}

	virtual int init();
	virtual void updateHotspots();
	virtual void run();
	virtual void updateAnimations() {};
	virtual void updateAnimationsCb() {};

private:
	bool _dropLoseCash;

	int _cashAmount;
	int _digits[4];
	int _digitSequenceIds[4];
	int _guySequenceId;
	int _guyNextSequenceId;
	int _itemsCaughtCtr;
	int _dropSpeedTicks;
	int _nextDropItemKind;
	int _itemInsertX;
	int _itemInsertDirection;
	int _platypusSequenceId;
	int _platypusNextSequenceId;
	int _platypusJumpSequenceId;
	int _itemsCtr;
	int _itemsCtr1;
	int _itemsCtr2;

	Scene51Item _items[6];

	void clearItem(Scene51Item *item);
	void dropNextItem();
	void updateItemAnimations();
	int checkCollision(int sequenceId);
	void updateItemAnimation(Scene51Item *item, int index);
	void removeCollidedItems();
	int itemIsCaught(Scene51Item *item);
	bool isJumpingRight(int sequenceId);
	bool isJumpingLeft(int sequenceId);
	bool isJumping(int sequenceId);
	void waitForAnim(int animationIndex);
	int getPosRight(int sequenceId);
	int getPosLeft(int sequenceId);
	void playIntroAnim();
	void updateGuyAnimation();
	int incCashAmount(int sequenceId);
	void winMinigame();
	void playCashAppearAnim();
	void updateCash(int amount);
	void drawDigit(int digit, int position);
	void initCashDisplay();
};

/*****************************************************************************/

class Scene52: public Scene {
public:
	Scene52(GnapEngine *vm);
	~Scene52() {}

	virtual int init();
	virtual void updateHotspots();
	virtual void run();
	virtual void updateAnimations() {};
	virtual void updateAnimationsCb() {};

private:
	int _liveAlienRows;
	int _gameScore;
	bool _soundToggle;
	int _arcadeScreenBottom;
	int _shipsLeft;
	int _shieldSpriteIds[3];
	int _shieldPosX[3];
	int _shipPosX;
	int _shipCannonPosX, _shipCannonPosY;
	bool _shipCannonFiring;
	bool _shipCannonFired;
	int _shipCannonWidth, _shipCannonHeight;
	int _shipCannonTopY;
	int _shipMidX, _shipMidY;
	bool _shipFlag;
	bool _aliensInitialized;
	int _alienSpeed, _alienDirection;
	int _alienWidth, _alienHeight;
	int _alienLeftX, _alienTopY;
	int _alienRowDownCtr;
	int _alienRowKind[8];
	int _alienRowAnims[8];
	int _alienRowIds[8];
	int _alienRowXOfs[8];
	int _alienCannonFired[3];
	int _alienCannonPosX[3];
	int _alienCannonPosY[3];
	int _alienCannonSequenceIds[3];
	int _alienCannonIds[3];
	bool _alienWave, _alienSingle;
	int _alienCounter;
	bool _bottomAlienFlag;
	int _aliensCount;
	int _items[8][5];
	int _nextUfoSequenceId, _ufoSequenceId;

	void update();
	void initShipCannon(int bottomY);
	void initAlienCannons();
	void fireShipCannon(int posX);
	void fireAlienCannon();
	int getFreeShipCannon();
	int getFreeAlienCannon();
	void updateShipCannon();
	void updateAlienCannons();
	void initAliens();
	void initAlienRowKind(int rowNum, int alienKind);
	void insertAlienRow(int rowNum);
	void insertAlienRowAliens(int rowNum);
	void updateAlienRow(int rowNum);
	void moveDownAlienRow();
	int updateHitAlien();
	int getHitAlienNum(int rowNum);
	int alienCannonHitShip(int cannonNum);
	int alienCannonHitShield(int cannonNum);
	bool shipCannonHitShield(int cannonNum);
	bool shipCannonHitAlien();
	void shipExplode();
	bool checkAlienRow(int rowNum);
	void updateAlienRowXOfs();
	void initAlienSize();
	void playSound();
	void updateAliens();
	void updateAlien(int rowNum);
	void loseShip();
	void initShields();
	void initAnims();
	void drawScore(int score);
};

} // End of namespace Gnap

#endif // GNAP_ARCADE_H