]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Cleanup scoreboard code a little bit
authorterencehill <piuntn@gmail.com>
Thu, 8 Sep 2016 14:43:30 +0000 (16:43 +0200)
committerterencehill <piuntn@gmail.com>
Thu, 8 Sep 2016 14:43:30 +0000 (16:43 +0200)
qcsrc/client/hud/panel/score.qc
qcsrc/client/hud/panel/scoreboard.qc
qcsrc/client/hud/panel/scoreboard.qh
qcsrc/client/view.qc

index 4b5df98d19892d237ba925b62f7439afd398eabe..f3d55a433e8db1792ddc098c8bd71e7f4b0186f8 100644 (file)
@@ -6,7 +6,6 @@
 
 // Score (#7)
 
-void Scoreboard_UpdatePlayerTeams();
 void HUD_Score_Rankings(vector pos, vector mySize, entity me)
 {
        float score;
index f82c7345ca0c7d3afdc84102cd5a728afa54c6ed..4e81d3789d317354b3cbe363cea2c669836be771 100644 (file)
@@ -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;
index 2c8c77dd6f2370d25a6fa85dbe8aefb9b0c5cbb7..a560b74c74ab616e33fc4ac497741a6e22cf4f48 100644 (file)
@@ -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();
index c272e3217952cfb258cfa292a034351e80e82981..e5f8b6a580969ee76a0687fd19aee735a756afa1 100644 (file)
@@ -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;