From 37905954f1035172eab97d8cc398565e9947930e Mon Sep 17 00:00:00 2001 From: sparky4 Date: Fri, 22 Apr 2016 10:14:26 -0500 Subject: [PATCH] repo sync ^^ --- src/.scroll.c.kate-swp | Bin 0 -> 149 bytes src/lib/modex16.c | 28 ++++++++++++++++++++++++---- src/lib/modex16.h | 2 ++ src/lib/typdefst.h | 7 +++++-- src/scroll.c | 8 +------- 5 files changed, 32 insertions(+), 13 deletions(-) create mode 100755 src/.scroll.c.kate-swp diff --git a/src/.scroll.c.kate-swp b/src/.scroll.c.kate-swp new file mode 100755 index 0000000000000000000000000000000000000000..d25cd712ebfc5957edd16dc721cb9ea9a4f401a9 GIT binary patch literal 149 zcmZQzU=Z?7EJ;-eE>A2_aLdd|RWQ;sU|?VnxT|u>b#2j_TqFL}ZCj-DZG*!Z7#NoU uWg1video.page[0].tilemidposscreenx = gv->video.page[0].tilesw; gv->video.page[0].tilemidposscreeny = (gv->video.page[0].tilesh/2)+1; - #define PAGE_SIZE (word)(gv->video.page[0].sw/4 * gv->video.page[0].sh) } void modexLeave() { - /* TODO restore original mode and palette */ + /* VGAmodeX restores original mode and palette */ vgaSetMode(TEXT_MODE); } @@ -181,7 +180,7 @@ modexDefaultPage(page_t *p) page.tilemidposscreeny = (page.th/2)+1; page.tilesw=p->tilesw; page.tilesh=p->tilesh; - //pageSize = p->sw*p->sh; + page.pagesize = page.width*page.height; page.id = 0; return page; @@ -202,9 +201,9 @@ modexNextPage(page_t *p) { result.tw = p->width/TILEWH; result.th = p->height/TILEWH; result.id = p->id+1; + result.pagesize = p->pagesize; return result; -// return modexNextPageFlexibleSize(&p, p->width, p->height); } //next page with defined dimentions~ @@ -221,11 +220,32 @@ modexNextPageFlexibleSize(page_t *p, word x, word y) result.tw = p->width/TILEWH; result.th = p->height/TILEWH; result.id = p->id+1; + result.pagesize = result.width*result.height; return result; } +void modexCalcVmemRemain(video_t *video) +{ + byte i; + video->vmem_remain=262144; + for(i=0; i<=video->num_of_pages; i++) + { + video->vmem_remain-=video->page[i].pagesize; + } +} +void modexHiganbanaPageSetup(video_t *video) +{ + (video->page[0]) = modexDefaultPage(&(video->page[0])); video->num_of_pages++; + video->page[0].width += (TILEWH*2); video->page[0].height += (TILEWH*2); + (video->page[1]) = modexNextPage(&(video->page[0])); video->num_of_pages++; + modexCalcVmemRemain(video); + (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 + video->num_of_pages++; + modexCalcVmemRemain(video); + //gvar.video.page[2] = modexNextPage0(mv2.page, 320, 192); //(352*176)+1024 is the remaining amount of memory left wwww +} void modexShowPage(page_t *page) { word high_address; diff --git a/src/lib/modex16.h b/src/lib/modex16.h index 98551f48..ae9ae3ed 100755 --- a/src/lib/modex16.h +++ b/src/lib/modex16.h @@ -118,6 +118,8 @@ void modexsetBaseXMode(); 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); diff --git a/src/lib/typdefst.h b/src/lib/typdefst.h index 772f3066..25a49196 100755 --- a/src/lib/typdefst.h +++ b/src/lib/typdefst.h @@ -80,6 +80,7 @@ typedef struct { sword tilemidposscreeny; /* middle tile position */ sword tileplayerposscreenx; /* player position on screen */ sword tileplayerposscreeny; /* player position on screen */ + iword pagesize; /* page size */ } page_t; typedef struct @@ -101,8 +102,10 @@ typedef struct typedef struct { - long old_mode; //old video mode before game! - page_t page[4]; //pointer to root page[0] + char old_mode; //old video mode before game! + page_t page[4]; //pointer to root page[0] + dword vmem_remain; //remaining video memory + byte num_of_pages; //number of actual pages } video_t; typedef struct diff --git a/src/scroll.c b/src/scroll.c index 491610d3..f58490f9 100755 --- a/src/scroll.c +++ b/src/scroll.c @@ -163,15 +163,9 @@ void main(int argc, char *argv[]) #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 */ -- 2.39.5