// This is a grid-based rewrite of Mald's original menu navigation system
// The original was built on switch statements, broken dreams, and zero architectural foresight
// We’re replacing it with something that doesn’t look like it was written by an outsourced chink with a proclivity for animal cum
var nav_grid = [
[0, 1, 2], // Top row. Where Mald began his descent.
[3, 4, 5], // Middle row. Peak spaghetti density.
[6, 7, 8] // Bottom row. The furry degeneracy of menu logic. Irredeemable.
];
// Step 1: Locate the selected button in this eldritch sudoku
// Because Mald never believed in state, just chaos and feelings
var row = 0;
var col = 0;
for (var i = 0; i < array_length(nav_grid); i++) {
for (var j = 0; j < array_length(nav_grid[i]); j++) {
if (nav_grid[i][j] == selected_button) {
row = i;
col = j;
}
}
}
// Step 2: Process directional input like a functioning adult
// Not with 80 lines of copy-pasted switch-case fuckery
if (global.left_key_pressed) {
col = max(0, col - 1); // Escape to the left, assuming Mald lets you
}
if (global.right_key_pressed) {
col = min(array_length(nav_grid[0]) - 1, col + 1); // March toward disappointment
}
if (global.up_key_pressed) {
row = max(0, row - 1); // Rise above your past sins, temporarily
}
if (global.down_key_pressed) {
row = min(array_length(nav_grid) - 1, row + 1); // Descend into the pit Mald left for you
// Step 3: Return to the void with your newly selected button
// It's not cleaner because you deserve it. It's cleaner because we're tired.
selected_button = nav_grid[row][col];