]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/scoreboard.qc
Merge branch 'master' into Mario/monsters
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / scoreboard.qc
index f98d680f04240fa6f4511256c0f1b07e2a13fa10..4ec433870168cf325f739054e4a2b3a9bfe9a484 100644 (file)
@@ -9,7 +9,7 @@ float scoreboard_alpha_name_self;
 void drawstringright(vector, string, vector, vector, float, float);
 void drawstringcenter(vector, string, vector, vector, float, float);
 
-float SCOREBOARD_OFFSET = 50;
+const float SCOREBOARD_OFFSET = 50;
 
 // wrapper to put all possible scores titles through gettext
 string TranslateScoresLabel(string l)
@@ -447,7 +447,7 @@ void Cmd_HUD_SetFields(float argc)
                        hud_title[0] = strzone(TranslateScoresLabel("name"));
                        hud_field[0] = SP_NAME;
                        ++hud_num_fields;
-                       print(sprintf(_("fixed missing field '%s'\n"), "name"));
+                       print("fixed missing field 'name'\n");
 
                        if(!have_separator)
                        {
@@ -462,7 +462,7 @@ void Cmd_HUD_SetFields(float argc)
                                hud_field[1] = SP_SEPARATOR;
                                hud_size[1] = stringwidth("|", FALSE, hud_fontsize);
                                ++hud_num_fields;
-                               print(sprintf(_("fixed missing field '%s'\n"), "|"));
+                               print("fixed missing field '|'\n");
                        }
                }
                else if(!have_separator)
@@ -472,7 +472,7 @@ void Cmd_HUD_SetFields(float argc)
                        hud_size[hud_num_fields] = stringwidth("|", FALSE, hud_fontsize);
                        hud_field[hud_num_fields] = SP_SEPARATOR;
                        ++hud_num_fields;
-                       print(sprintf(_("fixed missing field '%s'\n"), "|"));
+                       print("fixed missing field '|'\n");
                }
                if(!have_secondary)
                {
@@ -481,7 +481,7 @@ void Cmd_HUD_SetFields(float argc)
                        hud_size[hud_num_fields] = stringwidth(hud_title[hud_num_fields], FALSE, hud_fontsize);
                        hud_field[hud_num_fields] = ps_secondary;
                        ++hud_num_fields;
-                       print(sprintf(_("fixed missing field '%s'\n"), scores_label[ps_secondary]));
+                       print(sprintf("fixed missing field '%s'\n", scores_label[ps_secondary]));
                }
                if(!have_primary)
                {
@@ -490,7 +490,7 @@ void Cmd_HUD_SetFields(float argc)
                        hud_size[hud_num_fields] = stringwidth(hud_title[hud_num_fields], FALSE, hud_fontsize);
                        hud_field[hud_num_fields] = ps_primary;
                        ++hud_num_fields;
-                       print(sprintf(_("fixed missing field '%s'\n"), scores_label[ps_primary]));
+                       print(sprintf("fixed missing field '%s'\n", scores_label[ps_primary]));
                }
        }
 
@@ -965,7 +965,6 @@ float HUD_WouldDrawScoreboard() {
        return 0;
 }
 
-float g_minstagib;
 float average_accuracy;
 vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
 {
@@ -980,6 +979,7 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
        float fontsize = height * 1/3;
        float weapon_height = height * 2/3;
        float weapon_width = sbwidth / weapon_cnt;
+       float g_minstagib = 0;
 
        drawstring(pos, sprintf(_("Accuracy stats (average %d%%)"), average_accuracy), hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
        pos_y += 1.25 * hud_fontsize_y + autocvar_scoreboard_border_thickness;
@@ -1087,15 +1087,23 @@ vector HUD_DrawKeyValue(vector pos, string key, string value) {
 
 vector HUD_DrawMapStats(vector pos, vector rgb, vector bg_size) {
        float stat_secrets_found, stat_secrets_total;
-       float rows;
+       float stat_monsters_killed, stat_monsters_total;
+       float rows = 0;
        string val;
+       
+       // get monster stats
+       stat_monsters_killed = getstatf(STAT_MONSTERS_KILLED);
+       stat_monsters_total = getstatf(STAT_MONSTERS_TOTAL);
 
        // get secrets stats
        stat_secrets_found = getstatf(STAT_SECRETS_FOUND);
        stat_secrets_total = getstatf(STAT_SECRETS_TOTAL);
 
        // get number of rows
-       rows = (stat_secrets_total ? 1 : 0);
+       if(stat_secrets_total)
+               rows += 1;
+       if(stat_monsters_total)
+               rows += 1;
 
        // if no rows, return
        if not(rows)
@@ -1115,10 +1123,20 @@ vector HUD_DrawMapStats(vector pos, vector rgb, vector bg_size) {
        else
                drawpic_tiled(pos, "gfx/scoreboard/scoreboard_bg", bg_size, tmp, rgb, scoreboard_alpha_bg, DRAWFLAG_NORMAL);
        drawborderlines(autocvar_scoreboard_border_thickness, pos, tmp, '0 0 0', scoreboard_alpha_bg * 0.75, DRAWFLAG_NORMAL);
+       
+       // draw monsters
+       if(stat_monsters_total)
+       {
+               val = sprintf("%d/%d", stat_monsters_killed, stat_monsters_total);
+               pos = HUD_DrawKeyValue(pos, _("Monsters killed:"), val);
+       }
 
        // draw secrets
-       val = sprintf("%d/%d", stat_secrets_found, stat_secrets_total);
-       pos = HUD_DrawKeyValue(pos, _("Secrets found:"), val);
+       if(stat_secrets_total)
+       {
+               val = sprintf("%d/%d", stat_secrets_found, stat_secrets_total);
+               pos = HUD_DrawKeyValue(pos, _("Secrets found:"), val);
+       }
        
        // update position
        pos_y += 1.25 * hud_fontsize_y;