para fix, new goto cleanups
This commit is contained in:
parent
c8e91c66a6
commit
f2333e2d8f
|
@ -82,13 +82,32 @@ go = function (self, where, back)
|
||||||
stead.in_entered_call = false
|
stead.in_entered_call = false
|
||||||
res = par('^^',res,v);
|
res = par('^^',res,v);
|
||||||
end
|
end
|
||||||
|
PLAYER_MOVED = true
|
||||||
if need_scene then -- or isForcedsc(ref(where)) then -- i'am not sure...
|
if need_scene then -- or isForcedsc(ref(where)) then -- i'am not sure...
|
||||||
return par('^^',res,ref(where):scene());
|
NEED_SCENE = true
|
||||||
|
-- return par('^^',res,ref(where):scene());
|
||||||
end
|
end
|
||||||
return res;
|
return res;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
iface.fmt = function(self, cmd, st, moved, r, av, objs, pv) -- st -- changed state (main win), move -- loc changed
|
||||||
|
local l
|
||||||
|
if st then
|
||||||
|
av = txtem(av);
|
||||||
|
pv = txtem(pv);
|
||||||
|
r = txtem(r)
|
||||||
|
if isForcedsc(here()) or NEED_SCENE then
|
||||||
|
l = here():scene();
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if moved then
|
||||||
|
vv = stead.fmt(stead.cat(stead.par("^^", r, av, l, objs, pv), '^'));
|
||||||
|
else
|
||||||
|
vv = stead.fmt(stead.cat(stead.par("^^", l, r, av, objs, pv), '^'));
|
||||||
|
end
|
||||||
|
return vv
|
||||||
|
end
|
||||||
|
|
||||||
go = hook(go, function(f, ...)
|
go = hook(go, function(f, ...)
|
||||||
local r,v = f(unpack(arg))
|
local r,v = f(unpack(arg))
|
||||||
if type(r) == 'string' and cctx() then
|
if type(r) == 'string' and cctx() then
|
||||||
|
@ -99,3 +118,17 @@ go = hook(go, function(f, ...)
|
||||||
end
|
end
|
||||||
return r,v
|
return r,v
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
iface.cmd = hook(iface.cmd, function(f, ...)
|
||||||
|
NEED_SCENE = nil
|
||||||
|
return f(unpack(arg))
|
||||||
|
end)
|
||||||
|
|
||||||
|
player = inherit(player, function(v)
|
||||||
|
v.look = function(s)
|
||||||
|
NEED_SCENE = true
|
||||||
|
end
|
||||||
|
return v
|
||||||
|
end)
|
||||||
|
|
||||||
|
pl = player(pl) -- reinit
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
stead.fmt = hook(stead.fmt, function(f, ...)
|
stead.fmt = hook(stead.fmt, function(f, ...)
|
||||||
local r = f(unpack(arg))
|
local r = f(unpack(arg))
|
||||||
if type(r) == 'string' then
|
if type(r) == 'string' then
|
||||||
r = r:gsub('~', txtnb(' '));
|
r = r:gsub('~[ \t]*([^ \t]+)', txtnb(' %1'));
|
||||||
end
|
end
|
||||||
return r;
|
return r;
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -1170,7 +1170,7 @@ function go(self, where, back)
|
||||||
stead.in_entered_call = false
|
stead.in_entered_call = false
|
||||||
res = stead.par('^^',res,v);
|
res = stead.par('^^',res,v);
|
||||||
end
|
end
|
||||||
|
PLAYER_MOVED = true
|
||||||
if need_scene then -- or isForcedsc(ref(where)) then -- i'am not sure...
|
if need_scene then -- or isForcedsc(ref(where)) then -- i'am not sure...
|
||||||
return stead.par('^^',res,ref(where):scene());
|
return stead.par('^^',res,ref(where):scene());
|
||||||
end
|
end
|
||||||
|
@ -1715,7 +1715,8 @@ iface = {
|
||||||
local st = false; -- changed state (main screen)
|
local st = false; -- changed state (main screen)
|
||||||
local a = { };
|
local a = { };
|
||||||
local cmd;
|
local cmd;
|
||||||
|
RAW_TEXT = nil
|
||||||
|
PLAYER_MOVED = nil
|
||||||
cmd,a = stead.getcmd(inp);
|
cmd,a = stead.getcmd(inp);
|
||||||
-- me():tag();
|
-- me():tag();
|
||||||
local oldloc = here();
|
local oldloc = here();
|
||||||
|
@ -1766,14 +1767,13 @@ iface = {
|
||||||
end
|
end
|
||||||
|
|
||||||
if RAW_TEXT then
|
if RAW_TEXT then
|
||||||
RAW_TEXT = nil
|
|
||||||
v = false
|
v = false
|
||||||
end
|
end
|
||||||
|
|
||||||
if v == false then
|
if v == false then
|
||||||
return stead.cat(r, '\n'), false;
|
return stead.cat(r, '\n'), false;
|
||||||
end
|
end
|
||||||
|
|
||||||
ACTION_TEXT = r; -- here, life methods can redefine this
|
ACTION_TEXT = r; -- here, life methods can redefine this
|
||||||
|
|
||||||
local av, pv -- av -- active lifes, pv -- background
|
local av, pv -- av -- active lifes, pv -- background
|
||||||
|
@ -1785,7 +1785,8 @@ iface = {
|
||||||
vv = here():look();
|
vv = here():look();
|
||||||
end
|
end
|
||||||
|
|
||||||
vv = self:fmt(cmd, st, oldloc ~= here(), ACTION_TEXT, av, vv, pv);
|
vv = self:fmt(cmd, st, (oldloc ~= here()) or PLAYER_MOVED,
|
||||||
|
ACTION_TEXT, av, vv, pv);
|
||||||
|
|
||||||
if st then
|
if st then
|
||||||
game._lastdisp = vv
|
game._lastdisp = vv
|
||||||
|
|
Loading…
Reference in a new issue