]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/mapvoting.qc
Merge branch 'terencehill/csqc_input_stuff' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / mapvoting.qc
index 0b60bfcadecaf8996888a741c541ec2e3487cad3..2a6f39f8a5ff50dcbe63c7fdc628328bcc1eb449 100644 (file)
@@ -760,9 +760,11 @@ int MapVote_MoveUp(int pos)
                imp = pos - mv_columns;
                if ( imp < 0 )
                {
-                       imp = floor(mv_num_maps/mv_columns)*mv_columns + pos % mv_columns;
-                       if ( imp >= mv_num_maps )
-                               imp -= mv_columns;
+                       int mv_rows = ceil(mv_num_maps / mv_columns);
+                       if (imp == -mv_columns) // pos == 0
+                               imp = mv_columns * mv_rows - 1;
+                       else
+                               imp = imp + mv_columns * mv_rows - 1;
                }
        }
        if ( !(mv_flags[imp] & GTV_AVAILABLE) && imp != mv_ownvote )
@@ -779,7 +781,12 @@ int MapVote_MoveDown(int pos)
        {
                imp = pos + mv_columns;
                if ( imp >= mv_num_maps )
-                       imp = imp % mv_columns;
+               {
+                       if ((imp % mv_columns) == mv_columns - 1)
+                               imp = 0;
+                       else
+                               imp = imp % mv_columns + 1;
+               }
        }
        if ( !(mv_flags[imp] & GTV_AVAILABLE) && imp != mv_ownvote )
                imp = MapVote_MoveDown(imp);
@@ -808,7 +815,7 @@ float MapVote_InputEvent(int bInputType, float nPrimary, float nSecondary)
                return false;
        }
 
-       // at this point bInputType can be 0 or 1 (key pressed or released)
+       // at this point bInputType can only be 0 or 1 (key pressed or released)
        bool key_pressed = (bInputType == 0);
 
        if (key_pressed)