From e91d329de15b7c6e28e323366ffa869f1dff5a6a Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Sun, 15 May 2011 15:26:59 +0000 Subject: [PATCH] fix git-svn-id: http://svn.net-core.org/repos/t-engine4@3373 51575b47-30f0-44d4-a5cc-537603b46e54 --- game/modules/tome/class/Actor.lua | 56 ++++++++++++++++--------------- src/map.c | 6 ++-- 2 files changed, 33 insertions(+), 29 deletions(-) diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index 5e97a378af..731451b8d0 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -426,7 +426,7 @@ function _M:defineDisplayCallback() local f_enemy = nil local f_neutral = nil - self._mo:displayCallback(function(x, y, w, h) + self._mo:displayCallback(function(x, y, w, h, zoom, on_map) local e for i = 1, #ps do e = ps[i] @@ -440,33 +440,35 @@ function _M:defineDisplayCallback() local map = game.level.map -- Tactical life info - local dh = h * 0.1 - core.display.drawQuad(x, y + h - dh, w, dh, 139, 210, 77, 128) - core.display.drawQuad(x, y + h - dh, w * self.life / self.max_life, dh, 50, 220, 77, 255) - - if not f_self then - f_self = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_self) - f_danger = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_danger) - f_friend = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_friend) - f_enemy = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_enemy) - f_neutral = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_neutral) - end + if on_map then + local dh = h * 0.1 + core.display.drawQuad(x, y + h - dh, w, dh, 139, 210, 77, 128) + core.display.drawQuad(x, y + h - dh, w * self.life / self.max_life, dh, 50, 220, 77, 255) + + if not f_self then + f_self = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_self) + f_danger = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_danger) + f_friend = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_friend) + f_enemy = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_enemy) + f_neutral = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_neutral) + end - if self.faction then - local friend - if not map.actor_player then friend = Faction:factionReaction(map.view_faction, self.faction) - else friend = map.actor_player:reactionToward(self) end - - if self == map.actor_player then - f_self:toScreen(x, y, w, h) - elseif map:faction_danger_check(self) then - f_danger:toScreen(x, y, w, h) - elseif friend > 0 then - f_friend:toScreen(x, y, w, h) - elseif friend < 0 then - f_enemy:toScreen(x, y, w, h) - else - f_neutral:toScreen(x, y, w, h) + if self.faction then + local friend + if not map.actor_player then friend = Faction:factionReaction(map.view_faction, self.faction) + else friend = map.actor_player:reactionToward(self) end + + if self == map.actor_player then + f_self:toScreen(x, y, w, h) + elseif map:faction_danger_check(self) then + f_danger:toScreen(x, y, w, h) + elseif friend > 0 then + f_friend:toScreen(x, y, w, h) + elseif friend < 0 then + f_enemy:toScreen(x, y, w, h) + else + f_neutral:toScreen(x, y, w, h) + end end end end diff --git a/src/map.c b/src/map.c index 961241bee7..f124e7fe53 100644 --- a/src/map.c +++ b/src/map.c @@ -355,7 +355,8 @@ static int map_objects_toscreen(lua_State *L) lua_pushnumber(L, w); lua_pushnumber(L, h); lua_pushnumber(L, 1); - if (lua_pcall(L, 5, 1, 0)) + lua_pushboolean(L, FALSE); + if (lua_pcall(L, 6, 1, 0)) { printf("Display callback error: UID %ld: %sn", m->uid, lua_tostring(L, -1)); lua_pop(L, 1); @@ -1013,7 +1014,8 @@ static int map_get_scroll(lua_State *L) lua_pushnumber(L, map->tile_w * (dw) * (zoom)); \ lua_pushnumber(L, map->tile_h * (dh) * (zoom)); \ lua_pushnumber(L, (zoom)); \ - if (lua_pcall(L, 5, 1, 0)) \ + lua_pushboolean(L, TRUE); \ + if (lua_pcall(L, 6, 1, 0)) \ { \ printf("Display callback error: UID %ld: %s\n", dm->uid, lua_tostring(L, -1)); \ lua_pop(L, 1); \ -- GitLab