2017-04-02 03:03:37 +00:00
|
|
|
#include "CHudHelmetInterface.hpp"
|
2017-04-04 05:48:13 +00:00
|
|
|
#include "CGuiFrame.hpp"
|
|
|
|
#include "CGuiCamera.hpp"
|
|
|
|
#include "GameGlobalObjects.hpp"
|
|
|
|
#include "CGameState.hpp"
|
2017-04-02 03:03:37 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
|
|
|
|
CHudHelmetInterface::CHudHelmetInterface(CGuiFrame& helmetFrame)
|
|
|
|
{
|
2017-04-04 05:48:13 +00:00
|
|
|
x3c_24_helmetVisibleDebug = true;
|
|
|
|
x3c_25_helmetVisibleGame = true;
|
|
|
|
x3c_26_glowVisibleDebug = true;
|
|
|
|
x3c_27_glowVisibleGame = true;
|
|
|
|
x40_camera = helmetFrame.GetFrameCamera();
|
|
|
|
x44_BaseWidget_Pivot = helmetFrame.FindWidget("BaseWidget_Pivot");
|
|
|
|
x48_BaseWidget_Helmet = helmetFrame.FindWidget("BaseWidget_Helmet");
|
|
|
|
x4c_BaseWidget_Glow = helmetFrame.FindWidget("BaseWidget_Glow");
|
|
|
|
x50_BaseWidget_HelmetLight = helmetFrame.FindWidget("BaseWidget_HelmetLight");
|
|
|
|
x24_pivotPosition = x44_BaseWidget_Pivot->GetIdlePosition();
|
|
|
|
x50_BaseWidget_HelmetLight->SetColor(g_tweakGuiColors->GetHelmetLightColor());
|
|
|
|
}
|
2017-04-02 03:03:37 +00:00
|
|
|
|
2017-04-04 05:48:13 +00:00
|
|
|
void CHudHelmetInterface::UpdateVisibility()
|
|
|
|
{
|
|
|
|
x48_BaseWidget_Helmet->SetVisibility(x3c_24_helmetVisibleDebug && x3c_25_helmetVisibleGame, ETraversalMode::Children);
|
|
|
|
x4c_BaseWidget_Glow->SetVisibility(x3c_26_glowVisibleDebug && x3c_27_glowVisibleGame, ETraversalMode::Children);
|
2017-04-02 03:03:37 +00:00
|
|
|
}
|
|
|
|
|
2017-04-03 01:39:23 +00:00
|
|
|
void CHudHelmetInterface::Update(float dt)
|
|
|
|
{
|
2017-04-04 05:48:13 +00:00
|
|
|
if (x3c_28_hudLagDirty)
|
|
|
|
{
|
|
|
|
x3c_28_hudLagDirty = false;
|
|
|
|
x44_BaseWidget_Pivot->SetTransform(zeus::CTransform(x0_hudLagRotation, x24_pivotPosition + x30_hudLagPosition));
|
|
|
|
}
|
|
|
|
}
|
2017-04-03 01:39:23 +00:00
|
|
|
|
2017-04-04 05:48:13 +00:00
|
|
|
void CHudHelmetInterface::SetHudLagOffset(const zeus::CVector3f& off)
|
|
|
|
{
|
|
|
|
x30_hudLagPosition = off;
|
|
|
|
x3c_28_hudLagDirty = true;
|
2017-04-03 01:39:23 +00:00
|
|
|
}
|
|
|
|
|
2017-04-04 05:48:13 +00:00
|
|
|
void CHudHelmetInterface::SetHudLagRotation(const zeus::CMatrix3f& rot)
|
2017-04-03 01:39:23 +00:00
|
|
|
{
|
2017-04-04 05:48:13 +00:00
|
|
|
x0_hudLagRotation = rot;
|
|
|
|
x3c_28_hudLagDirty = true;
|
|
|
|
}
|
2017-04-03 01:39:23 +00:00
|
|
|
|
2017-04-04 05:48:13 +00:00
|
|
|
void CHudHelmetInterface::AddHelmetLightValue(float val)
|
|
|
|
{
|
|
|
|
x50_BaseWidget_HelmetLight->SetColor(g_tweakGuiColors->GetHelmetLightColor() + zeus::CColor(val, val));
|
2017-04-03 01:39:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CHudHelmetInterface::UpdateCameraDebugSettings(float fov, float y, float z)
|
|
|
|
{
|
2017-04-04 05:48:13 +00:00
|
|
|
x40_camera->SetFov(fov);
|
|
|
|
x40_camera->SetTransform(zeus::CTransform(x40_camera->GetTransform().buildMatrix3f(), zeus::CVector3f(0.f, y, z)));
|
2017-04-03 01:39:23 +00:00
|
|
|
}
|
|
|
|
|
2017-04-02 03:03:37 +00:00
|
|
|
void CHudHelmetInterface::UpdateHelmetAlpha()
|
|
|
|
{
|
2017-04-04 05:48:13 +00:00
|
|
|
zeus::CColor color = zeus::CColor::skWhite;
|
|
|
|
color.a = g_GameState->GameOptions().GetHelmetAlpha() / 255.f;
|
|
|
|
x44_BaseWidget_Pivot->SetColor(color);
|
|
|
|
}
|
2017-04-02 03:03:37 +00:00
|
|
|
|
2017-04-04 05:48:13 +00:00
|
|
|
void CHudHelmetInterface::SetIsVisibleDebug(bool helmet, bool glow)
|
|
|
|
{
|
|
|
|
x3c_24_helmetVisibleDebug = helmet;
|
|
|
|
x3c_26_glowVisibleDebug = glow;
|
|
|
|
UpdateVisibility();
|
2017-04-02 03:03:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|