diff --git a/boot.jim b/boot.jim index 4a4ad68..907f1f7 100755 Binary files a/boot.jim and b/boot.jim differ diff --git a/debug.jim b/debug.jim index 40e8fe1..47d874f 100755 Binary files a/debug.jim and b/debug.jim differ diff --git a/debug.jor b/debug.jor index 52584b8..22d94de 100755 --- a/debug.jor +++ b/debug.jor @@ -12,7 +12,7 @@ defer dbg-cmd dup $DOCOLON = if drop else dup $DOCREATE = if drop @ else $DODEFERRED = if @ dbg-first-ip else - drop 0 then then then ; + drop 0 then then then ; userword : tail :| rdrop dbg-first-ip >r |; , [ ' [ , ] ; immediate @@ -84,11 +84,14 @@ array breakpoints bp, bp, bp, bp, bp, : set-next-breakpoint ( ip -- ) free-breakpoint >r r@ breakpoint# reset-breakpoint - : create-object blankentity dup link-object ; : create-linked-object blankentity swap , dup link-object ; +: create-extra-linked-object blankentity swap , swap , + dup link-object ; : create-timed-object blankentity swap , swap , 0 , dup link-object obj-ticking! ; diff --git a/gameboot.jor b/gameboot.jor index c2d989f..3133d69 100755 --- a/gameboot.jor +++ b/gameboot.jor @@ -19,6 +19,8 @@ defer tick defer draw defer loadlevel +task :noname activate blah begin tick suspend again ; execute + :noname s" input.jor" loadfile s" timer.jor" loadfile @@ -33,6 +35,8 @@ s" game.jor" loadfile s" debug.jor" loadfile ; execute +task :noname activate blah begin draw suspend again ; execute + ' load-new-level checkpoint _loadlevel ' _loadlevel ' loadlevel redefine diff --git a/input.jim b/input.jim index 88d958c..5f0fac9 100755 Binary files a/input.jim and b/input.jim differ diff --git a/jiles.jim b/jiles.jim index ead598b..6dc40ff 100755 Binary files a/jiles.jim and b/jiles.jim differ diff --git a/jiles.jor b/jiles.jor index 98f2729..7833ddf 100755 --- a/jiles.jor +++ b/jiles.jor @@ -3,7 +3,9 @@ var rcolor 0x10 rcolor ! var spriteindex var refresh-needed +var spritedirty : refresh 1 refresh-needed ! ; +: refresh-xy spritedirty 1 + b! spritedirty b! 2 refresh-needed ! ; array preview 128 allot @@ -30,7 +32,8 @@ array preview 128 allot : mousepixel! ( color -- ) >r mousexys getpixel r@ != if - r@ mousexys putpixel refresh + r@ mousexys putpixel + mousepos mousepos>sprpos refresh-xy then rdrop ; : gfxfilename @@ -96,7 +99,11 @@ var copysrc refresh-needed @ if mousehide draw-preview - spriteindex @ drawfatsprite + refresh-needed @ 2 = if + spritedirty b@ spritedirty 1 + b@ spriteindex @ drawfatspritepixel + else + spriteindex @ drawfatsprite + then lcolor @ 77 0 drawfatbox rcolor @ 78 0 drawfatbox draw-palette diff --git a/job.jim b/job.jim index 7d46002..c996f87 100755 Binary files a/job.jim and b/job.jim differ diff --git a/jorth.h b/jorth.h index 9cee4f8..27235cb 100755 --- a/jorth.h +++ b/jorth.h @@ -1,6 +1,7 @@ + #include -#define MEM_SIZE 24576 +#define MEM_SIZE 28762 #define STACK_SIZE 64 #define RSTACK_SIZE 64 diff --git a/lev00001.jim b/lev00001.jim deleted file mode 100755 index cba1b68..0000000 Binary files a/lev00001.jim and /dev/null differ diff --git a/lev00003.jim b/lev00003.jim deleted file mode 100755 index 755319d..0000000 Binary files a/lev00003.jim and /dev/null differ diff --git a/lev00004.jim b/lev00004.jim deleted file mode 100755 index ac0a4db..0000000 Binary files a/lev00004.jim and /dev/null differ diff --git a/lev00005.jim b/lev00005.jim deleted file mode 100755 index 4fbccdc..0000000 Binary files a/lev00005.jim and /dev/null differ diff --git a/lev00005.jor b/lev00005.jor index 04d4228..4faf39d 100755 --- a/lev00005.jor +++ b/lev00005.jor @@ -11,7 +11,7 @@ lazy 60 over 19 9 timedswitch ts 10 9 door d2 5 6 door d3 >lazy! 10 2 door d4 -LEV_END 5 12 exitdoor dx +6 5 12 exitdoor dx lazy dup 11 3 computer c1 ' c1 7 11 computer c2 >lazy! diff --git a/lev00006.jim b/lev00006.jim index edb7f3c..f8f54de 100755 Binary files a/lev00006.jim and b/lev00006.jim differ diff --git a/lev00006.jor b/lev00006.jor index 13a4e69..baab093 100755 --- a/lev00006.jor +++ b/lev00006.jor @@ -1,8 +1,66 @@ ( L E V E L 0 0 0 0 6 ) -:noname +objects: O + +2 const ^1 +30 const code-y +20 const code-x + +: wait-for-digit ( -- n ) + 0 begin suspend ^1 dup 11 + for i key-pressed if drop i then next dup until + ^1 - 1 + dup 10 = if drop 0 then ; +: draw-digit ( x n -- ) code-y swap 48 + text-color @ textc ; +: code-digit ( code x -- code ) + wait-for-digit swap code-x + over draw-digit swap 10 * + ; + +: read-code ( -- n ) + WHITE text-color ! + s" ####" code-x code-y textxy + 0 0 code-digit + 1 code-digit + 2 code-digit + 3 code-digit ; + +var pady-introduced +: keypad-code responder entity.user cell + @ ; +: keypad create-extra-linked-object + :| dup EVTOUCH = if + pady-introduced @ not if + pady say" Hello, stranger! I'm Pady,\the friendly keypad lock!" + jaye say" I need to get through this\door, Pady." + pady say" You didn't say the magic\word, stranger!" + 1 pady-introduced ! + then + isneut? if move-player then + PAD-OFF responder>tile? if + runon pady say" Enter your 4-digit door code!\And have a super day!" + read-code keypad-code = if + pady say" That's right! Hooray!\You get a gold star!" + drop EVACT + else + pady say" Ohhh, sorry! That's not it.\Better luck next time!" + then + else + pady say" Oh hi again! I missed you too!" + then + then + dup PAD-ON PAD-OFF handle-onoff + PAD-ON handle-link |; listener! ; + +3 1 door d1 +17 1 door d2 +4 11 door d3 +10 9 door d4 + +1234 ' d1 3 2 keypad k1 +-1 ' d2 17 2 keypad k2 ( must be hacked ) +3456 ' d3 4 10 keypad k3 + +LEV_END 13 12 exitdoor dx +' dx 14 12 scanner sx + +:noname O 5 1 tile>world Jaye entity.pos! 4 0 tile>world Neut entity.pos! with-gord - ; ' onload redefine diff --git a/lev16597.jim b/lev16597.jim deleted file mode 100755 index b4d632f..0000000 Binary files a/lev16597.jim and /dev/null differ diff --git a/lev16597.jor b/lev16597.jor deleted file mode 100755 index e69de29..0000000 diff --git a/lev16603.jim b/lev16603.jim deleted file mode 100755 index 60a0e98..0000000 Binary files a/lev16603.jim and /dev/null differ diff --git a/lev16603.jor b/lev16603.jor deleted file mode 100755 index e69de29..0000000 diff --git a/lev16625.jor b/lev16625.jor deleted file mode 100755 index e69de29..0000000 diff --git a/lev16631.jor b/lev16631.jor deleted file mode 100755 index e69de29..0000000 diff --git a/level.jim b/level.jim index 7b4f45e..75052db 100755 Binary files a/level.jim and b/level.jim differ diff --git a/map.jim b/map.jim index 3544aec..7aaae41 100755 Binary files a/map.jim and b/map.jim differ diff --git a/map.jor b/map.jor index fe7f578..8aa8f70 100755 --- a/map.jor +++ b/map.jor @@ -34,7 +34,8 @@ array tileflags ( 21:scanner-on ) NEUTABLE b, ( 22:cracked-wall ) 0 b, ( 23:rexx-pod ) NEUTABLE b, -( 24:keypad ) NEUTABLE b, +( 24:keypad-off ) NEUTABLE b, +( 25:keypad-on ) NEUTABLE b, here tileflags - 1 - const MAXTILE @@ -49,6 +50,8 @@ here tileflags - 1 - const MAXTILE 20 const SCAN-OFF 21 const SCAN-ON 23 const REXX-POD +24 const PAD-OFF +25 const PAD-ON : mapflag? ( x y flag -- b ) >rot tile b@ tileflags + b@ & ; diff --git a/neuttowr.exe b/neuttowr.exe index 206f56c..b386fcc 100755 Binary files a/neuttowr.exe and b/neuttowr.exe differ diff --git a/neuttowr.prj b/neuttowr.prj index be3d990..501418c 100755 Binary files a/neuttowr.prj and b/neuttowr.prj differ diff --git a/portrait.gfx b/portrait.gfx index e9b95b8..f969436 100755 Binary files a/portrait.gfx and b/portrait.gfx differ diff --git a/state.jim b/state.jim index ff58fa7..8aa7366 100755 Binary files a/state.jim and b/state.jim differ diff --git a/testbed.c b/testbed.c index da126fb..be18cb5 100755 --- a/testbed.c +++ b/testbed.c @@ -449,6 +449,29 @@ void f_drawfatsprite() { } } +void f_drawfatspritepixel() { + int x = ST2().i; + int y = ST1().i; + unsigned int far *spr = getTarget(TOP().i); + DROP(3); + + if (editTarget != ET_PORTRAIT) { + int color = getsprpixel(x, y, spr); + + setAllPlanes(); + drawFatBox(x, y << 3, color); + } else { + int colorl, colorr; + + x = x & 0xfffe; + colorl = getsprpixel( x, y, spr); + colorr = getsprpixel(x + 1, y, spr); + + drawDoubleFatBox(x >> 1, y << 2, colorl, colorr); + setAllPlanes(); + } +} + void f_drawfatbox() { drawFatBox(ST1().i, TOP().i, ST2().i); DROP(3); @@ -690,6 +713,7 @@ void game_f_init(char *exe, char *bootjor) { CDEF("mouseshow", f_mouseshow); CDEF("mousehide", f_mousehide); CDEF("drawfatsprite", f_drawfatsprite); + CDEF("drawfatspritepixel", f_drawfatspritepixel); CDEF("drawfatbox", f_drawfatbox); CDEF("putpixel", f_putpixel); CDEF("getpixel", f_getpixel); @@ -748,7 +772,6 @@ void do_repl(char *exe) { } int main(int argc, char *argv[]) { - cell tick, draw; char *bootjor = "gameboot.jor"; if (argc > 1) { @@ -758,15 +781,11 @@ int main(int argc, char *argv[]) { ser_init(SER_COM2, BAUD_19200, SER_8N1); game_init(); game_f_init(argv[0], bootjor); - tick = f_lookupcp("tick"); - draw = f_lookupcp("draw"); while (!keyIsDown(K_ESC)) { kbd_debounce(); f_poll(); - f_execcp(tick); f_taskloop(); - f_execcp(draw); } return 0; diff --git a/timer.jim b/timer.jim index dbe4169..50da0d2 100755 Binary files a/timer.jim and b/timer.jim differ