diff options
author | johndoe123 | 2011-09-23 15:45:50 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2013-05-08 20:39:41 +0200 |
commit | af2820fd23d152c7fddf77872198a07df680b46d (patch) | |
tree | 856a3a2e1a885ce56b9cd79a06785724f40f90d6 /engines | |
parent | 236ca705e8082184aae61aae5e2d561d09b7043c (diff) | |
download | scummvm-rg350-af2820fd23d152c7fddf77872198a07df680b46d.tar.gz scummvm-rg350-af2820fd23d152c7fddf77872198a07df680b46d.tar.bz2 scummvm-rg350-af2820fd23d152c7fddf77872198a07df680b46d.zip |
NEVERHOOD: Add leaveModule and leaveScene
(instead of using sendMessage directly)
Diffstat (limited to 'engines')
-rw-r--r-- | engines/neverhood/module1000.cpp | 14 | ||||
-rw-r--r-- | engines/neverhood/module1100.cpp | 6 | ||||
-rw-r--r-- | engines/neverhood/module1200.cpp | 13 | ||||
-rw-r--r-- | engines/neverhood/module1300.cpp | 16 | ||||
-rw-r--r-- | engines/neverhood/module1400.cpp | 24 | ||||
-rw-r--r-- | engines/neverhood/module1500.cpp | 6 | ||||
-rw-r--r-- | engines/neverhood/module1700.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/module1800.cpp | 8 | ||||
-rw-r--r-- | engines/neverhood/module2000.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/module2200.cpp | 8 | ||||
-rw-r--r-- | engines/neverhood/module2300.cpp | 10 | ||||
-rw-r--r-- | engines/neverhood/module3000.cpp | 16 |
12 files changed, 62 insertions, 63 deletions
diff --git a/engines/neverhood/module1000.cpp b/engines/neverhood/module1000.cpp index 14bc4a41ea..26b68e1c9a 100644 --- a/engines/neverhood/module1000.cpp +++ b/engines/neverhood/module1000.cpp @@ -89,7 +89,7 @@ void Module1000::updateScene() { break; case 1: if (_moduleResult == 1) - sendMessage(_parentModule, 0x1009, 0); + leaveModule(0); else if (_moduleResult == 2) createScene(3, 0); else @@ -408,12 +408,12 @@ uint32 Scene1001::handleMessage(int messageNum, const MessageParam ¶m, Entit switch (messageNum) { case 0x0001: if (param.asPoint().x == 0 && getGlobalVar(0xA4014072)) { - sendMessage(_parentModule, 0x1009, 0); + leaveScene(0); } break; case 0x000D: if (param.asInteger() == 0x188B2105) { - sendMessage(_parentModule, 0x1009, 0); + leaveScene(0); messageResult = 1; } break; @@ -1439,7 +1439,7 @@ uint32 Scene1002::handleMessage(int messageNum, const MessageParam ¶m, Entit if (param.asPoint().x == 0 && getGlobalVar(0xA4014072)) { setGlobalVar(0x8306F218, 1); setGlobalVar(0x1B144052, 3); - sendMessage(_parentModule, 0x1009, 1); + leaveScene(1); } break; case 0x000D: @@ -1447,7 +1447,7 @@ uint32 Scene1002::handleMessage(int messageNum, const MessageParam ¶m, Entit if (param.asInteger() == 0x48848178) { setGlobalVar(0x8306F218, 1); setGlobalVar(0x1B144052, 3); - sendMessage(_parentModule, 0x1009, 1); + leaveScene(1); } messageResult = 1; break; @@ -1577,7 +1577,7 @@ uint32 Class152::handleMessage(int messageNum, const MessageParam ¶m, Entity switch (messageNum) { case 0x0001: if (param.asPoint().x <= 20 || param.asPoint().x >= 620) { - sendMessage(_parentModule, 0x1009, 0); + leaveScene(0); } break; } @@ -1745,7 +1745,7 @@ uint32 Scene1005::handleMessage(int messageNum, const MessageParam ¶m, Entit switch (messageNum) { case 0x0001: if (param.asPoint().x <= 20 || param.asPoint().x >= 620) { - sendMessage(_parentModule, 0x1009, 0); + leaveScene(0); } break; } diff --git a/engines/neverhood/module1100.cpp b/engines/neverhood/module1100.cpp index 4bafbd96a1..740e4875bd 100644 --- a/engines/neverhood/module1100.cpp +++ b/engines/neverhood/module1100.cpp @@ -168,7 +168,7 @@ void Module1100::updateScene() { } break; case 6: - sendMessage(_parentModule, 0x1009, 1); + leaveModule(1); break; case 7: createScene(2, 2); @@ -177,7 +177,7 @@ void Module1100::updateScene() { if (_moduleResult == 0) { createScene(0, 0); } else if (_moduleResult == 1) { - sendMessage(_parentModule, 0x1009, 0); + leaveModule(0); } break; case 1002: @@ -651,7 +651,7 @@ void Scene1105::update() { createObjects(); } if (_flag4 && !_soundResource2.isPlaying()) { - sendMessage(_parentModule, 0x1009, _flag5); + leaveScene(_flag5); } if (_flag3 && !_soundResource3.isPlaying()) { sendMessage(_asTeddyBear, 0x2002, 0); diff --git a/engines/neverhood/module1200.cpp b/engines/neverhood/module1200.cpp index 8853dd0df4..83a9b5ccd9 100644 --- a/engines/neverhood/module1200.cpp +++ b/engines/neverhood/module1200.cpp @@ -77,10 +77,10 @@ void Module1200::updateScene() { if (getGlobalVar(0x0A18CA33) && !getGlobalVar(0x2A02C07B)) { createScene(2, -1); } else { - sendMessage(_parentModule, 0x1009, 1); + leaveModule(1); } } else { - sendMessage(_parentModule, 0x1009, 0); + leaveModule(0); } break; case 1: @@ -1157,9 +1157,8 @@ Scene1202::~Scene1202() { void Scene1202::update() { Scene::update(); if (_soundFlag) { - if (!_soundResource4.isPlaying()) { - sendMessage(_parentModule, 0x1009, 0); - } + if (!_soundResource4.isPlaying()) + leaveScene(0); } else if (_counter == 0 && isSolved()) { SetMessageHandler(&Scene1202::handleMessage453D90); setGlobalVar(0x000CF819, 1); @@ -1191,7 +1190,7 @@ uint32 Scene1202::handleMessage453C10(int messageNum, const MessageParam ¶m, case 0x0001: // TODO: Debug/Cheat stuff if ((param.asPoint().x <= 20 || param.asPoint().x >= 620) && !_soundFlag) { - sendMessage(_parentModule, 0x1009, 0); + leaveScene(0); } break; case 0x000D: @@ -1215,7 +1214,7 @@ uint32 Scene1202::handleMessage453D90(int messageNum, const MessageParam ¶m, switch (messageNum) { case 0x0001: if (param.asPoint().x <= 20 || param.asPoint().x >= 620) { - sendMessage(_parentModule, 0x1009, 0); + leaveScene(0); } break; } diff --git a/engines/neverhood/module1300.cpp b/engines/neverhood/module1300.cpp index 1f3716b2a1..75a185b96c 100644 --- a/engines/neverhood/module1300.cpp +++ b/engines/neverhood/module1300.cpp @@ -214,7 +214,7 @@ void Module1300::updateScene() { } else if (_moduleResult == 3) { createScene(2, 0); } else if (_moduleResult == 0) { - sendMessage(_parentModule, 0x1009, 0); + leaveModule(0); } else if (_moduleResult == 1) { createScene(10, -1); } @@ -522,7 +522,7 @@ uint32 Scene1302::handleMessage(int messageNum, const MessageParam ¶m, Entit break; case 0x2002: if (_klayman->getX() > 545) { - sendMessage(_parentModule, 0x1009, 1); + leaveScene(1); } break; case 0x2032: @@ -1036,7 +1036,7 @@ uint32 Scene1306::handleMessage416EB0(int messageNum, const MessageParam ¶m, SetMessageHandler(&Scene1306::handleMessage); break; case 0x4809: - sendMessage(_parentModule, 0x1009, 1); + leaveScene(1); break; case 0x482A: setSurfacePriority(_asElevator->getSurface(), 1100); @@ -1328,7 +1328,7 @@ void Scene1307::update() { _palette->startFadeToWhite(40); } if (_doLeaveScene && !_soundResource.isPlaying()) { - sendMessage(_parentModule, 0x1009, 1); + leaveScene(1); setGlobalVar(0x80455A41, 1); } } @@ -1368,7 +1368,7 @@ uint32 Scene1307::handleMessage(int messageNum, const MessageParam ¶m, Entit } } } else if (_countdown == 0 && !_asCurrKey && !_isInsertingKey) { - sendMessage(_parentModule, 0x1009, 0); + leaveScene(0); } } break; @@ -1724,7 +1724,7 @@ uint32 Scene1308::handleMessage(int messageNum, const MessageParam ¶m, Entit _klayman->setVisible(true); break; case 0x2001: - sendMessage(_parentModule, 0x1009, 0); + leaveScene(0); break; case 0x2003: _class601_1->setVisible(false); @@ -1868,7 +1868,7 @@ uint32 Scene1317::hmKlaymanAsKing(int messageNum, const MessageParam ¶m, Ent uint32 messageResult = Scene::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x3002: - sendMessage(_parentModule, 0x1009, 0); + leaveScene(0); break; } return messageResult; @@ -1878,7 +1878,7 @@ uint32 Scene1317::hmEndMovie(int messageNum, const MessageParam ¶m, Entity * uint32 messageResult = Scene::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x3002: - sendMessage(_parentModule, 0x1009, 0); + leaveScene(0); break; } return messageResult; diff --git a/engines/neverhood/module1400.cpp b/engines/neverhood/module1400.cpp index b1354584b0..0045064314 100644 --- a/engines/neverhood/module1400.cpp +++ b/engines/neverhood/module1400.cpp @@ -94,7 +94,7 @@ void Module1400::updateScene() { } else if (_moduleResult == 2) { createScene(3, 0); } else { - sendMessage(_parentModule, 0x1009, 0); + leaveModule(0); } break; case 1: @@ -755,9 +755,9 @@ uint32 Scene1401::handleMessage(int messageNum, const MessageParam ¶m, Entit break; case 0x1019: if (param.asInteger() != 0) { - sendMessage(_parentModule, 0x1009, 2); + leaveScene(2); } else { - sendMessage(_parentModule, 0x1009, 1); + leaveScene(1); } break; case 0x480B: @@ -968,7 +968,7 @@ uint32 Scene1402::handleMessage(int messageNum, const MessageParam ¶m, Entit case 0x100D: if (param.asInteger() == 0x00F43389) { if (getGlobalVar(0x70A1189C)) { - sendMessage(_parentModule, 0x1009, 0); + leaveScene(0); } else { clearRectList(); _klayman->setVisible(false); @@ -980,9 +980,9 @@ uint32 Scene1402::handleMessage(int messageNum, const MessageParam ¶m, Entit break; case 0x1019: if (param.asInteger()) { - sendMessage(_parentModule, 0x1009, 0); + leaveScene(0); } else { - sendMessage(_parentModule, 0x1009, 1); + leaveScene(1); } break; case 0x2000: @@ -992,7 +992,7 @@ uint32 Scene1402::handleMessage(int messageNum, const MessageParam ¶m, Entit break; case 0x2001: sub428230(); - sendMessage(_parentModule, 0x1009, 0); + leaveScene(0); break; case 0x2003: sub428230(); @@ -1277,7 +1277,7 @@ Scene1407::Scene1407(NeverhoodEngine *vm, Module *parentModule, int which) void Scene1407::update() { Scene::update(); if (_puzzleSolvedCountdown != 0 && (--_puzzleSolvedCountdown == 0)) { - sendMessage(_parentModule, 0x1009, 1); + leaveScene(1); } else if (_resetButtonCountdown != 0 && (--_resetButtonCountdown == 0)) { _ssResetButton->setVisible(false); } @@ -1291,7 +1291,7 @@ uint32 Scene1407::handleMessage(int messageNum, const MessageParam ¶m, Entit // TODO: Debug/Cheat stuff if (param.asPoint().x <= 20 || param.asPoint().x >= 620) { // Exit scene - sendMessage(_parentModule, 0x1009, 0); + leaveScene(0); } else if (param.asPoint().x >= 75 && param.asPoint().x <= 104 && param.asPoint().y >= 62 && param.asPoint().y <= 90) { // The reset button was clicked @@ -1391,7 +1391,7 @@ uint32 Scene1403::handleMessage(int messageNum, const MessageParam ¶m, Entit } break; case 0x1019: - sendMessage(_parentModule, 0x1009, 0); + leaveScene(0); break; case 0x1022: if (sender == _class489) { @@ -1515,7 +1515,7 @@ uint32 Scene1404::handleMessage(int messageNum, const MessageParam ¶m, Entit } break; case 0x1019: - sendMessage(_parentModule, 0x1009, 0); + leaveScene(0); break; case 0x4826: if (sender == _class489) { @@ -1708,7 +1708,7 @@ uint32 Scene1405::handleMessage(int messageNum, const MessageParam ¶m, Entit case 0x0001: // TODO: Debug/Cheat stuff if (param.asPoint().x <= 20 || param.asPoint().x >= 620) { - sendMessage(_parentModule, 0x1009, 0); + leaveScene(0); } break; case 0x000D: diff --git a/engines/neverhood/module1500.cpp b/engines/neverhood/module1500.cpp index 54a46851d6..76afb956ff 100644 --- a/engines/neverhood/module1500.cpp +++ b/engines/neverhood/module1500.cpp @@ -67,14 +67,14 @@ void Module1500::updateScene() { if (_flag) { createScene(2, -1); } else { - sendMessage(_parentModule, 0x1009, 0); + leaveModule(0); } break; case 3: createScene(0, -1); break; default: - sendMessage(_parentModule, 0x1009, 0); + leaveModule(0); break; } } @@ -119,7 +119,7 @@ void Scene1501::update() { _countdown1--; if (_countdown1 == 0) { _vm->_screen->clear(); - sendMessage(_parentModule, 0x1009, 0); + leaveScene(0); } } else if ((_countdown2 != 0 && (--_countdown2 == 0)) /*|| !_soundResource.isPlaying()*/) { _countdown1 = 12; diff --git a/engines/neverhood/module1700.cpp b/engines/neverhood/module1700.cpp index 8140608e8a..4426a7eb76 100644 --- a/engines/neverhood/module1700.cpp +++ b/engines/neverhood/module1700.cpp @@ -107,7 +107,7 @@ void Module1700::updateScene() { createScene(4, 0); break; case 4: - sendMessage(_parentModule, 0x1009, 1); + leaveModule(1); break; } } diff --git a/engines/neverhood/module1800.cpp b/engines/neverhood/module1800.cpp index d5aa789cbf..cce72b0a11 100644 --- a/engines/neverhood/module1800.cpp +++ b/engines/neverhood/module1800.cpp @@ -134,7 +134,7 @@ void Module1800::updateScene() { break; case 5: if (_moduleResult == 0) { - sendMessage(_parentModule, 0x1009, 2); + leaveModule(2); } else if (_moduleResult == 1) { createScene(4, 3); } @@ -143,14 +143,14 @@ void Module1800::updateScene() { createScene(8, -1); break; case 7: - sendMessage(_parentModule, 0x1009, 3); + leaveModule(3); break; case 8: - sendMessage(_parentModule, 0x1009, 1); + leaveModule(1); // TODO GameState stuff break; case 9: - sendMessage(_parentModule, 0x1009, 0); + leaveModule(0); break; } } else { diff --git a/engines/neverhood/module2000.cpp b/engines/neverhood/module2000.cpp index 22ee648731..9c0843c3e1 100644 --- a/engines/neverhood/module2000.cpp +++ b/engines/neverhood/module2000.cpp @@ -68,7 +68,7 @@ void Module2000::updateScene() { switch (_vm->gameState().sceneNum) { case 0: if (_moduleResult == 1) { - sendMessage(_parentModule, 0x1009, 0); + leaveModule(0); } else { createScene(1, 0); } diff --git a/engines/neverhood/module2200.cpp b/engines/neverhood/module2200.cpp index c37cdaced2..3751a6fe8a 100644 --- a/engines/neverhood/module2200.cpp +++ b/engines/neverhood/module2200.cpp @@ -229,7 +229,7 @@ void Module2200::updateScene() { } else if (_moduleResult == 2) { createScene(1, 0); } else { - sendMessage(_parentModule, 0x1009, 0); + leaveModule(0); } break; case 1: @@ -929,7 +929,7 @@ void Scene2202::update() { Scene::update(); if (_leaveScene && !_soundResource2.isPlaying()) { - sendMessage(_parentModule, 0x1009, 0); + leaveScene(0); } if (_isSolved && !_soundResource1.isPlaying()) { @@ -966,7 +966,7 @@ uint32 Scene2202::handleMessage(int messageNum, const MessageParam ¶m, Entit case 0x0001: // TODO Debug stuff if (param.asPoint().x <= 20 || param.asPoint().x >= 620) { - sendMessage(_parentModule, 0x1009, 0); + leaveScene(0); } break; case 0x000D: @@ -2356,7 +2356,7 @@ uint32 Scene2208::handleMessage(int messageNum, const MessageParam ¶m, Entit switch (messageNum) { case 0x0001: if (param.asPoint().x <= 40 || param.asPoint().x >= 600) { - sendMessage(_parentModule, 0x1009, 0); + leaveScene(0); } break; } diff --git a/engines/neverhood/module2300.cpp b/engines/neverhood/module2300.cpp index dd4144f74f..1513f7ba40 100644 --- a/engines/neverhood/module2300.cpp +++ b/engines/neverhood/module2300.cpp @@ -107,7 +107,7 @@ void Module2300::updateScene() { if (_moduleResult == 1) { createScene(1, 4); } else { - sendMessage(_parentModule, 0x1009, 0); + leaveModule(0); } break; case 1: @@ -120,21 +120,21 @@ void Module2300::updateScene() { } else if (_moduleResult == 4) { createScene(3, 1); } else if (_moduleResult == 5) { - sendMessage(_parentModule, 0x1009, 3); + leaveModule(3); } else { - sendMessage(_parentModule, 0x1009, 4); + leaveModule(4); } break; case 2: if (_moduleResult == 1) { - sendMessage(_parentModule, 0x1009, 3); + leaveModule(3); } else { createScene(1, 5); } break; case 3: if (_moduleResult == 1) { - sendMessage(_parentModule, 0x1009, 2); + leaveModule(2); } else { createScene(1, 1); } diff --git a/engines/neverhood/module3000.cpp b/engines/neverhood/module3000.cpp index e7714c08fd..f645fb475b 100644 --- a/engines/neverhood/module3000.cpp +++ b/engines/neverhood/module3000.cpp @@ -169,7 +169,7 @@ void Module3000::updateScene() { if (_moduleResult == 0) createScene(9, -1); else if (_moduleResult == 1) - sendMessage(_parentModule, 0x1009, 0); + leaveModule(0); } else { if (_moduleResult == 0) if (_navigationAreaType == 2) @@ -177,7 +177,7 @@ void Module3000::updateScene() { else createScene(1001, -1); else if (_moduleResult == 1) - sendMessage(_parentModule, 0x1009, 0); + leaveModule(0); } break; case 2: @@ -205,7 +205,7 @@ void Module3000::updateScene() { break; case 4: if (_moduleResult == 0) - sendMessage(_parentModule, 0x1009, 1); + leaveModule(1); else if (_moduleResult == 1) createScene(7, -1); else if (_moduleResult == 2) @@ -248,7 +248,7 @@ void Module3000::updateScene() { createScene(3, 3); break; case 11: - sendMessage(_parentModule, 0x1009, 3); + leaveModule(3); break; case 12: createScene(1, 0); @@ -931,7 +931,7 @@ uint32 Scene3009::handleMessage(int messageNum, const MessageParam ¶m, Entit // TODO: Debug stuff if ((param.asPoint().x <= 20 || param.asPoint().x >= 620) && !getGlobalVar(0x000809C2)) { setGlobalVar(0x20580A86, 0); - sendMessage(_parentModule, 0x1009, 0); + leaveScene(0); } break; case 0x000D: @@ -1014,7 +1014,7 @@ uint32 Scene3009::handleMessage(int messageNum, const MessageParam ¶m, Entit void Scene3009::playExtVideo() { setGlobalVar(0x20580A86, _cannonLocation); setGlobalVar(0xF0402B0A, kScene3009CannonLocationFileHashes[_cannonLocation]); - sendMessage(_parentModule, 0x1009, 1); + leaveScene(1); } bool Scene3009::isSymbolsPart1Solved() { @@ -1332,7 +1332,7 @@ void Scene3010::update() { _checkUnlocked = false; } if (_countdown != 0 && (--_countdown == 0)) { - sendMessage(_parentModule, 0x1009, _doorUnlocked ? 1 : 0); + leaveScene(_doorUnlocked ? 1 : 0); } } @@ -1608,7 +1608,7 @@ uint32 Scene3011::handleMessage(int messageNum, const MessageParam ¶m, Entit switch (messageNum) { case 0x0001: if (param.asPoint().x <= 20 || param.asPoint().x >= 620) { - sendMessage(_parentModule, 0x1009, 0); + leaveScene(0); } break; case 0x2000: |