trunk/src/mame/drivers/coolridr.c
| r21442 | r21443 | |
| 687 | 687 | /* skip the decoding if it's the same tile as last time! */ \ |
| 688 | 688 | if (spriteNumber != lastSpriteNumber) \ |
| 689 | 689 | { \ |
| 690 | blankcount = 256;\ |
| 690 | 691 | lastSpriteNumber = spriteNumber; \ |
| 691 | 692 | \ |
| 692 | 693 | int i = 1;/* skip first 10 bits for now */ \ |
| r21442 | r21443 | |
| 744 | 745 | } \ |
| 745 | 746 | |
| 746 | 747 | |
| 747 | | #define YXLOOP_START \ |
| 748 | #define CHECK_DECODE \ |
| 749 | if (used_flipy) \ |
| 750 | { \ |
| 751 | if (used_flipx) \ |
| 752 | { \ |
| 753 | RLE_BLOCK(0xff) \ |
| 754 | } \ |
| 755 | else \ |
| 756 | { \ |
| 757 | RLE_BLOCK(0xf0) \ |
| 758 | } \ |
| 759 | } \ |
| 760 | else \ |
| 761 | { if (used_flipx) \ |
| 762 | { \ |
| 763 | RLE_BLOCK(0x0f) \ |
| 764 | } \ |
| 765 | else \ |
| 766 | { \ |
| 767 | RLE_BLOCK(0x00) \ |
| 768 | } \ |
| 769 | } \ |
| 770 | if (blankcount==0) \ |
| 771 | continue; \ |
| 772 | |
| 773 | #define GET_SPRITE_NUMBER \ |
| 774 | int lookupnum; \ |
| 775 | /* with this bit enabled the tile numbers gets looked up using 'data' (which would be blit11) (eg 03f40000 for startup text) */ \ |
| 776 | /* this allows text strings to be written as 8-bit ascii in one area (using command 0x10), and drawn using multi-width sprites */ \ |
| 777 | if (indirect_tile_enable) \ |
| 778 | { \ |
| 779 | /* this doesn't handle the various flip modes.. */ \ |
| 780 | lookupnum = object->indirect_tiles[h + (v*used_hCellCount)]; \ |
| 781 | } \ |
| 782 | else \ |
| 783 | { \ |
| 784 | if (!blit_rotate) \ |
| 785 | { \ |
| 786 | if (!used_flipy) \ |
| 787 | { \ |
| 788 | if (!used_flipx) \ |
| 789 | lookupnum = h + (v*used_hCellCount); \ |
| 790 | else \ |
| 791 | lookupnum = (used_hCellCount-h-1) + (v*used_hCellCount); \ |
| 792 | } \ |
| 793 | else \ |
| 794 | { \ |
| 795 | if (!used_flipx) \ |
| 796 | lookupnum = h + ((used_vCellCount-v-1)*used_hCellCount); \ |
| 797 | else \ |
| 798 | lookupnum = (used_hCellCount-h-1) + ((used_vCellCount-v-1)*used_hCellCount); \ |
| 799 | } \ |
| 800 | } \ |
| 801 | else \ |
| 802 | { \ |
| 803 | if (!used_flipy) \ |
| 804 | { \ |
| 805 | if (!used_flipx) \ |
| 806 | lookupnum = v + (h*used_vCellCount); \ |
| 807 | else \ |
| 808 | lookupnum = (used_vCellCount-v-1) + (h*used_vCellCount); \ |
| 809 | } \ |
| 810 | else \ |
| 811 | { \ |
| 812 | if (!used_flipx) \ |
| 813 | lookupnum = v + ((used_hCellCount-h-1)*used_vCellCount); \ |
| 814 | else \ |
| 815 | lookupnum = (used_vCellCount-v-1) + ((used_hCellCount-h-1)*used_vCellCount); \ |
| 816 | } \ |
| 817 | } \ |
| 818 | } \ |
| 819 | UINT32 spriteNumber = (expanded_10bit_gfx[ (b3romoffset) + (lookupnum<<1) +0 ] << 10) | (expanded_10bit_gfx[ (b3romoffset) + (lookupnum<<1) + 1 ]); \ |
| 820 | |
| 821 | |
| 822 | #define YXLOOP_START_1 \ |
| 748 | 823 | for (int y = 0; y < blockhigh; y++) \ |
| 749 | 824 | { \ |
| 750 | 825 | int realy = ((y*incy)>>21); \ |
| r21442 | r21443 | |
| 761 | 836 | continue; \ |
| 762 | 837 | if (pixelOffsetX>clipmaxX) \ |
| 763 | 838 | continue; \ |
| 764 | | UINT32 incx = 0x8000000 / hZoomTable[realy]; \ |
| 765 | | for (int x = 0; x < blockwide; x++) \ |
| 839 | \ |
| 840 | if (pixelOffsetX>=clipminX && pixelOffsetX+blockwide<clipmaxX) \ |
| 766 | 841 | { \ |
| 767 | | const int drawx = pixelOffsetX+x; \ |
| 768 | | if ((drawx>clipmaxX || drawx<clipminX)) continue; \ |
| 769 | | int realx = ((x*incx)>>21); \ |
| 842 | UINT32 incx = 0x8000000 / hZoomTable[realy]; \ |
| 843 | for (int x = 0; x < blockwide; x++) \ |
| 844 | { \ |
| 845 | const int drawx = pixelOffsetX+x; \ |
| 846 | int realx = ((x*incx)>>21); \ |
| 847 | const UINT16 &pix = tempshape[realx*16+realy]; \ |
| 848 | DRAW_PIX \ |
| 849 | } \ |
| 850 | } \ |
| 851 | else \ |
| 852 | { \ |
| 853 | UINT32 incx = 0x8000000 / hZoomTable[realy]; \ |
| 854 | for (int x = 0; x < blockwide; x++) \ |
| 855 | { \ |
| 856 | const int drawx = pixelOffsetX+x; \ |
| 857 | if ((drawx>clipmaxX || drawx<clipminX)) continue; \ |
| 858 | int realx = ((x*incx)>>21); \ |
| 859 | const UINT16 &pix = tempshape[realx*16+realy]; \ |
| 860 | DRAW_PIX \ |
| 861 | } \ |
| 862 | } \ |
| 863 | } \ |
| 770 | 864 | |
| 865 | |
| 866 | #define YXLOOP_START_2 \ |
| 867 | for (int y = 0; y < blockhigh; y++) \ |
| 868 | { \ |
| 869 | int realy = ((y*incy)>>21); \ |
| 870 | if (!hZoomTable[realy]) \ |
| 871 | continue; \ |
| 872 | const int pixelOffsetX = ((hPositionTable[realy]) + (h* 16 * hZoomTable[realy])) / 0x40; \ |
| 873 | const int pixelOffsetnextX = ((hPositionTable[realy]) + ((h+1)* 16 * hZoomTable[realy])) / 0x40; \ |
| 874 | const int drawy = pixelOffsetY+y; \ |
| 875 | if ((drawy>clipmaxY) || (drawy<clipminY)) continue; \ |
| 876 | line = &drawbitmap->pix32(drawy); \ |
| 877 | zline = &object->zbitmap->pix16(drawy); \ |
| 878 | int blockwide = pixelOffsetnextX-pixelOffsetX; \ |
| 879 | if (pixelOffsetX+blockwide <clipminX) \ |
| 880 | continue; \ |
| 881 | if (pixelOffsetX>clipmaxX) \ |
| 882 | continue; \ |
| 883 | if (pixelOffsetX>=clipminX && pixelOffsetX+blockwide<clipmaxX) \ |
| 884 | { \ |
| 885 | UINT32 incx = 0x8000000 / hZoomTable[realy]; \ |
| 886 | for (int x = 0; x < blockwide; x++) \ |
| 887 | { \ |
| 888 | const int drawx = pixelOffsetX+x; \ |
| 889 | int realx = ((x*incx)>>21); \ |
| 890 | const UINT16 &pix = tempshape[realy*16+realx]; \ |
| 891 | DRAW_PIX \ |
| 892 | } \ |
| 893 | } \ |
| 894 | else \ |
| 895 | { \ |
| 896 | UINT32 incx = 0x8000000 / hZoomTable[realy]; \ |
| 897 | for (int x = 0; x < blockwide; x++) \ |
| 898 | { \ |
| 899 | const int drawx = pixelOffsetX+x; \ |
| 900 | int realx = ((x*incx)>>21); \ |
| 901 | if ((drawx>clipmaxX || drawx<clipminX)) continue; \ |
| 902 | const UINT16 &pix = tempshape[realy*16+realx]; \ |
| 903 | DRAW_PIX \ |
| 904 | } \ |
| 905 | } \ |
| 906 | } \ |
| 907 | |
| 908 | |
| 909 | |
| 910 | |
| 771 | 911 | #define YXLOOP_END \ |
| 772 | 912 | } \ |
| 773 | 913 | } \ |
| r21442 | r21443 | |
| 842 | 982 | if (object->zpri < zline[drawx]) \ |
| 843 | 983 | { \ |
| 844 | 984 | { \ |
| 845 | | int r,g,b; \ |
| 846 | | r = pal5bit((pix >> 10) & 0x1f); \ |
| 847 | | g = pal5bit((pix >> 5) & 0x1f); \ |
| 848 | | b = pal5bit((pix >> 0) & 0x1f); \ |
| 849 | | line[drawx] = r<<16 | g<<8 | b; \ |
| 985 | line[drawx] = (pal5bit((pix >> 10) & 0x1f)<<16)|(pal5bit((pix >> 5) & 0x1f)<<8)|pal5bit((pix >> 0) & 0x1f); \ |
| 850 | 986 | zline[drawx] = object->zpri; \ |
| 851 | 987 | } \ |
| 852 | 988 | } \ |
| r21442 | r21443 | |
| 1485 | 1621 | } |
| 1486 | 1622 | } |
| 1487 | 1623 | |
| 1624 | UINT32 lastSpriteNumber = 0xffffffff; |
| 1625 | UINT16 tempshape[16*16]; |
| 1626 | UINT16 blankcount = 0; |
| 1627 | int color_offs = (0x7b20 + (b1colorNumber & 0x7ff))*0x40 * 5; /* yes, * 5 */ \ |
| 1628 | int color_offs2 = (0x7b20 + (b2colorNumber & 0x7ff))*0x40 * 5; \ |
| 1488 | 1629 | |
| 1489 | | |
| 1490 | 1630 | for (int h = 0; h < used_hCellCount; h++) |
| 1491 | 1631 | { |
| 1492 | | if (!indirect_zoom_enable) |
| 1493 | | { |
| 1494 | | // int offs = ((hPosition) + (h* 16 * hZoom)) / 0x40; |
| 1495 | | // if (offs>clipmaxX) continue; |
| 1496 | | } |
| 1497 | 1632 | |
| 1498 | | UINT32 lastSpriteNumber = 0xffffffff; |
| 1499 | 1633 | |
| 1500 | | int lookupnum; |
| 1501 | 1634 | |
| 1502 | | // with this bit enabled the tile numbers gets looked up using 'data' (which would be blit11) (eg 03f40000 for startup text) |
| 1503 | | // this allows text strings to be written as 8-bit ascii in one area (using command 0x10), and drawn using multi-width sprites |
| 1504 | | if (indirect_tile_enable) |
| 1505 | | { |
| 1506 | | // this doesn't handle the various flip modes.. |
| 1507 | | lookupnum = object->indirect_tiles[h + (v*used_hCellCount)]; |
| 1508 | | } |
| 1509 | | else |
| 1510 | | { |
| 1511 | | if (!blit_rotate) |
| 1512 | | { |
| 1513 | | if (!used_flipy) |
| 1514 | | { |
| 1515 | | if (!used_flipx) |
| 1516 | | lookupnum = h + (v*used_hCellCount); |
| 1517 | | else |
| 1518 | | lookupnum = (used_hCellCount-h-1) + (v*used_hCellCount); |
| 1519 | | } |
| 1520 | | else |
| 1521 | | { |
| 1522 | | if (!used_flipx) |
| 1523 | | lookupnum = h + ((used_vCellCount-v-1)*used_hCellCount); |
| 1524 | | else |
| 1525 | | lookupnum = (used_hCellCount-h-1) + ((used_vCellCount-v-1)*used_hCellCount); |
| 1526 | 1635 | |
| 1527 | | } |
| 1528 | | } |
| 1529 | | else |
| 1530 | | { |
| 1531 | | if (!used_flipy) |
| 1532 | | { |
| 1533 | | if (!used_flipx) |
| 1534 | | lookupnum = v + (h*used_vCellCount); |
| 1535 | | else |
| 1536 | | lookupnum = (used_vCellCount-v-1) + (h*used_vCellCount); |
| 1537 | | } |
| 1538 | | else |
| 1539 | | { |
| 1540 | | if (!used_flipx) |
| 1541 | | lookupnum = v + ((used_hCellCount-h-1)*used_vCellCount); |
| 1542 | | else |
| 1543 | | lookupnum = (used_vCellCount-v-1) + ((used_hCellCount-h-1)*used_vCellCount); |
| 1544 | 1636 | |
| 1545 | | } |
| 1546 | | } |
| 1547 | | } |
| 1548 | 1637 | |
| 1549 | | // these should be 'cell numbers' (tile numbers) which look up RLE data? |
| 1550 | | UINT32 spriteNumber = (expanded_10bit_gfx[ (b3romoffset) + (lookupnum<<1) +0 ] << 10) | (expanded_10bit_gfx[ (b3romoffset) + (lookupnum<<1) + 1 ]); |
| 1551 | | UINT16 tempshape[16*16]; |
| 1552 | | |
| 1553 | | int color_offs = (0x7b20 + (b1colorNumber & 0x7ff))*0x40 * 5; /* yes, * 5 */ |
| 1554 | | int color_offs2 = (0x7b20 + (b2colorNumber & 0x7ff))*0x40 * 5; |
| 1555 | | UINT16 blankcount = 256; |
| 1556 | | |
| 1557 | | if (used_flipy) |
| 1558 | | { |
| 1559 | | if (used_flipx) |
| 1560 | | { |
| 1561 | | RLE_BLOCK(0xff) |
| 1562 | | } |
| 1563 | | else |
| 1564 | | { |
| 1565 | | RLE_BLOCK(0xf0) |
| 1566 | | } |
| 1567 | | } |
| 1568 | | else |
| 1569 | | { if (used_flipx) |
| 1570 | | { |
| 1571 | | RLE_BLOCK(0x0f) |
| 1572 | | } |
| 1573 | | else |
| 1574 | | { |
| 1575 | | RLE_BLOCK(0x00) |
| 1576 | | } |
| 1577 | | } |
| 1578 | | |
| 1579 | | |
| 1580 | | if (blankcount==0) |
| 1581 | | continue; |
| 1582 | | |
| 1583 | | |
| 1584 | | |
| 1585 | | |
| 1586 | | |
| 1587 | | |
| 1588 | 1638 | UINT32 incy = 0x8000000 / vZoom; |
| 1589 | 1639 | |
| 1590 | 1640 | // DEBUG: Draw 16x16 block |
| r21442 | r21443 | |
| 1594 | 1644 | |
| 1595 | 1645 | if (indirect_zoom_enable) |
| 1596 | 1646 | { |
| 1647 | GET_SPRITE_NUMBER |
| 1648 | CHECK_DECODE |
| 1649 | |
| 1650 | |
| 1597 | 1651 | if (blit_rotate) |
| 1598 | 1652 | { |
| 1599 | | YXLOOP_START |
| 1600 | | UINT16 pix = tempshape[realx*16+realy]; |
| 1601 | | DRAW_PIX |
| 1602 | | YXLOOP_END |
| 1653 | YXLOOP_START_1 |
| 1654 | |
| 1603 | 1655 | } |
| 1604 | 1656 | else // no rotate |
| 1605 | 1657 | { |
| 1606 | | YXLOOP_START |
| 1607 | | UINT16 pix = tempshape[realy*16+realx]; |
| 1608 | | DRAW_PIX |
| 1609 | | YXLOOP_END |
| 1658 | YXLOOP_START_2 |
| 1659 | |
| 1610 | 1660 | } |
| 1611 | 1661 | } |
| 1612 | 1662 | else // no indirect zoom |
| r21442 | r21443 | |
| 1627 | 1677 | if (pixelOffsetX>clipmaxX) |
| 1628 | 1678 | continue; |
| 1629 | 1679 | |
| 1680 | GET_SPRITE_NUMBER |
| 1681 | CHECK_DECODE |
| 1682 | |
| 1630 | 1683 | if (pixelOffsetX>=clipminX && pixelOffsetX+16<clipmaxX) |
| 1631 | 1684 | { |
| 1632 | 1685 | if (blit_rotate) |
| 1633 | 1686 | { |
| 1634 | 1687 | YXLOOP_START_NO_ZOOM_NO_XCLIP |
| 1635 | | UINT16 pix = tempshape[x*16+y]; |
| 1688 | const UINT16 &pix = tempshape[x*16+y]; |
| 1636 | 1689 | DRAW_PIX |
| 1637 | 1690 | YXLOOP_END |
| 1638 | 1691 | } |
| 1639 | 1692 | else // no rotate |
| 1640 | 1693 | { |
| 1641 | 1694 | YXLOOP_START_NO_ZOOM_NO_XCLIP |
| 1642 | | UINT16 pix = tempshape[y*16+x]; |
| 1695 | const UINT16 &pix = tempshape[y*16+x]; |
| 1643 | 1696 | DRAW_PIX |
| 1644 | 1697 | YXLOOP_END |
| 1645 | 1698 | } |
| r21442 | r21443 | |
| 1649 | 1702 | if (blit_rotate) |
| 1650 | 1703 | { |
| 1651 | 1704 | YXLOOP_START_NO_ZOOM |
| 1652 | | UINT16 pix = tempshape[x*16+y]; |
| 1705 | const UINT16 &pix = tempshape[x*16+y]; |
| 1653 | 1706 | DRAW_PIX |
| 1654 | 1707 | YXLOOP_END |
| 1655 | 1708 | } |
| 1656 | 1709 | else // no rotate |
| 1657 | 1710 | { |
| 1658 | 1711 | YXLOOP_START_NO_ZOOM |
| 1659 | | UINT16 pix = tempshape[y*16+x]; |
| 1712 | const UINT16 &pix = tempshape[y*16+x]; |
| 1660 | 1713 | DRAW_PIX |
| 1661 | 1714 | YXLOOP_END |
| 1662 | 1715 | } |
| r21442 | r21443 | |
| 1676 | 1729 | if (pixelOffsetX>clipmaxX) |
| 1677 | 1730 | continue; |
| 1678 | 1731 | |
| 1732 | GET_SPRITE_NUMBER |
| 1733 | CHECK_DECODE |
| 1734 | |
| 1679 | 1735 | if (pixelOffsetX>=clipminX && pixelOffsetX+blockwide<clipmaxX) |
| 1680 | 1736 | { |
| 1681 | 1737 | if (blit_rotate) |
| 1682 | 1738 | { |
| 1683 | 1739 | YXLOOP_START_NO_LINEZOOM_NO_XCLIP |
| 1684 | | UINT16 pix = tempshape[realx*16+realy]; |
| 1740 | const UINT16 &pix = tempshape[realx*16+realy]; |
| 1685 | 1741 | DRAW_PIX |
| 1686 | 1742 | YXLOOP_END |
| 1687 | 1743 | } |
| 1688 | 1744 | else // no rotate |
| 1689 | 1745 | { |
| 1690 | 1746 | YXLOOP_START_NO_LINEZOOM_NO_XCLIP |
| 1691 | | UINT16 pix = tempshape[realy*16+realx]; |
| 1747 | const UINT16 &pix = tempshape[realy*16+realx]; |
| 1692 | 1748 | DRAW_PIX |
| 1693 | 1749 | YXLOOP_END |
| 1694 | 1750 | } |
| r21442 | r21443 | |
| 1698 | 1754 | if (blit_rotate) |
| 1699 | 1755 | { |
| 1700 | 1756 | YXLOOP_START_NO_LINEZOOM |
| 1701 | | UINT16 pix = tempshape[realx*16+realy]; |
| 1757 | const UINT16 &pix = tempshape[realx*16+realy]; |
| 1702 | 1758 | DRAW_PIX |
| 1703 | 1759 | YXLOOP_END |
| 1704 | 1760 | } |
| 1705 | 1761 | else // no rotate |
| 1706 | 1762 | { |
| 1707 | 1763 | YXLOOP_START_NO_LINEZOOM |
| 1708 | | UINT16 pix = tempshape[realy*16+realx]; |
| 1764 | const UINT16 &pix = tempshape[realy*16+realx]; |
| 1709 | 1765 | DRAW_PIX |
| 1710 | 1766 | YXLOOP_END |
| 1711 | 1767 | } |