src/mess/drivers/x1.c
| r5592 | r5593 | |
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | /* |
| 261 | * Priority Mixer Calculation (PLY) |
| 262 | * |
| 263 | * If ply is 0xff then the bitmap entirely covers the tilemap, if it's 0x00 then |
| 264 | * the tilemap priority is entirely above the bitmap. Any other value mixes the |
| 265 | * bitmap and the tilemap priorities based on the pen value, bit 0 = entry 0 <-> bit 7 = entry 7 |
| 266 | * of the bitmap. |
| 267 | * |
| 268 | */ |
| 269 | static int priority_mixer_ply(running_machine *machine,int color) |
| 270 | { |
| 271 | int pri_i,pri_mask_calc; |
| 272 | |
| 273 | pri_i = 0; |
| 274 | pri_mask_calc = 1; |
| 275 | |
| 276 | while(pri_i < 7) |
| 277 | { |
| 278 | if((color & 7) == pri_i) |
| 279 | break; |
| 280 | |
| 281 | pri_i++; |
| 282 | pri_mask_calc<<=1; |
| 283 | } |
| 284 | |
| 285 | return pri_mask_calc; |
| 286 | } |
| 287 | |
| 260 | 288 | static void draw_gfxbitmap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int w,int plane,int pri) |
| 261 | 289 | { |
| 262 | 290 | int count,xi,yi,x,y; |
| 263 | 291 | int pen_r,pen_g,pen_b,color; |
| 264 | 292 | int yi_size; |
| 265 | | int pri_i,pri_mask_val,pri_helper; |
| 293 | int pri_mask_val; |
| 266 | 294 | |
| 267 | 295 | count = crtc_start_addr; |
| 268 | 296 | |
| r5592 | r5593 | |
| 282 | 310 | |
| 283 | 311 | color = pen_g<<2 | pen_r<<1 | pen_b<<0; |
| 284 | 312 | |
| 285 | | /* Priority mixer calculation (PLY) */ |
| 286 | | { |
| 287 | | pri_i = 0; |
| 288 | | pri_mask_val = 1; |
| 289 | | pri_helper = 0; |
| 290 | | |
| 291 | | while(pri_i < 7 && pri_helper == 0) |
| 292 | | { |
| 293 | | if((color & 7) == pri_i) |
| 294 | | pri_helper = 1; |
| 295 | | else |
| 296 | | { |
| 297 | | pri_i++; |
| 298 | | pri_mask_val<<=1; |
| 299 | | } |
| 300 | | } |
| 301 | | } |
| 302 | | |
| 313 | pri_mask_val = priority_mixer_ply(machine,color); |
| 303 | 314 | if(pri_mask_val & pri) continue; |
| 304 | 315 | |
| 305 | | if(color == 0) |
| 306 | | continue; |
| 307 | | |
| 308 | 316 | if(w == 1) |
| 309 | 317 | { |
| 310 | 318 | if(yi & 1) |
| r5592 | r5593 | |
| 332 | 340 | |
| 333 | 341 | w = (video_screen_get_width(screen) < 640) ? 1 : 2; |
| 334 | 342 | |
| 335 | | bitmap_fill(bitmap, cliprect, screen->machine->pens[0x100]); |
| 336 | | |
| 337 | 343 | draw_gfxbitmap(screen->machine,bitmap,cliprect,w,0,scrn_reg.ply); |
| 338 | 344 | draw_fgtilemap(screen->machine,bitmap,cliprect,w); |
| 339 | 345 | draw_gfxbitmap(screen->machine,bitmap,cliprect,w,0,scrn_reg.ply^0xff); |
| 340 | | /* Y's uses the following as a normal buffer without anything reasonable to draw */ |
| 346 | /* Y's uses the following as a normal buffer/work ram without anything reasonable to draw */ |
| 341 | 347 | // draw_gfxbitmap(screen->machine,bitmap,cliprect,w,1); |
| 342 | 348 | |
| 343 | 349 | return 0; |