Jorth lookup optimization; add Jeanne's house
This commit is contained in:
parent
a010ec5911
commit
d52d5b96f5
BIN
entity.jim
BIN
entity.jim
Binary file not shown.
BIN
footer.jim
BIN
footer.jim
Binary file not shown.
13
footer.jor
13
footer.jor
|
@ -23,11 +23,9 @@ var footer-y
|
||||||
|
|
||||||
var text-color
|
var text-color
|
||||||
WHITE text-color !
|
WHITE text-color !
|
||||||
|
: textxy ( s x y ) <rot text-color @ text ;
|
||||||
: statusy 7 swap <rot text-color @ text ;
|
: portraity 1 swap textxy ;
|
||||||
: status0 10 statusy ;
|
: statusy 7 swap textxy ;
|
||||||
: status1 20 statusy ;
|
|
||||||
: status2 30 statusy ;
|
|
||||||
|
|
||||||
var textx
|
var textx
|
||||||
var texty
|
var texty
|
||||||
|
@ -57,7 +55,7 @@ var texttimer
|
||||||
: clear
|
: clear
|
||||||
text-color @
|
text-color @
|
||||||
WHITE text-color !
|
WHITE text-color !
|
||||||
s" " dup dup status0 status1 status2
|
s" " dup dup 10 statusy 20 statusy 30 statusy
|
||||||
text-color !
|
text-color !
|
||||||
6 textx !
|
6 textx !
|
||||||
10 texty ! ;
|
10 texty ! ;
|
||||||
|
@ -76,4 +74,7 @@ var texttimer
|
||||||
0 GREEN character pete
|
0 GREEN character pete
|
||||||
1 MAGENTA character mary
|
1 MAGENTA character mary
|
||||||
2 BROWN character chuck
|
2 BROWN character chuck
|
||||||
|
3 YELLOW character jeanne
|
||||||
|
|
||||||
|
: noone WHITE text-color ! s" " dup dup dup
|
||||||
|
8 portraity 16 portraity 24 portraity 32 portraity ;
|
||||||
|
|
|
@ -23,6 +23,7 @@ s" game.jor" loadfile
|
||||||
intern pete.jor
|
intern pete.jor
|
||||||
intern petehous.jor
|
intern petehous.jor
|
||||||
intern road.jor
|
intern road.jor
|
||||||
|
intern jeanne.jor
|
||||||
|
|
||||||
:noname loadfile ; checkpoint _loadlevel
|
:noname loadfile ; checkpoint _loadlevel
|
||||||
' _loadlevel ' loadlevel redefine
|
' _loadlevel ' loadlevel redefine
|
||||||
|
|
BIN
jeanne.jim
Executable file
BIN
jeanne.jim
Executable file
Binary file not shown.
45
jeanne.jor
Executable file
45
jeanne.jor
Executable file
|
@ -0,0 +1,45 @@
|
||||||
|
( J E A N N E )
|
||||||
|
|
||||||
|
16 18 W ' {horse} defentity e_chuck
|
||||||
|
14 22 N ' {car} defentity car
|
||||||
|
|
||||||
|
e_chuck :touch
|
||||||
|
pete say" Hey there, Chuck."
|
||||||
|
chuck say" * w h i n n y *\(Hey there, Pete.)"
|
||||||
|
;entity
|
||||||
|
|
||||||
|
car :touch
|
||||||
|
player move-entity 1 player.state DRIVING f!
|
||||||
|
;entity
|
||||||
|
|
||||||
|
:noname
|
||||||
|
reset-level
|
||||||
|
0 player.state DRIVING f!
|
||||||
|
:| player yield
|
||||||
|
e_chuck yield
|
||||||
|
player.driving? not if car yield then
|
||||||
|
0 |; ' entities redefine
|
||||||
|
|
||||||
|
:|
|
||||||
|
touch-begin S leaving? dup
|
||||||
|
if player.driving? not
|
||||||
|
if pete say" I'm not walking."
|
||||||
|
else player move-entity 24 7 road.jor queue-level
|
||||||
|
then
|
||||||
|
then
|
||||||
|
touch-next 6 21 2= dup
|
||||||
|
if player.driving? 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."
|
||||||
|
else
|
||||||
|
pete say" Jeanne hates me enough already\without driving through her\front door!"
|
||||||
|
then
|
||||||
|
then
|
||||||
|
touch-last |; ' player-touch redefine
|
||||||
|
|
||||||
|
s" jeanne.map" load-map
|
||||||
|
; ' onload redefine
|
BIN
jeanne.map
Executable file
BIN
jeanne.map
Executable file
Binary file not shown.
31
jorth.c
31
jorth.c
|
@ -553,22 +553,31 @@ void f_codepointer() {
|
||||||
|
|
||||||
void f_lookup() { // name -- (codepointer flags) | (name 0)
|
void f_lookup() { // name -- (codepointer flags) | (name 0)
|
||||||
cell *entry = LATEST;
|
cell *entry = LATEST;
|
||||||
|
char *name = TOP().s;
|
||||||
|
int len = strlen(name);
|
||||||
|
DROP(1);
|
||||||
|
|
||||||
while (entry) {
|
while (entry) {
|
||||||
f_dup();
|
|
||||||
PUSHP(entry);
|
PUSHP(entry);
|
||||||
f_wordname();
|
f_wordflags();
|
||||||
f_streq();
|
if (len == (TOP().u & ~F_IMMEDIATE)) {
|
||||||
if (TOP().i) {
|
PUSHS(name);
|
||||||
TOP().p = entry;
|
PUSHP(entry);
|
||||||
f_codepointer();
|
f_wordname();
|
||||||
f_swap();
|
f_streq();
|
||||||
TOP().p = entry;
|
if (TOP().i) {
|
||||||
f_wordflags();
|
TOP().p = entry;
|
||||||
return;
|
f_codepointer();
|
||||||
|
f_swap();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DROP(2);
|
||||||
|
} else {
|
||||||
|
DROP(1);
|
||||||
}
|
}
|
||||||
DROP(1);
|
|
||||||
entry = entry->p;
|
entry = entry->p;
|
||||||
}
|
}
|
||||||
|
PUSHS(name);
|
||||||
PUSHU(0);
|
PUSHU(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
BIN
petehous.jim
BIN
petehous.jim
Binary file not shown.
BIN
portrait.tif
BIN
portrait.tif
Binary file not shown.
2
road.jor
2
road.jor
|
@ -14,7 +14,7 @@ touch-next 5 9 2= dup
|
||||||
touch-next 13 6 2= dup
|
touch-next 13 6 2= dup
|
||||||
if pete say" Old hiking trail." then
|
if pete say" Old hiking trail." then
|
||||||
touch-next 24 6 2= dup
|
touch-next 24 6 2= dup
|
||||||
if mary say" Welcome to my place, Pete!" then
|
if player move-entity 13 22 jeanne.jor queue-level then
|
||||||
touch-next 39 33 2= dup
|
touch-next 39 33 2= dup
|
||||||
if pete say" School's out for the day,\looks like." then
|
if pete say" School's out for the day,\looks like." then
|
||||||
touch-next 32 36 2= dup
|
touch-next 32 36 2= dup
|
||||||
|
|
Loading…
Reference in a new issue