yaze 0.2.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>

Inheritance diagram for yaze::zelda3::Overworld:
Collaboration diagram for yaze::zelda3::Overworld:

Public Member Functions

 Overworld (Rom &rom)
 
absl::Status Load (Rom &rom)
 
absl::Status LoadOverworldMaps ()
 
void LoadTileTypes ()
 
absl::Status LoadEntrances ()
 
absl::Status LoadHoles ()
 
absl::Status LoadExits ()
 
absl::Status LoadItems ()
 
absl::Status LoadSprites ()
 
absl::Status LoadSpritesFromMap (int sprite_start, int sprite_count, int sprite_index)
 
absl::Status Save (Rom &rom)
 
absl::Status SaveOverworldMaps ()
 
absl::Status SaveLargeMaps ()
 
absl::Status SaveEntrances ()
 
absl::Status SaveExits ()
 
absl::Status SaveItems ()
 
absl::Status CreateTile32Tilemap ()
 
absl::Status SaveMap16Expanded ()
 
absl::Status SaveMap16Tiles ()
 
absl::Status SaveMap32Expanded ()
 
absl::Status SaveMap32Tiles ()
 
absl::Status SaveMapProperties ()
 
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 mutable_tiles16 ()
 
auto sprites (int state) const
 
auto mutable_sprites (int state)
 
auto current_graphics () const
 
auto & entrances ()
 
auto mutable_entrances ()
 
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
 
auto is_loaded () const
 
void set_current_map (int i)
 
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 ()
 
- Public Member Functions inherited from yaze::SharedRom
 SharedRom ()=default
 
virtual ~SharedRom ()=default
 
std::shared_ptr< Romshared_rom ()
 
auto rom ()
 

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 OrganizeMapTiles (std::vector< uint8_t > &bytes, std::vector< uint8_t > &bytes2, int i, int sx, int sy, int &ttpos)
 
void DecompressAllMapTiles ()
 

Private Attributes

Romrom_
 
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::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_
 
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
 
std::vector< absl::flat_hash_map< uint16_t, int > > usage_stats_
 

Additional Inherited Members

- Static Public Attributes inherited from yaze::SharedRom
static std::shared_ptr< Romshared_rom_ = nullptr
 

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.

Definition at line 111 of file overworld.h.

Member Enumeration Documentation

◆ Dimension

Enumerator
map32TilesTL 
map32TilesTR 
map32TilesBL 
map32TilesBR 

Definition at line 216 of file overworld.h.

Constructor & Destructor Documentation

◆ Overworld()

yaze::zelda3::Overworld::Overworld ( Rom & rom)
inline

Definition at line 113 of file overworld.h.

References yaze::SharedRom::rom(), and rom_.

Here is the call graph for this function:

Member Function Documentation

◆ Load()

◆ LoadOverworldMaps()

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

◆ LoadTileTypes()

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

Definition at line 297 of file overworld.cc.

References all_tiles_types_, yaze::zelda3::kNumTileTypes, and yaze::SharedRom::rom().

Here is the call graph for this function:

◆ LoadEntrances()

◆ LoadHoles()

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

Definition at line 339 of file overworld.cc.

References all_holes_, ASSIGN_OR_RETURN, yaze::zelda3::kOverworldHoleArea, yaze::zelda3::kOverworldHoleEntrance, yaze::zelda3::kOverworldHolePos, and yaze::SharedRom::rom().

Referenced by Load().

Here is the call graph for this function:

◆ LoadExits()

◆ LoadItems()

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

Definition at line 416 of file overworld.cc.

References all_items_, ASSIGN_OR_RETURN, yaze::zelda3::kOverworldItemsAddress, overworld_maps_, yaze::SharedRom::rom(), and yaze::SnesToPc().

Referenced by Load().

Here is the call graph for this function:

◆ LoadSprites()

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

Definition at line 466 of file overworld.cc.

References yaze::zelda3::kOverworldSpritesAgahnim, yaze::zelda3::kOverworldSpritesBeginning, yaze::zelda3::kOverworldSpritesZelda, LoadSpritesFromMap(), and RETURN_IF_ERROR.

Referenced by Load().

Here is the call graph for this function:

◆ LoadSpritesFromMap()

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

Definition at line 485 of file overworld.cc.

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

Referenced by LoadSprites().

Here is the call graph for this function:

◆ Save()

◆ SaveOverworldMaps()

◆ SaveLargeMaps()

◆ SaveEntrances()

◆ SaveExits()

◆ SaveItems()

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

◆ CreateTile32Tilemap()

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

◆ SaveMap16Expanded()

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

Definition at line 1281 of file overworld.cc.

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

Referenced by Save().

Here is the call graph for this function:

◆ SaveMap16Tiles()

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

Definition at line 1359 of file overworld.cc.

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

Referenced by Save().

Here is the call graph for this function:

◆ SaveMap32Expanded()

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

◆ SaveMap32Tiles()

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

Definition at line 1152 of file overworld.cc.

References map32TilesBL, map32TilesBR, RETURN_IF_ERROR, yaze::SharedRom::rom(), and tiles32_unique_.

Referenced by Save().

Here is the call graph for this function:

◆ SaveMapProperties()

◆ Destroy()

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

Definition at line 142 of file overworld.h.

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

Here is the call graph for this function:

◆ GetTileFromPosition()

int yaze::zelda3::Overworld::GetTileFromPosition ( ImVec2 position) const
inline

Definition at line 156 of file overworld.h.

References current_world_, and map_tiles_.

◆ GetMapTiles()

OverworldBlockset & yaze::zelda3::Overworld::GetMapTiles ( int world_type)
inline

Definition at line 166 of file overworld.h.

References map_tiles_.

Referenced by LoadOverworldMaps().

◆ overworld_maps()

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

Definition at line 179 of file overworld.h.

References overworld_maps_.

◆ overworld_map()

auto yaze::zelda3::Overworld::overworld_map ( int i) const
inline

Definition at line 180 of file overworld.h.

References overworld_maps_.

◆ mutable_overworld_map()

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

Definition at line 181 of file overworld.h.

References overworld_maps_.

◆ exits()

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

Definition at line 182 of file overworld.h.

References all_exits_.

Referenced by LoadExits().

◆ mutable_exits()

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

Definition at line 183 of file overworld.h.

References all_exits_.

◆ tiles16()

std::vector< gfx::Tile16 > yaze::zelda3::Overworld::tiles16 ( ) const
inline

Definition at line 184 of file overworld.h.

References tiles16_.

◆ mutable_tiles16()

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

Definition at line 185 of file overworld.h.

References tiles16_.

◆ sprites()

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

Definition at line 186 of file overworld.h.

References all_sprites_.

Referenced by Destroy().

◆ mutable_sprites()

auto yaze::zelda3::Overworld::mutable_sprites ( int state)
inline

Definition at line 187 of file overworld.h.

References all_sprites_.

◆ current_graphics()

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

Definition at line 188 of file overworld.h.

References current_map_, and overworld_maps_.

◆ entrances()

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

Definition at line 191 of file overworld.h.

References all_entrances_.

◆ mutable_entrances()

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

Definition at line 192 of file overworld.h.

References all_entrances_.

◆ holes()

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

Definition at line 193 of file overworld.h.

References all_holes_.

◆ mutable_holes()

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

Definition at line 194 of file overworld.h.

References all_holes_.

◆ deleted_entrances()

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

Definition at line 195 of file overworld.h.

References deleted_entrances_.

◆ mutable_deleted_entrances()

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

Definition at line 196 of file overworld.h.

References deleted_entrances_.

◆ current_area_palette()

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

Definition at line 197 of file overworld.h.

References current_map_, and overworld_maps_.

◆ current_map_bitmap_data()

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

Definition at line 200 of file overworld.h.

References current_map_, and overworld_maps_.

◆ tile16_blockset_data()

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

Definition at line 203 of file overworld.h.

References current_map_, and overworld_maps_.

◆ is_loaded()

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

Definition at line 206 of file overworld.h.

References is_loaded_.

◆ set_current_map()

void yaze::zelda3::Overworld::set_current_map ( int i)
inline

Definition at line 207 of file overworld.h.

References current_map_.

◆ map_tiles()

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

Definition at line 208 of file overworld.h.

References map_tiles_.

◆ mutable_map_tiles()

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

Definition at line 209 of file overworld.h.

References map_tiles_.

◆ all_items()

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

Definition at line 210 of file overworld.h.

References all_items_.

◆ mutable_all_items()

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

Definition at line 211 of file overworld.h.

References all_items_.

◆ all_tiles_types()

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

Definition at line 212 of file overworld.h.

References all_tiles_types_.

◆ mutable_all_tiles_types()

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

Definition at line 213 of file overworld.h.

References all_tiles_types_.

◆ FetchLargeMaps()

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

Definition at line 45 of file overworld.cc.

References 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 98 of file overworld.cc.

References ASSIGN_OR_RETURN, and rom_.

Referenced by AssembleMap32Tiles().

◆ AssembleMap32Tiles()

◆ AssembleMap16Tiles()

◆ AssignWorldTiles()

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

Definition at line 190 of file overworld.cc.

References tiles32_unique_.

Referenced by OrganizeMapTiles().

◆ 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

Definition at line 202 of file overworld.cc.

References AssignWorldTiles(), yaze::zelda3::kDarkWorldMapIdStart, map_tiles_, and tiles32_unique_.

Referenced by DecompressAllMapTiles().

Here is the call graph for this function:

◆ DecompressAllMapTiles()

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

Definition at line 222 of file overworld.cc.

References yaze::gfx::HyruleMagicDecompress(), yaze::zelda3::kNumOverworldMaps, OrganizeMapTiles(), yaze::SharedRom::rom(), and yaze::SnesToPc().

Referenced by Load().

Here is the call graph for this function:

Member Data Documentation

◆ rom_

Rom& yaze::zelda3::Overworld::rom_
private

Definition at line 236 of file overworld.h.

Referenced by AssembleMap32Tiles(), GetTile16ForTile32(), Load(), Overworld(), and Save().

◆ is_loaded_

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

Definition at line 238 of file overworld.h.

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

◆ expanded_tile16_

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

Definition at line 239 of file overworld.h.

Referenced by AssembleMap16Tiles(), and Save().

◆ expanded_tile32_

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

Definition at line 240 of file overworld.h.

Referenced by AssembleMap32Tiles(), and Save().

◆ expanded_entrances_

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

Definition at line 241 of file overworld.h.

Referenced by LoadEntrances(), and SaveEntrances().

◆ game_state_

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

Definition at line 243 of file overworld.h.

Referenced by LoadOverworldMaps().

◆ current_map_

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

◆ current_world_

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

Definition at line 245 of file overworld.h.

Referenced by GetTileFromPosition().

◆ map_tiles_

OverworldMapTiles yaze::zelda3::Overworld::map_tiles_
private

◆ overworld_maps_

◆ all_entrances_

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

Definition at line 250 of file overworld.h.

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

◆ all_holes_

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

Definition at line 251 of file overworld.h.

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

◆ all_exits_

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

Definition at line 252 of file overworld.h.

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

◆ all_items_

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

Definition at line 253 of file overworld.h.

Referenced by all_items(), Destroy(), LoadItems(), 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 256 of file overworld.h.

◆ 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 259 of file overworld.h.

Referenced by CreateTile32Tilemap(), and SaveOverworldMaps().

◆ deleted_entrances_

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

Definition at line 260 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 262 of file overworld.h.

Referenced by LoadSpritesFromMap().

◆ all_tiles_types_

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

Definition at line 263 of file overworld.h.

Referenced by all_tiles_types(), LoadTileTypes(), and mutable_all_tiles_types().

◆ all_sprites_

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

Definition at line 264 of file overworld.h.

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

◆ map_data_p1

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

Definition at line 265 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 266 of file overworld.h.

Referenced by SaveOverworldMaps().

◆ map_pointers1_id

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

Definition at line 267 of file overworld.h.

Referenced by SaveOverworldMaps().

◆ map_pointers2_id

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

Definition at line 268 of file overworld.h.

Referenced by SaveOverworldMaps().

◆ map_pointers1

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

Definition at line 269 of file overworld.h.

Referenced by SaveOverworldMaps().

◆ map_pointers2

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

Definition at line 270 of file overworld.h.

Referenced by SaveOverworldMaps().

◆ usage_stats_

std::vector<absl::flat_hash_map<uint16_t, int> > yaze::zelda3::Overworld::usage_stats_
private

Definition at line 272 of file overworld.h.


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