diff options
author | Filippos Karapetis | 2013-10-05 21:50:33 +0300 |
---|---|---|
committer | Filippos Karapetis | 2013-10-05 21:50:33 +0300 |
commit | 8d1f601518971d1b90408fb714007a07deaa307b (patch) | |
tree | 18b0811714163ba0d9643c453288593e3b5dd4f9 /engines/neverhood/modules/module1100.cpp | |
parent | 1e87d135bedf9844e3e44a4261ffcb44aac67feb (diff) | |
download | scummvm-rg350-8d1f601518971d1b90408fb714007a07deaa307b.tar.gz scummvm-rg350-8d1f601518971d1b90408fb714007a07deaa307b.tar.bz2 scummvm-rg350-8d1f601518971d1b90408fb714007a07deaa307b.zip |
NEVERHOOD: Split sprites from their scenes in modules 1000 and 1100
Diffstat (limited to 'engines/neverhood/modules/module1100.cpp')
-rw-r--r-- | engines/neverhood/modules/module1100.cpp | 188 |
1 files changed, 8 insertions, 180 deletions
diff --git a/engines/neverhood/modules/module1100.cpp b/engines/neverhood/modules/module1100.cpp index faa0516d7e..1b226de456 100644 --- a/engines/neverhood/modules/module1100.cpp +++ b/engines/neverhood/modules/module1100.cpp @@ -21,6 +21,7 @@ */ #include "neverhood/modules/module1100.h" +#include "neverhood/modules/module1100_sprites.h" #include "neverhood/gamemodule.h" #include "neverhood/navigationscene.h" @@ -236,6 +237,13 @@ void Module1100::updateScene() { } } +static const uint32 kScene1105BackgroundFileHashes[] = { + 0x20018662, + 0x20014202, + 0x20012202, + 0x20010002 // CHECKME: This used ?? +}; + static const uint32 kScene1105FileHashes[] = { 0x00028006, 0x0100A425, @@ -249,186 +257,6 @@ static const uint32 kScene1105FileHashes[] = { 0xB14A891E }; -static const uint32 kScene1105BackgroundFileHashes[] = { - 0x20018662, - 0x20014202, - 0x20012202, - 0x20010002 // CHECKME: This used ?? -}; - -static const uint32 kSsScene1105SymbolDieFileHashes[] = { - 0, - 0x90898414, - 0x91098414, - 0x92098414, - 0x94098414, - 0x98098414, - 0x80098414, - 0xB0098414, - 0xD0098414, - 0x10098414 -}; - -SsScene1105Button::SsScene1105Button(NeverhoodEngine *vm, Scene *parentScene, uint32 fileHash, NRect &collisionBounds) - : StaticSprite(vm, fileHash, 200), _parentScene(parentScene), _countdown(0) { - - _collisionBounds = collisionBounds; - SetMessageHandler(&SsScene1105Button::handleMessage); - SetUpdateHandler(&SsScene1105Button::update); - setVisible(false); -} - -void SsScene1105Button::update() { - if (_countdown != 0 && (--_countdown == 0)) { - sendMessage(_parentScene, 0x4807, 0); - setVisible(false); - } -} - -uint32 SsScene1105Button::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); - switch (messageNum) { - case 0x1011: - if (_countdown == 0) { - sendMessage(_parentScene, 0x4826, 0); - messageResult = 1; - } - break; - case 0x480B: - _countdown = 8; - setVisible(true); - playSound(0, 0x44141000); - break; - } - return messageResult; -} - -SsScene1105Symbol::SsScene1105Symbol(NeverhoodEngine *vm, uint32 fileHash, int16 x, int16 y) - : StaticSprite(vm, 0) { - - loadSprite(fileHash, kSLFCenteredDrawOffset | kSLFSetPosition, 200, x, y); -} - -void SsScene1105Symbol::hide() { - setVisible(false); - _needRefresh = true; - updatePosition(); -} - -SsScene1105SymbolDie::SsScene1105SymbolDie(NeverhoodEngine *vm, uint dieIndex, int16 x, int16 y) - : StaticSprite(vm, 1100), _dieIndex(dieIndex) { - - _x = x; - _y = y; - createSurface(200, 50, 50); - loadSymbolSprite(); - SetMessageHandler(&SsScene1105SymbolDie::handleMessage); -} - -uint32 SsScene1105SymbolDie::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); - switch (messageNum) { - case 0x2000: - loadSymbolSprite(); - break; - } - return messageResult; -} - -void SsScene1105SymbolDie::loadSymbolSprite() { - loadSprite(kSsScene1105SymbolDieFileHashes[getSubVar(VA_CURR_DICE_NUMBERS, _dieIndex)], kSLFCenteredDrawOffset); -} - -void SsScene1105SymbolDie::hide() { - setVisible(false); - _needRefresh = true; - updatePosition(); -} - -AsScene1105TeddyBear::AsScene1105TeddyBear(NeverhoodEngine *vm, Scene *parentScene) - : AnimatedSprite(vm, 1100), _parentScene(parentScene) { - - createSurface(100, 556, 328); - _x = 320; - _y = 240; - SetUpdateHandler(&AnimatedSprite::update); - SetMessageHandler(&AsScene1105TeddyBear::handleMessage); - startAnimation(0x65084002, 0, -1); - _newStickFrameIndex = 0; - setVisible(false); - _needRefresh = true; - updatePosition(); - loadSound(0, 0xCE840261); - loadSound(1, 0xCCA41A62); -} - -uint32 AsScene1105TeddyBear::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); - switch (messageNum) { - case 0x2002: - if (getGlobalVar(V_ROBOT_TARGET)) { - startAnimation(0x6B0C0432, 0, -1); - playSound(0); - } else { - startAnimation(0x65084002, 0, -1); - playSound(1); - } - break; - case 0x3002: - sendMessage(_parentScene, 0x2003, 0); - stopAnimation(); - break; - } - return messageResult; -} - -void AsScene1105TeddyBear::show() { - setVisible(true); - _needRefresh = true; - updatePosition(); -} - -void AsScene1105TeddyBear::hide() { - setVisible(false); - _needRefresh = true; - updatePosition(); -} - -SsScene1105OpenButton::SsScene1105OpenButton(NeverhoodEngine *vm, Scene *parentScene) - : StaticSprite(vm, 900), _parentScene(parentScene), _countdown(0), _isClicked(false) { - - loadSprite(0x8228A46C, kSLFDefDrawOffset | kSLFDefPosition | kSLFDefCollisionBoundsOffset, 400); - setVisible(false); - loadSound(0, 0x44045140); - SetUpdateHandler(&SsScene1105OpenButton::update); - SetMessageHandler(&SsScene1105OpenButton::handleMessage); -} - -void SsScene1105OpenButton::update() { - updatePosition(); - if (_countdown != 0 && (--_countdown == 0)) { - setVisible(false); - sendMessage(_parentScene, 0x2001, 0); - } -} - -uint32 SsScene1105OpenButton::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { - uint32 messageResult = 0; - Sprite::handleMessage(messageNum, param, sender); - switch (messageNum) { - case 0x1011: - if (_countdown == 0 && !_isClicked) { - playSound(0); - setVisible(true); - _isClicked = true; - _countdown = 4; - } - messageResult = 1; - break; - } - return messageResult; -} - Scene1105::Scene1105(NeverhoodEngine *vm, Module *parentModule) : Scene(vm, parentModule), _countdown(0), _isPanelOpen(false), _isActionButtonClicked(false), _doMoveTeddy(false), _isClosePanelDone(false), _leaveResult(0), _backgroundIndex(0) { |