Dialog helpers

This commit is contained in:
Jeremy Penner 2020-11-22 22:13:16 -05:00
parent a88f92b9b3
commit 6d42399529

View file

@ -133,7 +133,7 @@
(vm:drop)
[:block
:row
[:ldy 0x2f] [:lda 0]
[:ldy 0x27] [:lda 0]
:start
[:sta [vm.W] :y]
[:dey]
@ -324,13 +324,39 @@
(vm:word :draw-char ; pscreen c --
:lookup-pchar :draw-pchar)
(vm:word :draw-text ; st --
0x2257 (vm:while [:over :bget :dup] ; st pscreen c
(vm:word :snooze (vm:for))
(vm:word :textsnooze 0x40 :snooze)
(vm:word :draw-text1 0x2257 :draw-text)
(vm:word :draw-text2 0x22d7 :draw-text)
(vm:word :draw-text3 0x2357 :draw-text)
(vm:word :draw-text4 0x23d7 :draw-text)
(vm:word :draw-text ; st pscreen --
(vm:while [:over :bget :dup] ; st pscreen c
:over :swap :draw-char ; st pscreen
:textsnooze
:inc :swap :inc :swap)
:drop :drop)
:drop :drop :drop)
(vm:word :cleartext
0x2257 :clearline 0x22d7 :clearline 0x2357 :clearline 0x23d7 :clearline)
(vm:word :hello-world (vm:str "HELLO, WORLD!") :draw-text)
(vm:word :wait-for-return (vm:until :read-key (string.byte "\r") :=))
(vm:word :dismiss-dialog :wait-for-return :cleartext)
(fn with-footer [...] [:vm :drawfooter [:vm ...] :clearfooter])
(fn say [portrait ...]
(local result [:vm :lit (.. :p portrait) :draw-portrait])
(local lines [...])
(local ilineOffset (if (< (length lines) 4) 1 0))
(each [iline line (ipairs lines)]
(table.insert result [:vm (vm:str line) (.. :draw-text (+ iline ilineOffset))]))
(table.insert result :dismiss-dialog)
result)
(vm:word :hello-world
(with-footer
(say :jaye "THAT WAS AN EARTHQUAKE!")
(say :neut "GOLLY GEE JAYE, YOU'RE RIGHT!" "WHAT ARE WE GONNA DO??")
(say :jaye "WE" "MUST" "NOT" "PANIC!!")))
(tile.appendtiles tiles-org)
@ -340,8 +366,6 @@
; 20x12 means full map is 240 bytes - we have an extra 16 bytes at the end to mess with?
(tile.appendmaps (prg:org 0x4800))
(font-org:append :font)
(tile.appendgfx font-org (tile.loadgfx tile.fn-font))
(code1:append :main