Represents the full Overworld data, light and dark world. More...
#include <overworld.h>
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 |
OverworldBlockset & | GetMapTiles (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::Tile16 > | tiles16 () 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< Rom > | shared_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 () |
Additional Inherited Members | |
Static Public Attributes inherited from yaze::SharedRom | |
static std::shared_ptr< Rom > | shared_rom_ = nullptr |
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.
|
private |
Enumerator | |
---|---|
map32TilesTL | |
map32TilesTR | |
map32TilesBL | |
map32TilesBR |
Definition at line 216 of file overworld.h.
|
inline |
Definition at line 113 of file overworld.h.
References yaze::SharedRom::rom(), and rom_.
absl::Status yaze::zelda3::Overworld::Load | ( | Rom & | rom | ) |
Definition at line 20 of file overworld.cc.
References AssembleMap16Tiles(), AssembleMap32Tiles(), DecompressAllMapTiles(), FetchLargeMaps(), is_loaded_, yaze::zelda3::kNumOverworldMaps, LoadEntrances(), LoadExits(), LoadHoles(), LoadItems(), LoadOverworldMaps(), LoadSprites(), overworld_maps_, RETURN_IF_ERROR, yaze::SharedRom::rom(), and rom_.
absl::Status yaze::zelda3::Overworld::LoadOverworldMaps | ( | ) |
Definition at line 272 of file overworld.cc.
References game_state_, GetMapTiles(), yaze::zelda3::kDarkWorldMapIdStart, yaze::zelda3::kNumOverworldMaps, yaze::zelda3::kSpecialWorldMapIdStart, overworld_maps_, RETURN_IF_ERROR, and tiles16_.
Referenced by Load().
void yaze::zelda3::Overworld::LoadTileTypes | ( | ) |
Definition at line 297 of file overworld.cc.
References all_tiles_types_, yaze::zelda3::kNumTileTypes, and yaze::SharedRom::rom().
absl::Status yaze::zelda3::Overworld::LoadEntrances | ( | ) |
Definition at line 304 of file overworld.cc.
References all_entrances_, ASSIGN_OR_RETURN, expanded_entrances_, yaze::core::FeatureFlags::get(), yaze::zelda3::kOverworldEntranceEntranceId, yaze::zelda3::kOverworldEntranceEntranceIdExpanded, yaze::zelda3::kOverworldEntranceExpandedFlagPos, yaze::zelda3::kOverworldEntranceMap, yaze::zelda3::kOverworldEntranceMapExpanded, yaze::zelda3::kOverworldEntrancePos, yaze::zelda3::kOverworldEntrancePosExpanded, and yaze::SharedRom::rom().
Referenced by Load().
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().
absl::Status yaze::zelda3::Overworld::LoadExits | ( | ) |
Definition at line 359 of file overworld.cc.
References all_exits_, exits(), yaze::core::FeatureFlags::get(), yaze::zelda3::OWExitDoorType1, yaze::zelda3::OWExitDoorType2, yaze::zelda3::OWExitMapId, yaze::zelda3::OWExitRoomId, yaze::zelda3::OWExitUnk1, yaze::zelda3::OWExitUnk2, yaze::zelda3::OWExitVram, yaze::zelda3::OWExitXCamera, yaze::zelda3::OWExitXPlayer, yaze::zelda3::OWExitXScroll, yaze::zelda3::OWExitYCamera, yaze::zelda3::OWExitYPlayer, yaze::zelda3::OWExitYScroll, RETURN_IF_ERROR, and yaze::SharedRom::rom().
Referenced by Load().
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().
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().
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().
absl::Status yaze::zelda3::Overworld::Save | ( | Rom & | rom | ) |
Definition at line 524 of file overworld.cc.
References expanded_tile16_, expanded_tile32_, RETURN_IF_ERROR, yaze::SharedRom::rom(), rom_, SaveEntrances(), SaveExits(), SaveMap16Expanded(), SaveMap16Tiles(), SaveMap32Expanded(), SaveMap32Tiles(), and SaveOverworldMaps().
absl::Status yaze::zelda3::Overworld::SaveOverworldMaps | ( | ) |
Definition at line 536 of file overworld.cc.
References yaze::util::HexByte(), yaze::util::HexLong(), yaze::gfx::HyruleMagicCompress(), yaze::zelda3::kNumOverworldMaps, yaze::zelda3::kOverworldCompressedMapPos, yaze::zelda3::kOverworldCompressedOverflowPos, yaze::zelda3::kOverworldMapDataOverflow, map_data_p1, map_data_p2, map_pointers1, map_pointers1_id, map_pointers2, map_pointers2_id, yaze::PcToSnes(), RETURN_IF_ERROR, yaze::SharedRom::rom(), SaveLargeMaps(), and tiles32_list_.
Referenced by Save().
absl::Status yaze::zelda3::Overworld::SaveLargeMaps | ( | ) |
Definition at line 674 of file overworld.cc.
References yaze::zelda3::kDarkWorldMapIdStart, yaze::zelda3::kOverworldMapParentId, yaze::zelda3::kOverworldMapSize, yaze::zelda3::kOverworldMapSizeHighByte, yaze::zelda3::kOverworldScreenSize, yaze::zelda3::kOverworldScreenSizeForLoading, yaze::zelda3::kOverworldScreenTileMapChangeByScreen1, yaze::zelda3::kOverworldScreenTileMapChangeByScreen2, yaze::zelda3::kOverworldScreenTileMapChangeByScreen3, yaze::zelda3::kOverworldScreenTileMapChangeByScreen4, yaze::zelda3::kOverworldTransitionPositionX, yaze::zelda3::kOverworldTransitionPositionY, yaze::zelda3::kSpecialWorldMapIdStart, yaze::zelda3::kTransitionTargetNorth, yaze::zelda3::kTransitionTargetWest, overworld_maps_, RETURN_IF_ERROR, and yaze::SharedRom::rom().
Referenced by SaveOverworldMaps().
absl::Status yaze::zelda3::Overworld::SaveEntrances | ( | ) |
Definition at line 1380 of file overworld.cc.
References all_entrances_, all_holes_, expanded_entrances_, yaze::zelda3::kNumOverworldEntrances, yaze::zelda3::kNumOverworldHoles, yaze::zelda3::kOverworldEntranceEntranceId, yaze::zelda3::kOverworldEntranceEntranceIdExpanded, yaze::zelda3::kOverworldEntranceMap, yaze::zelda3::kOverworldEntranceMapExpanded, yaze::zelda3::kOverworldEntrancePos, yaze::zelda3::kOverworldEntrancePosExpanded, yaze::zelda3::kOverworldHoleArea, yaze::zelda3::kOverworldHoleEntrance, yaze::zelda3::kOverworldHolePos, RETURN_IF_ERROR, and yaze::SharedRom::rom().
Referenced by Save().
absl::Status yaze::zelda3::Overworld::SaveExits | ( | ) |
Definition at line 1414 of file overworld.cc.
References all_exits_, yaze::zelda3::kNumOverworldExits, yaze::zelda3::OWExitDoorType1, yaze::zelda3::OWExitDoorType2, yaze::zelda3::OWExitMapId, yaze::zelda3::OWExitRoomId, yaze::zelda3::OWExitUnk1, yaze::zelda3::OWExitUnk2, yaze::zelda3::OWExitVram, yaze::zelda3::OWExitXCamera, yaze::zelda3::OWExitXPlayer, yaze::zelda3::OWExitXScroll, yaze::zelda3::OWExitYCamera, yaze::zelda3::OWExitYPlayer, yaze::zelda3::OWExitYScroll, RETURN_IF_ERROR, and yaze::SharedRom::rom().
Referenced by Save().
absl::Status yaze::zelda3::Overworld::SaveItems | ( | ) |
Definition at line 1476 of file overworld.cc.
References all_items_, yaze::core::FeatureFlags::get(), yaze::zelda3::kNumOverworldMapItemPointers, yaze::zelda3::kOverworldItemsEndData, yaze::zelda3::kOverworldItemsPointers, yaze::PcToSnes(), RETURN_IF_ERROR, and yaze::SharedRom::rom().
absl::Status yaze::zelda3::Overworld::CreateTile32Tilemap | ( | ) |
Definition at line 1041 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_.
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().
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().
absl::Status yaze::zelda3::Overworld::SaveMap32Expanded | ( | ) |
Definition at line 1101 of file overworld.cc.
References yaze::zelda3::kMap32TileBLExpanded, yaze::zelda3::kMap32TileBRExpanded, yaze::zelda3::kMap32TileTRExpanded, yaze::PcToSnes(), RETURN_IF_ERROR, and yaze::SharedRom::rom().
Referenced by Save().
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().
absl::Status yaze::zelda3::Overworld::SaveMapProperties | ( | ) |
Definition at line 1556 of file overworld.cc.
References yaze::zelda3::kAreaGfxIdPtr, yaze::zelda3::kDarkWorldMapIdStart, yaze::zelda3::kOverworldMapPaletteIds, yaze::zelda3::kOverworldSpritePaletteIds, yaze::zelda3::kOverworldSpriteset, yaze::zelda3::kSpecialWorldMapIdStart, overworld_maps_, RETURN_IF_ERROR, and yaze::SharedRom::rom().
|
inline |
Definition at line 142 of file overworld.h.
References all_entrances_, all_exits_, all_items_, all_sprites_, is_loaded_, overworld_maps_, and sprites().
|
inline |
Definition at line 156 of file overworld.h.
References current_world_, and map_tiles_.
|
inline |
Definition at line 166 of file overworld.h.
References map_tiles_.
Referenced by LoadOverworldMaps().
|
inline |
Definition at line 179 of file overworld.h.
References overworld_maps_.
|
inline |
Definition at line 180 of file overworld.h.
References overworld_maps_.
|
inline |
Definition at line 181 of file overworld.h.
References overworld_maps_.
|
inline |
|
inline |
Definition at line 183 of file overworld.h.
References all_exits_.
|
inline |
Definition at line 184 of file overworld.h.
References tiles16_.
|
inline |
Definition at line 185 of file overworld.h.
References tiles16_.
|
inline |
|
inline |
Definition at line 187 of file overworld.h.
References all_sprites_.
|
inline |
Definition at line 188 of file overworld.h.
References current_map_, and overworld_maps_.
|
inline |
Definition at line 191 of file overworld.h.
References all_entrances_.
|
inline |
Definition at line 192 of file overworld.h.
References all_entrances_.
|
inline |
Definition at line 193 of file overworld.h.
References all_holes_.
|
inline |
Definition at line 194 of file overworld.h.
References all_holes_.
|
inline |
Definition at line 195 of file overworld.h.
References deleted_entrances_.
|
inline |
Definition at line 196 of file overworld.h.
References deleted_entrances_.
|
inline |
Definition at line 197 of file overworld.h.
References current_map_, and overworld_maps_.
|
inline |
Definition at line 200 of file overworld.h.
References current_map_, and overworld_maps_.
|
inline |
Definition at line 203 of file overworld.h.
References current_map_, and overworld_maps_.
|
inline |
Definition at line 206 of file overworld.h.
References is_loaded_.
|
inline |
Definition at line 207 of file overworld.h.
References current_map_.
|
inline |
Definition at line 208 of file overworld.h.
References map_tiles_.
|
inline |
Definition at line 209 of file overworld.h.
References map_tiles_.
|
inline |
Definition at line 210 of file overworld.h.
References all_items_.
|
inline |
Definition at line 211 of file overworld.h.
References all_items_.
|
inline |
Definition at line 212 of file overworld.h.
References all_tiles_types_.
|
inline |
Definition at line 213 of file overworld.h.
References all_tiles_types_.
|
private |
|
private |
Definition at line 98 of file overworld.cc.
References ASSIGN_OR_RETURN, and rom_.
Referenced by AssembleMap32Tiles().
|
private |
Definition at line 110 of file overworld.cc.
References ASSIGN_OR_RETURN, expanded_tile32_, yaze::core::FeatureFlags::get(), GetTile16ForTile32(), yaze::zelda3::kMap32ExpandedFlagPos, yaze::zelda3::kMap32TileBLExpanded, yaze::zelda3::kMap32TileBRExpanded, yaze::zelda3::kMap32TileCountExpanded, yaze::zelda3::kMap32TilesLength, yaze::zelda3::kMap32TileTRExpanded, map32TilesBL, map32TilesBR, map32TilesTL, map32TilesTR, map_tiles_, yaze::SharedRom::rom(), rom_, and tiles32_unique_.
Referenced by Load().
|
private |
Definition at line 162 of file overworld.cc.
References ASSIGN_OR_RETURN, expanded_tile16_, yaze::core::FeatureFlags::get(), yaze::gfx::GetTilesInfo(), yaze::zelda3::kMap16ExpandedFlagPos, yaze::zelda3::kMap16Tiles, yaze::zelda3::kMap16TilesExpanded, yaze::zelda3::kNumTile16Individual, yaze::zelda3::NumberOfMap16Ex, yaze::SharedRom::rom(), and tiles16_.
Referenced by Load().
|
private |
Definition at line 190 of file overworld.cc.
References tiles32_unique_.
Referenced by OrganizeMapTiles().
|
private |
Definition at line 202 of file overworld.cc.
References AssignWorldTiles(), yaze::zelda3::kDarkWorldMapIdStart, map_tiles_, and tiles32_unique_.
Referenced by 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().
|
private |
Definition at line 236 of file overworld.h.
Referenced by AssembleMap32Tiles(), GetTile16ForTile32(), Load(), Overworld(), and Save().
|
private |
Definition at line 238 of file overworld.h.
Referenced by Destroy(), is_loaded(), and Load().
|
private |
Definition at line 239 of file overworld.h.
Referenced by AssembleMap16Tiles(), and Save().
|
private |
Definition at line 240 of file overworld.h.
Referenced by AssembleMap32Tiles(), and Save().
|
private |
Definition at line 241 of file overworld.h.
Referenced by LoadEntrances(), and SaveEntrances().
|
private |
Definition at line 243 of file overworld.h.
Referenced by LoadOverworldMaps().
|
private |
Definition at line 244 of file overworld.h.
Referenced by current_area_palette(), current_graphics(), current_map_bitmap_data(), set_current_map(), and tile16_blockset_data().
|
private |
Definition at line 245 of file overworld.h.
Referenced by GetTileFromPosition().
|
private |
Definition at line 247 of file overworld.h.
Referenced by AssembleMap32Tiles(), CreateTile32Tilemap(), GetMapTiles(), GetTileFromPosition(), map_tiles(), mutable_map_tiles(), and OrganizeMapTiles().
|
private |
Definition at line 249 of file overworld.h.
Referenced by current_area_palette(), current_graphics(), current_map_bitmap_data(), Destroy(), FetchLargeMaps(), Load(), LoadItems(), LoadOverworldMaps(), LoadSpritesFromMap(), mutable_overworld_map(), overworld_map(), overworld_maps(), SaveLargeMaps(), SaveMapProperties(), and tile16_blockset_data().
|
private |
Definition at line 250 of file overworld.h.
Referenced by Destroy(), entrances(), LoadEntrances(), mutable_entrances(), and SaveEntrances().
|
private |
Definition at line 251 of file overworld.h.
Referenced by holes(), LoadHoles(), mutable_holes(), and SaveEntrances().
|
private |
Definition at line 252 of file overworld.h.
Referenced by Destroy(), exits(), LoadExits(), mutable_exits(), and SaveExits().
|
private |
Definition at line 253 of file overworld.h.
Referenced by all_items(), Destroy(), LoadItems(), mutable_all_items(), and SaveItems().
|
private |
Definition at line 255 of file overworld.h.
Referenced by AssembleMap16Tiles(), LoadOverworldMaps(), mutable_tiles16(), SaveMap16Tiles(), and tiles16().
|
private |
Definition at line 256 of file overworld.h.
|
private |
Definition at line 257 of file overworld.h.
Referenced by AssembleMap32Tiles(), AssignWorldTiles(), CreateTile32Tilemap(), OrganizeMapTiles(), and SaveMap32Tiles().
|
private |
Definition at line 259 of file overworld.h.
Referenced by CreateTile32Tilemap(), and SaveOverworldMaps().
|
private |
Definition at line 260 of file overworld.h.
Referenced by deleted_entrances(), and mutable_deleted_entrances().
|
private |
Definition at line 262 of file overworld.h.
Referenced by LoadSpritesFromMap().
|
private |
Definition at line 263 of file overworld.h.
Referenced by all_tiles_types(), LoadTileTypes(), and mutable_all_tiles_types().
|
private |
Definition at line 264 of file overworld.h.
Referenced by Destroy(), LoadSpritesFromMap(), mutable_sprites(), and sprites().
|
private |
Definition at line 265 of file overworld.h.
Referenced by SaveOverworldMaps().
|
private |
Definition at line 266 of file overworld.h.
Referenced by SaveOverworldMaps().
|
private |
Definition at line 267 of file overworld.h.
Referenced by SaveOverworldMaps().
|
private |
Definition at line 268 of file overworld.h.
Referenced by SaveOverworldMaps().
|
private |
Definition at line 269 of file overworld.h.
Referenced by SaveOverworldMaps().
|
private |
Definition at line 270 of file overworld.h.
Referenced by SaveOverworldMaps().
|
private |
Definition at line 272 of file overworld.h.