- [NEW] Redimensionades les habitacions per a ocupar tota la pantalla
- [FIX] Ajustada posició inici segons nou tamany de habitacions - [FIX] Ajustat nivell de l'aigua segons nou tamany de habitacions - [WIP] Treballant en el nou menú
This commit is contained in:
@@ -14,28 +14,48 @@ rooms = {
|
||||
surf_items = nil,
|
||||
surf_original_items = nil,
|
||||
visibility = LAYER_ALL,
|
||||
pos = {x=0, y=4*12},
|
||||
pos = {x=0, y=4*13},
|
||||
|
||||
current = function()
|
||||
return (rooms.pos.x//20) + (rooms.pos.y//12) * 8
|
||||
return (rooms.pos.x//20) + (rooms.pos.y//13) * 8
|
||||
end,
|
||||
|
||||
convert = function(src)
|
||||
local dst = surf.new(20*8,13*8)
|
||||
surf.source(src)
|
||||
surf.target(dst)
|
||||
|
||||
for ry=0,7 do
|
||||
for rx=0,7 do
|
||||
for ty=0,11 do
|
||||
for tx=0,19 do
|
||||
surf.pixel(rx*20+tx, ry*13+ty, surf.pixel(rx*20+tx, ry*12+ty))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return dst
|
||||
end,
|
||||
|
||||
reload = function()
|
||||
if rooms.surf_background ~= nil then surf.free(rooms.surf_background) end
|
||||
rooms.surf_background = surf.load("rooms_background"..ROOM_FILE_EXT)
|
||||
--rooms.surf_background = surf.new(20*8,12*8)
|
||||
--rooms.surf_background = surf.new(20*8,13*8)
|
||||
--rooms.surf_background = rooms.convert(surf.load("rooms_background"..ROOM_FILE_EXT))
|
||||
|
||||
if rooms.surf_foreground ~= nil then surf.free(rooms.surf_foreground) end
|
||||
rooms.surf_foreground = surf.load("rooms_foreground"..ROOM_FILE_EXT)
|
||||
--rooms.surf_foreground = surf.new(20*8,12*8)
|
||||
--rooms.surf_foreground = rooms.convert(surf.load("rooms_foreground"..ROOM_FILE_EXT))
|
||||
|
||||
if rooms.surf_items ~= nil then surf.free(rooms.surf_items) end
|
||||
rooms.surf_items = surf.load("rooms_items"..ROOM_FILE_EXT)
|
||||
--rooms.surf_items = surf.new(20*8,12*8)
|
||||
--rooms.surf_items = rooms.convert(surf.load("rooms_items"..ROOM_FILE_EXT))
|
||||
end,
|
||||
|
||||
init = function()
|
||||
rooms.pos.x, rooms.pos.y = 0,4*12
|
||||
rooms.pos.x, rooms.pos.y = 0,4*13
|
||||
rooms.reload()
|
||||
sprites.init()
|
||||
end,
|
||||
@@ -50,15 +70,15 @@ rooms = {
|
||||
end,
|
||||
|
||||
is_outside = function(x, y)
|
||||
return x < rooms.pos.x or y < rooms.pos.y or x > rooms.pos.x + 20 or y > rooms.pos.y + 12
|
||||
return x < rooms.pos.x or y < rooms.pos.y or x > rooms.pos.x + 20 or y > rooms.pos.y + 13
|
||||
end,
|
||||
|
||||
draw = function()
|
||||
-- Retallem la pantalla a la zona de joc
|
||||
view.clip(0,8,160,96)
|
||||
--view.clip(0,8,160,96)
|
||||
|
||||
-- Movem la càmara a l'habitació on estem
|
||||
view.origin(-rooms.pos.x*8,-rooms.pos.y*8+8)
|
||||
view.origin(-rooms.pos.x*8,-rooms.pos.y*8)
|
||||
|
||||
-- Pintem el background
|
||||
surf.source(surf_tiles)
|
||||
@@ -70,7 +90,7 @@ rooms = {
|
||||
end
|
||||
|
||||
-- Movem 4x4 pixels la càmara per a pintar les sombres dels sprites i el foreground
|
||||
view.origin(-rooms.pos.x*8+4,-rooms.pos.y*8+12)
|
||||
view.origin(-rooms.pos.x*8+4,-rooms.pos.y*8+4)
|
||||
|
||||
-- Pintem el foreground de negre
|
||||
map.surf(rooms.surf_foreground)
|
||||
@@ -78,13 +98,13 @@ rooms = {
|
||||
if rooms.is_visible(LAYER_FOREGROUND | LAYER_SHADOWS) then map.draw() end
|
||||
|
||||
-- Pintem els sprites de negre
|
||||
if rooms.is_visible(LAYER_SPRITES | LAYER_SHADOWS) then
|
||||
if rooms.is_visible(LAYER_SPRITES | LAYER_SHADOWS) then
|
||||
sprites.draw(true)
|
||||
--draw.surf(0, 0, 16, 17, 20, 15, 16, 17)
|
||||
end
|
||||
|
||||
-- Movem la càmara al lloc que toca de nou, i tornem la paleta normal
|
||||
view.origin(-rooms.pos.x*8,-rooms.pos.y*8+8)
|
||||
view.origin(-rooms.pos.x*8,-rooms.pos.y*8)
|
||||
pal.subpal()
|
||||
|
||||
-- Pintem el foreground
|
||||
|
||||
Reference in New Issue
Block a user