From: sparky4 Date: Thu, 29 Oct 2015 19:33:44 +0000 (-0500) Subject: I DID IT PLANAR BUFFERING IS RENDERED! IT JUST NEEDS POLISHING~ X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=9c094584b72c9c1ad4ae3b1cb641690297480661;p=16.git I DID IT PLANAR BUFFERING IS RENDERED! IT JUST NEEDS POLISHING~ --- diff --git a/16.exe b/16.exe index 0eac45e6..b2de2cf4 100755 Binary files a/16.exe and b/16.exe differ diff --git a/bakapi.exe b/bakapi.exe index 4bc4733b..191066e2 100755 Binary files a/bakapi.exe and b/bakapi.exe differ diff --git a/exmmtest.exe b/exmmtest.exe index 0645e31e..573d7487 100755 Binary files a/exmmtest.exe and b/exmmtest.exe differ diff --git a/fontgfx.exe b/fontgfx.exe index 13953f93..da3d1446 100755 Binary files a/fontgfx.exe and b/fontgfx.exe differ diff --git a/maptest.exe b/maptest.exe index 0ebfa9fa..9e8a2c64 100755 Binary files a/maptest.exe and b/maptest.exe differ diff --git a/palettec.exe b/palettec.exe index 38431222..00180097 100755 Binary files a/palettec.exe and b/palettec.exe differ diff --git a/palettel.exe b/palettel.exe index de042c2f..7ef37e50 100755 Binary files a/palettel.exe and b/palettel.exe differ diff --git a/pcxtest.exe b/pcxtest.exe index a5070a2f..4ff8f919 100755 Binary files a/pcxtest.exe and b/pcxtest.exe differ diff --git a/pcxtest2.exe b/pcxtest2.exe index 0e215b4c..454e4515 100755 Binary files a/pcxtest2.exe and b/pcxtest2.exe differ diff --git a/planrpcx.exe b/planrpcx.exe index 390b3783..429816d9 100755 Binary files a/planrpcx.exe and b/planrpcx.exe differ diff --git a/scroll.exe b/scroll.exe index c93f9c18..c495ac89 100755 Binary files a/scroll.exe and b/scroll.exe differ diff --git a/src/lib/mapread.c b/src/lib/mapread.c index 7fc94d18..205bf39a 100755 --- a/src/lib/mapread.c +++ b/src/lib/mapread.c @@ -74,7 +74,7 @@ word dump(const char *js, jsmntok_t *t, size_t count, word indent, char *js_sv, //map->tiles->data = malloc(sizeof(bitmap_t)); //fix this to be far~ bp = bitmapLoadPcx("data/ed.pcx"); - map->tiles->data = &bp; + map->tiles->btdata = &bp; //map->tiles->data->data = malloc((16/**2*/)*16); //map->tiles->data->width = (16/**2*/); //map->tiles->data->height= 16; diff --git a/src/lib/mapread.h b/src/lib/mapread.h index 7b22348b..b8062211 100755 --- a/src/lib/mapread.h +++ b/src/lib/mapread.h @@ -16,7 +16,8 @@ //#define DEBUG_JS typedef struct { - bitmap_t *data; + bitmap_t huge *btdata; +// planar_buf_t huge *data; word tileHeight; word tileWidth; unsigned int rows; diff --git a/src/lib/modex16.c b/src/lib/modex16.c index 19ab89c7..8a0015bd 100755 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -499,6 +499,7 @@ oldDrawBmp(byte far* page, int x, int y, bitmap_t *bmp, byte sprite) } } +//* normal versions *// void modexDrawBmp(page_t *page, int x, int y, bitmap_t *bmp) { /* draw the region (the entire freakin bitmap) */ @@ -508,19 +509,18 @@ 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; - byte far *data = bmp->data;//+bmp->offset; - word bmpOffset = (word) data + ry * bmp->width + rx; - word width = rw; - word height = rh; - byte plane = 1 << ((byte) x & 0x03); - word scanCount = width/4 + (width%4 ? 1 :0); - word nextPageRow = page->width/4 - scanCount; - word nextBmpRow = (word) bmp->width - width; - word rowCounter; - byte planeCounter = 4; - - //code is a bit slow here + 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; + word height = rh; + byte plane = 1 << ((byte) x & 0x03); + word scanCount = width/4 + (width%4 ? 1 :0); + word nextPageRow = page->width/4 - scanCount; + word nextBmpRow = (word) bmp->width - width; + word rowCounter; + byte planeCounter = 4; + __asm { MOV AX, SCREEN_SEG ; go to the VGA memory MOV ES, AX @@ -555,7 +555,6 @@ modexDrawBmpRegion(page_t *page, int x, int y, DEC rowCounter JNZ ROW_LOOP ; do all the rows ;-- end plane painting - MOV AL, plane ; advance to the next plane SHL AL, 1 ; AND AL, 0x0f ; mask the plane properly @@ -577,17 +576,163 @@ modexDrawSprite(page_t *page, int x, int y, bitmap_t *bmp) { void modexDrawSpriteRegion(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; - byte *data = bmp->data;//+bmp->offset; - word bmpOffset = (word) data + ry * bmp->width + rx; - word width = rw; - word height = rh; - byte plane = 1 << ((byte) x & 0x03); - word scanCount = width/4 + (width%4 ? 1 :0); - word nextPageRow = page->width/4 - scanCount; - word nextBmpRow = (word) bmp->width - width; - word rowCounter; - byte planeCounter = 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; + word height = rh; + byte plane = 1 << ((byte) x & 0x03); + word scanCount = width/4 + (width%4 ? 1 :0); + word nextPageRow = page->width/4 - scanCount; + word nextBmpRow = (word) bmp->width - width; + word rowCounter; + byte planeCounter = 4; + + __asm { + MOV AX, SCREEN_SEG ; go to the VGA memory + MOV ES, AX + + MOV DX, SC_INDEX ; point at the map mask register + MOV AL, MAP_MASK ; + OUT DX, AL ; + + PLANE_LOOP: + MOV DX, SC_DATA ; select the current plane + MOV AL, plane ; + OUT DX, AL ; + + ;-- begin plane painting + MOV AX, height ; start the row counter + MOV rowCounter, AX ; + MOV DI, poffset ; go to the first pixel + MOV SI, bmpOffset ; go to the bmp pixel + ROW_LOOP: + MOV CX, width ; count the columns + SCAN_LOOP: + LODSB + DEC SI + CMP AL, 0 + JNE DRAW_PIXEL ; draw non-zero pixels + + INC DI ; skip the transparent pixel + ADD SI, 1 + JMP NEXT_PIXEL + DRAW_PIXEL: + MOVSB ; copy the pixel + NEXT_PIXEL: + SUB CX, 3 ; we skip the next 3 + ADD SI, 3 ; skip the bmp pixels + LOOP SCAN_LOOP ; finish the scan + + MOV AX, nextPageRow + ADD DI, AX ; go to the next row on screen + MOV AX, nextBmpRow + ADD SI, AX ; go to the next row on bmp + + DEC rowCounter + JNZ ROW_LOOP ; do all the rows + ;-- end plane painting + + MOV AL, plane ; advance to the next plane + SHL AL, 1 ; + AND AL, 0x0f ; mask the plane properly + MOV plane, AL ; store the plane + + INC bmpOffset ; start bmp at the right spot + + DEC planeCounter + JNZ PLANE_LOOP ; do all 4 planes + } +} + +//* planar buffer versions *// +void +modexDrawBmpPBuf(page_t *page, int x, int y, planar_buf_t *bmp) { + /* draw the region (the entire freakin bitmap) */ + modexDrawBmpPBufRegion(page, x, y, 0, 0, bmp->width, bmp->height, bmp); +} + +void +modexDrawBmpPBufRegion(page_t *page, int x, int y, + int rx, int ry, int rw, int rh, planar_buf_t *bmp) { + word poffset = (word) page->data + y*(page->width/4) + x/4; + byte huge *data = *bmp->plane;//+bmp->offset; + word bmpOffset = (word) data + ry * bmp->width + rx; + word width = rw/4; + word height = rh/4; + byte plane = 1 << ((byte) x & 0x03); + word scanCount = width/4 + (width%4 ? 1 :0); + word nextPageRow = page->width/4 - scanCount; + word nextBmpRow = (word) bmp->width - width; + word rowCounter; + byte planeCounter = 4; + + __asm { + MOV AX, SCREEN_SEG ; go to the VGA memory + MOV ES, AX + + MOV DX, SC_INDEX ; point at the map mask register + MOV AL, MAP_MASK ; + OUT DX, AL ; + + PLANE_LOOP: + MOV DX, SC_DATA ; select the current plane + MOV AL, plane ; + OUT DX, AL ; + + ;-- begin plane painting + MOV AX, height ; start the row counter + MOV rowCounter, AX ; + MOV DI, poffset ; go to the first pixel + MOV SI, bmpOffset ; go to the bmp pixel + ROW_LOOP: + MOV CX, width ; count the columns + SCAN_LOOP: + MOVSB ; copy the pixel + SUB CX, 3 ; we skip the next 3 + ADD SI, 3 ; skip the bmp pixels + LOOP SCAN_LOOP ; finish the scan + + MOV AX, nextPageRow + ADD DI, AX ; go to the next row on screen + MOV AX, nextBmpRow + ADD SI, AX ; go to the next row on bmp + + DEC rowCounter + JNZ ROW_LOOP ; do all the rows + ;-- end plane painting + MOV AL, plane ; advance to the next plane + SHL AL, 1 ; + AND AL, 0x0f ; mask the plane properly + MOV plane, AL ; store the plane + + INC bmpOffset ; start bmp at the right spot + + DEC planeCounter + JNZ PLANE_LOOP ; do all 4 planes + } +} + +void +modexDrawSpritePBuf(page_t *page, int x, int y, planar_buf_t *bmp) { + /* draw the whole sprite */ + modexDrawSpritePBufRegion(page, x, y, 0, 0, bmp->width, bmp->height, bmp); +} + +void +modexDrawSpritePBufRegion(page_t *page, int x, int y, + int rx, int ry, int rw, int rh, planar_buf_t *bmp) { + word poffset = (word)page->data + y*(page->width/4) + x/4; + byte huge *data = *bmp->plane;//+bmp->offset; + word bmpOffset = (word) data + ry * bmp->width + rx; + word width = rw/4; + word height = rh/4; + byte plane = 1 << ((byte) x & 0x03); + word scanCount = width/4 + (width%4 ? 1 :0); + word nextPageRow = page->width/4 - scanCount; + word nextBmpRow = (word) bmp->width - width; + word rowCounter; + byte planeCounter = 4; __asm { MOV AX, SCREEN_SEG ; go to the VGA memory diff --git a/src/lib/modex16.h b/src/lib/modex16.h index 9c9ea4bb..7eb60540 100755 --- a/src/lib/modex16.h +++ b/src/lib/modex16.h @@ -77,6 +77,10 @@ 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); void modexDrawSprite(page_t *page, int x, int y, bitmap_t *bmp); void modexDrawSpriteRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp); +void modexDrawBmpPBuf(page_t *page, int x, int y, planar_buf_t *bmp); /*pbuf version*/ +void modexDrawBmpPBufRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, planar_buf_t *bmp); +void modexDrawSpritePBuf(page_t *page, int x, int y, planar_buf_t *bmp); +void modexDrawSpritePBufRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, planar_buf_t *bmp); void modexCopyPageRegion(page_t *dest, page_t *src, word sx, word sy, word dx, word dy, word width, word height); /* Palette fade and flash effects */ diff --git a/src/lib/modex16/rn.c b/src/lib/modex16/rn.c new file mode 100755 index 00000000..61bc1a58 --- /dev/null +++ b/src/lib/modex16/rn.c @@ -0,0 +1,144 @@ +void +modexDrawBmp(page_t *page, int x, int y, bitmap_t *bmp) { + /* draw the region (the entire freakin bitmap) */ + modexDrawBmpRegion(page, x, y, 0, 0, bmp->width, bmp->height, 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; + byte *data = bmp->data;//+bmp->offset; + word bmpOffset = (word) data + ry * bmp->width + rx; + word width = rw; + word height = rh; + byte plane = 1 << ((byte) x & 0x03); + word scanCount = width/4 + (width%4 ? 1 :0); + word nextPageRow = page->width/4 - scanCount; + word nextBmpRow = (word) bmp->width - width; + word rowCounter; + byte planeCounter = 4; + + __asm { + MOV AX, SCREEN_SEG ; go to the VGA memory + MOV ES, AX + + MOV DX, SC_INDEX ; point at the map mask register + MOV AL, MAP_MASK ; + OUT DX, AL ; + + PLANE_LOOP: + MOV DX, SC_DATA ; select the current plane + MOV AL, plane ; + OUT DX, AL ; + + ;-- begin plane painting + MOV AX, height ; start the row counter + MOV rowCounter, AX ; + MOV DI, poffset ; go to the first pixel + MOV SI, bmpOffset ; go to the bmp pixel + ROW_LOOP: + MOV CX, width ; count the columns + SCAN_LOOP: + MOVSB ; copy the pixel + SUB CX, 3 ; we skip the next 3 + ADD SI, 3 ; skip the bmp pixels + LOOP SCAN_LOOP ; finish the scan + + MOV AX, nextPageRow + ADD DI, AX ; go to the next row on screen + MOV AX, nextBmpRow + ADD SI, AX ; go to the next row on bmp + + DEC rowCounter + JNZ ROW_LOOP ; do all the rows + ;-- end plane painting + MOV AL, plane ; advance to the next plane + SHL AL, 1 ; + AND AL, 0x0f ; mask the plane properly + MOV plane, AL ; store the plane + + INC bmpOffset ; start bmp at the right spot + + DEC planeCounter + JNZ PLANE_LOOP ; do all 4 planes + } +} + +void +modexDrawSprite(page_t *page, int x, int y, bitmap_t *bmp) { + /* draw the whole sprite */ + modexDrawSpriteRegion(page, x, y, 0, 0, bmp->width, bmp->height, bmp); +} + +void +modexDrawSpriteRegion(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; + byte *data = bmp->data;//+bmp->offset; + word bmpOffset = (word) data + ry * bmp->width + rx; + word width = rw; + word height = rh; + byte plane = 1 << ((byte) x & 0x03); + word scanCount = width/4 + (width%4 ? 1 :0); + word nextPageRow = page->width/4 - scanCount; + word nextBmpRow = (word) bmp->width - width; + word rowCounter; + byte planeCounter = 4; + + __asm { + MOV AX, SCREEN_SEG ; go to the VGA memory + MOV ES, AX + + MOV DX, SC_INDEX ; point at the map mask register + MOV AL, MAP_MASK ; + OUT DX, AL ; + + PLANE_LOOP: + MOV DX, SC_DATA ; select the current plane + MOV AL, plane ; + OUT DX, AL ; + + ;-- begin plane painting + MOV AX, height ; start the row counter + MOV rowCounter, AX ; + MOV DI, poffset ; go to the first pixel + MOV SI, bmpOffset ; go to the bmp pixel + ROW_LOOP: + MOV CX, width ; count the columns + SCAN_LOOP: + LODSB + DEC SI + CMP AL, 0 + JNE DRAW_PIXEL ; draw non-zero pixels + + INC DI ; skip the transparent pixel + ADD SI, 1 + JMP NEXT_PIXEL + DRAW_PIXEL: + MOVSB ; copy the pixel + NEXT_PIXEL: + SUB CX, 3 ; we skip the next 3 + ADD SI, 3 ; skip the bmp pixels + LOOP SCAN_LOOP ; finish the scan + + MOV AX, nextPageRow + ADD DI, AX ; go to the next row on screen + MOV AX, nextBmpRow + ADD SI, AX ; go to the next row on bmp + + DEC rowCounter + JNZ ROW_LOOP ; do all the rows + ;-- end plane painting + + MOV AL, plane ; advance to the next plane + SHL AL, 1 ; + AND AL, 0x0f ; mask the plane properly + MOV plane, AL ; store the plane + + INC bmpOffset ; start bmp at the right spot + + DEC planeCounter + JNZ PLANE_LOOP ; do all 4 planes + } +} diff --git a/src/lib/modex16/rp.c b/src/lib/modex16/rp.c new file mode 100755 index 00000000..f99cb765 --- /dev/null +++ b/src/lib/modex16/rp.c @@ -0,0 +1,144 @@ +void +modexDrawBmpPBuf(page_t *page, int x, int y, planar_buf_t *bmp) { + /* draw the region (the entire freakin bitmap) */ + modexDrawBmpPBufRegion(page, x, y, 0, 0, bmp->width, bmp->height, bmp); +} + +void +modexDrawBmpPBufRegion(page_t *page, int x, int y, + int rx, int ry, int rw, int rh, planar_buf_t *bmp) { + word poffset = (word) page->data + y*(page->width/4) + x/4; + byte huge *data = *bmp->plane;//+bmp->offset; + word bmpOffset = (word) data + ry * bmp->width + rx; + word width = rw/4; + word height = rh/4; + byte plane = 1 << ((byte) x & 0x03); + word scanCount = width/4 + (width%4 ? 1 :0); + word nextPageRow = page->width/4 - scanCount; + word nextBmpRow = (word) bmp->width - width; + word rowCounter; + byte planeCounter = 4; + + __asm { + MOV AX, SCREEN_SEG ; go to the VGA memory + MOV ES, AX + + MOV DX, SC_INDEX ; point at the map mask register + MOV AL, MAP_MASK ; + OUT DX, AL ; + + PLANE_LOOP: + MOV DX, SC_DATA ; select the current plane + MOV AL, plane ; + OUT DX, AL ; + + ;-- begin plane painting + MOV AX, height ; start the row counter + MOV rowCounter, AX ; + MOV DI, poffset ; go to the first pixel + MOV SI, bmpOffset ; go to the bmp pixel + ROW_LOOP: + MOV CX, width ; count the columns + SCAN_LOOP: + MOVSB ; copy the pixel + SUB CX, 3 ; we skip the next 3 + ADD SI, 3 ; skip the bmp pixels + LOOP SCAN_LOOP ; finish the scan + + MOV AX, nextPageRow + ADD DI, AX ; go to the next row on screen + MOV AX, nextBmpRow + ADD SI, AX ; go to the next row on bmp + + DEC rowCounter + JNZ ROW_LOOP ; do all the rows + ;-- end plane painting + MOV AL, plane ; advance to the next plane + SHL AL, 1 ; + AND AL, 0x0f ; mask the plane properly + MOV plane, AL ; store the plane + + INC bmpOffset ; start bmp at the right spot + + DEC planeCounter + JNZ PLANE_LOOP ; do all 4 planes + } +} + +void +modexDrawSpritePBuf(page_t *page, int x, int y, planar_buf_t *bmp) { + /* draw the whole sprite */ + modexDrawSpritePBufRegion(page, x, y, 0, 0, bmp->width, bmp->height, bmp); +} + +void +modexDrawSpritePBufRegion(page_t *page, int x, int y, + int rx, int ry, int rw, int rh, planar_buf_t *bmp) { + word poffset = (word)page->data + y*(page->width/4) + x/4; + byte huge *data = *bmp->plane;//+bmp->offset; + word bmpOffset = (word) data + ry * bmp->width + rx; + word width = rw/4; + word height = rh/4; + byte plane = 1 << ((byte) x & 0x03); + word scanCount = width/4 + (width%4 ? 1 :0); + word nextPageRow = page->width/4 - scanCount; + word nextBmpRow = (word) bmp->width - width; + word rowCounter; + byte planeCounter = 4; + + __asm { + MOV AX, SCREEN_SEG ; go to the VGA memory + MOV ES, AX + + MOV DX, SC_INDEX ; point at the map mask register + MOV AL, MAP_MASK ; + OUT DX, AL ; + + PLANE_LOOP: + MOV DX, SC_DATA ; select the current plane + MOV AL, plane ; + OUT DX, AL ; + + ;-- begin plane painting + MOV AX, height ; start the row counter + MOV rowCounter, AX ; + MOV DI, poffset ; go to the first pixel + MOV SI, bmpOffset ; go to the bmp pixel + ROW_LOOP: + MOV CX, width ; count the columns + SCAN_LOOP: + LODSB + DEC SI + CMP AL, 0 + JNE DRAW_PIXEL ; draw non-zero pixels + + INC DI ; skip the transparent pixel + ADD SI, 1 + JMP NEXT_PIXEL + DRAW_PIXEL: + MOVSB ; copy the pixel + NEXT_PIXEL: + SUB CX, 3 ; we skip the next 3 + ADD SI, 3 ; skip the bmp pixels + LOOP SCAN_LOOP ; finish the scan + + MOV AX, nextPageRow + ADD DI, AX ; go to the next row on screen + MOV AX, nextBmpRow + ADD SI, AX ; go to the next row on bmp + + DEC rowCounter + JNZ ROW_LOOP ; do all the rows + ;-- end plane painting + + MOV AL, plane ; advance to the next plane + SHL AL, 1 ; + AND AL, 0x0f ; mask the plane properly + MOV plane, AL ; store the plane + + INC bmpOffset ; start bmp at the right spot + + DEC planeCounter + JNZ PLANE_LOOP ; do all 4 planes + } +} diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index ccc347a5..39b9394d 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -60,11 +60,7 @@ void walk(map_view_t *pip, player_t *player, word pn) { modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x-4, player[pn].y-TILEWH, player[pn].x-4, player[pn].y-TILEWH, 24, 32); #ifdef SPRITE -#ifdef BMPTYPE - modexDrawPBufRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 24, 32, &player[pn].data, 1); -#else - modexDrawSpriteRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 24, 32, &player[pn].data); -#endif + modexDrawSpritePBufRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 24, 32, &player[pn].data); #else modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 14); #endif @@ -105,11 +101,7 @@ void walk(map_view_t *pip, player_t *player, word pn) { modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x-4, player[pn].y-TILEWH, player[pn].x-4, player[pn].y-TILEWH, 24, 32); #ifdef SPRITE -#ifdef BMPTYPE - modexDrawPBufRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 96, 24, 32, &player[pn].data, 1); -#else - modexDrawSpriteRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 96, 24, 32, &player[pn].data); -#endif + modexDrawSpritePBufRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 96, 24, 32, &player[pn].data); #else modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 10); #endif @@ -150,11 +142,7 @@ void walk(map_view_t *pip, player_t *player, word pn) { modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x-4, player[pn].y-TILEWH, player[pn].x-4, player[pn].y-TILEWH, 24, 32); #ifdef SPRITE -#ifdef BMPTYPE - modexDrawPBufRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 64, 24, 32, &player[pn].data, 1); -#else - modexDrawSpriteRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 64, 24, 32, &player[pn].data); -#endif + modexDrawSpritePBufRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 64, 24, 32, &player[pn].data); #else modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 9); #endif @@ -195,11 +183,7 @@ void walk(map_view_t *pip, player_t *player, word pn) { modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x-4, player[pn].y-TILEWH, player[pn].x-4, player[pn].y-TILEWH, 24, 32); #ifdef SPRITE -#ifdef BMPTYPE - modexDrawPBufRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 0, 24, 32, &player[pn].data, 1); -#else - modexDrawSpriteRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 0, 24, 32, &player[pn].data); -#endif + modexDrawSpritePBufRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 0, 24, 32, &player[pn].data); #else modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 12); #endif @@ -494,8 +478,8 @@ mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) } else { - rx = (((i-1) % ((t->data->width)/t->tileWidth)) * t->tileWidth); - ry = (((i-1) / ((t->data->height)/t->tileHeight)) * t->tileHeight); + rx = (((i-1) % ((t->btdata->width)/t->tileWidth)) * t->tileWidth); + ry = (((i-1) / ((t->btdata->height)/t->tileHeight)) * t->tileHeight); ////0000printf("i=%d\n", i); switch(t->debug_text) { @@ -504,12 +488,8 @@ mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, ((t->debug_data[i])+1)*2); //cannot print number value du to it being slow as bakapee #else -#ifdef BMPTYPE - modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, ((t->debug_data[i])+1)*2); - //modexDrawPBufRegion(page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data), 0); -#else - modexDrawBmpRegion(page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data)); -#endif + //0000modexDrawBmpPBufRegion(page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data)); + modexDrawBmpRegion(page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->btdata)); #endif break; case 1: @@ -681,17 +661,10 @@ void near animatePlayer(map_view_t *pip, player_t *player, word playnum, sword s } #ifdef SPRITE -#ifdef BMPTYPE -#define FRAME1 modexDrawPBufRegion(pip[1].page, x, y, 48, dire, 24, 32, &player[playnum].data, 1); -#define FRAME2 modexDrawPBufRegion(pip[1].page, x, y, 24, dire, 24, 32, &player[playnum].data, 1); -#define FRAME3 modexDrawPBufRegion(pip[1].page, x, y, 0, dire, 24, 32, &player[playnum].data, 1); -#define FRAME4 modexDrawPBufRegion(pip[1].page, x, y, 24, dire, 24, 32, &player[playnum].data, 1); -#else -#define FRAME1 modexDrawSpriteRegion(pip[1].page, x, y, 48, dire, 24, 32, &player[playnum].data); -#define FRAME2 modexDrawSpriteRegion(pip[1].page, x, y, 24, dire, 24, 32, &player[playnum].data); -#define FRAME3 modexDrawSpriteRegion(pip[1].page, x, y, 0, dire, 24, 32, &player[playnum].data); -#define FRAME4 modexDrawSpriteRegion(pip[1].page, x, y, 24, dire, 24, 32, &player[playnum].data); -#endif +#define FRAME1 modexDrawSpritePBufRegion(pip[1].page, x, y, 48, dire, 24, 32, &player[playnum].data); +#define FRAME2 modexDrawSpritePBufRegion(pip[1].page, x, y, 24, dire, 24, 32, &player[playnum].data); +#define FRAME3 modexDrawSpritePBufRegion(pip[1].page, x, y, 0, dire, 24, 32, &player[playnum].data); +#define FRAME4 modexDrawSpritePBufRegion(pip[1].page, x, y, 24, dire, 24, 32, &player[playnum].data); #else #define FRAME1 modexClearRegion(pip[1].page, x, y, 24, 32, 2+dire); #define FRAME2 modexClearRegion(pip[1].page, x, y, 24, 32, 1+dire); diff --git a/src/lib/scroll16.h b/src/lib/scroll16.h index b74570f0..300a0514 100755 --- a/src/lib/scroll16.h +++ b/src/lib/scroll16.h @@ -33,8 +33,7 @@ #include "src/lib/timer.h" #include "src/lib/wcpu/wcpu.h" -#define SPRITE -#define BMPTYPE +//#define SPRITE typedef struct { map_t *map; diff --git a/src/planrpcx.c b/src/planrpcx.c index 95940152..9de942b3 100755 --- a/src/planrpcx.c +++ b/src/planrpcx.c @@ -36,7 +36,7 @@ void main(int argc, char *argv[]) int i; word start; int plane; - float t1, t2; + float t1, t2, tpee; int x,y; word px,py; sword baka; @@ -77,7 +77,7 @@ baka = 1; start = *clockw; // oldDrawBmp(VGA, 20, 20, &bmp, 0); for(i=0; i<100 ;i++) { - modexDrawBmp(&gvar.video.page[0], 32, 32, &bmp); + modexDrawBmpPBuf(&gvar.video.page[0], 32, 32, p); } t1 = (*clockw-start) /18.2; // start = *clockw; @@ -88,8 +88,9 @@ baka = 1; modexDrawPBuf(&gvar.video.page[0], 0, 0, p, 0); } t2 = (*clockw-start) /18.2; + /*getch(); modexPalUpdate1(ptmpbt.palette); - modexDrawPBufRegion(&gvar.video.page[0], 160, 140, 48, 32, 24, 32, ptmp, 1); + modexDrawBmpPBufRegion(&gvar.video.page[0], 64, 64, 48, 32, 24, 32, ptmp);*/ while(!kbhit()) { } @@ -141,8 +142,9 @@ baka = 1; fprintf(stderr,"%dx%d\n", gvar.video.page[0].sw-(p->width), gvar.video.page[0].sh-(p->height)); planar_buf_free(p); free(bakapeee); - fprintf(stderr, "modexDrawBmp: %f\n", t1); - fprintf(stderr, "DrawPBuf: %f\n", t2); + fprintf(stderr, "modexDrawBmpPBuf: %f\n", t1); + fprintf(stderr, "modexDrawPBuf: %f\n", t2); + fprintf(stderr, "speed difference %f\n", t2/t1); fprintf(stderr, "gvar.video.page[0].width: %u\n", gvar.video.page[0].width); fprintf(stderr, "gvar.video.page[0].height: %u\n", gvar.video.page[0].height); return; diff --git a/src/scroll.c b/src/scroll.c index c5280652..96f0660c 100755 --- a/src/scroll.c +++ b/src/scroll.c @@ -87,7 +87,7 @@ void main(int argc, char *argv[]) /* draw the tiles */ #ifdef MODEX ptr = map.data; - mappalptr = map.tiles->data->palette; + //mappalptr = map.tiles->bt_data->palette; /* data */ p = bitmapLoadPcx("data/ptmp.pcx"); // load sprite @@ -186,14 +186,10 @@ void main(int argc, char *argv[]) npc0.d=0; modexDrawSpriteRegion(spri->page, npc0.x-4, npc0.y-TILEWH, 24, 64, 24, 32, &npctmp);*/ modexCopyPageRegion(mv[1].page, mv[0].page, 0, 0, 0, 0, mv[0].page->width, mv[0].page->height); -#ifdef SPRITE -#ifdef BMPTYPE - //oldDrawBmp(VGA, player[0].x-4, player[0].y-TILEWH, &player[0].data, 1); -#else - modexDrawSpriteRegion(spri->page, player[0].x-4, player[0].y-TILEWH, 24, 64, 24, 32, &player[0].data); -#endif -#else +#ifndef SPRITE modexClearRegion(mv[1].page, player[0].x-4, player[0].y-TILEWH, 24, 32, 15); +#else + modexDrawSpritePBufRegion(spri->page, player[0].x-4, player[0].y-TILEWH, 24, 64, 24, 32, &player[0].data); #endif modexShowPage(spri->page); diff --git a/test.exe b/test.exe index 0ad7e77c..f9b03820 100755 Binary files a/test.exe and b/test.exe differ diff --git a/test2.exe b/test2.exe index 3b0ebe5d..50abe51a 100755 Binary files a/test2.exe and b/test2.exe differ