trunk/src/mame/video/stvvdp2.c
| r20839 | r20840 | |
| 3001 | 3001 | |
| 3002 | 3002 | void saturn_state::draw_4bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 3003 | 3003 | { |
| 3004 | | int xsize, ysize; |
| 3004 | int xsize, ysize, xsize_mask; |
| 3005 | 3005 | int xsrc,ysrc,xdst,ydst; |
| 3006 | 3006 | int src_offs; |
| 3007 | 3007 | UINT8* vram = m_vdp2.gfx_decode; |
| r20839 | r20840 | |
| 3015 | 3015 | xsize = (stv2_current_tilemap.bitmap_size & 2) ? 1024 : 512; |
| 3016 | 3016 | ysize = (stv2_current_tilemap.bitmap_size & 1) ? 512 : 256; |
| 3017 | 3017 | |
| 3018 | xsize_mask = (stv2_current_tilemap.linescroll_enable) ? 1024 : xsize; |
| 3019 | |
| 3018 | 3020 | pal_bank = stv2_current_tilemap.bitmap_palette_number; |
| 3019 | 3021 | pal_bank+= stv2_current_tilemap.colour_ram_address_offset; |
| 3020 | 3022 | pal_bank&= 7; |
| r20839 | r20840 | |
| 3029 | 3031 | if(stv_vdp2_window_process(xdst,ydst)) |
| 3030 | 3032 | continue; |
| 3031 | 3033 | |
| 3032 | | xsrc = (xdst + scrollx) & (xsize-1); |
| 3034 | xsrc = (xdst + scrollx) & (xsize_mask-1); |
| 3033 | 3035 | ysrc = (ydst + scrolly) & (ysize-1); |
| 3034 | 3036 | src_offs = (xsrc + (ysrc*xsize)); |
| 3035 | 3037 | src_offs/= 2; |
| r20839 | r20840 | |
| 3055 | 3057 | |
| 3056 | 3058 | void saturn_state::draw_8bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 3057 | 3059 | { |
| 3058 | | int xsize, ysize; |
| 3060 | int xsize, ysize, xsize_mask; |
| 3059 | 3061 | int xsrc,ysrc,xdst,ydst; |
| 3060 | 3062 | int src_offs; |
| 3061 | 3063 | UINT8* vram = m_vdp2.gfx_decode; |
| r20839 | r20840 | |
| 3069 | 3071 | xsize = (stv2_current_tilemap.bitmap_size & 2) ? 1024 : 512; |
| 3070 | 3072 | ysize = (stv2_current_tilemap.bitmap_size & 1) ? 512 : 256; |
| 3071 | 3073 | |
| 3074 | xsize_mask = (stv2_current_tilemap.linescroll_enable) ? 1024 : xsize; |
| 3075 | |
| 3072 | 3076 | pal_bank = stv2_current_tilemap.bitmap_palette_number; |
| 3073 | 3077 | pal_bank+= stv2_current_tilemap.colour_ram_address_offset; |
| 3074 | 3078 | pal_bank&= 7; |
| r20839 | r20840 | |
| 3083 | 3087 | if(stv_vdp2_window_process(xdst,ydst)) |
| 3084 | 3088 | continue; |
| 3085 | 3089 | |
| 3086 | | xsrc = (xdst + scrollx) & (xsize-1); |
| 3090 | xsrc = (xdst + scrollx) & (xsize_mask-1); |
| 3087 | 3091 | ysrc = (ydst + scrolly) & (ysize-1); |
| 3088 | 3092 | src_offs = (xsrc + (ysrc*xsize)); |
| 3089 | 3093 | src_offs += map_offset; |
| r20839 | r20840 | |
| 3106 | 3110 | |
| 3107 | 3111 | void saturn_state::draw_rgb15_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 3108 | 3112 | { |
| 3109 | | int xsize, ysize; |
| 3113 | int xsize, ysize, xsize_mask; |
| 3110 | 3114 | int xsrc,ysrc,xdst,ydst; |
| 3111 | 3115 | int src_offs; |
| 3112 | 3116 | UINT8* vram = m_vdp2.gfx_decode; |
| r20839 | r20840 | |
| 3120 | 3124 | xsize = (stv2_current_tilemap.bitmap_size & 2) ? 1024 : 512; |
| 3121 | 3125 | ysize = (stv2_current_tilemap.bitmap_size & 1) ? 512 : 256; |
| 3122 | 3126 | |
| 3127 | xsize_mask = (stv2_current_tilemap.linescroll_enable) ? 1024 : xsize; |
| 3128 | |
| 3123 | 3129 | for(ydst=cliprect.min_y;ydst<=cliprect.max_y;ydst++) |
| 3124 | 3130 | { |
| 3125 | 3131 | for(xdst=cliprect.min_x;xdst<=cliprect.max_x;xdst++) |
| r20839 | r20840 | |
| 3127 | 3133 | if(stv_vdp2_window_process(xdst,ydst)) |
| 3128 | 3134 | continue; |
| 3129 | 3135 | |
| 3130 | | xsrc = (xdst + scrollx) & (xsize-1); |
| 3136 | xsrc = (xdst + scrollx) & (xsize_mask-1); |
| 3131 | 3137 | ysrc = (ydst + scrolly) & (ysize-1); |
| 3132 | 3138 | src_offs = (xsrc + (ysrc*xsize)); |
| 3133 | 3139 | src_offs *= 2; |
| r20839 | r20840 | |
| 3156 | 3162 | |
| 3157 | 3163 | void saturn_state::draw_rgb32_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 3158 | 3164 | { |
| 3159 | | int xsize, ysize; |
| 3165 | int xsize, ysize, xsize_mask; |
| 3160 | 3166 | int xsrc,ysrc,xdst,ydst; |
| 3161 | 3167 | int src_offs; |
| 3162 | 3168 | UINT8* vram = m_vdp2.gfx_decode; |
| r20839 | r20840 | |
| 3170 | 3176 | xsize = (stv2_current_tilemap.bitmap_size & 2) ? 1024 : 512; |
| 3171 | 3177 | ysize = (stv2_current_tilemap.bitmap_size & 1) ? 512 : 256; |
| 3172 | 3178 | |
| 3179 | xsize_mask = (stv2_current_tilemap.linescroll_enable) ? 1024 : xsize; |
| 3180 | |
| 3173 | 3181 | for(ydst=cliprect.min_y;ydst<=cliprect.max_y;ydst++) |
| 3174 | 3182 | { |
| 3175 | 3183 | for(xdst=cliprect.min_x;xdst<=cliprect.max_x;xdst++) |
| r20839 | r20840 | |
| 3177 | 3185 | if(stv_vdp2_window_process(xdst,ydst)) |
| 3178 | 3186 | continue; |
| 3179 | 3187 | |
| 3180 | | xsrc = (xdst + scrollx) & (xsize-1); |
| 3188 | xsrc = (xdst + scrollx) & (xsize_mask-1); |
| 3181 | 3189 | ysrc = (ydst + scrolly) & (ysize-1); |
| 3182 | 3190 | src_offs = (xsrc + (ysrc*xsize)); |
| 3183 | 3191 | src_offs *= 4; |
| r20839 | r20840 | |
| 4283 | 4291 | |
| 4284 | 4292 | // prepare linescroll flags |
| 4285 | 4293 | linescroll_enable = stv2_current_tilemap.linescroll_enable; |
| 4286 | | stv2_current_tilemap.linescroll_enable = 0; |
| 4294 | // stv2_current_tilemap.linescroll_enable = 0; |
| 4287 | 4295 | 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; |
| 4289 | 4297 | linezoom_enable = stv2_current_tilemap.linezoom_enable; |
| 4290 | | stv2_current_tilemap.linezoom_enable = 0; |
| 4298 | // stv2_current_tilemap.linezoom_enable = 0; |
| 4291 | 4299 | |
| 4292 | 4300 | // prepare working clipping rectangle |
| 4293 | 4301 | memcpy( &mycliprect, &cliprect, sizeof(rectangle) ); |
| r20839 | r20840 | |
| 4384 | 4392 | |
| 4385 | 4393 | // 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 ); |
| 4386 | 4394 | // render current tilemap portion |
| 4387 | | stv_vdp2_apply_window_on_layer(mycliprect); |
| 4388 | | |
| 4389 | 4395 | if (stv2_current_tilemap.bitmap_enable) // this layer is a bitmap |
| 4390 | 4396 | { |
| 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 | | |
| 4395 | 4397 | stv_vdp2_draw_basic_bitmap(bitmap, mycliprect); |
| 4396 | 4398 | } |
| 4397 | 4399 | else |
| 4398 | 4400 | { |
| 4401 | stv_vdp2_apply_window_on_layer(mycliprect); |
| 4399 | 4402 | stv_vdp2_draw_basic_tilemap(bitmap, mycliprect); |
| 4400 | 4403 | } |
| 4401 | 4404 | |
| r20839 | r20840 | |
| 4484 | 4487 | return; |
| 4485 | 4488 | } |
| 4486 | 4489 | |
| 4487 | | // window_applied = |
| 4488 | | stv_vdp2_apply_window_on_layer(mycliprect); |
| 4489 | 4490 | |
| 4490 | 4491 | if (stv2_current_tilemap.bitmap_enable) // this layer is a bitmap |
| 4491 | 4492 | { |
| r20839 | r20840 | |
| 4497 | 4498 | } |
| 4498 | 4499 | else |
| 4499 | 4500 | { |
| 4501 | stv_vdp2_apply_window_on_layer(mycliprect); |
| 4500 | 4502 | stv_vdp2_draw_basic_tilemap(bitmap, mycliprect); |
| 4501 | 4503 | } |
| 4502 | 4504 | |