}\r
\r
//TODO! ADD CLIPPING!!\r
+//memory management needs to be added\r
//void\r
//modexDrawBmpRegion (page_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp)\r
void modexDrawPBufRegion (page_t *page, int x, int y, int rx, int ry, int rw, int rh, planar_buf_t *p, boolean sprite)\r
// _nfree(buff);\r
}\r
\r
-/*void\r
+/*temp*/\r
+void\r
DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, boolean sprite)\r
{\r
int plane;\r
y=py;\r
}\r
// _nfree(buff);\r
-}*/\r
+}\r
\r
void\r
oldDrawBmp(byte far* page, int x, int y, bitmap_t *bmp, byte sprite)\r
}\r
}\r
\r
-void\r
-modexDrawPlanarBuf(page_t *page, int x, int y, planar_buf_t *bmp) {\r
- /* TODO - adapt from test code */\r
- int plane;\r
- for(plane=0; plane < 4; plane++)\r
- {\r
- //fack\r
- }\r
-}\r
-\r
-\r
void\r
modexDrawSprite(page_t *page, int x, int y, bitmap_t *bmp) {\r
/* draw the whole sprite */\r
modexDrawSpriteRegion(page, x, y, 0, 0, bmp->width, bmp->height, bmp);\r
}\r
\r
-/*void\r
-modexDrawSpriteRegion(page_t *page, int x, int y,\r
- int rx, int ry, int rw, int rh, bitmap_t *bmp) {\r
- word poffset = (word)page->data + y*(page->width/4) + x/4;\r
- byte *data = bmp->data;//+bmp->offset;\r
- word bmpOffset = (word) data + ry * bmp->width + rx;\r
- word width = rw;\r
- word height = rh;\r
- byte plane = 1 << ((byte) x & 0x03);\r
- word scanCount = width/4 + (width%4 ? 1 :0);\r
- word nextPageRow = page->width/4 - scanCount;\r
- word nextBmpRow = (word) bmp->width - width;\r
- word rowCounter;\r
- byte planeCounter = 4;\r
-\r
- __asm {\r
- MOV AX, SCREEN_SEG ; go to the VGA memory\r
- MOV ES, AX\r
-\r
- MOV DX, SC_INDEX ; point at the map mask register\r
- MOV AL, MAP_MASK ;\r
- OUT DX, AL ;\r
-\r
- PLANE_LOOP:\r
- MOV DX, SC_DATA ; select the current plane\r
- MOV AL, plane ;\r
- OUT DX, AL ;\r
-\r
- ;-- begin plane painting\r
- MOV AX, height ; start the row counter\r
- MOV rowCounter, AX ;\r
- MOV DI, poffset ; go to the first pixel\r
- MOV SI, bmpOffset ; go to the bmp pixel\r
- ROW_LOOP:\r
- MOV CX, width ; count the columns\r
- SCAN_LOOP:\r
- LODSB\r
- DEC SI\r
- CMP AL, 0\r
- JNE DRAW_PIXEL ; draw non-zero pixels\r
-\r
- INC DI ; skip the transparent pixel\r
- ADD SI, 1\r
- JMP NEXT_PIXEL\r
- DRAW_PIXEL:\r
- MOVSB ; copy the pixel\r
- NEXT_PIXEL:\r
- SUB CX, 3 ; we skip the next 3\r
- ADD SI, 3 ; skip the bmp pixels\r
- LOOP SCAN_LOOP ; finish the scan\r
-\r
- MOV AX, nextPageRow\r
- ADD DI, AX ; go to the next row on screen\r
- MOV AX, nextBmpRow\r
- ADD SI, AX ; go to the next row on bmp\r
-\r
- DEC rowCounter\r
- JNZ ROW_LOOP ; do all the rows\r
- ;-- end plane painting\r
-\r
- MOV AL, plane ; advance to the next plane\r
- SHL AL, 1 ;\r
- AND AL, 0x0f ; mask the plane properly\r
- MOV plane, AL ; store the plane\r
-\r
- INC bmpOffset ; start bmp at the right spot\r
-\r
- DEC planeCounter\r
- JNZ PLANE_LOOP ; do all 4 planes\r
- }\r
-}//backup!*/\r
-\r
void\r
modexDrawSpriteRegion(page_t *page, int x, int y,\r
int rx, int ry, int rw, int rh, bitmap_t *bmp) {\r
word poffset = (word)page->data + y*(page->width/4) + x/4;\r
- byte huge *data = bmp->data;//+bmp->offset;\r
+ byte *data = bmp->data;//+bmp->offset;\r
word bmpOffset = (word) data + ry * bmp->width + rx;\r
word width = rw;\r
word height = rh;\r
void modexSelectPlane(byte plane);
void modexClearRegion(page_t *page, int x, int y, int w, int h, byte color);
void modexDrawPBufRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, planar_buf_t *p, boolean sprite);
-void modexDrawPBuf(page_t *page, int x, int y, planar_buf_t *p, boolean sprite);
+void modexDrawPBuf(page_t *page, int x, int y, planar_buf_t *p, boolean sprite); /*temp*/
void oldDrawBmp(byte far* page, int x, int y, bitmap_t *bmp, byte sprite);
void 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);