From 8eedd2ca5b4a1c8bf2c6629a98d26deafc64e19f Mon Sep 17 00:00:00 2001 From: sparky4 Date: Wed, 27 Apr 2016 11:19:37 -0500 Subject: [PATCH] paging system being worked on~ --- dlmkfile | 56 ---------------------------------------------- src/lib/modex16.c | 12 +++++----- src/lib/modex16.h | 3 ++- src/lib/scroll16.c | 44 +++++++++++++++++++++--------------- src/lib/scroll16.h | 3 +++ src/lib/typdefst.h | 7 ++++-- src/scroll.c | 45 ++++++++++++++++++------------------- 7 files changed, 65 insertions(+), 105 deletions(-) delete mode 100755 dlmkfile diff --git a/dlmkfile b/dlmkfile deleted file mode 100755 index e47a14cc..00000000 --- a/dlmkfile +++ /dev/null @@ -1,56 +0,0 @@ -# do not use GNU make. -# Only use Open Watcom WMAKE - -all: cpu16.exe cpu16h.exe cpu32.exe - -clean: .symbolic - rm -v *.exe *.obj *.map - -DOSLIBDIR=.. -!include $(DOSLIBDIR)/extdep.mak - -# library deps 16-bit large -$(DOSLIBDIR)/hw/cpu/dos86l/cpu.lib: - cd $(DOSLIBDIR)/hw/cpu && ./make.sh -$(DOSLIBDIR)/hw/dos/dos86l/dos.lib: - cd $(DOSLIBDIR)/hw/dos && ./make.sh - -# library deps 16-bit huge -$(DOSLIBDIR)/hw/cpu/dos86h/cpu.lib: - cd $(DOSLIBDIR)/hw/cpu && ./make.sh -$(DOSLIBDIR)/hw/dos/dos86h/dos.lib: - cd $(DOSLIBDIR)/hw/dos && ./make.sh - -# library deps 32-bit flat -$(DOSLIBDIR)/hw/cpu/dos386f/cpu.lib: - cd $(DOSLIBDIR)/hw/cpu && ./make.sh -$(DOSLIBDIR)/hw/dos/dos386f/dos.lib: - cd $(DOSLIBDIR)/hw/dos && ./make.sh - -# NOTE: dos86l = 16-bit large memory model. memory model must match! -cpu16.exe: cpu16.obj $(DOSLIBDIR)/hw/cpu/dos86l/cpu.lib $(DOSLIBDIR)/hw/dos/dos86l/dos.lib - %write tmp.cmd option quiet option map=cpu16.map $(DOSLIB_LDFLAGS_DOS16L) file cpu16.obj name cpu16.exe - %write tmp.cmd library $(DOSLIBDIR)/hw/cpu/dos86l/cpu.lib - %write tmp.cmd library $(DOSLIBDIR)/hw/dos/dos86l/dos.lib - @wlink @tmp.cmd -cpu16.obj: cpu.c - wcl $(FLAGS) -fo=cpu16.obj -ml $(DOSLIB_CFLAGS_DOS16L) -c cpu.c - -# NOTE: dos86h = 16-bit huge memory model. memory model must match! -cpu16h.exe: cpu16h.obj $(DOSLIBDIR)/hw/cpu/dos86h/cpu.lib $(DOSLIBDIR)/hw/dos/dos86h/dos.lib - %write tmp.cmd option quiet option map=cpu16h.map $(DOSLIB_LDFLAGS_DOS16H) file cpu16h.obj name cpu16h.exe - %write tmp.cmd library $(DOSLIBDIR)/hw/cpu/dos86h/cpu.lib - %write tmp.cmd library $(DOSLIBDIR)/hw/dos/dos86h/dos.lib - @wlink @tmp.cmd -cpu16h.obj: cpu.c - wcl $(FLAGS) -fo=cpu16h.obj -mh $(DOSLIB_CFLAGS_DOS16H) -c cpu.c - -# NOTE: dos386f = 32-bit flat memory model. memory model must match! -cpu32.exe: cpu32.obj $(DOSLIBDIR)/hw/cpu/dos386f/cpu.lib $(DOSLIBDIR)/hw/dos/dos386f/dos.lib - %write tmp.cmd option quiet option map=cpu32.map $(DOSLIB_LDFLAGS_DOS32) file cpu32.obj name cpu32.exe - %write tmp.cmd library $(DOSLIBDIR)/hw/cpu/dos386f/cpu.lib - %write tmp.cmd library $(DOSLIBDIR)/hw/dos/dos386f/dos.lib - @wlink @tmp.cmd -cpu32.obj: cpu.c - wcl386 $(FLAGS) -fo=cpu32.obj -mf $(DOSLIB_CFLAGS_DOS32) -c cpu.c - diff --git a/src/lib/modex16.c b/src/lib/modex16.c index b290a08e..b51b6223 100755 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -238,14 +238,16 @@ void modexCalcVmemRemain(video_t *video) 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[0].width += (TILEWHD); video->page[0].height += (TILEWHD); (video->page[1]) = modexNextPage(&(video->page[0])); video->num_of_pages++; - (video->page[2]) = modexNextPage(&(video->page[1])); video->num_of_pages++; +// (video->page[2]) = modexNextPageFlexibleSize(&(video->page[1]), video->page[0].width, 16); video->num_of_pages++; +// (video->page[2]) = modexNextPage(&(video->page[1])); video->num_of_pages++; //(352*176)+1024 is the remaining amount of memory left wwww - modexCalcVmemRemain(video); - (video->page[3]) = modexNextPageFlexibleSize(&(video->page[2]), video->page[0].sw, 92); video->num_of_pages++; +// modexCalcVmemRemain(video); +// (video->page[3]) = modexNextPageFlexibleSize(&(video->page[2]), video->page[0].sw, 92); video->num_of_pages++; modexCalcVmemRemain(video); } + void modexShowPage(page_t *page) { word high_address; @@ -362,7 +364,7 @@ modexCopyPageRegion(page_t *dest, page_t *src, { word doffset = (word)dest->data + dy*(dest->width/4) + dx/4; word soffset = (word)src->data + sy*(src->width/4) + sx/4; - word scans = width/4; + word scans = vga_state.vga_stride; word nextSrcRow = src->width/4 - scans - 1; word nextDestRow = dest->width/4 - scans - 1; byte lclip[] = {0x0f, 0x0e, 0x0c, 0x08}; /* clips for rectangles not on 4s */ diff --git a/src/lib/modex16.h b/src/lib/modex16.h index ae9ae3ed..8679bf86 100755 --- a/src/lib/modex16.h +++ b/src/lib/modex16.h @@ -66,7 +66,8 @@ static struct pcxHeader { //192x144 = 12x9 //temp defines -#define TILEWH 16 +#define TILEWH 16 +#define TILEWHD TILEWH*2 #define QUADWH TILEWH/2 /* -========================== Types & Macros ==========================- */ diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index ba227eca..a4aaf647 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -41,7 +41,8 @@ void walk(map_view_t *pip, player_t *player, word pn) animatePlayer(pip, player, pn, 1); mapScrollRight(pip, player, 0, pn); mapScrollRight(pip, player, 1, pn); - modexShowPage(pip[1].page); +// mapScrollRight(pip, player, 2, pn); + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx++; } } @@ -52,7 +53,7 @@ void walk(map_view_t *pip, player_t *player, word pn) INC_PER_FRAME; player[pn].x+=(player[pn].speed); animatePlayer(pip, player, pn, 0); - modexShowPage(pip[1].page); + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx++; } } @@ -64,7 +65,7 @@ void walk(map_view_t *pip, player_t *player, word pn) #else modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 14); #endif - modexShowPage(pip[1].page); + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].d = 2; } player[pn].triggerx = player[pn].tx+1; @@ -82,7 +83,8 @@ void walk(map_view_t *pip, player_t *player, word pn) animatePlayer(pip, player, pn, 1); mapScrollLeft(pip, player, 0, pn); mapScrollLeft(pip, player, 1, pn); - modexShowPage(pip[1].page); +// mapScrollLeft(pip, player, 2, pn); + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx--; } } @@ -93,7 +95,7 @@ void walk(map_view_t *pip, player_t *player, word pn) INC_PER_FRAME; player[pn].x-=(player[pn].speed); animatePlayer(pip, player, pn, 0); - modexShowPage(pip[1].page); + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx--; } } @@ -105,7 +107,7 @@ void walk(map_view_t *pip, player_t *player, word pn) #else modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 10); #endif - modexShowPage(pip[1].page); + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].d = 2; } player[pn].triggerx = player[pn].tx-1; @@ -123,7 +125,8 @@ void walk(map_view_t *pip, player_t *player, word pn) animatePlayer(pip, player, pn, 1); mapScrollDown(pip, player, 0, pn); mapScrollDown(pip, player, 1, pn); - modexShowPage(pip[1].page); +// mapScrollDown(pip, player, 2, pn); + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty++; } } @@ -134,7 +137,7 @@ void walk(map_view_t *pip, player_t *player, word pn) INC_PER_FRAME; player[pn].y+=(player[pn].speed); animatePlayer(pip, player, pn, 0); - modexShowPage(pip[1].page); + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty++; } } @@ -146,7 +149,7 @@ void walk(map_view_t *pip, player_t *player, word pn) #else modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 9); #endif - modexShowPage(pip[1].page); + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].d = 2; } player[pn].triggerx = player[pn].tx; @@ -164,7 +167,8 @@ void walk(map_view_t *pip, player_t *player, word pn) animatePlayer(pip, player, pn, 1); mapScrollUp(pip, player, 0, pn); mapScrollUp(pip, player, 1, pn); - modexShowPage(pip[1].page); +// mapScrollUp(pip, player, 2, pn); + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty--; } } @@ -175,7 +179,7 @@ void walk(map_view_t *pip, player_t *player, word pn) INC_PER_FRAME; player[pn].y-=(player[pn].speed); animatePlayer(pip, player, 0, pn); - modexShowPage(pip[1].page); + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty--; } } @@ -187,7 +191,7 @@ void walk(map_view_t *pip, player_t *player, word pn) #else modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 12); #endif - modexShowPage(pip[1].page); + if(!pageflipflop) modexShowPage(pip[1].page); player[pn].d = 2; } player[pn].triggerx = player[pn].tx; @@ -587,6 +591,7 @@ void mapDrawWCol(map_view_t *mv, int tx, int ty, word x) }*/ unsigned char shinku_fps_indicator_page = 0; +boolean pageflipflop; //gv->video.p /* sync */ @@ -603,9 +608,10 @@ void shinku(global_game_variables_t *gv) //modexCopyPageRegion(pip[1].page, pip[2].page, 16, 16, 16, 16, (14*8)+4, 8+4); /* block copy to visible RAM from offscreen */ vga_setup_wm1_block_copy(); - o = *(gv->video.page[2].data); // source offscreen - o2 = *(gv->video.page[shinku_fps_indicator_page].data)+(y * vga_state.vga_stride) + (x >> 2); // dest visible (original stride) - for (i=0;i < h;i++,o += vga_state.vga_draw_stride,o2 += vga_state.vga_stride) vga_wm1_mem_block_copy(o2,o,w >> 2); + modexCopyPageRegion(&(gv->video.page[shinku_fps_indicator_page]), &(gv->video.page[!shinku_fps_indicator_page]), x, y, x+w, 0, w, h); +// o = *(gv->video.page[2].data); // source offscreen +// o2 = *(gv->video.page[shinku_fps_indicator_page].data)+(y * vga_state.vga_stride) + (x >> 2); // dest visible (original stride) +// for (i=0;i < h;i++,o += vga_state.vga_draw_stride,o2 += vga_state.vga_stride) vga_wm1_mem_block_copy(o2,o,w >> 2); /* must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally */ vga_restore_rm0wm0(); if(elapsed_timer(gv) >= (1.0 / gv->kurokku.frames_per_second)) @@ -616,9 +622,10 @@ void shinku(global_game_variables_t *gv) gv->kurokku.tiku=0; /* block copy to visible RAM from offscreen */ vga_setup_wm1_block_copy(); - o = *(gv->video.page[shinku_fps_indicator_page].data); // source offscreen - o2 = *(gv->video.page[2].data)+(y * vga_state.vga_stride) + (x >> 2); // dest visible (original stride) - for (i=0;i < h;i++,o += vga_state.vga_draw_stride,o2 += vga_state.vga_stride) vga_wm1_mem_block_copy(o2,o,w >> 2); +// o = *(gv->video.page[shinku_fps_indicator_page].data); // source offscreen +// o2 = *(gv->video.page[2].data)+(y * vga_state.vga_stride) + (x >> 2); // dest visible (original stride) +// for (i=0;i < h;i++,o += vga_state.vga_draw_stride,o2 += vga_state.vga_stride) vga_wm1_mem_block_copy(o2,o,w >> 2); + modexCopyPageRegion(&(gv->video.page[shinku_fps_indicator_page]), &(gv->video.page[!shinku_fps_indicator_page]), x, y, x, 0, w, h); /* must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally */ vga_restore_rm0wm0(); }else //copy dat sheet @@ -637,6 +644,7 @@ void shinku(global_game_variables_t *gv) gv->kurokku.frames_per_second=60; break; } + if(pageflipflop) modexShowPage(&(gv->video.page[gv->video.p])); gv->video.p=!gv->video.p; } diff --git a/src/lib/scroll16.h b/src/lib/scroll16.h index d3711b5e..7a4f24a0 100755 --- a/src/lib/scroll16.h +++ b/src/lib/scroll16.h @@ -52,6 +52,7 @@ typedef struct { int ty; //appears to be the top left tile position on the viewable screen map word dxThresh; //???? word dyThresh; //???? + video_t *video; } map_view_t; typedef struct @@ -63,6 +64,8 @@ typedef struct #define MAPW 40 #define MAPH 30 +extern boolean pageflipflop; + //map_t allocMap(int w, int h); //void initMap(map_t *map); void walk(map_view_t *pip, player_t *player, word pn); diff --git a/src/lib/typdefst.h b/src/lib/typdefst.h index 8ee28a5c..8c80cbe1 100755 --- a/src/lib/typdefst.h +++ b/src/lib/typdefst.h @@ -100,13 +100,16 @@ typedef struct boolean fpscap; //cap the fps var } kurokku_t; +#define MAXPAGE 4 + typedef struct { char old_mode; //old video mode before game! - page_t page[4]; //pointer to root page[0] - dword vmem_remain; //remaining video memory + page_t page[MAXPAGE]; //pointer to root page[0] + sdword vmem_remain; //remaining video memory byte num_of_pages; //number of actual pages boolean p; //render page number + word pr[MAXPAGE][4]; //render sections of pages } video_t; typedef struct diff --git a/src/scroll.c b/src/scroll.c index 81f7da05..8fe1bc42 100755 --- a/src/scroll.c +++ b/src/scroll.c @@ -100,9 +100,6 @@ void main(int argc, char *argv[]) chkmap(&map, 0); printf("chkmap ok "); fprintf(stderr, "yay map loaded~~\n"); - mv[0].map = ↦ - mv[1].map = ↦ - mv[2].map = ↦ /* draw the tiles */ #ifdef MODEX @@ -164,9 +161,12 @@ void main(int argc, char *argv[]) /* setup camera and screen~ */ modexHiganbanaPageSetup(&gvar.video); - mv[0].page = &gvar.video.page[0]; - mv[1].page = &gvar.video.page[1]; - mv[2].page = &gvar.video.page[2]; + for(i=0;i