Various Invoke imps

This commit is contained in:
Jack Andersen 2016-03-19 20:37:08 -10:00
parent 4960f683fd
commit 18e0e208a7
13 changed files with 270 additions and 64 deletions

View File

@ -164,6 +164,10 @@ public:
Lock(); Lock();
return x0_objRef->GetObject(); return x0_objRef->GetObject();
} }
const IObj* GetObj() const
{
return ((CToken*)this)->GetObj();
}
CToken& operator=(const CToken& other) CToken& operator=(const CToken& other)
{ {
Unlock(); Unlock();
@ -247,6 +251,10 @@ public:
return static_cast<TObjOwnerDerivedFromIObj<T>*>(CToken::GetObj())->GetObj(); return static_cast<TObjOwnerDerivedFromIObj<T>*>(CToken::GetObj())->GetObj();
return nullptr; return nullptr;
} }
const T* GetObj() const
{
return ((TToken<T>*)this)->GetObj();
}
T* operator->() {return GetObj();} T* operator->() {return GetObj();}
}; };

View File

@ -13,7 +13,9 @@ class CDrawStringOptions
friend class CColorOverrideInstruction; friend class CColorOverrideInstruction;
friend class CFontRenderState; friend class CFontRenderState;
friend class CRasterFont; friend class CRasterFont;
u32 x0_ = 0; friend class CTextExecuteBuffer;
friend class CBlockInstruction;
ETextDirection x0_direction = ETextDirection::Horizontal;
std::vector<CTextColor> x4_vec; std::vector<CTextColor> x4_vec;
public: public:
CDrawStringOptions() CDrawStringOptions()

View File

@ -5,14 +5,14 @@ namespace urde
CFontImageDef::CFontImageDef(std::vector<TToken<CTexture>>&& texs, CFontImageDef::CFontImageDef(std::vector<TToken<CTexture>>&& texs,
float interval, const zeus::CVector2f& vec) float interval, const zeus::CVector2f& vec)
: x0_interval(interval), x4_texs(std::move(texs)), x14_(vec) : x0_interval(interval), x4_texs(std::move(texs)), x14_pointsPerTexel(vec)
{ {
for (TToken<CTexture>& tok : x4_texs) for (TToken<CTexture>& tok : x4_texs)
tok.Lock(); tok.Lock();
} }
CFontImageDef::CFontImageDef(TToken<CTexture>&& tex, const zeus::CVector2f& vec) CFontImageDef::CFontImageDef(TToken<CTexture>&& tex, const zeus::CVector2f& vec)
: x0_interval(0.f), x4_texs({std::move(tex)}), x14_(vec) : x0_interval(0.f), x4_texs({std::move(tex)}), x14_pointsPerTexel(vec)
{ {
x4_texs[0].Lock(); x4_texs[0].Lock();
} }

View File

@ -11,10 +11,11 @@ class CTexture;
class CFontImageDef class CFontImageDef
{ {
public:
float x0_interval; float x0_interval;
std::vector<TToken<CTexture>> x4_texs; std::vector<TToken<CTexture>> x4_texs;
zeus::CVector2f x14_; zeus::CVector2f x14_pointsPerTexel;
public:
CFontImageDef(std::vector<TToken<CTexture>>&& texs, float interval, CFontImageDef(std::vector<TToken<CTexture>>&& texs, float interval,
const zeus::CVector2f& vec); const zeus::CVector2f& vec);
CFontImageDef(TToken<CTexture>&& tex, const zeus::CVector2f& vec); CFontImageDef(TToken<CTexture>&& tex, const zeus::CVector2f& vec);

View File

@ -59,9 +59,9 @@ void CFontRenderState::RefreshColor(EColorType tp)
switch (tp) switch (tp)
{ {
case EColorType::Zero: case EColorType::Zero:
if (!x14_token) if (!x14_font)
return; return;
switch (x14_token.GetObj()->GetMode()) switch (x14_font.GetObj()->GetMode())
{ {
case EColorType::Zero: case EColorType::Zero:
if (!x30_[0]) if (!x30_[0])
@ -75,11 +75,11 @@ void CFontRenderState::RefreshColor(EColorType tp)
} }
break; break;
case EColorType::One: case EColorType::One:
if (!x14_token) if (!x14_font)
return; return;
if (x30_[1]) if (x30_[1])
return; return;
if (x14_token.GetObj()->GetMode() == EColorType::One) if (x14_font.GetObj()->GetMode() == EColorType::One)
x0_drawStrOpts.x4_vec[1] = ConvertToTextureSpace(x20_[1]); x0_drawStrOpts.x4_vec[1] = ConvertToTextureSpace(x20_[1]);
break; break;
case EColorType::Two: case EColorType::Two:

View File

@ -8,14 +8,18 @@
namespace urde namespace urde
{ {
class CLineInstruction; class CLineInstruction;
class CBlockInstruction;
class CFontRenderState : public CSaveableState class CFontRenderState : public CSaveableState
{ {
friend class CLineInstruction; friend class CLineInstruction;
friend class CBlockInstruction;
friend class CTextInstruction;
/* void* x54_ = 0; top-to-bottom state */ CBlockInstruction* x54_curBlock = nullptr;
CDrawStringOptions x58_drawOpts; CDrawStringOptions x58_drawOpts;
u32 x6c_ = 0; s32 x6c_curX = 0;
s32 x70_curY;
const CLineInstruction* x74_currentLineInst = nullptr; const CLineInstruction* x74_currentLineInst = nullptr;
bool xa0_ = true; bool xa0_ = true;
std::vector<CSaveableState> xa4_pushedStates; std::vector<CSaveableState> xa4_pushedStates;

View File

@ -13,13 +13,30 @@ class CRasterFont;
enum class EJustification enum class EJustification
{ {
Zero = 0 Zero = 0,
One,
Two,
Three,
Four,
Five,
Six,
Seven,
Eight,
Nine
}; };
enum class EVerticalJustification enum class EVerticalJustification
{ {
Zero = 0, Zero = 0,
Three = 3 One,
Two,
Three,
Four,
Five,
Six,
Seven,
Eight,
Nine
}; };
enum class EColorType enum class EColorType

View File

@ -1,6 +1,7 @@
#include "CInstruction.hpp" #include "CInstruction.hpp"
#include "CFontRenderState.hpp" #include "CFontRenderState.hpp"
#include "CTextRenderBuffer.hpp" #include "CTextRenderBuffer.hpp"
#include "CRasterFont.hpp"
namespace urde namespace urde
{ {
@ -29,7 +30,7 @@ void CColorOverrideInstruction::Invoke(CFontRenderState& state, CTextRenderBuffe
void CFontInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const void CFontInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const
{ {
buf->AddFontChange(x4_font); buf->AddFontChange(x4_font);
state.x14_token = x4_font; state.x14_font = x4_font;
state.RefreshPalette(); state.RefreshPalette();
} }
@ -48,23 +49,101 @@ void CLineExtraSpaceInstruction::Invoke(CFontRenderState& state, CTextRenderBuff
state.x44_extraLineSpace = x4_extraSpace; state.x44_extraLineSpace = x4_extraSpace;
} }
void CLineInstruction::TestLargestFont(s32 w, s32 h, s32 b) void CLineInstruction::TestLargestFont(s32 monoW, s32 monoH, s32 baseline)
{ {
if (!x18_largestBaseline) if (!x18_largestBaseline)
x18_largestBaseline = b; x18_largestBaseline = baseline;
if (x14_largestMonoWidth < w) if (x14_largestMonoWidth < monoW)
w = x14_largestMonoWidth; monoW = x14_largestMonoWidth;
if (x10_largestMonoHeight < h) if (x10_largestMonoHeight < monoH)
{ {
x10_largestMonoHeight = h; x10_largestMonoHeight = monoH;
x18_largestBaseline = b; x18_largestBaseline = baseline;
} }
} }
void CLineInstruction::InvokeLTR(CFontRenderState& state) const void CLineInstruction::InvokeLTR(CFontRenderState& state) const
{ {
switch (x1c_just)
{
case EJustification::Zero:
case EJustification::Three:
case EJustification::Four:
case EJustification::Seven:
state.x6c_curX = state.x54_curBlock->x4_offsetX;
break;
case EJustification::One:
case EJustification::Eight:
state.x6c_curX = state.x54_curBlock->x4_offsetX +
state.x54_curBlock->xc_blockPaddingX / 2 - x8_curX / 2;
break;
case EJustification::Five:
if (x4_ == 1)
{
state.x6c_curX = state.x54_curBlock->x4_offsetX +
state.x54_curBlock->xc_blockPaddingX / 2 - x8_curX / 2;
}
else
{
state.x6c_curX = state.x54_curBlock->x4_offsetX +
state.x54_curBlock->xc_blockPaddingX / 2 -
state.x54_curBlock->x2c_lineX / 2;
}
break;
case EJustification::Two:
case EJustification::Nine:
state.x6c_curX = state.x54_curBlock->x4_offsetX +
state.x54_curBlock->xc_blockPaddingX - x8_curX;
break;
case EJustification::Six:
state.x6c_curX = state.x54_curBlock->x4_offsetX +
state.x54_curBlock->xc_blockPaddingX -
state.x54_curBlock->x2c_lineX;
break;
default: break;
}
if (state.x74_currentLineInst)
{
const CLineInstruction& inst = *state.x74_currentLineInst;
s32 val = 0;
switch (state.x54_curBlock->x1c_vertJustification)
{
case EVerticalJustification::Zero:
case EVerticalJustification::One:
case EVerticalJustification::Two:
case EVerticalJustification::Four:
case EVerticalJustification::Five:
case EVerticalJustification::Six:
val = inst.xc_curY;
break;
case EVerticalJustification::Three:
val = state.x54_curBlock->x10_blockPaddingY - state.x54_curBlock->x30_lineY;
if (state.x54_curBlock->x34_lineCount > 1)
val /= state.x54_curBlock->x34_lineCount - 1;
else
val = 0;
val += inst.xc_curY;
break;
case EVerticalJustification::Seven:
val = state.x54_curBlock->x24_largestMonoH;
break;
case EVerticalJustification::Eight:
val = (inst.xc_curY - state.x54_curBlock->x24_largestMonoH) / 2 +
state.x54_curBlock->x24_largestMonoH;
break;
case EVerticalJustification::Nine:
val = state.x54_curBlock->x24_largestMonoH * 2 - inst.xc_curY;
break;
}
if (state.x54_curBlock->x1c_vertJustification != EVerticalJustification::Three)
val = val * state.x40_lineSpacing + state.x44_extraLineSpace;
state.x70_curY += val;
}
} }
void CLineInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const void CLineInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const
@ -74,12 +153,63 @@ void CLineInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf) c
state.x74_currentLineInst = this; state.x74_currentLineInst = this;
} }
CTextInstruction::CTextInstruction(const wchar_t* str, int len)
{
}
void CTextInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const void CTextInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const
{ {
int xOut, yOut;
state.x14_font.GetObj()->DrawString(state.x0_drawStrOpts, state.x6c_curX,
state.x74_currentLineInst->x18_largestBaseline + state.x70_curY,
xOut, yOut, buf, x4_str.c_str(), x4_str.size());
state.x6c_curX = xOut;
}
void CBlockInstruction::TestLargestFont(s32 monoW, s32 monoH, s32 baseline)
{
if (!x28_largestBaseline)
x28_largestBaseline = baseline;
if (x20_largestMonoW < monoW)
monoW = x20_largestMonoW;
if (x24_largestMonoH < monoH)
{
x24_largestMonoH = monoH;
x28_largestBaseline = baseline;
}
}
void CBlockInstruction::SetupPositionLTR(CFontRenderState& state) const
{
switch (x1c_vertJustification)
{
case EVerticalJustification::Zero:
case EVerticalJustification::Three:
case EVerticalJustification::Four:
case EVerticalJustification::Seven:
state.x70_curY = x8_offsetY;
break;
case EVerticalJustification::One:
case EVerticalJustification::Five:
state.x70_curY = x8_offsetY + (x10_blockPaddingY - x30_lineY) / 2;
break;
case EVerticalJustification::Eight:
state.x70_curY = x8_offsetY + (x10_blockPaddingY - x34_lineCount * x24_largestMonoH) / 2;
break;
case EVerticalJustification::Two:
case EVerticalJustification::Six:
state.x70_curY = x8_offsetY + x10_blockPaddingY - x30_lineY;
break;
case EVerticalJustification::Nine:
state.x70_curY = x8_offsetY + x10_blockPaddingY - x34_lineCount * x24_largestMonoH;
break;
}
}
void CBlockInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const
{
state.x0_drawStrOpts.x0_direction = x14_direction;
state.x54_curBlock = (CBlockInstruction*)this;
if (x14_direction == ETextDirection::Horizontal)
SetupPositionLTR(state);
} }
} }

View File

@ -3,12 +3,14 @@
#include "CToken.hpp" #include "CToken.hpp"
#include "CGuiTextSupport.hpp" #include "CGuiTextSupport.hpp"
#include "CFontImageDef.hpp"
#include <vector> #include <vector>
namespace urde namespace urde
{ {
class CFontRenderState; class CFontRenderState;
class CTextRenderBuffer; class CTextRenderBuffer;
class CFontImageDef;
class CInstruction class CInstruction
{ {
@ -60,6 +62,7 @@ public:
class CLineInstruction : public CInstruction class CLineInstruction : public CInstruction
{ {
friend class CTextExecuteBuffer; friend class CTextExecuteBuffer;
friend class CTextInstruction;
s32 x4_ = 0; s32 x4_ = 0;
s32 x8_curX = 0; s32 x8_curX = 0;
s32 xc_curY = 0; s32 xc_curY = 0;
@ -71,7 +74,7 @@ class CLineInstruction : public CInstruction
public: public:
CLineInstruction(EJustification just, EVerticalJustification vjust) CLineInstruction(EJustification just, EVerticalJustification vjust)
: x1c_just(just), x20_vjust(vjust) {} : x1c_just(just), x20_vjust(vjust) {}
void TestLargestFont(s32 w, s32 h, s32 b); void TestLargestFont(s32 monoW, s32 monoH, s32 baseline);
void InvokeLTR(CFontRenderState& state) const; void InvokeLTR(CFontRenderState& state) const;
void Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const; void Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const;
}; };
@ -106,38 +109,45 @@ public:
class CImageInstruction : public CInstruction class CImageInstruction : public CInstruction
{ {
CFontImageDef x0_image;
public: public:
CImageInstruction(const CFontImageDef& image) : x0_image(image) {}
void Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const; void Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const;
}; };
class CTextInstruction : public CInstruction class CTextInstruction : public CInstruction
{ {
std::wstring x4_str; /* used to be a placement-new sized allocation */
public: public:
CTextInstruction(const wchar_t* str, int len); CTextInstruction(const wchar_t* str, int len) : x4_str(str, len) {}
void Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const; void Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const;
}; };
class CBlockInstruction : public CInstruction class CBlockInstruction : public CInstruction
{ {
friend class CTextExecuteBuffer; friend class CTextExecuteBuffer;
s32 x4_; friend class CLineInstruction;
s32 x8_; s32 x4_offsetX;
s32 xc_; s32 x8_offsetY;
s32 x10_; s32 xc_blockPaddingX;
s32 x10_blockPaddingY;
ETextDirection x14_direction; ETextDirection x14_direction;
EJustification x18_justification; EJustification x18_justification;
EVerticalJustification x1c_vertJustification; EVerticalJustification x1c_vertJustification;
s32 x20_ = 0; s32 x20_largestMonoW = 0;
s32 x24_ = 0; s32 x24_largestMonoH = 0;
s32 x28_ = 0; s32 x28_largestBaseline = 0;
s32 x2c_ = 0; s32 x2c_lineX = 0;
s32 x30_lineY = 0; s32 x30_lineY = 0;
s32 x34_lineCount = 0; s32 x34_lineCount = 0;
public: public:
CBlockInstruction(s32 a, s32 b, s32 c, s32 d, ETextDirection dir, CBlockInstruction(s32 offX, s32 offY, s32 padX, s32 padY, ETextDirection dir,
EJustification just, EVerticalJustification vjust) EJustification just, EVerticalJustification vjust)
: x4_(a), x8_(b), xc_(c), x10_(d), x14_direction(dir), : x4_offsetX(offX), x8_offsetY(offY),
xc_blockPaddingX(padX), x10_blockPaddingY(padY), x14_direction(dir),
x18_justification(just), x1c_vertJustification(vjust) {} x18_justification(just), x1c_vertJustification(vjust) {}
void TestLargestFont(s32 monoW, s32 monoH, s32 baseline);
void SetupPositionLTR(CFontRenderState& state) const;
void Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const; void Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const;
}; };

View File

@ -90,7 +90,7 @@ void CRasterFont::SinglePassDrawString(const CDrawStringOptions& opts, int x, in
const CGlyph* glyph = GetGlyph(*chr); const CGlyph* glyph = GetGlyph(*chr);
if (glyph) if (glyph)
{ {
if (opts.x0_ == 0) if (opts.x0_direction == ETextDirection::Horizontal)
{ {
x += glyph->GetA(); x += glyph->GetA();
@ -123,7 +123,7 @@ void CRasterFont::SinglePassDrawString(const CDrawStringOptions& opts, int x, in
void CRasterFont::DrawSpace(const CDrawStringOptions& opts, int x, int y, int& xout, int& yout, int len) const void CRasterFont::DrawSpace(const CDrawStringOptions& opts, int x, int y, int& xout, int& yout, int len) const
{ {
if (opts.x0_ != 0) if (opts.x0_direction != ETextDirection::Horizontal)
return; return;
xout = x + len; xout = x + len;
@ -166,7 +166,7 @@ void CRasterFont::GetSize(const CDrawStringOptions& opts, int& width, int& heigh
if (glyph) if (glyph)
{ {
if (opts.x0_ == 0) if (opts.x0_direction == ETextDirection::Horizontal)
{ {
int advance = 0; int advance = 0;
if (prevGlyph) if (prevGlyph)

View File

@ -16,9 +16,10 @@ class CSaveableState
friend class CColorOverrideInstruction; friend class CColorOverrideInstruction;
friend class CFontInstruction; friend class CFontInstruction;
friend class CLineExtraSpaceInstruction; friend class CLineExtraSpaceInstruction;
friend class CTextInstruction;
protected: protected:
CDrawStringOptions x0_drawStrOpts; CDrawStringOptions x0_drawStrOpts;
TToken<CRasterFont> x14_token; TToken<CRasterFont> x14_font;
std::vector<CTextColor> x20_; std::vector<CTextColor> x20_;
std::vector<bool> x30_; std::vector<bool> x30_;
float x40_lineSpacing = 1.f; float x40_lineSpacing = 1.f;

View File

@ -6,6 +6,7 @@
#include "CRasterFont.hpp" #include "CRasterFont.hpp"
#include "CWordBreakTables.hpp" #include "CWordBreakTables.hpp"
#include "Graphics/CGraphicsPalette.hpp" #include "Graphics/CGraphicsPalette.hpp"
#include "Graphics/CTexture.hpp"
namespace urde namespace urde
{ {
@ -69,7 +70,7 @@ void CTextExecuteBuffer::AddString(const wchar_t* str, int count)
StartNewWord(); StartNewWord();
int w, h; int w, h;
wchar_t space = L' '; wchar_t space = L' ';
x18_textState.x14_token.GetObj()->GetSize(x18_textState.x0_drawStrOpts, x18_textState.x14_font.GetObj()->GetSize(x18_textState.x0_drawStrOpts,
w, h, &space, 1); w, h, &space, 1);
if (x6c_curBlock->x14_direction == ETextDirection::Horizontal) if (x6c_curBlock->x14_direction == ETextDirection::Horizontal)
{ {
@ -98,24 +99,24 @@ void CTextExecuteBuffer::AddStringFragment(const wchar_t* str, int len)
int CTextExecuteBuffer::WrapOneLTR(const wchar_t* str, int len) int CTextExecuteBuffer::WrapOneLTR(const wchar_t* str, int len)
{ {
if (!x18_textState.x14_token) if (!x18_textState.x14_font)
return len; return len;
CRasterFont* font = x18_textState.x14_token.GetObj(); CRasterFont* font = x18_textState.x14_font.GetObj();
int rem = len; int rem = len;
int w, h; int w, h;
x18_textState.x14_token.GetObj()->GetSize(x18_textState.x0_drawStrOpts, x18_textState.x14_font.GetObj()->GetSize(x18_textState.x0_drawStrOpts,
w, h, str, len); w, h, str, len);
if (x18_textState.x48_) if (x18_textState.x48_)
{ {
if (w + x70_curLine->x8_curX > x6c_curBlock->xc_ && if (w + x70_curLine->x8_curX > x6c_curBlock->xc_blockPaddingX &&
x70_curLine->x4_ > 1 && x70_curLine->x4_ > 1 &&
x7c_curX + w < x6c_curBlock->xc_) x7c_curX + w < x6c_curBlock->xc_blockPaddingX)
{ {
MoveWordLTR(); MoveWordLTR();
} }
if (w + x70_curLine->x8_curX > x6c_curBlock->xc_ && len > 1) if (w + x70_curLine->x8_curX > x6c_curBlock->xc_blockPaddingX && len > 1)
{ {
const wchar_t* strEnd = str + len; const wchar_t* strEnd = str + len;
int aRank = 5; int aRank = 5;
@ -136,11 +137,11 @@ int CTextExecuteBuffer::WrapOneLTR(const wchar_t* str, int len)
} }
else else
{ {
x18_textState.x14_token.GetObj()->GetSize(x18_textState.x0_drawStrOpts, x18_textState.x14_font.GetObj()->GetSize(x18_textState.x0_drawStrOpts,
w, h, str, rem); w, h, str, rem);
} }
} while (w + x70_curLine->x8_curX > x6c_curBlock->xc_ && rem > 1); } while (w + x70_curLine->x8_curX > x6c_curBlock->xc_blockPaddingX && rem > 1);
} }
} }
@ -151,7 +152,7 @@ int CTextExecuteBuffer::WrapOneLTR(const wchar_t* str, int len)
font->GetBaseline()); font->GetBaseline());
x70_curLine->x8_curX += w; x70_curLine->x8_curX += w;
x6c_curBlock->x2c_ = std::max(x6c_curBlock->x2c_, x70_curLine->x8_curX); x6c_curBlock->x2c_lineX = std::max(x6c_curBlock->x2c_lineX, x70_curLine->x8_curX);
x7c_curX += w; x7c_curX += w;
x0_instList.emplace(x0_instList.cend(), new CTextInstruction(str, rem)); x0_instList.emplace(x0_instList.cend(), new CTextInstruction(str, rem));
@ -208,7 +209,7 @@ void CTextExecuteBuffer::TerminateLine()
void CTextExecuteBuffer::TerminateLineLTR() void CTextExecuteBuffer::TerminateLineLTR()
{ {
if (!x70_curLine->xc_curY && x18_textState.x14_token) if (!x70_curLine->xc_curY && x18_textState.x14_font)
{ {
x70_curLine->xc_curY = x70_curLine->x10_largestMonoHeight; x70_curLine->xc_curY = x70_curLine->x10_largestMonoHeight;
} }
@ -298,17 +299,47 @@ void CTextExecuteBuffer::AddImage(const CFontImageDef& image)
if (x6c_curBlock) if (x6c_curBlock)
{ {
/* TODO: Finish */ const CTexture* tex = image.x4_texs[0].GetObj();
int width = tex->GetWidth() * image.x14_pointsPerTexel.x;
int height = tex->GetHeight() * image.x14_pointsPerTexel.y;
x70_curLine->TestLargestFont(width, height, height);
if (x6c_curBlock->x14_direction == ETextDirection::Horizontal)
if (x70_curLine->x8_curX > width)
x6c_curBlock->x2c_lineX = x70_curLine->x8_curX;
} }
x0_instList.emplace(x0_instList.cend(), new CImageInstruction(image));
} }
void CTextExecuteBuffer::EndBlock() void CTextExecuteBuffer::EndBlock()
{ {
if (x70_curLine)
TerminateLine();
x70_curLine = nullptr;
x6c_curBlock = nullptr;
} }
void CTextExecuteBuffer::BeginBlock(int,int,int,int, void CTextExecuteBuffer::BeginBlock(s32 offX, s32 offY, s32 padX, s32 padY,
ETextDirection,EJustification,EVerticalJustification) ETextDirection dir, EJustification just,
EVerticalJustification vjust)
{ {
x0_instList.emplace(x0_instList.cend(),
new CBlockInstruction(offX, offY, padX, padY, dir, just, vjust));
if (x18_textState.x14_font)
{
CRasterFont* font = x18_textState.x14_font.GetObj();
s32 baseline = font->GetBaseline();
s32 monoH = font->GetMonoHeight();
s32 monoW = font->GetMonoWidth();
static_cast<CBlockInstruction&>(*x0_instList.back()).
TestLargestFont(monoW, monoH, baseline);
}
x18_textState.x0_drawStrOpts.x0_direction = dir;
x18_textState.x4c_just = just;
x18_textState.x50_vjust = vjust;
} }
void CTextExecuteBuffer::Clear() void CTextExecuteBuffer::Clear()

View File

@ -36,9 +36,9 @@ public:
CTextRenderBuffer CreateTextRenderBuffer() const; CTextRenderBuffer CreateTextRenderBuffer() const;
std::vector<CToken> GetAssets() const; std::vector<CToken> GetAssets() const;
void AddString(const wchar_t* str, int); void AddString(const wchar_t* str, int len);
void AddStringFragment(const wchar_t* str, int); void AddStringFragment(const wchar_t* str, int len);
int WrapOneLTR(const wchar_t* str, int); int WrapOneLTR(const wchar_t* str, int len);
void MoveWordLTR(); void MoveWordLTR();
void StartNewLine(); void StartNewLine();
void StartNewWord(); void StartNewWord();
@ -46,16 +46,18 @@ public:
void TerminateLineLTR(); void TerminateLineLTR();
void AddPopState(); void AddPopState();
void AddPushState(); void AddPushState();
void AddVerticalJustification(EVerticalJustification); void AddVerticalJustification(EVerticalJustification vjust);
void AddJustification(EJustification); void AddJustification(EJustification just);
void AddLineExtraSpace(s32 space); void AddLineExtraSpace(s32 space);
void AddLineSpacing(float); void AddLineSpacing(float spacing);
void AddRemoveColorOverride(int); void AddRemoveColorOverride(int idx);
void AddColorOverride(int, const CTextColor& color); void AddColorOverride(int idx, const CTextColor& color);
void AddColor(EColorType, const CTextColor& color); void AddColor(EColorType, const CTextColor& color);
void AddImage(const CFontImageDef& image); void AddImage(const CFontImageDef& image);
void EndBlock(); void EndBlock();
void BeginBlock(int,int,int,int,ETextDirection,EJustification,EVerticalJustification); void BeginBlock(s32 offX, s32 offY, s32 padX, s32 padY,
ETextDirection dir, EJustification just,
EVerticalJustification vjust);
void Clear(); void Clear();
}; };