From 3bf47f058d31a41f9ef112767c3d432c287b559f Mon Sep 17 00:00:00 2001 From: Jan Date: Wed, 9 Sep 2020 12:03:14 +0200 Subject: [PATCH] Add LeaderboardDef asset loading for IW4 --- src/ZoneCode.lua | 2 +- src/ZoneCode/Game/IW4/IW4_Commands.txt | 15 +++++- src/ZoneCommon/Game/IW4/GameAssetPoolIW4.cpp | 10 ++-- src/ZoneCommon/Game/IW4/GameAssetPoolIW4.h | 2 +- src/ZoneCommon/Game/IW4/IW4_Assets.h | 47 +++++++++++++++++-- src/ZoneLoading/Game/IW4/ContentLoaderIW4.cpp | 4 +- 6 files changed, 67 insertions(+), 13 deletions(-) diff --git a/src/ZoneCode.lua b/src/ZoneCode.lua index 4a091907..1668e031 100644 --- a/src/ZoneCode.lua +++ b/src/ZoneCode.lua @@ -33,7 +33,7 @@ ZoneCode.Assets = { "FxImpactTable", "RawFile", "StringTable", - -- "LeaderboardDef", + "LeaderboardDef", -- "StructuredDataDefSet", -- "TracerDef", -- "VehicleDef", diff --git a/src/ZoneCode/Game/IW4/IW4_Commands.txt b/src/ZoneCode/Game/IW4/IW4_Commands.txt index 71ece05a..12a49407 100644 --- a/src/ZoneCode/Game/IW4/IW4_Commands.txt +++ b/src/ZoneCode/Game/IW4/IW4_Commands.txt @@ -33,7 +33,7 @@ asset FxEffectDef ASSET_TYPE_FX; asset FxImpactTable ASSET_TYPE_IMPACT_FX; asset RawFile ASSET_TYPE_RAWFILE; asset StringTable ASSET_TYPE_STRINGTABLE; -// asset LeaderboardDef ASSET_TYPE_LEADERBOARD; +asset LeaderboardDef ASSET_TYPE_LEADERBOARD; // asset StructuredDataDefSet ASSET_TYPE_STRUCTURED_DATA_DEF; // asset TracerDef ASSET_TYPE_TRACER; // asset VehicleDef ASSET_TYPE_VEHICLE; @@ -652,4 +652,17 @@ set count values columnCount * rowCount; // StringTableCell set string StringTableCell::string; +// ========================================= +// LeaderboardDef +// ========================================= +use LeaderboardDef; +set string name; +set name name; +set count columns columnCount; + +// LbColumnDef +use LbColumnDef; +set string name; +set string statName; + // EOF \ No newline at end of file diff --git a/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.cpp b/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.cpp index fa092ad8..b64a5f13 100644 --- a/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.cpp +++ b/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.cpp @@ -134,7 +134,7 @@ GameAssetPoolIW4::GameAssetPoolIW4(const int priority) m_fx_impact_table = nullptr; m_raw_file = nullptr; m_string_table = nullptr; - // m_leaderboard = nullptr; + m_leaderboard = nullptr; // m_structed_data_def_set = nullptr; // m_tracer = nullptr; // m_vehicle = nullptr; @@ -187,7 +187,7 @@ void GameAssetPoolIW4::InitPoolStatic(const asset_type_t type, const size_t capa CASE_INIT_POOL_STATIC(ASSET_TYPE_IMPACT_FX, m_fx_impact_table, FxImpactTable); CASE_INIT_POOL_STATIC(ASSET_TYPE_RAWFILE, m_raw_file, RawFile); CASE_INIT_POOL_STATIC(ASSET_TYPE_STRINGTABLE, m_string_table, StringTable); - // CASE_INIT_POOL_STATIC(ASSET_TYPE_LEADERBOARD, m_leaderboard, LeaderboardDef); + CASE_INIT_POOL_STATIC(ASSET_TYPE_LEADERBOARD, m_leaderboard, LeaderboardDef); // CASE_INIT_POOL_STATIC(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set, StructuredDataDefSet); // CASE_INIT_POOL_STATIC(ASSET_TYPE_TRACER, m_tracer, TracerDef); // CASE_INIT_POOL_STATIC(ASSET_TYPE_VEHICLE, m_vehicle, VehicleDef); @@ -247,7 +247,7 @@ void GameAssetPoolIW4::InitPoolDynamic(const asset_type_t type) CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_IMPACT_FX, m_fx_impact_table, FxImpactTable); CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_RAWFILE, m_raw_file, RawFile); CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_STRINGTABLE, m_string_table, StringTable); - // CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_LEADERBOARD, m_leaderboard, LeaderboardDef); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_LEADERBOARD, m_leaderboard, LeaderboardDef); // CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set, StructuredDataDefSet); // CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_TRACER, m_tracer, TracerDef); // CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_VEHICLE, m_vehicle, VehicleDef); @@ -316,7 +316,7 @@ XAssetInfoGeneric* GameAssetPoolIW4::AddAsset(asset_type_t type, std::string nam CASE_ADD_TO_POOL(ASSET_TYPE_IMPACT_FX, m_fx_impact_table, impactFx); CASE_ADD_TO_POOL(ASSET_TYPE_RAWFILE, m_raw_file, rawfile); CASE_ADD_TO_POOL(ASSET_TYPE_STRINGTABLE, m_string_table, stringTable); - // CASE_ADD_TO_POOL(ASSET_TYPE_LEADERBOARD, m_leaderboard, leaderboardDef); + CASE_ADD_TO_POOL(ASSET_TYPE_LEADERBOARD, m_leaderboard, leaderboardDef); // CASE_ADD_TO_POOL(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set, structuredDataDefSet); // CASE_ADD_TO_POOL(ASSET_TYPE_TRACER, m_tracer, tracerDef); // CASE_ADD_TO_POOL(ASSET_TYPE_VEHICLE, m_vehicle, vehDef); @@ -376,7 +376,7 @@ XAssetInfoGeneric* GameAssetPoolIW4::GetAsset(const asset_type_t type, std::stri CASE_GET_ASSET(ASSET_TYPE_IMPACT_FX, m_fx_impact_table); CASE_GET_ASSET(ASSET_TYPE_RAWFILE, m_raw_file); CASE_GET_ASSET(ASSET_TYPE_STRINGTABLE, m_string_table); - // CASE_GET_ASSET(ASSET_TYPE_LEADERBOARD, m_leaderboard); + CASE_GET_ASSET(ASSET_TYPE_LEADERBOARD, m_leaderboard); // CASE_GET_ASSET(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set); // CASE_GET_ASSET(ASSET_TYPE_TRACER, m_tracer); // CASE_GET_ASSET(ASSET_TYPE_VEHICLE, m_vehicle); diff --git a/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.h b/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.h index 177d82e8..3345469b 100644 --- a/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.h +++ b/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.h @@ -46,7 +46,7 @@ public: std::unique_ptr> m_fx_impact_table; std::unique_ptr> m_raw_file; std::unique_ptr> m_string_table; - // std::unique_ptr> m_leaderboard; + std::unique_ptr> m_leaderboard; // std::unique_ptr> m_structed_data_def_set; // std::unique_ptr> m_tracer; // std::unique_ptr> m_vehicle; diff --git a/src/ZoneCommon/Game/IW4/IW4_Assets.h b/src/ZoneCommon/Game/IW4/IW4_Assets.h index 8a7e6e29..5ca5d030 100644 --- a/src/ZoneCommon/Game/IW4/IW4_Assets.h +++ b/src/ZoneCommon/Game/IW4/IW4_Assets.h @@ -105,8 +105,7 @@ namespace IW4 struct FxImpactTable; struct RawFile; struct StringTable; - - // struct LeaderboardDef; + struct LeaderboardDef; // struct StructuredDataDefSet; // struct TracerDef; // struct VehicleDef; @@ -146,7 +145,7 @@ namespace IW4 FxImpactTable* impactFx; RawFile* rawfile; StringTable* stringTable; - // LeaderboardDef* leaderboardDef; + LeaderboardDef* leaderboardDef; // StructuredDataDefSet* structuredDataDefSet; // TracerDef* tracerDef; // VehicleDef* vehDef; @@ -1639,6 +1638,48 @@ namespace IW4 FxImpactEntry* table; }; + enum LbColType + { + LBCOL_TYPE_NUMBER = 0x0, + LBCOL_TYPE_TIME = 0x1, + LBCOL_TYPE_LEVELXP = 0x2, + LBCOL_TYPE_PRESTIGE = 0x3, + LBCOL_TYPE_BIGNUMBER = 0x4, + LBCOL_TYPE_PERCENT = 0x5, + LBCOL_TYPE_COUNT = 0x6, + }; + + enum LbAggType + { + LBAGG_TYPE_MIN = 0x0, + LBAGG_TYPE_MAX = 0x1, + LBAGG_TYPE_SUM = 0x2, + LBAGG_TYPE_LAST = 0x3, + LBAGG_TYPE_COUNT = 0x4, + }; + + struct LbColumnDef + { + const char* name; + int id; + int propertyId; + bool hidden; + const char* statName; + LbColType type; + int precision; + LbAggType agg; + }; + + struct LeaderboardDef + { + const char* name; + int id; + int columnCount; + int xpColId; + int prestigeColId; + LbColumnDef* columns; + }; + #ifndef __zonecodegenerator } #endif diff --git a/src/ZoneLoading/Game/IW4/ContentLoaderIW4.cpp b/src/ZoneLoading/Game/IW4/ContentLoaderIW4.cpp index d9191aeb..84cd657a 100644 --- a/src/ZoneLoading/Game/IW4/ContentLoaderIW4.cpp +++ b/src/ZoneLoading/Game/IW4/ContentLoaderIW4.cpp @@ -16,7 +16,7 @@ #include "Game/IW4/XAssets/gfximage/gfximage_load_db.h" #include "Game/IW4/XAssets/gfxlightdef/gfxlightdef_load_db.h" //#include "Game/IW4/XAssets/gfxworld/gfxworld_load_db.h" -//#include "Game/IW4/XAssets/leaderboarddef/leaderboarddef_load_db.h" +#include "Game/IW4/XAssets/leaderboarddef/leaderboarddef_load_db.h" #include "Game/IW4/XAssets/loadedsound/loadedsound_load_db.h" #include "Game/IW4/XAssets/localizeentry/localizeentry_load_db.h" //#include "Game/IW4/XAssets/mapents/mapents_load_db.h" @@ -135,7 +135,7 @@ void ContentLoaderIW4::LoadXAsset(const bool atStreamStart) 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_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);