trunk/src/emu/video/psx.c
| r20369 | r20370 | |
| 73 | 73 | { |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | | static const UINT16 p_n_rightpointlist[] = { 1, 2, 0 }; |
| 77 | | static const UINT16 p_n_leftpointlist[] = { 2, 0, 1 }; |
| 76 | static const UINT16 m_p_n_nextpointlist4[] = { 1, 3, 0, 2 }; |
| 77 | static const UINT16 m_p_n_prevpointlist4[] = { 2, 0, 3, 1 }; |
| 78 | static const UINT16 m_p_n_nextpointlist3[] = { 1, 2, 0 }; |
| 79 | static const UINT16 m_p_n_prevpointlist3[] = { 2, 0, 1 }; |
| 78 | 80 | |
| 79 | 81 | #define SINT11( x ) ( ( (INT32)( x ) << 21 ) >> 21 ) |
| 80 | 82 | |
| 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 ) |
| 85 | 89 | #define SIZE_W( a ) ( a.w.l ) |
| 86 | 90 | #define SIZE_H( a ) ( a.w.h ) |
| 87 | 91 | #define BGR_C( a ) ( a.b.h3 ) |
| r20369 | r20370 | |
| 1262 | 1266 | } \ |
| 1263 | 1267 | } |
| 1264 | 1268 | |
| 1265 | | void psxgpu_device::FlatPolygon( int n_startpoint ) |
| 1269 | void psxgpu_device::FlatPolygon( int n_points ) |
| 1266 | 1270 | { |
| 1267 | 1271 | INT16 n_y; |
| 1268 | 1272 | INT16 n_x; |
| r20369 | r20370 | |
| 1286 | 1290 | UINT8 n_cmd; |
| 1287 | 1291 | |
| 1288 | 1292 | INT32 n_distance; |
| 1293 | |
| 1289 | 1294 | UINT16 n_point; |
| 1290 | 1295 | UINT16 n_rightpoint; |
| 1291 | 1296 | UINT16 n_leftpoint; |
| 1297 | const UINT16 *p_n_rightpointlist; |
| 1298 | const UINT16 *p_n_leftpointlist; |
| 1299 | |
| 1292 | 1300 | UINT16 *p_vram; |
| 1293 | | struct FLATVERTEX *vertex = &m_packet.FlatPolygon.vertex[ n_startpoint ]; |
| 1294 | 1301 | |
| 1295 | 1302 | #if defined( MAME_DEBUG ) |
| 1296 | 1303 | if( m_debug.n_skip == 1 ) |
| 1297 | 1304 | { |
| 1298 | 1305 | return; |
| 1299 | 1306 | } |
| 1300 | | for( n_point = 0; n_point < 3; n_point++ ) |
| 1307 | for( n_point = 0; n_point < n_points; n_point++ ) |
| 1301 | 1308 | { |
| 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 ); |
| 1303 | 1310 | } |
| 1304 | 1311 | DebugMeshEnd(); |
| 1305 | 1312 | #endif |
| r20369 | r20370 | |
| 1315 | 1322 | n_g.w.h = BGR_G( m_packet.FlatPolygon.n_bgr ); n_g.w.l = 0; |
| 1316 | 1323 | n_b.w.h = BGR_B( m_packet.FlatPolygon.n_bgr ); n_b.w.l = 0; |
| 1317 | 1324 | |
| 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 | |
| 1318 | 1341 | n_leftpoint = 0; |
| 1319 | | for( n_point = 1; n_point < 3; n_point++ ) |
| 1342 | for( n_point = 1; n_point < n_points; n_point++ ) |
| 1320 | 1343 | { |
| 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 ) ) ) |
| 1324 | 1347 | { |
| 1325 | 1348 | n_leftpoint = n_point; |
| 1326 | 1349 | } |
| r20369 | r20370 | |
| 1330 | 1353 | n_dx1 = 0; |
| 1331 | 1354 | n_dx2 = 0; |
| 1332 | 1355 | |
| 1333 | | n_y = COORD_DY( vertex[ n_rightpoint ].n_coord ); |
| 1356 | n_y = COORD_Y( m_packet.FlatPolygon.vertex[ n_rightpoint ].n_coord ); |
| 1334 | 1357 | |
| 1335 | 1358 | for( ;; ) |
| 1336 | 1359 | { |
| r20369 | r20370 | |
| 1339 | 1362 | return; |
| 1340 | 1363 | } |
| 1341 | 1364 | |
| 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 ) ) |
| 1343 | 1366 | { |
| 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 ) ) |
| 1345 | 1368 | { |
| 1346 | 1369 | n_leftpoint = p_n_leftpointlist[ n_leftpoint ]; |
| 1347 | 1370 | if( n_leftpoint == n_rightpoint ) |
| r20369 | r20370 | |
| 1349 | 1372 | break; |
| 1350 | 1373 | } |
| 1351 | 1374 | } |
| 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; |
| 1353 | 1376 | 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; |
| 1355 | 1378 | if( n_distance < 1 ) |
| 1356 | 1379 | { |
| 1357 | 1380 | break; |
| 1358 | 1381 | } |
| 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; |
| 1360 | 1383 | } |
| 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 ) ) |
| 1362 | 1385 | { |
| 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 ) ) |
| 1364 | 1387 | { |
| 1365 | 1388 | n_rightpoint = p_n_rightpointlist[ n_rightpoint ]; |
| 1366 | 1389 | if( n_rightpoint == n_leftpoint ) |
| r20369 | r20370 | |
| 1368 | 1391 | break; |
| 1369 | 1392 | } |
| 1370 | 1393 | } |
| 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; |
| 1372 | 1395 | 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; |
| 1374 | 1397 | if( n_distance < 1 ) |
| 1375 | 1398 | { |
| 1376 | 1399 | break; |
| 1377 | 1400 | } |
| 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; |
| 1379 | 1402 | } |
| 1380 | 1403 | if( (INT16)n_cx1.w.h != (INT16)n_cx2.w.h && n_y >= (INT32)n_drawarea_y1 && n_y <= (INT32)n_drawarea_y2 ) |
| 1381 | 1404 | { |
| r20369 | r20370 | |
| 1403 | 1426 | } |
| 1404 | 1427 | } |
| 1405 | 1428 | |
| 1406 | | void psxgpu_device::FlatTexturedPolygon( int n_startpoint ) |
| 1429 | void psxgpu_device::FlatTexturedPolygon( int n_points ) |
| 1407 | 1430 | { |
| 1408 | 1431 | INT16 n_y; |
| 1409 | 1432 | INT16 n_x; |
| r20369 | r20370 | |
| 1448 | 1471 | UINT16 n_point; |
| 1449 | 1472 | UINT16 n_rightpoint; |
| 1450 | 1473 | UINT16 n_leftpoint; |
| 1474 | const UINT16 *p_n_rightpointlist; |
| 1475 | const UINT16 *p_n_leftpointlist; |
| 1451 | 1476 | UINT16 *p_clut; |
| 1452 | 1477 | UINT16 *p_vram; |
| 1453 | 1478 | UINT32 n_bgr; |
| 1454 | | struct FLATTEXTUREDVERTEX *vertex = &m_packet.FlatTexturedPolygon.vertex[ n_startpoint ]; |
| 1455 | 1479 | |
| 1456 | 1480 | #if defined( MAME_DEBUG ) |
| 1457 | 1481 | if( m_debug.n_skip == 2 ) |
| 1458 | 1482 | { |
| 1459 | 1483 | return; |
| 1460 | 1484 | } |
| 1461 | | for( n_point = 0; n_point < 3; n_point++ ) |
| 1485 | for( n_point = 0; n_point < n_points; n_point++ ) |
| 1462 | 1486 | { |
| 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 ); |
| 1464 | 1488 | } |
| 1465 | 1489 | DebugMeshEnd(); |
| 1466 | 1490 | #endif |
| r20369 | r20370 | |
| 1497 | 1521 | break; |
| 1498 | 1522 | } |
| 1499 | 1523 | |
| 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 | |
| 1500 | 1540 | n_leftpoint = 0; |
| 1501 | | for( n_point = 1; n_point < 3; n_point++ ) |
| 1541 | for( n_point = 1; n_point < n_points; n_point++ ) |
| 1502 | 1542 | { |
| 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 ) ) ) |
| 1506 | 1546 | { |
| 1507 | 1547 | n_leftpoint = n_point; |
| 1508 | 1548 | } |
| r20369 | r20370 | |
| 1516 | 1556 | n_dv1 = 0; |
| 1517 | 1557 | n_dv2 = 0; |
| 1518 | 1558 | |
| 1519 | | n_y = COORD_DY( vertex[ n_rightpoint ].n_coord ); |
| 1559 | n_y = COORD_Y( m_packet.FlatTexturedPolygon.vertex[ n_rightpoint ].n_coord ); |
| 1520 | 1560 | |
| 1521 | 1561 | for( ;; ) |
| 1522 | 1562 | { |
| r20369 | r20370 | |
| 1525 | 1565 | return; |
| 1526 | 1566 | } |
| 1527 | 1567 | |
| 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 ) ) |
| 1529 | 1569 | { |
| 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 ) ) |
| 1531 | 1571 | { |
| 1532 | 1572 | n_leftpoint = p_n_leftpointlist[ n_leftpoint ]; |
| 1533 | 1573 | if( n_leftpoint == n_rightpoint ) |
| r20369 | r20370 | |
| 1535 | 1575 | break; |
| 1536 | 1576 | } |
| 1537 | 1577 | } |
| 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; |
| 1541 | 1581 | 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; |
| 1543 | 1583 | if( n_distance < 1 ) |
| 1544 | 1584 | { |
| 1545 | 1585 | break; |
| 1546 | 1586 | } |
| 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; |
| 1550 | 1590 | } |
| 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 ) ) |
| 1552 | 1592 | { |
| 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 ) ) |
| 1554 | 1594 | { |
| 1555 | 1595 | n_rightpoint = p_n_rightpointlist[ n_rightpoint ]; |
| 1556 | 1596 | if( n_rightpoint == n_leftpoint ) |
| r20369 | r20370 | |
| 1558 | 1598 | break; |
| 1559 | 1599 | } |
| 1560 | 1600 | } |
| 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; |
| 1564 | 1604 | 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; |
| 1566 | 1606 | if( n_distance < 1 ) |
| 1567 | 1607 | { |
| 1568 | 1608 | break; |
| 1569 | 1609 | } |
| 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; |
| 1573 | 1613 | } |
| 1574 | 1614 | if( (INT16)n_cx1.w.h != (INT16)n_cx2.w.h && n_y >= (INT32)n_drawarea_y1 && n_y <= (INT32)n_drawarea_y2 ) |
| 1575 | 1615 | { |
| r20369 | r20370 | |
| 1613 | 1653 | } |
| 1614 | 1654 | } |
| 1615 | 1655 | |
| 1616 | | void psxgpu_device::GouraudPolygon( int n_startpoint ) |
| 1656 | void psxgpu_device::GouraudPolygon( int n_points ) |
| 1617 | 1657 | { |
| 1618 | 1658 | INT16 n_y; |
| 1619 | 1659 | INT16 n_x; |
| r20369 | r20370 | |
| 1652 | 1692 | INT32 n_db2; |
| 1653 | 1693 | |
| 1654 | 1694 | INT32 n_distance; |
| 1695 | |
| 1655 | 1696 | UINT16 n_point; |
| 1656 | 1697 | UINT16 n_rightpoint; |
| 1657 | 1698 | UINT16 n_leftpoint; |
| 1699 | const UINT16 *p_n_rightpointlist; |
| 1700 | const UINT16 *p_n_leftpointlist; |
| 1701 | |
| 1658 | 1702 | UINT16 *p_vram; |
| 1659 | | struct GOURAUDVERTEX *vertex = &m_packet.GouraudPolygon.vertex[ n_startpoint ]; |
| 1660 | 1703 | |
| 1661 | 1704 | #if defined( MAME_DEBUG ) |
| 1662 | 1705 | if( m_debug.n_skip == 3 ) |
| 1663 | 1706 | { |
| 1664 | 1707 | return; |
| 1665 | 1708 | } |
| 1666 | | for( n_point = 0; n_point < 3; n_point++ ) |
| 1709 | for( n_point = 0; n_point < n_points; n_point++ ) |
| 1667 | 1710 | { |
| 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 ); |
| 1669 | 1712 | } |
| 1670 | 1713 | DebugMeshEnd(); |
| 1671 | 1714 | #endif |
| r20369 | r20370 | |
| 1683 | 1726 | |
| 1684 | 1727 | SOLIDSETUP |
| 1685 | 1728 | |
| 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 | |
| 1686 | 1745 | n_leftpoint = 0; |
| 1687 | | for( n_point = 1; n_point < 3; n_point++ ) |
| 1746 | for( n_point = 1; n_point < n_points; n_point++ ) |
| 1688 | 1747 | { |
| 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 ) ) ) |
| 1692 | 1751 | { |
| 1693 | 1752 | n_leftpoint = n_point; |
| 1694 | 1753 | } |
| r20369 | r20370 | |
| 1704 | 1763 | n_db1 = 0; |
| 1705 | 1764 | n_db2 = 0; |
| 1706 | 1765 | |
| 1707 | | n_y = COORD_DY( vertex[ n_rightpoint ].n_coord ); |
| 1766 | n_y = COORD_Y( m_packet.GouraudPolygon.vertex[ n_rightpoint ].n_coord ); |
| 1708 | 1767 | |
| 1709 | 1768 | for( ;; ) |
| 1710 | 1769 | { |
| r20369 | r20370 | |
| 1713 | 1772 | return; |
| 1714 | 1773 | } |
| 1715 | 1774 | |
| 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 ) ) |
| 1717 | 1776 | { |
| 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 ) ) |
| 1719 | 1778 | { |
| 1720 | 1779 | n_leftpoint = p_n_leftpointlist[ n_leftpoint ]; |
| 1721 | 1780 | if( n_leftpoint == n_rightpoint ) |
| r20369 | r20370 | |
| 1723 | 1782 | break; |
| 1724 | 1783 | } |
| 1725 | 1784 | } |
| 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; |
| 1730 | 1789 | 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; |
| 1732 | 1791 | if( n_distance < 1 ) |
| 1733 | 1792 | { |
| 1734 | 1793 | break; |
| 1735 | 1794 | } |
| 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; |
| 1740 | 1799 | } |
| 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 ) ) |
| 1742 | 1801 | { |
| 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 ) ) |
| 1744 | 1803 | { |
| 1745 | 1804 | n_rightpoint = p_n_rightpointlist[ n_rightpoint ]; |
| 1746 | 1805 | if( n_rightpoint == n_leftpoint ) |
| r20369 | r20370 | |
| 1748 | 1807 | break; |
| 1749 | 1808 | } |
| 1750 | 1809 | } |
| 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; |
| 1755 | 1814 | 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; |
| 1757 | 1816 | if( n_distance < 1 ) |
| 1758 | 1817 | { |
| 1759 | 1818 | break; |
| 1760 | 1819 | } |
| 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; |
| 1765 | 1824 | } |
| 1766 | 1825 | if( (INT16)n_cx1.w.h != (INT16)n_cx2.w.h && n_y >= (INT32)n_drawarea_y1 && n_y <= (INT32)n_drawarea_y2 ) |
| 1767 | 1826 | { |
| r20369 | r20370 | |
| 1812 | 1871 | } |
| 1813 | 1872 | } |
| 1814 | 1873 | |
| 1815 | | void psxgpu_device::GouraudTexturedPolygon( int n_startpoint ) |
| 1874 | void psxgpu_device::GouraudTexturedPolygon( int n_points ) |
| 1816 | 1875 | { |
| 1817 | 1876 | INT16 n_y; |
| 1818 | 1877 | INT16 n_x; |
| r20369 | r20370 | |
| 1872 | 1931 | UINT16 n_point; |
| 1873 | 1932 | UINT16 n_rightpoint; |
| 1874 | 1933 | UINT16 n_leftpoint; |
| 1934 | const UINT16 *p_n_rightpointlist; |
| 1935 | const UINT16 *p_n_leftpointlist; |
| 1875 | 1936 | UINT16 *p_clut; |
| 1876 | 1937 | UINT16 *p_vram; |
| 1877 | 1938 | UINT32 n_bgr; |
| 1878 | | struct GOURAUDTEXTUREDVERTEX *vertex = &m_packet.GouraudTexturedPolygon.vertex[ n_startpoint ]; |
| 1879 | 1939 | |
| 1880 | 1940 | #if defined( MAME_DEBUG ) |
| 1881 | 1941 | if( m_debug.n_skip == 4 ) |
| 1882 | 1942 | { |
| 1883 | 1943 | return; |
| 1884 | 1944 | } |
| 1885 | | for( n_point = 0; n_point < 3; n_point++ ) |
| 1945 | for( n_point = 0; n_point < n_points; n_point++ ) |
| 1886 | 1946 | { |
| 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 ); |
| 1888 | 1948 | } |
| 1889 | 1949 | DebugMeshEnd(); |
| 1890 | 1950 | #endif |
| r20369 | r20370 | |
| 1910 | 1970 | decode_tpage( m_packet.GouraudTexturedPolygon.vertex[ 1 ].n_texture.w.h ); |
| 1911 | 1971 | TEXTURESETUP |
| 1912 | 1972 | |
| 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 | |
| 1913 | 1989 | n_leftpoint = 0; |
| 1914 | | for( n_point = 1; n_point < 3; n_point++ ) |
| 1990 | for( n_point = 1; n_point < n_points; n_point++ ) |
| 1915 | 1991 | { |
| 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 ) ) ) |
| 1919 | 1995 | { |
| 1920 | 1996 | n_leftpoint = n_point; |
| 1921 | 1997 | } |
| r20369 | r20370 | |
| 1935 | 2011 | n_dv1 = 0; |
| 1936 | 2012 | n_dv2 = 0; |
| 1937 | 2013 | |
| 1938 | | n_y = COORD_DY( vertex[ n_rightpoint ].n_coord ); |
| 2014 | n_y = COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_coord ); |
| 1939 | 2015 | |
| 1940 | 2016 | for( ;; ) |
| 1941 | 2017 | { |
| r20369 | r20370 | |
| 1944 | 2020 | return; |
| 1945 | 2021 | } |
| 1946 | 2022 | |
| 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 ) ) |
| 1948 | 2024 | { |
| 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 ) ) |
| 1950 | 2026 | { |
| 1951 | 2027 | n_leftpoint = p_n_leftpointlist[ n_leftpoint ]; |
| 1952 | 2028 | if( n_leftpoint == n_rightpoint ) |
| r20369 | r20370 | |
| 1954 | 2030 | break; |
| 1955 | 2031 | } |
| 1956 | 2032 | } |
| 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; |
| 1958 | 2034 | switch( n_cmd & 0x01 ) |
| 1959 | 2035 | { |
| 1960 | 2036 | 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; |
| 1964 | 2040 | break; |
| 1965 | 2041 | case 0x01: |
| 1966 | 2042 | n_cr1.w.h = 0x80; n_cr1.w.l = 0; |
| r20369 | r20370 | |
| 1968 | 2044 | n_cb1.w.h = 0x80; n_cb1.w.l = 0; |
| 1969 | 2045 | break; |
| 1970 | 2046 | } |
| 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; |
| 1973 | 2049 | 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; |
| 1975 | 2051 | if( n_distance < 1 ) |
| 1976 | 2052 | { |
| 1977 | 2053 | break; |
| 1978 | 2054 | } |
| 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; |
| 1980 | 2056 | switch( n_cmd & 0x01 ) |
| 1981 | 2057 | { |
| 1982 | 2058 | 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; |
| 1986 | 2062 | break; |
| 1987 | 2063 | case 0x01: |
| 1988 | 2064 | n_dr1 = 0; |
| r20369 | r20370 | |
| 1990 | 2066 | n_db1 = 0; |
| 1991 | 2067 | break; |
| 1992 | 2068 | } |
| 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; |
| 1995 | 2071 | } |
| 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 ) ) |
| 1997 | 2073 | { |
| 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 ) ) |
| 1999 | 2075 | { |
| 2000 | 2076 | n_rightpoint = p_n_rightpointlist[ n_rightpoint ]; |
| 2001 | 2077 | if( n_rightpoint == n_leftpoint ) |
| r20369 | r20370 | |
| 2003 | 2079 | break; |
| 2004 | 2080 | } |
| 2005 | 2081 | } |
| 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; |
| 2007 | 2083 | switch( n_cmd & 0x01 ) |
| 2008 | 2084 | { |
| 2009 | 2085 | 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; |
| 2013 | 2089 | break; |
| 2014 | 2090 | case 0x01: |
| 2015 | 2091 | n_cr2.w.h = 0x80; n_cr2.w.l = 0; |
| r20369 | r20370 | |
| 2017 | 2093 | n_cb2.w.h = 0x80; n_cb2.w.l = 0; |
| 2018 | 2094 | break; |
| 2019 | 2095 | } |
| 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; |
| 2022 | 2098 | 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; |
| 2024 | 2100 | if( n_distance < 1 ) |
| 2025 | 2101 | { |
| 2026 | 2102 | break; |
| 2027 | 2103 | } |
| 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; |
| 2029 | 2105 | switch( n_cmd & 0x01 ) |
| 2030 | 2106 | { |
| 2031 | 2107 | 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; |
| 2035 | 2111 | break; |
| 2036 | 2112 | case 0x01: |
| 2037 | 2113 | n_dr2 = 0; |
| r20369 | r20370 | |
| 2039 | 2115 | n_db2 = 0; |
| 2040 | 2116 | break; |
| 2041 | 2117 | } |
| 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; |
| 2044 | 2120 | } |
| 2045 | 2121 | if( (INT16)n_cx1.w.h != (INT16)n_cx2.w.h && n_y >= (INT32)n_drawarea_y1 && n_y <= (INT32)n_drawarea_y2 ) |
| 2046 | 2122 | { |
| r20369 | r20370 | |
| 2128 | 2204 | { |
| 2129 | 2205 | return; |
| 2130 | 2206 | } |
| 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 ); |
| 2133 | 2209 | DebugMeshEnd(); |
| 2134 | 2210 | #endif |
| 2135 | 2211 | |
| 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; |
| 2140 | 2216 | |
| 2141 | 2217 | n_r = BGR_R( m_packet.MonochromeLine.n_bgr ); |
| 2142 | 2218 | n_g = BGR_G( m_packet.MonochromeLine.n_bgr ); |
| r20369 | r20370 | |
| 2231 | 2307 | { |
| 2232 | 2308 | return; |
| 2233 | 2309 | } |
| 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 ); |
| 2236 | 2312 | DebugMeshEnd(); |
| 2237 | 2313 | #endif |
| 2238 | 2314 | |
| 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; |
| 2241 | 2317 | n_cr1.w.h = BGR_R( m_packet.GouraudLine.vertex[ 0 ].n_bgr ); n_cr1.w.l = 0; |
| 2242 | 2318 | n_cg1.w.h = BGR_G( m_packet.GouraudLine.vertex[ 0 ].n_bgr ); n_cg1.w.l = 0; |
| 2243 | 2319 | n_cb1.w.h = BGR_B( m_packet.GouraudLine.vertex[ 0 ].n_bgr ); n_cb1.w.l = 0; |
| 2244 | 2320 | |
| 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; |
| 2247 | 2323 | n_cr2.w.h = BGR_R( m_packet.GouraudLine.vertex[ 1 ].n_bgr ); n_cr1.w.l = 0; |
| 2248 | 2324 | n_cg2.w.h = BGR_G( m_packet.GouraudLine.vertex[ 1 ].n_bgr ); n_cg1.w.l = 0; |
| 2249 | 2325 | n_cb2.w.h = BGR_B( m_packet.GouraudLine.vertex[ 1 ].n_bgr ); n_cb1.w.l = 0; |
| r20369 | r20370 | |
| 2392 | 2468 | { |
| 2393 | 2469 | return; |
| 2394 | 2470 | } |
| 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 ) ); |
| 2399 | 2475 | DebugMeshEnd(); |
| 2400 | 2476 | #endif |
| 2401 | 2477 | |
| r20369 | r20370 | |
| 2407 | 2483 | n_g.w.h = BGR_G( m_packet.FlatRectangle.n_bgr ); n_g.w.l = 0; |
| 2408 | 2484 | n_b.w.h = BGR_B( m_packet.FlatRectangle.n_bgr ); n_b.w.l = 0; |
| 2409 | 2485 | |
| 2410 | | n_y = COORD_DY( m_packet.FlatRectangle.n_coord ); |
| 2486 | n_y = COORD_Y( m_packet.FlatRectangle.n_coord ) + n_drawoffset_y; |
| 2411 | 2487 | n_h = SIZE_H( m_packet.FlatRectangle.n_size ); |
| 2412 | 2488 | |
| 2413 | 2489 | while( n_h > 0 ) |
| 2414 | 2490 | { |
| 2415 | | n_x = COORD_DX( m_packet.FlatRectangle.n_coord ); |
| 2491 | n_x = COORD_X( m_packet.FlatRectangle.n_coord ) + n_drawoffset_x; |
| 2416 | 2492 | |
| 2417 | 2493 | n_distance = SIZE_W( m_packet.FlatRectangle.n_size ); |
| 2418 | 2494 | if( n_distance > 0 && n_y >= (INT32)n_drawarea_y1 && n_y <= (INT32)n_drawarea_y2 ) |
| r20369 | r20370 | |
| 2457 | 2533 | { |
| 2458 | 2534 | return; |
| 2459 | 2535 | } |
| 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 ); |
| 2464 | 2540 | DebugMeshEnd(); |
| 2465 | 2541 | #endif |
| 2466 | 2542 | |
| r20369 | r20370 | |
| 2472 | 2548 | n_g.w.h = BGR_G( m_packet.FlatRectangle8x8.n_bgr ); n_g.w.l = 0; |
| 2473 | 2549 | n_b.w.h = BGR_B( m_packet.FlatRectangle8x8.n_bgr ); n_b.w.l = 0; |
| 2474 | 2550 | |
| 2475 | | n_y = COORD_DY( m_packet.FlatRectangle8x8.n_coord ); |
| 2551 | n_y = COORD_Y( m_packet.FlatRectangle8x8.n_coord ) + n_drawoffset_y; |
| 2476 | 2552 | n_h = 8; |
| 2477 | 2553 | |
| 2478 | 2554 | while( n_h > 0 ) |
| 2479 | 2555 | { |
| 2480 | | n_x = COORD_DX( m_packet.FlatRectangle8x8.n_coord ); |
| 2556 | n_x = COORD_X( m_packet.FlatRectangle8x8.n_coord ) + n_drawoffset_x; |
| 2481 | 2557 | |
| 2482 | 2558 | n_distance = 8; |
| 2483 | 2559 | if( n_distance > 0 && n_y >= (INT32)n_drawarea_y1 && n_y <= (INT32)n_drawarea_y2 ) |
| r20369 | r20370 | |
| 2522 | 2598 | { |
| 2523 | 2599 | return; |
| 2524 | 2600 | } |
| 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 ); |
| 2529 | 2605 | DebugMeshEnd(); |
| 2530 | 2606 | #endif |
| 2531 | 2607 | |
| r20369 | r20370 | |
| 2537 | 2613 | n_g.w.h = BGR_G( m_packet.FlatRectangle16x16.n_bgr ); n_g.w.l = 0; |
| 2538 | 2614 | n_b.w.h = BGR_B( m_packet.FlatRectangle16x16.n_bgr ); n_b.w.l = 0; |
| 2539 | 2615 | |
| 2540 | | n_y = COORD_DY( m_packet.FlatRectangle16x16.n_coord ); |
| 2616 | n_y = COORD_Y( m_packet.FlatRectangle16x16.n_coord ) + n_drawoffset_y; |
| 2541 | 2617 | n_h = 16; |
| 2542 | 2618 | |
| 2543 | 2619 | while( n_h > 0 ) |
| 2544 | 2620 | { |
| 2545 | | n_x = COORD_DX( m_packet.FlatRectangle16x16.n_coord ); |
| 2621 | n_x = COORD_X( m_packet.FlatRectangle16x16.n_coord ) + n_drawoffset_x; |
| 2546 | 2622 | |
| 2547 | 2623 | n_distance = 16; |
| 2548 | 2624 | if( n_distance > 0 && n_y >= (INT32)n_drawarea_y1 && n_y <= (INT32)n_drawarea_y2 ) |
| r20369 | r20370 | |
| 2598 | 2674 | { |
| 2599 | 2675 | return; |
| 2600 | 2676 | } |
| 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 ) ); |
| 2605 | 2681 | DebugMeshEnd(); |
| 2606 | 2682 | #endif |
| 2607 | 2683 | |
| r20369 | r20370 | |
| 2632 | 2708 | } |
| 2633 | 2709 | |
| 2634 | 2710 | 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; |
| 2636 | 2712 | n_h = SIZE_H( m_packet.FlatTexturedRectangle.n_size ); |
| 2637 | 2713 | |
| 2638 | 2714 | while( n_h > 0 ) |
| 2639 | 2715 | { |
| 2640 | | n_x = COORD_DX( m_packet.FlatTexturedRectangle.n_coord ); |
| 2716 | n_x = COORD_X( m_packet.FlatTexturedRectangle.n_coord ) + n_drawoffset_x; |
| 2641 | 2717 | n_u = TEXTURE_U( m_packet.FlatTexturedRectangle.n_texture ); |
| 2642 | 2718 | |
| 2643 | 2719 | n_distance = SIZE_W( m_packet.FlatTexturedRectangle.n_size ); |
| r20369 | r20370 | |
| 2696 | 2772 | { |
| 2697 | 2773 | return; |
| 2698 | 2774 | } |
| 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 ); |
| 2703 | 2779 | DebugMeshEnd(); |
| 2704 | 2780 | #endif |
| 2705 | 2781 | |
| r20369 | r20370 | |
| 2730 | 2806 | } |
| 2731 | 2807 | |
| 2732 | 2808 | 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; |
| 2734 | 2810 | n_h = 8; |
| 2735 | 2811 | |
| 2736 | 2812 | while( n_h > 0 ) |
| 2737 | 2813 | { |
| 2738 | | n_x = COORD_DX( m_packet.Sprite8x8.n_coord ); |
| 2814 | n_x = COORD_X( m_packet.Sprite8x8.n_coord ) + n_drawoffset_x; |
| 2739 | 2815 | n_u = TEXTURE_U( m_packet.Sprite8x8.n_texture ); |
| 2740 | 2816 | |
| 2741 | 2817 | n_distance = 8; |
| r20369 | r20370 | |
| 2794 | 2870 | { |
| 2795 | 2871 | return; |
| 2796 | 2872 | } |
| 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 ); |
| 2801 | 2877 | DebugMeshEnd(); |
| 2802 | 2878 | #endif |
| 2803 | 2879 | |
| r20369 | r20370 | |
| 2828 | 2904 | } |
| 2829 | 2905 | |
| 2830 | 2906 | 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; |
| 2832 | 2908 | n_h = 16; |
| 2833 | 2909 | |
| 2834 | 2910 | while( n_h > 0 ) |
| 2835 | 2911 | { |
| 2836 | | n_x = COORD_DX( m_packet.Sprite16x16.n_coord ); |
| 2912 | n_x = COORD_X( m_packet.Sprite16x16.n_coord ) + n_drawoffset_x; |
| 2837 | 2913 | n_u = TEXTURE_U( m_packet.Sprite16x16.n_texture ); |
| 2838 | 2914 | |
| 2839 | 2915 | n_distance = 16; |
| r20369 | r20370 | |
| 2867 | 2943 | { |
| 2868 | 2944 | return; |
| 2869 | 2945 | } |
| 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 ); |
| 2871 | 2947 | DebugMeshEnd(); |
| 2872 | 2948 | #endif |
| 2873 | 2949 | |
| 2874 | 2950 | n_r = BGR_R( m_packet.Dot.n_bgr ); |
| 2875 | 2951 | n_g = BGR_G( m_packet.Dot.n_bgr ); |
| 2876 | 2952 | 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; |
| 2879 | 2955 | |
| 2880 | 2956 | if( (INT16)n_x >= (INT32)n_drawarea_x1 && |
| 2881 | 2957 | (INT16)n_y >= (INT32)n_drawarea_y1 && |
| r20369 | r20370 | |
| 2980 | 3056 | else |
| 2981 | 3057 | { |
| 2982 | 3058 | verboselog( machine(), 1, "%02x: monochrome 3 point polygon\n", m_packet.n_entry[ 0 ] >> 24 ); |
| 2983 | | FlatPolygon( 0 ); |
| 3059 | FlatPolygon( 3 ); |
| 2984 | 3060 | n_gpu_buffer_offset = 0; |
| 2985 | 3061 | } |
| 2986 | 3062 | break; |
| r20369 | r20370 | |
| 2995 | 3071 | else |
| 2996 | 3072 | { |
| 2997 | 3073 | verboselog( machine(), 1, "%02x: textured 3 point polygon\n", m_packet.n_entry[ 0 ] >> 24 ); |
| 2998 | | FlatTexturedPolygon( 0 ); |
| 3074 | FlatTexturedPolygon( 3 ); |
| 2999 | 3075 | n_gpu_buffer_offset = 0; |
| 3000 | 3076 | } |
| 3001 | 3077 | break; |
| r20369 | r20370 | |
| 3010 | 3086 | else |
| 3011 | 3087 | { |
| 3012 | 3088 | verboselog( machine(), 1, "%02x: monochrome 4 point polygon\n", m_packet.n_entry[ 0 ] >> 24 ); |
| 3013 | | FlatPolygon( 0 ); |
| 3014 | | FlatPolygon( 1 ); |
| 3089 | FlatPolygon( 4 ); |
| 3015 | 3090 | n_gpu_buffer_offset = 0; |
| 3016 | 3091 | } |
| 3017 | 3092 | break; |
| r20369 | r20370 | |
| 3026 | 3101 | else |
| 3027 | 3102 | { |
| 3028 | 3103 | verboselog( machine(), 1, "%02x: textured 4 point polygon\n", m_packet.n_entry[ 0 ] >> 24 ); |
| 3029 | | FlatTexturedPolygon( 0 ); |
| 3030 | | FlatTexturedPolygon( 1 ); |
| 3104 | FlatTexturedPolygon( 4 ); |
| 3031 | 3105 | n_gpu_buffer_offset = 0; |
| 3032 | 3106 | } |
| 3033 | 3107 | break; |
| r20369 | r20370 | |
| 3042 | 3116 | else |
| 3043 | 3117 | { |
| 3044 | 3118 | verboselog( machine(), 1, "%02x: gouraud 3 point polygon\n", m_packet.n_entry[ 0 ] >> 24 ); |
| 3045 | | GouraudPolygon( 0 ); |
| 3119 | GouraudPolygon( 3 ); |
| 3046 | 3120 | n_gpu_buffer_offset = 0; |
| 3047 | 3121 | } |
| 3048 | 3122 | break; |
| r20369 | r20370 | |
| 3057 | 3131 | else |
| 3058 | 3132 | { |
| 3059 | 3133 | verboselog( machine(), 1, "%02x: gouraud textured 3 point polygon\n", m_packet.n_entry[ 0 ] >> 24 ); |
| 3060 | | GouraudTexturedPolygon( 0 ); |
| 3134 | GouraudTexturedPolygon( 3 ); |
| 3061 | 3135 | n_gpu_buffer_offset = 0; |
| 3062 | 3136 | } |
| 3063 | 3137 | break; |
| r20369 | r20370 | |
| 3072 | 3146 | else |
| 3073 | 3147 | { |
| 3074 | 3148 | verboselog( machine(), 1, "%02x: gouraud 4 point polygon\n", m_packet.n_entry[ 0 ] >> 24 ); |
| 3075 | | GouraudPolygon( 0 ); |
| 3076 | | GouraudPolygon( 1 ); |
| 3149 | GouraudPolygon( 4 ); |
| 3077 | 3150 | n_gpu_buffer_offset = 0; |
| 3078 | 3151 | } |
| 3079 | 3152 | break; |
| r20369 | r20370 | |
| 3088 | 3161 | else |
| 3089 | 3162 | { |
| 3090 | 3163 | 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 ); |
| 3093 | 3165 | n_gpu_buffer_offset = 0; |
| 3094 | 3166 | } |
| 3095 | 3167 | break; |