diff options
author | Strangerke | 2016-04-23 13:16:59 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-05-10 09:54:21 +0200 |
commit | 2e37c2b9e67b5196cf014aaa57e785289ec09348 (patch) | |
tree | 5c31ae2b533d85616cfd21f7c4c14876a65f7710 /engines | |
parent | 367a10bdbd7710ca8bbb439df8173d1456221fd4 (diff) | |
download | scummvm-rg350-2e37c2b9e67b5196cf014aaa57e785289ec09348.tar.gz scummvm-rg350-2e37c2b9e67b5196cf014aaa57e785289ec09348.tar.bz2 scummvm-rg350-2e37c2b9e67b5196cf014aaa57e785289ec09348.zip |
GNAP: Refactor scene 28
Diffstat (limited to 'engines')
-rw-r--r-- | engines/gnap/gnap.h | 8 | ||||
-rw-r--r-- | engines/gnap/scenes/scene28.cpp | 446 | ||||
-rw-r--r-- | engines/gnap/scenes/scene28.h | 51 | ||||
-rw-r--r-- | engines/gnap/scenes/scenecore.cpp | 9 |
4 files changed, 280 insertions, 234 deletions
diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 627ee59f86..aa0b3097b4 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -606,14 +606,6 @@ public: // Scene 18 int _s18_garbageCanPos; - // Scene 28 - int _s28_currClownSequenceId, _s28_nextClownSequenceId; - int _s28_clownTalkCtr; - int scene28_init(); - void scene28_updateHotspots(); - void scene28_run(); - void scene28_updateAnimations(); - // Scene 29 int _s28_currMonkeySequenceId, _s28_nextMonkeySequenceId; int _s28_currManSequenceId, _s28_nextManSequenceId; diff --git a/engines/gnap/scenes/scene28.cpp b/engines/gnap/scenes/scene28.cpp index 93723e65f6..ac55d90f01 100644 --- a/engines/gnap/scenes/scene28.cpp +++ b/engines/gnap/scenes/scene28.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene28.h" namespace Gnap { @@ -51,108 +52,112 @@ enum { kASLeaveScene = 10 }; -int GnapEngine::scene28_init() { +Scene28::Scene28(GnapEngine *vm) : Scene(vm) { + _s28_currClownSequenceId = -1; + _s28_nextClownSequenceId = -1; + _s28_clownTalkCtr = 0; +} + +int Scene28::init() { return 0x125; } -void GnapEngine::scene28_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSHorn, 148, 352, 215, 383, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); - setHotspot(kHSClown, 130, 250, 285, 413, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 5); - setHotspot(kHSExitOutsideClown, 660, 190, 799, 400, SF_EXIT_R_CURSOR, 9, 6); - setHotspot(kHSEmptyBucket, 582, 421, 643, 478, SF_WALKABLE | SF_DISABLED, 9, 7); - setHotspot(kHSWalkArea1, 0, 0, 799, 523); - setHotspot(kHSWalkArea2, 0, 0, 0, 0, 7, SF_DISABLED); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (invHas(kItemHorn)) - _hotspots[kHSHorn]._flags = SF_DISABLED; - if (isFlag(kGFUnk22)) - _hotspots[kHSEmptyBucket]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - _hotspotsCount = 8; +void Scene28::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSHorn, 148, 352, 215, 383, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); + _vm->setHotspot(kHSClown, 130, 250, 285, 413, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 5); + _vm->setHotspot(kHSExitOutsideClown, 660, 190, 799, 400, SF_EXIT_R_CURSOR, 9, 6); + _vm->setHotspot(kHSEmptyBucket, 582, 421, 643, 478, SF_WALKABLE | SF_DISABLED, 9, 7); + _vm->setHotspot(kHSWalkArea1, 0, 0, 799, 523); + _vm->setHotspot(kHSWalkArea2, 0, 0, 0, 0, 7, SF_DISABLED); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->invHas(kItemHorn)) + _vm->_hotspots[kHSHorn]._flags = SF_DISABLED; + if (_vm->isFlag(kGFUnk22)) + _vm->_hotspots[kHSEmptyBucket]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _vm->_hotspotsCount = 8; } -void GnapEngine::scene28_run() { - playSound(0x1093C, true); +void Scene28::run() { + _vm->playSound(0x1093C, true); _s28_nextClownSequenceId = -1; - queueInsertDeviceIcon(); - _gameSys->insertSequence(0x124, 255, 0, 0, kSeqNone, 0, 0, 0); + _vm->queueInsertDeviceIcon(); + _vm->_gameSys->insertSequence(0x124, 255, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(kGFUnk22)) - _gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, 0, 0, 0); + if (_vm->isFlag(kGFUnk22)) + _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(kGFMudTaken)) { - if (isFlag(kGFUnk21)) { - _gameSys->setAnimation(0x11C, 39, 3); - _gameSys->insertSequence(0x11C, 39, 0, 0, kSeqNone, 0, 0, 0); - if (!invHas(kItemHorn)) - _gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, 0, 0, 0); + if (_vm->isFlag(kGFMudTaken)) { + if (_vm->isFlag(kGFUnk21)) { + _vm->_gameSys->setAnimation(0x11C, 39, 3); + _vm->_gameSys->insertSequence(0x11C, 39, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->invHas(kItemHorn)) + _vm->_gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, 0, 0, 0); _s28_currClownSequenceId = 0x11C; } else { _s28_currClownSequenceId = 0x11B; - _gameSys->setAnimation(0x11B, 39, 3); - _gameSys->insertSequence(_s28_currClownSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); - _timers[4] = getRandom(20) + 80; + _vm->_gameSys->setAnimation(0x11B, 39, 3); + _vm->_gameSys->insertSequence(_s28_currClownSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->_timers[4] = _vm->getRandom(20) + 80; } - initGnapPos(8, 8, kDirBottomLeft); - initPlatypusPos(9, 8, kDirUnk4); - endSceneInit(); + _vm->initGnapPos(8, 8, kDirBottomLeft); + _vm->initPlatypusPos(9, 8, kDirUnk4); + _vm->endSceneInit(); } else { - _gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); - initGnapPos(8, 8, kDirBottomLeft); - initPlatypusPos(9, 8, kDirUnk4); - endSceneInit(); - playSequences(0xF7, 0x121, 0x122, 0x123); + _vm->_gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->initGnapPos(8, 8, kDirBottomLeft); + _vm->initPlatypusPos(9, 8, kDirUnk4); + _vm->endSceneInit(); + _vm->playSequences(0xF7, 0x121, 0x122, 0x123); _s28_currClownSequenceId = 0x115; - setFlag(kGFMudTaken); - _gameSys->setAnimation(0x115, 39, 3); - _gameSys->insertSequence(_s28_currClownSequenceId, 39, 0x11B, 39, kSeqSyncWait, 0, 0, 0); + _vm->setFlag(kGFMudTaken); + _vm->_gameSys->setAnimation(0x115, 39, 3); + _vm->_gameSys->insertSequence(_s28_currClownSequenceId, 39, 0x11B, 39, kSeqSyncWait, 0, 0, 0); _s28_nextClownSequenceId = -1; - _timers[4] = getRandom(20) + 80; - _gnapActionStatus = kASGnapWaiting; - while (_gameSys->getAnimationStatus(3) != 2) { - gameUpdateTick(); - updateMouseCursor(); + _vm->_timers[4] = _vm->getRandom(20) + 80; + _vm->_gnapActionStatus = kASGnapWaiting; + while (_vm->_gameSys->getAnimationStatus(3) != 2) { + _vm->gameUpdateTick(); + _vm->updateMouseCursor(); } - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; } - while (!_sceneDone) { - - updateMouseCursor(); - updateCursorByHotspot(); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); - - switch (_sceneClickedHotspot) { + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene28_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemJoint) { - gnapUseJointOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -160,32 +165,32 @@ void GnapEngine::scene28_run() { break; case kHSHorn: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(2, 8, 3, 4); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(2, 8, 3, 4); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(2, 4); + _vm->playGnapScratchingHead(2, 4); break; case GRAB_CURSOR: - if (isFlag(kGFUnk21)) { - if (!invHas(kItemHorn)) { - gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[kHSHorn].x, _hotspotsWalkPos[kHSHorn].y) | 0x10000, 1); - _gnapActionStatus = kASGrabHornSuccess; + if (_vm->isFlag(kGFUnk21)) { + if (!_vm->invHas(kItemHorn)) { + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHSHorn].x, _vm->_hotspotsWalkPos[kHSHorn].y) | 0x10000, 1); + _vm->_gnapActionStatus = kASGrabHornSuccess; } } else { - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(2, 8, 0, 0x107BB, 1); - _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - gnapWalkTo(_hotspotsWalkPos[kHSHorn].x, _hotspotsWalkPos[kHSHorn].y, 0, 0x107BB, 1); - _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - _gnapActionStatus = kASGrabHornFails; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(2, 8, 0, 0x107BB, 1); + _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSHorn].x, _vm->_hotspotsWalkPos[kHSHorn].y, 0, 0x107BB, 1); + _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kASGrabHornFails; } break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -193,39 +198,39 @@ void GnapEngine::scene28_run() { break; case kHSClown: - if (_gnapActionStatus < 0) { - if (isFlag(kGFUnk21)) { - if (_verbCursor == LOOK_CURSOR) - playGnapScratchingHead(5, 2); + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFUnk21)) { + if (_vm->_verbCursor == LOOK_CURSOR) + _vm->playGnapScratchingHead(5, 2); else - playGnapImpossible(0, 0); - } else if (_grabCursorSpriteIndex == kItemBucketWithBeer) { - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(_hotspotsWalkPos[kHSClown].x, _hotspotsWalkPos[kHSClown].y, 0, 0x107BC, 1); - playGnapPullOutDevice(0, 0); - playGnapUseDevice(0, 0); - _gnapActionStatus = kASUseBeerBucketWithClown; - } else if (_grabCursorSpriteIndex == kItemBucketWithPill) { - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(_hotspotsWalkPos[kHSClown].x, _hotspotsWalkPos[kHSClown].y, 0, 0x107BC, 1); - playGnapPullOutDevice(0, 0); - playGnapUseDevice(0, 0); - _gnapActionStatus = kASUsePillBucketWithClown; - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSClown].x, _hotspotsWalkPos[kHSClown].y, 2, 4); + _vm->playGnapImpossible(0, 0); + } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithBeer) { + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSClown].x, _vm->_hotspotsWalkPos[kHSClown].y, 0, 0x107BC, 1); + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_gnapActionStatus = kASUseBeerBucketWithClown; + } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithPill) { + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSClown].x, _vm->_hotspotsWalkPos[kHSClown].y, 0, 0x107BC, 1); + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_gnapActionStatus = kASUsePillBucketWithClown; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSClown].x, _vm->_hotspotsWalkPos[kHSClown].y, 2, 4); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(5, 2); + _vm->playGnapScratchingHead(5, 2); break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(5, 8, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASTalkClown; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(5, 8, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASTalkClown; break; case GRAB_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -233,35 +238,35 @@ void GnapEngine::scene28_run() { break; case kHSExitOutsideClown: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 27; - _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideClown].x, _hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107BF, 1); - _gnapActionStatus = kASLeaveScene; - _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideClown].x - 1, _hotspotsWalkPos[kHSExitOutsideClown].y, -1, 0x107C2, 1); + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 27; + _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideClown].x, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107BF, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideClown].x - 1, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y, -1, 0x107C2, 1); } break; case kHSEmptyBucket: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowItem(_grabCursorSpriteIndex, 8, 6); - } else if (isFlag(kGFUnk21)) { - playGnapImpossible(8, 6); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 8, 6); + } else if (_vm->isFlag(kGFUnk21)) { + _vm->playGnapImpossible(8, 6); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(8, 6); + _vm->playGnapScratchingHead(8, 6); break; case GRAB_CURSOR: - gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[kHSEmptyBucket].x, _hotspotsWalkPos[kHSEmptyBucket].y) | 0x10000, 1); - _gnapActionStatus = kASGrabEmptyBucket; + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHSEmptyBucket].x, _vm->_hotspotsWalkPos[kHSEmptyBucket].y) | 0x10000, 1); + _vm->_gnapActionStatus = kASGrabEmptyBucket; break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -270,114 +275,110 @@ void GnapEngine::scene28_run() { 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; - } - scene28_updateAnimations(); + updateAnimations(); - if (!isSoundPlaying(0x1093C)) - playSound(0x1093C, true); + if (!_vm->isSoundPlaying(0x1093C)) + _vm->playSound(0x1093C, true); - if (!_isLeavingScene) { - updatePlatypusIdleSequence(); - updateGnapIdleSequence(); - if (!_timers[4]) { - _timers[4] = getRandom(20) + 80; - if (_gnapActionStatus < 0 && !isFlag(kGFUnk21)) + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(20) + 80; + if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFUnk21)) _s28_nextClownSequenceId = 0x114; } } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene28_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene28_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene28::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASUseBeerBucketWithClown: - setFlag(kGFUnk22); + _vm->setFlag(kGFUnk22); _s28_nextClownSequenceId = 0x113; - invRemove(kItemBucketWithBeer); - scene28_updateHotspots(); + _vm->invRemove(kItemBucketWithBeer); + updateHotspots(); break; case kASUsePillBucketWithClown: _s28_nextClownSequenceId = 0x116; - invRemove(kItemBucketWithPill); - setFlag(kGFUnk22); - setFlag(kGFUnk21); - scene28_updateHotspots(); + _vm->invRemove(kItemBucketWithPill); + _vm->setFlag(kGFUnk22); + _vm->setFlag(kGFUnk21); + updateHotspots(); break; case kASGrabHornFails: _s28_nextClownSequenceId = 0x119; break; case kASGrabHornSuccess: - playGnapPullOutDevice(0, 0); - playGnapUseDevice(0, 0); - _gameSys->setAnimation(0x117, 59, 0); - _gameSys->insertSequence(0x117, 59, 280, 59, kSeqSyncWait, 0, 0, 0); - _gnapActionStatus = kASGrabHornSuccessDone; + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->setAnimation(0x117, 59, 0); + _vm->_gameSys->insertSequence(0x117, 59, 280, 59, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = kASGrabHornSuccessDone; break; case kASGrabHornSuccessDone: - hideCursor(); - setGrabCursorSprite(-1); - addFullScreenSprite(0xF6, 255); - _gameSys->setAnimation(0x120, 256, 0); - _gameSys->insertSequence(0x120, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_gameSys->getAnimationStatus(0) != 2) - gameUpdateTick(); - removeFullScreenSprite(); - showCursor(); - setGrabCursorSprite(kItemHorn); - invAdd(kItemHorn); - scene28_updateHotspots(); - _gnapActionStatus = -1; + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + _vm->addFullScreenSprite(0xF6, 255); + _vm->_gameSys->setAnimation(0x120, 256, 0); + _vm->_gameSys->insertSequence(0x120, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(0) != 2) + _vm->gameUpdateTick(); + _vm->removeFullScreenSprite(); + _vm->showCursor(); + _vm->setGrabCursorSprite(kItemHorn); + _vm->invAdd(kItemHorn); + updateHotspots(); + _vm->_gnapActionStatus = -1; break; case kASGrabEmptyBucket: - playGnapPullOutDevice(0, 0); - playGnapUseDevice(0, 0); - _gameSys->setAnimation(0x111, 99, 0); - _gameSys->insertSequence(0x111, 99, 274, 99, kSeqSyncWait, 0, 0, 0); - _gnapActionStatus = kASGrabEmptyBucketDone; + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->setAnimation(0x111, 99, 0); + _vm->_gameSys->insertSequence(0x111, 99, 274, 99, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = kASGrabEmptyBucketDone; break; case kASGrabEmptyBucketDone: - setGrabCursorSprite(kItemEmptyBucket); - clearFlag(kGFUnk22);; - scene28_updateHotspots(); - invAdd(kItemEmptyBucket); - _gnapActionStatus = -1; + _vm->setGrabCursorSprite(kItemEmptyBucket); + _vm->clearFlag(kGFUnk22);; + updateHotspots(); + _vm->invAdd(kItemEmptyBucket); + _vm->_gnapActionStatus = -1; break; case kASGrabHornFailsDone: - _gameSys->insertSequence(0x107B5, _gnapId, 281, 39, kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); - _gnapSequenceId = 0x7B5; - _gnapSequenceDatNum = 1; - _gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 281, 39, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceId = 0x7B5; + _vm->_gnapSequenceDatNum = 1; + _vm->_gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); _s28_currClownSequenceId = 0x11B; _s28_nextClownSequenceId = -1; - _gnapActionStatus = -1; - gnapWalkTo(2, 8, -1, 0x107BB, 1); + _vm->_gnapActionStatus = -1; + _vm->gnapWalkTo(2, 8, -1, 0x107BB, 1); break; case kASTalkClown: _s28_clownTalkCtr = (_s28_clownTalkCtr + 1) % 2; @@ -389,60 +390,59 @@ void GnapEngine::scene28_updateAnimations() { _s28_nextClownSequenceId = 0x11F; // NOTE CHECKME Never set, bug in the original? break; case kASGnapWaiting: - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; } } - if (_gameSys->getAnimationStatus(3) == 2) { + if (_vm->_gameSys->getAnimationStatus(3) == 2) { switch (_s28_nextClownSequenceId) { case 0x113: - setGrabCursorSprite(-1); - _gameSys->setAnimation(_s28_nextClownSequenceId, 39, 0); - _gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, getSequenceTotalDuration(_s28_nextClownSequenceId), 0, 0); - _gameSys->insertSequence(_s28_nextClownSequenceId, 39, _s28_currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x11B, 39, _s28_nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->setGrabCursorSprite(-1); + _vm->_gameSys->setAnimation(_s28_nextClownSequenceId, 39, 0); + _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_s28_nextClownSequenceId), 0, 0); + _vm->_gameSys->insertSequence(_s28_nextClownSequenceId, 39, _s28_currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x11B, 39, _s28_nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); _s28_currClownSequenceId = 0x11B; _s28_nextClownSequenceId = -1; - _gnapActionStatus = kASGnapWaiting; + _vm->_gnapActionStatus = kASGnapWaiting; break; case 0x116: - setGrabCursorSprite(-1); - _gameSys->setAnimation(_s28_nextClownSequenceId, 39, 0); - _gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, getSequenceTotalDuration(_s28_nextClownSequenceId), 0, 0); - _gameSys->insertSequence(_s28_nextClownSequenceId, 39, _s28_currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x11C, 39, _s28_nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, getSequenceTotalDuration(_s28_nextClownSequenceId), 0, 0); + _vm->setGrabCursorSprite(-1); + _vm->_gameSys->setAnimation(_s28_nextClownSequenceId, 39, 0); + _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_s28_nextClownSequenceId), 0, 0); + _vm->_gameSys->insertSequence(_s28_nextClownSequenceId, 39, _s28_currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x11C, 39, _s28_nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_s28_nextClownSequenceId), 0, 0); _s28_currClownSequenceId = _s28_nextClownSequenceId; _s28_nextClownSequenceId = -1; - _gnapActionStatus = kASGnapWaiting; + _vm->_gnapActionStatus = kASGnapWaiting; break; case 0x11D: case 0x11E: case 0x11F: - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case 0x119: - _gameSys->insertSequence(_s28_nextClownSequenceId, 39, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s28_nextClownSequenceId, 39, 0); - _gameSys->removeSequence(_s28_currClownSequenceId, 39, true); - _gnapActionStatus = kASGrabHornFailsDone; - _gnapSequenceId = _s28_nextClownSequenceId; - _gnapSequenceDatNum = 0; + _vm->_gameSys->insertSequence(_s28_nextClownSequenceId, 39, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s28_nextClownSequenceId, 39, 0); + _vm->_gameSys->removeSequence(_s28_currClownSequenceId, 39, true); + _vm->_gnapActionStatus = kASGrabHornFailsDone; + _vm->_gnapSequenceId = _s28_nextClownSequenceId; + _vm->_gnapSequenceDatNum = 0; _s28_nextClownSequenceId = -1; break; } if (_s28_nextClownSequenceId != -1) { - _gameSys->insertSequence(_s28_nextClownSequenceId, 39, _s28_currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s28_nextClownSequenceId, 39, 3); + _vm->_gameSys->insertSequence(_s28_nextClownSequenceId, 39, _s28_currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s28_nextClownSequenceId, 39, 3); _s28_currClownSequenceId = _s28_nextClownSequenceId; _s28_nextClownSequenceId = -1; } } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene28.h b/engines/gnap/scenes/scene28.h new file mode 100644 index 0000000000..40fa93b15a --- /dev/null +++ b/engines/gnap/scenes/scene28.h @@ -0,0 +1,51 @@ +/* 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_SCENE28_H +#define GNAP_SCENE28_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene28: public Scene { +public: + Scene28(GnapEngine *vm); + ~Scene28() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s28_currClownSequenceId; + int _s28_nextClownSequenceId; + int _s28_clownTalkCtr; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE28_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 0198eb573b..25a2f7df50 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -53,6 +53,7 @@ #include "gnap/scenes/scene25.h" #include "gnap/scenes/scene26.h" #include "gnap/scenes/scene27.h" +#include "gnap/scenes/scene28.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -256,8 +257,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 28: - backgroundId = scene28_init(); - scene28_updateHotspots(); + _scene = new Scene28(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -578,7 +580,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 20; break; case 28: - scene28_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 20; break; |