X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Fmodex16%2F16planar.c;h=cd528e46fd3675f8fde171dc74365a4278ef0281;hb=bb4d13928a126dede13e5ccc3cdb19059ed71b55;hp=ea5675bcd8569831e9a067d8f4c46e187880deb7;hpb=bb43fc8365a5409f885835cff9dcf4f104630748;p=16.git diff --git a/src/lib/modex16/16planar.c b/src/lib/modex16/16planar.c index ea5675bc..cd528e46 100755 --- a/src/lib/modex16/16planar.c +++ b/src/lib/modex16/16planar.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover * * This file is part of Project 16. * @@ -90,7 +90,7 @@ pbuf_alloc(word width, word height) { /* allocate the planes */ for(i=0; i<4; i++) { - p.plane[i] = _fmalloc(p.height * p.pwidth); + p.plane[i] = _fmalloc((p.height * p.pwidth)+1); } return p; @@ -123,8 +123,6 @@ planar_buf_t planarLoadPcx(char *filename) word index[4], plane; byte count, val; - word px,py,i,pla; - /*word w=0; fprintf(stderr, "\nplanarLoadPcx: "); fprintf(stderr, "%u ", w++);*/ @@ -182,6 +180,9 @@ fprintf(stderr, "%u ", w++);*/ /* write the pixel the specified number of times */ //fprintf(stderr, "\nputting in memory~ %u\n", w++); for(; count && (index[0]+index[1]+index[2]+index[3]) < bufSize; count--,index[plane]++) { + // copy to each plane + result.plane[plane][index[plane]]=(word)val; +//fprintf(stdout, "plane=%u index val=%02X val=%02X\n", plane, result.plane[plane][index[plane]], val); switch (plane) { case 4: @@ -196,29 +197,14 @@ fprintf(stderr, "%u ", w++);*/ plane=0; break; } - // copy to each plane - result.plane[plane][index[plane]]=val; //fprintf(stdout, "count=%02X index=%u plane=%u ", count, index[plane], plane); -//fprintf(stdout, "index val=%02X val=%02X\n", result.plane[plane][index[plane]], val); } + //val++; // fprintf(stdout, "\nindex=%lu bufsize=%lu\n\n", (dword)(index[0]+index[1]+index[2]+index[3]), bufSize); } while((index[0]+index[1]+index[2]+index[3]) < bufSize); loadPcxpbufPalette(file, &result); fclose(file); - -// //dump value!! -// for(pla=0; pla < 4; pla++) { -// i=0; -// printf("Plane %d\n", pla); -// for(py=0; py < result.height; py++) { -// for(px=0; px < result.pwidth; px++) { -// printf("%02X ", (int) result.plane[pla][i++]); -// } -// printf("\n"); -// } -// } // fprintf(stderr, "\n\n%s count=%d index=%d plane=%d\n", filename, count, (dword)(index[0]+index[1]+index[2]+index[3]), pla); -// exit(0); return result; }