Skip to content
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

Add player count to scoreboard #274

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Version 1.9.0 (not released yet)
- Do not load unnecessary VPPs in dedicated server mode
- Add level filename to "Level Initializing" console message
- Properly handle WM_PAINT in dedicated server, may improve performance (DF bug)
- Add current server player count to scoreboard

Version 1.8.0 (released 2022-09-17)
-----------------------------------
Expand Down
19 changes: 11 additions & 8 deletions game_patch/hud/multi_scoreboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,17 @@ int draw_scoreboard_header(int x, int y, int w, rf::NetGameType game_type, bool

// Draw Game Type name
if (!dry_run) {
const char* game_type_name;
if (game_type == rf::NG_TYPE_DM)
game_type_name = rf::strings::deathmatch;
else if (game_type == rf::NG_TYPE_CTF)
game_type_name = rf::strings::capture_the_flag;
else
game_type_name = rf::strings::team_deathmatch;
rf::gr::string_aligned(rf::gr::ALIGN_CENTER, x_center, cur_y, game_type_name);
int num_players = rf::multi_num_players();
std::string player_count_str =
" | " + std::to_string(num_players) + (num_players > 1 ? " PLAYERS" : " PLAYER");

std::string game_type_name = (game_type == rf::NG_TYPE_DM) ? rf::strings::deathmatch
: (game_type == rf::NG_TYPE_CTF) ? rf::strings::capture_the_flag
: rf::strings::team_deathmatch;

game_type_name += player_count_str;

rf::gr::string_aligned(rf::gr::ALIGN_CENTER, x_center, cur_y, game_type_name.c_str());
}
int font_h = rf::gr::get_font_height(-1);
cur_y += font_h + 8;
Expand Down