Skip to content

Commit

Permalink
NUGHUD vertical view offset, and more
Browse files Browse the repository at this point in the history
Also changed `weapheight` range from [0, 200] to [-32, 32].

Additionally, some reformatting.
  • Loading branch information
MrAlaux committed Dec 5, 2023
1 parent f4442cb commit 96eb18a
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 13 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:**
Expand All @@ -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**
Expand Down
5 changes: 4 additions & 1 deletion docs/nughud.lmp
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions docs/nughud.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

---

Expand Down
3 changes: 3 additions & 0 deletions src/hu_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
3 changes: 2 additions & 1 deletion src/m_nughud.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
1 change: 1 addition & 0 deletions src/m_nughud.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ typedef struct nughud_s {

boolean percents;
fixed_t weapheight;
int viewoffset;
} nughud_t;

extern nughud_t nughud;
Expand Down
3 changes: 3 additions & 0 deletions src/r_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
9 changes: 3 additions & 6 deletions src/st_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 96eb18a

Please sign in to comment.