diff --git a/CHANGELOG.md b/CHANGELOG.md index de56e6a875..10c19e4cae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Generated a net world map - Overhauled clouds for more verticality and performance - New tooltip for items with stats comparison +- Improved bow feedback, added arrow particles ### Removed diff --git a/assets/voxygen/audio/sfx/arrow_hit.wav b/assets/voxygen/audio/sfx/arrow_hit.wav new file mode 100644 index 0000000000..251492a6ec --- /dev/null +++ b/assets/voxygen/audio/sfx/arrow_hit.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c988685b6fee850a9a66e4f9a62538fe93431bb04e6cd253b37e6cb56e478216 +size 16554 diff --git a/assets/voxygen/audio/sfx/arrow_miss.wav b/assets/voxygen/audio/sfx/arrow_miss.wav new file mode 100644 index 0000000000..376df2f963 --- /dev/null +++ b/assets/voxygen/audio/sfx/arrow_miss.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b1891ae965af462f2bb582c271f69eaa385f15fa3283ef9076361b1d25321254 +size 98712 diff --git a/assets/voxygen/shaders/particle-vert.glsl b/assets/voxygen/shaders/particle-vert.glsl index e19bb3eb34..1f963ad787 100644 --- a/assets/voxygen/shaders/particle-vert.glsl +++ b/assets/voxygen/shaders/particle-vert.glsl @@ -62,6 +62,7 @@ const int EXPLOSION = 20; const int ICE = 21; const int LIFESTEAL_BEAM = 22; const int CULTIST_FLAME = 23; +const int STATIC_SMOKE = 24; // meters per second squared (acceleration) const float earth_gravity = 9.807; @@ -402,6 +403,13 @@ void main() { vec4(purp_color, 0.0, purp_color, 1), spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9) ); + } else if (inst_mode == STATIC_SMOKE) { + attr = Attr( + vec3(0), + vec3((0.5 * (1 - slow_start(0.8)))), + vec4(1.0), + spin_in_axis(vec3(rand6, rand7, rand8), rand9) + ); } else { attr = Attr( linear_motion( @@ -424,7 +432,7 @@ void main() { vec4 normals[6] = vec4[](vec4(-1,0,0,0), vec4(1,0,0,0), vec4(0,-1,0,0), vec4(0,1,0,0), vec4(0,0,-1,0), vec4(0,0,1,0)); f_norm = // inst_pos * - ((normals[(v_norm_ao >> 0) & 0x7u]) * attr.rot).xyz; + normalize(((normals[(v_norm_ao >> 0) & 0x7u]) * attr.rot).xyz); //vec3 col = vec3((uvec3(v_col) >> uvec3(0, 8, 16)) & uvec3(0xFFu)) / 255.0; f_col = vec4(attr.col.rgb, attr.col.a); diff --git a/client/src/lib.rs b/client/src/lib.rs index 2b6019d3a4..0c2a1b59fb 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -1033,17 +1033,18 @@ impl Client { pub fn loaded_distance(&self) -> f32 { self.loaded_distance } + pub fn position(&self) -> Option> { + self.state + .read_storage::() + .get(self.entity()) + .map(|v| v.0) + } + pub fn current_chunk(&self) -> Option> { - let chunk_pos = Vec2::from( - self.state - .read_storage::() - .get(self.entity()) - .cloned()? - .0, - ) - .map2(TerrainChunkSize::RECT_SIZE, |e: f32, sz| { - (e as u32).div_euclid(sz) as i32 - }); + let chunk_pos = Vec2::from(self.position()?) + .map2(TerrainChunkSize::RECT_SIZE, |e: f32, sz| { + (e as u32).div_euclid(sz) as i32 + }); self.state.terrain().get_key_arc(chunk_pos).cloned() } diff --git a/common/net/src/sync/interpolation.rs b/common/net/src/sync/interpolation.rs index a41709c8f1..00650abd37 100644 --- a/common/net/src/sync/interpolation.rs +++ b/common/net/src/sync/interpolation.rs @@ -8,13 +8,25 @@ use specs_idvs::IdvStorage; use tracing::warn; use vek::ops::{Lerp, Slerp}; -#[derive(Debug, Default)] +#[derive(Debug)] pub struct InterpBuffer { pub buf: [(f64, T); 4], pub i: usize, } impl InterpBuffer { + pub fn new(x: T) -> Self { + Self { + buf: [ + (0.0, x.clone()), + (0.0, x.clone()), + (0.0, x.clone()), + (0.0, x), + ], + i: 0, + } + } + fn push(&mut self, time: f64, x: T) { let InterpBuffer { ref mut buf, @@ -54,6 +66,8 @@ impl InterpolatableComponent for Pos { type InterpData = InterpBuffer; type ReadData = InterpBuffer; + fn new_data(x: Self) -> Self::InterpData { InterpBuffer::new(x) } + fn update_component(&self, interp_data: &mut Self::InterpData, time: f64, force_update: bool) { interp_data.update(time, *self, force_update); } @@ -108,6 +122,8 @@ impl InterpolatableComponent for Vel { type InterpData = InterpBuffer; type ReadData = (); + fn new_data(x: Self) -> Self::InterpData { InterpBuffer::new(x) } + fn update_component(&self, interp_data: &mut Self::InterpData, time: f64, force_update: bool) { interp_data.update(time, *self, force_update); } @@ -143,6 +159,8 @@ impl InterpolatableComponent for Ori { type InterpData = InterpBuffer; type ReadData = (); + fn new_data(x: Self) -> Self::InterpData { InterpBuffer::new(x) } + fn update_component(&self, interp_data: &mut Self::InterpData, time: f64, force_update: bool) { interp_data.update(time, *self, force_update); } diff --git a/common/net/src/sync/packet.rs b/common/net/src/sync/packet.rs index af4727dec2..1b5164b8f0 100644 --- a/common/net/src/sync/packet.rs +++ b/common/net/src/sync/packet.rs @@ -47,20 +47,21 @@ pub fn handle_remove(entity: Entity, world: &World) { } pub trait InterpolatableComponent: Component { - type InterpData: Component + Default; + type InterpData: Component; type ReadData; + fn new_data(x: Self) -> Self::InterpData; fn update_component(&self, data: &mut Self::InterpData, time: f64, force_update: bool); fn interpolate(self, data: &Self::InterpData, time: f64, read_data: &Self::ReadData) -> Self; } -pub fn handle_interp_insert( +pub fn handle_interp_insert( comp: C, entity: Entity, world: &World, force_update: bool, ) { - let mut interp_data = C::InterpData::default(); + let mut interp_data = C::new_data(comp.clone()); let time = world.read_resource::