Commit e91d329de15b7c6e28e323366ffa869f1dff5a6a

Authored by dg
1 parent af81faee

fix


git-svn-id: http://svn.net-core.org/repos/t-engine4@3373 51575b47-30f0-44d4-a5cc-537603b46e54
... ... @@ -426,7 +426,7 @@ function _M:defineDisplayCallback()
426 426 local f_enemy = nil
427 427 local f_neutral = nil
428 428
429   - self._mo:displayCallback(function(x, y, w, h)
  429 + self._mo:displayCallback(function(x, y, w, h, zoom, on_map)
430 430 local e
431 431 for i = 1, #ps do
432 432 e = ps[i]
... ... @@ -440,33 +440,35 @@ function _M:defineDisplayCallback()
440 440 local map = game.level.map
441 441
442 442 -- Tactical life info
443   - local dh = h * 0.1
444   - core.display.drawQuad(x, y + h - dh, w, dh, 139, 210, 77, 128)
445   - core.display.drawQuad(x, y + h - dh, w * self.life / self.max_life, dh, 50, 220, 77, 255)
446   -
447   - if not f_self then
448   - f_self = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_self)
449   - f_danger = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_danger)
450   - f_friend = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_friend)
451   - f_enemy = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_enemy)
452   - f_neutral = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_neutral)
453   - end
  443 + if on_map then
  444 + local dh = h * 0.1
  445 + core.display.drawQuad(x, y + h - dh, w, dh, 139, 210, 77, 128)
  446 + core.display.drawQuad(x, y + h - dh, w * self.life / self.max_life, dh, 50, 220, 77, 255)
  447 +
  448 + if not f_self then
  449 + f_self = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_self)
  450 + f_danger = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_danger)
  451 + f_friend = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_friend)
  452 + f_enemy = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_enemy)
  453 + f_neutral = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_neutral)
  454 + end
454 455
455   - if self.faction then
456   - local friend
457   - if not map.actor_player then friend = Faction:factionReaction(map.view_faction, self.faction)
458   - else friend = map.actor_player:reactionToward(self) end
459   -
460   - if self == map.actor_player then
461   - f_self:toScreen(x, y, w, h)
462   - elseif map:faction_danger_check(self) then
463   - f_danger:toScreen(x, y, w, h)
464   - elseif friend > 0 then
465   - f_friend:toScreen(x, y, w, h)
466   - elseif friend < 0 then
467   - f_enemy:toScreen(x, y, w, h)
468   - else
469   - f_neutral:toScreen(x, y, w, h)
  456 + if self.faction then
  457 + local friend
  458 + if not map.actor_player then friend = Faction:factionReaction(map.view_faction, self.faction)
  459 + else friend = map.actor_player:reactionToward(self) end
  460 +
  461 + if self == map.actor_player then
  462 + f_self:toScreen(x, y, w, h)
  463 + elseif map:faction_danger_check(self) then
  464 + f_danger:toScreen(x, y, w, h)
  465 + elseif friend > 0 then
  466 + f_friend:toScreen(x, y, w, h)
  467 + elseif friend < 0 then
  468 + f_enemy:toScreen(x, y, w, h)
  469 + else
  470 + f_neutral:toScreen(x, y, w, h)
  471 + end
470 472 end
471 473 end
472 474 end
... ...
... ... @@ -355,7 +355,8 @@ static int map_objects_toscreen(lua_State *L)
355 355 lua_pushnumber(L, w);
356 356 lua_pushnumber(L, h);
357 357 lua_pushnumber(L, 1);
358   - if (lua_pcall(L, 5, 1, 0))
  358 + lua_pushboolean(L, FALSE);
  359 + if (lua_pcall(L, 6, 1, 0))
359 360 {
360 361 printf("Display callback error: UID %ld: %sn", m->uid, lua_tostring(L, -1));
361 362 lua_pop(L, 1);
... ... @@ -1013,7 +1014,8 @@ static int map_get_scroll(lua_State *L)
1013 1014 lua_pushnumber(L, map->tile_w * (dw) * (zoom)); \
1014 1015 lua_pushnumber(L, map->tile_h * (dh) * (zoom)); \
1015 1016 lua_pushnumber(L, (zoom)); \
1016   - if (lua_pcall(L, 5, 1, 0)) \
  1017 + lua_pushboolean(L, TRUE); \
  1018 + if (lua_pcall(L, 6, 1, 0)) \
1017 1019 { \
1018 1020 printf("Display callback error: UID %ld: %s\n", dm->uid, lua_tostring(L, -1)); \
1019 1021 lua_pop(L, 1); \
... ...