diff --git a/examples/the-dungeon-puzzlers-lament/build.rs b/examples/the-dungeon-puzzlers-lament/build.rs index cb2b3e71..1561be13 100644 --- a/examples/the-dungeon-puzzlers-lament/build.rs +++ b/examples/the-dungeon-puzzlers-lament/build.rs @@ -9,21 +9,25 @@ use std::{ use proc_macro2::TokenStream; const LEVEL_NAMES: &[&str] = &[ - "level1", "level2", "level3", "level4", "level5", + "level1", + "level2", + "level3", + "level4", + "level5", "level6", - // "level_switch", - // "level_spikes", - // "level_spikes2", - // "squid_force_button", - // "level_squid_intro", - // "level_squid2", - // "level_squid1", - // "level_squid_item", - // "level_squid_button", - // "level_squid_drop", - // "level_spikes3", - // "level_around", - // "level_squidprogramming", + "level_switch", + "level_spikes", + "level_spikes2", + "level_squid_force_button", + "level_squid_intro", + "level_squid2", + "level_squid1", + "level_squid_item", + "level_squid_button", + "level_squid_drop", + "level_spikes3", + "level_around", + "level_squidprogramming", ]; fn main() { @@ -312,24 +316,24 @@ fn export_tiles(map: &tiled::Map, background: TokenStream) -> TokenStream { match tile { Some(tile) => { - let vflip = tile.flip_h; - let hflip = tile.flip_v; + let vflip = tile.flip_v; + let hflip = tile.flip_h; + + // calculate the actual tile ID based on the properties here + // since the tiles in tiled are 16x16, but we want to export to 8x8, we have to work this out carefully let tile_tileset_x = tile.id() % 9; let tile_tileset_y = tile.id() / 9; - let x_offset = if x % 2 == 0 && !hflip { 0 } else { 1 }; - let y_offset = if y % 2 == 0 && !vflip { 0 } else { 1 }; - - // calculate the actual tile ID based on the properties here - // since the tiles in tiled are 16x16, but we want to export to 8x8, we have to work this out carefully + let x_offset = if (x % 2 == 0) ^ hflip { 0 } else { 1 }; + let y_offset = if (y % 2 == 0) ^ vflip { 0 } else { 1 }; let gba_tile_id = tile_tileset_x * 2 + x_offset + tile_tileset_y * 9 * 4 + y_offset * 9 * 2; let gba_tile_id = gba_tile_id as u16; let palette_id = quote! { backgrounds::#background.palette_assignments[#gba_tile_id as usize] }; - quote! { TileSetting::new(#gba_tile_id, #vflip, #hflip, #palette_id) } + quote! { TileSetting::new(#gba_tile_id, #hflip, #vflip, #palette_id) } } None => { quote! { TileSetting::new(1023, false, false, 0) } @@ -355,11 +359,11 @@ fn export_ui_tiles(map: &tiled::Map, background: TokenStream) -> TokenStream { match tile { Some(tile) => { let tile_id = tile.id() as u16; - let vflip = tile.flip_h; - let hflip = tile.flip_v; + let vflip = tile.flip_v; + let hflip = tile.flip_h; let palette_id = quote! { backgrounds::#background.palette_assignments[#tile_id as usize] }; - quote! { TileSetting::new(#tile_id, #vflip, #hflip, #palette_id) } + quote! { TileSetting::new(#tile_id, #hflip, #vflip, #palette_id) } } None => { quote! { TileSetting::new(1023, false, false, 0) } diff --git a/examples/the-dungeon-puzzlers-lament/maps/levels16/level_around.tmx b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_around.tmx new file mode 100644 index 00000000..a2e0cee9 --- /dev/null +++ b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_around.tmx @@ -0,0 +1,31 @@ + + + + + + + + + + +0,0,1,7,4,7,5,2,2,2,9, +0,0,46,11,11,17,13,12,14,16,18, +1,6,1073741852,13,16,11,12,12,13,12,18, +46,16,13,13,15,14,13,16,15,13,47, +37,17,12,14,12,13,17,11,2147483676,26,27, +19,28,11,13,14,11,16,16,18,0,0, +0,37,16,12,13,17,17,15,18,0,0, +0,19,28,16,15,17,15,11,47,0,0, +0,0,46,12,15,12,16,2147483676,27,0,0, +0,0,19,21,25,23,22,27,0,0,0 + + + + + + + + + + + diff --git a/examples/the-dungeon-puzzlers-lament/maps/levels16/level_spikes.tmx b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_spikes.tmx new file mode 100644 index 00000000..d50168d9 --- /dev/null +++ b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_spikes.tmx @@ -0,0 +1,40 @@ + + + + + + + + + + +0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0, +0,1,7,2,7,6,7,3,2,9,0, +0,10,11,17,12,12,13,16,13,47,0, +0,37,15,15,17,11,11,17,12,18,0, +0,46,11,16,17,12,13,16,16,47,0, +0,37,13,11,14,12,14,11,17,38,0, +0,19,23,25,22,21,26,21,20,27,0, +0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0 + + + + + + + + + + + + + + + + + + + + diff --git a/examples/the-dungeon-puzzlers-lament/maps/levels16/level_spikes2.tmx b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_spikes2.tmx new file mode 100644 index 00000000..f1e28c2f --- /dev/null +++ b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_spikes2.tmx @@ -0,0 +1,43 @@ + + + + + + + + + + +0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0, +0,0,1,2,5,6,3,6,7,9,0, +0,0,46,11,17,15,14,17,11,18,0, +0,0,2147483678,2147483677,16,14,15,11,11,38,0, +0,0,46,12,11,16,15,15,11,18,0, +0,0,37,14,15,12,12,14,15,38,0, +0,0,19,23,24,25,24,25,20,27,0, +0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/the-dungeon-puzzlers-lament/maps/levels16/level_spikes3.tmx b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_spikes3.tmx new file mode 100644 index 00000000..e8e67c6e --- /dev/null +++ b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_spikes3.tmx @@ -0,0 +1,46 @@ + + + + + + + + + + +0,0,1,8,4,1073741872,2,7,9,0,0, +0,0,37,15,15,1073741863,15,13,3221225500,3,9, +0,0,19,28,12,12,14,17,12,13,47, +0,1,2,1073741852,17,17,15,16,14,14,38, +0,37,14,15,17,13,14,14,14,11,18, +0,19,28,13,16,15,12,11,13,17,38, +0,0,19,25,28,16,16,15,16,15,47, +0,0,0,0,10,13,16,17,12,17,38, +0,0,0,0,19,28,15,17,13,2147483676,27, +0,0,0,0,0,19,21,22,23,27,0 + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squid1.tmx b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squid1.tmx new file mode 100644 index 00000000..79dcfd30 --- /dev/null +++ b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squid1.tmx @@ -0,0 +1,37 @@ + + + + + + + + + + +0,0,0,0,1,8,2,6,9,0,0, +0,0,0,0,46,11,11,11,38,0,0, +0,0,0,0,10,11,12,14,38,0,0, +0,0,0,0,19,28,17,2147483676,27,0,0, +0,1,4,8,8,1073741852,13,3221225500,2,9,0, +0,46,17,17,17,12,13,11,12,47,0, +0,19,26,26,21,28,12,2147483676,24,27,0, +0,0,0,0,0,46,15,47,0,0,0, +0,0,0,0,0,10,14,47,0,0,0, +0,0,0,0,0,19,23,27,0,0,0 + + + + + + + + + + + + + + + + + diff --git a/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squid2.tmx b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squid2.tmx new file mode 100644 index 00000000..a740e0fc --- /dev/null +++ b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squid2.tmx @@ -0,0 +1,40 @@ + + + + + + + + + + +0,0,0,0,0,0,0,0,0,0,0, +0,0,0,1,5,9,0,0,0,0,0, +0,0,0,37,14,18,0,0,0,0,0, +0,0,0,46,13,18,0,0,0,0,0, +0,0,0,10,12,3221225500,6,6,9,0,0, +0,0,0,37,15,13,14,14,47,0,0, +0,0,0,46,12,2147483676,21,21,27,0,0, +0,0,0,37,16,47,0,0,0,0,0, +0,0,0,19,25,27,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0 + + + + + + + + + + + + + + + + + + + + diff --git a/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squid_button.tmx b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squid_button.tmx new file mode 100644 index 00000000..a6d7a077 --- /dev/null +++ b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squid_button.tmx @@ -0,0 +1,43 @@ + + + + + + + + + + +0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,1,2,9,0,0,0, +0,1,7,4,5,1073741852,16,3221225500,6,9,0, +0,37,15,14,11,11,11,12,17,18,0, +0,46,14,17,16,11,15,11,13,18,0, +0,46,13,12,11,14,16,11,16,18,0, +0,10,14,16,13,13,13,14,29,30,0, +0,37,15,11,14,14,39,16,13,38,0, +0,19,24,26,22,22,48,20,25,27,0, +0,0,0,0,0,0,0,0,0,0,0 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squid_drop.tmx b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squid_drop.tmx new file mode 100644 index 00000000..1dc5cabd --- /dev/null +++ b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squid_drop.tmx @@ -0,0 +1,37 @@ + + + + + + + + + + +0,0,0,1,4,8,3,2,3,9,0, +0,0,0,46,11,12,14,16,14,38,0, +0,0,0,46,15,17,13,13,15,3221225500,9, +1,6,1073741873,1073741874,13,15,17,17,11,13,38, +46,13,1073741864,1073741865,17,14,16,15,13,13,47, +10,11,13,1073741863,11,16,15,14,17,11,18, +46,17,13,14,11,17,14,11,12,16,47, +37,15,2147483676,20,23,28,12,12,16,15,18, +19,21,27,0,0,19,25,20,26,22,27, +0,0,0,0,0,0,0,0,0,0,0 + + + + + + + + + + + + + + + + + diff --git a/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squid_force_button.tmx b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squid_force_button.tmx new file mode 100644 index 00000000..918dd3c5 --- /dev/null +++ b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squid_force_button.tmx @@ -0,0 +1,40 @@ + + + + + + + + + + +0,0,0,0,0,0,0,0,0,0,0, +0,1,7,9,0,0,0,0,0,0,0, +0,10,14,47,0,0,1,5,2,9,0, +0,46,11,18,0,1,1073741852,16,16,38,0, +0,10,17,47,0,10,13,11,15,47,0, +0,10,16,47,0,10,13,12,11,18,0, +0,10,13,18,0,19,28,13,2147483676,27,0, +0,10,11,38,0,0,19,23,27,0,0, +0,19,21,27,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0 + + + + + + + + + + + + + + + + + + + + diff --git a/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squid_intro.tmx b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squid_intro.tmx new file mode 100644 index 00000000..f16222ce --- /dev/null +++ b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squid_intro.tmx @@ -0,0 +1,43 @@ + + + + + + + + + + +0,0,0,1,8,9,0,0,0,0,0, +1,7,2,32,16,3221225500,9,0,0,0,0, +10,12,16,1073741863,12,13,47,0,0,0,0, +10,13,17,15,15,12,3221225500,4,5,2,9, +46,11,11,14,16,12,15,14,15,13,18, +37,13,14,39,12,14,39,14,17,13,38, +46,11,40,41,16,29,33,11,13,13,18, +19,22,49,50,16,12,15,13,12,12,38, +0,0,0,46,12,13,39,15,2147483676,21,27, +0,0,0,19,23,25,48,22,27,0,0 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squid_item.tmx b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squid_item.tmx new file mode 100644 index 00000000..8c250cdb --- /dev/null +++ b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squid_item.tmx @@ -0,0 +1,43 @@ + + + + + + + + + + +0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,1,3,7,6,9,0,0, +0,0,0,0,10,13,12,13,3221225500,9,0, +0,0,0,0,37,16,12,11,11,38,0, +0,1,2,5,1073741852,12,17,15,14,47,0, +0,46,15,12,12,16,13,14,13,18,0, +0,19,28,12,11,39,14,14,2147483676,27,0, +0,0,19,20,25,48,25,21,27,0,0, +0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squidprogramming.tmx b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squidprogramming.tmx new file mode 100644 index 00000000..b7c12c53 --- /dev/null +++ b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_squidprogramming.tmx @@ -0,0 +1,52 @@ + + + + + + + + + + +0,1,4,3221225492,7,2147483655,3,1073741844,1073741850,2147483649,0, +0,37,2147483659,11,2147483659,2147483665,3221225486,3221225484,1073741839,3221225518,0, +0,10,17,1073741836,11,1073741838,15,3221225485,3221225485,3221225509,0, +0,37,14,14,15,12,12,3221225483,3221225486,2147483694,0, +0,37,17,11,17,16,11,1073741836,1073741837,3221225509,0, +0,46,15,17,13,12,16,2147483665,2147483662,1073741862,0, +0,19,23,24,21,21,22,26,25,1073741833,0, +1,1073741844,2147483651,1073741847,1073741846,1073741848,1073741847,7,3221225494,4,9, +10,2147483664,1073741840,1073741837,1073741837,3221225486,1073741840,1073741836,12,16,18, +19,2147483672,2147483673,1073741831,1073741832,1073741829,21,1073741826,22,22,27 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/the-dungeon-puzzlers-lament/maps/levels16/level_switch.tmx b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_switch.tmx new file mode 100644 index 00000000..333cba05 --- /dev/null +++ b/examples/the-dungeon-puzzlers-lament/maps/levels16/level_switch.tmx @@ -0,0 +1,37 @@ + + + + + + + + + + +0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0, +0,0,1,6,2,5,8,6,9,0,0, +0,0,37,12,13,16,11,13,38,0,0, +0,0,19,24,23,28,13,29,30,0,0, +0,0,0,0,0,10,16,14,18,0,0, +0,0,0,0,0,19,22,21,27,0,0, +0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0 + + + + + + + + + + + + + + + + +