From: sparky4 Date: Mon, 30 Mar 2015 10:26:29 +0000 (-0500) Subject: color palette updater dose not operate the way i want it to.... X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=064eedc8b51015c259233375ec7744e2bf20d65c;p=16.git color palette updater dose not operate the way i want it to.... modified: data/g.pal modified: pcxtest.exe modified: scroll.exe modified: src/lib/modex16.c modified: src/lib/modex16.h modified: src/pcxtest.c modified: src/scroll.c modified: test.exe modified: test2.exe --- diff --git a/data/g.pal b/data/g.pal index c6ab01c5..b9f6a3c5 100644 Binary files a/data/g.pal and b/data/g.pal differ diff --git a/pcxtest.exe b/pcxtest.exe index deaf73ac..2cff9040 100644 Binary files a/pcxtest.exe and b/pcxtest.exe differ diff --git a/scroll.exe b/scroll.exe index 770b479d..87e392ef 100644 Binary files a/scroll.exe and b/scroll.exe differ diff --git a/src/lib/modex16.c b/src/lib/modex16.c index c3a808aa..e346ab3e 100644 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -591,32 +591,82 @@ modexPalWhite() { /* utility */ void -modexPalUpdate(bitmap_t *bmp, word *i, word qp) +modexPalUpdate(bitmap_t *bmp, word *i, word qp, word qr) { byte *p = bmp->palette; word w=0; word q=0; + word qq=0; + word *qqqq; + static word a[256] = { 0 }; + word z=0,aq=0,aa=0; + word pp=0,aqpp=0,spee=0,ppee=0; - if(qp>0) printf("(*i)=%02d\n", (*i)/3); - +// if(qp>0) printf("(*i)=%02d\n", (*i)); modexWaitBorder(); if((*i)==0) outp(PAL_WRITE_REG, 0); /* start at the beginning of palette */ - else if(qp==0) q=(*i);// else outp(PAL_WRITE_REG, (*i)); + else if(qp==0) + { + q=(*i); + (*qqqq)=(*i)-q; + //mxi1=PAL_SIZE/2; + //mxi2=PAL_SIZE; + } + else + { + q=(*i); + qq=(*i)/3; + (*qqqq)=(*i)-(bmp->offset*3); + //mxi1=q+3; + //mxi2=q+3; +// printf("q: %02d\n", (q)); + //printf("mxi1: %02d\n", mxi1); +// printf("qq: %02d\n", (qq)); + //printf(" ((*i)-(bmp->offset*3))=%02d\n", ((*i)-(bmp->offset*3))); + //printf(" (*i)-q=%02d\n", (*i)-q); +// printf("qqqq: %d\n",(*qqqq)); +// printf("================\n"); + 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((((*i)-q)%3==0 || ((qp>0)&&((*i)-(bmp->offset*3))%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])) { -// printf("[%d]", p[((*i)-q)]); printf("[%d]", p[((*i)-q)+1]); printf("[%d]", p[((*i)-q)+2]); printf("[%d]", p[((*i)-q)+3]); printf("[%d]", p[((*i)-q)+4]); printf("[%d]", p[((*i)-q)+5]); printf(" %d [%d]\n", (*i), p[((*i)-q)]); + printf("[%d]", p[((*i)-q)]); printf("[%d]", p[((*i)-q)+1]); printf("[%d]", p[((*i)-q)+2]); printf("[%d]", p[((*i)-q)+3]); printf("[%d]", p[((*i)-q)+4]); printf("[%d]", p[((*i)-q)+5]); printf(" %d [%d]\n", (*i), p[((*i)-q)]); w++; break; } else { - outp(PAL_DATA_REG, p[(*i)-q]); + /*if(qp>0) + { + printf(" ((*i)-(bmp->offset*3))=%02d\n", ((*i)-(bmp->offset*3))); + }*/ + /*if(q>0 && qp==0) + { + printf("(*i)-q=%02d", (*i)-q); + printf("[%d]", p[((*i)-q)]); printf("[%d]", p[((*i)-q)+1]); printf("[%d]", p[((*i)-q)+2]); printf("[%d]", p[((*i)-q)+3]); printf("[%d]", p[((*i)-q)+4]); printf("[%d]", p[((*i)-q)+5]); printf(" %d [%d]\n", (*i), p[((*i)-q)]); + }*/ + if(qp==0) outp(PAL_DATA_REG, p[(*i)-q]); + else outp(PAL_DATA_REG, p[((*i)-(bmp->offset*3))]); + /*if(q>0 && qp==0) + { + qq=(*i)-q; + chkcolor(bmp, &q, &a, &aa, &z); + if(a[(*i)-q]==0) + { + printf("%d qqqq\n", qq); + outp(PAL_DATA_REG, p[(*i)-q]); + } + } + else + { + outp(PAL_DATA_REG, p[(*i)-q]); + }*/ } } } @@ -626,92 +676,61 @@ modexPalUpdate(bitmap_t *bmp, word *i, word qp) 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])) + if((((*i)-q)%3==0 || ((qp>0)&&((*i)-(bmp->offset*3))%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])) { -// printf("[%d]", p[((*i)-q)]); printf("[%d]", p[((*i)-q)+1]); printf("[%d]", p[((*i)-q)+2]); printf("[%d]", p[((*i)-q)+3]); printf("[%d]", p[((*i)-q)+4]); printf("[%d]", p[((*i)-q)+5]); printf(" %d [%d]\n", (*i), p[((*i)-q)]); + printf("[%d]", p[((*i)-q)]); printf("[%d]", p[((*i)-q)+1]); printf("[%d]", p[((*i)-q)+2]); printf("[%d]", p[((*i)-q)+3]); printf("[%d]", p[((*i)-q)+4]); printf("[%d]", p[((*i)-q)+5]); printf(" %d [%d]\n", (*i), p[((*i)-q)]); w++; break; } else { - outp(PAL_DATA_REG, p[(*i)-q]); + /*if(qp>0) + { + printf(" ((*i)-(bmp->offset*3))=%02d\n", ((*i)-(bmp->offset*3))); + }*/ + /*if(q>0 && qp==0) + { + printf("(*i)-q=%02d", (*i)-q); + printf("[%d]", p[((*i)-q)]); printf("[%d]", p[((*i)-q)+1]); printf("[%d]", p[((*i)-q)+2]); printf("[%d]", p[((*i)-q)+3]); printf("[%d]", p[((*i)-q)+4]); printf("[%d]", p[((*i)-q)+5]); printf(" %d [%d]\n", (*i), p[((*i)-q)]); + }*/ + if(qp==0) outp(PAL_DATA_REG, p[(*i)-q]); + else outp(PAL_DATA_REG, p[((*i)-(bmp->offset*3))]); + /*if(q>0 && qp==0) + { + qq=(*i)-q; + chkcolor(bmp, &q, &a, &aa, &z); + if(a[(*i)-q]==0) + { + printf("%d qqqq\n", qq); + outp(PAL_DATA_REG, p[(*i)-q]); + } + } + else + { + outp(PAL_DATA_REG, p[(*i)-q]); + }*/ } } } +// if(qp>0) printf("(*i)=%02d\n", (*i)); //palette checker~ - if(q>0 && qp==0) + if(q>0 && qp==0/* && qr==0*/) { - static word a[256] = { 0 }; + word qw=0; long lq; long bufSize = (bmp->width * bmp->height); - byte *pal; - word z, zz=0,aq=0,aa=0,pp=0,aqpp=0,spee=0,ppp=0; - pal = modexNewPal(); - modexPalSave(pal); - //q-=3; - printf("q: %02d\n", (q/3)); - //check palette for dups - for(z=0; zpalette[pp-q]); - printf("[%d]", bmp->palette[(pp-q)+1]); - printf("[%d]\n", bmp->palette[(pp-q)+2]);*/ + printf("bmp: [%d]", bmp->palette[pp-ppee]); + printf("[%d]", bmp->palette[(pp-ppee)+1]); + printf("[%d]\n", bmp->palette[(pp-ppee)+2]);*/ if(((pp/3)==aq || spee>0)) { printf("spee=%d\n", spee); printf(" pp=%02d ", pp/3); - printf("old bmp: [%d]", bmp->palette[(pp-ppp)]); - printf("[%d]", bmp->palette[(pp-ppp)+1]); - printf("[%d]\n", bmp->palette[(pp-ppp)+2]); + printf("old bmp: [%d]", bmp->palette[(pp-ppee)]); + printf("[%d]", bmp->palette[(pp-ppee)+1]); + printf("[%d]\n", bmp->palette[(pp-ppee)+2]); //if(spee==0) printf("\npp=%02d\n\n", pp/3); - bmp->palette[(pp-ppp)]= bmp->palette[(pp-ppp)+3]; - bmp->palette[(pp-ppp)+1]= bmp->palette[(pp-ppp)+4]; - bmp->palette[(pp-ppp)+2]= bmp->palette[(pp-ppp)+5]; + bmp->palette[(pp-ppee)]= bmp->palette[(pp-ppee)+3]; + bmp->palette[(pp-ppee)+1]= bmp->palette[(pp-ppee)+4]; + bmp->palette[(pp-ppee)+2]= bmp->palette[(pp-ppee)+5]; if(spee==0) spee++; } /* bmp->palette[pp]= bmp->palette[pp+3]; bmp->palette[pp+1]= bmp->palette[pp+4]; bmp->palette[pp+2]= bmp->palette[pp+5];*/ printf(" pp=%02d ", pp/3); - printf(" bmp: [%d]", bmp->palette[(pp-ppp)]); - printf("[%d]", bmp->palette[(pp-ppp)+1]); - printf("[%d]\n", bmp->palette[(pp-ppp)+2]); + printf(" bmp: [%d]", bmp->palette[(pp-ppee)]); + printf("[%d]", bmp->palette[(pp-ppee)+1]); + printf("[%d]\n", bmp->palette[(pp-ppee)+2]); /* printf("bmp: [%d]", bmp->palette[pp]); printf("[%d]", bmp->palette[pp+1]); printf("[%d]\n", bmp->palette[pp+2]);*/ - //aqpp=(pp-q); + //aqpp=(pp-ppee); //else if(pp==(z-1)) bmp->palette[pp]=0; + //if(ppdata->offset=(paloffset/3); - modexPalUpdate(map.tiles->data, &paloffset, 0); + modexPalUpdate(map.tiles->data, &paloffset, 0, 0); //printf("wwww: %d\n", map.tiles->data->offset); //printf("2: %d\n", paloffset); //printf(" %d\n", sizeof(map.tiles->data->(*data))); diff --git a/test.exe b/test.exe index 0bf81152..73b8e85e 100644 Binary files a/test.exe and b/test.exe differ diff --git a/test2.exe b/test2.exe index e6d30e9d..8e3efeb6 100644 Binary files a/test2.exe and b/test2.exe differ