mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-09-01 22:47:26 +00:00
refactor: streamline map assets dumper
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
#include "AssetDumperMapEnts.h"
|
||||
|
||||
using namespace IW3;
|
||||
|
||||
bool AssetDumperMapEnts::ShouldDump(XAssetInfo<MapEnts>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void AssetDumperMapEnts::DumpAsset(AssetDumpingContext& context, XAssetInfo<MapEnts>* asset)
|
||||
{
|
||||
const auto* mapEnts = asset->Asset();
|
||||
const auto assetFile = context.OpenAssetFile(asset->m_name + ".ents");
|
||||
|
||||
if (!assetFile)
|
||||
return;
|
||||
|
||||
auto& stream = *assetFile;
|
||||
stream.write(mapEnts->entityString, mapEnts->numEntityChars);
|
||||
}
|
23
src/ObjWriting/Game/IW3/Maps/MapEntsDumperIW3.cpp
Normal file
23
src/ObjWriting/Game/IW3/Maps/MapEntsDumperIW3.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "MapEntsDumperIW3.h"
|
||||
|
||||
using namespace IW3;
|
||||
|
||||
namespace IW3::map_ents
|
||||
{
|
||||
bool Dumper::ShouldDump(XAssetInfo<MapEnts>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void Dumper::DumpAsset(AssetDumpingContext& context, XAssetInfo<MapEnts>* asset)
|
||||
{
|
||||
const auto* mapEnts = asset->Asset();
|
||||
const auto assetFile = context.OpenAssetFile(asset->m_name + ".ents");
|
||||
|
||||
if (!assetFile)
|
||||
return;
|
||||
|
||||
auto& stream = *assetFile;
|
||||
stream.write(mapEnts->entityString, mapEnts->numEntityChars);
|
||||
}
|
||||
} // namespace IW3::map_ents
|
@@ -3,12 +3,12 @@
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/IW3/IW3.h"
|
||||
|
||||
namespace IW3
|
||||
namespace IW3::map_ents
|
||||
{
|
||||
class AssetDumperMapEnts final : public AbstractAssetDumper<MapEnts>
|
||||
class Dumper final : public AbstractAssetDumper<MapEnts>
|
||||
{
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<MapEnts>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<MapEnts>* asset) override;
|
||||
};
|
||||
} // namespace IW3
|
||||
} // namespace IW3::map_ents
|
@@ -4,7 +4,7 @@
|
||||
#include "Game/IW3/XModel/XModelDumperIW3.h"
|
||||
#include "Image/ImageDumperIW3.h"
|
||||
#include "Localize/LocalizeDumperIW3.h"
|
||||
#include "Maps/AssetDumperMapEnts.h"
|
||||
#include "Maps/MapEntsDumperIW3.h"
|
||||
#include "Material/DumperMaterialIW3.h"
|
||||
#include "ObjWriting.h"
|
||||
#include "RawFile/AssetDumperRawFile.h"
|
||||
@@ -38,7 +38,7 @@ bool ObjWriter::DumpZone(AssetDumpingContext& context) const
|
||||
// DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world, ASSET_TYPE_COMWORLD)
|
||||
// DUMP_ASSET_POOL(AssetDumperGameWorldSp, m_game_world_sp, ASSET_TYPE_GAMEWORLD_SP)
|
||||
// DUMP_ASSET_POOL(AssetDumperGameWorldMp, m_game_world_mp, ASSET_TYPE_GAMEWORLD_MP)
|
||||
DUMP_ASSET_POOL(AssetDumperMapEnts, m_map_ents, ASSET_TYPE_MAP_ENTS)
|
||||
DUMP_ASSET_POOL(map_ents::Dumper, m_map_ents, ASSET_TYPE_MAP_ENTS)
|
||||
// DUMP_ASSET_POOL(AssetDumperGfxWorld, m_gfx_world, ASSET_TYPE_GFXWORLD)
|
||||
// DUMP_ASSET_POOL(AssetDumperGfxLightDef, m_gfx_light_def, ASSET_TYPE_LIGHT_DEF)
|
||||
// DUMP_ASSET_POOL(AssetDumperFont_s, m_font, ASSET_TYPE_FONT)
|
||||
|
Reference in New Issue
Block a user