Bugfixes + removing warning for invalid property count in MP2/3 areas
This commit is contained in:
parent
20849526e7
commit
e8f48ef66a
|
@ -128,7 +128,7 @@ void CAreaLoader::ReadSCLYPrime()
|
||||||
Log::FileError(mpMREA->GetSourceString(), mpMREA->Tell() - 4, "Invalid SCLY magic: " + SCLY.ToString());
|
Log::FileError(mpMREA->GetSourceString(), mpMREA->Tell() - 4, "Invalid SCLY magic: " + SCLY.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mpMREA->Seek(0x4, SEEK_CUR); // Skipping unknown value which is always 4
|
mpMREA->Seek(mVersion <= ePrime ? 4 : 1, SEEK_CUR); // Skipping unknown value which is always 1
|
||||||
|
|
||||||
// Read layer sizes
|
// Read layer sizes
|
||||||
mNumLayers = mpMREA->ReadLong();
|
mNumLayers = mpMREA->ReadLong();
|
||||||
|
|
|
@ -182,7 +182,8 @@ void CScriptLoader::LoadStructMP1(IInputStream& SCLY, CPropertyStruct *pStruct,
|
||||||
TIDString IDString = pTemp->IDString(true);
|
TIDString IDString = pTemp->IDString(true);
|
||||||
if (!IDString.IsEmpty()) IDString = " (" + IDString + ")";
|
if (!IDString.IsEmpty()) IDString = " (" + IDString + ")";
|
||||||
|
|
||||||
Log::FileWarning(SCLY.GetSourceString(), StructStart, "Struct \"" + pTemp->Name() + "\"" + IDString + " template prop count doesn't match file");
|
Log::FileWarning(SCLY.GetSourceString(), StructStart, "Struct \"" + pTemp->Name() + "\"" + IDString + " template prop count doesn't match file; template is " + TString::HexString(PropCount, true, true, 2) + ", file is " + TString::HexString(FilePropCount, true, true, 2));
|
||||||
|
Version = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +209,7 @@ CScriptObject* CScriptLoader::LoadObjectMP1(IInputStream& SCLY)
|
||||||
if (!pTemp)
|
if (!pTemp)
|
||||||
{
|
{
|
||||||
// No valid template for this object; can't load
|
// No valid template for this object; can't load
|
||||||
Log::FileError(SCLY.GetSourceString(), ObjStart, "Invalid object ID encountered: " + TString::HexString(Type));
|
Log::FileError(SCLY.GetSourceString(), ObjStart, "Unknown object ID encountered: " + TString::HexString(Type));
|
||||||
SCLY.Seek(End, SEEK_SET);
|
SCLY.Seek(End, SEEK_SET);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -269,23 +270,9 @@ void CScriptLoader::LoadStructMP2(IInputStream& SCLY, CPropertyStruct *pStruct,
|
||||||
u32 StructStart = SCLY.Tell();
|
u32 StructStart = SCLY.Tell();
|
||||||
StructStart += 0;
|
StructStart += 0;
|
||||||
u32 PropCount = pTemp->Count();
|
u32 PropCount = pTemp->Count();
|
||||||
u32 Version = 0;
|
|
||||||
|
|
||||||
if (!pTemp->IsSingleProperty())
|
if (!pTemp->IsSingleProperty())
|
||||||
{
|
PropCount = SCLY.ReadShort();
|
||||||
u16 NumProperties = SCLY.ReadShort();
|
|
||||||
Version = pTemp->VersionForPropertyCount(NumProperties);
|
|
||||||
|
|
||||||
if ((NumProperties != PropCount) && (mVersion < eReturns))
|
|
||||||
{
|
|
||||||
TIDString IDString = pTemp->IDString(true);
|
|
||||||
if (!IDString.IsEmpty()) IDString = " (" + IDString + ")";
|
|
||||||
|
|
||||||
Log::FileWarning(SCLY.GetSourceString(), StructStart, "Struct \"" + pTemp->Name() + "\"" + IDString + " template prop count doesn't match file");
|
|
||||||
}
|
|
||||||
|
|
||||||
PropCount = NumProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse properties
|
// Parse properties
|
||||||
for (u32 iProp = 0; iProp < PropCount; iProp++)
|
for (u32 iProp = 0; iProp < PropCount; iProp++)
|
||||||
|
@ -334,7 +321,7 @@ CScriptObject* CScriptLoader::LoadObjectMP2(IInputStream& SCLY)
|
||||||
|
|
||||||
if (!pTemplate)
|
if (!pTemplate)
|
||||||
{
|
{
|
||||||
Log::FileError(SCLY.GetSourceString(), ObjStart, "Invalid object ID encountered: " + CFourCC(ObjectID).ToString());
|
Log::FileError(SCLY.GetSourceString(), ObjStart, "Unknown object ID encountered: " + CFourCC(ObjectID).ToString());
|
||||||
SCLY.Seek(ObjEnd, SEEK_SET);
|
SCLY.Seek(ObjEnd, SEEK_SET);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -413,7 +413,7 @@ CScriptTemplate* CTemplateLoader::LoadScriptTemplate(XMLDocument *pDoc, const TS
|
||||||
{
|
{
|
||||||
CScriptTemplate *pScript = new CScriptTemplate(mpMaster);
|
CScriptTemplate *pScript = new CScriptTemplate(mpMaster);
|
||||||
pScript->mObjectID = ObjectID;
|
pScript->mObjectID = ObjectID;
|
||||||
pScript->mpBaseStruct = new CStructTemplate(-1, nullptr, mpMaster);
|
pScript->mpBaseStruct = new CStructTemplate(-1, pScript, mpMaster);
|
||||||
pScript->mSourceFile = rkTemplateName;
|
pScript->mSourceFile = rkTemplateName;
|
||||||
|
|
||||||
XMLElement *pRoot = pDoc->FirstChildElement("ScriptTemplate");
|
XMLElement *pRoot = pDoc->FirstChildElement("ScriptTemplate");
|
||||||
|
|
Loading…
Reference in New Issue