diff options
Diffstat (limited to 'engines/gnap')
-rw-r--r-- | engines/gnap/gnap.cpp | 10 | ||||
-rw-r--r-- | engines/gnap/gnap.h | 13 | ||||
-rw-r--r-- | engines/gnap/scenes/scene17.cpp | 919 | ||||
-rw-r--r-- | engines/gnap/scenes/scene17.h | 61 | ||||
-rw-r--r-- | engines/gnap/scenes/scenecore.cpp | 9 |
5 files changed, 530 insertions, 482 deletions
diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 07978cb322..e002bb5ec4 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2018,16 +2018,6 @@ void GnapEngine::initPlatypusPos(int gridX, int gridY, Facing facing) { //////////////////////////////////////////////////////////////////////////////// void GnapEngine::initGlobalSceneVars() { - // Scene 17 - _s17_platTryGetWrenchCtr = 0; - _s17_wrenchCtr = 2; - _s17_nextCarWindowSequenceId = -1; - _s17_nextWrenchSequenceId = -1; - _s17_canTryGetWrench = true; - _s17_platPhoneCtr = 0; - _s17_nextPhoneSequenceId = -1; - _s17_currPhoneSequenceId = -1; - // Scene 18 _s18_garbageCanPos = 8; _s18_platPhoneCtr = 0; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index cbe711a47b..0fa110b383 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -603,19 +603,6 @@ public: void sceneXX_playRandomSound(int timerIndex); void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); - // Scene 17 - bool _s17_canTryGetWrench; - int _s17_wrenchCtr, _s17_platPhoneCtr, _s17_platTryGetWrenchCtr; - int _s17_nextPhoneSequenceId, _s17_currPhoneSequenceId; - int _s17_nextWrenchSequenceId, _s17_currWrenchSequenceId; - int _s17_nextCarWindowSequenceId, _s17_currCarWindowSequenceId; - int scene17_init(); - void scene17_updateHotspots(); - void scene17_update(); - void scene17_platHangUpPhone(); - void scene17_run(); - void scene17_updateAnimations(); - // Scene 18 int _s18_garbageCanPos; int _s18_platPhoneCtr; diff --git a/engines/gnap/scenes/scene17.cpp b/engines/gnap/scenes/scene17.cpp index cf5945dde8..00b3f19fa5 100644 --- a/engines/gnap/scenes/scene17.cpp +++ b/engines/gnap/scenes/scene17.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene17.h" namespace Gnap { @@ -57,270 +58,279 @@ enum { kASLeaveScene = 15 }; -int GnapEngine::scene17_init() { +Scene17::Scene17(GnapEngine *vm) : Scene(vm) { + _s17_platTryGetWrenchCtr = 0; + _s17_wrenchCtr = 2; + _s17_nextCarWindowSequenceId = -1; + _s17_nextWrenchSequenceId = -1; + _s17_canTryGetWrench = true; + _s17_platPhoneCtr = 0; + _s17_nextPhoneSequenceId = -1; + _s17_currPhoneSequenceId = -1; +} + +int Scene17::init() { return 0x263; } -void GnapEngine::scene17_updateHotspots() { - setHotspot(kHSPlatypus, 1, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSPhone1, 61, 280, 97, 322, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); - setHotspot(kHSPhone2, 80, 204, 178, 468, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); - setHotspot(kHSExitGrubCity, 196, 207, 280, 304, SF_EXIT_U_CURSOR, 3, 5); - setHotspot(kHSExitToyStore, 567, 211, 716, 322, SF_EXIT_U_CURSOR, 5, 6); - setHotspot(kHSWrench, 586, 455, 681, 547, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); - setHotspot(kHSWalkArea1, 0, 0, 800, 434); - setHotspot(kHSWalkArea2, 541, 0, 800, 600); - setHotspot(kHSWalkArea3, 0, 204, 173, 468); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(kGFGrassTaken)) - _hotspots[kHSWrench]._flags = SF_NONE; - if (isFlag(kGFPlatypusTalkingToAssistant)) { - _hotspots[kHSDevice]._flags = SF_DISABLED; - _hotspots[kHSPlatypus]._flags = SF_DISABLED; +void Scene17::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 1, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSPhone1, 61, 280, 97, 322, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); + _vm->setHotspot(kHSPhone2, 80, 204, 178, 468, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); + _vm->setHotspot(kHSExitGrubCity, 196, 207, 280, 304, SF_EXIT_U_CURSOR, 3, 5); + _vm->setHotspot(kHSExitToyStore, 567, 211, 716, 322, SF_EXIT_U_CURSOR, 5, 6); + _vm->setHotspot(kHSWrench, 586, 455, 681, 547, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); + _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 434); + _vm->setHotspot(kHSWalkArea2, 541, 0, 800, 600); + _vm->setHotspot(kHSWalkArea3, 0, 204, 173, 468); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->isFlag(kGFGrassTaken)) + _vm->_hotspots[kHSWrench]._flags = SF_NONE; + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { + _vm->_hotspots[kHSDevice]._flags = SF_DISABLED; + _vm->_hotspots[kHSPlatypus]._flags = SF_DISABLED; } - _hotspotsCount = 10; + _vm->_hotspotsCount = 10; } -void GnapEngine::scene17_update() { - gameUpdateTick(); - updateMouseCursor(); - updateGrabCursorSprite(0, 0); - if (_mouseClickState._left) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; +void Scene17::update() { + _vm->gameUpdateTick(); + _vm->updateMouseCursor(); + _vm->updateGrabCursorSprite(0, 0); + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } } -void GnapEngine::scene17_platHangUpPhone() { - int savedGnapActionStatus = _gnapActionStatus; +void Scene17::platHangUpPhone() { + int savedGnapActionStatus = _vm->_gnapActionStatus; - if (_platypusActionStatus == kASPlatPhoningAssistant) { - _gnapActionStatus = kASPlatHangUpPhone; - updateMouseCursor(); + if (_vm->_platypusActionStatus == kASPlatPhoningAssistant) { + _vm->_gnapActionStatus = kASPlatHangUpPhone; + _vm->updateMouseCursor(); _s17_platPhoneCtr = 0; - _platypusActionStatus = -1; - _gameSys->setAnimation(0x257, 254, 4); - _gameSys->insertSequence(0x257, 254, _s17_currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); - while (_gameSys->getAnimationStatus(4) != 2) - gameUpdateTick(); - _gameSys->setAnimation(0x25B, _platypusId, 1); - _gameSys->insertSequence(0x25B, _platypusId, _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); - _platypusSequenceId = 0x25B; - _platypusSequenceDatNum = 0; + _vm->_platypusActionStatus = -1; + _vm->_gameSys->setAnimation(0x257, 254, 4); + _vm->_gameSys->insertSequence(0x257, 254, _s17_currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(4) != 2) + _vm->gameUpdateTick(); + _vm->_gameSys->setAnimation(0x25B, _vm->_platypusId, 1); + _vm->_gameSys->insertSequence(0x25B, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceId = 0x25B; + _vm->_platypusSequenceDatNum = 0; _s17_currPhoneSequenceId = -1; _s17_nextPhoneSequenceId = -1; - clearFlag(kGFPlatypusTalkingToAssistant); - while (_gameSys->getAnimationStatus(1) != 2) - gameUpdateTick(); - _gnapActionStatus = savedGnapActionStatus; - updateMouseCursor(); + _vm->clearFlag(kGFPlatypusTalkingToAssistant); + while (_vm->_gameSys->getAnimationStatus(1) != 2) + _vm->gameUpdateTick(); + _vm->_gnapActionStatus = savedGnapActionStatus; + _vm->updateMouseCursor(); } - scene17_updateHotspots(); + updateHotspots(); } -void GnapEngine::scene17_run() { - playSound(0x10940, true); - startSoundTimerA(8); - _sceneWaiting = false; - _timers[4] = getRandom(100) + 200; - _timers[3] = 200; - _timers[5] = getRandom(30) + 80; - _timers[6] = getRandom(30) + 200; - _timers[7] = getRandom(100) + 100; - - if (isFlag(kGFTruckKeysUsed)) { - _gameSys->insertSequence(0x25F, 20, 0, 0, kSeqNone, 0, 0, 0); +void Scene17::run() { + _vm->playSound(0x10940, true); + _vm->startSoundTimerA(8); + _vm->_sceneWaiting = false; + _vm->_timers[4] = _vm->getRandom(100) + 200; + _vm->_timers[3] = 200; + _vm->_timers[5] = _vm->getRandom(30) + 80; + _vm->_timers[6] = _vm->getRandom(30) + 200; + _vm->_timers[7] = _vm->getRandom(100) + 100; + + if (_vm->isFlag(kGFTruckKeysUsed)) { + _vm->_gameSys->insertSequence(0x25F, 20, 0, 0, kSeqNone, 0, 0, 0); } else { - if (_s18_garbageCanPos >= 8) { - _gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 97, 1); - } else if (_s18_garbageCanPos >= 6) { - _gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 68, 2); - } else if (_s18_garbageCanPos >= 5) { - _gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 23, -1); - } else if (_s18_garbageCanPos >= 4) { - _gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, -11, -5); + if (_vm->_s18_garbageCanPos >= 8) { + _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 97, 1); + } else if (_vm->_s18_garbageCanPos >= 6) { + _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 68, 2); + } else if (_vm->_s18_garbageCanPos >= 5) { + _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 23, -1); + } else if (_vm->_s18_garbageCanPos >= 4) { + _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, -11, -5); } else { - _gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, -54, -8); + _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, -54, -8); } } - if (isFlag(kGFGroceryStoreHatTaken)) - _gameSys->insertSequence(0x262, 1, 0, 0, kSeqNone, 0, 0, 0); + if (_vm->isFlag(kGFGroceryStoreHatTaken)) + _vm->_gameSys->insertSequence(0x262, 1, 0, 0, kSeqNone, 0, 0, 0); - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - if (isFlag(kGFGrassTaken)) + if (_vm->isFlag(kGFGrassTaken)) _s17_currWrenchSequenceId = 0x22D; else _s17_currWrenchSequenceId = 0x22F; _s17_currCarWindowSequenceId = 0x244; - if (isFlag(kGFUnk14)) - _gameSys->insertSequence(0x261, 1, 0, 0, kSeqNone, 0, 0, 0); + if (_vm->isFlag(kGFUnk14)) + _vm->_gameSys->insertSequence(0x261, 1, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->setAnimation(_s17_currWrenchSequenceId, 40, 2); - _gameSys->insertSequence(_s17_currWrenchSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(_s17_currWrenchSequenceId, 40, 2); + _vm->_gameSys->insertSequence(_s17_currWrenchSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(kGFGrassTaken)) { - _gameSys->setAnimation(0, 0, 3); + if (_vm->isFlag(kGFGrassTaken)) { + _vm->_gameSys->setAnimation(0, 0, 3); } else { - _gameSys->setAnimation(_s17_currCarWindowSequenceId, 40, 3); - _gameSys->insertSequence(_s17_currCarWindowSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(_s17_currCarWindowSequenceId, 40, 3); + _vm->_gameSys->insertSequence(_s17_currCarWindowSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); } _s17_canTryGetWrench = true; - if (isFlag(kGFUnk18)) - _gameSys->insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); - - if (_prevSceneNum == 53 || _prevSceneNum == 18 || _prevSceneNum == 20 || _prevSceneNum == 19) { - if (_prevSceneNum == 20) { - initGnapPos(4, 6, kDirBottomRight); - initPlatypusPos(5, 6, kDirNone); - endSceneInit(); - platypusWalkTo(5, 9, -1, 0x107C2, 1); - gnapWalkTo(4, 8, -1, 0x107B9, 1); - } else if (isFlag(kGFUnk27)) { - initGnapPos(3, 9, kDirUpLeft); - _platX = _hotspotsWalkPos[2].x; - _platY = _hotspotsWalkPos[2].y; - _platypusId = 20 * _hotspotsWalkPos[2].y; - _gameSys->insertSequence(0x25A, 20 * _hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x257, 254, 0, 0, kSeqNone, 0, 0, 0); - _platypusSequenceId = 0x25A; - _platypusSequenceDatNum = 0; - endSceneInit(); - clearFlag(kGFSpringTaken); - clearFlag(kGFUnk16); - _platypusActionStatus = kASPlatPhoningAssistant; - scene17_platHangUpPhone(); - _gameSys->setAnimation(0, 0, 4); - clearFlag(kGFPlatypusTalkingToAssistant); - clearFlag(kGFUnk27); - scene17_updateHotspots(); - } else if (isFlag(kGFUnk25)) { - clearFlag(kGFSpringTaken); - clearFlag(kGFUnk16); - initPlatypusPos(7, 9, kDirNone); - _gnapX = _hotspotsWalkPos[2].x; - _gnapY = _hotspotsWalkPos[2].y; - _gnapId = 20 * _hotspotsWalkPos[2].y; - _gameSys->insertSequence(601, 20 * _hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 601; - _gnapActionStatus = kASGnapHangUpPhone; - clearFlag(kGFUnk25); - _gameSys->insertSequence(0x251, 254, 0, 0, kSeqNone, 0, 0, 0); - endSceneInit(); - _gameSys->setAnimation(0x257, 254, 0); - _gameSys->insertSequence(0x257, 254, 0x251, 254, kSeqSyncWait, 0, 0, 0); - } else if (isFlag(kGFPlatypusTalkingToAssistant)) { - clearFlag(kGFSpringTaken); - clearFlag(kGFUnk16); - _sceneWaiting = true; - initGnapPos(3, 9, kDirUpLeft); - _platX = _hotspotsWalkPos[2].x; - _platY = _hotspotsWalkPos[2].y; - _platypusId = 20 * _hotspotsWalkPos[2].y; + if (_vm->isFlag(kGFUnk18)) + _vm->_gameSys->insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->_prevSceneNum == 53 || _vm->_prevSceneNum == 18 || _vm->_prevSceneNum == 20 || _vm->_prevSceneNum == 19) { + if (_vm->_prevSceneNum == 20) { + _vm->initGnapPos(4, 6, kDirBottomRight); + _vm->initPlatypusPos(5, 6, kDirNone); + _vm->endSceneInit(); + _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); + _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); + } else if (_vm->isFlag(kGFUnk27)) { + _vm->initGnapPos(3, 9, kDirUpLeft); + _vm->_platX = _vm->_hotspotsWalkPos[2].x; + _vm->_platY = _vm->_hotspotsWalkPos[2].y; + _vm->_platypusId = 20 * _vm->_hotspotsWalkPos[2].y; + _vm->_gameSys->insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x257, 254, 0, 0, kSeqNone, 0, 0, 0); + _vm->_platypusSequenceId = 0x25A; + _vm->_platypusSequenceDatNum = 0; + _vm->endSceneInit(); + _vm->clearFlag(kGFSpringTaken); + _vm->clearFlag(kGFUnk16); + _vm->_platypusActionStatus = kASPlatPhoningAssistant; + platHangUpPhone(); + _vm->_gameSys->setAnimation(0, 0, 4); + _vm->clearFlag(kGFPlatypusTalkingToAssistant); + _vm->clearFlag(kGFUnk27); + updateHotspots(); + } else if (_vm->isFlag(kGFUnk25)) { + _vm->clearFlag(kGFSpringTaken); + _vm->clearFlag(kGFUnk16); + _vm->initPlatypusPos(7, 9, kDirNone); + _vm->_gnapX = _vm->_hotspotsWalkPos[2].x; + _vm->_gnapY = _vm->_hotspotsWalkPos[2].y; + _vm->_gnapId = 20 * _vm->_hotspotsWalkPos[2].y; + _vm->_gameSys->insertSequence(601, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 601; + _vm->_gnapActionStatus = kASGnapHangUpPhone; + _vm->clearFlag(kGFUnk25); + _vm->_gameSys->insertSequence(0x251, 254, 0, 0, kSeqNone, 0, 0, 0); + _vm->endSceneInit(); + _vm->_gameSys->setAnimation(0x257, 254, 0); + _vm->_gameSys->insertSequence(0x257, 254, 0x251, 254, kSeqSyncWait, 0, 0, 0); + } else if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { + _vm->clearFlag(kGFSpringTaken); + _vm->clearFlag(kGFUnk16); + _vm->_sceneWaiting = true; + _vm->initGnapPos(3, 9, kDirUpLeft); + _vm->_platX = _vm->_hotspotsWalkPos[2].x; + _vm->_platY = _vm->_hotspotsWalkPos[2].y; + _vm->_platypusId = 20 * _vm->_hotspotsWalkPos[2].y; _s17_currPhoneSequenceId = 0x251; - _gameSys->insertSequence(0x25A, 20 * _hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(_s17_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); - _platypusSequenceId = 0x25A; - _platypusSequenceDatNum = 0; - endSceneInit(); - _gameSys->setAnimation(_s17_currPhoneSequenceId, 254, 1); - _platypusActionStatus = kASPlatPhoningAssistant; - scene17_updateHotspots(); - } else if (_prevSceneNum == 18) { - initGnapPos(6, 6, kDirBottomRight); - initPlatypusPos(5, 6, kDirNone); - endSceneInit(); - platypusWalkTo(5, 9, -1, 0x107C2, 1); - gnapWalkTo(4, 8, -1, 0x107B9, 1); + _vm->_gameSys->insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(_s17_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); + _vm->_platypusSequenceId = 0x25A; + _vm->_platypusSequenceDatNum = 0; + _vm->endSceneInit(); + _vm->_gameSys->setAnimation(_s17_currPhoneSequenceId, 254, 1); + _vm->_platypusActionStatus = kASPlatPhoningAssistant; + updateHotspots(); + } else if (_vm->_prevSceneNum == 18) { + _vm->initGnapPos(6, 6, kDirBottomRight); + _vm->initPlatypusPos(5, 6, kDirNone); + _vm->endSceneInit(); + _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); + _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); } else { - if (isFlag(kGFSpringTaken)) { - initGnapPos(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, kDirBottomRight); - initPlatypusPos(1, 9, kDirNone); - endSceneInit(); + if (_vm->isFlag(kGFSpringTaken)) { + _vm->initGnapPos(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, kDirBottomRight); + _vm->initPlatypusPos(1, 9, kDirNone); + _vm->endSceneInit(); } else { - initGnapPos(3, 7, kDirBottomRight); - initPlatypusPos(1, 7, kDirNone); - endSceneInit(); + _vm->initGnapPos(3, 7, kDirBottomRight); + _vm->initPlatypusPos(1, 7, kDirNone); + _vm->endSceneInit(); } - clearFlag(kGFSpringTaken); - clearFlag(kGFUnk16); - endSceneInit(); + _vm->clearFlag(kGFSpringTaken); + _vm->clearFlag(kGFUnk16); + _vm->endSceneInit(); } } else { - _gnapX = 3; - _gnapY = 6; - _gnapId = 120; - _gnapSequenceId = 0x23D; - _gnapSequenceDatNum = 0; - _gnapIdleFacing = kDirBottomRight; - _gameSys->insertSequence(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0, 0, kSeqNone, 0, 0, 0); - _platX = -1; - _platY = 8; - _platypusId = 160; - _gameSys->insertSequence(0x241, 160, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x107C1, _platypusId, 0x241, _platypusId, - kSeqScale | kSeqSyncWait, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); - _gameSys->insertSequence(0x22C, 2, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapX = 3; + _vm->_gnapY = 6; + _vm->_gnapId = 120; + _vm->_gnapSequenceId = 0x23D; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gameSys->insertSequence(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); + _vm->_platX = -1; + _vm->_platY = 8; + _vm->_platypusId = 160; + _vm->_gameSys->insertSequence(0x241, 160, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x107C1, _vm->_platypusId, 0x241, _vm->_platypusId, + kSeqScale | kSeqSyncWait, 0, 75 * _vm->_platX - _vm->_platGridX, 48 * _vm->_platY - _vm->_platGridY); + _vm->_gameSys->insertSequence(0x22C, 2, 0, 0, kSeqNone, 0, 0, 0); // TODO delayTicksA(2, 9); - endSceneInit(); - _platypusSequenceId = 0x7C1; - _platypusSequenceDatNum = 1; - _platypusFacing = kDirBottomRight; - platypusWalkTo(2, 9, -1, 0x107C2, 1); + _vm->endSceneInit(); + _vm->_platypusSequenceId = 0x7C1; + _vm->_platypusSequenceDatNum = 1; + _vm->_platypusFacing = kDirBottomRight; + _vm->platypusWalkTo(2, 9, -1, 0x107C2, 1); } - while (!_sceneDone) { - - updateMouseCursor(); - updateCursorByHotspot(); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0 || _gnapActionStatus == 3) { - runMenu(); - scene17_updateHotspots(); + if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == 3) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemJoint) { - if (isFlag(kGFGrassTaken)) { - gnapUseJointOnPlatypus(); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + if (_vm->isFlag(kGFGrassTaken)) { + _vm->gnapUseJointOnPlatypus(); } else { - gnapUseDeviceOnPlatypuss(); - platypusWalkTo(_hotspotsWalkPos[6].x, _hotspotsWalkPos[6].y, 1, 0x107C2, 1); - gnapWalkTo(_hotspotsWalkPos[6].x + 1, _hotspotsWalkPos[6].y, 0, 0x107BA, 1); - _platypusActionStatus = kASGetWrench1; - _gnapActionStatus = kASGetWrench1; - _timers[5] = getRandom(30) + 80; - setGrabCursorSprite(-1); - invRemove(kItemJoint); + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, 1, 0x107C2, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, 0, 0x107BA, 1); + _vm->_platypusActionStatus = kASGetWrench1; + _vm->_gnapActionStatus = kASGetWrench1; + _vm->_timers[5] = _vm->getRandom(30) + 80; + _vm->setGrabCursorSprite(-1); + _vm->invRemove(kItemJoint); } - } else if (_grabCursorSpriteIndex >= 0) { - playGnapScratchingHead(_platX, _platY); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: - playGnapScratchingHead(_platX, _platY); + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); 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; } } @@ -328,30 +338,30 @@ void GnapEngine::scene17_run() { break; case kHSWrench: - if (_gnapActionStatus < 0) { - if (isFlag(kGFGrassTaken)) { - playGnapImpossible(0, 0); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 8, 7); + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFGrassTaken)) { + _vm->playGnapImpossible(0, 0); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 7); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: - playGnapScratchingHead(8, 7); + _vm->playGnapScratchingHead(8, 7); break; case TALK_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case PLAT_CURSOR: if (_s17_canTryGetWrench) { - scene17_platHangUpPhone(); - gnapUseDeviceOnPlatypuss(); - platypusWalkTo(_hotspotsWalkPos[6].x + 1, _hotspotsWalkPos[6].y, 1, 0x107C2, 1); - _platypusActionStatus = kASTryGetWrench; - _gnapActionStatus = kASTryGetWrench; - _timers[5] = getRandom(30) + 80; + platHangUpPhone(); + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, 1, 0x107C2, 1); + _vm->_platypusActionStatus = kASTryGetWrench; + _vm->_gnapActionStatus = kASTryGetWrench; + _vm->_timers[5] = _vm->getRandom(30) + 80; } else - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -359,40 +369,40 @@ void GnapEngine::scene17_run() { break; case kHSPhone1: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemDiceQuarterHole) { - gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASPutCoinIntoPhone; - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 1, 3); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASPutCoinIntoPhone; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(1, 3); + _vm->playGnapScratchingHead(1, 3); break; case GRAB_CURSOR: - if (isFlag(kGFUnk18)) { - scene17_platHangUpPhone(); - gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y) | 0x10000, 1); - _gnapActionStatus = kASGetCoinFromPhone; + if (_vm->isFlag(kGFUnk18)) { + platHangUpPhone(); + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1); + _vm->_gnapActionStatus = kASGetCoinFromPhone; } else - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case TALK_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case PLAT_CURSOR: - if (isFlag(kGFUnk18)) { - scene17_platHangUpPhone(); - _isLeavingScene = true; - gnapUseDeviceOnPlatypuss(); - _platypusFacing = kDirUpLeft; - platypusWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 1, 0x107C2, 1); - setFlag(kGFUnk16); - _platypusActionStatus = kASPlatUsePhone; - _gnapActionStatus = kASPlatUsePhone; + if (_vm->isFlag(kGFUnk18)) { + platHangUpPhone(); + _vm->_isLeavingScene = true; + _vm->gnapUseDeviceOnPlatypuss(); + _vm->_platypusFacing = kDirUpLeft; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 0x107C2, 1); + _vm->setFlag(kGFUnk16); + _vm->_platypusActionStatus = kASPlatUsePhone; + _vm->_gnapActionStatus = kASPlatUsePhone; } else - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -400,43 +410,43 @@ void GnapEngine::scene17_run() { break; case kHSPhone2: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemDiceQuarterHole) { - gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASPutCoinIntoPhone; - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 1, 3); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASPutCoinIntoPhone; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(1, 3); + _vm->playGnapScratchingHead(1, 3); break; case GRAB_CURSOR: - if (isFlag(kGFUnk18)) { - scene17_platHangUpPhone(); - _isLeavingScene = true; - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASGnapUsePhone; - setFlag(kGFSpringTaken); + if (_vm->isFlag(kGFUnk18)) { + platHangUpPhone(); + _vm->_isLeavingScene = true; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASGnapUsePhone; + _vm->setFlag(kGFSpringTaken); } else - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case TALK_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case PLAT_CURSOR: - if (isFlag(kGFUnk18)) { - scene17_platHangUpPhone(); - _isLeavingScene = true; - gnapUseDeviceOnPlatypuss(); - _platypusFacing = kDirUpLeft; - platypusWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 1, 0x107C2, 1); - setFlag(kGFUnk16); - _platypusActionStatus = kASPlatUsePhone; - _gnapActionStatus = kASPlatUsePhone; + if (_vm->isFlag(kGFUnk18)) { + platHangUpPhone(); + _vm->_isLeavingScene = true; + _vm->gnapUseDeviceOnPlatypuss(); + _vm->_platypusFacing = kDirUpLeft; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 0x107C2, 1); + _vm->setFlag(kGFUnk16); + _vm->_platypusActionStatus = kASPlatUsePhone; + _vm->_gnapActionStatus = kASPlatUsePhone; } else - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -444,80 +454,80 @@ void GnapEngine::scene17_run() { break; case kHSExitToyStore: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 18; - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[5].x, _hotspotsWalkPos[5].y, 0, 0x107BB, 1); - _gnapActionStatus = kASLeaveScene; - if (_platypusActionStatus != kASPlatPhoningAssistant) - platypusWalkTo(_hotspotsWalkPos[5].x - 1, _hotspotsWalkPos[5].y, -1, 0x107C2, 1); + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 18; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kASLeaveScene; + if (_vm->_platypusActionStatus != kASPlatPhoningAssistant) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[5].x - 1, _vm->_hotspotsWalkPos[5].y, -1, 0x107C2, 1); } break; case kHSExitGrubCity: - if (_gnapActionStatus < 0) { - scene17_platHangUpPhone(); - _isLeavingScene = true; - _newSceneNum = 20; - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, 0x107BC, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[3].x + 1, _hotspotsWalkPos[3].y, -1, 0x107C2, 1); + if (_vm->_gnapActionStatus < 0) { + platHangUpPhone(); + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 20; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[3].x + 1, _vm->_hotspotsWalkPos[3].y, -1, 0x107C2, 1); } break; 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 && _gnapActionStatus < 0) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = 0; + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = 0; } break; } - scene17_updateAnimations(); + updateAnimations(); - if (!isSoundPlaying(0x10940)) - playSound(0x10940, true); + if (!_vm->isSoundPlaying(0x10940)) + _vm->playSound(0x10940, true); - if (!_isLeavingScene) { - if (_platypusActionStatus < 0) - platypusSub426234(); - updateGnapIdleSequence2(); - if (!_timers[4]) { - _timers[4] = getRandom(100) + 200; - if (_gnapActionStatus < 0 && _platypusActionStatus < 0) - _gameSys->insertSequence(0x22B, 21, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0) + _vm->platypusSub426234(); + _vm->updateGnapIdleSequence2(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(100) + 200; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) + _vm->_gameSys->insertSequence(0x22B, 21, 0, 0, kSeqNone, 0, 0, 0); } - 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(0x25C, 255, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x25C, 255, 0, 0, kSeqNone, 0, 0, 0); break; case 1: - _gameSys->insertSequence(0x25D, 255, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x25D, 255, 0, 0, kSeqNone, 0, 0, 0); break; case 2: - _gameSys->insertSequence(0x25E, 255, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x25E, 255, 0, 0, kSeqNone, 0, 0, 0); break; } } } - if (_platypusActionStatus < 0 && !_timers[5]) { - _timers[5] = getRandom(30) + 80; - if (isFlag(kGFGrassTaken) && _s17_nextWrenchSequenceId == -1) { + if (_vm->_platypusActionStatus < 0 && !_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(30) + 80; + if (_vm->isFlag(kGFGrassTaken) && _s17_nextWrenchSequenceId == -1) { _s17_nextWrenchSequenceId = 0x236; } else if (_s17_canTryGetWrench) { - switch (getRandom(6)) { + switch (_vm->getRandom(6)) { case 0: _s17_nextWrenchSequenceId = 0x231; break; @@ -536,7 +546,7 @@ void GnapEngine::scene17_run() { } else { --_s17_wrenchCtr; if (_s17_wrenchCtr) { - switch (getRandom(6)) { + switch (_vm->getRandom(6)) { case 0: _s17_nextWrenchSequenceId = 0x237; break; @@ -562,90 +572,87 @@ void GnapEngine::scene17_run() { } } } - if (!_timers[6]) { - _timers[6] = getRandom(30) + 200; - if (_s17_nextCarWindowSequenceId == -1 && !isFlag(kGFGrassTaken)) + if (!_vm->_timers[6]) { + _vm->_timers[6] = _vm->getRandom(30) + 200; + if (_s17_nextCarWindowSequenceId == -1 && !_vm->isFlag(kGFGrassTaken)) _s17_nextCarWindowSequenceId = 0x246; } - playSoundA(); + _vm->playSoundA(); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene17_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene17_updateAnimations() { - +void Scene17::updateAnimations() { static const int kPlatPhoneSequenceIds[] = { 0x251, 0x252, 0x253, 0x254, 0x255, 0x256, 0x257 }; - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASGetWrench1: - _gnapActionStatus = kASGetWrenchGnapReady; + _vm->_gnapActionStatus = kASGetWrenchGnapReady; break; case kASGetCoinFromPhone: - playGnapPullOutDevice(1, 3); - playGnapUseDevice(0, 0); - _gameSys->setAnimation(0x250, 100, 0); - _gameSys->insertSequence(0x250, 100, 591, 100, kSeqSyncWait, 0, 0, 0); - invAdd(kItemDiceQuarterHole); - clearFlag(kGFUnk18); - _gnapActionStatus = kASGetCoinFromPhoneDone; + _vm->playGnapPullOutDevice(1, 3); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->setAnimation(0x250, 100, 0); + _vm->_gameSys->insertSequence(0x250, 100, 591, 100, kSeqSyncWait, 0, 0, 0); + _vm->invAdd(kItemDiceQuarterHole); + _vm->clearFlag(kGFUnk18); + _vm->_gnapActionStatus = kASGetCoinFromPhoneDone; break; case kASGetCoinFromPhoneDone: - setGrabCursorSprite(kItemDiceQuarterHole); - _gnapActionStatus = -1; + _vm->setGrabCursorSprite(kItemDiceQuarterHole); + _vm->_gnapActionStatus = -1; break; case kASPutCoinIntoPhone: - _gameSys->setAnimation(0x24C, _gnapId, 0); - _gameSys->insertSequence(0x24C, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 0x24C; - invRemove(kItemDiceQuarterHole); - setGrabCursorSprite(-1); - setFlag(kGFUnk18); - _gnapActionStatus = kASPutCoinIntoPhoneDone; + _vm->_gameSys->setAnimation(0x24C, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x24C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x24C; + _vm->invRemove(kItemDiceQuarterHole); + _vm->setGrabCursorSprite(-1); + _vm->setFlag(kGFUnk18); + _vm->_gnapActionStatus = kASPutCoinIntoPhoneDone; break; case kASPutCoinIntoPhoneDone: - _gameSys->insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); - _gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapActionStatus = -1; break; case kASGnapUsePhone: - _gameSys->setAnimation(0x24D, _gnapId, 0); - _gameSys->insertSequence(0x24D, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapActionStatus = kASLeaveScene; - _newSceneNum = 53; + _vm->_gameSys->setAnimation(0x24D, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x24D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->_newSceneNum = 53; break; case kASGnapHangUpPhone: - _gameSys->insertSequence(0x258, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 0x258; - _gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0x258, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x258; + _vm->_gnapActionStatus = -1; break; case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; } } - if (_gameSys->getAnimationStatus(1) == 2) { - _gameSys->setAnimation(0, 0, 1); - switch (_platypusActionStatus) { + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + switch (_vm->_platypusActionStatus) { case kASTryGetWrench: - _platypusActionStatus = -1; + _vm->_platypusActionStatus = -1; ++_s17_platTryGetWrenchCtr; if (_s17_platTryGetWrenchCtr % 2 != 0) _s17_nextWrenchSequenceId = 0x233; @@ -660,17 +667,17 @@ void GnapEngine::scene17_updateAnimations() { _s17_nextCarWindowSequenceId = 0x249; break; case kASGetWrenchDone: - _platypusActionStatus = -1; - invAdd(kItemWrench); - setGrabCursorSprite(kItemWrench); + _vm->_platypusActionStatus = -1; + _vm->invAdd(kItemWrench); + _vm->setGrabCursorSprite(kItemWrench); break; case kASPlatUsePhone: - _gameSys->setAnimation(0x24E, _platypusId, 1); - _gameSys->insertSequence(0x24E, _platypusId, _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); - _platypusSequenceDatNum = 0; - _platypusSequenceId = 0x24E; - _platypusActionStatus = kASLeaveScene; - _newSceneNum = 53; + _vm->_gameSys->setAnimation(0x24E, _vm->_platypusId, 1); + _vm->_gameSys->insertSequence(0x24E, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceDatNum = 0; + _vm->_platypusSequenceId = 0x24E; + _vm->_platypusActionStatus = kASLeaveScene; + _vm->_newSceneNum = 53; break; case kASPlatPhoningAssistant: ++_s17_platPhoneCtr; @@ -678,103 +685,103 @@ void GnapEngine::scene17_updateAnimations() { _s17_platPhoneCtr = 0; _s17_nextPhoneSequenceId = -1; _s17_currPhoneSequenceId = -1; - _gameSys->insertSequence(0x25B, _platypusId, 0x25A, _platypusId, kSeqSyncWait, 0, 0, 0); - _platypusSequenceDatNum = 0; - _platypusSequenceId = 0x25B; - _platypusActionStatus = -1; - clearFlag(kGFPlatypusTalkingToAssistant); - _sceneWaiting = false; - scene17_updateHotspots(); + _vm->_gameSys->insertSequence(0x25B, _vm->_platypusId, 0x25A, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceDatNum = 0; + _vm->_platypusSequenceId = 0x25B; + _vm->_platypusActionStatus = -1; + _vm->clearFlag(kGFPlatypusTalkingToAssistant); + _vm->_sceneWaiting = false; + updateHotspots(); } else { _s17_nextPhoneSequenceId = kPlatPhoneSequenceIds[_s17_platPhoneCtr]; - _gameSys->setAnimation(_s17_nextPhoneSequenceId, 254, 1); - _gameSys->insertSequence(_s17_nextPhoneSequenceId, 254, _s17_currPhoneSequenceId, 254, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x25A, _platypusId, 0x25A, _platypusId, kSeqSyncWait, 0, 0, 0); - _platypusSequenceDatNum = 0; - _platypusSequenceId = 0x25A; + _vm->_gameSys->setAnimation(_s17_nextPhoneSequenceId, 254, 1); + _vm->_gameSys->insertSequence(_s17_nextPhoneSequenceId, 254, _s17_currPhoneSequenceId, 254, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x25A, _vm->_platypusId, 0x25A, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceDatNum = 0; + _vm->_platypusSequenceId = 0x25A; _s17_currPhoneSequenceId = _s17_nextPhoneSequenceId; } break; case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; } } - if (_gameSys->getAnimationStatus(2) == 2) { + if (_vm->_gameSys->getAnimationStatus(2) == 2) { switch (_s17_nextWrenchSequenceId) { case 0x233: - _gnapActionStatus = -1; - _gameSys->insertSequence(0x243, _platypusId, - _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, + _vm->_gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0x243, _vm->_platypusId, + _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _s17_currWrenchSequenceId = _s17_nextWrenchSequenceId; _s17_nextWrenchSequenceId = -1; - _platypusSequenceId = 0x243; - _platypusSequenceDatNum = 0; - _gameSys->setAnimation(0x243, _platypusId, 1); + _vm->_platypusSequenceId = 0x243; + _vm->_platypusSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x243, _vm->_platypusId, 1); break; case 0x234: - _gnapActionStatus = -1; - _gameSys->insertSequence(0x242, _platypusId, - _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, + _vm->_gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0x242, _vm->_platypusId, + _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _s17_currWrenchSequenceId = _s17_nextWrenchSequenceId; _s17_nextWrenchSequenceId = -1; - _platypusSequenceId = 0x242; - _platypusSequenceDatNum = 0; - _gameSys->setAnimation(0x242, _platypusId, 1); + _vm->_platypusSequenceId = 0x242; + _vm->_platypusSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x242, _vm->_platypusId, 1); break; case 0x231: - if (getRandom(2) != 0) + if (_vm->getRandom(2) != 0) _s17_nextCarWindowSequenceId = 0x245; else _s17_nextCarWindowSequenceId = 0x248; - _gameSys->setAnimation(0, 0, 2); + _vm->_gameSys->setAnimation(0, 0, 2); break; case 0x232: _s17_nextCarWindowSequenceId = 0x247; - _gameSys->setAnimation(0, 0, 2); + _vm->_gameSys->setAnimation(0, 0, 2); break; case 0x22E: case 0x235: if (_s17_nextWrenchSequenceId == 0x235) - _hotspots[kHSWrench]._flags &= ~SF_DISABLED; + _vm->_hotspots[kHSWrench]._flags &= ~SF_DISABLED; else - _hotspots[kHSWrench]._flags |= SF_DISABLED; + _vm->_hotspots[kHSWrench]._flags |= SF_DISABLED; _s17_canTryGetWrench = !_s17_canTryGetWrench; - _gameSys->setAnimation(_s17_nextWrenchSequenceId, 40, 2); - _gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s17_nextWrenchSequenceId, 40, 2); + _vm->_gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _s17_currWrenchSequenceId = _s17_nextWrenchSequenceId; _s17_nextWrenchSequenceId = -1; break; case 0x230: - if (_gnapActionStatus == kASGetWrenchGnapReady) { - _gameSys->setAnimation(0, 0, 2); + if (_vm->_gnapActionStatus == kASGetWrenchGnapReady) { + _vm->_gameSys->setAnimation(0, 0, 2); if (_s17_canTryGetWrench) { - _gameSys->insertSequence(0x22E, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x22E, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _s17_currWrenchSequenceId = 0x22E; _s17_canTryGetWrench = false; } - _gameSys->setAnimation(0x23F, _platypusId, 1); - _gameSys->insertSequence(0x10875, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x23F, _platypusId, - _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, + _vm->_gameSys->setAnimation(0x23F, _vm->_platypusId, 1); + _vm->_gameSys->insertSequence(0x10875, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x23F, _vm->_platypusId, + _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceDatNum = 1; - _platypusSequenceDatNum = 0; - _gnapSequenceId = 0x875; - _platypusSequenceId = 0x23F; - gnapWalkTo(3, 8, -1, 0x107B9, 1); - _platypusActionStatus = kASGetWrench2; + _vm->_gnapSequenceDatNum = 1; + _vm->_platypusSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x875; + _vm->_platypusSequenceId = 0x23F; + _vm->gnapWalkTo(3, 8, -1, 0x107B9, 1); + _vm->_platypusActionStatus = kASGetWrench2; } break; default: if (_s17_nextWrenchSequenceId != -1) { - _gameSys->setAnimation(_s17_nextWrenchSequenceId, 40, 2); - _gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s17_nextWrenchSequenceId, 40, 2); + _vm->_gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _s17_currWrenchSequenceId = _s17_nextWrenchSequenceId; _s17_nextWrenchSequenceId = -1; } @@ -782,60 +789,60 @@ void GnapEngine::scene17_updateAnimations() { } } - if (_gameSys->getAnimationStatus(3) == 2) { + if (_vm->_gameSys->getAnimationStatus(3) == 2) { switch (_s17_nextCarWindowSequenceId) { case 0x246: - _gameSys->setAnimation(_s17_nextCarWindowSequenceId, 40, 3); - _gameSys->insertSequence(_s17_nextCarWindowSequenceId, 40, _s17_currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s17_nextCarWindowSequenceId, 40, 3); + _vm->_gameSys->insertSequence(_s17_nextCarWindowSequenceId, 40, _s17_currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); _s17_currCarWindowSequenceId = _s17_nextCarWindowSequenceId; _s17_nextCarWindowSequenceId = -1; break; case 0x245: case 0x247: case 0x248: - _gameSys->setAnimation(_s17_nextWrenchSequenceId, 40, 2); - _gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (_gameSys->getAnimationStatus(2) != 2) - scene17_update(); - _gameSys->setAnimation(_s17_nextCarWindowSequenceId, 40, 3); - _gameSys->insertSequence(_s17_nextCarWindowSequenceId, 40, _s17_currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s17_nextWrenchSequenceId, 40, 2); + _vm->_gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(2) != 2) + update(); + _vm->_gameSys->setAnimation(_s17_nextCarWindowSequenceId, 40, 3); + _vm->_gameSys->insertSequence(_s17_nextCarWindowSequenceId, 40, _s17_currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); _s17_currCarWindowSequenceId = _s17_nextCarWindowSequenceId; _s17_nextCarWindowSequenceId = -1; _s17_currWrenchSequenceId = _s17_nextWrenchSequenceId; _s17_nextWrenchSequenceId = -1; break; case 0x249: - _gameSys->setAnimation(0x230, 40, 2); - _gameSys->setAnimation(0x240, _platypusId, 1); - _gameSys->insertSequence(0x230, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(_s17_nextCarWindowSequenceId, 40, _s17_currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x240, _platypusId, _platypusSequenceId, _platypusId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x23E, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x23E; - _gnapSequenceDatNum = 0; - _platypusSequenceId = 0x240; - _platypusSequenceDatNum = 0; - _gameSys->setAnimation(0x24A, 40, 3); - _gameSys->insertSequence(0x24A, 40, _s17_nextCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (_gameSys->getAnimationStatus(2) != 2) { - scene17_update(); - if (_gameSys->getAnimationStatus(3) == 2) { - _gameSys->setAnimation(0x24A, 40, 3); - _gameSys->insertSequence(0x24A, 40, 586, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x230, 40, 2); + _vm->_gameSys->setAnimation(0x240, _vm->_platypusId, 1); + _vm->_gameSys->insertSequence(0x230, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(_s17_nextCarWindowSequenceId, 40, _s17_currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x240, _vm->_platypusId, _vm->_platypusSequenceId, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x23E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x23E; + _vm->_gnapSequenceDatNum = 0; + _vm->_platypusSequenceId = 0x240; + _vm->_platypusSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x24A, 40, 3); + _vm->_gameSys->insertSequence(0x24A, 40, _s17_nextCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(2) != 2) { + update(); + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + _vm->_gameSys->setAnimation(0x24A, 40, 3); + _vm->_gameSys->insertSequence(0x24A, 40, 586, 40, kSeqSyncWait, 0, 0, 0); } } - _gameSys->insertSequence(0x22D, 40, 560, 40, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0x24B, 40, 3); - _gameSys->insertSequence(0x24B, 40, 586, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x22D, 40, 560, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x24B, 40, 3); + _vm->_gameSys->insertSequence(0x24B, 40, 586, 40, kSeqSyncWait, 0, 0, 0); _s17_currCarWindowSequenceId = 0x24B; _s17_nextCarWindowSequenceId = -1; _s17_currWrenchSequenceId = 0x22D; _s17_nextWrenchSequenceId = -1; - setFlag(kGFGrassTaken); - _gnapActionStatus = -1; - _platypusActionStatus = 2; - scene17_updateHotspots(); - _timers[5] = getRandom(30) + 80; + _vm->setFlag(kGFGrassTaken); + _vm->_gnapActionStatus = -1; + _vm->_platypusActionStatus = 2; + updateHotspots(); + _vm->_timers[5] = _vm->getRandom(30) + 80; break; } } diff --git a/engines/gnap/scenes/scene17.h b/engines/gnap/scenes/scene17.h new file mode 100644 index 0000000000..108ef952b2 --- /dev/null +++ b/engines/gnap/scenes/scene17.h @@ -0,0 +1,61 @@ +/* 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_SCENE17_H +#define GNAP_SCENE17_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene17: public Scene { +public: + Scene17(GnapEngine *vm); + ~Scene17() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + bool _s17_canTryGetWrench; + int _s17_wrenchCtr; + int _s17_platPhoneCtr; + int _s17_platTryGetWrenchCtr; + int _s17_nextPhoneSequenceId; + int _s17_currPhoneSequenceId; + int _s17_nextWrenchSequenceId; + int _s17_currWrenchSequenceId; + int _s17_nextCarWindowSequenceId; + int _s17_currCarWindowSequenceId; + + void update(); + void platHangUpPhone(); +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE15_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 2f93098ebc..68370e25eb 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -42,6 +42,7 @@ #include "gnap/scenes/scene14.h" #include "gnap/scenes/scene15.h" #include "gnap/scenes/scene16.h" +#include "gnap/scenes/scene17.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -168,8 +169,9 @@ int GnapEngine::initSceneLogic() { _gameSys->setScaleValues(0, 500, 1, 1000); break; case 17: - backgroundId = scene17_init(); - scene17_updateHotspots(); + _scene = new Scene17(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -490,7 +492,8 @@ void GnapEngine::runSceneLogic() { delete _scene; break; case 17: - scene17_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 20; break; |