+ if (sb_showscores || (cl.stats[STAT_HEALTH] <= 0 && cl_deathscoreboard.integer))
+ {
+ sbar_x = (vid_conwidth.integer - 640)/2;
+ sbar_y = vid_conheight.integer - 47;
+ Sbar_DrawAlphaPic (0, 0, sb_scorebar, sbar_alpha_bg.value);
+ Sbar_DrawScoreboard ();
+ }
+ else if (sb_lines && sbar_hudselector.integer == 1)
+ {
+ int i;
+ float fade;
+ int redflag, blueflag;
+ float x;
+
+ sbar_x = (vid_conwidth.integer - 320)/2;
+ sbar_y = vid_conheight.integer - 24 - 16;
+
+ // calculate intensity to draw weapons bar at
+ fade = 3.2 - 2 * (cl.time - cl.weapontime);
+ fade = bound(0.7, fade, 1);
+ for (i = 0; i < 8;i++)
+ if (cl.stats[STAT_ITEMS] & (1 << i))
+ Sbar_DrawWeapon(i + 1, fade, (i + 2 == cl.stats[STAT_ACTIVEWEAPON]));
+ if((cl.stats[STAT_ITEMS] & (1<<12)))
+ Sbar_DrawWeapon(0, fade, (cl.stats[STAT_ACTIVEWEAPON] == 1));
+
+ // flag icons
+ redflag = ((cl.stats[STAT_ITEMS]>>15) & 3);
+ blueflag = ((cl.stats[STAT_ITEMS]>>17) & 3);
+ x = sbar_flagstatus_right.integer ? vid_conwidth.integer - 10 - sbar_x - 64 : 10 - sbar_x;
+ if (redflag == 3 && blueflag == 3)
+ {
+ // The Impossible Combination[tm]
+ // Can only happen in Key Hunt mode...
+ Sbar_DrawPic ((int) x, (int) ((vid_conheight.integer - sbar_y) - (sbar_flagstatus_pos.value + 128)), sb_items[14]);
+ }
+ else
+ {
+ if (redflag)
+ Sbar_DrawPic ((int) x, (int) ((vid_conheight.integer - sbar_y) - (sbar_flagstatus_pos.value + 64)), sb_items[redflag+10]);
+ if (blueflag)
+ Sbar_DrawPic ((int) x, (int) ((vid_conheight.integer - sbar_y) - (sbar_flagstatus_pos.value + 128)), sb_items[blueflag+14]);
+ }
+
+ // armor
+ if (cl.stats[STAT_ARMOR] > 0)
+ {
+ Sbar_DrawStretchPic (72, 0, sb_armor[0], sbar_alpha_fg.value, 24, 24);
+ if(cl.stats[STAT_ARMOR] > 200)
+ Sbar_DrawXNum(0,0,cl.stats[STAT_ARMOR],3,24,0,1,0,1,0);
+ else if(cl.stats[STAT_ARMOR] > 100)
+ Sbar_DrawXNum(0,0,cl.stats[STAT_ARMOR],3,24,0.2,1,0.2,1,0);
+ else if(cl.stats[STAT_ARMOR] > 50)
+ Sbar_DrawXNum(0,0,cl.stats[STAT_ARMOR],3,24,0.6,0.7,0.8,1,0);
+ else if(cl.stats[STAT_ARMOR] > 25)
+ Sbar_DrawXNum(0,0,cl.stats[STAT_ARMOR],3,24,1,1,0.2,1,0);
+ else
+ Sbar_DrawXNum(0,0,cl.stats[STAT_ARMOR],3,24,0.7,0,0,1,0);
+ }
+
+ // health
+ if (cl.stats[STAT_HEALTH] != 0)
+ {
+ Sbar_DrawStretchPic (184, 0, sb_health, sbar_alpha_fg.value, 24, 24);
+ if(cl.stats[STAT_HEALTH] > 200)
+ Sbar_DrawXNum(112,0,cl.stats[STAT_HEALTH],3,24,0,1,0,1,0);
+ else if(cl.stats[STAT_HEALTH] > 100)
+ Sbar_DrawXNum(112,0,cl.stats[STAT_HEALTH],3,24,0.2,1,0.2,1,0);
+ else if(cl.stats[STAT_HEALTH] > 50)
+ Sbar_DrawXNum(112,0,cl.stats[STAT_HEALTH],3,24,0.6,0.7,0.8,1,0);
+ else if(cl.stats[STAT_HEALTH] > 25)
+ Sbar_DrawXNum(112,0,cl.stats[STAT_HEALTH],3,24,1,1,0.2,1,0);
+ else
+ Sbar_DrawXNum(112,0,cl.stats[STAT_HEALTH],3,24,0.7,0,0,1,0);
+ }
+
+ // ammo
+ if ((cl.stats[STAT_ITEMS] & (NEX_IT_SHELLS | NEX_IT_BULLETS | NEX_IT_ROCKETS | NEX_IT_CELLS)) || cl.stats[STAT_AMMO] != 0)
+ {
+ if (cl.stats[STAT_ITEMS] & NEX_IT_SHELLS)
+ Sbar_DrawStretchPic (296, 0, sb_ammo[0], sbar_alpha_fg.value, 24, 24);
+ else if (cl.stats[STAT_ITEMS] & NEX_IT_BULLETS)
+ Sbar_DrawStretchPic (296, 0, sb_ammo[1], sbar_alpha_fg.value, 24, 24);
+ else if (cl.stats[STAT_ITEMS] & NEX_IT_ROCKETS)
+ Sbar_DrawStretchPic (296, 0, sb_ammo[2], sbar_alpha_fg.value, 24, 24);
+ else if (cl.stats[STAT_ITEMS] & NEX_IT_CELLS)
+ Sbar_DrawStretchPic (296, 0, sb_ammo[3], sbar_alpha_fg.value, 24, 24);
+ if(cl.stats[STAT_AMMO] > 10)
+ Sbar_DrawXNum(224, 0, cl.stats[STAT_AMMO], 3, 24, 0.6,0.7,0.8,1,0);
+ else
+ Sbar_DrawXNum(224, 0, cl.stats[STAT_AMMO], 3, 24, 0.7,0,0,1,0);
+ }
+
+ if (sbar_x + 320 + 160 <= vid_conwidth.integer)
+ Sbar_MiniDeathmatchOverlay (sbar_x + 320, sbar_y);
+ if (sbar_x > 0)
+ Sbar_Score(16);
+ // The margin can be at most 8 to support 640x480 console size:
+ // 320 + 2 * (144 + 16) = 640
+ }
+ else if (sb_lines)
+ {
+ int i;
+ float fade;
+ int redflag, blueflag;
+ float x;
+
+ sbar_x = (vid_conwidth.integer - 640)/2;
+ sbar_y = vid_conheight.integer - 47;
+
+ // calculate intensity to draw weapons bar at
+ fade = 3 - 2 * (cl.time - cl.weapontime);
+ if (fade > 0)
+ {
+ fade = min(fade, 1);
+ for (i = 0; i < 8;i++)
+ if (cl.stats[STAT_ITEMS] & (1 << i))
+ Sbar_DrawWeapon(i + 1, fade, (i + 2 == cl.stats[STAT_ACTIVEWEAPON]));
+
+ if((cl.stats[STAT_ITEMS] & (1<<12)))
+ Sbar_DrawWeapon(0, fade, (cl.stats[STAT_ACTIVEWEAPON] == 1));
+ }
+
+ //if (!cl.islocalgame)
+ // Sbar_DrawFrags ();
+
+ if (sb_lines > 24)
+ Sbar_DrawAlphaPic (0, 0, sb_sbar, sbar_alpha_fg.value);
+ else
+ Sbar_DrawAlphaPic (0, 0, sb_sbar_minimal, sbar_alpha_fg.value);
+
+ // flag icons
+ redflag = ((cl.stats[STAT_ITEMS]>>15) & 3);
+ blueflag = ((cl.stats[STAT_ITEMS]>>17) & 3);
+ x = sbar_flagstatus_right.integer ? vid_conwidth.integer - 10 - sbar_x - 64 : 10 - sbar_x;
+ if (redflag == 3 && blueflag == 3)
+ {
+ // The Impossible Combination[tm]
+ // Can only happen in Key Hunt mode...
+ Sbar_DrawPic ((int) x, -179, sb_items[14]);
+ }
+ else
+ {
+ if (redflag)
+ Sbar_DrawPic ((int) x, -117, sb_items[redflag+10]);
+ if (blueflag)
+ Sbar_DrawPic ((int) x, -177, sb_items[blueflag+14]);
+ }
+
+ // armor
+ Sbar_DrawXNum ((340-3*24), 12, cl.stats[STAT_ARMOR], 3, 24, 0.6,0.7,0.8,1,0);
+
+ // health
+ if(cl.stats[STAT_HEALTH] > 100)
+ Sbar_DrawXNum((154-3*24),12,cl.stats[STAT_HEALTH],3,24,1,1,1,1,0);
+ else if(cl.stats[STAT_HEALTH] <= 25 && cl.time - (int)cl.time > 0.5)
+ Sbar_DrawXNum((154-3*24),12,cl.stats[STAT_HEALTH],3,24,0.7,0,0,1,0);
+ else
+ Sbar_DrawXNum((154-3*24),12,cl.stats[STAT_HEALTH],3,24,0.6,0.7,0.8,1,0);
+
+ // AK dont draw ammo for the laser
+ if(cl.stats[STAT_ACTIVEWEAPON] != 12)
+ {
+ if (cl.stats[STAT_ITEMS] & NEX_IT_SHELLS)
+ Sbar_DrawPic (519, 0, sb_ammo[0]);
+ else if (cl.stats[STAT_ITEMS] & NEX_IT_BULLETS)
+ Sbar_DrawPic (519, 0, sb_ammo[1]);
+ else if (cl.stats[STAT_ITEMS] & NEX_IT_ROCKETS)
+ Sbar_DrawPic (519, 0, sb_ammo[2]);
+ else if (cl.stats[STAT_ITEMS] & NEX_IT_CELLS)
+ Sbar_DrawPic (519, 0, sb_ammo[3]);
+
+ if(cl.stats[STAT_AMMO] <= 10)
+ Sbar_DrawXNum ((519-3*24), 12, cl.stats[STAT_AMMO], 3, 24, 0.7, 0,0,1,0);
+ else
+ Sbar_DrawXNum ((519-3*24), 12, cl.stats[STAT_AMMO], 3, 24, 0.6, 0.7,0.8,1,0);
+
+ }
+
+ if (sb_lines > 24)
+ DrawQ_Pic(sbar_x,sbar_y,sb_sbar_overlay,0,0,1,1,1,1,DRAWFLAG_MODULATE);
+
+ if (sbar_x + 600 + 160 <= vid_conwidth.integer)
+ Sbar_MiniDeathmatchOverlay (sbar_x + 600, sbar_y);
+
+ if (sbar_x > 0)
+ Sbar_Score(-16);
+ // Because:
+ // Mini scoreboard uses 12*4 per other team, that is, 144
+ // pixels when there are four teams...
+ // Nexuiz by default sets vid_conwidth to 800... makes
+ // sbar_x == 80...
+ // so we need to shift it by 64 pixels to the right to fit
+ // BUT: then it overlaps with the image that gets drawn
+ // for viewsize 100! Therefore, just account for 3 teams,
+ // that is, 96 pixels mini scoreboard size, needing 16 pixels
+ // to the right!
+ }