#include "src/lib/16_head.h"\r
#include "src/lib/timer.h"\r
#include "src/lib/bitmap.h"\r
+#include "src/lib/planar.h"\r
\r
#ifdef __DEBUG__\r
//#define __DEBUG_InputMgr__\r
word d; //direction!! wwww\r
word q; //loop variable\r
word speed; //player speed!\r
- bitmap_t data; //supposively the sprite sheet data\r
+ planar_buf_t data; //supposively the sprite sheet data\r
+// bitmap_t data; //supposively the sprite sheet data\r
sword hp; //hitpoints of the player\r
int persist_aniframe; /* gonna be increased to 1 before being used, so 0 is ok for default */\r
CursorInfo info;\r
//memory management needs to be added\r
//void\r
//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
+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
- int px, py, i;\r
-// byte near *buff;\r
- px=x;\r
- py=y;\r
-// buff = _nmalloc(p->pwidth+1);\r
- // TODO Make this fast. It's SLOOOOOOW\r
-// for(plane=0; plane < 4; plane++) {\r
-// i=0;\r
-// modexSelectPlane(PLANE(plane+x));\r
-// for(px = plane; px < p->width; px+=4) {\r
-// offset=px;\r
-// for(py=0; py<p->height/2; py++) {\r
-// //SELECT_ALL_PLANES();\r
-// if(!sprite || p->plane[offset])\r
-// page->data = &(p->plane[offset][i++]);\r
-// offset+=p->width;\r
-// offset++;\r
-// }\r
-// }\r
-// }\r
- for(plane=0; plane < 4; plane++) {\r
- i=(rx/4)+((rx/4)*ry);\r
- modexSelectPlane(PLANE(plane+x));\r
- for(; y < py+p->height; 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)), 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
- //}\r
- }\r
- x=px;\r
- y=py;\r
- }\r
-// _nfree(buff);\r
+ int plane;\r
+ int px, py, i;\r
+ px=x;\r
+ py=y;\r
+ for(plane=0; plane < 4; plane++) {\r
+ i=(rx/4)+((rx/4)*ry);\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+=rw]), rw/4);\r
+ //}\r
+ }\r
+ x=px;\r
+ y=py;\r
+ }\r
}\r
\r
+\r
/*temp*/\r
void\r
DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, boolean sprite)\r
\r
global_game_variables_t gvar;\r
\r
-/*\r
-void\r
-DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, byte sprite)\r
-{\r
- byte plane;\r
- word px, py;\r
- word offset;\r
-\r
- // TODO Make this fast. It's SLOOOOOOW\r
- for(plane=0; plane < 4; plane++) {\r
- modexSelectPlane(PLANE(plane+x));\r
- for(px = plane; px < p->width; px+=4) {\r
- offset=px;\r
- for(py=0; py<p->height/2; py++) {\r
- SELECT_ALL_PLANES();\r
- if(!sprite || p->plane[offset])\r
- page->data = p->plane;\r
- //offset+=p->width;\r
- //offset++;\r
- }\r
- }\r
- }\r
-}\r
-*/\r
-\r
void main() {\r
bitmap_t bmp;\r
planar_buf_t *p;\r
//page_t screen, gvar.video.page[1], gvar.video.page[2];
map_view_t mv[3];
map_view_t *bg, *spri, *mask;//, *tmp;
-planar_buf_t *p;
+bitmap_t p;
float t;
sword bakapee;
mappalptr = map.tiles->data->palette;
/* data */
- player[0].data = bitmapLoadPcx("data/ptmp.pcx"); // load sprite
+ p = bitmapLoadPcx("data/ptmp.pcx"); // load sprite
//npctmp = bitmapLoadPcx("ptmp1.pcx"); // load sprite
/* create the planar buffer */
- p = planar_buf_from_bitmap(&player[0].data);
+ (player[0].data) = *planar_buf_from_bitmap(&p);
//0000 printf("planar buffer ok\n");
#endif
/* input! */
modexCopyPageRegion(mv[1].page, mv[0].page, 0, 0, 0, 0, mv[0].page->width, mv[0].page->height);
#ifdef SPRITE
#ifdef BMPTYPE
- oldDrawBmp(VGA, player[0].x-4, player[0].y-TILEWH, &player[0].data, 1);
+ //oldDrawBmp(VGA, player[0].x-4, player[0].y-TILEWH, &player[0].data, 1);
#else
modexDrawSpriteRegion(spri->page, player[0].x-4, player[0].y-TILEWH, 24, 64, 24, 32, &player[0].data);
#endif