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

Manage graphics group configurations in a Rom. More...

#include <gfx_group_editor.h>

Classes

struct  AssignmentSession
 

Public Types

using MainUsageCallback
 
using RoomsetUsageCallback
 

Public Member Functions

 ~GfxGroupEditor ()
 
absl::Status Update ()
 
void DrawBlocksetViewer (bool sheet_only=false)
 
void DrawRoomsetViewer ()
 
void DrawSpritesetViewer (bool sheet_only=false)
 
void DrawPaletteControls ()
 
void SetSelectedBlockset (uint8_t blockset)
 
void SetSelectedRoomset (uint8_t roomset)
 
void SetSelectedSpriteset (uint8_t spriteset)
 
void SetRom (Rom *rom)
 
void SetUndoManager (UndoManager *undo)
 
void SetMainUsageCallback (MainUsageCallback callback)
 
absl::Status EditMainGraphicsSheet (int group, int slot, int sheet)
 
absl::Status EditRoomsetGraphicsSheet (int group, int entry, int sheet)
 
void SetRoomsetUsageCallback (RoomsetUsageCallback callback)
 
void DetachRuntimeContext ()
 
Rom * rom () const
 
void SetGameData (zelda3::GameData *data)
 
zelda3::GameData * game_data () const
 
void SetWorkspaceState (GfxGroupWorkspaceState *state)
 
void SetHostSurfaceHint (std::string hint)
 
const GfxGroupWorkspaceState & workspace_state () const
 

Private Types

enum class  GroupKind { kMain , kRoomset }
 

Private Member Functions

void UpdateCurrentPalette ()
 
absl::Status EditGraphicsSheet (GroupKind kind, int group, int slot, int sheet)
 
void DrawAssignmentControls (GroupKind kind)
 
void DrawRoomsetUsage ()
 
void DrawMainUsage ()
 
void DrawSheetPicker ()
 
void ResetSheetPicker ()
 
gfx::Bitmap * PrepareSheetPreview (int sheet_id, gfx::SheetRole role, gfx::Bitmap &preview)
 
GfxGroupWorkspaceState & Ws ()
 
const GfxGroupWorkspaceState & Ws () const
 
void DrawSpritesetUsage (int id)
 

Private Attributes

std::shared_ptr< AssignmentSession > assignment_session_
 
UndoManager * undo_ = nullptr
 
MainUsageCallback main_usage_
 
RoomsetUsageCallback roomset_usage_
 
GroupKind picker_kind_ = GroupKind::kMain
 
int selected_roomset_entry_ = 0
 
int selected_main_slot_ = 0
 
int picker_group_ = -1
 
int pending_sheet_ = -1
 
uint8_t picker_expected_sheet_ = 0
 
bool show_sheet_picker_ = false
 
std::string assignment_error_
 
std::map< int, gfx::Bitmap > picker_previews_
 
GfxGroupWorkspaceState * workspace_ = nullptr
 
GfxGroupWorkspaceState fallback_ {}
 
std::array< gui::Canvas, 8 > blockset_canvases_
 
std::array< gui::Canvas, 4 > roomset_canvases_
 
std::array< gui::Canvas, 4 > spriteset_canvases_
 
std::array< gfx::Bitmap, 8 > blockset_previews_
 
std::array< gfx::Bitmap, 4 > roomset_previews_
 
std::array< gfx::Bitmap, 4 > spriteset_previews_
 
Rom * rom_ = nullptr
 
zelda3::GameData * game_data_ = nullptr
 
std::optional< std::map< int, zelda3::OverworldAreaGfxInfo > > usage_areas_
 
std::optional< std::map< int, zelda3::RoomGfxInfo > > usage_rooms_
 
const Rom * usage_rom_ = nullptr
 
gfx::SnesPalette * current_palette_ = nullptr
 
std::string host_surface_hint_
 

Detailed Description

Manage graphics group configurations in a Rom.

Provides a UI for viewing and editing:

  • Blocksets (8 sheets per blockset)
  • Roomsets (4 sheets that override blockset slots 3-6; zero inherits)
  • Spritesets (4 sheets for enemy/NPC graphics)

Features palette preview controls for viewing sheets with different palettes.

When SetWorkspaceState is set (typically from EditorSet), selection and preview palette UI fields are shared with other GfxGroupEditor instances for the same ROM session. Canvases remain per-instance.

Definition at line 39 of file gfx_group_editor.h.

Member Typedef Documentation

◆ MainUsageCallback

Initial value:
std::function<absl::StatusOr<zelda3::MainGroupUsageReport>(int, int)>

Definition at line 58 of file gfx_group_editor.h.

◆ RoomsetUsageCallback

Initial value:
std::function<absl::StatusOr<zelda3::RoomsetUsageReport>(int)>

Definition at line 68 of file gfx_group_editor.h.

Member Enumeration Documentation

◆ GroupKind

enum class yaze::editor::GfxGroupEditor::GroupKind
strongprivate
Enumerator
kMain 
kRoomset 

Definition at line 89 of file gfx_group_editor.h.

Constructor & Destructor Documentation

◆ ~GfxGroupEditor()

yaze::editor::GfxGroupEditor::~GfxGroupEditor ( )

Member Function Documentation

◆ Update()

◆ DrawBlocksetViewer()

void yaze::editor::GfxGroupEditor::DrawBlocksetViewer ( bool sheet_only = false)

◆ DrawRoomsetViewer()

void yaze::editor::GfxGroupEditor::DrawRoomsetViewer ( )

◆ DrawSpritesetViewer()

void yaze::editor::GfxGroupEditor::DrawSpritesetViewer ( bool sheet_only = false)

◆ DrawPaletteControls()

◆ SetSelectedBlockset()

void yaze::editor::GfxGroupEditor::SetSelectedBlockset ( uint8_t blockset)
inline

Definition at line 49 of file gfx_group_editor.h.

References yaze::editor::GfxGroupWorkspaceState::selected_blockset, and Ws().

Here is the call graph for this function:

◆ SetSelectedRoomset()

void yaze::editor::GfxGroupEditor::SetSelectedRoomset ( uint8_t roomset)
inline

Definition at line 52 of file gfx_group_editor.h.

References yaze::editor::GfxGroupWorkspaceState::selected_roomset, and Ws().

Here is the call graph for this function:

◆ SetSelectedSpriteset()

void yaze::editor::GfxGroupEditor::SetSelectedSpriteset ( uint8_t spriteset)
inline

Definition at line 53 of file gfx_group_editor.h.

References yaze::editor::GfxGroupWorkspaceState::selected_spriteset, and Ws().

Here is the call graph for this function:

◆ SetRom()

void yaze::editor::GfxGroupEditor::SetRom ( Rom * rom)

Definition at line 72 of file gfx_group_editor_main.cc.

References assignment_session_, current_palette_, ResetSheetPicker(), rom(), rom_, usage_areas_, and usage_rooms_.

Referenced by DetachRuntimeContext(), and yaze::editor::OverworldEditor::OverworldEditor().

Here is the call graph for this function:

◆ SetUndoManager()

void yaze::editor::GfxGroupEditor::SetUndoManager ( UndoManager * undo)
inline

Definition at line 57 of file gfx_group_editor.h.

References undo_.

Referenced by yaze::editor::OverworldEditor::OverworldEditor().

◆ SetMainUsageCallback()

void yaze::editor::GfxGroupEditor::SetMainUsageCallback ( MainUsageCallback callback)
inline

◆ EditMainGraphicsSheet()

absl::Status yaze::editor::GfxGroupEditor::EditMainGraphicsSheet ( int group,
int slot,
int sheet )

Definition at line 104 of file gfx_group_editor_main.cc.

References EditGraphicsSheet(), and kMain.

Here is the call graph for this function:

◆ EditRoomsetGraphicsSheet()

absl::Status yaze::editor::GfxGroupEditor::EditRoomsetGraphicsSheet ( int group,
int entry,
int sheet )

Definition at line 109 of file gfx_group_editor_main.cc.

References EditGraphicsSheet(), and kRoomset.

Here is the call graph for this function:

◆ SetRoomsetUsageCallback()

void yaze::editor::GfxGroupEditor::SetRoomsetUsageCallback ( RoomsetUsageCallback callback)
inline

◆ DetachRuntimeContext()

void yaze::editor::GfxGroupEditor::DetachRuntimeContext ( )

Definition at line 95 of file gfx_group_editor_main.cc.

References main_usage_, roomset_usage_, SetGameData(), SetRom(), undo_, and workspace_.

Referenced by yaze::editor::OverworldEditor::PrepareForSessionTeardown().

Here is the call graph for this function:

◆ rom()

Rom * yaze::editor::GfxGroupEditor::rom ( ) const
inline

Definition at line 74 of file gfx_group_editor.h.

References rom_.

Referenced by SetRom(), and Update().

◆ SetGameData()

void yaze::editor::GfxGroupEditor::SetGameData ( zelda3::GameData * data)

Definition at line 84 of file gfx_group_editor_main.cc.

References assignment_session_, current_palette_, game_data_, and ResetSheetPicker().

Referenced by DetachRuntimeContext(), and yaze::editor::OverworldEditor::SetGameData().

Here is the call graph for this function:

◆ game_data()

zelda3::GameData * yaze::editor::GfxGroupEditor::game_data ( ) const
inline

◆ SetWorkspaceState()

void yaze::editor::GfxGroupEditor::SetWorkspaceState ( GfxGroupWorkspaceState * state)
inline

Definition at line 78 of file gfx_group_editor.h.

References workspace_.

Referenced by yaze::editor::OverworldEditor::SetDependencies().

◆ SetHostSurfaceHint()

void yaze::editor::GfxGroupEditor::SetHostSurfaceHint ( std::string hint)
inline

Subdued line at top of the panel (per-surface messaging).

Definition at line 81 of file gfx_group_editor.h.

References host_surface_hint_.

Referenced by yaze::editor::OverworldEditor::Initialize().

◆ workspace_state()

const GfxGroupWorkspaceState & yaze::editor::GfxGroupEditor::workspace_state ( ) const
inline

Definition at line 85 of file gfx_group_editor.h.

References Ws().

Here is the call graph for this function:

◆ UpdateCurrentPalette()

void yaze::editor::GfxGroupEditor::UpdateCurrentPalette ( )
private

Definition at line 491 of file gfx_group_editor.cc.

References current_palette_, game_data(), yaze::zelda3::GameData::palette_groups, and Ws().

Referenced by DrawPaletteControls(), PrepareSheetPreview(), and Update().

Here is the call graph for this function:

◆ EditGraphicsSheet()

◆ DrawAssignmentControls()

◆ DrawRoomsetUsage()

void yaze::editor::GfxGroupEditor::DrawRoomsetUsage ( )
private

Definition at line 220 of file gfx_group_editor_main.cc.

References roomset_usage_, and Ws().

Referenced by DrawAssignmentControls().

Here is the call graph for this function:

◆ DrawMainUsage()

void yaze::editor::GfxGroupEditor::DrawMainUsage ( )
private

Definition at line 169 of file gfx_group_editor_main.cc.

References main_usage_, selected_main_slot_, and Ws().

Referenced by DrawAssignmentControls().

Here is the call graph for this function:

◆ DrawSheetPicker()

◆ ResetSheetPicker()

void yaze::editor::GfxGroupEditor::ResetSheetPicker ( )
private

◆ PrepareSheetPreview()

◆ Ws() [1/2]

◆ Ws() [2/2]

const GfxGroupWorkspaceState & yaze::editor::GfxGroupEditor::Ws ( ) const
inlineprivate

Definition at line 120 of file gfx_group_editor.h.

References fallback_, and workspace_.

◆ DrawSpritesetUsage()

void yaze::editor::GfxGroupEditor::DrawSpritesetUsage ( int id)
private

Member Data Documentation

◆ assignment_session_

std::shared_ptr<AssignmentSession> yaze::editor::GfxGroupEditor::assignment_session_
private
Initial value:
=
std::make_shared<AssignmentSession>()

Definition at line 102 of file gfx_group_editor.h.

Referenced by EditGraphicsSheet(), SetGameData(), and SetRom().

◆ undo_

UndoManager* yaze::editor::GfxGroupEditor::undo_ = nullptr
private

◆ main_usage_

MainUsageCallback yaze::editor::GfxGroupEditor::main_usage_
private

◆ roomset_usage_

RoomsetUsageCallback yaze::editor::GfxGroupEditor::roomset_usage_
private

◆ picker_kind_

GroupKind yaze::editor::GfxGroupEditor::picker_kind_ = GroupKind::kMain
private

Definition at line 107 of file gfx_group_editor.h.

Referenced by DrawAssignmentControls(), and DrawSheetPicker().

◆ selected_roomset_entry_

int yaze::editor::GfxGroupEditor::selected_roomset_entry_ = 0
private

Definition at line 108 of file gfx_group_editor.h.

Referenced by DrawAssignmentControls(), and DrawSheetPicker().

◆ selected_main_slot_

int yaze::editor::GfxGroupEditor::selected_main_slot_ = 0
private

Definition at line 109 of file gfx_group_editor.h.

Referenced by DrawAssignmentControls(), DrawMainUsage(), and DrawSheetPicker().

◆ picker_group_

int yaze::editor::GfxGroupEditor::picker_group_ = -1
private

Definition at line 110 of file gfx_group_editor.h.

Referenced by DrawAssignmentControls(), DrawSheetPicker(), and ResetSheetPicker().

◆ pending_sheet_

int yaze::editor::GfxGroupEditor::pending_sheet_ = -1
private

Definition at line 111 of file gfx_group_editor.h.

Referenced by DrawSheetPicker(), and ResetSheetPicker().

◆ picker_expected_sheet_

uint8_t yaze::editor::GfxGroupEditor::picker_expected_sheet_ = 0
private

Definition at line 112 of file gfx_group_editor.h.

Referenced by DrawAssignmentControls(), and DrawSheetPicker().

◆ show_sheet_picker_

bool yaze::editor::GfxGroupEditor::show_sheet_picker_ = false
private

Definition at line 113 of file gfx_group_editor.h.

Referenced by DrawAssignmentControls(), DrawSheetPicker(), and ResetSheetPicker().

◆ assignment_error_

std::string yaze::editor::GfxGroupEditor::assignment_error_
private

Definition at line 114 of file gfx_group_editor.h.

Referenced by DrawAssignmentControls(), DrawSheetPicker(), and ResetSheetPicker().

◆ picker_previews_

std::map<int, gfx::Bitmap> yaze::editor::GfxGroupEditor::picker_previews_
private

Definition at line 115 of file gfx_group_editor.h.

Referenced by DrawSheetPicker(), and ResetSheetPicker().

◆ workspace_

GfxGroupWorkspaceState* yaze::editor::GfxGroupEditor::workspace_ = nullptr
private

Definition at line 124 of file gfx_group_editor.h.

Referenced by DetachRuntimeContext(), SetWorkspaceState(), Ws(), and Ws().

◆ fallback_

GfxGroupWorkspaceState yaze::editor::GfxGroupEditor::fallback_ {}
private

Definition at line 125 of file gfx_group_editor.h.

Referenced by Ws(), and Ws().

◆ blockset_canvases_

std::array<gui::Canvas, 8> yaze::editor::GfxGroupEditor::blockset_canvases_
private

Definition at line 128 of file gfx_group_editor.h.

Referenced by DrawBlocksetViewer().

◆ roomset_canvases_

std::array<gui::Canvas, 4> yaze::editor::GfxGroupEditor::roomset_canvases_
private

Definition at line 129 of file gfx_group_editor.h.

Referenced by DrawRoomsetViewer().

◆ spriteset_canvases_

std::array<gui::Canvas, 4> yaze::editor::GfxGroupEditor::spriteset_canvases_
private

Definition at line 130 of file gfx_group_editor.h.

Referenced by DrawSpritesetViewer().

◆ blockset_previews_

std::array<gfx::Bitmap, 8> yaze::editor::GfxGroupEditor::blockset_previews_
private

Definition at line 132 of file gfx_group_editor.h.

Referenced by DrawBlocksetViewer(), and ~GfxGroupEditor().

◆ roomset_previews_

std::array<gfx::Bitmap, 4> yaze::editor::GfxGroupEditor::roomset_previews_
private

Definition at line 133 of file gfx_group_editor.h.

Referenced by DrawRoomsetViewer(), and ~GfxGroupEditor().

◆ spriteset_previews_

std::array<gfx::Bitmap, 4> yaze::editor::GfxGroupEditor::spriteset_previews_
private

Definition at line 134 of file gfx_group_editor.h.

Referenced by DrawSpritesetViewer(), and ~GfxGroupEditor().

◆ rom_

Rom* yaze::editor::GfxGroupEditor::rom_ = nullptr
private

Definition at line 136 of file gfx_group_editor.h.

Referenced by DrawSpritesetUsage(), EditGraphicsSheet(), rom(), and SetRom().

◆ game_data_

zelda3::GameData* yaze::editor::GfxGroupEditor::game_data_ = nullptr
private

◆ usage_areas_

std::optional<std::map<int, zelda3::OverworldAreaGfxInfo> > yaze::editor::GfxGroupEditor::usage_areas_
private

Definition at line 142 of file gfx_group_editor.h.

Referenced by DrawSpritesetUsage(), and SetRom().

◆ usage_rooms_

std::optional<std::map<int, zelda3::RoomGfxInfo> > yaze::editor::GfxGroupEditor::usage_rooms_
private

Definition at line 143 of file gfx_group_editor.h.

Referenced by DrawSpritesetUsage(), and SetRom().

◆ usage_rom_

const Rom* yaze::editor::GfxGroupEditor::usage_rom_ = nullptr
private

Definition at line 144 of file gfx_group_editor.h.

Referenced by DrawSpritesetUsage().

◆ current_palette_

gfx::SnesPalette* yaze::editor::GfxGroupEditor::current_palette_ = nullptr
private

◆ host_surface_hint_

std::string yaze::editor::GfxGroupEditor::host_surface_hint_
private

Definition at line 146 of file gfx_group_editor.h.

Referenced by SetHostSurfaceHint(), and Update().


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