diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/neverhood/gamemodule.cpp | 17 | ||||
-rw-r--r-- | engines/neverhood/module.cpp | 8 | ||||
-rw-r--r-- | engines/neverhood/module.h | 8 | ||||
-rw-r--r-- | engines/neverhood/module1300.cpp | 536 | ||||
-rw-r--r-- | engines/neverhood/module1300.h | 36 | ||||
-rw-r--r-- | engines/neverhood/module1400.cpp | 219 | ||||
-rw-r--r-- | engines/neverhood/module1400.h | 16 | ||||
-rw-r--r-- | engines/neverhood/module1500.cpp | 76 | ||||
-rw-r--r-- | engines/neverhood/module1500.h | 7 | ||||
-rw-r--r-- | engines/neverhood/module1700.cpp | 158 | ||||
-rw-r--r-- | engines/neverhood/module1700.h | 12 | ||||
-rw-r--r-- | engines/neverhood/module1800.cpp | 291 | ||||
-rw-r--r-- | engines/neverhood/module1800.h | 22 | ||||
-rw-r--r-- | engines/neverhood/module2000.cpp | 105 | ||||
-rw-r--r-- | engines/neverhood/module2000.h | 8 | ||||
-rw-r--r-- | engines/neverhood/module2300.cpp | 241 | ||||
-rw-r--r-- | engines/neverhood/module2300.h | 14 | ||||
-rw-r--r-- | engines/neverhood/module3000.cpp | 640 | ||||
-rw-r--r-- | engines/neverhood/module3000.h | 26 | ||||
-rw-r--r-- | engines/neverhood/smackerscene.cpp | 4 |
20 files changed, 908 insertions, 1536 deletions
diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index 103d53df95..e6bd99e990 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -276,7 +276,7 @@ void GameModule::startup() { _vm->gameState().sceneNum = 0; createModule2000(-1); #endif -#if 1 +#if 0 _vm->gameState().sceneNum = 4; createModule2200(-1); #endif @@ -284,6 +284,10 @@ void GameModule::startup() { _vm->gameState().sceneNum = 0; createModule1000(-1); #endif +#if 1 + _vm->gameState().sceneNum = 12; + createModule3000(-1); +#endif } void GameModule::createModule1000(int which) { @@ -375,7 +379,6 @@ void GameModule::createModule1700(int which) { void GameModule::updateModule1700() { if (!updateChild()) { - debug("Module1700 done; _moduleResult = %d", _moduleResult); if (_moduleResult == 1) { // TODO createModule2900(3); // TODO _childObject->handleUpdate(); @@ -401,8 +404,8 @@ void GameModule::updateModule1800() { // TODO createModule2700(0); // TODO _childObject->handleUpdate(); } else if (_moduleResult == 3) { - // TODO createModule3000(3); - // TODO _childObject->handleUpdate(); + createModule3000(3); + _childObject->handleUpdate(); } else { // TODO createModule2800(0); // TODO _childObject->handleUpdate(); @@ -451,7 +454,7 @@ void GameModule::updateModule2300() { } else if (_moduleResult == 3) { // TODO createModule2400(0); } else if (_moduleResult == 4) { - // TODO createModule3000(0); + createModule3000(0); } else { createModule1000(1); } @@ -480,8 +483,8 @@ void GameModule::updateModule3000() { createModule1800(3); _childObject->handleUpdate(); } else if (_moduleResult == 4) { - // TODO createModule3000(0); - // TODO _childObject->handleUpdate(); + createModule3000(0); + _childObject->handleUpdate(); } else { createModule2300(4); _childObject->handleUpdate(); diff --git a/engines/neverhood/module.cpp b/engines/neverhood/module.cpp index 78775ceba1..c58c924c3a 100644 --- a/engines/neverhood/module.cpp +++ b/engines/neverhood/module.cpp @@ -28,7 +28,7 @@ namespace Neverhood { Module::Module(NeverhoodEngine *vm, Module *parentModule) : Entity(vm, 0), _parentModule(parentModule), _childObject(NULL), - _done(false) { + _done(false), _sceneType(kSceneTypeNormal) { SetMessageHandler(&Module::handleMessage); @@ -71,11 +71,13 @@ NavigationScene *Module::navigationScene() { } void Module::createNavigationScene(uint32 navigationListId, int navigationIndex, const byte *itemsTypes) { + _sceneType = kSceneTypeNavigation; _childObject = new NavigationScene(_vm, this, navigationListId, navigationIndex, itemsTypes); } void Module::createSmackerScene(uint32 fileHash, bool doubleSurface, bool flag1, bool canAbort) { SmackerScene *smackerScene; + _sceneType = kSceneTypeSmacker; smackerScene = new SmackerScene(_vm, this, doubleSurface, flag1, canAbort); smackerScene->setFileHash(fileHash); smackerScene->nextVideo(); @@ -87,8 +89,12 @@ bool Module::updateChild() { _childObject->handleUpdate(); if (_done) { _done = false; + // Save the last area type if it's a NavigationScene for further processing + if (_sceneType == kSceneTypeNavigation) + _navigationAreaType = navigationScene()->getNavigationAreaType(); delete _childObject; _childObject = NULL; + _sceneType = kSceneTypeNormal; return false; } } diff --git a/engines/neverhood/module.h b/engines/neverhood/module.h index 2f272d71b6..c0fdaa79b5 100644 --- a/engines/neverhood/module.h +++ b/engines/neverhood/module.h @@ -38,6 +38,12 @@ namespace Neverhood { class NavigationScene; +enum SceneType { + kSceneTypeNormal, + kSceneTypeSmacker, + kSceneTypeNavigation +}; + class Module : public Entity { public: Module(NeverhoodEngine *vm, Module *parentModule); @@ -48,6 +54,8 @@ protected: Entity *_childObject; bool _done; uint32 _moduleResult; + SceneType _sceneType; + int _navigationAreaType; uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); NavigationScene *navigationScene(); void createNavigationScene(uint32 navigationListId, int navigationIndex, const byte *itemsTypes = NULL); diff --git a/engines/neverhood/module1300.cpp b/engines/neverhood/module1300.cpp index af2390cb86..518568cdb0 100644 --- a/engines/neverhood/module1300.cpp +++ b/engines/neverhood/module1300.cpp @@ -35,8 +35,6 @@ namespace Neverhood { Module1300::Module1300(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule) { - debug("Create Module1300(%d)", which); - // TODO Music18hList_add(0x61C090, 0x203197); // TODO Sound1ChList_addSoundResources(0x61C090, dword_4B2868, true); // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, 0, 50, 600, 20, 150); @@ -45,406 +43,250 @@ Module1300::Module1300(NeverhoodEngine *vm, Module *parentModule, int which) // TODO Sound1ChList_setVolume(0x50399F64, 70); if (which < 0) { - switch (_vm->gameState().sceneNum) { + if (_vm->gameState().sceneNum >= 1 && _vm->gameState().sceneNum <= 17) + createScene(_vm->gameState().sceneNum, -1); + else + createScene(11, 0); + } else { + switch (which) { + case 0: + createScene(11, 0); + break; case 1: - createScene1302(-1); + createScene(13, 0); break; case 2: - createScene1303(-1); + createScene(14, 0); break; case 3: - createScene1304(-1); + createScene(15, 0); break; case 4: - createScene1305(-1); + createScene(7, 0); break; case 5: - createScene1306(-1); + createScene(5, 1); break; case 6: - createScene1307(-1); + createScene(5, 5); break; case 7: - createScene1308(-1); + createScene(3, 0); break; case 8: - createScene1309(-1); + createScene(1, 0); break; case 9: - createScene1310(-1); + createScene(2, 0); break; case 10: - createScene1311(-1); + createScene(6, 0); break; case 11: - createScene1312(-1); - break; - case 12: - createScene1313(-1); - break; - case 13: - createScene1314(-1); - break; - case 14: - createScene1315(-1); - break; - case 15: - createScene1316(-1); - break; - case 16: - createScene1317(-1); - break; - case 17: - createScene1318(-1); + createScene(4, 0); break; default: - createScene1312(0); - } - } else { - switch (which) { - case 0: - createScene1312(0); + createScene(12, 0); break; + } + } + +} + +Module1300::~Module1300() { + // TODO Sound1ChList_sub_407A50(0x61C090); +} + +void Module1300::createScene(int sceneNum, int which) { + debug("Module1300::createScene(%d, %d)", sceneNum, which); + _vm->gameState().sceneNum = sceneNum; + switch (_vm->gameState().sceneNum) { + case 1: + // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0); + // TODO Music18hList_play(0x203197, 0, 2, 1); + _childObject = new Scene1302(_vm, this, which); + break; + case 2: + // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0); + // TODO Music18hList_stop(0x203197, 0, 2); + _childObject = new Scene1303(_vm, this, which); + break; + case 3: + // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0); + // TODO Music18hList_stop(0x203197, 0, 2); + _childObject = new Scene1304(_vm, this, which); + break; + case 4: + // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0); + // TODO Music18hList_play(0x203197, 0, 2, 1); + _childObject = new Scene1305(_vm, this, which); + break; + case 5: + // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0); + // TODO Music18hList_play(0x203197, 0, 2, 1); + _childObject = new Scene1306(_vm, this, which); + break; + case 6: + // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0); + // TODO Music18hList_play(0x203197, 0, 2, 1); + _childObject = new Scene1307(_vm, this, which); + break; + case 7: + // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0); + // TODO Music18hList_play(0x203197, 0, 2, 1); + _childObject = new Scene1308(_vm, this, which); + break; + case 8: + // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0); + // TODO Music18hList_stop(0x203197, 0, 2); + _childObject = new DiskplayerScene(_vm, this, 1); + break; + case 9: + // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0); + // TODO Music18hList_stop(0x203197, 0, 2); + createSmackerScene(0x20082818, true, true, false); + break; + case 10: + // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0); + // TODO Music18hList_stop(0x203197, 0, 2); + createSmackerScene(0x20082828, true, true, false); + break; + case 11: + // TODO Sound1ChList_setSoundValuesMulti(0xdword_4B2868, true, 0, 0, 0, 0); + // TODO Music18hList_stop(0x203197, 0, 2); + createNavigationScene(0x004B27A8, which); + break; + case 12: + // TODO Sound1ChList_setSoundValuesMulti(0xdword_4B2868, true, 0, 0, 0, 0); + // TODO Music18hList_stop(0x203197, 0, 2); + createNavigationScene(0x004B2718, which); + break; + case 13: + // TODO Sound1ChList_setSoundValuesMulti(0xdword_4B2868, true, 0, 0, 0, 0); + // TODO Music18hList_stop(0x203197, 0, 2); + createNavigationScene(0x004B27D8, which); + break; + case 14: + // TODO Sound1ChList_setSoundValuesMulti(0xdword_4B2868, true, 0, 0, 0, 0); + // TODO Music18hList_stop(0x203197, 0, 2); + createNavigationScene(0x004B2808, which); + break; + case 15: + // TODO Sound1ChList_setSoundValuesMulti(0xdword_4B2868, true, 0, 0, 0, 0); + // TODO Music18hList_stop(0x203197, 0, 2); + createNavigationScene(0x004B2838, which); + break; + case 16: + // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0); + // TODO Music18hList_stop(0x203197, 0, 2); + _childObject = new Scene1317(_vm, this, which); + break; + case 17: + // TODO: Credits scene + break; + } + SetUpdateHandler(&Module1300::updateScene); + _childObject->handleUpdate(); +} + +void Module1300::updateScene() { + if (!updateChild()) { + switch (_vm->gameState().sceneNum) { case 1: - createScene1314(0); + if (_moduleResult == 1) { + createScene(4, 0); + } else { + createScene(7, 1); + } break; case 2: - createScene1315(0); + createScene(5, 3); break; case 3: - createScene1316(0); + createScene(15, 0); break; case 4: - createScene1308(0); + createScene(16, -1); break; case 5: - createScene1306(1); + if (_moduleResult == 2) { + createScene(8, 0); + } else if (_moduleResult == 3) { + createScene(2, 0); + } else if (_moduleResult == 0) { + sendMessage(_parentModule, 0x1009, 0); + } else if (_moduleResult == 1) { + createScene(10, -1); + } break; case 6: - createScene1306(5); + createScene(7, 2); break; case 7: - createScene1304(0); + if (_moduleResult == 0) { + createScene(13, 0); + } else if (_moduleResult == 1) { + createScene(1, 0); + } else if (_moduleResult == 2) { + createScene(6, 0); + } break; case 8: - createScene1302(0); + createScene(5, 2); break; case 9: - createScene1303(0); + createScene(5, 0); break; case 10: - createScene1307(0); + createScene(14, 0); break; case 11: - createScene1305(0); + if (_moduleResult == 0) + createScene(12, 0); + else if (_moduleResult == 1) + createScene(11, 1); break; - default: - createScene1313(0); + case 12: + if (_moduleResult == 0) + createScene(14, 1); + else if (_moduleResult == 1) + createScene(15, 1); + else if (_moduleResult == 3) + createScene(11, 1); + else if (_moduleResult == 5) + createScene(13, 1); break; - } - } - -} - -Module1300::~Module1300() { - // TODO Sound1ChList_sub_407A50(0x61C090); -} - -void Module1300::createScene1302(int which) { - _vm->gameState().sceneNum = 1; - // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0); - // TODO Music18hList_play(0x203197, 0, 2, 1); - _childObject = new Scene1302(_vm, this, which); - SetUpdateHandler(&Module1300::updateScene1302); -} - -void Module1300::createScene1303(int which) { - _vm->gameState().sceneNum = 2; - // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0); - // TODO Music18hList_stop(0x203197, 0, 2); - _childObject = new Scene1303(_vm, this, which); - SetUpdateHandler(&Module1300::updateScene1303); -} - -void Module1300::createScene1304(int which) { - _vm->gameState().sceneNum = 3; - // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0); - // TODO Music18hList_stop(0x203197, 0, 2); - _childObject = new Scene1304(_vm, this, which); - SetUpdateHandler(&Module1300::updateScene1304); -} - -void Module1300::createScene1305(int which) { - _vm->gameState().sceneNum = 4; - // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0); - // TODO Music18hList_play(0x203197, 0, 2, 1); - _childObject = new Scene1305(_vm, this, which); - SetUpdateHandler(&Module1300::updateScene1305); -} - -void Module1300::createScene1306(int which) { - _vm->gameState().sceneNum = 5; - // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0); - // TODO Music18hList_play(0x203197, 0, 2, 1); - _childObject = new Scene1306(_vm, this, which); - SetUpdateHandler(&Module1300::updateScene1306); -} - -void Module1300::createScene1307(int which) { - _vm->gameState().sceneNum = 6; - // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0); - // TODO Music18hList_play(0x203197, 0, 2, 1); - _childObject = new Scene1307(_vm, this, which); - SetUpdateHandler(&Module1300::updateScene1307); -} - -void Module1300::createScene1308(int which) { - _vm->gameState().sceneNum = 7; - // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0); - // TODO Music18hList_play(0x203197, 0, 2, 1); - _childObject = new Scene1308(_vm, this, which); - SetUpdateHandler(&Module1300::updateScene1308); -} - -void Module1300::createScene1309(int which) { - _vm->gameState().sceneNum = 8; - // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0); - // TODO Music18hList_stop(0x203197, 0, 2); - _childObject = new DiskplayerScene(_vm, this, 1); - SetUpdateHandler(&Module1300::updateScene1309); -} - -void Module1300::createScene1310(int which) { - _vm->gameState().sceneNum = 9; - // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0); - // TODO Music18hList_stop(0x203197, 0, 2); - createSmackerScene(0x20082818, true, true, false); - SetUpdateHandler(&Module1300::updateScene1310); -} - -void Module1300::createScene1311(int which) { - _vm->gameState().sceneNum = 10; - // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0); - // TODO Music18hList_stop(0x203197, 0, 2); - createSmackerScene(0x20082828, true, true, false); - SetUpdateHandler(&Module1300::updateScene1310); -} - -void Module1300::createScene1312(int which) { - _vm->gameState().sceneNum = 11; - createNavigationScene(0x004B27A8, which); - SetUpdateHandler(&Module1300::updateScene1312); - // TODO Sound1ChList_setSoundValuesMulti(0xdword_4B2868, true, 0, 0, 0, 0); - // TODO Music18hList_stop(0x203197, 0, 2); -} - -void Module1300::createScene1313(int which) { - _vm->gameState().sceneNum = 12; - createNavigationScene(0x004B2718, which); - SetUpdateHandler(&Module1300::updateScene1313); - // TODO Sound1ChList_setSoundValuesMulti(0xdword_4B2868, true, 0, 0, 0, 0); - // TODO Music18hList_stop(0x203197, 0, 2); -} - -void Module1300::createScene1314(int which) { - _vm->gameState().sceneNum = 13; - createNavigationScene(0x004B27D8, which); - SetUpdateHandler(&Module1300::updateScene1314); - // TODO Sound1ChList_setSoundValuesMulti(0xdword_4B2868, true, 0, 0, 0, 0); - // TODO Music18hList_stop(0x203197, 0, 2); -} - -void Module1300::createScene1315(int which) { - _vm->gameState().sceneNum = 14; - createNavigationScene(0x004B2808, which); - SetUpdateHandler(&Module1300::updateScene1315); - // TODO Sound1ChList_setSoundValuesMulti(0xdword_4B2868, true, 0, 0, 0, 0); - // TODO Music18hList_stop(0x203197, 0, 2); -} - -void Module1300::createScene1316(int which) { - _vm->gameState().sceneNum = 15; - createNavigationScene(0x004B2838, which); - SetUpdateHandler(&Module1300::updateScene1316); - // TODO Sound1ChList_setSoundValuesMulti(0xdword_4B2868, true, 0, 0, 0, 0); - // TODO Music18hList_stop(0x203197, 0, 2); -} - -void Module1300::createScene1317(int which) { - _vm->gameState().sceneNum = 16; - // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0); - // TODO Music18hList_stop(0x203197, 0, 2); - _childObject = new Scene1317(_vm, this, which); - SetUpdateHandler(&Module1300::updateScene1317); -} - -void Module1300::createScene1318(int which) { - // TODO: Credits scene -} - -void Module1300::updateScene1302() { - if (!updateChild()) { - if (_moduleResult == 1) { - createScene1305(0); - } else { - createScene1308(1); - } - _childObject->handleUpdate(); - } -} - -void Module1300::updateScene1303() { - if (!updateChild()) { - createScene1306(3); - _childObject->handleUpdate(); - } -} - -void Module1300::updateScene1304() { - if (!updateChild()) { - createScene1316(0); - _childObject->handleUpdate(); - } -} - -void Module1300::updateScene1305() { - if (!updateChild()) { - createScene1317(-1); - _childObject->handleUpdate(); - } -} - -void Module1300::updateScene1306() { - if (!updateChild()) { - if (_moduleResult == 2) { - createScene1309(0); - _childObject->handleUpdate(); - } else if (_moduleResult == 3) { - createScene1303(0); - _childObject->handleUpdate(); - } else if (_moduleResult == 0) { - sendMessage(_parentModule, 0x1009, 0); - } else if (_moduleResult == 1) { - createScene1311(-1); - _childObject->handleUpdate(); - } - } -} - -void Module1300::updateScene1307() { - if (!updateChild()) { - createScene1308(2); - _childObject->handleUpdate(); - } -} - -void Module1300::updateScene1308() { - if (!updateChild()) { - if (_moduleResult == 0) { - createScene1314(0); - } else if (_moduleResult == 1) { - createScene1302(0); - } else if (_moduleResult == 2) { - createScene1307(0); - } - _childObject->handleUpdate(); - } -} - -void Module1300::updateScene1309() { - if (!updateChild()) { - createScene1306(2); - _childObject->handleUpdate(); - } -} - -void Module1300::updateScene1310() { - if (!updateChild()) { - if (_vm->gameState().sceneNum == 9) - createScene1306(0); - else - createScene1315(0); - _childObject->handleUpdate(); - } -} - -void Module1300::updateScene1311() { -} - -void Module1300::updateScene1312() { - if (!updateChild()) { - if (_moduleResult == 0) { - createScene1313(0); - } else if (_moduleResult == 1) { - createScene1312(1); - } - _childObject->handleUpdate(); - } -} - -void Module1300::updateScene1313() { - if (!updateChild()) { - switch (_moduleResult) { - case 0: - createScene1315(1); + case 13: + if (_moduleResult == 0) { + createScene(12, 2); + } else if (_moduleResult == 1) { + createScene(7, 0); + } break; - case 1: - createScene1316(1); + case 14: + if (_moduleResult == 0) { + createScene(12, 3); + } else if (_moduleResult == 1) { + createScene(9, -1); + } break; - case 3: - createScene1312(1); + case 15: + if (_moduleResult == 0) { + createScene(12, 4); + } else if (_moduleResult == 1) { + createScene(3, 0); + } break; - case 5: - createScene1314(1); + case 16: + createScene(17, -1); + break; + case 17: + // TODO break; } - _childObject->handleUpdate(); - } -} - -void Module1300::updateScene1314() { - if (!updateChild()) { - if (_moduleResult == 0) { - createScene1313(2); - } else if (_moduleResult == 1) { - createScene1308(0); - } - _childObject->handleUpdate(); - } -} - -void Module1300::updateScene1315() { - if (!updateChild()) { - if (_moduleResult == 0) { - createScene1313(3); - } else if (_moduleResult == 1) { - createScene1310(-1); - } - _childObject->handleUpdate(); - } -} - -void Module1300::updateScene1316() { - if (!updateChild()) { - if (_moduleResult == 0) { - createScene1313(4); - } else if (_moduleResult == 1) { - createScene1304(0); - } - _childObject->handleUpdate(); - } -} - -void Module1300::updateScene1317() { - if (!updateChild()) { - createScene1318(-1); - _childObject->handleUpdate(); } } -void Module1300::updateScene1318() { -} - AsScene1302Bridge::AsScene1302Bridge(NeverhoodEngine *vm, Scene *parentScene) : AnimatedSprite(vm, 1100), _soundResource1(vm), _soundResource2(vm), _parentScene(parentScene) { diff --git a/engines/neverhood/module1300.h b/engines/neverhood/module1300.h index 0e9837cc96..27e2540407 100644 --- a/engines/neverhood/module1300.h +++ b/engines/neverhood/module1300.h @@ -38,40 +38,8 @@ public: virtual ~Module1300(); protected: uint32 _musicFileHash; - void createScene1302(int which); - void createScene1303(int which); - void createScene1304(int which); - void createScene1305(int which); - void createScene1306(int which); - void createScene1307(int which); - void createScene1308(int which); - void createScene1309(int which); - void createScene1310(int which); - void createScene1311(int which); - void createScene1312(int which); - void createScene1313(int which); - void createScene1314(int which); - void createScene1315(int which); - void createScene1316(int which); - void createScene1317(int which); - void createScene1318(int which); - void updateScene1302(); - void updateScene1303(); - void updateScene1304(); - void updateScene1305(); - void updateScene1306(); - void updateScene1307(); - void updateScene1308(); - void updateScene1309(); - void updateScene1310(); - void updateScene1311(); - void updateScene1312(); - void updateScene1313(); - void updateScene1314(); - void updateScene1315(); - void updateScene1316(); - void updateScene1317(); - void updateScene1318(); + void createScene(int sceneNum, int which); + void updateScene(); }; class AsScene1302Bridge : public AnimatedSprite { diff --git a/engines/neverhood/module1400.cpp b/engines/neverhood/module1400.cpp index d59cbd8812..32918b1424 100644 --- a/engines/neverhood/module1400.cpp +++ b/engines/neverhood/module1400.cpp @@ -31,36 +31,13 @@ namespace Neverhood { Module1400::Module1400(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule) { - debug("Create Module1400(%d)", which); - // TODO Music18hList_add(0x00AD0012, 0x06333232); // TODO Music18hList_add(0x00AD0012, 0x624A220E); if (which < 0) { - switch (_vm->gameState().sceneNum) { - case 1: - createScene1402(-1); - break; - case 2: - createScene1403(-1); - break; - case 3: - createScene1404(-1); - break; - case 4: - createScene1405(-1); - break; - case 5: - createScene1406(-1); - break; - case 6: - createScene1407(-1); - break; - default: - createScene1401(-1); - } + createScene(_vm->gameState().sceneNum, -1); } else { - createScene1401(0); + createScene(0, 0); } } @@ -69,129 +46,91 @@ Module1400::~Module1400() { // TODO Music18hList_deleteGroup(0x00AD0012); } -void Module1400::createScene1401(int which) { - _vm->gameState().sceneNum = 0; - // TODO Music18hList_play(0x06333232, 0, 2, 1); - _childObject = new Scene1401(_vm, this, which); - SetUpdateHandler(&Module1400::updateScene1401); -} - -void Module1400::createScene1402(int which) { - _vm->gameState().sceneNum = 1; - // TODO Music18hList_stop(0x06333232, 0, 2); - // TODO Music18hList_stop(0x624A220E, 0, 2); - _childObject = new Scene1402(_vm, this, which); - SetUpdateHandler(&Module1400::updateScene1402); -} - -void Module1400::createScene1403(int which) { - _vm->gameState().sceneNum = 2; - // TODO Music18hList_stop(0x06333232, 0, 2); - // TODO Music18hList_play(0x624A220E, 0, 2, 1); - _childObject = new Scene1403(_vm, this, which); - SetUpdateHandler(&Module1400::updateScene1403); -} - -void Module1400::createScene1404(int which) { - _vm->gameState().sceneNum = 3; - // TODO Music18hList_play(0x06333232, 0, 2, 1); - _childObject = new Scene1404(_vm, this, which); - SetUpdateHandler(&Module1400::updateScene1404); -} - -void Module1400::createScene1405(int which) { - _vm->gameState().sceneNum = 4; - // TODO Music18hList_play(0x06333232, 0, 2, 1); - _childObject = new Scene1405(_vm, this, which); - SetUpdateHandler(&Module1400::updateScene1405); -} - -void Module1400::createScene1406(int which) { - _vm->gameState().sceneNum = 5; - // TODO Music18hList_stop(0x06333232, 0, 2); - _childObject = new DiskplayerScene(_vm, this, 2); - SetUpdateHandler(&Module1400::updateScene1406); -} - -void Module1400::createScene1407(int which) { - _vm->gameState().sceneNum = 6; - // TODO Music18hList_stop(0x06333232, 0, 2); - _childObject = new Scene1407(_vm, this, which); - SetUpdateHandler(&Module1400::updateScene1407); -} - -void Module1400::updateScene1401() { - if (!updateChild()) { - if (_moduleResult == 1) { - createScene1402(0); - _childObject->handleUpdate(); - } else if (_moduleResult == 2) { - createScene1404(0); - _childObject->handleUpdate(); - } else { - sendMessage(_parentModule, 0x1009, 0); - } - } -} - -void Module1400::updateScene1402() { - if (!updateChild()) { - if (_moduleResult == 1) { - createScene1403(0); - _childObject->handleUpdate(); - } else if (_moduleResult == 2) { - createScene1407(-1); - _childObject->handleUpdate(); - } else { - createScene1401(1); - _childObject->handleUpdate(); - } - } -} - -void Module1400::updateScene1403() { - if (!updateChild()) { - createScene1402(1); - _childObject->handleUpdate(); +void Module1400::createScene(int sceneNum, int which) { + debug("Module1400::createScene(%d, %d)", sceneNum, which); + _vm->gameState().sceneNum = sceneNum; + switch (_vm->gameState().sceneNum) { + case 0: + // TODO Music18hList_play(0x06333232, 0, 2, 1); + _childObject = new Scene1401(_vm, this, which); + break; + case 1: + // TODO Music18hList_stop(0x06333232, 0, 2); + // TODO Music18hList_stop(0x624A220E, 0, 2); + _childObject = new Scene1402(_vm, this, which); + break; + case 2: + // TODO Music18hList_stop(0x06333232, 0, 2); + // TODO Music18hList_play(0x624A220E, 0, 2, 1); + _childObject = new Scene1403(_vm, this, which); + break; + case 3: + // TODO Music18hList_play(0x06333232, 0, 2, 1); + _childObject = new Scene1404(_vm, this, which); + break; + case 4: + // TODO Music18hList_play(0x06333232, 0, 2, 1); + _childObject = new Scene1405(_vm, this, which); + break; + case 5: + // TODO Music18hList_stop(0x06333232, 0, 2); + _childObject = new DiskplayerScene(_vm, this, 2); + break; + case 6: + // TODO Music18hList_stop(0x06333232, 0, 2); + _childObject = new Scene1407(_vm, this, which); + break; } + SetUpdateHandler(&Module1400::updateScene); + _childObject->handleUpdate(); } -void Module1400::updateScene1404() { +void Module1400::updateScene() { if (!updateChild()) { - if (_moduleResult == 1) { - createScene1405(0); - _childObject->handleUpdate(); - } else if (_moduleResult == 2) { - createScene1406(-1); - _childObject->handleUpdate(); - } else { - createScene1401(2); - _childObject->handleUpdate(); + switch (_vm->gameState().sceneNum) { + case 0: + if (_moduleResult == 1) { + createScene(1, 0); + } else if (_moduleResult == 2) { + createScene(3, 0); + } else { + sendMessage(_parentModule, 0x1009, 0); + } + break; + case 1: + if (_moduleResult == 1) { + createScene(2, 0); + } else if (_moduleResult == 2) { + createScene(6, -1); + } else { + createScene(0, 1); + } + break; + case 2: + createScene(1, 1); + break; + case 3: + if (_moduleResult == 1) { + createScene(4, 0); + } else if (_moduleResult == 2) { + createScene(5, -1); + } else { + createScene(0, 2); + } + break; + case 4: + createScene(3, 1); + break; + case 5: + createScene(3, 2); + break; + case 6: + createScene(1, 2); + break; } } } -void Module1400::updateScene1405() { - if (!updateChild()) { - createScene1404(1); - _childObject->handleUpdate(); - } -} - -void Module1400::updateScene1406() { - if (!updateChild()) { - createScene1404(2); - _childObject->handleUpdate(); - } -} - -void Module1400::updateScene1407() { - if (!updateChild()) { - createScene1402(2); - _childObject->handleUpdate(); - } -} - // Scene1401 Class525::Class525(NeverhoodEngine *vm) diff --git a/engines/neverhood/module1400.h b/engines/neverhood/module1400.h index 72afb4f15a..7b4d95761b 100644 --- a/engines/neverhood/module1400.h +++ b/engines/neverhood/module1400.h @@ -35,20 +35,8 @@ public: Module1400(NeverhoodEngine *vm, Module *parentModule, int which); virtual ~Module1400(); protected: - void createScene1401(int which); - void createScene1402(int which); - void createScene1403(int which); - void createScene1404(int which); - void createScene1405(int which); - void createScene1406(int which); - void createScene1407(int which); - void updateScene1401(); - void updateScene1402(); - void updateScene1403(); - void updateScene1404(); - void updateScene1405(); - void updateScene1406(); - void updateScene1407(); + void createScene(int sceneNum, int which); + void updateScene(); }; // Scene1401 diff --git a/engines/neverhood/module1500.cpp b/engines/neverhood/module1500.cpp index 7c03e9b941..09567f5392 100644 --- a/engines/neverhood/module1500.cpp +++ b/engines/neverhood/module1500.cpp @@ -27,43 +27,51 @@ namespace Neverhood { Module1500::Module1500(NeverhoodEngine *vm, Module *parentModule, int which, bool flag) : Module(vm, parentModule), _flag(flag) { - debug("Create Module1500(%d)", which); - if (which < 0) { - switch (_vm->gameState().sceneNum) { - case 1: - createScene1502(); - break; - case 2: - createScene1503(); - break; - case 3: - createScene1504(); - break; - default: - createScene1501(); - } + createScene(_vm->gameState().sceneNum, -1); } else { - createScene1504(); + createScene(3, -1); } } -void Module1500::update() { +void Module1500::createScene(int sceneNum, int which) { + debug("Module1500::createScene(%d, %d)", sceneNum, which); + _vm->gameState().sceneNum = sceneNum; + switch (_vm->gameState().sceneNum) { + case 0: + _childObject = new Scene1501(_vm, this, 0x8420221D, 0xA61024C4, 150, 48); + break; + case 1: + _childObject = new Scene1501(_vm, this, 0x30050A0A, 0x58B45E58, 110, 48); + break; + case 2: + sendMessage(_parentModule, 0x0800, 0); + createSmackerScene(0x001A0005, true, true, true); + break; + case 3: + _childObject = new Scene1501(_vm, this, 0x0CA04202, 0, 110, 48); + break; + } + SetUpdateHandler(&Module1500::updateScene); + _childObject->handleUpdate(); +} + +void Module1500::updateScene() { if (!updateChild()) { switch (_vm->gameState().sceneNum) { case 0: - createScene1502(); + createScene(1, -1); break; case 1: if (_flag) { - createScene1503(); + createScene(2, -1); } else { sendMessage(_parentModule, 0x1009, 0); } break; case 3: - createScene1501(); + createScene(0, -1); break; default: sendMessage(_parentModule, 0x1009, 0); @@ -72,40 +80,12 @@ void Module1500::update() { } } -void Module1500::createScene1501() { - _vm->gameState().sceneNum = 0; - _childObject = new Scene1501(_vm, this, 0x8420221D, 0xA61024C4, 150, 48); - SetUpdateHandler(&Module1500::update); -} - -void Module1500::createScene1502() { - debug("createScene1502"); - _vm->gameState().sceneNum = 1; - _childObject = new Scene1501(_vm, this, 0x30050A0A, 0x58B45E58, 110, 48); - SetUpdateHandler(&Module1500::update); -} - -void Module1500::createScene1503() { - sendMessage(_parentModule, 0x0800, 0); - _vm->gameState().sceneNum = 2; - createSmackerScene(0x001A0005, true, true, true); - SetUpdateHandler(&Module1500::update); -} - -void Module1500::createScene1504() { - _vm->gameState().sceneNum = 3; - _childObject = new Scene1501(_vm, this, 0x0CA04202, 0, 110, 48); - SetUpdateHandler(&Module1500::update); -} - // Scene1501 Scene1501::Scene1501(NeverhoodEngine *vm, Module *parentModule, uint32 backgroundFileHash, uint32 soundFileHash, int countdown2, int countdown3) : Scene(vm, parentModule, true), _soundResource(vm), _countdown3(countdown3), _countdown2(countdown2), _countdown1(0), _flag(false) { - debug("Create Scene1501(%08X, %08X, %d, %d)", backgroundFileHash, soundFileHash, countdown2, countdown3); - SetUpdateHandler(&Scene1501::update); SetMessageHandler(&Scene1501::handleMessage); diff --git a/engines/neverhood/module1500.h b/engines/neverhood/module1500.h index 87b2a0b9ae..eeabec0618 100644 --- a/engines/neverhood/module1500.h +++ b/engines/neverhood/module1500.h @@ -37,11 +37,8 @@ public: Module1500(NeverhoodEngine *vm, Module *parentModule, int which, bool flag); protected: bool _flag; - void update(); - void createScene1501(); - void createScene1502(); - void createScene1503(); - void createScene1504(); + void createScene(int sceneNum, int which); + void updateScene(); }; class Scene1501 : public Scene { diff --git a/engines/neverhood/module1700.cpp b/engines/neverhood/module1700.cpp index 2b0f25d163..9188dab2b0 100644 --- a/engines/neverhood/module1700.cpp +++ b/engines/neverhood/module1700.cpp @@ -27,36 +27,19 @@ namespace Neverhood { Module1700::Module1700(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule), _soundResource(vm) { - debug("Create Module1700(%d)", which); - // TODO Music18hList_add(0x04212331); // TODO Sound1ChList_addSoundResources(0x04212331, dword_4AE930, true); // TODO Sound1ChList_setSoundValuesMulti(dword_4AE930, 1, 50, 600, 5, 150); // TODO Sound1ChList_sub_407C70(0x04212331, 0x41861371, 0x43A2507F, 0); if (which < 0) { - switch (_vm->gameState().sceneNum) { - case 0: - createScene1701(-1); - break; - case 1: - createScene1702(-1); - break; - case 2: - createScene1703(-1); - break; - case 3: - createScene1704(-1); - break; - default: - createScene1705(-1); - } + createScene(_vm->gameState().sceneNum, -1); } else if (which == 0) { - createScene1701(-1); + createScene(0, -1); } else if (which == 1) { - createScene1705(1); + createScene(4, 1); } else { - createScene1705(3); + createScene(4, 3); } } @@ -65,90 +48,71 @@ Module1700::~Module1700() { // TODO Sound1ChList_sub_407A50(0x04212331); } -void Module1700::createScene1701(int which) { - _vm->gameState().sceneNum = 0; - // TODO Sound1ChList_setSoundValuesMulti(dword_4AE930, 0, 0, 0, 0, 0); - createSmackerScene(0x3028A005, true, true, false); - SetUpdateHandler(&Module1700::updateScene1701); -} - -void Module1700::createScene1702(int which) { - _vm->gameState().sceneNum = 1; - createNavigationScene(0x004AE8B8, which); - SetUpdateHandler(&Module1700::updateScene1702); -} - -void Module1700::createScene1703(int which) { - _vm->gameState().sceneNum = 2; - createNavigationScene(0x004AE8E8, which); - SetUpdateHandler(&Module1700::updateScene1703); -} - -void Module1700::createScene1704(int which) { - _vm->gameState().sceneNum = 3; - // TODO Sound1ChList_setSoundValuesMulti(dword_4AE930, 0, 0, 0, 0, 0); - createSmackerScene(0x01190041, true, true, false); - SetUpdateHandler(&Module1700::updateScene1701); -} - -void Module1700::createScene1705(int which) { - _vm->gameState().sceneNum = 4; - // TODO Sound1ChList_setSoundValuesMulti(dword_4AE930, 0, 0, 0, 0, 0); - // TODO Music18hList_play(0x31114225, 0, 2, 1); - _childObject = new Scene1705(_vm, this, which); - SetUpdateHandler(&Module1700::updateScene1705); -} - -void Module1700::updateScene1701() { - if (!updateChild()) { - if (_vm->gameState().sceneNum == 3) { - createScene1705(0); - _childObject->handleUpdate(); - } else { - // TODO Sound1ChList_setSoundValuesMulti(dword_4AE930, 1, 0, 0, 0); - createScene1702(0); - _childObject->handleUpdate(); - } - } -} - -void Module1700::updateScene1702() { - if (!updateChild()) { - if (_moduleResult == 0) { - createScene1703(0); - _childObject->handleUpdate(); - } else if (_moduleResult == 1) { - createScene1702(1); - _childObject->handleUpdate(); - } +void Module1700::createScene(int sceneNum, int which) { + debug("Module1700::createScene(%d, %d)", sceneNum, which); + _vm->gameState().sceneNum = sceneNum; + switch (_vm->gameState().sceneNum) { + case 0: + // TODO Sound1ChList_setSoundValuesMulti(dword_4AE930, 0, 0, 0, 0, 0); + createSmackerScene(0x3028A005, true, true, false); + break; + case 1: + createNavigationScene(0x004AE8B8, which); + break; + case 2: + createNavigationScene(0x004AE8E8, which); + break; + case 3: + // TODO Sound1ChList_setSoundValuesMulti(dword_4AE930, 0, 0, 0, 0, 0); + createSmackerScene(0x01190041, true, true, false); + break; + case 4: + // TODO Sound1ChList_setSoundValuesMulti(dword_4AE930, 0, 0, 0, 0, 0); + // TODO Music18hList_play(0x31114225, 0, 2, 1); + _childObject = new Scene1705(_vm, this, which); + break; } + SetUpdateHandler(&Module1700::updateScene); + _childObject->handleUpdate(); } -void Module1700::updateScene1703() { +void Module1700::updateScene() { if (!updateChild()) { - if (_moduleResult == 0) { - createScene1704(-1); - _childObject->handleUpdate(); - } else if (_moduleResult == 1) { - createScene1702(1); - _childObject->handleUpdate(); - } else if (_moduleResult == 2) { - if (!_soundResource.isPlaying()) { - // TODO _soundResource.setVolume(60); - _soundResource.play(0x58B45E58); + switch (_vm->gameState().sceneNum) { + case 0: + // TODO Sound1ChList_setSoundValuesMulti(dword_4AE930, 1, 0, 0, 0); + createScene(1, 0); + break; + case 1: + if (_moduleResult == 0) { + createScene(2, 0); + } else if (_moduleResult == 1) { + createScene(1, 1); + } + break; + case 2: + if (_moduleResult == 0) { + createScene(3, -1); + } else if (_moduleResult == 1) { + createScene(1, 1); + } else if (_moduleResult == 2) { + if (!_soundResource.isPlaying()) { + // TODO _soundResource.setVolume(60); + _soundResource.play(0x58B45E58); + } + createScene(2, 2); } - createScene1703(2); - _childObject->handleUpdate(); + break; + case 3: + createScene(4, 0); + break; + case 4: + sendMessage(_parentModule, 0x1009, 1); + break; } } } - -void Module1700::updateScene1705() { - if (!updateChild()) { - sendMessage(_parentModule, 0x1009, 1); - } -} - + // Scene1705 static const uint32 kScene1705FileHashes[] = { diff --git a/engines/neverhood/module1700.h b/engines/neverhood/module1700.h index 0fefa72122..f7388484b2 100644 --- a/engines/neverhood/module1700.h +++ b/engines/neverhood/module1700.h @@ -36,16 +36,8 @@ public: virtual ~Module1700(); protected: SoundResource _soundResource; - void update(); - void createScene1701(int which); - void createScene1702(int which); - void createScene1703(int which); - void createScene1704(int which); - void createScene1705(int which); - void updateScene1701(); - void updateScene1702(); - void updateScene1703(); - void updateScene1705(); + void createScene(int sceneNum, int which); + void updateScene(); }; // Scene1705 diff --git a/engines/neverhood/module1800.cpp b/engines/neverhood/module1800.cpp index 31a156461d..d5aa789cbf 100644 --- a/engines/neverhood/module1800.cpp +++ b/engines/neverhood/module1800.cpp @@ -28,218 +28,143 @@ namespace Neverhood { Module1800::Module1800(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule) { - debug("Create Module1800(%d)", which); - // TODO Sound1ChList_addSoundResources(0x04A14718, dword_4AFE70); // TODO Sound1ChList_setSoundValuesMulti(dword_4AFE70, 1, 50, 600, 10, 150); // TODO Sound1ChList_sub_407C70(0x04A14718, 0x8A382B55, 0x0C242F1D, 0); if (which < 0) { + createScene(_vm->gameState().sceneNum, -1); + } else if (which == 2) { + createScene(5, 0); + } else if (which == 3) { + createScene(0, 0); + } else { + createScene(3, 1); + } + +} + +Module1800::~Module1800() { + // TODO Sound1ChList_sub_407A50(0x04A14718); +} + +void Module1800::createScene(int sceneNum, int which) { + static const byte kNavigationTypes00[] = {1, 0, 2, 0}; + static const byte kNavigationTypes01[] = {5}; + debug("Module1800::createScene(%d, %d)", sceneNum, which); + _vm->gameState().sceneNum = sceneNum; + switch (_vm->gameState().sceneNum) { + case 0: + createNavigationScene(0x004AFD38, which, kNavigationTypes00); + break; + case 1: + createNavigationScene(0x004AFD98, which, kNavigationTypes01); + break; + case 2: + createSmackerScene(0x006C0085, true, true, false); + break; + case 3: + createNavigationScene(0x004AFDB0, which); + break; + case 4: + createNavigationScene(0x004AFDE0, which); + break; + case 5: + createNavigationScene(0x004AFE40, which); + break; + case 6: + // TODO Sound1ChList_sub_407A50(0x04A14718); + createSmackerScene(0x08D84010, true, true, false); + break; + case 7: + // TODO Sound1ChList_setSoundValuesMulti(dword_4AFE70, 0, 0, 0, 0, 0); + createSmackerScene(0x0168B121, true, true, false); + break; + case 8: + // TODO _childObject = new CreditsScene(_vm, this, 0); + break; + case 9: + // NOTE: Newly introduced sceneNum 9 (was duplicate 3 with own update handler) + createSmackerScene(0x0A840C01, true, true, false); + break; + } + SetUpdateHandler(&Module1800::updateScene); + _childObject->handleUpdate(); +} + +void Module1800::updateScene() { + if (!updateChild()) { switch (_vm->gameState().sceneNum) { case 0: - createScene1801(-1); + if (_moduleResult == 1) { + createScene(4, 0); + } else if (_moduleResult == 2) { + createScene(1, -1); + } else if (_moduleResult == 3) { + createScene(3, 0); + } break; case 1: - createScene1802(-1); + if (_navigationAreaType == 3) { + createScene(7, -1); + } else { + createScene(2, -1); + } break; case 2: - createScene1803(-1); + createScene(0, 2); break; - default: case 3: - createScene1804(-1); + if (_moduleResult == 0) { + createScene(9, -1); + } else if (_moduleResult == 1) { + createScene(0, 1); + } break; case 4: - createScene1805(-1); + if (_moduleResult == 0) { + createScene(6, -1); + } else if (_moduleResult == 1) { + createScene(5, 0); + } else if (_moduleResult == 2) { + createScene(0, 3); + } else if (_moduleResult == 3) { + createScene(4, 3); + } break; case 5: - createScene1806(-1); + if (_moduleResult == 0) { + sendMessage(_parentModule, 0x1009, 2); + } else if (_moduleResult == 1) { + createScene(4, 3); + } break; case 6: - createScene1807(-1); + createScene(8, -1); break; case 7: - createScene1808(-1); + sendMessage(_parentModule, 0x1009, 3); break; case 8: - createScene1809(-1); + sendMessage(_parentModule, 0x1009, 1); + // TODO GameState stuff + break; + case 9: + sendMessage(_parentModule, 0x1009, 0); break; - } - } else if (which == 2) { - createScene1806(0); - } else if (which == 3) { - createScene1801(0); - } else { - createScene1804(1); - } - -} - -Module1800::~Module1800() { - // TODO Sound1ChList_sub_407A50(0x04A14718); -} - -void Module1800::createScene1801(int which) { - static const byte kNavigationTypes[] = {1, 0, 2, 0}; - _vm->gameState().sceneNum = 0; - createNavigationScene(0x004AFD38, which, kNavigationTypes); - SetUpdateHandler(&Module1800::updateScene1801); -} - -void Module1800::createScene1802(int which) { - static const byte kNavigationTypes[] = {5}; - _vm->gameState().sceneNum = 1; - createNavigationScene(0x004AFD98, which, kNavigationTypes); - SetUpdateHandler(&Module1800::updateScene1802); -} - -void Module1800::createScene1803(int which) { - _vm->gameState().sceneNum = 2; - createSmackerScene(0x006C0085, true, true, false); - SetUpdateHandler(&Module1800::updateScene1803); -} - -void Module1800::createScene1804(int which) { - _vm->gameState().sceneNum = 3; - createNavigationScene(0x004AFDB0, which); - SetUpdateHandler(&Module1800::updateScene1804); -} - -void Module1800::createScene1804b(int which) { - _vm->gameState().sceneNum = 3; - createSmackerScene(0x0A840C01, true, true, false); - SetUpdateHandler(&Module1800::updateScene1803); -} - -void Module1800::createScene1805(int which) { - _vm->gameState().sceneNum = 4; - createNavigationScene(0x004AFDE0, which); - SetUpdateHandler(&Module1800::updateScene1805); -} - -void Module1800::createScene1806(int which) { - _vm->gameState().sceneNum = 5; - createNavigationScene(0x004AFE40, which); - SetUpdateHandler(&Module1800::updateScene1806); -} - -void Module1800::createScene1807(int which) { - _vm->gameState().sceneNum = 6; - createSmackerScene(0x08D84010, true, true, false); - SetUpdateHandler(&Module1800::updateScene1803); - // TODO Sound1ChList_sub_407A50(0x04A14718); -} - -void Module1800::createScene1808(int which) { - _vm->gameState().sceneNum = 7; - // TODO Sound1ChList_setSoundValuesMulti(dword_4AFE70, 0, 0, 0, 0, 0); - createSmackerScene(0x0168B121, true, true, false); - SetUpdateHandler(&Module1800::updateScene1803); -} - -void Module1800::createScene1809(int which) { -#if 0 // TODO - _vm->gameState().sceneNum = 8; - _childObject = new CreditsScene(_vm, this, 0); - SetUpdateHandler(&Module1800::updateScene1809); -#endif -} - -void Module1800::updateScene1801() { - if (!updateChild()) { - if (_moduleResult == 1) { - createScene1805(0); - _childObject->handleUpdate(); - } else if (_moduleResult == 2) { - createScene1802(-1); - _childObject->handleUpdate(); - } else if (_moduleResult == 3) { - createScene1804(0); - _childObject->handleUpdate(); } } else { + switch (_vm->gameState().sceneNum) { + case 0: #if 0 // TODO - NavigationScene *navigationScene = (NavigationScene*)_childObject; - if (navigationScene->soundFlag1 && navigationScene->index == 2) { - // TODO Sound1ChList_sub_4080B0(false); - } + NavigationScene *navigationScene = (NavigationScene*)_childObject; + if (navigationScene->soundFlag1 && navigationScene->index == 2) { + // TODO Sound1ChList_sub_4080B0(false); + } #endif - } -} - -void Module1800::updateScene1802() { - _childObject->handleUpdate(); - if (_done) { - int areaType = navigationScene()->getNavigationAreaType(); - _done = false; - delete _childObject; - _childObject = NULL; - if (areaType == 3) { - createScene1808(-1); - } else { - createScene1803(-1); - } - _childObject->handleUpdate(); - } -} - -void Module1800::updateScene1803() { - if (!updateChild()) { - if (_moduleResult == 2) { - createScene1801(2); - _childObject->handleUpdate(); - } else if (_moduleResult == 3) { - sendMessage(_parentModule, 0x1009, 0); - } else if (_moduleResult == 6) { - createScene1809(-1); - _childObject->handleUpdate(); - } else if (_moduleResult == 7) { - sendMessage(_parentModule, 0x1009, 3); - } - } -} - -void Module1800::updateScene1804() { - if (!updateChild()) { - if (_moduleResult == 0) { - createScene1804b(-1); - } else if (_moduleResult == 1) { - createScene1801(1); - } - _childObject->handleUpdate(); - } -} - -void Module1800::updateScene1805() { - if (!updateChild()) { - if (_moduleResult == 0) { - createScene1807(-1); - } else if (_moduleResult == 1) { - createScene1806(0); - } else if (_moduleResult == 2) { - createScene1801(3); - } else if (_moduleResult == 3) { - createScene1805(3); - } - _childObject->handleUpdate(); - } -} - -void Module1800::updateScene1806() { - if (!updateChild()) { - if (_moduleResult == 0) { - sendMessage(_parentModule, 0x1009, 2); - } else if (_moduleResult == 1) { - createScene1805(3); - _childObject->handleUpdate(); + break; } } } - -void Module1800::updateScene1809() { - if (!updateChild()) { - sendMessage(_parentModule, 0x1009, 1); - // TODO GameState stuff - } -} + } // End of namespace Neverhood diff --git a/engines/neverhood/module1800.h b/engines/neverhood/module1800.h index 13d4790a8c..8ec8dfecea 100644 --- a/engines/neverhood/module1800.h +++ b/engines/neverhood/module1800.h @@ -36,26 +36,8 @@ public: Module1800(NeverhoodEngine *vm, Module *parentModule, int which); virtual ~Module1800(); protected: - // TODO ResourceTable _resourceTable; - void createScene1801(int which); - void createScene1802(int which); - void createScene1803(int which); - void createScene1804(int which); - void createScene1804b(int which); - void createScene1805(int which); - void createScene1806(int which); - void createScene1807(int which); - void createScene1808(int which); - void createScene1809(int which); - void updateScene1801(); - void updateScene1802(); - void updateScene1803(); - void updateScene1804(); - void updateScene1805(); - void updateScene1806(); - void updateScene1807(); - void updateScene1808(); - void updateScene1809(); + void createScene(int sceneNum, int which); + void updateScene(); }; } // End of namespace Neverhood diff --git a/engines/neverhood/module2000.cpp b/engines/neverhood/module2000.cpp index cf7256bce8..a30bb93541 100644 --- a/engines/neverhood/module2000.cpp +++ b/engines/neverhood/module2000.cpp @@ -29,24 +29,12 @@ namespace Neverhood { Module2000::Module2000(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule) { - debug("Create Module2000(%d)", which); - if (which < 0) { - switch (_vm->gameState().sceneNum) { - case 0: - createScene2001(-1); - break; - case 2: - createScene2003(-1); - break; - default: - createScene2002(-1); - break; - } + createScene(_vm->gameState().sceneNum, -1); } else if (which == 0) { - createScene2001(3); + createScene(0, 3); } else if (which == 1) { - createScene2001(1); + createScene(0, 1); } } @@ -55,65 +43,56 @@ Module2000::~Module2000() { // TODO Sound1ChList_sub_407A50(0x81293110); } -void Module2000::createScene2001(int which) { - _vm->gameState().sceneNum = 0; - _childObject = new Scene2001(_vm, this, which); - SetUpdateHandler(&Module2000::updateScene2001); - _childObject->handleUpdate(); -} - -void Module2000::createScene2002(int which) { - _vm->gameState().sceneNum = 1; - if (getGlobalVar(0x98109F12)) { - createNavigationScene(0x004B7B48, which); - } else { - createNavigationScene(0x004B7B00, which); +void Module2000::createScene(int sceneNum, int which) { + debug("Module2000::createScene(%d, %d)", sceneNum, which); + _vm->gameState().sceneNum = sceneNum; + switch (_vm->gameState().sceneNum) { + case 0: + _childObject = new Scene2001(_vm, this, which); + break; + case 1: + createNavigationScene(getGlobalVar(0x98109F12) ? 0x004B7B48 : 0x004B7B00, which); + break; + case 2: + setGlobalVar(0x98109F12, 1); + setSubVar(0x2C145A98, 1, 1); + createSmackerScene(0x204B2031, true, true, false); + break; } - SetUpdateHandler(&Module2000::updateScene2002); + SetUpdateHandler(&Module2000::updateScene); _childObject->handleUpdate(); } -void Module2000::createScene2003(int which) { - _vm->gameState().sceneNum = 2; - setGlobalVar(0x98109F12, 1); - setSubVar(0x2C145A98, 1, 1); - createSmackerScene(0x204B2031, true, true, false); - SetUpdateHandler(&Module2000::updateScene2003); - _childObject->handleUpdate(); -} - -void Module2000::updateScene2001() { - if (!updateChild()) { - if (_moduleResult == 1) { - sendMessage(_parentModule, 0x1009, 0); - } else { - createScene2002(0); - } - } -} - -void Module2000::updateScene2002() { +void Module2000::updateScene() { if (!updateChild()) { - if (_moduleResult == 0) { - if (getGlobalVar(0x98109F12)) { - createScene2002(0); + switch (_vm->gameState().sceneNum) { + case 0: + if (_moduleResult == 1) { + sendMessage(_parentModule, 0x1009, 0); } else { - createScene2003(-1); + createScene(1, 0); + } + break; + case 1: + if (_moduleResult == 0) { + if (getGlobalVar(0x98109F12)) { + createScene(1, 0); + } else { + createScene(2, -1); + } + } else if (_moduleResult == 1) { + createScene(1, 1); + } else if (_moduleResult == 2) { + createScene(0, 0); } - } else if (_moduleResult == 1) { - createScene2002(1); - } else if (_moduleResult == 2) { - createScene2001(0); + break; + case 2: + createScene(1, 0); + break; } } } -void Module2000::updateScene2003() { - if (!updateChild()) { - createScene2002(0); - } -} - // Scene2001 Scene2001::Scene2001(NeverhoodEngine *vm, Module *parentModule, int which) diff --git a/engines/neverhood/module2000.h b/engines/neverhood/module2000.h index 23ac8a8e9f..8e741b357e 100644 --- a/engines/neverhood/module2000.h +++ b/engines/neverhood/module2000.h @@ -36,12 +36,8 @@ public: virtual ~Module2000(); protected: uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); - void createScene2001(int which); - void createScene2002(int which); - void createScene2003(int which); - void updateScene2001(); - void updateScene2002(); - void updateScene2003(); + void createScene(int sceneNum, int which); + void updateScene(); }; // Scene2001 diff --git a/engines/neverhood/module2300.cpp b/engines/neverhood/module2300.cpp index ce9250a9b6..dd4144f74f 100644 --- a/engines/neverhood/module2300.cpp +++ b/engines/neverhood/module2300.cpp @@ -27,8 +27,6 @@ namespace Neverhood { Module2300::Module2300(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule), _volume(0) { - debug("Create Module2300(%d)", which); - // TODO Sound1ChList_addSoundResources(0x1A214010, dword_4B6938, true); // TODO Sound1ChList_setSoundValuesMulti(dword_4B6938, true, 50, 600, 10, 10, 150); @@ -45,33 +43,17 @@ Module2300::Module2300(NeverhoodEngine *vm, Module *parentModule, int which) // TODO Sound1ChList_sub_407C70(0x1A214010, 0x41861371, 0x43A2507F, 0); if (which < 0) { - switch (_vm->gameState().sceneNum) { - case 0: - createScene2301(-1); - break; - case 1: - createScene2302(-1); - break; - case 2: - createScene2303(-1); - break; - case 3: - createScene2304(-1); - break; - case 4: - createScene2305(-1); - break; - } + createScene(_vm->gameState().sceneNum, -1); } else if (which == 1) { - createScene2303(0); + createScene(2, 0); } else if (which == 2) { - createScene2304(0); + createScene(3, 0); } else if (which == 3) { - createScene2305(-1); + createScene(4, -1); } else if (which == 4) { - createScene2302(3); + createScene(1, 3); } else { - createScene2301(1); + createScene(0, 1); } } @@ -80,136 +62,119 @@ Module2300::~Module2300() { // TODO Sound1ChList_sub_407A50(0x1A214010); } -void Module2300::createScene2301(int which) { - _vm->gameState().sceneNum = 0; - createNavigationScene(0x004B67B8, which); - SetUpdateHandler(&Module2300::updateScene2301); -} - -void Module2300::createScene2302(int which) { - _vm->gameState().sceneNum = 1; - createNavigationScene(0x004B67E8, which); - SetUpdateHandler(&Module2300::updateScene2302); - if (_flag) { - _volume = 15; - // TODO Sound1ChList_setVolume(0x90F0D1C3, 15); - } -} - -void Module2300::createScene2303(int which) { - _vm->gameState().sceneNum = 2; - createNavigationScene(0x004B6878, which); - SetUpdateHandler(&Module2300::updateScene2303); -} - -void Module2300::createScene2304(int which) { - _vm->gameState().sceneNum = 3; - if (getGlobalVar(0x10938830)) { - createNavigationScene(0x004B68F0, which); - } else { - // TODO Sound1ChList_setVolume(0x90F0D1C3, _volume); - createNavigationScene(0x004B68A8, which); +void Module2300::createScene(int sceneNum, int which) { + debug("Module2300::createScene(%d, %d)", sceneNum, which); + _vm->gameState().sceneNum = sceneNum; + switch (_vm->gameState().sceneNum) { + case 0: + createNavigationScene(0x004B67B8, which); + break; + case 1: + createNavigationScene(0x004B67E8, which); if (_flag) { - _volume = 87; - // TODO Sound1ChList_setVolume(0x90F0D1C3, 87); + _volume = 15; + // TODO Sound1ChList_setVolume(0x90F0D1C3, 15); } - } - SetUpdateHandler(&Module2300::updateScene2304); -} - -void Module2300::createScene2305(int which) { - _vm->gameState().sceneNum = 4; - // TODO Sound1ChList_sub_4080B0(true); - createSmackerScene(0x20080A0B, true, true, false); - SetUpdateHandler(&Module2300::updateScene2305); -} - -void Module2300::updateScene2301() { - if (!updateChild()) { - if (_moduleResult == 1) { - createScene2302(4); - _childObject->handleUpdate(); + break; + case 2: + createNavigationScene(0x004B6878, which); + break; + case 3: + if (getGlobalVar(0x10938830)) { + createNavigationScene(0x004B68F0, which); } else { - sendMessage(_parentModule, 0x1009, 0); + // TODO Sound1ChList_setVolume(0x90F0D1C3, _volume); + createNavigationScene(0x004B68A8, which); + if (_flag) { + _volume = 87; + // TODO Sound1ChList_setVolume(0x90F0D1C3, 87); + } } + break; + case 4: + // TODO Sound1ChList_sub_4080B0(true); + createSmackerScene(0x20080A0B, true, true, false); + break; } + SetUpdateHandler(&Module2300::updateScene); + _childObject->handleUpdate(); } -void Module2300::updateScene2302() { +void Module2300::updateScene() { if (!updateChild()) { - if (_moduleResult == 1) { - createScene2301(0); - _childObject->handleUpdate(); - } else if (_moduleResult == 2) { - createScene2303(1); - _childObject->handleUpdate(); - } else if (_moduleResult == 3) { - createScene2302(3); - _childObject->handleUpdate(); - } else if (_moduleResult == 4) { - createScene2304(1); - _childObject->handleUpdate(); - } else if (_moduleResult == 5) { - sendMessage(_parentModule, 0x1009, 3); - } else { - sendMessage(_parentModule, 0x1009, 4); + switch (_vm->gameState().sceneNum) { + case 0: + if (_moduleResult == 1) { + createScene(1, 4); + } else { + sendMessage(_parentModule, 0x1009, 0); + } + break; + case 1: + if (_moduleResult == 1) { + createScene(0, 0); + } else if (_moduleResult == 2) { + createScene(2, 1); + } else if (_moduleResult == 3) { + createScene(1, 3); + } else if (_moduleResult == 4) { + createScene(3, 1); + } else if (_moduleResult == 5) { + sendMessage(_parentModule, 0x1009, 3); + } else { + sendMessage(_parentModule, 0x1009, 4); + } + break; + case 2: + if (_moduleResult == 1) { + sendMessage(_parentModule, 0x1009, 3); + } else { + createScene(1, 5); + } + break; + case 3: + if (_moduleResult == 1) { + sendMessage(_parentModule, 0x1009, 2); + } else { + createScene(1, 1); + } + break; + case 4: + // TODO Sound1ChList_sub_4080B0(false); + createScene(1, 2); + break; } } 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++; - Sound1ChList_setVolume(0x90F0D1C3, _volume); - } + NavigationScene *navigationScene = (NavigationScene*)_childObject; + if (_flag && navigationScene->getSoundFlag1() && navigationScene->getNavigationIndex() == 4 && + navigationScene->getSmackerPlayer() && navigationScene->getSmackerPlayer()->getFrameNumber() % 2) { + _volume++; + Sound1ChList_setVolume(0x90F0D1C3, _volume); + } #endif #if 0 // TODO - if (navigationScene->getSoundFlag1() && navigationScene->getNavigationIndex() == 0 && - navigationScene->getSmackerPlayer() && navigationScene->getSmackerPlayer()->getFrameNumber() == 50) { - Sound1ChList_sub_407C70(0x1A214010, 0x48498E46, 0x50399F64); - Sound1ChList_setVolume(0x48498E46, 70); - Sound1ChList_setVolume(0x50399F64, 70); - } + if (navigationScene->getSoundFlag1() && navigationScene->getNavigationIndex() == 0 && + navigationScene->getSmackerPlayer() && navigationScene->getSmackerPlayer()->getFrameNumber() == 50) { + Sound1ChList_sub_407C70(0x1A214010, 0x48498E46, 0x50399F64); + Sound1ChList_setVolume(0x48498E46, 70); + Sound1ChList_setVolume(0x50399F64, 70); + } #endif - } -} - -void Module2300::updateScene2303() { - if (!updateChild()) { - if (_moduleResult == 1) { - sendMessage(_parentModule, 0x1009, 3); - } else { - createScene2302(5); - _childObject->handleUpdate(); - } - } -} - -void Module2300::updateScene2304() { - if (!updateChild()) { - if (_moduleResult == 1) { - sendMessage(_parentModule, 0x1009, 2); - } else { - createScene2302(1); - _childObject->handleUpdate(); - } - } else { + break; + case 3: #if 0 // TODO - NavigationScene *navigationScene = (NavigationScene*)_childObject; - if (_flag && navigationScene->getSoundFlag1() && navigationScene->getSmackerPlayer() && - navigationScene->getSmackerPlayer()->getFrameNumber() % 2) { - _volume--; - Sound1ChList_setVolume(0x90F0D1C3, _volume); - } + NavigationScene *navigationScene = (NavigationScene*)_childObject; + if (_flag && navigationScene->getSoundFlag1() && navigationScene->getSmackerPlayer() && + navigationScene->getSmackerPlayer()->getFrameNumber() % 2) { + _volume--; + Sound1ChList_setVolume(0x90F0D1C3, _volume); + } #endif - } -} - -void Module2300::updateScene2305() { - if (!updateChild()) { - // TODO Sound1ChList_sub_4080B0(false); - createScene2302(2); - _childObject->handleUpdate(); + break; + } } } diff --git a/engines/neverhood/module2300.h b/engines/neverhood/module2300.h index 9f705db6d5..722255978c 100644 --- a/engines/neverhood/module2300.h +++ b/engines/neverhood/module2300.h @@ -36,20 +36,10 @@ public: Module2300(NeverhoodEngine *vm, Module *parentModule, int which); virtual ~Module2300(); protected: - // TODO ResourceTable _resourceTable1; - // TODO ResourceTable _resourceTable2; bool _flag; int _volume; - void createScene2301(int which); - void createScene2302(int which); - void createScene2303(int which); - void createScene2304(int which); - void createScene2305(int which); - void updateScene2301(); - void updateScene2302(); - void updateScene2303(); - void updateScene2304(); - void updateScene2305(); + void createScene(int sceneNum, int which); + void updateScene(); }; } // End of namespace Neverhood diff --git a/engines/neverhood/module3000.cpp b/engines/neverhood/module3000.cpp index c28d0eb478..219f595593 100644 --- a/engines/neverhood/module3000.cpp +++ b/engines/neverhood/module3000.cpp @@ -29,8 +29,6 @@ namespace Neverhood { Module3000::Module3000(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule), _soundVolume(0) { - debug("Create Module3000(%d)", which); - // TODO Sound1ChList_addSoundResources(0x81293110, dword_4B7FC8, true); // TODO Sound1ChList_setSoundValuesMulti(dword_4B7FC8, 1, 50, 600, 5, 150); // TODO Sound1ChList_setSoundValues(0x90F0D1C3, false, 20000, 30000, 20000, 30000); @@ -46,53 +44,15 @@ Module3000::Module3000(NeverhoodEngine *vm, Module *parentModule, int which) } if (which < 0) { - switch (_vm->gameState().sceneNum) { - default: - case 1: - createScene3002(-1); - break; - case 2: - createScene3003(-1); - break; - case 3: - createScene3004(-1); - break; - case 4: - createScene3005(-1); - break; - case 5: - createScene3006(-1); - break; - case 6: - createScene3007(-1); - break; - case 7: - createScene3008(-1); - break; - case 8: - createScene3009(-1); - break; - case 9: - createScene3010(-1); - break; - case 10: - createScene3011(-1); - break; - case 11: - createScene3012(-1); - break; - case 12: - createScene3013(-1); - break; - } + createScene(_vm->gameState().sceneNum, -1); } else if (which == 0) { - createScene3002(0); + createScene(1, 0); } else if (which == 1) { - createScene3005(2); + createScene(4, 2); } else if (which == 2) { - createScene3005(1); + createScene(4, 1); } else if (which == 3) { - createScene3006(1); + createScene(5, 1); } } @@ -101,384 +61,296 @@ Module3000::~Module3000() { // TODO Sound1ChList_sub_407A50(0x81293110); } -void Module3000::createScene3002(int which) { - _vm->gameState().sceneNum = 1; - if (!getGlobalVar(0x01BA1A52)) { - createNavigationScene(0x004B7C80, which); - } else if (getGlobalVar(0x10938830)) { - createNavigationScene(0x004B7CE0, which); - } else { - createNavigationScene(0x004B7CB0, which); - } - SetUpdateHandler(&Module3000::updateScene3002); -} - -void Module3000::createScene3002b(int which) { - _vm->gameState().sceneNum = 1; - if (!getGlobalVar(0x01BA1A52)) { - if (getGlobalVar(0x10938830)) { - createSmackerScene(0x00940021, true, true, false); +void Module3000::createScene(int sceneNum, int which) { + static const byte kNavigationTypes05[] = {3, 0}; + static const byte kNavigationTypes06[] = {5}; + debug("Module3000::createScene(%d, %d)", sceneNum, which); + _vm->gameState().sceneNum = sceneNum; + switch (_vm->gameState().sceneNum) { + case 1: + if (!getGlobalVar(0x01BA1A52)) { + createNavigationScene(0x004B7C80, which); + } else if (getGlobalVar(0x10938830)) { + createNavigationScene(0x004B7CE0, which); } else { - createSmackerScene(0x01140021, true, true, false); + createNavigationScene(0x004B7CB0, which); + } + break; + case 2: + // TODO Sound1ChList_sub_407C70(0x81293110, 0x40030A51, 0xC862CA15, 0); + if (_flag) { + _soundVolume = 90; + // TODO Sound1ChList_setVolume(0x90F0D1C3, 90); } - } else { if (getGlobalVar(0x10938830)) { - createSmackerScene(0x001011B1, true, true, false); + createNavigationScene(0x004B7D58, which); } else { - createSmackerScene(0x001021B1, true, true, false); + createNavigationScene(0x004B7D10, which); } + break; + case 3: + if (getGlobalVar(0x09221A62)) + createNavigationScene(0x004B7E60, which); + else if (getGlobalVar(0x10938830)) + createNavigationScene(0x004B7DA0, which); + else + createNavigationScene(0x004B7E00, which); + break; + case 4: + if (getGlobalVar(0x09221A62)) + createNavigationScene(0x004B7F20, which); + else + createNavigationScene(0x004B7EC0, which); + break; + case 5: + createNavigationScene(0x004B7F80, which, kNavigationTypes05); + break; + case 6: + createNavigationScene(0x004B7FB0, which, kNavigationTypes06); + break; + case 7: + // TODO Sound1ChList_setSoundValuesMulti(dword_4B7FC8, 0, 0, 0, 0, 0); + if (!getSubVar(0x40050052, 0x089809C2)) { + setSubVar(0x40050052, 0x089809C2, 1); + createSmackerScene(0x90022001, true, true, false); + } else + createSmackerScene(0x98022001, true, true, false); + break; + case 8: + _childObject = new Scene3009(_vm, this, which); + break; + case 9: + _childObject = new Scene3010(_vm, this, 0); + break; + case 10: + _childObject = new Scene3011(_vm, this, 0); + break; + case 11: + // TODO Sound1ChList_setSoundValuesMulti(dword_4B7FC8, 0, 0, 0, 0, 0); + if (!getSubVar(0x40050052, 0x10130993)) { + setSubVar(0x40050052, 0x10130993, 1); + createSmackerScene(0x31093019, true, true, false); + } else + createSmackerScene(0x20093019, true, true, false); + break; + case 12: + _childObject = new Scene3010(_vm, this, 1); + break; + // NOTE: Newly introduced sceneNums + case 1001: + if (!getGlobalVar(0x01BA1A52)) + if (getGlobalVar(0x10938830)) + createSmackerScene(0x00940021, true, true, false); + else + createSmackerScene(0x01140021, true, true, false); + else + if (getGlobalVar(0x10938830)) + createSmackerScene(0x001011B1, true, true, false); + else + createSmackerScene(0x001021B1, true, true, false); + setGlobalVar(0x01BA1A52, getGlobalVar(0x01BA1A52) ? 0 : 1); + break; + case 1006: + createSmackerScene(0x080810C5, true, true, false); + break; + case 1008: + createSmackerScene(getGlobalVar(0xF0402B0A), true, true, false); + break; } - SetUpdateHandler(&Module3000::updateScene3002b); - setGlobalVar(0x01BA1A52, getGlobalVar(0x01BA1A52) ? 0 : 1); -} - -void Module3000::createScene3003(int which) { - _vm->gameState().sceneNum = 2; - // TODO Sound1ChList_sub_407C70(0x81293110, 0x40030A51, 0xC862CA15, 0); - if (_flag) { - _soundVolume = 90; - // TODO Sound1ChList_setVolume(0x90F0D1C3, 90); - } - if (getGlobalVar(0x10938830)) { - createNavigationScene(0x004B7D58, which); - } else { - createNavigationScene(0x004B7D10, which); - } - SetUpdateHandler(&Module3000::updateScene3003); -} - -void Module3000::createScene3004(int which) { - _vm->gameState().sceneNum = 3; - if (getGlobalVar(0x09221A62)) { - createNavigationScene(0x004B7E60, which); - } else if (getGlobalVar(0x10938830)) { - createNavigationScene(0x004B7DA0, which); - } else { - createNavigationScene(0x004B7E00, which); - } - SetUpdateHandler(&Module3000::updateScene3004); -} - -void Module3000::createScene3005(int which) { - _vm->gameState().sceneNum = 4; - if (getGlobalVar(0x09221A62)) { - createNavigationScene(0x004B7F20, which); - } else { - createNavigationScene(0x004B7EC0, which); - } - SetUpdateHandler(&Module3000::updateScene3005); -} - -void Module3000::createScene3006(int which) { - static const byte kNavigationTypes[] = {3, 0}; - _vm->gameState().sceneNum = 5; - createNavigationScene(0x004B7F80, which, kNavigationTypes); - SetUpdateHandler(&Module3000::updateScene3006); -} - -void Module3000::createScene3007(int which) { - static const byte kNavigationTypes[] = {5}; - _vm->gameState().sceneNum = 6; - createNavigationScene(0x004B7FB0, which, kNavigationTypes); - SetUpdateHandler(&Module3000::updateScene3007); -} - -void Module3000::createScene3008(int which) { - _vm->gameState().sceneNum = 7; - // TODO Sound1ChList_setSoundValuesMulti(dword_4B7FC8, 0, 0, 0, 0, 0); - if (!getSubVar(0x40050052, 0x089809C2)) { - setSubVar(0x40050052, 0x089809C2, 1); - createSmackerScene(0x90022001, true, true, false); - } else { - createSmackerScene(0x98022001, true, true, false); - } - SetUpdateHandler(&Module3000::updateScene3002b); -} - -void Module3000::createScene3009(int which) { - _vm->gameState().sceneNum = 8; - _childObject = new Scene3009(_vm, this, which); - SetUpdateHandler(&Module3000::updateScene3009); -} - -void Module3000::createScene3010(int which) { - _vm->gameState().sceneNum = 9; - _childObject = new Scene3010(_vm, this, 0); - SetUpdateHandler(&Module3000::updateScene3010); -} - -void Module3000::createScene3011(int which) { - _vm->gameState().sceneNum = 10; - _childObject = new Scene3011(_vm, this, 0); - SetUpdateHandler(&Module3000::updateScene3011); -} - -void Module3000::createScene3012(int which) { - _vm->gameState().sceneNum = 11; - // TODO Sound1ChList_setSoundValuesMulti(dword_4B7FC8, 0, 0, 0, 0, 0); - if (!getSubVar(0x40050052, 0x10130993)) { - setSubVar(0x40050052, 0x10130993, 1); - createSmackerScene(0x31093019, true, true, false); - } else { - createSmackerScene(0x20093019, true, true, false); - } - SetUpdateHandler(&Module3000::updateScene3002b); -} - -void Module3000::createScene3013(int which) { - _vm->gameState().sceneNum = 12; - _childObject = new Scene3010(_vm, this, 1); - SetUpdateHandler(&Module3000::updateScene3002b); -} - -void Module3000::updateScene3002() { + SetUpdateHandler(&Module3000::updateScene); _childObject->handleUpdate(); -#if 0 // ALL TODO - if (navigationScene()->getSoundFlag1()) { - uint32 frameNumber = navigationScene()->getFrameNumber(); - int navigationIndex = navigationScene()->getIndex(); - if (navigationIndex == 1) { - if (frameNumber == 0) { - // TODO Sound1ChList_sub_407C70(0x81293110, 0x48498E46, 0x50399F64, 0); - // TODO Sound1ChList_setVolume(0x48498E46, 70); - // TODO Sound1ChList_setVolume(0x50399F64, 70); - } else if (frameNumber == 100) { - // TODO Sound1ChList_sub_407C70(0x81293110, 0x41861371, 0x43A2507F, 0); - } - } else if (navigationIndex == 0) { - if (frameNumber == 0) { - // TODO Sound1ChList_sub_407C70(0x81293110, 0x48498E46, 0x50399F64, 0); - // TODO Sound1ChList_setVolume(0x48498E46, 70); - // TODO Sound1ChList_setVolume(0x50399F64, 70); - } else if (frameNumber == 10) { - // TODO Sound1ChList_sub_407C70(0x81293110, 0x40030A51, 0xC862CA15, 0); - } - if (_flag && _soundVolume < 90 && frameNumber % 2) { - if (frameNumber == 0) - _soundVolume = 40; - else - _soundVolume++; - // TODO Sound1ChList_setVolume(0x90F0D1C3, _soundVolume); - } - } - } -#endif - if (_done) { - int areaType = navigationScene()->getNavigationAreaType(); - _done = false; - delete _childObject; - _childObject = NULL; - if (!getGlobalVar(0x01BA1A52)) { - if (_moduleResult == 0) { - createScene3010(-1); - _childObject->handleUpdate(); - } else if (_moduleResult == 1) { - sendMessage(_parentModule, 0x1009, 0); - } - } else { - if (_moduleResult == 0) { - if (areaType == 2) { - createScene3003(0); - _childObject->handleUpdate(); - } else { - //createScene3002b(-1); - _childObject->handleUpdate(); - } - } else if (_moduleResult == 1) { - sendMessage(_parentModule, 0x1009, 0); - } - } - } } -void Module3000::updateScene3002b() { +void Module3000::updateScene() { if (!updateChild()) { switch (_vm->gameState().sceneNum) { case 1: - if (getGlobalVar(0x01BA1A52)) { - createScene3002(0); - _childObject->handleUpdate(); + if (!getGlobalVar(0x01BA1A52)) { + if (_moduleResult == 0) + createScene(9, -1); + else if (_moduleResult == 1) + sendMessage(_parentModule, 0x1009, 0); } else { - createScene3013(-1); - _childObject->handleUpdate(); + if (_moduleResult == 0) + if (_navigationAreaType == 2) + createScene(2, 0); + else + createScene(1001, -1); + else if (_moduleResult == 1) + sendMessage(_parentModule, 0x1009, 0); } break; + case 2: + // TODO Sound1ChList_sub_407C70(0x81293110, 0x41861371, 0x43A2507F, 0); + if (_flag) { + _soundVolume = 0; + // TODO Sound1ChList_setVolume(0x90F0D1C3, 0); + } + if (_moduleResult == 0) { + createScene(3, 0); + } else if (_moduleResult == 1) { + setGlobalVar(0x01BA1A52, 0); + createScene(1, 1); + } + break; + case 3: + if (_moduleResult == 1) + createScene(4, 0); + else if (_moduleResult == 3) + createScene(10, -1); + else if (getGlobalVar(0x09221A62)) + createScene(5, 0); + else + createScene(2, 1); + break; + case 4: + if (_moduleResult == 0) + sendMessage(_parentModule, 0x1009, 1); + else if (_moduleResult == 1) + createScene(7, -1); + else if (_moduleResult == 2) + createScene(3, 3); + break; + case 5: + if (_moduleResult == 0) + createScene(6, 0); + else if (_moduleResult == 1) + createScene(3, 0); + break; + case 6: + if (_navigationAreaType == 4) + createScene(11, -1); + else + createScene(1006, -1); + break; case 7: + createScene(8, -1); + break; case 8: - createScene3009(-1); + _flag = getGlobalVar(0x10938830); // CHECKME + if (_moduleResult != 1) { + // TODO: Sound1ChList_setSoundValuesMulti(dword_4B7FC8, true, 0, 0, 0, 0): + createScene(4, 1); + } else if (getGlobalVar(0xF0402B0A)) { + createScene(1008, -1); + } else { + // TODO: Sound1ChList_setSoundValuesMulti(dword_4B7FC8, true, 0, 0, 0, 0); + createScene(4, 1); + } + break; + case 9: + if (_moduleResult == 0 || _moduleResult == 2) + createScene(1, 0); + else if (_moduleResult == 1) + createScene(1001, -1); + break; + case 10: + createScene(3, 3); break; case 11: sendMessage(_parentModule, 0x1009, 3); break; case 12: - createScene3002(0); - _childObject->handleUpdate(); + createScene(1, 0); break; - default: - createScene3006(0); + case 1001: + if (getGlobalVar(0x01BA1A52)) + createScene(1, 0); + else + createScene(12, -1); + break; + case 1006: + createScene(5, 0); + break; + case 1008: + createScene(8, -1); break; - } - } -} - -void Module3000::updateScene3003() { - if (!updateChild()) { - // TODO Sound1ChList_sub_407C70(0x81293110, 0x41861371, 0x43A2507F, 0); - if (_flag) { - _soundVolume = 0; - // TODO Sound1ChList_setVolume(0x90F0D1C3, 0); - } - if (_moduleResult == 0) { - createScene3004(0); - _childObject->handleUpdate(); - } else if (_moduleResult == 1) { - setGlobalVar(0x01BA1A52, 0); - createScene3002(1); - _childObject->handleUpdate(); } } else { + switch (_vm->gameState().sceneNum) { + case 1: #if 0 // ALL TODO - if (navigationScene()->getSoundFlag1()) { - uint32 frameNumber = navigationScene()->getFrameNumber(); - int navigationIndex = navigationScene()->getIndex(); - if (_flag && _soundVolume > 1 && frameNumber % 2) { - _soundVolume--; - // TODO Sound1ChList_setVolume(0x90F0D1C3, _soundVolume); + if (navigationScene()->getSoundFlag1()) { + uint32 frameNumber = navigationScene()->getFrameNumber(); + int navigationIndex = navigationScene()->getIndex(); + if (navigationIndex == 1) { + if (frameNumber == 0) { + // TODO Sound1ChList_sub_407C70(0x81293110, 0x48498E46, 0x50399F64, 0); + // TODO Sound1ChList_setVolume(0x48498E46, 70); + // TODO Sound1ChList_setVolume(0x50399F64, 70); + } else if (frameNumber == 100) { + // TODO Sound1ChList_sub_407C70(0x81293110, 0x41861371, 0x43A2507F, 0); + } + } else if (navigationIndex == 0) { + if (frameNumber == 0) { + // TODO Sound1ChList_sub_407C70(0x81293110, 0x48498E46, 0x50399F64, 0); + // TODO Sound1ChList_setVolume(0x48498E46, 70); + // TODO Sound1ChList_setVolume(0x50399F64, 70); + } else if (frameNumber == 10) { + // TODO Sound1ChList_sub_407C70(0x81293110, 0x40030A51, 0xC862CA15, 0); + } + if (_flag && _soundVolume < 90 && frameNumber % 2) { + if (frameNumber == 0) + _soundVolume = 40; + else + _soundVolume++; + // TODO Sound1ChList_setVolume(0x90F0D1C3, _soundVolume); + } + } } - if (navigationIndex == 0) { - if (frameNumber == 35) { - // TODO Sound1ChList_sub_407C70(0x81293110, 0x41861371, 0x43A2507F, 0); +#endif + break; + case 2: +#if 0 // ALL TODO + if (navigationScene()->getSoundFlag1()) { + uint32 frameNumber = navigationScene()->getFrameNumber(); + int navigationIndex = navigationScene()->getIndex(); + if (_flag && _soundVolume > 1 && frameNumber % 2) { + _soundVolume--; + // TODO Sound1ChList_setVolume(0x90F0D1C3, _soundVolume); } - } else if (navigationIndex == 1) { - if (frameNumber == 55) { - // TODO Sound1ChList_sub_407C70(0x81293110, 0x48498E46, 0x50399F64, 0); - // TODO Sound1ChList_setVolume(0x48498E46, 70); - // TODO Sound1ChList_setVolume(0x50399F64, 70); + if (navigationIndex == 0) { + if (frameNumber == 35) { + // TODO Sound1ChList_sub_407C70(0x81293110, 0x41861371, 0x43A2507F, 0); + } + } else if (navigationIndex == 1) { + if (frameNumber == 55) { + // TODO Sound1ChList_sub_407C70(0x81293110, 0x48498E46, 0x50399F64, 0); + // TODO Sound1ChList_setVolume(0x48498E46, 70); + // TODO Sound1ChList_setVolume(0x50399F64, 70); + } } } - } #endif - } -} - -void Module3000::updateScene3004() { - if (!updateChild()) { - if (_moduleResult == 1) { - createScene3005(0); - _childObject->handleUpdate(); - } else if (_moduleResult == 3) { - createScene3011(-1); - _childObject->handleUpdate(); - } else if (getGlobalVar(0x09221A62)) { - createScene3006(0); - _childObject->handleUpdate(); - } else { - createScene3003(1); - _childObject->handleUpdate(); - } - } else { + break; + case 3: #if 0 // ALL TODO - if (navigationScene()->getSoundFlag1()) { - uint32 frameNumber = navigationScene()->getFrameNumber(); - int navigationIndex = navigationScene()->getIndex(); - if (navigationIndex == 2) { - if (frameNumber == 40) { - // TODO Sound1ChList_sub_407C70(0x81293110, 0x40030A51, 0xC862CA15, 0); - } - if (_flag && _soundVolume < 90 && frameNumber % 2) { - if (frameNumber == 0) - _soundVolume = 40; - else - _soundVolume++; - // TODO Sound1ChList_setVolume(0x90F0D1C3, _soundVolume); + if (navigationScene()->getSoundFlag1()) { + uint32 frameNumber = navigationScene()->getFrameNumber(); + int navigationIndex = navigationScene()->getIndex(); + if (navigationIndex == 2) { + if (frameNumber == 40) { + // TODO Sound1ChList_sub_407C70(0x81293110, 0x40030A51, 0xC862CA15, 0); + } + if (_flag && _soundVolume < 90 && frameNumber % 2) { + if (frameNumber == 0) + _soundVolume = 40; + else + _soundVolume++; + // TODO Sound1ChList_setVolume(0x90F0D1C3, _soundVolume); + } } } - } #endif - } -} - -void Module3000::updateScene3005() { - if (!updateChild()) { - if (_moduleResult == 0) { - sendMessage(_parentModule, 0x1009, 1); - } else if (_moduleResult == 1) { - createScene3008(-1); - _childObject->handleUpdate(); - } else if (_moduleResult == 2) { - createScene3004(3); - _childObject->handleUpdate(); - } - } -} - -void Module3000::updateScene3006() { - if (!updateChild()) { - if (_moduleResult == 0) { - createScene3007(0); - } else if (_moduleResult == 1) { - createScene3004(0); - } - _childObject->handleUpdate(); - } else { + break; + case 5: #if 0 // ALL TODO - if (navigationScene()->getSoundFlag1() && navigationScene()->getIndex() == 0) { - // TODO Sound1ChList_sub_4080B0(false); - } + if (navigationScene()->getSoundFlag1() && navigationScene()->getIndex() == 0) { + // TODO Sound1ChList_sub_4080B0(false); + } #endif - } -} - -void Module3000::updateScene3007() { - _childObject->handleUpdate(); - if (_done) { - int areaType = navigationScene()->getNavigationAreaType(); - _done = false; - delete _childObject; - _childObject = NULL; - if (areaType == 4) { - createScene3012(-1); - _childObject->handleUpdate(); - } else { - createSmackerScene(0x080810C5, true, true, false); - SetUpdateHandler(&Module3000::updateScene3002b); - } - } -} - -void Module3000::updateScene3009() { - if (!updateChild()) { - _flag = getGlobalVar(0x10938830); // CHECKME - if (_moduleResult != 1) { - // TODO: Sound1ChList_setSoundValuesMulti(dword_4B7FC8, true, 0, 0, 0, 0): - createScene3005(1); - _childObject->handleUpdate(); - } else if (getGlobalVar(0xF0402B0A)) { - createSmackerScene(getGlobalVar(0xF0402B0A), true, true, false); - SetUpdateHandler(&Module3000::updateScene3002b); - } else { - // TODO: Sound1ChList_setSoundValuesMulti(dword_4B7FC8, true, 0, 0, 0, 0); - createScene3005(1); - _childObject->handleUpdate(); - } - } -} - -void Module3000::updateScene3010() { - if (!updateChild()) { - if (_moduleResult == 0 || _moduleResult == 2) { - createScene3002(0); - } else if (_moduleResult == 1) { - createScene3002b(-1); + break; } - _childObject->handleUpdate(); - } -} - -void Module3000::updateScene3011() { - if (!updateChild()) { - createScene3004(3); - _childObject->handleUpdate(); } } diff --git a/engines/neverhood/module3000.h b/engines/neverhood/module3000.h index 63e5261207..2764c83490 100644 --- a/engines/neverhood/module3000.h +++ b/engines/neverhood/module3000.h @@ -37,30 +37,8 @@ public: protected: int _soundVolume; bool _flag; - uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); - void createScene3002(int which); - void createScene3002b(int which); - void createScene3003(int which); - void createScene3004(int which); - void createScene3005(int which); - void createScene3006(int which); - void createScene3007(int which); - void createScene3008(int which); - void createScene3009(int which); - void createScene3010(int which); - void createScene3011(int which); - void createScene3012(int which); - void createScene3013(int which); - void updateScene3002(); - void updateScene3002b(); - void updateScene3003(); - void updateScene3004(); - void updateScene3005(); - void updateScene3006(); - void updateScene3007(); - void updateScene3009(); - void updateScene3010(); - void updateScene3011(); + void createScene(int sceneNum, int which); + void updateScene(); }; // Scene3009 diff --git a/engines/neverhood/smackerscene.cpp b/engines/neverhood/smackerscene.cpp index ae290631a9..c24bf6ac49 100644 --- a/engines/neverhood/smackerscene.cpp +++ b/engines/neverhood/smackerscene.cpp @@ -81,9 +81,7 @@ void SmackerScene::nextVideo() { setSubVar(0x00800410, smackerFileHash, 1); } if (_fileHashListIndex == 0) { - _smackerPlayer = new SmackerPlayer(_vm, this, smackerFileHash, _doubleSurface, false); - addEntity(_smackerPlayer); - addSurface(_smackerPlayer->getSurface()); + _smackerPlayer = addSmackerPlayer(new SmackerPlayer(_vm, this, smackerFileHash, _doubleSurface, false)); // TODO? Screen.hSmack = _smackerPlayer; } else { _smackerPlayer->open(smackerFileHash, false); |