From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Fri, 20 Jan 2023 21:31:24 +0000 (+0100) Subject: strafehud: add exponent cvar for sonar ranges X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=bff5e4fa4e166e97fccf57fe87bf409237d1efd5;p=xonotic%2Fxonotic-data.pk3dir.git strafehud: add exponent cvar for sonar ranges --- diff --git a/_hud_common.cfg b/_hud_common.cfg index 272c7594e..9a063f752 100644 --- a/_hud_common.cfg +++ b/_hud_common.cfg @@ -214,10 +214,13 @@ seta hud_panel_strafehud_sonar_audio "misc/talk" "audio to play for sonar" seta hud_panel_strafehud_sonar_start "0.5" "how optimal from 0 to 1 your strafing angle has to be for the strafe sonar to activate" seta hud_panel_strafehud_sonar_interval_start "0.333333" "strafe sonar sound interval in seconds" seta hud_panel_strafehud_sonar_interval_range "-0.222222" "dynamic sound interval range in seconds of the strafe sonar as you approach the optimal angle" +seta hud_panel_strafehud_sonar_interval_exponent "1" "exponent of the dynamic sound interval range of the strafe sonar" seta hud_panel_strafehud_sonar_volume_start "0.333333" "sound volume of the strafe sonar" seta hud_panel_strafehud_sonar_volume_range "0.666666" "dynamic volume range of the strafe sonar as you approach the optimal angle" +seta hud_panel_strafehud_sonar_volume_exponent "1" "exponent of the dynamic volume range of the strafe sonar" seta hud_panel_strafehud_sonar_pitch_start "0.9" "playback speed of the strafe sonar" seta hud_panel_strafehud_sonar_pitch_range "0.1" "dynamic playback speed range of the strafe sonar as you approach the optimal angle" +seta hud_panel_strafehud_sonar_pitch_exponent "1" "exponent of the dynamic playback speed range of the strafe sonar" seta hud_panel_strafehud_vangle "0" "set to \"1\" to enable the vertical angle indicator" seta hud_panel_strafehud_vangle_color "0.75 0.75 0.75" "color of the vertical angle text" seta hud_panel_strafehud_vangle_size "1" "size of the vertical angle text (relative to the panel height)" diff --git a/qcsrc/client/hud/panel/strafehud.qc b/qcsrc/client/hud/panel/strafehud.qc index c56111934..9a2c90d14 100644 --- a/qcsrc/client/hud/panel/strafehud.qc +++ b/qcsrc/client/hud/panel/strafehud.qc @@ -961,17 +961,17 @@ void HUD_StrafeHUD() sonar_ratio = 1; float sonar_interval = max(0, autocvar_hud_panel_strafehud_sonar_interval_start); - sonar_interval += autocvar_hud_panel_strafehud_sonar_interval_range * sonar_ratio; + sonar_interval += autocvar_hud_panel_strafehud_sonar_interval_range * sonar_ratio ** max(1, autocvar_hud_panel_strafehud_sonar_interval_exponent); bool sonar_ready = (sonar_time == 0) || ((time - sonar_time) >= sonar_interval); if(autocvar_hud_panel_strafehud_sonar && sonar_ready && (strafe_ratio >= sonar_start)) { sonar_time = time; float sonar_volume = bound(0, autocvar_hud_panel_strafehud_sonar_volume_start, 1); - sonar_volume += autocvar_hud_panel_strafehud_sonar_volume_range * sonar_ratio; + sonar_volume += autocvar_hud_panel_strafehud_sonar_volume_range * sonar_ratio ** max(1, autocvar_hud_panel_strafehud_sonar_volume_exponent); float sonar_pitch = max(0, autocvar_hud_panel_strafehud_sonar_pitch_start); - sonar_pitch += autocvar_hud_panel_strafehud_sonar_pitch_range * sonar_ratio; + sonar_pitch += autocvar_hud_panel_strafehud_sonar_pitch_range * sonar_ratio ** max(1, autocvar_hud_panel_strafehud_sonar_pitch_exponent); if(sonar_volume > 0) sound7(csqcplayer, CH_INFO, sonarsound, bound(0, sonar_volume, 1) * VOL_BASE, ATTN_NONE, max(0.000001, sonar_pitch * 100), 0); diff --git a/qcsrc/client/hud/panel/strafehud.qh b/qcsrc/client/hud/panel/strafehud.qh index e1ed023bd..7080327d8 100644 --- a/qcsrc/client/hud/panel/strafehud.qh +++ b/qcsrc/client/hud/panel/strafehud.qh @@ -63,10 +63,13 @@ string autocvar_hud_panel_strafehud_sonar_audio = "misc/talk"; float autocvar_hud_panel_strafehud_sonar_start = 0.5; float autocvar_hud_panel_strafehud_sonar_interval_start = 0.333333; float autocvar_hud_panel_strafehud_sonar_interval_range = -0.222222; +float autocvar_hud_panel_strafehud_sonar_interval_exponent = 1; float autocvar_hud_panel_strafehud_sonar_volume_start = 0.333333; float autocvar_hud_panel_strafehud_sonar_volume_range = 0.666666; +float autocvar_hud_panel_strafehud_sonar_volume_exponent = 1; float autocvar_hud_panel_strafehud_sonar_pitch_start = 0.9; float autocvar_hud_panel_strafehud_sonar_pitch_range = 0.1; +float autocvar_hud_panel_strafehud_sonar_pitch_exponent = 1; bool autocvar_hud_panel_strafehud_vangle = false; vector autocvar_hud_panel_strafehud_vangle_color = '0.75 0.75 0.75'; float autocvar_hud_panel_strafehud_vangle_size = 1;