Unified draw routine registry. More...
#include <draw_routine_registry.h>
Public Member Functions | |
| void | Initialize () |
| void | RefreshFeatureFlagMappings () |
| const DrawRoutineInfo * | GetRoutineInfo (int routine_id) const |
| const std::vector< DrawRoutineInfo > & | GetAllRoutines () const |
| bool | RoutineDrawsToBothBGs (int routine_id) const |
| bool | GetRoutineDimensions (int routine_id, int *base_width, int *base_height) const |
| int | GetRoutineIdForObject (int16_t object_id) const |
Static Public Member Functions | |
| static DrawRoutineRegistry & | Get () |
Private Member Functions | |
| DrawRoutineRegistry ()=default | |
| void | BuildRegistry () |
| void | BuildObjectMapping () |
Private Attributes | |
| std::vector< DrawRoutineInfo > | routines_ |
| std::unordered_map< int, const DrawRoutineInfo * > | routine_map_ |
| std::unordered_map< int16_t, int > | object_to_routine_map_ |
| bool | initialized_ = false |
Unified draw routine registry.
Singleton that provides draw routine metadata for both ObjectDrawer and ObjectGeometry. This ensures both systems use the same routine IDs and dimension calculations.
Definition at line 179 of file draw_routine_registry.h.
|
privatedefault |
|
static |
Definition at line 13 of file draw_routine_registry.cc.
References Initialize(), and initialized_.
Referenced by yaze::cli::resources::CommandContext::ApplyProjectRuntimeContext(), yaze::zelda3::ObjectGeometry::BuildRegistry(), yaze::zelda3::ObjectDrawer::DrawObject(), yaze::zelda3::ObjectDrawer::DrawUsingRegistryRoutine(), yaze::zelda3::ObjectDrawer::GetDrawRoutineId(), yaze::zelda3::ObjectParser::GetObjectDrawInfo(), yaze::zelda3::GetObjectLayerSemantics(), yaze::editor::EditorManager::LoadProjectWithRom(), yaze::zelda3::ObjectGeometry::MeasureByObjectId(), yaze::cli::resources::CommandContext::RestoreProjectRuntimeContext(), and yaze::zelda3::ObjectDrawer::RoutineDrawsToBothBGs().

| void yaze::zelda3::DrawRoutineRegistry::Initialize | ( | ) |
Definition at line 21 of file draw_routine_registry.cc.
References BuildRegistry(), and initialized_.
Referenced by Get(), and RefreshFeatureFlagMappings().

| void yaze::zelda3::DrawRoutineRegistry::RefreshFeatureFlagMappings | ( | ) |
Definition at line 27 of file draw_routine_registry.cc.
References BuildObjectMapping(), Initialize(), and initialized_.
Referenced by yaze::cli::resources::CommandContext::ApplyProjectRuntimeContext(), yaze::editor::EditorManager::LoadProjectWithRom(), and yaze::cli::resources::CommandContext::RestoreProjectRuntimeContext().

| const DrawRoutineInfo * yaze::zelda3::DrawRoutineRegistry::GetRoutineInfo | ( | int | routine_id | ) | const |
Definition at line 54 of file draw_routine_registry.cc.
References routine_map_.
Referenced by yaze::zelda3::ObjectDrawer::DrawObject(), yaze::zelda3::ObjectDrawer::DrawUsingRegistryRoutine(), GetRoutineDimensions(), and RoutineDrawsToBothBGs().
|
inline |
Definition at line 193 of file draw_routine_registry.h.
References routines_.
| bool yaze::zelda3::DrawRoutineRegistry::RoutineDrawsToBothBGs | ( | int | routine_id | ) | const |
Definition at line 62 of file draw_routine_registry.cc.
References yaze::zelda3::DrawRoutineInfo::draws_to_both_bgs, and GetRoutineInfo().
Referenced by yaze::zelda3::GetObjectLayerSemantics(), and yaze::zelda3::ObjectDrawer::RoutineDrawsToBothBGs().

| bool yaze::zelda3::DrawRoutineRegistry::GetRoutineDimensions | ( | int | routine_id, |
| int * | base_width, | ||
| int * | base_height ) const |
Definition at line 67 of file draw_routine_registry.cc.
References yaze::zelda3::DrawRoutineInfo::base_height, yaze::zelda3::DrawRoutineInfo::base_width, and GetRoutineInfo().

| int yaze::zelda3::DrawRoutineRegistry::GetRoutineIdForObject | ( | int16_t | object_id | ) | const |
Definition at line 79 of file draw_routine_registry.cc.
References object_to_routine_map_.
Referenced by yaze::zelda3::ObjectDrawer::GetDrawRoutineId(), yaze::zelda3::GetObjectLayerSemantics(), and yaze::zelda3::ObjectGeometry::MeasureByObjectId().
|
private |
Definition at line 35 of file draw_routine_registry.cc.
References BuildObjectMapping(), yaze::zelda3::draw_routines::RegisterCornerRoutines(), yaze::zelda3::draw_routines::RegisterDiagonalRoutines(), yaze::zelda3::draw_routines::RegisterDownwardsRoutines(), yaze::zelda3::draw_routines::RegisterRightwardsRoutines(), yaze::zelda3::draw_routines::RegisterSpecialRoutines(), routine_map_, and routines_.
Referenced by Initialize().
|
private |
Definition at line 87 of file draw_routine_registry.cc.
References yaze::core::FeatureFlags::get(), yaze::zelda3::DrawRoutineIds::kCustomObject, yaze::zelda3::DrawRoutineIds::kDownwardsHasEdge1x1_1to16_plus23, yaze::core::FeatureFlags::Flags::kEnableCustomObjects, yaze::zelda3::DrawRoutineIds::kNothing, yaze::zelda3::DrawRoutineIds::kRightwardsHasEdge1x1_1to16_plus23, and object_to_routine_map_.
Referenced by BuildRegistry(), and RefreshFeatureFlagMappings().

|
private |
Definition at line 212 of file draw_routine_registry.h.
Referenced by BuildRegistry(), and GetAllRoutines().
|
private |
Definition at line 213 of file draw_routine_registry.h.
Referenced by BuildRegistry(), and GetRoutineInfo().
|
private |
Definition at line 214 of file draw_routine_registry.h.
Referenced by BuildObjectMapping(), and GetRoutineIdForObject().
|
private |
Definition at line 215 of file draw_routine_registry.h.
Referenced by Get(), Initialize(), and RefreshFeatureFlagMappings().