diff options
author | johndoe123 | 2011-09-30 06:59:17 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2013-05-08 20:39:41 +0200 |
commit | a7dcbd0f335023615acdcdef514e614bd6a40f76 (patch) | |
tree | faf52f5a13ba601a675729ba01c8f7cf62f43b60 | |
parent | 21ebcf2af20bf96c32f5668952dba4ed7797a89c (diff) | |
download | scummvm-rg350-a7dcbd0f335023615acdcdef514e614bd6a40f76.tar.gz scummvm-rg350-a7dcbd0f335023615acdcdef514e614bd6a40f76.tar.bz2 scummvm-rg350-a7dcbd0f335023615acdcdef514e614bd6a40f76.zip |
NEVERHOOD: Add floor button ("Class429") to Scene2101
-rw-r--r-- | engines/neverhood/module2100.cpp | 45 | ||||
-rw-r--r-- | engines/neverhood/module2100.h | 14 |
2 files changed, 58 insertions, 1 deletions
diff --git a/engines/neverhood/module2100.cpp b/engines/neverhood/module2100.cpp index e07e990dc2..fa0d111f8b 100644 --- a/engines/neverhood/module2100.cpp +++ b/engines/neverhood/module2100.cpp @@ -156,6 +156,49 @@ uint32 Class539::handleMessage(int messageNum, const MessageParam ¶m, Entity return messageResult; } +Class427::Class427(NeverhoodEngine *vm, Scene *parentScene, uint32 fileHash1, uint32 fileHash2, int surfacePriority, uint32 soundFileHash) + : StaticSprite(vm, 1100), _soundResource(vm), _parentScene(parentScene), _countdown(0), + _fileHash1(fileHash1), _fileHash2(fileHash2), _soundFileHash(soundFileHash) { + + SetUpdateHandler(&Class427::update); + SetMessageHandler(&Class427::handleMessage); + if (_soundFileHash == 0) + _soundFileHash = 0x44141000; + createSurface(1010, 61, 30); + if (_fileHash1) { + load(_fileHash1, true, true); + StaticSprite::update(); + } else + setVisible(false); +} + +void Class427::update() { + if (_countdown != 0 && (--_countdown == 0)) { + sendMessage(_parentScene, 0x1022, 1010); + if (_fileHash1) { + load(_fileHash1, true, true); + StaticSprite::update(); + } else + setVisible(false); + } +} + +uint32 Class427::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); + switch (messageNum) { + case 0x480B: + sendMessage(_parentScene, 0x480B, 0); + setVisible(true); + sendMessage(_parentScene, 0x1022, 990); + load(_fileHash2, true, true); + StaticSprite::update(); + _countdown = 16; + _soundResource.play(_soundFileHash); + break; + } + return messageResult; +} + Scene2101::Scene2101(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule, true) { @@ -169,7 +212,7 @@ Scene2101::Scene2101(NeverhoodEngine *vm, Module *parentModule, int which) insertStaticSprite(0x00502330, 1100); _sprite1 = insertStaticSprite(0x78492010, 1100); - // TODO _class427 = insertSprite<Class427>(this, 0x72427010, 0x32423010, 200, 0); + _class427 = insertSprite<Class427>(this, 0x72427010, 0x32423010, 200, 0); _asTape1 = insertSprite<AsScene1201Tape>(this, 18, 1100, 412, 443, 0x9148A011); _vm->_collisionMan->addSprite(_asTape1); _asTape2 = insertSprite<AsScene1201Tape>(this, 11, 1100, 441, 443, 0x9148A011); diff --git a/engines/neverhood/module2100.h b/engines/neverhood/module2100.h index 3e7f579281..65846d7ded 100644 --- a/engines/neverhood/module2100.h +++ b/engines/neverhood/module2100.h @@ -60,6 +60,20 @@ protected: uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); }; +class Class427 : public StaticSprite { +public: + Class427(NeverhoodEngine *vm, Scene *parentScene, uint32 fileHash1, uint32 fileHash2, int surfacePriority, uint32 soundFileHash); +protected: + Scene *_parentScene; + SoundResource _soundResource; + uint32 _soundFileHash; + uint32 _fileHash1, _fileHash2; + int16 _countdown; + void update(); + uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); +}; + + class Scene2101 : public Scene { public: Scene2101(NeverhoodEngine *vm, Module *parentModule, int which); |