tricks with output in game_cmd
This commit is contained in:
parent
ba21b3af94
commit
1b1fa9f03c
|
@ -1673,7 +1673,7 @@ int game_cmd(char *cmd)
|
||||||
// if (dd)
|
// if (dd)
|
||||||
game_cursor(CURSOR_CLEAR);
|
game_cursor(CURSOR_CLEAR);
|
||||||
|
|
||||||
cmdstr = instead_cmd(cmd); instead_clear();
|
cmdstr = instead_cmd(cmd); rc = instead_bretval(1); instead_clear();
|
||||||
game_music_player();
|
game_music_player();
|
||||||
game_sound_player();
|
game_sound_player();
|
||||||
|
|
||||||
|
@ -1691,8 +1691,10 @@ int game_cmd(char *cmd)
|
||||||
if (!cmdstr) {
|
if (!cmdstr) {
|
||||||
if (game_pict_modify(NULL)) /* redraw pic only */
|
if (game_pict_modify(NULL)) /* redraw pic only */
|
||||||
game_redraw_pic();
|
game_redraw_pic();
|
||||||
rc = 1; /* nothing happens */
|
rc = (rc)?0:1; /* nothing happens? */
|
||||||
goto inv; /* hackish? ok, yes it is... */
|
if (!rc)
|
||||||
|
goto inv; /* hackish? ok, yes it is... */
|
||||||
|
goto err; /* really nothing to do */
|
||||||
}
|
}
|
||||||
|
|
||||||
fading = check_fading();
|
fading = check_fading();
|
||||||
|
@ -2262,7 +2264,6 @@ int game_click(int x, int y, int action, int filter)
|
||||||
snd_play(game_theme.click, -1, 0);
|
snd_play(game_theme.click, -1, 0);
|
||||||
game_cmd(buf);
|
game_cmd(buf);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menu_mode || go_mode || elem->id == el_title)
|
if (menu_mode || go_mode || elem->id == el_title)
|
||||||
|
|
|
@ -51,9 +51,6 @@ function(f, s, cmd, x, y, px, py, ...)
|
||||||
elseif s.click then
|
elseif s.click then
|
||||||
r,v = call(s, 'click', tonumber(x), tonumber(y), x2, y2, ...);
|
r,v = call(s, 'click', tonumber(x), tonumber(y), x2, y2, ...);
|
||||||
end
|
end
|
||||||
if r == nil and v == nil then
|
|
||||||
return nil, true
|
|
||||||
end
|
|
||||||
return r,v
|
return r,v
|
||||||
end
|
end
|
||||||
return f(s, cmd, x, y, px, py, ...)
|
return f(s, cmd, x, y, px, py, ...)
|
||||||
|
|
|
@ -198,9 +198,6 @@ game.action = stead.hook(game.action, function (f, s, cmd, ...)
|
||||||
elseif s.inp_enter then
|
elseif s.inp_enter then
|
||||||
r,v = call(s, 'inp_enter');
|
r,v = call(s, 'inp_enter');
|
||||||
end
|
end
|
||||||
-- if r == nil and v == nil then
|
|
||||||
-- return nil, true
|
|
||||||
-- end
|
|
||||||
return r,v -- nothing todo
|
return r,v -- nothing todo
|
||||||
end
|
end
|
||||||
return f(s, cmd, ...)
|
return f(s, cmd, ...)
|
||||||
|
|
|
@ -8,9 +8,6 @@ game.action = stead.hook(game.action, function(f, s, cmd, ...)
|
||||||
r,v = call(s, 'kbd',
|
r,v = call(s, 'kbd',
|
||||||
input.key_event.down, input.key_event.key);
|
input.key_event.down, input.key_event.key);
|
||||||
end
|
end
|
||||||
if r == nil and v == nil then
|
|
||||||
return nil, true-- nothing to do
|
|
||||||
end
|
|
||||||
return r,v
|
return r,v
|
||||||
end
|
end
|
||||||
return f(s, cmd, ...);
|
return f(s, cmd, ...);
|
||||||
|
|
|
@ -2083,11 +2083,11 @@ iface = {
|
||||||
if v ~= false and game.showlast then
|
if v ~= false and game.showlast then
|
||||||
return r;
|
return r;
|
||||||
end
|
end
|
||||||
elseif cmd == 'wait' then
|
elseif cmd == 'wait' then -- nothing todo in game, skip tick
|
||||||
v = nil;
|
v = nil;
|
||||||
r = nil;
|
r = true;
|
||||||
stead.state = true
|
stead.state = true
|
||||||
elseif cmd == 'nop' then
|
elseif cmd == 'nop' then -- inv only
|
||||||
v = true;
|
v = true;
|
||||||
r = nil;
|
r = nil;
|
||||||
stead.state = true
|
stead.state = true
|
||||||
|
@ -2098,8 +2098,13 @@ iface = {
|
||||||
-- here r is action result, v - ret code value
|
-- here r is action result, v - ret code value
|
||||||
-- state -- game state changed
|
-- state -- game state changed
|
||||||
if stead.state and r == nil and v == true then -- we do nothing
|
if stead.state and r == nil and v == true then -- we do nothing
|
||||||
return nil;
|
return nil, true; -- menu
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if stead.state and r == nil and v == nil then
|
||||||
|
return nil, nil -- really nothing
|
||||||
|
end
|
||||||
|
|
||||||
if RAW_TEXT then
|
if RAW_TEXT then
|
||||||
v = false
|
v = false
|
||||||
end
|
end
|
||||||
|
@ -2128,7 +2133,7 @@ iface = {
|
||||||
if vv == nil then -- nil is error
|
if vv == nil then -- nil is error
|
||||||
return ''
|
return ''
|
||||||
end
|
end
|
||||||
return vv;
|
return vv, true; -- action is here
|
||||||
end,
|
end,
|
||||||
shell = function(self)
|
shell = function(self)
|
||||||
local inp, i, k, cmd, a, n;
|
local inp, i, k, cmd, a, n;
|
||||||
|
|
|
@ -6,9 +6,6 @@ game.action = stead.hook(game.action, function(f, s, cmd, ...)
|
||||||
elseif s.timer then
|
elseif s.timer then
|
||||||
r,v = call(s, 'timer');
|
r,v = call(s, 'timer');
|
||||||
end
|
end
|
||||||
if r == nil and v == nil then
|
|
||||||
return nil, true
|
|
||||||
end
|
|
||||||
return r,v
|
return r,v
|
||||||
end
|
end
|
||||||
return f(s, cmd, ...);
|
return f(s, cmd, ...);
|
||||||
|
|
Loading…
Reference in a new issue