neuttower/lev00001.jor

101 lines
2.7 KiB
Plaintext
Executable file

( L E V E L 0 0 0 0 1 )
: intro
30 sleep
1 quaking !
30 sleep
jaye say" Woah!!..."
hide-footer
10 sleep
0 quaking !
jaye say" That was an earthquake!"
;
4 const COMP-OFF
5 const COMP-ON
9 const DOOR-CLOSED
10 const DOOR-OPENED
11 const SWITCH-OFF
12 const SWITCH-ON
: entity>tile ( entity -- tile ) entity>pos world>tile tile ;
: entity>tile? ( entity expected - b ) swap entity>tile b@ = ;
: toggleval ( off on val -- off|on ) over = not if swap then drop ;
: toggletile ( entity off on -- )
<rot >r r@ entity>tile b@ toggleval <r entity>tile b! invalidate-map ;
: respondertile! ( tile -- ) responder entity>tile b! invalidate-map ;
: handle-onoff ( ev on off -- )
<rot dup EVDEACT = if drop swap drop respondertile! else
dup EVACT = if drop drop respondertile! else
dup EVTOG = if drop responder >rot toggletile else
drop drop drop then then then ;
: statechange? ( ev -- b )
dup EVACT = over EVDEACT = or swap EVTOG = or ;
: blankentity array here >r N ' {blank} allotentity <r ;
: door blankentity
:| dup EVTOUCH = isjaye? and responder DOOR-OPENED entity>tile? and if
move-player
then
DOOR-OPENED DOOR-CLOSED handle-onoff
|; swap ! ;
: handle-link ( ev ontile -- )
swap statechange? if
responder swap entity>tile? if EVACT else EVDEACT then
responder entity.user @ swap entity>do
else drop then ;
: switch blankentity swap ,
:| dup EVTOUCH = isneut? and if move-player then
dup EVTOUCH = if responder EVTOG entity>do then
dup SWITCH-ON SWITCH-OFF handle-onoff
SWITCH-ON handle-link |; swap ! ;
: computer blankentity swap ,
:| dup EVTOUCH = isjaye? and if responder EVACT entity>do then
dup EVTOUCH = isneut? and if move-player then
dup COMP-ON COMP-OFF handle-onoff
COMP-ON handle-link |; swap ! ;
: chainev ( entity xp -- ) swap dup @ , ! ; immediate
12 9 door d1
d1 :noname
dup EVTOUCH = isjaye? and d1 DOOR-CLOSED entity>tile? and if
jaye say" It won't open!"
then chainev ;
d1 12 8 switch s1
0 15 8 computer c1
7 6 door d2
d2 6 6 switch s2
c1 :noname
dup EVTOUCH = isjaye? and if
player.state HASNEUT f@ not if
jaye say" Maybe Neut can help."
neut say" NEUT v0.71.4rc12\ONLINE"
neut say" PRESS SPACE TO TAKE CONTROL"
c1 entity>pos pneut entity.pos!
1 player.state HASNEUT f!
else
jaye say" Neut is running now.\I can hit the space bar\to control them."
then
then chainev ;
:noname
reset-level
:| d1 yield s1 yield c1 yield d2 yield s2 yield done |; ' entities redefine
:| touch-begin 15 8 2= dup if
then touch-last |; ' jaye-touch redefine
s" lev00001.map" load-map
( ' intro sched )
; ' onload redefine