X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fcl_client.qc;h=a2bc2f967c0b4fbbae0295f38b02e77fb1105807;hb=49f91e2df43419bb48275cdfe2a2d5663637467a;hp=8eef87f9601905188c224420bb8ea061541300e2;hpb=50e00110bb3855e1d989c0461dbf05ad9950e8e2;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 8eef87f96..a2bc2f967 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -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) @@ -755,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 = ""; @@ -861,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 @@ -912,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; @@ -1030,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); @@ -1528,6 +1534,10 @@ float PlayerInIDList(entity p, string idlist) return 0; } +#ifndef NO_LEGACY_NETWORKING +.float iscsqcmodel; +#endif + /* ============= ClientConnect @@ -1789,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 } /* @@ -1843,6 +1863,7 @@ void ClientDisconnect (void) Portal_ClearAll(self); + RemoveGrapplingHook(self); if(self.flagcarried) DropFlag(self.flagcarried, world, world); if(self.ballcarried && g_nexball) @@ -1910,7 +1931,7 @@ void ChatBubbleThink() self.model = self.mdl; else self.model = ""; -}; +} void UpdateChatBubble() { @@ -1939,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'; @@ -1949,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) @@ -1963,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); @@ -2526,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; @@ -2776,7 +2797,7 @@ void PlayerPreThink (void) MUTATOR_CALLHOOK(PlayerPreThink); - if(!self.cvar_cl_newusekeysupported) + 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(); @@ -2807,42 +2828,22 @@ void PlayerPreThink (void) if(frametime) { - if(self.health <= 0 && autocvar_g_deathglow) + if(self.weapon == WEP_NEX && autocvar_g_balance_nex_charge) { - if(self.glowmod_x > 0) - self.glowmod_x -= autocvar_g_deathglow * frametime; - else - self.glowmod_x = -1; - if(self.glowmod_y > 0) - self.glowmod_y -= autocvar_g_deathglow * frametime; - else - self.glowmod_y = -1; - if(self.glowmod_z > 0) - self.glowmod_z -= autocvar_g_deathglow * frametime; - else - self.glowmod_z = -1; - } - else - { - // set weapon and player glowmod - self.glowmod = colormapPaletteColor(self.clientcolors & 0x0F, TRUE) * 2; + self.weaponentity_glowmod_x = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_half * min(1, self.nex_charge / autocvar_g_balance_nex_charge_animlimit); + self.weaponentity_glowmod_y = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_half * min(1, self.nex_charge / autocvar_g_balance_nex_charge_animlimit); + self.weaponentity_glowmod_z = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_half * min(1, self.nex_charge / autocvar_g_balance_nex_charge_animlimit); - if(self.weapon == WEP_NEX && autocvar_g_balance_nex_charge) + if(self.nex_charge > autocvar_g_balance_nex_charge_animlimit) { - self.weaponentity_glowmod_x = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_half * min(1, self.nex_charge / autocvar_g_balance_nex_charge_animlimit); - self.weaponentity_glowmod_y = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_half * min(1, self.nex_charge / autocvar_g_balance_nex_charge_animlimit); - self.weaponentity_glowmod_z = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_half * min(1, self.nex_charge / autocvar_g_balance_nex_charge_animlimit); - - if(self.nex_charge > autocvar_g_balance_nex_charge_animlimit) - { - self.weaponentity_glowmod_x = self.weaponentity_glowmod_x + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_full * (self.nex_charge - autocvar_g_balance_nex_charge_animlimit) / (1 - autocvar_g_balance_nex_charge_animlimit); - self.weaponentity_glowmod_y = self.weaponentity_glowmod_y + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_full * (self.nex_charge - autocvar_g_balance_nex_charge_animlimit) / (1 - autocvar_g_balance_nex_charge_animlimit); - self.weaponentity_glowmod_z = self.weaponentity_glowmod_z + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_full * (self.nex_charge - autocvar_g_balance_nex_charge_animlimit) / (1 - autocvar_g_balance_nex_charge_animlimit); - } + self.weaponentity_glowmod_x = self.weaponentity_glowmod_x + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_full * (self.nex_charge - autocvar_g_balance_nex_charge_animlimit) / (1 - autocvar_g_balance_nex_charge_animlimit); + self.weaponentity_glowmod_y = self.weaponentity_glowmod_y + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_full * (self.nex_charge - autocvar_g_balance_nex_charge_animlimit) / (1 - autocvar_g_balance_nex_charge_animlimit); + self.weaponentity_glowmod_z = self.weaponentity_glowmod_z + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_full * (self.nex_charge - autocvar_g_balance_nex_charge_animlimit) / (1 - autocvar_g_balance_nex_charge_animlimit); } - else - self.weaponentity_glowmod = self.glowmod; } + else + self.glowmod = colormapPaletteColor(self.clientcolors & 0x0F, TRUE) * 2; + player_powerups(); } @@ -2948,14 +2949,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 @@ -3014,7 +3015,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 @@ -3242,7 +3246,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); } @@ -3252,4 +3256,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 }