add mary animation, scripting, day/night tiles

This commit is contained in:
Jeremy Penner 2019-06-01 23:35:37 -04:00
parent 530d79c09b
commit 5e98b5f095
14 changed files with 169 additions and 10 deletions

View file

@ -65,6 +65,8 @@ array frames
( 0: car ) 3 1 0 2 frame ( 0: car ) 3 1 0 2 frame
( 1: pete stand ) 11 9 7 5 frame ( 1: pete stand ) 11 9 7 5 frame
( 2: pete walk ) 12 10 8 6 frame ( 2: pete walk ) 12 10 8 6 frame
( 3: mary stand ) 17 20 22 24 frame
( 4: mary walk ) 19 21 23 25 frame
: sprindex ( dir frame ) 2 << frames + + b@ ; : sprindex ( dir frame ) 2 << frames + + b@ ;
: defstatic ( frame -- ) create b, does> b@ sprindex ; : defstatic ( frame -- ) create b, does> b@ sprindex ;
@ -83,5 +85,6 @@ array frames
14 defsingle {chair} 14 defsingle {chair}
15 defsingle {pete-bed} 15 defsingle {pete-bed}
16 defsingle {horse} 16 defsingle {horse}
17 defsingle {mary} 3 defstatic {mary}
3 4 2 5 defanim {mary-walk}
18 defsingle {phone} 18 defsingle {phone}

BIN
footer2.tif Executable file

Binary file not shown.

BIN
game.exe

Binary file not shown.

View file

@ -32,13 +32,17 @@ var player.prevdir
1 const MOVING 1 const MOVING
2 const DRIVING 2 const DRIVING
4 const NOCLIP 4 const NOCLIP
8 const ISMARY
: player.driving? player.state DRIVING f@ ; : player.driving? player.state DRIVING f@ ;
: {player} : {player}
player.driving? if {car} player.driving? if {car}
else player.state MOVING f@ if {pete-walk} else player.state MOVING f@ if
else {pete-stand} then then ; player.state ISMARY f@ if {mary-walk} else {pete-walk} then
else
player.state ISMARY f@ if {mary} else {pete-stand} then
then then ;
: player.canmove? ( x y -- ) : player.canmove? ( x y -- )
player.state NOCLIP f@ not if player.state NOCLIP f@ not if

BIN
game.prj

Binary file not shown.

View file

@ -30,6 +30,10 @@ intern petehous.jor
intern road.jor intern road.jor
intern jeanne.jor intern jeanne.jor
intern trail1.jor intern trail1.jor
intern mpete.jor
intern mroad.jor
intern mjeanne.jor
intern mtrail1.jor
:noname loadfile ; checkpoint _loadlevel :noname loadfile ; checkpoint _loadlevel
' _loadlevel ' loadlevel redefine ' _loadlevel ' loadlevel redefine

View file

@ -4,6 +4,8 @@ var tileselect
: mouseworldpos mousepos scrollpos +pos ; : mouseworldpos mousepos scrollpos +pos ;
: mousetile mouseworldpos world>tile ; : mousetile mouseworldpos world>tile ;
: tile ( x y -- ptr ) mapsize drop * + map + ; : tile ( x y -- ptr ) mapsize drop * + map + ;
: day s" TILES.TIF" loadtiles invalidate-map ;
: night s" NTILES.TIF" loadtiles invalidate-map ;
1 const WALKABLE 1 const WALKABLE
2 const DRIVABLE 2 const DRIVABLE

38
mjeanne.jor Executable file
View file

@ -0,0 +1,38 @@
( J E A N N E )
16 18 W ' {horse} defentity e_chuck
14 22 N ' {car} defentity car
e_chuck :touch
mary say" Good old Chuck."
chuck say" * n e i g h *\(Hi Mary!)"
;entity
car :touch
move-player 1 player.state DRIVING f!
;entity
:noname
0 player.state DRIVING f!
:| CHUCK-HOME flag@ if e_chuck yield then
player.driving? not CHUCK-FOLLOW flag@ not and if car yield then
done |; ' entities redefine
:|
touch-begin S leaving? dup
if player.driving? not
if pete say" I'm not walking."
else move-player 24 7 road.jor queue-level
then
then
touch-next 6 21 2= dup
if player.driving? not
if noone say" * knock knock *"
jeanne say" C'mon in, Ma."
move-player
then
then
touch-last |; ' player-touch redefine
s" jeanne.map" load-map
; ' onload redefine

36
mpete.jor Executable file
View file

@ -0,0 +1,36 @@
( P E T E )
13 8 N ' {car} defentity pcar
32 5 W ' {horse} defentity e_chuck
car :touch
move-player
1 player.state DRIVING f!
;entity
e_chuck :touch
mary say" Did Pete steal you?\Again!?"
chuck say" * n e i g h *\(Hi Mary!)"
;entity
:noname
:| car yield
( player.driving? not if car yield then ) ( todo: mary's car )
CHUCK-STOLEN flag@ if e_chuck yield then
done |; ' entities redefine
:|
touch-begin S leaving? dup
if player.driving? not
if mary say" I shouldn't leave my car here."
else move-player 5 10 mroad.jor queue-level
then
then
touch-next 12 7 2= player.driving? not and dup
if mary say" I don't really want to\call on Pete right now." then
touch-next 30 7 2= dup
if mary say" Yech, what a miserable\swamp." then
touch-last |; ' player-touch redefine
s" pete.map" load-map
; ' onload redefine

29
mroad.jor Executable file
View file

@ -0,0 +1,29 @@
( O V E R W O R L D )
24 4 N ' {horse} defentity chuck
:noname
:| CHUCK-HOME flag@ if chuck yield then
done |; ' entities redefine
:|
touch-begin E leaving? dup
if mary say" I've no reason to head out that way." then
touch-next 5 9 2= dup
if move-player 13 12 mpete.jor queue-level then
touch-next 13 6 2= dup
if move-player 38 71 mtrail1.jor queue-level then
touch-next 24 6 2= dup
if move-player 13 22 mjeanne.jor queue-level then
touch-next 39 33 2= dup
if mary say" I heard they'll be building\a new play structure this\summer." then
touch-next 32 36 2= dup
if mary say" I'm done for the day." then
touch-next 35 39 2= dup
if mary say" Community center." then
touch-next tile b@ 17 = dup
if mary say" Oh, I wouldn't want to\be a bother." then
touch-last |; ' player-touch redefine
s" road.map" load-map
; ' onload redefine

29
mtrail1.jor Executable file
View file

@ -0,0 +1,29 @@
( T R A I L 1 )
39 71 N ' {car} defentity car
car :touch
move-player 1 player.state DRIVING f!
;entity
:noname
0 player.state DRIVING f!
:| player.driving? not if car yield then
done |; ' entities redefine
:|
touch-begin S leaving? dup
if player.driving? not CHUCK-FOLLOW flag@ not and
if mary say" I'd best drive."
else move-player 13 7 mroad.jor queue-level
then
then
touch-next 3 56 2= dup
if mary say" What on Earth...?"
say" Is this where...?"
then
touch-last |; ' player-touch redefine
s" trail1.map" load-map
; ' onload redefine

BIN
ntiles.tif Executable file

Binary file not shown.

Binary file not shown.

View file

@ -83,6 +83,24 @@ void fillMap() {
} }
} }
void readTiles(char *filename) {
FILE *f;
TifImageMeta_t meta;
f = fopen(filename, "rb");
meta = tifLoadMeta(f);
tifLoad(f, meta, tiles, NUM_TILES * 16, 16, 4);
tifLoadEGA(f, meta, OFF_TILES, NUM_TILES * 16, 16);
fclose(f);
loadTiles(OFF_TILES, tiles);
}
void f_loadtiles() {
readTiles(TOP().s);
DROP(1);
}
void game_init() { void game_init() {
FILE *f; FILE *f;
TifImageMeta_t meta; TifImageMeta_t meta;
@ -106,12 +124,6 @@ void game_init() {
tifLoadEGA(f, meta, 0, 48, 336); tifLoadEGA(f, meta, 0, 48, 336);
fclose(f); fclose(f);
f = fopen("TILES.TIF", "rb");
meta = tifLoadMeta(f);
tifLoad(f, meta, tiles, NUM_TILES * 16, 16, 4);
tifLoadEGA(f, meta, OFF_TILES, NUM_TILES * 16, 16);
fclose(f);
f = fopen("SPRITE.TIF", "rb"); f = fopen("SPRITE.TIF", "rb");
meta = tifLoadMeta(f); meta = tifLoadMeta(f);
tifLoad(f, meta, sprites, NUM_SPRITES * 16, 16, 5); tifLoad(f, meta, sprites, NUM_SPRITES * 16, 16, 5);
@ -122,7 +134,8 @@ void game_init() {
tifLoadEGA(f, meta, OFF_PORTRAITS, NUM_PORTRAITS * 32, 32); tifLoadEGA(f, meta, OFF_PORTRAITS, NUM_PORTRAITS * 32, 32);
fclose(f); fclose(f);
loadTiles(OFF_TILES, tiles); readTiles("TILES.TIF");
loadMap(map, 100, 100); loadMap(map, 100, 100);
scroll(0, 0); scroll(0, 0);
} }
@ -245,6 +258,7 @@ void game_f_init(char *exe) {
CDEF("mapsize!", f_mapsize_set); CDEF("mapsize!", f_mapsize_set);
CDEF("mousepos", f_mousepos); CDEF("mousepos", f_mousepos);
CDEF("mousebuttons", f_mousebuttons); CDEF("mousebuttons", f_mousebuttons);
CDEF("loadtiles", f_loadtiles);
CDEF("unfuck", tile_init); CDEF("unfuck", tile_init);
f_loadjor("gameboot.jor"); f_loadjor("gameboot.jor");