From 284cf7186e8b406d0e1bb082a4ef8ba56894a392 Mon Sep 17 00:00:00 2001
From: "p.kosyh"
Date: Thu, 14 Apr 2011 16:13:52 +0000
Subject: [PATCH] fix
---
src/sdl-instead/game.c | 2 +-
stead/goto.lua | 4 ++++
stead/stead.lua | 22 ++++++++++++++++++++--
3 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/src/sdl-instead/game.c b/src/sdl-instead/game.c
index 09e2944..052015f 100644
--- a/src/sdl-instead/game.c
+++ b/src/sdl-instead/game.c
@@ -3116,7 +3116,7 @@ int game_loop(void)
// game_highlight(ev.x, ev.y, 1);
}
- if (game_theme.gfx_mode != GFX_MODE_DIRECT) {
+ if (game_theme.gfx_mode != GFX_MODE_DIRECT || menu_shown) {
if (old_xref)
game_highlight(x, y, 1);
else {
diff --git a/stead/goto.lua b/stead/goto.lua
index 7470d19..fcb7fcd 100644
--- a/stead/goto.lua
+++ b/stead/goto.lua
@@ -213,6 +213,10 @@ end)
player = stead.inherit(player, function(v)
v.look = function(s)
+ if not stead.started then
+ stead.started = true
+ game:start()
+ end
if game._time == 0 then
return stead.goto(here(), false, false, true);
end
diff --git a/stead/stead.lua b/stead/stead.lua
index 8922107..de67b21 100644
--- a/stead/stead.lua
+++ b/stead/stead.lua
@@ -1561,10 +1561,11 @@ function do_ini(self, load)
stead.initialized = true
return stead.par('',v, self._lastdisp); --stead.par('^^',v);
end
+stead.do_ini = do_ini
function game_ini(self)
local v,vv
- v = do_ini(self);
+ v = stead.do_ini(self);
vv = iface:title(call(self,'nam'));
vv = stead.par('^^', vv, call(self,'dsc'));
if type(init) == 'function' then
@@ -1576,6 +1577,12 @@ function game_ini(self)
return stead.par("^^", vv, v);
end
+function game_start(s)
+ if type(start) == 'function' then
+ start() -- start function
+ end
+end
+
function game(v)
if v.nam == nil then
error ("No game name in constructor.", 2);
@@ -1586,6 +1593,9 @@ function game(v)
if v.ini == nil then
v.ini = game_ini;
end
+ if v.start == nil then
+ v.start = game_start
+ end
if v.save == nil then
v.save = game_save;
end
@@ -1789,6 +1799,8 @@ function gamefile(file, forget)
end
init = function() -- null init function
end
+ start = function() -- null start function
+ end
for_each_object(function(k, o) -- destroy all objects
if o.system_type then
return
@@ -1879,7 +1891,12 @@ function game_load(self, name)
if r then
return nil, false
end
- return do_ini(self, true);
+ i, r = stead.do_ini(self, true);
+ if not stead.started then
+ game:start()
+ stead.started = true
+ end
+ return i, r
end
return nil, false
end
@@ -2906,6 +2923,7 @@ end
stead.init = function(s)
stead.initialized = false
+ stead.started = false
stead:objects();
s.functions = {} -- code blocks
local k,v