Previous 199869 Revisions Next

r21325 Friday 22nd February, 2013 at 19:15:35 UTC by David Haywood
better road handling, although less playable now because it renders over the bike ;-)
[src/mame/drivers]coolridr.c

trunk/src/mame/drivers/coolridr.c
r21324r21325
613613}
614614#endif
615615
616#define YLOOP_START \
617   for (int y = 0; y < blockhigh; y++) \
618   { \
619      int realy = ((y*incy)>>21); \
620      if (!hZoomTable[realy]) \
621         continue;    \
622      const int pixelOffsetX = ((hPositionTable[realy]) + (h* 16 * hZoomTable[realy])) / 0x40; \
623      const int drawy = pixelOffsetY+y; \
624      if ((drawy>383) || (drawy<0)) continue; \
625      line = &drawbitmap->pix32(drawy); \
626      int blockwide = ((16*hZoomTable[realy])/0x40); \
627      UINT32 incx = 0x8000000 / hZoomTable[realy]; \
628
629#define XLOOP_START \
630   for (int x = 0; x < blockwide; x++) \
631   { \
632      const int drawx = pixelOffsetX+x; \
633      if ((drawx>=495 || drawx<0)) continue; \
634      int realx = ((x*incx)>>21); \
635
636
637
616638#define DRAW_PIX \
617639   if (pix) \
618640   { \
r21324r21325
731753   int indirect_zoom_enable = (m_spriteblit[5] & 0x00000001);
732754
733755
734   if (blit5_unused) printf("unknown bits in blit word %d -  %08x\n", m_blitterSerialCount, blit5_unused);
756   if (blit5_unused) printf("unknown bits in blit word %d -  %08x\n", 5, blit5_unused);
735757   // 00010000 (text)
736758   // 00000001 (other)
737759
r21324r21325
745767
746768   /************* m_spriteblit[7] *************/
747769
748   UINT16 vOrigin = (m_spriteblit[7] & 0xffff0000) >> 16;
749   UINT16 hOrigin = (m_spriteblit[7] & 0x0000ffff);
770   UINT16 vOrigin = (m_spriteblit[7] & 0x00030000) >> 16;
771   UINT16 hOrigin = (m_spriteblit[7] & 0x00000003);
772   UINT16 OriginUnused = (m_spriteblit[7] & 0xfffcfffc);
773
774   if (blit5_unused) printf("unknown bits in blit word %d -  %08x\n", 7, OriginUnused);
775
750776   //printf("%04x %04x\n", vOrigin, hOrigin);
751777
752778   /************* m_spriteblit[8] *************/
r21324r21325
852878
853879      for (int idx=0;idx<16;idx++)
854880      {
881
855882         if (indirect_zoom_enable)
856883         {
857884            UINT32 dword = space.read_dword(blit10);
858885
859            hZoomTable[idx] = (dword>>16); // add original value?
860            int linescroll = dword&0xffff;
861            if (linescroll & 0x8000) linescroll -= 0x10000;
886            hZoomTable[idx] = hZoom + (dword>>16); // add original value?
887           
888            // bit 0x8000 does get set too, but only on some lines, might have another meaning?
889            int linescroll = dword&0x7fff;
890            if (linescroll & 0x4000) linescroll -= 0x8000;
862891
863892            hPositionTable[idx] = linescroll + hPosition;
864893            blit10+=4;
r21324r21325
871900            hPositionTable[idx] = hPosition;
872901         }
873902
874
875         int sizex = used_hCellCount * 16 * hZoomTable[idx];
903         // DON'T use the table hZoom in this calc? (road..)
904         int sizex = used_hCellCount * 16 * hZoom;
876905           
877906         hPositionTable[idx] *= 0x40;
878907
r21324r21325
896925
897926      }
898927
928      //if ((hOrigin & 3) != 1)
929      //   return;
899930
900931      for (int h = 0; h < used_hCellCount; h++)
901932      {
r21324r21325
10321063         {
10331064            if (used_flipy)
10341065            {
1035               for (int y = 0; y < blockhigh; y++)
1036               {
1037                  int realy = ((y*incy)>>21);
1038                  if (!hZoomTable[realy])
1039                     continue;
1040                  const int pixelOffsetX = ((hPositionTable[realy]) + (h* 16 * hZoomTable[realy])) / 0x40;
1041                  const int drawy = pixelOffsetY+y;
1042                  if ((drawy>383) || (drawy<0)) continue;
1043                  line = &drawbitmap->pix32(drawy);
1044                  int blockwide = ((16*hZoomTable[realy])/0x40);
1045                  UINT32 incx = 0x8000000 / hZoomTable[realy];
1066               YLOOP_START
10461067
1047
10481068                  if (used_flipx)
10491069                  {
1050                     for (int x = 0; x < blockwide; x++)
1051                     {
1052                       
1070                     XLOOP_START
10531071
1054                        const int drawx = pixelOffsetX+x;
1055                        if ((drawx>=495 || drawx<0)) continue;
1056                        int realx = ((x*incx)>>21);
1057
10581072                        UINT16 pix = tempshape[(15-realx)*16+(15-realy)];
10591073                        DRAW_PIX
10601074                     }
10611075                  }
10621076                  else
10631077                  {
1064                     for (int x = 0; x < blockwide; x++)
1065                     {
1066                        const int drawx = pixelOffsetX+x;
1067                        if ((drawx>=495 || drawx<0)) continue;
1068                        int realx = ((x*incx)>>21);
1078                     XLOOP_START
10691079
10701080                        UINT16 pix = tempshape[(15-realx)*16+realy];
10711081                        DRAW_PIX
r21324r21325
10751085            }
10761086            else
10771087            {
1078               for (int y = 0; y < blockhigh; y++)
1079               {
1080                  int realy = ((y*incy)>>21);
1081                  if (!hZoomTable[realy])
1082                     continue;   
1083                  const int pixelOffsetX = ((hPositionTable[realy]) + (h* 16 * hZoomTable[realy])) / 0x40;
1084                  const int drawy = pixelOffsetY+y;
1085                  if ((drawy>383) || (drawy<0)) continue;
1086                  line = &drawbitmap->pix32(drawy);
1087                  int blockwide = ((16*hZoomTable[realy])/0x40);
1088                  UINT32 incx = 0x8000000 / hZoomTable[realy];
1088               YLOOP_START
10891089
10901090
10911091                  if (used_flipx)
10921092                  {
1093                     for (int x = 0; x < blockwide; x++)
1094                     {
1095                        const int drawx = pixelOffsetX+x;
1096                        if ((drawx>=495 || drawx<0)) continue;
1097                        int realx = ((x*incx)>>21);
1093                     XLOOP_START
10981094
10991095                        UINT16 pix = tempshape[realx*16+(15-realy)];
11001096                        DRAW_PIX
r21324r21325
11021098                  }
11031099                  else
11041100                  {
1105                     for (int x = 0; x < blockwide; x++)
1106                     {
1107                        const int drawx = pixelOffsetX+x;
1108                        if ((drawx>=495 || drawx<0)) continue;
1109                        int realx = ((x*incx)>>21);
1101                     XLOOP_START
11101102
11111103                        UINT16 pix = tempshape[realx*16+realy];
11121104                        DRAW_PIX
r21324r21325
11191111         {
11201112            if (used_flipy)
11211113            {
1122               for (int y = 0; y < blockhigh; y++)
1123               {
1124                  int realy = ((y*incy)>>21);
1125                  if (!hZoomTable[realy])
1126                     continue;
1127                  const int pixelOffsetX = ((hPositionTable[realy]) + (h* 16 * hZoomTable[realy])) / 0x40;
1128                  const int drawy = pixelOffsetY+y;
1129                  if ((drawy>383) || (drawy<0)) continue;
1130                  line = &drawbitmap->pix32(drawy);
1131                  int blockwide = ((16*hZoomTable[realy])/0x40);
1132                  UINT32 incx = 0x8000000 / hZoomTable[realy];
1114               YLOOP_START
11331115
1134
11351116                  if (used_flipx)
11361117                  {
1137                     for (int x = 0; x < blockwide; x++)
1138                     {
1139                        const int drawx = pixelOffsetX+x;
1140                        if ((drawx>=495 || drawx<0)) continue;
1141                        int realx = ((x*incx)>>21);
1118                     XLOOP_START
11421119
11431120                        UINT16 pix = tempshape[(15-realy)*16+(15-realx)];
11441121                        DRAW_PIX
r21324r21325
11461123                  }
11471124                  else
11481125                  {
1149                     for (int x = 0; x < blockwide; x++)
1150                     {
1151                        const int drawx = pixelOffsetX+x;
1152                        if ((drawx>=495 || drawx<0)) continue;
1153                        int realx = ((x*incx)>>21);
1126                     XLOOP_START
11541127                        UINT16 pix = tempshape[(15-realy)*16+realx];
11551128                        DRAW_PIX
11561129                     }
r21324r21325
11591132            }
11601133            else // no rotate, no flipy
11611134            {
1162               for (int y = 0; y < blockhigh; y++)
1163               {
1164                  int realy = ((y*incy)>>21);
1165                  if (!hZoomTable[realy])
1166                     continue;
1167                  const int pixelOffsetX = ((hPositionTable[realy]) + (h* 16 * hZoomTable[realy])) / 0x40;
1168                  const int drawy = pixelOffsetY+y;
1169                  if ((drawy>383) || (drawy<0)) continue;
1170                  line = &drawbitmap->pix32(drawy);
1171                  int blockwide = ((16*hZoomTable[realy])/0x40);
1172                  UINT32 incx = 0x8000000 / hZoomTable[realy];
1135               YLOOP_START
11731136
11741137
11751138                  if (used_flipx)
11761139                  {
1177                     for (int x = 0; x < blockwide; x++)
1178                     {
1179                        const int drawx = pixelOffsetX+x;
1180                        if ((drawx>=495 || drawx<0)) continue;
1181                        int realx = ((x*incx)>>21);
1140                     XLOOP_START
11821141
11831142                        UINT16 pix = tempshape[realy*16+(15-realx)];
11841143                        DRAW_PIX
11851144                     }
11861145                  }
1187
1188
1189
11901146                  else // no rotate, no flipy, no flipx
11911147                  {
1192                     for (int x = 0; x < blockwide; x++)
1193                     {
1194                        const int drawx = pixelOffsetX+x;
1195                        if ((drawx>=495 || drawx<0)) continue;
1196                        int realx = ((x*incx)>>21);
1148                     XLOOP_START
11971149
11981150                        UINT16 pix = tempshape[realy*16+realx];
11991151                        DRAW_PIX
r21324r21325
12011153                  }
12021154               }
12031155            }
1156
1157
12041158         }
12051159      }
12061160   }

Previous 199869 Revisions Next


© 1997-2024 The MAME Team