]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/mapvoting.qc
Add an option to show spectators watching you
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / mapvoting.qc
index 0961096a4dc53a28abadabc9c2f2ee2bbad894a6..107b25d712ad523caeeb3002f122fa18b1c0c2b4 100644 (file)
@@ -28,6 +28,8 @@ string MapVote_FormatMapItem(float id, string map, float count, float maxwidth,
                        post = _(" (1 vote)");
                else if(count >= 0)
                        post = sprintf(_(" (%d votes)"), count);
+               else
+                       post = "";
        }
        else
                post = "";
@@ -50,7 +52,7 @@ vector MapVote_RGB(float id, float count)
 
 void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, string pic, float count, float id)
 {
-       vector img_size;
+       vector img_size = '0 0 0';
        vector rgb;
        string label;
        float text_size;
@@ -169,11 +171,19 @@ void MapVote_Draw()
        float center;
        float columns, rows;
        float tsize;
-       vector dist;
+       vector dist = '0 0 0';
 
        if(!mv_active)
                return;
 
+       if not(autocvar_hud_cursormode)
+       {
+               mv_mousepos = mv_mousepos + getmousepos();
+               
+               mv_mousepos_x = bound(0, mv_mousepos_x, vid_conwidth);
+               mv_mousepos_y = bound(0, mv_mousepos_y, vid_conheight);
+       }
+
        center = (vid_conwidth - 1)/2;
        xmin = vid_conwidth*0.05; // 5% border must suffice
        xmax = vid_conwidth - xmin;
@@ -250,7 +260,7 @@ void MapVote_Draw()
                MapVote_DrawAbstain(pos, isize, xmax - xmin, tmp, i);
        }
 
-       drawpic(mv_mousepos, strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), '32 32 0', '1 1 1', autocvar_hud_panel_fg_alpha, DRAWFLAG_NORMAL);
+       drawpic(mv_mousepos, strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), '32 32 0', '1 1 1', 1 - autocvar__menu_alpha, DRAWFLAG_NORMAL);
 }
 
 void Cmd_MapVote_MapDownload(float argc)
@@ -330,7 +340,8 @@ void MapVote_Init()
        precache_sound ("misc/invshot.wav");
 
        mv_active = 1;
-       setcursormode(1);
+       if(autocvar_hud_cursormode) { setcursormode(1); }
+       else { mv_mousepos = '0.5 0 0' * vid_conwidth + '0 0.5 0' * vid_conheight; }
        mv_selection = -1;
 
        for(n_ssdirs = 0; ; ++n_ssdirs)
@@ -453,9 +464,9 @@ void MapVote_UpdateMask()
        else
                mv_maps_mask = ReadShort();
 
-       if(oldmask & mv_maps_mask != oldmask)
-               if(oldmask & mv_maps_mask == mv_maps_mask)
-                        sound(world, CH_INFO, "misc_invshot.wav", VOL_BASE, ATTN_NONE);
+       if((oldmask & mv_maps_mask) != oldmask)
+               if((oldmask & mv_maps_mask) == mv_maps_mask)
+                        sound(world, CH_INFO, "misc_invshot.wav", VOL_BASE, ATTEN_NONE);
 
        // remove votes that no longer apply
        for(i = 0, power = 1; i < mv_num_maps; ++i, power *= 2)