From 96eb18a86ef5343c63e7fd75eeb585b6f2881712 Mon Sep 17 00:00:00 2001 From: Alaux <73968015+MrAlaux@users.noreply.github.com> Date: Tue, 5 Dec 2023 06:40:32 -0300 Subject: [PATCH] NUGHUD vertical view offset, and more Also changed `weapheight` range from [0, 200] to [-32, 32]. Additionally, some reformatting. --- CHANGELOG.md | 6 ++++-- docs/nughud.lmp | 5 ++++- docs/nughud.md | 6 +++--- src/hu_stuff.c | 3 +++ src/m_nughud.c | 3 ++- src/m_nughud.h | 1 + src/r_main.c | 3 +++ src/st_stuff.c | 9 +++------ 8 files changed, 23 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 197d9fc8d..99af20250 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,8 @@ - **Minimap mode for Automap** - **NUGHUD:** - Ammo and Health icons; - - Toggle to apply patch offsets. + - Toggle to apply patch offsets; + - Vertical view offset setting. - **Further Extended HUD color customization** - **_Show Kills Percentage [in Stats display]_** setting - **Made the following cheats bindable to keys:** @@ -28,7 +29,8 @@ - **NUGHUD:** - Let Ammo, Health and Armor icons fall back to vanilla sprites; - Made Patches and icons alignable horizontally and vertically; - - Disabled Armor icon by default. + - Disabled Armor icon by default; + - Changed `weapheight` range from [0, 200] to [-32, 32]. - **Speed of non-Melt wipes is now independent of resolution** - **Implemented Teleporter Zoom for multiplayer respawning** - **Applied interpolation for Chasecam speed effect** diff --git a/docs/nughud.lmp b/docs/nughud.lmp index c991df08b..1f9ee75bc 100644 --- a/docs/nughud.lmp +++ b/docs/nughud.lmp @@ -219,5 +219,8 @@ nughud_percents 1 ; Apply graphic offsets when drawing Patches nughud_patch_offsets 1 -; Upwards offset to apply to weapon sprites +; Vertical offset for weapon sprites nughud_weapheight 0 + +; Vertical offset for view window +nughud_viewoffset 0 diff --git a/docs/nughud.md b/docs/nughud.md index 63f87cc93..79fad717a 100644 --- a/docs/nughud.md +++ b/docs/nughud.md @@ -202,10 +202,10 @@ nughud_patch2_wide 0 nughud_patch2_name "STARMS" ``` -### Miscellaneous +### Additional integer properties -**There is an additional fixed-point property, `nughud_weapheight`, to increase the height at which weapon sprites are drawn**. -It can be any value between `0` and `200` (inclusive). +- `nughud_weapheight`: **vertical offset for weapon sprites**, in the [-32, 32] range; greater values shift the sprites upwards. +- `nughud_viewoffset`: **vertical offset for the view window**, in the [-16, 16] range; greater values shift the view downwards. --- diff --git a/src/hu_stuff.c b/src/hu_stuff.c index d4642eb46..cd756a903 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1544,6 +1544,9 @@ static void HU_UpdateCrosshair(void) { crosshair.x = ORIGWIDTH/2; crosshair.y = (screenblocks <= 10) ? (ORIGHEIGHT-ST_HEIGHT)/2 : ORIGHEIGHT/2; + + // [Nugget] + crosshair.y += STRICTMODE(st_crispyhud) ? nughud.viewoffset : 0; crosshair.side = 0; if (STRICTMODE(hud_crosshair_target || hud_crosshair_lockon)) diff --git a/src/m_nughud.c b/src/m_nughud.c index 59824b75b..9d1d9b2c5 100644 --- a/src/m_nughud.c +++ b/src/m_nughud.c @@ -121,7 +121,8 @@ default_t nughud_defaults[] = { TOGGLE( "nughud_percents", nughud.percents, 1 ), TOGGLE( "nughud_patch_offsets", nughud.patch_offsets, 1 ), - { "nughud_weapheight", (config_t *)&nughud.weapheight, NULL, { 0 }, { 0, 200 }, number }, + { "nughud_weapheight", (config_t *)&nughud.weapheight, NULL, { 0 }, { -32, 32 }, number }, + { "nughud_viewoffset", (config_t *)&nughud.viewoffset, NULL, { 0 }, { -16, 16 }, number }, { NULL } // last entry }; diff --git a/src/m_nughud.h b/src/m_nughud.h index ba89921a9..ec56dc58f 100644 --- a/src/m_nughud.h +++ b/src/m_nughud.h @@ -77,6 +77,7 @@ typedef struct nughud_s { boolean percents; fixed_t weapheight; + int viewoffset; } nughud_t; extern nughud_t nughud; diff --git a/src/r_main.c b/src/r_main.c index 73b855bb0..5ddd74c4f 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -31,6 +31,7 @@ #include "st_stuff.h" #include "hu_stuff.h" // [Nugget] +#include "m_nughud.h" #include "m_random.h" #include "p_map.h" #include "p_mobj.h" @@ -886,6 +887,8 @@ void R_SetupFrame (player_t *player) // [Nugget] Mitigate `PLAYER_SLOPE()` and `lookdir` misalignment pitch *= FOVDIFF2; + if (STRICTMODE(st_crispyhud)) { pitch += nughud.viewoffset; } // [Nugget] NUGHUD + // [Nugget] Explosion shake effect chasecamheight = chasecam_height * FRACUNIT; if (shake > 0) diff --git a/src/st_stuff.c b/src/st_stuff.c index 5145f6761..cbd0bf72c 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1197,18 +1197,15 @@ void ST_Drawer(boolean fullscreen, boolean refresh) st_classicstatusbar = st_statusbaron && !st_crispyhud; st_statusbarface = st_classicstatusbar || (st_crispyhud && nughud.face.x > -1); - // [Nugget] NUGHUD /-------------------------------------------------------- - + // [Nugget] NUGHUD if (oldcrispy != st_crispyhud) { ST_createWidgets(); ST_updateWidgets(); HU_Start(); - } - - oldcrispy = st_crispyhud; - // [Nugget] ---------------------------------------------------------------/ + oldcrispy = st_crispyhud; + } ST_doPaletteStuff(); // Do red-/gold-shifts from damage/items