diff options
author | Strangerke | 2016-04-24 23:17:15 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-05-10 09:54:21 +0200 |
commit | 28d8a8be7cba9f1695650c4c5de93eee458ebe7d (patch) | |
tree | a9f7d0974482ee1e9f0ae69b9ae4ecf01430c023 /engines/gnap | |
parent | ba0c3f2cc316d932065437b6e749f1d5edc426e4 (diff) | |
download | scummvm-rg350-28d8a8be7cba9f1695650c4c5de93eee458ebe7d.tar.gz scummvm-rg350-28d8a8be7cba9f1695650c4c5de93eee458ebe7d.tar.bz2 scummvm-rg350-28d8a8be7cba9f1695650c4c5de93eee458ebe7d.zip |
GNAP: Rename and move two fonctions to Scene
Diffstat (limited to 'engines/gnap')
-rw-r--r-- | engines/gnap/gnap.cpp | 39 | ||||
-rw-r--r-- | engines/gnap/gnap.h | 7 | ||||
-rw-r--r-- | engines/gnap/scenes/scene07.cpp | 2 | ||||
-rw-r--r-- | engines/gnap/scenes/scene08.cpp | 2 | ||||
-rw-r--r-- | engines/gnap/scenes/scene09.cpp | 2 | ||||
-rw-r--r-- | engines/gnap/scenes/scene49.cpp | 2 | ||||
-rw-r--r-- | engines/gnap/scenes/scene51.cpp | 2 | ||||
-rw-r--r-- | engines/gnap/scenes/scene52.cpp | 2 | ||||
-rw-r--r-- | engines/gnap/scenes/scenecore.cpp | 39 | ||||
-rw-r--r-- | engines/gnap/scenes/scenecore.h | 3 |
10 files changed, 48 insertions, 52 deletions
diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 376c2790b7..371e7ef45f 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2028,45 +2028,6 @@ void GnapEngine::initGlobalSceneVars() { _toyUfoY = 50; } -bool GnapEngine::sceneXX_sub_4466B1() { - if (isKeyStatus1(Common::KEYCODE_ESCAPE)) { - clearKeyStatus1(Common::KEYCODE_ESCAPE); - clearKeyStatus1(Common::KEYCODE_UP); - clearKeyStatus1(Common::KEYCODE_RIGHT); - clearKeyStatus1(Common::KEYCODE_LEFT); - clearKeyStatus1(Common::KEYCODE_p); - return true; - } - - if (isKeyStatus1(Common::KEYCODE_p)) { - clearKeyStatus1(Common::KEYCODE_p); - pauseGame(); - updatePause(); - } - - return false; -} - -void GnapEngine::sceneXX_playRandomSound(int timerIndex) { - if (!_timers[timerIndex]) { - _timers[timerIndex] = getRandom(40) + 50; - switch (getRandom(4)) { - case 0: - playSound(0x1091B, false); - break; - case 1: - playSound(0x10921, false); - break; - case 2: - playSound(0x10927, false); - break; - case 3: - playSound(0x1091D, false); - break; - } - } -} - void GnapEngine::playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3) { setGrabCursorSprite(-1); _gameSys->setAnimation(sequenceId2, _gnapId, 0); diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 3da744aa0e..1169c3bf34 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -576,9 +576,6 @@ public: int _toyUfoY; void initGlobalSceneVars(); - - bool sceneXX_sub_4466B1(); - void sceneXX_playRandomSound(int timerIndex); void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); // Shared by scenes 17 & 18 @@ -589,10 +586,6 @@ public: int toyUfoGetSequenceId(); bool toyUfoCheckTimer(); void toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, int maxY, int animationIndex); - - // Scene 54 - void scene54_initCutscene1(); - void scene54_initCutscene2(); }; } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene07.cpp b/engines/gnap/scenes/scene07.cpp index c94408297e..244e901947 100644 --- a/engines/gnap/scenes/scene07.cpp +++ b/engines/gnap/scenes/scene07.cpp @@ -235,7 +235,7 @@ void Scene07::run() { _vm->_timers[0] = 100; _vm->_timers[1] = 35; } - _vm->sceneXX_playRandomSound(4); + playRandomSound(4); } _vm->checkGameKeys(); diff --git a/engines/gnap/scenes/scene08.cpp b/engines/gnap/scenes/scene08.cpp index d13f763a19..a5054cb558 100644 --- a/engines/gnap/scenes/scene08.cpp +++ b/engines/gnap/scenes/scene08.cpp @@ -385,7 +385,7 @@ void Scene08::run() { } } } - _vm->sceneXX_playRandomSound(5); + playRandomSound(5); } _vm->checkGameKeys(); diff --git a/engines/gnap/scenes/scene09.cpp b/engines/gnap/scenes/scene09.cpp index ac0b1be342..5feee78597 100644 --- a/engines/gnap/scenes/scene09.cpp +++ b/engines/gnap/scenes/scene09.cpp @@ -187,7 +187,7 @@ void Scene09::run() { else _vm->_gameSys->insertSequence(0x4A, 1, 0, 0, kSeqNone, 0, 0, 0); } - _vm->sceneXX_playRandomSound(5); + playRandomSound(5); } _vm->checkGameKeys(); diff --git a/engines/gnap/scenes/scene49.cpp b/engines/gnap/scenes/scene49.cpp index 97a8724072..9f637b2b78 100644 --- a/engines/gnap/scenes/scene49.cpp +++ b/engines/gnap/scenes/scene49.cpp @@ -451,7 +451,7 @@ void Scene49::run() { updateAnimations(); - if (_vm->sceneXX_sub_4466B1()) { + if (clearKeyStatus()) { _vm->_sceneDone = true; _vm->_newSceneNum = 2; _vm->_newCursorValue = 1; diff --git a/engines/gnap/scenes/scene51.cpp b/engines/gnap/scenes/scene51.cpp index f4a3a843ba..dc93c6ba4d 100644 --- a/engines/gnap/scenes/scene51.cpp +++ b/engines/gnap/scenes/scene51.cpp @@ -724,7 +724,7 @@ void Scene51::run() { bool startWalk = true; while (!_vm->_sceneDone) { - if (_vm->sceneXX_sub_4466B1()) + if (clearKeyStatus()) _vm->_sceneDone = true; _vm->gameUpdateTick(); diff --git a/engines/gnap/scenes/scene52.cpp b/engines/gnap/scenes/scene52.cpp index fb16184742..ba1b0ff79e 100644 --- a/engines/gnap/scenes/scene52.cpp +++ b/engines/gnap/scenes/scene52.cpp @@ -877,7 +877,7 @@ void Scene52::run() { update(); - if (_vm->sceneXX_sub_4466B1()) { + if (clearKeyStatus()) { _s52_alienWave = false; _vm->_gameSys->waitForUpdate(); initAnims(); diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index c6bc9a1c1f..33ba9111e7 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -821,6 +821,45 @@ void GnapEngine::runSceneLogic() { } } +void Scene::playRandomSound(int timerIndex) { + if (!_vm->_timers[timerIndex]) { + _vm->_timers[timerIndex] = _vm->getRandom(40) + 50; + switch (_vm->getRandom(4)) { + case 0: + _vm->playSound(0x1091B, false); + break; + case 1: + _vm->playSound(0x10921, false); + break; + case 2: + _vm->playSound(0x10927, false); + break; + case 3: + _vm->playSound(0x1091D, false); + break; + } + } +} + +bool Scene::clearKeyStatus() { + if (_vm->isKeyStatus1(Common::KEYCODE_ESCAPE)) { + _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); + _vm->clearKeyStatus1(Common::KEYCODE_UP); + _vm->clearKeyStatus1(Common::KEYCODE_RIGHT); + _vm->clearKeyStatus1(Common::KEYCODE_LEFT); + _vm->clearKeyStatus1(Common::KEYCODE_p); + return true; + } + + if (_vm->isKeyStatus1(Common::KEYCODE_p)) { + _vm->clearKeyStatus1(Common::KEYCODE_p); + _vm->pauseGame(); + _vm->updatePause(); + } + + return false; +} + void CutScene::run() { int itemIndex = 0; int soundId = -1; diff --git a/engines/gnap/scenes/scenecore.h b/engines/gnap/scenes/scenecore.h index 1f49fd8641..ba729f802d 100644 --- a/engines/gnap/scenes/scenecore.h +++ b/engines/gnap/scenes/scenecore.h @@ -34,6 +34,9 @@ public: Scene(GnapEngine *vm) : _vm(vm) {}; ~Scene() {}; + void playRandomSound(int timerIndex); + bool clearKeyStatus(); + virtual int init() = 0; virtual void updateHotspots() = 0; virtual void run() = 0; |