yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::zelda3::Overworld Class Reference

Represents the full Overworld data, light and dark world. More...

#include <overworld.h>

Collaboration diagram for yaze::zelda3::Overworld:

Classes

struct  GraphicsConfigCache
 

Public Member Functions

 Overworld (Rom *rom, GameData *game_data=nullptr)
 
void SetGameData (GameData *game_data)
 
zelda3_version_pointers version_constants () const
 Get version-specific ROM addresses.
 
absl::Status Load (Rom *rom)
 Load all overworld data from ROM.
 
absl::Status LoadOverworldMaps ()
 Load overworld map tile data.
 
void LoadTileTypes ()
 Load tile type collision data.
 
absl::Status LoadSprites ()
 Load sprite data for all game states.
 
absl::Status LoadSpritesFromMap (int sprite_start, int sprite_count, int sprite_index)
 Load sprites from a specific map range.
 
absl::Status EnsureMapBuilt (int map_index)
 Build a map on-demand if it hasn't been built yet.
 
uint64_t ComputeGraphicsConfigHash (int map_index)
 Compute hash of graphics configuration for cache lookup.
 
const std::vector< uint8_t > * GetCachedTileset (uint64_t config_hash)
 Try to get cached tileset data for a graphics configuration.
 
void CacheTileset (uint64_t config_hash, const std::vector< uint8_t > &tileset)
 Cache tileset data for future reuse.
 
void ClearGraphicsConfigCache ()
 Clear entire graphics config cache Call when palette or graphics settings change globally.
 
void InvalidateMapCache (int map_index)
 Invalidate cached tileset for a specific map.
 
void InvalidateSiblingMapCaches (int map_index)
 Invalidate cached tilesets for a map and all its siblings.
 
absl::Status Save (Rom *rom)
 Master save method (calls sub-methods in correct order)
 
absl::Status SaveOverworldMaps ()
 Save compressed map tile data to ROM.
 
absl::Status SaveLargeMaps ()
 Save large map parent/sibling relationships.
 
absl::Status SaveLargeMapsExpanded ()
 Save expanded large map data (v1+ ROMs)
 
absl::Status SaveSmallAreaTransitions (int i, int parent_x_pos, int parent_y_pos, int transition_target_north, int transition_target_west, int transition_pos_x, int transition_pos_y, int screen_change_1, int screen_change_2, int screen_change_3, int screen_change_4)
 Save screen transition data for small (1x1) areas.
 
absl::Status SaveLargeAreaTransitions (int i, int parent_x_pos, int parent_y_pos, int transition_target_north, int transition_target_west, int transition_pos_x, int transition_pos_y, int screen_change_1, int screen_change_2, int screen_change_3, int screen_change_4)
 Save screen transition data for large (2x2) areas.
 
absl::Status SaveWideAreaTransitions (int i, int parent_x_pos, int parent_y_pos, int transition_target_north, int transition_target_west, int transition_pos_x, int transition_pos_y, int screen_change_1, int screen_change_2, int screen_change_3, int screen_change_4)
 Save screen transition data for wide (2x1) areas (v3+ only)
 
absl::Status SaveTallAreaTransitions (int i, int parent_x_pos, int parent_y_pos, int transition_target_north, int transition_target_west, int transition_pos_x, int transition_pos_y, int screen_change_1, int screen_change_2, int screen_change_3, int screen_change_4)
 Save screen transition data for tall (1x2) areas (v3+ only)
 
absl::Status SaveEntrances ()
 Save entrance warp points to ROM.
 
absl::Status SaveExits ()
 Save exit return points to ROM.
 
absl::Status SaveItems ()
 Save hidden overworld items to ROM.
 
absl::Status SaveMapOverlays ()
 Save interactive overlay data to ROM.
 
absl::Status SaveOverworldTilesType ()
 Save tile type collision data to ROM.
 
absl::Status SaveCustomOverworldASM (bool enable_bg_color, bool enable_main_palette, bool enable_mosaic, bool enable_gfx_groups, bool enable_subscreen_overlay, bool enable_animated)
 Save custom ASM feature enable flags.
 
absl::Status SaveAreaSpecificBGColors ()
 Save per-area background colors (v2+)
 
absl::Status CreateTile32Tilemap ()
 Build tile32 tilemap from current tile16 data.
 
absl::Status SaveMap16Expanded ()
 Save expanded tile16 definitions (v1+ ROMs)
 
absl::Status SaveMap16Tiles ()
 Save tile16 definitions to ROM.
 
absl::Status SaveMap32Expanded ()
 Save expanded tile32 definitions (v1+ ROMs)
 
absl::Status SaveMap32Tiles ()
 Save tile32 definitions to ROM.
 
absl::Status SaveMapProperties ()
 Save per-area graphics, palettes, and messages.
 
absl::Status SaveMusic ()
 Save per-area music IDs.
 
absl::Status SaveAreaSizes ()
 Save area size enum data (v3+ only)
 
void AssignMapSizes (std::vector< OverworldMap > &maps)
 Assign map sizes based on area size enum (v3+)
 
absl::Status ConfigureMultiAreaMap (int parent_index, AreaSizeEnum size)
 Configure a multi-area map structure (Large/Wide/Tall)
 
auto rom () const
 
auto mutable_rom ()
 
bool HasExpandedPointerTables () const
 Check if the ROM has expanded pointer tables for tail maps.
 
void Destroy ()
 
int GetTileFromPosition (ImVec2 position) const
 
OverworldBlocksetGetMapTiles (int world_type)
 
auto overworld_maps () const
 
auto overworld_map (int i) const
 
auto mutable_overworld_map (int i)
 
auto exits () const
 
auto mutable_exits ()
 
std::vector< gfx::Tile16tiles16 () const
 
auto tiles32_unique () const
 
auto mutable_tiles16 ()
 
auto sprites (int state) const
 
auto mutable_sprites (int state)
 
auto current_graphics () const
 
const std::vector< OverworldEntrance > & entrances () const
 
auto & entrances ()
 
auto mutable_entrances ()
 
const std::vector< OverworldEntrance > & holes () const
 
auto & holes ()
 
auto mutable_holes ()
 
auto deleted_entrances () const
 
auto mutable_deleted_entrances ()
 
auto current_area_palette () const
 
auto current_map_bitmap_data () const
 
auto tile16_blockset_data () const
 
bool is_current_map_valid () const
 
auto is_loaded () const
 
auto expanded_tile16 () const
 
auto expanded_tile32 () const
 
auto expanded_entrances () const
 
int current_map_id () const
 
int current_world () const
 
void set_current_map (int i)
 
void set_current_world (int world)
 
uint16_t GetTile (int x, int y) const
 
void SetTile (int x, int y, uint16_t tile_id)
 
auto map_tiles () const
 
auto mutable_map_tiles ()
 
auto all_items () const
 
auto mutable_all_items ()
 
auto all_tiles_types () const
 
auto mutable_all_tiles_types ()
 
auto all_sprites () const
 
const DiggableTilesdiggable_tiles () const
 
DiggableTilesmutable_diggable_tiles ()
 
absl::Status LoadDiggableTiles ()
 
absl::Status SaveDiggableTiles ()
 
absl::Status AutoDetectDiggableTiles ()
 

Private Types

enum  Dimension { map32TilesTL = 0 , map32TilesTR = 1 , map32TilesBL = 2 , map32TilesBR = 3 }
 

Private Member Functions

void FetchLargeMaps ()
 
absl::StatusOr< uint16_t > GetTile16ForTile32 (int index, int quadrant, int dimension, const uint32_t *map32address)
 
absl::Status AssembleMap32Tiles ()
 
absl::Status AssembleMap16Tiles ()
 
void AssignWorldTiles (int x, int y, int sx, int sy, int tpos, OverworldBlockset &world)
 
void FillBlankMapTiles (int map_index)
 
OverworldBlocksetSelectWorldBlockset (int world_type)
 
void OrganizeMapTiles (std::vector< uint8_t > &bytes, std::vector< uint8_t > &bytes2, int i, int sx, int sy, int &ttpos)
 
absl::Status DecompressAllMapTilesParallel ()
 

Private Attributes

Romrom_
 
GameDatagame_data_ = nullptr
 
bool is_loaded_ = false
 
bool expanded_tile16_ = false
 
bool expanded_tile32_ = false
 
bool expanded_entrances_ = false
 
int game_state_ = 0
 
int current_map_ = 0
 
int current_world_ = 0
 
OverworldMapTiles map_tiles_
 
std::mutex map_tiles_mutex_
 
std::deque< int > built_map_lru_
 
std::unordered_map< uint64_t, GraphicsConfigCachegfx_config_cache_
 
std::vector< OverworldMapoverworld_maps_
 
std::vector< OverworldEntranceall_entrances_
 
std::vector< OverworldEntranceall_holes_
 
std::vector< OverworldExitall_exits_
 
std::vector< OverworldItemall_items_
 
std::vector< gfx::Tile16tiles16_
 
std::vector< gfx::Tile32tiles32_
 
std::vector< gfx::Tile32tiles32_unique_
 
std::vector< uint16_t > tiles32_list_
 
std::vector< uint64_t > deleted_entrances_
 
std::array< uint8_t, kNumOverworldMapsmap_parent_ = {0}
 
std::array< uint8_t, kNumTileTypesall_tiles_types_ = {0}
 
std::array< std::vector< Sprite >, 3 > all_sprites_
 
DiggableTiles diggable_tiles_
 
std::array< std::vector< uint8_t >, kNumOverworldMapsmap_data_p1
 
std::array< std::vector< uint8_t >, kNumOverworldMapsmap_data_p2
 
std::array< int, kNumOverworldMapsmap_pointers1_id
 
std::array< int, kNumOverworldMapsmap_pointers2_id
 
std::array< int, kNumOverworldMapsmap_pointers1
 
std::array< int, kNumOverworldMapsmap_pointers2
 

Static Private Attributes

static constexpr int kMaxBuiltMaps = 20
 
static constexpr int kMaxCachedConfigs = 8
 

Detailed Description

Represents the full Overworld data, light and dark world.

This class is responsible for loading and saving the overworld data, as well as creating the tilesets and tilemaps for the overworld.

The Overworld manages 160 map screens across three worlds and provides the data layer that the OverworldEditor UI operates on.

See also
OverworldMap for individual map data
OverworldEditor for the UI layer
overworld_version_helper.h for Version Information detection

Definition at line 217 of file overworld.h.

Member Enumeration Documentation

◆ Dimension

Enumerator
map32TilesTL 
map32TilesTR 
map32TilesBL 
map32TilesBR 

Definition at line 570 of file overworld.h.

Constructor & Destructor Documentation

◆ Overworld()

yaze::zelda3::Overworld::Overworld ( Rom * rom,
GameData * game_data = nullptr )
inline

Definition at line 219 of file overworld.h.

Member Function Documentation

◆ SetGameData()

void yaze::zelda3::Overworld::SetGameData ( GameData * game_data)
inline

Definition at line 222 of file overworld.h.

References game_data_.

Referenced by yaze::editor::OverworldEditor::SetGameData().

◆ version_constants()

◆ Load()

absl::Status yaze::zelda3::Overworld::Load ( Rom * rom)

Load all overworld data from ROM.

Definition at line 36 of file overworld.cc.

References all_entrances_, all_exits_, all_holes_, all_items_, AssembleMap16Tiles(), AssembleMap32Tiles(), ASSIGN_OR_RETURN, AssignMapSizes(), DecompressAllMapTilesParallel(), FetchLargeMaps(), game_data_, yaze::zelda3::OverworldVersionHelper::GetVersion(), is_loaded_, yaze::zelda3::kNumOverworldMaps, LoadDiggableTiles(), yaze::zelda3::LoadEntrances(), yaze::zelda3::LoadExits(), yaze::zelda3::LoadHoles(), yaze::zelda3::LoadItems(), LoadOverworldMaps(), LoadSprites(), LoadTileTypes(), map_parent_, overworld_maps_, RETURN_IF_ERROR, rom(), rom_, and yaze::zelda3::OverworldVersionHelper::SupportsAreaEnum().

Referenced by yaze::cli::Tile16ProposalGenerator::ApplyProposal(), yaze::editor::OverworldEditor::ApplyZSCustomOverworldASM(), yaze::cli::handlers::OverworldFindTileCommandHandler::Execute(), yaze::cli::handlers::OverworldDescribeMapCommandHandler::Execute(), yaze::cli::handlers::OverworldListWarpsCommandHandler::Execute(), yaze::cli::handlers::OverworldListSpritesCommandHandler::Execute(), yaze::cli::handlers::OverworldGetEntranceCommandHandler::Execute(), yaze::cli::handlers::OverworldTileStatsCommandHandler::Execute(), yaze::cli::OverworldValidateCommandHandler::Execute(), yaze::cli::handlers::ToolsExtractGoldenCommandHandler::Execute(), yaze::cli::Tile16ProposalGenerator::GenerateDiff(), yaze::cli::HandleOverworldDescribeMapLegacy(), yaze::cli::HandleOverworldFindTileLegacy(), yaze::cli::HandleOverworldGetTileLegacy(), yaze::cli::HandleOverworldListWarpsLegacy(), yaze::cli::HandleOverworldSetTileLegacy(), yaze::editor::OverworldEditor::LoadGraphics(), yaze::cli::Tile16ProposalGenerator::ParseReplaceTileCommand(), yaze::cli::Tile16ProposalGenerator::ParseSetAreaCommand(), yaze::cli::Tile16ProposalGenerator::ParseSetTileCommand(), yaze::test::RomDependentTestSuite::RunComprehensiveSaveTest(), and yaze::test::RomDependentTestSuite::RunRomOverworldLoadingTest().

◆ LoadOverworldMaps()

◆ LoadTileTypes()

void yaze::zelda3::Overworld::LoadTileTypes ( )

Load tile type collision data.

Definition at line 993 of file overworld.cc.

References all_tiles_types_, yaze::zelda3::kNumTileTypes, zelda3_version_pointers::kOverworldTilesType, rom(), and version_constants().

Referenced by Load().

Here is the call graph for this function:

◆ LoadSprites()

◆ LoadSpritesFromMap()

absl::Status yaze::zelda3::Overworld::LoadSpritesFromMap ( int sprite_start,
int sprite_count,
int sprite_index )

Load sprites from a specific map range.

Definition at line 1220 of file overworld.cc.

References all_sprites_, ASSIGN_OR_RETURN, map_parent_, overworld_maps_, rom(), and yaze::SnesToPc().

Referenced by LoadSprites().

Here is the call graph for this function:

◆ EnsureMapBuilt()

◆ ComputeGraphicsConfigHash()

uint64_t yaze::zelda3::Overworld::ComputeGraphicsConfigHash ( int map_index)

Compute hash of graphics configuration for cache lookup.

Definition at line 1000 of file overworld.cc.

References game_state_, yaze::zelda3::kDarkWorldMapIdStart, yaze::zelda3::kSpecialWorldMapIdStart, and overworld_maps_.

Referenced by EnsureMapBuilt(), InvalidateMapCache(), and LoadOverworldMaps().

◆ GetCachedTileset()

const std::vector< uint8_t > * yaze::zelda3::Overworld::GetCachedTileset ( uint64_t config_hash)

Try to get cached tileset data for a graphics configuration.

Returns
nullptr if not cached, pointer to cached data if available

Definition at line 1078 of file overworld.cc.

References gfx_config_cache_.

Referenced by EnsureMapBuilt(), and LoadOverworldMaps().

◆ CacheTileset()

void yaze::zelda3::Overworld::CacheTileset ( uint64_t config_hash,
const std::vector< uint8_t > & tileset )

Cache tileset data for future reuse.

Definition at line 1087 of file overworld.cc.

References gfx_config_cache_, and kMaxCachedConfigs.

Referenced by EnsureMapBuilt(), and LoadOverworldMaps().

◆ ClearGraphicsConfigCache()

void yaze::zelda3::Overworld::ClearGraphicsConfigCache ( )
inline

Clear entire graphics config cache Call when palette or graphics settings change globally.

Definition at line 273 of file overworld.h.

References gfx_config_cache_.

Referenced by yaze::editor::OverworldEditor::InvalidateGraphicsCache().

◆ InvalidateMapCache()

void yaze::zelda3::Overworld::InvalidateMapCache ( int map_index)

Invalidate cached tileset for a specific map.

Parameters
map_indexThe map whose cache entry should be invalidated

Definition at line 1106 of file overworld.cc.

References ComputeGraphicsConfigHash(), gfx_config_cache_, yaze::zelda3::kNumOverworldMaps, and overworld_maps_.

Referenced by InvalidateSiblingMapCaches().

Here is the call graph for this function:

◆ InvalidateSiblingMapCaches()

void yaze::zelda3::Overworld::InvalidateSiblingMapCaches ( int map_index)

◆ Save()

◆ SaveOverworldMaps()

◆ SaveLargeMaps()

◆ SaveLargeMapsExpanded()

◆ SaveSmallAreaTransitions()

absl::Status yaze::zelda3::Overworld::SaveSmallAreaTransitions ( int i,
int parent_x_pos,
int parent_y_pos,
int transition_target_north,
int transition_target_west,
int transition_pos_x,
int transition_pos_y,
int screen_change_1,
int screen_change_2,
int screen_change_3,
int screen_change_4 )

Save screen transition data for small (1x1) areas.

Definition at line 1756 of file overworld.cc.

References yaze::zelda3::kNumOverworldMaps, yaze::zelda3::LargeArea, overworld_maps_, RETURN_IF_ERROR, rom(), yaze::zelda3::TallArea, and yaze::zelda3::WideArea.

Referenced by SaveLargeMapsExpanded().

Here is the call graph for this function:

◆ SaveLargeAreaTransitions()

absl::Status yaze::zelda3::Overworld::SaveLargeAreaTransitions ( int i,
int parent_x_pos,
int parent_y_pos,
int transition_target_north,
int transition_target_west,
int transition_pos_x,
int transition_pos_y,
int screen_change_1,
int screen_change_2,
int screen_change_3,
int screen_change_4 )

Save screen transition data for large (2x2) areas.

Definition at line 1865 of file overworld.cc.

References yaze::zelda3::kNumOverworldMaps, yaze::zelda3::LargeArea, overworld_maps_, RETURN_IF_ERROR, rom(), yaze::zelda3::TallArea, and yaze::zelda3::WideArea.

Referenced by SaveLargeMapsExpanded().

Here is the call graph for this function:

◆ SaveWideAreaTransitions()

absl::Status yaze::zelda3::Overworld::SaveWideAreaTransitions ( int i,
int parent_x_pos,
int parent_y_pos,
int transition_target_north,
int transition_target_west,
int transition_pos_x,
int transition_pos_y,
int screen_change_1,
int screen_change_2,
int screen_change_3,
int screen_change_4 )

Save screen transition data for wide (2x1) areas (v3+ only)

Definition at line 2021 of file overworld.cc.

References yaze::zelda3::kNumOverworldMaps, yaze::zelda3::LargeArea, overworld_maps_, RETURN_IF_ERROR, rom(), yaze::zelda3::TallArea, and yaze::zelda3::WideArea.

Referenced by SaveLargeMapsExpanded().

Here is the call graph for this function:

◆ SaveTallAreaTransitions()

absl::Status yaze::zelda3::Overworld::SaveTallAreaTransitions ( int i,
int parent_x_pos,
int parent_y_pos,
int transition_target_north,
int transition_target_west,
int transition_pos_x,
int transition_pos_y,
int screen_change_1,
int screen_change_2,
int screen_change_3,
int screen_change_4 )

Save screen transition data for tall (1x2) areas (v3+ only)

Definition at line 2161 of file overworld.cc.

References yaze::zelda3::kNumOverworldMaps, yaze::zelda3::LargeArea, overworld_maps_, RETURN_IF_ERROR, rom(), yaze::zelda3::TallArea, and yaze::zelda3::WideArea.

Referenced by SaveLargeMapsExpanded().

Here is the call graph for this function:

◆ SaveEntrances()

absl::Status yaze::zelda3::Overworld::SaveEntrances ( )

Save entrance warp points to ROM.

Definition at line 2900 of file overworld.cc.

References all_entrances_, all_holes_, expanded_entrances_, RETURN_IF_ERROR, rom_, yaze::zelda3::SaveEntrances(), and yaze::zelda3::SaveHoles().

Referenced by yaze::editor::OverworldEditor::Save(), and Save().

Here is the call graph for this function:

◆ SaveExits()

absl::Status yaze::zelda3::Overworld::SaveExits ( )

Save exit return points to ROM.

Definition at line 2907 of file overworld.cc.

References all_exits_, RETURN_IF_ERROR, rom_, and yaze::zelda3::SaveExits().

Referenced by yaze::editor::OverworldEditor::Save(), and Save().

Here is the call graph for this function:

◆ SaveItems()

absl::Status yaze::zelda3::Overworld::SaveItems ( )

Save hidden overworld items to ROM.

Definition at line 2912 of file overworld.cc.

References all_items_, RETURN_IF_ERROR, rom_, and yaze::zelda3::SaveItems().

Referenced by yaze::editor::OverworldEditor::Save(), and Save().

Here is the call graph for this function:

◆ SaveMapOverlays()

absl::Status yaze::zelda3::Overworld::SaveMapOverlays ( )

Save interactive overlay data to ROM.

Definition at line 2917 of file overworld.cc.

References yaze::zelda3::kNumOverworldMaps, yaze::zelda3::kOverlayCodeStart, yaze::util::logf(), overworld_maps_, yaze::PcToSnes(), RETURN_IF_ERROR, and rom().

Referenced by Save().

Here is the call graph for this function:

◆ SaveOverworldTilesType()

absl::Status yaze::zelda3::Overworld::SaveOverworldTilesType ( )

Save tile type collision data to ROM.

Definition at line 2989 of file overworld.cc.

References all_tiles_types_, yaze::zelda3::kNumTileTypes, yaze::util::logf(), yaze::zelda3::overworldTilesType, RETURN_IF_ERROR, and rom().

Referenced by Save().

Here is the call graph for this function:

◆ SaveCustomOverworldASM()

◆ SaveAreaSpecificBGColors()

absl::Status yaze::zelda3::Overworld::SaveAreaSpecificBGColors ( )

◆ CreateTile32Tilemap()

absl::Status yaze::zelda3::Overworld::CreateTile32Tilemap ( )

Build tile32 tilemap from current tile16 data.

Note
Must be called before SaveMap32Tiles()

Definition at line 2426 of file overworld.cc.

References yaze::core::FeatureFlags::get(), yaze::gfx::Tile32::GetPackedValue(), yaze::zelda3::LimitOfMap32, map_tiles_, yaze::zelda3::NumberOfMap32, tiles32_list_, and tiles32_unique_.

Referenced by yaze::editor::OverworldEditor::Save().

Here is the call graph for this function:

◆ SaveMap16Expanded()

absl::Status yaze::zelda3::Overworld::SaveMap16Expanded ( )

Save expanded tile16 definitions (v1+ ROMs)

Definition at line 2784 of file overworld.cc.

References yaze::zelda3::kMap16TilesExpanded, yaze::zelda3::NumberOfMap16Ex, yaze::PcToSnes(), RETURN_IF_ERROR, rom(), yaze::SnesToPc(), and tiles16_.

Referenced by Save().

Here is the call graph for this function:

◆ SaveMap16Tiles()

absl::Status yaze::zelda3::Overworld::SaveMap16Tiles ( )

Save tile16 definitions to ROM.

Definition at line 2879 of file overworld.cc.

References yaze::zelda3::kMap16Tiles, yaze::util::logf(), yaze::zelda3::NumberOfMap16, RETURN_IF_ERROR, rom(), and tiles16_.

Referenced by yaze::editor::OverworldEditor::Save(), and Save().

Here is the call graph for this function:

◆ SaveMap32Expanded()

absl::Status yaze::zelda3::Overworld::SaveMap32Expanded ( )

Save expanded tile32 definitions (v1+ ROMs)

Definition at line 2486 of file overworld.cc.

References yaze::zelda3::kMap32TileBLExpanded, yaze::zelda3::kMap32TileBRExpanded, zelda3_version_pointers::kMap32TileTL, yaze::zelda3::kMap32TileTRExpanded, yaze::PcToSnes(), RETURN_IF_ERROR, rom(), tiles32_unique_, and version_constants().

Referenced by Save().

Here is the call graph for this function:

◆ SaveMap32Tiles()

absl::Status yaze::zelda3::Overworld::SaveMap32Tiles ( )

◆ SaveMapProperties()

◆ SaveMusic()

◆ SaveAreaSizes()

absl::Status yaze::zelda3::Overworld::SaveAreaSizes ( )

Save area size enum data (v3+ only)

Definition at line 3246 of file overworld.cc.

References yaze::zelda3::kNumOverworldMaps, yaze::zelda3::kOverworldMessagesExpanded, yaze::zelda3::kOverworldScreenSize, yaze::util::logf(), overworld_maps_, yaze::zelda3::OverworldCustomASMHasBeenApplied, RETURN_IF_ERROR, and rom().

Referenced by Save().

Here is the call graph for this function:

◆ AssignMapSizes()

void yaze::zelda3::Overworld::AssignMapSizes ( std::vector< OverworldMap > & maps)

Assign map sizes based on area size enum (v3+)

Loads all maps from ROM to see what size they are.

Parameters
mapsThe maps to update (passed by reference)

Definition at line 218 of file overworld.cc.

References yaze::zelda3::kNumOverworldMaps, yaze::zelda3::LargeArea, yaze::zelda3::SmallArea, yaze::zelda3::TallArea, and yaze::zelda3::WideArea.

Referenced by Load().

◆ ConfigureMultiAreaMap()

◆ rom()

◆ mutable_rom()

auto yaze::zelda3::Overworld::mutable_rom ( )
inline

Definition at line 416 of file overworld.h.

References rom_.

◆ HasExpandedPointerTables()

bool yaze::zelda3::Overworld::HasExpandedPointerTables ( ) const
inline

Check if the ROM has expanded pointer tables for tail maps.

Returns true if the TailMapExpansion.asm patch has been applied, enabling support for maps 0xA0-0xBF. Detection is based on the marker byte at 0x1423FF being 0xEA.

Definition at line 425 of file overworld.h.

References yaze::Rom::data(), yaze::zelda3::kExpandedPtrTableMagic, yaze::zelda3::kExpandedPtrTableMarker, rom_, and yaze::Rom::size().

Referenced by DecompressAllMapTilesParallel(), and EnsureMapBuilt().

Here is the call graph for this function:

◆ Destroy()

void yaze::zelda3::Overworld::Destroy ( )
inline

Definition at line 432 of file overworld.h.

References all_entrances_, all_exits_, all_items_, all_sprites_, is_loaded_, overworld_maps_, sprites(), tiles16_, tiles32_, and tiles32_unique_.

Referenced by yaze::editor::OverworldEditor::Clear().

Here is the call graph for this function:

◆ GetTileFromPosition()

◆ GetMapTiles()

◆ overworld_maps()

auto yaze::zelda3::Overworld::overworld_maps ( ) const
inline

◆ overworld_map()

◆ mutable_overworld_map()

auto yaze::zelda3::Overworld::mutable_overworld_map ( int i)
inline

Definition at line 479 of file overworld.h.

References overworld_maps_.

Referenced by yaze::editor::MapPropertiesSystem::DrawBasicPropertiesTab(), yaze::editor::OverworldSidebar::DrawConfiguration(), yaze::editor::MapPropertiesSystem::DrawCustomBackgroundColorEditor(), yaze::editor::MapPropertiesSystem::DrawCustomFeaturesTab(), yaze::editor::MapPropertiesSystem::DrawGraphicsPopup(), yaze::editor::OverworldSidebar::DrawGraphicsSettings(), yaze::editor::MapPropertiesSystem::DrawMosaicControls(), yaze::editor::MapPropertiesSystem::DrawMusicTab(), yaze::editor::OverworldSidebar::DrawMusicTab(), yaze::editor::MapPropertiesSystem::DrawOverlayControls(), yaze::editor::MapPropertiesSystem::DrawOverlayEditor(), yaze::editor::OverworldSidebar::DrawPaletteSettings(), yaze::editor::MapPropertiesSystem::DrawPalettesPopup(), yaze::editor::MapPropertiesSystem::DrawPropertiesPopup(), yaze::editor::MapPropertiesSystem::DrawSpritePropertiesTab(), yaze::editor::OverworldSidebar::DrawSpritePropertiesTab(), yaze::editor::MapPropertiesSystem::DrawTileGraphicsTab(), InvalidateSiblingMapCaches(), yaze::editor::OverworldEditor::RefreshChildMap(), yaze::editor::OverworldEditor::RefreshChildMapOnDemand(), yaze::editor::OverworldEditor::RefreshMapPalette(), yaze::editor::OverworldEditor::RefreshMapProperties(), yaze::editor::OverworldEditor::RefreshMultiAreaMapsSafely(), yaze::editor::MapPropertiesSystem::RefreshSiblingMapGraphics(), yaze::editor::OverworldEditor::RefreshSiblingMapGraphics(), and yaze::test::RomDependentTestSuite::RunComprehensiveSaveTest().

◆ exits()

auto yaze::zelda3::Overworld::exits ( ) const
inline

Definition at line 485 of file overworld.h.

References all_exits_.

◆ mutable_exits()

auto yaze::zelda3::Overworld::mutable_exits ( )
inline

◆ tiles16()

◆ tiles32_unique()

auto yaze::zelda3::Overworld::tiles32_unique ( ) const
inline

◆ mutable_tiles16()

auto yaze::zelda3::Overworld::mutable_tiles16 ( )
inline

◆ sprites()

auto yaze::zelda3::Overworld::sprites ( int state) const
inline

Definition at line 490 of file overworld.h.

References all_sprites_.

Referenced by yaze::cli::overworld::CollectOverworldSprites(), and Destroy().

◆ mutable_sprites()

◆ current_graphics()

auto yaze::zelda3::Overworld::current_graphics ( ) const
inline

◆ entrances() [1/2]

◆ entrances() [2/2]

auto & yaze::zelda3::Overworld::entrances ( )
inline

Definition at line 505 of file overworld.h.

References all_entrances_.

◆ mutable_entrances()

auto yaze::zelda3::Overworld::mutable_entrances ( )
inline

Definition at line 506 of file overworld.h.

References all_entrances_.

Referenced by yaze::editor::InsertEntrance().

◆ holes() [1/2]

const std::vector< OverworldEntrance > & yaze::zelda3::Overworld::holes ( ) const
inline

Definition at line 507 of file overworld.h.

References all_holes_.

Referenced by yaze::cli::overworld::CollectWarpEntries(), and yaze::editor::InsertEntrance().

◆ holes() [2/2]

auto & yaze::zelda3::Overworld::holes ( )
inline

Definition at line 508 of file overworld.h.

References all_holes_.

◆ mutable_holes()

auto yaze::zelda3::Overworld::mutable_holes ( )
inline

Definition at line 509 of file overworld.h.

References all_holes_.

◆ deleted_entrances()

auto yaze::zelda3::Overworld::deleted_entrances ( ) const
inline

Definition at line 510 of file overworld.h.

References deleted_entrances_.

◆ mutable_deleted_entrances()

auto yaze::zelda3::Overworld::mutable_deleted_entrances ( )
inline

Definition at line 511 of file overworld.h.

References deleted_entrances_.

◆ current_area_palette()

◆ current_map_bitmap_data()

auto yaze::zelda3::Overworld::current_map_bitmap_data ( ) const
inline

Definition at line 516 of file overworld.h.

References current_map_, is_current_map_valid(), and overworld_maps_.

Referenced by yaze::editor::OverworldEditor::EnsureMapTexture(), and yaze::editor::OverworldEditor::LoadGraphics().

Here is the call graph for this function:

◆ tile16_blockset_data()

auto yaze::zelda3::Overworld::tile16_blockset_data ( ) const
inline

Definition at line 520 of file overworld.h.

References current_map_, is_current_map_valid(), and overworld_maps_.

Referenced by yaze::editor::OverworldEditor::LoadGraphics(), and yaze::editor::OverworldEditor::RefreshTile16Blockset().

Here is the call graph for this function:

◆ is_current_map_valid()

bool yaze::zelda3::Overworld::is_current_map_valid ( ) const
inline

◆ is_loaded()

◆ expanded_tile16()

auto yaze::zelda3::Overworld::expanded_tile16 ( ) const
inline

◆ expanded_tile32()

auto yaze::zelda3::Overworld::expanded_tile32 ( ) const
inline

◆ expanded_entrances()

auto yaze::zelda3::Overworld::expanded_entrances ( ) const
inline

Definition at line 531 of file overworld.h.

References expanded_entrances_.

◆ current_map_id()

int yaze::zelda3::Overworld::current_map_id ( ) const
inline

Definition at line 532 of file overworld.h.

References current_map_.

◆ current_world()

int yaze::zelda3::Overworld::current_world ( ) const
inline

Definition at line 533 of file overworld.h.

References current_world_.

◆ set_current_map()

◆ set_current_world()

◆ GetTile()

◆ SetTile()

◆ map_tiles()

auto yaze::zelda3::Overworld::map_tiles ( ) const
inline

Definition at line 554 of file overworld.h.

References map_tiles_.

◆ mutable_map_tiles()

◆ all_items()

auto yaze::zelda3::Overworld::all_items ( ) const
inline

Definition at line 556 of file overworld.h.

References all_items_.

◆ mutable_all_items()

auto yaze::zelda3::Overworld::mutable_all_items ( )
inline

◆ all_tiles_types()

auto yaze::zelda3::Overworld::all_tiles_types ( ) const
inline

Definition at line 558 of file overworld.h.

References all_tiles_types_.

◆ mutable_all_tiles_types()

auto yaze::zelda3::Overworld::mutable_all_tiles_types ( )
inline

Definition at line 559 of file overworld.h.

References all_tiles_types_.

Referenced by yaze::editor::OverworldEditor::Load().

◆ all_sprites()

auto yaze::zelda3::Overworld::all_sprites ( ) const
inline

Definition at line 560 of file overworld.h.

References all_sprites_.

◆ diggable_tiles()

const DiggableTiles & yaze::zelda3::Overworld::diggable_tiles ( ) const
inline

◆ mutable_diggable_tiles()

DiggableTiles * yaze::zelda3::Overworld::mutable_diggable_tiles ( )
inline

Definition at line 564 of file overworld.h.

References diggable_tiles_.

◆ LoadDiggableTiles()

◆ SaveDiggableTiles()

◆ AutoDetectDiggableTiles()

◆ FetchLargeMaps()

void yaze::zelda3::Overworld::FetchLargeMaps ( )
private

Definition at line 127 of file overworld.cc.

References yaze::zelda3::kNumOverworldMaps, and overworld_maps_.

Referenced by Load().

◆ GetTile16ForTile32()

absl::StatusOr< uint16_t > yaze::zelda3::Overworld::GetTile16ForTile32 ( int index,
int quadrant,
int dimension,
const uint32_t * map32address )
private

Definition at line 463 of file overworld.cc.

References ASSIGN_OR_RETURN, and rom().

Referenced by AssembleMap32Tiles().

Here is the call graph for this function:

◆ AssembleMap32Tiles()

◆ AssembleMap16Tiles()

◆ AssignWorldTiles()

void yaze::zelda3::Overworld::AssignWorldTiles ( int x,
int y,
int sx,
int sy,
int tpos,
OverworldBlockset & world )
private

Definition at line 579 of file overworld.cc.

References tiles32_unique_.

Referenced by OrganizeMapTiles().

◆ FillBlankMapTiles()

void yaze::zelda3::Overworld::FillBlankMapTiles ( int map_index)
private

Definition at line 602 of file overworld.cc.

References yaze::zelda3::kDarkWorldMapIdStart, yaze::zelda3::kSpecialWorldMapIdStart, and SelectWorldBlockset().

Referenced by DecompressAllMapTilesParallel(), and EnsureMapBuilt().

Here is the call graph for this function:

◆ SelectWorldBlockset()

OverworldBlockset & yaze::zelda3::Overworld::SelectWorldBlockset ( int world_type)
private

◆ OrganizeMapTiles()

void yaze::zelda3::Overworld::OrganizeMapTiles ( std::vector< uint8_t > & bytes,
std::vector< uint8_t > & bytes2,
int i,
int sx,
int sy,
int & ttpos )
private

◆ DecompressAllMapTilesParallel()

Member Data Documentation

◆ rom_

◆ game_data_

GameData* yaze::zelda3::Overworld::game_data_ = nullptr
private

Definition at line 593 of file overworld.h.

Referenced by Load(), SetGameData(), and version_constants().

◆ is_loaded_

bool yaze::zelda3::Overworld::is_loaded_ = false
private

Definition at line 595 of file overworld.h.

Referenced by Destroy(), is_loaded(), and Load().

◆ expanded_tile16_

bool yaze::zelda3::Overworld::expanded_tile16_ = false
private

Definition at line 596 of file overworld.h.

Referenced by AssembleMap16Tiles(), expanded_tile16(), and Save().

◆ expanded_tile32_

bool yaze::zelda3::Overworld::expanded_tile32_ = false
private

Definition at line 597 of file overworld.h.

Referenced by AssembleMap32Tiles(), expanded_tile32(), and Save().

◆ expanded_entrances_

bool yaze::zelda3::Overworld::expanded_entrances_ = false
private

Definition at line 598 of file overworld.h.

Referenced by expanded_entrances(), and SaveEntrances().

◆ game_state_

int yaze::zelda3::Overworld::game_state_ = 0
private

Definition at line 600 of file overworld.h.

Referenced by ComputeGraphicsConfigHash(), EnsureMapBuilt(), and LoadOverworldMaps().

◆ current_map_

int yaze::zelda3::Overworld::current_map_ = 0
private

◆ current_world_

int yaze::zelda3::Overworld::current_world_ = 0
private

Definition at line 602 of file overworld.h.

Referenced by current_world(), GetTile(), GetTileFromPosition(), set_current_world(), and SetTile().

◆ map_tiles_

◆ map_tiles_mutex_

std::mutex yaze::zelda3::Overworld::map_tiles_mutex_
mutableprivate

Definition at line 607 of file overworld.h.

◆ kMaxBuiltMaps

constexpr int yaze::zelda3::Overworld::kMaxBuiltMaps = 20
staticconstexprprivate

Definition at line 611 of file overworld.h.

Referenced by EnsureMapBuilt().

◆ built_map_lru_

std::deque<int> yaze::zelda3::Overworld::built_map_lru_
private

Definition at line 612 of file overworld.h.

Referenced by EnsureMapBuilt().

◆ gfx_config_cache_

std::unordered_map<uint64_t, GraphicsConfigCache> yaze::zelda3::Overworld::gfx_config_cache_
private

◆ kMaxCachedConfigs

constexpr int yaze::zelda3::Overworld::kMaxCachedConfigs = 8
staticconstexprprivate

Definition at line 627 of file overworld.h.

Referenced by CacheTileset().

◆ overworld_maps_

◆ all_entrances_

std::vector<OverworldEntrance> yaze::zelda3::Overworld::all_entrances_
private

Definition at line 631 of file overworld.h.

Referenced by Destroy(), entrances(), entrances(), Load(), mutable_entrances(), and SaveEntrances().

◆ all_holes_

std::vector<OverworldEntrance> yaze::zelda3::Overworld::all_holes_
private

Definition at line 632 of file overworld.h.

Referenced by holes(), holes(), Load(), mutable_holes(), and SaveEntrances().

◆ all_exits_

std::vector<OverworldExit> yaze::zelda3::Overworld::all_exits_
private

Definition at line 633 of file overworld.h.

Referenced by Destroy(), exits(), Load(), mutable_exits(), and SaveExits().

◆ all_items_

std::vector<OverworldItem> yaze::zelda3::Overworld::all_items_
private

Definition at line 634 of file overworld.h.

Referenced by all_items(), Destroy(), Load(), mutable_all_items(), and SaveItems().

◆ tiles16_

std::vector<gfx::Tile16> yaze::zelda3::Overworld::tiles16_
private

◆ tiles32_

std::vector<gfx::Tile32> yaze::zelda3::Overworld::tiles32_
private

Definition at line 637 of file overworld.h.

Referenced by Destroy().

◆ tiles32_unique_

std::vector<gfx::Tile32> yaze::zelda3::Overworld::tiles32_unique_
private

◆ tiles32_list_

std::vector<uint16_t> yaze::zelda3::Overworld::tiles32_list_
private

Definition at line 640 of file overworld.h.

Referenced by CreateTile32Tilemap(), and SaveOverworldMaps().

◆ deleted_entrances_

std::vector<uint64_t> yaze::zelda3::Overworld::deleted_entrances_
private

Definition at line 641 of file overworld.h.

Referenced by deleted_entrances(), and mutable_deleted_entrances().

◆ map_parent_

std::array<uint8_t, kNumOverworldMaps> yaze::zelda3::Overworld::map_parent_ = {0}
private

Definition at line 643 of file overworld.h.

Referenced by Load(), and LoadSpritesFromMap().

◆ all_tiles_types_

std::array<uint8_t, kNumTileTypes> yaze::zelda3::Overworld::all_tiles_types_ = {0}
private

◆ all_sprites_

std::array<std::vector<Sprite>, 3> yaze::zelda3::Overworld::all_sprites_
private

Definition at line 645 of file overworld.h.

Referenced by all_sprites(), Destroy(), LoadSpritesFromMap(), mutable_sprites(), and sprites().

◆ diggable_tiles_

DiggableTiles yaze::zelda3::Overworld::diggable_tiles_
private

◆ map_data_p1

std::array<std::vector<uint8_t>, kNumOverworldMaps> yaze::zelda3::Overworld::map_data_p1
private

Definition at line 647 of file overworld.h.

Referenced by SaveOverworldMaps().

◆ map_data_p2

std::array<std::vector<uint8_t>, kNumOverworldMaps> yaze::zelda3::Overworld::map_data_p2
private

Definition at line 648 of file overworld.h.

Referenced by SaveOverworldMaps().

◆ map_pointers1_id

std::array<int, kNumOverworldMaps> yaze::zelda3::Overworld::map_pointers1_id
private

Definition at line 649 of file overworld.h.

Referenced by SaveOverworldMaps().

◆ map_pointers2_id

std::array<int, kNumOverworldMaps> yaze::zelda3::Overworld::map_pointers2_id
private

Definition at line 650 of file overworld.h.

Referenced by SaveOverworldMaps().

◆ map_pointers1

std::array<int, kNumOverworldMaps> yaze::zelda3::Overworld::map_pointers1
private

Definition at line 651 of file overworld.h.

Referenced by SaveOverworldMaps().

◆ map_pointers2

std::array<int, kNumOverworldMaps> yaze::zelda3::Overworld::map_pointers2
private

Definition at line 652 of file overworld.h.

Referenced by SaveOverworldMaps().


The documentation for this class was generated from the following files: