Compare commits

..

No commits in common. "a2423fa642a5b7b1f25dcad5a2837b5756762de7" and "5c3f41ad446fe8a1c520c17e38aadfdd0ce4c8e0" have entirely different histories.

5 changed files with 21 additions and 34 deletions

View file

@ -227,7 +227,7 @@ pub fn play_sfx(
if let Some(source) = sounds.0.get(&sfx.0) { if let Some(source) = sounds.0.get(&sfx.0) {
commands.spawn(AudioBundle { commands.spawn(AudioBundle {
source: source.clone(), source: source.clone(),
settings: PlaybackSettings::DESPAWN.with_volume(Volume::new(settings.volume_sfx)), settings: PlaybackSettings::DESPAWN,
}); });
} }
} }
@ -278,7 +278,11 @@ pub fn play_gasp_sfx(
continue; continue;
} }
if suit.oxygen <= 0.0 && !settings.god_mode { if suit.oxygen <= 0.0 && !settings.god_mode {
sink.set_volume(settings.volume_sfx * 0.6); if settings.mute_sfx {
sink.set_volume(0.0);
} else {
sink.set_volume(0.6);
}
sink.play(); sink.play();
} else { } else {
if !sink.is_paused() { if !sink.is_paused() {

View file

@ -672,9 +672,7 @@ pub fn apply_input_to_player(
let speed = sink.speed(); let speed = sink.speed();
let action = pitch_yaw_rot.length_squared().powf(0.2) * 0.0005; let action = pitch_yaw_rot.length_squared().powf(0.2) * 0.0005;
if play_reactionwheel_sound && !settings.mute_sfx && bike.is_some() { if play_reactionwheel_sound && !settings.mute_sfx && bike.is_some() {
sink.set_volume( sink.set_volume(reactionwheel_volume * (volume + action).clamp(0.0, 1.0));
settings.volume_sfx * reactionwheel_volume * (volume + action).clamp(0.0, 1.0),
);
sink.set_speed((speed + action * 0.2).clamp(0.2, 0.5)); sink.set_speed((speed + action * 0.2).clamp(0.2, 0.5));
sink.play() sink.play()
} else { } else {
@ -708,21 +706,22 @@ pub fn apply_input_to_player(
sink.pause(); sink.pause();
} else { } else {
let volume = sink.volume(); let volume = sink.volume();
let maxvol = settings.volume_sfx * vol_boost;
if engine.engine_type == engine_type { if engine.engine_type == engine_type {
if play_thruster_sound { if play_thruster_sound {
sink.set_speed(speed); sink.set_speed(speed);
sink.play(); sink.play();
if volume < maxvol { if volume < 1.0 {
let maxvol = vol_boost;
//let maxvol = engine.current_warmup * vol_boost;
sink.set_volume( sink.set_volume(
(volume + dt / seconds_to_max_vol).clamp(0.0, maxvol), (volume + dt / seconds_to_max_vol).clamp(0.0, maxvol),
); );
} }
} else { } else {
sink.set_volume((volume - dt / seconds_to_min_vol).clamp(0.0, maxvol)); sink.set_volume((volume - dt / seconds_to_min_vol).clamp(0.0, 1.0));
} }
} else if volume > 0.0 { } else if volume > 0.0 {
sink.set_volume((volume - dt / seconds_to_min_vol).clamp(0.0, maxvol)); sink.set_volume((volume - dt / seconds_to_min_vol).clamp(0.0, 1.0));
} }
if volume < 0.0001 { if volume < 0.0001 {
sink.pause(); sink.pause();

View file

@ -88,7 +88,6 @@ actor 0 0 0
tidally locked tidally locked
scale 21.5e3 scale 21.5e3
moon yes moon yes
collider handcrafted
angularmomentum 0 0 0 angularmomentum 0 0 0
actor 0 0 0 orbitring actor 0 0 0 orbitring
relativeto jupiter relativeto jupiter
@ -104,7 +103,6 @@ actor 0 0 0
tidally locked tidally locked
scale 8.2e3 scale 8.2e3
moon yes moon yes
collider handcrafted
angularmomentum 0 0 0 angularmomentum 0 0 0
actor 0 0 0 orbitring actor 0 0 0 orbitring
relativeto jupiter relativeto jupiter
@ -120,7 +118,6 @@ actor 0 0 0
tidally locked tidally locked
scale 83.5e3 scale 83.5e3
moon yes moon yes
collider handcrafted
angularmomentum 0 0 0 angularmomentum 0 0 0
actor 0 0 0 orbitring actor 0 0 0 orbitring
relativeto jupiter relativeto jupiter

View file

@ -471,9 +471,9 @@ pub fn update_menu(
.noise_cancellation_modes .noise_cancellation_modes
.get(settings.noise_cancellation_mode) .get(settings.noise_cancellation_mode)
{ {
&noisecancel.0 noisecancel
} else { } else {
&settings.noise_cancellation_modes[0].0 &settings.noise_cancellation_modes[0]
}; };
text.sections[i].value = format!("\nNoise Cancellation: {noisecancel}\n"); text.sections[i].value = format!("\nNoise Cancellation: {noisecancel}\n");
} }

View file

@ -41,11 +41,11 @@ pub struct Settings {
pub alive: bool, pub alive: bool,
pub mute_sfx: bool, pub mute_sfx: bool,
pub noise_cancellation_mode: usize, pub noise_cancellation_mode: usize,
pub noise_cancellation_modes: Vec<(String, f32)>, pub noise_cancellation_modes: Vec<String>,
pub radio_mode: usize, pub radio_mode: usize,
pub radio_modes: Vec<String>, // see also: settings.is_radio_playing() pub radio_modes: Vec<String>, // see also: settings.is_radio_playing()
pub volume_sfx: f32, pub volume_sfx: u8,
pub volume_music: f32, pub volume_music: u8,
pub mouse_sensitivity: f32, pub mouse_sensitivity: f32,
pub fov: f32, pub fov: f32,
pub fov_highspeed: f32, pub fov_highspeed: f32,
@ -173,12 +173,7 @@ impl Default for Settings {
alive: true, alive: true,
mute_sfx: false, mute_sfx: false,
noise_cancellation_mode: 0, noise_cancellation_mode: 0,
noise_cancellation_modes: vec![ noise_cancellation_modes: vec!["Off".to_string(), "On".to_string()],
("Off".to_string(), 1.0),
("33%".to_string(), 0.66),
("66%".to_string(), 0.33),
("100%".to_string(), 0.0),
],
radio_mode: 1, radio_mode: 1,
radio_modes: vec![ radio_modes: vec![
// see also: settings.is_radio_playing() // see also: settings.is_radio_playing()
@ -186,8 +181,8 @@ impl Default for Settings {
"Space Wave Radio".to_string(), "Space Wave Radio".to_string(),
"Amplify outside recordings".to_string(), "Amplify outside recordings".to_string(),
], ],
volume_sfx: 1.0, volume_sfx: 100,
volume_music: 1.0, volume_music: 100,
mouse_sensitivity: 0.4, mouse_sensitivity: 0.4,
fov: 50.0, fov: 50.0,
fov_highspeed: 25.0, fov_highspeed: 25.0,
@ -354,15 +349,7 @@ impl Settings {
value value
}; };
self.noise_cancellation_mode = value; self.noise_cancellation_mode = value;
self.volume_sfx = if let Some(noisecancel) = self self.mute_sfx = value >= 1;
.noise_cancellation_modes
.get(self.noise_cancellation_mode)
{
noisecancel.1
} else {
self.noise_cancellation_modes[0].1
};
self.mute_sfx = value >= 3;
} }
} }