trunk/src/mame/video/deco_mlc.c
| r21882 | r21883 | |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | |
| 161 | | void deco_mlc_state::draw_sprites( bitmap_rgb32 &bitmap,const rectangle &cliprect) |
| 161 | void deco_mlc_state::draw_sprites( bitmap_rgb32 &bitmap,const rectangle &cliprect, int scanline) |
| 162 | 162 | { |
| 163 | 163 | UINT32 *index_ptr=0; |
| 164 | 164 | int offs,fx=0,fy=0,x,y,color,colorOffset,sprite,indx,h,w,bx,by,fx1,fy1; |
| r21882 | r21883 | |
| 368 | 368 | if (!ratio) |
| 369 | 369 | continue; |
| 370 | 370 | |
| 371 | | for (int bby=0; bby<full_sprite_screen_height>>16; bby++) |
| 372 | | { |
| 373 | | int srcline = ((bby<<16) / ratio); |
| 371 | int bby = scanline - (full_realybase>>16); |
| 372 | |
| 373 | if (bby < 0) |
| 374 | continue; |
| 375 | |
| 376 | if (bby >= full_sprite_screen_height>>16) |
| 377 | continue; |
| 378 | |
| 379 | |
| 380 | |
| 381 | |
| 382 | int srcline = ((bby<<16) / ratio); |
| 374 | 383 | |
| 375 | | by = srcline >> 4; |
| 384 | by = srcline >> 4; |
| 376 | 385 | |
| 377 | | int y = (full_realybase>>16)+bby; |
| 386 | int y = (full_realybase>>16)+bby; |
| 378 | 387 | |
| 379 | | rectangle myclip; |
| 380 | | myclip = user_clip; |
| 381 | | myclip &= bitmap.cliprect(); |
| 388 | rectangle myclip; |
| 389 | myclip = user_clip; |
| 390 | myclip &= bitmap.cliprect(); |
| 382 | 391 | |
| 383 | | if( y < myclip.min_y ) |
| 384 | | continue; |
| 392 | if( y < myclip.min_y ) |
| 393 | continue; |
| 385 | 394 | |
| 386 | | if( y > myclip.max_y+1 ) |
| 387 | | continue; |
| 395 | if( y > myclip.max_y+1 ) |
| 396 | continue; |
| 388 | 397 | |
| 389 | | UINT32 *dest = &bitmap.pix32(y); |
| 398 | UINT32 *dest = &bitmap.pix32(y); |
| 390 | 399 | |
| 391 | | srcline &=0xf; |
| 392 | | if( fy ) |
| 400 | srcline &=0xf; |
| 401 | if( fy ) |
| 402 | { |
| 403 | srcline = 15 - srcline; |
| 404 | } |
| 405 | |
| 406 | |
| 407 | for (bx=0; bx<w; bx++) { |
| 408 | |
| 409 | int realxbase = xbase + bx * xinc; |
| 410 | int count = 0; |
| 411 | if (fx) |
| 393 | 412 | { |
| 394 | | srcline = 15 - srcline; |
| 413 | if (fy) |
| 414 | count = (h-1-by) * w + (w-1-bx); |
| 415 | else |
| 416 | count = by * w + (w-1-bx); |
| 395 | 417 | } |
| 418 | else |
| 419 | { |
| 420 | if (fy) |
| 421 | count = (h-1-by) * w + bx; |
| 422 | else |
| 423 | count = by * w + bx; |
| 424 | } |
| 396 | 425 | |
| 426 | int tile=sprite + count; |
| 427 | int tile2=sprite2 + count; |
| 397 | 428 | |
| 398 | | for (bx=0; bx<w; bx++) { |
| 399 | | |
| 400 | | int realxbase = xbase + bx * xinc; |
| 401 | | int count = 0; |
| 402 | | if (fx) |
| 429 | if (blockIsTilemapIndex) { |
| 430 | if (useIndicesInRom) |
| 403 | 431 | { |
| 404 | | if (fy) |
| 405 | | count = (h-1-by) * w + (w-1-bx); |
| 432 | const UINT8* ptr=rawrom+(tile*2); |
| 433 | tile=(*ptr) + ((*(ptr+1))<<8); |
| 434 | |
| 435 | if (use8bppMode) { |
| 436 | const UINT8* ptr2=rawrom+(tile2*2); |
| 437 | tile2=(*ptr2) + ((*(ptr2+1))<<8); |
| 438 | } |
| 406 | 439 | else |
| 407 | | count = by * w + (w-1-bx); |
| 440 | { |
| 441 | tile2=0; |
| 442 | } |
| 443 | |
| 444 | if (tileFormat) |
| 445 | { |
| 446 | colorOffset=(tile&0xf000)>>12; |
| 447 | tile=(tile&0x0fff)|hibits; |
| 448 | tile2=(tile2&0x0fff)|hibits; |
| 449 | } |
| 450 | else |
| 451 | { |
| 452 | colorOffset=0; |
| 453 | tile=(tile&0xffff)|(hibits<<2); |
| 454 | tile2=(tile2&0xffff)|(hibits<<2); |
| 455 | } |
| 408 | 456 | } |
| 409 | 457 | else |
| 410 | 458 | { |
| 411 | | if (fy) |
| 412 | | count = (h-1-by) * w + bx; |
| 413 | | else |
| 414 | | count = by * w + bx; |
| 415 | | } |
| 459 | const UINT32* ptr=m_mlc_vram + ((tile)&0x7fff); |
| 460 | tile=(*ptr)&0xffff; |
| 416 | 461 | |
| 417 | | int tile=sprite + count; |
| 418 | | int tile2=sprite2 + count; |
| 419 | | |
| 420 | | if (blockIsTilemapIndex) { |
| 421 | | if (useIndicesInRom) |
| 462 | if (tileFormat) |
| 422 | 463 | { |
| 423 | | const UINT8* ptr=rawrom+(tile*2); |
| 424 | | tile=(*ptr) + ((*(ptr+1))<<8); |
| 425 | | |
| 426 | | if (use8bppMode) { |
| 427 | | const UINT8* ptr2=rawrom+(tile2*2); |
| 428 | | tile2=(*ptr2) + ((*(ptr2+1))<<8); |
| 429 | | } |
| 430 | | else |
| 431 | | { |
| 432 | | tile2=0; |
| 433 | | } |
| 434 | | |
| 435 | | if (tileFormat) |
| 436 | | { |
| 437 | | colorOffset=(tile&0xf000)>>12; |
| 438 | | tile=(tile&0x0fff)|hibits; |
| 439 | | tile2=(tile2&0x0fff)|hibits; |
| 440 | | } |
| 441 | | else |
| 442 | | { |
| 443 | | colorOffset=0; |
| 444 | | tile=(tile&0xffff)|(hibits<<2); |
| 445 | | tile2=(tile2&0xffff)|(hibits<<2); |
| 446 | | } |
| 464 | colorOffset=(tile&0xf000)>>12; |
| 465 | tile=(tile&0x0fff)|hibits; |
| 447 | 466 | } |
| 448 | 467 | else |
| 449 | 468 | { |
| 450 | | const UINT32* ptr=m_mlc_vram + ((tile)&0x7fff); |
| 451 | | tile=(*ptr)&0xffff; |
| 452 | | |
| 453 | | if (tileFormat) |
| 454 | | { |
| 455 | | colorOffset=(tile&0xf000)>>12; |
| 456 | | tile=(tile&0x0fff)|hibits; |
| 457 | | } |
| 458 | | else |
| 459 | | { |
| 460 | | colorOffset=0; |
| 461 | | tile=(tile&0xffff)|(hibits<<2); |
| 462 | | } |
| 463 | | |
| 464 | | tile2=0; |
| 469 | colorOffset=0; |
| 470 | tile=(tile&0xffff)|(hibits<<2); |
| 465 | 471 | } |
| 466 | | } |
| 467 | 472 | |
| 468 | | |
| 469 | | |
| 470 | | |
| 471 | | mlc_drawgfxzoomline( |
| 472 | | dest,user_clip,machine().gfx[0], |
| 473 | | tile,tile2, |
| 474 | | color + colorOffset,fx,realxbase, |
| 475 | | 0, |
| 476 | | use8bppMode,(xscale<<8),alpha, srcline); |
| 477 | | |
| 473 | tile2=0; |
| 474 | } |
| 478 | 475 | } |
| 479 | 476 | |
| 480 | | |
| 477 | mlc_drawgfxzoomline( |
| 478 | dest,user_clip,machine().gfx[0], |
| 479 | tile,tile2, |
| 480 | color + colorOffset,fx,realxbase, |
| 481 | 0, |
| 482 | use8bppMode,(xscale<<8),alpha, srcline); |
| 481 | 483 | |
| 482 | 484 | } |
| 483 | 485 | |
| 484 | | // if (lastRasterMode!=0 && rasterDirty) |
| 485 | | // { |
| 486 | | // blitRaster(machine, bitmap, rasterMode); |
| 487 | | // temp_bitmap->fill(0, cliprect); |
| 488 | | // rasterDirty=0; |
| 489 | | // } |
| 490 | | // lastRasterMode=rasterMode; |
| 491 | | |
| 492 | 486 | if (use8bppMode) |
| 493 | 487 | offs-=8; |
| 494 | 488 | } |
| r21882 | r21883 | |
| 512 | 506 | { |
| 513 | 507 | // temp_bitmap->fill(0, cliprect); |
| 514 | 508 | bitmap.fill(machine().pens[0], cliprect); /* Pen 0 fill colour confirmed from Skull Fang level 2 */ |
| 515 | | draw_sprites(bitmap,cliprect); |
| 509 | |
| 510 | for (int i=0;i<256;i++) |
| 511 | { |
| 512 | draw_sprites(bitmap,cliprect, i); |
| 513 | } |
| 516 | 514 | return 0; |
| 517 | 515 | } |