diff options
-rw-r--r-- | engines/neverhood/gamemodule.cpp | 32 | ||||
-rw-r--r-- | engines/neverhood/gamemodule.h | 2 | ||||
-rw-r--r-- | engines/neverhood/klayman.cpp | 98 | ||||
-rw-r--r-- | engines/neverhood/klayman.h | 13 | ||||
-rw-r--r-- | engines/neverhood/module.mk | 1 | ||||
-rw-r--r-- | engines/neverhood/module2000.cpp | 193 | ||||
-rw-r--r-- | engines/neverhood/module2000.h | 59 |
7 files changed, 391 insertions, 7 deletions
diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index 16824e9ba8..7408c25fbd 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -29,6 +29,7 @@ #include "neverhood/module1500.h" #include "neverhood/module1700.h" #include "neverhood/module1800.h" +#include "neverhood/module2000.h" #include "neverhood/module2300.h" #include "neverhood/module3000.h" @@ -227,7 +228,7 @@ void GameModule::startup() { //createModule1700(-1); //createModule1700(1); //createModule1400(-1); -#if 1 +#if 0 _vm->gameState().sceneNum = 10; createModule3000(-1); #endif @@ -235,6 +236,10 @@ void GameModule::startup() { _vm->gameState().sceneNum = 0; createModule1800(-1); #endif +#if 1 + _vm->gameState().sceneNum = 0; + createModule2000(-1); +#endif } void GameModule::createModule1000(int which) { @@ -284,11 +289,7 @@ void GameModule::updateModule1200() { void GameModule::createModule1400(int which) { setGlobalVar(0x91080831, 0x00AD0012); - //_childObject = new Module1400(_vm, this, which); - - _vm->gameState().sceneNum = 9; - _childObject = new Module3000(_vm, this, -1); - + _childObject = new Module1400(_vm, this, which); SetUpdateHandler(&GameModule::updateModule1400); } @@ -384,6 +385,25 @@ void GameModule::updateModule1800() { } } +void GameModule::createModule2000(int which) { + setGlobalVar(0x91080831, 0x08250000); + _childObject = new Module2000(_vm, this, which); + SetUpdateHandler(&GameModule::updateModule2000); +} + +void GameModule::updateModule2000() { + if (!_childObject) + return; + _childObject->handleUpdate(); + if (_done) { + _done = false; + delete _childObject; + _childObject = NULL; + // TODO createModule2900(4); + _childObject->handleUpdate(); + } +} + void GameModule::createModule2300(int which) { setGlobalVar(0x91080831, 0x1A214010); _childObject = new Module2300(_vm, this, which); diff --git a/engines/neverhood/gamemodule.h b/engines/neverhood/gamemodule.h index 6290a85209..6de3893fbd 100644 --- a/engines/neverhood/gamemodule.h +++ b/engines/neverhood/gamemodule.h @@ -63,6 +63,8 @@ protected: void updateModule1700(); void createModule1800(int which); void updateModule1800(); + void createModule2000(int which); + void updateModule2000(); void createModule2200(int which); void createModule2300(int which); void updateModule2300(); diff --git a/engines/neverhood/klayman.cpp b/engines/neverhood/klayman.cpp index 3aaab36874..d74f94bbbf 100644 --- a/engines/neverhood/klayman.cpp +++ b/engines/neverhood/klayman.cpp @@ -3324,4 +3324,102 @@ void KmScene1705::sub468B10() { SetMessageHandler(&KmScene1705::handleMessage4689A0); } +KmScene2001::KmScene2001(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) + : Klayman(vm, parentScene, x, y, 1000, 1000), _flag(false) { + + // Empty +} + +uint32 KmScene2001::xHandleMessage(int messageNum, const MessageParam ¶m) { + switch (messageNum) { + case 0x2000: + _flag = param.asInteger() != 0; + break; + case 0x4001: + case 0x4800: + sub41C930(param.asPoint().x, false); + break; + case 0x4004: + if (_flag) { + setCallback2(AnimationCallback(&Klayman::sub421350)); + } else { + setCallback2(AnimationCallback(&Klayman::sub41FC80)); + } + break; + case 0x4804: + if (param.asInteger() != 0) { + _x4 = param.asInteger(); + setCallback2(AnimationCallback(&Klayman::sub41F9E0)); + } else { + setCallback2(AnimationCallback(&Klayman::sub41FC40)); + } + break; + case 0x4817: + setDoDeltaX(param.asInteger()); + sub41C7B0(); + break; + case 0x481D: + if (_flag) { + setCallback2(AnimationCallback(&Klayman::sub4214D0)); + } + break; + case 0x481E: + if (_flag) { + setCallback2(AnimationCallback(&Klayman::sub421510)); + } + break; + case 0x4834: + setCallback2(AnimationCallback(&Klayman::sub421160)); + break; + case 0x4835: + _parentScene->sendMessage(0x2000, 1, this); + _flag = true; + setCallback2(AnimationCallback(&Klayman::sub4212C0)); + break; + case 0x4836: + _parentScene->sendMessage(0x2000, 0, this); + _flag = false; + setCallback2(AnimationCallback(&Klayman::sub421310)); + break; + case 0x483D: + sub440230(); + break; + case 0x483E: + sub440270(); + break; + } + return 0; +} + +uint32 KmScene2001::handleMessage4401A0(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = handleMessage41D480(messageNum, param, sender); + switch (messageNum) { + case 0x100D: + if (param.asInteger() == 0x4E0A2C24) { + _soundResource1.play(0x85B10BB8); + } if (param.asInteger() == 0x4E6A0CA0) { + _soundResource1.play(0xC5B709B0); + } + break; + } +} + +void KmScene2001::sub440230() { + _status2 = 0; + _flagE5 = false; + setFileHash(0xBE68CC54, 0, -1); + SetUpdateHandler(&Klayman::update); + SetSpriteCallback(NULL); + SetMessageHandler(&KmScene2001::handleMessage4401A0); +} + +void KmScene2001::sub440270() { + _status2 = 0; + _flagE5 = false; + setFileHash(0x18AB4ED4, 0, -1); + SetUpdateHandler(&Klayman::update); + SetSpriteCallback(NULL); + SetMessageHandler(&KmScene2001::handleMessage4401A0); +} + } // End of namespace Neverhood diff --git a/engines/neverhood/klayman.h b/engines/neverhood/klayman.h index d7c351e20c..8585689595 100644 --- a/engines/neverhood/klayman.h +++ b/engines/neverhood/klayman.h @@ -109,6 +109,7 @@ public: void sub420E90(); void sub420EB0(); void sub420680(); + void sub41F9E0(); void spriteUpdate41F250(); void spriteUpdate41F5F0(); @@ -204,7 +205,6 @@ protected: void sub41F950(); void sub41FB30(); uint32 handleMessage41EC70(int messageNum, const MessageParam ¶m, Entity *sender); - void sub41F9E0(); void spriteUpdate41F300(); uint32 handleMessage41EB70(int messageNum, const MessageParam ¶m, Entity *sender); void sub41FA40(); @@ -359,6 +359,17 @@ protected: void sub468B10(); }; +class KmScene2001 : public Klayman { +public: + KmScene2001(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); +protected: + bool _flag; + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); + uint32 handleMessage4401A0(int messageNum, const MessageParam ¶m, Entity *sender); + void sub440230(); + void sub440270(); +}; + } // End of namespace Neverhood #endif /* NEVERHOOD_KLAYMAN_H */ diff --git a/engines/neverhood/module.mk b/engines/neverhood/module.mk index 20e0bbb2c7..5dcdc41aed 100644 --- a/engines/neverhood/module.mk +++ b/engines/neverhood/module.mk @@ -17,6 +17,7 @@ MODULE_OBJS = \ module1500.o \ module1700.o \ module1800.o \ + module2000.o \ module2300.o \ module3000.o \ mouse.o \ diff --git a/engines/neverhood/module2000.cpp b/engines/neverhood/module2000.cpp new file mode 100644 index 0000000000..9f45db218c --- /dev/null +++ b/engines/neverhood/module2000.cpp @@ -0,0 +1,193 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "neverhood/module2000.h" +#include "neverhood/gamemodule.h" +#include "neverhood/navigationscene.h" + +namespace Neverhood { + +Module2000::Module2000(NeverhoodEngine *vm, Module *parentModule, int which) + : Module(vm, parentModule) { + + debug("Create Module2000(%d)", which); + + if (which < 0) { + switch (_vm->gameState().sceneNum) { + case 0: + createScene2001(-1); + break; + case 2: + createScene2003(-1); + break; + default: + createScene2002(-1); + break; + } + } else if (which == 0) { + createScene2001(3); + } else if (which == 1) { + createScene2001(1); + } + +} + +Module2000::~Module2000() { + // TODO Sound1ChList_sub_407A50(0x81293110); +} + +void Module2000::createScene2001(int which) { + _vm->gameState().sceneNum = 0; + _childObject = new Scene2001(_vm, this, which); + SetUpdateHandler(&Module2000::updateScene2001); + _childObject->handleUpdate(); +} + +void Module2000::createScene2002(int which) { + _vm->gameState().sceneNum = 1; + if (getGlobalVar(0x98109F12)) { + createNavigationScene(0x004B7B48, which); + } else { + createNavigationScene(0x004B7B00, which); + } + SetUpdateHandler(&Module2000::updateScene2002); + _childObject->handleUpdate(); +} + +void Module2000::createScene2003(int which) { + _vm->gameState().sceneNum = 2; + setGlobalVar(0x98109F12, 1); + setSubVar(0x2C145A98, 1, 1); + createSmackerScene(0x204B2031, true, true, false); + SetUpdateHandler(&Module2000::updateScene2003); + _childObject->handleUpdate(); +} + +void Module2000::updateScene2001() { + _childObject->handleUpdate(); + if (_done) { + _done = false; + delete _childObject; + _childObject = NULL; + if (_field20 == 1) { + _parentModule->sendMessage(0x1009, 0, this); + } else { + createScene2002(0); + } + } +} + +void Module2000::updateScene2002() { + _childObject->handleUpdate(); + if (_done) { + _done = false; + delete _childObject; + _childObject = NULL; + if (_field20 == 0) { + if (getGlobalVar(0x98109F12)) { + createScene2002(0); + } else { + createScene2003(-1); + } + } else if (_field20 == 1) { + createScene2002(1); + } else if (_field20 == 2) { + createScene2001(0); + } + } +} + +void Module2000::updateScene2003() { + _childObject->handleUpdate(); + if (_done) { + _done = false; + delete _childObject; + _childObject = NULL; + createScene2002(0); + } +} + +// Scene2001 + +Scene2001::Scene2001(NeverhoodEngine *vm, Module *parentModule, int which) + : Scene(vm, parentModule, true) { + + _surfaceFlag = true; + SetMessageHandler(&Scene2001::handleMessage); + + _background = addBackground(new DirtyBackground(_vm, 0xA6417244, 0, 0)); + _palette = new Palette(_vm, 0xA6417244); + _palette->usePalette(); + _mouseCursor = addSprite(new Mouse433(_vm, 0x17240A6C, NULL)); + + _class401 = addSprite(new StaticSprite(_vm, 0x0D641724, 1100)); + + if (which < 0) { + _klayman = new KmScene2001(_vm, this, 300, 345); + setMessageList(0x004B3538); + sendMessage(0x2000, 0, this); + } else if (which == 1) { + _klayman = new KmScene2001(_vm, this, 116, 345); + _klayman->sendMessage(0x2000, 1, this); + setMessageList(0x004B3540); + sendMessage(0x2000, 1, this); + } else if (which == 2) { + _klayman = new KmScene2001(_vm, this, 116, 345); + _klayman->sendMessage(0x2000, 1, this); + setMessageList(0x004B35F0); + sendMessage(0x2000, 1, this); + } else if (which == 3) { + _klayman = new KmScene2001(_vm, this, 116, 345); + _klayman->sendMessage(0x2000, 1, this); + setMessageList(0x004B3550); + sendMessage(0x2000, 1, this); + } else { + _klayman = new KmScene2001(_vm, this, 390, 345); + setMessageList(0x004B3530); + sendMessage(0x2000, 0, this); + _klayman->setDoDeltaX(1); + } + addSprite(_klayman); + + _klayman->getSurface()->getClipRect().x1 = _class401->getSurface()->getDrawRect().x; + _klayman->getSurface()->getClipRect().y1 = 0; + _klayman->getSurface()->getClipRect().x2 = 640; + _klayman->getSurface()->getClipRect().y2 = 480; + +} + +uint32 Scene2001::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { + Scene::handleMessage(messageNum, param, sender); + switch (messageNum) { + case 0x2000: + if (param.asInteger()) { + setRectList(0x004B3680); + _klayman->setKlaymanTable3(); + } else { + setRectList(0x004B3670); + _klayman->setKlaymanTable1(); + } + } + return 0; +} + +} // End of namespace Neverhood diff --git a/engines/neverhood/module2000.h b/engines/neverhood/module2000.h new file mode 100644 index 0000000000..23ac8a8e9f --- /dev/null +++ b/engines/neverhood/module2000.h @@ -0,0 +1,59 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef NEVERHOOD_MODULE2000_H +#define NEVERHOOD_MODULE2000_H + +#include "neverhood/neverhood.h" +#include "neverhood/module.h" +#include "neverhood/scene.h" +#include "neverhood/module1200.h" + +namespace Neverhood { + +class Module2000 : public Module { +public: + Module2000(NeverhoodEngine *vm, Module *parentModule, int which); + virtual ~Module2000(); +protected: + uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); + void createScene2001(int which); + void createScene2002(int which); + void createScene2003(int which); + void updateScene2001(); + void updateScene2002(); + void updateScene2003(); +}; + +// Scene2001 + +class Scene2001 : public Scene { +public: + Scene2001(NeverhoodEngine *vm, Module *parentModule, int which); +protected: + Sprite *_class401; + uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); +}; + +} // End of namespace Neverhood + +#endif /* NEVERHOOD_MODULE2000_H */ |