X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fcl_client.qc;h=6d3d786aecda1de1a1b2c70c697bcb3c3cc3b7a8;hb=3108bc8ea930e133184d3055677d706c7ecaa833;hp=53ec965030552c0bd76eb2af8811aa53ac90165a;hpb=4e85c153239969d8dccea38031e18ddb24b6c935;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 53ec96503..6d3d786ae 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -1,30 +1,48 @@ +#include "cl_client.qh" + #include "waypointsprites.qh" +#include "anticheat.qh" #include "cl_impulse.qh" #include "cl_player.qh" #include "ent_cs.qh" -#include "g_subs.qh" #include "ipban.qh" #include "miscfunctions.qh" #include "portals.qh" #include "teamplay.qh" #include "playerdemo.qh" -#include "secret.qh" +#include "spawnpoints.qh" +#include "g_damage.qh" +#include "g_hook.qh" +#include "command/common.qh" +#include "cheats.qh" +#include "g_world.qh" +#include "race.qh" +#include "antilag.qh" +#include "campaign.qh" +#include "command/common.qh" #include "bot/bot.qh" #include "bot/navigation.qh" +#include "vehicles/vehicle.qh" + #include "weapons/hitplot.qh" #include "weapons/weaponsystem.qh" #include "../common/net_notice.qh" #include "../common/physics.qh" +#include "../common/triggers/subs.qh" +#include "../common/triggers/triggers.qh" +#include "../common/triggers/trigger/secret.qh" + +#include "../common/items/inventory.qh" + #include "../common/monsters/sv_monsters.qh" #include "../warpzonelib/server.qh" -float c1, c2, c3, c4; void send_CSQC_teamnagger() { WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); @@ -177,6 +195,7 @@ void PutObserverInServer (void) if(IS_REAL_CLIENT(self)) { + Item_ItemsTime_SetTimesForPlayer(self); msg_entity = self; WriteByte(MSG_ONE, SVC_SETVIEW); WriteEntity(MSG_ONE, self); @@ -208,7 +227,8 @@ void PutObserverInServer (void) if(self.killcount != -666) { Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_SPECTATE, self.netname); - if(autocvar_g_chat_nospectators == 1 || (cvar("g_warmup") && !(warmup_stage || gameover) && autocvar_g_chat_nospectators == 2)) + if(!intermission_running) + if(autocvar_g_chat_nospectators == 1 || (!(warmup_stage || gameover) && autocvar_g_chat_nospectators == 2)) Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_CHAT_NOSPECTATORS); if(self.just_joined == false) { @@ -302,7 +322,7 @@ void FixPlayermodel() defaultskin = 0; chmdl = false; - if(autocvar_sv_defaultcharacter == 1) + if(autocvar_sv_defaultcharacter) { if(teamplay) { @@ -410,7 +430,6 @@ void PutClientInServer (void) if(IS_PLAYER(self)) { entity spot, oldself; - float j; accuracy_resend(self); @@ -489,6 +508,9 @@ void PutClientInServer (void) else self.superweapons_finished = 0; + if(!warmup_stage) + Item_ItemsTime_ResetTimesForPlayer(self); + if(g_weaponarena_random) // WEAPONTODO: more stuff that should be in a mutator. also: rename those cvars { if(g_weaponarena_random_with_blaster) @@ -517,7 +539,7 @@ void PutClientInServer (void) self.respawn_flags = 0; self.respawn_time = 0; self.stat_respawn_time = 0; - self.scale = 0; + self.scale = autocvar_sv_player_scale; self.fade_time = 0; self.pain_frame = 0; self.pain_finished = 0; @@ -599,13 +621,13 @@ void PutClientInServer (void) target_voicescript_clear(self); // reset fields the weapons may use - for (j = WEP_FIRST; j <= WEP_LAST; ++j) + for (int j = WEP_FIRST; j <= WEP_LAST; ++j) { WEP_ACTION(j, WR_RESETPLAYER); // all weapons must be fully loaded when we spawn entity e = get_weaponinfo(j); - if(e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars + if (e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars self.(weapon_load[j]) = e.reloading_ammo; } @@ -652,7 +674,7 @@ void PutClientInServer (void) .float ebouncefactor, ebouncestop; // electro's values // TODO do we need all these fields, or should we stop autodetecting runtime // changes and just have a console command to update this? -float ClientInit_SendEntity(entity to, float sf) +float ClientInit_SendEntity(entity to, int sf) { WriteByte(MSG_ENTITY, ENT_CLIENT_INIT); WriteByte(MSG_ENTITY, g_nexball_meter_period * 32); @@ -1001,7 +1023,7 @@ float PlayerInIDList(entity p, string idlist) float n, i; string s; - // NOTE: we do NOT check crypto_keyfp here, an unsigned ID is fine too for this + // NOTE: we do NOT check crypto_idfp_signed here, an unsigned ID is fine too for this if (!p.crypto_idfp) return 0; @@ -1083,6 +1105,7 @@ void ClientConnect (void) PlayerScore_Attach(self); ClientData_Attach(); accuracy_init(self); + Inventory_new(self); bot_clientconnect(); @@ -1250,6 +1273,13 @@ void ClientConnect (void) if(IS_REAL_CLIENT(self)) sv_notice_join(); + for (entity e = world; (e = findfloat(e, init_for_player_needed, 1)); ) { + entity oldself = self; + self = e; + e.init_for_player(oldself); + self = oldself; + } + MUTATOR_CALLHOOK(ClientConnect); } /* @@ -1318,6 +1348,7 @@ void ClientDisconnect (void) bot_relinkplayerlist(); accuracy_free(self); + Inventory_delete(self); ClientData_Detach(); PlayerScore_Detach(self); @@ -1656,10 +1687,10 @@ void SetZoomState(float z) void GetPressedKeys(void) { MUTATOR_CALLHOOK(GetPressedKeys); #define X(var,bit,flag) (flag ? var |= bit : var &= ~bit) - X(self.pressedkeys, KEY_FORWARD, PHYS_INPUT_MOVEVALUES(self)_x > 0); - X(self.pressedkeys, KEY_BACKWARD, PHYS_INPUT_MOVEVALUES(self)_x < 0); - X(self.pressedkeys, KEY_RIGHT, PHYS_INPUT_MOVEVALUES(self)_y > 0); - X(self.pressedkeys, KEY_LEFT, PHYS_INPUT_MOVEVALUES(self)_y < 0); + X(self.pressedkeys, KEY_FORWARD, self.movement_x > 0); + X(self.pressedkeys, KEY_BACKWARD, self.movement_x < 0); + X(self.pressedkeys, KEY_RIGHT, self.movement_y > 0); + X(self.pressedkeys, KEY_LEFT, self.movement_y < 0); X(self.pressedkeys, KEY_JUMP, PHYS_INPUT_BUTTON_JUMP(self)); X(self.pressedkeys, KEY_CROUCH, PHYS_INPUT_BUTTON_CROUCH(self)); @@ -2200,6 +2231,8 @@ void PlayerPreThink (void) self.stat_allow_oldvortexbeam = autocvar_g_allow_oldvortexbeam; self.stat_leadlimit = autocvar_leadlimit; + self.weaponsinmap = weaponsInMap; + if(frametime) { // physics frames: update anticheat stuff @@ -2438,8 +2471,8 @@ void PlayerPreThink (void) if (!self.crouch) { self.crouch = true; - self.view_ofs = PL_CROUCH_VIEW_OFS; - setsize (self, PL_CROUCH_MIN, PL_CROUCH_MAX); + self.view_ofs = self.stat_pl_crouch_view_ofs; + setsize (self, self.stat_pl_crouch_min, self.stat_pl_crouch_max); // setanim(self, self.anim_duck, false, true, true); // this anim is BROKEN anyway } } @@ -2447,12 +2480,12 @@ void PlayerPreThink (void) { if (self.crouch) { - tracebox(self.origin, PL_MIN, PL_MAX, self.origin, false, self); + tracebox(self.origin, self.stat_pl_min, self.stat_pl_max, self.origin, false, self); if (!trace_startsolid) { self.crouch = false; - self.view_ofs = PL_VIEW_OFS; - setsize (self, PL_MIN, PL_MAX); + self.view_ofs = self.stat_pl_view_ofs; + setsize (self, self.stat_pl_min, self.stat_pl_max); } } }