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.

More documentation.

AlephCubed e9a424a3 48a709a8

+63 -42
+1
src/difficulty.rs
··· 10 10 11 11 use serde::{Deserialize, Serialize}; 12 12 13 + /// A map's difficulty file(s) (i.e. `ExpertStandard.dat`). 13 14 #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] 14 15 #[serde(rename_all = "camelCase")] 15 16 #[cfg_attr(
+4 -3
src/difficulty/gameplay_event.rs
··· 3 3 use crate::{impl_timed, loose_enum}; 4 4 use serde::{Deserialize, Serialize}; 5 5 6 + /// Controls the rotation that interactable objects spawn in 90/360 degree difficulties. 6 7 #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] 7 8 #[cfg_attr( 8 9 feature = "bevy_reflect", ··· 21 22 impl_timed!(LaneRotationEvent::beat); 22 23 23 24 loose_enum!( 24 - /// Determines when a [`LaneRotationEvent`] will be applied to objects placed on the same beat as this event. 25 + /// Determines when a [`LaneRotationEvent`] will be applied to objects. 25 26 #[derive(Default, Copy)] 26 27 ExecutionTime: i32 { 27 - /// The [`LaneRotationEvent`] will affect objects with a beat greater than or equal to the event's beat. 28 + /// The [`LaneRotationEvent`] will affect objects with a beat *greater than or equal to* the event's beat. 28 29 #[default] 29 30 Early = 0, 30 - /// The [`LaneRotationEvent`] will affect objects with a beat greater than the event's beat. 31 + /// The [`LaneRotationEvent`] will affect objects with a beat *greater than* the event's beat. 31 32 Late = 1, 32 33 } 33 34 );
+7 -19
src/difficulty/lightshow.rs
··· 13 13 use crate::loose_enum; 14 14 15 15 loose_enum! { 16 - /// The distribution value does different things depending on the type. 17 - /// 18 - /// # [Beat Distribution](https://bsmg.wiki/mapping/map-format/lightshow.html#light-color-event-boxes-beat-distribution): 19 - /// ### Wave: 20 - /// The value represents the total time for all steps to complete. 21 - /// ### Step: 22 - /// The value represents the time until the next step is completed. 23 - /// 24 - /// # [Brightness](https://bsmg.wiki/mapping/map-format/lightshow.html#light-color-event-boxes-effect-distribution) and [Rotation Distribution](https://bsmg.wiki/mapping/map-format/lightshow.html#light-rotation-event-boxes-effect-distribution): 25 - /// ### Wave: 26 - /// The value represents the total difference between the first and last step. 27 - /// ### Step: 28 - /// The value represents the different between the current and next step. 16 + /// The way that the distribution value is used. 29 17 #[derive(Default, Copy)] 30 18 DistributionType: i32 { 19 + /// The distribution value represents the difference between *the last and first step*. 31 20 #[default] 32 21 Wave = 1, 22 + /// The distribution value represents the difference between *each step*. 33 23 Step = 2, 34 24 } 35 25 } ··· 76 66 } 77 67 78 68 loose_enum! { 79 - /// Controls how the value is changed from the previous event. 80 - /// - Transition: The value will blend from the previous event's value, using the 81 - /// [easing](Easing) value. 82 - /// - Extend: The event's value will be ignored, replaced with the values from the previous event. 83 - /// 84 - /// More info [here](https://bsmg.wiki/mapping/map-format/lightshow.html#light-rotation-events-type). 69 + /// Controls how the state is changed relative to the previous event. 85 70 #[derive(Default, Copy)] 86 71 TransitionType: i32 { 72 + /// The state will blend from the previous event's state, using the events [easing](Easing). 87 73 #[default] 88 74 Transition = 0, 75 + /// The event's state will be ignored, replaced with the state from the previous event. 89 76 Extend = 1, 90 77 } 91 78 } 92 79 93 80 loose_enum! { 81 + /// The axis that a rotation/translation event effects. 94 82 #[derive(Default, Copy)] 95 83 EventAxis: i32 { 96 84 #[default]
+4
src/difficulty/lightshow/easing.rs
··· 2 2 use simple_easing::*; 3 3 4 4 loose_enum! { 5 + /// The easing that a [transition](crate::lightshow::TransitionType::Transition) event will use. 5 6 #[derive(Default, Copy)] 6 7 Easing: i32 { 7 8 #[default] ··· 39 40 OutBounce = 29, 40 41 InOutBounce = 30, 41 42 43 + /// Note: For [`Easing::ease`], the result will be the same as [`Easing::InOutBack`]. 42 44 BeatSaberInOutBack = 100, 45 + /// Note: For [`Easing::ease`], the result will be the same as [`Easing::InOutElastic`]. 43 46 BeatSaberInOutElastic = 101, 47 + /// Note: For [`Easing::ease`], the result will be the same as [`Easing::InOutBounce`]. 44 48 BeatSaberInOutBounce = 102, 45 49 } 46 50 }
+14 -16
src/difficulty/lightshow/filter.rs
··· 2 2 use crate::utils::LooseBool; 3 3 use serde::{Deserialize, Serialize}; 4 4 5 - /// Controls which light indices are affected by event boxes. 5 + /// Controls which light IDs are affected by an event box. 6 6 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] 7 7 #[cfg_attr( 8 8 feature = "bevy_reflect", ··· 11 11 )] 12 12 pub struct Filter { 13 13 // V3.0: 14 + /// Controls how [`parameter1`](Self::parameter1) and [`parameter2`](Self::parameter2) are used. 14 15 #[serde(rename = "f")] 15 16 pub filter_type: FilterType, 16 - /// Dependent on the [`FilterType`] 17 + /// Dependent on the [`FilterType`]. 17 18 #[serde(rename = "p")] 18 19 pub parameter1: i32, 19 - /// Dependent on the [`FilterType`] 20 + /// Dependent on the [`FilterType`]. 20 21 #[serde(rename = "t")] 21 22 pub parameter2: i32, 23 + /// If true, the filter will start at the end of a group and work backwards. 22 24 #[serde(rename = "r")] 23 25 pub reverse: LooseBool, 24 26 // V3.1: ··· 152 154 } 153 155 154 156 loose_enum! { 155 - /// The parameters of a [Filter] do different things depending on the type. 156 - /// 157 - /// ### [Division](https://bsmg.wiki/mapping/map-format/lightshow.html#index-filters-type-1): 158 - /// Splits the group up into equal sections and selects one. 159 - /// - Parameter 1 determines the number of sections. 160 - /// It will be rounded up to the nearest multiple of the group size. 161 - /// - Parameter 2 determines the section to select, starting at 0. 162 - /// 163 - /// ### [Step and Offset](https://bsmg.wiki/mapping/map-format/lightshow.html#index-filters-type-2): 164 - /// Alternates selecting and not selecting lights. 165 - /// - Parameter 1 is the index of the first light that will be selected, starting at 0. 166 - /// - Parameter 2 determines the number of IDs to move forward before selecting another light. 157 + /// Controls how a [`Filter`]'s [`parameter1`](Filter::parameter1) 158 + /// and [`parameter2`](Filter::parameter2) values are used. 167 159 #[derive(Default, Copy)] 168 160 FilterType: i32 { 161 + /// Splits the group up into equal sections and selects one. 162 + /// - [`parameter1`](Filter::parameter1) determines the number of sections. 163 + /// It will be rounded up to the nearest multiple of the group size. 164 + /// - [`parameter2`](Filter::parameter2) determines the section to select, starting at 0. 169 165 #[default] 170 - //Todo Doesn't match wiki 171 166 Division = 1, 167 + /// Alternates selecting and not selecting lights. 168 + /// - [`parameter1`](Filter::parameter1) is the index of the first light that will be selected, starting at 0. 169 + /// - [`parameter2`](Filter::parameter2) determines the number of IDs to move forward before selecting another light. 172 170 StepAndOffset = 2, 173 171 } 174 172 }
+23 -1
src/difficulty/playfield.rs
··· 3 3 use crate::{impl_duration, impl_timed, loose_enum}; 4 4 use serde::{Deserialize, Serialize}; 5 5 6 - /// The standard block/note. 6 + /// The standard block/note that a player cuts. 7 7 #[doc(alias = "Block")] 8 8 #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] 9 9 #[cfg_attr( ··· 23 23 /// In the range 0..3 inclusive, with zero being the far left and three being the far right column. 24 24 #[serde(rename = "x")] 25 25 pub col: i32, 26 + /// The color that determines which saber should be used to cut the note. 26 27 #[serde(rename = "c")] 27 28 pub color: NoteColor, 29 + /// The direction the note should be cut. 28 30 #[serde(rename = "d")] 29 31 pub direction: CutDirection, 30 32 /// The number of degrees counter-clockwise to offset the object by. ··· 57 59 UpRight = 5, 58 60 DownLeft = 6, 59 61 DownRight = 7, 62 + #[doc(alias = "Dot")] 60 63 Any = 8, 61 64 } 62 65 } ··· 81 84 } 82 85 } 83 86 87 + /// The spiked bombs that players avoid hitting with their sabers. 84 88 #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] 85 89 #[cfg_attr( 86 90 feature = "bevy_reflect", ··· 103 107 104 108 impl_timed!(Bomb::beat); 105 109 110 + /// A wall/obstacle that players avoid running into. 106 111 #[doc(alias = "Obstacle")] 107 112 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] 108 113 #[cfg_attr( ··· 125 130 /// In the range 0..3 inclusive, with zero being the far left and three being the far right column. 126 131 #[serde(rename = "x")] 127 132 pub col: i32, 133 + /// The number of columns that the wall will take up. 128 134 #[serde(rename = "w")] 129 135 pub width: i32, 136 + /// The number of rows that the wall will take up. 137 + /// 138 + /// A standard wall has a height of five while a crouch wall has a height of three. 130 139 #[serde(rename = "h")] 131 140 pub height: i32, 132 141 } ··· 146 155 147 156 impl_duration!(Wall::beat, duration: duration); 148 157 158 + /// A glowing line that guides the player's saber. 149 159 #[doc(alias = "Slider")] 150 160 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] 151 161 #[cfg_attr( ··· 165 175 /// In the range 0..3 inclusive, with zero being the far left and three being the far right column. 166 176 #[serde(rename = "x")] 167 177 pub col: i32, 178 + /// The color of the arc. 168 179 #[serde(rename = "c")] 169 180 pub color: NoteColor, 181 + /// The direction the arc moves in at the start. 170 182 #[serde(rename = "d")] 171 183 pub direction: CutDirection, 172 184 /// Controls how far away the starting bezier control point is in [cut direction](Self::direction). ··· 184 196 /// In the range 0..3 inclusive, with zero being the far left and three being the far right column. 185 197 #[serde(rename = "tx")] 186 198 pub tail_col: i32, 199 + /// The direction the arc moves in at the end. 187 200 #[serde(rename = "tc")] 188 201 pub tail_direction: CutDirection, 189 202 /// Controls how far away the ending bezier control point is in [tail cut direction](Self::tail_direction). 190 203 #[serde(rename = "tmu")] 191 204 pub tail_control_point: f32, 192 205 206 + /// Controls how the arc curves from its head to its tail. 193 207 #[serde(rename = "m")] 194 208 pub mid_anchor_mode: MidAnchorMode, 195 209 } ··· 216 230 impl_duration!(Arc::beat, end: tail_beat); 217 231 218 232 loose_enum! { 233 + /// Controls how an arc curves from its head to its tail. 219 234 #[derive(Default, Copy)] 220 235 MidAnchorMode: i32 { 221 236 #[default] ··· 225 240 } 226 241 } 227 242 243 + /// A chain/burst of mini-notes. 228 244 #[doc(alias = "BurstSlider")] 229 245 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] 230 246 #[cfg_attr( ··· 244 260 /// In the range 0..3 inclusive, with zero being the far left and three being the far right column. 245 261 #[serde(rename = "x")] 246 262 pub col: i32, 263 + /// The color that determines which saber should be used to cut the chain links. 247 264 #[serde(rename = "c")] 248 265 pub color: NoteColor, 266 + /// The direction the start of the chain should be cut. 249 267 #[serde(rename = "d")] 250 268 pub direction: CutDirection, 251 269 ··· 264 282 /// The number of links the chain has, including the connected [`Note`]. 265 283 #[serde(rename = "sc")] 266 284 pub link_count: i32, 285 + /// The percent of the path (from head to tail) that will be used, usually in the range 0..1 inclusive. 286 + /// Smaller values will result in the chain links bunching up near the head. 287 + /// 288 + /// Setting this to zero will crash the game. 267 289 #[serde(rename = "s")] 268 290 pub link_squish: f32, 269 291 }
+4 -2
src/info.rs
··· 7 7 use crate::loose_enum; 8 8 use serde::{Deserialize, Serialize}; 9 9 10 + /// A map's `Info.dat` file. 10 11 #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] 11 12 #[cfg_attr( 12 13 feature = "bevy_reflect", ··· 51 52 /// The path to the cover image file, relative to the map's folder. 52 53 #[serde(rename = "_coverImageFilename")] 53 54 pub cover_image_file: String, 55 + /// The environment that will be used for 90 and 360 degree difficulties. 56 + /// 57 + /// Starting in info file V2.1, individual difficulties can override this using [environment_index](DifficultyInfo::environment_index). 54 58 #[serde(rename = "_environmentName")] 55 59 pub environment: Environment, 56 60 /// The environment that will be used for 90 and 360 degree difficulties. 57 - /// 58 - /// Starting in info file V2.1, Individual difficulties can override this using [environment_index](DifficultyInfo::environment_index). 59 61 #[serde(rename = "_allDirectionsEnvironmentName")] 60 62 pub all_directions_environment: AllDirectionEnvironment, 61 63 /// > Only present in info file V2.1 or higher.
+4 -1
src/info/color_scheme.rs
··· 1 + //! Describes the colors of objects and lights for an environment/map. 2 + 1 3 pub mod presets; 2 4 3 5 #[allow(unused_imports)] ··· 18 20 pub color_scheme: ColorScheme, 19 21 } 20 22 21 - /// Describes the colors of objects a lights for an environment/map. 23 + /// The colors of objects and lights for an environment/map. 22 24 /// 23 25 /// This does *not* currently support while light color overrides. 24 26 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] ··· 105 107 } 106 108 } 107 109 110 + /// The color of an object/light. 108 111 #[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)] 109 112 #[cfg_attr( 110 113 feature = "bevy_reflect",
+2
src/info/color_scheme/presets.rs
··· 1 + //! Defines the color schemes provided by the base game for each environment. 2 + 1 3 use crate::info::color_scheme::{Color, ColorScheme}; 2 4 use crate::info::{AllDirectionEnvironment, Environment}; 3 5