fix crosshair target lock-on on voxel models (#1812)

Fixes #1811
This commit is contained in:
Fabian Greffrath 2024-08-02 17:32:56 +02:00 committed by GitHub
parent 60d9deae96
commit bf163d8f3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,6 +17,7 @@
#include "doomstat.h" #include "doomstat.h"
#include "doomtype.h" #include "doomtype.h"
#include "hu_crosshair.h"
#include "i_printf.h" #include "i_printf.h"
#include "i_video.h" #include "i_video.h"
#include "info.h" #include "info.h"
@ -707,6 +708,18 @@ boolean VX_ProjectVoxel (mobj_t * thing)
vis->brightmap = R_BrightmapForSprite(thing->sprite); vis->brightmap = R_BrightmapForSprite(thing->sprite);
vis->color = thing->bloodcolor; vis->color = thing->bloodcolor;
// [Alaux] Lock crosshair on target
if (STRICTMODE(hud_crosshair_lockon) && thing == crosshair_target)
{
HU_UpdateCrosshairLock
(
BETWEEN(0, viewwidth - 1, (centerxfrac + FixedMul(tx, xscale)) >> FRACBITS),
BETWEEN(0, viewheight - 1, (centeryfrac + FixedMul(viewz - gz - crosshair_target->actualheight/2, xscale)) >> FRACBITS)
);
crosshair_target = NULL; // Don't update it again until next tic
}
return true; return true;
} }