X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Fplanrpcx.c;h=06b1f29c8eb812887bf6bd089ff940d67f81d64c;hb=8d77030556e776f864e8e95bcbb5684ce2916d44;hp=6fe5ad7f57ac0fdc71f0b09987c33e8f1c912758;hpb=acd620ca492b03e6118fd56752456187bd59f5fc;p=16.git diff --git a/src/planrpcx.c b/src/planrpcx.c index 6fe5ad7f..06b1f29c 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,29 +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, ptmpbt; -//planar_buf_t *p, *ptmp; -planar_buf_t pnp, ptmpnp; +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, tpee; - 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]; @@ -55,97 +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); - pnp = planar_buf_from_bitmap0(&bmp); - ptmpbt = bitmapLoadPcx("data/ptmp.pcx"); - //ptmp = planar_buf_from_bitmap(&ptmpbt); - ptmpnp = planar_buf_from_bitmap0(&ptmpbt); - 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++) { -// modexDrawBmpPBufRegion (&gvar.video.page[0], 32, 32, 0, 0, pnp.width, pnp.height, &pnp); - modexDrawBmpPBuf (&gvar.video.page[0], 32, 32, &pnp); + //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++) { - modexDrawPBuf(&gvar.video.page[0], 0, 0, &pnp, 0); + modexDrawPBuf (&gvar.video.page[0], 0, 0, &p, 0); } - t2 = (*clockw-start) /18.2; - getch(); - modexPalUpdate1(ptmpbt.palette); - modexDrawBmpPBufRegion(&gvar.video.page[0], 64, 64, 48, 32, 24, 32, &ptmpnp); + 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); + 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 < ptmpnp.height; py++) { - for(px=0; px < ptmpnp.pwidth; px++) { - printf("%02X ", (int) ptmpnp.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"); } } - 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"); - }*/ - chw += xp; + 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(pnp.plane)); - fprintf(stderr,"pw=%d\n", pnp.width); - fprintf(stderr,"ph=%d\n", pnp.height); - fprintf(stderr,"ppw=%d\n", pnp.pwidth); - fprintf(stderr,"%d\n", sizeof(bmp)); - fprintf(stderr,"%dx%d\n", gvar.video.page[0].sw-(pnp.width), gvar.video.page[0].sh-(pnp.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, "modexDrawBmpPBuf: %f\n", t1); - fprintf(stderr, "modexDrawPBuf: %f\n", t2); - fprintf(stderr, "speed difference %f\n", t2/t1); - 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); }