aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorjohndoe1232011-10-13 10:43:58 +0000
committerWillem Jan Palenstijn2013-05-08 20:39:42 +0200
commitaa789ee02bf55828fb8f0bfa9aa1efe0ecb44310 (patch)
treec68248a368d56a9934f26e23c19124e31106e60b /engines
parente7673ffdc63f4d0a9b7b6f39161c3150537f3cd6 (diff)
downloadscummvm-rg350-aa789ee02bf55828fb8f0bfa9aa1efe0ecb44310.tar.gz
scummvm-rg350-aa789ee02bf55828fb8f0bfa9aa1efe0ecb44310.tar.bz2
scummvm-rg350-aa789ee02bf55828fb8f0bfa9aa1efe0ecb44310.zip
NEVERHOOD: More work in Module2700
Diffstat (limited to 'engines')
-rw-r--r--engines/neverhood/gamemodule.cpp15
-rw-r--r--engines/neverhood/module2200.cpp2
-rw-r--r--engines/neverhood/module2700.cpp301
-rw-r--r--engines/neverhood/module2700.h15
-rw-r--r--engines/neverhood/resource.cpp7
-rw-r--r--engines/neverhood/resource.h1
-rw-r--r--engines/neverhood/staticdata.cpp26
-rw-r--r--engines/neverhood/staticdata.h17
8 files changed, 377 insertions, 7 deletions
diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp
index fa0af0753c..9bdaa865d4 100644
--- a/engines/neverhood/gamemodule.cpp
+++ b/engines/neverhood/gamemodule.cpp
@@ -38,6 +38,7 @@
#include "neverhood/module2200.h"
#include "neverhood/module2300.h"
#include "neverhood/module2600.h"
+#include "neverhood/module2700.h"
#include "neverhood/module3000.h"
namespace Neverhood {
@@ -291,10 +292,15 @@ void GameModule::startup() {
_vm->gameState().sceneNum = 0;
createModule(2100, 3);
#endif
-#if 1
+#if 0
_vm->gameState().sceneNum = 8;
createModule(2600, -1);
#endif
+#if 1
+ _vm->gameState().which = 0;
+ _vm->gameState().sceneNum = 5;
+ createModule(2700, -1);
+#endif
}
void GameModule::createModule(int moduleNum, int which) {
@@ -362,6 +368,10 @@ void GameModule::createModule(int moduleNum, int which) {
setGlobalVar(0x91080831, 0x40271018);
_childObject = new Module2600(_vm, this, which);
break;
+ case 2700:
+ setGlobalVar(0x91080831, 0x42212411);
+ _childObject = new Module2700(_vm, this, which);
+ break;
case 3000:
setGlobalVar(0x91080831, 0x81293110);
_childObject = new Module3000(_vm, this, which);
@@ -476,6 +486,9 @@ void GameModule::updateModule() {
createModule(1200, 1);
}
break;
+ case 2700:
+ createModule(1800, 2);
+ break;
case 3000:
if (_moduleResult == 1) {
createModule(1900, 0);
diff --git a/engines/neverhood/module2200.cpp b/engines/neverhood/module2200.cpp
index 97729cbb00..ff0afa6f58 100644
--- a/engines/neverhood/module2200.cpp
+++ b/engines/neverhood/module2200.cpp
@@ -396,6 +396,8 @@ void Module2200::updateScene() {
}
}
}
+
+#undef HallOfRecordsSceneLink
// Scene2201
diff --git a/engines/neverhood/module2700.cpp b/engines/neverhood/module2700.cpp
index 83b1d9003f..f5dc0785b5 100644
--- a/engines/neverhood/module2700.cpp
+++ b/engines/neverhood/module2700.cpp
@@ -166,7 +166,7 @@ void Module2700::createScene(int sceneNum, int which) {
}
break;
case 9:
- createScene2704(which, 0x004B18F0, 150, kScene2710StaticSprites, &kScene2710ClipRect);
+ createScene2704(which, 0x004B1918, 150, kScene2710StaticSprites, &kScene2710ClipRect);
break;
case 10:
// TODO _vm->gameModule()->initScene2808Vars2();
@@ -279,14 +279,196 @@ void Module2700::createScene(int sceneNum, int which) {
_childObject->handleUpdate();
}
+#define SceneLinkIf(moduleResult, sceneNum, which) \
+ if (_moduleResult == moduleResult) { createScene(sceneNum, which); break; }
+
void Module2700::updateScene() {
if (!updateChild()) {
+
+ debug("sceneNum = %d; _moduleResult = %d", _vm->gameState().sceneNum, _moduleResult);
+
switch (_vm->gameState().sceneNum) {
case 0:
- if (_moduleResult == 1) {
- createScene(1, 3);
- } else {
- leaveModule(0);
+ SceneLinkIf(1, 1, 0);
+ leaveModule(0);
+ break;
+ case 1:
+ SceneLinkIf(1, 14, 1);
+ SceneLinkIf(2, 2, 2);
+ SceneLinkIf(3, 14, 3);
+ SceneLinkIf(4, 2, 6);
+ SceneLinkIf(5, 2, 4);
+ createScene(0, 1);
+ break;
+ case 2:
+ SceneLinkIf(1, 5, 0);
+ SceneLinkIf(2, 1, 2);
+ SceneLinkIf(3, 5, 2);
+ SceneLinkIf(4, 1, 5);
+ SceneLinkIf(5, 5, 4);
+ SceneLinkIf(6, 1, 4);
+ SceneLinkIf(7, 11, 0);
+ createScene(3, 0);
+ break;
+ case 3:
+ createScene(2, 0);
+ break;
+ case 4:
+ SceneLinkIf(1, 7, 2);
+ createScene(5, 5);
+ break;
+ case 5:
+ SceneLinkIf(1, 6, 0);
+ SceneLinkIf(2, 2, 3);
+ SceneLinkIf(3, 8, 2);
+ SceneLinkIf(4, 2, 5);
+ SceneLinkIf(5, 4, 0);
+ SceneLinkIf(6, 7, 0);
+ createScene(2, 1);
+ break;
+ case 6:
+ SceneLinkIf(1, 8, 0);
+ createScene(5, 1);
+ break;
+ case 7:
+ SceneLinkIf(1, 8, 3);
+ SceneLinkIf(2, 4, 1);
+ SceneLinkIf(3, 9, 0);
+ createScene(5, 6);
+ break;
+ case 8:
+ SceneLinkIf(1, 10, 0);
+ SceneLinkIf(2, 5, 3);
+ SceneLinkIf(3, 7, 1);
+ createScene(6, 1);
+ break;
+ case 9:
+ SceneLinkIf(1, 10, 1);
+ createScene(7, 3);
+ break;
+ case 10:
+ SceneLinkIf(1, 9, 1);
+ createScene(8, 1);
+ break;
+ case 11:
+ SceneLinkIf(1, 12, 0);
+ createScene(2, 7);
+ break;
+ case 12:
+ SceneLinkIf(1, 13, 0);
+ createScene(11, 1);
+ break;
+ case 13:
+ SceneLinkIf(1, 30, 0);
+ createScene(12, 1);
+ break;
+ case 14:
+ SceneLinkIf(1, 1, 1);
+ SceneLinkIf(2, 15, 3);
+ SceneLinkIf(3, 1, 3);
+ SceneLinkIf(4, 15, 5);
+ SceneLinkIf(5, 22, 0);
+ createScene(15, 1);
+ break;
+ case 15:
+ SceneLinkIf(1, 14, 0);
+ SceneLinkIf(2, 16, 3);
+ SceneLinkIf(3, 14, 2);
+ SceneLinkIf(4, 16, 5);
+ SceneLinkIf(5, 14, 4);
+ createScene(16, 1);
+ break;
+ case 16:
+ SceneLinkIf(1, 15, 0);
+ SceneLinkIf(2, 17, 3);
+ SceneLinkIf(3, 15, 2);
+ SceneLinkIf(4, 17, 5);
+ SceneLinkIf(5, 15, 4);
+ createScene(17, 1);
+ break;
+ case 17:
+ SceneLinkIf(1, 16, 0);
+ SceneLinkIf(2, 18, 3);
+ SceneLinkIf(3, 16, 2);
+ SceneLinkIf(4, 20, 1);
+ SceneLinkIf(5, 16, 4);
+ createScene(18, 1);
+ break;
+ case 18:
+ SceneLinkIf(1, 17, 0);
+ SceneLinkIf(2, 19, 2);
+ SceneLinkIf(3, 17, 2);
+ createScene(19, 0);
+ break;
+ case 19:
+ SceneLinkIf(1, 20, 2);
+ SceneLinkIf(2, 18, 2);
+ SceneLinkIf(3, 20, 0);
+ createScene(18, 0);
+ break;
+ case 20:
+ SceneLinkIf(1, 17, 4);
+ SceneLinkIf(2, 19, 1);
+ SceneLinkIf(3, 21, 0);
+ createScene(19, 3);
+ break;
+ case 21:
+ // TODO? GameState_sub_469C50(&field_52, 0);
+ // TODO MusicMan_stopAll (if field_52 above = 1)
+ // TODO Music18hList_delete(_musicFileHash);
+ // TODO Music18hList_play(0x04020210, 0, 2, 1);
+ // TODO Sound1ChList_sub_407AF0(0x42212411);
+ createScene(20, 3);
+ break;
+ case 22:
+ SceneLinkIf(1, 23, 0);
+ createScene(14, 5);
+ break;
+ case 23:
+ SceneLinkIf(1, 24, 0);
+ createScene(22, 1);
+ break;
+ case 24:
+ SceneLinkIf(1, 25, 0);
+ createScene(23, 1);
+ break;
+ case 25:
+ SceneLinkIf(1, 26, 0);
+ createScene(24, 1);
+ break;
+ case 26:
+ SceneLinkIf(1, 27, 0);
+ createScene(25, 1);
+ break;
+ case 27:
+ SceneLinkIf(1, 28, 0);
+ createScene(26, 1);
+ break;
+ case 28:
+ SceneLinkIf(1, 31, 0);
+ createScene(27, 1);
+ break;
+ case 29:
+ createScene(13, 1);
+ break;
+ case 30:
+ createScene(28, 1);
+ break;
+ }
+ } else {
+ switch (_vm->gameState().sceneNum) {
+ case 21:
+ if (!_flag1) {
+ // TODO Music18hList_stop(0x04020210, 0, 1);
+ // TODO _vm->gameModule()->initScene2801Vars();
+ _musicFileHash = getGlobalVar(0x89A82A15);
+ // TODO? GameState_sub_469C50(&field_52, 0);
+ // TODO MusicMan_create();
+ // TODO Music18hList_add2(0x42212411, _musicFileHash);
+ // TODO Music18hList_play2(_musicFileHash, 0, /*TODO */???, 1);
+ // TODO Sound1ChList_addSoundResource(0x42212411, 0x44014282, true);
+ // TODO Sound1ChList_setSoundValues(0x44014282, true, 120, 360, 72, 0);
+ _flag1 = true;
}
break;
}
@@ -294,6 +476,7 @@ void Module2700::updateScene() {
}
void Module2700::update() {
+
}
uint32 Module2700::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
@@ -327,7 +510,113 @@ void Module2700::createScene2703(int which, uint32 sceneInfoId, const uint32 *st
}
void Module2700::createScene2704(int which, uint32 sceneInfoId, int16 value, const uint32 *staticSprites, const NRect *clipRect) {
- // TODO
+ _childObject = new Scene2704(_vm, this, which, sceneInfoId, value, staticSprites, clipRect);
+}
+
+Scene2704::Scene2704(NeverhoodEngine *vm, Module *parentModule, int which, uint32 sceneInfoId, int16 value,
+ const uint32 *staticSprites, const NRect *clipRect)
+ : Scene(vm, parentModule, true) {
+
+ SceneInfo2700 *sceneInfo = _vm->_staticData->getSceneInfo2700(sceneInfoId);
+
+ _surfaceFlag = true;
+ SetMessageHandler(&Scene2704::handleMessage);
+ SetUpdateHandler(&Scene2704::update);
+
+ setBackground(sceneInfo->bgFilename);
+ setPalette(sceneInfo->bgFilename);
+
+ if (sceneInfo->exPaletteFilename1)
+ _palette->addPalette(sceneInfo->exPaletteFilename1, 0, 65, 0);
+
+ if (sceneInfo->exPaletteFilename2)
+ _palette->addPalette(sceneInfo->exPaletteFilename2, 65, 31, 65);
+
+ while (staticSprites && *staticSprites)
+ insertStaticSprite(*staticSprites++, 1100);
+
+ insertMouse433(sceneInfo->mouseCursorFilename);
+
+ 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 {
+//TODO _class437 = NULL;
+//TODO _class517 = NULL;
+ _class521 = insertSprite<Class521>(this, 320, 240);
+ }
+
+//TODO _class518 = insertSprite<Class518>(_class521);
+
+ _which1 = sceneInfo->which1;
+ _which2 = sceneInfo->which2;
+
+ _dataResource.load(sceneInfo->dataResourceFilename);
+ _pointList = _dataResource.getPointArray(sceneInfo->pointListName);
+ _class521->setPathPoints(_pointList);
+
+ if (sceneInfo->rectListName) {
+ _rectList = _dataResource.getRectArray(sceneInfo->rectListName);
+ // TODO _class521->setPathRects(_rectList);
+ }
+
+ if (which == _which2) {
+ NPoint testPoint = (*_pointList)[_pointList->size() - 1];
+ sendMessage(_class521, 0x2002, _pointList->size() - 1);
+ if (testPoint.x > 0 && testPoint.x < 640 && testPoint.y > 0 && testPoint.y < 480)
+ sendMessage(_class521, 0x2009, 0);
+ else
+ sendMessage(_class521, 0x2007, 0);
+ } else {
+ NPoint testPoint = (*_pointList)[0];
+ sendMessage(_class521, 0x2002, 0);
+ if (testPoint.x > 0 && testPoint.x < 640 && testPoint.y > 0 && testPoint.y < 480)
+ sendMessage(_class521, 0x2009, 0);
+ else
+ sendMessage(_class521, 0x2008, 0);
+ }
+
+ if (clipRect) {
+ _class521->getClipRect() = *clipRect;
+ if (_class517)
+ _class517->getClipRect() = *clipRect;
+ if (_class520)
+ _class520->getClipRect() = *clipRect;
+ if (_class519)
+ _class519->getClipRect() = *clipRect;
+ if (_class518)
+ _class518->getClipRect() = *clipRect;
+ }
+
+}
+
+void Scene2704::update() {
+ Scene::update();
+ if (_mouseClicked) {
+ sendPointMessage(_class521, 0x2004, _mouseClickPos);
+ _mouseClicked = false;
+ }
+}
+
+uint32 Scene2704::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
+ Scene::handleMessage(messageNum, param, sender);
+ switch (messageNum) {
+ case 0x2005:
+ if (_which1 >= 0)
+ leaveScene(_which1);
+ break;
+ case 0x2006:
+ if (_which2 >= 0)
+ leaveScene(_which2);
+ break;
+ case 0x200D:
+ sendMessage(_parentModule, 0x200D, 0);
+ break;
+ }
+ return 0;
}
} // End of namespace Neverhood
diff --git a/engines/neverhood/module2700.h b/engines/neverhood/module2700.h
index a0f424eb6c..4df284c0f3 100644
--- a/engines/neverhood/module2700.h
+++ b/engines/neverhood/module2700.h
@@ -26,6 +26,7 @@
#include "neverhood/neverhood.h"
#include "neverhood/module.h"
#include "neverhood/scene.h"
+#include "neverhood/module1600.h"
namespace Neverhood {
@@ -43,6 +44,7 @@ protected:
int _soundIndex;
bool _flag1;
uint32 _scene2711StaticSprites[6];
+ uint32 _musicFileHash;
void createScene(int sceneNum, int which);
void updateScene();
void update();
@@ -51,6 +53,19 @@ protected:
void createScene2704(int which, uint32 sceneInfoId, int16 value, const uint32 *staticSprites = NULL, const NRect *clipRect = NULL);
};
+class Scene2704 : public Scene {
+public:
+ Scene2704(NeverhoodEngine *vm, Module *parentModule, int which, uint32 sceneInfoId, int16 value,
+ const uint32 *staticSprites = NULL, const NRect *clipRect = NULL);
+protected:
+ Class521 *_class521;
+ int _which1, _which2;
+ NPointArray *_pointList;
+ NRectArray *_rectList;
+ void update();
+ uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);
+};
+
} // End of namespace Neverhood
#endif /* NEVERHOOD_MODULE2700_H */
diff --git a/engines/neverhood/resource.cpp b/engines/neverhood/resource.cpp
index ef8e532ef1..9678031554 100644
--- a/engines/neverhood/resource.cpp
+++ b/engines/neverhood/resource.cpp
@@ -601,6 +601,13 @@ NPointArray *DataResource::getPointArray(uint32 nameHash) {
return NULL;
}
+NRectArray *DataResource::getRectArray(uint32 nameHash) {
+ DataResource::DRDirectoryItem *drDirectoryItem = findDRDirectoryItem(nameHash, 3);
+ if (drDirectoryItem)
+ return _rectArrays[drDirectoryItem->offset];
+ return NULL;
+}
+
HitRectList *DataResource::getHitRectList() {
DataResource::DRDirectoryItem *drDirectoryItem = findDRDirectoryItem(calcHash("HitArray"), 3);
if (drDirectoryItem)
diff --git a/engines/neverhood/resource.h b/engines/neverhood/resource.h
index f8d282cd57..6436509228 100644
--- a/engines/neverhood/resource.h
+++ b/engines/neverhood/resource.h
@@ -154,6 +154,7 @@ public:
void unload();
NPoint getPoint(uint32 nameHash);
NPointArray *getPointArray(uint32 nameHash);
+ NRectArray *getRectArray(uint32 nameHash);
HitRectList *getHitRectList();
MessageList *getMessageListAtPos(int16 klaymanX, int16 klaymanY, int16 mouseX, int16 mouseY);
protected:
diff --git a/engines/neverhood/staticdata.cpp b/engines/neverhood/staticdata.cpp
index d897d7a342..4e7d24c6bb 100644
--- a/engines/neverhood/staticdata.cpp
+++ b/engines/neverhood/staticdata.cpp
@@ -140,6 +140,26 @@ void StaticData::load(const char *filename) {
_sceneInfo140Items[id] = sceneInfo140;
}
+ // Load SceneInfo2700 items
+ uint32 sceneInfo2700ItemsCount = fd.readUint32LE();
+ debug("sceneInfo2700ItemsCount: %d", sceneInfo2700ItemsCount);
+ for (uint32 i = 0; i < sceneInfo2700ItemsCount; i++) {
+ SceneInfo2700 *sceneInfo2700 = new SceneInfo2700();
+ uint32 id = fd.readUint32LE();
+ sceneInfo2700->bgFilename = fd.readUint32LE();
+ sceneInfo2700->class437Filename = fd.readUint32LE();
+ sceneInfo2700->dataResourceFilename = fd.readUint32LE();
+ sceneInfo2700->pointListName = fd.readUint32LE();
+ sceneInfo2700->rectListName = fd.readUint32LE();
+ sceneInfo2700->exPaletteFilename2 = fd.readUint32LE();
+ sceneInfo2700->exPaletteFilename1 = fd.readUint32LE();
+ sceneInfo2700->mouseCursorFilename = fd.readUint32LE();
+ sceneInfo2700->which1 = fd.readUint16LE();
+ sceneInfo2700->which2 = fd.readUint16LE();
+ sceneInfo2700->field24 = fd.readUint32LE();
+ _sceneInfo2700Items[id] = sceneInfo2700;
+ }
+
}
HitRectList *StaticData::getHitRectList(uint32 id) {
@@ -172,4 +192,10 @@ SceneInfo140 *StaticData::getSceneInfo140Item(uint32 id) {
return _sceneInfo140Items[id];
}
+SceneInfo2700 *StaticData::getSceneInfo2700(uint32 id) {
+ if (!_sceneInfo2700Items[id])
+ error("StaticData::getSceneInfo2700() SceneInfo2700 with id %08X not found", id);
+ return _sceneInfo2700Items[id];
+}
+
} // End of namespace Neverhood
diff --git a/engines/neverhood/staticdata.h b/engines/neverhood/staticdata.h
index 2a0cc9072c..c223735ef4 100644
--- a/engines/neverhood/staticdata.h
+++ b/engines/neverhood/staticdata.h
@@ -77,6 +77,21 @@ struct SceneInfo140 {
byte count;
};
+struct SceneInfo2700 {
+ uint32 id;
+ uint32 bgFilename;
+ uint32 class437Filename;
+ uint32 dataResourceFilename;
+ uint32 pointListName;
+ uint32 rectListName;
+ uint32 exPaletteFilename2;
+ uint32 exPaletteFilename1;
+ uint32 mouseCursorFilename;
+ int16 which1;
+ int16 which2;
+ uint32 field24;
+};
+
class StaticData {
public:
StaticData();
@@ -87,12 +102,14 @@ public:
MessageList *getMessageList(uint32 id);
NavigationList *getNavigationList(uint32 id);
SceneInfo140 *getSceneInfo140Item(uint32 id);
+ SceneInfo2700 *getSceneInfo2700(uint32 id);
protected:
Common::HashMap<uint32, HitRectList*> _hitRectLists;
Common::HashMap<uint32, RectList*> _rectLists;
Common::HashMap<uint32, MessageList*> _messageLists;
Common::HashMap<uint32, NavigationList*> _navigationLists;
Common::HashMap<uint32, SceneInfo140*> _sceneInfo140Items;
+ Common::HashMap<uint32, SceneInfo2700*> _sceneInfo2700Items;
};
} // End of namespace Neverhood