From 4edfe094ea91c4a05a71613fc398d1b32851713f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 27 Apr 2016 23:04:00 +0200 Subject: GNAP: renaming and grouping of scenes in group 2 --- engines/gnap/scenes/group2.cpp | 3549 +++++++++++++++++++++++++++++++++++++ engines/gnap/scenes/group2.h | 211 +++ engines/gnap/scenes/scene20.cpp | 732 -------- engines/gnap/scenes/scene20.h | 57 - engines/gnap/scenes/scene21.cpp | 344 ---- engines/gnap/scenes/scene21.h | 50 - engines/gnap/scenes/scene22.cpp | 292 --- engines/gnap/scenes/scene22.h | 52 - engines/gnap/scenes/scene23.cpp | 295 --- engines/gnap/scenes/scene23.h | 50 - engines/gnap/scenes/scene24.cpp | 262 --- engines/gnap/scenes/scene24.h | 52 - engines/gnap/scenes/scene25.cpp | 397 ----- engines/gnap/scenes/scene25.h | 52 - engines/gnap/scenes/scene26.cpp | 255 --- engines/gnap/scenes/scene26.h | 50 - engines/gnap/scenes/scene27.cpp | 421 ----- engines/gnap/scenes/scene27.h | 50 - engines/gnap/scenes/scene28.cpp | 448 ----- engines/gnap/scenes/scene28.h | 51 - engines/gnap/scenes/scene29.cpp | 358 ---- engines/gnap/scenes/scene29.h | 52 - engines/gnap/scenes/scenecore.cpp | 11 +- 23 files changed, 3761 insertions(+), 4330 deletions(-) create mode 100644 engines/gnap/scenes/group2.cpp create mode 100644 engines/gnap/scenes/group2.h delete mode 100644 engines/gnap/scenes/scene20.cpp delete mode 100644 engines/gnap/scenes/scene20.h delete mode 100644 engines/gnap/scenes/scene21.cpp delete mode 100644 engines/gnap/scenes/scene21.h delete mode 100644 engines/gnap/scenes/scene22.cpp delete mode 100644 engines/gnap/scenes/scene22.h delete mode 100644 engines/gnap/scenes/scene23.cpp delete mode 100644 engines/gnap/scenes/scene23.h delete mode 100644 engines/gnap/scenes/scene24.cpp delete mode 100644 engines/gnap/scenes/scene24.h delete mode 100644 engines/gnap/scenes/scene25.cpp delete mode 100644 engines/gnap/scenes/scene25.h delete mode 100644 engines/gnap/scenes/scene26.cpp delete mode 100644 engines/gnap/scenes/scene26.h delete mode 100644 engines/gnap/scenes/scene27.cpp delete mode 100644 engines/gnap/scenes/scene27.h delete mode 100644 engines/gnap/scenes/scene28.cpp delete mode 100644 engines/gnap/scenes/scene28.h delete mode 100644 engines/gnap/scenes/scene29.cpp delete mode 100644 engines/gnap/scenes/scene29.h (limited to 'engines/gnap/scenes') diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp new file mode 100644 index 0000000000..0a89b83dc5 --- /dev/null +++ b/engines/gnap/scenes/group2.cpp @@ -0,0 +1,3549 @@ +/* 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/group2.h" + +namespace Gnap { + +enum { + kHS20Platypus = 0, + kHS20GroceryStoreHat = 1, + kHS20ExitParkingLot = 2, + kHS20StonerGuy = 3, + kHS20GroceryStoreGuy = 4, + kHS20Device = 5, + kHS20ExitInsideGrubCity = 6, + kHS20ExitOutsideCircusWorld = 7, + kHS20ExitOutsideToyStore = 8, + kHS20ExitPhone = 9, + kHS20WalkArea1 = 10, + kHS20WalkArea2 = 11 +}; + +enum { + kAS20LeaveScene = 0, + kAS20TalkStonerGuyNoJoint = 2, + kAS20TalkStonerGuyHasJoint = 3, + kAS20GrabJoint = 4, + kAS20ActionDone = 5, + kAS20TalkGroceryStoreGuy = 6, + kAS20GrabGroceryStoreGuy = 9, + kAS20GrabGroceryStoreHat = 10, + kAS20SwitchGroceryStoreHat = 11, + kAS20SwitchGroceryStoreHatDone = 12, + kAS20GrabJointDone = 13 +}; + +Scene20::Scene20(GnapEngine *vm) : Scene(vm) { + _stonerGuyCtr = 3; + _stonerGuyShowingJoint = false; + _groceryStoreGuyCtr = 0; +} + +int Scene20::init() { + return 0x186; +} + +void Scene20::updateHotspots() { + _vm->setHotspot(kHS20Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS20GroceryStoreHat, 114, 441, 174, 486, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 7); + _vm->setHotspot(kHS20ExitParkingLot, 0, 300, 15, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 7); + _vm->setHotspot(kHS20StonerGuy, 276, 290, 386, 450, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 8); + _vm->setHotspot(kHS20GroceryStoreGuy, 123, 282, 258, 462, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); + _vm->setHotspot(kHS20ExitInsideGrubCity, 519, 250, 581, 413, SF_EXIT_L_CURSOR, 8, 7); + _vm->setHotspot(kHS20ExitOutsideCircusWorld, 660, 222, 798, 442, SF_EXIT_NE_CURSOR, 9, 6); + _vm->setHotspot(kHS20ExitOutsideToyStore, 785, 350, 800, 600, SF_EXIT_R_CURSOR, 11, 8); + _vm->setHotspot(kHS20ExitPhone, 250, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 10); + _vm->setHotspot(kHS20WalkArea1, 0, 0, 800, 468); + _vm->setHotspot(kHS20WalkArea2, 605, 0, 800, 600); + _vm->setDeviceHotspot(kHS20Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 12; +} + +void Scene20::updateAnimationsCb() { + if (_vm->_gameSys->getAnimationStatus(2) == 2) { + switch (_nextStonerGuySequenceId) { + case 0x16B: + if (!_vm->_timers[4]) { + _stonerGuyShowingJoint = false; + _vm->_gameSys->insertSequence(0x16B, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _currStonerGuySequenceId = 0x16B; + _nextStonerGuySequenceId = -1; + } + break; + case 0x16A: + // Grab joint + _vm->playGnapPullOutDevice(4, 4); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->setAnimation(0x16A, 21, 0); + _vm->_gameSys->insertSequence(0x16A, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _currStonerGuySequenceId = 0x16A; + _nextStonerGuySequenceId = -1; + _vm->invAdd(kItemJoint); + _vm->setFlag(kGFJointTaken); + _stonerGuyShowingJoint = false; + _vm->_gnapActionStatus = kAS20GrabJointDone; + break; + case 0x16E: + _vm->_gameSys->setAnimation(0x16E, 21, 2); + _vm->_gameSys->insertSequence(0x16E, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _currStonerGuySequenceId = 0x16E; + _nextStonerGuySequenceId = -1; + _nextGroceryStoreGuySequenceId = 0x175; + break; + case 0x16D: + _vm->_gameSys->setAnimation(_nextStonerGuySequenceId, 21, 2); + _vm->_gameSys->setAnimation(_nextStonerGuySequenceId, 21, 0); + _vm->_gameSys->insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _currStonerGuySequenceId = _nextStonerGuySequenceId; + _nextStonerGuySequenceId = -1; + _vm->_gnapActionStatus = kAS20ActionDone; + break; + case 0x16F: + _vm->_gameSys->setAnimation(_nextStonerGuySequenceId, 21, 2); + _vm->_gameSys->setAnimation(0x17A, 20, 3); + _vm->_gameSys->insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x17A, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _currGroceryStoreGuySequenceId = 0x17A; + _nextGroceryStoreGuySequenceId = -1; + _currStonerGuySequenceId = _nextStonerGuySequenceId; + _nextStonerGuySequenceId = -1; + break; + case 0x171: + _stonerGuyCtr = (_stonerGuyCtr + 1) % 3; + switch (_stonerGuyCtr) { + case 1: + _nextStonerGuySequenceId = 0x171; + break; + case 2: + _nextStonerGuySequenceId = 0x172; + break; + case 3: + _nextStonerGuySequenceId = 0x173; + break; + default: + _nextStonerGuySequenceId = 0x171; + break; + } + _vm->_gameSys->insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x17C, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x17C, 20, 3); + _vm->_gameSys->setAnimation(_nextStonerGuySequenceId, 21, 2); + _currGroceryStoreGuySequenceId = 0x17C; + _nextGroceryStoreGuySequenceId = -1; + _currStonerGuySequenceId = _nextStonerGuySequenceId; + _nextStonerGuySequenceId = -1; + break; + default: + _nextStonerGuySequenceId = 0x16C; + _vm->_gameSys->setAnimation(0x16C, 21, 2); + _vm->_gameSys->insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _currStonerGuySequenceId = _nextStonerGuySequenceId; + _nextStonerGuySequenceId = -1; + break; + } + } +} + +void Scene20::stopSounds() { + _vm->stopSound(0x18E); + _vm->stopSound(0x18F); + _vm->stopSound(0x190); + _vm->stopSound(0x191); + _vm->stopSound(0x194); + _vm->stopSound(0x195); + _vm->stopSound(0x192); + _vm->stopSound(0x193); + _vm->stopSound(0x196); + _vm->stopSound(0x197); + _vm->stopSound(0x198); + _vm->stopSound(0x199); + _vm->stopSound(0x19A); +} + +void Scene20::run() { + _vm->playSound(0x10940, true); + _vm->startSoundTimerA(8); + + _stonerGuyShowingJoint = false; + _vm->_timers[7] = _vm->getRandom(100) + 100; + + _stonerGuyCtr = (_stonerGuyCtr + 1) % 3; + switch (_stonerGuyCtr) { + case 1: + _currStonerGuySequenceId = 0x171; + break; + case 2: + _currStonerGuySequenceId = 0x172; + break; + case 3: + _currStonerGuySequenceId = 0x173; + break; + } + + _nextStonerGuySequenceId = -1; + _vm->_gameSys->setAnimation(_currStonerGuySequenceId, 21, 2); + _vm->_gameSys->insertSequence(_currStonerGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); + + _vm->_timers[6] = _vm->getRandom(20) + 30; + + _currGroceryStoreGuySequenceId = 0x17C; + _nextGroceryStoreGuySequenceId = -1; + _vm->_gameSys->setAnimation(0x17C, 20, 3); + _vm->_gameSys->insertSequence(0x17C, 20, 0, 0, kSeqNone, 0, 0, 0); + + _vm->_timers[5] = _vm->getRandom(50) + 130; + if (_vm->isFlag(kGFGroceryStoreHatTaken)) + _vm->_gameSys->insertSequence(0x17F, 20, 0, 0, kSeqNone, 0, 0, 0); + else + _vm->_gameSys->insertSequence(0x174, 20, 0, 0, kSeqNone, 0, 0, 0); + + _vm->queueInsertDeviceIcon(); + + if (_vm->isFlag(kGFSceneFlag1)) { + _vm->clearFlag(kGFSceneFlag1); + _vm->endSceneInit(); + _vm->_gameSys->setAnimation(0x182, 140, 0); + _vm->_gameSys->insertSequence(0x182, 140, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(0) != 2) { + // checkGameAppStatus(); + _vm->gameUpdateTick(); + } + _vm->initGnapPos(11, 8, kDirBottomLeft); + _vm->initPlatypusPos(11, 9, kDirUnk4); + _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); + } else { + switch (_vm->_prevSceneNum) { + case 17: + _vm->initGnapPos(5, 11, kDirBottomRight); + _vm->initPlatypusPos(6, 11, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); + break; + case 18: + _vm->initGnapPos(11, 8, kDirBottomLeft); + _vm->initPlatypusPos(11, 9, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); + break; + case 21: + _vm->initGnapPos(-1, 8, kDirBottomLeft); + _vm->initPlatypusPos(-1, 9, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(3, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(3, 9, -1, 0x107C2, 1); + break; + case 22: + _vm->initGnapPos(7, 6, kDirBottomRight); + _vm->initPlatypusPos(8, 6, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(9, 9, -1, 0x107C2, 1); + break; + default: + _vm->initGnapPos(8, 6, kDirBottomLeft); + _vm->initPlatypusPos(9, 6, kDirUnk4); + _vm->endSceneInit(); + _vm->_hotspots[kHS20WalkArea2]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(9, 9, -1, 0x107C2, 1); + _vm->_hotspots[kHS20WalkArea2]._flags &= ~SF_WALKABLE; + break; + } + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 0, -1, -1, -1, -1); + _vm->testWalk(0, 1, 7, 9, 8, 9); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS20Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS20Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(20); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS20ExitParkingLot: + if (_vm->_gnapActionStatus < 0) { + if (_stonerGuyShowingJoint) + _vm->_timers[4] = 0; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 21; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot].x, _vm->_hotspotsWalkPos[kHS20ExitParkingLot].y, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kAS20LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot].x, _vm->_hotspotsWalkPos[kHS20ExitParkingLot].y + 1, -1, 0x107CF, 1); + _vm->_platypusFacing = kDirUnk4; + } + break; + + case kHS20ExitPhone: + if (_vm->_gnapActionStatus < 0) { + if (_stonerGuyShowingJoint) + _vm->_timers[4] = 0; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 17; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone].x, _vm->_hotspotsWalkPos[kHS20ExitPhone].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kAS20LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone].x + 1, _vm->_hotspotsWalkPos[kHS20ExitPhone].y, -1, 0x107C2, 1); + } + break; + + case kHS20ExitOutsideToyStore: + if (_vm->_gnapActionStatus < 0) { + if (_stonerGuyShowingJoint) + _vm->_timers[4] = 0; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 18; + _vm->_hotspots[kHS20WalkArea2]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore].x, _vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kAS20LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore].x, _vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore].y + 1, -1, 0x107CD, 1); + _vm->_hotspots[kHS20WalkArea2]._flags &= ~SF_WALKABLE; + } + break; + + case kHS20ExitInsideGrubCity: + if (_vm->_gnapActionStatus < 0) { + if (_stonerGuyShowingJoint) + _vm->_timers[4] = 0; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 22; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity].x, _vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity].y - 1, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kAS20LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity].y, -1, 0x107C2, 1); + _vm->_platypusFacing = kDirUnk4; + } + break; + + case kHS20ExitOutsideCircusWorld: + if (_vm->_gnapActionStatus < 0) { + if (_stonerGuyShowingJoint) + _vm->_timers[4] = 0; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 24; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld].x, _vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld].y, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kAS20LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld].y, -1, 0x107C2, 1); + } + break; + + case kHS20StonerGuy: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 5, 4); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan2(5, 4); + break; + case GRAB_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + if (_stonerGuyShowingJoint) + _vm->_gnapActionStatus = kAS20GrabJoint; + else + _vm->playGnapImpossible(0, 0); + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + if (_vm->isFlag(kGFJointTaken)) + _vm->_gnapActionStatus = kAS20TalkStonerGuyNoJoint; + else + _vm->_gnapActionStatus = kAS20TalkStonerGuyHasJoint; + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS20GroceryStoreGuy: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 2, 4); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(2, 3); + break; + case GRAB_CURSOR: + _stonerGuyShowingJoint = false; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS20GrabGroceryStoreGuy; + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS20TalkGroceryStoreGuy; + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS20GroceryStoreHat: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemCowboyHat) { + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreHat].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS20SwitchGroceryStoreHat; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreHat].y, 1, 6); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(1, 6); + break; + case GRAB_CURSOR: + _stonerGuyShowingJoint = false; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS20GrabGroceryStoreHat; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS20WalkArea1: + case kHS20WalkArea2: + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x10940)) + _vm->playSound(0x10940, true); + + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0) { + _vm->_hotspots[kHS20WalkArea1]._y2 += 48; + _vm->updatePlatypusIdleSequence(); + _vm->_hotspots[kHS20WalkArea1]._y2 -= 48; + } + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (_vm->_gnapActionStatus < 0 && !_vm->_timers[5] && _nextGroceryStoreGuySequenceId == -1) { + _vm->_timers[5] = _vm->getRandom(50) + 130; + if (_vm->getRandom(4) != 0) + _nextGroceryStoreGuySequenceId = 0x17C; + else + _nextGroceryStoreGuySequenceId = 0x17A; + } + if (!_vm->_timers[7]) { + _vm->_timers[7] = _vm->getRandom(100) + 100; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + switch (_vm->getRandom(3)) { + case 0: + _vm->_gameSys->insertSequence(0x183, 253, 0, 0, kSeqNone, 0, 0, 0); + break; + case 1: + _vm->_gameSys->insertSequence(0x184, 253, 0, 0, kSeqNone, 0, 0, 0); + break; + case 2: + _vm->_gameSys->insertSequence(0x185, 253, 0, 0, kSeqNone, 0, 0, 0); + break; + } + } + } + _vm->playSoundA(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + _vm->gameUpdateTick(); + } +} + +void Scene20::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS20LeaveScene: + _vm->_sceneDone = true; + break; + case kAS20TalkStonerGuyNoJoint: + _vm->_gameSys->setAnimation(0x170, 21, 2); + _vm->_gameSys->setAnimation(0x17B, 20, 3); + _vm->_gameSys->insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + _vm->stopSound(0x1A1); + stopSounds(); + _currGroceryStoreGuySequenceId = 0x17B; + _currStonerGuySequenceId = 0x170; + _nextGroceryStoreGuySequenceId = -1; + _nextStonerGuySequenceId = 0x16E; + _vm->_timers[5] = 100; + _vm->_timers[6] = 100; + break; + case kAS20TalkStonerGuyHasJoint: + _vm->_gameSys->setAnimation(0x168, 21, 2); + _vm->_gameSys->setAnimation(379, 20, 3); + _vm->_gameSys->insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x168, 21, 0x170, 21, kSeqSyncWait, 0, 0, 0); + _vm->stopSound(0x1A1); + stopSounds(); + _currGroceryStoreGuySequenceId = 0x17B; + _currStonerGuySequenceId = 0x168; + _nextGroceryStoreGuySequenceId = -1; + _nextStonerGuySequenceId = 0x16B; + _vm->_timers[5] = 200; + _vm->_timers[6] = 200; + _vm->_timers[4] = 100; + _stonerGuyShowingJoint = true; + _vm->_gnapActionStatus = -1; + break; + case kAS20GrabJoint: + _nextStonerGuySequenceId = 0x16A; + break; + case kAS20ActionDone: + _vm->_gnapActionStatus = -1; + break; + case kAS20TalkGroceryStoreGuy: + _vm->_gameSys->setAnimation(0x170, 21, 2); + _vm->_gameSys->setAnimation(0x17B, 20, 3); + _vm->_gameSys->insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + _vm->stopSound(0x1A1); + stopSounds(); + _currGroceryStoreGuySequenceId = 0x17B; + _currStonerGuySequenceId = 0x170; + _groceryStoreGuyCtr = (_groceryStoreGuyCtr + 1) % 2; + if (_groceryStoreGuyCtr != 0) + _nextGroceryStoreGuySequenceId = 0x176; + else + _nextGroceryStoreGuySequenceId = 0x177; + _vm->_timers[5] = 100; + _vm->_timers[6] = 100; + break; + case kAS20GrabGroceryStoreGuy: + _vm->_gameSys->setAnimation(0x170, 21, 2); + _vm->_gameSys->setAnimation(0x17B, 20, 3); + _vm->_gameSys->insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _vm->stopSound(0x1A1); + stopSounds(); + _currGroceryStoreGuySequenceId = 0x17B; + _currStonerGuySequenceId = 0x170; + _vm->_timers[5] = 120; + _vm->_timers[6] = 120; + _nextGroceryStoreGuySequenceId = 0x178; + break; + case kAS20GrabGroceryStoreHat: + _vm->_gameSys->setAnimation(0x170, 21, 2); + _vm->_gameSys->setAnimation(0x17B, 20, 3); + _vm->_gameSys->insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + _vm->stopSound(0x1A1); + stopSounds(); + _currGroceryStoreGuySequenceId = 0x17B; + _currStonerGuySequenceId = 0x170; + _nextGroceryStoreGuySequenceId = 0x179; + break; + case kAS20SwitchGroceryStoreHat: + _vm->setGrabCursorSprite(-1); + _vm->_gameSys->setAnimation(0x180, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x180, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x180; + _vm->_gnapSequenceDatNum = 0; + _vm->invRemove(kItemCowboyHat); + _vm->invAdd(kItemGroceryStoreHat); + _vm->_gnapActionStatus = kAS20SwitchGroceryStoreHatDone; + break; + case kAS20SwitchGroceryStoreHatDone: + _vm->_gameSys->insertSequence(0x17F, 20, 372, 20, kSeqSyncWait, 0, 0, 0); + _vm->setFlag(kGFGroceryStoreHatTaken); + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + _vm->addFullScreenSprite(0x12C, 255); + _vm->_gameSys->setAnimation(0x181, 256, 0); + _vm->_gameSys->insertSequence(0x181, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(0) != 2) + _vm->gameUpdateTick(); + _vm->removeFullScreenSprite(); + _vm->showCursor(); + _vm->setGrabCursorSprite(kItemGroceryStoreHat); + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->gnapWalkTo(3, 8, -1, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = -1; + break; + case kAS20GrabJointDone: + _vm->setGrabCursorSprite(kItemJoint); + _vm->_gnapActionStatus = -1; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + switch (_nextGroceryStoreGuySequenceId) { + case 0x176: + case 0x177: + _vm->_gameSys->setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); + _vm->_gameSys->insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _currGroceryStoreGuySequenceId = _nextGroceryStoreGuySequenceId; + _nextGroceryStoreGuySequenceId = -1; + _nextStonerGuySequenceId = 0x16D; + break; + case 0x178: + _vm->_gameSys->setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); + _vm->_gameSys->setAnimation(0x17D, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x17D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x17D; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kAS20ActionDone; + _vm->_gameSys->setAnimation(0x16D, 21, 2); + _vm->_gameSys->insertSequence(0x16D, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _currStonerGuySequenceId = 0x16D; + _currGroceryStoreGuySequenceId = 0x178; + _nextGroceryStoreGuySequenceId = -1; + _nextStonerGuySequenceId = -1; + break; + case 0x179: + _vm->_gameSys->setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); + _vm->_gameSys->setAnimation(0x16D, 21, 0); + _vm->_gameSys->insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x17E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x17E; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kAS20ActionDone; + _vm->_gameSys->setAnimation(0x16D, 21, 2); + _vm->_gameSys->insertSequence(0x16D, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _currStonerGuySequenceId = 0x16D; + _currGroceryStoreGuySequenceId = 377; + _nextGroceryStoreGuySequenceId = -1; + _nextStonerGuySequenceId = -1; + _vm->gnapWalkTo(4, 8, -1, 0x107BB, 1); + break; + case 0x17C: + _vm->_gameSys->setAnimation(0, 0, 3); + _nextStonerGuySequenceId = 0x171; + break; + case 0x17A: + _vm->_gameSys->setAnimation(0, 0, 3); + _nextStonerGuySequenceId = 0x16F; + break; + case 0x175: + _vm->_gameSys->setAnimation(0x175, 20, 0); + _vm->_gameSys->setAnimation(0x175, 20, 3); + _vm->_gameSys->insertSequence(0x175, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _currGroceryStoreGuySequenceId = 0x175; + _nextGroceryStoreGuySequenceId = -1; + _vm->_gnapActionStatus = kAS20ActionDone; + break; + default: + if (_nextGroceryStoreGuySequenceId != -1) { + _vm->_gameSys->setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); + _vm->_gameSys->insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _currGroceryStoreGuySequenceId = _nextGroceryStoreGuySequenceId; + _nextGroceryStoreGuySequenceId = -1; + } + break; + } + } + + updateAnimationsCb(); +} + +/*****************************************************************************/ + +enum { + kHS21Platypus = 0, + kHS21Banana = 1, + kHS21OldLady = 2, + kHS21Device = 3, + kHS21ExitOutsideGrubCity = 4, + kHS21WalkArea1 = 5, + kHS21WalkArea2 = 6 +}; + +enum { + kAS21TalkOldLady = 0, + kAS21GrabBanana = 1, + kAS21GrabBananaDone = 2, + kAS21GrabOldLady = 3, + kAS21UseHatWithOldLady = 4, + kAS21UseHatWithOldLadyDone = 5, + kAS21LeaveScene = 6 +}; + +Scene21::Scene21(GnapEngine *vm) : Scene(vm) { + _currOldLadySequenceId = -1; + _nextOldLadySequenceId = -1; +} + +int Scene21::init() { + _vm->_gameSys->setAnimation(0, 0, 3); + return _vm->isFlag(kGFTwigTaken) ? 0x94 : 0x93; +} + +void Scene21::updateHotspots() { + _vm->setHotspot(kHS21Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS21Banana, 94, 394, 146, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 2, 6); + _vm->setHotspot(kHS21OldLady, 402, 220, 528, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); + _vm->setHotspot(kHS21ExitOutsideGrubCity, 522, 498, 800, 600, SF_EXIT_SE_CURSOR | SF_WALKABLE, 5, 10); + _vm->setHotspot(kHS21WalkArea1, 0, 0, 800, 440); + _vm->setHotspot(kHS21WalkArea2, 698, 0, 800, 600); + _vm->setDeviceHotspot(kHS21Device, -1, -1, -1, -1); + if (_vm->isFlag(kGFUnk04) || !_vm->isFlag(kGFTwigTaken)) + _vm->_hotspots[kHS21Banana]._flags = SF_WALKABLE | SF_DISABLED; + if (_vm->isFlag(kGFTwigTaken)) + _vm->_hotspots[kHS21OldLady]._flags = SF_DISABLED; + _vm->_hotspotsCount = 7; +} + +void Scene21::run() { + _vm->playSound(0x10940, true); + _vm->startSoundTimerA(6); + + _vm->_timers[5] = _vm->getRandom(100) + 100; + + _vm->queueInsertDeviceIcon(); + + if (_vm->isFlag(kGFTwigTaken)) { + if (_vm->isFlag(kGFKeysTaken)) { + _vm->initGnapPos(5, 8, kDirBottomRight); + _vm->initPlatypusPos(6, 8, kDirNone); + _vm->_gameSys->insertSequence(0x8E, 2, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->isFlag(kGFUnk04)) + _vm->_gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); + _vm->endSceneInit(); + _vm->clearFlag(kGFKeysTaken); + } else { + _vm->initGnapPos(5, 11, kDirBottomRight); + _vm->initPlatypusPos(6, 11, kDirNone); + if (!_vm->isFlag(kGFUnk04)) + _vm->_gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + } + } else { + _vm->initGnapPos(5, 11, kDirBottomRight); + _vm->initPlatypusPos(6, 11, kDirNone); + _currOldLadySequenceId = 0x89; + _vm->_gameSys->setAnimation(0x89, 79, 3); + _vm->_gameSys->insertSequence(_currOldLadySequenceId, 79, 0, 0, kSeqNone, 0, 0, 0); + _nextOldLadySequenceId = -1; + _vm->_timers[4] = _vm->getRandom(30) + 50; + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS21Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS21Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS21Banana: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 5); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(2, 5); + break; + case GRAB_CURSOR: + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS21Banana].x, _vm->_hotspotsWalkPos[kHS21Banana].y) | 0x10000, 1); + _vm->playGnapPullOutDevice(2, 5); + _vm->playGnapUseDevice(0, 0); + _vm->_gnapActionStatus = kAS21GrabBanana; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + break; + } + } + } + break; + + case kHS21OldLady: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemGroceryStoreHat) { + _vm->_newSceneNum = 47; + _vm->gnapWalkTo(4, 6, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS21UseHatWithOldLady; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(4, 6, 7, 4); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(7, 4); + break; + case GRAB_CURSOR: + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_hotspots[kHS21WalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(7, 6, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS21GrabOldLady; + _vm->_hotspots[kHS21WalkArea1]._flags &= ~SF_WALKABLE; + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS21OldLady].x, _vm->_hotspotsWalkPos[kHS21OldLady].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS21TalkOldLady; + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS21ExitOutsideGrubCity: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 20; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity].y, 0, 0x107B3, 1); + _vm->_gnapActionStatus = kAS21LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity].y, -1, 0x107C2, 1); + } + break; + + case kHS21WalkArea1: + case kHS21WalkArea2: + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x10940)) + _vm->playSound(0x10940, true); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->isFlag(kGFTwigTaken) && !_vm->_timers[4] && _nextOldLadySequenceId == -1 && _vm->_gnapActionStatus == -1) { + _vm->_timers[4] = _vm->getRandom(30) + 50; + switch (_vm->getRandom(5)) { + case 0: + _nextOldLadySequenceId = 0x88; + break; + case 1: + _nextOldLadySequenceId = 0x8A; + break; + default: + _nextOldLadySequenceId = 0x89; + break; + } + } + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(100) + 100; + _vm->_gameSys->insertSequence(0x92, 255, 0, 0, kSeqNone, 0, 0, 0); + } + _vm->playSoundA(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene21::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS21TalkOldLady: + _nextOldLadySequenceId = 0x8B; + _vm->_gnapActionStatus = -1; + break; + case kAS21GrabBanana: + _vm->_gameSys->setAnimation(0x8C, 59, 0); + _vm->_gameSys->insertSequence(0x8C, 59, 141, 59, kSeqSyncWait, 0, 0, 0); + _vm->setFlag(kGFUnk04); + _vm->invAdd(kItemBanana); + updateHotspots(); + _vm->_gnapActionStatus = kAS21GrabBananaDone; + break; + case kAS21GrabBananaDone: + _vm->setGrabCursorSprite(kItemBanana); + _vm->_gnapActionStatus = -1; + break; + case kAS21GrabOldLady: + _vm->_timers[4] = _vm->getRandom(30) + 50; + _nextOldLadySequenceId = 0x87; + break; + case kAS21UseHatWithOldLady: + _vm->_gameSys->setAnimation(0x8F, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x8F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x8F; + _vm->_gnapActionStatus = kAS21UseHatWithOldLadyDone; + _vm->invAdd(kItemTickets); + _vm->invRemove(kItemGroceryStoreHat); + _vm->setGrabCursorSprite(-1); + break; + case kAS21UseHatWithOldLadyDone: + _nextOldLadySequenceId = 0x91; + break; + case kAS21LeaveScene: + _vm->_sceneDone = true; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _nextOldLadySequenceId != -1) { + if (_nextOldLadySequenceId == 0x87) { + _vm->_gameSys->setAnimation(_nextOldLadySequenceId, 79, 3); + _vm->_gameSys->insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x86, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x86; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = -1; + _currOldLadySequenceId = _nextOldLadySequenceId; + _nextOldLadySequenceId = -1; + } else if (_nextOldLadySequenceId == 0x91) { + _vm->_gameSys->setAnimation(0x91, 79, 0); + _vm->_gameSys->insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = kAS21LeaveScene; + _currOldLadySequenceId = _nextOldLadySequenceId; + _nextOldLadySequenceId = -1; + } else { + _vm->_gameSys->setAnimation(_nextOldLadySequenceId, 79, 3); + _vm->_gameSys->insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); + _currOldLadySequenceId = _nextOldLadySequenceId; + _nextOldLadySequenceId = -1; + } + } +} + +/*****************************************************************************/ + +enum { + kHS22Platypus = 0, + kHS22ExitOutsideGrubCity = 1, + kHS22ExitBackGrubCity = 2, + kHS22Cashier = 3, + kHS22Device = 4, + kHS22WalkArea1 = 5, + kHS22WalkArea2 = 6 +}; + +enum { + kAS22LeaveScene = 0, + kAS22TalkCashier = 1 +}; + +Scene22::Scene22(GnapEngine *vm) : Scene(vm) { + _caughtBefore = false; + _cashierCtr = 3; +} + +int Scene22::init() { + return 0x5E; +} + +void Scene22::updateHotspots() { + _vm->setHotspot(kHS22Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS22ExitOutsideGrubCity, 0, 180, 184, 472, SF_EXIT_L_CURSOR, 3, 6); + _vm->setHotspot(kHS22ExitBackGrubCity, 785, 405, 800, 585, SF_EXIT_R_CURSOR, 11, 9); + _vm->setHotspot(kHS22Cashier, 578, 230, 660, 376, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); + _vm->setHotspot(kHS22WalkArea1, 553, 0, 800, 542); + _vm->setHotspot(kHS22WalkArea2, 0, 0, 552, 488); + _vm->setDeviceHotspot(kHS22Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 7; +} + +void Scene22::run() { + _vm->_gameSys->insertSequence(0x5D, 254, 0, 0, kSeqNone, 0, 0, 0); + + _currCashierSequenceId = 0x59; + _nextCashierSequenceId = -1; + + _vm->_gameSys->setAnimation(0x59, 1, 3); + _vm->_gameSys->insertSequence(_currCashierSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + + _vm->_timers[6] = _vm->getRandom(30) + 20; + + _vm->queueInsertDeviceIcon(); + + if (_vm->_prevSceneNum == 20) { + _vm->initGnapPos(2, 8, kDirBottomRight); + _vm->initPlatypusPos(1, 8, kDirNone); + _vm->endSceneInit(); + } else { + _vm->initGnapPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y, kDirBottomRight); + _vm->initPlatypusPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y + 1, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(9, 8, -1, 0x107C2, 1); + } + + if (_vm->isFlag(kGFSceneFlag1)) { + int storeDetectiveSeqId; + _vm->setGrabCursorSprite(-1); + _vm->invRemove(kItemCereals); + if (_caughtBefore) { + switch (_vm->getRandom(3)) { + case 0: + storeDetectiveSeqId = 0x55; + break; + case 1: + storeDetectiveSeqId = 0x56; + break; + default: + storeDetectiveSeqId = 0x57; + break; + } + } else { + _caughtBefore = true; + storeDetectiveSeqId = 0x54; + } + _vm->_gameSys->waitForUpdate(); + _vm->_gameSys->requestClear1(); + _vm->_gameSys->drawSpriteToBackground(0, 0, 0x44); + _vm->_gameSys->setAnimation(storeDetectiveSeqId, 256, 4); + _vm->_gameSys->insertSequence(storeDetectiveSeqId, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(4) != 2) { + _vm->gameUpdateTick(); + } + _vm->_sceneDone = true; + _vm->_newSceneNum = 20; + _caughtBefore = true; + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 0, -1, -1, -1, -1); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS22Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS22Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS22ExitOutsideGrubCity: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 20; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity].y, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kAS22LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity].y + 1, -1, 0x107C2, 1); + } + break; + + case kHS22ExitBackGrubCity: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 23; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].x, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kAS22LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].x, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y + 1, -1, 0x107C2, 1); + } + break; + + case kHS22Cashier: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS22Cashier].x, _vm->_hotspotsWalkPos[kHS22Cashier].y, 8, 4); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(8, 4); + break; + case GRAB_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS22Cashier].x, _vm->_hotspotsWalkPos[kHS22Cashier].y, + 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS22TalkCashier; + break; + case PLAT_CURSOR: + _vm->gnapUseDeviceOnPlatypuss(); + break; + } + } + } + break; + + case kHS22WalkArea1: + case kHS22WalkArea2: + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[6] && _nextCashierSequenceId == -1) { + _vm->_timers[6] = _vm->getRandom(30) + 20; + if (_vm->getRandom(8) != 0) { + _nextCashierSequenceId = 0x59; + } else { + _cashierCtr = (_cashierCtr + 1) % 3; + switch (_cashierCtr) { + case 1: + _nextCashierSequenceId = 0x58; + break; + case 2: + _nextCashierSequenceId = 0x5A; + break; + case 3: + _nextCashierSequenceId = 0x5B; + break; + default: + _nextCashierSequenceId = 0x58; + break; + } + } + } + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[2] = _vm->getRandom(30) + 20; + _vm->_timers[3] = 400; + _vm->_timers[1] = _vm->getRandom(20) + 30; + _vm->_timers[0] = _vm->getRandom(75) + 75; + } + + _vm->gameUpdateTick(); + } +} + +void Scene22::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS22LeaveScene: + _vm->_sceneDone = true; + break; + case kAS22TalkCashier: + _nextCashierSequenceId = 0x5C; + break; + } + _vm->_gnapActionStatus = -1; + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _nextCashierSequenceId != -1) { + _vm->_gameSys->setAnimation(_nextCashierSequenceId, 1, 3); + _vm->_gameSys->insertSequence(_nextCashierSequenceId, 1, _currCashierSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _currCashierSequenceId = _nextCashierSequenceId; + _nextCashierSequenceId = -1; + } +} + +/*****************************************************************************/ + +enum { + kHS23Platypus = 0, + kHS23ExitFrontGrubCity = 1, + kHS23Device = 2, + kHS23Cereals = 3, + kHS23WalkArea1 = 4, + kHS23WalkArea2 = 5 +}; + +enum { + kAS23LookCereals = 0, + kAS23GrabCereals = 1, + kAS23GrabCerealsDone = 2, + kAS23LeaveScene = 3 +}; + +Scene23::Scene23(GnapEngine *vm) : Scene(vm) { + _currStoreClerkSequenceId = -1; + _nextStoreClerkSequenceId = -1; +} + +int Scene23::init() { + return 0xC0; +} + +void Scene23::updateHotspots() { + _vm->setHotspot(kHS23Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS23ExitFrontGrubCity, 0, 250, 15, 550, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 7); + _vm->setHotspot(kHS23Cereals, 366, 332, 414, 408, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); + _vm->setHotspot(kHS23WalkArea1, 0, 0, 340, 460); + _vm->setHotspot(kHS23WalkArea2, 340, 0, 800, 501); + _vm->setDeviceHotspot(kHS23Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 6; +} + +void Scene23::run() { + _vm->_timers[4] = _vm->getRandom(100) + 200; + _vm->_timers[5] = _vm->getRandom(100) + 200; + + _currStoreClerkSequenceId = 0xB4; + _nextStoreClerkSequenceId = -1; + + _vm->_gameSys->setAnimation(0xB4, 1, 4); + _vm->_gameSys->insertSequence(_currStoreClerkSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + + _vm->queueInsertDeviceIcon(); + + _vm->initGnapPos(-1, 7, kDirBottomRight); + _vm->initPlatypusPos(-2, 7, kDirNone); + _vm->_gameSys->insertSequence(0xBD, 255, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0xBF, 2, 0, 0, kSeqNone, 0, 0, 0); + _vm->endSceneInit(); + + _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); + + if (_vm->isFlag(kGFUnk24)) { + _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); + } else { + _vm->gnapWalkTo(2, 7, 0, 0x107B9, 1); + while (_vm->_gameSys->getAnimationStatus(0) != 2) + _vm->gameUpdateTick(); + _vm->playSequences(0x48, 0xBA, 0xBB, 0xBC); + _vm->setFlag(kGFUnk24); + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 3, -1, -1, -1, -1); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS23Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS23Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS23Cereals: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS23Cereals].x, _vm->_hotspotsWalkPos[kHS23Cereals].y, 5, 4); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + if (_vm->isFlag(kGFSceneFlag1)) + _vm->playGnapMoan2(0, 0); + else { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS23Cereals].x, _vm->_hotspotsWalkPos[kHS23Cereals].y, + 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS23LookCereals; + } + break; + case GRAB_CURSOR: + if (_vm->isFlag(kGFSceneFlag1)) + _vm->playGnapImpossible(0, 0); + else { + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS23Cereals].x, _vm->_hotspotsWalkPos[kHS23Cereals].y, + 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->setFlag(kGFSceneFlag1); + _vm->_gnapActionStatus = kAS23GrabCereals; + _vm->invAdd(kItemCereals); + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS23ExitFrontGrubCity: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 22; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity].x, _vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity].y, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kAS23LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity].x, _vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity].y - 1, -1, 0x107C2, 1); + } + break; + + case kHS23WalkArea1: + case kHS23WalkArea2: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4] && _vm->_gnapActionStatus == -1) { + _vm->_timers[4] = _vm->getRandom(100) + 200; + switch (_vm->getRandom(4)) { + case 0: + _vm->_gameSys->insertSequence(0xB7, 256, 0, 0, kSeqNone, 0, 0, 0); + break; + case 1: + _vm->_gameSys->insertSequence(0xB8, 256, 0, 0, kSeqNone, 0, 0, 0); + break; + case 2: + case 3: + _vm->_gameSys->insertSequence(0xB9, 256, 0, 0, kSeqNone, 0, 0, 0); + break; + } + } + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(100) + 200; + switch (_vm->getRandom(3)) { + case 0: + _vm->playSound(0xCE, false); + break; + case 1: + _vm->playSound(0xD0, false); + break; + case 2: + _vm->playSound(0xCF, false); + break; + } + } + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene23::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS23LookCereals: + _vm->showFullScreenSprite(0x48); + _vm->_gnapActionStatus = -1; + break; + case kAS23GrabCereals: + _vm->_gameSys->setAnimation(0xBE, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0xBE, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->requestRemoveSequence(0xBF, 2); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0xBE; + _vm->_gnapActionStatus = kAS23GrabCerealsDone; + break; + case kAS23GrabCerealsDone: + _vm->setGrabCursorSprite(kItemCereals); + _vm->_gnapActionStatus = -1; + break; + case kAS23LeaveScene: + _vm->_sceneDone = true; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(4) == 2 && _nextStoreClerkSequenceId == -1) { + switch (_vm->getRandom(8)) { + case 0: + case 1: + case 2: + _nextStoreClerkSequenceId = 0xB4; + break; + case 3: + case 4: + case 5: + _nextStoreClerkSequenceId = 0xB5; + break; + default: + _nextStoreClerkSequenceId = 0xB6; + break; + } + _vm->_gameSys->setAnimation(_nextStoreClerkSequenceId, 1, 4); + _vm->_gameSys->insertSequence(_nextStoreClerkSequenceId, 1, _currStoreClerkSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _currStoreClerkSequenceId = _nextStoreClerkSequenceId; + _nextStoreClerkSequenceId = -1; + } +} + +/*****************************************************************************/ + +enum { + kHS24Platypus = 0, + kHS24ExitCircusWorld = 1, + kHS24ExitOutsideGrubCity = 2, + kHS24Device = 3, + kHS24WalkArea1 = 4, + kHS24WalkArea2 = 5, + kHS24WalkArea3 = 6 +}; + +enum { + kAS24LeaveScene = 0 +}; + +Scene24::Scene24(GnapEngine *vm) : Scene(vm) { + _currWomanSequenceId = -1; + _nextWomanSequenceId = -1; + _boySequenceId = -1; + _girlSequenceId = -1; +} + +int Scene24::init() { + return 0x3B; +} + +void Scene24::updateHotspots() { + _vm->setHotspot(kHS24Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS24ExitCircusWorld, 785, 128, 800, 600, SF_EXIT_R_CURSOR, 8, 7); + _vm->setHotspot(kHS24ExitOutsideGrubCity, 0, 213, 91, 600, SF_EXIT_NW_CURSOR, 1, 8); + _vm->setHotspot(kHS24WalkArea1, 0, 0, 0, 0); + _vm->setHotspot(kHS24WalkArea2, 530, 0, 800, 600); + _vm->setHotspot(kHS24WalkArea3, 0, 0, 800, 517); + _vm->setDeviceHotspot(kHS24Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 7; +} + +void Scene24::run() { + int counter = 0; + + _vm->playSound(0x10940, true); + _vm->startSoundTimerA(9); + + _vm->_timers[7] = _vm->getRandom(100) + 100; + + _vm->_gameSys->insertSequence(0x2F, 256, 0, 0, kSeqNone, 0, 0, 0); + + _vm->_timers[4] = _vm->getRandom(20) + 50; + _vm->_timers[5] = _vm->getRandom(20) + 40; + _vm->_timers[6] = _vm->getRandom(50) + 30; + + _vm->_gameSys->insertSequence(0x36, 20, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x30, 20, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x35, 20, 0, 0, kSeqNone, 0, 0, 0); + + _currWomanSequenceId = 0x35; + _girlSequenceId = 0x36; + _boySequenceId = 0x30; + + if (_vm->_debugLevel == 4) + _vm->startIdleTimer(8); + + _vm->queueInsertDeviceIcon(); + + if (_vm->_prevSceneNum == 20) { + _vm->initGnapPos(1, 8, kDirBottomRight); + _vm->initPlatypusPos(2, 8, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(1, 9, -1, 0x107B9, 1); + _vm->platypusWalkTo(2, 9, -1, 0x107C2, 1); + } else { + _vm->initGnapPos(8, 8, kDirBottomLeft); + _vm->initPlatypusPos(8, 8, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(2, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(3, 8, -1, 0x107C2, 1); + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 0, -1, -1, -1, -1); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + + case kHS24Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS24Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS24ExitCircusWorld: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 25; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld].x, _vm->_hotspotsWalkPos[kHS24ExitCircusWorld].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kAS24LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHS24ExitCircusWorld].y, -1, 0x107C2, 1); + } + break; + + case kHS24ExitOutsideGrubCity: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 20; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS24LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].y, -1, 0x107C2, 1); + } + break; + + case kHS24WalkArea1: + case kHS24WalkArea2: + case kHS24WalkArea3: + if (_vm->_gnapActionStatus == -1) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x10940)) + _vm->playSound(0x10940, true); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(20) + 50; + _vm->_gameSys->insertSequence(0x37, 20, _girlSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _girlSequenceId = 0x37; + } + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(20) + 40; + _vm->_gameSys->insertSequence(0x31, 20, _boySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _boySequenceId = 0x31; + } + if (!_vm->_timers[6]) { + _vm->_timers[6] = _vm->getRandom(50) + 30; + counter = (counter + 1) % 3; + switch (counter) { + case 0: + _nextWomanSequenceId = 0x32; + break; + case 1: + _nextWomanSequenceId = 0x33; + break; + case 2: + _nextWomanSequenceId = 0x34; + break; + } + _vm->_gameSys->insertSequence(_nextWomanSequenceId, 20, _currWomanSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _currWomanSequenceId = _nextWomanSequenceId; + } + if (!_vm->_timers[7]) { + _vm->_timers[7] = _vm->getRandom(100) + 100; + switch (_vm->getRandom(3)) { + case 0: + _vm->_gameSys->insertSequence(0x38, 253, 0, 0, kSeqNone, 0, 0, 0); + break; + case 1: + _vm->_gameSys->insertSequence(0x39, 253, 0, 0, kSeqNone, 0, 0, 0); + break; + case 2: + _vm->_gameSys->insertSequence(0x3A, 253, 0, 0, kSeqNone, 0, 0, 0); + break; + } + } + if (_vm->_debugLevel == 4) + _vm->updateIdleTimer(); + _vm->playSoundA(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + _vm->gameUpdateTick(); + } +} + +void Scene24::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + if (_vm->_gnapActionStatus == kAS24LeaveScene) + _vm->_sceneDone = true; + _vm->_gnapActionStatus = -1; + } +} + +/*****************************************************************************/ + +enum { + kHS25Platypus = 0, + kHS25TicketVendor = 1, + kHS25ExitOutsideCircusWorld = 2, + kHS25ExitInsideCircusWorld = 3, + kHS25Device = 4, + kHS25Posters1 = 5, + kHS25Posters2 = 6, + kHS25Posters3 = 7, + kHS25Posters4 = 8, + kHS25WalkArea1 = 9, + kHS25WalkArea2 = 10 +}; + +enum { + kAS25TalkTicketVendor = 0, + kAS25EnterCircusWihoutTicket = 1, + kAS25ShowTicketToVendor = 2, + kAS25ShowTicketToVendorDone = 3, + kAS25EnterCircusWihoutTicketDone = 4, + kAS25LeaveScene = 5 +}; + +Scene25::Scene25(GnapEngine *vm) : Scene(vm) { + _currTicketVendorSequenceId = -1; + _nextTicketVendorSequenceId = -1; +} + +int Scene25::init() { + return 0x62; +} + +void Scene25::updateHotspots() { + _vm->setHotspot(kHS25Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS25TicketVendor, 416, 94, 574, 324, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 5); + _vm->setHotspot(kHS25ExitOutsideCircusWorld, 0, 519, 205, 600, SF_EXIT_SW_CURSOR, 5, 10); + _vm->setHotspot(kHS25ExitInsideCircusWorld, 321, 70, 388, 350, SF_EXIT_NE_CURSOR, 3, 6); + _vm->setHotspot(kHS25Posters1, 0, 170, 106, 326, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); + _vm->setHotspot(kHS25Posters2, 146, 192, 254, 306, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); + _vm->setHotspot(kHS25Posters3, 606, 162, 654, 368, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 7); + _vm->setHotspot(kHS25Posters4, 708, 114, 754, 490, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); + _vm->setHotspot(kHS25WalkArea1, 0, 0, 800, 439); + _vm->setHotspot(kHS25WalkArea2, 585, 0, 800, 600); + _vm->setDeviceHotspot(kHS25Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 11; +} + +void Scene25::playAnims(int index) { + if (index > 4) + return; + + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + switch (index) { + case 1: + _vm->_largeSprite = _vm->_gameSys->createSurface(0x25); + break; + case 2: + _vm->_largeSprite = _vm->_gameSys->createSurface(0x26); + break; + case 3: + _vm->_largeSprite = _vm->_gameSys->createSurface(0x27); + break; + case 4: + _vm->_largeSprite = _vm->_gameSys->createSurface(0x28); + break; + } + _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); + _vm->delayTicksCursor(5); + while (!_vm->_mouseClickState._left && !_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) && !_vm->isKeyStatus1(Common::KEYCODE_SPACE) && + !_vm->isKeyStatus1(29)) { + _vm->gameUpdateTick(); + } + _vm->_mouseClickState._left = false; + _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); + _vm->clearKeyStatus1(29); + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); + _vm->_gameSys->removeSpriteDrawItem(_vm->_largeSprite, 300); + _vm->delayTicksCursor(5); + _vm->deleteSurface(&_vm->_largeSprite); + _vm->showCursor(); +} + +void Scene25::run() { + _vm->playSound(0x10940, true); + _vm->startSoundTimerA(5); + + _currTicketVendorSequenceId = 0x52; + _vm->_gameSys->setAnimation(0x52, 39, 3); + _vm->_gameSys->insertSequence(_currTicketVendorSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); + + _nextTicketVendorSequenceId = -1; + _vm->_timers[4] = _vm->getRandom(20) + 20; + + _vm->queueInsertDeviceIcon(); + + if (_vm->_prevSceneNum == 24) { + _vm->initGnapPos(5, 11, kDirUpLeft); + _vm->initPlatypusPos(6, 11, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 7, -1, 0x107BA, 1); + _vm->platypusWalkTo(6, 7, -1, 0x107C2, 1); + } else { + _vm->initGnapPos(5, 6, kDirBottomRight); + _vm->initPlatypusPos(6, 6, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS25Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS25Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS25TicketVendor: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemTickets) { + _vm->_gnapActionStatus = kAS25ShowTicketToVendor; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor].x, _vm->_hotspotsWalkPos[kHS25TicketVendor].y, + 0, _vm->getGnapSequenceId(gskIdle, 9, 4) | 0x10000, 1); + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS25TicketVendor].x, _vm->_hotspotsWalkPos[kHS25TicketVendor].y, 6, 1); + _nextTicketVendorSequenceId = 0x5B; + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(6, 1); + _nextTicketVendorSequenceId = (_vm->getRandom(2) == 1) ? 0x59 : 0x56; + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor].x, _vm->_hotspotsWalkPos[kHS25TicketVendor].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS25TalkTicketVendor; + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS25ExitOutsideCircusWorld: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 24; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld].x, _vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld].y, 0, 0x107B4, 1); + _vm->_gnapActionStatus = kAS25LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld].y, -1, 0x107C2, 1); + } + break; + + case kHS25ExitInsideCircusWorld: + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFNeedleTaken)) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 26; + _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld].x, _vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld].y, 0, 0x107B1, 1); + _vm->_gnapActionStatus = kAS25LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld].y, -1, 0x107C2, 1); + _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; + } else { + _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(4, 5, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kAS25EnterCircusWihoutTicket; + _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; + } + } + break; + + case kHS25Posters1: + case kHS25Posters2: + case kHS25Posters3: + case kHS25Posters4: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, -1, -1, 1); + if (_vm->_sceneClickedHotspot == 5 || _vm->_sceneClickedHotspot == 6) + _vm->_gnapIdleFacing = kDirUpLeft; + else if (_vm->_sceneClickedHotspot == 8) + _vm->_gnapIdleFacing = kDirBottomRight; + else + _vm->_gnapIdleFacing = kDirUpRight; + _vm->playGnapIdle(0, 0); + playAnims(8 - _vm->_sceneClickedHotspot + 1); + break; + case GRAB_CURSOR: + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapMoan2(0, 0); + break; + } + } + } + break; + + case kHS25WalkArea1: + case kHS25WalkArea2: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4] && _nextTicketVendorSequenceId == -1 && _vm->_gnapActionStatus == -1) { + _vm->_timers[4] = _vm->getRandom(20) + 20; + switch (_vm->getRandom(13)) { + case 0: + _nextTicketVendorSequenceId = 0x54; + break; + case 1: + _nextTicketVendorSequenceId = 0x58; + break; + case 2: + _nextTicketVendorSequenceId = 0x55; + break; + case 3: + _nextTicketVendorSequenceId = 0x5A; + break; + case 4: + case 5: + case 6: + case 7: + _nextTicketVendorSequenceId = 0x5B; + break; + case 8: + case 9: + case 10: + case 11: + _nextTicketVendorSequenceId = 0x5C; + break; + case 12: + _nextTicketVendorSequenceId = 0x5D; + break; + default: + _nextTicketVendorSequenceId = 0x52; + break; + } + } + _vm->playSoundA(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene25::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS25TalkTicketVendor: + _nextTicketVendorSequenceId = (_vm->getRandom(2) == 1) ? 0x57 : 0x5F; + _vm->_gnapActionStatus = -1; + break; + case kAS25EnterCircusWihoutTicket: + _nextTicketVendorSequenceId = 0x5E; + _vm->_gameSys->setAnimation(0x5E, 39, 0); + _vm->_gameSys->setAnimation(_nextTicketVendorSequenceId, 39, 3); + _vm->_gameSys->insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x60, 2, 0, 0, kSeqNone, 0, 0, 0); + _currTicketVendorSequenceId = _nextTicketVendorSequenceId; + _nextTicketVendorSequenceId = -1; + _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; + _vm->playGnapIdle(0, 0); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, -1, 0x107BB, 1); + _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kAS25EnterCircusWihoutTicketDone; + break; + case kAS25EnterCircusWihoutTicketDone: + _vm->_gnapActionStatus = -1; + break; + case kAS25ShowTicketToVendor: + _vm->setGrabCursorSprite(-1); + _vm->invRemove(kItemTickets); + _vm->setFlag(kGFNeedleTaken); + _vm->_gameSys->setAnimation(0x61, 40, 0); + _vm->_gameSys->insertSequence(0x61, 40, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapActionStatus = kAS25ShowTicketToVendorDone; + break; + case kAS25ShowTicketToVendorDone: + _nextTicketVendorSequenceId = 0x53; + break; + case kAS25LeaveScene: + _vm->_sceneDone = true; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (_nextTicketVendorSequenceId == 0x53) { + _vm->_gameSys->insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _currTicketVendorSequenceId = _nextTicketVendorSequenceId; + _nextTicketVendorSequenceId = -1; + _vm->_gnapActionStatus = -1; + } else if (_nextTicketVendorSequenceId != -1) { + _vm->_gameSys->setAnimation(_nextTicketVendorSequenceId, 39, 3); + _vm->_gameSys->insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _currTicketVendorSequenceId = _nextTicketVendorSequenceId; + _nextTicketVendorSequenceId = -1; + } + } +} + +/*****************************************************************************/ + +enum { + kHS26Platypus = 0, + kHS26ExitOutsideCircusWorld = 1, + kHS26ExitOutsideClown = 2, + kHS26ExitArcade = 3, + kHS26ExitElephant = 4, + kHS26ExitBeerStand = 5, + kHS26Device = 6, + kHS26WalkArea1 = 7, + kHS26WalkArea2 = 8 +}; + +enum { + kAS26LeaveScene = 0 +}; + +Scene26::Scene26(GnapEngine *vm) : Scene(vm) { + _currKidSequenceId = -1; + _nextKidSequenceId = -1; +} + +int Scene26::init() { + return _vm->isFlag(kGFUnk23) ? 0x61 : 0x60; +} + +void Scene26::updateHotspots() { + _vm->setHotspot(kHS26Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS26ExitOutsideCircusWorld, 0, 590, 300, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 1, 10); + _vm->setHotspot(kHS26ExitOutsideClown, 200, 265, 265, 350, SF_EXIT_U_CURSOR, 3, 8); + _vm->setHotspot(kHS26ExitArcade, 0, 295, 150, 400, SF_EXIT_NW_CURSOR, 2, 8); + _vm->setHotspot(kHS26ExitElephant, 270, 290, 485, 375, SF_EXIT_U_CURSOR, 5, 8); + _vm->setHotspot(kHS26ExitBeerStand, 530, 290, 620, 350, SF_EXIT_NE_CURSOR, 5, 8); + _vm->setHotspot(kHS26WalkArea1, 0, 0, 800, 500); + _vm->setHotspot(kHS26WalkArea2, 281, 0, 800, 600); + _vm->setDeviceHotspot(kHS26Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 9; +} + +void Scene26::run() { + _vm->startSoundTimerB(7); + _vm->playSound(0x1093B, true); + + _currKidSequenceId = 0x5B; + _nextKidSequenceId = -1; + _vm->_gameSys->setAnimation(0x5B, 160, 3); + _vm->_gameSys->insertSequence(_currKidSequenceId, 160, 0, 0, kSeqNone, 0, 0, 0); + + _vm->_timers[5] = _vm->getRandom(20) + 50; + _vm->_timers[4] = _vm->getRandom(20) + 50; + _vm->_timers[6] = _vm->getRandom(50) + 100; + + _vm->queueInsertDeviceIcon(); + + _vm->_gameSys->insertSequence(0x58, 40, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x5C, 40, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x5D, 40, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x5E, 40, 0, 0, kSeqLoop, 0, 0, 0); + + if (_vm->_prevSceneNum == 25) { + _vm->initGnapPos(-1, 8, kDirBottomRight); + _vm->initPlatypusPos(-2, 8, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); + } else { + _vm->initGnapPos(2, 8, kDirBottomRight); + _vm->initPlatypusPos(3, 8, kDirNone); + _vm->endSceneInit(); + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS26Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS26Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS26ExitOutsideCircusWorld: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 25; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS26ExitOutsideCircusWorld].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kAS26LeaveScene; + } + break; + + case kHS26ExitOutsideClown: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 27; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS26ExitOutsideClown].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kAS26LeaveScene; + } + break; + + case kHS26ExitArcade: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 29; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS26ExitArcade].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kAS26LeaveScene; + } + break; + + case kHS26ExitElephant: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 30; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kAS26LeaveScene; + } + break; + + case kHS26ExitBeerStand: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 31; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS26ExitBeerStand].y, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kAS26LeaveScene; + } + break; + + case kHS26WalkArea1: + case kHS26WalkArea2: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x1093B)) + _vm->playSound(0x1093B, true); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[5] && _nextKidSequenceId == -1) { + _vm->_timers[5] = _vm->getRandom(20) + 50; + if (_vm->getRandom(5) != 0) + _nextKidSequenceId = 0x5B; + else + _nextKidSequenceId = 0x5A; + } + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(20) + 130; + _vm->_gameSys->insertSequence(0x59, 40, 0, 0, kSeqNone, 0, 0, 0); + } + if (!_vm->_timers[6]) { + _vm->_timers[6] = _vm->getRandom(50) + 100; + _vm->_gameSys->insertSequence(0x5F, 40, 0, 0, kSeqNone, 0, 0, 0); + } + _vm->playSoundB(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene26::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + if (_vm->_gnapActionStatus == kAS26LeaveScene) + _vm->_sceneDone = true; + _vm->_gnapActionStatus = -1; + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _nextKidSequenceId != -1) { + _vm->_gameSys->insertSequence(_nextKidSequenceId, 160, _currKidSequenceId, 160, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextKidSequenceId, 160, 3); + _currKidSequenceId = _nextKidSequenceId; + _nextKidSequenceId = -1; + } +} + +/*****************************************************************************/ + +enum { + kHS27Platypus = 0, + kHS27Janitor = 1, + kHS27Device = 2, + kHS27Bucket = 3, + kHS27ExitCircus = 4, + kHS27ExitArcade = 5, + kHS27ExitBeerStand = 6, + kHS27ExitClown = 7, + kHS27WalkArea1 = 8 +}; + +enum { + kAS27TalkJanitor = 0, + kAS27GrabBucket = 1, + kAS27GrabBucketDone = 2, + kAS27ShowPictureToJanitor = 3, + kAS27TryEnterClownTent = 4, + kAS27TryEnterClownTentDone = 5, + kAS27EnterClownTent = 6, + kAS27LeaveScene = 7 +}; + +Scene27::Scene27(GnapEngine *vm) : Scene(vm) { + _nextJanitorSequenceId = -1; + _currJanitorSequenceId = -1; +} + +int Scene27::init() { + return 0xD5; +} + +void Scene27::updateHotspots() { + _vm->setHotspot(kHS27Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS27Janitor, 488, 204, 664, 450, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 8, 8); + _vm->setHotspot(kHS27Bucket, 129, 406, 186, 453, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 6); + _vm->setHotspot(kHS27ExitCircus, 200, 585, 700, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHS27ExitArcade, 0, 0, 15, 600, SF_EXIT_L_CURSOR, 0, 6); + _vm->setHotspot(kHS27ExitBeerStand, 785, 0, 800, 600, SF_EXIT_R_CURSOR, 11, 7); + _vm->setHotspot(kHS27ExitClown, 340, 240, 460, 420, SF_EXIT_U_CURSOR, 6, 8); + _vm->setHotspot(kHS27WalkArea1, 0, 0, 800, 507); + _vm->setDeviceHotspot(kHS27Device, -1, -1, -1, -1); + if (_vm->isFlag(kGFUnk13)) + _vm->_hotspots[kHS27Bucket]._flags = SF_DISABLED; + _vm->_hotspotsCount = 9; +} + +void Scene27::run() { + _vm->playSound(0x1093B, true); + _vm->startSoundTimerB(4); + _vm->_timers[7] = _vm->getRandom(100) + 300; + _vm->queueInsertDeviceIcon(); + + if (!_vm->isFlag(kGFUnk13)) + _vm->_gameSys->insertSequence(0xD3, 39, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->_debugLevel == 4) + _vm->startIdleTimer(6); + + _vm->_gameSys->insertSequence(0xCB, 39, 0, 0, kSeqNone, 0, 0, 0); + + _currJanitorSequenceId = 0xCB; + _nextJanitorSequenceId = -1; + + _vm->_gameSys->setAnimation(0xCB, 39, 3); + _vm->_timers[5] = _vm->getRandom(20) + 60; + + switch (_vm->_prevSceneNum) { + case 26: + _vm->initGnapPos(7, 12, kDirBottomRight); + _vm->initPlatypusPos(6, 12, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(7, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + break; + case 29: + _vm->initGnapPos(-1, 8, kDirBottomRight); + _vm->initPlatypusPos(-1, 9, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(3, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(3, 9, -1, 0x107C2, 1); + break; + case 31: + _vm->initGnapPos(12, 8, kDirBottomLeft); + _vm->initPlatypusPos(12, 9, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(8, 9, -1, 0x107C2, 1); + break; + default: + _vm->initGnapPos(6, 8, kDirBottomRight); + _vm->initPlatypusPos(5, 9, kDirNone); + _vm->endSceneInit(); + break; + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + _vm->_sceneClickedHotspot = -1; + if (_vm->_gnapActionStatus < 0) + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS27Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS27Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS27Janitor: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemPicture) { + _vm->_gnapIdleFacing = kDirUpLeft; + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 0, 0x107BC, 1)) + _vm->_gnapActionStatus = kAS27ShowPictureToJanitor; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 7, 3); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(6, 3); + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS27TalkJanitor; + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS27Bucket: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 3, 3); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(3, 3); + break; + case GRAB_CURSOR: + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS27Bucket].x, _vm->_hotspotsWalkPos[kHS27Bucket].y) | 0x10000, 1); + _vm->_gnapActionStatus = kAS27GrabBucket; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS27ExitCircus: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 26; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS27ExitCircus].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kAS27LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitCircus].x + 1, _vm->_hotspotsWalkPos[kHS27ExitCircus].y, -1, 0x107C7, 1); + } + break; + + case kHS27ExitArcade: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 29; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS27ExitArcade].y, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kAS27LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitArcade].x, _vm->_hotspotsWalkPos[kHS27ExitArcade].y + 1, -1, 0x107CF, 1); + } + break; + + case kHS27ExitBeerStand: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 31; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS27ExitBeerStand].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kAS27LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitBeerStand].x, _vm->_hotspotsWalkPos[kHS27ExitBeerStand].y + 1, -1, 0x107CD, 1); + } + break; + + case kHS27ExitClown: + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFPlatypus)) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 28; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27ExitClown].x, _vm->_hotspotsWalkPos[kHS27ExitClown].y, 0, 0x107AD, 1); + _vm->_gnapActionStatus = kAS27LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitClown].x + 1, _vm->_hotspotsWalkPos[kHS27ExitClown].y, -1, 0x107C4, 1); + } else { + _vm->_hotspots[kHS27WalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27ExitClown].x, 7, 0, 0x107BC, 1); + _vm->_hotspots[kHS27WalkArea1]._flags &= SF_WALKABLE; + _vm->_gnapActionStatus = kAS27TryEnterClownTent; + } + } + break; + + case kHS27WalkArea1: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x1093B)) + _vm->playSound(0x1093B, true); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (_vm->_debugLevel == 4) + _vm->updateIdleTimer(); + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(20) + 60; + if (_vm->_gnapActionStatus < 0) { + if (_vm->getRandom(3) != 0) + _nextJanitorSequenceId = 0xCB; + else + _nextJanitorSequenceId = 0xCF; + } + } + if (!_vm->_timers[7]) { + _vm->_timers[7] = _vm->getRandom(100) + 300; + if (_vm->_gnapActionStatus < 0) + _vm->_gameSys->insertSequence(0xD4, 120, 0, 0, kSeqNone, 0, 0, 0); + } + _vm->playSoundB(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene27::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS27TalkJanitor: + switch (_vm->getRandom(3)) { + case 0: + _nextJanitorSequenceId = 0xCC; + break; + case 1: + _nextJanitorSequenceId = 0xCD; + break; + case 2: + _nextJanitorSequenceId = 0xCE; + break; + } + break; + case kAS27GrabBucket: + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_hotspots[kHS27Bucket]._flags = SF_DISABLED; + _vm->invAdd(kItemEmptyBucket); + _vm->setFlag(kGFUnk13); + _vm->_gameSys->setAnimation(0xD2, 39, 0); + _vm->_gameSys->insertSequence(0xD2, 39, 211, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = kAS27GrabBucketDone; + break; + case kAS27GrabBucketDone: + _vm->setGrabCursorSprite(kItemEmptyBucket); + _vm->_gnapActionStatus = -1; + break; + case kAS27ShowPictureToJanitor: + _nextJanitorSequenceId = 0xD0; + break; + case kAS27TryEnterClownTent: + _nextJanitorSequenceId = 0xD1; + _vm->_gameSys->insertSequence(0xD1, 39, _currJanitorSequenceId, 39, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 3); + _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 0); + _currJanitorSequenceId = _nextJanitorSequenceId; + _nextJanitorSequenceId = -1; + _vm->_gnapActionStatus = kAS27TryEnterClownTentDone; + break; + case kAS27TryEnterClownTentDone: + _vm->_hotspots[kHS27WalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[7].x, 9, -1, 0x107BC, 1); + _vm->_hotspots[kHS27WalkArea1]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = -1; + break; + case kAS27EnterClownTent: + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107B2, 1); + _vm->_gnapActionStatus = kAS27LeaveScene; + break; + case kAS27LeaveScene: + _vm->_sceneDone = true; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + switch (_nextJanitorSequenceId) { + case -1: + _nextJanitorSequenceId = 0xCB; + _vm->_gameSys->insertSequence(0xCB, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 3); + _currJanitorSequenceId = _nextJanitorSequenceId; + _nextJanitorSequenceId = -1; + break; + case 0xCC: + case 0xCD: + case 0xCE: + _vm->_gnapActionStatus = -1; + _vm->_gameSys->insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 3); + _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 0); + _currJanitorSequenceId = _nextJanitorSequenceId; + _nextJanitorSequenceId = -1; + break; + case 0xD0: + // Show picture to janitor + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 0); + _vm->_gnapActionStatus = kAS27EnterClownTent; + _currJanitorSequenceId = _nextJanitorSequenceId; + _nextJanitorSequenceId = -1; + _vm->setFlag(kGFPlatypus); + _vm->setGrabCursorSprite(-1); + _vm->invRemove(kItemPicture); + _vm->_newSceneNum = 28; + break; + default: + _vm->_gameSys->insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 3); + _currJanitorSequenceId = _nextJanitorSequenceId; + _nextJanitorSequenceId = -1; + break; + } + } +} + +/*****************************************************************************/ + +enum { + kHS28Platypus = 0, + kHS28Horn = 1, + kHS28Clown = 2, + kHS28ExitOutsideClown = 3, + kHS28EmptyBucket = 4, + kHS28Device = 5, + kHS28WalkArea1 = 6, + kHS28WalkArea2 = 7 +}; + +enum { + kAS28UseBeerBucketWithClown = 0, + kAS28UsePillBucketWithClown = 1, + kAS28GrabHornFails = 2, + kAS28GrabEmptyBucket = 3, + kAS28GrabHornSuccess = 4, + kAS28GrabHornSuccessDone = 5, + kAS28GrabEmptyBucketDone = 6, + kAS28GrabHornFailsDone = 7, + kAS28TalkClown = 8, + kAS28GnapWaiting = 9, + kAS28LeaveScene = 10 +}; + +Scene28::Scene28(GnapEngine *vm) : Scene(vm) { + _currClownSequenceId = -1; + _nextClownSequenceId = -1; + _clownTalkCtr = 0; +} + +int Scene28::init() { + return 0x125; +} + +void Scene28::updateHotspots() { + _vm->setHotspot(kHS28Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS28Horn, 148, 352, 215, 383, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); + _vm->setHotspot(kHS28Clown, 130, 250, 285, 413, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 5); + _vm->setHotspot(kHS28ExitOutsideClown, 660, 190, 799, 400, SF_EXIT_R_CURSOR, 9, 6); + _vm->setHotspot(kHS28EmptyBucket, 582, 421, 643, 478, SF_WALKABLE | SF_DISABLED, 9, 7); + _vm->setHotspot(kHS28WalkArea1, 0, 0, 799, 523); + _vm->setHotspot(kHS28WalkArea2, 0, 0, 0, 0, 7, SF_DISABLED); + _vm->setDeviceHotspot(kHS28Device, -1, -1, -1, -1); + if (_vm->invHas(kItemHorn)) + _vm->_hotspots[kHS28Horn]._flags = SF_DISABLED; + if (_vm->isFlag(kGFUnk22)) + _vm->_hotspots[kHS28EmptyBucket]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _vm->_hotspotsCount = 8; +} + +void Scene28::run() { + _vm->playSound(0x1093C, true); + _nextClownSequenceId = -1; + _vm->queueInsertDeviceIcon(); + _vm->_gameSys->insertSequence(0x124, 255, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->isFlag(kGFUnk22)) + _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->isFlag(kGFMudTaken)) { + if (_vm->isFlag(kGFUnk21)) { + _vm->_gameSys->setAnimation(0x11C, 39, 3); + _vm->_gameSys->insertSequence(0x11C, 39, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->invHas(kItemHorn)) + _vm->_gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, 0, 0, 0); + _currClownSequenceId = 0x11C; + } else { + _currClownSequenceId = 0x11B; + _vm->_gameSys->setAnimation(0x11B, 39, 3); + _vm->_gameSys->insertSequence(_currClownSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->_timers[4] = _vm->getRandom(20) + 80; + } + _vm->initGnapPos(8, 8, kDirBottomLeft); + _vm->initPlatypusPos(9, 8, kDirUnk4); + _vm->endSceneInit(); + } else { + _vm->_gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->initGnapPos(8, 8, kDirBottomLeft); + _vm->initPlatypusPos(9, 8, kDirUnk4); + _vm->endSceneInit(); + _vm->playSequences(0xF7, 0x121, 0x122, 0x123); + _currClownSequenceId = 0x115; + _vm->setFlag(kGFMudTaken); + _vm->_gameSys->setAnimation(0x115, 39, 3); + _vm->_gameSys->insertSequence(_currClownSequenceId, 39, 0x11B, 39, kSeqSyncWait, 0, 0, 0); + _nextClownSequenceId = -1; + _vm->_timers[4] = _vm->getRandom(20) + 80; + _vm->_gnapActionStatus = kAS28GnapWaiting; + while (_vm->_gameSys->getAnimationStatus(3) != 2) { + _vm->gameUpdateTick(); + _vm->updateMouseCursor(); + } + _vm->_gnapActionStatus = -1; + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS28Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS28Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS28Horn: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(2, 8, 3, 4); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(2, 4); + break; + case GRAB_CURSOR: + if (_vm->isFlag(kGFUnk21)) { + if (!_vm->invHas(kItemHorn)) { + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28Horn].x, _vm->_hotspotsWalkPos[kHS28Horn].y) | 0x10000, 1); + _vm->_gnapActionStatus = kAS28GrabHornSuccess; + } + } else { + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(2, 8, 0, 0x107BB, 1); + _vm->_hotspots[kHS28WalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28Horn].x, _vm->_hotspotsWalkPos[kHS28Horn].y, 0, 0x107BB, 1); + _vm->_hotspots[kHS28WalkArea1]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kAS28GrabHornFails; + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS28Clown: + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFUnk21)) { + if (_vm->_verbCursor == LOOK_CURSOR) + _vm->playGnapScratchingHead(5, 2); + else + _vm->playGnapImpossible(0, 0); + } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithBeer) { + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28Clown].x, _vm->_hotspotsWalkPos[kHS28Clown].y, 0, 0x107BC, 1); + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_gnapActionStatus = kAS28UseBeerBucketWithClown; + } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithPill) { + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28Clown].x, _vm->_hotspotsWalkPos[kHS28Clown].y, 0, 0x107BC, 1); + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_gnapActionStatus = kAS28UsePillBucketWithClown; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS28Clown].x, _vm->_hotspotsWalkPos[kHS28Clown].y, 2, 4); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(5, 2); + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(5, 8, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS28TalkClown; + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS28ExitOutsideClown: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 27; + _vm->_hotspots[kHS28WalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown].x, _vm->_hotspotsWalkPos[kHS28ExitOutsideClown].y, 0, 0x107BF, 1); + _vm->_gnapActionStatus = kAS28LeaveScene; + _vm->_hotspots[kHS28WalkArea1]._flags &= ~SF_WALKABLE; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown].x - 1, _vm->_hotspotsWalkPos[kHS28ExitOutsideClown].y, -1, 0x107C2, 1); + } + break; + + case kHS28EmptyBucket: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 8, 6); + } else if (_vm->isFlag(kGFUnk21)) { + _vm->playGnapImpossible(8, 6); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(8, 6); + break; + case GRAB_CURSOR: + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28EmptyBucket].x, _vm->_hotspotsWalkPos[kHS28EmptyBucket].y) | 0x10000, 1); + _vm->_gnapActionStatus = kAS28GrabEmptyBucket; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS28WalkArea1: + case kHS28WalkArea2: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x1093C)) + _vm->playSound(0x1093C, true); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(20) + 80; + if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFUnk21)) + _nextClownSequenceId = 0x114; + } + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene28::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS28UseBeerBucketWithClown: + _vm->setFlag(kGFUnk22); + _nextClownSequenceId = 0x113; + _vm->invRemove(kItemBucketWithBeer); + updateHotspots(); + break; + case kAS28UsePillBucketWithClown: + _nextClownSequenceId = 0x116; + _vm->invRemove(kItemBucketWithPill); + _vm->setFlag(kGFUnk22); + _vm->setFlag(kGFUnk21); + updateHotspots(); + break; + case kAS28GrabHornFails: + _nextClownSequenceId = 0x119; + break; + case kAS28GrabHornSuccess: + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->setAnimation(0x117, 59, 0); + _vm->_gameSys->insertSequence(0x117, 59, 280, 59, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = kAS28GrabHornSuccessDone; + break; + case kAS28GrabHornSuccessDone: + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + _vm->addFullScreenSprite(0xF6, 255); + _vm->_gameSys->setAnimation(0x120, 256, 0); + _vm->_gameSys->insertSequence(0x120, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(0) != 2) + _vm->gameUpdateTick(); + _vm->removeFullScreenSprite(); + _vm->showCursor(); + _vm->setGrabCursorSprite(kItemHorn); + _vm->invAdd(kItemHorn); + updateHotspots(); + _vm->_gnapActionStatus = -1; + break; + case kAS28GrabEmptyBucket: + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->setAnimation(0x111, 99, 0); + _vm->_gameSys->insertSequence(0x111, 99, 274, 99, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = kAS28GrabEmptyBucketDone; + break; + case kAS28GrabEmptyBucketDone: + _vm->setGrabCursorSprite(kItemEmptyBucket); + _vm->clearFlag(kGFUnk22);; + updateHotspots(); + _vm->invAdd(kItemEmptyBucket); + _vm->_gnapActionStatus = -1; + break; + case kAS28GrabHornFailsDone: + _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 281, 39, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceId = 0x7B5; + _vm->_gnapSequenceDatNum = 1; + _vm->_gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); + _currClownSequenceId = 0x11B; + _nextClownSequenceId = -1; + _vm->_gnapActionStatus = -1; + _vm->gnapWalkTo(2, 8, -1, 0x107BB, 1); + break; + case kAS28TalkClown: + _clownTalkCtr = (_clownTalkCtr + 1) % 2; + if (_clownTalkCtr == 0) + _nextClownSequenceId = 0x11D; + else if (_clownTalkCtr == 1) + _nextClownSequenceId = 0x11E; + else if (_clownTalkCtr == 2) + _nextClownSequenceId = 0x11F; // NOTE CHECKME Never set, bug in the original? + break; + case kAS28GnapWaiting: + _vm->_gnapActionStatus = -1; + break; + case kAS28LeaveScene: + _vm->_sceneDone = true; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + switch (_nextClownSequenceId) { + case 0x113: + _vm->setGrabCursorSprite(-1); + _vm->_gameSys->setAnimation(_nextClownSequenceId, 39, 0); + _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_nextClownSequenceId), 0, 0); + _vm->_gameSys->insertSequence(_nextClownSequenceId, 39, _currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x11B, 39, _nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _currClownSequenceId = 0x11B; + _nextClownSequenceId = -1; + _vm->_gnapActionStatus = kAS28GnapWaiting; + break; + case 0x116: + _vm->setGrabCursorSprite(-1); + _vm->_gameSys->setAnimation(_nextClownSequenceId, 39, 0); + _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_nextClownSequenceId), 0, 0); + _vm->_gameSys->insertSequence(_nextClownSequenceId, 39, _currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x11C, 39, _nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_nextClownSequenceId), 0, 0); + _currClownSequenceId = _nextClownSequenceId; + _nextClownSequenceId = -1; + _vm->_gnapActionStatus = kAS28GnapWaiting; + break; + case 0x11D: + case 0x11E: + case 0x11F: + _vm->_gnapActionStatus = -1; + break; + case 0x119: + _vm->_gameSys->insertSequence(_nextClownSequenceId, 39, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextClownSequenceId, 39, 0); + _vm->_gameSys->removeSequence(_currClownSequenceId, 39, true); + _vm->_gnapActionStatus = kAS28GrabHornFailsDone; + _vm->_gnapSequenceId = _nextClownSequenceId; + _vm->_gnapSequenceDatNum = 0; + _nextClownSequenceId = -1; + break; + } + if (_nextClownSequenceId != -1) { + _vm->_gameSys->insertSequence(_nextClownSequenceId, 39, _currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextClownSequenceId, 39, 3); + _currClownSequenceId = _nextClownSequenceId; + _nextClownSequenceId = -1; + } + } +} + +/*****************************************************************************/ + +enum { + kHS29Platypus = 0, + kHS29Monkey = 1, + kHS29Device = 2, + kHS29ExitCircus = 3, + kHS29ExitOutsideClown = 4, + kHS29Aracde = 5, + kHS29WalkArea1 = 6 +}; + +enum { + kAS29UseBananaWithMonkey = 0, + kAS29LeaveScene = 2 +}; + +Scene29::Scene29(GnapEngine *vm) : Scene(vm) { + _currMonkeySequenceId = -1; + _nextMonkeySequenceId = -1; + _currManSequenceId = -1; + _nextManSequenceId = -1; +} + +int Scene29::init() { + return 0xF6; +} + +void Scene29::updateHotspots() { + _vm->setHotspot(kHS29Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS29Monkey, 410, 374, 518, 516, SF_WALKABLE | SF_DISABLED, 3, 7); + _vm->setHotspot(kHS29ExitCircus, 150, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHS29ExitOutsideClown, 785, 0, 800, 600, SF_EXIT_R_CURSOR | SF_WALKABLE, 11, 9); + _vm->setHotspot(kHS29Aracde, 88, 293, 155, 384, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 8); + _vm->setHotspot(kHS29WalkArea1, 0, 0, 800, 478); + _vm->setDeviceHotspot(kHS29Device, -1, -1, -1, -1); + if (_vm->invHas(kItemHorn)) + _vm->_hotspots[kHS29Monkey]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _vm->_hotspotsCount = 7; +} + +void Scene29::run() { + _vm->playSound(0x1093B, true); + _vm->startSoundTimerB(6); + _vm->queueInsertDeviceIcon(); + + if (_vm->invHas(kItemHorn)) { + _currMonkeySequenceId = 0xE8; + _nextMonkeySequenceId = -1; + _vm->_gameSys->setAnimation(0xE8, 159, 4); + _vm->_gameSys->insertSequence(_currMonkeySequenceId, 159, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); + _currManSequenceId = 0xED; + _nextManSequenceId = -1; + _vm->_gameSys->setAnimation(0xED, 39, 3); + _vm->_timers[4] = _vm->getRandom(20) + 60; + } else { + _vm->_gameSys->insertSequence(0xF4, 19, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 4); + _vm->_gameSys->insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 3); + } + + _vm->_gameSys->insertSequence(0xF3, 39, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0xF5, 38, 0, 0, kSeqLoop, 0, 0, 0); + + if (_vm->_prevSceneNum == 27) { + _vm->initGnapPos(12, 7, kDirBottomRight); + _vm->initPlatypusPos(12, 8, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 7, -1, 0x107B9, 1); + _vm->platypusWalkTo(8, 8, -1, 0x107C2, 1); + } else { + _vm->initGnapPos(-1, 7, kDirBottomRight); + _vm->initPlatypusPos(-2, 7, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); + _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS29Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS29Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS29Monkey: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemBanana) { + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS29UseBananaWithMonkey; + _vm->_newSceneNum = 51; + _vm->_isLeavingScene = true; + _vm->setGrabCursorSprite(-1); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y, 5, 6); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(5, 6); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y); + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS29ExitCircus: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 26; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus].x, _vm->_hotspotsWalkPos[kHS29ExitCircus].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kAS29LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus].x + 1, _vm->_hotspotsWalkPos[kHS29ExitCircus].y, -1, -1, 1); + } + break; + + case kHS29ExitOutsideClown: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 27; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown].x, _vm->_hotspotsWalkPos[kHS29ExitOutsideClown].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kAS29LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown].x, _vm->_hotspotsWalkPos[kHS29ExitOutsideClown].y - 1, -1, 0x107CD, 1); + } + break; + + case kHS29Aracde: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { + _vm->setGrabCursorSprite(-1); + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 52; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y, 0, -1, 1); + _vm->playGnapIdle(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y); + _vm->_gnapActionStatus = kAS29LeaveScene; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y, 2, 3); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan2(0, 0); + break; + case GRAB_CURSOR: + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS29WalkArea1: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x1093B)) + _vm->playSound(0x1093B, true); + + if (!_vm->_isLeavingScene) { + if (_vm->_gnapActionStatus < 0) { + _vm->updateGnapIdleSequence(); + _vm->updatePlatypusIdleSequence(); + } + if (!_vm->_timers[4]) { + if (_vm->invHas(kItemHorn)) { + _vm->_timers[4] = _vm->getRandom(20) + 60; + if (_vm->_gnapActionStatus < 0) { + switch (_vm->getRandom(5)) { + case 0: + _nextManSequenceId = 0xED; + break; + case 1: + _nextManSequenceId = 0xEE; + break; + case 2: + _nextManSequenceId = 0xEF; + break; + case 3: + _nextManSequenceId = 0xF0; + break; + case 4: + _nextManSequenceId = 0xF1; + break; + } + } + } + } + _vm->playSoundB(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene29::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS29UseBananaWithMonkey: + _nextMonkeySequenceId = 0xE5; + break; + case kAS29LeaveScene: + _vm->_sceneDone = true; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _nextManSequenceId != -1) { + _vm->_gameSys->insertSequence(_nextManSequenceId, 39, _currManSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextManSequenceId, 39, 3); + _currManSequenceId = _nextManSequenceId; + _nextManSequenceId = -1; + } + + if (_vm->_gameSys->getAnimationStatus(4) == 2) { + if (_nextMonkeySequenceId == 0xE5) { + _vm->_gameSys->insertSequence(0xF2, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0xF2; + _vm->_gameSys->setAnimation(0xE6, 159, 0); + _vm->_gameSys->setAnimation(0, 159, 4); + _vm->_gameSys->insertSequence(_nextMonkeySequenceId, 159, _currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xE6, 159, _nextMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = kAS29LeaveScene; + _currMonkeySequenceId = 0xE6; + _nextMonkeySequenceId = -1; + _vm->_timers[5] = 30; + while (_vm->_timers[5]) + _vm->gameUpdateTick(); + _vm->platypusWalkTo(0, 8, 1, 0x107CF, 1); + while (_vm->_gameSys->getAnimationStatus(1) != 2) + _vm->gameUpdateTick(); + } else if (_nextMonkeySequenceId == -1) { + switch (_vm->getRandom(6)) { + case 0: + _nextMonkeySequenceId = 0xE8; + break; + case 1: + _nextMonkeySequenceId = 0xE9; + break; + case 2: + _nextMonkeySequenceId = 0xEA; + break; + case 3: + _nextMonkeySequenceId = 0xEB; + break; + case 4: + _nextMonkeySequenceId = 0xEC; + break; + case 5: + _nextMonkeySequenceId = 0xE7; + break; + } + _vm->_gameSys->insertSequence(_nextMonkeySequenceId, 159, _currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextMonkeySequenceId, 159, 4); + _currMonkeySequenceId = _nextMonkeySequenceId; + _nextMonkeySequenceId = -1; + } else { + _vm->_gameSys->insertSequence(_nextMonkeySequenceId, 159, _currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextMonkeySequenceId, 159, 4); + _currMonkeySequenceId = _nextMonkeySequenceId; + _nextMonkeySequenceId = -1; + } + } +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/group2.h b/engines/gnap/scenes/group2.h new file mode 100644 index 0000000000..3e84d4d500 --- /dev/null +++ b/engines/gnap/scenes/group2.h @@ -0,0 +1,211 @@ +/* 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_GROUP2_H +#define GNAP_GROUP2_H + +#include "gnap/debugger.h" + +namespace Gnap { + +class GnapEngine; +class CutScene; + +class Scene20: public Scene { +public: + Scene20(GnapEngine *vm); + ~Scene20() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb(); + +private: + int _currStonerGuySequenceId; + int _nextStonerGuySequenceId; + int _currGroceryStoreGuySequenceId; + int _nextGroceryStoreGuySequenceId; + int _stonerGuyCtr; + int _groceryStoreGuyCtr; + bool _stonerGuyShowingJoint; + + void stopSounds(); +}; + +class Scene21: public Scene { +public: + Scene21(GnapEngine *vm); + ~Scene21() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currOldLadySequenceId; + int _nextOldLadySequenceId; +}; + +class Scene22: public Scene { +public: + Scene22(GnapEngine *vm); + ~Scene22() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currCashierSequenceId; + int _nextCashierSequenceId; + bool _caughtBefore; + int _cashierCtr; +}; + +class Scene23: public Scene { +public: + Scene23(GnapEngine *vm); + ~Scene23() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currStoreClerkSequenceId; + int _nextStoreClerkSequenceId; +}; + +class Scene24: public Scene { +public: + Scene24(GnapEngine *vm); + ~Scene24() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currWomanSequenceId; + int _nextWomanSequenceId; + int _boySequenceId; + int _girlSequenceId; +}; + +class Scene25: public Scene { +public: + Scene25(GnapEngine *vm); + ~Scene25() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currTicketVendorSequenceId; + int _nextTicketVendorSequenceId; + + void playAnims(int index); +}; + +class Scene26: public Scene { +public: + Scene26(GnapEngine *vm); + ~Scene26() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currKidSequenceId; + int _nextKidSequenceId; +}; + +class Scene27: public Scene { +public: + Scene27(GnapEngine *vm); + ~Scene27() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _nextJanitorSequenceId; + int _currJanitorSequenceId; +}; + +class Scene28: public Scene { +public: + Scene28(GnapEngine *vm); + ~Scene28() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currClownSequenceId; + int _nextClownSequenceId; + int _clownTalkCtr; +}; + +class Scene29: public Scene { +public: + Scene29(GnapEngine *vm); + ~Scene29() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currMonkeySequenceId; + int _nextMonkeySequenceId; + int _currManSequenceId; + int _nextManSequenceId; +}; + +} // End of namespace Gnap + +#endif // GNAP_GROUP1_H diff --git a/engines/gnap/scenes/scene20.cpp b/engines/gnap/scenes/scene20.cpp deleted file mode 100644 index c31f6229cb..0000000000 --- a/engines/gnap/scenes/scene20.cpp +++ /dev/null @@ -1,732 +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/scene20.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSGroceryStoreHat = 1, - kHSExitParkingLot = 2, - kHSStonerGuy = 3, - kHSGroceryStoreGuy = 4, - kHSDevice = 5, - kHSExitInsideGrubCity = 6, - kHSExitOutsideCircusWorld = 7, - kHSExitOutsideToyStore = 8, - kHSExitPhone = 9, - kHSWalkArea1 = 10, - kHSWalkArea2 = 11 -}; - -enum { - kASLeaveScene = 0, - kASTalkStonerGuyNoJoint = 2, - kASTalkStonerGuyHasJoint = 3, - kASGrabJoint = 4, - kASActionDone = 5, - kASTalkGroceryStoreGuy = 6, - kASGrabGroceryStoreGuy = 9, - kASGrabGroceryStoreHat = 10, - kASSwitchGroceryStoreHat = 11, - kASSwitchGroceryStoreHatDone = 12, - kASGrabJointDone = 13 -}; - -Scene20::Scene20(GnapEngine *vm) : Scene(vm) { - _s20_stonerGuyCtr = 3; - _s20_stonerGuyShowingJoint = false; - _s20_groceryStoreGuyCtr = 0; -} - -int Scene20::init() { - return 0x186; -} - -void Scene20::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSGroceryStoreHat, 114, 441, 174, 486, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 7); - _vm->setHotspot(kHSExitParkingLot, 0, 300, 15, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 7); - _vm->setHotspot(kHSStonerGuy, 276, 290, 386, 450, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 8); - _vm->setHotspot(kHSGroceryStoreGuy, 123, 282, 258, 462, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); - _vm->setHotspot(kHSExitInsideGrubCity, 519, 250, 581, 413, SF_EXIT_L_CURSOR, 8, 7); - _vm->setHotspot(kHSExitOutsideCircusWorld, 660, 222, 798, 442, SF_EXIT_NE_CURSOR, 9, 6); - _vm->setHotspot(kHSExitOutsideToyStore, 785, 350, 800, 600, SF_EXIT_R_CURSOR, 11, 8); - _vm->setHotspot(kHSExitPhone, 250, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 10); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 468); - _vm->setHotspot(kHSWalkArea2, 605, 0, 800, 600); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 12; -} - -void Scene20::updateAnimationsCb() { - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - switch (_s20_nextStonerGuySequenceId) { - case 0x16B: - if (!_vm->_timers[4]) { - _s20_stonerGuyShowingJoint = false; - _vm->_gameSys->insertSequence(0x16B, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _s20_currStonerGuySequenceId = 0x16B; - _s20_nextStonerGuySequenceId = -1; - } - break; - case 0x16A: - // Grab joint - _vm->playGnapPullOutDevice(4, 4); - _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->setAnimation(0x16A, 21, 0); - _vm->_gameSys->insertSequence(0x16A, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _s20_currStonerGuySequenceId = 0x16A; - _s20_nextStonerGuySequenceId = -1; - _vm->invAdd(kItemJoint); - _vm->setFlag(kGFJointTaken); - _s20_stonerGuyShowingJoint = false; - _vm->_gnapActionStatus = kASGrabJointDone; - break; - case 0x16E: - _vm->_gameSys->setAnimation(0x16E, 21, 2); - _vm->_gameSys->insertSequence(0x16E, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _s20_currStonerGuySequenceId = 0x16E; - _s20_nextStonerGuySequenceId = -1; - _s20_nextGroceryStoreGuySequenceId = 0x175; - break; - case 0x16D: - _vm->_gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 2); - _vm->_gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 0); - _vm->_gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _s20_currStonerGuySequenceId = _s20_nextStonerGuySequenceId; - _s20_nextStonerGuySequenceId = -1; - _vm->_gnapActionStatus = kASActionDone; - break; - case 0x16F: - _vm->_gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 2); - _vm->_gameSys->setAnimation(0x17A, 20, 3); - _vm->_gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x17A, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _s20_currGroceryStoreGuySequenceId = 0x17A; - _s20_nextGroceryStoreGuySequenceId = -1; - _s20_currStonerGuySequenceId = _s20_nextStonerGuySequenceId; - _s20_nextStonerGuySequenceId = -1; - break; - case 0x171: - _s20_stonerGuyCtr = (_s20_stonerGuyCtr + 1) % 3; - switch (_s20_stonerGuyCtr) { - case 1: - _s20_nextStonerGuySequenceId = 0x171; - break; - case 2: - _s20_nextStonerGuySequenceId = 0x172; - break; - case 3: - _s20_nextStonerGuySequenceId = 0x173; - break; - default: - _s20_nextStonerGuySequenceId = 0x171; - break; - } - _vm->_gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x17C, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x17C, 20, 3); - _vm->_gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 2); - _s20_currGroceryStoreGuySequenceId = 0x17C; - _s20_nextGroceryStoreGuySequenceId = -1; - _s20_currStonerGuySequenceId = _s20_nextStonerGuySequenceId; - _s20_nextStonerGuySequenceId = -1; - break; - default: - _s20_nextStonerGuySequenceId = 0x16C; - _vm->_gameSys->setAnimation(0x16C, 21, 2); - _vm->_gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _s20_currStonerGuySequenceId = _s20_nextStonerGuySequenceId; - _s20_nextStonerGuySequenceId = -1; - break; - } - } -} - -void Scene20::stopSounds() { - _vm->stopSound(0x18E); - _vm->stopSound(0x18F); - _vm->stopSound(0x190); - _vm->stopSound(0x191); - _vm->stopSound(0x194); - _vm->stopSound(0x195); - _vm->stopSound(0x192); - _vm->stopSound(0x193); - _vm->stopSound(0x196); - _vm->stopSound(0x197); - _vm->stopSound(0x198); - _vm->stopSound(0x199); - _vm->stopSound(0x19A); -} - -void Scene20::run() { - _vm->playSound(0x10940, true); - _vm->startSoundTimerA(8); - - _s20_stonerGuyShowingJoint = false; - _vm->_timers[7] = _vm->getRandom(100) + 100; - - _s20_stonerGuyCtr = (_s20_stonerGuyCtr + 1) % 3; - switch (_s20_stonerGuyCtr) { - case 1: - _s20_currStonerGuySequenceId = 0x171; - break; - case 2: - _s20_currStonerGuySequenceId = 0x172; - break; - case 3: - _s20_currStonerGuySequenceId = 0x173; - break; - } - - _s20_nextStonerGuySequenceId = -1; - _vm->_gameSys->setAnimation(_s20_currStonerGuySequenceId, 21, 2); - _vm->_gameSys->insertSequence(_s20_currStonerGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); - - _vm->_timers[6] = _vm->getRandom(20) + 30; - - _s20_currGroceryStoreGuySequenceId = 0x17C; - _s20_nextGroceryStoreGuySequenceId = -1; - _vm->_gameSys->setAnimation(0x17C, 20, 3); - _vm->_gameSys->insertSequence(0x17C, 20, 0, 0, kSeqNone, 0, 0, 0); - - _vm->_timers[5] = _vm->getRandom(50) + 130; - if (_vm->isFlag(kGFGroceryStoreHatTaken)) - _vm->_gameSys->insertSequence(0x17F, 20, 0, 0, kSeqNone, 0, 0, 0); - else - _vm->_gameSys->insertSequence(0x174, 20, 0, 0, kSeqNone, 0, 0, 0); - - _vm->queueInsertDeviceIcon(); - - if (_vm->isFlag(kGFSceneFlag1)) { - _vm->clearFlag(kGFSceneFlag1); - _vm->endSceneInit(); - _vm->_gameSys->setAnimation(0x182, 140, 0); - _vm->_gameSys->insertSequence(0x182, 140, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) { - // checkGameAppStatus(); - _vm->gameUpdateTick(); - } - _vm->initGnapPos(11, 8, kDirBottomLeft); - _vm->initPlatypusPos(11, 9, kDirUnk4); - _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); - } else { - switch (_vm->_prevSceneNum) { - case 17: - _vm->initGnapPos(5, 11, kDirBottomRight); - _vm->initPlatypusPos(6, 11, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); - break; - case 18: - _vm->initGnapPos(11, 8, kDirBottomLeft); - _vm->initPlatypusPos(11, 9, kDirUnk4); - _vm->endSceneInit(); - _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); - break; - case 21: - _vm->initGnapPos(-1, 8, kDirBottomLeft); - _vm->initPlatypusPos(-1, 9, kDirUnk4); - _vm->endSceneInit(); - _vm->gnapWalkTo(3, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(3, 9, -1, 0x107C2, 1); - break; - case 22: - _vm->initGnapPos(7, 6, kDirBottomRight); - _vm->initPlatypusPos(8, 6, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(8, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(9, 9, -1, 0x107C2, 1); - break; - default: - _vm->initGnapPos(8, 6, kDirBottomLeft); - _vm->initPlatypusPos(9, 6, kDirUnk4); - _vm->endSceneInit(); - _vm->_hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(9, 9, -1, 0x107C2, 1); - _vm->_hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; - break; - } - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 0, -1, -1, -1, -1); - _vm->testWalk(0, 1, 7, 9, 8, 9); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(20); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitParkingLot: - if (_vm->_gnapActionStatus < 0) { - if (_s20_stonerGuyShowingJoint) - _vm->_timers[4] = 0; - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 21; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitParkingLot].x, _vm->_hotspotsWalkPos[kHSExitParkingLot].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitParkingLot].x, _vm->_hotspotsWalkPos[kHSExitParkingLot].y + 1, -1, 0x107CF, 1); - _vm->_platypusFacing = kDirUnk4; - } - break; - - case kHSExitPhone: - if (_vm->_gnapActionStatus < 0) { - if (_s20_stonerGuyShowingJoint) - _vm->_timers[4] = 0; - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 17; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitPhone].x, _vm->_hotspotsWalkPos[kHSExitPhone].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitPhone].x + 1, _vm->_hotspotsWalkPos[kHSExitPhone].y, -1, 0x107C2, 1); - } - break; - - case kHSExitOutsideToyStore: - if (_vm->_gnapActionStatus < 0) { - if (_s20_stonerGuyShowingJoint) - _vm->_timers[4] = 0; - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 18; - _vm->_hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideToyStore].x, _vm->_hotspotsWalkPos[kHSExitOutsideToyStore].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideToyStore].x, _vm->_hotspotsWalkPos[kHSExitOutsideToyStore].y + 1, -1, 0x107CD, 1); - _vm->_hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; - } - break; - - case kHSExitInsideGrubCity: - if (_vm->_gnapActionStatus < 0) { - if (_s20_stonerGuyShowingJoint) - _vm->_timers[4] = 0; - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 22; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitInsideGrubCity].x, _vm->_hotspotsWalkPos[kHSExitInsideGrubCity].y - 1, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitInsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHSExitInsideGrubCity].y, -1, 0x107C2, 1); - _vm->_platypusFacing = kDirUnk4; - } - break; - - case kHSExitOutsideCircusWorld: - if (_vm->_gnapActionStatus < 0) { - if (_s20_stonerGuyShowingJoint) - _vm->_timers[4] = 0; - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 24; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].x, _vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].y, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].y, -1, 0x107C2, 1); - } - break; - - case kHSStonerGuy: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSStonerGuy].x, _vm->_hotspotsWalkPos[kHSStonerGuy].y, 5, 4); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan2(5, 4); - break; - case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSStonerGuy].x, _vm->_hotspotsWalkPos[kHSStonerGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - if (_s20_stonerGuyShowingJoint) - _vm->_gnapActionStatus = kASGrabJoint; - else - _vm->playGnapImpossible(0, 0); - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSStonerGuy].x, _vm->_hotspotsWalkPos[kHSStonerGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - if (_vm->isFlag(kGFJointTaken)) - _vm->_gnapActionStatus = kASTalkStonerGuyNoJoint; - else - _vm->_gnapActionStatus = kASTalkStonerGuyHasJoint; - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSGroceryStoreGuy: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSGroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHSGroceryStoreGuy].y, 2, 4); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(2, 3); - break; - case GRAB_CURSOR: - _s20_stonerGuyShowingJoint = false; - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSGroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASGrabGroceryStoreGuy; - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSGroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkGroceryStoreGuy; - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSGroceryStoreHat: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemCowboyHat) { - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSGroceryStoreHat].x, _vm->_hotspotsWalkPos[kHSGroceryStoreHat].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASSwitchGroceryStoreHat; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSGroceryStoreHat].x, _vm->_hotspotsWalkPos[kHSGroceryStoreHat].y, 1, 6); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(1, 6); - break; - case GRAB_CURSOR: - _s20_stonerGuyShowingJoint = false; - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSGroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASGrabGroceryStoreHat; - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x10940)) - _vm->playSound(0x10940, true); - - if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0) { - _vm->_hotspots[kHSWalkArea1]._y2 += 48; - _vm->updatePlatypusIdleSequence(); - _vm->_hotspots[kHSWalkArea1]._y2 -= 48; - } - if (_vm->_gnapActionStatus < 0) - _vm->updateGnapIdleSequence(); - if (_vm->_gnapActionStatus < 0 && !_vm->_timers[5] && _s20_nextGroceryStoreGuySequenceId == -1) { - _vm->_timers[5] = _vm->getRandom(50) + 130; - if (_vm->getRandom(4) != 0) - _s20_nextGroceryStoreGuySequenceId = 0x17C; - else - _s20_nextGroceryStoreGuySequenceId = 0x17A; - } - if (!_vm->_timers[7]) { - _vm->_timers[7] = _vm->getRandom(100) + 100; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { - switch (_vm->getRandom(3)) { - case 0: - _vm->_gameSys->insertSequence(0x183, 253, 0, 0, kSeqNone, 0, 0, 0); - break; - case 1: - _vm->_gameSys->insertSequence(0x184, 253, 0, 0, kSeqNone, 0, 0, 0); - break; - case 2: - _vm->_gameSys->insertSequence(0x185, 253, 0, 0, kSeqNone, 0, 0, 0); - break; - } - } - } - _vm->playSoundA(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - _vm->gameUpdateTick(); - } -} - -void Scene20::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASLeaveScene: - _vm->_sceneDone = true; - break; - case kASTalkStonerGuyNoJoint: - _vm->_gameSys->setAnimation(0x170, 21, 2); - _vm->_gameSys->setAnimation(0x17B, 20, 3); - _vm->_gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - _vm->stopSound(0x1A1); - stopSounds(); - _s20_currGroceryStoreGuySequenceId = 0x17B; - _s20_currStonerGuySequenceId = 0x170; - _s20_nextGroceryStoreGuySequenceId = -1; - _s20_nextStonerGuySequenceId = 0x16E; - _vm->_timers[5] = 100; - _vm->_timers[6] = 100; - break; - case kASTalkStonerGuyHasJoint: - _vm->_gameSys->setAnimation(0x168, 21, 2); - _vm->_gameSys->setAnimation(379, 20, 3); - _vm->_gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x168, 21, 0x170, 21, kSeqSyncWait, 0, 0, 0); - _vm->stopSound(0x1A1); - stopSounds(); - _s20_currGroceryStoreGuySequenceId = 0x17B; - _s20_currStonerGuySequenceId = 0x168; - _s20_nextGroceryStoreGuySequenceId = -1; - _s20_nextStonerGuySequenceId = 0x16B; - _vm->_timers[5] = 200; - _vm->_timers[6] = 200; - _vm->_timers[4] = 100; - _s20_stonerGuyShowingJoint = true; - _vm->_gnapActionStatus = -1; - break; - case kASGrabJoint: - _s20_nextStonerGuySequenceId = 0x16A; - break; - case kASActionDone: - _vm->_gnapActionStatus = -1; - break; - case kASTalkGroceryStoreGuy: - _vm->_gameSys->setAnimation(0x170, 21, 2); - _vm->_gameSys->setAnimation(0x17B, 20, 3); - _vm->_gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - _vm->stopSound(0x1A1); - stopSounds(); - _s20_currGroceryStoreGuySequenceId = 0x17B; - _s20_currStonerGuySequenceId = 0x170; - _s20_groceryStoreGuyCtr = (_s20_groceryStoreGuyCtr + 1) % 2; - if (_s20_groceryStoreGuyCtr != 0) - _s20_nextGroceryStoreGuySequenceId = 0x176; - else - _s20_nextGroceryStoreGuySequenceId = 0x177; - _vm->_timers[5] = 100; - _vm->_timers[6] = 100; - break; - case kASGrabGroceryStoreGuy: - _vm->_gameSys->setAnimation(0x170, 21, 2); - _vm->_gameSys->setAnimation(0x17B, 20, 3); - _vm->_gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _vm->stopSound(0x1A1); - stopSounds(); - _s20_currGroceryStoreGuySequenceId = 0x17B; - _s20_currStonerGuySequenceId = 0x170; - _vm->_timers[5] = 120; - _vm->_timers[6] = 120; - _s20_nextGroceryStoreGuySequenceId = 0x178; - break; - case kASGrabGroceryStoreHat: - _vm->_gameSys->setAnimation(0x170, 21, 2); - _vm->_gameSys->setAnimation(0x17B, 20, 3); - _vm->_gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - _vm->stopSound(0x1A1); - stopSounds(); - _s20_currGroceryStoreGuySequenceId = 0x17B; - _s20_currStonerGuySequenceId = 0x170; - _s20_nextGroceryStoreGuySequenceId = 0x179; - break; - case kASSwitchGroceryStoreHat: - _vm->setGrabCursorSprite(-1); - _vm->_gameSys->setAnimation(0x180, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x180, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x180; - _vm->_gnapSequenceDatNum = 0; - _vm->invRemove(kItemCowboyHat); - _vm->invAdd(kItemGroceryStoreHat); - _vm->_gnapActionStatus = kASSwitchGroceryStoreHatDone; - break; - case kASSwitchGroceryStoreHatDone: - _vm->_gameSys->insertSequence(0x17F, 20, 372, 20, kSeqSyncWait, 0, 0, 0); - _vm->setFlag(kGFGroceryStoreHatTaken); - _vm->hideCursor(); - _vm->setGrabCursorSprite(-1); - _vm->addFullScreenSprite(0x12C, 255); - _vm->_gameSys->setAnimation(0x181, 256, 0); - _vm->_gameSys->insertSequence(0x181, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) - _vm->gameUpdateTick(); - _vm->removeFullScreenSprite(); - _vm->showCursor(); - _vm->setGrabCursorSprite(kItemGroceryStoreHat); - _vm->_gnapIdleFacing = kDirBottomRight; - _vm->gnapWalkTo(3, 8, -1, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = -1; - break; - case kASGrabJointDone: - _vm->setGrabCursorSprite(kItemJoint); - _vm->_gnapActionStatus = -1; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - switch (_s20_nextGroceryStoreGuySequenceId) { - case 0x176: - case 0x177: - _vm->_gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); - _vm->_gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _s20_currGroceryStoreGuySequenceId = _s20_nextGroceryStoreGuySequenceId; - _s20_nextGroceryStoreGuySequenceId = -1; - _s20_nextStonerGuySequenceId = 0x16D; - break; - case 0x178: - _vm->_gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); - _vm->_gameSys->setAnimation(0x17D, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x17D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x17D; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kASActionDone; - _vm->_gameSys->setAnimation(0x16D, 21, 2); - _vm->_gameSys->insertSequence(0x16D, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _s20_currStonerGuySequenceId = 0x16D; - _s20_currGroceryStoreGuySequenceId = 0x178; - _s20_nextGroceryStoreGuySequenceId = -1; - _s20_nextStonerGuySequenceId = -1; - break; - case 0x179: - _vm->_gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); - _vm->_gameSys->setAnimation(0x16D, 21, 0); - _vm->_gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x17E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x17E; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kASActionDone; - _vm->_gameSys->setAnimation(0x16D, 21, 2); - _vm->_gameSys->insertSequence(0x16D, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _s20_currStonerGuySequenceId = 0x16D; - _s20_currGroceryStoreGuySequenceId = 377; - _s20_nextGroceryStoreGuySequenceId = -1; - _s20_nextStonerGuySequenceId = -1; - _vm->gnapWalkTo(4, 8, -1, 0x107BB, 1); - break; - case 0x17C: - _vm->_gameSys->setAnimation(0, 0, 3); - _s20_nextStonerGuySequenceId = 0x171; - break; - case 0x17A: - _vm->_gameSys->setAnimation(0, 0, 3); - _s20_nextStonerGuySequenceId = 0x16F; - break; - case 0x175: - _vm->_gameSys->setAnimation(0x175, 20, 0); - _vm->_gameSys->setAnimation(0x175, 20, 3); - _vm->_gameSys->insertSequence(0x175, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _s20_currGroceryStoreGuySequenceId = 0x175; - _s20_nextGroceryStoreGuySequenceId = -1; - _vm->_gnapActionStatus = kASActionDone; - break; - default: - if (_s20_nextGroceryStoreGuySequenceId != -1) { - _vm->_gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); - _vm->_gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _s20_currGroceryStoreGuySequenceId = _s20_nextGroceryStoreGuySequenceId; - _s20_nextGroceryStoreGuySequenceId = -1; - } - break; - } - } - - updateAnimationsCb(); -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene20.h b/engines/gnap/scenes/scene20.h deleted file mode 100644 index 7496c87892..0000000000 --- a/engines/gnap/scenes/scene20.h +++ /dev/null @@ -1,57 +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_SCENE20_H -#define GNAP_SCENE20_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene20: public Scene { -public: - Scene20(GnapEngine *vm); - ~Scene20() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb(); - -private: - int _s20_currStonerGuySequenceId; - int _s20_nextStonerGuySequenceId; - int _s20_currGroceryStoreGuySequenceId; - int _s20_nextGroceryStoreGuySequenceId; - int _s20_stonerGuyCtr; - int _s20_groceryStoreGuyCtr; - bool _s20_stonerGuyShowingJoint; - - void stopSounds(); -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE20_H diff --git a/engines/gnap/scenes/scene21.cpp b/engines/gnap/scenes/scene21.cpp deleted file mode 100644 index 0e88537014..0000000000 --- a/engines/gnap/scenes/scene21.cpp +++ /dev/null @@ -1,344 +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/scene21.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSBanana = 1, - kHSOldLady = 2, - kHSDevice = 3, - kHSExitOutsideGrubCity = 4, - kHSWalkArea1 = 5, - kHSWalkArea2 = 6 -}; - -enum { - kASTalkOldLady = 0, - kASGrabBanana = 1, - kASGrabBananaDone = 2, - kASGrabOldLady = 3, - kASUseHatWithOldLady = 4, - kASUseHatWithOldLadyDone = 5, - kASLeaveScene = 6 -}; - -Scene21::Scene21(GnapEngine *vm) : Scene(vm) { - _s21_currOldLadySequenceId = -1; - _s21_nextOldLadySequenceId = -1; -} - -int Scene21::init() { - _vm->_gameSys->setAnimation(0, 0, 3); - return _vm->isFlag(kGFTwigTaken) ? 0x94 : 0x93; -} - -void Scene21::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSBanana, 94, 394, 146, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 2, 6); - _vm->setHotspot(kHSOldLady, 402, 220, 528, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); - _vm->setHotspot(kHSExitOutsideGrubCity, 522, 498, 800, 600, SF_EXIT_SE_CURSOR | SF_WALKABLE, 5, 10); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 440); - _vm->setHotspot(kHSWalkArea2, 698, 0, 800, 600); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (_vm->isFlag(kGFUnk04) || !_vm->isFlag(kGFTwigTaken)) - _vm->_hotspots[kHSBanana]._flags = SF_WALKABLE | SF_DISABLED; - if (_vm->isFlag(kGFTwigTaken)) - _vm->_hotspots[kHSOldLady]._flags = SF_DISABLED; - _vm->_hotspotsCount = 7; -} - -void Scene21::run() { - _vm->playSound(0x10940, true); - _vm->startSoundTimerA(6); - - _vm->_timers[5] = _vm->getRandom(100) + 100; - - _vm->queueInsertDeviceIcon(); - - if (_vm->isFlag(kGFTwigTaken)) { - if (_vm->isFlag(kGFKeysTaken)) { - _vm->initGnapPos(5, 8, kDirBottomRight); - _vm->initPlatypusPos(6, 8, kDirNone); - _vm->_gameSys->insertSequence(0x8E, 2, 0, 0, kSeqNone, 0, 0, 0); - if (!_vm->isFlag(kGFUnk04)) - _vm->_gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); - _vm->endSceneInit(); - _vm->clearFlag(kGFKeysTaken); - } else { - _vm->initGnapPos(5, 11, kDirBottomRight); - _vm->initPlatypusPos(6, 11, kDirNone); - if (!_vm->isFlag(kGFUnk04)) - _vm->_gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); - _vm->endSceneInit(); - _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); - } - } else { - _vm->initGnapPos(5, 11, kDirBottomRight); - _vm->initPlatypusPos(6, 11, kDirNone); - _s21_currOldLadySequenceId = 0x89; - _vm->_gameSys->setAnimation(0x89, 79, 3); - _vm->_gameSys->insertSequence(_s21_currOldLadySequenceId, 79, 0, 0, kSeqNone, 0, 0, 0); - _s21_nextOldLadySequenceId = -1; - _vm->_timers[4] = _vm->getRandom(30) + 50; - _vm->endSceneInit(); - _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSBanana: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 5); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(2, 5); - break; - case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHSBanana].x, _vm->_hotspotsWalkPos[kHSBanana].y) | 0x10000, 1); - _vm->playGnapPullOutDevice(2, 5); - _vm->playGnapUseDevice(0, 0); - _vm->_gnapActionStatus = kASGrabBanana; - break; - case TALK_CURSOR: - case PLAT_CURSOR: - break; - } - } - } - break; - - case kHSOldLady: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemGroceryStoreHat) { - _vm->_newSceneNum = 47; - _vm->gnapWalkTo(4, 6, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASUseHatWithOldLady; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(4, 6, 7, 4); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(7, 4); - break; - case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(7, 6, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASGrabOldLady; - _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSOldLady].x, _vm->_hotspotsWalkPos[kHSOldLady].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkOldLady; - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitOutsideGrubCity: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 20; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].y, 0, 0x107B3, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].y, -1, 0x107C2, 1); - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x10940)) - _vm->playSound(0x10940, true); - - if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); - if (!_vm->isFlag(kGFTwigTaken) && !_vm->_timers[4] && _s21_nextOldLadySequenceId == -1 && _vm->_gnapActionStatus == -1) { - _vm->_timers[4] = _vm->getRandom(30) + 50; - switch (_vm->getRandom(5)) { - case 0: - _s21_nextOldLadySequenceId = 0x88; - break; - case 1: - _s21_nextOldLadySequenceId = 0x8A; - break; - default: - _s21_nextOldLadySequenceId = 0x89; - break; - } - } - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(100) + 100; - _vm->_gameSys->insertSequence(0x92, 255, 0, 0, kSeqNone, 0, 0, 0); - } - _vm->playSoundA(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene21::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASTalkOldLady: - _s21_nextOldLadySequenceId = 0x8B; - _vm->_gnapActionStatus = -1; - break; - case kASGrabBanana: - _vm->_gameSys->setAnimation(0x8C, 59, 0); - _vm->_gameSys->insertSequence(0x8C, 59, 141, 59, kSeqSyncWait, 0, 0, 0); - _vm->setFlag(kGFUnk04); - _vm->invAdd(kItemBanana); - updateHotspots(); - _vm->_gnapActionStatus = kASGrabBananaDone; - break; - case kASGrabBananaDone: - _vm->setGrabCursorSprite(kItemBanana); - _vm->_gnapActionStatus = -1; - break; - case kASGrabOldLady: - _vm->_timers[4] = _vm->getRandom(30) + 50; - _s21_nextOldLadySequenceId = 0x87; - break; - case kASUseHatWithOldLady: - _vm->_gameSys->setAnimation(0x8F, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x8F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x8F; - _vm->_gnapActionStatus = kASUseHatWithOldLadyDone; - _vm->invAdd(kItemTickets); - _vm->invRemove(kItemGroceryStoreHat); - _vm->setGrabCursorSprite(-1); - break; - case kASUseHatWithOldLadyDone: - _s21_nextOldLadySequenceId = 0x91; - break; - case kASLeaveScene: - _vm->_sceneDone = true; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s21_nextOldLadySequenceId != -1) { - if (_s21_nextOldLadySequenceId == 0x87) { - _vm->_gameSys->setAnimation(_s21_nextOldLadySequenceId, 79, 3); - _vm->_gameSys->insertSequence(_s21_nextOldLadySequenceId, 79, _s21_currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x86, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x86; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = -1; - _s21_currOldLadySequenceId = _s21_nextOldLadySequenceId; - _s21_nextOldLadySequenceId = -1; - } else if (_s21_nextOldLadySequenceId == 0x91) { - _vm->_gameSys->setAnimation(0x91, 79, 0); - _vm->_gameSys->insertSequence(_s21_nextOldLadySequenceId, 79, _s21_currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = kASLeaveScene; - _s21_currOldLadySequenceId = _s21_nextOldLadySequenceId; - _s21_nextOldLadySequenceId = -1; - } else { - _vm->_gameSys->setAnimation(_s21_nextOldLadySequenceId, 79, 3); - _vm->_gameSys->insertSequence(_s21_nextOldLadySequenceId, 79, _s21_currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); - _s21_currOldLadySequenceId = _s21_nextOldLadySequenceId; - _s21_nextOldLadySequenceId = -1; - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene21.h b/engines/gnap/scenes/scene21.h deleted file mode 100644 index ea83e69a1e..0000000000 --- a/engines/gnap/scenes/scene21.h +++ /dev/null @@ -1,50 +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_SCENE21_H -#define GNAP_SCENE21_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene21: public Scene { -public: - Scene21(GnapEngine *vm); - ~Scene21() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s21_currOldLadySequenceId; - int _s21_nextOldLadySequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE21_H diff --git a/engines/gnap/scenes/scene22.cpp b/engines/gnap/scenes/scene22.cpp deleted file mode 100644 index 494af92b85..0000000000 --- a/engines/gnap/scenes/scene22.cpp +++ /dev/null @@ -1,292 +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/scene22.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitOutsideGrubCity = 1, - kHSExitBackGrubCity = 2, - kHSCashier = 3, - kHSDevice = 4, - kHSWalkArea1 = 5, - kHSWalkArea2 = 6 -}; - -enum { - kASLeaveScene = 0, - kASTalkCashier = 1 -}; - -Scene22::Scene22(GnapEngine *vm) : Scene(vm) { - _s22_caughtBefore = false; - _s22_cashierCtr = 3; -} - -int Scene22::init() { - return 0x5E; -} - -void Scene22::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitOutsideGrubCity, 0, 180, 184, 472, SF_EXIT_L_CURSOR, 3, 6); - _vm->setHotspot(kHSExitBackGrubCity, 785, 405, 800, 585, SF_EXIT_R_CURSOR, 11, 9); - _vm->setHotspot(kHSCashier, 578, 230, 660, 376, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); - _vm->setHotspot(kHSWalkArea1, 553, 0, 800, 542); - _vm->setHotspot(kHSWalkArea2, 0, 0, 552, 488); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 7; -} - -void Scene22::run() { - _vm->_gameSys->insertSequence(0x5D, 254, 0, 0, kSeqNone, 0, 0, 0); - - _s22_currCashierSequenceId = 0x59; - _s22_nextCashierSequenceId = -1; - - _vm->_gameSys->setAnimation(0x59, 1, 3); - _vm->_gameSys->insertSequence(_s22_currCashierSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - - _vm->_timers[6] = _vm->getRandom(30) + 20; - - _vm->queueInsertDeviceIcon(); - - if (_vm->_prevSceneNum == 20) { - _vm->initGnapPos(2, 8, kDirBottomRight); - _vm->initPlatypusPos(1, 8, kDirNone); - _vm->endSceneInit(); - } else { - _vm->initGnapPos(11, _vm->_hotspotsWalkPos[kHSExitBackGrubCity].y, kDirBottomRight); - _vm->initPlatypusPos(11, _vm->_hotspotsWalkPos[kHSExitBackGrubCity].y + 1, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(8, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(9, 8, -1, 0x107C2, 1); - } - - if (_vm->isFlag(kGFSceneFlag1)) { - int storeDetectiveSeqId; - _vm->setGrabCursorSprite(-1); - _vm->invRemove(kItemCereals); - if (_s22_caughtBefore) { - switch (_vm->getRandom(3)) { - case 0: - storeDetectiveSeqId = 0x55; - break; - case 1: - storeDetectiveSeqId = 0x56; - break; - default: - storeDetectiveSeqId = 0x57; - break; - } - } else { - _s22_caughtBefore = true; - storeDetectiveSeqId = 0x54; - } - _vm->_gameSys->waitForUpdate(); - _vm->_gameSys->requestClear1(); - _vm->_gameSys->drawSpriteToBackground(0, 0, 0x44); - _vm->_gameSys->setAnimation(storeDetectiveSeqId, 256, 4); - _vm->_gameSys->insertSequence(storeDetectiveSeqId, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(4) != 2) { - _vm->gameUpdateTick(); - } - _vm->_sceneDone = true; - _vm->_newSceneNum = 20; - _s22_caughtBefore = true; - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 0, -1, -1, -1, -1); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitOutsideGrubCity: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 20; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].y + 1, -1, 0x107C2, 1); - } - break; - - case kHSExitBackGrubCity: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 23; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitBackGrubCity].x, _vm->_hotspotsWalkPos[kHSExitBackGrubCity].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitBackGrubCity].x, _vm->_hotspotsWalkPos[kHSExitBackGrubCity].y + 1, -1, 0x107C2, 1); - } - break; - - case kHSCashier: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSCashier].x, _vm->_hotspotsWalkPos[kHSCashier].y, 8, 4); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(8, 4); - break; - case GRAB_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSCashier].x, _vm->_hotspotsWalkPos[kHSCashier].y, - 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkCashier; - break; - case PLAT_CURSOR: - _vm->gnapUseDeviceOnPlatypuss(); - break; - } - } - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[6] && _s22_nextCashierSequenceId == -1) { - _vm->_timers[6] = _vm->getRandom(30) + 20; - if (_vm->getRandom(8) != 0) { - _s22_nextCashierSequenceId = 0x59; - } else { - _s22_cashierCtr = (_s22_cashierCtr + 1) % 3; - switch (_s22_cashierCtr) { - case 1: - _s22_nextCashierSequenceId = 0x58; - break; - case 2: - _s22_nextCashierSequenceId = 0x5A; - break; - case 3: - _s22_nextCashierSequenceId = 0x5B; - break; - default: - _s22_nextCashierSequenceId = 0x58; - break; - } - } - } - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - _vm->_timers[2] = _vm->getRandom(30) + 20; - _vm->_timers[3] = 400; - _vm->_timers[1] = _vm->getRandom(20) + 30; - _vm->_timers[0] = _vm->getRandom(75) + 75; - } - - _vm->gameUpdateTick(); - } -} - -void Scene22::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASLeaveScene: - _vm->_sceneDone = true; - break; - case kASTalkCashier: - _s22_nextCashierSequenceId = 0x5C; - break; - } - _vm->_gnapActionStatus = -1; - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s22_nextCashierSequenceId != -1) { - _vm->_gameSys->setAnimation(_s22_nextCashierSequenceId, 1, 3); - _vm->_gameSys->insertSequence(_s22_nextCashierSequenceId, 1, _s22_currCashierSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _s22_currCashierSequenceId = _s22_nextCashierSequenceId; - _s22_nextCashierSequenceId = -1; - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene22.h b/engines/gnap/scenes/scene22.h deleted file mode 100644 index 44afa10da7..0000000000 --- a/engines/gnap/scenes/scene22.h +++ /dev/null @@ -1,52 +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_SCENE22_H -#define GNAP_SCENE22_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene22: public Scene { -public: - Scene22(GnapEngine *vm); - ~Scene22() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s22_currCashierSequenceId; - int _s22_nextCashierSequenceId; - bool _s22_caughtBefore; - int _s22_cashierCtr; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE22_H diff --git a/engines/gnap/scenes/scene23.cpp b/engines/gnap/scenes/scene23.cpp deleted file mode 100644 index 75838f4482..0000000000 --- a/engines/gnap/scenes/scene23.cpp +++ /dev/null @@ -1,295 +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/scene23.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitFrontGrubCity = 1, - kHSDevice = 2, - kHSCereals = 3, - kHSWalkArea1 = 4, - kHSWalkArea2 = 5 -}; - -enum { - kASLookCereals = 0, - kASGrabCereals = 1, - kASGrabCerealsDone = 2, - kASLeaveScene = 3 -}; - -Scene23::Scene23(GnapEngine *vm) : Scene(vm) { - _s23_currStoreClerkSequenceId = -1; - _s23_nextStoreClerkSequenceId = -1; -} - -int Scene23::init() { - return 0xC0; -} - -void Scene23::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitFrontGrubCity, 0, 250, 15, 550, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 7); - _vm->setHotspot(kHSCereals, 366, 332, 414, 408, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); - _vm->setHotspot(kHSWalkArea1, 0, 0, 340, 460); - _vm->setHotspot(kHSWalkArea2, 340, 0, 800, 501); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 6; -} - -void Scene23::run() { - _vm->_timers[4] = _vm->getRandom(100) + 200; - _vm->_timers[5] = _vm->getRandom(100) + 200; - - _s23_currStoreClerkSequenceId = 0xB4; - _s23_nextStoreClerkSequenceId = -1; - - _vm->_gameSys->setAnimation(0xB4, 1, 4); - _vm->_gameSys->insertSequence(_s23_currStoreClerkSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - - _vm->queueInsertDeviceIcon(); - - _vm->initGnapPos(-1, 7, kDirBottomRight); - _vm->initPlatypusPos(-2, 7, kDirNone); - _vm->_gameSys->insertSequence(0xBD, 255, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0xBF, 2, 0, 0, kSeqNone, 0, 0, 0); - _vm->endSceneInit(); - - _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); - - if (_vm->isFlag(kGFUnk24)) { - _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); - } else { - _vm->gnapWalkTo(2, 7, 0, 0x107B9, 1); - while (_vm->_gameSys->getAnimationStatus(0) != 2) - _vm->gameUpdateTick(); - _vm->playSequences(0x48, 0xBA, 0xBB, 0xBC); - _vm->setFlag(kGFUnk24); - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 3, -1, -1, -1, -1); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSCereals: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSCereals].x, _vm->_hotspotsWalkPos[kHSCereals].y, 5, 4); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - if (_vm->isFlag(kGFSceneFlag1)) - _vm->playGnapMoan2(0, 0); - else { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSCereals].x, _vm->_hotspotsWalkPos[kHSCereals].y, - 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASLookCereals; - } - break; - case GRAB_CURSOR: - if (_vm->isFlag(kGFSceneFlag1)) - _vm->playGnapImpossible(0, 0); - else { - _vm->_gnapIdleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSCereals].x, _vm->_hotspotsWalkPos[kHSCereals].y, - 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->setFlag(kGFSceneFlag1); - _vm->_gnapActionStatus = kASGrabCereals; - _vm->invAdd(kItemCereals); - } - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitFrontGrubCity: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 22; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitFrontGrubCity].x, _vm->_hotspotsWalkPos[kHSExitFrontGrubCity].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitFrontGrubCity].x, _vm->_hotspotsWalkPos[kHSExitFrontGrubCity].y - 1, -1, 0x107C2, 1); - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4] && _vm->_gnapActionStatus == -1) { - _vm->_timers[4] = _vm->getRandom(100) + 200; - switch (_vm->getRandom(4)) { - case 0: - _vm->_gameSys->insertSequence(0xB7, 256, 0, 0, kSeqNone, 0, 0, 0); - break; - case 1: - _vm->_gameSys->insertSequence(0xB8, 256, 0, 0, kSeqNone, 0, 0, 0); - break; - case 2: - case 3: - _vm->_gameSys->insertSequence(0xB9, 256, 0, 0, kSeqNone, 0, 0, 0); - break; - } - } - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(100) + 200; - switch (_vm->getRandom(3)) { - case 0: - _vm->playSound(0xCE, false); - break; - case 1: - _vm->playSound(0xD0, false); - break; - case 2: - _vm->playSound(0xCF, false); - break; - } - } - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene23::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASLookCereals: - _vm->showFullScreenSprite(0x48); - _vm->_gnapActionStatus = -1; - break; - case kASGrabCereals: - _vm->_gameSys->setAnimation(0xBE, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0xBE, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->requestRemoveSequence(0xBF, 2); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0xBE; - _vm->_gnapActionStatus = kASGrabCerealsDone; - break; - case kASGrabCerealsDone: - _vm->setGrabCursorSprite(kItemCereals); - _vm->_gnapActionStatus = -1; - break; - case kASLeaveScene: - _vm->_sceneDone = true; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(4) == 2 && _s23_nextStoreClerkSequenceId == -1) { - switch (_vm->getRandom(8)) { - case 0: - case 1: - case 2: - _s23_nextStoreClerkSequenceId = 0xB4; - break; - case 3: - case 4: - case 5: - _s23_nextStoreClerkSequenceId = 0xB5; - break; - default: - _s23_nextStoreClerkSequenceId = 0xB6; - break; - } - _vm->_gameSys->setAnimation(_s23_nextStoreClerkSequenceId, 1, 4); - _vm->_gameSys->insertSequence(_s23_nextStoreClerkSequenceId, 1, _s23_currStoreClerkSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _s23_currStoreClerkSequenceId = _s23_nextStoreClerkSequenceId; - _s23_nextStoreClerkSequenceId = -1; - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene23.h b/engines/gnap/scenes/scene23.h deleted file mode 100644 index 73543c9997..0000000000 --- a/engines/gnap/scenes/scene23.h +++ /dev/null @@ -1,50 +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_SCENE23_H -#define GNAP_SCENE23_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene23: public Scene { -public: - Scene23(GnapEngine *vm); - ~Scene23() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s23_currStoreClerkSequenceId; - int _s23_nextStoreClerkSequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE23_H diff --git a/engines/gnap/scenes/scene24.cpp b/engines/gnap/scenes/scene24.cpp deleted file mode 100644 index d7959d0843..0000000000 --- a/engines/gnap/scenes/scene24.cpp +++ /dev/null @@ -1,262 +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/scene24.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitCircusWorld = 1, - kHSExitOutsideGrubCity = 2, - kHSDevice = 3, - kHSWalkArea1 = 4, - kHSWalkArea2 = 5, - kHSWalkArea3 = 6 -}; - -enum { - kASLeaveScene = 0 -}; - -Scene24::Scene24(GnapEngine *vm) : Scene(vm) { - _s24_currWomanSequenceId = -1; - _s24_nextWomanSequenceId = -1; - _s24_boySequenceId = -1; - _s24_girlSequenceId = -1; -} - -int Scene24::init() { - return 0x3B; -} - -void Scene24::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitCircusWorld, 785, 128, 800, 600, SF_EXIT_R_CURSOR, 8, 7); - _vm->setHotspot(kHSExitOutsideGrubCity, 0, 213, 91, 600, SF_EXIT_NW_CURSOR, 1, 8); - _vm->setHotspot(kHSWalkArea1, 0, 0, 0, 0); - _vm->setHotspot(kHSWalkArea2, 530, 0, 800, 600); - _vm->setHotspot(kHSWalkArea3, 0, 0, 800, 517); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 7; -} - -void Scene24::run() { - int counter = 0; - - _vm->playSound(0x10940, true); - _vm->startSoundTimerA(9); - - _vm->_timers[7] = _vm->getRandom(100) + 100; - - _vm->_gameSys->insertSequence(0x2F, 256, 0, 0, kSeqNone, 0, 0, 0); - - _vm->_timers[4] = _vm->getRandom(20) + 50; - _vm->_timers[5] = _vm->getRandom(20) + 40; - _vm->_timers[6] = _vm->getRandom(50) + 30; - - _vm->_gameSys->insertSequence(0x36, 20, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x30, 20, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x35, 20, 0, 0, kSeqNone, 0, 0, 0); - - _s24_currWomanSequenceId = 0x35; - _s24_girlSequenceId = 0x36; - _s24_boySequenceId = 0x30; - - if (_vm->_debugLevel == 4) - _vm->startIdleTimer(8); - - _vm->queueInsertDeviceIcon(); - - if (_vm->_prevSceneNum == 20) { - _vm->initGnapPos(1, 8, kDirBottomRight); - _vm->initPlatypusPos(2, 8, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(1, 9, -1, 0x107B9, 1); - _vm->platypusWalkTo(2, 9, -1, 0x107C2, 1); - } else { - _vm->initGnapPos(8, 8, kDirBottomLeft); - _vm->initPlatypusPos(8, 8, kDirUnk4); - _vm->endSceneInit(); - _vm->gnapWalkTo(2, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(3, 8, -1, 0x107C2, 1); - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 0, -1, -1, -1, -1); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitCircusWorld: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 25; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitCircusWorld].x, _vm->_hotspotsWalkPos[kHSExitCircusWorld].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHSExitCircusWorld].y, -1, 0x107C2, 1); - } - break; - - case kHSExitOutsideGrubCity: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 20; - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].y, -1, 0x107C2, 1); - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - case kHSWalkArea3: - if (_vm->_gnapActionStatus == -1) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x10940)) - _vm->playSound(0x10940, true); - - if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(20) + 50; - _vm->_gameSys->insertSequence(0x37, 20, _s24_girlSequenceId, 20, kSeqSyncWait, 0, 0, 0); - _s24_girlSequenceId = 0x37; - } - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(20) + 40; - _vm->_gameSys->insertSequence(0x31, 20, _s24_boySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _s24_boySequenceId = 0x31; - } - if (!_vm->_timers[6]) { - _vm->_timers[6] = _vm->getRandom(50) + 30; - counter = (counter + 1) % 3; - switch (counter) { - case 0: - _s24_nextWomanSequenceId = 0x32; - break; - case 1: - _s24_nextWomanSequenceId = 0x33; - break; - case 2: - _s24_nextWomanSequenceId = 0x34; - break; - } - _vm->_gameSys->insertSequence(_s24_nextWomanSequenceId, 20, _s24_currWomanSequenceId, 20, kSeqSyncWait, 0, 0, 0); - _s24_currWomanSequenceId = _s24_nextWomanSequenceId; - } - if (!_vm->_timers[7]) { - _vm->_timers[7] = _vm->getRandom(100) + 100; - switch (_vm->getRandom(3)) { - case 0: - _vm->_gameSys->insertSequence(0x38, 253, 0, 0, kSeqNone, 0, 0, 0); - break; - case 1: - _vm->_gameSys->insertSequence(0x39, 253, 0, 0, kSeqNone, 0, 0, 0); - break; - case 2: - _vm->_gameSys->insertSequence(0x3A, 253, 0, 0, kSeqNone, 0, 0, 0); - break; - } - } - if (_vm->_debugLevel == 4) - _vm->updateIdleTimer(); - _vm->playSoundA(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - _vm->gameUpdateTick(); - } -} - -void Scene24::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - if (_vm->_gnapActionStatus == kASLeaveScene) - _vm->_sceneDone = true; - _vm->_gnapActionStatus = -1; - } - -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene24.h b/engines/gnap/scenes/scene24.h deleted file mode 100644 index ea6d694d17..0000000000 --- a/engines/gnap/scenes/scene24.h +++ /dev/null @@ -1,52 +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_SCENE24_H -#define GNAP_SCENE24_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene24: public Scene { -public: - Scene24(GnapEngine *vm); - ~Scene24() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s24_currWomanSequenceId; - int _s24_nextWomanSequenceId; - int _s24_boySequenceId; - int _s24_girlSequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE24_H diff --git a/engines/gnap/scenes/scene25.cpp b/engines/gnap/scenes/scene25.cpp deleted file mode 100644 index 4731f72dab..0000000000 --- a/engines/gnap/scenes/scene25.cpp +++ /dev/null @@ -1,397 +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/scene25.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSTicketVendor = 1, - kHSExitOutsideCircusWorld = 2, - kHSExitInsideCircusWorld = 3, - kHSDevice = 4, - kHSPosters1 = 5, - kHSPosters2 = 6, - kHSPosters3 = 7, - kHSPosters4 = 8, - kHSWalkArea1 = 9, - kHSWalkArea2 = 10 -}; - -enum { - kASTalkTicketVendor = 0, - kASEnterCircusWihoutTicket = 1, - kASShowTicketToVendor = 2, - kASShowTicketToVendorDone = 3, - kASEnterCircusWihoutTicketDone = 4, - kASLeaveScene = 5 -}; - -Scene25::Scene25(GnapEngine *vm) : Scene(vm) { - _s25_currTicketVendorSequenceId = -1; - _s25_nextTicketVendorSequenceId = -1; -} - -int Scene25::init() { - return 0x62; -} - -void Scene25::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSTicketVendor, 416, 94, 574, 324, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 5); - _vm->setHotspot(kHSExitOutsideCircusWorld, 0, 519, 205, 600, SF_EXIT_SW_CURSOR, 5, 10); - _vm->setHotspot(kHSExitInsideCircusWorld, 321, 70, 388, 350, SF_EXIT_NE_CURSOR, 3, 6); - _vm->setHotspot(kHSPosters1, 0, 170, 106, 326, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); - _vm->setHotspot(kHSPosters2, 146, 192, 254, 306, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); - _vm->setHotspot(kHSPosters3, 606, 162, 654, 368, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 7); - _vm->setHotspot(kHSPosters4, 708, 114, 754, 490, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 439); - _vm->setHotspot(kHSWalkArea2, 585, 0, 800, 600); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 11; -} - -void Scene25::playAnims(int index) { - if (index > 4) - return; - - _vm->hideCursor(); - _vm->setGrabCursorSprite(-1); - switch (index) { - case 1: - _vm->_largeSprite = _vm->_gameSys->createSurface(0x25); - break; - case 2: - _vm->_largeSprite = _vm->_gameSys->createSurface(0x26); - break; - case 3: - _vm->_largeSprite = _vm->_gameSys->createSurface(0x27); - break; - case 4: - _vm->_largeSprite = _vm->_gameSys->createSurface(0x28); - break; - } - _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); - _vm->delayTicksCursor(5); - while (!_vm->_mouseClickState._left && !_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) && !_vm->isKeyStatus1(Common::KEYCODE_SPACE) && - !_vm->isKeyStatus1(29)) { - _vm->gameUpdateTick(); - } - _vm->_mouseClickState._left = false; - _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); - _vm->clearKeyStatus1(29); - _vm->clearKeyStatus1(Common::KEYCODE_SPACE); - _vm->_gameSys->removeSpriteDrawItem(_vm->_largeSprite, 300); - _vm->delayTicksCursor(5); - _vm->deleteSurface(&_vm->_largeSprite); - _vm->showCursor(); -} - -void Scene25::run() { - _vm->playSound(0x10940, true); - _vm->startSoundTimerA(5); - - _s25_currTicketVendorSequenceId = 0x52; - _vm->_gameSys->setAnimation(0x52, 39, 3); - _vm->_gameSys->insertSequence(_s25_currTicketVendorSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); - - _s25_nextTicketVendorSequenceId = -1; - _vm->_timers[4] = _vm->getRandom(20) + 20; - - _vm->queueInsertDeviceIcon(); - - if (_vm->_prevSceneNum == 24) { - _vm->initGnapPos(5, 11, kDirUpLeft); - _vm->initPlatypusPos(6, 11, kDirUnk4); - _vm->endSceneInit(); - _vm->gnapWalkTo(5, 7, -1, 0x107BA, 1); - _vm->platypusWalkTo(6, 7, -1, 0x107C2, 1); - } else { - _vm->initGnapPos(5, 6, kDirBottomRight); - _vm->initPlatypusPos(6, 6, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSTicketVendor: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemTickets) { - _vm->_gnapActionStatus = kASShowTicketToVendor; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSTicketVendor].x, _vm->_hotspotsWalkPos[kHSTicketVendor].y, - 0, _vm->getGnapSequenceId(gskIdle, 9, 4) | 0x10000, 1); - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSTicketVendor].x, _vm->_hotspotsWalkPos[kHSTicketVendor].y, 6, 1); - _s25_nextTicketVendorSequenceId = 0x5B; - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(6, 1); - _s25_nextTicketVendorSequenceId = (_vm->getRandom(2) == 1) ? 0x59 : 0x56; - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSTicketVendor].x, _vm->_hotspotsWalkPos[kHSTicketVendor].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkTicketVendor; - break; - case GRAB_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitOutsideCircusWorld: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 24; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].x, _vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].y, 0, 0x107B4, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].y, -1, 0x107C2, 1); - } - break; - - case kHSExitInsideCircusWorld: - if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFNeedleTaken)) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 26; - _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitInsideCircusWorld].x, _vm->_hotspotsWalkPos[kHSExitInsideCircusWorld].y, 0, 0x107B1, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitInsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHSExitInsideCircusWorld].y, -1, 0x107C2, 1); - _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - } else { - _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(4, 5, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kASEnterCircusWihoutTicket; - _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - } - } - break; - - case kHSPosters1: - case kHSPosters2: - case kHSPosters3: - case kHSPosters4: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, -1, -1, 1); - if (_vm->_sceneClickedHotspot == 5 || _vm->_sceneClickedHotspot == 6) - _vm->_gnapIdleFacing = kDirUpLeft; - else if (_vm->_sceneClickedHotspot == 8) - _vm->_gnapIdleFacing = kDirBottomRight; - else - _vm->_gnapIdleFacing = kDirUpRight; - _vm->playGnapIdle(0, 0); - playAnims(8 - _vm->_sceneClickedHotspot + 1); - break; - case GRAB_CURSOR: - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapMoan2(0, 0); - break; - } - } - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4] && _s25_nextTicketVendorSequenceId == -1 && _vm->_gnapActionStatus == -1) { - _vm->_timers[4] = _vm->getRandom(20) + 20; - switch (_vm->getRandom(13)) { - case 0: - _s25_nextTicketVendorSequenceId = 0x54; - break; - case 1: - _s25_nextTicketVendorSequenceId = 0x58; - break; - case 2: - _s25_nextTicketVendorSequenceId = 0x55; - break; - case 3: - _s25_nextTicketVendorSequenceId = 0x5A; - break; - case 4: - case 5: - case 6: - case 7: - _s25_nextTicketVendorSequenceId = 0x5B; - break; - case 8: - case 9: - case 10: - case 11: - _s25_nextTicketVendorSequenceId = 0x5C; - break; - case 12: - _s25_nextTicketVendorSequenceId = 0x5D; - break; - default: - _s25_nextTicketVendorSequenceId = 0x52; - break; - } - } - _vm->playSoundA(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene25::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASTalkTicketVendor: - _s25_nextTicketVendorSequenceId = (_vm->getRandom(2) == 1) ? 0x57 : 0x5F; - _vm->_gnapActionStatus = -1; - break; - case kASEnterCircusWihoutTicket: - _s25_nextTicketVendorSequenceId = 0x5E; - _vm->_gameSys->setAnimation(0x5E, 39, 0); - _vm->_gameSys->setAnimation(_s25_nextTicketVendorSequenceId, 39, 3); - _vm->_gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x60, 2, 0, 0, kSeqNone, 0, 0, 0); - _s25_currTicketVendorSequenceId = _s25_nextTicketVendorSequenceId; - _s25_nextTicketVendorSequenceId = -1; - _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - _vm->playGnapIdle(0, 0); - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, -1, 0x107BB, 1); - _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = kASEnterCircusWihoutTicketDone; - break; - case kASEnterCircusWihoutTicketDone: - _vm->_gnapActionStatus = -1; - break; - case kASShowTicketToVendor: - _vm->setGrabCursorSprite(-1); - _vm->invRemove(kItemTickets); - _vm->setFlag(kGFNeedleTaken); - _vm->_gameSys->setAnimation(0x61, 40, 0); - _vm->_gameSys->insertSequence(0x61, 40, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapActionStatus = kASShowTicketToVendorDone; - break; - case kASShowTicketToVendorDone: - _s25_nextTicketVendorSequenceId = 0x53; - break; - case kASLeaveScene: - _vm->_sceneDone = true; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - if (_s25_nextTicketVendorSequenceId == 0x53) { - _vm->_gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _s25_currTicketVendorSequenceId = _s25_nextTicketVendorSequenceId; - _s25_nextTicketVendorSequenceId = -1; - _vm->_gnapActionStatus = -1; - } else if (_s25_nextTicketVendorSequenceId != -1) { - _vm->_gameSys->setAnimation(_s25_nextTicketVendorSequenceId, 39, 3); - _vm->_gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _s25_currTicketVendorSequenceId = _s25_nextTicketVendorSequenceId; - _s25_nextTicketVendorSequenceId = -1; - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene25.h b/engines/gnap/scenes/scene25.h deleted file mode 100644 index 72df792be7..0000000000 --- a/engines/gnap/scenes/scene25.h +++ /dev/null @@ -1,52 +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_SCENE25_H -#define GNAP_SCENE25_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene25: public Scene { -public: - Scene25(GnapEngine *vm); - ~Scene25() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s25_currTicketVendorSequenceId; - int _s25_nextTicketVendorSequenceId; - - void playAnims(int index); -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE25_H diff --git a/engines/gnap/scenes/scene26.cpp b/engines/gnap/scenes/scene26.cpp deleted file mode 100644 index a8075963da..0000000000 --- a/engines/gnap/scenes/scene26.cpp +++ /dev/null @@ -1,255 +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/scene26.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitOutsideCircusWorld = 1, - kHSExitOutsideClown = 2, - kHSExitArcade = 3, - kHSExitElephant = 4, - kHSExitBeerStand = 5, - kHSDevice = 6, - kHSWalkArea1 = 7, - kHSWalkArea2 = 8 -}; - -enum { - kASLeaveScene = 0 -}; - -Scene26::Scene26(GnapEngine *vm) : Scene(vm) { - _s26_currKidSequenceId = -1; - _s26_nextKidSequenceId = -1; -} - -int Scene26::init() { - return _vm->isFlag(kGFUnk23) ? 0x61 : 0x60; -} - -void Scene26::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitOutsideCircusWorld, 0, 590, 300, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 1, 10); - _vm->setHotspot(kHSExitOutsideClown, 200, 265, 265, 350, SF_EXIT_U_CURSOR, 3, 8); - _vm->setHotspot(kHSExitArcade, 0, 295, 150, 400, SF_EXIT_NW_CURSOR, 2, 8); - _vm->setHotspot(kHSExitElephant, 270, 290, 485, 375, SF_EXIT_U_CURSOR, 5, 8); - _vm->setHotspot(kHSExitBeerStand, 530, 290, 620, 350, SF_EXIT_NE_CURSOR, 5, 8); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 500); - _vm->setHotspot(kHSWalkArea2, 281, 0, 800, 600); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 9; -} - -void Scene26::run() { - _vm->startSoundTimerB(7); - _vm->playSound(0x1093B, true); - - _s26_currKidSequenceId = 0x5B; - _s26_nextKidSequenceId = -1; - _vm->_gameSys->setAnimation(0x5B, 160, 3); - _vm->_gameSys->insertSequence(_s26_currKidSequenceId, 160, 0, 0, kSeqNone, 0, 0, 0); - - _vm->_timers[5] = _vm->getRandom(20) + 50; - _vm->_timers[4] = _vm->getRandom(20) + 50; - _vm->_timers[6] = _vm->getRandom(50) + 100; - - _vm->queueInsertDeviceIcon(); - - _vm->_gameSys->insertSequence(0x58, 40, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x5C, 40, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x5D, 40, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x5E, 40, 0, 0, kSeqLoop, 0, 0, 0); - - if (_vm->_prevSceneNum == 25) { - _vm->initGnapPos(-1, 8, kDirBottomRight); - _vm->initPlatypusPos(-2, 8, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); - } else { - _vm->initGnapPos(2, 8, kDirBottomRight); - _vm->initPlatypusPos(3, 8, kDirNone); - _vm->endSceneInit(); - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitOutsideCircusWorld: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 25; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kASLeaveScene; - } - break; - - case kHSExitOutsideClown: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 27; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kASLeaveScene; - } - break; - - case kHSExitArcade: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 29; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitArcade].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kASLeaveScene; - } - break; - - case kHSExitElephant: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 30; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kASLeaveScene; - } - break; - - case kHSExitBeerStand: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 31; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitBeerStand].y, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x1093B)) - _vm->playSound(0x1093B, true); - - if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[5] && _s26_nextKidSequenceId == -1) { - _vm->_timers[5] = _vm->getRandom(20) + 50; - if (_vm->getRandom(5) != 0) - _s26_nextKidSequenceId = 0x5B; - else - _s26_nextKidSequenceId = 0x5A; - } - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(20) + 130; - _vm->_gameSys->insertSequence(0x59, 40, 0, 0, kSeqNone, 0, 0, 0); - } - if (!_vm->_timers[6]) { - _vm->_timers[6] = _vm->getRandom(50) + 100; - _vm->_gameSys->insertSequence(0x5F, 40, 0, 0, kSeqNone, 0, 0, 0); - } - _vm->playSoundB(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene26::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - if (_vm->_gnapActionStatus == kASLeaveScene) - _vm->_sceneDone = true; - _vm->_gnapActionStatus = -1; - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s26_nextKidSequenceId != -1) { - _vm->_gameSys->insertSequence(_s26_nextKidSequenceId, 160, _s26_currKidSequenceId, 160, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s26_nextKidSequenceId, 160, 3); - _s26_currKidSequenceId = _s26_nextKidSequenceId; - _s26_nextKidSequenceId = -1; - } - -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene26.h b/engines/gnap/scenes/scene26.h deleted file mode 100644 index a29b0d8469..0000000000 --- a/engines/gnap/scenes/scene26.h +++ /dev/null @@ -1,50 +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_SCENE26_H -#define GNAP_SCENE26_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene26: public Scene { -public: - Scene26(GnapEngine *vm); - ~Scene26() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s26_currKidSequenceId; - int _s26_nextKidSequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE26_H diff --git a/engines/gnap/scenes/scene27.cpp b/engines/gnap/scenes/scene27.cpp deleted file mode 100644 index c2c32983b4..0000000000 --- a/engines/gnap/scenes/scene27.cpp +++ /dev/null @@ -1,421 +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/scene27.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSJanitor = 1, - kHSDevice = 2, - kHSBucket = 3, - kHSExitCircus = 4, - kHSExitArcade = 5, - kHSExitBeerStand = 6, - kHSExitClown = 7, - kHSWalkArea1 = 8 -}; - -enum { - kASTalkJanitor = 0, - kASGrabBucket = 1, - kASGrabBucketDone = 2, - kASShowPictureToJanitor = 3, - kASTryEnterClownTent = 4, - kASTryEnterClownTentDone = 5, - kASEnterClownTent = 6, - kASLeaveScene = 7 -}; - -Scene27::Scene27(GnapEngine *vm) : Scene(vm) { - _s27_nextJanitorSequenceId = -1; - _s27_currJanitorSequenceId = -1; -} - -int Scene27::init() { - return 0xD5; -} - -void Scene27::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSJanitor, 488, 204, 664, 450, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 8, 8); - _vm->setHotspot(kHSBucket, 129, 406, 186, 453, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 6); - _vm->setHotspot(kHSExitCircus, 200, 585, 700, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - _vm->setHotspot(kHSExitArcade, 0, 0, 15, 600, SF_EXIT_L_CURSOR, 0, 6); - _vm->setHotspot(kHSExitBeerStand, 785, 0, 800, 600, SF_EXIT_R_CURSOR, 11, 7); - _vm->setHotspot(kHSExitClown, 340, 240, 460, 420, SF_EXIT_U_CURSOR, 6, 8); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 507); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (_vm->isFlag(kGFUnk13)) - _vm->_hotspots[kHSBucket]._flags = SF_DISABLED; - _vm->_hotspotsCount = 9; -} - -void Scene27::run() { - _vm->playSound(0x1093B, true); - _vm->startSoundTimerB(4); - _vm->_timers[7] = _vm->getRandom(100) + 300; - _vm->queueInsertDeviceIcon(); - - if (!_vm->isFlag(kGFUnk13)) - _vm->_gameSys->insertSequence(0xD3, 39, 0, 0, kSeqNone, 0, 0, 0); - - if (_vm->_debugLevel == 4) - _vm->startIdleTimer(6); - - _vm->_gameSys->insertSequence(0xCB, 39, 0, 0, kSeqNone, 0, 0, 0); - - _s27_currJanitorSequenceId = 0xCB; - _s27_nextJanitorSequenceId = -1; - - _vm->_gameSys->setAnimation(0xCB, 39, 3); - _vm->_timers[5] = _vm->getRandom(20) + 60; - - switch (_vm->_prevSceneNum) { - case 26: - _vm->initGnapPos(7, 12, kDirBottomRight); - _vm->initPlatypusPos(6, 12, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(7, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); - break; - case 29: - _vm->initGnapPos(-1, 8, kDirBottomRight); - _vm->initPlatypusPos(-1, 9, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(3, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(3, 9, -1, 0x107C2, 1); - break; - case 31: - _vm->initGnapPos(12, 8, kDirBottomLeft); - _vm->initPlatypusPos(12, 9, kDirUnk4); - _vm->endSceneInit(); - _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(8, 9, -1, 0x107C2, 1); - break; - default: - _vm->initGnapPos(6, 8, kDirBottomRight); - _vm->initPlatypusPos(5, 9, kDirNone); - _vm->endSceneInit(); - break; - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - _vm->_sceneClickedHotspot = -1; - if (_vm->_gnapActionStatus < 0) - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSJanitor: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemPicture) { - _vm->_gnapIdleFacing = kDirUpLeft; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSJanitor].x, _vm->_hotspotsWalkPos[kHSJanitor].y, 0, 0x107BC, 1)) - _vm->_gnapActionStatus = kASShowPictureToJanitor; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSJanitor].x, _vm->_hotspotsWalkPos[kHSJanitor].y, 7, 3); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(6, 3); - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSJanitor].x, _vm->_hotspotsWalkPos[kHSJanitor].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkJanitor; - break; - case GRAB_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSBucket: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 3, 3); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(3, 3); - break; - case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHSBucket].x, _vm->_hotspotsWalkPos[kHSBucket].y) | 0x10000, 1); - _vm->_gnapActionStatus = kASGrabBucket; - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitCircus: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 26; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitCircus].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitCircus].x + 1, _vm->_hotspotsWalkPos[kHSExitCircus].y, -1, 0x107C7, 1); - } - break; - - case kHSExitArcade: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 29; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitArcade].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitArcade].x, _vm->_hotspotsWalkPos[kHSExitArcade].y + 1, -1, 0x107CF, 1); - } - break; - - case kHSExitBeerStand: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 31; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitBeerStand].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitBeerStand].x, _vm->_hotspotsWalkPos[kHSExitBeerStand].y + 1, -1, 0x107CD, 1); - } - break; - - case kHSExitClown: - if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFPlatypus)) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 28; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitClown].x, _vm->_hotspotsWalkPos[kHSExitClown].y, 0, 0x107AD, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitClown].x + 1, _vm->_hotspotsWalkPos[kHSExitClown].y, -1, 0x107C4, 1); - } else { - _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitClown].x, 7, 0, 0x107BC, 1); - _vm->_hotspots[kHSWalkArea1]._flags &= SF_WALKABLE; - _vm->_gnapActionStatus = kASTryEnterClownTent; - } - } - break; - - case kHSWalkArea1: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x1093B)) - _vm->playSound(0x1093B, true); - - if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) - _vm->updateGnapIdleSequence(); - if (_vm->_debugLevel == 4) - _vm->updateIdleTimer(); - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(20) + 60; - if (_vm->_gnapActionStatus < 0) { - if (_vm->getRandom(3) != 0) - _s27_nextJanitorSequenceId = 0xCB; - else - _s27_nextJanitorSequenceId = 0xCF; - } - } - if (!_vm->_timers[7]) { - _vm->_timers[7] = _vm->getRandom(100) + 300; - if (_vm->_gnapActionStatus < 0) - _vm->_gameSys->insertSequence(0xD4, 120, 0, 0, kSeqNone, 0, 0, 0); - } - _vm->playSoundB(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene27::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASTalkJanitor: - switch (_vm->getRandom(3)) { - case 0: - _s27_nextJanitorSequenceId = 0xCC; - break; - case 1: - _s27_nextJanitorSequenceId = 0xCD; - break; - case 2: - _s27_nextJanitorSequenceId = 0xCE; - break; - } - break; - case kASGrabBucket: - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); - _vm->_hotspots[kHSBucket]._flags = SF_DISABLED; - _vm->invAdd(kItemEmptyBucket); - _vm->setFlag(kGFUnk13); - _vm->_gameSys->setAnimation(0xD2, 39, 0); - _vm->_gameSys->insertSequence(0xD2, 39, 211, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = kASGrabBucketDone; - break; - case kASGrabBucketDone: - _vm->setGrabCursorSprite(kItemEmptyBucket); - _vm->_gnapActionStatus = -1; - break; - case kASShowPictureToJanitor: - _s27_nextJanitorSequenceId = 0xD0; - break; - case kASTryEnterClownTent: - _s27_nextJanitorSequenceId = 0xD1; - _vm->_gameSys->insertSequence(0xD1, 39, _s27_currJanitorSequenceId, 39, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 3); - _vm->_gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 0); - _s27_currJanitorSequenceId = _s27_nextJanitorSequenceId; - _s27_nextJanitorSequenceId = -1; - _vm->_gnapActionStatus = kASTryEnterClownTentDone; - break; - case kASTryEnterClownTentDone: - _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[7].x, 9, -1, 0x107BC, 1); - _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = -1; - break; - case kASEnterClownTent: - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107B2, 1); - _vm->_gnapActionStatus = kASLeaveScene; - break; - case kASLeaveScene: - _vm->_sceneDone = true; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - switch (_s27_nextJanitorSequenceId) { - case -1: - _s27_nextJanitorSequenceId = 0xCB; - _vm->_gameSys->insertSequence(0xCB, 39, _s27_currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 3); - _s27_currJanitorSequenceId = _s27_nextJanitorSequenceId; - _s27_nextJanitorSequenceId = -1; - break; - case 0xCC: - case 0xCD: - case 0xCE: - _vm->_gnapActionStatus = -1; - _vm->_gameSys->insertSequence(_s27_nextJanitorSequenceId, 39, _s27_currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 3); - _vm->_gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 0); - _s27_currJanitorSequenceId = _s27_nextJanitorSequenceId; - _s27_nextJanitorSequenceId = -1; - break; - case 0xD0: - // Show picture to janitor - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->insertSequence(_s27_nextJanitorSequenceId, 39, _s27_currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 0); - _vm->_gnapActionStatus = kASEnterClownTent; - _s27_currJanitorSequenceId = _s27_nextJanitorSequenceId; - _s27_nextJanitorSequenceId = -1; - _vm->setFlag(kGFPlatypus); - _vm->setGrabCursorSprite(-1); - _vm->invRemove(kItemPicture); - _vm->_newSceneNum = 28; - break; - default: - _vm->_gameSys->insertSequence(_s27_nextJanitorSequenceId, 39, _s27_currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 3); - _s27_currJanitorSequenceId = _s27_nextJanitorSequenceId; - _s27_nextJanitorSequenceId = -1; - break; - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene27.h b/engines/gnap/scenes/scene27.h deleted file mode 100644 index 9ee00538bc..0000000000 --- a/engines/gnap/scenes/scene27.h +++ /dev/null @@ -1,50 +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_SCENE27_H -#define GNAP_SCENE27_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene27: public Scene { -public: - Scene27(GnapEngine *vm); - ~Scene27() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s27_nextJanitorSequenceId; - int _s27_currJanitorSequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE27_H diff --git a/engines/gnap/scenes/scene28.cpp b/engines/gnap/scenes/scene28.cpp deleted file mode 100644 index ac55d90f01..0000000000 --- a/engines/gnap/scenes/scene28.cpp +++ /dev/null @@ -1,448 +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/scene28.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSHorn = 1, - kHSClown = 2, - kHSExitOutsideClown = 3, - kHSEmptyBucket = 4, - kHSDevice = 5, - kHSWalkArea1 = 6, - kHSWalkArea2 = 7 -}; - -enum { - kASUseBeerBucketWithClown = 0, - kASUsePillBucketWithClown = 1, - kASGrabHornFails = 2, - kASGrabEmptyBucket = 3, - kASGrabHornSuccess = 4, - kASGrabHornSuccessDone = 5, - kASGrabEmptyBucketDone = 6, - kASGrabHornFailsDone = 7, - kASTalkClown = 8, - kASGnapWaiting = 9, - kASLeaveScene = 10 -}; - -Scene28::Scene28(GnapEngine *vm) : Scene(vm) { - _s28_currClownSequenceId = -1; - _s28_nextClownSequenceId = -1; - _s28_clownTalkCtr = 0; -} - -int Scene28::init() { - return 0x125; -} - -void Scene28::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSHorn, 148, 352, 215, 383, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); - _vm->setHotspot(kHSClown, 130, 250, 285, 413, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 5); - _vm->setHotspot(kHSExitOutsideClown, 660, 190, 799, 400, SF_EXIT_R_CURSOR, 9, 6); - _vm->setHotspot(kHSEmptyBucket, 582, 421, 643, 478, SF_WALKABLE | SF_DISABLED, 9, 7); - _vm->setHotspot(kHSWalkArea1, 0, 0, 799, 523); - _vm->setHotspot(kHSWalkArea2, 0, 0, 0, 0, 7, SF_DISABLED); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (_vm->invHas(kItemHorn)) - _vm->_hotspots[kHSHorn]._flags = SF_DISABLED; - if (_vm->isFlag(kGFUnk22)) - _vm->_hotspots[kHSEmptyBucket]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - _vm->_hotspotsCount = 8; -} - -void Scene28::run() { - _vm->playSound(0x1093C, true); - _s28_nextClownSequenceId = -1; - _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(0x124, 255, 0, 0, kSeqNone, 0, 0, 0); - - if (_vm->isFlag(kGFUnk22)) - _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, 0, 0, 0); - - if (_vm->isFlag(kGFMudTaken)) { - if (_vm->isFlag(kGFUnk21)) { - _vm->_gameSys->setAnimation(0x11C, 39, 3); - _vm->_gameSys->insertSequence(0x11C, 39, 0, 0, kSeqNone, 0, 0, 0); - if (!_vm->invHas(kItemHorn)) - _vm->_gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, 0, 0, 0); - _s28_currClownSequenceId = 0x11C; - } else { - _s28_currClownSequenceId = 0x11B; - _vm->_gameSys->setAnimation(0x11B, 39, 3); - _vm->_gameSys->insertSequence(_s28_currClownSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->_timers[4] = _vm->getRandom(20) + 80; - } - _vm->initGnapPos(8, 8, kDirBottomLeft); - _vm->initPlatypusPos(9, 8, kDirUnk4); - _vm->endSceneInit(); - } else { - _vm->_gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->initGnapPos(8, 8, kDirBottomLeft); - _vm->initPlatypusPos(9, 8, kDirUnk4); - _vm->endSceneInit(); - _vm->playSequences(0xF7, 0x121, 0x122, 0x123); - _s28_currClownSequenceId = 0x115; - _vm->setFlag(kGFMudTaken); - _vm->_gameSys->setAnimation(0x115, 39, 3); - _vm->_gameSys->insertSequence(_s28_currClownSequenceId, 39, 0x11B, 39, kSeqSyncWait, 0, 0, 0); - _s28_nextClownSequenceId = -1; - _vm->_timers[4] = _vm->getRandom(20) + 80; - _vm->_gnapActionStatus = kASGnapWaiting; - while (_vm->_gameSys->getAnimationStatus(3) != 2) { - _vm->gameUpdateTick(); - _vm->updateMouseCursor(); - } - _vm->_gnapActionStatus = -1; - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSHorn: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(2, 8, 3, 4); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(2, 4); - break; - case GRAB_CURSOR: - if (_vm->isFlag(kGFUnk21)) { - if (!_vm->invHas(kItemHorn)) { - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHSHorn].x, _vm->_hotspotsWalkPos[kHSHorn].y) | 0x10000, 1); - _vm->_gnapActionStatus = kASGrabHornSuccess; - } - } else { - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(2, 8, 0, 0x107BB, 1); - _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSHorn].x, _vm->_hotspotsWalkPos[kHSHorn].y, 0, 0x107BB, 1); - _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = kASGrabHornFails; - } - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSClown: - if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFUnk21)) { - if (_vm->_verbCursor == LOOK_CURSOR) - _vm->playGnapScratchingHead(5, 2); - else - _vm->playGnapImpossible(0, 0); - } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithBeer) { - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSClown].x, _vm->_hotspotsWalkPos[kHSClown].y, 0, 0x107BC, 1); - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); - _vm->_gnapActionStatus = kASUseBeerBucketWithClown; - } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithPill) { - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSClown].x, _vm->_hotspotsWalkPos[kHSClown].y, 0, 0x107BC, 1); - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); - _vm->_gnapActionStatus = kASUsePillBucketWithClown; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSClown].x, _vm->_hotspotsWalkPos[kHSClown].y, 2, 4); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(5, 2); - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(5, 8, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkClown; - break; - case GRAB_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitOutsideClown: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 27; - _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideClown].x, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107BF, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideClown].x - 1, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y, -1, 0x107C2, 1); - } - break; - - case kHSEmptyBucket: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 8, 6); - } else if (_vm->isFlag(kGFUnk21)) { - _vm->playGnapImpossible(8, 6); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(8, 6); - break; - case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHSEmptyBucket].x, _vm->_hotspotsWalkPos[kHSEmptyBucket].y) | 0x10000, 1); - _vm->_gnapActionStatus = kASGrabEmptyBucket; - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x1093C)) - _vm->playSound(0x1093C, true); - - if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(20) + 80; - if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFUnk21)) - _s28_nextClownSequenceId = 0x114; - } - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene28::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASUseBeerBucketWithClown: - _vm->setFlag(kGFUnk22); - _s28_nextClownSequenceId = 0x113; - _vm->invRemove(kItemBucketWithBeer); - updateHotspots(); - break; - case kASUsePillBucketWithClown: - _s28_nextClownSequenceId = 0x116; - _vm->invRemove(kItemBucketWithPill); - _vm->setFlag(kGFUnk22); - _vm->setFlag(kGFUnk21); - updateHotspots(); - break; - case kASGrabHornFails: - _s28_nextClownSequenceId = 0x119; - break; - case kASGrabHornSuccess: - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->setAnimation(0x117, 59, 0); - _vm->_gameSys->insertSequence(0x117, 59, 280, 59, kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = kASGrabHornSuccessDone; - break; - case kASGrabHornSuccessDone: - _vm->hideCursor(); - _vm->setGrabCursorSprite(-1); - _vm->addFullScreenSprite(0xF6, 255); - _vm->_gameSys->setAnimation(0x120, 256, 0); - _vm->_gameSys->insertSequence(0x120, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) - _vm->gameUpdateTick(); - _vm->removeFullScreenSprite(); - _vm->showCursor(); - _vm->setGrabCursorSprite(kItemHorn); - _vm->invAdd(kItemHorn); - updateHotspots(); - _vm->_gnapActionStatus = -1; - break; - case kASGrabEmptyBucket: - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->setAnimation(0x111, 99, 0); - _vm->_gameSys->insertSequence(0x111, 99, 274, 99, kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = kASGrabEmptyBucketDone; - break; - case kASGrabEmptyBucketDone: - _vm->setGrabCursorSprite(kItemEmptyBucket); - _vm->clearFlag(kGFUnk22);; - updateHotspots(); - _vm->invAdd(kItemEmptyBucket); - _vm->_gnapActionStatus = -1; - break; - case kASGrabHornFailsDone: - _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 281, 39, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); - _vm->_gnapSequenceId = 0x7B5; - _vm->_gnapSequenceDatNum = 1; - _vm->_gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); - _s28_currClownSequenceId = 0x11B; - _s28_nextClownSequenceId = -1; - _vm->_gnapActionStatus = -1; - _vm->gnapWalkTo(2, 8, -1, 0x107BB, 1); - break; - case kASTalkClown: - _s28_clownTalkCtr = (_s28_clownTalkCtr + 1) % 2; - if (_s28_clownTalkCtr == 0) - _s28_nextClownSequenceId = 0x11D; - else if (_s28_clownTalkCtr == 1) - _s28_nextClownSequenceId = 0x11E; - else if (_s28_clownTalkCtr == 2) - _s28_nextClownSequenceId = 0x11F; // NOTE CHECKME Never set, bug in the original? - break; - case kASGnapWaiting: - _vm->_gnapActionStatus = -1; - break; - case kASLeaveScene: - _vm->_sceneDone = true; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - switch (_s28_nextClownSequenceId) { - case 0x113: - _vm->setGrabCursorSprite(-1); - _vm->_gameSys->setAnimation(_s28_nextClownSequenceId, 39, 0); - _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_s28_nextClownSequenceId), 0, 0); - _vm->_gameSys->insertSequence(_s28_nextClownSequenceId, 39, _s28_currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x11B, 39, _s28_nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _s28_currClownSequenceId = 0x11B; - _s28_nextClownSequenceId = -1; - _vm->_gnapActionStatus = kASGnapWaiting; - break; - case 0x116: - _vm->setGrabCursorSprite(-1); - _vm->_gameSys->setAnimation(_s28_nextClownSequenceId, 39, 0); - _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_s28_nextClownSequenceId), 0, 0); - _vm->_gameSys->insertSequence(_s28_nextClownSequenceId, 39, _s28_currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x11C, 39, _s28_nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_s28_nextClownSequenceId), 0, 0); - _s28_currClownSequenceId = _s28_nextClownSequenceId; - _s28_nextClownSequenceId = -1; - _vm->_gnapActionStatus = kASGnapWaiting; - break; - case 0x11D: - case 0x11E: - case 0x11F: - _vm->_gnapActionStatus = -1; - break; - case 0x119: - _vm->_gameSys->insertSequence(_s28_nextClownSequenceId, 39, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s28_nextClownSequenceId, 39, 0); - _vm->_gameSys->removeSequence(_s28_currClownSequenceId, 39, true); - _vm->_gnapActionStatus = kASGrabHornFailsDone; - _vm->_gnapSequenceId = _s28_nextClownSequenceId; - _vm->_gnapSequenceDatNum = 0; - _s28_nextClownSequenceId = -1; - break; - } - if (_s28_nextClownSequenceId != -1) { - _vm->_gameSys->insertSequence(_s28_nextClownSequenceId, 39, _s28_currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s28_nextClownSequenceId, 39, 3); - _s28_currClownSequenceId = _s28_nextClownSequenceId; - _s28_nextClownSequenceId = -1; - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene28.h b/engines/gnap/scenes/scene28.h deleted file mode 100644 index 40fa93b15a..0000000000 --- a/engines/gnap/scenes/scene28.h +++ /dev/null @@ -1,51 +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_SCENE28_H -#define GNAP_SCENE28_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene28: public Scene { -public: - Scene28(GnapEngine *vm); - ~Scene28() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s28_currClownSequenceId; - int _s28_nextClownSequenceId; - int _s28_clownTalkCtr; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE28_H diff --git a/engines/gnap/scenes/scene29.cpp b/engines/gnap/scenes/scene29.cpp deleted file mode 100644 index 5312a0bf8a..0000000000 --- a/engines/gnap/scenes/scene29.cpp +++ /dev/null @@ -1,358 +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/scene29.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSMonkey = 1, - kHSDevice = 2, - kHSExitCircus = 3, - kHSExitOutsideClown = 4, - kHSAracde = 5, - kHSWalkArea1 = 6 -}; - -enum { - kASUseBananaWithMonkey = 0, - kASLeaveScene = 2 -}; - -Scene29::Scene29(GnapEngine *vm) : Scene(vm) { - _s29_currMonkeySequenceId = -1; - _s29_nextMonkeySequenceId = -1; - _s29_currManSequenceId = -1; - _s29_nextManSequenceId = -1; -} - -int Scene29::init() { - return 0xF6; -} - -void Scene29::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSMonkey, 410, 374, 518, 516, SF_WALKABLE | SF_DISABLED, 3, 7); - _vm->setHotspot(kHSExitCircus, 150, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - _vm->setHotspot(kHSExitOutsideClown, 785, 0, 800, 600, SF_EXIT_R_CURSOR | SF_WALKABLE, 11, 9); - _vm->setHotspot(kHSAracde, 88, 293, 155, 384, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 8); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 478); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (_vm->invHas(kItemHorn)) - _vm->_hotspots[kHSMonkey]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - _vm->_hotspotsCount = 7; -} - -void Scene29::run() { - _vm->playSound(0x1093B, true); - _vm->startSoundTimerB(6); - _vm->queueInsertDeviceIcon(); - - if (_vm->invHas(kItemHorn)) { - _s29_currMonkeySequenceId = 0xE8; - _s29_nextMonkeySequenceId = -1; - _vm->_gameSys->setAnimation(0xE8, 159, 4); - _vm->_gameSys->insertSequence(_s29_currMonkeySequenceId, 159, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); - _s29_currManSequenceId = 0xED; - _s29_nextManSequenceId = -1; - _vm->_gameSys->setAnimation(0xED, 39, 3); - _vm->_timers[4] = _vm->getRandom(20) + 60; - } else { - _vm->_gameSys->insertSequence(0xF4, 19, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 4); - _vm->_gameSys->insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 3); - } - - _vm->_gameSys->insertSequence(0xF3, 39, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0xF5, 38, 0, 0, kSeqLoop, 0, 0, 0); - - if (_vm->_prevSceneNum == 27) { - _vm->initGnapPos(12, 7, kDirBottomRight); - _vm->initPlatypusPos(12, 8, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(8, 7, -1, 0x107B9, 1); - _vm->platypusWalkTo(8, 8, -1, 0x107C2, 1); - } else { - _vm->initGnapPos(-1, 7, kDirBottomRight); - _vm->initPlatypusPos(-2, 7, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); - _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSMonkey: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemBanana) { - _vm->_gnapIdleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSMonkey].x, _vm->_hotspotsWalkPos[kHSMonkey].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASUseBananaWithMonkey; - _vm->_newSceneNum = 51; - _vm->_isLeavingScene = true; - _vm->setGrabCursorSprite(-1); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSMonkey].x, _vm->_hotspotsWalkPos[kHSMonkey].y, 5, 6); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(5, 6); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_hotspotsWalkPos[kHSMonkey].x, _vm->_hotspotsWalkPos[kHSMonkey].y); - break; - case GRAB_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitCircus: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 26; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitCircus].x, _vm->_hotspotsWalkPos[kHSExitCircus].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitCircus].x + 1, _vm->_hotspotsWalkPos[kHSExitCircus].y, -1, -1, 1); - } - break; - - case kHSExitOutsideClown: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 27; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideClown].x, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideClown].x, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y - 1, -1, 0x107CD, 1); - } - break; - - case kHSAracde: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->setGrabCursorSprite(-1); - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 52; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSAracde].x, _vm->_hotspotsWalkPos[kHSAracde].y, 0, -1, 1); - _vm->playGnapIdle(_vm->_hotspotsWalkPos[kHSAracde].x, _vm->_hotspotsWalkPos[kHSAracde].y); - _vm->_gnapActionStatus = kASLeaveScene; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSAracde].x, _vm->_hotspotsWalkPos[kHSAracde].y, 2, 3); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan2(0, 0); - break; - case GRAB_CURSOR: - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSWalkArea1: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x1093B)) - _vm->playSound(0x1093B, true); - - if (!_vm->_isLeavingScene) { - if (_vm->_gnapActionStatus < 0) { - _vm->updateGnapIdleSequence(); - _vm->updatePlatypusIdleSequence(); - } - if (!_vm->_timers[4]) { - if (_vm->invHas(kItemHorn)) { - _vm->_timers[4] = _vm->getRandom(20) + 60; - if (_vm->_gnapActionStatus < 0) { - switch (_vm->getRandom(5)) { - case 0: - _s29_nextManSequenceId = 0xED; - break; - case 1: - _s29_nextManSequenceId = 0xEE; - break; - case 2: - _s29_nextManSequenceId = 0xEF; - break; - case 3: - _s29_nextManSequenceId = 0xF0; - break; - case 4: - _s29_nextManSequenceId = 0xF1; - break; - } - } - } - } - _vm->playSoundB(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene29::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASUseBananaWithMonkey: - _s29_nextMonkeySequenceId = 0xE5; - break; - case kASLeaveScene: - _vm->_sceneDone = true; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s29_nextManSequenceId != -1) { - _vm->_gameSys->insertSequence(_s29_nextManSequenceId, 39, _s29_currManSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s29_nextManSequenceId, 39, 3); - _s29_currManSequenceId = _s29_nextManSequenceId; - _s29_nextManSequenceId = -1; - } - - if (_vm->_gameSys->getAnimationStatus(4) == 2) { - if (_s29_nextMonkeySequenceId == 0xE5) { - _vm->_gameSys->insertSequence(0xF2, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0xF2; - _vm->_gameSys->setAnimation(0xE6, 159, 0); - _vm->_gameSys->setAnimation(0, 159, 4); - _vm->_gameSys->insertSequence(_s29_nextMonkeySequenceId, 159, _s29_currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xE6, 159, _s29_nextMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = kASLeaveScene; - _s29_currMonkeySequenceId = 0xE6; - _s29_nextMonkeySequenceId = -1; - _vm->_timers[5] = 30; - while (_vm->_timers[5]) - _vm->gameUpdateTick(); - _vm->platypusWalkTo(0, 8, 1, 0x107CF, 1); - while (_vm->_gameSys->getAnimationStatus(1) != 2) - _vm->gameUpdateTick(); - } else if (_s29_nextMonkeySequenceId == -1) { - switch (_vm->getRandom(6)) { - case 0: - _s29_nextMonkeySequenceId = 0xE8; - break; - case 1: - _s29_nextMonkeySequenceId = 0xE9; - break; - case 2: - _s29_nextMonkeySequenceId = 0xEA; - break; - case 3: - _s29_nextMonkeySequenceId = 0xEB; - break; - case 4: - _s29_nextMonkeySequenceId = 0xEC; - break; - case 5: - _s29_nextMonkeySequenceId = 0xE7; - break; - } - _vm->_gameSys->insertSequence(_s29_nextMonkeySequenceId, 159, _s29_currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s29_nextMonkeySequenceId, 159, 4); - _s29_currMonkeySequenceId = _s29_nextMonkeySequenceId; - _s29_nextMonkeySequenceId = -1; - } else { - _vm->_gameSys->insertSequence(_s29_nextMonkeySequenceId, 159, _s29_currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s29_nextMonkeySequenceId, 159, 4); - _s29_currMonkeySequenceId = _s29_nextMonkeySequenceId; - _s29_nextMonkeySequenceId = -1; - } - } - -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene29.h b/engines/gnap/scenes/scene29.h deleted file mode 100644 index 3ce5d8d497..0000000000 --- a/engines/gnap/scenes/scene29.h +++ /dev/null @@ -1,52 +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_SCENE29_H -#define GNAP_SCENE29_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene29: public Scene { -public: - Scene29(GnapEngine *vm); - ~Scene29() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s29_currMonkeySequenceId; - int _s29_nextMonkeySequenceId; - int _s29_currManSequenceId; - int _s29_nextManSequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE29_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 6f6a922a9b..52925ca08d 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -28,18 +28,9 @@ #include "gnap/scenes/groupcs.h" #include "gnap/scenes/group0.h" #include "gnap/scenes/group1.h" +#include "gnap/scenes/group2.h" #include "gnap/scenes/intro.h" -#include "gnap/scenes/scene20.h" -#include "gnap/scenes/scene21.h" -#include "gnap/scenes/scene22.h" -#include "gnap/scenes/scene23.h" -#include "gnap/scenes/scene24.h" -#include "gnap/scenes/scene25.h" -#include "gnap/scenes/scene26.h" -#include "gnap/scenes/scene27.h" -#include "gnap/scenes/scene28.h" -#include "gnap/scenes/scene29.h" #include "gnap/scenes/scene30.h" #include "gnap/scenes/scene31.h" #include "gnap/scenes/scene32.h" -- cgit v1.2.3