From 07f6f1c9e71af53f4f3d948c113ff6265a5a59e3 Mon Sep 17 00:00:00 2001 From: Alaux <73968015+MrAlaux@users.noreply.github.com> Date: Fri, 8 Nov 2024 02:13:56 -0300 Subject: [PATCH] Fix slowmo pitch decrease, and more More specifically, fixed the slow-motion pitch decrease being affected by `pitch_bend_range`. Also tweaked NUGHUD guide. --- docs/nughud.md | 4 ++-- src/i_oalsound.c | 14 +++++++++++++- src/s_sound.c | 4 ---- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/docs/nughud.md b/docs/nughud.md index 8c97baf6b..fd7bf263e 100644 --- a/docs/nughud.md +++ b/docs/nughud.md @@ -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 @@ -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 diff --git a/src/i_oalsound.c b/src/i_oalsound.c index e224e74b9..594919ec8 100644 --- a/src/i_oalsound.c +++ b/src/i_oalsound.c @@ -38,6 +38,7 @@ // [Nugget] #include "doomstat.h" +#include "g_game.h" #define OAL_ROLLOFF_FACTOR 1 #define OAL_SPEED_OF_SOUND 343.3f @@ -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); diff --git a/src/s_sound.c b/src/s_sound.c index ed1d5a284..9ebd65dbe 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -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;