aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorjohndoe1232012-08-17 15:03:38 +0000
committerWillem Jan Palenstijn2013-05-08 20:43:38 +0200
commitee7bd2fc6c228d3088cb236c54614b656af17636 (patch)
treece573ce04cf40014ae1beb5564d30b44990c2cdc /engines
parent646790489886aa8adb9a5bfc6e6ec6c57e5aa62b (diff)
downloadscummvm-rg350-ee7bd2fc6c228d3088cb236c54614b656af17636.tar.gz
scummvm-rg350-ee7bd2fc6c228d3088cb236c54614b656af17636.tar.bz2
scummvm-rg350-ee7bd2fc6c228d3088cb236c54614b656af17636.zip
NEVERHOOD: Implement Scene2803b
- Also some more Klayman stuff used by that scene
Diffstat (limited to 'engines')
-rw-r--r--engines/neverhood/gamemodule.cpp2
-rw-r--r--engines/neverhood/klayman.cpp280
-rw-r--r--engines/neverhood/klayman.h33
-rw-r--r--engines/neverhood/module2800.cpp287
-rw-r--r--engines/neverhood/module2800.h24
5 files changed, 607 insertions, 19 deletions
diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp
index 37e87431bf..a424d53556 100644
--- a/engines/neverhood/gamemodule.cpp
+++ b/engines/neverhood/gamemodule.cpp
@@ -303,7 +303,7 @@ void GameModule::startup() {
createModule(2700, -1);
#endif
#if 1
- _vm->gameState().sceneNum = 4;
+ _vm->gameState().sceneNum = 2;
createModule(2800, -1);
#endif
}
diff --git a/engines/neverhood/klayman.cpp b/engines/neverhood/klayman.cpp
index 247c946bc3..010c2e4ef0 100644
--- a/engines/neverhood/klayman.cpp
+++ b/engines/neverhood/klayman.cpp
@@ -62,7 +62,7 @@ Klayman::Klayman(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, int
_counterMax(0), _counter(0), _isMoveObjectRequested(false), _counter3Max(0), _isWalkingOpenDoorNotified(false), _counter1(0),
_counter2(0), /*_field118(0), */_status2(0), _acceptInput(true), _attachedSprite(NULL), _isWalking(false),
_status3(1), _parentScene(parentScene), _isSneaking(false), _isLargeStep(false), _flagF6(false), _isLeverDown(false),
- _flagFA(false), _ladderStatus(0), _field114(0), _resourceHandle(-1), _soundFlag(false) {
+ _flagFA(false), _ladderStatus(0), _pathPoints(NULL), _resourceHandle(-1), _soundFlag(false) {
// TODO DirtySurface
createSurface(surfacePriority, 320, 200);
@@ -574,11 +574,9 @@ uint32 Klayman::handleMessage41D360(int messageNum, const MessageParam &param, E
break;
case 0x482C:
if (param.asInteger() != 0) {
- debug("#################################################");
- // TODO _rectResource.getRectangle2(param.asInteger(), &_field118, &_field114,);
+ _pathPoints = _dataResource.getPointArray(param.asInteger());
} else {
- debug("#################################################");
- // TODO _field114 = 0;
+ _pathPoints = NULL;
}
break;
}
@@ -757,9 +755,8 @@ void Klayman::suWalking() {
if (_destX != _x) {
HitRect *hitRectPrev = _vm->_collisionMan->findHitRectAtPos(_x, _y);
_x += xdiff;
- if (_field114) {
- error("// TODO Klayman_sub_41CF70");
- // TODO Klayman_sub_41CF70
+ if (_pathPoints) {
+ walkAlongPathPoints();
} else {
HitRect *hitRectNext = _vm->_collisionMan->findHitRectAtPos(_x, _y);
if (hitRectNext->type == 0x5002) {
@@ -939,9 +936,8 @@ void Klayman::suWalkingTestExit() {
} else {
HitRect *hitRectPrev = _vm->_collisionMan->findHitRectAtPos(_x, _y);
_x += xdelta;
- if (_field114) {
- error("_field114");
- // TODO Klayman_sub_41CF70
+ if (_pathPoints) {
+ walkAlongPathPoints();
} else {
HitRect *hitRectNext = _vm->_collisionMan->findHitRectAtPos(_x, _y);
if (hitRectNext->type == 0x5002) {
@@ -1096,6 +1092,153 @@ void Klayman::startSpecialWalkLeft(int16 x) {
}
}
+void Klayman::sub41CDE0(int16 x) {
+ _status3 = 2;
+ if (_x == x) {
+ _destX = x;
+ if (_isWalking) {
+ GotoState(NULL);
+ gotoNextStateExt();
+ }
+ } else if (_isWalking && ((!_doDeltaX && x - _x > 0) || (_doDeltaX && x - _x < 0))) {
+ _destX = x;
+ } else {
+ _destX = x;
+ GotoState(&Klayman::sub421680);
+ }
+}
+
+void Klayman::sub421680() {
+ _isWalking = true;
+ _acceptInput = true;
+ _status3 = 2;
+ setDoDeltaX(_destX < _x ? 1 : 0);
+ startAnimation(0x3A4CD934, 0, -1);
+ SetUpdateHandler(&Klayman::update);
+ SetMessageHandler(&Klayman::handleMessage41ED70);
+ SetSpriteUpdate(&Klayman::suWalkingTestExit);
+ FinalizeState(&Klayman::stStartWalkingDone);
+}
+
+uint32 Klayman::handleMessage41ED70(int messageNum, const MessageParam &param, Entity *sender) {
+ uint32 messageResult = handleMessage41D360(messageNum, param, sender);
+ switch (messageNum) {
+ case 0x100D:
+ if (param.asInteger() == 0x32180101)
+ _soundResource1.play(0x4924AAC4);
+ else if (param.asInteger() == 0x0A2A9098)
+ _soundResource1.play(0x0A2AA8E0);
+ }
+ return messageResult;
+}
+
+void Klayman::sub421640() {
+ _status2 = 0;
+ _acceptInput = true;
+ startAnimation(0x90D0D1D0, 0, -1);
+ SetUpdateHandler(&Klayman::update);
+ SetMessageHandler(&Klayman::handleMessage41D360);
+ SetSpriteUpdate(NULL);
+}
+
+void Klayman::sub421740() {
+ _status2 = 0;
+ _acceptInput = true;
+ startAnimation(0x11C8D156, 30, -1);
+ SetUpdateHandler(&Klayman::update);
+ SetMessageHandler(&Klayman::handleMessage41D480);
+ SetSpriteUpdate(NULL);
+}
+
+void Klayman::sub421780() {
+ _status2 = 0;
+ _acceptInput = true;
+ startAnimation(0x11C8D156, 0, 10);
+ SetUpdateHandler(&Klayman::update);
+ SetMessageHandler(&Klayman::handleMessage41D480);
+ SetSpriteUpdate(NULL);
+}
+
+void Klayman::sub421700() {
+ _status2 = 0;
+ _acceptInput = true;
+ startAnimation(0x11C8D156, 0, -1);
+ SetUpdateHandler(&Klayman::update);
+ SetMessageHandler(&Klayman::handleMessage41D480);
+ SetSpriteUpdate(NULL);
+}
+
+void Klayman::sub421840() {
+ _status2 = 0;
+ _acceptInput = false;
+ startAnimationByHash(0x3F9CC394, 0x14884392, 0);
+ SetUpdateHandler(&Klayman::update);
+ SetMessageHandler(&Klayman::handleMessage41EE00);
+ SetSpriteUpdate(&Klayman::spriteUpdate41F230);
+}
+
+uint32 Klayman::handleMessage41EE00(int messageNum, const MessageParam &param, Entity *sender) {
+ uint32 messageResult = handleMessage41D480(messageNum, param, sender);
+ switch (messageNum) {
+ case 0x100D:
+ if (param.asInteger() == 0x80C110B5)
+ sendMessage(_parentScene, 0x482A, 0);
+ else if (param.asInteger() == 0x110010D1)
+ sendMessage(_parentScene, 0x482B, 0);
+ else if (param.asInteger() == 0x32180101)
+ _soundResource1.play(0x4924AAC4);
+ else if (param.asInteger() == 0x0A2A9098)
+ _soundResource1.play(0x0A2AA8E0);
+ break;
+ }
+ return messageResult;
+}
+
+void Klayman::sub421800() {
+ _status2 = 0;
+ _acceptInput = false;
+ startAnimation(0x2F1C4694, 0, -1);
+ SetUpdateHandler(&Klayman::update);
+ SetMessageHandler(&Klayman::handleMessage41EE00);
+ SetSpriteUpdate(&Klayman::spriteUpdate41F230);
+}
+
+void Klayman::sub4217C0() {
+ _status2 = 0;
+ _acceptInput = false;
+ startAnimation(0x3F9CC394, 0, -1);
+ SetUpdateHandler(&Klayman::update);
+ SetMessageHandler(&Klayman::handleMessage41EE00);
+ SetSpriteUpdate(&Klayman::spriteUpdate41F230);
+}
+
+void Klayman::sub421900() {
+ _status2 = 0;
+ _acceptInput = false;
+ startAnimationByHash(0x37ECD436, 0, 0x8520108C);
+ SetUpdateHandler(&Klayman::update);
+ SetMessageHandler(&Klayman::handleMessage41EE00);
+ SetSpriteUpdate(&Klayman::spriteUpdate41F230);
+}
+
+void Klayman::sub4218C0() {
+ _status2 = 0;
+ _acceptInput = false;
+ startAnimation(0x16EDDE36, 0, -1);
+ SetUpdateHandler(&Klayman::update);
+ SetMessageHandler(&Klayman::handleMessage41EE00);
+ SetSpriteUpdate(&Klayman::spriteUpdate41F230);
+}
+
+void Klayman::sub421880() {
+ _status2 = 0;
+ _acceptInput = false;
+ startAnimation(0x37ECD436, 0, -1);
+ SetUpdateHandler(&Klayman::update);
+ SetMessageHandler(&Klayman::handleMessage41EE00);
+ SetSpriteUpdate(&Klayman::spriteUpdate41F230);
+}
+
void Klayman::sub41CC40(int16 x1, int16 x2) {
if (_x > x1) {
if (_x == x1 + x2) {
@@ -1182,9 +1325,8 @@ void Klayman::suLargeStep() {
if (_x != _destX) {
HitRect *hitRectPrev = _vm->_collisionMan->findHitRectAtPos(_x, _y);
_x += xdiff;
- if (_field114) {
- error("// TODO Klayman_sub_41CF70();");
- // TODO Klayman_sub_41CF70();
+ if (_pathPoints) {
+ walkAlongPathPoints();
} else {
HitRect *hitRectNext = _vm->_collisionMan->findHitRectAtPos(_x, _y);
if (hitRectNext->type == 0x5002) {
@@ -1928,6 +2070,39 @@ uint32 Klayman::hmInsertDisk(int messageNum, const MessageParam &param, Entity *
return handleMessage41D480(messageNum, param, sender);
}
+void Klayman::walkAlongPathPoints() {
+ if (_x <= (*_pathPoints)[0].x)
+ _y = (*_pathPoints)[0].y;
+ else if (_x >= (*_pathPoints)[_pathPoints->size() - 1].x)
+ _y = (*_pathPoints)[_pathPoints->size() - 1].y;
+ else {
+ int16 deltaX = _x - (*_pathPoints)[0].x, deltaXIncr = 0;
+ uint index = 0;
+ while (deltaX > 0) {
+ NPoint pt2 = (*_pathPoints)[index];
+ NPoint pt1 = index + 1 >= _pathPoints->size() ? (*_pathPoints)[0] : (*_pathPoints)[index + 1];
+ int16 xd = ABS(pt1.x - pt2.x);
+ int16 yd = ABS(pt1.y - pt2.y);
+ if (deltaX + deltaXIncr >= xd) {
+ deltaX -= xd;
+ deltaX += deltaXIncr;
+ ++index;
+ if (index >= _pathPoints->size())
+ index = 0;
+ _y = (*_pathPoints)[index].y;
+ } else {
+ deltaXIncr += deltaX;
+ if (pt1.y >= pt2.y) {
+ _y = pt2.y + (yd * deltaXIncr) / xd;
+ } else {
+ _y = pt2.y - (yd * deltaXIncr) / xd;
+ }
+ deltaX = 0;
+ }
+ }
+ }
+}
+
//##############################################################################
// KmScene1001
@@ -4916,6 +5091,83 @@ uint32 KmScene2801::xHandleMessage(int messageNum, const MessageParam &param) {
return 0;
}
+KmScene2803b::KmScene2803b(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
+ : Klayman(vm, parentScene, x, y, 1000, 1000), _soundResource(vm) {
+
+ _dataResource.load(0x81120132);
+ _soundResource.load(0x10688664);
+}
+
+uint32 KmScene2803b::xHandleMessage(int messageNum, const MessageParam &param) {
+ switch (messageNum) {
+ case 0x4001:
+ case 0x4800:
+ sub41CDE0(param.asPoint().x);
+ break;
+ case 0x4004:
+ GotoState(&Klayman::sub421640);
+ break;
+ case 0x4817:
+ setDoDeltaX(param.asInteger());
+ gotoNextStateExt();
+ break;
+ case 0x4818:
+ sub41CDE0(_dataResource.getPoint(param.asInteger()).x);
+ break;
+ case 0x481F:
+ if (param.asInteger() == 1)
+ GotoState(&Klayman::sub421740);
+ else if (param.asInteger() == 0)
+ GotoState(&Klayman::sub421780);
+ else
+ GotoState(&Klayman::sub421700);
+ break;
+ case 0x482E:
+ if (param.asInteger() == 1)
+ GotoState(&Klayman::sub421840);
+ else if (param.asInteger() == 2)
+ GotoState(&Klayman::sub421800);
+ else
+ GotoState(&Klayman::sub4217C0);
+ break;
+ case 0x482F:
+ if (param.asInteger() == 1)
+ GotoState(&Klayman::sub421900);
+ else if (param.asInteger() == 2)
+ GotoState(&Klayman::sub4218C0);
+ else
+ GotoState(&Klayman::sub421880);
+ break;
+ case 0x4830:
+ GotoState(&KmScene2803b::sub460670);
+ break;
+ }
+ return 0;
+}
+
+uint32 KmScene2803b::handleMessage460600(int messageNum, const MessageParam &param, Entity *sender) {
+ uint32 messageResult = handleMessage41D480(messageNum, param, sender);
+ switch (messageNum) {
+ case 0x100D:
+ if (param.asInteger() == 0x80C110B5)
+ sendMessage(_parentScene, 0x482A, 0);
+ else if (param.asInteger() == 0x33288344)
+ _soundResource.play();
+ break;
+ }
+ return messageResult;
+}
+
+void KmScene2803b::sub460670() {
+ _status2 = 0;
+ _acceptInput = false;
+ startAnimation(0x1AE88904, 0, -1);
+ _soundResource1.play(0x4C69EA53);
+ SetUpdateHandler(&Klayman::update);
+ SetSpriteUpdate(&AnimatedSprite::updateDeltaXY);
+ SetMessageHandler(&KmScene2803b::handleMessage460600);
+}
+
KmScene2805::KmScene2805(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y)
: Klayman(vm, parentScene, x, y, 1000, 1000), _isSittingInTeleporter(false) {
// Empty
diff --git a/engines/neverhood/klayman.h b/engines/neverhood/klayman.h
index 5f4076e303..ab7ccb6050 100644
--- a/engines/neverhood/klayman.h
+++ b/engines/neverhood/klayman.h
@@ -140,6 +140,17 @@ public:
void setSoundFlag(bool value) { _soundFlag = value; }
+ void sub421640();
+ void sub421740();
+ void sub421780();
+ void sub421700();
+ void sub421840();
+ void sub421800();
+ void sub4217C0();
+ void sub421900();
+ void sub4218C0();
+ void sub421880();
+
protected:
Entity *_parentScene;
Sprite *_attachedSprite;
@@ -165,10 +176,7 @@ protected:
const KlaymanIdleTableItem *_idleTable;
int _idleTableCount;
int _idleTableMaxValue;
- uint32 _field114;
- /*
- 00000118 field118 dw ?
- */
+ NPointArray *_pathPoints;
bool _soundFlag;
int _resourceHandle;
virtual void xUpdate();
@@ -249,6 +257,13 @@ protected:
uint32 hmInsertDisk(int messageNum, const MessageParam &param, Entity *sender);
+ void sub41CDE0(int16 x);
+ void sub421680();
+ uint32 handleMessage41ED70(int messageNum, const MessageParam &param, Entity *sender);
+ uint32 handleMessage41EE00(int messageNum, const MessageParam &param, Entity *sender);
+
+ void walkAlongPathPoints();
+
};
class KmScene1001 : public Klayman {
@@ -549,6 +564,16 @@ protected:
uint32 xHandleMessage(int messageNum, const MessageParam &param);
};
+class KmScene2803b : public Klayman {
+public:
+ KmScene2803b(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y);
+protected:
+ SoundResource _soundResource;
+ uint32 xHandleMessage(int messageNum, const MessageParam &param);
+ uint32 handleMessage460600(int messageNum, const MessageParam &param, Entity *sender);
+ void sub460670();
+};
+
class KmScene2805 : public Klayman {
public:
KmScene2805(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y);
diff --git a/engines/neverhood/module2800.cpp b/engines/neverhood/module2800.cpp
index c1e70483a6..c6ce1791f7 100644
--- a/engines/neverhood/module2800.cpp
+++ b/engines/neverhood/module2800.cpp
@@ -73,6 +73,15 @@ void Module2800::createScene(int sceneNum, int which) {
}
#endif
break;
+ case 2:
+ // TODO Music18hList_play(0xD2FA4D14, 0, 2, 1);
+ setGlobalVar(0x1860C990,1);//DEBUG
+ if (getGlobalVar(0x1860C990))
+ _childObject = new Scene2803b(_vm, this, which);
+ else {
+ // TODO _childObject = new Scene2803(_vm, this, which);
+ }
+ break;
case 4:
// TODO Music18hList_stop(0xD2FA4D14, 0, 2);
_childObject = new Scene2805(_vm, this, which);
@@ -108,6 +117,20 @@ void Module2800::updateScene() {
createScene(1001, -1);
}
break;
+ case 2:
+ if (_moduleResult == 1)
+ createScene(3, 0);
+ else if (_moduleResult == 2)
+ createScene(5, 0);
+ else if (_moduleResult == 3)
+ createScene(6, 0);
+ else if (_moduleResult == 4)
+ createScene(9, 0);
+ else if (_moduleResult == 5)
+ createScene(25, 0);
+ else
+ createScene(0, 1);
+ break;
case 4:
if (_moduleResult == 1) {
leaveModule(1);
@@ -239,6 +262,270 @@ uint32 Scene2801::handleMessage(int messageNum, const MessageParam &param, Entit
return messageResult;
}
+Scene2803b::Scene2803b(NeverhoodEngine *vm, Module *parentModule, int which)
+ : Scene(vm, parentModule, true), _palStatus(0) {
+
+ static const uint32 kScene2803bFileHashes1[] = {
+ 0, 0x081000F1, 0x08100171, 0x08100271
+ };
+
+ static const uint32 kScene2803bFileHashes2[] = {
+ 0, 0x286800D4, 0x286806D4, 0x28680AD4
+ };
+
+ _surfaceFlag = true;
+ SetMessageHandler(&Scene2803b::handleMessage);
+
+ loadDataResource(0x81120132);
+ insertMouse433(0x00A05290);
+
+ // TODO insertSprite<Class488>(this, 0xAFAD591A, 0x276E321D, 578, 200);
+
+ if (getGlobalVar(0x190A1D18)) {
+ setBackground(0x412A423E);
+ setPalette(0x412A423E);
+ _palette->addBasePalette(0x412A423E, 0, 256, 0);
+ addEntity(_palette);
+ _sprite1 = insertStaticSprite(0x0C03AA23, 1100);
+ _sprite2 = insertStaticSprite(0x24320220, 1100);
+ _sprite3 = insertStaticSprite(0x1A032204, 1100);
+ _sprite4 = insertStaticSprite(0x18032204, 1100);
+ _sprite5 = insertStaticSprite(0x34422912, 1100);
+ _sprite6 = insertStaticSprite(0x3C42022F, 1100);
+ _sprite7 = insertStaticSprite(0x341A0237, 1100);
+
+ if (getSubVar(0x0C601058, 0) == 0)
+ insertStaticSprite(0x66121222, 100);
+ else
+ insertSprite<AnimatedSprite>(kScene2803bFileHashes1[getSubVar(0x0C601058, 0)], 100, 529, 326);
+
+ if (getSubVar(0x0C601058, 1) == 3)
+ insertStaticSprite(0x64330236, 100);
+
+ if (getSubVar(0x0C601058, 2) == 3)
+ insertStaticSprite(0x2E4A22A2, 100);
+
+ } else {
+ setBackground(0x29800A01);
+ setPalette(0x29800A01);
+ _palette->addBasePalette(0x29800A01, 0, 256, 0);
+ addEntity(_palette);
+ _sprite1 = insertStaticSprite(0x16202200, 1100);
+ _sprite2 = insertStaticSprite(0xD0802EA0, 1100);
+ _sprite3 = insertStaticSprite(0x780C2E30, 1100);
+ _sprite4 = insertStaticSprite(0x700C2E30, 1100);
+ _sprite5 = insertStaticSprite(0x102CE6E1, 900);
+ _sprite6 = insertStaticSprite(0x108012C1, 1100);
+ _sprite7 = insertStaticSprite(0x708072E0, 1100);
+ insertStaticSprite(0x90582EA4, 100);
+
+ setSubVar(0x0C601058, 0, 1);//DEBUG, FIXME crashes when not done?!
+ if (getSubVar(0x0C601058, 0) == 0)
+ insertStaticSprite(0x50C027A8, 100);
+ else
+ insertSprite<AnimatedSprite>(kScene2803bFileHashes2[getSubVar(0x0C601058, 0)], 100, 529, 326);
+
+ if (getSubVar(0x0C601058, 1) == 3)
+ insertStaticSprite(0xD48077A0, 100);
+
+ if (getSubVar(0x0C601058, 2) == 3)
+ insertStaticSprite(0x30022689, 100);
+
+ }
+
+ _sprite6->setVisible(false);
+ _sprite7->setVisible(false);
+
+ if (which < 0) {
+ insertKlayman<KmScene2803b>(479, 435);
+ sub460110();
+ setMessageList(0x004B60D8);
+ } else if (which == 3) {
+ NPoint pt = _dataResource.getPoint(0x096520ED);
+ insertKlayman<KmScene2803b>(pt.x, pt.y);
+ sub460090();
+ setMessageList(0x004B6100);
+ _klayman->setRepl(64, 0);
+ } else if (which == 4) {
+ NPoint pt = _dataResource.getPoint(0x20C6238D);
+ insertKlayman<KmScene2803b>(pt.x, pt.y);
+ sub460090();
+ setMessageList(0x004B60F8);
+ _klayman->setRepl(64, 0);
+ } else if (which == 5) {
+ NPoint pt = _dataResource.getPoint(0x2146690D);
+ insertKlayman<KmScene2803b>(pt.x, pt.y);
+ sub460090();
+ setMessageList(0x004B6100);
+ _klayman->setRepl(64, 0);
+ } else if (which == 2) {
+ NPoint pt = _dataResource.getPoint(0x104C03ED);
+ insertKlayman<KmScene2803b>(pt.x, pt.y);
+ sub460110();
+ setMessageList(0x004B6138);
+ } else {
+ insertKlayman<KmScene2803b>(135, 444);
+ sub460110();
+ setMessageList(0x004B60E0);
+ _sprite6->setVisible(true);
+ _sprite7->setVisible(true);
+ }
+
+}
+
+uint32 Scene2803b::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
+ Scene::handleMessage(messageNum, param, sender);
+ switch (messageNum) {
+ case 0x100D:
+ if (param.asInteger() == 0xB4E4884C) {
+ setMessageList(0x004B6180);
+ } else if (param.asInteger() == 0xB1FDAB2E) {
+ NPoint pt = _dataResource.getPoint(0x0D84A1AD);
+ _klayman->setX(pt.x);
+ _klayman->setY(pt.y);
+ _klayman->processDelta();
+ sub460110();
+ _klayman->setClipRect(517, 401, 536, 480);
+ setMessageList(0x004B6198);
+ } else if (param.asInteger() == 0xB00C7C48) {
+ setMessageList(0x004B6108);
+ } else if (param.asInteger() == 0x61F64346) {
+ setMessageList(0x004B6150);
+ } else if (param.asInteger() == 0xAC69A28D) {
+ setMessageList(0x004B6168);
+ } else if (param.asInteger() == 0x00086212) {
+ _klayman->setClipRect(0, 0, 560, 315);
+ _klayman->setX(560);
+ _klayman->setY(315);
+ _klayman->processDelta();
+ sub460090();
+ setMessageList(0x004B61A0);
+ } else if (param.asInteger() == 0x002CAA68) {
+ setMessageList(0x004B61A8);
+ }
+ break;
+ case 0x482A:
+ if (_klayman->getX() < 200) {
+ sub4601D0();
+ } else if (_klayman->getX() < 500) {
+ setSurfacePriority(_sprite5->getSurface(), 1100);
+ sendMessage(_klayman, 0x482C, 0);
+ sub4601B0();
+ } else {
+ _klayman->setClipRect(517, 401, 536, 480);
+ sub4601B0();
+ }
+ break;
+ case 0x482B:
+ _sprite6->setVisible(false);
+ _sprite7->setVisible(false);
+ _klayman->setClipRect(0, 0, 640, 480);
+ setSurfacePriority(_sprite5->getSurface(), 900);
+ sendMessage(_klayman, 0x482C, 0x2086222D);
+ break;
+ }
+ return 0;
+}
+
+void Scene2803b::update45FCB0() {
+ if (_klayman->getX() < 388) {
+ _klayman->setClipRect(_sprite3->getDrawRect().x, 0, 640, _sprite3->getDrawRect().y2());
+ sub460170();
+ } else if (_klayman->getX() < 500) {
+ _klayman->setClipRect(0, 0, _sprite1->getDrawRect().x2(), _sprite1->getDrawRect().y2());
+ sub460190();
+ }
+ Scene::update();
+}
+
+void Scene2803b::update45FD50() {
+ if (_klayman->getX() > 194 && _klayman->getX() < 273)
+ sub4601B0();
+ else if (_klayman->getX() > 155 && _klayman->getX() < 300)
+ sub460170();
+ Scene::update();
+}
+
+void Scene2803b::sub460090() {
+ SetUpdateHandler(&Scene2803b::update45FCB0);
+ sendMessage(_klayman, 0x482C, 0x23C630D9);
+ _klayman->setClipRect(0, 0, _sprite1->getDrawRect().x2(), _sprite1->getDrawRect().y2());
+ _klayman->setRepl(64, 0);
+ _sprite1->setVisible(true);
+}
+
+void Scene2803b::sub460110() {
+ SetUpdateHandler(&Scene2803b::update45FD50);
+ sendMessage(_klayman, 0x482C, 0x2086222D);
+ _klayman->setClipRect(0, 0, 640, 480);
+ _klayman->clearRepl();
+ _sprite1->setVisible(false);
+}
+
+void Scene2803b::sub460170() {
+ if (_palStatus != 0) {
+ _palStatus = 0;
+ sub4601F0(false);
+ }
+}
+
+void Scene2803b::sub460190() {
+ if (_palStatus != 1) {
+ _palStatus = 1;
+ sub4601F0(false);
+ }
+}
+
+void Scene2803b::sub4601B0() {
+ if (_palStatus != 2) {
+ _palStatus = 2;
+ sub4601F0(false);
+ }
+}
+
+void Scene2803b::sub4601D0() {
+ if (_palStatus != 3) {
+ _palStatus = 3;
+ sub4601F0(true);
+ }
+}
+
+void Scene2803b::sub4601F0(bool flag) {
+ if (getGlobalVar(0x190A1D18)) {
+ switch (_palStatus) {
+ case 1:
+ _palette->addBasePalette(0x0A938204, 0, 64, 0);
+ break;
+ case 2:
+ _palette->addBasePalette(0xB103B604, 0, 64, 0);
+ break;
+ case 3:
+ // TODO _palette->sub_47BFB0(0, 64);
+ break;
+ default:
+ _palette->addBasePalette(0x412A423E, 0, 64, 0);
+ break;
+ }
+ } else {
+ switch (_palStatus) {
+ case 2:
+ _palette->addBasePalette(0x0263D144, 0, 64, 0);
+ break;
+ case 3:
+ // TODO _palette->sub_47BFB0(0, 64);
+ break;
+ default:
+ _palette->addBasePalette(0x29800A01, 0, 64, 0);
+ break;
+ }
+ }
+ if (flag) {
+ _palette->startFadeToPalette(0);
+ } else {
+ _palette->startFadeToPalette(12);
+ }
+}
+
Scene2805::Scene2805(NeverhoodEngine *vm, Module *parentModule, int which)
: Scene(vm, parentModule, true) {
diff --git a/engines/neverhood/module2800.h b/engines/neverhood/module2800.h
index 06d818cc74..54b893bb5d 100644
--- a/engines/neverhood/module2800.h
+++ b/engines/neverhood/module2800.h
@@ -54,6 +54,30 @@ protected:
uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);
};
+class Scene2803b : public Scene {
+public:
+ Scene2803b(NeverhoodEngine *vm, Module *parentModule, int which);
+protected:
+ int _palStatus;
+ Sprite *_sprite1;
+ Sprite *_sprite2;
+ Sprite *_sprite3;
+ Sprite *_sprite4;
+ Sprite *_sprite5;
+ Sprite *_sprite6;
+ Sprite *_sprite7;
+ uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);
+ void update45FCB0();
+ void update45FD50();
+ void sub460090();
+ void sub460110();
+ void sub460170();
+ void sub460190();
+ void sub4601B0();
+ void sub4601D0();
+ void sub4601F0(bool flag);
+};
+
class Scene2805 : public Scene {
public:
Scene2805(NeverhoodEngine *vm, Module *parentModule, int which);