]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/modex16.c
wwwwwww ok going to try to fix~
[16.git] / src / lib / modex16.c
index f64fe1c18f12b450448181fe54fa39321e4ee378..798c9aee620d301092c95943d350f0570097abed 100755 (executable)
@@ -428,7 +428,6 @@ modexDrawBmp(page_t *page, int x, int y, bitmap_t *bmp) {
     modexDrawBmpRegion(page, x, y, 0, 0, bmp->width, bmp->height, bmp);\r
 }\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
@@ -497,10 +496,27 @@ modexDrawBmpRegion(page_t *page, int x, int y,
 }\r
 \r
 void\r
-modex_sparky4_DrawBmpRegion(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
+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
@@ -511,11 +527,6 @@ modex_sparky4_DrawBmpRegion(page_t *page, int x, int y,
     word rowCounter;\r
     byte planeCounter = 4;\r
 \r
-/*     printf("bmp->data=%Fp\n",bmp->data);\r
-       printf("*bmp->data=%Fp\n",*(bmp->data));\r
-       printf("&bmp->data=%Fp\n",&(bmp->data));*/\r
-\r
-        //code is a bit slow here\r
     __asm {\r
                 MOV AX, SCREEN_SEG      ; go to the VGA memory\r
                 MOV ES, AX\r
@@ -537,7 +548,17 @@ modex_sparky4_DrawBmpRegion(page_t *page, int x, int y,
         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
@@ -561,24 +582,7 @@ modex_sparky4_DrawBmpRegion(page_t *page, int x, int y,
                 DEC planeCounter\r
                 JNZ PLANE_LOOP          ; do all 4 planes\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
+}//backup!*/\r
 \r
 void\r
 modexDrawSpriteRegion(page_t *page, int x, int y,\r
@@ -612,7 +616,7 @@ modexDrawSpriteRegion(page_t *page, int x, int y,
                 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
+                MOV DI, bmpOffset       ; go to the bmp pixel\r
         ROW_LOOP:\r
                 MOV CX, width           ; count the columns\r
         SCAN_LOOP:\r
@@ -652,7 +656,6 @@ modexDrawSpriteRegion(page_t *page, int x, int y,
     }\r
 }\r
 \r
-\r
 /* copy a region of video memory from one page to another.\r
  * It assumes that the left edge of the tile is the same on both\r
  * regions and the memory areas do not overlap.\r