summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-05-10 16:57:38 +0200
committerBad Diode <bd@badd10de.dev>2021-05-10 16:57:38 +0200
commitd998dbb87c940030ba7a65143864f816b26a3b37 (patch)
tree7a37350cb583cf5fd5f0429a032cf6dd1c4dfe14
parentc3bf09e440a479e027d06a062379a5c57ce69656 (diff)
downloadgba-experiments-d998dbb87c940030ba7a65143864f816b26a3b37.tar.gz
gba-experiments-d998dbb87c940030ba7a65143864f816b26a3b37.zip
Adjust UI control for wave channel parameters
-rw-r--r--src/sequencer.c58
1 files 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) {
1088 1088
1089 // Update parameter selection. 1089 // Update parameter selection.
1090 { 1090 {
1091 int x = SEQ_CH3_PARAM_SEL_X + param_selection_loc * 4; 1091 u8 x_positions[] = {
1092 int y = SEQ_CH3_PARAM_SEL_Y; 1092 0, 4, 8, 12, 16, 20, 24, 28,
1093 36, 40, 44, 48, 52, 56, 60, 64,
1094 0, 4, 8, 12, 16, 20, 24, 28,
1095 36, 40, 44, 48, 52, 56, 60, 64,
1096 76, 80, 84, 88, 92, 96, 100, 104,
1097 112, 116, 120, 124, 128, 132, 136, 140,
1098 76, 80, 84, 88, 92, 96, 100, 104,
1099 112, 116, 120, 124, 128, 132, 136, 140,
1100 };
1101 u8 y_positions[] = {
1102 0, 0, 0, 0, 0, 0, 0, 0,
1103 0, 0, 0, 0, 0, 0, 0, 0,
1104 8, 8, 8, 8, 8, 8, 8, 8,
1105 8, 8, 8, 8, 8, 8, 8, 8,
1106 0, 0, 0, 0, 0, 0, 0, 0,
1107 0, 0, 0, 0, 0, 0, 0, 0,
1108 8, 8, 8, 8, 8, 8, 8, 8,
1109 8, 8, 8, 8, 8, 8, 8, 8,
1110 };
1111 int x = SEQ_CH3_PARAM_SEL_X + x_positions[param_selection_loc];
1112 int y = SEQ_CH3_PARAM_SEL_Y + y_positions[param_selection_loc];
1093 int base_tile = seq_sprites[57].base_tile; 1113 int base_tile = seq_sprites[57].base_tile;
1094 int hidden = 0; 1114 int hidden = 0;
1095 if (current_selection != SEQ_SELECT_PARAMETER) { 1115 if (current_selection != SEQ_SELECT_PARAMETER) {
@@ -1256,11 +1276,37 @@ handle_sequencer_input(void) {
1256 } 1276 }
1257 } 1277 }
1258 } else if (channel_selection_loc == 2) { 1278 } else if (channel_selection_loc == 2) {
1259 if (key_pressed(KEY_LEFT)) { 1279 if (key_pressed(KEY_LEFT) || key_pressed(KEY_RIGHT)) {
1260 param_selection_loc = MAX(param_selection_loc - 1, 0); 1280 int increment = 0;
1281 int loc = param_selection_loc;
1282 if (key_pressed(KEY_RIGHT)) {
1283 if (loc == 15 || loc == 32) {
1284 increment = 17;
1285 } else if (loc != 47){
1286 increment = 1;
1287 }
1288 } else {
1289 if (loc == 32 || loc == 48) {
1290 increment = -17;
1291 } else if (loc != 16){
1292 increment = -1;
1293 }
1294 }
1295 param_selection_loc = CLAMP(loc + increment, 0, 63);
1261 } 1296 }
1262 if (key_pressed(KEY_RIGHT)) { 1297 if (key_pressed(KEY_UP) || key_pressed(KEY_DOWN)) {
1263 param_selection_loc = MIN(param_selection_loc + 1, 64); 1298 int increment = 0;
1299 int loc = param_selection_loc;
1300 if (key_pressed(KEY_UP)) {
1301 if ((loc >= 16 && loc < 32) || (loc >= 48)) {
1302 increment = -16;
1303 }
1304 } else {
1305 if (loc < 16 || (loc >= 32 && loc < 48)) {
1306 increment = 16;
1307 }
1308 }
1309 param_selection_loc = CLAMP(loc + increment, 0, 63);
1264 } 1310 }
1265 if (key_pressed(KEY_R) || key_pressed(KEY_L)) { 1311 if (key_pressed(KEY_R) || key_pressed(KEY_L)) {
1266 int odd = param_selection_loc & 0x1; 1312 int odd = param_selection_loc & 0x1;