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 187 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::editor::EditorManager::ApplyCurrentProjectRuntimeContext(), 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::anonymous_namespace{dungeon_canvas_connected_view.cc}::IsHeaderBackedInterroomStaircaseObject(), yaze::editor::EditorManager::LoadProjectWithRom(), yaze::zelda3::ObjectGeometry::MeasureByObjectId(), yaze::zelda3::ObjectGeometry::MeasureByObjectIdForState(), yaze::zelda3::ObjectGeometry::ResolveAnchor(), 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 28 of file draw_routine_registry.cc.
References BuildObjectMapping(), Initialize(), and initialized_.
Referenced by yaze::editor::EditorManager::ApplyCurrentProjectRuntimeContext(), 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 55 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 201 of file draw_routine_registry.h.
References routines_.
| bool yaze::zelda3::DrawRoutineRegistry::RoutineDrawsToBothBGs | ( | int | routine_id | ) | const |
Definition at line 64 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 69 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 82 of file draw_routine_registry.cc.
References object_to_routine_map_.
Referenced by yaze::zelda3::ObjectDrawer::GetDrawRoutineId(), yaze::zelda3::GetObjectLayerSemantics(), yaze::editor::anonymous_namespace{dungeon_canvas_connected_view.cc}::IsHeaderBackedInterroomStaircaseObject(), yaze::zelda3::ObjectGeometry::MeasureByObjectId(), yaze::zelda3::ObjectGeometry::MeasureByObjectIdForState(), and yaze::zelda3::ObjectGeometry::ResolveAnchor().
|
private |
Definition at line 36 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 90 of file draw_routine_registry.cc.
References yaze::core::FeatureFlags::get(), yaze::zelda3::DrawRoutineIds::kCustomObject, yaze::zelda3::DrawRoutineIds::kDamFloodGate, yaze::zelda3::DrawRoutineIds::kDownwardsEdge1x1_1to16plus7, yaze::zelda3::DrawRoutineIds::kDownwardsHasEdge1x1_1to16_plus23, yaze::core::FeatureFlags::Flags::kEnableCustomObjects, yaze::zelda3::DrawRoutineIds::kFloorLight, yaze::zelda3::DrawRoutineIds::kNothing, yaze::zelda3::DrawRoutineIds::kRightwardsHasEdge1x1_1to16_plus23, yaze::zelda3::DrawRoutineIds::kSingle2x2, yaze::zelda3::DrawRoutineIds::kWaterHopStairsA, yaze::zelda3::DrawRoutineIds::kWaterHopStairsB, yaze::zelda3::DrawRoutineIds::kWeird2x4_1to16, and object_to_routine_map_.
Referenced by BuildRegistry(), and RefreshFeatureFlagMappings().

|
private |
Definition at line 220 of file draw_routine_registry.h.
Referenced by BuildRegistry(), and GetAllRoutines().
|
private |
Definition at line 221 of file draw_routine_registry.h.
Referenced by BuildRegistry(), and GetRoutineInfo().
|
private |
Definition at line 222 of file draw_routine_registry.h.
Referenced by BuildObjectMapping(), and GetRoutineIdForObject().
|
private |
Definition at line 223 of file draw_routine_registry.h.
Referenced by Get(), Initialize(), and RefreshFeatureFlagMappings().