diff options
author | Strangerke | 2016-04-24 11:59:30 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-05-10 09:54:21 +0200 |
commit | 1095af09a666e9e44c9f95b2e6d41436e3189604 (patch) | |
tree | 38108b484a1ee896981eb1188f7f6c2f45bb9f1d | |
parent | a5d312b23f68ef3480a5e7bd516ea844dafa8318 (diff) | |
download | scummvm-rg350-1095af09a666e9e44c9f95b2e6d41436e3189604.tar.gz scummvm-rg350-1095af09a666e9e44c9f95b2e6d41436e3189604.tar.bz2 scummvm-rg350-1095af09a666e9e44c9f95b2e6d41436e3189604.zip |
GNAP: Refactor scene 38
-rw-r--r-- | engines/gnap/gnap.h | 6 | ||||
-rw-r--r-- | engines/gnap/scenes/scene38.cpp | 392 | ||||
-rw-r--r-- | engines/gnap/scenes/scene38.h | 48 | ||||
-rw-r--r-- | engines/gnap/scenes/scenecore.cpp | 9 |
4 files changed, 248 insertions, 207 deletions
diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 79e6b6344e..4bcf7fc981 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -606,12 +606,6 @@ public: // Shared by scenes 17 & 18 int _s18_garbageCanPos; - // Scene 38 - int scene38_init(); - void scene38_updateHotspots(); - void scene38_run(); - void scene38_updateAnimations(); - // Scene 39 int _s39_currGuySequenceId, _s39_nextGuySequenceId; int scene39_init(); diff --git a/engines/gnap/scenes/scene38.cpp b/engines/gnap/scenes/scene38.cpp index 81da7642b4..9360afdd54 100644 --- a/engines/gnap/scenes/scene38.cpp +++ b/engines/gnap/scenes/scene38.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene38.h" namespace Gnap { @@ -52,156 +53,156 @@ enum { kASPlatypusHoldingTrapDoor = 6 }; -int GnapEngine::scene38_init() { - _gameSys->setAnimation(0, 0, 0); - _gameSys->setAnimation(0, 0, 1); - return 0xA5; +Scene38::Scene38(GnapEngine *vm) : Scene(vm) { } -void GnapEngine::scene38_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitHouse, 150, 585, 650, 600, SF_EXIT_D_CURSOR, 0, 8); - setHotspot(kHSExitCave, 430, 440, 655, 470, SF_WALKABLE, 0, 8); - setHotspot(kHSTrapDoorLid1, 525, 265, 640, 350, SF_DISABLED); - setHotspot(kHSTrapDoorLid2, 555, 350, 670, 430, SF_DISABLED); - setHotspot(kHSHuntingTrophy, 170, 85, 250, 190, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 8); - setHotspot(kHSWalkArea1, 330, 270, 640, 380, SF_DISABLED | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 8); - setHotspot(kHSWalkArea2, 0, 0, 799, 396); - setHotspot(kHSWalkArea3, 0, 585, 799, 599, SF_WALKABLE | SF_DISABLED); - setHotspot(kHSWalkArea4, 0, 0, 97, 445); - setHotspot(kHSWalkArea5, 770, 0, 799, 445); - setHotspot(kHSWalkArea6, 393, 0, 698, 445, SF_WALKABLE | SF_DISABLED); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_DISABLED; - if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _hotspots[kHSExitCave]._flags = SF_EXIT_D_CURSOR; - else if (_gnapActionStatus == kASHoldingHuntingTrophy) - _hotspots[kHSExitCave]._flags = SF_EXIT_D_CURSOR; - if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _hotspots[kHSTrapDoorLid1]._flags = SF_DISABLED; - else if (_gnapActionStatus == kASHoldingHuntingTrophy) - _hotspots[kHSTrapDoorLid1]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _hotspots[kHSTrapDoorLid2]._flags = SF_DISABLED; - else if (_gnapActionStatus == kASHoldingHuntingTrophy) - _hotspots[kHSTrapDoorLid2]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _hotspots[kHSWalkArea6]._flags = SF_NONE; - _hotspotsCount = 13; +int Scene38::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + return 0xA5; } -void GnapEngine::scene38_run() { +void Scene38::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitHouse, 150, 585, 650, 600, SF_EXIT_D_CURSOR, 0, 8); + _vm->setHotspot(kHSExitCave, 430, 440, 655, 470, SF_WALKABLE, 0, 8); + _vm->setHotspot(kHSTrapDoorLid1, 525, 265, 640, 350, SF_DISABLED); + _vm->setHotspot(kHSTrapDoorLid2, 555, 350, 670, 430, SF_DISABLED); + _vm->setHotspot(kHSHuntingTrophy, 170, 85, 250, 190, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 8); + _vm->setHotspot(kHSWalkArea1, 330, 270, 640, 380, SF_DISABLED | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 8); + _vm->setHotspot(kHSWalkArea2, 0, 0, 799, 396); + _vm->setHotspot(kHSWalkArea3, 0, 585, 799, 599, SF_WALKABLE | SF_DISABLED); + _vm->setHotspot(kHSWalkArea4, 0, 0, 97, 445); + _vm->setHotspot(kHSWalkArea5, 770, 0, 799, 445); + _vm->setHotspot(kHSWalkArea6, 393, 0, 698, 445, SF_WALKABLE | SF_DISABLED); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) + _vm->_hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_DISABLED; + if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) + _vm->_hotspots[kHSExitCave]._flags = SF_EXIT_D_CURSOR; + else if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) + _vm->_hotspots[kHSExitCave]._flags = SF_EXIT_D_CURSOR; + if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) + _vm->_hotspots[kHSTrapDoorLid1]._flags = SF_DISABLED; + else if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) + _vm->_hotspots[kHSTrapDoorLid1]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) + _vm->_hotspots[kHSTrapDoorLid2]._flags = SF_DISABLED; + else if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) + _vm->_hotspots[kHSTrapDoorLid2]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) + _vm->_hotspots[kHSWalkArea6]._flags = SF_NONE; + _vm->_hotspotsCount = 13; +} - queueInsertDeviceIcon(); - _gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); +void Scene38::run() { + _vm->queueInsertDeviceIcon(); + _vm->_gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); - if (_prevSceneNum == 39) { - initGnapPos(3, 7, kDirBottomLeft); - initPlatypusPos(4, 7, kDirUnk4); + if (_vm->_prevSceneNum == 39) { + _vm->initGnapPos(3, 7, kDirBottomLeft); + _vm->initPlatypusPos(4, 7, kDirUnk4); } else { - initGnapPos(3, 8, kDirBottomRight); - initPlatypusPos(4, 8, kDirNone); + _vm->initGnapPos(3, 8, kDirBottomRight); + _vm->initPlatypusPos(4, 8, kDirNone); } - endSceneInit(); - - while (!_sceneDone) { - - updateMouseCursor(); - updateCursorByHotspot(); + _vm->endSceneInit(); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - switch (_sceneClickedHotspot) { + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - runMenu(); - scene38_updateHotspots(); + _vm->runMenu(); + updateHotspots(); break; case kHSPlatypus: - if (_gnapActionStatus == kASHoldingHuntingTrophy) { - _gnapActionStatus = kASReleaseHuntingTrophy; - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(_platX, _platY); + if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) { + _vm->_gnapActionStatus = kASReleaseHuntingTrophy; + } 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(_platX, _platY); + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); break; } } break; case kHSExitHouse: - if (_gnapActionStatus == kASHoldingHuntingTrophy) { - _gnapActionStatus = kASReleaseHuntingTrophy; + if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) { + _vm->_gnapActionStatus = kASReleaseHuntingTrophy; } else { - _isLeavingScene = true; - gnapWalkTo(-1, -1, 0, 0x107AE, 1); - _gnapActionStatus = kASLeaveScene; - _newSceneNum = 37; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(-1, -1, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->_newSceneNum = 37; } break; case kHSExitCave: - if (_gnapActionStatus == kASHoldingHuntingTrophy) { - _gnapActionStatus = kASReleaseHuntingTrophy; - if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _isLeavingScene = true; - } else if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) { - _sceneWaiting = false; - _isLeavingScene = true; - gnapWalkTo(5, 7, 0, 0x107BB, 1); - _newSceneNum = 39; - _gnapActionStatus = kASExitCave; + if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) { + _vm->_gnapActionStatus = kASReleaseHuntingTrophy; + if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) + _vm->_isLeavingScene = true; + } else if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) { + _vm->_sceneWaiting = false; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(5, 7, 0, 0x107BB, 1); + _vm->_newSceneNum = 39; + _vm->_gnapActionStatus = kASExitCave; } break; case kHSTrapDoorLid1: case kHSTrapDoorLid2: - if (_gnapActionStatus == kASHoldingHuntingTrophy) { - if (_verbCursor == PLAT_CURSOR && _platypusActionStatus != kASPlatypusHoldingTrapDoor) - _gnapActionStatus = kASUsePlatypusWithTrapDoor; + if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) { + if (_vm->_verbCursor == PLAT_CURSOR && _vm->_platypusActionStatus != kASPlatypusHoldingTrapDoor) + _vm->_gnapActionStatus = kASUsePlatypusWithTrapDoor; else - _gnapActionStatus = kASReleaseHuntingTrophy; + _vm->_gnapActionStatus = kASReleaseHuntingTrophy; } break; case kHSHuntingTrophy: - if (_gnapActionStatus != kASHoldingHuntingTrophy) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(3, 6, 2, 0); + if (_vm->_gnapActionStatus != kASHoldingHuntingTrophy) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(3, 6, 2, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(0, 0); + _vm->playGnapScratchingHead(0, 0); break; case GRAB_CURSOR: - if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) - playGnapImpossible(0, 0); + if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) + _vm->playGnapImpossible(0, 0); else { - gnapWalkTo(3, 6, 0, 0x107BB, 1); - platypusWalkTo(4, 8, -1, -1, 1); - _gnapActionStatus = kASUseHuntingTrophy; + _vm->gnapWalkTo(3, 6, 0, 0x107BB, 1); + _vm->platypusWalkTo(4, 8, -1, -1, 1); + _vm->_gnapActionStatus = kASUseHuntingTrophy; } break; case TALK_CURSOR: - playGnapBrainPulsating(2, 0); + _vm->playGnapBrainPulsating(2, 0); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -217,148 +218,143 @@ void GnapEngine::scene38_run() { case kHSWalkArea4: case kHSWalkArea5: case kHSWalkArea6: - if (_gnapActionStatus == kASHoldingHuntingTrophy) - _gnapActionStatus = kASReleaseHuntingTrophy; - else if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) + _vm->_gnapActionStatus = kASReleaseHuntingTrophy; + else if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left) { - if (_gnapActionStatus == kASHoldingHuntingTrophy) - _gnapActionStatus = kASReleaseHuntingTrophy; - else if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left) { + if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) + _vm->_gnapActionStatus = kASReleaseHuntingTrophy; + else if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; - } - scene38_updateAnimations(); + updateAnimations(); - if (!_isLeavingScene) { - updatePlatypusIdleSequence(); - updateGnapIdleSequence(); + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene38_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene38_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene38::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 kASExitCave: - _gameSys->removeSequence(_platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, true); - _gameSys->insertSequence(0xA3, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0xA3; - _gnapSequenceDatNum = 0; - _gameSys->setAnimation(0xA3, _gnapId, 0); - _gnapActionStatus = kASLeaveScene; + _vm->_gameSys->removeSequence(_vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, true); + _vm->_gameSys->insertSequence(0xA3, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0xA3; + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0xA3, _vm->_gnapId, 0); + _vm->_gnapActionStatus = kASLeaveScene; break; case kASUseHuntingTrophy: - _gameSys->removeSequence(0x9B, 0, true); - _gameSys->insertSequence(0x9C, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x9C; - _gnapSequenceDatNum = 0; - _gameSys->setAnimation(0x9C, _gnapId, 0); - _gnapActionStatus = kASHoldingHuntingTrophy; - scene38_updateHotspots(); + _vm->_gameSys->removeSequence(0x9B, 0, true); + _vm->_gameSys->insertSequence(0x9C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x9C; + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x9C, _vm->_gnapId, 0); + _vm->_gnapActionStatus = kASHoldingHuntingTrophy; + updateHotspots(); break; case kASHoldingHuntingTrophy: - if (_platypusActionStatus != kASPlatypusHoldingTrapDoor) - _sceneWaiting = true; - if (_gnapSequenceId == 0xA4) { - _gameSys->insertSequence(0x9D, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x9D; + if (_vm->_platypusActionStatus != kASPlatypusHoldingTrapDoor) + _vm->_sceneWaiting = true; + if (_vm->_gnapSequenceId == 0xA4) { + _vm->_gameSys->insertSequence(0x9D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x9D; } else { - _gameSys->insertSequence(0xA4, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0xA4; + _vm->_gameSys->insertSequence(0xA4, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0xA4; } - _gnapSequenceDatNum = 0; - _gameSys->setAnimation(_gnapSequenceId, _gnapId, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->setAnimation(_vm->_gnapSequenceId, _vm->_gnapId, 0); break; case kASReleaseHuntingTrophy: - if (_gnapSequenceId == 0x9E) { - _gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); - _gnapActionStatus = -1; - } else if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) { - _gameSys->insertSequence(0xA0, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0xA0; - _gnapSequenceDatNum = 0; - _gnapX = 3; - _gnapY = 6; - _gnapIdleFacing = kDirBottomRight; - if (_isLeavingScene) { - _sceneWaiting = false; - gnapWalkTo(5, 7, 0, 0x107BB, 1); - _newSceneNum = 39; - _gnapActionStatus = kASExitCave; + if (_vm->_gnapSequenceId == 0x9E) { + _vm->_gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapActionStatus = -1; + } else if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) { + _vm->_gameSys->insertSequence(0xA0, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0xA0; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapX = 3; + _vm->_gnapY = 6; + _vm->_gnapIdleFacing = kDirBottomRight; + if (_vm->_isLeavingScene) { + _vm->_sceneWaiting = false; + _vm->gnapWalkTo(5, 7, 0, 0x107BB, 1); + _vm->_newSceneNum = 39; + _vm->_gnapActionStatus = kASExitCave; } else { - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; } } else { - _gameSys->insertSequence(0x9E, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x9E; - _gnapSequenceDatNum = 0; - _gnapX = 3; - _gnapY = 6; - _gnapIdleFacing = kDirBottomRight; - _gameSys->setAnimation(0x9E, _gnapId, 0); - _sceneWaiting = false; - scene38_updateHotspots(); + _vm->_gameSys->insertSequence(0x9E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x9E; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapX = 3; + _vm->_gnapY = 6; + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gameSys->setAnimation(0x9E, _vm->_gnapId, 0); + _vm->_sceneWaiting = false; + updateHotspots(); } break; case kASUsePlatypusWithTrapDoor: - _sceneWaiting = false; - _gameSys->insertSequence(0x9F, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x9F; - _gnapSequenceDatNum = 0; - _gameSys->setAnimation(0x9F, _gnapId, 0); - _gnapActionStatus = kASHoldingHuntingTrophy; - if (_platypusFacing != kDirNone) - playPlatypusSequence(0x107D5); + _vm->_sceneWaiting = false; + _vm->_gameSys->insertSequence(0x9F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x9F; + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x9F, _vm->_gnapId, 0); + _vm->_gnapActionStatus = kASHoldingHuntingTrophy; + if (_vm->_platypusFacing != kDirNone) + _vm->playPlatypusSequence(0x107D5); else - playPlatypusSequence(0x107D4); - platypusWalkTo(8, 7, -1, 0x107D2, 1); - _gameSys->insertSequence(0xA1, _gnapId + 1, _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); - _platypusSequenceId = 0xA1; - _platypusSequenceDatNum = 0; - _platypusId = _gnapId + 1; - _gameSys->setAnimation(0xA1, _gnapId + 1, 1); - _platypusActionStatus = kASPlatypusHoldingTrapDoor; - scene38_updateHotspots(); + _vm->playPlatypusSequence(0x107D4); + _vm->platypusWalkTo(8, 7, -1, 0x107D2, 1); + _vm->_gameSys->insertSequence(0xA1, _vm->_gnapId + 1, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceId = 0xA1; + _vm->_platypusSequenceDatNum = 0; + _vm->_platypusId = _vm->_gnapId + 1; + _vm->_gameSys->setAnimation(0xA1, _vm->_gnapId + 1, 1); + _vm->_platypusActionStatus = kASPlatypusHoldingTrapDoor; + updateHotspots(); break; } } - if (_gameSys->getAnimationStatus(1) == 2) { - _gameSys->setAnimation(0, 0, 1); - if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) { - _gameSys->insertSequence(0xA2, _platypusId, _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); - _platypusSequenceId = 0xA2; - _platypusSequenceDatNum = 0; - scene38_updateHotspots(); - _sceneWaiting = true; + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) { + _vm->_gameSys->insertSequence(0xA2, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceId = 0xA2; + _vm->_platypusSequenceDatNum = 0; + updateHotspots(); + _vm->_sceneWaiting = true; } } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene38.h b/engines/gnap/scenes/scene38.h new file mode 100644 index 0000000000..7cc90b75e7 --- /dev/null +++ b/engines/gnap/scenes/scene38.h @@ -0,0 +1,48 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE38_H +#define GNAP_SCENE38_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene38: public Scene { +public: + Scene38(GnapEngine *vm); + ~Scene38() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE38_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index c5b47c650f..75a1f572a6 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -59,6 +59,7 @@ #include "gnap/scenes/scene31.h" #include "gnap/scenes/scene32.h" #include "gnap/scenes/scene33.h" +#include "gnap/scenes/scene38.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -332,8 +333,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 38: - backgroundId = scene38_init(); - scene38_updateHotspots(); + _scene = new Scene38(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -650,7 +652,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 37; break; case 38: - scene38_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 37; break; |