From ecd36144c814bef03fa6beeb830797e5fe96609d Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 23 Feb 2023 00:31:45 -0800 Subject: [PATCH] Only draw capsule icon for Break the Capsules HUD tracking --- src/k_hud_track.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/k_hud_track.cpp b/src/k_hud_track.cpp index beaaea31f..a39a9a22c 100644 --- a/src/k_hud_track.cpp +++ b/src/k_hud_track.cpp @@ -100,7 +100,10 @@ void K_DrawTargetTracking(const TargetTracking& target) borderDir.y = FRACUNIT; } - targetPatch = kp_capsuletarget_icon[timer & 1]; + if (target.mobj->type == MT_BATTLECAPSULE) + { + targetPatch = kp_capsuletarget_icon[timer & 1]; + } if (abs(borderDir.x) > abs(borderDir.y)) { @@ -143,15 +146,18 @@ void K_DrawTargetTracking(const TargetTracking& target) arrowPos.x = std::clamp(arrowPos.x, borderSize, borderWin.x) * FRACUNIT; arrowPos.y = std::clamp(arrowPos.y, borderSize, borderWin.y) * FRACUNIT; - targetPos.x = arrowPos.x - (arrowDir.x * 12); - targetPos.y = arrowPos.y - (arrowDir.y * 12); + if (targetPatch) + { + targetPos.x = arrowPos.x - (arrowDir.x * 12); + targetPos.y = arrowPos.y - (arrowDir.y * 12); + + targetPos.x -= (targetPatch->width << FRACBITS) >> 1; + targetPos.y -= (targetPatch->height << FRACBITS) >> 1; + } arrowPos.x -= (arrowPatch->width << FRACBITS) >> 1; arrowPos.y -= (arrowPatch->height << FRACBITS) >> 1; - targetPos.x -= (targetPatch->width << FRACBITS) >> 1; - targetPos.y -= (targetPatch->height << FRACBITS) >> 1; - if (arrowDir.x < 0) { arrowPos.x += arrowPatch->width << FRACBITS; @@ -164,7 +170,10 @@ void K_DrawTargetTracking(const TargetTracking& target) arrowFlags |= V_VFLIP; } - V_DrawFixedPatch(targetPos.x, targetPos.y, FRACUNIT, V_SPLITSCREEN, targetPatch, nullptr); + if (targetPatch) + { + V_DrawFixedPatch(targetPos.x, targetPos.y, FRACUNIT, V_SPLITSCREEN, targetPatch, nullptr); + } V_DrawFixedPatch(arrowPos.x, arrowPos.y, FRACUNIT, V_SPLITSCREEN | arrowFlags, arrowPatch, nullptr); }