Skip to content

Dialoguepage trifurcation#435

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

Dialoguepage trifurcation#435
PringlesGang wants to merge 15 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 2 times, most recently 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.

Comment thread src/text/textparser.h Outdated
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, 
});

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Is this about what you meant? a35519b

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.

Yeah pretty much, i think you can use magic enum's enum containers too

@Enorovan Enorovan removed this from the 0.9.X Polishing milestone Apr 8, 2026
@PringlesGang PringlesGang force-pushed the dialoguepage-trifurcation branch 2 times, most recently from a35519b to e8bb1ba Compare April 10, 2026 22:34
@PringlesGang PringlesGang force-pushed the dialoguepage-trifurcation branch from e8bb1ba to 2408cc4 Compare April 11, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants