]> 4ch.mooo.com Git - 16.git/commitdiff
ok planar buffer dump somewhat works
authorsparky4 <sparky4@cock.li>
Fri, 23 Oct 2015 21:21:04 +0000 (16:21 -0500)
committersparky4 <sparky4@cock.li>
Fri, 23 Oct 2015 21:21:04 +0000 (16:21 -0500)
16.exe
exmmtest.exe
planrpcx.exe
scroll.exe
src/lib/planar.h
src/planrpcx.c
test.exe

diff --git a/16.exe b/16.exe
index 637f3400567661d3a094ceb0e4ecbd2e58c14ee1..8709ad37df5d044069a6e1eab84c5d6a39fcd1b7 100755 (executable)
Binary files a/16.exe and b/16.exe differ
index 014545ab44e25338f4b2c3a266e8b8f59f874d8f..0cf4e7e6f7636c56dd456951ee7461d4f941bd6c 100755 (executable)
Binary files a/exmmtest.exe and b/exmmtest.exe differ
index 49ed2d231a9394e81fcad4ea7a6770ce700c6457..03ef92cb5512ee830639ee449293a5a3ad96ad82 100755 (executable)
Binary files a/planrpcx.exe and b/planrpcx.exe differ
index e9867d072dc07251712b266fce71552e1494fe0c..38953b73db3926eadf852dff551fa49a51ebb166 100755 (executable)
Binary files a/scroll.exe and b/scroll.exe differ
index 9e003d4c8e141d804e0f1f34eb118b6b328072e1..af8c5bf427e9a4bbbaea84c1719bfce9de755075 100755 (executable)
  * Functions and types for a planar image buffer.
  * This is meant to be able to load into video memory faster.
  */
-#include "src/lib/bitmap.h"
-
 #ifndef PLANAR_H
 #define PLANAR_H
+
+#include "src/lib/bitmap.h"
+#include "src/lib/16_ca.h"
+#include "src/lib/16_mm.h"
+#include "src/lib/16_hc.h"
+
 typedef struct {
-  byte huge *plane[4];     /* 4 planes of image data */
-  word width;         /* width of the image (spread across 4 planes) */
-  word height;        /* height of the image (spread across 4 planes) */
-  word pwidth;        /* the number of bytes in each plane */
+       byte huge *plane[4];     /* 4 planes of image data */
+       word width;         /* width of the image (spread across 4 planes) */
+       word height;        /* height of the image (spread across 4 planes) */
+       word pwidth;        /* the number of bytes in each plane */
 } planar_buf_t;
 
-
 /* creates a planar buffer from the bitmap data.
    The planar buffer is dynamically allocated, and should
    be destroyed with the planar_buf_free function when no longer
@@ -42,11 +45,9 @@ typedef struct {
  */
 planar_buf_t *planar_buf_from_bitmap(bitmap_t *b);
 
-
 /* allocates a planar buffer with specified dimensions */
 planar_buf_t *planar_buf_alloc(word width, word height);
 
-
 /* deallocates a planar buffer */
 void planar_buf_free(planar_buf_t *p);
 #endif
index dc36d28396bed39a419173e9fd960c070c131035..da238f9384713b3622d5d2adf691e79fd7d6dbf5 100755 (executable)
@@ -32,10 +32,8 @@ global_game_variables_t gvar;
 void\r
 DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, byte sprite)\r
 {\r
-       word plane;\r
+       int plane;\r
        int px, py, i;\r
-//     word offset = (word) page->data;\r
-\r
        px=x;\r
        py=y;\r
        // TODO Make this fast.  It's SLOOOOOOW\r
@@ -53,18 +51,13 @@ DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, byte sprite)
 //                     }\r
 //             }\r
 //     }\r
-//     z=0;\r
        for(plane=0; plane < 4; plane++) {\r
-               //modexputPixel(page, 120, 90+z, z+1);\r
-               //z++;\r
                i=0;\r
                modexSelectPlane(PLANE(plane+x));\r
-               //modexSelectPlane(plane);\r
                for(; y < p->height; y++) {\r
                        //for(px=0; px < p->width; px++) {\r
                                //printf("%02X ", (int) p->plane[plane][i++]);\r
-                               strncpy(page->data + (((page->width/4) * (y+page->dy)) + ((x+page->dx) / 4))\r
-,&(p->plane[plane][i+=p->pwidth]), p->pwidth);\r
+                               _fstrncpy(page->data + (((page->width/4) * (y+page->dy)) + ((x+page->dx) / 4)), &(p->plane[plane][i+=p->pwidth]), p->pwidth);\r
                        //}\r
                }\r
                //getch();\r
@@ -101,8 +94,6 @@ baka = 1;
        p = planar_buf_from_bitmap(&bmp);\r
        VGAmodeX(baka, &gvar);\r
        gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]);\r
-//     gvar.video.page[0].sw+=32;\r
-//     gvar.video.page[0].sh+=32;\r
 \r
        /* fix up the palette and everything */\r
        modexPalUpdate1(bmp.palette);\r
@@ -141,14 +132,13 @@ baka = 1;
                //if(argv[2]) pee = strcpy(VGA, &(p->plane[plane][24]));\r
        }//gvar.video.page[0].data\r
        VGAmodeX(0, &gvar);\r
-       planar_buf_free(p);\r
        /*printf("\nmain=%Fp\n\n", &i);\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
        /* print out the contents of each plane */\r
-       /*for(plane=0; plane < 4; plane++) {\r
+       for(plane=0; plane < 4; plane++) {\r
                i=0;\r
                printf("Plane %d\n", plane);\r
                for(py=0; py < p->height; py++) {\r
@@ -157,12 +147,13 @@ baka = 1;
                        }\r
                        printf("\n");\r
                }\r
-       }*/\r
+       }\r
        fprintf(stderr,"\n%d\n", sizeof(p->plane));\r
        fprintf(stderr,"pw=%d\n", p->width);\r
        fprintf(stderr,"ph=%d\n", p->height);\r
        fprintf(stderr,"ppw=%d\n", p->pwidth);\r
        fprintf(stderr,"%d\n", sizeof(bmp));\r
+       planar_buf_free(p);\r
 //     fprintf(stderr,"%s\n", *pee);\r
 //     fprintf(stderr, "CPU to VGA: %f\n", t1);\r
 //     fprintf(stderr, "VGA to VGA: %f\n", t2);\r
index 18c1d7705c711f691c5c811d591f652f4e4c49d0..b5ea2dcd76811eeee05677ce5e800f788b07347b 100755 (executable)
Binary files a/test.exe and b/test.exe differ