From 9f599a7dfcc2175a8940eacce621f5a15d762314 Mon Sep 17 00:00:00 2001 From: johndoe123 Date: Mon, 10 Oct 2011 07:51:30 +0000 Subject: NEVERHOOD: Start with Module2600 (missing Scene2609) --- engines/neverhood/gamemodule.cpp | 1 + engines/neverhood/module.mk | 1 + engines/neverhood/module2600.cpp | 199 +++++++++++++++++++++++++++++++++++++++ engines/neverhood/module2600.h | 45 +++++++++ 4 files changed, 246 insertions(+) create mode 100644 engines/neverhood/module2600.cpp create mode 100644 engines/neverhood/module2600.h diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index 2891bddc2a..a1a1fc3379 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -37,6 +37,7 @@ #include "neverhood/module2100.h" #include "neverhood/module2200.h" #include "neverhood/module2300.h" +#include "neverhood/module2600.h" #include "neverhood/module3000.h" namespace Neverhood { diff --git a/engines/neverhood/module.mk b/engines/neverhood/module.mk index 9484e2e632..2eefff9458 100644 --- a/engines/neverhood/module.mk +++ b/engines/neverhood/module.mk @@ -25,6 +25,7 @@ MODULE_OBJS = \ module2100.o \ module2200.o \ module2300.o \ + module2600.o \ module3000.o \ mouse.o \ navigationscene.o \ diff --git a/engines/neverhood/module2600.cpp b/engines/neverhood/module2600.cpp new file mode 100644 index 0000000000..0217fe4b71 --- /dev/null +++ b/engines/neverhood/module2600.cpp @@ -0,0 +1,199 @@ +/* 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/module2600.h" + +namespace Neverhood { + +Module2600::Module2600(NeverhoodEngine *vm, Module *parentModule, int which) + : Module(vm, parentModule) { + + if (which < 0) { + createScene(_vm->gameState().sceneNum, -1); + } else if (which == 1) { + createScene(4, 1); + } else { + createScene(0, 1); + } + + // TODO Sound1ChList_addSoundResources(0x40271018, dword_4B87E8, true); + // TODO Sound1ChList_setSoundValuesMulti(dword_4B87E8, true, 50, 600, 5, 150); + // TODO Sound1ChList_sub_407C70(0x40271018, 0x41861371, 0x43A2507F); + +} + +Module2600::~Module2600() { + // TODO Sound1ChList_sub_407A50(0x40271018); +} + +void Module2600::createScene(int sceneNum, int which) { + debug("Module2600::createScene(%d, %d)", sceneNum, which); + _vm->gameState().sceneNum = sceneNum; + switch (_vm->gameState().sceneNum) { + case 0: + createNavigationScene(0x004B8608, which); + break; + case 1: + createNavigationScene(0x004B8638, which); + break; + case 2: + createNavigationScene(0x004B86C8, which); + break; + case 3: + if (getGlobalVar(0x0A310817)) { + createNavigationScene(0x004B8758, which); + } else { + createNavigationScene(0x004B86F8, which); + } + break; + case 4: + createNavigationScene(0x004B87B8, which); + break; + case 6: + createNavigationScene(0x004B8698, which); + break; + case 7: + // TODO Sound1ChList_sub_407A50(0x40271018); + createSmackerScene(0x30090001, true, true, false); + break; + case 8: +//TODO _childObject = new Scene2609(_vm, this, which); + break; + case 1002: + if (getGlobalVar(0x40040831) == 1) { + createSmackerScene(0x018C0404, true, true, false); + } else if (getGlobalVar(0x40040831) == 2) { + createSmackerScene(0x018C0407, true, true, false); + } else { + createSmackerScene(0x818C0405, true, true, false); + } + if (getGlobalVar(0x40040831) >= 2) { + setGlobalVar(0x40040831, 0); + } else { + incGlobalVar(0x40040831, +1); + } + break; + case 1003: + createSmackerScene(0x001C0007, true, true, false); + break; + case 1006: + if (getGlobalVar(0x4E0BE910)) { + createSmackerScene(0x049A1181, true, true, false); + } else { + createSmackerScene(0x04981181, true, true, false); + } + break; + case 1008: + if (getGlobalVar(0x4E0BE910)) { + createSmackerScene(0x42B80941, true, true, false); + } else { + createSmackerScene(0x42980941, true, true, false); + } + break; + } + SetUpdateHandler(&Module2600::updateScene); + _childObject->handleUpdate(); +} + +void Module2600::updateScene() { + if (!updateChild()) { + switch (_vm->gameState().sceneNum) { + case 0: + if (_moduleResult == 1) { + createScene(1, 3); + } else { + leaveModule(0); + } + break; + case 1: + if (_moduleResult == 0) { + createScene(6, 0); + } else if (_moduleResult == 1) { + createScene(0, 0); + } else if (_moduleResult == 2) { + createScene(2, 1); + } else if (_moduleResult == 3) { + createScene(3, 0); + } + break; + case 2: + if (_moduleResult == 0) { + createScene(1, 0); + } else if (_moduleResult == 1) { + createScene(1002, -1); + } + break; + case 3: + if (_moduleResult == 0) { + if (getGlobalVar(0x0A310817)) { + createScene(4, 0); + } else { + createScene(1003, -1); + } + } else if (_moduleResult == 2) { + createScene(1, 1); + } else if (_moduleResult == 3) { + if (getGlobalVar(0x0A310817)) { + createScene(4, 0); + } else { + setGlobalVar(0x0A310817, 1); + createScene(7, -1); + } + } + break; + case 4: + if (_moduleResult == 0) { + leaveModule(1); + } else { + createScene(3, 1); + } + break; + case 6: + if (_moduleResult == 0) { + createScene(1006, -1); + } else if (_moduleResult == 1) { + createScene(1, 2); + } + break; + case 7: + leaveModule(0); + break; + case 8: + createScene(1008, -1); + break; + case 1002: + createScene(2, 1); + break; + case 1003: + createScene(3, 0); + break; + case 1006: + createScene(8, -1); + break; + case 1008: + createScene(6, 0); + break; + } + } +} + +} // End of namespace Neverhood diff --git a/engines/neverhood/module2600.h b/engines/neverhood/module2600.h new file mode 100644 index 0000000000..66ee360733 --- /dev/null +++ b/engines/neverhood/module2600.h @@ -0,0 +1,45 @@ +/* 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_MODULE2600_H +#define NEVERHOOD_MODULE2600_H + +#include "neverhood/neverhood.h" +#include "neverhood/module.h" +#include "neverhood/scene.h" + +namespace Neverhood { + +// Module2600 + +class Module2600 : public Module { +public: + Module2600(NeverhoodEngine *vm, Module *parentModule, int which); + virtual ~Module2600(); +protected: + void createScene(int sceneNum, int which); + void updateScene(); +}; + +} // End of namespace Neverhood + +#endif /* NEVERHOOD_MODULE2600_H */ -- cgit v1.2.3