mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-02 00:42:24 +00:00
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
This commit is contained in:
parent
eea9dbe2da
commit
e51bea9b4e
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user