mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-21 10:49:23 +00:00
Fixed all DKCR name generation issues
This commit is contained in:
@@ -97,7 +97,7 @@ void GenerateAssetNames(CGameProject *pProj)
|
||||
|
||||
TString NewDir = (HasCustomDir ? It->DirectoryPath() : "Uncategorized/");
|
||||
TString NewName = (HasCustomName ? It->Name() : It->ID().ToString());
|
||||
It->Move(NewDir, NewName);
|
||||
It->Move(NewDir, NewName, true, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -131,7 +131,7 @@ void GenerateAssetNames(CGameProject *pProj)
|
||||
for (TResourceIterator<eWorld> It(pStore); It; ++It)
|
||||
{
|
||||
// Set world name
|
||||
CWorld *pWorld = (CWorld*) It->Load();
|
||||
TResPtr<CWorld> pWorld = It->Load();
|
||||
TString WorldName = pWorld->Name();
|
||||
TString WorldDir = kWorldsRoot + WorldName + '/';
|
||||
|
||||
@@ -205,7 +205,7 @@ void GenerateAssetNames(CGameProject *pProj)
|
||||
|
||||
// Rename area stuff
|
||||
CResourceEntry *pAreaEntry = pStore->FindEntry(AreaID);
|
||||
ASSERT(pAreaEntry != nullptr);
|
||||
if (!pAreaEntry) continue; // Some DKCR worlds reference areas that don't exist
|
||||
ApplyGeneratedName(pAreaEntry, WorldMasterDir, AreaName);
|
||||
|
||||
CStringTable *pAreaNameTable = pWorld->AreaName(iArea);
|
||||
|
||||
@@ -204,7 +204,7 @@ bool CVirtualDirectory::RemoveChildDirectory(CVirtualDirectory *pSubdir)
|
||||
// If this is part of the resource store, delete the corresponding filesystem directory
|
||||
if (mpStore && pSubdir->GetRoot() == mpStore->RootDirectory())
|
||||
{
|
||||
TString AbsPath = mpStore->DatabaseRootPath() + pSubdir->FullPath();
|
||||
TString AbsPath = mpStore->ResourcesDir() + pSubdir->FullPath();
|
||||
FileUtil::DeleteDirectory(AbsPath, true);
|
||||
}
|
||||
|
||||
@@ -237,7 +237,10 @@ void CVirtualDirectory::RemoveEmptySubdirectories()
|
||||
CVirtualDirectory *pDir = mSubdirectories[SubdirIdx];
|
||||
|
||||
if (pDir->IsEmpty())
|
||||
{
|
||||
RemoveChildDirectory(pDir);
|
||||
SubdirIdx--;
|
||||
}
|
||||
else
|
||||
pDir->RemoveEmptySubdirectories();
|
||||
}
|
||||
|
||||
@@ -29,6 +29,13 @@ IMetaAnimation* CMetaAnimFactory::LoadFromStream(IInputStream& rInput, EGame Gam
|
||||
}
|
||||
|
||||
// ************ CMetaAnimationPlay ************
|
||||
CMetaAnimPlay::CMetaAnimPlay(const CAnimPrimitive& rkPrimitive, float UnkA, u32 UnkB)
|
||||
: mPrimitive(rkPrimitive)
|
||||
, mUnknownA(UnkA)
|
||||
, mUnknownB(UnkB)
|
||||
{
|
||||
}
|
||||
|
||||
CMetaAnimPlay::CMetaAnimPlay(IInputStream& rInput, EGame Game)
|
||||
{
|
||||
mPrimitive = CAnimPrimitive(rInput, Game);
|
||||
|
||||
@@ -32,6 +32,12 @@ class CAnimPrimitive
|
||||
public:
|
||||
CAnimPrimitive() : mID(0) {}
|
||||
|
||||
CAnimPrimitive(const CAssetID& rkAnimAssetID, u32 CharAnimID, const TString& rkAnimName)
|
||||
: mID(CharAnimID), mName(rkAnimName)
|
||||
{
|
||||
mpAnim = gpResourceStore->LoadResource(rkAnimAssetID);
|
||||
}
|
||||
|
||||
CAnimPrimitive(IInputStream& rInput, EGame Game)
|
||||
{
|
||||
mpAnim = gpResourceStore->LoadResource( CAssetID(rInput, Game) );
|
||||
@@ -70,6 +76,7 @@ protected:
|
||||
u32 mUnknownB;
|
||||
|
||||
public:
|
||||
CMetaAnimPlay(const CAnimPrimitive& rkPrimitive, float UnkA, u32 UnkB);
|
||||
CMetaAnimPlay(IInputStream& rInput, EGame Game);
|
||||
virtual EMetaAnimationType Type() const;
|
||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
||||
|
||||
@@ -137,10 +137,16 @@ CAnimSet* CAnimSetLoader::LoadReturnsCHAR(IInputStream& rCHAR)
|
||||
|
||||
for (u32 AnimIdx = 0; AnimIdx < NumAnims; AnimIdx++)
|
||||
{
|
||||
rCHAR.ReadString();
|
||||
TString AnimName = rCHAR.ReadString();
|
||||
CAssetID AnimID(rCHAR, eReturns);
|
||||
rCHAR.Skip(0x25);
|
||||
rChar.DKDependencies.push_back(AnimID);
|
||||
|
||||
// small hack - create a meta-anim for it so we can generate asset names for the ANIM files correctly
|
||||
SAnimation Anim;
|
||||
Anim.Name = AnimName;
|
||||
Anim.pMetaAnim = new CMetaAnimPlay( CAnimPrimitive(AnimID, AnimIdx, AnimName), 0.f, 0 );
|
||||
pSet->mAnimations.push_back(Anim);
|
||||
}
|
||||
|
||||
// The only other thing we care about right now is the dependency list. If this file doesn't have a dependency list, exit out.
|
||||
@@ -229,6 +235,7 @@ CAnimSet* CAnimSetLoader::LoadReturnsCHAR(IInputStream& rCHAR)
|
||||
}
|
||||
}
|
||||
|
||||
ProcessPrimitives();
|
||||
return pSet;
|
||||
}
|
||||
|
||||
|
||||
@@ -624,7 +624,9 @@ void CAreaLoader::SetUpObjects(CScriptLayer *pGenLayer)
|
||||
// Check if this is a duplicate of an existing instance (this only happens with DKCR GenericCreature as far as I'm aware)
|
||||
if (mpArea->InstanceByID(InstanceID) != nullptr)
|
||||
{
|
||||
Log::Write("Duplicate SCGN object: [" + pInst->Template()->Name() + "] " + pInst->InstanceName() + " (" + TString::HexString(pInst->InstanceID(), 8, false) + ")");
|
||||
if (pInst->ObjectTypeID() != FOURCC('GCTR'))
|
||||
Log::Write("Duplicate SCGN object: [" + pInst->Template()->Name() + "] " + pInst->InstanceName() + " (" + TString::HexString(pInst->InstanceID(), 8, false) + ")");
|
||||
|
||||
pGenLayer->RemoveInstance(pInst);
|
||||
delete pInst;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user