diff --git a/data/stages/game.lua b/data/stages/game.lua index 35a5db0..e3bcbc2 100644 --- a/data/stages/game.lua +++ b/data/stages/game.lua @@ -12,11 +12,14 @@ cheats = {} game = { chg_adv = {x=0, y=0}, chg_step = 0, - back_buf = 0, + --back_buf = 0, circ_buf = 0, + water_buf = 0, + old_water_level = 0, - water_pal = {6,6,21,21,6,21,6,22,22,22,22,22,22,22,22,21,21,22,22,22,22,21,22,22,21,22,22,22,22,6,6,6}, - fade_pal = {1,1,3,1,1,3,29,29,3,3,3,3,3,6,6,29,29,3,3,3,3,29,6,29,29,6,29,6,6,1,1,1}, + water_pal = {6,6,21,21,6,21, 6,22,22,22,22,22,22,22,22,21,21,22,22,22,22,21,22,22,21,22,22,22,22,6,6,6}, + fade_pal = {1,1, 3, 1,1, 3,29,29, 3, 3, 3, 3, 3, 6, 6,29,29, 3, 3, 3, 3,29, 6,29,29, 6,29, 6, 6,1,1,1}, + black_pal = {1,1, 1, 1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1}, light_strobe_value = 0, light_strobe_dir = 1, @@ -24,10 +27,16 @@ game = { fade=0, enable = function() - if game.back_buf == 0 then - game.back_buf = surf.new(160,104) + if game.circ_buf == 0 then + --game.back_buf = surf.new(160,104) game.circ_buf = surf.new(160,104) + game.water_buf = surf.new(160,104) end + pal.lut(0,game.black_pal) + pal.lut(1,game.fade_pal) + pal.lut(3) + pal.lut(2,game.water_pal) + app.update = game.update sys.beat(2) palfade.init() @@ -62,7 +71,7 @@ game = { surf.target(0) surf.clip() - surf.target(game.back_buf) + surf.target(0)--game.back_buf) -- Pintar el mapa i sprites rooms.draw() @@ -92,7 +101,7 @@ game = { win.fullscreen(not win.fullscreen()) end - --draw.text(sys.fps(),2,20,8) + draw.text(math.floor(sys.fps()),144,1,14) end, change_room = function(x,y) @@ -112,7 +121,7 @@ game = { surf.target(0) surf.clip() - surf.target(game.back_buf) + surf.target(0)--game.back_buf) --view.clip() -- Pintar el mapa i sprites @@ -149,15 +158,20 @@ game = { apply_water = function() view.origin(0,0) if rooms.pos.y == 91 then - surf.target(game.back_buf) - surf.source(game.back_buf) + surf.target(game.water_buf) + surf.cls(3) for x=0,159 do - local water_level = math.sin(game.water_counter)*2 - for y=88+water_level,104 do - local pixel = draw.pixel(x,y) - draw.pixel(x,y,game.water_pal[pixel+1]) - end + --local water_level = math.sin(game.water_counter+x/20)*2 + local water_level = math.sin(game.water_counter+x/20)+math.cos(-game.water_counter+x/10) + draw.vline(x, 88+water_level, 104, 2) + --for y=88+water_level,104 do + -- local pixel = draw.pixel(x,y) + -- draw.pixel(x,y,game.water_pal[pixel+1]) + --end end + surf.target(0) + surf.source(game.water_buf) + pal.mask() end end, @@ -168,21 +182,23 @@ game = { end surf.target(0) - for y=0,103 do - for x=0,159 do - surf.source(game.back_buf) - local pixel = draw.pixel(x,y) - surf.source(game.circ_buf) - local light = draw.pixel(x,y) - if light==0 then - draw.pixel(x,y,1) - elseif (light&2)==2 then - draw.pixel(x,y,pixel) - else - draw.pixel(x,y,game.fade_pal[pixel+1]) - end - end - end + surf.source(game.circ_buf) + pal.mask() + --for y=0,103 do + -- for x=0,159 do + -- surf.source(game.back_buf) + -- local pixel = draw.pixel(x,y) + -- surf.source(game.circ_buf) + -- local light = draw.pixel(x,y) + -- if light==0 then + -- draw.pixel(x,y,1) + -- elseif (light&2)==2 then + -- draw.pixel(x,y,pixel) + -- else + -- draw.pixel(x,y,game.fade_pal[pixel+1]) + -- end + -- end + --end end