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; mpGeneratorLayer = nullptr;
} }
EGame CGameArea::Version()
{
return mVersion;
}
CTransform4f CGameArea::GetTransform() CTransform4f CGameArea::GetTransform()
{ {
return mTransform; return mTransform;

View File

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

View File

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

View File

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

View File

@ -57,9 +57,11 @@ CScan* CScanLoader::LoadScanMP2(IInputStream& SCAN)
switch (NumProperties) switch (NumProperties)
{ {
case 0x14: case 0x14:
case 0xB:
mpScan = new CScan(); mpScan = new CScan();
LoadParamsMP2(SCAN); LoadParamsMP2(SCAN);
break; break;
case 0x12:
case 0x16: case 0x16:
mpScan = new CScan(); mpScan = new CScan();
LoadParamsMP3(SCAN); LoadParamsMP3(SCAN);
@ -156,6 +158,7 @@ CScan* CScanLoader::LoadSCAN(IInputStream &SCAN)
// The MP2 load function will check for MP3 // The MP2 load function will check for MP3
CScanLoader loader; CScanLoader loader;
loader.mVersion = eEchoes; 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); return loader.LoadScanMP2(SCAN);
} }

View File

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

View File

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