]> 4ch.mooo.com Git - 16.git/commitdiff
paging system being worked on~
authorsparky4 <sparky4@cock.li>
Wed, 27 Apr 2016 16:19:37 +0000 (11:19 -0500)
committersparky4 <sparky4@cock.li>
Wed, 27 Apr 2016 16:19:37 +0000 (11:19 -0500)
dlmkfile [deleted file]
src/lib/modex16.c
src/lib/modex16.h
src/lib/scroll16.c
src/lib/scroll16.h
src/lib/typdefst.h
src/scroll.c

diff --git a/dlmkfile b/dlmkfile
deleted file mode 100755 (executable)
index e47a14c..0000000
--- 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
-
index b290a08efeb963b38bc6c5b33176d61b8c7454ac..b51b62231232f82a31dedcc2a457cb617b623268 100755 (executable)
@@ -238,14 +238,16 @@ void modexCalcVmemRemain(video_t *video)
 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[0].width += (TILEWHD); video->page[0].height += (TILEWHD);\r
        (video->page[1]) = modexNextPage(&(video->page[0]));    video->num_of_pages++;\r
-       (video->page[2]) = modexNextPage(&(video->page[1]));    video->num_of_pages++;\r
+//     (video->page[2]) = modexNextPageFlexibleSize(&(video->page[1]), video->page[0].width, 16);      video->num_of_pages++;\r
+//     (video->page[2]) = modexNextPage(&(video->page[1]));    video->num_of_pages++;\r
        //(352*176)+1024 is the remaining amount of memory left wwww\r
-       modexCalcVmemRemain(video);\r
-       (video->page[3]) = modexNextPageFlexibleSize(&(video->page[2]), video->page[0].sw, 92); video->num_of_pages++;\r
+//     modexCalcVmemRemain(video);\r
+//     (video->page[3]) = modexNextPageFlexibleSize(&(video->page[2]), video->page[0].sw, 92); video->num_of_pages++;\r
        modexCalcVmemRemain(video);\r
 }\r
+\r
 void\r
 modexShowPage(page_t *page) {\r
     word high_address;\r
@@ -362,7 +364,7 @@ modexCopyPageRegion(page_t *dest, page_t *src,
 {\r
     word doffset = (word)dest->data + dy*(dest->width/4) + dx/4;\r
     word soffset = (word)src->data + sy*(src->width/4) + sx/4;\r
-    word scans   = width/4;\r
+    word scans   = vga_state.vga_stride;\r
     word nextSrcRow = src->width/4 - scans - 1;\r
     word nextDestRow = dest->width/4 - scans - 1;\r
     byte lclip[] = {0x0f, 0x0e, 0x0c, 0x08};  /* clips for rectangles not on 4s */\r
index ae9ae3ede4cdff272a89d407934b7db5b71c6f2a..8679bf86a51ae1a81791b0803930af46f77ef94a 100755 (executable)
@@ -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 ==========================- */
index ba227ecac7dee47486c29285d02774c06bb3087d..a4aaf647e3b9c0b7686a23fc1cc4951ebbc47eda 100755 (executable)
@@ -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;
 }
 
index d3711b5e52cdb60ab566aabb47bdbd58b243cf60..7a4f24a0adea501c06d1611b189bfde04fe3a5fc 100755 (executable)
@@ -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);
index 8ee28a5ce6a64b981aa6a18a024219f836cc0b03..8c80cbe14883ac1e6af73a2236fc5c4ff7c51498 100755 (executable)
@@ -100,13 +100,16 @@ typedef struct
        boolean fpscap; //cap the fps var\r
 } kurokku_t;\r
 \r
+#define MAXPAGE 4\r
+\r
 typedef struct\r
 {\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
+       page_t page[MAXPAGE];           //pointer to root page[0]\r
+       sdword vmem_remain;     //remaining video memory\r
        byte num_of_pages;      //number of actual pages\r
        boolean p;                      //render page number\r
+       word pr[MAXPAGE][4];    //render sections of pages\r
 } video_t;\r
 \r
 typedef struct\r
index 81f7da051df07a8d6b5062d1c3e59f3a42cef351..8fe1bc42cc57459bdf8df826470893b49ba72f4a 100755 (executable)
@@ -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 = &map;
-       mv[1].map = &map;
-       mv[2].map = &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<gvar.video.num_of_pages;i++)
+       {
+               mv[i].page = &gvar.video.page[i];
+               mv[i].map = &map;
+               mv[i].video = &gvar.video;
+       }
 
        /* set up paging */
 //TODO: LOAD map data and position the map in the middle of the screen if smaller then screen
@@ -355,25 +355,18 @@ void main(int argc, char *argv[])
        //TSR
        if(IN_KeyDown(87))      //f11
        {
-               VGAmodeX(0, 0, &gvar);
-               IN_Shutdown();
-               __asm
-               {
-                       mov ah,31h
-                       int 21h
-               }
+               pageflipflop=!pageflipflop;
+//             VGAmodeX(0, 0, &gvar);
+//             IN_Shutdown();
+//             __asm
+//             {
+//                     mov ah,31h
+//                     int 21h
+//             }
        }
        if(IN_KeyDown(88))      //s
        {
-               switch(gvar.kurokku.fpscap)
-               {
-                       case 0:
-                               gvar.kurokku.fpscap=1;
-                       break;
-                       case 1:
-                               gvar.kurokku.fpscap=0;
-                       break;
-               }
+               gvar.kurokku.fpscap=!gvar.kurokku.fpscap;
                //IN_Ack();
        }
        //TODO fmemtest into page
@@ -420,9 +413,15 @@ void main(int argc, char *argv[])
 //not used now printf("temporary player sprite 1: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=44606385\n");
        printf("Virtual Screen: %dx", gvar.video.page[0].width);        printf("%d\n", gvar.video.page[0].height);
        printf("Screen: %dx", gvar.video.page[0].sw);   printf("%d\n", gvar.video.page[0].sh);
-       printf("tile resolution: %dx", gvar.video.page[0].tilesh);      printf("%d\n", gvar.video.page[0].tilesh);
+       printf("tile resolution: %dx", gvar.video.page[0].tilesh);      printf("%d ", gvar.video.page[0].tilesh);
        printf("middle tile position: %dx", gvar.video.page[0].tilemidposscreenx);      printf("%d\n", gvar.video.page[0].tilemidposscreeny);
        printf("video memory remaining: %d\n", gvar.video.vmem_remain);
+       printf("\npage ");
+       for(i=0; i<gvar.video.num_of_pages;i++)
+       {
+               printf("[%u]=(%Fp) ", i, &(gvar.video.page[i].data));
+       }
+       printf("\n");
 //     printf("Screen2: %dx", gvar.video.page[1].width);       printf("%d\n", gvar.video.page[1].height);
 //     printf("map: %dx%d\n", map.width, map.height);
 //     printf("\n");