diff --git a/game.exe b/game.exe index a08bb19..ec179c1 100755 Binary files a/game.exe and b/game.exe differ diff --git a/game.jor b/game.jor index e4686d8..aac990d 100755 --- a/game.jor +++ b/game.jor @@ -129,7 +129,7 @@ player :tick : mode-move entities each EVTICK entity>do more party each EVTICK entity>do more - tick-mapedit + tick-mapedit jiles tick-debounce q-level @ dup if 0 q-level ! diff --git a/game.prj b/game.prj index 3fad828..7375410 100755 Binary files a/game.prj and b/game.prj differ diff --git a/gameboot.jor b/gameboot.jor index 475b430..0a0aaf0 100755 --- a/gameboot.jor +++ b/gameboot.jor @@ -21,6 +21,7 @@ s" timer.jor" loadfile s" entity.jor" loadfile s" footer.jor" loadfile s" map.jor" loadfile +s" jiles.jor" loadfile s" state.jor" loadfile s" game.jor" loadfile ; execute diff --git a/input.jor b/input.jor index 6ec48a2..95d7763 100755 --- a/input.jor +++ b/input.jor @@ -1,5 +1,6 @@ ( K E Y B O A R D ) 1 const ^ESC +15 const ^TAB 28 const ^ENTER 29 const ^CTRL 51 const ^< diff --git a/jiles.jor b/jiles.jor index 4dfe8b3..fb78efc 100755 --- a/jiles.jor +++ b/jiles.jor @@ -1,62 +1,70 @@ -: blah ' seremit task-emit ! ; -blah - -s" game.log" open seekend fdeactivate const LOGFILE -: emit-log ' fputc LOGFILE withfp ; -: atexit LOGFILE factivate close ; - -: start-repl activate blah ' emit-log task-echo ! - s" .:: J O R T H ( jean forth) ::." type cr - begin receive loadstring s" ok" type cr again ; -task const REPL -REPL start-repl - -intern input.jor -input.jor loadfile - -var color +var lcolor 0x0f lcolor ! +var rcolor 0x10 rcolor ! var spriteindex var refresh-needed : refresh 1 refresh-needed ! ; -: color! dup color @ = if drop else color ! refresh then ; +: color! >r dup r@ @ = if drop else r@ ! refresh then rdrop ; + : +sprite! spriteindex spritecount +!cycle refresh ; : draw-palette 0 0x11 for i 79 i 3 << drawfatbox next ; : mousepos>sprpos 3 >> swap 3 >> swap ; : mousexys mousepos mousepos>sprpos spriteindex @ ; -: tick + +: mousepixel! ( color -- ) + >r mousexys getpixel r@ != if + r@ mousexys putpixel refresh + then rdrop ; + +var jiles-old-tick +var jiles-old-draw + +44 const ^Z +45 const ^X +31 const ^S + +: jiles-tick mousepos 128 < swap 128 < and if - MOUSEL mousedown if - mousexys getpixel color @ != if - color @ mousexys putpixel - refresh - then - then - MOUSER clicked if - mousexys getpixel color! - then + MOUSEL mousedown if lcolor @ mousepixel! then + MOUSER mousedown if rcolor @ mousepixel! then then mousepos 136 < swap 312 >= and if - mousepos swap drop 3 >> - MOUSEL mousedown if color! else drop then + mousepos swap drop 3 >> dup + MOUSEL mousedown if lcolor color! else drop then + MOUSER mousedown if rcolor color! else drop then then ^LEFT key-pressed if -1 +sprite! then ^RIGHT key-pressed if 1 +sprite! then + ^Z key-pressed if mousexys getpixel lcolor color! then + ^X key-pressed if mousexys getpixel rcolor color! then + ^S key-pressed if s" SAVING" type cr savegfx then + ^TAB key-pressed if + jiles-old-draw @ ' draw redefine + jiles-old-tick @ ' tick redefine + mousehide unfuck invalidate-map + then tick-debounce ; -: draw +: jiles-draw refresh-needed @ if mousehide spriteindex @ drawfatsprite - color @ 78 0 drawfatbox + lcolor @ 77 0 drawfatbox + rcolor @ 78 0 drawfatbox draw-palette mouseshow 0 refresh-needed ! then ; -mouseshow -refresh +: 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 ; diff --git a/sprite.gfx b/sprite.gfx index 9a659ef..74cbaa6 100755 Binary files a/sprite.gfx and b/sprite.gfx differ diff --git a/testbed.c b/testbed.c index 584ce39..f32be07 100755 --- a/testbed.c +++ b/testbed.c @@ -369,12 +369,18 @@ void f_savegfx() { void f_mousehide() { mouse_hide(); } + void f_mouseshow() { + mouse_show(); +} + +void f_resetvideo() { setLogicalWidth(SCREEN_STRIDE >> 1); setResetEnabledCached(0); setWriteMode(0); setAllPlanes(); - mouse_show(); + setDisplayOffset(0); + setHorizontalPan(0); } void f_putpixel() { @@ -441,6 +447,7 @@ void game_f_init(char *exe, char *bootjor) { CDEF("loadtiles", f_loadtiles); CDEF("glitch", f_glitch); CDEF("unfuck", tile_init); + CDEF("fuck", f_resetvideo); CDEF("mouseshow", f_mouseshow); CDEF("mousehide", f_mousehide);