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
- 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 copy_ofs = offscreen_ofs;\r
- unsigned int display_ofs = 0x0000;\r
unsigned int i,o,o2; int j;\r
int x,y,rx,ry,w,h;\r
\r
VGA_RAM_PTR omemptr = (VGA_RAM_PTR)video->page[0].data;// save original mem ptr\r
x=enti->spri->x;\r
y=enti->spri->y;\r
+ VL_Initofs(video);\r
\r
// Depending on delay, update indices\r
//#define FRAME1 modexDrawSpriteRegion(pip[(pip->video->p)].page, x, y, 48, player[pn].enti.dire, 24, 32, PLAYERBMPDATAPTR);\r
//#define FRAME3 modexDrawSpriteRegion(pip[(pip->video->p)].page, x, y, 0, player[pn].enti.dire, 24, 32, PLAYERBMPDATAPTR);\r
//#define FRAME4 modexDrawSpriteRegion(pip[(pip->video->p)].page, x, y, 24, player[pn].enti.dire, 24, 32, PLAYERBMPDATAPTR); stand\r
\r
- /* copy active display (0) to offscreen buffer (0x4000) */\r
- vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = vga_state.vga_stride;\r
+ // copy active display (0) to offscreen buffer (0x4000)\r
+ /*vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = vga_state.vga_stride;\r
vga_setup_wm1_block_copy();\r
vga_wm1_mem_block_copy(copy_ofs, display_ofs, vga_state.vga_stride * vga_state.vga_height);\r
- vga_restore_rm0wm0();\r
+ vga_restore_rm0wm0();*/\r
\r
switch(enti->spri->delay)\r
{\r
\r
// block copy pattern to where we will draw the sprite\r
vga_setup_wm1_block_copy();\r
- o2 = offscreen_ofs;\r
- o = pattern_ofs + (ry * video->page[0].stridew) + (rx >> 2); // source offscreen 0x10000UL -\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
\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 + offscreen_ofs;\r
+ vga_state.vga_graphics_ram = omemptr + video->ofs.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
\r
// block copy to visible RAM from offscreen\r
vga_setup_wm1_block_copy();\r
- o = offscreen_ofs; // source offscreen\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