aboutsummaryrefslogtreecommitdiff
path: root/engines/neverhood
diff options
context:
space:
mode:
Diffstat (limited to 'engines/neverhood')
-rw-r--r--engines/neverhood/gamemodule.cpp18
-rw-r--r--engines/neverhood/klayman.cpp72
-rw-r--r--engines/neverhood/klayman.h7
-rw-r--r--engines/neverhood/module.mk1
-rw-r--r--engines/neverhood/module2800.cpp201
-rw-r--r--engines/neverhood/module2800.h59
6 files changed, 357 insertions, 1 deletions
diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp
index 72f15a6bed..781a9c305a 100644
--- a/engines/neverhood/gamemodule.cpp
+++ b/engines/neverhood/gamemodule.cpp
@@ -39,6 +39,7 @@
#include "neverhood/module2300.h"
#include "neverhood/module2600.h"
#include "neverhood/module2700.h"
+#include "neverhood/module2800.h"
#include "neverhood/module3000.h"
namespace Neverhood {
@@ -275,7 +276,7 @@ void GameModule::startup() {
_vm->gameState().sceneNum = 0;
createModule(1000, -1);
#endif
-#if 1
+#if 0
_vm->gameState().sceneNum = 1;
createModule(1000, -1);
#endif
@@ -301,6 +302,10 @@ void GameModule::startup() {
_vm->gameState().sceneNum = 1;
createModule(2700, -1);
#endif
+#if 1
+ _vm->gameState().sceneNum = 0;
+ createModule(2800, -1);
+#endif
}
void GameModule::createModule(int moduleNum, int which) {
@@ -372,6 +377,10 @@ void GameModule::createModule(int moduleNum, int which) {
setGlobalVar(0x91080831, 0x42212411);
_childObject = new Module2700(_vm, this, which);
break;
+ case 2800:
+ setGlobalVar(0x91080831, 0x64210814);
+ _childObject = new Module2800(_vm, this, which);
+ break;
case 3000:
setGlobalVar(0x91080831, 0x81293110);
_childObject = new Module3000(_vm, this, which);
@@ -489,6 +498,13 @@ void GameModule::updateModule() {
case 2700:
createModule(1800, 2);
break;
+ case 2800:
+ if (_moduleResult == 1) {
+ createModule(2900, 5);
+ } else {
+ createModule(1800, 0);
+ }
+ break;
case 3000:
if (_moduleResult == 1) {
createModule(1900, 0);
diff --git a/engines/neverhood/klayman.cpp b/engines/neverhood/klayman.cpp
index bdc53d65f6..6873e505fa 100644
--- a/engines/neverhood/klayman.cpp
+++ b/engines/neverhood/klayman.cpp
@@ -4847,4 +4847,76 @@ void KmScene2247::sub453520() {
FinalizeState(&Klayman::stStartWalkingDone);
}
+KmScene2801::KmScene2801(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
+ : Klayman(vm, parentScene, x, y, 1000, 1000) {
+ // Empty
+}
+
+uint32 KmScene2801::xHandleMessage(int messageNum, const MessageParam &param) {
+ switch (messageNum) {
+ case 0x4001:
+ case 0x4800:
+ startWalkToX(param.asPoint().x, false);
+ break;
+ case 0x4004:
+ GotoState(&Klayman::stTryStandIdle);
+ break;
+ case 0x4812:
+ GotoState(&Klayman::stPickUpGeneric);
+ break;
+ case 0x4817:
+ setDoDeltaX(param.asInteger());
+ gotoNextStateExt();
+ break;
+ case 0x481B:
+ if (param.asPoint().y != 0) {
+ sub41CC40(param.asPoint().y, param.asPoint().x);
+ } else {
+ sub41CCE0(param.asPoint().x);
+ }
+ break;
+ case 0x481D:
+ GotoState(&Klayman::stTurnToUse);
+ break;
+ case 0x481E:
+ GotoState(&Klayman::stReturnFromUse);
+ break;
+ case 0x481F:
+ if (param.asInteger() == 1) {
+ GotoState(&Klayman::stWonderAboutAfter);
+ } else if (param.asInteger() == 0) {
+ GotoState(&Klayman::stWonderAboutHalf);
+ } else if (param.asInteger() == 4) {
+ GotoState(&Klayman::stTurnAwayFromUse);
+ } else if (param.asInteger() == 3) {
+ GotoState(&Klayman::stTurnToUseHalf);
+ } else {
+ GotoState(&Klayman::stWonderAbout);
+ }
+ break;
+ case 0x482D:
+ setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
+ gotoNextStateExt();
+ break;
+ case 0x482E:
+ if (param.asInteger() == 1) {
+ GotoState(&Klayman::stWalkToFrontNoStep);
+ } else {
+ GotoState(&Klayman::stWalkToFront);
+ }
+ break;
+ case 0x482F:
+ if (param.asInteger() == 1) {
+ GotoState(&Klayman::stTurnToFront);
+ } else {
+ GotoState(&Klayman::stTurnToBack);
+ }
+ break;
+ case 0x4837:
+ sub41CE70();
+ break;
+ }
+ return 0;
+}
+
} // End of namespace Neverhood
diff --git a/engines/neverhood/klayman.h b/engines/neverhood/klayman.h
index 7b8b42ebae..355c6d6f15 100644
--- a/engines/neverhood/klayman.h
+++ b/engines/neverhood/klayman.h
@@ -542,6 +542,13 @@ protected:
void sub453520();
};
+class KmScene2801 : public Klayman {
+public:
+ KmScene2801(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y);
+protected:
+ uint32 xHandleMessage(int messageNum, const MessageParam &param);
+};
+
} // End of namespace Neverhood
#endif /* NEVERHOOD_KLAYMAN_H */
diff --git a/engines/neverhood/module.mk b/engines/neverhood/module.mk
index adf58b1225..780ee76ae1 100644
--- a/engines/neverhood/module.mk
+++ b/engines/neverhood/module.mk
@@ -27,6 +27,7 @@ MODULE_OBJS = \
module2300.o \
module2600.o \
module2700.o \
+ module2800.o \
module3000.o \
mouse.o \
navigationscene.o \
diff --git a/engines/neverhood/module2800.cpp b/engines/neverhood/module2800.cpp
new file mode 100644
index 0000000000..3a86e29f36
--- /dev/null
+++ b/engines/neverhood/module2800.cpp
@@ -0,0 +1,201 @@
+/* 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/module2800.h"
+#include "neverhood/gamemodule.h"
+#include "neverhood/module1000.h"
+#include "neverhood/module1200.h"
+#include "neverhood/module1700.h"
+
+namespace Neverhood {
+
+Module2800::Module2800(NeverhoodEngine *vm, Module *parentModule, int which)
+ : Module(vm, parentModule) {
+
+ _fileHash = 0;
+ // TODO music stuff
+ // TODO Music18hList_add(0x64210814, 0xD2FA4D14);
+ setGlobalVar(0x28D8C940, 1);
+
+ if (which < 0) {
+ createScene(_vm->gameState().sceneNum, which);
+ } else if (which == 2) {
+ createScene(4, 3);
+ } else if (which == 1) {
+ createScene(4, 1);
+ } else {
+ createScene(0, 0);
+ }
+
+}
+
+Module2800::~Module2800() {
+ // TODO music stuff
+ // TODO Sound1ChList_sub_407A50(0x64210814);
+ // TODO Module2800_sub471DF0();
+}
+
+void Module2800::createScene(int sceneNum, int which) {
+ debug("Module2800::createScene(%d, %d)", sceneNum, which);
+ _vm->gameState().sceneNum = sceneNum;
+ switch (_vm->gameState().sceneNum) {
+ case 0:
+ // TODO Music18hList_stop(0xD2FA4D14, 0, 0);
+ _childObject = new Scene2801(_vm, this, which);
+ break;
+ // TODO ...
+ }
+ SetUpdateHandler(&Module2800::updateScene);
+ _childObject->handleUpdate();
+}
+
+void Module2800::updateScene() {
+ if (!updateChild()) {
+ switch (_vm->gameState().sceneNum) {
+ case 0:
+ if (_moduleResult != 2) {
+ // TODO music stuff
+ }
+ if (_moduleResult == 1) {
+ createScene(2, 0);
+ } else if (_moduleResult == 2) {
+ createScene(1, 0);
+ } else {
+ leaveModule(0);
+ }
+ break;
+ }
+ } else {
+ switch (_vm->gameState().sceneNum) {
+ case 0:
+ // TODO Module2800_sub4731E0(true);
+ break;
+ }
+ }
+}
+
+Scene2801::Scene2801(NeverhoodEngine *vm, Module *parentModule, int which)
+ : Scene(vm, parentModule, true) {
+
+ // TODO _vm->gameModule()->initScene2801Vars();
+
+ _surfaceFlag = true;
+ SetMessageHandler(&Scene2801::handleMessage);
+ SetUpdateHandler(&Scene::update);
+
+ if (getGlobalVar(0x4DE80AC0) == 0) {
+ insertStaticSprite(0x0001264C, 100);
+ }
+
+ if (which < 0) {
+ insertKlayman<KmScene2801>(194, 430);
+ setMessageList(0x004B6BB8);
+ } else if (which == 1) {
+ insertKlayman<KmScene2801>(443, 398);
+ setMessageList(0x004B6BC0);
+ } else if (which == 2) {
+ if (getGlobalVar(0xC0418A02)) {
+ insertKlayman<KmScene2801>(312, 432);
+ _klayman->setDoDeltaX(1);
+ setMessageList(0x004B6C10);
+ } else {
+ insertKlayman<KmScene2801>(194, 432);
+ setMessageList(0x004B6C10);
+ }
+ } else {
+ insertKlayman<KmScene2801>(0, 432);
+ setMessageList(0x004B6BB0);
+ }
+
+ if (getGlobalVar(0x09880D40)) {
+ setRectList(0x004B6CE0);
+ setBackground(0x01400666);
+ setPalette(0x01400666);
+ _paletteHash = 0x15021024;
+ _palette->addBasePalette(0x01400666, 0, 256, 0);
+ _sprite1 = insertStaticSprite(0x100CA0A8, 1100);
+ _sprite2 = insertStaticSprite(0x287C21A4, 1100);
+ _klayman->setClipRect(_sprite1->getDrawRect().x, 0, _sprite2->getDrawRect().x2(), 480);
+ insertMouse433(0x0066201C);
+ _asTape = insertSprite<AsScene1201Tape>(this, 8, 1100, 302, 437, 0x9148A011);
+ _vm->_collisionMan->addSprite(_asTape);
+ } else if (getGlobalVar(0x08180ABC)) {
+ setRectList(0x004B6CD0);
+ setBackground(0x11E00684);
+ setPalette(0x11E00684);
+ _paletteHash = 0x15021024;
+ _palette->addBasePalette(0x11E00684, 0, 256, 0);
+ _sprite2 = insertStaticSprite(0x061601C8, 1100);
+ _klayman->setClipRect(0, 0, _sprite2->getDrawRect().x2(), 480);
+ insertMouse433(0x00680116);
+ _asTape = insertSprite<Class606>(this, 8, 1100, 302, 437, 0x01142428);
+ _vm->_collisionMan->addSprite(_asTape);
+ } else {
+ setRectList(0x004B6CF0);
+ setBackground(0x030006E6);
+ setPalette(0x030006E6);
+ _paletteHash = 0x15021024;
+ _palette->addBasePalette(0x030006E6, 0, 256, 0);
+ _sprite2 = insertStaticSprite(0x273801CE, 1100);
+ _klayman->setClipRect(0, 0, _sprite2->getDrawRect().x2(), 480);
+ insertMouse433(0x006E2038);
+ _asTape = insertSprite<AsScene1201Tape>(this, 8, 1100, 302, 437, 0x9148A011);
+ _vm->_collisionMan->addSprite(_asTape);
+ }
+
+ if (which == 1) {
+ _palette->addPalette(0xB103B604, 0, 65, 0);
+ _palette->addBasePalette(0xB103B604, 0, 65, 0);
+ } else {
+ _palette->addPalette(_paletteHash, 0, 65, 0);
+ _palette->addBasePalette(_paletteHash, 0, 65, 0);
+ }
+
+}
+
+Scene2801::~Scene2801() {
+ setGlobalVar(0xC0418A02, _klayman->isDoDeltaX() ? 1 : 0);
+}
+
+uint32 Scene2801::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
+ uint32 messageResult = Scene::handleMessage(messageNum, param, sender);
+ switch (messageNum) {
+ // TODO: case 0x000D:
+ case 0x4826:
+ if (sender == _asTape) {
+ sendEntityMessage(_klayman, 0x1014, _asTape);
+ setMessageList(0x004B6C40);
+ }
+ break;
+ case 0x482A:
+ _palette->addBasePalette(0xB103B604, 0, 65, 0);
+ _palette->startFadeToPalette(12);
+ break;
+ case 0x482B:
+ _palette->addBasePalette(_paletteHash, 0, 65, 0);
+ _palette->startFadeToPalette(12);
+ break;
+ }
+ return messageResult;
+}
+
+} // End of namespace Neverhood
diff --git a/engines/neverhood/module2800.h b/engines/neverhood/module2800.h
new file mode 100644
index 0000000000..cdfcdbe802
--- /dev/null
+++ b/engines/neverhood/module2800.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_MODULE2800_H
+#define NEVERHOOD_MODULE2800_H
+
+#include "neverhood/neverhood.h"
+#include "neverhood/module.h"
+#include "neverhood/scene.h"
+
+namespace Neverhood {
+
+// Module2800
+
+class Module2800 : public Module {
+public:
+ Module2800(NeverhoodEngine *vm, Module *parentModule, int which);
+ virtual ~Module2800();
+protected:
+ bool _flag;
+ uint32 _fileHash;
+ void createScene(int sceneNum, int which);
+ void updateScene();
+};
+
+class Scene2801 : public Scene {
+public:
+ Scene2801(NeverhoodEngine *vm, Module *parentModule, int which);
+ ~Scene2801();
+protected:
+ Sprite *_sprite1;
+ Sprite *_sprite2;
+ Sprite *_asTape;
+ uint32 _paletteHash;
+ uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);
+};
+
+} // End of namespace Neverhood
+
+#endif /* NEVERHOOD_MODULE2800_H */