diff options
author | Strangerke | 2016-04-23 10:23:49 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-05-10 09:54:21 +0200 |
commit | 4c7756e75dcd3f7f9ad24e52e849e60936c8381d (patch) | |
tree | aad61ad946711c1b5e7ee2ebead5491a8c1b6aa9 /engines | |
parent | c8f4fce89551cc1332f65ebce2cc02e75d74c332 (diff) | |
download | scummvm-rg350-4c7756e75dcd3f7f9ad24e52e849e60936c8381d.tar.gz scummvm-rg350-4c7756e75dcd3f7f9ad24e52e849e60936c8381d.tar.bz2 scummvm-rg350-4c7756e75dcd3f7f9ad24e52e849e60936c8381d.zip |
GNAP: Refactor scenes 19 and 20
Diffstat (limited to 'engines')
-rw-r--r-- | engines/gnap/gnap.cpp | 10 | ||||
-rw-r--r-- | engines/gnap/gnap.h | 23 | ||||
-rw-r--r-- | engines/gnap/scenes/scene19.cpp | 409 | ||||
-rw-r--r-- | engines/gnap/scenes/scene19.h | 54 | ||||
-rw-r--r-- | engines/gnap/scenes/scene20.cpp | 706 | ||||
-rw-r--r-- | engines/gnap/scenes/scene20.h | 57 | ||||
-rw-r--r-- | engines/gnap/scenes/scenecore.cpp | 18 |
7 files changed, 681 insertions, 596 deletions
diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 82035ebef8..286bb7316d 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2021,16 +2021,6 @@ void GnapEngine::initGlobalSceneVars() { // Scene 18 _s18_garbageCanPos = 8; - // Scene 19 - _s19_toyGrabCtr = 0; - _s19_pictureSurface = 0; - _s19_shopAssistantCtr = 0; - - // Scene 20 - _s20_stonerGuyCtr = 3; - _s20_stonerGuyShowingJoint = false; - _s20_groceryStoreGuyCtr = 0; - // Scene 22 _s22_caughtBefore = false; _s22_cashierCtr = 3; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 7d8edd3697..b61f93c2d5 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -606,29 +606,6 @@ public: // Scene 18 int _s18_garbageCanPos; - // Scene 19 - int _s19_currShopAssistantSequenceId, _s19_nextShopAssistantSequenceId; - int _s19_toyGrabCtr; - int _s19_shopAssistantCtr; - Graphics::Surface *_s19_pictureSurface; - int scene19_init(); - void scene19_updateHotspots(); - void scene19_run(); - void scene19_updateAnimations(); - - // Scene 20 - int _s20_currStonerGuySequenceId, _s20_nextStonerGuySequenceId; - int _s20_currGroceryStoreGuySequenceId, _s20_nextGroceryStoreGuySequenceId; - int _s20_stonerGuyCtr; - bool _s20_stonerGuyShowingJoint; - int _s20_groceryStoreGuyCtr; - int scene20_init(); - void scene20_updateHotspots(); - void scene20_updateAnimationsCb(); - void scene20_stopSounds(); - void scene20_run(); - void scene20_updateAnimations(); - // Scene 21 int _s21_currOldLadySequenceId, _s21_nextOldLadySequenceId; int scene21_init(); diff --git a/engines/gnap/scenes/scene19.cpp b/engines/gnap/scenes/scene19.cpp index 4de51f8ca4..cb5cd6d16d 100644 --- a/engines/gnap/scenes/scene19.cpp +++ b/engines/gnap/scenes/scene19.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene19.h" namespace Gnap { @@ -58,120 +59,128 @@ enum { kASLeaveScene = 5 }; -int GnapEngine::scene19_init() { - playSound(0x79, false); - return isFlag(kGFPlatypusTalkingToAssistant) ? 0x77 : 0x76; +Scene19::Scene19(GnapEngine *vm) : Scene(vm) { + _s19_toyGrabCtr = 0; + _s19_pictureSurface = 0; + _s19_shopAssistantCtr = 0; + _s19_pictureSurface = nullptr; } -void GnapEngine::scene19_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitOutsideToyStore, 36, 154, 142, 338, SF_EXIT_NW_CURSOR, 4, 6); - setHotspot(kHSPicture, 471, 237, 525, 283, SF_DISABLED, 7, 2); - setHotspot(kHSShopAssistant, 411, 151, 575, 279, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); - setHotspot(kHSPhone, 647, 166, 693, 234, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 0); - setHotspot(kHSToy1, 181, 11, 319, 149, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 0); - setHotspot(kHSToy2, 284, 85, 611, 216, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 0); - setHotspot(kHSToy3, 666, 38, 755, 154, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 0); - setHotspot(kHSToy4, 154, 206, 285, 327, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 3); - setHotspot(kHSToy5, 494, 301, 570, 448, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 5); - setHotspot(kHSToy6, 0, 320, 188, 600, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 6); - setHotspot(kHSToy7, 597, 434, 800, 600, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 8); - setHotspot(kHSWalkArea1, 0, 0, 170, 600); - setHotspot(kHSWalkArea2, 622, 0, 800, 600); - setHotspot(kHSWalkArea3, 0, 0, 800, 437); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(kGFPlatypusTalkingToAssistant)) { - _hotspots[kHSToy1]._flags = SF_DISABLED; - _hotspots[kHSToy2]._flags = SF_DISABLED; - _hotspots[kHSToy3]._flags = SF_DISABLED; - _hotspots[kHSToy4]._flags = SF_DISABLED; - _hotspots[kHSToy5]._flags = SF_DISABLED; - _hotspots[kHSToy6]._flags = SF_DISABLED; - _hotspots[kHSToy7]._flags = SF_DISABLED; - _hotspots[kHSShopAssistant]._flags = SF_DISABLED; - _hotspots[kHSPhone]._flags = SF_DISABLED; - _hotspots[kHSPlatypus]._flags = SF_DISABLED; - _hotspots[kHSPicture]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - } - _hotspotsCount = 16; +Scene19::~Scene19() { + delete _s19_pictureSurface; +} + +int Scene19::init() { + _vm->playSound(0x79, false); + return _vm->isFlag(kGFPlatypusTalkingToAssistant) ? 0x77 : 0x76; } -void GnapEngine::scene19_run() { +void Scene19::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitOutsideToyStore, 36, 154, 142, 338, SF_EXIT_NW_CURSOR, 4, 6); + _vm->setHotspot(kHSPicture, 471, 237, 525, 283, SF_DISABLED, 7, 2); + _vm->setHotspot(kHSShopAssistant, 411, 151, 575, 279, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); + _vm->setHotspot(kHSPhone, 647, 166, 693, 234, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 0); + _vm->setHotspot(kHSToy1, 181, 11, 319, 149, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 0); + _vm->setHotspot(kHSToy2, 284, 85, 611, 216, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 0); + _vm->setHotspot(kHSToy3, 666, 38, 755, 154, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 0); + _vm->setHotspot(kHSToy4, 154, 206, 285, 327, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 3); + _vm->setHotspot(kHSToy5, 494, 301, 570, 448, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 5); + _vm->setHotspot(kHSToy6, 0, 320, 188, 600, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 6); + _vm->setHotspot(kHSToy7, 597, 434, 800, 600, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 8); + _vm->setHotspot(kHSWalkArea1, 0, 0, 170, 600); + _vm->setHotspot(kHSWalkArea2, 622, 0, 800, 600); + _vm->setHotspot(kHSWalkArea3, 0, 0, 800, 437); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { + _vm->_hotspots[kHSToy1]._flags = SF_DISABLED; + _vm->_hotspots[kHSToy2]._flags = SF_DISABLED; + _vm->_hotspots[kHSToy3]._flags = SF_DISABLED; + _vm->_hotspots[kHSToy4]._flags = SF_DISABLED; + _vm->_hotspots[kHSToy5]._flags = SF_DISABLED; + _vm->_hotspots[kHSToy6]._flags = SF_DISABLED; + _vm->_hotspots[kHSToy7]._flags = SF_DISABLED; + _vm->_hotspots[kHSShopAssistant]._flags = SF_DISABLED; + _vm->_hotspots[kHSPhone]._flags = SF_DISABLED; + _vm->_hotspots[kHSPlatypus]._flags = SF_DISABLED; + _vm->_hotspots[kHSPicture]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + } + _vm->_hotspotsCount = 16; +} - queueInsertDeviceIcon(); +void Scene19::run() { + _vm->queueInsertDeviceIcon(); _s19_toyGrabCtr = 0; _s19_pictureSurface = 0; - _gameSys->insertSequence(0x74, 254, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x75, 254, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x74, 254, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x75, 254, 0, 0, kSeqNone, 0, 0, 0); - if (!isFlag(kGFPictureTaken)) - _gameSys->insertSequence(0x69, 19, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->isFlag(kGFPictureTaken)) + _vm->_gameSys->insertSequence(0x69, 19, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(kGFPlatypusTalkingToAssistant)) { - initGnapPos(3, 6, kDirBottomRight); - _s19_currShopAssistantSequenceId = kS19ShopAssistantSequenceIds[getRandom(5)]; + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { + _vm->initGnapPos(3, 6, kDirBottomRight); + _s19_currShopAssistantSequenceId = kS19ShopAssistantSequenceIds[_vm->getRandom(5)]; _s19_nextShopAssistantSequenceId = _s19_currShopAssistantSequenceId; - _gameSys->setAnimation(_s19_currShopAssistantSequenceId, 20, 4); - _gameSys->insertSequence(0x6E, 254, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(_s19_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(_s19_currShopAssistantSequenceId, 20, 4); + _vm->_gameSys->insertSequence(0x6E, 254, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(_s19_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); _s19_shopAssistantCtr = 0; - endSceneInit(); - gnapWalkTo(4, 9, -1, 0x107B9, 1); - scene19_updateHotspots(); + _vm->endSceneInit(); + _vm->gnapWalkTo(4, 9, -1, 0x107B9, 1); + updateHotspots(); } else { _s19_currShopAssistantSequenceId = 0x6D; _s19_nextShopAssistantSequenceId = -1; - _gameSys->setAnimation(0x6D, 20, 4); - _gameSys->insertSequence(_s19_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); - _timers[6] = getRandom(40) + 50; - initGnapPos(3, 6, kDirBottomRight); - initPlatypusPos(4, 6, kDirNone); - endSceneInit(); - gnapWalkTo(4, 9, -1, 0x107B9, 1); - platypusWalkTo(5, 9, -1, 0x107C2, 1); + _vm->_gameSys->setAnimation(0x6D, 20, 4); + _vm->_gameSys->insertSequence(_s19_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); + _vm->_timers[6] = _vm->getRandom(40) + 50; + _vm->initGnapPos(3, 6, kDirBottomRight); + _vm->initPlatypusPos(4, 6, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(4, 9, -1, 0x107B9, 1); + _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); } - while (!_sceneDone) { - - updateMouseCursor(); - updateCursorByHotspot(); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - testWalk(0, 5, -1, -1, -1, -1); + _vm->testWalk(0, 5, -1, -1, -1, -1); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); - - switch (_sceneClickedHotspot) { + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene19_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemJoint) { - gnapUseJointOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(_platX, _platY); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -179,38 +188,38 @@ void GnapEngine::scene19_run() { break; case kHSExitOutsideToyStore: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 18; - _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - gnapWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y, 0, 0x107B2, 1); - _gnapActionStatus = kASLeaveScene; - if (isFlag(kGFPlatypusTalkingToAssistant)) - setFlag(kGFUnk27); + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 18; + _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, 0x107B2, 1); + _vm->_gnapActionStatus = kASLeaveScene; + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) + _vm->setFlag(kGFUnk27); else - platypusWalkTo(_hotspotsWalkPos[1].x + 1, _hotspotsWalkPos[1].y, -1, 0x107C5, 1); - _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[1].x + 1, _vm->_hotspotsWalkPos[1].y, -1, 0x107C5, 1); + _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; } break; case kHSPicture: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 6, 2); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(6, 2); + _vm->playGnapScratchingHead(6, 2); break; case GRAB_CURSOR: - if (!isFlag(kGFPictureTaken)) { - gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y) | 0x10000, 1); - _gnapActionStatus = kASGrabPicture; + if (!_vm->isFlag(kGFPictureTaken)) { + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y) | 0x10000, 1); + _vm->_gnapActionStatus = kASGrabPicture; } break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -218,22 +227,22 @@ void GnapEngine::scene19_run() { break; case kHSShopAssistant: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 6, 2); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(6, 2); + _vm->playGnapScratchingHead(6, 2); break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASTalkShopAssistant; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASTalkShopAssistant; break; case GRAB_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -247,22 +256,22 @@ void GnapEngine::scene19_run() { case kHSToy5: case kHSToy6: case kHSToy7: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan2(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y); + _vm->playGnapMoan2(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); break; case GRAB_CURSOR: - gnapWalkTo(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 0, -1, 1); - playGnapIdle(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y); - _gnapActionStatus = kASGrabToy; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, -1, 1); + _vm->playGnapIdle(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); + _vm->_gnapActionStatus = kASGrabToy; break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -270,22 +279,22 @@ void GnapEngine::scene19_run() { break; case kHSPhone: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 9, 1); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 9, 1); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(9, 1); + _vm->playGnapScratchingHead(9, 1); break; case GRAB_CURSOR: - gnapWalkTo(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 0, -1, 1); - playGnapIdle(8, 2); - _gnapActionStatus = kASUsePhone; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, -1, 1); + _vm->playGnapIdle(8, 2); + _vm->_gnapActionStatus = kASUsePhone; break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -295,28 +304,28 @@ void GnapEngine::scene19_run() { case kHSWalkArea1: case kHSWalkArea2: case kHSWalkArea3: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = 0; + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = 0; } } - scene19_updateAnimations(); + updateAnimations(); - if (!_isLeavingScene) { - updateGnapIdleSequence(); - if (!isFlag(kGFPlatypusTalkingToAssistant)) { - updatePlatypusIdleSequence(); - if (!_timers[6] && _s19_nextShopAssistantSequenceId == -1) { - _timers[6] = getRandom(40) + 50; - if (getRandom(4) != 0) { + if (!_vm->_isLeavingScene) { + _vm->updateGnapIdleSequence(); + if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) { + _vm->updatePlatypusIdleSequence(); + if (!_vm->_timers[6] && _s19_nextShopAssistantSequenceId == -1) { + _vm->_timers[6] = _vm->getRandom(40) + 50; + if (_vm->getRandom(4) != 0) { _s19_nextShopAssistantSequenceId = 0x64; - } else if (isFlag(kGFPictureTaken)) { + } else if (_vm->isFlag(kGFPictureTaken)) { _s19_nextShopAssistantSequenceId = 0x64; } else { _s19_nextShopAssistantSequenceId = 0x6C; @@ -324,29 +333,26 @@ void GnapEngine::scene19_run() { } } } + + _vm->checkGameKeys(); - checkGameKeys(); - - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene19_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); - + _vm->gameUpdateTick(); } if (_s19_pictureSurface) - deleteSurface(&_s19_pictureSurface); - + _vm->deleteSurface(&_s19_pictureSurface); } -void GnapEngine::scene19_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene19::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASUsePhone: _s19_nextShopAssistantSequenceId = 0x67; break; @@ -368,43 +374,43 @@ void GnapEngine::scene19_updateAnimations() { } break; case kASGrabPicture: - playGnapPullOutDevice(6, 2); - playGnapUseDevice(0, 0); - _gameSys->setAnimation(0x68, 19, 0); - _gameSys->insertSequence(0x68, 19, 105, 19, kSeqSyncWait, 0, 0, 0); - invAdd(kItemPicture); - setFlag(kGFPictureTaken); - scene19_updateHotspots(); - _gnapActionStatus = kASGrabPictureDone; + _vm->playGnapPullOutDevice(6, 2); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->setAnimation(0x68, 19, 0); + _vm->_gameSys->insertSequence(0x68, 19, 105, 19, kSeqSyncWait, 0, 0, 0); + _vm->invAdd(kItemPicture); + _vm->setFlag(kGFPictureTaken); + updateHotspots(); + _vm->_gnapActionStatus = kASGrabPictureDone; break; case kASGrabPictureDone: - setGrabCursorSprite(-1); - hideCursor(); - _s19_pictureSurface = addFullScreenSprite(0xF, 255); - _gameSys->setAnimation(0x61, 256, 0); - _gameSys->insertSequence(0x61, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_gameSys->getAnimationStatus(0) != 2) { + _vm->setGrabCursorSprite(-1); + _vm->hideCursor(); + _s19_pictureSurface = _vm->addFullScreenSprite(0xF, 255); + _vm->_gameSys->setAnimation(0x61, 256, 0); + _vm->_gameSys->insertSequence(0x61, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(0) != 2) { // checkGameAppStatus(); - gameUpdateTick(); + _vm->gameUpdateTick(); } - setFlag(kGFUnk27); - showCursor(); - _newSceneNum = 17; - _isLeavingScene = true; - _sceneDone = true; + _vm->setFlag(kGFUnk27); + _vm->showCursor(); + _vm->_newSceneNum = 17; + _vm->_isLeavingScene = true; + _vm->_sceneDone = true; _s19_nextShopAssistantSequenceId = -1; break; case kASTalkShopAssistant: _s19_nextShopAssistantSequenceId = 0x6D; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; } } - if (_gameSys->getAnimationStatus(4) == 2) { + if (_vm->_gameSys->getAnimationStatus(4) == 2) { switch (_s19_nextShopAssistantSequenceId) { case 0x6F: case 0x70: @@ -413,58 +419,57 @@ void GnapEngine::scene19_updateAnimations() { case 0x73: _s19_shopAssistantCtr = (_s19_shopAssistantCtr + 1) % 5; _s19_nextShopAssistantSequenceId = kS19ShopAssistantSequenceIds[_s19_shopAssistantCtr]; - _gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); - _gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x6E, 254, 0x6E, 254, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); + _vm->_gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x6E, 254, 0x6E, 254, kSeqSyncWait, 0, 0, 0); _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; break; case 0x62: case 0x66: case 0x6B: - _gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); - _gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); + _vm->_gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; _s19_nextShopAssistantSequenceId = -1; - _timers[5] = 10; - while (_timers[5]) { - gameUpdateTick(); + _vm->_timers[5] = 10; + while (_vm->_timers[5]) { + _vm->gameUpdateTick(); } - playGnapIdle(6, 2); - _gnapActionStatus = -1; + _vm->playGnapIdle(6, 2); + _vm->_gnapActionStatus = -1; break; case 0x67: - _gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); - _gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); + _vm->_gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; _s19_nextShopAssistantSequenceId = -1; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case 0x65: - playGnapIdle(6, 2); - _gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 0); - _gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->playGnapIdle(6, 2); + _vm->_gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 0); + _vm->_gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; _s19_nextShopAssistantSequenceId = -1; - _newSceneNum = 18; - _gnapActionStatus = kASLeaveScene; + _vm->_newSceneNum = 18; + _vm->_gnapActionStatus = kASLeaveScene; break; case 0x6D: - _gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); - _gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x69, 19, 0x69, 19, kSeqSyncWait, getSequenceTotalDuration(_s19_nextShopAssistantSequenceId), 0, 0); + _vm->_gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); + _vm->_gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x69, 19, 0x69, 19, kSeqSyncWait, _vm->getSequenceTotalDuration(_s19_nextShopAssistantSequenceId), 0, 0); _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; _s19_nextShopAssistantSequenceId = -1; break; case 0x64: case 0x6C: - _gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); - _gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); + _vm->_gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; _s19_nextShopAssistantSequenceId = -1; break; } } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene19.h b/engines/gnap/scenes/scene19.h new file mode 100644 index 0000000000..721b107cf5 --- /dev/null +++ b/engines/gnap/scenes/scene19.h @@ -0,0 +1,54 @@ +/* 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_SCENE19_H +#define GNAP_SCENE19_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene19: public Scene { +public: + Scene19(GnapEngine *vm); + ~Scene19(); + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s19_currShopAssistantSequenceId; + int _s19_nextShopAssistantSequenceId; + int _s19_toyGrabCtr; + int _s19_shopAssistantCtr; + + Graphics::Surface *_s19_pictureSurface; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE19_H diff --git a/engines/gnap/scenes/scene20.cpp b/engines/gnap/scenes/scene20.cpp index 54a8438345..c31f6229cb 100644 --- a/engines/gnap/scenes/scene20.cpp +++ b/engines/gnap/scenes/scene20.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene20.h" namespace Gnap { @@ -55,71 +56,76 @@ enum { kASGrabJointDone = 13 }; -int GnapEngine::scene20_init() { - return 0x186; +Scene20::Scene20(GnapEngine *vm) : Scene(vm) { + _s20_stonerGuyCtr = 3; + _s20_stonerGuyShowingJoint = false; + _s20_groceryStoreGuyCtr = 0; } -void GnapEngine::scene20_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSGroceryStoreHat, 114, 441, 174, 486, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 7); - setHotspot(kHSExitParkingLot, 0, 300, 15, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 7); - setHotspot(kHSStonerGuy, 276, 290, 386, 450, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 8); - setHotspot(kHSGroceryStoreGuy, 123, 282, 258, 462, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); - setHotspot(kHSExitInsideGrubCity, 519, 250, 581, 413, SF_EXIT_L_CURSOR, 8, 7); - setHotspot(kHSExitOutsideCircusWorld, 660, 222, 798, 442, SF_EXIT_NE_CURSOR, 9, 6); - setHotspot(kHSExitOutsideToyStore, 785, 350, 800, 600, SF_EXIT_R_CURSOR, 11, 8); - setHotspot(kHSExitPhone, 250, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 10); - setHotspot(kHSWalkArea1, 0, 0, 800, 468); - setHotspot(kHSWalkArea2, 605, 0, 800, 600); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _hotspotsCount = 12; +int Scene20::init() { + return 0x186; } -void GnapEngine::scene20_updateAnimationsCb() { +void Scene20::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSGroceryStoreHat, 114, 441, 174, 486, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 7); + _vm->setHotspot(kHSExitParkingLot, 0, 300, 15, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 7); + _vm->setHotspot(kHSStonerGuy, 276, 290, 386, 450, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 8); + _vm->setHotspot(kHSGroceryStoreGuy, 123, 282, 258, 462, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); + _vm->setHotspot(kHSExitInsideGrubCity, 519, 250, 581, 413, SF_EXIT_L_CURSOR, 8, 7); + _vm->setHotspot(kHSExitOutsideCircusWorld, 660, 222, 798, 442, SF_EXIT_NE_CURSOR, 9, 6); + _vm->setHotspot(kHSExitOutsideToyStore, 785, 350, 800, 600, SF_EXIT_R_CURSOR, 11, 8); + _vm->setHotspot(kHSExitPhone, 250, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 10); + _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 468); + _vm->setHotspot(kHSWalkArea2, 605, 0, 800, 600); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 12; +} - if (_gameSys->getAnimationStatus(2) == 2) { +void Scene20::updateAnimationsCb() { + if (_vm->_gameSys->getAnimationStatus(2) == 2) { switch (_s20_nextStonerGuySequenceId) { case 0x16B: - if (!_timers[4]) { + if (!_vm->_timers[4]) { _s20_stonerGuyShowingJoint = false; - _gameSys->insertSequence(0x16B, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x16B, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _s20_currStonerGuySequenceId = 0x16B; _s20_nextStonerGuySequenceId = -1; } break; case 0x16A: // Grab joint - playGnapPullOutDevice(4, 4); - playGnapUseDevice(0, 0); - _gameSys->setAnimation(0x16A, 21, 0); - _gameSys->insertSequence(0x16A, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _vm->playGnapPullOutDevice(4, 4); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->setAnimation(0x16A, 21, 0); + _vm->_gameSys->insertSequence(0x16A, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _s20_currStonerGuySequenceId = 0x16A; _s20_nextStonerGuySequenceId = -1; - invAdd(kItemJoint); - setFlag(kGFJointTaken); + _vm->invAdd(kItemJoint); + _vm->setFlag(kGFJointTaken); _s20_stonerGuyShowingJoint = false; - _gnapActionStatus = kASGrabJointDone; + _vm->_gnapActionStatus = kASGrabJointDone; break; case 0x16E: - _gameSys->setAnimation(0x16E, 21, 2); - _gameSys->insertSequence(0x16E, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x16E, 21, 2); + _vm->_gameSys->insertSequence(0x16E, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _s20_currStonerGuySequenceId = 0x16E; _s20_nextStonerGuySequenceId = -1; _s20_nextGroceryStoreGuySequenceId = 0x175; break; case 0x16D: - _gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 2); - _gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 0); - _gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 2); + _vm->_gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 0); + _vm->_gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _s20_currStonerGuySequenceId = _s20_nextStonerGuySequenceId; _s20_nextStonerGuySequenceId = -1; - _gnapActionStatus = kASActionDone; + _vm->_gnapActionStatus = kASActionDone; break; case 0x16F: - _gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 2); - _gameSys->setAnimation(0x17A, 20, 3); - _gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x17A, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 2); + _vm->_gameSys->setAnimation(0x17A, 20, 3); + _vm->_gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x17A, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); _s20_currGroceryStoreGuySequenceId = 0x17A; _s20_nextGroceryStoreGuySequenceId = -1; _s20_currStonerGuySequenceId = _s20_nextStonerGuySequenceId; @@ -141,10 +147,10 @@ void GnapEngine::scene20_updateAnimationsCb() { _s20_nextStonerGuySequenceId = 0x171; break; } - _gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x17C, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0x17C, 20, 3); - _gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 2); + _vm->_gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x17C, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x17C, 20, 3); + _vm->_gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 2); _s20_currGroceryStoreGuySequenceId = 0x17C; _s20_nextGroceryStoreGuySequenceId = -1; _s20_currStonerGuySequenceId = _s20_nextStonerGuySequenceId; @@ -152,40 +158,37 @@ void GnapEngine::scene20_updateAnimationsCb() { break; default: _s20_nextStonerGuySequenceId = 0x16C; - _gameSys->setAnimation(0x16C, 21, 2); - _gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x16C, 21, 2); + _vm->_gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _s20_currStonerGuySequenceId = _s20_nextStonerGuySequenceId; _s20_nextStonerGuySequenceId = -1; break; } } - } -void GnapEngine::scene20_stopSounds() { - stopSound(0x18E); - stopSound(0x18F); - stopSound(0x190); - stopSound(0x191); - stopSound(0x194); - stopSound(0x195); - stopSound(0x192); - stopSound(0x193); - stopSound(0x196); - stopSound(0x197); - stopSound(0x198); - stopSound(0x199); - stopSound(0x19A); +void Scene20::stopSounds() { + _vm->stopSound(0x18E); + _vm->stopSound(0x18F); + _vm->stopSound(0x190); + _vm->stopSound(0x191); + _vm->stopSound(0x194); + _vm->stopSound(0x195); + _vm->stopSound(0x192); + _vm->stopSound(0x193); + _vm->stopSound(0x196); + _vm->stopSound(0x197); + _vm->stopSound(0x198); + _vm->stopSound(0x199); + _vm->stopSound(0x19A); } -void GnapEngine::scene20_run() { - - playSound(0x10940, true); - - startSoundTimerA(8); +void Scene20::run() { + _vm->playSound(0x10940, true); + _vm->startSoundTimerA(8); _s20_stonerGuyShowingJoint = false; - _timers[7] = getRandom(100) + 100; + _vm->_timers[7] = _vm->getRandom(100) + 100; _s20_stonerGuyCtr = (_s20_stonerGuyCtr + 1) % 3; switch (_s20_stonerGuyCtr) { @@ -201,119 +204,117 @@ void GnapEngine::scene20_run() { } _s20_nextStonerGuySequenceId = -1; - _gameSys->setAnimation(_s20_currStonerGuySequenceId, 21, 2); - _gameSys->insertSequence(_s20_currStonerGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(_s20_currStonerGuySequenceId, 21, 2); + _vm->_gameSys->insertSequence(_s20_currStonerGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); - _timers[6] = getRandom(20) + 30; + _vm->_timers[6] = _vm->getRandom(20) + 30; _s20_currGroceryStoreGuySequenceId = 0x17C; _s20_nextGroceryStoreGuySequenceId = -1; - _gameSys->setAnimation(0x17C, 20, 3); - _gameSys->insertSequence(0x17C, 20, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x17C, 20, 3); + _vm->_gameSys->insertSequence(0x17C, 20, 0, 0, kSeqNone, 0, 0, 0); - _timers[5] = getRandom(50) + 130; - if (isFlag(kGFGroceryStoreHatTaken)) - _gameSys->insertSequence(0x17F, 20, 0, 0, kSeqNone, 0, 0, 0); + _vm->_timers[5] = _vm->getRandom(50) + 130; + if (_vm->isFlag(kGFGroceryStoreHatTaken)) + _vm->_gameSys->insertSequence(0x17F, 20, 0, 0, kSeqNone, 0, 0, 0); else - _gameSys->insertSequence(0x174, 20, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x174, 20, 0, 0, kSeqNone, 0, 0, 0); - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - if (isFlag(kGFSceneFlag1)) { - clearFlag(kGFSceneFlag1); - endSceneInit(); - _gameSys->setAnimation(0x182, 140, 0); - _gameSys->insertSequence(0x182, 140, 0, 0, kSeqNone, 0, 0, 0); - while (_gameSys->getAnimationStatus(0) != 2) { + if (_vm->isFlag(kGFSceneFlag1)) { + _vm->clearFlag(kGFSceneFlag1); + _vm->endSceneInit(); + _vm->_gameSys->setAnimation(0x182, 140, 0); + _vm->_gameSys->insertSequence(0x182, 140, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(0) != 2) { // checkGameAppStatus(); - gameUpdateTick(); + _vm->gameUpdateTick(); } - initGnapPos(11, 8, kDirBottomLeft); - initPlatypusPos(11, 9, kDirUnk4); - gnapWalkTo(5, 8, -1, 0x107BA, 1); - platypusWalkTo(6, 9, -1, 0x107C2, 1); + _vm->initGnapPos(11, 8, kDirBottomLeft); + _vm->initPlatypusPos(11, 9, kDirUnk4); + _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); } else { - switch (_prevSceneNum) { + switch (_vm->_prevSceneNum) { case 17: - initGnapPos(5, 11, kDirBottomRight); - initPlatypusPos(6, 11, kDirNone); - endSceneInit(); - gnapWalkTo(5, 8, -1, 0x107B9, 1); - platypusWalkTo(6, 9, -1, 0x107C2, 1); + _vm->initGnapPos(5, 11, kDirBottomRight); + _vm->initPlatypusPos(6, 11, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); break; case 18: - initGnapPos(11, 8, kDirBottomLeft); - initPlatypusPos(11, 9, kDirUnk4); - endSceneInit(); - gnapWalkTo(5, 8, -1, 0x107BA, 1); - platypusWalkTo(6, 9, -1, 0x107C2, 1); + _vm->initGnapPos(11, 8, kDirBottomLeft); + _vm->initPlatypusPos(11, 9, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); break; case 21: - initGnapPos(-1, 8, kDirBottomLeft); - initPlatypusPos(-1, 9, kDirUnk4); - endSceneInit(); - gnapWalkTo(3, 8, -1, 0x107B9, 1); - platypusWalkTo(3, 9, -1, 0x107C2, 1); + _vm->initGnapPos(-1, 8, kDirBottomLeft); + _vm->initPlatypusPos(-1, 9, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(3, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(3, 9, -1, 0x107C2, 1); break; case 22: - initGnapPos(7, 6, kDirBottomRight); - initPlatypusPos(8, 6, kDirNone); - endSceneInit(); - gnapWalkTo(8, 8, -1, 0x107B9, 1); - platypusWalkTo(9, 9, -1, 0x107C2, 1); + _vm->initGnapPos(7, 6, kDirBottomRight); + _vm->initPlatypusPos(8, 6, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(9, 9, -1, 0x107C2, 1); break; default: - initGnapPos(8, 6, kDirBottomLeft); - initPlatypusPos(9, 6, kDirUnk4); - endSceneInit(); - _hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; - gnapWalkTo(8, 8, -1, 0x107BA, 1); - platypusWalkTo(9, 9, -1, 0x107C2, 1); - _hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; + _vm->initGnapPos(8, 6, kDirBottomLeft); + _vm->initPlatypusPos(9, 6, kDirUnk4); + _vm->endSceneInit(); + _vm->_hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(9, 9, -1, 0x107C2, 1); + _vm->_hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; break; } } - while (!_sceneDone) { + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - updateMouseCursor(); - updateCursorByHotspot(); + _vm->testWalk(0, 0, -1, -1, -1, -1); + _vm->testWalk(0, 1, 7, 9, 8, 9); - testWalk(0, 0, -1, -1, -1, -1); - testWalk(0, 1, 7, 9, 8, 9); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); - - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene20_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemJoint) { - gnapUseJointOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(_platX, _platY); + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(20); + _vm->gnapKissPlatypus(20); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -321,96 +322,96 @@ void GnapEngine::scene20_run() { break; case kHSExitParkingLot: - if (_gnapActionStatus < 0) { + if (_vm->_gnapActionStatus < 0) { if (_s20_stonerGuyShowingJoint) - _timers[4] = 0; - _isLeavingScene = true; - _newSceneNum = 21; - gnapWalkTo(_hotspotsWalkPos[kHSExitParkingLot].x, _hotspotsWalkPos[kHSExitParkingLot].y, 0, 0x107AF, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitParkingLot].x, _hotspotsWalkPos[kHSExitParkingLot].y + 1, -1, 0x107CF, 1); - _platypusFacing = kDirUnk4; + _vm->_timers[4] = 0; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 21; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitParkingLot].x, _vm->_hotspotsWalkPos[kHSExitParkingLot].y, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitParkingLot].x, _vm->_hotspotsWalkPos[kHSExitParkingLot].y + 1, -1, 0x107CF, 1); + _vm->_platypusFacing = kDirUnk4; } break; case kHSExitPhone: - if (_gnapActionStatus < 0) { + if (_vm->_gnapActionStatus < 0) { if (_s20_stonerGuyShowingJoint) - _timers[4] = 0; - _isLeavingScene = true; - _newSceneNum = 17; - gnapWalkTo(_hotspotsWalkPos[kHSExitPhone].x, _hotspotsWalkPos[kHSExitPhone].y, 0, 0x107AE, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitPhone].x + 1, _hotspotsWalkPos[kHSExitPhone].y, -1, 0x107C2, 1); + _vm->_timers[4] = 0; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 17; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitPhone].x, _vm->_hotspotsWalkPos[kHSExitPhone].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitPhone].x + 1, _vm->_hotspotsWalkPos[kHSExitPhone].y, -1, 0x107C2, 1); } break; case kHSExitOutsideToyStore: - if (_gnapActionStatus < 0) { + if (_vm->_gnapActionStatus < 0) { if (_s20_stonerGuyShowingJoint) - _timers[4] = 0; - _isLeavingScene = true; - _newSceneNum = 18; - _hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; - gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideToyStore].x, _hotspotsWalkPos[kHSExitOutsideToyStore].y, 0, 0x107AB, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideToyStore].x, _hotspotsWalkPos[kHSExitOutsideToyStore].y + 1, -1, 0x107CD, 1); - _hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; + _vm->_timers[4] = 0; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 18; + _vm->_hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideToyStore].x, _vm->_hotspotsWalkPos[kHSExitOutsideToyStore].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideToyStore].x, _vm->_hotspotsWalkPos[kHSExitOutsideToyStore].y + 1, -1, 0x107CD, 1); + _vm->_hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; } break; case kHSExitInsideGrubCity: - if (_gnapActionStatus < 0) { + if (_vm->_gnapActionStatus < 0) { if (_s20_stonerGuyShowingJoint) - _timers[4] = 0; - _isLeavingScene = true; - _newSceneNum = 22; - gnapWalkTo(_hotspotsWalkPos[kHSExitInsideGrubCity].x, _hotspotsWalkPos[kHSExitInsideGrubCity].y - 1, 0, 0x107BB, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitInsideGrubCity].x + 1, _hotspotsWalkPos[kHSExitInsideGrubCity].y, -1, 0x107C2, 1); - _platypusFacing = kDirUnk4; + _vm->_timers[4] = 0; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 22; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitInsideGrubCity].x, _vm->_hotspotsWalkPos[kHSExitInsideGrubCity].y - 1, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitInsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHSExitInsideGrubCity].y, -1, 0x107C2, 1); + _vm->_platypusFacing = kDirUnk4; } break; case kHSExitOutsideCircusWorld: - if (_gnapActionStatus < 0) { + if (_vm->_gnapActionStatus < 0) { if (_s20_stonerGuyShowingJoint) - _timers[4] = 0; - _isLeavingScene = true; - _newSceneNum = 24; - gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideCircusWorld].x, _hotspotsWalkPos[kHSExitOutsideCircusWorld].y, 0, 0x107BB, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideCircusWorld].x + 1, _hotspotsWalkPos[kHSExitOutsideCircusWorld].y, -1, 0x107C2, 1); + _vm->_timers[4] = 0; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 24; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].x, _vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].y, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].y, -1, 0x107C2, 1); } break; case kHSStonerGuy: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSStonerGuy].x, _hotspotsWalkPos[kHSStonerGuy].y, 5, 4); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSStonerGuy].x, _vm->_hotspotsWalkPos[kHSStonerGuy].y, 5, 4); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan2(5, 4); + _vm->playGnapMoan2(5, 4); break; case GRAB_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[kHSStonerGuy].x, _hotspotsWalkPos[kHSStonerGuy].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSStonerGuy].x, _vm->_hotspotsWalkPos[kHSStonerGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); if (_s20_stonerGuyShowingJoint) - _gnapActionStatus = kASGrabJoint; + _vm->_gnapActionStatus = kASGrabJoint; else - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[kHSStonerGuy].x, _hotspotsWalkPos[kHSStonerGuy].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - if (isFlag(kGFJointTaken)) - _gnapActionStatus = kASTalkStonerGuyNoJoint; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSStonerGuy].x, _vm->_hotspotsWalkPos[kHSStonerGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + if (_vm->isFlag(kGFJointTaken)) + _vm->_gnapActionStatus = kASTalkStonerGuyNoJoint; else - _gnapActionStatus = kASTalkStonerGuyHasJoint; + _vm->_gnapActionStatus = kASTalkStonerGuyHasJoint; break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -418,27 +419,27 @@ void GnapEngine::scene20_run() { break; case kHSGroceryStoreGuy: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSGroceryStoreGuy].x, _hotspotsWalkPos[kHSGroceryStoreGuy].y, 2, 4); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSGroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHSGroceryStoreGuy].y, 2, 4); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(2, 3); + _vm->playGnapScratchingHead(2, 3); break; case GRAB_CURSOR: _s20_stonerGuyShowingJoint = false; - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(_hotspotsWalkPos[kHSGroceryStoreGuy].x, _hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASGrabGroceryStoreGuy; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSGroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASGrabGroceryStoreGuy; break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(_hotspotsWalkPos[kHSGroceryStoreGuy].x, _hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASTalkGroceryStoreGuy; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSGroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASTalkGroceryStoreGuy; break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -446,27 +447,27 @@ void GnapEngine::scene20_run() { break; case kHSGroceryStoreHat: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemCowboyHat) { - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[kHSGroceryStoreHat].x, _hotspotsWalkPos[kHSGroceryStoreHat].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASSwitchGroceryStoreHat; - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSGroceryStoreHat].x, _hotspotsWalkPos[kHSGroceryStoreHat].y, 1, 6); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemCowboyHat) { + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSGroceryStoreHat].x, _vm->_hotspotsWalkPos[kHSGroceryStoreHat].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASSwitchGroceryStoreHat; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSGroceryStoreHat].x, _vm->_hotspotsWalkPos[kHSGroceryStoreHat].y, 1, 6); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(1, 6); + _vm->playGnapScratchingHead(1, 6); break; case GRAB_CURSOR: _s20_stonerGuyShowingJoint = false; - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(_hotspotsWalkPos[kHSGroceryStoreGuy].x, _hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASGrabGroceryStoreHat; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSGroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASGrabGroceryStoreHat; break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -475,124 +476,120 @@ void GnapEngine::scene20_run() { case kHSWalkArea1: case kHSWalkArea2: - gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; } - scene20_updateAnimations(); + updateAnimations(); - if (!isSoundPlaying(0x10940)) - playSound(0x10940, true); + if (!_vm->isSoundPlaying(0x10940)) + _vm->playSound(0x10940, true); - if (!_isLeavingScene) { - if (_platypusActionStatus < 0) { - _hotspots[kHSWalkArea1]._y2 += 48; - updatePlatypusIdleSequence(); - _hotspots[kHSWalkArea1]._y2 -= 48; + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0) { + _vm->_hotspots[kHSWalkArea1]._y2 += 48; + _vm->updatePlatypusIdleSequence(); + _vm->_hotspots[kHSWalkArea1]._y2 -= 48; } - if (_gnapActionStatus < 0) - updateGnapIdleSequence(); - if (_gnapActionStatus < 0 && !_timers[5] && _s20_nextGroceryStoreGuySequenceId == -1) { - _timers[5] = getRandom(50) + 130; - if (getRandom(4) != 0) + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (_vm->_gnapActionStatus < 0 && !_vm->_timers[5] && _s20_nextGroceryStoreGuySequenceId == -1) { + _vm->_timers[5] = _vm->getRandom(50) + 130; + if (_vm->getRandom(4) != 0) _s20_nextGroceryStoreGuySequenceId = 0x17C; else _s20_nextGroceryStoreGuySequenceId = 0x17A; } - if (!_timers[7]) { - _timers[7] = getRandom(100) + 100; - if (_gnapActionStatus < 0 && _platypusActionStatus < 0) { - switch (getRandom(3)) { + if (!_vm->_timers[7]) { + _vm->_timers[7] = _vm->getRandom(100) + 100; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + switch (_vm->getRandom(3)) { case 0: - _gameSys->insertSequence(0x183, 253, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x183, 253, 0, 0, kSeqNone, 0, 0, 0); break; case 1: - _gameSys->insertSequence(0x184, 253, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x184, 253, 0, 0, kSeqNone, 0, 0, 0); break; case 2: - _gameSys->insertSequence(0x185, 253, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x185, 253, 0, 0, kSeqNone, 0, 0, 0); break; } } } - playSoundA(); + _vm->playSoundA(); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene20_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene20_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene20::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; case kASTalkStonerGuyNoJoint: - _gameSys->setAnimation(0x170, 21, 2); - _gameSys->setAnimation(0x17B, 20, 3); - _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - stopSound(0x1A1); - scene20_stopSounds(); + _vm->_gameSys->setAnimation(0x170, 21, 2); + _vm->_gameSys->setAnimation(0x17B, 20, 3); + _vm->_gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + _vm->stopSound(0x1A1); + stopSounds(); _s20_currGroceryStoreGuySequenceId = 0x17B; _s20_currStonerGuySequenceId = 0x170; _s20_nextGroceryStoreGuySequenceId = -1; _s20_nextStonerGuySequenceId = 0x16E; - _timers[5] = 100; - _timers[6] = 100; + _vm->_timers[5] = 100; + _vm->_timers[6] = 100; break; case kASTalkStonerGuyHasJoint: - _gameSys->setAnimation(0x168, 21, 2); - _gameSys->setAnimation(379, 20, 3); - _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - _gameSys->insertSequence(0x168, 21, 0x170, 21, kSeqSyncWait, 0, 0, 0); - stopSound(0x1A1); - scene20_stopSounds(); + _vm->_gameSys->setAnimation(0x168, 21, 2); + _vm->_gameSys->setAnimation(379, 20, 3); + _vm->_gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x168, 21, 0x170, 21, kSeqSyncWait, 0, 0, 0); + _vm->stopSound(0x1A1); + stopSounds(); _s20_currGroceryStoreGuySequenceId = 0x17B; _s20_currStonerGuySequenceId = 0x168; _s20_nextGroceryStoreGuySequenceId = -1; _s20_nextStonerGuySequenceId = 0x16B; - _timers[5] = 200; - _timers[6] = 200; - _timers[4] = 100; + _vm->_timers[5] = 200; + _vm->_timers[6] = 200; + _vm->_timers[4] = 100; _s20_stonerGuyShowingJoint = true; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case kASGrabJoint: _s20_nextStonerGuySequenceId = 0x16A; break; case kASActionDone: - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case kASTalkGroceryStoreGuy: - _gameSys->setAnimation(0x170, 21, 2); - _gameSys->setAnimation(0x17B, 20, 3); - _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - stopSound(0x1A1); - scene20_stopSounds(); + _vm->_gameSys->setAnimation(0x170, 21, 2); + _vm->_gameSys->setAnimation(0x17B, 20, 3); + _vm->_gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + _vm->stopSound(0x1A1); + stopSounds(); _s20_currGroceryStoreGuySequenceId = 0x17B; _s20_currStonerGuySequenceId = 0x170; _s20_groceryStoreGuyCtr = (_s20_groceryStoreGuyCtr + 1) % 2; @@ -600,137 +597,136 @@ void GnapEngine::scene20_updateAnimations() { _s20_nextGroceryStoreGuySequenceId = 0x176; else _s20_nextGroceryStoreGuySequenceId = 0x177; - _timers[5] = 100; - _timers[6] = 100; + _vm->_timers[5] = 100; + _vm->_timers[6] = 100; break; case kASGrabGroceryStoreGuy: - _gameSys->setAnimation(0x170, 21, 2); - _gameSys->setAnimation(0x17B, 20, 3); - _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - stopSound(0x1A1); - scene20_stopSounds(); + _vm->_gameSys->setAnimation(0x170, 21, 2); + _vm->_gameSys->setAnimation(0x17B, 20, 3); + _vm->_gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _vm->stopSound(0x1A1); + stopSounds(); _s20_currGroceryStoreGuySequenceId = 0x17B; _s20_currStonerGuySequenceId = 0x170; - _timers[5] = 120; - _timers[6] = 120; + _vm->_timers[5] = 120; + _vm->_timers[6] = 120; _s20_nextGroceryStoreGuySequenceId = 0x178; break; case kASGrabGroceryStoreHat: - _gameSys->setAnimation(0x170, 21, 2); - _gameSys->setAnimation(0x17B, 20, 3); - _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - stopSound(0x1A1); - scene20_stopSounds(); + _vm->_gameSys->setAnimation(0x170, 21, 2); + _vm->_gameSys->setAnimation(0x17B, 20, 3); + _vm->_gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + _vm->stopSound(0x1A1); + stopSounds(); _s20_currGroceryStoreGuySequenceId = 0x17B; _s20_currStonerGuySequenceId = 0x170; _s20_nextGroceryStoreGuySequenceId = 0x179; break; case kASSwitchGroceryStoreHat: - setGrabCursorSprite(-1); - _gameSys->setAnimation(0x180, _gnapId, 0); - _gameSys->insertSequence(0x180, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x180; - _gnapSequenceDatNum = 0; - invRemove(kItemCowboyHat); - invAdd(kItemGroceryStoreHat); - _gnapActionStatus = kASSwitchGroceryStoreHatDone; + _vm->setGrabCursorSprite(-1); + _vm->_gameSys->setAnimation(0x180, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x180, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x180; + _vm->_gnapSequenceDatNum = 0; + _vm->invRemove(kItemCowboyHat); + _vm->invAdd(kItemGroceryStoreHat); + _vm->_gnapActionStatus = kASSwitchGroceryStoreHatDone; break; case kASSwitchGroceryStoreHatDone: - _gameSys->insertSequence(0x17F, 20, 372, 20, kSeqSyncWait, 0, 0, 0); - setFlag(kGFGroceryStoreHatTaken); - hideCursor(); - setGrabCursorSprite(-1); - addFullScreenSprite(0x12C, 255); - _gameSys->setAnimation(0x181, 256, 0); - _gameSys->insertSequence(0x181, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_gameSys->getAnimationStatus(0) != 2) - gameUpdateTick(); - removeFullScreenSprite(); - showCursor(); - setGrabCursorSprite(kItemGroceryStoreHat); - _gnapIdleFacing = kDirBottomRight; - gnapWalkTo(3, 8, -1, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0x17F, 20, 372, 20, kSeqSyncWait, 0, 0, 0); + _vm->setFlag(kGFGroceryStoreHatTaken); + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + _vm->addFullScreenSprite(0x12C, 255); + _vm->_gameSys->setAnimation(0x181, 256, 0); + _vm->_gameSys->insertSequence(0x181, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(0) != 2) + _vm->gameUpdateTick(); + _vm->removeFullScreenSprite(); + _vm->showCursor(); + _vm->setGrabCursorSprite(kItemGroceryStoreHat); + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->gnapWalkTo(3, 8, -1, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = -1; break; case kASGrabJointDone: - setGrabCursorSprite(kItemJoint); - _gnapActionStatus = -1; + _vm->setGrabCursorSprite(kItemJoint); + _vm->_gnapActionStatus = -1; break; } } - if (_gameSys->getAnimationStatus(3) == 2) { + if (_vm->_gameSys->getAnimationStatus(3) == 2) { switch (_s20_nextGroceryStoreGuySequenceId) { case 0x176: case 0x177: - _gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); - _gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); + _vm->_gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); _s20_currGroceryStoreGuySequenceId = _s20_nextGroceryStoreGuySequenceId; _s20_nextGroceryStoreGuySequenceId = -1; _s20_nextStonerGuySequenceId = 0x16D; break; case 0x178: - _gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); - _gameSys->setAnimation(0x17D, _gnapId, 0); - _gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x17D, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x17D; - _gnapSequenceDatNum = 0; - _gnapActionStatus = kASActionDone; - _gameSys->setAnimation(0x16D, 21, 2); - _gameSys->insertSequence(0x16D, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); + _vm->_gameSys->setAnimation(0x17D, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x17D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x17D; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kASActionDone; + _vm->_gameSys->setAnimation(0x16D, 21, 2); + _vm->_gameSys->insertSequence(0x16D, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _s20_currStonerGuySequenceId = 0x16D; _s20_currGroceryStoreGuySequenceId = 0x178; _s20_nextGroceryStoreGuySequenceId = -1; _s20_nextStonerGuySequenceId = -1; break; case 0x179: - _gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); - _gameSys->setAnimation(0x16D, 21, 0); - _gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x17E, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x17E; - _gnapSequenceDatNum = 0; - _gnapActionStatus = kASActionDone; - _gameSys->setAnimation(0x16D, 21, 2); - _gameSys->insertSequence(0x16D, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); + _vm->_gameSys->setAnimation(0x16D, 21, 0); + _vm->_gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x17E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x17E; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kASActionDone; + _vm->_gameSys->setAnimation(0x16D, 21, 2); + _vm->_gameSys->insertSequence(0x16D, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _s20_currStonerGuySequenceId = 0x16D; _s20_currGroceryStoreGuySequenceId = 377; _s20_nextGroceryStoreGuySequenceId = -1; _s20_nextStonerGuySequenceId = -1; - gnapWalkTo(4, 8, -1, 0x107BB, 1); + _vm->gnapWalkTo(4, 8, -1, 0x107BB, 1); break; case 0x17C: - _gameSys->setAnimation(0, 0, 3); + _vm->_gameSys->setAnimation(0, 0, 3); _s20_nextStonerGuySequenceId = 0x171; break; case 0x17A: - _gameSys->setAnimation(0, 0, 3); + _vm->_gameSys->setAnimation(0, 0, 3); _s20_nextStonerGuySequenceId = 0x16F; break; case 0x175: - _gameSys->setAnimation(0x175, 20, 0); - _gameSys->setAnimation(0x175, 20, 3); - _gameSys->insertSequence(0x175, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x175, 20, 0); + _vm->_gameSys->setAnimation(0x175, 20, 3); + _vm->_gameSys->insertSequence(0x175, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); _s20_currGroceryStoreGuySequenceId = 0x175; _s20_nextGroceryStoreGuySequenceId = -1; - _gnapActionStatus = kASActionDone; + _vm->_gnapActionStatus = kASActionDone; break; default: if (_s20_nextGroceryStoreGuySequenceId != -1) { - _gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); - _gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); + _vm->_gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); _s20_currGroceryStoreGuySequenceId = _s20_nextGroceryStoreGuySequenceId; _s20_nextGroceryStoreGuySequenceId = -1; } break; } } - - scene20_updateAnimationsCb(); + updateAnimationsCb(); } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene20.h b/engines/gnap/scenes/scene20.h new file mode 100644 index 0000000000..7496c87892 --- /dev/null +++ b/engines/gnap/scenes/scene20.h @@ -0,0 +1,57 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE20_H +#define GNAP_SCENE20_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene20: public Scene { +public: + Scene20(GnapEngine *vm); + ~Scene20() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb(); + +private: + int _s20_currStonerGuySequenceId; + int _s20_nextStonerGuySequenceId; + int _s20_currGroceryStoreGuySequenceId; + int _s20_nextGroceryStoreGuySequenceId; + int _s20_stonerGuyCtr; + int _s20_groceryStoreGuyCtr; + bool _s20_stonerGuyShowingJoint; + + void stopSounds(); +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE20_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 8047029e75..20f4623348 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -44,6 +44,8 @@ #include "gnap/scenes/scene16.h" #include "gnap/scenes/scene17.h" #include "gnap/scenes/scene18.h" +#include "gnap/scenes/scene19.h" +#include "gnap/scenes/scene20.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -184,14 +186,16 @@ int GnapEngine::initSceneLogic() { _scene->updateHotspots(); break; case 19: - backgroundId = scene19_init(); - scene19_updateHotspots(); + _scene = new Scene19(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; case 20: - backgroundId = scene20_init(); - scene20_updateHotspots(); + _scene = new Scene20(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -506,12 +510,14 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 20; break; case 19: - scene19_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 19; break; case 20: - scene20_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 22; break; |