yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
zelda3_labels.cc
Go to the documentation of this file.
2
3#include "app/zelda3/common.h"
7
8namespace yaze {
9namespace zelda3 {
10
11// Room names - reuse existing kRoomNames array
12const std::vector<std::string>& Zelda3Labels::GetRoomNames() {
13 static std::vector<std::string> room_names;
14 if (room_names.empty()) {
15 for (const auto& name : kRoomNames) {
16 room_names.emplace_back(name);
17 }
18 }
19 return room_names;
20}
21
22// Entrance names - reuse existing kEntranceNames array
23const std::vector<std::string>& Zelda3Labels::GetEntranceNames() {
24 static std::vector<std::string> entrance_names;
25 if (entrance_names.empty()) {
26 for (const auto& name : kEntranceNames) {
27 entrance_names.emplace_back(name);
28 }
29 }
30 return entrance_names;
31}
32
33// Sprite names - reuse existing kSpriteDefaultNames array
34const std::vector<std::string>& Zelda3Labels::GetSpriteNames() {
35 static std::vector<std::string> sprite_names;
36 if (sprite_names.empty()) {
37 for (const auto& name : kSpriteDefaultNames) {
38 sprite_names.push_back(name);
39 }
40 }
41 return sprite_names;
42}
43
44// Overlord names - reuse existing kOverlordNames array
45const std::vector<std::string>& Zelda3Labels::GetOverlordNames() {
46 static std::vector<std::string> overlord_names;
47 if (overlord_names.empty()) {
48 for (const auto& name : kOverlordNames) {
49 overlord_names.push_back(name);
50 }
51 }
52 return overlord_names;
53}
54
55// Overworld map names (64 Light World + 64 Dark World + 32 Special Areas)
56const std::vector<std::string>& Zelda3Labels::GetOverworldMapNames() {
57 static const std::vector<std::string> map_names = {
58 // Light World (0x00-0x3F)
59 "Lost Woods", "Master Sword Pedestal", "Castle Courtyard", "Link's House",
60 "Eastern Palace", "Desert Palace", "Hyrule Castle", "Witch's Hut",
61 "Kakariko Village", "Death Mountain", "Tower of Hera", "Spectacle Rock",
62 "Graveyard", "Sanctuary", "Lake Hylia", "Desert of Mystery",
63 "Eastern Ruins", "Zora's Domain", "Catfish", "Dam",
64 "Potion Shop", "Kakariko Well", "Blacksmith", "Sick Kid",
65 "Library", "Mushroom", "Magic Bat", "Fairy Fountain",
66 "Fortune Teller", "Lake Shop", "Bomb Shop", "Cave 45",
67 "Checkerboard Cave", "Mini Moldorm Cave", "Ice Rod Cave", "Bonk Rocks",
68 "Bottle Merchant", "Sahasrahla's Hut", "Chicken House", "Aginah's Cave",
69 "Dam Exterior", "Mimic Cave Exterior", "Waterfall Fairy", "Pyramid",
70 "Fat Fairy", "Spike Cave", "Hookshot Cave", "Graveyard Ledge",
71 "Dark Lumberjacks", "Bumper Cave", "Skull Woods 1", "Skull Woods 2",
72 "Skull Woods 3", "Skull Woods 4", "Skull Woods 5", "Skull Woods 6",
73 "Skull Woods 7", "Skull Woods 8", "Ice Palace Exterior", "Misery Mire Exterior",
74 "Palace of Darkness Exterior", "Swamp Palace Exterior", "Turtle Rock Exterior", "Thieves' Town Exterior",
75
76 // Dark World (0x40-0x7F)
77 "Dark Woods", "Dark Chapel", "Dark Castle", "Dark Shields",
78 "Dark Palace", "Dark Desert", "Dark Castle Gate", "Dark Witch",
79 "Dark Village", "Dark Mountain", "Dark Tower", "Dark Rocks",
80 "Dark Graveyard", "Dark Sanctuary", "Dark Lake", "Dark Desert South",
81 "Dark Eastern", "Dark Zora", "Dark Catfish", "Dark Dam",
82 "Dark Shop", "Dark Well", "Dark Blacksmith", "Dark Sick Kid",
83 "Dark Library", "Dark Mushroom", "Dark Bat", "Dark Fountain",
84 "Dark Fortune", "Dark Lake Shop", "Dark Bomb Shop", "Dark Cave 45",
85 "Dark Checker", "Dark Mini Moldorm", "Dark Ice Rod", "Dark Bonk",
86 "Dark Bottle", "Dark Sahasrahla", "Dark Chicken", "Dark Aginah",
87 "Dark Dam Exit", "Dark Mimic Exit", "Dark Waterfall", "Pyramid Top",
88 "Dark Fat Fairy", "Dark Spike Cave", "Dark Hookshot", "Dark Graveyard Ledge",
89 "Lumberjack House", "Dark Bumper", "Skull Woods A", "Skull Woods B",
90 "Skull Woods C", "Skull Woods D", "Skull Woods E", "Skull Woods F",
91 "Skull Woods G", "Skull Woods H", "Ice Palace Entry", "Misery Mire Entry",
92 "Palace of Darkness Entry", "Swamp Palace Entry", "Turtle Rock Entry", "Thieves' Town Entry",
93
94 // Special Areas (0x80-0x9F)
95 "Special Area 1", "Special Area 2", "Special Area 3", "Special Area 4",
96 "Special Area 5", "Special Area 6", "Special Area 7", "Special Area 8",
97 "Special Area 9", "Special Area 10", "Special Area 11", "Special Area 12",
98 "Special Area 13", "Special Area 14", "Special Area 15", "Special Area 16",
99 "Special Area 17", "Special Area 18", "Special Area 19", "Special Area 20",
100 "Special Area 21", "Special Area 22", "Special Area 23", "Special Area 24",
101 "Special Area 25", "Special Area 26", "Special Area 27", "Special Area 28",
102 "Special Area 29", "Special Area 30", "Special Area 31", "Special Area 32"
103 };
104 return map_names;
105}
106
107// Item names (complete item list)
108const std::vector<std::string>& Zelda3Labels::GetItemNames() {
109 static const std::vector<std::string> item_names = {
110 "None", "Fighter Sword", "Master Sword", "Tempered Sword",
111 "Golden Sword", "Fighter Shield", "Fire Shield", "Mirror Shield",
112 "Fire Rod", "Ice Rod", "Hammer", "Hookshot",
113 "Bow", "Boomerang", "Powder", "Bee Badge",
114 "Bombos Medallion", "Ether Medallion", "Quake Medallion", "Lamp",
115 "Shovel", "Flute", "Somaria Cane", "Bottle",
116 "Heart Piece", "Byrna Cane", "Cape", "Mirror",
117 "Power Glove", "Titan Mitt", "Book of Mudora", "Zora Flippers",
118 "Moon Pearl", "Crystal", "Bug Net", "Blue Mail",
119 "Red Mail", "Key", "Compass", "Heart Container",
120 "Bomb", "3 Bombs", "Mushroom", "Red Boomerang",
121 "Red Potion", "Green Potion", "Blue Potion", "Red Potion (Refill)",
122 "Green Potion (Refill)", "Blue Potion (Refill)", "10 Bombs", "Big Key",
123 "Map", "1 Rupee", "5 Rupees", "20 Rupees",
124 "Pendant of Courage", "Pendant of Wisdom", "Pendant of Power", "Bow and Arrows",
125 "Silver Arrows Upgrade", "Bee", "Fairy", "Heart Container (Boss)",
126 "Heart", "1 Arrow", "10 Arrows", "Magic",
127 "Small Magic", "300 Rupees", "20 Rupees (Green)", "100 Rupees",
128 "50 Rupees", "Heart Container (Sanctuary)", "Arrow Refill (5)", "Arrow Refill (10)",
129 "Bomb Refill (1)", "Bomb Refill (4)", "Bomb Refill (8)", "Blue Shield (Refill)",
130 "Magic Upgrade (1/2)", "Magic Upgrade (1/4)", "Programmable Item 1", "Programmable Item 2",
131 "Programmable Item 3", "Silvers", "Rupoor", "Null Item",
132 "Red Clock", "Blue Clock", "Green Clock", "Progressive Sword",
133 "Progressive Shield", "Progressive Armor", "Progressive Lifting Glove", "RNG Item (Single)",
134 "RNG Item (Multi)", "Progressive Bow", "Progressive Bow (Alt)", "Aga Pendant",
135 "Pendant (Green)", "Blue Pendant", "Good Bee", "Tossed Key"
136 };
137 return item_names;
138}
139
140// Music track names
141const std::vector<std::string>& Zelda3Labels::GetMusicTrackNames() {
142 static const std::vector<std::string> music_names = {
143 "Nothing", "Light World", "Beginning", "Rabbit",
144 "Forest", "Intro", "Town", "Warp",
145 "Dark World", "Master Sword", "File Select", "Soldier",
146 "Boss", "Dark World Death Mountain", "Minigame", "Skull Woods",
147 "Indoor", "Cave 1", "Zelda's Rescue", "Crystal",
148 "Shop", "Cave 2", "Game Over", "Boss Victory",
149 "Sanctuary", "Boss Victory (Short)", "Dark World Woods", "Pendant",
150 "Ganon's Message", "Hyrule Castle", "Light World Death Mountain", "Eastern Palace",
151 "Desert Palace", "Agahnim's Theme", "Damp Dungeon", "Ganon Reveals",
152 "Confrontation", "Ganon's Theme", "Triforce", "Credits",
153 "Unused", "Unused", "Unused", "Unused",
154 "Unused", "Unused", "Unused", "Unused"
155 };
156 return music_names;
157}
158
159// Graphics sheet names
160const std::vector<std::string>& Zelda3Labels::GetGraphicsSheetNames() {
161 static const std::vector<std::string> gfx_names = {
162 "Sprite Sheet 0", "Sprite Sheet 1", "Sprite Sheet 2", "Sprite Sheet 3",
163 "Sprite Sheet 4", "Sprite Sheet 5", "Sprite Sheet 6", "Sprite Sheet 7",
164 "Sprite Sheet 8", "Sprite Sheet 9", "Sprite Sheet A", "Sprite Sheet B",
165 "Sprite Sheet C", "Sprite Sheet D", "Sprite Sheet E", "Sprite Sheet F",
166 "Link's Sprites", "Sword Sprites", "Shield Sprites", "Common Sprites",
167 "Boss Sprites", "NPC Sprites", "Enemy Sprites 1", "Enemy Sprites 2",
168 "Item Sprites", "Dungeon Objects", "Overworld Objects", "Interface",
169 "Font", "Credits", "Unused", "Unused"
170 };
171 return gfx_names;
172}
173
174// Room object names - these are large, so we'll delegate to a helper
175namespace {
176 std::vector<std::string> ConvertArrayToVector(const char** array, size_t size) {
177 std::vector<std::string> result;
178 result.reserve(size);
179 for (size_t i = 0; i < size; ++i) {
180 result.emplace_back(array[i]);
181 }
182 return result;
183 }
184}
185
186const std::vector<std::string>& Zelda3Labels::GetType1RoomObjectNames() {
187 static const std::vector<std::string> names = []() {
188 std::vector<std::string> result;
189 // Note: Type1RoomObjectNames is constexpr, we need to count its size
190 // For now, we'll add known objects. In full implementation,
191 // we'd import from room_object.h
192 result = {
193 "Ceiling ↔", "Wall (top, north) ↔", "Wall (top, south) ↔",
194 "Wall (bottom, north) ↔", "Wall (bottom, south) ↔", "Wall columns (north) ↔",
195 "Wall columns (south) ↔", "Deep wall (north) ↔", "Deep wall (south) ↔",
196 "Diagonal wall A ◤ (top) ↔", "Diagonal wall A ◣ (top) ↔",
197 "Diagonal wall A ◥ (top) ↔", "Diagonal wall A ◢ (top) ↔",
198 // ... Add all Type1 objects here
199 };
200 return result;
201 }();
202 return names;
203}
204
205const std::vector<std::string>& Zelda3Labels::GetType2RoomObjectNames() {
206 static const std::vector<std::string> names = []() {
207 std::vector<std::string> result;
208 // Add Type2 room objects
209 result = {"Type2 Object 1", "Type2 Object 2" /* ... */};
210 return result;
211 }();
212 return names;
213}
214
215const std::vector<std::string>& Zelda3Labels::GetType3RoomObjectNames() {
216 static const std::vector<std::string> names = []() {
217 std::vector<std::string> result;
218 // Add Type3 room objects
219 result = {"Type3 Object 1", "Type3 Object 2" /* ... */};
220 return result;
221 }();
222 return names;
223}
224
225// Room effect names - reuse existing RoomEffect array
226const std::vector<std::string>& Zelda3Labels::GetRoomEffectNames() {
227 static std::vector<std::string> effect_names;
228 if (effect_names.empty()) {
229 for (const auto& name : RoomEffect) {
230 effect_names.push_back(name);
231 }
232 }
233 return effect_names;
234}
235
236// Room tag names
237const std::vector<std::string>& Zelda3Labels::GetRoomTagNames() {
238 static const std::vector<std::string> tag_names = {
239 "No Tag", "NW", "NE", "SW", "SE",
240 "West", "East", "North", "South",
241 "Entrance", "Treasure", "Boss", "Dark"
242 };
243 return tag_names;
244}
245
246// Tile type names
247const std::vector<std::string>& Zelda3Labels::GetTileTypeNames() {
248 static const std::vector<std::string> tile_names = {
249 "Nothing (standard floor)", "Nothing (unused?)", "Collision",
250 "Collision (unknown types)", "Collision", "Collision (unused?)",
251 "Collision", "Collision", "Deep water", "Shallow water",
252 "Unknown (near water/pit edges)", "Collision (water/pit edges)",
253 "Overlay mask", "Spike floor", "GT ice", "Ice palace ice",
254 "Slope ◤", "Slope ◥", "Slope ◣", "Slope ◢",
255 "Nothing (unused?)", "Nothing (unused?)", "Nothing (unused?)",
256 "Slope ◤", "Slope ◥", "Slope ◣", "Slope ◢",
257 "Layer swap", "Pit", "Manual stairs", "Pot switch", "Pressure switch",
258 "Blocks switch (chest, PoD, walls)", "Layer toggle", "Layer 2 overlay",
259 "North single-layer auto stairs", "North layer swap auto stairs",
260 "South single-layer auto stairs", "South layer swap auto stairs",
261 "North/south layer swap auto stairs", "North/south single-layer auto stairs",
262 "West single-layer auto stairs", "West layer swap auto stairs",
263 "East single-layer auto stairs", "East layer swap auto stairs",
264 "East/west layer swap auto stairs", "East/west single-layer auto stairs",
265 "Nothing (stairs edge)", "Straight inter-room stairs south/up",
266 "Straight inter-room stairs north/down", "Straight inter-room stairs south/down 2",
267 "Straight inter-room stairs north/up 2", "Star tile (inactive on GBA)",
268 "Collision (near stairs)", "Warp tile", "Square corners ⌜⌝⌞⌟",
269 "Thick corner ⌜", "Thick corner ⌝", "Thick corner ⌞", "Thick corner ⌟",
270 "Roof/grass tiles?", "Spike floor"
271 };
272 return tile_names;
273}
274
275// Convert all labels to structured map for project embedding
276std::unordered_map<std::string, std::unordered_map<std::string, std::string>>
278 std::unordered_map<std::string, std::unordered_map<std::string, std::string>> labels;
279
280 // Rooms
281 const auto& rooms = GetRoomNames();
282 for (size_t i = 0; i < rooms.size(); ++i) {
283 labels["room"][std::to_string(i)] = rooms[i];
284 }
285
286 // Entrances
287 const auto& entrances = GetEntranceNames();
288 for (size_t i = 0; i < entrances.size(); ++i) {
289 labels["entrance"][std::to_string(i)] = entrances[i];
290 }
291
292 // Sprites
293 const auto& sprites = GetSpriteNames();
294 for (size_t i = 0; i < sprites.size(); ++i) {
295 labels["sprite"][std::to_string(i)] = sprites[i];
296 }
297
298 // Overlords
299 const auto& overlords = GetOverlordNames();
300 for (size_t i = 0; i < overlords.size(); ++i) {
301 labels["overlord"][std::to_string(i)] = overlords[i];
302 }
303
304 // Overworld maps
305 const auto& maps = GetOverworldMapNames();
306 for (size_t i = 0; i < maps.size(); ++i) {
307 labels["overworld_map"][std::to_string(i)] = maps[i];
308 }
309
310 // Items
311 const auto& items = GetItemNames();
312 for (size_t i = 0; i < items.size(); ++i) {
313 labels["item"][std::to_string(i)] = items[i];
314 }
315
316 // Music tracks
317 const auto& music = GetMusicTrackNames();
318 for (size_t i = 0; i < music.size(); ++i) {
319 labels["music"][std::to_string(i)] = music[i];
320 }
321
322 // Graphics sheets
323 const auto& gfx = GetGraphicsSheetNames();
324 for (size_t i = 0; i < gfx.size(); ++i) {
325 labels["graphics"][std::to_string(i)] = gfx[i];
326 }
327
328 // Room effects
329 const auto& effects = GetRoomEffectNames();
330 for (size_t i = 0; i < effects.size(); ++i) {
331 labels["room_effect"][std::to_string(i)] = effects[i];
332 }
333
334 // Room tags
335 const auto& tags = GetRoomTagNames();
336 for (size_t i = 0; i < tags.size(); ++i) {
337 labels["room_tag"][std::to_string(i)] = tags[i];
338 }
339
340 // Tile types
341 const auto& tiles = GetTileTypeNames();
342 for (size_t i = 0; i < tiles.size(); ++i) {
343 labels["tile_type"][std::to_string(i)] = tiles[i];
344 }
345
346 return labels;
347}
348
349// Get a label by resource type and ID
350std::string Zelda3Labels::GetLabel(const std::string& resource_type, int id,
351 const std::string& default_value) {
352 static auto labels = ToResourceLabels();
353
354 auto type_it = labels.find(resource_type);
355 if (type_it == labels.end()) {
356 return default_value.empty()
357 ? resource_type + "_" + std::to_string(id)
358 : default_value;
359 }
360
361 auto label_it = type_it->second.find(std::to_string(id));
362 if (label_it == type_it->second.end()) {
363 return default_value.empty()
364 ? resource_type + "_" + std::to_string(id)
365 : default_value;
366 }
367
368 return label_it->second;
369}
370
371} // namespace zelda3
372} // namespace yaze
std::vector< std::string > ConvertArrayToVector(const char **array, size_t size)
constexpr std::string_view kRoomNames[]
Definition room.h:484
constexpr const char * kEntranceNames[]
Definition common.h:47
Main namespace for the application.
static const std::vector< std::string > & GetRoomNames()
static const std::vector< std::string > & GetItemNames()
static std::unordered_map< std::string, std::unordered_map< std::string, std::string > > ToResourceLabels()
Convert all labels to a structured map for project embedding.
static const std::vector< std::string > & GetEntranceNames()
static const std::vector< std::string > & GetType2RoomObjectNames()
static const std::vector< std::string > & GetType1RoomObjectNames()
static const std::vector< std::string > & GetGraphicsSheetNames()
static const std::vector< std::string > & GetMusicTrackNames()
static const std::vector< std::string > & GetTileTypeNames()
static const std::vector< std::string > & GetOverlordNames()
static const std::vector< std::string > & GetSpriteNames()
static const std::vector< std::string > & GetOverworldMapNames()
static const std::vector< std::string > & GetType3RoomObjectNames()
static std::string GetLabel(const std::string &resource_type, int id, const std::string &default_value="")
Get a label by resource type and ID.
static const std::vector< std::string > & GetRoomEffectNames()
static const std::vector< std::string > & GetRoomTagNames()