metaforce/Runtime/GuiSys/CHudDecoInterface.cpp

652 lines
24 KiB
C++
Raw Normal View History

2017-04-02 03:03:37 +00:00
#include "CHudDecoInterface.hpp"
#include "CGuiFrame.hpp"
#include "CGuiTextPane.hpp"
#include "CGuiCamera.hpp"
#include "CGuiModel.hpp"
#include "CAuiEnergyBarT01.hpp"
#include "GameGlobalObjects.hpp"
#include "CSimplePool.hpp"
#include "MP1/CSamusHud.hpp"
#include "TCastTo.hpp"
#include "CGuiWidgetDrawParms.hpp"
namespace urde
{
2017-04-08 20:40:36 +00:00
void IHudDecoInterface::SetReticuleTransform(const zeus::CMatrix3f& xf) {}
void IHudDecoInterface::SetDecoRotation(float angle) {}
void IHudDecoInterface::SetFrameColorValue(float v) {}
void IHudDecoInterface::Draw() const {}
void IHudDecoInterface::ProcessInput(const CFinalInput& input) {}
float IHudDecoInterface::GetHudTextAlpha() const { return 1.f; }
2017-04-02 03:03:37 +00:00
CHudDecoInterfaceCombat::CHudDecoInterfaceCombat(CGuiFrame& selHud)
{
x68_24_visDebug = true;
x68_25_visGame = true;
x6c_camera = selHud.GetFrameCamera();
x2c_camPos = x6c_camera->GetLocalPosition();
x70_basewidget_pivot = selHud.FindWidget("basewidget_pivot");
x74_basewidget_deco = selHud.FindWidget("basewidget_deco");
x78_basewidget_tickdeco0 = selHud.FindWidget("basewidget_tickdeco0");
x7c_basewidget_frame = selHud.FindWidget("basewidget_frame");
x14_pivotPosition = x70_basewidget_pivot->GetIdlePosition();
x78_basewidget_tickdeco0->SetColor(g_tweakGuiColors->GetTickDecoColor());
x38_basePosition = x7c_basewidget_frame->GetLocalPosition();
x44_baseRotation = x7c_basewidget_frame->GetLocalTransform().buildMatrix3f();
}
void CHudDecoInterfaceCombat::UpdateVisibility()
{
bool vis = x68_24_visDebug && x68_25_visGame;
x74_basewidget_deco->SetVisibility(vis, ETraversalMode::Children);
x78_basewidget_tickdeco0->SetVisibility(vis, ETraversalMode::Children);
}
void CHudDecoInterfaceCombat::SetIsVisibleDebug(bool v)
{
x68_24_visDebug = v;
UpdateVisibility();
}
void CHudDecoInterfaceCombat::SetIsVisibleGame(bool v)
{
x68_25_visGame = v;
UpdateVisibility();
}
void CHudDecoInterfaceCombat::SetHudRotation(const zeus::CQuaternion& rot)
{
x4_rotation = rot;
}
void CHudDecoInterfaceCombat::SetHudOffset(const zeus::CVector3f& off)
{
x20_offset = off;
}
void CHudDecoInterfaceCombat::SetDamageTransform(const zeus::CMatrix3f& rotation,
const zeus::CVector3f& position)
{
x7c_basewidget_frame->SetLocalTransform(zeus::CTransform(rotation * x44_baseRotation,
position + x38_basePosition));
}
void CHudDecoInterfaceCombat::SetFrameColorValue(float v)
{
zeus::CColor color = v > 0.f ? zeus::CColor::skWhite : g_tweakGuiColors->GetHudFrameColor();
x7c_basewidget_frame->SetColor(color);
}
void CHudDecoInterfaceCombat::Update(float dt, const CStateManager& stateMgr)
{
x6c_camera->SetO2WTransform(MP1::CSamusHud::BuildFinalCameraTransform(
x4_rotation, x14_pivotPosition + x20_offset, x2c_camPos));
}
2017-04-03 01:39:23 +00:00
void CHudDecoInterfaceCombat::UpdateCameraDebugSettings(float fov, float y, float z)
2017-04-02 03:03:37 +00:00
{
x6c_camera->SetFov(fov);
x2c_camPos.y = y;
x2c_camPos.z = z;
}
void CHudDecoInterfaceCombat::UpdateHudAlpha()
{
zeus::CColor color = zeus::CColor::skWhite;
color.a = g_GameState->GameOptions().GetHUDAlpha() / 255.f;
x70_basewidget_pivot->SetColor(color);
}
CHudDecoInterfaceScan::CHudDecoInterfaceScan(CGuiFrame& selHud)
2017-05-17 05:04:38 +00:00
: x14_selHud(selHud), x18_scanDisplay(selHud)
2017-04-02 03:03:37 +00:00
{
x4_scanHudFlat = g_SimplePool->GetObj("FRME_ScanHudFlat");
x234_sidesPositioner = g_tweakGui->GetScanSidesPositionStart();
x240_24_visDebug = true;
x240_25_visGame = true;
x244_camera = selHud.GetFrameCamera();
x248_basewidget_pivot = selHud.FindWidget("basewidget_pivot");
x24c_basewidget_leftside = selHud.FindWidget("basewidget_leftside");
x250_basewidget_rightside = selHud.FindWidget("basewidget_rightside");
x1f4_pivotPosition = x248_basewidget_pivot->GetIdlePosition();
if (CGuiWidget* deco = selHud.FindWidget("basewidget_deco"))
deco->SetColor(g_tweakGuiColors->GetHudFrameColor());
x218_leftsidePosition = x24c_basewidget_leftside->GetLocalPosition();
zeus::CTransform leftXf(zeus::CMatrix3f::RotateZ(g_tweakGui->GetScanSidesAngle()), x218_leftsidePosition);
x24c_basewidget_leftside->SetLocalTransform(leftXf);
if (CGuiWidget* w = selHud.FindWidget("basewidget_databankl"))
{
zeus::CTransform xf(zeus::CMatrix3f::RotateZ(g_tweakGui->GetScanSidesAngle() * -1.f), w->GetLocalPosition());
w->SetLocalTransform(xf);
}
if (CGuiWidget* w = selHud.FindWidget("basewidget_leftguages"))
{
zeus::CTransform xf(zeus::CMatrix3f(zeus::CVector3f{g_tweakGui->GetScanSidesXScale(), 1.f, 1.f}),
w->GetLocalPosition());
w->SetLocalTransform(xf);
}
x224_rightsidePosition = x250_basewidget_rightside->GetLocalPosition();
zeus::CTransform rightXf(zeus::CMatrix3f::RotateZ(g_tweakGui->GetScanSidesAngle() * -1.f), x224_rightsidePosition);
x250_basewidget_rightside->SetLocalTransform(rightXf);
if (CGuiWidget* w = selHud.FindWidget("basewidget_databankr"))
{
zeus::CTransform xf(zeus::CMatrix3f::RotateZ(g_tweakGui->GetScanSidesAngle()), w->GetLocalPosition());
w->SetLocalTransform(xf);
}
if (CGuiWidget* w = selHud.FindWidget("basewidget_rightguages"))
{
zeus::CTransform xf(zeus::CMatrix3f(zeus::CVector3f{g_tweakGui->GetScanSidesXScale(), 1.f, 1.f}),
w->GetLocalPosition());
w->SetLocalTransform(xf);
}
zeus::CVector3f sidesPos(x234_sidesPositioner, 0.f, 0.f);
x24c_basewidget_leftside->SetLocalPosition(x24c_basewidget_leftside->RotateO2P(
x218_leftsidePosition + sidesPos));
x250_basewidget_rightside->SetLocalPosition(x250_basewidget_rightside->RotateO2P(
x224_rightsidePosition - sidesPos));
UpdateHudAlpha();
}
void CHudDecoInterfaceScan::UpdateVisibility()
{
// Empty
}
void CHudDecoInterfaceScan::SetIsVisibleDebug(bool v)
{
x240_24_visDebug = v;
UpdateVisibility();
}
void CHudDecoInterfaceScan::SetIsVisibleGame(bool v)
{
x240_25_visGame = v;
UpdateVisibility();
}
void CHudDecoInterfaceScan::SetHudRotation(const zeus::CQuaternion& rot)
{
x1e4_rotation = rot;
}
void CHudDecoInterfaceScan::SetHudOffset(const zeus::CVector3f& off)
{
x200_offset = off;
}
void CHudDecoInterfaceScan::SetReticuleTransform(const zeus::CMatrix3f& xf)
{
// Empty
}
void CHudDecoInterfaceScan::SetDamageTransform(const zeus::CMatrix3f& rotation,
const zeus::CVector3f& position)
{
// Empty
}
void CHudDecoInterfaceScan::SetFrameColorValue(float v)
{
// Empty
}
void CHudDecoInterfaceScan::InitializeFlatFrame()
{
x10_loadedScanHudFlat = x4_scanHudFlat.GetObj();
x10_loadedScanHudFlat->GetFrameCamera()->SetO2WTransform(zeus::CTransform::Translate(x20c_camPos));
x258_flat_basewidget_scanguage = x10_loadedScanHudFlat->FindWidget("basewidget_scanguage");
x258_flat_basewidget_scanguage->SetVisibility(false, ETraversalMode::Children);
x254_flat_textpane_scanning = static_cast<CGuiTextPane*>(x10_loadedScanHudFlat->FindWidget("textpane_scanning"));
x25c_flat_energybart01_scanbar = static_cast<CAuiEnergyBarT01*>(x10_loadedScanHudFlat->FindWidget("energybart01_scanbar"));
x264_flat_textpane_message = static_cast<CGuiTextPane*>(x10_loadedScanHudFlat->FindWidget("textpane_message"));
x268_flat_textpane_scrollmessage = static_cast<CGuiTextPane*>(x10_loadedScanHudFlat->FindWidget("textpane_scrollmessage"));
x260_flat_basewidget_textgroup = x10_loadedScanHudFlat->FindWidget("basewidget_textgroup");
x26c_flat_model_xmark = static_cast<CGuiModel*>(x10_loadedScanHudFlat->FindWidget("model_xmark"));
x270_flat_model_abutton = static_cast<CGuiModel*>(x10_loadedScanHudFlat->FindWidget("model_abutton"));
x274_flat_model_dash = static_cast<CGuiModel*>(x10_loadedScanHudFlat->FindWidget("model_dash"));
x260_flat_basewidget_textgroup->SetVisibility(false, ETraversalMode::Children);
x254_flat_textpane_scanning->SetIsVisible(false);
2017-05-31 21:26:50 +00:00
x254_flat_textpane_scanning->TextSupport().SetFontColor(g_tweakGuiColors->GetHudMessageFill());
x254_flat_textpane_scanning->TextSupport().SetOutlineColor(g_tweakGuiColors->GetHudMessageOutline());
2017-04-02 03:03:37 +00:00
x25c_flat_energybart01_scanbar->SetCoordFunc(CAuiEnergyBarT01::DownloadBarCoordFunc);
x25c_flat_energybart01_scanbar->ResetMaxEnergy();
x25c_flat_energybart01_scanbar->SetFilledColor(zeus::CColor(0.4f, 0.68f, 0.88f, 1.f));
x25c_flat_energybart01_scanbar->SetShadowColor(zeus::CColor::skClear);
x25c_flat_energybart01_scanbar->SetEmptyColor(zeus::CColor::skClear);
x25c_flat_energybart01_scanbar->SetFilledDrainSpeed(999.f);
x25c_flat_energybart01_scanbar->SetShadowDrainSpeed(999.f);
x25c_flat_energybart01_scanbar->SetShadowDrainDelay(0.f);
x25c_flat_energybart01_scanbar->SetIsAlwaysResetTimer(false);
x26c_flat_model_xmark->SetVisibility(false, ETraversalMode::Children);
x26c_flat_model_xmark->SetVisibility(false, ETraversalMode::Children);
x270_flat_model_abutton->SetVisibility(false, ETraversalMode::Children);
x274_flat_model_dash->SetVisibility(false, ETraversalMode::Children);
}
const CScannableObjectInfo* CHudDecoInterfaceScan::GetCurrScanInfo(const CStateManager& stateMgr) const
{
2017-04-03 01:39:23 +00:00
if (x1d4_latestScanState == CPlayer::EPlayerScanState::NotScanning)
2017-04-02 03:03:37 +00:00
return nullptr;
if (TCastToConstPtr<CActor> act = stateMgr.GetObjectById(x1d2_latestScanningObject))
return act->GetScannableObjectInfo();
return nullptr;
}
void CHudDecoInterfaceScan::UpdateScanDisplay(const CStateManager& stateMgr, float dt)
{
CPlayer& player = stateMgr.GetPlayer();
CPlayer::EPlayerScanState scanState = player.GetScanningState();
if (scanState != x1d4_latestScanState)
{
if (player.IsNewScanScanning())
{
2017-04-03 01:39:23 +00:00
if (scanState == CPlayer::EPlayerScanState::ScanComplete)
2017-04-02 03:03:37 +00:00
{
2017-04-03 01:39:23 +00:00
if (x1d4_latestScanState == CPlayer::EPlayerScanState::Scanning)
2017-04-02 03:03:37 +00:00
{
// Scan complete
2017-05-31 21:26:50 +00:00
x254_flat_textpane_scanning->TextSupport().SetText(g_MainStringTable->GetString(15));
x254_flat_textpane_scanning->TextSupport().SetTypeWriteEffectOptions(false, 0.f, 40.f);
2017-04-02 03:03:37 +00:00
x238_scanningTextAlpha = 2.f;
}
}
2017-04-03 01:39:23 +00:00
else if (scanState == CPlayer::EPlayerScanState::Scanning)
2017-04-02 03:03:37 +00:00
{
// Scanning
2017-05-31 21:26:50 +00:00
x254_flat_textpane_scanning->TextSupport().SetText(g_MainStringTable->GetString(14));
x254_flat_textpane_scanning->TextSupport().SetTypeWriteEffectOptions(false, 0.f, 40.f);
2017-04-02 03:03:37 +00:00
x238_scanningTextAlpha = 2.f;
}
}
x1d4_latestScanState = scanState;
}
if (player.GetScanningObjectId() != x1d2_latestScanningObject)
x1d2_latestScanningObject = player.GetScanningObjectId();
2017-04-03 01:39:23 +00:00
if (player.GetLockonObjectId() != x1d0_latestHudPoi)
2017-04-02 03:03:37 +00:00
{
2017-04-03 01:39:23 +00:00
x1d0_latestHudPoi = player.GetLockonObjectId();
2017-04-02 03:03:37 +00:00
if (x1d0_latestHudPoi != kInvalidUniqueId)
{
if (!player.ObjectInScanningRange(x1d0_latestHudPoi, stateMgr))
{
// Object out of scanning range
2017-05-31 21:26:50 +00:00
x254_flat_textpane_scanning->TextSupport().SetText(g_MainStringTable->GetString(16));
x254_flat_textpane_scanning->TextSupport().SetTypeWriteEffectOptions(true, 0.f, 40.f);
2017-04-02 03:03:37 +00:00
x238_scanningTextAlpha = 1.f;
}
}
}
const CScannableObjectInfo* scanInfo = GetCurrScanInfo(stateMgr);
2017-05-17 05:04:38 +00:00
if (x1d2_latestScanningObject != x18_scanDisplay.x10_objId || !scanInfo)
2017-04-02 03:03:37 +00:00
{
x18_scanDisplay.StopScan();
2017-05-17 05:04:38 +00:00
if (x18_scanDisplay.xc_state == CScanDisplay::EScanState::Inactive && scanInfo)
2017-04-02 03:03:37 +00:00
{
x18_scanDisplay.StartScan(x1d2_latestScanningObject, *scanInfo, x264_flat_textpane_message,
x268_flat_textpane_scrollmessage, x260_flat_basewidget_textgroup,
x26c_flat_model_xmark, x270_flat_model_abutton, x274_flat_model_dash,
player.GetScanningTime());
}
}
x18_scanDisplay.Update(dt, player.GetScanningTime());
if (x1d2_latestScanningObject != kInvalidUniqueId && GetCurrScanInfo(stateMgr))
if (TCastToConstPtr<CActor> act = stateMgr.GetObjectById(x1d2_latestScanningObject))
if (const CScannableObjectInfo* actScan = act->GetScannableObjectInfo())
x25c_flat_energybart01_scanbar->SetCurrEnergy(x1d8_scanningTime / actScan->GetTotalDownloadTime(),
CAuiEnergyBarT01::ESetMode::Normal);
2017-04-03 01:39:23 +00:00
if (x1d4_latestScanState != CPlayer::EPlayerScanState::Scanning)
2017-04-02 03:03:37 +00:00
if (x1d0_latestHudPoi == kInvalidUniqueId || player.ObjectInScanningRange(x1d0_latestHudPoi, stateMgr))
x238_scanningTextAlpha = std::max(0.f, x238_scanningTextAlpha - dt);
if (x238_scanningTextAlpha > 0.f)
{
zeus::CColor color = zeus::CColor::skWhite;
color.a = std::min(x238_scanningTextAlpha, 1.f);
x254_flat_textpane_scanning->SetColor(color);
x254_flat_textpane_scanning->SetIsVisible(true);
}
else
{
x254_flat_textpane_scanning->SetIsVisible(false);
}
if (GetCurrScanInfo(stateMgr))
x23c_scanBarAlpha = std::min(x23c_scanBarAlpha + 2.f * dt, 1.f);
else
x23c_scanBarAlpha = std::max(0.f, x23c_scanBarAlpha - 2.f * dt);
if (x23c_scanBarAlpha > 0.f)
{
zeus::CColor color = zeus::CColor::skWhite;
color.a = std::min(x23c_scanBarAlpha, 1.f);
x258_flat_basewidget_scanguage->SetColor(color);
x258_flat_basewidget_scanguage->SetVisibility(true, ETraversalMode::Children);
}
else
{
x258_flat_basewidget_scanguage->SetVisibility(false, ETraversalMode::Children);
}
}
void CHudDecoInterfaceScan::Update(float dt, const CStateManager& stateMgr)
{
CPlayer& player = stateMgr.GetPlayer();
CPlayer::EPlayerScanState scanState = player.GetScanningState();
2017-04-03 01:39:23 +00:00
if (scanState != CPlayer::EPlayerScanState::NotScanning)
2017-04-02 03:03:37 +00:00
x1d8_scanningTime = player.GetScanningTime();
2017-04-03 01:39:23 +00:00
if (scanState == CPlayer::EPlayerScanState::Scanning || scanState == CPlayer::EPlayerScanState::ScanComplete)
2017-04-02 03:03:37 +00:00
x230_sidesTimer = std::min(x230_sidesTimer + dt, g_tweakGui->GetScanSidesEndTime());
else
x230_sidesTimer = std::max(0.f, x230_sidesTimer - dt);
float sidesT = x230_sidesTimer < g_tweakGui->GetScanSidesStartTime() ? 0.f :
(x230_sidesTimer - g_tweakGui->GetScanSidesStartTime()) / g_tweakGui->GetScanSidesDuration();
float oldSidesPositioner = x234_sidesPositioner;
x234_sidesPositioner = (1.f - sidesT) * g_tweakGui->GetScanSidesPositionStart() +
sidesT * g_tweakGui->GetScanSidesPositionEnd();
if (oldSidesPositioner != x234_sidesPositioner)
{
zeus::CVector3f sidesPos(x234_sidesPositioner, 0.f, 0.f);
x24c_basewidget_leftside->SetLocalPosition(x24c_basewidget_leftside->RotateO2P(
x218_leftsidePosition + sidesPos));
x250_basewidget_rightside->SetLocalPosition(x250_basewidget_rightside->RotateO2P(
x224_rightsidePosition - sidesPos));
}
x244_camera->SetO2WTransform(
MP1::CSamusHud::BuildFinalCameraTransform(x1e4_rotation, x1f4_pivotPosition + x200_offset, x20c_camPos));
if (!x10_loadedScanHudFlat)
{
if (!x4_scanHudFlat.IsLoaded() || !x4_scanHudFlat->GetIsFinishedLoading())
return;
InitializeFlatFrame();
}
x10_loadedScanHudFlat->Update(dt);
UpdateScanDisplay(stateMgr, dt);
}
void CHudDecoInterfaceScan::Draw() const
{
x18_scanDisplay.Draw();
if (x10_loadedScanHudFlat)
x10_loadedScanHudFlat->Draw(CGuiWidgetDrawParms::Default);
}
void CHudDecoInterfaceScan::ProcessInput(const CFinalInput& input)
{
x18_scanDisplay.ProcessInput(input);
}
2017-04-03 01:39:23 +00:00
void CHudDecoInterfaceScan::UpdateCameraDebugSettings(float fov, float y, float z)
2017-04-02 03:03:37 +00:00
{
x244_camera->SetFov(fov);
x20c_camPos.y = y;
x20c_camPos.z = z;
}
void CHudDecoInterfaceScan::UpdateHudAlpha()
{
zeus::CColor color = zeus::CColor::skWhite;
color.a = g_GameState->GameOptions().GetHUDAlpha() / 255.f;
x248_basewidget_pivot->SetColor(color);
}
2017-04-03 01:39:23 +00:00
float CHudDecoInterfaceScan::GetHudTextAlpha() const
2017-04-02 03:03:37 +00:00
{
2017-05-17 05:04:38 +00:00
return 1.f - std::max(std::min(x238_scanningTextAlpha, 1.f), x18_scanDisplay.x1a8_bodyAlpha);
2017-04-02 03:03:37 +00:00
}
CHudDecoInterfaceXRay::CHudDecoInterfaceXRay(CGuiFrame& selHud)
{
2017-04-03 01:39:23 +00:00
xa0_camera = selHud.GetFrameCamera();
x30_camPos = xa0_camera->GetLocalPosition();
2017-04-02 03:03:37 +00:00
2017-04-03 01:39:23 +00:00
x9c_24_visDebug = true;
x9c_25_visGame = true;
xa4_basewidget_pivot = selHud.FindWidget("basewidget_pivot");
xa8_basewidget_seeker = selHud.FindWidget("basewidget_seeker");
xac_basewidget_rotate = selHud.FindWidget("basewidget_rotate");
if (CGuiWidget* w = selHud.FindWidget("basewidget_energydeco"))
w->SetColor(g_tweakGuiColors->GetXRayEnergyDecoColor());
if (CGuiWidget* w = selHud.FindWidget("model_frame"))
w->SetDepthWrite(true);
if (CGuiWidget* w = selHud.FindWidget("model_frame1"))
w->SetDepthWrite(true);
if (CGuiWidget* w = selHud.FindWidget("model_frame2"))
w->SetDepthWrite(true);
if (CGuiWidget* w = selHud.FindWidget("model_frame3"))
w->SetDepthWrite(true);
if (CGuiWidget* w = selHud.FindWidget("model_misslieslider"))
w->SetDepthWrite(true);
if (CGuiWidget* w = selHud.FindWidget("model_threatslider"))
w->SetDepthWrite(true);
UpdateHudAlpha();
2017-04-02 03:03:37 +00:00
}
void CHudDecoInterfaceXRay::UpdateVisibility()
{
2017-04-03 01:39:23 +00:00
// Empty
2017-04-02 03:03:37 +00:00
}
void CHudDecoInterfaceXRay::SetIsVisibleDebug(bool v)
{
2017-04-03 01:39:23 +00:00
x9c_24_visDebug = v;
UpdateVisibility();
2017-04-02 03:03:37 +00:00
}
void CHudDecoInterfaceXRay::SetIsVisibleGame(bool v)
{
2017-04-03 01:39:23 +00:00
x9c_25_visGame = v;
UpdateVisibility();
2017-04-02 03:03:37 +00:00
}
void CHudDecoInterfaceXRay::SetHudRotation(const zeus::CQuaternion& rot)
{
2017-04-03 01:39:23 +00:00
x8_rotation = rot;
2017-04-02 03:03:37 +00:00
}
void CHudDecoInterfaceXRay::SetHudOffset(const zeus::CVector3f& off)
{
2017-04-03 01:39:23 +00:00
x24_offset = off;
2017-04-02 03:03:37 +00:00
}
void CHudDecoInterfaceXRay::SetReticuleTransform(const zeus::CMatrix3f& xf)
{
2017-04-03 01:39:23 +00:00
x3c_reticuleXf = xf;
2017-04-02 03:03:37 +00:00
}
2017-04-03 01:39:23 +00:00
void CHudDecoInterfaceXRay::SetDecoRotation(float angle)
2017-04-02 03:03:37 +00:00
{
2017-04-03 01:39:23 +00:00
xac_basewidget_rotate->SetLocalTransform(zeus::CTransform(zeus::CMatrix3f::RotateY(angle),
xac_basewidget_rotate->GetLocalPosition()));
2017-04-02 03:03:37 +00:00
}
void CHudDecoInterfaceXRay::SetDamageTransform(const zeus::CMatrix3f& rotation,
const zeus::CVector3f& position)
{
2017-04-03 01:39:23 +00:00
// Empty
2017-04-02 03:03:37 +00:00
}
void CHudDecoInterfaceXRay::SetFrameColorValue(float v)
{
2017-04-03 01:39:23 +00:00
// Empty
2017-04-02 03:03:37 +00:00
}
void CHudDecoInterfaceXRay::Update(float dt, const CStateManager& stateMgr)
{
2017-04-03 01:39:23 +00:00
if (stateMgr.GetPlayer().GetOrbitState() == CPlayer::EPlayerOrbitState::One)
x4_seekerScale = std::max(x4_seekerScale - 3.f * dt, 0.35f);
else
x4_seekerScale = std::min(3.f * dt + x4_seekerScale, 1.f);
xa0_camera->SetO2WTransform(
MP1::CSamusHud::BuildFinalCameraTransform(x8_rotation, x18_pivotPosition + x24_offset, x30_camPos));
2017-04-02 03:03:37 +00:00
2017-04-03 01:39:23 +00:00
xa8_basewidget_seeker->SetLocalTransform(
zeus::CTransform(zeus::CMatrix3f(x4_seekerScale) * x3c_reticuleXf, x60_seekerPosition));
2017-04-02 03:03:37 +00:00
}
2017-04-03 01:39:23 +00:00
void CHudDecoInterfaceXRay::UpdateCameraDebugSettings(float fov, float y, float z)
2017-04-02 03:03:37 +00:00
{
2017-04-03 01:39:23 +00:00
xa0_camera->SetFov(fov);
x30_camPos.y = y;
x30_camPos.z = z;
2017-04-02 03:03:37 +00:00
}
void CHudDecoInterfaceXRay::UpdateHudAlpha()
{
2017-04-03 01:39:23 +00:00
zeus::CColor color = zeus::CColor::skWhite;
color.a = g_GameState->GameOptions().GetHUDAlpha() / 255.f;
xa4_basewidget_pivot->SetColor(color);
2017-04-02 03:03:37 +00:00
}
CHudDecoInterfaceThermal::CHudDecoInterfaceThermal(CGuiFrame& selHud)
{
2017-04-03 01:39:23 +00:00
x70_24_visDebug = true;
x70_25_visGame = true;
x74_camera = selHud.GetFrameCamera();
x2c_camPos = x74_camera->GetLocalPosition();
x78_basewidget_pivot = selHud.FindWidget("basewidget_pivot");
x7c_basewidget_reticle = selHud.FindWidget("basewidget_reticle");
x80_model_retflash = static_cast<CGuiModel*>(selHud.FindWidget("model_retflash"));
x14_pivotPosition = x78_basewidget_pivot->GetIdlePosition();
x5c_reticulePosition = x7c_basewidget_reticle->GetIdlePosition();
if (CGuiWidget* w = selHud.FindWidget("basewidget_deco"))
w->SetColor(g_tweakGuiColors->GetThermalDecoColor());
if (CGuiWidget* w = selHud.FindWidget("basewidget_oultlinesa"))
w->SetColor(g_tweakGuiColors->GetThermalOutlinesColor());
if (CGuiWidget* w = selHud.FindWidget("basewidget_lock"))
w->SetColor(g_tweakGuiColors->GetThermalLockColor());
if (CGuiWidget* w = selHud.FindWidget("basewidget_reticle"))
w->SetColor(g_tweakGuiColors->GetThermalOutlinesColor());
if (CGuiWidget* w = selHud.FindWidget("basewidget_lockon"))
w->SetColor(g_tweakGuiColors->GetThermalOutlinesColor());
2017-04-02 03:03:37 +00:00
2017-04-03 01:39:23 +00:00
if (CGuiWidget* w = selHud.FindWidget("model_threaticon"))
w->SetColor(g_tweakGuiColors->GetThermalOutlinesColor());
if (CGuiWidget* w = selHud.FindWidget("model_missileicon"))
w->SetColor(g_tweakGuiColors->GetThermalOutlinesColor());
if (CGuiWidget* w = selHud.FindWidget("basewidget_lock"))
{
for (CGuiWidget* c = static_cast<CGuiWidget*>(w->GetChildObject()); c;
c = static_cast<CGuiWidget*>(c->GetNextSibling()))
{
x84_lockonWidgets.push_back({c, c->GetLocalTransform()});
c->SetLocalTransform(c->GetLocalTransform() * zeus::CTransform::Scale(x68_lockonScale));
}
}
x14_pivotPosition = x78_basewidget_pivot->GetIdlePosition();
UpdateHudAlpha();
2017-04-02 03:03:37 +00:00
}
void CHudDecoInterfaceThermal::UpdateVisibility()
{
2017-04-03 01:39:23 +00:00
// Empty
2017-04-02 03:03:37 +00:00
}
void CHudDecoInterfaceThermal::SetIsVisibleDebug(bool v)
{
2017-04-03 01:39:23 +00:00
x70_24_visDebug = v;
UpdateVisibility();
2017-04-02 03:03:37 +00:00
}
void CHudDecoInterfaceThermal::SetIsVisibleGame(bool v)
{
2017-04-03 01:39:23 +00:00
x70_25_visGame = v;
UpdateVisibility();
2017-04-02 03:03:37 +00:00
}
void CHudDecoInterfaceThermal::SetHudRotation(const zeus::CQuaternion& rot)
{
2017-04-03 01:39:23 +00:00
x4_rotation = rot;
2017-04-02 03:03:37 +00:00
}
void CHudDecoInterfaceThermal::SetHudOffset(const zeus::CVector3f& off)
{
2017-04-03 01:39:23 +00:00
x20_offset = off;
2017-04-02 03:03:37 +00:00
}
void CHudDecoInterfaceThermal::SetReticuleTransform(const zeus::CMatrix3f& xf)
{
2017-04-03 01:39:23 +00:00
x38_reticuleXf = xf;
2017-04-02 03:03:37 +00:00
}
void CHudDecoInterfaceThermal::SetDamageTransform(const zeus::CMatrix3f& rotation,
const zeus::CVector3f& position)
{
2017-04-03 01:39:23 +00:00
// Empty
2017-04-02 03:03:37 +00:00
}
void CHudDecoInterfaceThermal::Update(float dt, const CStateManager& stateMgr)
{
2017-04-03 01:39:23 +00:00
float oldLockonScale = x68_lockonScale;
if (stateMgr.GetPlayer().GetLockonObjectId() != kInvalidUniqueId)
x68_lockonScale = std::max(x68_lockonScale - 15.f * dt, 1.f);
else
x68_lockonScale = std::min(x68_lockonScale + 15.f * dt, 5.f);
if (oldLockonScale != x68_lockonScale)
for (auto& lockWidget : x84_lockonWidgets)
lockWidget.first->SetLocalTransform(lockWidget.second * zeus::CTransform::Scale(x68_lockonScale));
x6c_retflashTimer += dt;
if (x6c_retflashTimer > 1.f)
x6c_retflashTimer -= 2.f;
2017-04-02 03:03:37 +00:00
2017-04-03 01:39:23 +00:00
zeus::CColor flashColor = zeus::CColor::skWhite;
flashColor.a = std::fabs(x6c_retflashTimer) * 0.5f + 0.5f;
x80_model_retflash->SetColor(flashColor);
x74_camera->SetO2WTransform(
MP1::CSamusHud::BuildFinalCameraTransform(x4_rotation, x14_pivotPosition + x20_offset, x2c_camPos));
x7c_basewidget_reticle->SetLocalTransform(zeus::CTransform(x38_reticuleXf, x5c_reticulePosition));
2017-04-02 03:03:37 +00:00
}
2017-04-03 01:39:23 +00:00
void CHudDecoInterfaceThermal::UpdateCameraDebugSettings(float fov, float y, float z)
2017-04-02 03:03:37 +00:00
{
2017-04-03 01:39:23 +00:00
x74_camera->SetFov(fov);
x2c_camPos.y = y;
x2c_camPos.z = z;
2017-04-02 03:03:37 +00:00
}
void CHudDecoInterfaceThermal::UpdateHudAlpha()
{
2017-04-03 01:39:23 +00:00
zeus::CColor color = zeus::CColor::skWhite;
color.a = g_GameState->GameOptions().GetHUDAlpha() / 255.f;
x78_basewidget_pivot->SetColor(color);
2017-04-02 03:03:37 +00:00
}
}