]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Remove some more SELFPARAMs
authorMario <mario@smbclan.net>
Fri, 10 Jun 2016 11:58:37 +0000 (21:58 +1000)
committerMario <mario@smbclan.net>
Fri, 10 Jun 2016 11:58:37 +0000 (21:58 +1000)
13 files changed:
qcsrc/common/minigames/sv_minigames.qc
qcsrc/common/mutators/mutator/superspec/superspec.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_client.qh
qcsrc/server/command/sv_cmd.qc
qcsrc/server/g_world.qc
qcsrc/server/g_world.qh
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_domination.qc
qcsrc/server/mutators/mutator/gamemode_freezetag.qc
qcsrc/server/sv_main.qc
qcsrc/server/teamplay.qc

index 499959302ac5d7db2ce4b68102489003445f46df..50dc93010642df60d52e3a9475a20847379ee404 100644 (file)
@@ -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;
index 70898811c9d4d30bee0dbcf162a9fe0b8af46bb7..93f35f13ff93f60573dd5081554318d18a281ea4 100644 (file)
@@ -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;
index e34c85ad8403748b4dbd8a30642450897736ddab..0c29aebebd621165cdb6f3797824c7ce0d65ab12 100644 (file)
@@ -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
index 337c4db838c3e73ed0b95b60fd58658d22315cb2..65e505de30b86033a6ad031db26325a1c2ba2de2 100644 (file)
@@ -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); }
index f056f0ff2f64533954fff7a98651c6b4fc52ec27..7fbfd536b0d993efe77defd8fcbf15dac01f3cd6 100644 (file)
@@ -31,7 +31,7 @@
 #include <common/monsters/sv_monsters.qh>
 
 
-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);
                                                }
index 0b05a47c65523c0152baca53e551d74ac987bdd9..0d3de4679ad1a8597199ad418585c9ac192cfd89 100644 (file)
@@ -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;
 
index 5366d0a782129ff2cce3e1064a76c14fb877f337..e408974bbe04d3b295b2329c912815b89cb4c1f2 100644 (file)
@@ -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();
 
index 629f0ae9ce29d53022667b9ef3a706ce3b7b154f..1e2cd69eee2cbbbfb03522e97b03f619cea6fbad 100644 (file)
@@ -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);
 }
index 366011b2971b50f12e2683315bb21556707d057f..a2e90dda309a23d6940d45e108dd7819591040ab 100644 (file)
@@ -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);  }
 
 
 // ==============
index dca3e484aeb97f5cfae4a80f61eb0aa664d9badb..01c5e4bd827041c26779e972d4c70674b6d4717b 100644 (file)
@@ -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;
index d8d25091126ab58f50b3dd9c512cb9fdc09ee061..e58dbd8b75d61187def0819c363c3b51af2606f4 100644 (file)
@@ -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;
index b33b96db1b2cb02cd24af7205b5e005d82ec406f..0c1cc66767c62a970c3f5764f36919fe2ea5f1c2 100644 (file)
@@ -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 != "")
index f23385ce0080ecc13b7fe6ef4ea5d272455bdece..945e7333be37c6e3e5b6b144a93d3f1e732b9867 100644 (file)
@@ -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