diff --git a/agb-fixnum/src/lib.rs b/agb-fixnum/src/lib.rs index 6128be88..a7a84f68 100644 --- a/agb-fixnum/src/lib.rs +++ b/agb-fixnum/src/lib.rs @@ -653,10 +653,9 @@ impl Rect { impl Rect { pub fn iter(self) -> impl Iterator { - let mut x = self.position.x - T::one(); + let mut x = self.position.x; let mut y = self.position.y; core::iter::from_fn(move || { - x = x + T::one(); if x >= self.position.x + self.size.x { x = self.position.x; y = y + T::one(); @@ -665,7 +664,10 @@ impl Rect { } } - Some((x, y)) + let ret_x = x; + x = x + T::one(); + + Some((ret_x, y)) }) } } diff --git a/agb/src/display/background.rs b/agb/src/display/background.rs index 1be22ba2..8f1b957d 100644 --- a/agb/src/display/background.rs +++ b/agb/src/display/background.rs @@ -516,7 +516,7 @@ impl<'a> InfiniteScrolledMap<'a> { let direction = difference.x.signum(); // either need to update 20 or 21 tiles depending on whether the y coordinate is a perfect multiple - let y_tiles_to_update: i32 = if new_pos.y % 8 == 0 { 20 } else { 21 }; + let y_tiles_to_update = 21; let line_to_update = if direction < 0 { // moving to the left, so need to update the left most position @@ -540,7 +540,7 @@ impl<'a> InfiniteScrolledMap<'a> { let direction = difference.y.signum(); // either need to update 30 or 31 tiles depending on whether the x coordinate is a perfect multiple - let x_tiles_to_update: i32 = if new_pos.x % 8 == 0 { 30 } else { 31 }; + let x_tiles_to_update: i32 = 31; let line_to_update = if direction < 0 { // moving up so need to update the top