mirror of https://github.com/PrimeDecomp/prime.git
Add CWordInstruction
This commit is contained in:
parent
3bba1300af
commit
2f75767d00
|
@ -1158,10 +1158,10 @@ MoveWordLTR__18CTextExecuteBufferFv:
|
|||
/* 80302B34 002FFA94 7C 7E 1B 79 */ or. r30, r3, r3
|
||||
/* 80302B38 002FFA98 41 82 00 1C */ beq .L_80302B54
|
||||
/* 80302B3C 002FFA9C 3C 80 80 3E */ lis r4, __vt__12CInstruction@ha
|
||||
/* 80302B40 002FFAA0 3C 60 80 3F */ lis r3, lbl_803ED8A8@ha
|
||||
/* 80302B40 002FFAA0 3C 60 80 3F */ lis r3, __vt__16CWordInstruction@ha
|
||||
/* 80302B44 002FFAA4 38 04 9A 6C */ addi r0, r4, __vt__12CInstruction@l
|
||||
/* 80302B48 002FFAA8 90 1E 00 00 */ stw r0, 0(r30)
|
||||
/* 80302B4C 002FFAAC 38 03 D8 A8 */ addi r0, r3, lbl_803ED8A8@l
|
||||
/* 80302B4C 002FFAAC 38 03 D8 A8 */ addi r0, r3, __vt__16CWordInstruction@l
|
||||
/* 80302B50 002FFAB0 90 1E 00 00 */ stw r0, 0(r30)
|
||||
.L_80302B54:
|
||||
/* 80302B54 002FFAB4 3C 80 80 3D */ lis r4, lbl_803D6E90@ha
|
||||
|
@ -1348,10 +1348,10 @@ StartNewWord__18CTextExecuteBufferFv:
|
|||
/* 80302DE8 002FFD48 7C 7F 1B 79 */ or. r31, r3, r3
|
||||
/* 80302DEC 002FFD4C 41 82 00 1C */ beq .L_80302E08
|
||||
/* 80302DF0 002FFD50 3C 80 80 3E */ lis r4, __vt__12CInstruction@ha
|
||||
/* 80302DF4 002FFD54 3C 60 80 3F */ lis r3, lbl_803ED8A8@ha
|
||||
/* 80302DF4 002FFD54 3C 60 80 3F */ lis r3, __vt__16CWordInstruction@ha
|
||||
/* 80302DF8 002FFD58 38 04 9A 6C */ addi r0, r4, __vt__12CInstruction@l
|
||||
/* 80302DFC 002FFD5C 90 1F 00 00 */ stw r0, 0(r31)
|
||||
/* 80302E00 002FFD60 38 03 D8 A8 */ addi r0, r3, lbl_803ED8A8@l
|
||||
/* 80302E00 002FFD60 38 03 D8 A8 */ addi r0, r3, __vt__16CWordInstruction@l
|
||||
/* 80302E04 002FFD64 90 1F 00 00 */ stw r0, 0(r31)
|
||||
.L_80302E08:
|
||||
/* 80302E08 002FFD68 3C 80 80 3D */ lis r4, lbl_803D6E90@ha
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
.section .data
|
||||
.balign 8
|
||||
|
||||
.global lbl_803ED8A8
|
||||
lbl_803ED8A8:
|
||||
.global __vt__16CWordInstruction
|
||||
__vt__16CWordInstruction:
|
||||
# ROM: 0x3EA8A8
|
||||
.4byte 0
|
||||
.4byte 0
|
||||
|
@ -25,8 +25,8 @@ __dt__16CWordInstructionFv:
|
|||
/* 80305BF4 00302B54 93 E1 00 0C */ stw r31, 0xc(r1)
|
||||
/* 80305BF8 00302B58 7C 7F 1B 79 */ or. r31, r3, r3
|
||||
/* 80305BFC 00302B5C 41 82 00 30 */ beq lbl_80305C2C
|
||||
/* 80305C00 00302B60 3C 60 80 3F */ lis r3, lbl_803ED8A8@ha
|
||||
/* 80305C04 00302B64 38 03 D8 A8 */ addi r0, r3, lbl_803ED8A8@l
|
||||
/* 80305C00 00302B60 3C 60 80 3F */ lis r3, __vt__16CWordInstruction@ha
|
||||
/* 80305C04 00302B64 38 03 D8 A8 */ addi r0, r3, __vt__16CWordInstruction@l
|
||||
/* 80305C08 00302B68 90 1F 00 00 */ stw r0, 0(r31)
|
||||
/* 80305C0C 00302B6C 41 82 00 10 */ beq lbl_80305C1C
|
||||
/* 80305C10 00302B70 3C 60 80 3E */ lis r3, __vt__12CInstruction@ha
|
||||
|
|
|
@ -551,7 +551,7 @@ LIBS = [
|
|||
"Kyoto/Text/CTextInstruction",
|
||||
["Kyoto/Text/CTextParser", False],
|
||||
["Kyoto/Text/CWordBreakTables", False],
|
||||
"Kyoto/Text/CWordInstruction",
|
||||
["Kyoto/Text/CWordInstruction", False],
|
||||
["Kyoto/Text/CBlockInstruction", True],
|
||||
["Kyoto/Text/CFont", True],
|
||||
["Kyoto/Graphics/CLight", True],
|
||||
|
|
|
@ -27,6 +27,19 @@ public:
|
|||
void TestLargestFont(int monoW, int monoH, int baseline);
|
||||
void PageInvoke(CFontRenderState& state, CTextRenderBuffer* buf) const;
|
||||
|
||||
int GetOutputX() const { return x4_offsetX; }
|
||||
int GetOutputY() const { return x8_offsetY; }
|
||||
int GetOutputWidth() const { return xc_blockExtentX; }
|
||||
int GetOutputHeight() const { return x10_blockExtentY; }
|
||||
ETextDirection GetTextDirection() const { return x14_dir; }
|
||||
EJustification GetJustification() const { return x18_justification; }
|
||||
EVerticalJustification GetVerticalJustification() const { return x1c_vertJustification; }
|
||||
int GetLargestFontWidth() const { return x20_largestMonoW; }
|
||||
int GetLargestFontHeight() const { return x24_largestMonoH; }
|
||||
int GetLineX() const { return x2c_lineX; }
|
||||
int GetLineY() const { return x30_lineY; }
|
||||
int GetLines() const { return x34_lineCount; }
|
||||
|
||||
private:
|
||||
int x4_offsetX;
|
||||
int x8_offsetY;
|
||||
|
|
|
@ -10,6 +10,7 @@ public:
|
|||
CDrawStringOptions();
|
||||
|
||||
void SetTextDirection(ETextDirection dir) { x0_direction = dir; }
|
||||
ETextDirection GetTextDirection() const { return x0_direction; }
|
||||
void SetPaletteEntry(int idx, uint color) { x4_colors[idx] = color; }
|
||||
private:
|
||||
ETextDirection x0_direction;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "Kyoto/Text/TextCommon.hpp"
|
||||
|
||||
class CBlockInstruction;
|
||||
class CLineInstruction;
|
||||
|
||||
class CFontRenderState {
|
||||
public:
|
||||
|
@ -15,22 +16,36 @@ public:
|
|||
void SetColor(EColorType type, const CTextColor& color);
|
||||
void RefreshPalette();
|
||||
CDrawStringOptions& GetOptions() { return x0_state.GetOptions(); }
|
||||
const TToken< CRasterFont >& GetFont() { return x0_state.GetFont(); }
|
||||
TToken< CRasterFont >& GetFont() { return x0_state.GetFont(); }
|
||||
rstl::vector< CTextColor >& GetColors() { return x0_state.GetColors(); }
|
||||
rstl::vector< bool >& GetOverride() { return x0_state.GetOverride(); }
|
||||
void SetLineSpacing(float spacing) { x0_state.SetLineSpacing(spacing); }
|
||||
void SetExtraLineSpace(int spacing) { x0_state.SetLineExtraSpace(spacing); }
|
||||
void SetBlock(const CBlockInstruction* block) { x88_curBlock = const_cast<CBlockInstruction*>(block); }
|
||||
const CBlockInstruction* GetBlock() const { return x88_curBlock; }
|
||||
void SetBlock(const CBlockInstruction* block) {
|
||||
x88_curBlock = const_cast< CBlockInstruction* >(block);
|
||||
}
|
||||
void SetX(int x) { xd4_curX = x; }
|
||||
int GetX() const { return xd4_curX; }
|
||||
void SetY(int y) { xd8_curY = y; }
|
||||
int GetY() const { return xd8_curY; }
|
||||
const CLineInstruction* GetLine() const { return xdc_currentLineInst; }
|
||||
bool IsFirstWordOnLine() const { return x108_lineInitialized; }
|
||||
void SetFirstWordOnLine(bool v) { x108_lineInitialized = v; }
|
||||
|
||||
private:
|
||||
CSaveableState x0_state;
|
||||
CBlockInstruction* x88_curBlock;
|
||||
CDrawStringOptions x8c_drawOpts;
|
||||
int xd4_curX;
|
||||
int xd8_curY;
|
||||
const CLineInstruction* xdc_currentLineInst;
|
||||
uint xe0_;
|
||||
uint xe4_;
|
||||
rstl::vector< uint > xe8_;
|
||||
rstl::vector< uchar > xf8_;
|
||||
bool x108_lineInitialized;
|
||||
rstl::list< CSaveableState > x10c_pushedStates;
|
||||
};
|
||||
|
||||
#endif // _CFONTRENDERSTATE
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
bool IsFinishedLoading();
|
||||
|
||||
CDrawStringOptions& GetOptions() { return x0_drawStringOptions; }
|
||||
const TToken<CRasterFont>& GetFont() const { return *x48_font; }
|
||||
TToken<CRasterFont>& GetFont() { return *x48_font; }
|
||||
rstl::vector<CTextColor>& GetColors() { return x54_colors; }
|
||||
rstl::vector<bool>& GetOverride() { return x64_colorOverrides; }
|
||||
void SetLineSpacing(float spacing) { x74_lineSpacing = spacing; }
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef _CWORDINSTRUCTION
|
||||
#define _CWORDINSTRUCTION
|
||||
|
||||
#include "Kyoto/Text/CInstruction.hpp"
|
||||
|
||||
class CWordInstruction : public CInstruction {
|
||||
public:
|
||||
void Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const;
|
||||
void PageInvoke(CFontRenderState& state, CTextRenderBuffer* buf) const;
|
||||
void InvokeLTR(CFontRenderState& state) const;
|
||||
};
|
||||
|
||||
#endif // _CWORDINSTRUCTION
|
|
@ -0,0 +1,24 @@
|
|||
#include "Kyoto/Text/CWordInstruction.hpp"
|
||||
|
||||
#include "Kyoto/Text/CFontRenderState.hpp"
|
||||
#include "Kyoto/Text/CRasterFont.hpp"
|
||||
#include "Kyoto/Text/CBlockInstruction.hpp"
|
||||
//#include "Kyoto/Text/CLineInstruction.hpp"
|
||||
|
||||
void CWordInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const {
|
||||
if (!state.IsFirstWordOnLine()) {
|
||||
if (state.GetOptions().GetTextDirection() == kTD_Horizontal) {
|
||||
InvokeLTR(state);
|
||||
}
|
||||
} else {
|
||||
state.SetFirstWordOnLine(false);
|
||||
}
|
||||
}
|
||||
|
||||
void CWordInstruction::PageInvoke(CFontRenderState& state, CTextRenderBuffer* buf) const {
|
||||
state.SetFirstWordOnLine(false);
|
||||
}
|
||||
|
||||
void CWordInstruction::InvokeLTR(CFontRenderState& state) const {
|
||||
// TODO: Implement this
|
||||
}
|
Loading…
Reference in New Issue