aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/neverhood/gamemodule.cpp2
-rw-r--r--engines/neverhood/klayman.cpp86
-rw-r--r--engines/neverhood/klayman.h13
-rw-r--r--engines/neverhood/module1300.cpp109
-rw-r--r--engines/neverhood/module1300.h20
5 files changed, 229 insertions, 1 deletions
diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp
index f4159f3087..8b984e211f 100644
--- a/engines/neverhood/gamemodule.cpp
+++ b/engines/neverhood/gamemodule.cpp
@@ -247,7 +247,7 @@ void GameModule::startup() {
createModule2200(-1);
#endif
#if 1
- _vm->gameState().sceneNum = 1;
+ _vm->gameState().sceneNum = 2;
createModule1300(-1);
#endif
}
diff --git a/engines/neverhood/klayman.cpp b/engines/neverhood/klayman.cpp
index e0359fc28f..d8b1dbee7d 100644
--- a/engines/neverhood/klayman.cpp
+++ b/engines/neverhood/klayman.cpp
@@ -2892,6 +2892,92 @@ void KmScene1201::sub40E040() {
}
}
+KmScene1303::KmScene1303(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
+ : Klayman(vm, parentScene, x, y, 1000, 1000) {
+
+ // Empty
+}
+
+uint32 KmScene1303::xHandleMessage(int messageNum, const MessageParam &param) {
+ switch (messageNum) {
+ case 0x4804:
+ setCallback2(AnimationCallback(&KmScene1303::sub4161D0));
+ break;
+ case 0x483B:
+ setCallback2(AnimationCallback(&KmScene1303::sub4162B0));
+ break;
+ case 0x483C:
+ setCallback2(AnimationCallback(&KmScene1303::sub416210));
+ break;
+ }
+ return 0;
+}
+
+uint32 KmScene1303::handleMessage4160A0(int messageNum, const MessageParam &param, Entity *sender) {
+ uint32 messageResult = handleMessage41D480(messageNum, param, sender);
+ switch (messageNum) {
+ case 0x100D:
+ if (param.asInteger() == calcHash("PopBalloon")) {
+ _parentScene->sendMessage(0x2000, 0, this);
+ } else if (param.asInteger() == 0x02B20220) {
+ _soundResource1.play(0xC5408620);
+ } else if (param.asInteger() == 0x0A720138) {
+ _soundResource1.play(0xD4C08010);
+ } else if (param.asInteger() == 0xB613A180) {
+ _soundResource1.play(0x44051000);
+ }
+ break;
+ }
+ return messageResult;
+}
+
+void KmScene1303::update4161A0() {
+ Klayman::update();
+ _counter3++;
+ if (_counter3 >= _counter3Max)
+ sub416250();
+}
+
+void KmScene1303::sub4161D0() {
+ _status2 = 0;
+ _flagE5 = true;
+ setFileHash(0xAC20C012, 8, 37);
+ SetUpdateHandler(&Klayman::update);
+ SetSpriteCallback(NULL);
+ SetMessageHandler(&Klayman::handleMessage41D480);
+ SetAnimationCallback3(&KmScene1303::sub416250);
+}
+
+void KmScene1303::sub416210() {
+ _status2 = 1;
+ _flagE5 = false;
+ setFileHash(0xAC20C012, 43, 49);
+ SetUpdateHandler(&Klayman::update);
+ SetSpriteCallback(NULL);
+ SetMessageHandler(&Klayman::handleMessage41D480);
+}
+
+void KmScene1303::sub416250() {
+ _counter3 = 0;
+ _status2 = 0;
+ _flagE5 = true;
+ _counter3Max = _vm->_rnd->getRandomNumber(64) + 24;
+ setFileHash(0xAC20C012, 38, 42);
+ SetUpdateHandler(&KmScene1303::update4161A0);
+ SetSpriteCallback(NULL);
+ SetMessageHandler(&Klayman::handleMessage41D360);
+ _newHashListIndex = 42;
+}
+
+void KmScene1303::sub4162B0() {
+ _status2 = 0;
+ _flagE5 = false;
+ setFileHash(0x2426932E, 0, -1);
+ SetUpdateHandler(&Klayman::update);
+ SetSpriteCallback(NULL);
+ SetMessageHandler(&KmScene1303::handleMessage4160A0);
+}
+
// KmScene1401
KmScene1401::KmScene1401(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
diff --git a/engines/neverhood/klayman.h b/engines/neverhood/klayman.h
index 12862e39ae..31a96f7cc7 100644
--- a/engines/neverhood/klayman.h
+++ b/engines/neverhood/klayman.h
@@ -322,6 +322,19 @@ protected:
void sub40E040();
};
+class KmScene1303 : public Klayman {
+public:
+ KmScene1303(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y);
+protected:
+ uint32 xHandleMessage(int messageNum, const MessageParam &param);
+ uint32 handleMessage4160A0(int messageNum, const MessageParam &param, Entity *sender);
+ void update4161A0();
+ void sub4161D0();
+ void sub416210();
+ void sub416250();
+ void sub4162B0();
+};
+
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 7c7beb7cd4..d893e8f483 100644
--- a/engines/neverhood/module1300.cpp
+++ b/engines/neverhood/module1300.cpp
@@ -155,6 +155,11 @@ void Module1300::createScene1302(int which) {
}
void Module1300::createScene1303(int which) {
+ _vm->gameState().sceneNum = 2;
+ // TODO Sound1ChList_setSoundValuesMulti(dword_4B2868, false, 0, 0, 0, 0);
+ // TODO Music18hList_stop(0x203197, 0, 2);
+ _childObject = new Scene1303(_vm, this, which);
+ SetUpdateHandler(&Module1300::updateScene1303);
}
void Module1300::createScene1304(int which) {
@@ -243,6 +248,14 @@ void Module1300::updateScene1302() {
}
void Module1300::updateScene1303() {
+ _childObject->handleUpdate();
+ if (_done) {
+ _done = false;
+ delete _childObject;
+ _childObject = NULL;
+ createScene1306(3);
+ _childObject->handleUpdate();
+ }
}
void Module1300::updateScene1304() {
@@ -661,4 +674,100 @@ uint32 Scene1302::handleMessage(int messageNum, const MessageParam &param, Entit
return messageResult;
}
+AsScene1303Balloon::AsScene1303Balloon(NeverhoodEngine *vm, Scene *parentScene)
+ : AnimatedSprite(vm, 1100), _soundResource(vm), _parentScene(parentScene) {
+
+ // TODO createSurface3(200, dword_4AF9F8);
+ createSurface(200, 640, 480); //TODO: Remeove once the line above is done
+ _x = 289;
+ _y = 390;
+ SetUpdateHandler(&AnimatedSprite::update);
+ SetMessageHandler(&AsScene1303Balloon::handleMessage);
+ SetSpriteCallback(&AnimatedSprite::updateDeltaXY);
+ setFileHash(0x800278D2, 0, -1);
+}
+
+uint32 AsScene1303Balloon::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
+ uint32 messageResult = Sprite::handleMessage(messageNum, param, sender);
+ switch (messageNum) {
+ case 0x1011:
+ _parentScene->sendMessage(0x4826, 0, this);
+ messageResult = 1;
+ break;
+ case 0x2000:
+ stPopBalloon();
+ break;
+ }
+ return messageResult;
+}
+
+uint32 AsScene1303Balloon::hmBalloonPopped(int messageNum, const MessageParam &param, Entity *sender) {
+ uint32 messageResult = Sprite::handleMessage(messageNum, param, sender);
+ switch (messageNum) {
+ case 0x100D:
+ if (param.asInteger() == 0x020B0003) {
+ _soundResource.play(0x742B0055);
+ }
+ break;
+ case 0x3002:
+ _soundResource.play(0x470007EE);
+ setFileHash1();
+ SetMessageHandler(NULL);
+ _surface->setVisible(false);
+ break;
+ }
+ return messageResult;
+}
+
+void AsScene1303Balloon::stPopBalloon() {
+ setFileHash(0xAC004CD0, 0, -1);
+ SetMessageHandler(&AsScene1303Balloon::hmBalloonPopped);
+}
+
+Scene1303::Scene1303(NeverhoodEngine *vm, Module *parentModule, int which)
+ : Scene(vm, parentModule, true) {
+
+ _surfaceFlag = true;
+ SetMessageHandler(&Scene1303::handleMessage);
+ setRectList(0x004AF9E8);
+
+ _background = addBackground(new DirtyBackground(_vm, 0x01581A9C, 0, 0));
+ _palette = new Palette(_vm, 0x01581A9C);
+ _palette->usePalette();
+ _mouseCursor = addSprite(new Mouse433(_vm, 0x81A9801D, NULL));
+
+ if (!getGlobalVar(0xAC00C0D0)) {
+ _asBalloon = addSprite(new AsScene1303Balloon(_vm, this));
+ _vm->_collisionMan->addSprite(_asBalloon);
+ }
+
+ _sprite1 = addSprite(new StaticSprite(_vm, 0xA014216B, 1100));
+
+ _klayman = new KmScene1303(_vm, this, 207, 332);
+ addSprite(_klayman);
+ setMessageList(0x004AF9A0);
+
+ _klayman->getSurface()->getClipRect().x1 = _sprite1->getSurface()->getDrawRect().x;
+ _klayman->getSurface()->getClipRect().y1 = 0;
+ _klayman->getSurface()->getClipRect().x2 = 640;
+ _klayman->getSurface()->getClipRect().y2 = 480;
+
+}
+
+uint32 Scene1303::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
+ Scene::handleMessage(messageNum, param, sender);
+ switch (messageNum) {
+ case 0x2000:
+ setGlobalVar(0xAC00C0D0, 1);
+ _asBalloon->sendMessage(0x2000, 0, this);
+ break;
+ case 0x4826:
+ if (sender == _asBalloon && getGlobalVar(0x31C63C51)) {
+ setMessageList(0x004AF9B8);
+ }
+ break;
+ }
+ return 0;
+}
+
} // End of namespace Neverhood
diff --git a/engines/neverhood/module1300.h b/engines/neverhood/module1300.h
index 25dde469b9..edabe4f3a9 100644
--- a/engines/neverhood/module1300.h
+++ b/engines/neverhood/module1300.h
@@ -127,6 +127,26 @@ protected:
uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);
};
+class AsScene1303Balloon : public AnimatedSprite {
+public:
+ AsScene1303Balloon(NeverhoodEngine *vm, Scene *parentScene);
+protected:
+ Scene *_parentScene;
+ SoundResource _soundResource;
+ uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);
+ uint32 hmBalloonPopped(int messageNum, const MessageParam &param, Entity *sender);
+ void stPopBalloon();
+};
+
+class Scene1303 : public Scene {
+public:
+ Scene1303(NeverhoodEngine *vm, Module *parentModule, int which);
+protected:
+ Sprite *_sprite1;
+ Sprite *_asBalloon;
+ uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);
+};
+
} // End of namespace Neverhood
#endif /* NEVERHOOD_MODULE1300_H */