Fixed crash when reading STRG files, fixed scale on script objects defaulting to 0, more cleanup
This commit is contained in:
parent
1150ee2b22
commit
e461039882
src/Core
|
@ -25,7 +25,7 @@ class CStringTable : public CResource
|
||||||
public:
|
public:
|
||||||
CStringTable() {}
|
CStringTable() {}
|
||||||
|
|
||||||
inline u32 NumStrings() const { return mLangTables.size(); }
|
inline u32 NumStrings() const { return mNumStrings; }
|
||||||
inline u32 NumLanguages() const { return mLangTables.size(); }
|
inline u32 NumLanguages() const { return mLangTables.size(); }
|
||||||
inline CFourCC LanguageTag(u32 Index) const { return mLangTables[Index].Language; }
|
inline CFourCC LanguageTag(u32 Index) const { return mLangTables[Index].Language; }
|
||||||
inline TWideString String(u32 LangIndex, u32 StringIndex) const { return mLangTables[LangIndex].Strings[StringIndex]; }
|
inline TWideString String(u32 LangIndex, u32 StringIndex) const { return mLangTables[LangIndex].Strings[StringIndex]; }
|
||||||
|
|
|
@ -84,26 +84,26 @@ public:
|
||||||
|
|
||||||
CVector3f Position() const { return mpPosition ? mpPosition->Get() : CVector3f::skZero; }
|
CVector3f Position() const { return mpPosition ? mpPosition->Get() : CVector3f::skZero; }
|
||||||
CVector3f Rotation() const { return mpRotation ? mpRotation->Get() : CVector3f::skZero; }
|
CVector3f Rotation() const { return mpRotation ? mpRotation->Get() : CVector3f::skZero; }
|
||||||
CVector3f Scale() const { return mpScale ? mpScale->Get() : CVector3f::skZero; }
|
CVector3f Scale() const { return mpScale ? mpScale->Get() : CVector3f::skOne; }
|
||||||
TString InstanceName() const { return mpInstanceName ? mpInstanceName->Get() : ""; }
|
TString InstanceName() const { return mpInstanceName ? mpInstanceName->Get() : ""; }
|
||||||
bool IsActive() const { return mpActive ? mpActive->Get() : false; }
|
bool IsActive() const { return mpActive ? mpActive->Get() : false; }
|
||||||
bool HasInGameModel() const { return mHasInGameModel; }
|
bool HasInGameModel() const { return mHasInGameModel; }
|
||||||
|
CPropertyStruct* LightParameters() const { return mpLightParameters; }
|
||||||
|
CModel* DisplayModel() const { return mpDisplayModel; }
|
||||||
|
CTexture* Billboard() const { return mpBillboard; }
|
||||||
|
CCollisionMeshGroup* Collision() const { return mpCollision; }
|
||||||
|
EVolumeShape VolumeShape() const { return mVolumeShape; }
|
||||||
|
float VolumeScale() const { return mVolumeScale; }
|
||||||
void SetPosition(const CVector3f& rkNewPos) { if (mpPosition) mpPosition->Set(rkNewPos); }
|
void SetPosition(const CVector3f& rkNewPos) { if (mpPosition) mpPosition->Set(rkNewPos); }
|
||||||
void SetRotation(const CVector3f& rkNewRot) { if (mpRotation) mpRotation->Set(rkNewRot); }
|
void SetRotation(const CVector3f& rkNewRot) { if (mpRotation) mpRotation->Set(rkNewRot); }
|
||||||
void SetScale(const CVector3f& rkNewScale) { if (mpScale) mpScale->Set(rkNewScale); }
|
void SetScale(const CVector3f& rkNewScale) { if (mpScale) mpScale->Set(rkNewScale); }
|
||||||
void SetName(const TString& rkNewName) { if (mpInstanceName) mpInstanceName->Set(rkNewName); }
|
void SetName(const TString& rkNewName) { if (mpInstanceName) mpInstanceName->Set(rkNewName); }
|
||||||
void SetActive(bool Active) { if (mpActive) mpActive->Set(Active); }
|
void SetActive(bool Active) { if (mpActive) mpActive->Set(Active); }
|
||||||
CPropertyStruct* LightParameters() const { return mpLightParameters; }
|
|
||||||
CModel* GetDisplayModel() const { return mpDisplayModel; }
|
|
||||||
CTexture* GetBillboard() const { return mpBillboard; }
|
|
||||||
CCollisionMeshGroup* GetCollision() const { return mpCollision; }
|
|
||||||
EVolumeShape VolumeShape() const { return mVolumeShape; }
|
|
||||||
float VolumeScale() const { return mVolumeScale; }
|
|
||||||
|
|
||||||
TStringProperty* InstanceNameProperty() const { return mpInstanceName; }
|
|
||||||
TVector3Property* PositionProperty() const { return mpPosition; }
|
TVector3Property* PositionProperty() const { return mpPosition; }
|
||||||
TVector3Property* RotationProperty() const { return mpRotation; }
|
TVector3Property* RotationProperty() const { return mpRotation; }
|
||||||
TVector3Property* ScaleProperty() const { return mpScale; }
|
TVector3Property* ScaleProperty() const { return mpScale; }
|
||||||
|
TStringProperty* InstanceNameProperty() const { return mpInstanceName; }
|
||||||
TBoolProperty* ActiveProperty() const { return mpActive; }
|
TBoolProperty* ActiveProperty() const { return mpActive; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ CScriptNode::CScriptNode(CScene *pScene, u32 NodeID, CSceneNode *pParent, CScrip
|
||||||
, mpInstance(pInstance)
|
, mpInstance(pInstance)
|
||||||
, mpBillboard(nullptr)
|
, mpBillboard(nullptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Evaluate instance
|
// Evaluate instance
|
||||||
SetActiveModel(nullptr);
|
SetActiveModel(nullptr);
|
||||||
mpCollisionNode = new CCollisionNode(pScene, -1, this);
|
mpCollisionNode = new CCollisionNode(pScene, -1, this);
|
||||||
|
@ -37,9 +36,9 @@ CScriptNode::CScriptNode(CScene *pScene, u32 NodeID, CSceneNode *pParent, CScrip
|
||||||
SetName("[" + pTemp->Name() + "] " + mpInstance->InstanceName());
|
SetName("[" + pTemp->Name() + "] " + mpInstance->InstanceName());
|
||||||
|
|
||||||
// Determine display assets
|
// Determine display assets
|
||||||
SetActiveModel(mpInstance->GetDisplayModel());
|
SetActiveModel(mpInstance->DisplayModel());
|
||||||
mpBillboard = mpInstance->GetBillboard();
|
mpBillboard = mpInstance->Billboard();
|
||||||
mpCollisionNode->SetCollision(mpInstance->GetCollision());
|
mpCollisionNode->SetCollision(mpInstance->Collision());
|
||||||
|
|
||||||
// Create preview volume node
|
// Create preview volume node
|
||||||
mpVolumePreviewNode = new CModelNode(pScene, -1, this, nullptr);
|
mpVolumePreviewNode = new CModelNode(pScene, -1, this, nullptr);
|
||||||
|
@ -450,7 +449,7 @@ void CScriptNode::PropertyModified(IProperty *pProp)
|
||||||
if (pProp->Type() == eCharacterProperty)
|
if (pProp->Type() == eCharacterProperty)
|
||||||
{
|
{
|
||||||
mpInstance->EvaluateDisplayModel();
|
mpInstance->EvaluateDisplayModel();
|
||||||
SetActiveModel(mpInstance->GetDisplayModel());
|
SetActiveModel(mpInstance->DisplayModel());
|
||||||
}
|
}
|
||||||
else if (pProp->Type() == eFileProperty)
|
else if (pProp->Type() == eFileProperty)
|
||||||
{
|
{
|
||||||
|
@ -459,17 +458,17 @@ void CScriptNode::PropertyModified(IProperty *pProp)
|
||||||
if (pFile->AcceptsExtension("CMDL") || pFile->AcceptsExtension("ANCS") || pFile->AcceptsExtension("CHAR"))
|
if (pFile->AcceptsExtension("CMDL") || pFile->AcceptsExtension("ANCS") || pFile->AcceptsExtension("CHAR"))
|
||||||
{
|
{
|
||||||
mpInstance->EvaluateDisplayModel();
|
mpInstance->EvaluateDisplayModel();
|
||||||
SetActiveModel(mpInstance->GetDisplayModel());
|
SetActiveModel(mpInstance->DisplayModel());
|
||||||
}
|
}
|
||||||
else if (pFile->AcceptsExtension("TXTR"))
|
else if (pFile->AcceptsExtension("TXTR"))
|
||||||
{
|
{
|
||||||
mpInstance->EvaluateBillboard();
|
mpInstance->EvaluateBillboard();
|
||||||
mpBillboard = mpInstance->GetBillboard();
|
mpBillboard = mpInstance->Billboard();
|
||||||
}
|
}
|
||||||
else if (pFile->AcceptsExtension("DCLN"))
|
else if (pFile->AcceptsExtension("DCLN"))
|
||||||
{
|
{
|
||||||
mpInstance->EvaluateCollisionModel();
|
mpInstance->EvaluateCollisionModel();
|
||||||
mpCollisionNode->SetCollision(mpInstance->GetCollision());
|
mpCollisionNode->SetCollision(mpInstance->Collision());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue