]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'bones_was_here/misc2' into 'master'
authorterencehill <piuntn@gmail.com>
Thu, 3 Jun 2021 14:11:10 +0000 (14:11 +0000)
committerterencehill <piuntn@gmail.com>
Thu, 3 Jun 2021 14:11:10 +0000 (14:11 +0000)
Misc low importance stuff

See merge request xonotic/xonotic-data.pk3dir!901

1  2 
qcsrc/client/view.qc
qcsrc/server/client.qc
qcsrc/server/world.qc
xonotic-client.cfg

diff --combined qcsrc/client/view.qc
index 871fab3bde130952261046fff316d14e95c6fa81,110ccdc8678d6a7ff729cf8d938da365a71890c6..7835908cb88ec1e88b0ba8aed8a1bc12c8346c89
@@@ -401,7 -401,7 +401,7 @@@ void fpscounter_update(
  
                int channel = MSG_C2S;
                WriteHeader(channel, fpsreport);
-               WriteShort(channel, bound(0, rint(fps), 65535)); // prevent insane fps values
+               WriteShort(channel, bound(0, rint(fps), 32767)); // prevent insane fps values
        }
  }
  
@@@ -955,17 -955,17 +955,17 @@@ void HUD_Draw(entity this
        if(STAT(NADE_TIMER) && autocvar_cl_nade_timer) // give nade top priority, as it's a matter of life and death
        {
                vector col = '0.25 0.90 1' + vec3(STAT(NADE_TIMER), -STAT(NADE_TIMER), -STAT(NADE_TIMER));
 -              DrawCircleClippedPic(vec2(0.5 * vid_conwidth, 0.6 * vid_conheight), 0.1 * vid_conheight, "gfx/crosshair_ring.tga", STAT(NADE_TIMER), col, autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
 +              DrawCircleClippedPic(vec2(0.5 * vid_conwidth, 0.6 * vid_conheight), 0.1 * vid_conheight, "gfx/crosshair_ring", STAT(NADE_TIMER), col, autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
                drawstring_aspect(eY * 0.64 * vid_conheight, ((autocvar_cl_nade_timer == 2) ? _("Nade timer") : ""), vec2(vid_conwidth, 0.025 * vid_conheight), '1 1 1', 1, DRAWFLAG_NORMAL);
        }
        else if(STAT(CAPTURE_PROGRESS))
        {
 -              DrawCircleClippedPic(vec2(0.5 * vid_conwidth, 0.6 * vid_conheight), 0.1 * vid_conheight, "gfx/crosshair_ring.tga", STAT(CAPTURE_PROGRESS), '0.25 0.90 1', autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
 +              DrawCircleClippedPic(vec2(0.5 * vid_conwidth, 0.6 * vid_conheight), 0.1 * vid_conheight, "gfx/crosshair_ring", STAT(CAPTURE_PROGRESS), '0.25 0.90 1', autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
                drawstring_aspect(eY * 0.64 * vid_conheight, _("Capture progress"), vec2(vid_conwidth, 0.025 * vid_conheight), '1 1 1', 1, DRAWFLAG_NORMAL);
        }
        else if(STAT(REVIVE_PROGRESS))
        {
 -              DrawCircleClippedPic(vec2(0.5 * vid_conwidth, 0.6 * vid_conheight), 0.1 * vid_conheight, "gfx/crosshair_ring.tga", STAT(REVIVE_PROGRESS), '0.25 0.90 1', autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
 +              DrawCircleClippedPic(vec2(0.5 * vid_conwidth, 0.6 * vid_conheight), 0.1 * vid_conheight, "gfx/crosshair_ring", STAT(REVIVE_PROGRESS), '0.25 0.90 1', autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
                drawstring_aspect(eY * 0.64 * vid_conheight, _("Revival progress"), vec2(vid_conwidth, 0.025 * vid_conheight), '1 1 1', 1, DRAWFLAG_NORMAL);
        }
        HUD_Scale_Disable();
@@@ -1086,7 -1086,7 +1086,7 @@@ void View_NightVision(
        tc_10 = '1.5 0 0' - '0.2 0 0' * sin(time * 0.5) + '0 0.5 0' * cos(time * 1.7);
        //tc_11 = '1 1 0' + '0.6 0 0' * sin(time * 0.6) + '0 0.3 0' * cos(time * 0.1);
        tc_11 = tc_01 + tc_10 - tc_00;
 -      R_BeginPolygon("gfx/nightvision-bg.tga", DRAWFLAG_ADDITIVE, true);
 +      R_BeginPolygon("gfx/nightvision-bg", DRAWFLAG_ADDITIVE, true);
        R_PolygonVertex('0 0 0', tc_00, rgb, a);
        R_PolygonVertex(autocvar_vid_conwidth * '1 0 0', tc_10, rgb, a);
        R_PolygonVertex(autocvar_vid_conwidth * '1 0 0' + autocvar_vid_conheight * '0 1 0', tc_11, rgb, a);
        tc_01 = tc_00 + '0 3 0' * (1 + Noise_White(nightvision_noise2, frametime) * 0.2);
        tc_10 = tc_00 + '2 0 0' * (1 + Noise_White(nightvision_noise2, frametime) * 0.3);
        tc_11 = tc_01 + tc_10 - tc_00;
 -      R_BeginPolygon("gfx/nightvision-fg.tga", DRAWFLAG_ADDITIVE, true);
 +      R_BeginPolygon("gfx/nightvision-fg", DRAWFLAG_ADDITIVE, true);
        R_PolygonVertex('0 0 0', tc_00, rgb, a);
        R_PolygonVertex(autocvar_vid_conwidth * '1 0 0', tc_10, rgb, a);
        R_PolygonVertex(autocvar_vid_conwidth * '1 0 0' + autocvar_vid_conheight * '0 1 0', tc_11, rgb, a);
diff --combined qcsrc/server/client.qc
index 7d3c1faca69520d5faa995bcfa443259d4ba668a,bed6dc6f85cdb2da0eecfc334846a81caae632aa..d80bdffa78d8aaf09e9e7a6faea3479aa5b49438
@@@ -775,15 -775,14 +775,15 @@@ void PutPlayerInServer(entity this
        for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
        {
                .entity weaponentity = weaponentities[slot];
 +              entity w_ent = this.(weaponentity);
                if(slot == 0 || autocvar_g_weaponswitch_debug == 1)
 -                      this.(weaponentity).m_switchweapon = w_getbestweapon(this, weaponentity);
 +                      w_ent.m_switchweapon = w_getbestweapon(this, weaponentity);
                else
 -                      this.(weaponentity).m_switchweapon = WEP_Null;
 -              this.(weaponentity).m_weapon = WEP_Null;
 -              this.(weaponentity).weaponname = "";
 -              this.(weaponentity).m_switchingweapon = WEP_Null;
 -              this.(weaponentity).cnt = -1;
 +                      w_ent.m_switchweapon = WEP_Null;
 +              w_ent.m_weapon = WEP_Null;
 +              w_ent.weaponname = "";
 +              w_ent.m_switchingweapon = WEP_Null;
 +              w_ent.cnt = -1;
        }
  
        MUTATOR_CALLHOOK(PlayerWeaponSelect, this);
@@@ -1056,7 -1055,7 +1056,7 @@@ string getwelcomemessage(entity this
        modifications = substring(modifications, 2, strlen(modifications) - 2);
  
        string versionmessage = GetClientVersionMessage(this);
-       string s = strcat(versionmessage, "^8\n^8\nhost is ^9", autocvar_hostname, "^8\n");
+       string s = strcat(versionmessage, "^8\n^8\nserver is ^9", autocvar_hostname, "^8\n");
  
        s = strcat(s, "^8\nmatch type is ^1", gamemode_name, "^8\n");
  
@@@ -2088,6 -2087,23 +2088,6 @@@ int nJoinAllowed(entity this, entity ig
        return free_slots;
  }
  
 -/**
 - * Checks whether the client is an observer or spectator, if so, he will get kicked after
 - * g_maxplayers_spectator_blocktime seconds
 - */
 -void checkSpectatorBlock(entity this)
 -{
 -      if(IS_SPEC(this) || IS_OBSERVER(this))
 -      if(!this.caplayer)
 -      if(IS_REAL_CLIENT(this))
 -      {
 -              if( time > (CS(this).spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) {
 -                      Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_QUIT_KICK_SPECTATING);
 -                      dropclient(this);
 -              }
 -      }
 -}
 -
  void PrintWelcomeMessage(entity this)
  {
        if(CS(this).motd_actived_time == 0)
@@@ -2451,16 -2467,12 +2451,16 @@@ void PlayerPreThink (entity this
        if (frametime) {
                // physics frames: update anticheat stuff
                anticheat_prethink(this);
 -      }
  
 -      if (blockSpectators && frametime) {
                // WORKAROUND: only use dropclient in server frames (frametime set).
                // Never use it in cl_movement frames (frametime zero).
 -              checkSpectatorBlock(this);
 +              if (blockSpectators && IS_REAL_CLIENT(this)
 +                      && (IS_SPEC(this) || IS_OBSERVER(this)) && !this.caplayer
 +                      && time > (CS(this).spectatortime + autocvar_g_maxplayers_spectator_blocktime))
 +              {
 +                      if (dropclient_schedule(this))
 +                              Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_QUIT_KICK_SPECTATING);
 +              }
        }
  
        zoomstate_set = false;
@@@ -2697,14 -2709,13 +2697,14 @@@ void PlayerPostThink (entity this
  {
        Player_Physics(this);
  
 -      if (autocvar_sv_maxidle > 0)
 +      if (autocvar_sv_maxidle > 0 || (IS_PLAYER(this) && autocvar_sv_maxidle_playertospectator > 0))
        if (frametime) // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero).
        if (IS_REAL_CLIENT(this))
 -      if (IS_PLAYER(this) || autocvar_sv_maxidle_spectatorsareidle)
 +      if (IS_PLAYER(this) || autocvar_sv_maxidle_alsokickspectators)
 +      if (!intermission_running) // NextLevel() kills all centerprints after setting this true
        {
                int totalClients = 0;
 -              if(autocvar_sv_maxidle_slots > 0)
 +              if(autocvar_sv_maxidle > 0 && autocvar_sv_maxidle_slots > 0)
                {
                        FOREACH_CLIENT(IS_REAL_CLIENT(it) || autocvar_sv_maxidle_slots_countbots,
                        {
                        });
                }
  
 -              if (autocvar_sv_maxidle_slots > 0 && (maxclients - totalClients) > autocvar_sv_maxidle_slots)
 +              if (autocvar_sv_maxidle > 0 && autocvar_sv_maxidle_slots > 0 && (maxclients - totalClients) > autocvar_sv_maxidle_slots)
                { /* do nothing */ }
                else if (time - CS(this).parm_idlesince < 1) // instead of (time == this.parm_idlesince) to support sv_maxidle <= 10
                {
                }
                else
                {
 -                      float timeleft = ceil(autocvar_sv_maxidle - (time - CS(this).parm_idlesince));
 -                      if (timeleft == min(10, autocvar_sv_maxidle - 1)) { // - 1 to support sv_maxidle <= 10
 -                              if (!CS(this).idlekick_lasttimeleft)
 +                      float maxidle_time = autocvar_sv_maxidle;
 +                      if (IS_PLAYER(this) && autocvar_sv_maxidle_playertospectator > 0)
 +                              maxidle_time = autocvar_sv_maxidle_playertospectator;
 +                      float timeleft = ceil(maxidle_time - (time - CS(this).parm_idlesince));
 +                      float countdown_time = max(min(10, maxidle_time - 1), ceil(maxidle_time * 0.33)); // - 1 to support maxidle_time <= 10
 +                      if (timeleft == countdown_time && !CS(this).idlekick_lasttimeleft)
 +                      {
 +                              if (IS_PLAYER(this) && autocvar_sv_maxidle_playertospectator > 0)
 +                                      Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOVETOSPEC_IDLING, timeleft);
 +                              else
                                        Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_DISCONNECT_IDLING, timeleft);
                        }
                        if (timeleft <= 0) {
 -                              Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_KICK_IDLING, this.netname);
 -                              dropclient(this);
 +                              if (IS_PLAYER(this) && autocvar_sv_maxidle_playertospectator > 0)
 +                              {
 +                                      Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_MOVETOSPEC_IDLING, this.netname, maxidle_time);
 +                                      if (this.caplayer)
 +                                              this.caplayer = 0;
 +                                      PutObserverInServer(this);
 +                              }
 +                              else
 +                              {
 +                                      if (dropclient_schedule(this))
 +                                              Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_KICK_IDLING, this.netname, maxidle_time);
 +                              }
                                return;
                        }
 -                      else if (timeleft <= 10) {
 +                      else if (timeleft <= countdown_time) {
                                if (timeleft != CS(this).idlekick_lasttimeleft)
 -                                      Send_Notification(NOTIF_ONE, this, MSG_ANNCE, Announcer_PickNumber(CNT_IDLE, timeleft));
 +                                      play2(this, SND(TALK2));
                                CS(this).idlekick_lasttimeleft = timeleft;
                        }
                }
diff --combined qcsrc/server/world.qc
index cfbc0caf7a86facb47588c2838d14e84c8f0716d,25c2cfb18ed53bb48ac2f3aad99f407be21f4359..7214c1550d13eab2396351747b83f951c76b3003
@@@ -69,7 -69,7 +69,7 @@@ void PingPLReport_Think(entity this
        {
                WriteHeader(MSG_BROADCAST, TE_CSQC_PINGPLREPORT);
                WriteByte(MSG_BROADCAST, this.cnt);
-               WriteShort(MSG_BROADCAST, bound(1, CS(e).ping, 32767));
+               WriteShort(MSG_BROADCAST, bound(1, rint(CS(e).ping), 32767));
                WriteByte(MSG_BROADCAST, min(ceil(CS(e).ping_packetloss * 255), 255));
                WriteByte(MSG_BROADCAST, min(ceil(CS(e).ping_movementloss * 255), 255));
  
@@@ -408,7 -408,7 +408,7 @@@ void cvar_changes_init(
                BADPREFIX("skill_");
                BADPREFIX("sv_allow_");
                BADPREFIX("sv_cullentities_");
 -              BADPREFIX("sv_maxidle_");
 +              BADPREFIX("sv_maxidle");
                BADPREFIX("sv_minigames_");
                BADPREFIX("sv_radio_");
                BADPREFIX("sv_timeout_");
                BADCVAR("g_ctf_leaderboard");
                BADCVAR("g_domination_point_limit");
                BADCVAR("g_domination_teams_override");
 +              BADCVAR("g_freezetag_revive_spawnshield");
                BADCVAR("g_freezetag_teams_override");
                BADCVAR("g_friendlyfire");
                BADCVAR("g_fullbrightitems");
                BADCVAR("g_player_brightness");
                BADCVAR("g_rocket_flying");
                BADCVAR("g_rocket_flying_disabledelays");
 -              BADCVAR("g_spawnshieldtime");
 +              BADPREFIX("g_spawnshield");
                BADCVAR("g_start_delay");
                BADCVAR("g_superspectate");
                BADCVAR("g_tdm_teams_override");
                BADCVAR("sv_defaultplayercolors");
                BADCVAR("sv_defaultplayermodel");
                BADCVAR("sv_defaultplayerskin");
 -              BADCVAR("sv_maxidle");
                BADCVAR("sv_maxrate");
                BADCVAR("sv_motd");
                BADCVAR("sv_public");
@@@ -839,8 -839,7 +839,8 @@@ spawnfunc(worldspawn
        // character set: ASCII 33-126 without the following characters: : ; ' " \ $
        if(autocvar_sv_eventlog)
        {
 -              string s = sprintf("%s.%s.%06d", itos(autocvar_sv_eventlog_files_counter), strftime(false, "%s"), floor(random() * 1000000));
 +              string num = strftime_s(); // strftime(false, "%s") isn't reliable, see strftime_s description
 +              string s = sprintf("%s.%s.%06d", itos(autocvar_sv_eventlog_files_counter), num, floor(random() * 1000000));
                matchid = strzone(s);
  
                GameLogEcho(strcat(":gamestart:", GetGametype(), "_", GetMapname(), ":", s));
diff --combined xonotic-client.cfg
index f5204648527d640b4eca0d63350265966eb99c68,4ea44c0e959c00d9242ca7b99227aa4643f64d59..c62cb55407beedd41fd03f9492cb1e78260d9a6b
@@@ -753,7 -753,7 +753,7 @@@ set cl_accuracy_data_receive 0 "1 recei
  set developer_csqcentities 0 "csqc entity spam"
  
  seta cl_forceplayermodels 0 "make everyone look like your own model (requires server to have sv_defaultcharacter 0)"
 -seta cl_forceplayercolors 0 "make enemies look like your own color (requires server to have sv_defaultcharacter 0); 2: enable it even in teamplay (only when there is exactly one enemy team); 3: enable it only playing Duel"
 +seta cl_forceplayercolors 0 "make enemies look like your own color (requires server to have sv_defaultcharacter 0); 1: in all game modes without teams, 2: even in game modes with 2 teams, 3: only in Duel"
  seta cl_forcemyplayermodel "" "set to the model file name you want to show yourself as (does not affect how enemies look with cl_forceplayermodels)"
  seta cl_forcemyplayerskin 0 "set to the skin number you want to show yourself as (does not affect how enemies look with cl_forceplayermodels)"
  seta cl_forcemyplayercolors 0 "set to the color value (encoding is same as _cl_color) for your own player model (ignored in teamplay; does not affect how enemies look with cl_forceplayermodels)"
@@@ -777,8 -777,6 +777,6 @@@ r_useportalculling 
  set cl_lerpanim_maxdelta_framegroups 0.05 // must be faster than fastest weapon refire
  set cl_lerpanim_maxdelta_server 0.1 // must be slower than slowest server controlled anim (e.g. animinfo stuff)
  
- r_lerpsprites 1
  // autodemo deleting
  seta cl_autodemo_delete_keeprecords 0 "when 1, records with a newly made race/cts demo are kept even if cl_autodemo_delete is used to delete demos"