refactor: Introduced a SessionCardRegistry and WindowDelegate for better session management in the editor.

Benefits:
- Streamlines the build process by allowing for multiple Protobuf targets, enhancing compatibility and maintainability.
- Improves session management capabilities within the editor, leading to a more organized and efficient user experience.
- Enhance Protobuf target handling in CMake configuration
- Updated CMake files to support multiple Protobuf targets, improving flexibility in linking.
- Adjusted target link libraries across various components (yaze, yaze_core_lib, yaze_editor, etc.) to utilize the new
This commit is contained in:
scawful
2025-10-14 20:30:25 -04:00
parent 76a5ab3f39
commit 6dbc30c11f
25 changed files with 2435 additions and 390 deletions

View File

@@ -1,78 +1,82 @@
#include "zelda3/palette_constants.h"
#include <string>
#include <vector>
namespace yaze {
namespace zelda3 {
namespace yaze::zelda3 {
const PaletteGroupMetadata* GetPaletteGroupMetadata(const char* group_id) {
std::string id_str(group_id);
if (id_str == PaletteGroupName::kOverworldMain) {
return &PaletteMetadata::kOverworldMain;
} else if (id_str == PaletteGroupName::kOverworldAux) {
}
if (id_str == PaletteGroupName::kOverworldAux) {
return &PaletteMetadata::kOverworldAux;
} else if (id_str == PaletteGroupName::kOverworldAnimated) {
}
if (id_str == PaletteGroupName::kOverworldAnimated) {
return &PaletteMetadata::kOverworldAnimated;
} else if (id_str == PaletteGroupName::kDungeonMain) {
}
if (id_str == PaletteGroupName::kDungeonMain) {
return &PaletteMetadata::kDungeonMain;
} else if (id_str == PaletteGroupName::kGlobalSprites) {
}
if (id_str == PaletteGroupName::kGlobalSprites) {
return &PaletteMetadata::kGlobalSprites;
} else if (id_str == PaletteGroupName::kSpritesAux1) {
}
if (id_str == PaletteGroupName::kSpritesAux1) {
return &PaletteMetadata::kSpritesAux1;
} else if (id_str == PaletteGroupName::kSpritesAux2) {
}
if (id_str == PaletteGroupName::kSpritesAux2) {
return &PaletteMetadata::kSpritesAux2;
} else if (id_str == PaletteGroupName::kSpritesAux3) {
}
if (id_str == PaletteGroupName::kSpritesAux3) {
return &PaletteMetadata::kSpritesAux3;
} else if (id_str == PaletteGroupName::kArmor) {
}
if (id_str == PaletteGroupName::kArmor) {
return &PaletteMetadata::kArmor;
} else if (id_str == PaletteGroupName::kSwords) {
}
if (id_str == PaletteGroupName::kSwords) {
return &PaletteMetadata::kSwords;
} else if (id_str == PaletteGroupName::kShields) {
}
if (id_str == PaletteGroupName::kShields) {
return &PaletteMetadata::kShields;
} else if (id_str == PaletteGroupName::kHud) {
}
if (id_str == PaletteGroupName::kHud) {
return &PaletteMetadata::kHud;
} else if (id_str == PaletteGroupName::kGrass) {
}
if (id_str == PaletteGroupName::kGrass) {
return &PaletteMetadata::kGrass;
} else if (id_str == PaletteGroupName::k3DObject) {
}
if (id_str == PaletteGroupName::k3DObject) {
return &PaletteMetadata::k3DObject;
} else if (id_str == PaletteGroupName::kOverworldMiniMap) {
}
if (id_str == PaletteGroupName::kOverworldMiniMap) {
return &PaletteMetadata::kOverworldMiniMap;
}
return nullptr;
}
std::vector<const PaletteGroupMetadata*> GetAllPaletteGroups() {
return {
// Overworld
&PaletteMetadata::kOverworldMain,
&PaletteMetadata::kOverworldAux,
&PaletteMetadata::kOverworldAnimated,
// Dungeon
&PaletteMetadata::kDungeonMain,
// Sprites
&PaletteMetadata::kGlobalSprites,
&PaletteMetadata::kSpritesAux1,
&PaletteMetadata::kSpritesAux2,
&PaletteMetadata::kSpritesAux3,
// Equipment
&PaletteMetadata::kArmor,
&PaletteMetadata::kSwords,
&PaletteMetadata::kShields,
// Interface
&PaletteMetadata::kHud,
&PaletteMetadata::kOverworldMiniMap,
// Special
&PaletteMetadata::kGrass,
&PaletteMetadata::k3DObject
};
return {// Overworld
&PaletteMetadata::kOverworldMain, &PaletteMetadata::kOverworldAux,
&PaletteMetadata::kOverworldAnimated,
// Dungeon
&PaletteMetadata::kDungeonMain,
// Sprites
&PaletteMetadata::kGlobalSprites, &PaletteMetadata::kSpritesAux1,
&PaletteMetadata::kSpritesAux2, &PaletteMetadata::kSpritesAux3,
// Equipment
&PaletteMetadata::kArmor, &PaletteMetadata::kSwords,
&PaletteMetadata::kShields,
// Interface
&PaletteMetadata::kHud, &PaletteMetadata::kOverworldMiniMap,
// Special
&PaletteMetadata::kGrass, &PaletteMetadata::k3DObject};
}
} // namespace zelda3
} // namespace yaze
} // namespace yaze::zelda3

View File

@@ -4,8 +4,7 @@
#include <cstdint>
#include <vector>
namespace yaze {
namespace zelda3 {
namespace yaze::zelda3 {
// ============================================================================
// Palette Group Names
@@ -303,8 +302,7 @@ const PaletteGroupMetadata* GetPaletteGroupMetadata(const char* group_id);
// Get all available palette groups
std::vector<const PaletteGroupMetadata*> GetAllPaletteGroups();
} // namespace zelda3
} // namespace yaze
} // namespace yaze::zelda3
#endif // YAZE_ZELDA3_PALETTE_CONSTANTS_H

View File

@@ -1,12 +1,15 @@
#include "zelda3/zelda3_labels.h"
#include <cstddef>
#include <string>
#include <unordered_map>
#include <vector>
#include "zelda3/common.h"
#include "zelda3/dungeon/room.h"
#include "zelda3/sprite/sprite.h"
#include "zelda3/sprite/overlord.h"
#include "zelda3/sprite/sprite.h"
namespace yaze {
namespace zelda3 {
namespace yaze::zelda3 {
// Room names - reuse existing kRoomNames array
const std::vector<std::string>& Zelda3Labels::GetRoomNames() {
@@ -55,147 +58,291 @@ const std::vector<std::string>& Zelda3Labels::GetOverlordNames() {
// Overworld map names (64 Light World + 64 Dark World + 32 Special Areas)
const std::vector<std::string>& Zelda3Labels::GetOverworldMapNames() {
static const std::vector<std::string> map_names = {
// Light World (0x00-0x3F)
"Lost Woods", "Master Sword Pedestal", "Castle Courtyard", "Link's House",
"Eastern Palace", "Desert Palace", "Hyrule Castle", "Witch's Hut",
"Kakariko Village", "Death Mountain", "Tower of Hera", "Spectacle Rock",
"Graveyard", "Sanctuary", "Lake Hylia", "Desert of Mystery",
"Eastern Ruins", "Zora's Domain", "Catfish", "Dam",
"Potion Shop", "Kakariko Well", "Blacksmith", "Sick Kid",
"Library", "Mushroom", "Magic Bat", "Fairy Fountain",
"Fortune Teller", "Lake Shop", "Bomb Shop", "Cave 45",
"Checkerboard Cave", "Mini Moldorm Cave", "Ice Rod Cave", "Bonk Rocks",
"Bottle Merchant", "Sahasrahla's Hut", "Chicken House", "Aginah's Cave",
"Dam Exterior", "Mimic Cave Exterior", "Waterfall Fairy", "Pyramid",
"Fat Fairy", "Spike Cave", "Hookshot Cave", "Graveyard Ledge",
"Dark Lumberjacks", "Bumper Cave", "Skull Woods 1", "Skull Woods 2",
"Skull Woods 3", "Skull Woods 4", "Skull Woods 5", "Skull Woods 6",
"Skull Woods 7", "Skull Woods 8", "Ice Palace Exterior", "Misery Mire Exterior",
"Palace of Darkness Exterior", "Swamp Palace Exterior", "Turtle Rock Exterior", "Thieves' Town Exterior",
// Dark World (0x40-0x7F)
"Dark Woods", "Dark Chapel", "Dark Castle", "Dark Shields",
"Dark Palace", "Dark Desert", "Dark Castle Gate", "Dark Witch",
"Dark Village", "Dark Mountain", "Dark Tower", "Dark Rocks",
"Dark Graveyard", "Dark Sanctuary", "Dark Lake", "Dark Desert South",
"Dark Eastern", "Dark Zora", "Dark Catfish", "Dark Dam",
"Dark Shop", "Dark Well", "Dark Blacksmith", "Dark Sick Kid",
"Dark Library", "Dark Mushroom", "Dark Bat", "Dark Fountain",
"Dark Fortune", "Dark Lake Shop", "Dark Bomb Shop", "Dark Cave 45",
"Dark Checker", "Dark Mini Moldorm", "Dark Ice Rod", "Dark Bonk",
"Dark Bottle", "Dark Sahasrahla", "Dark Chicken", "Dark Aginah",
"Dark Dam Exit", "Dark Mimic Exit", "Dark Waterfall", "Pyramid Top",
"Dark Fat Fairy", "Dark Spike Cave", "Dark Hookshot", "Dark Graveyard Ledge",
"Lumberjack House", "Dark Bumper", "Skull Woods A", "Skull Woods B",
"Skull Woods C", "Skull Woods D", "Skull Woods E", "Skull Woods F",
"Skull Woods G", "Skull Woods H", "Ice Palace Entry", "Misery Mire Entry",
"Palace of Darkness Entry", "Swamp Palace Entry", "Turtle Rock Entry", "Thieves' Town Entry",
// Special Areas (0x80-0x9F)
"Special Area 1", "Special Area 2", "Special Area 3", "Special Area 4",
"Special Area 5", "Special Area 6", "Special Area 7", "Special Area 8",
"Special Area 9", "Special Area 10", "Special Area 11", "Special Area 12",
"Special Area 13", "Special Area 14", "Special Area 15", "Special Area 16",
"Special Area 17", "Special Area 18", "Special Area 19", "Special Area 20",
"Special Area 21", "Special Area 22", "Special Area 23", "Special Area 24",
"Special Area 25", "Special Area 26", "Special Area 27", "Special Area 28",
"Special Area 29", "Special Area 30", "Special Area 31", "Special Area 32"
};
// Light World (0x00-0x3F)
"Lost Woods", "Master Sword Pedestal", "Castle Courtyard", "Link's House",
"Eastern Palace", "Desert Palace", "Hyrule Castle", "Witch's Hut",
"Kakariko Village", "Death Mountain", "Tower of Hera", "Spectacle Rock",
"Graveyard", "Sanctuary", "Lake Hylia", "Desert of Mystery",
"Eastern Ruins", "Zora's Domain", "Catfish", "Dam", "Potion Shop",
"Kakariko Well", "Blacksmith", "Sick Kid", "Library", "Mushroom",
"Magic Bat", "Fairy Fountain", "Fortune Teller", "Lake Shop", "Bomb Shop",
"Cave 45", "Checkerboard Cave", "Mini Moldorm Cave", "Ice Rod Cave",
"Bonk Rocks", "Bottle Merchant", "Sahasrahla's Hut", "Chicken House",
"Aginah's Cave", "Dam Exterior", "Mimic Cave Exterior", "Waterfall Fairy",
"Pyramid", "Fat Fairy", "Spike Cave", "Hookshot Cave", "Graveyard Ledge",
"Dark Lumberjacks", "Bumper Cave", "Skull Woods 1", "Skull Woods 2",
"Skull Woods 3", "Skull Woods 4", "Skull Woods 5", "Skull Woods 6",
"Skull Woods 7", "Skull Woods 8", "Ice Palace Exterior",
"Misery Mire Exterior", "Palace of Darkness Exterior",
"Swamp Palace Exterior", "Turtle Rock Exterior", "Thieves' Town Exterior",
// Dark World (0x40-0x7F)
"Dark Woods", "Dark Chapel", "Dark Castle", "Dark Shields", "Dark Palace",
"Dark Desert", "Dark Castle Gate", "Dark Witch", "Dark Village",
"Dark Mountain", "Dark Tower", "Dark Rocks", "Dark Graveyard",
"Dark Sanctuary", "Dark Lake", "Dark Desert South", "Dark Eastern",
"Dark Zora", "Dark Catfish", "Dark Dam", "Dark Shop", "Dark Well",
"Dark Blacksmith", "Dark Sick Kid", "Dark Library", "Dark Mushroom",
"Dark Bat", "Dark Fountain", "Dark Fortune", "Dark Lake Shop",
"Dark Bomb Shop", "Dark Cave 45", "Dark Checker", "Dark Mini Moldorm",
"Dark Ice Rod", "Dark Bonk", "Dark Bottle", "Dark Sahasrahla",
"Dark Chicken", "Dark Aginah", "Dark Dam Exit", "Dark Mimic Exit",
"Dark Waterfall", "Pyramid Top", "Dark Fat Fairy", "Dark Spike Cave",
"Dark Hookshot", "Dark Graveyard Ledge", "Lumberjack House",
"Dark Bumper", "Skull Woods A", "Skull Woods B", "Skull Woods C",
"Skull Woods D", "Skull Woods E", "Skull Woods F", "Skull Woods G",
"Skull Woods H", "Ice Palace Entry", "Misery Mire Entry",
"Palace of Darkness Entry", "Swamp Palace Entry", "Turtle Rock Entry",
"Thieves' Town Entry",
// Special Areas (0x80-0x9F)
"Special Area 1", "Special Area 2", "Special Area 3", "Special Area 4",
"Special Area 5", "Special Area 6", "Special Area 7", "Special Area 8",
"Special Area 9", "Special Area 10", "Special Area 11", "Special Area 12",
"Special Area 13", "Special Area 14", "Special Area 15",
"Special Area 16", "Special Area 17", "Special Area 18",
"Special Area 19", "Special Area 20", "Special Area 21",
"Special Area 22", "Special Area 23", "Special Area 24",
"Special Area 25", "Special Area 26", "Special Area 27",
"Special Area 28", "Special Area 29", "Special Area 30",
"Special Area 31", "Special Area 32"};
return map_names;
}
// Item names (complete item list)
const std::vector<std::string>& Zelda3Labels::GetItemNames() {
static const std::vector<std::string> item_names = {
"None", "Fighter Sword", "Master Sword", "Tempered Sword",
"Golden Sword", "Fighter Shield", "Fire Shield", "Mirror Shield",
"Fire Rod", "Ice Rod", "Hammer", "Hookshot",
"Bow", "Boomerang", "Powder", "Bee Badge",
"Bombos Medallion", "Ether Medallion", "Quake Medallion", "Lamp",
"Shovel", "Flute", "Somaria Cane", "Bottle",
"Heart Piece", "Byrna Cane", "Cape", "Mirror",
"Power Glove", "Titan Mitt", "Book of Mudora", "Zora Flippers",
"Moon Pearl", "Crystal", "Bug Net", "Blue Mail",
"Red Mail", "Key", "Compass", "Heart Container",
"Bomb", "3 Bombs", "Mushroom", "Red Boomerang",
"Red Potion", "Green Potion", "Blue Potion", "Red Potion (Refill)",
"Green Potion (Refill)", "Blue Potion (Refill)", "10 Bombs", "Big Key",
"Map", "1 Rupee", "5 Rupees", "20 Rupees",
"Pendant of Courage", "Pendant of Wisdom", "Pendant of Power", "Bow and Arrows",
"Silver Arrows Upgrade", "Bee", "Fairy", "Heart Container (Boss)",
"Heart", "1 Arrow", "10 Arrows", "Magic",
"Small Magic", "300 Rupees", "20 Rupees (Green)", "100 Rupees",
"50 Rupees", "Heart Container (Sanctuary)", "Arrow Refill (5)", "Arrow Refill (10)",
"Bomb Refill (1)", "Bomb Refill (4)", "Bomb Refill (8)", "Blue Shield (Refill)",
"Magic Upgrade (1/2)", "Magic Upgrade (1/4)", "Programmable Item 1", "Programmable Item 2",
"Programmable Item 3", "Silvers", "Rupoor", "Null Item",
"Red Clock", "Blue Clock", "Green Clock", "Progressive Sword",
"Progressive Shield", "Progressive Armor", "Progressive Lifting Glove", "RNG Item (Single)",
"RNG Item (Multi)", "Progressive Bow", "Progressive Bow (Alt)", "Aga Pendant",
"Pendant (Green)", "Blue Pendant", "Good Bee", "Tossed Key"
};
"None",
"Fighter Sword",
"Master Sword",
"Tempered Sword",
"Golden Sword",
"Fighter Shield",
"Fire Shield",
"Mirror Shield",
"Fire Rod",
"Ice Rod",
"Hammer",
"Hookshot",
"Bow",
"Boomerang",
"Powder",
"Bee Badge",
"Bombos Medallion",
"Ether Medallion",
"Quake Medallion",
"Lamp",
"Shovel",
"Flute",
"Somaria Cane",
"Bottle",
"Heart Piece",
"Byrna Cane",
"Cape",
"Mirror",
"Power Glove",
"Titan Mitt",
"Book of Mudora",
"Zora Flippers",
"Moon Pearl",
"Crystal",
"Bug Net",
"Blue Mail",
"Red Mail",
"Key",
"Compass",
"Heart Container",
"Bomb",
"3 Bombs",
"Mushroom",
"Red Boomerang",
"Red Potion",
"Green Potion",
"Blue Potion",
"Red Potion (Refill)",
"Green Potion (Refill)",
"Blue Potion (Refill)",
"10 Bombs",
"Big Key",
"Map",
"1 Rupee",
"5 Rupees",
"20 Rupees",
"Pendant of Courage",
"Pendant of Wisdom",
"Pendant of Power",
"Bow and Arrows",
"Silver Arrows Upgrade",
"Bee",
"Fairy",
"Heart Container (Boss)",
"Heart",
"1 Arrow",
"10 Arrows",
"Magic",
"Small Magic",
"300 Rupees",
"20 Rupees (Green)",
"100 Rupees",
"50 Rupees",
"Heart Container (Sanctuary)",
"Arrow Refill (5)",
"Arrow Refill (10)",
"Bomb Refill (1)",
"Bomb Refill (4)",
"Bomb Refill (8)",
"Blue Shield (Refill)",
"Magic Upgrade (1/2)",
"Magic Upgrade (1/4)",
"Programmable Item 1",
"Programmable Item 2",
"Programmable Item 3",
"Silvers",
"Rupoor",
"Null Item",
"Red Clock",
"Blue Clock",
"Green Clock",
"Progressive Sword",
"Progressive Shield",
"Progressive Armor",
"Progressive Lifting Glove",
"RNG Item (Single)",
"RNG Item (Multi)",
"Progressive Bow",
"Progressive Bow (Alt)",
"Aga Pendant",
"Pendant (Green)",
"Blue Pendant",
"Good Bee",
"Tossed Key"};
return item_names;
}
// Music track names
const std::vector<std::string>& Zelda3Labels::GetMusicTrackNames() {
static const std::vector<std::string> music_names = {
"Nothing", "Light World", "Beginning", "Rabbit",
"Forest", "Intro", "Town", "Warp",
"Dark World", "Master Sword", "File Select", "Soldier",
"Boss", "Dark World Death Mountain", "Minigame", "Skull Woods",
"Indoor", "Cave 1", "Zelda's Rescue", "Crystal",
"Shop", "Cave 2", "Game Over", "Boss Victory",
"Sanctuary", "Boss Victory (Short)", "Dark World Woods", "Pendant",
"Ganon's Message", "Hyrule Castle", "Light World Death Mountain", "Eastern Palace",
"Desert Palace", "Agahnim's Theme", "Damp Dungeon", "Ganon Reveals",
"Confrontation", "Ganon's Theme", "Triforce", "Credits",
"Unused", "Unused", "Unused", "Unused",
"Unused", "Unused", "Unused", "Unused"
};
"Nothing",
"Light World",
"Beginning",
"Rabbit",
"Forest",
"Intro",
"Town",
"Warp",
"Dark World",
"Master Sword",
"File Select",
"Soldier",
"Boss",
"Dark World Death Mountain",
"Minigame",
"Skull Woods",
"Indoor",
"Cave 1",
"Zelda's Rescue",
"Crystal",
"Shop",
"Cave 2",
"Game Over",
"Boss Victory",
"Sanctuary",
"Boss Victory (Short)",
"Dark World Woods",
"Pendant",
"Ganon's Message",
"Hyrule Castle",
"Light World Death Mountain",
"Eastern Palace",
"Desert Palace",
"Agahnim's Theme",
"Damp Dungeon",
"Ganon Reveals",
"Confrontation",
"Ganon's Theme",
"Triforce",
"Credits",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused"};
return music_names;
}
// Graphics sheet names
const std::vector<std::string>& Zelda3Labels::GetGraphicsSheetNames() {
static const std::vector<std::string> gfx_names = {
"Sprite Sheet 0", "Sprite Sheet 1", "Sprite Sheet 2", "Sprite Sheet 3",
"Sprite Sheet 4", "Sprite Sheet 5", "Sprite Sheet 6", "Sprite Sheet 7",
"Sprite Sheet 8", "Sprite Sheet 9", "Sprite Sheet A", "Sprite Sheet B",
"Sprite Sheet C", "Sprite Sheet D", "Sprite Sheet E", "Sprite Sheet F",
"Link's Sprites", "Sword Sprites", "Shield Sprites", "Common Sprites",
"Boss Sprites", "NPC Sprites", "Enemy Sprites 1", "Enemy Sprites 2",
"Item Sprites", "Dungeon Objects", "Overworld Objects", "Interface",
"Font", "Credits", "Unused", "Unused"
};
static const std::vector<std::string> gfx_names = {"Sprite Sheet 0",
"Sprite Sheet 1",
"Sprite Sheet 2",
"Sprite Sheet 3",
"Sprite Sheet 4",
"Sprite Sheet 5",
"Sprite Sheet 6",
"Sprite Sheet 7",
"Sprite Sheet 8",
"Sprite Sheet 9",
"Sprite Sheet A",
"Sprite Sheet B",
"Sprite Sheet C",
"Sprite Sheet D",
"Sprite Sheet E",
"Sprite Sheet F",
"Link's Sprites",
"Sword Sprites",
"Shield Sprites",
"Common Sprites",
"Boss Sprites",
"NPC Sprites",
"Enemy Sprites 1",
"Enemy Sprites 2",
"Item Sprites",
"Dungeon Objects",
"Overworld Objects",
"Interface",
"Font",
"Credits",
"Unused",
"Unused"};
return gfx_names;
}
// Room object names - these are large, so we'll delegate to a helper
namespace {
std::vector<std::string> ConvertArrayToVector(const char** array, size_t size) {
std::vector<std::string> result;
result.reserve(size);
for (size_t i = 0; i < size; ++i) {
result.emplace_back(array[i]);
}
return result;
std::vector<std::string> ConvertArrayToVector(const char** array, size_t size) {
std::vector<std::string> result;
result.reserve(size);
for (size_t i = 0; i < size; ++i) {
result.emplace_back(array[i]);
}
return result;
}
} // namespace
const std::vector<std::string>& Zelda3Labels::GetType1RoomObjectNames() {
static const std::vector<std::string> names = []() {
std::vector<std::string> result;
// Note: Type1RoomObjectNames is constexpr, we need to count its size
// For now, we'll add known objects. In full implementation,
// For now, we'll add known objects. In full implementation,
// we'd import from room_object.h
result = {
"Ceiling ↔", "Wall (top, north) ↔", "Wall (top, south) ↔",
"Wall (bottom, north) ↔", "Wall (bottom, south) ↔", "Wall columns (north) ↔",
"Wall columns (south) ↔", "Deep wall (north) ↔", "Deep wall (south) ↔",
"Diagonal wall A ◤ (top) ↔", "Diagonal wall A ◣ (top) ↔",
"Diagonal wall A ◥ (top) ↔", "Diagonal wall A ◢ (top) ↔",
// ... Add all Type1 objects here
"Ceiling ↔",
"Wall (top, north) ↔",
"Wall (top, south) ↔",
"Wall (bottom, north) ↔",
"Wall (bottom, south) ↔",
"Wall columns (north) ↔",
"Wall columns (south) ↔",
"Deep wall (north) ↔",
"Deep wall (south) ↔",
"Diagonal wall A ◤ (top) ↔",
"Diagonal wall A ◣ (top) ↔",
"Diagonal wall A ◥ (top) ↔",
"Diagonal wall A ◢ (top) ↔",
// ... Add all Type1 objects here
};
return result;
}();
@@ -236,137 +383,172 @@ const std::vector<std::string>& Zelda3Labels::GetRoomEffectNames() {
// Room tag names
const std::vector<std::string>& Zelda3Labels::GetRoomTagNames() {
static const std::vector<std::string> tag_names = {
"No Tag", "NW", "NE", "SW", "SE",
"West", "East", "North", "South",
"Entrance", "Treasure", "Boss", "Dark"
};
"No Tag", "NW", "NE", "SW", "SE", "West", "East",
"North", "South", "Entrance", "Treasure", "Boss", "Dark"};
return tag_names;
}
// Tile type names
const std::vector<std::string>& Zelda3Labels::GetTileTypeNames() {
static const std::vector<std::string> tile_names = {
"Nothing (standard floor)", "Nothing (unused?)", "Collision",
"Collision (unknown types)", "Collision", "Collision (unused?)",
"Collision", "Collision", "Deep water", "Shallow water",
"Unknown (near water/pit edges)", "Collision (water/pit edges)",
"Overlay mask", "Spike floor", "GT ice", "Ice palace ice",
"Slope ◤", "Slope ◥", "Slope ◣", "Slope ◢",
"Nothing (unused?)", "Nothing (unused?)", "Nothing (unused?)",
"Slope ◤", "Slope ◥", "Slope ◣", "Slope ◢",
"Layer swap", "Pit", "Manual stairs", "Pot switch", "Pressure switch",
"Blocks switch (chest, PoD, walls)", "Layer toggle", "Layer 2 overlay",
"North single-layer auto stairs", "North layer swap auto stairs",
"South single-layer auto stairs", "South layer swap auto stairs",
"North/south layer swap auto stairs", "North/south single-layer auto stairs",
"West single-layer auto stairs", "West layer swap auto stairs",
"East single-layer auto stairs", "East layer swap auto stairs",
"East/west layer swap auto stairs", "East/west single-layer auto stairs",
"Nothing (stairs edge)", "Straight inter-room stairs south/up",
"Straight inter-room stairs north/down", "Straight inter-room stairs south/down 2",
"Straight inter-room stairs north/up 2", "Star tile (inactive on GBA)",
"Collision (near stairs)", "Warp tile", "Square corners ⌜⌝⌞⌟",
"Thick corner ⌜", "Thick corner ⌝", "Thick corner ⌞", "Thick corner ⌟",
"Roof/grass tiles?", "Spike floor"
};
"Nothing (standard floor)",
"Nothing (unused?)",
"Collision",
"Collision (unknown types)",
"Collision",
"Collision (unused?)",
"Collision",
"Collision",
"Deep water",
"Shallow water",
"Unknown (near water/pit edges)",
"Collision (water/pit edges)",
"Overlay mask",
"Spike floor",
"GT ice",
"Ice palace ice",
"Slope ◤",
"Slope ◥",
"Slope ◣",
"Slope ◢",
"Nothing (unused?)",
"Nothing (unused?)",
"Nothing (unused?)",
"Slope ◤",
"Slope ◥",
"Slope ◣",
"Slope ◢",
"Layer swap",
"Pit",
"Manual stairs",
"Pot switch",
"Pressure switch",
"Blocks switch (chest, PoD, walls)",
"Layer toggle",
"Layer 2 overlay",
"North single-layer auto stairs",
"North layer swap auto stairs",
"South single-layer auto stairs",
"South layer swap auto stairs",
"North/south layer swap auto stairs",
"North/south single-layer auto stairs",
"West single-layer auto stairs",
"West layer swap auto stairs",
"East single-layer auto stairs",
"East layer swap auto stairs",
"East/west layer swap auto stairs",
"East/west single-layer auto stairs",
"Nothing (stairs edge)",
"Straight inter-room stairs south/up",
"Straight inter-room stairs north/down",
"Straight inter-room stairs south/down 2",
"Straight inter-room stairs north/up 2",
"Star tile (inactive on GBA)",
"Collision (near stairs)",
"Warp tile",
"Square corners ⌜⌝⌞⌟",
"Thick corner ⌜",
"Thick corner ⌝",
"Thick corner ⌞",
"Thick corner ⌟",
"Roof/grass tiles?",
"Spike floor"};
return tile_names;
}
// Convert all labels to structured map for project embedding
std::unordered_map<std::string, std::unordered_map<std::string, std::string>>
std::unordered_map<std::string, std::unordered_map<std::string, std::string>>
Zelda3Labels::ToResourceLabels() {
std::unordered_map<std::string, std::unordered_map<std::string, std::string>> labels;
std::unordered_map<std::string, std::unordered_map<std::string, std::string>>
labels;
// Rooms
const auto& rooms = GetRoomNames();
for (size_t i = 0; i < rooms.size(); ++i) {
labels["room"][std::to_string(i)] = rooms[i];
}
// Entrances
const auto& entrances = GetEntranceNames();
for (size_t i = 0; i < entrances.size(); ++i) {
labels["entrance"][std::to_string(i)] = entrances[i];
}
// Sprites
const auto& sprites = GetSpriteNames();
for (size_t i = 0; i < sprites.size(); ++i) {
labels["sprite"][std::to_string(i)] = sprites[i];
}
// Overlords
const auto& overlords = GetOverlordNames();
for (size_t i = 0; i < overlords.size(); ++i) {
labels["overlord"][std::to_string(i)] = overlords[i];
}
// Overworld maps
const auto& maps = GetOverworldMapNames();
for (size_t i = 0; i < maps.size(); ++i) {
labels["overworld_map"][std::to_string(i)] = maps[i];
}
// Items
const auto& items = GetItemNames();
for (size_t i = 0; i < items.size(); ++i) {
labels["item"][std::to_string(i)] = items[i];
}
// Music tracks
const auto& music = GetMusicTrackNames();
for (size_t i = 0; i < music.size(); ++i) {
labels["music"][std::to_string(i)] = music[i];
}
// Graphics sheets
const auto& gfx = GetGraphicsSheetNames();
for (size_t i = 0; i < gfx.size(); ++i) {
labels["graphics"][std::to_string(i)] = gfx[i];
}
// Room effects
const auto& effects = GetRoomEffectNames();
for (size_t i = 0; i < effects.size(); ++i) {
labels["room_effect"][std::to_string(i)] = effects[i];
}
// Room tags
const auto& tags = GetRoomTagNames();
for (size_t i = 0; i < tags.size(); ++i) {
labels["room_tag"][std::to_string(i)] = tags[i];
}
// Tile types
const auto& tiles = GetTileTypeNames();
for (size_t i = 0; i < tiles.size(); ++i) {
labels["tile_type"][std::to_string(i)] = tiles[i];
}
return labels;
}
// Get a label by resource type and ID
std::string Zelda3Labels::GetLabel(const std::string& resource_type, int id,
const std::string& default_value) {
const std::string& default_value) {
static auto labels = ToResourceLabels();
auto type_it = labels.find(resource_type);
if (type_it == labels.end()) {
return default_value.empty()
? resource_type + "_" + std::to_string(id)
: default_value;
return default_value.empty() ? resource_type + "_" + std::to_string(id)
: default_value;
}
auto label_it = type_it->second.find(std::to_string(id));
if (label_it == type_it->second.end()) {
return default_value.empty()
? resource_type + "_" + std::to_string(id)
: default_value;
return default_value.empty() ? resource_type + "_" + std::to_string(id)
: default_value;
}
return label_it->second;
}
} // namespace zelda3
} // namespace yaze
} // namespace yaze::zelda3