mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-21 02:39:17 +00:00
Added editor game info system, exporter now fetches game build version, merged asset name maps for all games, resource browser can now import/export names to/from a map XML, reworked asset name generation to more closely match Retro's organization scheme, bug fixes
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "CWorldLoader.h"
|
||||
#include "Core/GameProject/CGameProject.h"
|
||||
#include "Core/GameProject/CResourceStore.h"
|
||||
#include <Common/Log.h>
|
||||
|
||||
@@ -125,11 +126,9 @@ void CWorldLoader::LoadPrimeMLVL(IInputStream& rMLVL)
|
||||
}
|
||||
}
|
||||
|
||||
// Internal name - MP1 doesn't have this so reuse the area's real name
|
||||
// Internal name - MP1 doesn't have this, we'll get it from the GameInfo file later
|
||||
if (mVersion >= eEchoesDemo)
|
||||
pArea->InternalName = rMLVL.ReadString();
|
||||
else
|
||||
pArea->InternalName = (pArea->pAreaName ? pArea->pAreaName->String("ENGL", 0).ToUTF8() : "");
|
||||
}
|
||||
|
||||
// MapWorld
|
||||
@@ -234,6 +233,21 @@ void CWorldLoader::LoadReturnsMLVL(IInputStream& rMLVL)
|
||||
// todo: Layer ID support
|
||||
}
|
||||
|
||||
void CWorldLoader::GenerateEditorData()
|
||||
{
|
||||
CGameInfo *pGameInfo = mpWorld->Entry()->ResourceStore()->Project()->GameInfo();
|
||||
|
||||
if (mVersion <= ePrime)
|
||||
{
|
||||
for (u32 iArea = 0; iArea < mpWorld->NumAreas(); iArea++)
|
||||
{
|
||||
CWorld::SArea& rArea = mpWorld->mAreas[iArea];
|
||||
rArea.InternalName = pGameInfo->GetAreaName(rArea.AreaResID);
|
||||
ASSERT(!rArea.InternalName.IsEmpty());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CWorld* CWorldLoader::LoadMLVL(IInputStream& rMLVL, CResourceEntry *pEntry)
|
||||
{
|
||||
if (!rMLVL.IsValid()) return nullptr;
|
||||
@@ -264,6 +278,7 @@ CWorld* CWorldLoader::LoadMLVL(IInputStream& rMLVL, CResourceEntry *pEntry)
|
||||
else
|
||||
Loader.LoadReturnsMLVL(rMLVL);
|
||||
|
||||
Loader.GenerateEditorData();
|
||||
return Loader.mpWorld;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ class CWorldLoader
|
||||
CWorldLoader();
|
||||
void LoadPrimeMLVL(IInputStream& rMLVL);
|
||||
void LoadReturnsMLVL(IInputStream& rMLVL);
|
||||
void GenerateEditorData();
|
||||
|
||||
public:
|
||||
static CWorld* LoadMLVL(IInputStream& rMLVL, CResourceEntry *pEntry);
|
||||
|
||||
@@ -275,6 +275,22 @@ bool CModel::IsSurfaceTransparent(u32 Surface, u32 MatSet)
|
||||
return (mMaterialSets[MatSet]->MaterialByIndex(matID)->Options() & CMaterial::eTransparent) != 0;
|
||||
}
|
||||
|
||||
bool CModel::IsLightmapped() const
|
||||
{
|
||||
for (u32 iSet = 0; iSet < mMaterialSets.size(); iSet++)
|
||||
{
|
||||
CMaterialSet *pSet = mMaterialSets[iSet];
|
||||
|
||||
for (u32 iMat = 0; iMat < pSet->NumMaterials(); iMat++)
|
||||
{
|
||||
CMaterial *pMat = pSet->MaterialByIndex(iMat);
|
||||
if (pMat->Options().HasFlag(CMaterial::eLightmap))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CIndexBuffer* CModel::InternalGetIBO(u32 Surface, EGXPrimitiveType Primitive)
|
||||
{
|
||||
std::vector<CIndexBuffer> *pIBOs = &mSurfaceIndexBuffers[Surface];
|
||||
|
||||
@@ -41,6 +41,7 @@ public:
|
||||
CMaterial* GetMaterialBySurface(u32 MatSet, u32 Surface);
|
||||
bool HasTransparency(u32 MatSet);
|
||||
bool IsSurfaceTransparent(u32 Surface, u32 MatSet);
|
||||
bool IsLightmapped() const;
|
||||
|
||||
inline bool IsSkinned() const { return (mpSkin != nullptr); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user