Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 79d58e7

Browse files
committed
Fix multiple reload bars being improperly offset for ACrabs
1 parent 150a4e4 commit 79d58e7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Entities/ACrab.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2768,10 +2768,11 @@ void ACrab::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whichScr
27682768
for (const HeldDevice *mountedDevice : m_pTurret->GetMountedDevices()) {
27692769
if (const HDFirearm *mountedFirearm = dynamic_cast<const HDFirearm *>(mountedDevice)) {
27702770
if (!textString.empty()) { textString += " | "; }
2771+
int totalTextWidth = pSmallFont->CalculateWidth(textString);
27712772
if (mountedFirearm->IsReloading()) {
27722773
textString += "Reloading";
2773-
rectfill(pTargetBitmap, drawPos.GetFloorIntX() + 1, drawPos.GetFloorIntY() + m_HUDStack + 13, drawPos.GetFloorIntX() + 29, drawPos.GetFloorIntY() + m_HUDStack + 14, 245);
2774-
rectfill(pTargetBitmap, drawPos.GetFloorIntX(), drawPos.GetFloorIntY() + m_HUDStack + 12, drawPos.GetFloorIntX() + static_cast<int>(28.0F * mountedFirearm->GetReloadProgress() + 0.5F), drawPos.GetFloorIntY() + m_HUDStack + 13, 77);
2774+
rectfill(pTargetBitmap, drawPos.GetFloorIntX() + 1 + totalTextWidth, drawPos.GetFloorIntY() + m_HUDStack + 13, drawPos.GetFloorIntX() + 29 + totalTextWidth, drawPos.GetFloorIntY() + m_HUDStack + 14, 245);
2775+
rectfill(pTargetBitmap, drawPos.GetFloorIntX() + totalTextWidth, drawPos.GetFloorIntY() + m_HUDStack + 12, drawPos.GetFloorIntX() + static_cast<int>(28.0F * mountedFirearm->GetReloadProgress() + 0.5F) + totalTextWidth, drawPos.GetFloorIntY() + m_HUDStack + 13, 77);
27752776
} else {
27762777
textString += mountedFirearm->GetRoundInMagCount() < 0 ? "Infinite" : std::to_string(mountedFirearm->GetRoundInMagCount());
27772778
}

0 commit comments

Comments
 (0)