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