CFrontEndUI work

This commit is contained in:
Jack Andersen 2016-12-16 13:05:29 -10:00
parent f665812d6e
commit a2b07ba357
21 changed files with 572 additions and 300 deletions

View File

@ -394,7 +394,8 @@ bool FRME::Extract(const SpecBase &dataSpec,
if (info->projectionType == CAMRInfo::ProjectionType::Orthographic)
{
CAMRInfo::OrthographicProjection* proj = static_cast<CAMRInfo::OrthographicProjection*>(info->projection.get());
os.format("cam.type = 'ORTHO'\n");
os.format("cam.type = 'ORTHO'\n"
"cam.ortho_scale = %f\n", std::fabs(proj->right - proj->left));
}
else if (info->projectionType == CAMRInfo::ProjectionType::Perspective)
{

View File

@ -71,7 +71,7 @@ public:
void Decode(s16* bufOut, u32 numSamples);
void SetVolume(float vol)
{
xc0_volume = zeus::clamp(0.f, vol, 1.f) / 32768.f;
xc0_volume = zeus::clamp(0.f, vol, 1.f) * 32768.f;
}
void StartMixing()

View File

@ -19,13 +19,13 @@ CPersistentOptions::CPersistentOptions(CBitStreamReader& stream)
xc0_ = stream.ReadEncoded(2);
xc4_ = stream.ReadEncoded(2);
xc8_ = stream.ReadEncoded(1);
xcc_ = stream.ReadEncoded(7);
xcc_logScanCount = stream.ReadEncoded(7);
xd0_24_ = stream.ReadEncoded(1);
xd0_25_ = stream.ReadEncoded(1);
xd0_26_ = stream.ReadEncoded(1);
xd0_25_hasHardMode = stream.ReadEncoded(1);
xd0_26_hardModeBeat = stream.ReadEncoded(1);
xd0_27_ = stream.ReadEncoded(1);
xd0_28_hasFusion = stream.ReadEncoded(1);
xd0_29_ = stream.ReadEncoded(1);
xd0_29_allItemsCollected = stream.ReadEncoded(1);
xbc_ = stream.ReadEncoded(2);
auto& memWorlds = g_MemoryCardSys->GetMemoryWorlds();

View File

@ -19,18 +19,18 @@ class CPersistentOptions
u32 xc0_ = 0;
u32 xc4_ = 0;
u32 xc8_ = 0;
u32 xcc_ = 0;
u32 xcc_logScanCount = 0;
union
{
struct
{
bool xd0_24_;
bool xd0_25_;
bool xd0_26_;
bool xd0_27_;
bool xd0_28_hasFusion;
bool xd0_29_;
bool xd0_24_ : 1;
bool xd0_25_hasHardMode : 1;
bool xd0_26_hardModeBeat : 1;
bool xd0_27_ : 1;
bool xd0_28_hasFusion : 1;
bool xd0_29_allItemsCollected : 1;
};
u16 _dummy = 0;
};
@ -40,7 +40,11 @@ public:
CPersistentOptions(CBitStreamReader& stream);
void SetCinematicState(ResId mlvlId, TEditorId cineId, bool state);
bool PlayerHasHardMode() const { return xd0_25_hasHardMode; }
bool PlayerBeatHardMode() const { return xd0_26_hardModeBeat; }
bool PlayerHasFusion() const { return xd0_28_hasFusion; }
bool AllItemsCollected() const { return xd0_29_allItemsCollected; }
u32 GetLogScanCount() const { return xcc_logScanCount; }
};
/** Options tracked per game session */
@ -70,11 +74,11 @@ private:
{
struct
{
bool x68_24_;
bool x68_25_;
bool x68_26_;
bool x68_27_;
bool x68_28_;
bool x68_24_ : 1;
bool x68_25_ : 1;
bool x68_26_ : 1;
bool x68_27_ : 1;
bool x68_28_ : 1;
};
u16 _dummy = 0;
};

View File

@ -103,7 +103,7 @@ CGameState::CGameState(CBitStreamReader& stream)
x0_[i] = stream.ReadEncoded(8);
u32 tsSeconds = stream.ReadEncoded(32);
x228_24_ = stream.ReadEncoded(1);
x228_24_hardMode = stream.ReadEncoded(1);
x228_25_deferPowerupInit = stream.ReadEncoded(1);
x84_mlvlId = stream.ReadEncoded(32);
EnsureWorldPakReady(x84_mlvlId);
@ -144,7 +144,7 @@ void CGameState::PutTo(CBitStreamWriter& writer) const
writer.WriteEncoded(x0_[i], 8);
writer.WriteEncoded(CBasics::ToWiiTime(std::chrono::system_clock::now()) / CBasics::TICKS_PER_SECOND, 32);
writer.WriteEncoded(x228_24_, 1);
writer.WriteEncoded(x228_24_hardMode, 1);
writer.WriteEncoded(x228_25_deferPowerupInit, 1);
writer.WriteEncoded(x84_mlvlId, 32);

View File

@ -87,7 +87,7 @@ class CGameState
{
struct
{
bool x228_24_;
bool x228_24_hardMode;
bool x228_25_deferPowerupInit;
};
u8 _dummy = 0;
@ -107,6 +107,7 @@ public:
CWorldState& StateForWorld(ResId mlvlId);
CWorldState& CurrentWorldState() { return StateForWorld(x84_mlvlId); }
ResId CurrentWorldAssetId() const { return x84_mlvlId; }
void SetHardMode(bool v) { x228_24_hardMode = v; }
void PutTo(CBitStreamWriter& writer) const;
};

View File

@ -6,9 +6,9 @@ namespace urde
CFontRenderState::CFontRenderState()
{
x20_[0] = zeus::CColor::skWhite;
x20_[1] = zeus::CColor::skGrey;
x20_[2] = zeus::CColor::skWhite;
x54_[0] = zeus::CColor::skWhite;
x54_[1] = zeus::CColor::skGrey;
x54_[2] = zeus::CColor::skWhite;
RefreshPalette();
}
@ -36,13 +36,13 @@ void CFontRenderState::SetColor(EColorType tp, const CTextColor& col)
case EColorType::Main:
case EColorType::Outline:
case EColorType::Geometry:
x20_[int(tp)] = col;
x54_[int(tp)] = col;
break;
case EColorType::Foreground:
x20_[0] = col;
x54_[0] = col;
break;
case EColorType::Background:
x20_[1] = col;
x54_[1] = col;
break;
}
RefreshColor(tp);
@ -59,32 +59,32 @@ void CFontRenderState::RefreshColor(EColorType tp)
switch (tp)
{
case EColorType::Main:
if (!x14_font)
if (!x48_font)
return;
switch (x14_font.GetObj()->GetMode())
switch (x48_font.GetObj()->GetMode())
{
case EColorType::Main:
if (!x30_colorOverrides[0])
x0_drawStrOpts.x4_colors[0] = ConvertToTextureSpace(x20_[0]);
if (!x64_colorOverrides[0])
x0_drawStrOpts.x4_colors[0] = ConvertToTextureSpace(x54_[0]);
break;
case EColorType::Outline:
if (!x30_colorOverrides[0])
x0_drawStrOpts.x4_colors[0] = ConvertToTextureSpace(x20_[0]);
if (!x64_colorOverrides[0])
x0_drawStrOpts.x4_colors[0] = ConvertToTextureSpace(x54_[0]);
break;
default: break;
}
break;
case EColorType::Outline:
if (!x14_font)
if (!x48_font)
return;
if (x30_colorOverrides[1])
if (x64_colorOverrides[1])
return;
if (x14_font.GetObj()->GetMode() == EColorType::Outline)
x0_drawStrOpts.x4_colors[1] = ConvertToTextureSpace(x20_[1]);
if (x48_font.GetObj()->GetMode() == EColorType::Outline)
x0_drawStrOpts.x4_colors[1] = ConvertToTextureSpace(x54_[1]);
break;
case EColorType::Geometry:
if (!x30_colorOverrides[2])
x0_drawStrOpts.x4_colors[2] = ConvertToTextureSpace(x20_[2]);
if (!x64_colorOverrides[2])
x0_drawStrOpts.x4_colors[2] = ConvertToTextureSpace(x54_[2]);
break;
case EColorType::Foreground:
RefreshColor(EColorType::Main);

View File

@ -29,25 +29,25 @@ private:
int xcc_defaultUserSelection;
bool xd0_selectWraparound;
bool xd1_ = true;
std::function<void(const CGuiTableGroup*)> xd4_doMenuAdvance;
std::function<void(const CGuiTableGroup*)> xec_doMenuCancel;
std::function<void(const CGuiTableGroup*)> x104_doMenuSelChange;
std::function<void(CGuiTableGroup*)> xd4_doMenuAdvance;
std::function<void(CGuiTableGroup*)> xec_doMenuCancel;
std::function<void(CGuiTableGroup*)> x104_doMenuSelChange;
public:
CGuiTableGroup(const CGuiWidgetParms& parms, int, int, bool);
FourCC GetWidgetTypeID() const {return FOURCC('TBGP');}
void SetMenuAdvanceCallback(std::function<void(const CGuiTableGroup*)>&& cb)
void SetMenuAdvanceCallback(std::function<void(CGuiTableGroup*)>&& cb)
{
xd4_doMenuAdvance = std::move(cb);
}
void SetMenuCancelCallback(std::function<void(const CGuiTableGroup*)>&& cb)
void SetMenuCancelCallback(std::function<void(CGuiTableGroup*)>&& cb)
{
xec_doMenuCancel = std::move(cb);
}
void SetMenuSelectionChangeCallback(std::function<void(const CGuiTableGroup*)>&& cb)
void SetMenuSelectionChangeCallback(std::function<void(CGuiTableGroup*)>&& cb)
{
x104_doMenuSelChange = std::move(cb);
}

View File

@ -20,40 +20,62 @@ CGuiTextSupport::CGuiTextSupport(ResId fontId, const CGuiTextProperties& props,
x2cc_font = store->GetObj({SBIG('FONT'), fontId});
}
CTextRenderBuffer* CGuiTextSupport::GetCurrentLineRenderBuffer() const
{
if (x60_renderBuf && !x308_multilineFlag)
return const_cast<CTextRenderBuffer*>(&*x60_renderBuf);
if (!x308_multilineFlag || x300_ <= x304_lineCounter)
return nullptr;
int idx = 0;
for (const CTextRenderBuffer& buf : x2f0_lineRenderBufs)
if (idx++ == x304_lineCounter)
return const_cast<CTextRenderBuffer*>(&buf);
return nullptr;
}
float CGuiTextSupport::GetCurrentAnimationOverAge() const
{
if (!x2ac_active || !x50_typeEnable)
return 0.f;
if (x44_primStartTimes.size())
float ret = 0.f;
if (CTextRenderBuffer* buf = GetCurrentLineRenderBuffer())
{
float val = (x60_renderBuf->GetPrimitiveCount() - x44_primStartTimes.back().second) /
x58_chRate + x44_primStartTimes.back().first;
return std::max(0.f, val);
}
else
{
float val = x60_renderBuf->GetPrimitiveCount() / x58_chRate;
return std::max(0.f, val);
if (x50_typeEnable)
{
if (x40_primStartTimes.size())
{
auto& lastTime = x40_primStartTimes.back();
ret = std::max(ret, (buf->GetPrimitiveCount() - lastTime.second) / x58_chRate + lastTime.first);
}
else
{
ret = std::max(ret, buf->GetPrimitiveCount() / x58_chRate);
}
}
}
return ret;
}
float CGuiTextSupport::GetNumCharsPrinted() const
{
if (x2ac_active)
return std::min(x3c_curTime * x58_chRate, float(x60_renderBuf->GetPrimitiveCount()));
if (CTextRenderBuffer* buf = GetCurrentLineRenderBuffer())
{
if (x50_typeEnable)
{
float charsPrinted = x3c_curTime * x58_chRate;
return std::min(charsPrinted, float(buf->GetPrimitiveCount()));
}
}
return 0.f;
}
float CGuiTextSupport::GetTotalAnimationTime() const
{
if (!x2ac_active || !x50_typeEnable)
return 0.f;
return x60_renderBuf->GetPrimitiveCount() / x58_chRate;
if (CTextRenderBuffer* buf = GetCurrentLineRenderBuffer())
if (x50_typeEnable)
return buf->GetPrimitiveCount() / x58_chRate;
return 0.f;
}
bool CGuiTextSupport::AnimationDone() const
bool CGuiTextSupport::IsAnimationDone() const
{
return x3c_curTime >= GetTotalAnimationTime();
}
@ -67,50 +89,48 @@ void CGuiTextSupport::SetTypeWriteEffectOptions(bool enable, float chFadeTime, f
void CGuiTextSupport::Update(float dt)
{
if (!x2ac_active)
return;
if (x50_typeEnable)
{
for (int i=0 ; i<x60_renderBuf->GetPrimitiveCount() ; ++i)
if (CTextRenderBuffer* buf = GetCurrentLineRenderBuffer())
{
float chStartTime = 0.f;
for (const std::pair<float, int>& p : x44_primStartTimes)
for (int i=0 ; i<buf->GetPrimitiveCount() ; ++i)
{
if (p.second < i)
continue;
if (p.second != i)
float chStartTime = 0.f;
for (const std::pair<float, int>& p : x40_primStartTimes)
{
if (p.second < i)
continue;
if (p.second != i)
break;
chStartTime = p.first;
break;
chStartTime = p.first;
break;
}
}
#if 0
CTextRenderBuffer::Primitive prim = x54_renderBuf->GetPrimitive(i);
prim.x0_color1.a = std::min(std::max(0.f, (x30_curTime - chStartTime) / x48_chFadeTime), 1.f);
x54_renderBuf->SetPrimitive(prim, i);
CTextRenderBuffer::Primitive prim = x54_renderBuf->GetPrimitive(i);
prim.x0_color1.a = std::min(std::max(0.f, (x30_curTime - chStartTime) / x48_chFadeTime), 1.f);
x54_renderBuf->SetPrimitive(prim, i);
#else
x60_renderBuf->SetPrimitiveOpacity(i,
std::min(std::max(0.f, (x3c_curTime - chStartTime) / x54_chFadeTime), 1.f));
buf->SetPrimitiveOpacity(i,
std::min(std::max(0.f, (x3c_curTime - chStartTime) / x54_chFadeTime), 1.f));
#endif
}
}
x3c_curTime += dt;
}
x3c_curTime += dt;
x10_curTimeMod900 = std::fmod(x10_curTimeMod900 + dt, 900.f);
}
void CGuiTextSupport::ClearBuffer()
void CGuiTextSupport::ClearRenderBuffer()
{
x60_renderBuf = std::experimental::nullopt;
}
void CGuiTextSupport::CheckAndRebuildTextRenderBuffer()
{
if (x2ac_active)
return;
g_TextExecuteBuf->Clear();
g_TextExecuteBuf->x18_textState.x48_enableWordWrap = x14_props.x0_wordWrap;
g_TextExecuteBuf->x18_textState.x7c_enableWordWrap = x14_props.x0_wordWrap;
g_TextExecuteBuf->BeginBlock(0, 0, x34_extentX, x38_extentY, x14_props.xc_direction,
x14_props.x4_justification, x14_props.x8_vertJustification);
g_TextExecuteBuf->AddColor(EColorType::Main, x24_fontColor);
@ -124,24 +144,15 @@ void CGuiTextSupport::CheckAndRebuildTextRenderBuffer()
g_TextParser->ParseText(*g_TextExecuteBuf, initStr.c_str(), initStr.size());
g_TextExecuteBuf->EndBlock();
x2b0_assets = g_TextExecuteBuf->GetAssets();
if (GetIsTextSupportFinishedLoading())
{
x60_renderBuf = g_TextExecuteBuf->CreateTextRenderBuffer();
g_TextExecuteBuf->Clear();
}
Update(0.f);
}
void CGuiTextSupport::Render() const
{
if (x2ac_active)
if (CTextRenderBuffer* buf = GetCurrentLineRenderBuffer())
{
zeus::CTransform oldModel = CGraphics::g_GXModelMatrix;
CGraphics::SetModelMatrix(oldModel * zeus::CTransform::Scale(1.f, 1.f, -1.f));
x60_renderBuf->Render(x2c_geometryColor, x3c_curTime);
buf->Render(x2c_geometryColor, x10_curTimeMod900);
CGraphics::SetModelMatrix(oldModel);
}
}
@ -155,7 +166,7 @@ void CGuiTextSupport::SetOutlineColor(const zeus::CColor& col)
{
if (col != x28_outlineColor)
{
ClearBuffer();
ClearRenderBuffer();
x28_outlineColor = col;
}
}
@ -164,44 +175,44 @@ void CGuiTextSupport::SetFontColor(const zeus::CColor& col)
{
if (col != x24_fontColor)
{
ClearBuffer();
ClearRenderBuffer();
x24_fontColor = col;
}
}
void CGuiTextSupport::AddText(const std::wstring& str)
{
if (x2ac_active)
if (x60_renderBuf)
{
float t = GetCurrentAnimationOverAge();
x44_primStartTimes.push_back(std::make_pair(std::max(t, x3c_curTime),
x40_primStartTimes.push_back(std::make_pair(std::max(t, x3c_curTime),
x60_renderBuf->GetPrimitiveCount()));
}
x0_string += str;
ClearBuffer();
ClearRenderBuffer();
}
void CGuiTextSupport::SetText(const std::wstring& str, bool scanFlag)
void CGuiTextSupport::SetText(const std::wstring& str, bool multiline)
{
if (x0_string.compare(str))
{
x44_primStartTimes.clear();
x40_primStartTimes.clear();
x3c_curTime = 0.f;
x0_string = str;
ClearBuffer();
x308_scanFlag = scanFlag;
x304_scanCounter = 0;
ClearRenderBuffer();
x308_multilineFlag = multiline;
x304_lineCounter = 0;
}
}
void CGuiTextSupport::SetText(const std::string& str, bool scanFlag)
void CGuiTextSupport::SetText(const std::string& str, bool multiline)
{
SetText(hecl::UTF8ToWide(str), scanFlag);
SetText(hecl::UTF8ToWide(str), multiline);
}
bool CGuiTextSupport::GetIsTextSupportFinishedLoading() const
{
for (const CToken& tok : x2b0_assets)
for (const CToken& tok : x2bc_assets)
{
((CToken&)tok).Lock();
if (!tok.IsLoaded())

View File

@ -77,7 +77,7 @@ class CGuiTextSupport
{
friend class CGuiTextPane;
std::wstring x0_string;
float x10_ = 0.f;
float x10_curTimeMod900 = 0.f;
CGuiTextProperties x14_props;
zeus::CColor x24_fontColor;
zeus::CColor x28_outlineColor;
@ -85,23 +85,24 @@ class CGuiTextSupport
s32 x34_extentX;
s32 x38_extentY;
float x3c_curTime = 0.f;
std::vector<std::pair<float, int>> x44_primStartTimes;
std::vector<std::pair<float, int>> x40_primStartTimes;
bool x50_typeEnable = false;
float x54_chFadeTime = 0.1f;
float x58_chRate = 10.0f;
ResId x5c_fontId;
std::experimental::optional<CTextRenderBuffer> x60_renderBuf;
bool x2ac_active = false;
std::vector<CToken> x2b0_assets;
std::vector<CToken> x2bc_assets;
TLockedToken<CRasterFont> x2cc_font;
zeus::CVector2f x2dc_;
zeus::CVector2f x2e4_;
std::list<u8> x2f0_;
std::list<CTextRenderBuffer> x2f0_lineRenderBufs;
u32 x300_ = 0;
u32 x304_scanCounter = 0;
bool x308_scanFlag = false;
u32 x304_lineCounter = 0;
bool x308_multilineFlag = false;
CTextRenderBuffer* GetCurrentLineRenderBuffer() const;
public:
CGuiTextSupport(ResId fontId, const CGuiTextProperties& props,
@ -110,18 +111,18 @@ public:
float GetCurrentAnimationOverAge() const;
float GetNumCharsPrinted() const;
float GetTotalAnimationTime() const;
bool AnimationDone() const;
bool IsAnimationDone() const;
void SetTypeWriteEffectOptions(bool enable, float chFadeTime, float chRate);
void Update(float dt);
void ClearBuffer();
void ClearRenderBuffer();
void CheckAndRebuildTextRenderBuffer();
void Render() const;
void SetGeometryColor(const zeus::CColor& col);
void SetOutlineColor(const zeus::CColor& col);
void SetFontColor(const zeus::CColor& col);
void AddText(const std::wstring& str);
void SetText(const std::wstring& str, bool scanFlag=false); // Flag set for scan write effect
void SetText(const std::string& str, bool scanFlag=false);
void SetText(const std::wstring& str, bool multiline=false);
void SetText(const std::string& str, bool multiline=false);
bool GetIsTextSupportFinishedLoading() const;
};

View File

@ -23,7 +23,7 @@ void CColorInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf)
void CColorOverrideInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const
{
state.x30_colorOverrides[x4_overrideIdx] = true;
state.x64_colorOverrides[x4_overrideIdx] = true;
zeus::CColor convCol = state.ConvertToTextureSpace(x8_color);
state.x0_drawStrOpts.x4_colors[x4_overrideIdx] = convCol;
}
@ -31,7 +31,7 @@ void CColorOverrideInstruction::Invoke(CFontRenderState& state, CTextRenderBuffe
void CFontInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const
{
buf->AddFontChange(x4_font);
state.x14_font = x4_font;
state.x48_font = x4_font;
state.RefreshPalette();
}
@ -47,7 +47,7 @@ size_t CFontInstruction::GetAssetCount() const
void CLineExtraSpaceInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const
{
state.x44_extraLineSpace = x4_extraSpace;
state.x78_extraLineSpace = x4_extraSpace;
}
void CLineInstruction::TestLargestFont(s32 monoW, s32 monoH, s32 baseline)
@ -141,7 +141,7 @@ void CLineInstruction::InvokeLTR(CFontRenderState& state) const
}
if (state.x54_curBlock->x1c_vertJustification != EVerticalJustification::Full)
val = val * state.x40_lineSpacing + state.x44_extraLineSpace;
val = val * state.x74_lineSpacing + state.x78_extraLineSpace;
state.x70_curY += val;
}
@ -156,7 +156,7 @@ void CLineInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf) c
void CLineSpacingInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const
{
state.x40_lineSpacing = x4_lineSpacing;
state.x74_lineSpacing = x4_lineSpacing;
}
void CPopStateInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const
@ -171,7 +171,7 @@ void CPushStateInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* b
void CRemoveColorOverrideInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const
{
state.x30_colorOverrides[x4_idx] = false;
state.x64_colorOverrides[x4_idx] = false;
}
void CImageInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const
@ -196,7 +196,7 @@ void CImageInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf)
void CTextInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const
{
int xOut, yOut;
state.x14_font.GetObj()->DrawString(state.x0_drawStrOpts, state.x6c_curX,
state.x48_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;
@ -254,7 +254,7 @@ void CBlockInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf)
void CWordInstruction::InvokeLTR(CFontRenderState& state) const
{
CRasterFont* font = state.x14_font.GetObj();
CRasterFont* font = state.x48_font.GetObj();
wchar_t space = L' ';
int w, h;
font->GetSize(state.x0_drawStrOpts, w, h, &space, 1);

View File

@ -21,6 +21,21 @@ void CSaveUI::ProcessUserInput(const CFinalInput& input)
}
void CSaveUI::StartGame(int idx)
{
}
void CSaveUI::EraseGame(int idx)
{
}
void* CSaveUI::GetGameData(int idx) const
{
return nullptr;
}
CSaveUI::CSaveUI(u32 instIdx, u32 a, u32 b)
: x0_instIdx(instIdx), x8_a(a), xc_b(b)
{

View File

@ -39,6 +39,9 @@ struct CSaveUI
CIOWin::EMessageReturn Update(float dt);
bool PumpLoad();
void ProcessUserInput(const CFinalInput& input);
void StartGame(int idx);
void EraseGame(int idx);
void* GetGameData(int idx) const;
CSaveUI(u32 inst, u32 a, u32 b);
};

View File

@ -23,20 +23,20 @@ class CSaveableState
friend class CGuiTextSupport;
protected:
CDrawStringOptions x0_drawStrOpts;
TToken<CRasterFont> x14_font;
std::vector<CTextColor> x20_;
std::vector<bool> x30_colorOverrides;
float x40_lineSpacing = 1.f;
s32 x44_extraLineSpace = 0;
bool x48_enableWordWrap = false;
EJustification x4c_just = EJustification::Left;
EVerticalJustification x50_vjust = EVerticalJustification::Top;
TLockedToken<CRasterFont> x48_font;
std::vector<CTextColor> x54_;
std::vector<bool> x64_colorOverrides;
float x74_lineSpacing = 1.f;
s32 x78_extraLineSpace = 0;
bool x7c_enableWordWrap = false;
EJustification x80_just = EJustification::Left;
EVerticalJustification x84_vjust = EVerticalJustification::Top;
public:
CSaveableState()
{
x20_.resize(3, zeus::CColor::skBlack);
x30_colorOverrides.resize(16);
x54_.resize(3, zeus::CColor::skBlack);
x64_colorOverrides.resize(16);
}
};

View File

@ -49,7 +49,7 @@ std::vector<CToken> CTextExecuteBuffer::GetAssets() const
void CTextExecuteBuffer::AddString(const wchar_t* str, int count)
{
if (!x70_curLine)
if (!xa4_curLine)
StartNewLine();
const wchar_t* charCur = str;
@ -70,17 +70,17 @@ void CTextExecuteBuffer::AddString(const wchar_t* str, int count)
StartNewWord();
int w, h;
wchar_t space = L' ';
x18_textState.x14_font.GetObj()->GetSize(x18_textState.x0_drawStrOpts,
x18_textState.x48_font.GetObj()->GetSize(x18_textState.x0_drawStrOpts,
w, h, &space, 1);
if (x6c_curBlock->x14_direction == ETextDirection::Horizontal)
if (xa0_curBlock->x14_direction == ETextDirection::Horizontal)
{
x70_curLine->x8_curX += w;
x88_spaceDistance = w;
xa4_curLine->x8_curX += w;
xbc_spaceDistance = w;
}
else
{
x70_curLine->xc_curY += h;
x88_spaceDistance = h;
xa4_curLine->xc_curY += h;
xbc_spaceDistance = h;
}
}
}
@ -92,31 +92,31 @@ void CTextExecuteBuffer::AddString(const wchar_t* str, int count)
void CTextExecuteBuffer::AddStringFragment(const wchar_t* str, int len)
{
if (x6c_curBlock->x14_direction == ETextDirection::Horizontal)
if (xa0_curBlock->x14_direction == ETextDirection::Horizontal)
for (int i=0 ; i<len ;)
i += WrapOneLTR(str + i, len - i);
}
int CTextExecuteBuffer::WrapOneLTR(const wchar_t* str, int len)
{
if (!x18_textState.x14_font)
if (!x18_textState.x48_font)
return len;
CRasterFont* font = x18_textState.x14_font.GetObj();
CRasterFont* font = x18_textState.x48_font.GetObj();
int rem = len;
int w, h;
x18_textState.x14_font.GetObj()->GetSize(x18_textState.x0_drawStrOpts,
x18_textState.x48_font.GetObj()->GetSize(x18_textState.x0_drawStrOpts,
w, h, str, len);
if (x18_textState.x48_enableWordWrap)
if (x18_textState.x7c_enableWordWrap)
{
if (w + x70_curLine->x8_curX > x6c_curBlock->xc_blockExtentX &&
x70_curLine->x4_wordCount > 1 &&
x7c_curX + w < x6c_curBlock->xc_blockExtentX)
if (w + xa4_curLine->x8_curX > xa0_curBlock->xc_blockExtentX &&
xa4_curLine->x4_wordCount > 1 &&
xb0_curX + w < xa0_curBlock->xc_blockExtentX)
{
MoveWordLTR();
}
if (w + x70_curLine->x8_curX > x6c_curBlock->xc_blockExtentX && len > 1)
if (w + xa4_curLine->x8_curX > xa0_curBlock->xc_blockExtentX && len > 1)
{
const wchar_t* strEnd = str + len;
int aRank = 5;
@ -137,23 +137,23 @@ int CTextExecuteBuffer::WrapOneLTR(const wchar_t* str, int len)
}
else
{
x18_textState.x14_font.GetObj()->GetSize(x18_textState.x0_drawStrOpts,
x18_textState.x48_font.GetObj()->GetSize(x18_textState.x0_drawStrOpts,
w, h, str, rem);
}
} while (w + x70_curLine->x8_curX > x6c_curBlock->xc_blockExtentX && rem > 1);
} while (w + xa4_curLine->x8_curX > xa0_curBlock->xc_blockExtentX && rem > 1);
}
}
x78_curY = std::max(x78_curY, font->GetMonoHeight());
xac_curY = std::max(xac_curY, font->GetMonoHeight());
x70_curLine->TestLargestFont(font->GetMonoWidth(),
xa4_curLine->TestLargestFont(font->GetMonoWidth(),
font->GetMonoHeight(),
font->GetBaseline());
x70_curLine->x8_curX += w;
x6c_curBlock->x2c_lineX = std::max(x6c_curBlock->x2c_lineX, x70_curLine->x8_curX);
x7c_curX += w;
xa4_curLine->x8_curX += w;
xa0_curBlock->x2c_lineX = std::max(xa0_curBlock->x2c_lineX, xa4_curLine->x8_curX);
xb0_curX += w;
x0_instList.emplace(x0_instList.cend(), new CTextInstruction(str, rem));
@ -165,63 +165,63 @@ int CTextExecuteBuffer::WrapOneLTR(const wchar_t* str, int len)
void CTextExecuteBuffer::MoveWordLTR()
{
x70_curLine->xc_curY = std::min(x70_curLine->xc_curY, x84_);
x88_spaceDistance = 0;
--x70_curLine->x4_wordCount;
xa4_curLine->xc_curY = std::min(xa4_curLine->xc_curY, xb8_);
xbc_spaceDistance = 0;
--xa4_curLine->x4_wordCount;
TerminateLineLTR();
x70_curLine = static_cast<CLineInstruction*>(x0_instList.emplace(x74_curWordIt,
new CLineInstruction(x18_textState.x4c_just, x18_textState.x50_vjust))->get());
xa4_curLine = static_cast<CLineInstruction*>(x0_instList.emplace(xa8_curWordIt,
new CLineInstruction(x18_textState.x80_just, x18_textState.x84_vjust))->get());
x0_instList.emplace(x74_curWordIt, new CWordInstruction());
x0_instList.emplace(xa8_curWordIt, new CWordInstruction());
++x6c_curBlock->x34_lineCount;
++xa0_curBlock->x34_lineCount;
}
void CTextExecuteBuffer::StartNewLine()
{
if (x70_curLine)
if (xa4_curLine)
TerminateLine();
x74_curWordIt = x0_instList.emplace(x0_instList.cend(),
new CLineInstruction(x18_textState.x4c_just, x18_textState.x50_vjust));
x88_spaceDistance = 0;
xa8_curWordIt = x0_instList.emplace(x0_instList.cend(),
new CLineInstruction(x18_textState.x80_just, x18_textState.x84_vjust));
xbc_spaceDistance = 0;
StartNewWord();
++x6c_curBlock->x34_lineCount;
++xa0_curBlock->x34_lineCount;
}
void CTextExecuteBuffer::StartNewWord()
{
x74_curWordIt = x0_instList.emplace(x0_instList.cend(), new CWordInstruction());
x7c_curX = 0;
x78_curY = 0;
x80_ = x70_curLine->x8_curX;
x84_ = x70_curLine->xc_curY;
++x70_curLine->x4_wordCount;
xa8_curWordIt = x0_instList.emplace(x0_instList.cend(), new CWordInstruction());
xb0_curX = 0;
xac_curY = 0;
xb4_ = xa4_curLine->x8_curX;
xb8_ = xa4_curLine->xc_curY;
++xa4_curLine->x4_wordCount;
}
void CTextExecuteBuffer::TerminateLine()
{
if (x6c_curBlock->x14_direction == ETextDirection::Horizontal)
if (xa0_curBlock->x14_direction == ETextDirection::Horizontal)
TerminateLineLTR();
}
void CTextExecuteBuffer::TerminateLineLTR()
{
if (!x70_curLine->xc_curY && x18_textState.x14_font)
if (!xa4_curLine->xc_curY && x18_textState.x48_font)
{
x70_curLine->xc_curY = x70_curLine->x10_largestMonoHeight;
xa4_curLine->xc_curY = xa4_curLine->x10_largestMonoHeight;
}
if (x6c_curBlock->x1c_vertJustification == EVerticalJustification::Full)
if (xa0_curBlock->x1c_vertJustification == EVerticalJustification::Full)
{
x6c_curBlock->x30_lineY += x70_curLine->xc_curY;
xa0_curBlock->x30_lineY += xa4_curLine->xc_curY;
}
else
{
x6c_curBlock->x30_lineY += x18_textState.x44_extraLineSpace +
x70_curLine->xc_curY * x18_textState.x40_lineSpacing;
xa0_curBlock->x30_lineY += x18_textState.x78_extraLineSpace +
xa4_curLine->xc_curY * x18_textState.x74_lineSpacing;
}
}
@ -229,52 +229,52 @@ void CTextExecuteBuffer::AddPopState()
{
x0_instList.emplace(x0_instList.cend(), new CPopStateInstruction());
x18_textState = x8c_stateStack.back();
x8c_stateStack.pop_back();
x18_textState = xc4_stateStack.back();
xc4_stateStack.pop_back();
if (!x70_curLine->x8_curX)
if (!xa4_curLine->x8_curX)
{
x70_curLine->x1c_just = x18_textState.x4c_just;
x70_curLine->x20_vjust = x18_textState.x50_vjust;
xa4_curLine->x1c_just = x18_textState.x80_just;
xa4_curLine->x20_vjust = x18_textState.x84_vjust;
}
}
void CTextExecuteBuffer::AddPushState()
{
x0_instList.emplace(x0_instList.cend(), new CPushStateInstruction());
x8c_stateStack.push_back(x18_textState);
xc4_stateStack.push_back(x18_textState);
}
void CTextExecuteBuffer::AddVerticalJustification(EVerticalJustification vjust)
{
x18_textState.x50_vjust = vjust;
if (!x70_curLine)
x18_textState.x84_vjust = vjust;
if (!xa4_curLine)
return;
if (x70_curLine->x8_curX)
if (xa4_curLine->x8_curX)
return;
x70_curLine->x20_vjust = vjust;
xa4_curLine->x20_vjust = vjust;
}
void CTextExecuteBuffer::AddJustification(EJustification just)
{
x18_textState.x4c_just = just;
if (!x70_curLine)
x18_textState.x80_just = just;
if (!xa4_curLine)
return;
if (x70_curLine->x8_curX)
if (xa4_curLine->x8_curX)
return;
x70_curLine->x1c_just = just;
xa4_curLine->x1c_just = just;
}
void CTextExecuteBuffer::AddLineExtraSpace(s32 space)
{
x0_instList.emplace(x0_instList.cend(), new CLineExtraSpaceInstruction(space));
x18_textState.x44_extraLineSpace = space;
x18_textState.x78_extraLineSpace = space;
}
void CTextExecuteBuffer::AddLineSpacing(float spacing)
{
x0_instList.emplace(x0_instList.cend(), new CLineSpacingInstruction(spacing));
x18_textState.x40_lineSpacing = spacing;
x18_textState.x74_lineSpacing = spacing;
}
void CTextExecuteBuffer::AddRemoveColorOverride(int idx)
@ -294,19 +294,19 @@ void CTextExecuteBuffer::AddColor(EColorType tp, const CTextColor& color)
void CTextExecuteBuffer::AddImage(const CFontImageDef& image)
{
if (!x70_curLine)
if (!xa4_curLine)
StartNewLine();
if (x6c_curBlock)
if (xa0_curBlock)
{
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);
xa4_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;
if (xa0_curBlock->x14_direction == ETextDirection::Horizontal)
if (xa4_curLine->x8_curX > width)
xa0_curBlock->x2c_lineX = xa4_curLine->x8_curX;
}
x0_instList.emplace(x0_instList.cend(), new CImageInstruction(image));
@ -315,25 +315,25 @@ void CTextExecuteBuffer::AddImage(const CFontImageDef& image)
void CTextExecuteBuffer::AddFont(const TToken<CRasterFont>& font)
{
x0_instList.emplace(x0_instList.cend(), new CFontInstruction(font));
x18_textState.x14_font = font;
x18_textState.x48_font = font;
if (x6c_curBlock)
x6c_curBlock->TestLargestFont(font->GetMonoWidth(),
if (xa0_curBlock)
xa0_curBlock->TestLargestFont(font->GetMonoWidth(),
font->GetMonoHeight(),
font->GetBaseline());
if (x70_curLine)
x70_curLine->TestLargestFont(font->GetMonoWidth(),
if (xa4_curLine)
xa4_curLine->TestLargestFont(font->GetMonoWidth(),
font->GetMonoHeight(),
font->GetBaseline());
}
void CTextExecuteBuffer::EndBlock()
{
if (x70_curLine)
if (xa4_curLine)
TerminateLine();
x70_curLine = nullptr;
x6c_curBlock = nullptr;
xa4_curLine = nullptr;
xa0_curBlock = nullptr;
}
void CTextExecuteBuffer::BeginBlock(s32 offX, s32 offY, s32 padX, s32 padY,
@ -343,9 +343,9 @@ void CTextExecuteBuffer::BeginBlock(s32 offX, s32 offY, s32 padX, s32 padY,
x0_instList.emplace(x0_instList.cend(),
new CBlockInstruction(offX, offY, padX, padY, dir, just, vjust));
if (x18_textState.x14_font)
if (x18_textState.x48_font)
{
CRasterFont* font = x18_textState.x14_font.GetObj();
CRasterFont* font = x18_textState.x48_font.GetObj();
s32 baseline = font->GetBaseline();
s32 monoH = font->GetMonoHeight();
s32 monoW = font->GetMonoWidth();
@ -354,20 +354,20 @@ void CTextExecuteBuffer::BeginBlock(s32 offX, s32 offY, s32 padX, s32 padY,
}
x18_textState.x0_drawStrOpts.x0_direction = dir;
x18_textState.x4c_just = just;
x18_textState.x50_vjust = vjust;
x18_textState.x80_just = just;
x18_textState.x84_vjust = vjust;
}
void CTextExecuteBuffer::Clear()
{
x0_instList.clear();
x18_textState = CSaveableState();
x6c_curBlock = nullptr;
x70_curLine = nullptr;
x74_curWordIt = x0_instList.begin();
x80_ = 0;
x84_ = 0;
x88_spaceDistance = 0;
xa0_curBlock = nullptr;
xa4_curLine = nullptr;
xa8_curWordIt = x0_instList.begin();
xb4_ = 0;
xb8_ = 0;
xbc_spaceDistance = 0;
}
}

View File

@ -20,20 +20,22 @@ class CTextExecuteBuffer
std::list<std::shared_ptr<CInstruction>> x0_instList;
u32 x14_ = 0;
CSaveableState x18_textState;
CBlockInstruction* x6c_curBlock = nullptr;
CLineInstruction* x70_curLine = nullptr;
std::list<std::shared_ptr<CInstruction>>::iterator x74_curWordIt;
s32 x78_curY;
s32 x7c_curX;
s32 x80_ = 0;
s32 x84_ = 0;
s32 x88_spaceDistance = 0;
std::vector<CSaveableState> x8c_stateStack;
CBlockInstruction* xa0_curBlock = nullptr;
CLineInstruction* xa4_curLine = nullptr;
std::list<std::shared_ptr<CInstruction>>::iterator xa8_curWordIt;
s32 xac_curY;
s32 xb0_curX;
s32 xb4_ = 0;
s32 xb8_ = 0;
s32 xbc_spaceDistance = 0;
bool xc0_ = false;
std::list<CSaveableState> xc4_stateStack;
u32 xd8_ = 0;
public:
CTextExecuteBuffer()
{
x74_curWordIt = x0_instList.begin();
xa8_curWordIt = x0_instList.begin();
}
CTextRenderBuffer CreateTextRenderBuffer() const;

View File

@ -64,29 +64,28 @@ static const FEMovie FEMovies[] =
SObjectTag g_DefaultWorldTag = {FOURCC('MLVL'), 0x158efe17};
void CFrontEndUI::PlayAdvanceSfx()
{
CSfxManager::SfxStart(1096, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
CSfxManager::SfxStart(1091, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
}
CFrontEndUI::SNewFileSelectFrame::SNewFileSelectFrame(CSaveUI* sui, u32 rnd)
: x0_rnd(rnd), x4_saveUI(sui)
{
x10_frme = g_SimplePool->GetObj("FRME_NewFileSelect");
}
CFrontEndUI::SFileSelectOption CFrontEndUI::FindFileSelectOption(CGuiFrame* frame, int idx)
{
SFileSelectOption ret;
ret.x0_base = frame->FindWidget(hecl::Format("basewidget_file%d", idx).c_str());
ret.x4_textpanes[0] = FindTextPanePair(frame, hecl::Format("textpane_filename%d", idx).c_str());
ret.x4_textpanes[1] = FindTextPanePair(frame, hecl::Format("textpane_world%d", idx).c_str());
ret.x4_textpanes[2] = FindTextPanePair(frame, hecl::Format("textpane_playtime%d", idx).c_str());
ret.x4_textpanes[3] = FindTextPanePair(frame, hecl::Format("textpane_date%d", idx).c_str());
return ret;
}
void CFrontEndUI::SNewFileSelectFrame::FinishedLoading()
{
x20_tablegroup_fileselect = static_cast<CGuiTableGroup*>(x1c_loadedFrame->FindWidget("tablegroup_fileselect"));
x24_model_erase = static_cast<CGuiModel*>(x1c_loadedFrame->FindWidget("model_erase"));
xf8_model_erase_position = x24_model_erase->GetLocalPosition();
x28_textpane_erase = FindTextPanePair(x1c_loadedFrame, "textpane_erase");
x38_textpane_gba = FindTextPanePair(x1c_loadedFrame, "textpane_gba");
x30_textpane_cheats = FindTextPanePair(x1c_loadedFrame, "textpane_cheats");
x48_textpane_popupadvance = FindTextPanePair(x1c_loadedFrame, "textpane_popupadvance");
x50_textpane_popupcancel = FindTextPanePair(x1c_loadedFrame, "textpane_popupcancel");
x58_textpane_popupextra = FindTextPanePair(x1c_loadedFrame, "textpane_popupextra");
x40_tablegroup_popup = static_cast<CGuiTableGroup*>(x1c_loadedFrame->FindWidget("tablegroup_popup"));
x44_model_dash7 = static_cast<CGuiModel*>(x1c_loadedFrame->FindWidget("model_dash7"));
@ -146,9 +145,9 @@ bool CFrontEndUI::SNewFileSelectFrame::IsTextDoneAnimating() const
return false;
if (x64_fileSelections[2].x28_ != 4)
return false;
if (!x28_textpane_erase.x0_panes[0]->GetTextSupport()->AnimationDone())
if (!x28_textpane_erase.x0_panes[0]->GetTextSupport()->IsAnimationDone())
return false;
return x38_.x0_panes[0]->GetTextSupport()->AnimationDone();
return x38_textpane_gba.x0_panes[0]->GetTextSupport()->IsAnimationDone();
}
CFrontEndUI::SNewFileSelectFrame::EPhase
@ -162,12 +161,21 @@ CFrontEndUI::SNewFileSelectFrame::ProcessUserInput(const CFinalInput& input)
return xc_phase;
if (x10c_inputEnable)
x1c_loadedFrame->ProcessUserInput(input);
if (x10d_needsToggle)
if (x10d_needsExistingToggle)
{
if (x40_tablegroup_popup->GetIsActive())
DeactivatePopup();
DeactivateExistingGamePopup();
else
ActivatePopup();
ActivateExistingGamePopup();
x10d_needsExistingToggle = false;
}
if (x10e_needsNewToggle)
{
if (x40_tablegroup_popup->GetIsActive())
DeactivateNewGamePopup();
else
ActivateNewGamePopup();
x10e_needsNewToggle = false;
}
return xc_phase;
}
@ -189,7 +197,7 @@ void CFrontEndUI::SNewFileSelectFrame::HandleActiveChange(CGuiTableGroup* active
x24_model_erase->SetIsVisible(true);
}
void CFrontEndUI::SNewFileSelectFrame::DeactivatePopup()
void CFrontEndUI::SNewFileSelectFrame::DeactivateExistingGamePopup()
{
x40_tablegroup_popup->SetIsActive(false);
x40_tablegroup_popup->SetIsVisible(false);
@ -199,7 +207,7 @@ void CFrontEndUI::SNewFileSelectFrame::DeactivatePopup()
x0_base->SetColor(zeus::CColor::skWhite);
}
void CFrontEndUI::SNewFileSelectFrame::ActivatePopup()
void CFrontEndUI::SNewFileSelectFrame::ActivateExistingGamePopup()
{
x40_tablegroup_popup->SetIsActive(true);
x40_tablegroup_popup->SetIsVisible(true);
@ -209,36 +217,234 @@ void CFrontEndUI::SNewFileSelectFrame::ActivatePopup()
x20_tablegroup_fileselect->SetIsActive(false);
x8_ = 2;
HandleActiveChange(x40_tablegroup_popup);
x48_.SetPairText(g_MainStringTable->GetString(95));
x50_.SetPairText(g_MainStringTable->GetString(38));
x48_textpane_popupadvance.SetPairText(g_MainStringTable->GetString(95));
x50_textpane_popupcancel.SetPairText(g_MainStringTable->GetString(38));
x64_fileSelections[x20_tablegroup_fileselect->GetUserSelection()].
x0_base->SetColor(zeus::CColor{1.f, 1.f, 1.f, 0.f});
x44_model_dash7->SetVisibility(false, ETraversalMode::Children);
}
void CFrontEndUI::SNewFileSelectFrame::DoPopupCancel(const CGuiTableGroup* caller)
void CFrontEndUI::SNewFileSelectFrame::DeactivateNewGamePopup()
{
x40_tablegroup_popup->SetIsActive(false);
x40_tablegroup_popup->SetIsVisible(false);
x20_tablegroup_fileselect->SetIsActive(true);
CGuiWidget* worker = x40_tablegroup_popup->GetWorkerWidget(2);
worker->SetB627(false);
worker->SetVisibility(false, ETraversalMode::Children);
x44_model_dash7->SetVisibility(false, ETraversalMode::Children);
HandleActiveChange(x20_tablegroup_fileselect);
x64_fileSelections[x20_tablegroup_fileselect->GetUserSelection()].
x0_base->SetColor(zeus::CColor::skWhite);
x60_textpane_cancel->TextSupport()->SetText("");
}
void CFrontEndUI::SNewFileSelectFrame::ActivateNewGamePopup()
{
x40_tablegroup_popup->SetIsActive(true);
x40_tablegroup_popup->SetIsVisible(true);
x40_tablegroup_popup->SetUserSelection(0);
x40_tablegroup_popup->SetLocalTransform(
zeus::CTransform::Translate(0.f, 0.f, x20_tablegroup_fileselect->GetUserSelection() * x104_rowPitch) *
x40_tablegroup_popup->GetTransform());
x20_tablegroup_fileselect->SetIsActive(false);
x8_ = 3;
HandleActiveChange(x40_tablegroup_popup);
x64_fileSelections[x20_tablegroup_fileselect->GetUserSelection()].
x0_base->SetColor(zeus::CColor{1.f, 1.f, 1.f, 0.f});
PlayAdvanceSfx();
if (g_GameState->SystemOptions().PlayerHasHardMode())
{
x48_textpane_popupadvance.SetPairText(g_MainStringTable->GetString(102));
x50_textpane_popupcancel.SetPairText(g_MainStringTable->GetString(94));
x58_textpane_popupextra.SetPairText(g_MainStringTable->GetString(101));
CGuiWidget* worker = x40_tablegroup_popup->GetWorkerWidget(2);
worker->SetB627(true);
worker->SetVisibility(true, ETraversalMode::Children);
x44_model_dash7->SetVisibility(true, ETraversalMode::Children);
}
else
{
x48_textpane_popupadvance.SetPairText(g_MainStringTable->GetString(67));
x50_textpane_popupcancel.SetPairText(g_MainStringTable->GetString(94));
x44_model_dash7->SetVisibility(false, ETraversalMode::Children);
}
x60_textpane_cancel->TextSupport()->SetText(g_MainStringTable->GetString(82));
}
void CFrontEndUI::SNewFileSelectFrame::ResetFrame()
{
x8_ = 0;
x38_textpane_gba.x0_panes[0]->SetB627(true);
x38_textpane_gba.x0_panes[0]->TextSupport()->SetFontColor(zeus::CColor::skWhite);
x30_textpane_cheats.x0_panes[0]->SetB627(true);
x30_textpane_cheats.x0_panes[0]->TextSupport()->SetFontColor(zeus::CColor::skWhite);
ClearFrameContents();
for (int i=2 ; i>=0 ; --i)
x20_tablegroup_fileselect->GetWorkerWidget(i)->SetB627(true);
x60_textpane_cancel->TextSupport()->SetText("");
}
void CFrontEndUI::SNewFileSelectFrame::ClearFrameContents()
{
x108_curTime = 0.f;
bool hasSave = false;
for (int i=0 ; i<3 ; ++i)
{
if (x4_saveUI->GetGameData(i))
hasSave = true;
SFileSelectOption& option = x64_fileSelections[i];
option.x2c_ = SFileSelectOption::ComputeRandom();
option.x28_ = -1;
for (int j=0 ; j<4 ; ++j)
option.x4_textpanes[j].SetPairText(L"");
}
StartTextAnimating(x28_textpane_erase.x0_panes[0], g_MainStringTable->GetString(38), 60.f);
StartTextAnimating(x38_textpane_gba.x0_panes[0], g_MainStringTable->GetString(37), 60.f);
StartTextAnimating(x30_textpane_cheats.x0_panes[0], g_MainStringTable->GetString(96), 60.f);
StartTextAnimating(x28_textpane_erase.x0_panes[1], g_MainStringTable->GetString(38), 60.f);
StartTextAnimating(x38_textpane_gba.x0_panes[1], g_MainStringTable->GetString(37), 60.f);
StartTextAnimating(x30_textpane_cheats.x0_panes[1], g_MainStringTable->GetString(96), 60.f);
if (hasSave)
{
x28_textpane_erase.x0_panes[0]->SetB627(true);
x28_textpane_erase.x0_panes[0]->TextSupport()->SetFontColor(zeus::CColor::skWhite);
}
else
{
x28_textpane_erase.x0_panes[0]->SetB627(false);
zeus::CColor color = zeus::CColor::skGrey;
color.a = 0.5f;
x28_textpane_erase.x0_panes[0]->TextSupport()->SetFontColor(color);
}
x20_tablegroup_fileselect->SetUserSelection(0);
CGuiTextPane* cheats = static_cast<CGuiTextPane*>(x20_tablegroup_fileselect->GetWorkerWidget(5));
if (CSlideShow::SlideShowGalleryFlags())
{
cheats->SetB627(true);
x30_textpane_cheats.x0_panes[0]->TextSupport()->SetFontColor(zeus::CColor::skWhite);
}
else
{
cheats->SetB627(false);
zeus::CColor color = zeus::CColor::skGrey;
color.a = 0.5f;
x30_textpane_cheats.x0_panes[0]->TextSupport()->SetFontColor(color);
}
HandleActiveChange(x20_tablegroup_fileselect);
}
void CFrontEndUI::SNewFileSelectFrame::SetupFrameContents()
{
for (int i=0 ; i<3 ; ++i)
{
SFileSelectOption& option = x64_fileSelections[i];
if (option.x28_ == 4)
continue;
SGuiTextPair* pair = (option.x28_ == -1) ? nullptr : &option.x4_textpanes[option.x28_];
if (pair)
{
//pair->x0_panes[0]->GetTextSupport()->GetNumCharsPrinted()
}
}
}
void CFrontEndUI::SNewFileSelectFrame::DoPopupCancel(CGuiTableGroup* caller)
{
if (x8_ == 2)
{
CSfxManager::SfxStart(1094, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
x8_ = 1;
x10d_needsExistingToggle = true;
}
else
{
CSfxManager::SfxStart(1094, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
x8_ = 0;
x10e_needsNewToggle = true;
}
}
void CFrontEndUI::SNewFileSelectFrame::DoPopupAdvance(CGuiTableGroup* caller)
{
if (x8_ == 2)
{
if (x40_tablegroup_popup->GetUserSelection() == 1)
{
x4_saveUI->EraseGame(x20_tablegroup_fileselect->GetUserSelection());
ResetFrame();
}
else
x8_ = 1;
x10d_needsExistingToggle = true;
}
else
{
if (g_GameState->SystemOptions().PlayerHasHardMode())
{
if (x40_tablegroup_popup->GetUserSelection() == 1)
{
PlayAdvanceSfx();
xc_phase = EPhase::One;
return;
}
g_GameState->SetHardMode(x20_tablegroup_fileselect->GetUserSelection());
x4_saveUI->StartGame(x40_tablegroup_popup->GetUserSelection());
}
else
{
if (x40_tablegroup_popup->GetUserSelection() == 1)
{
PlayAdvanceSfx();
xc_phase = EPhase::One;
return;
}
x4_saveUI->StartGame(x40_tablegroup_popup->GetUserSelection());
}
}
}
void CFrontEndUI::SNewFileSelectFrame::DoFileselectCancel(CGuiTableGroup* caller)
{
if (x8_ == 1)
{
CSfxManager::SfxStart(1094, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
ResetFrame();
}
}
void CFrontEndUI::SNewFileSelectFrame::DoSelectionChange(CGuiTableGroup* caller)
{
HandleActiveChange(caller);
CSfxManager::SfxStart(1093, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
}
void CFrontEndUI::SNewFileSelectFrame::DoFileselectAdvance(CGuiTableGroup* caller)
{
}
void CFrontEndUI::SNewFileSelectFrame::DoPopupAdvance(const CGuiTableGroup* caller)
CFrontEndUI::SFileSelectOption CFrontEndUI::SNewFileSelectFrame::FindFileSelectOption(CGuiFrame* frame, int idx)
{
SFileSelectOption ret;
ret.x0_base = frame->FindWidget(hecl::Format("basewidget_file%d", idx).c_str());
ret.x4_textpanes[0] = FindTextPanePair(frame, hecl::Format("textpane_filename%d", idx).c_str());
ret.x4_textpanes[1] = FindTextPanePair(frame, hecl::Format("textpane_world%d", idx).c_str());
ret.x4_textpanes[2] = FindTextPanePair(frame, hecl::Format("textpane_playtime%d", idx).c_str());
ret.x4_textpanes[3] = FindTextPanePair(frame, hecl::Format("textpane_date%d", idx).c_str());
return ret;
}
void CFrontEndUI::SNewFileSelectFrame::DoFileselectCancel(const CGuiTableGroup* caller)
void CFrontEndUI::SNewFileSelectFrame::StartTextAnimating(CGuiTextPane* text, const std::wstring& str, float chRate)
{
}
void CFrontEndUI::SNewFileSelectFrame::DoSelectionChange(const CGuiTableGroup* caller)
{
}
void CFrontEndUI::SNewFileSelectFrame::DoFileselectAdvance(const CGuiTableGroup* caller)
{
text->TextSupport()->SetText(str);
text->TextSupport()->SetTypeWriteEffectOptions(true, 0.1f, chRate);
}
CFrontEndUI::SGBASupportFrame::SGBASupportFrame()
@ -308,17 +514,17 @@ void CFrontEndUI::SGBASupportFrame::ProcessUserInput(const CFinalInput& input, C
}
void CFrontEndUI::SGBASupportFrame::DoOptionsCancel(const CGuiTableGroup* caller)
void CFrontEndUI::SGBASupportFrame::DoOptionsCancel(CGuiTableGroup* caller)
{
}
void CFrontEndUI::SGBASupportFrame::DoSelectionChange(const CGuiTableGroup* caller)
void CFrontEndUI::SGBASupportFrame::DoSelectionChange(CGuiTableGroup* caller)
{
}
void CFrontEndUI::SGBASupportFrame::DoOptionsAdvance(const CGuiTableGroup* caller)
void CFrontEndUI::SGBASupportFrame::DoOptionsAdvance(CGuiTableGroup* caller)
{
}
@ -391,17 +597,17 @@ void CFrontEndUI::SFrontEndFrame::ProcessUserInput(const CFinalInput& input)
}
void CFrontEndUI::SFrontEndFrame::DoCancel(const CGuiTableGroup* caller)
void CFrontEndUI::SFrontEndFrame::DoCancel(CGuiTableGroup* caller)
{
}
void CFrontEndUI::SFrontEndFrame::DoSelectionChange(const CGuiTableGroup* caller)
void CFrontEndUI::SFrontEndFrame::DoSelectionChange(CGuiTableGroup* caller)
{
}
void CFrontEndUI::SFrontEndFrame::DoAdvance(const CGuiTableGroup* caller)
void CFrontEndUI::SFrontEndFrame::DoAdvance(CGuiTableGroup* caller)
{
}

View File

@ -70,6 +70,8 @@ public:
GBAFileSelectB
};
static void PlayAdvanceSfx();
struct SGuiTextPair
{
CGuiTextPane* x0_panes[2] = {};
@ -93,7 +95,6 @@ public:
return rand() / float(RAND_MAX) * 30.f + 30.f;
}
};
static SFileSelectOption FindFileSelectOption(CGuiFrame* frame, int idx);
struct SNewFileSelectFrame
{
@ -113,12 +114,12 @@ public:
CGuiTableGroup* x20_tablegroup_fileselect = nullptr;
CGuiModel* x24_model_erase = nullptr;
SGuiTextPair x28_textpane_erase;
SGuiTextPair x30_;
SGuiTextPair x38_;
SGuiTextPair x30_textpane_cheats;
SGuiTextPair x38_textpane_gba;
CGuiTableGroup* x40_tablegroup_popup = nullptr;
CGuiModel* x44_model_dash7 = nullptr;
SGuiTextPair x48_;
SGuiTextPair x50_;
SGuiTextPair x48_textpane_popupadvance;
SGuiTextPair x50_textpane_popupcancel;
SGuiTextPair x58_textpane_popupextra;
CGuiTextPane* x60_textpane_cancel = nullptr;
SFileSelectOption x64_fileSelections[3];
@ -126,8 +127,8 @@ public:
float x104_rowPitch = 0.f;
float x108_curTime = 0.f;
bool x10c_inputEnable = false;
bool x10d_needsToggle = false;
bool x10e_ = false;
bool x10d_needsExistingToggle = false;
bool x10e_needsNewToggle = false;
SNewFileSelectFrame(CSaveUI* sui, u32 rnd);
void FinishedLoading();
@ -136,14 +137,23 @@ public:
EPhase ProcessUserInput(const CFinalInput& input);
void HandleActiveChange(CGuiTableGroup* active);
void DeactivatePopup();
void ActivatePopup();
void DeactivateExistingGamePopup();
void ActivateExistingGamePopup();
void DeactivateNewGamePopup();
void ActivateNewGamePopup();
void DoPopupCancel(const CGuiTableGroup* caller);
void DoPopupAdvance(const CGuiTableGroup* caller);
void DoFileselectCancel(const CGuiTableGroup* caller);
void DoSelectionChange(const CGuiTableGroup* caller);
void DoFileselectAdvance(const CGuiTableGroup* caller);
void ResetFrame();
void ClearFrameContents();
void SetupFrameContents();
void DoPopupCancel(CGuiTableGroup* caller);
void DoPopupAdvance(CGuiTableGroup* caller);
void DoFileselectCancel(CGuiTableGroup* caller);
void DoSelectionChange(CGuiTableGroup* caller);
void DoFileselectAdvance(CGuiTableGroup* caller);
static SFileSelectOption FindFileSelectOption(CGuiFrame* frame, int idx);
static void StartTextAnimating(CGuiTextPane* text, const std::wstring& str, float chRate);
};
struct SGBASupportFrame
@ -166,9 +176,9 @@ public:
void SetTableColors(CGuiTableGroup* tbgp) const;
void ProcessUserInput(const CFinalInput& input, CSaveUI* sui);
void DoOptionsCancel(const CGuiTableGroup* caller);
void DoSelectionChange(const CGuiTableGroup* caller);
void DoOptionsAdvance(const CGuiTableGroup* caller);
void DoOptionsCancel(CGuiTableGroup* caller);
void DoSelectionChange(CGuiTableGroup* caller);
void DoOptionsAdvance(CGuiTableGroup* caller);
};
struct SFrontEndFrame
@ -184,9 +194,9 @@ public:
bool PumpLoad();
void ProcessUserInput(const CFinalInput& input);
void DoCancel(const CGuiTableGroup* caller);
void DoSelectionChange(const CGuiTableGroup* caller);
void DoAdvance(const CGuiTableGroup* caller);
void DoCancel(CGuiTableGroup* caller);
void DoSelectionChange(CGuiTableGroup* caller);
void DoAdvance(CGuiTableGroup* caller);
};
struct SFusionBonusFrame

View File

@ -165,4 +165,20 @@ void CSlideShow::Draw() const
}
}
u32 CSlideShow::SlideShowGalleryFlags()
{
u32 ret = 0;
if (!g_GameState)
return ret;
if (g_GameState->SystemOptions().GetLogScanCount() >= 50)
ret |= 1;
if (g_GameState->SystemOptions().GetLogScanCount() == 100)
ret |= 2;
if (g_GameState->SystemOptions().PlayerBeatHardMode())
ret |= 4;
if (g_GameState->SystemOptions().AllItemsCollected())
ret |= 8;
return ret;
}
}

View File

@ -119,6 +119,8 @@ public:
EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&);
bool GetIsContinueDraw() const {return false;}
void Draw() const;
static u32 SlideShowGalleryFlags();
};
}

2
hecl

@ -1 +1 @@
Subproject commit 2af7e12aa04e8028e7334a6371c3354c67f1c7fc
Subproject commit 0ebd4366a5ffbb97aca413dd55b3753b49f2e81c