diff options
author | johndoe123 | 2011-07-18 20:20:23 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2013-05-08 20:38:48 +0200 |
commit | f162516f25150cf5ca149986731f7f4e8f7da437 (patch) | |
tree | 5efd8f17995ec62f03d246d697e753091aa5cc6d /engines | |
parent | 0632fc7dda2b0ad97f22105a3fb6fbcd3346feb9 (diff) | |
download | scummvm-rg350-f162516f25150cf5ca149986731f7f4e8f7da437.tar.gz scummvm-rg350-f162516f25150cf5ca149986731f7f4e8f7da437.tar.bz2 scummvm-rg350-f162516f25150cf5ca149986731f7f4e8f7da437.zip |
NEVERHOOD: More work on Scene1201
Diffstat (limited to 'engines')
-rw-r--r-- | engines/neverhood/klayman.cpp | 26 | ||||
-rw-r--r-- | engines/neverhood/klayman.h | 2 | ||||
-rw-r--r-- | engines/neverhood/module1200.cpp | 77 | ||||
-rw-r--r-- | engines/neverhood/module1200.h | 22 |
4 files changed, 109 insertions, 18 deletions
diff --git a/engines/neverhood/klayman.cpp b/engines/neverhood/klayman.cpp index 145d645e01..91de87d7f5 100644 --- a/engines/neverhood/klayman.cpp +++ b/engines/neverhood/klayman.cpp @@ -485,7 +485,6 @@ void Klayman::sub41C930(int16 x, bool flag) { error("// TODO AnimatedSprite_setCallback2(AnimationCallback(&Klayman::sub421550));"); // TODO AnimatedSprite_setCallback2(AnimationCallback(&Klayman::sub421550)); } else { - debug("##################################################################"); _x4 = x; setCallback2(AnimationCallback(&Klayman::sub41F950)); } @@ -773,8 +772,7 @@ void Klayman::sub41FA40() { if (_status3 == 2) { sub41C7B0(); } else if (_status3 == 3) { - error("// TODO sub420F20();"); - // TODO sub420F20(); + sub420F20(); } else { _flagE2 = true; _flagE5 = true; @@ -1626,6 +1624,23 @@ void Klayman::sub4207F0() { SetMessageHandler(&Klayman::handleMessage41EEF0); } +void Klayman::sub420F20() { + _flagF8 = false; + _flagE5 = false; + setFileHash(0x11A8E012, 0, -1); + SetUpdateHandler(&Klayman::update); + SetSpriteCallback(&Klayman::spriteUpdate41F5A0); + SetMessageHandler(&Klayman::handleMessage41EC70); +} + +void Klayman::spriteUpdate41F5A0() { + if (!_flagF8 && ABS(_x4 - _x) < 80) { + _parentScene->sendMessage(0x4829, 0, this); + _flagF8 = true; + } + AnimatedSprite::updateDeltaXY(); +} + //############################################################################## // KmScene1001 @@ -1758,8 +1773,6 @@ void KmScene1002::xUpdate() { uint32 KmScene1002::xHandleMessage(int messageNum, const MessageParam ¶m) { //ok debug("KmScene1002::xHandleMessage(%04X)", messageNum); - if (messageNum == 0x100D) - debug("-> %08X", param.asInteger()); switch (messageNum) { case 0x2001: setCallback2(AnimationCallback(&KmScene1002::sub449E90)); @@ -1908,9 +1921,6 @@ uint32 KmScene1002::handleMessage4498E0(int messageNum, const MessageParam ¶ _x = ((Sprite*)sender)->getX() + 75; } _y = ((Sprite*)sender)->getY() - 200; - - debug("&&&&&&&&&&& param.asInteger() = %d", param.asInteger()); - if (param.asInteger() == 0) { sub449EF0(); } else if (param.asInteger() == 1) { diff --git a/engines/neverhood/klayman.h b/engines/neverhood/klayman.h index 3c87104125..3682d75e69 100644 --- a/engines/neverhood/klayman.h +++ b/engines/neverhood/klayman.h @@ -84,11 +84,13 @@ public: void sub420ED0(); void sub4207A0(); void sub4207F0(); + void sub420F20(); void spriteUpdate41F250(); void spriteUpdate41F5F0(); void spriteUpdate41F780(); void spriteUpdate41F230(); + void spriteUpdate41F5A0(); uint32 handleMessage41D360(int messageNum, const MessageParam ¶m, Entity *sender); uint32 handleMessage41D480(int messageNum, const MessageParam ¶m, Entity *sender); diff --git a/engines/neverhood/module1200.cpp b/engines/neverhood/module1200.cpp index 8075c5c391..eef543385c 100644 --- a/engines/neverhood/module1200.cpp +++ b/engines/neverhood/module1200.cpp @@ -478,6 +478,69 @@ void Class463::sub40CD90() { _newHashListIndex = -2; } +Class465::Class465(NeverhoodEngine *vm, Sprite *class463) + : AnimatedSprite(vm, 1200), _class463(class463) { + + createSurface1(995, 0x828C0411); + SetUpdateHandler(&Class465::update); + SetMessageHandler(&Sprite::handleMessage); + SetSpriteCallback(&Class465::spriteUpdate40D150); + setFileHash(0x828C0411, 0, -1); + _surface->setVisible(false); +} + +Class465::~Class465() { + // TODO Sound1ChList_sub_407AF0(0x041080A4); +} + +void Class465::update() { + AnimatedSprite::update(); + if (getGlobalVar(0x20A0C516)) { + _surface->setVisible(true); + SetUpdateHandler(&AnimatedSprite::update); + // TODO Sound1ChList_addSoundResource(0x041080A4, 0x460A1050, true); + // TODO Sound1ChList_playLooping(0x460A1050); + } +} + +void Class465::spriteUpdate40D150() { + _x = _class463->getX() - 18; + _y = _class463->getY() - 158; +} + +AsScene1201LeftDoor::AsScene1201LeftDoor(NeverhoodEngine *vm, Sprite *klayman) + : AnimatedSprite(vm, 1100), _soundResource(vm), _klayman(klayman) { + + _x = 320; + _y = 240; + createSurface(800, 55, 199); + if (_klayman->getX() < 100) { + setFileHash(0x508A111B, 0, -1); + _newHashListIndex = -2; + _soundResource.play(calcHash("fxDoorOpen03")); + } else { + setFileHash(0x508A111B, -1, -1); + _newHashListIndex = -2; + } + SetUpdateHandler(&AnimatedSprite::update); + SetMessageHandler(&AsScene1201LeftDoor::handleMessage); +} + +uint32 AsScene1201LeftDoor::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); + switch (messageNum) { + case 0x4809: + sub40D590(); + break; + } + return messageResult; +} + +void AsScene1201LeftDoor::sub40D590() { + setFileHash(0x508A111B, -1, -1); + _playBackwards = true; + _newHashListIndex = 0; +} Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule, true), _flag(false) { @@ -600,13 +663,11 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) class463->getSurface()->getClipRect().y2 = 480; _vm->_collisionMan->addSprite(_class463); _class463 = addSprite(class463); -#if 0 tempSprite = addSprite(new Class465(_vm, _class463)); tempSprite->getSurface()->getClipRect().x1 = x1; tempSprite->getSurface()->getClipRect().y1 = 0; tempSprite->getSurface()->getClipRect().x2 = x2; tempSprite->getSurface()->getClipRect().y2 = 480; -#endif class463->setRepl(64, 0); } @@ -670,13 +731,11 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) tempSprite = addSprite(new StaticSprite(_vm, 0x63D400BC, 900)); -#if 0 - _class467 = addSprite(new Class467(_vm, _klayman)); - _class467->getSurface()->getClipRect().x1 = x1; - _class467->getSurface()->getClipRect().y1 = tempSprite->getSurface()->getDrawRect().y; - _class467->getSurface()->getClipRect().x2 = tempSprite->getSurface()->getDrawRect().x + tempSprite->getSurface()->getDrawRect().width; - _class467->getSurface()->getClipRect().y2 = 480; -#endif + _asLeftDoor = addSprite(new AsScene1201LeftDoor(_vm, _klayman)); + _asLeftDoor->getSurface()->getClipRect().x1 = x1; + _asLeftDoor->getSurface()->getClipRect().y1 = tempSprite->getSurface()->getDrawRect().y; + _asLeftDoor->getSurface()->getClipRect().x2 = tempSprite->getSurface()->getDrawRect().x + tempSprite->getSurface()->getDrawRect().width; + _asLeftDoor->getSurface()->getClipRect().y2 = 480; if (getGlobalVar(0x0A310817) && ! getGlobalVar(0x0112090A)) { setGlobalVar(0x0112090A, 1); diff --git a/engines/neverhood/module1200.h b/engines/neverhood/module1200.h index bbdfaeb634..2a8a933b59 100644 --- a/engines/neverhood/module1200.h +++ b/engines/neverhood/module1200.h @@ -109,6 +109,26 @@ protected: void sub40CD90(); }; +class Class465 : public AnimatedSprite { +public: + Class465(NeverhoodEngine *vm, Sprite *class463); + ~Class465(); +protected: + Sprite *_class463; + void update(); + void spriteUpdate40D150(); +}; + +class AsScene1201LeftDoor : public AnimatedSprite { +public: + AsScene1201LeftDoor(NeverhoodEngine *vm, Sprite *klayman); +protected: + Sprite *_klayman; + SoundResource _soundResource; + uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); + void sub40D590(); +}; + class SsScene1201Tnt : public StaticSprite { public: SsScene1201Tnt(NeverhoodEngine *vm, uint32 elemIndex, uint32 pointIndex, int16 clipY2); @@ -128,7 +148,7 @@ protected: Sprite *_class463; Sprite *_class462; Sprite *_class466; - Sprite *_class467; + Sprite *_asLeftDoor; Sprite *_class468; Sprite *_asTape; bool _flag; |