yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::zelda3::OverworldMapScreen Class Reference

OverworldMapScreen manages the overworld map (pause menu) graphics. More...

#include <overworld_map_screen.h>

Collaboration diagram for yaze::zelda3::OverworldMapScreen:

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_
 

Detailed Description

OverworldMapScreen manages the overworld map (pause menu) graphics.

The overworld map screen shows the mini-map when the player pauses. It consists of:

  • 64x64 tiles (8x8 pixels each) for Light World map
  • 64x64 tiles (8x8 pixels each) for Dark World map
  • Mode 7 graphics stored at 0x0C4000
  • Tile data in interleaved format across 4 sections

Definition at line 24 of file overworld_map_screen.h.

Member Function Documentation

◆ Create()

◆ Save()

absl::Status yaze::zelda3::OverworldMapScreen::Save ( Rom rom)

Save changes back to ROM.

Parameters
romROM 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().

Here is the call graph for this function:

◆ lw_tiles()

auto & yaze::zelda3::OverworldMapScreen::lw_tiles ( )
inline

Definition at line 39 of file overworld_map_screen.h.

References lw_map_tiles_.

◆ dw_tiles()

auto & yaze::zelda3::OverworldMapScreen::dw_tiles ( )
inline

Definition at line 40 of file overworld_map_screen.h.

References dw_map_tiles_.

◆ mutable_lw_tiles()

auto & yaze::zelda3::OverworldMapScreen::mutable_lw_tiles ( )
inline

Definition at line 43 of file overworld_map_screen.h.

References lw_map_tiles_.

Referenced by yaze::editor::ScreenEditor::DrawOverworldMapEditor().

◆ mutable_dw_tiles()

auto & yaze::zelda3::OverworldMapScreen::mutable_dw_tiles ( )
inline

Definition at line 44 of file overworld_map_screen.h.

References dw_map_tiles_.

Referenced by yaze::editor::ScreenEditor::DrawOverworldMapEditor().

◆ tiles8_bitmap()

auto & yaze::zelda3::OverworldMapScreen::tiles8_bitmap ( )
inline

Definition at line 47 of file overworld_map_screen.h.

References tiles8_bitmap_.

Referenced by yaze::editor::ScreenEditor::DrawOverworldMapEditor().

◆ map_bitmap()

auto & yaze::zelda3::OverworldMapScreen::map_bitmap ( )
inline

Definition at line 48 of file overworld_map_screen.h.

References map_bitmap_.

Referenced by yaze::editor::ScreenEditor::DrawOverworldMapEditor().

◆ lw_palette()

auto & yaze::zelda3::OverworldMapScreen::lw_palette ( )
inline

Definition at line 51 of file overworld_map_screen.h.

References lw_palette_.

Referenced by yaze::editor::ScreenEditor::DrawOverworldMapEditor().

◆ dw_palette()

auto & yaze::zelda3::OverworldMapScreen::dw_palette ( )
inline

Definition at line 52 of file overworld_map_screen.h.

References dw_palette_.

Referenced by yaze::editor::ScreenEditor::DrawOverworldMapEditor().

◆ RenderMapLayer()

absl::Status yaze::zelda3::OverworldMapScreen::RenderMapLayer ( bool  use_dark_world)

Render map tiles into bitmap.

Parameters
use_dark_worldIf 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().

Here is the call graph for this function:

◆ LoadCustomMap()

absl::Status yaze::zelda3::OverworldMapScreen::LoadCustomMap ( const std::string &  file_path)

Load custom map from external binary file.

Parameters
file_pathPath 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().

Here is the call graph for this function:

◆ SaveCustomMap()

absl::Status yaze::zelda3::OverworldMapScreen::SaveCustomMap ( const std::string &  file_path,
bool  use_dark_world 
)

Save map data to external binary file.

Parameters
file_pathPath to output .bin file
use_dark_worldIf 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().

◆ LoadMapData()

absl::Status yaze::zelda3::OverworldMapScreen::LoadMapData ( Rom rom)
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().

Here is the call graph for this function:

Member Data Documentation

◆ lw_map_tiles_

std::array<uint8_t, 64 * 64> yaze::zelda3::OverworldMapScreen::lw_map_tiles_
private

◆ dw_map_tiles_

std::array<uint8_t, 64 * 64> yaze::zelda3::OverworldMapScreen::dw_map_tiles_
private

◆ tiles8_bitmap_

gfx::Bitmap yaze::zelda3::OverworldMapScreen::tiles8_bitmap_
private

Definition at line 83 of file overworld_map_screen.h.

Referenced by Create(), RenderMapLayer(), and tiles8_bitmap().

◆ map_bitmap_

gfx::Bitmap yaze::zelda3::OverworldMapScreen::map_bitmap_
private

Definition at line 84 of file overworld_map_screen.h.

Referenced by Create(), LoadCustomMap(), map_bitmap(), and RenderMapLayer().

◆ lw_palette_

gfx::SnesPalette yaze::zelda3::OverworldMapScreen::lw_palette_
private

Definition at line 86 of file overworld_map_screen.h.

Referenced by Create(), and lw_palette().

◆ dw_palette_

gfx::SnesPalette yaze::zelda3::OverworldMapScreen::dw_palette_
private

Definition at line 87 of file overworld_map_screen.h.

Referenced by Create(), and dw_palette().


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