2019-07-28 22:40:13 +00:00
|
|
|
var lcolor 0x0f lcolor !
|
|
|
|
var rcolor 0x10 rcolor !
|
2019-07-24 02:39:56 +00:00
|
|
|
var spriteindex
|
|
|
|
|
2019-07-27 01:37:47 +00:00
|
|
|
var refresh-needed
|
|
|
|
: refresh 1 refresh-needed ! ;
|
2019-07-24 02:39:56 +00:00
|
|
|
|
2019-08-07 02:47:15 +00:00
|
|
|
array preview 128 allot
|
|
|
|
|
2019-07-28 22:40:13 +00:00
|
|
|
: color! >r dup r@ @ = if drop else r@ ! refresh then rdrop ;
|
|
|
|
|
2019-08-25 02:37:00 +00:00
|
|
|
: +sprite! spriteindex spritecount +!cycle spriteindex @ . refresh ;
|
2019-07-24 02:39:56 +00:00
|
|
|
|
2019-07-27 01:37:47 +00:00
|
|
|
: draw-palette 0 0x11 for i 79 i 3 << drawfatbox next ;
|
2019-07-24 02:39:56 +00:00
|
|
|
|
2019-08-07 02:47:15 +00:00
|
|
|
: draw-preview
|
|
|
|
0 18 for
|
2019-08-08 02:25:27 +00:00
|
|
|
0 edittarget = if
|
|
|
|
i preview tile>buf
|
|
|
|
spriteindex @ preview spr>buf
|
|
|
|
else
|
|
|
|
spriteindex @ preview tile>buf
|
|
|
|
then
|
2019-08-07 02:47:15 +00:00
|
|
|
i 3 % 2 * 65 + i 3 / 16 * preview paintbuf
|
|
|
|
next ;
|
|
|
|
|
2020-01-13 21:52:56 +00:00
|
|
|
: mousecoord>sprcoord 2 edittarget = if 2 else 3 then >> ;
|
|
|
|
: mousepos>sprpos mousecoord>sprcoord swap mousecoord>sprcoord swap ;
|
2019-07-26 02:32:31 +00:00
|
|
|
: mousexys mousepos mousepos>sprpos spriteindex @ ;
|
2019-07-28 22:40:13 +00:00
|
|
|
|
|
|
|
: mousepixel! ( color -- )
|
|
|
|
>r mousexys getpixel r@ != if
|
|
|
|
r@ mousexys putpixel refresh
|
|
|
|
then rdrop ;
|
|
|
|
|
2019-08-08 02:25:27 +00:00
|
|
|
: gfxfilename
|
|
|
|
0 edittarget = if
|
|
|
|
s" sprite.gfx"
|
2020-01-13 21:52:56 +00:00
|
|
|
else 1 edittarget = if
|
2019-08-08 02:25:27 +00:00
|
|
|
NIGHT flag@ if
|
|
|
|
s" ntiles.gfx"
|
|
|
|
else
|
|
|
|
s" tiles.gfx"
|
|
|
|
then
|
2020-01-13 21:52:56 +00:00
|
|
|
else s" portrait.gfx" then then ;
|
|
|
|
|
2019-07-28 22:40:13 +00:00
|
|
|
var jiles-old-tick
|
|
|
|
var jiles-old-draw
|
|
|
|
|
|
|
|
44 const ^Z
|
|
|
|
45 const ^X
|
|
|
|
31 const ^S
|
2019-08-08 02:25:27 +00:00
|
|
|
20 const ^T
|
2019-09-20 01:52:24 +00:00
|
|
|
33 const ^F
|
2019-12-02 02:39:46 +00:00
|
|
|
19 const ^R
|
2019-09-20 01:52:24 +00:00
|
|
|
46 const ^C
|
|
|
|
47 const ^V
|
|
|
|
73 const ^PgUp
|
|
|
|
81 const ^PgDn
|
|
|
|
|
|
|
|
var copysrc
|
2019-07-28 22:40:13 +00:00
|
|
|
|
|
|
|
: jiles-tick
|
2019-07-27 01:37:47 +00:00
|
|
|
mousepos 128 < swap 128 < and if
|
2019-07-28 22:40:13 +00:00
|
|
|
MOUSEL mousedown if lcolor @ mousepixel! then
|
|
|
|
MOUSER mousedown if rcolor @ mousepixel! then
|
2019-07-26 02:32:31 +00:00
|
|
|
then
|
2019-07-27 01:37:47 +00:00
|
|
|
mousepos 136 < swap 312 >= and if
|
2019-07-28 22:40:13 +00:00
|
|
|
mousepos swap drop 3 >> dup
|
|
|
|
MOUSEL mousedown if lcolor color! else drop then
|
|
|
|
MOUSER mousedown if rcolor color! else drop then
|
2019-07-20 02:29:32 +00:00
|
|
|
then
|
2019-07-27 01:37:47 +00:00
|
|
|
^LEFT key-pressed if -1 +sprite! then
|
|
|
|
^RIGHT key-pressed if 1 +sprite! then
|
2019-07-28 22:40:13 +00:00
|
|
|
^Z key-pressed if mousexys getpixel lcolor color! then
|
|
|
|
^X key-pressed if mousexys getpixel rcolor color! then
|
2019-08-08 02:25:27 +00:00
|
|
|
^S key-pressed if s" SAVING " type gfxfilename dup type cr savegfx then
|
2020-01-13 21:52:56 +00:00
|
|
|
^T key-pressed if edittarget 1 + 3 % edittarget! 0 +sprite! then
|
2019-09-20 01:52:24 +00:00
|
|
|
^C key-pressed if spriteindex @ copysrc ! then
|
|
|
|
^V key-pressed if copysrc @ spriteindex @ paste-tile refresh then
|
|
|
|
^F key-pressed if spriteindex @ flip-tile refresh then
|
2019-12-02 02:39:46 +00:00
|
|
|
^R key-pressed if spriteindex @ vflip-tile refresh then
|
2019-09-20 01:52:24 +00:00
|
|
|
^PgDn key-pressed if 5 +sprite! then
|
|
|
|
^PgUp key-pressed if -5 +sprite! then
|
|
|
|
^UP key-pressed if -1 spriteindex @ nudge-sprite refresh then
|
|
|
|
^DOWN key-pressed if 1 spriteindex @ nudge-sprite refresh then
|
2019-07-28 22:40:13 +00:00
|
|
|
^TAB key-pressed if
|
|
|
|
jiles-old-draw @ ' draw redefine
|
|
|
|
jiles-old-tick @ ' tick redefine
|
2020-01-13 21:52:56 +00:00
|
|
|
mousehide unfuck invalidate-map reloadtiles reloadportraits load-footer
|
2019-07-28 22:40:13 +00:00
|
|
|
then
|
2019-07-20 02:29:32 +00:00
|
|
|
tick-debounce
|
2019-07-27 01:37:47 +00:00
|
|
|
;
|
|
|
|
|
2019-07-28 22:40:13 +00:00
|
|
|
: jiles-draw
|
2019-07-27 01:37:47 +00:00
|
|
|
refresh-needed @ if
|
|
|
|
mousehide
|
2019-08-07 02:47:15 +00:00
|
|
|
draw-preview
|
2019-07-27 01:37:47 +00:00
|
|
|
spriteindex @ drawfatsprite
|
2019-07-28 22:40:13 +00:00
|
|
|
lcolor @ 77 0 drawfatbox
|
|
|
|
rcolor @ 78 0 drawfatbox
|
2019-07-27 01:37:47 +00:00
|
|
|
draw-palette
|
|
|
|
mouseshow
|
|
|
|
0 refresh-needed !
|
|
|
|
then ;
|
2019-07-24 02:39:56 +00:00
|
|
|
|
2019-07-28 22:40:13 +00:00
|
|
|
: jiles
|
|
|
|
^TAB key-pressed if
|
|
|
|
' draw definition jiles-old-draw !
|
|
|
|
' tick definition jiles-old-tick !
|
|
|
|
' jiles-draw ' draw redefine
|
|
|
|
' jiles-tick ' tick redefine
|
|
|
|
fuck mouseshow refresh
|
|
|
|
then ;
|