Skip to content
Snippets Groups Projects
Commit b83d652d authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Yet more CNW fixes... this appears to be good all the way to Greentree now.

- saybar needs to leave cursor at 78,20 for BETTER.REF and
  TALQUIZ.REF
- buymanager and sellmanager start on the current line, not a
  hard-coded one
- buymanager and sellmanager need to clean their area on return
- handle do handlers in if before checking for begin (assuming do).
  Fixes issue in GIVE.REF where "then goto begin" was interpreted
  as "then do begin".
- "Fix" more prompt in @key to not center and always display
  "  <MORE>" as the prompt.  A number of things use @key after @saybar
parent 84319500
No related branches found
No related tags found
No related merge requests found
...@@ -1798,6 +1798,8 @@ function run_ref(sec, fname) ...@@ -1798,6 +1798,8 @@ function run_ref(sec, fname)
if (line >= files[fname].lines.length) if (line >= files[fname].lines.length)
throw new Error('Trailing saybar at '+fname+':'+line); throw new Error('Trailing saybar at '+fname+':'+line);
update_bar(files[fname].lines[line], true, 5); update_bar(files[fname].lines[line], true, 5);
// Required (at least) by the BEGGER.REF and TALQUIZ.REF.
dk.console.gotoxy(78, 20);
}, },
'statbar':function(args) { 'statbar':function(args) {
status_bar(); status_bar();
...@@ -1952,11 +1954,12 @@ function run_ref(sec, fname) ...@@ -1952,11 +1954,12 @@ function run_ref(sec, fname)
var cur = 0; var cur = 0;
var ch; var ch;
var choice; var choice;
var y = scr.pos.y;
for (i = 0; i < itms.length; i++) for (i = 0; i < itms.length; i++)
itms[i] = parseInt(itms[i], 10); itms[i] = parseInt(itms[i], 10);
// Don't clear the screen first? Interesting... // Don't clear the screen first? Interesting...
dk.console.gotoxy(0, 9); dk.console.gotoxy(0, y);
lw('`r5`% Item To Buy Price '); lw('`r5`% Item To Buy Price ');
dk.console.gotoxy(0, 23); dk.console.gotoxy(0, 23);
lw('`r5 '); lw('`r5 ');
...@@ -1972,7 +1975,7 @@ function run_ref(sec, fname) ...@@ -1972,7 +1975,7 @@ function run_ref(sec, fname)
} }
while(1) { while(1) {
choice = items_menu(itms, cur, true, false, '', 10, 22) choice = items_menu(itms, cur, true, false, '', y+1, 22)
cur = choice.cur; cur = choice.cur;
switch(choice.ch) { switch(choice.ch) {
case 'Q': case 'Q':
...@@ -2000,6 +2003,7 @@ function run_ref(sec, fname) ...@@ -2000,6 +2003,7 @@ function run_ref(sec, fname)
break; break;
} }
} }
clearrows(y, 23);
draw_map(); draw_map();
}, },
'checkmail':function(args) { 'checkmail':function(args) {
...@@ -2245,14 +2249,14 @@ function run_ref(sec, fname) ...@@ -2245,14 +2249,14 @@ function run_ref(sec, fname)
} }
return; return;
} }
if (args.length == 2 && args[1].toLowerCase() === 'begin') {
line++;
return;
}
if (do_handlers[args[0].toLowerCase()] !== undefined) { if (do_handlers[args[0].toLowerCase()] !== undefined) {
do_handlers[args[0].toLowerCase()](args.slice(1)); do_handlers[args[0].toLowerCase()](args.slice(1));
return; return;
} }
if (args.length == 2 && args[1].toLowerCase() === 'begin') {
line++;
return;
}
if (args.length > 2 && (args[1].toLowerCase() === 'is' || args[1] === '=')) { if (args.length > 2 && (args[1].toLowerCase() === 'is' || args[1] === '=')) {
if (args[2].toLowerCase() === 'length') { if (args[2].toLowerCase() === 'length') {
tmp = getvar(args[3]); tmp = getvar(args[3]);
...@@ -2486,14 +2490,19 @@ function run_ref(sec, fname) ...@@ -2486,14 +2490,19 @@ function run_ref(sec, fname)
// Any other argument is the same as no argument... CNW reset.ref uses '@key noshow' // Any other argument is the same as no argument... CNW reset.ref uses '@key noshow'
default: default:
//throw new Error('Unhandled key arg "'+args[0]+'" at '+fname+':'+line); //throw new Error('Unhandled key arg "'+args[0]+'" at '+fname+':'+line);
lw('\r'); // No, this would be the sane thing to do... don't do it.
//lw('\r');
break; break;
} }
} }
else else {
lw('\r'); // No, this would be the sane thing to do... don't do it.
//lw('\r');
}
dk.console.cleareol(); dk.console.cleareol();
lw(spaces(40-(displen(morestr)/2))+morestr); // NOTE: This doesn't actually use the "More" prompt that you can override... and it's not centred like the docs claim.
//lw(spaces(40-(displen(morestr)/2))+morestr);
lw(' `2<`0MORE`2>');
getkey(); getkey();
lw('\r'); lw('\r');
dk.console.cleareol(); dk.console.cleareol();
...@@ -2662,8 +2671,9 @@ function run_ref(sec, fname) ...@@ -2662,8 +2671,9 @@ function run_ref(sec, fname)
var ch; var ch;
var choice; var choice;
var box; var box;
var y = scr.pos.y;
dk.console.gotoxy(0, 6); dk.console.gotoxy(0, y);
lw('`r5`% Item To Sell Amount Owned `r0'); lw('`r5`% Item To Sell Amount Owned `r0');
dk.console.gotoxy(0, 23); dk.console.gotoxy(0, 23);
lw('`r5 `$Q `2to quit, `$ENTER `2to sell item. `r0'); lw('`r5 `$Q `2to quit, `$ENTER `2to sell item. `r0');
...@@ -2686,7 +2696,7 @@ rescan: ...@@ -2686,7 +2696,7 @@ rescan:
cur = 0; cur = 0;
while(1) { while(1) {
choice = items_menu(inv, cur, false, true, '', 7, 22); choice = items_menu(inv, cur, false, true, '', y + 1, 22);
cur = choice.cur; cur = choice.cur;
switch(choice.ch) { switch(choice.ch) {
case 'Q': case 'Q':
...@@ -2728,6 +2738,7 @@ rescan: ...@@ -2728,6 +2738,7 @@ rescan:
} }
draw_map(); draw_map();
} }
clearrows(y, 23);
}, },
'shell':function(args) { 'shell':function(args) {
// TODO? I mean... likely not. // TODO? I mean... likely not.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment