MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / GUI_Sidebar_TroopList_Draw

Method GUI_Sidebar_TroopList_Draw

Source/GUI_Element.cpp:198–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196
197
198void cFodder::GUI_Sidebar_TroopList_Draw() {
199
200 int16 Data0 = 0;
201 int8 Data4 = mSquads_TroopCount[mGUI_Loop_Squad_Current];
202 int16 DataC = mGUI_Loop_Draw_Y;
203
204 int8 Data4_Saved = Data4;
205
206 DataC += 0x22;
207 Data4 -= 1;
208 if (Data4 < 0)
209 goto loc_2F1BC;
210
211 for (; Data4 >= 0; --Data4) {
212
213 if (!mGUI_Loop_Is_CurrentSquad)
214 Data0 = 0xAB;
215 else
216 Data0 = 0xA9;
217
218 mGraphics->Sidebar_Copy_Sprite_To_ScreenBufPtr(Data0, 0, DataC);
219 DataC += 0x0C;
220 }
221loc_2F1BC:;
222
223 mGUI_Squad_NextDraw_Y = DataC;
224 Data4 = Data4_Saved;
225 if (Data4 < 0)
226 return;
227
228 mSidebar_Draw_Y = mGUI_Loop_Draw_Y + 0x22;
229
230 // Loop the squad
231 for (auto& Troop : mGame_Data.mSoldiers_Allocated) {
232
233 sSprite* Data34 = Troop.mSprite;
234
235 if (Data34 == INVALID_SPRITE_PTR || Data34 == 0)
236 continue;
237
238 if (mGUI_Loop_Squad_Current != Data34->field_32)
239 continue;
240
241 // If sliding, or entering a vehicle, or invincible
242 if (Data34->field_38 >= eSprite_Anim_Slide1 || (Data34->field_75 & eSprite_Flag_Invincibility))
243 goto loc_2F25C;
244
245 // If hit/dying, no longer render the troop name
246 if (Data34->field_38 != eSprite_Anim_None)
247 continue;
248
249 loc_2F25C:;
250
251 mGraphics->Sidebar_Copy_Sprite_To_ScreenBufPtr(Troop.mRank + 9, 0x00, mSidebar_Draw_Y);
252 mGraphics->Sidebar_Copy_Sprite_To_ScreenBufPtr(Troop.mRank + 9, 0x23, mSidebar_Draw_Y);
253
254 const sRecruit* Data28 = &mRecruits[Troop.mRecruitID];
255 if (!mGUI_Loop_Is_CurrentSquad)

Callers

nothing calls this directly

Tested by

no test coverage detected