X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16render.c;h=56abfb8fd6887f7f328cc4fd86ab532e423c040e;hb=d799ef823a8b57ba6c783ed323430254083158be;hp=091775b7ba1ce88a0bf82eb80e6805bd308943a3;hpb=f1cf981c40115d1c81698fe156905ef25fd80c3f;p=16.git diff --git a/src/lib/16render.c b/src/lib/16render.c index 091775b7..56abfb8f 100755 --- a/src/lib/16render.c +++ b/src/lib/16render.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover + * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover * * This file is part of Project 16. * @@ -33,8 +33,8 @@ void modexDrawPBufRegion (page_t *page, int x, int y, int rx, int ry, int rw, in { word plane; int i; - const int px=x+page->dx; - const int py=y+page->dy; + const int px=x+page[0].dx; + const int py=y+page[0].dy; const int prw = rw/4; int prh; @@ -72,8 +72,8 @@ modexDrawPBuf(page_t *page, int x, int y, planar_buf_t *p, boolean sprite) sword plane; int i; // byte near *buff; - const int px=x+page->dx; - const int py=y+page->dy; + const int px=x+page[0].dx; + const int py=y+page[0].dy; x=px; y=py; // buff = _nmalloc(p->pwidth+1); @@ -100,7 +100,7 @@ modexDrawPBuf(page_t *page, int x, int y, planar_buf_t *p, boolean sprite) //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[0].dy)) + ((x+page[0].dx) / 4)), buff, p->pwidth); _fmemcpy(page->data + (((page->width/4) * y) + (x / 4)), &(p->plane[plane][i+=p->pwidth]), p->pwidth); //} } @@ -142,7 +142,7 @@ modexDrawBmp(page_t *page, int x, int y, bitmap_t *bmp) { void modexDrawBmpRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp) { - word poffset = (word) page->data + y*(page->width/4) + x/4; + word poffset = (word)page->data + y*(page->width/4) + x/4; byte *data = bmp->data;//+bmp->offset; word bmpOffset = (word) data + ry * bmp->width + rx; word width = rw; @@ -151,7 +151,7 @@ modexDrawBmpRegion(page_t *page, int x, int y, word scanCount = width/4 + (width%4 ? 1 :0); word nextPageRow = page->width/4 - scanCount; word nextBmpRow = (word) bmp->width - width; - word rowCounter; + word rowCounter=0; byte planeCounter = 4; __asm { @@ -218,7 +218,7 @@ modexDrawSpriteRegion(page_t *page, int x, int y, word scanCount = width/4 + (width%4 ? 1 :0); word nextPageRow = page->width/4 - scanCount; word nextBmpRow = (word) bmp->width - width; - word rowCounter; + word rowCounter=0; byte planeCounter = 4; __asm { @@ -297,7 +297,7 @@ modexDrawBmpPBufRegion(page_t *page, int x, int y, word scanCount = width/4 + (width%4 ? 1 :0); word nextPageRow = page->width/4 - scanCount; word nextBmpRow = (word) bmp->width - width; - word rowCounter; + word rowCounter=0; byte planeCounter = 4; __asm { @@ -375,7 +375,7 @@ modexDrawSpritePBufRegion(page_t *page, int x, int y, word scanCount = width/4 + (width%4 ? 1 :0); word nextPageRow = page->width/4 - scanCount; word nextBmpRow = (word) bmp->width - width; - word rowCounter; + word rowCounter=0; byte planeCounter = 4; __asm { @@ -434,40 +434,3 @@ modexDrawSpritePBufRegion(page_t *page, int x, int y, JNZ PLANE_LOOP ; do all 4 planes } } - -void modexDrawChar(page_t *page, int x/*for planar selection only*/, word t, word col, word bgcol, word addr) -{ - /* vertical drawing routine by joncampbell123. - * - * optimize for VGA mode X planar memory to minimize the number of times we do I/O write to map mask register. - * so, we enumerate over columns (not rows!) to draw every 4th pixel. bit masks are used because of the font bitmap. - * - * NTS: addr defines what VGA memory address we use, "x" is redundant except to specify which of the 4 pixels we select in the map mask register. */ - word rows = romFonts[t].charSize; - word drawaddr; - word colm, row; - byte fontbyte; - byte plane; - byte m1,m2; - - plane = x & 3; - m1 = 0x80; // left half - m2 = 0x08; // right half - for (colm=0;colm < 4;colm++) { - drawaddr = addr; - modexSelectPlane(PLANE(plane)); - for (row=0;row < rows;row++) { - fontbyte = romFontsData.l[row]; - vga_state.vga_graphics_ram[drawaddr ] = (fontbyte & m1) ? col : bgcol; - vga_state.vga_graphics_ram[drawaddr+1] = (fontbyte & m2) ? col : bgcol; - drawaddr += page->width >> 2; - } - - m1 >>= 1; - m2 >>= 1; - if ((++plane) == 4) { - addr++; - plane = 0; - } - } -}