fix graphical artifacts, add eyedropper
This commit is contained in:
parent
f7ec90f032
commit
0c1a4c0539
14
jiles.jor
14
jiles.jor
|
@ -22,13 +22,19 @@ var spriteindex
|
||||||
|
|
||||||
|
|
||||||
: refresh
|
: refresh
|
||||||
spriteindex @ drawfatsprite ;
|
mousehide spriteindex @ drawfatsprite mouseshow ;
|
||||||
|
|
||||||
: mousepos>sprpos 3 >> swap 3 >> swap ;
|
: mousepos>sprpos 3 >> swap 3 >> swap ;
|
||||||
|
: mousexys mousepos mousepos>sprpos spriteindex @ ;
|
||||||
: tick
|
: tick
|
||||||
MOUSEL clicked if
|
MOUSEL mousedown if
|
||||||
color @ mousepos mousepos>sprpos spriteindex @ putpixel
|
mousexys getpixel color @ != if
|
||||||
|
color @ mousexys putpixel
|
||||||
|
refresh
|
||||||
|
then
|
||||||
|
then
|
||||||
|
MOUSER clicked if
|
||||||
|
mousexys getpixel color !
|
||||||
then
|
then
|
||||||
tick-debounce
|
tick-debounce
|
||||||
;
|
;
|
||||||
|
|
54
testbed.c
54
testbed.c
|
@ -264,31 +264,53 @@ void f_glitch() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* JILES */
|
/* JILES */
|
||||||
#define SCREEN_STRIDE 320
|
#define SCREEN_STRIDE 40
|
||||||
|
void f_mousehide() {
|
||||||
|
mouse_hide();
|
||||||
|
}
|
||||||
void f_mouseshow() {
|
void f_mouseshow() {
|
||||||
setLogicalWidth(SCREEN_STRIDE >> 1);
|
setLogicalWidth(SCREEN_STRIDE >> 1);
|
||||||
mouse_show();
|
mouse_show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getpixel(int x, int y, unsigned int far *spr) {
|
||||||
|
int shift = (15 - x);
|
||||||
|
int b = (spr[y + 0] & (1 << shift)) >> shift;
|
||||||
|
int g = (spr[y + 16] & (1 << shift)) >> shift;
|
||||||
|
int r = (spr[y + 32] & (1 << shift)) >> shift;
|
||||||
|
int i = (spr[y + 48] & (1 << shift)) >> shift;
|
||||||
|
return b | (g << 1) | (r << 2) | (i << 3);
|
||||||
|
}
|
||||||
|
|
||||||
void f_drawfatsprite() {
|
void f_drawfatsprite() {
|
||||||
int isprite = TOP().i;
|
int isprite = TOP().i;
|
||||||
unsigned int dst = 0;
|
unsigned int dst = 0;
|
||||||
unsigned int far *spr = &sprites[isprite * SPRITE_STRIDE];
|
unsigned int far *spr = &sprites[isprite * SPRITE_STRIDE];
|
||||||
int x, y, faty;
|
int x, y, faty, resetEnabled;
|
||||||
|
|
||||||
DROP(1);
|
DROP(1);
|
||||||
setWriteMode(0);
|
setWriteMode(0);
|
||||||
|
setAllPlanes();
|
||||||
|
setResetEnabled(0x0f);
|
||||||
|
resetEnabled = 1;
|
||||||
for ( y = 0; y < 16; y ++ ) {
|
for ( y = 0; y < 16; y ++ ) {
|
||||||
for ( x = 0; x < 16; x ++ ) {
|
for ( x = 0; x < 16; x ++ ) {
|
||||||
int shift = (15 - x);
|
int color = getpixel(x, y, spr);
|
||||||
int b = (spr[y + 0] & (1 << shift)) >> shift;
|
int fill1 = color & 0x10 ? 0xff : 0x55;
|
||||||
int g = (spr[y + 16] & (1 << shift)) >> shift;
|
|
||||||
int r = (spr[y + 32] & (1 << shift)) >> shift;
|
|
||||||
int i = (spr[y + 48] & (1 << shift)) >> shift;
|
|
||||||
int colour = b | (g << 1) | (r << 2) | (i << 3);
|
|
||||||
int fill1 = (spr[y + 64] & (1 << shift)) ? 0xff : 0x55;
|
|
||||||
int fill2 = fill1 == 0xff ? 0xff : 0xaa;
|
int fill2 = fill1 == 0xff ? 0xff : 0xaa;
|
||||||
setPlaneColor(colour);
|
|
||||||
|
if (color >= 0x0f) {
|
||||||
|
if (resetEnabled) {
|
||||||
|
setResetEnabled(0);
|
||||||
|
resetEnabled = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!resetEnabled) {
|
||||||
|
setResetEnabled(0x0f);
|
||||||
|
resetEnabled = 1;
|
||||||
|
}
|
||||||
|
setResetMask(color);
|
||||||
|
}
|
||||||
for ( faty = 0; faty < 8; faty ++) {
|
for ( faty = 0; faty < 8; faty ++) {
|
||||||
VID[dst + x + (SCREEN_STRIDE * faty)] = (faty % 2) ? fill1 : fill2;
|
VID[dst + x + (SCREEN_STRIDE * faty)] = (faty % 2) ? fill1 : fill2;
|
||||||
}
|
}
|
||||||
|
@ -322,6 +344,16 @@ void f_putpixel() {
|
||||||
spr[y + 64] = (spr[y + 64] & ~(1 << shift)) | (v << shift);
|
spr[y + 64] = (spr[y + 64] & ~(1 << shift)) | (v << shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void f_getpixel() {
|
||||||
|
int isprite = TOP().i;
|
||||||
|
unsigned int far *spr = &sprites[isprite * SPRITE_STRIDE];
|
||||||
|
int x = ST2().i;
|
||||||
|
int y = ST1().i;
|
||||||
|
DROP(2);
|
||||||
|
|
||||||
|
TOP().i = getpixel(x, y, spr);
|
||||||
|
}
|
||||||
|
|
||||||
/* INIT */
|
/* INIT */
|
||||||
void game_f_init(char *exe, char *bootjor) {
|
void game_f_init(char *exe, char *bootjor) {
|
||||||
f_init(exe);
|
f_init(exe);
|
||||||
|
@ -349,8 +381,10 @@ void game_f_init(char *exe, char *bootjor) {
|
||||||
CDEF("unfuck", tile_init);
|
CDEF("unfuck", tile_init);
|
||||||
|
|
||||||
CDEF("mouseshow", f_mouseshow);
|
CDEF("mouseshow", f_mouseshow);
|
||||||
|
CDEF("mousehide", f_mousehide);
|
||||||
CDEF("drawfatsprite", f_drawfatsprite);
|
CDEF("drawfatsprite", f_drawfatsprite);
|
||||||
CDEF("putpixel", f_putpixel);
|
CDEF("putpixel", f_putpixel);
|
||||||
|
CDEF("getpixel", f_getpixel);
|
||||||
|
|
||||||
f_loadjor(bootjor);
|
f_loadjor(bootjor);
|
||||||
|
|
||||||
|
|
6
video.h
6
video.h
|
@ -18,7 +18,11 @@
|
||||||
#define setPlaneColor(c) outport(REG_TS, 2 | (c << 8))
|
#define setPlaneColor(c) outport(REG_TS, 2 | (c << 8))
|
||||||
#define setAllPlanes() setPlaneColor(0x0f)
|
#define setAllPlanes() setPlaneColor(0x0f)
|
||||||
|
|
||||||
#define setWriteMode(m) outport(REG_GDC, 0x05 | m << 8)
|
#define setWriteMode(m) outport(REG_GDC, 0x05 | (m << 8))
|
||||||
|
#define setBitMask(m) outport(REG_GDC, 0x08 | (m << 8))
|
||||||
|
|
||||||
|
#define setResetEnabled(m) outport(REG_GDC, 0x01 | (m << 8))
|
||||||
|
#define setResetMask(m) outport(REG_GDC, m << 8)
|
||||||
|
|
||||||
#define VID ((volatile char far *)MK_FP(0xa000, 0))
|
#define VID ((volatile char far *)MK_FP(0xa000, 0))
|
||||||
#define WVID ((volatile int far *)MK_FP(0xa000, 0))
|
#define WVID ((volatile int far *)MK_FP(0xa000, 0))
|
||||||
|
|
Loading…
Reference in a new issue