Merge branch 'DaforLynx/audio-additions' into 'master'

Gnarling Fort music; more specific sites; fix music spacing; new sfx

See merge request veloren/veloren!3532
This commit is contained in:
Isse 2022-08-14 01:57:58 +00:00
commit 4ddd7ff4c9
29 changed files with 343 additions and 193 deletions

BIN
assets/voxygen/audio/ambience/cave.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/ambience/leaves.ogg (Stored with Git LFS)

Binary file not shown.

BIN
assets/voxygen/audio/ambience/rain.ogg (Stored with Git LFS)

Binary file not shown.

BIN
assets/voxygen/audio/ambience/thunder.ogg (Stored with Git LFS)

Binary file not shown.

BIN
assets/voxygen/audio/ambience/wind.ogg (Stored with Git LFS)

Binary file not shown.

View File

@ -20,5 +20,10 @@
length: 26.0,
tag: Leaves,
),
(
path:"voxygen.audio.ambience.cave",
length: 75.5,
tag: Cave,
)
]
)

View File

@ -1,6 +1,6 @@
(
combat_nearby_radius: 25.0,
combat_health_factor: 50.0,
combat_health_factor: 70.0,
combat_nearby_high_thresh: 4,
combat_nearby_low_thresh: 4,
fade_timings: {

View File

@ -348,13 +348,13 @@
//
Wield(Hammer): (
files: [
"voxygen.audio.sfx.weapon.sword_out",
"voxygen.audio.sfx.weapon.weapon_out",
],
threshold: 0.5,
),
Unwield(Hammer): (
files: [
"voxygen.audio.sfx.weapon.sword_in",
"voxygen.audio.sfx.weapon.weapon_in",
],
threshold: 0.5,
),
@ -388,13 +388,13 @@
//
Wield(Axe): (
files: [
"voxygen.audio.sfx.weapon.sword_out",
"voxygen.audio.sfx.weapon.weapon_out",
],
threshold: 0.5,
),
Unwield(Axe): (
files: [
"voxygen.audio.sfx.weapon.sword_in",
"voxygen.audio.sfx.weapon.weapon_in",
],
threshold: 0.5,
),
@ -434,13 +434,13 @@
//
Wield(Staff): (
files: [
"voxygen.audio.sfx.weapon.sword_out",
"voxygen.audio.sfx.weapon.staff_out",
],
threshold: 0.5,
),
Unwield(Staff): (
files: [
"voxygen.audio.sfx.weapon.sword_in",
"voxygen.audio.sfx.weapon.staff_in",
],
threshold: 0.5,
),
@ -468,13 +468,13 @@
//
Wield(Bow): (
files: [
"voxygen.audio.sfx.weapon.sword_out",
"voxygen.audio.sfx.weapon.weapon_out",
],
threshold: 0.5,
),
Unwield(Bow): (
files: [
"voxygen.audio.sfx.weapon.sword_in",
"voxygen.audio.sfx.weapon.weapon_in",
],
threshold: 0.5,
),
@ -496,13 +496,13 @@
//
Wield(Sceptre): (
files: [
"voxygen.audio.sfx.weapon.sword_out",
"voxygen.audio.sfx.weapon.staff_out",
],
threshold: 0.5,
),
Unwield(Sceptre): (
files: [
"voxygen.audio.sfx.weapon.sword_in",
"voxygen.audio.sfx.weapon.staff_in",
],
threshold: 0.5,
),
@ -514,7 +514,7 @@
),
Inventory(CollectedTool(Sceptre)): (
files: [
"voxygen.audio.sfx.inventory.add_item",
"voxygen.audio.sfx.inventory.pickup_staff",
],
threshold: 0.3,
),
@ -564,7 +564,7 @@
),
Unwield(Shield): (
files: [
"voxygen.audio.sfx.weapon.sword_in",
"voxygen.audio.sfx.weapon.weapon_in",
],
threshold: 0.5,
),

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
assets/voxygen/audio/sfx/weapon/weapon_in.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/weapon/weapon_out.ogg (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,15 +1,17 @@
// Times: Some(Day), Some(Night), None [both]
// Times: Some(Day or Night) or None [both]
// Weathers: Some(Clear, Cloudy, Rain, or Storm) or None [any weather]
// Biomes: Grassland, Forest, Desert, Snowland, Lake, Mountain, Ocean, Jungle, Savannah, Taiga
// planned biomes: Swamp
// Number after biome indicates weighting
// Sites: Some(Settlement), Some(Cave), Some(Dungeon), Some(Void) [none]
// Music states: Activity(Explore), Activity(Combat)
// Number after biome indicates weighting; higher numbers are less frequent
// Sites: Settlement(Default, Cliff, or Desert), Cave, Dungeon(Old or Gnarling), or Void [none]
// Music states: Activity(Explore or Combat)
// Combat music is looped. Needs three files: start, loop, and end. Start contains leadup to the loop.
// It's recommended to also have appropriate metadata for those who listen via the game files :)
(
tracks:
[
[
// Overworld exploration tracks
Individual((
@ -17,10 +19,11 @@
path: "voxygen.audio.soundtrack.overworld.the_undergrowth",
length: 165.0,
timing: None,
weather: None,
biomes: [
(Jungle, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "Oolnokk",
)),
@ -29,11 +32,12 @@
path: "voxygen.audio.soundtrack.overworld.moonlit_canopy",
length: 170.0,
timing: Some(Night),
weather: None,
biomes: [
(Forest, 2),
(Forest, 1),
(Taiga, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "GeekyGami",
)),
@ -42,11 +46,12 @@
path: "voxygen.audio.soundtrack.overworld.adventurous_soul",
length: 184.0,
timing: Some(Night),
weather: None,
biomes: [
(Mountain, 1),
(Snowland, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "Crow",
)),
@ -55,59 +60,62 @@
path: "voxygen.audio.soundtrack.overworld.stargazing",
length: 216.0,
timing: Some(Night),
weather: None,
biomes: [
(Taiga, 1),
(Grassland, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "GeekyGami",
)),
Individual((
title: "The Heavens Weep",
path: "voxygen.audio.soundtrack.overworld.the_heavens_weep",
length: 209.0,
length: 210.0,
timing: None,
weather: Some(Rain),
biomes: [],
site: None,
sites: [Void],
music_state: Activity(Explore),
artist: "Oolnokk",
)),
Individual((
title: "A Hero's Sorrow",
path: "voxygen.audio.soundtrack.overworld.a_heros_sorrow",
length: 251.0,
length: 252.0,
timing: None,
weather: Some(Rain),
biomes: [],
site: None,
sites: [Void],
music_state: Activity(Explore),
artist: "Oolnokk",
)),
Individual((
title: "Follow the Signs",
path: "voxygen.audio.soundtrack.town.follow_the_signs",
path: "voxygen.audio.soundtrack.overworld.follow_the_signs",
length: 154.0,
timing: Some(Night),
weather: None,
biomes: [
(Forest, 1),
(Taiga, 1),
(Forest, 2),
(Taiga, 2),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "Oolnokk",
)),
Individual((
title: "Travel By Night",
path: "voxygen.audio.soundtrack.town.travel_by_night",
path: "voxygen.audio.soundtrack.overworld.travel_by_night",
length: 66.0,
timing: Some(Night),
weather: None,
biomes: [
(Forest, 2),
(Forest, 1),
(Taiga, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "Oolnokk",
)),
@ -116,11 +124,12 @@
path: "voxygen.audio.soundtrack.overworld.raising_below_like_thunder",
length: 120.0,
timing: Some(Night),
weather: None,
biomes: [
(Desert, 1),
(Savannah, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "Rarnage",
)),
@ -133,7 +142,7 @@
biomes: [
(Mountain, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "Ultimafounding; mixed by Robotnik",
)),
@ -144,9 +153,9 @@
timing: Some(Day),
weather: None,
biomes: [
(Forest, 2),
(Forest, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "DaforLynx",
)),
@ -159,7 +168,7 @@
biomes: [
(Jungle, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "badbbad",
)),
@ -172,7 +181,7 @@
biomes: [
(Mountain, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "Aeronic",
)),
@ -186,7 +195,7 @@
(Ocean, 1),
(Lake, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "Aeronic",
)),
@ -200,7 +209,7 @@
(Desert, 1),
(Savannah, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "badbbad",
)),
@ -213,7 +222,7 @@
biomes: [
(Grassland, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "Aeronic",
)),
@ -227,7 +236,7 @@
(Grassland, 1),
(Savannah, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "Ultimafounding",
)),
@ -241,7 +250,7 @@
(Lake, 1),
(Ocean, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "DaforLynx",
)),
@ -254,7 +263,7 @@
biomes: [
(Snowland, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "DaforLynx",
)),
@ -268,7 +277,7 @@
(Desert, 1),
(Mountain, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "Ap1evideogame",
)),
@ -282,7 +291,7 @@
(Lake, 1),
(Ocean, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "Eden",
)),
@ -293,10 +302,10 @@
timing: Some(Night),
weather: None,
biomes: [
(Forest, 2),
(Forest, 1),
(Taiga, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "Eden",
)),
@ -307,9 +316,9 @@
timing: Some(Night),
weather: None,
biomes: [
(Forest, 2),
(Forest, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "Aeronic",
)),
@ -321,9 +330,9 @@
weather: None,
biomes: [
(Grassland, 1),
(Forest, 2),
(Forest, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "Aeronic",
)),
@ -336,7 +345,7 @@
biomes: [
(Grassland, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "Aeronic",
)),
@ -349,7 +358,7 @@
biomes: [
(Snowland, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "Aeronic",
)),
@ -362,7 +371,7 @@
biomes: [
(Snowland, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "Aeronic",
)),
@ -375,7 +384,7 @@
biomes: [
(Grassland, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "Aeronic",
)),
@ -388,7 +397,7 @@
biomes: [
(Grassland, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "badbbad",
)),
@ -399,10 +408,10 @@
timing: Some(Night),
weather: None,
biomes: [
(Forest, 2),
(Forest, 1),
(Taiga, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "badbbad",
)),
@ -416,7 +425,7 @@
(Mountain, 1),
(Taiga, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "badbbad",
)),
@ -427,10 +436,10 @@
timing: Some(Day),
weather: None,
biomes: [
(Forest, 2),
(Forest, 1),
(Taiga, 1),
],
site: Some(Void),
sites: [Void],
music_state: Activity(Explore),
artist: "badbbad",
)),
@ -442,11 +451,15 @@
path: "voxygen.audio.soundtrack.town.life_of_a_background_mob",
length: 234.0,
timing: Some(Day),
weather: None,
biomes: [
(Forest, 2),
(Forest, 1),
(Grassland, 1),
],
site: Some(Settlement),
sites: [
Settlement(Default),
Settlement(Cliff),
],
music_state: Activity(Explore),
artist: "GeekyGami",
)),
@ -455,8 +468,13 @@
path: "voxygen.audio.soundtrack.town.warmth_of_the_hearth",
length: 156.0,
timing: Some(Night),
weather: None,
biomes:[],
site: Some(Settlement),
sites: [
Settlement(Default),
Settlement(Cliff),
Settlement(Desert),
],
music_state: Activity(Explore),
artist: "Crow",
)),
@ -465,8 +483,13 @@
path: "voxygen.audio.soundtrack.town.the_quiet_after_the_battle",
length: 240.0,
timing: Some(Night),
weather: None,
biomes: [],
site: Some(Settlement),
sites: [
Settlement(Default),
Settlement(Cliff),
Settlement(Desert),
],
music_state: Activity(Explore),
artist: "Tobias Thy - (Thy SFX)",
)),
@ -475,8 +498,12 @@
path: "voxygen.audio.soundtrack.town.a_rest_under_the_sunset",
length: 83.0,
timing: Some(Day),
weather: None,
biomes: [],
site: Some(Settlement),
sites: [
Settlement(Default),
Settlement(Cliff),
],
music_state: Activity(Explore),
artist: "phoenix13032005",
)),
@ -485,8 +512,13 @@
path: "voxygen.audio.soundtrack.town.a_tale_worth_telling",
length: 279.0,
timing: Some(Night),
weather: None,
biomes: [],
site: Some(Settlement),
sites: [
Settlement(Default),
Settlement(Cliff),
Settlement(Desert),
],
music_state: Activity(Explore),
artist: "Oolnokk; mixed by cereal7",
)),
@ -495,8 +527,12 @@
path: "voxygen.audio.soundtrack.town.bustle_and_bloom",
length: 155.0,
timing: Some(Day),
weather: None,
biomes: [],
site: Some(Settlement),
sites: [
Settlement(Default),
Settlement(Cliff),
],
music_state: Activity(Explore),
artist: "DaforLynx",
)),
@ -505,21 +541,26 @@
path: "voxygen.audio.soundtrack.town.starlit_pathways",
length: 132.0,
timing: Some(Night),
weather: None,
biomes: [],
site: Some(Settlement),
sites: [
Settlement(Default),
Settlement(Cliff),
Settlement(Desert),
],
music_state: Activity(Explore),
artist: "DaforLynx",
)),
Individual((
title: "Fiesta Del Pueblo",
path: "voxygen.audio.soundtrack.town.fiesta_del_pueblo",
length: 183.0,
length: 96.0,
timing: Some(Day),
weather: None,
biomes: [
(Desert, 1)
biomes: [],
sites: [
Settlement(Desert),
],
site: Some(Settlement),
music_state: Activity(Explore),
artist: "Aeronic; mixed by Robotnik",
)),
@ -530,7 +571,10 @@
timing: Some(Day),
weather: None,
biomes: [],
site: Some(Settlement),
sites: [
Settlement(Default),
Settlement(Cliff),
],
music_state: Activity(Explore),
artist: "badbbad",
)),
@ -541,7 +585,10 @@
timing: Some(Night),
weather: None,
biomes: [],
site: Some(Settlement),
sites: [
Settlement(Default),
Settlement(Cliff),
],
music_state: Activity(Explore),
artist: "badbbad",
)),
@ -553,8 +600,9 @@
path: "voxygen.audio.soundtrack.cave.stars_like_stalactites",
length: 130.0,
timing: None,
weather: None,
biomes: [],
site: Some(Cave),
sites: [Cave],
music_state: Activity(Explore),
artist: "DragonDee",
)),
@ -563,8 +611,9 @@
path: "voxygen.audio.soundtrack.cave.cavernous_hollow",
length: 256.0,
timing: None,
weather: None,
biomes: [],
site: Some(Cave),
sites: [Cave],
music_state: Activity(Explore),
artist: "GeekyGami",
)),
@ -575,7 +624,7 @@
timing: None,
weather: None,
biomes: [],
site: Some(Cave),
sites: [Cave],
music_state: Activity(Explore),
artist: "Flashbang",
)),
@ -586,7 +635,7 @@
timing: None,
weather: None,
biomes: [],
site: Some(Cave),
sites: [Cave],
music_state: Activity(Explore),
artist: "Aeronic",
)),
@ -597,19 +646,23 @@
timing: None,
weather: None,
biomes: [],
site: Some(Cave),
sites: [Cave],
music_state: Activity(Explore),
artist: "badbbad",
)),
// Dungeon music
Individual((
title: "Mysty Temple",
path: "voxygen.audio.soundtrack.dungeon.mysty_temple",
length: 183.0,
timing: None,
weather: None,
biomes:[],
site: Some(Dungeon),
sites: [
Dungeon(Old),
],
music_state: Activity(Explore),
artist: "Tiny",
)),
@ -618,8 +671,11 @@
path: "voxygen.audio.soundtrack.dungeon.cobbled_halls",
length: 240.0,
timing: None,
weather: None,
biomes:[],
site: Some(Dungeon),
sites: [
Dungeon(Old),
],
music_state: Activity(Explore),
artist: "Crow",
)),
@ -630,7 +686,9 @@
timing: None,
weather: None,
biomes: [],
site: Some(Dungeon),
sites: [
Dungeon(Old),
],
music_state: Activity(Explore),
artist: "Aeronic",
)),
@ -641,7 +699,9 @@
timing: None,
weather: None,
biomes: [],
site: Some(Dungeon),
sites: [
Dungeon(Old),
],
music_state: Activity(Explore),
artist: "Aeronic",
)),
@ -652,7 +712,9 @@
timing: None,
weather: None,
biomes: [],
site: Some(Dungeon),
sites: [
Dungeon(Old),
],
music_state: Activity(Explore),
artist: "Aeronic",
)),
@ -663,10 +725,38 @@
timing: None,
weather: None,
biomes: [],
site: Some(Dungeon),
sites: [
Dungeon(Old),
],
music_state: Activity(Explore),
artist: "Aeronic",
)),
Individual((
title: "The Undergrowth",
path: "voxygen.audio.soundtrack.overworld.the_undergrowth",
length: 165.0,
timing: None,
weather: None,
biomes: [],
sites: [
Dungeon(Gnarling),
],
music_state: Activity(Explore),
artist: "Oolnokk",
)),
Individual((
title: "Jungle Ambient",
path: "voxygen.audio.soundtrack.overworld.jungle_ambient",
length: 218.0,
timing: None,
weather: None,
biomes: [],
sites: [
Dungeon(Gnarling),
],
music_state: Activity(Explore),
artist: "badbbad",
)),
// Combat Music
@ -675,7 +765,9 @@
timing: None,
weather: None,
biomes: [],
site: Some(Dungeon),
sites: [
Dungeon(Old),
],
segments: [
("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-start", 56.0, Transition(Explore, Combat(High)), Some(Combat(High))),
("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-loop", 54.0, Activity(Combat(High)), None),
@ -688,7 +780,9 @@
timing: None,
weather: None,
biomes: [],
site: Some(Dungeon),
sites: [
Dungeon(Old),
],
segments: [
("voxygen.audio.soundtrack.combat.reversal.reversal-start", 60.0, Transition(Explore, Combat(High)), Some(Combat(High))),
("voxygen.audio.soundtrack.combat.reversal.reversal-loop", 60.0, Activity(Combat(High)), None),

Binary file not shown.

View File

@ -42,8 +42,8 @@ use common::{
resources::{PlayerEntity, TimeOfDay},
spiral::Spiral2d,
terrain::{
block::Block, map::MapConfig, neighbors, BiomeKind, SitesKind, SpriteKind, TerrainChunk,
TerrainChunkSize,
block::Block, map::MapConfig, neighbors, site::DungeonKindMeta, BiomeKind, SiteKindMeta,
SpriteKind, TerrainChunk, TerrainChunkSize,
},
trade::{PendingTrade, SitePrices, TradeAction, TradeId, TradeResult},
uid::{Uid, UidAllocator},
@ -1517,31 +1517,30 @@ impl Client {
}
}
pub fn current_site(&self) -> SitesKind {
pub fn current_site(&self) -> SiteKindMeta {
let mut player_alt = 0.0;
if let Some(position) = self.current::<comp::Pos>() {
player_alt = position.0.z;
}
//let mut contains_cave = false;
let mut terrain_alt = 0.0;
let mut contains_dungeon = false;
let mut contains_settlement = false;
let mut site = None;
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();
site = chunk.meta().site();
}
if player_alt < terrain_alt - 40.0 {
if contains_dungeon {
SitesKind::Dungeon
if let Some(SiteKindMeta::Dungeon(dungeon)) = site {
SiteKindMeta::Dungeon(dungeon)
} else {
SitesKind::Cave
SiteKindMeta::Cave
}
} else if contains_settlement {
SitesKind::Settlement
} else if matches!(site, Some(SiteKindMeta::Dungeon(DungeonKindMeta::Old))) {
// If the player is in a dungeon chunk but aboveground, pass Void instead
SiteKindMeta::Void
} else {
SitesKind::Void
site.unwrap_or_default()
}
}

View File

@ -11,7 +11,7 @@ pub use self::{
biome::BiomeKind,
block::{Block, BlockKind},
map::MapSizeLg,
site::SitesKind,
site::SiteKindMeta,
sprite::SpriteKind,
structure::{Structure, StructuresGroup},
};
@ -89,8 +89,7 @@ pub struct TerrainChunkMeta {
river_velocity: Vec3<f32>,
temp: f32,
humidity: f32,
contains_settlement: bool,
contains_dungeon: bool,
site: Option<SiteKindMeta>,
}
impl TerrainChunkMeta {
@ -104,8 +103,7 @@ impl TerrainChunkMeta {
river_velocity: Vec3<f32>,
temp: f32,
humidity: f32,
contains_settlement: bool,
contains_dungeon: bool,
site: Option<SiteKindMeta>,
) -> Self {
Self {
name,
@ -117,8 +115,7 @@ impl TerrainChunkMeta {
river_velocity,
temp,
humidity,
contains_settlement,
contains_dungeon,
site,
}
}
@ -133,8 +130,7 @@ impl TerrainChunkMeta {
river_velocity: Vec3::zero(),
temp: 0.0,
humidity: 0.0,
contains_settlement: false,
contains_dungeon: false,
site: None,
}
}
@ -152,9 +148,7 @@ impl TerrainChunkMeta {
pub fn river_velocity(&self) -> Vec3<f32> { self.river_velocity }
pub fn contains_settlement(&self) -> bool { self.contains_settlement }
pub fn contains_dungeon(&self) -> bool { self.contains_dungeon }
pub fn site(&self) -> Option<SiteKindMeta> { self.site }
pub fn temp(&self) -> f32 { self.temp }

View File

@ -1,10 +1,27 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq)]
pub enum SitesKind {
Dungeon,
pub enum SiteKindMeta {
Dungeon(DungeonKindMeta),
Cave,
Settlement,
Settlement(SettlementKindMeta),
Castle,
Void,
}
#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq)]
pub enum DungeonKindMeta {
Old,
Gnarling,
}
#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq)]
pub enum SettlementKindMeta {
Default,
Cliff,
Desert,
}
impl Default for SiteKindMeta {
fn default() -> SiteKindMeta { SiteKindMeta::Void }
}

View File

@ -6,6 +6,7 @@ use crate::{
use client::Client;
use common::{
assets::{self, AssetExt, AssetHandle},
terrain::site::SiteKindMeta,
vol::ReadVol,
};
use common_state::State;
@ -57,6 +58,7 @@ impl AmbientMgr {
AmbientChannelTag::Rain => 0.1,
AmbientChannelTag::Thunder => 0.1,
AmbientChannelTag::Leaves => 0.05,
AmbientChannelTag::Cave => 0.1,
}
&& audio.get_ambient_channel(tag).is_none()
{
@ -109,10 +111,11 @@ impl AmbientMgr {
impl AmbientChannelTag {
pub fn tag_max_volume(tag: AmbientChannelTag) -> f32 {
match tag {
AmbientChannelTag::Wind => 1.15,
AmbientChannelTag::Wind => 1.0,
AmbientChannelTag::Rain => 0.95,
AmbientChannelTag::Thunder => 1.33,
AmbientChannelTag::Leaves => 1.33,
AmbientChannelTag::Cave => 1.0,
}
}
@ -205,6 +208,25 @@ impl AmbientChannelTag {
0.0
}
},
AmbientChannelTag::Cave => {
let focus_off = camera.get_focus_pos().map(f32::trunc);
let cam_pos = camera.dependents().cam_pos + focus_off;
let terrain_alt = if let Some(chunk) = client.current_chunk() {
chunk.meta().alt()
} else {
0.0
};
// When the camera is roughly above ground, don't play cave sounds
let camera_multiplier = (-(cam_pos.z - terrain_alt) / 100.0).max(0.0);
if client.current_site() == SiteKindMeta::Cave {
camera_multiplier
} else {
0.0
}
},
}
}
}
@ -237,8 +259,13 @@ fn get_target_volume(
}
// Is the camera underneath the terrain? Fade out the lower it goes beneath.
(volume_multiplier * ((cam_pos.z - terrain_alt) / 40.0 + 1.0).clamped(0.0, 1.0))
.min(AmbientChannelTag::tag_max_volume(tag))
// Unless, of course, the player is in a cave.
if tag != AmbientChannelTag::Cave {
(volume_multiplier * ((cam_pos.z - terrain_alt) / 50.0 + 1.0).clamped(0.0, 1.0))
.min(AmbientChannelTag::tag_max_volume(tag))
} else {
volume_multiplier.min(AmbientChannelTag::tag_max_volume(tag))
}
}
pub fn load_ambience_items() -> AssetHandle<AmbientCollection> {

View File

@ -165,6 +165,7 @@ pub enum AmbientChannelTag {
Rain,
Thunder,
Leaves,
Cave,
}
/// A AmbientChannel uses a non-positional audio sink designed to play sounds

View File

@ -47,7 +47,7 @@ use crate::audio::{AudioFrontend, MusicChannelTag};
use client::Client;
use common::{
assets::{self, AssetExt, AssetHandle},
terrain::{BiomeKind, SitesKind},
terrain::{BiomeKind, SiteKindMeta},
weather::WeatherKind,
};
use common_state::State;
@ -84,7 +84,7 @@ pub struct SoundtrackItem {
/// What biomes this track should play in with chance of play
biomes: Vec<(BiomeKind, u8)>,
/// Whether this track should play in a specific site
site: Option<SitesKind>,
sites: Vec<SiteKindMeta>,
/// What the player is doing when the track is played (i.e. exploring,
/// combat)
music_state: MusicState,
@ -105,7 +105,7 @@ enum RawSoundtrackItem {
timing: Option<DayPeriod>,
weather: Option<WeatherKind>,
biomes: Vec<(BiomeKind, u8)>,
site: Option<SitesKind>,
sites: Vec<SiteKindMeta>,
segments: Vec<(String, f32, MusicState, Option<MusicActivity>)>,
artist: String,
},
@ -346,15 +346,15 @@ impl MusicMgr {
if spacing_multiplier > f32::EPSILON {
silence_between_tracks_seconds =
if matches!(music_state, MusicState::Activity(MusicActivity::Explore))
&& matches!(client.current_site(), SitesKind::Settlement)
&& matches!(client.current_site(), SiteKindMeta::Settlement(_))
{
rng.gen_range(120.0 * spacing_multiplier..180.0 * spacing_multiplier)
} else if matches!(music_state, MusicState::Activity(MusicActivity::Explore))
&& matches!(client.current_site(), SitesKind::Dungeon)
&& matches!(client.current_site(), SiteKindMeta::Dungeon(_))
{
rng.gen_range(10.0 * spacing_multiplier..20.0 * spacing_multiplier)
} else if matches!(music_state, MusicState::Activity(MusicActivity::Explore))
&& matches!(client.current_site(), SitesKind::Cave)
&& matches!(client.current_site(), SiteKindMeta::Cave)
{
rng.gen_range(20.0 * spacing_multiplier..40.0 * spacing_multiplier)
} else if matches!(music_state, MusicState::Activity(MusicActivity::Explore)) {
@ -389,14 +389,12 @@ impl MusicMgr {
(match &track.timing {
Some(period_of_day) => period_of_day == &current_period_of_day,
None => true,
}) && match &track.site {
Some(site) => site == &current_site,
None => true,
} && match &track.weather {
}) && match &track.weather {
Some(weather) => weather == &current_weather.get_kind(),
None => true,
}
})
.filter(|track| track.sites.iter().any(|s| s == &current_site))
.filter(|track| {
track.biomes.is_empty() || track.biomes.iter().any(|b| b.0 == current_biome)
})
@ -444,7 +442,7 @@ impl MusicMgr {
.biomes
.iter()
.find(|b| b.0 == current_biome)
.map_or(1, |b| b.1)
.map_or(1.0, |b| (1.0_f32 / (b.1 as f32)))
});
debug!(
"selecting new track for {:?}: {:?}",
@ -515,7 +513,7 @@ impl assets::Compound for SoundtrackCollection<SoundtrackItem> {
timing,
weather,
biomes,
site,
sites,
segments,
artist,
} => {
@ -527,7 +525,7 @@ impl assets::Compound for SoundtrackCollection<SoundtrackItem> {
timing: timing.clone(),
weather,
biomes: biomes.clone(),
site,
sites: sites.clone(),
music_state,
activity_override,
artist: artist.clone(),

View File

@ -34,9 +34,9 @@ widget_ids! {
ambience_volume_text,
ambience_volume_slider,
ambience_volume_number,
music_frequency_text,
music_frequency_slider,
music_frequency_number,
music_spacing_text,
music_spacing_slider,
music_spacing_number,
//audio_device_list,
//audio_device_text,
reset_sound_button,
@ -290,12 +290,12 @@ impl<'a> Widget for Sound<'a> {
.set(state.ids.ambience_volume_number, ui);
// Music spacing
Text::new(&self.localized_strings.get("hud.settings.music_frequency"))
Text::new(&self.localized_strings.get("hud.settings.music_spacing"))
.down_from(state.ids.ambience_volume_slider, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.music_frequency_text, ui);
.set(state.ids.music_spacing_text, ui);
// Music spacing Slider
if let Some(new_val) = ImageSlider::continuous(
self.global_state.settings.audio.music_spacing,
@ -305,24 +305,24 @@ impl<'a> Widget for Sound<'a> {
self.imgs.slider,
)
.w_h(104.0, 22.0)
.down_from(state.ids.music_frequency_text, 10.0)
.down_from(state.ids.music_spacing_text, 10.0)
.track_breadth(12.0)
.slider_length(10.0)
.pad_track((5.0, 5.0))
.set(state.ids.music_frequency_slider, ui)
.set(state.ids.music_spacing_slider, ui)
{
events.push(AdjustMusicFrequency(new_val));
events.push(AdjustMusicSpacing(new_val));
}
// Music spacing Number
Text::new(&format!(
"{:1.2}x",
self.global_state.settings.audio.music_spacing
))
.right_from(state.ids.music_frequency_slider, 8.0)
.right_from(state.ids.music_spacing_slider, 8.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.music_frequency_number, ui);
.set(state.ids.music_spacing_number, ui);
// Audio Device Selector
// --------------------------------------------
@ -356,7 +356,7 @@ impl<'a> Widget for Sound<'a> {
.w_h(RESET_BUTTONS_WIDTH, RESET_BUTTONS_HEIGHT)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.down_from(state.ids.music_frequency_slider, 12.0)
.down_from(state.ids.music_spacing_slider, 12.0)
.label(&self.localized_strings.get("hud.settings.reset_sound"))
.label_font_size(self.fonts.cyri.scale(14))
.label_color(TEXT_COLOR)

View File

@ -234,6 +234,7 @@ fn main() {
audio.set_music_volume(settings.audio.music_volume);
audio.set_sfx_volume(settings.audio.sfx_volume);
audio.set_ambience_volume(settings.audio.ambience_volume);
audio.set_music_spacing(settings.audio.music_spacing);
// Load the profile.
let profile = Profile::load(&config_dir);

View File

@ -23,7 +23,7 @@ pub enum Audio {
AdjustMusicVolume(f32),
AdjustSfxVolume(f32),
AdjustAmbienceVolume(f32),
AdjustMusicFrequency(f32),
AdjustMusicSpacing(f32),
//ChangeAudioDevice(String),
ResetAudioSettings,
}
@ -209,7 +209,7 @@ impl SettingsChange {
settings.audio.ambience_volume = ambience_volume;
},
Audio::AdjustMusicFrequency(multiplier) => {
Audio::AdjustMusicSpacing(multiplier) => {
global_state.audio.set_music_spacing(multiplier);
settings.audio.music_spacing = multiplier;

View File

@ -39,6 +39,7 @@ pub use crate::{
};
pub use block::BlockGen;
pub use column::ColumnSample;
pub use common::terrain::site::{DungeonKindMeta, SettlementKindMeta};
pub use index::{IndexOwned, IndexRef};
use crate::{
@ -304,16 +305,10 @@ impl World {
sim_chunk.river.velocity,
sim_chunk.temp,
sim_chunk.humidity,
sim_chunk.sites.iter().any(|site| {
matches!(
index.sites[*site].kind,
SiteKind::Refactor(_) | SiteKind::CliffTown(_) | SiteKind::DesertCity(_)
)
}),
sim_chunk
.sites
.iter()
.any(|site| matches!(index.sites[*site].kind, SiteKind::Dungeon(_))),
.find_map(|site| index.sites[*site].kind.convert_to_meta()),
);
let mut chunk = TerrainChunk::new(base_z, stone, air, meta);

View File

@ -262,7 +262,14 @@ fn tick(index: &mut Index, dt: f32, _env: &mut Environment) {
#[cfg(test)]
mod tests {
use crate::{sim, util::seed_expan};
use common::{store::Id, terrain::BiomeKind, trade::Good};
use common::{
store::Id,
terrain::{
site::{DungeonKindMeta, SiteKindMeta},
BiomeKind,
},
trade::Good,
};
use hashbrown::HashMap;
use rand::SeedableRng;
use rand_chacha::ChaChaRng;
@ -294,7 +301,7 @@ mod tests {
struct EconomySetup {
name: String,
position: (i32, i32),
kind: common::terrain::site::SitesKind,
kind: common::terrain::site::SiteKindMeta,
neighbors: Vec<u64>, // id
resources: Vec<ResourcesSetup>,
}
@ -381,21 +388,7 @@ mod tests {
position: (i.get_origin().x, i.get_origin().y),
resources,
neighbors,
kind: match i.kind {
crate::site::SiteKind::Settlement(_)
| crate::site::SiteKind::Refactor(_)
| crate::site::SiteKind::CliffTown(_)
| crate::site::SiteKind::DesertCity(_) => {
common::terrain::site::SitesKind::Settlement
},
crate::site::SiteKind::Dungeon(_) => {
common::terrain::site::SitesKind::Dungeon
},
crate::site::SiteKind::Castle(_) => {
common::terrain::site::SitesKind::Castle
},
_ => common::terrain::site::SitesKind::Void,
},
kind: i.kind.convert_to_meta().unwrap_or_default(),
};
outarr.push(val);
}
@ -419,10 +412,10 @@ mod tests {
// loading on demand using the public API. There is no way to set
// the name, do we care?
let mut settlement = match i.kind {
common::terrain::site::SitesKind::Castle => crate::site::Site::castle(
SiteKindMeta::Castle => crate::site::Site::castle(
crate::site::Castle::generate(wpos, None, &mut rng),
),
common::terrain::site::SitesKind::Dungeon => {
SiteKindMeta::Dungeon(DungeonKindMeta::Old) => {
crate::site::Site::dungeon(crate::site2::Site::generate_dungeon(
&crate::Land::empty(),
&mut rng,

View File

@ -10,6 +10,8 @@ pub use self::{
block_mask::BlockMask, castle::Castle, economy::Economy, settlement::Settlement, tree::Tree,
};
pub use common::terrain::site::{DungeonKindMeta, SettlementKindMeta, SiteKindMeta};
use crate::{column::ColumnSample, site2, Canvas};
use common::generation::ChunkSupplement;
use rand::Rng;
@ -260,3 +262,18 @@ impl Site {
)
}
}
impl SiteKind {
pub fn convert_to_meta(&self) -> Option<SiteKindMeta> {
match self {
SiteKind::Refactor(_) | SiteKind::Settlement(_) => {
Some(SiteKindMeta::Settlement(SettlementKindMeta::Default))
},
SiteKind::CliffTown(_) => Some(SiteKindMeta::Settlement(SettlementKindMeta::Cliff)),
SiteKind::DesertCity(_) => Some(SiteKindMeta::Settlement(SettlementKindMeta::Desert)),
SiteKind::Dungeon(_) => Some(SiteKindMeta::Dungeon(DungeonKindMeta::Old)),
SiteKind::Gnarling(_) => Some(SiteKindMeta::Dungeon(DungeonKindMeta::Gnarling)),
_ => None,
}
}
}