[WIP] Lluita contra jefes
This commit is contained in:
@@ -124,31 +124,63 @@ function map_to_editor_tile(map_tile)
|
||||
return result
|
||||
end
|
||||
|
||||
function load_tilemap( sf_mapa )
|
||||
function load_tilemap( sf_mapa, replace_map )
|
||||
local mapa_tw, mapa_th = surf.size(sf_mapa)
|
||||
local nrooms = mapa_rooms_per_piso*mapa_pisos
|
||||
local x = 0
|
||||
local y = 0
|
||||
local yroom = 0
|
||||
local xroom = 0
|
||||
|
||||
|
||||
map.surf(sf_mapa)
|
||||
for ty=0,mapa_th-1 do
|
||||
if y == mapa_room_rows then
|
||||
yroom = yroom + mapa_rooms_per_piso
|
||||
y = 0
|
||||
end
|
||||
xroom = yroom
|
||||
for tx=0,mapa_tw-1 do
|
||||
local tile=editor_to_map_tile(mapa[1+xroom][1+x+y*mapa_room_cols])
|
||||
map.tile(tx, ty, tile)
|
||||
x = x + 1
|
||||
if x == mapa_room_cols then
|
||||
x = 0
|
||||
xroom = xroom + 1
|
||||
if replace_map==nil then
|
||||
for ty=0,mapa_th-1 do
|
||||
if y == mapa_room_rows then
|
||||
yroom = yroom + mapa_rooms_per_piso
|
||||
y = 0
|
||||
end
|
||||
xroom = yroom
|
||||
for tx=0,mapa_tw-1 do
|
||||
local tile=editor_to_map_tile(mapa[1+xroom][1+x+y*mapa_room_cols])
|
||||
map.tile(tx, ty, tile)
|
||||
x = x + 1
|
||||
if x == mapa_room_cols then
|
||||
x = 0
|
||||
xroom = xroom + 1
|
||||
end
|
||||
end
|
||||
y = y +1
|
||||
end
|
||||
else
|
||||
local mapa_x0, mapa_y0 = coords.room_to_mini_tile( replace_map.r0.r, replace_map.r0.x, replace_map.r0.y )
|
||||
local mapa_x1, mapa_y1 = coords.room_to_mini_tile( replace_map.r1.r, replace_map.r1.x, replace_map.r1.y )
|
||||
local replace_rooms_per_piso = ((replace_map.r1.r-replace_map.r0.r)+1)%mapa_rooms_per_piso
|
||||
-- print(mapa_x0..", "..mapa_y0)
|
||||
-- print(mapa_x1..", "..mapa_y1)
|
||||
-- print(mapa_x1-mapa_x0..", "..mapa_y1-mapa_y0)
|
||||
print(replace_rooms_per_piso)
|
||||
|
||||
y = 0
|
||||
for ty=mapa_y0,mapa_y1 do --24 -> 41 = 17 (18)
|
||||
if y == mapa_room_rows then
|
||||
yroom = yroom + replace_rooms_per_piso
|
||||
y = 0
|
||||
end
|
||||
xroom = yroom
|
||||
for tx=mapa_x0, mapa_x1 do -- 36 -> 59 = 23 (24)
|
||||
print("ROOM= "..xroom.." ( "..x..", "..y.." ) <= "..(1+xroom)..", "..(1+x+y*mapa_room_cols))
|
||||
-- print(replace_map.map[1+xroom][1+x+y*mapa_room_cols])
|
||||
|
||||
local tile=editor_to_map_tile(replace_map.map[1+xroom][1+x+y*mapa_room_cols])
|
||||
map.tile(tx, ty, tile)
|
||||
x = x + 1
|
||||
if x == mapa_room_cols then
|
||||
x = 0
|
||||
xroom = xroom + 1
|
||||
end
|
||||
end
|
||||
y = y +1
|
||||
end
|
||||
y = y +1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user