trunk/src/mame/drivers/lethal.c
| r30734 | r30735 | |
| 462 | 462 | PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "DSW:4") |
| 463 | 463 | INPUT_PORTS_END |
| 464 | 464 | |
| 465 | | static const gfx_layout lethal_6bpp = |
| 466 | | { |
| 467 | | 16,16, |
| 468 | | RGN_FRAC(1,2), |
| 469 | | 6, |
| 470 | | { RGN_FRAC(1,2)+8,RGN_FRAC(1,2)+0, 8, 0, 24, 16 }, |
| 471 | | { 0, 1, 2, 3, 4, 5, 6, 7, |
| 472 | | 8*32+0, 8*32+1, 8*32+2, 8*32+3, 8*32+4, 8*32+5, 8*32+6, 8*32+7 }, |
| 473 | | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, |
| 474 | | 16*32, 17*32, 18*32, 19*32, 20*32, 21*32, 22*32, 23*32 }, |
| 475 | | 128*8 |
| 476 | | }; |
| 477 | 465 | |
| 478 | | /* we use this decode instead of the one done by the sprite video start due to it being 6bpp */ |
| 479 | | static GFXDECODE_START( lethal ) |
| 480 | | GFXDECODE_ENTRY( "k053244", 0, lethal_6bpp, 0x000/*0x400*/, 256 ) /* sprites tiles */ |
| 481 | | GFXDECODE_END |
| 482 | | |
| 483 | | |
| 484 | 466 | /* sound */ |
| 485 | 467 | |
| 486 | 468 | static const k054539_interface k054539_config = |
| r30734 | r30735 | |
| 511 | 493 | |
| 512 | 494 | static const k056832_interface lethalen_k056832_intf = |
| 513 | 495 | { |
| 514 | | "gfx1", 1, |
| 496 | "gfx1", 0, |
| 515 | 497 | K056832_BPP_8LE, |
| 516 | 498 | 1, 0, |
| 517 | 499 | KONAMI_ROM_DEINTERLEAVE_NONE, |
| r30734 | r30735 | |
| 538 | 520 | |
| 539 | 521 | MCFG_EEPROM_SERIAL_ER5911_8BIT_ADD("eeprom") |
| 540 | 522 | |
| 541 | | MCFG_GFXDECODE_ADD("gfxdecode", "palette", lethal) |
| 523 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty) |
| 542 | 524 | |
| 543 | 525 | /* video hardware */ |
| 544 | 526 | MCFG_SCREEN_ADD("screen", RASTER) |
| r30734 | r30735 | |
| 559 | 541 | |
| 560 | 542 | MCFG_DEVICE_ADD("k053244", K053244, 0) |
| 561 | 543 | MCFG_GFX_PALETTE("palette") |
| 544 | MCFG_K05324X_BPP(6) |
| 562 | 545 | MCFG_K05324X_OFFSETS(95, 0) |
| 563 | 546 | MCFG_K05324X_CB(lethal_state, sprite_callback) |
| 564 | 547 | |
| r30734 | r30735 | |
| 596 | 579 | ROM_LOAD32_WORD( "191a09", 0x200000, 0x100000, CRC(e2028531) SHA1(63ccce7855d829763e9e248a6c3eb6ea89ab17ee) ) |
| 597 | 580 | |
| 598 | 581 | ROM_REGION( 0x400000, "k053244", ROMREGION_ERASE00 ) /* sprites */ |
| 599 | | ROM_LOAD32_WORD( "191a04", 0x000000, 0x100000, CRC(5c3eeb2b) SHA1(33ea8b3968b78806334b5a0aab3a2c24e45c604e) ) |
| 600 | | ROM_LOAD32_WORD( "191a05", 0x000002, 0x100000, CRC(f2e3b58b) SHA1(0bbc2fe87a4fd00b5073a884bcfebcf9c2c402ad) ) |
| 582 | ROM_LOAD32_WORD( "191a05", 0x000000, 0x100000, CRC(f2e3b58b) SHA1(0bbc2fe87a4fd00b5073a884bcfebcf9c2c402ad) ) |
| 583 | ROM_LOAD32_WORD( "191a04", 0x000002, 0x100000, CRC(5c3eeb2b) SHA1(33ea8b3968b78806334b5a0aab3a2c24e45c604e) ) |
| 601 | 584 | ROM_LOAD32_WORD( "191a06", 0x200000, 0x100000, CRC(ee11fc08) SHA1(ec6dd684e8261b181d65b8bf1b9e97da5c4468f7) ) |
| 602 | 585 | |
| 603 | 586 | ROM_REGION( 0x200000, "k054539", 0 ) /* K054539 samples */ |
| r30734 | r30735 | |
| 621 | 604 | ROM_LOAD32_WORD( "191a09", 0x200000, 0x100000, CRC(e2028531) SHA1(63ccce7855d829763e9e248a6c3eb6ea89ab17ee) ) |
| 622 | 605 | |
| 623 | 606 | ROM_REGION( 0x400000, "k053244", ROMREGION_ERASE00 ) /* sprites */ |
| 624 | | ROM_LOAD32_WORD( "191a04", 0x000000, 0x100000, CRC(5c3eeb2b) SHA1(33ea8b3968b78806334b5a0aab3a2c24e45c604e) ) |
| 625 | | ROM_LOAD32_WORD( "191a05", 0x000002, 0x100000, CRC(f2e3b58b) SHA1(0bbc2fe87a4fd00b5073a884bcfebcf9c2c402ad) ) |
| 607 | ROM_LOAD32_WORD( "191a05", 0x000000, 0x100000, CRC(f2e3b58b) SHA1(0bbc2fe87a4fd00b5073a884bcfebcf9c2c402ad) ) |
| 608 | ROM_LOAD32_WORD( "191a04", 0x000002, 0x100000, CRC(5c3eeb2b) SHA1(33ea8b3968b78806334b5a0aab3a2c24e45c604e) ) |
| 626 | 609 | ROM_LOAD32_WORD( "191a06", 0x200000, 0x100000, CRC(ee11fc08) SHA1(ec6dd684e8261b181d65b8bf1b9e97da5c4468f7) ) |
| 627 | 610 | |
| 628 | 611 | ROM_REGION( 0x200000, "k054539", 0 ) /* K054539 samples */ |
| r30734 | r30735 | |
| 646 | 629 | ROM_LOAD32_WORD( "191a09", 0x200000, 0x100000, CRC(e2028531) SHA1(63ccce7855d829763e9e248a6c3eb6ea89ab17ee) ) |
| 647 | 630 | |
| 648 | 631 | ROM_REGION( 0x400000, "k053244", ROMREGION_ERASE00 ) /* sprites */ |
| 649 | | ROM_LOAD32_WORD( "191a04", 0x000000, 0x100000, CRC(5c3eeb2b) SHA1(33ea8b3968b78806334b5a0aab3a2c24e45c604e) ) |
| 650 | | ROM_LOAD32_WORD( "191a05", 0x000002, 0x100000, CRC(f2e3b58b) SHA1(0bbc2fe87a4fd00b5073a884bcfebcf9c2c402ad) ) |
| 632 | ROM_LOAD32_WORD( "191a05", 0x000000, 0x100000, CRC(f2e3b58b) SHA1(0bbc2fe87a4fd00b5073a884bcfebcf9c2c402ad) ) |
| 633 | ROM_LOAD32_WORD( "191a04", 0x000002, 0x100000, CRC(5c3eeb2b) SHA1(33ea8b3968b78806334b5a0aab3a2c24e45c604e) ) |
| 651 | 634 | ROM_LOAD32_WORD( "191a06", 0x200000, 0x100000, CRC(ee11fc08) SHA1(ec6dd684e8261b181d65b8bf1b9e97da5c4468f7) ) |
| 652 | 635 | |
| 653 | 636 | ROM_REGION( 0x200000, "k054539", 0 ) /* K054539 samples */ |
| r30734 | r30735 | |
| 671 | 654 | ROM_LOAD32_WORD( "191a09", 0x200000, 0x100000, CRC(e2028531) SHA1(63ccce7855d829763e9e248a6c3eb6ea89ab17ee) ) |
| 672 | 655 | |
| 673 | 656 | ROM_REGION( 0x400000, "k053244", ROMREGION_ERASE00 ) /* sprites */ |
| 674 | | ROM_LOAD32_WORD( "191a04", 0x000000, 0x100000, CRC(5c3eeb2b) SHA1(33ea8b3968b78806334b5a0aab3a2c24e45c604e) ) |
| 675 | | ROM_LOAD32_WORD( "191a05", 0x000002, 0x100000, CRC(f2e3b58b) SHA1(0bbc2fe87a4fd00b5073a884bcfebcf9c2c402ad) ) |
| 657 | ROM_LOAD32_WORD( "191a05", 0x000000, 0x100000, CRC(f2e3b58b) SHA1(0bbc2fe87a4fd00b5073a884bcfebcf9c2c402ad) ) |
| 658 | ROM_LOAD32_WORD( "191a04", 0x000002, 0x100000, CRC(5c3eeb2b) SHA1(33ea8b3968b78806334b5a0aab3a2c24e45c604e) ) |
| 676 | 659 | ROM_LOAD32_WORD( "191a06", 0x200000, 0x100000, CRC(ee11fc08) SHA1(ec6dd684e8261b181d65b8bf1b9e97da5c4468f7) ) |
| 677 | 660 | |
| 678 | 661 | ROM_REGION( 0x200000, "k054539", 0 ) /* K054539 samples */ |
| r30734 | r30735 | |
| 696 | 679 | ROM_LOAD32_WORD( "191a09", 0x200000, 0x100000, CRC(e2028531) SHA1(63ccce7855d829763e9e248a6c3eb6ea89ab17ee) ) |
| 697 | 680 | |
| 698 | 681 | ROM_REGION( 0x400000, "k053244", ROMREGION_ERASE00 ) /* sprites */ |
| 699 | | ROM_LOAD32_WORD( "191a04", 0x000000, 0x100000, CRC(5c3eeb2b) SHA1(33ea8b3968b78806334b5a0aab3a2c24e45c604e) ) |
| 700 | | ROM_LOAD32_WORD( "191a05", 0x000002, 0x100000, CRC(f2e3b58b) SHA1(0bbc2fe87a4fd00b5073a884bcfebcf9c2c402ad) ) |
| 682 | ROM_LOAD32_WORD( "191a05", 0x000000, 0x100000, CRC(f2e3b58b) SHA1(0bbc2fe87a4fd00b5073a884bcfebcf9c2c402ad) ) |
| 683 | ROM_LOAD32_WORD( "191a04", 0x000002, 0x100000, CRC(5c3eeb2b) SHA1(33ea8b3968b78806334b5a0aab3a2c24e45c604e) ) |
| 701 | 684 | ROM_LOAD32_WORD( "191a06", 0x200000, 0x100000, CRC(ee11fc08) SHA1(ec6dd684e8261b181d65b8bf1b9e97da5c4468f7) ) |
| 702 | 685 | |
| 703 | 686 | ROM_REGION( 0x200000, "k054539", 0 ) /* K054539 samples */ |
| r30734 | r30735 | |
| 721 | 704 | ROM_LOAD32_WORD( "191a09", 0x200000, 0x100000, CRC(e2028531) SHA1(63ccce7855d829763e9e248a6c3eb6ea89ab17ee) ) |
| 722 | 705 | |
| 723 | 706 | ROM_REGION( 0x400000, "k053244", ROMREGION_ERASE00 ) /* sprites */ |
| 724 | | ROM_LOAD32_WORD( "191a04", 0x000000, 0x100000, CRC(5c3eeb2b) SHA1(33ea8b3968b78806334b5a0aab3a2c24e45c604e) ) |
| 725 | | ROM_LOAD32_WORD( "191a05", 0x000002, 0x100000, CRC(f2e3b58b) SHA1(0bbc2fe87a4fd00b5073a884bcfebcf9c2c402ad) ) |
| 707 | ROM_LOAD32_WORD( "191a05", 0x000000, 0x100000, CRC(f2e3b58b) SHA1(0bbc2fe87a4fd00b5073a884bcfebcf9c2c402ad) ) |
| 708 | ROM_LOAD32_WORD( "191a04", 0x000002, 0x100000, CRC(5c3eeb2b) SHA1(33ea8b3968b78806334b5a0aab3a2c24e45c604e) ) |
| 726 | 709 | ROM_LOAD32_WORD( "191a06", 0x200000, 0x100000, CRC(ee11fc08) SHA1(ec6dd684e8261b181d65b8bf1b9e97da5c4468f7) ) |
| 727 | 710 | |
| 728 | 711 | ROM_REGION( 0x200000, "k054539", 0 ) /* K054539 samples */ |
| r30734 | r30735 | |
| 746 | 729 | ROM_LOAD32_WORD( "191a09", 0x200000, 0x100000, CRC(e2028531) SHA1(63ccce7855d829763e9e248a6c3eb6ea89ab17ee) ) |
| 747 | 730 | |
| 748 | 731 | ROM_REGION( 0x400000, "k053244", ROMREGION_ERASE00 ) /* sprites */ |
| 749 | | ROM_LOAD32_WORD( "191a04", 0x000000, 0x100000, CRC(5c3eeb2b) SHA1(33ea8b3968b78806334b5a0aab3a2c24e45c604e) ) |
| 750 | | ROM_LOAD32_WORD( "191a05", 0x000002, 0x100000, CRC(f2e3b58b) SHA1(0bbc2fe87a4fd00b5073a884bcfebcf9c2c402ad) ) |
| 732 | ROM_LOAD32_WORD( "191a05", 0x000000, 0x100000, CRC(f2e3b58b) SHA1(0bbc2fe87a4fd00b5073a884bcfebcf9c2c402ad) ) |
| 733 | ROM_LOAD32_WORD( "191a04", 0x000002, 0x100000, CRC(5c3eeb2b) SHA1(33ea8b3968b78806334b5a0aab3a2c24e45c604e) ) |
| 751 | 734 | ROM_LOAD32_WORD( "191a06", 0x200000, 0x100000, CRC(ee11fc08) SHA1(ec6dd684e8261b181d65b8bf1b9e97da5c4468f7) ) |
| 752 | 735 | |
| 753 | 736 | ROM_REGION( 0x200000, "k054539", 0 ) /* K054539 samples */ |
trunk/src/mame/video/k053244_k053245.c
| r30734 | r30735 | |
| 54 | 54 | 128*8 |
| 55 | 55 | }; |
| 56 | 56 | |
| 57 | // Lethal Enforcers has two k053244s hooked up to one k053245 to give 6bpp... |
| 58 | // for now we just emulate it using an alternate gfx layout |
| 59 | const gfx_layout k05324x_device::spritelayout_6bpp = |
| 60 | { |
| 61 | 16,16, |
| 62 | RGN_FRAC(1,2), |
| 63 | 6, |
| 64 | { RGN_FRAC(1,2)+8,RGN_FRAC(1,2)+0, 24, 16, 8, 0 }, |
| 65 | { 0, 1, 2, 3, 4, 5, 6, 7, |
| 66 | 8*32+0, 8*32+1, 8*32+2, 8*32+3, 8*32+4, 8*32+5, 8*32+6, 8*32+7 }, |
| 67 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, |
| 68 | 16*32, 17*32, 18*32, 19*32, 20*32, 21*32, 22*32, 23*32 }, |
| 69 | 128*8 |
| 70 | }; |
| 57 | 71 | |
| 72 | |
| 58 | 73 | GFXDECODE_MEMBER( k05324x_device::gfxinfo ) |
| 59 | 74 | GFXDECODE_DEVICE(DEVICE_SELF, 0, spritelayout, 0, 1) |
| 60 | 75 | GFXDECODE_END |
| 61 | 76 | |
| 77 | GFXDECODE_MEMBER( k05324x_device::gfxinfo_6bpp ) |
| 78 | GFXDECODE_DEVICE(DEVICE_SELF, 0, spritelayout_6bpp, 0, 1) |
| 79 | GFXDECODE_END |
| 62 | 80 | |
| 81 | |
| 63 | 82 | k05324x_device::k05324x_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 64 | 83 | : device_t(mconfig, K053244, "K053244 & 053245 Sprite Generator", tag, owner, clock, "k05324x", __FILE__), |
| 65 | 84 | device_gfx_interface(mconfig, *this, gfxinfo), |
| r30734 | r30735 | |
| 71 | 90 | m_rombank(0), |
| 72 | 91 | m_ramsize(0), |
| 73 | 92 | m_z_rejection(0) |
| 74 | | { |
| 93 | { |
| 75 | 94 | } |
| 76 | 95 | |
| 96 | void k05324x_device::set_bpp(device_t &device, int bpp) |
| 97 | { |
| 98 | k05324x_device &dev = downcast<k05324x_device &>(device); |
| 99 | switch(bpp) |
| 100 | { |
| 101 | case 4: |
| 102 | device_gfx_interface::static_set_info(dev, gfxinfo); |
| 103 | break; |
| 104 | case 6: |
| 105 | device_gfx_interface::static_set_info(dev, gfxinfo_6bpp); |
| 106 | break; |
| 107 | default: |
| 108 | fatalerror("Unsupported bpp\n"); |
| 109 | } |
| 110 | } |
| 77 | 111 | |
| 112 | |
| 78 | 113 | //------------------------------------------------- |
| 79 | 114 | // device_start - device-specific startup |
| 80 | 115 | //------------------------------------------------- |
| r30734 | r30735 | |
| 521 | 556 | #endif |
| 522 | 557 | #undef NUM_SPRITES |
| 523 | 558 | } |
| 524 | | |
| 525 | | /* Lethal Enforcers has 2 of these chips hooked up in parallel to give 6bpp gfx.. let's cheat a |
| 526 | | bit and make emulating it a little less messy by using a custom function instead */ |
| 527 | | void k05324x_device::sprites_draw_lethal( bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap ) |
| 528 | | { |
| 529 | | #define NUM_SPRITES 128 |
| 530 | | int offs, pri_code, i; |
| 531 | | int sortedlist[NUM_SPRITES]; |
| 532 | | int flipscreenX, flipscreenY, spriteoffsX, spriteoffsY; |
| 533 | | UINT8 drawmode_table[256]; |
| 534 | | |
| 535 | | memset(drawmode_table, DRAWMODE_SOURCE, sizeof(drawmode_table)); |
| 536 | | drawmode_table[0] = DRAWMODE_NONE; |
| 537 | | |
| 538 | | flipscreenX = m_regs[5] & 0x01; |
| 539 | | flipscreenY = m_regs[5] & 0x02; |
| 540 | | spriteoffsX = (m_regs[0] << 8) | m_regs[1]; |
| 541 | | spriteoffsY = (m_regs[2] << 8) | m_regs[3]; |
| 542 | | |
| 543 | | for (offs = 0; offs < NUM_SPRITES; offs++) |
| 544 | | sortedlist[offs] = -1; |
| 545 | | |
| 546 | | /* prebuild a sorted table */ |
| 547 | | for (i = m_ramsize / 2, offs = 0; offs < i; offs += 8) |
| 548 | | { |
| 549 | | pri_code = m_buffer[offs]; |
| 550 | | if (pri_code & 0x8000) |
| 551 | | { |
| 552 | | pri_code &= 0x007f; |
| 553 | | |
| 554 | | if (offs && pri_code == m_z_rejection) |
| 555 | | continue; |
| 556 | | |
| 557 | | if (sortedlist[pri_code] == -1) |
| 558 | | sortedlist[pri_code] = offs; |
| 559 | | } |
| 560 | | } |
| 561 | | |
| 562 | | for (pri_code = NUM_SPRITES - 1; pri_code >= 0; pri_code--) |
| 563 | | { |
| 564 | | int ox, oy, color, code, size, w, h, x, y, flipx, flipy, mirrorx, mirrory, shadow, zoomx, zoomy, pri; |
| 565 | | |
| 566 | | offs = sortedlist[pri_code]; |
| 567 | | if (offs == -1) |
| 568 | | continue; |
| 569 | | |
| 570 | | /* the following changes the sprite draw order from |
| 571 | | 0 1 4 5 16 17 20 21 |
| 572 | | 2 3 6 7 18 19 22 23 |
| 573 | | 8 9 12 13 24 25 28 29 |
| 574 | | 10 11 14 15 26 27 30 31 |
| 575 | | 32 33 36 37 48 49 52 53 |
| 576 | | 34 35 38 39 50 51 54 55 |
| 577 | | 40 41 44 45 56 57 60 61 |
| 578 | | 42 43 46 47 58 59 62 63 |
| 579 | | |
| 580 | | to |
| 581 | | |
| 582 | | 0 1 2 3 4 5 6 7 |
| 583 | | 8 9 10 11 12 13 14 15 |
| 584 | | 16 17 18 19 20 21 22 23 |
| 585 | | 24 25 26 27 28 29 30 31 |
| 586 | | 32 33 34 35 36 37 38 39 |
| 587 | | 40 41 42 43 44 45 46 47 |
| 588 | | 48 49 50 51 52 53 54 55 |
| 589 | | 56 57 58 59 60 61 62 63 |
| 590 | | */ |
| 591 | | |
| 592 | | /* NOTE: from the schematics, it looks like the top 2 bits should be ignored */ |
| 593 | | /* (there are not output pins for them), and probably taken from the "color" */ |
| 594 | | /* field to do bank switching. However this applies only to TMNT2, with its */ |
| 595 | | /* protection mcu creating the sprite table, so we don't know where to fetch */ |
| 596 | | /* the bits from. */ |
| 597 | | code = m_buffer[offs + 1]; |
| 598 | | code = ((code & 0xffe1) + ((code & 0x0010) >> 2) + ((code & 0x0008) << 1) |
| 599 | | + ((code & 0x0004) >> 1) + ((code & 0x0002) << 2)); |
| 600 | | color = m_buffer[offs + 6] & 0x00ff; |
| 601 | | pri = 0; |
| 602 | | |
| 603 | | if (!m_k05324x_cb.isnull()) |
| 604 | | m_k05324x_cb(&code, &color, &pri); |
| 605 | | |
| 606 | | size = (m_buffer[offs] & 0x0f00) >> 8; |
| 607 | | |
| 608 | | w = 1 << (size & 0x03); |
| 609 | | h = 1 << ((size >> 2) & 0x03); |
| 610 | | |
| 611 | | /* zoom control: |
| 612 | | 0x40 = normal scale |
| 613 | | <0x40 enlarge (0x20 = double size) |
| 614 | | >0x40 reduce (0x80 = half size) |
| 615 | | */ |
| 616 | | zoomy = m_buffer[offs + 4]; |
| 617 | | if (zoomy > 0x2000) |
| 618 | | continue; |
| 619 | | if (zoomy) |
| 620 | | zoomy = (0x400000 + zoomy / 2) / zoomy; |
| 621 | | else |
| 622 | | zoomy = 2 * 0x400000; |
| 623 | | if ((m_buffer[offs] & 0x4000) == 0) |
| 624 | | { |
| 625 | | zoomx = m_buffer[offs + 5]; |
| 626 | | if (zoomx > 0x2000) |
| 627 | | continue; |
| 628 | | if (zoomx) |
| 629 | | zoomx = (0x400000 + zoomx / 2) / zoomx; |
| 630 | | else |
| 631 | | zoomx = 2 * 0x400000; |
| 632 | | // else zoomx = zoomy; /* workaround for TMNT2 */ |
| 633 | | } |
| 634 | | else |
| 635 | | zoomx = zoomy; |
| 636 | | |
| 637 | | ox = m_buffer[offs + 3] + spriteoffsX; |
| 638 | | oy = m_buffer[offs + 2]; |
| 639 | | |
| 640 | | ox += m_dx; |
| 641 | | oy += m_dy; |
| 642 | | |
| 643 | | flipx = m_buffer[offs] & 0x1000; |
| 644 | | flipy = m_buffer[offs] & 0x2000; |
| 645 | | mirrorx = m_buffer[offs + 6] & 0x0100; |
| 646 | | if (mirrorx) |
| 647 | | flipx = 0; // documented and confirmed |
| 648 | | mirrory = m_buffer[offs + 6] & 0x0200; |
| 649 | | shadow = m_buffer[offs + 6] & 0x0080; |
| 650 | | |
| 651 | | if (flipscreenX) |
| 652 | | { |
| 653 | | ox = 512 - ox; |
| 654 | | if (!mirrorx) flipx = !flipx; |
| 655 | | } |
| 656 | | if (flipscreenY) |
| 657 | | { |
| 658 | | oy = -oy; |
| 659 | | if (!mirrory) flipy = !flipy; |
| 660 | | } |
| 661 | | |
| 662 | | ox = (ox + 0x5d) & 0x3ff; |
| 663 | | if (ox >= 768) ox -= 1024; |
| 664 | | oy = (-(oy + spriteoffsY + 0x07)) & 0x3ff; |
| 665 | | if (oy >= 640) oy -= 1024; |
| 666 | | |
| 667 | | /* the coordinates given are for the *center* of the sprite */ |
| 668 | | ox -= (zoomx * w) >> 13; |
| 669 | | oy -= (zoomy * h) >> 13; |
| 670 | | |
| 671 | | drawmode_table[gfx(0)->granularity() - 1] = shadow ? DRAWMODE_SHADOW : DRAWMODE_SOURCE; |
| 672 | | |
| 673 | | for (y = 0; y < h; y++) |
| 674 | | { |
| 675 | | int sx, sy, zw, zh; |
| 676 | | |
| 677 | | sy = oy + ((zoomy * y + (1<<11)) >> 12); |
| 678 | | zh = (oy + ((zoomy * (y+1) + (1<<11)) >> 12)) - sy; |
| 679 | | |
| 680 | | for (x = 0; x < w; x++) |
| 681 | | { |
| 682 | | int c, fx, fy; |
| 683 | | |
| 684 | | sx = ox + ((zoomx * x + (1 << 11)) >> 12); |
| 685 | | zw = (ox + ((zoomx * (x+1) + (1 << 11)) >> 12)) - sx; |
| 686 | | c = code; |
| 687 | | if (mirrorx) |
| 688 | | { |
| 689 | | if ((flipx == 0) ^ (2 * x < w)) |
| 690 | | { |
| 691 | | /* mirror left/right */ |
| 692 | | c += (w - x - 1); |
| 693 | | fx = 1; |
| 694 | | } |
| 695 | | else |
| 696 | | { |
| 697 | | c += x; |
| 698 | | fx = 0; |
| 699 | | } |
| 700 | | } |
| 701 | | else |
| 702 | | { |
| 703 | | if (flipx) c += w-1-x; |
| 704 | | else c += x; |
| 705 | | fx = flipx; |
| 706 | | } |
| 707 | | if (mirrory) |
| 708 | | { |
| 709 | | if ((flipy == 0) ^ (2 * y >= h)) |
| 710 | | { |
| 711 | | /* mirror top/bottom */ |
| 712 | | c += 8 * (h - y - 1); |
| 713 | | fy = 1; |
| 714 | | } |
| 715 | | else |
| 716 | | { |
| 717 | | c += 8 * y; |
| 718 | | fy = 0; |
| 719 | | } |
| 720 | | } |
| 721 | | else |
| 722 | | { |
| 723 | | if (flipy) c += 8 * (h - 1 - y); |
| 724 | | else c += 8 * y; |
| 725 | | fy = flipy; |
| 726 | | } |
| 727 | | |
| 728 | | /* the sprite can start at any point in the 8x8 grid, but it must stay */ |
| 729 | | /* in a 64 entries window, wrapping around at the edges. The animation */ |
| 730 | | /* at the end of the saloon level in Sunset Riders breaks otherwise. */ |
| 731 | | c = (c & 0x3f) | (code & ~0x3f); |
| 732 | | |
| 733 | | if (zoomx == 0x10000 && zoomy == 0x10000) |
| 734 | | { |
| 735 | | gfx(0)->prio_transtable(bitmap,cliprect, /* hardcoded to 0 (decoded 6bpp gfx) for le */ |
| 736 | | c,color, |
| 737 | | fx,fy, |
| 738 | | sx,sy, |
| 739 | | priority_bitmap,pri, |
| 740 | | drawmode_table); |
| 741 | | } |
| 742 | | else |
| 743 | | { |
| 744 | | gfx(0)->prio_zoom_transtable(bitmap,cliprect, /* hardcoded to 0 (decoded 6bpp gfx) for le */ |
| 745 | | c,color, |
| 746 | | fx,fy, |
| 747 | | sx,sy, |
| 748 | | (zw << 16) / 16,(zh << 16) / 16, |
| 749 | | priority_bitmap,pri, |
| 750 | | drawmode_table); |
| 751 | | |
| 752 | | } |
| 753 | | } |
| 754 | | } |
| 755 | | } |
| 756 | | #if 0 |
| 757 | | if (machine().input().code_pressed(KEYCODE_D)) |
| 758 | | { |
| 759 | | FILE *fp; |
| 760 | | fp=fopen("SPRITE.DMP", "w+b"); |
| 761 | | if (fp) |
| 762 | | { |
| 763 | | fwrite(m_buffer, 0x800, 1, fp); |
| 764 | | popmessage("saved"); |
| 765 | | fclose(fp); |
| 766 | | } |
| 767 | | } |
| 768 | | #endif |
| 769 | | #undef NUM_SPRITES |
| 770 | | } |
| 771 | | |
| 772 | | READ16_MEMBER( k05324x_device::k053244_reg_word_r ) |
| 773 | | { |
| 774 | | return(m_regs[offset * 2] << 8 | m_regs[offset * 2 + 1]); |
| 775 | | } |