]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/16_vlpal.c
i did a butt load of tweaking to the paltest code and i did verious fixes here and...
[16.git] / src / lib / 16_vlpal.c
index 3a809828e52704bdc6e0adb8b47393926edf3066..57a97f0a70e35071cd170571e381bed3d8cea0a0 100755 (executable)
 \r
 //color checker~\r
 //i want to make another vesion that checks the palette when the palette is being appened~\r
-void modexchkcolor(imgtestpal_t *bmp, word *q, word *a, word *aa, word *z, word *i/*, word *offset*/)\r
+void modexchkcolor(imgtestpal_t *bmp, word *q, word *a, word *aa, word *z, word *i/*, word *offset*/, global_game_variables_t *gv)\r
 {\r
-               byte *pal;\r
+               byte *pal=&(gv->video.palette);\r
                word zz=0;\r
-               pal = modexNewPal();\r
-               modexPalSave(pal);\r
+               //pal = modexNewPal();\r
+//             modexPalSave(pal);\r
                CHKCOLDBGOUT1\r
                //check palette for dups\r
-               for(; (*z)<PAL_SIZE-3; (*z)+=3)\r
+               for(; (*z)<PAL_SIZE; (*z)+=3)\r
                {\r
                        CHKCOLDBGOUT2\r
                        //if((*z)%3==0)\r
@@ -93,13 +93,13 @@ no... wait.... no wwww
 }\r
 \r
 void\r
-VL_palette(imgtestpal_t *bmp, byte *p, word *i, word qp, word aqoffset)\r
+VL_palette(imgtestpal_t *bmp, byte *p, word *i, word qp, word aqoffset, global_game_variables_t *gv)\r
 {\r
        //byte *p = bmp->palette;\r
        word w=0;\r
        word q=0;\r
        word qq=0;\r
-       static word a[PAL_SIZE-3];      //palette array of change values!\r
+       static word a[PAL_SIZE];        //palette array of change values!\r
        word z=0, aq=0, aa=0, pp=0;\r
 \r
        //modexWaitBorder();\r
@@ -107,7 +107,7 @@ VL_palette(imgtestpal_t *bmp, byte *p, word *i, word qp, word aqoffset)
        if((*i)==0)\r
        {\r
                memset(a, -1, sizeof(a));\r
-               outp(PAL_WRITE_REG, 1);  /* start at the beginning of palette */\r
+               outp(PAL_WRITE_REG, 0);  /* start at the beginning of palette */\r
        }\r
        else if(qp==0)\r
        {\r
@@ -122,11 +122,11 @@ VL_palette(imgtestpal_t *bmp, byte *p, word *i, word qp, word aqoffset)
                printf("qq: %02d\n", (qq));//\r
                printf("          (*i)-q=%02d\n", (*i)-q);//\r
 #endif\r
-               outp(PAL_WRITE_REG, qq);\r
+               outp(PAL_WRITE_REG, qq);  /* start at the beginning of palette */\r
        }\r
-       if((*i)<PAL_SIZE-3 && w==0)\r
+       if((*i)<PAL_SIZE && w==0)\r
        {\r
-               for(; (*i)<PAL_SIZE-3; (*i)++)\r
+               for(; (*i)<PAL_SIZE; (*i)++)\r
                {\r
                        //if(i%3==0 && (p[i+5]==p[i+4] && p[i+4]==p[i+3] && p[i+3]==p[i+2] && p[i+2]==p[i+1] && p[i+1]==p[i] && p[i+5]==p[i]))\r
 //____           if((qp>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\r
@@ -179,7 +179,7 @@ VL_palette(imgtestpal_t *bmp, byte *p, word *i, word qp, word aqoffset)
                printf("1(*i)=%02d\n", (*i)/3);//\r
                printf("1z=%02d\n", z/3);//\r
 #endif\r
-               modexchkcolor(bmp, &q, &a, &aa, &z, i);\r
+               modexchkcolor(bmp, &q, &a, &aa, &z, i, gv);\r
 #ifdef BEVERBOSEPALCHECK\r
                printf("2(*i)=%02d\n", (*i)/3);\r
                printf("2z=%02d\n", z/3);\r
@@ -189,7 +189,7 @@ aqpee:
                while(aq<=aa)\r
                {\r
 #ifdef BEVERBOSEPALCHECK\r
-                       printf("a[%02d]=(%d)\n", aq, a[aq]);//\r
+//                     printf("a[%02d]=(%d)\n", aq, a[aq]);//0000\r
 #endif\r
                        if(a[aq]==-1) aq++;\r
                        else { aqoffset++; break; }\r
@@ -253,7 +253,7 @@ printf("              aq=%02d\n", aq);//
 printf("                 aa=%02d\n", aa);//\r
 #endif\r
        //update the palette~\r
-       VL_palette(bmp, p, &pp, aq, aqoffset);\r
+       VL_palette(bmp, p, &pp, aq, aqoffset, gv);\r
        (*i)=pp;\r
 \r
        if(aq<aa){ pp=q; aq++; goto aqpee; }\r