mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-17 08:57:09 +00:00
Added functionality to determine what AGSC a sound ID belongs to
This commit is contained in:
@@ -20,6 +20,7 @@ bool CGameProject::Load(const TWideString& rkPath)
|
||||
Serialize(Reader);
|
||||
|
||||
mpResourceStore->LoadResourceDatabase();
|
||||
mAudioManager.LoadAssets();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -95,3 +96,26 @@ void CGameProject::GetWorldList(std::list<CAssetID>& rOut) const
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CAssetID CGameProject::FindNamedResource(const TString& rkName) const
|
||||
{
|
||||
for (u32 iPkg = 0; iPkg < mPackages.size(); iPkg++)
|
||||
{
|
||||
CPackage *pPkg = mPackages[iPkg];
|
||||
|
||||
for (u32 iCol = 0; iCol < pPkg->NumCollections(); iCol++)
|
||||
{
|
||||
CResourceCollection *pCol = pPkg->CollectionByIndex(iCol);
|
||||
|
||||
for (u32 iRes = 0; iRes < pCol->NumResources(); iRes++)
|
||||
{
|
||||
const SNamedResource& rkRes = pCol->ResourceByIndex(iRes);
|
||||
|
||||
if (rkRes.Name == rkName)
|
||||
return rkRes.ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return CAssetID::InvalidID(mGame);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "CPackage.h"
|
||||
#include "CResourceStore.h"
|
||||
#include "Core/CAudioManager.h"
|
||||
#include <Common/CAssetID.h>
|
||||
#include <Common/EGame.h>
|
||||
#include <Common/FileUtil.h>
|
||||
@@ -17,6 +18,7 @@ class CGameProject
|
||||
TWideString mResourceDBPath;
|
||||
std::vector<CPackage*> mPackages;
|
||||
CResourceStore *mpResourceStore;
|
||||
CAudioManager mAudioManager;
|
||||
|
||||
enum EProjectVersion
|
||||
{
|
||||
@@ -32,6 +34,7 @@ public:
|
||||
CGameProject()
|
||||
: mGame(eUnknownGame)
|
||||
, mProjectName("Unnamed Project")
|
||||
, mAudioManager(this)
|
||||
{
|
||||
mpResourceStore = new CResourceStore(this);
|
||||
}
|
||||
@@ -41,6 +44,7 @@ public:
|
||||
, mProjectName("Unnamed Project")
|
||||
, mProjectRoot(rkProjRootDir)
|
||||
, mResourceDBPath(L"ResourceDB.rdb")
|
||||
, mAudioManager(this)
|
||||
{
|
||||
mpResourceStore = new CResourceStore(this);
|
||||
mProjectRoot.Replace(L"/", L"\\");
|
||||
@@ -53,6 +57,7 @@ public:
|
||||
void Serialize(IArchive& rArc);
|
||||
void SetActive();
|
||||
void GetWorldList(std::list<CAssetID>& rOut) const;
|
||||
CAssetID FindNamedResource(const TString& rkName) const;
|
||||
|
||||
// Directory Handling
|
||||
inline TWideString ProjectRoot() const { return mProjectRoot; }
|
||||
@@ -71,6 +76,7 @@ public:
|
||||
inline CPackage* PackageByIndex(u32 Index) const { return mPackages[Index]; }
|
||||
inline void AddPackage(CPackage *pPackage) { mPackages.push_back(pPackage); }
|
||||
inline CResourceStore* ResourceStore() const { return mpResourceStore; }
|
||||
inline CAudioManager* AudioManager() { return &mAudioManager; }
|
||||
inline EGame Game() const { return mGame; }
|
||||
inline bool IsActive() const { return mspActiveProject == this; }
|
||||
|
||||
|
||||
@@ -71,7 +71,11 @@ class TResourceIterator : public CResourceIterator
|
||||
{
|
||||
public:
|
||||
TResourceIterator(CResourceStore *pStore = gpResourceStore)
|
||||
: CResourceIterator(pStore) {}
|
||||
: CResourceIterator(pStore)
|
||||
{
|
||||
if (mpCurEntry->ResourceType() != ResType::StaticType())
|
||||
Next();
|
||||
}
|
||||
|
||||
virtual CResourceEntry* Next()
|
||||
{
|
||||
|
||||
@@ -177,7 +177,7 @@ void CPackageDependencyListBuilder::AddDependency(CResourceEntry *pCurEntry, con
|
||||
|
||||
// Is this entry valid?
|
||||
bool IsValid = ResType != eMidi &&
|
||||
(ResType != eAudioGroupSet || mGame >= eEchoesDemo) &&
|
||||
(ResType != eAudioGroup || mGame >= eEchoesDemo) &&
|
||||
(ResType != eWorld || !pCurEntry) &&
|
||||
(ResType != eArea || !pCurEntry || pCurEntry->ResourceType() == eWorld);
|
||||
|
||||
@@ -359,7 +359,7 @@ void CAreaDependencyListBuilder::AddDependency(const CAssetID& rkID, std::list<C
|
||||
bool IsValid = ResType != eMidi &&
|
||||
ResType != eWorld &&
|
||||
ResType != eArea &&
|
||||
(ResType != eAudioGroupSet || mGame >= eEchoesDemo);
|
||||
(ResType != eAudioGroup || mGame >= eEchoesDemo);
|
||||
|
||||
if (!IsValid) return;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define DEPENDENCYLISTBUILDERS
|
||||
|
||||
#include "CDependencyTree.h"
|
||||
#include "CGameProject.h"
|
||||
#include "CPackage.h"
|
||||
#include "CResourceEntry.h"
|
||||
#include "Core/Resource/CDependencyGroup.h"
|
||||
|
||||
Reference in New Issue
Block a user