diff options
author | Strangerke | 2016-04-30 13:37:57 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-05-10 12:14:48 +0200 |
commit | ce8e3281d4578d3f0833e8ce449fe6a9e6b4791e (patch) | |
tree | fa3f5a04982dc40d21d3668489c510b434647af6 /engines/gnap | |
parent | 33b27b8db3b86fac77ef12a6cbda92050c5d3bd3 (diff) | |
download | scummvm-rg350-ce8e3281d4578d3f0833e8ce449fe6a9e6b4791e.tar.gz scummvm-rg350-ce8e3281d4578d3f0833e8ce449fe6a9e6b4791e.tar.bz2 scummvm-rg350-ce8e3281d4578d3f0833e8ce449fe6a9e6b4791e.zip |
GNAP: Reduce dereferencing of _gameSys
Diffstat (limited to 'engines/gnap')
-rw-r--r-- | engines/gnap/scenes/group0.cpp | 607 | ||||
-rw-r--r-- | engines/gnap/scenes/group1.cpp | 832 | ||||
-rw-r--r-- | engines/gnap/scenes/group2.cpp | 568 | ||||
-rw-r--r-- | engines/gnap/scenes/group3.cpp | 224 | ||||
-rw-r--r-- | engines/gnap/scenes/group5.cpp | 72 | ||||
-rw-r--r-- | engines/gnap/scenes/intro.cpp | 27 | ||||
-rw-r--r-- | engines/gnap/scenes/scenecore.cpp | 22 |
7 files changed, 1258 insertions, 1094 deletions
diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index 2255edaed3..68c962b999 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -38,8 +38,10 @@ Scene01::~Scene01() { } int Scene01::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 3); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 3); return 0x88; } @@ -68,20 +70,21 @@ void Scene01::updateHotspots() { void Scene01::run() { // NOTE Removed _s01_dword_474380 which was set when the mud was taken // which is also set in the global game flags. + GameSys& gameSys = *_vm->_gameSys; _vm->playSound(0x1091C, true); _vm->startSoundTimerC(5); - _vm->_gameSys->setAnimation(134, 20, 4); - _vm->_gameSys->insertSequence(134, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(134, 20, 4); + gameSys.insertSequence(134, 20, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(0x7F, 40, 2); - _vm->_gameSys->insertSequence(0x7F, 40, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x7F, 40, 2); + gameSys.insertSequence(0x7F, 40, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[4] = _vm->getRandom(100) + 300; if (!_vm->isFlag(kGFMudTaken)) - _vm->_gameSys->insertSequence(129, 40, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(129, 40, 0, 0, kSeqNone, 0, 0, 0); _vm->queueInsertDeviceIcon(); @@ -264,9 +267,9 @@ void Scene01::run() { // Update bird animation _vm->_timers[4] = _vm->getRandom(100) + 300; if (_vm->getRandom(1) == 0) - _vm->_gameSys->insertSequence(0x84, 180, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x84, 180, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(0x83, 180, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x83, 180, 0, 0, kSeqNone, 0, 0, 0); } _vm->playSoundC(); } @@ -283,20 +286,22 @@ void Scene01::run() { } void Scene01::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS01LookSpaceship: - _spaceshipSurface = _vm->_gameSys->createSurface(47); - _vm->_gameSys->insertSpriteDrawItem(_spaceshipSurface, 0, 0, 255); - _vm->_gameSys->setAnimation(133, 256, 0); - _vm->_gameSys->insertSequence(133, 256, 0, 0, kSeqNone, 0, 0, 0); + _spaceshipSurface = gameSys.createSurface(47); + gameSys.insertSpriteDrawItem(_spaceshipSurface, 0, 0, 255); + gameSys.setAnimation(133, 256, 0); + gameSys.insertSequence(133, 256, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapActionStatus = kAS01LookSpaceshipDone; break; case kAS01LookSpaceshipDone: - _vm->_gameSys->removeSequence(133, 256, true); - _vm->_gameSys->removeSpriteDrawItem(_spaceshipSurface, 255); + gameSys.removeSequence(133, 256, true); + gameSys.removeSpriteDrawItem(_spaceshipSurface, 255); _vm->deleteSurface(&_spaceshipSurface); _vm->_gnapActionStatus = -1; break; @@ -308,8 +313,8 @@ void Scene01::updateAnimations() { case kAS01TakeMud: _vm->playGnapPullOutDevice(2, 3); _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->insertSequence(128, 40, 129, 40, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(128, 40, 3); + gameSys.insertSequence(128, 40, 129, 40, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(128, 40, 3); _vm->_gnapActionStatus = -1; break; @@ -323,32 +328,32 @@ void Scene01::updateAnimations() { case kAS01UsePigs: _vm->playGnapPullOutDevice(7, 2); _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->insertSequence(135, 39, 0, 0, kSeqNone, 25, _vm->getRandom(140) - 40, 0); + gameSys.insertSequence(135, 39, 0, 0, kSeqNone, 25, _vm->getRandom(140) - 40, 0); _vm->_gnapActionStatus = -1; break; } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - _vm->_gameSys->setAnimation(0, 0, 3); + if (gameSys.getAnimationStatus(3) == 2) { + gameSys.setAnimation(0, 0, 3); _vm->invAdd(kItemMud); _vm->setGrabCursorSprite(kItemMud); _vm->setFlag(kGFMudTaken); updateHotspots(); } - if (_vm->_gameSys->getAnimationStatus(4) == 2) { + if (gameSys.getAnimationStatus(4) == 2) { _smokeIdCtr = (_smokeIdCtr + 1) % 2; - _vm->_gameSys->setAnimation(0x86, _smokeIdCtr + 20, 4); - _vm->_gameSys->insertSequence(0x86, _smokeIdCtr + 20, + gameSys.setAnimation(0x86, _smokeIdCtr + 20, 4); + gameSys.insertSequence(0x86, _smokeIdCtr + 20, 0x86, (_smokeIdCtr + 1) % 2 + 20, kSeqSyncWait, 0, 0, 0); } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { + if (gameSys.getAnimationStatus(2) == 2) { _pigsIdCtr = (_pigsIdCtr + 1) % 2; - _vm->_gameSys->setAnimation(0x7F, _pigsIdCtr + 40, 2); - _vm->_gameSys->insertSequence(0x7F, _pigsIdCtr + 40, + gameSys.setAnimation(0x7F, _pigsIdCtr + 40, 2); + gameSys.insertSequence(0x7F, _pigsIdCtr + 40, 0x7F, (_pigsIdCtr + 1) % 2 + 40, kSeqSyncWait, 0, 0, 0); } @@ -389,12 +394,14 @@ void Scene02::updateHotspots() { } void Scene02::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x1091C, true); _vm->startSoundTimerC(6); _currChickenSequenceId = 0x14B; - _vm->_gameSys->setAnimation(0x14B, 179, 2); - _vm->_gameSys->insertSequence(0x14B, 179, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x14B, 179, 2); + gameSys.insertSequence(0x14B, 179, 0, 0, kSeqNone, 0, 0, 0); _nextChickenSequenceId = -1; _vm->_timers[5] = _vm->getRandom(20) + 30; @@ -421,7 +428,7 @@ void Scene02::run() { if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(8, 6, 1, 0x107C2, 1); updateHotspots(); - _vm->_gameSys->waitForUpdate(); + gameSys.waitForUpdate(); break; case 47: _vm->clearFlag(kGFUnk25); @@ -672,9 +679,9 @@ void Scene02::run() { // Update bird animation _vm->_timers[4] = _vm->getRandom(100) + 300; if (_vm->getRandom(2) != 0) - _vm->_gameSys->insertSequence(0x156, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x156, 256, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(0x154, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x154, 256, 0, 0, kSeqNone, 0, 0, 0); } if (!_vm->_timers[5] && _nextChickenSequenceId == -1 && _vm->_gnapActionStatus != 7 && _vm->_gnapActionStatus != 8) { if (_vm->getRandom(6) != 0) { @@ -701,18 +708,20 @@ void Scene02::run() { } void Scene02::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { switch (_vm->_gnapActionStatus) { case kAS02UseTruckNoKeys: - _vm->_gameSys->insertSequence(0x14E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x14E, _vm->_gnapId, 0); + gameSys.insertSequence(0x14E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x14E, _vm->_gnapId, 0); _vm->_gnapSequenceId = 0x14E; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = kAS02UseTruckNoKeysDone; break; case kAS02UseGasWithTruck: - _vm->_gameSys->insertSequence(0x151, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x151, _vm->_gnapId, 0); + gameSys.insertSequence(0x151, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x151, _vm->_gnapId, 0); _vm->_gnapSequenceId = 0x151; _vm->_gnapSequenceDatNum = 0; _vm->invRemove(kItemGas); @@ -726,8 +735,8 @@ void Scene02::updateAnimations() { _vm->hideCursor(); _vm->setGrabCursorSprite(-1); if (!_vm->isFlag(kGFTruckKeysUsed)) { - _vm->_gameSys->insertSequence(0x14F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->waitForUpdate(); + gameSys.insertSequence(0x14F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.waitForUpdate(); _vm->setFlag(kGFTruckKeysUsed); _vm->_gnapSequenceId = 0x14F; _vm->_gnapSequenceDatNum = 0; @@ -742,8 +751,8 @@ void Scene02::updateAnimations() { _vm->setGrabCursorSprite(-1); _vm->_timers[4] = 250; if (!_vm->isFlag(kGFTruckKeysUsed)) { - _vm->_gameSys->insertSequence(0x14F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->waitForUpdate(); + gameSys.insertSequence(0x14F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.waitForUpdate(); _vm->setFlag(kGFTruckKeysUsed); _vm->_gnapSequenceId = 0x14F; _vm->_gnapSequenceDatNum = 0; @@ -767,8 +776,8 @@ void Scene02::updateAnimations() { break; } _truckGrillCtr = (_truckGrillCtr + 1) % 3; - _vm->_gameSys->insertSequence(_gnapTruckSequenceId, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_gnapTruckSequenceId, _vm->_gnapId, 0); + gameSys.insertSequence(_gnapTruckSequenceId, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_gnapTruckSequenceId, _vm->_gnapId, 0); _vm->_gnapSequenceId = _gnapTruckSequenceId; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = -1; @@ -784,18 +793,18 @@ void Scene02::updateAnimations() { _vm->_timers[2] = 100; break; case kAS02GrabChickenDone: - _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 0x150, 179, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + gameSys.insertSequence(0x107B5, _vm->_gnapId, 0x150, 179, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7B5; _vm->_gnapSequenceDatNum = 1; _currChickenSequenceId = 0x14B; - _vm->_gameSys->setAnimation(0x14B, 179, 2); - _vm->_gameSys->insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x14B, 179, 2); + gameSys.insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapActionStatus = -1; _vm->_timers[5] = 30; break; case kAS02UseTwigWithChicken: _vm->playGnapShowItem(5, 0, 0); - _vm->_gameSys->insertSequence(0x155, 179, _currChickenSequenceId, 179, kSeqSyncExists, 0, 0, 0); + gameSys.insertSequence(0x155, 179, _currChickenSequenceId, 179, kSeqSyncExists, 0, 0, 0); _currChickenSequenceId = 0x155; _nextChickenSequenceId = -1; _vm->_gnapActionStatus = -1; @@ -808,24 +817,24 @@ void Scene02::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { + if (gameSys.getAnimationStatus(2) == 2) { if (_nextChickenSequenceId == 0x150) { - _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 0); - _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(_currChickenSequenceId, 179, true); + gameSys.setAnimation(_nextChickenSequenceId, 179, 0); + gameSys.insertSequence(_nextChickenSequenceId, 179, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.removeSequence(_currChickenSequenceId, 179, true); _nextChickenSequenceId = -1; _currChickenSequenceId = -1; _vm->_gnapActionStatus = kAS02GrabChickenDone; _vm->_timers[5] = 500; } else if (_nextChickenSequenceId == 0x14C) { - _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 2); - _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextChickenSequenceId, 179, 2); + gameSys.insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); _currChickenSequenceId = _nextChickenSequenceId; _nextChickenSequenceId = -1; _vm->_gnapActionStatus = -1; } else if (_nextChickenSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 2); - _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextChickenSequenceId, 179, 2); + gameSys.insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); _currChickenSequenceId = _nextChickenSequenceId; _nextChickenSequenceId = -1; } @@ -843,9 +852,11 @@ Scene03::Scene03(GnapEngine *vm) : Scene(vm) { } int Scene03::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 5); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 5); return 0x1CC; } @@ -872,21 +883,22 @@ void Scene03::updateHotspots() { } void Scene03::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x10925, true); _vm->startSoundTimerC(7); - _vm->_gameSys->insertSequence(0x1CA, 251, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x1CB, 251, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x1CA, 251, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x1CB, 251, 0, 0, kSeqLoop, 0, 0, 0); _platypusHypnotized = false; - _vm->initGnapPos(3, 4, kDirBottomRight); - _vm->_gameSys->insertSequence(0x1C6, 253, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x1C6, 253, 0, 0, kSeqNone, 0, 0, 0); _currFrogSequenceId = 0x1C6; _nextFrogSequenceId = -1; - _vm->_gameSys->setAnimation(0x1C6, 253, 2); + gameSys.setAnimation(0x1C6, 253, 2); _vm->_timers[6] = _vm->getRandom(20) + 30; _vm->_timers[4] = _vm->getRandom(100) + 300; @@ -896,16 +908,16 @@ void Scene03::run() { _vm->initPlatypusPos(5, 4, kDirNone); } else { _vm->_timers[1] = _vm->getRandom(40) + 20; - _vm->_gameSys->setAnimation(0x1C2, 99, 1); - _vm->_gameSys->insertSequence(0x1C2, 99, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x1C2, 99, 1); + gameSys.insertSequence(0x1C2, 99, 0, 0, kSeqNone, 0, 0, 0); _vm->_platypusSequenceId = 0x1C2; _vm->_platypusSequenceDatNum = 0; } - _vm->_gameSys->insertSequence(0x1C4, 255, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x1C4, 255, 0, 0, kSeqNone, 0, 0, 0); if (!_vm->isFlag(kGFGrassTaken)) - _vm->_gameSys->insertSequence(0x1B2, 253, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x1B2, 253, 0, 0, kSeqNone, 0, 0, 0); _vm->queueInsertDeviceIcon(); @@ -966,8 +978,8 @@ void Scene03::run() { case GRAB_CURSOR: _vm->playGnapPullOutDevice(9, 6); _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->insertSequence(0x1B3, 253, 0x1B2, 253, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x1B3, 253, 5); + gameSys.insertSequence(0x1B3, 253, 0x1B2, 253, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x1B3, 253, 5); _vm->_hotspots[kHS03Grass]._flags |= SF_WALKABLE | SF_DISABLED; break; case TALK_CURSOR: @@ -1129,13 +1141,13 @@ void Scene03::run() { // Update bird animation _vm->_timers[4] = _vm->getRandom(100) + 300; if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) - _vm->_gameSys->insertSequence(_vm->getRandom(2) != 0 ? 0x1C8 : 0x1C3, 253, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(_vm->getRandom(2) != 0 ? 0x1C8 : 0x1C3, 253, 0, 0, kSeqNone, 0, 0, 0); } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(100) + 200; if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { - _vm->_gameSys->setAnimation(0x1C5, 253, 4); - _vm->_gameSys->insertSequence(0x1C5, 253, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x1C5, 253, 4); + gameSys.insertSequence(0x1C5, 253, 0, 0, kSeqNone, 0, 0, 0); } } _vm->playSoundC(); @@ -1157,8 +1169,10 @@ void Scene03::run() { } void Scene03::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS03LeaveScene: _vm->_sceneDone = true; @@ -1172,9 +1186,9 @@ void Scene03::updateAnimations() { _vm->_platY = 6; _vm->_platypusFacing = kDirUnk4; _vm->_platypusId = 120; - _vm->_gameSys->insertSequence(0x107CA, _vm->_platypusId, 0x1BC, 99, + gameSys.insertSequence(0x107CA, _vm->_platypusId, 0x1BC, 99, kSeqSyncWait, 0, 75 * _vm->_platX - _vm->_platGridX, 48 * _vm->_platY - _vm->_platGridY); - _vm->_gameSys->insertSequence(0x1B7, 99, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x1B7, 99, 0, 0, kSeqNone, 0, 0, 0); _vm->_platypusSequenceDatNum = 1; _vm->_platypusSequenceId = 0x7CA; _vm->setFlag(kGFPlatypus); @@ -1184,13 +1198,13 @@ void Scene03::updateAnimations() { case kAS03HypnotizePlat: _vm->playGnapBrainPulsating(0, 0); _vm->addFullScreenSprite(0x106, 255); - _vm->_gameSys->setAnimation(0x1C9, 256, 1); - _vm->_gameSys->insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(1) != 2) + gameSys.setAnimation(0x1C9, 256, 1); + gameSys.insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(1) != 2) _vm->gameUpdateTick(); _vm->removeFullScreenSprite(); - _vm->_gameSys->setAnimation(0x1BA, 99, 1); - _vm->_gameSys->insertSequence(0x1BA, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); + gameSys.setAnimation(0x1BA, 99, 1); + gameSys.insertSequence(0x1BA, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); _vm->_platypusSequenceDatNum = 0; _vm->_platypusSequenceId = 0x1BA; _vm->_gnapActionStatus = -1; @@ -1199,18 +1213,18 @@ void Scene03::updateAnimations() { break; case kAS03HypnotizeScaredPlat: _vm->playGnapBrainPulsating(0, 0); - _vm->_gameSys->insertSequence(0x1BF, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->setAnimation(0x1BF, 99, 1); - while (_vm->_gameSys->getAnimationStatus(1) != 2) + gameSys.insertSequence(0x1BF, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); + gameSys.setAnimation(0x1BF, 99, 1); + while (gameSys.getAnimationStatus(1) != 2) _vm->gameUpdateTick(); _vm->addFullScreenSprite(0x106, 255); - _vm->_gameSys->setAnimation(0x1C9, 256, 1); - _vm->_gameSys->insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(1) != 2) + gameSys.setAnimation(0x1C9, 256, 1); + gameSys.insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(1) != 2) _vm->gameUpdateTick(); _vm->removeFullScreenSprite(); - _vm->_gameSys->setAnimation(0x1BA, 99, 1); - _vm->_gameSys->insertSequence(0x1BA, 99, 447, 99, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x1BA, 99, 1); + gameSys.insertSequence(0x1BA, 99, 447, 99, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceDatNum = 0; _vm->_platypusSequenceId = 0x1BA; _vm->_gnapActionStatus = -1; @@ -1226,8 +1240,8 @@ void Scene03::updateAnimations() { _platypusHypnotized = false; break; case kAS03GrabCreek: - _vm->_gameSys->insertSequence(0x1B4, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x1B4, _vm->_gnapId, 0); + gameSys.insertSequence(0x1B4, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x1B4, _vm->_gnapId, 0); _vm->_gnapSequenceId = 0x1B4; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = kAS03GrabCreekDone; @@ -1238,26 +1252,26 @@ void Scene03::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { + if (gameSys.getAnimationStatus(1) == 2) { if (_nextPlatSequenceId == 0x1BD || _nextPlatSequenceId == 0x1C0) { - _vm->_gameSys->setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 1); _platypusScared = true; - _vm->_gameSys->insertSequence(0x1B5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(_nextPlatSequenceId, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x1B5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextPlatSequenceId, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x1B5; _vm->_gnapSequenceDatNum = 0; _vm->_gnapIdleFacing = kDirNone; _vm->_platypusSequenceId = _nextPlatSequenceId; _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->setAnimation(_nextPlatSequenceId, 99, 1); + gameSys.setAnimation(_nextPlatSequenceId, 99, 1); _nextPlatSequenceId = -1; _vm->_gnapActionStatus = -1; } else if (_nextPlatSequenceId == 0x1BC) { _vm->_gnapX = 3; _vm->_gnapY = 6; - _vm->_gameSys->insertSequence(0x1B6, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x1BC, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x1BC, 99, 0); + gameSys.insertSequence(0x1B6, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x1BC, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x1BC, 99, 0); _vm->_gnapId = 20 * _vm->_gnapY; _vm->_gnapSequenceId = 0x1B6; _vm->_gnapSequenceDatNum = 0; @@ -1265,31 +1279,31 @@ void Scene03::updateAnimations() { _vm->_gnapActionStatus = kAS03FreePlatypusDone; _nextPlatSequenceId = -1; } else if (_nextPlatSequenceId == 0x1C2 && !_platypusScared) { - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->insertSequence(0x1C2, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.insertSequence(0x1C2, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceId = 0x1C2; _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x1C2, 99, 1); + gameSys.setAnimation(0x1C2, 99, 1); _nextPlatSequenceId = -1; } else if (_nextPlatSequenceId == -1 && _platypusScared && !_platypusHypnotized) { - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0x1BE, 99, 1); - _vm->_gameSys->insertSequence(0x1BE, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0x1BE, 99, 1); + gameSys.insertSequence(0x1BE, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceId = 0x1BE; _vm->_platypusSequenceDatNum = 0; _nextPlatSequenceId = -1; } } - if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextFrogSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextFrogSequenceId, 253, 2); - _vm->_gameSys->insertSequence(_nextFrogSequenceId, 253, _currFrogSequenceId, 253, kSeqSyncWait, 0, 0, 0); + if (gameSys.getAnimationStatus(2) == 2 && _nextFrogSequenceId != -1) { + gameSys.setAnimation(_nextFrogSequenceId, 253, 2); + gameSys.insertSequence(_nextFrogSequenceId, 253, _currFrogSequenceId, 253, kSeqSyncWait, 0, 0, 0); _currFrogSequenceId = _nextFrogSequenceId; _nextFrogSequenceId = -1; } - if (_vm->_gameSys->getAnimationStatus(5) == 2) { - _vm->_gameSys->setAnimation(0, 0, 5); + if (gameSys.getAnimationStatus(5) == 2) { + gameSys.setAnimation(0, 0, 5); _vm->invAdd(kItemGrass); _vm->setGrabCursorSprite(kItemGrass); _vm->setFlag(kGFGrassTaken); @@ -1307,9 +1321,11 @@ Scene04::Scene04(GnapEngine *vm) : Scene(vm) { } int Scene04::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 2); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); return 0x214; } @@ -1335,15 +1351,17 @@ void Scene04::updateHotspots() { } void Scene04::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x1091C, true); _vm->startSoundTimerC(4); - _vm->_gameSys->insertSequence(0x210, 139 - _dogIdCtr, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x210, 139 - _dogIdCtr, 0, 0, kSeqNone, 0, 0, 0); _currDogSequenceId = 0x210; _nextDogSequenceId = -1; - _vm->_gameSys->setAnimation(0x210, 139 - _dogIdCtr, 3); + gameSys.setAnimation(0x210, 139 - _dogIdCtr, 3); _dogIdCtr = (_dogIdCtr + 1) % 2; _vm->_timers[6] = _vm->getRandom(20) + 60; _vm->_timers[5] = _vm->getRandom(150) + 300; @@ -1351,10 +1369,10 @@ void Scene04::run() { _vm->_timers[8] = _vm->getRandom(150) + 400; if (!_vm->isFlag(kGFPlatypusTalkingToAssistant) && _vm->_cursorValue == 4) - _vm->_gameSys->insertSequence(0x212, 100, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x212, 100, 0, 0, kSeqNone, 0, 0, 0); if (!_vm->isFlag(kGFTwigTaken)) - _vm->_gameSys->insertSequence(0x1FE, 100, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x1FE, 100, 0, 0, kSeqNone, 0, 0, 0); _vm->queueInsertDeviceIcon(); @@ -1368,10 +1386,10 @@ void Scene04::run() { _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); + gameSys.insertSequence(0x107B5, 140, 0, 0, kSeqNone, 0, 300 - _vm->_gnapGridX, 336 - _vm->_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); _vm->endSceneInit(); _vm->invRemove(kItemDisguise); _vm->invAdd(kItemKeys); @@ -1382,9 +1400,9 @@ void Scene04::run() { _vm->_platypusFacing = kDirBottomRight; _vm->_gnapSequenceId = 0x7B5; _vm->_gnapSequenceDatNum = 1; - _vm->_gameSys->waitForUpdate(); + gameSys.waitForUpdate(); } else { - _vm->_gameSys->insertSequence(0x209, 121, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x209, 121, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 2) { _vm->initGnapPos(5, 11, kDirUpRight); if (_vm->isFlag(kGFPlatypus)) @@ -1469,8 +1487,8 @@ void Scene04::run() { case GRAB_CURSOR: _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); + gameSys.insertSequence(0x1FD, 100, 510, 100, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x1FD, 100, 2); break; case TALK_CURSOR: case PLAT_CURSOR: @@ -1655,11 +1673,11 @@ void Scene04::run() { 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); + gameSys.insertSequence(0x20D, 79, 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); + gameSys.insertSequence(0x1FC, 59, 0, 0, kSeqNone, 0, 0, 0); } if (!_vm->_timers[6]) { _vm->_timers[6] = _vm->getRandom(20) + 60; @@ -1668,7 +1686,7 @@ void Scene04::run() { } if (!_vm->_timers[8]) { _vm->_timers[8] = _vm->getRandom(150) + 400; - _vm->_gameSys->insertSequence(0x213, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x213, 20, 0, 0, kSeqNone, 0, 0, 0); } _vm->playSoundC(); } @@ -1686,49 +1704,51 @@ void Scene04::run() { } void Scene04::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS04LeaveScene: _vm->_sceneDone = true; break; case kAS04OpenDoor: - _vm->_gameSys->insertSequence(0x205, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x207, 121, 521, 121, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x205, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x207, 121, 521, 121, kSeqSyncWait, 0, 0, 0); _vm->_gnapX = 6; _vm->_gnapY = 7; - _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, + 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); + gameSys.setAnimation(0x107B5, _vm->_gnapId, 0); _vm->_gnapSequenceId = 0x7B5; _vm->_gnapSequenceDatNum = 1; _vm->_gnapActionStatus = kAS04OpenDoorDone; break; case kAS04OpenDoorDone: - _vm->_gameSys->insertSequence(0x209, 121, 0x207, 121, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x209, 121, 0x207, 121, kSeqSyncWait, 0, 0, 0); _vm->_gnapActionStatus = -1; break; case kAS04GetKeyFirst: - _vm->_gameSys->insertSequence(0x204, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x204, _vm->_gnapId, 0); + gameSys.insertSequence(0x204, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x204, _vm->_gnapId, 0); _vm->_gnapSequenceId = 0x204; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = kAS04GetKeyFirst2; break; case kAS04GetKeyFirst2: - _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); + gameSys.insertSequence(0x206, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_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); _vm->_gnapSequenceId = 0x206; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = kAS04GetKeyFirstDone; break; case kAS04GetKeyFirstDone: - _vm->_gameSys->requestRemoveSequence(0x1FF, 256); - _vm->_gameSys->requestRemoveSequence(0x20B, 256); - _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, + gameSys.requestRemoveSequence(0x1FF, 256); + gameSys.requestRemoveSequence(0x20B, 256); + 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; @@ -1737,25 +1757,25 @@ void Scene04::updateAnimations() { _vm->_gnapActionStatus = -1; break; case kAS04GetKeyAnother: - _vm->_gameSys->insertSequence(0x202, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x202, _vm->_gnapId, 0); + gameSys.insertSequence(0x202, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x202, _vm->_gnapId, 0); _vm->_gnapSequenceId = 0x202; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = kAS04GetKeyAnother2; break; case kAS04GetKeyAnother2: - _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); + gameSys.insertSequence(0x203, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_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); _vm->_gnapSequenceId = 0x203; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = kAS04GetKeyAnotherDone; break; case kAS04GetKeyAnotherDone: - _vm->_gameSys->removeSequence(0x1FF, 256, true); - _vm->_gameSys->removeSequence(0x20A, 256, true); - _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, + gameSys.removeSequence(0x1FF, 256, true); + gameSys.removeSequence(0x20A, 256, true); + 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; @@ -1767,8 +1787,8 @@ void Scene04::updateAnimations() { _nextDogSequenceId = 0x201; break; case kAS04GrabAxe: - _vm->_gameSys->insertSequence(0x211, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->requestRemoveSequence(0x212, 100); + gameSys.insertSequence(0x211, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.requestRemoveSequence(0x212, 100); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x211; _vm->_gnapActionStatus = -1; @@ -1779,21 +1799,21 @@ void Scene04::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - _vm->_gameSys->setAnimation(0, 0, 2); + if (gameSys.getAnimationStatus(2) == 2) { + gameSys.setAnimation(0, 0, 2); _vm->invAdd(kItemTwig); _vm->setGrabCursorSprite(kItemTwig); _vm->setFlag(kGFTwigTaken); updateHotspots(); } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { if (_nextDogSequenceId == 0x201) { - _vm->_gameSys->insertSequence(_nextDogSequenceId, 139 - _dogIdCtr, + gameSys.insertSequence(_nextDogSequenceId, 139 - _dogIdCtr, _currDogSequenceId, 139 - (_dogIdCtr + 1) % 2, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x200, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextDogSequenceId, 139 - _dogIdCtr, 3); + gameSys.insertSequence(0x200, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextDogSequenceId, 139 - _dogIdCtr, 3); _dogIdCtr = (_dogIdCtr + 1) % 2; _currDogSequenceId = 0x201; _vm->_gnapSequenceId = 0x200; @@ -1802,10 +1822,10 @@ void Scene04::updateAnimations() { _vm->_timers[6] = _vm->getRandom(20) + 60; _nextDogSequenceId = -1; } else if (_nextDogSequenceId != -1) { - _vm->_gameSys->insertSequence(_nextDogSequenceId, 139 - _dogIdCtr, + gameSys.insertSequence(_nextDogSequenceId, 139 - _dogIdCtr, _currDogSequenceId, 139 - (_dogIdCtr + 1) % 2, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextDogSequenceId, 139 - _dogIdCtr, 3); + gameSys.setAnimation(_nextDogSequenceId, 139 - _dogIdCtr, 3); _dogIdCtr = (_dogIdCtr + 1) % 2; _currDogSequenceId = _nextDogSequenceId; _nextDogSequenceId = -1; @@ -1821,9 +1841,11 @@ Scene05::Scene05(GnapEngine *vm) : Scene(vm) { } int Scene05::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 3); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 3); return _vm->isFlag(kGFBarnPadlockOpen) ? 0x151 : 0x150; } @@ -1846,12 +1868,14 @@ void Scene05::updateHotspots() { } void Scene05::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x1091C, true); _vm->startSoundTimerC(7); _currChickenSequenceId = 0x142; - _vm->_gameSys->setAnimation(0x142, 100, 3); - _vm->_gameSys->insertSequence(0x142, 100, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x142, 100, 3); + gameSys.insertSequence(0x142, 100, 0, 0, kSeqNone, 0, 0, 0); _nextChickenSequenceId = -1; @@ -1859,7 +1883,7 @@ void Scene05::run() { _vm->_timers[6] = _vm->getRandom(150) + 300; if (_vm->isFlag(kGFBarnPadlockOpen)) - _vm->_gameSys->insertSequence(0x14A, 141, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x14A, 141, 0, 0, kSeqNone, 0, 0, 0); _vm->queueInsertDeviceIcon(); @@ -2101,7 +2125,7 @@ void Scene05::run() { if (!_vm->_timers[6]) { _vm->_timers[6] = _vm->getRandom(150) + 300; if (_vm->_gnapActionStatus < 0) - _vm->_gameSys->insertSequence(0x149, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x149, 39, 0, 0, kSeqNone, 0, 0, 0); } _vm->playSoundC(); } @@ -2120,22 +2144,24 @@ void Scene05::run() { } void Scene05::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS05LeaveScene: _vm->_sceneDone = true; _vm->_gnapActionStatus = -1; break; case kAS05TryPickPadlock: - _vm->_gameSys->insertSequence(0x148, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x148, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x148; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = -1; break; case kAS05PickPadlock: - _vm->_gameSys->setAnimation(0x147, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x147, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x147, _vm->_gnapId, 0); + gameSys.insertSequence(0x147, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x147; _vm->_gnapSequenceDatNum = 0; _vm->setFlag(kGFBarnPadlockOpen); @@ -2154,10 +2180,10 @@ void Scene05::updateAnimations() { _nextChickenSequenceId = 0x14B; break; case kAS05GrabLadder: - while (_vm->_gameSys->isSequenceActive(0x149, 39)) + while (gameSys.isSequenceActive(0x149, 39)) _vm->gameUpdateTick(); - _vm->_gameSys->insertSequence(0x14E, _vm->_gnapId + 1, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x14D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x14E, _vm->_gnapId + 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x14D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x14D; _vm->_gnapSequenceDatNum = 0; _vm->_timers[2] = 200; @@ -2165,10 +2191,10 @@ void Scene05::updateAnimations() { _vm->_gnapActionStatus = -1; break; case kAS05EnterBarn: - _vm->_gameSys->insertSequence(0x107B1, 1, + gameSys.insertSequence(0x107B1, 1, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); - _vm->_gameSys->setAnimation(0x107B1, 1, 0); + gameSys.setAnimation(0x107B1, 1, 0); _vm->_gnapActionStatus = kAS05LeaveScene; break; case kAS05UseTwigWithChicken: @@ -2179,11 +2205,11 @@ void Scene05::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { + if (gameSys.getAnimationStatus(1) == 2) { if (_vm->_platypusSequenceId == 0x146) { _vm->_platX = 4; _vm->_platY = 8; - _vm->_gameSys->insertSequence(0x107C1, 160, 0x146, 256, kSeqSyncWait, 0, 300 - _vm->_platGridX, 384 - _vm->_platGridY); + gameSys.insertSequence(0x107C1, 160, 0x146, 256, kSeqSyncWait, 0, 300 - _vm->_platGridX, 384 - _vm->_platGridY); _vm->_platypusSequenceId = 0x7C1; _vm->_platypusSequenceDatNum = 1; _vm->_platypusId = 20 * _vm->_platY; @@ -2195,31 +2221,31 @@ void Scene05::updateAnimations() { _vm->_platypusActionStatus = -1; } if (_vm->_platypusActionStatus == kAS05PlatSearchHaystack) { - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->insertSequence(0x145, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x146, 256, 0x145, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.insertSequence(0x145, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x146, 256, 0x145, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _vm->hideCursor(); _vm->setGrabCursorSprite(-1); _vm->_platypusSequenceId = 0x146; _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x146, 256, 1); + gameSys.setAnimation(0x146, 256, 1); _vm->_timers[1] = 300; } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { if (_nextChickenSequenceId == 0x14B) { - _vm->_gameSys->setAnimation(_nextChickenSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_nextChickenSequenceId, 100, _currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x14C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextChickenSequenceId, 100, 3); + gameSys.insertSequence(_nextChickenSequenceId, 100, _currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x14C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x14C; _currChickenSequenceId = _nextChickenSequenceId; _nextChickenSequenceId = -1; _vm->_gnapActionStatus = -1; } else if (_nextChickenSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextChickenSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_nextChickenSequenceId, 100, _currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextChickenSequenceId, 100, 3); + gameSys.insertSequence(_nextChickenSequenceId, 100, _currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); _currChickenSequenceId = _nextChickenSequenceId; _nextChickenSequenceId = -1; } @@ -2236,9 +2262,11 @@ Scene06::Scene06(GnapEngine *vm) : Scene(vm) { } int Scene06::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 2); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); if (_vm->isFlag(kGFSceneFlag1)) { _vm->playSound(0x11B, false); _vm->clearFlag(kGFSceneFlag1); @@ -2268,26 +2296,27 @@ void Scene06::updateHotspots() { } void Scene06::run() { + GameSys& gameSys = *_vm->_gameSys; bool triedDeviceOnGas = false; _vm->startSoundTimerC(7); _horseTurnedBack = false; - _vm->_gameSys->insertSequence(0xF1, 120, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xF1, 120, 0, 0, kSeqNone, 0, 0, 0); _currHorseSequenceId = 0xF1; _nextHorseSequenceId = -1; - _vm->_gameSys->setAnimation(0xF1, 120, 2); + gameSys.setAnimation(0xF1, 120, 2); _vm->_timers[4] = _vm->getRandom(40) + 25; if (_vm->isFlag(kGFUnk04)) - _vm->_gameSys->insertSequence(0xF7, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xF7, 20, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(0xF8, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xF8, 20, 0, 0, kSeqNone, 0, 0, 0); if (!_vm->isFlag(kGFGasTaken) && _vm->_cursorValue != 4) - _vm->_gameSys->insertSequence(0xFE, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xFE, 20, 0, 0, kSeqNone, 0, 0, 0); _vm->queueInsertDeviceIcon(); @@ -2518,23 +2547,25 @@ void Scene06::run() { } void Scene06::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS06LeaveScene: _vm->_sceneDone = true; _vm->_gnapActionStatus = -1; break; case kAS06TryToGetGas: - _vm->_gameSys->insertSequence(0xFC, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xFC, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0xFC; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = -1; break; case kAS06TryToClimbLadder: - _vm->_gameSys->insertSequence(0xFF, 20, 0xFE, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0xFD, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0xFD, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xFF, 20, 0xFE, 20, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0xFD, _vm->_gnapId, 0); + gameSys.insertSequence(0xFD, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0xFD; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = kAS06TryToClimbLadderDone; @@ -2556,10 +2587,10 @@ void Scene06::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); if (_vm->_platypusSequenceId == 0xFA) { - _vm->_gameSys->setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 1); _vm->invAdd(kItemGas); _vm->setFlag(kGFGasTaken); _vm->_hotspots[kHS06Ladder]._flags = SF_DISABLED; @@ -2567,7 +2598,7 @@ void Scene06::updateAnimations() { _vm->_platypusActionStatus = -1; _vm->_platX = 6; _vm->_platY = 8; - _vm->_gameSys->insertSequence(0x107C1, _vm->_platypusId, 0, 0, kSeqNone, 0, 450 - _vm->_platGridX, 384 - _vm->_platGridY); + gameSys.insertSequence(0x107C1, _vm->_platypusId, 0, 0, kSeqNone, 0, 450 - _vm->_platGridX, 384 - _vm->_platGridY); _vm->_platypusSequenceId = 0x7C1; _vm->_platypusSequenceDatNum = 1; _vm->setFlag(kGFUnk04); @@ -2575,26 +2606,26 @@ void Scene06::updateAnimations() { _vm->showCursor(); } if (_nextPlatSequenceId == 0xFB) { - _vm->_gameSys->setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 1); _nextHorseSequenceId = 0xF2; _vm->_platypusActionStatus = 6; } } - if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextHorseSequenceId != -1) { + if (gameSys.getAnimationStatus(2) == 2 && _nextHorseSequenceId != -1) { switch (_nextHorseSequenceId) { case 0xF2: _vm->setGrabCursorSprite(-1); _vm->hideCursor(); - _vm->_gameSys->setAnimation(0xFA, 256, 1); - _vm->_gameSys->insertSequence(0xF2, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x100, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xF7, 20, 0xF8, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xFB, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xFA, 256, 0xFB, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0xFA, 256, 1); + gameSys.insertSequence(0xF2, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x100, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xF7, 20, 0xF8, 20, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xFB, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xFA, 256, 0xFB, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceId = 0xFA; _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->insertSequence(0x107B7, _vm->_gnapId, 0x100, _vm->_gnapId, + gameSys.insertSequence(0x107B7, _vm->_gnapId, 0x100, _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7B7; _vm->_gnapSequenceDatNum = 1; @@ -2604,16 +2635,16 @@ void Scene06::updateAnimations() { _vm->invRemove(kItemTwig); break; case 0xF6: - _vm->_gameSys->setAnimation(_nextHorseSequenceId, 120, 2); - _vm->_gameSys->insertSequence(0xF6, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextHorseSequenceId, 120, 2); + gameSys.insertSequence(0xF6, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); _horseTurnedBack = true; _currHorseSequenceId = _nextHorseSequenceId; _nextHorseSequenceId = -1; _vm->_gnapActionStatus = -1; break; default: - _vm->_gameSys->setAnimation(_nextHorseSequenceId, 120, 2); - _vm->_gameSys->insertSequence(_nextHorseSequenceId, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextHorseSequenceId, 120, 2); + gameSys.insertSequence(_nextHorseSequenceId, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); _currHorseSequenceId = _nextHorseSequenceId; _nextHorseSequenceId = -1; break; @@ -2644,15 +2675,17 @@ void Scene07::updateHotspots() { } void Scene07::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(0x8C, 1, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x90, 1, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x8C, 1, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x90, 1, 0, 0, kSeqLoop, 0, 0, 0); _vm->invRemove(kItemGas); _vm->invRemove(kItemNeedle); if (!_vm->isFlag(kGFPlatypus)) - _vm->_gameSys->insertSequence(0x8D, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x8D, 1, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 8) { _vm->initGnapPos(7, 7, kDirBottomLeft); @@ -2665,8 +2698,8 @@ void Scene07::run() { _vm->_gnapSequenceId = 0x8F; _vm->_gnapSequenceDatNum = 0; _vm->_gnapIdleFacing = kDirBottomRight; - _vm->_gameSys->insertSequence(0x8F, 140, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + gameSys.insertSequence(0x8F, 140, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); _vm->_gnapActionStatus = kAS07Wait; _vm->_platX = 3; _vm->_platY = 8; @@ -2674,7 +2707,7 @@ void Scene07::run() { _vm->_platypusSequenceId = 0x91; _vm->_platypusSequenceDatNum = 0; _vm->_platypusFacing = kDirNone; - _vm->_gameSys->insertSequence(0x91, 160, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x91, 160, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); } @@ -2733,9 +2766,9 @@ void Scene07::run() { _vm->invAdd(kItemDice); updateHotspots(); _vm->playGnapPullOutDevice(3, 3); - _vm->_gameSys->setAnimation(0x8E, 1, 2); - _vm->_gameSys->insertSequence(0x8E, 1, 141, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(_vm->getGnapSequenceId(gskUseDevice, 0, 0) | 0x10000, _vm->_gnapId, + gameSys.setAnimation(0x8E, 1, 2); + gameSys.insertSequence(0x8E, 1, 141, 1, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_vm->getGnapSequenceId(gskUseDevice, 0, 0) | 0x10000, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->_gnapSequenceId = _vm->getGnapSequenceId(gskUseDevice, 0, 0); @@ -2805,7 +2838,7 @@ void Scene07::run() { } else { _vm->playPlatypusSequence(0x107CB); } - _vm->_gameSys->setAnimation(_vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, 1); + gameSys.setAnimation(_vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, 1); } } else { _vm->_timers[0] = _vm->getRandom(75) + 75; @@ -2831,8 +2864,10 @@ void Scene07::run() { } void Scene07::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS07LeaveScene: _vm->_newSceneNum = 8; @@ -2842,8 +2877,8 @@ void Scene07::updateAnimations() { _vm->_gnapActionStatus = -1; } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - _vm->_gameSys->setAnimation(0, 0, 2); + if (gameSys.getAnimationStatus(2) == 2) { + gameSys.setAnimation(0, 0, 2); _vm->setGrabCursorSprite(kItemDice); } } @@ -2883,9 +2918,11 @@ void Scene08::updateHotspots() { } void Scene08::updateAnimationsCb() { - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - _vm->_gameSys->setAnimation(_nextDogSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(3) == 2) { + gameSys.setAnimation(_nextDogSequenceId, 100, 3); + gameSys.insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); _currDogSequenceId = _nextDogSequenceId; if ( _nextDogSequenceId != 0x135 ) _nextDogSequenceId = 0x134; @@ -2893,33 +2930,35 @@ void Scene08::updateAnimationsCb() { } void Scene08::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(0x14F, 1, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x14E, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x14F, 1, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x14E, 256, 0, 0, kSeqNone, 0, 0, 0); _currDogSequenceId = 0x135; _nextDogSequenceId = 0x135; - _vm->_gameSys->setAnimation(0x135, 100, 3); - _vm->_gameSys->insertSequence(_currDogSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x135, 100, 3); + gameSys.insertSequence(_currDogSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); _currManSequenceId = 0x140; _nextManSequenceId = -1; - _vm->_gameSys->setAnimation(0x140, 100, 2); - _vm->_gameSys->insertSequence(_currManSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x140, 100, 2); + gameSys.insertSequence(_currManSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[4] = _vm->getRandom(50) + 75; if (!_vm->isFlag(kGFBarnPadlockOpen)) - _vm->_gameSys->insertSequence(0x144, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x144, 1, 0, 0, kSeqNone, 0, 0, 0); if (!_vm->isFlag(kGFTruckFilledWithGas)) - _vm->_gameSys->insertSequence(0x145, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x145, 1, 0, 0, kSeqNone, 0, 0, 0); if (!_vm->isFlag(kGFTruckKeysUsed)) - _vm->_gameSys->insertSequence(0x146, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x146, 1, 0, 0, kSeqNone, 0, 0, 0); _vm->initGnapPos(-1, 8, kDirBottomRight); _vm->initPlatypusPos(-1, 7, kDirNone); @@ -3031,13 +3070,13 @@ void Scene08::run() { case kHS08Door: if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(4, 7, 5, 0); - _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); _vm->_gnapActionStatus = kAS08GrabDog; } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->playGnapScratchingHead(6, 0); - _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); _vm->_gnapActionStatus = kAS08LookDog; break; case GRAB_CURSOR: @@ -3201,8 +3240,10 @@ void Scene08::run() { } void Scene08::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS08LeaveScene: _vm->_sceneDone = true; @@ -3237,8 +3278,8 @@ void Scene08::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); switch (_vm->_platypusActionStatus) { case kAS08PlatWithDog: _nextDogSequenceId = 0x147; @@ -3250,14 +3291,14 @@ void Scene08::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextManSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextManSequenceId, 100, 2); - _vm->_gameSys->insertSequence(_nextManSequenceId, 100, _currManSequenceId, 100, kSeqSyncWait, 0, 0, 0); + if (gameSys.getAnimationStatus(2) == 2 && _nextManSequenceId != -1) { + gameSys.setAnimation(_nextManSequenceId, 100, 2); + gameSys.insertSequence(_nextManSequenceId, 100, _currManSequenceId, 100, kSeqSyncWait, 0, 0, 0); _currManSequenceId = _nextManSequenceId; _nextManSequenceId = -1; } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { if (_currDogSequenceId == 0x147) _vm->_platypusActionStatus = -1; if (_currDogSequenceId == 0x149 || _currDogSequenceId == 0x14A || _currDogSequenceId == 0x14B) { @@ -3268,31 +3309,31 @@ void Scene08::updateAnimations() { } else if (_currDogSequenceId == 0x133) _nextManSequenceId = 0x139; if (_nextDogSequenceId == 0x149 || _nextDogSequenceId == 0x14A || _nextDogSequenceId == 0x14B) { - _vm->_gameSys->setAnimation(_nextDogSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextDogSequenceId, 100, 3); + gameSys.insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); switch (_nextDogSequenceId) { case 0x149: _vm->setFlag(kGFBarnPadlockOpen); _vm->_hotspots[kHS08Meat]._flags = SF_DISABLED | SF_WALKABLE; - _vm->_gameSys->removeSequence(0x144, 1, true); + gameSys.removeSequence(0x144, 1, true); break; case 0x14A: _vm->setFlag(kGFTruckFilledWithGas); _vm->_hotspots[kHS08Bone]._flags = SF_DISABLED | SF_WALKABLE; - _vm->_gameSys->removeSequence(0x145, 1, true); + gameSys.removeSequence(0x145, 1, true); break; case 0x14B: _vm->setFlag(kGFTruckKeysUsed); _vm->_hotspots[kHS08Toy]._flags = SF_DISABLED | SF_WALKABLE; - _vm->_gameSys->removeSequence(0x146, 1, true); + gameSys.removeSequence(0x146, 1, true); break; } _currDogSequenceId = _nextDogSequenceId; _nextDogSequenceId = 0x134; } else if (_nextDogSequenceId == 0x147) { - _vm->_gameSys->setAnimation(_nextDogSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x148, 160, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextDogSequenceId, 100, 3); + gameSys.insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x148, 160, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _currDogSequenceId = _nextDogSequenceId; _nextDogSequenceId = 0x134; _vm->_platX = 1; @@ -3304,15 +3345,15 @@ void Scene08::updateAnimations() { if (_vm->_gnapX == 1 && _vm->_gnapY == 8) _vm->gnapWalkStep(); } else if (_nextDogSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextDogSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextDogSequenceId, 100, 3); + gameSys.insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); _currDogSequenceId = _nextDogSequenceId; if (_nextDogSequenceId != 0x135) _nextDogSequenceId = 0x134; if (_currDogSequenceId == 0x133) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - _vm->_gameSys->insertSequence(0x14D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x14D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x14D; _vm->_gnapIdleFacing = kDirUpRight; _vm->_gnapSequenceDatNum = 0; @@ -3344,10 +3385,12 @@ void Scene09::updateHotspots() { } void Scene09::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(0x4D, 1, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x4D, 1, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 8) { _vm->initGnapPos(11, 8, kDirBottomLeft); @@ -3463,9 +3506,9 @@ void Scene09::run() { if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(150) + 100; if (_vm->_timers[4] & 1) - _vm->_gameSys->insertSequence(0x49, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x49, 1, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(0x4A, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x4A, 1, 0, 0, kSeqNone, 0, 0, 0); } playRandomSound(5); } @@ -3485,17 +3528,19 @@ void Scene09::run() { } void Scene09::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS09LeaveScene: _vm->_sceneDone = true; _vm->_gnapActionStatus = -1; break; case kAS09SearchTrash: - _vm->_gameSys->setAnimation(0x4C, 120, 0); - _vm->_gameSys->insertSequence(0x4C, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(0x4B, 2, true); + gameSys.setAnimation(0x4C, 120, 0); + gameSys.insertSequence(0x4C, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.removeSequence(0x4B, 2, true); _vm->_gnapSequenceId = 0x4C; _vm->_gnapId = 120; _vm->_gnapIdleFacing = kDirUpLeft; @@ -3505,7 +3550,7 @@ void Scene09::updateAnimations() { _vm->_gnapActionStatus = kAS09SearchTrashDone; break; case kAS09SearchTrashDone: - _vm->_gameSys->insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[2] = 360; _vm->_timers[4] = _vm->getRandom(150) + 100; _vm->_gnapActionStatus = -1; diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 90767500ed..70742fe27a 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -33,9 +33,11 @@ Scene10::Scene10(GnapEngine *vm) : Scene(vm) { } int Scene10::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 2); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); return 0x10F; } @@ -56,14 +58,16 @@ void Scene10::updateHotspots() { } void Scene10::run() { + GameSys& gameSys = *_vm->_gameSys; + _currCookSequenceId = 0x103; - _vm->_gameSys->setAnimation(0x103, 100, 2); - _vm->_gameSys->insertSequence(0x103, 100, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x103, 100, 2); + gameSys.insertSequence(0x103, 100, 0, 0, kSeqNone, 0, 0, 0); _nextCookSequenceId = 0x106; if (!_vm->isFlag(kGFMudTaken)) - _vm->_gameSys->insertSequence(0x107, 100, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x107, 100, 0, 0, kSeqNone, 0, 0, 0); _vm->queueInsertDeviceIcon(); @@ -146,7 +150,7 @@ void Scene10::run() { case kHS10Cook: if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(4, 8, 6, 0); - _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); _vm->_gnapActionStatus = kAS10AnnoyCook; } else { switch (_vm->_verbCursor) { @@ -239,7 +243,7 @@ void Scene10::run() { _vm->platypusWalkTo(7, 6, 1, 0x107D2, 1); _vm->_platypusActionStatus = kAS10PlatWithBox; _vm->_platypusFacing = kDirUnk4; - _vm->_largeSprite = _vm->_gameSys->createSurface(0xC3); + _vm->_largeSprite = gameSys.createSurface(0xC3); _vm->playGnapIdle(7, 6); } break; @@ -258,7 +262,7 @@ void Scene10::run() { case GRAB_CURSOR: _vm->gnapActionIdle(0x10C); _vm->gnapWalkTo(9, 6, 0, 0x107BB, 1); - _vm->_gameSys->insertSequence(0x10E, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x10E, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x10E; _vm->_gnapId = 120; _vm->_gnapIdleFacing = kDirUpRight; @@ -320,7 +324,7 @@ void Scene10::run() { } else { sequenceId = 0x8A7; } - _vm->_gameSys->insertSequence(sequenceId | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(sequenceId | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); } } } @@ -338,8 +342,10 @@ void Scene10::run() { } void Scene10::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS10LeaveScene: _vm->_sceneDone = true; @@ -350,8 +356,8 @@ void Scene10::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); switch (_vm->_platypusActionStatus) { case kAS10PlatWithBox: _nextCookSequenceId = 0x109; @@ -359,18 +365,18 @@ void Scene10::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextCookSequenceId != -1) { + if (gameSys.getAnimationStatus(2) == 2 && _nextCookSequenceId != -1) { switch (_nextCookSequenceId) { case 0x109: _vm->_platX = 4; _vm->_platY = 8; - _vm->_gameSys->insertSequence(0x109, 100, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x107C9, 160, + gameSys.insertSequence(0x109, 100, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x107C9, 160, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, _vm->getSequenceTotalDuration(0x109) + _vm->getSequenceTotalDuration(0x10A) + _vm->getSequenceTotalDuration(0x10843), 75 * _vm->_platX - _vm->_platGridX, 48 * _vm->_platY - _vm->_platGridY); - _vm->_gameSys->removeSequence(0x107, 100, true); + gameSys.removeSequence(0x107, 100, true); _currCookSequenceId = 0x109; _nextCookSequenceId = 0x843; _vm->_platypusSequenceId = 0x7C9; @@ -380,17 +386,17 @@ void Scene10::updateAnimations() { break; case 0x843: _vm->hideCursor(); - _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); - _vm->_gameSys->insertSequence(0x10843, 301, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); + gameSys.insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); + gameSys.insertSequence(0x10843, 301, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); _currCookSequenceId = 0x843; _nextCookSequenceId = 0x10A; break; case 0x10A: - _vm->_gameSys->insertSequence(_nextCookSequenceId, 100, 0x10843, 301, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextCookSequenceId, 100, 0x10843, 301, kSeqSyncWait, 0, 0, 0); _currCookSequenceId = _nextCookSequenceId; _nextCookSequenceId = 0x104; _vm->showCursor(); - _vm->_gameSys->removeSpriteDrawItem(_vm->_largeSprite, 300); + gameSys.removeSpriteDrawItem(_vm->_largeSprite, 300); _vm->delayTicksCursor(5); _vm->deleteSurface(&_vm->_largeSprite); _vm->setGrabCursorSprite(kItemTongs); @@ -400,7 +406,7 @@ void Scene10::updateAnimations() { _vm->gnapWalkStep(); break; default: - _vm->_gameSys->insertSequence(_nextCookSequenceId, 100, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextCookSequenceId, 100, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); _currCookSequenceId = _nextCookSequenceId; break; } @@ -417,7 +423,7 @@ void Scene10::updateAnimations() { _nextCookSequenceId = 0x103; else if (rnd == 2) { _nextCookSequenceId = 0x106; - _vm->_gameSys->insertSequence(0x10D, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x10D, 1, 0, 0, kSeqNone, 0, 0, 0); } else _nextCookSequenceId = 0x106; } @@ -451,7 +457,7 @@ void Scene10::updateAnimations() { _nextCookSequenceId = 0x106; _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = 300; - _vm->_gameSys->insertSequence(0x10C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x10C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x10C; _vm->_gnapIdleFacing = kDirUpRight; _vm->_gnapSequenceDatNum = 0; @@ -461,16 +467,18 @@ void Scene10::updateAnimations() { break; } if (_currCookSequenceId == 0x843) - _vm->_gameSys->setAnimation(_currCookSequenceId | 0x10000, 301, 2); + gameSys.setAnimation(_currCookSequenceId | 0x10000, 301, 2); else - _vm->_gameSys->setAnimation(_currCookSequenceId, 100, 2); + gameSys.setAnimation(_currCookSequenceId, 100, 2); } } void Scene10::updateAnimationsCb() { - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - _vm->_gameSys->setAnimation(_nextCookSequenceId, 100, 2); - _vm->_gameSys->insertSequence(_nextCookSequenceId, 100, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(2) == 2) { + gameSys.setAnimation(_nextCookSequenceId, 100, 2); + gameSys.insertSequence(_nextCookSequenceId, 100, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); _currCookSequenceId = _nextCookSequenceId; _nextCookSequenceId = 0x106; } @@ -487,9 +495,11 @@ Scene11::Scene11(GnapEngine *vm) : Scene(vm) { } int Scene11::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 3); - _vm->_gameSys->setAnimation(0, 0, 2); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 3); + gameSys.setAnimation(0, 0, 2); if (_vm->_prevSceneNum == 10 || _vm->_prevSceneNum == 13) { _vm->playSound(0x108EC, false); _vm->playSound(0x10928, false); @@ -515,6 +525,7 @@ void Scene11::updateHotspots() { } void Scene11::run() { + GameSys& gameSys = *_vm->_gameSys; bool flag = true; _vm->_timers[7] = 50; @@ -547,16 +558,16 @@ void Scene11::run() { _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(_currHookGuySequenceId, 120, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(_currHookGuySequenceId, 120, 0, 0, kSeqNone, 0, 0, 0); _nextHookGuySequenceId = -1; - _vm->_gameSys->setAnimation(_currHookGuySequenceId, 120, 3); - _vm->_gameSys->insertSequence(_currGoggleGuySequenceId, 121, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(_currHookGuySequenceId, 120, 3); + gameSys.insertSequence(_currGoggleGuySequenceId, 121, 0, 0, kSeqNone, 0, 0, 0); _nextGoggleGuySequenceId = -1; - _vm->_gameSys->setAnimation(_currGoggleGuySequenceId, 121, 2); + gameSys.setAnimation(_currGoggleGuySequenceId, 121, 2); _vm->_timers[5] = _vm->getRandom(100) + 75; _vm->_timers[4] = _vm->getRandom(40) + 20; @@ -568,7 +579,7 @@ void Scene11::run() { _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); } - _vm->_gameSys->insertSequence(0x208, 256, 0, 0, kSeqNone, 40, 0, 0); + gameSys.insertSequence(0x208, 256, 0, 0, kSeqNone, 40, 0, 0); while (!_vm->_sceneDone) { _vm->testWalk(0, 0, -1, -1, -1, -1); @@ -733,8 +744,8 @@ void Scene11::run() { if (!_vm->_isLeavingScene) { if (flag && !_vm->_timers[7]) { flag = false; - _vm->_gameSys->setAnimation(0x207, 257, 4); - _vm->_gameSys->insertSequence(0x207, 257, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x207, 257, 4); + gameSys.insertSequence(0x207, 257, 0, 0, kSeqNone, 0, 0, 0); } _vm->platypusSub426234(); _vm->updateGnapIdleSequence2(); @@ -775,13 +786,13 @@ void Scene11::run() { int _gnapRandomValue = _vm->getRandom(3); switch (_gnapRandomValue) { case 0: - _vm->_gameSys->insertSequence(0x8A5 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x8A5 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); break; case 1: - _vm->_gameSys->insertSequence(0x8A7 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x8A7 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); break; case 2: - _vm->_gameSys->insertSequence(0x8A6 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x8A6 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); break; } } @@ -802,9 +813,11 @@ void Scene11::run() { } void Scene11::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { if (_vm->_gnapActionStatus != kAS11GrabBillardBall) - _vm->_gameSys->setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS11LeaveScene: _vm->_sceneDone = true; @@ -825,20 +838,20 @@ void Scene11::updateAnimations() { _nextHookGuySequenceId = 0x206; break; case kAS11GrabBillardBall: - if (_vm->_gameSys->getAnimationStatus(2) == 2 && _vm->_gameSys->getAnimationStatus(3) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + if (gameSys.getAnimationStatus(2) == 2 && gameSys.getAnimationStatus(3) == 2) { + gameSys.setAnimation(0, 0, 0); _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - _vm->_gameSys->insertSequence(0x1F4, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x1F4, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x1F4; _vm->_gnapId = 255; _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->removeSequence(0x207, 257, true); - _vm->_gameSys->removeSequence(0x208, 256, true); + gameSys.removeSequence(0x207, 257, true); + gameSys.removeSequence(0x208, 256, true); _nextGoggleGuySequenceId = 0x1F8; _vm->_timers[5] = _vm->getRandom(100) + 75; - _vm->_gameSys->insertSequence(_nextGoggleGuySequenceId, 121, _currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextGoggleGuySequenceId, 121, 2); + gameSys.insertSequence(_nextGoggleGuySequenceId, 121, _currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextGoggleGuySequenceId, 121, 2); _currGoggleGuySequenceId = _nextGoggleGuySequenceId; _nextGoggleGuySequenceId = -1; switch (_billardBallCtr) { @@ -853,36 +866,36 @@ void Scene11::updateAnimations() { break; } ++_billardBallCtr; - _vm->_gameSys->insertSequence(_nextHookGuySequenceId, 120, _currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextHookGuySequenceId, 120, 3); + gameSys.insertSequence(_nextHookGuySequenceId, 120, _currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextHookGuySequenceId, 120, 3); _currHookGuySequenceId = _nextHookGuySequenceId; _nextHookGuySequenceId = -1; _vm->_timers[4] = _vm->getRandom(40) + 20; - _vm->_gameSys->insertSequence(0x208, 256, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(0x1F4) - 5, 0, 0); + gameSys.insertSequence(0x208, 256, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(0x1F4) - 5, 0, 0); _vm->_hotspots[kHS11Billard]._flags |= SF_DISABLED; - _vm->_gameSys->setAnimation(0x207, 257, 4); - _vm->_gameSys->insertSequence(0x207, 257, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(0x1FE), 0, 0); + gameSys.setAnimation(0x207, 257, 4); + gameSys.insertSequence(0x207, 257, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(0x1FE), 0, 0); _vm->_gnapActionStatus = -1; } break; } } - if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextGoggleGuySequenceId != -1) { + if (gameSys.getAnimationStatus(2) == 2 && _nextGoggleGuySequenceId != -1) { _vm->_timers[5] = _vm->getRandom(100) + 75; - _vm->_gameSys->insertSequence(_nextGoggleGuySequenceId, 121, _currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextGoggleGuySequenceId, 121, 2); + gameSys.insertSequence(_nextGoggleGuySequenceId, 121, _currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextGoggleGuySequenceId, 121, 2); _currGoggleGuySequenceId = _nextGoggleGuySequenceId; _nextGoggleGuySequenceId = -1; if (_vm->_gnapActionStatus >= 1 && _vm->_gnapActionStatus <= 4) _vm->_gnapActionStatus = -1; } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { if (_nextHookGuySequenceId == 0x204) { - _vm->_gameSys->setAnimation(_nextHookGuySequenceId, 120, 3); - _vm->_gameSys->insertSequence(0x204, 120, _currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x1F5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextHookGuySequenceId, 120, 3); + gameSys.insertSequence(0x204, 120, _currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x1F5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _currHookGuySequenceId = 0x204; _nextHookGuySequenceId = -1; _vm->_gnapSequenceId = 0x1F5; @@ -893,8 +906,8 @@ void Scene11::updateAnimations() { if (_vm->_gnapActionStatus == kAS11GrabHookGuy) _vm->_gnapActionStatus = -1; } else if (_nextHookGuySequenceId != -1) { - _vm->_gameSys->insertSequence(_nextHookGuySequenceId, 120, _currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextHookGuySequenceId, 120, 3); + gameSys.insertSequence(_nextHookGuySequenceId, 120, _currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextHookGuySequenceId, 120, 3); _currHookGuySequenceId = _nextHookGuySequenceId; _nextHookGuySequenceId = -1; _vm->_timers[4] = _vm->getRandom(40) + 20; @@ -903,8 +916,8 @@ void Scene11::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(4) == 2) { - _vm->_gameSys->setAnimation(0, 0, 4); + if (gameSys.getAnimationStatus(4) == 2) { + gameSys.setAnimation(0, 0, 4); _vm->_hotspots[kHS11Billard]._flags &= ~SF_DISABLED; } } @@ -940,29 +953,30 @@ void Scene12::updateHotspots() { } void Scene12::run() { + GameSys& gameSys = *_vm->_gameSys; int v18 = 1; _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(0x207, 256, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x200, 50, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x207, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x200, 50, 0, 0, kSeqNone, 0, 0, 0); _currToothGuySequenceId = 0x200; _nextToothGuySequenceId = -1; - _vm->_gameSys->setAnimation(0x200, 50, 2); - _vm->_gameSys->insertSequence(0x202, 50, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x200, 50, 2); + gameSys.insertSequence(0x202, 50, 0, 0, kSeqNone, 0, 0, 0); _currBeardGuySequenceId = 0x202; _nextBeardGuySequenceId = -1; - _vm->_gameSys->setAnimation(0x202, 50, 4); - _vm->_gameSys->insertSequence(0x203, 50, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x202, 50, 4); + gameSys.insertSequence(0x203, 50, 0, 0, kSeqNone, 0, 0, 0); _currBarkeeperSequenceId = 0x203; _nextBarkeeperSequenceId = -1; - _vm->_gameSys->setAnimation(0x203, 50, 3); + gameSys.setAnimation(0x203, 50, 3); _vm->_timers[4] = 30; _vm->_timers[6] = _vm->getRandom(30) + 20; @@ -1026,7 +1040,7 @@ void Scene12::run() { case kHS12ToothGuy: if (_vm->_grabCursorSpriteIndex == kItemQuarter) { - _vm->_largeSprite = _vm->_gameSys->createSurface(0x141); + _vm->_largeSprite = gameSys.createSurface(0x141); _vm->gnapWalkTo(3, 7, 0, 0x107BC, 9); _vm->_gnapIdleFacing = kDirUpLeft; _vm->_gnapActionStatus = kAS12QuarterToToothGuy; @@ -1095,7 +1109,7 @@ void Scene12::run() { break; case PLAT_CURSOR: _vm->playGnapPullOutDevice(_vm->_platX, _vm->_platY); - _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); _vm->_gnapActionStatus = kAS12PlatWithBarkeeper; break; } @@ -1207,13 +1221,13 @@ void Scene12::run() { int _gnapRandomValue = _vm->getRandom(3); switch (_gnapRandomValue) { case 0: - _vm->_gameSys->insertSequence(0x8A5 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x8A5 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); break; case 1: - _vm->_gameSys->insertSequence(0x8A7 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x8A7 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); break; case 2: - _vm->_gameSys->insertSequence(0x8A6 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x8A6 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); break; } } @@ -1235,8 +1249,10 @@ void Scene12::run() { } void Scene12::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS12LeaveScene: _vm->_sceneDone = true; @@ -1287,7 +1303,7 @@ void Scene12::updateAnimations() { case kAS12QuarterToToothGuyDone: _vm->_gnapActionStatus = -1; _vm->showCursor(); - _vm->_gameSys->removeSpriteDrawItem(_vm->_largeSprite, 300); + gameSys.removeSpriteDrawItem(_vm->_largeSprite, 300); _vm->deleteSurface(&_vm->_largeSprite); _vm->setGrabCursorSprite(kItemQuarterWithHole); break; @@ -1327,8 +1343,8 @@ void Scene12::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); switch (_vm->_platypusActionStatus) { case kAS12PlatWithToothGuy: _nextToothGuySequenceId = 0x1EB; @@ -1339,15 +1355,15 @@ void Scene12::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { + if (gameSys.getAnimationStatus(2) == 2) { if (_currToothGuySequenceId == 0x1E9) { - _vm->_gameSys->setAnimation(0, 0, 2); + gameSys.setAnimation(0, 0, 2); _vm->hideCursor(); - _vm->_gameSys->setAnimation(0x10843, 301, 0); + gameSys.setAnimation(0x10843, 301, 0); _vm->_gnapActionStatus = kAS12QuarterToToothGuyDone; - _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); - _vm->_gameSys->insertSequence(0x10843, 301, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x107B7, _vm->_gnapId, 0x10843, 301, + gameSys.insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); + gameSys.insertSequence(0x10843, 301, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x107B7, _vm->_gnapId, 0x10843, 301, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7B7; _vm->_gnapSequenceDatNum = 1; @@ -1356,9 +1372,9 @@ void Scene12::updateAnimations() { _vm->invRemove(kItemQuarter); } if (_nextToothGuySequenceId == 0x1EF) { - _vm->_gameSys->setAnimation(_nextToothGuySequenceId, 50, 2); - _vm->_gameSys->insertSequence(_nextToothGuySequenceId, 50, _currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextToothGuySequenceId, 50, 2); + gameSys.insertSequence(_nextToothGuySequenceId, 50, _currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _currToothGuySequenceId = _nextToothGuySequenceId; _nextToothGuySequenceId = -1; _vm->_gnapSequenceId = 0x205; @@ -1369,8 +1385,8 @@ void Scene12::updateAnimations() { if (_vm->_gnapActionStatus == kAS12GrabToothGuy) _vm->_gnapActionStatus = -1; } else if (_nextToothGuySequenceId != -1) { - _vm->_gameSys->insertSequence(_nextToothGuySequenceId, 50, _currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextToothGuySequenceId, 50, 2); + gameSys.insertSequence(_nextToothGuySequenceId, 50, _currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextToothGuySequenceId, 50, 2); _currToothGuySequenceId = _nextToothGuySequenceId; _nextToothGuySequenceId = -1; _vm->_timers[4] = 50; @@ -1382,15 +1398,15 @@ void Scene12::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { if (_vm->_gnapActionStatus == kAS12PlatWithBarkeeper && _currBarkeeperSequenceId == 0x1F9) { _vm->_gnapActionStatus = -1; _vm->playGnapIdle(7, 6); _vm->_timers[5] = 0; } if (_nextBarkeeperSequenceId != -1) { - _vm->_gameSys->insertSequence(_nextBarkeeperSequenceId, 50, _currBarkeeperSequenceId, 50, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextBarkeeperSequenceId, 50, 3); + gameSys.insertSequence(_nextBarkeeperSequenceId, 50, _currBarkeeperSequenceId, 50, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextBarkeeperSequenceId, 50, 3); _currBarkeeperSequenceId = _nextBarkeeperSequenceId; _nextBarkeeperSequenceId = -1; _vm->_timers[5] = _vm->getRandom(30) + 20; @@ -1400,9 +1416,9 @@ void Scene12::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(4) == 2 && _nextBeardGuySequenceId != -1) { - _vm->_gameSys->insertSequence(_nextBeardGuySequenceId, 50, _currBeardGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextBeardGuySequenceId, 50, 4); + if (gameSys.getAnimationStatus(4) == 2 && _nextBeardGuySequenceId != -1) { + gameSys.insertSequence(_nextBeardGuySequenceId, 50, _currBeardGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextBeardGuySequenceId, 50, 4); _currBeardGuySequenceId = _nextBeardGuySequenceId; _nextBeardGuySequenceId = -1; _vm->_timers[6] = _vm->getRandom(30) + 20; @@ -1446,9 +1462,11 @@ void Scene13::updateHotspots() { } void Scene13::showScribble() { + GameSys& gameSys = *_vm->_gameSys; + _vm->hideCursor(); - _vm->_largeSprite = _vm->_gameSys->createSurface(0x6F); - _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); + _vm->_largeSprite = gameSys.createSurface(0x6F); + gameSys.insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); while (!_vm->_mouseClickState._left && !_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) && !_vm->isKeyStatus1(Common::KEYCODE_SPACE) && !_vm->isKeyStatus1(29)) _vm->gameUpdateTick(); @@ -1456,17 +1474,18 @@ void Scene13::showScribble() { _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); _vm->clearKeyStatus1(29); _vm->clearKeyStatus1(Common::KEYCODE_SPACE); - _vm->_gameSys->removeSpriteDrawItem(_vm->_largeSprite, 300); + gameSys.removeSpriteDrawItem(_vm->_largeSprite, 300); _vm->deleteSurface(&_vm->_largeSprite); _vm->showCursor(); } void Scene13::run() { + GameSys& gameSys = *_vm->_gameSys; int currSoundId = 0; _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 14) { _vm->initGnapPos(6, 6, kDirBottomLeft); @@ -1543,8 +1562,8 @@ void Scene13::run() { case TALK_CURSOR: if (_vm->_gnapX == 5 && _vm->_gnapY == 5) { _backToiletCtr = MIN(5, _backToiletCtr + 1); - _vm->_gameSys->setAnimation(_backToiletCtr + 0xA3, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(_backToiletCtr + 0xA3, _vm->_gnapId, + gameSys.setAnimation(_backToiletCtr + 0xA3, _vm->_gnapId, 0); + gameSys.insertSequence(_backToiletCtr + 0xA3, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqScale | kSeqSyncWait, 0, 0, 0); _vm->_gnapActionStatus = kAS13Wait; @@ -1742,8 +1761,10 @@ void Scene13::run() { } void Scene13::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS13LeaveScene: _vm->_sceneDone = true; @@ -1751,7 +1772,7 @@ void Scene13::updateAnimations() { break; case kAS13BackToilet: _backToiletCtr = MIN(5, _backToiletCtr + 1); - _vm->_gameSys->insertSequence(_backToiletCtr + 0xA3, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 9, 0, 0, 0); + gameSys.insertSequence(_backToiletCtr + 0xA3, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 9, 0, 0, 0); _vm->_gnapSequenceId = _backToiletCtr + 0xA3; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = -1; @@ -1765,9 +1786,9 @@ void Scene13::updateAnimations() { showScribble(); break; case kAS13GrabSink: - _vm->_gameSys->setAnimation(0xAB, 160, 0); - _vm->_gameSys->insertSequence(0xAB, 160, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(0xAA, 256, true); + gameSys.setAnimation(0xAB, 160, 0); + gameSys.insertSequence(0xAB, 160, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.removeSequence(0xAA, 256, true); _vm->_gnapSequenceId = 0xAB; _vm->_gnapId = 160; _vm->_gnapIdleFacing = kDirBottomRight; @@ -1778,15 +1799,15 @@ void Scene13::updateAnimations() { _vm->_gnapActionStatus = kAS13GrabSinkDone; break; case kAS13GrabSinkDone: - _vm->_gameSys->insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapActionStatus = -1; break; case kAS13Wait: _vm->_gnapActionStatus = -1; break; case kAS13GrabUrinal: - _vm->_gameSys->setAnimation(0xA2, 120, 0); - _vm->_gameSys->insertSequence(0xA2, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0xA2, 120, 0); + gameSys.insertSequence(0xA2, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0xA2; _vm->_gnapId = 120; _vm->_gnapIdleFacing = kDirBottomLeft; @@ -1799,8 +1820,8 @@ void Scene13::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); _vm->_platypusActionStatus = -1; } } @@ -1811,8 +1832,10 @@ Scene14::Scene14(GnapEngine *vm) : Scene(vm) { } int Scene14::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); return 0x27; } @@ -1828,20 +1851,21 @@ void Scene14::updateHotspots() { } void Scene14::run() { - _vm->_largeSprite = nullptr; + GameSys& gameSys = *_vm->_gameSys; + _vm->_largeSprite = nullptr; _vm->queueInsertDeviceIcon(); if (!_vm->isFlag(kGFNeedleTaken)) - _vm->_gameSys->insertSequence(0x23, 10, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x23, 10, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); if (!_vm->isFlag(kGFNeedleTaken) && _vm->invHas(kItemTongs)) - _vm->_largeSprite = _vm->_gameSys->createSurface(1); + _vm->_largeSprite = gameSys.createSurface(1); if (!_vm->isFlag(kGFNeedleTaken)) { - _vm->_gameSys->insertSequence(0x24, 10, 0x23, 10, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x24, 10, 0x23, 10, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x24; _vm->_timers[2] = _vm->getRandom(40) + 50; } @@ -1872,8 +1896,8 @@ void Scene14::run() { _vm->setFlag(kGFNeedleTaken); _vm->setGrabCursorSprite(-1); _vm->hideCursor(); - _vm->_gameSys->setAnimation(0x26, 10, 0); - _vm->_gameSys->insertSequence(0x26, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x26, 10, 0); + gameSys.insertSequence(0x26, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playSound(0x108E9, false); } else { @@ -1882,15 +1906,15 @@ void Scene14::run() { _vm->playSound(0x108E9, false); break; case GRAB_CURSOR: - _vm->_gameSys->insertSequence(0x25, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x23, 10, 0x25, 10, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x25, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x23, 10, 0x25, 10, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x23; break; case TALK_CURSOR: _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); break; } } @@ -1898,7 +1922,7 @@ void Scene14::run() { case kHS14Toilet: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1909,7 +1933,7 @@ void Scene14::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); break; } } @@ -1924,7 +1948,7 @@ void Scene14::run() { _vm->checkGameKeys(); if (!_vm->isFlag(kGFNeedleTaken) && !_vm->_timers[2]) { - _vm->_gameSys->insertSequence(0x24, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x24, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x24; _vm->_timers[2] = _vm->getRandom(40) + 50; } @@ -1943,15 +1967,17 @@ void Scene14::run() { } void Scene14::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); - _vm->_gameSys->setAnimation(0x10843, 301, 1); - _vm->_gameSys->insertSequence(0x10843, 301, 0x26, 10, kSeqSyncWait, 0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); + gameSys.insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); + gameSys.setAnimation(0x10843, 301, 1); + gameSys.insertSequence(0x10843, 301, 0x26, 10, kSeqSyncWait, 0, 0, 0); } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); _vm->_sceneDone = true; _vm->_newSceneNum = 13; _vm->_grabCursorSpriteIndex = kItemQuarter; @@ -1997,6 +2023,8 @@ void Scene15::updateHotspots() { } void Scene15::run() { + GameSys& gameSys = *_vm->_gameSys; + _currSlotSequenceId = -1; _currUpperButtonSequenceId = -1; _currLowerButtonSequenceId = -1; @@ -2006,8 +2034,8 @@ void Scene15::run() { _currRecordSequenceId = 0xD5; _nextRecordSequenceId = -1; - _vm->_gameSys->setAnimation(0xD5, 1, 0); - _vm->_gameSys->insertSequence(_currRecordSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0xD5, 1, 0); + gameSys.insertSequence(_currRecordSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); _vm->queueInsertDeviceIcon(); @@ -2044,7 +2072,7 @@ void Scene15::run() { } else if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { _nextSlotSequenceId = 0xDB; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2055,7 +2083,7 @@ void Scene15::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); break; } } @@ -2063,7 +2091,7 @@ void Scene15::run() { case kHS15PlayButton: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2082,7 +2110,7 @@ void Scene15::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); break; } } @@ -2095,7 +2123,7 @@ void Scene15::run() { case kHS15Button5: case kHS15Button6: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2108,7 +2136,7 @@ void Scene15::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); break; } } @@ -2121,7 +2149,7 @@ void Scene15::run() { case kHS15ButtonE: case kHS15ButtonF: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2134,7 +2162,7 @@ void Scene15::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); break; } } @@ -2160,12 +2188,14 @@ void Scene15::run() { } void Scene15::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { if (_vm->_isLeavingScene) { _vm->_sceneDone = true; } else if (_nextSlotSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextSlotSequenceId, 1, 0); - _vm->_gameSys->insertSequence(_nextSlotSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(_nextSlotSequenceId, 1, 0); + gameSys.insertSequence(_nextSlotSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); _currSlotSequenceId = _nextSlotSequenceId; _nextSlotSequenceId = -1; switch (_currSlotSequenceId) { @@ -2199,18 +2229,18 @@ void Scene15::updateAnimations() { case 0xD8: case 0xDA: if (_currUpperButtonSequenceId != -1) { - _vm->_gameSys->removeSequence(_currUpperButtonSequenceId, 1, true); + gameSys.removeSequence(_currUpperButtonSequenceId, 1, true); _currUpperButtonSequenceId = -1; } if (_currLowerButtonSequenceId != -1) { - _vm->_gameSys->removeSequence(_currLowerButtonSequenceId, 1, true); + gameSys.removeSequence(_currLowerButtonSequenceId, 1, true); _currLowerButtonSequenceId = -1; } break; } } else if (_nextRecordSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextRecordSequenceId, 1, 0); - _vm->_gameSys->insertSequence(_nextRecordSequenceId, 1, _currRecordSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextRecordSequenceId, 1, 0); + gameSys.insertSequence(_nextRecordSequenceId, 1, _currRecordSequenceId, 1, kSeqSyncWait, 0, 0, 0); _currRecordSequenceId = _nextRecordSequenceId; _nextRecordSequenceId = -1; if (_currRecordSequenceId == 0xD3) { @@ -2218,16 +2248,16 @@ void Scene15::updateAnimations() { _vm->_newSceneNum = 16; _vm->_isLeavingScene = true; } - _vm->_gameSys->removeSequence(_currUpperButtonSequenceId, 1, true); + gameSys.removeSequence(_currUpperButtonSequenceId, 1, true); _currUpperButtonSequenceId = -1; - _vm->_gameSys->removeSequence(_currLowerButtonSequenceId, 1, true); + gameSys.removeSequence(_currLowerButtonSequenceId, 1, true); _currLowerButtonSequenceId = -1; } else if (_nextUpperButtonSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextUpperButtonSequenceId, 1, 0); + gameSys.setAnimation(_nextUpperButtonSequenceId, 1, 0); if (_currUpperButtonSequenceId == -1) - _vm->_gameSys->insertSequence(_nextUpperButtonSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(_nextUpperButtonSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(_nextUpperButtonSequenceId, 1, _currUpperButtonSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextUpperButtonSequenceId, 1, _currUpperButtonSequenceId, 1, kSeqSyncWait, 0, 0, 0); _currUpperButtonSequenceId = _nextUpperButtonSequenceId; _nextUpperButtonSequenceId = -1; if (_currLowerButtonSequenceId != -1 && _vm->isFlag(kGFUnk14)) { @@ -2237,11 +2267,11 @@ void Scene15::updateAnimations() { _nextRecordSequenceId = 0xD4; } } else if (_nextLowerButtonSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextLowerButtonSequenceId, 1, 0); + gameSys.setAnimation(_nextLowerButtonSequenceId, 1, 0); if (_currLowerButtonSequenceId == -1) - _vm->_gameSys->insertSequence(_nextLowerButtonSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(_nextLowerButtonSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(_nextLowerButtonSequenceId, 1, _currLowerButtonSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextLowerButtonSequenceId, 1, _currLowerButtonSequenceId, 1, kSeqSyncWait, 0, 0, 0); _currLowerButtonSequenceId = _nextLowerButtonSequenceId; _nextLowerButtonSequenceId = -1; if (_currUpperButtonSequenceId != -1 && _vm->isFlag(kGFUnk14)) { @@ -2302,6 +2332,7 @@ void Scene17::update() { } void Scene17::platHangUpPhone() { + GameSys& gameSys = *_vm->_gameSys; int savedGnapActionStatus = _vm->_gnapActionStatus; if (_vm->_platypusActionStatus == kAS17PlatPhoningAssistant) { @@ -2309,18 +2340,18 @@ void Scene17::platHangUpPhone() { _vm->updateMouseCursor(); _platPhoneCtr = 0; _vm->_platypusActionStatus = -1; - _vm->_gameSys->setAnimation(0x257, 254, 4); - _vm->_gameSys->insertSequence(0x257, 254, _currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(4) != 2) + gameSys.setAnimation(0x257, 254, 4); + gameSys.insertSequence(0x257, 254, _currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); + while (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); + gameSys.setAnimation(0x25B, _vm->_platypusId, 1); + gameSys.insertSequence(0x25B, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceId = 0x25B; _vm->_platypusSequenceDatNum = 0; _currPhoneSequenceId = -1; _nextPhoneSequenceId = -1; _vm->clearFlag(kGFPlatypusTalkingToAssistant); - while (_vm->_gameSys->getAnimationStatus(1) != 2) + while (gameSys.getAnimationStatus(1) != 2) _vm->gameUpdateTick(); _vm->_gnapActionStatus = savedGnapActionStatus; _vm->updateMouseCursor(); @@ -2329,6 +2360,8 @@ void Scene17::platHangUpPhone() { } void Scene17::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x10940, true); _vm->startSoundTimerA(8); _vm->_sceneWaiting = false; @@ -2339,23 +2372,23 @@ void Scene17::run() { _vm->_timers[7] = _vm->getRandom(100) + 100; if (_vm->isFlag(kGFTruckKeysUsed)) { - _vm->_gameSys->insertSequence(0x25F, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x25F, 20, 0, 0, kSeqNone, 0, 0, 0); } else { if (_vm->_s18GarbageCanPos >= 8) { - _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 97, 1); + gameSys.insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 97, 1); } else if (_vm->_s18GarbageCanPos >= 6) { - _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 68, 2); + gameSys.insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 68, 2); } else if (_vm->_s18GarbageCanPos >= 5) { - _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 23, -1); + gameSys.insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 23, -1); } else if (_vm->_s18GarbageCanPos >= 4) { - _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, -11, -5); + gameSys.insertSequence(0x260, 20, 0, 0, kSeqNone, 0, -11, -5); } else { - _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, -54, -8); + gameSys.insertSequence(0x260, 20, 0, 0, kSeqNone, 0, -54, -8); } } if (_vm->isFlag(kGFGroceryStoreHatTaken)) - _vm->_gameSys->insertSequence(0x262, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x262, 1, 0, 0, kSeqNone, 0, 0, 0); _vm->queueInsertDeviceIcon(); @@ -2367,22 +2400,22 @@ void Scene17::run() { _currCarWindowSequenceId = 0x244; if (_vm->isFlag(kGFUnk14)) - _vm->_gameSys->insertSequence(0x261, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x261, 1, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(_currWrenchSequenceId, 40, 2); - _vm->_gameSys->insertSequence(_currWrenchSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(_currWrenchSequenceId, 40, 2); + gameSys.insertSequence(_currWrenchSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFGrassTaken)) { - _vm->_gameSys->setAnimation(0, 0, 3); + gameSys.setAnimation(0, 0, 3); } else { - _vm->_gameSys->setAnimation(_currCarWindowSequenceId, 40, 3); - _vm->_gameSys->insertSequence(_currCarWindowSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(_currCarWindowSequenceId, 40, 3); + gameSys.insertSequence(_currCarWindowSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); } _canTryGetWrench = true; if (_vm->isFlag(kGFUnk18)) - _vm->_gameSys->insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); + 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) { @@ -2396,8 +2429,8 @@ void Scene17::run() { _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); + gameSys.insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x257, 254, 0, 0, kSeqNone, 0, 0, 0); _vm->_platypusSequenceId = 0x25A; _vm->_platypusSequenceDatNum = 0; _vm->endSceneInit(); @@ -2405,7 +2438,7 @@ void Scene17::run() { _vm->clearFlag(kGFUnk16); _vm->_platypusActionStatus = kAS17PlatPhoningAssistant; platHangUpPhone(); - _vm->_gameSys->setAnimation(0, 0, 4); + gameSys.setAnimation(0, 0, 4); _vm->clearFlag(kGFPlatypusTalkingToAssistant); _vm->clearFlag(kGFUnk27); updateHotspots(); @@ -2416,15 +2449,15 @@ void Scene17::run() { _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); + gameSys.insertSequence(601, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 601; _vm->_gnapActionStatus = kAS17GnapHangUpPhone; _vm->clearFlag(kGFUnk25); - _vm->_gameSys->insertSequence(0x251, 254, 0, 0, kSeqNone, 0, 0, 0); + 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); + gameSys.setAnimation(0x257, 254, 0); + gameSys.insertSequence(0x257, 254, 0x251, 254, kSeqSyncWait, 0, 0, 0); } else if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { _vm->clearFlag(kGFSpringTaken); _vm->clearFlag(kGFUnk16); @@ -2434,12 +2467,12 @@ void Scene17::run() { _vm->_platY = _vm->_hotspotsWalkPos[2].y; _vm->_platypusId = 20 * _vm->_hotspotsWalkPos[2].y; _currPhoneSequenceId = 0x251; - _vm->_gameSys->insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); _vm->_platypusSequenceId = 0x25A; _vm->_platypusSequenceDatNum = 0; _vm->endSceneInit(); - _vm->_gameSys->setAnimation(_currPhoneSequenceId, 254, 1); + gameSys.setAnimation(_currPhoneSequenceId, 254, 1); _vm->_platypusActionStatus = kAS17PlatPhoningAssistant; updateHotspots(); } else if (_vm->_prevSceneNum == 18) { @@ -2469,14 +2502,14 @@ void Scene17::run() { _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); + 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, + gameSys.insertSequence(0x241, 160, 0, 0, kSeqNone, 0, 0, 0); + 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); + gameSys.insertSequence(0x22C, 2, 0, 0, kSeqNone, 0, 0, 0); // TODO delayTicksA(2, 9); _vm->endSceneInit(); _vm->_platypusSequenceId = 0x7C1; @@ -2702,20 +2735,20 @@ void Scene17::run() { 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); + gameSys.insertSequence(0x22B, 21, 0, 0, kSeqNone, 0, 0, 0); } if (!_vm->_timers[7]) { _vm->_timers[7] = _vm->getRandom(100) + 100; if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { switch (_vm->getRandom(3)) { case 0: - _vm->_gameSys->insertSequence(0x25C, 255, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x25C, 255, 0, 0, kSeqNone, 0, 0, 0); break; case 1: - _vm->_gameSys->insertSequence(0x25D, 255, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x25D, 255, 0, 0, kSeqNone, 0, 0, 0); break; case 2: - _vm->_gameSys->insertSequence(0x25E, 255, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x25E, 255, 0, 0, kSeqNone, 0, 0, 0); break; } } @@ -2795,8 +2828,10 @@ void Scene17::updateAnimations() { 0x251, 0x252, 0x253, 0x254, 0x255, 0x256, 0x257 }; - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS17GetWrench1: _vm->_gnapActionStatus = kAS17GetWrenchGnapReady; @@ -2804,8 +2839,8 @@ void Scene17::updateAnimations() { case kAS17GetCoinFromPhone: _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); + gameSys.setAnimation(0x250, 100, 0); + gameSys.insertSequence(0x250, 100, 591, 100, kSeqSyncWait, 0, 0, 0); _vm->invAdd(kItemDiceQuarterHole); _vm->clearFlag(kGFUnk18); _vm->_gnapActionStatus = kAS17GetCoinFromPhoneDone; @@ -2815,8 +2850,8 @@ void Scene17::updateAnimations() { _vm->_gnapActionStatus = -1; break; case kAS17PutCoinIntoPhone: - _vm->_gameSys->setAnimation(0x24C, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x24C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x24C, _vm->_gnapId, 0); + 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); @@ -2825,17 +2860,17 @@ void Scene17::updateAnimations() { _vm->_gnapActionStatus = kAS17PutCoinIntoPhoneDone; break; case kAS17PutCoinIntoPhoneDone: - _vm->_gameSys->insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapActionStatus = -1; break; case kAS17GnapUsePhone: - _vm->_gameSys->setAnimation(0x24D, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x24D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x24D, _vm->_gnapId, 0); + gameSys.insertSequence(0x24D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapActionStatus = kAS17LeaveScene; _vm->_newSceneNum = 53; break; case kAS17GnapHangUpPhone: - _vm->_gameSys->insertSequence(0x258, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + 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; @@ -2846,8 +2881,8 @@ void Scene17::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); switch (_vm->_platypusActionStatus) { case kAS17TryGetWrench: _vm->_platypusActionStatus = -1; @@ -2870,8 +2905,8 @@ void Scene17::updateAnimations() { _vm->setGrabCursorSprite(kItemWrench); break; case kAS17PlatUsePhone: - _vm->_gameSys->setAnimation(0x24E, _vm->_platypusId, 1); - _vm->_gameSys->insertSequence(0x24E, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x24E, _vm->_platypusId, 1); + gameSys.insertSequence(0x24E, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceDatNum = 0; _vm->_platypusSequenceId = 0x24E; _vm->_platypusActionStatus = kAS17LeaveScene; @@ -2883,7 +2918,7 @@ void Scene17::updateAnimations() { _platPhoneCtr = 0; _nextPhoneSequenceId = -1; _currPhoneSequenceId = -1; - _vm->_gameSys->insertSequence(0x25B, _vm->_platypusId, 0x25A, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x25B, _vm->_platypusId, 0x25A, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceDatNum = 0; _vm->_platypusSequenceId = 0x25B; _vm->_platypusActionStatus = -1; @@ -2892,9 +2927,9 @@ void Scene17::updateAnimations() { updateHotspots(); } else { _nextPhoneSequenceId = kPlatPhoneSequenceIds[_platPhoneCtr]; - _vm->_gameSys->setAnimation(_nextPhoneSequenceId, 254, 1); - _vm->_gameSys->insertSequence(_nextPhoneSequenceId, 254, _currPhoneSequenceId, 254, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x25A, _vm->_platypusId, 0x25A, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextPhoneSequenceId, 254, 1); + gameSys.insertSequence(_nextPhoneSequenceId, 254, _currPhoneSequenceId, 254, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x25A, _vm->_platypusId, 0x25A, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceDatNum = 0; _vm->_platypusSequenceId = 0x25A; _currPhoneSequenceId = _nextPhoneSequenceId; @@ -2906,42 +2941,42 @@ void Scene17::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { + if (gameSys.getAnimationStatus(2) == 2) { switch (_nextWrenchSequenceId) { case 0x233: _vm->_gnapActionStatus = -1; - _vm->_gameSys->insertSequence(0x243, _vm->_platypusId, + gameSys.insertSequence(0x243, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currWrenchSequenceId = _nextWrenchSequenceId; _nextWrenchSequenceId = -1; _vm->_platypusSequenceId = 0x243; _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x243, _vm->_platypusId, 1); + gameSys.setAnimation(0x243, _vm->_platypusId, 1); break; case 0x234: _vm->_gnapActionStatus = -1; - _vm->_gameSys->insertSequence(0x242, _vm->_platypusId, + gameSys.insertSequence(0x242, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currWrenchSequenceId = _nextWrenchSequenceId; _nextWrenchSequenceId = -1; _vm->_platypusSequenceId = 0x242; _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x242, _vm->_platypusId, 1); + gameSys.setAnimation(0x242, _vm->_platypusId, 1); break; case 0x231: if (_vm->getRandom(2) != 0) _nextCarWindowSequenceId = 0x245; else _nextCarWindowSequenceId = 0x248; - _vm->_gameSys->setAnimation(0, 0, 2); + gameSys.setAnimation(0, 0, 2); break; case 0x232: _nextCarWindowSequenceId = 0x247; - _vm->_gameSys->setAnimation(0, 0, 2); + gameSys.setAnimation(0, 0, 2); break; case 0x22E: case 0x235: @@ -2950,22 +2985,22 @@ void Scene17::updateAnimations() { else _vm->_hotspots[kHS17Wrench]._flags |= SF_DISABLED; _canTryGetWrench = !_canTryGetWrench; - _vm->_gameSys->setAnimation(_nextWrenchSequenceId, 40, 2); - _vm->_gameSys->insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextWrenchSequenceId, 40, 2); + gameSys.insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currWrenchSequenceId = _nextWrenchSequenceId; _nextWrenchSequenceId = -1; break; case 0x230: if (_vm->_gnapActionStatus == kAS17GetWrenchGnapReady) { - _vm->_gameSys->setAnimation(0, 0, 2); + gameSys.setAnimation(0, 0, 2); if (_canTryGetWrench) { - _vm->_gameSys->insertSequence(0x22E, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x22E, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currWrenchSequenceId = 0x22E; _canTryGetWrench = false; } - _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, + gameSys.setAnimation(0x23F, _vm->_platypusId, 1); + gameSys.insertSequence(0x10875, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x23F, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceDatNum = 1; @@ -2978,8 +3013,8 @@ void Scene17::updateAnimations() { break; default: if (_nextWrenchSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextWrenchSequenceId, 40, 2); - _vm->_gameSys->insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextWrenchSequenceId, 40, 2); + gameSys.insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currWrenchSequenceId = _nextWrenchSequenceId; _nextWrenchSequenceId = -1; } @@ -2987,51 +3022,51 @@ void Scene17::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { switch (_nextCarWindowSequenceId) { case 0x246: - _vm->_gameSys->setAnimation(_nextCarWindowSequenceId, 40, 3); - _vm->_gameSys->insertSequence(_nextCarWindowSequenceId, 40, _currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextCarWindowSequenceId, 40, 3); + gameSys.insertSequence(_nextCarWindowSequenceId, 40, _currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currCarWindowSequenceId = _nextCarWindowSequenceId; _nextCarWindowSequenceId = -1; break; case 0x245: case 0x247: case 0x248: - _vm->_gameSys->setAnimation(_nextWrenchSequenceId, 40, 2); - _vm->_gameSys->insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(2) != 2) + gameSys.setAnimation(_nextWrenchSequenceId, 40, 2); + gameSys.insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (gameSys.getAnimationStatus(2) != 2) update(); - _vm->_gameSys->setAnimation(_nextCarWindowSequenceId, 40, 3); - _vm->_gameSys->insertSequence(_nextCarWindowSequenceId, 40, _currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextCarWindowSequenceId, 40, 3); + gameSys.insertSequence(_nextCarWindowSequenceId, 40, _currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currCarWindowSequenceId = _nextCarWindowSequenceId; _nextCarWindowSequenceId = -1; _currWrenchSequenceId = _nextWrenchSequenceId; _nextWrenchSequenceId = -1; break; case 0x249: - _vm->_gameSys->setAnimation(0x230, 40, 2); - _vm->_gameSys->setAnimation(0x240, _vm->_platypusId, 1); - _vm->_gameSys->insertSequence(0x230, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(_nextCarWindowSequenceId, 40, _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); + gameSys.setAnimation(0x230, 40, 2); + gameSys.setAnimation(0x240, _vm->_platypusId, 1); + gameSys.insertSequence(0x230, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextCarWindowSequenceId, 40, _currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x240, _vm->_platypusId, _vm->_platypusSequenceId, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + 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, _nextCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(2) != 2) { + gameSys.setAnimation(0x24A, 40, 3); + gameSys.insertSequence(0x24A, 40, _nextCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (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); + if (gameSys.getAnimationStatus(3) == 2) { + gameSys.setAnimation(0x24A, 40, 3); + gameSys.insertSequence(0x24A, 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); + 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); _currCarWindowSequenceId = 0x24B; _nextCarWindowSequenceId = -1; _currWrenchSequenceId = 0x22D; @@ -3131,6 +3166,8 @@ void Scene18::gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, 0x203, 0x204 }; + GameSys& gameSys = *_vm->_gameSys; + int gnapSeqId, gnapId, gnapDatNum, gnapGridX; int clippedX, v12, v5, v10, v11, direction; @@ -3186,7 +3223,7 @@ void Scene18::gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, if (_vm->isPointBlocked(gnapGridX + direction, _vm->_gnapY)) break; a2 += direction; - _vm->_gameSys->insertSequence(kSequenceIds[seqId], a2, + gameSys.insertSequence(kSequenceIds[seqId], a2, gnapSeqId | (gnapDatNum << 16), gnapId, kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); gnapSeqId = kSequenceIds[seqId]; @@ -3215,9 +3252,9 @@ void Scene18::gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, _vm->_gnapId = 20 * _vm->_gnapY + 1; if (animationIndex >= 0) - _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, animationIndex); + gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, animationIndex); - _vm->_gameSys->insertSequence(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + gameSys.insertSequence(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, gnapSeqId | (gnapDatNum << 16), gnapId, kSeqScale | kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); @@ -3226,8 +3263,10 @@ void Scene18::gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, } void Scene18::putDownGarbageCan(int animationIndex) { + GameSys& gameSys = *_vm->_gameSys; + if (animationIndex >= 0) { - while (_vm->_gameSys->getAnimationStatus(animationIndex) != 2) + while (gameSys.getAnimationStatus(animationIndex) != 2) _vm->gameUpdateTick(); } if (_vm->_gnapIdleFacing != kDirNone && _vm->_gnapIdleFacing != kDirBottomRight && _vm->_gnapIdleFacing != kDirUpRight) @@ -3237,37 +3276,39 @@ void Scene18::putDownGarbageCan(int animationIndex) { _vm->clearFlag(kGFPlatyPussDisguised); updateHotspots(); if (_vm->_gnapIdleFacing != kDirNone && _vm->_gnapIdleFacing != kDirBottomRight && _vm->_gnapIdleFacing != kDirUpRight) { - _vm->_gameSys->insertSequence(0x107BA, _vm->_gnapId, + gameSys.insertSequence(0x107BA, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7BA; } else { - _vm->_gameSys->insertSequence(0x107B9, _vm->_gnapId, + gameSys.insertSequence(0x107B9, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7B9; } _vm->_gnapSequenceDatNum = 1; - _vm->_gameSys->insertSequence(0x1FB, 19, 0, 0, kSeqNone, 0, 15 * (5 * _vm->_s18GarbageCanPos - 40), 0); - _vm->_gameSys->setAnimation(0x1FA, 19, 4); - _vm->_gameSys->insertSequence(0x1FA, 19, 507, 19, kSeqSyncWait, 0, 15 * (5 * _vm->_s18GarbageCanPos - 40), 0); - while (_vm->_gameSys->getAnimationStatus(4) != 2) + gameSys.insertSequence(0x1FB, 19, 0, 0, kSeqNone, 0, 15 * (5 * _vm->_s18GarbageCanPos - 40), 0); + gameSys.setAnimation(0x1FA, 19, 4); + gameSys.insertSequence(0x1FA, 19, 507, 19, kSeqSyncWait, 0, 15 * (5 * _vm->_s18GarbageCanPos - 40), 0); + while (gameSys.getAnimationStatus(4) != 2) _vm->gameUpdateTick(); } void Scene18::platEndPhoning(bool platFl) { + GameSys& gameSys = *_vm->_gameSys; + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { _platPhoneIter = 0; _platPhoneCtr = 0; _vm->_platypusActionStatus = -1; if (_currPhoneSequenceId != -1) { - _vm->_gameSys->setAnimation(0x21E, 254, 3); - _vm->_gameSys->insertSequence(0x21E, 254, _currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(3) != 2) + gameSys.setAnimation(0x21E, 254, 3); + gameSys.insertSequence(0x21E, 254, _currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); + while (gameSys.getAnimationStatus(3) != 2) _vm->gameUpdateTick(); } - _vm->_gameSys->removeSequence(0x21F, 254, true); - _vm->_gameSys->setAnimation(0, 0, 3); + gameSys.removeSequence(0x21F, 254, true); + gameSys.setAnimation(0, 0, 3); _vm->clearFlag(kGFPlatypusTalkingToAssistant); if (platFl) { _vm->_platypusActionStatus = kAS18PlatComesHere; @@ -3307,37 +3348,36 @@ void Scene18::waitForGnapAction() { } void Scene18::run() { + GameSys& gameSys = *_vm->_gameSys; + _cowboyHatSurface = nullptr; _vm->playSound(0x10940, true); _vm->startSoundTimerA(4); - _vm->_timers[5] = _vm->getRandom(100) + 100; - _vm->queueInsertDeviceIcon(); - _vm->clearFlag(kGFPlatyPussDisguised); if (!_vm->isFlag(kGFUnk14)) - _vm->_gameSys->insertSequence(0x1F8, 19, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x1F8, 19, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFTruckKeysUsed)) { if (_vm->isFlag(kGFTruckFilledWithGas)) { - _vm->_gameSys->insertSequence(0x214, 39, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x20D, 39, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x214, 39, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x20D, 39, 0, 0, kSeqLoop, 0, 0, 0); _vm->playSound(0x22B, true); } else { - _vm->_gameSys->insertSequence(0x1F9, 19, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x1F9, 19, 0, 0, kSeqNone, 0, 0, 0); } } else { - _vm->_gameSys->insertSequence(0x1FA, 19, 0, 0, kSeqNone, 0, 15 * (5 * _vm->_s18GarbageCanPos - 40), 0); + gameSys.insertSequence(0x1FA, 19, 0, 0, kSeqNone, 0, 15 * (5 * _vm->_s18GarbageCanPos - 40), 0); if (_vm->isFlag(kGFTruckFilledWithGas)) { - _vm->_gameSys->insertSequence(0x212, 39, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x20D, 39, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x212, 39, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x20D, 39, 0, 0, kSeqLoop, 0, 0, 0); _vm->playSound(0x22B, true); } else if (_vm->isFlag(kGFBarnPadlockOpen)) { - _vm->_gameSys->insertSequence(0x20E, 39, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x217, 39, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x20E, 39, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x217, 39, 0, 0, kSeqLoop, 0, 0, 0); _vm->playSound(0x22B, true); } } @@ -3349,7 +3389,7 @@ void Scene18::run() { _vm->initGnapPos(4, 7, kDirBottomRight); _platPhoneCtr = _vm->getRandom(5); if (_vm->isFlag(kGFUnk27)) { - _vm->_gameSys->insertSequence(0x21E, 254, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x21E, 254, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); _currPhoneSequenceId = -1; platEndPhoning(true); @@ -3357,15 +3397,15 @@ void Scene18::run() { } else { _currPhoneSequenceId = kScene18SequenceIds[_platPhoneCtr]; _platPhoneIter = 0; - _vm->_gameSys->insertSequence(0x21F, 254, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x21F, 254, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); } if (_vm->isFlag(kGFUnk27)) { platEndPhoning(true); _vm->clearFlag(kGFUnk27); } else { - _vm->_gameSys->setAnimation(_currPhoneSequenceId, 254, 3); + gameSys.setAnimation(_currPhoneSequenceId, 254, 3); } _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); } else { @@ -3741,9 +3781,9 @@ void Scene18::run() { _vm->_timers[5] = _vm->getRandom(100) + 100; if (_vm->_gnapActionStatus < 0) { if (_vm->getRandom(2) == 1) - _vm->_gameSys->insertSequence(0x220, 255, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x220, 255, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(0x221, 255, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x221, 255, 0, 0, kSeqNone, 0, 0, 0); } } _vm->playSoundA(); @@ -3768,31 +3808,33 @@ void Scene18::run() { } void Scene18::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS18GrabGarbageCanFromStreet: if (_vm->_gnapIdleFacing != kDirUpRight && _vm->_gnapIdleFacing != kDirBottomRight) { - _vm->_gameSys->insertSequence(0x1FC, _vm->_gnapId, + gameSys.insertSequence(0x1FC, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - 675, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x1FC; } else { - _vm->_gameSys->insertSequence(0x1FD, _vm->_gnapId, + gameSys.insertSequence(0x1FD, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - 525, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x1FD; } - _vm->_gameSys->removeSequence(0x1FA, 19, true); + gameSys.removeSequence(0x1FA, 19, true); _vm->setFlag(kGFPlatyPussDisguised); updateHotspots(); _vm->_gnapActionStatus = -1; break; case kAS18GrabGarbageCanFromHydrant: - _vm->_gameSys->insertSequence(0x1FE, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(0x1F9, 19, true); + gameSys.insertSequence(0x1FE, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.removeSequence(0x1F9, 19, true); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x1FE; _vm->clearFlag(kGFTruckKeysUsed); @@ -3801,10 +3843,10 @@ void Scene18::updateAnimations() { _vm->_gnapActionStatus = -1; break; case kAS18CloseRightValveNoGarbageCan: - _vm->_gameSys->insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(0x20D, 39, true); - _vm->_gameSys->removeSequence(0x212, 39, true); - _vm->_gameSys->removeSequence(0x211, 39, true); + gameSys.insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.removeSequence(0x20D, 39, true); + gameSys.removeSequence(0x212, 39, true); + gameSys.removeSequence(0x211, 39, true); _vm->stopSound(0x22B); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x205; @@ -3819,7 +3861,7 @@ void Scene18::updateAnimations() { updateHotspots(); _vm->playGnapPullOutDevice(2, 7); _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->insertSequence(0x20C, 19, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x20C, 19, 0, 0, kSeqNone, 0, 0, 0); _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 0, 0x107BB, 1); _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; @@ -3827,15 +3869,15 @@ void Scene18::updateAnimations() { break; case kAS18OpenTopValveDone: _vm->setGrabCursorSprite(-1); - _vm->_gameSys->insertSequence(0x208, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x216, 39, 0, 0, kSeqNone, 21, 0, 0); - _vm->_gameSys->removeSequence(0x20C, 19, true); - _vm->_gameSys->setAnimation(0x217, 39, 5); - _vm->_gameSys->insertSequence(0x217, 39, 0x216, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(5) != 2) + gameSys.insertSequence(0x208, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x216, 39, 0, 0, kSeqNone, 21, 0, 0); + gameSys.removeSequence(0x20C, 19, true); + gameSys.setAnimation(0x217, 39, 5); + gameSys.insertSequence(0x217, 39, 0x216, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); + while (gameSys.getAnimationStatus(5) != 2) _vm->gameUpdateTick(); _vm->playSound(0x22B, true); - _vm->_gameSys->insertSequence(0x20E, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x20E, 39, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x208; _vm->invRemove(kItemWrench); @@ -3843,10 +3885,10 @@ void Scene18::updateAnimations() { _vm->_gnapActionStatus = -1; break; case kAS18CloseTopValve: - _vm->_gameSys->insertSequence(0x206, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(0x20E, 39, true); - _vm->_gameSys->removeSequence(0x216, 39, true); - _vm->_gameSys->removeSequence(0x217, 39, true); + gameSys.insertSequence(0x206, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.removeSequence(0x20E, 39, true); + gameSys.removeSequence(0x216, 39, true); + gameSys.removeSequence(0x217, 39, true); _vm->stopSound(0x22B); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x206; @@ -3857,8 +3899,8 @@ void Scene18::updateAnimations() { _vm->_gnapActionStatus = -1; break; case kAS18GrabCowboyHat: - _vm->_gameSys->setAnimation(0x200, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x200, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x200, _vm->_gnapId, 0); + gameSys.insertSequence(0x200, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x200; _vm->_gnapActionStatus = kAS18GrabCowboyHatDone; @@ -3867,9 +3909,9 @@ void Scene18::updateAnimations() { _vm->hideCursor(); _vm->setGrabCursorSprite(-1); _cowboyHatSurface = _vm->addFullScreenSprite(0x1D2, 255); - _vm->_gameSys->setAnimation(0x218, 256, 0); - _vm->_gameSys->insertSequence(0x218, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) + gameSys.setAnimation(0x218, 256, 0); + gameSys.insertSequence(0x218, 256, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); _vm->_newSceneNum = 18; _vm->invAdd(kItemCowboyHat); @@ -3889,27 +3931,27 @@ void Scene18::updateAnimations() { case kAS18PutGarbageCanOnRunningHydrant: _vm->setFlag(kGFTruckKeysUsed); _vm->clearFlag(kGFPlatyPussDisguised); - _vm->_gameSys->requestRemoveSequence(0x211, 39); - _vm->_gameSys->requestRemoveSequence(0x212, 39); - _vm->_gameSys->insertSequence(0x210, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.requestRemoveSequence(0x211, 39); + gameSys.requestRemoveSequence(0x212, 39); + gameSys.insertSequence(0x210, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->stopSound(0x22B); - _vm->_gameSys->setAnimation(0x210, _vm->_gnapId, 0); + gameSys.setAnimation(0x210, _vm->_gnapId, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x210; _vm->_gnapActionStatus = kAS18PutGarbageCanOnRunningHydrant2; break; case kAS18PutGarbageCanOnRunningHydrant2: _vm->playSound(0x22B, true); - _vm->_gameSys->setAnimation(0x1FF, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x1FF, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x1FF, _vm->_gnapId, 0); + gameSys.insertSequence(0x1FF, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x1FF; _vm->_sceneWaiting = true; _vm->_gnapActionStatus = kAS18StandingOnHydrant; break; case kAS18StandingOnHydrant: - _vm->_gameSys->setAnimation(0x1FF, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x1FF, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x1FF, _vm->_gnapId, 0); + gameSys.insertSequence(0x1FF, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); break; case kAS18OpenRightValveNoGarbageCan: case kAS18OpenRightValveWithGarbageCan: @@ -3917,7 +3959,7 @@ void Scene18::updateAnimations() { updateHotspots(); _vm->playGnapPullOutDevice(2, 7); _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->insertSequence(0x20B, 19, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x20B, 19, 0, 0, kSeqNone, 0, 0, 0); _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 0, 0x107BA, 1); _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; @@ -3928,16 +3970,16 @@ void Scene18::updateAnimations() { break; case kAS18OpenRightValveWithGarbageCanDone: _vm->setGrabCursorSprite(-1); - _vm->_gameSys->insertSequence(0x207, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x213, 39, 0, 0, kSeqNone, 21, 0, 0); - _vm->_gameSys->requestRemoveSequence(0x1F9, 19); - _vm->_gameSys->removeSequence(0x20B, 19, true); - _vm->_gameSys->setAnimation(0x213, 39, 5); - _vm->_gameSys->insertSequence(0x214, 39, 0x213, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(5) != 2) + gameSys.insertSequence(0x207, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x213, 39, 0, 0, kSeqNone, 21, 0, 0); + gameSys.requestRemoveSequence(0x1F9, 19); + gameSys.removeSequence(0x20B, 19, true); + gameSys.setAnimation(0x213, 39, 5); + gameSys.insertSequence(0x214, 39, 0x213, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); + while (gameSys.getAnimationStatus(5) != 2) _vm->gameUpdateTick(); _vm->playSound(555, true); - _vm->_gameSys->insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x207; _vm->invRemove(kItemWrench); @@ -3945,31 +3987,31 @@ void Scene18::updateAnimations() { break; case kAS18OpenRightValveNoGarbageCanDone: _vm->setGrabCursorSprite(-1); - _vm->_gameSys->insertSequence(0x207, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x211, 39, 0, 0, kSeqNone, 21, 0, 0); - _vm->_gameSys->removeSequence(0x20B, 19, true); - _vm->_gameSys->setAnimation(0x211, 39, 5); - _vm->_gameSys->insertSequence(0x212, 39, 0x211, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(5) != 2) + gameSys.insertSequence(0x207, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x211, 39, 0, 0, kSeqNone, 21, 0, 0); + gameSys.removeSequence(0x20B, 19, true); + gameSys.setAnimation(0x211, 39, 5); + gameSys.insertSequence(0x212, 39, 0x211, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); + while (gameSys.getAnimationStatus(5) != 2) _vm->gameUpdateTick(); _vm->playSound(0x22B, true); - _vm->_gameSys->insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x207; _vm->invRemove(kItemWrench); _vm->_gnapActionStatus = -1; break; case kAS18CloseRightValveWithGarbageCan: - _vm->_gameSys->insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(0x20D, 39, true); - _vm->_gameSys->insertSequence(0x215, 39, 0x214, 39, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.removeSequence(0x20D, 39, true); + gameSys.insertSequence(0x215, 39, 0x214, 39, kSeqSyncWait, 0, 0, 0); _vm->stopSound(0x22B); - _vm->_gameSys->setAnimation(0x1F9, 19, 0); - _vm->_gameSys->insertSequence(0x1F9, 19, 0x215, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x1F9, 19, 0); + gameSys.insertSequence(0x1F9, 19, 0x215, 39, kSeqSyncWait, 0, 0, 0); _vm->clearFlag(kGFTruckFilledWithGas); _vm->invAdd(kItemWrench); _vm->setGrabCursorSprite(kItemWrench); - _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 517, _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + gameSys.insertSequence(0x107B5, _vm->_gnapId, 517, _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); updateHotspots(); _vm->_gnapSequenceDatNum = 1; _vm->_gnapSequenceId = 0x7B5; @@ -3981,29 +4023,29 @@ void Scene18::updateAnimations() { case kAS18PutGarbageCanOnHydrant: _vm->setFlag(kGFTruckKeysUsed); _vm->clearFlag(kGFPlatyPussDisguised); - _vm->_gameSys->insertSequence(0x20F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x20F, _vm->_gnapId, 0); + gameSys.insertSequence(0x20F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x20F, _vm->_gnapId, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x20F; _vm->_gnapActionStatus = kAS18PutGarbageCanOnHydrantDone; break; case kAS18PutGarbageCanOnHydrantDone: - _vm->_gameSys->insertSequence(0x1F9, 19, 0x20F, _vm->_gnapId, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x1F9, 19, 0x20F, _vm->_gnapId, kSeqNone, 0, 0, 0); updateHotspots(); _vm->_gnapActionStatus = -1; break; } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - _vm->_gameSys->setAnimation(0, 0, 3); + if (gameSys.getAnimationStatus(3) == 2) { + gameSys.setAnimation(0, 0, 3); ++_platPhoneIter; if (_platPhoneIter <= 4) { ++_platPhoneCtr; _nextPhoneSequenceId = kScene18SequenceIds[_platPhoneCtr % 5]; - _vm->_gameSys->setAnimation(_nextPhoneSequenceId, 254, 3); - _vm->_gameSys->insertSequence(_nextPhoneSequenceId, 254, _currPhoneSequenceId, 254, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x21F, 254, 0x21F, 254, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextPhoneSequenceId, 254, 3); + gameSys.insertSequence(_nextPhoneSequenceId, 254, _currPhoneSequenceId, 254, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x21F, 254, 0x21F, 254, kSeqSyncWait, 0, 0, 0); _currPhoneSequenceId = _nextPhoneSequenceId; } else { platEndPhoning(true); @@ -4067,24 +4109,25 @@ void Scene19::updateHotspots() { } void Scene19::run() { - _vm->queueInsertDeviceIcon(); + GameSys& gameSys = *_vm->_gameSys; + _vm->queueInsertDeviceIcon(); _toyGrabCtr = 0; - _pictureSurface = 0; + _pictureSurface = nullptr; - _vm->_gameSys->insertSequence(0x74, 254, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x75, 254, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x74, 254, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x75, 254, 0, 0, kSeqNone, 0, 0, 0); if (!_vm->isFlag(kGFPictureTaken)) - _vm->_gameSys->insertSequence(0x69, 19, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x69, 19, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { _vm->initGnapPos(3, 6, kDirBottomRight); _currShopAssistantSequenceId = kS19ShopAssistantSequenceIds[_vm->getRandom(5)]; _nextShopAssistantSequenceId = _currShopAssistantSequenceId; - _vm->_gameSys->setAnimation(_currShopAssistantSequenceId, 20, 4); - _vm->_gameSys->insertSequence(0x6E, 254, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(_currShopAssistantSequenceId, 20, 4); + gameSys.insertSequence(0x6E, 254, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); _shopAssistantCtr = 0; _vm->endSceneInit(); _vm->gnapWalkTo(4, 9, -1, 0x107B9, 1); @@ -4092,8 +4135,8 @@ void Scene19::run() { } else { _currShopAssistantSequenceId = 0x6D; _nextShopAssistantSequenceId = -1; - _vm->_gameSys->setAnimation(0x6D, 20, 4); - _vm->_gameSys->insertSequence(_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x6D, 20, 4); + gameSys.insertSequence(_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[6] = _vm->getRandom(40) + 50; _vm->initGnapPos(3, 6, kDirBottomRight); _vm->initPlatypusPos(4, 6, kDirNone); @@ -4308,8 +4351,10 @@ void Scene19::run() { } void Scene19::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS19UsePhone: _nextShopAssistantSequenceId = 0x67; @@ -4334,8 +4379,8 @@ void Scene19::updateAnimations() { case kAS19GrabPicture: _vm->playGnapPullOutDevice(6, 2); _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->setAnimation(0x68, 19, 0); - _vm->_gameSys->insertSequence(0x68, 19, 105, 19, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x68, 19, 0); + gameSys.insertSequence(0x68, 19, 105, 19, kSeqSyncWait, 0, 0, 0); _vm->invAdd(kItemPicture); _vm->setFlag(kGFPictureTaken); updateHotspots(); @@ -4345,9 +4390,9 @@ void Scene19::updateAnimations() { _vm->setGrabCursorSprite(-1); _vm->hideCursor(); _pictureSurface = _vm->addFullScreenSprite(0xF, 255); - _vm->_gameSys->setAnimation(0x61, 256, 0); - _vm->_gameSys->insertSequence(0x61, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) { + gameSys.setAnimation(0x61, 256, 0); + gameSys.insertSequence(0x61, 256, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(0) != 2) { // checkGameAppStatus(); _vm->gameUpdateTick(); } @@ -4368,7 +4413,7 @@ void Scene19::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(4) == 2) { + if (gameSys.getAnimationStatus(4) == 2) { switch (_nextShopAssistantSequenceId) { case 0x6F: case 0x70: @@ -4377,16 +4422,16 @@ void Scene19::updateAnimations() { case 0x73: _shopAssistantCtr = (_shopAssistantCtr + 1) % 5; _nextShopAssistantSequenceId = kS19ShopAssistantSequenceIds[_shopAssistantCtr]; - _vm->_gameSys->setAnimation(_nextShopAssistantSequenceId, 20, 4); - _vm->_gameSys->insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x6E, 254, 0x6E, 254, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextShopAssistantSequenceId, 20, 4); + gameSys.insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x6E, 254, 0x6E, 254, kSeqSyncWait, 0, 0, 0); _currShopAssistantSequenceId = _nextShopAssistantSequenceId; break; case 0x62: case 0x66: case 0x6B: - _vm->_gameSys->setAnimation(_nextShopAssistantSequenceId, 20, 4); - _vm->_gameSys->insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextShopAssistantSequenceId, 20, 4); + gameSys.insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); _currShopAssistantSequenceId = _nextShopAssistantSequenceId; _nextShopAssistantSequenceId = -1; _vm->_timers[5] = 10; @@ -4397,32 +4442,32 @@ void Scene19::updateAnimations() { _vm->_gnapActionStatus = -1; break; case 0x67: - _vm->_gameSys->setAnimation(_nextShopAssistantSequenceId, 20, 4); - _vm->_gameSys->insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextShopAssistantSequenceId, 20, 4); + gameSys.insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); _currShopAssistantSequenceId = _nextShopAssistantSequenceId; _nextShopAssistantSequenceId = -1; _vm->_gnapActionStatus = -1; break; case 0x65: _vm->playGnapIdle(6, 2); - _vm->_gameSys->setAnimation(_nextShopAssistantSequenceId, 20, 0); - _vm->_gameSys->insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextShopAssistantSequenceId, 20, 0); + gameSys.insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); _currShopAssistantSequenceId = _nextShopAssistantSequenceId; _nextShopAssistantSequenceId = -1; _vm->_newSceneNum = 18; _vm->_gnapActionStatus = kAS19LeaveScene; break; case 0x6D: - _vm->_gameSys->setAnimation(_nextShopAssistantSequenceId, 20, 4); - _vm->_gameSys->insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x69, 19, 0x69, 19, kSeqSyncWait, _vm->getSequenceTotalDuration(_nextShopAssistantSequenceId), 0, 0); + gameSys.setAnimation(_nextShopAssistantSequenceId, 20, 4); + gameSys.insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x69, 19, 0x69, 19, kSeqSyncWait, _vm->getSequenceTotalDuration(_nextShopAssistantSequenceId), 0, 0); _currShopAssistantSequenceId = _nextShopAssistantSequenceId; _nextShopAssistantSequenceId = -1; break; case 0x64: case 0x6C: - _vm->_gameSys->setAnimation(_nextShopAssistantSequenceId, 20, 4); - _vm->_gameSys->insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextShopAssistantSequenceId, 20, 4); + gameSys.insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); _currShopAssistantSequenceId = _nextShopAssistantSequenceId; _nextShopAssistantSequenceId = -1; break; @@ -4430,5 +4475,4 @@ void Scene19::updateAnimations() { } } - } // End of namespace Gnap diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 98b6752afe..df3fbf4a83 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -54,12 +54,14 @@ void Scene20::updateHotspots() { } void Scene20::updateAnimationsCb() { - if (_vm->_gameSys->getAnimationStatus(2) == 2) { + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(2) == 2) { switch (_nextStonerGuySequenceId) { case 0x16B: if (!_vm->_timers[4]) { _stonerGuyShowingJoint = false; - _vm->_gameSys->insertSequence(0x16B, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x16B, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = 0x16B; _nextStonerGuySequenceId = -1; } @@ -68,8 +70,8 @@ void Scene20::updateAnimationsCb() { // Grab joint _vm->playGnapPullOutDevice(4, 4); _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->setAnimation(0x16A, 21, 0); - _vm->_gameSys->insertSequence(0x16A, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x16A, 21, 0); + gameSys.insertSequence(0x16A, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = 0x16A; _nextStonerGuySequenceId = -1; _vm->invAdd(kItemJoint); @@ -78,25 +80,25 @@ void Scene20::updateAnimationsCb() { _vm->_gnapActionStatus = kAS20GrabJointDone; break; case 0x16E: - _vm->_gameSys->setAnimation(0x16E, 21, 2); - _vm->_gameSys->insertSequence(0x16E, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x16E, 21, 2); + gameSys.insertSequence(0x16E, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = 0x16E; _nextStonerGuySequenceId = -1; _nextGroceryStoreGuySequenceId = 0x175; break; case 0x16D: - _vm->_gameSys->setAnimation(_nextStonerGuySequenceId, 21, 2); - _vm->_gameSys->setAnimation(_nextStonerGuySequenceId, 21, 0); - _vm->_gameSys->insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextStonerGuySequenceId, 21, 2); + gameSys.setAnimation(_nextStonerGuySequenceId, 21, 0); + gameSys.insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = _nextStonerGuySequenceId; _nextStonerGuySequenceId = -1; _vm->_gnapActionStatus = kAS20ActionDone; break; case 0x16F: - _vm->_gameSys->setAnimation(_nextStonerGuySequenceId, 21, 2); - _vm->_gameSys->setAnimation(0x17A, 20, 3); - _vm->_gameSys->insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x17A, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextStonerGuySequenceId, 21, 2); + gameSys.setAnimation(0x17A, 20, 3); + gameSys.insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x17A, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); _currGroceryStoreGuySequenceId = 0x17A; _nextGroceryStoreGuySequenceId = -1; _currStonerGuySequenceId = _nextStonerGuySequenceId; @@ -118,10 +120,10 @@ void Scene20::updateAnimationsCb() { _nextStonerGuySequenceId = 0x171; break; } - _vm->_gameSys->insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x17C, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x17C, 20, 3); - _vm->_gameSys->setAnimation(_nextStonerGuySequenceId, 21, 2); + gameSys.insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x17C, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x17C, 20, 3); + gameSys.setAnimation(_nextStonerGuySequenceId, 21, 2); _currGroceryStoreGuySequenceId = 0x17C; _nextGroceryStoreGuySequenceId = -1; _currStonerGuySequenceId = _nextStonerGuySequenceId; @@ -129,8 +131,8 @@ void Scene20::updateAnimationsCb() { break; default: _nextStonerGuySequenceId = 0x16C; - _vm->_gameSys->setAnimation(0x16C, 21, 2); - _vm->_gameSys->insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x16C, 21, 2); + gameSys.insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = _nextStonerGuySequenceId; _nextStonerGuySequenceId = -1; break; @@ -155,6 +157,8 @@ void Scene20::stopSounds() { } void Scene20::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x10940, true); _vm->startSoundTimerA(8); @@ -175,30 +179,30 @@ void Scene20::run() { } _nextStonerGuySequenceId = -1; - _vm->_gameSys->setAnimation(_currStonerGuySequenceId, 21, 2); - _vm->_gameSys->insertSequence(_currStonerGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(_currStonerGuySequenceId, 21, 2); + gameSys.insertSequence(_currStonerGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[6] = _vm->getRandom(20) + 30; _currGroceryStoreGuySequenceId = 0x17C; _nextGroceryStoreGuySequenceId = -1; - _vm->_gameSys->setAnimation(0x17C, 20, 3); - _vm->_gameSys->insertSequence(0x17C, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x17C, 20, 3); + gameSys.insertSequence(0x17C, 20, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[5] = _vm->getRandom(50) + 130; if (_vm->isFlag(kGFGroceryStoreHatTaken)) - _vm->_gameSys->insertSequence(0x17F, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x17F, 20, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(0x174, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x174, 20, 0, 0, kSeqNone, 0, 0, 0); _vm->queueInsertDeviceIcon(); if (_vm->isFlag(kGFSceneFlag1)) { _vm->clearFlag(kGFSceneFlag1); _vm->endSceneInit(); - _vm->_gameSys->setAnimation(0x182, 140, 0); - _vm->_gameSys->insertSequence(0x182, 140, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) { + gameSys.setAnimation(0x182, 140, 0); + gameSys.insertSequence(0x182, 140, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(0) != 2) { // checkGameAppStatus(); _vm->gameUpdateTick(); } @@ -484,13 +488,13 @@ void Scene20::run() { if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { switch (_vm->getRandom(3)) { case 0: - _vm->_gameSys->insertSequence(0x183, 253, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x183, 253, 0, 0, kSeqNone, 0, 0, 0); break; case 1: - _vm->_gameSys->insertSequence(0x184, 253, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x184, 253, 0, 0, kSeqNone, 0, 0, 0); break; case 2: - _vm->_gameSys->insertSequence(0x185, 253, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x185, 253, 0, 0, kSeqNone, 0, 0, 0); break; } } @@ -510,17 +514,19 @@ void Scene20::run() { } void Scene20::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS20LeaveScene: _vm->_sceneDone = true; break; case kAS20TalkStonerGuyNoJoint: - _vm->_gameSys->setAnimation(0x170, 21, 2); - _vm->_gameSys->setAnimation(0x17B, 20, 3); - _vm->_gameSys->insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + gameSys.setAnimation(0x170, 21, 2); + gameSys.setAnimation(0x17B, 20, 3); + gameSys.insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + gameSys.insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); _vm->stopSound(0x1A1); stopSounds(); _currGroceryStoreGuySequenceId = 0x17B; @@ -531,11 +537,11 @@ void Scene20::updateAnimations() { _vm->_timers[6] = 100; break; case kAS20TalkStonerGuyHasJoint: - _vm->_gameSys->setAnimation(0x168, 21, 2); - _vm->_gameSys->setAnimation(379, 20, 3); - _vm->_gameSys->insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x168, 21, 0x170, 21, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x168, 21, 2); + gameSys.setAnimation(379, 20, 3); + gameSys.insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + gameSys.insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + gameSys.insertSequence(0x168, 21, 0x170, 21, kSeqSyncWait, 0, 0, 0); _vm->stopSound(0x1A1); stopSounds(); _currGroceryStoreGuySequenceId = 0x17B; @@ -555,10 +561,10 @@ void Scene20::updateAnimations() { _vm->_gnapActionStatus = -1; break; case kAS20TalkGroceryStoreGuy: - _vm->_gameSys->setAnimation(0x170, 21, 2); - _vm->_gameSys->setAnimation(0x17B, 20, 3); - _vm->_gameSys->insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + gameSys.setAnimation(0x170, 21, 2); + gameSys.setAnimation(0x17B, 20, 3); + gameSys.insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + gameSys.insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); _vm->stopSound(0x1A1); stopSounds(); _currGroceryStoreGuySequenceId = 0x17B; @@ -572,10 +578,10 @@ void Scene20::updateAnimations() { _vm->_timers[6] = 100; break; case kAS20GrabGroceryStoreGuy: - _vm->_gameSys->setAnimation(0x170, 21, 2); - _vm->_gameSys->setAnimation(0x17B, 20, 3); - _vm->_gameSys->insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + gameSys.setAnimation(0x170, 21, 2); + gameSys.setAnimation(0x17B, 20, 3); + gameSys.insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + gameSys.insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); _vm->stopSound(0x1A1); stopSounds(); _currGroceryStoreGuySequenceId = 0x17B; @@ -585,10 +591,10 @@ void Scene20::updateAnimations() { _nextGroceryStoreGuySequenceId = 0x178; break; case kAS20GrabGroceryStoreHat: - _vm->_gameSys->setAnimation(0x170, 21, 2); - _vm->_gameSys->setAnimation(0x17B, 20, 3); - _vm->_gameSys->insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + gameSys.setAnimation(0x170, 21, 2); + gameSys.setAnimation(0x17B, 20, 3); + gameSys.insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + gameSys.insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); _vm->stopSound(0x1A1); stopSounds(); _currGroceryStoreGuySequenceId = 0x17B; @@ -597,8 +603,8 @@ void Scene20::updateAnimations() { break; case kAS20SwitchGroceryStoreHat: _vm->setGrabCursorSprite(-1); - _vm->_gameSys->setAnimation(0x180, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x180, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x180, _vm->_gnapId, 0); + gameSys.insertSequence(0x180, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x180; _vm->_gnapSequenceDatNum = 0; _vm->invRemove(kItemCowboyHat); @@ -606,14 +612,14 @@ void Scene20::updateAnimations() { _vm->_gnapActionStatus = kAS20SwitchGroceryStoreHatDone; break; case kAS20SwitchGroceryStoreHatDone: - _vm->_gameSys->insertSequence(0x17F, 20, 372, 20, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x17F, 20, 372, 20, kSeqSyncWait, 0, 0, 0); _vm->setFlag(kGFGroceryStoreHatTaken); _vm->hideCursor(); _vm->setGrabCursorSprite(-1); _vm->addFullScreenSprite(0x12C, 255); - _vm->_gameSys->setAnimation(0x181, 256, 0); - _vm->_gameSys->insertSequence(0x181, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) + gameSys.setAnimation(0x181, 256, 0); + gameSys.insertSequence(0x181, 256, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); _vm->removeFullScreenSprite(); _vm->showCursor(); @@ -629,41 +635,41 @@ void Scene20::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { switch (_nextGroceryStoreGuySequenceId) { case 0x176: case 0x177: - _vm->_gameSys->setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); - _vm->_gameSys->insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); + gameSys.insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); _currGroceryStoreGuySequenceId = _nextGroceryStoreGuySequenceId; _nextGroceryStoreGuySequenceId = -1; _nextStonerGuySequenceId = 0x16D; break; case 0x178: - _vm->_gameSys->setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); - _vm->_gameSys->setAnimation(0x17D, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x17D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); + gameSys.setAnimation(0x17D, _vm->_gnapId, 0); + gameSys.insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x17D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x17D; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = kAS20ActionDone; - _vm->_gameSys->setAnimation(0x16D, 21, 2); - _vm->_gameSys->insertSequence(0x16D, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x16D, 21, 2); + gameSys.insertSequence(0x16D, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = 0x16D; _currGroceryStoreGuySequenceId = 0x178; _nextGroceryStoreGuySequenceId = -1; _nextStonerGuySequenceId = -1; break; case 0x179: - _vm->_gameSys->setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); - _vm->_gameSys->setAnimation(0x16D, 21, 0); - _vm->_gameSys->insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x17E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); + gameSys.setAnimation(0x16D, 21, 0); + gameSys.insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x17E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x17E; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = kAS20ActionDone; - _vm->_gameSys->setAnimation(0x16D, 21, 2); - _vm->_gameSys->insertSequence(0x16D, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x16D, 21, 2); + gameSys.insertSequence(0x16D, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = 0x16D; _currGroceryStoreGuySequenceId = 377; _nextGroceryStoreGuySequenceId = -1; @@ -671,25 +677,25 @@ void Scene20::updateAnimations() { _vm->gnapWalkTo(4, 8, -1, 0x107BB, 1); break; case 0x17C: - _vm->_gameSys->setAnimation(0, 0, 3); + gameSys.setAnimation(0, 0, 3); _nextStonerGuySequenceId = 0x171; break; case 0x17A: - _vm->_gameSys->setAnimation(0, 0, 3); + gameSys.setAnimation(0, 0, 3); _nextStonerGuySequenceId = 0x16F; break; case 0x175: - _vm->_gameSys->setAnimation(0x175, 20, 0); - _vm->_gameSys->setAnimation(0x175, 20, 3); - _vm->_gameSys->insertSequence(0x175, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x175, 20, 0); + gameSys.setAnimation(0x175, 20, 3); + gameSys.insertSequence(0x175, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); _currGroceryStoreGuySequenceId = 0x175; _nextGroceryStoreGuySequenceId = -1; _vm->_gnapActionStatus = kAS20ActionDone; break; default: if (_nextGroceryStoreGuySequenceId != -1) { - _vm->_gameSys->setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); - _vm->_gameSys->insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); + gameSys.insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); _currGroceryStoreGuySequenceId = _nextGroceryStoreGuySequenceId; _nextGroceryStoreGuySequenceId = -1; } @@ -709,6 +715,7 @@ Scene21::Scene21(GnapEngine *vm) : Scene(vm) { int Scene21::init() { _vm->_gameSys->setAnimation(0, 0, 3); + return _vm->isFlag(kGFTwigTaken) ? 0x94 : 0x93; } @@ -728,27 +735,27 @@ void Scene21::updateHotspots() { } void Scene21::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x10940, true); _vm->startSoundTimerA(6); - _vm->_timers[5] = _vm->getRandom(100) + 100; - _vm->queueInsertDeviceIcon(); if (_vm->isFlag(kGFTwigTaken)) { if (_vm->isFlag(kGFKeysTaken)) { _vm->initGnapPos(5, 8, kDirBottomRight); _vm->initPlatypusPos(6, 8, kDirNone); - _vm->_gameSys->insertSequence(0x8E, 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x8E, 2, 0, 0, kSeqNone, 0, 0, 0); if (!_vm->isFlag(kGFUnk04)) - _vm->_gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); _vm->clearFlag(kGFKeysTaken); } else { _vm->initGnapPos(5, 11, kDirBottomRight); _vm->initPlatypusPos(6, 11, kDirNone); if (!_vm->isFlag(kGFUnk04)) - _vm->_gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); @@ -757,8 +764,8 @@ void Scene21::run() { _vm->initGnapPos(5, 11, kDirBottomRight); _vm->initPlatypusPos(6, 11, kDirNone); _currOldLadySequenceId = 0x89; - _vm->_gameSys->setAnimation(0x89, 79, 3); - _vm->_gameSys->insertSequence(_currOldLadySequenceId, 79, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x89, 79, 3); + gameSys.insertSequence(_currOldLadySequenceId, 79, 0, 0, kSeqNone, 0, 0, 0); _nextOldLadySequenceId = -1; _vm->_timers[4] = _vm->getRandom(30) + 50; _vm->endSceneInit(); @@ -911,7 +918,7 @@ void Scene21::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(100) + 100; - _vm->_gameSys->insertSequence(0x92, 255, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x92, 255, 0, 0, kSeqNone, 0, 0, 0); } _vm->playSoundA(); } @@ -929,16 +936,18 @@ void Scene21::run() { } void Scene21::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS21TalkOldLady: _nextOldLadySequenceId = 0x8B; _vm->_gnapActionStatus = -1; break; case kAS21GrabBanana: - _vm->_gameSys->setAnimation(0x8C, 59, 0); - _vm->_gameSys->insertSequence(0x8C, 59, 141, 59, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x8C, 59, 0); + gameSys.insertSequence(0x8C, 59, 141, 59, kSeqSyncWait, 0, 0, 0); _vm->setFlag(kGFUnk04); _vm->invAdd(kItemBanana); updateHotspots(); @@ -953,8 +962,8 @@ void Scene21::updateAnimations() { _nextOldLadySequenceId = 0x87; break; case kAS21UseHatWithOldLady: - _vm->_gameSys->setAnimation(0x8F, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x8F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x8F, _vm->_gnapId, 0); + gameSys.insertSequence(0x8F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x8F; _vm->_gnapActionStatus = kAS21UseHatWithOldLadyDone; @@ -971,25 +980,25 @@ void Scene21::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _nextOldLadySequenceId != -1) { + if (gameSys.getAnimationStatus(3) == 2 && _nextOldLadySequenceId != -1) { if (_nextOldLadySequenceId == 0x87) { - _vm->_gameSys->setAnimation(_nextOldLadySequenceId, 79, 3); - _vm->_gameSys->insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x86, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextOldLadySequenceId, 79, 3); + gameSys.insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x86, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x86; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = -1; _currOldLadySequenceId = _nextOldLadySequenceId; _nextOldLadySequenceId = -1; } else if (_nextOldLadySequenceId == 0x91) { - _vm->_gameSys->setAnimation(0x91, 79, 0); - _vm->_gameSys->insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x91, 79, 0); + gameSys.insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); _vm->_gnapActionStatus = kAS21LeaveScene; _currOldLadySequenceId = _nextOldLadySequenceId; _nextOldLadySequenceId = -1; } else { - _vm->_gameSys->setAnimation(_nextOldLadySequenceId, 79, 3); - _vm->_gameSys->insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextOldLadySequenceId, 79, 3); + gameSys.insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); _currOldLadySequenceId = _nextOldLadySequenceId; _nextOldLadySequenceId = -1; } @@ -1019,13 +1028,15 @@ void Scene22::updateHotspots() { } void Scene22::run() { - _vm->_gameSys->insertSequence(0x5D, 254, 0, 0, kSeqNone, 0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.insertSequence(0x5D, 254, 0, 0, kSeqNone, 0, 0, 0); _currCashierSequenceId = 0x59; _nextCashierSequenceId = -1; - _vm->_gameSys->setAnimation(0x59, 1, 3); - _vm->_gameSys->insertSequence(_currCashierSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x59, 1, 3); + gameSys.insertSequence(_currCashierSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[6] = _vm->getRandom(30) + 20; @@ -1063,12 +1074,12 @@ void Scene22::run() { _caughtBefore = true; storeDetectiveSeqId = 0x54; } - _vm->_gameSys->waitForUpdate(); - _vm->_gameSys->requestClear1(); - _vm->_gameSys->drawSpriteToBackground(0, 0, 0x44); - _vm->_gameSys->setAnimation(storeDetectiveSeqId, 256, 4); - _vm->_gameSys->insertSequence(storeDetectiveSeqId, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(4) != 2) { + gameSys.waitForUpdate(); + gameSys.requestClear1(); + gameSys.drawSpriteToBackground(0, 0, 0x44); + gameSys.setAnimation(storeDetectiveSeqId, 256, 4); + gameSys.insertSequence(storeDetectiveSeqId, 256, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(4) != 2) { _vm->gameUpdateTick(); } _vm->_sceneDone = true; @@ -1224,8 +1235,10 @@ void Scene22::run() { } void Scene22::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS22LeaveScene: _vm->_sceneDone = true; @@ -1237,9 +1250,9 @@ void Scene22::updateAnimations() { _vm->_gnapActionStatus = -1; } - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _nextCashierSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextCashierSequenceId, 1, 3); - _vm->_gameSys->insertSequence(_nextCashierSequenceId, 1, _currCashierSequenceId, 1, kSeqSyncWait, 0, 0, 0); + if (gameSys.getAnimationStatus(3) == 2 && _nextCashierSequenceId != -1) { + gameSys.setAnimation(_nextCashierSequenceId, 1, 3); + gameSys.insertSequence(_nextCashierSequenceId, 1, _currCashierSequenceId, 1, kSeqSyncWait, 0, 0, 0); _currCashierSequenceId = _nextCashierSequenceId; _nextCashierSequenceId = -1; } @@ -1267,21 +1280,23 @@ void Scene23::updateHotspots() { } void Scene23::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->_timers[4] = _vm->getRandom(100) + 200; _vm->_timers[5] = _vm->getRandom(100) + 200; _currStoreClerkSequenceId = 0xB4; _nextStoreClerkSequenceId = -1; - _vm->_gameSys->setAnimation(0xB4, 1, 4); - _vm->_gameSys->insertSequence(_currStoreClerkSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0xB4, 1, 4); + gameSys.insertSequence(_currStoreClerkSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); _vm->queueInsertDeviceIcon(); _vm->initGnapPos(-1, 7, kDirBottomRight); _vm->initPlatypusPos(-2, 7, kDirNone); - _vm->_gameSys->insertSequence(0xBD, 255, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0xBF, 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xBD, 255, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xBF, 2, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); @@ -1290,7 +1305,7 @@ void Scene23::run() { _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); } else { _vm->gnapWalkTo(2, 7, 0, 0x107B9, 1); - while (_vm->_gameSys->getAnimationStatus(0) != 2) + while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); _vm->playSequences(0x48, 0xBA, 0xBB, 0xBC); _vm->setFlag(kGFUnk24); @@ -1408,14 +1423,14 @@ void Scene23::run() { _vm->_timers[4] = _vm->getRandom(100) + 200; switch (_vm->getRandom(4)) { case 0: - _vm->_gameSys->insertSequence(0xB7, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xB7, 256, 0, 0, kSeqNone, 0, 0, 0); break; case 1: - _vm->_gameSys->insertSequence(0xB8, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xB8, 256, 0, 0, kSeqNone, 0, 0, 0); break; case 2: case 3: - _vm->_gameSys->insertSequence(0xB9, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xB9, 256, 0, 0, kSeqNone, 0, 0, 0); break; } } @@ -1448,17 +1463,19 @@ void Scene23::run() { } void Scene23::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS23LookCereals: _vm->showFullScreenSprite(0x48); _vm->_gnapActionStatus = -1; break; case kAS23GrabCereals: - _vm->_gameSys->setAnimation(0xBE, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0xBE, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->requestRemoveSequence(0xBF, 2); + gameSys.setAnimation(0xBE, _vm->_gnapId, 0); + gameSys.insertSequence(0xBE, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.requestRemoveSequence(0xBF, 2); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0xBE; _vm->_gnapActionStatus = kAS23GrabCerealsDone; @@ -1473,7 +1490,7 @@ void Scene23::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(4) == 2 && _nextStoreClerkSequenceId == -1) { + if (gameSys.getAnimationStatus(4) == 2 && _nextStoreClerkSequenceId == -1) { switch (_vm->getRandom(8)) { case 0: case 1: @@ -1489,8 +1506,8 @@ void Scene23::updateAnimations() { _nextStoreClerkSequenceId = 0xB6; break; } - _vm->_gameSys->setAnimation(_nextStoreClerkSequenceId, 1, 4); - _vm->_gameSys->insertSequence(_nextStoreClerkSequenceId, 1, _currStoreClerkSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextStoreClerkSequenceId, 1, 4); + gameSys.insertSequence(_nextStoreClerkSequenceId, 1, _currStoreClerkSequenceId, 1, kSeqSyncWait, 0, 0, 0); _currStoreClerkSequenceId = _nextStoreClerkSequenceId; _nextStoreClerkSequenceId = -1; } @@ -1521,6 +1538,7 @@ void Scene24::updateHotspots() { } void Scene24::run() { + GameSys& gameSys = *_vm->_gameSys; int counter = 0; _vm->playSound(0x10940, true); @@ -1528,15 +1546,15 @@ void Scene24::run() { _vm->_timers[7] = _vm->getRandom(100) + 100; - _vm->_gameSys->insertSequence(0x2F, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x2F, 256, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[4] = _vm->getRandom(20) + 50; _vm->_timers[5] = _vm->getRandom(20) + 40; _vm->_timers[6] = _vm->getRandom(50) + 30; - _vm->_gameSys->insertSequence(0x36, 20, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x30, 20, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x35, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x36, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x30, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x35, 20, 0, 0, kSeqNone, 0, 0, 0); _currWomanSequenceId = 0x35; _girlSequenceId = 0x36; @@ -1651,12 +1669,12 @@ void Scene24::run() { _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 50; - _vm->_gameSys->insertSequence(0x37, 20, _girlSequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x37, 20, _girlSequenceId, 20, kSeqSyncWait, 0, 0, 0); _girlSequenceId = 0x37; } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(20) + 40; - _vm->_gameSys->insertSequence(0x31, 20, _boySequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x31, 20, _boySequenceId, 20, kSeqSyncWait, 0, 0, 0); _boySequenceId = 0x31; } if (!_vm->_timers[6]) { @@ -1673,20 +1691,20 @@ void Scene24::run() { _nextWomanSequenceId = 0x34; break; } - _vm->_gameSys->insertSequence(_nextWomanSequenceId, 20, _currWomanSequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextWomanSequenceId, 20, _currWomanSequenceId, 20, kSeqSyncWait, 0, 0, 0); _currWomanSequenceId = _nextWomanSequenceId; } if (!_vm->_timers[7]) { _vm->_timers[7] = _vm->getRandom(100) + 100; switch (_vm->getRandom(3)) { case 0: - _vm->_gameSys->insertSequence(0x38, 253, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x38, 253, 0, 0, kSeqNone, 0, 0, 0); break; case 1: - _vm->_gameSys->insertSequence(0x39, 253, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x39, 253, 0, 0, kSeqNone, 0, 0, 0); break; case 2: - _vm->_gameSys->insertSequence(0x3A, 253, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x3A, 253, 0, 0, kSeqNone, 0, 0, 0); break; } } @@ -1707,8 +1725,10 @@ void Scene24::run() { } void Scene24::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); if (_vm->_gnapActionStatus == kAS24LeaveScene) _vm->_sceneDone = true; _vm->_gnapActionStatus = -1; @@ -1745,23 +1765,25 @@ void Scene25::playAnims(int index) { if (index > 4) return; + GameSys& gameSys = *_vm->_gameSys; + _vm->hideCursor(); _vm->setGrabCursorSprite(-1); switch (index) { case 1: - _vm->_largeSprite = _vm->_gameSys->createSurface(0x25); + _vm->_largeSprite = gameSys.createSurface(0x25); break; case 2: - _vm->_largeSprite = _vm->_gameSys->createSurface(0x26); + _vm->_largeSprite = gameSys.createSurface(0x26); break; case 3: - _vm->_largeSprite = _vm->_gameSys->createSurface(0x27); + _vm->_largeSprite = gameSys.createSurface(0x27); break; case 4: - _vm->_largeSprite = _vm->_gameSys->createSurface(0x28); + _vm->_largeSprite = gameSys.createSurface(0x28); break; } - _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); + gameSys.insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); _vm->delayTicksCursor(5); while (!_vm->_mouseClickState._left && !_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) && !_vm->isKeyStatus1(Common::KEYCODE_SPACE) && !_vm->isKeyStatus1(29)) { @@ -1771,19 +1793,21 @@ void Scene25::playAnims(int index) { _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); _vm->clearKeyStatus1(29); _vm->clearKeyStatus1(Common::KEYCODE_SPACE); - _vm->_gameSys->removeSpriteDrawItem(_vm->_largeSprite, 300); + gameSys.removeSpriteDrawItem(_vm->_largeSprite, 300); _vm->delayTicksCursor(5); _vm->deleteSurface(&_vm->_largeSprite); _vm->showCursor(); } void Scene25::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x10940, true); _vm->startSoundTimerA(5); _currTicketVendorSequenceId = 0x52; - _vm->_gameSys->setAnimation(0x52, 39, 3); - _vm->_gameSys->insertSequence(_currTicketVendorSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x52, 39, 3); + gameSys.insertSequence(_currTicketVendorSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); _nextTicketVendorSequenceId = -1; _vm->_timers[4] = _vm->getRandom(20) + 20; @@ -2005,8 +2029,10 @@ void Scene25::run() { } void Scene25::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS25TalkTicketVendor: _nextTicketVendorSequenceId = (_vm->getRandom(2) == 1) ? 0x57 : 0x5F; @@ -2014,10 +2040,10 @@ void Scene25::updateAnimations() { break; case kAS25EnterCircusWihoutTicket: _nextTicketVendorSequenceId = 0x5E; - _vm->_gameSys->setAnimation(0x5E, 39, 0); - _vm->_gameSys->setAnimation(_nextTicketVendorSequenceId, 39, 3); - _vm->_gameSys->insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x60, 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x5E, 39, 0); + gameSys.setAnimation(_nextTicketVendorSequenceId, 39, 3); + gameSys.insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncExists, 0, 0, 0); + gameSys.insertSequence(0x60, 2, 0, 0, kSeqNone, 0, 0, 0); _currTicketVendorSequenceId = _nextTicketVendorSequenceId; _nextTicketVendorSequenceId = -1; _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; @@ -2033,8 +2059,8 @@ void Scene25::updateAnimations() { _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemTickets); _vm->setFlag(kGFNeedleTaken); - _vm->_gameSys->setAnimation(0x61, 40, 0); - _vm->_gameSys->insertSequence(0x61, 40, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x61, 40, 0); + gameSys.insertSequence(0x61, 40, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapActionStatus = kAS25ShowTicketToVendorDone; break; case kAS25ShowTicketToVendorDone: @@ -2046,15 +2072,15 @@ void Scene25::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { if (_nextTicketVendorSequenceId == 0x53) { - _vm->_gameSys->insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); _currTicketVendorSequenceId = _nextTicketVendorSequenceId; _nextTicketVendorSequenceId = -1; _vm->_gnapActionStatus = -1; } else if (_nextTicketVendorSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextTicketVendorSequenceId, 39, 3); - _vm->_gameSys->insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextTicketVendorSequenceId, 39, 3); + gameSys.insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); _currTicketVendorSequenceId = _nextTicketVendorSequenceId; _nextTicketVendorSequenceId = -1; } @@ -2086,13 +2112,15 @@ void Scene26::updateHotspots() { } void Scene26::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->startSoundTimerB(7); _vm->playSound(0x1093B, true); _currKidSequenceId = 0x5B; _nextKidSequenceId = -1; - _vm->_gameSys->setAnimation(0x5B, 160, 3); - _vm->_gameSys->insertSequence(_currKidSequenceId, 160, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x5B, 160, 3); + gameSys.insertSequence(_currKidSequenceId, 160, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[5] = _vm->getRandom(20) + 50; _vm->_timers[4] = _vm->getRandom(20) + 50; @@ -2100,10 +2128,10 @@ void Scene26::run() { _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(0x58, 40, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x5C, 40, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x5D, 40, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x5E, 40, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x58, 40, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x5C, 40, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x5D, 40, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x5E, 40, 0, 0, kSeqLoop, 0, 0, 0); if (_vm->_prevSceneNum == 25) { _vm->initGnapPos(-1, 8, kDirBottomRight); @@ -2234,11 +2262,11 @@ void Scene26::run() { } if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 130; - _vm->_gameSys->insertSequence(0x59, 40, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x59, 40, 0, 0, kSeqNone, 0, 0, 0); } if (!_vm->_timers[6]) { _vm->_timers[6] = _vm->getRandom(50) + 100; - _vm->_gameSys->insertSequence(0x5F, 40, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x5F, 40, 0, 0, kSeqNone, 0, 0, 0); } _vm->playSoundB(); } @@ -2256,16 +2284,18 @@ void Scene26::run() { } void Scene26::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); if (_vm->_gnapActionStatus == kAS26LeaveScene) _vm->_sceneDone = true; _vm->_gnapActionStatus = -1; } - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _nextKidSequenceId != -1) { - _vm->_gameSys->insertSequence(_nextKidSequenceId, 160, _currKidSequenceId, 160, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextKidSequenceId, 160, 3); + if (gameSys.getAnimationStatus(3) == 2 && _nextKidSequenceId != -1) { + gameSys.insertSequence(_nextKidSequenceId, 160, _currKidSequenceId, 160, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextKidSequenceId, 160, 3); _currKidSequenceId = _nextKidSequenceId; _nextKidSequenceId = -1; } @@ -2298,23 +2328,25 @@ void Scene27::updateHotspots() { } void Scene27::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x1093B, true); _vm->startSoundTimerB(4); _vm->_timers[7] = _vm->getRandom(100) + 300; _vm->queueInsertDeviceIcon(); if (!_vm->isFlag(kGFUnk13)) - _vm->_gameSys->insertSequence(0xD3, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xD3, 39, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_debugLevel == 4) _vm->startIdleTimer(6); - _vm->_gameSys->insertSequence(0xCB, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xCB, 39, 0, 0, kSeqNone, 0, 0, 0); _currJanitorSequenceId = 0xCB; _nextJanitorSequenceId = -1; - _vm->_gameSys->setAnimation(0xCB, 39, 3); + gameSys.setAnimation(0xCB, 39, 3); _vm->_timers[5] = _vm->getRandom(20) + 60; switch (_vm->_prevSceneNum) { @@ -2522,7 +2554,7 @@ void Scene27::run() { if (!_vm->_timers[7]) { _vm->_timers[7] = _vm->getRandom(100) + 300; if (_vm->_gnapActionStatus < 0) - _vm->_gameSys->insertSequence(0xD4, 120, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xD4, 120, 0, 0, kSeqNone, 0, 0, 0); } _vm->playSoundB(); } @@ -2540,8 +2572,10 @@ void Scene27::run() { } void Scene27::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS27TalkJanitor: switch (_vm->getRandom(3)) { @@ -2562,8 +2596,8 @@ void Scene27::updateAnimations() { _vm->_hotspots[kHS27Bucket]._flags = SF_DISABLED; _vm->invAdd(kItemEmptyBucket); _vm->setFlag(kGFUnk13); - _vm->_gameSys->setAnimation(0xD2, 39, 0); - _vm->_gameSys->insertSequence(0xD2, 39, 211, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0xD2, 39, 0); + gameSys.insertSequence(0xD2, 39, 211, 39, kSeqSyncWait, 0, 0, 0); _vm->_gnapActionStatus = kAS27GrabBucketDone; break; case kAS27GrabBucketDone: @@ -2575,9 +2609,9 @@ void Scene27::updateAnimations() { break; case kAS27TryEnterClownTent: _nextJanitorSequenceId = 0xD1; - _vm->_gameSys->insertSequence(0xD1, 39, _currJanitorSequenceId, 39, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 3); - _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 0); + gameSys.insertSequence(0xD1, 39, _currJanitorSequenceId, 39, kSeqSyncExists, 0, 0, 0); + gameSys.setAnimation(_nextJanitorSequenceId, 39, 3); + gameSys.setAnimation(_nextJanitorSequenceId, 39, 0); _currJanitorSequenceId = _nextJanitorSequenceId; _nextJanitorSequenceId = -1; _vm->_gnapActionStatus = kAS27TryEnterClownTentDone; @@ -2598,12 +2632,12 @@ void Scene27::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { switch (_nextJanitorSequenceId) { case -1: _nextJanitorSequenceId = 0xCB; - _vm->_gameSys->insertSequence(0xCB, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 3); + gameSys.insertSequence(0xCB, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextJanitorSequenceId, 39, 3); _currJanitorSequenceId = _nextJanitorSequenceId; _nextJanitorSequenceId = -1; break; @@ -2611,9 +2645,9 @@ void Scene27::updateAnimations() { case 0xCD: case 0xCE: _vm->_gnapActionStatus = -1; - _vm->_gameSys->insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 3); - _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 0); + gameSys.insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextJanitorSequenceId, 39, 3); + gameSys.setAnimation(_nextJanitorSequenceId, 39, 0); _currJanitorSequenceId = _nextJanitorSequenceId; _nextJanitorSequenceId = -1; break; @@ -2621,8 +2655,8 @@ void Scene27::updateAnimations() { // Show picture to janitor _vm->playGnapPullOutDevice(0, 0); _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 0); + gameSys.insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextJanitorSequenceId, 39, 0); _vm->_gnapActionStatus = kAS27EnterClownTent; _currJanitorSequenceId = _nextJanitorSequenceId; _nextJanitorSequenceId = -1; @@ -2632,8 +2666,8 @@ void Scene27::updateAnimations() { _vm->_newSceneNum = 28; break; default: - _vm->_gameSys->insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 3); + gameSys.insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextJanitorSequenceId, 39, 3); _currJanitorSequenceId = _nextJanitorSequenceId; _nextJanitorSequenceId = -1; break; @@ -2670,44 +2704,46 @@ void Scene28::updateHotspots() { } void Scene28::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x1093C, true); _nextClownSequenceId = -1; _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(0x124, 255, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x124, 255, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFUnk22)) - _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x112, 99, 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); + gameSys.setAnimation(0x11C, 39, 3); + 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); + gameSys.insertSequence(0x118, 59, 0, 0, kSeqNone, 0, 0, 0); _currClownSequenceId = 0x11C; } else { _currClownSequenceId = 0x11B; - _vm->_gameSys->setAnimation(0x11B, 39, 3); - _vm->_gameSys->insertSequence(_currClownSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x11B, 39, 3); + gameSys.insertSequence(_currClownSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[4] = _vm->getRandom(20) + 80; } _vm->initGnapPos(8, 8, kDirBottomLeft); _vm->initPlatypusPos(9, 8, kDirUnk4); _vm->endSceneInit(); } else { - _vm->_gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); + 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); _currClownSequenceId = 0x115; _vm->setFlag(kGFMudTaken); - _vm->_gameSys->setAnimation(0x115, 39, 3); - _vm->_gameSys->insertSequence(_currClownSequenceId, 39, 0x11B, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x115, 39, 3); + gameSys.insertSequence(_currClownSequenceId, 39, 0x11B, 39, kSeqSyncWait, 0, 0, 0); _nextClownSequenceId = -1; _vm->_timers[4] = _vm->getRandom(20) + 80; _vm->_gnapActionStatus = kAS28GnapWaiting; - while (_vm->_gameSys->getAnimationStatus(3) != 2) { + while (gameSys.getAnimationStatus(3) != 2) { _vm->gameUpdateTick(); _vm->updateMouseCursor(); } @@ -2906,8 +2942,10 @@ void Scene28::run() { } void Scene28::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS28UseBeerBucketWithClown: _vm->setFlag(kGFUnk22); @@ -2928,17 +2966,17 @@ void Scene28::updateAnimations() { case kAS28GrabHornSuccess: _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); + gameSys.setAnimation(0x117, 59, 0); + gameSys.insertSequence(0x117, 59, 280, 59, kSeqSyncWait, 0, 0, 0); _vm->_gnapActionStatus = kAS28GrabHornSuccessDone; break; case kAS28GrabHornSuccessDone: _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) + gameSys.setAnimation(0x120, 256, 0); + gameSys.insertSequence(0x120, 256, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); _vm->removeFullScreenSprite(); _vm->showCursor(); @@ -2950,8 +2988,8 @@ void Scene28::updateAnimations() { case kAS28GrabEmptyBucket: _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); + gameSys.setAnimation(0x111, 99, 0); + gameSys.insertSequence(0x111, 99, 274, 99, kSeqSyncWait, 0, 0, 0); _vm->_gnapActionStatus = kAS28GrabEmptyBucketDone; break; case kAS28GrabEmptyBucketDone: @@ -2962,10 +3000,10 @@ void Scene28::updateAnimations() { _vm->_gnapActionStatus = -1; break; case kAS28GrabHornFailsDone: - _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 281, 39, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + 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); + gameSys.insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); _currClownSequenceId = 0x11B; _nextClownSequenceId = -1; _vm->_gnapActionStatus = -1; @@ -2989,25 +3027,25 @@ void Scene28::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { switch (_nextClownSequenceId) { case 0x113: _vm->setGrabCursorSprite(-1); - _vm->_gameSys->setAnimation(_nextClownSequenceId, 39, 0); - _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_nextClownSequenceId), 0, 0); - _vm->_gameSys->insertSequence(_nextClownSequenceId, 39, _currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x11B, 39, _nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextClownSequenceId, 39, 0); + gameSys.insertSequence(0x112, 99, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_nextClownSequenceId), 0, 0); + gameSys.insertSequence(_nextClownSequenceId, 39, _currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x11B, 39, _nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); _currClownSequenceId = 0x11B; _nextClownSequenceId = -1; _vm->_gnapActionStatus = kAS28GnapWaiting; break; case 0x116: _vm->setGrabCursorSprite(-1); - _vm->_gameSys->setAnimation(_nextClownSequenceId, 39, 0); - _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_nextClownSequenceId), 0, 0); - _vm->_gameSys->insertSequence(_nextClownSequenceId, 39, _currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x11C, 39, _nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_nextClownSequenceId), 0, 0); + gameSys.setAnimation(_nextClownSequenceId, 39, 0); + gameSys.insertSequence(0x112, 99, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_nextClownSequenceId), 0, 0); + gameSys.insertSequence(_nextClownSequenceId, 39, _currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x11C, 39, _nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x118, 59, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_nextClownSequenceId), 0, 0); _currClownSequenceId = _nextClownSequenceId; _nextClownSequenceId = -1; _vm->_gnapActionStatus = kAS28GnapWaiting; @@ -3018,9 +3056,9 @@ void Scene28::updateAnimations() { _vm->_gnapActionStatus = -1; break; case 0x119: - _vm->_gameSys->insertSequence(_nextClownSequenceId, 39, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextClownSequenceId, 39, 0); - _vm->_gameSys->removeSequence(_currClownSequenceId, 39, true); + gameSys.insertSequence(_nextClownSequenceId, 39, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextClownSequenceId, 39, 0); + gameSys.removeSequence(_currClownSequenceId, 39, true); _vm->_gnapActionStatus = kAS28GrabHornFailsDone; _vm->_gnapSequenceId = _nextClownSequenceId; _vm->_gnapSequenceDatNum = 0; @@ -3028,8 +3066,8 @@ void Scene28::updateAnimations() { break; } if (_nextClownSequenceId != -1) { - _vm->_gameSys->insertSequence(_nextClownSequenceId, 39, _currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextClownSequenceId, 39, 3); + gameSys.insertSequence(_nextClownSequenceId, 39, _currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextClownSequenceId, 39, 3); _currClownSequenceId = _nextClownSequenceId; _nextClownSequenceId = -1; } @@ -3063,6 +3101,8 @@ void Scene29::updateHotspots() { } void Scene29::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x1093B, true); _vm->startSoundTimerB(6); _vm->queueInsertDeviceIcon(); @@ -3070,22 +3110,22 @@ void Scene29::run() { if (_vm->invHas(kItemHorn)) { _currMonkeySequenceId = 0xE8; _nextMonkeySequenceId = -1; - _vm->_gameSys->setAnimation(0xE8, 159, 4); - _vm->_gameSys->insertSequence(_currMonkeySequenceId, 159, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0xE8, 159, 4); + gameSys.insertSequence(_currMonkeySequenceId, 159, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); _currManSequenceId = 0xED; _nextManSequenceId = -1; - _vm->_gameSys->setAnimation(0xED, 39, 3); + gameSys.setAnimation(0xED, 39, 3); _vm->_timers[4] = _vm->getRandom(20) + 60; } else { - _vm->_gameSys->insertSequence(0xF4, 19, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 4); - _vm->_gameSys->insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 3); + gameSys.insertSequence(0xF4, 19, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0, 0, 4); + gameSys.insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0, 0, 3); } - _vm->_gameSys->insertSequence(0xF3, 39, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0xF5, 38, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0xF3, 39, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0xF5, 38, 0, 0, kSeqLoop, 0, 0, 0); if (_vm->_prevSceneNum == 27) { _vm->initGnapPos(12, 7, kDirBottomRight); @@ -3279,8 +3319,10 @@ void Scene29::run() { } void Scene29::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS29UseBananaWithMonkey: _nextMonkeySequenceId = 0xE5; @@ -3291,22 +3333,22 @@ void Scene29::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _nextManSequenceId != -1) { - _vm->_gameSys->insertSequence(_nextManSequenceId, 39, _currManSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextManSequenceId, 39, 3); + if (gameSys.getAnimationStatus(3) == 2 && _nextManSequenceId != -1) { + gameSys.insertSequence(_nextManSequenceId, 39, _currManSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextManSequenceId, 39, 3); _currManSequenceId = _nextManSequenceId; _nextManSequenceId = -1; } - if (_vm->_gameSys->getAnimationStatus(4) == 2) { + if (gameSys.getAnimationStatus(4) == 2) { if (_nextMonkeySequenceId == 0xE5) { - _vm->_gameSys->insertSequence(0xF2, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xF2, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0xF2; - _vm->_gameSys->setAnimation(0xE6, 159, 0); - _vm->_gameSys->setAnimation(0, 159, 4); - _vm->_gameSys->insertSequence(_nextMonkeySequenceId, 159, _currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xE6, 159, _nextMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0xE6, 159, 0); + gameSys.setAnimation(0, 159, 4); + gameSys.insertSequence(_nextMonkeySequenceId, 159, _currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xE6, 159, _nextMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); _vm->_gnapActionStatus = kAS29LeaveScene; _currMonkeySequenceId = 0xE6; _nextMonkeySequenceId = -1; @@ -3314,7 +3356,7 @@ void Scene29::updateAnimations() { while (_vm->_timers[5]) _vm->gameUpdateTick(); _vm->platypusWalkTo(0, 8, 1, 0x107CF, 1); - while (_vm->_gameSys->getAnimationStatus(1) != 2) + while (gameSys.getAnimationStatus(1) != 2) _vm->gameUpdateTick(); } else if (_nextMonkeySequenceId == -1) { switch (_vm->getRandom(6)) { @@ -3337,13 +3379,13 @@ void Scene29::updateAnimations() { _nextMonkeySequenceId = 0xE7; break; } - _vm->_gameSys->insertSequence(_nextMonkeySequenceId, 159, _currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextMonkeySequenceId, 159, 4); + gameSys.insertSequence(_nextMonkeySequenceId, 159, _currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextMonkeySequenceId, 159, 4); _currMonkeySequenceId = _nextMonkeySequenceId; _nextMonkeySequenceId = -1; } else { - _vm->_gameSys->insertSequence(_nextMonkeySequenceId, 159, _currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextMonkeySequenceId, 159, 4); + gameSys.insertSequence(_nextMonkeySequenceId, 159, _currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextMonkeySequenceId, 159, 4); _currMonkeySequenceId = _nextMonkeySequenceId; _nextMonkeySequenceId = -1; } diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index 6d31df8b8a..7526a9d71c 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -45,6 +45,7 @@ void Scene30::updateHotspots() { } void Scene30::run() { + GameSys& gameSys = *_vm->_gameSys; bool hasTakenPill = false; _vm->playSound(0x1093B, true); @@ -53,13 +54,13 @@ void Scene30::run() { _vm->queueInsertDeviceIcon(); if (_vm->isFlag(kGFUnk23)) - _vm->_gameSys->insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); if (!_vm->isFlag(kGFUnk13)) - _vm->_gameSys->insertSequence(0x107, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x107, 1, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[5] = _vm->getRandom(50) + 180; - _vm->_gameSys->insertSequence(0x101, 40, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x101, 40, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[4] = _vm->getRandom(100) + 300; _kidSequenceId = 0x101; @@ -177,11 +178,11 @@ void Scene30::run() { _vm->_timers[4] = _vm->getRandom(100) + 300; if (_vm->_gnapActionStatus < 0) { if (_vm->getRandom(5) == 1) { - _vm->_gameSys->insertSequence(0xFF, 40, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x100, 40, _kidSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xFF, 40, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x100, 40, _kidSequenceId, 40, kSeqSyncWait, 0, 0, 0); _kidSequenceId = 0x100; } else { - _vm->_gameSys->insertSequence(0xFE, 40, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xFE, 40, 0, 0, kSeqNone, 0, 0, 0); } } } @@ -189,9 +190,9 @@ void Scene30::run() { _vm->_timers[5] = _vm->getRandom(50) + 180; if (_vm->_gnapActionStatus < 0) { if (!_vm->isFlag(kGFUnk23) || hasTakenPill) - _vm->_gameSys->insertSequence(0x109, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x109, 20, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(0x108, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x108, 20, 0, 0, kSeqNone, 0, 0, 0); } } _vm->playSoundB(); @@ -210,16 +211,18 @@ void Scene30::run() { } void Scene30::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS30LeaveScene: _vm->_sceneDone = true; break; case kAS30UsePillMachine: _vm->setGrabCursorSprite(-1); - _vm->_gameSys->setAnimation(0x105, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x105, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x105, _vm->_gnapId, 0); + gameSys.insertSequence(0x105, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x105; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = kAS30UsePillMachine2; @@ -228,13 +231,13 @@ void Scene30::updateAnimations() { _vm->hideCursor(); _vm->setGrabCursorSprite(-1); _vm->addFullScreenSprite(0x3F, 255); - _vm->_gameSys->removeSequence(0x105, _vm->_gnapId, true); - _vm->_gameSys->setAnimation(0x102, 256, 0); - _vm->_gameSys->insertSequence(0x102, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) + gameSys.removeSequence(0x105, _vm->_gnapId, true); + gameSys.setAnimation(0x102, 256, 0); + gameSys.insertSequence(0x102, 256, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); - _vm->_gameSys->setAnimation(0x103, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x103, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x103, _vm->_gnapId, 0); + gameSys.insertSequence(0x103, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); _vm->removeFullScreenSprite(); _vm->showCursor(); _vm->_gnapActionStatus = kAS30UsePillMachine3; @@ -242,15 +245,15 @@ void Scene30::updateAnimations() { _vm->setFlag(kGFUnk23); break; case kAS30UsePillMachine3: - _vm->_gameSys->setAnimation(0x104, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x104, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, 0x103), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x104, _vm->_gnapId, 0); + gameSys.insertSequence(0x104, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, 0x103), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x104; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = kAS30UsePillMachine4; _vm->setGrabCursorSprite(kItemDiceQuarterHole); break; case kAS30UsePillMachine4: - _vm->_gameSys->insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS30PillMachine].x, _vm->_hotspotsWalkPos[kHS30PillMachine].y + 1, -1, 0x107BC, 1); _vm->_gnapActionStatus = -1; break; @@ -291,18 +294,19 @@ void Scene31::updateHotspots() { } void Scene31::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x1093B, true); _vm->startSoundTimerB(6); - _vm->queueInsertDeviceIcon(); _beerGuyDistracted = false; - _vm->_gameSys->insertSequence(0xFB, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xFB, 39, 0, 0, kSeqNone, 0, 0, 0); _currClerkSequenceId = 0xFB; _nextClerkSequenceId = -1; - _vm->_gameSys->setAnimation(0xFB, 39, 3); + gameSys.setAnimation(0xFB, 39, 3); _vm->_timers[4] = _vm->getRandom(20) + 60; _vm->_timers[5] = _vm->getRandom(50) + 180; @@ -411,7 +415,7 @@ void Scene31::run() { _vm->setGrabCursorSprite(-1); _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, -1, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y) | 0x10000, 1); _clerkMeasureMaxCtr += 5; - _vm->_gameSys->insertSequence(0xF8, 59, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xF8, 59, 0, 0, kSeqNone, 0, 0, 0); _vm->playGnapPullOutDevice(6, 8); _vm->playGnapUseDevice(0, 0); _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y, 0, 0x107BC, 1); @@ -508,9 +512,9 @@ void Scene31::run() { _vm->_timers[5] = _vm->getRandom(50) + 180; if (_vm->_gnapActionStatus < 0) { if (_vm->getRandom(2) != 0) - _vm->_gameSys->insertSequence(0x104, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x104, 20, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(0x103, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x103, 20, 0, 0, kSeqNone, 0, 0, 0); } } _vm->playSoundB(); @@ -529,15 +533,17 @@ void Scene31::run() { } void Scene31::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS31UseBeerBarrel: _nextClerkSequenceId = 0xFE; break; case kAS31FillEmptyBucketWithBeer: - _vm->_gameSys->setAnimation(0x102, 59, 0); - _vm->_gameSys->insertSequence(0x102, 59, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x102, 59, 0); + gameSys.insertSequence(0x102, 59, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapX = 5; _vm->_gnapY = 7; _vm->_gnapSequenceDatNum = 0; @@ -549,7 +555,7 @@ void Scene31::updateAnimations() { _vm->_gnapIdleFacing = kDirBottomLeft; _vm->playGnapPullOutDevice(0, 0); _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->insertSequence(0xF9, 59, 0xF8, 59, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xF9, 59, 0xF8, 59, kSeqSyncWait, 0, 0, 0); _vm->_gnapActionStatus = -1; _vm->invAdd(kItemBucketWithBeer); _vm->invRemove(kItemEmptyBucket); @@ -566,8 +572,8 @@ void Scene31::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); if (_vm->_platypusActionStatus == kAS31PlatMeasuringClown) { _vm->_sceneWaiting = true; _beerGuyDistracted = true; @@ -575,12 +581,12 @@ void Scene31::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { switch (_nextClerkSequenceId) { case 0xFA: - _vm->_gameSys->insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xFC, 39, _nextClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0xFC, 39, 3); + gameSys.insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xFC, 39, _nextClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0xFC, 39, 3); _currClerkSequenceId = 0xFC; _nextClerkSequenceId = 0xFC; _clerkMeasureCtr = 0; @@ -591,33 +597,33 @@ void Scene31::updateAnimations() { if (_vm->_gnapActionStatus != 5) _vm->_platypusActionStatus = -1; _vm->_timers[0] = 40; - _vm->_gameSys->insertSequence(0xFD, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xFD, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); _currClerkSequenceId = 0xFD; _nextClerkSequenceId = -1; if (_vm->_gnapActionStatus != kAS31FillEmptyBucketWithBeerDone && _vm->_gnapActionStatus != kAS31FillEmptyBucketWithBeer) _vm->_gnapActionStatus = -1; _beerGuyDistracted = false; _clerkMeasureMaxCtr = 3; - _vm->_gameSys->setAnimation(0xFD, 39, 3); + gameSys.setAnimation(0xFD, 39, 3); _vm->_sceneWaiting = false; } else { - _vm->_gameSys->insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); _currClerkSequenceId = _nextClerkSequenceId; _nextClerkSequenceId = 0xFC; - _vm->_gameSys->setAnimation(0xFC, 39, 3); + gameSys.setAnimation(0xFC, 39, 3); } break; case 0xFE: - _vm->_gameSys->insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextClerkSequenceId, 39, 3); + gameSys.insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextClerkSequenceId, 39, 3); _currClerkSequenceId = _nextClerkSequenceId; _nextClerkSequenceId = -1; _vm->_gnapActionStatus = -1; break; default: if (_nextClerkSequenceId != -1) { - _vm->_gameSys->insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextClerkSequenceId, 39, 3); + gameSys.insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextClerkSequenceId, 39, 3); _currClerkSequenceId = _nextClerkSequenceId; _nextClerkSequenceId = -1; } @@ -651,6 +657,8 @@ void Scene32::updateHotspots() { } void Scene32::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x1091C, true); _vm->startSoundTimerC(5); _vm->queueInsertDeviceIcon(); @@ -751,9 +759,9 @@ void Scene32::run() { if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 300; if (_vm->getRandom(2) != 0) - _vm->_gameSys->insertSequence(0x0E, 180, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x0E, 180, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(0x0D, 180, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x0D, 180, 0, 0, kSeqNone, 0, 0, 0); } _vm->playSoundC(); } @@ -770,8 +778,10 @@ void Scene32::run() { } void Scene32::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); if (_vm->_gnapActionStatus == kAS32LeaveScene) _vm->_sceneDone = true; } @@ -802,13 +812,15 @@ void Scene33::updateHotspots() { } void Scene33::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x1091C, true); _vm->startSoundTimerC(6); _vm->queueInsertDeviceIcon(); _currChickenSequenceId = 0x7E; - _vm->_gameSys->setAnimation(0x7E, 179, 2); - _vm->_gameSys->insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x7E, 179, 2); + gameSys.insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); _nextChickenSequenceId = -1; _vm->_timers[5] = _vm->getRandom(20) + 30; _vm->_timers[4] = _vm->getRandom(100) + 300; @@ -978,9 +990,9 @@ void Scene33::run() { if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 300; if (_vm->getRandom(2) != 0) - _vm->_gameSys->insertSequence(0x83, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x83, 256, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(0x82, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x82, 256, 0, 0, kSeqNone, 0, 0, 0); } if (!_vm->_timers[5] && _nextChickenSequenceId == -1 && _vm->_gnapActionStatus != kAS33TalkChicken && _vm->_gnapActionStatus != kAS33UseChicken) { if (_vm->getRandom(6) != 0) { @@ -1006,7 +1018,9 @@ void Scene33::run() { } void Scene33::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { switch (_vm->_gnapActionStatus) { case kAS33LeaveScene: _vm->_sceneDone = true; @@ -1019,12 +1033,12 @@ void Scene33::updateAnimations() { _vm->_timers[2] = 100; break; case kAS33UseChickenDone: - _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 0x81, 179, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + gameSys.insertSequence(0x107B5, _vm->_gnapId, 0x81, 179, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7B5; _vm->_gnapSequenceDatNum = 1; _currChickenSequenceId = 0x7E; - _vm->_gameSys->setAnimation(0x7E, 179, 2); - _vm->_gameSys->insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x7E, 179, 2); + gameSys.insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapActionStatus = -1; _vm->_timers[5] = 30; break; @@ -1034,24 +1048,24 @@ void Scene33::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { + if (gameSys.getAnimationStatus(2) == 2) { if (_nextChickenSequenceId == 0x81) { - _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 0); - _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(_currChickenSequenceId, 179, true); + gameSys.setAnimation(_nextChickenSequenceId, 179, 0); + gameSys.insertSequence(_nextChickenSequenceId, 179, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.removeSequence(_currChickenSequenceId, 179, true); _nextChickenSequenceId = -1; _currChickenSequenceId = -1; _vm->_gnapActionStatus = kAS33UseChickenDone; _vm->_timers[5] = 500; } else if (_nextChickenSequenceId == 0x7F) { - _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 2); - _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextChickenSequenceId, 179, 2); + gameSys.insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); _currChickenSequenceId = _nextChickenSequenceId; _nextChickenSequenceId = -1; _vm->_gnapActionStatus = -1; } else if (_nextChickenSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 2); - _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextChickenSequenceId, 179, 2); + gameSys.insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); _currChickenSequenceId = _nextChickenSequenceId; _nextChickenSequenceId = -1; } @@ -1064,8 +1078,10 @@ Scene38::Scene38(GnapEngine *vm) : Scene(vm) { } int Scene38::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); return 0xA5; } @@ -1262,26 +1278,28 @@ void Scene38::run() { } void Scene38::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS38LeaveScene: _vm->_sceneDone = true; break; case kAS38ExitCave: - _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); + gameSys.removeSequence(_vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, true); + 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); + gameSys.setAnimation(0xA3, _vm->_gnapId, 0); _vm->_gnapActionStatus = kAS38LeaveScene; break; case kAS38UseHuntingTrophy: - _vm->_gameSys->removeSequence(0x9B, 0, true); - _vm->_gameSys->insertSequence(0x9C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.removeSequence(0x9B, 0, true); + 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); + gameSys.setAnimation(0x9C, _vm->_gnapId, 0); _vm->_gnapActionStatus = kAS38HoldingHuntingTrophy; updateHotspots(); break; @@ -1289,21 +1307,21 @@ void Scene38::updateAnimations() { if (_vm->_platypusActionStatus != kAS38PlatypusHoldingTrapDoor) _vm->_sceneWaiting = true; if (_vm->_gnapSequenceId == 0xA4) { - _vm->_gameSys->insertSequence(0x9D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x9D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x9D; } else { - _vm->_gameSys->insertSequence(0xA4, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xA4, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0xA4; } _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(_vm->_gnapSequenceId, _vm->_gnapId, 0); + gameSys.setAnimation(_vm->_gnapSequenceId, _vm->_gnapId, 0); break; case kAS38ReleaseHuntingTrophy: if (_vm->_gnapSequenceId == 0x9E) { - _vm->_gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapActionStatus = -1; } else if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) { - _vm->_gameSys->insertSequence(0xA0, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + 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; @@ -1318,44 +1336,44 @@ void Scene38::updateAnimations() { _vm->_gnapActionStatus = -1; } } else { - _vm->_gameSys->insertSequence(0x9E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + 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); + gameSys.setAnimation(0x9E, _vm->_gnapId, 0); _vm->_sceneWaiting = false; updateHotspots(); } break; case kAS38UsePlatypusWithTrapDoor: _vm->_sceneWaiting = false; - _vm->_gameSys->insertSequence(0x9F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + 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); + gameSys.setAnimation(0x9F, _vm->_gnapId, 0); _vm->_gnapActionStatus = kAS38HoldingHuntingTrophy; if (_vm->_platypusFacing != kDirNone) _vm->playPlatypusSequence(0x107D5); else _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); + 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); + gameSys.setAnimation(0xA1, _vm->_gnapId + 1, 1); _vm->_platypusActionStatus = kAS38PlatypusHoldingTrapDoor; updateHotspots(); break; } } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) { - _vm->_gameSys->insertSequence(0xA2, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xA2, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceId = 0xA2; _vm->_platypusSequenceDatNum = 0; updateHotspots(); @@ -1372,8 +1390,10 @@ Scene39::Scene39(GnapEngine *vm) : Scene(vm) { } int Scene39::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); return 0x35; } @@ -1389,15 +1409,17 @@ void Scene39::updateHotspots() { } void Scene39::run() { + GameSys& gameSys = *_vm->_gameSys; + // Bug in the original? Timer was never initialized. _vm->_timers[5] = 0; _vm->queueInsertDeviceIcon(); _currGuySequenceId = 0x33; - _vm->_gameSys->setAnimation(0x33, 21, 3); - _vm->_gameSys->insertSequence(_currGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x34, 21, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.setAnimation(0x33, 21, 3); + gameSys.insertSequence(_currGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x34, 21, 0, 0, kSeqLoop, 0, 0, 0); _nextGuySequenceId = -1; if (_vm->_prevSceneNum == 38) { @@ -1548,17 +1570,19 @@ void Scene39::run() { } void Scene39::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); if (_vm->_gnapActionStatus == kAS39LeaveScene) _vm->_sceneDone = true; else _vm->_gnapActionStatus = -1; } - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _nextGuySequenceId != -1) { - _vm->_gameSys->setAnimation(_nextGuySequenceId, 21, 3); - _vm->_gameSys->insertSequence(_nextGuySequenceId, 21, _currGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + if (gameSys.getAnimationStatus(3) == 2 && _nextGuySequenceId != -1) { + gameSys.setAnimation(_nextGuySequenceId, 21, 3); + gameSys.insertSequence(_nextGuySequenceId, 21, _currGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currGuySequenceId = _nextGuySequenceId; _nextGuySequenceId = -1; } diff --git a/engines/gnap/scenes/group5.cpp b/engines/gnap/scenes/group5.cpp index 98b26ec8ec..3ae20034fd 100644 --- a/engines/gnap/scenes/group5.cpp +++ b/engines/gnap/scenes/group5.cpp @@ -35,8 +35,10 @@ Scene53::Scene53(GnapEngine *vm) : Scene(vm) { } int Scene53::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); return 0x75; } @@ -73,18 +75,19 @@ int Scene53::pressPhoneNumberButton(int phoneNumber, int buttonNum) { 0x58, 0x59, 0x5A, 0x5C, 0x5D, 0x5B }; + GameSys& gameSys = *_vm->_gameSys; if (_isGnapPhoning) { - _vm->_gameSys->setAnimation(kGnapHandSequenceIds[buttonNum], 40, 6); - _vm->_gameSys->insertSequence(kGnapHandSequenceIds[buttonNum], 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(kGnapHandSequenceIds[buttonNum], 40, 6); + gameSys.insertSequence(kGnapHandSequenceIds[buttonNum], 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currHandSequenceId = kGnapHandSequenceIds[buttonNum]; } else { - _vm->_gameSys->setAnimation(kPlatypusHandSequenceIds[buttonNum], 40, 6); - _vm->_gameSys->insertSequence(kPlatypusHandSequenceIds[buttonNum], 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(kPlatypusHandSequenceIds[buttonNum], 40, 6); + gameSys.insertSequence(kPlatypusHandSequenceIds[buttonNum], 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currHandSequenceId = kPlatypusHandSequenceIds[buttonNum]; } _vm->_gnapActionStatus = 6; - while (_vm->_gameSys->getAnimationStatus(6) != 2) { + while (gameSys.getAnimationStatus(6) != 2) { // checkGameAppStatus(); _vm->updateMouseCursor(); _vm->gameUpdateTick(); @@ -117,6 +120,7 @@ void Scene53::runRandomCall() { 0x6A, 0x6B, 0x6C, 0x6D, 0x71 }; + GameSys& gameSys = *_vm->_gameSys; ++_callsMadeCtr; if (_callsMadeCtr <= 10) { @@ -125,16 +129,16 @@ void Scene53::runRandomCall() { do { index = getRandomCallIndex(); } while (!_isGnapPhoning && (index == 0 || index == 3 || index == 4 || index == 11)); - _vm->_gameSys->setAnimation(kCallSequenceIds[index], 1, 6); - _vm->_gameSys->insertSequence(kCallSequenceIds[index], 1, 0, 0, kSeqNone, 16, 0, 0); + gameSys.setAnimation(kCallSequenceIds[index], 1, 6); + gameSys.insertSequence(kCallSequenceIds[index], 1, 0, 0, kSeqNone, 16, 0, 0); } else { - _vm->_gameSys->setAnimation(0x74, 1, 6); - _vm->_gameSys->insertSequence(0x74, 1, 0, 0, kSeqNone, 16, 0, 0); + gameSys.setAnimation(0x74, 1, 6); + gameSys.insertSequence(0x74, 1, 0, 0, kSeqNone, 16, 0, 0); _callsMadeCtr = 0; } _vm->_gnapActionStatus = 1; - while (_vm->_gameSys->getAnimationStatus(6) != 2) { + while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); @@ -143,14 +147,15 @@ void Scene53::runRandomCall() { } void Scene53::runChitChatLine() { + GameSys& gameSys = *_vm->_gameSys; bool flag = false; int sequenceId = -1; - _vm->_gameSys->setAnimation(0x6E, 1, 6); - _vm->_gameSys->insertSequence(0x6E, 1, 0, 0, kSeqNone, 16, 0, 0); + gameSys.setAnimation(0x6E, 1, 6); + gameSys.insertSequence(0x6E, 1, 0, 0, kSeqNone, 16, 0, 0); _vm->_gnapActionStatus = 1; - while (_vm->_gameSys->getAnimationStatus(6) != 2) { + while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); @@ -158,10 +163,10 @@ void Scene53::runChitChatLine() { _vm->_gnapActionStatus = -1; if (_vm->isFlag(kGFSpringTaken)) { - _vm->_gameSys->insertSequence(0x45, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x45, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currHandSequenceId = 0x45; } else { - _vm->_gameSys->insertSequence(0x45, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x45, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currHandSequenceId = 0x5E; } @@ -213,19 +218,19 @@ void Scene53::runChitChatLine() { _vm->stopSound(0xA0); pressPhoneNumberButton(0, _vm->_sceneClickedHotspot - 1); _vm->_gnapActionStatus = 1; - _vm->_gameSys->setAnimation(sequenceId, 1, 6); - _vm->_gameSys->insertSequence(sequenceId, 1, 0, 0, kSeqNone, 16, 0, 0); + gameSys.setAnimation(sequenceId, 1, 6); + gameSys.insertSequence(sequenceId, 1, 0, 0, kSeqNone, 16, 0, 0); _vm->_gnapActionStatus = 1; - while (_vm->_gameSys->getAnimationStatus(6) != 2) { + while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); } _vm->_gnapActionStatus = -1; - _vm->_gameSys->setAnimation(0x72, 1, 6); - _vm->_gameSys->insertSequence(0x72, 1, 0, 0, kSeqNone, 16, 0, 0); + gameSys.setAnimation(0x72, 1, 6); + gameSys.insertSequence(0x72, 1, 0, 0, kSeqNone, 16, 0, 0); _vm->_gnapActionStatus = 1; - while (_vm->_gameSys->getAnimationStatus(6) != 2) { + while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); @@ -239,9 +244,9 @@ void Scene53::runChitChatLine() { _vm->_gnapActionStatus = 1; if (_vm->isFlag(kGFSpringTaken)) { - _vm->_gameSys->setAnimation(0x73, 40, 6); - _vm->_gameSys->insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(6) != 2) { + gameSys.setAnimation(0x73, 40, 6); + gameSys.insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); @@ -252,6 +257,7 @@ void Scene53::runChitChatLine() { } void Scene53::run() { + GameSys& gameSys = *_vm->_gameSys; int phoneNumber = 0; int phoneNumberLen = 0; @@ -265,7 +271,7 @@ void Scene53::run() { _isGnapPhoning = false; } - _vm->_gameSys->insertSequence(_currHandSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(_currHandSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); _vm->setVerbCursor(GRAB_CURSOR); _vm->playSound(0xA0, true); @@ -303,9 +309,9 @@ void Scene53::run() { if (phoneNumberLen == 7) { _vm->_gnapActionStatus = 1; if (_vm->isFlag(kGFSpringTaken)) { - _vm->_gameSys->setAnimation(0x73, 40, 6); - _vm->_gameSys->insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(6) != 2) { + gameSys.setAnimation(0x73, 40, 6); + gameSys.insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); @@ -345,9 +351,9 @@ void Scene53::run() { if (_vm->_gnapActionStatus < 0) { _vm->_gnapActionStatus = 1; if (_vm->isFlag(kGFSpringTaken)) { - _vm->_gameSys->setAnimation(0x73, 40, 6); - _vm->_gameSys->insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(6) != 2) { + gameSys.setAnimation(0x73, 40, 6); + gameSys.insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); diff --git a/engines/gnap/scenes/intro.cpp b/engines/gnap/scenes/intro.cpp index 0463f12ac6..fa23d6a2b3 100644 --- a/engines/gnap/scenes/intro.cpp +++ b/engines/gnap/scenes/intro.cpp @@ -55,6 +55,7 @@ void SceneIntro::run() { 0x1A, 0x14, 0x15, 0x16, 0x14, 0x19, 0}; + GameSys& gameSys = *_vm->_gameSys; int index = 0; bool skip = false; @@ -121,35 +122,35 @@ void SceneIntro::run() { delete videoDecoder; - _vm->_gameSys->drawSpriteToBackground(0, 0, backgroundIdArr[index]); - _vm->_gameSys->insertSequence(0x356, 2, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(0x356, 2, 0); + gameSys.drawSpriteToBackground(0, 0, backgroundIdArr[index]); + gameSys.insertSequence(0x356, 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x356, 2, 0); while (!_vm->_sceneDone) { _vm->gameUpdateTick(); - if (_vm->_gameSys->getAnimationStatus(0) == 2 || skip ) { + if (gameSys.getAnimationStatus(0) == 2 || skip ) { skip = false; - _vm->_gameSys->requestClear2(false); - _vm->_gameSys->requestClear1(); + gameSys.requestClear2(false); + gameSys.requestClear1(); if ( index == 11 || index == 1 ) _vm->screenEffect(0, 0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 0); if (++index >= 31) _vm->_sceneDone = true; else { - _vm->_gameSys->insertSequence(animIdArr[index], 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(animIdArr[index], 2, 0, 0, kSeqNone, 0, 0, 0); if (index == 2) { _vm->playSound(0x10000, false); - _vm->_gameSys->insertSequence(0x359, 2, 0, 0, 0, 0, 0, 0); + gameSys.insertSequence(0x359, 2, 0, 0, 0, 0, 0, 0); } else if (index == 3) - _vm->_gameSys->insertSequence(0x35B, 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x35B, 2, 0, 0, kSeqNone, 0, 0, 0); else if (index == 12) - _vm->_gameSys->insertSequence(0x36A, 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x36A, 2, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->drawSpriteToBackground(0, 0, backgroundIdArr[index]); - _vm->_gameSys->setAnimation(animIdArr[index], 2, 0); + gameSys.drawSpriteToBackground(0, 0, backgroundIdArr[index]); + gameSys.setAnimation(animIdArr[index], 2, 0); if (index == 11) _vm->stopSound(0x10000); diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 2b67d59d37..eb83632d89 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -650,6 +650,8 @@ bool Scene::clearKeyStatus() { } void CutScene::run() { + GameSys& gameSys = *_vm->_gameSys; + int itemIndex = 0; int soundId = -1; int volume = 100; @@ -667,11 +669,11 @@ void CutScene::run() { _vm->hideCursor(); - _vm->_gameSys->drawSpriteToBackground(0, 0, _resourceIdArr[0]); + gameSys.drawSpriteToBackground(0, 0, _resourceIdArr[0]); for (int j = 0; j < _sequenceCountArr[0]; ++j) - _vm->_gameSys->insertSequence(_sequenceIdArr[j], j + 2, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(_sequenceIdArr[0], 2, 0); + gameSys.insertSequence(_sequenceIdArr[j], j + 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(_sequenceIdArr[0], 2, 0); _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); _vm->clearKeyStatus1(Common::KEYCODE_SPACE); @@ -683,19 +685,19 @@ void CutScene::run() { while (!_vm->_sceneDone) { _vm->gameUpdateTick(); - if (_vm->_gameSys->getAnimationStatus(0) == 2 || skip) { + if (gameSys.getAnimationStatus(0) == 2 || skip) { skip = false; - _vm->_gameSys->requestClear2(false); - _vm->_gameSys->requestClear1(); - _vm->_gameSys->setAnimation(0, 0, 0); + gameSys.requestClear2(false); + gameSys.requestClear1(); + gameSys.setAnimation(0, 0, 0); firstSequenceIndex += _sequenceCountArr[itemIndex++]; if (itemIndex >= _itemsCount) { _vm->_sceneDone = true; } else { for (int m = 0; m < _sequenceCountArr[itemIndex]; ++m) - _vm->_gameSys->insertSequence(_sequenceIdArr[firstSequenceIndex + m], m + 2, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->drawSpriteToBackground(0, 0, _resourceIdArr[itemIndex]); - _vm->_gameSys->setAnimation(_sequenceIdArr[firstSequenceIndex], 2, 0); + gameSys.insertSequence(_sequenceIdArr[firstSequenceIndex + m], m + 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.drawSpriteToBackground(0, 0, _resourceIdArr[itemIndex]); + gameSys.setAnimation(_sequenceIdArr[firstSequenceIndex], 2, 0); } } |