Revision | 302b7dc1bc32ad5e2c9dc2d75ae4345ad3945ead (tree) |
---|---|
Time | 2021-06-01 23:15:39 |
Author | Adam Kaminski <kaminskiadam9@gmai...> |
Commiter | Adam Kaminski |
Cleaned up scoreboard_RenderIndividualPlayer, also modified some strings so they're not all capitalized.
@@ -179,6 +179,8 @@ | ||
179 | 179 | static void scoreboard_DrawRankings( ULONG ulPlayer ); |
180 | 180 | static void scoreboard_DrawBottomString( ULONG ulPlayer ); |
181 | 181 | static void scoreboard_RenderCountdown( ULONG ulTimeLeft ); |
182 | +static void scoreboard_DrawText( const char *pszString, EColorRange Color, ULONG &ulXPos, ULONG ulOffset, bool bOffsetRight = false ); | |
183 | +static void scoreboard_DrawIcon( const char *pszPatchName, ULONG &ulXPos, ULONG ulYPos, ULONG ulOffset, bool bOffsetRight = false ); | |
182 | 184 | |
183 | 185 | //***************************************************************************** |
184 | 186 | // CONSOLE VARIABLES |
@@ -1502,435 +1504,158 @@ | ||
1502 | 1504 | |
1503 | 1505 | //***************************************************************************** |
1504 | 1506 | // |
1507 | +static void scoreboard_DrawText( const char *pszString, EColorRange Color, ULONG &ulXPos, ULONG ulOffset, bool bOffsetRight ) | |
1508 | +{ | |
1509 | + ulXPos += SmallFont->StringWidth( pszString ) * ( bOffsetRight ? 1 : -1 ); | |
1510 | + HUD_DrawText( SmallFont, Color, ulXPos, g_ulCurYPos, pszString, g_bScale ); | |
1511 | + ulXPos += ulOffset * ( bOffsetRight ? 1 : -1 ); | |
1512 | +} | |
1513 | + | |
1514 | +//***************************************************************************** | |
1515 | +// | |
1516 | +static void scoreboard_DrawIcon( const char *pszPatchName, ULONG &ulXPos, ULONG ulYPos, ULONG ulOffset, bool bOffsetRight ) | |
1517 | +{ | |
1518 | + ulXPos += TexMan[pszPatchName]->GetWidth( ) * ( bOffsetRight ? 1 : -1 ); | |
1519 | + ulYPos -= (( TexMan[pszPatchName]->GetHeight( ) - SmallFont->GetHeight( )) >> 1 ); | |
1520 | + | |
1521 | + HUD_DrawTexture( TexMan[pszPatchName], ulXPos, ulYPos, g_bScale ); | |
1522 | + ulXPos += ulOffset * ( bOffsetRight ? 1 : -1 ); | |
1523 | +} | |
1524 | + | |
1525 | +//***************************************************************************** | |
1526 | +// | |
1505 | 1527 | static void scoreboard_RenderIndividualPlayer( ULONG ulDisplayPlayer, ULONG ulPlayer ) |
1506 | 1528 | { |
1507 | - ULONG ulIdx; | |
1508 | - ULONG ulColor; | |
1509 | - LONG lXPosOffset; | |
1510 | - char szPatchName[9]; | |
1511 | - char szString[64]; | |
1529 | + ULONG ulColor = CR_GRAY; | |
1530 | + FString text; | |
1531 | + | |
1532 | + // [AK] Change the text color if we're carrying a terminator sphere or on a team. | |
1533 | + if (( terminator ) && ( players[ulPlayer].cheats2 & CF2_TERMINATORARTIFACT )) | |
1534 | + ulColor = CR_RED; | |
1535 | + else if ( players[ulPlayer].bOnTeam ) | |
1536 | + ulColor = TEAM_GetTextColor( players[ulPlayer].Team ); | |
1537 | + else if ( ulDisplayPlayer == ulPlayer ) | |
1538 | + ulColor = demoplayback ? CR_GOLD : CR_GREEN; | |
1512 | 1539 | |
1513 | 1540 | // Draw the data for each column. |
1514 | - for( ulIdx = 0; ulIdx < g_ulNumColumnsUsed; ulIdx++ ) | |
1541 | + for ( ULONG ulColumn = 0; ulColumn < g_ulNumColumnsUsed; ulColumn++ ) | |
1515 | 1542 | { |
1516 | - szString[0] = 0; | |
1517 | - | |
1518 | - ulColor = CR_GRAY; | |
1519 | - if (( terminator ) && ( players[ulPlayer].cheats2 & CF2_TERMINATORARTIFACT )) | |
1520 | - ulColor = CR_RED; | |
1521 | - else if ( players[ulPlayer].bOnTeam == true ) | |
1522 | - ulColor = TEAM_GetTextColor( players[ulPlayer].Team ); | |
1523 | - else if ( ulDisplayPlayer == ulPlayer ) | |
1524 | - ulColor = demoplayback ? CR_GOLD : CR_GREEN; | |
1525 | - | |
1526 | - // Determine what needs to be displayed in this column. | |
1527 | - switch ( g_aulColumnType[ulIdx] ) | |
1528 | - { | |
1529 | - case COLUMN_NAME: | |
1530 | - | |
1531 | - sprintf( szString, "%s", players[ulPlayer].userinfo.GetName() ); | |
1532 | - | |
1533 | - // Track where we are to draw multiple icons. | |
1534 | - lXPosOffset = -SmallFont->StringWidth( " " ); | |
1535 | - | |
1536 | - // [TP] If this player is in the join queue, display the position. | |
1537 | - { | |
1538 | - int position = JOINQUEUE_GetPositionInLine( ulPlayer ); | |
1539 | - if ( position != -1 ) | |
1540 | - { | |
1541 | - FString text; | |
1542 | - text.Format( "%d.", position + 1 ); | |
1543 | - lXPosOffset -= SmallFont->StringWidth ( text ); | |
1544 | - if ( g_bScale ) | |
1545 | - { | |
1546 | - screen->DrawText( SmallFont, ( position == 0 ) ? CR_RED : CR_GOLD, | |
1547 | - (LONG)( g_aulColumnX[ulIdx] * g_fXScale ) + lXPosOffset, | |
1548 | - g_ulCurYPos, | |
1549 | - text.GetChars(), | |
1550 | - DTA_VirtualWidth, g_ValWidth.Int, | |
1551 | - DTA_VirtualHeight, g_ValHeight.Int, | |
1552 | - TAG_DONE ); | |
1553 | - } | |
1554 | - else | |
1555 | - { | |
1556 | - screen->DrawText( SmallFont, ( position == 0 ) ? CR_RED : CR_GOLD, | |
1557 | - (LONG)( g_aulColumnX[ulIdx] / 320.0f * SCREENWIDTH ) + lXPosOffset, | |
1558 | - g_ulCurYPos, | |
1559 | - text.GetChars(), | |
1560 | - DTA_Clean, | |
1561 | - g_bScale, | |
1562 | - TAG_DONE ); | |
1563 | - } | |
1564 | - lXPosOffset -= 4; | |
1565 | - } | |
1566 | - } | |
1567 | - | |
1568 | - // Draw the user's handicap, if any. | |
1569 | - if ( players[ulPlayer].userinfo.GetHandicap() > 0 ) | |
1570 | - { | |
1571 | - char szHandicapString[8]; | |
1572 | - | |
1573 | - if ( lastmanstanding || teamlms ) | |
1574 | - { | |
1575 | - if (( deh.MaxSoulsphere - (LONG)players[ulPlayer].userinfo.GetHandicap() ) < 1 ) | |
1576 | - sprintf( szHandicapString, "(1)" ); | |
1577 | - else | |
1578 | - sprintf( szHandicapString, "(%d)", static_cast<int> (deh.MaxArmor - (LONG)players[ulPlayer].userinfo.GetHandicap()) ); | |
1579 | - } | |
1580 | - else | |
1581 | - { | |
1582 | - if (( deh.StartHealth - (LONG)players[ulPlayer].userinfo.GetHandicap() ) < 1 ) | |
1583 | - sprintf( szHandicapString, "(1)" ); | |
1584 | - else | |
1585 | - sprintf( szHandicapString, "(%d)", static_cast<int> (deh.StartHealth - (LONG)players[ulPlayer].userinfo.GetHandicap()) ); | |
1586 | - } | |
1587 | - | |
1588 | - lXPosOffset -= SmallFont->StringWidth ( szHandicapString ); | |
1589 | - if ( g_bScale ) | |
1590 | - { | |
1591 | - screen->DrawText( SmallFont, ulColor, | |
1592 | - (LONG)( g_aulColumnX[ulIdx] * g_fXScale ) + lXPosOffset, | |
1593 | - g_ulCurYPos, | |
1594 | - szHandicapString, | |
1595 | - DTA_VirtualWidth, g_ValWidth.Int, | |
1596 | - DTA_VirtualHeight, g_ValHeight.Int, | |
1597 | - TAG_DONE ); | |
1598 | - } | |
1599 | - else | |
1600 | - { | |
1601 | - screen->DrawText( SmallFont, ulColor, | |
1602 | - (LONG)( g_aulColumnX[ulIdx] / 320.0f * SCREENWIDTH ) + lXPosOffset, | |
1603 | - g_ulCurYPos, | |
1604 | - szHandicapString, | |
1605 | - DTA_Clean, | |
1606 | - g_bScale, | |
1607 | - TAG_DONE ); | |
1608 | - } | |
1609 | - lXPosOffset -= 4; | |
1610 | - } | |
1611 | - | |
1612 | - // Draw an icon if this player is a ready to go on. | |
1613 | - if ( players[ulPlayer].bReadyToGoOn ) | |
1614 | - { | |
1615 | - sprintf( szPatchName, "RDYTOGO" ); | |
1616 | - lXPosOffset -= TexMan[szPatchName]->GetWidth(); | |
1617 | - if ( g_bScale ) | |
1618 | - { | |
1619 | - screen->DrawTexture( TexMan[szPatchName], | |
1620 | - (LONG)( g_aulColumnX[ulIdx] * g_fXScale ) + lXPosOffset, | |
1621 | - g_ulCurYPos - (( TexMan[szPatchName]->GetHeight( ) - SmallFont->GetHeight( )) / 2 ), | |
1622 | - DTA_VirtualWidth, g_ValWidth.Int, | |
1623 | - DTA_VirtualHeight, g_ValHeight.Int, | |
1624 | - TAG_DONE ); | |
1625 | - } | |
1626 | - else | |
1627 | - { | |
1628 | - screen->DrawTexture( TexMan[szPatchName], | |
1629 | - (LONG)( g_aulColumnX[ulIdx] / 320.0f * SCREENWIDTH ) + lXPosOffset, | |
1630 | - g_ulCurYPos - (( TexMan[szPatchName]->GetHeight( ) - SmallFont->GetHeight( )) / 2 ), | |
1631 | - TAG_DONE ); | |
1632 | - } | |
1633 | - lXPosOffset -= 4; | |
1634 | - } | |
1635 | - | |
1636 | - // Draw a bot icon if this player is a bot. | |
1637 | - if ( players[ulPlayer].bIsBot ) | |
1638 | - { | |
1639 | - sprintf( szPatchName, "BOTSKIL%d", botskill.GetGenericRep( CVAR_Int ).Int); | |
1640 | - | |
1641 | - lXPosOffset -= TexMan[szPatchName]->GetWidth(); | |
1642 | - if ( g_bScale ) | |
1643 | - { | |
1644 | - screen->DrawTexture( TexMan[szPatchName], | |
1645 | - (LONG)( g_aulColumnX[ulIdx] * g_fXScale ) + lXPosOffset, | |
1646 | - g_ulCurYPos, | |
1647 | - DTA_VirtualWidth, g_ValWidth.Int, | |
1648 | - DTA_VirtualHeight, g_ValHeight.Int, | |
1649 | - TAG_DONE ); | |
1650 | - } | |
1651 | - else | |
1652 | - { | |
1653 | - screen->DrawTexture( TexMan[szPatchName], | |
1654 | - (LONG)( g_aulColumnX[ulIdx] / 320.0f * SCREENWIDTH ) + lXPosOffset, | |
1655 | - g_ulCurYPos, | |
1656 | - DTA_Clean, | |
1657 | - g_bScale, | |
1658 | - TAG_DONE ); | |
1659 | - } | |
1660 | - lXPosOffset -= 4; | |
1661 | - } | |
1662 | - | |
1663 | - // Draw a chat icon if this player is chatting. | |
1664 | - // [Cata] Also shows who's in the console. | |
1665 | - if (( players[ulPlayer].bChatting ) || ( players[ulPlayer].bInConsole )) | |
1666 | - { | |
1667 | - if ( players[ulPlayer].bInConsole ) | |
1668 | - sprintf( szPatchName, "CONSMINI" ); | |
1669 | - else | |
1670 | - sprintf( szPatchName, "TLKMINI" ); | |
1671 | - | |
1672 | - lXPosOffset -= TexMan[szPatchName]->GetWidth(); | |
1673 | - if ( g_bScale ) | |
1674 | - { | |
1675 | - screen->DrawTexture( TexMan[szPatchName], | |
1676 | - (LONG)( g_aulColumnX[ulIdx] * g_fXScale ) + lXPosOffset, | |
1677 | - g_ulCurYPos - 1, | |
1678 | - DTA_VirtualWidth, g_ValWidth.Int, | |
1679 | - DTA_VirtualHeight, g_ValHeight.Int, | |
1680 | - TAG_DONE ); | |
1681 | - } | |
1682 | - else | |
1683 | - { | |
1684 | - screen->DrawTexture( TexMan[szPatchName], | |
1685 | - (LONG)( g_aulColumnX[ulIdx] / 320.0f * SCREENWIDTH ) + lXPosOffset, | |
1686 | - g_ulCurYPos - 1, | |
1687 | - DTA_Clean, | |
1688 | - g_bScale, | |
1689 | - TAG_DONE ); | |
1690 | - } | |
1691 | - lXPosOffset -= 4; | |
1692 | - } | |
1693 | - | |
1694 | - // [AK] Also show an icon if the player is lagging to the server. | |
1695 | - if (( players[ulPlayer].bLagging ) && ( players[ulPlayer].bSpectating == false ) && ( gamestate == GS_LEVEL )) | |
1696 | - { | |
1697 | - sprintf( szPatchName, "LAGMINI" ); | |
1543 | + // [AK] Determine the x-position of the text for this column. | |
1544 | + ULONG ulXPos = static_cast<ULONG>( g_aulColumnX[ulColumn] * g_fXScale ); | |
1698 | 1545 | |
1699 | - lXPosOffset -= TexMan[szPatchName]->GetWidth(); | |
1700 | - if ( g_bScale ) | |
1701 | - { | |
1702 | - screen->DrawTexture( TexMan[szPatchName], | |
1703 | - (LONG)( g_aulColumnX[ulIdx] * g_fXScale ) + lXPosOffset, | |
1704 | - g_ulCurYPos - 1, | |
1705 | - DTA_VirtualWidth, g_ValWidth.Int, | |
1706 | - DTA_VirtualHeight, g_ValHeight.Int, | |
1707 | - TAG_DONE ); | |
1708 | - } | |
1709 | - else | |
1710 | - { | |
1711 | - screen->DrawTexture( TexMan[szPatchName], | |
1712 | - (LONG)( g_aulColumnX[ulIdx] / 320.0f * SCREENWIDTH ) + lXPosOffset, | |
1713 | - g_ulCurYPos - 1, | |
1714 | - DTA_Clean, | |
1715 | - g_bScale, | |
1716 | - TAG_DONE ); | |
1717 | - } | |
1718 | - lXPosOffset -= 4; | |
1719 | - } | |
1720 | - | |
1721 | - // Draw text if there's a vote on and this player voted. | |
1722 | - if ( CALLVOTE_GetVoteState() == VOTESTATE_INVOTE ) | |
1723 | - { | |
1724 | - ULONG *pulPlayersWhoVotedYes; | |
1725 | - ULONG *pulPlayersWhoVotedNo; | |
1726 | - ULONG ulNumYes = 0; | |
1727 | - ULONG ulNumNo = 0; | |
1728 | - bool bWeVotedYes = false; | |
1729 | - bool bWeVotedNo = false; | |
1730 | - | |
1731 | - // Get how many players voted for what. | |
1732 | - pulPlayersWhoVotedYes = CALLVOTE_GetPlayersWhoVotedYes( ); | |
1733 | - pulPlayersWhoVotedNo = CALLVOTE_GetPlayersWhoVotedNo( ); | |
1734 | - | |
1735 | - for ( ULONG ulidx2 = 0; ulidx2 < ( MAXPLAYERS / 2 ) + 1; ulidx2++ ) | |
1736 | - { | |
1737 | - | |
1738 | - if ( pulPlayersWhoVotedYes[ulidx2] != MAXPLAYERS ) | |
1739 | - { | |
1740 | - ulNumYes++; | |
1741 | - if( pulPlayersWhoVotedYes[ulidx2] == ulPlayer ) | |
1742 | - bWeVotedYes = true; | |
1743 | - } | |
1546 | + // [AK] We need to display icons and some extra text in the name column. | |
1547 | + if ( g_aulColumnType[ulColumn] == COLUMN_NAME ) | |
1548 | + { | |
1549 | + // Track where we are to draw multiple icons. | |
1550 | + ULONG ulXPosOffset = ulXPos - SmallFont->StringWidth( " " ); | |
1744 | 1551 | |
1745 | - if ( pulPlayersWhoVotedNo[ulidx2] != MAXPLAYERS ) | |
1746 | - { | |
1747 | - ulNumNo++; | |
1748 | - if( pulPlayersWhoVotedNo[ulidx2] == ulPlayer) | |
1749 | - bWeVotedNo = true; | |
1750 | - } | |
1751 | - | |
1752 | - } | |
1753 | - | |
1754 | - if( bWeVotedYes || bWeVotedNo ) | |
1755 | - { | |
1756 | - char szVoteString[8]; | |
1552 | + // [TP] If this player is in the join queue, display the position. | |
1553 | + int position = JOINQUEUE_GetPositionInLine( ulPlayer ); | |
1554 | + if ( position != -1 ) | |
1555 | + { | |
1556 | + text.Format( "%d.", position + 1 ); | |
1557 | + scoreboard_DrawText( text, position == 0 ? CR_RED : CR_GOLD, ulXPosOffset, 4 ); | |
1558 | + } | |
1757 | 1559 | |
1758 | - sprintf( szVoteString, "(%s)", bWeVotedYes ? "yes" : "no" ); | |
1759 | - lXPosOffset -= SmallFont->StringWidth ( szVoteString ); | |
1760 | - if ( g_bScale ) | |
1761 | - { | |
1762 | - screen->DrawText( SmallFont, ( CALLVOTE_GetVoteCaller() == ulPlayer ) ? CR_RED : CR_GOLD, | |
1763 | - (LONG)( g_aulColumnX[ulIdx] * g_fXScale ) + lXPosOffset, | |
1764 | - g_ulCurYPos, | |
1765 | - szVoteString, | |
1766 | - DTA_VirtualWidth, g_ValWidth.Int, | |
1767 | - DTA_VirtualHeight, g_ValHeight.Int, | |
1768 | - TAG_DONE ); | |
1769 | - } | |
1770 | - else | |
1771 | - { | |
1772 | - screen->DrawText( SmallFont, ( static_cast<signed> (CALLVOTE_GetVoteCaller()) == consoleplayer ) ? CR_RED : CR_GOLD, | |
1773 | - (LONG)( g_aulColumnX[ulIdx] / 320.0f * SCREENWIDTH ) + lXPosOffset, | |
1774 | - g_ulCurYPos, | |
1775 | - szVoteString, | |
1776 | - DTA_Clean, | |
1777 | - g_bScale, | |
1778 | - TAG_DONE ); | |
1779 | - } | |
1780 | - lXPosOffset -= 4; | |
1781 | - } | |
1782 | - } | |
1560 | + // Draw the user's handicap, if any. | |
1561 | + int handicap = players[ulPlayer].userinfo.GetHandicap( ); | |
1562 | + if ( handicap > 0 ) | |
1563 | + { | |
1564 | + if (( lastmanstanding ) || ( teamlms )) | |
1565 | + text.Format( "(%d)", deh.MaxSoulsphere - handicap < 1 ? 1 : deh.MaxArmor - handicap ); | |
1566 | + else | |
1567 | + text.Format( "(%d)", deh.StartHealth - handicap < 1 ? 1 : deh.StartHealth - handicap ); | |
1783 | 1568 | |
1784 | - break; | |
1785 | - case COLUMN_TIME: | |
1786 | - | |
1787 | - sprintf( szString, "%d", static_cast<unsigned int> (players[ulPlayer].ulTime / ( TICRATE * 60 ))); | |
1788 | - break; | |
1789 | - case COLUMN_PING: | |
1569 | + scoreboard_DrawText( text, static_cast<EColorRange>( ulColor ), ulXPosOffset, 4 ); | |
1570 | + } | |
1790 | 1571 | |
1791 | - sprintf( szString, "%d", static_cast<unsigned int> (players[ulPlayer].ulPing) ); | |
1792 | - break; | |
1793 | - case COLUMN_FRAGS: | |
1572 | + // Draw an icon if this player is a ready to go on. | |
1573 | + if ( players[ulPlayer].bReadyToGoOn ) | |
1574 | + scoreboard_DrawIcon( "RDYTOGO", ulXPosOffset, g_ulCurYPos, 4 ); | |
1794 | 1575 | |
1795 | - sprintf( szString, "%d", players[ulPlayer].fragcount ); | |
1576 | + // Draw a bot icon if this player is a bot. | |
1577 | + if ( players[ulPlayer].bIsBot ) | |
1578 | + { | |
1579 | + FString patchName; | |
1580 | + patchName.Format( "BOTSKIL%d", botskill.GetGenericRep( CVAR_Int ).Int ); | |
1581 | + scoreboard_DrawIcon( patchName, ulXPosOffset, g_ulCurYPos, 4 ); | |
1582 | + } | |
1796 | 1583 | |
1797 | - // If the player isn't really playing, change this. | |
1798 | - if (( GAMEMODE_GetCurrentFlags() & GMF_PLAYERSONTEAMS ) && | |
1799 | - ( players[ulPlayer].bOnTeam == false )) | |
1584 | + // Draw a chat icon if this player is chatting. | |
1585 | + // [Cata] Also shows who's in the console. | |
1586 | + if (( players[ulPlayer].bChatting ) || ( players[ulPlayer].bInConsole )) | |
1587 | + scoreboard_DrawIcon( players[ulPlayer].bInConsole ? "CONSMINI" : "TLKMINI", ulXPosOffset, g_ulCurYPos, 4 ); | |
1588 | + | |
1589 | + // [AK] Also show an icon if the player is lagging to the server. | |
1590 | + if (( players[ulPlayer].bLagging ) && ( players[ulPlayer].bSpectating == false ) && ( gamestate == GS_LEVEL )) | |
1591 | + scoreboard_DrawIcon( "LAGMINI", ulXPosOffset, g_ulCurYPos, 4 ); | |
1592 | + | |
1593 | + // Draw text if there's a vote on and this player voted. | |
1594 | + if ( CALLVOTE_GetVoteState( ) == VOTESTATE_INVOTE ) | |
1595 | + { | |
1596 | + ULONG ulVoteChoice = CALLVOTE_GetPlayerVoteChoice( ulPlayer ); | |
1597 | + | |
1598 | + // [AK] Check if this player either voted yes or no. | |
1599 | + if ( ulVoteChoice != VOTE_UNDECIDED ) | |
1800 | 1600 | { |
1801 | - sprintf( szString, "NO TEAM" ); | |
1601 | + text.Format( "(%s)", ulVoteChoice == VOTE_YES ? "Yes" : "No" ); | |
1602 | + scoreboard_DrawText( text, CALLVOTE_GetVoteCaller( ) == ulPlayer ? CR_RED : CR_GOLD, ulXPosOffset, 4 ); | |
1802 | 1603 | } |
1803 | - if(PLAYER_IsTrueSpectator( &players[ulPlayer] )) | |
1804 | - sprintf(szString, "SPECT"); | |
1805 | - | |
1806 | - if (( GAMEMODE_GetCurrentFlags() & GMF_DEADSPECTATORS ) && | |
1807 | - (( players[ulPlayer].health <= 0 ) || ( players[ulPlayer].bDeadSpectator )) && | |
1808 | - ( gamestate != GS_INTERMISSION )) | |
1809 | - { | |
1810 | - sprintf( szString, "DEAD" ); | |
1811 | - } | |
1812 | - break; | |
1813 | - case COLUMN_POINTS: | |
1814 | - | |
1815 | - sprintf( szString, "%d", static_cast<int> (players[ulPlayer].lPointCount) ); | |
1816 | - | |
1817 | - // If the player isn't really playing, change this. | |
1818 | - if (( GAMEMODE_GetCurrentFlags() & GMF_PLAYERSONTEAMS ) && | |
1819 | - ( players[ulPlayer].bOnTeam == false )) | |
1820 | - { | |
1821 | - sprintf( szString, "NO TEAM" ); | |
1822 | - } | |
1823 | - if(PLAYER_IsTrueSpectator( &players[ulPlayer] )) | |
1824 | - sprintf(szString, "SPECT"); | |
1825 | - | |
1826 | - if (( GAMEMODE_GetCurrentFlags() & GMF_DEADSPECTATORS ) && | |
1827 | - (( players[ulPlayer].health <= 0 ) || ( players[ulPlayer].bDeadSpectator )) && | |
1828 | - ( gamestate != GS_INTERMISSION )) | |
1829 | - { | |
1830 | - sprintf( szString, "DEAD" ); | |
1831 | - } | |
1832 | - break; | |
1833 | - | |
1834 | - case COLUMN_POINTSASSISTS: | |
1835 | - sprintf(szString, "%d / %d", static_cast<int> (players[ulPlayer].lPointCount), static_cast<unsigned int> (players[ulPlayer].ulMedalCount[14])); | |
1836 | - | |
1837 | - // If the player isn't really playing, change this. | |
1838 | - if (( GAMEMODE_GetCurrentFlags() & GMF_PLAYERSONTEAMS ) && | |
1839 | - ( players[ulPlayer].bOnTeam == false )) | |
1840 | - { | |
1841 | - sprintf( szString, "NO TEAM" ); | |
1842 | - } | |
1843 | - if(PLAYER_IsTrueSpectator( &players[ulPlayer] )) | |
1844 | - sprintf(szString, "SPECT"); | |
1845 | - | |
1846 | - if (( GAMEMODE_GetCurrentFlags() & GMF_DEADSPECTATORS ) && | |
1847 | - (( players[ulPlayer].health <= 0 ) || ( players[ulPlayer].bDeadSpectator )) && | |
1848 | - ( gamestate != GS_INTERMISSION )) | |
1849 | - { | |
1850 | - sprintf( szString, "DEAD" ); | |
1851 | - } | |
1852 | - break; | |
1604 | + } | |
1853 | 1605 | |
1854 | - case COLUMN_DEATHS: | |
1855 | - sprintf(szString, "%d", static_cast<unsigned int> (players[ulPlayer].ulDeathCount)); | |
1856 | - break; | |
1857 | - | |
1858 | - case COLUMN_WINS: | |
1859 | - sprintf(szString, "%d", static_cast<unsigned int> (players[ulPlayer].ulWins)); | |
1860 | - | |
1861 | - // If the player isn't really playing, change this. | |
1862 | - if (( GAMEMODE_GetCurrentFlags() & GMF_PLAYERSONTEAMS ) && | |
1863 | - ( players[ulPlayer].bOnTeam == false )) | |
1864 | - { | |
1865 | - sprintf( szString, "NO TEAM" ); | |
1866 | - } | |
1867 | - if(PLAYER_IsTrueSpectator( &players[ulPlayer] )) | |
1868 | - sprintf(szString, "SPECT"); | |
1869 | - | |
1870 | - if (( GAMEMODE_GetCurrentFlags() & GMF_DEADSPECTATORS ) && | |
1871 | - (( players[ulPlayer].health <= 0 ) || ( players[ulPlayer].bDeadSpectator )) && | |
1872 | - ( gamestate != GS_INTERMISSION )) | |
1873 | - { | |
1874 | - sprintf( szString, "DEAD" ); | |
1875 | - } | |
1876 | - break; | |
1877 | - | |
1878 | - case COLUMN_KILLS: | |
1879 | - sprintf(szString, "%d", players[ulPlayer].killcount); | |
1606 | + text = players[ulPlayer].userinfo.GetName( ); | |
1607 | + } | |
1608 | + else if ( g_aulColumnType[ulColumn] == COLUMN_TIME ) | |
1609 | + { | |
1610 | + text.Format( "%d", static_cast<unsigned int>( players[ulPlayer].ulTime / ( TICRATE * 60 ))); | |
1611 | + } | |
1612 | + else if ( g_aulColumnType[ulColumn] == COLUMN_PING ) | |
1613 | + { | |
1614 | + text.Format( "%d", static_cast<unsigned int>( players[ulPlayer].ulPing )); | |
1615 | + } | |
1616 | + else if ( g_aulColumnType[ulColumn] == COLUMN_DEATHS ) | |
1617 | + { | |
1618 | + text.Format( "%d", static_cast<unsigned int>( players[ulPlayer].ulDeathCount )); | |
1619 | + } | |
1620 | + else | |
1621 | + { | |
1622 | + switch ( g_aulColumnType[ulColumn] ) | |
1623 | + { | |
1624 | + case COLUMN_FRAGS: | |
1625 | + text.Format( "%d", players[ulPlayer].fragcount ); | |
1626 | + break; | |
1880 | 1627 | |
1881 | - // If the player isn't really playing, change this. | |
1882 | - if(PLAYER_IsTrueSpectator( &players[ulPlayer] )) | |
1883 | - sprintf(szString, "SPECT"); | |
1628 | + case COLUMN_POINTS: | |
1629 | + text.Format( "%d", static_cast<int>( players[ulPlayer].lPointCount )); | |
1630 | + break; | |
1884 | 1631 | |
1885 | - if (( GAMEMODE_GetCurrentFlags() & GMF_DEADSPECTATORS ) && | |
1886 | - (( players[ulPlayer].health <= 0 ) || ( players[ulPlayer].bDeadSpectator )) && | |
1887 | - ( gamestate != GS_INTERMISSION )) | |
1888 | - { | |
1889 | - sprintf( szString, "DEAD" ); | |
1890 | - } | |
1891 | - break; | |
1892 | - case COLUMN_SECRETS: | |
1893 | - sprintf(szString, "%d", players[ulPlayer].secretcount); | |
1894 | - // If the player isn't really playing, change this. | |
1895 | - if(PLAYER_IsTrueSpectator( &players[ulPlayer] )) | |
1896 | - sprintf(szString, "SPECT"); | |
1897 | - if(((players[ulPlayer].health <= 0) || ( players[ulPlayer].bDeadSpectator )) | |
1898 | - && (gamestate != GS_INTERMISSION)) | |
1899 | - { | |
1900 | - sprintf(szString, "DEAD"); | |
1901 | - } | |
1632 | + case COLUMN_POINTSASSISTS: | |
1633 | + text.Format( "%d / %d", static_cast<int>( players[ulPlayer].lPointCount ), static_cast<unsigned int>( players[ulPlayer].ulMedalCount[14] )); | |
1634 | + break; | |
1902 | 1635 | |
1903 | - if (( GAMEMODE_GetCurrentFlags() & GMF_DEADSPECTATORS ) && | |
1904 | - (( players[ulPlayer].health <= 0 ) || ( players[ulPlayer].bDeadSpectator )) && | |
1905 | - ( gamestate != GS_INTERMISSION )) | |
1906 | - { | |
1907 | - sprintf( szString, "DEAD" ); | |
1908 | - } | |
1909 | - break; | |
1910 | - | |
1636 | + case COLUMN_WINS: | |
1637 | + text.Format( "%d", static_cast<unsigned int>( players[ulPlayer].ulWins )); | |
1638 | + break; | |
1639 | + | |
1640 | + case COLUMN_KILLS: | |
1641 | + text.Format( "%d", players[ulPlayer].killcount ); | |
1642 | + break; | |
1643 | + | |
1644 | + case COLUMN_SECRETS: | |
1645 | + text.Format( "%d", players[ulPlayer].secretcount ); | |
1646 | + break; | |
1647 | + } | |
1648 | + | |
1649 | + // If the player isn't really playing, change this. | |
1650 | + if ( PLAYER_IsTrueSpectator( &players[ulPlayer] )) | |
1651 | + text = "Spect"; | |
1652 | + else if (( GAMEMODE_GetCurrentFlags( ) & GMF_PLAYERSONTEAMS ) && ( players[ulPlayer].bOnTeam == false )) | |
1653 | + text = "No Team"; | |
1654 | + else if (( GAMEMODE_GetCurrentFlags( ) & GMF_DEADSPECTATORS ) && (( players[ulPlayer].health <= 0 ) || ( players[ulPlayer].bDeadSpectator )) && ( gamestate != GS_INTERMISSION )) | |
1655 | + text = "Dead"; | |
1911 | 1656 | } |
1912 | 1657 | |
1913 | - if ( szString[0] != 0 ) | |
1914 | - { | |
1915 | - if ( g_bScale ) | |
1916 | - { | |
1917 | - screen->DrawText( SmallFont, ulColor, | |
1918 | - (LONG)( g_aulColumnX[ulIdx] * g_fXScale ), | |
1919 | - g_ulCurYPos, | |
1920 | - szString, | |
1921 | - DTA_VirtualWidth, g_ValWidth.Int, | |
1922 | - DTA_VirtualHeight, g_ValHeight.Int, | |
1923 | - TAG_DONE ); | |
1924 | - } | |
1925 | - else | |
1926 | - { | |
1927 | - screen->DrawText( SmallFont, ulColor, | |
1928 | - (LONG)( g_aulColumnX[ulIdx] / 320.0f * SCREENWIDTH ), | |
1929 | - g_ulCurYPos, | |
1930 | - szString, | |
1931 | - TAG_DONE ); | |
1932 | - } | |
1933 | - } | |
1658 | + HUD_DrawText( SmallFont, ulColor, ulXPos, g_ulCurYPos, text, g_bScale ); | |
1934 | 1659 | } |
1935 | 1660 | } |
1936 | 1661 |