mirror of https://github.com/AxioDL/metaforce.git
CAuiEnergyBarT01: Make use of std::array where applicable
Same behavior, but allows dehardcoding array sizes.
This commit is contained in:
parent
e534f00706
commit
fa6006003d
|
@ -54,15 +54,16 @@ void CAuiEnergyBarT01::Update(float dt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAuiEnergyBarT01::Draw(const CGuiWidgetDrawParms& drawParms) const {
|
void CAuiEnergyBarT01::Draw(const CGuiWidgetDrawParms& drawParms) const {
|
||||||
if (!xbc_tex || !xbc_tex.IsLoaded() || !xd8_coordFunc)
|
if (!xbc_tex || !xbc_tex.IsLoaded() || !xd8_coordFunc) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(fmt("CAuiEnergyBarT01::Draw {}"), m_name).c_str(), zeus::skCyan);
|
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(fmt("CAuiEnergyBarT01::Draw {}"), m_name).c_str(), zeus::skCyan);
|
||||||
|
|
||||||
CGraphics::SetModelMatrix(x34_worldXF);
|
CGraphics::SetModelMatrix(x34_worldXF);
|
||||||
const_cast<CEnergyBarShader&>(m_energyBarShader).updateModelMatrix();
|
const_cast<CEnergyBarShader&>(m_energyBarShader).updateModelMatrix();
|
||||||
|
|
||||||
float filledT = xe0_maxEnergy > 0.f ? xf8_filledEnergy / xe0_maxEnergy : 0.f;
|
const float filledT = xe0_maxEnergy > 0.f ? xf8_filledEnergy / xe0_maxEnergy : 0.f;
|
||||||
float shadowT = xe0_maxEnergy > 0.f ? xfc_shadowEnergy / xe0_maxEnergy : 0.f;
|
const float shadowT = xe0_maxEnergy > 0.f ? xfc_shadowEnergy / xe0_maxEnergy : 0.f;
|
||||||
|
|
||||||
zeus::CColor filledColor = xd0_filledColor;
|
zeus::CColor filledColor = xd0_filledColor;
|
||||||
filledColor.a() *= drawParms.x0_alphaMod;
|
filledColor.a() *= drawParms.x0_alphaMod;
|
||||||
|
@ -76,7 +77,7 @@ void CAuiEnergyBarT01::Draw(const CGuiWidgetDrawParms& drawParms) const {
|
||||||
emptyColor.a() *= drawParms.x0_alphaMod;
|
emptyColor.a() *= drawParms.x0_alphaMod;
|
||||||
emptyColor *= xa8_color2;
|
emptyColor *= xa8_color2;
|
||||||
|
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (size_t i = 0; i < m_verts.size(); ++i) {
|
||||||
std::vector<CEnergyBarShader::Vertex>& verts = const_cast<CAuiEnergyBarT01&>(*this).m_verts[i];
|
std::vector<CEnergyBarShader::Vertex>& verts = const_cast<CAuiEnergyBarT01&>(*this).m_verts[i];
|
||||||
verts.clear();
|
verts.clear();
|
||||||
|
|
||||||
|
@ -98,8 +99,9 @@ void CAuiEnergyBarT01::Draw(const CGuiWidgetDrawParms& drawParms) const {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (start == end)
|
if (start == end) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
std::pair<zeus::CVector3f, zeus::CVector3f> coords = xd8_coordFunc(start);
|
std::pair<zeus::CVector3f, zeus::CVector3f> coords = xd8_coordFunc(start);
|
||||||
while (start < end) {
|
while (start < end) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <array>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -38,7 +39,7 @@ private:
|
||||||
float xfc_shadowEnergy = 0.f;
|
float xfc_shadowEnergy = 0.f;
|
||||||
float x100_shadowDrainDelayTimer = 0.f;
|
float x100_shadowDrainDelayTimer = 0.f;
|
||||||
CEnergyBarShader m_energyBarShader;
|
CEnergyBarShader m_energyBarShader;
|
||||||
std::vector<CEnergyBarShader::Vertex> m_verts[3];
|
std::array<std::vector<CEnergyBarShader::Vertex>, 3> m_verts;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CAuiEnergyBarT01(const CGuiWidgetParms& parms, CSimplePool* sp, CAssetId txtrId);
|
CAuiEnergyBarT01(const CGuiWidgetParms& parms, CSimplePool* sp, CAssetId txtrId);
|
||||||
|
|
Loading…
Reference in New Issue