small story edits, first stab at tile/sprite editor "jiles"
This commit is contained in:
parent
d4dca89ef9
commit
0fef456dff
8
game.jor
8
game.jor
|
@ -33,6 +33,7 @@ var player.prevdir
|
||||||
2 const DRIVING
|
2 const DRIVING
|
||||||
4 const NOCLIP
|
4 const NOCLIP
|
||||||
8 const ISMARY
|
8 const ISMARY
|
||||||
|
16 const ISJEANNE
|
||||||
|
|
||||||
: player.driving? player.state DRIVING f@ ;
|
: player.driving? player.state DRIVING f@ ;
|
||||||
|
|
||||||
|
@ -45,7 +46,10 @@ var player.prevdir
|
||||||
|
|
||||||
: {player}
|
: {player}
|
||||||
player.driving? if {car-drive}
|
player.driving? if {car-drive}
|
||||||
else player.state ISMARY f@ if {pmary} else {ppete} then
|
else
|
||||||
|
player.state ISMARY f@ if {pmary}
|
||||||
|
else player.state ISJEANNE f@ if {pjeanne}
|
||||||
|
else {ppete} then then
|
||||||
then ;
|
then ;
|
||||||
|
|
||||||
: player.canmove? ( x y -- )
|
: player.canmove? ( x y -- )
|
||||||
|
@ -170,7 +174,7 @@ var glitchlevel
|
||||||
MODE-MOVE @ ' tick redefine
|
MODE-MOVE @ ' tick redefine
|
||||||
' full-draw ' draw redefine
|
' full-draw ' draw redefine
|
||||||
:| player yield
|
:| player yield
|
||||||
ISMARY player.state f@ if p_jeanne yield then
|
player.state ISMARY f@ if p_jeanne yield then
|
||||||
CHUCK-FOLLOW flag@ if p_chuck yield then
|
CHUCK-FOLLOW flag@ if p_chuck yield then
|
||||||
done |; ' party redefine
|
done |; ' party redefine
|
||||||
|
|
||||||
|
|
29
jiles.jor
Executable file
29
jiles.jor
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
: blah ' seremit task-emit ! ;
|
||||||
|
blah
|
||||||
|
|
||||||
|
s" game.log" open seekend fdeactivate const LOGFILE
|
||||||
|
: emit-log ' fputc LOGFILE withfp ;
|
||||||
|
: atexit LOGFILE factivate close ;
|
||||||
|
|
||||||
|
: start-repl activate blah ' emit-log task-echo !
|
||||||
|
s" .:: J O R T H ( jean forth) ::." type cr
|
||||||
|
begin receive loadstring s" ok" type cr again ;
|
||||||
|
task const REPL
|
||||||
|
REPL start-repl
|
||||||
|
|
||||||
|
intern input.jor
|
||||||
|
input.jor loadfile
|
||||||
|
|
||||||
|
: worldpos>tilepos 4 >> swap 4 >> swap ;
|
||||||
|
: tilepos>mapindex mapsize drop * + ;
|
||||||
|
: tick
|
||||||
|
MOUSEL clicked if
|
||||||
|
0xf5 mousepos worldpos>tilepos tilepos>mapindex map + b!
|
||||||
|
then
|
||||||
|
tick-debounce
|
||||||
|
;
|
||||||
|
|
||||||
|
: draw
|
||||||
|
0 0 scroll
|
||||||
|
mousepos 4 draw-sprite
|
||||||
|
draw-screen ;
|
|
@ -1,16 +1,18 @@
|
||||||
( T R A I L 1 )
|
( T R A I L 1 )
|
||||||
|
|
||||||
39 71 N ' {car} defentity car
|
( 39 71 N ' {car} defentity car
|
||||||
|
|
||||||
car :touch
|
car :touch
|
||||||
move-player 1 player.state DRIVING f!
|
move-player 1 player.state DRIVING f!
|
||||||
;entity
|
;entity
|
||||||
|
)
|
||||||
|
|
||||||
:noname
|
:noname
|
||||||
0 player.state DRIVING f!
|
0 player.state DRIVING f!
|
||||||
|
|
||||||
:| player.driving? not if car yield then
|
( :| player.driving? not if car yield then
|
||||||
done |; ' entities redefine
|
done |; ' entities redefine
|
||||||
|
)
|
||||||
|
|
||||||
:|
|
:|
|
||||||
touch-begin S leaving? dup
|
touch-begin S leaving? dup
|
||||||
|
@ -26,4 +28,6 @@ touch-next 3 56 2= dup
|
||||||
touch-last |; ' player-touch redefine
|
touch-last |; ' player-touch redefine
|
||||||
|
|
||||||
s" trail1.map" load-map
|
s" trail1.map" load-map
|
||||||
|
1 player.state ISMARY f!
|
||||||
|
|
||||||
; ' onload redefine
|
; ' onload redefine
|
||||||
|
|
10
testbed.c
10
testbed.c
|
@ -263,7 +263,7 @@ void f_glitch() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void game_f_init(char *exe) {
|
void game_f_init(char *exe, char *bootjor) {
|
||||||
f_init(exe);
|
f_init(exe);
|
||||||
CDEF("seremit", f_seremit);
|
CDEF("seremit", f_seremit);
|
||||||
CDEF("key-pressed", f_keyWasPressed);
|
CDEF("key-pressed", f_keyWasPressed);
|
||||||
|
@ -288,7 +288,7 @@ void game_f_init(char *exe) {
|
||||||
CDEF("glitch", f_glitch);
|
CDEF("glitch", f_glitch);
|
||||||
CDEF("unfuck", tile_init);
|
CDEF("unfuck", tile_init);
|
||||||
|
|
||||||
f_loadjor("gameboot.jor");
|
f_loadjor(bootjor);
|
||||||
|
|
||||||
f_atexit = f_lookupcp("atexit");
|
f_atexit = f_lookupcp("atexit");
|
||||||
atexit(f_cleanup);
|
atexit(f_cleanup);
|
||||||
|
@ -329,13 +329,13 @@ void do_repl(char *exe) {
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
cell tick, draw;
|
cell tick, draw;
|
||||||
|
char *bootjor = "gameboot.jor";
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
do_repl(argv[0]);
|
bootjor = argv[1];
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
ser_init(SER_COM2, BAUD_19200, SER_8N1);
|
ser_init(SER_COM2, BAUD_19200, SER_8N1);
|
||||||
game_init();
|
game_init();
|
||||||
game_f_init(argv[0]);
|
game_f_init(argv[0], bootjor);
|
||||||
tick = f_lookupcp("tick");
|
tick = f_lookupcp("tick");
|
||||||
draw = f_lookupcp("draw");
|
draw = f_lookupcp("draw");
|
||||||
|
|
||||||
|
|
51
tiles.c
51
tiles.c
|
@ -32,6 +32,16 @@ void blitTile(unsigned int offsetFrom, unsigned int offsetTo) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void blitSolidBlock(unsigned int offsetTo, unsigned char color) {
|
||||||
|
int y;
|
||||||
|
setPlaneColor(color);
|
||||||
|
for (y = 0; y < 16; y ++) {
|
||||||
|
VID[offsetTo] = 0xff;
|
||||||
|
VID[offsetTo + 1] = 0xff;
|
||||||
|
offsetTo += PAGE_STRIDE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void blit32x32(unsigned int offsetFrom, unsigned int offsetTo) {
|
void blit32x32(unsigned int offsetFrom, unsigned int offsetTo) {
|
||||||
int y;
|
int y;
|
||||||
for (y = 0; y < 32; y ++) {
|
for (y = 0; y < 32; y ++) {
|
||||||
|
@ -74,9 +84,28 @@ int prepareBuffer(int pageX, int pageY) {
|
||||||
unsigned char ibuffer = screen.nextBuffer;
|
unsigned char ibuffer = screen.nextBuffer;
|
||||||
screen.nextBuffer = nextBufferIndex(ibuffer);
|
screen.nextBuffer = nextBufferIndex(ibuffer);
|
||||||
*dirty = ibuffer;
|
*dirty = ibuffer;
|
||||||
|
if ((tile & 0xf0) == 0xf0) {
|
||||||
|
unsigned int val = (tile & 0x01) ? 0xffff : 0x0000;
|
||||||
|
for (i = 0; i < 16; i ++) {
|
||||||
|
screen.buffer[ibuffer][i] = val;
|
||||||
|
}
|
||||||
|
val = (tile & 0x02) ? 0xffff : 0x0000;
|
||||||
|
for (i = 16; i < 32; i ++) {
|
||||||
|
screen.buffer[ibuffer][i] = val;
|
||||||
|
}
|
||||||
|
val = (tile & 0x04) ? 0xffff : 0x0000;
|
||||||
|
for (i = 32; i < 48; i ++) {
|
||||||
|
screen.buffer[ibuffer][i] = val;
|
||||||
|
}
|
||||||
|
val = (tile & 0x08) ? 0xffff : 0x0000;
|
||||||
|
for (i = 48; i < 64; i ++) {
|
||||||
|
screen.buffer[ibuffer][i] = val;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
for (i = 0; i < BUF_WSIZE; i ++) {
|
for (i = 0; i < BUF_WSIZE; i ++) {
|
||||||
screen.buffer[ibuffer][i] = (&screen.memTiles[tile * BUF_WSIZE])[i];
|
screen.buffer[ibuffer][i] = (&screen.memTiles[tile * BUF_WSIZE])[i];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
screen.bufferOffset[ibuffer] = screen.pageOffset[screen.currentPage]
|
screen.bufferOffset[ibuffer] = screen.pageOffset[screen.currentPage]
|
||||||
+ (pageX << 1) + (pageY * PAGE_STRIDE * 16);
|
+ (pageX << 1) + (pageY * PAGE_STRIDE * 16);
|
||||||
}
|
}
|
||||||
|
@ -183,9 +212,10 @@ void drawScreen() {
|
||||||
for (y = startY; y < startY + PAGE_TILES_H; y ++) {
|
for (y = startY; y < startY + PAGE_TILES_H; y ++) {
|
||||||
for (x = startX; x < startX + PAGE_TILES_W; x ++) {
|
for (x = startX; x < startX + PAGE_TILES_W; x ++) {
|
||||||
if (dirty[di++] == D_BGTILE) {
|
if (dirty[di++] == D_BGTILE) {
|
||||||
blitTile(
|
char tile = screen.map[x + (y * screen.w)];
|
||||||
screen.tilesOffset + (screen.map[x + (y * screen.w)] << 5),
|
if ((tile & 0xf0) != 0xf0) {
|
||||||
drawOffset);
|
blitTile(screen.tilesOffset + (tile << 5), drawOffset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
drawOffset += 2;
|
drawOffset += 2;
|
||||||
}
|
}
|
||||||
|
@ -204,6 +234,21 @@ void drawScreen() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setAllPlanes();
|
setAllPlanes();
|
||||||
|
di = 0;
|
||||||
|
drawOffset = screen.pageOffset[screen.currentPage];
|
||||||
|
for (y = startY; y < startY + PAGE_TILES_H; y ++) {
|
||||||
|
for (x = startX; x < startX + PAGE_TILES_W; x ++) {
|
||||||
|
if (dirty[di++] == D_BGTILE) {
|
||||||
|
char tile = screen.map[x + (y * screen.w)];
|
||||||
|
if ((tile & 0xf0) == 0xf0) {
|
||||||
|
blitSolidBlock(drawOffset, tile & 0x0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
drawOffset += 2;
|
||||||
|
}
|
||||||
|
drawOffset += PAGE_STRIDE * 15;
|
||||||
|
}
|
||||||
|
|
||||||
setDisplayOffset(scrollOffset);
|
setDisplayOffset(scrollOffset);
|
||||||
setHorizontalPan(screen.scrollX & 0x07);
|
setHorizontalPan(screen.scrollX & 0x07);
|
||||||
|
|
||||||
|
|
|
@ -43,8 +43,10 @@ CHUCK-GONE flag@ if
|
||||||
then
|
then
|
||||||
touch-next 3 56 2= dup
|
touch-next 3 56 2= dup
|
||||||
if
|
if
|
||||||
|
1 glitchlevel !
|
||||||
pete say" This is where I buried it."
|
pete say" This is where I buried it."
|
||||||
say" All those years ago."
|
say" All those years ago."
|
||||||
|
0 glitchlevel !
|
||||||
then
|
then
|
||||||
touch-last |; ' player-touch redefine
|
touch-last |; ' player-touch redefine
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue