From: terencehill Date: Thu, 8 Sep 2016 14:43:30 +0000 (+0200) Subject: Cleanup scoreboard code a little bit X-Git-Tag: xonotic-v0.8.2~613 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=16a9d9cea4f5f6ffd835c662175349a7959af231;p=xonotic%2Fxonotic-data.pk3dir.git Cleanup scoreboard code a little bit --- diff --git a/qcsrc/client/hud/panel/score.qc b/qcsrc/client/hud/panel/score.qc index 4b5df98d1..f3d55a433 100644 --- a/qcsrc/client/hud/panel/score.qc +++ b/qcsrc/client/hud/panel/score.qc @@ -6,7 +6,6 @@ // Score (#7) -void Scoreboard_UpdatePlayerTeams(); void HUD_Score_Rankings(vector pos, vector mySize, entity me) { float score; diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index f82c7345c..4e81d3789 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -141,12 +141,10 @@ void Scoreboard_UpdatePlayerTeams() { float Team; entity pl, tmp; - float num; - - num = 0; + //int num = 0; for(pl = players.sort_next; pl; pl = pl.sort_next) { - num += 1; + //num += 1; Team = entcs_GetScoreTeam(pl.sv_entnum); if(SetTeam(pl, Team)) { @@ -366,8 +364,8 @@ void Cmd_Scoreboard_SetFields(int argc) TC(int, argc); int i, slash; string str, pattern; - float have_name = 0, have_primary = 0, have_secondary = 0, have_separator = 0; - float missing; + bool have_name = false, have_primary = false, have_secondary = false, have_separator = false; + int missing; if(!gametype) return; // do nothing, we don't know gametype and scores yet @@ -470,9 +468,9 @@ LABEL(notfound) LABEL(found) sbt_field[sbt_num_fields] = j; if(j == ps_primary) - have_primary = 1; + have_primary = true; if(j == ps_secondary) - have_secondary = 1; + have_secondary = true; } } @@ -482,11 +480,11 @@ LABEL(found) } if(scores_flags(ps_primary) & SFL_ALLOW_HIDE) - have_primary = 1; + have_primary = true; if(scores_flags(ps_secondary) & SFL_ALLOW_HIDE) - have_secondary = 1; + have_secondary = true; if(ps_primary == ps_secondary) - have_secondary = 1; + have_secondary = true; missing = (!have_primary) + (!have_secondary) + (!have_separator) + (!have_name); if(sbt_num_fields + missing < MAX_SBT_FIELDS) @@ -953,22 +951,23 @@ vector Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_size) return end_pos; } -float Scoreboard_WouldDraw() { +bool Scoreboard_WouldDraw() +{ if (QuickMenu_IsOpened()) - return 0; + return false; else if (HUD_Radar_Clickable()) - return 0; + return false; else if (scoreboard_showscores) - return 1; + return true; else if (intermission == 1) - return 1; + return true; else if (intermission == 2) - return 0; + return false; else if (spectatee_status != -1 && STAT(HEALTH) <= 0 && autocvar_cl_deathscoreboard && gametype != MAPINFO_TYPE_CTS && !active_minigame) - return 1; + return true; else if (scoreboard_showscores_force) - return 1; - return 0; + return true; + return false; } float average_accuracy; diff --git a/qcsrc/client/hud/panel/scoreboard.qh b/qcsrc/client/hud/panel/scoreboard.qh index 2c8c77dd6..a560b74c7 100644 --- a/qcsrc/client/hud/panel/scoreboard.qh +++ b/qcsrc/client/hud/panel/scoreboard.qh @@ -1,12 +1,13 @@ #pragma once #include "../panel.qh" -float scoreboard_active; +bool scoreboard_active; float scoreboard_fade_alpha; void Cmd_Scoreboard_SetFields(float argc); void Scoreboard_Draw(); void Scoreboard_InitScores(); +void Scoreboard_UpdatePlayerTeams(); void Scoreboard_UpdatePlayerPos(entity pl); void Scoreboard_UpdateTeamPos(entity Team); -float Scoreboard_WouldDraw(); +bool Scoreboard_WouldDraw(); diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index c272e3217..e5f8b6a58 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -710,7 +710,6 @@ float TrueAimCheck() void PostInit(); void CSQC_Demo_Camera(); -float Scoreboard_WouldDraw(); float camera_mode; const float CAMERA_FREE = 1; const float CAMERA_CHASE = 2;