]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Mario/ons_updates
authorMario <zacjardine@y7mail.com>
Sat, 14 Feb 2015 13:14:04 +0000 (00:14 +1100)
committerMario <zacjardine@y7mail.com>
Sat, 14 Feb 2015 13:14:04 +0000 (00:14 +1100)
1  2 
defaultXonotic.cfg
qcsrc/client/hud.qc
qcsrc/common/mapinfo.qh

diff --combined defaultXonotic.cfg
index a765d46488182ca634efd1fc89ea395b90df696b,f66dc0128bdb87059cb2a4433fb81f8f7365c75a..0312c3abfbc6980b45fe6a55c308b9759d29cebc
@@@ -234,12 -234,10 +234,12 @@@ seta cl_hitsound_nom_damage 25 "damage 
  seta cl_eventchase_death 1 "camera goes into 3rd person mode when the player is dead; set to 2 to active the effect only when the corpse doesn't move anymore"
  seta cl_eventchase_nexball 1 "camera goes into 3rd person mode when in nexball game-mode"
  seta cl_eventchase_distance 140 "final camera distance"
 +seta cl_eventchase_distance 400 "final camera distance while viewing generator explosion"
  seta cl_eventchase_speed 1.3 "how fast the camera slides back, 0 is instant"
  seta cl_eventchase_maxs "12 12 8" "max size of eventchase camera bbox"
  seta cl_eventchase_mins "-12 -12 -8" "min size of eventchase camera bbox"
  seta cl_eventchase_viewoffset "0 0 20" "viewoffset of eventchase camera"
 +seta cl_eventchase_generator_viewoffset "0 0 80" "viewoffset of eventchase camera while viewing generator explosion"
  
  //nifreks lockonrestart feature, used in team-based game modes, if set to 1 and all players readied up no other player can then join the game anymore, useful to block spectators from joining
  set teamplay_lockonrestart 0 "it set to 1 in a team-based game, the teams are locked once all players readied up and the game restarted (no new players can join after restart unless using the server-command unlockteams)"
@@@ -474,7 -472,7 +474,7 @@@ set g_botclip_collisions 1 "0 = disabl
  set g_grappling_hook 0 "let players spawn with the grappling hook which allows them to pull themselves up"
  
  set g_spawn_alloweffects 1 "allow clients to enable spawn point and event effects such as particles and sounds, see cl_spawn_ cvars for more info"
- set g_spawn_furthest 0.5 "this amount of the spawns shall be far away from any players"
+ set g_spawn_furthest 1.0 "this amount of the spawns shall be far away from any players"
  set g_spawn_useallspawns 0 "use all spawns, e.g. also team spawns in non-teamplay, and all spawns, even enemy spawns, in teamplay"
  // respawn delay
  set g_respawn_delay_small 2 "small game number of seconds you have to wait before you can respawn again"
diff --combined qcsrc/client/hud.qc
index ff8cb727e30577136003ec228aa35bf616394e0b,105cce5f2ea850f6cc95fbc25283b304e726f325..e72ad16d178d925211c69e1185b7a20e0811d3e7
@@@ -1,4 -1,3 +1,4 @@@
 +#include "mapvoting.qh"
  #include "scoreboard.qh"
  #include "teamradar.qh"
  #include "../common/buffs.qh"
@@@ -531,35 -530,57 +531,57 @@@ void HUD_Weapons(void
                }
  
                vector old_panel_size = panel_size;
-               if(panel_bg_padding)
-                       old_panel_size -= '2 2 0' * panel_bg_padding;
-               // NOTE: the goal is to use the all-weapons layout and remove unneeded cells
-               // this way weapon icons always have the same size regardless of owned weapon count
+               vector padded_panel_size = panel_size - '2 2 0' * panel_bg_padding;
  
                // get the all-weapons layout
-               rows = HUD_GetRowCount(WEP_COUNT, old_panel_size, aspect);
-               columns = ceil(WEP_COUNT/rows);
-               weapon_size.x = old_panel_size.x / columns;
-               weapon_size.y = old_panel_size.y / rows;
+               rows = HUD_GetRowCount(WEP_COUNT, padded_panel_size, aspect);
+               columns = ceil(WEP_COUNT / rows);
+               weapon_size.x = padded_panel_size.x / columns;
+               weapon_size.y = padded_panel_size.y / rows;
  
                // reduce rows and columns as needed
-               columns = ceil(weapon_count / rows);
-               rows = ceil(weapon_count / columns);
-               // NOTE: although weapons should aways look the same even if onlyowned is disabled,
+               // NOTE: although weapons should aways look the same even if onlyowned is enabled,
                // we enlarge them a bit when possible to better match the desired aspect ratio
-               // as they look much better
-               weapon_size.x = min(old_panel_size.x / columns, aspect * weapon_size.y);
-               weapon_size.y = min(old_panel_size.y / rows, weapon_size.x / aspect);
+               if(padded_panel_size.y > padded_panel_size.x)
+               {
+                       columns = ceil(weapon_count / rows);
+                       rows = ceil(weapon_count / columns);
+                       weapon_size.y = min(padded_panel_size.y / rows, weapon_size.x / aspect);
+                       weapon_size.x = min(padded_panel_size.x / columns, aspect * weapon_size.y);
+               }
+               else
+               {
+                       rows = ceil(weapon_count / columns);
+                       columns = ceil(weapon_count / rows);
+                       weapon_size.x = min(padded_panel_size.x / columns, aspect * weapon_size.y);
+                       weapon_size.y = min(padded_panel_size.y / rows, weapon_size.x / aspect);
+               }
  
                // reduce size of the panel
                panel_size.x = columns * weapon_size.x;
                panel_size.y = rows * weapon_size.y;
-               panel_pos.x += (old_panel_size.x - panel_size.x) / 2;
-               panel_pos.y += (old_panel_size.y - panel_size.y) / 2;
-               if(panel_bg_padding)
-                       panel_size += '2 2 0' * panel_bg_padding;
+               panel_size += '2 2 0' * panel_bg_padding;
+               // center the resized panel, or snap it to the screen edge when close enough
+               if(panel_pos.x > vid_conwidth * 0.001)
+               {
+                       if(panel_pos.x + old_panel_size.x > vid_conwidth * 0.999)
+                               panel_pos.x += old_panel_size.x - panel_size.x;
+                       else
+                               panel_pos.x += (old_panel_size.x - panel_size.x) / 2;
+               }
+               else if(old_panel_size.x > vid_conwidth * 0.999)
+                       panel_pos.x += (old_panel_size.x - panel_size.x) / 2;
+               if(panel_pos.y > vid_conheight * 0.001)
+               {
+                       if(panel_pos.y + old_panel_size.y > vid_conheight * 0.999)
+                               panel_pos.y += old_panel_size.y - panel_size.y;
+                       else
+                               panel_pos.y += (old_panel_size.y - panel_size.y) / 2;
+               }
+               else if(old_panel_size.y > vid_conheight * 0.999)
+                       panel_pos.y += (old_panel_size.y - panel_size.y) / 2;
        }
        else
                weapon_count = WEP_COUNT;
@@@ -1876,167 -1897,6 +1898,167 @@@ void HUD_Timer(void
  
  // Radar (#6)
  //
 +
 +float HUD_Radar_Clickable()
 +{
 +      return hud_panel_radar_mouse && !hud_panel_radar_temp_hidden;
 +}
 +
 +void HUD_Radar_Show_Maximized(float show,float clickable)
 +{
 +      hud_panel_radar_maximized = show;
 +      hud_panel_radar_temp_hidden = 0;
 +      
 +      if ( show )
 +      {
 +              if (clickable)
 +              {
 +                      if(autocvar_hud_cursormode)
 +                              setcursormode(1);
 +                      hud_panel_radar_mouse = 1; 
 +              }
 +      }
 +      else if ( hud_panel_radar_mouse )
 +      {
 +              hud_panel_radar_mouse = 0;
 +              mouseClicked = 0;
 +              if(autocvar_hud_cursormode)
 +              if(!mv_active)
 +                      setcursormode(0);
 +      }
 +}
 +void HUD_Radar_Hide_Maximized()
 +{
 +      HUD_Radar_Show_Maximized(false,false);
 +}
 +
 +
 +float HUD_Radar_InputEvent(float bInputType, float nPrimary, float nSecondary)
 +{
 +      if(!hud_panel_radar_maximized || !hud_panel_radar_mouse || 
 +              autocvar__hud_configure || mv_active)
 +              return false;
 +
 +      if(bInputType == 3)
 +      {
 +              mousepos_x = nPrimary;
 +              mousepos_y = nSecondary;
 +              return true;
 +      }
 +
 +      if(nPrimary == K_MOUSE1)
 +      {
 +              if(bInputType == 0) // key pressed
 +                      mouseClicked |= S_MOUSE1;
 +              else if(bInputType == 1) // key released
 +                      mouseClicked -= (mouseClicked & S_MOUSE1);
 +      }
 +      else if(nPrimary == K_MOUSE2)
 +      {
 +              if(bInputType == 0) // key pressed
 +                      mouseClicked |= S_MOUSE2;
 +              else if(bInputType == 1) // key released
 +                      mouseClicked -= (mouseClicked & S_MOUSE2);
 +      }
 +      else if ( nPrimary == K_ESCAPE && bInputType == 0 )
 +      {
 +              HUD_Radar_Hide_Maximized();
 +      }
 +      else
 +      {
 +              // allow console/use binds to work without hiding the map
 +              string con_keys;
 +              float keys;
 +              float i;
 +              con_keys = strcat(findkeysforcommand("toggleconsole", 0)," ",findkeysforcommand("+use", 0)) ;
 +              keys = tokenize(con_keys); // findkeysforcommand returns data for this
 +              for (i = 0; i < keys; ++i)
 +              {
 +                      if(nPrimary == stof(argv(i)))
 +                              return false;
 +              }
 +              
 +              if ( getstati(STAT_HEALTH) <= 0 )
 +              {
 +                      // Show scoreboard
 +                      if ( bInputType < 2 )
 +                      {
 +                              con_keys = findkeysforcommand("+showscores", 0);
 +                              keys = tokenize(con_keys);
 +                              for (i = 0; i < keys; ++i)
 +                              {
 +                                      if ( nPrimary == stof(argv(i)) )
 +                                      {
 +                                              hud_panel_radar_temp_hidden = bInputType == 0;
 +                                              return false;
 +                                      }
 +                              }
 +                      }
 +              }
 +              else if ( bInputType == 0 )
 +                      HUD_Radar_Hide_Maximized();
 +              
 +              return false;
 +      }
 +
 +      return true;
 +}
 +
 +void HUD_Radar_Mouse()
 +{
 +      if ( !hud_panel_radar_mouse ) return;
 +      if(mv_active) return;
 +      
 +      if ( intermission )
 +      {
 +              HUD_Radar_Hide_Maximized();
 +              return;
 +      }
 +      
 +      if(mouseClicked & S_MOUSE2)
 +      {
 +              HUD_Radar_Hide_Maximized();
 +              return;
 +      }
 +      
 +      if(!autocvar_hud_cursormode)
 +      {
 +              mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
 +
 +              mousepos_x = bound(0, mousepos_x, vid_conwidth);
 +              mousepos_y = bound(0, mousepos_y, vid_conheight);
 +      }
 +
 +      HUD_Panel_UpdateCvars();
 +      
 +      
 +      panel_size = autocvar_hud_panel_radar_maximized_size;
 +      panel_size_x = bound(0.2, panel_size_x, 1) * vid_conwidth;
 +      panel_size_y = bound(0.2, panel_size_y, 1) * vid_conheight;
 +      panel_pos_x = (vid_conwidth - panel_size_x) / 2;
 +      panel_pos_y = (vid_conheight - panel_size_y) / 2;
 +              
 +      if(mouseClicked & S_MOUSE1)
 +      {
 +              // click outside
 +              if ( mousepos_x < panel_pos_x || mousepos_x > panel_pos_x + panel_size_x ||
 +                       mousepos_y < panel_pos_y || mousepos_y > panel_pos_y + panel_size_y )
 +              {
 +                      HUD_Radar_Hide_Maximized();
 +                      return;
 +              }
 +              vector pos = teamradar_texcoord_to_3dcoord(teamradar_2dcoord_to_texcoord(mousepos),view_origin_z);
 +              localcmd(sprintf("cmd ons_spawn %f %f %f",pos_x,pos_y,pos_z));
 +              
 +              HUD_Radar_Hide_Maximized();
 +              return;
 +      }
 +      
 +
 +      const vector cursor_size = '32 32 0';
 +      drawpic(mousepos-'8 4 0', strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursor_size, '1 1 1', 0.8, DRAWFLAG_NORMAL);
 +}
 +
  void HUD_Radar(void)
  {
        if (!autocvar__hud_configure)
                        }
                }
        }
 +      
 +      if ( hud_panel_radar_temp_hidden )
 +              return;
  
        HUD_Panel_UpdateCvars();
  
  
        for(tm = world; (tm = find(tm, classname, "radarlink")); )
                draw_teamradar_link(tm.origin, tm.velocity, tm.team);
 +      
 +      vector coord;
 +      vector brightcolor;
        for(tm = world; (tm = findflags(tm, teamradar_icon, 0xFFFFFF)); )
 +      {
 +              if ( hud_panel_radar_mouse )
 +              if ( tm.health > 0 )
 +              if ( tm.team == myteam+1 )
 +              {
 +                      coord = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(tm.origin));
 +                      if ( vlen(mousepos-coord) < 8 )
 +                      {
 +                              brightcolor_x = min(1,tm.teamradar_color_x*1.5);
 +                              brightcolor_y = min(1,tm.teamradar_color_y*1.5);
 +                              brightcolor_z = min(1,tm.teamradar_color_z*1.5);
 +                              drawpic(coord - '8 8 0', "gfx/teamradar_icon_glow", '16 16 0', brightcolor, panel_fg_alpha, 0);
 +                      }
 +              }
 +              
                draw_teamradar_icon(tm.origin, tm.teamradar_icon, tm, tm.teamradar_color, panel_fg_alpha);
 +      }
        for(tm = world; (tm = find(tm, classname, "entcs_receiver")); )
        {
                color2 = GetPlayerColor(tm.sv_entnum);
        draw_teamradar_player(view_origin, view_angles, '1 1 1');
  
        drawresetcliparea();
 +      
 +      if ( hud_panel_radar_mouse )
 +      {                       
 +              string message = "Click to select teleport destination";
 +              
 +              if ( getstati(STAT_HEALTH) <= 0 )
 +              {
 +                      message = "Click to select spawn location";
 +              }
 +              
 +              drawcolorcodedstring(pos + '0.5 0 0' * (mySize_x - stringwidth(message, true, hud_fontsize)) - '0 1 0' * hud_fontsize_y * 2,
 +                                                       message, hud_fontsize, hud_panel_radar_foreground_alpha, DRAWFLAG_NORMAL);
 +              
 +              hud_panel_radar_bottom = pos_y + mySize_y + hud_fontsize_y;
 +      }
  }
  
  // Score (#7)
@@@ -4410,16 -4233,8 +4432,16 @@@ void HUD_CenterPrint (void
                hud_fade_alpha = 1 - autocvar__menu_alpha;
        }
        HUD_Panel_UpdateCvars();
 -
 -      if(scoreboard_fade_alpha)
 +      
 +      if ( HUD_Radar_Clickable() )
 +      {
 +              if (hud_panel_radar_bottom >= 0.96 * vid_conheight)
 +                      return;
 +              
 +              panel_pos = eY * hud_panel_radar_bottom + eX * 0.5 * (vid_conwidth - panel_size_x);
 +              panel_size_y = min(panel_size_y, vid_conheight - hud_panel_radar_bottom);
 +      }
 +      else if(scoreboard_fade_alpha)
        {
                hud_fade_alpha = hud_fade_alpha_save;
  
diff --combined qcsrc/common/mapinfo.qh
index 88f03c998b1febfd60454fb3e5ae57908c37a06c,54255ec8d2aa153abfb6da7242d08b3635c40423..eae3fb4324a8dc12a7bf5e58ef1222cbf1ed240b
@@@ -70,7 -70,7 +70,7 @@@ REGISTER_GAMETYPE(_("Key Hunt"),kh,g_ke
  REGISTER_GAMETYPE(_("Assault"),as,g_assault,ASSAULT,true,"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,true,"timelimit=20",_("Capture control points to reach and destroy the enemy generator"));
 +REGISTER_GAMETYPE(_("Onslaught"),ons,g_onslaught,ONSLAUGHT,true,"pointlimit=1 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,true,"timelimit=20 pointlimit=5 leadlimit=0",_("XonSports"));
@@@ -152,7 -152,7 +152,7 @@@ float MapInfo_Type_FromString(string t)
  string MapInfo_Type_Description(float t);
  string MapInfo_Type_ToString(float t);
  string MapInfo_Type_ToText(float t);
- void MapInfo_SwitchGameType(float t);
+ void MapInfo_SwitchGameType(int t);
  
  // to be called from worldspawn to set up cvars
  void MapInfo_LoadMapSettings(string s);