]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/scoreboard.qc
Declare more ints as ints
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / scoreboard.qc
index b6efc3b3a7c1c22a97e301fa7846af504d2b946c..9a1cef2788855fc64bdbac28fa25e3974eb6b940 100644 (file)
@@ -57,7 +57,7 @@ string TranslateScoresLabel(string l)
 void Cmd_HUD_SetFields(float argc);
 void HUD_InitScores()
 {
-       float i, f;
+       int i, f;
 
        ps_primary = ps_secondary = ts_primary = ts_secondary = -1;
        for(i = 0; i < MAX_SCORE; ++i)
@@ -116,7 +116,7 @@ void HUD_UpdatePlayerTeams()
        */
 }
 
-float HUD_CompareScore(float vl, float vr, float f)
+int HUD_CompareScore(float vl, float vr, int f)
 {
        if(f & SFL_ZERO_IS_WORST)
        {
@@ -192,7 +192,7 @@ void HUD_UpdatePlayerPos(entity player)
 
 float HUD_CompareTeamScores(entity left, entity right)
 {
-       float i, r;
+       int i, r;
 
        if(left.team == NUM_SPECTATOR)
                return 1;
@@ -299,7 +299,7 @@ void Cmd_HUD_Help()
 
 void Cmd_HUD_SetFields(float argc)
 {
-       float i, j, slash;
+       int i, j, slash;
        string str, pattern;
        float have_name = 0, have_primary = 0, have_secondary = 0, have_separator = 0;
        float missing;
@@ -555,7 +555,7 @@ string HUD_GetField(entity pl, float field)
                                        hud_field_icon1 = "gfx/scoreboard/playercolor_shirt";
                                        hud_field_icon1_rgb = colormapPaletteColor(floor(f / 16), 0);
                                        hud_field_icon2 = "gfx/scoreboard/playercolor_pants";
-                                       hud_field_icon2_rgb = colormapPaletteColor(mod(f, 16), 1);
+                                       hud_field_icon2_rgb = colormapPaletteColor(f % 16, 1);
                                }
                        }
                        return GetPlayerName(pl.sv_entnum);
@@ -611,7 +611,7 @@ float hud_fixscoreboardcolumnwidth_len;
 float hud_fixscoreboardcolumnwidth_iconlen;
 float hud_fixscoreboardcolumnwidth_marginlen;
 
-string HUD_FixScoreboardColumnWidth(float i, string str)
+string HUD_FixScoreboardColumnWidth(int i, string str)
 {
        float field, f;
        vector sz;
@@ -652,7 +652,8 @@ string HUD_FixScoreboardColumnWidth(float i, string str)
 
        if(field == SP_NAME) // name gets all remaining space
        {
-               float namesize, j;
+               int j;
+               float namesize;
                namesize = sbwidth;// / hud_fontsize_x;
                for(j = 0; j < hud_num_fields; ++j)
                        if(j != i)
@@ -676,12 +677,12 @@ string HUD_FixScoreboardColumnWidth(float i, string str)
        return str;
 }
 
-void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_self, float pl_number)
+void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_self, int pl_number)
 {
        vector tmp, rgb;
        rgb = Team_ColorRGB(pl.team);
        string str;
-       float i, field;
+       float field;
        float is_spec;
        is_spec = (GetPlayerColor(pl.sv_entnum) == NUM_SPECTATOR);
 
@@ -695,13 +696,13 @@ void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_s
        // alternated rows highlighting
        if(is_self)
                drawfill(h_pos, h_size, rgb, scoreboard_highlight_alpha_self, DRAWFLAG_NORMAL);
-       else if((scoreboard_highlight) && (!mod(pl_number,2)))
+       else if((scoreboard_highlight) && (!(pl_number % 2)))
                drawfill(h_pos, h_size, rgb, scoreboard_highlight_alpha, DRAWFLAG_NORMAL);
 
        tmp_x = item_size_x;
        tmp_y = 0;
        tmp_z = 0;
-
+       int i;
        for(i = 0; i < hud_num_fields; ++i)
        {
                field = hud_field[i];
@@ -874,7 +875,7 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz
                column_dim_x = hud_size[i] + hud_fontsize_x;
                if (scoreboard_highlight)
                {
-                       if (mod(i,2))
+                       if (i % 2)
                                drawfill(pos - '0 1 0' - hud_fontsize_x / 2 * '1 0 0', column_dim, '0 0 0', scoreboard_alpha_bg * 0.2, DRAWFLAG_NORMAL);
                }
                drawstring(pos, hud_title[i], hud_fontsize, rgb * 1.5, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
@@ -893,7 +894,7 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz
 
                        if (scoreboard_highlight)
                        {
-                               if (!mod(i,2))
+                               if (!(i % 2))
                                {
                                        if (i == hud_num_fields-1)
                                                column_dim_x = hud_size[i] + hud_fontsize_x / 2 + 1;
@@ -966,7 +967,7 @@ float HUD_WouldDrawScoreboard() {
 float average_accuracy;
 vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
 {
-       float i;
+       int i;
        float weapon_cnt = WEP_COUNT - 3; // either vaporizer/vortex are hidden, no port-o-launch, no tuba
        float rows;
        if(autocvar_scoreboard_accuracy_doublerows)
@@ -994,7 +995,7 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
        // column highlighting
        for(i = 0; i < weapon_cnt/rows; ++i)
        {
-               if(!mod(i, 2))
+               if(!(i % 2))
                        drawfill(pos + '1 0 0' * weapon_width * rows * i, '0 1 0' * height * rows + '1 0 0' * weapon_width * rows, '0 0 0', scoreboard_alpha_bg * 0.2, DRAWFLAG_NORMAL);
        }
 
@@ -1144,7 +1145,7 @@ vector HUD_DrawMapStats(vector pos, vector rgb, vector bg_size) {
 
 vector HUD_DrawScoreboardRankings(vector pos, entity pl,  vector rgb, vector bg_size)
 {
-       float i;
+       int i;
        RANKINGS_RECEIVED_CNT = 0;
        for (i=RANKINGS_CNT-1; i>=0; --i)
                if (grecordtime[i])
@@ -1185,7 +1186,7 @@ vector HUD_DrawScoreboardRankings(vector pos, entity pl,  vector rgb, vector bg_
                p = count_ordinal(i+1);
                if(grecordholder[i] == GetPlayerName(player_localnum))
                        drawfill(pos, '1 0 0' * sbwidth + '0 1.25 0' * hud_fontsize_y, hl_rgb, scoreboard_highlight_alpha_self, DRAWFLAG_NORMAL);
-               else if(!mod(i, 2) && scoreboard_highlight)
+               else if(!(i % 2) && scoreboard_highlight)
                        drawfill(pos, '1 0 0' * sbwidth + '0 1.25 0' * hud_fontsize_y, hl_rgb, scoreboard_highlight_alpha, DRAWFLAG_NORMAL);
                drawstring(pos, p, '1 1 0' * hud_fontsize_y, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
                drawstring(pos + '3 0 0' * hud_fontsize_y, TIME_ENCODED_TOSTRING(t), '1 1 0' * hud_fontsize_y, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);