FTA2: Load ResImportTable in a portable way

This commit is contained in:
Eugene Sandulenko 2023-02-13 21:01:27 +01:00
parent 4b87b3dc8a
commit 20ec21f743
No known key found for this signature in database
GPG Key ID: 014D387312D34F08

View File

@ -210,9 +210,24 @@ INITIALIZER(initResourceHandles) {
return false;
if (g_vm->getGameId() == GID_FTA2) {
// Only FTA2 has resource imports
resImports = (ResImportTable *)LoadResource(listRes, MKTAG('I', 'M', 'P', 'O'), "res imports");
if (!resImports)
Common::SeekableReadStream *stream = loadResourceToStream(listRes, MKTAG('I', 'M', 'P', 'O'), "res imports");
if (!stream)
return false;
resImports = (ResImportTable *)malloc(sizeof(ResImportTable));
resImports->deadActorProto = (int16)stream->readSint16LE();
(void)stream->readSint16LE();
(void)stream->readSint16LE();
resImports->EXP_spellEffect_CreateFireWisp = stream->readSint16LE();
resImports->EXP_spellEffect_CreateWindWisp = stream->readSint16LE();
resImports->EXP_spellEffect_CreateWraith = stream->readSint16LE();
resImports->EXP_spellEffect_TeleportToShrine = stream->readSint16LE();
resImports->EXP_spellEffect_Rejoin = stream->readSint16LE();
resImports->EXP_spellEffect_Timequake = stream->readSint16LE();
resImports->EXP_spellEffect_CreateFood = stream->readSint16LE();
delete stream;
}
return true;
}