diff --git a/flora-sercha-sauna.lisp b/flora-sercha-sauna.lisp index be088f2..7c59165 100644 --- a/flora-sercha-sauna.lisp +++ b/flora-sercha-sauna.lisp @@ -21,9 +21,10 @@ (ql:quickload :cl-tiled) + (defun main () (clear-screen) - (draw-map "/home/jaidyn/.local/src/games/flower/res/mom.tmx")) + (draw-map "/home/jaidyn/.local/src/games/flower/res/map.tmx")) (defun move-cursor (row column &key (stream *standard-output*)) @@ -40,19 +41,33 @@ Borrowed from https://github.com/gorozhin/chlorophyll/ (defun draw-map (map-path) + "Draw a Tiled-format tilemap to the screen." (mapcar #'draw-tile-layer (cl-tiled:map-layers (cl-tiled:load-map map-path)))) (defun draw-tile-layer (tile-layer) + "Draw a Tiled tile-layer to the screen." (mapcar #'draw-cell (cl-tiled:layer-cells tile-layer))) (defun draw-cell (cell) - (move-cursor (cl-tiled:cell-row cell) - (cl-tiled:cell-column cell)) - (write-char #\A)) + "Draw a specific cell of a tile-layer to the screen." + (move-cursor (+ (cl-tiled:cell-row cell) 1) + (+ (cl-tiled:cell-column cell) 1)) + (write-char (tile-character + (cl-tiled:cell-tile cell)))) + + +(defun tile-character (tile) + "Given a tileset's tile, return it's corresponding text character, +assuming that the tileset is a bitmap font starting with char-code 32 +with 15 characters-per-line." + (code-char + (+ (* (cl-tiled:tile-row tile) 15) + (cl-tiled:tile-column tile) + 32))) (main) diff --git a/res/font.png b/res/font.png new file mode 100644 index 0000000..2a74303 Binary files /dev/null and b/res/font.png differ diff --git a/res/font.tsx b/res/font.tsx new file mode 100644 index 0000000..845ea58 --- /dev/null +++ b/res/font.tsx @@ -0,0 +1,4 @@ + + + + diff --git a/res/font.txt b/res/font.txt new file mode 100644 index 0000000..054b129 --- /dev/null +++ b/res/font.txt @@ -0,0 +1,18 @@ +A Tiled tileset generated from Fira Code Regular⁽¹⁾ printable ASCII characters. +This is (ofc) not used in the game, but is very handy for visualizing the map in Tiled! + +Generated thanks to the beautiful program ttf2png⁽²⁾, like so: + $ ttf2png -r 32,126 -s 15 -l 15 -e -t -o font.png FiraCode-Regular.ttf + +Note `-l 15`, which sets the row-length to 15. This is very important! +Flora's engine parses the tiles' character values by calculating the tile's +[15(row - 1) + column]. +Could we avoid this, and automatically figure out the row-length? Yeaaa. +Could I be bothered? Nooo. + + +[1] https://github.com/tonsky/FiraCode +Fira Code © 2014 Fira Coda Authors, SIL OFL 1.1 + +[2] https://www.tdb.fi/ttf2png.shtml +TTF2PNG © 2021 tdb, GNU GPLv1 diff --git a/res/map font.png b/res/map font.png deleted file mode 100644 index 017a3e7..0000000 Binary files a/res/map font.png and /dev/null differ diff --git a/res/map font.tsx b/res/map font.tsx deleted file mode 100644 index f6406b4..0000000 --- a/res/map font.tsx +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/res/map font.txt b/res/map font.txt deleted file mode 100644 index 2064fa7..0000000 --- a/res/map font.txt +++ /dev/null @@ -1,5 +0,0 @@ -License: CC0 -Author: domsson -URL: https://opengameart.org/content/ascii-bitmap-font-oldschool - -Used as a tilemap in Tiled — just to help visualize the maps! diff --git a/res/map.tmx b/res/map.tmx new file mode 100644 index 0000000..e5fb81e --- /dev/null +++ b/res/map.tmx @@ -0,0 +1,28 @@ + + + + + +2,0,18,18,18,19,20,21,22,23,24,0,0,0,48,48,33,33,33,33,33,18,19,20,21,22,23,24,0,18,33,33,48,63,63,63,64,65,66,67,63,18,19,20,21,22,23,24,0,0,0,0,0,0,0,0,33,48,63,64,65,66,67,68,69,0,0,0,0,0,0,0, +0,0,33,33,18,19,20,21,22,23,24,0,0,18,63,63,48,48,48,48,48,18,19,20,21,22,23,24,18,33,48,48,63,64,65,66,67,68,69,0,0,18,19,20,21,22,23,24,0,0,0,0,0,0,0,18,48,63,64,65,66,67,68,69,0,0,0,0,0,0,0,0, +0,0,48,48,18,19,20,21,22,23,24,0,0,33,63,64,63,63,63,63,63,18,19,20,21,22,23,18,33,48,63,63,64,65,66,67,68,69,0,0,0,18,19,20,21,22,23,24,0,0,0,0,0,0,18,33,63,64,65,66,67,68,69,0,0,0,0,0,0,0,0,0, +0,18,63,63,33,18,19,20,21,22,23,24,0,48,63,64,65,66,67,68,69,18,19,20,21,22,23,33,48,63,64,65,66,67,68,69,0,0,0,0,0,18,19,20,21,22,23,24,0,0,0,0,0,0,33,48,63,64,65,66,67,68,69,0,0,0,0,0,0,0,0,0, +0,33,63,64,48,18,19,20,21,22,23,24,0,63,63,64,65,66,67,68,69,18,19,20,21,22,18,48,63,64,65,66,67,68,69,0,0,0,0,0,0,18,19,20,21,22,23,24,0,0,0,0,0,18,48,63,64,65,66,67,68,69,0,0,0,0,0,0,0,0,0,0, +0,48,63,64,63,18,19,20,21,22,23,24,0,63,64,65,66,67,68,69,0,18,18,18,18,18,33,63,64,65,66,67,68,69,18,19,20,21,22,23,18,19,20,21,22,23,24,39,0,0,0,0,0,33,63,64,65,66,67,68,69,0,0,0,0,0,0,0,0,0,0,0, +0,63,64,65,66,18,19,20,21,22,23,24,0,63,64,65,66,67,68,69,18,18,33,33,33,33,48,63,64,65,66,67,68,69,33,18,18,18,19,20,18,19,20,21,22,23,24,54,0,0,0,0,18,48,63,64,65,66,67,68,69,0,0,0,0,0,0,0,0,0,0,0, +0,63,64,65,66,33,18,19,20,21,22,23,24,63,64,65,66,18,18,18,33,33,48,48,48,48,63,64,65,66,67,68,69,48,48,33,33,18,18,18,19,20,21,22,23,24,39,69,0,0,0,0,33,63,64,65,66,67,68,69,18,19,20,21,22,23,24,24,24,24,24,0, +18,63,64,65,66,48,33,18,19,20,21,22,23,63,64,65,66,33,33,33,48,48,63,63,63,63,64,65,66,67,68,69,63,63,63,48,48,33,18,18,19,20,21,22,23,24,54,0,0,0,0,18,48,63,64,65,66,67,68,69,19,20,21,22,23,24,39,39,39,39,39,24, +33,63,64,65,66,63,48,18,19,20,21,22,23,63,64,65,66,48,48,48,63,63,64,65,66,63,64,65,66,67,68,69,0,0,0,63,63,48,18,18,19,20,21,22,23,24,69,0,0,0,0,33,63,64,65,66,67,68,69,19,20,21,22,23,24,39,54,54,54,54,54,39, +48,63,64,65,66,67,63,33,18,19,20,21,22,63,64,65,66,63,63,63,64,65,66,67,68,63,64,65,66,67,68,69,0,0,0,0,0,63,18,19,20,21,22,23,24,39,0,0,0,0,18,48,63,64,65,66,67,68,69,20,21,22,23,24,39,54,69,69,69,69,69,54, +63,63,64,65,66,67,68,48,33,18,19,20,21,63,64,65,66,63,64,65,66,67,68,69,69,63,64,65,66,67,68,69,24,0,0,0,0,18,19,20,21,22,23,24,39,54,0,0,0,0,33,63,64,65,66,67,68,69,20,21,22,23,24,24,54,69,65,66,67,68,69,69, +63,64,65,66,67,68,69,63,48,18,19,20,21,63,64,65,66,67,68,69,39,0,0,0,0,63,64,65,66,67,68,69,39,24,19,20,21,18,19,20,21,22,23,24,54,69,0,0,0,0,48,63,64,65,66,67,68,69,20,21,22,23,24,39,69,0,0,63,64,65,66,67, +63,64,65,66,67,68,69,0,63,33,18,19,20,63,64,65,66,67,68,69,54,0,0,0,0,63,64,65,66,67,68,69,54,39,24,24,18,19,20,21,22,23,24,39,69,0,0,0,0,0,63,64,65,66,67,68,69,20,21,22,23,24,39,54,0,0,0,0,0,63,64,65, +63,64,65,66,67,68,69,0,0,48,33,18,19,20,63,64,65,66,67,68,69,24,0,0,0,0,63,64,65,66,67,68,69,54,39,18,19,20,21,22,23,24,24,54,69,0,0,0,0,0,63,64,65,66,67,68,69,21,22,23,24,39,54,69,0,0,0,0,0,0,0,18, +63,64,65,66,67,68,69,0,0,63,48,33,18,19,63,64,65,66,67,68,69,39,0,0,0,0,63,64,65,66,67,68,69,69,54,18,19,20,21,22,23,24,39,69,0,0,0,0,0,18,63,64,65,66,67,68,69,22,23,24,24,54,69,0,0,0,0,18,18,18,18,33, +63,64,65,66,67,68,69,0,0,0,63,48,33,18,63,64,65,66,67,68,69,54,24,0,0,0,0,0,63,64,65,66,67,68,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,33,63,64,65,66,67,68,69,22,23,24,39,69,18,18,18,18,18,33,33,33,33,48, +63,64,65,66,67,68,69,0,0,0,0,63,48,33,18,63,64,65,66,67,68,69,39,0,0,0,0,0,0,0,0,0,0,0,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,48,63,64,65,66,67,68,69,23,24,39,54,33,33,33,33,33,33,48,48,48,48,63, +0,0,0,0,0,0,0,0,0,0,0,0,63,48,33,63,64,65,66,67,68,69,54,24,0,0,0,0,0,0,0,0,0,0,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,63,64,65,66,67,68,69,22,23,24,54,69,48,48,48,48,48,48,63,63,63,63,64, +0,0,0,0,0,0,0,0,0,0,0,0,0,63,48,33,63,64,65,66,67,68,69,39,0,0,0,0,0,0,0,0,0,0,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,64,65,66,67,68,69,22,23,24,69,63,63,63,63,63,63,63,64,65,66,67,68 + + + diff --git a/res/mom.tmx b/res/mom.tmx deleted file mode 100644 index 7b82f77..0000000 --- a/res/mom.tmx +++ /dev/null @@ -1,28 +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,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,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,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,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,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,0,0,0,0,0,0,0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