diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/util/asset_manager.cc | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/util/asset_manager.cc b/src/util/asset_manager.cc index 65b3200..d9ecfe1 100644 --- a/src/util/asset_manager.cc +++ b/src/util/asset_manager.cc @@ -24,14 +24,6 @@ static const std::map<std::string, ProcGenFunc> kAssetManagerProcGenFuncMap = { {"make_periodic", procedural::make_periodic}, }; -// These are defined in the generated assets_data.cc -#if defined(USE_TEST_ASSETS) -extern const AssetRecord g_assets[]; -extern const size_t g_assets_count; -#else -extern const AssetRecord g_assets[]; -extern const size_t g_assets_count; -#endif // Array-based cache for assets. // Initialized to all zeros (nullptr data, 0 size, false is_procedural) // The size is derived from the generated ASSET_LAST_ID enum value. @@ -59,15 +51,19 @@ const uint8_t* GetAsset(AssetId asset_id, size_t* out_size) { return g_asset_cache[index].data; } + const AssetRecord* assets = GetAssetRecordTable(); + size_t count = GetAssetCount(); + // Not in cache, retrieve from static data (packed in binary) or generate // procedurally - if (index >= g_assets_count) { + if (index >= count) { if (out_size) *out_size = 0; return nullptr; // Invalid asset_id or asset not in static packed data. } - AssetRecord source_record = g_assets[index]; + AssetRecord source_record = assets[index]; + AssetRecord cached_record = source_record; if (source_record.is_procedural) { |
