shifting in map edit

This commit is contained in:
dani 2023-08-24 02:05:13 +00:00
parent 92afb74c8a
commit 4d684ee294
4 changed files with 46 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -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;

View File

@ -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;

View File

@ -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 };