diff options
author | Strangerke | 2016-04-20 01:34:08 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-05-10 09:54:21 +0200 |
commit | 58827530140a94c17053d02774884b23fd1dcab2 (patch) | |
tree | 1182a8a756c923dd00f0a09ed50d3c024005a12b /engines/gnap | |
parent | 729b82a428adf062894b67263485abe11507c416 (diff) | |
download | scummvm-rg350-58827530140a94c17053d02774884b23fd1dcab2.tar.gz scummvm-rg350-58827530140a94c17053d02774884b23fd1dcab2.tar.bz2 scummvm-rg350-58827530140a94c17053d02774884b23fd1dcab2.zip |
GNAP: Refactor scene 4
Diffstat (limited to 'engines/gnap')
-rw-r--r-- | engines/gnap/gnap.cpp | 4 | ||||
-rw-r--r-- | engines/gnap/gnap.h | 9 | ||||
-rw-r--r-- | engines/gnap/scenes/scene04.cpp | 610 | ||||
-rw-r--r-- | engines/gnap/scenes/scene04.h | 52 | ||||
-rw-r--r-- | engines/gnap/scenes/scenecore.cpp | 17 |
5 files changed, 369 insertions, 323 deletions
diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index cb5c889a6e..f706dd3a3d 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2022,10 +2022,6 @@ void GnapEngine::initPlatypusPos(int gridX, int gridY, Facing facing) { //////////////////////////////////////////////////////////////////////////////// void GnapEngine::initGlobalSceneVars() { - // Scene 4 - _s04_dogIdCtr = 0; - //_s04_triedWindow = true;//?? - _s04_triedWindow = false; // Scene 5 _s05_nextChickenSequenceId = -1; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index b6e7425082..ce1a8ab0fc 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -603,15 +603,6 @@ public: void sceneXX_playRandomSound(int timerIndex); void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); - // Scene 4 - bool _s04_triedWindow; - int _s04_dogIdCtr; - int _s04_nextDogSequenceId, _s04_currDogSequenceId; - int scene04_init(); - void scene04_updateHotspots(); - void scene04_run(); - void scene04_updateAnimations(); - // Scene 5 int _s05_nextChickenSequenceId, _s05_currChickenSequenceId; int scene05_init(); diff --git a/engines/gnap/scenes/scene04.cpp b/engines/gnap/scenes/scene04.cpp index cbe5d05034..299656c226 100644 --- a/engines/gnap/scenes/scene04.cpp +++ b/engines/gnap/scenes/scene04.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene04.h" namespace Gnap { @@ -54,153 +55,158 @@ enum { kASGrabAxe = 13 }; -int GnapEngine::scene04_init() { - _gameSys->setAnimation(0, 0, 0); - _gameSys->setAnimation(0, 0, 1); - _gameSys->setAnimation(0, 0, 2); +Scene04::Scene04(GnapEngine *vm) : Scene(vm) { + _s04_dogIdCtr = 0; + _s04_triedWindow = false; + _s04_nextDogSequenceId = -1; + _s04_currDogSequenceId = -1; +} + +int Scene04::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->setAnimation(0, 0, 2); return 0x214; } -void GnapEngine::scene04_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSTwig, 690, 394, 769, 452, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 6); - setHotspot(kHSDog, 550, 442, 680, 552, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); - setHotspot(kHSAxe, 574, 342, 680, 412, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); - setHotspot(kHSDoor, 300, 244, 386, 410, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); - setHotspot(kHSExitTruck, 226, 580, 688, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - setHotspot(kHSWindow, 121, 295, 237, 342, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); - setHotspot(kHSExitBarn, 585, 154, 800, 276, SF_EXIT_U_CURSOR, 10, 8); - setHotspot(kHSWalkArea1, 0, 0, 562, 461); - setHotspot(kHSWalkArea2, 562, 0, 800, 500); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(kGFPlatypus)) - _hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (isFlag(kGFTwigTaken)) - _hotspots[kHSTwig]._flags = SF_WALKABLE | SF_DISABLED; - if (isFlag(kGFPlatypusTalkingToAssistant) || _cursorValue == 1) - _hotspots[kHSAxe]._flags = SF_DISABLED; - _hotspotsCount = 11; +void Scene04::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSTwig, 690, 394, 769, 452, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 6); + _vm->setHotspot(kHSDog, 550, 442, 680, 552, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); + _vm->setHotspot(kHSAxe, 574, 342, 680, 412, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); + _vm->setHotspot(kHSDoor, 300, 244, 386, 410, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); + _vm->setHotspot(kHSExitTruck, 226, 580, 688, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHSWindow, 121, 295, 237, 342, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); + _vm->setHotspot(kHSExitBarn, 585, 154, 800, 276, SF_EXIT_U_CURSOR, 10, 8); + _vm->setHotspot(kHSWalkArea1, 0, 0, 562, 461); + _vm->setHotspot(kHSWalkArea2, 562, 0, 800, 500); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->isFlag(kGFPlatypus)) + _vm->_hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + if (_vm->isFlag(kGFTwigTaken)) + _vm->_hotspots[kHSTwig]._flags = SF_WALKABLE | SF_DISABLED; + if (_vm->isFlag(kGFPlatypusTalkingToAssistant) || _vm->_cursorValue == 1) + _vm->_hotspots[kHSAxe]._flags = SF_DISABLED; + _vm->_hotspotsCount = 11; } -void GnapEngine::scene04_run() { - playSound(0x1091C, true); - startSoundTimerC(4); +void Scene04::run() { + _vm->playSound(0x1091C, true); + _vm->startSoundTimerC(4); - _gameSys->insertSequence(0x210, 139 - _s04_dogIdCtr, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x210, 139 - _s04_dogIdCtr, 0, 0, kSeqNone, 0, 0, 0); _s04_currDogSequenceId = 0x210; _s04_nextDogSequenceId = -1; - _gameSys->setAnimation(0x210, 139 - _s04_dogIdCtr, 3); + _vm->_gameSys->setAnimation(0x210, 139 - _s04_dogIdCtr, 3); _s04_dogIdCtr = (_s04_dogIdCtr + 1) % 2; - _timers[6] = getRandom(20) + 60; - _timers[5] = getRandom(150) + 300; - _timers[7] = getRandom(150) + 200; - _timers[8] = getRandom(150) + 400; + _vm->_timers[6] = _vm->getRandom(20) + 60; + _vm->_timers[5] = _vm->getRandom(150) + 300; + _vm->_timers[7] = _vm->getRandom(150) + 200; + _vm->_timers[8] = _vm->getRandom(150) + 400; - if (!isFlag(kGFPlatypusTalkingToAssistant) && _cursorValue == 4) - _gameSys->insertSequence(0x212, 100, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->isFlag(kGFPlatypusTalkingToAssistant) && _vm->_cursorValue == 4) + _vm->_gameSys->insertSequence(0x212, 100, 0, 0, kSeqNone, 0, 0, 0); - if (!isFlag(kGFTwigTaken)) - _gameSys->insertSequence(0x1FE, 100, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->isFlag(kGFTwigTaken)) + _vm->_gameSys->insertSequence(0x1FE, 100, 0, 0, kSeqNone, 0, 0, 0); - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - if (isFlag(kGFPlatyPussDisguised)) { - _timers[3] = 300; + if (_vm->isFlag(kGFPlatyPussDisguised)) { + _vm->_timers[3] = 300; // TODO setCursor((LPCSTR)IDC_WAIT); - setGrabCursorSprite(kItemKeys); - _gnapX = 4; - _gnapY = 7; - _gnapId = 140; - _platX = 6; - _platY = 7; - _platypusId = 141; - _gameSys->insertSequence(0x107B5, 140, 0, 0, kSeqNone, 0, 300 - _gnapGridX, 336 - _gnapGridY); - _gameSys->insertSequence(0x20C, 141, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x208, 121, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x209, 121, 0x208, 121, kSeqSyncWait, 0, 0, 0); - endSceneInit(); - invRemove(kItemDisguise); - invAdd(kItemKeys); - setFlag(kGFKeysTaken); - clearFlag(kGFPlatyPussDisguised); - _platypusSequenceId = 0x20C; - _platypusSequenceDatNum = 0; - _platypusFacing = kDirBottomRight; - _gnapSequenceId = 0x7B5; - _gnapSequenceDatNum = 1; - _gameSys->waitForUpdate(); + _vm->setGrabCursorSprite(kItemKeys); + _vm->_gnapX = 4; + _vm->_gnapY = 7; + _vm->_gnapId = 140; + _vm->_platX = 6; + _vm->_platY = 7; + _vm->_platypusId = 141; + _vm->_gameSys->insertSequence(0x107B5, 140, 0, 0, kSeqNone, 0, 300 - _vm->_gnapGridX, 336 - _vm->_gnapGridY); + _vm->_gameSys->insertSequence(0x20C, 141, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x208, 121, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x209, 121, 0x208, 121, kSeqSyncWait, 0, 0, 0); + _vm->endSceneInit(); + _vm->invRemove(kItemDisguise); + _vm->invAdd(kItemKeys); + _vm->setFlag(kGFKeysTaken); + _vm->clearFlag(kGFPlatyPussDisguised); + _vm->_platypusSequenceId = 0x20C; + _vm->_platypusSequenceDatNum = 0; + _vm->_platypusFacing = kDirBottomRight; + _vm->_gnapSequenceId = 0x7B5; + _vm->_gnapSequenceDatNum = 1; + _vm->_gameSys->waitForUpdate(); } else { - _gameSys->insertSequence(0x209, 121, 0, 0, kSeqNone, 0, 0, 0); - if (_prevSceneNum == 2) { - initGnapPos(5, 11, kDirUpRight); - if (isFlag(kGFPlatypus)) - initPlatypusPos(6, 11, kDirUpLeft); - endSceneInit(); - if (isFlag(kGFPlatypus)) - platypusWalkTo(5, 8, -1, 0x107C2, 1); - gnapWalkTo(6, 9, -1, 0x107BA, 1); - } else if (_prevSceneNum == 38) { - initGnapPos(5, 7, kDirBottomRight); - initPlatypusPos(4, 7, kDirNone); - endSceneInit(); + _vm->_gameSys->insertSequence(0x209, 121, 0, 0, kSeqNone, 0, 0, 0); + if (_vm->_prevSceneNum == 2) { + _vm->initGnapPos(5, 11, kDirUpRight); + if (_vm->isFlag(kGFPlatypus)) + _vm->initPlatypusPos(6, 11, kDirUpLeft); + _vm->endSceneInit(); + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(5, 8, -1, 0x107C2, 1); + _vm->gnapWalkTo(6, 9, -1, 0x107BA, 1); + } else if (_vm->_prevSceneNum == 38) { + _vm->initGnapPos(5, 7, kDirBottomRight); + _vm->initPlatypusPos(4, 7, kDirNone); + _vm->endSceneInit(); } else { - initGnapPos(12, 9, kDirBottomRight); - if (isFlag(kGFPlatypus)) - initPlatypusPos(12, 8, kDirNone); - endSceneInit(); - if (isFlag(kGFPlatypus)) - platypusWalkTo(9, 8, -1, 0x107C2, 1); - gnapWalkTo(9, 9, -1, 0x107BA, 1); + _vm->initGnapPos(12, 9, kDirBottomRight); + if (_vm->isFlag(kGFPlatypus)) + _vm->initPlatypusPos(12, 8, kDirNone); + _vm->endSceneInit(); + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(9, 8, -1, 0x107C2, 1); + _vm->gnapWalkTo(9, 9, -1, 0x107BA, 1); } } - while (!_sceneDone) { - - updateMouseCursor(); - updateCursorByHotspot(); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - testWalk(0, 4, -1, -1, -1, -1); + _vm->testWalk(0, 4, -1, -1, -1, -1); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene04_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0 && isFlag(kGFPlatypus)) { - if (_grabCursorSpriteIndex == kItemDisguise) { - gnapUseDisguiseOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (_vm->_grabCursorSpriteIndex == kItemDisguise) { + _vm->gnapUseDisguiseOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (isFlag(kGFKeysTaken)) - playGnapMoan1(_platX, _platY); + if (_vm->isFlag(kGFKeysTaken)) + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); else - playGnapScratchingHead(_platX, _platY); + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - if (_cursorValue == 4) - gnapKissPlatypus(0); + if (_vm->_cursorValue == 4) + _vm->gnapKissPlatypus(0); else - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_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; } } @@ -208,23 +214,23 @@ void GnapEngine::scene04_run() { break; case kHSTwig: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowItem(_grabCursorSpriteIndex, 9, 6); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 9, 6); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y); + _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); break; case GRAB_CURSOR: - playGnapPullOutDevice(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y); - playGnapUseDevice(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y); - _gameSys->insertSequence(0x1FD, 100, 510, 100, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0x1FD, 100, 2); + _vm->playGnapPullOutDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + _vm->playGnapUseDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + _vm->_gameSys->insertSequence(0x1FD, 100, 510, 100, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x1FD, 100, 2); break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -232,24 +238,24 @@ void GnapEngine::scene04_run() { break; case kHSAxe: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 9, 5); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 9, 5); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan2(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y); + _vm->playGnapMoan2(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y); break; case GRAB_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASGrabAxe; - setFlag(kGFPlatypusTalkingToAssistant); - scene04_updateHotspots(); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASGrabAxe; + _vm->setFlag(kGFPlatypusTalkingToAssistant); + updateHotspots(); break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -257,31 +263,31 @@ void GnapEngine::scene04_run() { break; case kHSDog: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 9, 7); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 9, 7); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (gnapWalkTo(_gnapX, _gnapY, 0, -1, 1)) { - playGnapMoan2(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y); + if (_vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, -1, 1)) { + _vm->playGnapMoan2(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); _s04_nextDogSequenceId = 0x20F; } break; case GRAB_CURSOR: - _gnapIdleFacing = kDirBottomRight; - if (gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) - _gnapActionStatus = kASGrabDog; + _vm->_gnapIdleFacing = kDirBottomRight; + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + _vm->_gnapActionStatus = kASGrabDog; break; case TALK_CURSOR: - _gnapIdleFacing = kDirBottomRight; - if (gnapWalkTo(_gnapX, _gnapY, 0, -1, 1)) { - playGnapBrainPulsating(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y); + _vm->_gnapIdleFacing = kDirBottomRight; + if (_vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, -1, 1)) { + _vm->playGnapBrainPulsating(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); _s04_nextDogSequenceId = 0x20E; } break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -289,30 +295,30 @@ void GnapEngine::scene04_run() { break; case kHSDoor: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 4, 3); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 4, 3); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: case PLAT_CURSOR: - playGnapScratchingHead(4, 3); + _vm->playGnapScratchingHead(4, 3); break; case GRAB_CURSOR: - if (_cursorValue == 1) { - gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, 0x107BC, 1); - _gnapActionStatus = kASOpenDoor; - _timers[5] = 300; - _gnapIdleFacing = kDirUpLeft; + if (_vm->_cursorValue == 1) { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kASOpenDoor; + _vm->_timers[5] = 300; + _vm->_gnapIdleFacing = kDirUpLeft; } else { - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, 0x107BC, 1); - _gnapActionStatus = kASLeaveScene; - _newSceneNum = 38; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->_newSceneNum = 38; } break; case TALK_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -320,43 +326,43 @@ void GnapEngine::scene04_run() { break; case kHSExitTruck: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[5].x, _hotspotsWalkPos[5].y, 0, 0x107AE, 1); - _gnapActionStatus = kASLeaveScene; - if (isFlag(kGFPlatypus)) - platypusWalkTo(_hotspotsWalkPos[5].x, _hotspotsWalkPos[5].y, -1, 0x107C7, 1); - if (_cursorValue == 1) - _newSceneNum = 2; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kASLeaveScene; + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, -1, 0x107C7, 1); + if (_vm->_cursorValue == 1) + _vm->_newSceneNum = 2; else - _newSceneNum = 33; + _vm->_newSceneNum = 33; } break; case kHSWindow: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 2, 3); - } else if (isFlag(kGFKeysTaken)) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 3); + } else if (_vm->isFlag(kGFKeysTaken)) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (gnapWalkTo(_hotspotsWalkPos[7].x, _hotspotsWalkPos[7].y, 0, getGnapSequenceId(gskIdle, 10, 2) | 0x10000, 1)) { + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y, 0, _vm->getGnapSequenceId(gskIdle, 10, 2) | 0x10000, 1)) { if (_s04_triedWindow) { - _gnapActionStatus = kASGetKeyAnother; + _vm->_gnapActionStatus = kASGetKeyAnother; } else { - _gnapActionStatus = kASGetKeyFirst; + _vm->_gnapActionStatus = kASGetKeyFirst; _s04_triedWindow = true; } } break; case GRAB_CURSOR: - playGnapScratchingHead(_hotspotsWalkPos[7].x, _hotspotsWalkPos[7].y); + _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y); break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -364,207 +370,203 @@ void GnapEngine::scene04_run() { break; case kHSExitBarn: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[8].x, _hotspotsWalkPos[8].y, 0, 0x107AB, 1); - _gnapActionStatus = kASLeaveScene; - if (isFlag(kGFPlatypus)) - platypusWalkTo(_hotspotsWalkPos[8].x, _hotspotsWalkPos[8].y + 1, -1, 0x107C1, 1); - if (_cursorValue == 1) - _newSceneNum = 5; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kASLeaveScene; + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y + 1, -1, 0x107C1, 1); + if (_vm->_cursorValue == 1) + _vm->_newSceneNum = 5; else - _newSceneNum = 35; + _vm->_newSceneNum = 35; } break; case kHSWalkArea1: case kHSWalkArea2: - 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 = false; + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; } - scene04_updateAnimations(); + updateAnimations(); - if (!isSoundPlaying(0x1091C)) - playSound(0x1091C, true); + if (!_vm->isSoundPlaying(0x1091C)) + _vm->playSound(0x1091C, true); - if (!_isLeavingScene) { - if (_platypusActionStatus < 0 && isFlag(kGFPlatypus)) - platypusSub426234(); - if (_gnapActionStatus < 0) - updateGnapIdleSequence2(); - if (!_timers[5]) { - _timers[5] = getRandom(150) + 300; - if (_gnapActionStatus < 0) - _gameSys->insertSequence(0x20D, 79, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0 && _vm->isFlag(kGFPlatypus)) + _vm->platypusSub426234(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence2(); + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(150) + 300; + if (_vm->_gnapActionStatus < 0) + _vm->_gameSys->insertSequence(0x20D, 79, 0, 0, kSeqNone, 0, 0, 0); } - if (!_timers[7]) { - _timers[7] = getRandom(150) + 200; - _gameSys->insertSequence(0x1FC, 59, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->_timers[7]) { + _vm->_timers[7] = _vm->getRandom(150) + 200; + _vm->_gameSys->insertSequence(0x1FC, 59, 0, 0, kSeqNone, 0, 0, 0); } - if (!_timers[6]) { - _timers[6] = getRandom(20) + 60; + if (!_vm->_timers[6]) { + _vm->_timers[6] = _vm->getRandom(20) + 60; if (_s04_nextDogSequenceId == -1) _s04_nextDogSequenceId = 0x210; } - if (!_timers[8]) { - _timers[8] = getRandom(150) + 400; - _gameSys->insertSequence(0x213, 20, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->_timers[8]) { + _vm->_timers[8] = _vm->getRandom(150) + 400; + _vm->_gameSys->insertSequence(0x213, 20, 0, 0, kSeqNone, 0, 0, 0); } - playSoundC(); + _vm->playSoundC(); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene04_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene04_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene04::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 kASOpenDoor: - _gameSys->insertSequence(0x205, _gnapId, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x207, 121, 521, 121, kSeqSyncWait, 0, 0, 0); - _gnapX = 6; - _gnapY = 7; - _gameSys->insertSequence(0x107B5, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncWait, getSequenceTotalDuration(0x205) - 1, 450 - _gnapGridX, 336 - _gnapGridY); - _gameSys->setAnimation(0x107B5, _gnapId, 0); - _gnapSequenceId = 0x7B5; - _gnapSequenceDatNum = 1; - _gnapActionStatus = kASOpenDoorDone; + _vm->_gameSys->insertSequence(0x205, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x207, 121, 521, 121, kSeqSyncWait, 0, 0, 0); + _vm->_gnapX = 6; + _vm->_gnapY = 7; + _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + kSeqSyncWait, _vm->getSequenceTotalDuration(0x205) - 1, 450 - _vm->_gnapGridX, 336 - _vm->_gnapGridY); + _vm->_gameSys->setAnimation(0x107B5, _vm->_gnapId, 0); + _vm->_gnapSequenceId = 0x7B5; + _vm->_gnapSequenceDatNum = 1; + _vm->_gnapActionStatus = kASOpenDoorDone; break; case kASOpenDoorDone: - _gameSys->insertSequence(0x209, 121, 0x207, 121, kSeqSyncWait, 0, 0, 0); - _gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0x209, 121, 0x207, 121, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = -1; break; case kASGetKeyFirst: - _gameSys->insertSequence(0x204, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0x204, _gnapId, 0); - _gnapSequenceId = 0x204; - _gnapSequenceDatNum = 0; - _gnapActionStatus = kASGetKeyFirst2; + _vm->_gameSys->insertSequence(0x204, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x204, _vm->_gnapId, 0); + _vm->_gnapSequenceId = 0x204; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kASGetKeyFirst2; break; case kASGetKeyFirst2: - _gameSys->insertSequence(0x206, 255, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x20B, 256, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->setAnimation(0x20B, 256, 0); - _gnapSequenceId = 0x206; - _gnapSequenceDatNum = 0; - _gnapActionStatus = kASGetKeyFirstDone; + _vm->_gameSys->insertSequence(0x206, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x20B, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x20B, 256, 0); + _vm->_gnapSequenceId = 0x206; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kASGetKeyFirstDone; break; case kASGetKeyFirstDone: - _gameSys->requestRemoveSequence(0x1FF, 256); - _gameSys->requestRemoveSequence(0x20B, 256); - _gameSys->insertSequence(0x107B5, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), 255, - kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); - _gnapIdleFacing = kDirBottomRight; - _gnapSequenceId = 0x7B5; - _gnapSequenceDatNum = 1; - _gnapActionStatus = -1; + _vm->_gameSys->requestRemoveSequence(0x1FF, 256); + _vm->_gameSys->requestRemoveSequence(0x20B, 256); + _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), 255, + kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnapSequenceId = 0x7B5; + _vm->_gnapSequenceDatNum = 1; + _vm->_gnapActionStatus = -1; break; case kASGetKeyAnother: - _gameSys->insertSequence(0x202, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0x202, _gnapId, 0); - _gnapSequenceId = 0x202; - _gnapSequenceDatNum = 0; - _gnapActionStatus = kASGetKeyAnother2; + _vm->_gameSys->insertSequence(0x202, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x202, _vm->_gnapId, 0); + _vm->_gnapSequenceId = 0x202; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kASGetKeyAnother2; break; case kASGetKeyAnother2: - _gameSys->insertSequence(0x203, 255, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x20A, 256, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->setAnimation(0x20A, 256, 0); - _gnapSequenceId = 0x203; - _gnapSequenceDatNum = 0; - _gnapActionStatus = kASGetKeyAnotherDone; + _vm->_gameSys->insertSequence(0x203, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x20A, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x20A, 256, 0); + _vm->_gnapSequenceId = 0x203; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kASGetKeyAnotherDone; break; case kASGetKeyAnotherDone: - _gameSys->removeSequence(0x1FF, 256, true); - _gameSys->removeSequence(0x20A, 256, true); - _gameSys->insertSequence(0x107B5, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), 255, - kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); - _gnapSequenceId = 0x7B5; - _gnapSequenceDatNum = 1; - _gnapIdleFacing = kDirBottomRight; - _gnapActionStatus = -1; + _vm->_gameSys->removeSequence(0x1FF, 256, true); + _vm->_gameSys->removeSequence(0x20A, 256, true); + _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), 255, + kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceId = 0x7B5; + _vm->_gnapSequenceDatNum = 1; + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnapActionStatus = -1; break; case kASGrabDog: _s04_nextDogSequenceId = 0x201; break; case kASGrabAxe: - _gameSys->insertSequence(0x211, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->requestRemoveSequence(0x212, 100); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 0x211; - _gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0x211, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->requestRemoveSequence(0x212, 100); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x211; + _vm->_gnapActionStatus = -1; break; default: - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; } } - if (_gameSys->getAnimationStatus(2) == 2) { - _gameSys->setAnimation(0, 0, 2); - invAdd(kItemTwig); - setGrabCursorSprite(kItemTwig); - setFlag(kGFTwigTaken); - scene04_updateHotspots(); + if (_vm->_gameSys->getAnimationStatus(2) == 2) { + _vm->_gameSys->setAnimation(0, 0, 2); + _vm->invAdd(kItemTwig); + _vm->setGrabCursorSprite(kItemTwig); + _vm->setFlag(kGFTwigTaken); + updateHotspots(); } - if (_gameSys->getAnimationStatus(3) == 2) { + if (_vm->_gameSys->getAnimationStatus(3) == 2) { if (_s04_nextDogSequenceId == 0x201) { - _gameSys->insertSequence(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, + _vm->_gameSys->insertSequence(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, _s04_currDogSequenceId, 139 - (_s04_dogIdCtr + 1) % 2, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x200, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, 3); + _vm->_gameSys->insertSequence(0x200, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, 3); _s04_dogIdCtr = (_s04_dogIdCtr + 1) % 2; _s04_currDogSequenceId = 0x201; - _gnapSequenceId = 0x200; - _gnapSequenceDatNum = 0; - _gnapActionStatus = -1; - _timers[6] = getRandom(20) + 60; + _vm->_gnapSequenceId = 0x200; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = -1; + _vm->_timers[6] = _vm->getRandom(20) + 60; _s04_nextDogSequenceId = -1; } else if (_s04_nextDogSequenceId != -1) { - _gameSys->insertSequence(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, + _vm->_gameSys->insertSequence(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, _s04_currDogSequenceId, 139 - (_s04_dogIdCtr + 1) % 2, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, 3); + _vm->_gameSys->setAnimation(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, 3); _s04_dogIdCtr = (_s04_dogIdCtr + 1) % 2; _s04_currDogSequenceId = _s04_nextDogSequenceId; _s04_nextDogSequenceId = -1; } } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene04.h b/engines/gnap/scenes/scene04.h new file mode 100644 index 0000000000..11a7eeb46e --- /dev/null +++ b/engines/gnap/scenes/scene04.h @@ -0,0 +1,52 @@ +/* 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_SCENE04_H +#define GNAP_SCENE04_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene04: public Scene { +public: + Scene04(GnapEngine *vm); + ~Scene04() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + +private: + bool _s04_triedWindow; + int _s04_dogIdCtr; + int _s04_nextDogSequenceId; + int _s04_currDogSequenceId; +}; + +} // End of namespace Gnap + +#endif // GNAP_SCENE04_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index e88843d9ec..3837b7caf9 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -29,6 +29,7 @@ #include "gnap/scenes/scene01.h" #include "gnap/scenes/scene02.h" #include "gnap/scenes/scene03.h" +#include "gnap/scenes/scene04.h" namespace Gnap { @@ -63,8 +64,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 4: - backgroundId = scene04_init(); - scene04_updateHotspots(); + _scene = new Scene04(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -261,8 +263,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 37: - backgroundId = scene04_init(); - scene04_updateHotspots(); + _scene = new Scene04(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -379,7 +382,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 4; break; case 4: - scene04_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 4; break; @@ -546,7 +550,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 37; break; case 37: - scene04_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 37; break; |