2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 17:04:55 +00:00

Implement CCredits, minor text parser fixes

This commit is contained in:
2020-05-03 19:27:48 -07:00
parent 0f92b8d8c5
commit 0c6813d952
9 changed files with 321 additions and 13 deletions

View File

@@ -129,6 +129,17 @@ public:
void SetVerticalJustification(EVerticalJustification j);
void SetImageBaseline(bool b);
bool GetIsTextSupportFinishedLoading();
float GetCurTimeMod900() const { return x10_curTimeMod900; }
s32 GetExtentX() const { return x34_extentX; }
void SetExtentX(s32 extent) {
x34_extentX = extent;
ClearRenderBuffer();
}
s32 GetExtentY() const { return x38_extentY; }
void SetExtentY(s32 extent) {
x38_extentY = extent;
ClearRenderBuffer();
}
float GetCurTime() const { return x3c_curTime; }
void SetCurTime(float t) { x3c_curTime = t; }
std::u16string_view GetString() const { return x0_string; }

View File

@@ -162,7 +162,13 @@ void CLineSpacingInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer*
void CLineSpacingInstruction::PageInvoke(CFontRenderState& state, CTextRenderBuffer* buf) const { Invoke(state, buf); }
void CPopStateInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const { state.PopState(); }
void CPopStateInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const {
const auto& oldFont = state.GetFont();
state.PopState();
if (oldFont.GetObj() != state.GetFont().GetObj()) {
buf->AddFontChange(state.GetFont());
}
}
void CPopStateInstruction::PageInvoke(CFontRenderState& state, CTextRenderBuffer* buf) const { Invoke(state, buf); }

View File

@@ -35,6 +35,7 @@ protected:
public:
CSaveableState() : x54_colors(3, zeus::skBlack), x64_colorOverrides(16) {}
const TLockedToken<CRasterFont>& GetFont() const { return x48_font; }
bool IsFinishedLoading() const;
};

View File

@@ -229,7 +229,7 @@ void CTextExecuteBuffer::MoveWordLTR() {
->get());
// Dunno what's up with this in the original; seems fine without
// x0_instList.emplace(xa8_curWordIt, std::make_shared<CWordInstruction>());
x0_instList.emplace(xa8_curWordIt, std::make_shared<CWordInstruction>());
++xa0_curBlock->x34_lineCount;
}
@@ -263,7 +263,7 @@ void CTextExecuteBuffer::TerminateLine() {
}
void CTextExecuteBuffer::TerminateLineLTR() {
if (!xa4_curLine->xc_curY /*&& x18_textState.IsFinishedLoading()*/) {
if (!xa4_curLine->xc_curY && x18_textState.IsFinishedLoading()) {
xa4_curLine->xc_curY = std::max(xa4_curLine->GetHeight(), x18_textState.x48_font->GetCarriageAdvance());
}
@@ -280,7 +280,7 @@ void CTextExecuteBuffer::AddPopState() {
x18_textState = xc4_stateStack.back();
xc4_stateStack.pop_back();
if (!xa4_curLine->x8_curX) {
if (xa4_curLine->x8_curX == 0) {
xa4_curLine->x28_just = x18_textState.x80_just;
xa4_curLine->x2c_vjust = x18_textState.x84_vjust;
}