Beatsaber Rust Utilities: A Beatsaber V3 parsing library.
beatsaber beatmap
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Added `EventGroup::get_value_offset`.

AlephCubed 4c2de3ae c50e8e59

+33 -15
+18 -2
src/difficulty/lightshow/boxes.rs
··· 14 14 15 15 #[macro_export] 16 16 macro_rules! impl_event_box { 17 - ($ident:ident::$group:ident::$data:ident) => { 17 + ($ident:ident, $group:ident, $data:ident) => { 18 18 impl crate::difficulty::lightshow::boxes::EventBox for $ident { 19 19 type Group = $group; 20 20 type Data = $data; ··· 33 33 fn get_data(&self) -> &Vec<Self::Data>; 34 34 35 35 fn get_beat_offset(&self, light_id: i32, group_size: i32) -> f32; 36 + fn get_value_offset(&self, light_id: i32, group_size: i32) -> f32; 36 37 } 37 38 38 39 #[macro_export] 39 40 macro_rules! impl_event_group { 40 - ($ident:ident::$data:ident) => { 41 + ($ident:ident::$value_offset:ident, $data:ident) => { 41 42 impl crate::difficulty::lightshow::boxes::EventGroup for $ident { 42 43 type Data = $data; 43 44 ··· 59 60 None, 60 61 ) 61 62 } 63 + 64 + fn get_value_offset(&self, light_id: i32, group_size: i32) -> f32 { 65 + self.$value_offset(light_id, group_size) 66 + } 62 67 } 63 68 }; 64 69 } ··· 66 71 pub trait EventData { 67 72 fn get_beat_offset(&self) -> f32; 68 73 } 74 + 75 + #[macro_export] 76 + macro_rules! impl_event_data { 77 + ($ident:ident) => { 78 + impl crate::difficulty::lightshow::boxes::EventData for $ident { 79 + fn get_beat_offset(&self) -> f32 { 80 + self.beat_offset 81 + } 82 + } 83 + }; 84 + }
+4 -9
src/difficulty/lightshow/boxes/color.rs
··· 1 1 use crate::difficulty::lightshow::DistributionType; 2 - use crate::difficulty::lightshow::boxes::EventData; 3 2 use crate::difficulty::lightshow::easing::Easing; 4 3 use crate::difficulty::lightshow::filter::Filter; 5 4 use crate::utils::LooseBool; 6 - use crate::{impl_event_box, impl_event_group, impl_timed, loose_enum}; 5 + use crate::{impl_event_box, impl_event_data, impl_event_group, impl_timed, loose_enum}; 7 6 use serde::{Deserialize, Serialize}; 8 7 9 8 #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] ··· 22 21 } 23 22 24 23 impl_timed!(ColorEventBox::beat); 25 - impl_event_box!(ColorEventBox::ColorEventGroup::ColorEventData); 24 + impl_event_box!(ColorEventBox, ColorEventGroup, ColorEventData); 26 25 27 26 #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] 28 27 #[cfg_attr( ··· 50 49 pub data: Vec<ColorEventData>, 51 50 } 52 51 53 - impl_event_group!(ColorEventGroup::ColorEventData); 52 + impl_event_group!(ColorEventGroup::get_brightness_offset, ColorEventData); 54 53 55 54 impl ColorEventGroup { 56 55 pub fn get_brightness_offset(&self, light_id: i32, group_size: i32) -> f32 { ··· 84 83 pub strobe_frequency: i32, 85 84 } 86 85 87 - impl EventData for ColorEventData { 88 - fn get_beat_offset(&self) -> f32 { 89 - self.beat_offset 90 - } 91 - } 86 + impl_event_data!(ColorEventData); 92 87 93 88 loose_enum! { 94 89 #[derive(Default, Copy)]
+2 -2
src/difficulty/lightshow/boxes/rotation.rs
··· 22 22 } 23 23 24 24 impl_timed!(RotationEventBox::beat); 25 - impl_event_box!(RotationEventBox::RotationEventGroup::RotationEventData); 25 + impl_event_box!(RotationEventBox, RotationEventGroup, RotationEventData); 26 26 27 27 #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] 28 28 #[cfg_attr( ··· 54 54 pub data: Vec<RotationEventData>, 55 55 } 56 56 57 - impl_event_group!(RotationEventGroup::RotationEventData); 57 + impl_event_group!(RotationEventGroup::get_rotation_offset, RotationEventData); 58 58 59 59 impl RotationEventGroup { 60 60 pub fn get_rotation_offset(&self, light_id: i32, group_size: i32) -> f32 {
+9 -2
src/difficulty/lightshow/boxes/translation.rs
··· 22 22 } 23 23 24 24 impl_timed!(TranslationEventBox::beat); 25 - impl_event_box!(TranslationEventBox::TranslationEventGroup::TranslationEventData); 25 + impl_event_box!( 26 + TranslationEventBox, 27 + TranslationEventGroup, 28 + TranslationEventData 29 + ); 26 30 27 31 #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] 28 32 #[cfg_attr( ··· 53 57 pub data: Vec<TranslationEventData>, 54 58 } 55 59 56 - impl_event_group!(TranslationEventGroup::TranslationEventData); 60 + impl_event_group!( 61 + TranslationEventGroup::get_translation_offset, 62 + TranslationEventData 63 + ); 57 64 58 65 impl TranslationEventGroup { 59 66 pub fn get_translation_offset(&self, light_id: i32, group_size: i32) -> f32 {