diff options
author | johndoe123 | 2012-09-04 16:25:47 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2013-05-08 20:43:39 +0200 |
commit | 2aa6e6b89cc968854e84b1e752e36287251b898e (patch) | |
tree | 3e351b727ce158ccb98efec71dccc43ed4c5d5bc /engines | |
parent | 5688047fe353276806bc491e324dbb3a9c9df22f (diff) | |
download | scummvm-rg350-2aa6e6b89cc968854e84b1e752e36287251b898e.tar.gz scummvm-rg350-2aa6e6b89cc968854e84b1e752e36287251b898e.tar.bz2 scummvm-rg350-2aa6e6b89cc968854e84b1e752e36287251b898e.zip |
NEVERHOOD: Implement Scene2809
- Fix some setMessageList parameters
- Add scene 10 in Module2800
Diffstat (limited to 'engines')
-rw-r--r-- | engines/neverhood/gamemodule.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/klayman.cpp | 164 | ||||
-rw-r--r-- | engines/neverhood/klayman.h | 19 | ||||
-rw-r--r-- | engines/neverhood/module2800.cpp | 187 | ||||
-rw-r--r-- | engines/neverhood/module2800.h | 31 |
5 files changed, 388 insertions, 15 deletions
diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index 7ea115cfb9..384f419243 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -328,7 +328,7 @@ void GameModule::startup() { createModule(2700, -1); #endif #if 1 - _vm->gameState().sceneNum = 2; + _vm->gameState().sceneNum = 5; createModule(2800, -1); #endif } diff --git a/engines/neverhood/klayman.cpp b/engines/neverhood/klayman.cpp index 4178bec3a7..de3844e64f 100644 --- a/engines/neverhood/klayman.cpp +++ b/engines/neverhood/klayman.cpp @@ -5514,4 +5514,168 @@ void KmScene2806::sub40F7C0() { startAnimation(0x1C388C04, 0, -1); } +KmScene2809::KmScene2809(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, + bool flag, NRect *clipRects, uint clipRectsCount) + : Klayman(vm, parentScene, x, y, 1000, 1000), + _soundRes1(vm), _soundRes2(vm), _soundRes3(vm), _soundRes4(vm), _soundRes5(vm) { + + if (flag) { + // TODO Maybe? Don't know. Set Klayman clip rects + _soundRes1.load(0x58E0C341); + _soundRes2.load(0x40A00342); + _soundRes3.load(0xD0A1C348); + _soundRes4.load(0x166FC6E0); + _soundRes5.load(0x00018040); + } + + _dataResource.load(0x1830009A); + +} + +uint32 KmScene2809::xHandleMessage(int messageNum, const MessageParam ¶m) { + switch (messageNum) { + case 0x4001: + case 0x4800: + startWalkToX(param.asPoint().x, false); + break; + case 0x4004: + GotoState(&Klayman::stTryStandIdle); + break; + case 0x4804: + startWalkToX(226, true); + break; + case 0x480D: + GotoState(&Klayman::sub420F60); + break; + case 0x4816: + if (param.asInteger() == 0) { + GotoState(&Klayman::stPressButtonSide); + } + break; + case 0x4817: + setDoDeltaX(param.asInteger()); + gotoNextStateExt(); + break; + case 0x4818: + startWalkToX(_dataResource.getPoint(param.asInteger()).x, false); + break; + case 0x4831: + GotoState(&KmScene2809::sub458550); + break; + case 0x4832: + if (param.asInteger() == 1) { + GotoState(&KmScene2809::sub458590); + } else { + GotoState(&Klayman::sub421110); + } + break; + } + return 0; +} + +uint32 KmScene2809::handleMessage457FC0(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = handleMessage41D480(messageNum, param, sender); + switch (messageNum) { + case 0x1008: + if (_flag1) { + startAnimationByHash(0x1C388C04, 0x004A2148, 0); + messageResult = 0; + } else + _flag2 = true; + break; + case 0x100D: + if (param.asInteger() == 0x0002418E) + sendMessage(_parentScene, 0x2000, 0); + else if (param.asInteger() == 0x924090C2) { + _flag1 = true; + if (_flag2) { + startAnimationByHash(0x1C388C04, 0x004A2148, 0); + messageResult = 0; + } + } else if (param.asInteger() == 0x004A2148) + _flag1 = false; + else if (param.asInteger() == 0x02B20220) + _soundResource1.play(0xC5408620); + else if (param.asInteger() == 0x0A720138) + _soundResource1.play(0xD4C08010); + else if (param.asInteger() == 0x03020231) + _soundResource1.play(0xD4C08010); + else if (param.asInteger() == 0xB613A180) + _soundResource1.play(0x44051000); + else if (param.asInteger() == 0x67221A03) + _soundResource1.play(0x44051000); + else if (param.asInteger() == 0x038A010B) + _soundResource1.play(0x00018040); + else if (param.asInteger() == 0x422B0280) + _soundResource1.play(0x166FC6E0); + else if (param.asInteger() == 0x925A0C1E) + _soundResource1.play(0x40E5884D); + else if (param.asInteger() == 0x000F0082) + _soundResource1.play(0x546CDCC1); + else if (param.asInteger() == 0x00020814) + _soundResource1.play(0x786CC6D0); + else if (param.asInteger() == 0x06020500) + _soundResource1.play(0x1069C0E1); + else if (param.asInteger() == 0x02128C00) + _soundResource1.play(0x5068C4C3); + else if (param.asInteger() == 0x82022030) + _soundResource1.play(0x5C48C0E8); + break; + } + return messageResult; +} + +uint32 KmScene2809::handleMessage458340(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = handleMessage41D480(messageNum, param, sender); + switch (messageNum) { + case 0x100D: + if (param.asInteger() == 0x32180101) + _soundResource1.play(0x405002D8); + else if (param.asInteger() == 0x0A2A9098) + _soundResource1.play(0x0460E2FA); + else if (param.asInteger() == 0xD00A0C0C) + _soundRes1.play(); + else if (param.asInteger() == 0x04121920) + _soundRes2.play(); + else if (param.asInteger() == 0x030B4480) + _soundRes3.play(); + else if (param.asInteger() == 0x422B0280) + _soundRes4.play(); + else if (param.asInteger() == 0x038A010B) + _soundRes5.play(); + else if (param.asInteger() == 0x67221A03) + _soundResource1.play(0x44051000); + else if (param.asInteger() == 0x02B20220) + _soundResource1.play(0xC5408620); + else if (param.asInteger() == 0x925A0C1E) + _soundResource1.play(0x40E5884D); + else if (param.asInteger() == 0x03020231) + _soundResource1.play(0xD4C08010); + else if (param.asInteger() == 0x08040840) + setDoDeltaX(2); + break; + } + return messageResult; +} + +void KmScene2809::sub458550() { + _status2 = 0; + _acceptInput = false; + startAnimation(0x2838C010, 0, -1); + SetUpdateHandler(&Klayman::update); + SetMessageHandler(&KmScene2809::handleMessage458340); + SetSpriteUpdate(&AnimatedSprite::updateDeltaXY); +} + +void KmScene2809::sub458590() { + _status2 = 1; + _acceptInput = false; + _flag1 = false; + _flag2 = false; + startAnimation(0x1C388C04, 0, -1); + SetUpdateHandler(&Klayman::update); + SetMessageHandler(&KmScene2809::handleMessage457FC0); + SetSpriteUpdate(&AnimatedSprite::updateDeltaXY); +} + } // End of namespace Neverhood diff --git a/engines/neverhood/klayman.h b/engines/neverhood/klayman.h index 27d92984a2..d508f6cd27 100644 --- a/engines/neverhood/klayman.h +++ b/engines/neverhood/klayman.h @@ -612,6 +612,25 @@ protected: void sub40F7C0(); }; +class KmScene2809 : public Klayman { +public: + KmScene2809(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, + bool flag, NRect *clipRects, uint clipRectsCount); +protected: + SoundResource _soundRes1; + SoundResource _soundRes2; + SoundResource _soundRes3; + SoundResource _soundRes4; + SoundResource _soundRes5; + bool _flag1; + bool _flag2; + uint32 xHandleMessage(int messageNum, const MessageParam ¶m); + uint32 handleMessage457FC0(int messageNum, const MessageParam ¶m, Entity *sender); + uint32 handleMessage458340(int messageNum, const MessageParam ¶m, Entity *sender); + void sub458550(); + void sub458590(); +}; + } // End of namespace Neverhood #endif /* NEVERHOOD_KLAYMAN_H */ diff --git a/engines/neverhood/module2800.cpp b/engines/neverhood/module2800.cpp index 3a787ee013..0862205437 100644 --- a/engines/neverhood/module2800.cpp +++ b/engines/neverhood/module2800.cpp @@ -94,6 +94,14 @@ void Module2800::createScene(int sceneNum, int which) { // TODO Music18hList_play(0xD2FA4D14, 0, 2, 1); _childObject = new Scene2808(_vm, this, 0); break; + case 8: + // TODO Music18hList_play(0xD2FA4D14, 0, 2, 1); + _childObject = new Scene2809(_vm, this, which); + break; + case 10: + // TODO Music18hList_play(0xD2FA4D14, 0, 2, 1); + _childObject = new Scene2808(_vm, this, 1); + break; case 25: // TODO Music18hList_play(0xD2FA4D14, 0, 2, 1); if (getGlobalVar(0x190A1D18)) @@ -163,6 +171,16 @@ void Module2800::updateScene() { case 7: createScene(5, _moduleResult); break; + case 8: + if (_moduleResult == 1) { + createScene(10, 0); + } else { + createScene(9, 4); + } + break; + case 10: + createScene(8, _moduleResult); + break; case 25: createScene(2, 5); break; @@ -463,7 +481,7 @@ Scene2803b::Scene2803b(NeverhoodEngine *vm, Module *parentModule, int which) } else { insertKlayman<KmScene2803b>(135, 444); sub460110(); - setMessageList(0x004B60E0); + setMessageList(0x004B60E0, false); _sprite6->setVisible(true); _sprite7->setVisible(true); } @@ -644,17 +662,17 @@ Scene2805::Scene2805(NeverhoodEngine *vm, Module *parentModule, int which) } else if (which == 1) { insertKlayman<KmScene2805>(493, 338); sendMessage(_klayman, 0x2000, 1); - setMessageList(0x004AE1D0); + setMessageList(0x004AE1D0, false); sendMessage(this, 0x2000, 1); } else if (which == 2) { insertKlayman<KmScene2805>(493, 338); sendMessage(_klayman, 0x2000, 1); - setMessageList(0x004AE288); + setMessageList(0x004AE288, false); sendMessage(this, 0x2000, 1); } else if (which == 3) { insertKlayman<KmScene2805>(493, 338); sendMessage(_klayman, 0x2000, 1); - setMessageList(0x004AE1E0); + setMessageList(0x004AE1E0, false); sendMessage(this, 0x2000, 1); } else { insertKlayman<KmScene2805>(340, 338); @@ -682,19 +700,19 @@ uint32 Scene2805::handleMessage(int messageNum, const MessageParam ¶m, Entit return 0; } -Class469::Class469(NeverhoodEngine *vm) +AsScene2806Spew::AsScene2806Spew(NeverhoodEngine *vm) : AnimatedSprite(vm, 1200), _soundResource(vm) { createSurface1(0x04211490, 1200); _x = 378; _y = 423; SetUpdateHandler(&AnimatedSprite::update); - SetMessageHandler(&Class469::handleMessage); + SetMessageHandler(&AsScene2806Spew::handleMessage); setDoDeltaX(1); setVisible(false); } -uint32 Class469::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { +uint32 AsScene2806Spew::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { case 0x2000: @@ -757,7 +775,7 @@ Scene2806::Scene2806(NeverhoodEngine *vm, Module *parentModule, int which) insertStaticSprite(0x0201410A, 1100); insertStaticSprite(0x72875F42, 1100); - _class469 = insertSprite<Class469>(); + _asSpew = insertSprite<AsScene2806Spew>(); _clipRects[2].y1 = 0; _clipRects[3].y2 = 480; @@ -772,10 +790,10 @@ Scene2806::Scene2806(NeverhoodEngine *vm, Module *parentModule, int which) setMessageList(0x004AF098); } else if (which == 2) { insertKlayman<KmScene2806>(378, 423, false, _clipRects, 4); - setMessageList(0x004AF0C8); + setMessageList(0x004AF0C8, false); } else if (which == 3) { insertKlayman<KmScene2806>(378, 423, true, _clipRects, 4); - setMessageList(0x004AF0A0); + setMessageList(0x004AF0A0, false); setGlobalVar(0x1860C990, 0); } else { insertKlayman<KmScene2806>(670, 423, false, _clipRects, 4); @@ -796,7 +814,7 @@ uint32 Scene2806::handleMessage(int messageNum, const MessageParam ¶m, Entit } break; case 0x2000: - sendMessage(_class469, 0x2000, 0); + sendMessage(_asSpew, 0x2000, 0); break; } return 0; @@ -1276,5 +1294,152 @@ bool Scene2808::isAnyTestTubeFilled() { _asTestTubes[2]->getFillLevel() > 0; } +AsScene2809Spew::AsScene2809Spew(NeverhoodEngine *vm) + : AnimatedSprite(vm, 1200), _soundResource(vm) { + + SetUpdateHandler(&AnimatedSprite::update); + SetMessageHandler(&AsScene2809Spew::handleMessage); + createSurface1(0x04211490, 1200); + _x = 262; + _y = 423; + setDoDeltaX(0); + setVisible(false); +} + +uint32 AsScene2809Spew::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { + uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); + switch (messageNum) { + case 0x2000: + _soundResource.play(0x48640244); + startAnimation(0x04211490, 0, -1); + setVisible(true); + break; + case 0x3002: + stopAnimation(); + setVisible(false); + break; + } + return messageResult; +} + +Scene2809::Scene2809(NeverhoodEngine *vm, Module *parentModule, int which) + : Scene(vm, parentModule, true) { + + Sprite *tempSprite; + + _surfaceFlag = true; + SetMessageHandler(&Scene2809::handleMessage); + SetUpdateHandler(&Scene2809::update); + + loadDataResource(0x1830009A); + loadHitRectList(); + + _pointList = _dataResource.getPointArray(0x064A310E); + + setBackground(0xB22116C5); + setPalette(0xB22116C5); + insertMouse433(0x116C1B2A); + + _sprite1 = insertStaticSprite(0x1FA2EB82, 1100); + + _clipRects[0].x1 = _sprite1->getDrawRect().x; + _clipRects[0].y1 = _sprite1->getDrawRect().y; + _clipRects[0].x2 = _sprite1->getDrawRect().x2(); + _clipRects[0].y2 = _sprite1->getDrawRect().y2(); + + _sprite2 = insertStaticSprite(0x037321B2, 1100); + _clipRects[1].y2 = _sprite2->getDrawRect().y2(); + + _sprite3 = insertStaticSprite(0x82022E11, 1100); + + _sprite4 = insertStaticSprite(0x09236252, 1100); + _clipRects[1].x2 = _sprite4->getDrawRect().x2(); + _clipRects[1].y1 = _sprite4->getDrawRect().y; + + tempSprite = insertStaticSprite(0x010C22F2, 1100); + _clipRects[2].x2 = tempSprite->getDrawRect().x2(); + _clipRects[2].y2 = tempSprite->getDrawRect().y2(); + _clipRects[3].y1 = tempSprite->getDrawRect().y2(); + _clipRects[1].x1 = tempSprite->getDrawRect().x2(); + + tempSprite = insertStaticSprite(0x877F6252, 1100); + _clipRects[3].x2 = tempSprite->getDrawRect().x2(); + + insertStaticSprite(0x01612A22, 1100); + insertStaticSprite(0x877F6252, 1100); + + _asSpew = insertSprite<AsScene2809Spew>(); + _clipRects[2].y1 = 0; + _clipRects[3].y2 = 480; + _clipRects[2].x1 = 0; + _clipRects[3].x1 = 0; + + if (which < 0) { + insertKlayman<KmScene2809>(226, 423, false, _clipRects, 4); + setMessageList(0x004B5B90); + } else if (which == 1) { + insertKlayman<KmScene2809>(262, 423, false, _clipRects, 4); + setMessageList(0x004B5B90); + } else if (which == 2) { + insertKlayman<KmScene2809>(262, 423, false, _clipRects, 4); + setMessageList(0x004B5BD0); + } else if (which == 3) { + insertKlayman<KmScene2809>(262, 423, true, _clipRects, 4); + setMessageList(0x004B5BA8, false); + setGlobalVar(0x1860C990, 0); + } else { + insertKlayman<KmScene2809>(-30, 423, false, _clipRects, 4); + setMessageList(0x004B5B88); + } + + _pointIndex = -1; + findClosestPoint(); + +} + +void Scene2809::update() { + Scene::update(); + findClosestPoint(); +} + +uint32 Scene2809::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { + Scene::handleMessage(messageNum, param, sender); + switch (messageNum) { + case 0x100D: + if (param.asInteger() == 0x160DA937) { + setMessageList(0x004B5B98); + } + break; + case 0x2000: + sendMessage(_asSpew, 0x2000, 0); + break; + } + return 0; +} + +void Scene2809::findClosestPoint() { + + static const uint32 kScene2809PaletteFileHashes[] = { + 0x04260848, + 0x12970401, + 0x128F0401, + 0x12830401, + 0x12850401, + 0x6A8B9008 + }; + + int16 x = MAX<int16>(_klayman->getX(), 2); + int index = 1; + + while (index < (int)_pointList->size() && (*_pointList)[index].x >= x) + ++index; + --index; + + if (_pointIndex != index) { + _pointIndex = index; + _palette->addPalette(kScene2809PaletteFileHashes[index], 0, 64, 0); + } + +} } // End of namespace Neverhood diff --git a/engines/neverhood/module2800.h b/engines/neverhood/module2800.h index 4026093b1d..404f9ace1a 100644 --- a/engines/neverhood/module2800.h +++ b/engines/neverhood/module2800.h @@ -102,9 +102,9 @@ protected: uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); }; -class Class469 : public AnimatedSprite { +class AsScene2806Spew : public AnimatedSprite { public: - Class469(NeverhoodEngine *vm); + AsScene2806Spew(NeverhoodEngine *vm); protected: SoundResource _soundResource; uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); @@ -122,7 +122,7 @@ protected: Sprite *_sprite2; Sprite *_sprite3; Sprite *_sprite4; - Sprite *_class469; + Sprite *_asSpew; uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); void update(); void findClosestPoint(); @@ -213,6 +213,31 @@ protected: bool isAnyTestTubeFilled(); }; +class AsScene2809Spew : public AnimatedSprite { +public: + AsScene2809Spew(NeverhoodEngine *vm); +protected: + SoundResource _soundResource; + uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); +}; + +class Scene2809 : public Scene { +public: + Scene2809(NeverhoodEngine *vm, Module *parentModule, int which); +protected: + NPointArray *_pointList; + int _pointIndex; + NRect _clipRects[4]; + Sprite *_sprite1; + Sprite *_sprite2; + Sprite *_sprite3; + Sprite *_sprite4; + Sprite *_asSpew; + void update(); + uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); + void findClosestPoint(); +}; + } // End of namespace Neverhood #endif /* NEVERHOOD_MODULE2800_H */ |