From 7ecfc8afc935fdf69b9a5f49397cfb1ad082178c Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 10 Jun 2016 21:58:37 +1000 Subject: [PATCH] Remove some more SELFPARAMs --- qcsrc/common/minigames/sv_minigames.qc | 2 +- .../mutators/mutator/superspec/superspec.qc | 2 +- qcsrc/server/cl_client.qc | 97 ++++---- qcsrc/server/cl_client.qh | 2 +- qcsrc/server/command/sv_cmd.qc | 6 +- qcsrc/server/g_world.qc | 22 +- qcsrc/server/g_world.qh | 4 +- qcsrc/server/miscfunctions.qc | 2 +- qcsrc/server/mutators/mutator/gamemode_ctf.qc | 4 +- .../mutators/mutator/gamemode_domination.qc | 218 +++++++++--------- .../mutators/mutator/gamemode_freezetag.qc | 66 +++--- qcsrc/server/sv_main.qc | 2 +- qcsrc/server/teamplay.qc | 2 +- 13 files changed, 213 insertions(+), 216 deletions(-) diff --git a/qcsrc/common/minigames/sv_minigames.qc b/qcsrc/common/minigames/sv_minigames.qc index 499959302..50dc93010 100644 --- a/qcsrc/common/minigames/sv_minigames.qc +++ b/qcsrc/common/minigames/sv_minigames.qc @@ -146,7 +146,7 @@ int minigame_addplayer(entity minigame_session, entity player) if ( !IS_OBSERVER(player) && autocvar_sv_minigames_observer ) { - WITHSELF(player, PutObserverInServer()); + PutObserverInServer(player); } if ( autocvar_sv_minigames_observer == 2 ) player.team_forced = -1; diff --git a/qcsrc/common/mutators/mutator/superspec/superspec.qc b/qcsrc/common/mutators/mutator/superspec/superspec.qc index 70898811c..93f35f13f 100644 --- a/qcsrc/common/mutators/mutator/superspec/superspec.qc +++ b/qcsrc/common/mutators/mutator/superspec/superspec.qc @@ -25,7 +25,7 @@ const float SSF_ITEMMSG = 4; bool superspec_Spectate(entity this, entity targ) { - if(Spectate(targ) == 1) + if(Spectate(this, targ) == 1) TRANSMUTE(Spectator, this); return true; diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index e34c85ad8..0c29aebeb 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -62,7 +62,7 @@ STATIC_METHOD(Client, Add, void(Client this, int _team)) WITHSELF(this, PutClientInServer()); } -void PutObserverInServer(); +void PutObserverInServer(entity this); void ClientDisconnect(); STATIC_METHOD(Client, Remove, void(Client this)) @@ -184,9 +184,8 @@ void setplayermodel(entity e, string modelname) void FixPlayermodel(entity player); /** putting a client as observer in the server */ -void PutObserverInServer() +void PutObserverInServer(entity this) { - SELFPARAM(); bool mutator_returnvalue = MUTATOR_CALLHOOK(MakePlayerObserver, this); PlayerState_detach(this); @@ -463,7 +462,7 @@ void PutClientInServer() MUTATOR_CALLHOOK(PutClientInServer, this); if (IS_OBSERVER(this)) { - PutObserverInServer(); + PutObserverInServer(this); } else if (IS_PLAYER(this)) { PlayerState_attach(this); accuracy_resend(this); @@ -778,7 +777,7 @@ void ClientKill_Now_TeamChange(entity this) { if(blockSpectators) Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime); - WITHSELF(this, PutObserverInServer()); + PutObserverInServer(this); } else WITHSELF(this, SV_ChangeTeam(this.killindicator_teamchange - 1)); @@ -1648,8 +1647,8 @@ void SpectateCopy(entity this, entity spectatee) } } -bool SpectateUpdate() -{SELFPARAM(); +bool SpectateUpdate(entity this) +{ if(!this.enemy) return false; @@ -1664,8 +1663,8 @@ bool SpectateUpdate() return true; } -bool SpectateSet() -{SELFPARAM(); +bool SpectateSet(entity this) +{ if(!IS_PLAYER(this.enemy)) return false; @@ -1675,36 +1674,36 @@ bool SpectateSet() this.movetype = MOVETYPE_NONE; accuracy_resend(this); - if(!SpectateUpdate()) - PutObserverInServer(); + if(!SpectateUpdate(this)) + PutObserverInServer(this); return true; } -void SetSpectatee(entity player, entity spectatee) +void SetSpectatee(entity this, entity spectatee) { - entity old_spectatee = player.enemy; + entity old_spectatee = this.enemy; - player.enemy = spectatee; + this.enemy = spectatee; // WEAPONTODO // these are required to fix the spectator bug with arc if(old_spectatee && old_spectatee.arc_beam) { old_spectatee.arc_beam.SendFlags |= ARC_SF_SETTINGS; } - if(player.enemy && player.enemy.arc_beam) { player.enemy.arc_beam.SendFlags |= ARC_SF_SETTINGS; } + if(this.enemy && this.enemy.arc_beam) { this.enemy.arc_beam.SendFlags |= ARC_SF_SETTINGS; } } -bool Spectate(entity pl) -{SELFPARAM(); +bool Spectate(entity this, entity pl) +{ if(MUTATOR_CALLHOOK(SpectateSet, this, pl)) return false; pl = M_ARGV(1, entity); SetSpectatee(this, pl); - return SpectateSet(); + return SpectateSet(this); } -bool SpectateNext() -{SELFPARAM(); +bool SpectateNext(entity this) +{ other = find(this.enemy, classname, STR_PLAYER); if (MUTATOR_CALLHOOK(SpectateNext, this, other)) @@ -1714,11 +1713,11 @@ bool SpectateNext() if(other) { SetSpectatee(this, other); } - return SpectateSet(); + return SpectateSet(this); } -bool SpectatePrev() -{SELFPARAM(); +bool SpectatePrev(entity this) +{ // NOTE: chain order is from the highest to the lower entnum (unlike find) other = findchain(classname, STR_PLAYER); if (!other) // no player @@ -1750,7 +1749,7 @@ bool SpectatePrev() } SetSpectatee(this, other); - return SpectateSet(); + return SpectateSet(this); } /* @@ -1779,8 +1778,8 @@ void ShowRespawnCountdown() } } -void LeaveSpectatorMode() -{SELFPARAM(); +void LeaveSpectatorMode(entity this) +{ if(this.caplayer) return; if(nJoinAllowed(this, this)) @@ -1797,7 +1796,7 @@ void LeaveSpectatorMode() Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_PREVENT_JOIN); - PutClientInServer(); + 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); } } @@ -1916,8 +1915,8 @@ void PrintWelcomeMessage(entity this) } } -void ObserverThink() -{SELFPARAM(); +void ObserverThink(entity this) +{ if ( this.impulse ) { MinigameImpulse(this, this.impulse); @@ -1930,7 +1929,7 @@ void ObserverThink() this.flags |= FL_SPAWNING; } else if(PHYS_INPUT_BUTTON_ATCK(this) && !this.version_mismatch) { this.flags &= ~FL_JUMPRELEASED; - if(SpectateNext()) { + if(SpectateNext(this)) { TRANSMUTE(Spectator, this); } } else { @@ -1944,15 +1943,15 @@ void ObserverThink() if(this.flags & FL_SPAWNING) { this.flags &= ~FL_SPAWNING; - LeaveSpectatorMode(); + LeaveSpectatorMode(this); return; } } } } -void SpectatorThink() -{SELFPARAM(); +void SpectatorThink(entity this) +{ if ( this.impulse ) { if(MinigameImpulse(this, this.impulse)) @@ -1964,29 +1963,29 @@ void SpectatorThink() this.flags |= FL_SPAWNING; } else if(PHYS_INPUT_BUTTON_ATCK(this) || this.impulse == 10 || this.impulse == 15 || this.impulse == 18 || (this.impulse >= 200 && this.impulse <= 209)) { this.flags &= ~FL_JUMPRELEASED; - if(SpectateNext()) { + if(SpectateNext(this)) { TRANSMUTE(Spectator, this); } else { TRANSMUTE(Observer, this); - PutClientInServer(); + WITHSELF(this, PutClientInServer()); } this.impulse = 0; } else if(this.impulse == 12 || this.impulse == 16 || this.impulse == 19 || (this.impulse >= 220 && this.impulse <= 229)) { this.flags &= ~FL_JUMPRELEASED; - if(SpectatePrev()) { + if(SpectatePrev(this)) { TRANSMUTE(Spectator, this); } else { TRANSMUTE(Observer, this); - PutClientInServer(); + WITHSELF(this, PutClientInServer()); } this.impulse = 0; } else if (PHYS_INPUT_BUTTON_ATCK2(this)) { this.flags &= ~FL_JUMPRELEASED; TRANSMUTE(Observer, this); - PutClientInServer(); + WITHSELF(this, PutClientInServer()); } else { - if(!SpectateUpdate()) - PutObserverInServer(); + if(!SpectateUpdate(this)) + PutObserverInServer(this); } } else { if (!(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_ATCK2(this))) { @@ -1994,12 +1993,12 @@ void SpectatorThink() if(this.flags & FL_SPAWNING) { this.flags &= ~FL_SPAWNING; - LeaveSpectatorMode(); + LeaveSpectatorMode(this); return; } } - if(!SpectateUpdate()) - PutObserverInServer(); + if(!SpectateUpdate(this)) + PutObserverInServer(this); } this.flags |= FL_CLIENT | FL_NOTARGET; @@ -2189,10 +2188,10 @@ void PlayerPreThink () PrintWelcomeMessage(this); if (IS_PLAYER(this)) { - CheckRules_Player(); + CheckRules_Player(this); if (intermission_running) { - IntermissionThink(); + IntermissionThink(this); return; } @@ -2328,14 +2327,14 @@ void PlayerPreThink () this.dmg_team = max(0, this.dmg_team - autocvar_g_teamdamage_resetspeed * frametime); } else if (gameover) { - if (intermission_running) IntermissionThink(); + if (intermission_running) IntermissionThink(this); return; } else if (IS_OBSERVER(this)) { - ObserverThink(); + ObserverThink(this); } else if (IS_SPEC(this)) { - SpectatorThink(); + SpectatorThink(this); } // WEAPONTODO: Add weapon request for this @@ -2457,7 +2456,7 @@ void PlayerPostThink () if (IS_PLAYER(this)) { DrownPlayer(this); - CheckRules_Player(); + CheckRules_Player(this); UpdateChatBubble(); if (this.impulse) ImpulseCommands(this); if (intermission_running) return; // intermission or finale diff --git a/qcsrc/server/cl_client.qh b/qcsrc/server/cl_client.qh index 337c4db83..65e505de3 100644 --- a/qcsrc/server/cl_client.qh +++ b/qcsrc/server/cl_client.qh @@ -103,7 +103,7 @@ void play_countdown(float finished, Sound samp); float CalcRotRegen(float current, float regenstable, float regenfactor, float regenlinear, float regenframetime, float rotstable, float rotfactor, float rotlinear, float rotframetime, float limit); -float Spectate(entity pl); +bool Spectate(entity this, entity pl); #define SPECTATE_COPY() [[accumulate]] void SpectateCopy(entity this, entity spectatee) #define SPECTATE_COPYFIELD(fld) SPECTATE_COPY() { this.(fld) = spectatee.(fld); } diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index f056f0ff2..7fbfd536b 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -31,7 +31,7 @@ #include -void PutObserverInServer(); +void PutObserverInServer(entity this); // ===================================================== // Server side game commands code, reworked by Samual @@ -197,7 +197,7 @@ void GameCommand_allspec(float request, float argc) int n = 0; FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA( if (it.caplayer) it.caplayer = 0; - WITHSELF(it, PutObserverInServer()); + PutObserverInServer(it); ++n; )); if (n) bprint(strcat("Successfully forced all (", ftos(n), ") players to spectate", (reason ? strcat(" for reason: '", reason, "'") : ""), ".\n")); @@ -1025,7 +1025,7 @@ void GameCommand_moveplayer(float request, float argc) if (!IS_SPEC(client) && !IS_OBSERVER(client)) { if (client.caplayer) client.caplayer = 0; - WITHSELF(client, PutObserverInServer()); + PutObserverInServer(client); successful = strcat(successful, (successful ? ", " : ""), client.netname); } diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 0b05a47c6..0d3de4679 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -1296,18 +1296,18 @@ When the player presses attack or jump, change to the next level ============ */ .float autoscreenshot; -void IntermissionThink() -{SELFPARAM(); - FixIntermissionClient(self); +void IntermissionThink(entity this) +{ + FixIntermissionClient(this); - float server_screenshot = (autocvar_sv_autoscreenshot && self.cvar_cl_autoscreenshot); - float client_screenshot = (self.cvar_cl_autoscreenshot == 2); + float server_screenshot = (autocvar_sv_autoscreenshot && this.cvar_cl_autoscreenshot); + float client_screenshot = (this.cvar_cl_autoscreenshot == 2); if( (server_screenshot || client_screenshot) - && ((self.autoscreenshot > 0) && (time > self.autoscreenshot)) ) + && ((this.autoscreenshot > 0) && (time > this.autoscreenshot)) ) { - self.autoscreenshot = -1; - if(IS_REAL_CLIENT(self)) { stuffcmd(self, sprintf("\nscreenshot screenshots/autoscreenshot/%s-%s.jpg; echo \"^5A screenshot has been taken at request of the server.\"\n", GetMapname(), strftime(false, "%s"))); } + this.autoscreenshot = -1; + if(IS_REAL_CLIENT(this)) { stuffcmd(this, sprintf("\nscreenshot screenshots/autoscreenshot/%s-%s.jpg; echo \"^5A screenshot has been taken at request of the server.\"\n", GetMapname(), strftime(false, "%s"))); } return; } @@ -1315,7 +1315,7 @@ void IntermissionThink() return; if(!mapvote_initialized) - if (time < intermission_exittime + 10 && !(PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_JUMP(self) || PHYS_INPUT_BUTTON_ATCK2(self) || PHYS_INPUT_BUTTON_HOOK(self) || PHYS_INPUT_BUTTON_USE(self))) + if (time < intermission_exittime + 10 && !(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))) return; MapVote_Start(); @@ -1579,8 +1579,8 @@ CheckRules_Player Exit deathmatch games upon conditions ============ */ -void CheckRules_Player() -{SELFPARAM(); +void CheckRules_Player(entity this) +{ if (gameover) // someone else quit the game already return; diff --git a/qcsrc/server/g_world.qh b/qcsrc/server/g_world.qh index 5366d0a78..e408974bb 100644 --- a/qcsrc/server/g_world.qh +++ b/qcsrc/server/g_world.qh @@ -15,8 +15,8 @@ void SetLimits(int fraglimit_override, int leadlimit_override, float timelimit_o float WinningCondition_Scores(float limit, float leadlimit); void SetWinners(.float field, float value); -void CheckRules_Player(); -void IntermissionThink(); +void CheckRules_Player(entity this); +void IntermissionThink(entity this); void GotoNextMap(float reinit); void ReadyRestart(); diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 629f0ae9c..1e2cd69ee 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -824,7 +824,7 @@ void make_safe_for_remove(entity e) } void objerror(string s) -{SELFPARAM(); +{SELFPARAM(); // needed for engine functions make_safe_for_remove(self); builtin_objerror(s); } diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qc b/qcsrc/server/mutators/mutator/gamemode_ctf.qc index 366011b29..a2e90dda3 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qc @@ -2549,8 +2549,8 @@ spawnfunc(info_player_team2); spawnfunc(team_CTF_blueplayer) { spawnfunc_info_player_team2(this); } spawnfunc(team_CTF_bluespawn) { spawnfunc_info_player_team2(this); } -void team_CTF_neutralflag() { SELFPARAM(); spawnfunc_item_flag_neutral(self); } -void team_neutralobelisk() { SELFPARAM(); spawnfunc_item_flag_neutral(self); } +spawnfunc(team_CTF_neutralflag) { spawnfunc_item_flag_neutral(this); } +spawnfunc(team_neutralobelisk) { spawnfunc_item_flag_neutral(this); } // ============== diff --git a/qcsrc/server/mutators/mutator/gamemode_domination.qc b/qcsrc/server/mutators/mutator/gamemode_domination.qc index dca3e484a..01c5e4bd8 100644 --- a/qcsrc/server/mutators/mutator/gamemode_domination.qc +++ b/qcsrc/server/mutators/mutator/gamemode_domination.qc @@ -96,66 +96,65 @@ void set_dom_state(entity e) e.dom_pps_pink = pps_pink; } -void dompoint_captured () -{SELFPARAM(); - entity head; +void dompoint_captured(entity this) +{ float old_delay, old_team, real_team; // now that the delay has expired, switch to the latest team to lay claim to this point - head = self.owner; + entity head = this.owner; - real_team = self.cnt; - self.cnt = -1; + real_team = this.cnt; + this.cnt = -1; - dom_EventLog("taken", self.team, self.dmg_inflictor); - self.dmg_inflictor = world; + dom_EventLog("taken", this.team, this.dmg_inflictor); + this.dmg_inflictor = world; - self.goalentity = head; - self.model = head.mdl; - self.modelindex = head.dmg; - self.skin = head.skin; + this.goalentity = head; + this.model = head.mdl; + this.modelindex = head.dmg; + this.skin = head.skin; float points, wait_time; if (autocvar_g_domination_point_amt) points = autocvar_g_domination_point_amt; else - points = self.frags; + points = this.frags; if (autocvar_g_domination_point_rate) wait_time = autocvar_g_domination_point_rate; else - wait_time = self.wait; + wait_time = this.wait; if(domination_roundbased) - bprint(sprintf("^3%s^3%s\n", head.netname, self.message)); + bprint(sprintf("^3%s^3%s\n", head.netname, this.message)); else - Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_DOMINATION_CAPTURE_TIME, head.netname, self.message, points, wait_time); + Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_DOMINATION_CAPTURE_TIME, head.netname, this.message, points, wait_time); - if(self.enemy.playerid == self.enemy_playerid) - PlayerScore_Add(self.enemy, SP_DOM_TAKES, 1); + if(this.enemy.playerid == this.enemy_playerid) + PlayerScore_Add(this.enemy, SP_DOM_TAKES, 1); else - self.enemy = world; + this.enemy = world; if (head.noise != "") - if(self.enemy) - _sound(self.enemy, CH_TRIGGER, head.noise, VOL_BASE, ATTEN_NORM); + if(this.enemy) + _sound(this.enemy, CH_TRIGGER, head.noise, VOL_BASE, ATTEN_NORM); else - _sound(self, CH_TRIGGER, head.noise, VOL_BASE, ATTEN_NORM); + _sound(this, CH_TRIGGER, head.noise, VOL_BASE, ATTEN_NORM); if (head.noise1 != "") play2all(head.noise1); - self.delay = time + wait_time; + this.delay = time + wait_time; // do trigger work - old_delay = self.delay; - old_team = self.team; - self.team = real_team; - self.delay = 0; - SUB_UseTargets (self, self, NULL); - self.delay = old_delay; - self.team = old_team; + old_delay = this.delay; + old_team = this.team; + this.team = real_team; + this.delay = 0; + SUB_UseTargets (this, this, NULL); + this.delay = old_delay; + this.team = old_team; entity msg = WP_DomNeut; - switch(self.team) + switch(this.team) { case NUM_TEAM_1: msg = WP_DomRed; break; case NUM_TEAM_2: msg = WP_DomBlue; break; @@ -163,7 +162,7 @@ void dompoint_captured () case NUM_TEAM_4: msg = WP_DomPink; break; } - WaypointSprite_UpdateSprites(self.sprite, msg, WP_Null, WP_Null); + WaypointSprite_UpdateSprites(this.sprite, msg, WP_Null, WP_Null); total_pps = 0, pps_red = 0, pps_blue = 0, pps_yellow = 0, pps_pink = 0; for(head = world; (head = find(head, classname, "dom_controlpoint")) != world; ) @@ -186,74 +185,73 @@ void dompoint_captured () total_pps += points/wait_time; )); - WaypointSprite_UpdateTeamRadar(self.sprite, RADARICON_DOMPOINT, colormapPaletteColor(self.goalentity.team - 1, 0)); - WaypointSprite_Ping(self.sprite); + WaypointSprite_UpdateTeamRadar(this.sprite, RADARICON_DOMPOINT, colormapPaletteColor(this.goalentity.team - 1, 0)); + WaypointSprite_Ping(this.sprite); - self.captime = time; + this.captime = time; FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(set_dom_state(it))); } -void AnimateDomPoint() -{SELFPARAM(); - if(self.pain_finished > time) +void AnimateDomPoint(entity this) +{ + if(this.pain_finished > time) return; - self.pain_finished = time + self.t_width; - if(self.nextthink > self.pain_finished) - self.nextthink = self.pain_finished; + this.pain_finished = time + this.t_width; + if(this.nextthink > this.pain_finished) + this.nextthink = this.pain_finished; - self.frame = self.frame + 1; - if(self.frame > self.t_length) - self.frame = 0; + this.frame = this.frame + 1; + if(this.frame > this.t_length) + this.frame = 0; } void dompointthink(entity this) { float fragamt; - self.nextthink = time + 0.1; + this.nextthink = time + 0.1; - //self.frame = self.frame + 1; - //if(self.frame > 119) - // self.frame = 0; - AnimateDomPoint(); + //this.frame = this.frame + 1; + //if(this.frame > 119) + // this.frame = 0; + AnimateDomPoint(this); // give points - if (gameover || self.delay > time || time < game_starttime) // game has ended, don't keep giving points + if (gameover || this.delay > time || time < game_starttime) // game has ended, don't keep giving points return; if(autocvar_g_domination_point_rate) - self.delay = time + autocvar_g_domination_point_rate; + this.delay = time + autocvar_g_domination_point_rate; else - self.delay = time + self.wait; + this.delay = time + this.wait; // give credit to the team // NOTE: this defaults to 0 if (!domination_roundbased) - if (self.goalentity.netname != "") + if (this.goalentity.netname != "") { if(autocvar_g_domination_point_amt) fragamt = autocvar_g_domination_point_amt; else - fragamt = self.frags; - TeamScore_AddToTeam(self.goalentity.team, ST_SCORE, fragamt); - TeamScore_AddToTeam(self.goalentity.team, ST_DOM_TICKS, fragamt); + fragamt = this.frags; + TeamScore_AddToTeam(this.goalentity.team, ST_SCORE, fragamt); + TeamScore_AddToTeam(this.goalentity.team, ST_DOM_TICKS, fragamt); // give credit to the individual player, if he is still there - if (self.enemy.playerid == self.enemy_playerid) + if (this.enemy.playerid == this.enemy_playerid) { - PlayerScore_Add(self.enemy, SP_SCORE, fragamt); - PlayerScore_Add(self.enemy, SP_DOM_TICKS, fragamt); + PlayerScore_Add(this.enemy, SP_SCORE, fragamt); + PlayerScore_Add(this.enemy, SP_DOM_TICKS, fragamt); } else - self.enemy = world; + this.enemy = world; } } void dompointtouch(entity this) { - entity head; if (!IS_PLAYER(other)) return; if (other.health < 1) @@ -262,28 +260,28 @@ void dompointtouch(entity this) if(round_handler_IsActive() && !round_handler_IsRoundStarted()) return; - if(time < self.captime + 0.3) + if(time < this.captime + 0.3) return; // only valid teams can claim it - head = find(world, classname, "dom_team"); + entity head = find(world, classname, "dom_team"); while (head && head.team != other.team) head = find(head, classname, "dom_team"); - if (!head || head.netname == "" || head == self.goalentity) + if (!head || head.netname == "" || head == this.goalentity) return; // delay capture - self.team = self.goalentity.team; // this stores the PREVIOUS team! + this.team = this.goalentity.team; // this stores the PREVIOUS team! - self.cnt = other.team; - self.owner = head; // team to switch to after the delay - self.dmg_inflictor = other; + this.cnt = other.team; + this.owner = head; // team to switch to after the delay + this.dmg_inflictor = other; - // self.state = 1; - // self.delay = time + cvar("g_domination_point_capturetime"); - //self.nextthink = time + cvar("g_domination_point_capturetime"); - //self.think = dompoint_captured; + // this.state = 1; + // this.delay = time + cvar("g_domination_point_capturetime"); + //this.nextthink = time + cvar("g_domination_point_capturetime"); + //this.think = dompoint_captured; // go to neutral team in the mean time head = find(world, classname, "dom_team"); @@ -292,18 +290,18 @@ void dompointtouch(entity this) if(head == world) return; - WaypointSprite_UpdateSprites(self.sprite, WP_DomNeut, WP_Null, WP_Null); - WaypointSprite_UpdateTeamRadar(self.sprite, RADARICON_DOMPOINT, '0 1 1'); - WaypointSprite_Ping(self.sprite); + WaypointSprite_UpdateSprites(this.sprite, WP_DomNeut, WP_Null, WP_Null); + WaypointSprite_UpdateTeamRadar(this.sprite, RADARICON_DOMPOINT, '0 1 1'); + WaypointSprite_Ping(this.sprite); - self.goalentity = head; - self.model = head.mdl; - self.modelindex = head.dmg; - self.skin = head.skin; + this.goalentity = head; + this.model = head.mdl; + this.modelindex = head.dmg; + this.skin = head.skin; - self.enemy = other; // individual player scoring - self.enemy_playerid = other.playerid; - dompoint_captured(); + this.enemy = other; // individual player scoring + this.enemy_playerid = other.playerid; + dompoint_captured(this); } void dom_controlpoint_setup(entity this) @@ -317,48 +315,48 @@ void dom_controlpoint_setup(entity this) objerror("no spawnfunc_dom_team with netname \"\" found\n"); // copy important properties from spawnfunc_dom_team entity - self.goalentity = head; - _setmodel(self, head.mdl); // precision already set - self.skin = head.skin; + this.goalentity = head; + _setmodel(this, head.mdl); // precision already set + this.skin = head.skin; - self.cnt = -1; + this.cnt = -1; - if(self.message == "") - self.message = " has captured a control point"; + if(this.message == "") + this.message = " has captured a control point"; - if(self.frags <= 0) - self.frags = 1; - if(self.wait <= 0) - self.wait = 5; + if(this.frags <= 0) + this.frags = 1; + if(this.wait <= 0) + this.wait = 5; float points, waittime; if (autocvar_g_domination_point_amt) points = autocvar_g_domination_point_amt; else - points = self.frags; + points = this.frags; if (autocvar_g_domination_point_rate) waittime = autocvar_g_domination_point_rate; else - waittime = self.wait; + waittime = this.wait; total_pps += points/waittime; - if(!self.t_width) - self.t_width = 0.02; // frame animation rate - if(!self.t_length) - self.t_length = 239; // maximum frame - - setthink(self, dompointthink); - self.nextthink = time; - settouch(self, dompointtouch); - self.solid = SOLID_TRIGGER; - self.flags = FL_ITEM; - setsize(self, '-32 -32 -32', '32 32 32'); - setorigin(self, self.origin + '0 0 20'); - droptofloor(self); - - waypoint_spawnforitem(self); - WaypointSprite_SpawnFixed(WP_DomNeut, self.origin + '0 0 32', self, sprite, RADARICON_DOMPOINT); + if(!this.t_width) + this.t_width = 0.02; // frame animation rate + if(!this.t_length) + this.t_length = 239; // maximum frame + + setthink(this, dompointthink); + this.nextthink = time; + settouch(this, dompointtouch); + this.solid = SOLID_TRIGGER; + this.flags = FL_ITEM; + setsize(this, '-32 -32 -32', '32 32 32'); + setorigin(this, this.origin + '0 0 20'); + droptofloor(this); + + waypoint_spawnforitem(this); + WaypointSprite_SpawnFixed(WP_DomNeut, this.origin + '0 0 32', this, sprite, RADARICON_DOMPOINT); } float total_controlpoints; diff --git a/qcsrc/server/mutators/mutator/gamemode_freezetag.qc b/qcsrc/server/mutators/mutator/gamemode_freezetag.qc index d8d250911..e58dbd8b7 100644 --- a/qcsrc/server/mutators/mutator/gamemode_freezetag.qc +++ b/qcsrc/server/mutators/mutator/gamemode_freezetag.qc @@ -184,13 +184,13 @@ float freezetag_CheckWinner() return 1; } -entity freezetag_LastPlayerForTeam() -{SELFPARAM(); +entity freezetag_LastPlayerForTeam(entity this) +{ entity last_pl = world; - FOREACH_CLIENT(IS_PLAYER(it) && it != self, LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it) && it != this, LAMBDA( if(it.health >= 1) if(!STAT(FROZEN, it)) - if(SAME_TEAM(it, self)) + if(SAME_TEAM(it, this)) if(!last_pl) last_pl = it; else @@ -199,56 +199,56 @@ entity freezetag_LastPlayerForTeam() return last_pl; } -void freezetag_LastPlayerForTeam_Notify() +void freezetag_LastPlayerForTeam_Notify(entity this) { if(round_handler_IsActive()) if(round_handler_IsRoundStarted()) { - entity pl = freezetag_LastPlayerForTeam(); + entity pl = freezetag_LastPlayerForTeam(this); if(pl) Send_Notification(NOTIF_ONE, pl, MSG_CENTER, CENTER_ALONE); } } -void freezetag_Add_Score(entity attacker) -{SELFPARAM(); - if(attacker == self) +void freezetag_Add_Score(entity targ, entity attacker) +{ + if(attacker == targ) { - // you froze your own dumb self + // you froze your own dumb targ // counted as "suicide" already - PlayerScore_Add(self, SP_SCORE, -1); + PlayerScore_Add(targ, SP_SCORE, -1); } else if(IS_PLAYER(attacker)) { // got frozen by an enemy // counted as "kill" and "death" already - PlayerScore_Add(self, SP_SCORE, -1); + PlayerScore_Add(targ, SP_SCORE, -1); PlayerScore_Add(attacker, SP_SCORE, +1); } // else nothing - got frozen by the game type rules themselves } -void freezetag_Freeze(entity attacker) -{SELFPARAM(); - if(STAT(FROZEN, self)) +void freezetag_Freeze(entity targ, entity attacker) +{ + if(STAT(FROZEN, targ)) return; if(autocvar_g_freezetag_frozen_maxtime > 0) - self.freezetag_frozen_timeout = time + autocvar_g_freezetag_frozen_maxtime; + targ.freezetag_frozen_timeout = time + autocvar_g_freezetag_frozen_maxtime; - Freeze(self, 0, 1, true); + Freeze(targ, 0, 1, true); freezetag_count_alive_players(); - freezetag_Add_Score(attacker); + freezetag_Add_Score(targ, attacker); } -void freezetag_Unfreeze(entity attacker) -{SELFPARAM(); - self.freezetag_frozen_time = 0; - self.freezetag_frozen_timeout = 0; +void freezetag_Unfreeze(entity this) +{ + this.freezetag_frozen_time = 0; + this.freezetag_frozen_timeout = 0; - Unfreeze(self); + Unfreeze(this); } float freezetag_isEliminated(entity e) @@ -356,8 +356,8 @@ void ft_RemovePlayer(entity this) { this.health = 0; // neccessary to update correctly alive stats if(!STAT(FROZEN, this)) - freezetag_LastPlayerForTeam_Notify(); - WITHSELF(this, freezetag_Unfreeze(world)); + freezetag_LastPlayerForTeam_Notify(this); + freezetag_Unfreeze(this); freezetag_count_alive_players(); } @@ -387,7 +387,7 @@ MUTATOR_HOOKFUNCTION(ft, PlayerDies) if(round_handler_CountdownRunning()) { if(STAT(FROZEN, frag_target)) - WITHSELF(frag_target, freezetag_Unfreeze(world)); + freezetag_Unfreeze(frag_target); freezetag_count_alive_players(); return 1; // let the player die so that he can respawn whenever he wants } @@ -400,12 +400,12 @@ MUTATOR_HOOKFUNCTION(ft, PlayerDies) // let the player die, he will be automatically frozen when he respawns if(STAT(FROZEN, frag_target) != 1) { - freezetag_Add_Score(frag_attacker); + freezetag_Add_Score(frag_target, frag_attacker); freezetag_count_alive_players(); - freezetag_LastPlayerForTeam_Notify(); + freezetag_LastPlayerForTeam_Notify(frag_target); } else - WITHSELF(frag_target, freezetag_Unfreeze(world)); // remove ice + freezetag_Unfreeze(frag_target); // remove ice frag_target.health = 0; // Unfreeze resets health frag_target.freezetag_frozen_timeout = -2; // freeze on respawn return 1; @@ -414,8 +414,8 @@ MUTATOR_HOOKFUNCTION(ft, PlayerDies) if(STAT(FROZEN, frag_target)) return 1; - WITHSELF(frag_target, freezetag_Freeze(frag_attacker)); - freezetag_LastPlayerForTeam_Notify(); + freezetag_Freeze(frag_target, frag_attacker); + freezetag_LastPlayerForTeam_Notify(frag_target); if(frag_attacker == frag_target || frag_attacker == world) { @@ -444,7 +444,7 @@ MUTATOR_HOOKFUNCTION(ft, PlayerSpawn) if(player.freezetag_frozen_timeout == -2) // player was dead { - WITHSELF(player, freezetag_Freeze(world)); + freezetag_Freeze(player, world); return 1; } @@ -454,7 +454,7 @@ MUTATOR_HOOKFUNCTION(ft, PlayerSpawn) if(round_handler_IsRoundStarted()) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_SPAWN_LATE); - WITHSELF(player, freezetag_Freeze(world)); + freezetag_Freeze(player, world); } return 1; diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index b33b96db1..0c1cc6676 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -238,7 +238,7 @@ void StartFrame() .string cvarfilter; bool DoesQ3ARemoveThisEntity(entity this); void SV_OnEntityPreSpawnFunction() -{SELFPARAM(); +{SELFPARAM(); // needed for engine functions __spawnfunc_expect = this; if (this) if (this.gametypefilter != "") diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index f23385ce0..945e7333b 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -560,7 +560,7 @@ int JoinBestTeam(entity this, bool only_return_best, bool forcebestteam) //void() ctf_playerchanged; void SV_ChangeTeam(float _color) -{SELFPARAM(); +{SELFPARAM(); // needed for engine functions float scolor, dcolor, steam, dteam; //, dbotcount, scount, dcount; // in normal deathmatch we can just apply the color and we're done -- 2.39.2