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,
|
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
|
// 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,7 +1,9 @@
|
|||||||
// TODO: Re-add tunes that are not fitting general outside day/night situations
|
// 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
|
// TODO: Add an ambient-soundtrack that runs independently from the musical soundtrack
|
||||||
// Times: Some(Day), Some(Night), None
|
// Times: Some(Day), Some(Night), None
|
||||||
//List of biomes currently: Grassland, Forest, Jungle, Desert, Snowland, Lake, Mountain
|
// 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
|
// Sites: Cave, Dungeon
|
||||||
|
|
||||||
(
|
(
|
||||||
@ -12,7 +14,6 @@
|
|||||||
length: 206.0,
|
length: 206.0,
|
||||||
timing: Some(Night),
|
timing: Some(Night),
|
||||||
biomes: [
|
biomes: [
|
||||||
(Jungle, 1),
|
|
||||||
(Desert, 1),
|
(Desert, 1),
|
||||||
(Grassland, 1),
|
(Grassland, 1),
|
||||||
(Snowland, 1),
|
(Snowland, 1),
|
||||||
@ -29,7 +30,6 @@
|
|||||||
timing: Some(Night),
|
timing: Some(Night),
|
||||||
biomes: [
|
biomes: [
|
||||||
(Forest, 1),
|
(Forest, 1),
|
||||||
(Jungle, 1),
|
|
||||||
],
|
],
|
||||||
site: Some(Void),
|
site: Some(Void),
|
||||||
artist: "Aeronic",
|
artist: "Aeronic",
|
||||||
@ -75,6 +75,15 @@
|
|||||||
site: Some(Cave),
|
site: Some(Cave),
|
||||||
artist: "Aeronic",
|
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",
|
title: "Moonbeams",
|
||||||
path: "voxygen.audio.soundtrack.moonbeams",
|
path: "voxygen.audio.soundtrack.moonbeams",
|
||||||
@ -90,7 +99,6 @@
|
|||||||
length: 173.0,
|
length: 173.0,
|
||||||
timing: Some(Night),
|
timing: Some(Night),
|
||||||
biomes: [
|
biomes: [
|
||||||
(Forest, 1),
|
|
||||||
(Grassland, 1),
|
(Grassland, 1),
|
||||||
],
|
],
|
||||||
site: Some(Void),
|
site: Some(Void),
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
//! path: "voxygen.audio.soundtrack.sleepy",
|
//! path: "voxygen.audio.soundtrack.sleepy",
|
||||||
//! length: 400.0,
|
//! length: 400.0,
|
||||||
//! timing: Some(Night),
|
//! timing: Some(Night),
|
||||||
//! biome: [
|
//! biomes: [
|
||||||
//! (Forest, 1),
|
//! (Forest, 1),
|
||||||
//! (Grassland, 2),
|
//! (Grassland, 2),
|
||||||
//! ],
|
//! ],
|
||||||
@ -132,29 +132,12 @@ impl MusicMgr {
|
|||||||
//println!("biome: {:?}", current_chunk.meta().biome());
|
//println!("biome: {:?}", current_chunk.meta().biome());
|
||||||
//println!("chaos: {}", current_chunk.meta().chaos());
|
//println!("chaos: {}", current_chunk.meta().chaos());
|
||||||
//println!("alt: {}", current_chunk.meta().alt());
|
//println!("alt: {}", current_chunk.meta().alt());
|
||||||
//println!("temp: {}", current_chunk.meta().temp());
|
|
||||||
//println!("tree_density: {}",
|
//println!("tree_density: {}",
|
||||||
// current_chunk.meta().tree_density());
|
// current_chunk.meta().tree_density());
|
||||||
// println!("humidity: {}", current_chunk.meta().humidity());
|
|
||||||
//println!("cave_alt: {}", current_chunk.meta().cave_alt());
|
//println!("cave_alt: {}", current_chunk.meta().cave_alt());
|
||||||
//if let Some(position) = client.current_position() {
|
//if let Some(position) = client.current_position() {
|
||||||
// println!("player_pos: {:?}", 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()
|
if audio.music_enabled()
|
||||||
&& !self.soundtrack.tracks.is_empty()
|
&& !self.soundtrack.tracks.is_empty()
|
||||||
@ -226,7 +209,7 @@ impl MusicMgr {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if let Ok(track) = new_maybe_track {
|
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.last_track = String::from(&track.title);
|
||||||
self.began_playing = Instant::now();
|
self.began_playing = Instant::now();
|
||||||
self.next_track_change = track.length + silence_between_tracks_seconds;
|
self.next_track_change = track.length + silence_between_tracks_seconds;
|
||||||
|
@ -244,15 +244,16 @@ pub struct SfxMgr {
|
|||||||
event_mapper: SfxEventMapper,
|
event_mapper: SfxEventMapper,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SfxMgr {
|
impl Default for SfxMgr {
|
||||||
#[allow(clippy::new_without_default)] // TODO: Pending review in #587
|
fn default() -> Self {
|
||||||
pub fn new() -> Self {
|
|
||||||
Self {
|
Self {
|
||||||
triggers: Self::load_sfx_items(),
|
triggers: Self::load_sfx_items(),
|
||||||
event_mapper: SfxEventMapper::new(),
|
event_mapper: SfxEventMapper::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SfxMgr {
|
||||||
pub fn maintain(
|
pub fn maintain(
|
||||||
&mut self,
|
&mut self,
|
||||||
audio: &mut AudioFrontend,
|
audio: &mut AudioFrontend,
|
||||||
@ -360,7 +361,11 @@ impl SfxMgr {
|
|||||||
|
|
||||||
audio.play_sfx(file_ref, *pos, None);
|
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![
|
let file_ref = vec![
|
||||||
"voxygen.audio.sfx.abilities.fire_shot_1",
|
"voxygen.audio.sfx.abilities.fire_shot_1",
|
||||||
"voxygen.audio.sfx.abilities.fire_shot_2",
|
"voxygen.audio.sfx.abilities.fire_shot_2",
|
||||||
|
@ -6,10 +6,6 @@ use serde::Deserialize;
|
|||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
use tracing::warn;
|
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)]
|
#[derive(Debug, Default, Deserialize)]
|
||||||
struct WindCollection {
|
struct WindCollection {
|
||||||
tracks: Vec<WindItem>,
|
tracks: Vec<WindItem>,
|
||||||
@ -21,19 +17,8 @@ pub struct WindItem {
|
|||||||
path: String,
|
path: String,
|
||||||
/// Length of the track in seconds
|
/// Length of the track in seconds
|
||||||
length: f32,
|
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 {
|
pub struct WindMgr {
|
||||||
soundtrack: WindCollection,
|
soundtrack: WindCollection,
|
||||||
began_playing: Instant,
|
began_playing: Instant,
|
||||||
@ -42,9 +27,8 @@ pub struct WindMgr {
|
|||||||
tree_multiplier: f32,
|
tree_multiplier: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WindMgr {
|
impl Default for WindMgr {
|
||||||
#[allow(clippy::new_without_default)] // TODO: Pending review in #587
|
fn default() -> Self {
|
||||||
pub fn new() -> Self {
|
|
||||||
Self {
|
Self {
|
||||||
soundtrack: Self::load_soundtrack_items(),
|
soundtrack: Self::load_soundtrack_items(),
|
||||||
began_playing: Instant::now(),
|
began_playing: Instant::now(),
|
||||||
@ -53,7 +37,9 @@ impl WindMgr {
|
|||||||
tree_multiplier: 0.0,
|
tree_multiplier: 0.0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl WindMgr {
|
||||||
/// Checks whether the previous track has completed. If so, sends a
|
/// Checks whether the previous track has completed. If so, sends a
|
||||||
/// request to play the next (random) track
|
/// request to play the next (random) track
|
||||||
pub fn maintain(
|
pub fn maintain(
|
||||||
@ -64,15 +50,18 @@ impl WindMgr {
|
|||||||
camera: &Camera,
|
camera: &Camera,
|
||||||
) {
|
) {
|
||||||
if audio.sfx_enabled() && !self.soundtrack.tracks.is_empty() {
|
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 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,
|
// Tree density factors into wind volume. The more trees,
|
||||||
// the less wind
|
// the less wind
|
||||||
let mut tree_multiplier = self.tree_multiplier;
|
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)
|
1.0 - Self::get_current_tree_density(client)
|
||||||
} else {
|
} else {
|
||||||
1.0
|
1.0
|
||||||
@ -88,9 +77,6 @@ impl WindMgr {
|
|||||||
|
|
||||||
let mut volume_multiplier = alt_multiplier * self.tree_multiplier;
|
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
|
// Checks if the camera is underwater to stop wind sounds
|
||||||
if state
|
if state
|
||||||
.terrain()
|
.terrain()
|
||||||
@ -99,17 +85,13 @@ impl WindMgr {
|
|||||||
.unwrap_or(BlockKind::Air)
|
.unwrap_or(BlockKind::Air)
|
||||||
== BlockKind::Water
|
== BlockKind::Water
|
||||||
{
|
{
|
||||||
volume_multiplier *= volume_multiplier;
|
volume_multiplier *= 0.1;
|
||||||
}
|
}
|
||||||
if cam_pos.z < Self::get_current_terrain_alt(client) - 10.0 {
|
if cam_pos.z < Self::get_current_terrain_alt(client) - 10.0 {
|
||||||
volume_multiplier = 0.0;
|
volume_multiplier = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if volume_multiplier > 1.0 {
|
let target_volume = volume_multiplier.max(0.0).min(1.0);
|
||||||
volume_multiplier = 1.0
|
|
||||||
}
|
|
||||||
|
|
||||||
let target_volume = volume_multiplier;
|
|
||||||
|
|
||||||
// Transitions the wind smoothly
|
// Transitions the wind smoothly
|
||||||
self.volume = audio.get_wind_volume();
|
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 {
|
fn get_current_terrain_alt(client: &Client) -> f32 {
|
||||||
if let Some(chunk) = client.current_chunk() {
|
if let Some(chunk) = client.current_chunk() {
|
||||||
chunk.meta().alt()
|
chunk.meta().alt()
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#![recursion_limit = "2048"]
|
#![recursion_limit = "2048"]
|
||||||
|
|
||||||
use veloren_voxygen::{
|
use veloren_voxygen::{
|
||||||
audio::{self, AudioFrontend},
|
audio::AudioFrontend,
|
||||||
i18n::{self, i18n_asset_key, Localization},
|
i18n::{self, i18n_asset_key, Localization},
|
||||||
logging,
|
logging,
|
||||||
profile::Profile,
|
profile::Profile,
|
||||||
|
@ -307,9 +307,9 @@ impl Scene {
|
|||||||
light_data: Vec::new(),
|
light_data: Vec::new(),
|
||||||
particle_mgr: ParticleMgr::new(renderer),
|
particle_mgr: ParticleMgr::new(renderer),
|
||||||
figure_mgr: FigureMgr::new(renderer),
|
figure_mgr: FigureMgr::new(renderer),
|
||||||
sfx_mgr: SfxMgr::new(),
|
sfx_mgr: SfxMgr::default(),
|
||||||
music_mgr: MusicMgr::default(),
|
music_mgr: MusicMgr::default(),
|
||||||
ambient_mgr: WindMgr::new(),
|
ambient_mgr: WindMgr::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
column::{ColumnGen, ColumnSample},
|
column::{ColumnGen, ColumnSample},
|
||||||
util::{RandomField, Sampler, SmallCache},
|
util::{RandomField, Sampler, SmallCache},
|
||||||
IndexRef, CONFIG,
|
IndexRef,
|
||||||
};
|
};
|
||||||
use common::terrain::{
|
use common::terrain::{
|
||||||
structure::{self, StructureBlock},
|
structure::{self, StructureBlock},
|
||||||
@ -67,9 +67,9 @@ impl<'a> BlockGen<'a> {
|
|||||||
// marble_small,
|
// marble_small,
|
||||||
rock,
|
rock,
|
||||||
// temp,
|
// temp,
|
||||||
temp,
|
|
||||||
// humidity,
|
// humidity,
|
||||||
stone_col,
|
stone_col,
|
||||||
|
snow_cover,
|
||||||
..
|
..
|
||||||
} = sample;
|
} = sample;
|
||||||
|
|
||||||
@ -129,7 +129,8 @@ impl<'a> BlockGen<'a> {
|
|||||||
let col = Lerp::lerp(sub_surface_color, surface_color, grass_factor);
|
let col = Lerp::lerp(sub_surface_color, surface_color, grass_factor);
|
||||||
// Surface
|
// Surface
|
||||||
Some(Block::new(
|
Some(Block::new(
|
||||||
if temp < CONFIG.snow_temp + 0.031 {
|
if snow_cover {
|
||||||
|
//if temp < CONFIG.snow_temp + 0.031 {
|
||||||
BlockKind::Snow
|
BlockKind::Snow
|
||||||
} else if grass_factor > 0.7 {
|
} else if grass_factor > 0.7 {
|
||||||
BlockKind::Grass
|
BlockKind::Grass
|
||||||
|
@ -2303,20 +2303,20 @@ impl SimChunk {
|
|||||||
pub fn get_biome(&self) -> BiomeKind {
|
pub fn get_biome(&self) -> BiomeKind {
|
||||||
if self.alt < CONFIG.sea_level {
|
if self.alt < CONFIG.sea_level {
|
||||||
BiomeKind::Ocean
|
BiomeKind::Ocean
|
||||||
} else if self.humidity == 0.5 {
|
} else if (self.temp - 0.5) < 0.005 && self.humidity < 0.1 {
|
||||||
BiomeKind::Lake
|
BiomeKind::Lake
|
||||||
} else if self.temp < CONFIG.snow_temp {
|
} else if self.temp < CONFIG.snow_temp {
|
||||||
BiomeKind::Snowland
|
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
|
BiomeKind::Mountain
|
||||||
} else if self.temp > CONFIG.desert_temp && self.humidity < 0.6 {
|
} else if self.temp > CONFIG.desert_temp && self.humidity < 0.6 {
|
||||||
BiomeKind::Desert
|
BiomeKind::Desert
|
||||||
} else if self.tree_density > 0.65 && self.humidity > 0.7 && self.temp > 0.8 {
|
//} else if self.tree_density > 0.65 && self.humidity > 0.7 && self.temp > 0.8 {
|
||||||
BiomeKind::Jungle
|
// BiomeKind::Jungle
|
||||||
} else if self.tree_density > 0.65 {
|
} else if self.tree_density > 0.5 {
|
||||||
BiomeKind::Forest
|
BiomeKind::Forest
|
||||||
} else if self.humidity > 0.8 {
|
//} else if self.humidity > 0.8 {
|
||||||
BiomeKind::Swamp
|
// BiomeKind::Swamp
|
||||||
} else {
|
} else {
|
||||||
BiomeKind::Grassland
|
BiomeKind::Grassland
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user