From: sparky4 Date: Sat, 4 Feb 2017 19:04:37 +0000 (-0600) Subject: moved my palette function failure to 16_vlpal.c X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=02ebe5d276d33d55b9d46fef19a8ef939b7c9743;p=16.git moved my palette function failure to 16_vlpal.c --- diff --git a/MEMINFO.16W b/MEMINFO.16W deleted file mode 100755 index e69de29b..00000000 diff --git a/db.exe b/db.exe index 457a9fa1..af80cac8 100755 Binary files a/db.exe and b/db.exe differ diff --git a/makefile b/makefile index 0aa855fb..850d92ed 100755 --- a/makefile +++ b/makefile @@ -124,7 +124,7 @@ LIBFLAGS=$(WLIBQ) -b -n # VGMSNDOBJ = vgmSnd.$(OBJ) 16_snd.$(OBJ) OLDLIBOBJS=bitmap.$(OBJ) 16render.$(OBJ) -GFXLIBOBJS = 16_vl.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16_vrs.$(OBJ) 16_spri.$(OBJ) $(OLDLIBOBJS) +GFXLIBOBJS = 16_vl.$(OBJ) 16_vlpal.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16_vrs.$(OBJ) 16_spri.$(OBJ) $(OLDLIBOBJS) 16LIBOBJS = 16_mm.$(OBJ) 16_pm.$(OBJ) 16_ca.$(OBJ) 16_tail.$(OBJ) 16_in.$(OBJ) 16_head.$(OBJ) 16_dbg.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) 16_wcpu.$(OBJ) 16_timer.$(OBJ) jsmn.$(OBJ) 16_map.$(OBJ) 16text.$(OBJ) 16_enti.$(OBJ) DOSLIBOBJ = adlib.$(OBJ) 8254.$(OBJ) 8259.$(OBJ) dos.$(OBJ) cpu.$(OBJ) !ifeq DEBUGSERIAL 1 @@ -320,7 +320,8 @@ joytest.exe: cd $(DOSLIB_JOYSTICK:$(to_os_path)) && $(DOSLIBMAKE) $(DOSLIB_MEMMODE) && cd $(BUILD_ROOT) $(COPYCOMMAND) $(DOSLIB_JOYSTICK:$(to_os_path))$(DIRSEP)$(DOSLIB_MEMMODE)$(DIRSEP)test.exe joytest.exe -16_vl.$(OBJ):$(SRCLIB)/16_vl.c $(SRCLIB)/16_vl.h +16_vl.$(OBJ): $(SRCLIB)/16_vl.c $(SRCLIB)/16_vl.h +16_vlpal.$(OBJ): $(SRCLIB)/16_vlpal.c $(SRCLIB)/16_vlpal.h bakapee.$(OBJ):$(SRCLIB)/bakapee.c $(SRCLIB)/bakapee.h 16render.$(OBJ):$(SRCLIB)/16render.c $(SRCLIB)/16render.h 16planar.$(OBJ):$(MODEXLIB16)/16planar.c $(MODEXLIB16)/16planar.h diff --git a/src/lib/16_vl.c b/src/lib/16_vl.c index ab9a143b..a0b58723 100755 --- a/src/lib/16_vl.c +++ b/src/lib/16_vl.c @@ -617,7 +617,7 @@ fadePalette(sbyte fade, sbyte start, word iter, byte *palette) { /* handle the case where we just update */ if(iter == 0) { - modexPalUpdate1(palette); + modexPalUpdate(palette); return; } @@ -630,7 +630,7 @@ fadePalette(sbyte fade, sbyte start, word iter, byte *palette) { tmppal[i] = 63; } } - modexPalUpdate1(tmppal); + modexPalUpdate(tmppal); iter--; dim += fade; } @@ -740,177 +740,10 @@ modexPalWhite() { /* utility */ -void -modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqoffset) -{ - byte *p = bmp->palette; - word w=0; - word q=0; - word qq=0; - static word a[PAL_SIZE]; //palette array of change values! - word z=0, aq=0, aa=0, pp=0; - - //modexWaitBorder(); - vga_wait_for_vsync(); - if((*i)==0) - { - memset(a, -1, sizeof(a)); - outp(PAL_WRITE_REG, 0); /* start at the beginning of palette */ - } - else if(qp==0) - { - q=(*i); - } - else - { - q=(*i); - qq=(*i)/3; -// printf("q: %02d\n", (q)); -// printf("qq: %02d\n", (qq)); - //printf(" (*i)-q=%02d\n", (*i)-q); - outp(PAL_WRITE_REG, qq); /* start at the beginning of palette */ - } - if((*i)0)&&((*i)-q)%3==0 && (p[((*i)-q)]==p[((*i)-q)+3] && p[((*i)-q)+1]==p[((*i)-q)+4] && p[((*i)-q)+2]==p[((*i)-q)+5])) outp(PAL_DATA_REG, p[(*i)-q]); else - if(((((*i)-q)%3==0)) && (p[((*i)-q)]==p[((*i)-q)+3] && p[((*i)-q)+1]==p[((*i)-q)+4] && p[((*i)-q)+2]==p[((*i)-q)+5])) - { - w++; - break; - } - else if(qp>0 && (*i)>=(qp) && (*i)<((qp)+3)) - { - //printf("qp=%d\n", qp); - //printf(" (*i)=%d a[%d]=%d\n", (*i), qp, a[qp]); - printf(" %d's color=%d\n", (*i), (a[qp])-(bmp->offset*3)+qp); - //outp(PAL_DATA_REG, p[((a[qp])-(bmp->offset*3)+qp)]);// fix this shit! - if((*i)+1==(qp)+3){ w++; /*(*i)++;*/ break; } - } - else - { - if(bmp->offset==0 && (*i)<3 && q==0) outp(PAL_DATA_REG, 0); - else - if(qp==0) outp(PAL_DATA_REG, p[(*i)-q]); - else{ //outp(PAL_DATA_REG, p[((*i)-(bmp->offset*3)+qp)]); - printf("p[]=%d qp=%d p[]-qp=%d\n", ((*i)-(bmp->offset*3)), qp, ((*i)-(bmp->offset*3))+qp); } - } - } - //if(qp>0) printf("qp=%d\n", qp); - //if(qp>0) printf(" (*i)=%d\n", (*i)/3); - } - //modexWaitBorder(); /* waits one retrace -- less flicker */ - vga_wait_for_vsync(); - if((*i)>=PAL_SIZE/2 && w==0) - { - for(; (*i)0)&&((*i)-q)%3==0 && (p[((*i)-q)]==p[((*i)-q)+3] && p[((*i)-q)+1]==p[((*i)-q)+4] && p[((*i)-q)+2]==p[((*i)-q)+5])) outp(PAL_DATA_REG, p[(*i)-q]); else - if(((((*i)-q)%3==0)) && (p[((*i)-q)]==p[((*i)-q)+3] && p[((*i)-q)+1]==p[((*i)-q)+4] && p[((*i)-q)+2]==p[((*i)-q)+5])) - { - w++; - break; - } - else if(qp>0 && (*i)>=(qp) && (*i)<((qp)+3)) - { - //printf("qp=%d\n", qp); - //printf(" (*i)=%d a[%d]=%d\n", (*i), qp, a[qp]); - printf(" %d's color=%d\n", (*i), (a[qp]-(bmp->offset*3)+qp)); - //outp(PAL_DATA_REG, p[((a[qp])-(bmp->offset*3)+qp)]);// fix this shit! - if((*i)+1==(qp)+3){ w++; /*(*i)++;*/ break; } - } - else - { - if(qp==0) outp(PAL_DATA_REG, p[(*i)-q]); - else{ //outp(PAL_DATA_REG, p[((*i)-(bmp->offset*3)+qp)]); - printf("p[]=%d qp=%d p[]-qp=%d\n", ((*i)-(bmp->offset*3)), qp, ((*i)-(bmp->offset*3))+qp); } - } - } - //printf(" (*i)=%d\n", (*i)/3); - } - -printf("\nqqqqqqqq\n\n"); - - //palette checker~ - if(q>0 && qp==0) - { - long lq; - long bufSize = (bmp->width * bmp->height); - pp = q; - //printf("1(*i)=%02d\n", (*i)/3); - //printf("1z=%02d\n", z/3); - modexchkcolor(bmp, &q, &a, &aa, &z, i); - //printf("2(*i)=%02d\n", (*i)/3); - //printf("2z=%02d\n", z/3); - aq=0; -aqpee: - while(aq<=aa) - { -// printf("a[%02d]=(%d)\n", aq, a[aq]); - if(a[aq]==-1) aq++; - else { aqoffset++; break; } - } -//update the image data here! - for(lq=0; lqoffset for this spot! - NO! wwww - */ - - /* - Facking bloody point the values of the changed palette to correct values.... major confusion! wwww - */ - - //(offset/bmp->offset)*bmp->offset - - - //printf("%02d ",bmp->data[lq]+bmp->offset); - //if(lq > 0 && lq%bmp->width==0) printf("\n"); - //printf("%02d_", bmp->data[lq]+bmp->offset); - /*if(bmp->data[lq]+bmp->offset==aq) - { - //printf("%02d", bmp->data[lq]); - //printf("\n%02d\n", bmp->offset); - printf("aq=%02d ", aq); - printf("a[aq]=%02d ", a[aq]); - printf("a[aq]+aqpp=%02d ", a[aq]+aqpp); - printf("a[aq]-aqpp=%02d\n", a[aq]-aqpp); - //bmp->data[lq]=((bmp->data[lq]+bmp->offset)-a[aq]); -//++++ bmp->data[lq]=a[aq]-aqpp; -// printf("_%d ", bmp->data[lq]); - //if(lq > 0 && lq%bmp->width==0) printf("\n"); - } - else if(bmp->data[lq]+bmp->offset < ((*i)/3)-aqpp) - { - if(bmp->data[lq]+bmp->offset >= aq) - { - bmp->data[lq]=(bmp->data[lq]+bmp->offset)-aqpp;//-((z-(*i))/3); - //printf("_%d ", bmp->data[lq]+bmp->offset)-aqpp-((z-(*i))/3); - } - else bmp->data[lq]+=(bmp->offset-aqpp); - }*/ - - //printf("%02d`", bmp->data[lq]); - //if(lq > 0 && lq%bmp->width==0) printf("\n"); - } - -//printf(" aq=%02d\n", aq); -//printf(" aa=%02d\n", aa); - - //update the palette~ - modexPalUpdate(bmp, &pp, aq, aqoffset); - (*i)=pp; - - if(aq, or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#include "src/lib/16_vlpal.h" + +void VL_palette(bitmap_t *bmp, word *i, word qp, word aqoffset) +{ + byte *p = bmp->palette; + word w=0; + word q=0; + word qq=0; + static word a[PAL_SIZE]; //palette array of change values! + word z=0, aq=0, aa=0, pp=0; + + //modexWaitBorder(); + vga_wait_for_vsync(); + if((*i)==0) + { + memset(a, -1, sizeof(a)); + outp(PAL_WRITE_REG, 0); /* start at the beginning of palette */ + } + else if(qp==0) + { + q=(*i); + } + else + { + q=(*i); + qq=(*i)/3; +// printf("q: %02d\n", (q)); +// printf("qq: %02d\n", (qq)); + //printf(" (*i)-q=%02d\n", (*i)-q); + outp(PAL_WRITE_REG, qq); /* start at the beginning of palette */ + } + if((*i)0)&&((*i)-q)%3==0 && (p[((*i)-q)]==p[((*i)-q)+3] && p[((*i)-q)+1]==p[((*i)-q)+4] && p[((*i)-q)+2]==p[((*i)-q)+5])) outp(PAL_DATA_REG, p[(*i)-q]); else + if(((((*i)-q)%3==0)) && (p[((*i)-q)]==p[((*i)-q)+3] && p[((*i)-q)+1]==p[((*i)-q)+4] && p[((*i)-q)+2]==p[((*i)-q)+5])) + { + w++; + break; + } + else if(qp>0 && (*i)>=(qp) && (*i)<((qp)+3)) + { + //printf("qp=%d\n", qp); + //printf(" (*i)=%d a[%d]=%d\n", (*i), qp, a[qp]); + printf(" %d's color=%d\n", (*i), (a[qp])-(bmp->offset*3)+qp); + //outp(PAL_DATA_REG, p[((a[qp])-(bmp->offset*3)+qp)]);// fix this shit! + if((*i)+1==(qp)+3){ w++; /*(*i)++;*/ break; } + } + else + { + if(bmp->offset==0 && (*i)<3 && q==0) outp(PAL_DATA_REG, 0); + else + if(qp==0) outp(PAL_DATA_REG, p[(*i)-q]); + else{ //outp(PAL_DATA_REG, p[((*i)-(bmp->offset*3)+qp)]); + printf("p[]=%d qp=%d p[]-qp=%d\n", ((*i)-(bmp->offset*3)), qp, ((*i)-(bmp->offset*3))+qp); } + } + } + //if(qp>0) printf("qp=%d\n", qp); + //if(qp>0) printf(" (*i)=%d\n", (*i)/3); + } + //modexWaitBorder(); /* waits one retrace -- less flicker */ + vga_wait_for_vsync(); + if((*i)>=PAL_SIZE/2 && w==0) + { + for(; (*i)0)&&((*i)-q)%3==0 && (p[((*i)-q)]==p[((*i)-q)+3] && p[((*i)-q)+1]==p[((*i)-q)+4] && p[((*i)-q)+2]==p[((*i)-q)+5])) outp(PAL_DATA_REG, p[(*i)-q]); else + if(((((*i)-q)%3==0)) && (p[((*i)-q)]==p[((*i)-q)+3] && p[((*i)-q)+1]==p[((*i)-q)+4] && p[((*i)-q)+2]==p[((*i)-q)+5])) + { + w++; + break; + } + else if(qp>0 && (*i)>=(qp) && (*i)<((qp)+3)) + { + //printf("qp=%d\n", qp); + //printf(" (*i)=%d a[%d]=%d\n", (*i), qp, a[qp]); + printf(" %d's color=%d\n", (*i), (a[qp]-(bmp->offset*3)+qp)); + //outp(PAL_DATA_REG, p[((a[qp])-(bmp->offset*3)+qp)]);// fix this shit! + if((*i)+1==(qp)+3){ w++; /*(*i)++;*/ break; } + } + else + { + if(qp==0) outp(PAL_DATA_REG, p[(*i)-q]); + else{ //outp(PAL_DATA_REG, p[((*i)-(bmp->offset*3)+qp)]); + printf("p[]=%d qp=%d p[]-qp=%d\n", ((*i)-(bmp->offset*3)), qp, ((*i)-(bmp->offset*3))+qp); } + } + } + //printf(" (*i)=%d\n", (*i)/3); + } + +printf("\nqqqqqqqq\n\n"); + + //palette checker~ + if(q>0 && qp==0) + { + long lq; + long bufSize = (bmp->width * bmp->height); + pp = q; + //printf("1(*i)=%02d\n", (*i)/3); + //printf("1z=%02d\n", z/3); + modexchkcolor(bmp, &q, &a, &aa, &z, i); + //printf("2(*i)=%02d\n", (*i)/3); + //printf("2z=%02d\n", z/3); + aq=0; +aqpee: + while(aq<=aa) + { +// printf("a[%02d]=(%d)\n", aq, a[aq]); + if(a[aq]==-1) aq++; + else { aqoffset++; break; } + } +//update the image data here! + for(lq=0; lqoffset for this spot! + NO! wwww + */ + + /* + Facking bloody point the values of the changed palette to correct values.... major confusion! wwww + */ + + //(offset/bmp->offset)*bmp->offset + + + //printf("%02d ",bmp->data[lq]+bmp->offset); + //if(lq > 0 && lq%bmp->width==0) printf("\n"); + //printf("%02d_", bmp->data[lq]+bmp->offset); + /*if(bmp->data[lq]+bmp->offset==aq) + { + //printf("%02d", bmp->data[lq]); + //printf("\n%02d\n", bmp->offset); + printf("aq=%02d ", aq); + printf("a[aq]=%02d ", a[aq]); + printf("a[aq]+aqpp=%02d ", a[aq]+aqpp); + printf("a[aq]-aqpp=%02d\n", a[aq]-aqpp); + //bmp->data[lq]=((bmp->data[lq]+bmp->offset)-a[aq]); +//++++ bmp->data[lq]=a[aq]-aqpp; +// printf("_%d ", bmp->data[lq]); + //if(lq > 0 && lq%bmp->width==0) printf("\n"); + } + else if(bmp->data[lq]+bmp->offset < ((*i)/3)-aqpp) + { + if(bmp->data[lq]+bmp->offset >= aq) + { + bmp->data[lq]=(bmp->data[lq]+bmp->offset)-aqpp;//-((z-(*i))/3); + //printf("_%d ", bmp->data[lq]+bmp->offset)-aqpp-((z-(*i))/3); + } + else bmp->data[lq]+=(bmp->offset-aqpp); + }*/ + + //printf("%02d`", bmp->data[lq]); + //if(lq > 0 && lq%bmp->width==0) printf("\n"); + } + +//printf(" aq=%02d\n", aq); +//printf(" aa=%02d\n", aa); + + //update the palette~ + VL_palette(bmp, &pp, aq, aqoffset); + (*i)=pp; + + if(aqpalette); + modexPalUpdate(&PCXBMP->palette); /* clear and draw one sprite and one bitmap */ modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].width, gvar.video.page[0].height, 1); diff --git a/src/pcxtest2.c b/src/pcxtest2.c index efebd168..ab6e3b1e 100755 --- a/src/pcxtest2.c +++ b/src/pcxtest2.c @@ -95,7 +95,7 @@ void main() { gvar.video.page[0].sh+=32; /* fix up the palette and everything */ - modexPalUpdate1(bmp.palette); + modexPalUpdate(bmp.palette); /* clear and draw one sprite and one bitmap */ modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].sw, gvar.video.page[0].sh, 1); diff --git a/src/scroll.c b/src/scroll.c index de0cefd2..6e7664f0 100755 --- a/src/scroll.c +++ b/src/scroll.c @@ -88,9 +88,9 @@ void main(int argc, char *argv[]) #endif #endif //++++ PCXBMPVAR.offset=(paloffset/3); -//++++ modexPalUpdate1(&PCXBMPVAR, &paloffset, 0, 0); - modexPalUpdate1(&PCXBMP->palette); -//++++0000 modexPalUpdate1(map.tiles->btdata->palette); +//++++ modexPalUpdate(&PCXBMPVAR, &paloffset, 0, 0); + modexPalUpdate(&PCXBMP->palette); +//++++0000 modexPalUpdate(map.tiles->btdata->palette); //printf(" %d\n", sizeof(ptmp->data)); //printf("1: %d\n", paloffset); //++++ map.tiles->data->offset=(paloffset/3); @@ -220,7 +220,7 @@ void main(int argc, char *argv[]) //9 #ifdef FADE - if(IN_KeyDown(10)){ modexPalOverscan(rand()%56); modexPalUpdate1(dpal); IN_UserInput(1,1); } + if(IN_KeyDown(10)){ modexPalOverscan(rand()%56); modexPalUpdate(dpal); IN_UserInput(1,1); } #endif if(IN_KeyDown(sc_R)){ modexPalOverscan(rand()%56); } //r diff --git a/src/test.c b/src/test.c index 839915fc..2f4fd6b5 100755 --- a/src/test.c +++ b/src/test.c @@ -182,7 +182,7 @@ void main(int argc, char *argv[]) for(i=0;i<3;i++) { pal2[i] = rand()%64; - modexPalUpdate1(pal2); + modexPalUpdate(pal2); colo++; if(colo>HGQ) colo=LGQ; } diff --git a/src/vrstest.c b/src/vrstest.c index d006969d..1037b7c9 100755 --- a/src/vrstest.c +++ b/src/vrstest.c @@ -120,7 +120,7 @@ void main() t2 = (*clockw-start)/18.2; /*modexLoadPalFile("data/spri/chikyuu.pal", &pal); - modexPalUpdate1(pal);*/ + modexPalUpdate(pal);*/ //modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].width, gvar.video.page[0].height, 2); VL_LoadPalFile("data/spri/chikyuu.pal", &gvar.video.palette); for (i = 0; i < 10; i++){ diff --git a/src/zcroll.c b/src/zcroll.c index 7d586501..c0bd1079 100755 --- a/src/zcroll.c +++ b/src/zcroll.c @@ -110,8 +110,7 @@ void main(int argc, char *argv[]) /* load color palette */ VL_LoadPalFile(bakapee1p, &gvar.video.palette); -// CA_LoadFile("data/spri/"BAKAPEEFILE1".pal", &pal, &gvar); -// modexPalUpdate1(pal); + #ifdef FADE gpal = modexNewPal(); modexPalSave(gpal); @@ -202,7 +201,7 @@ void main(int argc, char *argv[]) VL_LoadPalFile(bakapee1p, &gvar.video.palette); }//JK #ifdef FADE - if(IN_KeyDown(10)){ modexPalOverscan(rand()%56); modexPalUpdate1(dpal); IN_UserInput(1,1); } + if(IN_KeyDown(10)){ modexPalOverscan(rand()%56); modexPalUpdate(dpal); IN_UserInput(1,1); } #endif if(IN_KeyDown(sc_R)){ modexPalOverscan(rand()%56); } //r diff --git a/wcpu.exe b/wcpu.exe index 6a5fae4e..dc69eb74 100755 Binary files a/wcpu.exe and b/wcpu.exe differ