Changes to fix level output in --system md
parent
8d4ade5f8e
commit
c4af44a5e4
|
@ -14,7 +14,7 @@ pub fn get_tiles( tilemap: &TiledTilemap ) -> Result<(Vec<u8>, Vec<u8>), Box<dyn
|
||||||
[ 0; 16 ],
|
[ 0; 16 ],
|
||||||
[ 0; 16 ]
|
[ 0; 16 ]
|
||||||
];
|
];
|
||||||
let mut all_tiles: Vec<u8> = Vec::new();
|
let mut all_tiles: Vec<u8> = vec![0; 32]; // --system md, start with a blank buffer tile
|
||||||
|
|
||||||
let tiles_height = tilemap.tileset.image.height() / 8; // --system md
|
let tiles_height = tilemap.tileset.image.height() / 8; // --system md
|
||||||
let tiles_width = tilemap.tileset.image.width() / 8; // --system md
|
let tiles_width = tilemap.tileset.image.width() / 8; // --system md
|
||||||
|
@ -93,7 +93,7 @@ pub fn get_tilemap( tilemap: &TiledTilemap ) -> Result<Vec<u8>, Box<dyn Error>>
|
||||||
let source_tile = target_tile - 1;
|
let source_tile = target_tile - 1;
|
||||||
|
|
||||||
// From the starting point of x, y "stamp" the target tile's indices
|
// From the starting point of x, y "stamp" the target tile's indices
|
||||||
let nametable_entry = source_tile;
|
let nametable_entry = target_tile;
|
||||||
let selected_pal = tilemap.tileset.palettes[ source_tile as usize ];
|
let selected_pal = tilemap.tileset.palettes[ source_tile as usize ];
|
||||||
if let Some( selected_pal ) = selected_pal {
|
if let Some( selected_pal ) = selected_pal {
|
||||||
nametable[ ( y * tilemap.width ) + x ] = ( ( selected_pal as u16 ) << 13 ) | nametable_entry;
|
nametable[ ( y * tilemap.width ) + x ] = ( ( selected_pal as u16 ) << 13 ) | nametable_entry;
|
||||||
|
@ -123,7 +123,7 @@ pub fn get_tilemap( tilemap: &TiledTilemap ) -> Result<Vec<u8>, Box<dyn Error>>
|
||||||
let source_tile = target_tile - 1;
|
let source_tile = target_tile - 1;
|
||||||
|
|
||||||
// From the starting point of x, y "stamp" the target tile's indices
|
// From the starting point of x, y "stamp" the target tile's indices
|
||||||
let nametable_entry = source_tile;
|
let nametable_entry = target_tile;
|
||||||
let selected_pal = tilemap.tileset.palettes[ source_tile as usize ];
|
let selected_pal = tilemap.tileset.palettes[ source_tile as usize ];
|
||||||
if let Some( selected_pal ) = selected_pal {
|
if let Some( selected_pal ) = selected_pal {
|
||||||
nametable[ ( y * tilemap.width ) + x ] = ( ( selected_pal as u16 ) << 13 ) | nametable_entry;
|
nametable[ ( y * tilemap.width ) + x ] = ( ( selected_pal as u16 ) << 13 ) | nametable_entry;
|
||||||
|
|
Loading…
Reference in New Issue