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

The complete Oracle narrative progression graph. More...

#include <story_event_graph.h>

Public Member Functions

 StoryEventGraph ()=default
 
absl::Status LoadFromJson (const std::string &path)
 Load the graph from a JSON file.
 
absl::Status LoadFromString (const std::string &json_content)
 Load the graph from a JSON string.
 
bool loaded () const
 Check if the graph has been loaded.
 
void AutoLayout ()
 Compute layout positions using topological sort + layered positioning.
 
void UpdateStatus (uint8_t crystal_bitfield, uint8_t game_state)
 Update node completion status based on SRAM state.
 
void UpdateStatus (const OracleProgressionState &state)
 Update node completion status based on Oracle progression state.
 
std::vector< std::string > GetCompletedNodes (uint8_t crystal_bitfield, uint8_t game_state) const
 Get IDs of events that are completed based on SRAM state.
 
std::vector< std::string > GetCompletedNodes (const OracleProgressionState &state) const
 Get IDs of events that are completed based on Oracle progression state.
 
const std::vector< StoryEventNode > & nodes () const
 
const std::vector< StoryEdge > & edges () const
 
const StoryEventNodeGetNode (const std::string &id) const
 

Private Attributes

std::vector< StoryEventNodenodes_
 
std::vector< StoryEdgeedges_
 
std::unordered_map< std::string, size_t > node_index_
 

Detailed Description

The complete Oracle narrative progression graph.

Loaded from story_events.json in the Oracle code folder. Used by the StoryEventGraphPanel to render an interactive node graph colored by SRAM completion state.

Usage: StoryEventGraph graph; auto status = graph.LoadFromJson(path); if (status.ok()) { graph.AutoLayout(); graph.UpdateStatus(crystal_bitfield, game_state); // Render nodes with graph.nodes() }

Definition at line 129 of file story_event_graph.h.

Constructor & Destructor Documentation

◆ StoryEventGraph()

yaze::core::StoryEventGraph::StoryEventGraph ( )
default

Member Function Documentation

◆ LoadFromJson()

absl::Status yaze::core::StoryEventGraph::LoadFromJson ( const std::string & path)

Load the graph from a JSON file.

Definition at line 192 of file story_event_graph.cc.

References LoadFromString().

Referenced by yaze::core::HackManifest::LoadProjectRegistry().

Here is the call graph for this function:

◆ LoadFromString()

◆ loaded()

bool yaze::core::StoryEventGraph::loaded ( ) const
inline

◆ AutoLayout()

void yaze::core::StoryEventGraph::AutoLayout ( )

Compute layout positions using topological sort + layered positioning.

Places nodes in horizontal layers based on dependency depth. Within each layer, nodes are spaced vertically.

Definition at line 336 of file story_event_graph.cc.

References edges_, and nodes_.

Referenced by yaze::core::HackManifest::LoadProjectRegistry().

◆ UpdateStatus() [1/2]

void yaze::core::StoryEventGraph::UpdateStatus ( uint8_t crystal_bitfield,
uint8_t game_state )

Update node completion status based on SRAM state.

Determines which events are completed, available, or locked based on the crystal bitfield and game state.

Definition at line 485 of file story_event_graph.cc.

References yaze::core::OracleProgressionState::crystal_bitfield, yaze::core::OracleProgressionState::game_state, and UpdateStatus().

Referenced by yaze::core::HackManifest::ClearOracleProgressionState(), yaze::core::HackManifest::LoadProjectRegistry(), yaze::core::HackManifest::SetOracleProgressionState(), and UpdateStatus().

Here is the call graph for this function:

◆ UpdateStatus() [2/2]

void yaze::core::StoryEventGraph::UpdateStatus ( const OracleProgressionState & state)

Update node completion status based on Oracle progression state.

Definition at line 493 of file story_event_graph.cc.

References GetCompletedNodes(), yaze::core::kAvailable, yaze::core::kCompleted, yaze::core::kLocked, and nodes_.

Here is the call graph for this function:

◆ GetCompletedNodes() [1/2]

std::vector< std::string > yaze::core::StoryEventGraph::GetCompletedNodes ( uint8_t crystal_bitfield,
uint8_t game_state ) const

Get IDs of events that are completed based on SRAM state.

Definition at line 520 of file story_event_graph.cc.

References yaze::core::OracleProgressionState::crystal_bitfield, yaze::core::OracleProgressionState::game_state, and GetCompletedNodes().

Referenced by GetCompletedNodes(), and UpdateStatus().

Here is the call graph for this function:

◆ GetCompletedNodes() [2/2]

std::vector< std::string > yaze::core::StoryEventGraph::GetCompletedNodes ( const OracleProgressionState & state) const

Get IDs of events that are completed based on Oracle progression state.

Definition at line 528 of file story_event_graph.cc.

References yaze::core::OracleProgressionState::crystal_bitfield, yaze::core::OracleProgressionState::game_state, and nodes_.

◆ nodes()

const std::vector< StoryEventNode > & yaze::core::StoryEventGraph::nodes ( ) const
inline

◆ edges()

const std::vector< StoryEdge > & yaze::core::StoryEventGraph::edges ( ) const
inline

Definition at line 188 of file story_event_graph.h.

References edges_.

Referenced by yaze::core::HackManifest::LoadProjectRegistry().

◆ GetNode()

const StoryEventNode * yaze::core::StoryEventGraph::GetNode ( const std::string & id) const

Definition at line 597 of file story_event_graph.cc.

References node_index_, and nodes_.

Referenced by yaze::editor::StoryEventGraphPanel::DrawNodeDetail().

Member Data Documentation

◆ nodes_

std::vector<StoryEventNode> yaze::core::StoryEventGraph::nodes_
private

◆ edges_

std::vector<StoryEdge> yaze::core::StoryEventGraph::edges_
private

Definition at line 194 of file story_event_graph.h.

Referenced by AutoLayout(), edges(), and LoadFromString().

◆ node_index_

std::unordered_map<std::string, size_t> yaze::core::StoryEventGraph::node_index_
private

Definition at line 195 of file story_event_graph.h.

Referenced by GetNode(), and LoadFromString().


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