diff options
author | johndoe123 | 2012-10-18 17:15:20 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2013-05-08 20:47:32 +0200 |
commit | 533eb5d61d6d3f0b7f229648cf186ba1b54e5388 (patch) | |
tree | c643fb58c97d8953a00aa20be4de18765b391bf1 /engines | |
parent | 9b7354dacb343a1618f8329c660fcba170f86ede (diff) | |
download | scummvm-rg350-533eb5d61d6d3f0b7f229648cf186ba1b54e5388.tar.gz scummvm-rg350-533eb5d61d6d3f0b7f229648cf186ba1b54e5388.tar.bz2 scummvm-rg350-533eb5d61d6d3f0b7f229648cf186ba1b54e5388.zip |
NEVERHOOD: Rename puzzle initialization methods and give them better names
Diffstat (limited to 'engines')
-rw-r--r-- | engines/neverhood/gamemodule.cpp | 56 | ||||
-rw-r--r-- | engines/neverhood/gamemodule.h | 16 | ||||
-rw-r--r-- | engines/neverhood/module1100.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/module1300.cpp | 4 | ||||
-rw-r--r-- | engines/neverhood/module1400.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/module1700.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/module2200.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/module2400.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/module2700.cpp | 8 | ||||
-rw-r--r-- | engines/neverhood/module2700.h | 2 | ||||
-rw-r--r-- | engines/neverhood/module2800.cpp | 13 | ||||
-rw-r--r-- | engines/neverhood/module3000.cpp | 2 |
12 files changed, 52 insertions, 59 deletions
diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index a3c88c2bf4..80e6fbeaad 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -47,7 +47,7 @@ namespace Neverhood { -static const uint32 kScene2801MusicFileHashes[] = { +static const uint32 kRadioMusicFileHashes[] = { 0x82B22000, 0x02B22004, 0x42B22000, @@ -124,7 +124,7 @@ void GameModule::handleSpaceKey() { } } -void GameModule::initScene1307Vars() { +void GameModule::initKeySlotsPuzzle() { // Exit if it's already initialized if (getSubVar(VA_IS_PUZZLE_INIT, 0x25400B10)) @@ -162,7 +162,7 @@ void GameModule::initScene1307Vars() { } -void GameModule::initScene1405Vars() { +void GameModule::initMemoryPuzzle() { // TODO: Give better names @@ -261,33 +261,29 @@ void GameModule::initScene1405Vars() { } -void GameModule::initScene2401Vars() { - - if (getSubVar(VA_IS_PUZZLE_INIT, 0x40520234)) - return; - - setSubVar(VA_GOOD_WATER_PIPES_LEVEL, 0, 3); - setSubVar(VA_GOOD_WATER_PIPES_LEVEL, 1, 1); - setSubVar(VA_GOOD_WATER_PIPES_LEVEL, 2, 2); - setSubVar(VA_GOOD_WATER_PIPES_LEVEL, 3, 0); - setSubVar(VA_GOOD_WATER_PIPES_LEVEL, 4, 4); - - setSubVar(VA_IS_PUZZLE_INIT, 0x40520234, 1); - +void GameModule::initWaterPipesPuzzle() { + if (!getSubVar(VA_IS_PUZZLE_INIT, 0x40520234)) { + setSubVar(VA_GOOD_WATER_PIPES_LEVEL, 0, 3); + setSubVar(VA_GOOD_WATER_PIPES_LEVEL, 1, 1); + setSubVar(VA_GOOD_WATER_PIPES_LEVEL, 2, 2); + setSubVar(VA_GOOD_WATER_PIPES_LEVEL, 3, 0); + setSubVar(VA_GOOD_WATER_PIPES_LEVEL, 4, 4); + setSubVar(VA_IS_PUZZLE_INIT, 0x40520234, 1); + } } -void GameModule::initScene2801Vars() { +void GameModule::initRadioPuzzle() { if (!getSubVar(VA_IS_PUZZLE_INIT, 0x08C80800)) { int currMusicIndex = _vm->_rnd->getRandomNumber(5 - 1) + 3; setGlobalVar(V_GOOD_RADIO_MUSIC_INDEX, 5 * currMusicIndex); - setGlobalVar(V_GOOD_RADIO_MUSIC_NAME, kScene2801MusicFileHashes[currMusicIndex]); + setGlobalVar(V_GOOD_RADIO_MUSIC_NAME, kRadioMusicFileHashes[currMusicIndex]); setGlobalVar(V_RADIO_ROOM_LEFT_DOOR, 1); setGlobalVar(V_RADIO_ROOM_RIGHT_DOOR, 0); setSubVar(VA_IS_PUZZLE_INIT, 0x08C80800, 1); } } -void GameModule::initScene2808Vars1() { +void GameModule::initTestTubes1Puzzle() { if (!getSubVar(VA_IS_PUZZLE_INIT, 0x20479010)) { for (uint i = 0; i < 3; i++) setSubVar(VA_GOOD_TEST_TUBES_LEVEL_1, i, _vm->_rnd->getRandomNumber(3 - 1) + 1); @@ -295,7 +291,7 @@ void GameModule::initScene2808Vars1() { } } -void GameModule::initScene2808Vars2() { +void GameModule::initTestTubes2Puzzle() { if (!getSubVar(VA_IS_PUZZLE_INIT, 0x66059818)) { for (uint i = 0; i < 3; i++) setSubVar(VA_GOOD_TEST_TUBES_LEVEL_2, i, _vm->_rnd->getRandomNumber(6 - 1) + 1); @@ -303,7 +299,7 @@ void GameModule::initScene2808Vars2() { } } -void GameModule::initScene3009Vars() { +void GameModule::initCannonSymbolsPuzzle() { if (!getSubVar(VA_IS_PUZZLE_INIT, 0x8C9819C2)) { for (int i = 0; i < 3; i++) { setSubVar(VA_GOOD_CANNON_SYMBOLS_1, i, _vm->_rnd->getRandomNumber(12 - 1)); @@ -313,9 +309,9 @@ void GameModule::initScene3009Vars() { } } -uint32 GameModule::getScene2802MusicFileHash() { +uint32 GameModule::getCurrRadioMusicFileHash() { uint musicIndex = getGlobalVar(V_CURR_RADIO_MUSIC_INDEX); - return (musicIndex % 5 != 0) ? 0 : kScene2801MusicFileHashes[CLIP<uint>(musicIndex / 5, 0, 17)]; + return (musicIndex % 5 != 0) ? 0 : kRadioMusicFileHashes[CLIP<uint>(musicIndex / 5, 0, 17)]; } @@ -324,20 +320,18 @@ uint32 GameModule::handleMessage(int messageNum, const MessageParam ¶m, Enti switch (messageNum) { case 0x0800: _someFlag1 = true; - return messageResult; + break; case 0x1009: _moduleResult = param.asInteger(); _done = true; - return messageResult; + break; case 0x100A: - // Unused resource preloading message - return messageResult; + case 0x1023: + // Unused resource preloading messages + break; case 0x101F: _field2C = true; - return messageResult; - case 0x1023: - // Unused resource preloading message - return messageResult; + break; } return messageResult; } diff --git a/engines/neverhood/gamemodule.h b/engines/neverhood/gamemodule.h index 275e8d3895..eb043cb646 100644 --- a/engines/neverhood/gamemodule.h +++ b/engines/neverhood/gamemodule.h @@ -39,14 +39,14 @@ public: void handleMouseDown(int16 x, int16 y); void handleMouseUp(int16 x, int16 y); void handleSpaceKey(); - void initScene1307Vars(); - void initScene1405Vars(); - void initScene2401Vars(); - void initScene2801Vars(); - void initScene2808Vars1(); - void initScene2808Vars2(); - void initScene3009Vars(); - uint32 getScene2802MusicFileHash(); + void initKeySlotsPuzzle(); + void initMemoryPuzzle(); + void initWaterPipesPuzzle(); + void initRadioPuzzle(); + void initTestTubes1Puzzle(); + void initTestTubes2Puzzle(); + void initCannonSymbolsPuzzle(); + uint32 getCurrRadioMusicFileHash(); protected: Entity *_prevChildObject; bool _someFlag1; diff --git a/engines/neverhood/module1100.cpp b/engines/neverhood/module1100.cpp index 9bd7b8887a..6bf61408b7 100644 --- a/engines/neverhood/module1100.cpp +++ b/engines/neverhood/module1100.cpp @@ -450,7 +450,7 @@ Scene1105::Scene1105(NeverhoodEngine *vm, Module *parentModule, int which) Sprite *ssOpenButton; - _vm->gameModule()->initScene1405Vars(); + _vm->gameModule()->initMemoryPuzzle(); SetUpdateHandler(&Scene1105::update); SetMessageHandler(&Scene1105::handleMessage); diff --git a/engines/neverhood/module1300.cpp b/engines/neverhood/module1300.cpp index f718d1efe9..d92cd66bc6 100644 --- a/engines/neverhood/module1300.cpp +++ b/engines/neverhood/module1300.cpp @@ -1258,7 +1258,7 @@ Scene1307::Scene1307(NeverhoodEngine *vm, Module *parentModule, int which) Sprite *tempSprite; - _vm->gameModule()->initScene1307Vars(); + _vm->gameModule()->initKeySlotsPuzzle(); _dataResource.load(0x22102142); _keyHolePoints = _dataResource.getPointArray(0xAC849240); @@ -1568,7 +1568,7 @@ uint32 AsScene1308Mouse::handleMessage(int messageNum, const MessageParam ¶m Scene1308::Scene1308(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule, true), _flag1(false) { - _vm->gameModule()->initScene1307Vars(); + _vm->gameModule()->initKeySlotsPuzzle(); SetMessageHandler(&Scene1308::handleMessage); diff --git a/engines/neverhood/module1400.cpp b/engines/neverhood/module1400.cpp index 1bb0548fd4..f25efe2027 100644 --- a/engines/neverhood/module1400.cpp +++ b/engines/neverhood/module1400.cpp @@ -1584,7 +1584,7 @@ void AsScene1405Tile::hide() { Scene1405::Scene1405(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule, true), _selectFirstTile(true), _tilesLeft(48), _countdown(0) { - _vm->gameModule()->initScene1405Vars(); + _vm->gameModule()->initMemoryPuzzle(); setBackground(0x0C0C007D); setPalette(0x0C0C007D); diff --git a/engines/neverhood/module1700.cpp b/engines/neverhood/module1700.cpp index ae97c151f7..7df162c15e 100644 --- a/engines/neverhood/module1700.cpp +++ b/engines/neverhood/module1700.cpp @@ -187,7 +187,7 @@ Scene1705::Scene1705(NeverhoodEngine *vm, Module *parentModule, int which) Sprite *tempSprite; setGlobalVar(V_FELL_DOWN_HOLE, 1); - _vm->gameModule()->initScene3009Vars(); + _vm->gameModule()->initCannonSymbolsPuzzle(); SetMessageHandler(&Scene1705::handleMessage); SetUpdateHandler(&Scene1705::update); diff --git a/engines/neverhood/module2200.cpp b/engines/neverhood/module2200.cpp index 1159c0b1da..028c88359c 100644 --- a/engines/neverhood/module2200.cpp +++ b/engines/neverhood/module2200.cpp @@ -2003,7 +2003,7 @@ Scene2207::Scene2207(NeverhoodEngine *vm, Module *parentModule, int which) //setGlobalVar(V_LIGHTS_ON, 1); //DEBUG<<< - _vm->gameModule()->initScene3009Vars(); + _vm->gameModule()->initCannonSymbolsPuzzle(); if (!getSubVar(VA_IS_PUZZLE_INIT, 0x88460852)) setSubVar(VA_IS_PUZZLE_INIT, 0x88460852, 1); diff --git a/engines/neverhood/module2400.cpp b/engines/neverhood/module2400.cpp index 94937bf874..770a5c3301 100644 --- a/engines/neverhood/module2400.cpp +++ b/engines/neverhood/module2400.cpp @@ -387,7 +387,7 @@ Scene2401::Scene2401(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule, true), _countdown1(0), _countdown2(0), _flag(false), _soundToggle(false), _asWaterSpitIndex(0) { - _vm->gameModule()->initScene2401Vars(); + _vm->gameModule()->initWaterPipesPuzzle(); setGlobalVar(V_WATER_RUNNING, 1); //DEBUG! Enables water setGlobalVar(V_HAS_TEST_TUBE, 1); //DEBUG! Gives the test tube diff --git a/engines/neverhood/module2700.cpp b/engines/neverhood/module2700.cpp index 870c14ced4..60cc581066 100644 --- a/engines/neverhood/module2700.cpp +++ b/engines/neverhood/module2700.cpp @@ -83,7 +83,7 @@ static const uint32 kScene2725StaticSprites[] = { }; Module2700::Module2700(NeverhoodEngine *vm, Module *parentModule, int which) - : Module(vm, parentModule), _soundIndex(0), _flag1(false) { + : Module(vm, parentModule), _soundIndex(0), _raidoMusicInitialized(false) { _vm->_soundMan->addMusic(0x42212411, 0x04020210); _vm->_soundMan->startMusic(0x04020210, 24, 2); @@ -454,15 +454,15 @@ void Module2700::updateScene() { } else { switch (_vm->gameState().sceneNum) { case 21: - if (!_flag1) { + if (!_raidoMusicInitialized) { _vm->_soundMan->stopMusic(0x04020210, 0, 1); - _vm->gameModule()->initScene2801Vars(); + _vm->gameModule()->initRadioPuzzle(); _musicFileHash = getGlobalVar(V_GOOD_RADIO_MUSIC_NAME); _vm->_soundMan->addMusic(0x42212411, _musicFileHash); _vm->_soundMan->startMusic(_musicFileHash, 0, 2/*TODO ??? */); _vm->_soundMan->addSound(0x42212411, 0x44014282); _vm->_soundMan->setSoundParams(0x44014282, true, 120, 360, 72, 0); - _flag1 = true; + _raidoMusicInitialized = true; } break; } diff --git a/engines/neverhood/module2700.h b/engines/neverhood/module2700.h index d11586ea3e..4973211075 100644 --- a/engines/neverhood/module2700.h +++ b/engines/neverhood/module2700.h @@ -38,7 +38,7 @@ public: virtual ~Module2700(); protected: int _soundIndex; - bool _flag1; + bool _raidoMusicInitialized; uint32 _scene2711StaticSprites[6]; uint32 _musicFileHash; void createScene(int sceneNum, int which); diff --git a/engines/neverhood/module2800.cpp b/engines/neverhood/module2800.cpp index c1e1790040..174e5e041d 100644 --- a/engines/neverhood/module2800.cpp +++ b/engines/neverhood/module2800.cpp @@ -372,7 +372,7 @@ void Module2800::updateScene() { void Module2800::updateMusic(bool halfVolume) { - uint32 newMusicFileHash = _vm->_gameModule->getScene2802MusicFileHash(); + uint32 newMusicFileHash = _vm->_gameModule->getCurrRadioMusicFileHash(); if (!_musicResource) _musicResource = new MusicResource(_vm); @@ -402,7 +402,7 @@ void Module2800::updateMusic(bool halfVolume) { Scene2801::Scene2801(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule, true) { - _vm->gameModule()->initScene2801Vars(); + _vm->gameModule()->initRadioPuzzle(); SetMessageHandler(&Scene2801::handleMessage); SetUpdateHandler(&Scene::update); @@ -657,9 +657,8 @@ void Scene2802::changeTuneStatus(int prevTuneStatus, int newTuneStatus) { } if (newTuneStatus == 0) { - if (_vm->_gameModule->getScene2802MusicFileHash() != 0) { + if (_vm->_gameModule->getCurrRadioMusicFileHash() != 0) _vm->_soundMan->stopSound(0x00632252); - } else _vm->_soundMan->playSoundLooping(0x00632252); } else if (newTuneStatus == 3 || newTuneStatus == 6) { @@ -835,7 +834,7 @@ Scene2803::Scene2803(NeverhoodEngine *vm, Module *parentModule, int which) }; setGlobalVar(V_BEEN_SHRINKING_ROOM, 1); - _vm->gameModule()->initScene2808Vars1(); + _vm->gameModule()->initTestTubes1Puzzle(); SetMessageHandler(&Scene2803::handleMessage); @@ -2521,9 +2520,9 @@ Scene2808::Scene2808(NeverhoodEngine *vm, Module *parentModule, int which) Sprite *tempSprite; if (which == 0) { - _vm->gameModule()->initScene2808Vars1(); + _vm->gameModule()->initTestTubes1Puzzle(); } else { - _vm->gameModule()->initScene2808Vars2(); + _vm->gameModule()->initTestTubes2Puzzle(); } SetMessageHandler(&Scene2808::handleMessage); diff --git a/engines/neverhood/module3000.cpp b/engines/neverhood/module3000.cpp index c3eb9e458d..a6bc6eb6fe 100644 --- a/engines/neverhood/module3000.cpp +++ b/engines/neverhood/module3000.cpp @@ -802,7 +802,7 @@ Scene3009::Scene3009(NeverhoodEngine *vm, Module *parentModule, int which) _cannonTargetStatus = getGlobalVar(V_CANNON_TARGET_STATUS); debug("_cannonTargetStatus = %d", _cannonTargetStatus); - _vm->gameModule()->initScene3009Vars(); + _vm->gameModule()->initCannonSymbolsPuzzle(); setGlobalVar(V_CANNON_SMACKER_NAME, 0); |