]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/mutator/gamemode_domination.qc
Kill the ret_string global
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator / gamemode_domination.qc
index 3a32c203140d754cc97eed98aefd38f1af99600d..dca3e484aeb97f5cfae4a80f61eb0aa664d9badb 100644 (file)
@@ -150,8 +150,7 @@ void dompoint_captured ()
        old_team = self.team;
        self.team = real_team;
        self.delay = 0;
-       activator = self;
-       SUB_UseTargets ();
+       SUB_UseTargets (self, self, NULL);
        self.delay = old_delay;
        self.team = old_team;
 
@@ -208,8 +207,8 @@ void AnimateDomPoint()
                self.frame = 0;
 }
 
-void dompointthink()
-{SELFPARAM();
+void dompointthink(entity this)
+{
        float fragamt;
 
        self.nextthink = time + 0.1;
@@ -252,8 +251,8 @@ void dompointthink()
        }
 }
 
-void dompointtouch()
-{SELFPARAM();
+void dompointtouch(entity this)
+{
        entity head;
        if (!IS_PLAYER(other))
                return;
@@ -307,8 +306,6 @@ void dompointtouch()
        dompoint_captured();
 }
 
-void dom_controlpoint_setup(entity this);
-void dom_controlpoint_setup_self() { SELFPARAM(); dom_controlpoint_setup(this); }
 void dom_controlpoint_setup(entity this)
 {
        entity head;
@@ -351,14 +348,14 @@ void dom_controlpoint_setup(entity this)
        if(!self.t_length)
                self.t_length = 239; // maximum frame
 
-       self.think = dompointthink;
+       setthink(self, dompointthink);
        self.nextthink = time;
-       self.touch = dompointtouch;
+       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();
+       droptofloor(self);
 
        waypoint_spawnforitem(self);
        WaypointSprite_SpawnFixed(WP_DomNeut, self.origin + '0 0 32', self, sprite, RADARICON_DOMPOINT);
@@ -471,8 +468,8 @@ void havocbot_role_dom(entity this)
 MUTATOR_HOOKFUNCTION(dom, GetTeamCount)
 {
        // fallback?
-       ret_float = domination_teams;
-       ret_string = "dom_team";
+       M_ARGV(0, float) = domination_teams;
+       string ret_string = "dom_team";
 
        entity head = find(world, classname, ret_string);
        while(head)
@@ -491,44 +488,48 @@ MUTATOR_HOOKFUNCTION(dom, GetTeamCount)
                head = find(head, classname, ret_string);
        }
 
-       ret_string = string_null;
+       M_ARGV(1, string) = string_null;
 
        return true;
 }
 
 MUTATOR_HOOKFUNCTION(dom, reset_map_players)
-{SELFPARAM();
+{
        total_pps = 0, pps_red = 0, pps_blue = 0, pps_yellow = 0, pps_pink = 0;
        FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
-               setself(it);
-               PutClientInServer();
+               WITHSELF(it, PutClientInServer());
                if(domination_roundbased)
-                       self.player_blocked = 1;
-               if(IS_REAL_CLIENT(self))
-                       set_dom_state(self);
+                       it.player_blocked = 1;
+               if(IS_REAL_CLIENT(it))
+                       set_dom_state(it);
        ));
        return 1;
 }
 
 MUTATOR_HOOKFUNCTION(dom, PlayerSpawn)
-{SELFPARAM();
+{
+       entity player = M_ARGV(0, entity);
+
        if(domination_roundbased)
        if(!round_handler_IsRoundStarted())
-               self.player_blocked = 1;
+               player.player_blocked = 1;
        else
-               self.player_blocked = 0;
+               player.player_blocked = 0;
        return false;
 }
 
 MUTATOR_HOOKFUNCTION(dom, ClientConnect)
-{SELFPARAM();
-       set_dom_state(self);
-       return false;
+{
+       entity player = M_ARGV(0, entity);
+
+       set_dom_state(player);
 }
 
 MUTATOR_HOOKFUNCTION(dom, HavocBot_ChooseRole)
-{SELFPARAM();
-       self.havocbot_role = havocbot_role_dom;
+{
+       entity bot = M_ARGV(0, entity);
+
+       bot.havocbot_role = havocbot_role_dom;
        return true;
 }
 
@@ -539,19 +540,19 @@ spawnfunc(dom_controlpoint)
 {
        if(!g_domination)
        {
-               remove(self);
+               remove(this);
                return;
        }
-       self.think = dom_controlpoint_setup_self;
-       self.nextthink = time + 0.1;
-       self.reset = dom_controlpoint_setup;
+       setthink(this, dom_controlpoint_setup);
+       this.nextthink = time + 0.1;
+       this.reset = dom_controlpoint_setup;
 
-       if(!self.scale)
-               self.scale = 0.6;
+       if(!this.scale)
+               this.scale = 0.6;
 
-       self.effects = self.effects | EF_LOWPRECISION;
+       this.effects = this.effects | EF_LOWPRECISION;
        if (autocvar_g_domination_point_fullbright)
-               self.effects |= EF_FULLBRIGHT;
+               this.effects |= EF_FULLBRIGHT;
 }
 
 /*QUAKED spawnfunc_dom_team (0 .5 .8) (-32 -32 -24) (32 32 32)
@@ -584,23 +585,23 @@ spawnfunc(dom_team)
 {
        if(!g_domination || autocvar_g_domination_teams_override >= 2)
        {
-               remove(self);
+               remove(this);
                return;
        }
-       precache_model(self.model);
-       if (self.noise != "")
-               precache_sound(self.noise);
-       if (self.noise1 != "")
-               precache_sound(self.noise1);
-       self.classname = "dom_team";
-       _setmodel(self, self.model); // precision not needed
-       self.mdl = self.model;
-       self.dmg = self.modelindex;
-       self.model = "";
-       self.modelindex = 0;
+       precache_model(this.model);
+       if (this.noise != "")
+               precache_sound(this.noise);
+       if (this.noise1 != "")
+               precache_sound(this.noise1);
+       this.classname = "dom_team";
+       _setmodel(this, this.model); // precision not needed
+       this.mdl = this.model;
+       this.dmg = this.modelindex;
+       this.model = "";
+       this.modelindex = 0;
        // this would have to be changed if used in quakeworld
-       if(self.cnt)
-               self.team = self.cnt + 1; // WHY are these different anyway?
+       if(this.cnt)
+               this.team = this.cnt + 1; // WHY are these different anyway?
 }
 
 // scoreboard setup
@@ -631,41 +632,37 @@ void ScoreRules_dom(float teams)
 
 // code from here on is just to support maps that don't have control point and team entities
 void dom_spawnteam (string teamname, float teamcolor, string pointmodel, float pointskin, Sound capsound, string capnarration, string capmessage)
-{SELFPARAM();
+{
     TC(Sound, capsound);
-       setself(spawn());
-       self.classname = "dom_team";
-       self.netname = strzone(teamname);
-       self.cnt = teamcolor;
-       self.model = pointmodel;
-       self.skin = pointskin;
-       self.noise = strzone(Sound_fixpath(capsound));
-       self.noise1 = strzone(capnarration);
-       self.message = strzone(capmessage);
+    entity e = new_pure(dom_team);
+       e.netname = strzone(teamname);
+       e.cnt = teamcolor;
+       e.model = pointmodel;
+       e.skin = pointskin;
+       e.noise = strzone(Sound_fixpath(capsound));
+       e.noise1 = strzone(capnarration);
+       e.message = strzone(capmessage);
 
        // this code is identical to spawnfunc_dom_team
-       _setmodel(self, self.model); // precision not needed
-       self.mdl = self.model;
-       self.dmg = self.modelindex;
-       self.model = "";
-       self.modelindex = 0;
+       _setmodel(e, e.model); // precision not needed
+       e.mdl = e.model;
+       e.dmg = e.modelindex;
+       e.model = "";
+       e.modelindex = 0;
        // this would have to be changed if used in quakeworld
-       self.team = self.cnt + 1;
+       e.team = e.cnt + 1;
 
-       //eprint(self);
-       setself(this);
+       //eprint(e);
 }
 
-void self_spawnfunc_dom_controlpoint() { SELFPARAM(); spawnfunc_dom_controlpoint(self); }
 void dom_spawnpoint(vector org)
-{SELFPARAM();
-       setself(spawn());
-       self.classname = "dom_controlpoint";
-       self.think = self_spawnfunc_dom_controlpoint;
-       self.nextthink = time;
-       setorigin(self, org);
-       spawnfunc_dom_controlpoint(this);
-       setself(this);
+{
+       entity e = spawn();
+       e.classname = "dom_controlpoint";
+       setthink(e, spawnfunc_dom_controlpoint);
+       e.nextthink = time;
+       setorigin(e, org);
+       spawnfunc_dom_controlpoint(e);
 }
 
 // spawn some default teams if the map is not set up for domination