Remove the stupid "-component" garbage from MP1 instance names

This commit is contained in:
Aruki 2017-05-18 13:57:31 -06:00
parent f9f6d1f963
commit 4ffd1f0a2d
2 changed files with 18 additions and 6 deletions

View File

@ -650,6 +650,17 @@ void CAreaLoader::SetUpObjects()
CLink *pLink = pObj->Link(eOutgoing, iCon);
mConnectionMap[pLink->ReceiverID()].push_back(pLink);
}
// Remove "-component" garbage from MP1 instance names
if (mVersion <= ePrime)
{
TString InstanceName = pObj->InstanceName();
while (InstanceName.EndsWith("-component"))
InstanceName = InstanceName.ChopBack(10);
pObj->SetName(InstanceName);
}
}
}

View File

@ -14,6 +14,13 @@ CScriptObject::CScriptObject(u32 InstanceID, CGameArea *pArea, CScriptLayer *pLa
{
mpTemplate->AddObject(this);
mpProperties = (CPropertyStruct*) pTemplate->BaseStruct()->InstantiateProperty(this, nullptr);
mpInstanceName = mpTemplate->FindInstanceName(mpProperties);
mpPosition = mpTemplate->FindPosition(mpProperties);
mpRotation = mpTemplate->FindRotation(mpProperties);
mpScale = mpTemplate->FindScale(mpProperties);
mpActive = mpTemplate->FindActive(mpProperties);
mpLightParameters = mpTemplate->FindLightParameters(mpProperties);
}
CScriptObject::~CScriptObject()
@ -29,12 +36,6 @@ CScriptObject::~CScriptObject()
// ************ DATA MANIPULATION ************
void CScriptObject::EvaluateProperties()
{
mpInstanceName = mpTemplate->FindInstanceName(mpProperties);
mpPosition = mpTemplate->FindPosition(mpProperties);
mpRotation = mpTemplate->FindRotation(mpProperties);
mpScale = mpTemplate->FindScale(mpProperties);
mpActive = mpTemplate->FindActive(mpProperties);
mpLightParameters = mpTemplate->FindLightParameters(mpProperties);
EvaluateDisplayAsset();
EvaluateCollisionModel();
EvaluateVolume();