yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
overworld_map.cc
Go to the documentation of this file.
1#include "overworld_map.h"
2
3#include <algorithm>
4#include <array>
5#include <cstddef>
6#include <cstdint>
7#include <unordered_map>
8#include <vector>
9
10#include "absl/status/status.h"
11#include "absl/status/statusor.h"
15#include "rom/rom.h"
16#include "core/features.h"
17#include "util/macro.h"
18#include "zelda3/common.h"
21
22namespace yaze::zelda3 {
23
24OverworldMap::OverworldMap(int index, Rom* rom, GameData* game_data)
25 : index_(index), parent_(index), rom_(rom), game_data_(game_data) {
27
28 // Load parent ID from ROM data for all versions
29 // This is critical for proper large map sibling coordination
31 if (version >= OverworldVersion::kZSCustomV3) {
32 // For v3+, parent ID is stored in expanded table (0x140998) with 160 entries
34 } else {
35 // For vanilla/v1/v2, parent ID table at 0x125EC only has 64 entries (LW only)
36 // DW maps mirror LW parents with +0x40 offset
37 // SW maps use hardcoded parent values based on vanilla game behavior
39 // Light World: direct lookup from 64-entry table
41 } else if (index_ < kSpecialWorldMapIdStart) {
42 // Dark World: mirror LW parent structure with +0x40 offset
43 // DW map 0x43's parent = LW map 0x03's parent (from table) + 0x40
44 uint8_t lw_equivalent = index_ - kDarkWorldMapIdStart;
45 uint8_t lw_parent = (*rom_)[kOverworldMapParentId + lw_equivalent];
46 parent_ = lw_parent + kDarkWorldMapIdStart;
47 } else {
48 // Special World: hardcoded parents for vanilla compatibility
49 // Zora's Domain (0x81, 0x82, 0x89, 0x8A) is a large area with parent 0x81
50 if (index_ == 0x81 || index_ == 0x82 || index_ == 0x89 || index_ == 0x8A) {
51 parent_ = 0x81;
52 } else {
53 // All other SW maps are small areas - parent is self
55 }
56 }
57 }
58
59 if (version != OverworldVersion::kVanilla) {
60 // For ALL custom ASM versions (v1-v3), read from custom arrays
61 // SetupCustomTileset checks enable flags and falls back to vanilla if disabled
63 } else if (core::FeatureFlags::get().overworld.kLoadCustomOverworld) {
64 // Pure vanilla ROM but flag enabled - set up hardcoded vanilla defaults
66 }
67 // For pure vanilla ROMs, LoadAreaInfo already handles everything
68}
69
70absl::Status OverworldMap::BuildMap(int count, int game_state, int world,
71 std::vector<gfx::Tile16>& tiles16,
72 OverworldBlockset& world_blockset) {
73 // Delegate to cached version with no cache
74 return BuildMapWithCache(count, game_state, world, tiles16, world_blockset,
75 nullptr);
76}
77
79 int count, int game_state, int world, std::vector<gfx::Tile16>& tiles16,
80 OverworldBlockset& world_blockset,
81 const std::vector<uint8_t>* cached_tileset) {
83 world_ = world;
85
86 // For large maps in vanilla ROMs, we need to handle special world graphics
87 // This ensures proper rendering of special overworld areas like Zora's Domain
88 if (large_map_ && (version == OverworldVersion::kVanilla)) {
89 if (parent_ != index_ && !initialized_) {
90 if (index_ >= kSpecialWorldMapIdStart && index_ <= 0x8A &&
91 index_ != 0x88) {
92 // Most special world areas use the special graphics group
96 } else if (index_ == 0x88) {
97 // Triforce room has special hardcoded values
98 area_graphics_ = 0x51;
99 area_palette_ = 0x00;
100 } else {
101 // Fallback to standard area graphics
104 }
105
106 initialized_ = true;
107 }
108 }
109
111
112 // Use cached tileset if available, otherwise build from scratch
113 if (cached_tileset && !cached_tileset->empty()) {
114 UseCachedTileset(*cached_tileset);
115 } else {
117 }
118
119 RETURN_IF_ERROR(BuildTiles16Gfx(tiles16, count))
122 RETURN_IF_ERROR(BuildBitmap(world_blockset))
123 built_ = true;
124 return absl::OkStatus();
125}
126
129
130 // ZSCustomOverworld ASM Version System:
131 // 0x00-0x02: Legacy versions with limited features
132 // 0x03: Current version with full area size expansion and custom data support
133 // 0xFF: Pure vanilla ROM (no ASM applied)
134
135 // Load message ID and area size based on ASM version
136 if (version < OverworldVersion::kZSCustomV2 ||
137 version == OverworldVersion::kVanilla) {
138 // v2 and vanilla: use original message table
139 message_id_ = (*rom_)[kOverworldMessageIds + (parent_ * 2)] |
140 ((*rom_)[kOverworldMessageIds + (parent_ * 2) + 1] << 8);
141
142 // Load area size for v2/vanilla
143 if (index_ < 0x80) {
144 // For LW and DW, check the screen size byte
145 // Note: v2 had a bug where large/small values were swapped
146 uint8_t size_byte = (*rom_)[kOverworldScreenSize + (index_ & 0x3F)];
147 switch (size_byte) {
148 case 0:
150 break;
151 case 1:
152 default:
154 break;
155 case 2:
157 break;
158 case 3:
160 break;
161 }
162 } else {
163 // For SW, use hardcoded values for v2 compatibility
164 // Zora's Domain areas (0x81, 0x82, 0x89, 0x8A) are large areas
165 area_size_ =
166 (index_ == 0x81 || index_ == 0x82 || index_ == 0x89 || index_ == 0x8A)
169 }
170 } else {
171 // v3: use expanded message table and area size table
172 // All area sizes are now stored in the expanded table, supporting all size
173 // types
175 (*rom_)[kOverworldMessagesExpanded + (parent_ * 2)] |
176 ((*rom_)[kOverworldMessagesExpanded + (parent_ * 2) + 1] << 8);
177 area_size_ =
178 static_cast<AreaSizeEnum>((*rom_)[kOverworldScreenSize + index_]);
179 }
180
181 // Update large_map_ based on area size
183
184 // Load area-specific data based on index range
186 // Light World (LW) areas
192
195
197 sprite_palette_[1] =
199 sprite_palette_[2] =
201
206
207 // For v2/vanilla, use original palette table
208 if (version < OverworldVersion::kZSCustomV2 ||
209 version == OverworldVersion::kVanilla) {
211 }
212 } else if (index_ < kSpecialWorldMapIdStart) {
213 // Dark World (DW) areas
220
223
224 sprite_palette_[0] =
226 sprite_palette_[1] =
228 sprite_palette_[2] =
230
231 area_music_[0] =
233
234 // For v2/vanilla, use original palette table
235 if (version < OverworldVersion::kZSCustomV2 ||
236 version == OverworldVersion::kVanilla) {
238 }
239 } else {
240 // Special World (SW) areas (index >= 0x80)
241 // Message ID already loaded above based on ASM version
242
243 // For v3, use expanded sprite tables with full customization support
244 if (version == OverworldVersion::kZSCustomV3) {
254
261 } else {
262 // For v2/vanilla, use original sprite tables
269
276 }
277
280
281 // For v2/vanilla, use original palette table and handle special cases
282 // These hardcoded cases are needed for vanilla compatibility
283 if (version < OverworldVersion::kZSCustomV2 ||
284 version == OverworldVersion::kVanilla) {
286
287 // Handle special world area cases based on ZScream documentation
288 if (index_ == 0x88 || index_ == 0x93) {
289 // Triforce room - special graphics and palette
290 area_graphics_ = 0x51;
291 area_palette_ = 0x00;
292 } else if (index_ == 0x80) {
293 // Master Sword area - use special graphics group
297 } else if (index_ == 0x81 || index_ == 0x82 || index_ == 0x89 ||
298 index_ == 0x8A) {
299 // Zora's Domain areas - use special sprite graphics and area graphics
300 // Note: These are the large area maps that were causing crashes
301 sprite_graphics_[0] = 0x0E;
302 sprite_graphics_[1] = 0x0E;
303 sprite_graphics_[2] = 0x0E;
304
308 } else if (index_ == 0x94) {
309 // Make this the same GFX as the true master sword area
311 (0x80 - kSpecialWorldMapIdStart)];
313 } else if (index_ == 0x95) {
314 // Make this the same GFX as the LW death mountain areas
315 area_graphics_ = (*rom_)[kAreaGfxIdPtr + 0x03];
316 area_palette_ = (*rom_)[kOverworldMapPaletteIds + 0x03];
317 } else if (index_ == 0x96) {
318 // Make this the same GFX as the pyramid areas
319 area_graphics_ = (*rom_)[kAreaGfxIdPtr + 0x5B];
320 area_palette_ = (*rom_)[kOverworldMapPaletteIds + 0x5B];
321 } else if (index_ == 0x9C) {
322 // Make this the same GFX as the DW death mountain areas
323 area_graphics_ = (*rom_)[kAreaGfxIdPtr + 0x43];
324 area_palette_ = (*rom_)[kOverworldMapPaletteIds + 0x43];
325 } else {
326 // Default case - use basic graphics
327 area_graphics_ = (*rom_)[kAreaGfxIdPtr + 0x00];
328 area_palette_ = (*rom_)[kOverworldMapPaletteIds + 0x00];
329 }
330 }
331 }
332}
333
335 // Set the main palette values based on ZScream logic
336 // Use parent_ to ensure all sibling maps in a large area share the same palette
337 if (parent_ < 0x40 || parent_ == 0x95) { // LW
338 main_palette_ = 0;
339 } else if ((parent_ >= 0x40 && parent_ < 0x80) || parent_ == 0x96) { // DW
340 main_palette_ = 1;
341 } else if (parent_ >= 0x80 && parent_ < 0xA0) { // SW
342 main_palette_ = 0;
343 }
344
345 // Death Mountain / special overrides - use parent_ so siblings get correct palette
346 if (parent_ == 0x03 || parent_ == 0x05 ||
347 parent_ == 0x07) { // LW Death Mountain
348 main_palette_ = 2;
349 } else if (parent_ == 0x43 || parent_ == 0x45 ||
350 parent_ == 0x47) { // DW Death Mountain
351 main_palette_ = 3;
352 } else if (parent_ == 0x88 || parent_ == 0x93) { // Triforce room
353 main_palette_ = 4;
354 }
355
356 // Set the mosaic values based on ZScream logic
357 switch (index_) {
358 case 0x00: // Leaving Skull Woods / Lost Woods
359 case 0x40:
360 mosaic_expanded_ = {false, true, false, true};
361 break;
362 case 0x02: // Going into Skull woods / Lost Woods west
363 case 0x0A:
364 case 0x42:
365 case 0x4A:
366 mosaic_expanded_ = {false, false, true, false};
367 break;
368 case 0x0F: // Going into Zora's Domain North
369 case 0x10: // Going into Skull Woods / Lost Woods North
370 case 0x11:
371 case 0x50:
372 case 0x51:
373 mosaic_expanded_ = {true, false, false, false};
374 break;
375 case 0x80: // Leaving Zora's Domain, the Master Sword area, and the
376 // Triforce area
377 case 0x81:
378 case 0x88:
379 mosaic_expanded_ = {false, true, false, false};
380 break;
381 default:
382 mosaic_expanded_ = {false, false, false, false};
383 break;
384 }
385
386 // Set up world index for GFX groups
387 int index_world = 0x20;
390 index_world = 0x21;
391 } else if (parent_ == 0x88 || parent_ == 0x93) { // Triforce room
392 index_world = 0x24;
393 }
394
395 const auto overworld_gfx_groups2 = version_constants().kOverworldGfxGroups2;
396
397 // Main Blocksets
398 for (int i = 0; i < 8; i++) {
399 custom_gfx_ids_[i] =
400 (uint8_t)(*rom_)[overworld_gfx_groups2 + (index_world * 8) + i];
401 }
402
403 const auto overworldgfxGroups = version_constants().kOverworldGfxGroups1;
404
405 // Replace the variable tiles with the variable ones
406 uint8_t temp = (*rom_)[overworldgfxGroups + (area_graphics_ * 4)];
407 if (temp != 0) {
408 custom_gfx_ids_[3] = temp;
409 } else {
410 custom_gfx_ids_[3] = 0xFF;
411 }
412
413 temp = (*rom_)[overworldgfxGroups + (area_graphics_ * 4) + 1];
414 if (temp != 0) {
415 custom_gfx_ids_[4] = temp;
416 } else {
417 custom_gfx_ids_[4] = 0xFF;
418 }
419
420 temp = (*rom_)[overworldgfxGroups + (area_graphics_ * 4) + 2];
421 if (temp != 0) {
422 custom_gfx_ids_[5] = temp;
423 } else {
424 custom_gfx_ids_[5] = 0xFF;
425 }
426
427 temp = (*rom_)[overworldgfxGroups + (area_graphics_ * 4) + 3];
428 if (temp != 0) {
429 custom_gfx_ids_[6] = temp;
430 } else {
431 custom_gfx_ids_[6] = 0xFF;
432 }
433
434 // Set the animated GFX values - use parent_ so siblings get correct animated sheet
435 // Death Mountain uses sheet 0x59, others use 0x5B
436 if (parent_ == 0x03 || parent_ == 0x05 || parent_ == 0x07 || parent_ == 0x43 ||
437 parent_ == 0x45 || parent_ == 0x47 || parent_ == 0x95) {
438 animated_gfx_ = 0x59;
439 } else {
440 animated_gfx_ = 0x5B;
441 }
442
443 // Set the subscreen overlay values
444 subscreen_overlay_ = 0x00FF;
445
446 if (index_ == 0x00 || index_ == 0x01 || index_ == 0x08 || index_ == 0x09 ||
447 index_ == 0x40 || index_ == 0x41 || index_ == 0x48 ||
448 index_ == 0x49) { // Add fog 2 to the lost woods and skull woods
449 subscreen_overlay_ = 0x009D;
450 } else if (index_ == 0x03 || index_ == 0x04 || index_ == 0x0B ||
451 index_ == 0x0C || index_ == 0x05 || index_ == 0x06 ||
452 index_ == 0x0D || index_ == 0x0E ||
453 index_ == 0x07) { // Add the sky BG to LW death mountain
454 subscreen_overlay_ = 0x0095;
455 } else if (index_ == 0x43 || index_ == 0x44 || index_ == 0x4B ||
456 index_ == 0x4C || index_ == 0x45 || index_ == 0x46 ||
457 index_ == 0x4D || index_ == 0x4E ||
458 index_ == 0x47) { // Add the lava to DW death mountain
459 subscreen_overlay_ = 0x009C;
460 } else if (index_ == 0x5B || index_ == 0x5C || index_ == 0x63 ||
461 index_ == 0x64) { // TODO: Might need this one too "index == 0x1B"
462 // but for now I don't think so
463 subscreen_overlay_ = 0x0096;
464 } else if (index_ == 0x80) { // Add fog 1 to the master sword area
465 subscreen_overlay_ = 0x0097;
466 } else if (index_ ==
467 0x88) { // Add the triforce room curtains to the triforce room
468 subscreen_overlay_ = 0x0093;
469 }
470}
471
473 uint8_t palette = 0;
474
475 // Base world selection - use parent_ to ensure siblings share the same palette
476 if (parent_ < 0x40 || parent_ == 0x95) { // LW
477 palette = 0;
478 } else if ((parent_ >= 0x40 && parent_ < 0x80) || parent_ == 0x96) { // DW
479 palette = 1;
480 } else if (parent_ >= 0x80 && parent_ < 0xA0) { // SW
481 palette = 0;
482 }
483
484 // Death Mountain / special overrides - use parent_ to ensure all siblings
485 // in a large area get the correct palette (brown grass for DM)
486 // LW DM parents: 0x03, 0x05, 0x07 (children: 0x04, 0x06, 0x0B-0x0E)
487 // DW DM parents: 0x43, 0x45, 0x47 (children: 0x44, 0x46, 0x4B-0x4E)
488 if (parent_ == 0x03 || parent_ == 0x05 || parent_ == 0x07) {
489 palette = 2; // LW Death Mountain
490 } else if (parent_ == 0x43 || parent_ == 0x45 || parent_ == 0x47) {
491 palette = 3; // DW Death Mountain
492 } else if (parent_ == 0x88 || parent_ == 0x93) {
493 palette = 4; // Triforce room
494 }
495
496 return palette;
497}
498
499void OverworldMap::SetupCustomTileset(uint8_t asm_version) {
500 // Load area size for v3
503 uint8_t size_byte = (*rom_)[kOverworldScreenSize + index_];
504 area_size_ = static_cast<AreaSizeEnum>(size_byte);
506 }
507
508 // Main Palette - check enable flag before reading from custom array
509 if ((*rom_)[OverworldCustomMainPaletteEnabled] != 0x00) {
511 } else {
512 // Fall back to world-based hardcoded logic
514 }
515
516 // Mosaic - check enable flag before reading from custom array
517 if ((*rom_)[OverworldCustomMosaicEnabled] != 0x00) {
518 mosaic_ = (*rom_)[OverworldCustomMosaicArray + index_] != 0x00;
519 uint8_t mosaicByte = (*rom_)[OverworldCustomMosaicArray + index_];
520 mosaic_expanded_ = {(mosaicByte & 0x08) != 0x00,
521 (mosaicByte & 0x04) != 0x00,
522 (mosaicByte & 0x02) != 0x00,
523 (mosaicByte & 0x01) != 0x00};
524 } else {
525 // Fall back to hardcoded vanilla mosaic values
526 mosaic_ = false;
527 mosaic_expanded_ = {false, false, false, false};
528 switch (index_) {
529 case 0x00: // Leaving Skull Woods / Lost Woods
530 case 0x40:
531 mosaic_expanded_ = {false, true, false, true};
532 break;
533 case 0x02: // Going into Skull woods / Lost Woods west
534 case 0x0A:
535 case 0x42:
536 case 0x4A:
537 mosaic_expanded_ = {false, false, true, false};
538 break;
539 case 0x0F: // Going into Zora's Domain North
540 case 0x10: // Going into Skull Woods / Lost Woods North
541 case 0x11:
542 case 0x50:
543 case 0x51:
544 mosaic_expanded_ = {true, false, false, false};
545 break;
546 case 0x80: // Leaving Zora's Domain, Master Sword area, Triforce area
547 case 0x81:
548 case 0x88:
549 mosaic_expanded_ = {false, true, false, false};
550 break;
551 }
552 }
553
554 // Animated GFX - check enable flag before reading from custom array
555 if ((*rom_)[OverworldCustomAnimatedGFXEnabled] != 0x00) {
557 } else {
558 // Death mountain uses 0x59, others use 0x5B
559 // Use parent_ to ensure siblings in large areas share the same animated sheet
560 if (parent_ == 0x03 || parent_ == 0x05 || parent_ == 0x07 || parent_ == 0x43 ||
561 parent_ == 0x45 || parent_ == 0x47 || parent_ == 0x95) {
562 animated_gfx_ = 0x59;
563 } else {
564 animated_gfx_ = 0x5B;
565 }
566 }
567
568 // Tile GFX Groups - check enable flag before reading from custom array
570 for (int i = 0; i < 8; i++) {
571 custom_gfx_ids_[i] =
572 (*rom_)[OverworldCustomTileGFXGroupArray + (index_ * 8) + i];
573 }
574 } else {
575 // Fall back to world-based GFX groups
576 int index_world = 0x20;
579 index_world = 0x21;
580 } else if (parent_ == 0x88 || parent_ == 0x93) { // Triforce room
581 index_world = 0x24;
582 }
583
584 // Main Blocksets
585 for (int i = 0; i < 8; i++) {
586 custom_gfx_ids_[i] =
588 (index_world * 8) + i];
589 }
590
591 const auto overworldgfxGroups =
593
594 // Replace the variable tiles with the variable ones
595 // If the variable is 00 set it to 0xFF which is the new "don't load
596 // anything" value
597 uint8_t temp = (*rom_)[overworldgfxGroups + (area_graphics_ * 4)];
598 if (temp != 0x00) {
599 custom_gfx_ids_[3] = temp;
600 } else {
601 custom_gfx_ids_[3] = 0xFF;
602 }
603
604 temp = (*rom_)[overworldgfxGroups + (area_graphics_ * 4) + 1];
605 if (temp != 0x00) {
606 custom_gfx_ids_[4] = temp;
607 } else {
608 custom_gfx_ids_[4] = 0xFF;
609 }
610
611 temp = (*rom_)[overworldgfxGroups + (area_graphics_ * 4) + 2];
612 if (temp != 0x00) {
613 custom_gfx_ids_[5] = temp;
614 } else {
615 custom_gfx_ids_[5] = 0xFF;
616 }
617
618 temp = (*rom_)[overworldgfxGroups + (area_graphics_ * 4) + 3];
619 if (temp != 0x00) {
620 custom_gfx_ids_[6] = temp;
621 } else {
622 custom_gfx_ids_[6] = 0xFF;
623 }
624 }
625
626 // Subscreen Overlay - check enable flag before reading from custom array
630 ((*rom_)[OverworldCustomSubscreenOverlayArray + (index_ * 2) + 1] << 8);
631 } else {
632 // Fall back to hardcoded overlay values
633 subscreen_overlay_ = 0x00FF;
634 if (index_ == 0x00 || index_ == 0x01 || index_ == 0x08 || index_ == 0x09 ||
635 index_ == 0x40 || index_ == 0x41 || index_ == 0x48 || index_ == 0x49) {
636 // Add fog 2 to the lost woods and skull woods
637 subscreen_overlay_ = 0x009D;
638 } else if (index_ == 0x03 || index_ == 0x04 || index_ == 0x0B ||
639 index_ == 0x0C || index_ == 0x05 || index_ == 0x06 ||
640 index_ == 0x0D || index_ == 0x0E || index_ == 0x07) {
641 // Add the sky BG to LW death mountain
642 subscreen_overlay_ = 0x0095;
643 } else if (index_ == 0x43 || index_ == 0x44 || index_ == 0x4B ||
644 index_ == 0x4C || index_ == 0x45 || index_ == 0x46 ||
645 index_ == 0x4D || index_ == 0x4E || index_ == 0x47) {
646 // Add the lava to DW death mountain
647 subscreen_overlay_ = 0x009C;
648 } else if (index_ == 0x5B || index_ == 0x5C || index_ == 0x63 ||
649 index_ == 0x64) {
650 subscreen_overlay_ = 0x0096;
651 } else if (index_ == 0x80) {
652 // Add fog 1 to the master sword area
653 subscreen_overlay_ = 0x0097;
654 } else if (index_ == 0x88) {
655 // Add the triforce room curtains to the triforce room
656 subscreen_overlay_ = 0x0093;
657 }
658 }
659}
660
663 main_gfx_id_ = 0x20;
664 } else if (parent_ >= kDarkWorldMapIdStart &&
666 main_gfx_id_ = 0x21;
667 } else if (parent_ >= kSpecialWorldMapIdStart) {
668 // Special world maps - use appropriate graphics ID based on the specific
669 // map
670 if (parent_ == 0x88) {
671 main_gfx_id_ = 0x24;
672 } else {
673 // Default special world graphics ID
674 main_gfx_id_ = 0x20;
675 }
676 }
677}
678
680 int static_graphics_base = 0x73;
681 static_graphics_[8] = static_graphics_base + 0x00;
682 static_graphics_[9] = static_graphics_base + 0x01;
683 static_graphics_[10] = static_graphics_base + 0x06;
684 static_graphics_[11] = static_graphics_base + 0x07;
685
686 for (int i = 0; i < 4; i++) {
687 static_graphics_[12 + i] =
689 (sprite_graphics_[game_state_] * 4) + i] +
690 static_graphics_base);
691 }
692}
693
695 for (int i = 0; i < 8; i++) {
698 (main_gfx_id_ * 8) + i];
699 }
700}
701
702// For animating water tiles on the overworld map.
703// We want to swap out static_graphics_[07] with the next sheet
704// Usually it is 5A, so we make it 5B instead.
705// There is a middle frame which contains tiles from the bottom half
706// of the 5A sheet, so this will need some special manipulation to make work
707// during the BuildBitmap step (or a new one specifically for animating).
709 if (static_graphics_[7] == 0x5B) {
710 static_graphics_[7] = 0x5A;
711 } else {
712 if (static_graphics_[7] == 0x59) {
713 static_graphics_[7] = 0x58;
714 }
715 static_graphics_[7] = 0x5B;
716 }
717}
718
720 for (int i = 0; i < 4; i++) {
721 uint8_t value = (*rom_)[version_constants().kOverworldGfxGroups1 +
722 (area_graphics_ * 4) + i];
723 if (value != 0) {
724 static_graphics_[3 + i] = value;
725 }
726 }
727}
728
729// TODO: Change the conditions for death mountain gfx
730// JaredBrian: This is how ZS did it, but in 3.0.4 I changed it to just check
731// for 03, 05, 07, and the DW ones as that's how it would appear in-game if
732// you were to make area 03 not a large area anymore for example, so you might
733// want to do the same.
735 // Match ZScream 3.0.4 behavior: only specific DM parents use animated GFX
736 const bool is_light_dm = (parent_ == 0x03 || parent_ == 0x05 || parent_ == 0x07);
737 const bool is_dark_dm = (parent_ == 0x43 || parent_ == 0x45 || parent_ == 0x47);
738 static_graphics_[7] = (is_light_dm || is_dark_dm) ? 0x59 : 0x5B;
739}
740
747
748 // v3 custom tile GFX groups: override main sheets when enabled
752 for (int i = 0; i < 8; i++) {
753 uint8_t custom_sheet = custom_gfx_ids_[i];
754 if (custom_sheet == 0x00 || custom_sheet == 0xFF) {
755 continue; // 0/FF = don't load/override this slot
756 }
757 static_graphics_[i] = custom_sheet;
758 }
759 }
760}
761
762namespace palette_internal {
763
764absl::Status SetColorsPalette(Rom& rom, GameData* game_data, int index,
765 gfx::SnesPalette& current,
768 gfx::SnesPalette hud, gfx::SnesColor bgrcolor,
770 // Palettes infos, color 0 of a palette is always transparent (the arrays
771 // contains 7 colors width wide) There is 16 color per line so 16*Y
772
773 // Left side of the palette - Main, Animated
774 std::array<gfx::SnesColor, 256> new_palette = {};
775
776 // Main Palette, Location 0,2 : 35 colors [7x5]
777 int k = 0;
778 for (int y = 2; y < 7; y++) {
779 for (int x = 1; x < 8; x++) {
780 new_palette[x + (16 * y)] = main[k];
781 k++;
782 }
783 }
784
785 // Animated Palette, Location 0,7 : 7colors
786 for (int x = 1; x < 8; x++) {
787 new_palette[(16 * 7) + (x)] = animated[(x - 1)];
788 }
789
790 // Right side of the palette - Aux1, Aux2
791
792 // Aux1 Palette, Location 8,2 : 21 colors [7x3]
793 k = 0;
794 for (int y = 2; y < 5; y++) {
795 for (int x = 9; x < 16; x++) {
796 new_palette[x + (16 * y)] = aux1[k];
797 k++;
798 }
799 }
800
801 // Aux2 Palette, Location 8,5 : 21 colors [7x3]
802 k = 0;
803 for (int y = 5; y < 8; y++) {
804 for (int x = 9; x < 16; x++) {
805 new_palette[x + (16 * y)] = aux2[k];
806 k++;
807 }
808 }
809
810 // Hud Palette, Location 0,0 : 32 colors [16x2]
811 for (int i = 0; i < 32; i++) {
812 new_palette[i] = hud[i];
813 }
814
815 // Hardcoded grass color (that might change to become invisible instead)
816 for (int i = 0; i < 8; i++) {
817 new_palette[(i * 16)] = bgrcolor;
818 new_palette[(i * 16) + 8] = bgrcolor;
819 }
820
821 // Sprite Palettes
822 k = 0;
823 for (int y = 8; y < 9; y++) {
824 for (int x = 1; x < 8; x++) {
825 new_palette[x + (16 * y)] = game_data->palette_groups.sprites_aux1[1][k];
826 k++;
827 }
828 }
829
830 // Sprite Palettes
831 k = 0;
832 for (int y = 8; y < 9; y++) {
833 for (int x = 9; x < 16; x++) {
834 new_palette[x + (16 * y)] = game_data->palette_groups.sprites_aux3[0][k];
835 k++;
836 }
837 }
838
839 // Sprite Palettes
840 k = 0;
841 for (int y = 9; y < 13; y++) {
842 for (int x = 1; x < 16; x++) {
843 new_palette[x + (16 * y)] = game_data->palette_groups.global_sprites[0][k];
844 k++;
845 }
846 }
847
848 // Sprite Palettes
849 k = 0;
850 for (int y = 13; y < 14; y++) {
851 for (int x = 1; x < 8; x++) {
852 new_palette[x + (16 * y)] = spr[k];
853 k++;
854 }
855 }
856
857 // Sprite Palettes
858 k = 0;
859 for (int y = 14; y < 15; y++) {
860 for (int x = 1; x < 8; x++) {
861 new_palette[x + (16 * y)] = spr2[k];
862 k++;
863 }
864 }
865
866 // Sprite Palettes
867 k = 0;
868 for (int y = 15; y < 16; y++) {
869 for (int x = 1; x < 16; x++) {
870 new_palette[x + (16 * y)] = game_data->palette_groups.armors[0][k];
871 k++;
872 }
873 }
874
875 for (int i = 0; i < 256; i++) {
876 current[i] = new_palette[i];
877 current[(i / 16) * 16].set_transparent(true);
878 }
879
880 current.set_size(256);
881 return absl::OkStatus();
882}
883} // namespace palette_internal
884
885absl::StatusOr<gfx::SnesPalette> OverworldMap::GetPalette(
886 const gfx::PaletteGroup& palette_group, int index, int previous_index,
887 int limit) {
888 if (index == 255) {
890 (previous_index * 4)];
891 }
892 if (index >= limit) {
893 index = limit - 1;
894 }
895 return palette_group[index];
896}
897
899 uint8_t asm_version = (*rom_)[OverworldCustomASMHasBeenApplied];
901
902 int previous_pal_id = 0;
903 int previous_spr_pal_id = 0;
904
905 if (index_ > 0) {
906 // Load previous palette ID based on ASM version
908 // v3 uses expanded palette table
909 previous_pal_id = (*rom_)[kOverworldPalettesScreenToSetNew + parent_ - 1];
910 } else {
911 previous_pal_id = (*rom_)[kOverworldMapPaletteIds + parent_ - 1];
912 }
913
914 previous_spr_pal_id = (*rom_)[kOverworldSpritePaletteIds + parent_ - 1];
915 }
916
917 area_palette_ = std::min((int)area_palette_, 0xA3);
918
919 uint8_t pal0 = 0;
920 uint8_t pal1 = (*rom_)[version_constants().kOverworldMapPaletteGroup +
921 (area_palette_ * 4)];
922 uint8_t pal2 = (*rom_)[version_constants().kOverworldMapPaletteGroup +
923 (area_palette_ * 4) + 1];
924 uint8_t pal3 = (*rom_)[version_constants().kOverworldMapPaletteGroup +
925 (area_palette_ * 4) + 2];
926 uint8_t pal4 = (*rom_)[kOverworldSpritePaletteGroup +
928 uint8_t pal5 = (*rom_)[kOverworldSpritePaletteGroup +
929 (sprite_palette_[game_state_] * 2) + 1];
930
931 auto& grass_pal_group = game_data_->palette_groups.grass;
932 auto bgr = grass_pal_group[0][0];
933
934 // Handle 0xFF palette references (use previous palette)
935 if (pal1 == 0xFF) {
937 (previous_pal_id * 4)];
938 }
939
940 if (pal2 == 0xFF) {
942 (previous_pal_id * 4) + 1];
943 }
944
945 if (pal3 == 0xFF) {
947 (previous_pal_id * 4) + 2];
948 }
949
950 auto& ow_aux_pal_group = game_data_->palette_groups.overworld_aux;
952 GetPalette(ow_aux_pal_group, pal1, previous_pal_id, 20));
954 GetPalette(ow_aux_pal_group, pal2, previous_pal_id, 20));
955
956 // Set background color based on world type and area-specific settings
957 bool use_area_specific_bg =
960 if (use_area_specific_bg) {
961 // Use area-specific background color from custom array
965 << 8);
966 // Convert 15-bit SNES color to palette color
968 } else {
969 // Use default world-based background colors
971 bgr = grass_pal_group[0][0]; // LW
972 } else if (parent_ >= kDarkWorldMapIdStart &&
974 bgr = grass_pal_group[0][1]; // DW
975 } else if (parent_ >= 128 && parent_ < kNumOverworldMaps) {
976 bgr = grass_pal_group[0][2]; // SW
977 }
978 }
979
980 // Use main palette from the overworld map data (matches ZScream logic)
981 if (version == OverworldVersion::kVanilla) {
982 // Vanilla ROMs never write main_palette_ elsewhere; ensure world defaults
984 }
985 pal0 = main_palette_;
986
987 auto& ow_main_pal_group = game_data_->palette_groups.overworld_main;
989 GetPalette(ow_main_pal_group, pal0, previous_pal_id, 255));
990 auto& ow_animated_pal_group = game_data_->palette_groups.overworld_animated;
992 GetPalette(ow_animated_pal_group, std::min((int)pal3, 13),
993 previous_pal_id, 14));
994
995 auto& hud_pal_group = game_data_->palette_groups.hud;
996 gfx::SnesPalette hud = hud_pal_group[0];
997
998 // Handle 0xFF sprite palette references (use previous sprite palette)
999 if (pal4 == 0xFF) {
1000 pal4 = (*rom_)[kOverworldSpritePaletteGroup + (previous_spr_pal_id * 2)];
1001 }
1002
1003 if (pal4 == 0xFF) {
1004 pal4 = 0; // Fallback to 0 if still 0xFF
1005 }
1006
1007 if (pal5 == 0xFF) {
1008 pal5 =
1009 (*rom_)[kOverworldSpritePaletteGroup + (previous_spr_pal_id * 2) + 1];
1010 }
1011
1012 if (pal5 == 0xFF) {
1013 pal5 = 0; // Fallback to 0 if still 0xFF
1014 }
1015
1018 previous_spr_pal_id, 24));
1021 previous_spr_pal_id, 24));
1022
1024 *rom_, game_data_, parent_, current_palette_, main, animated, aux1, aux2,
1025 hud, bgr, spr, spr2));
1026
1027 if (palettesets_.count(area_palette_) == 0) {
1029 main, animated, aux1, aux2, bgr, hud, spr, spr2, current_palette_};
1030 }
1031
1032 return absl::OkStatus();
1033}
1034
1036 // Load overlays based on ROM version
1038 // Vanilla ROM - load overlay from overlay pointers
1039 return LoadVanillaOverlayData();
1040 }
1041
1042 // Custom overworld ROM - use overlay from custom data
1044 has_overlay_ = (overlay_id_ != 0x00FF);
1045 overlay_data_.clear();
1046 return absl::OkStatus();
1047}
1048
1050 // Load vanilla overlay for this map (interactive overlays for revealing
1051 // holes/changing elements)
1052 int address = (kOverlayPointersBank << 16) +
1053 ((*rom_)[kOverlayPointers + (index_ * 2) + 1] << 8) +
1054 (*rom_)[kOverlayPointers + (index_ * 2)];
1055
1056 // Convert SNES address to PC address
1057 address = ((address & 0x7F0000) >> 1) | (address & 0x7FFF);
1058
1059 // Check if custom overlay code is present
1060 if ((*rom_)[kOverlayData1] == 0x6B) {
1061 // Use custom overlay data pointer
1062 address = ((*rom_)[kOverlayData2 + 2 + (index_ * 3)] << 16) +
1063 ((*rom_)[kOverlayData2 + 1 + (index_ * 3)] << 8) +
1064 (*rom_)[kOverlayData2 + (index_ * 3)];
1065 address = ((address & 0x7F0000) >> 1) | (address & 0x7FFF);
1066 }
1067
1068 // Validate address
1069 if (address >= rom_->size()) {
1070 has_overlay_ = false;
1071 overlay_id_ = 0;
1072 overlay_data_.clear();
1073 return absl::OkStatus();
1074 }
1075
1076 // Parse overlay data (interactive overlays)
1077 overlay_data_.clear();
1078 uint8_t b = (*rom_)[address];
1079
1080 // Parse overlay commands until we hit END (0x60)
1081 while (b != 0x60 && address < rom_->size()) {
1082 overlay_data_.push_back(b);
1083
1084 // Handle different overlay commands
1085 switch (b) {
1086 case 0xA9: // LDA #$
1087 if (address + 2 < rom_->size()) {
1088 overlay_data_.push_back((*rom_)[address + 1]);
1089 overlay_data_.push_back((*rom_)[address + 2]);
1090 address += 3;
1091 } else {
1092 address++;
1093 }
1094 break;
1095 case 0xA2: // LDX #$
1096 if (address + 2 < rom_->size()) {
1097 overlay_data_.push_back((*rom_)[address + 1]);
1098 overlay_data_.push_back((*rom_)[address + 2]);
1099 address += 3;
1100 } else {
1101 address++;
1102 }
1103 break;
1104 case 0x8D: // STA $xxxx
1105 if (address + 3 < rom_->size()) {
1106 overlay_data_.push_back((*rom_)[address + 1]);
1107 overlay_data_.push_back((*rom_)[address + 2]);
1108 overlay_data_.push_back((*rom_)[address + 3]);
1109 address += 4;
1110 } else {
1111 address++;
1112 }
1113 break;
1114 case 0x9D: // STA $xxxx,x
1115 if (address + 3 < rom_->size()) {
1116 overlay_data_.push_back((*rom_)[address + 1]);
1117 overlay_data_.push_back((*rom_)[address + 2]);
1118 overlay_data_.push_back((*rom_)[address + 3]);
1119 address += 4;
1120 } else {
1121 address++;
1122 }
1123 break;
1124 case 0x8F: // STA $xxxxxx
1125 if (address + 4 < rom_->size()) {
1126 overlay_data_.push_back((*rom_)[address + 1]);
1127 overlay_data_.push_back((*rom_)[address + 2]);
1128 overlay_data_.push_back((*rom_)[address + 3]);
1129 overlay_data_.push_back((*rom_)[address + 4]);
1130 address += 5;
1131 } else {
1132 address++;
1133 }
1134 break;
1135 case 0x1A: // INC A
1136 address++;
1137 break;
1138 case 0x4C: // JMP
1139 if (address + 3 < rom_->size()) {
1140 overlay_data_.push_back((*rom_)[address + 1]);
1141 overlay_data_.push_back((*rom_)[address + 2]);
1142 overlay_data_.push_back((*rom_)[address + 3]);
1143 address += 4;
1144 } else {
1145 address++;
1146 }
1147 break;
1148 default:
1149 address++;
1150 break;
1151 }
1152
1153 if (address < rom_->size()) {
1154 b = (*rom_)[address];
1155 } else {
1156 break;
1157 }
1158 }
1159
1160 // Add the END command if we found it
1161 if (b == 0x60) {
1162 overlay_data_.push_back(0x60);
1163 }
1164
1165 // Set overlay ID based on map index (simplified)
1167 has_overlay_ = !overlay_data_.empty();
1168
1169 return absl::OkStatus();
1170}
1171
1172void OverworldMap::ProcessGraphicsBuffer(int index, int static_graphics_offset,
1173 int size, const uint8_t* all_gfx) {
1174 // Ensure we don't go out of bounds
1175 int max_offset = static_graphics_offset * size + size;
1176 if (!game_data_ || max_offset > game_data_->graphics_buffer.size()) {
1177 // Fill with zeros if out of bounds
1178 for (int i = 0; i < size; i++) {
1179 current_gfx_[(index * size) + i] = 0x00;
1180 }
1181 return;
1182 }
1183
1184 for (int i = 0; i < size; i++) {
1185 auto byte = all_gfx[i + (static_graphics_offset * size)];
1186 switch (index) {
1187 case 0:
1188 case 3:
1189 case 4:
1190 case 5:
1191 byte += 0x88;
1192 break;
1193 }
1194 current_gfx_[(index * size) + i] = byte;
1195 }
1196}
1197
1199 if (current_gfx_.size() == 0)
1200 current_gfx_.resize(0x10000, 0x00);
1201
1202 if (!game_data_) {
1203 return absl::FailedPreconditionError("GameData not set");
1204 }
1205
1206 // Process the 8 main graphics sheets (slots 0-7)
1207 for (int i = 0; i < 8; i++) {
1208 if (static_graphics_[i] != 0) {
1210 game_data_->graphics_buffer.data());
1211 }
1212 }
1213
1214 // Process sprite graphics (slots 8-15)
1215 for (int i = 8; i < 16; i++) {
1216 if (static_graphics_[i] != 0) {
1218 game_data_->graphics_buffer.data());
1219 }
1220 }
1221
1222 // NOTE: Previously there was code here accessing static_graphics_[16], but
1223 // the array is only size 16 (indices 0-15). This was undefined behavior
1224 // that read random memory and sometimes corrupted the animated graphics
1225 // slot (7), causing flaky water/cloud rendering. The animated graphics
1226 // are already correctly set in static_graphics_[7] by LoadDeathMountainGFX().
1227
1228 return absl::OkStatus();
1229}
1230
1231absl::Status OverworldMap::BuildTiles16Gfx(std::vector<gfx::Tile16>& tiles16,
1232 int count) {
1233 if (current_blockset_.size() == 0)
1234 current_blockset_.resize(0x100000, 0x00);
1235
1236 const int offsets[] = {0x00, 0x08, 0x400, 0x408};
1237 auto yy = 0;
1238 auto xx = 0;
1239
1240 for (auto i = 0; i < count; i++) {
1241 for (auto tile = 0; tile < 0x04; tile++) {
1242 gfx::TileInfo info = tiles16[i].tiles_info[tile];
1243 int offset = offsets[tile];
1244 for (auto y = 0; y < 0x08; ++y) {
1245 for (auto x = 0; x < 0x08; ++x) {
1246 int mx = x;
1247 int my = y;
1248
1249 if (info.horizontal_mirror_ != 0) {
1250 mx = 0x07 - x;
1251 }
1252
1253 if (info.vertical_mirror_ != 0) {
1254 my = 0x07 - y;
1255 }
1256
1257 int xpos = ((info.id_ % 0x10) * 0x08);
1258 int ypos = (((info.id_ / 0x10)) * 0x400);
1259 int source = ypos + xpos + (x + (y * 0x80));
1260
1261 auto destination = xx + yy + offset + (mx + (my * 0x80));
1263 (current_gfx_[source] & 0x0F) + (info.palette_ * 0x10);
1264 }
1265 }
1266 }
1267
1268 xx += 0x10;
1269 if (xx >= 0x80) {
1270 yy += 0x800;
1271 xx = 0;
1272 }
1273 }
1274
1275 return absl::OkStatus();
1276}
1277
1278absl::Status OverworldMap::BuildBitmap(OverworldBlockset& world_blockset) {
1279 if (bitmap_data_.size() != 0) {
1280 bitmap_data_.clear();
1281 }
1282 bitmap_data_.reserve(0x40000);
1283 for (int i = 0; i < 0x40000; i++) {
1284 bitmap_data_.push_back(0x00);
1285 }
1286
1287 int superY = ((index_ - (world_ * 0x40)) / 0x08);
1288 int superX = index_ - (world_ * 0x40) - (superY * 0x08);
1289
1290 for (int y = 0; y < 0x20; y++) {
1291 for (int x = 0; x < 0x20; x++) {
1292 auto xt = x + (superX * 0x20);
1293 auto yt = y + (superY * 0x20);
1294 gfx::CopyTile8bpp16((x * 0x10), (y * 0x10), world_blockset[xt][yt],
1296 }
1297 }
1298 return absl::OkStatus();
1299}
1300
1301} // namespace yaze::zelda3
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:24
auto size() const
Definition rom.h:134
static Flags & get()
Definition features.h:92
static std::unordered_map< uint8_t, gfx::Paletteset > palettesets_
SNES Color container.
Definition snes_color.h:110
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
void set_size(size_t size)
SNES 16-bit tile metadata container.
Definition snes_tile.h:50
void ProcessGraphicsBuffer(int index, int static_graphics_offset, int size, const uint8_t *all_gfx)
zelda3_version_pointers version_constants() const
std::vector< uint8_t > current_gfx_
std::vector< uint8_t > current_blockset_
std::array< bool, 4 > mosaic_expanded_
absl::Status LoadVanillaOverlayData()
std::vector< uint8_t > bitmap_data_
absl::Status BuildMapWithCache(int count, int game_state, int world, std::vector< gfx::Tile16 > &tiles16, OverworldBlockset &world_blockset, const std::vector< uint8_t > *cached_tileset)
Build map with optional cached tileset for performance.
void SetupCustomTileset(uint8_t asm_version)
absl::StatusOr< gfx::SnesPalette > GetPalette(const gfx::PaletteGroup &group, int index, int previous_index, int limit)
absl::Status BuildTiles16Gfx(std::vector< gfx::Tile16 > &tiles16, int count)
absl::Status BuildMap(int count, int game_state, int world, std::vector< gfx::Tile16 > &tiles16, OverworldBlockset &world_blockset)
std::array< uint8_t, 3 > sprite_graphics_
uint8_t ComputeWorldBasedMainPalette() const
absl::Status BuildBitmap(OverworldBlockset &world_blockset)
std::array< uint8_t, 3 > sprite_palette_
std::array< uint8_t, 4 > area_music_
std::array< uint8_t, 16 > static_graphics_
std::array< uint8_t, 8 > custom_gfx_ids_
std::vector< uint8_t > overlay_data_
void UseCachedTileset(const std::vector< uint8_t > &cached_gfx)
Use a pre-computed tileset from cache instead of rebuilding.
gfx::SnesPalette current_palette_
static bool SupportsCustomBGColors(OverworldVersion version)
Check if ROM supports custom background colors per area (v2+)
static OverworldVersion GetVersion(const Rom &rom)
Detect ROM version from ASM marker byte.
static uint8_t GetAsmVersion(const Rom &rom)
Get raw ASM version byte from ROM.
static bool SupportsAreaEnum(OverworldVersion version)
Check if ROM supports area enum system (v3+ only)
static bool SupportsCustomTileGFX(OverworldVersion version)
Check if ROM supports custom tile GFX groups (v3+)
int main(int argc, char **argv)
Definition emu.cc:39
struct destination destination
Room transition destination.
#define ASSIGN_OR_RETURN(type_variable_name, expression)
Definition macro.h:62
void CopyTile8bpp16(int x, int y, int tile, std::vector< uint8_t > &bitmap, std::vector< uint8_t > &blockset)
Definition snes_tile.cc:379
absl::Status SetColorsPalette(Rom &rom, GameData *game_data, int index, gfx::SnesPalette &current, gfx::SnesPalette main, gfx::SnesPalette animated, gfx::SnesPalette aux1, gfx::SnesPalette aux2, gfx::SnesPalette hud, gfx::SnesColor bgrcolor, gfx::SnesPalette spr, gfx::SnesPalette spr2)
Zelda 3 specific classes and functions.
Definition editor.h:35
constexpr int kAreaGfxIdPtr
Definition overworld.h:117
constexpr int OverworldCustomTileGFXGroupEnabled
constexpr int OverworldCustomAreaSpecificBGEnabled
constexpr int kOverworldSpritePaletteGroup
Definition overworld.h:109
constexpr int kOverworldSpriteset
Definition overworld.h:110
constexpr int kOverworldScreenSize
Definition overworld.h:143
constexpr int kOverlayData1
constexpr int kSpecialWorldMapIdStart
constexpr int OverworldCustomMosaicArray
constexpr int OverworldCustomAnimatedGFXEnabled
constexpr int OverworldCustomMainPaletteEnabled
constexpr int kNumOverworldMaps
Definition common.h:85
constexpr int OverworldCustomMainPaletteArray
constexpr int kOverworldSpecialSpritePaletteExpandedTemp
constexpr int kOverworldMapParentIdExpanded
constexpr int kOverworldSpecialSpriteGfxGroupExpandedTemp
constexpr int kOverworldMusicBeginning
Definition overworld.h:120
std::vector< std::vector< uint16_t > > OverworldBlockset
Represents tile32 data for the overworld.
AreaSizeEnum
Area size enumeration for v3+ ROMs.
constexpr int kOverworldMusicDarkWorld
Definition overworld.h:124
constexpr int kOverlayPointersBank
constexpr int kOverworldSpecialPalGroup
Definition overworld.h:112
constexpr int kOverworldSpritePaletteIds
Definition overworld.h:108
constexpr int OverworldCustomASMHasBeenApplied
Definition common.h:89
constexpr int kOverworldMusicAgahnim
Definition overworld.h:123
constexpr int kOverworldMapParentId
Definition overworld.h:140
@ kZSCustomV2
Parent system, BG colors, main palettes.
@ kVanilla
0xFF in ROM, no ZScream ASM applied
@ kZSCustomV3
Area enum, wide/tall areas, all features.
constexpr int kOverworldPalettesScreenToSetNew
constexpr int kOverworldMessagesExpanded
constexpr int kOverworldMusicMasterSword
Definition overworld.h:122
constexpr int kOverworldMusicZelda
Definition overworld.h:121
constexpr int kOverworldMessageIds
Definition overworld.h:118
constexpr int kOverlayData2
constexpr int OverworldCustomAnimatedGFXArray
constexpr int kDarkWorldMapIdStart
constexpr int OverworldCustomMosaicEnabled
constexpr int OverworldCustomTileGFXGroupArray
constexpr int OverworldCustomSubscreenOverlayEnabled
constexpr int OverworldCustomAreaSpecificBGPalette
constexpr int kOverlayPointers
constexpr int kOverworldMapPaletteIds
Definition overworld.h:107
constexpr int kOverworldSpecialGfxGroup
Definition overworld.h:111
constexpr int OverworldCustomSubscreenOverlayArray
#define RETURN_IF_ERROR(expr)
Definition snes.cc:22
Room transition destination.
Definition zelda.h:448
Represents a group of palettes.
Represents a set of palettes used in a SNES graphics system.
gfx::PaletteGroupMap palette_groups
Definition game_data.h:89
std::vector< uint8_t > graphics_buffer
Definition game_data.h:82
uint32_t kOverworldMapPaletteGroup
Definition zelda.h:98
uint32_t kOverworldGfxGroups1
Definition zelda.h:94
uint32_t kSpriteBlocksetPointer
Definition zelda.h:109
uint32_t kOverworldGfxGroups2
Definition zelda.h:95