diff --git a/Cargo.lock b/Cargo.lock index 17a046f..cf115c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,12 +8,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" -[[package]] -name = "bobbin-bits" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a856508d80144eabeae3392de76f269e5fd2983226e4757219f8ce87c5e572" - [[package]] name = "buddy-alloc" version = "0.4.2" @@ -24,7 +18,6 @@ checksum = "3240a4cb09cf0da6a51641bd40ce90e96ea6065e3a1adc46434029254bcc2d09" name = "cart" version = "0.1.0" dependencies = [ - "bobbin-bits", "buddy-alloc", "num", ] diff --git a/Cargo.toml b/Cargo.toml index 806ad9d..d76fac6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,12 +9,14 @@ crate-type = ["cdylib"] [dependencies] buddy-alloc = { version = "0.4.1", optional = true } -bobbin-bits = "0.1.1" num = "0.4.1" [profile.release] opt-level = "z" lto = true +codegen-units = 1 # Reduce number of codegen units to increase optimizations +panic = 'abort' # Abort on panic +strip = true # Strip symbols from binary* [features] # use `--no-default-features` or comment out next line to disable allocator diff --git a/src/alloc.rs b/src/alloc.rs index 92d488e..2e3e6c6 100644 --- a/src/alloc.rs +++ b/src/alloc.rs @@ -1,9 +1,9 @@ use buddy_alloc::{BuddyAllocParam, FastAllocParam, NonThreadsafeAlloc}; // These values can be tuned -const FAST_HEAP_SIZE: usize = 4 * 1024; // 4 KB -const HEAP_SIZE: usize = 16 * 1024; // 16 KB -const LEAF_SIZE: usize = 16; +const FAST_HEAP_SIZE: usize = 1 * 1024; // 1 KB +const HEAP_SIZE: usize = 30 * 1024; // 48 KB +const LEAF_SIZE: usize = 1024; static mut FAST_HEAP: [u8; FAST_HEAP_SIZE] = [0u8; FAST_HEAP_SIZE]; static mut HEAP: [u8; HEAP_SIZE] = [0u8; HEAP_SIZE]; diff --git a/src/lib.rs b/src/lib.rs index 285b731..4f59d97 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,34 +6,105 @@ mod alloc; mod spritesheet; mod wasm4; +use num; use std::cell::RefCell; use wasm4::*; -use num; -use std::collections::HashMap; + + + +const MAP_CHUNK_N_ROWS: usize = 32; +const MAP_CHUNK_N_COLS: usize = 32; +const MAP_N_CHUNKS: i32 = 13; +const N_NPCS: i32 = 14; + +const GROUND_TILE_OFFSET: usize = 1; + +const TILE_WIDTH_PX: usize = 5; +const TILE_HEIGHT_PX: usize = 5; #[derive(PartialEq, Eq, Hash)] -enum kitty_states { - idle, - moving_1, - moving_2, - jump +enum KittyStates { + Idle, + Moving1, + Moving2, + Jump, } impl Character { - fn new() -> Character { - let kitty_state_to_anim_map = HashMap::from([ - (kitty_states::idle, 0), - (kitty_states::moving_1, 1), - (kitty_states::moving_2, 2), - (kitty_states::jump, 3) - ]); + fn new(x_pos: i32, sprite_type: spritesheet::PresetSprites) -> Character { Character { - x_pos: 0.0, y_pos: 0.0, x_vel: 0.0, y_vel: 0.0, - x_vel_cap: 2.0, y_vel_cap: 7.0, count: 0, facing_right: true, - state: kitty_states::idle, state_timer: 0, state_to_anim_map: kitty_state_to_anim_map + x_pos: x_pos as f32, + y_pos: 0.0, + x_vel: 0.0, + y_vel: 0.0, + x_vel_cap: 2.0, + y_vel_cap: 7.0, + count: 0, + facing_right: true, + state: KittyStates::Idle, + current_sprite_i: 0, + sprite: spritesheet::Sprite::from_preset(sprite_type), } } } +#[derive(Clone, Copy)] + +struct Camera { + current_viewing_x_offset: f32, + current_viewing_y_offset: f32, +} + + +struct MapChunk { + tiles: [[u8; MAP_CHUNK_N_COLS]; MAP_CHUNK_N_ROWS], + chunk_i: i32, + chunk_j: i32, +} + +struct GameMap { + chunks: Vec + +} + +fn drawmap(game_state: &GameState) { + let map = &game_state.map; + let camera = &game_state.camera; + + for chunk in &map.chunks { + let tiles = chunk.tiles; + for row in 0..tiles.len() { + for col in 0..tiles[row].len() { + let map_tile_i = &tiles[row][col]; + match map_tile_i { + 0 => {}, + tile_idx => { + let tile_i: usize = *tile_idx as usize - 1; // *tile_idx as usize; + // trace(format!("Tile {tile_i}")); + let chunk_x_offset: i32 = (TILE_WIDTH_PX * MAP_CHUNK_N_COLS) as i32 * chunk.chunk_j; + let chunk_y_offset: i32 = (TILE_HEIGHT_PX * MAP_CHUNK_N_ROWS) as i32 * chunk.chunk_i; + let x_loc = (chunk_x_offset + col as i32 * TILE_HEIGHT_PX as i32) - camera.current_viewing_x_offset as i32; + let y_loc = (chunk_y_offset + row as i32 * TILE_WIDTH_PX as i32) - camera.current_viewing_y_offset as i32; + + if x_loc >= 0 && x_loc < 160 && y_loc > 0 && y_loc < 160 { + blit_sub( + &game_state.spritesheet, + x_loc, + y_loc, + game_state.background_tiles[tile_i].frames[0].positioning.width as u32, + game_state.background_tiles[tile_i].frames[0].positioning.height as u32, + game_state.background_tiles[tile_i].frames[0].positioning.start_x as u32, + game_state.background_tiles[tile_i].frames[0].positioning.start_y as u32, + game_state.spritesheet_stride as u32, + spritesheet::KITTY_SS_FLAGS, + ); + } + }, + } + + } + } + } +} struct Character { x_pos: f32, @@ -44,112 +115,244 @@ struct Character { y_vel_cap: f32, count: i32, facing_right: bool, - state: kitty_states, - state_timer: i32, - state_to_anim_map: HashMap + state: KittyStates, + current_sprite_i: i32, + sprite: spritesheet::Sprite, } -thread_local!(static BOB: RefCell = RefCell::new(Character::new())); -thread_local!(static KITTY_SPRITES: RefCell>> = RefCell::new(vec![ - spritesheet::get_sprite_from_spritesheet([1, 2, 3, 4], 0, 0, 2, 2), - spritesheet::get_sprite_from_spritesheet([1, 2, 3, 4], 2, 0, 2, 2), - spritesheet::get_sprite_from_spritesheet([1, 2, 3, 4], 0, 2, 2, 2), - spritesheet::get_sprite_from_spritesheet([1, 2, 3, 4], 2, 2, 2, 2), - spritesheet::get_sprite_from_spritesheet([1, 2, 3, 4], 4, 0, 2, 2), - spritesheet::get_sprite_from_spritesheet([1, 2, 3, 4], 4, 2, 2, 2), -])); - -fn get_pos(bob: &Character) { - let _ = bob.x_pos; +#[derive(Debug)] +pub struct Rng(u128); + +impl Rng { + pub fn new() -> Self { + Self(0x7369787465656E2062797465206E756Du128 | 1) + } + + pub fn next(&mut self) -> u64 { + self.0 = self.0.wrapping_mul(0x2360ED051FC65DA44385DF649FCCF645); + let rot = (self.0 >> 122) as u32; + let xsl = ((self.0 >> 64) as u64) ^ (self.0 as u64); + xsl.rotate_right(rot) + } } -#[no_mangle] -fn start() { - unsafe { - *PALETTE = spritesheet::KITTY_SS_PALLETE; +struct GameState<'a> { + player_1: Character, + npcs: Vec, + spritesheet: &'a [u8], + spritesheet_stride: usize, + background_tiles: Vec, + map: GameMap, + camera: Camera, + rng: Rng, +} + + + +fn generate_map(rng: &mut Rng) -> GameMap { + + let mut chunks: Vec = (0..MAP_N_CHUNKS).map(|i| MapChunk { + tiles: [[0; MAP_CHUNK_N_COLS]; MAP_CHUNK_N_ROWS], + chunk_i: 0, + chunk_j: i + }).collect(); + for chunk in &mut chunks { + let tiles = &mut chunk.tiles; + for col in 0..MAP_CHUNK_N_COLS { + tiles[MAP_CHUNK_N_ROWS - GROUND_TILE_OFFSET][col] = 1; + } } + for chunk in &mut chunks { + + let tiles = &mut chunk.tiles; + for row in 0..MAP_CHUNK_N_ROWS - GROUND_TILE_OFFSET - 5 { + for col in 4..MAP_CHUNK_N_COLS - 4 { + let mut rand_num = rng.next() as u8; + rand_num /= 2; + if rand_num >= 9 { + rand_num = 0; + } + tiles[row][col] = rand_num; + } + } + + } + for row in 0..MAP_CHUNK_N_ROWS - GROUND_TILE_OFFSET { + chunks[0].tiles[row][0] = 1; + let l = chunks.len() - 1; + chunks[l].tiles[row][MAP_CHUNK_N_ROWS - 1] = 1; + } + + + let map = GameMap { chunks: chunks}; + + + + + map +} + +impl GameState<'static> { + fn new() -> GameState<'static> { + let mut rng = Rng::new(); + GameState { + player_1: Character::new(40, spritesheet::PresetSprites::Kitty1), + npcs: (0..N_NPCS).map(|mut x| { + x %= 6; + let preset = match x { + 0 => spritesheet::PresetSprites::Kitty1, + 1 => spritesheet::PresetSprites::Kitty2, + 2 => spritesheet::PresetSprites::Kitty3, + 3 => spritesheet::PresetSprites::Kitty4, + 4 => spritesheet::PresetSprites::Lizard, + 5 => spritesheet::PresetSprites::Pig, + _ => spritesheet::PresetSprites::Pig + }; + Character::new((x * 2000) % 300 , preset) + }).collect::>(), + // npcs: vec![ + // Character::new(500, spritesheet::PresetSprites::Kitty2), + // Character::new(400, spritesheet::PresetSprites::Kitty3), + // Character::new(300, spritesheet::PresetSprites::Kitty4), + // Character::new(200, spritesheet::PresetSprites::Pig), + // Character::new(100, spritesheet::PresetSprites::Lizard), + // ], + spritesheet: &spritesheet::KITTY_SS, + spritesheet_stride: spritesheet::KITTY_SS_STRIDE, + background_tiles: vec![ + spritesheet::Sprite::from_preset(spritesheet::PresetSprites::SolidWhite), + spritesheet::Sprite::from_preset(spritesheet::PresetSprites::SeethroughWhite), + spritesheet::Sprite::from_preset(spritesheet::PresetSprites::TopleftSolidCorner), + spritesheet::Sprite::from_preset(spritesheet::PresetSprites::ToprightSolidCorner), + spritesheet::Sprite::from_preset(spritesheet::PresetSprites::BottomleftSolidCorner), + spritesheet::Sprite::from_preset(spritesheet::PresetSprites::BottomrightSolidCorner), + spritesheet::Sprite::from_preset(spritesheet::PresetSprites::ColumnTop), + spritesheet::Sprite::from_preset(spritesheet::PresetSprites::ColumnMiddle), + spritesheet::Sprite::from_preset(spritesheet::PresetSprites::ColumnBottom), + ], + map: generate_map(&mut rng), + camera: Camera { current_viewing_x_offset: 0.0, current_viewing_y_offset: 0.0 }, + rng + } + } +} + +thread_local!(static GAME_STATE_HOLDER: RefCell> = RefCell::new(GameState::new())); + +fn update_pos(character: &mut Character, input: u8) { + + let btn_accel = 0.6; + let hop_v: f32 = -3.0; + let h_decay = 0.8; + if input & BUTTON_LEFT != 0 { + character.x_vel -= btn_accel; + character.facing_right = false; + character.state = KittyStates::Moving1; + character.current_sprite_i = 1; + } else if input & BUTTON_RIGHT != 0 { + character.x_vel += btn_accel; + character.facing_right = true; + character.state = KittyStates::Moving2; + character.current_sprite_i = 2; + } else { + character.x_vel *= h_decay; + character.state = KittyStates::Idle; + character.current_sprite_i = 0; + } + if input & BUTTON_1 != 0 || input & BUTTON_2 != 0 { + character.y_vel = hop_v; + character.state = KittyStates::Jump; + character.current_sprite_i = 3; + } else if input & BUTTON_DOWN != 0 { + } + + character.x_pos += character.x_vel; + character.y_pos += character.y_vel; + + let gravity = 0.2; + character.y_vel += gravity; + + character.x_pos = num::clamp(character.x_pos, 5.0, (TILE_WIDTH_PX * MAP_N_CHUNKS as usize * MAP_CHUNK_N_COLS - 5 - character.sprite.frames[character.current_sprite_i as usize].positioning.width) as f32); + character.y_pos = num::clamp(character.y_pos, 0.0, 160.0 - TILE_HEIGHT_PX as f32 * GROUND_TILE_OFFSET as f32 - (character.sprite.frames[character.current_sprite_i as usize].positioning.height as f32)); + character.x_vel = num::clamp(character.x_vel, -character.x_vel_cap, character.x_vel_cap); + character.y_vel = num::clamp(character.y_vel, -character.y_vel_cap, character.y_vel_cap); + character.count += 1; +} + +fn drawcharacter(spritesheet: &[u8], spritesheet_stride: &usize, camera: &Camera, character: &Character) { + let i = character.current_sprite_i as usize; + blit_sub( + &spritesheet, + character.x_pos as i32 - camera.current_viewing_x_offset as i32, + character.y_pos as i32 - camera.current_viewing_y_offset as i32, + character.sprite.frames[i].positioning.width as u32, + character.sprite.frames[i].positioning.height as u32, + character.sprite.frames[i].positioning.start_x as u32, + character.sprite.frames[i].positioning.start_y as u32, + *spritesheet_stride as u32, + spritesheet::KITTY_SS_FLAGS | if character.facing_right { 0 } else { BLIT_FLIP_X }, + ); } #[no_mangle] fn update() { - BOB.with(|bob_cell| { - KITTY_SPRITES.with(|kitty_sprites_cell| { - let mut bob = bob_cell.borrow_mut(); - let kitty_sprites = kitty_sprites_cell.borrow(); - unsafe { *DRAW_COLORS = spritesheet::KITTY_SS_DRAW_COLORS } - // text("Hello from Rust!", 10, 10); - - let gamepad = unsafe { *GAMEPAD1 }; - - let btn_accel = 0.6; - let hop_v: f32 = -3.0; - let h_decay = 0.8; - if gamepad & BUTTON_LEFT != 0 { - bob.x_vel -= btn_accel; - bob.facing_right = false; - bob.state = kitty_states::moving_1; - } else if gamepad & BUTTON_RIGHT != 0 { - bob.x_vel += btn_accel; - bob.facing_right = true; - bob.state = kitty_states::moving_2; - } else { - bob.x_vel *= h_decay; - bob.state = kitty_states::idle; + GAME_STATE_HOLDER.with(|game_cell| { + let mut game_state = game_cell.borrow_mut(); + + unsafe { *DRAW_COLORS = 0x1112 } + text("WELCOME TO KITTY GAME. :D xD WHAT IS POPPIN ITS YOUR BOY, THE KITTY GAME", 200 - game_state.camera.current_viewing_x_offset as i32, 130); + + + unsafe { + *PALETTE = spritesheet::KITTY_SS_PALLETE; + } + unsafe { *DRAW_COLORS = spritesheet::KITTY_SS_DRAW_COLORS } + + let gamepad = unsafe { *GAMEPAD1 }; + update_pos(&mut game_state.player_1, gamepad); + + game_state.camera.current_viewing_x_offset = num::clamp(game_state.player_1.x_pos - 80.0, 0.0, MAP_N_CHUNKS as f32 * TILE_WIDTH_PX as f32 * MAP_CHUNK_N_COLS as f32); + + let mut inputs: Vec = vec![]; + + for _ in 0..game_state.npcs.len() { + let rngg = &mut game_state.rng; + let rand_val = (rngg.next() % 255) as u8; + if rand_val < 20 { + inputs.push(0x10); } - if gamepad & BUTTON_UP != 0 { - bob.y_vel = hop_v; - bob.state = kitty_states::jump; - } else if gamepad & BUTTON_DOWN != 0 { - + else if rand_val < 40 { + inputs.push(0x20); + } + else if rand_val < 42 { + inputs.push(BUTTON_1); + } + else { + inputs.push(0x0); } - - bob.x_pos += bob.x_vel; - bob.y_pos += bob.y_vel; - let gravity = 0.1; - bob.y_vel += gravity; - get_pos(&bob); - bob.x_pos = num::clamp(bob.x_pos, 0.0, 159.0); - bob.y_pos = num::clamp(bob.y_pos, 0.0, 149.0); - bob.x_vel = num::clamp(bob.x_vel, -bob.x_vel_cap, bob.x_vel_cap); - bob.y_vel = num::clamp(bob.y_vel, -bob.y_vel_cap, bob.y_vel_cap); - bob.count += 1; - let i: usize = ((bob.count / 30) % 4) as usize; - // blit(&SMILEY, bob.x_pos as i32, bob.y_pos as i32, 8, 8, BLIT_1BPP); - // text("Press X to blink", 16, 90); - // [blit(&spritesheet::KITTY_SS, 0, 0, spritesheet::KITTY_SS_WIDTH, spritesheet::KITTY_SS_HEIGHT, spritesheet::KITTY_SS_FLAGS); - blit( - &kitty_sprites[3].frames[*bob.state_to_anim_map.get(&bob.state).unwrap()].img, - bob.x_pos as i32, - bob.y_pos as i32, - kitty_sprites[0].frames[i].width as u32, - kitty_sprites[0].frames[i].height as u32, - spritesheet::KITTY_SS_FLAGS | if bob.facing_right {0} else {BLIT_FLIP_X}, - ); - blit( - &kitty_sprites[1].frames[i].img, - 130, - 100, - kitty_sprites[1].frames[i].width as u32, - kitty_sprites[1].frames[i].height as u32, - spritesheet::KITTY_SS_FLAGS, - ); - blit( - &kitty_sprites[2].frames[i].img, - 90, - 120, - kitty_sprites[2].frames[i].width as u32, - kitty_sprites[2].frames[i].height as u32, - spritesheet::KITTY_SS_FLAGS, - ); - blit( - &kitty_sprites[3].frames[i].img, - 40, - 100, - kitty_sprites[3].frames[i].width as u32, - kitty_sprites[3].frames[i].height as u32, - spritesheet::KITTY_SS_FLAGS, - ); - }); + } + + for i in 0..game_state.npcs.len() { + update_pos(&mut game_state.npcs[i], inputs[i]); + } + for npc in &game_state.npcs { + drawcharacter(&game_state.spritesheet, &game_state.spritesheet_stride, &game_state.camera, &npc); + } + drawcharacter(&game_state.spritesheet, &game_state.spritesheet_stride, &game_state.camera, &game_state.player_1); + drawmap(&game_state); + + + // blit_sub( + // &game_state.spritesheet, + // 0 as i32, + // 150 as i32, + // game_state.background_tiles[0].frames[0].positioning.width as u32, + // game_state.background_tiles[0].frames[0].positioning.height as u32, + // game_state.background_tiles[0].frames[0].positioning.start_x as u32, + // game_state.background_tiles[0].frames[0].positioning.start_y as u32, + // game_state.spritesheet_stride as u32, + // spritesheet::KITTY_SS_FLAGS | if bob.facing_right { 0 } else { BLIT_FLIP_X }, + // ); }); } diff --git a/src/spritesheet.rs b/src/spritesheet.rs index 6aee1e1..8392f72 100644 --- a/src/spritesheet.rs +++ b/src/spritesheet.rs @@ -3,7 +3,10 @@ // kitty_ss pub const KITTY_SS_PALLETE: [u32; 4] = [ - 0x222034, + // 0x222034, + // 0x000000, + // 0x202020, + 0x000000, 0xffffff, 0xff67d3, 0x99e550, @@ -11,75 +14,165 @@ pub const KITTY_SS_PALLETE: [u32; 4] = [ pub const KITTY_SS_DRAW_COLORS: u16 = 0x3420; -pub const KITTY_SS_WIDTH: u32 = 320; -pub const KITTY_SS_HEIGHT: u32 = 64; pub const KITTY_SS_FLAGS: u32 = 1; // BLIT_2BPP -const KITTY_SS_PAGE_WIDTH: usize = 64; -const KITTY_SS_NUM_PAGES: usize = 5; +pub const KITTY_TILE_SIZE: usize = 8; + +pub const KITTY_SS_STRIDE: usize = 320; + +pub const KITTY_SS_PAGE_WIDTH: usize = 64; + // kitty_ss pub const KITTY_SS: [u8; 5120] = [ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x55,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x40,0x51,0x40,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x40,0x40,0x40,0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x40,0x51,0x40,0x55,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x50,0x15,0x00,0x00,0x00,0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x50,0x15,0x00,0x00,0x00,0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x11,0x00,0x00,0x01,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x55,0x40,0x55,0x40,0x55,0x40,0x01,0x50,0x15,0x00,0x00,0x00,0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x15,0x51,0x00,0x15,0x55,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x15,0x51,0x00,0x15,0x55,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x55,0x54,0x00,0x10,0x15,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x15,0x51,0x00,0x15,0x55,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x54,0x00,0x10,0x55,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x54,0x00,0x10,0x55,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x15,0x55,0x40,0x05,0x55,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x54,0x00,0x10,0x55,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x00,0x00,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x40,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x55,0x40,0x15,0x00,0x55,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x40,0x40,0x40,0x55,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x40,0x40,0x40,0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x40,0x40,0x40,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x15,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x55,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x40,0x00,0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x50,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x50,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x40,0x00,0x00,0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x40,0x00,0x10,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x40,0x00,0x10,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x40,0x01,0x51,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x40,0x01,0x50,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x40,0x00,0x15,0x55,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x40,0x00,0x15,0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x11,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x40,0x00,0x10,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x55,0x54,0x40,0x00,0x15,0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x55,0x54,0x40,0x00,0x15,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x55,0x40,0x00,0x15,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x55,0x54,0x40,0x00,0x15,0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x55,0x00,0x00,0x40,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x55,0x00,0x00,0x10,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x55,0x50,0x40,0x00,0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x55,0x00,0x00,0x15,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x00,0x00,0x40,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x01,0x00,0x00,0x10,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x55,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x22,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x22,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0x00,0x00,0x02,0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0x00,0x00,0x00,0x22,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0x00,0x00,0x02,0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xf3,0x00,0x00,0x2a,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xf3,0x00,0x00,0x02,0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xf3,0x00,0x00,0x2a,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xfc,0x00,0x00,0x2a,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xfc,0x00,0x00,0x2a,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xfc,0x00,0x00,0x2a,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x0c,0x00,0x00,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x30,0x00,0x00,0x2a,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x0c,0x00,0x00,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x82,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x82,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x82,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ]; #[derive(Clone, Copy)] -pub struct SpriteFrame { + + +pub struct SpriteFrameInternalPositioning { pub width: usize, pub height: usize, - pub img: [u8; COUNT], + pub start_x: usize, + pub start_y: usize, } -pub struct Sprite { - pub frames: [SpriteFrame; N_FRAMES] +pub struct SpriteFrame { + pub positioning: SpriteFrameInternalPositioning, } +pub struct Sprite { + pub frames: Vec +} +#[allow(dead_code)] +pub enum PresetSprites { + Kitty1, + Kitty2, + Kitty3, + Kitty4, + Pig, + Lizard, + TopleftSolidCorner, + ToprightSolidCorner, + SolidWhite, + BottomleftSolidCorner, + BottomrightSolidCorner, + SeethroughWhite, + ColumnTop, + ColumnMiddle, + ColumnBottom, +} +impl Sprite { + pub fn new(spriteframe_indecies: Vec<(usize, usize, usize, usize)>) -> Sprite { + Sprite { + frames: spriteframe_indecies.iter().map(|&x| SpriteFrame { + positioning: SpriteFrameInternalPositioning { width: x.0, height: x.1, start_x: x.2, start_y: x.3 } + }).collect::>() + } + } -pub fn get_sprite_from_spritesheet( - frame_indecies: [usize; N_FRAMES], - start_x: usize, - start_y: usize, - width: usize, - height: usize -) -> Sprite { - - let realsy = start_y * 8; - let realsx = start_x * 8; - let realw = width *8; - let realh = height * 8; - - let sf1 = SpriteFrame:: { - width: realw, - height: realh, - img: [0b11111111; COUNT] - }; - - let mut frames: [SpriteFrame; N_FRAMES] = [sf1; N_FRAMES]; - - for sprite_frame_i in 0..N_FRAMES { - let ss_frame_index = frame_indecies[sprite_frame_i]; - // for each frame, index to that page, - // (add 64 ** 2), get it row at a time. - // for each row, put the pixels in. - // then to jump to the next row, add the num_pages * page_row_len - let mut sf = SpriteFrame::{ - width: realw, - height: realh, - img:[0b00000000; COUNT] - }; - - for row in 0..realh { - - // 2 bits pp means indecies are 4x smller - let ss_row = row + realsy; - let img_start = (row * realw) / 4; - let ss_start = (ss_row * KITTY_SS_NUM_PAGES * KITTY_SS_PAGE_WIDTH + ss_frame_index * KITTY_SS_PAGE_WIDTH + realsx) / 4; - sf.img[img_start..img_start + (realw / 4)].clone_from_slice(&KITTY_SS[ss_start..ss_start + (realw / 4)]); - } - - frames[sprite_frame_i] = sf; + pub fn from_page_tilei_tilej(spriteframe_indecies: Vec<(usize, usize, usize, usize, usize, usize, usize)>) -> Sprite { + Sprite::new(spriteframe_indecies.iter().map(|&x| (x.3, x.4, KITTY_SS_PAGE_WIDTH * x.0 + KITTY_TILE_SIZE * x.1 + x.5, KITTY_TILE_SIZE * x.2 + x.6)).collect()) } - Sprite::{ - frames + pub fn from_preset(preset_sprite: PresetSprites) -> Sprite { + match preset_sprite { + PresetSprites::Kitty1 => Sprite::from_page_tilei_tilej(vec![ + // page, tile_i, tile_j, width, height, x_sub_tile, y_sub_tile + (1, 0, 0, 10, 5, 2, 2), + (2, 0, 0, 10, 5, 2, 2), + (3, 0, 0, 10, 5, 2, 2), + (4, 0, 0, 10, 5, 2, 2), + ]), + PresetSprites::Kitty2 => Sprite::from_page_tilei_tilej(vec![ + (1, 2, 0, 10, 5, 1, 2), + (2, 2, 0, 10, 5, 1, 2), + (3, 2, 0, 10, 5, 1, 2), + (4, 2, 0, 10, 7, 1, 1), + ]), + PresetSprites::Kitty3 => Sprite::from_page_tilei_tilej(vec![ + (1, 0, 2, 10, 5, 4, 4), + (2, 0, 2, 10, 5, 4, 4), + (3, 0, 2, 10, 5, 4, 4), + (4, 0, 2, 10, 7, 4, 2), + ]), + PresetSprites::Kitty4 => Sprite::from_page_tilei_tilej(vec![ + (1, 2, 2, 10, 6, 2, 3), + (2, 2, 2, 10, 6, 2, 3), + (3, 2, 2, 10, 6, 2, 3), + (4, 2, 2, 10, 10, 2, 0), + ]), + PresetSprites::Pig => Sprite::from_page_tilei_tilej(vec![ + (1, 0, 4, 8, 5, 4, 4), + (2, 0, 4, 8, 5, 4, 4), + (3, 0, 4, 8, 5, 4, 4), + (2, 0, 4, 8, 5, 4, 4), + ]), + PresetSprites::Lizard => Sprite::from_page_tilei_tilej(vec![ + (3, 2, 4, 10, 9, 3, 2), + (2, 2, 4, 10, 9, 3, 2), + (2, 2, 4, 10, 9, 3, 2), + (2, 2, 4, 10, 9, 3, 2), + ]), + PresetSprites::TopleftSolidCorner => Sprite::from_page_tilei_tilej(vec![(0, 5, 0, 5, 5, 0, 0)]), + PresetSprites::SolidWhite => Sprite::from_page_tilei_tilej(vec![(0, 6, 0, 5, 5, 0, 0)]), + PresetSprites::ToprightSolidCorner => Sprite::from_page_tilei_tilej(vec![(0, 7, 0, 5, 5, 0, 0)]), + PresetSprites::BottomleftSolidCorner => Sprite::from_page_tilei_tilej(vec![(0, 5, 1, 5, 5, 0, 0)]), + PresetSprites::SeethroughWhite => Sprite::from_page_tilei_tilej(vec![(0, 6, 1, 5, 5, 0, 0)]), + PresetSprites::BottomrightSolidCorner => Sprite::from_page_tilei_tilej(vec![(0, 7, 1, 5, 5, 0, 0)]), + PresetSprites::ColumnTop => Sprite::from_page_tilei_tilej(vec![(0, 5, 2, 5, 5, 0, 0)]), + PresetSprites::ColumnMiddle => Sprite::from_page_tilei_tilej(vec![(0, 5, 1, 5, 5, 0, 0)]), + PresetSprites::ColumnBottom => Sprite::from_page_tilei_tilej(vec![(0, 5, 2, 5, 5, 0, 0)]) + } } } + + + +// pub fn get_sprite_from_spritesheet( +// frame_indecies: [usize; N_FRAMES], +// positionings: [SpriteFrameInternalPositioning; N_FRAMES] +// ) -> Sprite { + +// let realsy = start_y * 8; +// let realsx = start_x * 8; +// let realw = width *8; +// let realh = height * 8; + +// let sf1 = SpriteFrame:: { +// width: realw, +// height: realh, +// img: [0b11111111; COUNT] +// }; + +// let mut frames: [SpriteFrame; N_FRAMES] = [sf1; N_FRAMES]; + +// for sprite_frame_i in 0..N_FRAMES { +// let ss_frame_index = frame_indecies[sprite_frame_i]; +// // for each frame, index to that page, +// // (add 64 ** 2), get it row at a time. +// // for each row, put the pixels in. +// // then to jump to the next row, add the num_pages * page_row_len +// let mut sf = SpriteFrame::{ +// width: realw, +// height: realh, +// img:[0b00000000; COUNT] +// }; + +// for row in 0..realh { + +// // 2 bits pp means indecies are 4x smller +// let ss_row = row + realsy; +// let img_start = (row * realw) / 4; +// let ss_start = (ss_row * KITTY_SS_NUM_PAGES * KITTY_SS_PAGE_WIDTH + ss_frame_index * KITTY_SS_PAGE_WIDTH + realsx) / 4; +// sf.img[img_start..img_start + (realw / 4)].clone_from_slice(&KITTY_SS[ss_start..ss_start + (realw / 4)]); +// } + +// frames[sprite_frame_i] = sf; +// } + +// Sprite::{ +// frames +// } +// } +