aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/gnap/gnap.cpp6
-rw-r--r--engines/gnap/gnap.h9
-rw-r--r--engines/gnap/scenes/scene00.h1
-rw-r--r--engines/gnap/scenes/scene01.h1
-rw-r--r--engines/gnap/scenes/scene02.h1
-rw-r--r--engines/gnap/scenes/scene03.h1
-rw-r--r--engines/gnap/scenes/scene04.h1
-rw-r--r--engines/gnap/scenes/scene05.h1
-rw-r--r--engines/gnap/scenes/scene06.h3
-rw-r--r--engines/gnap/scenes/scene07.h5
-rw-r--r--engines/gnap/scenes/scene08.cpp461
-rw-r--r--engines/gnap/scenes/scene08.h52
-rw-r--r--engines/gnap/scenes/scenecore.cpp9
-rw-r--r--engines/gnap/scenes/scenecore.h1
14 files changed, 302 insertions, 250 deletions
diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp
index ddaa9f6a8e..d0bbd8db5b 100644
--- a/engines/gnap/gnap.cpp
+++ b/engines/gnap/gnap.cpp
@@ -1797,13 +1797,9 @@ void GnapEngine::gnapUseDeviceOnPlatypuss() {
void GnapEngine::doCallback(int callback) {
switch (callback) {
case 8:
- scene08_updateAnimationsCb();
- break;
case 10:
- scene10_updateAnimationsCb();
- break;
case 20:
- scene20_updateAnimationsCb();
+ _scene->updateAnimationsCb();
break;
}
}
diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h
index 651d24e227..fbc97fe0ee 100644
--- a/engines/gnap/gnap.h
+++ b/engines/gnap/gnap.h
@@ -603,15 +603,6 @@ public:
void sceneXX_playRandomSound(int timerIndex);
void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3);
- // Scene 8
- int _s08_nextDogSequenceId, _s08_currDogSequenceId;
- int _s08_nextManSequenceId, _s08_currManSequenceId;
- int scene08_init();
- void scene08_updateHotspots();
- void scene08_updateAnimationsCb();
- void scene08_run();
- void scene08_updateAnimations();
-
// Scene 9
int scene09_init();
void scene09_updateHotspots();
diff --git a/engines/gnap/scenes/scene00.h b/engines/gnap/scenes/scene00.h
index 7edcab4207..d71722bcbc 100644
--- a/engines/gnap/scenes/scene00.h
+++ b/engines/gnap/scenes/scene00.h
@@ -39,6 +39,7 @@ public:
virtual void updateHotspots() {}
virtual void run();
virtual void updateAnimations() {}
+ virtual void updateAnimationsCb() {}
};
} // End of namespace Gnap
diff --git a/engines/gnap/scenes/scene01.h b/engines/gnap/scenes/scene01.h
index e7d3a335b2..c6de546954 100644
--- a/engines/gnap/scenes/scene01.h
+++ b/engines/gnap/scenes/scene01.h
@@ -39,6 +39,7 @@ public:
virtual void updateHotspots();
virtual void run();
virtual void updateAnimations();
+ virtual void updateAnimationsCb() {}
private:
int _s01_pigsIdCtr, _s01_smokeIdCtr;
diff --git a/engines/gnap/scenes/scene02.h b/engines/gnap/scenes/scene02.h
index 70f0591bcc..d9c341ce45 100644
--- a/engines/gnap/scenes/scene02.h
+++ b/engines/gnap/scenes/scene02.h
@@ -39,6 +39,7 @@ public:
virtual void updateHotspots();
virtual void run();
virtual void updateAnimations();
+ virtual void updateAnimationsCb() {}
private:
int _s02_truckGrillCtr;
diff --git a/engines/gnap/scenes/scene03.h b/engines/gnap/scenes/scene03.h
index 2ccb1cd542..e8a7ccf716 100644
--- a/engines/gnap/scenes/scene03.h
+++ b/engines/gnap/scenes/scene03.h
@@ -39,6 +39,7 @@ public:
virtual void updateHotspots();
virtual void run();
virtual void updateAnimations();
+ virtual void updateAnimationsCb() {}
private:
bool _s03_platypusHypnotized;
diff --git a/engines/gnap/scenes/scene04.h b/engines/gnap/scenes/scene04.h
index 11a7eeb46e..519799b48c 100644
--- a/engines/gnap/scenes/scene04.h
+++ b/engines/gnap/scenes/scene04.h
@@ -39,6 +39,7 @@ public:
virtual void updateHotspots();
virtual void run();
virtual void updateAnimations();
+ virtual void updateAnimationsCb() {}
private:
bool _s04_triedWindow;
diff --git a/engines/gnap/scenes/scene05.h b/engines/gnap/scenes/scene05.h
index f79adc0e41..083abe5f2d 100644
--- a/engines/gnap/scenes/scene05.h
+++ b/engines/gnap/scenes/scene05.h
@@ -39,6 +39,7 @@ public:
virtual void updateHotspots();
virtual void run();
virtual void updateAnimations();
+ virtual void updateAnimationsCb() {}
private:
int _s05_nextChickenSequenceId;
diff --git a/engines/gnap/scenes/scene06.h b/engines/gnap/scenes/scene06.h
index 43f7f8c678..1f15be54f6 100644
--- a/engines/gnap/scenes/scene06.h
+++ b/engines/gnap/scenes/scene06.h
@@ -39,6 +39,7 @@ public:
virtual void updateHotspots();
virtual void run();
virtual void updateAnimations();
+ virtual void updateAnimationsCb() {}
private:
bool _s06_horseTurnedBack;
@@ -49,4 +50,4 @@ private:
} // End of namespace Gnap
-#endif // GNAP_SCENE05_H
+#endif // GNAP_SCENE06_H
diff --git a/engines/gnap/scenes/scene07.h b/engines/gnap/scenes/scene07.h
index 08fdab2f3f..1afc1f8f12 100644
--- a/engines/gnap/scenes/scene07.h
+++ b/engines/gnap/scenes/scene07.h
@@ -39,10 +39,9 @@ public:
virtual void updateHotspots();
virtual void run();
virtual void updateAnimations();
-
-private:
+ virtual void updateAnimationsCb() {}
};
} // End of namespace Gnap
-#endif // GNAP_SCENE05_H
+#endif // GNAP_SCENE07_H
diff --git a/engines/gnap/scenes/scene08.cpp b/engines/gnap/scenes/scene08.cpp
index ca777aa11e..d13f763a19 100644
--- a/engines/gnap/scenes/scene08.cpp
+++ b/engines/gnap/scenes/scene08.cpp
@@ -23,6 +23,7 @@
#include "gnap/gnap.h"
#include "gnap/gamesys.h"
#include "gnap/resource.h"
+#include "gnap/scenes/scene08.h"
namespace Gnap {
@@ -51,123 +52,127 @@ enum {
kASPlatWithDog = 7
};
-int GnapEngine::scene08_init() {
+Scene08::Scene08(GnapEngine *vm) : Scene(vm) {
+ _s08_nextDogSequenceId = -1;
+ _s08_currDogSequenceId = -1;
+ _s08_nextManSequenceId = -1;
+ _s08_currManSequenceId = -1;
+}
+
+int Scene08::init() {
return 0x150;
}
-void GnapEngine::scene08_updateHotspots() {
- setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
- setHotspot(kHSExitBackdoor, 0, 280, 10, 400, SF_EXIT_L_CURSOR | SF_WALKABLE);
- setHotspot(kHSExitCrash, 200, 590, 400, 599, SF_EXIT_D_CURSOR | SF_WALKABLE);
- setHotspot(kHSMan, 510, 150, 610, 380, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
- setHotspot(kHSDoor, 350, 170, 500, 410, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
- setHotspot(kHSMeat, 405, 450, 480, 485, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
- setHotspot(kHSBone, 200, 405, 270, 465, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
- setHotspot(kHSToy, 540, 430, 615, 465, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
- setHotspot(kHSWalkArea1, 290, 340, -1, -1);
- setHotspot(kHSWalkArea2, 0, 0, 799, 420);
- setDeviceHotspot(kHSDevice, -1, -1, -1, -1);
- if (isFlag(kGFBarnPadlockOpen))
- _hotspots[kHSMeat]._flags = SF_WALKABLE | SF_DISABLED;
- if (isFlag(kGFTruckFilledWithGas))
- _hotspots[kHSBone]._flags = SF_WALKABLE | SF_DISABLED;
- if (isFlag(kGFTruckKeysUsed))
- _hotspots[kHSToy]._flags = SF_WALKABLE | SF_DISABLED;
- _hotspotsCount = 11;
+void Scene08::updateHotspots() {
+ _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
+ _vm->setHotspot(kHSExitBackdoor, 0, 280, 10, 400, SF_EXIT_L_CURSOR | SF_WALKABLE);
+ _vm->setHotspot(kHSExitCrash, 200, 590, 400, 599, SF_EXIT_D_CURSOR | SF_WALKABLE);
+ _vm->setHotspot(kHSMan, 510, 150, 610, 380, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
+ _vm->setHotspot(kHSDoor, 350, 170, 500, 410, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
+ _vm->setHotspot(kHSMeat, 405, 450, 480, 485, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
+ _vm->setHotspot(kHSBone, 200, 405, 270, 465, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
+ _vm->setHotspot(kHSToy, 540, 430, 615, 465, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR);
+ _vm->setHotspot(kHSWalkArea1, 290, 340, -1, -1);
+ _vm->setHotspot(kHSWalkArea2, 0, 0, 799, 420);
+ _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1);
+ if (_vm->isFlag(kGFBarnPadlockOpen))
+ _vm->_hotspots[kHSMeat]._flags = SF_WALKABLE | SF_DISABLED;
+ if (_vm->isFlag(kGFTruckFilledWithGas))
+ _vm->_hotspots[kHSBone]._flags = SF_WALKABLE | SF_DISABLED;
+ if (_vm->isFlag(kGFTruckKeysUsed))
+ _vm->_hotspots[kHSToy]._flags = SF_WALKABLE | SF_DISABLED;
+ _vm->_hotspotsCount = 11;
}
-void GnapEngine::scene08_updateAnimationsCb() {
- if (_gameSys->getAnimationStatus(3) == 2) {
- _gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3);
- _gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0);
+void Scene08::updateAnimationsCb() {
+ if (_vm->_gameSys->getAnimationStatus(3) == 2) {
+ _vm->_gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3);
+ _vm->_gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0);
_s08_currDogSequenceId = _s08_nextDogSequenceId;
if ( _s08_nextDogSequenceId != 0x135 )
_s08_nextDogSequenceId = 0x134;
}
}
-void GnapEngine::scene08_run() {
-
- queueInsertDeviceIcon();
+void Scene08::run() {
+ _vm->queueInsertDeviceIcon();
- _gameSys->insertSequence(0x14F, 1, 0, 0, kSeqLoop, 0, 0, 0);
- _gameSys->insertSequence(0x14E, 256, 0, 0, kSeqNone, 0, 0, 0);
+ _vm->_gameSys->insertSequence(0x14F, 1, 0, 0, kSeqLoop, 0, 0, 0);
+ _vm->_gameSys->insertSequence(0x14E, 256, 0, 0, kSeqNone, 0, 0, 0);
_s08_currDogSequenceId = 0x135;
_s08_nextDogSequenceId = 0x135;
- _gameSys->setAnimation(0x135, 100, 3);
- _gameSys->insertSequence(_s08_currDogSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0);
+ _vm->_gameSys->setAnimation(0x135, 100, 3);
+ _vm->_gameSys->insertSequence(_s08_currDogSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0);
_s08_currManSequenceId = 0x140;
_s08_nextManSequenceId = -1;
- _gameSys->setAnimation(0x140, 100, 2);
- _gameSys->insertSequence(_s08_currManSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0);
-
- _timers[4] = getRandom(50) + 75;
+ _vm->_gameSys->setAnimation(0x140, 100, 2);
+ _vm->_gameSys->insertSequence(_s08_currManSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0);
- if (!isFlag(kGFBarnPadlockOpen))
- _gameSys->insertSequence(0x144, 1, 0, 0, kSeqNone, 0, 0, 0);
+ _vm->_timers[4] = _vm->getRandom(50) + 75;
- if (!isFlag(kGFTruckFilledWithGas))
- _gameSys->insertSequence(0x145, 1, 0, 0, kSeqNone, 0, 0, 0);
+ if (!_vm->isFlag(kGFBarnPadlockOpen))
+ _vm->_gameSys->insertSequence(0x144, 1, 0, 0, kSeqNone, 0, 0, 0);
- if (!isFlag(kGFTruckKeysUsed))
- _gameSys->insertSequence(0x146, 1, 0, 0, kSeqNone, 0, 0, 0);
+ if (!_vm->isFlag(kGFTruckFilledWithGas))
+ _vm->_gameSys->insertSequence(0x145, 1, 0, 0, kSeqNone, 0, 0, 0);
- initGnapPos(-1, 8, kDirBottomRight);
- initPlatypusPos(-1, 7, kDirNone);
+ if (!_vm->isFlag(kGFTruckKeysUsed))
+ _vm->_gameSys->insertSequence(0x146, 1, 0, 0, kSeqNone, 0, 0, 0);
- endSceneInit();
+ _vm->initGnapPos(-1, 8, kDirBottomRight);
+ _vm->initPlatypusPos(-1, 7, kDirNone);
- gnapWalkTo(1, 8, -1, 0x107B9, 1);
- platypusWalkTo(1, 7, -1, 0x107C2, 1);
+ _vm->endSceneInit();
- _timers[5] = getRandom(40) + 50;
+ _vm->gnapWalkTo(1, 8, -1, 0x107B9, 1);
+ _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1);
- while (!_sceneDone) {
+ _vm->_timers[5] = _vm->getRandom(40) + 50;
- if (!isSoundPlaying(0x10919))
- playSound(0x10919, true);
+ while (!_vm->_sceneDone) {
+ if (!_vm->isSoundPlaying(0x10919))
+ _vm->playSound(0x10919, true);
- testWalk(0, 0, -1, -1, -1, -1);
+ _vm->testWalk(0, 0, -1, -1, -1, -1);
- updateMouseCursor();
- updateCursorByHotspot();
+ _vm->updateMouseCursor();
+ _vm->updateCursorByHotspot();
- _sceneClickedHotspot = getClickedHotspotId();
- updateGrabCursorSprite(0, 0);
+ _vm->_sceneClickedHotspot = _vm->getClickedHotspotId();
+ _vm->updateGrabCursorSprite(0, 0);
- switch (_sceneClickedHotspot) {
-
+ switch (_vm->_sceneClickedHotspot) {
case kHSDevice:
- if (_gnapActionStatus < 0) {
- runMenu();
- scene08_updateHotspots();
- _timers[4] = getRandom(50) + 75;
- _timers[5] = getRandom(40) + 50;
+ if (_vm->_gnapActionStatus < 0) {
+ _vm->runMenu();
+ updateHotspots();
+ _vm->_timers[4] = _vm->getRandom(50) + 75;
+ _vm->_timers[5] = _vm->getRandom(40) + 50;
}
break;
case kHSPlatypus:
- if (_grabCursorSpriteIndex >= 0) {
- playGnapImpossible(0, 0);
+ if (_vm->_grabCursorSpriteIndex >= 0) {
+ _vm->playGnapImpossible(0, 0);
} else {
- switch (_verbCursor) {
+ switch (_vm->_verbCursor) {
case LOOK_CURSOR:
- if (isFlag(kGFSceneFlag1))
- playGnapMoan1(_platX, _platY);
+ if (_vm->isFlag(kGFSceneFlag1))
+ _vm->playGnapMoan1(_vm->_platX, _vm->_platY);
else
- playGnapScratchingHead(_platX, _platY);
+ _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY);
break;
case GRAB_CURSOR:
- gnapActionIdle(0x14D);
- gnapKissPlatypus(8);
+ _vm->gnapActionIdle(0x14D);
+ _vm->gnapKissPlatypus(8);
break;
case TALK_CURSOR:
- playGnapBrainPulsating(_platX, _platY);
- playPlatypusSequence(getPlatypusSequenceId());
+ _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY);
+ _vm->playPlatypusSequence(_vm->getPlatypusSequenceId());
break;
case PLAT_CURSOR:
break;
@@ -176,164 +181,164 @@ void GnapEngine::scene08_run() {
break;
case kHSExitBackdoor:
- _isLeavingScene = true;
- gnapActionIdle(0x14D);
- gnapWalkTo(0, 6, 0, 0x107AF, 1);
- _gnapActionStatus = kASLeaveScene;
- platypusWalkTo(0, 7, 1, 0x107CF, 1);
- _newSceneNum = 9;
+ _vm->_isLeavingScene = true;
+ _vm->gnapActionIdle(0x14D);
+ _vm->gnapWalkTo(0, 6, 0, 0x107AF, 1);
+ _vm->_gnapActionStatus = kASLeaveScene;
+ _vm->platypusWalkTo(0, 7, 1, 0x107CF, 1);
+ _vm->_newSceneNum = 9;
break;
case kHSExitCrash:
- _isLeavingScene = true;
- gnapActionIdle(0x14D);
- gnapWalkTo(3, 9, 0, 0x107AE, 1);
- _gnapActionStatus = kASLeaveScene;
- platypusWalkTo(4, 9, 1, 0x107C1, 1);
- _newSceneNum = 7;
+ _vm->_isLeavingScene = true;
+ _vm->gnapActionIdle(0x14D);
+ _vm->gnapWalkTo(3, 9, 0, 0x107AE, 1);
+ _vm->_gnapActionStatus = kASLeaveScene;
+ _vm->platypusWalkTo(4, 9, 1, 0x107C1, 1);
+ _vm->_newSceneNum = 7;
break;
case kHSMan:
- if (_grabCursorSpriteIndex >= 0) {
- playGnapShowCurrItem(6, 6, 7, 0);
+ if (_vm->_grabCursorSpriteIndex >= 0) {
+ _vm->playGnapShowCurrItem(6, 6, 7, 0);
} else {
- switch (_verbCursor) {
+ switch (_vm->_verbCursor) {
case LOOK_CURSOR:
- gnapActionIdle(0x14D);
- gnapWalkTo(6, 6, 0, 0x107BB, 1);
- _gnapActionStatus = kASLookMan;
- _gnapIdleFacing = kDirUpRight;
+ _vm->gnapActionIdle(0x14D);
+ _vm->gnapWalkTo(6, 6, 0, 0x107BB, 1);
+ _vm->_gnapActionStatus = kASLookMan;
+ _vm->_gnapIdleFacing = kDirUpRight;
break;
case GRAB_CURSOR:
- playGnapImpossible(0, 0);
+ _vm->playGnapImpossible(0, 0);
break;
case TALK_CURSOR:
- _gnapIdleFacing = kDirUpLeft;
- gnapActionIdle(0x14D);
- gnapWalkTo(8, 6, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1);
- _gnapActionStatus = kASTalkMan;
+ _vm->_gnapIdleFacing = kDirUpLeft;
+ _vm->gnapActionIdle(0x14D);
+ _vm->gnapWalkTo(8, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1);
+ _vm->_gnapActionStatus = kASTalkMan;
break;
case PLAT_CURSOR:
- gnapActionIdle(0x14D);
- gnapUseDeviceOnPlatypuss();
- platypusWalkTo(6, 6, 1, 0x107C2, 1);
- _platypusActionStatus = kASPlatWithMan;
- _platypusFacing = kDirNone;
- playGnapIdle(6, 6);
+ _vm->gnapActionIdle(0x14D);
+ _vm->gnapUseDeviceOnPlatypuss();
+ _vm->platypusWalkTo(6, 6, 1, 0x107C2, 1);
+ _vm->_platypusActionStatus = kASPlatWithMan;
+ _vm->_platypusFacing = kDirNone;
+ _vm->playGnapIdle(6, 6);
break;
}
}
break;
case kHSDoor:
- if (_grabCursorSpriteIndex >= 0) {
- playGnapShowCurrItem(4, 7, 5, 0);
- _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0);
- _gnapActionStatus = kASGrabDog;
+ if (_vm->_grabCursorSpriteIndex >= 0) {
+ _vm->playGnapShowCurrItem(4, 7, 5, 0);
+ _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0);
+ _vm->_gnapActionStatus = kASGrabDog;
} else {
- switch (_verbCursor) {
+ switch (_vm->_verbCursor) {
case LOOK_CURSOR:
- playGnapScratchingHead(6, 0);
- _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0);
- _gnapActionStatus = kASLookDog;
+ _vm->playGnapScratchingHead(6, 0);
+ _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0);
+ _vm->_gnapActionStatus = kASLookDog;
break;
case GRAB_CURSOR:
- gnapWalkTo(4, 7, 0, 0x107BB, 1);
- _gnapActionStatus = kASGrabDog;
- _gnapIdleFacing = kDirUpRight;
+ _vm->gnapWalkTo(4, 7, 0, 0x107BB, 1);
+ _vm->_gnapActionStatus = kASGrabDog;
+ _vm->_gnapIdleFacing = kDirUpRight;
break;
case TALK_CURSOR:
- _gnapIdleFacing = kDirUpRight;
- gnapActionIdle(0x14D);
- gnapWalkTo(4, 7, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1);
- _gnapActionStatus = kASTalkDog;
+ _vm->_gnapIdleFacing = kDirUpRight;
+ _vm->gnapActionIdle(0x14D);
+ _vm->gnapWalkTo(4, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1);
+ _vm->_gnapActionStatus = kASTalkDog;
break;
case PLAT_CURSOR:
- setFlag(kGFSceneFlag1);
- gnapActionIdle(0x14D);
- gnapUseDeviceOnPlatypuss();
- platypusWalkTo(3, 7, 1, 0x107C2, 1);
- _platypusActionStatus = kASPlatWithDog;
- _platypusFacing = kDirNone;
- playGnapIdle(3, 7);
+ _vm->setFlag(kGFSceneFlag1);
+ _vm->gnapActionIdle(0x14D);
+ _vm->gnapUseDeviceOnPlatypuss();
+ _vm->platypusWalkTo(3, 7, 1, 0x107C2, 1);
+ _vm->_platypusActionStatus = kASPlatWithDog;
+ _vm->_platypusFacing = kDirNone;
+ _vm->playGnapIdle(3, 7);
break;
}
}
break;
case kHSMeat:
- if (_grabCursorSpriteIndex >= 0) {
- playGnapShowCurrItem(6, 8, 5, 6);
+ if (_vm->_grabCursorSpriteIndex >= 0) {
+ _vm->playGnapShowCurrItem(6, 8, 5, 6);
} else {
- switch (_verbCursor) {
+ switch (_vm->_verbCursor) {
case LOOK_CURSOR:
- playGnapScratchingHead(6, 7);
+ _vm->playGnapScratchingHead(6, 7);
break;
case GRAB_CURSOR:
if (_s08_currDogSequenceId == 0x135) {
- playGnapScratchingHead(6, 7);
+ _vm->playGnapScratchingHead(6, 7);
} else {
- gnapActionIdle(0x14D);
- playGnapPullOutDevice(6, 7);
- playGnapUseDevice(0, 0);
+ _vm->gnapActionIdle(0x14D);
+ _vm->playGnapPullOutDevice(6, 7);
+ _vm->playGnapUseDevice(0, 0);
_s08_nextDogSequenceId = 0x149;
}
break;
case TALK_CURSOR:
case PLAT_CURSOR:
- playGnapImpossible(0, 0);
+ _vm->playGnapImpossible(0, 0);
break;
}
}
break;
case kHSBone:
- if (_grabCursorSpriteIndex >= 0) {
- playGnapShowCurrItem(2, 7, 3, 6);
+ if (_vm->_grabCursorSpriteIndex >= 0) {
+ _vm->playGnapShowCurrItem(2, 7, 3, 6);
} else {
- switch (_verbCursor) {
+ switch (_vm->_verbCursor) {
case LOOK_CURSOR:
- playGnapScratchingHead(3, 6);
+ _vm->playGnapScratchingHead(3, 6);
break;
case GRAB_CURSOR:
if (_s08_currDogSequenceId == 0x135) {
- playGnapScratchingHead(3, 6);
+ _vm->playGnapScratchingHead(3, 6);
} else {
- gnapActionIdle(0x14D);
- playGnapPullOutDevice(3, 6);
- playGnapUseDevice(0, 0);
+ _vm->gnapActionIdle(0x14D);
+ _vm->playGnapPullOutDevice(3, 6);
+ _vm->playGnapUseDevice(0, 0);
_s08_nextDogSequenceId = 0x14A;
}
break;
case TALK_CURSOR:
case PLAT_CURSOR:
- playGnapImpossible(0, 0);
+ _vm->playGnapImpossible(0, 0);
break;
}
}
break;
case kHSToy:
- if (_grabCursorSpriteIndex >= 0) {
- playGnapShowCurrItem(8, 7, 7, 6);
+ if (_vm->_grabCursorSpriteIndex >= 0) {
+ _vm->playGnapShowCurrItem(8, 7, 7, 6);
} else {
- switch (_verbCursor) {
+ switch (_vm->_verbCursor) {
case LOOK_CURSOR:
- playGnapScratchingHead(7, 6);
+ _vm->playGnapScratchingHead(7, 6);
break;
case GRAB_CURSOR:
if (_s08_currDogSequenceId == 0x135) {
- playGnapScratchingHead(7, 6);
+ _vm->playGnapScratchingHead(7, 6);
} else {
- gnapActionIdle(0x14D);
- playGnapPullOutDevice(7, 6);
- playGnapUseDevice(0, 0);
+ _vm->gnapActionIdle(0x14D);
+ _vm->playGnapPullOutDevice(7, 6);
+ _vm->playGnapUseDevice(0, 0);
_s08_nextDogSequenceId = 0x14B;
}
break;
case TALK_CURSOR:
case PLAT_CURSOR:
- playGnapImpossible(0, 0);
+ _vm->playGnapImpossible(0, 0);
break;
}
}
@@ -341,30 +346,29 @@ void GnapEngine::scene08_run() {
case kHSWalkArea1:
case kHSWalkArea2:
- gnapActionIdle(0x14D);
- gnapWalkTo(-1, 6, -1, -1, 1);
+ _vm->gnapActionIdle(0x14D);
+ _vm->gnapWalkTo(-1, 6, -1, -1, 1);
break;
default:
- if (_mouseClickState._left) {
- gnapActionIdle(0x14D);
- gnapWalkTo(-1, -1, -1, -1, 1);
- _mouseClickState._left = false;
+ if (_vm->_mouseClickState._left) {
+ _vm->gnapActionIdle(0x14D);
+ _vm->gnapWalkTo(-1, -1, -1, -1, 1);
+ _vm->_mouseClickState._left = false;
}
break;
-
}
- scene08_updateAnimations();
-
- if (!_isLeavingScene) {
- updatePlatypusIdleSequence();
- updateGnapIdleSequence();
- if (!_timers[4]) {
- _timers[4] = getRandom(50) + 125;
- if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s08_nextManSequenceId == -1 &&
+ updateAnimations();
+
+ if (!_vm->_isLeavingScene) {
+ _vm->updatePlatypusIdleSequence();
+ _vm->updateGnapIdleSequence();
+ if (!_vm->_timers[4]) {
+ _vm->_timers[4] = _vm->getRandom(50) + 125;
+ if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s08_nextManSequenceId == -1 &&
(_s08_currDogSequenceId == 0x134 || _s08_currDogSequenceId == 0x135)) {
- int _gnapRandomValue = getRandom(4);
+ int _gnapRandomValue = _vm->getRandom(4);
switch (_gnapRandomValue) {
case 0:
_s08_nextManSequenceId = 0x138;
@@ -381,141 +385,140 @@ void GnapEngine::scene08_run() {
}
}
}
- sceneXX_playRandomSound(5);
+ _vm->sceneXX_playRandomSound(5);
}
- checkGameKeys();
+ _vm->checkGameKeys();
- if (isKeyStatus1(8)) {
- clearKeyStatus1(8);
- runMenu();
- scene08_updateHotspots();
- _timers[4] = getRandom(50) + 75;
- _timers[5] = getRandom(40) + 50;
+ if (_vm->isKeyStatus1(8)) {
+ _vm->clearKeyStatus1(8);
+ _vm->runMenu();
+ updateHotspots();
+ _vm->_timers[4] = _vm->getRandom(50) + 75;
+ _vm->_timers[5] = _vm->getRandom(40) + 50;
}
- gameUpdateTick();
+ _vm->gameUpdateTick();
}
}
-void GnapEngine::scene08_updateAnimations() {
-
- if (_gameSys->getAnimationStatus(0) == 2) {
- _gameSys->setAnimation(0, 0, 0);
- switch (_gnapActionStatus) {
+void Scene08::updateAnimations() {
+ if (_vm->_gameSys->getAnimationStatus(0) == 2) {
+ _vm->_gameSys->setAnimation(0, 0, 0);
+ switch (_vm->_gnapActionStatus) {
case kASLeaveScene:
- _sceneDone = true;
- _gnapActionStatus = -1;
+ _vm->_sceneDone = true;
+ _vm->_gnapActionStatus = -1;
break;
case kASTalkMan:
_s08_nextManSequenceId = 0x13F;
- _gnapActionStatus = -1;
+ _vm->_gnapActionStatus = -1;
break;
case kASLookMan:
_s08_nextManSequenceId = 0x140;
- _gnapActionStatus = -1;
+ _vm->_gnapActionStatus = -1;
break;
case kASLookDog:
_s08_nextManSequenceId = 0x137;
- _gnapActionStatus = -1;
+ _vm->_gnapActionStatus = -1;
break;
case kASGrabDog:
if (_s08_currDogSequenceId == 0x135)
_s08_nextDogSequenceId = 0x133;
else
_s08_nextDogSequenceId = 0x13C;
- _gnapActionStatus = -1;
+ _vm->_gnapActionStatus = -1;
break;
case kASTalkDog:
if (_s08_currDogSequenceId == 0x135)
_s08_nextDogSequenceId = 0x133;
else
_s08_nextDogSequenceId = 0x13C;
- _gnapActionStatus = -1;
+ _vm->_gnapActionStatus = -1;
break;
}
}
- if (_gameSys->getAnimationStatus(1) == 2) {
- _gameSys->setAnimation(0, 0, 1);
- switch (_platypusActionStatus) {
+ if (_vm->_gameSys->getAnimationStatus(1) == 2) {
+ _vm->_gameSys->setAnimation(0, 0, 1);
+ switch (_vm->_platypusActionStatus) {
case kASPlatWithDog:
_s08_nextDogSequenceId = 0x147;
break;
case kASPlatWithMan:
_s08_nextManSequenceId = 0x140;
- _platypusActionStatus = -1;
+ _vm->_platypusActionStatus = -1;
break;
}
}
- if (_gameSys->getAnimationStatus(2) == 2 && _s08_nextManSequenceId != -1) {
- _gameSys->setAnimation(_s08_nextManSequenceId, 100, 2);
- _gameSys->insertSequence(_s08_nextManSequenceId, 100, _s08_currManSequenceId, 100, kSeqSyncWait, 0, 0, 0);
+ if (_vm->_gameSys->getAnimationStatus(2) == 2 && _s08_nextManSequenceId != -1) {
+ _vm->_gameSys->setAnimation(_s08_nextManSequenceId, 100, 2);
+ _vm->_gameSys->insertSequence(_s08_nextManSequenceId, 100, _s08_currManSequenceId, 100, kSeqSyncWait, 0, 0, 0);
_s08_currManSequenceId = _s08_nextManSequenceId;
_s08_nextManSequenceId = -1;
}
- if (_gameSys->getAnimationStatus(3) == 2) {
+ if (_vm->_gameSys->getAnimationStatus(3) == 2) {
if (_s08_currDogSequenceId == 0x147)
- _platypusActionStatus = -1;
+ _vm->_platypusActionStatus = -1;
if (_s08_currDogSequenceId == 0x149 || _s08_currDogSequenceId == 0x14A || _s08_currDogSequenceId == 0x14B) {
- if (getRandom(2) != 0)
+ if (_vm->getRandom(2) != 0)
_s08_nextManSequenceId = 0x13D;
else
_s08_nextManSequenceId = 0x13E;
} else if (_s08_currDogSequenceId == 0x133)
_s08_nextManSequenceId = 0x139;
if (_s08_nextDogSequenceId == 0x149 || _s08_nextDogSequenceId == 0x14A || _s08_nextDogSequenceId == 0x14B) {
- _gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3);
- _gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0);
+ _vm->_gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3);
+ _vm->_gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0);
switch (_s08_nextDogSequenceId) {
case 0x149:
- setFlag(kGFBarnPadlockOpen);
- _hotspots[kHSMeat]._flags = SF_DISABLED | SF_WALKABLE;
- _gameSys->removeSequence(0x144, 1, true);
+ _vm->setFlag(kGFBarnPadlockOpen);
+ _vm->_hotspots[kHSMeat]._flags = SF_DISABLED | SF_WALKABLE;
+ _vm->_gameSys->removeSequence(0x144, 1, true);
break;
case 0x14A:
- setFlag(kGFTruckFilledWithGas);
- _hotspots[kHSBone]._flags = SF_DISABLED | SF_WALKABLE;
- _gameSys->removeSequence(0x145, 1, true);
+ _vm->setFlag(kGFTruckFilledWithGas);
+ _vm->_hotspots[kHSBone]._flags = SF_DISABLED | SF_WALKABLE;
+ _vm->_gameSys->removeSequence(0x145, 1, true);
break;
case 0x14B:
- setFlag(kGFTruckKeysUsed);
- _hotspots[kHSToy]._flags = SF_DISABLED | SF_WALKABLE;
- _gameSys->removeSequence(0x146, 1, true);
+ _vm->setFlag(kGFTruckKeysUsed);
+ _vm->_hotspots[kHSToy]._flags = SF_DISABLED | SF_WALKABLE;
+ _vm->_gameSys->removeSequence(0x146, 1, true);
break;
}
_s08_currDogSequenceId = _s08_nextDogSequenceId;
_s08_nextDogSequenceId = 0x134;
} else if (_s08_nextDogSequenceId == 0x147) {
- _gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3);
- _gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0);
- _gameSys->insertSequence(0x148, 160, _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0);
+ _vm->_gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3);
+ _vm->_gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0);
+ _vm->_gameSys->insertSequence(0x148, 160, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0);
_s08_currDogSequenceId = _s08_nextDogSequenceId;
_s08_nextDogSequenceId = 0x134;
- _platX = 1;
- _platY = 8;
- _platypusId = 160;
- _platypusSequenceId = 0x148;
- _platypusFacing = kDirUnk4;
- _platypusSequenceDatNum = 0;
- if (_gnapX == 1 && _gnapY == 8)
- gnapWalkStep();
+ _vm->_platX = 1;
+ _vm->_platY = 8;
+ _vm->_platypusId = 160;
+ _vm->_platypusSequenceId = 0x148;
+ _vm->_platypusFacing = kDirUnk4;
+ _vm->_platypusSequenceDatNum = 0;
+ if (_vm->_gnapX == 1 && _vm->_gnapY == 8)
+ _vm->gnapWalkStep();
} else if (_s08_nextDogSequenceId != -1) {
- _gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3);
- _gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0);
+ _vm->_gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3);
+ _vm->_gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0);
_s08_currDogSequenceId = _s08_nextDogSequenceId;
if (_s08_nextDogSequenceId != 0x135)
_s08_nextDogSequenceId = 0x134;
if (_s08_currDogSequenceId == 0x133) {
- _timers[2] = getRandom(30) + 20;
- _timers[3] = getRandom(50) + 200;
- _gameSys->insertSequence(0x14D, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0);
- _gnapSequenceId = 0x14D;
- _gnapIdleFacing = kDirUpRight;
- _gnapSequenceDatNum = 0;
- _gnapActionStatus = -1;
+ _vm->_timers[2] = _vm->getRandom(30) + 20;
+ _vm->_timers[3] = _vm->getRandom(50) + 200;
+ _vm->_gameSys->insertSequence(0x14D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0);
+ _vm->_gnapSequenceId = 0x14D;
+ _vm->_gnapIdleFacing = kDirUpRight;
+ _vm->_gnapSequenceDatNum = 0;
+ _vm->_gnapActionStatus = -1;
}
}
}
diff --git a/engines/gnap/scenes/scene08.h b/engines/gnap/scenes/scene08.h
new file mode 100644
index 0000000000..ab538ce29a
--- /dev/null
+++ b/engines/gnap/scenes/scene08.h
@@ -0,0 +1,52 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef GNAP_SCENE08_H
+#define GNAP_SCENE08_H
+
+#include "gnap/debugger.h"
+#include "gnap/scenes/scenecore.h"
+
+namespace Gnap {
+
+class GnapEngine;
+
+class Scene08: public Scene {
+public:
+ Scene08(GnapEngine *vm);
+ ~Scene08() {}
+
+ virtual int init();
+ virtual void updateHotspots();
+ virtual void run();
+ virtual void updateAnimations();
+ virtual void updateAnimationsCb();
+
+private:
+ int _s08_nextDogSequenceId;
+ int _s08_currDogSequenceId;
+ int _s08_nextManSequenceId;
+ int _s08_currManSequenceId;
+};
+
+} // End of namespace Gnap
+#endif // GNAP_SCENE08_H
diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp
index ba14f1260e..f93f995f78 100644
--- a/engines/gnap/scenes/scenecore.cpp
+++ b/engines/gnap/scenes/scenecore.cpp
@@ -33,6 +33,7 @@
#include "gnap/scenes/scene05.h"
#include "gnap/scenes/scene06.h"
#include "gnap/scenes/scene07.h"
+#include "gnap/scenes/scene08.h"
namespace Gnap {
@@ -95,8 +96,9 @@ int GnapEngine::initSceneLogic() {
initSceneGrid(21, 146, 11, 10);
break;
case 8:
- backgroundId = scene08_init();
- scene08_updateHotspots();
+ _scene = new Scene08(this);
+ backgroundId = _scene->init();
+ _scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
@@ -414,7 +416,8 @@ void GnapEngine::runSceneLogic() {
_newSceneNum = 8;
break;
case 8:
- scene08_run();
+ _scene->run();
+ delete _scene;
if (_newSceneNum == 55)
_newSceneNum = 9;
break;
diff --git a/engines/gnap/scenes/scenecore.h b/engines/gnap/scenes/scenecore.h
index a97bf5c8e4..63f11b9c8b 100644
--- a/engines/gnap/scenes/scenecore.h
+++ b/engines/gnap/scenes/scenecore.h
@@ -38,6 +38,7 @@ public:
virtual void updateHotspots() = 0;
virtual void run() = 0;
virtual void updateAnimations() = 0;
+ virtual void updateAnimationsCb() = 0;
protected:
GnapEngine *_vm;