aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorjohndoe1232013-01-18 19:00:28 +0000
committerWillem Jan Palenstijn2013-05-08 20:47:40 +0200
commite51bea9b4e4d2857b1225cdd7c0ebbe137b530ee (patch)
tree7fee197ac216e111ec2378d73b71b337fba634f7 /engines
parenteea9dbe2da9c6195431f234e89671fffd1e1ac29 (diff)
downloadscummvm-rg350-e51bea9b4e4d2857b1225cdd7c0ebbe137b530ee.tar.gz
scummvm-rg350-e51bea9b4e4d2857b1225cdd7c0ebbe137b530ee.tar.bz2
scummvm-rg350-e51bea9b4e4d2857b1225cdd7c0ebbe137b530ee.zip
NEVERHOOD: Don't load a DataResource if the same data is already loaded; this fixes a nasty bug in several scenes which use message lists from a DataResource
Diffstat (limited to 'engines')
-rw-r--r--engines/neverhood/gamemodule.cpp6
-rw-r--r--engines/neverhood/resource.cpp6
-rw-r--r--engines/neverhood/scene.cpp11
-rw-r--r--engines/neverhood/staticdata.cpp12
4 files changed, 23 insertions, 12 deletions
diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp
index d037cf55c0..f22a0d12e5 100644
--- a/engines/neverhood/gamemodule.cpp
+++ b/engines/neverhood/gamemodule.cpp
@@ -400,9 +400,9 @@ void GameModule::startup() {
// <<<DEBUG
#if 1
- _vm->gameState().which = 0;
- _vm->gameState().sceneNum = 0;
- createModule(2500, -1);
+ _vm->gameState().which = 1;
+ _vm->gameState().sceneNum = 1;
+ createModule(1000, -1);
#endif
#if 0
_vm->gameState().sceneNum = 5;
diff --git a/engines/neverhood/resource.cpp b/engines/neverhood/resource.cpp
index 869bebbcfe..269d13ded2 100644
--- a/engines/neverhood/resource.cpp
+++ b/engines/neverhood/resource.cpp
@@ -353,7 +353,9 @@ DataResource::~DataResource() {
}
void DataResource::load(uint32 fileHash) {
- debug(2, "DataResource::load(%08X)", fileHash);
+ if (_resourceHandle.fileHash() == fileHash)
+ return;
+ debug("DataResource::load(%08X)", fileHash);
const byte *data = NULL;
uint32 dataSize = 0;
unload();
@@ -497,7 +499,6 @@ void DataResource::load(uint32 fileHash) {
}
void DataResource::unload() {
- _vm->_res->unloadResource(_resourceHandle);
_directory.clear();
_points.clear();
for (Common::Array<NPointArray*>::iterator it = _pointArrays.begin(); it != _pointArrays.end(); ++it)
@@ -516,6 +517,7 @@ void DataResource::unload() {
for (Common::Array<DRSubRectList*>::iterator it = _drSubRectLists.begin(); it != _drSubRectLists.end(); ++it)
delete (*it);
_drSubRectLists.clear();
+ _vm->_res->unloadResource(_resourceHandle);
}
NPoint DataResource::getPoint(uint32 nameHash) {
diff --git a/engines/neverhood/scene.cpp b/engines/neverhood/scene.cpp
index 30b93bdada..866b75d399 100644
--- a/engines/neverhood/scene.cpp
+++ b/engines/neverhood/scene.cpp
@@ -397,7 +397,16 @@ void Scene::processMessageList() {
_messageListStatus = 0;
}
- if (_messageList && _klayman) {
+ if (_messageList && _klayman) {
+
+#if 0
+ debug("MessageList: %p, %d", (void*)_messageList, _messageList->size());
+ for (uint i = 0; i < _messageList->size(); ++i) {
+ if (i == _messageListIndex) debugN("**"); else debugN(" ");
+ debug("(%08X, %08X)", (*_messageList)[i].messageNum, (*_messageList)[i].messageValue);
+ }
+ debug("--------------------------------");
+#endif
while (_messageList && _messageListIndex < _messageListCount && !_isKlaymanBusy) {
uint32 messageNum = (*_messageList)[_messageListIndex].messageNum;
diff --git a/engines/neverhood/staticdata.cpp b/engines/neverhood/staticdata.cpp
index 45935945f7..3f89c2236f 100644
--- a/engines/neverhood/staticdata.cpp
+++ b/engines/neverhood/staticdata.cpp
@@ -42,7 +42,7 @@ void StaticData::load(const char *filename) {
// Load message lists
uint32 messageListsCount = fd.readUint32LE();
- debug("messageListsCount: %d", messageListsCount);
+ debug(3, "messageListsCount: %d", messageListsCount);
for (uint32 i = 0; i < messageListsCount; i++) {
MessageList *messageList = new MessageList();
uint32 id = fd.readUint32LE();
@@ -58,7 +58,7 @@ void StaticData::load(const char *filename) {
// Load rect lists
uint32 rectListsCount = fd.readUint32LE();
- debug("rectListsCount: %d", rectListsCount);
+ debug(3, "rectListsCount: %d", rectListsCount);
for (uint32 i = 0; i < rectListsCount; i++) {
RectList *rectList = new RectList();
uint32 id = fd.readUint32LE();
@@ -87,7 +87,7 @@ void StaticData::load(const char *filename) {
// Load hit rects
uint32 hitRectListsCount = fd.readUint32LE();
- debug("hitRectListsCount: %d", hitRectListsCount);
+ debug(3, "hitRectListsCount: %d", hitRectListsCount);
for (uint32 i = 0; i < hitRectListsCount; i++) {
HitRectList *hitRectList = new HitRectList();
uint32 id = fd.readUint32LE();
@@ -106,7 +106,7 @@ void StaticData::load(const char *filename) {
// Load navigation lists
uint32 navigationListsCount = fd.readUint32LE();
- debug("navigationListsCount: %d", navigationListsCount);
+ debug(3, "navigationListsCount: %d", navigationListsCount);
for (uint32 i = 0; i < navigationListsCount; i++) {
NavigationList *navigationList = new NavigationList();
uint32 id = fd.readUint32LE();
@@ -127,7 +127,7 @@ void StaticData::load(const char *filename) {
// Load HallOfRecordsInfo items
uint32 hallOfRecordsInfoItemsCount = fd.readUint32LE();
- debug("hallOfRecordsInfoItemsCount: %d", hallOfRecordsInfoItemsCount);
+ debug(3, "hallOfRecordsInfoItemsCount: %d", hallOfRecordsInfoItemsCount);
for (uint32 i = 0; i < hallOfRecordsInfoItemsCount; i++) {
HallOfRecordsInfo *hallOfRecordsInfo = new HallOfRecordsInfo();
uint32 id = fd.readUint32LE();
@@ -142,7 +142,7 @@ void StaticData::load(const char *filename) {
// Load TrackInfo items
uint32 trackInfoItemsCount = fd.readUint32LE();
- debug("trackInfoItemsCount: %d", trackInfoItemsCount);
+ debug(3, "trackInfoItemsCount: %d", trackInfoItemsCount);
for (uint32 i = 0; i < trackInfoItemsCount; i++) {
TrackInfo *trackInfo = new TrackInfo();
uint32 id = fd.readUint32LE();