mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Biome definition tweaks and more sfx
This commit is contained in:
parent
f0d14ebe20
commit
c44a9092d3
@ -366,6 +366,28 @@
|
||||
threshold: 0.3,
|
||||
),
|
||||
|
||||
//
|
||||
// Sceptre
|
||||
//
|
||||
Wield(Sceptre): (
|
||||
files: [
|
||||
"voxygen.audio.sfx.weapon.sword_out",
|
||||
],
|
||||
threshold: 0.5,
|
||||
),
|
||||
Unwield(Sceptre): (
|
||||
files: [
|
||||
"voxygen.audio.sfx.weapon.sword_in",
|
||||
],
|
||||
threshold: 0.5,
|
||||
),
|
||||
Attack(BasicBeam, Sceptre): (
|
||||
files: [
|
||||
"voxygen.audio.sfx.abilities.staff_channeling",
|
||||
],
|
||||
threshold: 0.6,
|
||||
),
|
||||
|
||||
//
|
||||
// Dagger
|
||||
//
|
||||
|
BIN
assets/voxygen/audio/sfx/abilities/flame_thrower.wav
(Stored with Git LFS)
BIN
assets/voxygen/audio/sfx/abilities/flame_thrower.wav
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/audio/sfx/abilities/staff_channeling.wav
(Stored with Git LFS)
BIN
assets/voxygen/audio/sfx/abilities/staff_channeling.wav
(Stored with Git LFS)
Binary file not shown.
@ -1,8 +1,10 @@
|
||||
// TODO: Re-add tunes that are not fitting general outside day/night situations
|
||||
// TODO: Add an ambient-soundtrack that runs independently from the musical soundtrack
|
||||
//Times: Some(Day), Some(Night), None
|
||||
//List of biomes currently: Grassland, Forest, Jungle, Desert, Snowland, Lake, Mountain
|
||||
//Sites: Cave, Dungeon
|
||||
// Times: Some(Day), Some(Night), None
|
||||
// List of biomes currently: Grassland, Forest, Desert, Snowland, Lake, Mountain, Ocean
|
||||
// Also Jungle and Swamp but these are not defined currently as the worldgen around
|
||||
// them is changing and not stable
|
||||
// Sites: Cave, Dungeon
|
||||
|
||||
(
|
||||
tracks: [
|
||||
@ -12,7 +14,6 @@
|
||||
length: 206.0,
|
||||
timing: Some(Night),
|
||||
biomes: [
|
||||
(Jungle, 1),
|
||||
(Desert, 1),
|
||||
(Grassland, 1),
|
||||
(Snowland, 1),
|
||||
@ -29,7 +30,6 @@
|
||||
timing: Some(Night),
|
||||
biomes: [
|
||||
(Forest, 1),
|
||||
(Jungle, 1),
|
||||
],
|
||||
site: Some(Void),
|
||||
artist: "Aeronic",
|
||||
@ -75,6 +75,15 @@
|
||||
site: Some(Cave),
|
||||
artist: "Aeronic",
|
||||
),
|
||||
( //Repeat for other site
|
||||
title: "Mineral Deposits",
|
||||
path: "voxygen.audio.soundtrack.mineral_deposits",
|
||||
length: 148.0,
|
||||
timing: None,
|
||||
biomes: [],
|
||||
site: Some(Dungeon),
|
||||
artist: "Aeronic",
|
||||
),
|
||||
(
|
||||
title: "Moonbeams",
|
||||
path: "voxygen.audio.soundtrack.moonbeams",
|
||||
@ -90,7 +99,6 @@
|
||||
length: 173.0,
|
||||
timing: Some(Night),
|
||||
biomes: [
|
||||
(Forest, 1),
|
||||
(Grassland, 1),
|
||||
],
|
||||
site: Some(Void),
|
||||
@ -148,7 +156,7 @@
|
||||
site: Some(Cave),
|
||||
artist: "badbbad",
|
||||
),
|
||||
( //Repeat for other site
|
||||
( //Repeat for other site
|
||||
title: "Down The Rabbit Hole",
|
||||
path: "voxygen.audio.soundtrack.down_the_rabbit_hole",
|
||||
length: 244.0,
|
||||
|
@ -26,7 +26,7 @@
|
||||
//! path: "voxygen.audio.soundtrack.sleepy",
|
||||
//! length: 400.0,
|
||||
//! timing: Some(Night),
|
||||
//! biome: [
|
||||
//! biomes: [
|
||||
//! (Forest, 1),
|
||||
//! (Grassland, 2),
|
||||
//! ],
|
||||
@ -132,29 +132,12 @@ impl MusicMgr {
|
||||
//println!("biome: {:?}", current_chunk.meta().biome());
|
||||
//println!("chaos: {}", current_chunk.meta().chaos());
|
||||
//println!("alt: {}", current_chunk.meta().alt());
|
||||
//println!("temp: {}", current_chunk.meta().temp());
|
||||
//println!("tree_density: {}",
|
||||
// current_chunk.meta().tree_density());
|
||||
// println!("humidity: {}", current_chunk.meta().humidity());
|
||||
//println!("cave_alt: {}", current_chunk.meta().cave_alt());
|
||||
//if let Some(position) = client.current_position() {
|
||||
// println!("player_pos: {:?}", position);
|
||||
//}
|
||||
//let player_position = match client.current_position() {
|
||||
// Some(pos) => pos,
|
||||
// None => Vec3::default(),
|
||||
//};
|
||||
//let block_position = Vec3::new(
|
||||
// player_position[0],
|
||||
// player_position[1],
|
||||
// player_position[2] - 1.0,
|
||||
//)
|
||||
//.map(|x| x as i32);
|
||||
//let block_kind = match state.get_block(block_position) {
|
||||
// Some(block) => block.kind(),
|
||||
// None => BlockKind::Air,
|
||||
//};
|
||||
//println!("BlockKind: {:?}", block_kind);
|
||||
|
||||
if audio.music_enabled()
|
||||
&& !self.soundtrack.tracks.is_empty()
|
||||
@ -226,7 +209,7 @@ impl MusicMgr {
|
||||
});
|
||||
|
||||
if let Ok(track) = new_maybe_track {
|
||||
println!("Now playing {:?}", track.title);
|
||||
//println!("Now playing {:?}", track.title);
|
||||
self.last_track = String::from(&track.title);
|
||||
self.began_playing = Instant::now();
|
||||
self.next_track_change = track.length + silence_between_tracks_seconds;
|
||||
|
@ -244,15 +244,16 @@ pub struct SfxMgr {
|
||||
event_mapper: SfxEventMapper,
|
||||
}
|
||||
|
||||
impl SfxMgr {
|
||||
#[allow(clippy::new_without_default)] // TODO: Pending review in #587
|
||||
pub fn new() -> Self {
|
||||
impl Default for SfxMgr {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
triggers: Self::load_sfx_items(),
|
||||
event_mapper: SfxEventMapper::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SfxMgr {
|
||||
pub fn maintain(
|
||||
&mut self,
|
||||
audio: &mut AudioFrontend,
|
||||
@ -360,7 +361,11 @@ impl SfxMgr {
|
||||
|
||||
audio.play_sfx(file_ref, *pos, None);
|
||||
},
|
||||
Body::Object(object::Body::BoltFire | object::Body::BoltFireBig) => {
|
||||
Body::Object(
|
||||
object::Body::BoltFire
|
||||
| object::Body::BoltFireBig
|
||||
| object::Body::BoltNature,
|
||||
) => {
|
||||
let file_ref = vec![
|
||||
"voxygen.audio.sfx.abilities.fire_shot_1",
|
||||
"voxygen.audio.sfx.abilities.fire_shot_2",
|
||||
|
@ -6,10 +6,6 @@ use serde::Deserialize;
|
||||
use std::time::Instant;
|
||||
use tracing::warn;
|
||||
|
||||
// For if we want wind to vary strength by time of day
|
||||
//const DAY_START_SECONDS: u32 = 28800; // 8:00
|
||||
//const DAY_END_SECONDS: u32 = 70200; // 19:30
|
||||
|
||||
#[derive(Debug, Default, Deserialize)]
|
||||
struct WindCollection {
|
||||
tracks: Vec<WindItem>,
|
||||
@ -21,19 +17,8 @@ pub struct WindItem {
|
||||
path: String,
|
||||
/// Length of the track in seconds
|
||||
length: f32,
|
||||
/* Whether this track should play during day or night
|
||||
* timing: Option<DayPeriod>, */
|
||||
}
|
||||
|
||||
///// Allows control over when a track should play based on in-game time of day
|
||||
//#[derive(Debug, Deserialize, PartialEq)]
|
||||
//enum DayPeriod {
|
||||
// /// 8:00 AM to 7:30 PM
|
||||
// Day,
|
||||
// /// 7:31 PM to 6:59 AM
|
||||
// Night,
|
||||
//}
|
||||
|
||||
pub struct WindMgr {
|
||||
soundtrack: WindCollection,
|
||||
began_playing: Instant,
|
||||
@ -42,9 +27,8 @@ pub struct WindMgr {
|
||||
tree_multiplier: f32,
|
||||
}
|
||||
|
||||
impl WindMgr {
|
||||
#[allow(clippy::new_without_default)] // TODO: Pending review in #587
|
||||
pub fn new() -> Self {
|
||||
impl Default for WindMgr {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
soundtrack: Self::load_soundtrack_items(),
|
||||
began_playing: Instant::now(),
|
||||
@ -53,7 +37,9 @@ impl WindMgr {
|
||||
tree_multiplier: 0.0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl WindMgr {
|
||||
/// Checks whether the previous track has completed. If so, sends a
|
||||
/// request to play the next (random) track
|
||||
pub fn maintain(
|
||||
@ -64,15 +50,18 @@ impl WindMgr {
|
||||
camera: &Camera,
|
||||
) {
|
||||
if audio.sfx_enabled() && !self.soundtrack.tracks.is_empty() {
|
||||
let player_alt = Self::get_current_alt(client);
|
||||
let focus_off = camera.get_focus_pos().map(f32::trunc);
|
||||
let cam_pos = camera.dependents().cam_pos + focus_off;
|
||||
|
||||
let cam_alt = cam_pos.z;
|
||||
let terrain_alt = Self::get_current_terrain_alt(client);
|
||||
|
||||
let alt_multiplier = (player_alt / 1200.0).abs();
|
||||
let alt_multiplier = (cam_alt / 1200.0).abs();
|
||||
|
||||
// Tree density factors into wind volume. The more trees,
|
||||
// the less wind
|
||||
let mut tree_multiplier = self.tree_multiplier;
|
||||
let new_tree_multiplier = if (player_alt - terrain_alt) < 150.0 {
|
||||
let new_tree_multiplier = if (cam_alt - terrain_alt) < 150.0 {
|
||||
1.0 - Self::get_current_tree_density(client)
|
||||
} else {
|
||||
1.0
|
||||
@ -88,9 +77,6 @@ impl WindMgr {
|
||||
|
||||
let mut volume_multiplier = alt_multiplier * self.tree_multiplier;
|
||||
|
||||
let focus_off = camera.get_focus_pos().map(f32::trunc);
|
||||
let cam_pos = camera.dependents().cam_pos + focus_off;
|
||||
|
||||
// Checks if the camera is underwater to stop wind sounds
|
||||
if state
|
||||
.terrain()
|
||||
@ -99,17 +85,13 @@ impl WindMgr {
|
||||
.unwrap_or(BlockKind::Air)
|
||||
== BlockKind::Water
|
||||
{
|
||||
volume_multiplier *= volume_multiplier;
|
||||
volume_multiplier *= 0.1;
|
||||
}
|
||||
if cam_pos.z < Self::get_current_terrain_alt(client) - 10.0 {
|
||||
volume_multiplier = 0.0;
|
||||
}
|
||||
|
||||
if volume_multiplier > 1.0 {
|
||||
volume_multiplier = 1.0
|
||||
}
|
||||
|
||||
let target_volume = volume_multiplier;
|
||||
let target_volume = volume_multiplier.max(0.0).min(1.0);
|
||||
|
||||
// Transitions the wind smoothly
|
||||
self.volume = audio.get_wind_volume();
|
||||
@ -132,21 +114,6 @@ impl WindMgr {
|
||||
}
|
||||
}
|
||||
|
||||
//fn get_current_day_period(game_time: u32) -> DayPeriod {
|
||||
// if game_time > DAY_START_SECONDS && game_time < DAY_END_SECONDS {
|
||||
// DayPeriod::Day
|
||||
// } else {
|
||||
// DayPeriod::Night
|
||||
// }
|
||||
//}
|
||||
|
||||
fn get_current_alt(client: &Client) -> f32 {
|
||||
match client.current_position() {
|
||||
Some(pos) => pos.z,
|
||||
None => 0.0,
|
||||
}
|
||||
}
|
||||
|
||||
fn get_current_terrain_alt(client: &Client) -> f32 {
|
||||
if let Some(chunk) = client.current_chunk() {
|
||||
chunk.meta().alt()
|
||||
|
@ -4,7 +4,7 @@
|
||||
#![recursion_limit = "2048"]
|
||||
|
||||
use veloren_voxygen::{
|
||||
audio::{self, AudioFrontend},
|
||||
audio::AudioFrontend,
|
||||
i18n::{self, i18n_asset_key, Localization},
|
||||
logging,
|
||||
profile::Profile,
|
||||
|
@ -307,9 +307,9 @@ impl Scene {
|
||||
light_data: Vec::new(),
|
||||
particle_mgr: ParticleMgr::new(renderer),
|
||||
figure_mgr: FigureMgr::new(renderer),
|
||||
sfx_mgr: SfxMgr::new(),
|
||||
sfx_mgr: SfxMgr::default(),
|
||||
music_mgr: MusicMgr::default(),
|
||||
ambient_mgr: WindMgr::new(),
|
||||
ambient_mgr: WindMgr::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
column::{ColumnGen, ColumnSample},
|
||||
util::{RandomField, Sampler, SmallCache},
|
||||
IndexRef, CONFIG,
|
||||
IndexRef,
|
||||
};
|
||||
use common::terrain::{
|
||||
structure::{self, StructureBlock},
|
||||
@ -67,9 +67,9 @@ impl<'a> BlockGen<'a> {
|
||||
// marble_small,
|
||||
rock,
|
||||
// temp,
|
||||
temp,
|
||||
// humidity,
|
||||
stone_col,
|
||||
snow_cover,
|
||||
..
|
||||
} = sample;
|
||||
|
||||
@ -129,7 +129,8 @@ impl<'a> BlockGen<'a> {
|
||||
let col = Lerp::lerp(sub_surface_color, surface_color, grass_factor);
|
||||
// Surface
|
||||
Some(Block::new(
|
||||
if temp < CONFIG.snow_temp + 0.031 {
|
||||
if snow_cover {
|
||||
//if temp < CONFIG.snow_temp + 0.031 {
|
||||
BlockKind::Snow
|
||||
} else if grass_factor > 0.7 {
|
||||
BlockKind::Grass
|
||||
|
@ -2303,20 +2303,20 @@ impl SimChunk {
|
||||
pub fn get_biome(&self) -> BiomeKind {
|
||||
if self.alt < CONFIG.sea_level {
|
||||
BiomeKind::Ocean
|
||||
} else if self.humidity == 0.5 {
|
||||
} else if (self.temp - 0.5) < 0.005 && self.humidity < 0.1 {
|
||||
BiomeKind::Lake
|
||||
} else if self.temp < CONFIG.snow_temp {
|
||||
BiomeKind::Snowland
|
||||
} else if self.alt > 450.0 && self.chaos > 0.35 && self.tree_density < 0.7 {
|
||||
} else if self.alt > 450.0 && self.chaos > 0.3 && self.tree_density < 0.6 {
|
||||
BiomeKind::Mountain
|
||||
} else if self.temp > CONFIG.desert_temp && self.humidity < 0.6 {
|
||||
BiomeKind::Desert
|
||||
} else if self.tree_density > 0.65 && self.humidity > 0.7 && self.temp > 0.8 {
|
||||
BiomeKind::Jungle
|
||||
} else if self.tree_density > 0.65 {
|
||||
//} else if self.tree_density > 0.65 && self.humidity > 0.7 && self.temp > 0.8 {
|
||||
// BiomeKind::Jungle
|
||||
} else if self.tree_density > 0.5 {
|
||||
BiomeKind::Forest
|
||||
} else if self.humidity > 0.8 {
|
||||
BiomeKind::Swamp
|
||||
//} else if self.humidity > 0.8 {
|
||||
// BiomeKind::Swamp
|
||||
} else {
|
||||
BiomeKind::Grassland
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user