]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/16_sprit.c
bg preservation still in works
[16.git] / src / lib / 16_sprit.c
index 5322746a55bee21389bdc09ea165d6cc820ce723..1c37d46d81f7b7b569b8499d7d698a44baf192ec 100755 (executable)
@@ -101,9 +101,8 @@ void animate_spri(entity_t *enti, video_t *video)
 #define INC_PER_FRAME if(enti->q&1) enti->persist_aniframe++; if(enti->persist_aniframe>4) enti->persist_aniframe = 1;\r
        unsigned int i,o,o2; int j;\r
        int x,y,rx,ry,w,h;\r
-#ifndef OLDBGPRESERVE\r
        VGA_RAM_PTR omemptr = (VGA_RAM_PTR)video->page[0].data;// save original mem ptr\r
-#endif\r
+\r
        x=enti->spri->x;\r
        y=enti->spri->y;\r
        VL_Initofs(video);\r
@@ -157,33 +156,35 @@ 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
-#ifndef OLDBGPRESERVE\r
-       if (x >= enti->overdraww) rx = (x - enti->overdraww) & (~3);\r
-               else rx = -(video->page[0].dx);\r
-       if (y >= enti->overdrawh) ry = (y - enti->overdrawh);\r
-               else ry = -(video->page[0].dy);\r
-       h = enti->spri->sprite_vrl_cont->vrl_header->height + enti->overdrawh + y - ry;\r
-       w = (x + enti->spri->sprite_vrl_cont->vrl_header->width + (enti->overdraww*2) + 3 - rx) & (~3) - enti->overdraww;//round up\r
-       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
-       // block copy pattern to where we will draw the sprite\r
-       vga_setup_wm1_block_copy();\r
-       o2 = video->ofs.offscreen_ofs;\r
-       o = video->ofs.pattern_ofs + (ry * video->page[0].stridew) + (rx >> 2); // source offscreen\r
-       for (i=0;i < h;i++,o += video->page[0].stridew,o2 += (w >> 2)) vga_wm1_mem_block_copy(o2,o,w >> 2);\r
-\r
-       // must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally\r
-       vga_restore_rm0wm0();\r
-\r
-       // replace VGA stride with our own and mem ptr. then sprite rendering at this stage is just (0,0)\r
-       vga_state.vga_draw_stride = w >> 2;\r
-       vga_state.vga_graphics_ram = omemptr + video->ofs.offscreen_ofs;\r
-#else\r
-       w=h=i=o=o2=0;\r
-       modexCopyPageRegion(&video->page[2], &video->page[0], enti->x, enti->y, 0, 0, 24, 32);\r
-#endif\r
+       if(!video->rss)\r
+       {\r
+               if(!video->bgps)\r
+               {\r
+                       if (x >= enti->overdraww) rx = (x - enti->overdraww) & (~3);\r
+                               else rx = -(video->page[0].dx);\r
+                       if (y >= enti->overdrawh) ry = (y - enti->overdrawh);\r
+                               else ry = -(video->page[0].dy);\r
+                       h = enti->spri->sprite_vrl_cont->vrl_header->height + enti->overdrawh + y - ry;\r
+                       w = (x + enti->spri->sprite_vrl_cont->vrl_header->width + (enti->overdraww*2) + 3 - rx) & (~3) - enti->overdraww;//round up\r
+                       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
+                       // block copy pattern to where we will draw the sprite\r
+                       vga_setup_wm1_block_copy();\r
+                       o2 = video->ofs.offscreen_ofs;\r
+                       o = video->ofs.pattern_ofs + (ry * video->page[0].stridew) + (rx >> 2); // source offscreen\r
+                       for (i=0;i < h;i++,o += video->page[0].stridew,o2 += (w >> 2)) vga_wm1_mem_block_copy(o2,o,w >> 2);\r
+\r
+                       // must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally\r
+                       vga_restore_rm0wm0();\r
+\r
+                       // replace VGA stride with our own and mem ptr. then sprite rendering at this stage is just (0,0)\r
+                       vga_state.vga_draw_stride = w >> 2;\r
+                       vga_state.vga_graphics_ram = omemptr + video->ofs.offscreen_ofs;\r
+               }else{\r
+                       w=h=i=o=o2=0;\r
+                       modexCopyPageRegion(&video->page[2], &video->page[0], enti->x, enti->y, 0, 0, 24, 32);\r
+               }\r
        }else{ rx=ry=w=h=0; vga_state.vga_graphics_ram = (VGA_RAM_PTR)video->page[0].data; }\r
        vga_state.vga_draw_stride_limit = (video->page[0].width + 3 - x) >> 2;//round up\r
 \r
@@ -200,28 +201,26 @@ void animate_spri(entity_t *enti, video_t *video)
                enti->spri->sprite_vrl_cont->data_size\r
        );\r
 #endif\r
-       if(!video->rss){\r
-#ifndef OLDBGPRESERVE\r
-       // restore ptr\r
-       vga_state.vga_graphics_ram = omemptr;\r
-\r
-       // block copy to visible RAM from offscreen\r
-       vga_setup_wm1_block_copy();\r
-       o = video->ofs.offscreen_ofs; // source offscreen\r
-       o2 = (ry * video->page[0].stridew) + (rx >> 2); // dest visible (original stride)\r
-       for (i=0;i < h;i++,o += vga_state.vga_draw_stride,o2 += video->page[0].stridew) vga_wm1_mem_block_copy(o2,o,w >> 2);\r
-       // must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally\r
-       vga_restore_rm0wm0();\r
-#else\r
-       //modexCopyPageRegion(&video->page[0], &video->page[2], 0, 0, enti->x, enti->y, 24, 32);\r
-#endif\r
+       if(!video->rss)\r
+       {\r
+               if(!video->bgps)\r
+               {\r
+                       // restore ptr\r
+                       vga_state.vga_graphics_ram = omemptr;\r
+\r
+                       // block copy to visible RAM from offscreen\r
+                       vga_setup_wm1_block_copy();\r
+                       o = video->ofs.offscreen_ofs; // source offscreen\r
+                       o2 = (ry * video->page[0].stridew) + (rx >> 2); // dest visible (original stride)\r
+                       for (i=0;i < h;i++,o += vga_state.vga_draw_stride,o2 += video->page[0].stridew) vga_wm1_mem_block_copy(o2,o,w >> 2);\r
+                       // must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally\r
+                       vga_restore_rm0wm0();\r
+               }else{\r
+                       //modexCopyPageRegion(&video->page[0], &video->page[2], 0, 0, enti->x, enti->y, 24, 32);\r
+               }\r
        }\r
        // 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
 }\r
-\r
-\r
-\r
-\r