level 6 cleanup, fix keyboard debounce
This commit is contained in:
parent
60f6e348ad
commit
89aee929eb
BIN
entity.jim
BIN
entity.jim
Binary file not shown.
BIN
footer.jim
BIN
footer.jim
Binary file not shown.
3
game.jor
3
game.jor
|
@ -165,6 +165,9 @@ defer on-gord-sit
|
||||||
then ;
|
then ;
|
||||||
var hack-handled
|
var hack-handled
|
||||||
: hacked 1 hack-handled ! ;
|
: hacked 1 hack-handled ! ;
|
||||||
|
: hack-override? ( e -- e b )
|
||||||
|
dup EVHACK = if hacked drop EVNOP 1 else 0 then ;
|
||||||
|
|
||||||
: activate-libb
|
: activate-libb
|
||||||
haslibb? if Libb entity-present? not if
|
haslibb? if Libb entity-present? not if
|
||||||
:| 0 hack-handled !
|
:| 0 hack-handled !
|
||||||
|
|
19
kbd.c
19
kbd.c
|
@ -35,12 +35,29 @@ static void interrupt kbd_isr() {
|
||||||
enable();
|
enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char kbd_wait() {
|
unsigned char kbd_wait_raw() {
|
||||||
kbd_triggered = 0;
|
kbd_triggered = 0;
|
||||||
while (!kbd_triggered) {}
|
while (!kbd_triggered) {}
|
||||||
return kbd_triggered;
|
return kbd_triggered;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned char kbd_any() {
|
||||||
|
unsigned char key;
|
||||||
|
kbd_debounce();
|
||||||
|
for (key = 0; key < 128; key ++) {
|
||||||
|
if (keybuf[key] != KEY_OFF) {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0xff;
|
||||||
|
}
|
||||||
|
unsigned char kbd_wait() {
|
||||||
|
unsigned char found = kbd_any();
|
||||||
|
for (; found != 0xff; found = kbd_any()) {}
|
||||||
|
for (; found == 0xff; found = kbd_any()) {}
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
void kbd_init() {
|
void kbd_init() {
|
||||||
if (oldKbdISR == NULL) {
|
if (oldKbdISR == NULL) {
|
||||||
memset(keybuf, 0, 128);
|
memset(keybuf, 0, 128);
|
||||||
|
|
3
kbd.h
3
kbd.h
|
@ -17,7 +17,8 @@ unsigned char kbd_wait();
|
||||||
|
|
||||||
#define keyIsDown(k) (keybuf[k] & KEY_SIGNAL)
|
#define keyIsDown(k) (keybuf[k] & KEY_SIGNAL)
|
||||||
#define keyWasPressed(k) ((keybuf[k] & 0x0f) == KEY_PRESSED)
|
#define keyWasPressed(k) ((keybuf[k] & 0x0f) == KEY_PRESSED)
|
||||||
#define consumeKey(k) (keybuf[k] = keyWasPressed(k) ? KEY_DOWN : keybuf[k])
|
#define consumeKey(k) (keybuf[k] = keyWasPressed(k) ? \
|
||||||
|
KEY_DOWN | (keybuf[k] & KEY_SIGNAL ) : keybuf[k])
|
||||||
#define keyWasReleased(k) ((keybuf[k] & 0x0f) == KEY_RELEASED)
|
#define keyWasReleased(k) ((keybuf[k] & 0x0f) == KEY_RELEASED)
|
||||||
|
|
||||||
#define K_ESC 1
|
#define K_ESC 1
|
||||||
|
|
BIN
lev00006.jim
BIN
lev00006.jim
Binary file not shown.
79
lev00006.jor
79
lev00006.jor
|
@ -69,7 +69,7 @@ var pady-introduced
|
||||||
18 1 defrexx r1
|
18 1 defrexx r1
|
||||||
|
|
||||||
3 1 door d1
|
3 1 door d1
|
||||||
17 1 door d2
|
16 1 door d2
|
||||||
4 11 door d3
|
4 11 door d3
|
||||||
10 9 door d4
|
10 9 door d4
|
||||||
16 11 door d5
|
16 11 door d5
|
||||||
|
@ -87,18 +87,18 @@ defer term-loop
|
||||||
|
|
||||||
: ret-if-on ( e -- ) dup computer-on? if rdrop else drop then ;
|
: ret-if-on ( e -- ) dup computer-on? if rdrop else drop then ;
|
||||||
: first-on ( -- e )
|
: first-on ( -- e )
|
||||||
c1 ret-if-on c2 ret-if-on c3 ret-if-on c4 ret-if-on c5 ret-if-on
|
c1 ret-if-on cx ret-if-on c2 ret-if-on c3 ret-if-on c4 ret-if-on
|
||||||
c6 ret-if-on c7 ret-if-on c8 ret-if-on c9 ret-if-on cx ret-if-on 0 ;
|
c5 ret-if-on c6 ret-if-on c7 ret-if-on c8 ret-if-on c9 ret-if-on 0 ;
|
||||||
defer cmp-next-on
|
defer cmp-next-on
|
||||||
: next-on ( e -- e )
|
: next-on ( e -- e )
|
||||||
:| over = if drop ' ret-if-on ' cmp-next-on redefine then |; ' cmp-next-on redefine
|
:| over = if drop ' ret-if-on ' cmp-next-on redefine then |; ' cmp-next-on redefine
|
||||||
c1 cmp-next-on c2 cmp-next-on c3 cmp-next-on c4 cmp-next-on c5 cmp-next-on
|
c1 cmp-next-on cx cmp-next-on c2 cmp-next-on c3 cmp-next-on c4 cmp-next-on
|
||||||
c6 cmp-next-on c7 cmp-next-on c8 cmp-next-on c9 cmp-next-on cx cmp-next-on
|
c5 cmp-next-on c6 cmp-next-on c7 cmp-next-on c8 cmp-next-on c9 cmp-next-on
|
||||||
first-on ;
|
first-on ;
|
||||||
:noname responder next-on ; ' term-loop redefine
|
:noname responder next-on ; ' term-loop redefine
|
||||||
|
|
||||||
5197 ' d1 3 2 keypad k1
|
5197 ' d1 3 2 keypad k1
|
||||||
-1 ' d2 17 2 keypad k2 ( must be hacked )
|
-1 ' d2 16 2 keypad k2 ( must be hacked )
|
||||||
2757 ' d3 4 10 keypad k3
|
2757 ' d3 4 10 keypad k3
|
||||||
7777 ' d5 16 10 keypad k5
|
7777 ' d5 16 10 keypad k5
|
||||||
|
|
||||||
|
@ -110,7 +110,11 @@ defer cmp-next-on
|
||||||
LEV_END 13 12 exitdoor dx
|
LEV_END 13 12 exitdoor dx
|
||||||
' dx 14 12 scanner sx
|
' dx 14 12 scanner sx
|
||||||
|
|
||||||
c1 :noname dup chain-listener EVACT = if
|
c1 :noname hack-override? if
|
||||||
|
libb say" just a bunch of boring\source code."
|
||||||
|
libb say" bill didn't leave anything\really juicy here where\other people could get at it."
|
||||||
|
then
|
||||||
|
dup chain-listener EVACT = if
|
||||||
term say" .:: welcome to farquaad ::.\please select your choice:"
|
term say" .:: welcome to farquaad ::.\please select your choice:"
|
||||||
0 begin :|
|
0 begin :|
|
||||||
s" about farquaad" :|
|
s" about farquaad" :|
|
||||||
|
@ -118,7 +122,7 @@ c1 :noname dup chain-listener EVACT = if
|
||||||
term say" don't mess with it!!!"
|
term say" don't mess with it!!!"
|
||||||
|; yield
|
|; yield
|
||||||
s" s3cr3t c0d3z" :| term say" get out lamer" |; yield
|
s" s3cr3t c0d3z" :| term say" get out lamer" |; yield
|
||||||
s" boss key" :| term say" press f9 to activate" |; yield
|
s" boss key" :| term say" press f9 to activate\at any time" |; yield
|
||||||
s" open pod bay doors" :| term say" i can't do that dave" |; yield
|
s" open pod bay doors" :| term say" i can't do that dave" |; yield
|
||||||
s" log off" :| term say" good riddance" drop 1 |; yield
|
s" log off" :| term say" good riddance" drop 1 |; yield
|
||||||
done |; choose
|
done |; choose
|
||||||
|
@ -141,7 +145,7 @@ c3 :noname dup chain-listener EVACT = if
|
||||||
else
|
else
|
||||||
term say" The passcode is 5197."
|
term say" The passcode is 5197."
|
||||||
then
|
then
|
||||||
term say" Subject: re: RE: Server's down\Uhhh the firewall blocked\the passcode?"
|
term say" Subject: re: RE: Server's down\Uhhh the firewall is blocking\the passcode?"
|
||||||
term say" Subject: re: RE: Server's down\AUGH FINE I rebooted it."
|
term say" Subject: re: RE: Server's down\AUGH FINE I rebooted it."
|
||||||
then ;
|
then ;
|
||||||
|
|
||||||
|
@ -178,13 +182,52 @@ c4 :noname
|
||||||
libb say" aww yiss."
|
libb say" aww yiss."
|
||||||
libb say" press z when you need me\to mess with something."
|
libb say" press z when you need me\to mess with something."
|
||||||
then
|
then
|
||||||
then then chain-listener ;
|
then then
|
||||||
|
hack-override? if
|
||||||
|
libb say" i brought everything good\along with me, don't worry."
|
||||||
|
then chain-listener ;
|
||||||
|
|
||||||
c5 :noname dup chain-listener EVACT = if
|
c5 :noname dup chain-listener EVACT = if
|
||||||
|
gord say" A weird looking spreadsheet..."
|
||||||
|
gord say" Oh wait, I pressed a key and\it disappeared. Someone using\the boss key to hide"
|
||||||
|
gord say" that they're reading the entire\archive of User Friendly comic\strips."
|
||||||
then ;
|
then ;
|
||||||
|
|
||||||
c6 :noname dup chain-listener EVACT = if
|
c6 :noname hack-override? if
|
||||||
|
libb say" hehehe, that was a fun one."
|
||||||
|
then
|
||||||
|
dup chain-listener EVACT = if
|
||||||
|
term say" Subject: Card scanners?\Looks like the scanners are\on the fritz again..."
|
||||||
|
term say" I scanned my keycard to get\into the office and the door\wouldn't close!"
|
||||||
|
term say" Someone's gotta fix that ASAP,\it's a serious security problem!"
|
||||||
|
term say" Subject: re: Card scanners?\I can take a quick look, I\might have an idea as to"
|
||||||
|
term say" what's going on.\ -- Bill"
|
||||||
|
then ;
|
||||||
|
|
||||||
|
c7 :noname hack-override? if
|
||||||
|
libb say" you know the switch is right\there on the wall, right?"
|
||||||
|
then
|
||||||
|
dup EVTOUCH = if isprog? not if
|
||||||
|
b2 switch-on? if
|
||||||
|
term say" WorkSecure (tm) v2.0\AUTHORIZED PERSONNEL ONLY"
|
||||||
|
term say" Actively neutralizing:\1 threat(s)"
|
||||||
|
else
|
||||||
|
jaye say" Looks like the power is cut."
|
||||||
|
then
|
||||||
|
drop EVNOP
|
||||||
|
then then chain-listener ;
|
||||||
|
|
||||||
|
c8 :noname dup chain-listener EVACT = if
|
||||||
|
term say" Subject: Password security\A reminder to all developers\about security best practice:"
|
||||||
|
term say" DO NOT WRITE DOWN PASSWORDS!\We pay significant license fees\for encrypted password"
|
||||||
|
term say" managers for all employees!\Use it to generate and store\secure passwords!"
|
||||||
|
jaye say" There's a sticky note attached\to the monitor that says\'7777'."
|
||||||
|
then ;
|
||||||
|
|
||||||
|
c9 :noname hack-override? if
|
||||||
|
libb say" he's just being dramatic."
|
||||||
|
then
|
||||||
|
dup chain-listener EVACT = if
|
||||||
term say" Subject: Experiment\Hey folks, can you all do me a\huge favour?"
|
term say" Subject: Experiment\Hey folks, can you all do me a\huge favour?"
|
||||||
term say" There was a small bug in my\code (yes, it happens!) and a\program I was working on"
|
term say" There was a small bug in my\code (yes, it happens!) and a\program I was working on"
|
||||||
term say" made a few too many copies of\itself. Can everyone check to\see if you have a process"
|
term say" made a few too many copies of\itself. Can everyone check to\see if you have a process"
|
||||||
|
@ -193,18 +236,6 @@ c6 :noname dup chain-listener EVACT = if
|
||||||
term say" It could seriously mess with\your system.\ -- Bill"
|
term say" It could seriously mess with\your system.\ -- Bill"
|
||||||
then ;
|
then ;
|
||||||
|
|
||||||
c7 :noname dup chain-listener EVTOUCH = if isprog? not if
|
|
||||||
term say" WorkSecure (tm) v2.0\AUTHORIZED PERSONNEL ONLY"
|
|
||||||
term say" Actively neutralizing:\1 threat(s)"
|
|
||||||
then then ;
|
|
||||||
|
|
||||||
c8 :noname dup chain-listener EVACT = if
|
|
||||||
term say" Subject: Password security\A reminder to all developers\about security best practice:"
|
|
||||||
term say" DO NOT WRITE DOWN PASSWORDS!\We pay significant license fees\for encrypted password"
|
|
||||||
term say" managers for all employees!\Use it to generate and store\secure passwords!"
|
|
||||||
gord say" There's a sticky note attached\to the monitor that says\'7777'."
|
|
||||||
then ;
|
|
||||||
|
|
||||||
cx :noname dup EVTOUCH = if isprog? not if b1 switch-on? not if
|
cx :noname dup EVTOUCH = if isprog? not if b1 switch-on? not if
|
||||||
jaye say" This is the sign-in terminal\used by visitors."
|
jaye say" This is the sign-in terminal\used by visitors."
|
||||||
jaye say" It's not turning on for some\reason."
|
jaye say" It's not turning on for some\reason."
|
||||||
|
|
BIN
lev00006.map
BIN
lev00006.map
Binary file not shown.
BIN
neuttowr.exe
BIN
neuttowr.exe
Binary file not shown.
BIN
neuttowr.prj
BIN
neuttowr.prj
Binary file not shown.
Loading…
Reference in a new issue