File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed
Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,18 @@ extern "C" {
7979 pub fn timer_undo_split ( ) ;
8080 /// Resets the timer.
8181 pub fn timer_reset ( ) ;
82+ /// Accesses the index of the split the attempt is currently on.
83+ /// If there's no attempt in progress, `-1` is returned instead.
84+ /// This returns an index that is equal to the amount of segments
85+ /// when the attempt is finished, but has not been reset.
86+ /// So you need to be careful when using this value for indexing.
87+ /// Same index does not imply same split on undo and then split.
88+ pub fn timer_current_split_index ( ) -> i64 ;
89+ /// Whether the segment at `idx` was splitted this attempt.
90+ /// Returns `1` if the segment was splitted, or `0` if skipped.
91+ /// If `idx` is greater than or equal to the current split index,
92+ /// `-1` is returned instead.
93+ pub fn timer_segment_splitted ( idx : u64 ) -> i32 ;
8294 /// Sets a custom key value pair. This may be arbitrary information that the
8395 /// auto splitter wants to provide for visualization. The pointers need to
8496 /// point to valid UTF-8 encoded text with the respective given length.
Original file line number Diff line number Diff line change @@ -112,6 +112,33 @@ pub fn state() -> TimerState {
112112 }
113113}
114114
115+ /// Accesses the index of the split the attempt is currently on.
116+ /// If there's no attempt in progress, `None` is returned instead.
117+ /// This returns an index that is equal to the amount of segments
118+ /// when the attempt is finished, but has not been reset.
119+ /// So you need to be careful when using this value for indexing.
120+ /// Same index does not imply same split on undo and then split.
121+ pub fn current_split_index ( ) -> Option < u64 > {
122+ let i = unsafe { sys:: timer_current_split_index ( ) } ;
123+ if i. is_negative ( ) {
124+ return None ;
125+ }
126+ Some ( i as u64 )
127+ }
128+
129+ /// Whether the segment at `idx` was splitted this attempt.
130+ /// Returns `Some(true)` if the segment was splitted,
131+ /// or `Some(false)` if skipped.
132+ /// If `idx` is greater than or equal to the current split index,
133+ /// `None` is returned instead.
134+ pub fn segment_splitted ( idx : u64 ) -> Option < bool > {
135+ match unsafe { sys:: timer_segment_splitted ( idx) } {
136+ 1 => Some ( true ) ,
137+ 0 => Some ( false ) ,
138+ _ => None ,
139+ }
140+ }
141+
115142/// Sets the game time.
116143#[ inline]
117144pub fn set_game_time ( time : time:: Duration ) {
You can’t perform that action at this time.
0 commit comments