2016-08-15 01:29:07 +00:00
|
|
|
#include "CScanDisplay.hpp"
|
|
|
|
#include "zeus/CTransform.hpp"
|
|
|
|
#include "Graphics/CGraphics.hpp"
|
2017-05-17 05:04:38 +00:00
|
|
|
#include "GameGlobalObjects.hpp"
|
|
|
|
#include "CSimplePool.hpp"
|
|
|
|
#include "GuiSys/CGuiWidget.hpp"
|
|
|
|
#include "GuiSys/CGuiTextPane.hpp"
|
|
|
|
#include "GuiSys/CGuiModel.hpp"
|
|
|
|
#include "GuiSys/CAuiImagePane.hpp"
|
|
|
|
#include "GuiSys/CGuiCamera.hpp"
|
|
|
|
#include "MP1/CPauseScreenBase.hpp"
|
|
|
|
#include "CStringTable.hpp"
|
|
|
|
#include "Audio/CSfxManager.hpp"
|
|
|
|
#include "Input/CFinalInput.hpp"
|
|
|
|
#include "Graphics/CBooRenderer.hpp"
|
2016-08-15 01:29:07 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
void CScanDisplay::CDataDot::Update(float dt)
|
|
|
|
{
|
2017-05-17 05:04:38 +00:00
|
|
|
if (x20_remTime > 0.f)
|
2016-08-15 01:29:07 +00:00
|
|
|
{
|
2017-05-17 05:04:38 +00:00
|
|
|
x20_remTime = std::max(0.f, x20_remTime - dt);
|
|
|
|
float d = x20_remTime / x1c_transDur;
|
|
|
|
xc_curPos = (x14_targetPos * (x4_startPos * d)) + (1.f - x1c_transDur > 0.f ? d : 0.f);
|
2016-08-15 01:29:07 +00:00
|
|
|
}
|
|
|
|
|
2017-05-17 05:04:38 +00:00
|
|
|
if (x24_alpha > x28_desiredAlpha)
|
2016-08-15 01:29:07 +00:00
|
|
|
{
|
2017-05-17 05:04:38 +00:00
|
|
|
float tmp = x24_alpha - 2.f * dt;
|
|
|
|
x24_alpha = std::max(tmp, x28_desiredAlpha);
|
2016-08-15 01:29:07 +00:00
|
|
|
}
|
2017-05-17 05:04:38 +00:00
|
|
|
else if (x24_alpha < x28_desiredAlpha)
|
2016-08-15 01:29:07 +00:00
|
|
|
{
|
2017-05-17 05:04:38 +00:00
|
|
|
float tmp = 2.0 * dt + x24_alpha;
|
|
|
|
x24_alpha = std::min(tmp, x28_desiredAlpha);
|
2016-08-15 01:29:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-17 05:04:38 +00:00
|
|
|
void CScanDisplay::CDataDot::Draw(const zeus::CColor& col, float radius) const
|
2016-08-15 01:29:07 +00:00
|
|
|
{
|
2017-05-17 05:04:38 +00:00
|
|
|
if (x24_alpha == 0.f)
|
2016-08-15 01:29:07 +00:00
|
|
|
return;
|
|
|
|
|
2017-05-17 05:04:38 +00:00
|
|
|
if (x0_dotState != EDotState::Hidden)
|
|
|
|
{
|
|
|
|
zeus::CTransform xf = zeus::CTransform::Translate(xc_curPos.x, 0.f, xc_curPos.y);
|
|
|
|
CGraphics::SetModelMatrix(xf);
|
|
|
|
zeus::CColor useColor = col;
|
|
|
|
useColor.a *= x24_alpha;
|
|
|
|
CTexturedQuadFilter::Vert verts[4] =
|
|
|
|
{
|
|
|
|
{{-radius, 0.f, radius}, {0.f, 1.f}},
|
|
|
|
{{-radius, 0.f, -radius}, {0.f, 0.f}},
|
|
|
|
{{radius, 0.f, radius}, {1.f, 1.f}},
|
|
|
|
{{radius, 0.f, -radius}, {1.f, 0.f}}
|
|
|
|
};
|
|
|
|
const_cast<CTexturedQuadFilter&>(m_quad).drawVerts(useColor, verts);
|
2016-08-15 01:29:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-17 05:04:38 +00:00
|
|
|
void CScanDisplay::CDataDot::StartTransitionTo(const zeus::CVector2f& vec, float dur)
|
2016-08-15 01:29:07 +00:00
|
|
|
{
|
2017-05-17 05:04:38 +00:00
|
|
|
x20_remTime = dur;
|
|
|
|
x1c_transDur = dur;
|
|
|
|
x4_startPos = xc_curPos;
|
|
|
|
x14_targetPos = vec;
|
2016-08-15 01:29:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CScanDisplay::CDataDot::SetDestPosition(const zeus::CVector2f& pos)
|
|
|
|
{
|
2017-05-17 05:04:38 +00:00
|
|
|
if (x20_remTime <= 0.f)
|
|
|
|
xc_curPos = pos;
|
2016-08-15 01:29:07 +00:00
|
|
|
else
|
2017-05-17 05:04:38 +00:00
|
|
|
x14_targetPos = pos;
|
|
|
|
}
|
|
|
|
|
|
|
|
CScanDisplay::CScanDisplay(const CGuiFrame& selHud)
|
|
|
|
: xa0_selHud(selHud)
|
|
|
|
{
|
|
|
|
x0_dataDot = g_SimplePool->GetObj("TXTR_DataDot");
|
2017-05-18 07:07:49 +00:00
|
|
|
for (int i=0 ; i<4 ; ++i)
|
|
|
|
xbc_dataDots.emplace_back(x0_dataDot);
|
2018-05-08 05:10:24 +00:00
|
|
|
x170_paneStates.resize(4);
|
2016-08-15 01:29:07 +00:00
|
|
|
}
|
2017-04-02 03:03:37 +00:00
|
|
|
|
|
|
|
void CScanDisplay::ProcessInput(const CFinalInput& input)
|
|
|
|
{
|
2017-05-17 05:04:38 +00:00
|
|
|
if (xc_state == EScanState::Inactive || xc_state == EScanState::Done)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (xc_state == EScanState::DownloadComplete && x1a4_xAlpha == 0.f)
|
|
|
|
{
|
|
|
|
if (input.PA())
|
|
|
|
{
|
2017-05-31 21:26:50 +00:00
|
|
|
if (xa8_message->TextSupport().GetCurTime() < xa8_message->TextSupport().GetTotalAnimationTime())
|
2017-05-17 05:04:38 +00:00
|
|
|
{
|
2017-05-31 21:26:50 +00:00
|
|
|
xa8_message->TextSupport().SetCurTime(xa8_message->TextSupport().GetTotalAnimationTime());
|
2017-05-17 05:04:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
xc_state = EScanState::ViewingScan;
|
|
|
|
CSfxManager::SfxStart(1439, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (xc_state == EScanState::ViewingScan)
|
|
|
|
{
|
|
|
|
int oldCounter = x1ac_pageCounter;
|
2017-05-31 21:26:50 +00:00
|
|
|
int totalPages = xac_scrollMessage->TextSupport().GetTotalPageCount();
|
2017-05-17 05:04:38 +00:00
|
|
|
if (input.PA() && totalPages != -1)
|
|
|
|
{
|
2017-05-31 21:26:50 +00:00
|
|
|
CGuiTextSupport& supp = !x1ac_pageCounter ? xa8_message->TextSupport() : xac_scrollMessage->TextSupport();
|
|
|
|
if (supp.GetCurTime() < supp.GetTotalAnimationTime())
|
|
|
|
supp.SetCurTime(supp.GetTotalAnimationTime());
|
2017-05-17 05:04:38 +00:00
|
|
|
else
|
|
|
|
x1ac_pageCounter = std::min(totalPages, x1ac_pageCounter + 1);
|
|
|
|
}
|
|
|
|
if (x1ac_pageCounter != oldCounter)
|
|
|
|
{
|
|
|
|
CSfxManager::SfxStart(1439, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
if (x1ac_pageCounter == 0)
|
|
|
|
{
|
|
|
|
xa8_message->SetIsVisible(true);
|
|
|
|
xac_scrollMessage->SetIsVisible(false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (oldCounter == 0)
|
|
|
|
{
|
|
|
|
xa8_message->SetIsVisible(false);
|
|
|
|
xac_scrollMessage->SetIsVisible(true);
|
|
|
|
}
|
2017-05-31 21:26:50 +00:00
|
|
|
xac_scrollMessage->TextSupport().SetPage(x1ac_pageCounter - 1);
|
2017-05-17 05:04:38 +00:00
|
|
|
SetScanMessageTypeEffect(xac_scrollMessage, !x1b4_scanComplete);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
float xAlpha = 0.f;
|
|
|
|
float aAlpha = 0.f;
|
|
|
|
float dashAlpha = 0.f;
|
|
|
|
if (xc_state == EScanState::DownloadComplete)
|
|
|
|
{
|
|
|
|
xAlpha = std::min(2.f * x1a4_xAlpha, 1.f);
|
|
|
|
aAlpha = (1.f - xAlpha) * std::fabs(x1b0_aPulse);
|
|
|
|
}
|
|
|
|
else if (xc_state == EScanState::ViewingScan)
|
|
|
|
{
|
2017-05-31 21:26:50 +00:00
|
|
|
if (x1ac_pageCounter < xac_scrollMessage->TextSupport().GetTotalPageCount())
|
2017-05-17 05:04:38 +00:00
|
|
|
aAlpha = std::fabs(x1b0_aPulse);
|
|
|
|
else
|
|
|
|
dashAlpha = 1.f;
|
|
|
|
}
|
|
|
|
|
|
|
|
xb0_xmark->SetVisibility(xAlpha > 0.f, ETraversalMode::Children);
|
|
|
|
xb4_abutton->SetVisibility(aAlpha > 0.f, ETraversalMode::Children);
|
|
|
|
xb8_dash->SetVisibility(dashAlpha > 0.f, ETraversalMode::Children);
|
|
|
|
|
|
|
|
xb0_xmark->SetColor(zeus::CColor(1.f, xAlpha));
|
|
|
|
xb4_abutton->SetColor(zeus::CColor(1.f, aAlpha));
|
|
|
|
xb8_dash->SetColor(zeus::CColor(0.53f, 0.84f, 1.f, dashAlpha));
|
|
|
|
}
|
|
|
|
|
|
|
|
float CScanDisplay::GetDownloadStartTime(int idx) const
|
|
|
|
{
|
|
|
|
if (!x14_scannableInfo)
|
|
|
|
return 0.f;
|
|
|
|
float nTime = x14_scannableInfo->GetBucket(idx).x4_appearanceRange;
|
|
|
|
float maxTime = 0.f;
|
|
|
|
for (int i=0 ; i<4 ; ++i)
|
|
|
|
{
|
|
|
|
float iTime = x14_scannableInfo->GetBucket(i).x4_appearanceRange;
|
|
|
|
if (iTime < nTime)
|
|
|
|
maxTime = std::max(iTime, maxTime);
|
|
|
|
}
|
|
|
|
return maxTime + g_tweakGui->GetScanAppearanceDuration();
|
|
|
|
}
|
2017-04-02 03:03:37 +00:00
|
|
|
|
2017-05-17 05:04:38 +00:00
|
|
|
float CScanDisplay::GetDownloadFraction(int idx, float scanningTime) const
|
|
|
|
{
|
|
|
|
if (!x14_scannableInfo)
|
|
|
|
return 0.f;
|
|
|
|
float appearTime = GetDownloadStartTime(idx);
|
|
|
|
float appearRange = x14_scannableInfo->GetBucket(idx).x4_appearanceRange;
|
|
|
|
if (appearTime == appearRange)
|
|
|
|
return 1.f;
|
|
|
|
return zeus::clamp(0.f, (scanningTime - appearTime) / (appearRange - appearTime), 1.f);
|
2017-04-02 03:03:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CScanDisplay::StartScan(TUniqueId id, const CScannableObjectInfo& scanInfo, CGuiTextPane* message,
|
|
|
|
CGuiTextPane* scrollMessage, CGuiWidget* textGroup, CGuiModel* xmark,
|
|
|
|
CGuiModel* abutton, CGuiModel* dash, float scanTime)
|
|
|
|
{
|
2017-05-17 05:04:38 +00:00
|
|
|
x1b4_scanComplete = scanTime >= scanInfo.GetTotalDownloadTime();
|
|
|
|
x14_scannableInfo.emplace(scanInfo);
|
|
|
|
x10_objId = id;
|
|
|
|
xc_state = EScanState::Downloading;
|
|
|
|
x1ac_pageCounter = 0;
|
|
|
|
x1a4_xAlpha = 0.f;
|
|
|
|
xa8_message = message;
|
|
|
|
xac_scrollMessage = scrollMessage;
|
|
|
|
xa4_textGroup = textGroup;
|
|
|
|
xb0_xmark = xmark;
|
|
|
|
xb4_abutton = abutton;
|
|
|
|
xb8_dash = dash;
|
|
|
|
xa4_textGroup->SetVisibility(true, ETraversalMode::Children);
|
|
|
|
xa4_textGroup->SetColor(zeus::CColor(1.f, 0.f));
|
|
|
|
|
|
|
|
for (int i=0 ; i<20 ; ++i)
|
|
|
|
{
|
|
|
|
CAuiImagePane* pane = static_cast<CAuiImagePane*>(
|
|
|
|
xa0_selHud.FindWidget(MP1::CPauseScreenBase::GetImagePaneName(i)));
|
|
|
|
zeus::CColor color = g_tweakGuiColors->GetScanDisplayImagePaneColor();
|
|
|
|
color.a = 0.f;
|
|
|
|
pane->SetColor(color);
|
|
|
|
pane->SetTextureID0(-1, g_SimplePool);
|
|
|
|
pane->SetAnimationParms(zeus::CVector2f::skZero, 0.f, 0.f);
|
|
|
|
int pos = -1;
|
|
|
|
for (int j=0 ; j<4 ; ++j)
|
|
|
|
{
|
|
|
|
if (x14_scannableInfo->GetBucket(j).x8_imagePos == i)
|
|
|
|
{
|
|
|
|
pos = j;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pos >= 0)
|
|
|
|
x170_paneStates[pos].second = pane;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i=0 ; i<x170_paneStates.size() ; ++i)
|
|
|
|
{
|
|
|
|
std::pair<float, CAuiImagePane*>& state = x170_paneStates[i];
|
|
|
|
if (state.second)
|
|
|
|
{
|
|
|
|
const CScannableObjectInfo::SBucket& bucket = x14_scannableInfo->GetBucket(i);
|
|
|
|
if (bucket.x14_interval > 0.f)
|
|
|
|
{
|
|
|
|
state.second->SetAnimationParms(zeus::CVector2f(bucket.xc_size.x, bucket.xc_size.y),
|
|
|
|
bucket.x14_interval, bucket.x18_fadeDuration);
|
|
|
|
}
|
|
|
|
state.second->SetTextureID0(bucket.x0_texture, g_SimplePool);
|
2017-05-18 07:07:49 +00:00
|
|
|
state.second->SetFlashFactor(0.f);
|
2017-05-17 05:04:38 +00:00
|
|
|
if (scanTime >= GetDownloadStartTime(i))
|
|
|
|
x170_paneStates[i].first = 0.f;
|
|
|
|
else
|
|
|
|
x170_paneStates[i].first = -1.f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId strId = x14_scannableInfo->GetStringTableId();
|
2017-11-15 04:12:13 +00:00
|
|
|
if (strId.IsValid())
|
2017-05-17 05:04:38 +00:00
|
|
|
x194_scanStr = g_SimplePool->GetObj({FOURCC('STRG'), strId});
|
2017-04-02 03:03:37 +00:00
|
|
|
|
2017-05-17 05:04:38 +00:00
|
|
|
for (int i=0 ; i<4 ; ++i)
|
|
|
|
{
|
|
|
|
int pos = x14_scannableInfo->GetBucket(i).x8_imagePos;
|
|
|
|
CDataDot& dot = xbc_dataDots[i];
|
|
|
|
if (pos != -1)
|
|
|
|
{
|
|
|
|
if (GetDownloadStartTime(i) - g_tweakGui->GetScanAppearanceDuration() < scanTime)
|
|
|
|
{
|
|
|
|
dot.SetAlpha(0.f);
|
|
|
|
dot.SetDotState(CDataDot::EDotState::Done);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dot.SetDesiredAlpha(1.f);
|
|
|
|
dot.SetDotState(CDataDot::EDotState::Seek);
|
|
|
|
dot.StartTransitionTo(zeus::CVector2f::skZero, FLT_EPSILON);
|
|
|
|
dot.Update(FLT_EPSILON);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dot.SetDotState(CDataDot::EDotState::Hidden);
|
|
|
|
}
|
|
|
|
}
|
2017-04-02 03:03:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CScanDisplay::StopScan()
|
|
|
|
{
|
2017-05-17 05:04:38 +00:00
|
|
|
if (xc_state == EScanState::Done || xc_state == EScanState::Inactive)
|
|
|
|
return;
|
2017-04-02 03:03:37 +00:00
|
|
|
|
2017-05-17 05:04:38 +00:00
|
|
|
xc_state = EScanState::Done;
|
|
|
|
for (int i=0 ; i<4 ; ++i)
|
|
|
|
xbc_dataDots[i].SetDesiredAlpha(0.f);
|
2017-04-08 20:40:36 +00:00
|
|
|
}
|
|
|
|
|
2017-05-17 05:04:38 +00:00
|
|
|
void CScanDisplay::SetScanMessageTypeEffect(CGuiTextPane* pane, bool type)
|
2017-04-08 20:40:36 +00:00
|
|
|
{
|
2017-05-17 05:04:38 +00:00
|
|
|
if (type)
|
2017-05-31 21:26:50 +00:00
|
|
|
pane->TextSupport().SetTypeWriteEffectOptions(true, 0.1f, 60.f);
|
2017-05-17 05:04:38 +00:00
|
|
|
else
|
2017-05-31 21:26:50 +00:00
|
|
|
pane->TextSupport().SetTypeWriteEffectOptions(false, 0.f, 0.f);
|
2017-04-08 20:40:36 +00:00
|
|
|
}
|
|
|
|
|
2017-05-17 05:04:38 +00:00
|
|
|
void CScanDisplay::Update(float dt, float scanningTime)
|
2017-04-08 20:40:36 +00:00
|
|
|
{
|
2017-05-17 05:04:38 +00:00
|
|
|
if (xc_state == EScanState::Inactive)
|
|
|
|
return;
|
2017-04-08 20:40:36 +00:00
|
|
|
|
2017-05-17 05:04:38 +00:00
|
|
|
bool active = false;
|
|
|
|
if (xc_state == EScanState::Done)
|
|
|
|
{
|
|
|
|
x1a8_bodyAlpha = std::max(0.f, x1a8_bodyAlpha - 2.f * dt);
|
|
|
|
if (x1a8_bodyAlpha > 0.f)
|
|
|
|
active = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
active = true;
|
|
|
|
x1a8_bodyAlpha = std::min(x1a8_bodyAlpha + 2.f * dt, 1.f);
|
|
|
|
if (xc_state == EScanState::DownloadComplete)
|
|
|
|
{
|
2017-05-31 21:26:50 +00:00
|
|
|
if (xac_scrollMessage->TextSupport().GetIsTextSupportFinishedLoading())
|
2017-05-17 05:04:38 +00:00
|
|
|
x1a4_xAlpha = std::max(0.f, x1a4_xAlpha - dt);
|
|
|
|
if (x1a4_xAlpha < 0.5f)
|
|
|
|
{
|
|
|
|
x1b0_aPulse += 2.f * dt;
|
|
|
|
if (x1b0_aPulse > 1.f)
|
|
|
|
x1b0_aPulse -= 2.f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (xc_state == EScanState::ViewingScan)
|
|
|
|
{
|
|
|
|
x1b0_aPulse += 2.f * dt;
|
|
|
|
if (x1b0_aPulse > 1.f)
|
|
|
|
x1b0_aPulse -= 2.f;
|
|
|
|
if (x1a4_xAlpha == 1.f)
|
|
|
|
{
|
2017-05-31 21:26:50 +00:00
|
|
|
xa8_message->TextSupport().SetText(x194_scanStr->GetString(0));
|
2017-05-17 05:04:38 +00:00
|
|
|
SetScanMessageTypeEffect(xa8_message, !x1b4_scanComplete);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (xc_state == EScanState::Downloading && scanningTime >= x14_scannableInfo->GetTotalDownloadTime() &&
|
|
|
|
x194_scanStr.IsLoaded())
|
|
|
|
{
|
|
|
|
if (x1b4_scanComplete || x14_scannableInfo->GetCategory() == 0)
|
|
|
|
{
|
|
|
|
xc_state = EScanState::ViewingScan;
|
2018-05-08 05:10:24 +00:00
|
|
|
x1b0_aPulse = x1a4_xAlpha = 1.f;
|
2017-05-17 05:04:38 +00:00
|
|
|
CSfxManager::SfxStart(1417, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-05-08 05:10:24 +00:00
|
|
|
xc_state = EScanState::DownloadComplete;
|
|
|
|
x1b0_aPulse = x1a4_xAlpha = 1.f;
|
2017-05-31 21:26:50 +00:00
|
|
|
xa8_message->TextSupport().SetText(std::u16string(g_MainStringTable->GetString(29)) +
|
2017-05-17 05:04:38 +00:00
|
|
|
g_MainStringTable->GetString(x14_scannableInfo->GetCategory() + 30) +
|
|
|
|
g_MainStringTable->GetString(30));
|
|
|
|
SetScanMessageTypeEffect(xa8_message, true);
|
|
|
|
CSfxManager::SfxStart(1425, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
}
|
2017-04-08 20:40:36 +00:00
|
|
|
|
2017-05-17 05:04:38 +00:00
|
|
|
if (x194_scanStr->GetStringCount() > 2)
|
|
|
|
{
|
2017-05-31 21:26:50 +00:00
|
|
|
xac_scrollMessage->TextSupport().SetText(x194_scanStr->GetString(2), true);
|
2017-05-17 05:04:38 +00:00
|
|
|
SetScanMessageTypeEffect(xac_scrollMessage, !x1b4_scanComplete);
|
|
|
|
}
|
|
|
|
xac_scrollMessage->SetIsVisible(false);
|
|
|
|
}
|
|
|
|
}
|
2017-04-08 20:40:36 +00:00
|
|
|
|
2017-05-17 05:04:38 +00:00
|
|
|
for (int i=0 ; i<4 ; ++i)
|
|
|
|
{
|
|
|
|
if (x170_paneStates[i].second == 0)
|
|
|
|
continue;
|
|
|
|
if (x170_paneStates[i].first > 0.f)
|
|
|
|
{
|
|
|
|
x170_paneStates[i].first = std::max(0.f, x170_paneStates[i].first - dt);
|
|
|
|
float tmp;
|
|
|
|
if (x170_paneStates[i].first > g_tweakGui->GetScanPaneFadeOutTime())
|
|
|
|
tmp = 1.f - (x170_paneStates[i].first - g_tweakGui->GetScanPaneFadeOutTime()) / g_tweakGui->GetScanPaneFadeInTime();
|
|
|
|
else
|
|
|
|
tmp = x170_paneStates[i].first / g_tweakGui->GetScanPaneFadeOutTime();
|
2017-05-18 07:07:49 +00:00
|
|
|
x170_paneStates[i].second->SetFlashFactor(tmp * g_tweakGui->GetScanPaneFlashFactor() * x1a8_bodyAlpha);
|
2017-05-17 05:04:38 +00:00
|
|
|
}
|
|
|
|
float alphaMul = ((xc_state == EScanState::Downloading) ? GetDownloadFraction(i, scanningTime) : 1.f) * x1a8_bodyAlpha;
|
|
|
|
zeus::CColor color = g_tweakGuiColors->GetScanDisplayImagePaneColor();
|
|
|
|
color.a *= alphaMul;
|
|
|
|
x170_paneStates[i].second->SetColor(color);
|
|
|
|
x170_paneStates[i].second->SetDeResFactor(1.f - alphaMul);
|
|
|
|
if (GetDownloadStartTime(i) - g_tweakGui->GetScanAppearanceDuration() < scanningTime)
|
|
|
|
{
|
|
|
|
CDataDot& dot = xbc_dataDots[i];
|
|
|
|
switch (dot.GetDotState())
|
|
|
|
{
|
|
|
|
case CDataDot::EDotState::Seek:
|
|
|
|
case CDataDot::EDotState::Hold:
|
|
|
|
dot.SetDotState(CDataDot::EDotState::RevealPane);
|
|
|
|
dot.StartTransitionTo(zeus::CVector2f::skZero, g_tweakGui->GetScanAppearanceDuration());
|
|
|
|
break;
|
|
|
|
case CDataDot::EDotState::RevealPane:
|
|
|
|
{
|
|
|
|
float tmp = dot.GetTransitionFactor();
|
|
|
|
if (tmp == 0.f)
|
|
|
|
{
|
|
|
|
dot.SetDotState(CDataDot::EDotState::Done);
|
|
|
|
CSfxManager::SfxStart(1414, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
x170_paneStates[i].first = g_tweakGui->GetScanPaneFadeOutTime() + g_tweakGui->GetScanPaneFadeInTime();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i=0 ; i<4 ; ++i)
|
|
|
|
{
|
|
|
|
CDataDot& dot = xbc_dataDots[i];
|
|
|
|
switch (dot.GetDotState())
|
|
|
|
{
|
|
|
|
case CDataDot::EDotState::Hidden:
|
|
|
|
continue;
|
|
|
|
case CDataDot::EDotState::Seek:
|
|
|
|
case CDataDot::EDotState::Hold:
|
|
|
|
{
|
|
|
|
float tmp = dot.GetTransitionFactor();
|
|
|
|
if (tmp == 0.f)
|
|
|
|
{
|
|
|
|
float posRand = g_tweakGui->GetScanDataDotPosRandMagnitude();
|
2017-05-18 07:07:49 +00:00
|
|
|
float durMin = dot.GetDotState() == CDataDot::EDotState::Hold ? g_tweakGui->GetScanDataDotHoldDurationMin() : g_tweakGui->GetScanDataDotSeekDurationMin();
|
|
|
|
float durMax = dot.GetDotState() == CDataDot::EDotState::Hold ? g_tweakGui->GetScanDataDotHoldDurationMax() : g_tweakGui->GetScanDataDotSeekDurationMax();
|
2017-05-17 05:04:38 +00:00
|
|
|
zeus::CVector2f vec(dot.GetDotState() == CDataDot::EDotState::Hold ? dot.GetCurrPosition().x : (posRand * (rand() / float(RAND_MAX)) - 0.5f * posRand),
|
|
|
|
dot.GetDotState() == CDataDot::EDotState::Hold ? dot.GetCurrPosition().y : (posRand * (rand() / float(RAND_MAX)) - 0.5f * posRand));
|
|
|
|
dot.StartTransitionTo(vec, (durMax - durMin) * (rand() / float(RAND_MAX)) + durMin);
|
|
|
|
dot.SetDotState(dot.GetDotState() == CDataDot::EDotState::Hold ? CDataDot::EDotState::Seek : CDataDot::EDotState::Hold);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CDataDot::EDotState::RevealPane:
|
|
|
|
case CDataDot::EDotState::Done:
|
|
|
|
{
|
|
|
|
zeus::CVector3f screenPos = xa0_selHud.GetFrameCamera()->ConvertToScreenSpace(x170_paneStates[i].second->GetWorldPosition());
|
|
|
|
zeus::CVector2f viewportCoords(screenPos.x * g_Viewport.x8_width * 0.5f,
|
|
|
|
screenPos.y * g_Viewport.xc_height * 0.5f);
|
|
|
|
dot.SetDestPosition(viewportCoords);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
dot.Update(dt);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!active)
|
|
|
|
{
|
|
|
|
xc_state = EScanState::Inactive;
|
|
|
|
x10_objId = kInvalidUniqueId;
|
|
|
|
x14_scannableInfo = std::experimental::nullopt;
|
2017-05-31 21:26:50 +00:00
|
|
|
xa8_message->TextSupport().SetText(u"");
|
|
|
|
xac_scrollMessage->TextSupport().SetText(u"");
|
2017-05-17 05:04:38 +00:00
|
|
|
xa4_textGroup->SetVisibility(false, ETraversalMode::Children);
|
|
|
|
xb0_xmark->SetVisibility(false, ETraversalMode::Children);
|
|
|
|
xb4_abutton->SetVisibility(false, ETraversalMode::Children);
|
|
|
|
xb8_dash->SetVisibility(false, ETraversalMode::Children);
|
|
|
|
xa8_message = nullptr;
|
|
|
|
xac_scrollMessage = nullptr;
|
|
|
|
xa4_textGroup = nullptr;
|
|
|
|
xb0_xmark = nullptr;
|
|
|
|
xb4_abutton = nullptr;
|
|
|
|
xb8_dash = nullptr;
|
|
|
|
x170_paneStates.clear();
|
|
|
|
x170_paneStates.resize(4);
|
|
|
|
x194_scanStr = TLockedToken<CStringTable>();
|
|
|
|
x1ac_pageCounter = 0;
|
|
|
|
x1b4_scanComplete = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
xa4_textGroup->SetColor(zeus::CColor(1.f, x1a8_bodyAlpha));
|
|
|
|
}
|
2017-04-08 20:40:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CScanDisplay::Draw() const
|
|
|
|
{
|
2017-05-17 05:04:38 +00:00
|
|
|
if (!x0_dataDot.IsLoaded())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// No Z-test or write
|
|
|
|
g_Renderer->SetViewportOrtho(true, -4096.f, 4096.f);
|
|
|
|
// Additive alpha
|
2017-04-08 20:40:36 +00:00
|
|
|
|
2017-05-17 05:04:38 +00:00
|
|
|
for (const CDataDot& dot : xbc_dataDots)
|
|
|
|
dot.Draw(g_tweakGuiColors->GetScanDataDotColor(), g_tweakGui->GetScanDataDotRadius());
|
2017-04-02 03:03:37 +00:00
|
|
|
}
|
2016-08-15 01:29:07 +00:00
|
|
|
}
|