diff --git a/data/gfx/score_font.fnt b/data/gfx/score_font.fnt index a355355..dde71b2 100644 --- a/data/gfx/score_font.fnt +++ b/data/gfx/score_font.fnt @@ -1,11 +1,11 @@ bitmap=gfx/score_font.gif -48: 0 0 8 8 0 # 0 -49: 8 0 8 8 0 # 1 -50: 16 0 8 8 0 # 2 -51: 24 0 8 8 0 # 3 -52: 32 0 8 8 0 # 4 -53: 40 0 8 8 0 # 5 -54: 48 0 8 8 0 # 6 -55: 56 0 8 8 0 # 7 -56: 64 0 8 8 0 # 8 -57: 72 0 8 8 0 # 9 +48: 0 0 7 8 0 # 0 +49: 7 0 7 8 0 # 1 +50: 14 0 7 8 0 # 2 +51: 21 0 7 8 0 # 3 +52: 28 0 7 8 0 # 4 +53: 35 0 7 8 0 # 5 +54: 42 0 7 8 0 # 6 +55: 49 0 7 8 0 # 7 +56: 56 0 7 8 0 # 8 +57: 63 0 7 8 0 # 9 diff --git a/data/gfx/score_font.gif b/data/gfx/score_font.gif index 67ee289..b582dc0 100644 Binary files a/data/gfx/score_font.gif and b/data/gfx/score_font.gif differ diff --git a/data/maps/rooms_background.gif b/data/maps/rooms_background.gif index 2039447..eb01468 100644 Binary files a/data/maps/rooms_background.gif and b/data/maps/rooms_background.gif differ diff --git a/data/maps/rooms_foreground.gif b/data/maps/rooms_foreground.gif index 01f2974..ba40585 100644 Binary files a/data/maps/rooms_foreground.gif and b/data/maps/rooms_foreground.gif differ diff --git a/data/maps/rooms_items.gif b/data/maps/rooms_items.gif index 28d7d6f..010e43b 100644 Binary files a/data/maps/rooms_items.gif and b/data/maps/rooms_items.gif differ diff --git a/data/maps/tiles_palette.gif b/data/maps/tiles_palette.gif new file mode 100644 index 0000000..c523b0f Binary files /dev/null and b/data/maps/tiles_palette.gif differ diff --git a/data/modules/score.lua b/data/modules/score.lua index 84830ea..fe76619 100644 --- a/data/modules/score.lua +++ b/data/modules/score.lua @@ -1,6 +1,6 @@ score = { points = 0, - color = 21, + color = 28, ypos = 3, surf = nil, font = nil @@ -17,16 +17,16 @@ local function draw_text() font.current(me.font) font.spacing(0) local txt = string.format("%03d", me.points) - draw.text(txt,2,me.ypos-1,27) - draw.text(txt,3,me.ypos-1,27) - draw.text(txt,4,me.ypos-1,27) - draw.text(txt,2,me.ypos,27) - draw.text(txt,4,me.ypos,27) - draw.text(txt,2,me.ypos+1,27) - draw.text(txt,4,me.ypos+1,27) - draw.text(txt,2,me.ypos+2,27) - draw.text(txt,3,me.ypos+2,27) - draw.text(txt,4,me.ypos+2,27) +-- draw.text(txt,2,me.ypos-1,27) +-- draw.text(txt,3,me.ypos-1,27) +-- draw.text(txt,4,me.ypos-1,27) +-- draw.text(txt,2,me.ypos,27) +-- draw.text(txt,4,me.ypos,27) +-- draw.text(txt,2,me.ypos+1,27) +-- draw.text(txt,4,me.ypos+1,27) +-- draw.text(txt,2,me.ypos+2,27) +-- draw.text(txt,3,me.ypos+2,27) +-- draw.text(txt,4,me.ypos+2,27) draw.text(txt,3,me.ypos+1,1) draw.text(txt,3,me.ypos,me.color) font.current(font.DEFAULT) @@ -64,6 +64,6 @@ end function me.inc(value) me.points = me.points + value - tweening.add(8, 0, 0.5, easing.linear, function(val,progress,finished) me.color = (math.floor(val)&1) == 0 and 21 or 14 end) + tweening.add(8, 0, 0.5, easing.linear, function(val,progress,finished) me.color = (math.floor(val)&1) == 0 and 28 or 14 end) tweening.add(5, 3, 0.5, easing.easeOutElastic, function(val,progress,finished) me.ypos = math.floor(val) end) end diff --git a/data/stages/editor.lua b/data/stages/editor.lua index a12e654..806e1ab 100644 --- a/data/stages/editor.lua +++ b/data/stages/editor.lua @@ -1,6 +1,7 @@ require ":modules.menu" require ":utils.msgbox" require ":modules.items" +require ":utils.palfade" editor = { @@ -148,6 +149,8 @@ editor = { else editor.itempicker.show() end + elseif key.press(key.GRAVE) then + editor.mapviewer.show() elseif key.press(key.P) then sprites.hero.pos.x = tx*8-4 sprites.hero.pos.y = ty*8-9 @@ -343,6 +346,55 @@ editor = { end }, + mapviewer = { + surf = nil, + pal = nil, + + show = function() + if editor.mapviewer.surf == nil then editor.mapviewer.surf = surf.new(160,104) end + local background = surf.load("maps/rooms_background.gif") + local foreground = surf.load("maps/rooms_foreground.gif") + + surf.target(surf.SCREEN) + surf.cls(0) + + surf.target(editor.mapviewer.surf) + + surf.source(background) + view.origin(0,0) + surf.clip() + draw.surf(0,0,160,104,0,0) + surf.source(foreground) + draw.surf(0,0,160,104,0,0) + + if editor.mapviewer.pal == nil then editor.mapviewer.pal = pal.load("maps/tiles_palette.gif") end + pal.set(editor.mapviewer.pal) + + app.push(editor.mapviewer.update) + end, + + close = function() + surf.target(surf.SCREEN) + surf.cls(0) + pal.set(palfade.original) + app.pop() + end, + + update = function() + surf.source(editor.mapviewer.surf) + surf.target(surf.SCREEN) + draw.surf(0,0,160,104,0,0) + + local x = (rooms.pos.x//20)*20 + local y = (rooms.pos.y//13)*13 + draw.rect(x, y, 20, 13, 68) + + if not key.down(key.GRAVE) then + editor.mapviewer.close() + end + end + }, + itempicker = { surf_back = nil, pos_y = 24, diff --git a/data/stages/game.lua b/data/stages/game.lua index 2f6635c..3ea678c 100644 --- a/data/stages/game.lua +++ b/data/stages/game.lua @@ -74,7 +74,7 @@ game = { score.draw() view.origin(0,0) - draw.text("safe: "..sprites.last_safe_room,1,96,28) + --draw.text("safe: "..sprites.last_safe_room,1,96,28) --draw.text(sprites.hero.pos.x ..","..sprites.hero.pos.y,14,89,28) if key.press(key.ESCAPE) or key.press(key.F9) then @@ -86,7 +86,7 @@ game = { console.enable() end - draw.text(sys.fps(),2,20,8) + --draw.text(sys.fps(),2,20,8) end, change_room = function(x,y) diff --git a/img2pal.py b/img2pal.py new file mode 100644 index 0000000..9db4f92 --- /dev/null +++ b/img2pal.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 + +from PIL import Image +import sys + +if len(sys.argv) != 3: + print(f"Uso: {sys.argv[0]} entrada.png salida.pal") + sys.exit(1) + +img = Image.open(sys.argv[1]).convert("RGB") + +num_colors = img.width * img.height + +with open(sys.argv[2], "w") as f: + f.write("JASC-PAL\n") + f.write("0100\n") + f.write(f"{num_colors}\n") + + for y in range(img.height): + for x in range(img.width): + r, g, b = img.getpixel((x, y)) + f.write(f"{r} {g} {b}\n") + +print(f"Escritos {num_colors} colores en {sys.argv[2]}") \ No newline at end of file diff --git a/tiles_palette.pal b/tiles_palette.pal new file mode 100644 index 0000000..e3cd589 --- /dev/null +++ b/tiles_palette.pal @@ -0,0 +1,259 @@ +JASC-PAL +0100 +256 +0 0 0 +206 195 177 +121 128 126 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +60 42 22 +118 80 46 +125 87 47 +115 77 45 +130 91 49 +122 83 46 +190 187 178 +238 232 214 +190 187 178 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +121 84 45 +125 87 47 +85 49 37 +79 43 36 +9 5 4 +86 60 32 +28 23 48 +28 23 48 +0 0 0 +28 23 48 +17 14 29 +28 23 48 +25 21 43 +22 22 14 +13 13 8 +0 0 0 +130 91 49 +120 82 46 +130 91 49 +97 60 40 +0 0 0 +0 0 0 +28 23 48 +0 0 0 +0 0 0 +28 23 48 +5 4 9 +28 23 48 +15 15 10 +1 1 1 +17 17 11 +15 15 10 +240 189 119 +197 145 84 +240 189 119 +128 94 54 +255 0 0 +0 0 0 +28 23 48 +20 16 35 +28 23 48 +28 23 48 +0 0 0 +0 0 0 +24 24 16 +3 3 2 +1 1 1 +0 0 0 +240 189 119 +186 137 79 +77 57 34 +173 127 74 +146 109 66 +0 0 0 +0 0 0 +19 5 7 +20 16 35 +3 3 6 +116 173 187 +116 173 187 +5 5 3 +0 0 0 +26 26 17 +0 0 0 +240 189 119 +197 145 84 +207 156 92 +222 171 105 +227 176 109 +99 73 42 +37 27 15 +138 101 59 +162 142 125 +128 111 97 +153 134 117 +126 109 96 +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0 0 +0 0 0 diff --git a/tiles_palette.png b/tiles_palette.png new file mode 100644 index 0000000..c8c64ba Binary files /dev/null and b/tiles_palette.png differ