HUD tracking: cull 20x10 blocks (previously 20x20)

This commit is contained in:
James R 2024-01-25 22:01:32 -08:00
parent 8ac2efe82c
commit 5ef2df577a

View file

@ -578,9 +578,10 @@ void K_DrawTargetTracking(const TargetTracking& target)
void K_CullTargetList(std::vector<TargetTracking>& targetList) void K_CullTargetList(std::vector<TargetTracking>& targetList)
{ {
constexpr int kBlockSize = 20; constexpr int kBlockWidth = 20;
constexpr int kXBlocks = BASEVIDWIDTH / kBlockSize; constexpr int kBlockHeight = 10;
constexpr int kYBlocks = BASEVIDHEIGHT / kBlockSize; constexpr int kXBlocks = BASEVIDWIDTH / kBlockWidth;
constexpr int kYBlocks = BASEVIDHEIGHT / kBlockHeight;
bool map[kXBlocks][kYBlocks] = {}; bool map[kXBlocks][kYBlocks] = {};
constexpr fixed_t kTrackerRadius = 30*FRACUNIT/2; // just an approximation of common HUD tracker constexpr fixed_t kTrackerRadius = 30*FRACUNIT/2; // just an approximation of common HUD tracker
@ -602,10 +603,10 @@ void K_CullTargetList(std::vector<TargetTracking>& targetList)
return; return;
} }
fixed_t x1 = std::max(((tr.result.x - kTrackerRadius) / kBlockSize) / FRACUNIT, 0); fixed_t x1 = std::max(((tr.result.x - kTrackerRadius) / kBlockWidth) / FRACUNIT, 0);
fixed_t x2 = std::min(((tr.result.x + kTrackerRadius) / kBlockSize) / FRACUNIT, kXBlocks - 1); fixed_t x2 = std::min(((tr.result.x + kTrackerRadius) / kBlockWidth) / FRACUNIT, kXBlocks - 1);
fixed_t y1 = std::max(((tr.result.y - kTrackerRadius) / kBlockSize) / FRACUNIT, 0); fixed_t y1 = std::max(((tr.result.y - kTrackerRadius) / kBlockHeight) / FRACUNIT, 0);
fixed_t y2 = std::min(((tr.result.y + kTrackerRadius) / kBlockSize) / FRACUNIT, kYBlocks - 1); fixed_t y2 = std::min(((tr.result.y + kTrackerRadius) / kBlockHeight) / FRACUNIT, kYBlocks - 1);
bool allMine = true; bool allMine = true;
@ -624,10 +625,10 @@ void K_CullTargetList(std::vector<TargetTracking>& targetList)
if (cv_debughudtracker.value) if (cv_debughudtracker.value)
{ {
V_DrawFill( V_DrawFill(
x * kBlockSize, x * kBlockWidth,
y * kBlockSize, y * kBlockHeight,
kBlockSize, kBlockWidth,
kBlockSize, kBlockHeight,
(39 + debugColorCycle) | V_SPLITSCREEN (39 + debugColorCycle) | V_SPLITSCREEN
); );
} }