CGuiTextPane imps

This commit is contained in:
Jack Andersen 2016-03-21 16:27:46 -10:00
parent 9f82900cdc
commit 5108456dc9
12 changed files with 188 additions and 69 deletions

View File

@ -241,9 +241,9 @@ void FRME::Widget::TXPNInfo::read(athena::io::IStreamReader& __dna_reader)
/* font */ /* font */
font.read(__dna_reader); font.read(__dna_reader);
/* unk1 */ /* unk1 */
unk1 = __dna_reader.readBool(); wordWrap = __dna_reader.readBool();
/* unk2 */ /* unk2 */
unk2 = __dna_reader.readBool(); vertical = __dna_reader.readBool();
/* justification */ /* justification */
justification = Justification(__dna_reader.readUint32Big()); justification = Justification(__dna_reader.readUint32Big());
/* verticalJustification */ /* verticalJustification */
@ -253,7 +253,7 @@ void FRME::Widget::TXPNInfo::read(athena::io::IStreamReader& __dna_reader)
/* outlineColor */ /* outlineColor */
outlineColor = __dna_reader.readVec4fBig(); outlineColor = __dna_reader.readVec4fBig();
/* pointScale */ /* pointScale */
pointScale = __dna_reader.readVec2fBig(); blockExtent = __dna_reader.readVec2fBig();
if (version == 1) if (version == 1)
{ {
/* jpnFont */ /* jpnFont */
@ -277,9 +277,9 @@ void FRME::Widget::TXPNInfo::write(athena::io::IStreamWriter& __dna_writer) cons
/* font */ /* font */
font.write(__dna_writer); font.write(__dna_writer);
/* unk1 */ /* unk1 */
__dna_writer.writeBool(unk1); __dna_writer.writeBool(wordWrap);
/* unk2 */ /* unk2 */
__dna_writer.writeBool(unk2); __dna_writer.writeBool(vertical);
/* justification */ /* justification */
__dna_writer.writeUint32Big(atUint32(justification)); __dna_writer.writeUint32Big(atUint32(justification));
/* verticalJustification */ /* verticalJustification */
@ -289,7 +289,7 @@ void FRME::Widget::TXPNInfo::write(athena::io::IStreamWriter& __dna_writer) cons
/* outlineColor */ /* outlineColor */
__dna_writer.writeVec4fBig(outlineColor); __dna_writer.writeVec4fBig(outlineColor);
/* pointScale */ /* pointScale */
__dna_writer.writeVec2fBig(pointScale); __dna_writer.writeVec2fBig(blockExtent);
if (version == 1) if (version == 1)
{ {
/* jpnFont */ /* jpnFont */

View File

@ -194,10 +194,30 @@ struct FRME : BigDNA
{ {
enum class Justification : atUint32 enum class Justification : atUint32
{ {
Left = 0,
Center,
Right,
Full,
NLeft,
NCenter,
NRight,
Seven,
Eight,
Nine
}; };
enum class VerticalJustification : atUint32 enum class VerticalJustification : atUint32
{ {
Top = 0,
Center,
Bottom,
Full,
NTop,
NCenter,
NBottom,
Seven,
Eight,
Nine
}; };
DECL_EXPLICIT_DNA DECL_EXPLICIT_DNA
@ -210,13 +230,13 @@ struct FRME : BigDNA
Value<float> zDim; Value<float> zDim;
Value<atVec3f> scaleCenter; Value<atVec3f> scaleCenter;
UniqueID32 font; UniqueID32 font;
Value<bool> unk1; Value<bool> wordWrap;
Value<bool> unk2; Value<bool> vertical;
Value<Justification> justification; Value<Justification> justification;
Value<VerticalJustification> verticalJustification; Value<VerticalJustification> verticalJustification;
Value<atVec4f> fillColor; Value<atVec4f> fillColor;
Value<atVec4f> outlineColor; Value<atVec4f> outlineColor;
Value<atVec2f> pointScale; Value<atVec2f> blockExtent; /* In points; converted to int by loader */
/* The following is only found in V1 */ /* The following is only found in V1 */
UniqueID32 jpnFont; UniqueID32 jpnFont;
Value<atInt32> jpnPointScale[2]; Value<atInt32> jpnPointScale[2];

View File

@ -88,7 +88,7 @@ void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) const
CModelFlags flags; CModelFlags flags;
flags.f1 = 4; flags.f1 = 4;
flags.f2 = 0; flags.f2 = 0;
flags.f3 = (xf7_24_ << 1) | xf6_31_; flags.f3 = (xf7_24_depthWrite << 1) | xf6_31_depthTest;
flags.color = moduCol; flags.color = moduCol;
model->Draw(flags); model->Draw(flags);
break; break;
@ -98,7 +98,7 @@ void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) const
CModelFlags flags; CModelFlags flags;
flags.f1 = 3; flags.f1 = 3;
flags.f2 = 0; flags.f2 = 0;
flags.f3 = (xf7_24_ << 1) | xf6_31_; flags.f3 = (xf7_24_depthWrite << 1) | xf6_31_depthTest;
flags.color = moduCol; flags.color = moduCol;
model->Draw(flags); model->Draw(flags);
break; break;
@ -108,13 +108,13 @@ void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) const
CModelFlags flags; CModelFlags flags;
flags.f1 = 4; flags.f1 = 4;
flags.f2 = 0; flags.f2 = 0;
flags.f3 = xf6_31_; flags.f3 = xf6_31_depthTest;
flags.color = moduCol; flags.color = moduCol;
model->Draw(flags); model->Draw(flags);
flags.f1 = 5; flags.f1 = 5;
flags.f2 = 0; flags.f2 = 0;
flags.f3 = (xf7_24_ << 1) | xf6_31_; flags.f3 = (xf7_24_depthWrite << 1) | xf6_31_depthTest;
flags.color = moduCol; flags.color = moduCol;
model->Draw(flags); model->Draw(flags);
break; break;

View File

@ -1,38 +1,124 @@
#include "CGuiTextPane.hpp" #include "CGuiTextPane.hpp"
#include "CGuiAnimController.hpp" #include "CGuiAnimController.hpp"
#include "CGuiLogicalEventTrigger.hpp" #include "CGuiLogicalEventTrigger.hpp"
#include "CFontImageDef.hpp"
#include "CGuiFrame.hpp"
#include "CGuiSys.hpp"
#include "CGuiWidgetDrawParms.hpp"
#include "Graphics/CGraphics.hpp"
#include "Graphics/CGraphicsPalette.hpp"
namespace urde namespace urde
{ {
CGuiTextPane::CGuiTextPane(const CGuiWidgetParms& parms, float a, float b, CGuiTextPane::CGuiTextPane(const CGuiWidgetParms& parms, float xDim, float zDim,
const zeus::CVector3f& vec, u32 c, const CGuiTextProperties& props, const zeus::CVector3f& vec, TResId fontId, const CGuiTextProperties& props,
const zeus::CColor& col1, const zeus::CColor& col2, const zeus::CColor& fontCol, const zeus::CColor& outlineCol,
int, int) s32 extentX, s32 extentY)
: CGuiPane(parms, a, b, vec) : CGuiPane(parms, xDim, zDim, vec), x114_textSupport(fontId, props, fontCol, outlineCol,
zeus::CColor::skWhite, extentX, extentY,
&parms.x0_frame->GetGuiSys().GetResStore()) {}
void CGuiTextPane::Update(float dt)
{ {
CGuiWidget::Update(dt);
x114_textSupport.Update(dt);
}
bool CGuiTextPane::GetIsFinishedLoadingWidgetSpecific() const
{
return x114_textSupport.GetIsTextSupportFinishedLoading();
}
void CGuiTextPane::SetDimensions(const zeus::CVector2f& dim, bool initVBO)
{
CGuiPane::SetDimensions(dim, initVBO);
if (initVBO)
InitializeBuffers();
}
void CGuiTextPane::ScaleDimensions(const zeus::CVector3f& scale)
{
}
void CGuiTextPane::Draw(const CGuiWidgetDrawParms& parms) const
{
if (!GetIsVisible())
return;
zeus::CVector2f dims = GetDimensions();
if (x114_textSupport.x28_extentX)
dims.x /= float(x114_textSupport.x28_extentX);
else
dims.x = 0.f;
if (x114_textSupport.x2c_extentY)
dims.y /= float(x114_textSupport.x2c_extentY);
else
dims.y = 0.f;
zeus::CTransform local = zeus::CTransform::Translate(x100_verts.front().m_pos + x108_scaleCenter) *
zeus::CTransform::Scale(dims.x, 1.f, dims.y);
CGraphics::SetModelMatrix(x34_worldXF * local);
zeus::CColor geomCol = xb4_;
geomCol.a *= parms.x0_alphaMod;
((CGuiTextPane*)this)->x114_textSupport.SetGeometryColor(geomCol);
CGraphics::SetDepthWriteMode(xf6_31_depthTest, ERglEnum::LEqual, xf7_24_depthWrite);
switch (xc4_drawFlags)
{
case EGuiModelDrawFlags::Shadeless:
case EGuiModelDrawFlags::Opaque:
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::One,
ERglBlendFactor::Zero, ERglLogicOp::Clear);
x114_textSupport.Render();
break;
case EGuiModelDrawFlags::Alpha:
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::SrcAlpha,
ERglBlendFactor::InvSrcAlpha, ERglLogicOp::Clear);
x114_textSupport.Render();
break;
case EGuiModelDrawFlags::Additive:
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::SrcAlpha,
ERglBlendFactor::One, ERglLogicOp::Clear);
x114_textSupport.Render();
break;
case EGuiModelDrawFlags::AlphaAdditiveOverdraw:
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::SrcAlpha,
ERglBlendFactor::InvSrcAlpha, ERglLogicOp::Clear);
x114_textSupport.Render();
((CGuiTextPane*)this)->x114_textSupport.SetGeometryColor
(geomCol * zeus::CColor(geomCol.a, geomCol.a, geomCol.a, 1.f));
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::One,
ERglBlendFactor::One, ERglLogicOp::Clear);
x114_textSupport.Render();
break;
}
} }
CGuiTextPane* CGuiTextPane::Create(CGuiFrame* frame, CInputStream& in, bool flag) CGuiTextPane* CGuiTextPane::Create(CGuiFrame* frame, CInputStream& in, bool flag)
{ {
CGuiWidgetParms parms = ReadWidgetHeader(frame, in, flag); CGuiWidgetParms parms = ReadWidgetHeader(frame, in, flag);
float a = in.readFloatBig(); float xDim = in.readFloatBig();
float b = in.readFloatBig(); float zDim = in.readFloatBig();
zeus::CVector3f vec; zeus::CVector3f vec;
vec.readBig(in); vec.readBig(in);
u32 c = in.readUint32Big(); u32 fontId = in.readUint32Big();
bool d = in.readBool(); bool wordWrap = in.readBool();
bool e = in.readBool(); bool vertical = in.readBool();
EJustification justification = EJustification(in.readUint32Big()); EJustification justification = EJustification(in.readUint32Big());
EVerticalJustification vJustification = EVerticalJustification(in.readUint32Big()); EVerticalJustification vJustification = EVerticalJustification(in.readUint32Big());
CGuiTextProperties props(d, e, false, justification, vJustification); CGuiTextProperties props(wordWrap, vertical, false, justification, vJustification);
zeus::CColor col1; zeus::CColor fontCol;
col1.readRGBABig(in); fontCol.readRGBABig(in);
zeus::CColor col2; zeus::CColor outlineCol;
col2.readRGBABig(in); outlineCol.readRGBABig(in);
int f = in.readFloatBig(); int extentX = in.readFloatBig();
int g = in.readFloatBig(); int extentY = in.readFloatBig();
return new CGuiTextPane(parms, a, b, vec, c, props, col1, col2, f, g); return new CGuiTextPane(parms, xDim, zDim, vec, fontId, props, fontCol, outlineCol, extentX, extentY);
} }
} }

View File

@ -9,10 +9,22 @@ namespace urde
class CGuiTextPane : public CGuiPane class CGuiTextPane : public CGuiPane
{ {
CGuiTextSupport x114_textSupport;
public: public:
CGuiTextPane(const CGuiWidgetParms& parms, float a, float b, const zeus::CVector3f& vec, CGuiTextPane(const CGuiWidgetParms& parms, float xDim, float zDim, const zeus::CVector3f& vec,
u32, const CGuiTextProperties& props, const zeus::CColor& col1, const zeus::CColor& col2, TResId fontId, const CGuiTextProperties& props, const zeus::CColor& col1,
int, int); const zeus::CColor& col2, s32 padX, s32 padY);
FourCC GetWidgetTypeID() const {return FOURCC('TXPN');}
CGuiTextSupport* TextSupport() {return &x114_textSupport;}
const CGuiTextSupport* GetTextSupport() const {return &x114_textSupport;}
void Update(float dt);
bool GetIsFinishedLoadingWidgetSpecific() const;
std::vector<TResId> GetFontAssets() const {return {x114_textSupport.x50_fontId};}
void SetDimensions(const zeus::CVector2f& dim, bool initVBO);
void ScaleDimensions(const zeus::CVector3f& scale);
void Draw(const CGuiWidgetDrawParms& parms) const;
static CGuiTextPane* Create(CGuiFrame* frame, CInputStream& in, bool); static CGuiTextPane* Create(CGuiFrame* frame, CInputStream& in, bool);
}; };

View File

@ -11,10 +11,10 @@ namespace urde
{ {
CGuiTextSupport::CGuiTextSupport(TResId fontId, const CGuiTextProperties& props, CGuiTextSupport::CGuiTextSupport(TResId fontId, const CGuiTextProperties& props,
const zeus::CColor& col1, const zeus::CColor& col2, const zeus::CColor& fontCol, const zeus::CColor& outlineCol,
const zeus::CColor& col3, s32 padX, s32 padY, CSimplePool* store) const zeus::CColor& geomCol, s32 padX, s32 padY, CSimplePool* store)
: x10_props(props), x1c_fontColor(col1), x20_outlineColor(col2), : x10_props(props), x1c_fontColor(fontCol), x20_outlineColor(outlineCol),
x24_geometryColor(col3), x28_padX(padX), x2c_padY(padY) x24_geometryColor(geomCol), x28_extentX(padX), x2c_extentY(padY)
{ {
x2c0_font = store->GetObj({SBIG('FONT'), fontId}); x2c0_font = store->GetObj({SBIG('FONT'), fontId});
} }
@ -100,7 +100,7 @@ void CGuiTextSupport::CheckAndRebuildTextRenderBuffer()
g_TextExecuteBuf->Clear(); g_TextExecuteBuf->Clear();
g_TextExecuteBuf->x18_textState.x48_enableWordWrap = x10_props.x0_wordWrap; g_TextExecuteBuf->x18_textState.x48_enableWordWrap = x10_props.x0_wordWrap;
g_TextExecuteBuf->BeginBlock(0, 0, x28_padX, x2c_padY, ETextDirection(x10_props.x1_vertical), g_TextExecuteBuf->BeginBlock(0, 0, x28_extentX, x2c_extentY, ETextDirection(x10_props.x1_vertical),
x10_props.x4_justification, x10_props.x8_vertJustification); x10_props.x4_justification, x10_props.x8_vertJustification);
g_TextExecuteBuf->AddColor(EColorType::Main, x1c_fontColor); g_TextExecuteBuf->AddColor(EColorType::Main, x1c_fontColor);
g_TextExecuteBuf->AddColor(EColorType::Outline, x20_outlineColor); g_TextExecuteBuf->AddColor(EColorType::Outline, x20_outlineColor);

View File

@ -66,21 +66,22 @@ class CGuiTextProperties
EJustification x4_justification; EJustification x4_justification;
EVerticalJustification x8_vertJustification; EVerticalJustification x8_vertJustification;
public: public:
CGuiTextProperties(bool a, bool b, bool c, EJustification justification, CGuiTextProperties(bool wordWrap, bool vertical, bool c, EJustification justification,
EVerticalJustification vertJustification) EVerticalJustification vertJustification)
: x0_wordWrap(a), x1_vertical(b), x2_c(c), x4_justification(justification), : x0_wordWrap(wordWrap), x1_vertical(vertical), x2_c(c), x4_justification(justification),
x8_vertJustification(vertJustification) {} x8_vertJustification(vertJustification) {}
}; };
class CGuiTextSupport class CGuiTextSupport
{ {
friend class CGuiTextPane;
std::wstring x0_string; std::wstring x0_string;
CGuiTextProperties x10_props; CGuiTextProperties x10_props;
zeus::CColor x1c_fontColor; zeus::CColor x1c_fontColor;
zeus::CColor x20_outlineColor; zeus::CColor x20_outlineColor;
zeus::CColor x24_geometryColor; zeus::CColor x24_geometryColor;
s32 x28_padX; s32 x28_extentX;
s32 x2c_padY; s32 x2c_extentY;
float x30_curTime = 0.f; float x30_curTime = 0.f;
std::vector<std::pair<float, int>> x34_primStartTimes; std::vector<std::pair<float, int>> x34_primStartTimes;
bool x44_typeEnable = false; bool x44_typeEnable = false;
@ -93,8 +94,8 @@ class CGuiTextSupport
TLockedToken<CRasterFont> x2c0_font; TLockedToken<CRasterFont> x2c0_font;
public: public:
CGuiTextSupport(TResId fontId, const CGuiTextProperties& props, CGuiTextSupport(TResId fontId, const CGuiTextProperties& props,
const zeus::CColor& col1, const zeus::CColor& col2, const zeus::CColor& fontCol, const zeus::CColor& outlineCol,
const zeus::CColor& col3, s32 padX, s32 padY, CSimplePool* store); const zeus::CColor& geomCol, s32 extX, s32 extY, CSimplePool* store);
float GetCurrentAnimationOverAge() const; float GetCurrentAnimationOverAge() const;
float GetNumCharsPrinted() const; float GetNumCharsPrinted() const;
float GetTotalAnimationTime() const; float GetTotalAnimationTime() const;

View File

@ -29,7 +29,7 @@ CGuiWidget::CGuiWidget(const CGuiWidgetParms& parms)
xf6_26_isActive(parms.xb_defaultActive), xf6_26_isActive(parms.xb_defaultActive),
xf6_27_(true), xf6_28_eventLock(false), xf6_27_(true), xf6_28_eventLock(false),
xf6_29_cullFaces(parms.xc_cullFaces), xf6_30_(false), xf6_29_cullFaces(parms.xc_cullFaces), xf6_30_(false),
xf6_31_(true), xf7_24_(false), xf7_25_(true) xf6_31_depthTest(true), xf7_24_depthWrite(false), xf7_25_(true)
{ {
if (parms.x4_useAnimController) if (parms.x4_useAnimController)
EnsureHasAnimController(); EnsureHasAnimController();
@ -143,7 +143,7 @@ CGuiTextSupport* CGuiWidget::TextSupport()
return nullptr; return nullptr;
} }
CGuiTextSupport* CGuiWidget::GetTextSupport() const const CGuiTextSupport* CGuiWidget::GetTextSupport() const
{ {
return nullptr; return nullptr;
} }

View File

@ -111,8 +111,8 @@ protected:
bool xf6_28_eventLock : 1; bool xf6_28_eventLock : 1;
bool xf6_29_cullFaces : 1; bool xf6_29_cullFaces : 1;
bool xf6_30_ : 1; bool xf6_30_ : 1;
bool xf6_31_ : 1; bool xf6_31_depthTest : 1;
bool xf7_24_ : 1; bool xf7_24_depthWrite : 1;
bool xf7_25_ : 1; bool xf7_25_ : 1;
public: public:
@ -133,7 +133,7 @@ public:
virtual bool GetIsVisible() const; virtual bool GetIsVisible() const;
virtual bool GetIsActive() const; virtual bool GetIsActive() const;
virtual CGuiTextSupport* TextSupport(); virtual CGuiTextSupport* TextSupport();
virtual CGuiTextSupport* GetTextSupport() const; virtual const CGuiTextSupport* GetTextSupport() const;
virtual void ModifyRGBA(CGuiWidget* widget); virtual void ModifyRGBA(CGuiWidget* widget);
virtual void AddAnim(EGuiAnimBehListID, CGuiAnimBase*); virtual void AddAnim(EGuiAnimBehListID, CGuiAnimBase*);
virtual void AddChildWidget(CGuiWidget* widget, bool makeWorldLocal, bool atEnd); virtual void AddChildWidget(CGuiWidget* widget, bool makeWorldLocal, bool atEnd);

View File

@ -78,29 +78,29 @@ void CLineInstruction::InvokeLTR(CFontRenderState& state) const
case EJustification::Center: case EJustification::Center:
case EJustification::Eight: case EJustification::Eight:
state.x6c_curX = state.x54_curBlock->x4_offsetX + state.x6c_curX = state.x54_curBlock->x4_offsetX +
state.x54_curBlock->xc_blockPaddingX / 2 - x8_curX / 2; state.x54_curBlock->xc_blockExtentX / 2 - x8_curX / 2;
break; break;
case EJustification::NCenter: case EJustification::NCenter:
if (x4_wordCount == 1) if (x4_wordCount == 1)
{ {
state.x6c_curX = state.x54_curBlock->x4_offsetX + state.x6c_curX = state.x54_curBlock->x4_offsetX +
state.x54_curBlock->xc_blockPaddingX / 2 - x8_curX / 2; state.x54_curBlock->xc_blockExtentX / 2 - x8_curX / 2;
} }
else else
{ {
state.x6c_curX = state.x54_curBlock->x4_offsetX + state.x6c_curX = state.x54_curBlock->x4_offsetX +
state.x54_curBlock->xc_blockPaddingX / 2 - state.x54_curBlock->xc_blockExtentX / 2 -
state.x54_curBlock->x2c_lineX / 2; state.x54_curBlock->x2c_lineX / 2;
} }
break; break;
case EJustification::Right: case EJustification::Right:
case EJustification::Nine: case EJustification::Nine:
state.x6c_curX = state.x54_curBlock->x4_offsetX + state.x6c_curX = state.x54_curBlock->x4_offsetX +
state.x54_curBlock->xc_blockPaddingX - x8_curX; state.x54_curBlock->xc_blockExtentX - x8_curX;
break; break;
case EJustification::NRight: case EJustification::NRight:
state.x6c_curX = state.x54_curBlock->x4_offsetX + state.x6c_curX = state.x54_curBlock->x4_offsetX +
state.x54_curBlock->xc_blockPaddingX - state.x54_curBlock->xc_blockExtentX -
state.x54_curBlock->x2c_lineX; state.x54_curBlock->x2c_lineX;
break; break;
default: break; default: break;
@ -121,7 +121,7 @@ void CLineInstruction::InvokeLTR(CFontRenderState& state) const
val = inst.xc_curY; val = inst.xc_curY;
break; break;
case EVerticalJustification::Full: case EVerticalJustification::Full:
val = state.x54_curBlock->x10_blockPaddingY - state.x54_curBlock->x30_lineY; val = state.x54_curBlock->x10_blockExtentY - state.x54_curBlock->x30_lineY;
if (state.x54_curBlock->x34_lineCount > 1) if (state.x54_curBlock->x34_lineCount > 1)
val /= state.x54_curBlock->x34_lineCount - 1; val /= state.x54_curBlock->x34_lineCount - 1;
else else
@ -229,17 +229,17 @@ void CBlockInstruction::SetupPositionLTR(CFontRenderState& state) const
break; break;
case EVerticalJustification::Center: case EVerticalJustification::Center:
case EVerticalJustification::NCenter: case EVerticalJustification::NCenter:
state.x70_curY = x8_offsetY + (x10_blockPaddingY - x30_lineY) / 2; state.x70_curY = x8_offsetY + (x10_blockExtentY - x30_lineY) / 2;
break; break;
case EVerticalJustification::Eight: case EVerticalJustification::Eight:
state.x70_curY = x8_offsetY + (x10_blockPaddingY - x34_lineCount * x24_largestMonoH) / 2; state.x70_curY = x8_offsetY + (x10_blockExtentY - x34_lineCount * x24_largestMonoH) / 2;
break; break;
case EVerticalJustification::Bottom: case EVerticalJustification::Bottom:
case EVerticalJustification::NBottom: case EVerticalJustification::NBottom:
state.x70_curY = x8_offsetY + x10_blockPaddingY - x30_lineY; state.x70_curY = x8_offsetY + x10_blockExtentY - x30_lineY;
break; break;
case EVerticalJustification::Nine: case EVerticalJustification::Nine:
state.x70_curY = x8_offsetY + x10_blockPaddingY - x34_lineCount * x24_largestMonoH; state.x70_curY = x8_offsetY + x10_blockExtentY - x34_lineCount * x24_largestMonoH;
break; break;
} }
} }
@ -263,7 +263,7 @@ void CWordInstruction::InvokeLTR(CFontRenderState& state) const
switch (state.x54_curBlock->x18_justification) switch (state.x54_curBlock->x18_justification)
{ {
case EJustification::Full: case EJustification::Full:
w += (state.x54_curBlock->xc_blockPaddingX - inst.x8_curX) / (inst.x4_wordCount - 1); w += (state.x54_curBlock->xc_blockExtentX - inst.x8_curX) / (inst.x4_wordCount - 1);
break; break;
case EJustification::NLeft: case EJustification::NLeft:
case EJustification::NCenter: case EJustification::NCenter:

View File

@ -135,8 +135,8 @@ class CBlockInstruction : public CInstruction
s32 x4_offsetX; s32 x4_offsetX;
s32 x8_offsetY; s32 x8_offsetY;
s32 xc_blockPaddingX; s32 xc_blockExtentX;
s32 x10_blockPaddingY; s32 x10_blockExtentY;
ETextDirection x14_direction; ETextDirection x14_direction;
EJustification x18_justification; EJustification x18_justification;
EVerticalJustification x1c_vertJustification; EVerticalJustification x1c_vertJustification;
@ -147,10 +147,10 @@ class CBlockInstruction : public CInstruction
s32 x30_lineY = 0; s32 x30_lineY = 0;
s32 x34_lineCount = 0; s32 x34_lineCount = 0;
public: public:
CBlockInstruction(s32 offX, s32 offY, s32 padX, s32 padY, ETextDirection dir, CBlockInstruction(s32 offX, s32 offY, s32 extX, s32 extY, ETextDirection dir,
EJustification just, EVerticalJustification vjust) EJustification just, EVerticalJustification vjust)
: x4_offsetX(offX), x8_offsetY(offY), : x4_offsetX(offX), x8_offsetY(offY),
xc_blockPaddingX(padX), x10_blockPaddingY(padY), x14_direction(dir), xc_blockExtentX(extX), x10_blockExtentY(extY), x14_direction(dir),
x18_justification(just), x1c_vertJustification(vjust) {} x18_justification(just), x1c_vertJustification(vjust) {}
void TestLargestFont(s32 monoW, s32 monoH, s32 baseline); void TestLargestFont(s32 monoW, s32 monoH, s32 baseline);
void SetupPositionLTR(CFontRenderState& state) const; void SetupPositionLTR(CFontRenderState& state) const;

View File

@ -110,13 +110,13 @@ int CTextExecuteBuffer::WrapOneLTR(const wchar_t* str, int len)
if (x18_textState.x48_enableWordWrap) if (x18_textState.x48_enableWordWrap)
{ {
if (w + x70_curLine->x8_curX > x6c_curBlock->xc_blockPaddingX && if (w + x70_curLine->x8_curX > x6c_curBlock->xc_blockExtentX &&
x70_curLine->x4_wordCount > 1 && x70_curLine->x4_wordCount > 1 &&
x7c_curX + w < x6c_curBlock->xc_blockPaddingX) x7c_curX + w < x6c_curBlock->xc_blockExtentX)
{ {
MoveWordLTR(); MoveWordLTR();
} }
if (w + x70_curLine->x8_curX > x6c_curBlock->xc_blockPaddingX && len > 1) if (w + x70_curLine->x8_curX > x6c_curBlock->xc_blockExtentX && len > 1)
{ {
const wchar_t* strEnd = str + len; const wchar_t* strEnd = str + len;
int aRank = 5; int aRank = 5;
@ -141,7 +141,7 @@ int CTextExecuteBuffer::WrapOneLTR(const wchar_t* str, int len)
w, h, str, rem); w, h, str, rem);
} }
} while (w + x70_curLine->x8_curX > x6c_curBlock->xc_blockPaddingX && rem > 1); } while (w + x70_curLine->x8_curX > x6c_curBlock->xc_blockExtentX && rem > 1);
} }
} }