mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-07-26 18:00:38 +00:00
feat: templated MapEnts dumper (#923)
Relates to https://github.com/Laupetin/OpenAssetTools/issues/626
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#options GAME (IW3, IW4, IW5, T4, T5, T6)
|
||||
|
||||
#filename "Game/" + GAME + "/Maps/MapEntsDumper" + GAME + ".cpp"
|
||||
|
||||
// This file was templated.
|
||||
// See MapEntsDumper.cpp.template.
|
||||
// Do not modify, changes will be lost.
|
||||
|
||||
#set DUMPER_HEADER "\"MapEntsDumper" + GAME + ".h\""
|
||||
#include DUMPER_HEADER
|
||||
|
||||
#include "Maps/MapEntsCommon.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using namespace GAME;
|
||||
|
||||
#set CLASS_NAME "Dumper" + GAME
|
||||
|
||||
namespace map_ents
|
||||
{
|
||||
void CLASS_NAME::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetMapEnts::Type>& 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, std::max(mapEnts->numEntityChars - 1, 0));
|
||||
}
|
||||
} // namespace map_ents
|
||||
@@ -0,0 +1,24 @@
|
||||
#options GAME (IW3, IW4, IW5, T4, T5, T6)
|
||||
|
||||
#filename "Game/" + GAME + "/Maps/MapEntsDumper" + GAME + ".h"
|
||||
|
||||
#set GAME_HEADER "\"Game/" + GAME + "/" + GAME + ".h\""
|
||||
#set CLASS_NAME "Dumper" + GAME
|
||||
|
||||
// This file was templated.
|
||||
// See MapEntsDumper.h.template.
|
||||
// Do not modify, changes will be lost.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include GAME_HEADER
|
||||
|
||||
namespace map_ents
|
||||
{
|
||||
class CLASS_NAME final : public AbstractAssetDumper<GAME::AssetMapEnts>
|
||||
{
|
||||
protected:
|
||||
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<GAME::AssetMapEnts::Type>& asset) override;
|
||||
};
|
||||
} // namespace map_ents
|
||||
Reference in New Issue
Block a user