X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Fplanrpcx.c;h=ce44cb4d53d01e032fa82efa254c15399fcc3a67;hb=465a28bde642141b8221a5217373e5f7c844e6c6;hp=086a5a52d9b8d28c29407d064e08b43f121455d9;hpb=a13436720996dce24b0b4a00b281e96f308962c5;p=16.git diff --git a/src/planrpcx.c b/src/planrpcx.c index 086a5a52..ce44cb4d 100755 --- a/src/planrpcx.c +++ b/src/planrpcx.c @@ -24,24 +24,29 @@ #include #include #include "src/lib/modex16.h" -#include "src/lib/bitmap.h" -#include "src/lib/planar.h" global_game_variables_t gvar; -bitmap_t bmp; -planar_buf_t *p; +planar_buf_t p, ptmp; +int i; +word start;//, w; +int plane; +float t1, t2, t3, t4, tpee; +int x,y; +word px,py; +sword baka; +char *bakapeee; + void main(int argc, char *argv[]) { - int i; - word start; - int plane; - float t1, t2; - int x,y; - word px,py; - sword baka; - char *bakapeee; + byte l[1024]; + static byte e; + static word chx, chy, colpee; + byte pee[2]; + +//w=0; +//printf("%u ", w++); bakapeee = malloc(64); if(argv[1]) bakapeee = argv[1]; @@ -50,71 +55,106 @@ void main(int argc, char *argv[]) // if(argv[2]) baka = atoi(argv[2]); // else baka = 1; +//fprintf(stderr, "%u ", w++); + p = planarLoadPcx(bakapeee); +//fprintf(stderr, "%u ", w++); +// ptmp = planarLoadPcx("data/ptmp.pcx"); +//fprintf(stderr, "%u ", w++); +//fprintf(stderr, "^^;", w++); +//getch(); - bmp = bitmapLoadPcx(bakapeee); - p = planar_buf_from_bitmap(&bmp); + textInit(); VGAmodeX(baka, &gvar); gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]); - /* fix up the palette and everything */ - modexPalUpdate1(bmp.palette); + //fix up the palette and everything + modexPalUpdate1(p.palette); - /* clear and draw one sprite and one bitmap */ + //clear and draw one sprite and one bitmap modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].sw, gvar.video.page[0].sh, 0); - /* update display~*/ + //update display~ gvar.video.page[0].dx+=32; gvar.video.page[0].dy+=32; modexShowPage(&gvar.video.page[0]); - /* non sprite comparison */ + //non sprite comparison 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; + for(i=0; i<100 ;i++) { + modexDrawBmpPBufRegion (&gvar.video.page[0], p.width+32, 32, p.width-(p.width/4), p.height-(p.height/4), p.width/4, p.height/4, &p); + } + t2 = (*clockw-start) /18.2; + getch(); // start = *clockw; // modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 0, 0, 0, 0, 320, 240); // t2 = (*clockw-start)/18.2; start = *clockw; for(i=0; i<100 ;i++) { - DrawPBuf(&gvar.video.page[0], 0, 0, p, 0); + modexDrawPBuf (&gvar.video.page[0], 0, 0, &p, 0); } - t2 = (*clockw-start) /18.2; + t3 = (*clockw-start) /18.2; +getch(); + for(i=0; i<100 ;i++) { + //(page_t *page, int x, int y, int rx, int ry, int rw, int rh, planar_buf_t *p, boolean sprite); + modexDrawPBufRegion (&gvar.video.page[0], p.width, 0, p.width-(p.width/4), p.height-(p.height/4), p.width/4, p.height/4, &p, 0);//(&gvar.video.page[0], 0, 0, 0+p.width, 0, p.width, p.height, &p, 0); + } + t4 = (*clockw-start) /18.2; + //++++ modexPalUpdate1(ptmp.palette); + //modexDrawBmpPBufRegion(&gvar.video.page[0], 64, 64, 48, 32, 24, 32, ptmp); + //modexDrawPBuf(&gvar.video.page[0], 64, 64, &ptmp, 0); while(!kbhit()) { } VGAmodeX(0, &gvar); - /*printf("\nmain=%Fp\n\n", &i); - printf("bmp.data=%Fp\n", bmp.data); - printf("*bmp.data=%Fp\n", *(bmp.data)); - printf("&bmp.data=%Fp\n", &(bmp.data));*/ - /* print out the contents of each plane */ + //print out the contents of each plane for(plane=0; plane < 4; plane++) { i=0; printf("Plane %d\n", plane); - for(py=0; py < p->height; py++) { - for(px=0; px < p->pwidth; px++) { - printf("%02X ", (int) p->plane[plane][i++]); + for(py=0; py < p.height; py++) { + for(px=0; px < p.pwidth; px++) { + printf("%02X ", (int) p.plane[plane][i++]); } printf("\n"); } } + + chx=0; + chy=0; + colpee=32; + for(e=0x00; e<=0xFE; e++) + { + if(chx+8>(gvar.video.page[0].width/2)) + { + chx=0; + chy+=8; + sprintf(pee,"%u", colpee); + modexprint(&gvar.video.page[0], 200, 200, 1, 47, 0, &pee, 0); + //getch(); + } + modexprint(&gvar.video.page[0], chx, chy, 1, 0, colpee, &e, 0); + chx+=9; + colpee++; + if(colpee>=32+24) colpee=32; + } + fprintf(stderr,"Project 16 planrpcx.exe. This is just a test file!\n"); fprintf(stderr,"version %s\n", VERSION); - fprintf(stderr,"%d\n", sizeof(p->plane)); - fprintf(stderr,"pw=%d\n", p->width); - fprintf(stderr,"ph=%d\n", p->height); - fprintf(stderr,"ppw=%d\n", p->pwidth); - fprintf(stderr,"%d\n", sizeof(bmp)); - fprintf(stderr,"%dx%d\n", gvar.video.page[0].sw-(p->width), gvar.video.page[0].sh-(p->height)); - planar_buf_free(p); + fprintf(stderr,"%d\n", sizeof(p.plane)); + fprintf(stderr,"pw=%d\n", p.width); + fprintf(stderr,"ph=%d\n", p.height); + fprintf(stderr,"ppw=%d\n", p.pwidth); + fprintf(stderr,"%d\n", sizeof(p)); + fprintf(stderr,"%dx%d\n", gvar.video.page[0].sw-(p.width), gvar.video.page[0].sh-(p.height)); free(bakapeee); - fprintf(stderr, "modexDrawBmp: %f\n", t1); - fprintf(stderr, "DrawPBuf: %f\n", t2); - 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; + fprintf(stderr, "modexDrawBmpPBufRegion: %f\n", t2); + fprintf(stderr, "modexDrawPBufRegion: %f\n", t4); + fprintf(stderr, "speed difference %f\n", t2/t4); + //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); }