diff options
author | Strangerke | 2016-05-08 10:14:46 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-05-10 12:14:55 +0200 |
commit | fdabbcc16ab90b47a14eda8c168ab206a92780f1 (patch) | |
tree | 051e34a6a2f04ee009d932a033cadeb181aa2c80 /engines/gnap/scenes | |
parent | 1f7eeb24a0622a44a4b4582b51950fae4a80fcb7 (diff) | |
download | scummvm-rg350-fdabbcc16ab90b47a14eda8c168ab206a92780f1.tar.gz scummvm-rg350-fdabbcc16ab90b47a14eda8c168ab206a92780f1.tar.bz2 scummvm-rg350-fdabbcc16ab90b47a14eda8c168ab206a92780f1.zip |
GNAP: Reduce dereferencing of _gnap
Diffstat (limited to 'engines/gnap/scenes')
-rw-r--r-- | engines/gnap/scenes/group0.cpp | 1356 | ||||
-rw-r--r-- | engines/gnap/scenes/group1.cpp | 1455 | ||||
-rw-r--r-- | engines/gnap/scenes/group2.cpp | 1063 | ||||
-rw-r--r-- | engines/gnap/scenes/group3.cpp | 603 | ||||
-rw-r--r-- | engines/gnap/scenes/group4.cpp | 727 | ||||
-rw-r--r-- | engines/gnap/scenes/group5.cpp | 50 |
6 files changed, 2677 insertions, 2577 deletions
diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index 982cfcaff0..f5e8307def 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -72,6 +72,7 @@ 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; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x1091C, true); _vm->startSoundTimerC(5); @@ -90,15 +91,15 @@ void Scene01::run() { _vm->queueInsertDeviceIcon(); if (_vm->_prevSceneNum == 2) { - _vm->_gnap->initPos(11, 6, kDirBottomLeft); + gnap.initPos(11, 6, kDirBottomLeft); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->initPos(12, 6, kDirUnk4); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(Common::Point(9, 6), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(8, 6), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(8, 6), -1, 0x107B9, 1); } else { - _vm->_gnap->initPos(1, 6, kDirBottomRight); + gnap.initPos(1, 6, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->initPos(1, 7, kDirNone); _vm->endSceneInit(); @@ -115,35 +116,35 @@ void Scene01::run() { switch (_vm->_sceneClickedHotspot) { case kHS01Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS01Platypus: - if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (gnap._actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->_gnap->useDisguiseOnPlatypus(); + gnap.useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -151,20 +152,20 @@ void Scene01::run() { break; case kHS01Spaceship: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpLeft; - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) - _vm->_gnap->_actionStatus = kAS01LookSpaceship; + gnap._idleFacing = kDirUpLeft; + if (gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) + gnap._actionStatus = kAS01LookSpaceship; break; case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -172,21 +173,21 @@ void Scene01::run() { break; case kHS01Mud: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 3); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(3, 3); + gnap.playScratchingHead(3, 3); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(2, 3)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS01TakeMud; + gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(gskIdle, Common::Point(2, 3)) | 0x10000, 1); + gnap._actionStatus = kAS01TakeMud; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -194,28 +195,28 @@ void Scene01::run() { break; case kHS01Pigs: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 7, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 7, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(7, 2)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS01LookPigs; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, Common::Point(7, 2)) | 0x10000, 1); + gnap._actionStatus = kAS01LookPigs; break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(7, 2)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS01UsePigs; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, Common::Point(7, 2)) | 0x10000, 1); + gnap._actionStatus = kAS01UsePigs; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(7, 2)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS01LookPigs; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(7, 2)) | 0x10000, 1); + gnap._actionStatus = kAS01LookPigs; break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -223,10 +224,10 @@ void Scene01::run() { break; case kHS01ExitTruck: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[1], 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS01LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[1], 0, 0x107AB, 1); + gnap._actionStatus = kAS01LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(_vm->_hotspotsWalkPos[1] + Common::Point(0, 1), -1, 0x107CD, 1); _vm->_newSceneNum = 2; @@ -241,13 +242,13 @@ void Scene01::run() { case kHS01WalkArea6: case kHS01WalkArea7: case kHS01WalkArea8: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -262,8 +263,8 @@ void Scene01::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); if (_vm->_timers[4] == 0) { // Update bird animation _vm->_timers[4] = _vm->getRandom(100) + 300; @@ -288,23 +289,24 @@ void Scene01::run() { void Scene01::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS01LookSpaceship: _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->_gnap->_actionStatus = kAS01LookSpaceshipDone; + gnap._actionStatus = kAS01LookSpaceshipDone; break; case kAS01LookSpaceshipDone: gameSys.removeSequence(133, 256, true); gameSys.removeSpriteDrawItem(_spaceshipSurface, 255); _vm->deleteSurface(&_spaceshipSurface); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS01LeaveScene: @@ -312,25 +314,25 @@ void Scene01::updateAnimations() { break; case kAS01TakeMud: - _vm->_gnap->playPullOutDevice(2, 3); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(2, 3); + gnap.playUseDevice(0, 0); gameSys.insertSequence(128, 40, 129, 40, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(128, 40, 3); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS01LookPigs: _vm->playSound(0x8A, false); _vm->playSound(0x8B, false); _vm->playSound(0x8C, false); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS01UsePigs: - _vm->_gnap->playPullOutDevice(7, 2); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(7, 2); + gnap.playUseDevice(0, 0); gameSys.insertSequence(135, 39, 0, 0, kSeqNone, 25, _vm->getRandom(140) - 40, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -396,6 +398,7 @@ void Scene02::updateHotspots() { void Scene02::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x1091C, true); _vm->startSoundTimerC(6); @@ -412,20 +415,20 @@ void Scene02::run() { switch (_vm->_prevSceneNum) { case 3: - _vm->_gnap->initPos(11, 6, kDirBottomLeft); + gnap.initPos(11, 6, kDirBottomLeft); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->initPos(12, 6, kDirUnk4); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(Common::Point(9, 6), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(8, 6), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(8, 6), -1, 0x107BA, 1); break; case 4: - _vm->_gnap->initPos(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, kDirBottomLeft); + gnap.initPos(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, kDirBottomLeft); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->initPos(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, kDirUnk4); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(7, 6), 0, 0x107B9, 1); + gnap.walkTo(Common::Point(7, 6), 0, 0x107B9, 1); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(Common::Point(8, 6), 1, 0x107C2, 1); updateHotspots(); @@ -433,24 +436,24 @@ void Scene02::run() { break; case 47: _vm->clearFlag(kGFUnk25); - _vm->_gnap->initPos(5, 6, kDirBottomLeft); + gnap.initPos(5, 6, kDirBottomLeft); _vm->_plat->initPos(6, 7, kDirUnk4); _vm->endSceneInit(); break; case 49: - _vm->_gnap->initPos(5, 6, kDirBottomRight); + gnap.initPos(5, 6, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->initPos(6, 7, kDirNone); _vm->endSceneInit(); break; default: - _vm->_gnap->initPos(-1, 6, kDirBottomRight); + gnap.initPos(-1, 6, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->initPos(-1, 7, kDirNone); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(Common::Point(2, 7), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); break; } @@ -465,35 +468,35 @@ void Scene02::run() { switch (_vm->_sceneClickedHotspot) { case kHS02Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS02Platypus: - if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (gnap._actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->_gnap->useDisguiseOnPlatypus(); + gnap.useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -501,33 +504,33 @@ void Scene02::run() { break; case kHS02Chicken: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTwig) { - _vm->_gnap->_idleFacing = kDirUpRight; + gnap._idleFacing = kDirUpRight; Common::Point destPos = Common::Point(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1); - _vm->_gnap->walkTo(destPos, 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS02UseTwigWithChicken; + gnap.walkTo(destPos, 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS02UseTwigWithChicken; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y + 1, 9, 8); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y + 1, 9, 8); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan2(9, 8); + gnap.playMoan2(9, 8); break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirBottomRight; - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[1], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) - _vm->_gnap->_actionStatus = kAS02GrabChicken; + gnap._idleFacing = kDirBottomRight; + if (gnap.walkTo(_vm->_hotspotsWalkPos[1], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) + gnap._actionStatus = kAS02GrabChicken; else - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[1], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS02TalkChicken; + gnap._idleFacing = kDirBottomRight; + gnap.walkTo(_vm->_hotspotsWalkPos[1], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS02TalkChicken; break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -536,45 +539,45 @@ void Scene02::run() { case kHS02Truck1: case kHS02Truck2: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemKeys) { - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) { + if (gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) { _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemKeys); if (_vm->isFlag(kGFTruckFilledWithGas)) - _vm->_gnap->_actionStatus = kAS02UseTruckGas; + gnap._actionStatus = kAS02UseTruckGas; else - _vm->_gnap->_actionStatus = kAS02UseTruckNoGas; + gnap._actionStatus = kAS02UseTruckNoGas; } } else if (_vm->_grabCursorSpriteIndex == kItemGas) { _vm->_hotspots[kHS02WalkArea4]._flags |= SF_WALKABLE; - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) - _vm->_gnap->_actionStatus = kAS02UseGasWithTruck; + if (gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) + gnap._actionStatus = kAS02UseGasWithTruck; _vm->_hotspots[kHS02WalkArea4]._flags &= ~SF_WALKABLE; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(2, 2); + gnap.playScratchingHead(2, 2); break; case GRAB_CURSOR: if (_vm->isFlag(kGFTruckKeysUsed)) { - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) { + if (gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) { if (_vm->isFlag(kGFTruckFilledWithGas)) - _vm->_gnap->_actionStatus = kAS02UseTruckGas; + gnap._actionStatus = kAS02UseTruckGas; else - _vm->_gnap->_actionStatus = kAS02UseTruckNoGas; + gnap._actionStatus = kAS02UseTruckNoGas; } } else { - _vm->_gnap->_idleFacing = kDirUnk4; - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) - _vm->_gnap->_actionStatus = kAS02UseTruckNoKeys; + gnap._idleFacing = kDirUnk4; + if (gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) + gnap._actionStatus = kAS02UseTruckNoKeys; } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -582,22 +585,22 @@ void Scene02::run() { break; case kHS02TruckGrill: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 2, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 2, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan2(2, 4); + gnap.playMoan2(2, 4); break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS02GrabTruckGrill; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS02GrabTruckGrill; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -605,10 +608,10 @@ void Scene02::run() { break; case kHS02ExitHouse: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[6], 0, 0x107AD, 1); - _vm->_gnap->_actionStatus = kAS02LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[6], 0, 0x107AD, 1); + gnap._actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(_vm->_hotspotsWalkPos[6] + Common::Point(1, 0), -1, 0x107C1, 1); updateHotspots(); @@ -617,10 +620,10 @@ void Scene02::run() { break; case kHS02ExitBarn: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[7], 0, 0x107AD, 1); - _vm->_gnap->_actionStatus = kAS02LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[7], 0, 0x107AD, 1); + gnap._actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(_vm->_hotspotsWalkPos[7] + Common::Point(1, 0), -1, 0x107C1, 1); updateHotspots(); @@ -629,10 +632,10 @@ void Scene02::run() { break; case kHS02ExitCreek: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[8], 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS02LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[8], 0, 0x107AB, 1); + gnap._actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(_vm->_hotspotsWalkPos[8], -1, 0x107CD, 1); _vm->_newSceneNum = 3; @@ -640,10 +643,10 @@ void Scene02::run() { break; case kHS02ExitPigpen: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[9], 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS02LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[9], 0, 0x107AF, 1); + gnap._actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(_vm->_hotspotsWalkPos[9], -1, 0x107CF, 1); _vm->_newSceneNum = 1; @@ -654,13 +657,13 @@ void Scene02::run() { case kHS02WalkArea2: case kHS02WalkArea3: case kHS02WalkArea4: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -674,8 +677,8 @@ void Scene02::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { // Update bird animation _vm->_timers[4] = _vm->getRandom(100) + 300; @@ -684,7 +687,7 @@ void Scene02::run() { else gameSys.insertSequence(0x154, 256, 0, 0, kSeqNone, 0, 0, 0); } - if (!_vm->_timers[5] && _nextChickenSequenceId == -1 && _vm->_gnap->_actionStatus != 7 && _vm->_gnap->_actionStatus != 8) { + if (!_vm->_timers[5] && _nextChickenSequenceId == -1 && gnap._actionStatus != 7 && gnap._actionStatus != 8) { if (_vm->getRandom(6) != 0) { _nextChickenSequenceId = 0x14B; _vm->_timers[5] = _vm->getRandom(20) + 30; @@ -710,25 +713,26 @@ void Scene02::run() { void Scene02::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS02UseTruckNoKeys: - gameSys.insertSequence(0x14E, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0x14E, _vm->_gnap->_id, 0); - _vm->_gnap->_sequenceId = 0x14E; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = kAS02UseTruckNoKeysDone; + gameSys.insertSequence(0x14E, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x14E, gnap._id, 0); + gnap._sequenceId = 0x14E; + gnap._sequenceDatNum = 0; + gnap._actionStatus = kAS02UseTruckNoKeysDone; break; case kAS02UseGasWithTruck: - gameSys.insertSequence(0x151, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0x151, _vm->_gnap->_id, 0); - _vm->_gnap->_sequenceId = 0x151; - _vm->_gnap->_sequenceDatNum = 0; + gameSys.insertSequence(0x151, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x151, gnap._id, 0); + gnap._sequenceId = 0x151; + gnap._sequenceDatNum = 0; _vm->invRemove(kItemGas); _vm->setGrabCursorSprite(-1); _vm->setFlag(kGFTruckFilledWithGas); - _vm->_gnap->_actionStatus = kAS02UseGasWithTruckDone; + gnap._actionStatus = kAS02UseGasWithTruckDone; break; case kAS02UseTruckGas: _vm->_timers[5] = 9999; @@ -736,11 +740,11 @@ void Scene02::updateAnimations() { _vm->hideCursor(); _vm->setGrabCursorSprite(-1); if (!_vm->isFlag(kGFTruckKeysUsed)) { - gameSys.insertSequence(0x14F, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x14F, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.waitForUpdate(); _vm->setFlag(kGFTruckKeysUsed); - _vm->_gnap->_sequenceId = 0x14F; - _vm->_gnap->_sequenceDatNum = 0; + gnap._sequenceId = 0x14F; + gnap._sequenceDatNum = 0; _vm->invRemove(kItemKeys); _vm->setGrabCursorSprite(-1); } @@ -752,11 +756,11 @@ void Scene02::updateAnimations() { _vm->setGrabCursorSprite(-1); _vm->_timers[4] = 250; if (!_vm->isFlag(kGFTruckKeysUsed)) { - gameSys.insertSequence(0x14F, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x14F, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.waitForUpdate(); _vm->setFlag(kGFTruckKeysUsed); - _vm->_gnap->_sequenceId = 0x14F; - _vm->_gnap->_sequenceDatNum = 0; + gnap._sequenceId = 0x14F; + gnap._sequenceDatNum = 0; _vm->invRemove(kItemKeys); _vm->setGrabCursorSprite(-1); } @@ -777,11 +781,11 @@ void Scene02::updateAnimations() { break; } _truckGrillCtr = (_truckGrillCtr + 1) % 3; - gameSys.insertSequence(_gnapTruckSequenceId, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(_gnapTruckSequenceId, _vm->_gnap->_id, 0); - _vm->_gnap->_sequenceId = _gnapTruckSequenceId; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = -1; + gameSys.insertSequence(_gnapTruckSequenceId, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_gnapTruckSequenceId, gnap._id, 0); + gnap._sequenceId = _gnapTruckSequenceId; + gnap._sequenceDatNum = 0; + gnap._actionStatus = -1; break; case kAS02LeaveScene: _vm->_sceneDone = true; @@ -794,26 +798,26 @@ void Scene02::updateAnimations() { _vm->_timers[2] = 100; break; case kAS02GrabChickenDone: - gameSys.insertSequence(0x107B5, _vm->_gnap->_id, 0x150, 179, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); - _vm->_gnap->_sequenceId = 0x7B5; - _vm->_gnap->_sequenceDatNum = 1; + gameSys.insertSequence(0x107B5, gnap._id, 0x150, 179, kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); + gnap._sequenceId = 0x7B5; + gnap._sequenceDatNum = 1; _currChickenSequenceId = 0x14B; gameSys.setAnimation(0x14B, 179, 2); gameSys.insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _vm->_timers[5] = 30; break; case kAS02UseTwigWithChicken: - _vm->_gnap->playShowItem(5, 0, 0); + gnap.playShowItem(5, 0, 0); gameSys.insertSequence(0x155, 179, _currChickenSequenceId, 179, kSeqSyncExists, 0, 0, 0); _currChickenSequenceId = 0x155; _nextChickenSequenceId = -1; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS02UseTruckNoKeysDone: case kAS02UseGasWithTruckDone: default: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -821,18 +825,18 @@ void Scene02::updateAnimations() { if (gameSys.getAnimationStatus(2) == 2) { if (_nextChickenSequenceId == 0x150) { gameSys.setAnimation(_nextChickenSequenceId, 179, 0); - gameSys.insertSequence(_nextChickenSequenceId, 179, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextChickenSequenceId, 179, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(_currChickenSequenceId, 179, true); _nextChickenSequenceId = -1; _currChickenSequenceId = -1; - _vm->_gnap->_actionStatus = kAS02GrabChickenDone; + gnap._actionStatus = kAS02GrabChickenDone; _vm->_timers[5] = 500; } else if (_nextChickenSequenceId == 0x14C) { gameSys.setAnimation(_nextChickenSequenceId, 179, 2); gameSys.insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); _currChickenSequenceId = _nextChickenSequenceId; _nextChickenSequenceId = -1; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } else if (_nextChickenSequenceId != -1) { gameSys.setAnimation(_nextChickenSequenceId, 179, 2); gameSys.insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); @@ -885,6 +889,7 @@ void Scene03::updateHotspots() { void Scene03::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x10925, true); _vm->startSoundTimerC(7); @@ -893,7 +898,7 @@ void Scene03::run() { gameSys.insertSequence(0x1CB, 251, 0, 0, kSeqLoop, 0, 0, 0); _platypusHypnotized = false; - _vm->_gnap->initPos(3, 4, kDirBottomRight); + gnap.initPos(3, 4, kDirBottomRight); gameSys.insertSequence(0x1C6, 253, 0, 0, kSeqNone, 0, 0, 0); @@ -926,7 +931,7 @@ void Scene03::run() { if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(Common::Point(4, 7), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(3, 6), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(3, 6), -1, 0x107B9, 1); while (!_vm->_sceneDone) { _vm->updateMouseCursor(); @@ -937,28 +942,28 @@ void Scene03::run() { switch (_vm->_sceneClickedHotspot) { case kHS03Platypus: - if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (gnap._actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->_gnap->useDisguiseOnPlatypus(); + gnap.useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -966,26 +971,26 @@ void Scene03::run() { break; case kHS03Grass: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFGrassTaken)) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 9, 6); + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 9, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(9, 6); + gnap.playScratchingHead(9, 6); break; case GRAB_CURSOR: - _vm->_gnap->playPullOutDevice(9, 6); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(9, 6); + gnap.playUseDevice(0, 0); 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: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -993,11 +998,11 @@ void Scene03::run() { break; case kHS03ExitTruck: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_hotspots[kHS03PlatypusWalkArea]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, 0x107AD, 1); - _vm->_gnap->_actionStatus = kAS03LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, 0x107AD, 1); + gnap._actionStatus = kAS03LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(_vm->_hotspotsWalkPos[2], -1, 0x107C2, 1); _vm->_hotspots[kHS03PlatypusWalkArea]._flags &= ~SF_WALKABLE; @@ -1009,25 +1014,25 @@ void Scene03::run() { break; case kHS03Creek: - if (_vm->_gnap->_actionStatus == -1) { + if (gnap._actionStatus == -1) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan2(2, 8); + gnap.playMoan2(2, 8); break; case GRAB_CURSOR: if (!_vm->isFlag(kGFPlatypus)) _vm->_hotspots[kHS03PlatypusWalkArea]._flags |= SF_WALKABLE; - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[3] + Common::Point(1, 1)) | 0x10000, 1)) - _vm->_gnap->_actionStatus = kAS03GrabCreek; + if (gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[3] + Common::Point(1, 1)) | 0x10000, 1)) + gnap._actionStatus = kAS03GrabCreek; if (!_vm->isFlag(kGFPlatypus)) _vm->_hotspots[kHS03PlatypusWalkArea]._flags &= ~SF_WALKABLE; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1035,42 +1040,42 @@ void Scene03::run() { break; case kHS03TrappedPlatypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFPlatypus)) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 8, 4); + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 8, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(8, 4); + gnap.playScratchingHead(8, 4); break; case GRAB_CURSOR: if (_platypusHypnotized) { - _vm->_gnap->walkTo(Common::Point(7, 6), 0, 0x107B5, 1); - _vm->_gnap->_actionStatus = kAS03FreePlatypus; + gnap.walkTo(Common::Point(7, 6), 0, 0x107B5, 1); + gnap._actionStatus = kAS03FreePlatypus; } else { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); if (_platypusScared) - _vm->_gnap->_actionStatus = kAS03GrabScaredPlatypus; + gnap._actionStatus = kAS03GrabScaredPlatypus; else - _vm->_gnap->_actionStatus = kAS03GrabPlatypus; + gnap._actionStatus = kAS03GrabPlatypus; } break; case TALK_CURSOR: if (_platypusHypnotized) { - _vm->_gnap->playBrainPulsating(8, 4); + gnap.playBrainPulsating(8, 4); } else { - _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._idleFacing = kDirBottomRight; + gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); if (_platypusScared) - _vm->_gnap->_actionStatus = kAS03HypnotizeScaredPlat; + gnap._actionStatus = kAS03HypnotizeScaredPlat; else - _vm->_gnap->_actionStatus = kAS03HypnotizePlat; + gnap._actionStatus = kAS03HypnotizePlat; } break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1078,7 +1083,7 @@ void Scene03::run() { break; case kHS03Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } @@ -1087,27 +1092,27 @@ void Scene03::run() { case kHS03WalkAreas1: case kHS03WalkAreas2: case kHS03WalkAreas3: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS03PlatypusWalkArea: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFPlatypus) || _platypusHypnotized) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); } else { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107B5, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107B5, 1); if (_platypusScared) - _vm->_gnap->_actionStatus = kAS03GrabScaredPlatypus; + gnap._actionStatus = kAS03GrabScaredPlatypus; else - _vm->_gnap->_actionStatus = kAS03GrabPlatypus; + gnap._actionStatus = kAS03GrabPlatypus; } } break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1122,16 +1127,16 @@ void Scene03::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); if (!_vm->_timers[1] && !_platypusScared) { _vm->_timers[1] = _vm->getRandom(40) + 20; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFPlatypus) && !_platypusHypnotized) + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFPlatypus) && !_platypusHypnotized) _nextPlatSequenceId = 450; } if (!_vm->_timers[6]) { _vm->_timers[6] = _vm->getRandom(20) + 30; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextFrogSequenceId == -1) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextFrogSequenceId == -1) { if (_vm->getRandom(5) == 1) _nextFrogSequenceId = 0x1C6; else @@ -1141,12 +1146,12 @@ void Scene03::run() { if (!_vm->_timers[4]) { // Update bird animation _vm->_timers[4] = _vm->getRandom(100) + 300; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 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->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { gameSys.setAnimation(0x1C5, 253, 4); gameSys.insertSequence(0x1C5, 253, 0, 0, kSeqNone, 0, 0, 0); } @@ -1171,10 +1176,11 @@ void Scene03::run() { void Scene03::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS03LeaveScene: _vm->_sceneDone = true; break; @@ -1182,7 +1188,7 @@ void Scene03::updateAnimations() { _nextPlatSequenceId = 0x1BC; break; case kAS03FreePlatypusDone: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _vm->_plat->_pos = Common::Point(6, 6); _vm->_plat->_idleFacing = kDirUnk4; _vm->_plat->_id = 120; @@ -1196,7 +1202,7 @@ void Scene03::updateAnimations() { updateHotspots(); break; case kAS03HypnotizePlat: - _vm->_gnap->playBrainPulsating(0, 0); + gnap.playBrainPulsating(0, 0); _vm->addFullScreenSprite(0x106, 255); gameSys.setAnimation(0x1C9, 256, 1); gameSys.insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); @@ -1207,12 +1213,12 @@ void Scene03::updateAnimations() { gameSys.insertSequence(0x1BA, 99, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); _vm->_plat->_sequenceDatNum = 0; _vm->_plat->_sequenceId = 0x1BA; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _platypusHypnotized = true; updateHotspots(); break; case kAS03HypnotizeScaredPlat: - _vm->_gnap->playBrainPulsating(0, 0); + gnap.playBrainPulsating(0, 0); gameSys.insertSequence(0x1BF, 99, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); gameSys.setAnimation(0x1BF, 99, 1); while (gameSys.getAnimationStatus(1) != 2) @@ -1227,7 +1233,7 @@ void Scene03::updateAnimations() { gameSys.insertSequence(0x1BA, 99, 447, 99, kSeqSyncWait, 0, 0, 0); _vm->_plat->_sequenceDatNum = 0; _vm->_plat->_sequenceId = 0x1BA; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _platypusHypnotized = true; updateHotspots(); break; @@ -1240,14 +1246,14 @@ void Scene03::updateAnimations() { _platypusHypnotized = false; break; case kAS03GrabCreek: - gameSys.insertSequence(0x1B4, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0x1B4, _vm->_gnap->_id, 0); - _vm->_gnap->_sequenceId = 0x1B4; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = kAS03GrabCreekDone; + gameSys.insertSequence(0x1B4, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x1B4, gnap._id, 0); + gnap._sequenceId = 0x1B4; + gnap._sequenceDatNum = 0; + gnap._actionStatus = kAS03GrabCreekDone; break; default: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -1256,26 +1262,26 @@ void Scene03::updateAnimations() { if (_nextPlatSequenceId == 0x1BD || _nextPlatSequenceId == 0x1C0) { gameSys.setAnimation(0, 0, 1); _platypusScared = true; - gameSys.insertSequence(0x1B5, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x1B5, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(_nextPlatSequenceId, 99, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x1B5; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_idleFacing = kDirNone; + gnap._sequenceId = 0x1B5; + gnap._sequenceDatNum = 0; + gnap._idleFacing = kDirNone; _vm->_plat->_sequenceId = _nextPlatSequenceId; _vm->_plat->_sequenceDatNum = 0; gameSys.setAnimation(_nextPlatSequenceId, 99, 1); _nextPlatSequenceId = -1; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } else if (_nextPlatSequenceId == 0x1BC) { - _vm->_gnap->_pos = Common::Point(3, 6); - gameSys.insertSequence(0x1B6, 120, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gnap._pos = Common::Point(3, 6); + gameSys.insertSequence(0x1B6, 120, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x1BC, 99, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(0x1BC, 99, 0); - _vm->_gnap->_id = 20 * _vm->_gnap->_pos.y; - _vm->_gnap->_sequenceId = 0x1B6; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_idleFacing = kDirNone; - _vm->_gnap->_actionStatus = kAS03FreePlatypusDone; + gnap._id = 20 * gnap._pos.y; + gnap._sequenceId = 0x1B6; + gnap._sequenceDatNum = 0; + gnap._idleFacing = kDirNone; + gnap._actionStatus = kAS03FreePlatypusDone; _nextPlatSequenceId = -1; } else if (_nextPlatSequenceId == 0x1C2 && !_platypusScared) { gameSys.setAnimation(0, 0, 1); @@ -1351,6 +1357,7 @@ void Scene04::updateHotspots() { void Scene04::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x1091C, true); _vm->startSoundTimerC(4); @@ -1379,11 +1386,11 @@ void Scene04::run() { _vm->_timers[3] = 300; // TODO setCursor((LPCSTR)IDC_WAIT); _vm->setGrabCursorSprite(kItemKeys); - _vm->_gnap->_pos = Common::Point(4, 7); - _vm->_gnap->_id = 140; + gnap._pos = Common::Point(4, 7); + gnap._id = 140; _vm->_plat->_pos = Common::Point(6, 7); _vm->_plat->_id = 141; - gameSys.insertSequence(0x107B5, 140, 0, 0, kSeqNone, 0, 300 - _vm->_gnap->_gridX, 336 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107B5, 140, 0, 0, kSeqNone, 0, 300 - gnap._gridX, 336 - gnap._gridY); 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); @@ -1395,31 +1402,31 @@ void Scene04::run() { _vm->_plat->_sequenceId = 0x20C; _vm->_plat->_sequenceDatNum = 0; _vm->_plat->_idleFacing = kDirBottomRight; - _vm->_gnap->_sequenceId = 0x7B5; - _vm->_gnap->_sequenceDatNum = 1; + gnap._sequenceId = 0x7B5; + gnap._sequenceDatNum = 1; gameSys.waitForUpdate(); } else { gameSys.insertSequence(0x209, 121, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 2) { - _vm->_gnap->initPos(5, 11, kDirUpRight); + gnap.initPos(5, 11, kDirUpRight); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(Common::Point(5, 8), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(6, 9), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(6, 9), -1, 0x107BA, 1); } else if (_vm->_prevSceneNum == 38) { - _vm->_gnap->initPos(5, 7, kDirBottomRight); + gnap.initPos(5, 7, kDirBottomRight); _vm->_plat->initPos(4, 7, kDirNone); _vm->endSceneInit(); } else { - _vm->_gnap->initPos(12, 9, kDirBottomRight); + gnap.initPos(12, 9, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->initPos(12, 8, kDirNone); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(9, 9), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(9, 9), -1, 0x107BA, 1); } } @@ -1434,38 +1441,38 @@ void Scene04::run() { switch (_vm->_sceneClickedHotspot) { case kHS04Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS04Platypus: - if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (gnap._actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->_gnap->useDisguiseOnPlatypus(); + gnap.useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: if (_vm->_cursorValue == 4) - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); else - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1473,23 +1480,23 @@ void Scene04::run() { break; case kHS04Twig: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 9, 6); + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 9, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + gnap.playScratchingHead(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); break; case GRAB_CURSOR: - _vm->_gnap->playPullOutDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); - _vm->_gnap->playUseDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + gnap.playPullOutDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + gnap.playUseDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); gameSys.insertSequence(0x1FD, 100, 510, 100, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(0x1FD, 100, 2); break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1497,24 +1504,24 @@ void Scene04::run() { break; case kHS04Axe: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 9, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 9, 5); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan2(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y); + gnap.playMoan2(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y); break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS04GrabAxe; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS04GrabAxe; _vm->setFlag(kGFPlatypusTalkingToAssistant); updateHotspots(); break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1522,31 +1529,31 @@ void Scene04::run() { break; case kHS04Dog: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 9, 7); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 9, 7); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (_vm->_gnap->walkTo(_vm->_gnap->_pos, 0, -1, 1)) { - _vm->_gnap->playMoan2(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); + if (gnap.walkTo(gnap._pos, 0, -1, 1)) { + gnap.playMoan2(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); _nextDogSequenceId = 0x20F; } break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirBottomRight; - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) - _vm->_gnap->_actionStatus = kAS04GrabDog; + gnap._idleFacing = kDirBottomRight; + if (gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) + gnap._actionStatus = kAS04GrabDog; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirBottomRight; - if (_vm->_gnap->walkTo(_vm->_gnap->_pos, 0, -1, 1)) { - _vm->_gnap->playBrainPulsating(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); + gnap._idleFacing = kDirBottomRight; + if (gnap.walkTo(gnap._pos, 0, -1, 1)) { + gnap.playBrainPulsating(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); _nextDogSequenceId = 0x20E; } break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1554,30 +1561,30 @@ void Scene04::run() { break; case kHS04Door: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 4, 3); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 4, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playScratchingHead(4, 3); + gnap.playScratchingHead(4, 3); break; case GRAB_CURSOR: if (_vm->_cursorValue == 1) { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS04OpenDoor; + gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107BC, 1); + gnap._actionStatus = kAS04OpenDoor; _vm->_timers[5] = 300; - _vm->_gnap->_idleFacing = kDirUpLeft; + gnap._idleFacing = kDirUpLeft; } else { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS04LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107BC, 1); + gnap._actionStatus = kAS04LeaveScene; _vm->_newSceneNum = 38; } break; case TALK_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1585,10 +1592,10 @@ void Scene04::run() { break; case kHS04ExitTruck: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[5], 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS04LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[5], 0, 0x107AE, 1); + gnap._actionStatus = kAS04LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(_vm->_hotspotsWalkPos[5], -1, 0x107C7, 1); if (_vm->_cursorValue == 1) @@ -1599,29 +1606,29 @@ void Scene04::run() { break; case kHS04Window: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 3); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 3); } else if (_vm->isFlag(kGFKeysTaken)) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[7], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(10, 2)) | 0x10000, 1)) { + if (gnap.walkTo(_vm->_hotspotsWalkPos[7], 0, gnap.getSequenceId(gskIdle, Common::Point(10, 2)) | 0x10000, 1)) { if (_triedWindow) { - _vm->_gnap->_actionStatus = kAS04GetKeyAnother; + gnap._actionStatus = kAS04GetKeyAnother; } else { - _vm->_gnap->_actionStatus = kAS04GetKeyFirst; + gnap._actionStatus = kAS04GetKeyFirst; _triedWindow = true; } } break; case GRAB_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y); + gnap.playScratchingHead(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y); break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1629,10 +1636,10 @@ void Scene04::run() { break; case kHS04ExitBarn: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[8], 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS04LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[8], 0, 0x107AB, 1); + gnap._actionStatus = kAS04LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(_vm->_hotspotsWalkPos[8] + Common::Point(0, 1), -1, 0x107C1, 1); if (_vm->_cursorValue == 1) @@ -1644,13 +1651,13 @@ void Scene04::run() { case kHS04WalkArea1: case kHS04WalkArea2: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1665,11 +1672,11 @@ void Scene04::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) _vm->_plat->updateIdleSequence2(); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence2(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence2(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(150) + 300; - if (_vm->_gnap->_actionStatus < 0) + if (gnap._actionStatus < 0) gameSys.insertSequence(0x20D, 79, 0, 0, kSeqNone, 0, 0, 0); } if (!_vm->_timers[7]) { @@ -1702,95 +1709,96 @@ void Scene04::run() { void Scene04::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS04LeaveScene: _vm->_sceneDone = true; break; case kAS04OpenDoor: - gameSys.insertSequence(0x205, _vm->_gnap->_id, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x205, gnap._id, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x207, 121, 521, 121, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_pos = Common::Point(6, 7); - gameSys.insertSequence(0x107B5, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, - kSeqSyncWait, _vm->getSequenceTotalDuration(0x205) - 1, 450 - _vm->_gnap->_gridX, 336 - _vm->_gnap->_gridY); - gameSys.setAnimation(0x107B5, _vm->_gnap->_id, 0); - _vm->_gnap->_sequenceId = 0x7B5; - _vm->_gnap->_sequenceDatNum = 1; - _vm->_gnap->_actionStatus = kAS04OpenDoorDone; + gnap._pos = Common::Point(6, 7); + gameSys.insertSequence(0x107B5, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, + kSeqSyncWait, _vm->getSequenceTotalDuration(0x205) - 1, 450 - gnap._gridX, 336 - gnap._gridY); + gameSys.setAnimation(0x107B5, gnap._id, 0); + gnap._sequenceId = 0x7B5; + gnap._sequenceDatNum = 1; + gnap._actionStatus = kAS04OpenDoorDone; break; case kAS04OpenDoorDone: gameSys.insertSequence(0x209, 121, 0x207, 121, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS04GetKeyFirst: - gameSys.insertSequence(0x204, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0x204, _vm->_gnap->_id, 0); - _vm->_gnap->_sequenceId = 0x204; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = kAS04GetKeyFirst2; + gameSys.insertSequence(0x204, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x204, gnap._id, 0); + gnap._sequenceId = 0x204; + gnap._sequenceDatNum = 0; + gnap._actionStatus = kAS04GetKeyFirst2; break; case kAS04GetKeyFirst2: - gameSys.insertSequence(0x206, 255, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x206, 255, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 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->_gnap->_sequenceId = 0x206; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = kAS04GetKeyFirstDone; + gnap._sequenceId = 0x206; + gnap._sequenceDatNum = 0; + gnap._actionStatus = kAS04GetKeyFirstDone; break; case kAS04GetKeyFirstDone: gameSys.requestRemoveSequence(0x1FF, 256); gameSys.requestRemoveSequence(0x20B, 256); - gameSys.insertSequence(0x107B5, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), 255, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); - _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->_sequenceId = 0x7B5; - _vm->_gnap->_sequenceDatNum = 1; - _vm->_gnap->_actionStatus = -1; + gameSys.insertSequence(0x107B5, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), 255, + kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); + gnap._idleFacing = kDirBottomRight; + gnap._sequenceId = 0x7B5; + gnap._sequenceDatNum = 1; + gnap._actionStatus = -1; break; case kAS04GetKeyAnother: - gameSys.insertSequence(0x202, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0x202, _vm->_gnap->_id, 0); - _vm->_gnap->_sequenceId = 0x202; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = kAS04GetKeyAnother2; + gameSys.insertSequence(0x202, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x202, gnap._id, 0); + gnap._sequenceId = 0x202; + gnap._sequenceDatNum = 0; + gnap._actionStatus = kAS04GetKeyAnother2; break; case kAS04GetKeyAnother2: - gameSys.insertSequence(0x203, 255, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x203, 255, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 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->_gnap->_sequenceId = 0x203; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = kAS04GetKeyAnotherDone; + gnap._sequenceId = 0x203; + gnap._sequenceDatNum = 0; + gnap._actionStatus = kAS04GetKeyAnotherDone; break; case kAS04GetKeyAnotherDone: gameSys.removeSequence(0x1FF, 256, true); gameSys.removeSequence(0x20A, 256, true); - gameSys.insertSequence(0x107B5, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), 255, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); - _vm->_gnap->_sequenceId = 0x7B5; - _vm->_gnap->_sequenceDatNum = 1; - _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->_actionStatus = -1; + gameSys.insertSequence(0x107B5, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), 255, + kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); + gnap._sequenceId = 0x7B5; + gnap._sequenceDatNum = 1; + gnap._idleFacing = kDirBottomRight; + gnap._actionStatus = -1; break; case kAS04GrabDog: _nextDogSequenceId = 0x201; break; case kAS04GrabAxe: - gameSys.insertSequence(0x211, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x211, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.requestRemoveSequence(0x212, 100); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x211; - _vm->_gnap->_actionStatus = -1; + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x211; + gnap._actionStatus = -1; break; default: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -1808,13 +1816,13 @@ void Scene04::updateAnimations() { gameSys.insertSequence(_nextDogSequenceId, 139 - _dogIdCtr, _currDogSequenceId, 139 - (_dogIdCtr + 1) % 2, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x200, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x200, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextDogSequenceId, 139 - _dogIdCtr, 3); _dogIdCtr = (_dogIdCtr + 1) % 2; _currDogSequenceId = 0x201; - _vm->_gnap->_sequenceId = 0x200; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = -1; + gnap._sequenceId = 0x200; + gnap._sequenceDatNum = 0; + gnap._actionStatus = -1; _vm->_timers[6] = _vm->getRandom(20) + 60; _nextDogSequenceId = -1; } else if (_nextDogSequenceId != -1) { @@ -1865,6 +1873,7 @@ void Scene05::updateHotspots() { void Scene05::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x1091C, true); _vm->startSoundTimerC(7); @@ -1884,15 +1893,15 @@ void Scene05::run() { _vm->queueInsertDeviceIcon(); if (_vm->_prevSceneNum != 6 && _vm->_prevSceneNum != 36) { - _vm->_gnap->initPos(-1, 8, kDirBottomRight); + gnap.initPos(-1, 8, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->initPos(-1, 9, kDirNone); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(Common::Point(2, 8), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(2, 9), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 9), -1, 0x107B9, 1); } else { - _vm->_gnap->initPos(6, 8, kDirBottomRight); + gnap.initPos(6, 8, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->initPos(7, 9, kDirNone); _vm->endSceneInit(); @@ -1909,35 +1918,35 @@ void Scene05::run() { switch (_vm->_sceneClickedHotspot) { case kHS05Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS05Platypus: - if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (gnap._actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->_gnap->useDisguiseOnPlatypus(); + gnap.useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1945,30 +1954,30 @@ void Scene05::run() { break; case kHS05Haystack: - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[1].x - 2, _vm->_hotspotsWalkPos[1].y, 4, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[1].x - 2, _vm->_hotspotsWalkPos[1].y, 4, 5); } else if (_vm->isFlag(kGFNeedleTaken)) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y - 1); + gnap.playScratchingHead(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y - 1); break; case GRAB_CURSOR: case TALK_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case PLAT_CURSOR: if (_vm->isFlag(kGFPlatypus)) { - _vm->_gnap->useDeviceOnPlatypus(); + gnap.useDeviceOnPlatypus(); if (_vm->_plat->walkTo(_vm->_hotspotsWalkPos[1], 1, 0x107C2, 1)) { _vm->_plat->_actionStatus = kAS05PlatSearchHaystack; _vm->_plat->_idleFacing = kDirUnk4; } - if (_vm->_gnap->_pos.x == 4 && (_vm->_gnap->_pos.y == 8 || _vm->_gnap->_pos.y == 7)) - _vm->_gnap->walkStep(); - _vm->_gnap->playIdle(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + if (gnap._pos.x == 4 && (gnap._pos.y == 8 || gnap._pos.y == 7)) + gnap.walkStep(); + gnap.playIdle(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } break; } @@ -1977,31 +1986,31 @@ void Scene05::run() { break; case kHS05Chicken: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTwig) { - _vm->_gnap->_idleFacing = kDirUpRight; + gnap._idleFacing = kDirUpRight; Common::Point checkPt = _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot] + Common::Point(0, 1); - _vm->_gnap->walkTo(checkPt, 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS05UseTwigWithChicken; + gnap.walkTo(checkPt, 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS05UseTwigWithChicken; } else if (_vm->_grabCursorSpriteIndex >= 0) - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, 9, 7); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, 9, 7); else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan2(9, 7); + gnap.playMoan2(9, 7); break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[5], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS05GrabChicken; + gnap._idleFacing = kDirBottomRight; + gnap.walkTo(_vm->_hotspotsWalkPos[5], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS05GrabChicken; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[5], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS05TalkChicken; + gnap._idleFacing = kDirBottomRight; + gnap.walkTo(_vm->_hotspotsWalkPos[5], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS05TalkChicken; break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2009,22 +2018,22 @@ void Scene05::run() { break; case kHS05Ladder: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 5); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan2(2, 4); + gnap.playMoan2(2, 4); break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirBottomLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS05GrabLadder; + gnap._idleFacing = kDirBottomLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS05GrabLadder; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2035,32 +2044,32 @@ void Scene05::run() { if (_vm->isFlag(kGFBarnPadlockOpen)) { _vm->_isLeavingScene = true; Common::Point destPt = _vm->_hotspotsWalkPos[2] + Common::Point(- 1, 1); - _vm->_gnap->walkTo(destPt, 0, -1, 1); - _vm->_gnap->_actionStatus = kAS05EnterBarn; + gnap.walkTo(destPt, 0, -1, 1); + gnap._actionStatus = kAS05EnterBarn; if (_vm->_cursorValue == 1) _vm->_newSceneNum = 6; else _vm->_newSceneNum = 36; - } else if (_vm->_gnap->_actionStatus < 0) { + } else if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemNeedle) { - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, - _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2]) | 0x10000, 1)) - _vm->_gnap->_actionStatus = kAS05PickPadlock; + if (gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, + gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2]) | 0x10000, 1)) + gnap._actionStatus = kAS05PickPadlock; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 7, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 7, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(7, 4); + gnap.playScratchingHead(7, 4); break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS05TryPickPadlock; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS05TryPickPadlock; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2068,10 +2077,10 @@ void Scene05::run() { break; case kHS05ExitHouse: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS05LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107AF, 1); + gnap._actionStatus = kAS05LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(_vm->_hotspotsWalkPos[4] + Common::Point(0, 1), -1, 0x107C7, 1); if (_vm->_cursorValue == 1) @@ -2083,8 +2092,8 @@ void Scene05::run() { case kHS05WalkArea1: case kHS05WalkArea2: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS05WalkArea3: @@ -2092,8 +2101,8 @@ void Scene05::run() { break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2108,10 +2117,10 @@ void Scene05::run() { if (!_vm->_isLeavingScene) { if (_vm->isFlag(kGFPlatypus)) _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(20) + 30; - if (_vm->_gnap->_actionStatus != kAS05TalkChicken && _nextChickenSequenceId == -1) { + if (gnap._actionStatus != kAS05TalkChicken && _nextChickenSequenceId == -1) { if (_vm->getRandom(4) != 0) _nextChickenSequenceId = 0x142; else @@ -2120,7 +2129,7 @@ void Scene05::run() { } if (!_vm->_timers[6]) { _vm->_timers[6] = _vm->getRandom(150) + 300; - if (_vm->_gnap->_actionStatus < 0) + if (gnap._actionStatus < 0) gameSys.insertSequence(0x149, 39, 0, 0, kSeqNone, 0, 0, 0); } _vm->playSoundC(); @@ -2141,36 +2150,37 @@ void Scene05::run() { void Scene05::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS05LeaveScene: _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS05TryPickPadlock: - gameSys.insertSequence(0x148, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x148; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = -1; + gameSys.insertSequence(0x148, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x148; + gnap._sequenceDatNum = 0; + gnap._actionStatus = -1; break; case kAS05PickPadlock: - gameSys.setAnimation(0x147, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x147, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x147; - _vm->_gnap->_sequenceDatNum = 0; + gameSys.setAnimation(0x147, gnap._id, 0); + gameSys.insertSequence(0x147, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x147; + gnap._sequenceDatNum = 0; _vm->setFlag(kGFBarnPadlockOpen); _vm->setFlag(kGFSceneFlag1); _vm->setGrabCursorSprite(-1); _vm->_newSceneNum = 6; _vm->_timers[2] = 100; _vm->invRemove(kItemNeedle); - _vm->_gnap->_actionStatus = kAS05LeaveScene; + gnap._actionStatus = kAS05LeaveScene; break; case kAS05TalkChicken: _nextChickenSequenceId = 0x144; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS05GrabChicken: _nextChickenSequenceId = 0x14B; @@ -2178,25 +2188,25 @@ void Scene05::updateAnimations() { case kAS05GrabLadder: while (gameSys.isSequenceActive(0x149, 39)) _vm->gameUpdateTick(); - gameSys.insertSequence(0x14E, _vm->_gnap->_id + 1, 0, 0, kSeqNone, 0, 0, 0); - gameSys.insertSequence(0x14D, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x14D; - _vm->_gnap->_sequenceDatNum = 0; + gameSys.insertSequence(0x14E, gnap._id + 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x14D, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x14D; + gnap._sequenceDatNum = 0; _vm->_timers[2] = 200; _vm->_timers[6] = 300; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS05EnterBarn: gameSys.insertSequence(0x107B1, 1, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, + kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); gameSys.setAnimation(0x107B1, 1, 0); - _vm->_gnap->_actionStatus = kAS05LeaveScene; + gnap._actionStatus = kAS05LeaveScene; break; case kAS05UseTwigWithChicken: - _vm->_gnap->playShowItem(5, 0, 0); + gnap.playShowItem(5, 0, 0); _nextChickenSequenceId = 0x14F; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -2232,12 +2242,12 @@ void Scene05::updateAnimations() { if (_nextChickenSequenceId == 0x14B) { gameSys.setAnimation(_nextChickenSequenceId, 100, 3); gameSys.insertSequence(_nextChickenSequenceId, 100, _currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x14C, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x14C; + gameSys.insertSequence(0x14C, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x14C; _currChickenSequenceId = _nextChickenSequenceId; _nextChickenSequenceId = -1; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } else if (_nextChickenSequenceId != -1) { gameSys.setAnimation(_nextChickenSequenceId, 100, 3); gameSys.insertSequence(_nextChickenSequenceId, 100, _currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); @@ -2292,6 +2302,7 @@ void Scene06::updateHotspots() { void Scene06::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; bool triedDeviceOnGas = false; _vm->startSoundTimerC(7); @@ -2315,12 +2326,12 @@ void Scene06::run() { _vm->queueInsertDeviceIcon(); - _vm->_gnap->initPos(5, 12, kDirBottomRight); + gnap.initPos(5, 12, kDirBottomRight); _vm->_plat->initPos(6, 12, kDirNone); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(5, 8), -1, 0x107B9, 1); while (!_vm->_sceneDone) { _vm->updateMouseCursor(); @@ -2333,35 +2344,35 @@ void Scene06::run() { switch (_vm->_sceneClickedHotspot) { case kHS06Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS06Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->_gnap->useDisguiseOnPlatypus(); + gnap.useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2369,33 +2380,33 @@ void Scene06::run() { break; case kHS06Gas: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 5, 0); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 5, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(5, 0); + gnap.playScratchingHead(5, 0); break; case GRAB_CURSOR: if (_vm->isFlag(kGFUnk04)) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else if (triedDeviceOnGas) { _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[1], 0, 0x107BC, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[1], 0, 0x107BC, 1); _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; - _vm->_gnap->_actionStatus = kAS06TryToGetGas; + gnap._actionStatus = kAS06TryToGetGas; } else { triedDeviceOnGas = true; - _vm->_gnap->playPullOutDeviceNonWorking(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + gnap.playPullOutDeviceNonWorking(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); } break; case TALK_CURSOR: case PLAT_CURSOR: if (_vm->isFlag(kGFUnk04)) - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); else - _vm->_gnap->playScratchingHead(5, 0); + gnap.playScratchingHead(5, 0); break; } } @@ -2403,26 +2414,26 @@ void Scene06::run() { break; case kHS06Ladder: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(8, 4); + gnap.playScratchingHead(8, 4); break; case GRAB_CURSOR: if (_vm->isFlag(kGFGasTaken)) - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); else { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS06TryToClimbLadder; + gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, 0x107BB, 1); + gnap._actionStatus = kAS06TryToClimbLadder; _vm->setFlag(kGFGasTaken); } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2430,37 +2441,37 @@ void Scene06::run() { break; case kHS06Horse: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTwig && _horseTurnedBack) { _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, 0x107BC, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, 0x107BC, 1); _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; - _vm->_gnap->_idleFacing = kDirUpLeft; + gnap._idleFacing = kDirUpLeft; _vm->_plat->walkTo(Common::Point(6, 8), 1, 0x107C2, 1); _vm->_plat->_idleFacing = kDirNone; - _vm->_gnap->_actionStatus = kAS06UseTwigOnHorse; + gnap._actionStatus = kAS06UseTwigOnHorse; _vm->setGrabCursorSprite(-1); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 3, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 3, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(3, 2); + gnap.playScratchingHead(3, 2); break; case TALK_CURSOR: if (_horseTurnedBack) { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(3, 2)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(3, 2)) | 0x10000, 1); } else { - _vm->_gnap->_idleFacing = kDirBottomLeft; + gnap._idleFacing = kDirBottomLeft; _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; - _vm->_gnap->_actionStatus = kAS06TalkToHorse; + gnap._actionStatus = kAS06TalkToHorse; } break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2468,10 +2479,10 @@ void Scene06::run() { break; case kHS06ExitOutsideBarn: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS06LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107AE, 1); + gnap._actionStatus = kAS06LeaveScene; if (_vm->_cursorValue == 1) _vm->_newSceneNum = 5; else @@ -2484,13 +2495,13 @@ void Scene06::run() { case kHS06WalkArea3: case kHS06WalkArea4: case kHS06WalkArea5: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2502,11 +2513,11 @@ void Scene06::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(40) + 25; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextHorseSequenceId == -1) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextHorseSequenceId == -1) { if (_horseTurnedBack) { _nextHorseSequenceId = 0xF5; } else { @@ -2543,31 +2554,32 @@ void Scene06::run() { void Scene06::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS06LeaveScene: _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS06TryToGetGas: - gameSys.insertSequence(0xFC, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0xFC; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = -1; + gameSys.insertSequence(0xFC, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0xFC; + gnap._sequenceDatNum = 0; + gnap._actionStatus = -1; break; case kAS06TryToClimbLadder: gameSys.insertSequence(0xFF, 20, 0xFE, 20, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0xFD, _vm->_gnap->_id, 0); - gameSys.insertSequence(0xFD, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0xFD; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = kAS06TryToClimbLadderDone; + gameSys.setAnimation(0xFD, gnap._id, 0); + gameSys.insertSequence(0xFD, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0xFD; + gnap._sequenceDatNum = 0; + gnap._actionStatus = kAS06TryToClimbLadderDone; break; case kAS06TryToClimbLadderDone: - _vm->_gnap->_pos = Common::Point(6, 7); - _vm->_gnap->_actionStatus = -1; + gnap._pos = Common::Point(6, 7); + gnap._actionStatus = -1; break; case kAS06TalkToHorse: _nextHorseSequenceId = 0xF6; @@ -2576,7 +2588,7 @@ void Scene06::updateAnimations() { _nextPlatSequenceId = 0xFB; break; default: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -2595,7 +2607,7 @@ void Scene06::updateAnimations() { _vm->_plat->_sequenceId = 0x7C1; _vm->_plat->_sequenceDatNum = 1; _vm->setFlag(kGFUnk04); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _vm->showCursor(); } if (_nextPlatSequenceId == 0xFB) { @@ -2612,16 +2624,16 @@ void Scene06::updateAnimations() { _vm->hideCursor(); gameSys.setAnimation(0xFA, 256, 1); gameSys.insertSequence(0xF2, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x100, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x100, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0xF7, 20, 0xF8, 20, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0xFB, _vm->_plat->_id, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0xFA, 256, 0xFB, _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); _vm->_plat->_sequenceId = 0xFA; _vm->_plat->_sequenceDatNum = 0; - gameSys.insertSequence(0x107B7, _vm->_gnap->_id, 0x100, _vm->_gnap->_id, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); - _vm->_gnap->_sequenceId = 0x7B7; - _vm->_gnap->_sequenceDatNum = 1; + gameSys.insertSequence(0x107B7, gnap._id, 0x100, gnap._id, + kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); + gnap._sequenceId = 0x7B7; + gnap._sequenceDatNum = 1; _currHorseSequenceId = _nextHorseSequenceId; _nextHorseSequenceId = -1; _nextPlatSequenceId = -1; @@ -2633,7 +2645,7 @@ void Scene06::updateAnimations() { _horseTurnedBack = true; _currHorseSequenceId = _nextHorseSequenceId; _nextHorseSequenceId = -1; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; default: gameSys.setAnimation(_nextHorseSequenceId, 120, 2); @@ -2669,6 +2681,7 @@ void Scene07::updateHotspots() { void Scene07::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->queueInsertDeviceIcon(); gameSys.insertSequence(0x8C, 1, 0, 0, kSeqLoop, 0, 0, 0); @@ -2681,18 +2694,18 @@ void Scene07::run() { gameSys.insertSequence(0x8D, 1, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 8) { - _vm->_gnap->initPos(7, 7, kDirBottomLeft); + gnap.initPos(7, 7, kDirBottomLeft); _vm->_plat->initPos(9, 7, kDirUnk4); _vm->endSceneInit(); } else { - _vm->_gnap->_pos = Common::Point(6, 7); - _vm->_gnap->_id = 140; - _vm->_gnap->_sequenceId = 0x8F; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_idleFacing = kDirBottomRight; + gnap._pos = Common::Point(6, 7); + gnap._id = 140; + gnap._sequenceId = 0x8F; + gnap._sequenceDatNum = 0; + gnap._idleFacing = kDirBottomRight; gameSys.insertSequence(0x8F, 140, 0, 0, kSeqNone, 0, 0, 0); - gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); - _vm->_gnap->_actionStatus = kAS07Wait; + gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); + gnap._actionStatus = kAS07Wait; _vm->_plat->_pos = Common::Point(3, 8); _vm->_plat->_id = 160; _vm->_plat->_sequenceId = 0x91; @@ -2722,13 +2735,13 @@ void Scene07::run() { case kHS07Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: @@ -2738,16 +2751,16 @@ void Scene07::run() { case kHS07ExitHouse: _vm->_isLeavingScene = true; - if (_vm->_gnap->_pos.x > 8) - _vm->_gnap->walkTo(Common::Point(_vm->_gnap->_pos.x, 7), 0, 0x107AD, 1); + if (gnap._pos.x > 8) + gnap.walkTo(Common::Point(gnap._pos.x, 7), 0, 0x107AD, 1); else - _vm->_gnap->walkTo(Common::Point(8, 7), 0, 0x107AD, 1); - _vm->_gnap->_actionStatus = kAS07LeaveScene; + gnap.walkTo(Common::Point(8, 7), 0, 0x107AD, 1); + gnap._actionStatus = kAS07LeaveScene; break; case kHS07Dice: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(4, 8, 3, 3); + gnap.playShowCurrItem(4, 8, 3, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2756,25 +2769,25 @@ void Scene07::run() { _vm->setFlag(kGFPlatypus); _vm->invAdd(kItemDice); updateHotspots(); - _vm->_gnap->playPullOutDevice(3, 3); + gnap.playPullOutDevice(3, 3); gameSys.setAnimation(0x8E, 1, 2); gameSys.insertSequence(0x8E, 1, 141, 1, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(_vm->_gnap->getSequenceId(gskUseDevice, Common::Point(0, 0)) | 0x10000, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); - _vm->_gnap->_sequenceId = _vm->_gnap->getSequenceId(gskUseDevice, Common::Point(0, 0)); - _vm->_gnap->_sequenceDatNum = 1; + gameSys.insertSequence(gnap.getSequenceId(gskUseDevice, Common::Point(0, 0)) | 0x10000, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, + kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); + gnap._sequenceId = gnap.getSequenceId(gskUseDevice, Common::Point(0, 0)); + gnap._sequenceDatNum = 1; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } break; case kHS07Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); _vm->_timers[4] = _vm->getRandom(40) + 50; @@ -2783,7 +2796,7 @@ void Scene07::run() { case kHS07WalkArea1: case kHS07WalkArea2: - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS07WalkArea3: @@ -2792,7 +2805,7 @@ void Scene07::run() { default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2801,8 +2814,8 @@ void Scene07::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - _vm->_gnap->updateIdleSequence(); - if (_vm->_plat->_actionStatus < 0 && _vm->_gnap->_actionStatus < 0) { + gnap.updateIdleSequence(); + if (_vm->_plat->_actionStatus < 0 && gnap._actionStatus < 0) { if (_vm->_timers[0]) { if (!_vm->_timers[1]) { _vm->_timers[1] = _vm->getRandom(20) + 30; @@ -2856,16 +2869,17 @@ void Scene07::run() { void Scene07::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS07LeaveScene: _vm->_newSceneNum = 8; _vm->_sceneDone = true; break; } - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } if (gameSys.getAnimationStatus(2) == 2) { @@ -2922,6 +2936,7 @@ void Scene08::updateAnimationsCb() { void Scene08::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->queueInsertDeviceIcon(); @@ -2951,12 +2966,12 @@ void Scene08::run() { if (!_vm->isFlag(kGFTruckKeysUsed)) gameSys.insertSequence(0x146, 1, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->initPos(-1, 8, kDirBottomRight); + gnap.initPos(-1, 8, kDirBottomRight); _vm->_plat->initPos(-1, 7, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(1, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(1, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(1, 7), -1, 0x107C2, 1); _vm->_timers[5] = _vm->getRandom(40) + 50; @@ -2975,7 +2990,7 @@ void Scene08::run() { switch (_vm->_sceneClickedHotspot) { case kHS08Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); _vm->_timers[4] = _vm->getRandom(50) + 75; @@ -2985,21 +3000,21 @@ void Scene08::run() { case kH08SPlatypus: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFSceneFlag1)) - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->kissPlatypus(8); + gnap.actionIdle(0x14D); + gnap.kissPlatypus(8); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: @@ -3010,49 +3025,49 @@ void Scene08::run() { case kHS08ExitBackdoor: _vm->_isLeavingScene = true; - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->walkTo(Common::Point(0, 6), 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS08LeaveScene; + gnap.actionIdle(0x14D); + gnap.walkTo(Common::Point(0, 6), 0, 0x107AF, 1); + gnap._actionStatus = kAS08LeaveScene; _vm->_plat->walkTo(Common::Point(0, 7), 1, 0x107CF, 1); _vm->_newSceneNum = 9; break; case kHS08ExitCrash: _vm->_isLeavingScene = true; - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->walkTo(Common::Point(3, 9), 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS08LeaveScene; + gnap.actionIdle(0x14D); + gnap.walkTo(Common::Point(3, 9), 0, 0x107AE, 1); + gnap._actionStatus = kAS08LeaveScene; _vm->_plat->walkTo(Common::Point(4, 9), 1, 0x107C1, 1); _vm->_newSceneNum = 7; break; case kHS08Man: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(6, 6, 7, 0); + gnap.playShowCurrItem(6, 6, 7, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->walkTo(Common::Point(6, 6), 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS08LookMan; - _vm->_gnap->_idleFacing = kDirUpRight; + gnap.actionIdle(0x14D); + gnap.walkTo(Common::Point(6, 6), 0, 0x107BB, 1); + gnap._actionStatus = kAS08LookMan; + gnap._idleFacing = kDirUpRight; break; case GRAB_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->walkTo(Common::Point(8, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS08TalkMan; + gnap._idleFacing = kDirUpLeft; + gnap.actionIdle(0x14D); + gnap.walkTo(Common::Point(8, 6), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS08TalkMan; break; case PLAT_CURSOR: - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->useDeviceOnPlatypus(); + gnap.actionIdle(0x14D); + gnap.useDeviceOnPlatypus(); _vm->_plat->walkTo(Common::Point(6, 6), 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS08PlatWithMan; _vm->_plat->_idleFacing = kDirNone; - _vm->_gnap->playIdle(6, 6); + gnap.playIdle(6, 6); break; } } @@ -3060,35 +3075,35 @@ void Scene08::run() { case kHS08Door: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(4, 7, 5, 0); - gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); - _vm->_gnap->_actionStatus = kAS08GrabDog; + gnap.playShowCurrItem(4, 7, 5, 0); + gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); + gnap._actionStatus = kAS08GrabDog; } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(6, 0); - gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); - _vm->_gnap->_actionStatus = kAS08LookDog; + gnap.playScratchingHead(6, 0); + gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); + gnap._actionStatus = kAS08LookDog; break; case GRAB_CURSOR: - _vm->_gnap->walkTo(Common::Point(4, 7), 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS08GrabDog; - _vm->_gnap->_idleFacing = kDirUpRight; + gnap.walkTo(Common::Point(4, 7), 0, 0x107BB, 1); + gnap._actionStatus = kAS08GrabDog; + gnap._idleFacing = kDirUpRight; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->walkTo(Common::Point(4, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS08TalkDog; + gnap._idleFacing = kDirUpRight; + gnap.actionIdle(0x14D); + gnap.walkTo(Common::Point(4, 7), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS08TalkDog; break; case PLAT_CURSOR: _vm->setFlag(kGFSceneFlag1); - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->useDeviceOnPlatypus(); + gnap.actionIdle(0x14D); + gnap.useDeviceOnPlatypus(); _vm->_plat->walkTo(Common::Point(3, 7), 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS08PlatWithDog; _vm->_plat->_idleFacing = kDirNone; - _vm->_gnap->playIdle(3, 7); + gnap.playIdle(3, 7); break; } } @@ -3096,25 +3111,25 @@ void Scene08::run() { case kHS08Meat: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(6, 8, 5, 6); + gnap.playShowCurrItem(6, 8, 5, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(6, 7); + gnap.playScratchingHead(6, 7); break; case GRAB_CURSOR: if (_currDogSequenceId == 0x135) { - _vm->_gnap->playScratchingHead(6, 7); + gnap.playScratchingHead(6, 7); } else { - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->playPullOutDevice(6, 7); - _vm->_gnap->playUseDevice(0, 0); + gnap.actionIdle(0x14D); + gnap.playPullOutDevice(6, 7); + gnap.playUseDevice(0, 0); _nextDogSequenceId = 0x149; } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3122,25 +3137,25 @@ void Scene08::run() { case kHS08Bone: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(2, 7, 3, 6); + gnap.playShowCurrItem(2, 7, 3, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(3, 6); + gnap.playScratchingHead(3, 6); break; case GRAB_CURSOR: if (_currDogSequenceId == 0x135) { - _vm->_gnap->playScratchingHead(3, 6); + gnap.playScratchingHead(3, 6); } else { - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->playPullOutDevice(3, 6); - _vm->_gnap->playUseDevice(0, 0); + gnap.actionIdle(0x14D); + gnap.playPullOutDevice(3, 6); + gnap.playUseDevice(0, 0); _nextDogSequenceId = 0x14A; } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3148,25 +3163,25 @@ void Scene08::run() { case kHS08Toy: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(8, 7, 7, 6); + gnap.playShowCurrItem(8, 7, 7, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(7, 6); + gnap.playScratchingHead(7, 6); break; case GRAB_CURSOR: if (_currDogSequenceId == 0x135) { - _vm->_gnap->playScratchingHead(7, 6); + gnap.playScratchingHead(7, 6); } else { - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->playPullOutDevice(7, 6); - _vm->_gnap->playUseDevice(0, 0); + gnap.actionIdle(0x14D); + gnap.playPullOutDevice(7, 6); + gnap.playUseDevice(0, 0); _nextDogSequenceId = 0x14B; } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3174,14 +3189,14 @@ void Scene08::run() { case kHS08WalkArea1: case kHS08WalkArea2: - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->walkTo(Common::Point(-1, 6), -1, -1, 1); + gnap.actionIdle(0x14D); + gnap.walkTo(Common::Point(-1, 6), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.actionIdle(0x14D); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -3191,10 +3206,10 @@ void Scene08::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(50) + 125; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextManSequenceId == -1 && + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextManSequenceId == -1 && (_currDogSequenceId == 0x134 || _currDogSequenceId == 0x135)) { int _gnapRandomValue = _vm->getRandom(4); switch (_gnapRandomValue) { @@ -3232,39 +3247,40 @@ void Scene08::run() { void Scene08::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS08LeaveScene: _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS08TalkMan: _nextManSequenceId = 0x13F; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS08LookMan: _nextManSequenceId = 0x140; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS08LookDog: _nextManSequenceId = 0x137; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS08GrabDog: if (_currDogSequenceId == 0x135) _nextDogSequenceId = 0x133; else _nextDogSequenceId = 0x13C; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS08TalkDog: if (_currDogSequenceId == 0x135) _nextDogSequenceId = 0x133; else _nextDogSequenceId = 0x13C; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -3332,8 +3348,8 @@ void Scene08::updateAnimations() { _vm->_plat->_sequenceId = 0x148; _vm->_plat->_idleFacing = kDirUnk4; _vm->_plat->_sequenceDatNum = 0; - if (_vm->_gnap->_pos == Common::Point(1, 8)) - _vm->_gnap->walkStep(); + if (gnap._pos == Common::Point(1, 8)) + gnap.walkStep(); } else if (_nextDogSequenceId != -1) { gameSys.setAnimation(_nextDogSequenceId, 100, 3); gameSys.insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); @@ -3343,11 +3359,11 @@ void Scene08::updateAnimations() { if (_currDogSequenceId == 0x133) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - gameSys.insertSequence(0x14D, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x14D; - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = -1; + gameSys.insertSequence(0x14D, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x14D; + gnap._idleFacing = kDirUpRight; + gnap._sequenceDatNum = 0; + gnap._actionStatus = -1; } } } @@ -3376,6 +3392,7 @@ void Scene09::updateHotspots() { void Scene09::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->queueInsertDeviceIcon(); @@ -3383,13 +3400,13 @@ void Scene09::run() { gameSys.insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 8) { - _vm->_gnap->initPos(11, 8, kDirBottomLeft); + gnap.initPos(11, 8, kDirBottomLeft); _vm->_plat->initPos(12, 7, kDirUnk4); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(9, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(9, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(9, 7), -1, 0x107D2, 1); } else { - _vm->_gnap->initPos(4, 7, kDirBottomRight); + gnap.initPos(4, 7, kDirBottomRight); _vm->_plat->initPos(5, 7, kDirNone); _vm->endSceneInit(); } @@ -3411,7 +3428,7 @@ void Scene09::run() { switch (_vm->_sceneClickedHotspot) { case kHS09Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); _vm->_timers[4] = _vm->getRandom(150) + 50; @@ -3422,13 +3439,13 @@ void Scene09::run() { case kHS09Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: @@ -3439,8 +3456,8 @@ void Scene09::run() { case kHS09ExitKitchen: _vm->_isLeavingScene = true; _vm->_newSceneNum = 10; - _vm->_gnap->walkTo(Common::Point(4, 7), 0, 0x107BF, 1); - _vm->_gnap->_actionStatus = kAS09LeaveScene; + gnap.walkTo(Common::Point(4, 7), 0, 0x107BF, 1); + gnap._actionStatus = kAS09LeaveScene; _vm->_plat->walkTo(Common::Point(4, 8), -1, 0x107D2, 1); _vm->_plat->_idleFacing = kDirUnk4; break; @@ -3448,27 +3465,27 @@ void Scene09::run() { case kHS09ExitHouse: _vm->_isLeavingScene = true; _vm->_newSceneNum = 8; - _vm->_gnap->walkTo(Common::Point(10, -1), 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS09LeaveScene; + gnap.walkTo(Common::Point(10, -1), 0, 0x107AB, 1); + gnap._actionStatus = kAS09LeaveScene; _vm->_plat->walkTo(Common::Point(10, -1), -1, 0x107CD, 1); _vm->_plat->_idleFacing = kDirUnk4; break; case kHS09Trash: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(9, 6, 8, 0); + gnap.playShowCurrItem(9, 6, 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(8, 3); + gnap.playScratchingHead(8, 3); break; case GRAB_CURSOR: - _vm->_gnap->_actionStatus = kAS09SearchTrash; - _vm->_gnap->walkTo(Common::Point(9, 6), 0, 0x107BC, 1); + gnap._actionStatus = kAS09SearchTrash; + gnap.walkTo(Common::Point(9, 6), 0, 0x107BC, 1); break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3477,12 +3494,12 @@ void Scene09::run() { case kHS09WalkArea1: case kHS09WalkArea2: case kHS09WalkArea3: - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -3490,9 +3507,9 @@ void Scene09::run() { updateAnimations(); - if (!_vm->_isLeavingScene && _vm->_gnap->_actionStatus != 1 && _vm->_gnap->_actionStatus != 2) { + if (!_vm->_isLeavingScene && gnap._actionStatus != 1 && gnap._actionStatus != 2) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(150) + 100; if (_vm->_timers[4] & 1) @@ -3519,30 +3536,31 @@ void Scene09::run() { void Scene09::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS09LeaveScene: _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS09SearchTrash: gameSys.setAnimation(0x4C, 120, 0); - gameSys.insertSequence(0x4C, 120, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x4C, 120, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(0x4B, 2, true); - _vm->_gnap->_sequenceId = 0x4C; - _vm->_gnap->_id = 120; - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_pos = Common::Point(9, 6); - _vm->_gnap->_actionStatus = kAS09SearchTrashDone; + gnap._sequenceId = 0x4C; + gnap._id = 120; + gnap._idleFacing = kDirUpLeft; + gnap._sequenceDatNum = 0; + gnap._pos = Common::Point(9, 6); + gnap._actionStatus = kAS09SearchTrashDone; break; case kAS09SearchTrashDone: gameSys.insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[2] = 360; _vm->_timers[4] = _vm->getRandom(150) + 100; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index aa55e1dcf5..d8b2a3ce28 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -59,6 +59,7 @@ void Scene10::updateHotspots() { void Scene10::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _currCookSequenceId = 0x103; @@ -72,16 +73,16 @@ void Scene10::run() { _vm->queueInsertDeviceIcon(); if (_vm->_prevSceneNum == 9) { - _vm->_gnap->initPos(11, 8, kDirBottomLeft); + gnap.initPos(11, 8, kDirBottomLeft); _vm->_plat->initPos(12, 7, kDirUnk4); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(9, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(9, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(9, 7), -1, 0x107D2, 1); } else { - _vm->_gnap->initPos(-1, 7, kDirBottomRight); + gnap.initPos(-1, 7, kDirBottomRight); _vm->_plat->initPos(-2, 8, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(1, 7), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(1, 7), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); } @@ -107,20 +108,20 @@ void Scene10::run() { switch (_vm->_sceneClickedHotspot) { case kHS10Platypus: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFMudTaken)) - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(10); + gnap.kissPlatypus(10); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: @@ -131,48 +132,48 @@ void Scene10::run() { case kHS10ExitBar: _vm->_isLeavingScene = true; - _vm->_gnap->actionIdle(0x10C); - _vm->_gnap->walkTo(Common::Point(0, 7), 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS10LeaveScene; + gnap.actionIdle(0x10C); + gnap.walkTo(Common::Point(0, 7), 0, 0x107AF, 1); + gnap._actionStatus = kAS10LeaveScene; _vm->_plat->walkTo(Common::Point(0, 7), -1, 0x107CF, 1); _vm->_newSceneNum = 11; break; case kHS10ExitBackdoor: _vm->_isLeavingScene = true; - _vm->_gnap->actionIdle(0x10C); - _vm->_gnap->walkTo(Common::Point(2, 9), 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS10LeaveScene; + gnap.actionIdle(0x10C); + gnap.walkTo(Common::Point(2, 9), 0, 0x107AE, 1); + gnap._actionStatus = kAS10LeaveScene; _vm->_plat->walkTo(Common::Point(3, 9), -1, 0x107C7, 1); _vm->_newSceneNum = 9; break; case kHS10Cook: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(4, 8, 6, 0); - gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); - _vm->_gnap->_actionStatus = kAS10AnnoyCook; + gnap.playShowCurrItem(4, 8, 6, 0); + gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); + gnap._actionStatus = kAS10AnnoyCook; } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(6, 0); + gnap.playScratchingHead(6, 0); break; case GRAB_CURSOR: - _vm->_gnap->playImpossible(0, 0); - _vm->_gnap->_idleFacing = kDirBottomRight; + gnap.playImpossible(0, 0); + gnap._idleFacing = kDirBottomRight; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->actionIdle(0x10C); - _vm->_gnap->walkTo(Common::Point(4, 8), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS10AnnoyCook; + gnap._idleFacing = kDirUpRight; + gnap.actionIdle(0x10C); + gnap.walkTo(Common::Point(4, 8), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS10AnnoyCook; break; case PLAT_CURSOR: - _vm->_gnap->actionIdle(0x10C); - _vm->_gnap->useDeviceOnPlatypus(); + gnap.actionIdle(0x10C); + gnap.useDeviceOnPlatypus(); _vm->_plat->walkTo(Common::Point(4, 6), -1, -1, 1); - _vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS10AnnoyCook; + gnap.walkTo(Common::Point(4, 8), 0, 0x107BB, 1); + gnap._actionStatus = kAS10AnnoyCook; break; } } @@ -180,36 +181,36 @@ void Scene10::run() { case kHS10Tongs: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(3, 7, 4, 0); + gnap.playShowCurrItem(3, 7, 4, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFMudTaken)) - _vm->_gnap->playMoan2(-1, -1); + gnap.playMoan2(-1, -1); else - _vm->_gnap->playScratchingHead(4, 3); + gnap.playScratchingHead(4, 3); break; case GRAB_CURSOR: if (_vm->isFlag(kGFMudTaken)) - _vm->_gnap->playMoan2(-1, -1); + gnap.playMoan2(-1, -1); else { - _vm->_gnap->actionIdle(0x10C); - _vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS10AnnoyCook; + gnap.actionIdle(0x10C); + gnap.walkTo(Common::Point(4, 8), 0, 0x107BB, 1); + gnap._actionStatus = kAS10AnnoyCook; } break; case TALK_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case PLAT_CURSOR: if (_vm->isFlag(kGFMudTaken)) - _vm->_gnap->playMoan2(-1, -1); + gnap.playMoan2(-1, -1); else { - _vm->_gnap->actionIdle(0x10C); - _vm->_gnap->useDeviceOnPlatypus(); + gnap.actionIdle(0x10C); + gnap.useDeviceOnPlatypus(); _vm->_plat->walkTo(Common::Point(3, 7), -1, -1, 1); - _vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS10AnnoyCook; + gnap.walkTo(Common::Point(4, 8), 0, 0x107BB, 1); + gnap._actionStatus = kAS10AnnoyCook; } break; } @@ -218,33 +219,33 @@ void Scene10::run() { case kHS10Box: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(7, 6, 6, 0); + gnap.playShowCurrItem(7, 6, 6, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(7, 3); + gnap.playScratchingHead(7, 3); break; case GRAB_CURSOR: - _vm->_gnap->actionIdle(0x10C); - _vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS10AnnoyCook; + gnap.actionIdle(0x10C); + gnap.walkTo(Common::Point(4, 8), 0, 0x107BB, 1); + gnap._actionStatus = kAS10AnnoyCook; break; case TALK_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case PLAT_CURSOR: if (_vm->isFlag(kGFMudTaken)) - _vm->_gnap->playMoan2(-1, -1); + gnap.playMoan2(-1, -1); else { _vm->invAdd(kItemTongs); _vm->setFlag(kGFMudTaken); - _vm->_gnap->actionIdle(0x10C); - _vm->_gnap->useDeviceOnPlatypus(); + gnap.actionIdle(0x10C); + gnap.useDeviceOnPlatypus(); _vm->_plat->walkTo(Common::Point(7, 6), 1, 0x107D2, 1); _vm->_plat->_actionStatus = kAS10PlatWithBox; _vm->_plat->_idleFacing = kDirUnk4; _vm->_largeSprite = gameSys.createSurface(0xC3); - _vm->_gnap->playIdle(7, 6); + gnap.playIdle(7, 6); } break; } @@ -253,26 +254,26 @@ void Scene10::run() { case kHS10Oven: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(9, 6, 10, 0); + gnap.playShowCurrItem(9, 6, 10, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, Common::Point(10, 5)) | 0x10000); + gnap.playSequence(gnap.getSequenceId(gskDeflect, Common::Point(10, 5)) | 0x10000); break; case GRAB_CURSOR: - _vm->_gnap->actionIdle(0x10C); - _vm->_gnap->walkTo(Common::Point(9, 6), 0, 0x107BB, 1); - gameSys.insertSequence(0x10E, 120, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x10E; - _vm->_gnap->_id = 120; - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_pos = Common::Point(9, 6); + gnap.actionIdle(0x10C); + gnap.walkTo(Common::Point(9, 6), 0, 0x107BB, 1); + gameSys.insertSequence(0x10E, 120, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x10E; + gnap._id = 120; + gnap._idleFacing = kDirUpRight; + gnap._sequenceDatNum = 0; + gnap._pos = Common::Point(9, 6); _vm->_timers[2] = 360; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -282,12 +283,12 @@ void Scene10::run() { case kHS10WalkArea2: case kHS10WalkArea3: case kHS10WalkArea4: - _vm->_gnap->actionIdle(0x10C); - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.actionIdle(0x10C); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS10Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } @@ -295,8 +296,8 @@ void Scene10::run() { default: if (_vm->_mouseClickState._left) { - _vm->_gnap->actionIdle(0x10C); - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.actionIdle(0x10C); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -306,7 +307,7 @@ void Scene10::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(80) + 150; _vm->playSound(0x12B, false); @@ -342,10 +343,11 @@ void Scene10::run() { void Scene10::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS10LeaveScene: _vm->_sceneDone = true; break; @@ -400,8 +402,8 @@ void Scene10::updateAnimations() { _vm->setGrabCursorSprite(kItemTongs); if (_vm->_plat->_actionStatus == kAS10PlatWithBox) _vm->_plat->_actionStatus = -1; - if (_vm->_gnap->_pos == Common::Point(4, 8)) - _vm->_gnap->walkStep(); + if (gnap._pos == Common::Point(4, 8)) + gnap.walkStep(); break; default: gameSys.insertSequence(_nextCookSequenceId, 100, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); @@ -411,7 +413,7 @@ void Scene10::updateAnimations() { switch (_currCookSequenceId) { case 0x106: - if (_vm->_gnap->_actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) + if (gnap._actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) _nextCookSequenceId = 0x106; else { int rnd = _vm->getRandom(7); @@ -432,7 +434,7 @@ void Scene10::updateAnimations() { } break; case 0x103: - if (_vm->_gnap->_actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) + if (gnap._actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) _nextCookSequenceId = 0x106; else if (_vm->getRandom(7) == 0) _nextCookSequenceId = 0x104; @@ -440,7 +442,7 @@ void Scene10::updateAnimations() { _nextCookSequenceId = 0x106; break; case 0x104: - if (_vm->_gnap->_actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) + if (gnap._actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) _nextCookSequenceId = 0x106; else if (_vm->getRandom(7) == 0) _nextCookSequenceId = 0x103; @@ -448,7 +450,7 @@ void Scene10::updateAnimations() { _nextCookSequenceId = 0x106; break; case 0x105: - if (_vm->_gnap->_actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) + if (gnap._actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) _nextCookSequenceId = 0x106; else { int rnd = _vm->getRandom(7); @@ -465,11 +467,11 @@ void Scene10::updateAnimations() { } _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = 300; - gameSys.insertSequence(0x10C, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x10C; - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = -1; + gameSys.insertSequence(0x10C, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x10C; + gnap._idleFacing = kDirUpRight; + gnap._sequenceDatNum = 0; + gnap._actionStatus = -1; _vm->_plat->_actionStatus = -1; break; } @@ -533,6 +535,8 @@ void Scene11::updateHotspots() { void Scene11::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; + bool flag = true; _vm->_timers[7] = 50; @@ -543,22 +547,22 @@ void Scene11::run() { switch (_vm->_prevSceneNum) { case 13: - _vm->_gnap->initPos(8, 5, kDirBottomLeft); + gnap.initPos(8, 5, kDirBottomLeft); _vm->_plat->initPos(9, 6, kDirUnk4); break; case 47: - _vm->_gnap->initPos(8, 5, kDirBottomLeft); + gnap.initPos(8, 5, kDirBottomLeft); _vm->_plat->initPos(9, 5, kDirUnk4); _currGoggleGuySequenceId = 0x1FA; _currHookGuySequenceId = 0x1FF; _vm->_timers[7] = 180; break; case 12: - _vm->_gnap->initPos(-1, 9, kDirBottomRight); + gnap.initPos(-1, 9, kDirBottomRight); _vm->_plat->initPos(-2, 8, kDirNone); break; default: - _vm->_gnap->initPos(6, 6, kDirBottomLeft); + gnap.initPos(6, 6, kDirBottomLeft); _vm->_plat->initPos(6, 5, kDirUnk4); break; } @@ -582,7 +586,7 @@ void Scene11::run() { _vm->endSceneInit(); if (_vm->_prevSceneNum == 12) { - _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); } @@ -600,17 +604,17 @@ void Scene11::run() { switch (_vm->_sceneClickedHotspot) { case kHS11Platypus: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: @@ -621,49 +625,49 @@ void Scene11::run() { case kHS11ExitKitchen: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(6, 5), 0, 0x107BF, 1); - _vm->_gnap->_actionStatus = kAS11LeaveScene; + gnap.walkTo(Common::Point(6, 5), 0, 0x107BF, 1); + gnap._actionStatus = kAS11LeaveScene; _vm->_plat->walkTo(Common::Point(6, 6), -1, -1, 1); _vm->_newSceneNum = 10; break; case kHS11ExitToilet: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(8, 5), 0, 0x107BF, 1); - _vm->_gnap->_actionStatus = kAS11LeaveScene; + gnap.walkTo(Common::Point(8, 5), 0, 0x107BF, 1); + gnap._actionStatus = kAS11LeaveScene; _vm->_plat->walkTo(Common::Point(8, 6), -1, -1, 1); _vm->_newSceneNum = 13; break; case kHS11ExitLeft: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(-1, 8), 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS11LeaveScene; + gnap.walkTo(Common::Point(-1, 8), 0, 0x107AF, 1); + gnap._actionStatus = kAS11LeaveScene; _vm->_plat->walkTo(Common::Point(-1, 9), -1, 0x107CF, 1); _vm->_newSceneNum = 12; break; case kHS11GoggleGuy: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemMagazine) { - _vm->_gnap->walkTo(Common::Point(3, 7), 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS11ShowMagazineToGoggleGuy; - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 2, 0); + gnap.walkTo(Common::Point(3, 7), 0, 0x107BC, 1); + gnap._actionStatus = kAS11ShowMagazineToGoggleGuy; + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 2, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(3, 7, 2, 0); + gnap.playShowCurrItem(3, 7, 2, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(1, 6); + gnap.playScratchingHead(1, 6); break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(Common::Point(3, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS11TalkGoggleGuy; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(Common::Point(3, 7), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS11TalkGoggleGuy; break; } } @@ -671,28 +675,28 @@ void Scene11::run() { break; case kHS11HookGuy: - if (_vm->_gnap->_actionStatus < 0) { - _vm->_gnap->_idleFacing = kDirUpRight; + if (gnap._actionStatus < 0) { + gnap._idleFacing = kDirUpRight; if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->walkTo(Common::Point(5, 6), 0, 0x107BC, 9); - _vm->_gnap->_actionStatus = kAS11ShowItemToHookGuy; - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 4, 0); + gnap.walkTo(Common::Point(5, 6), 0, 0x107BC, 9); + gnap._actionStatus = kAS11ShowItemToHookGuy; + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 4, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, Common::Point(3, 6)) | 0x10000); + gnap.playSequence(gnap.getSequenceId(gskDeflect, Common::Point(3, 6)) | 0x10000); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(Common::Point(5, 6), 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS11GrabHookGuy; + gnap.walkTo(Common::Point(5, 6), 0, 0x107BC, 1); + gnap._actionStatus = kAS11GrabHookGuy; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirBottomLeft; - _vm->_gnap->walkTo(Common::Point(5, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS11TalkHookGuy; + gnap._idleFacing = kDirBottomLeft; + gnap.walkTo(Common::Point(5, 6), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS11TalkHookGuy; break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -700,21 +704,21 @@ void Scene11::run() { break; case kHS11Billard: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(9, 8); + gnap.playImpossible(9, 8); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(9, 8); + gnap.playScratchingHead(9, 8); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(Common::Point(9, 8), 0, 0x107BA, 1); - _vm->_gnap->_actionStatus = kAS11GrabBillardBall; + gnap.walkTo(Common::Point(9, 8), 0, 0x107BA, 1); + gnap._actionStatus = kAS11GrabBillardBall; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(9, 8); + gnap.playImpossible(9, 8); break; } } @@ -726,20 +730,20 @@ void Scene11::run() { case kHS11WalkArea3: case kHS11WalkArea4: case kHS11WalkArea5: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS11Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -755,10 +759,10 @@ void Scene11::run() { gameSys.insertSequence(0x207, 257, 0, 0, kSeqNone, 0, 0, 0); } _vm->_plat->updateIdleSequence2(); - _vm->_gnap->updateIdleSequence2(); + gnap.updateIdleSequence2(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(100) + 75; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextGoggleGuySequenceId == -1) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextGoggleGuySequenceId == -1) { if (_vm->getRandom(2)) _nextGoggleGuySequenceId = 0x1F6; else @@ -767,7 +771,7 @@ void Scene11::run() { } if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(40) + 20; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextHookGuySequenceId == -1) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextHookGuySequenceId == -1) { if (_currHookGuySequenceId == 0x201) { switch (_vm->getRandom(7)) { case 0: @@ -821,11 +825,12 @@ void Scene11::run() { void Scene11::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { - if (_vm->_gnap->_actionStatus != kAS11GrabBillardBall) + if (gnap._actionStatus != kAS11GrabBillardBall) gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS11LeaveScene: _vm->_sceneDone = true; break; @@ -849,10 +854,10 @@ void Scene11::updateAnimations() { gameSys.setAnimation(0, 0, 0); _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - gameSys.insertSequence(0x1F4, 255, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x1F4; - _vm->_gnap->_id = 255; - _vm->_gnap->_sequenceDatNum = 0; + gameSys.insertSequence(0x1F4, 255, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x1F4; + gnap._id = 255; + gnap._sequenceDatNum = 0; gameSys.removeSequence(0x207, 257, true); gameSys.removeSequence(0x208, 256, true); _nextGoggleGuySequenceId = 0x1F8; @@ -882,7 +887,7 @@ void Scene11::updateAnimations() { _vm->_hotspots[kHS11Billard]._flags |= SF_DISABLED; gameSys.setAnimation(0x207, 257, 4); gameSys.insertSequence(0x207, 257, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(0x1FE), 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } break; } @@ -894,32 +899,32 @@ void Scene11::updateAnimations() { gameSys.setAnimation(_nextGoggleGuySequenceId, 121, 2); _currGoggleGuySequenceId = _nextGoggleGuySequenceId; _nextGoggleGuySequenceId = -1; - if (_vm->_gnap->_actionStatus >= 1 && _vm->_gnap->_actionStatus <= 4) - _vm->_gnap->_actionStatus = -1; + if (gnap._actionStatus >= 1 && gnap._actionStatus <= 4) + gnap._actionStatus = -1; } if (gameSys.getAnimationStatus(3) == 2) { if (_nextHookGuySequenceId == 0x204) { gameSys.setAnimation(_nextHookGuySequenceId, 120, 3); gameSys.insertSequence(0x204, 120, _currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x1F5, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x1F5, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); _currHookGuySequenceId = 0x204; _nextHookGuySequenceId = -1; - _vm->_gnap->_sequenceId = 0x1F5; - _vm->_gnap->_sequenceDatNum = 0; + gnap._sequenceId = 0x1F5; + gnap._sequenceDatNum = 0; _vm->_timers[4] = _vm->getRandom(40) + 20; _vm->_timers[2] = _vm->getRandom(20) + 70; _vm->_timers[3] = _vm->getRandom(50) + 200; - if (_vm->_gnap->_actionStatus == kAS11GrabHookGuy) - _vm->_gnap->_actionStatus = -1; + if (gnap._actionStatus == kAS11GrabHookGuy) + gnap._actionStatus = -1; } else if (_nextHookGuySequenceId != -1) { 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; - if (_vm->_gnap->_actionStatus >= 6 && _vm->_gnap->_actionStatus <= 9) - _vm->_gnap->_actionStatus = -1; + if (gnap._actionStatus >= 6 && gnap._actionStatus <= 9) + gnap._actionStatus = -1; } } @@ -961,6 +966,7 @@ void Scene12::updateHotspots() { void Scene12::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; int v18 = 1; _vm->queueInsertDeviceIcon(); @@ -991,14 +997,14 @@ void Scene12::run() { _vm->_timers[7] = _vm->getRandom(100) + 100; if (_vm->_prevSceneNum == 15) { - _vm->_gnap->initPos(5, 6, kDirBottomRight); + gnap.initPos(5, 6, kDirBottomRight); _vm->_plat->initPos(3, 7, kDirNone); _vm->endSceneInit(); } else { - _vm->_gnap->initPos(11, 8, kDirBottomLeft); + gnap.initPos(11, 8, kDirBottomLeft); _vm->_plat->initPos(12, 8, kDirUnk4); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); } @@ -1014,7 +1020,7 @@ void Scene12::run() { switch (_vm->_sceneClickedHotspot) { case kHS12Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } @@ -1023,13 +1029,13 @@ void Scene12::run() { case kHS12Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: @@ -1039,8 +1045,8 @@ void Scene12::run() { case kHS12ExitRight: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(10, -1), 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS12LeaveScene; + gnap.walkTo(Common::Point(10, -1), 0, 0x107AB, 1); + gnap._actionStatus = kAS12LeaveScene; _vm->_plat->walkTo(Common::Point(10, -1), -1, -1, 1); _vm->_newSceneNum = 11; break; @@ -1048,41 +1054,41 @@ void Scene12::run() { case kHS12ToothGuy: if (_vm->_grabCursorSpriteIndex == kItemQuarter) { _vm->_largeSprite = gameSys.createSurface(0x141); - _vm->_gnap->walkTo(Common::Point(3, 7), 0, 0x107BC, 9); - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->_actionStatus = kAS12QuarterToToothGuy; - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 2, 0); + gnap.walkTo(Common::Point(3, 7), 0, 0x107BC, 9); + gnap._idleFacing = kDirUpLeft; + gnap._actionStatus = kAS12QuarterToToothGuy; + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 2, 0); _vm->setGrabCursorSprite(-1); } else if (_vm->_grabCursorSpriteIndex == kItemQuarterWithHole) { - _vm->_gnap->walkTo(Common::Point(3, 7), 0, 0x107BC, 9); - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->_actionStatus = kAS12QuarterWithHoleToToothGuy; - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 2, 0); + gnap.walkTo(Common::Point(3, 7), 0, 0x107BC, 9); + gnap._idleFacing = kDirUpLeft; + gnap._actionStatus = kAS12QuarterWithHoleToToothGuy; + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 2, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->walkTo(Common::Point(3, 7), 0, 0x107BC, 9); - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->_actionStatus = kAS12ShowItemToToothGuy; - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 2, 0); + gnap.walkTo(Common::Point(3, 7), 0, 0x107BC, 9); + gnap._idleFacing = kDirUpLeft; + gnap._actionStatus = kAS12ShowItemToToothGuy; + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 2, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(1, 2); + gnap.playScratchingHead(1, 2); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(Common::Point(3, 7), 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS12GrabToothGuy; + gnap.walkTo(Common::Point(3, 7), 0, 0x107BC, 1); + gnap._actionStatus = kAS12GrabToothGuy; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(Common::Point(3, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS12TalkToothGuy; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(Common::Point(3, 7), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS12TalkToothGuy; break; case PLAT_CURSOR: - _vm->_gnap->useDeviceOnPlatypus(); + gnap.useDeviceOnPlatypus(); _vm->_plat->walkTo(Common::Point(3, 7), 1, 0x107D2, 1); _vm->_plat->_actionStatus = kAS12PlatWithToothGuy; _vm->_plat->_idleFacing = kDirUnk4; - _vm->_gnap->playIdle(2, 7); + gnap.playIdle(2, 7); break; } } @@ -1090,34 +1096,34 @@ void Scene12::run() { case kHS12Barkeeper: if (_vm->_grabCursorSpriteIndex == kItemQuarter || _vm->_grabCursorSpriteIndex == kItemQuarterWithHole) { - _vm->_gnap->walkTo(Common::Point(6, 6), 0, 0x107BB, 9); - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_actionStatus = kAS12QuarterWithBarkeeper; - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 7, 0); + gnap.walkTo(Common::Point(6, 6), 0, 0x107BB, 9); + gnap._idleFacing = kDirUpRight; + gnap._actionStatus = kAS12QuarterWithBarkeeper; + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 7, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->walkTo(Common::Point(6, 6), 0, 0x107BB, 9); - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_actionStatus = kAS12ShowItemToBarkeeper; - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 7, 0); + gnap.walkTo(Common::Point(6, 6), 0, 0x107BB, 9); + gnap._idleFacing = kDirUpRight; + gnap._actionStatus = kAS12ShowItemToBarkeeper; + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 7, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->walkTo(Common::Point(6, 6), 0, 0x107BB, 1); - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_actionStatus = kAS12LookBarkeeper; + gnap.walkTo(Common::Point(6, 6), 0, 0x107BB, 1); + gnap._idleFacing = kDirUpRight; + gnap._actionStatus = kAS12LookBarkeeper; break; case GRAB_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(Common::Point(6, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS12TalkBarkeeper; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(Common::Point(6, 6), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS12TalkBarkeeper; break; case PLAT_CURSOR: - _vm->_gnap->playPullOutDevice(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); - _vm->_gnap->_actionStatus = kAS12PlatWithBarkeeper; + gnap.playPullOutDevice(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); + gnap._actionStatus = kAS12PlatWithBarkeeper; break; } } @@ -1125,34 +1131,34 @@ void Scene12::run() { case kHS12BeardGuy: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->walkTo(Common::Point(7, 6), 0, 0x107BB, 9); - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_actionStatus = kAS12ShowItemToBeardGuy; - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 8, 0); + gnap.walkTo(Common::Point(7, 6), 0, 0x107BB, 9); + gnap._idleFacing = kDirUpRight; + gnap._actionStatus = kAS12ShowItemToBeardGuy; + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->walkTo(Common::Point(7, 6), 0, 0x107BB, 1); - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_actionStatus = kAS12LookBeardGuy; + gnap.walkTo(Common::Point(7, 6), 0, 0x107BB, 1); + gnap._idleFacing = kDirUpRight; + gnap._actionStatus = kAS12LookBeardGuy; break; case GRAB_CURSOR: // NOTE Bug in the original. It has 9 as flags which seems wrong here. - _vm->_gnap->walkTo(Common::Point(7, 6), 0, 0x107BB, 1); - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_actionStatus = kAS12GrabBeardGuy; + gnap.walkTo(Common::Point(7, 6), 0, 0x107BB, 1); + gnap._idleFacing = kDirUpRight; + gnap._actionStatus = kAS12GrabBeardGuy; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(Common::Point(7, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS12TalkBeardGuy; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(Common::Point(7, 6), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS12TalkBeardGuy; break; case PLAT_CURSOR: - _vm->_gnap->useDeviceOnPlatypus(); + gnap.useDeviceOnPlatypus(); _vm->_plat->walkTo(Common::Point(7, 6), 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS12PlatWithBeardGuy; _vm->_plat->_idleFacing = kDirNone; - _vm->_gnap->playIdle(7, 6); + gnap.playIdle(7, 6); break; } } @@ -1161,21 +1167,21 @@ void Scene12::run() { case kHS12Jukebox: _vm->_newSceneNum = 15; _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(5, 6), 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS12LeaveScene; + gnap.walkTo(Common::Point(5, 6), 0, 0x107BC, 1); + gnap._actionStatus = kAS12LeaveScene; break; case kHS12WalkArea1: case kHS12WalkArea2: case kHS12WalkArea3: case kHS12WalkArea4: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1186,11 +1192,11 @@ void Scene12::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = 15; if (_nextToothGuySequenceId == -1) { - if (v18 == 0 && _currBeardGuySequenceId == 0x202 && _currBarkeeperSequenceId == 0x203 && _vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (v18 == 0 && _currBeardGuySequenceId == 0x202 && _currBarkeeperSequenceId == 0x203 && gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { if (_vm->getRandom(2) != 0) _nextToothGuySequenceId = 0x1EC; else @@ -1202,8 +1208,8 @@ void Scene12::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(30) + 20; - if (_nextBarkeeperSequenceId == -1 && _vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { - if (v18 == 0 && _currToothGuySequenceId == 0x200 && _currBeardGuySequenceId == 0x202 && _vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (_nextBarkeeperSequenceId == -1 && gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (v18 == 0 && _currToothGuySequenceId == 0x200 && _currBeardGuySequenceId == 0x202 && gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { if (_vm->getRandom(2) != 0) _nextBarkeeperSequenceId = 0x208; else @@ -1215,8 +1221,8 @@ void Scene12::run() { } if (!_vm->_timers[6]) { _vm->_timers[6] = _vm->getRandom(30) + 15; - if (_nextBeardGuySequenceId == -1 && _vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { - if (v18 == 0 && _currToothGuySequenceId == 0x200 && _currBarkeeperSequenceId == 0x203 && _vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) + if (_nextBeardGuySequenceId == -1 && gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (v18 == 0 && _currToothGuySequenceId == 0x200 && _currBarkeeperSequenceId == 0x203 && gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) _nextBeardGuySequenceId = 0x1F2; else _nextBeardGuySequenceId = 0x202; @@ -1257,10 +1263,11 @@ void Scene12::run() { void Scene12::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS12LeaveScene: _vm->_sceneDone = true; break; @@ -1308,7 +1315,7 @@ void Scene12::updateAnimations() { } break; case kAS12QuarterToToothGuyDone: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _vm->showCursor(); gameSys.removeSpriteDrawItem(_vm->_largeSprite, 300); _vm->deleteSurface(&_vm->_largeSprite); @@ -1367,13 +1374,13 @@ void Scene12::updateAnimations() { gameSys.setAnimation(0, 0, 2); _vm->hideCursor(); gameSys.setAnimation(0x10843, 301, 0); - _vm->_gnap->_actionStatus = kAS12QuarterToToothGuyDone; + gnap._actionStatus = kAS12QuarterToToothGuyDone; gameSys.insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); - gameSys.insertSequence(0x10843, 301, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x107B7, _vm->_gnap->_id, 0x10843, 301, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); - _vm->_gnap->_sequenceId = 0x7B7; - _vm->_gnap->_sequenceDatNum = 1; + gameSys.insertSequence(0x10843, 301, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x107B7, gnap._id, 0x10843, 301, + kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); + gnap._sequenceId = 0x7B7; + gnap._sequenceDatNum = 1; _vm->setFlag(kGFTwigTaken); _vm->invAdd(kItemQuarterWithHole); _vm->invRemove(kItemQuarter); @@ -1381,34 +1388,34 @@ void Scene12::updateAnimations() { if (_nextToothGuySequenceId == 0x1EF) { gameSys.setAnimation(_nextToothGuySequenceId, 50, 2); gameSys.insertSequence(_nextToothGuySequenceId, 50, _currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x205, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x205, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); _currToothGuySequenceId = _nextToothGuySequenceId; _nextToothGuySequenceId = -1; - _vm->_gnap->_sequenceId = 0x205; - _vm->_gnap->_sequenceDatNum = 0; + gnap._sequenceId = 0x205; + gnap._sequenceDatNum = 0; _vm->_timers[4] = 40; _vm->_timers[2] = _vm->getRandom(20) + 70; _vm->_timers[3] = _vm->getRandom(50) + 200; - if (_vm->_gnap->_actionStatus == kAS12GrabToothGuy) - _vm->_gnap->_actionStatus = -1; + if (gnap._actionStatus == kAS12GrabToothGuy) + gnap._actionStatus = -1; } else if (_nextToothGuySequenceId != -1) { gameSys.insertSequence(_nextToothGuySequenceId, 50, _currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextToothGuySequenceId, 50, 2); _currToothGuySequenceId = _nextToothGuySequenceId; _nextToothGuySequenceId = -1; _vm->_timers[4] = 50; - if (_vm->_gnap->_actionStatus >= kAS12TalkToothGuy && _vm->_gnap->_actionStatus <= kAS12QuarterToToothGuy && _currToothGuySequenceId != 0x1E9 && + if (gnap._actionStatus >= kAS12TalkToothGuy && gnap._actionStatus <= kAS12QuarterToToothGuy && _currToothGuySequenceId != 0x1E9 && _currToothGuySequenceId != 0x1EC && _currToothGuySequenceId != 0x200) - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; if (_vm->_plat->_actionStatus == kAS12PlatWithToothGuy) _vm->_plat->_actionStatus = -1; } } if (gameSys.getAnimationStatus(3) == 2) { - if (_vm->_gnap->_actionStatus == kAS12PlatWithBarkeeper && _currBarkeeperSequenceId == 0x1F9) { - _vm->_gnap->_actionStatus = -1; - _vm->_gnap->playIdle(7, 6); + if (gnap._actionStatus == kAS12PlatWithBarkeeper && _currBarkeeperSequenceId == 0x1F9) { + gnap._actionStatus = -1; + gnap.playIdle(7, 6); _vm->_timers[5] = 0; } if (_nextBarkeeperSequenceId != -1) { @@ -1417,9 +1424,9 @@ void Scene12::updateAnimations() { _currBarkeeperSequenceId = _nextBarkeeperSequenceId; _nextBarkeeperSequenceId = -1; _vm->_timers[5] = _vm->getRandom(30) + 20; - if (_vm->_gnap->_actionStatus >= kAS12TalkBarkeeper && _vm->_gnap->_actionStatus <= kAS12QuarterWithBarkeeper && _currBarkeeperSequenceId != 0x203 && + if (gnap._actionStatus >= kAS12TalkBarkeeper && gnap._actionStatus <= kAS12QuarterWithBarkeeper && _currBarkeeperSequenceId != 0x203 && _currBarkeeperSequenceId != 0x1FB && _currBarkeeperSequenceId != 0x208) - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } } @@ -1429,8 +1436,8 @@ void Scene12::updateAnimations() { _currBeardGuySequenceId = _nextBeardGuySequenceId; _nextBeardGuySequenceId = -1; _vm->_timers[6] = _vm->getRandom(30) + 20; - if (_vm->_gnap->_actionStatus >= kAS12TalkBeardGuy && _vm->_gnap->_actionStatus <= kAS12ShowItemToBeardGuy && _currBeardGuySequenceId != 0x202 && _currBeardGuySequenceId != 0x1F2) - _vm->_gnap->_actionStatus = -1; + if (gnap._actionStatus >= kAS12TalkBeardGuy && gnap._actionStatus <= kAS12ShowItemToBeardGuy && _currBeardGuySequenceId != 0x202 && _currBeardGuySequenceId != 0x1F2) + gnap._actionStatus = -1; if (_vm->_plat->_actionStatus == kAS12PlatWithBeardGuy) _vm->_plat->_actionStatus = -1; } @@ -1488,17 +1495,18 @@ void Scene13::showScribble() { void Scene13::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; + int currSoundId = 0; _vm->queueInsertDeviceIcon(); - gameSys.insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 14) { - _vm->_gnap->initPos(6, 6, kDirBottomLeft); + gnap.initPos(6, 6, kDirBottomLeft); _vm->_plat->initPos(9, 8, kDirNone); } else { - _vm->_gnap->initPos(3, 7, kDirBottomRight); + gnap.initPos(3, 7, kDirBottomRight); _vm->_plat->initPos(2, 7, kDirNone); } @@ -1521,7 +1529,7 @@ void Scene13::run() { switch (_vm->_sceneClickedHotspot) { case kHS13Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); _vm->_timers[4] = _vm->getRandom(20) + 20; @@ -1532,13 +1540,13 @@ void Scene13::run() { case kHS13Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: @@ -1548,8 +1556,8 @@ void Scene13::run() { case kHS13ExitBar: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(2, 7), 0, 0x107C0, 1); - _vm->_gnap->_actionStatus = kAS13LeaveScene; + gnap.walkTo(Common::Point(2, 7), 0, 0x107C0, 1); + gnap._actionStatus = kAS13LeaveScene; _vm->_plat->walkTo(Common::Point(2, 8), -1, -1, 1); if (_vm->isFlag(kGFUnk14) || _vm->isFlag(kGFSpringTaken)) { _vm->_newSceneNum = 11; @@ -1561,30 +1569,30 @@ void Scene13::run() { case kHS13BackToilet: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(5, 5, 6, 0); + gnap.playShowCurrItem(5, 5, 6, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: case TALK_CURSOR: - if (_vm->_gnap->_pos == Common::Point(5, 5)) { + if (gnap._pos == Common::Point(5, 5)) { _backToiletCtr = MIN(5, _backToiletCtr + 1); - gameSys.setAnimation(_backToiletCtr + 0xA3, _vm->_gnap->_id, 0); - gameSys.insertSequence(_backToiletCtr + 0xA3, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, + gameSys.setAnimation(_backToiletCtr + 0xA3, gnap._id, 0); + gameSys.insertSequence(_backToiletCtr + 0xA3, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqScale | kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_actionStatus = kAS13Wait; - _vm->_gnap->_sequenceId = _backToiletCtr + 0xA3; - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_sequenceDatNum = 0; + gnap._actionStatus = kAS13Wait; + gnap._sequenceId = _backToiletCtr + 0xA3; + gnap._idleFacing = kDirUpRight; + gnap._sequenceDatNum = 0; } else { - _vm->_gnap->walkTo(Common::Point(5, 5), 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS13BackToilet; - _vm->_gnap->_idleFacing = kDirUpRight; + gnap.walkTo(Common::Point(5, 5), 0, 0x107BB, 1); + gnap._actionStatus = kAS13BackToilet; + gnap._idleFacing = kDirUpRight; } break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1592,16 +1600,16 @@ void Scene13::run() { case kHS13FrontToilet: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(6, 7, 7, 0); + gnap.playShowCurrItem(6, 7, 7, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->walkTo(Common::Point(6, 7), 0, 0xA9, 5); - _vm->_gnap->_actionStatus = kAS13FrontToilet; - _vm->_gnap->_idleFacing = kDirBottomRight; + gnap.walkTo(Common::Point(6, 7), 0, 0xA9, 5); + gnap._actionStatus = kAS13FrontToilet; + gnap._idleFacing = kDirBottomRight; break; } } @@ -1609,23 +1617,23 @@ void Scene13::run() { case kHS13Scribble: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(7, 7, 8, 0); + gnap.playShowCurrItem(7, 7, 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->walkTo(Common::Point(7, 7), 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS13LookScribble; - _vm->_gnap->_idleFacing = kDirUpRight; + gnap.walkTo(Common::Point(7, 7), 0, 0x107BB, 1); + gnap._actionStatus = kAS13LookScribble; + gnap._idleFacing = kDirUpRight; break; case GRAB_CURSOR: - _vm->_gnap->playScratchingHead(0, 0); + gnap.playScratchingHead(0, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(Common::Point(7, 7), -1, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)), 1); + gnap._idleFacing = kDirUpRight; + gnap.walkTo(Common::Point(7, 7), -1, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)), 1); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1633,21 +1641,21 @@ void Scene13::run() { case kHS13Urinal: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(8, 7, 9, 0); + gnap.playShowCurrItem(8, 7, 9, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, Common::Point(9, 6))); - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, -1, 1); - _vm->_gnap->_actionStatus = kAS13Wait; + gnap.playSequence(gnap.getSequenceId(gskDeflect, Common::Point(9, 6))); + gnap.walkTo(gnap._pos, 0, -1, 1); + gnap._actionStatus = kAS13Wait; break; case GRAB_CURSOR: - _vm->_gnap->walkTo(Common::Point(8, 7), 0, -1, 1); - _vm->_gnap->_actionStatus = kAS13GrabUrinal; + gnap.walkTo(Common::Point(8, 7), 0, -1, 1); + gnap._actionStatus = kAS13GrabUrinal; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1655,21 +1663,21 @@ void Scene13::run() { case kHS13Sink: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, Common::Point(5, 9))); - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, -1, 1); - _vm->_gnap->_actionStatus = kAS13Wait; + gnap.playSequence(gnap.getSequenceId(gskDeflect, Common::Point(5, 9))); + gnap.walkTo(gnap._pos, 0, -1, 1); + gnap._actionStatus = kAS13Wait; break; case GRAB_CURSOR: - _vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107B9, 1); - _vm->_gnap->_actionStatus = kAS13GrabSink; + gnap.walkTo(Common::Point(4, 8), 0, 0x107B9, 1); + gnap._actionStatus = kAS13GrabSink; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1683,7 +1691,7 @@ void Scene13::run() { case kHS13WalkArea7: case kHS13WalkArea8: case kHS13WalkArea9: - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS13WalkArea1: @@ -1692,7 +1700,7 @@ void Scene13::run() { default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1704,8 +1712,8 @@ void Scene13::run() { _vm->_plat->updateIdleSequence(); if (_vm->_plat->_pos.y == 5 || _vm->_plat->_pos.y == 6) _vm->_plat->walkTo(Common::Point(-1, 7), -1, -1, 1); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 20; switch (_vm->getRandom(5)) { @@ -1769,58 +1777,59 @@ void Scene13::run() { void Scene13::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS13LeaveScene: _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS13BackToilet: _backToiletCtr = MIN(5, _backToiletCtr + 1); - gameSys.insertSequence(_backToiletCtr + 0xA3, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 9, 0, 0, 0); - _vm->_gnap->_sequenceId = _backToiletCtr + 0xA3; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = -1; + gameSys.insertSequence(_backToiletCtr + 0xA3, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 9, 0, 0, 0); + gnap._sequenceId = _backToiletCtr + 0xA3; + gnap._sequenceDatNum = 0; + gnap._actionStatus = -1; break; case kAS13FrontToilet: _vm->_sceneDone = true; _vm->_newSceneNum = 14; break; case kAS13LookScribble: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; showScribble(); break; case kAS13GrabSink: gameSys.setAnimation(0xAB, 160, 0); - gameSys.insertSequence(0xAB, 160, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xAB, 160, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(0xAA, 256, true); - _vm->_gnap->_sequenceId = 0xAB; - _vm->_gnap->_id = 160; - _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_pos = Common::Point(4, 8); + gnap._sequenceId = 0xAB; + gnap._id = 160; + gnap._idleFacing = kDirBottomRight; + gnap._sequenceDatNum = 0; + gnap._pos = Common::Point(4, 8); _vm->_timers[2] = 360; - _vm->_gnap->_actionStatus = kAS13GrabSinkDone; + gnap._actionStatus = kAS13GrabSinkDone; break; case kAS13GrabSinkDone: gameSys.insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS13Wait: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS13GrabUrinal: gameSys.setAnimation(0xA2, 120, 0); - gameSys.insertSequence(0xA2, 120, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0xA2; - _vm->_gnap->_id = 120; - _vm->_gnap->_idleFacing = kDirBottomLeft; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_pos = Common::Point(4, 6); + gameSys.insertSequence(0xA2, 120, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0xA2; + gnap._id = 120; + gnap._idleFacing = kDirBottomLeft; + gnap._sequenceDatNum = 0; + gnap._pos = Common::Point(4, 6); _vm->_timers[2] = 360; - _vm->_gnap->_actionStatus = kAS13Wait; + gnap._actionStatus = kAS13Wait; break; } } @@ -1857,6 +1866,7 @@ void Scene14::updateHotspots() { void Scene14::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->_largeSprite = nullptr; _vm->queueInsertDeviceIcon(); @@ -1871,7 +1881,7 @@ void Scene14::run() { if (!_vm->isFlag(kGFNeedleTaken)) { gameSys.insertSequence(0x24, 10, 0x23, 10, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x24; + gnap._sequenceId = 0x24; _vm->_timers[2] = _vm->getRandom(40) + 50; } @@ -1884,7 +1894,7 @@ void Scene14::run() { switch (_vm->_sceneClickedHotspot) { case kHS14Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } @@ -1902,7 +1912,7 @@ void Scene14::run() { _vm->setGrabCursorSprite(-1); _vm->hideCursor(); gameSys.setAnimation(0x26, 10, 0); - gameSys.insertSequence(0x26, 10, _vm->_gnap->_sequenceId, 10, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x26, 10, gnap._sequenceId, 10, kSeqSyncWait, 0, 0, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playSound(0x108E9, false); } else { @@ -1911,15 +1921,15 @@ void Scene14::run() { _vm->playSound(0x108E9, false); break; case GRAB_CURSOR: - gameSys.insertSequence(0x25, 10, _vm->_gnap->_sequenceId, 10, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x25, 10, gnap._sequenceId, 10, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x23, 10, 0x25, 10, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x23; + gnap._sequenceId = 0x23; break; case TALK_CURSOR: _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - gnap._gridX, 576 - gnap._gridY); break; } } @@ -1927,7 +1937,7 @@ void Scene14::run() { case kHS14Toilet: if (_vm->_grabCursorSpriteIndex >= 0) { - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - gnap._gridX, 576 - gnap._gridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1938,7 +1948,7 @@ void Scene14::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - gnap._gridX, 576 - gnap._gridY); break; } } @@ -1953,8 +1963,8 @@ void Scene14::run() { _vm->checkGameKeys(); if (!_vm->isFlag(kGFNeedleTaken) && !_vm->_timers[2]) { - gameSys.insertSequence(0x24, 10, _vm->_gnap->_sequenceId, 10, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x24; + gameSys.insertSequence(0x24, 10, gnap._sequenceId, 10, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x24; _vm->_timers[2] = _vm->getRandom(40) + 50; } @@ -2029,6 +2039,7 @@ void Scene15::updateHotspots() { void Scene15::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _currSlotSequenceId = -1; _currUpperButtonSequenceId = -1; @@ -2060,7 +2071,7 @@ void Scene15::run() { switch (_vm->_sceneClickedHotspot) { case kHS15Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } @@ -2077,7 +2088,7 @@ void Scene15::run() { } else if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { _nextSlotSequenceId = 0xDB; } else if (_vm->_grabCursorSpriteIndex >= 0) { - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - gnap._gridX, 576 - gnap._gridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2088,7 +2099,7 @@ void Scene15::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - gnap._gridX, 576 - gnap._gridY); break; } } @@ -2096,7 +2107,7 @@ void Scene15::run() { case kHS15PlayButton: if (_vm->_grabCursorSpriteIndex >= 0) { - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - gnap._gridX, 576 - gnap._gridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2115,7 +2126,7 @@ void Scene15::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - gnap._gridX, 576 - gnap._gridY); break; } } @@ -2128,7 +2139,7 @@ void Scene15::run() { case kHS15Button5: case kHS15Button6: if (_vm->_grabCursorSpriteIndex >= 0) { - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - gnap._gridX, 576 - gnap._gridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2141,7 +2152,7 @@ void Scene15::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - gnap._gridX, 576 - gnap._gridY); break; } } @@ -2154,7 +2165,7 @@ void Scene15::run() { case kHS15ButtonE: case kHS15ButtonF: if (_vm->_grabCursorSpriteIndex >= 0) { - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - gnap._gridX, 576 - gnap._gridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2167,7 +2178,7 @@ void Scene15::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - gnap._gridX, 576 - gnap._gridY); break; } } @@ -2338,10 +2349,12 @@ void Scene17::update() { void Scene17::platHangUpPhone() { GameSys& gameSys = *_vm->_gameSys; - int savedGnapActionStatus = _vm->_gnap->_actionStatus; + PlayerGnap& gnap = *_vm->_gnap; + + int savedGnapActionStatus = gnap._actionStatus; if (_vm->_plat->_actionStatus == kAS17PlatPhoningAssistant) { - _vm->_gnap->_actionStatus = kAS17PlatHangUpPhone; + gnap._actionStatus = kAS17PlatHangUpPhone; _vm->updateMouseCursor(); _platPhoneCtr = 0; _vm->_plat->_actionStatus = -1; @@ -2358,7 +2371,7 @@ void Scene17::platHangUpPhone() { _vm->clearFlag(kGFPlatypusTalkingToAssistant); while (gameSys.getAnimationStatus(1) != 2) _vm->gameUpdateTick(); - _vm->_gnap->_actionStatus = savedGnapActionStatus; + gnap._actionStatus = savedGnapActionStatus; _vm->updateMouseCursor(); } updateHotspots(); @@ -2366,6 +2379,7 @@ void Scene17::platHangUpPhone() { void Scene17::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x10940, true); _vm->startSoundTimerA(8); @@ -2424,13 +2438,13 @@ void Scene17::run() { if (_vm->_prevSceneNum == 53 || _vm->_prevSceneNum == 18 || _vm->_prevSceneNum == 20 || _vm->_prevSceneNum == 19) { if (_vm->_prevSceneNum == 20) { - _vm->_gnap->initPos(4, 6, kDirBottomRight); + gnap.initPos(4, 6, kDirBottomRight); _vm->_plat->initPos(5, 6, kDirNone); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(5, 9), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(4, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(4, 8), -1, 0x107B9, 1); } else if (_vm->isFlag(kGFUnk27)) { - _vm->_gnap->initPos(3, 9, kDirUpLeft); + gnap.initPos(3, 9, kDirUpLeft); _vm->_plat->_pos = _vm->_hotspotsWalkPos[2]; _vm->_plat->_id = 20 * _vm->_hotspotsWalkPos[2].y; gameSys.insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); @@ -2450,12 +2464,12 @@ void Scene17::run() { _vm->clearFlag(kGFSpringTaken); _vm->clearFlag(kGFUnk16); _vm->_plat->initPos(7, 9, kDirNone); - _vm->_gnap->_pos = _vm->_hotspotsWalkPos[2]; - _vm->_gnap->_id = 20 * _vm->_hotspotsWalkPos[2].y; + gnap._pos = _vm->_hotspotsWalkPos[2]; + gnap._id = 20 * _vm->_hotspotsWalkPos[2].y; gameSys.insertSequence(601, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 601; - _vm->_gnap->_actionStatus = kAS17GnapHangUpPhone; + gnap._sequenceDatNum = 0; + gnap._sequenceId = 601; + gnap._actionStatus = kAS17GnapHangUpPhone; _vm->clearFlag(kGFUnk25); gameSys.insertSequence(0x251, 254, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); @@ -2465,7 +2479,7 @@ void Scene17::run() { _vm->clearFlag(kGFSpringTaken); _vm->clearFlag(kGFUnk16); _vm->_sceneWaiting = true; - _vm->_gnap->initPos(3, 9, kDirUpLeft); + gnap.initPos(3, 9, kDirUpLeft); _vm->_plat->_pos = _vm->_hotspotsWalkPos[2]; _vm->_plat->_id = 20 * _vm->_hotspotsWalkPos[2].y; _currPhoneSequenceId = 0x251; @@ -2478,18 +2492,18 @@ void Scene17::run() { _vm->_plat->_actionStatus = kAS17PlatPhoningAssistant; updateHotspots(); } else if (_vm->_prevSceneNum == 18) { - _vm->_gnap->initPos(6, 6, kDirBottomRight); + gnap.initPos(6, 6, kDirBottomRight); _vm->_plat->initPos(5, 6, kDirNone); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(5, 9), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(4, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(4, 8), -1, 0x107B9, 1); } else { if (_vm->isFlag(kGFSpringTaken)) { - _vm->_gnap->initPos(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, kDirBottomRight); + gnap.initPos(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, kDirBottomRight); _vm->_plat->initPos(1, 9, kDirNone); _vm->endSceneInit(); } else { - _vm->_gnap->initPos(3, 7, kDirBottomRight); + gnap.initPos(3, 7, kDirBottomRight); _vm->_plat->initPos(1, 7, kDirNone); _vm->endSceneInit(); } @@ -2498,12 +2512,12 @@ void Scene17::run() { _vm->endSceneInit(); } } else { - _vm->_gnap->_pos = Common::Point(3, 6); - _vm->_gnap->_id = 120; - _vm->_gnap->_sequenceId = 0x23D; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_idleFacing = kDirBottomRight; - gameSys.insertSequence(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0, 0, kSeqNone, 0, 0, 0); + gnap._pos = Common::Point(3, 6); + gnap._id = 120; + gnap._sequenceId = 0x23D; + gnap._sequenceDatNum = 0; + gnap._idleFacing = kDirBottomRight; + gameSys.insertSequence(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0, 0, kSeqNone, 0, 0, 0); _vm->_plat->_pos = Common::Point(-1, 8); _vm->_plat->_id = 160; gameSys.insertSequence(0x241, 160, 0, 0, kSeqNone, 0, 0, 0); @@ -2527,41 +2541,41 @@ void Scene17::run() { switch (_vm->_sceneClickedHotspot) { case kHS17Device: - if (_vm->_gnap->_actionStatus < 0 || _vm->_gnap->_actionStatus == 3) { + if (gnap._actionStatus < 0 || gnap._actionStatus == 3) { _vm->runMenu(); updateHotspots(); } break; case kHS17Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { if (_vm->isFlag(kGFGrassTaken)) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else { - _vm->_gnap->useDeviceOnPlatypus(); + gnap.useDeviceOnPlatypus(); _vm->_plat->walkTo(_vm->_hotspotsWalkPos[6], 1, 0x107C2, 1); - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[6] + Common::Point(1, 0), 0, 0x107BA, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[6] + Common::Point(1, 0), 0, 0x107BA, 1); _vm->_plat->_actionStatus = kAS17GetWrench1; - _vm->_gnap->_actionStatus = kAS17GetWrench1; + gnap._actionStatus = kAS17GetWrench1; _vm->_timers[5] = _vm->getRandom(30) + 80; _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemJoint); } } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2569,30 +2583,30 @@ void Scene17::run() { break; case kHS17Wrench: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFGrassTaken)) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 7); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 7); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: - _vm->_gnap->playScratchingHead(8, 7); + gnap.playScratchingHead(8, 7); break; case TALK_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case PLAT_CURSOR: if (_canTryGetWrench) { platHangUpPhone(); - _vm->_gnap->useDeviceOnPlatypus(); + gnap.useDeviceOnPlatypus(); _vm->_plat->walkTo(_vm->_hotspotsWalkPos[6] + Common::Point(1, 0), 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS17TryGetWrench; - _vm->_gnap->_actionStatus = kAS17TryGetWrench; + gnap._actionStatus = kAS17TryGetWrench; _vm->_timers[5] = _vm->getRandom(30) + 80; } else - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2600,40 +2614,40 @@ void Scene17::run() { break; case kHS17Phone1: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS17PutCoinIntoPhone; + gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS17PutCoinIntoPhone; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(1, 3); + gnap.playScratchingHead(1, 3); break; case GRAB_CURSOR: if (_vm->isFlag(kGFUnk18)) { platHangUpPhone(); - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2]) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS17GetCoinFromPhone; + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2]) | 0x10000, 1); + gnap._actionStatus = kAS17GetCoinFromPhone; } else - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case PLAT_CURSOR: if (_vm->isFlag(kGFUnk18)) { platHangUpPhone(); _vm->_isLeavingScene = true; - _vm->_gnap->useDeviceOnPlatypus(); + gnap.useDeviceOnPlatypus(); _vm->_plat->_idleFacing = kDirUpLeft; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[2], 1, 0x107C2, 1); _vm->setFlag(kGFUnk16); _vm->_plat->_actionStatus = kAS17PlatUsePhone; - _vm->_gnap->_actionStatus = kAS17PlatUsePhone; + gnap._actionStatus = kAS17PlatUsePhone; } else - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2641,43 +2655,43 @@ void Scene17::run() { break; case kHS17Phone2: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS17PutCoinIntoPhone; + gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS17PutCoinIntoPhone; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(1, 3); + gnap.playScratchingHead(1, 3); break; case GRAB_CURSOR: if (_vm->isFlag(kGFUnk18)) { platHangUpPhone(); _vm->_isLeavingScene = true; - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS17GnapUsePhone; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS17GnapUsePhone; _vm->setFlag(kGFSpringTaken); } else - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case PLAT_CURSOR: if (_vm->isFlag(kGFUnk18)) { platHangUpPhone(); _vm->_isLeavingScene = true; - _vm->_gnap->useDeviceOnPlatypus(); + gnap.useDeviceOnPlatypus(); _vm->_plat->_idleFacing = kDirUpLeft; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[2], 1, 0x107C2, 1); _vm->setFlag(kGFUnk16); _vm->_plat->_actionStatus = kAS17PlatUsePhone; - _vm->_gnap->_actionStatus = kAS17PlatUsePhone; + gnap._actionStatus = kAS17PlatUsePhone; } else - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2685,25 +2699,25 @@ void Scene17::run() { break; case kHS17ExitToyStore: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 18; - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[5], 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS17LeaveScene; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[5], 0, 0x107BB, 1); + gnap._actionStatus = kAS17LeaveScene; if (_vm->_plat->_actionStatus != kAS17PlatPhoningAssistant) _vm->_plat->walkTo(_vm->_hotspotsWalkPos[5] + Common::Point(-1, 0), -1, 0x107C2, 1); } break; case kHS17ExitGrubCity: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { platHangUpPhone(); _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS17LeaveScene; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, 0x107BC, 1); + gnap._actionStatus = kAS17LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[3] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -2711,13 +2725,13 @@ void Scene17::run() { case kHS17WalkArea1: case kHS17WalkArea2: case kHS17WalkArea3: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = 0; } break; @@ -2731,15 +2745,15 @@ void Scene17::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0) _vm->_plat->updateIdleSequence2(); - _vm->_gnap->updateIdleSequence2(); + gnap.updateIdleSequence2(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 200; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) gameSys.insertSequence(0x22B, 21, 0, 0, kSeqNone, 0, 0, 0); } if (!_vm->_timers[7]) { _vm->_timers[7] = _vm->getRandom(100) + 100; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { switch (_vm->getRandom(3)) { case 0: gameSys.insertSequence(0x25C, 255, 0, 0, kSeqNone, 0, 0, 0); @@ -2829,51 +2843,52 @@ void Scene17::updateAnimations() { }; GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS17GetWrench1: - _vm->_gnap->_actionStatus = kAS17GetWrenchGnapReady; + gnap._actionStatus = kAS17GetWrenchGnapReady; break; case kAS17GetCoinFromPhone: - _vm->_gnap->playPullOutDevice(1, 3); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(1, 3); + gnap.playUseDevice(0, 0); gameSys.setAnimation(0x250, 100, 0); gameSys.insertSequence(0x250, 100, 591, 100, kSeqSyncWait, 0, 0, 0); _vm->invAdd(kItemDiceQuarterHole); _vm->clearFlag(kGFUnk18); - _vm->_gnap->_actionStatus = kAS17GetCoinFromPhoneDone; + gnap._actionStatus = kAS17GetCoinFromPhoneDone; break; case kAS17GetCoinFromPhoneDone: _vm->setGrabCursorSprite(kItemDiceQuarterHole); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS17PutCoinIntoPhone: - gameSys.setAnimation(0x24C, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x24C, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x24C; + gameSys.setAnimation(0x24C, gnap._id, 0); + gameSys.insertSequence(0x24C, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x24C; _vm->invRemove(kItemDiceQuarterHole); _vm->setGrabCursorSprite(-1); _vm->setFlag(kGFUnk18); - _vm->_gnap->_actionStatus = kAS17PutCoinIntoPhoneDone; + gnap._actionStatus = kAS17PutCoinIntoPhoneDone; break; case kAS17PutCoinIntoPhoneDone: gameSys.insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS17GnapUsePhone: - gameSys.setAnimation(0x24D, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x24D, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_actionStatus = kAS17LeaveScene; + gameSys.setAnimation(0x24D, gnap._id, 0); + gameSys.insertSequence(0x24D, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._actionStatus = kAS17LeaveScene; _vm->_newSceneNum = 53; break; case kAS17GnapHangUpPhone: - gameSys.insertSequence(0x258, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x258; - _vm->_gnap->_actionStatus = -1; + gameSys.insertSequence(0x258, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x258; + gnap._actionStatus = -1; break; case kAS17LeaveScene: _vm->_sceneDone = true; @@ -2944,7 +2959,7 @@ void Scene17::updateAnimations() { if (gameSys.getAnimationStatus(2) == 2) { switch (_nextWrenchSequenceId) { case 0x233: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; gameSys.insertSequence(0x243, _vm->_plat->_id, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); @@ -2956,7 +2971,7 @@ void Scene17::updateAnimations() { gameSys.setAnimation(0x243, _vm->_plat->_id, 1); break; case 0x234: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; gameSys.insertSequence(0x242, _vm->_plat->_id, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); @@ -2991,7 +3006,7 @@ void Scene17::updateAnimations() { _nextWrenchSequenceId = -1; break; case 0x230: - if (_vm->_gnap->_actionStatus == kAS17GetWrenchGnapReady) { + if (gnap._actionStatus == kAS17GetWrenchGnapReady) { gameSys.setAnimation(0, 0, 2); if (_canTryGetWrench) { gameSys.insertSequence(0x22E, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); @@ -2999,15 +3014,15 @@ void Scene17::updateAnimations() { _canTryGetWrench = false; } gameSys.setAnimation(0x23F, _vm->_plat->_id, 1); - gameSys.insertSequence(0x10875, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x10875, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x23F, _vm->_plat->_id, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 1; + gnap._sequenceDatNum = 1; _vm->_plat->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x875; + gnap._sequenceId = 0x875; _vm->_plat->_sequenceId = 0x23F; - _vm->_gnap->walkTo(Common::Point(3, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(3, 8), -1, 0x107B9, 1); _vm->_plat->_actionStatus = kAS17GetWrench2; } break; @@ -3050,9 +3065,9 @@ void Scene17::updateAnimations() { gameSys.insertSequence(0x230, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(_nextCarWindowSequenceId, 40, _currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x240, _vm->_plat->_id, _vm->_plat->_sequenceId, _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x23E, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x23E; - _vm->_gnap->_sequenceDatNum = 0; + gameSys.insertSequence(0x23E, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x23E; + gnap._sequenceDatNum = 0; _vm->_plat->_sequenceId = 0x240; _vm->_plat->_sequenceDatNum = 0; gameSys.setAnimation(0x24A, 40, 3); @@ -3072,7 +3087,7 @@ void Scene17::updateAnimations() { _currWrenchSequenceId = 0x22D; _nextWrenchSequenceId = -1; _vm->setFlag(kGFGrassTaken); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _vm->_plat->_actionStatus = 2; updateHotspots(); _vm->_timers[5] = _vm->getRandom(30) + 80; @@ -3160,13 +3175,14 @@ void Scene18::updateHotspots() { void Scene18::gnapCarryGarbageCanTo(int gridX) { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; int gnapSeqId, gnapId, gnapDatNum, gnapGridX; int destGridX, direction; int curGridX = (_vm->_leftClickMouseX - _vm->_gridMinX + 37) / 75; - if (curGridX >= _vm->_gnap->_pos.x) + if (curGridX >= gnap._pos.x) destGridX = curGridX - 1; else destGridX = curGridX + 1; @@ -3181,30 +3197,30 @@ void Scene18::gnapCarryGarbageCanTo(int gridX) { if (nextGridX >= destGridX) nextGridX = destGridX; - if (nextGridX == _vm->_gnap->_pos.x) { - gnapSeqId = _vm->_gnap->_sequenceId; - gnapId = _vm->_gnap->_id; - gnapDatNum = _vm->_gnap->_sequenceDatNum; - gnapGridX = _vm->_gnap->_pos.x; - if (_vm->_gnap->_pos.x <= curGridX) + if (nextGridX == gnap._pos.x) { + gnapSeqId = gnap._sequenceId; + gnapId = gnap._id; + gnapDatNum = gnap._sequenceDatNum; + gnapGridX = gnap._pos.x; + if (gnap._pos.x <= curGridX) direction = 1; else direction = -1; } else { - if (_vm->_gnap->_pos.y == _vm->_plat->_pos.y) { - if (nextGridX >= _vm->_gnap->_pos.x) { - if (nextGridX >= _vm->_plat->_pos.x && _vm->_gnap->_pos.x <= _vm->_plat->_pos.x) + if (gnap._pos.y == _vm->_plat->_pos.y) { + if (nextGridX >= gnap._pos.x) { + if (nextGridX >= _vm->_plat->_pos.x && gnap._pos.x <= _vm->_plat->_pos.x) _vm->_plat->makeRoom(); - } else if (nextGridX <= _vm->_plat->_pos.x && _vm->_gnap->_pos.x >= _vm->_plat->_pos.x) { + } else if (nextGridX <= _vm->_plat->_pos.x && gnap._pos.x >= _vm->_plat->_pos.x) { _vm->_plat->makeRoom(); } } - gnapSeqId = _vm->_gnap->_sequenceId; - gnapId = _vm->_gnap->_id; - gnapDatNum = _vm->_gnap->_sequenceDatNum; - gnapGridX = _vm->_gnap->_pos.x; + gnapSeqId = gnap._sequenceId; + gnapId = gnap._id; + gnapDatNum = gnap._sequenceDatNum; + gnapGridX = gnap._pos.x; int seqId; - if (nextGridX < _vm->_gnap->_pos.x) { + if (nextGridX < gnap._pos.x) { direction = -1; seqId = 0x204; } else { @@ -3212,14 +3228,14 @@ void Scene18::gnapCarryGarbageCanTo(int gridX) { seqId = 0x203; } - int seqId2 = 20 * _vm->_gnap->_pos.y + 1; + int seqId2 = 20 * gnap._pos.y + 1; do { - if (_vm->isPointBlocked(gnapGridX + direction, _vm->_gnap->_pos.y)) + if (_vm->isPointBlocked(gnapGridX + direction, gnap._pos.y)) break; seqId2 += direction; gameSys.insertSequence(seqId, seqId2, gnapSeqId | (gnapDatNum << 16), gnapId, - kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); + kSeqSyncWait, 0, 75 * gnapGridX - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); gnapSeqId = seqId; gnapId = seqId2; gnapDatNum = 0; @@ -3228,51 +3244,52 @@ void Scene18::gnapCarryGarbageCanTo(int gridX) { } if (direction == 1) - _vm->_gnap->_sequenceId = 0x20A; + gnap._sequenceId = 0x20A; else - _vm->_gnap->_sequenceId = 0x209; - _vm->_gnap->_sequenceDatNum = 0; + gnap._sequenceId = 0x209; + gnap._sequenceDatNum = 0; if (direction == 1) - _vm->_gnap->_idleFacing = kDirBottomRight; + gnap._idleFacing = kDirBottomRight; else - _vm->_gnap->_idleFacing = kDirBottomLeft; + gnap._idleFacing = kDirBottomLeft; - _vm->_gnap->_id = 20 * _vm->_gnap->_pos.y + 1; + gnap._id = 20 * gnap._pos.y + 1; - gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); - gameSys.insertSequence(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, + gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); + gameSys.insertSequence(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, gnapSeqId | (gnapDatNum << 16), gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); + kSeqScale | kSeqSyncWait, 0, 75 * gnapGridX - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); - _vm->_gnap->_pos.x = gnapGridX; + gnap._pos.x = gnapGridX; } void Scene18::putDownGarbageCan(int animationIndex) { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (animationIndex >= 0) { while (gameSys.getAnimationStatus(animationIndex) != 2) _vm->gameUpdateTick(); } - if (_vm->_gnap->_idleFacing != kDirNone && _vm->_gnap->_idleFacing != kDirBottomRight && _vm->_gnap->_idleFacing != kDirUpRight) - _vm->_s18GarbageCanPos = _vm->_gnap->_pos.x - 1; + if (gnap._idleFacing != kDirNone && gnap._idleFacing != kDirBottomRight && gnap._idleFacing != kDirUpRight) + _vm->_s18GarbageCanPos = gnap._pos.x - 1; else - _vm->_s18GarbageCanPos = _vm->_gnap->_pos.x + 1; + _vm->_s18GarbageCanPos = gnap._pos.x + 1; _vm->clearFlag(kGFPlatypusDisguised); updateHotspots(); - if (_vm->_gnap->_idleFacing != kDirNone && _vm->_gnap->_idleFacing != kDirBottomRight && _vm->_gnap->_idleFacing != kDirUpRight) { - gameSys.insertSequence(0x107BA, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); - _vm->_gnap->_sequenceId = 0x7BA; + if (gnap._idleFacing != kDirNone && gnap._idleFacing != kDirBottomRight && gnap._idleFacing != kDirUpRight) { + gameSys.insertSequence(0x107BA, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, + kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); + gnap._sequenceId = 0x7BA; } else { - gameSys.insertSequence(0x107B9, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); - _vm->_gnap->_sequenceId = 0x7B9; + gameSys.insertSequence(0x107B9, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, + kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); + gnap._sequenceId = 0x7B9; } - _vm->_gnap->_sequenceDatNum = 1; + gnap._sequenceDatNum = 1; 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); @@ -3308,26 +3325,30 @@ void Scene18::platEndPhoning(bool platFl) { } void Scene18::closeHydrantValve() { - _vm->_gnap->_actionStatus = kAS18LeaveScene; + PlayerGnap& gnap = *_vm->_gnap; + + gnap._actionStatus = kAS18LeaveScene; _vm->updateMouseCursor(); if (_vm->isFlag(kGFTruckFilledWithGas)) { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 0, 0x107BA, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 0, 0x107BA, 1); if (_vm->isFlag(kGFTruckKeysUsed)) { - _vm->_gnap->_actionStatus = kAS18CloseRightValveWithGarbageCan; + gnap._actionStatus = kAS18CloseRightValveWithGarbageCan; waitForGnapAction(); } else { - _vm->_gnap->_actionStatus = kAS18CloseRightValveNoGarbageCan; + gnap._actionStatus = kAS18CloseRightValveNoGarbageCan; waitForGnapAction(); } } else if (_vm->isFlag(kGFBarnPadlockOpen)) { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 0, 0x107BA, 1); - _vm->_gnap->_actionStatus = kAS18CloseTopValve; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 0, 0x107BA, 1); + gnap._actionStatus = kAS18CloseTopValve; waitForGnapAction(); } } void Scene18::waitForGnapAction() { - while (_vm->_gnap->_actionStatus >= 0) { + PlayerGnap& gnap = *_vm->_gnap; + + while (gnap._actionStatus >= 0) { updateAnimations(); _vm->gameUpdateTick(); } @@ -3335,6 +3356,7 @@ void Scene18::waitForGnapAction() { void Scene18::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _cowboyHatSurface = nullptr; @@ -3370,9 +3392,9 @@ void Scene18::run() { if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { if (_vm->_prevSceneNum == 17) - _vm->_gnap->initPos(4, 11, kDirBottomRight); + gnap.initPos(4, 11, kDirBottomRight); else - _vm->_gnap->initPos(4, 7, kDirBottomRight); + gnap.initPos(4, 7, kDirBottomRight); _platPhoneCtr = _vm->getRandom(5); if (_vm->isFlag(kGFUnk27)) { gameSys.insertSequence(0x21E, 254, 0, 0, kSeqNone, 0, 0, 0); @@ -3393,7 +3415,7 @@ void Scene18::run() { } else { gameSys.setAnimation(_currPhoneSequenceId, 254, 3); } - _vm->_gnap->walkTo(Common::Point(4, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(4, 8), -1, 0x107B9, 1); } else { if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->clearFlag(kGFGnapControlsToyUFO); @@ -3401,22 +3423,22 @@ void Scene18::run() { _vm->_prevSceneNum = 19; } if (_vm->_prevSceneNum == 17) { - _vm->_gnap->initPos(4, 11, kDirBottomRight); + gnap.initPos(4, 11, kDirBottomRight); _vm->_plat->initPos(5, 11, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(4, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(4, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(5, 9), -1, 0x107C2, 1); } else if (_vm->_prevSceneNum == 19) { - _vm->_gnap->initPos(7, 7, kDirBottomRight); + gnap.initPos(7, 7, kDirBottomRight); _vm->_plat->initPos(8, 7, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(7, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(7, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(8, 8), -1, 0x107C2, 1); } else { - _vm->_gnap->initPos(-1, 10, kDirBottomRight); + gnap.initPos(-1, 10, kDirBottomRight); _vm->_plat->initPos(-1, 10, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(3, 7), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(3, 7), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(3, 8), -1, 0x107C2, 1); } } @@ -3432,36 +3454,36 @@ void Scene18::run() { switch (_vm->_sceneClickedHotspot) { case kHS18Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS18Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, _vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playShowItem(_vm->_grabCursorSpriteIndex, _vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3469,27 +3491,27 @@ void Scene18::run() { break; case kHS18CowboyHat: - if (_vm->_gnap->_actionStatus == kAS18StandingOnHydrant) { - _vm->_gnap->_actionStatus = kAS18GrabCowboyHat; + if (gnap._actionStatus == kAS18StandingOnHydrant) { + gnap._actionStatus = kAS18GrabCowboyHat; _vm->_sceneWaiting = false; - } else if (_vm->_gnap->_actionStatus < 0) { + } else if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS18CowboyHat].x, _vm->_hotspotsWalkPos[kHS18CowboyHat].y, 3, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18CowboyHat].x, _vm->_hotspotsWalkPos[kHS18CowboyHat].y, 3, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(3, 2); + gnap.playScratchingHead(3, 2); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18CowboyHat], 0, _vm->_gnap->getSequenceId(gskPullOutDeviceNonWorking, Common::Point(3, 2)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS18CowboyHat], 0, gnap.getSequenceId(gskPullOutDeviceNonWorking, Common::Point(3, 2)) | 0x10000, 1); break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3497,43 +3519,43 @@ void Scene18::run() { break; case kHS18GarbageCan: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFUnk14)) { if (_vm->_grabCursorSpriteIndex >= 0) - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 1, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 1, 5); else - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) platEndPhoning(true); if (_vm->_grabCursorSpriteIndex >= 0) { if (!_vm->isFlag(kGFTruckKeysUsed)) - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (_vm->_gnap->_pos.x < _vm->_s18GarbageCanPos ? 1 : -1), + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (gnap._pos.x < _vm->_s18GarbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHS18GarbageCan].y, _vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y); else - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 2, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 2, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (!_vm->isFlag(kGFTruckKeysUsed)) - _vm->_gnap->playScratchingHead(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (_vm->_gnap->_pos.x < _vm->_s18GarbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHS18GarbageCan].y); + gnap.playScratchingHead(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (gnap._pos.x < _vm->_s18GarbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHS18GarbageCan].y); else if (!_vm->isFlag(kGFTruckFilledWithGas)) - _vm->_gnap->playScratchingHead(2, 4); + gnap.playScratchingHead(2, 4); break; case GRAB_CURSOR: if (!_vm->isFlag(kGFTruckKeysUsed)) { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan] + Common::Point((_vm->_gnap->_pos.x < _vm->_s18GarbageCanPos ? 1 : -1), 0), + gnap.walkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan] + Common::Point((gnap._pos.x < _vm->_s18GarbageCanPos ? 1 : -1), 0), -1, -1, 1); - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(_vm->_s18GarbageCanPos, _vm->_gnap->_pos.y)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS18GrabGarbageCanFromStreet; + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, Common::Point(_vm->_s18GarbageCanPos, gnap._pos.y)) | 0x10000, 1); + gnap._actionStatus = kAS18GrabGarbageCanFromStreet; } else if (!_vm->isFlag(kGFTruckFilledWithGas)) { - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan], 0, -1, 1)) - _vm->_gnap->_actionStatus = kAS18GrabGarbageCanFromHydrant; + if (gnap.walkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan], 0, -1, 1)) + gnap._actionStatus = kAS18GrabGarbageCanFromHydrant; } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3542,64 +3564,64 @@ void Scene18::run() { break; case kHS18HydrantTopValve: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFPlatypusDisguised)) { // While carrying garbage can if (_vm->_grabCursorSpriteIndex >= 0) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 0, 0); + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); - _vm->_gnap->playScratchingHead(0, 0); + gnap.playScratchingHead(0, 0); break; case GRAB_CURSOR: if (_vm->isFlag(kGFTruckFilledWithGas)) { gnapCarryGarbageCanTo(2); - _vm->_gnap->_actionStatus = kAS18PutGarbageCanOnRunningHydrant; + gnap._actionStatus = kAS18PutGarbageCanOnRunningHydrant; } else if (!_vm->isFlag(kGFBarnPadlockOpen)) { gnapCarryGarbageCanTo(2); - _vm->_gnap->_actionStatus = kAS18PutGarbageCanOnHydrant; + gnap._actionStatus = kAS18PutGarbageCanOnHydrant; } else { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } break; case TALK_CURSOR: case PLAT_CURSOR: gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } } else { if (_vm->_grabCursorSpriteIndex == kItemWrench) { - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(2, 8)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS18OpenTopValve; + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, Common::Point(2, 8)) | 0x10000, 1); + gnap._actionStatus = kAS18OpenTopValve; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 1, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 1, 5); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(1, 5); + gnap.playScratchingHead(1, 5); break; case GRAB_CURSOR: if (_vm->isFlag(kGFBarnPadlockOpen)) { _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 0, 0x107BA, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 0, 0x107BA, 1); _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; - _vm->_gnap->_actionStatus = kAS18CloseTopValve; + gnap._actionStatus = kAS18CloseTopValve; } else - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3608,12 +3630,12 @@ void Scene18::run() { break; case kHS18HydrantRightValve: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFUnk14)) { if (_vm->_grabCursorSpriteIndex == -1) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 1, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 1, 5); } } else { if (_vm->isFlag(kGFPlatypusDisguised)) { @@ -3621,30 +3643,30 @@ void Scene18::run() { putDownGarbageCan(0); } if (_vm->_grabCursorSpriteIndex == kItemWrench) { - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(2, 8)) | 0x10000, 1); + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, Common::Point(2, 8)) | 0x10000, 1); if (_vm->isFlag(kGFTruckKeysUsed)) - _vm->_gnap->_actionStatus = kAS18OpenRightValveWithGarbageCan; + gnap._actionStatus = kAS18OpenRightValveWithGarbageCan; else - _vm->_gnap->_actionStatus = kAS18OpenRightValveNoGarbageCan; + gnap._actionStatus = kAS18OpenRightValveNoGarbageCan; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 1, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 1, 5); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(1, 5); + gnap.playScratchingHead(1, 5); break; case GRAB_CURSOR: if (_vm->isFlag(kGFTruckFilledWithGas)) { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 0, 0x107BA, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 0, 0x107BA, 1); if (_vm->isFlag(kGFTruckKeysUsed)) - _vm->_gnap->_actionStatus = kAS18CloseRightValveWithGarbageCan; + gnap._actionStatus = kAS18CloseRightValveWithGarbageCan; else - _vm->_gnap->_actionStatus = kAS18CloseRightValveNoGarbageCan; + gnap._actionStatus = kAS18CloseRightValveNoGarbageCan; } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3653,18 +3675,18 @@ void Scene18::run() { break; case kHS18ExitToyStore: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } if (_vm->isFlag(kGFPictureTaken)) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { _vm->_isLeavingScene = true; _vm->_newSceneNum = 19; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18ExitToyStore], 0, 0x107C0, 1); - _vm->_gnap->_actionStatus = kAS18LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS18ExitToyStore], 0, 0x107C0, 1); + gnap._actionStatus = kAS18LeaveScene; if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS18ExitToyStore] + Common::Point(1, 0), -1, 0x107C2, 1); } @@ -3672,7 +3694,7 @@ void Scene18::run() { break; case kHS18ExitPhoneBooth: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); @@ -3680,8 +3702,8 @@ void Scene18::run() { closeHydrantValve(); _vm->_isLeavingScene = true; _vm->_newSceneNum = 17; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18ExitPhoneBooth], 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS18LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS18ExitPhoneBooth], 0, 0x107AE, 1); + gnap._actionStatus = kAS18LeaveScene; if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) _vm->setFlag(kGFUnk27); else @@ -3690,7 +3712,7 @@ void Scene18::run() { break; case kHS18ExitGrubCity: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); @@ -3699,8 +3721,8 @@ void Scene18::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18ExitGrubCity], 0, 0x107B2, 1); - _vm->_gnap->_actionStatus = kAS18LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS18ExitGrubCity], 0, 0x107B2, 1); + gnap._actionStatus = kAS18LeaveScene; if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) platEndPhoning(false); else @@ -3711,24 +3733,24 @@ void Scene18::run() { case kHS18WalkArea1: case kHS18WalkArea2: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } else { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); } _vm->_mouseClickState._left = false; } break; default: - if (_vm->_gnap->_actionStatus != kAS18StandingOnHydrant && _vm->_mouseClickState._left) { + if (gnap._actionStatus != kAS18StandingOnHydrant && _vm->_mouseClickState._left) { if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } else { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); } _vm->_mouseClickState._left = false; } @@ -3741,9 +3763,9 @@ void Scene18::run() { _vm->playSound(0x10940, true); if ((_vm->isFlag(kGFTruckFilledWithGas) || _vm->isFlag(kGFBarnPadlockOpen)) && !_vm->isSoundPlaying(0x22B) && - _vm->_gnap->_actionStatus != kAS18OpenRightValveNoGarbageCanDone && _vm->_gnap->_actionStatus != kAS18OpenRightValveNoGarbageCan && - _vm->_gnap->_actionStatus != kAS18OpenTopValve && _vm->_gnap->_actionStatus != kAS18OpenTopValveDone && - _vm->_gnap->_actionStatus != kAS18OpenRightValveWithGarbageCan && _vm->_gnap->_actionStatus != kAS18OpenRightValveWithGarbageCanDone) + gnap._actionStatus != kAS18OpenRightValveNoGarbageCanDone && gnap._actionStatus != kAS18OpenRightValveNoGarbageCan && + gnap._actionStatus != kAS18OpenTopValve && gnap._actionStatus != kAS18OpenTopValveDone && + gnap._actionStatus != kAS18OpenRightValveWithGarbageCan && gnap._actionStatus != kAS18OpenRightValveWithGarbageCanDone) _vm->playSound(0x22B, true); if (!_vm->_isLeavingScene) { @@ -3765,7 +3787,7 @@ void Scene18::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(100) + 100; - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->getRandom(2) == 1) gameSys.insertSequence(0x220, 255, 0, 0, kSeqNone, 0, 0, 0); else @@ -3775,7 +3797,7 @@ void Scene18::run() { _vm->playSoundA(); } if (!_vm->isFlag(kGFPlatypusDisguised)) - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); } _vm->checkGameKeys(); @@ -3795,67 +3817,68 @@ void Scene18::run() { void Scene18::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS18GrabGarbageCanFromStreet: - if (_vm->_gnap->_idleFacing != kDirUpRight && _vm->_gnap->_idleFacing != kDirBottomRight) { - gameSys.insertSequence(0x1FC, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - 675, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x1FC; + if (gnap._idleFacing != kDirUpRight && gnap._idleFacing != kDirBottomRight) { + gameSys.insertSequence(0x1FC, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, + kSeqSyncWait, 0, 75 * gnap._pos.x - 675, 0); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x1FC; } else { - gameSys.insertSequence(0x1FD, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - 525, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x1FD; + gameSys.insertSequence(0x1FD, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, + kSeqSyncWait, 0, 75 * gnap._pos.x - 525, 0); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x1FD; } gameSys.removeSequence(0x1FA, 19, true); _vm->setFlag(kGFPlatypusDisguised); updateHotspots(); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS18GrabGarbageCanFromHydrant: - gameSys.insertSequence(0x1FE, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x1FE, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(0x1F9, 19, true); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x1FE; + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x1FE; _vm->clearFlag(kGFTruckKeysUsed); _vm->setFlag(kGFPlatypusDisguised); updateHotspots(); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS18CloseRightValveNoGarbageCan: - gameSys.insertSequence(0x205, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x205, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(0x20D, 39, true); gameSys.removeSequence(0x212, 39, true); gameSys.removeSequence(0x211, 39, true); _vm->stopSound(0x22B); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x205; + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x205; _vm->clearFlag(kGFTruckFilledWithGas); _vm->invAdd(kItemWrench); _vm->setGrabCursorSprite(kItemWrench); updateHotspots(); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS18OpenTopValve: _vm->setFlag(kGFBarnPadlockOpen); updateHotspots(); - _vm->_gnap->playPullOutDevice(2, 7); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(2, 7); + gnap.playUseDevice(0, 0); gameSys.insertSequence(0x20C, 19, 0, 0, kSeqNone, 0, 0, 0); _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 0, 0x107BB, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 0, 0x107BB, 1); _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; - _vm->_gnap->_actionStatus = kAS18OpenTopValveDone; + gnap._actionStatus = kAS18OpenTopValveDone; break; case kAS18OpenTopValveDone: _vm->setGrabCursorSprite(-1); - gameSys.insertSequence(0x208, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x208, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x216, 39, 0, 0, kSeqNone, 21, 0, 0); gameSys.removeSequence(0x20C, 19, true); gameSys.setAnimation(0x217, 39, 5); @@ -3864,32 +3887,32 @@ void Scene18::updateAnimations() { _vm->gameUpdateTick(); _vm->playSound(0x22B, true); gameSys.insertSequence(0x20E, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x208; + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x208; _vm->invRemove(kItemWrench); _vm->setGrabCursorSprite(-1); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS18CloseTopValve: - gameSys.insertSequence(0x206, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x206, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(0x20E, 39, true); gameSys.removeSequence(0x216, 39, true); gameSys.removeSequence(0x217, 39, true); _vm->stopSound(0x22B); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x206; + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x206; _vm->clearFlag(kGFBarnPadlockOpen); _vm->invAdd(kItemWrench); _vm->setGrabCursorSprite(kItemWrench); updateHotspots(); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS18GrabCowboyHat: - gameSys.setAnimation(0x200, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x200, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x200; - _vm->_gnap->_actionStatus = kAS18GrabCowboyHatDone; + gameSys.setAnimation(0x200, gnap._id, 0); + gameSys.insertSequence(0x200, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x200; + gnap._actionStatus = kAS18GrabCowboyHatDone; break; case kAS18GrabCowboyHatDone: _vm->hideCursor(); @@ -3908,55 +3931,55 @@ void Scene18::updateAnimations() { _vm->setFlag(kGFTruckKeysUsed); _vm->setFlag(kGFUnk14); // Useless, already set updateHotspots(); - _vm->_gnap->_actionStatus = kAS18LeaveScene; + gnap._actionStatus = kAS18LeaveScene; break; case kAS18LeaveScene: _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS18PutGarbageCanOnRunningHydrant: _vm->setFlag(kGFTruckKeysUsed); _vm->clearFlag(kGFPlatypusDisguised); gameSys.requestRemoveSequence(0x211, 39); gameSys.requestRemoveSequence(0x212, 39); - gameSys.insertSequence(0x210, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x210, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); _vm->stopSound(0x22B); - gameSys.setAnimation(0x210, _vm->_gnap->_id, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x210; - _vm->_gnap->_actionStatus = kAS18PutGarbageCanOnRunningHydrant2; + gameSys.setAnimation(0x210, gnap._id, 0); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x210; + gnap._actionStatus = kAS18PutGarbageCanOnRunningHydrant2; break; case kAS18PutGarbageCanOnRunningHydrant2: _vm->playSound(0x22B, true); - gameSys.setAnimation(0x1FF, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x1FF, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x1FF; + gameSys.setAnimation(0x1FF, gnap._id, 0); + gameSys.insertSequence(0x1FF, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x1FF; _vm->_sceneWaiting = true; - _vm->_gnap->_actionStatus = kAS18StandingOnHydrant; + gnap._actionStatus = kAS18StandingOnHydrant; break; case kAS18StandingOnHydrant: - gameSys.setAnimation(0x1FF, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x1FF, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x1FF, gnap._id, 0); + gameSys.insertSequence(0x1FF, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); break; case kAS18OpenRightValveNoGarbageCan: case kAS18OpenRightValveWithGarbageCan: _vm->setFlag(kGFTruckFilledWithGas); updateHotspots(); - _vm->_gnap->playPullOutDevice(2, 7); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(2, 7); + gnap.playUseDevice(0, 0); gameSys.insertSequence(0x20B, 19, 0, 0, kSeqNone, 0, 0, 0); _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 0, 0x107BA, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 0, 0x107BA, 1); _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; - if (_vm->_gnap->_actionStatus == kAS18OpenRightValveNoGarbageCan) - _vm->_gnap->_actionStatus = kAS18OpenRightValveNoGarbageCanDone; + if (gnap._actionStatus == kAS18OpenRightValveNoGarbageCan) + gnap._actionStatus = kAS18OpenRightValveNoGarbageCanDone; else - _vm->_gnap->_actionStatus = kAS18OpenRightValveWithGarbageCanDone; + gnap._actionStatus = kAS18OpenRightValveWithGarbageCanDone; break; case kAS18OpenRightValveWithGarbageCanDone: _vm->setGrabCursorSprite(-1); - gameSys.insertSequence(0x207, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x207, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x213, 39, 0, 0, kSeqNone, 21, 0, 0); gameSys.requestRemoveSequence(0x1F9, 19); gameSys.removeSequence(0x20B, 19, true); @@ -3966,14 +3989,14 @@ void Scene18::updateAnimations() { _vm->gameUpdateTick(); _vm->playSound(0x22B, true); gameSys.insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x207; + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x207; _vm->invRemove(kItemWrench); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS18OpenRightValveNoGarbageCanDone: _vm->setGrabCursorSprite(-1); - gameSys.insertSequence(0x207, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x207, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x211, 39, 0, 0, kSeqNone, 21, 0, 0); gameSys.removeSequence(0x20B, 19, true); gameSys.setAnimation(0x211, 39, 5); @@ -3982,13 +4005,13 @@ void Scene18::updateAnimations() { _vm->gameUpdateTick(); _vm->playSound(0x22B, true); gameSys.insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x207; + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x207; _vm->invRemove(kItemWrench); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS18CloseRightValveWithGarbageCan: - gameSys.insertSequence(0x205, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x205, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(0x20D, 39, true); gameSys.insertSequence(0x215, 39, 0x214, 39, kSeqSyncWait, 0, 0, 0); _vm->stopSound(0x22B); @@ -3997,28 +4020,28 @@ void Scene18::updateAnimations() { _vm->clearFlag(kGFTruckFilledWithGas); _vm->invAdd(kItemWrench); _vm->setGrabCursorSprite(kItemWrench); - gameSys.insertSequence(0x107B5, _vm->_gnap->_id, 517, _vm->_gnap->_id, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107B5, gnap._id, 517, gnap._id, kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); updateHotspots(); - _vm->_gnap->_sequenceDatNum = 1; - _vm->_gnap->_sequenceId = 0x7B5; - _vm->_gnap->_actionStatus = kAS18CloseRightValveWithGarbageCanDone; + gnap._sequenceDatNum = 1; + gnap._sequenceId = 0x7B5; + gnap._actionStatus = kAS18CloseRightValveWithGarbageCanDone; break; case kAS18CloseRightValveWithGarbageCanDone: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS18PutGarbageCanOnHydrant: _vm->setFlag(kGFTruckKeysUsed); _vm->clearFlag(kGFPlatypusDisguised); - gameSys.insertSequence(0x20F, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0x20F, _vm->_gnap->_id, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x20F; - _vm->_gnap->_actionStatus = kAS18PutGarbageCanOnHydrantDone; + gameSys.insertSequence(0x20F, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x20F, gnap._id, 0); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x20F; + gnap._actionStatus = kAS18PutGarbageCanOnHydrantDone; break; case kAS18PutGarbageCanOnHydrantDone: - gameSys.insertSequence(0x1F9, 19, 0x20F, _vm->_gnap->_id, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x1F9, 19, 0x20F, gnap._id, kSeqNone, 0, 0, 0); updateHotspots(); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -4096,6 +4119,7 @@ void Scene19::updateHotspots() { void Scene19::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->queueInsertDeviceIcon(); _toyGrabCtr = 0; @@ -4108,7 +4132,7 @@ void Scene19::run() { gameSys.insertSequence(0x69, 19, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { - _vm->_gnap->initPos(3, 6, kDirBottomRight); + gnap.initPos(3, 6, kDirBottomRight); _currShopAssistantSequenceId = kS19ShopAssistantSequenceIds[_vm->getRandom(5)]; _nextShopAssistantSequenceId = _currShopAssistantSequenceId; gameSys.setAnimation(_currShopAssistantSequenceId, 20, 4); @@ -4116,7 +4140,7 @@ void Scene19::run() { gameSys.insertSequence(_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); _shopAssistantCtr = 0; _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(4, 9), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(4, 9), -1, 0x107B9, 1); updateHotspots(); } else { _currShopAssistantSequenceId = 0x6D; @@ -4124,10 +4148,10 @@ void Scene19::run() { gameSys.setAnimation(0x6D, 20, 4); gameSys.insertSequence(_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[6] = _vm->getRandom(40) + 50; - _vm->_gnap->initPos(3, 6, kDirBottomRight); + gnap.initPos(3, 6, kDirBottomRight); _vm->_plat->initPos(4, 6, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(4, 9), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(4, 9), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(5, 9), -1, 0x107C2, 1); } @@ -4142,32 +4166,32 @@ void Scene19::run() { switch (_vm->_sceneClickedHotspot) { case kHS19Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS19Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -4175,12 +4199,12 @@ void Scene19::run() { break; case kHS19ExitOutsideToyStore: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 18; _vm->_hotspots[kHS19WalkArea1]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[1], 0, 0x107B2, 1); - _vm->_gnap->_actionStatus = kAS19LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[1], 0, 0x107B2, 1); + gnap._actionStatus = kAS19LeaveScene; if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) _vm->setFlag(kGFUnk27); else @@ -4190,23 +4214,23 @@ void Scene19::run() { break; case kHS19Picture: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(6, 2); + gnap.playScratchingHead(6, 2); break; case GRAB_CURSOR: if (!_vm->isFlag(kGFPictureTaken)) { - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot]) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS19GrabPicture; + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot]) | 0x10000, 1); + gnap._actionStatus = kAS19GrabPicture; } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -4214,22 +4238,22 @@ void Scene19::run() { break; case kHS19ShopAssistant: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(6, 2); + gnap.playScratchingHead(6, 2); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS19TalkShopAssistant; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS19TalkShopAssistant; break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -4243,22 +4267,22 @@ void Scene19::run() { case kHS19Toy5: case kHS19Toy6: case kHS19Toy7: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); + gnap.playImpossible(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan2(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); + gnap.playMoan2(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, -1, 1); - _vm->_gnap->playIdle(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); - _vm->_gnap->_actionStatus = kAS19GrabToy; + gnap.walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, -1, 1); + gnap.playIdle(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); + gnap._actionStatus = kAS19GrabToy; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -4266,22 +4290,22 @@ void Scene19::run() { break; case kHS19Phone: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 9, 1); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 9, 1); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(9, 1); + gnap.playScratchingHead(9, 1); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, -1, 1); - _vm->_gnap->playIdle(8, 2); - _vm->_gnap->_actionStatus = kAS19UsePhone; + gnap.walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, -1, 1); + gnap.playIdle(8, 2); + gnap._actionStatus = kAS19UsePhone; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -4291,13 +4315,13 @@ void Scene19::run() { case kHS19WalkArea1: case kHS19WalkArea2: case kHS19WalkArea3: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = 0; } } @@ -4305,7 +4329,7 @@ void Scene19::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) { _vm->_plat->updateIdleSequence(); if (!_vm->_timers[6] && _nextShopAssistantSequenceId == -1) { @@ -4338,10 +4362,11 @@ void Scene19::run() { void Scene19::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS19UsePhone: _nextShopAssistantSequenceId = 0x67; break; @@ -4363,14 +4388,14 @@ void Scene19::updateAnimations() { } break; case kAS19GrabPicture: - _vm->_gnap->playPullOutDevice(6, 2); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(6, 2); + gnap.playUseDevice(0, 0); gameSys.setAnimation(0x68, 19, 0); gameSys.insertSequence(0x68, 19, 105, 19, kSeqSyncWait, 0, 0, 0); _vm->invAdd(kItemPicture); _vm->setFlag(kGFPictureTaken); updateHotspots(); - _vm->_gnap->_actionStatus = kAS19GrabPictureDone; + gnap._actionStatus = kAS19GrabPictureDone; break; case kAS19GrabPictureDone: _vm->setGrabCursorSprite(-1); @@ -4391,7 +4416,7 @@ void Scene19::updateAnimations() { break; case kAS19TalkShopAssistant: _nextShopAssistantSequenceId = 0x6D; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS19LeaveScene: _vm->_sceneDone = true; @@ -4424,24 +4449,24 @@ void Scene19::updateAnimations() { while (_vm->_timers[5]) { _vm->gameUpdateTick(); } - _vm->_gnap->playIdle(6, 2); - _vm->_gnap->_actionStatus = -1; + gnap.playIdle(6, 2); + gnap._actionStatus = -1; break; case 0x67: gameSys.setAnimation(_nextShopAssistantSequenceId, 20, 4); gameSys.insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); _currShopAssistantSequenceId = _nextShopAssistantSequenceId; _nextShopAssistantSequenceId = -1; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case 0x65: - _vm->_gnap->playIdle(6, 2); + gnap.playIdle(6, 2); gameSys.setAnimation(_nextShopAssistantSequenceId, 20, 0); gameSys.insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); _currShopAssistantSequenceId = _nextShopAssistantSequenceId; _nextShopAssistantSequenceId = -1; _vm->_newSceneNum = 18; - _vm->_gnap->_actionStatus = kAS19LeaveScene; + gnap._actionStatus = kAS19LeaveScene; break; case 0x6D: gameSys.setAnimation(_nextShopAssistantSequenceId, 20, 4); diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 8c49bf606b..c4f578de93 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -55,6 +55,7 @@ void Scene20::updateHotspots() { void Scene20::updateAnimationsCb() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(2) == 2) { switch (_nextStonerGuySequenceId) { @@ -68,8 +69,8 @@ void Scene20::updateAnimationsCb() { break; case 0x16A: // Grab joint - _vm->_gnap->playPullOutDevice(4, 4); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(4, 4); + gnap.playUseDevice(0, 0); gameSys.setAnimation(0x16A, 21, 0); gameSys.insertSequence(0x16A, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = 0x16A; @@ -77,7 +78,7 @@ void Scene20::updateAnimationsCb() { _vm->invAdd(kItemJoint); _vm->setFlag(kGFJointTaken); _stonerGuyShowingJoint = false; - _vm->_gnap->_actionStatus = kAS20GrabJointDone; + gnap._actionStatus = kAS20GrabJointDone; break; case 0x16E: gameSys.setAnimation(0x16E, 21, 2); @@ -92,7 +93,7 @@ void Scene20::updateAnimationsCb() { gameSys.insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = _nextStonerGuySequenceId; _nextStonerGuySequenceId = -1; - _vm->_gnap->_actionStatus = kAS20ActionDone; + gnap._actionStatus = kAS20ActionDone; break; case 0x16F: gameSys.setAnimation(_nextStonerGuySequenceId, 21, 2); @@ -158,6 +159,7 @@ void Scene20::stopSounds() { void Scene20::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x10940, true); _vm->startSoundTimerA(8); @@ -206,46 +208,46 @@ void Scene20::run() { // checkGameAppStatus(); _vm->gameUpdateTick(); } - _vm->_gnap->initPos(11, 8, kDirBottomLeft); + gnap.initPos(11, 8, kDirBottomLeft); _vm->_plat->initPos(11, 9, kDirUnk4); - _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(5, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(6, 9), -1, 0x107C2, 1); } else { switch (_vm->_prevSceneNum) { case 17: - _vm->_gnap->initPos(5, 11, kDirBottomRight); + gnap.initPos(5, 11, kDirBottomRight); _vm->_plat->initPos(6, 11, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(5, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(6, 9), -1, 0x107C2, 1); break; case 18: - _vm->_gnap->initPos(11, 8, kDirBottomLeft); + gnap.initPos(11, 8, kDirBottomLeft); _vm->_plat->initPos(11, 9, kDirUnk4); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(5, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(6, 9), -1, 0x107C2, 1); break; case 21: - _vm->_gnap->initPos(-1, 8, kDirBottomLeft); + gnap.initPos(-1, 8, kDirBottomLeft); _vm->_plat->initPos(-1, 9, kDirUnk4); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(3, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(3, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(3, 9), -1, 0x107C2, 1); break; case 22: - _vm->_gnap->initPos(7, 6, kDirBottomRight); + gnap.initPos(7, 6, kDirBottomRight); _vm->_plat->initPos(8, 6, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(8, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(9, 9), -1, 0x107C2, 1); break; default: - _vm->_gnap->initPos(8, 6, kDirBottomLeft); + gnap.initPos(8, 6, kDirBottomLeft); _vm->_plat->initPos(9, 6, kDirUnk4); _vm->endSceneInit(); _vm->_hotspots[kHS20WalkArea2]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(9, 9), -1, 0x107C2, 1); _vm->_hotspots[kHS20WalkArea2]._flags &= ~SF_WALKABLE; break; @@ -264,32 +266,32 @@ void Scene20::run() { switch (_vm->_sceneClickedHotspot) { case kHS20Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS20Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(20); + gnap.kissPlatypus(20); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -297,96 +299,96 @@ void Scene20::run() { break; case kHS20ExitParkingLot: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_stonerGuyShowingJoint) _vm->_timers[4] = 0; _vm->_isLeavingScene = true; _vm->_newSceneNum = 21; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot], 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS20LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot], 0, 0x107AF, 1); + gnap._actionStatus = kAS20LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot] + Common::Point(0, 1), -1, 0x107CF, 1); _vm->_plat->_idleFacing = kDirUnk4; } break; case kHS20ExitPhone: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_stonerGuyShowingJoint) _vm->_timers[4] = 0; _vm->_isLeavingScene = true; _vm->_newSceneNum = 17; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone], 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS20LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone], 0, 0x107AE, 1); + gnap._actionStatus = kAS20LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone] + Common::Point(1, 0), -1, 0x107C2, 1); } break; case kHS20ExitOutsideToyStore: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_stonerGuyShowingJoint) _vm->_timers[4] = 0; _vm->_isLeavingScene = true; _vm->_newSceneNum = 18; _vm->_hotspots[kHS20WalkArea2]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore], 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS20LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore], 0, 0x107AB, 1); + gnap._actionStatus = kAS20LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore] + Common::Point(0, 1), -1, 0x107CD, 1); _vm->_hotspots[kHS20WalkArea2]._flags &= ~SF_WALKABLE; } break; case kHS20ExitInsideGrubCity: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_stonerGuyShowingJoint) _vm->_timers[4] = 0; _vm->_isLeavingScene = true; _vm->_newSceneNum = 22; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity] + Common::Point(0, - 1), 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS20LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity] + Common::Point(0, - 1), 0, 0x107BB, 1); + gnap._actionStatus = kAS20LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); _vm->_plat->_idleFacing = kDirUnk4; } break; case kHS20ExitOutsideCircusWorld: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_stonerGuyShowingJoint) _vm->_timers[4] = 0; _vm->_isLeavingScene = true; _vm->_newSceneNum = 24; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld], 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS20LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld], 0, 0x107BB, 1); + gnap._actionStatus = kAS20LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); } break; case kHS20StonerGuy: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 5, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 5, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan2(5, 4); + gnap.playMoan2(5, 4); break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); if (_stonerGuyShowingJoint) - _vm->_gnap->_actionStatus = kAS20GrabJoint; + gnap._actionStatus = kAS20GrabJoint; else - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); if (_vm->isFlag(kGFJointTaken)) - _vm->_gnap->_actionStatus = kAS20TalkStonerGuyNoJoint; + gnap._actionStatus = kAS20TalkStonerGuyNoJoint; else - _vm->_gnap->_actionStatus = kAS20TalkStonerGuyHasJoint; + gnap._actionStatus = kAS20TalkStonerGuyHasJoint; break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -394,27 +396,27 @@ void Scene20::run() { break; case kHS20GroceryStoreGuy: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 2, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 2, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(2, 3); + gnap.playScratchingHead(2, 3); break; case GRAB_CURSOR: _stonerGuyShowingJoint = false; - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS20GrabGroceryStoreGuy; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS20GrabGroceryStoreGuy; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS20TalkGroceryStoreGuy; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS20TalkGroceryStoreGuy; break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -422,27 +424,27 @@ void Scene20::run() { break; case kHS20GroceryStoreHat: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemCowboyHat) { - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS20SwitchGroceryStoreHat; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS20SwitchGroceryStoreHat; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreHat].y, 1, 6); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreHat].y, 1, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(1, 6); + gnap.playScratchingHead(1, 6); break; case GRAB_CURSOR: _stonerGuyShowingJoint = false; - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS20GrabGroceryStoreHat; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS20GrabGroceryStoreHat; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -451,12 +453,12 @@ void Scene20::run() { case kHS20WalkArea1: case kHS20WalkArea2: - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -474,9 +476,9 @@ void Scene20::run() { _vm->_plat->updateIdleSequence(); _vm->_hotspots[kHS20WalkArea1]._y2 -= 48; } - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0 && !_vm->_timers[5] && _nextGroceryStoreGuySequenceId == -1) { + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); + if (gnap._actionStatus < 0 && !_vm->_timers[5] && _nextGroceryStoreGuySequenceId == -1) { _vm->_timers[5] = _vm->getRandom(50) + 130; if (_vm->getRandom(4) != 0) _nextGroceryStoreGuySequenceId = 0x17C; @@ -485,7 +487,7 @@ void Scene20::run() { } if (!_vm->_timers[7]) { _vm->_timers[7] = _vm->getRandom(100) + 100; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { switch (_vm->getRandom(3)) { case 0: gameSys.insertSequence(0x183, 253, 0, 0, kSeqNone, 0, 0, 0); @@ -515,10 +517,11 @@ void Scene20::run() { void Scene20::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS20LeaveScene: _vm->_sceneDone = true; break; @@ -552,13 +555,13 @@ void Scene20::updateAnimations() { _vm->_timers[6] = 200; _vm->_timers[4] = 100; _stonerGuyShowingJoint = true; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS20GrabJoint: _nextStonerGuySequenceId = 0x16A; break; case kAS20ActionDone: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS20TalkGroceryStoreGuy: gameSys.setAnimation(0x170, 21, 2); @@ -603,13 +606,13 @@ void Scene20::updateAnimations() { break; case kAS20SwitchGroceryStoreHat: _vm->setGrabCursorSprite(-1); - gameSys.setAnimation(0x180, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x180, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x180; - _vm->_gnap->_sequenceDatNum = 0; + gameSys.setAnimation(0x180, gnap._id, 0); + gameSys.insertSequence(0x180, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x180; + gnap._sequenceDatNum = 0; _vm->invRemove(kItemCowboyHat); _vm->invAdd(kItemGroceryStoreHat); - _vm->_gnap->_actionStatus = kAS20SwitchGroceryStoreHatDone; + gnap._actionStatus = kAS20SwitchGroceryStoreHatDone; break; case kAS20SwitchGroceryStoreHatDone: gameSys.insertSequence(0x17F, 20, 372, 20, kSeqSyncWait, 0, 0, 0); @@ -624,13 +627,13 @@ void Scene20::updateAnimations() { _vm->removeFullScreenSprite(); _vm->showCursor(); _vm->setGrabCursorSprite(kItemGroceryStoreHat); - _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(Common::Point(3, 8), -1, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = -1; + gnap._idleFacing = kDirBottomRight; + gnap.walkTo(Common::Point(3, 8), -1, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = -1; break; case kAS20GrabJointDone: _vm->setGrabCursorSprite(kItemJoint); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -647,12 +650,12 @@ void Scene20::updateAnimations() { break; case 0x178: gameSys.setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); - gameSys.setAnimation(0x17D, _vm->_gnap->_id, 0); + gameSys.setAnimation(0x17D, gnap._id, 0); gameSys.insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x17D, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x17D; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = kAS20ActionDone; + gameSys.insertSequence(0x17D, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x17D; + gnap._sequenceDatNum = 0; + gnap._actionStatus = kAS20ActionDone; gameSys.setAnimation(0x16D, 21, 2); gameSys.insertSequence(0x16D, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = 0x16D; @@ -664,17 +667,17 @@ void Scene20::updateAnimations() { gameSys.setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); gameSys.setAnimation(0x16D, 21, 0); gameSys.insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x17E, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x17E; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = kAS20ActionDone; + gameSys.insertSequence(0x17E, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x17E; + gnap._sequenceDatNum = 0; + gnap._actionStatus = kAS20ActionDone; gameSys.setAnimation(0x16D, 21, 2); gameSys.insertSequence(0x16D, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = 0x16D; _currGroceryStoreGuySequenceId = 377; _nextGroceryStoreGuySequenceId = -1; _nextStonerGuySequenceId = -1; - _vm->_gnap->walkTo(Common::Point(4, 8), -1, 0x107BB, 1); + gnap.walkTo(Common::Point(4, 8), -1, 0x107BB, 1); break; case 0x17C: gameSys.setAnimation(0, 0, 3); @@ -690,7 +693,7 @@ void Scene20::updateAnimations() { gameSys.insertSequence(0x175, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); _currGroceryStoreGuySequenceId = 0x175; _nextGroceryStoreGuySequenceId = -1; - _vm->_gnap->_actionStatus = kAS20ActionDone; + gnap._actionStatus = kAS20ActionDone; break; default: if (_nextGroceryStoreGuySequenceId != -1) { @@ -736,6 +739,7 @@ void Scene21::updateHotspots() { void Scene21::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x10940, true); _vm->startSoundTimerA(6); @@ -744,7 +748,7 @@ void Scene21::run() { if (_vm->isFlag(kGFTwigTaken)) { if (_vm->isFlag(kGFKeysTaken)) { - _vm->_gnap->initPos(5, 8, kDirBottomRight); + gnap.initPos(5, 8, kDirBottomRight); _vm->_plat->initPos(6, 8, kDirNone); gameSys.insertSequence(0x8E, 2, 0, 0, kSeqNone, 0, 0, 0); if (!_vm->isFlag(kGFUnk04)) @@ -752,16 +756,16 @@ void Scene21::run() { _vm->endSceneInit(); _vm->clearFlag(kGFKeysTaken); } else { - _vm->_gnap->initPos(5, 11, kDirBottomRight); + gnap.initPos(5, 11, kDirBottomRight); _vm->_plat->initPos(6, 11, kDirNone); if (!_vm->isFlag(kGFUnk04)) gameSys.insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(5, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); } } else { - _vm->_gnap->initPos(5, 11, kDirBottomRight); + gnap.initPos(5, 11, kDirBottomRight); _vm->_plat->initPos(6, 11, kDirNone); _currOldLadySequenceId = 0x89; gameSys.setAnimation(0x89, 79, 3); @@ -769,7 +773,7 @@ void Scene21::run() { _nextOldLadySequenceId = -1; _vm->_timers[4] = _vm->getRandom(30) + 50; _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(5, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); } @@ -782,32 +786,32 @@ void Scene21::run() { switch (_vm->_sceneClickedHotspot) { case kHS21Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS21Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -815,19 +819,19 @@ void Scene21::run() { break; case kHS21Banana: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 2, 5); + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 2, 5); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(2, 5); + gnap.playScratchingHead(2, 5); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS21Banana]) | 0x10000, 1); - _vm->_gnap->playPullOutDevice(2, 5); - _vm->_gnap->playUseDevice(0, 0); - _vm->_gnap->_actionStatus = kAS21GrabBanana; + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS21Banana]) | 0x10000, 1); + gnap.playPullOutDevice(2, 5); + gnap.playUseDevice(0, 0); + gnap._actionStatus = kAS21GrabBanana; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -838,32 +842,32 @@ void Scene21::run() { break; case kHS21OldLady: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemGroceryStoreHat) { _vm->_newSceneNum = 47; - _vm->_gnap->walkTo(Common::Point(4, 6), 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS21UseHatWithOldLady; + gnap.walkTo(Common::Point(4, 6), 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS21UseHatWithOldLady; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(4, 6, 7, 4); + gnap.playShowCurrItem(4, 6, 7, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(7, 4); + gnap.playScratchingHead(7, 4); break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirUpLeft; + gnap._idleFacing = kDirUpLeft; _vm->_hotspots[kHS21WalkArea1]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(Common::Point(7, 6), 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS21GrabOldLady; + gnap.walkTo(Common::Point(7, 6), 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS21GrabOldLady; _vm->_hotspots[kHS21WalkArea1]._flags &= ~SF_WALKABLE; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS21OldLady], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS21TalkOldLady; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS21OldLady], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS21TalkOldLady; break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -871,23 +875,23 @@ void Scene21::run() { break; case kHS21ExitOutsideGrubCity: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity], 0, 0x107B3, 1); - _vm->_gnap->_actionStatus = kAS21LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity], 0, 0x107B3, 1); + gnap._actionStatus = kAS21LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); } break; case kHS21WalkArea1: case kHS21WalkArea2: - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -901,8 +905,8 @@ void Scene21::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); - if (!_vm->isFlag(kGFTwigTaken) && !_vm->_timers[4] && _nextOldLadySequenceId == -1 && _vm->_gnap->_actionStatus == -1) { + gnap.updateIdleSequence(); + if (!_vm->isFlag(kGFTwigTaken) && !_vm->_timers[4] && _nextOldLadySequenceId == -1 && gnap._actionStatus == -1) { _vm->_timers[4] = _vm->getRandom(30) + 50; switch (_vm->getRandom(5)) { case 0: @@ -937,13 +941,14 @@ void Scene21::run() { void Scene21::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS21TalkOldLady: _nextOldLadySequenceId = 0x8B; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS21GrabBanana: gameSys.setAnimation(0x8C, 59, 0); @@ -951,22 +956,22 @@ void Scene21::updateAnimations() { _vm->setFlag(kGFUnk04); _vm->invAdd(kItemBanana); updateHotspots(); - _vm->_gnap->_actionStatus = kAS21GrabBananaDone; + gnap._actionStatus = kAS21GrabBananaDone; break; case kAS21GrabBananaDone: _vm->setGrabCursorSprite(kItemBanana); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS21GrabOldLady: _vm->_timers[4] = _vm->getRandom(30) + 50; _nextOldLadySequenceId = 0x87; break; case kAS21UseHatWithOldLady: - gameSys.setAnimation(0x8F, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x8F, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x8F; - _vm->_gnap->_actionStatus = kAS21UseHatWithOldLadyDone; + gameSys.setAnimation(0x8F, gnap._id, 0); + gameSys.insertSequence(0x8F, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x8F; + gnap._actionStatus = kAS21UseHatWithOldLadyDone; _vm->invAdd(kItemTickets); _vm->invRemove(kItemGroceryStoreHat); _vm->setGrabCursorSprite(-1); @@ -984,16 +989,16 @@ void Scene21::updateAnimations() { if (_nextOldLadySequenceId == 0x87) { gameSys.setAnimation(_nextOldLadySequenceId, 79, 3); gameSys.insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x86, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x86; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = -1; + gameSys.insertSequence(0x86, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x86; + gnap._sequenceDatNum = 0; + gnap._actionStatus = -1; _currOldLadySequenceId = _nextOldLadySequenceId; _nextOldLadySequenceId = -1; } else if (_nextOldLadySequenceId == 0x91) { gameSys.setAnimation(0x91, 79, 0); gameSys.insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_actionStatus = kAS21LeaveScene; + gnap._actionStatus = kAS21LeaveScene; _currOldLadySequenceId = _nextOldLadySequenceId; _nextOldLadySequenceId = -1; } else { @@ -1029,6 +1034,7 @@ void Scene22::updateHotspots() { void Scene22::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; gameSys.insertSequence(0x5D, 254, 0, 0, kSeqNone, 0, 0, 0); @@ -1043,14 +1049,14 @@ void Scene22::run() { _vm->queueInsertDeviceIcon(); if (_vm->_prevSceneNum == 20) { - _vm->_gnap->initPos(2, 8, kDirBottomRight); + gnap.initPos(2, 8, kDirBottomRight); _vm->_plat->initPos(1, 8, kDirNone); _vm->endSceneInit(); } else { - _vm->_gnap->initPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y, kDirBottomRight); + gnap.initPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y, kDirBottomRight); _vm->_plat->initPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y + 1, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(8, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107C2, 1); } @@ -1098,32 +1104,32 @@ void Scene22::run() { switch (_vm->_sceneClickedHotspot) { case kHS22Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS22Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1131,44 +1137,44 @@ void Scene22::run() { break; case kHS22ExitOutsideGrubCity: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity], 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS22LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity], 0, 0x107AF, 1); + gnap._actionStatus = kAS22LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity] + Common::Point(0, 1), -1, 0x107C2, 1); } break; case kHS22ExitBackGrubCity: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 23; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity], 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS22LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity], 0, 0x107AB, 1); + gnap._actionStatus = kAS22LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity] + Common::Point(0, 1), -1, 0x107C2, 1); } break; case kHS22Cashier: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS22Cashier].x, _vm->_hotspotsWalkPos[kHS22Cashier].y, 8, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS22Cashier].x, _vm->_hotspotsWalkPos[kHS22Cashier].y, 8, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(8, 4); + gnap.playScratchingHead(8, 4); break; case GRAB_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS22Cashier], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS22TalkCashier; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS22Cashier], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS22TalkCashier; break; case PLAT_CURSOR: - _vm->_gnap->useDeviceOnPlatypus(); + gnap.useDeviceOnPlatypus(); break; } } @@ -1177,12 +1183,12 @@ void Scene22::run() { case kHS22WalkArea1: case kHS22WalkArea2: - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1192,7 +1198,7 @@ void Scene22::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); if (!_vm->_timers[6] && _nextCashierSequenceId == -1) { _vm->_timers[6] = _vm->getRandom(30) + 20; if (_vm->getRandom(8) != 0) { @@ -1235,10 +1241,11 @@ void Scene22::run() { void Scene22::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS22LeaveScene: _vm->_sceneDone = true; break; @@ -1246,7 +1253,7 @@ void Scene22::updateAnimations() { _nextCashierSequenceId = 0x5C; break; } - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } if (gameSys.getAnimationStatus(3) == 2 && _nextCashierSequenceId != -1) { @@ -1280,6 +1287,7 @@ void Scene23::updateHotspots() { void Scene23::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->_timers[4] = _vm->getRandom(100) + 200; _vm->_timers[5] = _vm->getRandom(100) + 200; @@ -1292,7 +1300,7 @@ void Scene23::run() { _vm->queueInsertDeviceIcon(); - _vm->_gnap->initPos(-1, 7, kDirBottomRight); + gnap.initPos(-1, 7, kDirBottomRight); _vm->_plat->initPos(-2, 7, kDirNone); gameSys.insertSequence(0xBD, 255, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0xBF, 2, 0, 0, kSeqNone, 0, 0, 0); @@ -1301,9 +1309,9 @@ void Scene23::run() { _vm->_plat->walkTo(Common::Point(1, 7), -1, 0x107C2, 1); if (_vm->isFlag(kGFUnk24)) { - _vm->_gnap->walkTo(Common::Point(2, 7), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 7), -1, 0x107B9, 1); } else { - _vm->_gnap->walkTo(Common::Point(2, 7), 0, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 7), 0, 0x107B9, 1); while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); _vm->playSequences(0x48, 0xBA, 0xBB, 0xBC); @@ -1321,32 +1329,32 @@ void Scene23::run() { switch (_vm->_sceneClickedHotspot) { case kHS23Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS23Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1354,33 +1362,33 @@ void Scene23::run() { break; case kHS23Cereals: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS23Cereals].x, _vm->_hotspotsWalkPos[kHS23Cereals].y, 5, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS23Cereals].x, _vm->_hotspotsWalkPos[kHS23Cereals].y, 5, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFSceneFlag1)) - _vm->_gnap->playMoan2(0, 0); + gnap.playMoan2(0, 0); else { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS23LookCereals; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS23LookCereals; } break; case GRAB_CURSOR: if (_vm->isFlag(kGFSceneFlag1)) - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); else { - _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._idleFacing = kDirBottomRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); _vm->setFlag(kGFSceneFlag1); - _vm->_gnap->_actionStatus = kAS23GrabCereals; + gnap._actionStatus = kAS23GrabCereals; _vm->invAdd(kItemCereals); } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1388,24 +1396,24 @@ void Scene23::run() { break; case kHS23ExitFrontGrubCity: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 22; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity], 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS23LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity], 0, 0x107AF, 1); + gnap._actionStatus = kAS23LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity] + Common::Point(0, -1), -1, 0x107C2, 1); } break; case kHS23WalkArea1: case kHS23WalkArea2: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1415,8 +1423,8 @@ void Scene23::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); - if (!_vm->_timers[4] && _vm->_gnap->_actionStatus == -1) { + gnap.updateIdleSequence(); + if (!_vm->_timers[4] && gnap._actionStatus == -1) { _vm->_timers[4] = _vm->getRandom(100) + 200; switch (_vm->getRandom(4)) { case 0: @@ -1461,25 +1469,26 @@ void Scene23::run() { void Scene23::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS23LookCereals: _vm->showFullScreenSprite(0x48); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS23GrabCereals: - gameSys.setAnimation(0xBE, _vm->_gnap->_id, 0); - gameSys.insertSequence(0xBE, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0xBE, gnap._id, 0); + gameSys.insertSequence(0xBE, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.requestRemoveSequence(0xBF, 2); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0xBE; - _vm->_gnap->_actionStatus = kAS23GrabCerealsDone; + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0xBE; + gnap._actionStatus = kAS23GrabCerealsDone; break; case kAS23GrabCerealsDone: _vm->setGrabCursorSprite(kItemCereals); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS23LeaveScene: _vm->_sceneDone = true; @@ -1536,6 +1545,7 @@ void Scene24::updateHotspots() { void Scene24::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; int counter = 0; _vm->playSound(0x10940, true); @@ -1563,16 +1573,16 @@ void Scene24::run() { _vm->queueInsertDeviceIcon(); if (_vm->_prevSceneNum == 20) { - _vm->_gnap->initPos(1, 8, kDirBottomRight); + gnap.initPos(1, 8, kDirBottomRight); _vm->_plat->initPos(2, 8, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(1, 9), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(1, 9), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(2, 9), -1, 0x107C2, 1); } else { - _vm->_gnap->initPos(8, 8, kDirBottomLeft); + gnap.initPos(8, 8, kDirBottomLeft); _vm->_plat->initPos(8, 8, kDirUnk4); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(2, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(3, 8), -1, 0x107C2, 1); } @@ -1588,32 +1598,32 @@ void Scene24::run() { switch (_vm->_sceneClickedHotspot) { case kHS24Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS24Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1621,22 +1631,22 @@ void Scene24::run() { break; case kHS24ExitCircusWorld: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 25; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld], 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS24LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld], 0, 0x107AB, 1); + gnap._actionStatus = kAS24LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); } break; case kHS24ExitOutsideGrubCity: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS24LeaveScene; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS24LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -1644,13 +1654,13 @@ void Scene24::run() { case kHS24WalkArea1: case kHS24WalkArea2: case kHS24WalkArea3: - if (_vm->_gnap->_actionStatus == -1) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus == -1) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1663,7 +1673,7 @@ void Scene24::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 50; gameSys.insertSequence(0x37, 20, _girlSequenceId, 20, kSeqSyncWait, 0, 0, 0); @@ -1723,12 +1733,13 @@ void Scene24::run() { void Scene24::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - if (_vm->_gnap->_actionStatus == kAS24LeaveScene) + if (gnap._actionStatus == kAS24LeaveScene) _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } } @@ -1798,6 +1809,7 @@ void Scene25::playAnims(int index) { void Scene25::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x10940, true); _vm->startSoundTimerA(5); @@ -1812,16 +1824,16 @@ void Scene25::run() { _vm->queueInsertDeviceIcon(); if (_vm->_prevSceneNum == 24) { - _vm->_gnap->initPos(5, 11, kDirUpLeft); + gnap.initPos(5, 11, kDirUpLeft); _vm->_plat->initPos(6, 11, kDirUnk4); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(5, 7), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(5, 7), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(6, 7), -1, 0x107C2, 1); } else { - _vm->_gnap->initPos(5, 6, kDirBottomRight); + gnap.initPos(5, 6, kDirBottomRight); _vm->_plat->initPos(6, 6, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(5, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); } @@ -1834,32 +1846,32 @@ void Scene25::run() { switch (_vm->_sceneClickedHotspot) { case kHS25Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS25Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1867,29 +1879,29 @@ void Scene25::run() { break; case kHS25TicketVendor: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTickets) { - _vm->_gnap->_actionStatus = kAS25ShowTicketToVendor; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(9, 4)) | 0x10000, 1); - _vm->_gnap->playPullOutDevice(0, 0); - _vm->_gnap->playUseDevice(0, 0); + gnap._actionStatus = kAS25ShowTicketToVendor; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, gnap.getSequenceId(gskIdle, Common::Point(9, 4)) | 0x10000, 1); + gnap.playPullOutDevice(0, 0); + gnap.playUseDevice(0, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS25TicketVendor].x, _vm->_hotspotsWalkPos[kHS25TicketVendor].y, 6, 1); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS25TicketVendor].x, _vm->_hotspotsWalkPos[kHS25TicketVendor].y, 6, 1); _nextTicketVendorSequenceId = 0x5B; } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(6, 1); + gnap.playScratchingHead(6, 1); _nextTicketVendorSequenceId = (_vm->getRandom(2) == 1) ? 0x59 : 0x56; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS25TalkTicketVendor; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS25TalkTicketVendor; break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1897,29 +1909,29 @@ void Scene25::run() { break; case kHS25ExitOutsideCircusWorld: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 24; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld], 0, 0x107B4, 1); - _vm->_gnap->_actionStatus = kAS25LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld], 0, 0x107B4, 1); + gnap._actionStatus = kAS25LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); } break; case kHS25ExitInsideCircusWorld: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFNeedleTaken)) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 26; _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld], 0, 0x107B1, 1); - _vm->_gnap->_actionStatus = kAS25LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld], 0, 0x107B1, 1); + gnap._actionStatus = kAS25LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; } else { _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(Common::Point(4, 5), 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS25EnterCircusWihoutTicket; + gnap.walkTo(Common::Point(4, 5), 0, 0x107BB, 1); + gnap._actionStatus = kAS25EnterCircusWihoutTicket; _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; } } @@ -1929,26 +1941,26 @@ void Scene25::run() { case kHS25Posters2: case kHS25Posters3: case kHS25Posters4: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], -1, -1, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], -1, -1, 1); if (_vm->_sceneClickedHotspot == 5 || _vm->_sceneClickedHotspot == 6) - _vm->_gnap->_idleFacing = kDirUpLeft; + gnap._idleFacing = kDirUpLeft; else if (_vm->_sceneClickedHotspot == 8) - _vm->_gnap->_idleFacing = kDirBottomRight; + gnap._idleFacing = kDirBottomRight; else - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->playIdle(0, 0); + gnap._idleFacing = kDirUpRight; + gnap.playIdle(0, 0); playAnims(8 - _vm->_sceneClickedHotspot + 1); break; case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playMoan2(0, 0); + gnap.playMoan2(0, 0); break; } } @@ -1957,13 +1969,13 @@ void Scene25::run() { case kHS25WalkArea1: case kHS25WalkArea2: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1973,8 +1985,8 @@ void Scene25::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); - if (!_vm->_timers[4] && _nextTicketVendorSequenceId == -1 && _vm->_gnap->_actionStatus == -1) { + gnap.updateIdleSequence(); + if (!_vm->_timers[4] && _nextTicketVendorSequenceId == -1 && gnap._actionStatus == -1) { _vm->_timers[4] = _vm->getRandom(20) + 20; switch (_vm->getRandom(13)) { case 0: @@ -2026,13 +2038,14 @@ void Scene25::run() { void Scene25::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS25TalkTicketVendor: _nextTicketVendorSequenceId = (_vm->getRandom(2) == 1) ? 0x57 : 0x5F; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS25EnterCircusWihoutTicket: _nextTicketVendorSequenceId = 0x5E; @@ -2043,13 +2056,13 @@ void Scene25::updateAnimations() { _currTicketVendorSequenceId = _nextTicketVendorSequenceId; _nextTicketVendorSequenceId = -1; _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; - _vm->_gnap->playIdle(0, 0); - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], -1, 0x107BB, 1); + gnap.playIdle(0, 0); + gnap.walkTo(_vm->_hotspotsWalkPos[3], -1, 0x107BB, 1); _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnap->_actionStatus = kAS25EnterCircusWihoutTicketDone; + gnap._actionStatus = kAS25EnterCircusWihoutTicketDone; break; case kAS25EnterCircusWihoutTicketDone: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS25ShowTicketToVendor: _vm->setGrabCursorSprite(-1); @@ -2057,7 +2070,7 @@ void Scene25::updateAnimations() { _vm->setFlag(kGFNeedleTaken); gameSys.setAnimation(0x61, 40, 0); gameSys.insertSequence(0x61, 40, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->_actionStatus = kAS25ShowTicketToVendorDone; + gnap._actionStatus = kAS25ShowTicketToVendorDone; break; case kAS25ShowTicketToVendorDone: _nextTicketVendorSequenceId = 0x53; @@ -2073,7 +2086,7 @@ void Scene25::updateAnimations() { gameSys.insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); _currTicketVendorSequenceId = _nextTicketVendorSequenceId; _nextTicketVendorSequenceId = -1; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } else if (_nextTicketVendorSequenceId != -1) { gameSys.setAnimation(_nextTicketVendorSequenceId, 39, 3); gameSys.insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); @@ -2109,6 +2122,7 @@ void Scene26::updateHotspots() { void Scene26::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->startSoundTimerB(7); _vm->playSound(0x1093B, true); @@ -2130,13 +2144,13 @@ void Scene26::run() { gameSys.insertSequence(0x5E, 40, 0, 0, kSeqLoop, 0, 0, 0); if (_vm->_prevSceneNum == 25) { - _vm->_gnap->initPos(-1, 8, kDirBottomRight); + gnap.initPos(-1, 8, kDirBottomRight); _vm->_plat->initPos(-2, 8, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); } else { - _vm->_gnap->initPos(2, 8, kDirBottomRight); + gnap.initPos(2, 8, kDirBottomRight); _vm->_plat->initPos(3, 8, kDirNone); _vm->endSceneInit(); } @@ -2150,32 +2164,32 @@ void Scene26::run() { switch (_vm->_sceneClickedHotspot) { case kHS26Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS26Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2183,59 +2197,59 @@ void Scene26::run() { break; case kHS26ExitOutsideCircusWorld: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 25; - _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitOutsideCircusWorld].y), 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS26LeaveScene; + gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitOutsideCircusWorld].y), 0, 0x107AE, 1); + gnap._actionStatus = kAS26LeaveScene; } break; case kHS26ExitOutsideClown: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 27; - _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitOutsideClown].y), 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS26LeaveScene; + gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitOutsideClown].y), 0, 0x107BC, 1); + gnap._actionStatus = kAS26LeaveScene; } break; case kHS26ExitArcade: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 29; - _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitArcade].y), 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS26LeaveScene; + gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitArcade].y), 0, 0x107BC, 1); + gnap._actionStatus = kAS26LeaveScene; } break; case kHS26ExitElephant: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 30; - _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitElephant].y), 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS26LeaveScene; + gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitElephant].y), 0, 0x107BC, 1); + gnap._actionStatus = kAS26LeaveScene; } break; case kHS26ExitBeerStand: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 31; - _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitBeerStand].y), 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS26LeaveScene; + gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitBeerStand].y), 0, 0x107BB, 1); + gnap._actionStatus = kAS26LeaveScene; } break; case kHS26WalkArea1: case kHS26WalkArea2: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2248,7 +2262,7 @@ void Scene26::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); if (!_vm->_timers[5] && _nextKidSequenceId == -1) { _vm->_timers[5] = _vm->getRandom(20) + 50; if (_vm->getRandom(5) != 0) @@ -2281,12 +2295,13 @@ void Scene26::run() { void Scene26::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - if (_vm->_gnap->_actionStatus == kAS26LeaveScene) + if (gnap._actionStatus == kAS26LeaveScene) _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } if (gameSys.getAnimationStatus(3) == 2 && _nextKidSequenceId != -1) { @@ -2325,6 +2340,7 @@ void Scene27::updateHotspots() { void Scene27::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x1093B, true); _vm->startSoundTimerB(4); @@ -2347,28 +2363,28 @@ void Scene27::run() { switch (_vm->_prevSceneNum) { case 26: - _vm->_gnap->initPos(7, 12, kDirBottomRight); + gnap.initPos(7, 12, kDirBottomRight); _vm->_plat->initPos(6, 12, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(7, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(7, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); break; case 29: - _vm->_gnap->initPos(-1, 8, kDirBottomRight); + gnap.initPos(-1, 8, kDirBottomRight); _vm->_plat->initPos(-1, 9, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(3, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(3, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(3, 9), -1, 0x107C2, 1); break; case 31: - _vm->_gnap->initPos(12, 8, kDirBottomLeft); + gnap.initPos(12, 8, kDirBottomLeft); _vm->_plat->initPos(12, 9, kDirUnk4); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(8, 9), -1, 0x107C2, 1); break; default: - _vm->_gnap->initPos(6, 8, kDirBottomRight); + gnap.initPos(6, 8, kDirBottomRight); _vm->_plat->initPos(5, 9, kDirNone); _vm->endSceneInit(); break; @@ -2378,38 +2394,38 @@ void Scene27::run() { _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); _vm->_sceneClickedHotspot = -1; - if (_vm->_gnap->_actionStatus < 0) + if (gnap._actionStatus < 0) _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); switch (_vm->_sceneClickedHotspot) { case kHS27Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS27Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2417,26 +2433,26 @@ void Scene27::run() { break; case kHS27Janitor: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemPicture) { - _vm->_gnap->_idleFacing = kDirUpLeft; - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS27Janitor], 0, 0x107BC, 1)) - _vm->_gnap->_actionStatus = kAS27ShowPictureToJanitor; + gnap._idleFacing = kDirUpLeft; + if (gnap.walkTo(_vm->_hotspotsWalkPos[kHS27Janitor], 0, 0x107BC, 1)) + gnap._actionStatus = kAS27ShowPictureToJanitor; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 7, 3); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 7, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(6, 3); + gnap.playScratchingHead(6, 3); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS27Janitor], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS27TalkJanitor; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS27Janitor], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS27TalkJanitor; break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2444,22 +2460,22 @@ void Scene27::run() { break; case kHS27Bucket: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 3, 3); + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 3, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(3, 3); + gnap.playScratchingHead(3, 3); break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS27Bucket]) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS27GrabBucket; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS27Bucket]) | 0x10000, 1); + gnap._actionStatus = kAS27GrabBucket; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2467,60 +2483,60 @@ void Scene27::run() { break; case kHS27ExitCircus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 26; - _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitCircus].y), 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS27LeaveScene; + gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitCircus].y), 0, 0x107AE, 1); + gnap._actionStatus = kAS27LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS27ExitCircus] + Common::Point(1, 0), -1, 0x107C7, 1); } break; case kHS27ExitArcade: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 29; - _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitArcade].y), 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS27LeaveScene; + gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitArcade].y), 0, 0x107AF, 1); + gnap._actionStatus = kAS27LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS27ExitArcade] + Common::Point(0, 1), -1, 0x107CF, 1); } break; case kHS27ExitBeerStand: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 31; - _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitBeerStand].y), 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS27LeaveScene; + gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitBeerStand].y), 0, 0x107AB, 1); + gnap._actionStatus = kAS27LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS27ExitBeerStand] + Common::Point(0, 1), -1, 0x107CD, 1); } break; case kHS27ExitClown: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFPlatypus)) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 28; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS27ExitClown], 0, 0x107AD, 1); - _vm->_gnap->_actionStatus = kAS27LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS27ExitClown], 0, 0x107AD, 1); + gnap._actionStatus = kAS27LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS27ExitClown] + Common::Point(1, 0), -1, 0x107C4, 1); } else { _vm->_hotspots[kHS27WalkArea1]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS27ExitClown].x, 7), 0, 0x107BC, 1); + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS27ExitClown].x, 7), 0, 0x107BC, 1); _vm->_hotspots[kHS27WalkArea1]._flags &= SF_WALKABLE; - _vm->_gnap->_actionStatus = kAS27TryEnterClownTent; + gnap._actionStatus = kAS27TryEnterClownTent; } } break; case kHS27WalkArea1: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2534,13 +2550,13 @@ void Scene27::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); if (_vm->_debugLevel == 4) _vm->updateIdleTimer(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(20) + 60; - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->getRandom(3) != 0) _nextJanitorSequenceId = 0xCB; else @@ -2549,7 +2565,7 @@ void Scene27::run() { } if (!_vm->_timers[7]) { _vm->_timers[7] = _vm->getRandom(100) + 300; - if (_vm->_gnap->_actionStatus < 0) + if (gnap._actionStatus < 0) gameSys.insertSequence(0xD4, 120, 0, 0, kSeqNone, 0, 0, 0); } _vm->playSoundB(); @@ -2569,10 +2585,11 @@ void Scene27::run() { void Scene27::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS27TalkJanitor: switch (_vm->getRandom(3)) { case 0: @@ -2587,18 +2604,18 @@ void Scene27::updateAnimations() { } break; case kAS27GrabBucket: - _vm->_gnap->playPullOutDevice(0, 0); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(0, 0); + gnap.playUseDevice(0, 0); _vm->_hotspots[kHS27Bucket]._flags = SF_DISABLED; _vm->invAdd(kItemEmptyBucket); _vm->setFlag(kGFUnk13); gameSys.setAnimation(0xD2, 39, 0); gameSys.insertSequence(0xD2, 39, 211, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_actionStatus = kAS27GrabBucketDone; + gnap._actionStatus = kAS27GrabBucketDone; break; case kAS27GrabBucketDone: _vm->setGrabCursorSprite(kItemEmptyBucket); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS27ShowPictureToJanitor: _nextJanitorSequenceId = 0xD0; @@ -2610,17 +2627,17 @@ void Scene27::updateAnimations() { gameSys.setAnimation(_nextJanitorSequenceId, 39, 0); _currJanitorSequenceId = _nextJanitorSequenceId; _nextJanitorSequenceId = -1; - _vm->_gnap->_actionStatus = kAS27TryEnterClownTentDone; + gnap._actionStatus = kAS27TryEnterClownTentDone; break; case kAS27TryEnterClownTentDone: _vm->_hotspots[kHS27WalkArea1]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[7].x, 9), -1, 0x107BC, 1); + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[7].x, 9), -1, 0x107BC, 1); _vm->_hotspots[kHS27WalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS27EnterClownTent: - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, 0x107B2, 1); - _vm->_gnap->_actionStatus = kAS27LeaveScene; + gnap.walkTo(gnap._pos, 0, 0x107B2, 1); + gnap._actionStatus = kAS27LeaveScene; break; case kAS27LeaveScene: _vm->_sceneDone = true; @@ -2640,7 +2657,7 @@ void Scene27::updateAnimations() { case 0xCC: case 0xCD: case 0xCE: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; gameSys.insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextJanitorSequenceId, 39, 3); gameSys.setAnimation(_nextJanitorSequenceId, 39, 0); @@ -2649,11 +2666,11 @@ void Scene27::updateAnimations() { break; case 0xD0: // Show picture to janitor - _vm->_gnap->playPullOutDevice(0, 0); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(0, 0); + gnap.playUseDevice(0, 0); gameSys.insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextJanitorSequenceId, 39, 0); - _vm->_gnap->_actionStatus = kAS27EnterClownTent; + gnap._actionStatus = kAS27EnterClownTent; _currJanitorSequenceId = _nextJanitorSequenceId; _nextJanitorSequenceId = -1; _vm->setFlag(kGFPlatypus); @@ -2701,6 +2718,7 @@ void Scene28::updateHotspots() { void Scene28::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x1093C, true); _nextClownSequenceId = -1; @@ -2723,12 +2741,12 @@ void Scene28::run() { gameSys.insertSequence(_currClownSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[4] = _vm->getRandom(20) + 80; } - _vm->_gnap->initPos(8, 8, kDirBottomLeft); + gnap.initPos(8, 8, kDirBottomLeft); _vm->_plat->initPos(9, 8, kDirUnk4); _vm->endSceneInit(); } else { gameSys.insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->initPos(8, 8, kDirBottomLeft); + gnap.initPos(8, 8, kDirBottomLeft); _vm->_plat->initPos(9, 8, kDirUnk4); _vm->endSceneInit(); _vm->playSequences(0xF7, 0x121, 0x122, 0x123); @@ -2738,12 +2756,12 @@ void Scene28::run() { gameSys.insertSequence(_currClownSequenceId, 39, 0x11B, 39, kSeqSyncWait, 0, 0, 0); _nextClownSequenceId = -1; _vm->_timers[4] = _vm->getRandom(20) + 80; - _vm->_gnap->_actionStatus = kAS28GnapWaiting; + gnap._actionStatus = kAS28GnapWaiting; while (gameSys.getAnimationStatus(3) != 2) { _vm->gameUpdateTick(); _vm->updateMouseCursor(); } - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } while (!_vm->_sceneDone) { @@ -2755,32 +2773,32 @@ void Scene28::run() { switch (_vm->_sceneClickedHotspot) { case kHS28Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS28Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2788,32 +2806,32 @@ void Scene28::run() { break; case kHS28Horn: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(2, 8, 3, 4); + gnap.playShowCurrItem(2, 8, 3, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(2, 4); + gnap.playScratchingHead(2, 4); break; case GRAB_CURSOR: if (_vm->isFlag(kGFUnk21)) { if (!_vm->invHas(kItemHorn)) { - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28Horn]) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS28GrabHornSuccess; + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28Horn]) | 0x10000, 1); + gnap._actionStatus = kAS28GrabHornSuccess; } } else { - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(Common::Point(2, 8), 0, 0x107BB, 1); + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(Common::Point(2, 8), 0, 0x107BB, 1); _vm->_hotspots[kHS28WalkArea1]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS28Horn], 0, 0x107BB, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS28Horn], 0, 0x107BB, 1); _vm->_hotspots[kHS28WalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnap->_actionStatus = kAS28GrabHornFails; + gnap._actionStatus = kAS28GrabHornFails; } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2821,39 +2839,39 @@ void Scene28::run() { break; case kHS28Clown: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFUnk21)) { if (_vm->_verbCursor == LOOK_CURSOR) - _vm->_gnap->playScratchingHead(5, 2); + gnap.playScratchingHead(5, 2); else - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithBeer) { - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS28Clown], 0, 0x107BC, 1); - _vm->_gnap->playPullOutDevice(0, 0); - _vm->_gnap->playUseDevice(0, 0); - _vm->_gnap->_actionStatus = kAS28UseBeerBucketWithClown; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS28Clown], 0, 0x107BC, 1); + gnap.playPullOutDevice(0, 0); + gnap.playUseDevice(0, 0); + gnap._actionStatus = kAS28UseBeerBucketWithClown; } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithPill) { - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS28Clown], 0, 0x107BC, 1); - _vm->_gnap->playPullOutDevice(0, 0); - _vm->_gnap->playUseDevice(0, 0); - _vm->_gnap->_actionStatus = kAS28UsePillBucketWithClown; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS28Clown], 0, 0x107BC, 1); + gnap.playPullOutDevice(0, 0); + gnap.playUseDevice(0, 0); + gnap._actionStatus = kAS28UsePillBucketWithClown; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS28Clown].x, _vm->_hotspotsWalkPos[kHS28Clown].y, 2, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS28Clown].x, _vm->_hotspotsWalkPos[kHS28Clown].y, 2, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(5, 2); + gnap.playScratchingHead(5, 2); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(Common::Point(5, 8), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS28TalkClown; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(Common::Point(5, 8), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS28TalkClown; break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2861,35 +2879,35 @@ void Scene28::run() { break; case kHS28ExitOutsideClown: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 27; _vm->_hotspots[kHS28WalkArea1]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown], 0, 0x107BF, 1); - _vm->_gnap->_actionStatus = kAS28LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown], 0, 0x107BF, 1); + gnap._actionStatus = kAS28LeaveScene; _vm->_hotspots[kHS28WalkArea1]._flags &= ~SF_WALKABLE; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown] + Common::Point(-1, 0), -1, 0x107C2, 1); } break; case kHS28EmptyBucket: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 8, 6); + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 8, 6); } else if (_vm->isFlag(kGFUnk21)) { - _vm->_gnap->playImpossible(8, 6); + gnap.playImpossible(8, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(8, 6); + gnap.playScratchingHead(8, 6); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28EmptyBucket]) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS28GrabEmptyBucket; + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28EmptyBucket]) | 0x10000, 1); + gnap._actionStatus = kAS28GrabEmptyBucket; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2898,13 +2916,13 @@ void Scene28::run() { case kHS28WalkArea1: case kHS28WalkArea2: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2917,10 +2935,10 @@ void Scene28::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 80; - if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFUnk21)) + if (gnap._actionStatus < 0 && !_vm->isFlag(kGFUnk21)) _nextClownSequenceId = 0x114; } } @@ -2939,10 +2957,11 @@ void Scene28::run() { void Scene28::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS28UseBeerBucketWithClown: _vm->setFlag(kGFUnk22); _nextClownSequenceId = 0x113; @@ -2960,11 +2979,11 @@ void Scene28::updateAnimations() { _nextClownSequenceId = 0x119; break; case kAS28GrabHornSuccess: - _vm->_gnap->playPullOutDevice(0, 0); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(0, 0); + gnap.playUseDevice(0, 0); gameSys.setAnimation(0x117, 59, 0); gameSys.insertSequence(0x117, 59, 280, 59, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_actionStatus = kAS28GrabHornSuccessDone; + gnap._actionStatus = kAS28GrabHornSuccessDone; break; case kAS28GrabHornSuccessDone: _vm->hideCursor(); @@ -2979,31 +2998,31 @@ void Scene28::updateAnimations() { _vm->setGrabCursorSprite(kItemHorn); _vm->invAdd(kItemHorn); updateHotspots(); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS28GrabEmptyBucket: - _vm->_gnap->playPullOutDevice(0, 0); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(0, 0); + gnap.playUseDevice(0, 0); gameSys.setAnimation(0x111, 99, 0); gameSys.insertSequence(0x111, 99, 274, 99, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_actionStatus = kAS28GrabEmptyBucketDone; + gnap._actionStatus = kAS28GrabEmptyBucketDone; break; case kAS28GrabEmptyBucketDone: _vm->setGrabCursorSprite(kItemEmptyBucket); _vm->clearFlag(kGFUnk22);; updateHotspots(); _vm->invAdd(kItemEmptyBucket); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS28GrabHornFailsDone: - gameSys.insertSequence(0x107B5, _vm->_gnap->_id, 281, 39, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); - _vm->_gnap->_sequenceId = 0x7B5; - _vm->_gnap->_sequenceDatNum = 1; + gameSys.insertSequence(0x107B5, gnap._id, 281, 39, kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); + gnap._sequenceId = 0x7B5; + gnap._sequenceDatNum = 1; gameSys.insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); _currClownSequenceId = 0x11B; _nextClownSequenceId = -1; - _vm->_gnap->_actionStatus = -1; - _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107BB, 1); + gnap._actionStatus = -1; + gnap.walkTo(Common::Point(2, 8), -1, 0x107BB, 1); break; case kAS28TalkClown: _clownTalkCtr = (_clownTalkCtr + 1) % 2; @@ -3015,7 +3034,7 @@ void Scene28::updateAnimations() { _nextClownSequenceId = 0x11F; // NOTE CHECKME Never set, bug in the original? break; case kAS28GnapWaiting: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS28LeaveScene: _vm->_sceneDone = true; @@ -3033,7 +3052,7 @@ void Scene28::updateAnimations() { gameSys.insertSequence(0x11B, 39, _nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); _currClownSequenceId = 0x11B; _nextClownSequenceId = -1; - _vm->_gnap->_actionStatus = kAS28GnapWaiting; + gnap._actionStatus = kAS28GnapWaiting; break; case 0x116: _vm->setGrabCursorSprite(-1); @@ -3044,20 +3063,20 @@ void Scene28::updateAnimations() { gameSys.insertSequence(0x118, 59, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_nextClownSequenceId), 0, 0); _currClownSequenceId = _nextClownSequenceId; _nextClownSequenceId = -1; - _vm->_gnap->_actionStatus = kAS28GnapWaiting; + gnap._actionStatus = kAS28GnapWaiting; break; case 0x11D: case 0x11E: case 0x11F: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case 0x119: - gameSys.insertSequence(_nextClownSequenceId, 39, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextClownSequenceId, 39, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextClownSequenceId, 39, 0); gameSys.removeSequence(_currClownSequenceId, 39, true); - _vm->_gnap->_actionStatus = kAS28GrabHornFailsDone; - _vm->_gnap->_sequenceId = _nextClownSequenceId; - _vm->_gnap->_sequenceDatNum = 0; + gnap._actionStatus = kAS28GrabHornFailsDone; + gnap._sequenceId = _nextClownSequenceId; + gnap._sequenceDatNum = 0; _nextClownSequenceId = -1; break; } @@ -3098,6 +3117,7 @@ void Scene29::updateHotspots() { void Scene29::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x1093B, true); _vm->startSoundTimerB(6); @@ -3124,16 +3144,16 @@ void Scene29::run() { gameSys.insertSequence(0xF5, 38, 0, 0, kSeqLoop, 0, 0, 0); if (_vm->_prevSceneNum == 27) { - _vm->_gnap->initPos(12, 7, kDirBottomRight); + gnap.initPos(12, 7, kDirBottomRight); _vm->_plat->initPos(12, 8, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(8, 7), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(8, 7), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(8, 8), -1, 0x107C2, 1); } else { - _vm->_gnap->initPos(-1, 7, kDirBottomRight); + gnap.initPos(-1, 7, kDirBottomRight); _vm->_plat->initPos(-2, 7, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(2, 7), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 7), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(1, 7), -1, 0x107C2, 1); } @@ -3146,32 +3166,32 @@ void Scene29::run() { switch (_vm->_sceneClickedHotspot) { case kHS29Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS29Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3179,27 +3199,27 @@ void Scene29::run() { break; case kHS29Monkey: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemBanana) { - _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS29Monkey], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS29UseBananaWithMonkey; + gnap._idleFacing = kDirBottomRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS29Monkey], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS29UseBananaWithMonkey; _vm->_newSceneNum = 51; _vm->_isLeavingScene = true; _vm->setGrabCursorSprite(-1); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y, 5, 6); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y, 5, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(5, 6); + gnap.playScratchingHead(5, 6); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y); + gnap.playBrainPulsating(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y); break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3207,45 +3227,45 @@ void Scene29::run() { break; case kHS29ExitCircus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 26; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus], 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS29LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus], 0, 0x107AE, 1); + gnap._actionStatus = kAS29LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus] + Common::Point(1, 0), -1, -1, 1); } break; case kHS29ExitOutsideClown: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 27; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown], 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS29LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown], 0, 0x107AB, 1); + gnap._actionStatus = kAS29LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown] + Common::Point(0, -1), -1, 0x107CD, 1); } break; case kHS29Aracde: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { _vm->setGrabCursorSprite(-1); _vm->_isLeavingScene = true; _vm->_newSceneNum = 52; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS29Aracde], 0, -1, 1); - _vm->_gnap->playIdle(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y); - _vm->_gnap->_actionStatus = kAS29LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS29Aracde], 0, -1, 1); + gnap.playIdle(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y); + gnap._actionStatus = kAS29LeaveScene; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y, 2, 3); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y, 2, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan2(0, 0); + gnap.playMoan2(0, 0); break; case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3253,13 +3273,13 @@ void Scene29::run() { break; case kHS29WalkArea1: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -3271,14 +3291,14 @@ void Scene29::run() { _vm->playSound(0x1093B, true); if (!_vm->_isLeavingScene) { - if (_vm->_gnap->_actionStatus < 0) { - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) { + gnap.updateIdleSequence(); _vm->_plat->updateIdleSequence(); } if (!_vm->_timers[4]) { if (_vm->invHas(kItemHorn)) { _vm->_timers[4] = _vm->getRandom(20) + 60; - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { switch (_vm->getRandom(5)) { case 0: _nextManSequenceId = 0xED; @@ -3316,10 +3336,11 @@ void Scene29::run() { void Scene29::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS29UseBananaWithMonkey: _nextMonkeySequenceId = 0xE5; break; @@ -3338,14 +3359,14 @@ void Scene29::updateAnimations() { if (gameSys.getAnimationStatus(4) == 2) { if (_nextMonkeySequenceId == 0xE5) { - gameSys.insertSequence(0xF2, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0xF2; + gameSys.insertSequence(0xF2, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0xF2; 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->_gnap->_actionStatus = kAS29LeaveScene; + gnap._actionStatus = kAS29LeaveScene; _currMonkeySequenceId = 0xE6; _nextMonkeySequenceId = -1; _vm->_timers[5] = 30; diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index 871177b3d3..c0050c1567 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -46,6 +46,8 @@ void Scene30::updateHotspots() { void Scene30::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; + bool hasTakenPill = false; _vm->playSound(0x1093B, true); @@ -64,10 +66,10 @@ void Scene30::run() { _vm->_timers[4] = _vm->getRandom(100) + 300; _kidSequenceId = 0x101; - _vm->_gnap->initPos(7, 12, kDirBottomRight); + gnap.initPos(7, 12, kDirBottomRight); _vm->_plat->initPos(6, 12, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(7, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(7, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); while (!_vm->_sceneDone) { @@ -79,32 +81,32 @@ void Scene30::run() { switch (_vm->_sceneClickedHotspot) { case kHS30Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS30Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -112,27 +114,27 @@ void Scene30::run() { break; case kHS30PillMachine: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole && !_vm->isFlag(kGFUnk23)) { _vm->_hotspots[kHS30WalkArea1]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS30PillMachine], 0, 0x107BC, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS30PillMachine], 0, 0x107BC, 1); _vm->_hotspots[kHS30WalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnap->_actionStatus = kAS30UsePillMachine; + gnap._actionStatus = kAS30UsePillMachine; hasTakenPill = true; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS30PillMachine].x, _vm->_hotspotsWalkPos[kHS30PillMachine].y, 8, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS30PillMachine].x, _vm->_hotspotsWalkPos[kHS30PillMachine].y, 8, 5); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->walkTo(Common::Point(9, 8), 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS30LookPillMachine; + gnap.walkTo(Common::Point(9, 8), 0, 0x107BC, 1); + gnap._actionStatus = kAS30LookPillMachine; break; case GRAB_CURSOR: - _vm->_gnap->playScratchingHead(8, 5); + gnap.playScratchingHead(8, 5); break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(8, 5); + gnap.playImpossible(8, 5); break; } } @@ -140,26 +142,26 @@ void Scene30::run() { break; case kHS30ExitCircus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; if (hasTakenPill) _vm->_newSceneNum = 47; else _vm->_newSceneNum = 26; - _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS30ExitCircus].y), 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS30LeaveScene; + gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS30ExitCircus].y), 0, 0x107AE, 1); + gnap._actionStatus = kAS30LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS30ExitCircus] + Common::Point(1, 0), -1, 0x107C2, 1); } break; case kHS30WalkArea1: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -172,11 +174,11 @@ void Scene30::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 300; - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->getRandom(5) == 1) { gameSys.insertSequence(0xFF, 40, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x100, 40, _kidSequenceId, 40, kSeqSyncWait, 0, 0, 0); @@ -188,7 +190,7 @@ void Scene30::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(50) + 180; - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (!_vm->isFlag(kGFUnk23) || hasTakenPill) gameSys.insertSequence(0x109, 20, 0, 0, kSeqNone, 0, 0, 0); else @@ -212,57 +214,58 @@ void Scene30::run() { void Scene30::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS30LeaveScene: _vm->_sceneDone = true; break; case kAS30UsePillMachine: _vm->setGrabCursorSprite(-1); - gameSys.setAnimation(0x105, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x105, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x105; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = kAS30UsePillMachine2; + gameSys.setAnimation(0x105, gnap._id, 0); + gameSys.insertSequence(0x105, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x105; + gnap._sequenceDatNum = 0; + gnap._actionStatus = kAS30UsePillMachine2; break; case kAS30UsePillMachine2: _vm->hideCursor(); _vm->setGrabCursorSprite(-1); _vm->addFullScreenSprite(0x3F, 255); - gameSys.removeSequence(0x105, _vm->_gnap->_id, true); + gameSys.removeSequence(0x105, gnap._id, true); gameSys.setAnimation(0x102, 256, 0); gameSys.insertSequence(0x102, 256, 0, 0, kSeqNone, 0, 0, 0); while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); - gameSys.setAnimation(0x103, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x103, _vm->_gnap->_id, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x103, gnap._id, 0); + gameSys.insertSequence(0x103, gnap._id, 0, 0, kSeqNone, 0, 0, 0); _vm->removeFullScreenSprite(); _vm->showCursor(); - _vm->_gnap->_actionStatus = kAS30UsePillMachine3; + gnap._actionStatus = kAS30UsePillMachine3; _vm->invAdd(kItemPill); _vm->setFlag(kGFUnk23); break; case kAS30UsePillMachine3: - gameSys.setAnimation(0x104, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x104, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, 0x103), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x104; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = kAS30UsePillMachine4; + gameSys.setAnimation(0x104, gnap._id, 0); + gameSys.insertSequence(0x104, gnap._id, makeRid(gnap._sequenceDatNum, 0x103), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x104; + gnap._sequenceDatNum = 0; + gnap._actionStatus = kAS30UsePillMachine4; _vm->setGrabCursorSprite(kItemDiceQuarterHole); break; case kAS30UsePillMachine4: gameSys.insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS30PillMachine] + Common::Point(0, 1), -1, 0x107BC, 1); - _vm->_gnap->_actionStatus = -1; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS30PillMachine] + Common::Point(0, 1), -1, 0x107BC, 1); + gnap._actionStatus = -1; break; case kAS30LookPillMachine: if (_vm->isFlag(kGFUnk23)) _vm->showFullScreenSprite(0xE3); else _vm->showFullScreenSprite(0xE2); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -295,6 +298,7 @@ void Scene31::updateHotspots() { void Scene31::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x1093B, true); _vm->startSoundTimerB(6); @@ -312,16 +316,16 @@ void Scene31::run() { _vm->_timers[5] = _vm->getRandom(50) + 180; if (_vm->_prevSceneNum == 27) { - _vm->_gnap->initPos(-1, 8, kDirBottomLeft); + gnap.initPos(-1, 8, kDirBottomLeft); _vm->_plat->initPos(-1, 9, kDirUnk4); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(3, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(3, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(3, 9), -1, 0x107D2, 1); } else { - _vm->_gnap->initPos(7, 12, kDirBottomRight); + gnap.initPos(7, 12, kDirBottomRight); _vm->_plat->initPos(6, 12, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(7, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(7, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107D2, 1); } @@ -334,32 +338,32 @@ void Scene31::run() { switch (_vm->_sceneClickedHotspot) { case kHS31Device: - if (_vm->_gnap->_actionStatus < 0 || _vm->_gnap->_actionStatus == kAS31PlatMeasuringClown) { + if (gnap._actionStatus < 0 || gnap._actionStatus == kAS31PlatMeasuringClown) { _vm->runMenu(); updateHotspots(); } break; case kHS31Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -367,42 +371,42 @@ void Scene31::run() { break; case kHS31MeasuringClown: - if (_vm->_gnap->_actionStatus < 0 || _vm->_gnap->_actionStatus == kAS31PlatMeasuringClown) { - if (_vm->_gnap->_actionStatus == kAS31PlatMeasuringClown) { + if (gnap._actionStatus < 0 || gnap._actionStatus == kAS31PlatMeasuringClown) { + if (gnap._actionStatus == kAS31PlatMeasuringClown) { if (_vm->_verbCursor == LOOK_CURSOR) - _vm->_gnap->playScratchingHead(2, 2); + gnap.playScratchingHead(2, 2); else - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y + 1, 2, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y + 1, 2, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(2, 2); + gnap.playScratchingHead(2, 2); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown] + Common::Point(0, 1), -1, -1, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown] + Common::Point(0, 1), -1, -1, 1); _vm->_hotspots[kHS31WalkArea1]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown], 0, 0x107B9, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown], 0, 0x107B9, 1); _vm->_hotspots[kHS31WalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnap->_actionStatus = kAS31UseMeasuringClown; + gnap._actionStatus = kAS31UseMeasuringClown; _vm->_timers[4] = 300; break; case TALK_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case PLAT_CURSOR: if (!_vm->invHas(kItemBucketWithBeer)) { - _vm->_gnap->useDeviceOnPlatypus(); + gnap.useDeviceOnPlatypus(); _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown] + Common::Point(0, 1), 1, 0x107C2, 1); _vm->_hotspots[kHS31WalkArea1]._flags |= SF_WALKABLE; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown], 1, 0x107C2, 1); _vm->_hotspots[kHS31WalkArea1]._flags &= ~SF_WALKABLE; _vm->_plat->_actionStatus = kAS31PlatMeasuringClown; - _vm->_gnap->_actionStatus = kAS31PlatMeasuringClown; + gnap._actionStatus = kAS31PlatMeasuringClown; _vm->_timers[4] = 300; } else - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -410,36 +414,36 @@ void Scene31::run() { break; case kHS31BeerBarrel: - if (_vm->_gnap->_actionStatus < 0 || _vm->_gnap->_actionStatus == kAS31PlatMeasuringClown) { + if (gnap._actionStatus < 0 || gnap._actionStatus == kAS31PlatMeasuringClown) { if (_vm->_grabCursorSpriteIndex == kItemEmptyBucket && _beerGuyDistracted) { _vm->setGrabCursorSprite(-1); - _vm->_gnap->walkTo(_vm->_gnap->_pos, -1, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS31BeerBarrel]) | 0x10000, 1); + gnap.walkTo(gnap._pos, -1, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS31BeerBarrel]) | 0x10000, 1); _clerkMeasureMaxCtr += 5; gameSys.insertSequence(0xF8, 59, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->playPullOutDevice(6, 8); - _vm->_gnap->playUseDevice(0, 0); - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel], 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS31FillEmptyBucketWithBeer; + gnap.playPullOutDevice(6, 8); + gnap.playUseDevice(0, 0); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel], 0, 0x107BC, 1); + gnap._actionStatus = kAS31FillEmptyBucketWithBeer; _vm->_timers[4] = 300; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y, 6, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y, 6, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(6, 2); + gnap.playScratchingHead(6, 2); break; case GRAB_CURSOR: if (_beerGuyDistracted) { - _vm->_gnap->playScratchingHead(6, 2); + gnap.playScratchingHead(6, 2); } else { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel], 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS31UseBeerBarrel; - _vm->_gnap->_idleFacing = kDirUpLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel], 0, 0x107BC, 1); + gnap._actionStatus = kAS31UseBeerBarrel; + gnap._idleFacing = kDirUpLeft; } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -447,33 +451,33 @@ void Scene31::run() { break; case kHS31ExitCircus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 26; - _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS31ExitCircus].y), 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS31LeaveScene; + gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS31ExitCircus].y), 0, 0x107AE, 1); + gnap._actionStatus = kAS31LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS31ExitCircus] + Common::Point(1, 0), -1, -1, 1); } break; case kHS31ExitOutsideClown: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 27; - _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS31ExitOutsideClown].y), 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS31LeaveScene; + gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS31ExitOutsideClown].y), 0, 0x107AF, 1); + gnap._actionStatus = kAS31LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS31ExitOutsideClown] + Common::Point(0, 1), -1, 0x107CF, 1); } break; case kHS31WalkArea1: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -487,11 +491,11 @@ void Scene31::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 60; - if (_vm->_gnap->_actionStatus < 0 && _nextClerkSequenceId == -1) { + if (gnap._actionStatus < 0 && _nextClerkSequenceId == -1) { switch (_vm->getRandom(6)){ case 0: _nextClerkSequenceId = 0xFF; @@ -510,7 +514,7 @@ void Scene31::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(50) + 180; - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->getRandom(2) != 0) gameSys.insertSequence(0x104, 20, 0, 0, kSeqNone, 0, 0, 0); else @@ -534,28 +538,29 @@ void Scene31::run() { void Scene31::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS31UseBeerBarrel: _nextClerkSequenceId = 0xFE; break; case kAS31FillEmptyBucketWithBeer: gameSys.setAnimation(0x102, 59, 0); - gameSys.insertSequence(0x102, 59, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_pos = Common::Point(5, 7); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x102; - _vm->_gnap->_id = 59; - _vm->_gnap->_actionStatus = kAS31FillEmptyBucketWithBeerDone; + gameSys.insertSequence(0x102, 59, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._pos = Common::Point(5, 7); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x102; + gnap._id = 59; + gnap._actionStatus = kAS31FillEmptyBucketWithBeerDone; break; case kAS31FillEmptyBucketWithBeerDone: - _vm->_gnap->_idleFacing = kDirBottomLeft; - _vm->_gnap->playPullOutDevice(0, 0); - _vm->_gnap->playUseDevice(0, 0); + gnap._idleFacing = kDirBottomLeft; + gnap.playPullOutDevice(0, 0); + gnap.playUseDevice(0, 0); gameSys.insertSequence(0xF9, 59, 0xF8, 59, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _vm->invAdd(kItemBucketWithBeer); _vm->invRemove(kItemEmptyBucket); _vm->setGrabCursorSprite(kItemBucketWithBeer); @@ -566,7 +571,7 @@ void Scene31::updateAnimations() { break; case kAS31LeaveScene: _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -593,14 +598,14 @@ void Scene31::updateAnimations() { case 0xFC: ++_clerkMeasureCtr; if (_clerkMeasureCtr >= _clerkMeasureMaxCtr) { - if (_vm->_gnap->_actionStatus != 5) + if (gnap._actionStatus != 5) _vm->_plat->_actionStatus = -1; _vm->_timers[0] = 40; gameSys.insertSequence(0xFD, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); _currClerkSequenceId = 0xFD; _nextClerkSequenceId = -1; - if (_vm->_gnap->_actionStatus != kAS31FillEmptyBucketWithBeerDone && _vm->_gnap->_actionStatus != kAS31FillEmptyBucketWithBeer) - _vm->_gnap->_actionStatus = -1; + if (gnap._actionStatus != kAS31FillEmptyBucketWithBeerDone && gnap._actionStatus != kAS31FillEmptyBucketWithBeer) + gnap._actionStatus = -1; _beerGuyDistracted = false; _clerkMeasureMaxCtr = 3; gameSys.setAnimation(0xFD, 39, 3); @@ -617,7 +622,7 @@ void Scene31::updateAnimations() { gameSys.setAnimation(_nextClerkSequenceId, 39, 3); _currClerkSequenceId = _nextClerkSequenceId; _nextClerkSequenceId = -1; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; default: if (_nextClerkSequenceId != -1) { @@ -657,6 +662,7 @@ void Scene32::updateHotspots() { void Scene32::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x1091C, true); _vm->startSoundTimerC(5); @@ -664,13 +670,13 @@ void Scene32::run() { _vm->_timers[4] = _vm->getRandom(100) + 300; if (_vm->_prevSceneNum == 33) { - _vm->_gnap->initPos(11, 6, kDirBottomLeft); + gnap.initPos(11, 6, kDirBottomLeft); _vm->_plat->initPos(12, 6, kDirUnk4); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(9, 6), -1, 0x107D2, 1); - _vm->_gnap->walkTo(Common::Point(8, 6), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(8, 6), -1, 0x107BA, 1); } else { - _vm->_gnap->initPos(1, 6, kDirBottomRight); + gnap.initPos(1, 6, kDirBottomRight); _vm->_plat->initPos(1, 7, kDirNone); _vm->endSceneInit(); } @@ -685,30 +691,30 @@ void Scene32::run() { switch (_vm->_sceneClickedHotspot) { case kHS32Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS32Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -716,11 +722,11 @@ void Scene32::run() { break; case kHS32ExitTruck: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->setGrabCursorSprite(-1); - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck], 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS32LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck], 0, 0x107AB, 1); + gnap._actionStatus = kAS32LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck] + Common::Point(0, 1), -1, 0x107CD, 1); _vm->_newSceneNum = 33; } @@ -734,14 +740,14 @@ void Scene32::run() { case kHS32WalkArea6: case kHS32WalkArea7: case kHS32WalkArea8: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; } - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = 0; } @@ -753,8 +759,8 @@ void Scene32::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 300; if (_vm->getRandom(2) != 0) @@ -812,6 +818,7 @@ void Scene33::updateHotspots() { void Scene33::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x1091C, true); _vm->startSoundTimerC(6); @@ -826,26 +833,26 @@ void Scene33::run() { switch (_vm->_prevSceneNum) { case 34: - _vm->_gnap->initPos(11, 7, kDirBottomLeft); + gnap.initPos(11, 7, kDirBottomLeft); _vm->_plat->initPos(12, 7, kDirUnk4); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(8, 7), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(8, 7), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(9, 7), -1, 0x107D2, 1); break; case 37: - _vm->_gnap->initPos(7, 7, kDirBottomRight); + gnap.initPos(7, 7, kDirBottomRight); _vm->_plat->initPos(8, 7, kDirNone); _vm->endSceneInit(); break; case 32: - _vm->_gnap->initPos(-1, 6, kDirBottomRight); + gnap.initPos(-1, 6, kDirBottomRight); _vm->_plat->initPos(-1, 7, kDirNone); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(2, 7), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); break; default: - _vm->_gnap->initPos(3, 7, kDirBottomRight); + gnap.initPos(3, 7, kDirBottomRight); _vm->_plat->initPos(2, 7, kDirNone); _vm->endSceneInit(); break; @@ -861,30 +868,30 @@ void Scene33::run() { switch (_vm->_sceneClickedHotspot) { case kHS33Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS33Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -892,26 +899,26 @@ void Scene33::run() { break; case kHS33Chicken: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(7, 9, 9, 8); + gnap.playShowCurrItem(7, 9, 9, 8); } else { switch (_vm->_verbCursor) { case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirBottomRight; - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS33Chicken], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) - _vm->_gnap->_actionStatus = kAS33UseChicken; + gnap._idleFacing = kDirBottomRight; + if (gnap.walkTo(_vm->_hotspotsWalkPos[kHS33Chicken], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) + gnap._actionStatus = kAS33UseChicken; else - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS33Chicken], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS33TalkChicken; + gnap._idleFacing = kDirBottomRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS33Chicken], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS33TalkChicken; break; case LOOK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -919,44 +926,44 @@ void Scene33::run() { break; case kHS33ExitHouse: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->_actionStatus = kAS33LeaveScene; + gnap._actionStatus = kAS33LeaveScene; _vm->_newSceneNum = 37; - if (_vm->_gnap->_pos.x > 6) - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, 0x107AD, 1); + if (gnap._pos.x > 6) + gnap.walkTo(gnap._pos, 0, 0x107AD, 1); else - _vm->_gnap->walkTo(Common::Point(6, 7), 0, 0x107B1, 1); + gnap.walkTo(Common::Point(6, 7), 0, 0x107B1, 1); } break; case kHS33ExitBarn: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->_actionStatus = kAS33LeaveScene; + gnap._actionStatus = kAS33LeaveScene; _vm->_newSceneNum = 35; - if (_vm->_gnap->_pos.x > 7) - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, 0x107AD, 1); + if (gnap._pos.x > 7) + gnap.walkTo(gnap._pos, 0, 0x107AD, 1); else - _vm->_gnap->walkTo(Common::Point(7, 7), 0, 0x107B1, 1); + gnap.walkTo(Common::Point(7, 7), 0, 0x107B1, 1); } break; case kHS33ExitCreek: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek], 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS33LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek], 0, 0x107AB, 1); + gnap._actionStatus = kAS33LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek], -1, 0x107CD, 1); _vm->_newSceneNum = 34; } break; case kHS33ExitPigpen: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen], 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS33LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen], 0, 0x107AF, 1); + gnap._actionStatus = kAS33LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen], -1, 0x107CF, 1); _vm->_newSceneNum = 32; } @@ -964,13 +971,13 @@ void Scene33::run() { case kHS33WalkArea1: case kHS33WalkArea2: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -984,8 +991,8 @@ void Scene33::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 300; if (_vm->getRandom(2) != 0) @@ -993,7 +1000,7 @@ void Scene33::run() { else gameSys.insertSequence(0x82, 256, 0, 0, kSeqNone, 0, 0, 0); } - if (!_vm->_timers[5] && _nextChickenSequenceId == -1 && _vm->_gnap->_actionStatus != kAS33TalkChicken && _vm->_gnap->_actionStatus != kAS33UseChicken) { + if (!_vm->_timers[5] && _nextChickenSequenceId == -1 && gnap._actionStatus != kAS33TalkChicken && gnap._actionStatus != kAS33UseChicken) { if (_vm->getRandom(6) != 0) { _nextChickenSequenceId = 0x7E; _vm->_timers[5] = _vm->getRandom(20) + 30; @@ -1018,9 +1025,10 @@ void Scene33::run() { void Scene33::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS33LeaveScene: _vm->_sceneDone = true; break; @@ -1032,17 +1040,17 @@ void Scene33::updateAnimations() { _vm->_timers[2] = 100; break; case kAS33UseChickenDone: - gameSys.insertSequence(0x107B5, _vm->_gnap->_id, 0x81, 179, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); - _vm->_gnap->_sequenceId = 0x7B5; - _vm->_gnap->_sequenceDatNum = 1; + gameSys.insertSequence(0x107B5, gnap._id, 0x81, 179, kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); + gnap._sequenceId = 0x7B5; + gnap._sequenceDatNum = 1; _currChickenSequenceId = 0x7E; gameSys.setAnimation(0x7E, 179, 2); gameSys.insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _vm->_timers[5] = 30; break; default: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -1050,18 +1058,18 @@ void Scene33::updateAnimations() { if (gameSys.getAnimationStatus(2) == 2) { if (_nextChickenSequenceId == 0x81) { gameSys.setAnimation(_nextChickenSequenceId, 179, 0); - gameSys.insertSequence(_nextChickenSequenceId, 179, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextChickenSequenceId, 179, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(_currChickenSequenceId, 179, true); _nextChickenSequenceId = -1; _currChickenSequenceId = -1; - _vm->_gnap->_actionStatus = kAS33UseChickenDone; + gnap._actionStatus = kAS33UseChickenDone; _vm->_timers[5] = 500; } else if (_nextChickenSequenceId == 0x7F) { gameSys.setAnimation(_nextChickenSequenceId, 179, 2); gameSys.insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); _currChickenSequenceId = _nextChickenSequenceId; _nextChickenSequenceId = -1; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } else if (_nextChickenSequenceId != -1) { gameSys.setAnimation(_nextChickenSequenceId, 179, 2); gameSys.insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); @@ -1085,6 +1093,8 @@ int Scene38::init() { } void Scene38::updateHotspots() { + PlayerGnap& gnap = *_vm->_gnap; + _vm->setHotspot(kHS38Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); _vm->setHotspot(kHS38ExitHouse, 150, 585, 650, 600, SF_EXIT_D_CURSOR, 0, 8); _vm->setHotspot(kHS38ExitCave, 430, 440, 655, 470, SF_WALKABLE, 0, 8); @@ -1102,15 +1112,15 @@ void Scene38::updateHotspots() { _vm->_hotspots[kHS38Platypus]._flags = SF_WALKABLE | SF_DISABLED; if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->_hotspots[kHS38ExitCave]._flags = SF_EXIT_D_CURSOR; - else if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) + else if (gnap._actionStatus == kAS38HoldingHuntingTrophy) _vm->_hotspots[kHS38ExitCave]._flags = SF_EXIT_D_CURSOR; if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->_hotspots[kHS38TrapDoorLid1]._flags = SF_DISABLED; - else if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) + else if (gnap._actionStatus == kAS38HoldingHuntingTrophy) _vm->_hotspots[kHS38TrapDoorLid1]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->_hotspots[kHS38TrapDoorLid2]._flags = SF_DISABLED; - else if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) + else if (gnap._actionStatus == kAS38HoldingHuntingTrophy) _vm->_hotspots[kHS38TrapDoorLid2]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->_hotspots[kHS38WalkArea6]._flags = SF_NONE; @@ -1118,14 +1128,16 @@ void Scene38::updateHotspots() { } void Scene38::run() { + PlayerGnap& gnap = *_vm->_gnap; + _vm->queueInsertDeviceIcon(); _vm->_gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 39) { - _vm->_gnap->initPos(3, 7, kDirBottomLeft); + gnap.initPos(3, 7, kDirBottomLeft); _vm->_plat->initPos(4, 7, kDirUnk4); } else { - _vm->_gnap->initPos(3, 8, kDirBottomRight); + gnap.initPos(3, 8, kDirBottomRight); _vm->_plat->initPos(4, 8, kDirNone); } _vm->endSceneInit(); @@ -1144,87 +1156,87 @@ void Scene38::run() { break; case kHS38Platypus: - if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) { - _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; + if (gnap._actionStatus == kAS38HoldingHuntingTrophy) { + gnap._actionStatus = kAS38ReleaseHuntingTrophy; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } break; case kHS38ExitHouse: - if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) { - _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; + if (gnap._actionStatus == kAS38HoldingHuntingTrophy) { + gnap._actionStatus = kAS38ReleaseHuntingTrophy; } else { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(-1, -1), 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS38LeaveScene; + gnap.walkTo(Common::Point(-1, -1), 0, 0x107AE, 1); + gnap._actionStatus = kAS38LeaveScene; _vm->_newSceneNum = 37; } break; case kHS38ExitCave: - if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) { - _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; + if (gnap._actionStatus == kAS38HoldingHuntingTrophy) { + gnap._actionStatus = kAS38ReleaseHuntingTrophy; if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->_isLeavingScene = true; } else if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) { _vm->_sceneWaiting = false; _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(5, 7), 0, 0x107BB, 1); + gnap.walkTo(Common::Point(5, 7), 0, 0x107BB, 1); _vm->_newSceneNum = 39; - _vm->_gnap->_actionStatus = kAS38ExitCave; + gnap._actionStatus = kAS38ExitCave; } break; case kHS38TrapDoorLid1: case kHS38TrapDoorLid2: - if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) { + if (gnap._actionStatus == kAS38HoldingHuntingTrophy) { if (_vm->_verbCursor == PLAT_CURSOR && _vm->_plat->_actionStatus != kAS38PlatypusHoldingTrapDoor) - _vm->_gnap->_actionStatus = kAS38UsePlatypusWithTrapDoor; + gnap._actionStatus = kAS38UsePlatypusWithTrapDoor; else - _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; + gnap._actionStatus = kAS38ReleaseHuntingTrophy; } break; case kHS38HuntingTrophy: - if (_vm->_gnap->_actionStatus != kAS38HoldingHuntingTrophy) { + if (gnap._actionStatus != kAS38HoldingHuntingTrophy) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(3, 6, 2, 0); + gnap.playShowCurrItem(3, 6, 2, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(0, 0); + gnap.playScratchingHead(0, 0); break; case GRAB_CURSOR: if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); else { - _vm->_gnap->walkTo(Common::Point(3, 6), 0, 0x107BB, 1); + gnap.walkTo(Common::Point(3, 6), 0, 0x107BB, 1); _vm->_plat->walkTo(Common::Point(4, 8), -1, -1, 1); - _vm->_gnap->_actionStatus = kAS38UseHuntingTrophy; + gnap._actionStatus = kAS38UseHuntingTrophy; } break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(2, 0); + gnap.playBrainPulsating(2, 0); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1240,18 +1252,18 @@ void Scene38::run() { case kHS38WalkArea4: case kHS38WalkArea5: case kHS38WalkArea6: - if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) - _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; - else if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus == kAS38HoldingHuntingTrophy) + gnap._actionStatus = kAS38ReleaseHuntingTrophy; + else if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) - _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; - else if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus == kAS38HoldingHuntingTrophy) + gnap._actionStatus = kAS38ReleaseHuntingTrophy; + else if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1261,7 +1273,7 @@ void Scene38::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); } _vm->checkGameKeys(); @@ -1278,89 +1290,90 @@ void Scene38::run() { void Scene38::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS38LeaveScene: _vm->_sceneDone = true; break; case kAS38ExitCave: gameSys.removeSequence(_vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, true); - gameSys.insertSequence(0xA3, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0xA3; - _vm->_gnap->_sequenceDatNum = 0; - gameSys.setAnimation(0xA3, _vm->_gnap->_id, 0); - _vm->_gnap->_actionStatus = kAS38LeaveScene; + gameSys.insertSequence(0xA3, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0xA3; + gnap._sequenceDatNum = 0; + gameSys.setAnimation(0xA3, gnap._id, 0); + gnap._actionStatus = kAS38LeaveScene; break; case kAS38UseHuntingTrophy: gameSys.removeSequence(0x9B, 0, true); - gameSys.insertSequence(0x9C, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x9C; - _vm->_gnap->_sequenceDatNum = 0; - gameSys.setAnimation(0x9C, _vm->_gnap->_id, 0); - _vm->_gnap->_actionStatus = kAS38HoldingHuntingTrophy; + gameSys.insertSequence(0x9C, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x9C; + gnap._sequenceDatNum = 0; + gameSys.setAnimation(0x9C, gnap._id, 0); + gnap._actionStatus = kAS38HoldingHuntingTrophy; updateHotspots(); break; case kAS38HoldingHuntingTrophy: if (_vm->_plat->_actionStatus != kAS38PlatypusHoldingTrapDoor) _vm->_sceneWaiting = true; - if (_vm->_gnap->_sequenceId == 0xA4) { - gameSys.insertSequence(0x9D, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x9D; + if (gnap._sequenceId == 0xA4) { + gameSys.insertSequence(0x9D, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x9D; } else { - gameSys.insertSequence(0xA4, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0xA4; + gameSys.insertSequence(0xA4, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0xA4; } - _vm->_gnap->_sequenceDatNum = 0; - gameSys.setAnimation(_vm->_gnap->_sequenceId, _vm->_gnap->_id, 0); + gnap._sequenceDatNum = 0; + gameSys.setAnimation(gnap._sequenceId, gnap._id, 0); break; case kAS38ReleaseHuntingTrophy: - if (_vm->_gnap->_sequenceId == 0x9E) { + if (gnap._sequenceId == 0x9E) { gameSys.insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } else if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) { - gameSys.insertSequence(0xA0, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0xA0; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_pos = Common::Point(3, 6); - _vm->_gnap->_idleFacing = kDirBottomRight; + gameSys.insertSequence(0xA0, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0xA0; + gnap._sequenceDatNum = 0; + gnap._pos = Common::Point(3, 6); + gnap._idleFacing = kDirBottomRight; if (_vm->_isLeavingScene) { _vm->_sceneWaiting = false; - _vm->_gnap->walkTo(Common::Point(5, 7), 0, 0x107BB, 1); + gnap.walkTo(Common::Point(5, 7), 0, 0x107BB, 1); _vm->_newSceneNum = 39; - _vm->_gnap->_actionStatus = kAS38ExitCave; + gnap._actionStatus = kAS38ExitCave; } else { - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } } else { - gameSys.insertSequence(0x9E, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x9E; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_pos = Common::Point(3, 6); - _vm->_gnap->_idleFacing = kDirBottomRight; - gameSys.setAnimation(0x9E, _vm->_gnap->_id, 0); + gameSys.insertSequence(0x9E, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x9E; + gnap._sequenceDatNum = 0; + gnap._pos = Common::Point(3, 6); + gnap._idleFacing = kDirBottomRight; + gameSys.setAnimation(0x9E, gnap._id, 0); _vm->_sceneWaiting = false; updateHotspots(); } break; case kAS38UsePlatypusWithTrapDoor: _vm->_sceneWaiting = false; - gameSys.insertSequence(0x9F, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x9F; - _vm->_gnap->_sequenceDatNum = 0; - gameSys.setAnimation(0x9F, _vm->_gnap->_id, 0); - _vm->_gnap->_actionStatus = kAS38HoldingHuntingTrophy; + gameSys.insertSequence(0x9F, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x9F; + gnap._sequenceDatNum = 0; + gameSys.setAnimation(0x9F, gnap._id, 0); + gnap._actionStatus = kAS38HoldingHuntingTrophy; if (_vm->_plat->_idleFacing != kDirNone) _vm->_plat->playSequence(0x107D5); else _vm->_plat->playSequence(0x107D4); _vm->_plat->walkTo(Common::Point(8, 7), -1, 0x107D2, 1); - gameSys.insertSequence(0xA1, _vm->_gnap->_id + 1, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xA1, gnap._id + 1, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); _vm->_plat->_sequenceId = 0xA1; _vm->_plat->_sequenceDatNum = 0; - _vm->_plat->_id = _vm->_gnap->_id + 1; - gameSys.setAnimation(0xA1, _vm->_gnap->_id + 1, 1); + _vm->_plat->_id = gnap._id + 1; + gameSys.setAnimation(0xA1, gnap._id + 1, 1); _vm->_plat->_actionStatus = kAS38PlatypusHoldingTrapDoor; updateHotspots(); break; @@ -1407,6 +1420,7 @@ void Scene39::updateHotspots() { void Scene39::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; // Bug in the original? Timer was never initialized. _vm->_timers[5] = 0; @@ -1420,11 +1434,11 @@ void Scene39::run() { _nextGuySequenceId = -1; if (_vm->_prevSceneNum == 38) { - _vm->_gnap->initPos(3, 7, kDirUpRight); + gnap.initPos(3, 7, kDirUpRight); _vm->_plat->initPos(2, 7, kDirUpLeft); _vm->endSceneInit(); } else { - _vm->_gnap->initPos(4, 7, kDirBottomRight); + gnap.initPos(4, 7, kDirBottomRight); _vm->_plat->initPos(5, 7, kDirNone); _vm->endSceneInit(); } @@ -1451,23 +1465,23 @@ void Scene39::run() { break; case kHS39Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -1475,30 +1489,30 @@ void Scene39::run() { break; case kHS39ExitUfoParty: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_sceneDone = true; - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS39LeaveScene; + gnap.walkTo(gnap._pos, 0, 0x107AB, 1); + gnap._actionStatus = kAS39LeaveScene; _vm->_newSceneNum = 40; } break; case kHS39Sign: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS39Sign], 0, -1, 1); - _vm->_gnap->playIdle(_vm->_hotspotsWalkPos[kHS39Sign].x, _vm->_hotspotsWalkPos[kHS39Sign].y); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS39Sign], 0, -1, 1); + gnap.playIdle(_vm->_hotspotsWalkPos[kHS39Sign].x, _vm->_hotspotsWalkPos[kHS39Sign].y); _vm->showFullScreenSprite(0x1C); break; case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1506,7 +1520,7 @@ void Scene39::run() { break; case kHS39ExitInsideHouse: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_sceneDone = true; _vm->_isLeavingScene = true; _vm->_newSceneNum = 38; @@ -1515,13 +1529,13 @@ void Scene39::run() { case kHS39WalkArea1: case kHS39WalkArea2: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1532,8 +1546,8 @@ void Scene39::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(20) + 50; switch (_vm->getRandom(4)) { @@ -1568,13 +1582,14 @@ void Scene39::run() { void Scene39::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - if (_vm->_gnap->_actionStatus == kAS39LeaveScene) + if (gnap._actionStatus == kAS39LeaveScene) _vm->_sceneDone = true; else - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } if (gameSys.getAnimationStatus(3) == 2 && _nextGuySequenceId != -1) { diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index 44a99f9f90..154f837ea1 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -52,6 +52,8 @@ void Scene40::updateHotspots() { } void Scene40::run() { + PlayerGnap& gnap = *_vm->_gnap; + _vm->queueInsertDeviceIcon(); _vm->endSceneInit(); @@ -74,23 +76,23 @@ void Scene40::run() { break; case kHS40Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -98,56 +100,56 @@ void Scene40::run() { break; case kHS40ExitCave: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_newSceneNum = 39; _vm->_sceneDone = true; } break; case kHS40ExitToyStand: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_newSceneNum = 41; _vm->_sceneDone = true; } break; case kHS40ExitBBQ: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_newSceneNum = 42; _vm->_sceneDone = true; } break; case kHS40ExitUfo: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_newSceneNum = 43; _vm->_sceneDone = true; } break; case kHS40ExitKissinBooth: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_newSceneNum = 44; _vm->_sceneDone = true; } break; case kHS40ExitDancefloor: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_newSceneNum = 45; _vm->_sceneDone = true; } break; case kHS40ExitShoe: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_newSceneNum = 46; _vm->_sceneDone = true; } break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) _vm->_mouseClickState._left = false; break; @@ -168,11 +170,12 @@ void Scene40::run() { void Scene40::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - if (_vm->_gnap->_actionStatus) - _vm->_gnap->_actionStatus = -1; + if (gnap._actionStatus) + gnap._actionStatus = -1; else _vm->_sceneDone = true; } @@ -220,6 +223,7 @@ void Scene41::updateHotspots() { void Scene41::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->queueInsertDeviceIcon(); @@ -228,7 +232,7 @@ void Scene41::run() { if (_vm->_toyUfoY < 0 || _vm->_toyUfoY > 300) _vm->_toyUfoY = 150; if (!_vm->_timers[9]) - _vm->_gnap->_actionStatus = kAS41GiveBackToyUfo; + gnap._actionStatus = kAS41GiveBackToyUfo; } else { if (!_vm->isFlag(kGFUnk16) && !_vm->isFlag(kGFJointTaken) && !_vm->isFlag(kGFUnk18) && !_vm->isFlag(kGFGroceryStoreHatTaken)) _vm->toyUfoSetStatus(kGFUnk16); @@ -263,29 +267,29 @@ void Scene41::run() { gameSys.insertSequence(0x127, 2, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->_gnap->_sequenceId = 0x120; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_pos = Common::Point(7, 7); - _vm->_gnap->_id = 140; + gnap._sequenceId = 0x120; + gnap._sequenceDatNum = 0; + gnap._idleFacing = kDirUpRight; + gnap._pos = Common::Point(7, 7); + gnap._id = 140; gameSys.insertSequence(0x120, 140, 0, 0, kSeqNone, 0, 0, 0); - gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); + gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); _vm->_plat->initPos(8, 10, kDirBottomLeft); _vm->endSceneInit(); } else if (_vm->_prevSceneNum == 45) { - _vm->_gnap->initPos(-1, 8, kDirUpRight); + gnap.initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-2, 8, kDirUpLeft); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); } else if (_vm->_prevSceneNum == 42) { - _vm->_gnap->initPos(11, 8, kDirUpRight); + gnap.initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); } else { - _vm->_gnap->initPos(5, 8, kDirBottomRight); + gnap.initPos(5, 8, kDirBottomRight); _vm->_plat->initPos(6, 8, kDirBottomLeft); _vm->endSceneInit(); } @@ -349,23 +353,23 @@ void Scene41::run() { break; case kHS41Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -374,49 +378,49 @@ void Scene41::run() { case kHS41ExitCave: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS41ExitCave], 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS41LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS41ExitCave], 0, 0x107AE, 1); + gnap._actionStatus = kAS41LeaveScene; _vm->_newSceneNum = 40; break; case kHS41Exit: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41Exit].x, -1), 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS41LeaveScene; + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41Exit].x, -1), 0, 0x107AF, 1); + gnap._actionStatus = kAS41LeaveScene; _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41Exit].x, -1), -1, 0x107CF, 1); _vm->_newSceneNum = 45; break; case kHS41ExitBBQ: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1), 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS41LeaveScene; + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1), 0, 0x107AB, 1); + gnap._actionStatus = kAS41LeaveScene; _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1), -1, 0x107CD, 1); _vm->_newSceneNum = 42; break; case kHS41ToyVendor: if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->_gnap->_actionStatus = kAS41UseQuarterWithToyVendor; - _vm->_gnap->walkTo(Common::Point(4, 7), 0, 0x107BB, 9); - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 5, 0); + gnap._actionStatus = kAS41UseQuarterWithToyVendor; + gnap.walkTo(Common::Point(4, 7), 0, 0x107BB, 9); + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 5, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(4, 7, 5, 0); + gnap.playShowCurrItem(4, 7, 5, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(5, 0); + gnap.playMoan1(5, 0); break; case GRAB_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(Common::Point(4, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS41TalkToyVendor; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(Common::Point(4, 7), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS41TalkToyVendor; break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -424,27 +428,27 @@ void Scene41::run() { case kHS41Kid: if (_vm->_grabCursorSpriteIndex == kItemChickenBucket) { - _vm->_gnap->walkTo(Common::Point(7, 7), 0, 0x107BB, 1); - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_actionStatus = kAS41UseChickenBucketWithKid; + gnap.walkTo(Common::Point(7, 7), 0, 0x107BB, 1); + gnap._idleFacing = kDirUpRight; + gnap._actionStatus = kAS41UseChickenBucketWithKid; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(7, 7, 8, 0); + gnap.playShowCurrItem(7, 7, 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(9, 0); + gnap.playScratchingHead(9, 0); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(Common::Point(7, 7), 0, 0x107BB, 1); - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_actionStatus = kAS41GrabKid; + gnap.walkTo(Common::Point(7, 7), 0, 0x107BB, 1); + gnap._idleFacing = kDirUpRight; + gnap._actionStatus = kAS41GrabKid; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(Common::Point(7, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._idleFacing = kDirUpRight; + gnap.walkTo(Common::Point(7, 7), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -452,58 +456,58 @@ void Scene41::run() { case kHS41ToyUfo: if (_vm->_grabCursorSpriteIndex == kItemGum) { - _vm->_gnap->playPullOutDevice(9, 0); - gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); - _vm->_gnap->_actionStatus = kAS41UseGumWithToyUfo; + gnap.playPullOutDevice(9, 0); + gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); + gnap._actionStatus = kAS41UseGumWithToyUfo; } break; case kHS41WalkArea1: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; } } if (_vm->isFlag(kGFGnapControlsToyUFO)) { - if (!_vm->_timers[9] && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->_actionStatus = kAS41GiveBackToyUfo; - if (_vm->_gnap->_sequenceId == 0x121 || _vm->_gnap->_sequenceId == 0x122) { - gameSys.insertSequence(0x123, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x123; - _vm->_gnap->_sequenceDatNum = 0; - gameSys.setAnimation(0x123, _vm->_gnap->_id, 0); + if (!_vm->_timers[9] && gnap._actionStatus < 0) { + gnap._actionStatus = kAS41GiveBackToyUfo; + if (gnap._sequenceId == 0x121 || gnap._sequenceId == 0x122) { + gameSys.insertSequence(0x123, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x123; + gnap._sequenceDatNum = 0; + gameSys.setAnimation(0x123, gnap._id, 0); } } } - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { _vm->_mouseClickState._left = false; if (_vm->isFlag(kGFGnapControlsToyUFO)) { int sequenceId; if (_vm->_leftClickMouseX >= 400) { - if (_vm->_gnap->_sequenceId == 0x11F || _vm->_gnap->_sequenceId == 0x120 || _vm->_gnap->_sequenceId == 0x123 || _vm->_gnap->_sequenceId == 0x126) + if (gnap._sequenceId == 0x11F || gnap._sequenceId == 0x120 || gnap._sequenceId == 0x123 || gnap._sequenceId == 0x126) sequenceId = 0x120; else if (_vm->_leftClickMouseX - _vm->_toyUfoX >= 400) sequenceId = 0x126; else sequenceId = 0x123; } else { - if (_vm->_gnap->_sequenceId == 0x121 || _vm->_gnap->_sequenceId == 0x125 || _vm->_gnap->_sequenceId == 0x122) + if (gnap._sequenceId == 0x121 || gnap._sequenceId == 0x125 || gnap._sequenceId == 0x122) sequenceId = 0x122; else if (_vm->_toyUfoX - _vm->_leftClickMouseX >= 400) sequenceId = 0x125; else sequenceId = 0x121; } - gameSys.insertSequence(sequenceId, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = sequenceId; - _vm->_gnap->_sequenceDatNum = 0; - gameSys.setAnimation(sequenceId, _vm->_gnap->_id, 0); + gameSys.insertSequence(sequenceId, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = sequenceId; + gnap._sequenceDatNum = 0; + gameSys.setAnimation(sequenceId, gnap._id, 0); _vm->_toyUfoActionStatus = kAS41ToyUfoRefresh; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); } else { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); } } @@ -512,11 +516,11 @@ void Scene41::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 100; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextToyVendorSequenceId == -1) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextToyVendorSequenceId == -1) { switch (_vm->getRandom(3)) { case 0: _nextToyVendorSequenceId = 0x113; @@ -534,7 +538,7 @@ void Scene41::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(30) + 20; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextKidSequenceId == -1) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextKidSequenceId == -1) { if (_vm->isFlag(kGFGnapControlsToyUFO)) _nextKidSequenceId = 0x11B; else if (_vm->getRandom(3) != 0) @@ -560,28 +564,29 @@ void Scene41::run() { void Scene41::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS41LeaveScene: gameSys.setAnimation(0, 0, 0); _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS41UseQuarterWithToyVendor: gameSys.setAnimation(0, 0, 0); _nextToyVendorSequenceId = 0x114; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS41TalkToyVendor: gameSys.setAnimation(0, 0, 0); _nextToyVendorSequenceId = 0x116; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS41UseGumWithToyUfo: gameSys.setAnimation(0, 0, 0); - _vm->_gnap->playUseDevice(9, 0); - _vm->_gnap->_actionStatus = -1; + gnap.playUseDevice(9, 0); + gnap._actionStatus = -1; _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemGum); _vm->_toyUfoActionStatus = kAS41UfoGumAttached; @@ -591,17 +596,17 @@ void Scene41::updateAnimations() { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; _vm->setGrabCursorSprite(-1); - gameSys.insertSequence(0x11F, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x11F; - _vm->_gnap->_sequenceDatNum = 0; - gameSys.setAnimation(0x11F, _vm->_gnap->_id, 0); + gameSys.insertSequence(0x11F, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x11F; + gnap._sequenceDatNum = 0; + gameSys.setAnimation(0x11F, gnap._id, 0); _nextKidSequenceId = 0x11A; gameSys.insertSequence(0x11A, 1, _currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextKidSequenceId, 1, 4); _currKidSequenceId = _nextKidSequenceId; _nextKidSequenceId = 0x11B; _vm->_timers[5] = _vm->getRandom(30) + 20; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _vm->setFlag(kGFGnapControlsToyUFO); updateHotspots(); _vm->_timers[9] = 600; @@ -611,10 +616,10 @@ void Scene41::updateAnimations() { if (gameSys.getAnimationStatus(3) == 2 && gameSys.getAnimationStatus(4) == 2) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - gameSys.insertSequence(0x110, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x110; - _vm->_gnap->_sequenceDatNum = 0; - gameSys.setAnimation(0x110, _vm->_gnap->_id, 0); + gameSys.insertSequence(0x110, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x110; + gnap._sequenceDatNum = 0; + gameSys.setAnimation(0x110, gnap._id, 0); _nextToyVendorSequenceId = 0x111; gameSys.insertSequence(0x111, 1, _currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextToyVendorSequenceId, 1, 3); @@ -627,19 +632,19 @@ void Scene41::updateAnimations() { _currKidSequenceId = _nextKidSequenceId; _nextKidSequenceId = -1; _vm->_timers[5] = _vm->getRandom(30) + 20; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } break; case kAS41GiveBackToyUfo: if (gameSys.getAnimationStatus(3) == 2 && gameSys.getAnimationStatus(4) == 2) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - gameSys.insertSequence(0x124, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, + gameSys.insertSequence(0x124, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x124; - _vm->_gnap->_sequenceDatNum = 0; - gameSys.setAnimation(0x124, _vm->_gnap->_id, 0); + gnap._sequenceId = 0x124; + gnap._sequenceDatNum = 0; + gameSys.setAnimation(0x124, gnap._id, 0); _nextToyVendorSequenceId = 0x112; gameSys.insertSequence(0x112, 1, _currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextToyVendorSequenceId, 1, 3); @@ -652,7 +657,7 @@ void Scene41::updateAnimations() { _currKidSequenceId = _nextKidSequenceId; _nextKidSequenceId = -1; _vm->_timers[5] = _vm->getRandom(30) + 20; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _vm->clearFlag(kGFGnapControlsToyUFO); updateHotspots(); } @@ -750,6 +755,7 @@ void Scene42::updateHotspots() { void Scene42::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->queueInsertDeviceIcon(); @@ -785,22 +791,22 @@ void Scene42::run() { if (_vm->_toyUfoSequenceId == 0x872) _vm->setGrabCursorSprite(-1); } else if (_vm->_prevSceneNum == 41) { - _vm->_gnap->initPos(-1, 8, kDirUpRight); + gnap.initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-1, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); } else if (_vm->_prevSceneNum == 43) { - _vm->_gnap->initPos(11, 8, kDirUpRight); + gnap.initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); } else { - _vm->_gnap->initPos(5, 11, kDirUpRight); + gnap.initPos(5, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(5, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); } @@ -861,23 +867,23 @@ void Scene42::run() { break; case kHS42Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -886,49 +892,49 @@ void Scene42::run() { case kHS42ExitUfoParty: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y), 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS42LeaveScene; + gnap.walkTo(Common::Point(gnap._pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y), 0, 0x107AE, 1); + gnap._actionStatus = kAS42LeaveScene; _vm->_plat->walkTo(Common::Point(_vm->_plat->_pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y), -1, 0x107C7, 1); _vm->_newSceneNum = 40; break; case kHS42ExitToyStand: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS42ExitToyStand].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS42LeaveScene; + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS42ExitToyStand].x, gnap._pos.y), 0, 0x107AF, 1); + gnap._actionStatus = kAS42LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS42ExitToyStand], -1, 0x107CF, 1); _vm->_newSceneNum = 41; break; case kHS42ExitUfo: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS42ExitUfo].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS42LeaveScene; + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS42ExitUfo].x, gnap._pos.y), 0, 0x107AB, 1); + gnap._actionStatus = kAS42LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS42ExitUfo], -1, 0x107CD, 1); _vm->_newSceneNum = 43; break; case kHS42BBQVendor: if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor], 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS42UseQuarterWithBBQVendor; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor], 0, 0x107BB, 1); + gnap._actionStatus = kAS42UseQuarterWithBBQVendor; if (_vm->_plat->_pos.y < 9) _vm->_plat->walkTo(Common::Point(_vm->_plat->_pos.x, 9), -1, -1, 1); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS42BBQVendor].x, _vm->_hotspotsWalkPos[kHS42BBQVendor].y, _vm->_hotspotsWalkPos[kHS42BBQVendor].x + 1, 0); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS42BBQVendor].x, _vm->_hotspotsWalkPos[kHS42BBQVendor].y, _vm->_hotspotsWalkPos[kHS42BBQVendor].x + 1, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_hotspotsWalkPos[kHS42BBQVendor].x - 1, 0); + gnap.playScratchingHead(_vm->_hotspotsWalkPos[kHS42BBQVendor].x - 1, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS42TalkBBQVendor; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS42TalkBBQVendor; break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -936,19 +942,19 @@ void Scene42::run() { case kHS42ChickenLeg: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS42ChickenLeg].x, _vm->_hotspotsWalkPos[kHS42ChickenLeg].y, _vm->_hotspotsWalkPos[kHS42ChickenLeg].x - 1, 0); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS42ChickenLeg].x, _vm->_hotspotsWalkPos[kHS42ChickenLeg].y, _vm->_hotspotsWalkPos[kHS42ChickenLeg].x - 1, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_hotspotsWalkPos[kHS42ChickenLeg].x - 1, 0); + gnap.playScratchingHead(_vm->_hotspotsWalkPos[kHS42ChickenLeg].x - 1, 0); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS42ChickenLeg], 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS42GrabChickenLeg; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS42ChickenLeg], 0, 0x107BC, 1); + gnap._actionStatus = kAS42GrabChickenLeg; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -956,20 +962,20 @@ void Scene42::run() { case kHS42WalkArea1: case kHS42WalkArea2: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; } } - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { _vm->_mouseClickState._left = false; if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoActionStatus = kAS42ToyUfoRefresh; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); } else { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); } } @@ -980,11 +986,11 @@ void Scene42::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 30; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextBBQVendorSequenceId == -1) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextBBQVendorSequenceId == -1) { switch (_vm->getRandom(8)) { case 0: _nextBBQVendorSequenceId = 0x14C; @@ -1024,24 +1030,25 @@ void Scene42::run() { void Scene42::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS42LeaveScene: gameSys.setAnimation(0, 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _vm->_sceneDone = true; break; case kAS42TalkBBQVendor: gameSys.setAnimation(0, 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _nextBBQVendorSequenceId = 0x14B; break; case kAS42UseQuarterWithBBQVendor: case kAS42GrabChickenLeg: if (gameSys.getAnimationStatus(2) == 2) { int sequenceId; - if (_vm->_gnap->_actionStatus == kAS42UseQuarterWithBBQVendor) { + if (gnap._actionStatus == kAS42UseQuarterWithBBQVendor) { _vm->invRemove(kItemDiceQuarterHole); _vm->invAdd(kItemChickenBucket); _vm->setGrabCursorSprite(-1); @@ -1062,23 +1069,23 @@ void Scene42::updateAnimations() { _nextBBQVendorSequenceId = 0x146; } if (sequenceId == 0x7B7) { - gameSys.insertSequence(0x107B7, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, + gameSys.insertSequence(0x107B7, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, _vm->getSequenceTotalDuration(_nextBBQVendorSequenceId), - 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); - _vm->_gnap->_sequenceDatNum = 1; + 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); + gnap._sequenceDatNum = 1; } else { - gameSys.insertSequence(sequenceId, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, + gameSys.insertSequence(sequenceId, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; + gnap._sequenceDatNum = 0; } - _vm->_gnap->_sequenceId = sequenceId; - gameSys.setAnimation(sequenceId | (_vm->_gnap->_sequenceDatNum << 16), _vm->_gnap->_id, 0); - if (_vm->_gnap->_actionStatus == kAS42UseQuarterWithBBQVendor) - _vm->_gnap->_actionStatus = kAS42UseQuarterWithBBQVendorDone; + gnap._sequenceId = sequenceId; + gameSys.setAnimation(sequenceId | (gnap._sequenceDatNum << 16), gnap._id, 0); + if (gnap._actionStatus == kAS42UseQuarterWithBBQVendor) + gnap._actionStatus = kAS42UseQuarterWithBBQVendorDone; else - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; gameSys.insertSequence(_nextBBQVendorSequenceId, 1, _currBBQVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextBBQVendorSequenceId, 1, 2); _currBBQVendorSequenceId = _nextBBQVendorSequenceId; @@ -1094,11 +1101,11 @@ void Scene42::updateAnimations() { case kAS42UseQuarterWithBBQVendorDone: gameSys.setAnimation(0, 0, 0); _vm->setGrabCursorSprite(kItemChickenBucket); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; default: gameSys.setAnimation(0, 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -1200,6 +1207,7 @@ void Scene43::updateHotspots() { void Scene43::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->queueInsertDeviceIcon(); @@ -1227,30 +1235,30 @@ void Scene43::run() { } else { switch (_vm->_prevSceneNum) { case 42: - _vm->_gnap->initPos(-1, 8, kDirUpRight); + gnap.initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-1, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); break; case 44: - _vm->_gnap->initPos(11, 8, kDirUpRight); + gnap.initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); break; case 54: - _vm->_gnap->initPos(4, 7, kDirBottomLeft); + gnap.initPos(4, 7, kDirBottomLeft); _vm->_plat->initPos(11, 8, kDirUpLeft); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); break; default: - _vm->_gnap->initPos(5, 11, kDirUpRight); + gnap.initPos(5, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(5, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); break; } @@ -1319,23 +1327,23 @@ void Scene43::run() { break; case kHS43Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -1344,44 +1352,44 @@ void Scene43::run() { case kHS43ExitUfoParty: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS43ExitUfoParty], 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS43ExitUfoParty], 0, 0x107AE, 1); + gnap._actionStatus = 0; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS43ExitUfoParty], -1, 0x107C7, 1); _vm->_newSceneNum = 40; break; case kHS43ExitBBQ: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS43ExitBBQ].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS43ExitBBQ].x, gnap._pos.y), 0, 0x107AF, 1); + gnap._actionStatus = 0; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS43ExitBBQ], -1, 0x107CF, 1); _vm->_newSceneNum = 42; break; case kHS43ExitKissinBooth: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth].x, gnap._pos.y), 0, 0x107AB, 1); + gnap._actionStatus = 0; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth], -1, 0x107CD, 1); _vm->_newSceneNum = 44; break; case kHS43TwoHeadedGuy: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(6, 8, 7, 0); + gnap.playShowCurrItem(6, 8, 7, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(7, 0); + gnap.playScratchingHead(7, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(Common::Point(5, 8), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = 2; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(Common::Point(5, 8), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = 2; break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1390,20 +1398,20 @@ void Scene43::run() { case kHS43Key: case kHS43Ufo: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(3, 7, 2, 0); + gnap.playShowCurrItem(3, 7, 2, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(0, 0); + gnap.playScratchingHead(0, 0); break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(Common::Point(3, 7), 0, 67515, 1); - _vm->_gnap->_actionStatus = 1; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(Common::Point(3, 7), 0, 67515, 1); + gnap._actionStatus = 1; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1411,19 +1419,19 @@ void Scene43::run() { case kHS43WalkArea1: case kHS43WalkArea2: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; } } - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { _vm->_mouseClickState._left = false; if (_vm->isFlag(kGFGnapControlsToyUFO) && (_vm->_toyUfoActionStatus == 5 || _vm->_toyUfoActionStatus == -1)) { _vm->_toyUfoActionStatus = 5; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); } else { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); } } @@ -1434,11 +1442,11 @@ void Scene43::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + gnap.updateIdleSequence(); if (!_vm->_timers[4] && (!_vm->isFlag(kGFGnapControlsToyUFO) || !_vm->isFlag(kGFGroceryStoreHatTaken))) { _vm->_timers[4] = _vm->getRandom(100) + 100; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextTwoHeadedGuySequenceId == -1) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextTwoHeadedGuySequenceId == -1) { switch (_vm->getRandom(5)) { case 0: _nextTwoHeadedGuySequenceId = 0x13C; @@ -1480,9 +1488,10 @@ void Scene43::run() { void Scene43::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case 0: gameSys.setAnimation(0, 0, 0); _vm->_sceneDone = true; @@ -1492,23 +1501,23 @@ void Scene43::updateAnimations() { if (gameSys.getAnimationStatus(2) == 2) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - gameSys.insertSequence(0x13D, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x13D; - _vm->_gnap->_sequenceDatNum = 0; - gameSys.setAnimation(0x13D, _vm->_gnap->_id, 0); + gameSys.insertSequence(0x13D, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x13D; + gnap._sequenceDatNum = 0; + gameSys.setAnimation(0x13D, gnap._id, 0); _nextTwoHeadedGuySequenceId = 0x13B; gameSys.insertSequence(0x13B, 1, _currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextTwoHeadedGuySequenceId, 1, 2); _currTwoHeadedGuySequenceId = _nextTwoHeadedGuySequenceId; _nextTwoHeadedGuySequenceId = -1; _vm->_timers[4] = _vm->getRandom(100) + 100; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } break; default: gameSys.setAnimation(0, 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -1560,7 +1569,7 @@ void Scene43::updateAnimations() { gameSys.setAnimation(0x10874, _vm->_toyUfoId, 3); _vm->_toyUfoActionStatus = 8; _vm->setFlag(kGFJointTaken); - _vm->_gnap->_actionStatus = 3; + gnap._actionStatus = 3; break; case 8: _nextTwoHeadedGuySequenceId = 0x13A; @@ -1633,6 +1642,7 @@ void Scene44::updateHotspots() { void Scene44::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->queueInsertDeviceIcon(); @@ -1681,21 +1691,21 @@ void Scene44::run() { } else { switch (_vm->_prevSceneNum) { case 43: - _vm->_gnap->initPos(-1, 8, kDirUpRight); + gnap.initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-1, 7, kDirUpLeft); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); break; case 46: - _vm->_gnap->initPos(11, 8, kDirUpRight); + gnap.initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 8, kDirUpLeft); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(6, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(6, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(7, 8), -1, 0x107D2, 1); break; case 50: - _vm->_gnap->initPos(4, 8, kDirBottomRight); + gnap.initPos(4, 8, kDirBottomRight); if (_vm->_sceneSavegameLoaded) { _vm->_plat->initPos(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, kDirUnk4); } else if (!_vm->isFlag(kGFUnk13)) { @@ -1711,11 +1721,11 @@ void Scene44::run() { _vm->endSceneInit(); break; default: - _vm->_gnap->initPos(5, 11, kDirUpRight); + gnap.initPos(5, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(5, 8), -1, 0x107BA, 1); break; } } @@ -1767,23 +1777,23 @@ void Scene44::run() { break; case kHS44Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -1792,50 +1802,50 @@ void Scene44::run() { case kHS44ExitUfoParty: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS44ExitUfoParty], 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS44ExitUfoParty], 0, 0x107AE, 1); + gnap._actionStatus = 0; _vm->_newSceneNum = 40; break; case kHS44ExitUfo: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, gnap._pos.y), 0, 0x107AF, 1); + gnap._actionStatus = 0; _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_plat->_pos.y), -1, 0x107CF, 1); _vm->_newSceneNum = 43; break; case kHS44ExitShow: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS44ExitShow], 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS44ExitShow], 0, 0x107AB, 1); + gnap._actionStatus = 0; _vm->_newSceneNum = 46; break; case kHS44KissingLady: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->_actionStatus = 2; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS44KissingLady], 0, -1, 9); - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, _vm->_hotspotsWalkPos[kHS44KissingLady].x - 1, _vm->_hotspotsWalkPos[kHS44KissingLady].y); + gnap._actionStatus = 2; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS44KissingLady], 0, -1, 9); + gnap.playShowItem(_vm->_grabCursorSpriteIndex, _vm->_hotspotsWalkPos[kHS44KissingLady].x - 1, _vm->_hotspotsWalkPos[kHS44KissingLady].y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(4, 3); + gnap.playScratchingHead(4, 3); break; case GRAB_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS44KissingLady], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = 1; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS44KissingLady], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = 1; break; case PLAT_CURSOR: - _vm->_gnap->useDeviceOnPlatypus(); + gnap.useDeviceOnPlatypus(); _vm->_plat->walkTo(Common::Point(6, 7), 1, 0x107D2, 1); - if (_vm->_gnap->_pos == Common::Point(7, 7)) - _vm->_gnap->walkStep(); - _vm->_gnap->playIdle(5, 7); + if (gnap._pos == Common::Point(7, 7)) + gnap.walkStep(); + gnap.playIdle(5, 7); _vm->_plat->_actionStatus = 4; break; } @@ -1844,25 +1854,25 @@ void Scene44::run() { case kHS44Spring: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS44Spring].x, _vm->_hotspotsWalkPos[kHS44Spring].y, 8, 0); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS44Spring].x, _vm->_hotspotsWalkPos[kHS44Spring].y, 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(8, 7); + gnap.playScratchingHead(8, 7); break; case GRAB_CURSOR: - _vm->_gnap->playPullOutDevice(8, 0); - _vm->_gnap->playUseDevice(8, 0); + gnap.playPullOutDevice(8, 0); + gnap.playUseDevice(8, 0); _nextSpringGuySequenceId = 0xFB; _vm->invAdd(kItemSpring); _vm->setFlag(kGFSpringTaken); updateHotspots(); break; case TALK_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1870,22 +1880,22 @@ void Scene44::run() { case kHS44SpringGuy: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS44SpringGuy].x, _vm->_hotspotsWalkPos[kHS44SpringGuy].y, 8, 0); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS44SpringGuy].x, _vm->_hotspotsWalkPos[kHS44SpringGuy].y, 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFSpringTaken)) - _vm->_gnap->playMoan1(8, 7); + gnap.playMoan1(8, 7); else - _vm->_gnap->playScratchingHead(8, 7); + gnap.playScratchingHead(8, 7); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS44SpringGuy], -1, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS44SpringGuy], -1, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1893,20 +1903,20 @@ void Scene44::run() { case kHS44WalkArea1: case kHS44WalkArea2: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; } } - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { _vm->_mouseClickState._left = false; if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoActionStatus = 7; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); } else { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); } } @@ -1916,11 +1926,11 @@ void Scene44::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO) && _currKissingLadySequenceId != 0xF5) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 20; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextKissingLadySequenceId == -1) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextKissingLadySequenceId == -1) { switch (_vm->getRandom(20)) { case 0: _nextKissingLadySequenceId = 0xED; @@ -1947,7 +1957,7 @@ void Scene44::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(20) + 20; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextSpringGuySequenceId == -1) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextSpringGuySequenceId == -1) { if (_vm->getRandom(5) != 0) { if (!_vm->isFlag(kGFSpringTaken)) _nextSpringGuySequenceId = 0xF9; @@ -1976,10 +1986,11 @@ void Scene44::run() { void Scene44::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case 0: _vm->_sceneDone = true; break; @@ -1990,7 +2001,7 @@ void Scene44::updateAnimations() { _nextKissingLadySequenceId = 0xF2; break; } - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } if (gameSys.getAnimationStatus(1) == 2) { @@ -2114,6 +2125,7 @@ void Scene45::updateHotspots() { void Scene45::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (!_vm->isSoundPlaying(0x1094A)) _vm->playSound(0x1094A, true); @@ -2141,39 +2153,39 @@ void Scene45::run() { gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->endSceneInit(); } else if (_vm->isFlag(kGFUnk22)) { - _vm->_gnap->_sequenceId = 0x9E; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_id = 1; + gnap._sequenceId = 0x9E; + gnap._sequenceDatNum = 0; + gnap._id = 1; gameSys.setAnimation(0x9E, 1, 0); - _vm->_gnap->_actionStatus = 1; - gameSys.insertSequence(_vm->_gnap->_sequenceId, _vm->_gnap->_id, 0, 0, kSeqNone, 0, 0, 0); + gnap._actionStatus = 1; + gameSys.insertSequence(gnap._sequenceId, gnap._id, 0, 0, kSeqNone, 0, 0, 0); _vm->_plat->initPos(4, 8, kDirNone); _vm->endSceneInit(); } else if (_vm->_prevSceneNum == 46) { - _vm->_gnap->initPos(-1, 8, kDirUpRight); + gnap.initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-1, 9, kDirUpLeft); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(4, 8), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(2, 7), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 7), -1, 0x107B9, 1); } else if (_vm->_prevSceneNum == 41) { - _vm->_gnap->initPos(11, 8, kDirUpRight); + gnap.initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(4, 8), -1, 0x107D2, 1); - _vm->_gnap->walkTo(Common::Point(10, 9), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(10, 9), -1, 0x107BA, 1); } else { - _vm->_gnap->initPos(2, 11, kDirUpRight); + gnap.initPos(2, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(4, 8), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(2, 7), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 7), -1, 0x107B9, 1); } if (!_vm->isFlag(kGFUnk21) && !_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->setFlag(kGFUnk21); _vm->setGrabCursorSprite(-1); - gameSys.setAnimation(0x9D, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x9D, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x9D, gnap._id, 0); + gameSys.insertSequence(0x9D, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); while (gameSys.getAnimationStatus(0) != 2) { _vm->gameUpdateTick(); if (gameSys.getAnimationStatus(2) == 2) { @@ -2190,22 +2202,22 @@ void Scene45::run() { gameSys.setAnimation(0x99, 1, 4); } } - _vm->_gnap->_sequenceId = 0x9D; - _vm->_gnap->_sequenceDatNum = 0; + gnap._sequenceId = 0x9D; + gnap._sequenceDatNum = 0; _vm->hideCursor(); _vm->addFullScreenSprite(0x8A, 255); gameSys.setAnimation(0xA0, 256, 0); gameSys.insertSequence(0xA0, 256, 0, 0, kSeqNone, 0, 0, 0); while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); - gameSys.setAnimation(0x107BD, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x107BD, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); + gameSys.setAnimation(0x107BD, gnap._id, 0); + gameSys.insertSequence(0x107BD, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, + kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); _vm->removeFullScreenSprite(); _vm->showCursor(); - _vm->_gnap->_sequenceId = 0x7BD; - _vm->_gnap->_sequenceDatNum = 1; + gnap._sequenceId = 0x7BD; + gnap._sequenceDatNum = 1; } _vm->_plat->playSequence(0x9A); @@ -2256,25 +2268,25 @@ void Scene45::run() { break; case kHS45Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); _vm->_plat->playSequence(0x9A); gameSys.setAnimation(_vm->_plat->_sequenceId, _vm->_plat->_id, 1); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -2282,29 +2294,29 @@ void Scene45::run() { break; case kHS45ExitUfoParty: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS45ExitUfoParty].y), 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(Common::Point(gnap._pos.x, _vm->_hotspotsWalkPos[kHS45ExitUfoParty].y), 0, 0x107AE, 1); + gnap._actionStatus = 0; _vm->_newSceneNum = 40; } break; case kHS45ExitShoe: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, gnap._pos.y), 0, 0x107AF, 1); + gnap._actionStatus = 0; _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_plat->_pos.y), -1, 0x107CF, 1); _vm->_newSceneNum = 46; } break; case kHS45ExitRight: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitRight].x, gnap._pos.y), 0, 0x107AB, 1); + gnap._actionStatus = 0; _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_plat->_pos.y), -1, 0x107CD, 1); _vm->_newSceneNum = 41; } @@ -2318,23 +2330,23 @@ void Scene45::run() { break; case kHS45DiscoBall: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemSpring) { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS45DiscoBall], 0, 0x9F, 5); - _vm->_gnap->_actionStatus = 1; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS45DiscoBall], 0, 0x9F, 5); + gnap._actionStatus = 1; _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemSpring); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 5, 0); + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 5, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(5, 0); + gnap.playScratchingHead(5, 0); break; case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2342,27 +2354,27 @@ void Scene45::run() { break; case kHS45WalkArea1: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; } } - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { _vm->_mouseClickState._left = false; if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoActionStatus = 3; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 5); } else { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); } } updateAnimations(); _vm->toyUfoCheckTimer(); - if (!_vm->_isLeavingScene && _vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->_gnap->updateIdleSequence(); + if (!_vm->_isLeavingScene && gnap._actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + gnap.updateIdleSequence(); _vm->checkGameKeys(); @@ -2380,10 +2392,11 @@ void Scene45::run() { void Scene45::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case 0: _vm->_sceneDone = true; break; @@ -2391,13 +2404,13 @@ void Scene45::updateAnimations() { _vm->_sceneWaiting = true; _vm->setFlag(kGFUnk22); updateHotspots(); - gameSys.insertSequence(0x9E, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x9E; - _vm->_gnap->_sequenceDatNum = 0; - gameSys.setAnimation(0x9E, _vm->_gnap->_id, 0); + gameSys.insertSequence(0x9E, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x9E; + gnap._sequenceDatNum = 0; + gameSys.setAnimation(0x9E, gnap._id, 0); break; default: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -2487,6 +2500,7 @@ void Scene46::updateHotspots() { void Scene46::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->queueInsertDeviceIcon(); gameSys.insertSequence(0x4D, 0, 0, 0, kSeqLoop, 0, 0, 0); @@ -2514,23 +2528,23 @@ void Scene46::run() { gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->endSceneInit(); } else if (_vm->_prevSceneNum == 44) { - _vm->_gnap->initPos(-1, 8, kDirUpRight); + gnap.initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-1, 8, kDirUpLeft); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); } else if (_vm->_prevSceneNum == 45) { - _vm->_gnap->initPos(11, 8, kDirUpRight); + gnap.initPos(11, 8, kDirUpRight); _vm->_plat->initPos(12, 8, kDirUpLeft); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); } else { - _vm->_gnap->initPos(5, 11, kDirUpRight); + gnap.initPos(5, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(5, 8), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(6, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(6, 8), -1, 0x107BA, 1); } _vm->_timers[4] = _vm->getRandom(50) + 80; @@ -2581,23 +2595,23 @@ void Scene46::run() { break; case kHS46Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -2606,20 +2620,20 @@ void Scene46::run() { case kHS46SackGuy: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS46SackGuy].x, _vm->_hotspotsWalkPos[kHS46SackGuy].y, 2, 0); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS46SackGuy].x, _vm->_hotspotsWalkPos[kHS46SackGuy].y, 2, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_hotspotsWalkPos[kHS46SackGuy].x + 1, 0); + gnap.playMoan1(_vm->_hotspotsWalkPos[kHS46SackGuy].x + 1, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS46SackGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = 2; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS46SackGuy], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = 2; break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2627,20 +2641,20 @@ void Scene46::run() { case kHS46ItchyGuy: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x, _vm->_hotspotsWalkPos[kHS46ItchyGuy].y, 7, 0); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x, _vm->_hotspotsWalkPos[kHS46ItchyGuy].y, 7, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x - 1, 0); + gnap.playMoan1(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x - 1, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS46ItchyGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = 1; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS46ItchyGuy], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = 1; break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2648,41 +2662,41 @@ void Scene46::run() { case kHS46ExitUfoParty: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS46ExitUfoParty].y), 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(Common::Point(gnap._pos.x, _vm->_hotspotsWalkPos[kHS46ExitUfoParty].y), 0, 0x107AE, 1); + gnap._actionStatus = 0; _vm->_newSceneNum = 40; break; case kHS46ExitKissinBooth: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, gnap._pos.y), 0, 0x107AF, 1); + gnap._actionStatus = 0; _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_plat->_pos.y), -1, 0x107CF, 1); _vm->_newSceneNum = 44; break; case kHS46ExitDisco: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, gnap._pos.y), 0, 0x107AB, 1); + gnap._actionStatus = 0; _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_plat->_pos.y), -1, 0x107CD, 1); _vm->_newSceneNum = 45; break; case kHS46WalkArea1: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; } } - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { _vm->_mouseClickState._left = false; if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoActionStatus = 4; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); } else { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); } } @@ -2692,11 +2706,11 @@ void Scene46::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(50) + 80; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextItchyGuySequenceId == -1) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextItchyGuySequenceId == -1) { if (_vm->getRandom(2) != 0) _nextItchyGuySequenceId = 0x49; else @@ -2705,7 +2719,7 @@ void Scene46::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(50) + 80; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextSackGuySequenceId == -1) + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextSackGuySequenceId == -1) _nextSackGuySequenceId = 0x4C; } } @@ -2724,10 +2738,11 @@ void Scene46::run() { void Scene46::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case 0: _vm->_sceneDone = true; break; @@ -2738,7 +2753,7 @@ void Scene46::updateAnimations() { _nextSackGuySequenceId = 0x4A; break; } - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } if (gameSys.getAnimationStatus(3) == 2 && _nextSackGuySequenceId != -1) { diff --git a/engines/gnap/scenes/group5.cpp b/engines/gnap/scenes/group5.cpp index 8cf5087ff6..3f21752e2a 100644 --- a/engines/gnap/scenes/group5.cpp +++ b/engines/gnap/scenes/group5.cpp @@ -76,6 +76,8 @@ int Scene53::pressPhoneNumberButton(int phoneNumber, int buttonNum) { }; GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; + if (_isGnapPhoning) { gameSys.setAnimation(kGnapHandSequenceIds[buttonNum], 40, 6); gameSys.insertSequence(kGnapHandSequenceIds[buttonNum], 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); @@ -86,13 +88,13 @@ int Scene53::pressPhoneNumberButton(int phoneNumber, int buttonNum) { _currHandSequenceId = kPlatypusHandSequenceIds[buttonNum]; } - _vm->_gnap->_actionStatus = 6; + gnap._actionStatus = 6; while (gameSys.getAnimationStatus(6) != 2) { // checkGameAppStatus(); _vm->updateMouseCursor(); _vm->gameUpdateTick(); } - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; if (buttonNum < 11) phoneNumber = buttonNum % 10 + 10 * phoneNumber; @@ -121,8 +123,9 @@ void Scene53::runRandomCall() { }; GameSys& gameSys = *_vm->_gameSys; - ++_callsMadeCtr; + PlayerGnap& gnap = *_vm->_gnap; + ++_callsMadeCtr; if (_callsMadeCtr <= 10) { int index; @@ -137,30 +140,31 @@ void Scene53::runRandomCall() { _callsMadeCtr = 0; } - _vm->_gnap->_actionStatus = 1; + gnap._actionStatus = 1; while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); } - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } void Scene53::runChitChatLine() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; bool flag = false; int sequenceId = -1; gameSys.setAnimation(0x6E, 1, 6); gameSys.insertSequence(0x6E, 1, 0, 0, kSeqNone, 16, 0, 0); - _vm->_gnap->_actionStatus = 1; + gnap._actionStatus = 1; while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); } - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; if (_vm->isFlag(kGFSpringTaken)) { gameSys.insertSequence(0x45, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); @@ -198,7 +202,7 @@ void Scene53::runChitChatLine() { flag = 1; _vm->_isLeavingScene = true; _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = 0; + gnap._actionStatus = 0; _vm->_newSceneNum = 17; break; case 5: @@ -217,31 +221,31 @@ void Scene53::runChitChatLine() { if (flag && sequenceId != -1) { _vm->stopSound(0xA0); pressPhoneNumberButton(0, _vm->_sceneClickedHotspot - 1); - _vm->_gnap->_actionStatus = 1; + gnap._actionStatus = 1; gameSys.setAnimation(sequenceId, 1, 6); gameSys.insertSequence(sequenceId, 1, 0, 0, kSeqNone, 16, 0, 0); - _vm->_gnap->_actionStatus = 1; + gnap._actionStatus = 1; while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); } - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; gameSys.setAnimation(0x72, 1, 6); gameSys.insertSequence(0x72, 1, 0, 0, kSeqNone, 16, 0, 0); - _vm->_gnap->_actionStatus = 1; + gnap._actionStatus = 1; while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); } - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } } updateHotspots(); - _vm->_gnap->_actionStatus = 1; + gnap._actionStatus = 1; if (_vm->isFlag(kGFSpringTaken)) { gameSys.setAnimation(0x73, 40, 6); @@ -252,12 +256,14 @@ void Scene53::runChitChatLine() { _vm->gameUpdateTick(); } _currHandSequenceId = 0x73; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } } void Scene53::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; + int phoneNumber = 0; int phoneNumberLen = 0; @@ -287,7 +293,7 @@ void Scene53::run() { switch (_vm->_sceneClickedHotspot) { case 1: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } @@ -307,7 +313,7 @@ void Scene53::run() { phoneNumber = pressPhoneNumberButton(phoneNumber, _vm->_sceneClickedHotspot - 1); debugC(kDebugBasic, "phoneNumber: %d", phoneNumber); if (phoneNumberLen == 7) { - _vm->_gnap->_actionStatus = 1; + gnap._actionStatus = 1; if (_vm->isFlag(kGFSpringTaken)) { gameSys.setAnimation(0x73, 40, 6); gameSys.insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); @@ -317,7 +323,7 @@ void Scene53::run() { _vm->gameUpdateTick(); } _currHandSequenceId = 0x73; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } if (phoneNumber == 7284141) { runChitChatLine(); @@ -348,8 +354,8 @@ void Scene53::run() { pressPhoneNumberButton(0, _vm->_sceneClickedHotspot - 1); break; case 14: - if (_vm->_gnap->_actionStatus < 0) { - _vm->_gnap->_actionStatus = 1; + if (gnap._actionStatus < 0) { + gnap._actionStatus = 1; if (_vm->isFlag(kGFSpringTaken)) { gameSys.setAnimation(0x73, 40, 6); gameSys.insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); @@ -359,11 +365,11 @@ void Scene53::run() { _vm->gameUpdateTick(); } _currHandSequenceId = 0x73; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } _vm->_isLeavingScene = true; _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = 0; + gnap._actionStatus = 0; _vm->_newSceneNum = 17; } break; |