Commit 8d9090c4 authored by deuce's avatar deuce
Browse files

Fix fixes from Complete New World

Random offset can be a variable.
Now that `* is the node number use `r4`^
If game.dat doesn't exist or is zero bytes, create it.
In local mode, load FONTS/LORD2.FNT which just happens to be the same format
conio supports.  SyncTERM users should get this font for free.

lord2.js can now bootstrap Complete New World.
parent d10dcf2c
......@@ -1700,7 +1700,7 @@ function run_ref(sec, fname)
return;
}
if (args.length > 3 && args[1].toLowerCase() === 'random') {
setvar(args[0], random(clamp_integer(getvar(args[2]), 's32')) + clamp_integer(args[3], 's32'));
setvar(args[0], random(clamp_integer(getvar(args[2]), 's32')) + clamp_integer(getvar(args[3]), 's32'));
return;
}
if (args.length === 3 && args[1].toLowerCase() === 'random') {
......@@ -2213,11 +2213,12 @@ function run_ref(sec, fname)
player.i[itm.Record]++;
player.money -= itm.value;
dk.console.gotoxy(1, 23);
lw('`* ITEM BOUGHT! `%You now have ' + player.i[itm.Record] + ' of \'em. `2(`0press a key to continue`2)`r0');
// TODO: `* is node number... sometimes!
lw('`r4`^* ITEM BOUGHT! `%You now have ' + player.i[itm.Record] + ' of \'em. `2(`0press a key to continue`2)`r0');
}
else {
dk.console.gotoxy(1, 23);
lw('`* ITEM NOT BOUGHT! `%You don\'t have enough gold. `2(`0press a key to continue`2)`r0');
lw('`r4`^ ITEM NOT BOUGHT! `%You don\'t have enough gold. `2(`0press a key to continue`2)`r0');
}
getkey();
dk.console.gotoxy(0, 23);
......@@ -3902,7 +3903,12 @@ function load_time()
function load_game()
{
game = gfile.get(0);
if (gfile.length > 0)
game = gfile.get(0);
else {
game = gfile.new();
game.put();
}
}
function pick_deleted()
......@@ -3940,6 +3946,12 @@ var ufile = new RecordFile(getfname('update.tmp'), Update_Def);
var gfile = new RecordFile(getfname('game.dat'), Game_Def);
var maildir = getfname('mail');
// TODO: Actually send this font to SyncTERM too.
if (file_exists(getfname('FONTS/LORD2.FNT'))) {
if (dk.system.mode === 'local')
conio.loadfont(getfname('FONTS/LORD2.FNT'));
}
if (!file_isdir(maildir)) {
mkdir(maildir);
if (!file_isdir(maildir))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment