diff --git a/asm/Kyoto/Text/CRemoveColorOverrideInstruction.s b/asm/Kyoto/Text/CRemoveColorOverrideInstruction.s index 8573715a..da2c6c10 100644 --- a/asm/Kyoto/Text/CRemoveColorOverrideInstruction.s +++ b/asm/Kyoto/Text/CRemoveColorOverrideInstruction.s @@ -3,8 +3,8 @@ .section .data .balign 8 -.global lbl_803ED6D8 -lbl_803ED6D8: +.global __vt__31CRemoveColorOverrideInstruction +__vt__31CRemoveColorOverrideInstruction: # ROM: 0x3EA6D8 .4byte 0 .4byte 0 @@ -25,8 +25,8 @@ __dt__31CRemoveColorOverrideInstructionFv: /* 80301848 002FE7A8 93 E1 00 0C */ stw r31, 0xc(r1) /* 8030184C 002FE7AC 7C 7F 1B 79 */ or. r31, r3, r3 /* 80301850 002FE7B0 41 82 00 30 */ beq lbl_80301880 -/* 80301854 002FE7B4 3C 60 80 3F */ lis r3, lbl_803ED6D8@ha -/* 80301858 002FE7B8 38 03 D6 D8 */ addi r0, r3, lbl_803ED6D8@l +/* 80301854 002FE7B4 3C 60 80 3F */ lis r3, __vt__31CRemoveColorOverrideInstruction@ha +/* 80301858 002FE7B8 38 03 D6 D8 */ addi r0, r3, __vt__31CRemoveColorOverrideInstruction@l /* 8030185C 002FE7BC 90 1F 00 00 */ stw r0, 0(r31) /* 80301860 002FE7C0 41 82 00 10 */ beq lbl_80301870 /* 80301864 002FE7C4 3C 60 80 3E */ lis r3, __vt__12CInstruction@ha diff --git a/asm/Kyoto/Text/CTextExecuteBuffer.s b/asm/Kyoto/Text/CTextExecuteBuffer.s index 981f9590..4600e062 100644 --- a/asm/Kyoto/Text/CTextExecuteBuffer.s +++ b/asm/Kyoto/Text/CTextExecuteBuffer.s @@ -1739,10 +1739,10 @@ __ct__31CRemoveColorOverrideInstructionFi: /* 80303358 003002B8 7C 7F 1B 79 */ or. r31, r3, r3 /* 8030335C 003002BC 41 82 00 20 */ beq lbl_8030337C /* 80303360 003002C0 3C 80 80 3E */ lis r4, __vt__12CInstruction@ha -/* 80303364 003002C4 3C 60 80 3F */ lis r3, lbl_803ED6D8@ha +/* 80303364 003002C4 3C 60 80 3F */ lis r3, __vt__31CRemoveColorOverrideInstruction@ha /* 80303368 003002C8 38 04 9A 6C */ addi r0, r4, __vt__12CInstruction@l /* 8030336C 003002CC 90 1F 00 00 */ stw r0, 0(r31) -/* 80303370 003002D0 38 03 D6 D8 */ addi r0, r3, lbl_803ED6D8@l +/* 80303370 003002D0 38 03 D6 D8 */ addi r0, r3, __vt__31CRemoveColorOverrideInstruction@l /* 80303374 003002D4 90 1F 00 00 */ stw r0, 0(r31) /* 80303378 003002D8 93 DF 00 04 */ stw r30, 4(r31) lbl_8030337C: diff --git a/configure.py b/configure.py index 5c6818ec..cd24cefb 100755 --- a/configure.py +++ b/configure.py @@ -545,7 +545,7 @@ LIBS = [ ["Kyoto/Text/CPopStateInstruction", True], ["Kyoto/Text/CPushStateInstruction", True], ["Kyoto/Text/CRasterFont", False], - "Kyoto/Text/CRemoveColorOverrideInstruction", + ["Kyoto/Text/CRemoveColorOverrideInstruction", True], ["Kyoto/Text/CSaveableState", True], "Kyoto/Text/CTextExecuteBuffer", "Kyoto/Text/CTextInstruction", diff --git a/include/Kyoto/Text/CFontRenderState.hpp b/include/Kyoto/Text/CFontRenderState.hpp index fe4ef2a4..2959765c 100644 --- a/include/Kyoto/Text/CFontRenderState.hpp +++ b/include/Kyoto/Text/CFontRenderState.hpp @@ -12,10 +12,13 @@ public: void PushState(); void PopState(); void SetColor(EColorType type, const CTextColor& color); + void RefreshPalette(); const TToken& GetFont() { return x0_state.GetFont(); } void SetLineSpacing(float spacing) { x0_state.SetLineSpacing(spacing); } void SetExtraLineSpace(int spacing) { x0_state.SetLineExtraSpace(spacing); } - + + + rstl::vector& GetOverride() { return x0_state.GetOverride(); } private: CSaveableState x0_state; CBlockInstruction* x88_curBlock; diff --git a/include/Kyoto/Text/CRemoveColorOverrideInstruction.hpp b/include/Kyoto/Text/CRemoveColorOverrideInstruction.hpp new file mode 100644 index 00000000..9e9da0f9 --- /dev/null +++ b/include/Kyoto/Text/CRemoveColorOverrideInstruction.hpp @@ -0,0 +1,16 @@ +#ifndef _CREMOVECOLOROVERRIDEINSTRUCTION +#define _CREMOVECOLOROVERRIDEINSTRUCTION + +#include "Kyoto/Text/CInstruction.hpp" + +class CRemoveColorOverrideInstruction : public CInstruction { +public: + explicit CRemoveColorOverrideInstruction(int idx) : x4_idx(idx) {} + void Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const; + void PageInvoke(CFontRenderState& state, CTextRenderBuffer* buf) const; + +private: + int x4_idx; +}; + +#endif // _CREMOVECOLOROVERRIDEINSTRUCTION diff --git a/include/Kyoto/Text/CSaveableState.hpp b/include/Kyoto/Text/CSaveableState.hpp index 0cf847f2..779472c0 100644 --- a/include/Kyoto/Text/CSaveableState.hpp +++ b/include/Kyoto/Text/CSaveableState.hpp @@ -18,6 +18,7 @@ public: void SetLineSpacing(float spacing) { x74_lineSpacing = spacing; } void SetLineExtraSpace(int spacing) { x78_extraLineSpacing = spacing; } + rstl::vector& GetOverride() { return x64_colorOverrides; } private: CDrawStringOptions x0_drawStringOptions; diff --git a/src/Kyoto/Text/CRemoveColorOverrideInstruction.cpp b/src/Kyoto/Text/CRemoveColorOverrideInstruction.cpp new file mode 100644 index 00000000..1eb3efa7 --- /dev/null +++ b/src/Kyoto/Text/CRemoveColorOverrideInstruction.cpp @@ -0,0 +1,12 @@ +#include "Kyoto/Text/CRemoveColorOverrideInstruction.hpp" + +#include "Kyoto/Text/CFontRenderState.hpp" + +void CRemoveColorOverrideInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const { + state.GetOverride()[x4_idx] = false; + state.RefreshPalette(); +} + +void CRemoveColorOverrideInstruction::PageInvoke(CFontRenderState& state, CTextRenderBuffer* buf) const { + Invoke(state, buf); +}