Previous 199869 Revisions Next

r20840 Friday 8th February, 2013 at 17:13:27 UTC by Angelo Salese
Fixed linescroll for VDP2 bitmap layers [Angelo Salese]
[src/mame/video]stvvdp2.c

trunk/src/mame/video/stvvdp2.c
r20839r20840
30013001
30023002void saturn_state::draw_4bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect)
30033003{
3004   int xsize, ysize;
3004   int xsize, ysize, xsize_mask;
30053005   int xsrc,ysrc,xdst,ydst;
30063006   int src_offs;
30073007   UINT8* vram = m_vdp2.gfx_decode;
r20839r20840
30153015   xsize = (stv2_current_tilemap.bitmap_size & 2) ? 1024 : 512;
30163016   ysize = (stv2_current_tilemap.bitmap_size & 1) ? 512 : 256;
30173017
3018   xsize_mask = (stv2_current_tilemap.linescroll_enable) ? 1024 : xsize;
3019
30183020   pal_bank = stv2_current_tilemap.bitmap_palette_number;
30193021   pal_bank+= stv2_current_tilemap.colour_ram_address_offset;
30203022   pal_bank&= 7;
r20839r20840
30293031         if(stv_vdp2_window_process(xdst,ydst))
30303032            continue;
30313033
3032         xsrc = (xdst + scrollx) & (xsize-1);
3034         xsrc = (xdst + scrollx) & (xsize_mask-1);
30333035         ysrc = (ydst + scrolly) & (ysize-1);
30343036         src_offs = (xsrc + (ysrc*xsize));
30353037         src_offs/= 2;
r20839r20840
30553057
30563058void saturn_state::draw_8bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect)
30573059{
3058   int xsize, ysize;
3060   int xsize, ysize, xsize_mask;
30593061   int xsrc,ysrc,xdst,ydst;
30603062   int src_offs;
30613063   UINT8* vram = m_vdp2.gfx_decode;
r20839r20840
30693071   xsize = (stv2_current_tilemap.bitmap_size & 2) ? 1024 : 512;
30703072   ysize = (stv2_current_tilemap.bitmap_size & 1) ? 512 : 256;
30713073
3074   xsize_mask = (stv2_current_tilemap.linescroll_enable) ? 1024 : xsize;
3075
30723076   pal_bank = stv2_current_tilemap.bitmap_palette_number;
30733077   pal_bank+= stv2_current_tilemap.colour_ram_address_offset;
30743078   pal_bank&= 7;
r20839r20840
30833087         if(stv_vdp2_window_process(xdst,ydst))
30843088            continue;
30853089
3086         xsrc = (xdst + scrollx) & (xsize-1);
3090         xsrc = (xdst + scrollx) & (xsize_mask-1);
30873091         ysrc = (ydst + scrolly) & (ysize-1);
30883092         src_offs = (xsrc + (ysrc*xsize));
30893093         src_offs += map_offset;
r20839r20840
31063110
31073111void saturn_state::draw_rgb15_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect)
31083112{
3109   int xsize, ysize;
3113   int xsize, ysize, xsize_mask;
31103114   int xsrc,ysrc,xdst,ydst;
31113115   int src_offs;
31123116   UINT8* vram = m_vdp2.gfx_decode;
r20839r20840
31203124   xsize = (stv2_current_tilemap.bitmap_size & 2) ? 1024 : 512;
31213125   ysize = (stv2_current_tilemap.bitmap_size & 1) ? 512 : 256;
31223126
3127   xsize_mask = (stv2_current_tilemap.linescroll_enable) ? 1024 : xsize;
3128
31233129   for(ydst=cliprect.min_y;ydst<=cliprect.max_y;ydst++)
31243130   {
31253131      for(xdst=cliprect.min_x;xdst<=cliprect.max_x;xdst++)
r20839r20840
31273133         if(stv_vdp2_window_process(xdst,ydst))
31283134            continue;
31293135
3130         xsrc = (xdst + scrollx) & (xsize-1);
3136         xsrc = (xdst + scrollx) & (xsize_mask-1);
31313137         ysrc = (ydst + scrolly) & (ysize-1);
31323138         src_offs = (xsrc + (ysrc*xsize));
31333139         src_offs *= 2;
r20839r20840
31563162
31573163void saturn_state::draw_rgb32_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect)
31583164{
3159   int xsize, ysize;
3165   int xsize, ysize, xsize_mask;
31603166   int xsrc,ysrc,xdst,ydst;
31613167   int src_offs;
31623168   UINT8* vram = m_vdp2.gfx_decode;
r20839r20840
31703176   xsize = (stv2_current_tilemap.bitmap_size & 2) ? 1024 : 512;
31713177   ysize = (stv2_current_tilemap.bitmap_size & 1) ? 512 : 256;
31723178
3179   xsize_mask = (stv2_current_tilemap.linescroll_enable) ? 1024 : xsize;
3180
31733181   for(ydst=cliprect.min_y;ydst<=cliprect.max_y;ydst++)
31743182   {
31753183      for(xdst=cliprect.min_x;xdst<=cliprect.max_x;xdst++)
r20839r20840
31773185         if(stv_vdp2_window_process(xdst,ydst))
31783186            continue;
31793187
3180         xsrc = (xdst + scrollx) & (xsize-1);
3188         xsrc = (xdst + scrollx) & (xsize_mask-1);
31813189         ysrc = (ydst + scrolly) & (ysize-1);
31823190         src_offs = (xsrc + (ysrc*xsize));
31833191         src_offs *= 4;
r20839r20840
42834291
42844292   // prepare linescroll flags
42854293   linescroll_enable = stv2_current_tilemap.linescroll_enable;
4286   stv2_current_tilemap.linescroll_enable = 0;
4294//   stv2_current_tilemap.linescroll_enable = 0;
42874295   vertical_linescroll_enable = stv2_current_tilemap.vertical_linescroll_enable;
4288   stv2_current_tilemap.vertical_linescroll_enable = 0;
4296//   stv2_current_tilemap.vertical_linescroll_enable = 0;
42894297   linezoom_enable = stv2_current_tilemap.linezoom_enable;
4290   stv2_current_tilemap.linezoom_enable = 0;
4298//   stv2_current_tilemap.linezoom_enable = 0;
42914299
42924300   // prepare working clipping rectangle
42934301   memcpy( &mycliprect, &cliprect, sizeof(rectangle) );
r20839r20840
43844392
43854393//      if ( LOG_VDP2 ) logerror( "Linescroll: y < %d, %d >, scrollx = %d, scrolly = %d, incx = %f\n", mycliprect.min_y, mycliprect.max_y, stv2_current_tilemap.scrollx, stv2_current_tilemap.scrolly, (float)stv2_current_tilemap.incx/65536.0 );
43864394      // render current tilemap portion
4387      stv_vdp2_apply_window_on_layer(mycliprect);
4388
43894395      if (stv2_current_tilemap.bitmap_enable) // this layer is a bitmap
43904396      {
4391         /*elandore doesn't like current cliprect code,will be worked on...*/
4392         //if ( window_applied && stv2_current_tilemap.colour_depth != 4)
4393         //  stv2_current_tilemap.window_control = 0;
4394
43954397         stv_vdp2_draw_basic_bitmap(bitmap, mycliprect);
43964398      }
43974399      else
43984400      {
4401         stv_vdp2_apply_window_on_layer(mycliprect);
43994402         stv_vdp2_draw_basic_tilemap(bitmap, mycliprect);
44004403      }
44014404
r20839r20840
44844487      return;
44854488   }
44864489
4487//  window_applied =
4488   stv_vdp2_apply_window_on_layer(mycliprect);
44894490
44904491   if (stv2_current_tilemap.bitmap_enable) // this layer is a bitmap
44914492   {
r20839r20840
44974498   }
44984499   else
44994500   {
4501      stv_vdp2_apply_window_on_layer(mycliprect);
45004502      stv_vdp2_draw_basic_tilemap(bitmap, mycliprect);
45014503   }
45024504

Previous 199869 Revisions Next


© 1997-2024 The MAME Team