]> 4ch.mooo.com Git - 16.git/commitdiff
[16_ca needs huge amounts of work and I should remember what needs to be done soon...
authorsparky4 <sparky4@cock.li>
Wed, 29 Mar 2017 21:44:54 +0000 (16:44 -0500)
committersparky4 <sparky4@cock.li>
Wed, 29 Mar 2017 21:44:54 +0000 (16:44 -0500)
src/lib/16_ca.c
src/lib/16_ca.h
src/lib/16_enti.c
src/lib/16_spri.c
src/lib/16_tail.h
src/lib/16_tdef.h
src/lib/16_vl.c
src/lib/scroll16.c
src/lib/scroll16.h

index 0358a50559361b1ef53e48fe0cf389abe1349c73..ca0ad83748917056141568a104ccd969488511bf 100755 (executable)
@@ -1123,8 +1123,10 @@ dinorm:
 \r
 void CAL_SetupMapFile (global_game_variables_t *gvar)\r
 {\r
+#ifndef MAPHEADERLINKED\r
        int handle;\r
        long length;\r
+#endif\r
 \r
 //\r
 // load maphead.ext (offsets and tileinfo for map file)\r
@@ -1137,9 +1139,9 @@ void CAL_SetupMapFile (global_game_variables_t *gvar)
        MM_GetPtr (MEMPTR gvar->ca.tinf,length,gvar);\r
        CA_FarRead(handle, gvar->ca.tinf, length,gvar);\r
        close(handle);\r
-#else\r
+//#else\r
 \r
-       tinf = (byte _seg *)FP_SEG(&maphead);\r
+       gvar->ca.tinf = (byte _seg *)FP_SEG(&maphead);\r
 \r
 #endif\r
 \r
@@ -1805,7 +1807,7 @@ void CA_CacheGrChunk (int chunk)
        byte    far *source;\r
        int             next;\r
 \r
-       gvar->video.grneeded[chunk] |= ca_levelbit;             // make sure it doesn't get removed\r
+       gvar->ca.grneeded[chunk] |= ca_levelbit;                // make sure it doesn't get removed\r
        if (grsegs[chunk])\r
        {\r
                MM_SetPurge (&grsegs[chunk],0);\r
index bda68182c97dd8bc5fff65447725e3dbd259ca2e..29b6c6276b4468d545148327a9c3532af468de9a 100755 (executable)
@@ -31,7 +31,7 @@
 #define NOGRAPHICS\r
 #define NOAUDIO\r
 \r
-//#define MAPHEADERLINKED\r
+#define MAPHEADERLINKED\r
 //#define GRHEADERLINKED\r
 //#define AUDIOHEADERLINKED\r
 \r
index c66eead06669bcb581d484bac9c82f7210fd30ab..7210e6d371d74375a771643205ff1a21da49cdd4 100755 (executable)
@@ -46,7 +46,7 @@ void EN_initentity(entity_t *enti, video_t *video)
 //     modexClearRegion(&video->page[0], enti->x, enti->y, 16, 16, 2);\r
 //     modexClearRegion(&video->page[2], 0, 0, video->page[2].sw, video->page[2].sh, 45);\r
 //     modexClearRegion(&video->page[3], 0, 0, video->page[3].sw, video->page[3].sh, 47);\r
-       if(!video->bgps){\r
+       if(!video->vga_state.bgps){\r
                //video->ofs.pattern_ofs=(uint16_t)video->page[0].data;\r
                //video->ofs.offscreen_ofs=(uint16_t)video->page[3].data;\r
                w = (enti->x + 24) & (~3);\r
index f2c58ff3e021a28ff2ffbfd32c999456f8d09d49..251bad5b22ac1896690a2dbe0d0cabb93316726f 100755 (executable)
@@ -156,7 +156,7 @@ void animate_spri(entity_t *enti, video_t *video)
        }\r
 \r
        // render box bounds. y does not need modification, but x and width must be multiple of 4\r
-       if(!video->rss)\r
+       if(!video->vga_state.rss)\r
        {\r
                if (x >= enti->overdraww) rx = (x - enti->overdraww) & (~3);\r
                        else rx = -(video->page[0].dx);\r
@@ -167,7 +167,7 @@ void animate_spri(entity_t *enti, video_t *video)
                if ((rx+w) > video->page[0].width) w = video->page[0].width-rx;\r
                if ((ry+h) > video->page[0].height) h = video->page[0].height-ry;\r
 \r
-               if(!video->bgps){\r
+               if(!video->vga_state.bgps){\r
                        // block copy pattern to where we will draw the sprite\r
                        vga_setup_wm1_block_copy();\r
                        o2 = video->ofs.offscreen_ofs;\r
@@ -199,12 +199,12 @@ void animate_spri(entity_t *enti, video_t *video)
 #ifdef __DEBUG_SPRI__\r
        if(dbg_delayanimation) delay(250);//{ while(!IN_KeyDown(sc_Space)/* && !IN_KeyDown(sc_Escape)*/){} delay(250); }\r
 #endif\r
-       if(!video->rss)\r
+       if(!video->vga_state.rss)\r
        {\r
                // restore ptr\r
                vga_state.vga_graphics_ram = omemptr;\r
 \r
-               if(!video->bgps){\r
+               if(!video->vga_state.bgps){\r
                        // block copy to visible RAM from offscreen\r
                        vga_setup_wm1_block_copy();\r
                        o = video->ofs.offscreen_ofs; // source offscreen\r
@@ -217,6 +217,6 @@ void animate_spri(entity_t *enti, video_t *video)
        // restore stride\r
        vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = video->page[0].stridew;\r
 \r
-       vga_state.vga_graphics_ram = video->omemptr;\r
+       vga_state.vga_graphics_ram = video->vga_state.omemptr;\r
        video->dorender=1;\r
 }\r
index d31cac10c7d951e1762e21dacce1d55d0697bacf..4de636c66270e65c0eb84c9eb978eeac45c18264 100755 (executable)
 #define TAIL_FUNCTIONKEYFUNCTIONS0EXE \\r
        if(gvar.in.inst->Keyboard[sc_F4]){ turboXT(12);                                                                 IN_UserInput(1, &gvar); } \\r
        if(gvar.in.inst->Keyboard[68/*sc_F10*/]){ gvar.kurokku.fpscap=!gvar.kurokku.fpscap;             IN_UserInput(1, &gvar); } \\r
-       if(gvar.in.inst->Keyboard[sc_F8]){ gvar.video.bgps=!gvar.video.bgps;                                    IN_UserInput(1, &gvar); } \\r
+       if(gvar.in.inst->Keyboard[sc_F8]){ gvar.video.vga_state.bgps=!gvar.video.vga_state.bgps;                                        IN_UserInput(1, &gvar); } \\r
        if(gvar.in.inst->Keyboard[sc_F7]){ ZC_ShowMV(&gvar.mv, 0, 1);                                           IN_UserInput(1, &gvar); } \\r
        if(gvar.in.inst->Keyboard[sc_F6]){ ZC_ShowMV(&gvar.mv, 0, 0);                                           IN_UserInput(1, &gvar); } \\r
-       if(gvar.in.inst->Keyboard[sc_T]){ gvar.video.rss=!gvar.video.rss;                                               IN_UserInput(1, &gvar); } \\r
+       if(gvar.in.inst->Keyboard[sc_T]){ gvar.video.vga_state.rss=!gvar.video.vga_state.rss;                                           IN_UserInput(1, &gvar); } \\r
        if(gvar.in.inst->Keyboard[sc_P]){ modexpdump(&gvar.video.page[0]);                                      IN_UserInput(1, &gvar); } \\r
        if(gvar.in.inst->Keyboard[sc_Y]){ dbg_delayanimation=!dbg_delayanimation;                               IN_UserInput(1, &gvar); } \\r
        RFDEBUGFUNCTIONS\r
index 871cf69e80afd377d873976e629e290e37c0bc55..2c2d0f723a115ad5f02e64862c907b770a0e1603 100755 (executable)
@@ -365,18 +365,23 @@ typedef struct
 \r
 typedef struct\r
 {\r
-       char old_mode;          //old video mode before game!\r
-       byte palette[PALSIZE], dpal[PALSIZE];   //palette array\r
-       page_t page[MAXPAGE];   //can be used as a pointer to root page[0]\r
-       word vmem_remain;       //remaining video memory\r
-       byte num_of_pages;      //number of actual pages\r
-       //doslib origi vars\r
+//doslib origi vars\r
        byte far * omemptr;\r
        byte vga_draw_stride;\r
        byte vga_draw_stride_limit;             // further X clipping\r
-       //end of doslib origi vars\r
+//end of doslib origi vars\r
        boolean __near rss;             //render sprite switch\r
        boolean __near bgps;            //bg preservation render switch between old and new\r
+} vga_state_t;\r
+\r
+typedef struct\r
+{\r
+       char old_mode;          //old video mode before game!\r
+       byte palette[PALSIZE], dpal[PALSIZE];   //palette array\r
+       page_t page[MAXPAGE];   //can be used as a pointer to root page[0]\r
+       word vmem_remain;       //remaining video memory\r
+       byte num_of_pages;      //number of actual pages\r
+       vga_state_t     vga_state;\r
        sword __near sprifilei;         //player file's i\r
        nibble __near p;                        //render page number\r
        nibble __near sp;                       //show page number(for showpage)\r
@@ -387,9 +392,6 @@ typedef struct
        ofs_t   ofs;            //offset vars used for doslib\r
        word    vh;             //video combined height\r
        //0000word startclk; float clk, tickclk;        //timer\r
-//newer vars\r
-//TODO: find out how they are used\r
-//     byte grneeded[NUMCHUNKS];\r
 } video_t;\r
 \r
 //from scroll16\r
index 7e67b01293432e91b9166b430996522576c12711..82e81375b79a804cc3ff4cc3c65b6fb1cbef0d0a 100755 (executable)
@@ -274,7 +274,7 @@ void modexCalcVmemRemain(video_t *video)
 \r
 void VL_Initofs(video_t *video)\r
 {\r
-       if(!video->bgps)\r
+       if(!video->vga_state.bgps)\r
        {\r
                video->ofs.offscreen_ofs =      video->page[0].pagesize+video->page[1].pagesize;//(vga_state.vga_stride * vga_state.vga_height);\r
                video->ofs.pattern_ofs =        (uint16_t)video->page[2].data;\r
@@ -304,12 +304,12 @@ void modexHiganbanaPageSetup(video_t *video)
 \r
        VL_Initofs(video);\r
        //doslib origi var\r
-       video->omemptr=                 vga_state.vga_graphics_ram;\r
-       video->vga_draw_stride= vga_state.vga_draw_stride;\r
-       video->vga_draw_stride_limit=   vga_state.vga_draw_stride_limit;\r
+       video->vga_state.omemptr=                       vga_state.vga_graphics_ram;\r
+       video->vga_state.vga_draw_stride=       vga_state.vga_draw_stride;\r
+       video->vga_state.vga_draw_stride_limit= vga_state.vga_draw_stride_limit;\r
        //sprite render switch and bgpreservation switch\r
-       video->rss=             1;\r
-       video->bgps=    1;\r
+       video->vga_state.rss=           1;\r
+       video->vga_state.bgps=  1;\r
 \r
        //setup the buffersize\r
        video->page[0].dx=video->page[0].dy=\r
index 9e69713cba5d7a6bc900918609c4e98f11c01e14..0cbb7397dd35aa13ddf012e3364f72c34523e346 100755 (executable)
@@ -347,7 +347,7 @@ void near mapScrollRight(map_view_t *mv, player_t *player, word id, word plid)
 //             if(id==0)\r
                        mapDrawCol(&mv[id], mv[0].tx + mv[0].page->ti.tw, mv[0].ty-1, x, player, DRAWCOLNUM);\r
 //             else\r
-//                     if(mv[0].video->bgps)\r
+//                     if(mv[0].video->vga_state.bgps)\r
 //                             modexCopyPageRegion(mv->page, mv[0].page, x, 0, x, 0, mv[0].map->tiles->tileWidth, mv[0].page->height);\r
        //mv[0].video->dorender=1;//ScrollRight\r
 }\r
@@ -370,7 +370,7 @@ void near mapScrollLeft(map_view_t *mv, player_t *player, word id, word plid)
 //             if(id==0)\r
                        mapDrawCol(&mv[id], mv[0].tx - 1, mv[0].ty-1, x, player, DRAWCOLNUM);\r
 //             else\r
-//                     if(mv[0].video->bgps)\r
+//                     if(mv[0].video->vga_state.bgps)\r
 //                             modexCopyPageRegion(mv->page, mv[0].page, x, 0, x, 0, mv[0].map->tiles->tileWidth, mv[0].page->height);\r
        //mv[0].video->dorender=1;//ScrollLeft\r
 }\r
@@ -393,7 +393,7 @@ void near mapScrollUp(map_view_t *mv, player_t *player, word id, word plid)
 //             if(id==0)\r
                        mapDrawRow(&mv[id], mv[0].tx - 1, mv[0].ty-1, y, player, DRAWROWNUM);\r
 //             else\r
-//                     if(mv[0].video->bgps)\r
+//                     if(mv[0].video->vga_state.bgps)\r
 //                             modexCopyPageRegion(mv->page, mv[0].page, 0, y, 0, y, mv[0].page->width, mv[0].map->tiles->tileHeight);\r
        //mv[0].video->dorender=1;//ScrollUp\r
 }\r
@@ -416,14 +416,14 @@ void near mapScrollDown(map_view_t *mv, player_t *player, word id, word plid)
 //             if(id==0)\r
                        mapDrawRow(&mv[id], mv[0].tx - 1, mv[0].ty+mv[0].page->ti.th, y, player, DRAWROWNUM);\r
 //             else\r
-//                     if(mv[0].video->bgps)\r
+//                     if(mv[0].video->vga_state.bgps)\r
 //                             modexCopyPageRegion(mv->page, mv[0].page, 0, y, 0, y, mv[0].page->width, mv[0].map->tiles->tileHeight);\r
        //mv[0].video->dorender=1;//ScrollDown\r
 }\r
 \r
 void ZC_mapScroll(map_view_t *mv, player_t *player, word pn)\r
 {\r
-       word b = mv[0].video->bgps;\r
+       word b = mv[0].video->vga_state.bgps;\r
        switch(player[pn].enti.d)\r
        {\r
                case 2://none\r
@@ -534,7 +534,7 @@ void mapGoTo(map_view_t *mv, int tx, int ty)
        modexClearRegion(mv[0].page, 0, 0, mv[0].page->width, mv[0].page->height, 0);\r
        ZC_mapredraw(mv, tx, ty);\r
 \r
-       //if(mv[0].video->bgps) modexCopyPageRegion(mv[1].page, mv[0].page, 0, 0, 0, 0, mv[0].page->width, mv[0].page->height);\r
+       //if(mv[0].video->vga_state.bgps) modexCopyPageRegion(mv[1].page, mv[0].page, 0, 0, 0, 0, mv[0].page->width, mv[0].page->height);\r
 }\r
 \r
 void ZC_mapinitMV(map_view_t *mv, int tx, int ty)\r
@@ -825,7 +825,7 @@ void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn)
                }\r
        }\r
 \r
-       if(pip[0].video->bgps && dd)//if moving wwww\r
+       if(pip[0].video->vga_state.bgps && dd)//if moving wwww\r
        {\r
                modexCopyPageRegion(pip[0].page, pip[1].page, x-4, y-4, x-4, y-4, 28, 40);\r
 \r
index 8f367bf7b48a14a2fb9f1ff66cbe37da3a55afd4..f7887686a9daae4118d413a5d51f6062bfb605ec 100755 (executable)
@@ -88,7 +88,7 @@ printf("\n\n");\
 \\r
        printf("gvar.video:\n");\\r
        printf(" r=%u ", gvar.video.dorender);\\r
-       printf("bgps=%u ", gvar.video.bgps);\\r
+       printf("bgps=%u ", gvar.video.vga_state.bgps);\\r
        printf("dbg_delayanimation=%u ", dbg_delayanimation);\\r
 printf("\n\n");\r
 \r
@@ -96,12 +96,10 @@ printf("\n\n");
        if(IN_KeyDown(sc_F11)){ pagedelayrendermap=!pagedelayrendermap;         IN_UserInput(1, &gvar); }\r
        if(IN_KeyDown(sc_F10)){ gvar.kurokku.fpscap=!gvar.kurokku.fpscap;               IN_UserInput(1, &gvar); }\r
        if(IN_KeyDown(sc_F9)){ pagenorendermap=!pagenorendermap;                                IN_UserInput(1, &gvar); }\r
-       if(IN_KeyDown(sc_F8)){ gvar.video.bgps=!gvar.video.bgps;                                        IN_UserInput(1, &gvar); }\r
-       if(IN_KeyDown(sc_T)){ gvar.video.rss=!gvar.video.rss;                                           IN_UserInput(1, &gvar); }\r
+       if(IN_KeyDown(sc_F8)){ gvar.video.vga_state.bgps=!gvar.video.vga_state.bgps;                                    IN_UserInput(1, &gvar); }\r
+       if(IN_KeyDown(sc_T)){ gvar.video.vga_state.rss=!gvar.video.vga_state.rss;                                               IN_UserInput(1, &gvar); }\r
 */\r
 \r
-extern boolean pagenorendermap, pagedelayrendermap;\r
-\r
 extern char global_temp_status_text[512];\r
 extern char global_temp_status_text2[512];\r
 \r