I'm drawing a tile!!
This commit is contained in:
parent
dc61bb08e0
commit
f833e62d91
|
@ -12,7 +12,6 @@
|
|||
(for [x 0 15 2]
|
||||
(let [ibyte (+ (* y 8) (math.floor (/ x 2)) 1)
|
||||
byte (string.byte (tile:sub ibyte ibyte))
|
||||
_ (print x y ibyte byte)
|
||||
left (bit.band (bit.rshift byte 4) 0xf)
|
||||
right (bit.band byte 0xf)]
|
||||
(putpixel x y (gs-to-rgb (. pal (+ left 1))))
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
(when ?filename (set files.filename ?filename))
|
||||
(let [game {}]
|
||||
(each [k v (pairs files.game)]
|
||||
(tset game k (lume.map v #(serialize k (clone $1) files.game))))
|
||||
(tset game k (if (= (type v) :table) (lume.map v #(serialize k (clone $1) files.game)) v)))
|
||||
(util.writejson (filename) game)))
|
||||
|
||||
(fn new-cache [game key]
|
||||
|
@ -71,7 +71,6 @@
|
|||
:portraits tiledraw.portrait-to-sprite
|
||||
_ tiledraw.tile-to-sprite)
|
||||
gfx (. game key)]
|
||||
(print gfx key)
|
||||
(tiledraw.TileCache gfx spritegen)))
|
||||
|
||||
(fn files.cache [key]
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"platform": "iigs"}
|
||||
{"platform":"iigs","tiles":[{"flags":[],"word":"","label":"","gfx":"FFFFFFFFFFFFFFFFFAAAAAA3FAAAAAA3FAAAAAA3FAAAAAA3FAAAAAA3FAAAAAA3FAAAAAA3FAAAAAA3FAAAAAA3FAAAAAA3FAAAAAA3FAAAAAA3F3333333F3333333FFFFFFFFFFFFFFFFFAAAAAA3FAAAAAA3FAAAAAA3FAAAAAA3FAAAAAA3FAAAAAA3FAAAAAA3FAAAAAA3FAAAAAA3FAAAAAA3FAAAAAA3FAAAAAA3F3333333F3333333"}]}
|
|
@ -1,4 +1,6 @@
|
|||
(local Ssc (require :ssc))
|
||||
(local files (require :game.files))
|
||||
(local {: pal} (require :editor.tiledraw.iigs))
|
||||
(import-macros {:sss ! : compile} :ssc.macros)
|
||||
|
||||
(local ssc (Ssc))
|
||||
|
@ -20,8 +22,6 @@
|
|||
(long! (ref hexbuf) (HexIt num))
|
||||
(WriteString (far-ref pascalhex)))
|
||||
|
||||
(fn add (lhs rhs) (+ lhs rhs))
|
||||
|
||||
(asm event-buffer)
|
||||
(global word event-what)
|
||||
(global long event-msg)
|
||||
|
@ -38,11 +38,24 @@
|
|||
(const screen-addr 0xe12000)
|
||||
(const screen-size 0x9d00)
|
||||
|
||||
(global word screen-offset 0)
|
||||
(getter screen-cursor (+ screen-addr screen-offset))
|
||||
(setter screen-cursor (pixels)
|
||||
(word! screen-cursor pixels)
|
||||
(set! screen-offset (+ screen-offset 2)))
|
||||
(asm tiles (bytes [(. files.game.tiles 1 :gfx)]))
|
||||
|
||||
(form set-palette [(fn [ssc index pal]
|
||||
(let [addr (+ 0xe19e00 (* index 0x20))
|
||||
writes (icollect [icolor [r g b] (ipairs pal)]
|
||||
[[:lda (bit.bor (bit.lshift r 8) (bit.lshift g 4) b)] [:sta (tostring (+ addr (* icolor 2) -2))]])]
|
||||
(lume.concat [:block] (table.unpack writes))))])
|
||||
|
||||
(fn draw-tile (tile (long addr))
|
||||
(let (y 0)
|
||||
(while (< y 16)
|
||||
(word! addr (word-at tile))
|
||||
(word! (+ addr 2) (word-at (+ tile 2)))
|
||||
(word! (+ addr 4) (word-at (+ tile 4)))
|
||||
(word! (+ addr 6) (word-at (+ tile 6)))
|
||||
(set! addr (+ addr 160))
|
||||
(set! tile (+ tile 8))
|
||||
(set! y (+ y 1)))))
|
||||
|
||||
(global word userID)
|
||||
|
||||
|
@ -59,13 +72,14 @@
|
|||
(TextStartUp)
|
||||
(QDStartUp 0x2100 0 0 userID)
|
||||
(EMStartUp 0x2000 0 0 320 0 200 userID)
|
||||
; (GrafOn)
|
||||
(GrafOn)
|
||||
|
||||
(let (number-printer (new-task (ref print-numbers-forever)))
|
||||
(set-palette 0 [pal])
|
||||
(SetAllSCBs 0)
|
||||
(draw-tile (ref tiles) screen-addr)
|
||||
(wait-for-key)
|
||||
(reset-task number-printer (ref yield-forever)))
|
||||
|
||||
; (GrafOff)
|
||||
(GrafOff)
|
||||
|
||||
(EMShutDown)
|
||||
(QDShutDown)
|
||||
|
|
10
ssc/init.fnl
10
ssc/init.fnl
|
@ -160,13 +160,13 @@
|
|||
pre (when ropgen.setup (ropgen.setup))
|
||||
lopgen (self:expr-opgen lhs)
|
||||
left (when lopgen.setup (lopgen.setup))
|
||||
truebranch (if ropgen.cleanup (.. :-if-true-cleanup- depth) truelabel)
|
||||
falsebranch (if ropgen.cleanup (.. :-if-false-cleanup- depth) falselabel)
|
||||
truebranch (.. :-if-true-cleanup- depth)
|
||||
falsebranch (.. :-if-false-cleanup- depth)
|
||||
hibranch (when lopgen.hi
|
||||
[(lopgen.hi :lda) (ropgen.hi :cmp) (cmp.hibranch truebranch falsebranch)])
|
||||
lobranch [(lopgen.lo :lda) (ropgen.lo :cmp) (cmp.lobranch falsebranch)]
|
||||
cleanup (when ropgen.cleanup (ropgen.cleanup))
|
||||
post (if cleanup [truebranch cleanup [:bra truelabel] falsebranch cleanup [:bra falselabel]]
|
||||
cleanup (if ropgen.cleanup (ropgen.cleanup) [:flatten])
|
||||
post (if cleanup [truebranch cleanup [:brl truelabel] falsebranch cleanup [:brl falselabel]]
|
||||
?branch-when-true [[:bra truelabel]])]
|
||||
(lume.concat [:block] [pre] [left] hibranch lobranch post))
|
||||
|
||||
|
@ -243,7 +243,7 @@
|
|||
:while (lambda [self test ...]
|
||||
(let [block [:block :-loop-top- (self:gen-condition test :-enter-loop- :-exit-loop-) :-enter-loop-]
|
||||
c-body (self:expr-poly [:do ...])]
|
||||
(values (lume.concat block [c-body [:bra :-loop-top-] :-exit-loop-]) :void)))
|
||||
(values (lume.concat block [c-body [:brl :-loop-top-] :-exit-loop-]) :void)))
|
||||
:+ (lambda [self first ...]
|
||||
(self:accumulation-op
|
||||
(fn [etype opgen]
|
||||
|
|
Loading…
Reference in a new issue