//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;
//#define DEBUG_JS\r
\r
typedef struct {\r
- bitmap_t *data;\r
+ bitmap_t huge *btdata;\r
+// planar_buf_t huge *data;\r
word tileHeight;\r
word tileWidth;\r
unsigned int rows;\r
}\r
}\r
\r
+//* normal versions *//\r
void\r
modexDrawBmp(page_t *page, int x, int y, bitmap_t *bmp) {\r
/* draw the region (the entire freakin bitmap) */\r
void\r
modexDrawBmpRegion(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 far *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
- //code is a bit slow here\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
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
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
+ 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
+}\r
+\r
+//* planar buffer versions *//\r
+void\r
+modexDrawBmpPBuf(page_t *page, int x, int y, planar_buf_t *bmp) {\r
+ /* draw the region (the entire freakin bitmap) */\r
+ modexDrawBmpPBufRegion(page, x, y, 0, 0, bmp->width, bmp->height, bmp);\r
+}\r
+\r
+void\r
+modexDrawBmpPBufRegion(page_t *page, int x, int y,\r
+ int rx, int ry, int rw, int rh, planar_buf_t *bmp) {\r
+ word poffset = (word) page->data + y*(page->width/4) + x/4;\r
+ byte huge *data = *bmp->plane;//+bmp->offset;\r
+ word bmpOffset = (word) data + ry * bmp->width + rx;\r
+ word width = rw/4;\r
+ word height = rh/4;\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
+ MOVSB ; copy the 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
+ 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
+}\r
+\r
+void\r
+modexDrawSpritePBuf(page_t *page, int x, int y, planar_buf_t *bmp) {\r
+ /* draw the whole sprite */\r
+ modexDrawSpritePBufRegion(page, x, y, 0, 0, bmp->width, bmp->height, bmp);\r
+}\r
+\r
+void\r
+modexDrawSpritePBufRegion(page_t *page, int x, int y,\r
+ int rx, int ry, int rw, int rh, planar_buf_t *bmp) {\r
+ word poffset = (word)page->data + y*(page->width/4) + x/4;\r
+ byte huge *data = *bmp->plane;//+bmp->offset;\r
+ word bmpOffset = (word) data + ry * bmp->width + rx;\r
+ word width = rw/4;\r
+ word height = rh/4;\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
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 */
--- /dev/null
+void\r
+modexDrawBmp(page_t *page, int x, int y, bitmap_t *bmp) {\r
+ /* draw the region (the entire freakin bitmap) */\r
+ modexDrawBmpRegion(page, x, y, 0, 0, bmp->width, bmp->height, bmp);\r
+}\r
+\r
+void\r
+modexDrawBmpRegion(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
+ MOVSB ; copy the 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
+ 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
+}\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
+}\r
--- /dev/null
+void\r
+modexDrawBmpPBuf(page_t *page, int x, int y, planar_buf_t *bmp) {\r
+ /* draw the region (the entire freakin bitmap) */\r
+ modexDrawBmpPBufRegion(page, x, y, 0, 0, bmp->width, bmp->height, bmp);\r
+}\r
+\r
+void\r
+modexDrawBmpPBufRegion(page_t *page, int x, int y,\r
+ int rx, int ry, int rw, int rh, planar_buf_t *bmp) {\r
+ word poffset = (word) page->data + y*(page->width/4) + x/4;\r
+ byte huge *data = *bmp->plane;//+bmp->offset;\r
+ word bmpOffset = (word) data + ry * bmp->width + rx;\r
+ word width = rw/4;\r
+ word height = rh/4;\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
+ MOVSB ; copy the 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
+ 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
+}\r
+\r
+void\r
+modexDrawSpritePBuf(page_t *page, int x, int y, planar_buf_t *bmp) {\r
+ /* draw the whole sprite */\r
+ modexDrawSpritePBufRegion(page, x, y, 0, 0, bmp->width, bmp->height, bmp);\r
+}\r
+\r
+void\r
+modexDrawSpritePBufRegion(page_t *page, int x, int y,\r
+ int rx, int ry, int rw, int rh, planar_buf_t *bmp) {\r
+ word poffset = (word)page->data + y*(page->width/4) + x/4;\r
+ byte huge *data = *bmp->plane;//+bmp->offset;\r
+ word bmpOffset = (word) data + ry * bmp->width + rx;\r
+ word width = rw/4;\r
+ word height = rh/4;\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
+}\r
{
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
{
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
{
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
{
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
}
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)
{
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:
}
#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);
#include "src/lib/timer.h"
#include "src/lib/wcpu/wcpu.h"
-#define SPRITE
-#define BMPTYPE
+//#define SPRITE
typedef struct {
map_t *map;
int i;\r
word start;\r
int plane;\r
- float t1, t2;\r
+ float t1, t2, tpee;\r
int x,y;\r
word px,py;\r
sword baka;\r
start = *clockw;\r
// oldDrawBmp(VGA, 20, 20, &bmp, 0);\r
for(i=0; i<100 ;i++) {\r
- modexDrawBmp(&gvar.video.page[0], 32, 32, &bmp);\r
+ modexDrawBmpPBuf(&gvar.video.page[0], 32, 32, p);\r
}\r
t1 = (*clockw-start) /18.2;\r
// start = *clockw;\r
modexDrawPBuf(&gvar.video.page[0], 0, 0, p, 0);\r
}\r
t2 = (*clockw-start) /18.2;\r
+ /*getch();\r
modexPalUpdate1(ptmpbt.palette);\r
- modexDrawPBufRegion(&gvar.video.page[0], 160, 140, 48, 32, 24, 32, ptmp, 1);\r
+ modexDrawBmpPBufRegion(&gvar.video.page[0], 64, 64, 48, 32, 24, 32, ptmp);*/\r
while(!kbhit())\r
{\r
}\r
fprintf(stderr,"%dx%d\n", gvar.video.page[0].sw-(p->width), gvar.video.page[0].sh-(p->height));\r
planar_buf_free(p);\r
free(bakapeee);\r
- fprintf(stderr, "modexDrawBmp: %f\n", t1);\r
- fprintf(stderr, "DrawPBuf: %f\n", t2);\r
+ fprintf(stderr, "modexDrawBmpPBuf: %f\n", t1);\r
+ fprintf(stderr, "modexDrawPBuf: %f\n", t2);\r
+ fprintf(stderr, "speed difference %f\n", t2/t1);\r
fprintf(stderr, "gvar.video.page[0].width: %u\n", gvar.video.page[0].width);\r
fprintf(stderr, "gvar.video.page[0].height: %u\n", gvar.video.page[0].height);\r
return;\r
/* 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
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);