Skip to content

Commit

Permalink
Fix crosshair jumping due to view offset
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlaux committed May 7, 2024
1 parent c4f4ec8 commit 8bb7acf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@
- **_Show Stats/Time_ toggle affecting Automap instead of HUD when on Minimap**
- **NUGHUD view offset behaving incorrectly** (should now match pre-3.0.0 behavior) [1]
- **_Cycle Chasecam_ and _Toggle Crosshair_ inputs eating inputs**
- **Crosshair jumping vertically when changing screen size to Status Bar from NUGHUD with view offset**

**[1].** This may affect existing NUGHUDs.
12 changes: 6 additions & 6 deletions src/hu_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1682,9 +1682,6 @@ static void HU_UpdateCrosshair(void)
crosshair.x = SCREENWIDTH/2;
crosshair.y = (screenblocks <= 10) ? (SCREENHEIGHT-ST_HEIGHT)/2 : SCREENHEIGHT/2;

// [Nugget] NUGHUD
crosshair.y += STRICTMODE(st_crispyhud) ? nughud.viewoffset : 0;

crosshair.side = 0; // [Nugget] Horizontal-autoaim indicators

if (hud_crosshair_health)
Expand Down Expand Up @@ -1766,23 +1763,26 @@ void HU_DrawCrosshair(void)
return;
}

// [Nugget] NUGHUD
const int y = crosshair.y + (nughud.viewoffset * STRICTMODE(st_crispyhud));

if (crosshair.patch)
V_DrawPatchTranslated(crosshair.x - crosshair.w,
crosshair.y - crosshair.h,
y - crosshair.h,
crosshair.patch, crosshair.cr);

// [Nugget] Horizontal-autoaim indicators ----------------------------------

if (crosshair.side == -1)
{
V_DrawPatchTranslated(crosshair.x - crosshair.w - crosshair.lw,
crosshair.y - crosshair.lh,
y - crosshair.lh,
crosshair.patchl, crosshair.cr);
}
else if (crosshair.side == 1)
{
V_DrawPatchTranslated(crosshair.x + crosshair.w,
crosshair.y - crosshair.rh,
y - crosshair.rh,
crosshair.patchr, crosshair.cr);
}
}
Expand Down

0 comments on commit 8bb7acf

Please sign in to comment.