Previous 199869 Revisions Next

r20370 Sunday 20th January, 2013 at 13:21:39 UTC by smf
change the rendering back to quads as less people complained about the old graphical issues compares to the new ones [smf]
[src/emu/video]psx.c

trunk/src/emu/video/psx.c
r20369r20370
7373{
7474}
7575
76static const UINT16 p_n_rightpointlist[] = { 1, 2, 0 };
77static const UINT16 p_n_leftpointlist[] = { 2, 0, 1 };
76static const UINT16 m_p_n_nextpointlist4[] = { 1, 3, 0, 2 };
77static const UINT16 m_p_n_prevpointlist4[] = { 2, 0, 3, 1 };
78static const UINT16 m_p_n_nextpointlist3[] = { 1, 2, 0 };
79static const UINT16 m_p_n_prevpointlist3[] = { 2, 0, 1 };
7880
7981#define SINT11( x ) ( ( (INT32)( x ) << 21 ) >> 21 )
8082
81#define COORD_X( a ) ( a.sw.l )
82#define COORD_Y( a ) ( a.sw.h )
83#define COORD_DX( a ) ( n_drawoffset_x + a.sw.l )
84#define COORD_DY( a ) ( n_drawoffset_y + a.sw.h )
83#define ADJUST_COORD( a ) \
84   a.w.l = COORD_X( a ) + n_drawoffset_x; \
85   a.w.h = COORD_Y( a ) + n_drawoffset_y;
86
87#define COORD_X( a ) ( (INT16)a.w.l )
88#define COORD_Y( a ) ( (INT16)a.w.h )
8589#define SIZE_W( a ) ( a.w.l )
8690#define SIZE_H( a ) ( a.w.h )
8791#define BGR_C( a ) ( a.b.h3 )
r20369r20370
12621266      } \
12631267   }
12641268
1265void psxgpu_device::FlatPolygon( int n_startpoint )
1269void psxgpu_device::FlatPolygon( int n_points )
12661270{
12671271   INT16 n_y;
12681272   INT16 n_x;
r20369r20370
12861290   UINT8 n_cmd;
12871291
12881292   INT32 n_distance;
1293
12891294   UINT16 n_point;
12901295   UINT16 n_rightpoint;
12911296   UINT16 n_leftpoint;
1297   const UINT16 *p_n_rightpointlist;
1298   const UINT16 *p_n_leftpointlist;
1299
12921300   UINT16 *p_vram;
1293   struct FLATVERTEX *vertex = &m_packet.FlatPolygon.vertex[ n_startpoint ];
12941301
12951302#if defined( MAME_DEBUG )
12961303   if( m_debug.n_skip == 1 )
12971304   {
12981305      return;
12991306   }
1300   for( n_point = 0; n_point < 3; n_point++ )
1307   for( n_point = 0; n_point < n_points; n_point++ )
13011308   {
1302      DebugMesh( COORD_DX( vertex[ n_point ].n_coord ), COORD_DY( vertex[ n_point ].n_coord ) );
1309      DebugMesh( COORD_X( m_packet.FlatPolygon.vertex[ n_point ].n_coord ) + n_drawoffset_x, COORD_Y( m_packet.FlatPolygon.vertex[ n_point ].n_coord ) + n_drawoffset_y );
13031310   }
13041311   DebugMeshEnd();
13051312#endif
r20369r20370
13151322   n_g.w.h = BGR_G( m_packet.FlatPolygon.n_bgr ); n_g.w.l = 0;
13161323   n_b.w.h = BGR_B( m_packet.FlatPolygon.n_bgr ); n_b.w.l = 0;
13171324
1325   if( n_points == 4 )
1326   {
1327      p_n_rightpointlist = m_p_n_nextpointlist4;
1328      p_n_leftpointlist = m_p_n_prevpointlist4;
1329   }
1330   else
1331   {
1332      p_n_rightpointlist = m_p_n_nextpointlist3;
1333      p_n_leftpointlist = m_p_n_prevpointlist3;
1334   }
1335
1336   for( n_point = 0; n_point < n_points; n_point++ )
1337   {
1338      ADJUST_COORD( m_packet.FlatPolygon.vertex[ n_point ].n_coord );
1339   }
1340
13181341   n_leftpoint = 0;
1319   for( n_point = 1; n_point < 3; n_point++ )
1342   for( n_point = 1; n_point < n_points; n_point++ )
13201343   {
1321      if( COORD_DY( vertex[ n_point ].n_coord ) < COORD_DY( vertex[ n_leftpoint ].n_coord ) ||
1322         ( COORD_DY( vertex[ n_point ].n_coord ) == COORD_DY( vertex[ n_leftpoint ].n_coord ) &&
1323         COORD_DX( vertex[ n_point ].n_coord ) < COORD_DX( vertex[ n_leftpoint ].n_coord ) ) )
1344      if( COORD_Y( m_packet.FlatPolygon.vertex[ n_point ].n_coord ) < COORD_Y( m_packet.FlatPolygon.vertex[ n_leftpoint ].n_coord ) ||
1345         ( COORD_Y( m_packet.FlatPolygon.vertex[ n_point ].n_coord ) == COORD_Y( m_packet.FlatPolygon.vertex[ n_leftpoint ].n_coord ) &&
1346         COORD_X( m_packet.FlatPolygon.vertex[ n_point ].n_coord ) < COORD_X( m_packet.FlatPolygon.vertex[ n_leftpoint ].n_coord ) ) )
13241347      {
13251348         n_leftpoint = n_point;
13261349      }
r20369r20370
13301353   n_dx1 = 0;
13311354   n_dx2 = 0;
13321355
1333   n_y = COORD_DY( vertex[ n_rightpoint ].n_coord );
1356   n_y = COORD_Y( m_packet.FlatPolygon.vertex[ n_rightpoint ].n_coord );
13341357
13351358   for( ;; )
13361359   {
r20369r20370
13391362         return;
13401363      }
13411364
1342      if( n_y == COORD_DY( vertex[ n_leftpoint ].n_coord ) )
1365      if( n_y == COORD_Y( m_packet.FlatPolygon.vertex[ n_leftpoint ].n_coord ) )
13431366      {
1344         while( n_y == COORD_DY( vertex[ p_n_leftpointlist[ n_leftpoint ] ].n_coord ) )
1367         while( n_y == COORD_Y( m_packet.FlatPolygon.vertex[ p_n_leftpointlist[ n_leftpoint ] ].n_coord ) )
13451368         {
13461369            n_leftpoint = p_n_leftpointlist[ n_leftpoint ];
13471370            if( n_leftpoint == n_rightpoint )
r20369r20370
13491372               break;
13501373            }
13511374         }
1352         n_cx1.w.h = COORD_DX( vertex[ n_leftpoint ].n_coord ); n_cx1.w.l = 0;
1375         n_cx1.w.h = COORD_X( m_packet.FlatPolygon.vertex[ n_leftpoint ].n_coord ); n_cx1.w.l = 0;
13531376         n_leftpoint = p_n_leftpointlist[ n_leftpoint ];
1354         n_distance = COORD_DY( vertex[ n_leftpoint ].n_coord ) - n_y;
1377         n_distance = COORD_Y( m_packet.FlatPolygon.vertex[ n_leftpoint ].n_coord ) - n_y;
13551378         if( n_distance < 1 )
13561379         {
13571380            break;
13581381         }
1359         n_dx1 = (INT32)( ( COORD_DX( vertex[ n_leftpoint ].n_coord ) << 16 ) - n_cx1.d ) / n_distance;
1382         n_dx1 = (INT32)( ( COORD_X( m_packet.FlatPolygon.vertex[ n_leftpoint ].n_coord ) << 16 ) - n_cx1.d ) / n_distance;
13601383      }
1361      if( n_y == COORD_DY( vertex[ n_rightpoint ].n_coord ) )
1384      if( n_y == COORD_Y( m_packet.FlatPolygon.vertex[ n_rightpoint ].n_coord ) )
13621385      {
1363         while( n_y == COORD_DY( vertex[ p_n_rightpointlist[ n_rightpoint ] ].n_coord ) )
1386         while( n_y == COORD_Y( m_packet.FlatPolygon.vertex[ p_n_rightpointlist[ n_rightpoint ] ].n_coord ) )
13641387         {
13651388            n_rightpoint = p_n_rightpointlist[ n_rightpoint ];
13661389            if( n_rightpoint == n_leftpoint )
r20369r20370
13681391               break;
13691392            }
13701393         }
1371         n_cx2.w.h = COORD_DX( vertex[ n_rightpoint ].n_coord ); n_cx2.w.l = 0;
1394         n_cx2.w.h = COORD_X( m_packet.FlatPolygon.vertex[ n_rightpoint ].n_coord ); n_cx2.w.l = 0;
13721395         n_rightpoint = p_n_rightpointlist[ n_rightpoint ];
1373         n_distance = COORD_DY( vertex[ n_rightpoint ].n_coord ) - n_y;
1396         n_distance = COORD_Y( m_packet.FlatPolygon.vertex[ n_rightpoint ].n_coord ) - n_y;
13741397         if( n_distance < 1 )
13751398         {
13761399            break;
13771400         }
1378         n_dx2 = (INT32)( ( COORD_DX( vertex[ n_rightpoint ].n_coord ) << 16 ) - n_cx2.d ) / n_distance;
1401         n_dx2 = (INT32)( ( COORD_X( m_packet.FlatPolygon.vertex[ n_rightpoint ].n_coord ) << 16 ) - n_cx2.d ) / n_distance;
13791402      }
13801403      if( (INT16)n_cx1.w.h != (INT16)n_cx2.w.h && n_y >= (INT32)n_drawarea_y1 && n_y <= (INT32)n_drawarea_y2 )
13811404      {
r20369r20370
14031426   }
14041427}
14051428
1406void psxgpu_device::FlatTexturedPolygon( int n_startpoint )
1429void psxgpu_device::FlatTexturedPolygon( int n_points )
14071430{
14081431   INT16 n_y;
14091432   INT16 n_x;
r20369r20370
14481471   UINT16 n_point;
14491472   UINT16 n_rightpoint;
14501473   UINT16 n_leftpoint;
1474   const UINT16 *p_n_rightpointlist;
1475   const UINT16 *p_n_leftpointlist;
14511476   UINT16 *p_clut;
14521477   UINT16 *p_vram;
14531478   UINT32 n_bgr;
1454   struct FLATTEXTUREDVERTEX *vertex = &m_packet.FlatTexturedPolygon.vertex[ n_startpoint ];
14551479
14561480#if defined( MAME_DEBUG )
14571481   if( m_debug.n_skip == 2 )
14581482   {
14591483      return;
14601484   }
1461   for( n_point = 0; n_point < 3; n_point++ )
1485   for( n_point = 0; n_point < n_points; n_point++ )
14621486   {
1463      DebugMesh( COORD_DX( vertex[ n_point ].n_coord ), COORD_DY( vertex[ n_point ].n_coord ) );
1487      DebugMesh( COORD_X( m_packet.FlatTexturedPolygon.vertex[ n_point ].n_coord ) + n_drawoffset_x, COORD_Y( m_packet.FlatTexturedPolygon.vertex[ n_point ].n_coord ) + n_drawoffset_y );
14641488   }
14651489   DebugMeshEnd();
14661490#endif
r20369r20370
14971521      break;
14981522   }
14991523
1524   if( n_points == 4 )
1525   {
1526      p_n_rightpointlist = m_p_n_nextpointlist4;
1527      p_n_leftpointlist = m_p_n_prevpointlist4;
1528   }
1529   else
1530   {
1531      p_n_rightpointlist = m_p_n_nextpointlist3;
1532      p_n_leftpointlist = m_p_n_prevpointlist3;
1533   }
1534
1535   for( n_point = 0; n_point < n_points; n_point++ )
1536   {
1537      ADJUST_COORD( m_packet.FlatTexturedPolygon.vertex[ n_point ].n_coord );
1538   }
1539
15001540   n_leftpoint = 0;
1501   for( n_point = 1; n_point < 3; n_point++ )
1541   for( n_point = 1; n_point < n_points; n_point++ )
15021542   {
1503      if( COORD_DY( vertex[ n_point ].n_coord ) < COORD_DY( vertex[ n_leftpoint ].n_coord ) ||
1504         ( COORD_DY( vertex[ n_point ].n_coord ) == COORD_DY( vertex[ n_leftpoint ].n_coord ) &&
1505         COORD_DX( vertex[ n_point ].n_coord ) < COORD_DX( vertex[ n_leftpoint ].n_coord ) ) )
1543      if( COORD_Y( m_packet.FlatTexturedPolygon.vertex[ n_point ].n_coord ) < COORD_Y( m_packet.FlatTexturedPolygon.vertex[ n_leftpoint ].n_coord ) ||
1544         ( COORD_Y( m_packet.FlatTexturedPolygon.vertex[ n_point ].n_coord ) == COORD_Y( m_packet.FlatTexturedPolygon.vertex[ n_leftpoint ].n_coord ) &&
1545         COORD_X( m_packet.FlatTexturedPolygon.vertex[ n_point ].n_coord ) < COORD_X( m_packet.FlatTexturedPolygon.vertex[ n_leftpoint ].n_coord ) ) )
15061546      {
15071547         n_leftpoint = n_point;
15081548      }
r20369r20370
15161556   n_dv1 = 0;
15171557   n_dv2 = 0;
15181558
1519   n_y = COORD_DY( vertex[ n_rightpoint ].n_coord );
1559   n_y = COORD_Y( m_packet.FlatTexturedPolygon.vertex[ n_rightpoint ].n_coord );
15201560
15211561   for( ;; )
15221562   {
r20369r20370
15251565         return;
15261566      }
15271567
1528      if( n_y == COORD_DY( vertex[ n_leftpoint ].n_coord ) )
1568      if( n_y == COORD_Y( m_packet.FlatTexturedPolygon.vertex[ n_leftpoint ].n_coord ) )
15291569      {
1530         while( n_y == COORD_DY( vertex[ p_n_leftpointlist[ n_leftpoint ] ].n_coord ) )
1570         while( n_y == COORD_Y( m_packet.FlatTexturedPolygon.vertex[ p_n_leftpointlist[ n_leftpoint ] ].n_coord ) )
15311571         {
15321572            n_leftpoint = p_n_leftpointlist[ n_leftpoint ];
15331573            if( n_leftpoint == n_rightpoint )
r20369r20370
15351575               break;
15361576            }
15371577         }
1538         n_cx1.w.h = COORD_DX( vertex[ n_leftpoint ].n_coord ); n_cx1.w.l = 0;
1539         n_cu1.w.h = TEXTURE_U( vertex[ n_leftpoint ].n_texture ); n_cu1.w.l = 0;
1540         n_cv1.w.h = TEXTURE_V( vertex[ n_leftpoint ].n_texture ); n_cv1.w.l = 0;
1578         n_cx1.w.h = COORD_X( m_packet.FlatTexturedPolygon.vertex[ n_leftpoint ].n_coord ); n_cx1.w.l = 0;
1579         n_cu1.w.h = TEXTURE_U( m_packet.FlatTexturedPolygon.vertex[ n_leftpoint ].n_texture ); n_cu1.w.l = 0;
1580         n_cv1.w.h = TEXTURE_V( m_packet.FlatTexturedPolygon.vertex[ n_leftpoint ].n_texture ); n_cv1.w.l = 0;
15411581         n_leftpoint = p_n_leftpointlist[ n_leftpoint ];
1542         n_distance = COORD_DY( vertex[ n_leftpoint ].n_coord ) - n_y;
1582         n_distance = COORD_Y( m_packet.FlatTexturedPolygon.vertex[ n_leftpoint ].n_coord ) - n_y;
15431583         if( n_distance < 1 )
15441584         {
15451585            break;
15461586         }
1547         n_dx1 = (INT32)( ( COORD_DX( vertex[ n_leftpoint ].n_coord ) << 16 ) - n_cx1.d ) / n_distance;
1548         n_du1 = (INT32)( ( TEXTURE_U( vertex[ n_leftpoint ].n_texture ) << 16 ) - n_cu1.d ) / n_distance;
1549         n_dv1 = (INT32)( ( TEXTURE_V( vertex[ n_leftpoint ].n_texture ) << 16 ) - n_cv1.d ) / n_distance;
1587         n_dx1 = (INT32)( ( COORD_X( m_packet.FlatTexturedPolygon.vertex[ n_leftpoint ].n_coord ) << 16 ) - n_cx1.d ) / n_distance;
1588         n_du1 = (INT32)( ( TEXTURE_U( m_packet.FlatTexturedPolygon.vertex[ n_leftpoint ].n_texture ) << 16 ) - n_cu1.d ) / n_distance;
1589         n_dv1 = (INT32)( ( TEXTURE_V( m_packet.FlatTexturedPolygon.vertex[ n_leftpoint ].n_texture ) << 16 ) - n_cv1.d ) / n_distance;
15501590      }
1551      if( n_y == COORD_DY( vertex[ n_rightpoint ].n_coord ) )
1591      if( n_y == COORD_Y( m_packet.FlatTexturedPolygon.vertex[ n_rightpoint ].n_coord ) )
15521592      {
1553         while( n_y == COORD_DY( vertex[ p_n_rightpointlist[ n_rightpoint ] ].n_coord ) )
1593         while( n_y == COORD_Y( m_packet.FlatTexturedPolygon.vertex[ p_n_rightpointlist[ n_rightpoint ] ].n_coord ) )
15541594         {
15551595            n_rightpoint = p_n_rightpointlist[ n_rightpoint ];
15561596            if( n_rightpoint == n_leftpoint )
r20369r20370
15581598               break;
15591599            }
15601600         }
1561         n_cx2.w.h = COORD_DX( vertex[ n_rightpoint ].n_coord ); n_cx2.w.l = 0;
1562         n_cu2.w.h = TEXTURE_U( vertex[ n_rightpoint ].n_texture ); n_cu2.w.l = 0;
1563         n_cv2.w.h = TEXTURE_V( vertex[ n_rightpoint ].n_texture ); n_cv2.w.l = 0;
1601         n_cx2.w.h = COORD_X( m_packet.FlatTexturedPolygon.vertex[ n_rightpoint ].n_coord ); n_cx2.w.l = 0;
1602         n_cu2.w.h = TEXTURE_U( m_packet.FlatTexturedPolygon.vertex[ n_rightpoint ].n_texture ); n_cu2.w.l = 0;
1603         n_cv2.w.h = TEXTURE_V( m_packet.FlatTexturedPolygon.vertex[ n_rightpoint ].n_texture ); n_cv2.w.l = 0;
15641604         n_rightpoint = p_n_rightpointlist[ n_rightpoint ];
1565         n_distance = COORD_DY( vertex[ n_rightpoint ].n_coord ) - n_y;
1605         n_distance = COORD_Y( m_packet.FlatTexturedPolygon.vertex[ n_rightpoint ].n_coord ) - n_y;
15661606         if( n_distance < 1 )
15671607         {
15681608            break;
15691609         }
1570         n_dx2 = (INT32)( ( COORD_DX( vertex[ n_rightpoint ].n_coord ) << 16 ) - n_cx2.d ) / n_distance;
1571         n_du2 = (INT32)( ( TEXTURE_U( vertex[ n_rightpoint ].n_texture ) << 16 ) - n_cu2.d ) / n_distance;
1572         n_dv2 = (INT32)( ( TEXTURE_V( vertex[ n_rightpoint ].n_texture ) << 16 ) - n_cv2.d ) / n_distance;
1610         n_dx2 = (INT32)( ( COORD_X( m_packet.FlatTexturedPolygon.vertex[ n_rightpoint ].n_coord ) << 16 ) - n_cx2.d ) / n_distance;
1611         n_du2 = (INT32)( ( TEXTURE_U( m_packet.FlatTexturedPolygon.vertex[ n_rightpoint ].n_texture ) << 16 ) - n_cu2.d ) / n_distance;
1612         n_dv2 = (INT32)( ( TEXTURE_V( m_packet.FlatTexturedPolygon.vertex[ n_rightpoint ].n_texture ) << 16 ) - n_cv2.d ) / n_distance;
15731613      }
15741614      if( (INT16)n_cx1.w.h != (INT16)n_cx2.w.h && n_y >= (INT32)n_drawarea_y1 && n_y <= (INT32)n_drawarea_y2 )
15751615      {
r20369r20370
16131653   }
16141654}
16151655
1616void psxgpu_device::GouraudPolygon( int n_startpoint )
1656void psxgpu_device::GouraudPolygon( int n_points )
16171657{
16181658   INT16 n_y;
16191659   INT16 n_x;
r20369r20370
16521692   INT32 n_db2;
16531693
16541694   INT32 n_distance;
1695
16551696   UINT16 n_point;
16561697   UINT16 n_rightpoint;
16571698   UINT16 n_leftpoint;
1699   const UINT16 *p_n_rightpointlist;
1700   const UINT16 *p_n_leftpointlist;
1701
16581702   UINT16 *p_vram;
1659   struct GOURAUDVERTEX *vertex = &m_packet.GouraudPolygon.vertex[ n_startpoint ];
16601703
16611704#if defined( MAME_DEBUG )
16621705   if( m_debug.n_skip == 3 )
16631706   {
16641707      return;
16651708   }
1666   for( n_point = 0; n_point < 3; n_point++ )
1709   for( n_point = 0; n_point < n_points; n_point++ )
16671710   {
1668      DebugMesh( COORD_DX( vertex[ n_point ].n_coord ), COORD_DY( vertex[ n_point ].n_coord ) );
1711      DebugMesh( COORD_X( m_packet.GouraudPolygon.vertex[ n_point ].n_coord ) + n_drawoffset_x, COORD_Y( m_packet.GouraudPolygon.vertex[ n_point ].n_coord ) + n_drawoffset_y );
16691712   }
16701713   DebugMeshEnd();
16711714#endif
r20369r20370
16831726
16841727   SOLIDSETUP
16851728
1729   if( n_points == 4 )
1730   {
1731      p_n_rightpointlist = m_p_n_nextpointlist4;
1732      p_n_leftpointlist = m_p_n_prevpointlist4;
1733   }
1734   else
1735   {
1736      p_n_rightpointlist = m_p_n_nextpointlist3;
1737      p_n_leftpointlist = m_p_n_prevpointlist3;
1738   }
1739
1740   for( n_point = 0; n_point < n_points; n_point++ )
1741   {
1742      ADJUST_COORD( m_packet.GouraudPolygon.vertex[ n_point ].n_coord );
1743   }
1744
16861745   n_leftpoint = 0;
1687   for( n_point = 1; n_point < 3; n_point++ )
1746   for( n_point = 1; n_point < n_points; n_point++ )
16881747   {
1689      if( COORD_DY( vertex[ n_point ].n_coord ) < COORD_DY( vertex[ n_leftpoint ].n_coord ) ||
1690         ( COORD_DY( vertex[ n_point ].n_coord ) == COORD_DY( vertex[ n_leftpoint ].n_coord ) &&
1691         COORD_DX( vertex[ n_point ].n_coord ) < COORD_DX( vertex[ n_leftpoint ].n_coord ) ) )
1748      if( COORD_Y( m_packet.GouraudPolygon.vertex[ n_point ].n_coord ) < COORD_Y( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_coord ) ||
1749         ( COORD_Y( m_packet.GouraudPolygon.vertex[ n_point ].n_coord ) == COORD_Y( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_coord ) &&
1750         COORD_X( m_packet.GouraudPolygon.vertex[ n_point ].n_coord ) < COORD_X( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_coord ) ) )
16921751      {
16931752         n_leftpoint = n_point;
16941753      }
r20369r20370
17041763   n_db1 = 0;
17051764   n_db2 = 0;
17061765
1707   n_y = COORD_DY( vertex[ n_rightpoint ].n_coord );
1766   n_y = COORD_Y( m_packet.GouraudPolygon.vertex[ n_rightpoint ].n_coord );
17081767
17091768   for( ;; )
17101769   {
r20369r20370
17131772         return;
17141773      }
17151774
1716      if( n_y == COORD_DY( vertex[ n_leftpoint ].n_coord ) )
1775      if( n_y == COORD_Y( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_coord ) )
17171776      {
1718         while( n_y == COORD_DY( vertex[ p_n_leftpointlist[ n_leftpoint ] ].n_coord ) )
1777         while( n_y == COORD_Y( m_packet.GouraudPolygon.vertex[ p_n_leftpointlist[ n_leftpoint ] ].n_coord ) )
17191778         {
17201779            n_leftpoint = p_n_leftpointlist[ n_leftpoint ];
17211780            if( n_leftpoint == n_rightpoint )
r20369r20370
17231782               break;
17241783            }
17251784         }
1726         n_cx1.w.h = COORD_DX( vertex[ n_leftpoint ].n_coord ); n_cx1.w.l = 0;
1727         n_cr1.w.h = BGR_R( vertex[ n_leftpoint ].n_bgr ); n_cr1.w.l = 0;
1728         n_cg1.w.h = BGR_G( vertex[ n_leftpoint ].n_bgr ); n_cg1.w.l = 0;
1729         n_cb1.w.h = BGR_B( vertex[ n_leftpoint ].n_bgr ); n_cb1.w.l = 0;
1785         n_cx1.w.h = COORD_X( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_coord ); n_cx1.w.l = 0;
1786         n_cr1.w.h = BGR_R( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_bgr ); n_cr1.w.l = 0;
1787         n_cg1.w.h = BGR_G( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_bgr ); n_cg1.w.l = 0;
1788         n_cb1.w.h = BGR_B( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_bgr ); n_cb1.w.l = 0;
17301789         n_leftpoint = p_n_leftpointlist[ n_leftpoint ];
1731         n_distance = COORD_DY( vertex[ n_leftpoint ].n_coord ) - n_y;
1790         n_distance = COORD_Y( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_coord ) - n_y;
17321791         if( n_distance < 1 )
17331792         {
17341793            break;
17351794         }
1736         n_dx1 = (INT32)( ( COORD_DX( vertex[ n_leftpoint ].n_coord ) << 16 ) - n_cx1.d ) / n_distance;
1737         n_dr1 = (INT32)( ( BGR_R( vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cr1.d ) / n_distance;
1738         n_dg1 = (INT32)( ( BGR_G( vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cg1.d ) / n_distance;
1739         n_db1 = (INT32)( ( BGR_B( vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cb1.d ) / n_distance;
1795         n_dx1 = (INT32)( ( COORD_X( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_coord ) << 16 ) - n_cx1.d ) / n_distance;
1796         n_dr1 = (INT32)( ( BGR_R( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cr1.d ) / n_distance;
1797         n_dg1 = (INT32)( ( BGR_G( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cg1.d ) / n_distance;
1798         n_db1 = (INT32)( ( BGR_B( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cb1.d ) / n_distance;
17401799      }
1741      if( n_y == COORD_DY( vertex[ n_rightpoint ].n_coord ) )
1800      if( n_y == COORD_Y( m_packet.GouraudPolygon.vertex[ n_rightpoint ].n_coord ) )
17421801      {
1743         while( n_y == COORD_DY( vertex[ p_n_rightpointlist[ n_rightpoint ] ].n_coord ) )
1802         while( n_y == COORD_Y( m_packet.GouraudPolygon.vertex[ p_n_rightpointlist[ n_rightpoint ] ].n_coord ) )
17441803         {
17451804            n_rightpoint = p_n_rightpointlist[ n_rightpoint ];
17461805            if( n_rightpoint == n_leftpoint )
r20369r20370
17481807               break;
17491808            }
17501809         }
1751         n_cx2.w.h = COORD_DX( vertex[ n_rightpoint ].n_coord ); n_cx2.w.l = 0;
1752         n_cr2.w.h = BGR_R( vertex[ n_rightpoint ].n_bgr ); n_cr2.w.l = 0;
1753         n_cg2.w.h = BGR_G( vertex[ n_rightpoint ].n_bgr ); n_cg2.w.l = 0;
1754         n_cb2.w.h = BGR_B( vertex[ n_rightpoint ].n_bgr ); n_cb2.w.l = 0;
1810         n_cx2.w.h = COORD_X( m_packet.GouraudPolygon.vertex[ n_rightpoint ].n_coord ); n_cx2.w.l = 0;
1811         n_cr2.w.h = BGR_R( m_packet.GouraudPolygon.vertex[ n_rightpoint ].n_bgr ); n_cr2.w.l = 0;
1812         n_cg2.w.h = BGR_G( m_packet.GouraudPolygon.vertex[ n_rightpoint ].n_bgr ); n_cg2.w.l = 0;
1813         n_cb2.w.h = BGR_B( m_packet.GouraudPolygon.vertex[ n_rightpoint ].n_bgr ); n_cb2.w.l = 0;
17551814         n_rightpoint = p_n_rightpointlist[ n_rightpoint ];
1756         n_distance = COORD_DY( vertex[ n_rightpoint ].n_coord ) - n_y;
1815         n_distance = COORD_Y( m_packet.GouraudPolygon.vertex[ n_rightpoint ].n_coord ) - n_y;
17571816         if( n_distance < 1 )
17581817         {
17591818            break;
17601819         }
1761         n_dx2 = (INT32)( ( COORD_DX( vertex[ n_rightpoint ].n_coord ) << 16 ) - n_cx2.d ) / n_distance;
1762         n_dr2 = (INT32)( ( BGR_R( vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cr2.d ) / n_distance;
1763         n_dg2 = (INT32)( ( BGR_G( vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cg2.d ) / n_distance;
1764         n_db2 = (INT32)( ( BGR_B( vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cb2.d ) / n_distance;
1820         n_dx2 = (INT32)( ( COORD_X( m_packet.GouraudPolygon.vertex[ n_rightpoint ].n_coord ) << 16 ) - n_cx2.d ) / n_distance;
1821         n_dr2 = (INT32)( ( BGR_R( m_packet.GouraudPolygon.vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cr2.d ) / n_distance;
1822         n_dg2 = (INT32)( ( BGR_G( m_packet.GouraudPolygon.vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cg2.d ) / n_distance;
1823         n_db2 = (INT32)( ( BGR_B( m_packet.GouraudPolygon.vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cb2.d ) / n_distance;
17651824      }
17661825      if( (INT16)n_cx1.w.h != (INT16)n_cx2.w.h && n_y >= (INT32)n_drawarea_y1 && n_y <= (INT32)n_drawarea_y2 )
17671826      {
r20369r20370
18121871   }
18131872}
18141873
1815void psxgpu_device::GouraudTexturedPolygon( int n_startpoint )
1874void psxgpu_device::GouraudTexturedPolygon( int n_points )
18161875{
18171876   INT16 n_y;
18181877   INT16 n_x;
r20369r20370
18721931   UINT16 n_point;
18731932   UINT16 n_rightpoint;
18741933   UINT16 n_leftpoint;
1934   const UINT16 *p_n_rightpointlist;
1935   const UINT16 *p_n_leftpointlist;
18751936   UINT16 *p_clut;
18761937   UINT16 *p_vram;
18771938   UINT32 n_bgr;
1878   struct GOURAUDTEXTUREDVERTEX *vertex = &m_packet.GouraudTexturedPolygon.vertex[ n_startpoint ];
18791939
18801940#if defined( MAME_DEBUG )
18811941   if( m_debug.n_skip == 4 )
18821942   {
18831943      return;
18841944   }
1885   for( n_point = 0; n_point < 3; n_point++ )
1945   for( n_point = 0; n_point < n_points; n_point++ )
18861946   {
1887      DebugMesh( COORD_DX( vertex[ n_point ].n_coord ), COORD_DY( vertex[ n_point ].n_coord ) );
1947      DebugMesh( COORD_X( m_packet.GouraudTexturedPolygon.vertex[ n_point ].n_coord ) + n_drawoffset_x, COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ n_point ].n_coord ) + n_drawoffset_y );
18881948   }
18891949   DebugMeshEnd();
18901950#endif
r20369r20370
19101970   decode_tpage( m_packet.GouraudTexturedPolygon.vertex[ 1 ].n_texture.w.h );
19111971   TEXTURESETUP
19121972
1973   if( n_points == 4 )
1974   {
1975      p_n_rightpointlist = m_p_n_nextpointlist4;
1976      p_n_leftpointlist = m_p_n_prevpointlist4;
1977   }
1978   else
1979   {
1980      p_n_rightpointlist = m_p_n_nextpointlist3;
1981      p_n_leftpointlist = m_p_n_prevpointlist3;
1982   }
1983
1984   for( n_point = 0; n_point < n_points; n_point++ )
1985   {
1986      ADJUST_COORD( m_packet.GouraudTexturedPolygon.vertex[ n_point ].n_coord );
1987   }
1988
19131989   n_leftpoint = 0;
1914   for( n_point = 1; n_point < 3; n_point++ )
1990   for( n_point = 1; n_point < n_points; n_point++ )
19151991   {
1916      if( COORD_DY( vertex[ n_point ].n_coord ) < COORD_DY( vertex[ n_leftpoint ].n_coord ) ||
1917         ( COORD_DY( vertex[ n_point ].n_coord ) == COORD_DY( vertex[ n_leftpoint ].n_coord ) &&
1918         COORD_DX( vertex[ n_point ].n_coord ) < COORD_DX( vertex[ n_leftpoint ].n_coord ) ) )
1992      if( COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ n_point ].n_coord ) < COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_coord ) ||
1993         ( COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ n_point ].n_coord ) == COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_coord ) &&
1994         COORD_X( m_packet.GouraudTexturedPolygon.vertex[ n_point ].n_coord ) < COORD_X( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_coord ) ) )
19191995      {
19201996         n_leftpoint = n_point;
19211997      }
r20369r20370
19352011   n_dv1 = 0;
19362012   n_dv2 = 0;
19372013
1938   n_y = COORD_DY( vertex[ n_rightpoint ].n_coord );
2014   n_y = COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_coord );
19392015
19402016   for( ;; )
19412017   {
r20369r20370
19442020         return;
19452021      }
19462022
1947      if( n_y == COORD_DY( vertex[ n_leftpoint ].n_coord ) )
2023      if( n_y == COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_coord ) )
19482024      {
1949         while( n_y == COORD_DY( vertex[ p_n_leftpointlist[ n_leftpoint ] ].n_coord ) )
2025         while( n_y == COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ p_n_leftpointlist[ n_leftpoint ] ].n_coord ) )
19502026         {
19512027            n_leftpoint = p_n_leftpointlist[ n_leftpoint ];
19522028            if( n_leftpoint == n_rightpoint )
r20369r20370
19542030               break;
19552031            }
19562032         }
1957         n_cx1.w.h = COORD_DX( vertex[ n_leftpoint ].n_coord ); n_cx1.w.l = 0;
2033         n_cx1.w.h = COORD_X( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_coord ); n_cx1.w.l = 0;
19582034         switch( n_cmd & 0x01 )
19592035         {
19602036         case 0x00:
1961            n_cr1.w.h = BGR_R( vertex[ n_leftpoint ].n_bgr ); n_cr1.w.l = 0;
1962            n_cg1.w.h = BGR_G( vertex[ n_leftpoint ].n_bgr ); n_cg1.w.l = 0;
1963            n_cb1.w.h = BGR_B( vertex[ n_leftpoint ].n_bgr ); n_cb1.w.l = 0;
2037            n_cr1.w.h = BGR_R( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_bgr ); n_cr1.w.l = 0;
2038            n_cg1.w.h = BGR_G( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_bgr ); n_cg1.w.l = 0;
2039            n_cb1.w.h = BGR_B( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_bgr ); n_cb1.w.l = 0;
19642040            break;
19652041         case 0x01:
19662042            n_cr1.w.h = 0x80; n_cr1.w.l = 0;
r20369r20370
19682044            n_cb1.w.h = 0x80; n_cb1.w.l = 0;
19692045            break;
19702046         }
1971         n_cu1.w.h = TEXTURE_U( vertex[ n_leftpoint ].n_texture ); n_cu1.w.l = 0;
1972         n_cv1.w.h = TEXTURE_V( vertex[ n_leftpoint ].n_texture ); n_cv1.w.l = 0;
2047         n_cu1.w.h = TEXTURE_U( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_texture ); n_cu1.w.l = 0;
2048         n_cv1.w.h = TEXTURE_V( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_texture ); n_cv1.w.l = 0;
19732049         n_leftpoint = p_n_leftpointlist[ n_leftpoint ];
1974         n_distance = COORD_DY( vertex[ n_leftpoint ].n_coord ) - n_y;
2050         n_distance = COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_coord ) - n_y;
19752051         if( n_distance < 1 )
19762052         {
19772053            break;
19782054         }
1979         n_dx1 = (INT32)( ( COORD_DX( vertex[ n_leftpoint ].n_coord ) << 16 ) - n_cx1.d ) / n_distance;
2055         n_dx1 = (INT32)( ( COORD_X( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_coord ) << 16 ) - n_cx1.d ) / n_distance;
19802056         switch( n_cmd & 0x01 )
19812057         {
19822058         case 0x00:
1983            n_dr1 = (INT32)( ( BGR_R( vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cr1.d ) / n_distance;
1984            n_dg1 = (INT32)( ( BGR_G( vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cg1.d ) / n_distance;
1985            n_db1 = (INT32)( ( BGR_B( vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cb1.d ) / n_distance;
2059            n_dr1 = (INT32)( ( BGR_R( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cr1.d ) / n_distance;
2060            n_dg1 = (INT32)( ( BGR_G( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cg1.d ) / n_distance;
2061            n_db1 = (INT32)( ( BGR_B( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cb1.d ) / n_distance;
19862062            break;
19872063         case 0x01:
19882064            n_dr1 = 0;
r20369r20370
19902066            n_db1 = 0;
19912067            break;
19922068         }
1993         n_du1 = (INT32)( ( TEXTURE_U( vertex[ n_leftpoint ].n_texture ) << 16 ) - n_cu1.d ) / n_distance;
1994         n_dv1 = (INT32)( ( TEXTURE_V( vertex[ n_leftpoint ].n_texture ) << 16 ) - n_cv1.d ) / n_distance;
2069         n_du1 = (INT32)( ( TEXTURE_U( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_texture ) << 16 ) - n_cu1.d ) / n_distance;
2070         n_dv1 = (INT32)( ( TEXTURE_V( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_texture ) << 16 ) - n_cv1.d ) / n_distance;
19952071      }
1996      if( n_y == COORD_DY( vertex[ n_rightpoint ].n_coord ) )
2072      if( n_y == COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_coord ) )
19972073      {
1998         while( n_y == COORD_DY( vertex[ p_n_rightpointlist[ n_rightpoint ] ].n_coord ) )
2074         while( n_y == COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ p_n_rightpointlist[ n_rightpoint ] ].n_coord ) )
19992075         {
20002076            n_rightpoint = p_n_rightpointlist[ n_rightpoint ];
20012077            if( n_rightpoint == n_leftpoint )
r20369r20370
20032079               break;
20042080            }
20052081         }
2006         n_cx2.w.h = COORD_DX( vertex[ n_rightpoint ].n_coord ); n_cx2.w.l = 0;
2082         n_cx2.w.h = COORD_X( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_coord ); n_cx2.w.l = 0;
20072083         switch( n_cmd & 0x01 )
20082084         {
20092085         case 0x00:
2010            n_cr2.w.h = BGR_R( vertex[ n_rightpoint ].n_bgr ); n_cr2.w.l = 0;
2011            n_cg2.w.h = BGR_G( vertex[ n_rightpoint ].n_bgr ); n_cg2.w.l = 0;
2012            n_cb2.w.h = BGR_B( vertex[ n_rightpoint ].n_bgr ); n_cb2.w.l = 0;
2086            n_cr2.w.h = BGR_R( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_bgr ); n_cr2.w.l = 0;
2087            n_cg2.w.h = BGR_G( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_bgr ); n_cg2.w.l = 0;
2088            n_cb2.w.h = BGR_B( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_bgr ); n_cb2.w.l = 0;
20132089            break;
20142090         case 0x01:
20152091            n_cr2.w.h = 0x80; n_cr2.w.l = 0;
r20369r20370
20172093            n_cb2.w.h = 0x80; n_cb2.w.l = 0;
20182094            break;
20192095         }
2020         n_cu2.w.h = TEXTURE_U( vertex[ n_rightpoint ].n_texture ); n_cu2.w.l = 0;
2021         n_cv2.w.h = TEXTURE_V( vertex[ n_rightpoint ].n_texture ); n_cv2.w.l = 0;
2096         n_cu2.w.h = TEXTURE_U( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_texture ); n_cu2.w.l = 0;
2097         n_cv2.w.h = TEXTURE_V( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_texture ); n_cv2.w.l = 0;
20222098         n_rightpoint = p_n_rightpointlist[ n_rightpoint ];
2023         n_distance = COORD_DY( vertex[ n_rightpoint ].n_coord ) - n_y;
2099         n_distance = COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_coord ) - n_y;
20242100         if( n_distance < 1 )
20252101         {
20262102            break;
20272103         }
2028         n_dx2 = (INT32)( ( COORD_DX( vertex[ n_rightpoint ].n_coord ) << 16 ) - n_cx2.d ) / n_distance;
2104         n_dx2 = (INT32)( ( COORD_X( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_coord ) << 16 ) - n_cx2.d ) / n_distance;
20292105         switch( n_cmd & 0x01 )
20302106         {
20312107         case 0x00:
2032            n_dr2 = (INT32)( ( BGR_R( vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cr2.d ) / n_distance;
2033            n_dg2 = (INT32)( ( BGR_G( vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cg2.d ) / n_distance;
2034            n_db2 = (INT32)( ( BGR_B( vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cb2.d ) / n_distance;
2108            n_dr2 = (INT32)( ( BGR_R( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cr2.d ) / n_distance;
2109            n_dg2 = (INT32)( ( BGR_G( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cg2.d ) / n_distance;
2110            n_db2 = (INT32)( ( BGR_B( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cb2.d ) / n_distance;
20352111            break;
20362112         case 0x01:
20372113            n_dr2 = 0;
r20369r20370
20392115            n_db2 = 0;
20402116            break;
20412117         }
2042         n_du2 = (INT32)( ( TEXTURE_U( vertex[ n_rightpoint ].n_texture ) << 16 ) - n_cu2.d ) / n_distance;
2043         n_dv2 = (INT32)( ( TEXTURE_V( vertex[ n_rightpoint ].n_texture ) << 16 ) - n_cv2.d ) / n_distance;
2118         n_du2 = (INT32)( ( TEXTURE_U( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_texture ) << 16 ) - n_cu2.d ) / n_distance;
2119         n_dv2 = (INT32)( ( TEXTURE_V( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_texture ) << 16 ) - n_cv2.d ) / n_distance;
20442120      }
20452121      if( (INT16)n_cx1.w.h != (INT16)n_cx2.w.h && n_y >= (INT32)n_drawarea_y1 && n_y <= (INT32)n_drawarea_y2 )
20462122      {
r20369r20370
21282204   {
21292205      return;
21302206   }
2131   DebugMesh( COORD_DX( m_packet.MonochromeLine.vertex[ 0 ].n_coord ), COORD_DY( m_packet.MonochromeLine.vertex[ 0 ].n_coord ) );
2132   DebugMesh( COORD_DX( m_packet.MonochromeLine.vertex[ 1 ].n_coord ), COORD_DY( m_packet.MonochromeLine.vertex[ 1 ].n_coord ) );
2207   DebugMesh( COORD_X( m_packet.MonochromeLine.vertex[ 0 ].n_coord ) + n_drawoffset_x, COORD_Y( m_packet.MonochromeLine.vertex[ 0 ].n_coord ) + n_drawoffset_y );
2208   DebugMesh( COORD_X( m_packet.MonochromeLine.vertex[ 1 ].n_coord ) + n_drawoffset_x, COORD_Y( m_packet.MonochromeLine.vertex[ 1 ].n_coord ) + n_drawoffset_y );
21332209   DebugMeshEnd();
21342210#endif
21352211
2136   n_xstart = COORD_DX( m_packet.MonochromeLine.vertex[ 0 ].n_coord );
2137   n_xend = COORD_DX( m_packet.MonochromeLine.vertex[ 1 ].n_coord );
2138   n_ystart = COORD_DY( m_packet.MonochromeLine.vertex[ 0 ].n_coord );
2139   n_yend = COORD_DY( m_packet.MonochromeLine.vertex[ 1 ].n_coord );
2212   n_xstart = COORD_X( m_packet.MonochromeLine.vertex[ 0 ].n_coord ) + n_drawoffset_x;
2213   n_xend = COORD_X( m_packet.MonochromeLine.vertex[ 1 ].n_coord ) + n_drawoffset_x;
2214   n_ystart = COORD_Y( m_packet.MonochromeLine.vertex[ 0 ].n_coord ) + n_drawoffset_y;
2215   n_yend = COORD_Y( m_packet.MonochromeLine.vertex[ 1 ].n_coord ) + n_drawoffset_y;
21402216
21412217   n_r = BGR_R( m_packet.MonochromeLine.n_bgr );
21422218   n_g = BGR_G( m_packet.MonochromeLine.n_bgr );
r20369r20370
22312307   {
22322308      return;
22332309   }
2234   DebugMesh( COORD_DX( m_packet.GouraudLine.vertex[ 0 ].n_coord ), COORD_DY( m_packet.GouraudLine.vertex[ 0 ].n_coord ) );
2235   DebugMesh( COORD_DX( m_packet.GouraudLine.vertex[ 1 ].n_coord ), COORD_DY( m_packet.GouraudLine.vertex[ 1 ].n_coord ) );
2310   DebugMesh( COORD_X( m_packet.GouraudLine.vertex[ 0 ].n_coord ) + n_drawoffset_x, COORD_Y( m_packet.GouraudLine.vertex[ 0 ].n_coord ) + n_drawoffset_y );
2311   DebugMesh( COORD_X( m_packet.GouraudLine.vertex[ 1 ].n_coord ) + n_drawoffset_x, COORD_Y( m_packet.GouraudLine.vertex[ 1 ].n_coord ) + n_drawoffset_y );
22362312   DebugMeshEnd();
22372313#endif
22382314
2239   n_xstart = COORD_DX( m_packet.GouraudLine.vertex[ 0 ].n_coord );
2240   n_ystart = COORD_DY( m_packet.GouraudLine.vertex[ 0 ].n_coord );
2315   n_xstart = COORD_X( m_packet.GouraudLine.vertex[ 0 ].n_coord ) + n_drawoffset_x;
2316   n_ystart = COORD_Y( m_packet.GouraudLine.vertex[ 0 ].n_coord ) + n_drawoffset_y;
22412317   n_cr1.w.h = BGR_R( m_packet.GouraudLine.vertex[ 0 ].n_bgr ); n_cr1.w.l = 0;
22422318   n_cg1.w.h = BGR_G( m_packet.GouraudLine.vertex[ 0 ].n_bgr ); n_cg1.w.l = 0;
22432319   n_cb1.w.h = BGR_B( m_packet.GouraudLine.vertex[ 0 ].n_bgr ); n_cb1.w.l = 0;
22442320
2245   n_xend = COORD_DX( m_packet.GouraudLine.vertex[ 1 ].n_coord );
2246   n_yend = COORD_DY( m_packet.GouraudLine.vertex[ 1 ].n_coord );
2321   n_xend = COORD_X( m_packet.GouraudLine.vertex[ 1 ].n_coord ) + n_drawoffset_x;
2322   n_yend = COORD_Y( m_packet.GouraudLine.vertex[ 1 ].n_coord ) + n_drawoffset_y;
22472323   n_cr2.w.h = BGR_R( m_packet.GouraudLine.vertex[ 1 ].n_bgr ); n_cr1.w.l = 0;
22482324   n_cg2.w.h = BGR_G( m_packet.GouraudLine.vertex[ 1 ].n_bgr ); n_cg1.w.l = 0;
22492325   n_cb2.w.h = BGR_B( m_packet.GouraudLine.vertex[ 1 ].n_bgr ); n_cb1.w.l = 0;
r20369r20370
23922468   {
23932469      return;
23942470   }
2395   DebugMesh( COORD_DX( m_packet.FlatRectangle.n_coord ), COORD_DY( m_packet.FlatRectangle.n_coord ) );
2396   DebugMesh( COORD_DX( m_packet.FlatRectangle.n_coord ) + SIZE_W( m_packet.FlatRectangle.n_size ), COORD_DY( m_packet.FlatRectangle.n_coord ) );
2397   DebugMesh( COORD_DX( m_packet.FlatRectangle.n_coord ), COORD_DY( m_packet.FlatRectangle.n_coord ) + SIZE_H( m_packet.FlatRectangle.n_size ) );
2398   DebugMesh( COORD_DX( m_packet.FlatRectangle.n_coord ) + SIZE_W( m_packet.FlatRectangle.n_size ), COORD_DY( m_packet.FlatRectangle.n_coord ) + SIZE_H( m_packet.FlatRectangle.n_size ) );
2471   DebugMesh( COORD_X( m_packet.FlatRectangle.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.FlatRectangle.n_coord ) + n_drawoffset_y );
2472   DebugMesh( COORD_X( m_packet.FlatRectangle.n_coord ) + n_drawoffset_x + SIZE_W( m_packet.FlatRectangle.n_size ), COORD_Y( m_packet.FlatRectangle.n_coord ) + n_drawoffset_y );
2473   DebugMesh( COORD_X( m_packet.FlatRectangle.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.FlatRectangle.n_coord ) + n_drawoffset_y + SIZE_H( m_packet.FlatRectangle.n_size ) );
2474   DebugMesh( COORD_X( m_packet.FlatRectangle.n_coord ) + n_drawoffset_x + SIZE_W( m_packet.FlatRectangle.n_size ), COORD_Y( m_packet.FlatRectangle.n_coord ) + n_drawoffset_y + SIZE_H( m_packet.FlatRectangle.n_size ) );
23992475   DebugMeshEnd();
24002476#endif
24012477
r20369r20370
24072483   n_g.w.h = BGR_G( m_packet.FlatRectangle.n_bgr ); n_g.w.l = 0;
24082484   n_b.w.h = BGR_B( m_packet.FlatRectangle.n_bgr ); n_b.w.l = 0;
24092485
2410   n_y = COORD_DY( m_packet.FlatRectangle.n_coord );
2486   n_y = COORD_Y( m_packet.FlatRectangle.n_coord ) + n_drawoffset_y;
24112487   n_h = SIZE_H( m_packet.FlatRectangle.n_size );
24122488
24132489   while( n_h > 0 )
24142490   {
2415      n_x = COORD_DX( m_packet.FlatRectangle.n_coord );
2491      n_x = COORD_X( m_packet.FlatRectangle.n_coord ) + n_drawoffset_x;
24162492
24172493      n_distance = SIZE_W( m_packet.FlatRectangle.n_size );
24182494      if( n_distance > 0 && n_y >= (INT32)n_drawarea_y1 && n_y <= (INT32)n_drawarea_y2 )
r20369r20370
24572533   {
24582534      return;
24592535   }
2460   DebugMesh( COORD_DX( m_packet.FlatRectangle8x8.n_coord ), COORD_DY( m_packet.FlatRectangle8x8.n_coord ) );
2461   DebugMesh( COORD_DX( m_packet.FlatRectangle8x8.n_coord ) + 8, COORD_DY( m_packet.FlatRectangle8x8.n_coord ) );
2462   DebugMesh( COORD_DX( m_packet.FlatRectangle8x8.n_coord ), COORD_DY( m_packet.FlatRectangle8x8.n_coord ) + 8 );
2463   DebugMesh( COORD_DX( m_packet.FlatRectangle8x8.n_coord ) + 8, COORD_DY( m_packet.FlatRectangle8x8.n_coord ) + 8 );
2536   DebugMesh( COORD_X( m_packet.FlatRectangle8x8.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.FlatRectangle8x8.n_coord ) + n_drawoffset_y );
2537   DebugMesh( COORD_X( m_packet.FlatRectangle8x8.n_coord ) + n_drawoffset_x + 8, COORD_Y( m_packet.FlatRectangle8x8.n_coord ) + n_drawoffset_y );
2538   DebugMesh( COORD_X( m_packet.FlatRectangle8x8.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.FlatRectangle8x8.n_coord ) + n_drawoffset_y + 8 );
2539   DebugMesh( COORD_X( m_packet.FlatRectangle8x8.n_coord ) + n_drawoffset_x + 8, COORD_Y( m_packet.FlatRectangle8x8.n_coord ) + n_drawoffset_y + 8 );
24642540   DebugMeshEnd();
24652541#endif
24662542
r20369r20370
24722548   n_g.w.h = BGR_G( m_packet.FlatRectangle8x8.n_bgr ); n_g.w.l = 0;
24732549   n_b.w.h = BGR_B( m_packet.FlatRectangle8x8.n_bgr ); n_b.w.l = 0;
24742550
2475   n_y = COORD_DY( m_packet.FlatRectangle8x8.n_coord );
2551   n_y = COORD_Y( m_packet.FlatRectangle8x8.n_coord ) + n_drawoffset_y;
24762552   n_h = 8;
24772553
24782554   while( n_h > 0 )
24792555   {
2480      n_x = COORD_DX( m_packet.FlatRectangle8x8.n_coord );
2556      n_x = COORD_X( m_packet.FlatRectangle8x8.n_coord ) + n_drawoffset_x;
24812557
24822558      n_distance = 8;
24832559      if( n_distance > 0 && n_y >= (INT32)n_drawarea_y1 && n_y <= (INT32)n_drawarea_y2 )
r20369r20370
25222598   {
25232599      return;
25242600   }
2525   DebugMesh( COORD_DX( m_packet.FlatRectangle16x16.n_coord ), COORD_DY( m_packet.FlatRectangle16x16.n_coord ) );
2526   DebugMesh( COORD_DX( m_packet.FlatRectangle16x16.n_coord ) + 16, COORD_DY( m_packet.FlatRectangle16x16.n_coord ) );
2527   DebugMesh( COORD_DX( m_packet.FlatRectangle16x16.n_coord ), COORD_DY( m_packet.FlatRectangle16x16.n_coord ) + 16 );
2528   DebugMesh( COORD_DX( m_packet.FlatRectangle16x16.n_coord ) + 16, COORD_DY( m_packet.FlatRectangle16x16.n_coord ) + 16 );
2601   DebugMesh( COORD_X( m_packet.FlatRectangle16x16.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.FlatRectangle16x16.n_coord ) + n_drawoffset_y );
2602   DebugMesh( COORD_X( m_packet.FlatRectangle16x16.n_coord ) + n_drawoffset_x + 16, COORD_Y( m_packet.FlatRectangle16x16.n_coord ) + n_drawoffset_y );
2603   DebugMesh( COORD_X( m_packet.FlatRectangle16x16.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.FlatRectangle16x16.n_coord ) + n_drawoffset_y + 16 );
2604   DebugMesh( COORD_X( m_packet.FlatRectangle16x16.n_coord ) + n_drawoffset_x + 16, COORD_Y( m_packet.FlatRectangle16x16.n_coord ) + n_drawoffset_y + 16 );
25292605   DebugMeshEnd();
25302606#endif
25312607
r20369r20370
25372613   n_g.w.h = BGR_G( m_packet.FlatRectangle16x16.n_bgr ); n_g.w.l = 0;
25382614   n_b.w.h = BGR_B( m_packet.FlatRectangle16x16.n_bgr ); n_b.w.l = 0;
25392615
2540   n_y = COORD_DY( m_packet.FlatRectangle16x16.n_coord );
2616   n_y = COORD_Y( m_packet.FlatRectangle16x16.n_coord ) + n_drawoffset_y;
25412617   n_h = 16;
25422618
25432619   while( n_h > 0 )
25442620   {
2545      n_x = COORD_DX( m_packet.FlatRectangle16x16.n_coord );
2621      n_x = COORD_X( m_packet.FlatRectangle16x16.n_coord ) + n_drawoffset_x;
25462622
25472623      n_distance = 16;
25482624      if( n_distance > 0 && n_y >= (INT32)n_drawarea_y1 && n_y <= (INT32)n_drawarea_y2 )
r20369r20370
25982674   {
25992675      return;
26002676   }
2601   DebugMesh( COORD_DX( m_packet.FlatTexturedRectangle.n_coord ), COORD_DY( m_packet.FlatTexturedRectangle.n_coord ) );
2602   DebugMesh( COORD_DX( m_packet.FlatTexturedRectangle.n_coord ) + SIZE_W( m_packet.FlatTexturedRectangle.n_size ), COORD_DY( m_packet.FlatTexturedRectangle.n_coord ) );
2603   DebugMesh( COORD_DX( m_packet.FlatTexturedRectangle.n_coord ), COORD_DY( m_packet.FlatTexturedRectangle.n_coord ) + SIZE_H( m_packet.FlatTexturedRectangle.n_size ) );
2604   DebugMesh( COORD_DX( m_packet.FlatTexturedRectangle.n_coord ) + SIZE_W( m_packet.FlatTexturedRectangle.n_size ), COORD_DY( m_packet.FlatTexturedRectangle.n_coord ) + SIZE_H( m_packet.FlatTexturedRectangle.n_size ) );
2677   DebugMesh( COORD_X( m_packet.FlatTexturedRectangle.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.FlatTexturedRectangle.n_coord ) + n_drawoffset_y );
2678   DebugMesh( COORD_X( m_packet.FlatTexturedRectangle.n_coord ) + n_drawoffset_x + SIZE_W( m_packet.FlatTexturedRectangle.n_size ), COORD_Y( m_packet.FlatTexturedRectangle.n_coord ) + n_drawoffset_y );
2679   DebugMesh( COORD_X( m_packet.FlatTexturedRectangle.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.FlatTexturedRectangle.n_coord ) + n_drawoffset_y + SIZE_H( m_packet.FlatTexturedRectangle.n_size ) );
2680   DebugMesh( COORD_X( m_packet.FlatTexturedRectangle.n_coord ) + n_drawoffset_x + SIZE_W( m_packet.FlatTexturedRectangle.n_size ), COORD_Y( m_packet.FlatTexturedRectangle.n_coord ) + n_drawoffset_y + SIZE_H( m_packet.FlatTexturedRectangle.n_size ) );
26052681   DebugMeshEnd();
26062682#endif
26072683
r20369r20370
26322708   }
26332709
26342710   n_v = TEXTURE_V( m_packet.FlatTexturedRectangle.n_texture );
2635   n_y = COORD_DY( m_packet.FlatTexturedRectangle.n_coord );
2711   n_y = COORD_Y( m_packet.FlatTexturedRectangle.n_coord ) + n_drawoffset_y;
26362712   n_h = SIZE_H( m_packet.FlatTexturedRectangle.n_size );
26372713
26382714   while( n_h > 0 )
26392715   {
2640      n_x = COORD_DX( m_packet.FlatTexturedRectangle.n_coord );
2716      n_x = COORD_X( m_packet.FlatTexturedRectangle.n_coord ) + n_drawoffset_x;
26412717      n_u = TEXTURE_U( m_packet.FlatTexturedRectangle.n_texture );
26422718
26432719      n_distance = SIZE_W( m_packet.FlatTexturedRectangle.n_size );
r20369r20370
26962772   {
26972773      return;
26982774   }
2699   DebugMesh( COORD_DX( m_packet.Sprite8x8.n_coord ), COORD_DY( m_packet.Sprite8x8.n_coord ) );
2700   DebugMesh( COORD_DX( m_packet.Sprite8x8.n_coord ) + 7, COORD_DY( m_packet.Sprite8x8.n_coord ) );
2701   DebugMesh( COORD_DX( m_packet.Sprite8x8.n_coord ), COORD_DY( m_packet.Sprite8x8.n_coord ) + 7 );
2702   DebugMesh( COORD_DX( m_packet.Sprite8x8.n_coord ) + 7, COORD_DY( m_packet.Sprite8x8.n_coord ) + 7 );
2775   DebugMesh( COORD_X( m_packet.Sprite8x8.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.Sprite8x8.n_coord ) + n_drawoffset_y );
2776   DebugMesh( COORD_X( m_packet.Sprite8x8.n_coord ) + n_drawoffset_x + 7, COORD_Y( m_packet.Sprite8x8.n_coord ) + n_drawoffset_y );
2777   DebugMesh( COORD_X( m_packet.Sprite8x8.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.Sprite8x8.n_coord ) + n_drawoffset_y + 7 );
2778   DebugMesh( COORD_X( m_packet.Sprite8x8.n_coord ) + n_drawoffset_x + 7, COORD_Y( m_packet.Sprite8x8.n_coord ) + n_drawoffset_y + 7 );
27032779   DebugMeshEnd();
27042780#endif
27052781
r20369r20370
27302806   }
27312807
27322808   n_v = TEXTURE_V( m_packet.Sprite8x8.n_texture );
2733   n_y = COORD_DY( m_packet.Sprite8x8.n_coord );
2809   n_y = COORD_Y( m_packet.Sprite8x8.n_coord ) + n_drawoffset_y;
27342810   n_h = 8;
27352811
27362812   while( n_h > 0 )
27372813   {
2738      n_x = COORD_DX( m_packet.Sprite8x8.n_coord );
2814      n_x = COORD_X( m_packet.Sprite8x8.n_coord ) + n_drawoffset_x;
27392815      n_u = TEXTURE_U( m_packet.Sprite8x8.n_texture );
27402816
27412817      n_distance = 8;
r20369r20370
27942870   {
27952871      return;
27962872   }
2797   DebugMesh( COORD_DX( m_packet.Sprite16x16.n_coord ), COORD_DY( m_packet.Sprite16x16.n_coord ) );
2798   DebugMesh( COORD_DX( m_packet.Sprite16x16.n_coord ) + 7, COORD_DY( m_packet.Sprite16x16.n_coord ) );
2799   DebugMesh( COORD_DX( m_packet.Sprite16x16.n_coord ), COORD_DY( m_packet.Sprite16x16.n_coord ) + 7 );
2800   DebugMesh( COORD_DX( m_packet.Sprite16x16.n_coord ) + 7, COORD_DY( m_packet.Sprite16x16.n_coord ) + 7 );
2873   DebugMesh( COORD_X( m_packet.Sprite16x16.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.Sprite16x16.n_coord ) + n_drawoffset_y );
2874   DebugMesh( COORD_X( m_packet.Sprite16x16.n_coord ) + n_drawoffset_x + 7, COORD_Y( m_packet.Sprite16x16.n_coord ) + n_drawoffset_y );
2875   DebugMesh( COORD_X( m_packet.Sprite16x16.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.Sprite16x16.n_coord ) + n_drawoffset_y + 7 );
2876   DebugMesh( COORD_X( m_packet.Sprite16x16.n_coord ) + n_drawoffset_x + 7, COORD_Y( m_packet.Sprite16x16.n_coord ) + n_drawoffset_y + 7 );
28012877   DebugMeshEnd();
28022878#endif
28032879
r20369r20370
28282904   }
28292905
28302906   n_v = TEXTURE_V( m_packet.Sprite16x16.n_texture );
2831   n_y = COORD_DY( m_packet.Sprite16x16.n_coord );
2907   n_y = COORD_Y( m_packet.Sprite16x16.n_coord ) + n_drawoffset_y;
28322908   n_h = 16;
28332909
28342910   while( n_h > 0 )
28352911   {
2836      n_x = COORD_DX( m_packet.Sprite16x16.n_coord );
2912      n_x = COORD_X( m_packet.Sprite16x16.n_coord ) + n_drawoffset_x;
28372913      n_u = TEXTURE_U( m_packet.Sprite16x16.n_texture );
28382914
28392915      n_distance = 16;
r20369r20370
28672943   {
28682944      return;
28692945   }
2870   DebugMesh( COORD_DX( m_packet.Dot.vertex.n_coord ), COORD_DY( m_packet.Dot.vertex.n_coord ) );
2946   DebugMesh( COORD_X( m_packet.Dot.vertex.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.Dot.vertex.n_coord ) + n_drawoffset_y );
28712947   DebugMeshEnd();
28722948#endif
28732949
28742950   n_r = BGR_R( m_packet.Dot.n_bgr );
28752951   n_g = BGR_G( m_packet.Dot.n_bgr );
28762952   n_b = BGR_B( m_packet.Dot.n_bgr );
2877   n_x = COORD_DX( m_packet.Dot.vertex.n_coord );
2878   n_y = COORD_DY( m_packet.Dot.vertex.n_coord );
2953   n_x = COORD_X( m_packet.Dot.vertex.n_coord ) + n_drawoffset_x;
2954   n_y = COORD_Y( m_packet.Dot.vertex.n_coord ) + n_drawoffset_y;
28792955
28802956   if( (INT16)n_x >= (INT32)n_drawarea_x1 &&
28812957      (INT16)n_y >= (INT32)n_drawarea_y1 &&
r20369r20370
29803056         else
29813057         {
29823058            verboselog( machine(), 1, "%02x: monochrome 3 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
2983            FlatPolygon( 0 );
3059            FlatPolygon( 3 );
29843060            n_gpu_buffer_offset = 0;
29853061         }
29863062         break;
r20369r20370
29953071         else
29963072         {
29973073            verboselog( machine(), 1, "%02x: textured 3 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
2998            FlatTexturedPolygon( 0 );
3074            FlatTexturedPolygon( 3 );
29993075            n_gpu_buffer_offset = 0;
30003076         }
30013077         break;
r20369r20370
30103086         else
30113087         {
30123088            verboselog( machine(), 1, "%02x: monochrome 4 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
3013            FlatPolygon( 0 );
3014            FlatPolygon( 1 );
3089            FlatPolygon( 4 );
30153090            n_gpu_buffer_offset = 0;
30163091         }
30173092         break;
r20369r20370
30263101         else
30273102         {
30283103            verboselog( machine(), 1, "%02x: textured 4 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
3029            FlatTexturedPolygon( 0 );
3030            FlatTexturedPolygon( 1 );
3104            FlatTexturedPolygon( 4 );
30313105            n_gpu_buffer_offset = 0;
30323106         }
30333107         break;
r20369r20370
30423116         else
30433117         {
30443118            verboselog( machine(), 1, "%02x: gouraud 3 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
3045            GouraudPolygon( 0 );
3119            GouraudPolygon( 3 );
30463120            n_gpu_buffer_offset = 0;
30473121         }
30483122         break;
r20369r20370
30573131         else
30583132         {
30593133            verboselog( machine(), 1, "%02x: gouraud textured 3 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
3060            GouraudTexturedPolygon( 0 );
3134            GouraudTexturedPolygon( 3 );
30613135            n_gpu_buffer_offset = 0;
30623136         }
30633137         break;
r20369r20370
30723146         else
30733147         {
30743148            verboselog( machine(), 1, "%02x: gouraud 4 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
3075            GouraudPolygon( 0 );
3076            GouraudPolygon( 1 );
3149            GouraudPolygon( 4 );
30773150            n_gpu_buffer_offset = 0;
30783151         }
30793152         break;
r20369r20370
30883161         else
30893162         {
30903163            verboselog( machine(), 1, "%02x: gouraud textured 4 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
3091            GouraudTexturedPolygon( 0 );
3092            GouraudTexturedPolygon( 1 );
3164            GouraudTexturedPolygon( 4 );
30933165            n_gpu_buffer_offset = 0;
30943166         }
30953167         break;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team