From 6a4e17ea8520e9eb3a88ce15a9e337679d631775 Mon Sep 17 00:00:00 2001 From: Alfred Eriksson Date: Sun, 7 Sep 2008 15:07:08 +0000 Subject: [PATCH] added round number to the scoreboard --- datasrc/network.py | 3 +++ src/game/client/components/scoreboard.cpp | 26 +++++++++++++++++------ src/game/server/gamecontroller.cpp | 3 +++ 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/datasrc/network.py b/datasrc/network.py index c5d021a20..bb3545af6 100644 --- a/datasrc/network.py +++ b/datasrc/network.py @@ -96,6 +96,9 @@ Objects = [ NetIntRange("time_limit", 0, 'max_int'), NetIntRange("warmup", 0, 'max_int'), + + NetIntRange("round_num", 0, 'max_int'), + NetIntRange("round_current", 0, 'max_int'), NetIntAny("teamscore_red"), NetIntAny("teamscore_blue"), diff --git a/src/game/client/components/scoreboard.cpp b/src/game/client/components/scoreboard.cpp index e0c7765a5..9159d3918 100644 --- a/src/game/client/components/scoreboard.cpp +++ b/src/game/client/components/scoreboard.cpp @@ -42,17 +42,29 @@ void SCOREBOARD::render_goals(float x, float y, float w) // render goals //y = ystart+h-54; - if(gameclient.snap.gameobj && gameclient.snap.gameobj->time_limit) - { - char buf[64]; - str_format(buf, sizeof(buf), "Time Limit: %d min", gameclient.snap.gameobj->time_limit); - gfx_text(0, x+w/2, y, 24.0f, buf, -1); - } + float tw = 0.0f; if(gameclient.snap.gameobj && gameclient.snap.gameobj->score_limit) { char buf[64]; str_format(buf, sizeof(buf), "Score Limit: %d", gameclient.snap.gameobj->score_limit); - gfx_text(0, x+40, y, 24.0f, buf, -1); + gfx_text(0, x+20.0f, y, 22.0f, buf, -1); + tw += gfx_text_width(0, 22.0f, buf, -1); + } + if(gameclient.snap.gameobj && gameclient.snap.gameobj->time_limit) + { + char buf[64]; + str_format(buf, sizeof(buf), "Time Limit: %d min", gameclient.snap.gameobj->time_limit); + gfx_text(0, x+220.0f, y, 22.0f, buf, -1); + tw += gfx_text_width(0, 22.0f, buf, -1); + } + if(gameclient.snap.gameobj && gameclient.snap.gameobj->round_num && gameclient.snap.gameobj->round_current) + { + char buf[64]; + str_format(buf, sizeof(buf), "Round %d/%d", gameclient.snap.gameobj->round_current, gameclient.snap.gameobj->round_num); + gfx_text(0, x+450.0f, y, 22.0f, buf, -1); + + /*[48c3fd4c][game/scoreboard]: timelimit x:219.428558 + [48c3fd4c][game/scoreboard]: round x:453.142822*/ } } diff --git a/src/game/server/gamecontroller.cpp b/src/game/server/gamecontroller.cpp index bf4f5451b..dc4ec1296 100644 --- a/src/game/server/gamecontroller.cpp +++ b/src/game/server/gamecontroller.cpp @@ -450,6 +450,9 @@ void GAMECONTROLLER::snap(int snapping_client) gameobj->warmup = warmup; + gameobj->round_num = (strlen(config.sv_maprotation) || config.sv_rounds_per_map > 1) ? config.sv_rounds_per_map : 0; + gameobj->round_current = round_count+1; + gameobj->teamscore_red = is_teamplay() ? teamscore[0] : game.players[snapping_client].score; gameobj->teamscore_blue = teamscore[1]; }