trunk/src/mame/video/tecmo_spr.c
| r30718 | r30719 | |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | |
| 301 | | /* sprite format (wc90.c): |
| 301 | /* sprite format (wc90.c): - similar to the 16-bit one |
| 302 | 302 | * |
| 303 | 303 | * byte bit usage |
| 304 | 304 | * --------+-76543210-+---------------- |
| 305 | | 0 | xxxxx--- | bank / upper tile bits |
| 305 | |
| 306 | 306 | |
| 307 | 307 | |
| 308 | 308 | */ |
| 309 | 309 | |
| 310 | 310 | |
| 311 | | #define WC90_DRAW_SPRITE( code, sx, sy ) \ |
| 312 | | gfxdecode->gfx(3)->transpen(bitmap,cliprect, code, flags >> 4, \ |
| 313 | | bank&1, bank&2, sx, sy, 0 ) |
| 314 | | |
| 315 | | static const char p32x32[4][4] = { |
| 316 | | { 0, 1, 2, 3 }, |
| 317 | | { 1, 0, 3, 2 }, |
| 318 | | { 2, 3, 0, 1 }, |
| 319 | | { 3, 2, 1, 0 } |
| 320 | | }; |
| 321 | | |
| 322 | | static const char p32x64[4][8] = { |
| 323 | | { 0, 1, 2, 3, 4, 5, 6, 7 }, |
| 324 | | { 5, 4, 7, 6, 1, 0, 3, 2 }, |
| 325 | | { 2, 3, 0, 1, 6, 7, 4, 5 }, |
| 326 | | { 7, 6, 5, 4, 3, 2, 1, 0 } |
| 327 | | }; |
| 328 | | |
| 329 | | static const char p64x32[4][8] = { |
| 330 | | { 0, 1, 2, 3, 4, 5, 6, 7 }, |
| 331 | | { 1, 0, 3, 2, 5, 4, 7, 6 }, |
| 332 | | { 6, 7, 4, 5, 2, 3, 0, 1 }, |
| 333 | | { 7, 6, 5, 4, 3, 2, 1, 0 } |
| 334 | | }; |
| 335 | | |
| 336 | | static const char p64x64[4][16] = { |
| 337 | | { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, |
| 338 | | { 5, 4, 7, 6, 1, 0, 3, 2, 13, 12, 15, 14, 9, 8, 11, 10 }, |
| 339 | | { 10, 11, 8, 9, 14, 15, 12, 13, 2, 3, 0, 1, 6, 7, 4, 5 }, |
| 340 | | { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 } |
| 341 | | }; |
| 342 | | |
| 343 | | void tecmo_spr_device::draw_wc90_sprite_16x16(bitmap_ind16 &bitmap, const rectangle &cliprect, gfxdecode_device *gfxdecode, int code,int sx, int sy, int bank, int flags ) |
| 344 | | { |
| 345 | | WC90_DRAW_SPRITE( code, sx, sy ); |
| 346 | | } |
| 347 | | |
| 348 | | void tecmo_spr_device::draw_wc90_sprite_16x32(bitmap_ind16 &bitmap, const rectangle &cliprect, gfxdecode_device *gfxdecode, int code,int sx, int sy, int bank, int flags ) |
| 349 | | { |
| 350 | | if ( bank & 2 ) { |
| 351 | | WC90_DRAW_SPRITE( code+1, sx, sy+16 ); |
| 352 | | WC90_DRAW_SPRITE( code, sx, sy ); |
| 353 | | } else { |
| 354 | | WC90_DRAW_SPRITE( code, sx, sy ); |
| 355 | | WC90_DRAW_SPRITE( code+1, sx, sy+16 ); |
| 356 | | } |
| 357 | | } |
| 358 | | |
| 359 | | void tecmo_spr_device::draw_wc90_sprite_16x64(bitmap_ind16 &bitmap, const rectangle &cliprect, gfxdecode_device *gfxdecode, int code,int sx, int sy, int bank, int flags ) |
| 360 | | { |
| 361 | | if ( bank & 2 ) { |
| 362 | | WC90_DRAW_SPRITE( code+3, sx, sy+48 ); |
| 363 | | WC90_DRAW_SPRITE( code+2, sx, sy+32 ); |
| 364 | | WC90_DRAW_SPRITE( code+1, sx, sy+16 ); |
| 365 | | WC90_DRAW_SPRITE( code, sx, sy ); |
| 366 | | } else { |
| 367 | | WC90_DRAW_SPRITE( code, sx, sy ); |
| 368 | | WC90_DRAW_SPRITE( code+1, sx, sy+16 ); |
| 369 | | WC90_DRAW_SPRITE( code+2, sx, sy+32 ); |
| 370 | | WC90_DRAW_SPRITE( code+3, sx, sy+48 ); |
| 371 | | } |
| 372 | | } |
| 373 | | |
| 374 | | void tecmo_spr_device::draw_wc90_sprite_32x16(bitmap_ind16 &bitmap, const rectangle &cliprect, gfxdecode_device *gfxdecode, int code,int sx, int sy, int bank, int flags ) |
| 375 | | { |
| 376 | | if ( bank & 1 ) { |
| 377 | | WC90_DRAW_SPRITE( code+1, sx+16, sy ); |
| 378 | | WC90_DRAW_SPRITE( code, sx, sy ); |
| 379 | | } else { |
| 380 | | WC90_DRAW_SPRITE( code, sx, sy ); |
| 381 | | WC90_DRAW_SPRITE( code+1, sx+16, sy ); |
| 382 | | } |
| 383 | | } |
| 384 | | |
| 385 | | void tecmo_spr_device::draw_wc90_sprite_32x32(bitmap_ind16 &bitmap, const rectangle &cliprect, gfxdecode_device *gfxdecode, int code,int sx, int sy, int bank, int flags ) |
| 386 | | { |
| 387 | | const char *p = p32x32[ bank&3 ]; |
| 388 | | |
| 389 | | WC90_DRAW_SPRITE( code+p[0], sx, sy ); |
| 390 | | WC90_DRAW_SPRITE( code+p[1], sx+16, sy ); |
| 391 | | WC90_DRAW_SPRITE( code+p[2], sx, sy+16 ); |
| 392 | | WC90_DRAW_SPRITE( code+p[3], sx+16, sy+16 ); |
| 393 | | } |
| 394 | | |
| 395 | | void tecmo_spr_device::draw_wc90_sprite_32x64(bitmap_ind16 &bitmap, const rectangle &cliprect, gfxdecode_device *gfxdecode, int code, int sx, int sy, int bank, int flags ) |
| 396 | | { |
| 397 | | const char *p = p32x64[ bank&3 ]; |
| 398 | | |
| 399 | | WC90_DRAW_SPRITE( code+p[0], sx, sy ); |
| 400 | | WC90_DRAW_SPRITE( code+p[1], sx+16, sy ); |
| 401 | | WC90_DRAW_SPRITE( code+p[2], sx, sy+16 ); |
| 402 | | WC90_DRAW_SPRITE( code+p[3], sx+16, sy+16 ); |
| 403 | | WC90_DRAW_SPRITE( code+p[4], sx, sy+32 ); |
| 404 | | WC90_DRAW_SPRITE( code+p[5], sx+16, sy+32 ); |
| 405 | | WC90_DRAW_SPRITE( code+p[6], sx, sy+48 ); |
| 406 | | WC90_DRAW_SPRITE( code+p[7], sx+16, sy+48 ); |
| 407 | | } |
| 408 | | |
| 409 | | void tecmo_spr_device::draw_wc90_sprite_64x16(bitmap_ind16 &bitmap, const rectangle &cliprect, gfxdecode_device *gfxdecode, int code,int sx, int sy, int bank, int flags ) |
| 410 | | { |
| 411 | | if ( bank & 1 ) { |
| 412 | | WC90_DRAW_SPRITE( code+3, sx+48, sy ); |
| 413 | | WC90_DRAW_SPRITE( code+2, sx+32, sy ); |
| 414 | | WC90_DRAW_SPRITE( code+1, sx+16, sy ); |
| 415 | | WC90_DRAW_SPRITE( code, sx, sy ); |
| 416 | | } else { |
| 417 | | WC90_DRAW_SPRITE( code, sx, sy ); |
| 418 | | WC90_DRAW_SPRITE( code+1, sx+16, sy ); |
| 419 | | WC90_DRAW_SPRITE( code+2, sx+32, sy ); |
| 420 | | WC90_DRAW_SPRITE( code+3, sx+48, sy ); |
| 421 | | } |
| 422 | | } |
| 423 | | |
| 424 | | void tecmo_spr_device::draw_wc90_sprite_64x32(bitmap_ind16 &bitmap, const rectangle &cliprect, gfxdecode_device *gfxdecode, int code,int sx, int sy, int bank, int flags ) |
| 425 | | { |
| 426 | | const char *p = p64x32[ bank&3 ]; |
| 427 | | |
| 428 | | WC90_DRAW_SPRITE( code+p[0], sx, sy ); |
| 429 | | WC90_DRAW_SPRITE( code+p[1], sx+16, sy ); |
| 430 | | WC90_DRAW_SPRITE( code+p[2], sx, sy+16 ); |
| 431 | | WC90_DRAW_SPRITE( code+p[3], sx+16, sy+16 ); |
| 432 | | WC90_DRAW_SPRITE( code+p[4], sx+32, sy ); |
| 433 | | WC90_DRAW_SPRITE( code+p[5], sx+48, sy ); |
| 434 | | WC90_DRAW_SPRITE( code+p[6], sx+32, sy+16 ); |
| 435 | | WC90_DRAW_SPRITE( code+p[7], sx+48, sy+16 ); |
| 436 | | } |
| 437 | | |
| 438 | | void tecmo_spr_device::draw_wc90_sprite_64x64(bitmap_ind16 &bitmap, const rectangle &cliprect, gfxdecode_device *gfxdecode, int code,int sx, int sy, int bank, int flags ) |
| 439 | | { |
| 440 | | const char *p = p64x64[ bank&3 ]; |
| 441 | | |
| 442 | | WC90_DRAW_SPRITE( code+p[0], sx, sy ); |
| 443 | | WC90_DRAW_SPRITE( code+p[1], sx+16, sy ); |
| 444 | | WC90_DRAW_SPRITE( code+p[2], sx, sy+16 ); |
| 445 | | WC90_DRAW_SPRITE( code+p[3], sx+16, sy+16 ); |
| 446 | | WC90_DRAW_SPRITE( code+p[4], sx+32, sy ); |
| 447 | | WC90_DRAW_SPRITE( code+p[5], sx+48, sy ); |
| 448 | | WC90_DRAW_SPRITE( code+p[6], sx+32, sy+16 ); |
| 449 | | WC90_DRAW_SPRITE( code+p[7], sx+48, sy+16 ); |
| 450 | | |
| 451 | | WC90_DRAW_SPRITE( code+p[8], sx, sy+32 ); |
| 452 | | WC90_DRAW_SPRITE( code+p[9], sx+16, sy+32 ); |
| 453 | | WC90_DRAW_SPRITE( code+p[10], sx, sy+48 ); |
| 454 | | WC90_DRAW_SPRITE( code+p[11], sx+16, sy+48 ); |
| 455 | | WC90_DRAW_SPRITE( code+p[12], sx+32, sy+32 ); |
| 456 | | WC90_DRAW_SPRITE( code+p[13], sx+48, sy+32 ); |
| 457 | | WC90_DRAW_SPRITE( code+p[14], sx+32, sy+48 ); |
| 458 | | WC90_DRAW_SPRITE( code+p[15], sx+48, sy+48 ); |
| 459 | | } |
| 460 | | |
| 461 | | void tecmo_spr_device::draw_wc90_sprite_invalid(bitmap_ind16 &bitmap, const rectangle &cliprect, gfxdecode_device *gfxdecode, int code, int sx, int sy, int bank, int flags ) |
| 462 | | { |
| 463 | | logerror("8 pixel sprite size not supported\n" ); |
| 464 | | } |
| 465 | | |
| 466 | | static const tecmo_spr_device::draw_wc90_sprites_func draw_wc90_sprites_proc[16] = { |
| 467 | | &tecmo_spr_device::draw_wc90_sprite_invalid, /* 0000 = 08x08 */ |
| 468 | | &tecmo_spr_device::draw_wc90_sprite_invalid, /* 0001 = 16x08 */ |
| 469 | | &tecmo_spr_device::draw_wc90_sprite_invalid, /* 0010 = 32x08 */ |
| 470 | | &tecmo_spr_device::draw_wc90_sprite_invalid, /* 0011 = 64x08 */ |
| 471 | | &tecmo_spr_device::draw_wc90_sprite_invalid, /* 0100 = 08x16 */ |
| 472 | | &tecmo_spr_device::draw_wc90_sprite_16x16, /* 0101 = 16x16 */ |
| 473 | | &tecmo_spr_device::draw_wc90_sprite_32x16, /* 0110 = 32x16 */ |
| 474 | | &tecmo_spr_device::draw_wc90_sprite_64x16, /* 0111 = 64x16 */ |
| 475 | | &tecmo_spr_device::draw_wc90_sprite_invalid, /* 1000 = 08x32 */ |
| 476 | | &tecmo_spr_device::draw_wc90_sprite_16x32, /* 1001 = 16x32 */ |
| 477 | | &tecmo_spr_device::draw_wc90_sprite_32x32, /* 1010 = 32x32 */ |
| 478 | | &tecmo_spr_device::draw_wc90_sprite_64x32, /* 1011 = 64x32 */ |
| 479 | | &tecmo_spr_device::draw_wc90_sprite_invalid, /* 1100 = 08x64 */ |
| 480 | | &tecmo_spr_device::draw_wc90_sprite_16x64, /* 1101 = 16x64 */ |
| 481 | | &tecmo_spr_device::draw_wc90_sprite_32x64, /* 1110 = 32x64 */ |
| 482 | | &tecmo_spr_device::draw_wc90_sprite_64x64 /* 1111 = 64x64 */ |
| 483 | | }; |
| 484 | | |
| 485 | 311 | void tecmo_spr_device::draw_wc90_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfxdecode_device *gfxdecode, UINT8* spriteram, int size, int priority ) |
| 486 | 312 | { |
| 487 | | int offs, sx,sy, flags, which; |
| 313 | int offs, flags, code; |
| 488 | 314 | |
| 489 | 315 | /* draw all visible sprites of specified priority */ |
| 490 | 316 | for (offs = 0;offs < size;offs += 16){ |
| r30718 | r30719 | |
| 492 | 318 | |
| 493 | 319 | if ( ( bank >> 4 ) == priority ) { |
| 494 | 320 | if ( bank & 4 ) { /* visible */ |
| 495 | | which = ( spriteram[offs+2] >> 2 ) + ( spriteram[offs+3] << 6 ); |
| 321 | code = ( spriteram[offs+2] ) + ( spriteram[offs+3] << 8 ); |
| 496 | 322 | |
| 497 | | sx = spriteram[offs + 8] + ( (spriteram[offs + 9] & 3 ) << 8 ); |
| 498 | | sy = spriteram[offs + 6] + ( (spriteram[offs + 7] & 1 ) << 8 ); |
| 323 | int xpos = spriteram[offs + 8] + ( (spriteram[offs + 9] & 3 ) << 8 ); |
| 324 | int ypos = spriteram[offs + 6] + ( (spriteram[offs + 7] & 1 ) << 8 ); |
| 499 | 325 | |
| 500 | | if (sx >= 0x0300) sx -= 0x0400; |
| 326 | if (xpos >= 0x0300) xpos -= 0x0400; |
| 501 | 327 | |
| 502 | 328 | flags = spriteram[offs+4]; |
| 503 | | (this->*( draw_wc90_sprites_proc[ flags & 0x0f ] ) )(bitmap,cliprect, gfxdecode, which, sx, sy, bank, flags ); |
| 329 | |
| 330 | int sizex = 1 << ((flags >> 0) & 3); |
| 331 | int sizey = 1 << ((flags >> 2) & 3); |
| 332 | |
| 333 | |
| 334 | int flipx = bank & 1; |
| 335 | int flipy = bank & 2; |
| 336 | |
| 337 | for (int y = 0;y < sizey;y++) |
| 338 | { |
| 339 | for (int x = 0;x < sizex;x++) |
| 340 | { |
| 341 | int sx = xpos + 8*(flipx?(sizex-1-x):x); |
| 342 | int sy = ypos + 8*(flipy?(sizey-1-y):y); |
| 343 | gfxdecode->gfx(3)->transpen(bitmap,cliprect, |
| 344 | code + layout[y][x], |
| 345 | (flags>>4) & 0xf, |
| 346 | flipx,flipy, |
| 347 | sx,sy, |
| 348 | 0); |
| 349 | } |
| 350 | } |
| 351 | |
| 352 | |
| 504 | 353 | } |
| 505 | 354 | } |
| 506 | 355 | } |
| r30718 | r30719 | |
| 513 | 362 | void tecmo_spr_device::tbowl_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, gfxdecode_device *gfxdecode, int xscroll, UINT8* spriteram) |
| 514 | 363 | { |
| 515 | 364 | int offs; |
| 516 | | static const UINT8 layout[8][8] = |
| 517 | | { |
| 518 | | {0,1,4,5,16,17,20,21}, |
| 519 | | {2,3,6,7,18,19,22,23}, |
| 520 | | {8,9,12,13,24,25,28,29}, |
| 521 | | {10,11,14,15,26,27,30,31}, |
| 522 | | {32,33,36,37,48,49,52,53}, |
| 523 | | {34,35,38,39,50,51,54,55}, |
| 524 | | {40,41,44,45,56,57,60,61}, |
| 525 | | {42,43,46,47,58,59,62,63} |
| 526 | | }; |
| 527 | 365 | |
| 528 | 366 | for (offs = 0;offs < 0x800;offs += 8) |
| 529 | 367 | { |