Commit ae4c791e authored by deuce's avatar deuce
Browse files

Limit strings to 80 characters.

@DO FRONTPAD is broken... break it.
@READSPECIAL prints the selected character.
parent 96469c6d
......@@ -637,7 +637,7 @@ for (i = 0; i < 40; i++) {
vars[format('`v%02d', i+1)] = {type:'fn', get:eval('function() { return world.v['+i+'] }'), set:eval('function(val) { world.v['+i+'] = clamp_integer(val, "s32"); }')};
}
for (i = 0; i < 10; i++) {
vars[format('`s%02d', i+1)] = {type:'fn', get:eval('function() { return world.s['+i+'] }'), set:eval('function(val) { world.s['+i+'] = val; }')};
vars[format('`s%02d', i+1)] = {type:'fn', get:eval('function() { return world.s['+i+'] }'), set:eval('function(val) { world.s['+i+'] = val.substr(0, 80); }')};
}
for (i = 0; i < 99; i++) {
vars[format('`p%02d', i+1)] = {type:'fn', get:eval('function() { return player.p['+i+'] }'), set:eval('function(val) { player.p['+i+'] = clamp_integer(val, "s32"); }')};
......@@ -960,6 +960,16 @@ function displen(str)
return superclean(str).length;
}
// FRONTPAD is broken on colour codes.
// It doesn't ignore colour codes.
function broken_displen(str)
{
var i;
str = expand_ticks(replace_vars(str));
return str.length;
}
function sw(str) {
if (str === '') {
return;
......@@ -1465,7 +1475,7 @@ function run_ref(sec, fname)
ch = args[1].substr(0, 1);
} while (args[1].indexOf(ch) === -1);
setvar(args[0], ch);
sln('');
sln(ch);
},
'goto':function(args) {
// NOTE: This doesn't use getvar() because GREEN.REF has 'do goto bank'
......@@ -1597,7 +1607,7 @@ function run_ref(sec, fname)
},
'frontpad':function(args) {
var str = getvar(args[0]).toString();
var dl = displen(str);
var dl = broken_displen(str);
var l = parseInt(getvar(args[1]), 10);
str = spaces(l - dl) + str;
......
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