diff --git a/examples/basic/gfx.gif b/examples/basic/gfx.gif index b98b169..61999f1 100644 Binary files a/examples/basic/gfx.gif and b/examples/basic/gfx.gif differ diff --git a/src/mapedit/constants.rs b/src/mapedit/constants.rs index 7a55fce..2f86435 100644 --- a/src/mapedit/constants.rs +++ b/src/mapedit/constants.rs @@ -18,12 +18,20 @@ pub const TILE_BUT_CREATE: u16 = 0x7213; pub const BUT_SAVE: usize = 0; pub const BUT_CREATE: usize = 1; + pub const BUT_LAYER1: usize = 3; pub const BUT_LAYER2: usize = 4; pub const BUT_LAYER3: usize = 5; pub const BUT_LAYERS: usize = 6; + pub const BUT_SHIFT_LEFT: usize = 8; pub const BUT_SHIFT_RIGHT: usize = 9; pub const BUT_SHIFT_UP: usize = 10; pub const BUT_SHIFT_DOWN: usize = 11; -pub const BUT_EXIT: usize = 13; + +pub const BUT_REDUCE_HORIZONTAL: usize = 13; +pub const BUT_ENLARGE_HORIZONTAL: usize = 14; +pub const BUT_REDUCE_VERTICAL: usize = 15; +pub const BUT_ENLARGE_VERTICAL: usize = 16; + +pub const BUT_EXIT: usize = 18; diff --git a/src/mapedit/mod.rs b/src/mapedit/mod.rs index d9731c4..342405e 100644 --- a/src/mapedit/mod.rs +++ b/src/mapedit/mod.rs @@ -252,6 +252,38 @@ pub(crate) fn run_mapedit() { stuff.gsa1.bg[1].shift_down(); stuff.gsa1.bg[2].shift_down(); } + BUT_REDUCE_HORIZONTAL => { + if stuff.gsa1.bg[0].size.x > 1 { + stuff.gsa1.bg[0].size.x -= 1; + stuff.gsa1.bg[1].size.x -= 1; + stuff.gsa1.bg[2].size.x -= 1; + stuff.update_status_bar(); + } + } + BUT_ENLARGE_HORIZONTAL => { + if stuff.gsa1.bg[0].size.x <= BACKGROUND_MAX_SIZE as i32 - 1 { + stuff.gsa1.bg[0].size.x += 1; + stuff.gsa1.bg[1].size.x += 1; + stuff.gsa1.bg[2].size.x += 1; + stuff.update_status_bar(); + } + } + BUT_REDUCE_VERTICAL => { + if stuff.gsa1.bg[0].size.y > 1 { + stuff.gsa1.bg[0].size.y -= 1; + stuff.gsa1.bg[1].size.y -= 1; + stuff.gsa1.bg[2].size.y -= 1; + stuff.update_status_bar(); + } + } + BUT_ENLARGE_VERTICAL => { + if stuff.gsa1.bg[0].size.y <= BACKGROUND_MAX_SIZE as i32 - 1 { + stuff.gsa1.bg[0].size.y += 1; + stuff.gsa1.bg[1].size.y += 1; + stuff.gsa1.bg[2].size.y += 1; + stuff.update_status_bar(); + } + } BUT_EXIT => { println!("exit"); *control_flow = ControlFlow::Exit; diff --git a/src/mapedit/stuff.rs b/src/mapedit/stuff.rs index 4cbf2b6..fdacd09 100644 --- a/src/mapedit/stuff.rs +++ b/src/mapedit/stuff.rs @@ -80,6 +80,11 @@ impl Stuff { self.gsa2.bg[2].tiles[0][BUT_SHIFT_UP] = 0x7316; self.gsa2.bg[2].tiles[0][BUT_SHIFT_DOWN] = 0x7317; + self.gsa2.bg[2].tiles[0][BUT_REDUCE_HORIZONTAL] = 0x7414; + self.gsa2.bg[2].tiles[0][BUT_ENLARGE_HORIZONTAL] = 0x7415; + self.gsa2.bg[2].tiles[0][BUT_REDUCE_VERTICAL] = 0x7416; + self.gsa2.bg[2].tiles[0][BUT_ENLARGE_VERTICAL] = 0x7417; + self.gsa2.bg[2].size = IVec2 { x: 120, y: 68 }; //enough to cover 4k monitors? <_< self.gsa2.bg[3].size = IVec2 { x: 240, y: 136 };