]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sbar.c
patch from VorteX which removes special menu behavior for
[xonotic/darkplaces.git] / sbar.c
diff --git a/sbar.c b/sbar.c
index 4ceda890bfac528e79c5cd08d1a595f773bef4de..5f53fb5d1b96e5827e95ca27c3c6a40916a8ff22 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -96,6 +96,7 @@ cvar_t sbar_alpha_bg = {CVAR_SAVE, "sbar_alpha_bg", "0.4", "opacity value of the
 cvar_t sbar_alpha_fg = {CVAR_SAVE, "sbar_alpha_fg", "1", "opacity value of the statusbar weapon/item icons and numbers"};
 cvar_t sbar_hudselector = {CVAR_SAVE, "sbar_hudselector", "0", "selects which of the builtin hud layouts to use (meaning is somewhat dependent on gamemode, so nexuiz has a very different set of hud layouts than quake for example)"};
 cvar_t sbar_miniscoreboard_size = {CVAR_SAVE, "sbar_miniscoreboard_size", "-1", "sets the size of the mini deathmatch overlay in items, or disables it when set to 0, or sets it to a sane default when set to -1"};
+cvar_t sbar_flagstatus_right = {CVAR_SAVE, "sbar_flagstatus_right", "0", "moves Nexuiz flag status icons to the right"};
 
 cvar_t cl_deathscoreboard = {0, "cl_deathscoreboard", "1", "shows scoreboard (+showscores) while dead"};
 
@@ -145,7 +146,7 @@ void sbar_start(void)
 {
        int i;
 
-       if (gamemode == GAME_NETHERWORLD)
+       if (gamemode == GAME_DELUXEQUAKE)
        {
        }
        else if (gamemode == GAME_SOM)
@@ -384,6 +385,9 @@ void Sbar_Init (void)
        Cvar_RegisterVariable(&crosshair_color_alpha);
        Cvar_RegisterVariable(&crosshair_size);
 
+       if(gamemode == GAME_NEXUIZ)
+               Cvar_RegisterVariable(&sbar_flagstatus_right); // this cvar makes no sense in other games
+
        R_RegisterModule("sbar", sbar_start, sbar_shutdown, sbar_newmap);
 }
 
@@ -939,9 +943,9 @@ void Sbar_DrawFrags (void)
                s = &cl.scores[k];
 
                // draw background
-               c = (unsigned char *)&palette_pantsscoreboard[(s->colors & 0xf0) >> 4];
+               c = palette_rgb_pantsscoreboard[(s->colors & 0xf0) >> 4];
                DrawQ_Fill (sbar_x + x + 10, sbar_y     - 23, 28, 4, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f) * sbar_alpha_fg.value, 0);
-               c = (unsigned char *)&palette_shirtscoreboard[s->colors & 0xf];
+               c = palette_rgb_shirtscoreboard[s->colors & 0xf];
                DrawQ_Fill (sbar_x + x + 10, sbar_y + 4 - 23, 28, 3, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f) * sbar_alpha_fg.value, 0);
 
                // draw number
@@ -983,9 +987,9 @@ void Sbar_DrawFace (void)
                s = &cl.scores[cl.viewentity - 1];
                // draw background
                Sbar_DrawPic (112, 0, rsb_teambord);
-               c = (unsigned char *)&palette_pantsscoreboard[(s->colors & 0xf0) >> 4];
+               c = palette_rgb_pantsscoreboard[(s->colors & 0xf0) >> 4];
                DrawQ_Fill (sbar_x + 113, vid_conheight.integer-SBAR_HEIGHT+3, 22, 9, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f) * sbar_alpha_fg.value, 0);
-               c = (unsigned char *)&palette_shirtscoreboard[s->colors & 0xf];
+               c = palette_rgb_shirtscoreboard[s->colors & 0xf];
                DrawQ_Fill (sbar_x + 113, vid_conheight.integer-SBAR_HEIGHT+12, 22, 9, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f) * sbar_alpha_fg.value, 0);
 
                // draw number
@@ -1147,7 +1151,7 @@ void Sbar_Draw (void)
                }
                else if (cl.intermission == 2)
                        Sbar_FinaleOverlay();
-               else if (gamemode == GAME_NETHERWORLD)
+               else if (gamemode == GAME_DELUXEQUAKE)
                {
                }
                else if (gamemode == GAME_SOM)
@@ -1204,6 +1208,7 @@ void Sbar_Draw (void)
                                int i;
                                float fade;
                                int redflag, blueflag;
+                               float x;
 
                                sbar_x = (vid_conwidth.integer - 320)/2;
                                sbar_y = vid_conheight.integer - 24 - 16;
@@ -1220,18 +1225,19 @@ void Sbar_Draw (void)
                                // 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 (10 - sbar_x, -179, sb_items[14]);
+                                       Sbar_DrawPic (x, -179, sb_items[14]);
                                }
                                else
                                {
                                        if (redflag)
-                                               Sbar_DrawPic (10 - sbar_x, -117, sb_items[redflag+10]);
+                                               Sbar_DrawPic (x, -117, sb_items[redflag+10]);
                                        if (blueflag)
-                                               Sbar_DrawPic (10 - sbar_x, -177, sb_items[blueflag+14]);
+                                               Sbar_DrawPic (x, -177, sb_items[blueflag+14]);
                                }
 
                                // armor
@@ -1295,6 +1301,7 @@ void Sbar_Draw (void)
                                int i;
                                float fade;
                                int redflag, blueflag;
+                               float x;
 
                                sbar_x = (vid_conwidth.integer - 640)/2;
                                sbar_y = vid_conheight.integer - 47;
@@ -1323,18 +1330,19 @@ void Sbar_Draw (void)
                                // 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 (10 - sbar_x, -179, sb_items[14]);
+                                       Sbar_DrawPic (x, -179, sb_items[14]);
                                }
                                else
                                {
                                        if (redflag)
-                                               Sbar_DrawPic (10 - sbar_x, -117, sb_items[redflag+10]);
+                                               Sbar_DrawPic (x, -117, sb_items[redflag+10]);
                                        if (blueflag)
-                                               Sbar_DrawPic (10 - sbar_x, -177, sb_items[blueflag+14]);
+                                               Sbar_DrawPic (x, -177, sb_items[blueflag+14]);
                                }
 
                                // armor
@@ -1616,9 +1624,9 @@ float Sbar_PrintScoreboardItem(scoreboard_t *s, float x, float y)
                        //
                        //
                        //
-                       c = (unsigned char *)&palette_pantsscoreboard[(s->colors & 0xf0) >> 4];
+                       c = palette_rgb_pantsscoreboard[(s->colors & 0xf0) >> 4];
                        DrawQ_Fill(x + 14*8, y+1, 40, 3, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f) * sbar_alpha_fg.value, 0);
-                       c = (unsigned char *)&palette_shirtscoreboard[s->colors & 0xf];
+                       c = palette_rgb_shirtscoreboard[s->colors & 0xf];
                        DrawQ_Fill(x + 14*8, y+4, 40, 3, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f) * sbar_alpha_fg.value, 0);
                        // print the text
                        //DrawQ_String(x, y, va("%c%4i %s", myself ? 13 : ' ', (int) s->frags, s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL, true);
@@ -1640,9 +1648,9 @@ float Sbar_PrintScoreboardItem(scoreboard_t *s, float x, float y)
                else
                {
                        // draw colors behind score
-                       c = (unsigned char *)&palette_pantsscoreboard[(s->colors & 0xf0) >> 4];
+                       c = palette_rgb_pantsscoreboard[(s->colors & 0xf0) >> 4];
                        DrawQ_Fill(x + 9*8, y+1, 40, 3, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f) * sbar_alpha_fg.value, 0);
-                       c = (unsigned char *)&palette_shirtscoreboard[s->colors & 0xf];
+                       c = palette_rgb_shirtscoreboard[s->colors & 0xf];
                        DrawQ_Fill(x + 9*8, y+4, 40, 3, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f) * sbar_alpha_fg.value, 0);
                        // print the text
                        //DrawQ_String(x, y, va("%c%4i %s", myself ? 13 : ' ', (int) s->frags, s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL, true);
@@ -1873,7 +1881,7 @@ void Sbar_Score (int margin)
                        for(i = 0; i < teamlines; ++i)
                        {
                                int cindex = teamcolorsort[i]->colors & 15;
-                               unsigned char *c = (unsigned char *)&palette_shirtscoreboard[cindex];
+                               unsigned char *c = palette_rgb_shirtscoreboard[cindex];
                                float cm = max(max(c[0], c[1]), c[2]);
                                float cr = c[0] / cm;
                                float cg = c[1] / cm;