SAGA2: Non-fatal warning on failed resource load

This commit is contained in:
Eugene Sandulenko 2021-06-18 23:39:59 +02:00
parent a445537f48
commit ac8c438dac
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
2 changed files with 21 additions and 15 deletions

View File

@ -556,7 +556,8 @@ Common::SeekableReadStream *loadResourceToStream(hResContext *con, uint32 id, co
size = con->size(id);
if (size <= 0 || !con->seek(id)) {
error("loadResourceToStream(): Error reading resource ID '%s'.", &idString);
warning("loadResourceToStream(): Error reading resource ID '%s'.", &idString);
return nullptr;
}
// Allocate the buffer

View File

@ -596,8 +596,10 @@ void ActorAppearance::loadSpriteBanks(int16 banksNeeded) {
// Load the sprite handle...
if (spriteBanks[bank] == nullptr && (banksNeeded & (1 << bank))) {
Common::SeekableReadStream *stream = loadResourceToStream(spriteRes, id + MKTAG(0, 0, 0, bank), "sprite bank");
spriteBanks[bank] = new SpriteSet(stream);
delete stream;
if (stream) {
spriteBanks[bank] = new SpriteSet(stream);
delete stream;
}
}
}
}
@ -693,20 +695,23 @@ ActorAppearance *LoadActorAppearance(uint32 id, int16 banksNeeded) {
// Load in new frame lists and sprite banks
aa->loadSpriteBanks(banksNeeded);
if(poseRes->seek(id) == 0)
error("Could not load pose list");
if (poseRes->seek(id) == 0) {
warning("LoadActorAppearance: Could not load pose list");
} else {
poseListSize = poseRes->size(id) / actorAnimSetSize;
aa->poseList = new ActorAnimSet[poseListSize];
for (int i = 0; i < poseListSize; ++i)
readActorAnimSet(poseRes, aa->poseList[i]);
}
poseListSize = poseRes->size(id) / actorAnimSetSize;
aa->poseList = new ActorAnimSet[poseListSize];
for (int i = 0; i < poseListSize; ++i)
readActorAnimSet(poseRes, aa->poseList[i]);
if (schemeRes->seek(id) == 0) {
warning("LoadActorAppearance: Could not load scheme list");
} else {
schemeListSize = schemeRes->size(id) / colorSchemeSize;
stream = loadResourceToStream(schemeRes, id, "scheme list");
aa->schemeList = new ColorSchemeList(schemeListSize, stream);
}
if(schemeRes->seek(id) == 0)
error("Could not load scheme list");
schemeListSize = schemeRes->size(id) / colorSchemeSize;
stream = loadResourceToStream(schemeRes, id, "scheme list");
aa->schemeList = new ColorSchemeList(schemeListSize, stream);
delete stream;
return aa;