]> 4ch.mooo.com Git - 16.git/commitdiff
showing row and colum drawing i optimized it to only draw at the end of walk. this...
authorsparky4 <sparky4@cock.li>
Thu, 26 Jan 2017 21:02:24 +0000 (15:02 -0600)
committersparky4 <sparky4@cock.li>
Thu, 26 Jan 2017 21:02:24 +0000 (15:02 -0600)
src/lib/16_sprit.c
src/lib/16_sprit.h

index c69f6694f90ec36ee276d71c1b85ae433db10063..8cac6595fd57204f8675cd8101105d669cce66c0 100755 (executable)
@@ -99,7 +99,8 @@ void print_anim_ids(struct sprite *spri)
 void animate_spri(entity_t *enti, video_t *video)\r
 {\r
 #define INC_PER_FRAME if(enti->q&1) enti->persist_aniframe++; if(enti->persist_aniframe>4) enti->persist_aniframe = 1;\r
-\r
+       const unsigned int offscreen_ofs = video->page[0].pagesize+video->page[1].pagesize;//(vga_state.vga_stride * vga_state.vga_height);\r
+       const unsigned int pattern_ofs = 0x10000UL - (uint16_t)video->page[2].data;//(vga_state.vga_stride * vga_state.vga_height);\r
        unsigned int i,o,o2; int j;\r
        int x,y,rx,ry,w,h;\r
 \r
@@ -162,8 +163,8 @@ void animate_spri(entity_t *enti, video_t *video)
 \r
        // block copy pattern to where we will draw the sprite\r
        vga_setup_wm1_block_copy();\r
-       o2 = VMEMPAGESIZE2;\r
-       o = ((uint16_t)VMEMPAGEDATA2) + (ry * video->page[0].stridew) + (rx >> 2); // source offscreen          0x10000UL -\r
+       o2 = offscreen_ofs;\r
+       o = pattern_ofs + (ry * video->page[0].stridew) + (rx >> 2); // source offscreen                0x10000UL -\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
@@ -171,7 +172,7 @@ void animate_spri(entity_t *enti, video_t *video)
 \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 + VMEMPAGESIZE2;\r
+       vga_state.vga_graphics_ram = omemptr + offscreen_ofs;\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
@@ -194,7 +195,7 @@ void animate_spri(entity_t *enti, video_t *video)
 \r
        // block copy to visible RAM from offscreen\r
        vga_setup_wm1_block_copy();\r
-       o = VMEMPAGESIZE2; // source offscreen\r
+       o = 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
index 77891d4ea8f19a06a3ab8a4896937207ae5bf469..8fede6661fd1acd6bad0837f04e8e5b095dc10d1 100755 (executable)
@@ -25,8 +25,8 @@
 #include "src/lib/16_vrs.h"\r
 #include "src/lib/scroll16.h"\r
 \r
-#define VMEMPAGESIZE2  video->page[0].pagesize+video->page[1].pagesize\r
-#define VMEMPAGEDATA2  video->page[2].data\r
+//#define VMEMPAGESIZE2        video->page[0].pagesize+video->page[1].pagesize\r
+//#define VMEMPAGEDATA2        video->page[2].data\r
 \r
 struct sprite\r
 {\r