1#ifndef YAZE_APP_DATA_OVERWORLD_H
2#define YAZE_APP_DATA_OVERWORLD_H
6#include "absl/container/flat_hash_map.h"
7#include "absl/status/status.h"
86 OverworldItem(uint8_t
id, uint16_t room_map_id,
int x,
int y,
bool bg2) {
91 this->room_map_id_ = room_map_id;
96 int map_x = room_map_id - ((room_map_id / 8) * 8);
97 int map_y = room_map_id / 8;
99 game_x_ =
static_cast<uint8_t
>(std::abs(x - (map_x * 512)) / 16);
100 game_y_ =
static_cast<uint8_t
>(std::abs(y - (map_y * 512)) / 16);
113 game_x_ =
static_cast<uint8_t
>(std::abs(
x_ - (map_x * 512)) / 16);
114 game_y_ =
static_cast<uint8_t
>(std::abs(
y_ - (map_y * 512)) / 16);
116 std::cout <<
"Item: " << std::hex << std::setw(2) << std::setfill(
'0')
117 <<
static_cast<int>(
id_) <<
" MapId: " << std::hex << std::setw(2)
119 <<
" X: " <<
static_cast<int>(
game_x_)
120 <<
" Y: " <<
static_cast<int>(
game_y_) << std::endl;
177 uint16_t y_scroll, uint16_t x_scroll, uint16_t player_y,
178 uint16_t player_x, uint16_t camera_y, uint16_t camera_x,
179 uchar scroll_mod_y,
uchar scroll_mod_x, uint16_t door_type_1,
180 uint16_t door_type_2,
bool deleted =
false)
210 if (door_type_1 != 0) {
211 int p = (door_type_1 & 0x7FFF) >> 1;
216 if (door_type_2 != 0) {
217 int p = (door_type_2 & 0x7FFF) >> 1;
249 int mapX = map_id - ((map_id / 8) * 8);
250 int mapY = map_id / 8;
259 int mapx = (map_id & 7) << 9;
260 int mapy = (map_id & 56) << 6;
274 if (
x_ > mapx + large) {
278 if (
y_ > mapy + large + 32) {
279 y_ = mapy + large + 32;
302 short vram_x_scroll = (short)(
x_ - mapx);
303 short vram_y_scroll = (short)(
y_ - mapy);
305 map_pos_ = (uint16_t)(((vram_y_scroll & 0xFFF0) << 3) |
306 ((vram_x_scroll & 0xFFF0) >> 3));
308 std::cout <<
"Exit: " <<
room_id_ <<
" MapId: " << std::hex << mapid
309 <<
" X: " <<
static_cast<int>(
area_x_)
310 <<
" Y: " <<
static_cast<int>(
area_y_) << std::endl;
354 uint16_t map_pos,
bool hole)
512 switch (world_type) {
571 const uint32_t *map32address);
577 std::vector<uint8_t> &bytes2,
int i,
int sx,
int sy,
The Rom class is used to load, save, and modify Rom data.
A class to hold a shared pointer to a Rom object.
A class to manage experimental feature flags.
Base class for all overworld and dungeon entities.
enum yaze::app::zelda3::GameEntity::EntityType entity_type_
OverworldEntrance()=default
void UpdateMapProperties(uint16_t map_id) override
OverworldEntrance(int x, int y, uchar entrance_id, short map_id, uint16_t map_pos, bool hole)
OverworldExit(uint16_t room_id, uchar map_id, uint16_t vram_location, uint16_t y_scroll, uint16_t x_scroll, uint16_t player_y, uint16_t player_x, uint16_t camera_y, uint16_t camera_x, uchar scroll_mod_y, uchar scroll_mod_x, uint16_t door_type_1, uint16_t door_type_2, bool deleted=false)
void UpdateMapProperties(uint16_t map_id) override
OverworldItem(uint8_t id, uint16_t room_map_id, int x, int y, bool bg2)
void UpdateMapProperties(uint16_t room_map_id) override
Represents the full Overworld data, light and dark world.
std::vector< std::vector< Sprite > > all_sprites_
auto mutable_deleted_entrances()
auto overworld_maps() const
auto mutable_sprites(int state)
absl::Status AssembleMap32Tiles()
absl::Status SaveMap32Tiles()
auto current_graphics() const
absl::Status DecompressAllMapTiles()
absl::Status CreateTile32Tilemap()
absl::Status SaveMap16Expanded()
void set_current_map(int i)
OWBlockset & GetMapTiles(int world_type)
std::vector< OverworldItem > all_items_
std::vector< gfx::Tile32 > tiles32_
std::vector< absl::flat_hash_map< uint16_t, int > > usage_stats_
std::vector< OverworldEntrance > all_entrances_
absl::Status SaveLargeMaps()
absl::Status SaveMap16Tiles()
absl::Status SaveOverworldMaps()
std::vector< int > map_pointers2_id
absl::Status LoadSprites()
std::vector< gfx::Tile32 > tiles32_unique_
auto deleted_entrances() const
std::vector< int > map_pointers1
std::vector< OverworldExit > all_exits_
absl::Status SaveEntrances()
void OrganizeMapTiles(std::vector< uint8_t > &bytes, std::vector< uint8_t > &bytes2, int i, int sx, int sy, int &ttpos)
auto mutable_overworld_map(int i)
std::vector< uint64_t > deleted_entrances_
std::vector< gfx::Tile16 > tiles16_
void AssignWorldTiles(int x, int y, int sx, int sy, int tpos, OWBlockset &world)
std::vector< int > map_pointers1_id
absl::Status Load(Rom &rom)
absl::StatusOr< uint16_t > GetTile16ForTile32(int index, int quadrant, int dimension, const uint32_t *map32address)
uint8_t all_tiles_types_[0x200]
auto tile16_blockset_data() const
std::vector< int > map_pointers2
std::vector< gfx::Tile16 > tiles16() const
auto overworld_map(int i) const
absl::Status SaveMap32Expanded()
std::vector< OverworldEntrance > all_holes_
int GetTileFromPosition(ImVec2 position) const
std::vector< OverworldMap > overworld_maps_
auto sprites(int state) const
auto mutable_all_tiles_types()
absl::Status LoadOverworldMaps()
absl::Status Save(Rom &rom)
std::vector< std::vector< uint8_t > > map_data_p2
auto all_tiles_types() const
auto current_area_palette() const
std::vector< std::vector< uint8_t > > map_data_p1
absl::Status LoadSpritesFromMap(int spriteStart, int spriteCount, int spriteIndex)
auto current_map_bitmap_data() const
void AssembleMap16Tiles()
std::vector< uint16_t > tiles32_list_
absl::Status SaveMapProperties()
constexpr int overworldTransitionPositionY
constexpr int OWHoleEntrance
constexpr int kMap32TileCountExpanded
constexpr int OWExitYScroll
constexpr int NumberOfOWSprites
constexpr int kOverworldItemsAddress
constexpr int OWWhirlpoolPosition
constexpr int overworldSpritePaletteGroup
constexpr int overworldMapParentId
constexpr int OWEntrancePos
constexpr int GraveLinkSpecialStairs
constexpr int kMap32TileBLExpanded
constexpr int OWExitXScroll
constexpr int OWExitXCamera
constexpr int OWExitYCameraWhirlpool
constexpr int OWExitDoorPosition
constexpr int OWExitYCamera
constexpr int GravesYLine
constexpr int overworldSpriteset
constexpr int kAreaGfxIdPtr
constexpr int kMap32TileTRExpanded
constexpr int overworldMapPaletteGroup
constexpr int overworldItemsEndData
constexpr int OverworldScreenSizeForLoading
constexpr int OWExitMapId
constexpr int OWEntranceMap
constexpr int OWExitYPlayer
constexpr int kMap16Tiles
constexpr int Map32PerScreen
constexpr int OverworldScreenTileMapChangeByScreen2
constexpr int OWExitXCameraWhirlpool
constexpr int kOverworldMapPaletteIds
constexpr int overworldSpritesZelda
constexpr int overworldCustomMosaicArray
constexpr int OverworldMapDataOverflow
constexpr int OWEntranceEntranceId
constexpr int kNumTile16Individual
constexpr int overworldEntranceAllowedTilesRight
constexpr int NumberOfMap32
constexpr int NumberOfMap16Ex
constexpr int kNumOverworldMaps
constexpr int OWExitXScrollWhirlpool
constexpr int overworldMapSize
constexpr int overworldMusicDW
constexpr int OWExitUnk1Whirlpool
constexpr int OWExitUnk2Whirlpool
constexpr int overworldMusicMasterSword
constexpr int OWExitXPlayerWhirlpool
constexpr int overworldCustomMosaicASM
constexpr int overworldScreenSize
constexpr int kMap16TilesExpanded
constexpr int NumberOfMap16
constexpr int OWExitDoorType2
constexpr int OWExitMapIdWhirlpool
constexpr int overworldMusicBegining
constexpr int kOverworldSpritePaletteIds
constexpr int LimitOfMap32
constexpr int OWExitXPlayer
constexpr int OverworldScreenTileMapChangeByScreen3
constexpr int OWExitRoomId
constexpr int transition_target_north
constexpr int overworldMusicZelda
constexpr int overworldSpecialGFXGroup
constexpr int overworldMapSizeHighByte
constexpr int GravesCountOnY
constexpr int OWExitYScrollWhirlpool
constexpr int overworldSpritesBegining
constexpr int overworldMusicAgahim
constexpr int transition_target_west
constexpr int kMap32TileBRExpanded
constexpr int overworldItemsBank
const std::vector< std::string > kSecretItemNames
constexpr int OverworldScreenTileMapChangeByScreen4
constexpr int overworldSpecialPALGroup
constexpr int overworldTransitionPositionX
constexpr int GravesYTilePos
constexpr int overworldSpritesAgahnim
constexpr int OverworldScreenTileMapChangeByScreen1
constexpr int OWExitDoorType1
constexpr int overworldItemsPointers
constexpr int GraveLinkSpecialHole
constexpr int OWExitVramWhirlpool
constexpr int GravesXTilePos
constexpr int GravesTilemapPos
constexpr int OWExitYPlayerWhirlpool
constexpr int overworldEntranceAllowedTilesLeft
constexpr int kOverworldMessageIds
std::vector< std::vector< uint16_t > > OWBlockset
Represents tile32 data for the overworld.
Overworld map tile32 data.