diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/neverhood/gamemodule.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/module2800.cpp | 71 | ||||
-rw-r--r-- | engines/neverhood/module2800.h | 15 |
3 files changed, 86 insertions, 2 deletions
diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index 248c873359..7ea115cfb9 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -328,7 +328,7 @@ void GameModule::startup() { createModule(2700, -1); #endif #if 1 - _vm->gameState().sceneNum = 7; + _vm->gameState().sceneNum = 2; createModule(2800, -1); #endif } diff --git a/engines/neverhood/module2800.cpp b/engines/neverhood/module2800.cpp index 353bb76d73..3a787ee013 100644 --- a/engines/neverhood/module2800.cpp +++ b/engines/neverhood/module2800.cpp @@ -290,6 +290,75 @@ uint32 Scene2801::handleMessage(int messageNum, const MessageParam ¶m, Entit return messageResult; } +Class488::Class488(NeverhoodEngine *vm, Scene *parentScene, uint32 fileHash1, uint32 fileHash2, int16 x, int16 y) + : AnimatedSprite(vm, 1100), _parentScene(parentScene), _fileHash1(fileHash1), _fileHash2(fileHash2), + _flag1(false), _flag2(false), _soundResource(vm) { + + createSurface(1010, 640, 480); // TODO Use correct size from the two hashes + SetUpdateHandler(&AnimatedSprite::update); + SetSpriteUpdate(&AnimatedSprite::updateDeltaXY); + _x = x; + _y = y; + sub4343C0(); +} + +uint32 Class488::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); + switch (messageNum) { + case 0x100D: + if (!_flag2 && param.asInteger() == calcHash("ClickSwitch")) { + sendMessage(_parentScene, 0x480F, 0); + _soundResource.play(0x4E1CA4A0); + } + break; + case 0x480F: + sub434380(); + break; + case 0x482A: + sendMessage(_parentScene, 0x1022, 990); + break; + case 0x482B: + sendMessage(_parentScene, 0x1022, 1010); + break; + } + return messageResult; +} + +uint32 Class488::handleMessage434340(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = handleMessage(messageNum, param, sender); + switch (messageNum) { + case 0x3002: + gotoNextState(); + break; + } + return messageResult; +} + +void Class488::sub434380() { + _flag2 = false; + _flag1 = true; + startAnimation(_fileHash2, 0, -1); + SetMessageHandler(&Class488::handleMessage434340); + NextState(&Class488::sub4343C0); +} + +void Class488::sub4343C0() { + _flag1 = false; + startAnimation(_fileHash1, 0, -1); + SetMessageHandler(&Class488::handleMessage); +} + +void Class488::setFileHashes(uint32 fileHash1, uint32 fileHash2) { + _fileHash1 = fileHash1; + _fileHash2 = fileHash2; + if (_flag1) { + startAnimation(_fileHash2, _currFrameIndex, -1); + _flag2 = true; + } else { + startAnimation(_fileHash1, 0, -1); + } +} + Scene2803b::Scene2803b(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule, true), _palStatus(0) { @@ -307,7 +376,7 @@ Scene2803b::Scene2803b(NeverhoodEngine *vm, Module *parentModule, int which) loadDataResource(0x81120132); insertMouse433(0x00A05290); - // TODO insertSprite<Class488>(this, 0xAFAD591A, 0x276E321D, 578, 200); + insertSprite<Class488>(this, 0xAFAD591A, 0x276E321D, 578, 200); if (getGlobalVar(0x190A1D18)) { setBackground(0x412A423E); diff --git a/engines/neverhood/module2800.h b/engines/neverhood/module2800.h index ed93c9fe32..4026093b1d 100644 --- a/engines/neverhood/module2800.h +++ b/engines/neverhood/module2800.h @@ -54,6 +54,21 @@ protected: uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); }; +class Class488 : public AnimatedSprite { +public: + Class488(NeverhoodEngine *vm, Scene *parentScene, uint32 fileHash1, uint32 fileHash2, int16 x, int16 y); + void sub434380(); + void sub4343C0(); + void setFileHashes(uint32 fileHash1, uint32 fileHash2); +protected: + Scene *_parentScene; + SoundResource _soundResource; + uint32 _fileHash1, _fileHash2; + bool _flag1, _flag2; + uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 handleMessage434340(int messageNum, const MessageParam ¶m, Entity *sender); +}; + class Scene2803b : public Scene { public: Scene2803b(NeverhoodEngine *vm, Module *parentModule, int which); |