-
Notifications
You must be signed in to change notification settings - Fork 24
Show SourceTV separately on scoreboard #2045
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AdamTadeusz
wants to merge
2
commits into
NeotokyoRebuild:master
Choose a base branch
from
AdamTadeusz:372_ShowSourceTVSeparatelyOnScoreboard
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -345,13 +345,20 @@ void CNEOScoreBoard::Update() | |
| m_iTotalPlayers = 0; | ||
| V_memset(m_playersInfo, 0, sizeof(m_playersInfo)); | ||
|
|
||
| m_bSourceTVEnabled = false; | ||
| for (int i = 1; i <= gpGlobals->maxClients; ++i) | ||
| { | ||
| if (false == g_PR->IsConnected(i)) | ||
| { | ||
| continue; | ||
| } | ||
|
|
||
| if (true == g_PR->IsHLTV(i)) | ||
| { | ||
| m_bSourceTVEnabled = true; | ||
| continue; | ||
| } | ||
|
|
||
| C_NEO_Player *pNeoPlayer = ToNEOPlayer(UTIL_PlayerByIndex(i)); | ||
| C_NEO_Player *pNeoImpersonator = pNeoPlayer | ||
| ? ToNEOPlayer(pNeoPlayer->m_hSpectatorTakeoverPlayerImpersonatingMe.Get()) | ||
|
|
@@ -795,14 +802,14 @@ void CNEOScoreBoard::OnMainLoop(const NeoUI::Mode eMode) | |
| } | ||
| if (bShowReadyUp) | ||
| { | ||
| V_swprintf_safe(wszText, L"%ls: %d (%d players - %d ready)", | ||
| wszTeamtag, pTeam->GetRoundsWon(), iaTeamTally[iCurTeam], | ||
| V_swprintf_safe(wszText, L"%ls: %d (%d player%s - %d ready)", | ||
| wszTeamtag, pTeam->GetRoundsWon(), iaTeamTally[iCurTeam], iaTeamTally[iCurTeam] == 1 ? "" : "s", | ||
| iaTeamReadyTally[iCurTeam]); | ||
| } | ||
| else | ||
| { | ||
| V_swprintf_safe(wszText, L"%ls: %d (%d players)", | ||
| wszTeamtag, pTeam->GetRoundsWon(), iaTeamTally[iCurTeam]); | ||
| V_swprintf_safe(wszText, L"%ls: %d (%d player%s)", | ||
| wszTeamtag, pTeam->GetRoundsWon(), iaTeamTally[iCurTeam], iaTeamTally[iCurTeam] == 1 ? "" : "s"); | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -811,26 +818,33 @@ void CNEOScoreBoard::OnMainLoop(const NeoUI::Mode eMode) | |
| // DM - Print players total on the left side only | ||
| if (iCurTeam == TEAM_JINRAI) | ||
| { | ||
| V_swprintf_safe(wszText, L"Players: %d", | ||
| iaTeamTally[TEAM_JINRAI] + iaTeamTally[TEAM_NSF]); | ||
| const int total = iaTeamTally[TEAM_JINRAI] + iaTeamTally[TEAM_NSF]; | ||
| V_swprintf_safe(wszText, L"Player%s: %d", | ||
| total == 1 ? "" : "s", total); | ||
| } | ||
| else | ||
| { | ||
| wszText[0] = L'\0'; | ||
| } | ||
| } | ||
| } | ||
| else if (TEAM_SPECTATOR == iCurTeam && m_HLTVSpectators > 0) | ||
| { | ||
| V_swprintf_safe(wszText, L"%ls + %d HLTV spectators", | ||
| SZWSZ_NEO_TEAM_STRS[iCurTeam].wszStr, m_HLTVSpectators); | ||
| } | ||
| else | ||
| { | ||
| V_wcscpy_safe(wszText, SZWSZ_NEO_TEAM_STRS[iCurTeam].wszStr); | ||
| V_swprintf_safe(wszText, L"%ls (%d player%s)", | ||
| SZWSZ_NEO_TEAM_STRS[iCurTeam].wszStr, iaTeamTally[iCurTeam], iaTeamTally[iCurTeam] == 1 ? "" : "s"); | ||
| } | ||
| NeoUI::Label(wszText, true); | ||
|
|
||
| if (TEAM_SPECTATOR == iCurTeam && m_bSourceTVEnabled) | ||
| { | ||
| V_swprintf_safe(wszText,L"SourceTV Enabled (%d watching)", m_HLTVSpectators); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| int x = 0; | ||
| [[maybe_unused]] int y = 0; | ||
| vgui::surface()->GetTextSize(m_uiCtx.fonts[m_uiCtx.eFont].hdl, wszText, x, y); | ||
| vgui::surface()->DrawSetTextPos(m_uiCtx.rWidgetArea.x0 + m_uiCtx.dPanel.wide - x - m_uiCtx.iMarginX, m_uiCtx.rWidgetArea.y0 + m_uiCtx.fonts[m_uiCtx.eFont].iYFontOffset); | ||
| vgui::surface()->DrawPrintText(wszText, V_wcslen(wszText)); | ||
| } | ||
|
|
||
| NeoUI::Pad(); // Avatar/Dead-indicator | ||
| NeoUI::Pad(); // Name column | ||
| if (iCurTeam >= FIRST_GAME_TEAM) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,7 +96,9 @@ class CNEOScoreBoard : public vgui::Panel, public IViewPortPanel, public CGameEv | |
|
|
||
| NeoUI::Context m_uiCtx; | ||
|
|
||
| bool m_bSourceTVEnabled = 0; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| int m_HLTVSpectators = 0; | ||
|
|
||
| int m_iTotalPlayers = 0; | ||
| CNEOScoreBoardPlayer m_playersInfo[MAX_PLAYERS_ARRAY_SAFE] = {}; | ||
| CNEOScoreBoardPlayer m_playerPopup = {}; | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true == g_PR->IsHLTV(i)->g_PR->IsHLTV(i)