X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fmodex16%2F16render.c;h=0399a7771738f489fe3a77a936387183319ab571;hb=496c6da40bdf534f4ddf3833aee732d1631e5824;hp=6ae57a80a5fad977d1e0212b899555653b87811e;hpb=220f356f1b06b309bbb323dd72b26d7ada94de87;p=16.git diff --git a/src/lib/modex16/16render.c b/src/lib/modex16/16render.c index 6ae57a80..0399a777 100755 --- a/src/lib/modex16/16render.c +++ b/src/lib/modex16/16render.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * @@ -31,36 +31,35 @@ //modexDrawBmpRegion (page_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp) void modexDrawPBufRegion (page_t *page, int x, int y, int rx, int ry, int rw, int rh, planar_buf_t *p, boolean sprite) { - sword plane; + word plane; int i; - const int px=x;//-page->dx; - const int py=y;//-page->dy; - #define PEEE ((rw)/4)-rx - //-(rx/4) - #define PEEEE ((p->pwidth)*(ry)) - //y=py; - //x=px; + const int px=x+page->dx; + const int py=y+page->dy; + const int prw = rw/4; + int prh; + + //fine tuning + rx+=1; + ry+=1; + + //^^; + #define PEEE rx-prw + #define PE (p->pwidth) + if(rhheight) prh = (PE*(ry-4)); + else if(rh==p->height) prh = (PE*(ry)); + y=py; + x=px; //printf("%d,%d p(%d,%d) r(%d,%d) rwh(%d,%d)\n", x, y, px, py, rx, ry, rw, rh); for(plane=0; plane < 4; plane++) { - i=PEEE+PEEEE; - //printf("PEEE=%d ", PEEE); - //printf("PEEEE=%d ", PEEEE); - //printf("i=%d\n", i); - modexSelectPlane(PLANE(plane+x)); + i=PEEE+prh; + modexSelectPlane(PLANE(plane-1)); for(; y < py+rh; y++) { - //for(px=0; px < p->width; px++) { - //printf("%02X ", (int) p->plane[plane][i++]); -// _fmemcpy(buff, &(p->plane[plane][i+=p->pwidth]), p->pwidth); -// printf("buff %u==%s\n", y, *buff); - _fmemcpy(page->data + (((page->width/4) * y) + (x / 4)), &(p->plane[plane][i+=p->pwidth]), (rw/4)); - //} - //if(plane==3) IN_Ack(); + _fmemcpy(page->data + (((page->width/4) * (y)) + ((x) / 4)), &(p->plane[plane][i]), prw); + i+=PE; } - /*printf("y%d=%d ", plane, y); - if(plane==3) printf("y%d=%d\n", plane, y);*/ x=px; y=py; - } + } } @@ -68,7 +67,9 @@ void modexDrawPBufRegion (page_t *page, int x, int y, int rx, int ry, int rw, in void modexDrawPBuf(page_t *page, int x, int y, planar_buf_t *p, boolean sprite) { - int plane; + modexDrawPBufRegion (page, x, x, 0, 0, p->width, p->height, p, sprite); + /* + sword plane; int i; // byte near *buff; const int px=x+page->dx; @@ -93,20 +94,21 @@ modexDrawPBuf(page_t *page, int x, int y, planar_buf_t *p, boolean sprite) // } for(plane=0; plane < 4; plane++) { i=0; - modexSelectPlane(PLANE(plane+x)); + modexSelectPlane(PLANE(plane-1)); for(; y < py+p->height; y++) { //for(px=0; px < p->width; px++) { //printf("%02X ", (int) p->plane[plane][i++]); -// _fmemcpy(buff, &(p->plane[plane][i+=p->pwidth]), p->pwidth); -// printf("buff %u==%s\n", y, *buff); -// _fmemcpy(page->data + (((page->width/4) * (y+page->dy)) + ((x+page->dx) / 4)), buff, p->pwidth); +// _fmemcpy(buff, &(p->plane[plane][i+=p->pwidth]), p->pwidth); +// printf("buff %u==%s\n", y, *buff); +// _fmemcpy(page->data + (((page->width/4) * (y+page->dy)) + ((x+page->dx) / 4)), buff, p->pwidth); _fmemcpy(page->data + (((page->width/4) * y) + (x / 4)), &(p->plane[plane][i+=p->pwidth]), p->pwidth); //} } +//getch(); x=px; y=py; } -// _nfree(buff); +// _nfree(buff);*/ } void @@ -432,3 +434,35 @@ modexDrawSpritePBufRegion(page_t *page, int x, int y, JNZ PLANE_LOOP ; do all 4 planes } } + +void modexDrawCharPBuf(page_t *page, int x, int y, word t, word col, word bgcol, boolean q) +{ + word i, j, k; + for(i=0; idata + (((page->width/4) * (y+i)) + ((x+romFontsData.chw+k) / 4)), romFontsData.l[i] & j ? col:bgcol, 2); + modexputPixel(page, x+k+romFontsData.chw, y+i, romFontsData.l[i] & j ? col:bgcol); + else + //printf("l[i]=%c j=%02u l[i] & j=%02u %c\n", l[i] , j, l[i] & j, l[i] & j ? '*':' '); + //printf("%c", l[i] & j ? '*':' '); + romFontsData.z[k]=romFontsData.l[i] & j ? '*':' '; + j>>=1; + k++; + } + if(!q) + { + for(k=0;k<9;k++) + { + printf("%c", romFontsData.z[k]); + } + printf("\n"); + } + } + romFontsData.chw += k; +}