]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into develop
authorterencehill <piuntn@gmail.com>
Tue, 12 Apr 2022 11:56:49 +0000 (13:56 +0200)
committerterencehill <piuntn@gmail.com>
Tue, 12 Apr 2022 11:56:49 +0000 (13:56 +0200)
1  2 
qcsrc/client/csqcmodel_hooks.qc
qcsrc/client/main.qc
qcsrc/client/view.qc
qcsrc/common/weapons/all.qh
xonotic-client.cfg

index e74fee00d5630cd745f7f81e5e1fe3a60a98c9da,7c9234fae33511d22a321fe1188f550c14c8cd3e..f1f581a83003077e3aa86a83cdb229c80799440f
@@@ -236,7 -236,7 +236,7 @@@ void CSQCPlayer_ModelAppearance_Apply(e
  
        bool forceplayercolors_enabled = false;
        #define fpc autocvar_cl_forceplayercolors
-       if (ISGAMETYPE(DUEL))
+       if (gametype.m_1v1)
        {
                if ((myteam != NUM_SPECTATOR) && (fpc == 1 || fpc == 2 || fpc == 3 || fpc == 5))
                        forceplayercolors_enabled = true;
        {
                if(autocvar_cl_forcemyplayercolors && islocalplayer)
                        this.colormap = 1024 + autocvar_cl_forcemyplayercolors;
-               else if (autocvar_cl_forceuniqueplayercolors && !islocalplayer && !ISGAMETYPE(DUEL))
+               else if (autocvar_cl_forceuniqueplayercolors && !islocalplayer && !gametype.m_1v1)
                {
                        // Assign each enemy unique colors
                        // pick colors from 0 to 14 since 15 is the rainbow color
  
        // GLOWMOD AND DEATH FADING
        if(this.colormap > 0)
 -              this.glowmod = colormapPaletteColor(((this.colormap >= 1024) ? this.colormap : entcs_GetClientColors(this.colormap - 1)) & 0x0F, true) * 2;
 +              this.glowmod = colormapPaletteColor(((this.colormap >= 1024) ? this.colormap : entcs_GetClientColors(this.colormap - 1)) & 0x0F, true);
        else
                this.glowmod = '1 1 1';
  
                }
        }
  
 +      // don't let the engine increase player's glowmod
 +      if (autocvar_r_hdr_glowintensity > 1)
 +              this.glowmod /= autocvar_r_hdr_glowintensity;
 +
        //printf("CSQCPlayer_ModelAppearance_Apply(): state = %s, colormap = %f, glowmod = %s\n", (this.csqcmodel_isdead ? "DEAD" : "ALIVE"), this.colormap, vtos(this.glowmod));
  }
  
diff --combined qcsrc/client/main.qc
index 90067ce9ee6f5585c0d3c003c1880398348c1312,0892bb6bf2bf0bd67a21ce4fa727a3c22ff988f5..753ed24f8614f747603510457db5633e7165eba1
@@@ -4,6 -4,7 +4,7 @@@
  #include <client/draw.qh>
  #include <client/hud/_mod.qh>
  #include <client/hud/panel/centerprint.qh>
+ #include <client/hud/panel/chat.qh>
  #include <client/hud/panel/quickmenu.qh>
  #include <client/hud/panel/scoreboard.qh>
  #include <client/items/items.qh>
@@@ -57,7 -58,7 +58,7 @@@ void CSQC_Init(
                maxclients = i;
        }
  
-       ReplicateVars_Send_All();
+       ReplicateVars(REPLICATEVARS_SEND_ALL);
  
        // needs to be done so early because of the constants they create
        static_init();
@@@ -179,14 -180,7 +180,14 @@@ void Shutdown(
                if (!(calledhooks & HOOK_START))
                        localcmd("\n_cl_hook_gamestart nop\n");
                if (!(calledhooks & HOOK_END))
 +              {
 +                      int gamecount = cvar("cl_matchcount");
                        localcmd("\ncl_hook_gameend\n");
 +                      // NOTE: using localcmd here to ensure it's executed AFTER cl_hook_gameend
 +                      // earlier versions of the game abuse the hook to set this cvar
 +                      localcmd(strcat("cl_matchcount ", itos(gamecount + 1), "\n"));
 +                      //cvar_set("cl_matchcount", itos(gamecount + 1));
 +              }
        }
  
        localcmd("\ncl_hook_shutdown\n");
        deactivate_minigame();
        HUD_MinigameMenu_Close(NULL, NULL, NULL);
  
-       ReplicateVars_Destroy();
+       ReplicateVars(REPLICATEVARS_DESTROY);
  }
  
  void AuditLists()
@@@ -459,10 -453,13 +460,13 @@@ float CSQC_InputEvent(int bInputType, f
  {
        TC(int, bInputType);
        bool override = false;
        override |= HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary);
        if (override)
                return true;
  
+       override |= HUD_Panel_Chat_InputEvent(bInputType, nPrimary, nSecondary);
        override |= QuickMenu_InputEvent(bInputType, nPrimary, nSecondary);
  
        override |= HUD_Radar_InputEvent(bInputType, nPrimary, nSecondary);
        if(override)
                return true;
  
+       if(bInputType == 3 || bInputType == 2)
+               return false;
+       // at this point bInputType can only be 0 or 1 (key pressed or released)
+       bool key_pressed = (bInputType == 0);
+       if(key_pressed) {
+               if(nPrimary == K_ALT) hudShiftState |= S_ALT;
+               if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
+               if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
+       }
+       else {
+               if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
+               if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
+               if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
+       }
+       if (nPrimary == K_ESCAPE && !(hudShiftState & S_SHIFT) && key_pressed)
+       {
+               if (!isdemo() && cvar("_menu_gamemenu_dialog_available"))
+               {
+                       localcmd("\nmenu_showgamemenudialog\n");
+                       return true;
+               }
+       }
        return false;
  }
  
@@@ -1014,6 -1037,7 +1044,7 @@@ void Fog_Force(
                localcmd(sprintf("\nfog %s\nr_fog_exp2 0\nr_drawfog 1\n", forcefog));
  }
  
+ bool net_handle_ServerWelcome();
  NET_HANDLE(ENT_CLIENT_SCORES_INFO, bool isnew)
  {
        make_pure(this);
                strcpy(teamscores_label(i), ReadString());
                teamscores_flags(i) = ReadByte();
        }
+       bool welcome_msg_too = ReadByte();
+       if (welcome_msg_too)
+               net_handle_ServerWelcome();
        return = true;
        Scoreboard_InitScores();
        Gamemode_Init();
@@@ -1289,6 -1316,80 +1323,80 @@@ NET_HANDLE(TE_CSQC_WEAPONCOMPLAIN, boo
        }
  }
  
+ bool net_handle_ServerWelcome()
+ {
+       bool campaign = ReadByte();
+       if (campaign)
+       {
+               string campaign_title = ReadString();
+               int campaign_level = ReadByte();
+               string campaign_msg = ReadString();
+               string welcomedialog_args;
+               welcomedialog_args = strcat("HOSTNAME \"", campaign_title, "\"");
+               string key = getcommandkey(_("jump"), "+jump");
+               string msg = strcat(
+                       CCR("^F1"), sprintf(_("Level %d:"), campaign_level),
+                       sprintf(CCR(" ^BG%s\n^3\n"), campaign_msg),
+                       sprintf(CCR(_("^BGPress ^F2%s^BG to enter the game")), key));
+               msg = MakeConsoleSafe(strreplace("\n", "\\n", msg));
+               welcomedialog_args = strcat(welcomedialog_args, " WELCOME \"", msg, "\"");
+               localcmd("\nmenu_cmd directmenu Welcome ", welcomedialog_args, "\n");
+               return true;
+       }
+       welcome_msg_force_centerprint = ReadByte();
+       strcpy(hostname, ReadString());
+       string ver = ReadString();
+       string modifications = ReadString();
+       string cache_mutatormsg = ReadString();
+       string mutator_msg = ReadString();
+       string motd = ReadString();
+       string msg = "";
+       msg = strcat(msg, ver);
+       msg = strcat(msg, "^8\n\n", strcat(_("Gametype:"), " ^1", MapInfo_Type_ToText(gametype)), "^8\n");
+       if(modifications != "")
+               msg = strcat(msg, "^8\n", _("Active modifications:"), " ^3", modifications, "^8\n");
+       if (cache_mutatormsg != "")
+               msg = strcat(msg, "\n\n^8", _("Special gameplay tips:"), " ^7", cache_mutatormsg);
+       msg = strcat(msg, mutator_msg); // trust that the mutator will do proper formatting
+       if (motd != "")
+               msg = strcat(msg, "\n\n^8", _("MOTD:"), " ^7", motd);
+       strcpy(welcome_msg, msg);
+       welcome_msg_menu_check_maxtime = time + 1; // wait for menu to load before showing the welcome dialog
+       return true;
+ }
+ void Welcome_Message_Show_Try()
+ {
+       if (!welcome_msg_menu_check_maxtime)
+               return;
+       bool want_dialog = (!welcome_msg_force_centerprint && !isdemo() && autocvar_cl_welcome_in_menu_dialog);
+       // if want dialog check if menu is initialized but for a short time
+       if (!want_dialog || cvar("_menu_initialized") == 2 || time > welcome_msg_menu_check_maxtime)
+       {
+               if (want_dialog && cvar("_menu_welcome_dialog_available"))
+               {
+                       string welcomedialog_args = strcat("HOSTNAME \"", hostname, "\"");
+                       string msg = MakeConsoleSafe(strreplace("\n", "\\n", welcome_msg));
+                       welcomedialog_args = strcat(welcomedialog_args, " WELCOME \"", msg, "\"");
+                       localcmd("\nmenu_cmd directmenu Welcome ", welcomedialog_args, "\n");
+               }
+               else
+                       centerprint_Add(ORDINAL(CPID_MOTD), strcat(hostname, "\n\n\n", welcome_msg), -1, 0);
+               strfree(welcome_msg);
+               welcome_msg_menu_check_maxtime = 0;
+       }
+ }
+ NET_HANDLE(TE_CSQC_SERVERWELCOME, bool isNew)
+ {
+       return net_handle_ServerWelcome();
+ }
  string _getcommandkey(string cmd_name, string command, bool forcename)
  {
        string keys;
diff --combined qcsrc/client/view.qc
index 08987b384f878b1a6bc83e9857fa0e669e02ea2d,855d20f818fbf7d04028cd255ec5067f42ab25f8..7183d80c8be432be81153e230e98e58c0f110cdf
@@@ -770,7 -770,7 +770,7 @@@ void UpdateDamage(
  {
        // accumulate damage with each stat update
        static float damage_total_prev = 0;
-       float damage_total = STAT(DAMAGE_DEALT_TOTAL);
+       float damage_total = STAT(HITSOUND_DAMAGE_DEALT_TOTAL);
        float unaccounted_damage_new = COMPARE_INCREASING(damage_total, damage_total_prev);
        damage_total_prev = damage_total;
  
@@@ -1540,7 -1540,7 +1540,7 @@@ void CSQC_UpdateView(entity this, floa
        stats_get();
        hud = STAT(HUD);
  
-       ReplicateVars_Check();
+       ReplicateVars(REPLICATEVARS_CHECK);
  
        HUD_Scale_Disable();
  
                current_player = player_localnum;
        myteam = entcs_GetTeam(current_player);
  
-       // abused multiple places below
        entity local_player = ((csqcplayer) ? csqcplayer : CSQCModel_server2csqc(player_localentnum - 1));
        if(!local_player)
                local_player = this; // fall back!
        if(intermission && !intermission_time)
                intermission_time = time;
  
+       if(STAT(GAME_STOPPED) && !game_stopped_time)
+               game_stopped_time = time;
+       else if(game_stopped_time && !STAT(GAME_STOPPED))
+               game_stopped_time = 0;
        if(intermission && !isdemo() && !(calledhooks & HOOK_END))
        {
                if(calledhooks & HOOK_START)
                {
 +                      int gamecount = cvar("cl_matchcount");
                        localcmd("\ncl_hook_gameend\n");
 +                      // NOTE: using localcmd here to ensure it's executed AFTER cl_hook_gameend
 +                      // earlier versions of the game abuse the hook to set this cvar
 +                      localcmd(strcat("cl_matchcount ", itos(gamecount + 1), "\n"));
 +                      //cvar_set("cl_matchcount", itos(gamecount + 1));
                        calledhooks |= HOOK_END;
                }
        }
  
+       Welcome_Message_Show_Try();
        Announcer();
  
        View_CheckButtonStatus();
        // Draw the World (and sky)
        setproperty(VF_DRAWWORLD, 1);
  
-       // Set the console size vars
        vid_conwidth = autocvar_vid_conwidth;
        vid_conheight = autocvar_vid_conheight;
        vid_pixelheight = autocvar_vid_pixelheight;
  
        View_DemoCamera();
  
-       // Draw the Crosshair
-       setproperty(VF_DRAWCROSSHAIR, 0); //Make sure engine crosshairs are always hidden
-       // Draw the Engine Status Bar (the default Quake HUD)
-       setproperty(VF_DRAWENGINESBAR, 0);
-       // Update the mouse position
-       /*
-          mousepos_x = vid_conwidth;
-          mousepos_y = vid_conheight;
-          mousepos = mousepos*0.5 + getmousepos();
-        */
+       setproperty(VF_DRAWCROSSHAIR, 0); // hide engine crosshair
+       setproperty(VF_DRAWENGINESBAR, 0); // hide engine status bar
  
        IL_EACH(g_drawables, it.draw, it.draw(it));
  
index 2205d2b422110a28e19f92d9dfc431c9da81e2eb,6824680436fe3c5f320649053c2e697aa84d8ff6..356c3882a920d84537261cbc8b9acb9ba7b26be2
@@@ -308,11 -308,14 +308,11 @@@ WepSet WEPSET_SUPERWEAPONS
  
  #include "all.inc"
  
 -// TODO: remove after 0.8.2. Retains impulse number compatibility because 0.8.1 clients don't reload the weapons.cfg
 -#define WEP_HARDCODED_IMPULSES 20
 -
  // TODO: invert after 0.8.2. Will require moving 'best weapon' impulses
  #define WEP_IMPULSE_BEGIN 230
  #define WEP_IMPULSE_END bound(WEP_IMPULSE_BEGIN, WEP_IMPULSE_BEGIN + (REGISTRY_COUNT(Weapons) - 1) - 1, 253)
  
 -REGISTRY_SORT(Weapons, WEP_HARDCODED_IMPULSES + 1)
 +REGISTRY_SORT(Weapons, 1)
  REGISTRY_CHECK(Weapons)
  
  STATIC_INIT(register_weapons_done)
  vector weaponentity_glowmod(Weapon wep, entity actor, int c, entity wepent)
  {
      vector g;
 -    if (!(g = wep.wr_glow(wep, actor, wepent))) g = colormapPaletteColor(c & 0x0F, true) * 2;
 +    if (!(g = wep.wr_glow(wep, actor, wepent))) g = colormapPaletteColor(c & 0x0F, true);
      return g;
  }
  
@@@ -391,18 -394,26 +391,26 @@@ ENUMCLASS_END(WFRAME
  vector shotorg_adjust_values(vector vecs, bool y_is_right, bool visual, int algn);
  void CL_WeaponEntity_SetModel(entity this, string name, bool _anim);
  
+ REPLICATE_INIT(int, cvar_cl_gunalign);
+ REPLICATE_INIT(bool, cvar_cl_weapon_switch_reload);
+ REPLICATE_INIT(bool, cvar_cl_weapon_switch_fallback_to_impulse);
+ REPLICATE_INIT(int, cvar_cl_weaponimpulsemode);
+ REPLICATE_INIT(string, cvar_cl_weaponpriority);
+ REPLICATE_INIT(string, cvar_cl_weaponpriorities[10]);
  #ifdef CSQC
- bool cvar_cl_accuracy_data_share;
- REPLICATE(cvar_cl_accuracy_data_share, bool, "cl_accuracy_data_share");
- bool cvar_cl_accuracy_data_receive;
- REPLICATE(cvar_cl_accuracy_data_receive, bool, "cl_accuracy_data_receive");
+ REPLICATE_INIT(bool, cvar_cl_accuracy_data_share);
+ REPLICATE_INIT(bool, cvar_cl_accuracy_data_receive);
  #endif
  
  #ifdef SVQC
  void wframe_send(entity actor, entity weaponentity, int wepframe, float attackrate, bool restartanim);
- #endif
  
- #ifdef SVQC
  void W_MuzzleFlash(Weapon thiswep, entity actor, .entity weaponentity, vector shotorg, vector shotdir);
+ string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(entity this, string wo);
+ string W_FixWeaponOrder_AllowIncomplete(entity this, string order);
  #endif
  #endif
diff --combined xonotic-client.cfg
index 334abd02e1c3aa5099924f48321f6a00b70c265c,349a393c61a4150610685da12e6adfd66c926b57..f3c5ca7731151c512499a72d3e0d3ac7d3f01611
@@@ -23,8 -23,15 +23,15 @@@ alias use "impulse 21
  cl_particles_forcetraileffects 1
  
  alias dropweapon "impulse 17"
- alias +show_info +button7
- alias -show_info -button7
+ alias +show_info0 "+button7"
+ alias -show_info0 "-button7"
+ alias +show_info1 "menu_showwelcomedialog"
+ alias -show_info1 ""
+ seta cl_welcome_in_menu_dialog 1 "1: show the welcome message in a dedicated menu dialog; 0: show it as a centerprint message"
+ alias +show_info +show_info$cl_welcome_in_menu_dialog
+ alias -show_info -show_info$cl_welcome_in_menu_dialog
  
  // merge lightmaps up to 2048x2048 textures
  mod_q3bsp_lightmapmergepower 4
@@@ -172,13 -179,14 +179,14 @@@ r_motionblur 0 // motion blur value, de
  r_damageblur 0 // motion blur when damaged, default is 0 (removed in Xonotic)
  net_slist_queriespersecond 60 // to be reduced if any major issues arise (ping times increased etc.)
  
+ // TODO: revisit bloom settings on the GL32 renderer!
  r_bloom_blur 4
- r_bloom_brighten 2
+ r_bloom_brighten 1
  r_bloom_colorexponent 1
- r_bloom_colorscale 1
+ r_bloom_colorscale 1.5
  r_bloom_colorsubtract 0.125
  r_bloom_resolution 320
- r_bloom_scenebrightness 0.85
+ r_bloom_scenebrightness 1
  
  seta vid_x11_display ""       "xonotic-linux-*.sh will use this to start xonotic on an other/new X display"
  // This can have three possible settings:
@@@ -317,8 -325,7 +325,7 @@@ seta cl_casings_sloppy 1 "sloppy casing
  seta cl_projectiles_sloppy 1 "sloppy projectiles, may temporarily penetrate walls"
  cl_stainmaps 0
  cl_particles_smoke 1
- set vid_gl20 1
- set gl_vbo 3
+ gl_vbo 1 // removed in GL32 renderer
  r_glsl_deluxemapping 1
  r_glsl_offsetmapping 0
  r_glsl_offsetmapping_lod 1
@@@ -379,6 -386,8 +386,6 @@@ alias weapon_group_7 "impulse 7
  alias weapon_group_8 "impulse 8"
  alias weapon_group_9 "impulse 9"
  alias weapon_group_0 "impulse 14" // cycles the superweapons
 -// TODO: remove after 0.8.2. Default impulse commands for 0.8.1 servers
 -exec weapons.cfg
  
  cl_curl_enabled 1
  cl_curl_maxdownloads 3
@@@ -483,7 -492,10 +490,10 @@@ seta menu_tooltips 1 "menu tooltips: 0 
  set menu_picmip_bypass 0 "bypass texture quality enforcement based on system resources, not recommended and may cause crashes!"
  set menu_showboxes 0 "show item bounding boxes (debug)"
  set menu_cvarlist_onlymodified 0 "show only modified cvars in the cvar list"
- set menu_force_on_disconnection 1 "force to show the menu this number of seconds after you get disconnected (0 to disable)"
+ set menu_force_on_disconnection 1 "force to show the menu after you get disconnected"
+ set _menu_credits_export 0 "set to 1 and restart the menu to export credits to credits.txt (menu will automatically reset to 0)"
+ alias menu_credits_export "_menu_credits_export 1; menu_restart"
  
  r_textbrightness 0.2
  r_textcontrast 0.8
@@@ -840,6 -852,9 +850,9 @@@ seta cl_allow_uid2name -1 "-1 = ask if 
  seta cl_allow_uidtracking 1 "-1 = ask if the player wants to disable/enable this feature, 0 = disable, 1 = enable uid tracking (allows associating your data with your player ID)"
  seta cl_allow_uidranking 1 "0 = disable, 1 = enable uid ranking (allows statistics like elo to rank you in leaderboards)"
  
+ // terms of service
+ seta _termsofservice_accepted 0
  // polygonoffset for submodel SUCKS SUCKS SUCKS (only a hack for quake1, we don't need that)
  r_polygonoffset_submodel_offset 0
  r_polygonoffset_submodel_factor 0