From 2e0272ce28a08caefe9b2211212cba825c41d397 Mon Sep 17 00:00:00 2001 From: DaforLynx Date: Wed, 28 Apr 2021 05:07:59 +0000 Subject: [PATCH] Town music --- CHANGELOG.md | 1 + assets/voxygen/audio/soundtrack.ron | 51 ++++++++++++++++--- ..._paths-hi-end.ogg => barred_paths-end.ogg} | 0 .../barred_paths/barred_paths-lo-end.ogg | 3 -- .../barred_paths/barred_paths-lo-loop.ogg | 3 -- .../barred_paths/barred_paths-lo-start.ogg | 3 -- ...aths-hi-loop.ogg => barred_paths-loop.ogg} | 0 ...hs-hi-start.ogg => barred_paths-start.ogg} | 0 .../barred_paths/barred_paths-trans-hi-lo.ogg | 3 -- .../barred_paths/barred_paths-trans-lo-hi.ogg | 3 -- client/src/lib.rs | 8 ++- common/src/terrain/mod.rs | 13 +++++ voxygen/src/audio/music.rs | 2 + world/src/lib.rs | 9 ++++ 14 files changed, 75 insertions(+), 24 deletions(-) rename assets/voxygen/audio/soundtrack/combat/barred_paths/{barred_paths-hi-end.ogg => barred_paths-end.ogg} (100%) delete mode 100644 assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-lo-end.ogg delete mode 100644 assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-lo-loop.ogg delete mode 100644 assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-lo-start.ogg rename assets/voxygen/audio/soundtrack/combat/barred_paths/{barred_paths-hi-loop.ogg => barred_paths-loop.ogg} (100%) rename assets/voxygen/audio/soundtrack/combat/barred_paths/{barred_paths-hi-start.ogg => barred_paths-start.ogg} (100%) delete mode 100644 assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-trans-hi-lo.ogg delete mode 100644 assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-trans-lo-hi.ogg diff --git a/CHANGELOG.md b/CHANGELOG.md index c13fb25a19..65a5cc791b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Day period dependant wildlife spawns - You can now block and parry with melee weapons - Lift is now calculated for gliders based on dimensions (currently same for all) +- Specific music tracks can now play exclusively in towns. ### Changed diff --git a/assets/voxygen/audio/soundtrack.ron b/assets/voxygen/audio/soundtrack.ron index 6321af451f..9ecf0ae0e3 100644 --- a/assets/voxygen/audio/soundtrack.ron +++ b/assets/voxygen/audio/soundtrack.ron @@ -7,6 +7,46 @@ ( tracks: [ + Individual(( + title: "Rest Assured", + path: "voxygen.audio.soundtrack.town.rest_assured", + length: 189.0, + timing: Some(Day), + biomes: [], + site: Some(Settlement), + music_state: Activity(Explore), + artist: "badbbad", + )), + Individual(( + title: "Library Theme", + path: "voxygen.audio.soundtrack.town.library_theme", + length: 65.0, + timing: Some(Day), + biomes: [], + site: Some(Settlement), + music_state: Activity(Explore), + artist: "Aeronic", + )), + Individual(( + title: "Onwards!", + path: "voxygen.audio.soundtrack.town.onwards", + length: 151.0, + timing: Some(Night), + biomes: [], + site: Some(Settlement), + music_state: Activity(Explore), + artist: "lorenzo_rozzi", + )), + Individual(( + title: "I'm Home", + path: "voxygen.audio.soundtrack.town.im_home", + length: 125.0, + timing: Some(Night), + biomes: [], + site: Some(Settlement), + music_state: Activity(Explore), + artist: "badbbad", + )), Individual(( title: "Dank Dungeon", path: "voxygen.audio.soundtrack.dungeon.dank_dungeon", @@ -381,14 +421,9 @@ biomes: [], site: Some(Dungeon), segments: [ - ("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-hi-end", 6.0, Transition(Combat(High), Explore), None), - ("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-hi-loop", 54.0, Activity(Combat(High)), None), - ("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-hi-start", 56.0, Transition(Explore, Combat(High)), Some(Combat(High))), - // ("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-lo-end", 3.0, Transition(Combat(Low), Explore), None), - // ("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-lo-loop", 7.0, Activity(Combat(Low)), None), - // ("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-lo-start", 10.0, Transition(Explore, Combat(Low)), None), - // ("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-trans-hi-lo", 10.0, Transition(Combat(High), Combat(Low)), None), - // ("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-trans-lo-hi", 7.0, Transition(Combat(Low), Combat(High)), None), + ("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-end", 6.0, Transition(Combat(High), Explore), None), + ("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-loop", 54.0, Activity(Combat(High)), None), + ("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-start", 56.0, Transition(Explore, Combat(High)), Some(Combat(High))), ], ), ] diff --git a/assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-hi-end.ogg b/assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-end.ogg similarity index 100% rename from assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-hi-end.ogg rename to assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-end.ogg diff --git a/assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-lo-end.ogg b/assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-lo-end.ogg deleted file mode 100644 index af2e027343..0000000000 --- a/assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-lo-end.ogg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9d533af2ac981004367024ee49cf28ff29a55b01beaa1ddf46e2ef3503fca2f4 -size 66906 diff --git a/assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-lo-loop.ogg b/assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-lo-loop.ogg deleted file mode 100644 index fd7b53d16e..0000000000 --- a/assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-lo-loop.ogg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d8075cd260e7a40dfd34f707536a0e14dc808a40c3ee6c60b64bcb58a32110f4 -size 137390 diff --git a/assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-lo-start.ogg b/assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-lo-start.ogg deleted file mode 100644 index 7ea491255f..0000000000 --- a/assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-lo-start.ogg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5f7d93a7e02d6028c09bfe2f6b84c9144d32085819e58ba69180dbd213f9f713 -size 193104 diff --git a/assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-hi-loop.ogg b/assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-loop.ogg similarity index 100% rename from assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-hi-loop.ogg rename to assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-loop.ogg diff --git a/assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-hi-start.ogg b/assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-start.ogg similarity index 100% rename from assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-hi-start.ogg rename to assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-start.ogg diff --git a/assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-trans-hi-lo.ogg b/assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-trans-hi-lo.ogg deleted file mode 100644 index 4ec0305287..0000000000 --- a/assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-trans-hi-lo.ogg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f5899c9320aa61f47b772b98906a205831e2f22d3697446031443827f18c67ba -size 203896 diff --git a/assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-trans-lo-hi.ogg b/assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-trans-lo-hi.ogg deleted file mode 100644 index 5a24de8c05..0000000000 --- a/assets/voxygen/audio/soundtrack/combat/barred_paths/barred_paths-trans-lo-hi.ogg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fe4daa29272234be5b94faa32c5e77a01433c3289409e822796f089f920dddd1 -size 133418 diff --git a/client/src/lib.rs b/client/src/lib.rs index 4c77cb928f..100cb2ea0b 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -1306,14 +1306,20 @@ impl Client { } let mut contains_cave = false; let mut terrain_alt = 0.0; + let mut contains_dungeon = false; + let mut contains_settlement = false; if let Some(chunk) = self.current_chunk() { terrain_alt = chunk.meta().alt(); contains_cave = chunk.meta().contains_cave(); + contains_dungeon = chunk.meta().contains_dungeon(); + contains_settlement = chunk.meta().contains_settlement(); } if player_alt < (terrain_alt - 25.0) && contains_cave { SitesKind::Cave - } else if player_alt < (terrain_alt - 25.0) { + } else if player_alt < (terrain_alt - 25.0) && contains_dungeon { SitesKind::Dungeon + } else if contains_settlement { + SitesKind::Settlement } else { SitesKind::Void } diff --git a/common/src/terrain/mod.rs b/common/src/terrain/mod.rs index 5360b6c7c8..39dc773f88 100644 --- a/common/src/terrain/mod.rs +++ b/common/src/terrain/mod.rs @@ -87,8 +87,11 @@ pub struct TerrainChunkMeta { contains_cave: bool, contains_river: bool, temp: f32, + contains_settlement: bool, + contains_dungeon: bool, } +#[allow(clippy::clippy::too_many_arguments)] impl TerrainChunkMeta { pub fn new( name: Option, @@ -98,6 +101,8 @@ impl TerrainChunkMeta { contains_cave: bool, contains_river: bool, temp: f32, + contains_settlement: bool, + contains_dungeon: bool, ) -> Self { Self { name, @@ -107,6 +112,8 @@ impl TerrainChunkMeta { contains_cave, contains_river, temp, + contains_settlement, + contains_dungeon, } } @@ -119,6 +126,8 @@ impl TerrainChunkMeta { contains_cave: false, contains_river: false, temp: 0.0, + contains_settlement: false, + contains_dungeon: false, } } @@ -134,6 +143,10 @@ impl TerrainChunkMeta { pub fn contains_river(&self) -> bool { self.contains_river } + pub fn contains_settlement(&self) -> bool { self.contains_settlement } + + pub fn contains_dungeon(&self) -> bool { self.contains_dungeon } + pub fn temp(&self) -> f32 { self.temp } } diff --git a/voxygen/src/audio/music.rs b/voxygen/src/audio/music.rs index 75154ac3d1..5298e006b8 100644 --- a/voxygen/src/audio/music.rs +++ b/voxygen/src/audio/music.rs @@ -221,6 +221,8 @@ impl MusicMgr { //println!("alt: {}", current_chunk.meta().alt()); //println!("tree_density: {}", // current_chunk.meta().tree_density()); + // let current_site = client.current_site(); + // println!("{:?}", current_site); //if let Some(position) = client.current::() { // player_alt = position.0.z; //} diff --git a/world/src/lib.rs b/world/src/lib.rs index a349e5bf7a..6e515d1ef3 100644 --- a/world/src/lib.rs +++ b/world/src/lib.rs @@ -45,6 +45,7 @@ pub use index::{IndexOwned, IndexRef}; use crate::{ column::ColumnGen, index::Index, + site::SiteKind, util::{Grid, Sampler}, }; use common::{ @@ -281,6 +282,14 @@ impl World { sim_chunk.cave.1.alt != 0.0, sim_chunk.river.is_river(), sim_chunk.temp, + sim_chunk + .sites + .iter() + .any(|site| matches!(index.sites[*site].kind, SiteKind::Settlement(_))), + sim_chunk + .sites + .iter() + .any(|site| matches!(index.sites[*site].kind, SiteKind::Dungeon(_))), ); let mut chunk = TerrainChunk::new(base_z, stone, air, meta);