X-Git-Url: http://4ch.mooo.com/gitweb/?p=16.git;a=blobdiff_plain;f=src%2Flib%2F16_vlpal.c;h=691171808dcac8a43a8e43d0d7f3f98d5b687183;hp=d6e92a8c5dc423d43b894d0b7d039b30cd5dc27e;hb=ce1c7884eb2b6e2e3b468a7f661abd2962a15122;hpb=02ebe5d276d33d55b9d46fef19a8ef939b7c9743 diff --git a/src/lib/16_vlpal.c b/src/lib/16_vlpal.c index d6e92a8c..69117180 100755 --- a/src/lib/16_vlpal.c +++ b/src/lib/16_vlpal.c @@ -22,14 +22,88 @@ #include "src/lib/16_vlpal.h" -void VL_palette(bitmap_t *bmp, word *i, word qp, word aqoffset) +//color checker~ +//i want to make another vesion that checks the palette when the palette is being appened~ +void modexchkcolor(imgtestpal_t *bmp, word *q, word *a, word *aa, word *z, word *i/*, word *offset*/, global_game_variables_t *gv) { - byte *p = bmp->palette; + byte *pal=&(gv->video.palette); + word zz=0; + //pal = modexNewPal(); +// modexPalSave(pal); + CHKCOLDBGOUT1 + //check palette for dups + for(; (*z)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; + word a[PAL_SIZE]; //palette array of change values! + word z=0, aq=0, aa=0, pp=0, iq=0;//iq=(*i)-q //modexWaitBorder(); vga_wait_for_vsync(); @@ -46,73 +120,58 @@ void VL_palette(bitmap_t *bmp, word *i, word qp, word aqoffset) { q=(*i); qq=(*i)/3; -// printf("q: %02d\n", (q)); -// printf("qq: %02d\n", (qq)); - //printf(" (*i)-q=%02d\n", (*i)-q); +#ifdef BEVERBOSEPALCHECK + printf("q: %02d\n", (q));// + printf("qq: %02d\n", (qq));// + printf(" (*i)-q=%02d\n", (*i)-q);// +#endif 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])) +//____ if((qp>0)&&(iq)%3==0 && (p[(iq)]==p[(iq)+3] && p[(iq)+1]==p[(iq)+4] && p[(iq)+2]==p[(iq)+5])) outp(PAL_DATA_REG, p[iq]); else + if((((iq)%3==0)) && (p[(iq)]==p[(iq)+3] && p[(iq)+1]==p[(iq)+4] && p[(iq)+2]==p[(iq)+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! +#ifdef BEVERBOSEPALCHECK + 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);// +#endif + 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); } + if(qp==0) outp(PAL_DATA_REG, p[iq]); + else + { outp(PAL_DATA_REG, p[((*i)-(bmp->offset*3)+qp)]); +#ifdef BEVERBOSEPALCHECK + printf("p[]=%d qp=%d p[]-qp=%d\n", ((*i)-(bmp->offset*3)), qp, ((*i)-(bmp->offset*3))+qp); +#endif + } } } - //printf(" (*i)=%d\n", (*i)/3); +#ifdef BEVERBOSEPALCHECK + if(qp>0) printf("qp=%d\n", qp);// + if(qp>0) printf(" (*i)=%d\n", (*i)/3);// + printf(" (*i)=%d\n", (*i)/3); +#endif } -printf("\nqqqqqqqq\n\n"); +#ifdef BEVERBOSEPALCHECK + printf("\nqqqqqqqq\n\n"); +#endif //palette checker~ if(q>0 && qp==0) @@ -120,16 +179,22 @@ printf("\nqqqqqqqq\n\n"); 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); +#ifdef BEVERBOSEPALCHECK + printf("1(*i)=%02d\n", (*i)/3);// + printf("1z=%02d\n", z/3);// +#endif + modexchkcolor(bmp, &q, &a, &aa, &z, i, gv); +#ifdef BEVERBOSEPALCHECK + printf("2(*i)=%02d\n", (*i)/3); + printf("2z=%02d\n", z/3); +#endif aq=0; aqpee: while(aq<=aa) { -// printf("a[%02d]=(%d)\n", aq, a[aq]); +#ifdef BEVERBOSEPALCHECK +// printf("a[%02d]=(%d)\n", aq, a[aq]);//0000 +#endif if(a[aq]==-1) aq++; else { aqoffset++; break; } } @@ -148,42 +213,51 @@ aqpee: //(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); +#ifdef BEVERBOSEPALCHECK + //printf("%02d ",bmp->data[lq]+bmp->offset);// + //if(lq > 0 && lq%bmp->width==0) printf("\n");// + //printf("%02d_", bmp->data[lq]+bmp->offset);// +#endif /*if(bmp->data[lq]+bmp->offset==aq) { - //printf("%02d", bmp->data[lq]); - //printf("\n%02d\n", bmp->offset); +#ifdef BEVERBOSEPALCHECK + 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); +#endif //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"); +#ifdef BEVERBOSEPALCHECK + printf("_%d ", bmp->data[lq]);// + if(lq > 0 && lq%bmp->width==0) printf("\n");// +#endif } 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); +#ifdef BEVERBOSEPALCHECK + printf("_%d ", bmp->data[lq]+bmp->offset)-aqpp-((z-(*i))/3);// +#endif } else bmp->data[lq]+=(bmp->offset-aqpp); }*/ - - //printf("%02d`", bmp->data[lq]); - //if(lq > 0 && lq%bmp->width==0) printf("\n"); +#ifdef BEVERBOSEPALCHECK + //printf("%02d`", bmp->data[lq]);// + //if(lq > 0 && lq%bmp->width==0) printf("\n");// +#endif } -//printf(" aq=%02d\n", aq); -//printf(" aa=%02d\n", aa); - +#ifdef BEVERBOSEPALCHECK +printf(" aq=%02d\n", aq);// +printf(" aa=%02d\n", aa);// +#endif //update the palette~ - VL_palette(bmp, &pp, aq, aqoffset); + VL_palette(bmp, p, &pp, aq, aqoffset, &a, gv); (*i)=pp; if(aq