1#ifndef YAZE_APP_EDITOR_DUNGEON_DUNGEON_PROJECT_LABELS_H
2#define YAZE_APP_EDITOR_DUNGEON_DUNGEON_PROJECT_LABELS_H
7#include "absl/strings/str_format.h"
35 if (tag && !tag->enabled) {
36 label +=
" (disabled)";
44 size_t* dungeon_index =
nullptr) {
56 for (
size_t i = 0; i < dungeons.size(); ++i) {
57 const auto& dungeon = dungeons[i];
58 for (
const auto& room : dungeon.rooms) {
59 if (room.id == room_id) {
76 for (
const auto& room : dungeon->
rooms) {
77 if (room.id == room_id) {
85 if (dungeon.
id.empty()) {
88 if (dungeon.
name.empty()) {
91 return absl::StrFormat(
"%s %s", dungeon.
id, dungeon.
name);
104 int entrance_id,
int room_id) {
116 room && !room->
floor.empty()) {
119 return std::string();
128 return std::string();
130 const auto type_it = project->
resource_labels.find(kRoomOverrideLabelType);
132 return std::string();
134 const auto label_it = type_it->second.find(std::to_string(room_id));
135 return label_it != type_it->second.end() ? label_it->second : std::string();
144 const std::string& label) {
145 if (!project || label.empty()) {
148 project->
resource_labels[kRoomOverrideLabelType][std::to_string(room_id)] =
156 const auto type_it = project->
resource_labels.find(kRoomOverrideLabelType);
160 type_it->second.erase(std::to_string(room_id));
161 if (type_it->second.empty()) {
173 room && !room->
name.empty()) {
std::optional< RoomTagEntry > GetRoomTag(uint8_t tag_id) const
Get the full room tag entry for a tag ID.
const ProjectRegistry & project_registry() const
bool HasProjectRegistry() const
Unified interface for accessing resource labels with project overrides.
std::string GetLabel(ResourceType type, int id) const
Get a label for a resource by type and ID.
std::unordered_map< std::string, LabelMap > ProjectLabels
void SetHackManifest(const core::HackManifest *manifest)
Set the hack manifest reference for ASM-defined labels.
void SetProjectLabels(ProjectLabels *labels)
Set the project labels reference (typically from YazeProject)
void ClearRoomLabel(project::YazeProject *project, int room_id)
std::string FindRoomOverride(const project::YazeProject *project, int room_id)
zelda3::ResourceLabelProvider LabelsForProject(const project::YazeProject *project)
std::string GetRoomTagLabel(const project::YazeProject *project, int id)
bool HasCustomRoomLabel(const project::YazeProject *project, int room_id)
std::string GetEntranceLabel(const project::YazeProject *project, int entrance_id, int room_id)
std::string GetRoomLabel(const project::YazeProject *project, int room_id)
void SetRoomLabel(project::YazeProject *project, int room_id, const std::string &label)
const core::DungeonEntry * FindDungeonForRoom(const project::YazeProject *project, int room_id, size_t *dungeon_index=nullptr)
std::string GetDungeonNameForRoom(const project::YazeProject *project, int room_id)
const core::DungeonRoom * FindDungeonRoom(const project::YazeProject *project, int room_id)
std::string GetRoomFloorLabel(const project::YazeProject *project, int room_id)
std::string FormatDungeonName(const core::DungeonEntry &dungeon)
std::string GetEntranceLabel(int id)
Convenience function to get an entrance label.
constexpr char kRoomOverrideLabelType[]
A complete dungeon entry with rooms and connections.
std::vector< DungeonRoom > rooms
A room within a dungeon, with spatial and metadata info.
std::vector< DungeonEntry > dungeons
Modern project structure with comprehensive settings consolidation.
bool project_opened() const
core::HackManifest hack_manifest
std::unordered_map< std::string, std::unordered_map< std::string, std::string > > resource_labels