From fc336a1019d8c49be3fac900b7bdb56e20937516 Mon Sep 17 00:00:00 2001 From: Jan Date: Sun, 18 Oct 2020 17:41:52 +0200 Subject: [PATCH] Add dumping of iw4 addonmapents --- .../AssetDumpers/AssetDumperAddonMapEnts.cpp | 19 +++++ .../AssetDumpers/AssetDumperAddonMapEnts.h | 15 ++++ src/ObjWriting/Game/IW4/ZoneDumperIW4.cpp | 71 ++++++++++--------- 3 files changed, 70 insertions(+), 35 deletions(-) create mode 100644 src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperAddonMapEnts.cpp create mode 100644 src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperAddonMapEnts.h diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperAddonMapEnts.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperAddonMapEnts.cpp new file mode 100644 index 00000000..f912cd92 --- /dev/null +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperAddonMapEnts.cpp @@ -0,0 +1,19 @@ +#define NOMINMAX +#include "AssetDumperAddonMapEnts.h" + +using namespace IW4; + +bool AssetDumperAddonMapEnts::ShouldDump(AddonMapEnts* asset) +{ + return true; +} + +std::string AssetDumperAddonMapEnts::GetFileNameForAsset(Zone* zone, AddonMapEnts* asset) +{ + return std::string(asset->name); +} + +void AssetDumperAddonMapEnts::DumpAsset(Zone* zone, AddonMapEnts* asset, FileAPI::File* out) +{ + out->Write(asset->entityString, 1, std::max(asset->numEntityChars - 1, 0)); +} diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperAddonMapEnts.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperAddonMapEnts.h new file mode 100644 index 00000000..b51021e6 --- /dev/null +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperAddonMapEnts.h @@ -0,0 +1,15 @@ +#pragma once + +#include "Dumping/AbstractAssetDumper.h" +#include "Game/IW4/IW4.h" + +namespace IW4 +{ + class AssetDumperAddonMapEnts final : public AbstractAssetDumper + { + protected: + bool ShouldDump(AddonMapEnts* asset) override; + std::string GetFileNameForAsset(Zone* zone, AddonMapEnts* asset) override; + void DumpAsset(Zone* zone, AddonMapEnts* asset, FileAPI::File* out) override; + }; +} diff --git a/src/ObjWriting/Game/IW4/ZoneDumperIW4.cpp b/src/ObjWriting/Game/IW4/ZoneDumperIW4.cpp index 473073b3..46565cbf 100644 --- a/src/ObjWriting/Game/IW4/ZoneDumperIW4.cpp +++ b/src/ObjWriting/Game/IW4/ZoneDumperIW4.cpp @@ -7,6 +7,7 @@ #include "AssetDumpers/AssetDumperStringTable.h" #include "AssetDumpers/AssetDumperLocalizeEntry.h" #include "AssetDumpers/AssetDumperGfxImage.h" +#include "AssetDumpers/AssetDumperAddonMapEnts.h" #include "AssetDumpers/AssetDumperLoadedSound.h" using namespace IW4; @@ -27,42 +28,42 @@ bool ZoneDumper::DumpZone(Zone* zone, const std::string& basePath) const const auto* assetPools = dynamic_cast(zone->GetPools()); - // DUMP_ASSET_POOL(AssetDumperPhysPreset, m_phys_preset); - // DUMP_ASSET_POOL(AssetDumperPhysCollmap, m_phys_collmap); - // DUMP_ASSET_POOL(AssetDumperXAnimParts, m_xanim_parts); - // DUMP_ASSET_POOL(AssetDumperXModel, m_xmodel); - // DUMP_ASSET_POOL(AssetDumperMaterial, m_material); - // DUMP_ASSET_POOL(AssetDumperMaterialPixelShader, m_material_pixel_shader); - // DUMP_ASSET_POOL(AssetDumperMaterialVertexShader, m_material_vertex_shader); - // DUMP_ASSET_POOL(AssetDumperMaterialVertexDeclaration, m_material_vertex_decl); - // DUMP_ASSET_POOL(AssetDumperMaterialTechniqueSet, m_technique_set); - DUMP_ASSET_POOL(AssetDumperGfxImage, m_image); - // DUMP_ASSET_POOL(AssetDumpersnd_alias_list_t, m_sound); - // DUMP_ASSET_POOL(AssetDumperSndCurve, m_sound_curve); - // DUMP_ASSET_POOL(AssetDumperclipMap_t, m_clip_map); - // DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world); - // DUMP_ASSET_POOL(AssetDumperGameWorldSp, m_game_world_sp); - // DUMP_ASSET_POOL(AssetDumperGameWorldMp, m_game_world_mp); - // DUMP_ASSET_POOL(AssetDumperMapEnts, m_map_ents); - // DUMP_ASSET_POOL(AssetDumperFxWorld, m_fx_world); - // DUMP_ASSET_POOL(AssetDumperGfxWorld, m_gfx_world); - // DUMP_ASSET_POOL(AssetDumperGfxLightDef, m_gfx_light_def); - // DUMP_ASSET_POOL(AssetDumperFont_s, m_font); - // DUMP_ASSET_POOL(AssetDumperMenuList, m_menu_list); - // DUMP_ASSET_POOL(AssetDumpermenuDef_t, m_menu_def); - DUMP_ASSET_POOL(AssetDumperLocalizeEntry, m_localize); - // DUMP_ASSET_POOL(AssetDumperWeaponCompleteDef, m_weapon); - // DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals); - // DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx); - // DUMP_ASSET_POOL(AssetDumperFxImpactTable, m_fx_impact_table); - DUMP_ASSET_POOL(AssetDumperRawFile, m_raw_file); - DUMP_ASSET_POOL(AssetDumperStringTable, m_string_table); - // DUMP_ASSET_POOL(AssetDumperLeaderboardDef, m_leaderboard); - // DUMP_ASSET_POOL(AssetDumperStructuredDataDefSet, m_structed_data_def_set); - // DUMP_ASSET_POOL(AssetDumperTracerDef, m_tracer); - // DUMP_ASSET_POOL(AssetDumperVehicleDef, m_vehicle); - // DUMP_ASSET_POOL(AssetDumperAddonMapEnts, m_addon_map_ents); + // DUMP_ASSET_POOL(AssetDumperPhysPreset, m_phys_preset) + // DUMP_ASSET_POOL(AssetDumperPhysCollmap, m_phys_collmap) + // DUMP_ASSET_POOL(AssetDumperXAnimParts, m_xanim_parts) + // DUMP_ASSET_POOL(AssetDumperXModel, m_xmodel) + // DUMP_ASSET_POOL(AssetDumperMaterial, m_material) + // DUMP_ASSET_POOL(AssetDumperMaterialPixelShader, m_material_pixel_shader) + // DUMP_ASSET_POOL(AssetDumperMaterialVertexShader, m_material_vertex_shader) + // DUMP_ASSET_POOL(AssetDumperMaterialVertexDeclaration, m_material_vertex_decl) + // DUMP_ASSET_POOL(AssetDumperMaterialTechniqueSet, m_technique_set) + DUMP_ASSET_POOL(AssetDumperGfxImage, m_image) + // DUMP_ASSET_POOL(AssetDumpersnd_alias_list_t, m_sound) + // DUMP_ASSET_POOL(AssetDumperSndCurve, m_sound_curve) DUMP_ASSET_POOL(AssetDumperLoadedSound, m_loaded_sound) + // DUMP_ASSET_POOL(AssetDumperclipMap_t, m_clip_map) + // DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world) + // DUMP_ASSET_POOL(AssetDumperGameWorldSp, m_game_world_sp) + // DUMP_ASSET_POOL(AssetDumperGameWorldMp, m_game_world_mp) + // DUMP_ASSET_POOL(AssetDumperMapEnts, m_map_ents) + // DUMP_ASSET_POOL(AssetDumperFxWorld, m_fx_world) + // DUMP_ASSET_POOL(AssetDumperGfxWorld, m_gfx_world) + // DUMP_ASSET_POOL(AssetDumperGfxLightDef, m_gfx_light_def) + // DUMP_ASSET_POOL(AssetDumperFont_s, m_font) + // DUMP_ASSET_POOL(AssetDumperMenuList, m_menu_list) + // DUMP_ASSET_POOL(AssetDumpermenuDef_t, m_menu_def) + DUMP_ASSET_POOL(AssetDumperLocalizeEntry, m_localize) + // DUMP_ASSET_POOL(AssetDumperWeaponCompleteDef, m_weapon) + // DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals) + // DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx) + // DUMP_ASSET_POOL(AssetDumperFxImpactTable, m_fx_impact_table) + DUMP_ASSET_POOL(AssetDumperRawFile, m_raw_file) + DUMP_ASSET_POOL(AssetDumperStringTable, m_string_table) + // DUMP_ASSET_POOL(AssetDumperLeaderboardDef, m_leaderboard) + // DUMP_ASSET_POOL(AssetDumperStructuredDataDefSet, m_structed_data_def_set) + // DUMP_ASSET_POOL(AssetDumperTracerDef, m_tracer) + // DUMP_ASSET_POOL(AssetDumperVehicleDef, m_vehicle) + DUMP_ASSET_POOL(AssetDumperAddonMapEnts, m_addon_map_ents) return true;