MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / update

Method update

src/SB/Core/x/xHudUnitMeter.cpp:82–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82void xhud::unit_meter_widget::update(F32 dt)
83{
84 meter_widget::updater(dt);
85
86 if (!widget::visible() || this->rc.a <= (5.0f / 255.0f))
87 {
88 return;
89 }
90
91 anim_time += dt;
92
93 S32 units = 0.5f + max_value;
94 if (units > 6)
95 {
96 units = 6;
97 }
98
99 for (S32 i = 0; i < units; i++) {
100 S32 which = 0;
101 if ((res.fill_forward && value >= i + 1) || (!res.fill_forward && value >= units - i))
102 {
103 which = 1;
104 }
105
106 xModelInstance* m = model[i][which];
107 if (m != NULL && m->Anim != NULL && !(m->Anim->Single->State->Data->Duration <= 0.0f))
108 {
109 // TODO: Float ops aren't quite right
110 F32 duration = i * 0.1f + anim_time;
111 if (duration > m->Anim->Single->State->Data->Duration) {
112 duration = xfmod(duration, m->Anim->Single->State->Data->Duration);
113 }
114
115 m->Anim->Single->Time = duration;
116 xModelEval(m);
117 }
118 }
119}
120
121void xhud::unit_meter_widget::render()
122{

Callers

nothing calls this directly

Calls 2

xModelEvalFunction · 0.85
updaterFunction · 0.50

Tested by

no test coverage detected