2016-03-26 00:51:59 +00:00
|
|
|
#include "ProjectResourceFactoryMP1.hpp"
|
|
|
|
#include "Runtime/IOStreams.hpp"
|
|
|
|
|
2016-09-10 04:50:00 +00:00
|
|
|
#include "Runtime/CGameHintInfo.hpp"
|
2016-03-26 00:51:59 +00:00
|
|
|
#include "Runtime/Particle/CParticleDataFactory.hpp"
|
|
|
|
#include "Runtime/Particle/CGenDescription.hpp"
|
|
|
|
#include "Runtime/Particle/CElectricDescription.hpp"
|
|
|
|
#include "Runtime/Particle/CSwooshDescription.hpp"
|
|
|
|
#include "Runtime/GuiSys/CGuiFrame.hpp"
|
|
|
|
#include "Runtime/GuiSys/CRasterFont.hpp"
|
2016-08-17 05:40:25 +00:00
|
|
|
#include "Runtime/GuiSys/CStringTable.hpp"
|
2016-03-26 00:51:59 +00:00
|
|
|
#include "Runtime/Graphics/CModel.hpp"
|
|
|
|
#include "Runtime/Graphics/CTexture.hpp"
|
2016-04-09 23:19:17 +00:00
|
|
|
#include "Runtime/Character/CCharLayoutInfo.hpp"
|
2016-04-12 22:28:08 +00:00
|
|
|
#include "Runtime/Character/CSkinRules.hpp"
|
2016-04-10 21:22:59 +00:00
|
|
|
#include "Runtime/Character/CAnimCharacterSet.hpp"
|
2016-04-12 06:15:32 +00:00
|
|
|
#include "Runtime/Character/CAllFormatsAnimSource.hpp"
|
|
|
|
#include "Runtime/Character/CAnimPOIData.hpp"
|
2016-04-20 21:44:18 +00:00
|
|
|
#include "Runtime/Collision/CCollidableOBBTreeGroup.hpp"
|
2016-07-24 22:51:15 +00:00
|
|
|
#include "Audio/CAudioGroupSet.hpp"
|
2016-04-12 11:37:07 +00:00
|
|
|
#include "Runtime/CDependencyGroup.hpp"
|
2016-03-26 00:51:59 +00:00
|
|
|
#include "DataSpec/DNACommon/TXTR.hpp"
|
|
|
|
|
|
|
|
namespace DataSpec
|
|
|
|
{
|
|
|
|
extern hecl::Database::DataSpecEntry SpecEntMP1;
|
|
|
|
extern hecl::Database::DataSpecEntry SpecEntMP1PC;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
|
2016-03-27 20:43:04 +00:00
|
|
|
ProjectResourceFactoryMP1::ProjectResourceFactoryMP1(hecl::ClientProcess& clientProc)
|
|
|
|
: ProjectResourceFactoryBase(clientProc)
|
2016-03-26 00:51:59 +00:00
|
|
|
{
|
2016-04-01 01:00:37 +00:00
|
|
|
m_factoryMgr.AddFactory(FOURCC('TXTR'), FMemFactoryFunc(FTextureFactory));
|
2016-03-31 02:44:43 +00:00
|
|
|
m_factoryMgr.AddFactory(FOURCC('PART'), FFactoryFunc(FParticleFactory));
|
|
|
|
m_factoryMgr.AddFactory(FOURCC('FRME'), FFactoryFunc(RGuiFrameFactoryInGame));
|
|
|
|
m_factoryMgr.AddFactory(FOURCC('FONT'), FFactoryFunc(FRasterFontFactory));
|
|
|
|
m_factoryMgr.AddFactory(FOURCC('CMDL'), FMemFactoryFunc(FModelFactory));
|
2016-04-09 23:19:17 +00:00
|
|
|
m_factoryMgr.AddFactory(FOURCC('CINF'), FFactoryFunc(FCharLayoutInfo));
|
2016-04-12 22:28:08 +00:00
|
|
|
m_factoryMgr.AddFactory(FOURCC('CSKR'), FFactoryFunc(FSkinRulesFactory));
|
2016-04-10 21:22:59 +00:00
|
|
|
m_factoryMgr.AddFactory(FOURCC('ANCS'), FFactoryFunc(FAnimCharacterSet));
|
2016-04-12 06:15:32 +00:00
|
|
|
m_factoryMgr.AddFactory(FOURCC('ANIM'), FFactoryFunc(AnimSourceFactory));
|
|
|
|
m_factoryMgr.AddFactory(FOURCC('EVNT'), FFactoryFunc(AnimPOIDataFactory));
|
2016-04-20 21:44:18 +00:00
|
|
|
m_factoryMgr.AddFactory(FOURCC('DCLN'), FFactoryFunc(FCollidableOBBTreeGroupFactory));
|
2016-04-12 11:37:07 +00:00
|
|
|
m_factoryMgr.AddFactory(FOURCC('DGRP'), FFactoryFunc(FDependencyGroupFactory));
|
2016-07-24 22:51:15 +00:00
|
|
|
m_factoryMgr.AddFactory(FOURCC('AGSC'), FMemFactoryFunc(FAudioGroupSetDataFactory));
|
2016-08-17 05:40:25 +00:00
|
|
|
m_factoryMgr.AddFactory(FOURCC('STRG'), FFactoryFunc(FStringTableFactory));
|
2016-09-10 04:50:00 +00:00
|
|
|
m_factoryMgr.AddFactory(FOURCC('HINT'), FFactoryFunc(FHintFactory));
|
2016-03-26 00:51:59 +00:00
|
|
|
}
|
|
|
|
|
2016-03-28 04:36:55 +00:00
|
|
|
void ProjectResourceFactoryMP1::IndexMP1Resources(hecl::Database::Project& proj)
|
2016-03-26 00:51:59 +00:00
|
|
|
{
|
|
|
|
BeginBackgroundIndex(proj, DataSpec::SpecEntMP1, DataSpec::SpecEntMP1PC);
|
|
|
|
}
|
|
|
|
|
2016-09-17 21:33:32 +00:00
|
|
|
SObjectTag ProjectResourceFactoryMP1::BuildTagFromPath(const hecl::ProjectPath& path, hecl::BlenderToken& btok) const
|
2016-03-26 00:51:59 +00:00
|
|
|
{
|
2016-08-31 01:13:58 +00:00
|
|
|
if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".CINF")))
|
2016-04-16 03:24:25 +00:00
|
|
|
return SObjectTag(SBIG('CINF'), path.hash().val32());
|
2016-08-31 01:13:58 +00:00
|
|
|
else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".CSKR")))
|
2016-04-16 03:24:25 +00:00
|
|
|
return SObjectTag(SBIG('CSKR'), path.hash().val32());
|
2016-08-31 01:13:58 +00:00
|
|
|
else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".ANIM")))
|
2016-04-16 03:24:25 +00:00
|
|
|
return SObjectTag(SBIG('ANIM'), path.hash().val32());
|
|
|
|
|
2016-09-21 05:41:51 +00:00
|
|
|
hecl::ProjectPath asBlend;
|
|
|
|
if (path.getPathType() == hecl::ProjectPath::Type::Glob)
|
|
|
|
asBlend = path.getWithExtension(_S(".blend"), true);
|
|
|
|
else
|
|
|
|
asBlend = path;
|
|
|
|
|
|
|
|
if (hecl::IsPathBlend(asBlend))
|
2016-03-26 00:51:59 +00:00
|
|
|
{
|
2016-03-31 21:06:41 +00:00
|
|
|
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
2016-09-21 05:41:51 +00:00
|
|
|
if (!conn.openBlend(asBlend))
|
2016-03-26 00:51:59 +00:00
|
|
|
return {};
|
|
|
|
|
|
|
|
switch (conn.getBlendType())
|
|
|
|
{
|
|
|
|
case hecl::BlenderConnection::BlendType::Mesh:
|
2016-03-28 04:36:55 +00:00
|
|
|
return {SBIG('CMDL'), path.hash().val32()};
|
2016-03-26 00:51:59 +00:00
|
|
|
case hecl::BlenderConnection::BlendType::Actor:
|
2016-04-07 03:40:25 +00:00
|
|
|
if (path.getAuxInfo().size())
|
2016-04-12 22:28:08 +00:00
|
|
|
{
|
2016-08-31 01:13:58 +00:00
|
|
|
if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".CINF")))
|
2016-04-12 22:28:08 +00:00
|
|
|
return {SBIG('CINF'), path.hash().val32()};
|
2016-08-31 01:13:58 +00:00
|
|
|
else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".CSKR")))
|
2016-04-12 22:28:08 +00:00
|
|
|
return {SBIG('CSKR'), path.hash().val32()};
|
2016-08-31 01:13:58 +00:00
|
|
|
else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".ANIM")))
|
2016-04-12 22:28:08 +00:00
|
|
|
return {SBIG('ANIM'), path.hash().val32()};
|
|
|
|
}
|
2016-03-28 04:36:55 +00:00
|
|
|
return {SBIG('ANCS'), path.hash().val32()};
|
2016-03-26 00:51:59 +00:00
|
|
|
case hecl::BlenderConnection::BlendType::Area:
|
2016-03-28 04:36:55 +00:00
|
|
|
return {SBIG('MREA'), path.hash().val32()};
|
2016-03-26 00:51:59 +00:00
|
|
|
case hecl::BlenderConnection::BlendType::World:
|
2016-10-01 02:57:09 +00:00
|
|
|
{
|
|
|
|
if (path.getAuxInfo().size())
|
2016-10-01 23:20:20 +00:00
|
|
|
{
|
2016-10-01 02:57:09 +00:00
|
|
|
if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".MAPW")))
|
|
|
|
return {SBIG('MAPW'), path.hash().val32()};
|
2016-10-01 23:20:20 +00:00
|
|
|
else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".SAVW")))
|
|
|
|
return {SBIG('SAVW'), path.hash().val32()};
|
|
|
|
}
|
2016-03-28 04:36:55 +00:00
|
|
|
return {SBIG('MLVL'), path.hash().val32()};
|
2016-10-01 02:57:09 +00:00
|
|
|
}
|
2016-03-26 00:51:59 +00:00
|
|
|
case hecl::BlenderConnection::BlendType::MapArea:
|
2016-03-28 04:36:55 +00:00
|
|
|
return {SBIG('MAPA'), path.hash().val32()};
|
2016-03-26 00:51:59 +00:00
|
|
|
case hecl::BlenderConnection::BlendType::MapUniverse:
|
2016-03-28 04:36:55 +00:00
|
|
|
return {SBIG('MAPU'), path.hash().val32()};
|
2016-03-26 00:51:59 +00:00
|
|
|
case hecl::BlenderConnection::BlendType::Frame:
|
2016-03-28 04:36:55 +00:00
|
|
|
return {SBIG('FRME'), path.hash().val32()};
|
2016-03-26 00:51:59 +00:00
|
|
|
default:
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (hecl::IsPathPNG(path))
|
|
|
|
{
|
2016-03-28 04:36:55 +00:00
|
|
|
return {SBIG('TXTR'), path.hash().val32()};
|
2016-03-26 00:51:59 +00:00
|
|
|
}
|
|
|
|
else if (hecl::IsPathYAML(path))
|
|
|
|
{
|
|
|
|
FILE* fp = hecl::Fopen(path.getAbsolutePath().c_str(), _S("r"));
|
|
|
|
if (!fp)
|
|
|
|
return {};
|
|
|
|
|
|
|
|
athena::io::YAMLDocReader reader;
|
|
|
|
yaml_parser_set_input_file(reader.getParser(), fp);
|
|
|
|
|
|
|
|
SObjectTag resTag;
|
2016-09-21 05:41:51 +00:00
|
|
|
if (reader.ClassTypeOperation([&](const char* className) -> bool
|
|
|
|
{
|
|
|
|
if (!strcmp(className, "GPSM"))
|
|
|
|
{
|
|
|
|
resTag.type = SBIG('PART');
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!strcmp(className, "SWSH"))
|
|
|
|
{
|
|
|
|
resTag.type = SBIG('SWHC');
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!strcmp(className, "ELSM"))
|
|
|
|
{
|
|
|
|
resTag.type = SBIG('ELSC');
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!strcmp(className, "WPSM"))
|
|
|
|
{
|
|
|
|
resTag.type = SBIG('WPSC');
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!strcmp(className, "CRSM"))
|
|
|
|
{
|
|
|
|
resTag.type = SBIG('CRSC');
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!strcmp(className, "DPSM"))
|
|
|
|
{
|
|
|
|
resTag.type = SBIG('DPSC');
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (!strcmp(className, "FONT"))
|
|
|
|
{
|
|
|
|
resTag.type = SBIG('FONT');
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (!strcmp(className, "urde::DNAMP1::EVNT"))
|
|
|
|
{
|
|
|
|
resTag.type = SBIG('EVNT');
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (!strcmp(className, "urde::DGRP"))
|
|
|
|
{
|
|
|
|
resTag.type = SBIG('DGRP');
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (!strcmp(className, "urde::DNAMP1::STRG"))
|
|
|
|
{
|
|
|
|
resTag.type = SBIG('STRG');
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (!strcmp(className, "DataSpec::DNAMP1::CTweakPlayerRes") ||
|
|
|
|
!strcmp(className, "DataSpec::DNAMP1::CTweakGunRes") ||
|
|
|
|
!strcmp(className, "DataSpec::DNAMP1::CTweakSlideShow") ||
|
|
|
|
!strcmp(className, "DataSpec::DNAMP1::CTweakPlayer") ||
|
|
|
|
!strcmp(className, "DataSpec::DNAMP1::CTweakCameraBob"))
|
|
|
|
{
|
|
|
|
resTag.type = SBIG('CTWK');
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (!strcmp(className, "DataSpec::DNAMP1::HINT"))
|
|
|
|
{
|
|
|
|
resTag.type = SBIG('HINT');
|
|
|
|
return true;
|
|
|
|
}
|
2016-09-10 04:50:00 +00:00
|
|
|
|
2016-09-21 05:41:51 +00:00
|
|
|
return false;
|
|
|
|
}))
|
2016-03-26 00:51:59 +00:00
|
|
|
{
|
2016-03-28 04:36:55 +00:00
|
|
|
resTag.id = path.hash().val32();
|
|
|
|
fclose(fp);
|
2016-03-26 00:51:59 +00:00
|
|
|
return resTag;
|
|
|
|
}
|
2016-03-28 04:36:55 +00:00
|
|
|
fclose(fp);
|
2016-03-26 00:51:59 +00:00
|
|
|
}
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
}
|