X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fmodex16.c;h=9b47253eef860da180d8901354ac96b6b90377b1;hb=1cc75f46d15728fed75f53a2243c9ad4c8234511;hp=7dd523a96f07bdf9b04eb7eff62823c1b962a15d;hpb=c97a7b2245f9f8ab913efcd2741a0b280e6baa83;p=16.git diff --git a/src/lib/modex16.c b/src/lib/modex16.c index 7dd523a9..9b47253e 100755 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -394,13 +394,14 @@ modexClearRegion(page_t *page, int x, int y, int w, int h, byte color) { } } -void -DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, boolean sprite) +//TODO! +//void +//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) { int plane; int px, py, i; // byte near *buff; - px=x; py=y; // buff = _nmalloc(p->pwidth+1); @@ -420,7 +421,7 @@ DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, boolean sprite) // } // } for(plane=0; plane < 4; plane++) { - i=0; + i=(rx/4)+((rx/4)*ry); modexSelectPlane(PLANE(plane+x)); for(; y < py+p->height; y++) { //for(px=0; px < p->width; px++) { @@ -437,34 +438,54 @@ DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, boolean sprite) // _nfree(buff); } -void -oldDrawBmp(byte far* page, int x, int y, bitmap_t *bmp, byte sprite) +/*void +DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, boolean sprite) { - byte plane; - word px, py; - word offset; - - /* TODO Make this fast. It's SLOOOOOOW */ + int plane; + int px, py, i; +// byte near *buff; + px=x; + py=y; +// buff = _nmalloc(p->pwidth+1); + // TODO Make this fast. It's SLOOOOOOW +// for(plane=0; plane < 4; plane++) { +// i=0; +// modexSelectPlane(PLANE(plane+x)); +// for(px = plane; px < p->width; px+=4) { +// offset=px; +// for(py=0; pyheight/2; py++) { +// //SELECT_ALL_PLANES(); +// if(!sprite || p->plane[offset]) +// page->data = &(p->plane[offset][i++]); +// offset+=p->width; +// offset++; +// } +// } +// } for(plane=0; plane < 4; plane++) { + i=0; modexSelectPlane(PLANE(plane+x)); - for(px = plane; px < bmp->width; px+=4) { - offset=px; - for(py=0; pyheight; py++) { - if(!sprite || bmp->data[offset]) - page[PAGE_OFFSET(x+px, y+py)] = bmp->data[offset]; - offset+=bmp->width; - } + 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(page->data + (((page->width/4) * (y+page->dy)) + ((x+page->dx) / 4)), &(p->plane[plane][i+=p->pwidth]), p->pwidth); + //} } + x=px; + y=py; } -} +// _nfree(buff); +}*/ void -CDrawBmp(byte far* vgamem, page_t* page, int x, int y, bitmap_t *bmp, byte sprite) +oldDrawBmp(byte far* page, int x, int y, bitmap_t *bmp, byte sprite) { byte plane; word px, py; - word offset=0; - + word offset; /* TODO Make this fast. It's SLOOOOOOW */ for(plane=0; plane < 4; plane++) { @@ -473,8 +494,7 @@ CDrawBmp(byte far* vgamem, page_t* page, int x, int y, bitmap_t *bmp, byte sprit offset=px; for(py=0; pyheight; py++) { if(!sprite || bmp->data[offset]) - //modexputPixel(page, x+px, y+py, bmp->data[offset]); - vgamem[PAGE_OFFSET(x+px, y+py)] = bmp->data[offset]; + page[PAGE_OFFSET(x+px, y+py)] = bmp->data[offset]; offset+=bmp->width; } } @@ -1278,6 +1298,7 @@ void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, cons word addr = (word) l; word chw=0; byte c; + //byte near *bakapee; switch(t) { @@ -1330,9 +1351,14 @@ void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, cons DEC CX JNZ L1 } - + //bakapee = _nmalloc(sizeof(byte)*8); +//TODO: OPTIMIZE THIS!!!! for(i=0; idata + (((page->width/4) * (y+page->dy+i)) + ((x+page->dx+chw) / 4)), bakapee, 8);*/ j=1<<8; xp=0; while(j) @@ -1344,6 +1370,7 @@ void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, cons } chw += xp; } + //_nfree(bakapee); } void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str)