From ce7c14c1c9b40bdc8fd80b11ae2efa39c5f9e9f9 Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Fri, 8 Jan 2021 07:38:22 -0600 Subject: [PATCH] render hitobjects with earlier ones on top --- src/game.rs | 7 +++---- src/slider_render.rs | 4 +++- todo.txt | 1 - 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/game.rs b/src/game.rs index 9876374..3ae9aa1 100644 --- a/src/game.rs +++ b/src/game.rs @@ -10,7 +10,6 @@ use ggez::{ self, Color, DrawMode, DrawParam, FillOptions, FilterMode, Mesh, Rect, StrokeOptions, Text, WHITE, }, - nalgebra::Point2, Context, GameError, GameResult, }; use libosu::{Beatmap, HitObject, HitObjectKind, Point, SpinnerInfo}; @@ -61,7 +60,7 @@ impl Game { let dir = path.parent().unwrap(); let song = Sound::create(dir.join(&self.beatmap.audio_filename))?; - song.set_position(36.5)?; + // song.set_position(36.5)?; self.song = Some(song); Ok(()) @@ -139,7 +138,7 @@ impl Game { let cs_osupx = self.beatmap.difficulty.circle_size_osupx(); let cs_real = cs_osupx * cs_scale; - for draw_info in visible_hitobjects.iter() { + for draw_info in visible_hitobjects.iter().rev() { let ho = draw_info.hit_object; let ho_time = (ho.start_time.0 as f64) / 1000.0; let pos = [ @@ -171,7 +170,7 @@ impl Game { travel_percent = 1.0 - travel_percent; } let travel_length = travel_percent * info.pixel_length; - print!("ho={:.3} ", ho_time); + // print!("ho={:.3} ", ho_time); let pos = spline.point_at_length(travel_length); let ball_pos = [ PLAYFIELD_BOUNDS.x + osupx_scale_x * pos.0 as f32, diff --git a/src/slider_render.rs b/src/slider_render.rs index 962e324..039f8e3 100644 --- a/src/slider_render.rs +++ b/src/slider_render.rs @@ -227,9 +227,11 @@ impl Spline { match self.cumulative_lengths.binary_search(&length_notnan) { Ok(idx) => self.spline_points[idx], Err(idx) => { - let n = self.spline_points.len() - 1; + let n = self.spline_points.len(); if idx == 0 && self.spline_points.len() > 2 { return self.spline_points[0]; + } else if idx == n { + return self.spline_points[n - 1]; } let (len1, len2) = ( diff --git a/todo.txt b/todo.txt index 6dc36aa..4c77ee7 100644 --- a/todo.txt +++ b/todo.txt @@ -1,5 +1,4 @@ - stacking -- fix straight slider segment teleportation - don't draw overlaps between slider segments - use skin components - timeline