//modexDrawBmpRegion (page_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp)\r
void modexDrawPBufRegion (page_t *page, int x, int y, int rx, int ry, int rw, int rh, planar_buf_t *p, boolean sprite)\r
{\r
- int plane;\r
- //const int px, py;\r
+ sword plane;\r
int i;\r
- const int px=x-page->dx;\r
- const int py=y-page->dy;\r
+ const int px=x;//-page->dx;\r
+ const int py=y;//-page->dy;\r
+ #define PEEE ((rw)/4)-rx\r
+ //-(rx/4)\r
+ #define PEEEE ((p->pwidth)*(ry))\r
+ //y=py;\r
+ //x=px;\r
+ //printf("%d,%d p(%d,%d) r(%d,%d) rwh(%d,%d)\n", x, y, px, py, rx, ry, rw, rh);\r
for(plane=0; plane < 4; plane++) {\r
- i=(rw/4)+((p->pwidth)*ry);\r
+ i=PEEE+PEEEE;\r
+ //printf("PEEE=%d ", PEEE);\r
+ //printf("PEEEE=%d ", PEEEE);\r
+ //printf("i=%d\n", i);\r
modexSelectPlane(PLANE(plane+x));\r
for(; y < py+rh; y++) {\r
//for(px=0; px < p->width; px++) {\r
//printf("%02X ", (int) p->plane[plane][i++]);\r
// _fmemcpy(buff, &(p->plane[plane][i+=p->pwidth]), p->pwidth);\r
// printf("buff %u==%s\n", y, *buff);\r
- _fmemcpy(page->data + (((page->width/4) * (y+page->dy)) + ((x+page->dx) / 4)), &(p->plane[plane][i+=p->pwidth]), rw/4);\r
+ _fmemcpy(page->data + (((page->width/4) * y) + (x / 4)), &(p->plane[plane][i+=p->pwidth]), (rw/4));\r
//}\r
+ //if(plane==3) IN_Ack();\r
}\r
+ /*printf("y%d=%d ", plane, y);\r
+ if(plane==3) printf("y%d=%d\n", plane, y);*/\r
x=px;\r
y=py;\r
}\r
int plane;\r
int i;\r
// byte near *buff;\r
- const int px=x;\r
- const int py=y;\r
+ const int px=x+page->dx;\r
+ const int py=y+page->dy;\r
+ x=px;\r
+ y=py;\r
// buff = _nmalloc(p->pwidth+1);\r
// TODO Make this fast. It's SLOOOOOOW\r
// for(plane=0; plane < 4; plane++) {\r
// _fmemcpy(buff, &(p->plane[plane][i+=p->pwidth]), p->pwidth);\r
// printf("buff %u==%s\n", y, *buff);\r
// _fmemcpy(page->data + (((page->width/4) * (y+page->dy)) + ((x+page->dx) / 4)), buff, p->pwidth);\r
- _fmemcpy(page->data + (((page->width/4) * (y+page->dy)) + ((x+page->dx) / 4)), &(p->plane[plane][i+=p->pwidth]), p->pwidth);\r
+ _fmemcpy(page->data + (((page->width/4) * y) + (x / 4)), &(p->plane[plane][i+=p->pwidth]), p->pwidth);\r
//}\r
}\r
x=px;\r
word rowCounter;\r
byte planeCounter = 4;\r
\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
//code is a bit slow here\r
__asm {\r
MOV AX, SCREEN_SEG ; go to the VGA memory\r
bmp = bitmapLoadPcx(bakapeee);\r
p = planar_buf_from_bitmap(&bmp);\r
ptmpbt = bitmapLoadPcx("data/ptmp.pcx");\r
- ptmp = planar_buf_from_bitmap(&bmp);\r
+ ptmp = planar_buf_from_bitmap(&ptmpbt);\r
VGAmodeX(baka, &gvar);\r
gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]);\r
\r
modexDrawPBuf(&gvar.video.page[0], 0, 0, p, 0);\r
}\r
t2 = (*clockw-start) /18.2;\r
- getch();\r
modexPalUpdate1(ptmpbt.palette);\r
- modexDrawPBufRegion(&gvar.video.page[0], 140, 140, 48, 32, 24, 32, ptmp, 1);\r
+ modexDrawPBufRegion(&gvar.video.page[0], 160, 140, 48, 32, 24, 32, ptmp, 1);\r
while(!kbhit())\r
{\r
}\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
- for(px=0; px < p->pwidth; px++) {\r
- printf("%02X ", (int) p->plane[plane][i++]);\r
+ for(py=0; py < ptmp->height; py++) {\r
+ for(px=0; px < ptmp->pwidth; px++) {\r
+ printf("%02X ", (int) ptmp->plane[plane][i++]);\r
}\r
printf("\n");\r
}\r
}\r
col=0x0d, bgcol=0;\r
- for(i=0; i<8; i++)\r
+ /*for(i=0; i<8; i++)\r
{\r
- /*modexSelectPlane(PLANE(x));\r
- j=1<<8;\r
- *bakapee=(l[i] & j ? col:bgcol);\r
- _fmemcpy(page->data + (((page->width/4) * (y+page->dy+i)) + ((x+page->dx+chw) / 4)), bakapee, 8);*/\r
+ //modexSelectPlane(PLANE(x));\r
+ //j=1<<8;\r
+ //*bakapee=(l[i] & j ? col:bgcol);\r
+ //_fmemcpy(page->data + (((page->width/4) * (y+page->dy+i)) + ((x+page->dx+chw) / 4)), bakapee, 8);\r
j=4<<8;\r
fprintf(stderr, "j<<=%u\n", j);\r
xp=0;\r
fprintf(stderr, " j>>=%u\n", j);\r
}\r
//fprintf(stderr, "\n");\r
- }\r
+ }*/\r
chw += xp;\r
fprintf(stderr,"Project 16 planrpcx.exe. This is just a test file!\n");\r
fprintf(stderr,"version %s\n", VERSION);\r