From f0c8ffa6be2c42e7a89d33f74d0f17966c32c52c Mon Sep 17 00:00:00 2001 From: Jan Date: Sat, 17 Oct 2020 15:55:19 +0200 Subject: [PATCH] move contentloader classes to their respective game namespaces --- src/ZoneLoading/Game/IW4/ContentLoaderIW4.cpp | 88 ++++++------ src/ZoneLoading/Game/IW4/ContentLoaderIW4.h | 29 ++-- src/ZoneLoading/Game/T6/ContentLoaderT6.cpp | 134 +++++++++--------- src/ZoneLoading/Game/T6/ContentLoaderT6.h | 29 ++-- .../Game/T6/ZoneLoaderFactoryT6.cpp | 2 +- src/ZoneLoading/Loading/AssetLoader.h | 4 +- ...ontentLoader.cpp => ContentLoaderBase.cpp} | 12 +- .../{ContentLoader.h => ContentLoaderBase.h} | 6 +- 8 files changed, 155 insertions(+), 149 deletions(-) rename src/ZoneLoading/Loading/{ContentLoader.cpp => ContentLoaderBase.cpp} (68%) rename src/ZoneLoading/Loading/{ContentLoader.h => ContentLoaderBase.h} (79%) diff --git a/src/ZoneLoading/Game/IW4/ContentLoaderIW4.cpp b/src/ZoneLoading/Game/IW4/ContentLoaderIW4.cpp index 282727f3..ae69cc13 100644 --- a/src/ZoneLoading/Game/IW4/ContentLoaderIW4.cpp +++ b/src/ZoneLoading/Game/IW4/ContentLoaderIW4.cpp @@ -42,7 +42,7 @@ using namespace IW4; -ContentLoaderIW4::ContentLoaderIW4() +ContentLoader::ContentLoader() { varXAsset = nullptr; varScriptStringList = nullptr; @@ -51,7 +51,7 @@ ContentLoaderIW4::ContentLoaderIW4() m_script_strings.emplace_back(""); } -void ContentLoaderIW4::LoadScriptStringList(const bool atStreamStart) +void ContentLoader::LoadScriptStringList(const bool atStreamStart) { m_stream->PushBlock(XFILE_BLOCK_VIRTUAL); @@ -82,7 +82,7 @@ void ContentLoaderIW4::LoadScriptStringList(const bool atStreamStart) m_stream->PopBlock(); } -void ContentLoaderIW4::LoadXAsset(const bool atStreamStart) +void ContentLoader::LoadXAsset(const bool atStreamStart) { #define LOAD_ASSET(type_index, typeName, headerEntry) \ case type_index: \ @@ -102,43 +102,43 @@ void ContentLoaderIW4::LoadXAsset(const bool atStreamStart) switch (varXAsset->type) { - LOAD_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset); - LOAD_ASSET(ASSET_TYPE_PHYSCOLLMAP, PhysCollmap, physCollmap); - LOAD_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts); - LOAD_ASSET(ASSET_TYPE_XMODEL, XModel, model); - LOAD_ASSET(ASSET_TYPE_MATERIAL, Material, material); - LOAD_ASSET(ASSET_TYPE_PIXELSHADER, MaterialPixelShader, pixelShader); - LOAD_ASSET(ASSET_TYPE_VERTEXSHADER, MaterialVertexShader, vertexShader); - LOAD_ASSET(ASSET_TYPE_VERTEXDECL, MaterialVertexDeclaration, vertexDecl); - LOAD_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet); - LOAD_ASSET(ASSET_TYPE_IMAGE, GfxImage, image); - LOAD_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound); - LOAD_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve); - LOAD_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd); - LOAD_ASSET(ASSET_TYPE_CLIPMAP_SP, clipMap_t, clipMap); - LOAD_ASSET(ASSET_TYPE_CLIPMAP_MP, clipMap_t, clipMap); - LOAD_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld); - LOAD_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp); - LOAD_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp); - LOAD_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts); - LOAD_ASSET(ASSET_TYPE_FXWORLD, FxWorld, fxWorld); - LOAD_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld); - LOAD_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef); - LOAD_ASSET(ASSET_TYPE_FONT, Font_s, font); - LOAD_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList); - LOAD_ASSET(ASSET_TYPE_MENU, menuDef_t, menu); - LOAD_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize); - LOAD_ASSET(ASSET_TYPE_WEAPON, WeaponCompleteDef, weapon); - SKIP_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals); - LOAD_ASSET(ASSET_TYPE_FX, FxEffectDef, fx); - LOAD_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx); - LOAD_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile); - LOAD_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable); - LOAD_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef); - LOAD_ASSET(ASSET_TYPE_STRUCTURED_DATA_DEF, StructuredDataDefSet, structuredDataDefSet); - LOAD_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef); - LOAD_ASSET(ASSET_TYPE_VEHICLE, VehicleDef, vehDef); - LOAD_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts); + LOAD_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset) + LOAD_ASSET(ASSET_TYPE_PHYSCOLLMAP, PhysCollmap, physCollmap) + LOAD_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts) + LOAD_ASSET(ASSET_TYPE_XMODEL, XModel, model) + LOAD_ASSET(ASSET_TYPE_MATERIAL, Material, material) + LOAD_ASSET(ASSET_TYPE_PIXELSHADER, MaterialPixelShader, pixelShader) + LOAD_ASSET(ASSET_TYPE_VERTEXSHADER, MaterialVertexShader, vertexShader) + LOAD_ASSET(ASSET_TYPE_VERTEXDECL, MaterialVertexDeclaration, vertexDecl) + LOAD_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet) + LOAD_ASSET(ASSET_TYPE_IMAGE, GfxImage, image) + LOAD_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound) + LOAD_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve) + LOAD_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd) + LOAD_ASSET(ASSET_TYPE_CLIPMAP_SP, clipMap_t, clipMap) + LOAD_ASSET(ASSET_TYPE_CLIPMAP_MP, clipMap_t, clipMap) + LOAD_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld) + LOAD_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp) + LOAD_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp) + LOAD_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts) + LOAD_ASSET(ASSET_TYPE_FXWORLD, FxWorld, fxWorld) + LOAD_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld) + LOAD_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef) + LOAD_ASSET(ASSET_TYPE_FONT, Font_s, font) + LOAD_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList) + LOAD_ASSET(ASSET_TYPE_MENU, menuDef_t, menu) + LOAD_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize) + LOAD_ASSET(ASSET_TYPE_WEAPON, WeaponCompleteDef, weapon) + SKIP_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals) + LOAD_ASSET(ASSET_TYPE_FX, FxEffectDef, fx) + LOAD_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx) + LOAD_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile) + LOAD_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable) + LOAD_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef) + LOAD_ASSET(ASSET_TYPE_STRUCTURED_DATA_DEF, StructuredDataDefSet, structuredDataDefSet) + LOAD_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef) + LOAD_ASSET(ASSET_TYPE_VEHICLE, VehicleDef, vehDef) + LOAD_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts) default: { @@ -149,7 +149,7 @@ void ContentLoaderIW4::LoadXAsset(const bool atStreamStart) #undef LOAD_ASSET } -void ContentLoaderIW4::LoadXAssetArray(const bool atStreamStart, const size_t count) +void ContentLoader::LoadXAssetArray(const bool atStreamStart, const size_t count) { assert(varXAsset != nullptr); @@ -168,7 +168,7 @@ void ContentLoaderIW4::LoadXAssetArray(const bool atStreamStart, const size_t co } } -void ContentLoaderIW4::Load(Zone* zone, IZoneInputStream* stream) +void ContentLoader::Load(Zone* zone, IZoneInputStream* stream) { m_zone = zone; m_stream = stream; @@ -193,11 +193,11 @@ void ContentLoaderIW4::Load(Zone* zone, IZoneInputStream* stream) m_stream->PopBlock(); } -std::string& ContentLoaderIW4::GetZoneScriptString(const scr_string_t scrString) +std::string& ContentLoader::GetZoneScriptString(const scr_string_t scrString) { assert(scrString >= 0 && scrString < m_script_strings.size()); - if (scrString < 0 || scrString >= m_script_strings.size()) + if (scrString >= m_script_strings.size()) { return m_script_strings[0]; } diff --git a/src/ZoneLoading/Game/IW4/ContentLoaderIW4.h b/src/ZoneLoading/Game/IW4/ContentLoaderIW4.h index 5237c7c7..27483eea 100644 --- a/src/ZoneLoading/Game/IW4/ContentLoaderIW4.h +++ b/src/ZoneLoading/Game/IW4/ContentLoaderIW4.h @@ -1,23 +1,26 @@ #pragma once -#include "Loading/ContentLoader.h" +#include "Loading/ContentLoaderBase.h" #include "Loading/IContentLoadingEntryPoint.h" #include "Game/IW4/IW4.h" #include "Loading/IZoneScriptStringProvider.h" -class ContentLoaderIW4 final : public ContentLoader, public IContentLoadingEntryPoint, public IZoneScriptStringProvider +namespace IW4 { - std::vector m_script_strings; - IW4::XAsset* varXAsset; - IW4::ScriptStringList* varScriptStringList; + class ContentLoader final : public ContentLoaderBase, public IContentLoadingEntryPoint, public IZoneScriptStringProvider + { + std::vector m_script_strings; + XAsset* varXAsset; + ScriptStringList* varScriptStringList; - void LoadScriptStringList(bool atStreamStart); + void LoadScriptStringList(bool atStreamStart); - void LoadXAsset(bool atStreamStart); - void LoadXAssetArray(bool atStreamStart, size_t count); + void LoadXAsset(bool atStreamStart); + void LoadXAssetArray(bool atStreamStart, size_t count); -public: - ContentLoaderIW4(); + public: + ContentLoader(); - void Load(Zone* zone, IZoneInputStream* stream) override; - std::string& GetZoneScriptString(scr_string_t scrString) override; -}; + void Load(Zone* zone, IZoneInputStream* stream) override; + std::string& GetZoneScriptString(scr_string_t scrString) override; + }; +} diff --git a/src/ZoneLoading/Game/T6/ContentLoaderT6.cpp b/src/ZoneLoading/Game/T6/ContentLoaderT6.cpp index 24ee1e7c..aff6ad40 100644 --- a/src/ZoneLoading/Game/T6/ContentLoaderT6.cpp +++ b/src/ZoneLoading/Game/T6/ContentLoaderT6.cpp @@ -28,7 +28,7 @@ #include "Game/T6/XAssets/mapents/mapents_load_db.h" #include "Game/T6/XAssets/material/material_load_db.h" #include "Game/T6/XAssets/materialtechniqueset/materialtechniqueset_load_db.h" -#include "Game/T6/XAssets/memoryblock/memoryblock_load_db.h" +//#include "Game/T6/XAssets/memoryblock/memoryblock_load_db.h" #include "Game/T6/XAssets/menudef_t/menudef_t_load_db.h" #include "Game/T6/XAssets/menulist/menulist_load_db.h" #include "Game/T6/XAssets/physconstraints/physconstraints_load_db.h" @@ -55,7 +55,7 @@ using namespace T6; -ContentLoaderT6::ContentLoaderT6() +ContentLoader::ContentLoader() { varXAsset = nullptr; varScriptStringList = nullptr; @@ -64,14 +64,14 @@ ContentLoaderT6::ContentLoaderT6() m_script_strings.emplace_back(""); } -void ContentLoaderT6::LoadScriptStringList(const bool atStreamStart) +void ContentLoader::LoadScriptStringList(const bool atStreamStart) { m_stream->PushBlock(XFILE_BLOCK_VIRTUAL); if (atStreamStart) m_stream->Load(varScriptStringList); - if(varScriptStringList->strings != nullptr) + if (varScriptStringList->strings != nullptr) { assert(varScriptStringList->strings == PTR_FOLLOWING); @@ -79,9 +79,9 @@ void ContentLoaderT6::LoadScriptStringList(const bool atStreamStart) varXString = varScriptStringList->strings; LoadXStringArray(true, varScriptStringList->count); - for(int i = 0; i < varScriptStringList->count; i++) + for (int i = 0; i < varScriptStringList->count; i++) { - if(varScriptStringList->strings[i]) + if (varScriptStringList->strings[i]) { m_script_strings.emplace_back(varScriptStringList->strings[i]); } @@ -95,7 +95,7 @@ void ContentLoaderT6::LoadScriptStringList(const bool atStreamStart) m_stream->PopBlock(); } -void ContentLoaderT6::LoadXAsset(const bool atStreamStart) +void ContentLoader::LoadXAsset(const bool atStreamStart) { #define LOAD_ASSET(type_index, typeName, headerEntry) \ case type_index: \ @@ -107,60 +107,60 @@ void ContentLoaderT6::LoadXAsset(const bool atStreamStart) assert(varXAsset != nullptr); - if(atStreamStart) + if (atStreamStart) m_stream->Load(varXAsset); - switch(varXAsset->type) + switch (varXAsset->type) { - LOAD_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset); - LOAD_ASSET(ASSET_TYPE_PHYSCONSTRAINTS, PhysConstraints, physConstraints); - LOAD_ASSET(ASSET_TYPE_DESTRUCTIBLEDEF, DestructibleDef, destructibleDef); - LOAD_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts); - LOAD_ASSET(ASSET_TYPE_XMODEL, XModel, model); - LOAD_ASSET(ASSET_TYPE_MATERIAL, Material, material); - LOAD_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet); - LOAD_ASSET(ASSET_TYPE_IMAGE, GfxImage, image); - LOAD_ASSET(ASSET_TYPE_SOUND, SndBank, sound); - LOAD_ASSET(ASSET_TYPE_SOUND_PATCH, SndPatch, soundPatch); - LOAD_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap); - LOAD_ASSET(ASSET_TYPE_CLIPMAP_PVS, clipMap_t, clipMap); - LOAD_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld); - LOAD_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp); - LOAD_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp); - LOAD_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts); - LOAD_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld); - LOAD_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef); - LOAD_ASSET(ASSET_TYPE_FONT, Font_s, font); - LOAD_ASSET(ASSET_TYPE_FONTICON, FontIcon, fontIcon); - LOAD_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList); - LOAD_ASSET(ASSET_TYPE_MENU, menuDef_t, menu); - LOAD_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize); - LOAD_ASSET(ASSET_TYPE_WEAPON, WeaponVariantDef, weapon); - LOAD_ASSET(ASSET_TYPE_ATTACHMENT, WeaponAttachment, attachment); - LOAD_ASSET(ASSET_TYPE_ATTACHMENT_UNIQUE, WeaponAttachmentUnique, attachmentUnique); - LOAD_ASSET(ASSET_TYPE_WEAPON_CAMO, WeaponCamo, weaponCamo); - LOAD_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals); - LOAD_ASSET(ASSET_TYPE_FX, FxEffectDef, fx); - LOAD_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx); - LOAD_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile); - LOAD_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable); - LOAD_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef); - LOAD_ASSET(ASSET_TYPE_XGLOBALS, XGlobals, xGlobals); - LOAD_ASSET(ASSET_TYPE_DDL, ddlRoot_t, ddlRoot); - LOAD_ASSET(ASSET_TYPE_GLASSES, Glasses, glasses); - LOAD_ASSET(ASSET_TYPE_EMBLEMSET, EmblemSet, emblemSet); - LOAD_ASSET(ASSET_TYPE_SCRIPTPARSETREE, ScriptParseTree, scriptParseTree); - LOAD_ASSET(ASSET_TYPE_KEYVALUEPAIRS, KeyValuePairs, keyValuePairs); - LOAD_ASSET(ASSET_TYPE_VEHICLEDEF, VehicleDef, vehicleDef); + LOAD_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset) + LOAD_ASSET(ASSET_TYPE_PHYSCONSTRAINTS, PhysConstraints, physConstraints) + LOAD_ASSET(ASSET_TYPE_DESTRUCTIBLEDEF, DestructibleDef, destructibleDef) + LOAD_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts) + LOAD_ASSET(ASSET_TYPE_XMODEL, XModel, model) + LOAD_ASSET(ASSET_TYPE_MATERIAL, Material, material) + LOAD_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet) + LOAD_ASSET(ASSET_TYPE_IMAGE, GfxImage, image) + LOAD_ASSET(ASSET_TYPE_SOUND, SndBank, sound) + LOAD_ASSET(ASSET_TYPE_SOUND_PATCH, SndPatch, soundPatch) + LOAD_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap) + LOAD_ASSET(ASSET_TYPE_CLIPMAP_PVS, clipMap_t, clipMap) + LOAD_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld) + LOAD_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp) + LOAD_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp) + LOAD_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts) + LOAD_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld) + LOAD_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef) + LOAD_ASSET(ASSET_TYPE_FONT, Font_s, font) + LOAD_ASSET(ASSET_TYPE_FONTICON, FontIcon, fontIcon) + LOAD_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList) + LOAD_ASSET(ASSET_TYPE_MENU, menuDef_t, menu) + LOAD_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize) + LOAD_ASSET(ASSET_TYPE_WEAPON, WeaponVariantDef, weapon) + LOAD_ASSET(ASSET_TYPE_ATTACHMENT, WeaponAttachment, attachment) + LOAD_ASSET(ASSET_TYPE_ATTACHMENT_UNIQUE, WeaponAttachmentUnique, attachmentUnique) + LOAD_ASSET(ASSET_TYPE_WEAPON_CAMO, WeaponCamo, weaponCamo) + LOAD_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals) + LOAD_ASSET(ASSET_TYPE_FX, FxEffectDef, fx) + LOAD_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx) + LOAD_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile) + LOAD_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable) + LOAD_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef) + LOAD_ASSET(ASSET_TYPE_XGLOBALS, XGlobals, xGlobals) + LOAD_ASSET(ASSET_TYPE_DDL, ddlRoot_t, ddlRoot) + LOAD_ASSET(ASSET_TYPE_GLASSES, Glasses, glasses) + LOAD_ASSET(ASSET_TYPE_EMBLEMSET, EmblemSet, emblemSet) + LOAD_ASSET(ASSET_TYPE_SCRIPTPARSETREE, ScriptParseTree, scriptParseTree) + LOAD_ASSET(ASSET_TYPE_KEYVALUEPAIRS, KeyValuePairs, keyValuePairs) + LOAD_ASSET(ASSET_TYPE_VEHICLEDEF, VehicleDef, vehicleDef) // LOAD_ASSET(ASSET_TYPE_MEMORYBLOCK, MemoryBlock, memoryBlock); - LOAD_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts); - LOAD_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef); - LOAD_ASSET(ASSET_TYPE_SKINNEDVERTS, SkinnedVertsDef, skinnedVertsDef); - LOAD_ASSET(ASSET_TYPE_QDB, Qdb, qdb); - LOAD_ASSET(ASSET_TYPE_SLUG, Slug, slug); - LOAD_ASSET(ASSET_TYPE_FOOTSTEP_TABLE, FootstepTableDef, footstepTableDef); - LOAD_ASSET(ASSET_TYPE_FOOTSTEPFX_TABLE, FootstepFXTableDef, footstepFXTableDef); - LOAD_ASSET(ASSET_TYPE_ZBARRIER, ZBarrierDef, zbarrierDef); + LOAD_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts) + LOAD_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef) + LOAD_ASSET(ASSET_TYPE_SKINNEDVERTS, SkinnedVertsDef, skinnedVertsDef) + LOAD_ASSET(ASSET_TYPE_QDB, Qdb, qdb) + LOAD_ASSET(ASSET_TYPE_SLUG, Slug, slug) + LOAD_ASSET(ASSET_TYPE_FOOTSTEP_TABLE, FootstepTableDef, footstepTableDef) + LOAD_ASSET(ASSET_TYPE_FOOTSTEPFX_TABLE, FootstepFXTableDef, footstepFXTableDef) + LOAD_ASSET(ASSET_TYPE_ZBARRIER, ZBarrierDef, zbarrierDef) default: { @@ -171,26 +171,26 @@ void ContentLoaderT6::LoadXAsset(const bool atStreamStart) #undef LOAD_ASSET } -void ContentLoaderT6::LoadXAssetArray(const bool atStreamStart, const size_t count) +void ContentLoader::LoadXAssetArray(const bool atStreamStart, const size_t count) { assert(varXAsset != nullptr); - if(atStreamStart) + if (atStreamStart) m_stream->Load(varXAsset, count); - for(asset_type_t assetType = 0; assetType < ASSET_TYPE_COUNT; assetType++) + for (asset_type_t assetType = 0; assetType < ASSET_TYPE_COUNT; assetType++) { m_zone->GetPools()->InitPoolDynamic(assetType); } - for(size_t index = 0; index < count; index++) + for (size_t index = 0; index < count; index++) { LoadXAsset(false); varXAsset++; } } -void ContentLoaderT6::Load(Zone* zone, IZoneInputStream* stream) +void ContentLoader::Load(Zone* zone, IZoneInputStream* stream) { m_zone = zone; m_stream = stream; @@ -203,7 +203,7 @@ void ContentLoaderT6::Load(Zone* zone, IZoneInputStream* stream) varScriptStringList = &assetList.stringList; LoadScriptStringList(false); - if(assetList.depends != nullptr) + if (assetList.depends != nullptr) { assert(assetList.depends == PTR_FOLLOWING); @@ -212,7 +212,7 @@ void ContentLoaderT6::Load(Zone* zone, IZoneInputStream* stream) LoadXStringArray(true, assetList.dependCount); } - if(assetList.assets != nullptr) + if (assetList.assets != nullptr) { assert(assetList.assets == PTR_FOLLOWING); @@ -224,14 +224,14 @@ void ContentLoaderT6::Load(Zone* zone, IZoneInputStream* stream) m_stream->PopBlock(); } -std::string& ContentLoaderT6::GetZoneScriptString(const scr_string_t scrString) +std::string& ContentLoader::GetZoneScriptString(const scr_string_t scrString) { assert(scrString >= 0 && scrString < m_script_strings.size()); - if(scrString < 0 || scrString >= m_script_strings.size()) + if (scrString >= m_script_strings.size()) { return m_script_strings[0]; } return m_script_strings[scrString]; -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Game/T6/ContentLoaderT6.h b/src/ZoneLoading/Game/T6/ContentLoaderT6.h index 0797c64e..2f3437fd 100644 --- a/src/ZoneLoading/Game/T6/ContentLoaderT6.h +++ b/src/ZoneLoading/Game/T6/ContentLoaderT6.h @@ -1,23 +1,26 @@ #pragma once -#include "Loading/ContentLoader.h" +#include "Loading/ContentLoaderBase.h" #include "Loading/IContentLoadingEntryPoint.h" #include "Game/T6/T6.h" #include "Loading/IZoneScriptStringProvider.h" -class ContentLoaderT6 final : public ContentLoader, public IContentLoadingEntryPoint, public IZoneScriptStringProvider +namespace T6 { - std::vector m_script_strings; - T6::XAsset* varXAsset; - T6::ScriptStringList* varScriptStringList; + class ContentLoader final : public ContentLoaderBase, public IContentLoadingEntryPoint, public IZoneScriptStringProvider + { + std::vector m_script_strings; + XAsset* varXAsset; + ScriptStringList* varScriptStringList; - void LoadScriptStringList(bool atStreamStart); + void LoadScriptStringList(bool atStreamStart); - void LoadXAsset(bool atStreamStart); - void LoadXAssetArray(bool atStreamStart, size_t count); + void LoadXAsset(bool atStreamStart); + void LoadXAssetArray(bool atStreamStart, size_t count); -public: - ContentLoaderT6(); + public: + ContentLoader(); - void Load(Zone* zone, IZoneInputStream* stream) override; - std::string& GetZoneScriptString(scr_string_t scrString) override; -}; + void Load(Zone* zone, IZoneInputStream* stream) override; + std::string& GetZoneScriptString(scr_string_t scrString) override; + }; +} diff --git a/src/ZoneLoading/Game/T6/ZoneLoaderFactoryT6.cpp b/src/ZoneLoading/Game/T6/ZoneLoaderFactoryT6.cpp index 0e7f88b0..5645ce82 100644 --- a/src/ZoneLoading/Game/T6/ZoneLoaderFactoryT6.cpp +++ b/src/ZoneLoading/Game/T6/ZoneLoaderFactoryT6.cpp @@ -16,7 +16,7 @@ #include "Utils/ClassUtils.h" #include #include "Loading/Steps/StepLoadZoneContent.h" -#include "ContentLoaderT6.h" +#include "ContentLoader.h" #include "Game/T6/GameAssetPoolT6.h" #include "Game/T6/GameT6.h" #include "Game/GameLanguage.h" diff --git a/src/ZoneLoading/Loading/AssetLoader.h b/src/ZoneLoading/Loading/AssetLoader.h index 300bb12f..df9b70bf 100644 --- a/src/ZoneLoading/Loading/AssetLoader.h +++ b/src/ZoneLoading/Loading/AssetLoader.h @@ -1,9 +1,9 @@ #pragma once #include "Pool/XAssetInfo.h" -#include "ContentLoader.h" +#include "ContentLoaderBase.h" #include "IZoneScriptStringProvider.h" -class AssetLoader : public ContentLoader +class AssetLoader : public ContentLoaderBase { asset_type_t m_asset_type; diff --git a/src/ZoneLoading/Loading/ContentLoader.cpp b/src/ZoneLoading/Loading/ContentLoaderBase.cpp similarity index 68% rename from src/ZoneLoading/Loading/ContentLoader.cpp rename to src/ZoneLoading/Loading/ContentLoaderBase.cpp index 2dec8a45..f67342b0 100644 --- a/src/ZoneLoading/Loading/ContentLoader.cpp +++ b/src/ZoneLoading/Loading/ContentLoaderBase.cpp @@ -1,10 +1,10 @@ -#include "ContentLoader.h" +#include "ContentLoaderBase.h" #include -const void* ContentLoader::PTR_FOLLOWING = reinterpret_cast(-1); -const void* ContentLoader::PTR_INSERT = reinterpret_cast(-2); +const void* ContentLoaderBase::PTR_FOLLOWING = reinterpret_cast(-1); +const void* ContentLoaderBase::PTR_INSERT = reinterpret_cast(-2); -ContentLoader::ContentLoader() +ContentLoaderBase::ContentLoaderBase() { varXString = nullptr; @@ -12,7 +12,7 @@ ContentLoader::ContentLoader() m_stream = nullptr; } -void ContentLoader::LoadXString(const bool atStreamStart) const +void ContentLoaderBase::LoadXString(const bool atStreamStart) const { assert(varXString != nullptr); @@ -33,7 +33,7 @@ void ContentLoader::LoadXString(const bool atStreamStart) const } } -void ContentLoader::LoadXStringArray(const bool atStreamStart, const size_t count) +void ContentLoaderBase::LoadXStringArray(const bool atStreamStart, const size_t count) { assert(varXString != nullptr); diff --git a/src/ZoneLoading/Loading/ContentLoader.h b/src/ZoneLoading/Loading/ContentLoaderBase.h similarity index 79% rename from src/ZoneLoading/Loading/ContentLoader.h rename to src/ZoneLoading/Loading/ContentLoaderBase.h index 3977bca0..5014fb78 100644 --- a/src/ZoneLoading/Loading/ContentLoader.h +++ b/src/ZoneLoading/Loading/ContentLoaderBase.h @@ -3,7 +3,7 @@ #include "Zone/Zone.h" #include "Zone/Stream/IZoneInputStream.h" -class ContentLoader +class ContentLoaderBase { protected: static const void* PTR_FOLLOWING; @@ -14,11 +14,11 @@ protected: Zone* m_zone; IZoneInputStream* m_stream; - ContentLoader(); + ContentLoaderBase(); void LoadXString(bool atStreamStart) const; void LoadXStringArray(bool atStreamStart, size_t count); public: - virtual ~ContentLoader() = default; + virtual ~ContentLoaderBase() = default; };