From d998dbb87c940030ba7a65143864f816b26a3b37 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Mon, 10 May 2021 16:57:38 +0200 Subject: Adjust UI control for wave channel parameters --- src/sequencer.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 52 insertions(+), 6 deletions(-) diff --git a/src/sequencer.c b/src/sequencer.c index 3f52963..dfb2850 100644 --- a/src/sequencer.c +++ b/src/sequencer.c @@ -1088,8 +1088,28 @@ update_sequencer_sprites(void) { // Update parameter selection. { - int x = SEQ_CH3_PARAM_SEL_X + param_selection_loc * 4; - int y = SEQ_CH3_PARAM_SEL_Y; + u8 x_positions[] = { + 0, 4, 8, 12, 16, 20, 24, 28, + 36, 40, 44, 48, 52, 56, 60, 64, + 0, 4, 8, 12, 16, 20, 24, 28, + 36, 40, 44, 48, 52, 56, 60, 64, + 76, 80, 84, 88, 92, 96, 100, 104, + 112, 116, 120, 124, 128, 132, 136, 140, + 76, 80, 84, 88, 92, 96, 100, 104, + 112, 116, 120, 124, 128, 132, 136, 140, + }; + u8 y_positions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + }; + int x = SEQ_CH3_PARAM_SEL_X + x_positions[param_selection_loc]; + int y = SEQ_CH3_PARAM_SEL_Y + y_positions[param_selection_loc]; int base_tile = seq_sprites[57].base_tile; int hidden = 0; if (current_selection != SEQ_SELECT_PARAMETER) { @@ -1256,11 +1276,37 @@ handle_sequencer_input(void) { } } } else if (channel_selection_loc == 2) { - if (key_pressed(KEY_LEFT)) { - param_selection_loc = MAX(param_selection_loc - 1, 0); + if (key_pressed(KEY_LEFT) || key_pressed(KEY_RIGHT)) { + int increment = 0; + int loc = param_selection_loc; + if (key_pressed(KEY_RIGHT)) { + if (loc == 15 || loc == 32) { + increment = 17; + } else if (loc != 47){ + increment = 1; + } + } else { + if (loc == 32 || loc == 48) { + increment = -17; + } else if (loc != 16){ + increment = -1; + } + } + param_selection_loc = CLAMP(loc + increment, 0, 63); } - if (key_pressed(KEY_RIGHT)) { - param_selection_loc = MIN(param_selection_loc + 1, 64); + if (key_pressed(KEY_UP) || key_pressed(KEY_DOWN)) { + int increment = 0; + int loc = param_selection_loc; + if (key_pressed(KEY_UP)) { + if ((loc >= 16 && loc < 32) || (loc >= 48)) { + increment = -16; + } + } else { + if (loc < 16 || (loc >= 32 && loc < 48)) { + increment = 16; + } + } + param_selection_loc = CLAMP(loc + increment, 0, 63); } if (key_pressed(KEY_R) || key_pressed(KEY_L)) { int odd = param_selection_loc & 0x1; -- cgit v1.2.1