mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-11 07:18:11 -05:00
ZoneCommon: List zone content in the order it was loaded
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
#pragma once
|
||||
#include "Zone/Zone.h"
|
||||
#include "GameLanguage.h"
|
||||
#include <vector>
|
||||
|
||||
@ -8,6 +7,7 @@ class Zone;
|
||||
class IGame
|
||||
{
|
||||
public:
|
||||
virtual const std::string& GetName() = 0;
|
||||
virtual void AddZone(Zone* zone) = 0;
|
||||
virtual void RemoveZone(Zone* zone) = 0;
|
||||
virtual std::vector<Zone*> GetZones() = 0;
|
||||
|
@ -5,8 +5,75 @@
|
||||
|
||||
using namespace T6;
|
||||
|
||||
const std::string GameAssetPoolT6::ASSET_TYPE_INVALID = "invalid_asset";
|
||||
const std::string GameAssetPoolT6::ASSET_TYPE_NAMES[]
|
||||
{
|
||||
"xmodelpieces",
|
||||
"physpreset",
|
||||
"physconstraints",
|
||||
"destructibledef",
|
||||
"xanim",
|
||||
"xmodel",
|
||||
"material",
|
||||
"techniqueset",
|
||||
"image",
|
||||
"soundbank",
|
||||
"soundpatch",
|
||||
"clipmap",
|
||||
"clipmap",
|
||||
"comworld",
|
||||
"gameworldsp",
|
||||
"gameworldmp",
|
||||
"mapents",
|
||||
"gfxworld",
|
||||
"gfxlightdef",
|
||||
"uimap",
|
||||
"font",
|
||||
"fonticon",
|
||||
"menulist",
|
||||
"menu",
|
||||
"localize",
|
||||
"weapon",
|
||||
"weapondef",
|
||||
"weaponvariant",
|
||||
"weaponfull",
|
||||
"attachment",
|
||||
"attachmentunique",
|
||||
"camo",
|
||||
"snddriverglobals",
|
||||
"fx",
|
||||
"fximpacttable",
|
||||
"aitype",
|
||||
"mptype",
|
||||
"mpbody",
|
||||
"mphead",
|
||||
"character",
|
||||
"xmodelalias",
|
||||
"rawfile",
|
||||
"stringtable",
|
||||
"leaderboard",
|
||||
"xglobals",
|
||||
"ddl",
|
||||
"glasses",
|
||||
"emblemset",
|
||||
"script",
|
||||
"keyvaluepairs",
|
||||
"vehicle",
|
||||
"memoryblock",
|
||||
"addonmapents",
|
||||
"tracer",
|
||||
"skinnedverts",
|
||||
"qdb",
|
||||
"slug",
|
||||
"footsteptable",
|
||||
"footstepfxtable",
|
||||
"zbarrier"
|
||||
};
|
||||
|
||||
GameAssetPoolT6::GameAssetPoolT6(const int priority)
|
||||
{
|
||||
assert(_countof(ASSET_TYPE_NAMES) == ASSET_TYPE_COUNT);
|
||||
|
||||
m_priority = priority;
|
||||
|
||||
m_phys_preset = nullptr;
|
||||
@ -271,7 +338,12 @@ XAssetInfoGeneric* GameAssetPoolT6::AddAsset(asset_type_t type, std::string name
|
||||
case assetType: \
|
||||
{ \
|
||||
assert((poolName) != nullptr); \
|
||||
return (poolName)->AddAsset(std::move(name), xAsset.header.headerName, scriptStrings, dependencies); \
|
||||
auto* assetInfo = (poolName)->AddAsset(std::move(name), xAsset.header.headerName, scriptStrings, dependencies); \
|
||||
if(assetInfo) \
|
||||
{ \
|
||||
m_assets_in_order.push_back(assetInfo); \
|
||||
} \
|
||||
return assetInfo; \
|
||||
}
|
||||
|
||||
switch(xAsset.type)
|
||||
@ -336,7 +408,7 @@ XAssetInfoGeneric* GameAssetPoolT6::AddAsset(asset_type_t type, std::string name
|
||||
#undef CASE_ADD_TO_POOL
|
||||
}
|
||||
|
||||
XAssetInfoGeneric* GameAssetPoolT6::GetAsset(const asset_type_t type, std::string name)
|
||||
XAssetInfoGeneric* GameAssetPoolT6::GetAsset(const asset_type_t type, std::string name) const
|
||||
{
|
||||
#define CASE_GET_ASSET(assetType, poolName) \
|
||||
case assetType: \
|
||||
@ -408,71 +480,20 @@ XAssetInfoGeneric* GameAssetPoolT6::GetAsset(const asset_type_t type, std::strin
|
||||
#undef CASE_GET_ASSET
|
||||
}
|
||||
|
||||
ZoneContent GameAssetPoolT6::GetContent() const
|
||||
const std::string& GameAssetPoolT6::GetAssetTypeName(const asset_type_t assetType) const
|
||||
{
|
||||
ZoneContent content{};
|
||||
if (assetType >= 0 && assetType < static_cast<int>(_countof(ASSET_TYPE_NAMES)))
|
||||
return ASSET_TYPE_NAMES[assetType];
|
||||
|
||||
content.m_game_name = "T6";
|
||||
|
||||
#define POOL_ADD_TO_CONTENT(assetTypeName, poolName) \
|
||||
if((poolName) != nullptr) \
|
||||
{ \
|
||||
for(auto asset : *(poolName)) \
|
||||
{ \
|
||||
content.m_assets.emplace_back((assetTypeName), asset->m_name);\
|
||||
} \
|
||||
}
|
||||
|
||||
POOL_ADD_TO_CONTENT("physpreset", m_phys_preset);
|
||||
POOL_ADD_TO_CONTENT("physconstraints", m_phys_constraints);
|
||||
POOL_ADD_TO_CONTENT("destructibledef", m_destructible_def);
|
||||
POOL_ADD_TO_CONTENT("xanim", m_xanim_parts);
|
||||
POOL_ADD_TO_CONTENT("xmodel", m_xmodel);
|
||||
POOL_ADD_TO_CONTENT("material", m_material);
|
||||
POOL_ADD_TO_CONTENT("techniqueset", m_technique_set);
|
||||
POOL_ADD_TO_CONTENT("image", m_image);
|
||||
POOL_ADD_TO_CONTENT("soundbank", m_sound_bank);
|
||||
POOL_ADD_TO_CONTENT("soundpatch", m_sound_patch);
|
||||
POOL_ADD_TO_CONTENT("clipmap", m_clip_map);
|
||||
POOL_ADD_TO_CONTENT("comworld", m_com_world);
|
||||
POOL_ADD_TO_CONTENT("gameworldsp", m_game_world_sp);
|
||||
POOL_ADD_TO_CONTENT("gameworldmp", m_game_world_mp);
|
||||
POOL_ADD_TO_CONTENT("mapents", m_map_ents);
|
||||
POOL_ADD_TO_CONTENT("gfxworld", m_gfx_world);
|
||||
POOL_ADD_TO_CONTENT("gfxlightdef", m_gfx_light_def);
|
||||
POOL_ADD_TO_CONTENT("font", m_font);
|
||||
POOL_ADD_TO_CONTENT("fonticon", m_font_icon);
|
||||
POOL_ADD_TO_CONTENT("menulist", m_menu_list);
|
||||
POOL_ADD_TO_CONTENT("menudef", m_menu_def);
|
||||
POOL_ADD_TO_CONTENT("localize", m_localize);
|
||||
POOL_ADD_TO_CONTENT("weapon", m_weapon);
|
||||
POOL_ADD_TO_CONTENT("attachment", m_attachment);
|
||||
POOL_ADD_TO_CONTENT("attachmentunique", m_attachment_unique);
|
||||
POOL_ADD_TO_CONTENT("camo", m_camo);
|
||||
POOL_ADD_TO_CONTENT("snddriverglobals", m_snd_driver_globals);
|
||||
POOL_ADD_TO_CONTENT("fx", m_fx);
|
||||
POOL_ADD_TO_CONTENT("fximpacttable", m_fx_impact_table);
|
||||
POOL_ADD_TO_CONTENT("rawfile", m_raw_file);
|
||||
POOL_ADD_TO_CONTENT("stringtable", m_string_table);
|
||||
POOL_ADD_TO_CONTENT("leaderboard", m_leaderboard);
|
||||
POOL_ADD_TO_CONTENT("xglobals", m_xglobals);
|
||||
POOL_ADD_TO_CONTENT("ddl", m_ddl);
|
||||
POOL_ADD_TO_CONTENT("glasses", m_glasses);
|
||||
POOL_ADD_TO_CONTENT("emblemset", m_emblem_set);
|
||||
POOL_ADD_TO_CONTENT("script", m_script);
|
||||
POOL_ADD_TO_CONTENT("keyvaluepairs", m_key_value_pairs);
|
||||
POOL_ADD_TO_CONTENT("vehicle", m_vehicle);
|
||||
POOL_ADD_TO_CONTENT("memoryblock", m_memory_block);
|
||||
POOL_ADD_TO_CONTENT("addonmapents", m_addon_map_ents);
|
||||
POOL_ADD_TO_CONTENT("tracer", m_tracer);
|
||||
POOL_ADD_TO_CONTENT("skinnedverts", m_skinned_verts);
|
||||
POOL_ADD_TO_CONTENT("qdb", m_qdb);
|
||||
POOL_ADD_TO_CONTENT("slug", m_slug);
|
||||
POOL_ADD_TO_CONTENT("footsteptable", m_footstep_table);
|
||||
POOL_ADD_TO_CONTENT("footstepfxtable", m_footstep_fx_table);
|
||||
POOL_ADD_TO_CONTENT("zbarrier", m_zbarrier);
|
||||
|
||||
return content;
|
||||
|
||||
#undef POOL_ADD_TO_CONTENT
|
||||
return ASSET_TYPE_INVALID;
|
||||
}
|
||||
|
||||
IZoneAssetPools::iterator GameAssetPoolT6::begin() const
|
||||
{
|
||||
return m_assets_in_order.begin();
|
||||
}
|
||||
|
||||
IZoneAssetPools::iterator GameAssetPoolT6::end() const
|
||||
{
|
||||
return m_assets_in_order.end();
|
||||
}
|
||||
|
@ -7,6 +7,10 @@
|
||||
class GameAssetPoolT6 final : public IZoneAssetPools
|
||||
{
|
||||
int m_priority;
|
||||
std::vector<XAssetInfoGeneric*> m_assets_in_order;
|
||||
|
||||
static const std::string ASSET_TYPE_INVALID;
|
||||
static const std::string ASSET_TYPE_NAMES[];
|
||||
|
||||
public:
|
||||
AssetPool<T6::PhysPreset>* m_phys_preset;
|
||||
@ -65,7 +69,9 @@ public:
|
||||
void InitPoolDynamic(asset_type_t type) override;
|
||||
|
||||
XAssetInfoGeneric* AddAsset(asset_type_t type, std::string name, void* asset, std::vector<std::string>& scriptStrings, std::vector<XAssetInfoGeneric*>& dependencies) override;
|
||||
XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) override;
|
||||
XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const override;
|
||||
const std::string& GetAssetTypeName(asset_type_t assetType) const override;
|
||||
|
||||
ZoneContent GetContent() const override;
|
||||
iterator begin() const override;
|
||||
iterator end() const override;
|
||||
};
|
||||
|
@ -5,6 +5,13 @@ using namespace T6;
|
||||
|
||||
GameT6 g_GameT6;
|
||||
|
||||
const std::string GameT6::NAME = "T6";
|
||||
|
||||
const std::string& GameT6::GetName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
void GameT6::AddZone(Zone* zone)
|
||||
{
|
||||
m_zones.push_back(zone);
|
||||
|
@ -3,9 +3,11 @@
|
||||
|
||||
class GameT6 : public IGame
|
||||
{
|
||||
static const std::string NAME;
|
||||
std::vector<Zone*> m_zones;
|
||||
|
||||
public:
|
||||
const std::string& GetName() override;
|
||||
void AddZone(Zone* zone) override;
|
||||
void RemoveZone(Zone* zone) override;
|
||||
std::vector<Zone*> GetZones() override;
|
||||
|
Reference in New Issue
Block a user