mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-07-02 22:08:11 +00:00
feat: T4 MapEnts dumper (#865)
* feat: T4 MapEnts dumper * chore: use common map_ents logic for filename --------- Co-authored-by: Jan Laupetin <jan@laupetin.net>
This commit is contained in:
@@ -142,7 +142,7 @@ using `Linker`):
|
||||
| ComWorld | ❌ | ❌ | |
|
||||
| GameWorldSp | ❌ | ❌ | |
|
||||
| GameWorldMp | ❌ | ❌ | |
|
||||
| MapEnts | ❌ | ❌ | |
|
||||
| MapEnts | ✅ | ❌ | |
|
||||
| GfxWorld | ❌ | ❌ | |
|
||||
| GfxLightDef | ❌ | ❌ | |
|
||||
| Font_s | ❌ | ❌ | |
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#include "MapEntsCommon.h"
|
||||
|
||||
#include <format>
|
||||
|
||||
namespace map_ents
|
||||
{
|
||||
std::string GetEntsFileNameForAssetName(const std::string& assetName)
|
||||
{
|
||||
return std::format("{}.ents", assetName);
|
||||
}
|
||||
} // namespace map_ents
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace map_ents
|
||||
{
|
||||
std::string GetEntsFileNameForAssetName(const std::string& assetName);
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "MapEntsDumperIW3.h"
|
||||
|
||||
#include "Maps/MapEntsCommon.h"
|
||||
|
||||
using namespace IW3;
|
||||
|
||||
namespace map_ents
|
||||
@@ -7,7 +9,7 @@ namespace map_ents
|
||||
void DumperIW3::DumpAsset(AssetDumpingContext& context, const XAssetInfo<MapEnts>& asset)
|
||||
{
|
||||
const auto* mapEnts = asset.Asset();
|
||||
const auto assetFile = context.OpenAssetFile(asset.m_name + ".ents");
|
||||
const auto assetFile = context.OpenAssetFile(GetEntsFileNameForAssetName(asset.m_name));
|
||||
|
||||
if (!assetFile)
|
||||
return;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#include "MapEntsDumperT4.h"
|
||||
|
||||
#include "Maps/MapEntsCommon.h"
|
||||
|
||||
using namespace T4;
|
||||
|
||||
namespace map_ents
|
||||
{
|
||||
void DumperT4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<MapEnts>& asset)
|
||||
{
|
||||
const auto* mapEnts = asset.Asset();
|
||||
const auto assetFile = context.OpenAssetFile(GetEntsFileNameForAssetName(asset.m_name));
|
||||
|
||||
if (!assetFile)
|
||||
return;
|
||||
|
||||
auto& stream = *assetFile;
|
||||
stream.write(mapEnts->entityString, mapEnts->numEntityChars);
|
||||
}
|
||||
} // namespace map_ents
|
||||
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T4/T4.h"
|
||||
|
||||
namespace map_ents
|
||||
{
|
||||
class DumperT4 final : public AbstractAssetDumper<T4::AssetMapEnts>
|
||||
{
|
||||
protected:
|
||||
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<T4::MapEnts>& asset) override;
|
||||
};
|
||||
} // namespace map_ents
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "Game/T4/XAnim/XAnimDumperT4.h"
|
||||
#include "Game/T4/XModel/XModelDumperT4.h"
|
||||
#include "Localize/LocalizeDumperT4.h"
|
||||
#include "Maps/MapEntsDumperT4.h"
|
||||
#include "RawFile/RawFileDumperT4.h"
|
||||
#include "StringTable/StringTableDumperT4.h"
|
||||
|
||||
@@ -14,6 +15,7 @@ void ObjWriter::RegisterAssetDumpers(AssetDumpingContext& context)
|
||||
RegisterAssetDumper(std::make_unique<xanim::DumperT4>());
|
||||
RegisterAssetDumper(std::make_unique<xmodel::DumperT4>());
|
||||
RegisterAssetDumper(std::make_unique<image::DumperT4>());
|
||||
RegisterAssetDumper(std::make_unique<map_ents::DumperT4>());
|
||||
RegisterAssetDumper(std::make_unique<localize::DumperT4>());
|
||||
RegisterAssetDumper(std::make_unique<raw_file::DumperT4>());
|
||||
RegisterAssetDumper(std::make_unique<string_table::DumperT4>());
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "MapEntsDumperT6.h"
|
||||
|
||||
#include <format>
|
||||
#include "Maps/MapEntsCommon.h"
|
||||
|
||||
using namespace T6;
|
||||
|
||||
@@ -9,13 +9,12 @@ namespace map_ents
|
||||
void DumperT6::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetMapEnts::Type>& asset)
|
||||
{
|
||||
const auto* mapEnts = asset.Asset();
|
||||
const auto assetFile = context.OpenAssetFile(GetEntsFileNameForAssetName(asset.m_name));
|
||||
|
||||
const auto mapEntsFile = context.OpenAssetFile(std::format("{}.ents", mapEnts->name));
|
||||
|
||||
if (!mapEntsFile)
|
||||
if (!assetFile)
|
||||
return;
|
||||
|
||||
auto& stream = *mapEntsFile;
|
||||
auto& stream = *assetFile;
|
||||
stream.write(mapEnts->entityString, mapEnts->numEntityChars - 1);
|
||||
}
|
||||
} // namespace map_ents
|
||||
|
||||
Reference in New Issue
Block a user