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 () |
auto | rom () const |
auto | mutable_rom () |
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 () |
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 () |
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 112 of file overworld.h.
|
private |
Enumerator | |
---|---|
map32TilesTL | |
map32TilesTR | |
map32TilesBL | |
map32TilesBR |
Definition at line 223 of file overworld.h.
|
inline |
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, rom(), and rom_.
absl::Status yaze::zelda3::Overworld::LoadOverworldMaps | ( | ) |
Definition at line 271 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 296 of file overworld.cc.
References all_tiles_types_, yaze::zelda3::kNumTileTypes, and rom().
absl::Status yaze::zelda3::Overworld::LoadEntrances | ( | ) |
Definition at line 303 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 rom().
Referenced by Load().
absl::Status yaze::zelda3::Overworld::LoadHoles | ( | ) |
Definition at line 338 of file overworld.cc.
References all_holes_, ASSIGN_OR_RETURN, yaze::zelda3::kOverworldHoleArea, yaze::zelda3::kOverworldHoleEntrance, yaze::zelda3::kOverworldHolePos, and rom().
Referenced by Load().
absl::Status yaze::zelda3::Overworld::LoadExits | ( | ) |
Definition at line 356 of file overworld.cc.
References all_exits_, exits(), 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 rom().
Referenced by Load().
absl::Status yaze::zelda3::Overworld::LoadItems | ( | ) |
Definition at line 408 of file overworld.cc.
References all_items_, ASSIGN_OR_RETURN, yaze::zelda3::kOverworldItemsAddress, overworld_maps_, rom(), and yaze::SnesToPc().
Referenced by Load().
absl::Status yaze::zelda3::Overworld::LoadSprites | ( | ) |
Definition at line 457 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 476 of file overworld.cc.
References all_sprites_, ASSIGN_OR_RETURN, map_parent_, overworld_maps_, rom(), and yaze::SnesToPc().
Referenced by LoadSprites().
absl::Status yaze::zelda3::Overworld::Save | ( | Rom * | rom | ) |
Definition at line 515 of file overworld.cc.
References expanded_tile16_, expanded_tile32_, RETURN_IF_ERROR, rom(), rom_, SaveEntrances(), SaveExits(), SaveMap16Expanded(), SaveMap16Tiles(), SaveMap32Expanded(), SaveMap32Tiles(), and SaveOverworldMaps().
absl::Status yaze::zelda3::Overworld::SaveOverworldMaps | ( | ) |
Definition at line 527 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, rom(), SaveLargeMaps(), and tiles32_list_.
Referenced by Save().
absl::Status yaze::zelda3::Overworld::SaveLargeMaps | ( | ) |
Definition at line 665 of file overworld.cc.
References yaze::zelda3::kDarkWorldMapIdStart, yaze::zelda3::kNumMapsPerWorld, 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 rom().
Referenced by SaveOverworldMaps().
absl::Status yaze::zelda3::Overworld::SaveEntrances | ( | ) |
Definition at line 1364 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 rom().
Referenced by Save().
absl::Status yaze::zelda3::Overworld::SaveExits | ( | ) |
Definition at line 1398 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 rom().
Referenced by Save().
absl::Status yaze::zelda3::Overworld::SaveItems | ( | ) |
Definition at line 1460 of file overworld.cc.
References all_items_, yaze::zelda3::kNumOverworldMapItemPointers, yaze::zelda3::kOverworldItemsEndData, yaze::zelda3::kOverworldItemsPointers, yaze::PcToSnes(), RETURN_IF_ERROR, and rom().
absl::Status yaze::zelda3::Overworld::CreateTile32Tilemap | ( | ) |
Definition at line 1032 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 1269 of file overworld.cc.
References yaze::zelda3::kMap16TilesExpanded, yaze::PcToSnes(), RETURN_IF_ERROR, rom(), and yaze::SnesToPc().
Referenced by Save().
absl::Status yaze::zelda3::Overworld::SaveMap16Tiles | ( | ) |
Definition at line 1347 of file overworld.cc.
References yaze::zelda3::kMap16Tiles, yaze::zelda3::NumberOfMap16, RETURN_IF_ERROR, rom(), and tiles16_.
Referenced by Save().
absl::Status yaze::zelda3::Overworld::SaveMap32Expanded | ( | ) |
Definition at line 1092 of file overworld.cc.
References yaze::zelda3::kMap32TileBLExpanded, yaze::zelda3::kMap32TileBRExpanded, yaze::zelda3::kMap32TileTRExpanded, yaze::PcToSnes(), RETURN_IF_ERROR, and rom().
Referenced by Save().
absl::Status yaze::zelda3::Overworld::SaveMap32Tiles | ( | ) |
Definition at line 1140 of file overworld.cc.
References map32TilesBL, map32TilesBR, RETURN_IF_ERROR, rom(), and tiles32_unique_.
Referenced by Save().
absl::Status yaze::zelda3::Overworld::SaveMapProperties | ( | ) |
Definition at line 1538 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 rom().
|
inline |
Definition at line 143 of file overworld.h.
References rom_.
Referenced by AssembleMap16Tiles(), AssembleMap32Tiles(), DecompressAllMapTiles(), GetTile16ForTile32(), Load(), LoadEntrances(), LoadExits(), LoadHoles(), LoadItems(), LoadSpritesFromMap(), LoadTileTypes(), Overworld(), Save(), SaveEntrances(), SaveExits(), SaveItems(), SaveLargeMaps(), SaveMap16Expanded(), SaveMap16Tiles(), SaveMap32Expanded(), SaveMap32Tiles(), SaveMapProperties(), and SaveOverworldMaps().
|
inline |
Definition at line 144 of file overworld.h.
References rom_.
|
inline |
Definition at line 146 of file overworld.h.
References all_entrances_, all_exits_, all_items_, all_sprites_, is_loaded_, overworld_maps_, sprites(), tiles16_, tiles32_, and tiles32_unique_.
|
inline |
Definition at line 163 of file overworld.h.
References current_world_, and map_tiles_.
|
inline |
Definition at line 173 of file overworld.h.
References map_tiles_.
Referenced by LoadOverworldMaps().
|
inline |
Definition at line 186 of file overworld.h.
References overworld_maps_.
|
inline |
Definition at line 187 of file overworld.h.
References overworld_maps_.
|
inline |
Definition at line 188 of file overworld.h.
References overworld_maps_.
|
inline |
|
inline |
Definition at line 190 of file overworld.h.
References all_exits_.
|
inline |
Definition at line 191 of file overworld.h.
References tiles16_.
|
inline |
Definition at line 192 of file overworld.h.
References tiles16_.
|
inline |
|
inline |
Definition at line 194 of file overworld.h.
References all_sprites_.
|
inline |
Definition at line 195 of file overworld.h.
References current_map_, and overworld_maps_.
|
inline |
Definition at line 198 of file overworld.h.
References all_entrances_.
|
inline |
Definition at line 199 of file overworld.h.
References all_entrances_.
|
inline |
Definition at line 200 of file overworld.h.
References all_holes_.
|
inline |
Definition at line 201 of file overworld.h.
References all_holes_.
|
inline |
Definition at line 202 of file overworld.h.
References deleted_entrances_.
|
inline |
Definition at line 203 of file overworld.h.
References deleted_entrances_.
|
inline |
Definition at line 204 of file overworld.h.
References current_map_, and overworld_maps_.
|
inline |
Definition at line 207 of file overworld.h.
References current_map_, and overworld_maps_.
|
inline |
Definition at line 210 of file overworld.h.
References current_map_, and overworld_maps_.
|
inline |
Definition at line 213 of file overworld.h.
References is_loaded_.
|
inline |
Definition at line 214 of file overworld.h.
References current_map_.
|
inline |
Definition at line 215 of file overworld.h.
References map_tiles_.
|
inline |
Definition at line 216 of file overworld.h.
References map_tiles_.
|
inline |
Definition at line 217 of file overworld.h.
References all_items_.
|
inline |
Definition at line 218 of file overworld.h.
References all_items_.
|
inline |
Definition at line 219 of file overworld.h.
References all_tiles_types_.
|
inline |
Definition at line 220 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 108 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::kMap32TileTRExpanded, map32TilesBL, map32TilesBR, map32TilesTL, map32TilesTR, map_tiles_, rom(), and tiles32_unique_.
Referenced by Load().
|
private |
Definition at line 161 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, rom(), and tiles16_.
Referenced by Load().
|
private |
Definition at line 189 of file overworld.cc.
References tiles32_unique_.
Referenced by OrganizeMapTiles().
|
private |
Definition at line 201 of file overworld.cc.
References AssignWorldTiles(), yaze::zelda3::kDarkWorldMapIdStart, map_tiles_, and tiles32_unique_.
Referenced by DecompressAllMapTiles().
|
private |
Definition at line 221 of file overworld.cc.
References yaze::gfx::HyruleMagicDecompress(), yaze::zelda3::kNumOverworldMaps, OrganizeMapTiles(), rom(), and yaze::SnesToPc().
Referenced by Load().
|
private |
Definition at line 243 of file overworld.h.
Referenced by Load(), mutable_rom(), Overworld(), rom(), and Save().
|
private |
Definition at line 245 of file overworld.h.
Referenced by Destroy(), is_loaded(), and Load().
|
private |
Definition at line 246 of file overworld.h.
Referenced by AssembleMap16Tiles(), and Save().
|
private |
Definition at line 247 of file overworld.h.
Referenced by AssembleMap32Tiles(), and Save().
|
private |
Definition at line 248 of file overworld.h.
Referenced by LoadEntrances(), and SaveEntrances().
|
private |
Definition at line 250 of file overworld.h.
Referenced by LoadOverworldMaps().
|
private |
Definition at line 251 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 252 of file overworld.h.
Referenced by GetTileFromPosition().
|
private |
Definition at line 254 of file overworld.h.
Referenced by AssembleMap32Tiles(), CreateTile32Tilemap(), GetMapTiles(), GetTileFromPosition(), map_tiles(), mutable_map_tiles(), and OrganizeMapTiles().
|
private |
Definition at line 256 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 257 of file overworld.h.
Referenced by Destroy(), entrances(), LoadEntrances(), mutable_entrances(), and SaveEntrances().
|
private |
Definition at line 258 of file overworld.h.
Referenced by holes(), LoadHoles(), mutable_holes(), and SaveEntrances().
|
private |
Definition at line 259 of file overworld.h.
Referenced by Destroy(), exits(), LoadExits(), mutable_exits(), and SaveExits().
|
private |
Definition at line 260 of file overworld.h.
Referenced by all_items(), Destroy(), LoadItems(), mutable_all_items(), and SaveItems().
|
private |
Definition at line 262 of file overworld.h.
Referenced by AssembleMap16Tiles(), Destroy(), LoadOverworldMaps(), mutable_tiles16(), SaveMap16Tiles(), and tiles16().
|
private |
Definition at line 263 of file overworld.h.
Referenced by Destroy().
|
private |
Definition at line 264 of file overworld.h.
Referenced by AssembleMap32Tiles(), AssignWorldTiles(), CreateTile32Tilemap(), Destroy(), OrganizeMapTiles(), and SaveMap32Tiles().
|
private |
Definition at line 266 of file overworld.h.
Referenced by CreateTile32Tilemap(), and SaveOverworldMaps().
|
private |
Definition at line 267 of file overworld.h.
Referenced by deleted_entrances(), and mutable_deleted_entrances().
|
private |
Definition at line 269 of file overworld.h.
Referenced by LoadSpritesFromMap().
|
private |
Definition at line 270 of file overworld.h.
Referenced by all_tiles_types(), LoadTileTypes(), and mutable_all_tiles_types().
|
private |
Definition at line 271 of file overworld.h.
Referenced by Destroy(), LoadSpritesFromMap(), mutable_sprites(), and sprites().
|
private |
Definition at line 272 of file overworld.h.
Referenced by SaveOverworldMaps().
|
private |
Definition at line 273 of file overworld.h.
Referenced by SaveOverworldMaps().
|
private |
Definition at line 274 of file overworld.h.
Referenced by SaveOverworldMaps().
|
private |
Definition at line 275 of file overworld.h.
Referenced by SaveOverworldMaps().
|
private |
Definition at line 276 of file overworld.h.
Referenced by SaveOverworldMaps().
|
private |
Definition at line 277 of file overworld.h.
Referenced by SaveOverworldMaps().