diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/neverhood/gamemodule.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/module1300.cpp | 181 | ||||
-rw-r--r-- | engines/neverhood/module1300.h | 26 | ||||
-rw-r--r-- | engines/neverhood/smackerplayer.cpp | 20 | ||||
-rw-r--r-- | engines/neverhood/smackerplayer.h | 2 |
5 files changed, 226 insertions, 5 deletions
diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index 6e7eb157a1..fc2ca8ed03 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -284,7 +284,7 @@ void GameModule::startup() { createModule2200(-1); #endif #if 1 - _vm->gameState().sceneNum = 7; + _vm->gameState().sceneNum = 16; createModule1300(-1); #endif } diff --git a/engines/neverhood/module1300.cpp b/engines/neverhood/module1300.cpp index c5d2870c87..7de50b11cb 100644 --- a/engines/neverhood/module1300.cpp +++ b/engines/neverhood/module1300.cpp @@ -207,6 +207,11 @@ void Module1300::createScene1308(int which) { } 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) { @@ -256,6 +261,11 @@ void Module1300::createScene1316(int which) { } 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) { @@ -359,6 +369,14 @@ void Module1300::updateScene1308() { } void Module1300::updateScene1309() { + _childObject->handleUpdate(); + if (_done) { + _done = false; + delete _childObject; + _childObject = NULL; + createScene1306(2); + _childObject->handleUpdate(); + } } void Module1300::updateScene1310() { @@ -452,6 +470,14 @@ void Module1300::updateScene1316() { } void Module1300::updateScene1317() { + _childObject->handleUpdate(); + if (_done) { + _done = false; + delete _childObject; + _childObject = NULL; + createScene1318(-1); + _childObject->handleUpdate(); + } } void Module1300::updateScene1318() { @@ -1991,4 +2017,159 @@ uint32 Scene1308::handleMessage(int messageNum, const MessageParam ¶m, Entit return 0; } +Scene1317::Scene1317(NeverhoodEngine *vm, Module *parentModule, int which) + : Scene(vm, parentModule, true) { + + SetMessageHandler(&Scene1317::handleMessage); + _smackerPlayer = addSmackerPlayer(new SmackerPlayer(_vm, this, 0x08982841, true, false)); + _mouseCursor = addSprite(new Mouse433(_vm, 0x08284011, NULL)); + _mouseCursor->getSurface()->setVisible(false); + _smackerFileHash = 0; + _smackerFlag1 = false; +} + +void Scene1317::update() { + if (_smackerFileHash) { + _smackerPlayer->open(_smackerFileHash, _smackerFlag1); + _smackerFileHash = 0; + } + Scene::update(); +} + +void Scene1317::upChooseKing() { + if (!_klaymanBlinks && _klaymanBlinkCountdown != 0 && (--_klaymanBlinkCountdown == 0)) + _klaymanBlinks = true; + + if (!_klaymanBlinks && _smackerPlayer->getFrameNumber() + 1 >= 2) { + _smackerPlayer->rewind(); + } else if (_klaymanBlinks && _smackerPlayer->getFrameNumber() + 1 >= 6) { + _smackerPlayer->rewind(); + _klaymanBlinks = false; + _klaymanBlinkCountdown = _vm->_rnd->getRandomNumber(30 - 1) + 15; + } + + if (!_klaymanBlinks && _decisionCountdown != 0 && (--_decisionCountdown == 0)) + stNoDecisionYet(); + + if (_smackerFileHash) { + _smackerPlayer->open(_smackerFileHash, _smackerFlag1); + _smackerFileHash = 0; + } + + Scene::update(); + +} + +uint32 Scene1317::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = Scene::handleMessage(messageNum, param, sender); + switch (messageNum) { + case 0x3002: + stChooseKing(); + break; + } + return messageResult; +} + +uint32 Scene1317::hmChooseKing(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = Scene::handleMessage(messageNum, param, sender); + switch (messageNum) { + case 0x0001: + if (param.asPoint().x >= 21 && param.asPoint().y >= 24 && + param.asPoint().x <= 261 && param.asPoint().y <= 280) { + stHoborgAsKing(); + } else if (param.asPoint().x >= 313 && param.asPoint().y >= 184 && + param.asPoint().x <= 399 && param.asPoint().y <= 379) { + stKlaymanAsKing(); + } else if (param.asPoint().x >= 347 && param.asPoint().y >= 380 && + param.asPoint().x <= 418 && param.asPoint().y <= 474) { + stKlaymanAsKing(); + } + break; + } + return messageResult; +} + +uint32 Scene1317::hmNoDecisionYet(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = Scene::handleMessage(messageNum, param, sender); + switch (messageNum) { + case 0x3002: + stChooseKing(); + break; + } + return messageResult; +} + +uint32 Scene1317::hmHoborgAsKing(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = Scene::handleMessage(messageNum, param, sender); + switch (messageNum) { + case 0x3002: + stEndMovie(); + break; + } + return messageResult; +} + +uint32 Scene1317::hmKlaymanAsKing(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = Scene::handleMessage(messageNum, param, sender); + switch (messageNum) { + case 0x3002: + _parentModule->sendMessage(0x1009, 0, this); + break; + } + return messageResult; +} + +uint32 Scene1317::hmEndMovie(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = Scene::handleMessage(messageNum, param, sender); + switch (messageNum) { + case 0x3002: + _parentModule->sendMessage(0x1009, 0, this); + break; + } + return messageResult; +} + +void Scene1317::stChooseKing() { + _mouseCursor->getSurface()->setVisible(true); + SetMessageHandler(&Scene1317::hmChooseKing); + SetUpdateHandler(&Scene1317::upChooseKing); + _smackerFileHash = 0x10982841; + _smackerFlag1 = true; + _decisionCountdown = 450; + _klaymanBlinks = false; + _klaymanBlinkCountdown = _vm->_rnd->getRandomNumber(30 - 1) + 15; +} + +void Scene1317::stNoDecisionYet() { + _mouseCursor->getSurface()->setVisible(false); + SetMessageHandler(&Scene1317::hmNoDecisionYet); + SetUpdateHandler(&Scene1317::update); + _smackerFileHash = 0x20982841; + _smackerFlag1 = false; +} + +void Scene1317::stHoborgAsKing() { + _mouseCursor->getSurface()->setVisible(false); + SetMessageHandler(&Scene1317::hmHoborgAsKing); + SetUpdateHandler(&Scene1317::update); + _smackerFileHash = 0x40982841; + _smackerFlag1 = false; +} + +void Scene1317::stKlaymanAsKing() { + _mouseCursor->getSurface()->setVisible(false); + SetMessageHandler(&Scene1317::hmKlaymanAsKing); + SetUpdateHandler(&Scene1317::update); + _smackerFileHash = 0x80982841; + _smackerFlag1 = false; +} + +void Scene1317::stEndMovie() { + _mouseCursor->getSurface()->setVisible(false); + SetMessageHandler(&Scene1317::hmEndMovie); + SetUpdateHandler(&Scene1317::update); + _smackerFileHash = 0x40800711; + _smackerFlag1 = false; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/module1300.h b/engines/neverhood/module1300.h index 8e142022cd..0e9837cc96 100644 --- a/engines/neverhood/module1300.h +++ b/engines/neverhood/module1300.h @@ -26,6 +26,7 @@ #include "neverhood/neverhood.h" #include "neverhood/module.h" #include "neverhood/scene.h" +#include "neverhood/smackerplayer.h" namespace Neverhood { @@ -322,6 +323,31 @@ protected: uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); }; +class Scene1317 : public Scene { +public: + Scene1317(NeverhoodEngine *vm, Module *parentModule, int which); +protected: + SmackerPlayer *_smackerPlayer; + bool _klaymanBlinks; + int _klaymanBlinkCountdown; + int _decisionCountdown; + uint32 _smackerFileHash; + bool _smackerFlag1; + void update(); + void upChooseKing(); + uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 hmChooseKing(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 hmNoDecisionYet(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 hmHoborgAsKing(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 hmKlaymanAsKing(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 hmEndMovie(int messageNum, const MessageParam ¶m, Entity *sender); + void stChooseKing(); + void stNoDecisionYet(); + void stHoborgAsKing(); + void stKlaymanAsKing(); + void stEndMovie(); +}; + } // End of namespace Neverhood #endif /* NEVERHOOD_MODULE1300_H */ diff --git a/engines/neverhood/smackerplayer.cpp b/engines/neverhood/smackerplayer.cpp index 39f49cb6e7..0ebec5ee9f 100644 --- a/engines/neverhood/smackerplayer.cpp +++ b/engines/neverhood/smackerplayer.cpp @@ -170,10 +170,9 @@ void SmackerPlayer::update() { _dirtyFlag = false; } +#if 0 if (!_smackerDecoder->endOfVideo()) { - updateFrame(); - if (_smackerDecoder->endOfVideo() && !_keepLastFrame) { // Inform the scene about the end of the video playback if (_scene) { @@ -187,8 +186,23 @@ void SmackerPlayer::update() { } _flag2 = false; } - } +#endif + + if (!_smackerDecoder->endOfVideo()) { + updateFrame(); + } else if (!_keepLastFrame) { + // Inform the scene about the end of the video playback + if (_scene) { + _scene->sendMessage(0x3002, 0, this); + } + _flag2 = true; + } else { + rewind(); + updateFrame(); + _flag2 = false; + } + } void SmackerPlayer::updateFrame() { diff --git a/engines/neverhood/smackerplayer.h b/engines/neverhood/smackerplayer.h index fb7f6daa96..883cb52245 100644 --- a/engines/neverhood/smackerplayer.h +++ b/engines/neverhood/smackerplayer.h @@ -59,6 +59,7 @@ public: uint32 getFrameNumber(); uint getStatus(); void setDrawPos(int16 x, int16 y); + void rewind(); protected: Scene *_scene; Palette *_palette; @@ -72,7 +73,6 @@ protected: bool _flag2; bool _dirtyFlag; int _drawX, _drawY; - void rewind(); void update(); void updateFrame(); void updatePalette(); |