fix tile ids

This commit is contained in:
Corwin Kuiper 2021-10-30 20:33:54 +01:00
parent d0808cb7f2
commit 301e2c115a

View file

@ -119,6 +119,10 @@ impl ObjectStandard<'_> {
self.attributes.set_mode(Mode::Hidden) self.attributes.set_mode(Mode::Hidden)
} }
pub fn set_palette(&mut self, palette: u16) {
self.attributes.set_palette(palette);
}
/// Sets the x and y position of the object, performing casts as nessesary /// Sets the x and y position of the object, performing casts as nessesary
/// to fit within the bits allocated for this purpose. /// to fit within the bits allocated for this purpose.
pub fn set_position(&mut self, position: Vector2D<i32>) { pub fn set_position(&mut self, position: Vector2D<i32>) {
@ -231,6 +235,10 @@ impl ObjectAttribute {
self.a1 = set_bits(self.a1, a1, 2, 0xE); self.a1 = set_bits(self.a1, a1, 2, 0xE);
} }
fn set_palette(&mut self, palette: u16) {
self.a2 = set_bits(self.a2, palette, 4, 0xC);
}
fn set_x(&mut self, x: u16) { fn set_x(&mut self, x: u16) {
self.a1 = set_bits(self.a1, x, 9, 0); self.a1 = set_bits(self.a1, x, 9, 0);
} }
@ -240,7 +248,7 @@ impl ObjectAttribute {
} }
fn set_tile_id(&mut self, id: u16) { fn set_tile_id(&mut self, id: u16) {
self.a2 = set_bits(self.a2, id, 9, 0); self.a2 = set_bits(self.a2, id, 10, 0);
} }
fn set_mode(&mut self, mode: Mode) { fn set_mode(&mut self, mode: Mode) {