diff options
author | johndoe123 | 2012-10-15 15:50:43 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2013-05-08 20:47:07 +0200 |
commit | 6df8fccf6b90399490543b142bb88976565aae2f (patch) | |
tree | 8e0ef1c353292fe8720c237368c662e0ff2bccc2 /engines/neverhood | |
parent | 9858705772f88af82a811979831aa46b107330cd (diff) | |
download | scummvm-rg350-6df8fccf6b90399490543b142bb88976565aae2f.tar.gz scummvm-rg350-6df8fccf6b90399490543b142bb88976565aae2f.tar.bz2 scummvm-rg350-6df8fccf6b90399490543b142bb88976565aae2f.zip |
NEVERHOOD: Implement GameModule::createModuleByHash
This is used later when restoring savegames
- Rename V_RING5_PULLED to V_RADIO_ENABLED
- Implement Palette::fillBaseBlack and use it in Scene2803Small
- Fix Scene2802 (show disabled radio if it's not enabled)
Diffstat (limited to 'engines/neverhood')
-rw-r--r-- | engines/neverhood/gamemodule.cpp | 70 | ||||
-rw-r--r-- | engines/neverhood/gamemodule.h | 1 | ||||
-rw-r--r-- | engines/neverhood/gamevars.h | 2 | ||||
-rw-r--r-- | engines/neverhood/module1000.cpp | 14 | ||||
-rw-r--r-- | engines/neverhood/module2800.cpp | 29 | ||||
-rw-r--r-- | engines/neverhood/palette.cpp | 11 | ||||
-rw-r--r-- | engines/neverhood/palette.h | 1 |
7 files changed, 102 insertions, 26 deletions
diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index ca22c01eca..da432c5dbb 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -517,6 +517,76 @@ void GameModule::createModule(int moduleNum, int which) { _childObject->handleUpdate(); } +void GameModule::createModuleByHash(uint32 nameHash) { + switch (nameHash) { + case 0x03294419: + createModule(1000, -1); + break; + case 0x0002C818: + createModule(1100, -1); + break; + case 0x00478311: + createModule(1200, -1); + break; + case 0x0061C090: + createModule(1300, -1); + break; + case 0x00AD0012: + createModule(1400, -1); + break; + case 0x00F10114: + createModule(1500, -1); + break; + case 0x01A008D8: + createModule(1600, -1); + break; + case 0x04212331: + createModule(1700, -1); + break; + case 0x04A14718: + createModule(1800, -1); + break; + case 0x04E1C09C: + createModule(1900, -1); + break; + case 0x08250000: + createModule(2000, -1); + break; + case 0x10A10C14: + createModule(2100, -1); + break; + case 0x11391412: + createModule(2200, -1); + break; + case 0x1A214010: + createModule(2300, -1); + break; + case 0x202D1010: + createModule(2400, -1); + break; + case 0x29220120: + createModule(2500, -1); + break; + case 0x40271018: + createModule(2600, -1); + break; + case 0x42212411: + createModule(2700, -1); + break; + case 0x64210814: + createModule(2800, -1); + break; + case 0x81100020: + createModule(2900, -1); + break; + case 0x81293110: + createModule(3000, -1); + break; + default: + error("GameModule::createModuleByHash() Unknown module name %08X", nameHash); + } +} + void GameModule::updateModule() { if (!updateChild()) { switch (_moduleNum) { diff --git a/engines/neverhood/gamemodule.h b/engines/neverhood/gamemodule.h index 82e6fa57c8..94fafc8796 100644 --- a/engines/neverhood/gamemodule.h +++ b/engines/neverhood/gamemodule.h @@ -54,6 +54,7 @@ protected: int _moduleNum; uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); void createModule(int moduleNum, int which); + void createModuleByHash(uint32 nameHash); void updateModule(); }; diff --git a/engines/neverhood/gamevars.h b/engines/neverhood/gamevars.h index 52740dca56..19a8a8586a 100644 --- a/engines/neverhood/gamevars.h +++ b/engines/neverhood/gamevars.h @@ -87,7 +87,7 @@ enum { V_BALLOON_POPPED = 0xAC00C0D0, // Has the balloon with the key been popped? V_TNT_DUMMY_BUILT = 0x000CF819, // Are all TNT parts on the dummy? V_TNT_DUMMY_FUSE_LIT = 0x20A0C516, - V_RING5_PULLED = 0x4DE80AC0, + V_RADIO_ENABLED = 0x4DE80AC0, V_CREATURE_EXPLODED = 0x2A02C07B, // Match V_MATCH_STATUS = 0x0112090A, diff --git a/engines/neverhood/module1000.cpp b/engines/neverhood/module1000.cpp index 6cae11a1f4..e718904cb3 100644 --- a/engines/neverhood/module1000.cpp +++ b/engines/neverhood/module1000.cpp @@ -1475,21 +1475,21 @@ uint32 Scene1002::handleMessage(int messageNum, const MessageParam ¶m, Entit sendMessage(_parentModule, 0x1024, 2); _flag1BE = true; if (sender == _asRing1) { - setGlobalVar(V_RING5_PULLED, 0); + setGlobalVar(V_RADIO_ENABLED, 0); playSound(0, 0x665198C0); } else if (sender == _asRing2) { - setGlobalVar(V_RING5_PULLED, 0); + setGlobalVar(V_RADIO_ENABLED, 0); playSound(0, 0xE2D389C0); } else if (sender == _asRing3) { - setGlobalVar(V_RING5_PULLED, 0); + setGlobalVar(V_RADIO_ENABLED, 0); playSound(1); sendMessage(_asDoor, 0x4808, 0); sendMessage(_asOutsideDoorBackground, 0x4808, 0); } else if (sender == _asRing4) { - setGlobalVar(V_RING5_PULLED, 0); + setGlobalVar(V_RADIO_ENABLED, 0); playSound(0, 0xE0558848); } else if (sender == _asRing5) { - setGlobalVar(V_RING5_PULLED, 1); + setGlobalVar(V_RADIO_ENABLED, 1); playSound(0, 0x44014282); } break; @@ -1508,7 +1508,7 @@ uint32 Scene1002::handleMessage(int messageNum, const MessageParam ¶m, Entit sendEntityMessage(_klayman, 0x1014, _asDoorSpy); break; case 0x480F: - setGlobalVar(V_RING5_PULLED, 0); + setGlobalVar(V_RADIO_ENABLED, 0); playSound(1); sendMessage(_asDoor, 0x4808, 0); sendMessage(_asOutsideDoorBackground, 0x4808, 0); @@ -1800,7 +1800,7 @@ uint32 Scene1005::getTextIndex1() { textIndex = 12; else if (!getGlobalVar(0x2050861A)) textIndex = 13; - else if (!getGlobalVar(V_RING5_PULLED)) + else if (!getGlobalVar(V_RADIO_ENABLED)) textIndex = 50; else if (!getGlobalVar(0x89C669AA)) textIndex = 14; diff --git a/engines/neverhood/module2800.cpp b/engines/neverhood/module2800.cpp index 28a0eb814a..a47d9cb355 100644 --- a/engines/neverhood/module2800.cpp +++ b/engines/neverhood/module2800.cpp @@ -34,7 +34,6 @@ Module2800::Module2800(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule), _musicResource(NULL) { _currentMusicFileHash = 0; - // TODO music stuff _vm->_soundMan->addMusic(0x64210814, 0xD2FA4D14); setGlobalVar(0x28D8C940, 1); @@ -68,19 +67,10 @@ void Module2800::createScene(int sceneNum, int which) { break; case 1: _vm->_soundMan->stopMusic(0xD2FA4D14, 0, 0); - - // TODO!! - - _childObject = new Scene2802(_vm, this, which); - -#if 0 - _flag = true; // DEBUG! - if (_flag) { + if (getGlobalVar(V_RADIO_ENABLED)) _childObject = new Scene2802(_vm, this, which); - } else { + else createStaticScene(0x000C6444, 0xC6440008); - } -#endif break; case 2: _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); @@ -202,7 +192,12 @@ void Module2800::updateScene() { switch (_vm->gameState().sceneNum) { case 0: if (_moduleResult != 2) { - // TODO music stuff + if (_musicResource) { + _musicResource->unload(); + delete _musicResource; + _musicResource = NULL; + } + _currentMusicFileHash = 0; } if (_moduleResult == 1) { createScene(2, 0); @@ -407,15 +402,13 @@ void Module2800::updateMusic(bool halfVolume) { Scene2801::Scene2801(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule, true) { - // TODO Weird palette glitches in the mouse cursor and sprite, check this later - // TODO _vm->gameModule()->initScene2801Vars(); _surfaceFlag = true; SetMessageHandler(&Scene2801::handleMessage); SetUpdateHandler(&Scene::update); - if (getGlobalVar(V_RING5_PULLED) == 0) { + if (getGlobalVar(V_RADIO_ENABLED) == 0) { // Display the disabled radio; only possible when the left door is open insertStaticSprite(0x0001264C, 100); } @@ -1357,7 +1350,7 @@ void Scene2803Small::updatePaletteArea(bool instantly) { _palette->addBasePalette(0xB103B604, 0, 64, 0); break; case 3: - // TODO _palette->sub_47BFB0(0, 64); + _palette->fillBaseBlack(0, 64); break; default: _palette->addBasePalette(0x412A423E, 0, 64, 0); @@ -1369,7 +1362,7 @@ void Scene2803Small::updatePaletteArea(bool instantly) { _palette->addBasePalette(0x0263D144, 0, 64, 0); break; case 3: - // TODO _palette->sub_47BFB0(0, 64); + _palette->fillBaseBlack(0, 64); break; default: _palette->addBasePalette(0x29800A01, 0, 64, 0); diff --git a/engines/neverhood/palette.cpp b/engines/neverhood/palette.cpp index c27bd867bc..16ef31d569 100644 --- a/engines/neverhood/palette.cpp +++ b/engines/neverhood/palette.cpp @@ -150,6 +150,17 @@ void Palette::fillBaseWhite(int index, int count) { } } +void Palette::fillBaseBlack(int index, int count) { + if (index + count > 256) + count = 256 - index; + for (int i = 0; i < count; i++) { + _basePalette[(i + index) * 4 + 0] = 0; + _basePalette[(i + index) * 4 + 1] = 0; + _basePalette[(i + index) * 4 + 2] = 0; + _basePalette[(i + index) * 4 + 3] = 0; + } +} + void Palette::update() { debug(2, "Palette::update() _status = %d", _status); if (_status == 1) { diff --git a/engines/neverhood/palette.h b/engines/neverhood/palette.h index 27f4816bb0..4b0747bd73 100644 --- a/engines/neverhood/palette.h +++ b/engines/neverhood/palette.h @@ -50,6 +50,7 @@ public: void startFadeToWhite(int counter); void startFadeToPalette(int counter); void fillBaseWhite(int index, int count); + void fillBaseBlack(int index, int count); protected: int _status; byte *_palette; |