From c7e2f2dacab267f5f99d85c6b252b02fd310239a Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sun, 14 Jul 2019 18:51:00 +0200 Subject: [PATCH] fix(baseworld): draw all map layer instead of using map:draw() It allow us to use the exact same transform for map and actors --- gamecore/modules/world/baseworld.lua | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/gamecore/modules/world/baseworld.lua b/gamecore/modules/world/baseworld.lua index 35f7529..1636854 100644 --- a/gamecore/modules/world/baseworld.lua +++ b/gamecore/modules/world/baseworld.lua @@ -432,8 +432,8 @@ function BaseWorld:draw(dt) else for i=1, camNumber do self.cameras:setScissor(i) - self:drawMap(i) self.cameras:attachView(i) + self:drawMap(i) self:drawActors(i) self.cameras:detachView(i) self.cameras:drawHUD(i) @@ -451,21 +451,12 @@ function BaseWorld:drawActors(id) end function BaseWorld:drawMap(id) - local tx, ty, scale = 0, 0, 1 - if id ~= nil then - -- Du à la manière dont fonctionne STI, on est obligé de récupérer les info - -- de position de camera pour afficher la carte par rapport à ces infos - tx, ty = self.cameras:getInternalCamCoordinate(id) - scale = self.cameras:getViewScale(id) or 2 - local vx, vy = self.cameras:getOnScreenViewRelativePosition(id) - tx = math.floor(tx - math.abs(vx)) - ty = math.floor(ty - math.abs(vy)) - - local w, h = core.screen:getDimensions() - end - if self.haveMap then - self.map:draw(-tx, -ty, scale, scale) + for _, layer in ipairs(self.map.layers) do + if layer.visible and layer.opacity > 0 then + self.map:drawLayer(layer) + end + end end end