aboutsummaryrefslogtreecommitdiff
path: root/engines/gnap
diff options
context:
space:
mode:
authorStrangerke2016-04-28 07:26:11 +0200
committerEugene Sandulenko2016-05-10 12:14:47 +0200
commit8a91335bfa4a23ab0cbc5427ab3a407bcbe5f2ef (patch)
treef709276a70952b214456c51f7456bcbd37227c4c /engines/gnap
parent4120f8795e1aad9180a5207a9e8a068543ee84df (diff)
downloadscummvm-rg350-8a91335bfa4a23ab0cbc5427ab3a407bcbe5f2ef.tar.gz
scummvm-rg350-8a91335bfa4a23ab0cbc5427ab3a407bcbe5f2ef.tar.bz2
scummvm-rg350-8a91335bfa4a23ab0cbc5427ab3a407bcbe5f2ef.zip
GNAP: renaming and grouping of scenes in group Arcade and Group 5
Diffstat (limited to 'engines/gnap')
-rw-r--r--engines/gnap/module.mk6
-rw-r--r--engines/gnap/scenes/arcade.cpp2730
-rw-r--r--engines/gnap/scenes/arcade.h290
-rw-r--r--engines/gnap/scenes/group4.cpp497
-rw-r--r--engines/gnap/scenes/group4.h45
-rw-r--r--engines/gnap/scenes/group5.cpp (renamed from engines/gnap/scenes/scene53.cpp)132
-rw-r--r--engines/gnap/scenes/group5.h (renamed from engines/gnap/scenes/scene53.h)14
-rw-r--r--engines/gnap/scenes/scene50.cpp498
-rw-r--r--engines/gnap/scenes/scene50.h87
-rw-r--r--engines/gnap/scenes/scene51.cpp897
-rw-r--r--engines/gnap/scenes/scene51.h101
-rw-r--r--engines/gnap/scenes/scene52.cpp894
-rw-r--r--engines/gnap/scenes/scene52.h118
-rw-r--r--engines/gnap/scenes/scenecore.cpp8
14 files changed, 3098 insertions, 3219 deletions
diff --git a/engines/gnap/module.mk b/engines/gnap/module.mk
index cdbda4a1da..79849cf293 100644
--- a/engines/gnap/module.mk
+++ b/engines/gnap/module.mk
@@ -10,17 +10,15 @@ MODULE_OBJS := \
menu.o \
resource.o \
sound.o \
+ scenes/arcade.o \
scenes/groupcs.o \
scenes/group0.o \
scenes/group1.o \
scenes/group2.o \
scenes/group3.o \
scenes/group4.o \
+ scenes/group5.o \
scenes/intro.o \
- scenes/scene50.o \
- scenes/scene51.o \
- scenes/scene52.o \
- scenes/scene53.o \
scenes/scenecore.o
# This module can be built as a plugin
diff --git a/engines/gnap/scenes/arcade.cpp b/engines/gnap/scenes/arcade.cpp
new file mode 100644
index 0000000000..3b1b1b0807
--- /dev/null
+++ b/engines/gnap/scenes/arcade.cpp
@@ -0,0 +1,2730 @@
+/* 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.
+ *
+ */
+
+#include "gnap/gnap.h"
+#include "gnap/gamesys.h"
+#include "gnap/resource.h"
+#include "gnap/scenes/arcade.h"
+
+namespace Gnap {
+
+static const ObstacleDef kObstacleDefs[] = {
+ {0xB4, 15}, {0xCB, 14}, {0xCD, 13}, {0xCF, 15}, {0xBA, 14},
+ {0xCD, 13}, {0xCF, 12}, {0xCB, 15}, {0xBD, 13}, {0xCF, 12},
+ {0xCD, 11}, {0xCB, 15}, {0xB7, 12}, {0xCD, 11}, {0xCB, 10},
+ {0xCF, 15}, {0xCF, 14}, {0xBD, 13}, {0xCF, 12}, {0xCD, 11},
+ {0xCB, 15}, {0xCB, 13}, {0xB4, 12}, {0xCB, 11}, {0xCD, 10},
+ {0xCF, 15}, {0xCD, 12}, {0xBA, 12}, {0xCD, 12}, {0xCF, 12},
+ {0xCB, 15}, {0xCB, 9}, {0xCD, 9}, {0xCF, 9}, {0xCD, 9},
+ {0xCB, 9}, {0xCD, 9}, {0xCF, 5}, {0xBD, 13}, {0xCF, 8},
+ {0xCB, 8}, {0xCD, 15}, {0xB4, 1}, {0xBD, 7}, {0xCF, 7},
+ {0xCD, 7}, {0xCB, 7}, {0xCD, 7}, {0xCF, 15}, {0xCF, 15}
+};
+
+Scene49::Scene49(GnapEngine *vm) : Scene(vm) {
+ _scoreBarFlash = false;
+ _scoreBarPos = -1;
+ _scoreLevel = -1;
+ _obstacleIndex = -1;
+ _truckSequenceId = -1;
+ _truckId = -1;
+ _truckLaneNum = -1;
+
+ for (int i = 0; i < 5; i++) {
+ _obstacles[i]._currSequenceId = -1;
+ _obstacles[i]._closerSequenceId = -1;
+ _obstacles[i]._passedSequenceId = -1;
+ _obstacles[i]._splashSequenceId = -1;
+ _obstacles[i]._collisionSequenceId = -1;
+ _obstacles[i]._prevId = -1;
+ _obstacles[i]._currId = -1;
+ _obstacles[i]._laneNum = -1;
+ }
+}
+
+int Scene49::init() {
+ GameSys gameSys = *_vm->_gameSys;
+
+ gameSys.setAnimation(0, 0, 0);
+ gameSys.setAnimation(0, 0, 1);
+ for (int i = 0; i < 5; ++i)
+ gameSys.setAnimation(0, 0, i + 2);
+ _vm->_timers[2] = 0;
+ _vm->_timers[0] = 0;
+ _vm->_timers[1] = 0;
+ _vm->clearKeyStatus1(28);
+ _vm->clearKeyStatus1(54);
+ _vm->clearKeyStatus1(52);
+ return 0xD5;
+}
+
+void Scene49::updateHotspots() {
+ _vm->_hotspotsCount = 0;
+}
+
+void Scene49::checkObstacles() {
+ if (_vm->_timers[2] == 0) {
+ if (_vm->_timers[3] == 0) {
+ for (int i = 0; i < 5; ++i)
+ clearObstacle(i);
+ }
+
+ for (int j = 0; j < 5; ++j) {
+ if (_obstacles[j]._currSequenceId == 0) {
+ _vm->_timers[3] = 35;
+ _obstacles[j]._currSequenceId = kObstacleDefs[_obstacleIndex]._sequenceId;
+ switch (_obstacles[j]._currSequenceId) {
+ case 0xB4:
+ _obstacles[j]._laneNum = 1;
+ _obstacles[j]._closerSequenceId = 180;
+ _obstacles[j]._passedSequenceId = 181;
+ _obstacles[j]._splashSequenceId = 182;
+ _obstacles[j]._collisionSequenceId = 192;
+ break;
+ case 0xB7:
+ _obstacles[j]._laneNum = 2;
+ _obstacles[j]._closerSequenceId = 183;
+ _obstacles[j]._passedSequenceId = 184;
+ _obstacles[j]._splashSequenceId = 185;
+ _obstacles[j]._collisionSequenceId = 193;
+ break;
+ case 0xBD:
+ _obstacles[j]._laneNum = 3;
+ _obstacles[j]._closerSequenceId = 189;
+ _obstacles[j]._passedSequenceId = 190;
+ _obstacles[j]._splashSequenceId = 191;
+ _obstacles[j]._collisionSequenceId = 195;
+ break;
+ case 0xBA:
+ _obstacles[j]._laneNum = 2;
+ _obstacles[j]._closerSequenceId = 186;
+ _obstacles[j]._passedSequenceId = 187;
+ _obstacles[j]._splashSequenceId = 188;
+ _obstacles[j]._collisionSequenceId = 194;
+ break;
+ case 0xCB:
+ _obstacles[j]._laneNum = 1;
+ _obstacles[j]._closerSequenceId = 203;
+ _obstacles[j]._passedSequenceId = 204;
+ _obstacles[j]._splashSequenceId = 0;
+ _obstacles[j]._collisionSequenceId = 209;
+ break;
+ case 0xCD:
+ _obstacles[j]._laneNum = 2;
+ _obstacles[j]._closerSequenceId = 205;
+ _obstacles[j]._passedSequenceId = 206;
+ _obstacles[j]._splashSequenceId = 0;
+ _obstacles[j]._collisionSequenceId = 210;
+ break;
+ case 0xCF:
+ _obstacles[j]._laneNum = 3;
+ _obstacles[j]._closerSequenceId = 207;
+ _obstacles[j]._passedSequenceId = 208;
+ _obstacles[j]._splashSequenceId = 0;
+ _obstacles[j]._collisionSequenceId = 211;
+ break;
+ }
+ _obstacles[j]._prevId = _truckId;
+ _obstacles[j]._currId = _obstacles[j]._prevId;
+ _vm->_gameSys->setAnimation(_obstacles[j]._currSequenceId, _obstacles[j]._currId, j + 2);
+ _vm->_gameSys->insertSequence(_obstacles[j]._currSequenceId, _obstacles[j]._currId, 0, 0, kSeqNone, 0, 0, -50);
+ _vm->_timers[2] = kObstacleDefs[_obstacleIndex]._ticks;
+ ++_obstacleIndex;
+ if (_obstacleIndex == 50)
+ _obstacleIndex = 0;
+ break;
+ }
+ }
+ }
+}
+
+void Scene49::updateObstacle(int id) {
+ GameSys gameSys = *_vm->_gameSys;
+ Scene49Obstacle &obstacle = _obstacles[id];
+
+ obstacle._currId = obstacle._prevId;
+
+ switch (obstacle._laneNum) {
+ case 1:
+ obstacle._prevId = _truckId + 1;
+ break;
+ case 2:
+ if (_truckLaneNum != 2 && _truckLaneNum != 3)
+ obstacle._prevId = _truckId - 1;
+ else
+ obstacle._prevId = _truckId + 1;
+ break;
+ case 3:
+ if (_truckLaneNum != 1 && _truckLaneNum != 2)
+ obstacle._prevId = _truckId;
+ else
+ obstacle._prevId = _truckId - 1;
+ break;
+ }
+
+ if (obstacle._currSequenceId == obstacle._closerSequenceId) {
+ if (_truckLaneNum == obstacle._laneNum) {
+ if (obstacle._splashSequenceId) {
+ gameSys.setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2);
+ gameSys.insertSequence(obstacle._collisionSequenceId, obstacle._prevId,
+ obstacle._currSequenceId, obstacle._currId,
+ kSeqSyncWait, 0, 0, -50);
+ obstacle._currSequenceId = obstacle._collisionSequenceId;
+ _vm->playSound(224, false);
+ increaseScore(30);
+ } else if ((obstacle._laneNum == 1 && _truckSequenceId == 0xB0) ||
+ (obstacle._laneNum == 2 && (_truckSequenceId == 0xB1 || _truckSequenceId == 0xB2)) ||
+ (obstacle._laneNum == 3 && _truckSequenceId == 0xB3)) {
+ gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2);
+ gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId,
+ obstacle._currSequenceId, obstacle._currId,
+ kSeqSyncWait, 0, 0, -50);
+ obstacle._currSequenceId = obstacle._passedSequenceId;
+ } else {
+ gameSys.setAnimation(obstacle._collisionSequenceId, 256, 0);
+ gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2);
+ gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId,
+ obstacle._currSequenceId, obstacle._currId,
+ kSeqSyncWait, 0, 0, -50);
+ gameSys.insertSequence(obstacle._collisionSequenceId, 256,
+ _truckSequenceId, _truckId,
+ kSeqSyncExists, 0, 0, -50);
+ _truckSequenceId = obstacle._collisionSequenceId;
+ _truckId = 256;
+ obstacle._currSequenceId = obstacle._passedSequenceId;
+ _vm->playSound(225, false);
+ decreaseScore(30);
+ }
+ } else {
+ gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2);
+ gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId,
+ obstacle._currSequenceId, obstacle._currId,
+ kSeqSyncWait, 0, 0, -50);
+ obstacle._currSequenceId = obstacle._passedSequenceId;
+ }
+ } else if (obstacle._currSequenceId == obstacle._passedSequenceId) {
+ if (_truckLaneNum == obstacle._laneNum) {
+ if (obstacle._splashSequenceId) {
+ gameSys.setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2);
+ gameSys.insertSequence(obstacle._collisionSequenceId, obstacle._prevId,
+ obstacle._currSequenceId, obstacle._currId,
+ kSeqSyncWait, 0, 0, -50);
+ obstacle._currSequenceId = obstacle._collisionSequenceId;
+ _vm->playSound(224, false);
+ increaseScore(30);
+ }
+ } else if (obstacle._splashSequenceId) {
+ gameSys.setAnimation(obstacle._splashSequenceId, obstacle._prevId, id + 2);
+ gameSys.insertSequence(obstacle._splashSequenceId, obstacle._prevId,
+ obstacle._currSequenceId, obstacle._currId,
+ kSeqSyncWait, 0, 0, -50);
+ obstacle._currSequenceId = obstacle._splashSequenceId;
+ }
+ } else {
+ gameSys.setAnimation(0, 0, id + 2);
+ clearObstacle(id);
+ }
+}
+
+void Scene49::increaseScore(int amount) {
+ if (_scoreBarPos + amount <= 556) {
+ _scoreBarPos += amount;
+ _vm->_gameSys->fillSurface(0, _scoreBarPos, 508, amount, 22, 255, 0, 0);
+ }
+ _scoreLevel = _scoreBarPos + amount >= 556;
+}
+
+void Scene49::decreaseScore(int amount) {
+ if (_scoreBarPos >= 226 && _scoreLevel == 0) {
+ if (_scoreBarFlash)
+ refreshScoreBar();
+ _vm->_gameSys->fillSurface(0, _scoreBarPos, 508, amount, 22, 89, 0, 5);
+ _scoreBarPos -= amount;
+ _scoreLevel = 0;
+ }
+}
+
+void Scene49::refreshScoreBar() {
+ if (_scoreBarFlash)
+ _vm->_gameSys->fillSurface(0, 226, 508, 330, 22, 255, 0, 0);
+ else
+ _vm->_gameSys->fillSurface(0, 226, 508, 330, 22, 89, 0, 5);
+ _scoreBarFlash = !_scoreBarFlash;
+}
+
+void Scene49::clearObstacle(int index) {
+ _obstacles[index]._currSequenceId = 0;
+ _obstacles[index]._closerSequenceId = 0;
+ _obstacles[index]._passedSequenceId = 0;
+ _obstacles[index]._splashSequenceId = 0;
+ _obstacles[index]._collisionSequenceId = 0;
+ _obstacles[index]._prevId = 0;
+ _obstacles[index]._currId = 0;
+ _obstacles[index]._laneNum = 0;
+}
+
+void Scene49::run() {
+ GameSys gameSys = *_vm->_gameSys;
+
+ bool animToggle6 = false;
+ bool animToggle5 = false;
+ bool animToggle4 = false;
+ bool animToggle3 = false;
+ bool streetAnimToggle = false;
+ bool bgAnimToggle = false;
+
+ _vm->playSound(0xE2, true);
+ _vm->setSoundVolume(0xE2, 75);
+
+ _vm->hideCursor();
+ _vm->setGrabCursorSprite(-1);
+
+ _scoreBarPos = 196;
+ _scoreLevel = 0;
+ _scoreBarFlash = false;
+
+ switch (_vm->getRandom(3)) {
+ case 0:
+ _truckSequenceId = 0xAD;
+ _truckLaneNum = 1;
+ break;
+ case 1:
+ _truckSequenceId = 0xAE;
+ _truckLaneNum = 2;
+ break;
+ case 2:
+ _truckSequenceId = 0xAF;
+ _truckLaneNum = 3;
+ break;
+ }
+
+ int bgWidth1 = gameSys.getSpriteWidthById(0x5E);
+ int bgX1 = 600;
+
+ int bgWidth2 = gameSys.getSpriteWidthById(0x5F);
+ int bgX2 = 400;
+
+ int bgWidth3 = gameSys.getSpriteWidthById(4);
+ int bgX3 = 700;
+
+ int bgWidth4 = gameSys.getSpriteWidthById(5);
+ int bgX4 = 500;
+
+ int bgWidth5 = gameSys.getSpriteWidthById(6);
+ int bgX5 = 300;
+
+ int bgWidth6 = gameSys.getSpriteWidthById(7);
+ int bgX6 = 100;
+
+ gameSys.setAnimation(0xC8, 251, 1);
+ gameSys.setAnimation(_truckSequenceId, 256, 0);
+ gameSys.insertSequence(0xC9, 256, 0, 0, kSeqNone, 0, 600, 85);
+ gameSys.insertSequence(0xCA, 257, 0, 0, kSeqNone, 0, 400, 100);
+ gameSys.insertSequence(0xC4, 256, 0, 0, kSeqNone, 0, 700, 140);
+ gameSys.insertSequence(0xC5, 257, 0, 0, kSeqNone, 0, 500, 160);
+ gameSys.insertSequence(0xC6, 258, 0, 0, kSeqNone, 0, 300, 140);
+ gameSys.insertSequence(0xC7, 259, 0, 0, kSeqNone, 0, 100, 140);
+ gameSys.insertSequence(0xC8, 251, 0, 0, kSeqNone, 0, 0, -50);
+ gameSys.insertSequence(_truckSequenceId, 256, 0, 0, kSeqNone, 0, 0, -50);
+
+ _vm->_timers[0] = 2;
+
+ for (int i = 0; i < 5; ++i)
+ clearObstacle(i);
+
+ _obstacleIndex = 0;
+
+ _vm->_timers[2] = _vm->getRandom(20) + 10;
+
+ _truckId = 256;
+ _vm->_timers[3] = 35;
+
+ while (!_vm->_sceneDone) {
+ if (_vm->_timers[0] == 0) {
+ // Update background animations (clouds etc.)
+ --bgX1;
+ bgX2 -= 2;
+ bgX3 -= 5;
+ --bgX4;
+ --bgX5;
+ --bgX6;
+ if (bgX1 <= -bgWidth1)
+ bgX1 = 799;
+ if (bgX2 <= -bgWidth2)
+ bgX2 = 799;
+ if (bgX3 <= -bgWidth3)
+ bgX3 = 799;
+ if (bgX4 <= -bgWidth4)
+ bgX4 = 799;
+ if (bgX5 <= -bgWidth5)
+ bgX5 = 799;
+ if (bgX6 <= -bgWidth6)
+ bgX6 = 799;
+ bgAnimToggle = !bgAnimToggle;
+ gameSys.insertSequence(0xC9, (bgAnimToggle ? 1 : 0) + 256, 0xC9, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX1, 85);
+ gameSys.insertSequence(0xCA, (bgAnimToggle ? 1 : 0) + 257, 0xCA, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX2, 100);
+ gameSys.insertSequence(0xC4, (bgAnimToggle ? 1 : 0) + 256, 0xC4, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX3, 140);
+ gameSys.insertSequence(0xC5, (bgAnimToggle ? 1 : 0) + 257, 0xC5, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX4, 160);
+ gameSys.insertSequence(0xC6, (bgAnimToggle ? 1 : 0) + 258, 0xC6, (bgAnimToggle ? 0 : 1) + 258, kSeqSyncWait, 0, bgX5, 140);
+ gameSys.insertSequence(0xC7, (bgAnimToggle ? 1 : 0) + 259, 0xC7, (bgAnimToggle ? 0 : 1) + 259, kSeqSyncWait, 0, bgX6, 140);
+ _vm->_timers[0] = 2;
+ }
+
+ if (gameSys.getAnimationStatus(1) == 2) {
+ streetAnimToggle = !streetAnimToggle;
+ gameSys.setAnimation(0xC8, (streetAnimToggle ? 1 : 0) + 251, 1);
+ gameSys.insertSequence(0xC8, (streetAnimToggle ? 1 : 0) + 251, 200, (streetAnimToggle ? 0 : 1) + 251, kSeqSyncWait, 0, 0, -50);
+ }
+
+ checkObstacles();
+
+ if (gameSys.getAnimationStatus(0) == 2) {
+ switch (_truckSequenceId) {
+ case 0xB1:
+ _truckLaneNum = 1;
+ break;
+ case 0xB0:
+ case 0xB3:
+ _truckLaneNum = 2;
+ break;
+ case 0xB2:
+ _truckLaneNum = 3;
+ break;
+ }
+ animToggle3 = !animToggle3;
+ if (_truckLaneNum == 1) {
+ gameSys.setAnimation(0xAD, (animToggle3 ? 1 : 0) + 256, 0);
+ gameSys.insertSequence(0xAD, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50);
+ _truckSequenceId = 0xAD;
+ } else if (_truckLaneNum == 2) {
+ gameSys.setAnimation(0xAE, (animToggle3 ? 1 : 0) + 256, 0);
+ gameSys.insertSequence(0xAE, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50);
+ _truckSequenceId = 0xAE;
+ } else {
+ gameSys.setAnimation(0xAF, (animToggle3 ? 1 : 0) + 256, 0);
+ gameSys.insertSequence(0xAF, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50);
+ _truckSequenceId = 0xAF;
+ }
+ _truckId = (animToggle3 ? 1 : 0) + 256;
+ if (_scoreLevel == 1) {
+ if (!gameSys.isSequenceActive(0xD4, 266)) {
+ gameSys.setAnimation(0xD4, 266, 8);
+ gameSys.insertSequence(0xD4, 266, 0, 0, kSeqNone, 0, 0, -50);
+ }
+ ++_scoreLevel;
+ _vm->_timers[1] = 2;
+ animToggle4 = false;
+ animToggle5 = false;
+ animToggle6 = false;
+ _scoreBarFlash = false;
+ }
+ }
+
+ if (_scoreLevel != 0 && !_vm->_timers[1]) {
+ refreshScoreBar();
+ _vm->_timers[1] = 8;
+ if (animToggle6) {
+ if (animToggle5) {
+ if (animToggle4 && !gameSys.isSequenceActive(212, 266))
+ gameSys.insertSequence(212, 266, 0, 0, kSeqNone, 0, 0, -50);
+ animToggle4 = !animToggle4;
+ }
+ animToggle5 = !animToggle5;
+ }
+ animToggle6 = !animToggle6;
+ }
+
+ updateAnimations();
+
+ if (clearKeyStatus()) {
+ _vm->_sceneDone = true;
+ _vm->_newSceneNum = 2;
+ _vm->_newCursorValue = 1;
+ }
+
+ if (_vm->isKeyStatus1(Common::KEYCODE_RIGHT)) {
+ // Steer right
+ if (_truckSequenceId == 0xB3)
+ _truckLaneNum = 2;
+ if (_truckSequenceId == 0xB1)
+ _truckLaneNum = 1;
+ if (_truckLaneNum != 3 && _truckLaneNum != 2) {
+ if (_scoreLevel) {
+ _vm->_sceneDone = true;
+ _vm->_newSceneNum = 47;
+ }
+ } else {
+ int steerSequenceId = (_truckLaneNum == 3) ? 0xB3 : 0xB1;
+ if (_truckSequenceId == 0xAE || _truckSequenceId == 0xAF) {
+ gameSys.setAnimation(steerSequenceId, 256, 0);
+ gameSys.insertSequence(steerSequenceId, 256, _truckSequenceId, _truckId, kSeqSyncExists, 0, 0, -50);
+ _truckSequenceId = steerSequenceId;
+ _truckId = 256;
+ }
+ }
+ _vm->clearKeyStatus1(Common::KEYCODE_RIGHT);
+ }
+
+ if (_vm->isKeyStatus1(Common::KEYCODE_LEFT)) {
+ // Steer left
+ if (_truckSequenceId == 0xB0)
+ _truckLaneNum = 2;
+ if (_truckSequenceId == 0xB2)
+ _truckLaneNum = 3;
+ if (_truckLaneNum == 1 || _truckLaneNum == 2) {
+ int steerSequenceId = (_truckLaneNum == 1) ? 0xB0 : 0xB2;
+ if (_truckSequenceId == 0xAD || _truckSequenceId == 0xAE) {
+ gameSys.setAnimation(steerSequenceId, 256, 0);
+ gameSys.insertSequence(steerSequenceId, 256, _truckSequenceId, _truckId, kSeqSyncExists, 0, 0, -50);
+ _truckSequenceId = steerSequenceId;
+ _truckId = 256;
+ }
+ }
+ _vm->clearKeyStatus1(Common::KEYCODE_LEFT);
+ }
+ _vm->gameUpdateTick();
+ }
+ _vm->stopSound(0xE2);
+}
+
+void Scene49::updateAnimations() {
+ GameSys gameSys = *_vm->_gameSys;
+
+ for (int i = 0; i < 5; ++i) {
+ if (gameSys.getAnimationStatus(i + 2) == 2) {
+ if (_obstacles[i]._currSequenceId)
+ updateObstacle(i);
+ }
+ }
+
+ if (gameSys.getAnimationStatus(8) == 2) {
+ _vm->_sceneDone = true;
+ _vm->_newSceneNum = 47;
+ }
+}
+
+/*****************************************************************************/
+
+Scene50::Scene50(GnapEngine *vm) : Scene(vm) {
+ _fightDone = false;
+
+ _roundNum = -1;
+ _timeRemaining = -1;
+ _leftTongueRoundsWon = -1;
+ _rightTongueRoundsWon = -1;
+ _leftTongueSequenceId = -1;
+ _leftTongueId = -1;
+ _leftTongueNextSequenceId = -1;
+ _leftTongueNextId = -1;
+ _rightTongueSequenceId = -1;
+ _rightTongueId = -1;
+ _rightTongueNextSequenceId = -1;
+ _rightTongueNextId = -1;
+ _leftTongueEnergy = -1;
+ _rightTongueEnergy = -1;
+
+ _timesPlayed = 0;
+ _timesPlayedModifier = 0;
+ _attackCounter = 0;
+ _leftTongueEnergyBarPos = 10;
+ _leftTongueNextIdCtr = 0;
+ _rightTongueEnergyBarPos = 10;
+ _rightTongueNextIdCtr = 0;
+}
+
+int Scene50::init() {
+ return 0xC7;
+}
+
+void Scene50::updateHotspots() {
+ _vm->_hotspotsCount = 0;
+}
+
+bool Scene50::tongueWinsRound(int tongueNum) {
+ if (tongueNum == 1)
+ ++_leftTongueRoundsWon;
+ else
+ ++_rightTongueRoundsWon;
+ playWinBadgeAnim(tongueNum);
+ bool fightOver = _rightTongueRoundsWon == 2 || _leftTongueRoundsWon == 2;
+ playWinAnim(tongueNum, fightOver);
+ return fightOver;
+}
+
+void Scene50::playWinAnim(int tongueNum, bool fightOver) {
+ if (tongueNum == 1) {
+ if (fightOver) {
+ _vm->_gameSys->insertSequence(0xAD, 140, 0xAC, 140, kSeqSyncWait, 0, 0, 0);
+ _vm->_gameSys->insertSequence(0xB4, 100, _leftTongueSequenceId, _leftTongueId, kSeqSyncWait, 0, 0, 0);
+ _vm->_gameSys->insertSequence(0xBD, 100, _rightTongueSequenceId, _rightTongueId, kSeqSyncWait, 0, 0, 0);
+ _vm->_gameSys->insertSequence(0xBC, 100, 0xBD, 100, kSeqSyncWait, 0, 0, 0);
+ _leftTongueSequenceId = 0xB4;
+ _rightTongueSequenceId = 0xBC;
+ _rightTongueId = 100;
+ _leftTongueId = 100;
+ _vm->_gameSys->setAnimation(0xB4, 100, 6);
+ _vm->_gameSys->setAnimation(_rightTongueSequenceId, 100, 5);
+ waitForAnim(6);
+ waitForAnim(5);
+ _vm->invAdd(kItemGum);
+ _vm->setFlag(kGFUnk13);
+ } else {
+ _vm->_gameSys->insertSequence(0xB4, 100, _leftTongueSequenceId, _leftTongueId, kSeqSyncWait, 0, 0, 0);
+ _vm->_gameSys->insertSequence(0xBD, 100, _rightTongueSequenceId, _rightTongueId, kSeqSyncWait, 0, 0, 0);
+ _vm->_gameSys->insertSequence(0xBC, 100, 0xBD, 100, kSeqSyncWait, 0, 0, 0);
+ _leftTongueSequenceId = 0xB4;
+ _rightTongueSequenceId = 0xBC;
+ _rightTongueId = 100;
+ _leftTongueId = 100;
+ _vm->_gameSys->setAnimation(0xB4, 100, 6);
+ _vm->_gameSys->setAnimation(_rightTongueSequenceId, 100, 5);
+ waitForAnim(6);
+ waitForAnim(5);
+ }
+ } else {
+ _vm->_gameSys->insertSequence(0xBE, 100, _rightTongueSequenceId, _rightTongueId, kSeqSyncWait, 0, 0, 0);
+ _vm->_gameSys->setAnimation(0xBE, 100, 5);
+ waitForAnim(5);
+ _vm->_gameSys->insertSequence(0xBF, 100, 0xBE, 100, kSeqSyncWait, 0, 0, 0);
+ _vm->_gameSys->insertSequence(0xB5, 100, _leftTongueSequenceId, _leftTongueId, kSeqSyncWait, 0, 0, 0);
+ _rightTongueSequenceId = 0xBF;
+ _leftTongueSequenceId = 0xB5;
+ _rightTongueId = 100;
+ _leftTongueId = 100;
+ _vm->_gameSys->setAnimation(0xB5, 100, 6);
+ _vm->_gameSys->setAnimation(_rightTongueSequenceId, 100, 5);
+ waitForAnim(6);
+ waitForAnim(5);
+ }
+ // TODO delayTicksA(1, 7);
+}
+
+void Scene50::delayTicks() {
+ // TODO delayTicksA(3, 7);
+}
+
+void Scene50::initRound() {
+ _leftTongueEnergy = 10;
+ _rightTongueEnergy = 10;
+ _fightDone = false;
+ _vm->_timers[3] = getRightTongueActionTicks();
+ _vm->_timers[4] = 0;
+ _vm->_timers[6] = 0;
+ _vm->_gameSys->fillSurface(0, 91, 73, 260, 30, 212, 0, 0);
+ _vm->_gameSys->fillSurface(0, 450, 73, 260, 30, 212, 0, 0);
+ _timeRemaining = 40;
+ drawCountdown(40);
+}
+
+bool Scene50::updateCountdown() {
+ if (!_vm->_timers[5]) {
+ --_timeRemaining;
+ if (_timeRemaining < 0) {
+ return true;
+ } else {
+ _vm->_timers[5] = 15;
+ drawCountdown(_timeRemaining);
+ }
+ }
+ return false;
+}
+
+void Scene50::drawCountdown(int value) {
+ char str[8];
+ sprintf(str, "%02d", value);
+ _vm->_gameSys->fillSurface(0, 371, 505, 50, 27, 0, 0, 0);
+ _vm->_gameSys->drawTextToSurface(0, 381, 504, 255, 255, 255, str);
+}
+
+void Scene50::playTonguesIdle() {
+ _vm->_gameSys->insertSequence(0xBA, 100, _leftTongueSequenceId, _leftTongueId, kSeqSyncWait, 0, 0, 0);
+ _vm->_gameSys->insertSequence(0xC2, 100, _rightTongueSequenceId, _rightTongueId, kSeqSyncWait, 0, 0, 0);
+ _leftTongueSequenceId = 0xBA;
+ _rightTongueSequenceId = 0xC2;
+ _rightTongueNextSequenceId = -1;
+ _leftTongueNextSequenceId = -1;
+ _leftTongueId = 100;
+ _rightTongueId = 100;
+ _vm->_gameSys->setAnimation(0xC2, 100, 5);
+ _vm->_gameSys->setAnimation(_leftTongueSequenceId, _leftTongueId, 6);
+}
+
+void Scene50::playRoundAnim(int roundNum) {
+ int sequenceId = 0;
+
+ switch (roundNum) {
+ case 1:
+ sequenceId = 0xAF;
+ break;
+ case 2:
+ sequenceId = 0xB0;
+ break;
+ case 3:
+ sequenceId = 0xB1;
+ break;
+ }
+
+ _vm->_gameSys->insertSequence(sequenceId, 256, 0, 0, kSeqNone, 0, 0, 0);
+ _vm->_gameSys->setAnimation(sequenceId, 256, 7);
+ waitForAnim(7);
+
+ _vm->_gameSys->insertSequence(0xAB, 256, sequenceId, 256, kSeqSyncWait, 0, 0, 0);
+ _vm->_gameSys->setAnimation(0xAB, 256, 7);
+ waitForAnim(7);
+}
+
+bool Scene50::updateEnergyBars(int newLeftBarPos, int newRightBarPos) {
+ if (newLeftBarPos != _leftTongueEnergyBarPos) {
+ if (newLeftBarPos < 0)
+ newLeftBarPos = 0;
+ _leftTongueEnergyBarPos = newLeftBarPos;
+ _vm->_gameSys->fillSurface(0, 26 * newLeftBarPos + 91, 73, 260 - 26 * newLeftBarPos, 30, 0, 0, 0);
+ }
+
+ if (newRightBarPos != _rightTongueEnergyBarPos) {
+ if (newRightBarPos < 0)
+ newRightBarPos = 0;
+ _rightTongueEnergyBarPos = newRightBarPos;
+ if (newRightBarPos != 10)
+ _vm->_gameSys->fillSurface(0, 26 * (9 - newRightBarPos) + 450, 73, 26, 30, 0, 0, 0);
+ }
+
+ if (newLeftBarPos * newRightBarPos > 0)
+ return false;
+
+ _leftTongueEnergyBarPos = 10;
+ _rightTongueEnergyBarPos = 10;
+ return true;
+}
+
+void Scene50::waitForAnim(int animationIndex) {
+ while (_vm->_gameSys->getAnimationStatus(animationIndex) != 2) {
+ _vm->gameUpdateTick();
+ }
+ _vm->_gameSys->setAnimation(0, 0, animationIndex);
+}
+
+int Scene50::checkInput() {
+ int sequenceId = -1;
+
+ if (_vm->isKeyStatus1(Common::KEYCODE_RIGHT)) {
+ _vm->clearKeyStatus1(Common::KEYCODE_RIGHT);
+ sequenceId = 0xB6;
+ } else if (_vm->isKeyStatus1(Common::KEYCODE_LEFT)) {
+ _vm->clearKeyStatus1(Common::KEYCODE_LEFT);
+ sequenceId = 0xB3;
+ } else if (_vm->isKeyStatus1(Common::KEYCODE_ESCAPE)) {
+ _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE);
+ _fightDone = true;
+ }
+
+ return sequenceId;
+}
+
+int Scene50::getRightTongueAction() {
+ int sequenceId = -1;
+
+ if (!_vm->_timers[3]) {
+ _vm->_timers[3] = getRightTongueActionTicks();
+ if (_rightTongueEnergy >= _leftTongueEnergy) {
+ switch (_vm->getRandom(5)) {
+ case 0:
+ sequenceId = 0xBE;
+ break;
+ case 1:
+ sequenceId = 0xBE;
+ break;
+ case 2:
+ sequenceId = 0xBB;
+ break;
+ case 3:
+ sequenceId = 0xBB;
+ break;
+ case 4:
+ sequenceId = 0xBB;
+ break;
+ }
+ } else {
+ switch (_vm->getRandom(4)) {
+ case 0:
+ sequenceId = 0xBE;
+ break;
+ case 1:
+ sequenceId = 0xBB;
+ break;
+ case 2:
+ sequenceId = 0xBE;
+ break;
+ case 3:
+ sequenceId = 0xBE;
+ break;
+ }
+ }
+ }
+
+ return sequenceId;
+}
+
+void Scene50::updateAnimations() {
+ if (!_vm->_timers[4])
+ _attackCounter = 0;
+
+ if (_vm->_gameSys->getAnimationStatus(5) == 2) {
+ if (_rightTongueSequenceId == 0xBE) {
+ if (_leftTongueSequenceId != 0xB3 && _leftTongueSequenceId != 0xB8)
+ _rightTongueNextSequenceId = 0xBF;
+ else
+ _rightTongueNextSequenceId = 0xC0;
+ }
+ if (_rightTongueNextSequenceId == -1)
+ _rightTongueNextSequenceId = 0xC2;
+ if (_rightTongueNextSequenceId == 0xBF) {
+ _leftTongueNextId = getLeftTongueNextId();
+ _rightTongueNextId = getRightTongueNextId();
+ _vm->_gameSys->setAnimation(_rightTongueNextSequenceId, _rightTongueNextId, 5);
+ _vm->_gameSys->setAnimation(0xB9, _leftTongueNextId, 6);
+ _vm->_gameSys->insertSequence(_rightTongueNextSequenceId, _rightTongueNextId, _rightTongueSequenceId, _rightTongueId, kSeqSyncWait, 0, 0, 0);
+ _vm->_gameSys->insertSequence(0xB9, _leftTongueNextId, _leftTongueSequenceId, _leftTongueId, kSeqSyncExists, 0, 0, 0);
+ _rightTongueSequenceId = _rightTongueNextSequenceId;
+ _rightTongueNextSequenceId = -1;
+ _leftTongueSequenceId = 0xB9;
+ _leftTongueNextSequenceId = -1;
+ _rightTongueId = _rightTongueNextId;
+ _leftTongueId = _leftTongueNextId;
+ _leftTongueEnergy -= _vm->getRandom(2) + 1;//CHECKME
+ } else {
+ _rightTongueNextId = getRightTongueNextId();
+ _vm->_gameSys->setAnimation(_rightTongueNextSequenceId, _rightTongueNextId, 5);
+ _vm->_gameSys->insertSequence(_rightTongueNextSequenceId, _rightTongueNextId, _rightTongueSequenceId, _rightTongueId, kSeqSyncWait, 0, 0, 0);
+ _rightTongueSequenceId = _rightTongueNextSequenceId;
+ _rightTongueNextSequenceId = -1;
+ _rightTongueId = _rightTongueNextId;
+ }
+ }
+
+ if (_vm->_gameSys->getAnimationStatus(6) == 2) {
+ if (_leftTongueSequenceId == 0xB6) {
+ ++_attackCounter;
+ if (_timesPlayedModifier + 3 <= _attackCounter) {
+ _leftTongueNextSequenceId = 0xB8;
+ } else {
+ _vm->_timers[4] = 20;
+ //CHECKME
+ if (_rightTongueSequenceId != 0xBB && _rightTongueSequenceId != 0xC0 && _vm->getRandom(8) != _roundNum)
+ _leftTongueNextSequenceId = 0xB7;
+ else
+ _leftTongueNextSequenceId = 0xB8;
+ }
+ }
+ if (_leftTongueNextSequenceId == 0xB3)
+ --_attackCounter;
+ if (_leftTongueNextSequenceId == -1)
+ _leftTongueNextSequenceId = 0xBA;
+ if (_leftTongueNextSequenceId == 0xB7) {
+ _leftTongueNextId = getLeftTongueNextId();
+ _rightTongueNextId = getRightTongueNextId();
+ _vm->_gameSys->setAnimation(_leftTongueNextSequenceId, _leftTongueNextId, 6);
+ _vm->_gameSys->setAnimation(0xC1, _rightTongueNextId, 5);
+ _vm->_gameSys->insertSequence(_leftTongueNextSequenceId, _leftTongueNextId, _leftTongueSequenceId, _leftTongueId, kSeqSyncWait, 0, 0, 0);
+ _vm->_gameSys->insertSequence(0xC1, _rightTongueNextId, _rightTongueSequenceId, _rightTongueId, kSeqSyncExists, 0, 0, 0);
+ _leftTongueSequenceId = _leftTongueNextSequenceId;
+ _leftTongueNextSequenceId = -1;
+ _rightTongueSequenceId = 0xC1;
+ _rightTongueNextSequenceId = -1;
+ _rightTongueId = _rightTongueNextId;
+ _leftTongueId = _leftTongueNextId;
+ --_rightTongueEnergy;
+ } else if (_leftTongueNextSequenceId != 0xB8 || _rightTongueSequenceId != 0xC2) {
+ _leftTongueNextId = getLeftTongueNextId();
+ _vm->_gameSys->setAnimation(_leftTongueNextSequenceId, _leftTongueNextId, 6);
+ _vm->_gameSys->insertSequence(_leftTongueNextSequenceId, _leftTongueNextId, _leftTongueSequenceId, _leftTongueId, kSeqSyncWait, 0, 0, 0);
+ _leftTongueSequenceId = _leftTongueNextSequenceId;
+ _leftTongueNextSequenceId = -1;
+ _leftTongueId = _leftTongueNextId;
+ } else {
+ _leftTongueNextId = getLeftTongueNextId();
+ _rightTongueNextId = getRightTongueNextId();
+ _vm->_gameSys->setAnimation(0xBB, _rightTongueNextId, 5);
+ _vm->_gameSys->setAnimation(_leftTongueNextSequenceId, _leftTongueNextId, 6);
+ _vm->_gameSys->insertSequence(_leftTongueNextSequenceId, _leftTongueNextId, _leftTongueSequenceId, _leftTongueId, kSeqSyncWait, 0, 0, 0);
+ _vm->_gameSys->insertSequence(0xBB, _rightTongueNextId, _rightTongueSequenceId, _rightTongueId, kSeqSyncExists, 0, 0, 0);
+ _rightTongueSequenceId = 0xBB;
+ _rightTongueId = _rightTongueNextId;
+ _rightTongueNextSequenceId = -1;
+ _leftTongueSequenceId = _leftTongueNextSequenceId;
+ _leftTongueNextSequenceId = -1;
+ _leftTongueId = _leftTongueNextId;
+ }
+ }
+}
+
+int Scene50::getRightTongueActionTicks() {
+ return 15 - 5 * _roundNum + 1;
+}
+
+int Scene50::getLeftTongueNextId() {
+ _leftTongueNextIdCtr = (_leftTongueNextIdCtr + 1) % 3;
+ return _leftTongueNextIdCtr + 100;
+}
+
+int Scene50::getRightTongueNextId() {
+ _rightTongueNextIdCtr = (_rightTongueNextIdCtr + 1) % 3;
+ return _rightTongueNextIdCtr + 100;
+}
+
+void Scene50::playWinBadgeAnim(int tongueNum) {
+ int sequenceId;
+
+ if (tongueNum == 1) {
+ if (_leftTongueRoundsWon == 1)
+ sequenceId = 0xC3;
+ else
+ sequenceId = 0xC4;
+ } else {
+ if (_rightTongueRoundsWon == 1)
+ sequenceId = 0xC5;
+ else
+ sequenceId = 0xC6;
+ }
+
+ _vm->_gameSys->setAnimation(sequenceId, 120, 7);
+ _vm->_gameSys->insertSequence(sequenceId, 120, 0, 0, kSeqNone, 0, 0, 0);
+ waitForAnim(7);
+}
+
+void Scene50::run() {
+ ++_timesPlayed;
+ _timesPlayedModifier = _timesPlayed / 4;
+ _leftTongueRoundsWon = 0;
+ _rightTongueRoundsWon = 0;
+ // initFont();
+ _leftTongueSequenceId = 186;
+ _rightTongueSequenceId = 194;
+ _rightTongueNextSequenceId = -1;
+ _leftTongueNextSequenceId = -1;
+ _leftTongueId = 100;
+ _rightTongueId = 100;
+
+ _vm->_gameSys->setAnimation(194, 100, 5);
+ _vm->_gameSys->setAnimation(_leftTongueSequenceId, _leftTongueId, 6);
+ _vm->_gameSys->insertSequence(_leftTongueSequenceId, _leftTongueId, 0, 0, kSeqNone, 0, 0, 0);
+ _vm->_gameSys->insertSequence(_rightTongueSequenceId, _rightTongueId, 0, 0, kSeqNone, 0, 0, 0);
+ _vm->_gameSys->insertSequence(172, 140, 0, 0, kSeqNone, 0, 0, 0);
+ _vm->endSceneInit();
+
+ initRound();
+
+ _roundNum = 1;
+
+ _vm->setGrabCursorSprite(-1);
+ _vm->hideCursor();
+
+ // TODO delayTicksA(1, 7);
+
+ playRoundAnim(_roundNum);
+
+ _vm->_timers[5] = 15;
+
+ while (!_fightDone) {
+ /* TODO
+ if (sceneXX_sub_4466B1())
+ _fightDone = true;
+ */
+
+ int playerSequenceId = checkInput();
+ if (playerSequenceId != -1)
+ _leftTongueNextSequenceId = playerSequenceId;
+
+ int rightSequenceId = getRightTongueAction();
+ if (rightSequenceId != -1)
+ _rightTongueNextSequenceId = rightSequenceId;
+
+ updateAnimations();
+
+ if (updateCountdown() ||
+ updateEnergyBars(_leftTongueEnergy, _rightTongueEnergy)) {
+ bool v0;
+ if (_rightTongueEnergy < _leftTongueEnergy)
+ v0 = tongueWinsRound(1);
+ else
+ v0 = tongueWinsRound(2);
+ if (v0) {
+ delayTicks();
+ _fightDone = true;
+ } else {
+ ++_roundNum;
+ initRound();
+ playTonguesIdle();
+ updateEnergyBars(_leftTongueEnergy, _rightTongueEnergy);
+ playRoundAnim(_roundNum);
+ _vm->_timers[5] = 15;
+ }
+ }
+ _vm->gameUpdateTick();
+ }
+
+ // freeFont();
+
+ _vm->_gameSys->setAnimation(0, 0, 7);
+ _vm->_gameSys->setAnimation(0, 0, 6);
+ _vm->_gameSys->setAnimation(0, 0, 5);
+ _vm->_gameSys->setAnimation(0, 0, 3);
+
+ _vm->showCursor();
+}
+
+/*****************************************************************************/
+
+static const int kDigitSequenceIds[] = {
+ 0xCA, 0xCB, 0xCC, 0xCD, 0xCE,
+ 0xCF, 0xD0, 0xD1, 0xD2, 0xD3
+};
+
+static const int kDigitPositions[4] = {
+ 0, 34, 83, 119
+};
+
+/*
+ 0xBA Falling banana peel
+ 0xBC Banana peel goes away
+ 0xBD Falling coin
+ 0xBE Fallen coin
+ 0xC0 Falling banknote
+ 0xB6 Platypus tripping (right)
+ 0xB7 Platypus tripping (left)
+ 0x76 Platypus jumping (right)
+*/
+
+Scene51::Scene51(GnapEngine *vm) : Scene(vm) {
+ _dropLoseCash = false;
+
+ _cashAmount = -1;
+ _guySequenceId = -1;
+ _guyNextSequenceId = -1;
+ _itemsCaughtCtr = -1;
+ _dropSpeedTicks = -1;
+ _nextDropItemKind = -1;
+ _itemInsertX = -1;
+ _itemInsertDirection = -1;
+ _platypusSequenceId = -1;
+ _platypusNextSequenceId = -1;
+ _platypusJumpSequenceId = -1;
+ _itemsCtr = -1;
+ _itemsCtr1 = -1;
+ _itemsCtr2 = -1;
+
+ for (int i = 0; i < 4; i++) {
+ _digits[i] = 0;
+ _digitSequenceIds[4] = -1;
+ }
+
+ for (int i = 0; i < 6; i++) {
+ _items[i]._currSequenceId = -1;
+ _items[i]._droppedSequenceId;
+ _items[i]._x = 0;
+ _items[i]._y = 0;
+ _items[i]._collisionX;
+ _items[i]._canCatch = false;
+ _items[i]._isCollision = false;
+ _items[i]._x2 = 0;
+ _items[i]._id = -1;
+ }
+}
+
+int Scene51::init() {
+ _vm->_gameSys->setAnimation(0, 0, 0);
+ for (int i = 0; i < 6; ++i)
+ _vm->_gameSys->setAnimation(0, 0, i + 1);
+ return 0xD4;
+}
+
+void Scene51::updateHotspots() {
+ _vm->_hotspotsCount = 0;
+}
+
+void Scene51::clearItem(Scene51Item *item) {
+ item->_currSequenceId = 0;
+ item->_droppedSequenceId = 0;
+ item->_x = 0;
+ item->_y = 0;
+ item->_x2 = 0;
+ item->_collisionX = 0;
+ item->_canCatch = false;
+}
+
+void Scene51::dropNextItem() {
+ if (_vm->_timers[0])
+ return;
+
+ int index = 0;
+ while (index < 6 && _items[index]._currSequenceId)
+ ++index;
+
+ if (index == 6)
+ return;
+
+ switch (_nextDropItemKind) {
+ case 0:
+ if (_vm->getRandom(10) != 0 || _itemsCtr2 >= 2) {
+ _items[index]._currSequenceId = 0xBD;
+ } else {
+ --_itemsCtr1;
+ _items[index]._currSequenceId = 0xBA;
+ ++_itemsCtr2;
+ }
+ break;
+
+ case 1:
+ if (_vm->getRandom(8) != 0 || _itemsCtr2 >= 2) {
+ if (_vm->getRandom(5) == 0) {
+ if (_itemInsertDirection)
+ _itemInsertX -= 70;
+ else
+ _itemInsertX += 70;
+ }
+ _items[index]._currSequenceId = 0xBD;
+ } else {
+ --_itemsCtr1;
+ _items[index]._currSequenceId = 0xBA;
+ ++_itemsCtr2;
+ }
+ break;
+
+ case 2:
+ if (_vm->getRandom(6) != 0 || _itemsCtr2 >= 2) {
+ _items[index]._currSequenceId = 0xBD;
+ } else {
+ --_itemsCtr1;
+ _items[index]._currSequenceId = 0xBA;
+ ++_itemsCtr2;
+ }
+ break;
+
+ case 3:
+ case 4:
+ if (_itemsCtr == 0)
+ _itemsCtr1 = 3;
+ _items[index]._currSequenceId = 0xC0;
+ break;
+
+ case 5:
+ case 6:
+ if (_vm->getRandom(5) != 0 || _itemsCtr2 >= 2) {
+ if (_vm->getRandom(5) != 0)
+ _items[index]._currSequenceId = 0xBD;
+ else
+ _items[index]._currSequenceId = 0xC0;
+ } else {
+ --_itemsCtr1;
+ _items[index]._currSequenceId = 0xBA;
+ ++_itemsCtr2;
+ }
+ break;
+
+ case 7:
+ if (_vm->getRandom(5) != 0 || _itemsCtr2 >= 2) {
+ if (_vm->getRandom(5) == 0) {
+ if (_itemInsertDirection)
+ _itemInsertX -= 40;
+ else
+ _itemInsertX += 40;
+ }
+ if (_vm->getRandom(9) != 0)
+ _items[index]._currSequenceId = 0xBD;
+ else
+ _items[index]._currSequenceId = 0xC0;
+ } else {
+ --_itemsCtr1;
+ _items[index]._currSequenceId = 0xBA;
+ ++_itemsCtr2;
+ }
+ break;
+
+ default:
+ if (_vm->getRandom(4) != 0 || _itemsCtr2 >= 2) {
+ if (_vm->getRandom(9) != 0)
+ _items[index]._currSequenceId = 0xBD;
+ else
+ _items[index]._currSequenceId = 0xC0;
+ } else {
+ --_itemsCtr1;
+ _items[index]._currSequenceId = 0xBA;
+ ++_itemsCtr2;
+ }
+ break;
+ }
+
+ if (_itemInsertDirection) {
+ _itemInsertX -= 73;
+ if (_itemInsertX < 129) {
+ _itemInsertX += 146;
+ _itemInsertDirection = 0;
+ }
+ } else {
+ _itemInsertX += 73;
+ if (_itemInsertX > 685) {
+ _itemInsertX -= 146;
+ _itemInsertDirection = 1;
+ }
+ }
+
+ if (_itemInsertX > 685)
+ _itemInsertX = 685;
+
+ if (_itemInsertX < 129)
+ _itemInsertX = 129;
+
+ if (_items[index]._currSequenceId == 0xBA) {
+ _items[index]._x2 = _vm->getRandom(350) + 200;
+ _items[index]._x = _items[index]._x2 - 362;
+ _items[index]._y = 15;
+ _items[index]._id = 249 - index;
+ } else {
+ _items[index]._collisionX = _itemInsertX;
+ _items[index]._x = _items[index]._collisionX - 395;
+ if (_items[index]._currSequenceId == 0xC0)
+ _items[index]._x -= 65;
+ _items[index]._id = index + 250;
+ _items[index]._canCatch = true;
+ }
+
+ _vm->_gameSys->setAnimation(_items[index]._currSequenceId, _items[index]._id, index + 1);
+ _vm->_gameSys->insertSequence(_items[index]._currSequenceId, _items[index]._id, 0, 0,
+ kSeqNone, 0, _items[index]._x, _items[index]._y);
+
+ _vm->_timers[0] = _dropSpeedTicks;
+
+ if (_nextDropItemKind >= 3)
+ _vm->_timers[0] = 20;
+
+ if (_nextDropItemKind >= 5)
+ _vm->_timers[0] = 5;
+
+ if (_nextDropItemKind == 8)
+ _vm->_timers[0] = 4;
+
+ ++_itemsCtr;
+}
+
+void Scene51::updateItemAnimations() {
+ for (int i = 0; i < 6; ++i) {
+ if (_vm->_gameSys->getAnimationStatus(i + 1) == 2)
+ updateItemAnimation(&_items[i], i);
+ }
+}
+
+int Scene51::checkCollision(int sequenceId) {
+ bool jumpingLeft = false, jumpingRight = false;
+ int v8, v4;
+ int result = 0;
+
+ if (!isJumping(sequenceId))
+ return false;
+
+ bool checkFl = false;
+ for (int i = 0; i < 6; i++)
+ checkFl |= _items[i]._isCollision;
+
+ if (!checkFl)
+ return false;
+
+ if (isJumpingRight(sequenceId)) {
+ v8 = getPosRight(sequenceId);
+ v4 = getPosRight(sequenceId + 1);
+ jumpingRight = true;
+ } else if (isJumpingLeft(sequenceId)) {
+ v4 = getPosLeft(sequenceId - 1) + 33;
+ v8 = getPosLeft(sequenceId) + 33;
+ jumpingLeft = true;
+ }
+
+ if (jumpingRight || jumpingLeft) {
+ int v5 = 0;
+ int i;
+ for (i = 0; i < 6; ++i) {
+ if (_items[i]._isCollision) {
+ if (jumpingRight && _items[i]._x2 > v8 && _items[i]._x2 < v4) {
+ v5 = v8 - 359;
+ if (v5 == 0)
+ v5 = 1;
+ _platypusNextSequenceId = 0xB6;
+ break;
+ } else if (jumpingLeft && _items[i]._x2 < v4 && _items[i]._x2 > v8) {
+ v5 = v8 - 344;
+ if (v5 == 0)
+ v5 = 1;
+ _platypusNextSequenceId = 0xB7;
+ break;
+ }
+ }
+ }
+ if (v5) {
+ _vm->_gameSys->setAnimation(0xBC, _items[i]._id, i + 1);
+ _vm->_gameSys->insertSequence(0xBC, _items[i]._id, _items[i]._currSequenceId, _items[i]._id, kSeqSyncWait, 0, _items[i]._x, 15);
+ _items[i]._isCollision = false;
+ _items[i]._currSequenceId = 0xBC;
+ --_itemsCtr2;
+ }
+ result = v5;
+ }
+
+ return result;
+}
+
+void Scene51::updateItemAnimation(Scene51Item *item, int index) {
+
+ switch (item->_currSequenceId) {
+ case 0xBD:
+ case 0xC0:
+ case 0xC1:
+ // Falling coin and banknote
+ if (!itemIsCaught(item)) {
+ if (_dropLoseCash) {
+ if (item->_currSequenceId == 0xBD)
+ _cashAmount -= 2;
+ else
+ _cashAmount -= 25;
+ if (_cashAmount < 0)
+ _cashAmount = 0;
+ updateCash(_cashAmount);
+ }
+ item->_droppedSequenceId = item->_currSequenceId + 1;
+ if (item->_currSequenceId != 0xC0) {
+ item->_canCatch = false;
+ _dropLoseCash = true;
+ _itemsCtr = 0;
+ _vm->_timers[0] = 10;
+ }
+ if (item->_droppedSequenceId) {
+ _vm->_gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1);
+ _vm->_gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y);
+ item->_currSequenceId = item->_droppedSequenceId;
+ item->_y = 0;
+ }
+ } else {
+ _vm->_gameSys->removeSequence(item->_currSequenceId, item->_id, true);
+ _vm->_gameSys->setAnimation(0, 0, index + 1);
+ _vm->playSound(218, false);
+ if (incCashAmount(item->_currSequenceId) == 1995) {
+ winMinigame();
+ _vm->_sceneDone = true;
+ } else {
+ clearItem(item);
+ ++_itemsCaughtCtr;
+ if (_itemsCaughtCtr == 5)
+ --_dropSpeedTicks;
+ if (_itemsCaughtCtr == 8)
+ --_dropSpeedTicks;
+ if (_itemsCaughtCtr == 11)
+ --_dropSpeedTicks;
+ if (_itemsCaughtCtr == 14)
+ --_dropSpeedTicks;
+ if (_itemsCaughtCtr >= 15 && _dropSpeedTicks > 4)
+ --_dropSpeedTicks;
+ if (_itemsCtr1 <= _itemsCaughtCtr) {
+ ++_nextDropItemKind;
+ _dropSpeedTicks = 10;
+ _itemsCtr = 0;
+ _itemsCtr1 = 20;
+ _dropLoseCash = false;
+ _itemsCaughtCtr = 0;
+ removeCollidedItems();
+ }
+ }
+ }
+ break;
+
+ case 0xBE:
+ // Fallen coin
+ item->_droppedSequenceId = item->_currSequenceId + 1;
+ if (item->_droppedSequenceId) {
+ _vm->_gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1);
+ _vm->_gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y);
+ item->_currSequenceId = item->_droppedSequenceId;
+ item->_y = 0;
+ }
+ break;
+
+ case 0xBF:
+ case 0xC2:
+ // Bouncing coin and banknote
+ _vm->_gameSys->setAnimation(0, 0, index + 1);
+ _vm->_gameSys->removeSequence(item->_currSequenceId, item->_id, true);
+ clearItem(item);
+ break;
+
+ case 0xBA:
+ // Falling banana peel
+ item->_droppedSequenceId = 0xBB;
+ item->_y = 15;
+ if (item->_droppedSequenceId) {
+ _vm->_gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1);
+ _vm->_gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y);
+ item->_currSequenceId = item->_droppedSequenceId;
+ item->_y = 0;
+ }
+ break;
+
+ case 0xBB:
+ item->_isCollision = true;
+ item->_droppedSequenceId = 0;
+ _vm->_gameSys->setAnimation(0, 0, index + 1);
+ break;
+
+ case 0xBC:
+ _vm->_gameSys->removeSequence(item->_currSequenceId, item->_id, true);
+ _vm->_gameSys->setAnimation(0, 0, index + 1);
+ clearItem(item);
+ break;
+
+ default:
+ if (item->_droppedSequenceId) {
+ _vm->_gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1);
+ _vm->_gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y);
+ item->_currSequenceId = item->_droppedSequenceId;
+ item->_y = 0;
+ }
+ break;
+ }
+}
+
+void Scene51::removeCollidedItems() {
+ for (int i = 0; i < 6; ++i) {
+ if (_items[i]._isCollision) {
+ _vm->_gameSys->removeSequence(_items[i]._currSequenceId, _items[i]._id, true);
+ _vm->_gameSys->setAnimation(0, 0, i + 1);
+ clearItem(&_items[i]);
+ }
+ }
+ _itemsCtr2 = 0;
+}
+
+int Scene51::itemIsCaught(Scene51Item *item) {
+ if (!item->_canCatch)
+ return 0;
+
+ if (isJumpingRight(_platypusJumpSequenceId)) {
+ int v4 = getPosRight(_platypusJumpSequenceId) + 97;
+ if (item->_collisionX < v4 && v4 - item->_collisionX < 56)
+ return 1;
+ } else {
+ int v2 = getPosLeft(_platypusJumpSequenceId);
+ if (item->_collisionX > v2 && item->_collisionX - v2 < 56)
+ return 1;
+ }
+
+ if (item->_currSequenceId == 0xC1) {
+ int v3 = item->_collisionX + 100;
+ if (isJumpingRight(_platypusJumpSequenceId)) {
+ if (ABS(getPosRight(_platypusJumpSequenceId) + 46 - v3) < 56)
+ return 1;
+ } else if (ABS(getPosLeft(_platypusJumpSequenceId) + 46 - v3) < 56) {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+bool Scene51::isJumpingRight(int sequenceId) {
+ return sequenceId >= 0x76 && sequenceId <= 0x95;
+}
+
+bool Scene51::isJumpingLeft(int sequenceId) {
+ return sequenceId >= 0x96 && sequenceId <= 0xB5;
+}
+
+bool Scene51::isJumping(int sequenceId) {
+ return sequenceId >= 0x76 && sequenceId <= 0xB5;
+}
+
+void Scene51::waitForAnim(int animationIndex) {
+ while (_vm->_gameSys->getAnimationStatus(animationIndex) != 2) {
+ // pollMessages();
+ updateItemAnimations();
+ _vm->gameUpdateTick();
+ }
+}
+
+int Scene51::getPosRight(int sequenceId) {
+ static const int kRightPosTbl[] = {
+ 131, 159, 178, 195, 203, 219, 238, 254,
+ 246, 274, 293, 310, 318, 334, 353, 369,
+ 362, 390, 409, 426, 434, 450, 469, 485,
+ 477, 505, 524, 541, 549, 565, 584, 600
+ };
+
+ if (sequenceId >= 118 && sequenceId <= 149)
+ return kRightPosTbl[sequenceId - 118];
+ return -1;
+}
+
+int Scene51::getPosLeft(int sequenceId) {
+ static const int kLeftPosTbl[] = {
+ 580, 566, 550, 536, 526, 504, 488, 469,
+ 460, 446, 430, 416, 406, 384, 368, 349,
+ 342, 328, 312, 298, 288, 266, 250, 231,
+ 220, 206, 190, 176, 166, 144, 128, 109
+ };
+
+ if (sequenceId >= 150 && sequenceId <= 181)
+ return kLeftPosTbl[sequenceId - 150];
+ return -1;
+}
+
+void Scene51::playIntroAnim() {
+ int soundCtr = 0;
+
+ _platypusSequenceId = 0x76;
+ _platypusNextSequenceId = 0x76;
+
+ for (int i = 0; i < 6; ++i)
+ clearItem(&_items[i]);
+
+ _items[0]._currSequenceId = 0xBA;
+ _items[0]._x2 = 320;
+ _items[0]._x = -42;
+ _items[0]._y = 15;
+ _items[0]._id = 249;
+ _items[0]._isCollision = true;
+
+ _vm->_gameSys->insertSequence(_platypusSequenceId, 256, 0, 0, kSeqNone, 0, -179, 0);
+ _vm->_gameSys->insertSequence(0xBA, 249, 0, 0, kSeqNone, 0, _items[0]._x, _items[0]._y);
+ _vm->_gameSys->setAnimation(0xBA, 249, 1);
+ _vm->_gameSys->setAnimation(_platypusSequenceId, 256, 0);
+
+ while (_platypusSequenceId < 0x80) {
+ waitForAnim(0);
+ ++_platypusNextSequenceId;
+ _vm->_gameSys->setAnimation(_platypusNextSequenceId, 256, 0);
+ _vm->_gameSys->insertSequence(_platypusNextSequenceId, 256, _platypusSequenceId, 256, kSeqSyncWait, 0, -179, 0);
+ _platypusSequenceId = _platypusNextSequenceId;
+ ++soundCtr;
+ if (soundCtr % 4 == 0)
+ _vm->playSound(214, false);
+ }
+
+ _platypusNextSequenceId = 0x75;
+
+ while (_platypusSequenceId != 0x84) {
+ waitForAnim(0);
+ ++_platypusNextSequenceId;
+ int oldSequenceId = _platypusNextSequenceId;
+ int v0 = checkCollision(_platypusNextSequenceId);
+ _vm->_gameSys->setAnimation(_platypusNextSequenceId, 256, 0);
+ _vm->_gameSys->insertSequence(_platypusNextSequenceId, 256, _platypusSequenceId, 256, kSeqSyncWait, 0, v0, 0);
+ _platypusSequenceId = _platypusNextSequenceId;
+ if (v0) {
+ _platypusNextSequenceId = oldSequenceId;
+ } else {
+ ++soundCtr;
+ if (soundCtr % 4 == 0)
+ _vm->playSound(214, false);
+ }
+ }
+ waitForAnim(0);
+}
+
+void Scene51::updateGuyAnimation() {
+ if (!_vm->_timers[4]) {
+ _vm->_timers[4] = _vm->getRandom(20) + 60;
+
+ switch (_vm->getRandom(5)) {
+ case 0:
+ _guyNextSequenceId = 0xC3;
+ break;
+ case 1:
+ _guyNextSequenceId = 0xC4;
+ break;
+ case 2:
+ _guyNextSequenceId = 0xC5;
+ break;
+ case 3:
+ _guyNextSequenceId = 0xC6;
+ break;
+ case 4:
+ _guyNextSequenceId = 0xC7;
+ break;
+ }
+
+ _vm->_gameSys->insertSequence(_guyNextSequenceId, 39, _guySequenceId, 39, kSeqSyncWait, 0, 0, 0);
+ _guySequenceId = _guyNextSequenceId;
+ _guyNextSequenceId = -1;
+ }
+}
+
+int Scene51::incCashAmount(int sequenceId) {
+ switch (sequenceId) {
+ case 0xBD:
+ _cashAmount += 10;
+ break;
+ case 0xC0:
+ case 0xC1:
+ _cashAmount += 100;
+ break;
+ case 0xB6:
+ case 0xB7:
+ _cashAmount -= 10 * _vm->getRandom(5) + 50;
+ if (_cashAmount < 0)
+ _cashAmount = 0;
+ break;
+ }
+ if (_cashAmount > 1995)
+ _cashAmount = 1995;
+ updateCash(_cashAmount);
+ return _cashAmount;
+}
+
+void Scene51::winMinigame() {
+ updateCash(1995);
+ _vm->playSound(218, false);
+ // TODO delayTicksA(1, 5);
+ _vm->_newSceneNum = 48;
+ _vm->invRemove(kItemBanana);
+}
+
+void Scene51::playCashAppearAnim() {
+ _vm->_gameSys->setAnimation(0xC8, 252, 0);
+ _vm->_gameSys->insertSequence(0xC8, 252, 0, 0, kSeqNone, 0, -20, -20);
+ while (_vm->_gameSys->getAnimationStatus(0) != 2) {
+ _vm->gameUpdateTick();
+ // checkGameAppStatus();
+ }
+}
+
+void Scene51::updateCash(int amount) {
+ drawDigit(amount / 1000, 0);
+ drawDigit(amount / 100 % 10, 1);
+ drawDigit(amount / 10 % 10, 2);
+ drawDigit(amount % 10, 3);
+}
+
+void Scene51::drawDigit(int digit, int position) {
+ if (digit != _digits[position]) {
+ _vm->_gameSys->insertSequence(kDigitSequenceIds[digit], 253,
+ _digitSequenceIds[position], 253,
+ kSeqSyncWait, 0, kDigitPositions[position] - 20, -20);
+ _digitSequenceIds[position] = kDigitSequenceIds[digit];
+ _digits[position] = digit;
+ }
+}
+
+void Scene51::initCashDisplay() {
+ for (int position = 0; position < 4; ++position) {
+ _digits[position] = 0;
+ _digitSequenceIds[position] = kDigitSequenceIds[0];
+ _vm->_gameSys->insertSequence(kDigitSequenceIds[0], 253, 0, 0,
+ kSeqNone, 0, kDigitPositions[position] - 20, -20);
+ }
+ _cashAmount = 0;
+}
+
+void Scene51::run() {
+ int soundCtr = 0;
+ bool isIdle = true;
+
+ _itemsCtr = 0;
+ _vm->_newSceneNum = _vm->_prevSceneNum;
+ _cashAmount = 0;
+ _platypusJumpSequenceId = 0x84;
+ _vm->endSceneInit();
+
+ _vm->hideCursor();
+ _vm->setGrabCursorSprite(-1);
+
+ _guySequenceId = 0xC3;
+ _guyNextSequenceId = -1;
+
+ _vm->_gameSys->insertSequence(0xC3, 39, 0, 0, kSeqNone, 0, 0, 0);
+ _vm->_timers[4] = _vm->getRandom(20) + 60;
+
+ playCashAppearAnim();
+ initCashDisplay();
+ playIntroAnim();
+
+ _platypusNextSequenceId = 0x74;
+ _vm->_gameSys->setAnimation(0x74, 256, 0);
+ _vm->_gameSys->insertSequence(_platypusNextSequenceId, 256, _platypusSequenceId, 256, kSeqSyncWait, 0, getPosRight(_platypusJumpSequenceId) - 362, 0);
+ _platypusSequenceId = _platypusNextSequenceId;
+
+ _itemInsertDirection = 0;
+ _itemInsertX = 685;
+ _dropSpeedTicks = 10;
+ _nextDropItemKind = 0;
+
+ for (int i = 0; i < 6; ++i)
+ clearItem(&_items[i]);
+
+ _itemInsertX = _vm->getRandom(556) + 129;
+ _vm->_timers[0] = 15;
+
+ _itemsCaughtCtr = 0;
+ _dropLoseCash = false;
+ _itemsCtr1 = 20;
+
+ _vm->clearKeyStatus1(Common::KEYCODE_RIGHT);
+ _vm->clearKeyStatus1(Common::KEYCODE_LEFT);
+ _vm->clearKeyStatus1(Common::KEYCODE_UP);
+ _vm->clearKeyStatus1(Common::KEYCODE_SPACE);
+ _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE);
+
+ bool isCollision = false;
+ bool startWalk = true;
+
+ while (!_vm->_sceneDone) {
+ if (clearKeyStatus())
+ _vm->_sceneDone = true;
+
+ _vm->gameUpdateTick();
+
+ updateGuyAnimation();
+ dropNextItem();
+ updateItemAnimations();
+
+ if (_vm->isKeyStatus2(Common::KEYCODE_UP) || _vm->isKeyStatus2(Common::KEYCODE_SPACE)) {
+ _vm->clearKeyStatus1(Common::KEYCODE_UP);
+ _vm->clearKeyStatus1(Common::KEYCODE_SPACE);
+ if (isJumpingRight(_platypusJumpSequenceId)) {
+ waitForAnim(0);
+ _vm->_gameSys->setAnimation(0xB8, 256, 0);
+ _vm->_gameSys->insertSequence(0xB8, 256, _platypusSequenceId, 256, kSeqSyncWait, 0, getPosRight(_platypusJumpSequenceId) - 348, 0);
+ _platypusSequenceId = 0xB8;
+ waitForAnim(0);
+ _platypusNextSequenceId += 6;
+ if (_platypusNextSequenceId > 0x95)
+ _platypusNextSequenceId = 0x95;
+ _platypusJumpSequenceId = _platypusNextSequenceId;
+ } else {
+ waitForAnim(0);
+ _vm->_gameSys->setAnimation(0xB9, 256, 0);
+ _vm->_gameSys->insertSequence(0xB9, 256, _platypusSequenceId, 256, kSeqSyncWait, 0, getPosLeft(_platypusJumpSequenceId) - 338, 0);
+ _platypusSequenceId = 0xB9;
+ waitForAnim(0);
+ _platypusNextSequenceId += 6;
+ if (_platypusNextSequenceId > 0xB5)
+ _platypusNextSequenceId = 0xB5;
+ _platypusJumpSequenceId = _platypusNextSequenceId;
+ }
+ isIdle = false;
+ }
+
+ while (_vm->isKeyStatus2(Common::KEYCODE_RIGHT) && _platypusNextSequenceId != 0x96) {
+ // pollMessages();
+ if (_platypusNextSequenceId == 0xB6)
+ _platypusNextSequenceId = 0x76;
+ updateItemAnimations();
+ if (startWalk) {
+ _platypusNextSequenceId = 0x86;
+ startWalk = false;
+ }
+
+ if (_vm->_gameSys->getAnimationStatus(0) == 2) {
+ int collisionX = checkCollision(_platypusNextSequenceId);
+ if (collisionX)
+ incCashAmount(_platypusNextSequenceId);
+ _vm->_gameSys->setAnimation(_platypusNextSequenceId, 256, 0);
+ _vm->_gameSys->insertSequence(_platypusNextSequenceId, 256, _platypusSequenceId, 256, kSeqSyncWait, 0, collisionX, 0);
+ _platypusSequenceId = _platypusNextSequenceId;
+ if (collisionX) {
+ isCollision = true;
+ ++_platypusJumpSequenceId;
+ _platypusNextSequenceId = _platypusJumpSequenceId;
+ } else {
+ _platypusJumpSequenceId = _platypusNextSequenceId;
+ }
+ if (isJumpingRight(_platypusJumpSequenceId)) {
+ ++_platypusNextSequenceId;
+ if (!isCollision) {
+ if (_vm->isKeyStatus2(Common::KEYCODE_UP) || _vm->isKeyStatus2(Common::KEYCODE_SPACE)) {
+ _vm->clearKeyStatus1(Common::KEYCODE_UP);
+ _vm->clearKeyStatus1(Common::KEYCODE_SPACE);
+ waitForAnim(0);
+ _vm->_gameSys->setAnimation(0xB8, 256, 0);
+ _vm->_gameSys->insertSequence(0xB8, 256, _platypusSequenceId, 256, kSeqSyncWait, 0, getPosRight(_platypusJumpSequenceId) - 348, 0);
+ _platypusSequenceId = 0xB8;
+ waitForAnim(0);
+ _platypusNextSequenceId += 6;
+ if (_platypusNextSequenceId > 0x95)
+ _platypusNextSequenceId = 0x95;
+ _platypusJumpSequenceId = _platypusNextSequenceId;
+ } else {
+ ++soundCtr;
+ if (soundCtr % 4 == 0)
+ _vm->playSound(214, false);
+ }
+ }
+ } else {
+ _platypusNextSequenceId = 150 - (_platypusJumpSequenceId - 150);
+ }
+ isCollision = false;
+ isIdle = false;
+ }
+ _vm->gameUpdateTick();
+ }
+
+ while (_vm->isKeyStatus2(Common::KEYCODE_LEFT) && _platypusNextSequenceId != 0xB6) {
+ // pollMessages();
+ updateItemAnimations();
+ if (startWalk) {
+ _platypusNextSequenceId = 0xA5;
+ startWalk = false;
+ }
+
+ if (_vm->_gameSys->getAnimationStatus(0) == 2) {
+ int collisionX = checkCollision(_platypusNextSequenceId);
+ if (collisionX)
+ incCashAmount(_platypusNextSequenceId);
+ _vm->_gameSys->setAnimation(_platypusNextSequenceId, 256, 0);
+ _vm->_gameSys->insertSequence(_platypusNextSequenceId, 256, _platypusSequenceId, 256, kSeqSyncWait, 0, collisionX, 0);
+ _platypusSequenceId = _platypusNextSequenceId;
+ if (collisionX) {
+ isCollision = true;
+ ++_platypusJumpSequenceId;
+ _platypusNextSequenceId = _platypusJumpSequenceId;
+ } else {
+ _platypusJumpSequenceId = _platypusNextSequenceId;
+ }
+ if (isJumpingLeft(_platypusJumpSequenceId)) {
+ ++_platypusNextSequenceId;
+ if (!isCollision) {
+ if (_vm->isKeyStatus2(Common::KEYCODE_UP) || _vm->isKeyStatus2(Common::KEYCODE_SPACE)) {
+ _vm->clearKeyStatus1(Common::KEYCODE_UP);
+ _vm->clearKeyStatus1(Common::KEYCODE_SPACE);
+ waitForAnim(0);
+ _vm->_gameSys->setAnimation(0xB9, 256, 0);
+ _vm->_gameSys->insertSequence(0xB9, 256, _platypusSequenceId, 256, kSeqSyncWait, 0, getPosLeft(_platypusJumpSequenceId) - 338, 0);
+ _platypusSequenceId = 0xB9;
+ waitForAnim(0);
+ _platypusNextSequenceId += 6;
+ if (_platypusNextSequenceId > 0xB5)
+ _platypusNextSequenceId = 0xB5;
+ _platypusJumpSequenceId = _platypusNextSequenceId;
+ } else {
+ ++soundCtr;
+ if (soundCtr % 4 == 0)
+ _vm->playSound(214, false);
+ }
+ }
+ } else {
+ _platypusNextSequenceId = 182 - (_platypusJumpSequenceId - 118);
+ }
+ isCollision = false;
+ isIdle = false;
+ }
+ _vm->gameUpdateTick();
+ }
+
+ if (!isIdle && _vm->_gameSys->getAnimationStatus(0) == 2) {
+ if (isJumpingRight(_platypusJumpSequenceId)) {
+ _vm->_gameSys->setAnimation(0x74, 256, 0);
+ _vm->_gameSys->insertSequence(0x74, 256, _platypusSequenceId, 256, kSeqSyncWait, 0, getPosRight(_platypusJumpSequenceId) - 362, 0);
+ _platypusSequenceId = 0x74;
+ } else {
+ _vm->_gameSys->setAnimation(0x75, 256, 0);
+ _vm->_gameSys->insertSequence(0x75, 256, _platypusSequenceId, 256, kSeqSyncWait, 0, getPosLeft(_platypusJumpSequenceId) - 341, 0);
+ _platypusSequenceId = 0x75;
+ }
+ waitForAnim(0);
+ isIdle = true;
+ }
+ }
+
+ _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE);
+ _vm->clearKeyStatus1(Common::KEYCODE_UP);
+ _vm->clearKeyStatus1(Common::KEYCODE_SPACE);
+ _vm->clearKeyStatus1(Common::KEYCODE_RIGHT);
+ _vm->clearKeyStatus1(Common::KEYCODE_LEFT);
+
+ _vm->_gameSys->setAnimation(0, 0, 0);
+ for (int i = 0; i < 6; ++i)
+ _vm->_gameSys->setAnimation(0, 0, i + 1);
+
+ _vm->showCursor();
+}
+
+/*****************************************************************************/
+
+Scene52::Scene52(GnapEngine *vm) : Scene(vm) {
+ _gameScore = 0;
+ _aliensInitialized = false;
+ _alienDirection = 0;
+ _soundToggle = false;
+}
+
+int Scene52::init() {
+ initAnims();
+ return 0x2B;
+}
+
+void Scene52::updateHotspots() {
+ _vm->_hotspotsCount = 0;
+}
+
+void Scene52::update() {
+ for (int rowNum = 0; rowNum < 7; ++rowNum) {
+ _vm->gameUpdateTick();
+ if (_vm->_gameSys->getAnimationStatus(_alienRowAnims[rowNum]) == 2) {
+ updateAlienRow(rowNum);
+ rowNum = 0;
+ }
+ }
+
+ if (_liveAlienRows == 0 && !_alienSingle) {
+ _alienWave = false;
+ _vm->playSound(48, false);
+ ++_alienCounter;
+ if (_alienCounter != 3) {
+ _vm->_timers[0] = 50;
+ _vm->_timers[2] = 100;
+ _alienRowDownCtr = 0;
+ _alienSingle = true;
+ }
+ }
+
+ if (_alienSingle && !_vm->_timers[0]) {
+ initAliens();
+ _alienSingle = false;
+ _vm->_timers[2] = 5;
+ _alienWave = true;
+ }
+
+ if ((_alienRowDownCtr || _liveAlienRows == 0) && !_alienSingle) {
+ moveDownAlienRow();
+ _alienRowDownCtr = 0;
+ }
+
+ if (_vm->isKeyStatus1(Common::KEYCODE_UP) || _vm->isKeyStatus1(Common::KEYCODE_SPACE)) {
+ _vm->clearKeyStatus1(Common::KEYCODE_SPACE);
+ _vm->clearKeyStatus1(Common::KEYCODE_UP);
+ if (!_aliensCount)
+ fireShipCannon(_shipPosX);
+ }
+
+ if (_shipCannonFiring)
+ updateShipCannon();
+
+ fireAlienCannon();
+ updateAlienCannons();
+
+ if (_aliensCount == 1) {
+ _alienWave = false;
+ _vm->_timers[3] = 20;
+ _vm->_timers[2] = 100;
+ ++_aliensCount;
+ }
+
+ if (_aliensCount && !_vm->_timers[3]) {
+ updateAliens();
+ loseShip();
+ if (_shipsLeft != 0) {
+ _vm->_timers[3] = 40;
+ while (_vm->_timers[3]) {
+ updateAlienCannons();
+ if (_shipCannonFiring)
+ updateShipCannon();
+ _vm->gameUpdateTick();
+ }
+ initAliens();
+ _shipPosX = (800 - _shipMidX) / 2;
+ _vm->_gameSys->setAnimation(_nextUfoSequenceId, 256, 7);
+ _vm->_gameSys->insertSequence(_nextUfoSequenceId, 256, 0, 0, kSeqNone, 0, _shipPosX, _arcadeScreenBottom);
+ _ufoSequenceId = _nextUfoSequenceId;
+ _vm->_timers[2] = 5;
+ _alienWave = true;
+ } else {
+ _vm->_sceneDone = true;
+ }
+ }
+
+ if (_vm->_timers[1] || getFreeShipCannon() == -1) {
+ _nextUfoSequenceId = 34;
+ if (_ufoSequenceId != 34)
+ _shipFlag = true;
+ } else {
+ _nextUfoSequenceId = 34;
+ if (_ufoSequenceId != 34)
+ _shipFlag = true;
+ }
+
+ if (_shipFlag) {
+ if (_vm->_gameSys->getAnimationStatus(7) == 2) {
+ _vm->_gameSys->setAnimation(_nextUfoSequenceId, 256, 7);
+ _vm->_gameSys->insertSequence(_nextUfoSequenceId, 256, _ufoSequenceId, 256, kSeqSyncWait, 0, _shipPosX, _arcadeScreenBottom);
+ _ufoSequenceId = _nextUfoSequenceId;
+ }
+ _shipFlag = false;
+ }
+
+ if (_alienWave && !_vm->_timers[0]) {
+ playSound();
+ int v0 = _alienSpeed;
+ if (_alienSpeed >= 10)
+ v0 = 10;
+ int v1 = v0;
+ if (v0 < 2)
+ v1 = 2;
+ _vm->_timers[0] = v1;
+ }
+}
+
+void Scene52::initShipCannon(int bottomY) {
+ _shipCannonFired = false;
+ _shipCannonWidth = MAX(_vm->_gameSys->getSpriteWidthById(14), _vm->_gameSys->getSpriteWidthById(16));
+ _shipCannonHeight = MAX(_vm->_gameSys->getSpriteHeightById(14), _vm->_gameSys->getSpriteHeightById(16));
+ _shipCannonTopY = bottomY - _shipCannonHeight;
+ _shipCannonFiring = false;
+}
+
+void Scene52::initAlienCannons() {
+ for (int i = 0; i < 3; ++i) {
+ _alienCannonIds[i] = 0;
+ _alienCannonFired[i] = 0;
+ }
+ _alienCannonSequenceIds[0] = 30;
+ _alienCannonSequenceIds[1] = 31;
+ _alienCannonSequenceIds[2] = 32;
+}
+
+void Scene52::fireShipCannon(int posX) {
+ if (_vm->_timers[1])
+ return;
+
+ int cannonNum = getFreeShipCannon();
+ if (cannonNum != -1) {
+ _shipCannonPosX = _shipMidX / 2 + posX - _shipCannonWidth / 2;
+ _shipCannonPosY = _shipCannonTopY;
+ _vm->_gameSys->setAnimation(0x23, cannonNum + 256, cannonNum + 8);
+ _vm->_gameSys->insertSequence(0x23, cannonNum + 256, 0, 0, kSeqNone, 0, _shipCannonPosX, _shipCannonPosY);
+ _vm->playSound(0x2D, false);
+ if (shipCannonHitShield(cannonNum)) {
+ _vm->_gameSys->setAnimation(0, 0, cannonNum + 8);
+ _vm->_gameSys->removeSequence(0x23, cannonNum + 256, true);
+ } else {
+ _shipCannonFired = true;
+ _shipCannonPosY -= 13;
+ _shipCannonFiring = true;
+ }
+ _vm->_timers[1] = 5;
+ }
+}
+
+void Scene52::fireAlienCannon() {
+ if (_vm->_timers[2])
+ return;
+
+ int cannonNum = getFreeAlienCannon();
+ if (cannonNum != -1) {
+ int alienX1 = _alienLeftX + _alienRowXOfs[0];
+ int alienX2 = _alienLeftX + _alienRowXOfs[0] + 5 * _alienWidth - (_alienWidth / 2 - 15);
+ _alienCannonPosX[cannonNum] = _vm->getRandom(alienX2 - alienX1) + alienX1;
+ _alienCannonPosY[cannonNum] = 104;
+ _alienCannonFired[cannonNum] = 1;
+ _vm->_gameSys->setAnimation(_alienCannonSequenceIds[cannonNum], _alienCannonIds[cannonNum] + 256, cannonNum + 9);
+ _vm->_gameSys->insertSequence(_alienCannonSequenceIds[cannonNum], _alienCannonIds[cannonNum] + 256, 0, 0,
+ kSeqNone, 0, _alienCannonPosX[cannonNum], _alienCannonPosY[cannonNum]);
+ _alienCannonPosY[cannonNum] -= 13;
+ _vm->_timers[2] = 5;
+ }
+}
+
+int Scene52::getFreeShipCannon() {
+ if (!_shipCannonFired)
+ return 0;
+ return -1;
+}
+
+int Scene52::getFreeAlienCannon() {
+ for (int i = 0; i < 3; ++i)
+ if (!_alienCannonFired[i])
+ return i;
+ return -1;
+}
+
+void Scene52::updateShipCannon() {
+ if (_shipCannonFired && _vm->_gameSys->getAnimationStatus(8) == 2) {
+ _shipCannonPosY -= 13;
+ if (_shipCannonPosY - 13 >= 135) {
+ if (updateHitAlien()) {
+ _vm->_gameSys->setAnimation(0, 0, 8);
+ _vm->_gameSys->removeSequence(35, 256, true);
+ _shipCannonFired = false;
+ drawScore(_gameScore);
+ } else {
+ _vm->_gameSys->setAnimation(35, 256, 8);
+ _vm->_gameSys->insertSequence(35, 256, 35, 256, kSeqSyncWait, 0, _shipCannonPosX, _shipCannonPosY);
+ _shipCannonPosY -= 13;
+ }
+ } else {
+ _vm->_gameSys->setAnimation(0, 0, 8);
+ _vm->_gameSys->removeSequence(35, 256, true);
+ _shipCannonFired = false;
+ }
+ }
+}
+
+void Scene52::updateAlienCannons() {
+ for (int i = 0; i < 3; ++i) {
+ if (_alienCannonFired[i] && _vm->_gameSys->getAnimationStatus(i + 9) == 2) {
+ _alienCannonPosY[i] += 13;
+ if (_shipCannonHeight + _alienCannonPosY[i] + 13 <= 550) {
+ if (alienCannonHitShip(i)) {
+ _vm->_gameSys->setAnimation(0, 0, i + 9);
+ _alienCannonFired[i] = 0;
+ shipExplode();
+ } else if (alienCannonHitShield(i)) {
+ _alienCannonFired[i] = 0;
+ } else {
+ _vm->_gameSys->insertSequence(_alienCannonSequenceIds[i], 1 - _alienCannonIds[i] + 256, 0, 0,
+ kSeqNone, 0, _alienCannonPosX[i], _alienCannonPosY[i]);
+ _vm->_gameSys->setAnimation(_alienCannonSequenceIds[i], 1 - _alienCannonIds[i] + 256, i + 9);
+ _alienCannonIds[i] = 1 - _alienCannonIds[i];
+ _alienCannonPosY[i] += 13;
+ }
+ } else {
+ _vm->_gameSys->setAnimation(0, 0, i + 9);
+ _alienCannonFired[i] = 0;
+ }
+ }
+ }
+}
+
+void Scene52::initAliens() {
+ if (!_aliensInitialized) {
+ initAlienSize();
+ _aliensInitialized = true;
+ }
+
+ _liveAlienRows = 0;
+ _alienSpeed = 0;
+ _bottomAlienFlag = false;
+ _aliensCount = 0;
+ _alienSingle = false;
+ _alienRowDownCtr = 0;
+
+ initShields();
+
+ _alienRowKind[0] = -1;
+ _alienRowKind[1] = -1;
+ _alienRowKind[2] = -1;
+ _alienRowKind[3] = -1;
+ _alienRowKind[4] = _vm->getRandom(2) != 0 ? 24 : 27;
+ _alienRowKind[5] = _vm->getRandom(2) != 0 ? 25 : 28;
+ _alienRowKind[6] = _vm->getRandom(2) != 0 ? 26 : 29;
+
+ for (int i = 0; i < 7; ++i) {
+ _alienRowAnims[i] = i;
+ _alienRowXOfs[i] = 0;
+ initAlienRowKind(i, _alienRowKind[i]);
+ insertAlienRow(i);
+ }
+}
+
+void Scene52::initAlienRowKind(int rowNum, int alienKind) {
+ for (int i = 0; i < 5; ++i)
+ _items[rowNum][i] = alienKind;
+}
+
+void Scene52::insertAlienRow(int rowNum) {
+ if (_alienRowKind[rowNum] >= 0) {
+ insertAlienRowAliens(rowNum);
+ _alienRowIds[rowNum] = 256;
+ _vm->_gameSys->setAnimation(_alienRowKind[rowNum], _alienRowIds[rowNum], _alienRowAnims[rowNum]);
+ ++_liveAlienRows;
+ }
+}
+
+void Scene52::insertAlienRowAliens(int rowNum) {
+ int xOffs = _alienLeftX;
+ int yOffs = _alienTopY - 52 * rowNum - _alienHeight + 10;
+ for (int i = 0; i < 5; ++i) {
+ if (_items[rowNum][i] >= 0) {
+ _vm->_gameSys->insertSequence(_items[rowNum][i], i + 256, 0, 0, kSeqNone, 0, xOffs, yOffs);
+ ++_alienSpeed;
+ }
+ xOffs += _alienWidth;
+ }
+}
+
+void Scene52::updateAlienRow(int rowNum) {
+ if (_alienRowKind[rowNum] != -1 && !checkAlienRow(rowNum)) {
+ updateAlienRowXOfs();
+ _alienRowIds[rowNum] = -1;
+ int xOffs = _alienLeftX + _alienRowXOfs[rowNum];
+ int yOffs = _alienTopY - 52 * rowNum - _alienHeight + 10;
+ for (int i = 0; i < 5; ++i) {
+ if (_items[rowNum][i] >= 0) {
+ _vm->_gameSys->insertSequence(_items[rowNum][i], i + 256, _items[rowNum][i], i + 256, kSeqSyncWait, 0, xOffs, yOffs);
+ if (_alienRowIds[rowNum] == -1)
+ _alienRowIds[rowNum] = i + 256;
+ } else if (_items[rowNum][i] == -2) {
+ _vm->_gameSys->removeSequence(_alienRowKind[rowNum], i + 256, true);
+ _items[rowNum][i] = -1;
+ --_alienSpeed;
+ }
+ xOffs += _alienWidth;
+ }
+ if (_alienRowIds[rowNum] == -1) {
+ _vm->_gameSys->setAnimation(0, 0, _alienRowAnims[rowNum]);
+ // MessageBoxA(0, "No live aliens!", "Error 3:", 0x30u);
+ } else {
+ _vm->_gameSys->setAnimation(_alienRowKind[rowNum], _alienRowIds[rowNum], _alienRowAnims[rowNum]);
+ }
+ if (rowNum == 1) {
+ for (int j = 0; j < 3; ++j) {
+ if (_shieldSpriteIds[j] != -1) {
+ _vm->_gameSys->fillSurface(0, _shieldPosX[j], _arcadeScreenBottom - 44, 33, 44, 0, 0, 0);
+ _shieldSpriteIds[j] = -1;
+ }
+ }
+ }
+ if (rowNum == 0 && _bottomAlienFlag)
+ shipExplode();
+ }
+}
+
+void Scene52::moveDownAlienRow() {
+ int v2[5], v3, v1, v0, v4;
+
+ for (int i = 0; i < 5; ++i)
+ v2[i] = _items[0][i];
+
+ v3 = _alienRowIds[0];
+ v1 = _alienRowAnims[0];
+ v0 = _alienRowKind[0];
+ v4 = _alienRowXOfs[0];
+
+ for (int j = 0; j < 7; ++j) {
+ for (int i = 0; i < 5; ++i)
+ _items[j][i] = _items[j + 1][i];
+ _alienRowIds[j] = _alienRowIds[j + 1];
+ _alienRowAnims[j] = _alienRowAnims[j + 1];
+ _alienRowKind[j] = _alienRowKind[j + 1];
+ _alienRowXOfs[j] = _alienRowXOfs[j + 1];
+ }
+
+ for (int i = 0; i < 5; ++i)
+ _items[6][i] = v2[i];
+
+ _alienRowIds[6] = v3;
+ _alienRowAnims[6] = v1;
+ _alienRowKind[6] = v0;
+ _alienRowXOfs[6] = v4;
+
+ updateAlien(6);
+ initAlienRowKind(6, _alienRowKind[6]);
+ insertAlienRow(6);
+
+ _bottomAlienFlag = _alienRowKind[0] > -1;
+}
+
+int Scene52::updateHitAlien() {
+ int result = 0, rowNum, ya;
+
+ int y = _shipCannonTopY - _shipCannonPosY;
+
+ if (y == 26) {
+ rowNum = 1;
+ ya = _shipCannonPosY + 26;
+ } else {
+ if (y % 52)
+ return 0;
+ rowNum = y / 52 + 1;
+ ya = _shipCannonPosY;
+ }
+
+ if (rowNum < 7) {
+ int hitAlienNum = getHitAlienNum(rowNum);
+ if (hitAlienNum != -1 && _items[rowNum][hitAlienNum] >= 0) {
+ _gameScore = ((_items[rowNum][hitAlienNum] - 24) % 3 + _gameScore + 1) % 1000;
+ _items[rowNum][hitAlienNum] = -2;
+ _vm->playSound(44, false);
+ _vm->_gameSys->insertSequence(0x21, 266, 0, 0,
+ kSeqNone, 0, _alienLeftX + hitAlienNum * _alienWidth + _alienRowXOfs[rowNum] - 10, ya - _alienHeight);
+ result = 1;
+ }
+ }
+
+ return result;
+}
+
+int Scene52::getHitAlienNum(int rowNum) {
+ int result = -1;
+
+ int v3 = _alienLeftX + _alienRowXOfs[rowNum];
+
+ if (_shipCannonPosX >= v3) {
+ int v8 = _alienWidth / 2 - 15;
+ if (v3 + 5 * _alienWidth - v8 >= _shipCannonPosX) {
+ int v4 = v3 + _alienWidth;
+ if (_shipCannonPosX >= v4 - v8) {
+ int v5 = v4 + _alienWidth;
+ if (_shipCannonPosX >= v5 - v8) {
+ int v6 = v5 + _alienWidth;
+ if (_shipCannonPosX >= v6 - v8) {
+ int v7 = v6 + _alienWidth;
+ if (_shipCannonPosX >= v7 - v8) {
+ if (_shipCannonPosX >= v7 + _alienWidth - v8)
+ result = -1;
+ else
+ result = 4;
+ } else {
+ result = 3;
+ }
+ } else {
+ result = 2;
+ }
+ } else {
+ result = 1;
+ }
+ } else {
+ result = 0;
+ }
+ } else {
+ result = -1;
+ }
+ } else {
+ result = -1;
+ }
+ return result;
+}
+
+int Scene52::alienCannonHitShip(int cannonNum) {
+ int result = 0;
+
+ if (_aliensCount) {
+ result = 0;
+ } else {
+ int cannonY = _alienCannonPosY[cannonNum] - 13;
+ if (_arcadeScreenBottom <= cannonY) {
+ if (_shipMidY + _arcadeScreenBottom > cannonY) {
+ if (_alienCannonPosX[cannonNum] >= _shipPosX)
+ result = _alienCannonPosX[cannonNum] < _shipMidX + _shipPosX;
+ else
+ result = 0;
+ } else {
+ result = 0;
+ }
+ } else {
+ result = 0;
+ }
+ }
+ return result;
+}
+
+int Scene52::alienCannonHitShield(int cannonNum) {
+ int result = 0;
+
+ int v3 = _alienCannonPosY[cannonNum] + 39;
+ if (_arcadeScreenBottom - 44 > v3)
+ return 0;
+
+ if (_arcadeScreenBottom <= v3)
+ return 0;
+
+ if (_alienCannonPosX[cannonNum] < _shieldPosX[0])
+ return 0;
+
+ if (_alienCannonPosX[cannonNum] > _shieldPosX[2] + 33)
+ return 0;
+
+ int shieldNum = -1;
+ if (_alienCannonPosX[cannonNum] < _shieldPosX[0] + 33)
+ shieldNum = 0;
+
+ if (shieldNum < 0 && _alienCannonPosX[cannonNum] < _shieldPosX[1])
+ return 0;
+
+ if (shieldNum < 0 && _alienCannonPosX[cannonNum] < _shieldPosX[1] + 33)
+ shieldNum = 1;
+
+ if (shieldNum < 0) {
+ if (_alienCannonPosX[cannonNum] < _shieldPosX[2])
+ return 0;
+ shieldNum = 2;
+ }
+
+ if (_shieldSpriteIds[shieldNum] == -1) {
+ result = 0;
+ } else {
+ ++_shieldSpriteIds[shieldNum];
+ if (_shieldSpriteIds[shieldNum] <= 21) {
+ _vm->_gameSys->drawSpriteToBackground(_shieldPosX[shieldNum], _arcadeScreenBottom - 44, _shieldSpriteIds[shieldNum]);
+ } else {
+ _vm->_gameSys->fillSurface(0, _shieldPosX[shieldNum], _arcadeScreenBottom - 44, 33, 44, 0, 0, 0);
+ _shieldSpriteIds[shieldNum] = -1;
+ }
+ _vm->_gameSys->setAnimation(0, 0, cannonNum + 9);
+ _vm->_gameSys->insertSequence(0x21, shieldNum + 257, 0, 0, kSeqNone, 0, _alienCannonPosX[cannonNum] - 18, _arcadeScreenBottom - 44);
+ _vm->playSound(0x2C, false);
+ result = 1;
+ }
+
+ return result;
+}
+
+bool Scene52::shipCannonHitShield(int cannonNum) {
+ bool result = false;
+
+ if (_shipCannonPosX < _shieldPosX[0])
+ return result;
+
+ if (_shipCannonPosX > _shieldPosX[2] + 33)
+ return result;
+
+ int shieldNum = -1;
+ if (_shipCannonPosX < _shieldPosX[0] + 33)
+ shieldNum = 0;
+
+ if (shieldNum < 0 && _shipCannonPosX < _shieldPosX[1])
+ return result;
+
+ if (shieldNum < 0 && _shipCannonPosX < _shieldPosX[1] + 33)
+ shieldNum = 1;
+
+ if (shieldNum < 0) {
+ if (_shipCannonPosX < _shieldPosX[2])
+ return result;
+ shieldNum = 2;
+ }
+
+ if (_shieldSpriteIds[shieldNum] == -1) {
+ result = false;
+ } else {
+ ++_shieldSpriteIds[shieldNum];
+ if (_shieldSpriteIds[shieldNum] <= 21) {
+ _vm->_gameSys->drawSpriteToBackground(_shieldPosX[shieldNum], _arcadeScreenBottom - 44, _shieldSpriteIds[shieldNum]);
+ } else {
+ _vm->_gameSys->fillSurface(0, _shieldPosX[shieldNum], _arcadeScreenBottom - 44, 33, 44, 0, 0, 0);
+ _shieldSpriteIds[shieldNum] = -1;
+ }
+ _vm->_gameSys->insertSequence(0x21, shieldNum + 257, 0, 0, kSeqNone, 0, _shipCannonPosX - 18, _arcadeScreenBottom - 44);
+ _vm->playSound(0x2C, false);
+ result = true;
+ }
+
+ return result;
+}
+
+bool Scene52::shipCannonHitAlien() {
+ bool result = false;
+
+ if (_aliensCount || checkAlienRow(0))
+ return false;
+
+ int alienNextX = _alienLeftX + _alienRowXOfs[0];
+ if (_shipMidX + _shipPosX >= alienNextX) {
+ int startX = _alienWidth / 2 - 15;
+ if (alienNextX + 5 * _alienWidth - startX >= _shipPosX) {
+ int alienNextDeltaX = alienNextX + _alienWidth;
+ if (_items[0][0] <= -1 || alienNextDeltaX - startX <= _shipPosX) {
+ alienNextDeltaX += _alienWidth;
+ if (_items[0][1] <= -1 || alienNextDeltaX - startX <= _shipPosX) {
+ alienNextDeltaX += _alienWidth;
+ if (_items[0][2] <= -1 || alienNextDeltaX - startX <= _shipPosX) {
+ alienNextDeltaX += _alienWidth;
+ if (_items[0][3] <= -1 || alienNextDeltaX - startX <= _shipPosX) {
+ alienNextDeltaX += _alienWidth;
+ result = _items[0][4] > -1 && alienNextDeltaX - startX > _shipPosX;
+ } else {
+ result = true;
+ }
+ } else {
+ result = true;
+ }
+ } else {
+ result = true;
+ }
+ } else {
+ result = true;
+ }
+ } else {
+ result = false;
+ }
+ } else {
+ result = false;
+ }
+
+ return result;
+}
+
+void Scene52::shipExplode() {
+ if (!_aliensCount) {
+ _vm->_gameSys->setAnimation(0, 0, 7);
+ _vm->_gameSys->removeSequence(_ufoSequenceId, 256, true);
+ _vm->playSound(44, false);
+ _vm->_gameSys->insertSequence(0x21, 266, 0, 0, kSeqNone, 0, _shipPosX, _arcadeScreenBottom);
+ _aliensCount = 1;
+ _vm->playSound(0x31, false);
+ }
+}
+
+bool Scene52::checkAlienRow(int rowNum) {
+ for (int i = 0; i < 5; ++i) {
+ if (_items[rowNum][i] >= 0)
+ return false;
+ }
+
+ bool found = false;
+ for (int j = 0; j < 5; ++j)
+ if (_items[rowNum][j] == -2) {
+ _vm->_gameSys->removeSequence(_alienRowKind[rowNum], j + 256, true);
+ _items[rowNum][j] = -1;
+ --_alienSpeed;
+ found = true;
+ }
+
+ if (found) {
+ _vm->_gameSys->setAnimation(0, 0, _alienRowAnims[rowNum]);
+ --_liveAlienRows;
+ }
+
+ if (_liveAlienRows < 0)
+ _liveAlienRows = 0;
+
+ return true;
+}
+
+void Scene52::updateAlienRowXOfs() {
+ int amount = 2 * (3 - _liveAlienRows) + 1;
+
+ if (_alienSpeed == 2)
+ amount *= 4;
+ else if (_alienSpeed == 1)
+ amount *= 10;
+
+ if (_alienDirection) {
+ for (int i = 0; i < 7; ++i) {
+ _alienRowXOfs[i] -= amount;
+ if (_alienRowXOfs[i] <= -100) {
+ _alienRowXOfs[i] = -100;
+ _alienDirection = 0;
+ ++_alienRowDownCtr;
+ }
+ }
+ } else {
+ for (int j = 0; j < 7; ++j) {
+ _alienRowXOfs[j] += amount;
+ if (_alienRowXOfs[j] >= 100) {
+ _alienRowXOfs[j] = 100;
+ _alienDirection = 1;
+ ++_alienRowDownCtr;
+ }
+ }
+ }
+}
+
+void Scene52::initAlienSize() {
+ _alienWidth = _vm->_gameSys->getSpriteWidthById(0);
+ if (_vm->_gameSys->getSpriteWidthById(1) > _alienWidth)
+ _alienWidth = _vm->_gameSys->getSpriteWidthById(1);
+ if (_vm->_gameSys->getSpriteWidthById(4) > _alienWidth)
+ _alienWidth = _vm->_gameSys->getSpriteWidthById(4);
+ if (_vm->_gameSys->getSpriteWidthById(5) > _alienWidth)
+ _alienWidth = _vm->_gameSys->getSpriteWidthById(5);
+ if (_vm->_gameSys->getSpriteWidthById(12) > _alienWidth)
+ _alienWidth = _vm->_gameSys->getSpriteWidthById(12);
+ if (_vm->_gameSys->getSpriteWidthById(13) > _alienWidth)
+ _alienWidth = _vm->_gameSys->getSpriteWidthById(13);
+
+ _alienHeight = _vm->_gameSys->getSpriteHeightById(0);
+ if (_vm->_gameSys->getSpriteHeightById(1) > _alienHeight)
+ _alienHeight = _vm->_gameSys->getSpriteHeightById(1);
+ if (_vm->_gameSys->getSpriteHeightById(4) > _alienHeight)
+ _alienHeight = _vm->_gameSys->getSpriteHeightById(4);
+ if (_vm->_gameSys->getSpriteHeightById(5) > _alienHeight)
+ _alienHeight = _vm->_gameSys->getSpriteHeightById(5);
+ if (_vm->_gameSys->getSpriteHeightById(12) > _alienHeight)
+ _alienHeight = _vm->_gameSys->getSpriteHeightById(12);
+ if (_vm->_gameSys->getSpriteHeightById(13) > _alienHeight)
+ _alienHeight = _vm->_gameSys->getSpriteHeightById(13);
+
+ _alienTopY = _shipCannonTopY + 52;
+ _alienLeftX = (800 - 5 * _alienWidth) / 2;
+}
+
+void Scene52::playSound() {
+ if (_soundToggle) {
+ _vm->playSound(0x2F, false);
+ _soundToggle = false;
+ } else {
+ _vm->playSound(0x2E, false);
+ _soundToggle = true;
+ }
+}
+
+void Scene52::updateAliens() {
+ for (int i = 0; i < 7; ++i)
+ updateAlien(i);
+}
+
+void Scene52::updateAlien(int rowNum) {
+ if (_alienRowKind[rowNum] >= 0 && !checkAlienRow(rowNum)) {
+ for (int i = 0; i < 5; ++i) {
+ if (_items[rowNum][i] >= 0)
+ _items[rowNum][i] = -2;
+ }
+ checkAlienRow(rowNum);
+ }
+}
+
+void Scene52::loseShip() {
+ --_shipsLeft;
+ if (_shipsLeft == 2) {
+ _vm->_gameSys->fillSurface(0, 120, 140, _shipMidX, _shipMidY, 0, 0, 0);
+ } else if (_shipsLeft == 1) {
+ _vm->_gameSys->fillSurface(0, 120, 185, _shipMidX, _shipMidY, 0, 0, 0);
+ }
+}
+
+void Scene52::initShields() {
+ for (int i = 0; i < 3; ++i) {
+ _vm->_gameSys->drawSpriteToBackground(_shieldPosX[i], _arcadeScreenBottom - 44, 17);
+ _shieldSpriteIds[i] = 17;
+ }
+}
+
+void Scene52::initAnims() {
+ for (int i = 0; i < 7; ++i)
+ _vm->_gameSys->setAnimation(0, 0, i);
+ _vm->_gameSys->setAnimation(0, 0, 7);
+ for (int j = 0; j < 1; ++j)
+ _vm->_gameSys->setAnimation(0, 0, j + 8);
+ for (int k = 0; k < 3; ++k)
+ _vm->_gameSys->setAnimation(0, 0, k + 9);
+}
+
+void Scene52::drawScore(int score) {
+ char str[4];
+ sprintf(str, "%03d", score);
+ _vm->_gameSys->fillSurface(0, 420, 80, 48, 30, 0, 0, 0);
+ _vm->_gameSys->drawTextToSurface(0, 420, 80, 255, 255, 255, str);
+}
+
+void Scene52::run() {
+ _vm->_timers[1] = 0;
+
+ _vm->hideCursor();
+
+ // TODO loadFont("maturasc", "Matura MT Script Capitals", 2000);
+ // TODO setFontSize(24);
+
+ _gameScore = 0;
+ _vm->_gameSys->drawTextToSurface(0, 300, 80, 255, 255, 255, "SCORE");
+ _vm->_gameSys->drawTextToSurface(0, 468, 80, 255, 255, 255, "0");
+
+ drawScore(0);
+
+ _shipMidX = 33;
+ _shipMidY = _vm->_gameSys->getSpriteHeightById(15);
+ _shipPosX = (800 - _shipMidX) / 2;
+ _arcadeScreenBottom = 496;
+ _arcadeScreenRight = 595 - _shipMidX;
+ _arcadeScreenLeft = 210;
+ _shipsLeft = 3;
+ _alienCounter = 0;
+
+ _shieldPosX[0] = 247;
+ _shieldPosX[1] = 387;
+ _shieldPosX[2] = 525;
+
+ for (int i = 0; i < 3; ++i)
+ _shieldSpriteIds[i] = -1;
+
+ _vm->_gameSys->drawSpriteToBackground(120, 140, 0xF);
+ _vm->_gameSys->drawSpriteToBackground(120, 185, 0xF);
+
+ initShipCannon(_arcadeScreenBottom);
+ initAlienCannons();
+ initAliens();
+
+ _nextUfoSequenceId = 0x22;
+ _vm->_gameSys->setAnimation(0x22, 256, 7);
+ _vm->_gameSys->insertSequence(_nextUfoSequenceId, 256, 0, 0, kSeqNone, 0, _shipPosX, _arcadeScreenBottom);
+
+ _ufoSequenceId = _nextUfoSequenceId;
+
+ _vm->clearKeyStatus1(Common::KEYCODE_RIGHT);
+ _vm->clearKeyStatus1(Common::KEYCODE_LEFT);
+ _vm->clearKeyStatus1(Common::KEYCODE_SPACE);
+ _vm->clearKeyStatus1(Common::KEYCODE_UP);
+ _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE);
+
+ _vm->_timers[2] = 5;
+ _shipFlag = false;
+
+ _vm->_timers[0] = 10;
+ _alienWave = true;
+
+ while (!_vm->_sceneDone) {
+ _vm->gameUpdateTick();
+
+ while (_vm->isKeyStatus2(Common::KEYCODE_RIGHT)) {
+ update();
+ if (_vm->_gameSys->getAnimationStatus(7) == 2) {
+ if (_shipPosX < _arcadeScreenRight) {
+ _shipPosX += 15;
+ if (_shipPosX > _arcadeScreenRight)
+ _shipPosX = _arcadeScreenRight;
+ _vm->_gameSys->setAnimation(_nextUfoSequenceId, 256, 7);
+ _vm->_gameSys->insertSequence(_nextUfoSequenceId, 256, _ufoSequenceId, 256, kSeqSyncWait, 0, _shipPosX, _arcadeScreenBottom);
+ _ufoSequenceId = _nextUfoSequenceId;
+ if (_bottomAlienFlag && shipCannonHitAlien())
+ shipExplode();
+ }
+ break;
+ }
+ }
+
+ while (_vm->isKeyStatus2(Common::KEYCODE_LEFT)) {
+ update();
+ if (_vm->_gameSys->getAnimationStatus(7) == 2) {
+ if (_shipPosX > _arcadeScreenLeft) {
+ _shipPosX -= 15;
+ if (_shipPosX < _arcadeScreenLeft)
+ _shipPosX = _arcadeScreenLeft;
+ _vm->_gameSys->setAnimation(_nextUfoSequenceId, 256, 7);
+ _vm->_gameSys->insertSequence(_nextUfoSequenceId, 256, _ufoSequenceId, 256, kSeqSyncWait, 0, _shipPosX, _arcadeScreenBottom);
+ _ufoSequenceId = _nextUfoSequenceId;
+ if (_bottomAlienFlag && shipCannonHitAlien())
+ shipExplode();
+ }
+ break;
+ }
+ }
+
+ update();
+
+ if (clearKeyStatus()) {
+ _alienWave = false;
+ _vm->_gameSys->waitForUpdate();
+ initAnims();
+ _vm->clearKeyStatus1(30);
+ _vm->_sceneDone = true;
+ }
+ }
+
+ // TODO freeFont();
+
+ _vm->_gameSys->waitForUpdate();
+}
+
+} // End of namespace Gnap
diff --git a/engines/gnap/scenes/arcade.h b/engines/gnap/scenes/arcade.h
new file mode 100644
index 0000000000..4255a2d6b0
--- /dev/null
+++ b/engines/gnap/scenes/arcade.h
@@ -0,0 +1,290 @@
+/* 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 _arcadeScreenLeft;
+ int _arcadeScreenRight;
+ 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[7];
+ int _alienRowAnims[7];
+ int _alienRowIds[7];
+ int _alienRowXOfs[7];
+ 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
diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp
index 7bb296147f..90cb91f393 100644
--- a/engines/gnap/scenes/group4.cpp
+++ b/engines/gnap/scenes/group4.cpp
@@ -2926,501 +2926,4 @@ void Scene46::updateAnimations() {
}
}
-/*****************************************************************************/
-
-static const ObstacleDef kObstacleDefs[] = {
- {0xB4, 15}, {0xCB, 14}, {0xCD, 13}, {0xCF, 15}, {0xBA, 14},
- {0xCD, 13}, {0xCF, 12}, {0xCB, 15}, {0xBD, 13}, {0xCF, 12},
- {0xCD, 11}, {0xCB, 15}, {0xB7, 12}, {0xCD, 11}, {0xCB, 10},
- {0xCF, 15}, {0xCF, 14}, {0xBD, 13}, {0xCF, 12}, {0xCD, 11},
- {0xCB, 15}, {0xCB, 13}, {0xB4, 12}, {0xCB, 11}, {0xCD, 10},
- {0xCF, 15}, {0xCD, 12}, {0xBA, 12}, {0xCD, 12}, {0xCF, 12},
- {0xCB, 15}, {0xCB, 9}, {0xCD, 9}, {0xCF, 9}, {0xCD, 9},
- {0xCB, 9}, {0xCD, 9}, {0xCF, 5}, {0xBD, 13}, {0xCF, 8},
- {0xCB, 8}, {0xCD, 15}, {0xB4, 1}, {0xBD, 7}, {0xCF, 7},
- {0xCD, 7}, {0xCB, 7}, {0xCD, 7}, {0xCF, 15}, {0xCF, 15}
-};
-
-Scene49::Scene49(GnapEngine *vm) : Scene(vm) {
- _scoreBarFlash = false;
- _scoreBarPos = -1;
- _scoreLevel = -1;
- _obstacleIndex = -1;
- _truckSequenceId = -1;
- _truckId = -1;
- _truckLaneNum = -1;
-
- for (int i = 0; i < 5; i++) {
- _obstacles[i]._currSequenceId = -1;
- _obstacles[i]._closerSequenceId = -1;
- _obstacles[i]._passedSequenceId = -1;
- _obstacles[i]._splashSequenceId = -1;
- _obstacles[i]._collisionSequenceId = -1;
- _obstacles[i]._prevId = -1;
- _obstacles[i]._currId = -1;
- _obstacles[i]._laneNum = -1;
- }
-}
-
-int Scene49::init() {
- GameSys gameSys = *_vm->_gameSys;
-
- gameSys.setAnimation(0, 0, 0);
- gameSys.setAnimation(0, 0, 1);
- for (int i = 0; i < 5; ++i)
- gameSys.setAnimation(0, 0, i + 2);
- _vm->_timers[2] = 0;
- _vm->_timers[0] = 0;
- _vm->_timers[1] = 0;
- _vm->clearKeyStatus1(28);
- _vm->clearKeyStatus1(54);
- _vm->clearKeyStatus1(52);
- return 0xD5;
-}
-
-void Scene49::updateHotspots() {
- _vm->_hotspotsCount = 0;
-}
-
-void Scene49::checkObstacles() {
- if (_vm->_timers[2] == 0) {
- if (_vm->_timers[3] == 0) {
- for (int i = 0; i < 5; ++i)
- clearObstacle(i);
- }
-
- for (int j = 0; j < 5; ++j) {
- if (_obstacles[j]._currSequenceId == 0) {
- _vm->_timers[3] = 35;
- _obstacles[j]._currSequenceId = kObstacleDefs[_obstacleIndex]._sequenceId;
- switch (_obstacles[j]._currSequenceId) {
- case 0xB4:
- _obstacles[j]._laneNum = 1;
- _obstacles[j]._closerSequenceId = 180;
- _obstacles[j]._passedSequenceId = 181;
- _obstacles[j]._splashSequenceId = 182;
- _obstacles[j]._collisionSequenceId = 192;
- break;
- case 0xB7:
- _obstacles[j]._laneNum = 2;
- _obstacles[j]._closerSequenceId = 183;
- _obstacles[j]._passedSequenceId = 184;
- _obstacles[j]._splashSequenceId = 185;
- _obstacles[j]._collisionSequenceId = 193;
- break;
- case 0xBD:
- _obstacles[j]._laneNum = 3;
- _obstacles[j]._closerSequenceId = 189;
- _obstacles[j]._passedSequenceId = 190;
- _obstacles[j]._splashSequenceId = 191;
- _obstacles[j]._collisionSequenceId = 195;
- break;
- case 0xBA:
- _obstacles[j]._laneNum = 2;
- _obstacles[j]._closerSequenceId = 186;
- _obstacles[j]._passedSequenceId = 187;
- _obstacles[j]._splashSequenceId = 188;
- _obstacles[j]._collisionSequenceId = 194;
- break;
- case 0xCB:
- _obstacles[j]._laneNum = 1;
- _obstacles[j]._closerSequenceId = 203;
- _obstacles[j]._passedSequenceId = 204;
- _obstacles[j]._splashSequenceId = 0;
- _obstacles[j]._collisionSequenceId = 209;
- break;
- case 0xCD:
- _obstacles[j]._laneNum = 2;
- _obstacles[j]._closerSequenceId = 205;
- _obstacles[j]._passedSequenceId = 206;
- _obstacles[j]._splashSequenceId = 0;
- _obstacles[j]._collisionSequenceId = 210;
- break;
- case 0xCF:
- _obstacles[j]._laneNum = 3;
- _obstacles[j]._closerSequenceId = 207;
- _obstacles[j]._passedSequenceId = 208;
- _obstacles[j]._splashSequenceId = 0;
- _obstacles[j]._collisionSequenceId = 211;
- break;
- }
- _obstacles[j]._prevId = _truckId;
- _obstacles[j]._currId = _obstacles[j]._prevId;
- _vm->_gameSys->setAnimation(_obstacles[j]._currSequenceId, _obstacles[j]._currId, j + 2);
- _vm->_gameSys->insertSequence(_obstacles[j]._currSequenceId, _obstacles[j]._currId, 0, 0, kSeqNone, 0, 0, -50);
- _vm->_timers[2] = kObstacleDefs[_obstacleIndex]._ticks;
- ++_obstacleIndex;
- if (_obstacleIndex == 50)
- _obstacleIndex = 0;
- break;
- }
- }
- }
-}
-
-void Scene49::updateObstacle(int id) {
- GameSys gameSys = *_vm->_gameSys;
- Scene49Obstacle &obstacle = _obstacles[id];
-
- obstacle._currId = obstacle._prevId;
-
- switch (obstacle._laneNum) {
- case 1:
- obstacle._prevId = _truckId + 1;
- break;
- case 2:
- if (_truckLaneNum != 2 && _truckLaneNum != 3)
- obstacle._prevId = _truckId - 1;
- else
- obstacle._prevId = _truckId + 1;
- break;
- case 3:
- if (_truckLaneNum != 1 && _truckLaneNum != 2)
- obstacle._prevId = _truckId;
- else
- obstacle._prevId = _truckId - 1;
- break;
- }
-
- if (obstacle._currSequenceId == obstacle._closerSequenceId) {
- if (_truckLaneNum == obstacle._laneNum) {
- if (obstacle._splashSequenceId) {
- gameSys.setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2);
- gameSys.insertSequence(obstacle._collisionSequenceId, obstacle._prevId,
- obstacle._currSequenceId, obstacle._currId,
- kSeqSyncWait, 0, 0, -50);
- obstacle._currSequenceId = obstacle._collisionSequenceId;
- _vm->playSound(224, false);
- increaseScore(30);
- } else if ((obstacle._laneNum == 1 && _truckSequenceId == 0xB0) ||
- (obstacle._laneNum == 2 && (_truckSequenceId == 0xB1 || _truckSequenceId == 0xB2)) ||
- (obstacle._laneNum == 3 && _truckSequenceId == 0xB3)) {
- gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2);
- gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId,
- obstacle._currSequenceId, obstacle._currId,
- kSeqSyncWait, 0, 0, -50);
- obstacle._currSequenceId = obstacle._passedSequenceId;
- } else {
- gameSys.setAnimation(obstacle._collisionSequenceId, 256, 0);
- gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2);
- gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId,
- obstacle._currSequenceId, obstacle._currId,
- kSeqSyncWait, 0, 0, -50);
- gameSys.insertSequence(obstacle._collisionSequenceId, 256,
- _truckSequenceId, _truckId,
- kSeqSyncExists, 0, 0, -50);
- _truckSequenceId = obstacle._collisionSequenceId;
- _truckId = 256;
- obstacle._currSequenceId = obstacle._passedSequenceId;
- _vm->playSound(225, false);
- decreaseScore(30);
- }
- } else {
- gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2);
- gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId,
- obstacle._currSequenceId, obstacle._currId,
- kSeqSyncWait, 0, 0, -50);
- obstacle._currSequenceId = obstacle._passedSequenceId;
- }
- } else if (obstacle._currSequenceId == obstacle._passedSequenceId) {
- if (_truckLaneNum == obstacle._laneNum) {
- if (obstacle._splashSequenceId) {
- gameSys.setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2);
- gameSys.insertSequence(obstacle._collisionSequenceId, obstacle._prevId,
- obstacle._currSequenceId, obstacle._currId,
- kSeqSyncWait, 0, 0, -50);
- obstacle._currSequenceId = obstacle._collisionSequenceId;
- _vm->playSound(224, false);
- increaseScore(30);
- }
- } else if (obstacle._splashSequenceId) {
- gameSys.setAnimation(obstacle._splashSequenceId, obstacle._prevId, id + 2);
- gameSys.insertSequence(obstacle._splashSequenceId, obstacle._prevId,
- obstacle._currSequenceId, obstacle._currId,
- kSeqSyncWait, 0, 0, -50);
- obstacle._currSequenceId = obstacle._splashSequenceId;
- }
- } else {
- gameSys.setAnimation(0, 0, id + 2);
- clearObstacle(id);
- }
-}
-
-void Scene49::increaseScore(int amount) {
- if (_scoreBarPos + amount <= 556) {
- _scoreBarPos += amount;
- _vm->_gameSys->fillSurface(0, _scoreBarPos, 508, amount, 22, 255, 0, 0);
- }
- _scoreLevel = _scoreBarPos + amount >= 556;
-}
-
-void Scene49::decreaseScore(int amount) {
- if (_scoreBarPos >= 226 && _scoreLevel == 0) {
- if (_scoreBarFlash)
- refreshScoreBar();
- _vm->_gameSys->fillSurface(0, _scoreBarPos, 508, amount, 22, 89, 0, 5);
- _scoreBarPos -= amount;
- _scoreLevel = 0;
- }
-}
-
-void Scene49::refreshScoreBar() {
- if (_scoreBarFlash)
- _vm->_gameSys->fillSurface(0, 226, 508, 330, 22, 255, 0, 0);
- else
- _vm->_gameSys->fillSurface(0, 226, 508, 330, 22, 89, 0, 5);
- _scoreBarFlash = !_scoreBarFlash;
-}
-
-void Scene49::clearObstacle(int index) {
- _obstacles[index]._currSequenceId = 0;
- _obstacles[index]._closerSequenceId = 0;
- _obstacles[index]._passedSequenceId = 0;
- _obstacles[index]._splashSequenceId = 0;
- _obstacles[index]._collisionSequenceId = 0;
- _obstacles[index]._prevId = 0;
- _obstacles[index]._currId = 0;
- _obstacles[index]._laneNum = 0;
-}
-
-void Scene49::run() {
- GameSys gameSys = *_vm->_gameSys;
-
- bool animToggle6 = false;
- bool animToggle5 = false;
- bool animToggle4 = false;
- bool animToggle3 = false;
- bool streetAnimToggle = false;
- bool bgAnimToggle = false;
-
- _vm->playSound(0xE2, true);
- _vm->setSoundVolume(0xE2, 75);
-
- _vm->hideCursor();
- _vm->setGrabCursorSprite(-1);
-
- _scoreBarPos = 196;
- _scoreLevel = 0;
- _scoreBarFlash = false;
-
- switch (_vm->getRandom(3)) {
- case 0:
- _truckSequenceId = 0xAD;
- _truckLaneNum = 1;
- break;
- case 1:
- _truckSequenceId = 0xAE;
- _truckLaneNum = 2;
- break;
- case 2:
- _truckSequenceId = 0xAF;
- _truckLaneNum = 3;
- break;
- }
-
- int bgWidth1 = gameSys.getSpriteWidthById(0x5E);
- int bgX1 = 600;
-
- int bgWidth2 = gameSys.getSpriteWidthById(0x5F);
- int bgX2 = 400;
-
- int bgWidth3 = gameSys.getSpriteWidthById(4);
- int bgX3 = 700;
-
- int bgWidth4 = gameSys.getSpriteWidthById(5);
- int bgX4 = 500;
-
- int bgWidth5 = gameSys.getSpriteWidthById(6);
- int bgX5 = 300;
-
- int bgWidth6 = gameSys.getSpriteWidthById(7);
- int bgX6 = 100;
-
- gameSys.setAnimation(0xC8, 251, 1);
- gameSys.setAnimation(_truckSequenceId, 256, 0);
- gameSys.insertSequence(0xC9, 256, 0, 0, kSeqNone, 0, 600, 85);
- gameSys.insertSequence(0xCA, 257, 0, 0, kSeqNone, 0, 400, 100);
- gameSys.insertSequence(0xC4, 256, 0, 0, kSeqNone, 0, 700, 140);
- gameSys.insertSequence(0xC5, 257, 0, 0, kSeqNone, 0, 500, 160);
- gameSys.insertSequence(0xC6, 258, 0, 0, kSeqNone, 0, 300, 140);
- gameSys.insertSequence(0xC7, 259, 0, 0, kSeqNone, 0, 100, 140);
- gameSys.insertSequence(0xC8, 251, 0, 0, kSeqNone, 0, 0, -50);
- gameSys.insertSequence(_truckSequenceId, 256, 0, 0, kSeqNone, 0, 0, -50);
-
- _vm->_timers[0] = 2;
-
- for (int i = 0; i < 5; ++i)
- clearObstacle(i);
-
- _obstacleIndex = 0;
-
- _vm->_timers[2] = _vm->getRandom(20) + 10;
-
- _truckId = 256;
- _vm->_timers[3] = 35;
-
- while (!_vm->_sceneDone) {
- if (_vm->_timers[0] == 0) {
- // Update background animations (clouds etc.)
- --bgX1;
- bgX2 -= 2;
- bgX3 -= 5;
- --bgX4;
- --bgX5;
- --bgX6;
- if (bgX1 <= -bgWidth1)
- bgX1 = 799;
- if (bgX2 <= -bgWidth2)
- bgX2 = 799;
- if (bgX3 <= -bgWidth3)
- bgX3 = 799;
- if (bgX4 <= -bgWidth4)
- bgX4 = 799;
- if (bgX5 <= -bgWidth5)
- bgX5 = 799;
- if (bgX6 <= -bgWidth6)
- bgX6 = 799;
- bgAnimToggle = !bgAnimToggle;
- gameSys.insertSequence(0xC9, (bgAnimToggle ? 1 : 0) + 256, 0xC9, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX1, 85);
- gameSys.insertSequence(0xCA, (bgAnimToggle ? 1 : 0) + 257, 0xCA, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX2, 100);
- gameSys.insertSequence(0xC4, (bgAnimToggle ? 1 : 0) + 256, 0xC4, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX3, 140);
- gameSys.insertSequence(0xC5, (bgAnimToggle ? 1 : 0) + 257, 0xC5, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX4, 160);
- gameSys.insertSequence(0xC6, (bgAnimToggle ? 1 : 0) + 258, 0xC6, (bgAnimToggle ? 0 : 1) + 258, kSeqSyncWait, 0, bgX5, 140);
- gameSys.insertSequence(0xC7, (bgAnimToggle ? 1 : 0) + 259, 0xC7, (bgAnimToggle ? 0 : 1) + 259, kSeqSyncWait, 0, bgX6, 140);
- _vm->_timers[0] = 2;
- }
-
- if (gameSys.getAnimationStatus(1) == 2) {
- streetAnimToggle = !streetAnimToggle;
- gameSys.setAnimation(0xC8, (streetAnimToggle ? 1 : 0) + 251, 1);
- gameSys.insertSequence(0xC8, (streetAnimToggle ? 1 : 0) + 251, 200, (streetAnimToggle ? 0 : 1) + 251, kSeqSyncWait, 0, 0, -50);
- }
-
- checkObstacles();
-
- if (gameSys.getAnimationStatus(0) == 2) {
- switch (_truckSequenceId) {
- case 0xB1:
- _truckLaneNum = 1;
- break;
- case 0xB0:
- case 0xB3:
- _truckLaneNum = 2;
- break;
- case 0xB2:
- _truckLaneNum = 3;
- break;
- }
- animToggle3 = !animToggle3;
- if (_truckLaneNum == 1) {
- gameSys.setAnimation(0xAD, (animToggle3 ? 1 : 0) + 256, 0);
- gameSys.insertSequence(0xAD, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50);
- _truckSequenceId = 0xAD;
- } else if (_truckLaneNum == 2) {
- gameSys.setAnimation(0xAE, (animToggle3 ? 1 : 0) + 256, 0);
- gameSys.insertSequence(0xAE, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50);
- _truckSequenceId = 0xAE;
- } else {
- gameSys.setAnimation(0xAF, (animToggle3 ? 1 : 0) + 256, 0);
- gameSys.insertSequence(0xAF, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50);
- _truckSequenceId = 0xAF;
- }
- _truckId = (animToggle3 ? 1 : 0) + 256;
- if (_scoreLevel == 1) {
- if (!gameSys.isSequenceActive(0xD4, 266)) {
- gameSys.setAnimation(0xD4, 266, 8);
- gameSys.insertSequence(0xD4, 266, 0, 0, kSeqNone, 0, 0, -50);
- }
- ++_scoreLevel;
- _vm->_timers[1] = 2;
- animToggle4 = false;
- animToggle5 = false;
- animToggle6 = false;
- _scoreBarFlash = false;
- }
- }
-
- if (_scoreLevel != 0 && !_vm->_timers[1]) {
- refreshScoreBar();
- _vm->_timers[1] = 8;
- if (animToggle6) {
- if (animToggle5) {
- if (animToggle4 && !gameSys.isSequenceActive(212, 266))
- gameSys.insertSequence(212, 266, 0, 0, kSeqNone, 0, 0, -50);
- animToggle4 = !animToggle4;
- }
- animToggle5 = !animToggle5;
- }
- animToggle6 = !animToggle6;
- }
-
- updateAnimations();
-
- if (clearKeyStatus()) {
- _vm->_sceneDone = true;
- _vm->_newSceneNum = 2;
- _vm->_newCursorValue = 1;
- }
-
- if (_vm->isKeyStatus1(Common::KEYCODE_RIGHT)) {
- // Steer right
- if (_truckSequenceId == 0xB3)
- _truckLaneNum = 2;
- if (_truckSequenceId == 0xB1)
- _truckLaneNum = 1;
- if (_truckLaneNum != 3 && _truckLaneNum != 2) {
- if (_scoreLevel) {
- _vm->_sceneDone = true;
- _vm->_newSceneNum = 47;
- }
- } else {
- int steerSequenceId = (_truckLaneNum == 3) ? 0xB3 : 0xB1;
- if (_truckSequenceId == 0xAE || _truckSequenceId == 0xAF) {
- gameSys.setAnimation(steerSequenceId, 256, 0);
- gameSys.insertSequence(steerSequenceId, 256, _truckSequenceId, _truckId, kSeqSyncExists, 0, 0, -50);
- _truckSequenceId = steerSequenceId;
- _truckId = 256;
- }
- }
- _vm->clearKeyStatus1(Common::KEYCODE_RIGHT);
- }
-
- if (_vm->isKeyStatus1(Common::KEYCODE_LEFT)) {
- // Steer left
- if (_truckSequenceId == 0xB0)
- _truckLaneNum = 2;
- if (_truckSequenceId == 0xB2)
- _truckLaneNum = 3;
- if (_truckLaneNum == 1 || _truckLaneNum == 2) {
- int steerSequenceId = (_truckLaneNum == 1) ? 0xB0 : 0xB2;
- if (_truckSequenceId == 0xAD || _truckSequenceId == 0xAE) {
- gameSys.setAnimation(steerSequenceId, 256, 0);
- gameSys.insertSequence(steerSequenceId, 256, _truckSequenceId, _truckId, kSeqSyncExists, 0, 0, -50);
- _truckSequenceId = steerSequenceId;
- _truckId = 256;
- }
- }
- _vm->clearKeyStatus1(Common::KEYCODE_LEFT);
- }
- _vm->gameUpdateTick();
- }
- _vm->stopSound(0xE2);
-}
-
-void Scene49::updateAnimations() {
- GameSys gameSys = *_vm->_gameSys;
-
- for (int i = 0; i < 5; ++i) {
- if (gameSys.getAnimationStatus(i + 2) == 2) {
- if (_obstacles[i]._currSequenceId)
- updateObstacle(i);
- }
- }
-
- if (gameSys.getAnimationStatus(8) == 2) {
- _vm->_sceneDone = true;
- _vm->_newSceneNum = 47;
- }
-}
-
} // End of namespace Gnap
diff --git a/engines/gnap/scenes/group4.h b/engines/gnap/scenes/group4.h
index db73bbddc4..28f03eec6d 100644
--- a/engines/gnap/scenes/group4.h
+++ b/engines/gnap/scenes/group4.h
@@ -143,51 +143,6 @@ private:
int _currItchyGuySequenceId;
};
-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);
-};
-
} // End of namespace Gnap
#endif // GNAP_GROUP4_H
diff --git a/engines/gnap/scenes/scene53.cpp b/engines/gnap/scenes/group5.cpp
index 7c461464be..68b957f753 100644
--- a/engines/gnap/scenes/scene53.cpp
+++ b/engines/gnap/scenes/group5.cpp
@@ -23,33 +23,33 @@
#include "gnap/gnap.h"
#include "gnap/gamesys.h"
#include "gnap/resource.h"
-#include "gnap/scenes/scene53.h"
+#include "gnap/scenes/group5.h"
namespace Gnap {
enum {
- kHSPlatypus = 0,
- kHSDevice = 1,
- kHSPhoneKey1 = 2,
- kHSPhoneKey2 = 3,
- kHSPhoneKey3 = 4,
- kHSPhoneKey4 = 5,
- kHSPhoneKey5 = 6,
- kHSPhoneKey6 = 7,
- kHSPhoneKey7 = 8,
- kHSPhoneKey8 = 9,
- kHSPhoneKey9 = 10,
- kHSPhoneKey0 = 11,
- kHSPhoneKeySharp = 12,
- kHSPhoneKeyStar = 13,
- kHSPhoneExit = 14
+ kHS53Platypus = 0,
+ kHS53Device = 1,
+ kHS53PhoneKey1 = 2,
+ kHS53PhoneKey2 = 3,
+ kHS53PhoneKey3 = 4,
+ kHS53PhoneKey4 = 5,
+ kHS53PhoneKey5 = 6,
+ kHS53PhoneKey6 = 7,
+ kHS53PhoneKey7 = 8,
+ kHS53PhoneKey8 = 9,
+ kHS53PhoneKey9 = 10,
+ kHS53PhoneKey0 = 11,
+ kHS53PhoneKeySharp = 12,
+ kHS53PhoneKeyStar = 13,
+ kHS53PhoneExit = 14
};
Scene53::Scene53(GnapEngine *vm) : Scene(vm) {
- _s53_isGnapPhoning = false;
- _s53_currHandSequenceId = -1;
- _s53_callsMadeCtr = 0;
- _s53_callsRndUsed = 0;
+ _isGnapPhoning = false;
+ _currHandSequenceId = -1;
+ _callsMadeCtr = 0;
+ _callsRndUsed = 0;
}
int Scene53::init() {
@@ -59,22 +59,22 @@ int Scene53::init() {
}
void Scene53::updateHotspots() {
- _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
- _vm->setHotspot(kHSPhoneKey1, 336, 238, 361, 270, SF_GRAB_CURSOR);
- _vm->setHotspot(kHSPhoneKey2, 376, 243, 405, 274, SF_GRAB_CURSOR);
- _vm->setHotspot(kHSPhoneKey3, 415, 248, 441, 276, SF_GRAB_CURSOR);
- _vm->setHotspot(kHSPhoneKey4, 329, 276, 358, 303, SF_GRAB_CURSOR);
- _vm->setHotspot(kHSPhoneKey5, 378, 282, 408, 311, SF_GRAB_CURSOR);
- _vm->setHotspot(kHSPhoneKey6, 417, 286, 446, 319, SF_GRAB_CURSOR);
- _vm->setHotspot(kHSPhoneKey7, 332, 311, 361, 342, SF_GRAB_CURSOR);
- _vm->setHotspot(kHSPhoneKey8, 376, 318, 407, 349, SF_GRAB_CURSOR);
- _vm->setHotspot(kHSPhoneKey9, 417, 320, 447, 353, SF_GRAB_CURSOR);
- _vm->setHotspot(kHSPhoneKey0, 377, 352, 405, 384, SF_GRAB_CURSOR);
- _vm->setHotspot(kHSPhoneKeySharp, 419, 358, 450, 394, SF_GRAB_CURSOR);
- _vm->setHotspot(kHSPhoneKeyStar, 328, 346, 359, 379, SF_GRAB_CURSOR);
- _vm->setHotspot(kHSPhoneExit, 150, 585, 650, 600, SF_EXIT_D_CURSOR);
+ _vm->setHotspot(kHS53Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
+ _vm->setHotspot(kHS53PhoneKey1, 336, 238, 361, 270, SF_GRAB_CURSOR);
+ _vm->setHotspot(kHS53PhoneKey2, 376, 243, 405, 274, SF_GRAB_CURSOR);
+ _vm->setHotspot(kHS53PhoneKey3, 415, 248, 441, 276, SF_GRAB_CURSOR);
+ _vm->setHotspot(kHS53PhoneKey4, 329, 276, 358, 303, SF_GRAB_CURSOR);
+ _vm->setHotspot(kHS53PhoneKey5, 378, 282, 408, 311, SF_GRAB_CURSOR);
+ _vm->setHotspot(kHS53PhoneKey6, 417, 286, 446, 319, SF_GRAB_CURSOR);
+ _vm->setHotspot(kHS53PhoneKey7, 332, 311, 361, 342, SF_GRAB_CURSOR);
+ _vm->setHotspot(kHS53PhoneKey8, 376, 318, 407, 349, SF_GRAB_CURSOR);
+ _vm->setHotspot(kHS53PhoneKey9, 417, 320, 447, 353, SF_GRAB_CURSOR);
+ _vm->setHotspot(kHS53PhoneKey0, 377, 352, 405, 384, SF_GRAB_CURSOR);
+ _vm->setHotspot(kHS53PhoneKeySharp, 419, 358, 450, 394, SF_GRAB_CURSOR);
+ _vm->setHotspot(kHS53PhoneKeyStar, 328, 346, 359, 379, SF_GRAB_CURSOR);
+ _vm->setHotspot(kHS53PhoneExit, 150, 585, 650, 600, SF_EXIT_D_CURSOR);
- _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1);
+ _vm->setDeviceHotspot(kHS53Device, -1, -1, -1, -1);
_vm->_hotspotsCount = 15;
}
@@ -91,14 +91,14 @@ int Scene53::pressPhoneNumberButton(int phoneNumber, int buttonNum) {
0x58, 0x59, 0x5A, 0x5C, 0x5D, 0x5B
};
- if (_s53_isGnapPhoning) {
+ if (_isGnapPhoning) {
_vm->_gameSys->setAnimation(kGnapHandSequenceIds[buttonNum], 40, 6);
- _vm->_gameSys->insertSequence(kGnapHandSequenceIds[buttonNum], 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0);
- _s53_currHandSequenceId = kGnapHandSequenceIds[buttonNum];
+ _vm->_gameSys->insertSequence(kGnapHandSequenceIds[buttonNum], 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0);
+ _currHandSequenceId = kGnapHandSequenceIds[buttonNum];
} else {
_vm->_gameSys->setAnimation(kPlatypusHandSequenceIds[buttonNum], 40, 6);
- _vm->_gameSys->insertSequence(kPlatypusHandSequenceIds[buttonNum], 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0);
- _s53_currHandSequenceId = kPlatypusHandSequenceIds[buttonNum];
+ _vm->_gameSys->insertSequence(kPlatypusHandSequenceIds[buttonNum], 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0);
+ _currHandSequenceId = kPlatypusHandSequenceIds[buttonNum];
}
_vm->_gnapActionStatus = 6;
@@ -117,14 +117,14 @@ int Scene53::pressPhoneNumberButton(int phoneNumber, int buttonNum) {
int Scene53::getRandomCallIndex() {
int index, tries = 0;
- if (_s53_callsRndUsed == 0x7FFF)
- _s53_callsRndUsed = 0;
+ if (_callsRndUsed == 0x7FFF)
+ _callsRndUsed = 0;
do {
index = _vm->getRandom(16);
if (++tries == 300)
- _s53_callsRndUsed = 0;
- } while (_s53_callsRndUsed & (1 << index));
- _s53_callsRndUsed |= (1 << index);
+ _callsRndUsed = 0;
+ } while (_callsRndUsed & (1 << index));
+ _callsRndUsed |= (1 << index);
return index;
}
@@ -135,20 +135,20 @@ void Scene53::runRandomCall() {
0x6A, 0x6B, 0x6C, 0x6D, 0x71
};
- ++_s53_callsMadeCtr;
+ ++_callsMadeCtr;
- if (_s53_callsMadeCtr <= 10) {
+ if (_callsMadeCtr <= 10) {
int index;
do {
index = getRandomCallIndex();
- } while (!_s53_isGnapPhoning && (index == 0 || index == 3 || index == 4 || index == 11));
+ } while (!_isGnapPhoning && (index == 0 || index == 3 || index == 4 || index == 11));
_vm->_gameSys->setAnimation(kCallSequenceIds[index], 1, 6);
_vm->_gameSys->insertSequence(kCallSequenceIds[index], 1, 0, 0, kSeqNone, 16, 0, 0);
} else {
_vm->_gameSys->setAnimation(0x74, 1, 6);
_vm->_gameSys->insertSequence(0x74, 1, 0, 0, kSeqNone, 16, 0, 0);
- _s53_callsMadeCtr = 0;
+ _callsMadeCtr = 0;
}
_vm->_gnapActionStatus = 1;
@@ -176,14 +176,14 @@ void Scene53::runChitChatLine() {
_vm->_gnapActionStatus = -1;
if (_vm->isFlag(kGFSpringTaken)) {
- _vm->_gameSys->insertSequence(0x45, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0);
- _s53_currHandSequenceId = 0x45;
+ _vm->_gameSys->insertSequence(0x45, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0);
+ _currHandSequenceId = 0x45;
} else {
- _vm->_gameSys->insertSequence(0x45, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0);
- _s53_currHandSequenceId = 0x5E;
+ _vm->_gameSys->insertSequence(0x45, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0);
+ _currHandSequenceId = 0x5E;
}
- _vm->_hotspots[kHSDevice]._flags = SF_DISABLED;
+ _vm->_hotspots[kHS53Device]._flags = SF_DISABLED;
while (!flag) {
_vm->updateMouseCursor();
@@ -258,13 +258,13 @@ void Scene53::runChitChatLine() {
if (_vm->isFlag(kGFSpringTaken)) {
_vm->_gameSys->setAnimation(0x73, 40, 6);
- _vm->_gameSys->insertSequence(0x73, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0);
+ _vm->_gameSys->insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0);
while (_vm->_gameSys->getAnimationStatus(6) != 2) {
_vm->updateMouseCursor();
// checkGameAppStatus();
_vm->gameUpdateTick();
}
- _s53_currHandSequenceId = 0x73;
+ _currHandSequenceId = 0x73;
_vm->_gnapActionStatus = -1;
}
}
@@ -276,14 +276,14 @@ void Scene53::run() {
_vm->queueInsertDeviceIcon();
if (_vm->isFlag(kGFSpringTaken)) {
- _s53_currHandSequenceId = 0x45;
- _s53_isGnapPhoning = true;
+ _currHandSequenceId = 0x45;
+ _isGnapPhoning = true;
} else {
- _s53_currHandSequenceId = 0x5E;
- _s53_isGnapPhoning = false;
+ _currHandSequenceId = 0x5E;
+ _isGnapPhoning = false;
}
- _vm->_gameSys->insertSequence(_s53_currHandSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0);
+ _vm->_gameSys->insertSequence(_currHandSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0);
_vm->endSceneInit();
_vm->setVerbCursor(GRAB_CURSOR);
_vm->playSound(0xA0, true);
@@ -322,13 +322,13 @@ void Scene53::run() {
_vm->_gnapActionStatus = 1;
if (_vm->isFlag(kGFSpringTaken)) {
_vm->_gameSys->setAnimation(0x73, 40, 6);
- _vm->_gameSys->insertSequence(0x73, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0);
+ _vm->_gameSys->insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0);
while (_vm->_gameSys->getAnimationStatus(6) != 2) {
_vm->updateMouseCursor();
// checkGameAppStatus();
_vm->gameUpdateTick();
}
- _s53_currHandSequenceId = 0x73;
+ _currHandSequenceId = 0x73;
_vm->_gnapActionStatus = -1;
}
if (phoneNumber == 7284141) {
@@ -348,7 +348,7 @@ void Scene53::run() {
phoneNumberLen = 0;
_vm->_sceneDone = true;
_vm->_newSceneNum = 17;
- if (_s53_isGnapPhoning)
+ if (_isGnapPhoning)
_vm->setFlag(kGFUnk25);
else
_vm->setFlag(kGFPlatypusTalkingToAssistant);
@@ -364,13 +364,13 @@ void Scene53::run() {
_vm->_gnapActionStatus = 1;
if (_vm->isFlag(kGFSpringTaken)) {
_vm->_gameSys->setAnimation(0x73, 40, 6);
- _vm->_gameSys->insertSequence(0x73, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0);
+ _vm->_gameSys->insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0);
while (_vm->_gameSys->getAnimationStatus(6) != 2) {
_vm->updateMouseCursor();
// checkGameAppStatus();
_vm->gameUpdateTick();
}
- _s53_currHandSequenceId = 0x73;
+ _currHandSequenceId = 0x73;
_vm->_gnapActionStatus = -1;
}
_vm->_isLeavingScene = true;
diff --git a/engines/gnap/scenes/scene53.h b/engines/gnap/scenes/group5.h
index 724411784e..d9ffc19b74 100644
--- a/engines/gnap/scenes/scene53.h
+++ b/engines/gnap/scenes/group5.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef GNAP_SCENE53_H
-#define GNAP_SCENE53_H
+#ifndef GNAP_GROUP5_H
+#define GNAP_GROUP5_H
#include "gnap/debugger.h"
#include "gnap/scenes/scenecore.h"
@@ -42,10 +42,10 @@ public:
virtual void updateAnimationsCb() {};
private:
- bool _s53_isGnapPhoning;
- int _s53_currHandSequenceId;
- int _s53_callsMadeCtr;
- uint _s53_callsRndUsed;
+ bool _isGnapPhoning;
+ int _currHandSequenceId;
+ int _callsMadeCtr;
+ uint _callsRndUsed;
int pressPhoneNumberButton(int phoneNumber, int buttonNum);
int getRandomCallIndex();
@@ -54,4 +54,4 @@ private:
};
} // End of namespace Gnap
-#endif // GNAP_SCENE53_H
+#endif // GNAP_GROUP5_H
diff --git a/engines/gnap/scenes/scene50.cpp b/engines/gnap/scenes/scene50.cpp
deleted file mode 100644
index 68f29f3d78..0000000000
--- a/engines/gnap/scenes/scene50.cpp
+++ /dev/null
@@ -1,498 +0,0 @@
-/* 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.
- *
- */
-
-#include "gnap/gnap.h"
-#include "gnap/gamesys.h"
-#include "gnap/resource.h"
-#include "gnap/scenes/scene50.h"
-
-namespace Gnap {
-
-Scene50::Scene50(GnapEngine *vm) : Scene(vm) {
- _s50_fightDone = false;
-
- _s50_roundNum = -1;
- _s50_timeRemaining = -1;
- _s50_leftTongueRoundsWon = -1;
- _s50_rightTongueRoundsWon = -1;
- _s50_leftTongueSequenceId = -1;
- _s50_leftTongueId = -1;
- _s50_leftTongueNextSequenceId = -1;
- _s50_leftTongueNextId = -1;
- _s50_rightTongueSequenceId = -1;
- _s50_rightTongueId = -1;
- _s50_rightTongueNextSequenceId = -1;
- _s50_rightTongueNextId = -1;
- _s50_leftTongueEnergy = -1;
- _s50_rightTongueEnergy = -1;
-
- _s50_timesPlayed = 0;
- _s50_timesPlayedModifier = 0;
- _s50_attackCounter = 0;
- _s50_leftTongueEnergyBarPos = 10;
- _s50_leftTongueNextIdCtr = 0;
- _s50_rightTongueEnergyBarPos = 10;
- _s50_rightTongueNextIdCtr = 0;
-}
-
-int Scene50::init() {
- return 0xC7;
-}
-
-void Scene50::updateHotspots() {
- _vm->_hotspotsCount = 0;
-}
-
-bool Scene50::tongueWinsRound(int tongueNum) {
- if (tongueNum == 1)
- ++_s50_leftTongueRoundsWon;
- else
- ++_s50_rightTongueRoundsWon;
- playWinBadgeAnim(tongueNum);
- bool fightOver = _s50_rightTongueRoundsWon == 2 || _s50_leftTongueRoundsWon == 2;
- playWinAnim(tongueNum, fightOver);
- return fightOver;
-}
-
-void Scene50::playWinAnim(int tongueNum, bool fightOver) {
- if (tongueNum == 1) {
- if (fightOver) {
- _vm->_gameSys->insertSequence(0xAD, 140, 0xAC, 140, kSeqSyncWait, 0, 0, 0);
- _vm->_gameSys->insertSequence(0xB4, 100, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0);
- _vm->_gameSys->insertSequence(0xBD, 100, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0);
- _vm->_gameSys->insertSequence(0xBC, 100, 0xBD, 100, kSeqSyncWait, 0, 0, 0);
- _s50_leftTongueSequenceId = 0xB4;
- _s50_rightTongueSequenceId = 0xBC;
- _s50_rightTongueId = 100;
- _s50_leftTongueId = 100;
- _vm->_gameSys->setAnimation(0xB4, 100, 6);
- _vm->_gameSys->setAnimation(_s50_rightTongueSequenceId, 100, 5);
- waitForAnim(6);
- waitForAnim(5);
- _vm->invAdd(kItemGum);
- _vm->setFlag(kGFUnk13);
- } else {
- _vm->_gameSys->insertSequence(0xB4, 100, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0);
- _vm->_gameSys->insertSequence(0xBD, 100, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0);
- _vm->_gameSys->insertSequence(0xBC, 100, 0xBD, 100, kSeqSyncWait, 0, 0, 0);
- _s50_leftTongueSequenceId = 0xB4;
- _s50_rightTongueSequenceId = 0xBC;
- _s50_rightTongueId = 100;
- _s50_leftTongueId = 100;
- _vm->_gameSys->setAnimation(0xB4, 100, 6);
- _vm->_gameSys->setAnimation(_s50_rightTongueSequenceId, 100, 5);
- waitForAnim(6);
- waitForAnim(5);
- }
- } else {
- _vm->_gameSys->insertSequence(0xBE, 100, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0);
- _vm->_gameSys->setAnimation(0xBE, 100, 5);
- waitForAnim(5);
- _vm->_gameSys->insertSequence(0xBF, 100, 0xBE, 100, kSeqSyncWait, 0, 0, 0);
- _vm->_gameSys->insertSequence(0xB5, 100, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0);
- _s50_rightTongueSequenceId = 0xBF;
- _s50_leftTongueSequenceId = 0xB5;
- _s50_rightTongueId = 100;
- _s50_leftTongueId = 100;
- _vm->_gameSys->setAnimation(0xB5, 100, 6);
- _vm->_gameSys->setAnimation(_s50_rightTongueSequenceId, 100, 5);
- waitForAnim(6);
- waitForAnim(5);
- }
- // TODO delayTicksA(1, 7);
-}
-
-void Scene50::delayTicks() {
- // TODO delayTicksA(3, 7);
-}
-
-void Scene50::initRound() {
- _s50_leftTongueEnergy = 10;
- _s50_rightTongueEnergy = 10;
- _s50_fightDone = false;
- _vm->_timers[3] = getRightTongueActionTicks();
- _vm->_timers[4] = 0;
- _vm->_timers[6] = 0;
- _vm->_gameSys->fillSurface(0, 91, 73, 260, 30, 212, 0, 0);
- _vm->_gameSys->fillSurface(0, 450, 73, 260, 30, 212, 0, 0);
- _s50_timeRemaining = 40;
- drawCountdown(40);
-}
-
-bool Scene50::updateCountdown() {
- if (!_vm->_timers[5]) {
- --_s50_timeRemaining;
- if (_s50_timeRemaining < 0) {
- return true;
- } else {
- _vm->_timers[5] = 15;
- drawCountdown(_s50_timeRemaining);
- }
- }
- return false;
-}
-
-void Scene50::drawCountdown(int value) {
- char str[8];
- sprintf(str, "%02d", value);
- _vm->_gameSys->fillSurface(0, 371, 505, 50, 27, 0, 0, 0);
- _vm->_gameSys->drawTextToSurface(0, 381, 504, 255, 255, 255, str);
-}
-
-void Scene50::playTonguesIdle() {
- _vm->_gameSys->insertSequence(0xBA, 100, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0);
- _vm->_gameSys->insertSequence(0xC2, 100, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0);
- _s50_leftTongueSequenceId = 0xBA;
- _s50_rightTongueSequenceId = 0xC2;
- _s50_rightTongueNextSequenceId = -1;
- _s50_leftTongueNextSequenceId = -1;
- _s50_leftTongueId = 100;
- _s50_rightTongueId = 100;
- _vm->_gameSys->setAnimation(0xC2, 100, 5);
- _vm->_gameSys->setAnimation(_s50_leftTongueSequenceId, _s50_leftTongueId, 6);
-}
-
-void Scene50::playRoundAnim(int roundNum) {
- int sequenceId = 0;
-
- switch (roundNum) {
- case 1:
- sequenceId = 0xAF;
- break;
- case 2:
- sequenceId = 0xB0;
- break;
- case 3:
- sequenceId = 0xB1;
- break;
- }
-
- _vm->_gameSys->insertSequence(sequenceId, 256, 0, 0, kSeqNone, 0, 0, 0);
- _vm->_gameSys->setAnimation(sequenceId, 256, 7);
- waitForAnim(7);
-
- _vm->_gameSys->insertSequence(0xAB, 256, sequenceId, 256, kSeqSyncWait, 0, 0, 0);
- _vm->_gameSys->setAnimation(0xAB, 256, 7);
- waitForAnim(7);
-}
-
-bool Scene50::updateEnergyBars(int newLeftBarPos, int newRightBarPos) {
- if (newLeftBarPos != _s50_leftTongueEnergyBarPos) {
- if (newLeftBarPos < 0)
- newLeftBarPos = 0;
- _s50_leftTongueEnergyBarPos = newLeftBarPos;
- _vm->_gameSys->fillSurface(0, 26 * newLeftBarPos + 91, 73, 260 - 26 * newLeftBarPos, 30, 0, 0, 0);
- }
-
- if (newRightBarPos != _s50_rightTongueEnergyBarPos) {
- if (newRightBarPos < 0)
- newRightBarPos = 0;
- _s50_rightTongueEnergyBarPos = newRightBarPos;
- if (newRightBarPos != 10)
- _vm->_gameSys->fillSurface(0, 26 * (9 - newRightBarPos) + 450, 73, 26, 30, 0, 0, 0);
- }
-
- if (newLeftBarPos * newRightBarPos > 0)
- return false;
-
- _s50_leftTongueEnergyBarPos = 10;
- _s50_rightTongueEnergyBarPos = 10;
- return true;
-}
-
-void Scene50::waitForAnim(int animationIndex) {
- while (_vm->_gameSys->getAnimationStatus(animationIndex) != 2) {
- _vm->gameUpdateTick();
- }
- _vm->_gameSys->setAnimation(0, 0, animationIndex);
-}
-
-int Scene50::checkInput() {
- int sequenceId = -1;
-
- if (_vm->isKeyStatus1(Common::KEYCODE_RIGHT)) {
- _vm->clearKeyStatus1(Common::KEYCODE_RIGHT);
- sequenceId = 0xB6;
- } else if (_vm->isKeyStatus1(Common::KEYCODE_LEFT)) {
- _vm->clearKeyStatus1(Common::KEYCODE_LEFT);
- sequenceId = 0xB3;
- } else if (_vm->isKeyStatus1(Common::KEYCODE_ESCAPE)) {
- _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE);
- _s50_fightDone = true;
- }
-
- return sequenceId;
-}
-
-int Scene50::getRightTongueAction() {
- int sequenceId = -1;
-
- if (!_vm->_timers[3]) {
- _vm->_timers[3] = getRightTongueActionTicks();
- if (_s50_rightTongueEnergy >= _s50_leftTongueEnergy) {
- switch (_vm->getRandom(5)) {
- case 0:
- sequenceId = 0xBE;
- break;
- case 1:
- sequenceId = 0xBE;
- break;
- case 2:
- sequenceId = 0xBB;
- break;
- case 3:
- sequenceId = 0xBB;
- break;
- case 4:
- sequenceId = 0xBB;
- break;
- }
- } else {
- switch (_vm->getRandom(4)) {
- case 0:
- sequenceId = 0xBE;
- break;
- case 1:
- sequenceId = 0xBB;
- break;
- case 2:
- sequenceId = 0xBE;
- break;
- case 3:
- sequenceId = 0xBE;
- break;
- }
- }
- }
-
- return sequenceId;
-}
-
-void Scene50::updateAnimations() {
- if (!_vm->_timers[4])
- _s50_attackCounter = 0;
-
- if (_vm->_gameSys->getAnimationStatus(5) == 2) {
- if (_s50_rightTongueSequenceId == 0xBE) {
- if (_s50_leftTongueSequenceId != 0xB3 && _s50_leftTongueSequenceId != 0xB8)
- _s50_rightTongueNextSequenceId = 0xBF;
- else
- _s50_rightTongueNextSequenceId = 0xC0;
- }
- if (_s50_rightTongueNextSequenceId == -1)
- _s50_rightTongueNextSequenceId = 0xC2;
- if (_s50_rightTongueNextSequenceId == 0xBF) {
- _s50_leftTongueNextId = getLeftTongueNextId();
- _s50_rightTongueNextId = getRightTongueNextId();
- _vm->_gameSys->setAnimation(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, 5);
- _vm->_gameSys->setAnimation(0xB9, _s50_leftTongueNextId, 6);
- _vm->_gameSys->insertSequence(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0);
- _vm->_gameSys->insertSequence(0xB9, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncExists, 0, 0, 0);
- _s50_rightTongueSequenceId = _s50_rightTongueNextSequenceId;
- _s50_rightTongueNextSequenceId = -1;
- _s50_leftTongueSequenceId = 0xB9;
- _s50_leftTongueNextSequenceId = -1;
- _s50_rightTongueId = _s50_rightTongueNextId;
- _s50_leftTongueId = _s50_leftTongueNextId;
- _s50_leftTongueEnergy -= _vm->getRandom(2) + 1;//CHECKME
- } else {
- _s50_rightTongueNextId = getRightTongueNextId();
- _vm->_gameSys->setAnimation(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, 5);
- _vm->_gameSys->insertSequence(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0);
- _s50_rightTongueSequenceId = _s50_rightTongueNextSequenceId;
- _s50_rightTongueNextSequenceId = -1;
- _s50_rightTongueId = _s50_rightTongueNextId;
- }
- }
-
- if (_vm->_gameSys->getAnimationStatus(6) == 2) {
- if (_s50_leftTongueSequenceId == 0xB6) {
- ++_s50_attackCounter;
- if (_s50_timesPlayedModifier + 3 <= _s50_attackCounter) {
- _s50_leftTongueNextSequenceId = 0xB8;
- } else {
- _vm->_timers[4] = 20;
- //CHECKME
- if (_s50_rightTongueSequenceId != 0xBB && _s50_rightTongueSequenceId != 0xC0 && _vm->getRandom(8) != _s50_roundNum)
- _s50_leftTongueNextSequenceId = 0xB7;
- else
- _s50_leftTongueNextSequenceId = 0xB8;
- }
- }
- if (_s50_leftTongueNextSequenceId == 0xB3)
- --_s50_attackCounter;
- if (_s50_leftTongueNextSequenceId == -1)
- _s50_leftTongueNextSequenceId = 0xBA;
- if (_s50_leftTongueNextSequenceId == 0xB7) {
- _s50_leftTongueNextId = getLeftTongueNextId();
- _s50_rightTongueNextId = getRightTongueNextId();
- _vm->_gameSys->setAnimation(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, 6);
- _vm->_gameSys->setAnimation(0xC1, _s50_rightTongueNextId, 5);
- _vm->_gameSys->insertSequence(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0);
- _vm->_gameSys->insertSequence(0xC1, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncExists, 0, 0, 0);
- _s50_leftTongueSequenceId = _s50_leftTongueNextSequenceId;
- _s50_leftTongueNextSequenceId = -1;
- _s50_rightTongueSequenceId = 0xC1;
- _s50_rightTongueNextSequenceId = -1;
- _s50_rightTongueId = _s50_rightTongueNextId;
- _s50_leftTongueId = _s50_leftTongueNextId;
- --_s50_rightTongueEnergy;
- } else if (_s50_leftTongueNextSequenceId != 0xB8 || _s50_rightTongueSequenceId != 0xC2) {
- _s50_leftTongueNextId = getLeftTongueNextId();
- _vm->_gameSys->setAnimation(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, 6);
- _vm->_gameSys->insertSequence(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0);
- _s50_leftTongueSequenceId = _s50_leftTongueNextSequenceId;
- _s50_leftTongueNextSequenceId = -1;
- _s50_leftTongueId = _s50_leftTongueNextId;
- } else {
- _s50_leftTongueNextId = getLeftTongueNextId();
- _s50_rightTongueNextId = getRightTongueNextId();
- _vm->_gameSys->setAnimation(0xBB, _s50_rightTongueNextId, 5);
- _vm->_gameSys->setAnimation(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, 6);
- _vm->_gameSys->insertSequence(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0);
- _vm->_gameSys->insertSequence(0xBB, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncExists, 0, 0, 0);
- _s50_rightTongueSequenceId = 0xBB;
- _s50_rightTongueId = _s50_rightTongueNextId;
- _s50_rightTongueNextSequenceId = -1;
- _s50_leftTongueSequenceId = _s50_leftTongueNextSequenceId;
- _s50_leftTongueNextSequenceId = -1;
- _s50_leftTongueId = _s50_leftTongueNextId;
- }
- }
-}
-
-int Scene50::getRightTongueActionTicks() {
- return 15 - 5 * _s50_roundNum + 1;
-}
-
-int Scene50::getLeftTongueNextId() {
- _s50_leftTongueNextIdCtr = (_s50_leftTongueNextIdCtr + 1) % 3;
- return _s50_leftTongueNextIdCtr + 100;
-}
-
-int Scene50::getRightTongueNextId() {
- _s50_rightTongueNextIdCtr = (_s50_rightTongueNextIdCtr + 1) % 3;
- return _s50_rightTongueNextIdCtr + 100;
-}
-
-void Scene50::playWinBadgeAnim(int tongueNum) {
- int sequenceId;
-
- if (tongueNum == 1) {
- if (_s50_leftTongueRoundsWon == 1)
- sequenceId = 0xC3;
- else
- sequenceId = 0xC4;
- } else {
- if (_s50_rightTongueRoundsWon == 1)
- sequenceId = 0xC5;
- else
- sequenceId = 0xC6;
- }
-
- _vm->_gameSys->setAnimation(sequenceId, 120, 7);
- _vm->_gameSys->insertSequence(sequenceId, 120, 0, 0, kSeqNone, 0, 0, 0);
- waitForAnim(7);
-}
-
-void Scene50::run() {
- ++_s50_timesPlayed;
- _s50_timesPlayedModifier = _s50_timesPlayed / 4;
- _s50_leftTongueRoundsWon = 0;
- _s50_rightTongueRoundsWon = 0;
- // initFont();
- _s50_leftTongueSequenceId = 186;
- _s50_rightTongueSequenceId = 194;
- _s50_rightTongueNextSequenceId = -1;
- _s50_leftTongueNextSequenceId = -1;
- _s50_leftTongueId = 100;
- _s50_rightTongueId = 100;
-
- _vm->_gameSys->setAnimation(194, 100, 5);
- _vm->_gameSys->setAnimation(_s50_leftTongueSequenceId, _s50_leftTongueId, 6);
- _vm->_gameSys->insertSequence(_s50_leftTongueSequenceId, _s50_leftTongueId, 0, 0, kSeqNone, 0, 0, 0);
- _vm->_gameSys->insertSequence(_s50_rightTongueSequenceId, _s50_rightTongueId, 0, 0, kSeqNone, 0, 0, 0);
- _vm->_gameSys->insertSequence(172, 140, 0, 0, kSeqNone, 0, 0, 0);
- _vm->endSceneInit();
-
- initRound();
-
- _s50_roundNum = 1;
-
- _vm->setGrabCursorSprite(-1);
- _vm->hideCursor();
-
- // TODO delayTicksA(1, 7);
-
- playRoundAnim(_s50_roundNum);
-
- _vm->_timers[5] = 15;
-
- while (!_s50_fightDone) {
- /* TODO
- if (sceneXX_sub_4466B1())
- _s50_fightDone = true;
- */
-
- int playerSequenceId = checkInput();
- if (playerSequenceId != -1)
- _s50_leftTongueNextSequenceId = playerSequenceId;
-
- int rightSequenceId = getRightTongueAction();
- if (rightSequenceId != -1)
- _s50_rightTongueNextSequenceId = rightSequenceId;
-
- updateAnimations();
-
- if (updateCountdown() ||
- updateEnergyBars(_s50_leftTongueEnergy, _s50_rightTongueEnergy)) {
- bool v0;
- if (_s50_rightTongueEnergy < _s50_leftTongueEnergy)
- v0 = tongueWinsRound(1);
- else
- v0 = tongueWinsRound(2);
- if (v0) {
- delayTicks();
- _s50_fightDone = true;
- } else {
- ++_s50_roundNum;
- initRound();
- playTonguesIdle();
- updateEnergyBars(_s50_leftTongueEnergy, _s50_rightTongueEnergy);
- playRoundAnim(_s50_roundNum);
- _vm->_timers[5] = 15;
- }
- }
- _vm->gameUpdateTick();
- }
-
- // freeFont();
-
- _vm->_gameSys->setAnimation(0, 0, 7);
- _vm->_gameSys->setAnimation(0, 0, 6);
- _vm->_gameSys->setAnimation(0, 0, 5);
- _vm->_gameSys->setAnimation(0, 0, 3);
-
- _vm->showCursor();
-}
-
-} // End of namespace Gnap
diff --git a/engines/gnap/scenes/scene50.h b/engines/gnap/scenes/scene50.h
deleted file mode 100644
index 6cc4bc35cb..0000000000
--- a/engines/gnap/scenes/scene50.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* 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_SCENE50_H
-#define GNAP_SCENE50_H
-
-#include "gnap/debugger.h"
-#include "gnap/scenes/scenecore.h"
-
-namespace Gnap {
-
-class GnapEngine;
-
-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 _s50_fightDone;
- int _s50_timesPlayed;
- int _s50_timesPlayedModifier;
- int _s50_attackCounter;
- int _s50_roundNum;
- int _s50_timeRemaining;
- int _s50_leftTongueRoundsWon;
- int _s50_rightTongueRoundsWon;
- int _s50_leftTongueEnergyBarPos;
- int _s50_rightTongueEnergyBarPos;
- int _s50_leftTongueSequenceId;
- int _s50_leftTongueId;
- int _s50_leftTongueNextSequenceId;
- int _s50_leftTongueNextId;
- int _s50_leftTongueNextIdCtr;
- int _s50_rightTongueSequenceId;
- int _s50_rightTongueId;
- int _s50_rightTongueNextSequenceId;
- int _s50_rightTongueNextId;
- int _s50_rightTongueNextIdCtr;
- int _s50_leftTongueEnergy;
- int _s50_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);
-};
-
-} // End of namespace Gnap
-#endif // GNAP_SCENE50_H
diff --git a/engines/gnap/scenes/scene51.cpp b/engines/gnap/scenes/scene51.cpp
deleted file mode 100644
index dc93c6ba4d..0000000000
--- a/engines/gnap/scenes/scene51.cpp
+++ /dev/null
@@ -1,897 +0,0 @@
-/* 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.
- *
- */
-
-#include "gnap/gnap.h"
-#include "gnap/gamesys.h"
-#include "gnap/resource.h"
-#include "gnap/scenes/scene51.h"
-
-namespace Gnap {
-
-static const int kDigitSequenceIds[] = {
- 0xCA, 0xCB, 0xCC, 0xCD, 0xCE,
- 0xCF, 0xD0, 0xD1, 0xD2, 0xD3
-};
-
-static const int kDigitPositions[4] = {
- 0, 34, 83, 119
-};
-
-/*
- 0xBA Falling banana peel
- 0xBC Banana peel goes away
- 0xBD Falling coin
- 0xBE Fallen coin
- 0xC0 Falling banknote
- 0xB6 Platypus tripping (right)
- 0xB7 Platypus tripping (left)
- 0x76 Platypus jumping (right)
-*/
-
-Scene51::Scene51(GnapEngine *vm) : Scene(vm) {
- _s51_dropLoseCash = false;
-
- _s51_cashAmount = -1;
- _s51_guySequenceId = -1;
- _s51_guyNextSequenceId = -1;
- _s51_itemsCaughtCtr = -1;
- _s51_dropSpeedTicks = -1;
- _s51_nextDropItemKind = -1;
- _s51_itemInsertX = -1;
- _s51_itemInsertDirection = -1;
- _s51_platypusSequenceId = -1;
- _s51_platypusNextSequenceId = -1;
- _s51_platypusJumpSequenceId = -1;
- _s51_itemsCtr = -1;
- _s51_itemsCtr1 = -1;
- _s51_itemsCtr2 = -1;
-
- for (int i = 0; i < 4; i++) {
- _s51_digits[i] = 0;
- _s51_digitSequenceIds[4] = -1;
- }
-
- for (int i = 0; i < 6; i++) {
- _s51_items[i]._currSequenceId = -1;
- _s51_items[i]._droppedSequenceId;
- _s51_items[i]._x = 0;
- _s51_items[i]._y = 0;
- _s51_items[i]._collisionX;
- _s51_items[i]._canCatch = false;
- _s51_items[i]._isCollision = false;
- _s51_items[i]._x2 = 0;
- _s51_items[i]._id = -1;
- }
-}
-
-int Scene51::init() {
- _vm->_gameSys->setAnimation(0, 0, 0);
- for (int i = 0; i < 6; ++i)
- _vm->_gameSys->setAnimation(0, 0, i + 1);
- return 0xD4;
-}
-
-void Scene51::updateHotspots() {
- _vm->_hotspotsCount = 0;
-}
-
-void Scene51::clearItem(Scene51Item *item) {
- item->_currSequenceId = 0;
- item->_droppedSequenceId = 0;
- item->_x = 0;
- item->_y = 0;
- item->_x2 = 0;
- item->_collisionX = 0;
- item->_canCatch = false;
-}
-
-void Scene51::dropNextItem() {
- if (_vm->_timers[0])
- return;
-
- int index = 0;
- while (index < 6 && _s51_items[index]._currSequenceId)
- ++index;
-
- if (index == 6)
- return;
-
- switch (_s51_nextDropItemKind) {
- case 0:
- if (_vm->getRandom(10) != 0 || _s51_itemsCtr2 >= 2) {
- _s51_items[index]._currSequenceId = 0xBD;
- } else {
- --_s51_itemsCtr1;
- _s51_items[index]._currSequenceId = 0xBA;
- ++_s51_itemsCtr2;
- }
- break;
-
- case 1:
- if (_vm->getRandom(8) != 0 || _s51_itemsCtr2 >= 2) {
- if (_vm->getRandom(5) == 0) {
- if (_s51_itemInsertDirection)
- _s51_itemInsertX -= 70;
- else
- _s51_itemInsertX += 70;
- }
- _s51_items[index]._currSequenceId = 0xBD;
- } else {
- --_s51_itemsCtr1;
- _s51_items[index]._currSequenceId = 0xBA;
- ++_s51_itemsCtr2;
- }
- break;
-
- case 2:
- if (_vm->getRandom(6) != 0 || _s51_itemsCtr2 >= 2) {
- _s51_items[index]._currSequenceId = 0xBD;
- } else {
- --_s51_itemsCtr1;
- _s51_items[index]._currSequenceId = 0xBA;
- ++_s51_itemsCtr2;
- }
- break;
-
- case 3:
- case 4:
- if (_s51_itemsCtr == 0)
- _s51_itemsCtr1 = 3;
- _s51_items[index]._currSequenceId = 0xC0;
- break;
-
- case 5:
- case 6:
- if (_vm->getRandom(5) != 0 || _s51_itemsCtr2 >= 2) {
- if (_vm->getRandom(5) != 0)
- _s51_items[index]._currSequenceId = 0xBD;
- else
- _s51_items[index]._currSequenceId = 0xC0;
- } else {
- --_s51_itemsCtr1;
- _s51_items[index]._currSequenceId = 0xBA;
- ++_s51_itemsCtr2;
- }
- break;
-
- case 7:
- if (_vm->getRandom(5) != 0 || _s51_itemsCtr2 >= 2) {
- if (_vm->getRandom(5) == 0) {
- if (_s51_itemInsertDirection)
- _s51_itemInsertX -= 40;
- else
- _s51_itemInsertX += 40;
- }
- if (_vm->getRandom(9) != 0)
- _s51_items[index]._currSequenceId = 0xBD;
- else
- _s51_items[index]._currSequenceId = 0xC0;
- } else {
- --_s51_itemsCtr1;
- _s51_items[index]._currSequenceId = 0xBA;
- ++_s51_itemsCtr2;
- }
- break;
-
- default:
- if (_vm->getRandom(4) != 0 || _s51_itemsCtr2 >= 2) {
- if (_vm->getRandom(9) != 0)
- _s51_items[index]._currSequenceId = 0xBD;
- else
- _s51_items[index]._currSequenceId = 0xC0;
- } else {
- --_s51_itemsCtr1;
- _s51_items[index]._currSequenceId = 0xBA;
- ++_s51_itemsCtr2;
- }
- break;
- }
-
- if (_s51_itemInsertDirection) {
- _s51_itemInsertX -= 73;
- if (_s51_itemInsertX < 129) {
- _s51_itemInsertX += 146;
- _s51_itemInsertDirection = 0;
- }
- } else {
- _s51_itemInsertX += 73;
- if (_s51_itemInsertX > 685) {
- _s51_itemInsertX -= 146;
- _s51_itemInsertDirection = 1;
- }
- }
-
- if (_s51_itemInsertX > 685)
- _s51_itemInsertX = 685;
-
- if (_s51_itemInsertX < 129)
- _s51_itemInsertX = 129;
-
- if (_s51_items[index]._currSequenceId == 0xBA) {
- _s51_items[index]._x2 = _vm->getRandom(350) + 200;
- _s51_items[index]._x = _s51_items[index]._x2 - 362;
- _s51_items[index]._y = 15;
- _s51_items[index]._id = 249 - index;
- } else {
- _s51_items[index]._collisionX = _s51_itemInsertX;
- _s51_items[index]._x = _s51_items[index]._collisionX - 395;
- if (_s51_items[index]._currSequenceId == 0xC0)
- _s51_items[index]._x -= 65;
- _s51_items[index]._id = index + 250;
- _s51_items[index]._canCatch = true;
- }
-
- _vm->_gameSys->setAnimation(_s51_items[index]._currSequenceId, _s51_items[index]._id, index + 1);
- _vm->_gameSys->insertSequence(_s51_items[index]._currSequenceId, _s51_items[index]._id, 0, 0,
- kSeqNone, 0, _s51_items[index]._x, _s51_items[index]._y);
-
- _vm->_timers[0] = _s51_dropSpeedTicks;
-
- if (_s51_nextDropItemKind >= 3)
- _vm->_timers[0] = 20;
-
- if (_s51_nextDropItemKind >= 5)
- _vm->_timers[0] = 5;
-
- if (_s51_nextDropItemKind == 8)
- _vm->_timers[0] = 4;
-
- ++_s51_itemsCtr;
-}
-
-void Scene51::updateItemAnimations() {
- for (int i = 0; i < 6; ++i) {
- if (_vm->_gameSys->getAnimationStatus(i + 1) == 2)
- updateItemAnimation(&_s51_items[i], i);
- }
-}
-
-int Scene51::checkCollision(int sequenceId) {
- bool jumpingLeft = false, jumpingRight = false;
- int v8, v4;
- int result = 0;
-
- if (!isJumping(sequenceId))
- return false;
-
- bool checkFl = false;
- for (int i = 0; i < 6; i++)
- checkFl |= _s51_items[i]._isCollision;
-
- if (!checkFl)
- return false;
-
- if (isJumpingRight(sequenceId)) {
- v8 = getPosRight(sequenceId);
- v4 = getPosRight(sequenceId + 1);
- jumpingRight = true;
- } else if (isJumpingLeft(sequenceId)) {
- v4 = getPosLeft(sequenceId - 1) + 33;
- v8 = getPosLeft(sequenceId) + 33;
- jumpingLeft = true;
- }
-
- if (jumpingRight || jumpingLeft) {
- int v5 = 0;
- int i;
- for (i = 0; i < 6; ++i) {
- if (_s51_items[i]._isCollision) {
- if (jumpingRight && _s51_items[i]._x2 > v8 && _s51_items[i]._x2 < v4) {
- v5 = v8 - 359;
- if (v5 == 0)
- v5 = 1;
- _s51_platypusNextSequenceId = 0xB6;
- break;
- } else if (jumpingLeft && _s51_items[i]._x2 < v4 && _s51_items[i]._x2 > v8) {
- v5 = v8 - 344;
- if (v5 == 0)
- v5 = 1;
- _s51_platypusNextSequenceId = 0xB7;
- break;
- }
- }
- }
- if (v5) {
- _vm->_gameSys->setAnimation(0xBC, _s51_items[i]._id, i + 1);
- _vm->_gameSys->insertSequence(0xBC, _s51_items[i]._id, _s51_items[i]._currSequenceId, _s51_items[i]._id, kSeqSyncWait, 0, _s51_items[i]._x, 15);
- _s51_items[i]._isCollision = false;
- _s51_items[i]._currSequenceId = 0xBC;
- --_s51_itemsCtr2;
- }
- result = v5;
- }
-
- return result;
-}
-
-void Scene51::updateItemAnimation(Scene51Item *item, int index) {
-
- switch (item->_currSequenceId) {
- case 0xBD:
- case 0xC0:
- case 0xC1:
- // Falling coin and banknote
- if (!itemIsCaught(item)) {
- if (_s51_dropLoseCash) {
- if (item->_currSequenceId == 0xBD)
- _s51_cashAmount -= 2;
- else
- _s51_cashAmount -= 25;
- if (_s51_cashAmount < 0)
- _s51_cashAmount = 0;
- updateCash(_s51_cashAmount);
- }
- item->_droppedSequenceId = item->_currSequenceId + 1;
- if (item->_currSequenceId != 0xC0) {
- item->_canCatch = false;
- _s51_dropLoseCash = true;
- _s51_itemsCtr = 0;
- _vm->_timers[0] = 10;
- }
- if (item->_droppedSequenceId) {
- _vm->_gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1);
- _vm->_gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y);
- item->_currSequenceId = item->_droppedSequenceId;
- item->_y = 0;
- }
- } else {
- _vm->_gameSys->removeSequence(item->_currSequenceId, item->_id, true);
- _vm->_gameSys->setAnimation(0, 0, index + 1);
- _vm->playSound(218, false);
- if (incCashAmount(item->_currSequenceId) == 1995) {
- winMinigame();
- _vm->_sceneDone = true;
- } else {
- clearItem(item);
- ++_s51_itemsCaughtCtr;
- if (_s51_itemsCaughtCtr == 5)
- --_s51_dropSpeedTicks;
- if (_s51_itemsCaughtCtr == 8)
- --_s51_dropSpeedTicks;
- if (_s51_itemsCaughtCtr == 11)
- --_s51_dropSpeedTicks;
- if (_s51_itemsCaughtCtr == 14)
- --_s51_dropSpeedTicks;
- if (_s51_itemsCaughtCtr >= 15 && _s51_dropSpeedTicks > 4)
- --_s51_dropSpeedTicks;
- if (_s51_itemsCtr1 <= _s51_itemsCaughtCtr) {
- ++_s51_nextDropItemKind;
- _s51_dropSpeedTicks = 10;
- _s51_itemsCtr = 0;
- _s51_itemsCtr1 = 20;
- _s51_dropLoseCash = false;
- _s51_itemsCaughtCtr = 0;
- removeCollidedItems();
- }
- }
- }
- break;
-
- case 0xBE:
- // Fallen coin
- item->_droppedSequenceId = item->_currSequenceId + 1;
- if (item->_droppedSequenceId) {
- _vm->_gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1);
- _vm->_gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y);
- item->_currSequenceId = item->_droppedSequenceId;
- item->_y = 0;
- }
- break;
-
- case 0xBF:
- case 0xC2:
- // Bouncing coin and banknote
- _vm->_gameSys->setAnimation(0, 0, index + 1);
- _vm->_gameSys->removeSequence(item->_currSequenceId, item->_id, true);
- clearItem(item);
- break;
-
- case 0xBA:
- // Falling banana peel
- item->_droppedSequenceId = 0xBB;
- item->_y = 15;
- if (item->_droppedSequenceId) {
- _vm->_gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1);
- _vm->_gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y);
- item->_currSequenceId = item->_droppedSequenceId;
- item->_y = 0;
- }
- break;
-
- case 0xBB:
- item->_isCollision = true;
- item->_droppedSequenceId = 0;
- _vm->_gameSys->setAnimation(0, 0, index + 1);
- break;
-
- case 0xBC:
- _vm->_gameSys->removeSequence(item->_currSequenceId, item->_id, true);
- _vm->_gameSys->setAnimation(0, 0, index + 1);
- clearItem(item);
- break;
-
- default:
- if (item->_droppedSequenceId) {
- _vm->_gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1);
- _vm->_gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y);
- item->_currSequenceId = item->_droppedSequenceId;
- item->_y = 0;
- }
- break;
- }
-}
-
-void Scene51::removeCollidedItems() {
- for (int i = 0; i < 6; ++i) {
- if (_s51_items[i]._isCollision) {
- _vm->_gameSys->removeSequence(_s51_items[i]._currSequenceId, _s51_items[i]._id, true);
- _vm->_gameSys->setAnimation(0, 0, i + 1);
- clearItem(&_s51_items[i]);
- }
- }
- _s51_itemsCtr2 = 0;
-}
-
-int Scene51::itemIsCaught(Scene51Item *item) {
- if (!item->_canCatch)
- return 0;
-
- if (isJumpingRight(_s51_platypusJumpSequenceId)) {
- int v4 = getPosRight(_s51_platypusJumpSequenceId) + 97;
- if (item->_collisionX < v4 && v4 - item->_collisionX < 56)
- return 1;
- } else {
- int v2 = getPosLeft(_s51_platypusJumpSequenceId);
- if (item->_collisionX > v2 && item->_collisionX - v2 < 56)
- return 1;
- }
-
- if (item->_currSequenceId == 0xC1) {
- int v3 = item->_collisionX + 100;
- if (isJumpingRight(_s51_platypusJumpSequenceId)) {
- if (ABS(getPosRight(_s51_platypusJumpSequenceId) + 46 - v3) < 56)
- return 1;
- } else if (ABS(getPosLeft(_s51_platypusJumpSequenceId) + 46 - v3) < 56) {
- return 1;
- }
- }
-
- return 0;
-}
-
-bool Scene51::isJumpingRight(int sequenceId) {
- return sequenceId >= 0x76 && sequenceId <= 0x95;
-}
-
-bool Scene51::isJumpingLeft(int sequenceId) {
- return sequenceId >= 0x96 && sequenceId <= 0xB5;
-}
-
-bool Scene51::isJumping(int sequenceId) {
- return sequenceId >= 0x76 && sequenceId <= 0xB5;
-}
-
-void Scene51::waitForAnim(int animationIndex) {
- while (_vm->_gameSys->getAnimationStatus(animationIndex) != 2) {
- // pollMessages();
- updateItemAnimations();
- _vm->gameUpdateTick();
- }
-}
-
-int Scene51::getPosRight(int sequenceId) {
- static const int kRightPosTbl[] = {
- 131, 159, 178, 195, 203, 219, 238, 254,
- 246, 274, 293, 310, 318, 334, 353, 369,
- 362, 390, 409, 426, 434, 450, 469, 485,
- 477, 505, 524, 541, 549, 565, 584, 600
- };
-
- if (sequenceId >= 118 && sequenceId <= 149)
- return kRightPosTbl[sequenceId - 118];
- return -1;
-}
-
-int Scene51::getPosLeft(int sequenceId) {
- static const int kLeftPosTbl[] = {
- 580, 566, 550, 536, 526, 504, 488, 469,
- 460, 446, 430, 416, 406, 384, 368, 349,
- 342, 328, 312, 298, 288, 266, 250, 231,
- 220, 206, 190, 176, 166, 144, 128, 109
- };
-
- if (sequenceId >= 150 && sequenceId <= 181)
- return kLeftPosTbl[sequenceId - 150];
- return -1;
-}
-
-void Scene51::playIntroAnim() {
- int soundCtr = 0;
-
- _s51_platypusSequenceId = 0x76;
- _s51_platypusNextSequenceId = 0x76;
-
- for (int i = 0; i < 6; ++i)
- clearItem(&_s51_items[i]);
-
- _s51_items[0]._currSequenceId = 0xBA;
- _s51_items[0]._x2 = 320;
- _s51_items[0]._x = -42;
- _s51_items[0]._y = 15;
- _s51_items[0]._id = 249;
- _s51_items[0]._isCollision = true;
-
- _vm->_gameSys->insertSequence(_s51_platypusSequenceId, 256, 0, 0, kSeqNone, 0, -179, 0);
- _vm->_gameSys->insertSequence(0xBA, 249, 0, 0, kSeqNone, 0, _s51_items[0]._x, _s51_items[0]._y);
- _vm->_gameSys->setAnimation(0xBA, 249, 1);
- _vm->_gameSys->setAnimation(_s51_platypusSequenceId, 256, 0);
-
- while (_s51_platypusSequenceId < 0x80) {
- waitForAnim(0);
- ++_s51_platypusNextSequenceId;
- _vm->_gameSys->setAnimation(_s51_platypusNextSequenceId, 256, 0);
- _vm->_gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, -179, 0);
- _s51_platypusSequenceId = _s51_platypusNextSequenceId;
- ++soundCtr;
- if (soundCtr % 4 == 0)
- _vm->playSound(214, false);
- }
-
- _s51_platypusNextSequenceId = 0x75;
-
- while (_s51_platypusSequenceId != 0x84) {
- waitForAnim(0);
- ++_s51_platypusNextSequenceId;
- int oldSequenceId = _s51_platypusNextSequenceId;
- int v0 = checkCollision(_s51_platypusNextSequenceId);
- _vm->_gameSys->setAnimation(_s51_platypusNextSequenceId, 256, 0);
- _vm->_gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, v0, 0);
- _s51_platypusSequenceId = _s51_platypusNextSequenceId;
- if (v0) {
- _s51_platypusNextSequenceId = oldSequenceId;
- } else {
- ++soundCtr;
- if (soundCtr % 4 == 0)
- _vm->playSound(214, false);
- }
- }
- waitForAnim(0);
-}
-
-void Scene51::updateGuyAnimation() {
- if (!_vm->_timers[4]) {
- _vm->_timers[4] = _vm->getRandom(20) + 60;
-
- switch (_vm->getRandom(5)) {
- case 0:
- _s51_guyNextSequenceId = 0xC3;
- break;
- case 1:
- _s51_guyNextSequenceId = 0xC4;
- break;
- case 2:
- _s51_guyNextSequenceId = 0xC5;
- break;
- case 3:
- _s51_guyNextSequenceId = 0xC6;
- break;
- case 4:
- _s51_guyNextSequenceId = 0xC7;
- break;
- }
-
- _vm->_gameSys->insertSequence(_s51_guyNextSequenceId, 39, _s51_guySequenceId, 39, kSeqSyncWait, 0, 0, 0);
- _s51_guySequenceId = _s51_guyNextSequenceId;
- _s51_guyNextSequenceId = -1;
- }
-}
-
-int Scene51::incCashAmount(int sequenceId) {
- switch (sequenceId) {
- case 0xBD:
- _s51_cashAmount += 10;
- break;
- case 0xC0:
- case 0xC1:
- _s51_cashAmount += 100;
- break;
- case 0xB6:
- case 0xB7:
- _s51_cashAmount -= 10 * _vm->getRandom(5) + 50;
- if (_s51_cashAmount < 0)
- _s51_cashAmount = 0;
- break;
- }
- if (_s51_cashAmount > 1995)
- _s51_cashAmount = 1995;
- updateCash(_s51_cashAmount);
- return _s51_cashAmount;
-}
-
-void Scene51::winMinigame() {
- updateCash(1995);
- _vm->playSound(218, false);
- // TODO delayTicksA(1, 5);
- _vm->_newSceneNum = 48;
- _vm->invRemove(kItemBanana);
-}
-
-void Scene51::playCashAppearAnim() {
- _vm->_gameSys->setAnimation(0xC8, 252, 0);
- _vm->_gameSys->insertSequence(0xC8, 252, 0, 0, kSeqNone, 0, -20, -20);
- while (_vm->_gameSys->getAnimationStatus(0) != 2) {
- _vm->gameUpdateTick();
- // checkGameAppStatus();
- }
-}
-
-void Scene51::updateCash(int amount) {
- drawDigit(amount / 1000, 0);
- drawDigit(amount / 100 % 10, 1);
- drawDigit(amount / 10 % 10, 2);
- drawDigit(amount % 10, 3);
-}
-
-void Scene51::drawDigit(int digit, int position) {
- if (digit != _s51_digits[position]) {
- _vm->_gameSys->insertSequence(kDigitSequenceIds[digit], 253,
- _s51_digitSequenceIds[position], 253,
- kSeqSyncWait, 0, kDigitPositions[position] - 20, -20);
- _s51_digitSequenceIds[position] = kDigitSequenceIds[digit];
- _s51_digits[position] = digit;
- }
-}
-
-void Scene51::initCashDisplay() {
- for (int position = 0; position < 4; ++position) {
- _s51_digits[position] = 0;
- _s51_digitSequenceIds[position] = kDigitSequenceIds[0];
- _vm->_gameSys->insertSequence(kDigitSequenceIds[0], 253, 0, 0,
- kSeqNone, 0, kDigitPositions[position] - 20, -20);
- }
- _s51_cashAmount = 0;
-}
-
-void Scene51::run() {
- int soundCtr = 0;
- bool isIdle = true;
-
- _s51_itemsCtr = 0;
- _vm->_newSceneNum = _vm->_prevSceneNum;
- _s51_cashAmount = 0;
- _s51_platypusJumpSequenceId = 0x84;
- _vm->endSceneInit();
-
- _vm->hideCursor();
- _vm->setGrabCursorSprite(-1);
-
- _s51_guySequenceId = 0xC3;
- _s51_guyNextSequenceId = -1;
-
- _vm->_gameSys->insertSequence(0xC3, 39, 0, 0, kSeqNone, 0, 0, 0);
- _vm->_timers[4] = _vm->getRandom(20) + 60;
-
- playCashAppearAnim();
- initCashDisplay();
- playIntroAnim();
-
- _s51_platypusNextSequenceId = 0x74;
- _vm->_gameSys->setAnimation(0x74, 256, 0);
- _vm->_gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, getPosRight(_s51_platypusJumpSequenceId) - 362, 0);
- _s51_platypusSequenceId = _s51_platypusNextSequenceId;
-
- _s51_itemInsertDirection = 0;
- _s51_itemInsertX = 685;
- _s51_dropSpeedTicks = 10;
- _s51_nextDropItemKind = 0;
-
- for (int i = 0; i < 6; ++i)
- clearItem(&_s51_items[i]);
-
- _s51_itemInsertX = _vm->getRandom(556) + 129;
- _vm->_timers[0] = 15;
-
- _s51_itemsCaughtCtr = 0;
- _s51_dropLoseCash = false;
- _s51_itemsCtr1 = 20;
-
- _vm->clearKeyStatus1(Common::KEYCODE_RIGHT);
- _vm->clearKeyStatus1(Common::KEYCODE_LEFT);
- _vm->clearKeyStatus1(Common::KEYCODE_UP);
- _vm->clearKeyStatus1(Common::KEYCODE_SPACE);
- _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE);
-
- bool isCollision = false;
- bool startWalk = true;
-
- while (!_vm->_sceneDone) {
- if (clearKeyStatus())
- _vm->_sceneDone = true;
-
- _vm->gameUpdateTick();
-
- updateGuyAnimation();
- dropNextItem();
- updateItemAnimations();
-
- if (_vm->isKeyStatus2(Common::KEYCODE_UP) || _vm->isKeyStatus2(Common::KEYCODE_SPACE)) {
- _vm->clearKeyStatus1(Common::KEYCODE_UP);
- _vm->clearKeyStatus1(Common::KEYCODE_SPACE);
- if (isJumpingRight(_s51_platypusJumpSequenceId)) {
- waitForAnim(0);
- _vm->_gameSys->setAnimation(0xB8, 256, 0);
- _vm->_gameSys->insertSequence(0xB8, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, getPosRight(_s51_platypusJumpSequenceId) - 348, 0);
- _s51_platypusSequenceId = 0xB8;
- waitForAnim(0);
- _s51_platypusNextSequenceId += 6;
- if (_s51_platypusNextSequenceId > 0x95)
- _s51_platypusNextSequenceId = 0x95;
- _s51_platypusJumpSequenceId = _s51_platypusNextSequenceId;
- } else {
- waitForAnim(0);
- _vm->_gameSys->setAnimation(0xB9, 256, 0);
- _vm->_gameSys->insertSequence(0xB9, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, getPosLeft(_s51_platypusJumpSequenceId) - 338, 0);
- _s51_platypusSequenceId = 0xB9;
- waitForAnim(0);
- _s51_platypusNextSequenceId += 6;
- if (_s51_platypusNextSequenceId > 0xB5)
- _s51_platypusNextSequenceId = 0xB5;
- _s51_platypusJumpSequenceId = _s51_platypusNextSequenceId;
- }
- isIdle = false;
- }
-
- while (_vm->isKeyStatus2(Common::KEYCODE_RIGHT) && _s51_platypusNextSequenceId != 0x96) {
- // pollMessages();
- if (_s51_platypusNextSequenceId == 0xB6)
- _s51_platypusNextSequenceId = 0x76;
- updateItemAnimations();
- if (startWalk) {
- _s51_platypusNextSequenceId = 0x86;
- startWalk = false;
- }
-
- if (_vm->_gameSys->getAnimationStatus(0) == 2) {
- int collisionX = checkCollision(_s51_platypusNextSequenceId);
- if (collisionX)
- incCashAmount(_s51_platypusNextSequenceId);
- _vm->_gameSys->setAnimation(_s51_platypusNextSequenceId, 256, 0);
- _vm->_gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, collisionX, 0);
- _s51_platypusSequenceId = _s51_platypusNextSequenceId;
- if (collisionX) {
- isCollision = true;
- ++_s51_platypusJumpSequenceId;
- _s51_platypusNextSequenceId = _s51_platypusJumpSequenceId;
- } else {
- _s51_platypusJumpSequenceId = _s51_platypusNextSequenceId;
- }
- if (isJumpingRight(_s51_platypusJumpSequenceId)) {
- ++_s51_platypusNextSequenceId;
- if (!isCollision) {
- if (_vm->isKeyStatus2(Common::KEYCODE_UP) || _vm->isKeyStatus2(Common::KEYCODE_SPACE)) {
- _vm->clearKeyStatus1(Common::KEYCODE_UP);
- _vm->clearKeyStatus1(Common::KEYCODE_SPACE);
- waitForAnim(0);
- _vm->_gameSys->setAnimation(0xB8, 256, 0);
- _vm->_gameSys->insertSequence(0xB8, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, getPosRight(_s51_platypusJumpSequenceId) - 348, 0);
- _s51_platypusSequenceId = 0xB8;
- waitForAnim(0);
- _s51_platypusNextSequenceId += 6;
- if (_s51_platypusNextSequenceId > 0x95)
- _s51_platypusNextSequenceId = 0x95;
- _s51_platypusJumpSequenceId = _s51_platypusNextSequenceId;
- } else {
- ++soundCtr;
- if (soundCtr % 4 == 0)
- _vm->playSound(214, false);
- }
- }
- } else {
- _s51_platypusNextSequenceId = 150 - (_s51_platypusJumpSequenceId - 150);
- }
- isCollision = false;
- isIdle = false;
- }
- _vm->gameUpdateTick();
- }
-
- while (_vm->isKeyStatus2(Common::KEYCODE_LEFT) && _s51_platypusNextSequenceId != 0xB6) {
- // pollMessages();
- updateItemAnimations();
- if (startWalk) {
- _s51_platypusNextSequenceId = 0xA5;
- startWalk = false;
- }
-
- if (_vm->_gameSys->getAnimationStatus(0) == 2) {
- int collisionX = checkCollision(_s51_platypusNextSequenceId);
- if (collisionX)
- incCashAmount(_s51_platypusNextSequenceId);
- _vm->_gameSys->setAnimation(_s51_platypusNextSequenceId, 256, 0);
- _vm->_gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, collisionX, 0);
- _s51_platypusSequenceId = _s51_platypusNextSequenceId;
- if (collisionX) {
- isCollision = true;
- ++_s51_platypusJumpSequenceId;
- _s51_platypusNextSequenceId = _s51_platypusJumpSequenceId;
- } else {
- _s51_platypusJumpSequenceId = _s51_platypusNextSequenceId;
- }
- if (isJumpingLeft(_s51_platypusJumpSequenceId)) {
- ++_s51_platypusNextSequenceId;
- if (!isCollision) {
- if (_vm->isKeyStatus2(Common::KEYCODE_UP) || _vm->isKeyStatus2(Common::KEYCODE_SPACE)) {
- _vm->clearKeyStatus1(Common::KEYCODE_UP);
- _vm->clearKeyStatus1(Common::KEYCODE_SPACE);
- waitForAnim(0);
- _vm->_gameSys->setAnimation(0xB9, 256, 0);
- _vm->_gameSys->insertSequence(0xB9, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, getPosLeft(_s51_platypusJumpSequenceId) - 338, 0);
- _s51_platypusSequenceId = 0xB9;
- waitForAnim(0);
- _s51_platypusNextSequenceId += 6;
- if (_s51_platypusNextSequenceId > 0xB5)
- _s51_platypusNextSequenceId = 0xB5;
- _s51_platypusJumpSequenceId = _s51_platypusNextSequenceId;
- } else {
- ++soundCtr;
- if (soundCtr % 4 == 0)
- _vm->playSound(214, false);
- }
- }
- } else {
- _s51_platypusNextSequenceId = 182 - (_s51_platypusJumpSequenceId - 118);
- }
- isCollision = false;
- isIdle = false;
- }
- _vm->gameUpdateTick();
- }
-
- if (!isIdle && _vm->_gameSys->getAnimationStatus(0) == 2) {
- if (isJumpingRight(_s51_platypusJumpSequenceId)) {
- _vm->_gameSys->setAnimation(0x74, 256, 0);
- _vm->_gameSys->insertSequence(0x74, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, getPosRight(_s51_platypusJumpSequenceId) - 362, 0);
- _s51_platypusSequenceId = 0x74;
- } else {
- _vm->_gameSys->setAnimation(0x75, 256, 0);
- _vm->_gameSys->insertSequence(0x75, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, getPosLeft(_s51_platypusJumpSequenceId) - 341, 0);
- _s51_platypusSequenceId = 0x75;
- }
- waitForAnim(0);
- isIdle = true;
- }
- }
-
- _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE);
- _vm->clearKeyStatus1(Common::KEYCODE_UP);
- _vm->clearKeyStatus1(Common::KEYCODE_SPACE);
- _vm->clearKeyStatus1(Common::KEYCODE_RIGHT);
- _vm->clearKeyStatus1(Common::KEYCODE_LEFT);
-
- _vm->_gameSys->setAnimation(0, 0, 0);
- for (int i = 0; i < 6; ++i)
- _vm->_gameSys->setAnimation(0, 0, i + 1);
-
- _vm->showCursor();
-}
-
-} // End of namespace Gnap
diff --git a/engines/gnap/scenes/scene51.h b/engines/gnap/scenes/scene51.h
deleted file mode 100644
index 44fbd3d4d1..0000000000
--- a/engines/gnap/scenes/scene51.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* 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_SCENE51_H
-#define GNAP_SCENE51_H
-
-#include "gnap/debugger.h"
-#include "gnap/scenes/scenecore.h"
-
-namespace Gnap {
-
-class GnapEngine;
-
-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 _s51_dropLoseCash;
-
- int _s51_cashAmount;
- int _s51_digits[4];
- int _s51_digitSequenceIds[4];
- int _s51_guySequenceId;
- int _s51_guyNextSequenceId;
- int _s51_itemsCaughtCtr;
- int _s51_dropSpeedTicks;
- int _s51_nextDropItemKind;
- int _s51_itemInsertX;
- int _s51_itemInsertDirection;
- int _s51_platypusSequenceId;
- int _s51_platypusNextSequenceId;
- int _s51_platypusJumpSequenceId;
- int _s51_itemsCtr;
- int _s51_itemsCtr1;
- int _s51_itemsCtr2;
-
- Scene51Item _s51_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();
-};
-
-} // End of namespace Gnap
-#endif // GNAP_SCENE51_H
diff --git a/engines/gnap/scenes/scene52.cpp b/engines/gnap/scenes/scene52.cpp
deleted file mode 100644
index ba1b0ff79e..0000000000
--- a/engines/gnap/scenes/scene52.cpp
+++ /dev/null
@@ -1,894 +0,0 @@
-/* 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.
- *
- */
-
-#include "gnap/gnap.h"
-#include "gnap/gamesys.h"
-#include "gnap/resource.h"
-#include "gnap/scenes/scene52.h"
-
-namespace Gnap {
-
-Scene52::Scene52(GnapEngine *vm) : Scene(vm) {
- _s52_gameScore = 0;
- _s52_aliensInitialized = false;
- _s52_alienDirection = 0;
- _s52_soundToggle = false;
-}
-
-int Scene52::init() {
- initAnims();
- return 0x2B;
-}
-
-void Scene52::updateHotspots() {
- _vm->_hotspotsCount = 0;
-}
-
-void Scene52::update() {
- for (int rowNum = 0; rowNum < 7; ++rowNum) {
- _vm->gameUpdateTick();
- if (_vm->_gameSys->getAnimationStatus(_s52_alienRowAnims[rowNum]) == 2) {
- updateAlienRow(rowNum);
- rowNum = 0;
- }
- }
-
- if (_s52_liveAlienRows == 0 && !_s52_alienSingle) {
- _s52_alienWave = false;
- _vm->playSound(48, false);
- ++_s52_alienCounter;
- if (_s52_alienCounter != 3) {
- _vm->_timers[0] = 50;
- _vm->_timers[2] = 100;
- _s52_alienRowDownCtr = 0;
- _s52_alienSingle = true;
- }
- }
-
- if (_s52_alienSingle && !_vm->_timers[0]) {
- initAliens();
- _s52_alienSingle = false;
- _vm->_timers[2] = 5;
- _s52_alienWave = true;
- }
-
- if ((_s52_alienRowDownCtr || _s52_liveAlienRows == 0) && !_s52_alienSingle) {
- moveDownAlienRow();
- _s52_alienRowDownCtr = 0;
- }
-
- if (_vm->isKeyStatus1(Common::KEYCODE_UP) || _vm->isKeyStatus1(Common::KEYCODE_SPACE)) {
- _vm->clearKeyStatus1(Common::KEYCODE_SPACE);
- _vm->clearKeyStatus1(Common::KEYCODE_UP);
- if (!_s52_aliensCount)
- fireShipCannon(_s52_shipPosX);
- }
-
- if (_s52_shipCannonFiring)
- updateShipCannon();
-
- fireAlienCannon();
- updateAlienCannons();
-
- if (_s52_aliensCount == 1) {
- _s52_alienWave = false;
- _vm->_timers[3] = 20;
- _vm->_timers[2] = 100;
- ++_s52_aliensCount;
- }
-
- if (_s52_aliensCount && !_vm->_timers[3]) {
- updateAliens();
- loseShip();
- if (_s52_shipsLeft != 0) {
- _vm->_timers[3] = 40;
- while (_vm->_timers[3]) {
- updateAlienCannons();
- if (_s52_shipCannonFiring)
- updateShipCannon();
- _vm->gameUpdateTick();
- }
- initAliens();
- _s52_shipPosX = (800 - _s52_shipMidX) / 2;
- _vm->_gameSys->setAnimation(_s52_nextUfoSequenceId, 256, 7);
- _vm->_gameSys->insertSequence(_s52_nextUfoSequenceId, 256, 0, 0, kSeqNone, 0, _s52_shipPosX, _s52_arcadeScreenBottom);
- _s52_ufoSequenceId = _s52_nextUfoSequenceId;
- _vm->_timers[2] = 5;
- _s52_alienWave = true;
- } else {
- _vm->_sceneDone = true;
- }
- }
-
- if (_vm->_timers[1] || getFreeShipCannon() == -1) {
- _s52_nextUfoSequenceId = 34;
- if (_s52_ufoSequenceId != 34)
- _s52_shipFlag = true;
- } else {
- _s52_nextUfoSequenceId = 34;
- if (_s52_ufoSequenceId != 34)
- _s52_shipFlag = true;
- }
-
- if (_s52_shipFlag) {
- if (_vm->_gameSys->getAnimationStatus(7) == 2) {
- _vm->_gameSys->setAnimation(_s52_nextUfoSequenceId, 256, 7);
- _vm->_gameSys->insertSequence(_s52_nextUfoSequenceId, 256, _s52_ufoSequenceId, 256, kSeqSyncWait, 0, _s52_shipPosX, _s52_arcadeScreenBottom);
- _s52_ufoSequenceId = _s52_nextUfoSequenceId;
- }
- _s52_shipFlag = false;
- }
-
- if (_s52_alienWave && !_vm->_timers[0]) {
- playSound();
- int v0 = _s52_alienSpeed;
- if (_s52_alienSpeed >= 10)
- v0 = 10;
- int v1 = v0;
- if (v0 < 2)
- v1 = 2;
- _vm->_timers[0] = v1;
- }
-}
-
-void Scene52::initShipCannon(int bottomY) {
- _s52_shipCannonFired = false;
- _s52_shipCannonWidth = MAX(_vm->_gameSys->getSpriteWidthById(14), _vm->_gameSys->getSpriteWidthById(16));
- _s52_shipCannonHeight = MAX(_vm->_gameSys->getSpriteHeightById(14), _vm->_gameSys->getSpriteHeightById(16));
- _s52_shipCannonTopY = bottomY - _s52_shipCannonHeight;
- _s52_shipCannonFiring = false;
-}
-
-void Scene52::initAlienCannons() {
- for (int i = 0; i < 3; ++i) {
- _s52_alienCannonIds[i] = 0;
- _s52_alienCannonFired[i] = 0;
- }
- _s52_alienCannonSequenceIds[0] = 30;
- _s52_alienCannonSequenceIds[1] = 31;
- _s52_alienCannonSequenceIds[2] = 32;
-}
-
-void Scene52::fireShipCannon(int posX) {
- if (_vm->_timers[1])
- return;
-
- int cannonNum = getFreeShipCannon();
- if (cannonNum != -1) {
- _s52_shipCannonPosX = _s52_shipMidX / 2 + posX - _s52_shipCannonWidth / 2;
- _s52_shipCannonPosY = _s52_shipCannonTopY;
- _vm->_gameSys->setAnimation(0x23, cannonNum + 256, cannonNum + 8);
- _vm->_gameSys->insertSequence(0x23, cannonNum + 256, 0, 0, kSeqNone, 0, _s52_shipCannonPosX, _s52_shipCannonPosY);
- _vm->playSound(0x2D, false);
- if (shipCannonHitShield(cannonNum)) {
- _vm->_gameSys->setAnimation(0, 0, cannonNum + 8);
- _vm->_gameSys->removeSequence(0x23, cannonNum + 256, true);
- } else {
- _s52_shipCannonFired = true;
- _s52_shipCannonPosY -= 13;
- _s52_shipCannonFiring = true;
- }
- _vm->_timers[1] = 5;
- }
-}
-
-void Scene52::fireAlienCannon() {
- if (_vm->_timers[2])
- return;
-
- int cannonNum = getFreeAlienCannon();
- if (cannonNum != -1) {
- int alienX1 = _s52_alienLeftX + _s52_alienRowXOfs[0];
- int alienX2 = _s52_alienLeftX + _s52_alienRowXOfs[0] + 5 * _s52_alienWidth - (_s52_alienWidth / 2 - 15);
- _s52_alienCannonPosX[cannonNum] = _vm->getRandom(alienX2 - alienX1) + alienX1;
- _s52_alienCannonPosY[cannonNum] = 104;
- _s52_alienCannonFired[cannonNum] = 1;
- _vm->_gameSys->setAnimation(_s52_alienCannonSequenceIds[cannonNum], _s52_alienCannonIds[cannonNum] + 256, cannonNum + 9);
- _vm->_gameSys->insertSequence(_s52_alienCannonSequenceIds[cannonNum], _s52_alienCannonIds[cannonNum] + 256, 0, 0,
- kSeqNone, 0, _s52_alienCannonPosX[cannonNum], _s52_alienCannonPosY[cannonNum]);
- _s52_alienCannonPosY[cannonNum] -= 13;
- _vm->_timers[2] = 5;
- }
-}
-
-int Scene52::getFreeShipCannon() {
- if (!_s52_shipCannonFired)
- return 0;
- return -1;
-}
-
-int Scene52::getFreeAlienCannon() {
- for (int i = 0; i < 3; ++i)
- if (!_s52_alienCannonFired[i])
- return i;
- return -1;
-}
-
-void Scene52::updateShipCannon() {
- if (_s52_shipCannonFired && _vm->_gameSys->getAnimationStatus(8) == 2) {
- _s52_shipCannonPosY -= 13;
- if (_s52_shipCannonPosY - 13 >= 135) {
- if (updateHitAlien()) {
- _vm->_gameSys->setAnimation(0, 0, 8);
- _vm->_gameSys->removeSequence(35, 256, true);
- _s52_shipCannonFired = false;
- drawScore(_s52_gameScore);
- } else {
- _vm->_gameSys->setAnimation(35, 256, 8);
- _vm->_gameSys->insertSequence(35, 256, 35, 256, kSeqSyncWait, 0, _s52_shipCannonPosX, _s52_shipCannonPosY);
- _s52_shipCannonPosY -= 13;
- }
- } else {
- _vm->_gameSys->setAnimation(0, 0, 8);
- _vm->_gameSys->removeSequence(35, 256, true);
- _s52_shipCannonFired = false;
- }
- }
-}
-
-void Scene52::updateAlienCannons() {
- for (int i = 0; i < 3; ++i) {
- if (_s52_alienCannonFired[i] && _vm->_gameSys->getAnimationStatus(i + 9) == 2) {
- _s52_alienCannonPosY[i] += 13;
- if (_s52_shipCannonHeight + _s52_alienCannonPosY[i] + 13 <= 550) {
- if (alienCannonHitShip(i)) {
- _vm->_gameSys->setAnimation(0, 0, i + 9);
- _s52_alienCannonFired[i] = 0;
- shipExplode();
- } else if (alienCannonHitShield(i)) {
- _s52_alienCannonFired[i] = 0;
- } else {
- _vm->_gameSys->insertSequence(_s52_alienCannonSequenceIds[i], 1 - _s52_alienCannonIds[i] + 256, 0, 0,
- kSeqNone, 0, _s52_alienCannonPosX[i], _s52_alienCannonPosY[i]);
- _vm->_gameSys->setAnimation(_s52_alienCannonSequenceIds[i], 1 - _s52_alienCannonIds[i] + 256, i + 9);
- _s52_alienCannonIds[i] = 1 - _s52_alienCannonIds[i];
- _s52_alienCannonPosY[i] += 13;
- }
- } else {
- _vm->_gameSys->setAnimation(0, 0, i + 9);
- _s52_alienCannonFired[i] = 0;
- }
- }
- }
-}
-
-void Scene52::initAliens() {
- if (!_s52_aliensInitialized) {
- initAlienSize();
- _s52_aliensInitialized = true;
- }
-
- _s52_liveAlienRows = 0;
- _s52_alienSpeed = 0;
- _s52_bottomAlienFlag = false;
- _s52_aliensCount = 0;
- _s52_alienSingle = false;
- _s52_alienRowDownCtr = 0;
-
- initShields();
-
- _s52_alienRowKind[0] = -1;
- _s52_alienRowKind[1] = -1;
- _s52_alienRowKind[2] = -1;
- _s52_alienRowKind[3] = -1;
- _s52_alienRowKind[4] = _vm->getRandom(2) != 0 ? 24 : 27;
- _s52_alienRowKind[5] = _vm->getRandom(2) != 0 ? 25 : 28;
- _s52_alienRowKind[6] = _vm->getRandom(2) != 0 ? 26 : 29;
-
- for (int i = 0; i < 7; ++i) {
- _s52_alienRowAnims[i] = i;
- _s52_alienRowXOfs[i] = 0;
- initAlienRowKind(i, _s52_alienRowKind[i]);
- insertAlienRow(i);
- }
-}
-
-void Scene52::initAlienRowKind(int rowNum, int alienKind) {
- for (int i = 0; i < 5; ++i)
- _s52_items[rowNum][i] = alienKind;
-}
-
-void Scene52::insertAlienRow(int rowNum) {
- if (_s52_alienRowKind[rowNum] >= 0) {
- insertAlienRowAliens(rowNum);
- _s52_alienRowIds[rowNum] = 256;
- _vm->_gameSys->setAnimation(_s52_alienRowKind[rowNum], _s52_alienRowIds[rowNum], _s52_alienRowAnims[rowNum]);
- ++_s52_liveAlienRows;
- }
-}
-
-void Scene52::insertAlienRowAliens(int rowNum) {
- int xOffs = _s52_alienLeftX;
- int yOffs = _s52_alienTopY - 52 * rowNum - _s52_alienHeight + 10;
- for (int i = 0; i < 5; ++i) {
- if (_s52_items[rowNum][i] >= 0) {
- _vm->_gameSys->insertSequence(_s52_items[rowNum][i], i + 256, 0, 0, kSeqNone, 0, xOffs, yOffs);
- ++_s52_alienSpeed;
- }
- xOffs += _s52_alienWidth;
- }
-}
-
-void Scene52::updateAlienRow(int rowNum) {
- if (_s52_alienRowKind[rowNum] != -1 && !checkAlienRow(rowNum)) {
- updateAlienRowXOfs();
- _s52_alienRowIds[rowNum] = -1;
- int xOffs = _s52_alienLeftX + _s52_alienRowXOfs[rowNum];
- int yOffs = _s52_alienTopY - 52 * rowNum - _s52_alienHeight + 10;
- for (int i = 0; i < 5; ++i) {
- if (_s52_items[rowNum][i] >= 0) {
- _vm->_gameSys->insertSequence(_s52_items[rowNum][i], i + 256, _s52_items[rowNum][i], i + 256, kSeqSyncWait, 0, xOffs, yOffs);
- if (_s52_alienRowIds[rowNum] == -1)
- _s52_alienRowIds[rowNum] = i + 256;
- } else if (_s52_items[rowNum][i] == -2) {
- _vm->_gameSys->removeSequence(_s52_alienRowKind[rowNum], i + 256, true);
- _s52_items[rowNum][i] = -1;
- --_s52_alienSpeed;
- }
- xOffs += _s52_alienWidth;
- }
- if (_s52_alienRowIds[rowNum] == -1) {
- _vm->_gameSys->setAnimation(0, 0, _s52_alienRowAnims[rowNum]);
- // MessageBoxA(0, "No live aliens!", "Error 3:", 0x30u);
- } else {
- _vm->_gameSys->setAnimation(_s52_alienRowKind[rowNum], _s52_alienRowIds[rowNum], _s52_alienRowAnims[rowNum]);
- }
- if (rowNum == 1) {
- for (int j = 0; j < 3; ++j) {
- if (_s52_shieldSpriteIds[j] != -1) {
- _vm->_gameSys->fillSurface(0, _s52_shieldPosX[j], _s52_arcadeScreenBottom - 44, 33, 44, 0, 0, 0);
- _s52_shieldSpriteIds[j] = -1;
- }
- }
- }
- if (rowNum == 0 && _s52_bottomAlienFlag)
- shipExplode();
- }
-}
-
-void Scene52::moveDownAlienRow() {
- int v2[5], v3, v1, v0, v4;
-
- for (int i = 0; i < 5; ++i)
- v2[i] = _s52_items[0][i];
-
- v3 = _s52_alienRowIds[0];
- v1 = _s52_alienRowAnims[0];
- v0 = _s52_alienRowKind[0];
- v4 = _s52_alienRowXOfs[0];
-
- for (int j = 0; j < 7; ++j) {
- for (int i = 0; i < 5; ++i)
- _s52_items[j][i] = _s52_items[j + 1][i];
- _s52_alienRowIds[j] = _s52_alienRowIds[j + 1];
- _s52_alienRowAnims[j] = _s52_alienRowAnims[j + 1];
- _s52_alienRowKind[j] = _s52_alienRowKind[j + 1];
- _s52_alienRowXOfs[j] = _s52_alienRowXOfs[j + 1];
- }
-
- for (int i = 0; i < 5; ++i)
- _s52_items[6][i] = v2[i];
-
- _s52_alienRowIds[6] = v3;
- _s52_alienRowAnims[6] = v1;
- _s52_alienRowKind[6] = v0;
- _s52_alienRowXOfs[6] = v4;
-
- updateAlien(6);
- initAlienRowKind(6, _s52_alienRowKind[6]);
- insertAlienRow(6);
-
- _s52_bottomAlienFlag = _s52_alienRowKind[0] > -1;
-}
-
-int Scene52::updateHitAlien() {
- int result = 0, rowNum, ya;
-
- int y = _s52_shipCannonTopY - _s52_shipCannonPosY;
-
- if (y == 26) {
- rowNum = 1;
- ya = _s52_shipCannonPosY + 26;
- } else {
- if (y % 52)
- return 0;
- rowNum = y / 52 + 1;
- ya = _s52_shipCannonPosY;
- }
-
- if (rowNum < 7) {
- int hitAlienNum = getHitAlienNum(rowNum);
- if (hitAlienNum != -1 && _s52_items[rowNum][hitAlienNum] >= 0) {
- _s52_gameScore = ((_s52_items[rowNum][hitAlienNum] - 24) % 3 + _s52_gameScore + 1) % 1000;
- _s52_items[rowNum][hitAlienNum] = -2;
- _vm->playSound(44, false);
- _vm->_gameSys->insertSequence(0x21, 266, 0, 0,
- kSeqNone, 0, _s52_alienLeftX + hitAlienNum * _s52_alienWidth + _s52_alienRowXOfs[rowNum] - 10, ya - _s52_alienHeight);
- result = 1;
- }
- }
-
- return result;
-}
-
-int Scene52::getHitAlienNum(int rowNum) {
- int result = -1;
-
- int v3 = _s52_alienLeftX + _s52_alienRowXOfs[rowNum];
-
- if (_s52_shipCannonPosX >= v3) {
- int v8 = _s52_alienWidth / 2 - 15;
- if (v3 + 5 * _s52_alienWidth - v8 >= _s52_shipCannonPosX) {
- int v4 = v3 + _s52_alienWidth;
- if (_s52_shipCannonPosX >= v4 - v8) {
- int v5 = v4 + _s52_alienWidth;
- if (_s52_shipCannonPosX >= v5 - v8) {
- int v6 = v5 + _s52_alienWidth;
- if (_s52_shipCannonPosX >= v6 - v8) {
- int v7 = v6 + _s52_alienWidth;
- if (_s52_shipCannonPosX >= v7 - v8) {
- if (_s52_shipCannonPosX >= v7 + _s52_alienWidth - v8)
- result = -1;
- else
- result = 4;
- } else {
- result = 3;
- }
- } else {
- result = 2;
- }
- } else {
- result = 1;
- }
- } else {
- result = 0;
- }
- } else {
- result = -1;
- }
- } else {
- result = -1;
- }
- return result;
-}
-
-int Scene52::alienCannonHitShip(int cannonNum) {
- int result = 0;
-
- if (_s52_aliensCount) {
- result = 0;
- } else {
- int cannonY = _s52_alienCannonPosY[cannonNum] - 13;
- if (_s52_arcadeScreenBottom <= cannonY) {
- if (_s52_shipMidY + _s52_arcadeScreenBottom > cannonY) {
- if (_s52_alienCannonPosX[cannonNum] >= _s52_shipPosX)
- result = _s52_alienCannonPosX[cannonNum] < _s52_shipMidX + _s52_shipPosX;
- else
- result = 0;
- } else {
- result = 0;
- }
- } else {
- result = 0;
- }
- }
- return result;
-}
-
-int Scene52::alienCannonHitShield(int cannonNum) {
- int result = 0;
-
- int v3 = _s52_alienCannonPosY[cannonNum] + 39;
- if (_s52_arcadeScreenBottom - 44 > v3)
- return 0;
-
- if (_s52_arcadeScreenBottom <= v3)
- return 0;
-
- if (_s52_alienCannonPosX[cannonNum] < _s52_shieldPosX[0])
- return 0;
-
- if (_s52_alienCannonPosX[cannonNum] > _s52_shieldPosX[2] + 33)
- return 0;
-
- int shieldNum = -1;
- if (_s52_alienCannonPosX[cannonNum] < _s52_shieldPosX[0] + 33)
- shieldNum = 0;
-
- if (shieldNum < 0 && _s52_alienCannonPosX[cannonNum] < _s52_shieldPosX[1])
- return 0;
-
- if (shieldNum < 0 && _s52_alienCannonPosX[cannonNum] < _s52_shieldPosX[1] + 33)
- shieldNum = 1;
-
- if (shieldNum < 0) {
- if (_s52_alienCannonPosX[cannonNum] < _s52_shieldPosX[2])
- return 0;
- shieldNum = 2;
- }
-
- if (_s52_shieldSpriteIds[shieldNum] == -1) {
- result = 0;
- } else {
- ++_s52_shieldSpriteIds[shieldNum];
- if (_s52_shieldSpriteIds[shieldNum] <= 21) {
- _vm->_gameSys->drawSpriteToBackground(_s52_shieldPosX[shieldNum], _s52_arcadeScreenBottom - 44, _s52_shieldSpriteIds[shieldNum]);
- } else {
- _vm->_gameSys->fillSurface(0, _s52_shieldPosX[shieldNum], _s52_arcadeScreenBottom - 44, 33, 44, 0, 0, 0);
- _s52_shieldSpriteIds[shieldNum] = -1;
- }
- _vm->_gameSys->setAnimation(0, 0, cannonNum + 9);
- _vm->_gameSys->insertSequence(0x21, shieldNum + 257, 0, 0, kSeqNone, 0, _s52_alienCannonPosX[cannonNum] - 18, _s52_arcadeScreenBottom - 44);
- _vm->playSound(0x2C, false);
- result = 1;
- }
-
- return result;
-}
-
-bool Scene52::shipCannonHitShield(int cannonNum) {
- bool result = false;
-
- if (_s52_shipCannonPosX < _s52_shieldPosX[0])
- return result;
-
- if (_s52_shipCannonPosX > _s52_shieldPosX[2] + 33)
- return result;
-
- int shieldNum = -1;
- if (_s52_shipCannonPosX < _s52_shieldPosX[0] + 33)
- shieldNum = 0;
-
- if (shieldNum < 0 && _s52_shipCannonPosX < _s52_shieldPosX[1])
- return result;
-
- if (shieldNum < 0 && _s52_shipCannonPosX < _s52_shieldPosX[1] + 33)
- shieldNum = 1;
-
- if (shieldNum < 0) {
- if (_s52_shipCannonPosX < _s52_shieldPosX[2])
- return result;
- shieldNum = 2;
- }
-
- if (_s52_shieldSpriteIds[shieldNum] == -1) {
- result = false;
- } else {
- ++_s52_shieldSpriteIds[shieldNum];
- if (_s52_shieldSpriteIds[shieldNum] <= 21) {
- _vm->_gameSys->drawSpriteToBackground(_s52_shieldPosX[shieldNum], _s52_arcadeScreenBottom - 44, _s52_shieldSpriteIds[shieldNum]);
- } else {
- _vm->_gameSys->fillSurface(0, _s52_shieldPosX[shieldNum], _s52_arcadeScreenBottom - 44, 33, 44, 0, 0, 0);
- _s52_shieldSpriteIds[shieldNum] = -1;
- }
- _vm->_gameSys->insertSequence(0x21, shieldNum + 257, 0, 0, kSeqNone, 0, _s52_shipCannonPosX - 18, _s52_arcadeScreenBottom - 44);
- _vm->playSound(0x2C, false);
- result = true;
- }
-
- return result;
-}
-
-bool Scene52::shipCannonHitAlien() {
- bool result = false;
-
- if (_s52_aliensCount || checkAlienRow(0))
- return false;
-
- int alienNextX = _s52_alienLeftX + _s52_alienRowXOfs[0];
- if (_s52_shipMidX + _s52_shipPosX >= alienNextX) {
- int startX = _s52_alienWidth / 2 - 15;
- if (alienNextX + 5 * _s52_alienWidth - startX >= _s52_shipPosX) {
- int alienNextDeltaX = alienNextX + _s52_alienWidth;
- if (_s52_items[0][0] <= -1 || alienNextDeltaX - startX <= _s52_shipPosX) {
- alienNextDeltaX += _s52_alienWidth;
- if (_s52_items[0][1] <= -1 || alienNextDeltaX - startX <= _s52_shipPosX) {
- alienNextDeltaX += _s52_alienWidth;
- if (_s52_items[0][2] <= -1 || alienNextDeltaX - startX <= _s52_shipPosX) {
- alienNextDeltaX += _s52_alienWidth;
- if (_s52_items[0][3] <= -1 || alienNextDeltaX - startX <= _s52_shipPosX) {
- alienNextDeltaX += _s52_alienWidth;
- result = _s52_items[0][4] > -1 && alienNextDeltaX - startX > _s52_shipPosX;
- } else {
- result = true;
- }
- } else {
- result = true;
- }
- } else {
- result = true;
- }
- } else {
- result = true;
- }
- } else {
- result = false;
- }
- } else {
- result = false;
- }
-
- return result;
-}
-
-void Scene52::shipExplode() {
- if (!_s52_aliensCount) {
- _vm->_gameSys->setAnimation(0, 0, 7);
- _vm->_gameSys->removeSequence(_s52_ufoSequenceId, 256, true);
- _vm->playSound(44, false);
- _vm->_gameSys->insertSequence(0x21, 266, 0, 0, kSeqNone, 0, _s52_shipPosX, _s52_arcadeScreenBottom);
- _s52_aliensCount = 1;
- _vm->playSound(0x31, false);
- }
-}
-
-bool Scene52::checkAlienRow(int rowNum) {
- for (int i = 0; i < 5; ++i) {
- if (_s52_items[rowNum][i] >= 0)
- return false;
- }
-
- bool found = false;
- for (int j = 0; j < 5; ++j)
- if (_s52_items[rowNum][j] == -2) {
- _vm->_gameSys->removeSequence(_s52_alienRowKind[rowNum], j + 256, true);
- _s52_items[rowNum][j] = -1;
- --_s52_alienSpeed;
- found = true;
- }
-
- if (found) {
- _vm->_gameSys->setAnimation(0, 0, _s52_alienRowAnims[rowNum]);
- --_s52_liveAlienRows;
- }
-
- if (_s52_liveAlienRows < 0)
- _s52_liveAlienRows = 0;
-
- return true;
-}
-
-void Scene52::updateAlienRowXOfs() {
- int amount = 2 * (3 - _s52_liveAlienRows) + 1;
-
- if (_s52_alienSpeed == 2)
- amount *= 4;
- else if (_s52_alienSpeed == 1)
- amount *= 10;
-
- if (_s52_alienDirection) {
- for (int i = 0; i < 7; ++i) {
- _s52_alienRowXOfs[i] -= amount;
- if (_s52_alienRowXOfs[i] <= -100) {
- _s52_alienRowXOfs[i] = -100;
- _s52_alienDirection = 0;
- ++_s52_alienRowDownCtr;
- }
- }
- } else {
- for (int j = 0; j < 7; ++j) {
- _s52_alienRowXOfs[j] += amount;
- if (_s52_alienRowXOfs[j] >= 100) {
- _s52_alienRowXOfs[j] = 100;
- _s52_alienDirection = 1;
- ++_s52_alienRowDownCtr;
- }
- }
- }
-}
-
-void Scene52::initAlienSize() {
- _s52_alienWidth = _vm->_gameSys->getSpriteWidthById(0);
- if (_vm->_gameSys->getSpriteWidthById(1) > _s52_alienWidth)
- _s52_alienWidth = _vm->_gameSys->getSpriteWidthById(1);
- if (_vm->_gameSys->getSpriteWidthById(4) > _s52_alienWidth)
- _s52_alienWidth = _vm->_gameSys->getSpriteWidthById(4);
- if (_vm->_gameSys->getSpriteWidthById(5) > _s52_alienWidth)
- _s52_alienWidth = _vm->_gameSys->getSpriteWidthById(5);
- if (_vm->_gameSys->getSpriteWidthById(12) > _s52_alienWidth)
- _s52_alienWidth = _vm->_gameSys->getSpriteWidthById(12);
- if (_vm->_gameSys->getSpriteWidthById(13) > _s52_alienWidth)
- _s52_alienWidth = _vm->_gameSys->getSpriteWidthById(13);
-
- _s52_alienHeight = _vm->_gameSys->getSpriteHeightById(0);
- if (_vm->_gameSys->getSpriteHeightById(1) > _s52_alienHeight)
- _s52_alienHeight = _vm->_gameSys->getSpriteHeightById(1);
- if (_vm->_gameSys->getSpriteHeightById(4) > _s52_alienHeight)
- _s52_alienHeight = _vm->_gameSys->getSpriteHeightById(4);
- if (_vm->_gameSys->getSpriteHeightById(5) > _s52_alienHeight)
- _s52_alienHeight = _vm->_gameSys->getSpriteHeightById(5);
- if (_vm->_gameSys->getSpriteHeightById(12) > _s52_alienHeight)
- _s52_alienHeight = _vm->_gameSys->getSpriteHeightById(12);
- if (_vm->_gameSys->getSpriteHeightById(13) > _s52_alienHeight)
- _s52_alienHeight = _vm->_gameSys->getSpriteHeightById(13);
-
- _s52_alienTopY = _s52_shipCannonTopY + 52;
- _s52_alienLeftX = (800 - 5 * _s52_alienWidth) / 2;
-}
-
-void Scene52::playSound() {
- if (_s52_soundToggle) {
- _vm->playSound(0x2F, false);
- _s52_soundToggle = false;
- } else {
- _vm->playSound(0x2E, false);
- _s52_soundToggle = true;
- }
-}
-
-void Scene52::updateAliens() {
- for (int i = 0; i < 7; ++i)
- updateAlien(i);
-}
-
-void Scene52::updateAlien(int rowNum) {
- if (_s52_alienRowKind[rowNum] >= 0 && !checkAlienRow(rowNum)) {
- for (int i = 0; i < 5; ++i) {
- if (_s52_items[rowNum][i] >= 0)
- _s52_items[rowNum][i] = -2;
- }
- checkAlienRow(rowNum);
- }
-}
-
-void Scene52::loseShip() {
- --_s52_shipsLeft;
- if (_s52_shipsLeft == 2) {
- _vm->_gameSys->fillSurface(0, 120, 140, _s52_shipMidX, _s52_shipMidY, 0, 0, 0);
- } else if (_s52_shipsLeft == 1) {
- _vm->_gameSys->fillSurface(0, 120, 185, _s52_shipMidX, _s52_shipMidY, 0, 0, 0);
- }
-}
-
-void Scene52::initShields() {
- for (int i = 0; i < 3; ++i) {
- _vm->_gameSys->drawSpriteToBackground(_s52_shieldPosX[i], _s52_arcadeScreenBottom - 44, 17);
- _s52_shieldSpriteIds[i] = 17;
- }
-}
-
-void Scene52::initAnims() {
- for (int i = 0; i < 7; ++i)
- _vm->_gameSys->setAnimation(0, 0, i);
- _vm->_gameSys->setAnimation(0, 0, 7);
- for (int j = 0; j < 1; ++j)
- _vm->_gameSys->setAnimation(0, 0, j + 8);
- for (int k = 0; k < 3; ++k)
- _vm->_gameSys->setAnimation(0, 0, k + 9);
-}
-
-void Scene52::drawScore(int score) {
- char str[4];
- sprintf(str, "%03d", score);
- _vm->_gameSys->fillSurface(0, 420, 80, 48, 30, 0, 0, 0);
- _vm->_gameSys->drawTextToSurface(0, 420, 80, 255, 255, 255, str);
-}
-
-void Scene52::run() {
- _vm->_timers[1] = 0;
-
- _vm->hideCursor();
-
- // TODO loadFont("maturasc", "Matura MT Script Capitals", 2000);
- // TODO setFontSize(24);
-
- _s52_gameScore = 0;
- _vm->_gameSys->drawTextToSurface(0, 300, 80, 255, 255, 255, "SCORE");
- _vm->_gameSys->drawTextToSurface(0, 468, 80, 255, 255, 255, "0");
-
- drawScore(0);
-
- _s52_shipMidX = 33;
- _s52_shipMidY = _vm->_gameSys->getSpriteHeightById(15);
- _s52_shipPosX = (800 - _s52_shipMidX) / 2;
- _s52_arcadeScreenBottom = 496;
- _s52_arcadeScreenRight = 595 - _s52_shipMidX;
- _s52_arcadeScreenLeft = 210;
- _s52_shipsLeft = 3;
- _s52_alienCounter = 0;
-
- _s52_shieldPosX[0] = 247;
- _s52_shieldPosX[1] = 387;
- _s52_shieldPosX[2] = 525;
-
- for (int i = 0; i < 3; ++i)
- _s52_shieldSpriteIds[i] = -1;
-
- _vm->_gameSys->drawSpriteToBackground(120, 140, 0xF);
- _vm->_gameSys->drawSpriteToBackground(120, 185, 0xF);
-
- initShipCannon(_s52_arcadeScreenBottom);
- initAlienCannons();
- initAliens();
-
- _s52_nextUfoSequenceId = 0x22;
- _vm->_gameSys->setAnimation(0x22, 256, 7);
- _vm->_gameSys->insertSequence(_s52_nextUfoSequenceId, 256, 0, 0, kSeqNone, 0, _s52_shipPosX, _s52_arcadeScreenBottom);
-
- _s52_ufoSequenceId = _s52_nextUfoSequenceId;
-
- _vm->clearKeyStatus1(Common::KEYCODE_RIGHT);
- _vm->clearKeyStatus1(Common::KEYCODE_LEFT);
- _vm->clearKeyStatus1(Common::KEYCODE_SPACE);
- _vm->clearKeyStatus1(Common::KEYCODE_UP);
- _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE);
-
- _vm->_timers[2] = 5;
- _s52_shipFlag = false;
-
- _vm->_timers[0] = 10;
- _s52_alienWave = true;
-
- while (!_vm->_sceneDone) {
- _vm->gameUpdateTick();
-
- while (_vm->isKeyStatus2(Common::KEYCODE_RIGHT)) {
- update();
- if (_vm->_gameSys->getAnimationStatus(7) == 2) {
- if (_s52_shipPosX < _s52_arcadeScreenRight) {
- _s52_shipPosX += 15;
- if (_s52_shipPosX > _s52_arcadeScreenRight)
- _s52_shipPosX = _s52_arcadeScreenRight;
- _vm->_gameSys->setAnimation(_s52_nextUfoSequenceId, 256, 7);
- _vm->_gameSys->insertSequence(_s52_nextUfoSequenceId, 256, _s52_ufoSequenceId, 256, kSeqSyncWait, 0, _s52_shipPosX, _s52_arcadeScreenBottom);
- _s52_ufoSequenceId = _s52_nextUfoSequenceId;
- if (_s52_bottomAlienFlag && shipCannonHitAlien())
- shipExplode();
- }
- break;
- }
- }
-
- while (_vm->isKeyStatus2(Common::KEYCODE_LEFT)) {
- update();
- if (_vm->_gameSys->getAnimationStatus(7) == 2) {
- if (_s52_shipPosX > _s52_arcadeScreenLeft) {
- _s52_shipPosX -= 15;
- if (_s52_shipPosX < _s52_arcadeScreenLeft)
- _s52_shipPosX = _s52_arcadeScreenLeft;
- _vm->_gameSys->setAnimation(_s52_nextUfoSequenceId, 256, 7);
- _vm->_gameSys->insertSequence(_s52_nextUfoSequenceId, 256, _s52_ufoSequenceId, 256, kSeqSyncWait, 0, _s52_shipPosX, _s52_arcadeScreenBottom);
- _s52_ufoSequenceId = _s52_nextUfoSequenceId;
- if (_s52_bottomAlienFlag && shipCannonHitAlien())
- shipExplode();
- }
- break;
- }
- }
-
- update();
-
- if (clearKeyStatus()) {
- _s52_alienWave = false;
- _vm->_gameSys->waitForUpdate();
- initAnims();
- _vm->clearKeyStatus1(30);
- _vm->_sceneDone = true;
- }
- }
-
- // TODO freeFont();
-
- _vm->_gameSys->waitForUpdate();
-}
-
-} // End of namespace Gnap
diff --git a/engines/gnap/scenes/scene52.h b/engines/gnap/scenes/scene52.h
deleted file mode 100644
index 0fbc29cb71..0000000000
--- a/engines/gnap/scenes/scene52.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* 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_SCENE52_H
-#define GNAP_SCENE52_H
-
-#include "gnap/debugger.h"
-#include "gnap/scenes/scenecore.h"
-
-namespace Gnap {
-
-class GnapEngine;
-
-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 _s52_liveAlienRows;
- int _s52_gameScore;
- bool _s52_soundToggle;
- int _s52_arcadeScreenLeft;
- int _s52_arcadeScreenRight;
- int _s52_arcadeScreenBottom;
- int _s52_shipsLeft;
- int _s52_shieldSpriteIds[3];
- int _s52_shieldPosX[3];
- int _s52_shipPosX;
- int _s52_shipCannonPosX, _s52_shipCannonPosY;
- bool _s52_shipCannonFiring;
- bool _s52_shipCannonFired;
- int _s52_shipCannonWidth, _s52_shipCannonHeight;
- int _s52_shipCannonTopY;
- int _s52_shipMidX, _s52_shipMidY;
- bool _s52_shipFlag;
- bool _s52_aliensInitialized;
- int _s52_alienSpeed, _s52_alienDirection;
- int _s52_alienWidth, _s52_alienHeight;
- int _s52_alienLeftX, _s52_alienTopY;
- int _s52_alienRowDownCtr;
- int _s52_alienRowKind[7];
- int _s52_alienRowAnims[7];
- int _s52_alienRowIds[7];
- int _s52_alienRowXOfs[7];
- int _s52_alienCannonFired[3];
- int _s52_alienCannonPosX[3];
- int _s52_alienCannonPosY[3];
- int _s52_alienCannonSequenceIds[3];
- int _s52_alienCannonIds[3];
- bool _s52_alienWave, _s52_alienSingle;
- int _s52_alienCounter;
- bool _s52_bottomAlienFlag;
- int _s52_aliensCount;
- int _s52_items[8][5];
- int _s52_nextUfoSequenceId, _s52_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_SCENE52_H
diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp
index 6fc51d862c..2b67d59d37 100644
--- a/engines/gnap/scenes/scenecore.cpp
+++ b/engines/gnap/scenes/scenecore.cpp
@@ -25,19 +25,17 @@
#include "gnap/resource.h"
#include "gnap/scenes/scenecore.h"
+
+#include "gnap/scenes/arcade.h"
#include "gnap/scenes/groupcs.h"
#include "gnap/scenes/group0.h"
#include "gnap/scenes/group1.h"
#include "gnap/scenes/group2.h"
#include "gnap/scenes/group3.h"
#include "gnap/scenes/group4.h"
+#include "gnap/scenes/group5.h"
#include "gnap/scenes/intro.h"
-#include "gnap/scenes/scene50.h"
-#include "gnap/scenes/scene51.h"
-#include "gnap/scenes/scene52.h"
-#include "gnap/scenes/scene53.h"
-
namespace Gnap {
int GnapEngine::initSceneLogic() {