From 36903a0a6537505afe81fe8b81dfcc46f9fa5302 Mon Sep 17 00:00:00 2001 From: Corwin Kuiper Date: Sat, 5 Jun 2021 20:48:02 +0100 Subject: [PATCH] fix index for affine matrix --- agb/src/display/object.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agb/src/display/object.rs b/agb/src/display/object.rs index 5a4e32fd..ea702dca 100644 --- a/agb/src/display/object.rs +++ b/agb/src/display/object.rs @@ -228,7 +228,7 @@ impl AffineMatrix<'_> { #[allow(clippy::identity_op)] /// Commits matrix to OAM, will cause any objects using this matrix to be updated. pub fn commit(&self) { - let id = self.loan.index as usize; + let id = self.loan.index as usize * 4; OBJECT_ATTRIBUTE_MEMORY.set((id + 0) * 4 + 3, self.attributes.p_a as u16); OBJECT_ATTRIBUTE_MEMORY.set((id + 1) * 4 + 3, self.attributes.p_b as u16); OBJECT_ATTRIBUTE_MEMORY.set((id + 2) * 4 + 3, self.attributes.p_c as u16);