pete286/footer.jor

80 lines
1.6 KiB
Plaintext
Executable file

( F O O T E R )
var footer-y
0 footer-y !
: draw-footer footer-y @ split-screen ;
0 const BLACK
1 const BLUE
2 const GREEN
3 const CYAN
4 const RED
5 const MAGENTA
6 const BROWN
7 const LGRAY
8 const DGRAY
9 const LBLUE
10 const LGREEN
11 const LCYAN
12 const PINK
13 const LMAGENTA
14 const YELLOW
15 const WHITE
var text-color
WHITE text-color !
: statusy 7 swap <rot text-color @ text ;
: status0 10 statusy ;
: status1 20 statusy ;
: status2 30 statusy ;
var textx
var texty
2 const textspeed
: nltext 6 textx ! 10 texty +! ;
: inctextx
textx @ 1 + dup 38 <= if textx !
else drop nltext inctextx then ;
key \ const '\'
: statusc
dup dup '\' = swap '\n' = or if drop nltext
else dup '\r' = if drop
else inctextx textx @ texty @ <rot text-color @ textc then then ;
var texttimer
: textnextc ( s -- s )
dup b@ dup if statusc 1 + else drop then ;
: slowtext ( s -- )
texttimer now!
begin dup b@ while
texttimer advance! textspeed * 0 for textnextc next
suspend repeat drop ;
: clear
text-color @
WHITE text-color !
s" " dup dup status0 status1 status2
text-color !
6 textx !
10 texty ! ;
: show-footer 48 10 footer-y move-to ;
: hide-footer 0 10 footer-y move-to ;
: footer-wait show-footer ^ENTER wait-key ;
: say ( s -- ) clear show-footer slowtext footer-wait ;
: say" [ ' s" , ] ' say expile ; immediate
: character ( iportrait color ) create , ,
does> dup @ text-color ! cell + @ draw-portrait ;
0 GREEN character pete
1 MAGENTA character mary
2 BROWN character chuck