X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Fplanrpcx.c;h=d3ac3bef1a89547088d9eae05238bed35d8e9f1b;hb=7a3b6f331f36735ef30027236eb447439583d43d;hp=d4b91e009101257bae68c3874e2d74cd14c4f608;hpb=4388d78db512b19cfb276402059633929b560dd3;p=16.git diff --git a/src/planrpcx.c b/src/planrpcx.c index d4b91e00..d3ac3bef 100755 --- a/src/planrpcx.c +++ b/src/planrpcx.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * @@ -24,97 +24,116 @@ #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]; + byte pee[2]; + +//w=0; +//printf("%u ", w++); bakapeee = malloc(64); if(argv[1]) bakapeee = argv[1]; else bakapeee = "data/koishi~.pcx"; - if(argv[2]) baka = atoi(argv[2]); - else +// 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); - VGAmodeX(baka, &gvar); + textInit(); + VGAmodeX(baka, 1, &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));*/ + VGAmodeX(0, 1, &gvar); - /* 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"); } } + 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); }