Remove pointless set_scroll_pos and scroll_pos from AffineBackground

This commit is contained in:
Gwilym Kuiper 2022-10-11 22:32:00 +01:00
parent e30e0b76e2
commit f1fb9d5375

View file

@ -33,9 +33,6 @@ trait TiledMapPrivate: TiledMapTypes {
fn update_bg_registers(&self);
fn scroll_pos(&self) -> Vector2D<i16>;
fn set_scroll_pos(&mut self, new_pos: Vector2D<i16>);
fn bg_control_register(&self) -> MemoryMapped<u16> {
unsafe { MemoryMapped::new(0x0400_0008 + 2 * self.background_id()) }
}
@ -52,10 +49,6 @@ pub trait TiledMap: TiledMapTypes {
fn hide(&mut self);
fn commit(&mut self, vram: &mut VRamManager);
fn size(&self) -> Self::Size;
#[must_use]
fn scroll_pos(&self) -> Vector2D<i16>;
fn set_scroll_pos(&mut self, pos: Vector2D<i16>);
}
impl<T> TiledMap for T
@ -114,15 +107,6 @@ where
fn size(&self) -> T::Size {
self.map_size()
}
#[must_use]
fn scroll_pos(&self) -> Vector2D<i16> {
TiledMapPrivate::scroll_pos(self)
}
fn set_scroll_pos(&mut self, pos: Vector2D<i16>) {
TiledMapPrivate::set_scroll_pos(self, pos);
}
}
pub struct RegularMap {
@ -170,12 +154,6 @@ impl TiledMapPrivate for RegularMap {
self.x_register().set(self.scroll.x);
self.y_register().set(self.scroll.y);
}
fn scroll_pos(&self) -> Vector2D<i16> {
self.scroll
}
fn set_scroll_pos(&mut self, new_pos: Vector2D<i16>) {
self.scroll = new_pos;
}
}
impl RegularMap {
@ -230,6 +208,15 @@ impl RegularMap {
*self.tiles_dirty() = true;
}
#[must_use]
pub fn scroll_pos(&self) -> Vector2D<i16> {
self.scroll
}
pub fn set_scroll_pos(&mut self, pos: Vector2D<i16>) {
self.scroll = pos;
}
fn x_register(&self) -> MemoryMapped<i16> {
unsafe { MemoryMapped::new(0x0400_0010 + 4 * self.background_id as usize) }
}
@ -245,8 +232,6 @@ pub struct AffineMap {
priority: Priority,
size: AffineBackgroundSize,
scroll: Vector2D<i16>,
transform: AffineMatrixBackground,
tiles: Vec<u8>,
@ -282,12 +267,6 @@ impl TiledMapPrivate for AffineMap {
fn update_bg_registers(&self) {
self.bg_affine_matrix().set(self.transform);
}
fn scroll_pos(&self) -> Vector2D<i16> {
self.scroll
}
fn set_scroll_pos(&mut self, new_pos: Vector2D<i16>) {
self.scroll = new_pos;
}
}
impl AffineMap {
@ -303,8 +282,6 @@ impl AffineMap {
priority,
size,
scroll: Default::default(),
transform: Default::default(),
tiles: vec![Default::default(); size.num_tiles()],