diff options
author | Strangerke | 2016-04-28 06:54:39 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-05-10 12:14:46 +0200 |
commit | d7bd157fef8feee89fe111bc6f1bbc670e1e9201 (patch) | |
tree | cbd9ae7c76b3f644586156d17062ae37f9bf24d0 /engines | |
parent | 4edfe094ea91c4a05a71613fc398d1b32851713f (diff) | |
download | scummvm-rg350-d7bd157fef8feee89fe111bc6f1bbc670e1e9201.tar.gz scummvm-rg350-d7bd157fef8feee89fe111bc6f1bbc670e1e9201.tar.bz2 scummvm-rg350-d7bd157fef8feee89fe111bc6f1bbc670e1e9201.zip |
GNAP: renaming and grouping of scenes in group 3
Diffstat (limited to 'engines')
-rw-r--r-- | engines/gnap/module.mk | 7 | ||||
-rw-r--r-- | engines/gnap/scenes/group3.cpp | 1682 | ||||
-rw-r--r-- | engines/gnap/scenes/group3.h | 125 | ||||
-rw-r--r-- | engines/gnap/scenes/scene30.cpp | 285 | ||||
-rw-r--r-- | engines/gnap/scenes/scene30.h | 49 | ||||
-rw-r--r-- | engines/gnap/scenes/scene31.cpp | 408 | ||||
-rw-r--r-- | engines/gnap/scenes/scene31.h | 53 | ||||
-rw-r--r-- | engines/gnap/scenes/scene32.cpp | 199 | ||||
-rw-r--r-- | engines/gnap/scenes/scene32.h | 46 | ||||
-rw-r--r-- | engines/gnap/scenes/scene33.cpp | 328 | ||||
-rw-r--r-- | engines/gnap/scenes/scene33.h | 50 | ||||
-rw-r--r-- | engines/gnap/scenes/scene38.cpp | 360 | ||||
-rw-r--r-- | engines/gnap/scenes/scene38.h | 46 | ||||
-rw-r--r-- | engines/gnap/scenes/scene39.cpp | 242 | ||||
-rw-r--r-- | engines/gnap/scenes/scene39.h | 50 | ||||
-rw-r--r-- | engines/gnap/scenes/scenecore.cpp | 7 |
16 files changed, 1809 insertions, 2128 deletions
diff --git a/engines/gnap/module.mk b/engines/gnap/module.mk index 52d6a5a4d4..388b33b178 100644 --- a/engines/gnap/module.mk +++ b/engines/gnap/module.mk @@ -14,13 +14,8 @@ MODULE_OBJS := \ scenes/group0.o \ scenes/group1.o \ scenes/group2.o \ + scenes/group3.o \ scenes/intro.o \ - scenes/scene30.o \ - scenes/scene31.o \ - scenes/scene32.o \ - scenes/scene33.o \ - scenes/scene38.o \ - scenes/scene39.o \ scenes/scene40.o \ scenes/scene41.o \ scenes/scene42.o \ diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp new file mode 100644 index 0000000000..d61859a07c --- /dev/null +++ b/engines/gnap/scenes/group3.cpp @@ -0,0 +1,1682 @@ +/* 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/group3.h" + +namespace Gnap { + +enum { + kHS30Platypus = 0, + kHS30PillMachine = 1, + kHS30Device = 2, + kHS30ExitCircus = 3, + kHS30WalkArea1 = 4 +}; + +enum { + kAS30LeaveScene = 0, + kAS30UsePillMachine = 1, + kAS30UsePillMachine2 = 2, + kAS30LookPillMachine = 3, + kAS30UsePillMachine3 = 4, + kAS30UsePillMachine4 = 5 +}; + +Scene30::Scene30(GnapEngine *vm) : Scene(vm) { + _kidSequenceId = -1; +} + +int Scene30::init() { + return _vm->isFlag(kGFUnk23) ? 0x10B : 0x10A; +} + +void Scene30::updateHotspots() { + _vm->setHotspot(kHS30Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS30PillMachine, 598, 342, 658, 426, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 7); + _vm->setHotspot(kHS30ExitCircus, 100, 590 - _vm->_deviceY1, 700, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHS30WalkArea1, 0, 0, 800, 514); + _vm->setDeviceHotspot(kHS30Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 5; +} + +void Scene30::run() { + bool hasTakenPill = false; + + _vm->playSound(0x1093B, true); + _vm->startSoundTimerB(6); + + _vm->queueInsertDeviceIcon(); + + if (_vm->isFlag(kGFUnk23)) + _vm->_gameSys->insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); + + if (!_vm->isFlag(kGFUnk13)) + _vm->_gameSys->insertSequence(0x107, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->_timers[5] = _vm->getRandom(50) + 180; + + _vm->_gameSys->insertSequence(0x101, 40, 0, 0, kSeqNone, 0, 0, 0); + _vm->_timers[4] = _vm->getRandom(100) + 300; + + _kidSequenceId = 0x101; + _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); + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS30Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS30Platypus: + 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 kHS30PillMachine: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole && !_vm->isFlag(kGFUnk23)) { + _vm->_hotspots[kHS30WalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS30PillMachine].x, _vm->_hotspotsWalkPos[kHS30PillMachine].y, 0, 0x107BC, 1); + _vm->_hotspots[kHS30WalkArea1]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kAS30UsePillMachine; + hasTakenPill = true; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS30PillMachine].x, _vm->_hotspotsWalkPos[kHS30PillMachine].y, 8, 5); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->gnapWalkTo(9, 8, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kAS30LookPillMachine; + break; + case GRAB_CURSOR: + _vm->playGnapScratchingHead(8, 5); + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(8, 5); + break; + } + } + } + break; + + case kHS30ExitCircus: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + if (hasTakenPill) + _vm->_newSceneNum = 47; + else + _vm->_newSceneNum = 26; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS30ExitCircus].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kAS30LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS30ExitCircus].x + 1, _vm->_hotspotsWalkPos[kHS30ExitCircus].y, -1, 0x107C2, 1); + } + break; + + case kHS30WalkArea1: + 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(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(100) + 300; + if (_vm->_gnapActionStatus < 0) { + if (_vm->getRandom(5) == 1) { + _vm->_gameSys->insertSequence(0xFF, 40, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x100, 40, _kidSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _kidSequenceId = 0x100; + } else { + _vm->_gameSys->insertSequence(0xFE, 40, 0, 0, kSeqNone, 0, 0, 0); + } + } + } + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(50) + 180; + if (_vm->_gnapActionStatus < 0) { + if (!_vm->isFlag(kGFUnk23) || hasTakenPill) + _vm->_gameSys->insertSequence(0x109, 20, 0, 0, kSeqNone, 0, 0, 0); + else + _vm->_gameSys->insertSequence(0x108, 20, 0, 0, kSeqNone, 0, 0, 0); + } + } + _vm->playSoundB(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene30::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS30LeaveScene: + _vm->_sceneDone = true; + break; + case kAS30UsePillMachine: + _vm->setGrabCursorSprite(-1); + _vm->_gameSys->setAnimation(0x105, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x105, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x105; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kAS30UsePillMachine2; + break; + case kAS30UsePillMachine2: + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + _vm->addFullScreenSprite(0x3F, 255); + _vm->_gameSys->removeSequence(0x105, _vm->_gnapId, true); + _vm->_gameSys->setAnimation(0x102, 256, 0); + _vm->_gameSys->insertSequence(0x102, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(0) != 2) + _vm->gameUpdateTick(); + _vm->_gameSys->setAnimation(0x103, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x103, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); + _vm->removeFullScreenSprite(); + _vm->showCursor(); + _vm->_gnapActionStatus = kAS30UsePillMachine3; + _vm->invAdd(kItemPill); + _vm->setFlag(kGFUnk23); + break; + case kAS30UsePillMachine3: + _vm->_gameSys->setAnimation(0x104, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x104, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, 0x103), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x104; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kAS30UsePillMachine4; + _vm->setGrabCursorSprite(kItemDiceQuarterHole); + break; + case kAS30UsePillMachine4: + _vm->_gameSys->insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS30PillMachine].x, _vm->_hotspotsWalkPos[kHS30PillMachine].y + 1, -1, 0x107BC, 1); + _vm->_gnapActionStatus = -1; + break; + case kAS30LookPillMachine: + if (_vm->isFlag(kGFUnk23)) + _vm->showFullScreenSprite(0xE3); + else + _vm->showFullScreenSprite(0xE2); + _vm->_gnapActionStatus = -1; + break; + } + } +} + +/*****************************************************************************/ + +enum { + kHS31Platypus = 0, + kHS31MeasuringClown = 1, + kHS31BeerBarrel = 2, + kHS31Device = 3, + kHS31ExitCircus = 4, + kHS31ExitOutsideClown = 5, + kHS31WalkArea1 = 6 +}; + +enum { + kAS31UseBeerBarrel = 1, + kAS31FillEmptyBucketWithBeer = 2, + kAS31FillEmptyBucketWithBeerDone = 3, + kAS31PlatMeasuringClown = 4, + kAS31UseMeasuringClown = 5, + kAS31LeaveScene = 6 +}; + +Scene31::Scene31(GnapEngine *vm) : Scene(vm) { + _beerGuyDistracted = false; + _currClerkSequenceId = -1; + _nextClerkSequenceId = -1; + _clerkMeasureCtr = -1; + _clerkMeasureMaxCtr = 3; +} + +int Scene31::init() { + return 0x105; +} + +void Scene31::updateHotspots() { + _vm->setHotspot(kHS31Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS31MeasuringClown, 34, 150, 256, 436, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 6); + _vm->setHotspot(kHS31BeerBarrel, 452, 182, 560, 306, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); + _vm->setHotspot(kHS31ExitCircus, 150, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHS31ExitOutsideClown, 0, 0, 15, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); + _vm->setHotspot(kHS31WalkArea1, 0, 0, 800, 480); + _vm->setDeviceHotspot(kHS31Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 7; +} + +void Scene31::run() { + _vm->playSound(0x1093B, true); + _vm->startSoundTimerB(6); + + _vm->queueInsertDeviceIcon(); + + _beerGuyDistracted = false; + _vm->_gameSys->insertSequence(0xFB, 39, 0, 0, kSeqNone, 0, 0, 0); + + _currClerkSequenceId = 0xFB; + _nextClerkSequenceId = -1; + + _vm->_gameSys->setAnimation(0xFB, 39, 3); + + _vm->_timers[4] = _vm->getRandom(20) + 60; + _vm->_timers[5] = _vm->getRandom(50) + 180; + + if (_vm->_prevSceneNum == 27) { + _vm->initGnapPos(-1, 8, kDirBottomLeft); + _vm->initPlatypusPos(-1, 9, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(3, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(3, 9, -1, 0x107D2, 1); + } else { + _vm->initGnapPos(7, 12, kDirBottomRight); + _vm->initPlatypusPos(6, 12, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(7, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(6, 8, -1, 0x107D2, 1); + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS31Device: + if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == kAS31PlatMeasuringClown) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS31Platypus: + 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 kHS31MeasuringClown: + if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == kAS31PlatMeasuringClown) { + if (_vm->_gnapActionStatus == kAS31PlatMeasuringClown) { + if (_vm->_verbCursor == LOOK_CURSOR) + _vm->playGnapScratchingHead(2, 2); + else + _vm->playGnapImpossible(0, 0); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y + 1, 2, 2); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(2, 2); + break; + case GRAB_CURSOR: + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y + 1, -1, -1, 1); + _vm->_hotspots[kHS31WalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y, 0, 0x107B9, 1); + _vm->_hotspots[kHS31WalkArea1]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kAS31UseMeasuringClown; + _vm->_timers[4] = 300; + break; + case TALK_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + case PLAT_CURSOR: + if (!_vm->invHas(kItemBucketWithBeer)) { + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y + 1, 1, 0x107C2, 1); + _vm->_hotspots[kHS31WalkArea1]._flags |= SF_WALKABLE; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y, 1, 0x107C2, 1); + _vm->_hotspots[kHS31WalkArea1]._flags &= ~SF_WALKABLE; + _vm->_platypusActionStatus = kAS31PlatMeasuringClown; + _vm->_gnapActionStatus = kAS31PlatMeasuringClown; + _vm->_timers[4] = 300; + } else + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS31BeerBarrel: + if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == kAS31PlatMeasuringClown) { + if (_vm->_grabCursorSpriteIndex == kItemEmptyBucket && _beerGuyDistracted) { + _vm->setGrabCursorSprite(-1); + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, -1, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y) | 0x10000, 1); + _clerkMeasureMaxCtr += 5; + _vm->_gameSys->insertSequence(0xF8, 59, 0, 0, kSeqNone, 0, 0, 0); + _vm->playGnapPullOutDevice(6, 8); + _vm->playGnapUseDevice(0, 0); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kAS31FillEmptyBucketWithBeer; + _vm->_timers[4] = 300; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y, 6, 2); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(6, 2); + break; + case GRAB_CURSOR: + if (_beerGuyDistracted) { + _vm->playGnapScratchingHead(6, 2); + } else { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kAS31UseBeerBarrel; + _vm->_gnapIdleFacing = kDirUpLeft; + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS31ExitCircus: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 26; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS31ExitCircus].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kAS31LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31ExitCircus].x + 1, _vm->_hotspotsWalkPos[kHS31ExitCircus].y, -1, -1, 1); + } + break; + + case kHS31ExitOutsideClown: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 27; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS31ExitOutsideClown].y, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kAS31LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31ExitOutsideClown].x, _vm->_hotspotsWalkPos[kHS31ExitOutsideClown].y + 1, -1, 0x107CF, 1); + } + break; + + case kHS31WalkArea1: + 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->_platypusActionStatus < 0) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(20) + 60; + if (_vm->_gnapActionStatus < 0 && _nextClerkSequenceId == -1) { + switch (_vm->getRandom(6)){ + case 0: + _nextClerkSequenceId = 0xFF; + break; + case 1: + _nextClerkSequenceId = 0x100; + break; + case 2: + _nextClerkSequenceId = 0x101; + break; + default: + _nextClerkSequenceId = 0xFB; + break; + } + } + } + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(50) + 180; + if (_vm->_gnapActionStatus < 0) { + if (_vm->getRandom(2) != 0) + _vm->_gameSys->insertSequence(0x104, 20, 0, 0, kSeqNone, 0, 0, 0); + else + _vm->_gameSys->insertSequence(0x103, 20, 0, 0, kSeqNone, 0, 0, 0); + } + } + _vm->playSoundB(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene31::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS31UseBeerBarrel: + _nextClerkSequenceId = 0xFE; + break; + case kAS31FillEmptyBucketWithBeer: + _vm->_gameSys->setAnimation(0x102, 59, 0); + _vm->_gameSys->insertSequence(0x102, 59, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapX = 5; + _vm->_gnapY = 7; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x102; + _vm->_gnapId = 59; + _vm->_gnapActionStatus = kAS31FillEmptyBucketWithBeerDone; + break; + case kAS31FillEmptyBucketWithBeerDone: + _vm->_gnapIdleFacing = kDirBottomLeft; + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->insertSequence(0xF9, 59, 0xF8, 59, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = -1; + _vm->invAdd(kItemBucketWithBeer); + _vm->invRemove(kItemEmptyBucket); + _vm->setGrabCursorSprite(kItemBucketWithBeer); + break; + case kAS31UseMeasuringClown: + _nextClerkSequenceId = 0xFA; + _clerkMeasureMaxCtr = 1; + break; + case kAS31LeaveScene: + _vm->_sceneDone = true; + _vm->_gnapActionStatus = -1; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + if (_vm->_platypusActionStatus == kAS31PlatMeasuringClown) { + _vm->_sceneWaiting = true; + _beerGuyDistracted = true; + _nextClerkSequenceId = 0xFA; + } + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + switch (_nextClerkSequenceId) { + case 0xFA: + _vm->_gameSys->insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xFC, 39, _nextClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0xFC, 39, 3); + _currClerkSequenceId = 0xFC; + _nextClerkSequenceId = 0xFC; + _clerkMeasureCtr = 0; + break; + case 0xFC: + ++_clerkMeasureCtr; + if (_clerkMeasureCtr >= _clerkMeasureMaxCtr) { + if (_vm->_gnapActionStatus != 5) + _vm->_platypusActionStatus = -1; + _vm->_timers[0] = 40; + _vm->_gameSys->insertSequence(0xFD, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _currClerkSequenceId = 0xFD; + _nextClerkSequenceId = -1; + if (_vm->_gnapActionStatus != kAS31FillEmptyBucketWithBeerDone && _vm->_gnapActionStatus != kAS31FillEmptyBucketWithBeer) + _vm->_gnapActionStatus = -1; + _beerGuyDistracted = false; + _clerkMeasureMaxCtr = 3; + _vm->_gameSys->setAnimation(0xFD, 39, 3); + _vm->_sceneWaiting = false; + } else { + _vm->_gameSys->insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _currClerkSequenceId = _nextClerkSequenceId; + _nextClerkSequenceId = 0xFC; + _vm->_gameSys->setAnimation(0xFC, 39, 3); + } + break; + case 0xFE: + _vm->_gameSys->insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextClerkSequenceId, 39, 3); + _currClerkSequenceId = _nextClerkSequenceId; + _nextClerkSequenceId = -1; + _vm->_gnapActionStatus = -1; + break; + default: + if (_nextClerkSequenceId != -1) { + _vm->_gameSys->insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextClerkSequenceId, 39, 3); + _currClerkSequenceId = _nextClerkSequenceId; + _nextClerkSequenceId = -1; + } + break; + } + } +} + +/*****************************************************************************/ + +enum { + kHS32Platypus = 0, + kHS32ExitTruck = 1, + kHS32Device = 2, + kHS32WalkArea1 = 3, + kHS32WalkArea2 = 4, + kHS32WalkArea3 = 5, + kHS32WalkArea4 = 6, + kHS32WalkArea5 = 7, + kHS32WalkArea6 = 8, + kHS32WalkArea7 = 9, + kHS32WalkArea8 = 10 +}; + +enum { + kAS32LeaveScene = 0 +}; + +Scene32::Scene32(GnapEngine *vm) : Scene(vm) { + +} + +int Scene32::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + return _vm->isFlag(kGFPlatypusTalkingToAssistant) ? 0xF : 0x10; +} + +void Scene32::updateHotspots() { + _vm->setHotspot(kHS32Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS32ExitTruck, 780, 226, 800, 455, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 6); + _vm->setHotspot(kHS32WalkArea1, 0, 0, 162, 426); + _vm->setHotspot(kHS32WalkArea2, 162, 0, 237, 396); + _vm->setHotspot(kHS32WalkArea3, 237, 0, 319, 363); + _vm->setHotspot(kHS32WalkArea4, 520, 0, 800, 404); + _vm->setHotspot(kHS32WalkArea5, 300, 447, 800, 600); + _vm->setHotspot(kHS32WalkArea6, 678, 0, 800, 404); + _vm->setHotspot(kHS32WalkArea7, 0, 0, 520, 351); + _vm->setHotspot(kHS32WalkArea8, 0, 546, 300, 600); + _vm->setDeviceHotspot(kHS32Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 11; +} + +void Scene32::run() { + _vm->playSound(0x1091C, true); + _vm->startSoundTimerC(5); + _vm->queueInsertDeviceIcon(); + _vm->_timers[4] = _vm->getRandom(100) + 300; + + if (_vm->_prevSceneNum == 33) { + _vm->initGnapPos(11, 6, kDirBottomLeft); + _vm->initPlatypusPos(12, 6, kDirUnk4); + _vm->endSceneInit(); + _vm->platypusWalkTo(9, 6, -1, 0x107D2, 1); + _vm->gnapWalkTo(8, 6, -1, 0x107BA, 1); + } else { + _vm->initGnapPos(1, 6, kDirBottomRight); + _vm->initPlatypusPos(1, 7, kDirNone); + _vm->endSceneInit(); + } + + 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 kHS32Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS32Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + } 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(_vm->_platX, _vm->_platY); + break; + } + } + } + break; + + case kHS32ExitTruck: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->setGrabCursorSprite(-1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck].x, _vm->_hotspotsWalkPos[kHS32ExitTruck].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kAS32LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck].x, _vm->_hotspotsWalkPos[kHS32ExitTruck].y + 1, -1, 0x107CD, 1); + _vm->_newSceneNum = 33; + } + break; + + case kHS32WalkArea1: + case kHS32WalkArea2: + case kHS32WalkArea3: + case kHS32WalkArea4: + case kHS32WalkArea5: + case kHS32WalkArea6: + case kHS32WalkArea7: + case kHS32WalkArea8: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + } + + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = 0; + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x1091C)) + _vm->playSound(0x1091C, true); + + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(100) + 300; + if (_vm->getRandom(2) != 0) + _vm->_gameSys->insertSequence(0x0E, 180, 0, 0, kSeqNone, 0, 0, 0); + else + _vm->_gameSys->insertSequence(0x0D, 180, 0, 0, kSeqNone, 0, 0, 0); + } + _vm->playSoundC(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + _vm->gameUpdateTick(); + } +} + +void Scene32::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + if (_vm->_gnapActionStatus == kAS32LeaveScene) + _vm->_sceneDone = true; + } +} + +/*****************************************************************************/ + +enum { + kHS33Platypus = 0, + kHS33Chicken = 1, + kHS33Device = 2, + kHS33ExitHouse = 3, + kHS33ExitBarn = 4, + kHS33ExitCreek = 5, + kHS33ExitPigpen = 6, + kHS33WalkArea1 = 7, + kHS33WalkArea2 = 8 +}; + +enum { + kAS33LeaveScene = 0, + kAS33TalkChicken = 1, + kAS33UseChicken = 2, + kAS33UseChickenDone = 3 +}; + +Scene33::Scene33(GnapEngine *vm) : Scene(vm) { + _currChickenSequenceId = -1; + _nextChickenSequenceId = -1; +} + +int Scene33::init() { + return _vm->isFlag(kGFPlatypusTalkingToAssistant) ? 0x84 : 0x85; +} + +void Scene33::updateHotspots() { + _vm->setHotspot(kHS33Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS33Chicken, 606, 455, 702, 568, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); + _vm->setHotspot(kHS33ExitHouse, 480, 120, 556, 240, SF_EXIT_U_CURSOR, 7, 3); + _vm->setHotspot(kHS33ExitBarn, 610, 75, 800, 164, SF_EXIT_U_CURSOR, 10, 3); + _vm->setHotspot(kHS33ExitCreek, 780, 336, 800, 556, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 8); + _vm->setHotspot(kHS33ExitPigpen, 0, 300, 20, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); + _vm->setHotspot(kHS33WalkArea1, 120, 0, 514, 458); + _vm->setHotspot(kHS33WalkArea2, 0, 0, 800, 452); + _vm->setDeviceHotspot(kHS33Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 9; +} + +void Scene33::run() { + _vm->playSound(0x1091C, true); + _vm->startSoundTimerC(6); + _vm->queueInsertDeviceIcon(); + + _currChickenSequenceId = 0x7E; + _vm->_gameSys->setAnimation(0x7E, 179, 2); + _vm->_gameSys->insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); + _nextChickenSequenceId = -1; + _vm->_timers[5] = _vm->getRandom(20) + 30; + _vm->_timers[4] = _vm->getRandom(100) + 300; + + switch (_vm->_prevSceneNum) { + case 34: + _vm->initGnapPos(11, 7, kDirBottomLeft); + _vm->initPlatypusPos(12, 7, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 7, -1, 0x107BA, 1); + _vm->platypusWalkTo(9, 7, -1, 0x107D2, 1); + break; + case 37: + _vm->initGnapPos(7, 7, kDirBottomRight); + _vm->initPlatypusPos(8, 7, kDirNone); + _vm->endSceneInit(); + break; + case 32: + _vm->initGnapPos(-1, 6, kDirBottomRight); + _vm->initPlatypusPos(-1, 7, kDirNone); + _vm->endSceneInit(); + _vm->platypusWalkTo(2, 7, -1, 0x107C2, 1); + _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + break; + default: + _vm->initGnapPos(3, 7, kDirBottomRight); + _vm->initPlatypusPos(2, 7, kDirNone); + _vm->endSceneInit(); + break; + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + _vm->testWalk(0, 0, 7, 6, 8, 6); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS33Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS33Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + } 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(_vm->_platX, _vm->_platY); + break; + } + } + } + break; + + case kHS33Chicken: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(7, 9, 9, 8); + } else { + switch (_vm->_verbCursor) { + case GRAB_CURSOR: + _vm->_gnapIdleFacing = kDirBottomRight; + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33Chicken].x, _vm->_hotspotsWalkPos[kHS33Chicken].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + _vm->_gnapActionStatus = kAS33UseChicken; + else + _vm->_gnapActionStatus = -1; + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33Chicken].x, _vm->_hotspotsWalkPos[kHS33Chicken].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS33TalkChicken; + break; + case LOOK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS33ExitHouse: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_gnapActionStatus = kAS33LeaveScene; + _vm->_newSceneNum = 37; + if (_vm->_gnapX > 6) + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107AD, 1); + else + _vm->gnapWalkTo(6, 7, 0, 0x107B1, 1); + } + break; + + case kHS33ExitBarn: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_gnapActionStatus = kAS33LeaveScene; + _vm->_newSceneNum = 35; + if (_vm->_gnapX > 7) + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107AD, 1); + else + _vm->gnapWalkTo(7, 7, 0, 0x107B1, 1); + } + break; + + case kHS33ExitCreek: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek].x, _vm->_hotspotsWalkPos[kHS33ExitCreek].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kAS33LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek].x, _vm->_hotspotsWalkPos[kHS33ExitCreek].y, -1, 0x107CD, 1); + _vm->_newSceneNum = 34; + } + break; + + case kHS33ExitPigpen: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen].x, _vm->_hotspotsWalkPos[kHS33ExitPigpen].y, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kAS33LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen].x, _vm->_hotspotsWalkPos[kHS33ExitPigpen].y, -1, 0x107CF, 1); + _vm->_newSceneNum = 32; + } + break; + + case kHS33WalkArea1: + case kHS33WalkArea2: + 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(0x1091C)) + _vm->playSound(0x1091C, true); + + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(100) + 300; + if (_vm->getRandom(2) != 0) + _vm->_gameSys->insertSequence(0x83, 256, 0, 0, kSeqNone, 0, 0, 0); + else + _vm->_gameSys->insertSequence(0x82, 256, 0, 0, kSeqNone, 0, 0, 0); + } + if (!_vm->_timers[5] && _nextChickenSequenceId == -1 && _vm->_gnapActionStatus != kAS33TalkChicken && _vm->_gnapActionStatus != kAS33UseChicken) { + if (_vm->getRandom(6) != 0) { + _nextChickenSequenceId = 0x7E; + _vm->_timers[5] = _vm->getRandom(20) + 30; + } else { + _nextChickenSequenceId = 0x80; + _vm->_timers[5] = _vm->getRandom(20) + 50; + } + } + _vm->playSoundC(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + _vm->gameUpdateTick(); + } +} + +void Scene33::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + switch (_vm->_gnapActionStatus) { + case kAS33LeaveScene: + _vm->_sceneDone = true; + break; + case kAS33TalkChicken: + _nextChickenSequenceId = 0x7F; + break; + case kAS33UseChicken: + _nextChickenSequenceId = 0x81; + _vm->_timers[2] = 100; + break; + case kAS33UseChickenDone: + _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 0x81, 179, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceId = 0x7B5; + _vm->_gnapSequenceDatNum = 1; + _currChickenSequenceId = 0x7E; + _vm->_gameSys->setAnimation(0x7E, 179, 2); + _vm->_gameSys->insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapActionStatus = -1; + _vm->_timers[5] = 30; + break; + default: + _vm->_gnapActionStatus = -1; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(2) == 2) { + if (_nextChickenSequenceId == 0x81) { + _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 0); + _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->removeSequence(_currChickenSequenceId, 179, true); + _nextChickenSequenceId = -1; + _currChickenSequenceId = -1; + _vm->_gnapActionStatus = kAS33UseChickenDone; + _vm->_timers[5] = 500; + } else if (_nextChickenSequenceId == 0x7F) { + _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 2); + _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + _currChickenSequenceId = _nextChickenSequenceId; + _nextChickenSequenceId = -1; + _vm->_gnapActionStatus = -1; + } else if (_nextChickenSequenceId != -1) { + _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 2); + _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + _currChickenSequenceId = _nextChickenSequenceId; + _nextChickenSequenceId = -1; + } + } +} + +/*****************************************************************************/ + +enum { + kHS38Platypus = 0, + kHS38ExitHouse = 1, + kHS38ExitCave = 2, + kHS38TrapDoorLid1 = 3, + kHS38TrapDoorLid2 = 4, + kHS38HuntingTrophy = 5, + kHS38WalkArea1 = 6, + kHS38Device = 7, + kHS38WalkArea2 = 8, + kHS38WalkArea3 = 9, + kHS38WalkArea4 = 10, + kHS38WalkArea5 = 11, + kHS38WalkArea6 = 12 +}; + +enum { + kAS38LeaveScene = 0, + kAS38ExitCave = 1, + kAS38UseHuntingTrophy = 2, + kAS38HoldingHuntingTrophy = 3, + kAS38ReleaseHuntingTrophy = 4, + kAS38UsePlatypusWithTrapDoor = 5, + kAS38PlatypusHoldingTrapDoor = 6 +}; + +Scene38::Scene38(GnapEngine *vm) : Scene(vm) { +} + +int Scene38::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + return 0xA5; +} + +void Scene38::updateHotspots() { + _vm->setHotspot(kHS38Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS38ExitHouse, 150, 585, 650, 600, SF_EXIT_D_CURSOR, 0, 8); + _vm->setHotspot(kHS38ExitCave, 430, 440, 655, 470, SF_WALKABLE, 0, 8); + _vm->setHotspot(kHS38TrapDoorLid1, 525, 265, 640, 350, SF_DISABLED); + _vm->setHotspot(kHS38TrapDoorLid2, 555, 350, 670, 430, SF_DISABLED); + _vm->setHotspot(kHS38HuntingTrophy, 170, 85, 250, 190, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 8); + _vm->setHotspot(kHS38WalkArea1, 330, 270, 640, 380, SF_DISABLED | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 8); + _vm->setHotspot(kHS38WalkArea2, 0, 0, 799, 396); + _vm->setHotspot(kHS38WalkArea3, 0, 585, 799, 599, SF_WALKABLE | SF_DISABLED); + _vm->setHotspot(kHS38WalkArea4, 0, 0, 97, 445); + _vm->setHotspot(kHS38WalkArea5, 770, 0, 799, 445); + _vm->setHotspot(kHS38WalkArea6, 393, 0, 698, 445, SF_WALKABLE | SF_DISABLED); + _vm->setDeviceHotspot(kHS38Device, -1, -1, -1, -1); + if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) + _vm->_hotspots[kHS38Platypus]._flags = SF_WALKABLE | SF_DISABLED; + if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) + _vm->_hotspots[kHS38ExitCave]._flags = SF_EXIT_D_CURSOR; + else if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) + _vm->_hotspots[kHS38ExitCave]._flags = SF_EXIT_D_CURSOR; + if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) + _vm->_hotspots[kHS38TrapDoorLid1]._flags = SF_DISABLED; + else if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) + _vm->_hotspots[kHS38TrapDoorLid1]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) + _vm->_hotspots[kHS38TrapDoorLid2]._flags = SF_DISABLED; + else if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) + _vm->_hotspots[kHS38TrapDoorLid2]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) + _vm->_hotspots[kHS38WalkArea6]._flags = SF_NONE; + _vm->_hotspotsCount = 13; +} + +void Scene38::run() { + _vm->queueInsertDeviceIcon(); + _vm->_gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->_prevSceneNum == 39) { + _vm->initGnapPos(3, 7, kDirBottomLeft); + _vm->initPlatypusPos(4, 7, kDirUnk4); + } else { + _vm->initGnapPos(3, 8, kDirBottomRight); + _vm->initPlatypusPos(4, 8, kDirNone); + } + _vm->endSceneInit(); + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS38Device: + _vm->runMenu(); + updateHotspots(); + break; + + case kHS38Platypus: + if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) { + _vm->_gnapActionStatus = kAS38ReleaseHuntingTrophy; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + } 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(_vm->_platX, _vm->_platY); + break; + } + } + break; + + case kHS38ExitHouse: + if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) { + _vm->_gnapActionStatus = kAS38ReleaseHuntingTrophy; + } else { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(-1, -1, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kAS38LeaveScene; + _vm->_newSceneNum = 37; + } + break; + + case kHS38ExitCave: + if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) { + _vm->_gnapActionStatus = kAS38ReleaseHuntingTrophy; + if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) + _vm->_isLeavingScene = true; + } else if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) { + _vm->_sceneWaiting = false; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(5, 7, 0, 0x107BB, 1); + _vm->_newSceneNum = 39; + _vm->_gnapActionStatus = kAS38ExitCave; + } + break; + + case kHS38TrapDoorLid1: + case kHS38TrapDoorLid2: + if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) { + if (_vm->_verbCursor == PLAT_CURSOR && _vm->_platypusActionStatus != kAS38PlatypusHoldingTrapDoor) + _vm->_gnapActionStatus = kAS38UsePlatypusWithTrapDoor; + else + _vm->_gnapActionStatus = kAS38ReleaseHuntingTrophy; + } + break; + + case kHS38HuntingTrophy: + if (_vm->_gnapActionStatus != kAS38HoldingHuntingTrophy) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(3, 6, 2, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(0, 0); + break; + case GRAB_CURSOR: + if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) + _vm->playGnapImpossible(0, 0); + else { + _vm->gnapWalkTo(3, 6, 0, 0x107BB, 1); + _vm->platypusWalkTo(4, 8, -1, -1, 1); + _vm->_gnapActionStatus = kAS38UseHuntingTrophy; + } + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(2, 0); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS38WalkArea1: + // Nothing + break; + + case kHS38WalkArea2: + case kHS38WalkArea3: + case kHS38WalkArea4: + case kHS38WalkArea5: + case kHS38WalkArea6: + if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) + _vm->_gnapActionStatus = kAS38ReleaseHuntingTrophy; + else if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left) { + if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) + _vm->_gnapActionStatus = kAS38ReleaseHuntingTrophy; + else if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene38::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS38LeaveScene: + _vm->_sceneDone = true; + break; + case kAS38ExitCave: + _vm->_gameSys->removeSequence(_vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, true); + _vm->_gameSys->insertSequence(0xA3, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0xA3; + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0xA3, _vm->_gnapId, 0); + _vm->_gnapActionStatus = kAS38LeaveScene; + break; + case kAS38UseHuntingTrophy: + _vm->_gameSys->removeSequence(0x9B, 0, true); + _vm->_gameSys->insertSequence(0x9C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x9C; + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x9C, _vm->_gnapId, 0); + _vm->_gnapActionStatus = kAS38HoldingHuntingTrophy; + updateHotspots(); + break; + case kAS38HoldingHuntingTrophy: + if (_vm->_platypusActionStatus != kAS38PlatypusHoldingTrapDoor) + _vm->_sceneWaiting = true; + if (_vm->_gnapSequenceId == 0xA4) { + _vm->_gameSys->insertSequence(0x9D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x9D; + } else { + _vm->_gameSys->insertSequence(0xA4, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0xA4; + } + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->setAnimation(_vm->_gnapSequenceId, _vm->_gnapId, 0); + break; + case kAS38ReleaseHuntingTrophy: + if (_vm->_gnapSequenceId == 0x9E) { + _vm->_gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapActionStatus = -1; + } else if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) { + _vm->_gameSys->insertSequence(0xA0, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0xA0; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapX = 3; + _vm->_gnapY = 6; + _vm->_gnapIdleFacing = kDirBottomRight; + if (_vm->_isLeavingScene) { + _vm->_sceneWaiting = false; + _vm->gnapWalkTo(5, 7, 0, 0x107BB, 1); + _vm->_newSceneNum = 39; + _vm->_gnapActionStatus = kAS38ExitCave; + } else { + _vm->_gnapActionStatus = -1; + } + } else { + _vm->_gameSys->insertSequence(0x9E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x9E; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapX = 3; + _vm->_gnapY = 6; + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gameSys->setAnimation(0x9E, _vm->_gnapId, 0); + _vm->_sceneWaiting = false; + updateHotspots(); + } + break; + case kAS38UsePlatypusWithTrapDoor: + _vm->_sceneWaiting = false; + _vm->_gameSys->insertSequence(0x9F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x9F; + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x9F, _vm->_gnapId, 0); + _vm->_gnapActionStatus = kAS38HoldingHuntingTrophy; + if (_vm->_platypusFacing != kDirNone) + _vm->playPlatypusSequence(0x107D5); + else + _vm->playPlatypusSequence(0x107D4); + _vm->platypusWalkTo(8, 7, -1, 0x107D2, 1); + _vm->_gameSys->insertSequence(0xA1, _vm->_gnapId + 1, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceId = 0xA1; + _vm->_platypusSequenceDatNum = 0; + _vm->_platypusId = _vm->_gnapId + 1; + _vm->_gameSys->setAnimation(0xA1, _vm->_gnapId + 1, 1); + _vm->_platypusActionStatus = kAS38PlatypusHoldingTrapDoor; + updateHotspots(); + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) { + _vm->_gameSys->insertSequence(0xA2, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceId = 0xA2; + _vm->_platypusSequenceDatNum = 0; + updateHotspots(); + _vm->_sceneWaiting = true; + } + } +} + +/*****************************************************************************/ + +enum { + kHS39Platypus = 0, + kHS39ExitInsideHouse = 1, + kHS39ExitUfoParty = 2, + kHS39Sign = 3, + kHS39Device = 4, + kHS39WalkArea1 = 5, + kHS39WalkArea2 = 6 +}; + +enum { + kAS39LeaveScene = 0 +}; + +Scene39::Scene39(GnapEngine *vm) : Scene(vm) { + _currGuySequenceId = -1; + _nextGuySequenceId = -1; +} + +int Scene39::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + return 0x35; +} + +void Scene39::updateHotspots() { + _vm->setHotspot(kHS39Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS39ExitInsideHouse, 0, 0, 140, 206, SF_EXIT_U_CURSOR, 4, 8); + _vm->setHotspot(kHS39ExitUfoParty, 360, 204, 480, 430, SF_EXIT_R_CURSOR, 6, 8); + _vm->setHotspot(kHS39Sign, 528, 232, 607, 397, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 3); + _vm->setHotspot(kHS39WalkArea1, 0, 0, 800, 466); + _vm->setHotspot(kHS39WalkArea2, 502, 466, 800, 600); + _vm->setDeviceHotspot(kHS39Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 7; +} + +void Scene39::run() { + // Bug in the original? Timer was never initialized. + _vm->_timers[5] = 0; + + _vm->queueInsertDeviceIcon(); + _currGuySequenceId = 0x33; + + _vm->_gameSys->setAnimation(0x33, 21, 3); + _vm->_gameSys->insertSequence(_currGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x34, 21, 0, 0, kSeqLoop, 0, 0, 0); + + _nextGuySequenceId = -1; + if (_vm->_prevSceneNum == 38) { + _vm->initGnapPos(3, 7, kDirUpRight); + _vm->initPlatypusPos(2, 7, kDirUpLeft); + _vm->endSceneInit(); + } else { + _vm->initGnapPos(4, 7, kDirBottomRight); + _vm->initPlatypusPos(5, 7, kDirNone); + _vm->endSceneInit(); + } + + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x1094B)) { + _vm->playSound(0x1094B, true); + _vm->setSoundVolume(0x1094B, 60); + } + + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 0, -1, -1, -1, -1); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS39Device: + _vm->runMenu(); + updateHotspots(); + _vm->_timers[5] = _vm->getRandom(20) + 50; + break; + + case kHS39Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + } 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(_vm->_platX, _vm->_platY); + break; + } + } + } + break; + + case kHS39ExitUfoParty: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_sceneDone = true; + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kAS39LeaveScene; + _vm->_newSceneNum = 40; + } + break; + + case kHS39Sign: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS39Sign].x, _vm->_hotspotsWalkPos[kHS39Sign].y, 0, -1, 1); + _vm->playGnapIdle(_vm->_hotspotsWalkPos[kHS39Sign].x, _vm->_hotspotsWalkPos[kHS39Sign].y); + _vm->showFullScreenSprite(0x1C); + break; + case GRAB_CURSOR: + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS39ExitInsideHouse: + if (_vm->_gnapActionStatus < 0) { + _vm->_sceneDone = true; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 38; + } + break; + + case kHS39WalkArea1: + case kHS39WalkArea2: + 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->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(20) + 50; + switch (_vm->getRandom(4)) { + case 0: + _nextGuySequenceId = 0x30; + break; + case 1: + _nextGuySequenceId = 0x31; + break; + case 2: + _nextGuySequenceId = 0x32; + break; + case 3: + _nextGuySequenceId = 0x33; + break; + } + } + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[5] = _vm->getRandom(20) + 50; + } + + _vm->gameUpdateTick(); + } +} + +void Scene39::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + if (_vm->_gnapActionStatus == kAS39LeaveScene) + _vm->_sceneDone = true; + else + _vm->_gnapActionStatus = -1; + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _nextGuySequenceId != -1) { + _vm->_gameSys->setAnimation(_nextGuySequenceId, 21, 3); + _vm->_gameSys->insertSequence(_nextGuySequenceId, 21, _currGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _currGuySequenceId = _nextGuySequenceId; + _nextGuySequenceId = -1; + } +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/group3.h b/engines/gnap/scenes/group3.h new file mode 100644 index 0000000000..fa57f1781e --- /dev/null +++ b/engines/gnap/scenes/group3.h @@ -0,0 +1,125 @@ +/* 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_GROUP3_H +#define GNAP_GROUP3_H + +#include "gnap/debugger.h" + +namespace Gnap { + +class GnapEngine; +class CutScene; + +class Scene30: public Scene { +public: + Scene30(GnapEngine *vm); + ~Scene30() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _kidSequenceId; +}; + +class Scene31: public Scene { +public: + Scene31(GnapEngine *vm); + ~Scene31() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + bool _beerGuyDistracted; + int _currClerkSequenceId; + int _nextClerkSequenceId; + int _clerkMeasureCtr; + int _clerkMeasureMaxCtr; +}; + +class Scene32: public Scene { +public: + Scene32(GnapEngine *vm); + ~Scene32() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; +}; + +class Scene33: public Scene { +public: + Scene33(GnapEngine *vm); + ~Scene33() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currChickenSequenceId; + int _nextChickenSequenceId; +}; + +class Scene38: public Scene { +public: + Scene38(GnapEngine *vm); + ~Scene38() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; +}; + +class Scene39: public Scene { +public: + Scene39(GnapEngine *vm); + ~Scene39() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currGuySequenceId; + int _nextGuySequenceId; +}; + +} // End of namespace Gnap + +#endif // GNAP_GROUP3_H diff --git a/engines/gnap/scenes/scene30.cpp b/engines/gnap/scenes/scene30.cpp deleted file mode 100644 index 02a389e571..0000000000 --- a/engines/gnap/scenes/scene30.cpp +++ /dev/null @@ -1,285 +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/scene30.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSPillMachine = 1, - kHSDevice = 2, - kHSExitCircus = 3, - kHSWalkArea1 = 4 -}; - -enum { - kASLeaveScene = 0, - kASUsePillMachine = 1, - kASUsePillMachine2 = 2, - kASLookPillMachine = 3, - kASUsePillMachine3 = 4, - kASUsePillMachine4 = 5 -}; - -Scene30::Scene30(GnapEngine *vm) : Scene(vm) { - _s30_kidSequenceId = -1; -} - -int Scene30::init() { - return _vm->isFlag(kGFUnk23) ? 0x10B : 0x10A; -} - -void Scene30::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSPillMachine, 598, 342, 658, 426, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 7); - _vm->setHotspot(kHSExitCircus, 100, 590 - _vm->_deviceY1, 700, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 514); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 5; -} - -void Scene30::run() { - bool hasTakenPill = false; - - _vm->playSound(0x1093B, true); - _vm->startSoundTimerB(6); - - _vm->queueInsertDeviceIcon(); - - if (_vm->isFlag(kGFUnk23)) - _vm->_gameSys->insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); - - if (!_vm->isFlag(kGFUnk13)) - _vm->_gameSys->insertSequence(0x107, 1, 0, 0, kSeqNone, 0, 0, 0); - _vm->_timers[5] = _vm->getRandom(50) + 180; - - _vm->_gameSys->insertSequence(0x101, 40, 0, 0, kSeqNone, 0, 0, 0); - _vm->_timers[4] = _vm->getRandom(100) + 300; - - _s30_kidSequenceId = 0x101; - _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); - - 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 kHSPillMachine: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole && !_vm->isFlag(kGFUnk23)) { - _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSPillMachine].x, _vm->_hotspotsWalkPos[kHSPillMachine].y, 0, 0x107BC, 1); - _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = kASUsePillMachine; - hasTakenPill = true; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSPillMachine].x, _vm->_hotspotsWalkPos[kHSPillMachine].y, 8, 5); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->gnapWalkTo(9, 8, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kASLookPillMachine; - break; - case GRAB_CURSOR: - _vm->playGnapScratchingHead(8, 5); - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(8, 5); - break; - } - } - } - break; - - case kHSExitCircus: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - if (hasTakenPill) - _vm->_newSceneNum = 47; - else - _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, 0x107C2, 1); - } - 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) { - _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(100) + 300; - if (_vm->_gnapActionStatus < 0) { - if (_vm->getRandom(5) == 1) { - _vm->_gameSys->insertSequence(0xFF, 40, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x100, 40, _s30_kidSequenceId, 40, kSeqSyncWait, 0, 0, 0); - _s30_kidSequenceId = 0x100; - } else { - _vm->_gameSys->insertSequence(0xFE, 40, 0, 0, kSeqNone, 0, 0, 0); - } - } - } - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(50) + 180; - if (_vm->_gnapActionStatus < 0) { - if (!_vm->isFlag(kGFUnk23) || hasTakenPill) - _vm->_gameSys->insertSequence(0x109, 20, 0, 0, kSeqNone, 0, 0, 0); - else - _vm->_gameSys->insertSequence(0x108, 20, 0, 0, kSeqNone, 0, 0, 0); - } - } - _vm->playSoundB(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene30::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASLeaveScene: - _vm->_sceneDone = true; - break; - case kASUsePillMachine: - _vm->setGrabCursorSprite(-1); - _vm->_gameSys->setAnimation(0x105, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x105, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x105; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kASUsePillMachine2; - break; - case kASUsePillMachine2: - _vm->hideCursor(); - _vm->setGrabCursorSprite(-1); - _vm->addFullScreenSprite(0x3F, 255); - _vm->_gameSys->removeSequence(0x105, _vm->_gnapId, true); - _vm->_gameSys->setAnimation(0x102, 256, 0); - _vm->_gameSys->insertSequence(0x102, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) - _vm->gameUpdateTick(); - _vm->_gameSys->setAnimation(0x103, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x103, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); - _vm->removeFullScreenSprite(); - _vm->showCursor(); - _vm->_gnapActionStatus = kASUsePillMachine3; - _vm->invAdd(kItemPill); - _vm->setFlag(kGFUnk23); - break; - case kASUsePillMachine3: - _vm->_gameSys->setAnimation(0x104, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x104, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, 0x103), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x104; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kASUsePillMachine4; - _vm->setGrabCursorSprite(kItemDiceQuarterHole); - break; - case kASUsePillMachine4: - _vm->_gameSys->insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSPillMachine].x, _vm->_hotspotsWalkPos[kHSPillMachine].y + 1, -1, 0x107BC, 1); - _vm->_gnapActionStatus = -1; - break; - case kASLookPillMachine: - if (_vm->isFlag(kGFUnk23)) - _vm->showFullScreenSprite(0xE3); - else - _vm->showFullScreenSprite(0xE2); - _vm->_gnapActionStatus = -1; - break; - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene30.h b/engines/gnap/scenes/scene30.h deleted file mode 100644 index e1b2476a5f..0000000000 --- a/engines/gnap/scenes/scene30.h +++ /dev/null @@ -1,49 +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_SCENE30_H -#define GNAP_SCENE30_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene30: public Scene { -public: - Scene30(GnapEngine *vm); - ~Scene30() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s30_kidSequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE30_H diff --git a/engines/gnap/scenes/scene31.cpp b/engines/gnap/scenes/scene31.cpp deleted file mode 100644 index 0c3a1fa6c7..0000000000 --- a/engines/gnap/scenes/scene31.cpp +++ /dev/null @@ -1,408 +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/scene31.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSMeasuringClown = 1, - kHSBeerBarrel = 2, - kHSDevice = 3, - kHSExitCircus = 4, - kHSExitOutsideClown = 5, - kHSWalkArea1 = 6 -}; - -enum { - kASUseBeerBarrel = 1, - kASFillEmptyBucketWithBeer = 2, - kASFillEmptyBucketWithBeerDone = 3, - kASPlatMeasuringClown = 4, - kASUseMeasuringClown = 5, - kASLeaveScene = 6 -}; - -Scene31::Scene31(GnapEngine *vm) : Scene(vm) { - _s31_beerGuyDistracted = false; - _s31_currClerkSequenceId = -1; - _s31_nextClerkSequenceId = -1; - _s31_clerkMeasureCtr = -1; - _s31_clerkMeasureMaxCtr = 3; -} - -int Scene31::init() { - return 0x105; -} - -void Scene31::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSMeasuringClown, 34, 150, 256, 436, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 6); - _vm->setHotspot(kHSBeerBarrel, 452, 182, 560, 306, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); - _vm->setHotspot(kHSExitCircus, 150, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - _vm->setHotspot(kHSExitOutsideClown, 0, 0, 15, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 480); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 7; -} - -void Scene31::run() { - _vm->playSound(0x1093B, true); - _vm->startSoundTimerB(6); - - _vm->queueInsertDeviceIcon(); - - _s31_beerGuyDistracted = false; - _vm->_gameSys->insertSequence(0xFB, 39, 0, 0, kSeqNone, 0, 0, 0); - - _s31_currClerkSequenceId = 0xFB; - _s31_nextClerkSequenceId = -1; - - _vm->_gameSys->setAnimation(0xFB, 39, 3); - - _vm->_timers[4] = _vm->getRandom(20) + 60; - _vm->_timers[5] = _vm->getRandom(50) + 180; - - if (_vm->_prevSceneNum == 27) { - _vm->initGnapPos(-1, 8, kDirBottomLeft); - _vm->initPlatypusPos(-1, 9, kDirUnk4); - _vm->endSceneInit(); - _vm->gnapWalkTo(3, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(3, 9, -1, 0x107D2, 1); - } else { - _vm->initGnapPos(7, 12, kDirBottomRight); - _vm->initPlatypusPos(6, 12, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(7, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(6, 8, -1, 0x107D2, 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->_gnapActionStatus == kASPlatMeasuringClown) { - _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 kHSMeasuringClown: - if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == kASPlatMeasuringClown) { - if (_vm->_gnapActionStatus == kASPlatMeasuringClown) { - if (_vm->_verbCursor == LOOK_CURSOR) - _vm->playGnapScratchingHead(2, 2); - else - _vm->playGnapImpossible(0, 0); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSMeasuringClown].x, _vm->_hotspotsWalkPos[kHSMeasuringClown].y + 1, 2, 2); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(2, 2); - break; - case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSMeasuringClown].x, _vm->_hotspotsWalkPos[kHSMeasuringClown].y + 1, -1, -1, 1); - _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSMeasuringClown].x, _vm->_hotspotsWalkPos[kHSMeasuringClown].y, 0, 0x107B9, 1); - _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = kASUseMeasuringClown; - _vm->_timers[4] = 300; - break; - case TALK_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - case PLAT_CURSOR: - if (!_vm->invHas(kItemBucketWithBeer)) { - _vm->gnapUseDeviceOnPlatypuss(); - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSMeasuringClown].x, _vm->_hotspotsWalkPos[kHSMeasuringClown].y + 1, 1, 0x107C2, 1); - _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSMeasuringClown].x, _vm->_hotspotsWalkPos[kHSMeasuringClown].y, 1, 0x107C2, 1); - _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - _vm->_platypusActionStatus = kASPlatMeasuringClown; - _vm->_gnapActionStatus = kASPlatMeasuringClown; - _vm->_timers[4] = 300; - } else - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSBeerBarrel: - if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == kASPlatMeasuringClown) { - if (_vm->_grabCursorSpriteIndex == kItemEmptyBucket && _s31_beerGuyDistracted) { - _vm->setGrabCursorSprite(-1); - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, -1, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHSBeerBarrel].x, _vm->_hotspotsWalkPos[kHSBeerBarrel].y) | 0x10000, 1); - _s31_clerkMeasureMaxCtr += 5; - _vm->_gameSys->insertSequence(0xF8, 59, 0, 0, kSeqNone, 0, 0, 0); - _vm->playGnapPullOutDevice(6, 8); - _vm->playGnapUseDevice(0, 0); - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSBeerBarrel].x, _vm->_hotspotsWalkPos[kHSBeerBarrel].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kASFillEmptyBucketWithBeer; - _vm->_timers[4] = 300; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSBeerBarrel].x, _vm->_hotspotsWalkPos[kHSBeerBarrel].y, 6, 2); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(6, 2); - break; - case GRAB_CURSOR: - if (_s31_beerGuyDistracted) { - _vm->playGnapScratchingHead(6, 2); - } else { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSBeerBarrel].x, _vm->_hotspotsWalkPos[kHSBeerBarrel].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kASUseBeerBarrel; - _vm->_gnapIdleFacing = kDirUpLeft; - } - 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, -1, 1); - } - break; - - case kHSExitOutsideClown: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 27; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideClown].x, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y + 1, -1, 0x107CF, 1); - } - 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->_platypusActionStatus < 0) - _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(20) + 60; - if (_vm->_gnapActionStatus < 0 && _s31_nextClerkSequenceId == -1) { - switch (_vm->getRandom(6)){ - case 0: - _s31_nextClerkSequenceId = 0xFF; - break; - case 1: - _s31_nextClerkSequenceId = 0x100; - break; - case 2: - _s31_nextClerkSequenceId = 0x101; - break; - default: - _s31_nextClerkSequenceId = 0xFB; - break; - } - } - } - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(50) + 180; - if (_vm->_gnapActionStatus < 0) { - if (_vm->getRandom(2) != 0) - _vm->_gameSys->insertSequence(0x104, 20, 0, 0, kSeqNone, 0, 0, 0); - else - _vm->_gameSys->insertSequence(0x103, 20, 0, 0, kSeqNone, 0, 0, 0); - } - } - _vm->playSoundB(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene31::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASUseBeerBarrel: - _s31_nextClerkSequenceId = 0xFE; - break; - case kASFillEmptyBucketWithBeer: - _vm->_gameSys->setAnimation(0x102, 59, 0); - _vm->_gameSys->insertSequence(0x102, 59, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapX = 5; - _vm->_gnapY = 7; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x102; - _vm->_gnapId = 59; - _vm->_gnapActionStatus = kASFillEmptyBucketWithBeerDone; - break; - case kASFillEmptyBucketWithBeerDone: - _vm->_gnapIdleFacing = kDirBottomLeft; - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->insertSequence(0xF9, 59, 0xF8, 59, kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = -1; - _vm->invAdd(kItemBucketWithBeer); - _vm->invRemove(kItemEmptyBucket); - _vm->setGrabCursorSprite(kItemBucketWithBeer); - break; - case kASUseMeasuringClown: - _s31_nextClerkSequenceId = 0xFA; - _s31_clerkMeasureMaxCtr = 1; - break; - case kASLeaveScene: - _vm->_sceneDone = true; - _vm->_gnapActionStatus = -1; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); - if (_vm->_platypusActionStatus == kASPlatMeasuringClown) { - _vm->_sceneWaiting = true; - _s31_beerGuyDistracted = true; - _s31_nextClerkSequenceId = 0xFA; - } - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - switch (_s31_nextClerkSequenceId) { - case 0xFA: - _vm->_gameSys->insertSequence(_s31_nextClerkSequenceId, 39, _s31_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xFC, 39, _s31_nextClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0xFC, 39, 3); - _s31_currClerkSequenceId = 0xFC; - _s31_nextClerkSequenceId = 0xFC; - _s31_clerkMeasureCtr = 0; - break; - case 0xFC: - ++_s31_clerkMeasureCtr; - if (_s31_clerkMeasureCtr >= _s31_clerkMeasureMaxCtr) { - if (_vm->_gnapActionStatus != 5) - _vm->_platypusActionStatus = -1; - _vm->_timers[0] = 40; - _vm->_gameSys->insertSequence(0xFD, 39, _s31_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _s31_currClerkSequenceId = 0xFD; - _s31_nextClerkSequenceId = -1; - if (_vm->_gnapActionStatus != kASFillEmptyBucketWithBeerDone && _vm->_gnapActionStatus != kASFillEmptyBucketWithBeer) - _vm->_gnapActionStatus = -1; - _s31_beerGuyDistracted = false; - _s31_clerkMeasureMaxCtr = 3; - _vm->_gameSys->setAnimation(0xFD, 39, 3); - _vm->_sceneWaiting = false; - } else { - _vm->_gameSys->insertSequence(_s31_nextClerkSequenceId, 39, _s31_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _s31_currClerkSequenceId = _s31_nextClerkSequenceId; - _s31_nextClerkSequenceId = 0xFC; - _vm->_gameSys->setAnimation(0xFC, 39, 3); - } - break; - case 0xFE: - _vm->_gameSys->insertSequence(_s31_nextClerkSequenceId, 39, _s31_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s31_nextClerkSequenceId, 39, 3); - _s31_currClerkSequenceId = _s31_nextClerkSequenceId; - _s31_nextClerkSequenceId = -1; - _vm->_gnapActionStatus = -1; - break; - default: - if (_s31_nextClerkSequenceId != -1) { - _vm->_gameSys->insertSequence(_s31_nextClerkSequenceId, 39, _s31_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s31_nextClerkSequenceId, 39, 3); - _s31_currClerkSequenceId = _s31_nextClerkSequenceId; - _s31_nextClerkSequenceId = -1; - } - break; - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene31.h b/engines/gnap/scenes/scene31.h deleted file mode 100644 index 09b7c65696..0000000000 --- a/engines/gnap/scenes/scene31.h +++ /dev/null @@ -1,53 +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_SCENE31_H -#define GNAP_SCENE31_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene31: public Scene { -public: - Scene31(GnapEngine *vm); - ~Scene31() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - bool _s31_beerGuyDistracted; - int _s31_currClerkSequenceId; - int _s31_nextClerkSequenceId; - int _s31_clerkMeasureCtr; - int _s31_clerkMeasureMaxCtr; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE31_H diff --git a/engines/gnap/scenes/scene32.cpp b/engines/gnap/scenes/scene32.cpp deleted file mode 100644 index 75d2efa22b..0000000000 --- a/engines/gnap/scenes/scene32.cpp +++ /dev/null @@ -1,199 +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/scene32.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitTruck = 1, - kHSDevice = 2, - kHSWalkArea1 = 3, - kHSWalkArea2 = 4, - kHSWalkArea3 = 5, - kHSWalkArea4 = 6, - kHSWalkArea5 = 7, - kHSWalkArea6 = 8, - kHSWalkArea7 = 9, - kHSWalkArea8 = 10 -}; - -enum { - kASLeaveScene = 0 -}; - -Scene32::Scene32(GnapEngine *vm) : Scene(vm) { - -} - -int Scene32::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - return _vm->isFlag(kGFPlatypusTalkingToAssistant) ? 0xF : 0x10; -} - -void Scene32::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitTruck, 780, 226, 800, 455, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 6); - _vm->setHotspot(kHSWalkArea1, 0, 0, 162, 426); - _vm->setHotspot(kHSWalkArea2, 162, 0, 237, 396); - _vm->setHotspot(kHSWalkArea3, 237, 0, 319, 363); - _vm->setHotspot(kHSWalkArea4, 520, 0, 800, 404); - _vm->setHotspot(kHSWalkArea5, 300, 447, 800, 600); - _vm->setHotspot(kHSWalkArea6, 678, 0, 800, 404); - _vm->setHotspot(kHSWalkArea7, 0, 0, 520, 351); - _vm->setHotspot(kHSWalkArea8, 0, 546, 300, 600); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 11; -} - -void Scene32::run() { - _vm->playSound(0x1091C, true); - _vm->startSoundTimerC(5); - _vm->queueInsertDeviceIcon(); - _vm->_timers[4] = _vm->getRandom(100) + 300; - - if (_vm->_prevSceneNum == 33) { - _vm->initGnapPos(11, 6, kDirBottomLeft); - _vm->initPlatypusPos(12, 6, kDirUnk4); - _vm->endSceneInit(); - _vm->platypusWalkTo(9, 6, -1, 0x107D2, 1); - _vm->gnapWalkTo(8, 6, -1, 0x107BA, 1); - } else { - _vm->initGnapPos(1, 6, kDirBottomRight); - _vm->initPlatypusPos(1, 7, kDirNone); - _vm->endSceneInit(); - } - - 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 >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - } 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(_vm->_platX, _vm->_platY); - break; - } - } - } - break; - - case kHSExitTruck: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->setGrabCursorSprite(-1); - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitTruck].x, _vm->_hotspotsWalkPos[kHSExitTruck].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitTruck].x, _vm->_hotspotsWalkPos[kHSExitTruck].y + 1, -1, 0x107CD, 1); - _vm->_newSceneNum = 33; - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - case kHSWalkArea3: - case kHSWalkArea4: - case kHSWalkArea5: - case kHSWalkArea6: - case kHSWalkArea7: - case kHSWalkArea8: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - } - - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = 0; - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x1091C)) - _vm->playSound(0x1091C, true); - - if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0) - _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(100) + 300; - if (_vm->getRandom(2) != 0) - _vm->_gameSys->insertSequence(0x0E, 180, 0, 0, kSeqNone, 0, 0, 0); - else - _vm->_gameSys->insertSequence(0x0D, 180, 0, 0, kSeqNone, 0, 0, 0); - } - _vm->playSoundC(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - _vm->gameUpdateTick(); - } -} - -void Scene32::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - if (_vm->_gnapActionStatus == kASLeaveScene) - _vm->_sceneDone = true; - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene32.h b/engines/gnap/scenes/scene32.h deleted file mode 100644 index d96e834091..0000000000 --- a/engines/gnap/scenes/scene32.h +++ /dev/null @@ -1,46 +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_SCENE32_H -#define GNAP_SCENE32_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene32: public Scene { -public: - Scene32(GnapEngine *vm); - ~Scene32() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE32_H diff --git a/engines/gnap/scenes/scene33.cpp b/engines/gnap/scenes/scene33.cpp deleted file mode 100644 index d0dec3f58c..0000000000 --- a/engines/gnap/scenes/scene33.cpp +++ /dev/null @@ -1,328 +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/scene33.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSChicken = 1, - kHSDevice = 2, - kHSExitHouse = 3, - kHSExitBarn = 4, - kHSExitCreek = 5, - kHSExitPigpen = 6, - kHSWalkArea1 = 7, - kHSWalkArea2 = 8 -}; - -enum { - kASLeaveScene = 0, - kASTalkChicken = 1, - kASUseChicken = 2, - kASUseChickenDone = 3 -}; - -Scene33::Scene33(GnapEngine *vm) : Scene(vm) { - _s33_currChickenSequenceId = -1; - _s33_nextChickenSequenceId = -1; -} - -int Scene33::init() { - return _vm->isFlag(kGFPlatypusTalkingToAssistant) ? 0x84 : 0x85; -} - -void Scene33::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSChicken, 606, 455, 702, 568, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); - _vm->setHotspot(kHSExitHouse, 480, 120, 556, 240, SF_EXIT_U_CURSOR, 7, 3); - _vm->setHotspot(kHSExitBarn, 610, 75, 800, 164, SF_EXIT_U_CURSOR, 10, 3); - _vm->setHotspot(kHSExitCreek, 780, 336, 800, 556, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 8); - _vm->setHotspot(kHSExitPigpen, 0, 300, 20, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); - _vm->setHotspot(kHSWalkArea1, 120, 0, 514, 458); - _vm->setHotspot(kHSWalkArea2, 0, 0, 800, 452); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 9; -} - -void Scene33::run() { - _vm->playSound(0x1091C, true); - _vm->startSoundTimerC(6); - _vm->queueInsertDeviceIcon(); - - _s33_currChickenSequenceId = 0x7E; - _vm->_gameSys->setAnimation(0x7E, 179, 2); - _vm->_gameSys->insertSequence(_s33_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); - _s33_nextChickenSequenceId = -1; - _vm->_timers[5] = _vm->getRandom(20) + 30; - _vm->_timers[4] = _vm->getRandom(100) + 300; - - switch (_vm->_prevSceneNum) { - case 34: - _vm->initGnapPos(11, 7, kDirBottomLeft); - _vm->initPlatypusPos(12, 7, kDirUnk4); - _vm->endSceneInit(); - _vm->gnapWalkTo(8, 7, -1, 0x107BA, 1); - _vm->platypusWalkTo(9, 7, -1, 0x107D2, 1); - break; - case 37: - _vm->initGnapPos(7, 7, kDirBottomRight); - _vm->initPlatypusPos(8, 7, kDirNone); - _vm->endSceneInit(); - break; - case 32: - _vm->initGnapPos(-1, 6, kDirBottomRight); - _vm->initPlatypusPos(-1, 7, kDirNone); - _vm->endSceneInit(); - _vm->platypusWalkTo(2, 7, -1, 0x107C2, 1); - _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); - break; - default: - _vm->initGnapPos(3, 7, kDirBottomRight); - _vm->initPlatypusPos(2, 7, kDirNone); - _vm->endSceneInit(); - break; - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - _vm->testWalk(0, 0, 7, 6, 8, 6); - - _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 >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - } 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(_vm->_platX, _vm->_platY); - break; - } - } - } - break; - - case kHSChicken: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(7, 9, 9, 8); - } else { - switch (_vm->_verbCursor) { - case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirBottomRight; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSChicken].x, _vm->_hotspotsWalkPos[kHSChicken].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) - _vm->_gnapActionStatus = kASUseChicken; - else - _vm->_gnapActionStatus = -1; - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSChicken].x, _vm->_hotspotsWalkPos[kHSChicken].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkChicken; - break; - case LOOK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitHouse: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_gnapActionStatus = kASLeaveScene; - _vm->_newSceneNum = 37; - if (_vm->_gnapX > 6) - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107AD, 1); - else - _vm->gnapWalkTo(6, 7, 0, 0x107B1, 1); - } - break; - - case kHSExitBarn: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_gnapActionStatus = kASLeaveScene; - _vm->_newSceneNum = 35; - if (_vm->_gnapX > 7) - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107AD, 1); - else - _vm->gnapWalkTo(7, 7, 0, 0x107B1, 1); - } - break; - - case kHSExitCreek: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitCreek].x, _vm->_hotspotsWalkPos[kHSExitCreek].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitCreek].x, _vm->_hotspotsWalkPos[kHSExitCreek].y, -1, 0x107CD, 1); - _vm->_newSceneNum = 34; - } - break; - - case kHSExitPigpen: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitPigpen].x, _vm->_hotspotsWalkPos[kHSExitPigpen].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitPigpen].x, _vm->_hotspotsWalkPos[kHSExitPigpen].y, -1, 0x107CF, 1); - _vm->_newSceneNum = 32; - } - 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(0x1091C)) - _vm->playSound(0x1091C, true); - - if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0) - _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(100) + 300; - if (_vm->getRandom(2) != 0) - _vm->_gameSys->insertSequence(0x83, 256, 0, 0, kSeqNone, 0, 0, 0); - else - _vm->_gameSys->insertSequence(0x82, 256, 0, 0, kSeqNone, 0, 0, 0); - } - if (!_vm->_timers[5] && _s33_nextChickenSequenceId == -1 && _vm->_gnapActionStatus != kASTalkChicken && _vm->_gnapActionStatus != kASUseChicken) { - if (_vm->getRandom(6) != 0) { - _s33_nextChickenSequenceId = 0x7E; - _vm->_timers[5] = _vm->getRandom(20) + 30; - } else { - _s33_nextChickenSequenceId = 0x80; - _vm->_timers[5] = _vm->getRandom(20) + 50; - } - } - _vm->playSoundC(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - _vm->gameUpdateTick(); - } -} - -void Scene33::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - switch (_vm->_gnapActionStatus) { - case kASLeaveScene: - _vm->_sceneDone = true; - break; - case kASTalkChicken: - _s33_nextChickenSequenceId = 0x7F; - break; - case kASUseChicken: - _s33_nextChickenSequenceId = 0x81; - _vm->_timers[2] = 100; - break; - case kASUseChickenDone: - _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 0x81, 179, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); - _vm->_gnapSequenceId = 0x7B5; - _vm->_gnapSequenceDatNum = 1; - _s33_currChickenSequenceId = 0x7E; - _vm->_gameSys->setAnimation(0x7E, 179, 2); - _vm->_gameSys->insertSequence(_s33_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapActionStatus = -1; - _vm->_timers[5] = 30; - break; - default: - _vm->_gnapActionStatus = -1; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - if (_s33_nextChickenSequenceId == 0x81) { - _vm->_gameSys->setAnimation(_s33_nextChickenSequenceId, 179, 0); - _vm->_gameSys->insertSequence(_s33_nextChickenSequenceId, 179, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(_s33_currChickenSequenceId, 179, true); - _s33_nextChickenSequenceId = -1; - _s33_currChickenSequenceId = -1; - _vm->_gnapActionStatus = kASUseChickenDone; - _vm->_timers[5] = 500; - } else if (_s33_nextChickenSequenceId == 0x7F) { - _vm->_gameSys->setAnimation(_s33_nextChickenSequenceId, 179, 2); - _vm->_gameSys->insertSequence(_s33_nextChickenSequenceId, 179, _s33_currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); - _s33_currChickenSequenceId = _s33_nextChickenSequenceId; - _s33_nextChickenSequenceId = -1; - _vm->_gnapActionStatus = -1; - } else if (_s33_nextChickenSequenceId != -1) { - _vm->_gameSys->setAnimation(_s33_nextChickenSequenceId, 179, 2); - _vm->_gameSys->insertSequence(_s33_nextChickenSequenceId, 179, _s33_currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); - _s33_currChickenSequenceId = _s33_nextChickenSequenceId; - _s33_nextChickenSequenceId = -1; - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene33.h b/engines/gnap/scenes/scene33.h deleted file mode 100644 index 4532a263f1..0000000000 --- a/engines/gnap/scenes/scene33.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_SCENE33_H -#define GNAP_SCENE33_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene33: public Scene { -public: - Scene33(GnapEngine *vm); - ~Scene33() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s33_currChickenSequenceId; - int _s33_nextChickenSequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE33_H diff --git a/engines/gnap/scenes/scene38.cpp b/engines/gnap/scenes/scene38.cpp deleted file mode 100644 index 9360afdd54..0000000000 --- a/engines/gnap/scenes/scene38.cpp +++ /dev/null @@ -1,360 +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/scene38.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitHouse = 1, - kHSExitCave = 2, - kHSTrapDoorLid1 = 3, - kHSTrapDoorLid2 = 4, - kHSHuntingTrophy = 5, - kHSWalkArea1 = 6, - kHSDevice = 7, - kHSWalkArea2 = 8, - kHSWalkArea3 = 9, - kHSWalkArea4 = 10, - kHSWalkArea5 = 11, - kHSWalkArea6 = 12 -}; - -enum { - kASLeaveScene = 0, - kASExitCave = 1, - kASUseHuntingTrophy = 2, - kASHoldingHuntingTrophy = 3, - kASReleaseHuntingTrophy = 4, - kASUsePlatypusWithTrapDoor = 5, - kASPlatypusHoldingTrapDoor = 6 -}; - -Scene38::Scene38(GnapEngine *vm) : Scene(vm) { -} - -int Scene38::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - return 0xA5; -} - -void Scene38::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitHouse, 150, 585, 650, 600, SF_EXIT_D_CURSOR, 0, 8); - _vm->setHotspot(kHSExitCave, 430, 440, 655, 470, SF_WALKABLE, 0, 8); - _vm->setHotspot(kHSTrapDoorLid1, 525, 265, 640, 350, SF_DISABLED); - _vm->setHotspot(kHSTrapDoorLid2, 555, 350, 670, 430, SF_DISABLED); - _vm->setHotspot(kHSHuntingTrophy, 170, 85, 250, 190, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 8); - _vm->setHotspot(kHSWalkArea1, 330, 270, 640, 380, SF_DISABLED | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 8); - _vm->setHotspot(kHSWalkArea2, 0, 0, 799, 396); - _vm->setHotspot(kHSWalkArea3, 0, 585, 799, 599, SF_WALKABLE | SF_DISABLED); - _vm->setHotspot(kHSWalkArea4, 0, 0, 97, 445); - _vm->setHotspot(kHSWalkArea5, 770, 0, 799, 445); - _vm->setHotspot(kHSWalkArea6, 393, 0, 698, 445, SF_WALKABLE | SF_DISABLED); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _vm->_hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_DISABLED; - if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _vm->_hotspots[kHSExitCave]._flags = SF_EXIT_D_CURSOR; - else if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) - _vm->_hotspots[kHSExitCave]._flags = SF_EXIT_D_CURSOR; - if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _vm->_hotspots[kHSTrapDoorLid1]._flags = SF_DISABLED; - else if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) - _vm->_hotspots[kHSTrapDoorLid1]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _vm->_hotspots[kHSTrapDoorLid2]._flags = SF_DISABLED; - else if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) - _vm->_hotspots[kHSTrapDoorLid2]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _vm->_hotspots[kHSWalkArea6]._flags = SF_NONE; - _vm->_hotspotsCount = 13; -} - -void Scene38::run() { - _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); - - if (_vm->_prevSceneNum == 39) { - _vm->initGnapPos(3, 7, kDirBottomLeft); - _vm->initPlatypusPos(4, 7, kDirUnk4); - } else { - _vm->initGnapPos(3, 8, kDirBottomRight); - _vm->initPlatypusPos(4, 8, kDirNone); - } - _vm->endSceneInit(); - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - _vm->runMenu(); - updateHotspots(); - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) { - _vm->_gnapActionStatus = kASReleaseHuntingTrophy; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - } 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(_vm->_platX, _vm->_platY); - break; - } - } - break; - - case kHSExitHouse: - if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) { - _vm->_gnapActionStatus = kASReleaseHuntingTrophy; - } else { - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(-1, -1, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->_newSceneNum = 37; - } - break; - - case kHSExitCave: - if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) { - _vm->_gnapActionStatus = kASReleaseHuntingTrophy; - if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _vm->_isLeavingScene = true; - } else if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) { - _vm->_sceneWaiting = false; - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(5, 7, 0, 0x107BB, 1); - _vm->_newSceneNum = 39; - _vm->_gnapActionStatus = kASExitCave; - } - break; - - case kHSTrapDoorLid1: - case kHSTrapDoorLid2: - if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) { - if (_vm->_verbCursor == PLAT_CURSOR && _vm->_platypusActionStatus != kASPlatypusHoldingTrapDoor) - _vm->_gnapActionStatus = kASUsePlatypusWithTrapDoor; - else - _vm->_gnapActionStatus = kASReleaseHuntingTrophy; - } - break; - - case kHSHuntingTrophy: - if (_vm->_gnapActionStatus != kASHoldingHuntingTrophy) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(3, 6, 2, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(0, 0); - break; - case GRAB_CURSOR: - if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _vm->playGnapImpossible(0, 0); - else { - _vm->gnapWalkTo(3, 6, 0, 0x107BB, 1); - _vm->platypusWalkTo(4, 8, -1, -1, 1); - _vm->_gnapActionStatus = kASUseHuntingTrophy; - } - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(2, 0); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSWalkArea1: - // Nothing - break; - - case kHSWalkArea2: - case kHSWalkArea3: - case kHSWalkArea4: - case kHSWalkArea5: - case kHSWalkArea6: - if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) - _vm->_gnapActionStatus = kASReleaseHuntingTrophy; - else if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left) { - if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) - _vm->_gnapActionStatus = kASReleaseHuntingTrophy; - else if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene38::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASLeaveScene: - _vm->_sceneDone = true; - break; - case kASExitCave: - _vm->_gameSys->removeSequence(_vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, true); - _vm->_gameSys->insertSequence(0xA3, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0xA3; - _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0xA3, _vm->_gnapId, 0); - _vm->_gnapActionStatus = kASLeaveScene; - break; - case kASUseHuntingTrophy: - _vm->_gameSys->removeSequence(0x9B, 0, true); - _vm->_gameSys->insertSequence(0x9C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x9C; - _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x9C, _vm->_gnapId, 0); - _vm->_gnapActionStatus = kASHoldingHuntingTrophy; - updateHotspots(); - break; - case kASHoldingHuntingTrophy: - if (_vm->_platypusActionStatus != kASPlatypusHoldingTrapDoor) - _vm->_sceneWaiting = true; - if (_vm->_gnapSequenceId == 0xA4) { - _vm->_gameSys->insertSequence(0x9D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x9D; - } else { - _vm->_gameSys->insertSequence(0xA4, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0xA4; - } - _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(_vm->_gnapSequenceId, _vm->_gnapId, 0); - break; - case kASReleaseHuntingTrophy: - if (_vm->_gnapSequenceId == 0x9E) { - _vm->_gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapActionStatus = -1; - } else if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) { - _vm->_gameSys->insertSequence(0xA0, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0xA0; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapX = 3; - _vm->_gnapY = 6; - _vm->_gnapIdleFacing = kDirBottomRight; - if (_vm->_isLeavingScene) { - _vm->_sceneWaiting = false; - _vm->gnapWalkTo(5, 7, 0, 0x107BB, 1); - _vm->_newSceneNum = 39; - _vm->_gnapActionStatus = kASExitCave; - } else { - _vm->_gnapActionStatus = -1; - } - } else { - _vm->_gameSys->insertSequence(0x9E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x9E; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapX = 3; - _vm->_gnapY = 6; - _vm->_gnapIdleFacing = kDirBottomRight; - _vm->_gameSys->setAnimation(0x9E, _vm->_gnapId, 0); - _vm->_sceneWaiting = false; - updateHotspots(); - } - break; - case kASUsePlatypusWithTrapDoor: - _vm->_sceneWaiting = false; - _vm->_gameSys->insertSequence(0x9F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x9F; - _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x9F, _vm->_gnapId, 0); - _vm->_gnapActionStatus = kASHoldingHuntingTrophy; - if (_vm->_platypusFacing != kDirNone) - _vm->playPlatypusSequence(0x107D5); - else - _vm->playPlatypusSequence(0x107D4); - _vm->platypusWalkTo(8, 7, -1, 0x107D2, 1); - _vm->_gameSys->insertSequence(0xA1, _vm->_gnapId + 1, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceId = 0xA1; - _vm->_platypusSequenceDatNum = 0; - _vm->_platypusId = _vm->_gnapId + 1; - _vm->_gameSys->setAnimation(0xA1, _vm->_gnapId + 1, 1); - _vm->_platypusActionStatus = kASPlatypusHoldingTrapDoor; - updateHotspots(); - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); - if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) { - _vm->_gameSys->insertSequence(0xA2, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceId = 0xA2; - _vm->_platypusSequenceDatNum = 0; - updateHotspots(); - _vm->_sceneWaiting = true; - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene38.h b/engines/gnap/scenes/scene38.h deleted file mode 100644 index 8ad8e73fa3..0000000000 --- a/engines/gnap/scenes/scene38.h +++ /dev/null @@ -1,46 +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_SCENE38_H -#define GNAP_SCENE38_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene38: public Scene { -public: - Scene38(GnapEngine *vm); - ~Scene38() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE38_H diff --git a/engines/gnap/scenes/scene39.cpp b/engines/gnap/scenes/scene39.cpp deleted file mode 100644 index cfbdd5721a..0000000000 --- a/engines/gnap/scenes/scene39.cpp +++ /dev/null @@ -1,242 +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/scene39.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitInsideHouse = 1, - kHSExitUfoParty = 2, - kHSSign = 3, - kHSDevice = 4, - kHSWalkArea1 = 5, - kHSWalkArea2 = 6 -}; - -enum { - kASLeaveScene = 0 -}; - -Scene39::Scene39(GnapEngine *vm) : Scene(vm) { - _s39_currGuySequenceId = -1; - _s39_nextGuySequenceId = -1; -} - -int Scene39::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - return 0x35; -} - -void Scene39::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitInsideHouse, 0, 0, 140, 206, SF_EXIT_U_CURSOR, 4, 8); - _vm->setHotspot(kHSExitUfoParty, 360, 204, 480, 430, SF_EXIT_R_CURSOR, 6, 8); - _vm->setHotspot(kHSSign, 528, 232, 607, 397, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 3); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 466); - _vm->setHotspot(kHSWalkArea2, 502, 466, 800, 600); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 7; -} - -void Scene39::run() { - // Bug in the original? Timer was never initialized. - _vm->_timers[5] = 0; - - _vm->queueInsertDeviceIcon(); - _s39_currGuySequenceId = 0x33; - - _vm->_gameSys->setAnimation(0x33, 21, 3); - _vm->_gameSys->insertSequence(_s39_currGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x34, 21, 0, 0, kSeqLoop, 0, 0, 0); - - _s39_nextGuySequenceId = -1; - if (_vm->_prevSceneNum == 38) { - _vm->initGnapPos(3, 7, kDirUpRight); - _vm->initPlatypusPos(2, 7, kDirUpLeft); - _vm->endSceneInit(); - } else { - _vm->initGnapPos(4, 7, kDirBottomRight); - _vm->initPlatypusPos(5, 7, kDirNone); - _vm->endSceneInit(); - } - - while (!_vm->_sceneDone) { - if (!_vm->isSoundPlaying(0x1094B)) { - _vm->playSound(0x1094B, true); - _vm->setSoundVolume(0x1094B, 60); - } - - _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: - _vm->runMenu(); - updateHotspots(); - _vm->_timers[5] = _vm->getRandom(20) + 50; - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - } 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(_vm->_platX, _vm->_platY); - break; - } - } - } - break; - - case kHSExitUfoParty: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_sceneDone = true; - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->_newSceneNum = 40; - } - break; - - case kHSSign: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSSign].x, _vm->_hotspotsWalkPos[kHSSign].y, 0, -1, 1); - _vm->playGnapIdle(_vm->_hotspotsWalkPos[kHSSign].x, _vm->_hotspotsWalkPos[kHSSign].y); - _vm->showFullScreenSprite(0x1C); - break; - case GRAB_CURSOR: - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitInsideHouse: - if (_vm->_gnapActionStatus < 0) { - _vm->_sceneDone = true; - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 38; - } - 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->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0) - _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(20) + 50; - switch (_vm->getRandom(4)) { - case 0: - _s39_nextGuySequenceId = 0x30; - break; - case 1: - _s39_nextGuySequenceId = 0x31; - break; - case 2: - _s39_nextGuySequenceId = 0x32; - break; - case 3: - _s39_nextGuySequenceId = 0x33; - break; - } - } - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - _vm->_timers[5] = _vm->getRandom(20) + 50; - } - - _vm->gameUpdateTick(); - } -} - -void Scene39::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - if (_vm->_gnapActionStatus == kASLeaveScene) - _vm->_sceneDone = true; - else - _vm->_gnapActionStatus = -1; - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s39_nextGuySequenceId != -1) { - _vm->_gameSys->setAnimation(_s39_nextGuySequenceId, 21, 3); - _vm->_gameSys->insertSequence(_s39_nextGuySequenceId, 21, _s39_currGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _s39_currGuySequenceId = _s39_nextGuySequenceId; - _s39_nextGuySequenceId = -1; - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene39.h b/engines/gnap/scenes/scene39.h deleted file mode 100644 index 68dfdfd8e4..0000000000 --- a/engines/gnap/scenes/scene39.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_SCENE39_H -#define GNAP_SCENE39_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene39: public Scene { -public: - Scene39(GnapEngine *vm); - ~Scene39() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s39_currGuySequenceId; - int _s39_nextGuySequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE39_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 52925ca08d..a9024b581b 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -29,14 +29,9 @@ #include "gnap/scenes/group0.h" #include "gnap/scenes/group1.h" #include "gnap/scenes/group2.h" +#include "gnap/scenes/group3.h" #include "gnap/scenes/intro.h" -#include "gnap/scenes/scene30.h" -#include "gnap/scenes/scene31.h" -#include "gnap/scenes/scene32.h" -#include "gnap/scenes/scene33.h" -#include "gnap/scenes/scene38.h" -#include "gnap/scenes/scene39.h" #include "gnap/scenes/scene40.h" #include "gnap/scenes/scene41.h" #include "gnap/scenes/scene42.h" |