aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/neverhood/background.cpp3
-rw-r--r--engines/neverhood/gamemodule.cpp10
-rw-r--r--engines/neverhood/klayman.cpp96
-rw-r--r--engines/neverhood/klayman.h11
-rw-r--r--engines/neverhood/module1100.cpp60
-rw-r--r--engines/neverhood/module1100.h8
-rw-r--r--engines/neverhood/module1200.cpp2
-rw-r--r--engines/neverhood/module1300.cpp2
-rw-r--r--engines/neverhood/module1700.cpp6
-rw-r--r--engines/neverhood/module2000.cpp6
-rw-r--r--engines/neverhood/scene.cpp10
11 files changed, 196 insertions, 18 deletions
diff --git a/engines/neverhood/background.cpp b/engines/neverhood/background.cpp
index 0c522dbe75..e235eaa1b3 100644
--- a/engines/neverhood/background.cpp
+++ b/engines/neverhood/background.cpp
@@ -62,7 +62,7 @@ void Background::load(uint32 fileHash) {
DirtyBackground::DirtyBackground(NeverhoodEngine *vm, const char *fileName, int objectPriority, int surfacePriority)
: Background(vm, objectPriority) {
- // TODO _spriteResource.load(calcHash(fileName));
+ _spriteResource.load(calcHash(fileName));
createSurface(surfacePriority, _spriteResource.getDimensions().width, _spriteResource.getDimensions().height);
_surface->drawSpriteResource(_spriteResource);
}
@@ -85,5 +85,4 @@ void DirtyBackground::createSurface(int surfacePriority, int16 width, int16 heig
}
-
} // End of namespace Neverhood
diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp
index c6dc006a8d..4d1c27d4df 100644
--- a/engines/neverhood/gamemodule.cpp
+++ b/engines/neverhood/gamemodule.cpp
@@ -275,7 +275,7 @@ void GameModule::startup() {
createModule(1000, -1);
#endif
#if 1
- _vm->gameState().sceneNum = 4;
+ _vm->gameState().sceneNum = 8;
createModule(1100, -1);
#endif
}
@@ -353,6 +353,14 @@ void GameModule::updateModule() {
createModule(2300, 2);
}
break;
+ case 1100:
+ if (_moduleResult == 0) {
+ createModule(2900, 2);
+ } else {
+ setGlobalVar(0xD0A14D10, 1);
+ createModule(1300, 0);
+ }
+ break;
case 1300:
if (_moduleResult == 1) {
// TODO _gameState.clear();
diff --git a/engines/neverhood/klayman.cpp b/engines/neverhood/klayman.cpp
index 4d4d9c4aa4..4916056ab0 100644
--- a/engines/neverhood/klayman.cpp
+++ b/engines/neverhood/klayman.cpp
@@ -2687,6 +2687,102 @@ void KmScene1004::sub478170() {
SetSpriteCallback(&AnimatedSprite::updateDeltaXY);
}
+KmScene1109::KmScene1109(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
+ : Klayman(vm, parentScene, x, y, 1000, 1000), _flag1(false) {
+
+ // Empty
+}
+
+uint32 KmScene1109::xHandleMessage(int messageNum, const MessageParam &param) {
+ switch (messageNum) {
+ case 0x2000:
+ _flag1 = param.asInteger() != 0;
+ break;
+ case 0x4001:
+ case 0x4800:
+ sub41C930(param.asPoint().x, false);
+ break;
+ case 0x4004:
+ if (_flag1)
+ 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 (_flag1)
+ setCallback2(AnimationCallback(&Klayman::sub4214D0));
+ break;
+ case 0x481E:
+ if (_flag)
+ setCallback2(AnimationCallback(&Klayman::sub421510));
+ break;
+ case 0x4834:
+ setCallback2(AnimationCallback(&Klayman::sub421160));
+ break;
+ case 0x4835:
+ sendMessage(_parentScene, 0x2000, 1);
+ _flag1 = true;
+ setCallback2(AnimationCallback(&Klayman::sub4212C0));
+ break;
+ case 0x4836:
+ sendMessage(_parentScene, 0x2000, 0);
+ _flag1 = false;
+ setCallback2(AnimationCallback(&Klayman::sub421310));
+ break;
+ case 0x483D:
+ sub461F30();
+ break;
+ case 0x483E:
+ sub461F70();
+ break;
+ }
+ return 0;
+}
+
+uint32 KmScene1109::handleMessage461EA0(int messageNum, const MessageParam &param, Entity *sender) {
+ uint32 messageResult = Klayman::handleMessage41D480(messageNum, param, sender);
+ switch (messageNum) {
+ case 0x100D:
+ if (param.asInteger() == 0x4E0A2C24) {
+ _soundResource1.play(0x85B10BB8);
+ } else if (param.asInteger() == 0x4E6A0CA0) {
+ _soundResource1.play(0xC5B709B0);
+ }
+ break;
+ }
+ return messageResult;
+}
+
+void KmScene1109::sub461F30() {
+ _status2 = 0;
+ _flagE5 = false;
+ SetUpdateHandler(&Klayman::update);
+ SetSpriteCallback(NULL);
+ SetMessageHandler(&KmScene1109::handleMessage461EA0);
+ setFileHash(0x2C2A4A1C, 0, -1);
+}
+
+void KmScene1109::sub461F70() {
+ _status2 = 0;
+ _flagE5 = false;
+ SetUpdateHandler(&Klayman::update);
+ SetSpriteCallback(NULL);
+ SetMessageHandler(&KmScene1109::handleMessage461EA0);
+ setFileHash(0x3C2E4245, 0, -1);
+}
+
// KmScene1201
KmScene1201::KmScene1201(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, Entity *class464)
diff --git a/engines/neverhood/klayman.h b/engines/neverhood/klayman.h
index a4d355726b..7b3530c93d 100644
--- a/engines/neverhood/klayman.h
+++ b/engines/neverhood/klayman.h
@@ -305,6 +305,17 @@ protected:
void sub478170();
};
+class KmScene1109 : public Klayman {
+public:
+ KmScene1109(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y);
+protected:
+ bool _flag1;
+ uint32 xHandleMessage(int messageNum, const MessageParam &param);
+ uint32 handleMessage461EA0(int messageNum, const MessageParam &param, Entity *sender);
+ void sub461F30();
+ void sub461F70();
+};
+
class KmScene1201 : public Klayman {
public:
KmScene1201(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, Entity *class464);
diff --git a/engines/neverhood/module1100.cpp b/engines/neverhood/module1100.cpp
index 3ee3f4c3b3..4bafbd96a1 100644
--- a/engines/neverhood/module1100.cpp
+++ b/engines/neverhood/module1100.cpp
@@ -94,7 +94,7 @@ void Module1100::createScene(int sceneNum, int which) {
createSmackerScene(kSmackerFileHashList07, true, true, false);
break;
case 8:
-//TODO _childObject = new Scene1109(_vm, this, which);
+ _childObject = new Scene1109(_vm, this, which);
break;
case 1002:
_countdown = 40;
@@ -108,7 +108,6 @@ void Module1100::createScene(int sceneNum, int which) {
void Module1100::updateScene() {
if (!updateChild()) {
- debug("_vm->gameState().sceneNum = %d", _vm->gameState().sceneNum);
switch (_vm->gameState().sceneNum) {
case 0:
_countdown = 0;
@@ -660,4 +659,61 @@ void Scene1105::update() {
}
}
+Scene1109::Scene1109(NeverhoodEngine *vm, Module *parentModule, int which)
+ : Scene(vm, parentModule, which) {
+
+ _surfaceFlag = true;
+ SetMessageHandler(&Scene1109::handleMessage);
+
+ setBackground(0x8449E02F);
+ setPalette(0x8449E02F);
+ insertMouse433(0x9E02B84C);
+
+ _sprite1 = insertStaticSprite(0x600CEF01, 1100);
+
+ if (which < 0) {
+ insertKlayman<KmScene1109>(140, 436);
+ setMessageList(0x004B6260);
+ sendMessage(this, 0x2000, 0);
+ } else if (which == 1) {
+ insertKlayman<KmScene1109>(450, 436);
+ sendMessage(_klayman, 0x2000, 1);
+ setMessageList(0x004B6268, false);
+ sendMessage(this, 0x2000, 1);
+ } else if (which == 2) {
+ insertKlayman<KmScene1109>(450, 436);
+ sendMessage(_klayman, 0x2000, 1);
+ setMessageList(0x004B6318, false);
+ sendMessage(this, 0x2000, 1);
+ } else if (which == 3) {
+ insertKlayman<KmScene1109>(450, 436);
+ sendMessage(_klayman, 0x2000, 1);
+ setMessageList(0x004B6278, false);
+ sendMessage(this, 0x2000, 1);
+ } else {
+ insertKlayman<KmScene1109>(0, 436);
+ setMessageList(0x004B6258);
+ sendMessage(this, 0x2000, 0);
+ }
+
+ _klayman->setClipRect(0, 0, _sprite1->getDrawRect().x2(), 480);
+
+}
+
+uint32 Scene1109::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
+ Scene::handleMessage(messageNum, param, sender);
+ switch (messageNum) {
+ case 0x2000:
+ if (param.asInteger()) {
+ setRectList(0x004B63A8);
+ _klayman->setKlaymanTable3();
+ } else {
+ setRectList(0x004B6398);
+ _klayman->setKlaymanTable1();
+ }
+ break;
+ }
+ return 0;
+}
+
} // End of namespace Neverhood
diff --git a/engines/neverhood/module1100.h b/engines/neverhood/module1100.h
index 8d49f8fde3..c46c1dfbca 100644
--- a/engines/neverhood/module1100.h
+++ b/engines/neverhood/module1100.h
@@ -123,6 +123,14 @@ protected:
void update();
};
+class Scene1109 : public Scene {
+public:
+ Scene1109(NeverhoodEngine *vm, Module *parentModule, int which);
+protected:
+ Sprite *_sprite1;
+ uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);
+};
+
} // End of namespace Neverhood
#endif /* NEVERHOOD_MODULE1100_H */
diff --git a/engines/neverhood/module1200.cpp b/engines/neverhood/module1200.cpp
index 9c84950a2b..8853dd0df4 100644
--- a/engines/neverhood/module1200.cpp
+++ b/engines/neverhood/module1200.cpp
@@ -971,7 +971,7 @@ uint32 Scene1201::handleMessage(int messageNum, const MessageParam &param, Entit
case 0x2002:
if (getGlobalVar(0x20A0C516)) {
sendEntityMessage(_klayman, 0x1014, _asTntMan);
- setMessageList2(0x004AECF0);
+ setMessageList2(0x004AECF0, false);
} else if (getGlobalVar(0x0112090A) == 3) {
sendEntityMessage(_klayman, 0x1014, _asTntMan);
if (_klayman->getX() > _asTntMan->getX()) {
diff --git a/engines/neverhood/module1300.cpp b/engines/neverhood/module1300.cpp
index 4876135cef..1f3716b2a1 100644
--- a/engines/neverhood/module1300.cpp
+++ b/engines/neverhood/module1300.cpp
@@ -1719,7 +1719,7 @@ uint32 Scene1308::handleMessage(int messageNum, const MessageParam &param, Entit
} else {
setRectList(0x004B5980);
}
- setMessageList(0x004B57E8);
+ setMessageList(0x004B57E8, false);
_sprite1->setVisible(true);
_klayman->setVisible(true);
break;
diff --git a/engines/neverhood/module1700.cpp b/engines/neverhood/module1700.cpp
index 9547d3447c..8140608e8a 100644
--- a/engines/neverhood/module1700.cpp
+++ b/engines/neverhood/module1700.cpp
@@ -214,19 +214,19 @@ Scene1705::Scene1705(NeverhoodEngine *vm, Module *parentModule, int which)
} else if (which == 1) {
insertKlayman<KmScene1705>(431, 434);
sendMessage(_klayman, 0x2000, 1);
- setMessageList(0x004B6A08);
+ setMessageList(0x004B6A08, false);
sendMessage(this, 0x2000, 1);
_klayman->setClipRect(0, 0, _sprite->getDrawRect().x2(), 480);
} else if (which == 2) {
insertKlayman<KmScene1705>(431, 434);
sendMessage(_klayman, 0x2000, 1);
- setMessageList(0x004B6AA0);
+ setMessageList(0x004B6AA0, false);
sendMessage(this, 0x2000, 1);
_klayman->setClipRect(0, 0, _sprite->getDrawRect().x2(), 480);
} else if (which == 3) {
insertKlayman<KmScene1705>(431, 434);
sendMessage(_klayman, 0x2000, 1);
- setMessageList(0x004B6A18);
+ setMessageList(0x004B6A18, false);
sendMessage(this, 0x2000, 1);
_klayman->setClipRect(0, 0, _sprite->getDrawRect().x2(), 480);
} else {
diff --git a/engines/neverhood/module2000.cpp b/engines/neverhood/module2000.cpp
index b870d823ec..22ee648731 100644
--- a/engines/neverhood/module2000.cpp
+++ b/engines/neverhood/module2000.cpp
@@ -114,17 +114,17 @@ Scene2001::Scene2001(NeverhoodEngine *vm, Module *parentModule, int which)
} else if (which == 1) {
insertKlayman<KmScene2001>(116, 345);
sendMessage(_klayman, 0x2000, 1);
- setMessageList(0x004B3540);
+ setMessageList(0x004B3540, false);
sendMessage(this, 0x2000, 1);
} else if (which == 2) {
insertKlayman<KmScene2001>(116, 345);
sendMessage(_klayman, 0x2000, 1);
- setMessageList(0x004B35F0);
+ setMessageList(0x004B35F0, false);
sendMessage(this, 0x2000, 1);
} else if (which == 3) {
insertKlayman<KmScene2001>(116, 345);
sendMessage(_klayman, 0x2000, 1);
- setMessageList(0x004B3550);
+ setMessageList(0x004B3550, false);
sendMessage(this, 0x2000, 1);
} else {
insertKlayman<KmScene2001>(390, 345);
diff --git a/engines/neverhood/scene.cpp b/engines/neverhood/scene.cpp
index 8d7fc787ec..441ee1e291 100644
--- a/engines/neverhood/scene.cpp
+++ b/engines/neverhood/scene.cpp
@@ -249,14 +249,14 @@ void Scene::update() {
if (_mouseClicked) {
if (_klayman) {
// TODO: Merge later
- if (_klayman->hasMessageHandler() &&
+ if (_messageListFlag &&
+ _klayman->hasMessageHandler() &&
sendMessage(_klayman, 0x1008, 0) != 0 &&
- _messageListFlag &&
queryPositionSprite(_mouseClickPos.x, _mouseClickPos.y)) {
_mouseClicked = false;
- } else if (_klayman->hasMessageHandler() &&
- sendMessage(_klayman, 0x1008, 0) != 0 &&
- _messageListFlag) {
+ } else if (_messageListFlag &&
+ _klayman->hasMessageHandler() &&
+ sendMessage(_klayman, 0x1008, 0) != 0) {
_mouseClicked = !queryPositionRectList(_mouseClickPos.x, _mouseClickPos.y);
}
} else if (queryPositionSprite(_mouseClickPos.x, _mouseClickPos.y)) {