yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::zelda3::CustomObjectManager Class Reference

Manages loading and caching of custom object binary files. More...

#include <custom_object.h>

Public Member Functions

void Initialize (const std::string &custom_objects_folder)
 
absl::StatusOr< std::shared_ptr< CustomObject > > LoadObject (const std::string &filename)
 
absl::StatusOr< std::shared_ptr< CustomObject > > GetObjectInternal (int object_id, int subtype)
 
int GetSubtypeCount (int object_id) const
 
void ReloadAll ()
 

Static Public Member Functions

static CustomObjectManagerGet ()
 

Private Member Functions

 CustomObjectManager ()=default
 
absl::StatusOr< CustomObjectParseBinaryData (const std::vector< uint8_t > &data)
 

Private Attributes

std::string base_path_
 
std::unordered_map< std::string, std::shared_ptr< CustomObject > > cache_
 

Static Private Attributes

static const std::vector< std::string > kSubtype1Filenames
 
static const std::vector< std::string > kSubtype2Filenames
 

Detailed Description

Manages loading and caching of custom object binary files.

Definition at line 47 of file custom_object.h.

Constructor & Destructor Documentation

◆ CustomObjectManager()

yaze::zelda3::CustomObjectManager::CustomObjectManager ( )
privatedefault

Member Function Documentation

◆ Get()

◆ Initialize()

void yaze::zelda3::CustomObjectManager::Initialize ( const std::string & custom_objects_folder)

Definition at line 42 of file custom_object.cc.

References base_path_, and cache_.

Referenced by yaze::editor::DungeonEditorV2::Load().

◆ LoadObject()

absl::StatusOr< std::shared_ptr< CustomObject > > yaze::zelda3::CustomObjectManager::LoadObject ( const std::string & filename)

Definition at line 47 of file custom_object.cc.

References base_path_, cache_, LOG_ERROR, and ParseBinaryData().

Referenced by GetObjectInternal().

Here is the call graph for this function:

◆ GetObjectInternal()

absl::StatusOr< std::shared_ptr< CustomObject > > yaze::zelda3::CustomObjectManager::GetObjectInternal ( int object_id,
int subtype )

Definition at line 135 of file custom_object.cc.

References kSubtype1Filenames, kSubtype2Filenames, and LoadObject().

Here is the call graph for this function:

◆ GetSubtypeCount()

int yaze::zelda3::CustomObjectManager::GetSubtypeCount ( int object_id) const

Definition at line 168 of file custom_object.cc.

References kSubtype1Filenames, and kSubtype2Filenames.

◆ ReloadAll()

void yaze::zelda3::CustomObjectManager::ReloadAll ( )

Definition at line 176 of file custom_object.cc.

References cache_.

◆ ParseBinaryData()

absl::StatusOr< CustomObject > yaze::zelda3::CustomObjectManager::ParseBinaryData ( const std::vector< uint8_t > & data)
private

Definition at line 77 of file custom_object.cc.

References LOG_WARN, and yaze::zelda3::CustomObject::tiles.

Referenced by LoadObject().

Member Data Documentation

◆ base_path_

std::string yaze::zelda3::CustomObjectManager::base_path_
private

Definition at line 73 of file custom_object.h.

Referenced by Initialize(), and LoadObject().

◆ cache_

std::unordered_map<std::string, std::shared_ptr<CustomObject> > yaze::zelda3::CustomObjectManager::cache_
private

Definition at line 74 of file custom_object.h.

Referenced by Initialize(), LoadObject(), and ReloadAll().

◆ kSubtype1Filenames

const std::vector< std::string > yaze::zelda3::CustomObjectManager::kSubtype1Filenames
staticprivate
Initial value:
= {
"track_LR.bin",
"track_UD.bin",
"track_corner_TL.bin",
"track_corner_TR.bin",
"track_corner_BL.bin",
"track_corner_BR.bin",
"track_floor_UD.bin",
"track_floor_LR.bin",
"track_floor_corner_TL.bin",
"track_floor_corner_TR.bin",
"track_floor_corner_BL.bin",
"track_floor_corner_BR.bin",
"track_floor_any.bin",
"wall_sword_house.bin",
"track_any.bin",
"small_statue.bin",
}

Definition at line 77 of file custom_object.h.

Referenced by GetObjectInternal(), and GetSubtypeCount().

◆ kSubtype2Filenames

const std::vector< std::string > yaze::zelda3::CustomObjectManager::kSubtype2Filenames
staticprivate
Initial value:
= {
"furnace.bin",
"firewood.bin",
"ice_chair.bin",
}

Definition at line 79 of file custom_object.h.

Referenced by GetObjectInternal(), and GetSubtypeCount().


The documentation for this class was generated from the following files: