Jam 2024 changes (#752)

- [ ] Changelog updated / no changelog update needed
This commit is contained in:
Gwilym Inzani 2024-08-28 12:34:20 +01:00 committed by GitHub
commit d617bd10d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 13 deletions

View file

@ -90,13 +90,20 @@ type AffineMatrixElement = Num<i32, 8>;
#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[derive(Debug, PartialEq, Eq, Clone, Copy)]
/// An affine matrix stored in a way that is efficient for the GBA to perform /// An affine matrix stored in a way that is efficient for the GBA to perform
/// operations on. This implements multiplication. /// operations on. This implements multiplication.
///
/// ```txt
/// a b x
/// c d y
/// 0 0 0
/// ```
#[allow(missing_docs)]
pub struct AffineMatrix { pub struct AffineMatrix {
a: AffineMatrixElement, pub a: AffineMatrixElement,
b: AffineMatrixElement, pub b: AffineMatrixElement,
c: AffineMatrixElement, pub c: AffineMatrixElement,
d: AffineMatrixElement, pub d: AffineMatrixElement,
x: AffineMatrixElement, pub x: AffineMatrixElement,
y: AffineMatrixElement, pub y: AffineMatrixElement,
} }
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
@ -318,11 +325,17 @@ impl From<AffineMatrixBackground> for AffineMatrix {
#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[derive(Debug, PartialEq, Eq, Clone, Copy)]
#[repr(C, packed(4))] #[repr(C, packed(4))]
/// An affine matrix that can be used in affine objects /// An affine matrix that can be used in affine objects
///
/// ```txt
/// a b
/// c d
/// ```
#[allow(missing_docs)]
pub struct AffineMatrixObject { pub struct AffineMatrixObject {
a: Num<i16, 8>, pub a: Num<i16, 8>,
b: Num<i16, 8>, pub b: Num<i16, 8>,
c: Num<i16, 8>, pub c: Num<i16, 8>,
d: Num<i16, 8>, pub d: Num<i16, 8>,
} }
impl Default for AffineMatrixObject { impl Default for AffineMatrixObject {

View file

@ -432,7 +432,7 @@ impl AffineMap {
vram: &mut VRamManager, vram: &mut VRamManager,
pos: impl Into<Vector2D<u16>>, pos: impl Into<Vector2D<u16>>,
tileset: &TileSet<'_>, tileset: &TileSet<'_>,
tile_id: u8, tile_index: u16,
) { ) {
let pos = self.map_size().gba_offset(pos.into()); let pos = self.map_size().gba_offset(pos.into());
let colours = self.colours(); let colours = self.colours();
@ -442,8 +442,6 @@ impl AffineMap {
vram.remove_tile(old_tile.tile_index(colours)); vram.remove_tile(old_tile.tile_index(colours));
} }
let tile_index = tile_id as u16;
let new_tile = if tile_index != TRANSPARENT_TILE_INDEX { let new_tile = if tile_index != TRANSPARENT_TILE_INDEX {
let new_tile_idx = vram.add_tile(tileset, tile_index); let new_tile_idx = vram.add_tile(tileset, tile_index);
Tile::new(new_tile_idx, TileSetting(0)) Tile::new(new_tile_idx, TileSetting(0))