aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjohndoe1232011-10-14 12:25:31 +0000
committerWillem Jan Palenstijn2013-05-08 20:39:42 +0200
commitd276e7ceaa307844a8db82f231bba86a6b88e121 (patch)
treef3a1afc6fc619e5359bd6c4eeaee559846594889
parent31b3dec8c94975333a868cc527107a32b091a5ae (diff)
downloadscummvm-rg350-d276e7ceaa307844a8db82f231bba86a6b88e121.tar.gz
scummvm-rg350-d276e7ceaa307844a8db82f231bba86a6b88e121.tar.bz2
scummvm-rg350-d276e7ceaa307844a8db82f231bba86a6b88e121.zip
NEVERHOOD: Add Scene2701
-rw-r--r--engines/neverhood/gamemodule.cpp2
-rw-r--r--engines/neverhood/module2700.cpp111
-rw-r--r--engines/neverhood/module2700.h19
-rw-r--r--engines/neverhood/staticdata.cpp1
-rw-r--r--engines/neverhood/staticdata.h1
5 files changed, 127 insertions, 7 deletions
diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp
index 9ed447a925..64117ad39a 100644
--- a/engines/neverhood/gamemodule.cpp
+++ b/engines/neverhood/gamemodule.cpp
@@ -298,7 +298,7 @@ void GameModule::startup() {
#endif
#if 1
_vm->gameState().which = 4;
- _vm->gameState().sceneNum = 5;
+ _vm->gameState().sceneNum = 0;
createModule(2700, -1);
#endif
}
diff --git a/engines/neverhood/module2700.cpp b/engines/neverhood/module2700.cpp
index 7d09b66e98..e8d3105f6a 100644
--- a/engines/neverhood/module2700.cpp
+++ b/engines/neverhood/module2700.cpp
@@ -118,7 +118,7 @@ void Module2700::createScene(int sceneNum, int which) {
_vm->gameState().sceneNum = sceneNum;
switch (_vm->gameState().sceneNum) {
case 0:
-//TODO _childObject = new Scene2701(_vm, this, which);
+ _childObject = new Scene2701(_vm, this, which);
break;
case 1:
//TODO _childObject = new Scene2702(_vm, this, which);
@@ -513,6 +513,110 @@ void Module2700::createScene2704(int which, uint32 sceneInfoId, int16 value, con
_childObject = new Scene2704(_vm, this, which, sceneInfoId, value, staticSprites, clipRect);
}
+Scene2701::Scene2701(NeverhoodEngine *vm, Module *parentModule, int which)
+ : Scene(vm, parentModule, true) {
+
+ NRect clipRect;
+ SceneInfo2700 *sceneInfo = _vm->_staticData->getSceneInfo2700(0x004B2240);
+ setGlobalVar(0x21E60190, 1);
+
+ _surfaceFlag = true;
+
+ setBackground(sceneInfo->bgFilename);
+ setPalette(sceneInfo->bgFilename);
+
+ _palette->addPalette(calcHash("paPodFloor"), 65, 31, 65);
+ _palette->addPalette(calcHash("paKlayFloor"), 0, 65, 0);
+
+ insertMouse433(0x08B08180);
+
+ _sprite1 = insertStaticSprite(0x1E086325, 1200);
+
+ clipRect.set(0, 0, 640, _sprite1->getDrawRect().x2());
+
+ if (sceneInfo->class437Filename) {
+//TODO _class437 = insertSprite<Class437>(sceneInfo->class437Filename);
+ _class521 = insertSprite<Class521>(this, 320, 240);
+//TODO _class517 = insertSprite<Class517>(_class521, _class437->getSurface(), 4);
+//TODO _class520 = insertSprite<Class520>(_class521, _class437->getSurface(), 4);
+//TODO _class519 = insertSprite<Class519>(_class521, _class437->getSurface(), 4);
+ } else {
+ _class437 = NULL;
+ _class521 = insertSprite<Class521>(this, 320, 240);
+ }
+
+//TODO _class518 = insertSprite<Class518>(_class521);
+
+ _which1 = sceneInfo->which1;
+ _which2 = sceneInfo->which2;
+
+ _dataResource.load(sceneInfo->dataResourceFilename);
+ _trackPoints = _dataResource.getPointArray(sceneInfo->pointListName);
+ _class521->setPathPoints(_trackPoints);
+
+ if (which == _which2) {
+ NPoint testPoint = (*_trackPoints)[_trackPoints->size() - 1];
+ sendMessage(_class521, 0x2002, _trackPoints->size() - 1);
+ if (testPoint.x < 0 || testPoint.x >= 640 || testPoint.y < 0 || testPoint.y >= 480)
+ sendMessage(_class521, 0x2007, 150);
+ } else {
+ NPoint testPoint = (*_trackPoints)[0];
+ sendMessage(_class521, 0x2002, 0);
+ if (testPoint.x < 0 || testPoint.x >= 640 || testPoint.y < 0 || testPoint.y >= 480)
+ sendMessage(_class521, 0x2008, 150);
+ }
+
+ _class521->setClipRect(clipRect);
+ // TODO _class518->setClipRect(clipRect);
+
+ if (which == 1) {
+ SetMessageHandler(&Scene2701::handleMessage42F500);
+ } else {
+ sendMessage(_class521, 0x2009, 0);
+ SetMessageHandler(&Scene2701::handleMessage42F600);
+ }
+
+}
+
+uint32 Scene2701::handleMessage42F500(int messageNum, const MessageParam &param, Entity *sender) {
+ Scene::handleMessage(messageNum, param, sender);
+ switch (messageNum) {
+ case 0x0001:
+ sendPointMessage(_class521, 0x2004, param.asPoint());
+ break;
+ case 0x2005:
+ if (_which1 >= 0)
+ SetMessageHandler(&Scene2701::handleMessage42F600);
+ break;
+ case 0x2006:
+ if (_which2 >= 0)
+ leaveScene(_which2);
+ break;
+ case 0x200D:
+ sendMessage(_parentModule, 0x200D, 0);
+ break;
+ }
+ return 0;
+}
+
+uint32 Scene2701::handleMessage42F600(int messageNum, const MessageParam &param, Entity *sender) {
+ Scene::handleMessage(messageNum, param, sender);
+ switch (messageNum) {
+ case 0x0001:
+ if (param.asPoint().x >= 385) {
+ leaveScene(0);
+ } else {
+ sendPointMessage(_class521, 0x2004, param.asPoint());
+ SetMessageHandler(&Scene2701::handleMessage42F500);
+ }
+ break;
+ case 0x200D:
+ sendMessage(_parentModule, 0x200D, 0);
+ break;
+ }
+ return 0;
+}
+
Scene2704::Scene2704(NeverhoodEngine *vm, Module *parentModule, int which, uint32 sceneInfoId, int16 value,
const uint32 *staticSprites, const NRect *clipRect)
: Scene(vm, parentModule, true) {
@@ -621,6 +725,7 @@ uint32 Scene2704::handleMessage(int messageNum, const MessageParam &param, Entit
return 0;
}
+static const int kSceneInfo2706Count = 3;
static const struct { const char *pointListName; int which1, which2; } kSceneInfo2706[] = {
{"me06slotSlotPath2", 4, -1},
{"me06slotSlotPath3", -1, 6},
@@ -628,7 +733,7 @@ static const struct { const char *pointListName; int which1, which2; } kSceneInf
};
Scene2706::Scene2706(NeverhoodEngine *vm, Module *parentModule, int which)
- : Scene(vm, parentModule, true), _newTrackIndex(-1), _count(3) {
+ : Scene(vm, parentModule, true), _newTrackIndex(-1) {
_surfaceFlag = true;
SetMessageHandler(&Scene2706::handleMessage);
@@ -707,7 +812,7 @@ void Scene2706::findClosestTrack(NPoint pt) {
int minMatchTrackIndex = -1;
int minMatchDistance = 640;
// Find the track which contains a point closest to pt
- for (int infoIndex = 0; infoIndex < _count; infoIndex++) {
+ for (int infoIndex = 0; infoIndex < kSceneInfo2706Count; infoIndex++) {
NPointArray *pointList = _dataResource.getPointArray(calcHash(kSceneInfo2706[infoIndex].pointListName));
for (uint pointIndex = 0; pointIndex < pointList->size(); pointIndex++) {
NPoint testPt = (*pointList)[pointIndex];
diff --git a/engines/neverhood/module2700.h b/engines/neverhood/module2700.h
index b596ccd580..85c5b88f51 100644
--- a/engines/neverhood/module2700.h
+++ b/engines/neverhood/module2700.h
@@ -53,6 +53,24 @@ protected:
void createScene2704(int which, uint32 sceneInfoId, int16 value, const uint32 *staticSprites = NULL, const NRect *clipRect = NULL);
};
+class Scene2701 : public Scene {
+public:
+ Scene2701(NeverhoodEngine *vm, Module *parentModule, int which);
+protected:
+ Class521 *_class521;
+ Sprite *_class437;
+ Sprite *_class517;
+ Sprite *_class520;
+ Sprite *_class519;
+ Sprite *_class518;
+ Sprite *_sprite1;
+ //NRect _rect;
+ int _which1, _which2;
+ NPointArray *_trackPoints;
+ uint32 handleMessage42F500(int messageNum, const MessageParam &param, Entity *sender);
+ uint32 handleMessage42F600(int messageNum, const MessageParam &param, Entity *sender);
+};
+
class Scene2704 : public Scene {
public:
Scene2704(NeverhoodEngine *vm, Module *parentModule, int which, uint32 sceneInfoId, int16 value,
@@ -78,7 +96,6 @@ protected:
Sprite *_class519;
int16 _newTrackDestX;
int _currTrackIndex, _newTrackIndex;
- int _count;
NPointArray *_trackPoints;
uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);
void findClosestTrack(NPoint pt);
diff --git a/engines/neverhood/staticdata.cpp b/engines/neverhood/staticdata.cpp
index 4e7d24c6bb..147a319d2e 100644
--- a/engines/neverhood/staticdata.cpp
+++ b/engines/neverhood/staticdata.cpp
@@ -156,7 +156,6 @@ void StaticData::load(const char *filename) {
sceneInfo2700->mouseCursorFilename = fd.readUint32LE();
sceneInfo2700->which1 = fd.readUint16LE();
sceneInfo2700->which2 = fd.readUint16LE();
- sceneInfo2700->field24 = fd.readUint32LE();
_sceneInfo2700Items[id] = sceneInfo2700;
}
diff --git a/engines/neverhood/staticdata.h b/engines/neverhood/staticdata.h
index c223735ef4..2a2db556e0 100644
--- a/engines/neverhood/staticdata.h
+++ b/engines/neverhood/staticdata.h
@@ -89,7 +89,6 @@ struct SceneInfo2700 {
uint32 mouseCursorFilename;
int16 which1;
int16 which2;
- uint32 field24;
};
class StaticData {