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

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

#include <overworld.h>

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

Public Member Functions

absl::Status Load (Rom &rom)
 
absl::Status LoadOverworldMaps ()
 
void LoadTileTypes ()
 
void LoadEntrances ()
 
absl::Status LoadExits ()
 
absl::Status LoadItems ()
 
absl::Status LoadSprites ()
 
absl::Status LoadSpritesFromMap (int spriteStart, int spriteCount, int spriteIndex)
 
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
 
OWBlocksetGetMapTiles (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::app::SharedRom
 SharedRom ()=default
 
virtual ~SharedRom ()=default
 
std::shared_ptr< Romshared_rom ()
 
auto rom ()
 
- Public Member Functions inherited from yaze::app::core::ExperimentFlags
 ExperimentFlags ()=default
 
virtual ~ExperimentFlags ()=default
 
auto flags () const
 
Flagsmutable_flags ()
 
std::string Serialize () const
 

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 ()
 
void AssembleMap16Tiles ()
 
void AssignWorldTiles (int x, int y, int sx, int sy, int tpos, OWBlockset &world)
 
void OrganizeMapTiles (std::vector< uint8_t > &bytes, std::vector< uint8_t > &bytes2, int i, int sx, int sy, int &ttpos)
 
absl::Status DecompressAllMapTiles ()
 

Private Attributes

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
 
uchar map_parent_ [160]
 
Rom rom_
 
OWMapTiles map_tiles_
 
uint8_t all_tiles_types_ [0x200]
 
std::vector< gfx::Tile16tiles16_
 
std::vector< gfx::Tile32tiles32_
 
std::vector< uint16_t > tiles32_list_
 
std::vector< gfx::Tile32tiles32_unique_
 
std::vector< OverworldMapoverworld_maps_
 
std::vector< OverworldEntranceall_entrances_
 
std::vector< OverworldEntranceall_holes_
 
std::vector< OverworldExitall_exits_
 
std::vector< OverworldItemall_items_
 
std::vector< std::vector< Sprite > > all_sprites_
 
std::vector< uint64_t > deleted_entrances_
 
std::vector< std::vector< uint8_t > > map_data_p1
 
std::vector< std::vector< uint8_t > > map_data_p2
 
std::vector< int > map_pointers1_id = std::vector<int>(kNumOverworldMaps)
 
std::vector< int > map_pointers2_id = std::vector<int>(kNumOverworldMaps)
 
std::vector< int > map_pointers1 = std::vector<int>(kNumOverworldMaps)
 
std::vector< int > map_pointers2 = std::vector<int>(kNumOverworldMaps)
 
std::vector< absl::flat_hash_map< uint16_t, int > > usage_stats_
 

Additional Inherited Members

- Static Public Attributes inherited from yaze::app::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 461 of file overworld.h.

Member Enumeration Documentation

◆ Dimension

Enumerator
map32TilesTL 
map32TilesTR 
map32TilesBL 
map32TilesBR 

Definition at line 561 of file overworld.h.

Member Function Documentation

◆ Load()

◆ LoadOverworldMaps()

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

Definition at line 278 of file overworld.cc.

References game_state_, GetMapTiles(), yaze::app::zelda3::overworld::kNumOverworldMaps, overworld_maps_, and tiles16_.

Referenced by Load().

Here is the call graph for this function:

◆ LoadTileTypes()

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

Definition at line 305 of file overworld.cc.

References all_tiles_types_, and yaze::app::SharedRom::rom().

Here is the call graph for this function:

◆ LoadEntrances()

◆ LoadExits()

◆ LoadItems()

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

Definition at line 414 of file overworld.cc.

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

Referenced by Load().

Here is the call graph for this function:

◆ LoadSprites()

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

◆ LoadSpritesFromMap()

absl::Status yaze::app::zelda3::overworld::Overworld::LoadSpritesFromMap ( int spriteStart,
int spriteCount,
int spriteIndex )

Definition at line 475 of file overworld.cc.

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

Referenced by LoadSprites().

Here is the call graph for this function:

◆ Save()

absl::Status yaze::app::zelda3::overworld::Overworld::Save ( Rom & rom)

◆ SaveOverworldMaps()

◆ SaveLargeMaps()

◆ SaveEntrances()

◆ SaveExits()

◆ SaveItems()

◆ CreateTile32Tilemap()

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

◆ SaveMap16Expanded()

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

Definition at line 1285 of file overworld.cc.

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

Referenced by Save().

Here is the call graph for this function:

◆ SaveMap16Tiles()

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

◆ SaveMap32Expanded()

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

◆ SaveMap32Tiles()

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

Definition at line 1156 of file overworld.cc.

References yaze::app::core::Logger::log(), map32TilesBL, map32TilesBR, RETURN_IF_ERROR, yaze::app::SharedRom::rom(), and tiles32_unique_.

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

Here is the call graph for this function:

◆ SaveMapProperties()

◆ Destroy()

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

Definition at line 489 of file overworld.h.

References all_entrances_, all_exits_, all_items_, all_sprites_, is_loaded_, and overworld_maps_.

◆ GetTileFromPosition()

◆ GetMapTiles()

OWBlockset & yaze::app::zelda3::overworld::Overworld::GetMapTiles ( int world_type)
inline

◆ overworld_maps()

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

Definition at line 524 of file overworld.h.

References overworld_maps_.

◆ overworld_map()

◆ mutable_overworld_map()

◆ exits()

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

Definition at line 527 of file overworld.h.

References all_exits_.

Referenced by LoadExits().

◆ mutable_exits()

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

Definition at line 528 of file overworld.h.

References all_exits_.

Referenced by yaze::app::editor::OverworldEditor::DrawOverworldExits().

◆ tiles16()

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

Definition at line 529 of file overworld.h.

References tiles16_.

Referenced by yaze::app::editor::OverworldEditor::RefreshChildMap().

◆ mutable_tiles16()

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

Definition at line 530 of file overworld.h.

References tiles16_.

Referenced by yaze::app::editor::OverworldEditor::RefreshChildMap().

◆ sprites()

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

Definition at line 531 of file overworld.h.

References all_sprites_.

Referenced by yaze::app::editor::OverworldEditor::LoadSpriteGraphics().

◆ mutable_sprites()

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

Definition at line 532 of file overworld.h.

References all_sprites_.

Referenced by yaze::app::editor::OverworldEditor::DrawOverworldSprites().

◆ current_graphics()

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

◆ entrances()

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

◆ mutable_entrances()

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

Definition at line 537 of file overworld.h.

References all_entrances_.

◆ holes()

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

Definition at line 538 of file overworld.h.

References all_holes_.

◆ mutable_holes()

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

Definition at line 539 of file overworld.h.

References all_holes_.

◆ deleted_entrances()

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

◆ mutable_deleted_entrances()

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

◆ current_area_palette()

◆ current_map_bitmap_data()

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

Definition at line 545 of file overworld.h.

References current_map_, and overworld_maps_.

Referenced by yaze::app::editor::OverworldEditor::LoadGraphics().

◆ tile16_blockset_data()

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

◆ is_loaded()

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

◆ set_current_map()

◆ map_tiles()

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

Definition at line 553 of file overworld.h.

References map_tiles_.

◆ mutable_map_tiles()

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

◆ all_items()

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

Definition at line 555 of file overworld.h.

References all_items_.

◆ mutable_all_items()

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

Definition at line 556 of file overworld.h.

References all_items_.

Referenced by yaze::app::editor::OverworldEditor::DrawOverworldItems().

◆ all_tiles_types()

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

Definition at line 557 of file overworld.h.

References all_tiles_types_.

◆ mutable_all_tiles_types()

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

Definition at line 558 of file overworld.h.

References all_tiles_types_.

Referenced by yaze::app::editor::OverworldEditor::Update().

◆ FetchLargeMaps()

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

Definition at line 46 of file overworld.cc.

References overworld_maps_.

Referenced by Load().

◆ GetTile16ForTile32()

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

Definition at line 101 of file overworld.cc.

References ASSIGN_OR_RETURN, yaze::app::Rom::ReadByte(), yaze::app::Rom::ReadWord(), and rom_.

Referenced by AssembleMap32Tiles().

Here is the call graph for this function:

◆ AssembleMap32Tiles()

◆ AssembleMap16Tiles()

void yaze::app::zelda3::overworld::Overworld::AssembleMap16Tiles ( )
private

◆ AssignWorldTiles()

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

Definition at line 186 of file overworld.cc.

References tiles32_unique_.

Referenced by OrganizeMapTiles().

◆ OrganizeMapTiles()

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

◆ DecompressAllMapTiles()

absl::Status yaze::app::zelda3::overworld::Overworld::DecompressAllMapTiles ( )
private

Definition at line 218 of file overworld.cc.

References OrganizeMapTiles(), yaze::app::SharedRom::rom(), yaze::app::core::SnesToPc(), and yaze::app::gfx::lc_lz2::Uncompress().

Referenced by Load().

Here is the call graph for this function:

Member Data Documentation

◆ is_loaded_

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

Definition at line 581 of file overworld.h.

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

◆ expanded_tile16_

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

Definition at line 582 of file overworld.h.

Referenced by AssembleMap16Tiles(), and Save().

◆ expanded_tile32_

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

Definition at line 583 of file overworld.h.

Referenced by AssembleMap32Tiles(), and Save().

◆ expanded_entrances_

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

Definition at line 584 of file overworld.h.

Referenced by LoadEntrances().

◆ game_state_

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

Definition at line 586 of file overworld.h.

Referenced by LoadOverworldMaps().

◆ current_map_

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

◆ current_world_

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

Definition at line 588 of file overworld.h.

Referenced by GetTileFromPosition().

◆ map_parent_

uchar yaze::app::zelda3::overworld::Overworld::map_parent_[160]
private

Definition at line 589 of file overworld.h.

Referenced by LoadSpritesFromMap().

◆ rom_

Rom yaze::app::zelda3::overworld::Overworld::rom_
private

Definition at line 591 of file overworld.h.

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

◆ map_tiles_

OWMapTiles yaze::app::zelda3::overworld::Overworld::map_tiles_
private

◆ all_tiles_types_

uint8_t yaze::app::zelda3::overworld::Overworld::all_tiles_types_[0x200]
private

Definition at line 594 of file overworld.h.

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

◆ tiles16_

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

◆ tiles32_

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

Definition at line 597 of file overworld.h.

◆ tiles32_list_

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

Definition at line 598 of file overworld.h.

Referenced by CreateTile32Tilemap(), and SaveOverworldMaps().

◆ tiles32_unique_

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

◆ overworld_maps_

◆ all_entrances_

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

Definition at line 601 of file overworld.h.

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

◆ all_holes_

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

Definition at line 602 of file overworld.h.

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

◆ all_exits_

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

Definition at line 603 of file overworld.h.

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

◆ all_items_

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

Definition at line 604 of file overworld.h.

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

◆ all_sprites_

std::vector<std::vector<Sprite> > yaze::app::zelda3::overworld::Overworld::all_sprites_
private

Definition at line 605 of file overworld.h.

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

◆ deleted_entrances_

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

Definition at line 607 of file overworld.h.

Referenced by deleted_entrances(), and mutable_deleted_entrances().

◆ map_data_p1

std::vector<std::vector<uint8_t> > yaze::app::zelda3::overworld::Overworld::map_data_p1
private
Initial value:
=
std::vector<std::vector<uint8_t>>(kNumOverworldMaps)
constexpr int kNumOverworldMaps
Definition overworld.h:446

Definition at line 609 of file overworld.h.

Referenced by SaveOverworldMaps().

◆ map_data_p2

std::vector<std::vector<uint8_t> > yaze::app::zelda3::overworld::Overworld::map_data_p2
private
Initial value:
=
std::vector<std::vector<uint8_t>>(kNumOverworldMaps)

Definition at line 611 of file overworld.h.

Referenced by SaveOverworldMaps().

◆ map_pointers1_id

std::vector<int> yaze::app::zelda3::overworld::Overworld::map_pointers1_id = std::vector<int>(kNumOverworldMaps)
private

Definition at line 614 of file overworld.h.

Referenced by SaveOverworldMaps().

◆ map_pointers2_id

std::vector<int> yaze::app::zelda3::overworld::Overworld::map_pointers2_id = std::vector<int>(kNumOverworldMaps)
private

Definition at line 615 of file overworld.h.

Referenced by SaveOverworldMaps().

◆ map_pointers1

std::vector<int> yaze::app::zelda3::overworld::Overworld::map_pointers1 = std::vector<int>(kNumOverworldMaps)
private

Definition at line 617 of file overworld.h.

Referenced by SaveOverworldMaps().

◆ map_pointers2

std::vector<int> yaze::app::zelda3::overworld::Overworld::map_pointers2 = std::vector<int>(kNumOverworldMaps)
private

Definition at line 618 of file overworld.h.

Referenced by SaveOverworldMaps().

◆ usage_stats_

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

Definition at line 620 of file overworld.h.


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