Skip to content

Dialoguepage trifurcation#435

Draft
PringlesGang wants to merge 8 commits intomasterfrom
dialoguepage-trifurcation
Draft

Dialoguepage trifurcation#435
PringlesGang wants to merge 8 commits intomasterfrom
dialoguepage-trifurcation

Conversation

@PringlesGang
Copy link
Copy Markdown
Member

@PringlesGang PringlesGang commented Mar 24, 2026

Trifurcates the DialoguePage class into separate instances for dialogue, backlog entries, and tip entries

Moves text parsing to a separate class, with separate directive functions for dialogue, backlog, and tips, handling what is parsed and how

@PringlesGang PringlesGang added this to the 0.9.X Polishing milestone Mar 24, 2026
@PringlesGang PringlesGang self-assigned this Mar 24, 2026
@PringlesGang PringlesGang force-pushed the dialoguepage-trifurcation branch from 24b9ee8 to 763e9c8 Compare March 28, 2026 00:18
@PringlesGang PringlesGang force-pushed the dialoguepage-trifurcation branch from 763e9c8 to 4843a2e Compare March 30, 2026 20:54
protected:
DialoguePage* BacklogPage;
int TextLength = 0;
std::unique_ptr<BacklogPage> Page;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of having a backlogpage pointer per backlog entry (which adds a lot of indirection and fragmentation), could we instead maybe store a vector of backlogpages inside backlog menu (since it's not polymorphic), and then access that in backlogentry with an index and maybe a pointer to the backlogmenu?
If backlog max count should be a bounded value, we should store it in a static array as well.

DialoguePageMode PageMode = DPM_ADV;

protected:
void ParseLineBreak(const StringToken& token);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest a template function for this templated on the StringToken, then you can specialize it in the textparser.cpp since it's only being used there anyway. To handle runtime to compiletime lookup, I would recommend doing a constexpr static lookup table like what we had for backgrounds2d table rather than a heap allocated map + std function, just do nullptr checks if you wanna leave some blank.

template <StringTokenType T>
void ParseStringToken(const Stringtoken& t);

using TextParserProc = auto (TextParser::*)(const StringToken&) -> void;
auto constexpr static textParserLUT = std::to_array<TextParserProc>({
 &TextParser::ParseStringToken<STT_LineBreak>,
 &TextParser::ParseStringToken<STT_CharacterNameStart>,
 nullptr, 
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DialoguePage Refactor Step 3] Duplicate string parsing for the backlogs so that they don't keep the "styling" from the main DialoguePage

2 participants