2017-04-03 01:39:23 +00:00
|
|
|
#include "CHudBossEnergyInterface.hpp"
|
2017-04-04 05:48:13 +00:00
|
|
|
#include "CGuiFrame.hpp"
|
|
|
|
#include "CAuiEnergyBarT01.hpp"
|
|
|
|
#include "GameGlobalObjects.hpp"
|
|
|
|
#include "CGuiTextPane.hpp"
|
2017-04-03 01:39:23 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
|
2017-04-04 05:48:13 +00:00
|
|
|
CHudBossEnergyInterface::CHudBossEnergyInterface(CGuiFrame& selHud)
|
|
|
|
{
|
|
|
|
x10_24_visible = false;
|
|
|
|
x14_basewidget_bossenergystuff = selHud.FindWidget("basewidget_bossenergystuff");
|
|
|
|
x18_energybart01_bossbar = static_cast<CAuiEnergyBarT01*>(selHud.FindWidget("energybart01_bossbar"));
|
|
|
|
x1c_textpane_boss = static_cast<CGuiTextPane*>(selHud.FindWidget("textpane_boss"));
|
|
|
|
|
|
|
|
x18_energybart01_bossbar->SetCoordFunc(BossEnergyCoordFunc);
|
|
|
|
x18_energybart01_bossbar->SetTesselation(0.2f);
|
|
|
|
ITweakGuiColors::VisorEnergyBarColors barColors = g_tweakGuiColors->GetVisorEnergyBarColors(0);
|
|
|
|
x18_energybart01_bossbar->SetFilledColor(barColors.filled);
|
|
|
|
x18_energybart01_bossbar->SetShadowColor(barColors.shadow);
|
|
|
|
x18_energybart01_bossbar->SetEmptyColor(barColors.empty);
|
|
|
|
}
|
|
|
|
|
2017-04-03 01:39:23 +00:00
|
|
|
void CHudBossEnergyInterface::Update(float dt)
|
|
|
|
{
|
2017-04-04 05:48:13 +00:00
|
|
|
if (x10_24_visible)
|
|
|
|
x4_fader = std::min(x4_fader + dt, 1.f);
|
|
|
|
else
|
|
|
|
x4_fader = std::max(0.f, x4_fader - dt);
|
|
|
|
|
|
|
|
if (x4_fader > 0.f)
|
|
|
|
{
|
|
|
|
zeus::CColor color = zeus::CColor::skWhite;
|
2018-12-08 01:49:15 +00:00
|
|
|
color.a() = x0_alpha * x4_fader;
|
2017-04-04 05:48:13 +00:00
|
|
|
x14_basewidget_bossenergystuff->SetColor(color);
|
|
|
|
x14_basewidget_bossenergystuff->SetVisibility(true, ETraversalMode::Children);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
x14_basewidget_bossenergystuff->SetVisibility(false, ETraversalMode::Children);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-13 06:19:18 +00:00
|
|
|
void CHudBossEnergyInterface::SetBossParams(bool visible, std::u16string_view name,
|
2017-04-04 05:48:13 +00:00
|
|
|
float curEnergy, float maxEnergy)
|
|
|
|
{
|
|
|
|
x10_24_visible = visible;
|
|
|
|
if (visible)
|
|
|
|
{
|
|
|
|
x18_energybart01_bossbar->SetFilledDrainSpeed(maxEnergy);
|
|
|
|
x18_energybart01_bossbar->SetCurrEnergy(curEnergy, CAuiEnergyBarT01::ESetMode::Normal);
|
|
|
|
x18_energybart01_bossbar->SetMaxEnergy(maxEnergy);
|
2017-05-31 21:26:50 +00:00
|
|
|
x1c_textpane_boss->TextSupport().SetText(name);
|
2017-04-04 05:48:13 +00:00
|
|
|
}
|
|
|
|
x8_curEnergy = curEnergy;
|
|
|
|
xc_maxEnergy = maxEnergy;
|
|
|
|
}
|
2017-04-03 01:39:23 +00:00
|
|
|
|
2017-04-04 05:48:13 +00:00
|
|
|
std::pair<zeus::CVector3f, zeus::CVector3f> CHudBossEnergyInterface::BossEnergyCoordFunc(float t)
|
|
|
|
{
|
|
|
|
float x = 9.25f * t - 4.625f;
|
|
|
|
return {zeus::CVector3f(x, 0.f, 0.f), zeus::CVector3f(x, 0.f, 0.4f)};
|
2017-04-03 01:39:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|