modules/world: work around Y invertion in the camera system

This commit is contained in:
Kazhnuz 2019-05-02 18:46:44 +02:00
parent b69ad095ee
commit 56a269dd57

View file

@ -56,11 +56,11 @@ function CameraSystem:initViews()
if (self.verticalSplit) then if (self.verticalSplit) then
self.views.posList.dual[1] = {} self.views.posList.dual[1] = {}
self.views.posList.dual[1].x = 0 self.views.posList.dual[1].x = 0
self.views.posList.dual[1].y = -(self.views.baseheight/4) self.views.posList.dual[1].y = (self.views.baseheight/4)
self.views.posList.dual[2] = {} self.views.posList.dual[2] = {}
self.views.posList.dual[2].x = 0 self.views.posList.dual[2].x = 0
self.views.posList.dual[2].y = (self.views.baseheight/4) self.views.posList.dual[2].y = -(self.views.baseheight/4)
else else
self.views.posList.dual[1] = {} self.views.posList.dual[1] = {}
self.views.posList.dual[1].x = -(self.views.basewidth/4) self.views.posList.dual[1].x = -(self.views.basewidth/4)
@ -73,19 +73,19 @@ function CameraSystem:initViews()
self.views.posList.multi[1] = {} self.views.posList.multi[1] = {}
self.views.posList.multi[1].x = -(self.views.basewidth /4) self.views.posList.multi[1].x = -(self.views.basewidth /4)
self.views.posList.multi[1].y = -(self.views.baseheight/4) self.views.posList.multi[1].y = (self.views.baseheight/4)
self.views.posList.multi[2] = {} self.views.posList.multi[2] = {}
self.views.posList.multi[2].x = (self.views.basewidth /4) self.views.posList.multi[2].x = (self.views.basewidth /4)
self.views.posList.multi[2].y = -(self.views.baseheight/4) self.views.posList.multi[2].y = (self.views.baseheight/4)
self.views.posList.multi[3] = {} self.views.posList.multi[3] = {}
self.views.posList.multi[3].x = -(self.views.basewidth /4) self.views.posList.multi[3].x = -(self.views.basewidth /4)
self.views.posList.multi[3].y = (self.views.baseheight/4) self.views.posList.multi[3].y = -(self.views.baseheight/4)
self.views.posList.multi[4] = {} self.views.posList.multi[4] = {}
self.views.posList.multi[4].x = (self.views.basewidth /4) self.views.posList.multi[4].x = (self.views.basewidth /4)
self.views.posList.multi[4].y = (self.views.baseheight/4) self.views.posList.multi[4].y = -(self.views.baseheight/4)
end end
-- INFO FUNCTIONS -- INFO FUNCTIONS
@ -134,7 +134,7 @@ function CameraSystem:getViewPositions(id)
if (viewNumber == 2) and (id == 1) or (id == 2) then if (viewNumber == 2) and (id == 1) or (id == 2) then
return self.views.posList.dual[id].x, self.views.posList.dual[id].y return self.views.posList.dual[id].x, self.views.posList.dual[id].y
elseif (viewNumber > 2) and ((id >= 1) or (id <= 4)) then elseif (viewNumber > 2) then
return self.views.posList.multi[id].x, self.views.posList.multi[id].y return self.views.posList.multi[id].x, self.views.posList.multi[id].y
end end
@ -287,7 +287,11 @@ function CameraSystem:computeCamPosition(id)
local realy = self.views.list[id].pos.y local realy = self.views.list[id].pos.y
self.views.list[id].cam.x = realx - decalx self.views.list[id].cam.x = realx - decalx
self.views.list[id].cam.y = realy - decaly self.views.list[id].cam.y = realy + decaly
-- FIXME: this workaround certainly will cause some problem but that's the only
-- solution we seem to have right now
-- We invert the y decalage for the camera in order to work around a problem
-- that invert the y between it and the clipping.
end end
function CameraSystem:followActor(id) function CameraSystem:followActor(id)