complete chuck arc, complete rename of state to flag

This commit is contained in:
Jeremy Penner 2019-05-20 15:12:25 -04:00
parent edf0a91f71
commit 69bab3aacd
7 changed files with 61 additions and 32 deletions

View file

@ -14,8 +14,8 @@ car :touch
:noname
0 player.state DRIVING f!
:| CHUCK-HOME state@ if e_chuck yield then
player.driving? not if car yield then
:| CHUCK-HOME flag@ if e_chuck yield then
player.driving? not CHUCK-FOLLOW flag@ not and if car yield then
done |; ' entities redefine
:|
@ -27,13 +27,13 @@ touch-begin S leaving? dup
then
touch-next 6 21 2= dup
if player.driving? not
if CHUCK-FOLLOW state@ not if
if CHUCK-FOLLOW flag@ not if
noone say" * knock knock *"
clear 30 sleep
pete say" Nobody home, I guess."
jeanne say" Go away before I call the\cops, Pete!"
pete say" Oh.\I guess she's still mad."
JEANNE-ANGRY setstate
JEANNE-ANGRY setflag
else
pete say" I brought you your\damn horse, Jeanne!"
jeanne say" Oh my God. Is he okay?\Hold on, I'm coming outside."
@ -46,7 +46,7 @@ touch-next 6 21 2= dup
jeanne say" Don't think for a MINUTE\I'm not still furious at you."
jeanne say" If I catch you on my property\again, I *will* call the cops."
pete say" Alright, alright, I'm going!\Christ, no good deed goes\unpunished."
CHUCK-HOME setstate CHUCK-FOLLOW clearstate
CHUCK-HOME setflag CHUCK-FOLLOW clearflag
10 6 petehous.jor queue-level
then
else

View file

@ -1,19 +1,26 @@
( P E T E )
13 8 N ' {car} defentity car
32 5 W ' {horse} defentity e_chuck
car :touch
move-player
1 player.state DRIVING f!
;entity
e_chuck :touch
pete say" It's good to have you\back, Chuck."
chuck say" * w h i n n y *\(I remember this place...)"
;entity
:noname
:| player.driving? not if car yield then
:| player.driving? not CHUCK-FOLLOW flag@ not and if car yield then
CHUCK-STOLEN flag@ if e_chuck yield then
done |; ' entities redefine
:|
touch-begin S leaving? dup
if player.driving? not
if player.driving? not CHUCK-FOLLOW flag@ not and
if pete say" It's too far to walk to town."
else move-player 5 10 road.jor queue-level
then
@ -24,6 +31,14 @@ touch-next 13 8 2= player.driving? and dup
W player entity.dir !
move-player
then
touch-next 19 9 2= CHUCK-FOLLOW flag@ and player entity.dir @ E = and dup
if pete say" Hmm, yeah, lots of good\grazing over here..."
say" Let's get you comfy, Chuck." move-player then
touch-next 22 9 2= CHUCK-FOLLOW flag@ and dup
if pete say" Welcome home, old buddy."
chuck say" * n e i g h *\(OK, Pete.)"
CHUCK-FOLLOW clearflag CHUCK-STOLEN setflag
13 7 petehous.jor queue-level then
touch-next 12 7 2= player.driving? not and dup
if move-player 16 9 petehous.jor queue-level then
touch-next 30 7 2= dup

View file

@ -17,7 +17,7 @@ s" [don't pick up]"
s" Hey Pete, what's up?"
:| pete say" Not much, old friend!"
0 begin phone :|
JEANNE-ANGRY state@ CHUCK-GONE state@ not and if
JEANNE-ANGRY flag@ CHUCK-GONE flag@ not and if
s" I hear Jeanne's awful mad\at you!"
:| pete say" Ohh, she'll come round."
phone say" What'd you do, anyway?"
@ -44,14 +44,28 @@ s" Hey Pete, what's up?"
pete say" I figured he just went home!\But when I went to Jeanne's,\he wasn't there."
phone say" You lost him."
pete say" He's a smart old goat,\just like me. He'll\turn up soon."
CHUCK-GONE setstate
CHUCK-GONE setflag
|; yield
then
CHUCK-GONE state@ if
CHUCK-GONE flag@ if
s" You found Chuck yet?"
:| pete say" I'm sure he'll turn up soon!\Sheesh, get off my back." |; yield
then
CHUCK-FOLLOW flag@ if
s" You found Chuck yet?"
:| pete say" He's right here."
chuck say" * s n o r t *"
phone say" You brought him in your house??"
phone say" Of course you did.\Never mind.\Don't even bother explaining."
|; yield
then
CHUCK-STOLEN flag@ CHUCK-HOME flag@ or CHUCK-EXPLAINED flag@ not and if
s" You found Chuck yet?"
:| pete say" He found his way home."
phone say" Well, thank goodness\for that."
CHUCK-EXPLAINED setflag
|; yield
then
s" Goodbye, Pete." :| pete say" Goodbye!" drop 1 |; yield
done |; choose
dup until drop

View file

@ -3,13 +3,13 @@
24 4 N ' {horse} defentity chuck
:noname
CHUCK-FOLLOW state@ not player.state DRIVING f!
:| CHUCK-HOME state@ if chuck yield then
CHUCK-FOLLOW flag@ not player.state DRIVING f!
:| CHUCK-HOME flag@ if chuck yield then
done |; ' entities redefine
:|
touch-begin E leaving? dup
if pete say" It's 100 miles to the next town." then
touch-next 24 15 2= CHUCK-FOLLOW state@ and dup
touch-next 24 15 2= CHUCK-FOLLOW flag@ and dup
if pete say" I'm not walking all the way into\town with a horse!" then
touch-next 5 9 2= dup
if move-player 13 12 pete.jor queue-level then

View file

@ -2,19 +2,22 @@
1 const CHUCK-GONE
2 const CHUCK-FOLLOW
3 const CHUCK-HOME
4 const CHUCK-STOLEN
5 const CHUCK-EXPLAINED
3 const LAST-STATE
array flags LAST-STATE 8 / 1 + allot
6 const FLAG-COUNT
: flagstof ( f -- v f ) dup 8 % 1 swap << swap 8 / flags + swap ;
array flags FLAG-COUNT 8 / 1 + allot
: flagstof ( f -- v f ) dup 8 / flags + swap 8 % 1 swap << ;
: flagsf! ( b f -- ) flagstof f! ;
: state@ ( b f -- ) flagstof f@ ;
: setstate 1 swap flagsf! ;
: clearstate 0 swap flagsf! ;
: flag@ ( f -- b ) flagstof f@ ;
: setflag 1 swap flagsf! ;
: clearflag 0 swap flagsf! ;
16 18 W ' {horse} defentity p_chuck
:noname
:| player yield
CHUCK-FOLLOW state@ if p_chuck yield then
CHUCK-FOLLOW flag@ if p_chuck yield then
done |; ' party redefine
; ' onload redefine

View file

@ -1,10 +1,10 @@
( T R A I L 1 )
38 60 E ' {horse} defentity e_chuck
50 17 E ' {horse} defentity e_chuck
39 71 N ' {car} defentity car
car :touch
CHUCK-FOLLOW state@ if
CHUCK-FOLLOW flag@ if
pete say" I can't leave Chuck here!"
else
move-player 1 player.state DRIVING f!
@ -12,31 +12,28 @@ car :touch
;entity
e_chuck :touch
pete say" Woah, boy. Calm down."
pete say" Woah, boy. Calm down." move-player
chuck say" * w h i n n y *\(You came back!)"
pete say" Of course I did, boy.\Of course I did."
p_chuck follow
( e_chuck entity>pos p_chuck entity.pos!
p_chuck entity>pos player entity>pos facing player.prevdir ! )
CHUCK-GONE clearstate CHUCK-FOLLOW setstate
p_chuck follow CHUCK-GONE clearflag CHUCK-FOLLOW setflag
;entity
:noname
0 player.state DRIVING f!
:| CHUCK-GONE state@ if e_chuck yield then
:| CHUCK-GONE flag@ if e_chuck yield then
player.driving? not if car yield then
done |; ' entities redefine
:|
touch-begin S leaving? dup
if player.driving? not CHUCK-FOLLOW state@ not and
if player.driving? not CHUCK-FOLLOW flag@ not and
if pete say" I'm not walking."
else move-player 13 7 road.jor queue-level
then
then
CHUCK-GONE state@ if
touch-next 37 60 2= dup
CHUCK-GONE flag@ if
touch-next 49 17 2= dup
if
pete say" Oh for the love of..."
say" Chuck! How on Earth did you\end up over there!?"

Binary file not shown.