From 1fd566931eaf9c7c5a502c36725419172dd15404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net> Date: Sat, 27 Feb 2021 19:49:36 -0500 Subject: [PATCH] Add HOME/END support where cursor keys are supported. This provides a way to create muscle memory for random fights... HOME will always take you to 'Attack' and END will always take you to 'Run Away' now. Two birds with one stone, yay! --- xtrn/lord2/lord2.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/xtrn/lord2/lord2.js b/xtrn/lord2/lord2.js index 646ccc144c..6accd2f705 100644 --- a/xtrn/lord2/lord2.js +++ b/xtrn/lord2/lord2.js @@ -1538,6 +1538,8 @@ function yes_no(y, title, question) { case 'KEY_DOWN': case '6': case 'KEY_RIGHT': + case 'KEY_END': + case 'KEY_HOME': ret = !ret; dk.console.gotoxy(box.x + 3, box.y + 4); if (ret) @@ -3865,6 +3867,12 @@ function hbar(x, y, opts, cur) ch = getkey(); switch(ch) { + case 'KEY_HOME': + cur = 0; + break; + case 'KEY_END': + cur = opts.length - 1; + break; case '8': case 'KEY_UP': case '4': @@ -4241,6 +4249,9 @@ function vbar(choices, args) return ret; } switch(ch) { + case 'KEY_HOME': + ret.cur = 0; + break; case '8': case 'KEY_UP': case '4': @@ -4271,6 +4282,9 @@ function vbar(choices, args) ret.cur = 0; } break; + case 'KEY_END': + ret.cur = choices.length - 1; + break; case '\r': movetoend(); return ret; @@ -4850,6 +4864,17 @@ function hail() if ((cur % 9) < 6) cur += 3; break; + case 'KEY_HOME': + cur = 0; + if (page != 0) + erase_menu(); + page = 0; + break; + case 'KEY_END': + cur = pl.length - 1; + if (page != pages - 1) + erase_menu(); + page = pages - 1; case '\r': break; } -- GitLab