]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_client.qc
gradually fade out the "charge" on the nex so if you go fast but hit a wall, you...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_client.qc
index 73c9169e5e6929341cca72c4f50377ec92c32125..5c980920b7228a5dcc37681bca3e7b3fa855afd1 100644 (file)
@@ -6,6 +6,22 @@ void send_CSQC_teamnagger() {
        WriteByte(0, TE_CSQC_TEAMNAGGER);
 }
 
+void send_CSQC_nexvelocity(entity e) {
+       msg_entity = e;
+       WriteByte(MSG_ONE, SVC_TEMPENTITY);
+       WriteByte(MSG_ONE, TE_CSQC_NEX_VELOCITY);
+       WriteShort(MSG_ONE, cvar("g_balance_nex_velocitydependent_minspeed"));
+       WriteShort(MSG_ONE, cvar("g_balance_nex_velocitydependent_maxspeed"));
+       WriteShort(MSG_ONE, cvar("g_balance_nex_velocitydependent_falloff_factor") * 10000);
+}
+
+void send_CSQC_cr_maxbullets(entity e) {
+       msg_entity = e;
+       WriteByte(MSG_ONE, SVC_TEMPENTITY);
+       WriteByte(MSG_ONE, TE_CSQC_CR_MAXBULLETS);
+       WriteByte(MSG_ONE, cvar("g_balance_campingrifle_magazinecapacity"));
+}
+
 void Announce(string snd) {
        WriteByte(MSG_ALL, SVC_TEMPENTITY);
        WriteByte(MSG_ALL, TE_CSQC_ANNOUNCE);
@@ -866,10 +882,11 @@ void PutClientInServer (void)
                self.iscreature = TRUE;
                self.movetype = MOVETYPE_WALK;
                self.solid = SOLID_SLIDEBOX;
+               self.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_SOLID;
                if(cvar("g_playerclip_collisions"))
-                       self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP;
-               else
-                       self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY;
+                       self.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP;
+               if(clienttype(self) == CLIENTTYPE_BOT && cvar("g_botclip_collisions"))
+                       self.dphitcontentsmask |= DPCONTENTS_BOTCLIP;
                self.frags = FRAGS_PLAYER;
                if(independent_players)
                        MAKE_INDEPENDENT_PLAYER(self);
@@ -1063,9 +1080,18 @@ float ClientInit_SendEntity(entity to, float sf)
 {
        WriteByte(MSG_ENTITY, ENT_CLIENT_INIT);
        WriteByte(MSG_ENTITY, g_nexball_meter_period * 32);
-       WriteCoord(MSG_ENTITY, hook_shotorigin_x);
-       WriteCoord(MSG_ENTITY, hook_shotorigin_y);
-       WriteCoord(MSG_ENTITY, hook_shotorigin_z);
+       WriteInt24_t(MSG_ENTITY, compressShotOrigin(hook_shotorigin[0]));
+       WriteInt24_t(MSG_ENTITY, compressShotOrigin(hook_shotorigin[1]));
+       WriteInt24_t(MSG_ENTITY, compressShotOrigin(hook_shotorigin[2]));
+       WriteInt24_t(MSG_ENTITY, compressShotOrigin(hook_shotorigin[3]));
+       WriteInt24_t(MSG_ENTITY, compressShotOrigin(electro_shotorigin[0]));
+       WriteInt24_t(MSG_ENTITY, compressShotOrigin(electro_shotorigin[1]));
+       WriteInt24_t(MSG_ENTITY, compressShotOrigin(electro_shotorigin[2]));
+       WriteInt24_t(MSG_ENTITY, compressShotOrigin(electro_shotorigin[3]));
+       WriteInt24_t(MSG_ENTITY, compressShotOrigin(gauntlet_shotorigin[0]));
+       WriteInt24_t(MSG_ENTITY, compressShotOrigin(gauntlet_shotorigin[1]));
+       WriteInt24_t(MSG_ENTITY, compressShotOrigin(gauntlet_shotorigin[2]));
+       WriteInt24_t(MSG_ENTITY, compressShotOrigin(gauntlet_shotorigin[3]));
        if(sv_foginterval && world.fog != "")
                WriteString(MSG_ENTITY, world.fog);
        else
@@ -1074,6 +1100,8 @@ float ClientInit_SendEntity(entity to, float sf)
        WriteByte(MSG_ENTITY, self.cnt * 255.0); // g_balance_weaponswitchdelay
        WriteCoord(MSG_ENTITY, self.bouncefactor); // g_balance_grenadelauncher_secondary_bouncefactor
        WriteCoord(MSG_ENTITY, self.bouncestop); // g_balance_grenadelauncher_secondary_bouncestop
+       WriteByte(MSG_ENTITY, cvar("g_balance_nex_secondary")); // client has to know if it should zoom or not
+       WriteByte(MSG_ENTITY, cvar("g_balance_campingrifle_secondary")); // client has to know if it should zoom or not
        return TRUE;
 }
 
@@ -1343,8 +1371,9 @@ void FixClientCvars(entity e)
        if(g_race || g_cts)
                stuffcmd(e, "cl_cmd settemp cl_movecliptokeyboard 2\n");
        if(cvar("g_antilag") == 3) // client side hitscan
-               //stuffcmd(e, "cl_cmd settemp cl_prydoncursor -1\ncl_cmd settemp cl_prydoncursor_notrace 0\n");
                stuffcmd(e, "cl_cmd settemp cl_prydoncursor_notrace 0\n");
+       if(sv_gentle)
+               stuffcmd(e, "cl_cmd settemp cl_gentle 1\n");
        /*
         * we no longer need to stuff this. Remove this comment block if you feel
         * 2.3 and higher (or was it 2.2.3?) don't need these any more
@@ -1582,9 +1611,12 @@ void ClientConnect (void)
                        race_SendRankings(i, 0, 0, MSG_ONE);
                }
        }
-       else if(cvar("sv_teamnagger") && !g_ca) // teamnagger is currently bad for ca
+       else if(cvar("sv_teamnagger") && !(cvar("bot_vs_human") && (c3==-1 && c4==-1)) && !g_ca) // teamnagger is currently bad for ca
                send_CSQC_teamnagger();
 
+       send_CSQC_nexvelocity(self);
+       send_CSQC_cr_maxbullets(self);
+
        CheatInitClient();
 }
 
@@ -2526,9 +2558,9 @@ void PlayerPreThink (void)
                if(self.cvar_g_xonoticversion)
                        if(time > self.version_nagtime)
                        {
-                               if(strstr(self.cvar_g_xonoticversion, "svn", 0) < 0)
+                               if(strstr(self.cvar_g_xonoticversion, "git", 0) < 0)
                                {
-                                       if(strstr(cvar_string("g_xonoticversion"), "svn", 0) >= 0)
+                                       if(strstr(cvar_string("g_xonoticversion"), "git", 0) >= 0)
                                        {
                                                dprint("^1NOTE^7 to ", self.netname, "^7 - the server is running ^3Xonotic ", cvar_string("g_xonoticversion"), " (beta)^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n");
                                                sprint(self, strcat("\{1}^1NOTE: ^7the server is running ^3Xonotic ", cvar_string("g_xonoticversion"), " (beta)^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n"));
@@ -2599,7 +2631,23 @@ void PlayerPreThink (void)
 
                if(frametime)
                {
-                       self.glowmod = colormapPaletteColor(self.clientcolors & 0x0F, TRUE) * 2;
+                       if(self.health <= 0 && cvar("g_deathglow"))
+                       {
+                               if(self.glowmod_x > 0)
+                                       self.glowmod_x -= cvar("g_deathglow") * frametime;
+                               else
+                                       self.glowmod_x = -1;
+                               if(self.glowmod_y > 0)
+                                       self.glowmod_y -= cvar("g_deathglow") * frametime;
+                               else
+                                       self.glowmod_y = -1;
+                               if(self.glowmod_z > 0)
+                                       self.glowmod_z -= cvar("g_deathglow") * frametime;
+                               else
+                                       self.glowmod_z = -1;
+                       }
+                       else
+                               self.glowmod = colormapPaletteColor(self.clientcolors & 0x0F, TRUE) * 2;
                        player_powerups();
                }
 
@@ -2659,7 +2707,6 @@ void PlayerPreThink (void)
                FOR_EACH_PLAYER(other) if(self != other)
                {
                        if(time > other.touchexplode_time)
-                       if(other.classname == "player")
                        if(other.deadflag == DEAD_NO)
                        if not(IS_INDEPENDENT_PLAYER(other))
                        if(boxesoverlap(self.absmin, self.absmax, other.absmin, other.absmax))
@@ -2777,7 +2824,7 @@ void PlayerPreThink (void)
        }
 
        if(!zoomstate_set)
-               SetZoomState(self.BUTTON_ZOOM || (self.BUTTON_ATCK2 && self.weapon == WEP_NEX));
+               SetZoomState(self.BUTTON_ZOOM || (self.BUTTON_ATCK2 && self.weapon == WEP_NEX) || (self.BUTTON_ATCK2 && self.weapon == WEP_CAMPINGRIFLE && cvar("g_balance_campingrifle_secondary") == 0));
 
        float oldspectatee_status;
        oldspectatee_status = self.spectatee_status;
@@ -2830,9 +2877,16 @@ float isInvisibleString(string s)
                switch(c)
                {
                        case 0:
-                       case 32:
-                       case 160:
+                       case 32: // space
                                break;
+                       case 192: // charmap space
+                               if (!cvar("utf8_enable"))
+                                       break;
+                               return FALSE;
+                       case 160: // space in unicode fonts
+                       case 0xE000 + 192: // utf8 charmap space
+                               if (cvar("utf8_enable"))
+                                       break;
                        default:
                                return FALSE;
                }