Previous 199869 Revisions Next

r21443 Tuesday 26th February, 2013 at 05:16:50 UTC by David Haywood
shuffle some clip checks around
[src/mame/drivers]coolridr.c

trunk/src/mame/drivers/coolridr.c
r21442r21443
687687   /* skip the decoding if it's the same tile as last time! */ \
688688   if (spriteNumber != lastSpriteNumber) \
689689   { \
690      blankcount = 256;\
690691      lastSpriteNumber = spriteNumber; \
691692       \
692693      int i = 1;/* skip first 10 bits for now */ \
r21442r21443
744745   } \
745746
746747
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 \
748823   for (int y = 0; y < blockhigh; y++) \
749824   { \
750825      int realy = ((y*incy)>>21); \
r21442r21443
761836         continue; \
762837      if (pixelOffsetX>clipmaxX) \
763838         continue; \
764      UINT32 incx = 0x8000000 / hZoomTable[realy]; \
765      for (int x = 0; x < blockwide; x++) \
839      \
840      if (pixelOffsetX>=clipminX && pixelOffsetX+blockwide<clipmaxX) \
766841      { \
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   } \
770864
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
771911#define YXLOOP_END \
772912      } \
773913   } \
r21442r21443
842982      if (object->zpri < zline[drawx]) \
843983      { \
844984         { \
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); \
850986            zline[drawx] = object->zpri; \
851987         } \
852988      } \
r21442r21443
14851621         }
14861622      }
14871623
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; \
14881629
1489
14901630      for (int h = 0; h < used_hCellCount; h++)
14911631      {
1492         if (!indirect_zoom_enable)
1493         {
1494         //   int offs = ((hPosition) + (h* 16 * hZoom)) / 0x40;
1495         //   if (offs>clipmaxX) continue;
1496         }
14971632
1498         UINT32 lastSpriteNumber = 0xffffffff;
14991633
1500         int lookupnum;
15011634
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);
15261635
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);
15441636
1545               }
1546            }
1547         }
15481637
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
15881638         UINT32 incy = 0x8000000 / vZoom;
15891639
15901640         // DEBUG: Draw 16x16 block
r21442r21443
15941644
15951645         if (indirect_zoom_enable)
15961646         {
1647            GET_SPRITE_NUMBER
1648            CHECK_DECODE
1649
1650
15971651            if (blit_rotate)
15981652            {
1599               YXLOOP_START
1600               UINT16 pix = tempshape[realx*16+realy];
1601               DRAW_PIX
1602               YXLOOP_END
1653               YXLOOP_START_1
1654
16031655            }
16041656            else // no rotate
16051657            {
1606               YXLOOP_START
1607               UINT16 pix = tempshape[realy*16+realx];
1608               DRAW_PIX
1609               YXLOOP_END
1658               YXLOOP_START_2
1659
16101660            }
16111661         }
16121662         else  // no indirect zoom
r21442r21443
16271677               if (pixelOffsetX>clipmaxX)
16281678                  continue;
16291679
1680               GET_SPRITE_NUMBER
1681               CHECK_DECODE
1682
16301683               if (pixelOffsetX>=clipminX && pixelOffsetX+16<clipmaxX)
16311684               {
16321685                  if (blit_rotate)
16331686                  {
16341687                     YXLOOP_START_NO_ZOOM_NO_XCLIP
1635                     UINT16 pix = tempshape[x*16+y];
1688                     const UINT16 &pix = tempshape[x*16+y];
16361689                     DRAW_PIX
16371690                     YXLOOP_END
16381691                  }
16391692                  else // no rotate
16401693                  {
16411694                     YXLOOP_START_NO_ZOOM_NO_XCLIP
1642                     UINT16 pix = tempshape[y*16+x];
1695                     const UINT16 &pix = tempshape[y*16+x];
16431696                     DRAW_PIX
16441697                     YXLOOP_END
16451698                  }
r21442r21443
16491702                  if (blit_rotate)
16501703                  {
16511704                     YXLOOP_START_NO_ZOOM
1652                     UINT16 pix = tempshape[x*16+y];
1705                     const UINT16 &pix = tempshape[x*16+y];
16531706                     DRAW_PIX
16541707                     YXLOOP_END
16551708                  }
16561709                  else // no rotate
16571710                  {
16581711                     YXLOOP_START_NO_ZOOM
1659                     UINT16 pix = tempshape[y*16+x];
1712                     const UINT16 &pix = tempshape[y*16+x];
16601713                     DRAW_PIX
16611714                     YXLOOP_END
16621715                  }
r21442r21443
16761729               if (pixelOffsetX>clipmaxX)
16771730                  continue;
16781731
1732               GET_SPRITE_NUMBER
1733               CHECK_DECODE
1734
16791735               if (pixelOffsetX>=clipminX && pixelOffsetX+blockwide<clipmaxX)
16801736               {
16811737                  if (blit_rotate)
16821738                  {
16831739                     YXLOOP_START_NO_LINEZOOM_NO_XCLIP
1684                     UINT16 pix = tempshape[realx*16+realy];
1740                     const UINT16 &pix = tempshape[realx*16+realy];
16851741                     DRAW_PIX
16861742                     YXLOOP_END
16871743                  }
16881744                  else // no rotate
16891745                  {
16901746                     YXLOOP_START_NO_LINEZOOM_NO_XCLIP
1691                     UINT16 pix = tempshape[realy*16+realx];
1747                     const UINT16 &pix = tempshape[realy*16+realx];
16921748                     DRAW_PIX
16931749                     YXLOOP_END
16941750                  }
r21442r21443
16981754                  if (blit_rotate)
16991755                  {
17001756                     YXLOOP_START_NO_LINEZOOM
1701                     UINT16 pix = tempshape[realx*16+realy];
1757                     const UINT16 &pix = tempshape[realx*16+realy];
17021758                     DRAW_PIX
17031759                     YXLOOP_END
17041760                  }
17051761                  else // no rotate
17061762                  {
17071763                     YXLOOP_START_NO_LINEZOOM
1708                     UINT16 pix = tempshape[realy*16+realx];
1764                     const UINT16 &pix = tempshape[realy*16+realx];
17091765                     DRAW_PIX
17101766                     YXLOOP_END
17111767                  }

Previous 199869 Revisions Next


© 1997-2024 The MAME Team