OverworldMapScreen manages the overworld map (pause menu) graphics. More...
#include <overworld_map_screen.h>
Public Member Functions | |
absl::Status | Create (Rom *rom) |
Initialize and load overworld map data from ROM. | |
absl::Status | Save (Rom *rom) |
Save changes back to ROM. | |
auto & | lw_tiles () |
auto & | dw_tiles () |
auto & | mutable_lw_tiles () |
auto & | mutable_dw_tiles () |
auto & | tiles8_bitmap () |
auto & | map_bitmap () |
auto & | lw_palette () |
auto & | dw_palette () |
absl::Status | RenderMapLayer (bool use_dark_world) |
Render map tiles into bitmap. | |
absl::Status | LoadCustomMap (const std::string &file_path) |
Load custom map from external binary file. | |
absl::Status | SaveCustomMap (const std::string &file_path, bool use_dark_world) |
Save map data to external binary file. | |
Private Member Functions | |
absl::Status | LoadMapData (Rom *rom) |
Load map tile data from ROM Reads the interleaved tile format from 4 ROM sections. | |
Private Attributes | |
std::array< uint8_t, 64 *64 > | lw_map_tiles_ |
std::array< uint8_t, 64 *64 > | dw_map_tiles_ |
gfx::Bitmap | tiles8_bitmap_ |
gfx::Bitmap | map_bitmap_ |
gfx::SnesPalette | lw_palette_ |
gfx::SnesPalette | dw_palette_ |
OverworldMapScreen manages the overworld map (pause menu) graphics.
The overworld map screen shows the mini-map when the player pauses. It consists of:
Definition at line 24 of file overworld_map_screen.h.
absl::Status yaze::zelda3::OverworldMapScreen::Create | ( | Rom * | rom | ) |
Initialize and load overworld map data from ROM.
rom | ROM instance to read data from |
Definition at line 13 of file overworld_map_screen.cc.
References yaze::gfx::SnesPalette::AddColor(), ASSIGN_OR_RETURN, yaze::gfx::Bitmap::Create(), yaze::gfx::Arena::CREATE, dw_palette_, yaze::gfx::Arena::Get(), yaze::Rom::is_loaded(), LoadMapData(), lw_palette_, map_bitmap_, yaze::gfx::Bitmap::metadata(), yaze::gfx::Bitmap::BitmapMetadata::palette_colors, yaze::gfx::Bitmap::BitmapMetadata::palette_format, yaze::gfx::Arena::QueueTextureCommand(), yaze::Rom::ReadByte(), yaze::Rom::ReadWord(), RenderMapLayer(), RETURN_IF_ERROR, yaze::gfx::Bitmap::set_active(), yaze::gfx::Bitmap::SetPalette(), yaze::gfx::Bitmap::BitmapMetadata::source_bpp, yaze::gfx::Bitmap::BitmapMetadata::source_type, and tiles8_bitmap_.
Referenced by yaze::editor::ScreenEditor::DrawOverworldMapEditor().
absl::Status yaze::zelda3::OverworldMapScreen::Save | ( | Rom * | rom | ) |
Save changes back to ROM.
rom | ROM instance to write data to |
Definition at line 233 of file overworld_map_screen.cc.
References dw_map_tiles_, lw_map_tiles_, RETURN_IF_ERROR, and yaze::Rom::WriteByte().
Referenced by yaze::editor::ScreenEditor::DrawOverworldMapEditor().
|
inline |
Definition at line 39 of file overworld_map_screen.h.
References lw_map_tiles_.
|
inline |
Definition at line 40 of file overworld_map_screen.h.
References dw_map_tiles_.
|
inline |
Definition at line 43 of file overworld_map_screen.h.
References lw_map_tiles_.
Referenced by yaze::editor::ScreenEditor::DrawOverworldMapEditor().
|
inline |
Definition at line 44 of file overworld_map_screen.h.
References dw_map_tiles_.
Referenced by yaze::editor::ScreenEditor::DrawOverworldMapEditor().
|
inline |
Definition at line 47 of file overworld_map_screen.h.
References tiles8_bitmap_.
Referenced by yaze::editor::ScreenEditor::DrawOverworldMapEditor().
|
inline |
Definition at line 48 of file overworld_map_screen.h.
References map_bitmap_.
Referenced by yaze::editor::ScreenEditor::DrawOverworldMapEditor().
|
inline |
Definition at line 51 of file overworld_map_screen.h.
References lw_palette_.
Referenced by yaze::editor::ScreenEditor::DrawOverworldMapEditor().
|
inline |
Definition at line 52 of file overworld_map_screen.h.
References dw_palette_.
Referenced by yaze::editor::ScreenEditor::DrawOverworldMapEditor().
absl::Status yaze::zelda3::OverworldMapScreen::RenderMapLayer | ( | bool | use_dark_world | ) |
Render map tiles into bitmap.
use_dark_world | If true, render DW tiles, otherwise LW tiles |
Definition at line 199 of file overworld_map_screen.cc.
References dw_map_tiles_, lw_map_tiles_, map_bitmap_, yaze::gfx::Bitmap::mutable_data(), tiles8_bitmap_, yaze::gfx::Bitmap::UpdateSurfacePixels(), and yaze::gfx::Bitmap::vector().
Referenced by Create(), yaze::editor::ScreenEditor::DrawOverworldMapEditor(), and LoadCustomMap().
absl::Status yaze::zelda3::OverworldMapScreen::LoadCustomMap | ( | const std::string & | file_path | ) |
Load custom map from external binary file.
file_path | Path to .bin file containing 64×64 tile indices |
Definition at line 317 of file overworld_map_screen.cc.
References yaze::gfx::Arena::Get(), lw_map_tiles_, map_bitmap_, yaze::gfx::Arena::QueueTextureCommand(), RenderMapLayer(), RETURN_IF_ERROR, and yaze::gfx::Arena::UPDATE.
Referenced by yaze::editor::ScreenEditor::DrawOverworldMapEditor().
absl::Status yaze::zelda3::OverworldMapScreen::SaveCustomMap | ( | const std::string & | file_path, |
bool | use_dark_world | ||
) |
Save map data to external binary file.
file_path | Path to output .bin file |
use_dark_world | If true, save DW tiles, otherwise LW tiles |
Definition at line 347 of file overworld_map_screen.cc.
References dw_map_tiles_, and lw_map_tiles_.
Referenced by yaze::editor::ScreenEditor::DrawOverworldMapEditor().
|
private |
Load map tile data from ROM Reads the interleaved tile format from 4 ROM sections.
Definition at line 98 of file overworld_map_screen.cc.
References ASSIGN_OR_RETURN, dw_map_tiles_, lw_map_tiles_, and yaze::Rom::ReadByte().
Referenced by Create().
|
private |
Definition at line 80 of file overworld_map_screen.h.
Referenced by LoadCustomMap(), LoadMapData(), lw_tiles(), mutable_lw_tiles(), RenderMapLayer(), Save(), and SaveCustomMap().
|
private |
Definition at line 81 of file overworld_map_screen.h.
Referenced by dw_tiles(), LoadMapData(), mutable_dw_tiles(), RenderMapLayer(), Save(), and SaveCustomMap().
|
private |
Definition at line 83 of file overworld_map_screen.h.
Referenced by Create(), RenderMapLayer(), and tiles8_bitmap().
|
private |
Definition at line 84 of file overworld_map_screen.h.
Referenced by Create(), LoadCustomMap(), map_bitmap(), and RenderMapLayer().
|
private |
Definition at line 86 of file overworld_map_screen.h.
Referenced by Create(), and lw_palette().
|
private |
Definition at line 87 of file overworld_map_screen.h.
Referenced by Create(), and dw_palette().