Apply a patch by Melanosuchus, fixing issues noted in http://dev.xonotic.org/issues...
authorMario <mario.mario@y7mail.com>
Wed, 11 Jun 2014 09:59:40 +0000 (19:59 +1000)
committerMario <mario.mario@y7mail.com>
Wed, 11 Jun 2014 09:59:40 +0000 (19:59 +1000)
1  2 
defaultXonotic.cfg
gamemodes.cfg
qcsrc/client/mapvoting.qc
qcsrc/common/mapinfo.qc
qcsrc/common/mapinfo.qh
qcsrc/server/autocvars.qh
qcsrc/server/g_world.qc

Simple merge
diff --cc gamemodes.cfg
Simple merge
@@@ -18,12 -17,6 +18,14 @@@ float mv_top2_alpha
  
  vector mv_mousepos;
  float mv_selection;
 +float mv_columns;
++float mv_mouse_selection;
++float mv_selection_keyboard;
 +
 +float gametypevote;
 +string mapvote_choosenmap;
 +vector gtv_text_size;
 +vector gtv_text_size_small;
  
  string MapVote_FormatMapItem(float id, string map, float count, float maxwidth, vector fontsize)
  {
@@@ -241,10 -135,10 +243,10 @@@ vector MapVote_GridVec(vector gridspec
  
  float MapVote_Selection(vector topleft, vector cellsize, float rows, float columns)
  {
--      float cell;
++
        float c, r;
  
--      cell = -1;
++      mv_mouse_selection = -1;
  
        for (r = 0; r < rows; ++r)
                for (c = 0; c < columns; ++c)
                                mv_mousepos_y >= topleft_y + cellsize_y *  r &&
                                mv_mousepos_y <= topleft_y + cellsize_y * (r + 1))
                        {
--                              cell = r * columns + c;
++                              mv_mouse_selection = r * columns + c;
                                break;
                        }
                }
  
--      if (cell >= mv_num_maps)
--              cell = -1;
++      if (mv_mouse_selection >= mv_num_maps)
++              mv_mouse_selection = -1;
  
--      if (mv_abstain && cell < 0)
--              return mv_num_maps;
++      if (mv_abstain && mv_mouse_selection < 0)
++              mv_mouse_selection = mv_num_maps;
  
--      return cell;
++      if ( mv_selection_keyboard )
++              return mv_selection;
++      
++      return mv_mouse_selection;
  }
  
  void MapVote_Draw()
  
        if (!autocvar_hud_cursormode)
        {
--              mv_mousepos = mv_mousepos + getmousepos();
++              vector mpos = mv_mousepos + getmousepos();
++              mpos_x = bound(0, mpos_x, vid_conwidth);
++              mpos_y = bound(0, mpos_y, vid_conheight);
++              
++              if ( mpos_x != mv_mousepos_x || mpos_y != mv_mousepos_y )
++                      mv_selection_keyboard = 0;
++              mv_mousepos = mpos;
  
--              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;
@@@ -499,6 -343,6 +508,7 @@@ void MapVote_Init(
        if(autocvar_hud_cursormode) { setcursormode(1); }
        else { mv_mousepos = '0.5 0 0' * vid_conwidth + '0 0.5 0' * vid_conheight; }
        mv_selection = -1;
++      mv_selection_keyboard = 0;
  
        for(n_ssdirs = 0; ; ++n_ssdirs)
        {
@@@ -665,6 -415,6 +675,7 @@@ float MapVote_InputEvent(float bInputTy
        {
                mv_mousepos_x = nPrimary;
                mv_mousepos_y = nSecondary;
++              mv_selection_keyboard = 0;
                return true;
        }
  
                case K_KP_8: localcmd("\nimpulse 8\n"); return true;
                case K_KP_9: localcmd("\nimpulse 9\n"); return true;
                case K_KP_0: localcmd("\nimpulse 10\n"); return true;
-                       MapVote_SendChoice(MapVote_MoveRight(mv_ownvote));
 +
 +              case K_RIGHTARROW:
-                       MapVote_SendChoice(MapVote_MoveLeft(mv_ownvote));
++                      mv_selection_keyboard = 1;
++                      mv_selection = MapVote_MoveRight(mv_selection);
 +                      return true;
 +              case K_LEFTARROW:
-                       MapVote_SendChoice(MapVote_MoveDown(mv_ownvote));
++                      mv_selection_keyboard = 1;
++                      mv_selection = MapVote_MoveLeft(mv_selection);
 +                      return true;
 +              case K_DOWNARROW:
-                       MapVote_SendChoice(MapVote_MoveUp(mv_ownvote));
++                      mv_selection_keyboard = 1;
++                      mv_selection = MapVote_MoveDown(mv_selection);
 +                      return true;
 +              case K_UPARROW:
++                      mv_selection_keyboard = 1;
++                      mv_selection = MapVote_MoveUp(mv_selection);
++                      return true;
++              case K_KP_ENTER:
++              case K_ENTER:
++              case K_SPACE:
++                      if ( mv_selection_keyboard )
++                              MapVote_SendChoice(mv_selection);
 +                      return true;
        }
  
        if (nPrimary == K_MOUSE1)
++      {
++              mv_selection_keyboard = 0;
++              mv_selection = mv_mouse_selection;
                if (mv_selection >= 0)
                {
                        imp = min(mv_selection + 1, mv_num_maps);
                        localcmd(strcat("\nimpulse ", ftos(imp), "\n"));
                        return true;
                }
++      }
  
        return false;
  }
Simple merge
@@@ -35,49 -33,49 +35,49 @@@ entity MapInfo_Type_last
  #define IS_GAMETYPE(NAME) \
        (MapInfo_LoadedGametype == MAPINFO_TYPE_##NAME)
  
 -REGISTER_GAMETYPE(_("Deathmatch"),dm,g_dm,DEATHMATCH,"timelimit=20 pointlimit=30 leadlimit=0");
 +REGISTER_GAMETYPE(_("Deathmatch"),dm,g_dm,DEATHMATCH,"timelimit=20 pointlimit=30 leadlimit=0",_("Kill all enemies"));
  #define g_dm IS_GAMETYPE(DEATHMATCH)
  
 -REGISTER_GAMETYPE(_("Last Man Standing"),lms,g_lms,LMS,"timelimit=20 lives=9 leadlimit=0");
 +REGISTER_GAMETYPE(_("Last Man Standing"),lms,g_lms,LMS,"timelimit=20 lives=9 leadlimit=0",_("Survive and kill until the enemies have no lives left"));
  #define g_lms IS_GAMETYPE(LMS)
  
 -REGISTER_GAMETYPE(_("Race"),rc,g_race,RACE,"timelimit=20 qualifying_timelimit=5 laplimit=7 teamlaplimit=15 leadlimit=0");
 +REGISTER_GAMETYPE(_("Race"),rc,g_race,RACE,"timelimit=20 qualifying_timelimit=5 laplimit=7 teamlaplimit=15 leadlimit=0",_("Race against other players to the finish line"));
  #define g_race IS_GAMETYPE(RACE)
  
 -REGISTER_GAMETYPE(_("Race CTS"),cts,g_cts,CTS,"timelimit=20 skill=-1");
 +REGISTER_GAMETYPE(_("Race CTS"),cts,g_cts,CTS,"timelimit=20 skill=-1",_("Race for fastest time"));
  #define g_cts IS_GAMETYPE(CTS)
  
 -REGISTER_GAMETYPE(_("Team Deathmatch"),tdm,g_tdm,TEAM_DEATHMATCH,"timelimit=20 pointlimit=50 teams=2 leadlimit=0");
 +REGISTER_GAMETYPE(_("Team Deathmatch"),tdm,g_tdm,TEAM_DEATHMATCH,"timelimit=20 pointlimit=50 teams=2 leadlimit=0",_("Kill all enemy teammates"));
  #define g_tdm IS_GAMETYPE(TEAM_DEATHMATCH)
  
 -REGISTER_GAMETYPE(_("Capture the Flag"),ctf,g_ctf,CTF,"timelimit=20 caplimit=10 leadlimit=0");
 +REGISTER_GAMETYPE(_("Capture the Flag"),ctf,g_ctf,CTF,"timelimit=20 caplimit=10 leadlimit=0",_("Find and bring the enemy flag to your base to capture it"));
  #define g_ctf IS_GAMETYPE(CTF)
  
 -REGISTER_GAMETYPE(_("Clan Arena"),ca,g_ca,CA,"timelimit=20 pointlimit=10 leadlimit=0");
 +REGISTER_GAMETYPE(_("Clan Arena"),ca,g_ca,CA,"timelimit=20 pointlimit=10 leadlimit=0",_("Kill all enemy teammates to win the round"));
  #define g_ca IS_GAMETYPE(CA)
  
 -REGISTER_GAMETYPE(_("Domination"),dom,g_domination,DOMINATION,"timelimit=20 pointlimit=200 teams=2 leadlimit=0");
 +REGISTER_GAMETYPE(_("Domination"),dom,g_domination,DOMINATION,"timelimit=20 pointlimit=200 teams=2 leadlimit=0",_("Capture all the control points to win"));
  #define g_domination IS_GAMETYPE(DOMINATION)
  
 -REGISTER_GAMETYPE(_("Key Hunt"),kh,g_keyhunt,KEYHUNT,"timelimit=20 pointlimit=1000 teams=3 leadlimit=0");
 +REGISTER_GAMETYPE(_("Key Hunt"),kh,g_keyhunt,KEYHUNT,"timelimit=20 pointlimit=1000 teams=3 leadlimit=0",_("Gather all the keys to win the round"));
  #define g_keyhunt IS_GAMETYPE(KEYHUNT)
  
 -REGISTER_GAMETYPE(_("Assault"),as,g_assault,ASSAULT,"timelimit=20");
 +REGISTER_GAMETYPE(_("Assault"),as,g_assault,ASSAULT,"timelimit=20",_("Destroy obstacles to find and destroy the enemy power core before time runs out"));
  #define g_assault IS_GAMETYPE(ASSAULT)
  
 -REGISTER_GAMETYPE(_("Onslaught"),ons,g_onslaught,ONSLAUGHT,"timelimit=20");
 +REGISTER_GAMETYPE(_("Onslaught"),ons,g_onslaught,ONSLAUGHT,"timelimit=20",_("Capture control points to reach and destroy the enemy generator"));
  #define g_onslaught IS_GAMETYPE(ONSLAUGHT)
  
 -REGISTER_GAMETYPE(_("Nexball"),nb,g_nexball,NEXBALL,"timelimit=20 pointlimit=5 leadlimit=0");
 +REGISTER_GAMETYPE(_("Nexball"),nb,g_nexball,NEXBALL,"timelimit=20 pointlimit=5 leadlimit=0",_("XonSports"));
  #define g_nexball IS_GAMETYPE(NEXBALL)
  
 -REGISTER_GAMETYPE(_("Freeze Tag"),ft,g_freezetag,FREEZETAG,"timelimit=20 pointlimit=10 teams=2 leadlimit=0");
 +REGISTER_GAMETYPE(_("Freeze Tag"),ft,g_freezetag,FREEZETAG,"timelimit=20 pointlimit=10 teams=2 leadlimit=0",_("Kill enemies to freeze them, stand next to teammates to revive them"));
  #define g_freezetag IS_GAMETYPE(FREEZETAG)
  
 -REGISTER_GAMETYPE(_("Keepaway"),ka,g_keepaway,KEEPAWAY,"timelimit=20 pointlimit=30");
 +REGISTER_GAMETYPE(_("Keepaway"),ka,g_keepaway,KEEPAWAY,"timelimit=20 pointlimit=30",_("Hold the ball to get points for kills"));
  #define g_keepaway IS_GAMETYPE(KEEPAWAY)
  
- REGISTER_GAMETYPE(_("Invasion"),inv,g_invasion,INVASION,"pointlimit=5",_("Survive against waves of monsters"));
 -REGISTER_GAMETYPE(_("Invasion"),inv,g_invasion,INVASION,"pointlimit=50 teams=0");
++REGISTER_GAMETYPE(_("Invasion"),inv,g_invasion,INVASION,"pointlimit=50 teams=0",_("Survive against waves of monsters"));
  #define g_invasion IS_GAMETYPE(INVASION)
  
  const float MAPINFO_FEATURE_WEAPONS       = 1; // not defined for minstagib-only maps
Simple merge
Simple merge