X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;ds=inline;f=qcsrc%2Fserver%2Fcl_client.qc;h=1298ae4fe675d107b1141d0b64b1c09e60582cdb;hb=b8dea2df7d3495a80c733043b136b28cd12cab79;hp=0c29aebebd621165cdb6f3797824c7ce0d65ab12;hpb=7ecfc8afc935fdf69b9a5f49397cfb1ad082178c;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 0c29aebeb..1298ae4fe 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -177,7 +177,7 @@ void setplayermodel(entity e, string modelname) { precache_model(modelname); _setmodel(e, modelname); - player_setupanimsformodel(); + player_setupanimsformodel(e); if(!autocvar_g_debug_globalsounds) UpdatePlayerSounds(e); } @@ -247,7 +247,7 @@ void PutObserverInServer(entity this) if (this.killcount != FRAGS_SPECTATOR) { - Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_SPECTATE, this.netname); + Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_SPECTATE, this.netname); if(!intermission_running) if(autocvar_g_chat_nospectators == 1 || (!(warmup_stage || gameover) && autocvar_g_chat_nospectators == 2)) Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_CHAT_NOSPECTATORS); @@ -383,7 +383,7 @@ void FixPlayermodel(entity player) defaultskin = autocvar_sv_defaultplayerskin; } - MUTATOR_CALLHOOK(FixPlayermodel, defaultmodel, defaultskin); + MUTATOR_CALLHOOK(FixPlayermodel, defaultmodel, defaultskin, player); defaultmodel = M_ARGV(0, string); defaultskin = M_ARGV(1, int); @@ -441,8 +441,7 @@ void FixPlayermodel(entity player) /** Called when a client spawns in the server */ void PutClientInServer() -{ - SELFPARAM(); +{ENGINE_EVENT(); if (IS_BOT_CLIENT(this)) { TRANSMUTE(Player, this); } else if (IS_REAL_CLIENT(this)) { @@ -711,7 +710,7 @@ void ClientInit_Spawn() setthink(e, ClientInit_CheckUpdate); Net_LinkEntity(e, false, 0, ClientInit_SendEntity); - WITHSELF(e, ClientInit_CheckUpdate(e)); + ClientInit_CheckUpdate(e); } /* @@ -733,7 +732,7 @@ SetChangeParms ============= */ void SetChangeParms () -{SELFPARAM(); +{ENGINE_EVENT(); // save parms for level change parm1 = this.parm_idlesince - time; @@ -784,8 +783,8 @@ void ClientKill_Now_TeamChange(entity this) this.killindicator_teamchange = 0; } -void ClientKill_Now() -{SELFPARAM(); +void ClientKill_Now(entity this) +{ if(this.vehicle) { vehicles_exit(this.vehicle, VHEF_RELEASE); @@ -799,7 +798,7 @@ void ClientKill_Now() if(this.killindicator && !wasfreed(this.killindicator)) remove(this.killindicator); - this.killindicator = world; + this.killindicator = NULL; if(this.killindicator_teamchange) ClientKill_Now_TeamChange(this); @@ -813,21 +812,21 @@ void KillIndicator_Think(entity this) { if (gameover) { - this.owner.killindicator = world; + this.owner.killindicator = NULL; remove(this); return; } if (this.owner.alpha < 0 && !this.owner.vehicle) { - this.owner.killindicator = world; + this.owner.killindicator = NULL; remove(this); return; } if(this.cnt <= 0) { - WITHSELF(this.owner, ClientKill_Now()); + ClientKill_Now(this.owner); return; } else if(g_cts && this.health == 1) // health == 1 means that it's silent @@ -854,7 +853,6 @@ void ClientKill_TeamChange (entity this, float targetteam) // 0 = don't change, { float killtime; float starttime; - entity e; if (gameover) return; @@ -879,7 +877,7 @@ void ClientKill_TeamChange (entity this, float targetteam) // 0 = don't change, if(killtime <= 0 || !IS_PLAYER(this) || IS_DEAD(this)) { - WITHSELF(this, ClientKill_Now()); + ClientKill_Now(this); } else { @@ -897,20 +895,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 = world; (e = find(e, classname, "body")) != world; ) + 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; } } @@ -949,7 +947,7 @@ void ClientKill_TeamChange (entity this, float targetteam) // 0 = don't change, } void ClientKill () -{SELFPARAM(); +{ENGINE_EVENT(); if(gameover) return; if(this.player_blocked) return; if(STAT(FROZEN, this)) return; @@ -999,7 +997,7 @@ Called once (not at each match start) when a client begins a connection to the s ============= */ void ClientPreConnect () -{SELFPARAM(); +{ENGINE_EVENT(); if(autocvar_sv_eventlog) { GameLogEcho(sprintf(":connect:%d:%d:%s", @@ -1019,8 +1017,7 @@ Called when a client connects to the server ============= */ void ClientConnect() -{ - SELFPARAM(); +{ENGINE_EVENT(); if (Ban_MaybeEnforceBanOnce(this)) return; assert(!IS_CLIENT(this), return); this.flags |= FL_CLIENT; @@ -1176,8 +1173,7 @@ Called when a client disconnects from the server .entity chatbubbleentity; void ReadyCount(); void ClientDisconnect() -{ - SELFPARAM(); +{ENGINE_EVENT(); assert(IS_CLIENT(this), return); PlayerStats_GameReport_FinalizePlayer(this); @@ -1188,7 +1184,7 @@ void ClientDisconnect() if (autocvar_sv_eventlog) GameLogEcho(strcat(":part:", ftos(this.playerid))); - Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_DISCONNECT, this.netname); + Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_DISCONNECT, this.netname); MUTATOR_CALLHOOK(ClientDisconnect, this); @@ -1226,8 +1222,8 @@ void ChatBubbleThink(entity this) this.nextthink = time; if ((this.owner.alpha < 0) || this.owner.chatbubbleentity != this) { - if(this.owner) // but why can that ever be world? - this.owner.chatbubbleentity = world; + if(this.owner) // but why can that ever be NULL? + this.owner.chatbubbleentity = NULL; remove(this); return; } @@ -1247,8 +1243,8 @@ void ChatBubbleThink(entity this) } -void UpdateChatBubble() -{SELFPARAM(); +void UpdateChatBubble(entity this) +{ if (this.alpha < 0) return; // spawn a chatbubble entity if needed @@ -1286,8 +1282,8 @@ void UpdateChatBubble() else this.colormod = '1 1 1'; }*/ -void respawn() -{SELFPARAM(); +void respawn(entity this) +{ if(this.alpha >= 0 && autocvar_g_respawn_ghosts) { this.solid = SOLID_NOT; @@ -1304,11 +1300,11 @@ void respawn() CopyBody(this, 1); this.effects |= EF_NODRAW; // prevent another CopyBody - PutClientInServer(); + WITHSELF(this, PutClientInServer()); } -void play_countdown(float finished, Sound samp) -{SELFPARAM(); +void play_countdown(entity this, float finished, Sound samp) +{ TC(Sound, samp); if(IS_REAL_CLIENT(this)) if(floor(finished - time - frametime) != floor(finished - time)) @@ -1316,8 +1312,8 @@ void play_countdown(float finished, Sound samp) sound (this, CH_INFO, samp, VOL_BASE, ATTEN_NORM); } -void player_powerups () -{SELFPARAM(); +void player_powerups(entity this) +{ // add a way to see what the items were BEFORE all of these checks for the mutator hook int items_prev = this.items; @@ -1338,12 +1334,12 @@ void player_powerups () { if (this.items & ITEM_Strength.m_itemid) { - play_countdown(this.strength_finished, SND_POWEROFF); + play_countdown(this, this.strength_finished, SND_POWEROFF); this.effects = this.effects | (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT); if (time > this.strength_finished) { this.items = this.items - (this.items & ITEM_Strength.m_itemid); - //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_STRENGTH, this.netname); + //Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERDOWN_STRENGTH, this.netname); Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERDOWN_STRENGTH); } } @@ -1352,18 +1348,18 @@ void player_powerups () if (time < this.strength_finished) { this.items = this.items | ITEM_Strength.m_itemid; - Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_STRENGTH, this.netname); + Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERUP_STRENGTH, this.netname); Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERUP_STRENGTH); } } if (this.items & ITEM_Shield.m_itemid) { - play_countdown(this.invincible_finished, SND_POWEROFF); + play_countdown(this, this.invincible_finished, SND_POWEROFF); this.effects = this.effects | (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT); if (time > this.invincible_finished) { this.items = this.items - (this.items & ITEM_Shield.m_itemid); - //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_SHIELD, this.netname); + //Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERDOWN_SHIELD, this.netname); Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERDOWN_SHIELD); } } @@ -1372,7 +1368,7 @@ void player_powerups () if (time < this.invincible_finished) { this.items = this.items | ITEM_Shield.m_itemid; - Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SHIELD, this.netname); + Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERUP_SHIELD, this.netname); Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERUP_SHIELD); } } @@ -1382,7 +1378,7 @@ void player_powerups () { this.superweapons_finished = 0; this.items = this.items - (this.items & IT_SUPERWEAPON); - //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_LOST, this.netname); + //Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_SUPERWEAPON_LOST, this.netname); Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_SUPERWEAPON_LOST); } else if (this.items & IT_UNLIMITED_SUPERWEAPONS) @@ -1391,12 +1387,12 @@ void player_powerups () } else { - play_countdown(this.superweapons_finished, SND_POWEROFF); + play_countdown(this, this.superweapons_finished, SND_POWEROFF); if (time > this.superweapons_finished) { this.items = this.items - (this.items & IT_SUPERWEAPON); this.weapons &= ~WEPSET_SUPERWEAPONS; - //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_BROKEN, this.netname); + //Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_SUPERWEAPON_BROKEN, this.netname); Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_SUPERWEAPON_BROKEN); } } @@ -1406,7 +1402,7 @@ void player_powerups () if (time < this.superweapons_finished || (this.items & IT_UNLIMITED_SUPERWEAPONS)) { this.items = this.items | IT_SUPERWEAPON; - Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_PICKUP, this.netname); + Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_SUPERWEAPON_PICKUP, this.netname); Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_SUPERWEAPON_PICKUP); } else @@ -1479,22 +1475,32 @@ float CalcRotRegen(float current, float regenstable, float regenfactor, float re return current; } -void player_regen () -{SELFPARAM(); +void player_regen(entity this) +{ float max_mod, regen_mod, rot_mod, limit_mod; max_mod = regen_mod = rot_mod = limit_mod = 1; - regen_mod_max = max_mod; - regen_mod_regen = regen_mod; - regen_mod_rot = rot_mod; - regen_mod_limit = limit_mod; - - regen_health = autocvar_g_balance_health_regen; - regen_health_linear = autocvar_g_balance_health_regenlinear; - regen_health_rot = autocvar_g_balance_health_rot; - regen_health_rotlinear = autocvar_g_balance_health_rotlinear; - regen_health_stable = autocvar_g_balance_health_regenstable; - regen_health_rotstable = autocvar_g_balance_health_rotstable; - if(!MUTATOR_CALLHOOK(PlayerRegen)) + + float regen_health = autocvar_g_balance_health_regen; + float regen_health_linear = autocvar_g_balance_health_regenlinear; + float regen_health_rot = autocvar_g_balance_health_rot; + float regen_health_rotlinear = autocvar_g_balance_health_rotlinear; + float regen_health_stable = autocvar_g_balance_health_regenstable; + float regen_health_rotstable = autocvar_g_balance_health_rotstable; + bool mutator_returnvalue = MUTATOR_CALLHOOK(PlayerRegen, this, max_mod, regen_mod, rot_mod, limit_mod, regen_health, regen_health_linear, regen_health_rot, + regen_health_rotlinear, regen_health_stable, regen_health_rotstable); + max_mod = M_ARGV(1, float); + regen_mod = M_ARGV(2, float); + rot_mod = M_ARGV(3, float); + limit_mod = M_ARGV(4, float); + regen_health = M_ARGV(5, float); + regen_health_linear = M_ARGV(6, float); + regen_health_rot = M_ARGV(7, float); + regen_health_rotlinear = M_ARGV(8, float); + regen_health_stable = M_ARGV(9, float); + regen_health_rotstable = M_ARGV(10, float); + + + if(!mutator_returnvalue) if(!STAT(FROZEN, this)) { float mina, maxa, limith, limita; @@ -1503,11 +1509,6 @@ void player_regen () limith = autocvar_g_balance_health_limit; limita = autocvar_g_balance_armor_limit; - max_mod = regen_mod_max; - regen_mod = regen_mod_regen; - rot_mod = regen_mod_rot; - limit_mod = regen_mod_limit; - regen_health_rotstable = regen_health_rotstable * max_mod; regen_health_stable = regen_health_stable * max_mod; limith = limith * limit_mod; @@ -1540,8 +1541,8 @@ void player_regen () } bool zoomstate_set; -void SetZoomState(float z) -{SELFPARAM(); +void SetZoomState(entity this, float z) +{ if(z != this.zoomstate) { this.zoomstate = z; @@ -1617,7 +1618,7 @@ void SpectateCopy(entity this, entity spectatee) this.fixangle = true; setorigin(this, spectatee.origin); setsize(this, spectatee.mins, spectatee.maxs); - SetZoomState(spectatee.zoomstate); + SetZoomState(this, spectatee.zoomstate); anticheat_spectatecopy(this, spectatee); this.hud = spectatee.hud; @@ -1759,8 +1760,8 @@ ShowRespawnCountdown() Update a respawn countdown display. ============= */ -void ShowRespawnCountdown() -{SELFPARAM(); +void ShowRespawnCountdown(entity this) +{ float number; if(!IS_DEAD(this)) // just respawned? return; @@ -1798,7 +1799,7 @@ void LeaveSpectatorMode(entity this) WITHSELF(this, PutClientInServer()); - if(IS_PLAYER(this)) { Send_Notification(NOTIF_ALL, world, MSG_INFO, ((teamplay && this.team != -1) ? APP_TEAM_ENT(this, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), this.netname); } + 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); } } else stuffcmd(this, "menu_showteamselect\n"); @@ -1855,8 +1856,8 @@ bool nJoinAllowed(entity this, entity ignore) * Checks whether the client is an observer or spectator, if so, he will get kicked after * g_maxplayers_spectator_blocktime seconds */ -void checkSpectatorBlock() -{SELFPARAM(); +void checkSpectatorBlock(entity this) +{ if(IS_SPEC(this) || IS_OBSERVER(this)) if(!this.caplayer) if(IS_REAL_CLIENT(this)) @@ -2005,8 +2006,8 @@ void SpectatorThink(entity this) } void vehicles_enter (entity pl, entity veh); -void PlayerUseKey() -{SELFPARAM(); +void PlayerUseKey(entity this) +{ if (!IS_PLAYER(this)) return; @@ -2024,19 +2025,19 @@ void PlayerUseKey() if(!IS_DEAD(this)) if(!gameover) { - entity head, closest_target = world; + entity head, closest_target = NULL; head = WarpZone_FindRadius(this.origin, autocvar_g_vehicles_enter_radius, true); 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) { if(closest_target) { - if(vlen(this.origin - head.origin) < vlen(this.origin - closest_target.origin)) + if(vlen2(this.origin - head.origin) < vlen2(this.origin - closest_target.origin)) { closest_target = head; } } else { closest_target = head; } @@ -2065,8 +2066,7 @@ Called every frame for each client before the physics are run .float last_vehiclecheck; .int items_added; void PlayerPreThink () -{ - SELFPARAM(); +{ENGINE_EVENT(); WarpZone_PlayerPhysics_FixVAngle(this); STAT(GAMESTARTTIME, this) = game_starttime; @@ -2084,7 +2084,7 @@ void PlayerPreThink () if (blockSpectators && frametime) { // WORKAROUND: only use dropclient in server frames (frametime set). // Never use it in cl_movement frames (frametime zero). - checkSpectatorBlock(); + checkSpectatorBlock(this); } zoomstate_set = false; @@ -2145,7 +2145,8 @@ void PlayerPreThink () { if (this.vehicle) vehicles_exit(this.vehicle, VHEF_RELEASE); - this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, this.origin, '0 0 0'); + if(this.event_damage) + this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, this.origin, '0 0 0'); } else if (this.revive_progress <= 0) Unfreeze(this); @@ -2153,26 +2154,26 @@ void PlayerPreThink () MUTATOR_CALLHOOK(PlayerPreThink, this); - if(autocvar_g_vehicles_enter) - if(time > this.last_vehiclecheck) - if(IS_PLAYER(this)) - if(!gameover) - if(!STAT(FROZEN, this)) - if(!this.vehicle) - if(!IS_DEAD(this)) + if(autocvar_g_vehicles_enter && (time > this.last_vehiclecheck) && !gameover && !this.vehicle) + if(IS_PLAYER(this) && !STAT(FROZEN, this) && !IS_DEAD(this)) { - entity veh; - for(veh = world; (veh = findflags(veh, vehicle_flags, VHF_ISVEHICLE)); ) - if(vlen(veh.origin - this.origin) < autocvar_g_vehicles_enter_radius) - if(!IS_DEAD(veh)) - if(veh.takedamage != DAMAGE_NO) - if((veh.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(veh.owner, this)) - Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER_GUNNER); - else if(!veh.owner) - if(!veh.team || SAME_TEAM(this, veh)) - Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER); - else if(autocvar_g_vehicles_steal) - Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER_STEAL); + FOREACH_ENTITY_RADIUS(this.origin, autocvar_g_vehicles_enter_radius, IS_VEHICLE(it), + { + if(!IS_DEAD(it) && it.takedamage != DAMAGE_NO) + if((it.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(it.owner, this)) + { + Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER_GUNNER); + } + else if(!it.owner) + { + if(!it.team || SAME_TEAM(this, it)) + Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER); + } + else if(autocvar_g_vehicles_steal) + { + Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER_STEAL); + } + }); this.last_vehiclecheck = time + 1; } @@ -2180,7 +2181,7 @@ void PlayerPreThink () if(!this.cvar_cl_newusekeysupported) // FIXME remove this - it was a stupid idea to begin with, we can JUST use the button { if(PHYS_INPUT_BUTTON_USE(this) && !this.usekeypressed) - PlayerUseKey(); + PlayerUseKey(this); this.usekeypressed = PHYS_INPUT_BUTTON_USE(this); } @@ -2203,17 +2204,17 @@ void PlayerPreThink () this.fixangle = true; } - if (frametime) player_powerups(); + if (frametime) player_powerups(this); if (IS_DEAD(this)) { if (this.personal && g_race_qualifying) { if (time > this.respawn_time) { STAT(RESPAWN_TIME, this) = this.respawn_time = time + 1; // only retry once a second - respawn(); + respawn(this); this.impulse = CHIMPULSE_SPEEDRUN.impulse; } } else { - if (frametime) player_anim(); + if (frametime) player_anim(this); bool button_pressed = (PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_JUMP(this) || PHYS_INPUT_BUTTON_ATCK2(this) || PHYS_INPUT_BUTTON_HOOK(this) || PHYS_INPUT_BUTTON_USE(this)); if (this.deadflag == DEAD_DYING) { @@ -2236,11 +2237,11 @@ void PlayerPreThink () if (time > this.respawn_time) { this.respawn_time = time + 1; // only retry once a second this.respawn_time_max = this.respawn_time; - respawn(); + respawn(this); } } - ShowRespawnCountdown(); + ShowRespawnCountdown(this); if (this.respawn_flags & RESPAWN_SILENT) STAT(RESPAWN_TIME, this) = 0; @@ -2309,14 +2310,14 @@ void PlayerPreThink () this.items |= this.items_added; } - player_regen(); + player_regen(this); // WEAPONTODO: Add a weapon request for this // rot vortex charge to the charge limit if (WEP_CVAR(vortex, charge_rot_rate) && this.vortex_charge > WEP_CVAR(vortex, charge_limit) && this.vortex_charge_rottime < time) this.vortex_charge = bound(WEP_CVAR(vortex, charge_limit), this.vortex_charge - WEP_CVAR(vortex, charge_rot_rate) * frametime / W_TICSPERFRAME, 1); - if (frametime) player_anim(); + if (frametime) player_anim(this); // secret status secrets_setstatus(this); @@ -2339,7 +2340,7 @@ void PlayerPreThink () // WEAPONTODO: Add weapon request for this if (!zoomstate_set) { - SetZoomState( + SetZoomState(this, PHYS_INPUT_BUTTON_ZOOM(this) || PHYS_INPUT_BUTTON_ZOOMSCRIPT(this) || (PHYS_INPUT_BUTTON_ATCK2(this) && PS(this).m_weapon == WEP_VORTEX) || (PHYS_INPUT_BUTTON_ATCK2(this) && PS(this).m_weapon == WEP_RIFLE && WEP_CVAR(rifle, secondary) == 0) @@ -2399,7 +2400,7 @@ void DrownPlayer(entity this) { // drown! if (this.pain_finished < time) { - Damage (this, world, world, autocvar_g_balance_contents_playerdamage_drowning * autocvar_g_balance_contents_damagerate, DEATH_DROWN.m_id, this.origin, '0 0 0'); + Damage (this, NULL, NULL, autocvar_g_balance_contents_playerdamage_drowning * autocvar_g_balance_contents_damagerate, DEATH_DROWN.m_id, this.origin, '0 0 0'); this.pain_finished = time + 0.5; } } @@ -2414,8 +2415,7 @@ Called every frame for each client after the physics are run */ .float idlekick_lasttimeleft; void PlayerPostThink () -{ - SELFPARAM(); +{ENGINE_EVENT(); 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)) @@ -2437,7 +2437,7 @@ void PlayerPostThink () Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_DISCONNECT_IDLING, timeleft); } if (timeleft <= 0) { - Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_KICK_IDLING, this.netname); + Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_KICK_IDLING, this.netname); dropclient(this); return; } @@ -2450,14 +2450,14 @@ void PlayerPostThink () } } - CheatFrame(); + CheatFrame(this); //CheckPlayerJump(); if (IS_PLAYER(this)) { DrownPlayer(this); CheckRules_Player(this); - UpdateChatBubble(); + UpdateChatBubble(this); if (this.impulse) ImpulseCommands(this); if (intermission_running) return; // intermission or finale GetPressedKeys(this);