mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
weather dependant music
This commit is contained in:
parent
102156c4b3
commit
6585ef1513
@ -122,6 +122,7 @@
|
||||
path: "voxygen.audio.soundtrack.town.rest_assured",
|
||||
length: 189.0,
|
||||
timing: Some(Day),
|
||||
weather: None,
|
||||
biomes: [],
|
||||
site: Some(Settlement),
|
||||
music_state: Activity(Explore),
|
||||
@ -132,6 +133,7 @@
|
||||
path: "voxygen.audio.soundtrack.town.im_home",
|
||||
length: 125.0,
|
||||
timing: Some(Night),
|
||||
weather: None,
|
||||
biomes: [],
|
||||
site: Some(Settlement),
|
||||
music_state: Activity(Explore),
|
||||
@ -142,6 +144,7 @@
|
||||
path: "voxygen.audio.soundtrack.dungeon.dank_dungeon",
|
||||
length: 130.0,
|
||||
timing: None,
|
||||
weather: None,
|
||||
biomes: [],
|
||||
site: Some(Dungeon),
|
||||
music_state: Activity(Explore),
|
||||
@ -152,6 +155,7 @@
|
||||
path: "voxygen.audio.soundtrack.overworld.calming_hills",
|
||||
length: 101.0,
|
||||
timing: Some(Day),
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Mountain, 1),
|
||||
],
|
||||
@ -164,6 +168,7 @@
|
||||
path: "voxygen.audio.soundtrack.town.fiesta_del_pueblo",
|
||||
length: 183.0,
|
||||
timing: Some(Day),
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Desert, 1)
|
||||
],
|
||||
@ -176,6 +181,7 @@
|
||||
path: "voxygen.audio.soundtrack.dungeon.ruination",
|
||||
length: 135.0,
|
||||
timing: None,
|
||||
weather: None,
|
||||
biomes: [],
|
||||
site: Some(Dungeon),
|
||||
music_state: Activity(Explore),
|
||||
@ -186,6 +192,7 @@
|
||||
path: "voxygen.audio.soundtrack.cave.saturated_hallows",
|
||||
length: 227.0,
|
||||
timing: None,
|
||||
weather: None,
|
||||
biomes: [],
|
||||
site: Some(Cave),
|
||||
music_state: Activity(Explore),
|
||||
@ -196,6 +203,7 @@
|
||||
path: "voxygen.audio.soundtrack.dungeon.vast_onslaught",
|
||||
length: 237.0,
|
||||
timing: None,
|
||||
weather: None,
|
||||
biomes: [],
|
||||
site: Some(Dungeon),
|
||||
music_state: Activity(Explore),
|
||||
@ -206,6 +214,7 @@
|
||||
path: "voxygen.audio.soundtrack.dungeon.sacred_temple",
|
||||
length: 75.0,
|
||||
timing: None,
|
||||
weather: None,
|
||||
biomes: [],
|
||||
site: Some(Dungeon),
|
||||
music_state: Activity(Explore),
|
||||
@ -216,6 +225,7 @@
|
||||
path: "voxygen.audio.soundtrack.overworld.true_nature",
|
||||
length: 169.0,
|
||||
timing: Some(Day),
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Forest, 2),
|
||||
],
|
||||
@ -228,6 +238,7 @@
|
||||
path: "voxygen.audio.soundtrack.overworld.jungle_ambient",
|
||||
length: 218.0,
|
||||
timing: Some(Day),
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Jungle, 1),
|
||||
],
|
||||
@ -240,6 +251,7 @@
|
||||
path: "voxygen.audio.soundtrack.overworld.ethereal_bonds",
|
||||
length: 59.0,
|
||||
timing: Some(Night),
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Mountain, 1),
|
||||
],
|
||||
@ -252,6 +264,7 @@
|
||||
path: "voxygen.audio.soundtrack.overworld.leap_of_faith",
|
||||
length: 269.0,
|
||||
timing: Some(Night),
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Ocean, 1),
|
||||
(Lake, 1),
|
||||
@ -265,6 +278,7 @@
|
||||
path: "voxygen.audio.soundtrack.overworld.highland_of_the_hawk",
|
||||
length: 283.0,
|
||||
timing: Some(Day),
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Desert, 1),
|
||||
(Savannah, 1),
|
||||
@ -278,6 +292,7 @@
|
||||
path: "voxygen.audio.soundtrack.overworld.verdant_glades",
|
||||
length: 97.0,
|
||||
timing: Some(Day),
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Grassland, 1),
|
||||
],
|
||||
@ -290,6 +305,7 @@
|
||||
path: "voxygen.audio.soundtrack.overworld.calling_wild",
|
||||
length: 160.0,
|
||||
timing: Some(Night),
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Grassland, 1),
|
||||
(Savannah, 1),
|
||||
@ -303,6 +319,7 @@
|
||||
path: "voxygen.audio.soundtrack.overworld.drifting_along",
|
||||
length: 164.0,
|
||||
timing: None,
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Lake, 1),
|
||||
(Ocean, 1),
|
||||
@ -316,6 +333,7 @@
|
||||
path: "voxygen.audio.soundtrack.overworld.winter_falls",
|
||||
length: 215.0,
|
||||
timing: Some(Day),
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Snowland, 1),
|
||||
(Taiga, 1),
|
||||
@ -329,6 +347,7 @@
|
||||
path: "voxygen.audio.soundtrack.overworld.short_meandering",
|
||||
length: 147.0,
|
||||
timing: Some(Night),
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Desert, 1),
|
||||
(Mountain, 1),
|
||||
@ -342,6 +361,7 @@
|
||||
path: "voxygen.audio.soundtrack.overworld.oceania",
|
||||
length: 135.0,
|
||||
timing: None,
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Lake, 1),
|
||||
(Ocean, 1),
|
||||
@ -355,6 +375,7 @@
|
||||
path: "voxygen.audio.soundtrack.overworld.a_solemn_quest",
|
||||
length: 206.0,
|
||||
timing: Some(Night),
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Forest, 2),
|
||||
],
|
||||
@ -367,6 +388,7 @@
|
||||
path: "voxygen.audio.soundtrack.overworld.into_the_dark_forest",
|
||||
length: 184.0,
|
||||
timing: Some(Night),
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Forest, 2),
|
||||
(Jungle, 1),
|
||||
@ -380,6 +402,7 @@
|
||||
path: "voxygen.audio.soundtrack.overworld.field_grazing",
|
||||
length: 154.0,
|
||||
timing: Some(Day),
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Grassland, 1),
|
||||
(Forest, 2),
|
||||
@ -393,6 +416,7 @@
|
||||
path: "voxygen.audio.soundtrack.overworld.wandering_voices",
|
||||
length: 137.0,
|
||||
timing: Some(Night),
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Grassland, 1),
|
||||
],
|
||||
@ -405,6 +429,7 @@
|
||||
path: "voxygen.audio.soundtrack.overworld.snowtop_volume",
|
||||
length: 89.0,
|
||||
timing: Some(Day),
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Snowland, 1),
|
||||
(Taiga, 1),
|
||||
@ -418,6 +443,7 @@
|
||||
path: "voxygen.audio.soundtrack.cave.mineral_deposits",
|
||||
length: 148.0,
|
||||
timing: None,
|
||||
weather: None,
|
||||
biomes: [],
|
||||
site: Some(Cave),
|
||||
music_state: Activity(Explore),
|
||||
@ -428,6 +454,7 @@
|
||||
path: "voxygen.audio.soundtrack.overworld.moonbeams",
|
||||
length: 158.0,
|
||||
timing: Some(Night),
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Snowland, 1),
|
||||
(Taiga, 1),
|
||||
@ -441,6 +468,7 @@
|
||||
path: "voxygen.audio.soundtrack.overworld.serene_meadows",
|
||||
length: 173.0,
|
||||
timing: Some(Night),
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Grassland, 1),
|
||||
],
|
||||
@ -453,6 +481,7 @@
|
||||
path: "voxygen.audio.soundtrack.overworld.just_the_beginning",
|
||||
length: 188.0,
|
||||
timing: Some(Day),
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Grassland, 1),
|
||||
],
|
||||
@ -465,6 +494,7 @@
|
||||
path: "voxygen.audio.soundtrack.overworld.campfire_stories",
|
||||
length: 100.0,
|
||||
timing: Some(Night),
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Forest, 2),
|
||||
],
|
||||
@ -477,6 +507,7 @@
|
||||
path: "voxygen.audio.soundtrack.overworld.limits",
|
||||
length: 203.0,
|
||||
timing: Some(Day),
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Mountain, 1),
|
||||
],
|
||||
@ -489,6 +520,7 @@
|
||||
path: "voxygen.audio.soundtrack.dungeon.down_the_rabbit_hole",
|
||||
length: 244.0,
|
||||
timing: None,
|
||||
weather: None,
|
||||
biomes: [],
|
||||
site: Some(Cave),
|
||||
music_state: Activity(Explore),
|
||||
@ -499,13 +531,36 @@
|
||||
path: "voxygen.audio.soundtrack.overworld.between_the_fairies",
|
||||
length: 175.0,
|
||||
timing: Some(Day),
|
||||
weather: None,
|
||||
biomes: [
|
||||
(Forest, 2),
|
||||
],
|
||||
site: Some(Void),
|
||||
music_state: Activity(Explore),
|
||||
artist: "badbbad",
|
||||
)),
|
||||
)),
|
||||
Individual((
|
||||
title: "The Heavens Weep",
|
||||
path: "voxygen.audio.soundtrack.overworld.the_heavens_weep",
|
||||
length: 209.0,
|
||||
timing: None,
|
||||
weather: Some(Rain),
|
||||
biomes: [],
|
||||
site: None,
|
||||
music_state: Activity(Explore),
|
||||
artist: "Oolnokk",
|
||||
)),
|
||||
Individual((
|
||||
title: "A Heroes Sorrow",
|
||||
path: "voxygen.audio.soundtrack.overworld.a_heroes_sorrow",
|
||||
length: 251.0,
|
||||
timing: None,
|
||||
weather: Some(Rain),
|
||||
biomes: [],
|
||||
site: None,
|
||||
music_state: Activity(Explore),
|
||||
artist: "Oolnokk",
|
||||
)),
|
||||
|
||||
// Combat Music
|
||||
|
||||
@ -513,6 +568,7 @@
|
||||
title: "Barred Paths",
|
||||
author: "DaforLynx",
|
||||
timing: None,
|
||||
weather: None,
|
||||
biomes: [],
|
||||
site: Some(Dungeon),
|
||||
segments: [
|
||||
|
BIN
assets/voxygen/audio/soundtrack/overworld/a_heros_sorrow.ogg
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/audio/soundtrack/overworld/a_heros_sorrow.ogg
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/audio/soundtrack/overworld/the_heavens_weep.ogg
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/audio/soundtrack/overworld/the_heavens_weep.ogg
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -48,7 +48,7 @@ use common::{
|
||||
trade::{PendingTrade, SitePrices, TradeAction, TradeId, TradeResult},
|
||||
uid::{Uid, UidAllocator},
|
||||
vol::RectVolSize,
|
||||
weather::Weather,
|
||||
weather::{self, Weather},
|
||||
};
|
||||
#[cfg(feature = "tracy")] use common_base::plot;
|
||||
use common_base::{prof_span, span};
|
||||
@ -107,7 +107,7 @@ pub enum Event {
|
||||
CharacterEdited(CharacterId),
|
||||
CharacterError(String),
|
||||
MapMarker(comp::MapMarkerUpdate),
|
||||
WeatherUpdate(Grid<Weather>),
|
||||
WeatherUpdate,
|
||||
}
|
||||
|
||||
pub struct WorldData {
|
||||
@ -159,6 +159,7 @@ pub struct Client {
|
||||
runtime: Arc<Runtime>,
|
||||
server_info: ServerInfo,
|
||||
world_data: WorldData,
|
||||
weather: Grid<Weather>,
|
||||
player_list: HashMap<Uid, PlayerInfo>,
|
||||
character_list: CharacterList,
|
||||
sites: HashMap<SiteId, SiteInfoRich>,
|
||||
@ -610,6 +611,7 @@ impl Client {
|
||||
lod_horizon,
|
||||
map: world_map,
|
||||
},
|
||||
weather: Grid::new(Vec2::new(1, 1), Weather::default()),
|
||||
player_list: HashMap::new(),
|
||||
character_list: CharacterList::default(),
|
||||
sites: sites
|
||||
@ -1415,6 +1417,19 @@ impl Client {
|
||||
.map(|v| v.0)
|
||||
}
|
||||
|
||||
pub fn get_weather(&self) -> &Grid<Weather> { &self.weather }
|
||||
|
||||
pub fn current_weather(&self) -> Weather {
|
||||
if let Some(position) = self.position() {
|
||||
let cell_pos = (position.xy()
|
||||
/ ((TerrainChunkSize::RECT_SIZE * weather::CHUNKS_PER_CELL).as_()))
|
||||
.as_();
|
||||
*self.weather.get(cell_pos).unwrap_or(&Weather::default())
|
||||
} else {
|
||||
Weather::default()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn current_chunk(&self) -> Option<Arc<TerrainChunk>> {
|
||||
let chunk_pos = Vec2::from(self.position()?)
|
||||
.map2(TerrainChunkSize::RECT_SIZE, |e: f32, sz| {
|
||||
@ -2196,7 +2211,8 @@ impl Client {
|
||||
frontend_events.push(Event::MapMarker(event));
|
||||
},
|
||||
ServerGeneral::WeatherUpdate(weather) => {
|
||||
frontend_events.push(Event::WeatherUpdate(weather));
|
||||
self.weather = weather;
|
||||
frontend_events.push(Event::WeatherUpdate);
|
||||
},
|
||||
_ => unreachable!("Not a in_game message"),
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use vek::Vec2;
|
||||
|
||||
pub const CHUNKS_PER_CELL: u32 = 16;
|
||||
// Weather::default is Clear, 0 degrees C and no wind
|
||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize, Default)]
|
||||
pub struct Weather {
|
||||
@ -18,7 +19,8 @@ impl Weather {
|
||||
(self.rain * 10.0) as i32,
|
||||
(self.wind.magnitude() * 10.0) as i32,
|
||||
) {
|
||||
(_, _, 2455..) => WeatherKind::Storm,
|
||||
// Over 24.5 m/s wind is a storm
|
||||
(_, _, 245..) => WeatherKind::Storm,
|
||||
(_, 1..=10, _) => WeatherKind::Rain,
|
||||
(4..=10, _, _) => WeatherKind::Cloudy,
|
||||
_ => WeatherKind::Clear,
|
||||
@ -26,6 +28,7 @@ impl Weather {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub enum WeatherKind {
|
||||
Clear,
|
||||
Cloudy,
|
||||
|
@ -1,3 +1,4 @@
|
||||
use common::weather::CHUNKS_PER_CELL;
|
||||
use common_ecs::{dispatch, System};
|
||||
use common_state::State;
|
||||
use specs::DispatcherBuilder;
|
||||
@ -13,7 +14,6 @@ pub fn add_server_systems(dispatch_builder: &mut DispatcherBuilder) {
|
||||
dispatch::<tick::Sys>(dispatch_builder, &[]);
|
||||
dispatch::<sync::Sys>(dispatch_builder, &[&tick::Sys::sys_name()]);
|
||||
}
|
||||
const CHUNKS_PER_CELL: u32 = 16;
|
||||
|
||||
pub fn init(state: &mut State, world: &world::World) {
|
||||
// How many chunks wide a weather cell is.
|
||||
|
@ -8,7 +8,7 @@ use common::{
|
||||
resources::TimeOfDay,
|
||||
terrain::{BiomeKind, TerrainChunkSize},
|
||||
vol::RectVolSize,
|
||||
weather::Weather,
|
||||
weather::{Weather, CHUNKS_PER_CELL},
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use vek::*;
|
||||
@ -261,7 +261,7 @@ impl WeatherSim {
|
||||
cell.rain -= rain_fall_max;
|
||||
self.weather[point].rain = 1.0;
|
||||
} else {
|
||||
self.weather[point].rain = 0.0;
|
||||
self.weather[point].rain = 0.5;
|
||||
}
|
||||
cell.moisture += evaporation - condensation;
|
||||
|
||||
|
@ -48,6 +48,7 @@ use client::Client;
|
||||
use common::{
|
||||
assets::{self, AssetExt, AssetHandle},
|
||||
terrain::{BiomeKind, SitesKind},
|
||||
weather::WeatherKind,
|
||||
};
|
||||
use common_state::State;
|
||||
use hashbrown::HashMap;
|
||||
@ -78,6 +79,8 @@ pub struct SoundtrackItem {
|
||||
length: f32,
|
||||
/// Whether this track should play during day or night
|
||||
timing: Option<DayPeriod>,
|
||||
/// Whether this track should play during a certain weather
|
||||
weather: Option<WeatherKind>,
|
||||
/// What biomes this track should play in with chance of play
|
||||
biomes: Vec<(BiomeKind, u8)>,
|
||||
/// Whether this track should play in a specific site
|
||||
@ -98,6 +101,7 @@ enum RawSoundtrackItem {
|
||||
Segmented {
|
||||
title: String,
|
||||
timing: Option<DayPeriod>,
|
||||
weather: Option<WeatherKind>,
|
||||
biomes: Vec<(BiomeKind, u8)>,
|
||||
site: Option<SitesKind>,
|
||||
segments: Vec<(String, f32, MusicState, Option<MusicActivity>)>,
|
||||
@ -328,6 +332,7 @@ impl MusicMgr {
|
||||
|
||||
let is_dark = (state.get_day_period().is_dark()) as bool;
|
||||
let current_period_of_day = Self::get_current_day_period(is_dark);
|
||||
let current_weather = client.current_weather();
|
||||
let current_biome = client.current_biome();
|
||||
let current_site = client.current_site();
|
||||
|
||||
@ -348,6 +353,9 @@ impl MusicMgr {
|
||||
}) && match &track.site {
|
||||
Some(site) => site == ¤t_site,
|
||||
None => true,
|
||||
} && match &track.weather {
|
||||
Some(weather) => weather == ¤t_weather.get_kind(),
|
||||
None => true,
|
||||
}
|
||||
})
|
||||
.filter(|track| {
|
||||
@ -457,6 +465,7 @@ impl assets::Compound for SoundtrackCollection<SoundtrackItem> {
|
||||
RawSoundtrackItem::Segmented {
|
||||
title,
|
||||
timing,
|
||||
weather,
|
||||
biomes,
|
||||
site,
|
||||
segments,
|
||||
@ -467,6 +476,7 @@ impl assets::Compound for SoundtrackCollection<SoundtrackItem> {
|
||||
path,
|
||||
length,
|
||||
timing: timing.clone(),
|
||||
weather: weather.clone(),
|
||||
biomes: biomes.clone(),
|
||||
site,
|
||||
music_state,
|
||||
|
@ -325,15 +325,17 @@ impl SessionState {
|
||||
client::Event::MapMarker(event) => {
|
||||
self.hud.show.update_map_markers(event);
|
||||
},
|
||||
client::Event::WeatherUpdate(weather) => {
|
||||
client::Event::WeatherUpdate => {
|
||||
//weather
|
||||
// .iter_mut()
|
||||
// .for_each(|(p, c)| *c = if (p.x + p.y) % 2 == 0 { 1.0 } else { 0.0 });
|
||||
let size = client.get_weather().size();
|
||||
global_state.window.renderer_mut().update_texture(
|
||||
&self.scene.lod.get_data().clouds,
|
||||
[0, 0],
|
||||
[weather.size().x as u32, weather.size().y as u32],
|
||||
weather
|
||||
[size.x as u32, size.y as u32],
|
||||
client
|
||||
.get_weather()
|
||||
.iter()
|
||||
.map(|(_, w)| {
|
||||
[
|
||||
|
Loading…
Reference in New Issue
Block a user