Skip to content

Commit

Permalink
Fix slowmo pitch decrease, and more
Browse files Browse the repository at this point in the history
More specifically, fixed the slow-motion pitch decrease being affected by `pitch_bend_range`.
Also tweaked NUGHUD guide.
  • Loading branch information
MrAlaux committed Nov 8, 2024
1 parent ff41be5 commit 07f6f1c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/nughud.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Text lines will inherit the properties of the stack they belong to.
**Stacks make use of all the shared properties, and are alignable both horizontally and vertically.**

The _Message_ and _Chat_ displays will always be drawn first in whichever stack they're assigned to,
and will also be assigned to the next stack, which is assumed to be on the other end of the screen at the same height,
and will also be assigned to the next stack, which is assumed to be on the other side of the screen at the same height,
so as to leave space to prevent overlapping issues due to those displays' potential length.

#### Examples
Expand All @@ -147,7 +147,7 @@ so as to leave space to prevent overlapping issues due to those displays' potent
nughud_face_x 143
; Move the Frags widget elsewhere, since in the default Nugget HUD distribution,
; Move the Frags widget elsewhere, since in the default NUGHUD,
; it is drawn right where the Face is drawn in the traditional Status Bar.
nughud_frags_x 314
nughud_frags_y 155
Expand Down
14 changes: 13 additions & 1 deletion src/i_oalsound.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

// [Nugget]
#include "doomstat.h"
#include "g_game.h"

#define OAL_ROLLOFF_FACTOR 1
#define OAL_SPEED_OF_SOUND 343.3f
Expand Down Expand Up @@ -737,8 +738,19 @@ boolean I_OAL_StartSound(int channel, sfxinfo_t *sfx, int pitch)
return false;
}

// [Nugget] Slow Motion /-------------------------------------------------

float fpitch = pitch == NORM_PITCH ? OAL_DEFAULT_PITCH : steptable[pitch];

const float slowmo_factor = G_GetSlowMotionFactor();

if (!menuactive && slowmo_factor != SLOWMO_FACTOR_NORMAL)
{ fpitch *= (4.0f + G_GetSlowMotionFactor()) / 5.0f; }

// [Nugget] -------------------------------------------------------------/

alSourcef(oal->sources[channel], AL_PITCH,
pitch == NORM_PITCH ? OAL_DEFAULT_PITCH : steptable[pitch]);
fpitch);

alSourcei(oal->sources[channel], AL_BUFFER, sfx->buffer);

Expand Down
4 changes: 0 additions & 4 deletions src/s_sound.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,6 @@ void S_StartSoundPitch(const mobj_t *origin, int sfx_id, const pitchrange_t pitc
// Initialize sound parameters
pitch = NORM_PITCH;

// [Nugget] Slow Motion
if (!menuactive && G_GetSlowMotionFactor() != SLOWMO_FACTOR_NORMAL)
{ pitch *= G_GetSlowMotionFactor(); }

// haleyjd: modified so that priority value is always used
// haleyjd: also modified to get and store proper singularity value
o_priority = priority = sfx->priority;
Expand Down

0 comments on commit 07f6f1c

Please sign in to comment.