X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fcl_client.qc;h=608895b4e77cc630e2e84bb2ec8f20e4236f3ba1;hb=a61dce59e20aeb3e1b086dde70bf6ab02a8d09c8;hp=4263bc3b31cc99495ebc7b534f746b10a2480a8a;hpb=46ae86da6fddf3af9dd43fa1e834e19a2bd696b2;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 4263bc3b3..608895b4e 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -55,21 +55,20 @@ STATIC_METHOD(Client, Add, void(Client this, int _team)) { - WITHSELF(this, ClientConnect()); + ClientConnect(this); TRANSMUTE(Player, this); this.frame = 12; // 7 this.team = _team; - WITHSELF(this, PutClientInServer()); + PutClientInServer(this); } void PutObserverInServer(entity this); -void ClientDisconnect(); STATIC_METHOD(Client, Remove, void(Client this)) { TRANSMUTE(Observer, this); - WITHSELF(this, PutClientInServer()); - WITHSELF(this, ClientDisconnect()); + PutClientInServer(this); + ClientDisconnect(this); } void send_CSQC_teamnagger() { @@ -440,8 +439,8 @@ void FixPlayermodel(entity player) /** Called when a client spawns in the server */ -void PutClientInServer() -{ENGINE_EVENT(); +void PutClientInServer(entity this) +{ if (IS_BOT_CLIENT(this)) { TRANSMUTE(Player, this); } else if (IS_REAL_CLIENT(this)) { @@ -731,8 +730,8 @@ void SetNewParms () SetChangeParms ============= */ -void SetChangeParms () -{ENGINE_EVENT(); +void SetChangeParms (entity this) +{ // save parms for level change parm1 = this.parm_idlesince - time; @@ -779,7 +778,7 @@ void ClientKill_Now_TeamChange(entity this) PutObserverInServer(this); } else - WITHSELF(this, SV_ChangeTeam(this.killindicator_teamchange - 1)); + SV_ChangeTeam(this, this.killindicator_teamchange - 1); this.killindicator_teamchange = 0; } @@ -853,7 +852,6 @@ void ClientKill_TeamChange (entity this, float targetteam) // 0 = don't change, { float killtime; float starttime; - entity e; if (gameover) return; @@ -896,20 +894,20 @@ void ClientKill_TeamChange (entity this, float targetteam) // 0 = don't change, this.killindicator.count = bound(0, ceil(killtime), 10); //sprint(this, strcat("^1You'll be dead in ", ftos(this.killindicator.cnt), " seconds\n")); - for(e = NULL; (e = find(e, classname, "body")) != NULL; ) + FOREACH_ENTITY_ENT(enemy, this, { - if(e.enemy != this) + if(it.classname != "body") continue; - e.killindicator = spawn(); - e.killindicator.owner = e; - e.killindicator.scale = 0.5; - setattachment(e.killindicator, e, ""); - setorigin(e.killindicator, '0 0 52'); - setthink(e.killindicator, KillIndicator_Think); - e.killindicator.nextthink = starttime + (e.lip) * 0.05; - clientkilltime = max(clientkilltime, e.killindicator.nextthink + 0.05); - e.killindicator.cnt = ceil(killtime); - } + it.killindicator = spawn(); + it.killindicator.owner = it; + it.killindicator.scale = 0.5; + setattachment(it.killindicator, it, ""); + setorigin(it.killindicator, '0 0 52'); + setthink(it.killindicator, KillIndicator_Think); + it.killindicator.nextthink = starttime + (it.lip) * 0.05; + clientkilltime = max(clientkilltime, it.killindicator.nextthink + 0.05); + it.killindicator.cnt = ceil(killtime); + }); this.lip = 0; } } @@ -947,8 +945,8 @@ void ClientKill_TeamChange (entity this, float targetteam) // 0 = don't change, } -void ClientKill () -{ENGINE_EVENT(); +void ClientKill (entity this) +{ if(gameover) return; if(this.player_blocked) return; if(STAT(FROZEN, this)) return; @@ -1017,8 +1015,8 @@ ClientConnect Called when a client connects to the server ============= */ -void ClientConnect() -{ENGINE_EVENT(); +void ClientConnect(entity this) +{ if (Ban_MaybeEnforceBanOnce(this)) return; assert(!IS_CLIENT(this), return); this.flags |= FL_CLIENT; @@ -1173,8 +1171,8 @@ Called when a client disconnects from the server */ .entity chatbubbleentity; void ReadyCount(); -void ClientDisconnect() -{ENGINE_EVENT(); +void ClientDisconnect(entity this) +{ assert(IS_CLIENT(this), return); PlayerStats_GameReport_FinalizePlayer(this); @@ -1301,7 +1299,7 @@ void respawn(entity this) CopyBody(this, 1); this.effects |= EF_NODRAW; // prevent another CopyBody - WITHSELF(this, PutClientInServer()); + PutClientInServer(this); } void play_countdown(entity this, float finished, Sound samp) @@ -1798,7 +1796,7 @@ void LeaveSpectatorMode(entity this) Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_PREVENT_JOIN); - WITHSELF(this, PutClientInServer()); + PutClientInServer(this); if(IS_PLAYER(this)) { Send_Notification(NOTIF_ALL, NULL, MSG_INFO, ((teamplay && this.team != -1) ? APP_TEAM_ENT(this, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), this.netname); } } @@ -1969,7 +1967,7 @@ void SpectatorThink(entity this) TRANSMUTE(Spectator, this); } else { TRANSMUTE(Observer, this); - WITHSELF(this, PutClientInServer()); + PutClientInServer(this); } this.impulse = 0; } else if(this.impulse == 12 || this.impulse == 16 || this.impulse == 19 || (this.impulse >= 220 && this.impulse <= 229)) { @@ -1978,13 +1976,13 @@ void SpectatorThink(entity this) TRANSMUTE(Spectator, this); } else { TRANSMUTE(Observer, this); - WITHSELF(this, PutClientInServer()); + PutClientInServer(this); } this.impulse = 0; } else if (PHYS_INPUT_BUTTON_ATCK2(this)) { this.flags &= ~FL_JUMPRELEASED; TRANSMUTE(Observer, this); - WITHSELF(this, PutClientInServer()); + PutClientInServer(this); } else { if(!SpectateUpdate(this)) PutObserverInServer(this); @@ -2031,7 +2029,7 @@ void PlayerUseKey(entity this) while(head) // find the closest acceptable target to enter { - if(head.vehicle_flags & VHF_ISVEHICLE) + if(IS_VEHICLE(head)) if(!IS_DEAD(head)) if(!head.owner || ((head.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(head.owner, this))) if(head.takedamage != DAMAGE_NO) @@ -2066,8 +2064,8 @@ Called every frame for each client before the physics are run .float usekeypressed; .float last_vehiclecheck; .int items_added; -void PlayerPreThink () -{ENGINE_EVENT(); +void PlayerPreThink (entity this) +{ WarpZone_PlayerPhysics_FixVAngle(this); STAT(GAMESTARTTIME, this) = game_starttime; @@ -2158,10 +2156,9 @@ void PlayerPreThink () if(autocvar_g_vehicles_enter && (time > this.last_vehiclecheck) && !gameover && !this.vehicle) if(IS_PLAYER(this) && !STAT(FROZEN, this) && !IS_DEAD(this)) { - FOREACH_ENTITY_FLAGS(vehicle_flags, VHF_ISVEHICLE, + FOREACH_ENTITY_RADIUS(this.origin, autocvar_g_vehicles_enter_radius, IS_VEHICLE(it), { if(!IS_DEAD(it) && it.takedamage != DAMAGE_NO) - if(vdist(it.origin - this.origin, <, autocvar_g_vehicles_enter_radius)) if((it.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(it.owner, this)) { Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER_GUNNER); @@ -2416,8 +2413,8 @@ Called every frame for each client after the physics are run ============= */ .float idlekick_lasttimeleft; -void PlayerPostThink () -{ENGINE_EVENT(); +void PlayerPostThink (entity this) +{ if (sv_maxidle > 0) if (frametime) // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero). if (IS_REAL_CLIENT(this))