car headlights
This commit is contained in:
parent
5e98b5f095
commit
761ef1751a
|
@ -67,6 +67,7 @@ array frames
|
||||||
( 2: pete walk ) 12 10 8 6 frame
|
( 2: pete walk ) 12 10 8 6 frame
|
||||||
( 3: mary stand ) 17 20 22 24 frame
|
( 3: mary stand ) 17 20 22 24 frame
|
||||||
( 4: mary walk ) 19 21 23 25 frame
|
( 4: mary walk ) 19 21 23 25 frame
|
||||||
|
( 5: car lights ) 29 27 26 28 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 ;
|
||||||
|
@ -79,6 +80,7 @@ array frames
|
||||||
2 + + b@ sprindex ;
|
2 + + b@ sprindex ;
|
||||||
|
|
||||||
0 defstatic {car}
|
0 defstatic {car}
|
||||||
|
5 defstatic {car-lit}
|
||||||
1 defstatic {pete-stand}
|
1 defstatic {pete-stand}
|
||||||
1 2 2 5 defanim {pete-walk}
|
1 2 2 5 defanim {pete-walk}
|
||||||
13 defsingle {pete-table}
|
13 defsingle {pete-table}
|
||||||
|
|
10
game.jor
10
game.jor
|
@ -37,7 +37,7 @@ var player.prevdir
|
||||||
: player.driving? player.state DRIVING f@ ;
|
: player.driving? player.state DRIVING f@ ;
|
||||||
|
|
||||||
: {player}
|
: {player}
|
||||||
player.driving? if {car}
|
player.driving? if {car-drive}
|
||||||
else player.state MOVING f@ if
|
else player.state MOVING f@ if
|
||||||
player.state ISMARY f@ if {mary-walk} else {pete-walk} then
|
player.state ISMARY f@ if {mary-walk} else {pete-walk} then
|
||||||
else
|
else
|
||||||
|
@ -141,6 +141,8 @@ player :tick
|
||||||
|
|
||||||
var showmouse
|
var showmouse
|
||||||
1 showmouse !
|
1 showmouse !
|
||||||
|
var glitchlevel
|
||||||
|
|
||||||
: full-draw
|
: full-draw
|
||||||
player entity.x @ 152 -
|
player entity.x @ 152 -
|
||||||
player entity.y @ 92 -
|
player entity.y @ 92 -
|
||||||
|
@ -152,11 +154,17 @@ var showmouse
|
||||||
showmouse @ if
|
showmouse @ if
|
||||||
mouseworldpos 4 draw-sprite
|
mouseworldpos 4 draw-sprite
|
||||||
then
|
then
|
||||||
|
glitchlevel @ glitch
|
||||||
draw-screen
|
draw-screen
|
||||||
draw-footer ;
|
draw-footer ;
|
||||||
|
|
||||||
|
16 18 W ' {horse} defentity p_chuck
|
||||||
:noname
|
:noname
|
||||||
reset-level
|
reset-level
|
||||||
MODE-MOVE @ ' tick redefine
|
MODE-MOVE @ ' tick redefine
|
||||||
' full-draw ' draw redefine
|
' full-draw ' draw redefine
|
||||||
|
:| player yield
|
||||||
|
CHUCK-FOLLOW flag@ if p_chuck yield then
|
||||||
|
done |; ' party redefine
|
||||||
|
|
||||||
; ' onload redefine
|
; ' onload redefine
|
|
@ -21,8 +21,8 @@ s" timer.jor" loadfile
|
||||||
s" entity.jor" loadfile
|
s" entity.jor" loadfile
|
||||||
s" footer.jor" loadfile
|
s" footer.jor" loadfile
|
||||||
s" map.jor" loadfile
|
s" map.jor" loadfile
|
||||||
s" game.jor" loadfile
|
|
||||||
s" state.jor" loadfile
|
s" state.jor" loadfile
|
||||||
|
s" game.jor" loadfile
|
||||||
; execute
|
; execute
|
||||||
|
|
||||||
intern pete.jor
|
intern pete.jor
|
||||||
|
|
2
map.jor
2
map.jor
|
@ -4,8 +4,6 @@ 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
|
||||||
|
|
BIN
ntiles.tif
BIN
ntiles.tif
Binary file not shown.
BIN
sprite.tif
BIN
sprite.tif
Binary file not shown.
14
state.jor
14
state.jor
|
@ -4,8 +4,9 @@
|
||||||
3 const CHUCK-HOME
|
3 const CHUCK-HOME
|
||||||
4 const CHUCK-STOLEN
|
4 const CHUCK-STOLEN
|
||||||
5 const CHUCK-EXPLAINED
|
5 const CHUCK-EXPLAINED
|
||||||
|
6 const NIGHT
|
||||||
|
|
||||||
6 const FLAG-COUNT
|
7 const FLAG-COUNT
|
||||||
|
|
||||||
array flags FLAG-COUNT 8 / 1 + allot
|
array flags FLAG-COUNT 8 / 1 + allot
|
||||||
|
|
||||||
|
@ -15,9 +16,8 @@ array flags FLAG-COUNT 8 / 1 + allot
|
||||||
: setflag 1 swap flagsf! ;
|
: setflag 1 swap flagsf! ;
|
||||||
: clearflag 0 swap flagsf! ;
|
: clearflag 0 swap flagsf! ;
|
||||||
|
|
||||||
16 18 W ' {horse} defentity p_chuck
|
: day s" TILES.TIF" loadtiles invalidate-map NIGHT clearflag ;
|
||||||
:noname
|
: night s" NTILES.TIF" loadtiles invalidate-map NIGHT setflag ;
|
||||||
:| player yield
|
|
||||||
CHUCK-FOLLOW flag@ if p_chuck yield then
|
: {car-drive} NIGHT flag@ if {car-lit} else {car} then ;
|
||||||
done |; ' party redefine
|
|
||||||
; ' onload redefine
|
|
||||||
|
|
31
testbed.c
31
testbed.c
|
@ -59,10 +59,18 @@ unsigned int far *tiles;
|
||||||
unsigned int far *sprites;
|
unsigned int far *sprites;
|
||||||
unsigned char map[10000];
|
unsigned char map[10000];
|
||||||
|
|
||||||
|
|
||||||
|
void deallocate_gfx() {
|
||||||
|
if (tiles) farfree(tiles);
|
||||||
|
if (sprites) farfree(sprites);
|
||||||
|
}
|
||||||
|
|
||||||
void allocate_gfx() {
|
void allocate_gfx() {
|
||||||
unsigned long memleft = farcoreleft();
|
unsigned long memleft = farcoreleft();
|
||||||
tiles = farmalloc(NUM_TILES * TILE_STRIDE);
|
tiles = farmalloc(NUM_TILES * TILE_STRIDE * 2);
|
||||||
sprites = farmalloc(NUM_SPRITES * SPRITE_STRIDE);
|
sprites = farmalloc(NUM_SPRITES * SPRITE_STRIDE * 2);
|
||||||
|
atexit(deallocate_gfx);
|
||||||
|
|
||||||
if (!tiles || !sprites) {
|
if (!tiles || !sprites) {
|
||||||
printf("%lu bytes free - need %lu\n", memleft,
|
printf("%lu bytes free - need %lu\n", memleft,
|
||||||
(unsigned long)
|
(unsigned long)
|
||||||
|
@ -237,6 +245,24 @@ void f_cleanup() {
|
||||||
f_execcp(f_atexit);
|
f_execcp(f_atexit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void f_glitch() {
|
||||||
|
int count = TOP().u;
|
||||||
|
int i, x, y;
|
||||||
|
DROP(1);
|
||||||
|
for (i = 0; i < count; i ++) {
|
||||||
|
x = screen.scrollX + (rand() % 352) - 16;
|
||||||
|
y = screen.scrollY + (rand() % 232) - 16;
|
||||||
|
switch(rand()%2) {
|
||||||
|
case 0:
|
||||||
|
drawSprite(sprites + (rand() % (NUM_SPRITES * SPRITE_STRIDE)), x, y);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
drawSprite(mem + (rand() % MEM_SIZE), x, y);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void game_f_init(char *exe) {
|
void game_f_init(char *exe) {
|
||||||
f_init(exe);
|
f_init(exe);
|
||||||
CDEF("seremit", f_seremit);
|
CDEF("seremit", f_seremit);
|
||||||
|
@ -259,6 +285,7 @@ void game_f_init(char *exe) {
|
||||||
CDEF("mousepos", f_mousepos);
|
CDEF("mousepos", f_mousepos);
|
||||||
CDEF("mousebuttons", f_mousebuttons);
|
CDEF("mousebuttons", f_mousebuttons);
|
||||||
CDEF("loadtiles", f_loadtiles);
|
CDEF("loadtiles", f_loadtiles);
|
||||||
|
CDEF("glitch", f_glitch);
|
||||||
CDEF("unfuck", tile_init);
|
CDEF("unfuck", tile_init);
|
||||||
|
|
||||||
f_loadjor("gameboot.jor");
|
f_loadjor("gameboot.jor");
|
||||||
|
|
BIN
trail1.map
BIN
trail1.map
Binary file not shown.
Loading…
Reference in a new issue