X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Fplanrpcx.c;h=9ed1096db65f89f936b6a3b9daf9ecbe11d2d380;hb=d71e4ebbd3770b48eee2b2cc18288b97aad4e1e4;hp=7ed2b7b95bb07214034bf5680575e335a8043be6;hpb=2ac6d138ce852064f3c792957880a87b5f3d4523;p=16.git diff --git a/src/planrpcx.c b/src/planrpcx.c index 7ed2b7b9..9ed1096d 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,28 +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]; - word j,chw,xp,col,bgcol; - + 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]; @@ -54,92 +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"); } } - 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); - 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); - col=0x0d, bgcol=0; - for(i=0; i<8; i++) + + chx=0; + chy=0; + colpee=32; + for(e=0x00; e<=0xFE; e++) { - /*modexSelectPlane(PLANE(x)); - j=1<<8; - *bakapee=(l[i] & j ? col:bgcol); - _fmemcpy(page->data + (((page->width/4) * (y+page->dy+i)) + ((x+page->dx+chw) / 4)), bakapee, 8);*/ - j=4<<8; - fprintf(stderr, "j<<=%u\n", j); - xp=0; - while(j) + if(chx+8>(gvar.video.page[0].width/2)) { - //modexputPixel(page, x+xp+chw, y+i, l[i] & j ? col:bgcol); - //fprintf(stderr, "%u", l[i] & j ? col:bgcol); - xp++; - j>>=4; - fprintf(stderr, " j>>=%u\n", j); + chx=0; + chy+=8; + sprintf(pee,"%u", colpee); + modexprint(&gvar.video.page[0], 200, 200, 1, 47, 0, &pee, 0); + //getch(); } - //fprintf(stderr, "\n"); + modexprint(&gvar.video.page[0], chx, chy, 1, 0, colpee, &e, 0); + chx+=9; + colpee++; + if(colpee>=32+24) colpee=32; } - chw += xp; - return; + + 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(p)); + fprintf(stderr,"%dx%d\n", gvar.video.page[0].sw-(p.width), gvar.video.page[0].sh-(p.height)); + free(bakapeee); + 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); }