SCAN support for Echoes demo, lights/CHAR support/instance view bugfix for the Corruption proto

This commit is contained in:
parax0 2016-01-02 13:39:29 -07:00
parent 37fd93d10e
commit 8cf9968134
7 changed files with 14 additions and 3 deletions

View File

@ -106,6 +106,11 @@ void CGameArea::ClearScriptLayers()
mpGeneratorLayer = nullptr;
}
EGame CGameArea::Version()
{
return mVersion;
}
CTransform4f CGameArea::GetTransform()
{
return mTransform;

View File

@ -20,6 +20,7 @@ class CGameArea : public CResource
DECLARE_RESOURCE_TYPE(eArea)
friend class CAreaLoader;
EGame mVersion;
u32 mVertexCount;
u32 mTriangleCount;
bool mTerrainMerged;
@ -50,6 +51,7 @@ public:
void ClearScriptLayers();
// Getters
EGame Version();
CTransform4f GetTransform();
u32 GetTerrainModelCount();
u32 GetStaticModelCount();

View File

@ -177,7 +177,7 @@ CAnimSet* CAnimSetLoader::LoadCHAR(IInputStream &CHAR)
CAnimSetLoader loader;
u8 check = CHAR.ReadByte();
if (check == 0x5)
if (check == 0x5 || check == 0x3)
{
loader.mVersion = eCorruption;
loader.set = new CAnimSet();

View File

@ -563,6 +563,7 @@ CGameArea* CAreaLoader::LoadMREA(IInputStream& MREA)
Loader.mpArea = new CGameArea;
u32 version = MREA.ReadLong();
Loader.mVersion = GetFormatVersion(version);
Loader.mpArea->mVersion = Loader.mVersion;
Loader.mpMREA = &MREA;
switch (Loader.mVersion)
@ -594,6 +595,7 @@ CGameArea* CAreaLoader::LoadMREA(IInputStream& MREA)
Loader.ReadGeometryPrime();
Loader.ReadSCLYEchoes();
Loader.ReadCollision();
Loader.ReadLightsCorruption();
break;
case eCorruption:
case eReturns:

View File

@ -57,9 +57,11 @@ CScan* CScanLoader::LoadScanMP2(IInputStream& SCAN)
switch (NumProperties)
{
case 0x14:
case 0xB:
mpScan = new CScan();
LoadParamsMP2(SCAN);
break;
case 0x12:
case 0x16:
mpScan = new CScan();
LoadParamsMP3(SCAN);
@ -156,6 +158,7 @@ CScan* CScanLoader::LoadSCAN(IInputStream &SCAN)
// The MP2 load function will check for MP3
CScanLoader loader;
loader.mVersion = eEchoes;
if (magic == 0x01000000) SCAN.Seek(-4, SEEK_CUR); // The version number isn't present in the Echoes demo
return loader.LoadScanMP2(SCAN);
}

View File

@ -345,7 +345,6 @@ CScriptObject* CScriptLoader::LoadObjectMP2(IInputStream& SCLY)
}
mpObj = new CScriptObject(mpArea, mpLayer, pTemplate);
mpObj->mpTemplate = pTemplate;
mpObj->mInstanceID = SCLY.ReadLong();
// Load connections

View File

@ -137,7 +137,7 @@ void CWorldEditor::SetArea(CWorld *pWorld, CGameArea *pArea)
}
// Set up sidebar tabs
CMasterTemplate *pMaster = CMasterTemplate::GetMasterForGame(mpWorld->Version());
CMasterTemplate *pMaster = CMasterTemplate::GetMasterForGame(mpArea->Version());
ui->InstancesTabContents->SetMaster(pMaster);
}