//TODO MAKE FLEXIBLE~\r
gv->video.page[0].tilemidposscreenx = gv->video.page[0].tilesw;\r
gv->video.page[0].tilemidposscreeny = (gv->video.page[0].tilesh/2)+1;\r
- #define PAGE_SIZE (word)(gv->video.page[0].sw/4 * gv->video.page[0].sh)\r
}\r
\r
void\r
modexLeave() {\r
- /* TODO restore original mode and palette */\r
+ /* VGAmodeX restores original mode and palette */\r
vgaSetMode(TEXT_MODE);\r
}\r
\r
page.tilemidposscreeny = (page.th/2)+1;\r
page.tilesw=p->tilesw;\r
page.tilesh=p->tilesh;\r
- //pageSize = p->sw*p->sh;\r
+ page.pagesize = page.width*page.height;\r
page.id = 0;\r
\r
return page;\r
result.tw = p->width/TILEWH;\r
result.th = p->height/TILEWH;\r
result.id = p->id+1;\r
+ result.pagesize = p->pagesize;\r
\r
return result;\r
-// return modexNextPageFlexibleSize(&p, p->width, p->height);\r
}\r
\r
//next page with defined dimentions~\r
result.tw = p->width/TILEWH;\r
result.th = p->height/TILEWH;\r
result.id = p->id+1;\r
+ result.pagesize = result.width*result.height;\r
\r
return result;\r
}\r
\r
+void modexCalcVmemRemain(video_t *video)\r
+{\r
+ byte i;\r
+ video->vmem_remain=262144;\r
+ for(i=0; i<=video->num_of_pages; i++)\r
+ {\r
+ video->vmem_remain-=video->page[i].pagesize;\r
+ }\r
+}\r
\r
+void modexHiganbanaPageSetup(video_t *video)\r
+{\r
+ (video->page[0]) = modexDefaultPage(&(video->page[0])); video->num_of_pages++;\r
+ video->page[0].width += (TILEWH*2); video->page[0].height += (TILEWH*2);\r
+ (video->page[1]) = modexNextPage(&(video->page[0])); video->num_of_pages++;\r
+ modexCalcVmemRemain(video);\r
+ (video->page[2]) = modexNextPageFlexibleSize(&(video->page[1]), video->page[0].sw, video->page[0].sh); //(352*176)+1024 is the remaining amount of memory left wwww\r
+ video->num_of_pages++;\r
+ modexCalcVmemRemain(video);\r
+ //gvar.video.page[2] = modexNextPage0(mv2.page, 320, 192); //(352*176)+1024 is the remaining amount of memory left wwww\r
+}\r
void\r
modexShowPage(page_t *page) {\r
word high_address;\r
page_t modexDefaultPage(page_t *p);
page_t modexNextPage(page_t *p);
page_t modexNextPageFlexibleSize(page_t *p, word x, word y);
+void modexCalcVmemRemain(video_t *video);
+void modexHiganbanaPageSetup(video_t *video);
void modexShowPage(page_t *page);
void modexPanPage(page_t *page, int dx, int dy);
void modexSelectPlane(byte plane);
sword tilemidposscreeny; /* middle tile position */\r
sword tileplayerposscreenx; /* player position on screen */\r
sword tileplayerposscreeny; /* player position on screen */\r
+ iword pagesize; /* page size */\r
} page_t;\r
\r
typedef struct\r
\r
typedef struct\r
{\r
- long old_mode; //old video mode before game!\r
- page_t page[4]; //pointer to root page[0]\r
+ char old_mode; //old video mode before game!\r
+ page_t page[4]; //pointer to root page[0]\r
+ dword vmem_remain; //remaining video memory\r
+ byte num_of_pages; //number of actual pages\r
} video_t;\r
\r
typedef struct\r
#endif
/* setup camera and screen~ */
- gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]);
- gvar.video.page[0].width += (TILEWH*2);
- gvar.video.page[0].height += (TILEWH*2);
+ modexHiganbanaPageSetup(&gvar.video);
mv[0].page = &gvar.video.page[0];
- gvar.video.page[1] = modexNextPage(mv[0].page);
mv[1].page = &gvar.video.page[1];
-
- gvar.video.page[2] = modexNextPageFlexibleSize(mv[1].page, gvar.video.page[0].sw, gvar.video.page[0].sh); //(352*176)+1024 is the remaining amount of memory left wwww
- //gvar.video.page[2] = modexNextPage0(mv2.page, 320, 192); //(352*176)+1024 is the remaining amount of memory left wwww
mv[2].page = &gvar.video.page[2];
/* set up paging */