]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_client.qc
fix some typos
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_client.qc
index bddb5933233ba91f7d422a85820852276344722e..7f8523e345b33a4c721a7858de6266af2e760024 100644 (file)
@@ -118,7 +118,7 @@ void spawnpoint_use()
                self.team = activator.team;
                some_spawn_has_been_used = 1;
        }
-};
+}
 
 // Returns:
 //   _x: prio (-1 if unusable)
@@ -153,7 +153,7 @@ vector Spawn_Score(entity spot, entity playerlist, float teamcheck, float anypoi
 
        // filter out spots for assault
        if(spot.target != "") {
-               local entity ent;
+               entity ent;
                float good, found;
                ent = find(world, targetname, spot.target);
 
@@ -224,7 +224,7 @@ float spawn_allbad;
 float spawn_allgood;
 entity Spawn_FilterOutBadSpots(entity firstspot, entity playerlist, float mindist, float teamcheck, float anypoint)
 {
-       local entity spot, spotlist, spotlistend;
+       entity spot, spotlist, spotlistend;
        spawn_allgood = TRUE;
        spawn_allbad = TRUE;
 
@@ -299,7 +299,7 @@ entity Spawn_WeightedPoint(entity firstspot, float lower, float upper, float exp
 {
        // weight of a point: bound(lower, mindisttoplayer, upper)^exponent
        // multiplied by spot.cnt (useful if you distribute many spawnpoints in a small area)
-       local entity spot;
+       entity spot;
 
        RandomSelection_Init();
        for(spot = firstspot; spot; spot = spot.chain)
@@ -317,9 +317,9 @@ Finds a point to respawn
 */
 entity SelectSpawnPoint (float anypoint)
 {
-       local float teamcheck;
-       local entity firstspot_new;
-       local entity spot, firstspot, playerlist;
+       float teamcheck;
+       entity firstspot_new;
+       entity spot, firstspot, playerlist;
 
        spot = find (world, classname, "testplayerstart");
        if (spot)
@@ -662,6 +662,7 @@ void PutObserverInServer (void)
        
        self.classname = "observer";
        self.iscreature = FALSE;
+       self.damagedbycontents = FALSE;
        self.health = -666;
        self.takedamage = DAMAGE_NO;
        self.solid = SOLID_NOT;
@@ -754,9 +755,9 @@ void PutObserverInServer (void)
 
 void FixPlayermodel()
 {
-       local string defaultmodel;
-       local float defaultskin, chmdl, oldskin;
-       local vector m1, m2;
+       string defaultmodel;
+       float defaultskin, chmdl, oldskin;
+       vector m1, m2;
 
        defaultmodel = "";
 
@@ -860,6 +861,9 @@ void PutClientInServer (void)
                WriteByte(MSG_ONE, SVC_SETVIEW);
                WriteEntity(MSG_ONE, self);
        }
+       
+       // reset player keys
+       self.itemkeys = 0;
 
        // player is dead and becomes observer
        // FIXME fix LMS scoring for new system
@@ -899,6 +903,7 @@ void PutClientInServer (void)
                self.classname = "player";
                self.wasplayer = TRUE;
                self.iscreature = TRUE;
+               self.damagedbycontents = TRUE;
                self.movetype = MOVETYPE_WALK;
                self.solid = SOLID_SLIDEBOX;
                self.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_SOLID;
@@ -910,6 +915,8 @@ void PutClientInServer (void)
                if(INDEPENDENT_PLAYERS)
                        MAKE_INDEPENDENT_PLAYER(self);
                self.flags = FL_CLIENT;
+               if(autocvar__notarget)
+                       self.flags |= FL_NOTARGET;
                self.takedamage = DAMAGE_AIM;
                if(g_minstagib)
                        self.effects = EF_FULLBRIGHT;
@@ -1028,7 +1035,8 @@ void PutClientInServer (void)
                self.prevorigin = self.origin;
                self.lastrocket = world; // stop rocket guiding, no revenge from the grave!
                self.lastteleporttime = time; // prevent insane speeds due to changing origin
-
+        self.hud = HUD_NORMAL;
+        
                if(g_arena)
                {
                        Spawnqueue_Remove(self);
@@ -1091,7 +1099,7 @@ void PutClientInServer (void)
                        entity e;
                        e = get_weaponinfo(j);
                        if(e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars
-                               self.weapon_load[j] = cvar(strcat("g_balance_", e.netname, "_reload_ammo"));
+                               self.(weapon_load[j]) = cvar(strcat("g_balance_", e.netname, "_reload_ammo"));
                }
 
                oldself = self;
@@ -1526,6 +1534,10 @@ float PlayerInIDList(entity p, string idlist)
        return 0;
 }
 
+#ifndef NO_LEGACY_NETWORKING
+.float iscsqcmodel;
+#endif
+
 /*
 =============
 ClientConnect
@@ -1787,6 +1799,16 @@ void ClientConnect (void)
 
        if(!autocvar_g_campaign)
                Send_CSQC_Centerprint_Generic(self, CPID_MOTD, getwelcomemessage(), autocvar_welcome_message_time, 0);
+
+#ifndef NO_LEGACY_NETWORKING
+       if(autocvar_sv_use_csqc_players)
+       {
+               CSQCModel_LinkEntity();
+               self.iscsqcmodel = 1;
+       }
+#else
+       CSQCModel_LinkEntity();
+#endif
 }
 
 /*
@@ -1841,6 +1863,7 @@ void ClientDisconnect (void)
 
        Portal_ClearAll(self);
 
+       RemoveGrapplingHook(self);
        if(self.flagcarried)
                DropFlag(self.flagcarried, world, world);
        if(self.ballcarried && g_nexball)
@@ -1908,7 +1931,7 @@ void ChatBubbleThink()
                self.model = self.mdl;
        else
                self.model = "";
-};
+}
 
 void UpdateChatBubble()
 {
@@ -1937,7 +1960,7 @@ void UpdateChatBubble()
 // added to the model skins
 /*void UpdateColorModHack()
 {
-       local float c;
+       float c;
        c = self.clientcolors & 15;
        // LordHavoc: only bothering to support white, green, red, yellow, blue
             if (!teamplay) self.colormod = '0 0 0';
@@ -1947,7 +1970,7 @@ void UpdateChatBubble()
        else if (c == 12) self.colormod = '1.22 1.22 0.10';
        else if (c == 13) self.colormod = '0.10 0.10 1.73';
        else self.colormod = '1 1 1';
-};*/
+}*/
 
 .float oldcolormap;
 void respawn(void)
@@ -1961,7 +1984,7 @@ void respawn(void)
                self.avelocity = randomvec() * autocvar_g_respawn_ghosts_speed * 3 - randomvec() * autocvar_g_respawn_ghosts_speed * 3;
                self.effects |= EF_ADDITIVE;
                self.oldcolormap = self.colormap;
-               self.colormap = 512;
+               self.colormap = 0; // this originally was 512, but raises a warning in the engine, so get rid of it
                pointparticles(particleeffectnum("respawn_ghost"), self.origin, '0 0 0', 1);
                if(autocvar_g_respawn_ghosts_maxtime)
                        SUB_SetFade (self, time + autocvar_g_respawn_ghosts_maxtime / 2 + random () * (autocvar_g_respawn_ghosts_maxtime - autocvar_g_respawn_ghosts_maxtime / 2), 1.5);
@@ -2524,16 +2547,16 @@ float nJoinAllowed(float includeMe) {
                return FALSE; // forced spectators can never join
 
        // TODO simplify this
-       local entity e;
+       entity e;
 
-       local float totalClients;
+       float totalClients;
        FOR_EACH_CLIENT(e)
                totalClients += 1;
 
        if (!autocvar_g_maxplayers)
                return maxclients - totalClients + includeMe;
 
-       local float currentlyPlaying;
+       float currentlyPlaying;
        FOR_EACH_REALPLAYER(e)
                currentlyPlaying += 1;
 
@@ -2774,9 +2797,12 @@ void PlayerPreThink (void)
 
        MUTATOR_CALLHOOK(PlayerPreThink);
 
-       if(self.BUTTON_USE && !self.usekeypressed)
-               PlayerUseKey();
-       self.usekeypressed = self.BUTTON_USE;
+       if(!self.cvar_cl_newusekeysupported) // FIXME remove this - it was a stupid idea to begin with, we can JUST use the button
+       {
+               if(self.BUTTON_USE && !self.usekeypressed)
+                       PlayerUseKey();
+               self.usekeypressed = self.BUTTON_USE;
+       }
 
        PrintWelcomeMessage();
 
@@ -2943,14 +2969,14 @@ void PlayerPreThink (void)
 
                self.prevorigin = self.origin;
 
-               if ((self.BUTTON_CROUCH && !self.hook.state) || self.health <= g_bloodloss)
+               if (((self.BUTTON_CROUCH && !self.hook.state) || self.health <= g_bloodloss) && self.animstate_startframe != self.anim_melee_x) // prevent crouching if using melee attack
                {
                        if (!self.crouch)
                        {
                                self.crouch = TRUE;
                                self.view_ofs = PL_CROUCH_VIEW_OFS;
                                setsize (self, PL_CROUCH_MIN, PL_CROUCH_MAX);
-                               setanim(self, self.anim_duck, FALSE, TRUE, TRUE);
+                               // setanim(self, self.anim_duck, FALSE, TRUE, TRUE); // this anim is BROKEN anyway
                        }
                }
                else
@@ -3009,7 +3035,10 @@ void PlayerPreThink (void)
 
                if(g_nexball)
                        nexball_setstatus();
-
+               
+               // secret status
+               secrets_setstatus();
+               
                self.dmg_team = max(0, self.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
 
                //self.angles_y=self.v_angle_y + 90;   // temp
@@ -3237,7 +3266,7 @@ void PlayerPostThink (void)
                        self.stored_netname = strzone(uid2name(self.crypto_idfp));
                if(self.stored_netname != self.netname)
                {
-                       db_put(ServerProgsDB, strcat("uid2name", self.crypto_idfp), self.netname);
+                       db_put(ServerProgsDB, strcat("/uid2name/", self.crypto_idfp), self.netname);
                        strunzone(self.stored_netname);
                        self.stored_netname = strzone(self.netname);
                }
@@ -3247,4 +3276,23 @@ void PlayerPostThink (void)
        if(g_race)
                dprint(sprintf("%f %.6f\n", time, race_GetFractionalLapCount(self)));
        */
+
+#ifndef NO_LEGACY_NETWORKING
+       if(autocvar_sv_use_csqc_players && !self.iscsqcmodel)
+       {
+               CSQCModel_LinkEntity();
+               self.iscsqcmodel = 1;
+       }
+
+       if(!autocvar_sv_use_csqc_players && self.iscsqcmodel)
+       {
+               CSQCModel_UnlinkEntity();
+               self.iscsqcmodel = 0;
+       }
+
+       if(self.iscsqcmodel)
+               CSQCModel_CheckUpdate();
+#else
+       CSQCModel_CheckUpdate();
+#endif
 }