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 {
|
||||
if (!xbc_tex || !xbc_tex.IsLoaded() || !xd8_coordFunc)
|
||||
if (!xbc_tex || !xbc_tex.IsLoaded() || !xd8_coordFunc) {
|
||||
return;
|
||||
}
|
||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(fmt("CAuiEnergyBarT01::Draw {}"), m_name).c_str(), zeus::skCyan);
|
||||
|
||||
CGraphics::SetModelMatrix(x34_worldXF);
|
||||
const_cast<CEnergyBarShader&>(m_energyBarShader).updateModelMatrix();
|
||||
|
||||
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 filledT = xe0_maxEnergy > 0.f ? xf8_filledEnergy / xe0_maxEnergy : 0.f;
|
||||
const float shadowT = xe0_maxEnergy > 0.f ? xfc_shadowEnergy / xe0_maxEnergy : 0.f;
|
||||
|
||||
zeus::CColor filledColor = xd0_filledColor;
|
||||
filledColor.a() *= drawParms.x0_alphaMod;
|
||||
|
@ -76,7 +77,7 @@ void CAuiEnergyBarT01::Draw(const CGuiWidgetDrawParms& drawParms) const {
|
|||
emptyColor.a() *= drawParms.x0_alphaMod;
|
||||
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];
|
||||
verts.clear();
|
||||
|
||||
|
@ -98,8 +99,9 @@ void CAuiEnergyBarT01::Draw(const CGuiWidgetDrawParms& drawParms) const {
|
|||
break;
|
||||
}
|
||||
|
||||
if (start == end)
|
||||
if (start == end) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::pair<zeus::CVector3f, zeus::CVector3f> coords = xd8_coordFunc(start);
|
||||
while (start < end) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
|
@ -38,7 +39,7 @@ private:
|
|||
float xfc_shadowEnergy = 0.f;
|
||||
float x100_shadowDrainDelayTimer = 0.f;
|
||||
CEnergyBarShader m_energyBarShader;
|
||||
std::vector<CEnergyBarShader::Vertex> m_verts[3];
|
||||
std::array<std::vector<CEnergyBarShader::Vertex>, 3> m_verts;
|
||||
|
||||
public:
|
||||
CAuiEnergyBarT01(const CGuiWidgetParms& parms, CSimplePool* sp, CAssetId txtrId);
|
||||
|
|
Loading…
Reference in New Issue