aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorjohndoe1232012-10-08 10:17:20 +0000
committerWillem Jan Palenstijn2013-05-08 20:44:39 +0200
commit483d76d635dac1ea4418a4ab6cbb639e9314a0c7 (patch)
treedd11df7b930e23d33a6fee3e9277bc23abf8ab3d /engines
parent9b7bb71dd952c85fea54d6526d9b2aaa1bd0498f (diff)
downloadscummvm-rg350-483d76d635dac1ea4418a4ab6cbb639e9314a0c7.tar.gz
scummvm-rg350-483d76d635dac1ea4418a4ab6cbb639e9314a0c7.tar.bz2
scummvm-rg350-483d76d635dac1ea4418a4ab6cbb639e9314a0c7.zip
NEVERHOOD: Enable/fixup navigation scene sound update code in several modules
- Rename some NavigationScene stuff
Diffstat (limited to 'engines')
-rw-r--r--engines/neverhood/gamemodule.cpp4
-rw-r--r--engines/neverhood/module1100.cpp18
-rw-r--r--engines/neverhood/module1800.cpp4
-rw-r--r--engines/neverhood/module2300.cpp55
-rw-r--r--engines/neverhood/module2300.h2
-rw-r--r--engines/neverhood/module3000.cpp24
-rw-r--r--engines/neverhood/navigationscene.cpp41
-rw-r--r--engines/neverhood/navigationscene.h11
8 files changed, 70 insertions, 89 deletions
diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp
index ef1b09320a..190934f91b 100644
--- a/engines/neverhood/gamemodule.cpp
+++ b/engines/neverhood/gamemodule.cpp
@@ -309,8 +309,8 @@ void GameModule::startup() {
#if 1
- _vm->gameState().sceneNum = 5;
- createModule(2200, -1);
+ _vm->gameState().sceneNum = 1;
+ createModule(2300, -1);
#endif
#if 0
_vm->gameState().sceneNum = 0;
diff --git a/engines/neverhood/module1100.cpp b/engines/neverhood/module1100.cpp
index 257ee27d0d..53ede4315d 100644
--- a/engines/neverhood/module1100.cpp
+++ b/engines/neverhood/module1100.cpp
@@ -206,23 +206,19 @@ void Module1100::updateScene() {
} else {
switch (_vm->gameState().sceneNum) {
case 0:
-#if 0 // TODO
- if (navigationScene()->soundFlag1 && _countdown != 0 && (--_countdown == 0)) {
- SoundMan_playTwoSounds(0x0002C818, 0x48498E46, 0x50399F64);
- SoundMan_setSoundVolume(0x48498E46, 65);
- SoundMan_setSoundVolume(0x50399F64, 65);
+ if (navigationScene()->isWalkingForward() && _countdown != 0 && (--_countdown == 0)) {
+ _vm->_soundMan->playTwoSounds(0x0002C818, 0x48498E46, 0x50399F64, 0);
+ _vm->_soundMan->setSoundVolume(0x48498E46, 65);
+ _vm->_soundMan->setSoundVolume(0x50399F64, 65);
}
-#endif
break;
case 1:
-#if 0 // TODO
- if (navigationScene()->soundFlag1 && _countdown != 0 && (--_countdown == 0)) {
- SoundMan_playTwoSounds(0x0002C818, 0x41861371, 0x43A2507F);
+ if (navigationScene()->isWalkingForward() && _countdown != 0 && (--_countdown == 0)) {
+ _vm->_soundMan->playTwoSounds(0x0002C818, 0x41861371, 0x43A2507F, 0);
}
-#endif
break;
case 2:
- _vm->_soundMan->setSoundParams(0x74E01054, !navigationScene()->getSoundFlag1(), 0, 0, 0, 0);
+ _vm->_soundMan->setSoundParams(0x74E01054, !navigationScene()->isWalkingForward(), 0, 0, 0, 0);
break;
case 5:
case 6:
diff --git a/engines/neverhood/module1800.cpp b/engines/neverhood/module1800.cpp
index 43355955d5..ea6182d746 100644
--- a/engines/neverhood/module1800.cpp
+++ b/engines/neverhood/module1800.cpp
@@ -158,7 +158,7 @@ void Module1800::updateScene() {
case 8:
// NOTE: After Klayman jumped into the hole and died...
leaveModule(1);
- // TODO GameState stuff
+ // TODO GameState stuff // Restarts the game?
break;
case 9:
leaveModule(0);
@@ -167,7 +167,7 @@ void Module1800::updateScene() {
} else {
switch (_vm->gameState().sceneNum) {
case 0:
- if (navigationScene()->getSoundFlag1() && navigationScene()->getNavigationIndex() == 2) {
+ if (navigationScene()->isWalkingForward() && navigationScene()->getNavigationIndex() == 2) {
_vm->_soundMan->setTwoSoundsPlayFlag(false);
}
break;
diff --git a/engines/neverhood/module2300.cpp b/engines/neverhood/module2300.cpp
index 4f35122eb2..9e2acff997 100644
--- a/engines/neverhood/module2300.cpp
+++ b/engines/neverhood/module2300.cpp
@@ -21,25 +21,25 @@
*/
#include "neverhood/module2300.h"
+#include "neverhood/navigationscene.h"
namespace Neverhood {
static const uint32 kModule2300SoundList[] = {
- 0x90805C50,
- 0x90804450,
- 0xB4005E60,
- 0x91835066,
- 0x90E14440,
- 0x90F0D1C3,
- 0
+ 0x90805C50, 0x90804450, 0xB4005E60, 0x91835066,
+ 0x90E14440, 0x90F0D1C3, 0
};
Module2300::Module2300(NeverhoodEngine *vm, Module *parentModule, int which)
- : Module(vm, parentModule), _volume(0) {
+ : Module(vm, parentModule), _soundVolume(0) {
_vm->_soundMan->addSoundList(0x1A214010, kModule2300SoundList);
_vm->_soundMan->setSoundListParams(kModule2300SoundList, true, 50, 600, 10, 150);
+ //DEBUG>>>
+ setGlobalVar(0x10938830, 0);
+ //DEBUG<<<
+
_flag = getGlobalVar(0x10938830) == 0;
if (_flag) {
@@ -82,7 +82,7 @@ void Module2300::createScene(int sceneNum, int which) {
case 1:
createNavigationScene(0x004B67E8, which);
if (_flag) {
- _volume = 15;
+ _soundVolume = 15;
_vm->_soundMan->setSoundVolume(0x90F0D1C3, 15);
}
break;
@@ -93,10 +93,10 @@ void Module2300::createScene(int sceneNum, int which) {
if (getGlobalVar(0x10938830)) {
createNavigationScene(0x004B68F0, which);
} else {
- _vm->_soundMan->setSoundVolume(0x90F0D1C3, _volume);
+ _vm->_soundMan->setSoundVolume(0x90F0D1C3, _soundVolume);
createNavigationScene(0x004B68A8, which);
if (_flag) {
- _volume = 87;
+ _soundVolume = 87;
_vm->_soundMan->setSoundVolume(0x90F0D1C3, 87);
}
}
@@ -157,32 +157,23 @@ void Module2300::updateScene() {
} else {
switch (_vm->gameState().sceneNum) {
case 1:
-#if 0 // TODO
- NavigationScene *navigationScene = (NavigationScene*)_childObject;
- if (_flag && navigationScene->getSoundFlag1() && navigationScene->getNavigationIndex() == 4 &&
- navigationScene->getSmackerPlayer() && navigationScene->getSmackerPlayer()->getFrameNumber() % 2) {
- _volume++;
- SoundMan_setSoundVolume(0x90F0D1C3, _volume);
+ if (_flag && navigationScene()->isWalkingForward() && navigationScene()->getNavigationIndex() == 4 &&
+ navigationScene()->getFrameNumber() % 2) {
+ _soundVolume++;
+ _vm->_soundMan->setSoundVolume(0x90F0D1C3, _soundVolume);
}
-#endif
-#if 0 // TODO
- if (navigationScene->getSoundFlag1() && navigationScene->getNavigationIndex() == 0 &&
- navigationScene->getSmackerPlayer() && navigationScene->getSmackerPlayer()->getFrameNumber() == 50) {
- SoundMan_playTwoSounds(0x1A214010, 0x48498E46, 0x50399F64);
- SoundMan_setSoundVolume(0x48498E46, 70);
- SoundMan_setSoundVolume(0x50399F64, 70);
+ if (navigationScene()->isWalkingForward() && navigationScene()->getNavigationIndex() == 0 &&
+ navigationScene()->getFrameNumber() == 50) {
+ _vm->_soundMan->playTwoSounds(0x1A214010, 0x48498E46, 0x50399F64, 0);
+ _vm->_soundMan->setSoundVolume(0x48498E46, 70);
+ _vm->_soundMan->setSoundVolume(0x50399F64, 70);
}
-#endif
break;
case 3:
-#if 0 // TODO
- NavigationScene *navigationScene = (NavigationScene*)_childObject;
- if (_flag && navigationScene->getSoundFlag1() && navigationScene->getSmackerPlayer() &&
- navigationScene->getSmackerPlayer()->getFrameNumber() % 2) {
- _volume--;
- SoundMan_setSoundVolume(0x90F0D1C3, _volume);
+ if (_flag && navigationScene()->isWalkingForward() && navigationScene()->getFrameNumber() % 2) {
+ _soundVolume--;
+ _vm->_soundMan->setSoundVolume(0x90F0D1C3, _soundVolume);
}
-#endif
break;
}
}
diff --git a/engines/neverhood/module2300.h b/engines/neverhood/module2300.h
index 722255978c..ed39a45b35 100644
--- a/engines/neverhood/module2300.h
+++ b/engines/neverhood/module2300.h
@@ -37,7 +37,7 @@ public:
virtual ~Module2300();
protected:
bool _flag;
- int _volume;
+ int _soundVolume;
void createScene(int sceneNum, int which);
void updateScene();
};
diff --git a/engines/neverhood/module3000.cpp b/engines/neverhood/module3000.cpp
index 78ab74d61a..55ad05b58a 100644
--- a/engines/neverhood/module3000.cpp
+++ b/engines/neverhood/module3000.cpp
@@ -240,12 +240,12 @@ void Module3000::updateScene() {
case 8:
_flag = getGlobalVar(0x10938830); // CHECKME
if (_moduleResult != 1) {
- // TODO: SoundMan_setSoundListParams(kModule3000SoundList, true, 0, 0, 0, 0):
+ _vm->_soundMan->setSoundListParams(kModule3000SoundList, true, 0, 0, 0, 0);
createScene(4, 1);
} else if (getGlobalVar(0xF0402B0A)) {
createScene(1008, -1);
} else {
- // TODO: SoundMan_setSoundListParams(kModule3000SoundList, true, 0, 0, 0, 0);
+ _vm->_soundMan->setSoundListParams(kModule3000SoundList, true, 0, 0, 0, 0);
createScene(4, 1);
}
break;
@@ -280,10 +280,9 @@ void Module3000::updateScene() {
} else {
switch (_vm->gameState().sceneNum) {
case 1:
-#if 0 // ALL TODO
- if (navigationScene()->getSoundFlag1()) {
+ if (navigationScene()->isWalkingForward()) {
uint32 frameNumber = navigationScene()->getFrameNumber();
- int navigationIndex = navigationScene()->getIndex();
+ int navigationIndex = navigationScene()->getNavigationIndex();
if (navigationIndex == 1) {
if (frameNumber == 0) {
_vm->_soundMan->playTwoSounds(0x81293110, 0x48498E46, 0x50399F64, 0);
@@ -309,13 +308,11 @@ void Module3000::updateScene() {
}
}
}
-#endif
break;
case 2:
-#if 0 // ALL TODO
- if (navigationScene()->getSoundFlag1()) {
+ if (navigationScene()->isWalkingForward()) {
uint32 frameNumber = navigationScene()->getFrameNumber();
- int navigationIndex = navigationScene()->getIndex();
+ int navigationIndex = navigationScene()->getNavigationIndex();
if (_flag && _soundVolume > 1 && frameNumber % 2) {
_soundVolume--;
_vm->_soundMan->setSoundVolume(0x90F0D1C3, _soundVolume);
@@ -332,13 +329,11 @@ void Module3000::updateScene() {
}
}
}
-#endif
break;
case 3:
-#if 0 // ALL TODO
- if (navigationScene()->getSoundFlag1()) {
+ if (navigationScene()->isWalkingForward()) {
uint32 frameNumber = navigationScene()->getFrameNumber();
- int navigationIndex = navigationScene()->getIndex();
+ int navigationIndex = navigationScene()->getNavigationIndex();
if (navigationIndex == 2) {
if (frameNumber == 40) {
_vm->_soundMan->playTwoSounds(0x81293110, 0x40030A51, 0xC862CA15, 0);
@@ -352,10 +347,9 @@ void Module3000::updateScene() {
}
}
}
-#endif
break;
case 5:
- if (navigationScene()->getSoundFlag1() && navigationScene()->getNavigationIndex() == 0) {
+ if (navigationScene()->isWalkingForward() && navigationScene()->getNavigationIndex() == 0) {
_vm->_soundMan->setTwoSoundsPlayFlag(false);
}
break;
diff --git a/engines/neverhood/navigationscene.cpp b/engines/neverhood/navigationscene.cpp
index a3e15369ae..66b30cf79e 100644
--- a/engines/neverhood/navigationscene.cpp
+++ b/engines/neverhood/navigationscene.cpp
@@ -27,13 +27,16 @@ namespace Neverhood {
NavigationScene::NavigationScene(NeverhoodEngine *vm, Module *parentModule, uint32 navigationListId, int navigationIndex, const byte *itemsTypes)
: Scene(vm, parentModule, true), _itemsTypes(itemsTypes), _navigationIndex(navigationIndex), _smackerDone(false),
- _soundFlag1(false), _soundFlag2(false), _smackerFileHash(0), _interactive(true), _done(false) {
+ _isWalkingForward(false), _isTurning(false), _smackerFileHash(0), _interactive(true), _leaveSceneAfter(false) {
_navigationList = _vm->_staticData->getNavigationList(navigationListId);
+
+ //DEBUG>>>
for (NavigationList::iterator it = _navigationList->begin(); it != _navigationList->end(); it++) {
debug("%08X %08X %08X %08X %d %d %08X", (*it).fileHash, (*it).leftSmackerFileHash, (*it).rightSmackerFileHash,
(*it).middleSmackerFileHash, (*it).interactive, (*it).middleFlag, (*it).mouseCursorFileHash);
}
+ //DEBUG<<<
if (_navigationIndex < 0) {
_navigationIndex = (int)getGlobalVar(0x4200189E);
@@ -46,9 +49,7 @@ NavigationScene::NavigationScene(NeverhoodEngine *vm, Module *parentModule, uint
SetMessageHandler(&NavigationScene::handleMessage);
_smackerPlayer = new SmackerPlayer(_vm, this, (*_navigationList)[_navigationIndex].fileHash, true, true);
-
addEntity(_smackerPlayer);
-
addSurface(_smackerPlayer->getSurface());
createMouseCursor();
@@ -79,14 +80,14 @@ void NavigationScene::update() {
_smackerDone = false;
_smackerFileHash = 0;
} else if (_smackerDone) {
- if (_done) {
+ if (_leaveSceneAfter) {
sendMessage(_parentModule, 0x1009, _navigationIndex);
} else {
const NavigationItem &navigationItem = (*_navigationList)[_navigationIndex];
createMouseCursor();
showMouse(true);
- _soundFlag2 = false;
- _soundFlag1 = false;
+ _isTurning = false;
+ _isWalkingForward = false;
_interactive = true;
_vm->_soundMan->setTwoSoundsPlayFlag(false);
_vm->_soundMan->setSoundThreePlayFlag(false);
@@ -151,8 +152,8 @@ void NavigationScene::createMouseCursor() {
void NavigationScene::handleNavigation(const NPoint &mousePos) {
const NavigationItem &navigationItem = (*_navigationList)[_navigationIndex];
- bool oldSoundFlag1 = _soundFlag1;
- bool oldSoundFlag2 = _soundFlag2;
+ bool oldIsWalkingForward = _isWalkingForward;
+ bool oldIsTurning = _isTurning;
uint32 direction = sendPointMessage(_mouseCursor, 0x2064, mousePos);
switch (direction) {
@@ -161,8 +162,8 @@ void NavigationScene::handleNavigation(const NPoint &mousePos) {
if (navigationItem.leftSmackerFileHash != 0) {
_smackerFileHash = navigationItem.leftSmackerFileHash;
_interactive = false;
- _soundFlag1 = false;
- _soundFlag2 = true;
+ _isWalkingForward = false;
+ _isTurning = true;
do {
_navigationIndex--;
if (_navigationIndex < 0)
@@ -177,8 +178,8 @@ void NavigationScene::handleNavigation(const NPoint &mousePos) {
if (navigationItem.rightSmackerFileHash != 0) {
_smackerFileHash = navigationItem.rightSmackerFileHash;
_interactive = false;
- _soundFlag1 = false;
- _soundFlag2 = true;
+ _isWalkingForward = false;
+ _isTurning = true;
do {
_navigationIndex++;
if (_navigationIndex >= (int)_navigationList->size())
@@ -197,20 +198,18 @@ void NavigationScene::handleNavigation(const NPoint &mousePos) {
} else if (navigationItem.middleSmackerFileHash != 0) {
_smackerFileHash = navigationItem.middleSmackerFileHash;
_interactive = false;
- _soundFlag1 = true;
- _soundFlag2 = false;
- _done = true;
+ _isWalkingForward = true;
+ _isTurning = false;
+ _leaveSceneAfter = true;
}
break;
}
- if (oldSoundFlag2 != _soundFlag2) {
- _vm->_soundMan->setSoundThreePlayFlag(_soundFlag2);
- }
+ if (oldIsTurning != _isTurning)
+ _vm->_soundMan->setSoundThreePlayFlag(_isTurning);
- if (oldSoundFlag1 != _soundFlag1) {
- _vm->_soundMan->setTwoSoundsPlayFlag(_soundFlag1);
- }
+ if (oldIsWalkingForward != _isWalkingForward)
+ _vm->_soundMan->setTwoSoundsPlayFlag(_isWalkingForward);
}
diff --git a/engines/neverhood/navigationscene.h b/engines/neverhood/navigationscene.h
index cf351d1bcd..ebe9a3597c 100644
--- a/engines/neverhood/navigationscene.h
+++ b/engines/neverhood/navigationscene.h
@@ -35,8 +35,9 @@ public:
virtual ~NavigationScene();
int getNavigationAreaType();
int getNavigationIndex() const { return _navigationIndex; }
- bool getSoundFlag1() const { return _soundFlag1; }
- bool getSoundFlag2() const { return _soundFlag2; }
+ bool isWalkingForward() const { return _isWalkingForward; }
+ bool isTurning() const { return _isTurning; }
+ int getFrameNumber() const { return _smackerPlayer->getFrameNumber(); }
protected:
SmackerPlayer *_smackerPlayer;
bool _smackerDone;
@@ -44,9 +45,9 @@ protected:
int _navigationIndex;
uint32 _smackerFileHash;
bool _interactive;
- bool _soundFlag1;
- bool _soundFlag2;
- bool _done;
+ bool _isWalkingForward;
+ bool _isTurning;
+ bool _leaveSceneAfter;
const byte *_itemsTypes;
void update();
uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);