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

Commit 36b22f9

Browse files
committed
Fix AHuman::DrawHud not checking for arms
1 parent 3fbebc3 commit 36b22f9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Entities/AHuman.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4316,9 +4316,8 @@ void AHuman::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whichSc
43164316
}
43174317
// Held-related GUI stuff
43184318
else if (m_pFGArm || m_pBGArm) {
4319-
HDFirearm *fgHeldFirearm = dynamic_cast<HDFirearm *>(m_pFGArm->GetHeldDevice());
4320-
MovableObject *bgHeldItem = GetEquippedBGItem();
4321-
const HDFirearm *bgHeldFirearm = dynamic_cast<HDFirearm *>(bgHeldItem);
4319+
HDFirearm *fgHeldFirearm = dynamic_cast<HDFirearm *>(GetEquippedItem());
4320+
HDFirearm *bgHeldFirearm = dynamic_cast<HDFirearm *>(GetEquippedBGItem());
43224321

43234322
if (fgHeldFirearm || bgHeldFirearm) {
43244323
str[0] = -56; str[1] = 0;
@@ -4335,7 +4334,7 @@ void AHuman::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whichSc
43354334
}
43364335
}
43374336

4338-
if (bgHeldItem && bgHeldFirearm) {
4337+
if (bgHeldFirearm) {
43394338
std::string bgWeaponString;
43404339
if (bgHeldFirearm->IsReloading()) {
43414340
bgWeaponString = "Reloading";
@@ -4367,7 +4366,7 @@ void AHuman::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whichSc
43674366
m_HUDStack -= 11;
43684367
}
43694368
*/
4370-
std::string equippedItemsString = (m_pFGArm->HoldsSomething() ? m_pFGArm->GetHeldMO()->GetPresetName() : "EMPTY") + (m_pBGArm->HoldsSomething() ? " | " + m_pBGArm->GetHeldMO()->GetPresetName() : "");
4369+
std::string equippedItemsString = (m_pFGArm && m_pFGArm->HoldsSomething() ? m_pFGArm->GetHeldMO()->GetPresetName() : "EMPTY") + (m_pBGArm && m_pBGArm->HoldsSomething() ? " | " + m_pBGArm->GetHeldMO()->GetPresetName() : "");
43714370
pSmallFont->DrawAligned(&allegroBitmap, drawPos.GetFloorIntX() + 1, drawPos.GetFloorIntY() + m_HUDStack + 3, equippedItemsString, GUIFont::Centre);
43724371
m_HUDStack -= 9;
43734372
/*

0 commit comments

Comments
 (0)