diff options
author | johndoe123 | 2011-09-15 11:48:51 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2013-05-08 20:39:38 +0200 |
commit | 3e122b002c08162fdbc841e9df8a73c95358b0a4 (patch) | |
tree | 0559ed1097fe37a500b2d418d3398fef1e43a0dd | |
parent | 85a216737cd1a8c8946dfd4ac7eafd68caeb6c09 (diff) | |
download | scummvm-rg350-3e122b002c08162fdbc841e9df8a73c95358b0a4.tar.gz scummvm-rg350-3e122b002c08162fdbc841e9df8a73c95358b0a4.tar.bz2 scummvm-rg350-3e122b002c08162fdbc841e9df8a73c95358b0a4.zip |
NEVERHOOD: Add Scene1308 (renaming of stuff todo)
-rw-r--r-- | engines/neverhood/gamemodule.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/klayman.cpp | 135 | ||||
-rw-r--r-- | engines/neverhood/klayman.h | 10 | ||||
-rw-r--r-- | engines/neverhood/module1300.cpp | 394 | ||||
-rw-r--r-- | engines/neverhood/module1300.h | 68 |
5 files changed, 608 insertions, 1 deletions
diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index 277b55da7c..6e7eb157a1 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 = 6; + _vm->gameState().sceneNum = 7; createModule1300(-1); #endif } diff --git a/engines/neverhood/klayman.cpp b/engines/neverhood/klayman.cpp index 739c8ad6fa..26f9d1afae 100644 --- a/engines/neverhood/klayman.cpp +++ b/engines/neverhood/klayman.cpp @@ -3231,6 +3231,141 @@ uint32 KmScene1306::handleMessage417CB0(int messageNum, const MessageParam ¶ return messageResult; } +KmScene1308::KmScene1308(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) + : Klayman(vm, parentScene, x, y, 1000, 1000) { + + _flag1 = false; +} + +uint32 KmScene1308::xHandleMessage(int messageNum, const MessageParam ¶m) { + switch (messageNum) { + case 0x4001: + case 0x4800: + sub41C930(param.asPoint().x, false); + break; + case 0x4004: + setCallback2(AnimationCallback(&Klayman::sub41FC80)); + break; + case 0x480A: + if (param.asInteger() == 1) { + setCallback2(AnimationCallback(&Klayman::sub420600)); + } else { + setCallback2(AnimationCallback(&Klayman::sub420550)); + } + break; + case 0x480D: + setCallback2(AnimationCallback(&KmScene1001::sub420C50)); + break; + case 0x4812: + if (param.asInteger() == 2) { + setCallback2(AnimationCallback(&Klayman::sub420060)); + } else if (param.asInteger() == 1) { + setCallback2(AnimationCallback(&Klayman::sub41FFF0)); + } else { + setCallback2(AnimationCallback(&Klayman::sub41FF80)); + } + break; + case 0x4817: + setDoDeltaX(param.asInteger()); + sub41C7B0(); + break; + case 0x481A: + if (param.asInteger() == 1) { + setCallback2(AnimationCallback(&KmScene1308::sub456150)); + } else { + setCallback2(AnimationCallback(&Klayman::sub420680)); + } + break; + case 0x481B: + if (param.asPoint().y != 0) { + sub41CC40(param.asPoint().y, param.asPoint().x); + } else { + sub41CCE0(param.asPoint().x); + } + break; + case 0x481D: + setCallback2(AnimationCallback(&Klayman::sub4207A0)); + break; + case 0x481E: + setCallback2(AnimationCallback(&Klayman::sub4207F0)); + break; + case 0x4827: + setCallback2(AnimationCallback(&Klayman::sub420E20)); + break; + case 0x4834: + setCallback2(AnimationCallback(&Klayman::sub421160)); + break; + case 0x483F: + sub41CD00(param.asInteger()); + break; + case 0x4840: + sub41CD70(param.asInteger()); + break; + } + return 0; +} + +uint32 KmScene1308::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = Klayman::handleMessage41D480(messageNum, param, sender); + switch (messageNum) { + case 0x100D: + if (!_flag1 && param.asInteger() == 0x06040580) { + setFileHash3(0xDC409440, 0x46431401, 0); + } else if (_flag1 && param.asInteger() == 0x46431401) { + _flag1 = false; + setFileHash2(0xDC409440, 0x01084280, 0); + } else if (param.asInteger() == 0x062A1510) { + _soundResource1.play(0x41688704); + } else if (param.asInteger() == 0x02B20220) { + _soundResource1.play(0xC5408620); + } else if (param.asInteger() == 0x0A720138) { + _soundResource1.play(0xD4C08010); + } else if (param.asInteger() == 0xB613A180) { + _soundResource1.play(0x44051000); + } else if (param.asInteger() == 0x0E4C8141) { + _soundResource1.play(0xDC4A1280); + } + break; + } + return messageResult; +} + +void KmScene1308::sub456150() { + if (!sub41CF10(AnimationCallback(&KmScene1308::sub456150))) { + _status2 = 2; + _flag1 = false; + for (uint i = 0; i < 3; i++) { + if (getSubVar(0x0090EA95, i)) { + bool more; + setSubVar(0x08D0AB11, i, 1); + setSubVar(0x0090EA95, i, 0); + do { + more = false; + setSubVar(0xA010B810, i, _vm->_rnd->getRandomNumber(16 - 1)); + for (uint j = 0; j < i && !more; j++) { + if (getSubVar(0x08D0AB11, j) && getSubVar(0xA010B810, j) == getSubVar(0xA010B810, i)) + more = true; + } + if (getSubVar(0xA010B810, i) == getSubVar(0x0C10A000, i)) + more = true; + } while (more); + _flag1 = true; + } + } + if (!_flag1) { + setCallback2(NULL); + sub41C7B0(); + } else { + _flagE5 = false; + setFileHash(0xDC409440, 0, -1); + SetUpdateHandler(&Klayman::update); + SetSpriteCallback(&Klayman::spriteUpdate41F250); + SetMessageHandler(&KmScene1308::handleMessage); + _flag1 = false; + } + } +} + // KmScene1401 KmScene1401::KmScene1401(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) diff --git a/engines/neverhood/klayman.h b/engines/neverhood/klayman.h index 118e8131e3..a5381c8dd1 100644 --- a/engines/neverhood/klayman.h +++ b/engines/neverhood/klayman.h @@ -362,6 +362,16 @@ protected: void sub417D80(); }; +class KmScene1308 : public Klayman { +public: + KmScene1308(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); +protected: + bool _flag1; + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); + uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); + void sub456150(); +}; + class KmScene1401 : public Klayman { public: KmScene1401(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); diff --git a/engines/neverhood/module1300.cpp b/engines/neverhood/module1300.cpp index 27f8a11f75..c5d2870c87 100644 --- a/engines/neverhood/module1300.cpp +++ b/engines/neverhood/module1300.cpp @@ -23,6 +23,7 @@ #include "neverhood/module1300.h" #include "neverhood/module1000.h" #include "neverhood/module1200.h" +#include "neverhood/module1400.h" #include "neverhood/module2200.h" #include "neverhood/gamemodule.h" #include "neverhood/diskplayerscene.h" @@ -198,6 +199,11 @@ void Module1300::createScene1307(int which) { } void Module1300::createScene1308(int which) { + _vm->gameState().sceneNum = 7; + // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0); + // TODO Music18hList_play(0x203197, 0, 2, 1); + _childObject = new Scene1308(_vm, this, which); + SetUpdateHandler(&Module1300::updateScene1308); } void Module1300::createScene1309(int which) { @@ -336,6 +342,20 @@ void Module1300::updateScene1307() { } void Module1300::updateScene1308() { + _childObject->handleUpdate(); + if (_done) { + _done = false; + delete _childObject; + _childObject = NULL; + if (_field20 == 0) { + createScene1314(0); + } else if (_field20 == 1) { + createScene1302(0); + } else if (_field20 == 2) { + createScene1307(0); + } + _childObject->handleUpdate(); + } } void Module1300::updateScene1309() { @@ -1597,4 +1617,378 @@ uint32 Scene1307::handleMessage(int messageNum, const MessageParam ¶m, Entit return messageResult; } +static const uint32 kScene1308FileHashes[] = { + 0x08006320, + 0x10006320, + 0x20006320, + 0x40006320, + 0x80006320, + 0x00006321, + 0x00006322, + 0x00006324, + 0x00006328, + 0x08306320, + 0x10306320, + 0x20306320, + 0x40306320, + 0x80306320, + 0x00306321, + 0x00306322 +}; + +Class549::Class549(NeverhoodEngine *vm, Scene *parentScene) + : AnimatedSprite(vm, 0xBA0AE050, 1100, 320, 240), _soundResource(vm), + _parentScene(parentScene) { + + SetMessageHandler(&Class549::handleMessage); + _surface->setVisible(false); + setFileHash1(); +} + +uint32 Class549::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); + switch (messageNum) { + case 0x3002: + removeCallbacks(); + break; + case 0x4808: + sub455470(); + break; + case 0x4809: + sub4554F0(); + break; + } + return messageResult; +} + +void Class549::sub455470() { + setFileHash(0xBA0AE050, 0, -1); + _surface->setVisible(true); + SetAnimationCallback3(&Class549::hide); + _soundResource.play(calcHash("fxDoorOpen38")); +} + +void Class549::hide() { + _parentScene->sendMessage(0x2000, 0, this); + setFileHash1(); + _surface->setVisible(false); +} + +void Class549::sub4554F0() { + setFileHash(0xBA0AE050, -1, -1); + _playBackwards = true; + _surface->setVisible(true); + SetAnimationCallback3(&Class549::sub455550); + _soundResource.play(calcHash("fxDoorClose38")); +} + +void Class549::sub455550() { + _parentScene->sendMessage(0x2001, 0, this); + setFileHash1(); +} + +Class592::Class592(NeverhoodEngine *vm, Scene *parentScene) + : AnimatedSprite(vm, 0xA08A0851, 1100, 320, 240), _soundResource(vm), + _parentScene(parentScene) { + + SetMessageHandler(&Class592::handleMessage); + SetAnimationCallback3(&Class592::sub455710); + _soundResource.play(0x51456049); +} + +uint32 Class592::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); + switch (messageNum) { + case 0x3002: + removeCallbacks(); + break; + } + return messageResult; +} + +void Class592::sub455710() { + setFileHash(0x6238B191, 0, -1); + SetAnimationCallback3(&Class592::sub455740); + _x = 580; + _y = 383; +} + +void Class592::sub455740() { + _parentScene->sendMessage(0x2004, 0, this); + setFileHash1(); + _surface->setVisible(false); +} + +Class593::Class593(NeverhoodEngine *vm, Scene *parentScene) + : AnimatedSprite(vm, 0x80180A10, 100, 320, 240), _parentScene(parentScene) { + + SetMessageHandler(&Class593::handleMessage); + _surface->setVisible(false); + setFileHash1(); + Entity::_priority = 1200; +} + +uint32 Class593::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); + switch (messageNum) { + case 0x2002: + sub4558F0(); + break; + case 0x2003: + sub455920(); + case 0x3002: + removeCallbacks(); + break; + } + return messageResult; +} + +void Class593::sub4558F0() { + setFileHash(0x80180A10, 0, -1); + _surface->setVisible(false); + _newHashListIndex = -2; +} + +void Class593::sub455920() { + setFileHash(0x80180A10, -1, -1); + _playBackwards = true; + SetAnimationCallback3(&Class593::sub455950); +} + +void Class593::sub455950() { + _parentScene->sendMessage(0x2003, 0, this); + setFileHash1(); + _surface->setVisible(false); +} + +Class601::Class601(NeverhoodEngine *vm, uint32 fileHash, int index) + : StaticSprite(vm, fileHash, 100) { + + _surface->setVisible(false); + _x = _spriteResource.getPosition().x + index * 20; + StaticSprite::update(); +} + +Class513::Class513(NeverhoodEngine *vm) + : AnimatedSprite(vm, 1100), _soundResource(vm) { + + SetUpdateHandler(&AnimatedSprite::update); + SetMessageHandler(&Class513::handleMessage); + _x = 286; + _y = 429; + createSurface1(0xA282C472, 100); + setFileHash(0xA282C472, 0, -1); +} + +uint32 Class513::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); + switch (messageNum) { + case 0x100D: + if (param.asInteger() == 0x66382026) { + _soundResource.play(0x0CD84468); + } else if (param.asInteger() == 0x6E28061C) { + _soundResource.play(0x78C8402C); + } else if (param.asInteger() == 0x462F0410) { + _soundResource.play(0x60984E28); + } + break; + } + return messageResult; +} + +Scene1308::Scene1308(NeverhoodEngine *vm, Module *parentModule, int which) + : Scene(vm, parentModule, true), _flag1(false) { + + _vm->gameModule()->initScene1307Vars(); + + _surfaceFlag = true; + SetMessageHandler(&Scene1308::handleMessage); + + _background = addBackground(new DirtyBackground(_vm, 0x41024202, 0, 0)); + _palette = new Palette(_vm, 0x41024202); + _palette->usePalette(); + _mouseCursor = addSprite(new Mouse433(_vm, 0x24206418, NULL)); + + _asTape = addSprite(new AsScene1201Tape(_vm, this, 17, 1100, 502, 445, 0x9148A011)); + _vm->_collisionMan->addSprite(_asTape); + + if (getGlobalVar(0x01023818)) { + addSprite(new Class513(_vm)); + addSprite(new AnimatedSprite(_vm, 0x461A1490, 200, 235, 429)); + } + + _sprite1 = addSprite(new StaticSprite(_vm, 0x0A042060, 1100)); + _class549 = addSprite(new Class549(_vm, this)); + _class593 = addSprite(new Class593(_vm, this)); + + _class601_1 = addSprite(new Class601(_vm, kScene1308FileHashes[getSubVar(0x0C10A000, 1)], 0)); + _class601_2 = addSprite(new Class601(_vm, kScene1308FileHashes[getSubVar(0x0C10A000, 0)], 1)); + _class601_2 = addSprite(new Class601(_vm, kScene1308FileHashes[getSubVar(0x0C10A000, 2)], 2)); + + _sprite2 = addSprite(new StaticSprite(_vm, 0x40043120, 995)); + _sprite3 = addSprite(new StaticSprite(_vm, 0x43003100, 995)); + _sprite4 = NULL; + + if (which < 0) { + _klayman = new KmScene1308(_vm, this, 380, 440); + setMessageList(0x004B57C0); + if (getGlobalVar(0x80455A41)) { + _sprite4 = addSprite(new StaticSprite(_vm, 0x0101A624, 1100)); + setRectList(0x004B5990); + } else { + _sprite5 = addSprite(new StaticSprite(_vm, 0x080811A0, 100)); + setRectList(0x004B5980); + } + } else if (which == 1) { + _klayman = new KmScene1308(_vm, this, 640, 440); + setMessageList(0x004B57C8); + if (getGlobalVar(0x80455A41)) { + _sprite4 = addSprite(new StaticSprite(_vm, 0x0101A624, 1100)); + setRectList(0x004B5990); + } else { + _sprite5 = addSprite(new StaticSprite(_vm, 0x080811A0, 100)); + setRectList(0x004B5980); + } + } else if (which == 2) { + _klayman = new KmScene1308(_vm, this, 475, 440); + setMessageList(0x004B58B0); + if (getGlobalVar(0x80455A41)) { + _sprite5 = addSprite(new Class592(_vm, this)); + _sprite4 = addSprite(new StaticSprite(_vm, 0x0101A624, 1100)); + _sprite4->getSurface()->setVisible(false); + } else { + _sprite5 = addSprite(new StaticSprite(_vm, 0x080811A0, 100)); + setRectList(0x004B5980); + } + } else { + _klayman = new KmScene1308(_vm, this, 41, 440); + setMessageList(0x004B57D0); + _class549->sendMessage(0x4808, 0, this); + _sprite1->getSurface()->setVisible(false); + if (getGlobalVar(0x80455A41)) { + _sprite4 = addSprite(new StaticSprite(_vm, 0x0101A624, 1100)); + _klayman->getSurface()->setVisible(false); + } else { + _sprite5 = addSprite(new StaticSprite(_vm, 0x080811A0, 100)); + _klayman->getSurface()->setVisible(false); + } + } + addSprite(_klayman); + + if (_sprite4) { + _klayman->getSurface()->getClipRect().x1 = _sprite1->getSurface()->getDrawRect().x; + _klayman->getSurface()->getClipRect().y1 = 0; + _klayman->getSurface()->getClipRect().x2 = _sprite4->getSurface()->getDrawRect().x + _sprite4->getSurface()->getDrawRect().width; + _klayman->getSurface()->getClipRect().y2 = 480; + } else { + _klayman->getSurface()->getClipRect().x1 = _sprite1->getSurface()->getDrawRect().x; + _klayman->getSurface()->getClipRect().y1 = 0; + _klayman->getSurface()->getClipRect().x2 = 640; + _klayman->getSurface()->getClipRect().y2 = 480; + } + + if (getGlobalVar(0x04A105B3) == 4) { + _class489 = new Class489(_vm, this, _klayman, 0); + addSprite(_class489); + _vm->_collisionMan->addSprite(_class489); + _class489->getSurface()->getClipRect().x1 = 0; + _class489->getSurface()->getClipRect().y1 = 0; + _class489->getSurface()->getClipRect().x2 = 0; + _class489->getSurface()->getClipRect().y2 = _sprite2->getSurface()->getDrawRect().y + _sprite2->getSurface()->getDrawRect().height; + _class489->setRepl(64, 0); + } else { + _class489 = NULL; + } + +} + +uint32 Scene1308::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { + Scene::handleMessage(messageNum, param, sender); + switch (messageNum) { + case 0x100D: + if (param.asInteger() == 0x88C11390) { + setRectList(0x004B59A0); + _flag1 = true; + } else if (param.asInteger() == 0x08821382) { + _klayman->sendEntityMessage(0x1014, _class489, this); + if (getGlobalVar(0x80455A41)) { + setRectList(0x004B5990); + } else { + setRectList(0x004B5980); + } + _flag1 = false; + } else if (param.asInteger() == 0x4AC68808) { + clearRectList(); + _class549->sendMessage(0x4809, 0, this); + _sprite1->getSurface()->setVisible(false); + _klayman->getSurface()->setVisible(false); + } + break; + case 0x1022: + if (sender == _class489) { + if (param.asInteger() >= 1000) + setSurfacePriority(_sprite3->getSurface(), 1100); + else + setSurfacePriority(_sprite3->getSurface(), 995); + } + break; + case 0x2000: + if (getGlobalVar(0x80455A41)) { + setRectList(0x004B5990); + } else { + setRectList(0x004B5980); + } + setMessageList(0x004B57E8); + _sprite1->getSurface()->setVisible(true); + _klayman->getSurface()->setVisible(true); + break; + case 0x2001: + _parentModule->sendMessage(0x1009, 0, this); + break; + case 0x2003: + _class601_1->getSurface()->setVisible(false); + _class601_2->getSurface()->setVisible(false); + _class601_3->getSurface()->setVisible(false); + break; + case 0x2004: + _sprite4->getSurface()->setVisible(true); + setRectList(0x004B5990); + break; + case 0x4807: + _class593->sendMessage(0x2003, 0, this); + break; + case 0x480F: + _class593->sendMessage(0x2002, 0, this); + _class601_1->getSurface()->setVisible(true); + _class601_2->getSurface()->setVisible(true); + _class601_3->getSurface()->setVisible(true); + break; + case 0x4826: + if (sender == _class489) { + if (_flag1) { + setMessageList2(0x004B5868); + } else { + if (param.asInteger() == 1) { + _klayman->sendMessage(0x1014, _class489, this); + setMessageList2(0x004B5848); + } else if (_class489->sendMessage(0x480C, _klayman->getX() <= _class489->getX() ? 0 : 1, this) != 0) { + _klayman->sendEntityMessage(0x1014, _class489, this); + setMessageList2(0x004B5830); + } else { + setMessageList2(0x004B5800); + } + } + } else if (sender == _asTape) { + if (_flag1) { + setMessageList2(0x004B5868); + } else if (_messageListStatus != 2) { + _klayman->sendMessage(0x1014, _asTape, this); + setMessageList2(0x004B58E0); + } + } + break; + } + return 0; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/module1300.h b/engines/neverhood/module1300.h index 80b2774817..8e142022cd 100644 --- a/engines/neverhood/module1300.h +++ b/engines/neverhood/module1300.h @@ -254,6 +254,74 @@ protected: uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); }; +class Class549 : public AnimatedSprite { +public: + Class549(NeverhoodEngine *vm, Scene *parentScene); +protected: + Scene *_parentScene; + SoundResource _soundResource; + uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); + void sub455470(); + void hide(); + void sub4554F0(); + void sub455550(); +}; + +class Class592 : public AnimatedSprite { +public: + Class592(NeverhoodEngine *vm, Scene *parentScene); +protected: + Scene *_parentScene; + SoundResource _soundResource; + uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); + void sub455710(); + void sub455740(); +}; + +class Class593 : public AnimatedSprite { +public: + Class593(NeverhoodEngine *vm, Scene *parentScene); +protected: + Scene *_parentScene; + uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); + void sub4558F0(); + void sub455920(); + void sub455950(); +}; + +class Class601 : public StaticSprite { +public: + Class601(NeverhoodEngine *vm, uint32 fileHash, int index); +}; + +class Class513 : public AnimatedSprite { +public: + Class513(NeverhoodEngine *vm); +protected: + SoundResource _soundResource; + uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); +}; + +class Scene1308 : public Scene { +public: + Scene1308(NeverhoodEngine *vm, Module *parentModule, int which); +protected: + Sprite *_asTape; + Sprite *_class549; + Sprite *_class593; + Sprite *_class601_1; + Sprite *_class601_2; + Sprite *_class601_3; + AnimatedSprite *_class489; + Sprite *_sprite1; + Sprite *_sprite2; + Sprite *_sprite3; + Sprite *_sprite4; + Sprite *_sprite5; + bool _flag1; + uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); +}; + } // End of namespace Neverhood #endif /* NEVERHOOD_MODULE1300_H */ |