1#ifndef YAZE_ZELDA3_DUNGEON_CUSTOM_OBJECT_H_
2#define YAZE_ZELDA3_DUNGEON_CUSTOM_OBJECT_H_
7#include <unordered_map>
10#include "absl/status/status.h"
11#include "absl/status/statusor.h"
48 std::vector<TileMapEntry>
tiles;
62 for (
size_t i = 1; i <
tiles.size(); ++i) {
90 void Initialize(
const std::string& custom_objects_folder);
94 const std::unordered_map<
int, std::vector<std::string>>& map);
99 absl::StatusOr<std::shared_ptr<CustomObject>>
LoadObject(
100 const std::string& filename);
114 void AddObjectFile(
int object_id,
const std::string& filename);
131 const std::vector<uint8_t>& data);
135 std::unordered_map<std::string, std::shared_ptr<CustomObject>>
cache_;
Manages loading and caching of custom object binary files.
int GetSubtypeCount(int object_id) const
void RestoreState(const State &state)
bool HasCustomFileMap() const
const std::string & GetBasePath() const
absl::StatusOr< CustomObject > ParseBinaryData(const std::vector< uint8_t > &data)
void SetObjectFileMap(const std::unordered_map< int, std::vector< std::string > > &map)
static CustomObjectManager & Get()
absl::StatusOr< std::shared_ptr< CustomObject > > LoadObject(const std::string &filename)
CustomObjectManager()=default
void AddObjectFile(int object_id, const std::string &filename)
absl::StatusOr< std::shared_ptr< CustomObject > > GetObjectInternal(int object_id, int subtype)
static const std::vector< std::string > kSubtype2Filenames
void Initialize(const std::string &custom_objects_folder)
std::unordered_map< std::string, std::shared_ptr< CustomObject > > cache_
const std::vector< std::string > * ResolveFileList(int object_id) const
void ClearObjectFileMap()
std::unordered_map< int, std::vector< std::string > > custom_file_map_
std::string ResolveFilename(int object_id, int subtype) const
static const std::vector< std::string > kSubtype1Filenames
std::vector< std::string > GetEffectiveFileList(int object_id) const
State SnapshotState() const
std::unordered_map< int, std::vector< std::string > > custom_file_map
Represents a decoded custom object (from binary format)
BoundingBox GetBoundingBox() const
std::vector< TileMapEntry > tiles