]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'Mario/use1' into 'master'
authorMario <zacjardine@y7mail.com>
Sat, 30 Apr 2016 07:24:03 +0000 (07:24 +0000)
committerMario <zacjardine@y7mail.com>
Sat, 30 Apr 2016 07:24:03 +0000 (07:24 +0000)
Merge branch Mario/use1 (XL merge request)

Cleans out the use of self from .use, a necessary step towards supporting the Daemon engine and NaCl.

See merge request !298

88 files changed:
qcsrc/client/commands/cl_cmd.qc
qcsrc/client/main.qc
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/common/minigames/cl_minigames.qc
qcsrc/common/minigames/cl_minigames.qh
qcsrc/common/minigames/cl_minigames_hud.qc
qcsrc/common/monsters/monster/shambler.qc
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/overkill/rpc.qc
qcsrc/common/t_items.qc
qcsrc/common/t_items.qh
qcsrc/common/triggers/func/breakable.qc
qcsrc/common/triggers/func/button.qc
qcsrc/common/triggers/func/conveyor.qc
qcsrc/common/triggers/func/door.qc
qcsrc/common/triggers/func/door_secret.qc
qcsrc/common/triggers/func/pointparticles.qc
qcsrc/common/triggers/func/rotating.qc
qcsrc/common/triggers/func/train.qc
qcsrc/common/triggers/misc/laser.qc
qcsrc/common/triggers/platforms.qc
qcsrc/common/triggers/platforms.qh
qcsrc/common/triggers/subs.qc
qcsrc/common/triggers/subs.qh
qcsrc/common/triggers/target/changelevel.qc
qcsrc/common/triggers/target/music.qc
qcsrc/common/triggers/target/spawn.qc
qcsrc/common/triggers/target/speaker.qc
qcsrc/common/triggers/target/voicescript.qc
qcsrc/common/triggers/teleporters.qh
qcsrc/common/triggers/trigger/counter.qc
qcsrc/common/triggers/trigger/delay.qc
qcsrc/common/triggers/trigger/disablerelay.qc
qcsrc/common/triggers/trigger/flipflop.qc
qcsrc/common/triggers/trigger/gamestart.qc
qcsrc/common/triggers/trigger/gravity.qc
qcsrc/common/triggers/trigger/hurt.qc
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/triggers/trigger/jumppads.qh
qcsrc/common/triggers/trigger/keylock.qc
qcsrc/common/triggers/trigger/magicear.qc
qcsrc/common/triggers/trigger/monoflop.qc
qcsrc/common/triggers/trigger/multi.qc
qcsrc/common/triggers/trigger/multivibrator.qc
qcsrc/common/triggers/trigger/relay_activators.qc
qcsrc/common/triggers/trigger/relay_if.qc
qcsrc/common/triggers/trigger/relay_teamcheck.qc
qcsrc/common/triggers/trigger/teleport.qc
qcsrc/common/triggers/triggers.qc
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/turrets/turret/ewheel.qc
qcsrc/common/turrets/turret/walker.qc
qcsrc/common/util.qh
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/vehicle/racer_weapon.qc
qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/fireball.qc
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/common/weapons/weapon/hook.qc
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/dpdefs/csprogsdefs.qh
qcsrc/dpdefs/progsdefs.qh
qcsrc/lib/self.qh
qcsrc/lib/warpzone/server.qc
qcsrc/server/cheats.qc
qcsrc/server/cl_client.qc
qcsrc/server/defs.qh
qcsrc/server/g_lights.qc
qcsrc/server/g_models.qc
qcsrc/server/g_subs.qh
qcsrc/server/item_key.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/miscfunctions.qh
qcsrc/server/mutators/mutator/gamemode_assault.qc
qcsrc/server/mutators/mutator/gamemode_domination.qc
qcsrc/server/race.qc
qcsrc/server/spawnpoints.qc
qcsrc/server/spawnpoints.qh
qcsrc/server/weapons/common.qc
qcsrc/server/weapons/common.qh

index 6dadff2f3cb8e610b2fd81bfbd78f77807557614..45444c8791ef50f20157d428e8341e0e146936a5 100644 (file)
@@ -252,7 +252,7 @@ void QuickMenu_Close();
 bool QuickMenu_Open(string mode, string submenu);
 
 bool HUD_MinigameMenu_IsOpened();
-void HUD_MinigameMenu_Close();
+void HUD_MinigameMenu_Close(entity this, entity actor, entity trigger);
 void HUD_MinigameMenu_Open();
 
 void HUD_Radar_Show_Maximized(bool doshow, bool clickable);
index 98b266c6d18410a39a466a66b77b452ee10a9ef5..7cbe6e125f14c5c7642bf8b3c039f4df2dc7ac70 100644 (file)
@@ -213,7 +213,7 @@ void Shutdown()
        }
 
        deactivate_minigame();
-       HUD_MinigameMenu_Close();
+       HUD_MinigameMenu_Close(NULL, NULL, NULL);
 }
 
 .float has_team;
index 95c789841dfeb9828f280953d458c657fc066962..bb302998f2e9c6c8daeb19e08562987126a11153 100644 (file)
@@ -546,10 +546,7 @@ void ons_ControlPoint_Icon_Damage(entity this, entity inflictor, entity attacker
                onslaught_updatelinks();
 
                // Use targets now (somebody make sure this is in the right place..)
-               setself(this.owner);
-               activator = this;
-               WITHSELF(this, SUB_UseTargets());
-               setself(this);
+               SUB_UseTargets(this.owner, this, NULL);
 
                this.owner.waslinked = this.owner.islinked;
                if(this.owner.model != "models/onslaught/controlpoint_pad.md3")
@@ -611,10 +608,7 @@ void ons_ControlPoint_Icon_Think()
                if(!self.owner.islinked)
                        self.owner.team = 0;
 
-               setself(self.owner);
-               activator = self;
-               SUB_UseTargets ();
-               setself(this);
+               SUB_UseTargets(self.owner, self, NULL);
 
                self.owner.team = t;
 
@@ -676,10 +670,7 @@ void ons_ControlPoint_Icon_BuildThink()
                onslaught_updatelinks();
 
                // Use targets now (somebody make sure this is in the right place..)
-               setself(self.owner);
-               activator = self;
-               SUB_UseTargets ();
-               setself(this);
+               SUB_UseTargets(self.owner, self, NULL);
 
                self.SendFlags |= CPSF_SETUP;
        }
@@ -849,8 +840,7 @@ void ons_ControlPoint_Reset(entity this)
 
        onslaught_updatelinks();
 
-       activator = this;
-       SUB_UseTargets(); // to reset the structures, playerspawns etc.
+       SUB_UseTargets(this, this, NULL); // to reset the structures, playerspawns etc.
 
        CSQCMODEL_AUTOUPDATE(this);
 }
@@ -1953,23 +1943,22 @@ MUTATOR_HOOKFUNCTION(ons, MonsterMove)
 
 void ons_MonsterSpawn_Delayed(entity this)
 {
-       entity e, own = self.owner;
+       entity own = self.owner;
 
-       if(!own) { remove(self); return; }
+       if(!own) { remove(this); return; }
 
        if(own.targetname)
        {
-               e = find(world, target, own.targetname);
+               entity e = find(world, target, own.targetname);
                if(e != world)
                {
                        own.team = e.team;
 
-                       activator = e;
-                       own.use();
+                       own.use(own, e, NULL);
                }
        }
 
-       remove(self);
+       remove(this);
 }
 
 MUTATOR_HOOKFUNCTION(ons, MonsterSpawn)
@@ -1983,20 +1972,19 @@ MUTATOR_HOOKFUNCTION(ons, MonsterSpawn)
 
 void ons_TurretSpawn_Delayed(entity this)
 {
-       entity e, own = self.owner;
+       entity own = self.owner;
 
        if(!own) { remove(self); return; }
 
        if(own.targetname)
        {
-               e = find(world, target, own.targetname);
+               entity e = find(world, target, own.targetname);
                if(e != world)
                {
                        own.team = e.team;
                        own.active = ACTIVE_NOT;
 
-                       activator = e;
-                       own.use();
+                       own.use(own, e, NULL);
                }
        }
 
index 6f7e7c3ae9466cd83d0c4f45dc765efc8e2a9e0a..f080e90d068cd666bc9d471c8041061ec0084d9c 100644 (file)
@@ -98,7 +98,7 @@ void deactivate_minigame()
 
        if ( auto_close_minigamemenu )
        {
-               HUD_MinigameMenu_Close();
+               HUD_MinigameMenu_Close(NULL, NULL, NULL);
                auto_close_minigamemenu = 0;
        }
        else
@@ -393,7 +393,7 @@ MUTATOR_HOOKFUNCTION(minigames, HUD_Command)
        if(argv(1) == "minigame")
        {
                if (HUD_MinigameMenu_IsOpened())
-                       HUD_MinigameMenu_Close();
+                       HUD_MinigameMenu_Close(NULL, NULL, NULL);
                else
                        HUD_MinigameMenu_Open();
                return true;
index e3c7df18f34f778c58f1ba6d911d4711a6367d7e..4359dba22630ae9e5ec93236ace5a31645962401 100644 (file)
@@ -100,7 +100,7 @@ void minigame_cmd_workaround(float dummy, string...cmdargc);
 void minigame_prompt();
 
 float HUD_MinigameMenu_IsOpened();
-void HUD_MinigameMenu_Close();
+void HUD_MinigameMenu_Close(entity this, entity actor, entity trigger);
 float HUD_Minigame_Showpanels();
 // Adds a game-specific entry to the menu
 void HUD_MinigameMenu_CustomEntry(entity parent, string message, string event_arg);
index ca2a0ed17c9234e306d03b4cabce5910cf9d79f8..56cae3c228867df92a9ee7d39fd9c5957cf68826 100644 (file)
@@ -112,10 +112,10 @@ entity HUD_MinigameMenu_activeitem;
 
 // Click the given item
 void HUD_MinigameMenu_Click(entity menuitem)
-{SELFPARAM();
+{
        if ( menuitem )
        {
-               WITHSELF(menuitem, menuitem.use());
+               menuitem.use(menuitem, NULL, NULL);
        }
 }
 
@@ -146,7 +146,7 @@ void HUD_MinigameMenu_EraseEntry ( entity e )
 }
 
 // Minigame menu options: create entry
-entity HUD_MinigameMenu_SpawnEntry(string s, vector offset, vector fontsize, vector color,void() click)
+entity HUD_MinigameMenu_SpawnEntry(string s, vector offset, vector fontsize, vector color,void(entity, entity, entity) click)
 {
        entity entry = spawn();
        entry.message = s;
@@ -160,7 +160,7 @@ entity HUD_MinigameMenu_SpawnEntry(string s, vector offset, vector fontsize, vec
 }
 
 // Spawn a child entry of a collapsable entry
-entity HUD_MinigameMenu_SpawnSubEntry(string s, void() click, entity parent)
+entity HUD_MinigameMenu_SpawnSubEntry(string s, void(entity, entity, entity) click, entity parent)
 {
        vector item_fontsize = hud_fontsize*1.25;
        vector item_offset = '1 0 0' * item_fontsize_x;
@@ -171,43 +171,43 @@ entity HUD_MinigameMenu_SpawnSubEntry(string s, void() click, entity parent)
 }
 
 // Click action for Create sub-entries
-void HUD_MinigameMenu_ClickCreate_Entry()
-{SELFPARAM();
-       minigame_cmd("create ",self.netname);
+void HUD_MinigameMenu_ClickCreate_Entry(entity this, entity actor, entity trigger)
+{
+       minigame_cmd("create ", this.netname);
 }
 
 // Helper click action for collapsible entries
 // returns true when you have to create the sub-entries
-bool HUD_MinigameMenu_Click_ExpandCollapse()
-{SELFPARAM();
+bool HUD_MinigameMenu_Click_ExpandCollapse(entity this)
+{
        entity e;
-       if ( self.flags & 2 )
+       if ( this.flags & 2 )
        {
                if ( HUD_MinigameMenu_activeitem &&
-                               HUD_MinigameMenu_activeitem.owner == self )
+                               HUD_MinigameMenu_activeitem.owner == this )
                        HUD_MinigameMenu_activeitem = world;
-               self.flags &= ~2;
-               for ( e = self.list_next; e != world && e.owner == self; e = self.list_next )
+               this.flags &= ~2;
+               for ( e = this.list_next; e != world && e.owner == this; e = this.list_next )
                {
                        if ( e.flags & 2 )
                                HUD_MinigameMenu_Click(e);
-                       self.list_next = e.list_next;
+                       this.list_next = e.list_next;
                        remove(e);
                }
-               if ( self.list_next )
-                       self.list_next.list_prev = self;
+               if ( this.list_next )
+                       this.list_next.list_prev = this;
                else
-                       HUD_MinigameMenu_last_entry = self;
+                       HUD_MinigameMenu_last_entry = this;
        }
        else
        {
                for ( e = HUD_MinigameMenu_entries; e != world; e = e.list_next )
                {
-                       if ( e.flags & 2 && e.origin_x == self.origin_x)
+                       if ( e.flags & 2 && e.origin_x == this.origin_x)
                                HUD_MinigameMenu_Click(e);
                }
 
-               self.flags |= 2;
+               this.flags |= 2;
 
                return true;
        }
@@ -215,14 +215,14 @@ bool HUD_MinigameMenu_Click_ExpandCollapse()
 }
 
 // Click action for the Create menu
-void HUD_MinigameMenu_ClickCreate()
-{SELFPARAM();
-       if ( HUD_MinigameMenu_Click_ExpandCollapse() )
+void HUD_MinigameMenu_ClickCreate(entity this, entity actor, entity trigger)
+{
+       if ( HUD_MinigameMenu_Click_ExpandCollapse(this) )
        {
                entity curr;
-               entity prev = self;
+               entity prev = this;
                FOREACH(Minigames, true, {
-                       curr = HUD_MinigameMenu_SpawnSubEntry(it.message, HUD_MinigameMenu_ClickCreate_Entry, self);
+                       curr = HUD_MinigameMenu_SpawnSubEntry(it.message, HUD_MinigameMenu_ClickCreate_Entry, this);
                        curr.netname = it.netname;
                        curr.model = strzone(minigame_texture(strcat(it.netname,"/icon")));
                        HUD_MinigameMenu_InsertEntry( curr, prev );
@@ -232,26 +232,26 @@ void HUD_MinigameMenu_ClickCreate()
 }
 
 // Click action for Join sub-entries
-void HUD_MinigameMenu_ClickJoin_Entry()
-{SELFPARAM();
-       minigame_cmd("join ",self.netname);
-       HUD_MinigameMenu_EraseEntry(self);
+void HUD_MinigameMenu_ClickJoin_Entry(entity this, entity actor, entity trigger)
+{
+       minigame_cmd("join ",this.netname);
+       HUD_MinigameMenu_EraseEntry(this);
 }
 
 // Click action for the Join menu
-void HUD_MinigameMenu_ClickJoin()
-{SELFPARAM();
-       if ( HUD_MinigameMenu_Click_ExpandCollapse() )
+void HUD_MinigameMenu_ClickJoin(entity this, entity actor, entity trigger)
+{
+       if ( HUD_MinigameMenu_Click_ExpandCollapse(this) )
        {
                entity e = world;
                entity curr;
-               entity prev = self;
+               entity prev = this;
                while( (e = find(e,classname,"minigame")) )
                {
                        if ( e != active_minigame )
                        {
                                curr = HUD_MinigameMenu_SpawnSubEntry(
-                                       e.netname, HUD_MinigameMenu_ClickJoin_Entry, self );
+                                       e.netname, HUD_MinigameMenu_ClickJoin_Entry, this );
                                curr.netname = e.netname;
                                curr.model = strzone(minigame_texture(strcat(e.descriptor.netname,"/icon")));
                                HUD_MinigameMenu_InsertEntry( curr, prev );
@@ -268,22 +268,22 @@ void HUD_MinigameMenu_ClickNoop()
 }*/
 
 // Click action for Quit
-void HUD_MinigameMenu_ClickQuit()
+void HUD_MinigameMenu_ClickQuit(entity this, entity actor, entity trigger)
 {
        deactivate_minigame();
        minigame_cmd("end");
 }
 
 // Click action for Invite sub-entries
-void HUD_MinigameMenu_ClickInvite_Entry()
-{SELFPARAM();
-       minigame_cmd("invite #",self.netname);
+void HUD_MinigameMenu_ClickInvite_Entry(entity this, entity actor, entity trigger)
+{
+       minigame_cmd("invite #",this.netname);
 }
 
 // Click action for the Invite menu
-void HUD_MinigameMenu_ClickInvite()
-{SELFPARAM();
-       if ( HUD_MinigameMenu_Click_ExpandCollapse() )
+void HUD_MinigameMenu_ClickInvite(entity this, entity actor, entity trigger)
+{
+       if ( HUD_MinigameMenu_Click_ExpandCollapse(this) )
        {
                entity e;
                entity prev = self;
@@ -305,10 +305,10 @@ void HUD_MinigameMenu_ClickInvite()
        }
 }
 
-void HUD_MinigameMenu_ClickCustomEntry()
-{SELFPARAM();
+void HUD_MinigameMenu_ClickCustomEntry(entity this, entity actor, entity trigger)
+{
        if ( active_minigame )
-               active_minigame.minigame_event(active_minigame,"menu_click",self.netname);
+               active_minigame.minigame_event(active_minigame,"menu_click",this.netname);
 }
 
 // Adds a game-specific entry to the menu
@@ -322,17 +322,17 @@ void HUD_MinigameMenu_CustomEntry(entity parent, string menumessage, string even
 }
 
 // Click action for the Current Game menu
-void HUD_MinigameMenu_ClickCurrentGame()
-{SELFPARAM();
-       if ( HUD_MinigameMenu_Click_ExpandCollapse() )
+void HUD_MinigameMenu_ClickCurrentGame(entity this, entity actor, entity trigger)
+{
+       if ( HUD_MinigameMenu_Click_ExpandCollapse(this) )
        {
                HUD_MinigameMenu_InsertEntry( HUD_MinigameMenu_SpawnSubEntry(
-                       _("Quit"), HUD_MinigameMenu_ClickQuit, self ), self);
+                       _("Quit"), HUD_MinigameMenu_ClickQuit, this ), this);
 
-               active_minigame.minigame_event(active_minigame,"menu_show",self);
+               active_minigame.minigame_event(active_minigame,"menu_show",this);
 
                HUD_MinigameMenu_InsertEntry( HUD_MinigameMenu_SpawnSubEntry(
-                       _("Invite"), HUD_MinigameMenu_ClickInvite, self), self);
+                       _("Invite"), HUD_MinigameMenu_ClickInvite, this), this);
        }
 }
 // Whether the minigame menu panel is open
@@ -342,7 +342,7 @@ bool HUD_MinigameMenu_IsOpened()
 }
 
 // Close the minigame menu panel
-void HUD_MinigameMenu_Close()
+void HUD_MinigameMenu_Close(entity this, entity actor, entity trigger)
 {
        if ( HUD_MinigameMenu_IsOpened() )
        {
@@ -665,7 +665,7 @@ float HUD_Minigame_InputEvent(float bInputType, float nPrimary, float nSecondary
                        }
                        else if ( nPrimary == K_ESCAPE )
                        {
-                               HUD_MinigameMenu_Close();
+                               HUD_MinigameMenu_Close(NULL, NULL, NULL);
                                return true;
                        }
                }
index 3cfa18cdf4bc166e3f296cc11274a260acf3e050..139967a2ccb5fcc5826265b9a488c32ea2bedc38 100644 (file)
@@ -105,6 +105,11 @@ void M_Shambler_Attack_Lightning_Explode()
        self.nextthink = time + 0.2;
 }
 
+void M_Shambler_Attack_Lightning_Explode_use(entity this, entity actor, entity trigger)
+{
+       WITHSELF(this, M_Shambler_Attack_Lightning_Explode());
+}
+
 void M_Shambler_Attack_Lightning_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 {
        if (this.health <= 0)
@@ -116,14 +121,14 @@ void M_Shambler_Attack_Lightning_Damage(entity this, entity inflictor, entity at
        this.health = this.health - damage;
 
        if (this.health <= 0)
-               WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.use));
+               W_PrepareExplosionByDamage(this, attacker, adaptor_think2use);
 }
 
 void M_Shambler_Attack_Lightning_Touch()
 {SELFPARAM();
        PROJECTILE_TOUCH;
 
-       self.use ();
+       self.use(this, NULL, NULL);
 }
 
 void M_Shambler_Attack_Lightning_Think()
@@ -157,7 +162,7 @@ void M_Shambler_Attack_Lightning(entity this)
        gren.cnt = time + 5;
        gren.nextthink = time;
        gren.think = M_Shambler_Attack_Lightning_Think;
-       gren.use = M_Shambler_Attack_Lightning_Explode;
+       gren.use = M_Shambler_Attack_Lightning_Explode_use;
        gren.touch = M_Shambler_Attack_Lightning_Touch;
 
        gren.takedamage = DAMAGE_YES;
index 9b0541c14edb581a2f342337a8511b249c56c961..0b2e3650b4c3cdf23d86008393709646af99614d 100644 (file)
@@ -151,6 +151,11 @@ void M_Spider_Attack_Web_Explode()
        }
 }
 
+void M_Spider_Attack_Web_Explode_use(entity this, entity actor, entity trigger)
+{
+       WITHSELF(this, M_Spider_Attack_Web_Explode());
+}
+
 void M_Spider_Attack_Web_Touch()
 {
        PROJECTILE_TOUCH;
@@ -168,7 +173,7 @@ void M_Spider_Attack_Web(entity this)
 
        entity proj = new(plasma);
        proj.owner = proj.realowner = this;
-       proj.use = M_Spider_Attack_Web_Explode;
+       proj.use = M_Spider_Attack_Web_Explode_use;
        proj.think = adaptor_think2use_hittype_splash;
        proj.bot_dodge = true;
        proj.bot_dodgerating = 0;
index 9d1022fa36cd92fcda738a5477699a6f80cd74d4..def29e969df9a8b373d50121deb37f77065877dc 100644 (file)
@@ -548,9 +548,9 @@ void Monster_Dead_Fade(entity this)
        }
 }
 
-void Monster_Use()
-{SELFPARAM();
-       if(Monster_ValidTarget(this, activator)) { this.enemy = activator; }
+void Monster_Use(entity this, entity actor, entity trigger)
+{
+       if(Monster_ValidTarget(this, actor)) { this.enemy = actor; }
 }
 
 vector Monster_Move_Target(entity this, entity targ)
@@ -931,9 +931,9 @@ void Monster_Dead_Think()
        }
 }
 
-void Monster_Appear()
-{SELFPARAM();
-       this.enemy = activator;
+void Monster_Appear(entity this, entity actor, entity trigger)
+{
+       this.enemy = actor;
        this.spawnflags &= ~MONSTERFLAG_APPEAR; // otherwise, we get an endless loop
        Monster_Spawn(this, this.monsterid);
 }
@@ -1102,9 +1102,7 @@ void Monster_Damage(entity this, entity inflictor, entity attacker, float damage
                        this.candrop = false; // killed by mobkill command
 
                // TODO: fix this?
-               activator = attacker;
-               other = this.enemy;
-               WITHSELF(this, SUB_UseTargets());
+               SUB_UseTargets(this, attacker, this.enemy);
                this.target2 = this.oldtarget2; // reset to original target on death, incase we respawn
 
                Monster_Dead(this, attacker, (this.health <= -100 || deathtype == DEATH_KILL.m_id));
index 44847f27de94043bdde6e02921a4f3c6c288c81a..cabfd31b816ec03e53e3eae5c8f94e0bf840aa2f 100644 (file)
@@ -805,7 +805,7 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i
                this.realowner = attacker;
 
        if(this.health <= 0)
-               WITHSELF(this, W_PrepareExplosionByDamage(attacker, nade_boom));
+               W_PrepareExplosionByDamage(this, attacker, nade_boom);
        else
                nade_burn_spawn(this);
 }
index 5a06302d9f282fe5cc92a550dee40b90d9eaf21f..2d9d423cf5502bc1ff66a3ba5d7e7af7defd688e 100644 (file)
@@ -80,7 +80,7 @@ void W_RocketPropelledChainsaw_Damage(entity this, entity inflictor, entity atta
        this.health = this.health - damage;
 
        if (this.health <= 0)
-               WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_RocketPropelledChainsaw_Explode));
+               W_PrepareExplosionByDamage(this, attacker, W_RocketPropelledChainsaw_Explode);
 }
 
 void W_RocketPropelledChainsaw_Think()
index 85ba9f51b3471bac94a42f0d967f1dd7f2e7961b..a3ac40b670010a39cfff08aea30f1c7c826b4037 100644 (file)
@@ -1421,29 +1421,31 @@ spawnfunc(item_invincible)
 // compatibility:
 spawnfunc(item_quad) { this.classname = "item_strength";spawnfunc_item_strength(this);}
 
-void target_items_use()
-{SELFPARAM();
-       if(activator.classname == "droppedweapon")
+void target_items_use(entity this, entity actor, entity trigger)
+{
+       other = trigger; // TODO
+
+       if(actor.classname == "droppedweapon")
        {
                EXACTTRIGGER_TOUCH;
-               remove(activator);
+               remove(actor);
                return;
        }
 
-       if (!IS_PLAYER(activator))
+       if (!IS_PLAYER(actor))
                return;
-       if(IS_DEAD(activator))
+       if(IS_DEAD(actor))
                return;
        EXACTTRIGGER_TOUCH;
 
-       FOREACH_ENTITY_ENT(enemy, activator,
+       FOREACH_ENTITY_ENT(enemy, actor,
        {
                if(it.classname == "droppedweapon")
                        remove(it);
        });
 
-       if(GiveItems(activator, 0, tokenize_console(self.netname)))
-               centerprint(activator, self.message);
+       if(GiveItems(actor, 0, tokenize_console(this.netname)))
+               centerprint(actor, this.message);
 }
 
 spawnfunc(target_items)
index 1eb4b182dee07359b7fd7d0baf8b2948c877071a..ce8307821ca11b0faea0811529e153eb2614661c 100644 (file)
@@ -114,8 +114,6 @@ float commodity_pickupevalfunc(entity player, entity item);
 void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter);
 
 
-void target_items_use ();
-
 float GiveWeapon(entity e, float wpn, float op, float val);
 
 float GiveBit(entity e, .float fld, float bit, float op, float val);
index feaf8785093d97b9663d67096ae3c8d22d853394..25857be3a1f48d659bc35a0f1a1c2a6467a845bc 100644 (file)
@@ -47,121 +47,121 @@ void func_breakable_damage(entity this, entity inflictor, entity attacker, float
 // func_breakable
 // - basically func_assault_destructible for general gameplay use
 //
-void LaunchDebris (string debrisname, vector force)
-{SELFPARAM();
+void LaunchDebris (entity this, string debrisname, vector force)
+{
        entity dbr = spawn();
-       vector org = self.absmin
-                  + '1 0 0' * random() * (self.absmax.x - self.absmin.x)
-                  + '0 1 0' * random() * (self.absmax.y - self.absmin.y)
-                  + '0 0 1' * random() * (self.absmax.z - self.absmin.z);
+       vector org = this.absmin
+                  + '1 0 0' * random() * (this.absmax.x - this.absmin.x)
+                  + '0 1 0' * random() * (this.absmax.y - this.absmin.y)
+                  + '0 0 1' * random() * (this.absmax.z - this.absmin.z);
        setorigin(dbr, org);
        _setmodel (dbr, debrisname );
-       dbr.skin = self.debrisskin;
-       dbr.colormap = self.colormap; // inherit team colors
-       dbr.owner = self; // do not be affected by our own explosion
-       dbr.movetype = self.debrismovetype;
-       dbr.solid = self.debrissolid;
+       dbr.skin = this.debrisskin;
+       dbr.colormap = this.colormap; // inherit team colors
+       dbr.owner = this; // do not be affected by our own explosion
+       dbr.movetype = this.debrismovetype;
+       dbr.solid = this.debrissolid;
        if(dbr.solid != SOLID_BSP) // SOLID_BSP has exact collision, MAYBE this works? TODO check this out
                setsize(dbr, '0 0 0', '0 0 0'); // needed for performance, until engine can deal better with it
-       dbr.velocity_x = self.debrisvelocity.x + self.debrisvelocityjitter.x * crandom();
-       dbr.velocity_y = self.debrisvelocity.y + self.debrisvelocityjitter.y * crandom();
-       dbr.velocity_z = self.debrisvelocity.z + self.debrisvelocityjitter.z * crandom();
-       self.velocity = self.velocity + force * self.debrisdamageforcescale;
-       dbr.avelocity_x = random()*self.debrisavelocityjitter.x;
-       dbr.avelocity_y = random()*self.debrisavelocityjitter.y;
-       dbr.avelocity_z = random()*self.debrisavelocityjitter.z;
-       dbr.damageforcescale = self.debrisdamageforcescale;
+       dbr.velocity_x = this.debrisvelocity.x + this.debrisvelocityjitter.x * crandom();
+       dbr.velocity_y = this.debrisvelocity.y + this.debrisvelocityjitter.y * crandom();
+       dbr.velocity_z = this.debrisvelocity.z + this.debrisvelocityjitter.z * crandom();
+       this.velocity = this.velocity + force * this.debrisdamageforcescale;
+       dbr.avelocity_x = random()*this.debrisavelocityjitter.x;
+       dbr.avelocity_y = random()*this.debrisavelocityjitter.y;
+       dbr.avelocity_z = random()*this.debrisavelocityjitter.z;
+       dbr.damageforcescale = this.debrisdamageforcescale;
        if(dbr.damageforcescale)
                dbr.takedamage = DAMAGE_YES;
-       SUB_SetFade(dbr, time + self.debristime + crandom() * self.debristimejitter, self.debrisfadetime);
+       SUB_SetFade(dbr, time + this.debristime + crandom() * this.debristimejitter, this.debrisfadetime);
 }
 
-void func_breakable_colormod()
-{SELFPARAM();
+void func_breakable_colormod(entity this)
+{
        float h;
-       if (!(self.spawnflags & 2))
+       if (!(this.spawnflags & 2))
                return;
-       h = self.health / self.max_health;
+       h = this.health / this.max_health;
        if(h < 0.25)
-               self.colormod = '1 0 0';
+               this.colormod = '1 0 0';
        else if(h <= 0.75)
-               self.colormod = '1 0 0' + '0 1 0' * (2 * h - 0.5);
+               this.colormod = '1 0 0' + '0 1 0' * (2 * h - 0.5);
        else
-               self.colormod = '1 1 1';
+               this.colormod = '1 1 1';
 
-       CSQCMODEL_AUTOUPDATE(self);
+       CSQCMODEL_AUTOUPDATE(this);
 }
 
-void func_breakable_look_destroyed()
-{SELFPARAM();
+void func_breakable_look_destroyed(entity this)
+{
        float floorZ;
 
-       if(self.solid == SOLID_BSP) // in case a misc_follow moved me, save the current origin first
-               self.dropped_origin = self.origin;
+       if(this.solid == SOLID_BSP) // in case a misc_follow moved me, save the current origin first
+               this.dropped_origin = this.origin;
 
-       if(self.mdl_dead == "")
-               self.effects |= EF_NODRAW;
+       if(this.mdl_dead == "")
+               this.effects |= EF_NODRAW;
        else {
-               if (self.origin == '0 0 0')     {       // probably no origin brush, so don't spawn in the middle of the map..
-                       floorZ = self.absmin.z;
-                       setorigin(self,((self.absmax+self.absmin)*.5));
-                       self.origin_z = floorZ;
+               if (this.origin == '0 0 0')     {       // probably no origin brush, so don't spawn in the middle of the map..
+                       floorZ = this.absmin.z;
+                       setorigin(this,((this.absmax+this.absmin)*.5));
+                       this.origin_z = floorZ;
                }
-               _setmodel(self, self.mdl_dead);
-               self.effects &= ~EF_NODRAW;
+               _setmodel(this, this.mdl_dead);
+               this.effects &= ~EF_NODRAW;
        }
 
-       CSQCMODEL_AUTOUPDATE(self);
+       CSQCMODEL_AUTOUPDATE(this);
 
-       self.solid = SOLID_NOT;
+       this.solid = SOLID_NOT;
 }
 
-void func_breakable_look_restore()
-{SELFPARAM();
-       _setmodel(self, self.mdl);
-       self.effects &= ~EF_NODRAW;
+void func_breakable_look_restore(entity this)
+{
+       _setmodel(this, this.mdl);
+       this.effects &= ~EF_NODRAW;
 
-       if(self.mdl_dead != "") // only do this if we use mdl_dead, to behave better with misc_follow
-               setorigin(self, self.dropped_origin);
+       if(this.mdl_dead != "") // only do this if we use mdl_dead, to behave better with misc_follow
+               setorigin(this, this.dropped_origin);
 
-       CSQCMODEL_AUTOUPDATE(self);
+       CSQCMODEL_AUTOUPDATE(this);
 
-       self.solid = SOLID_BSP;
+       this.solid = SOLID_BSP;
 }
 
-void func_breakable_behave_destroyed()
-{SELFPARAM();
-       self.health = self.max_health;
-       self.takedamage = DAMAGE_NO;
-       self.bot_attack = false;
-       self.event_damage = func_null;
-       self.state = 1;
-       if(self.spawnflags & 4)
-               self.use = func_null;
-       func_breakable_colormod();
-       if (self.noise1)
-               stopsound (self, CH_TRIGGER_SINGLE);
+void func_breakable_behave_destroyed(entity this)
+{
+       this.health = this.max_health;
+       this.takedamage = DAMAGE_NO;
+       this.bot_attack = false;
+       this.event_damage = func_null;
+       this.state = 1;
+       if(this.spawnflags & 4)
+               this.use = func_null;
+       func_breakable_colormod(this);
+       if (this.noise1)
+               stopsound (this, CH_TRIGGER_SINGLE);
 }
 
-void func_breakable_behave_restore()
-{SELFPARAM();
-       self.health = self.max_health;
-       if(self.sprite)
+void func_breakable_behave_restore(entity this)
+{
+       this.health = this.max_health;
+       if(this.sprite)
        {
-               WaypointSprite_UpdateMaxHealth(self.sprite, self.max_health);
-               WaypointSprite_UpdateHealth(self.sprite, self.health);
+               WaypointSprite_UpdateMaxHealth(this.sprite, this.max_health);
+               WaypointSprite_UpdateHealth(this.sprite, this.health);
        }
-       if(!(self.spawnflags & 4))
+       if(!(this.spawnflags & 4))
        {
-               self.takedamage = DAMAGE_AIM;
-               self.bot_attack = true;
-               self.event_damage = func_breakable_damage;
+               this.takedamage = DAMAGE_AIM;
+               this.bot_attack = true;
+               this.event_damage = func_breakable_damage;
        }
-       self.state = 0;
-       self.nextthink = 0; // cancel auto respawn
-       func_breakable_colormod();
-       if (self.noise1)
-               _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
+       this.state = 0;
+       this.nextthink = 0; // cancel auto respawn
+       func_breakable_colormod(this);
+       if (this.noise1)
+               _sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM);
 }
 
 void func_breakable_init_for_player(entity player)
@@ -173,57 +173,67 @@ void func_breakable_init_for_player(entity player)
        }
 }
 
-void func_breakable_destroyed()
-{SELFPARAM();
-       func_breakable_look_destroyed();
-       func_breakable_behave_destroyed();
+void func_breakable_destroyed(entity this)
+{
+       func_breakable_look_destroyed(this);
+       func_breakable_behave_destroyed(this);
 
-       CSQCMODEL_AUTOUPDATE(self);
+       CSQCMODEL_AUTOUPDATE(this);
 }
 
-void func_breakable_restore()
-{SELFPARAM();
-       func_breakable_look_restore();
-       func_breakable_behave_restore();
+void func_breakable_restore(entity this, entity actor, entity trigger)
+{
+       func_breakable_look_restore(this);
+       func_breakable_behave_restore(this);
 
-       CSQCMODEL_AUTOUPDATE(self);
+       CSQCMODEL_AUTOUPDATE(this);
 }
 
-vector debrisforce; // global, set before calling this
-void func_breakable_destroy()
+void func_breakable_restore_self()
 {SELFPARAM();
+       func_breakable_restore(this, NULL, NULL);
+}
+
+vector debrisforce; // global, set before calling this
+void func_breakable_destroy(entity this, entity actor, entity trigger)
+{
        float n, i;
        string oldmsg;
 
-       activator = self.owner;
-       self.owner = world; // set by W_PrepareExplosionByDamage
+       entity act = this.owner;
+       this.owner = world; // set by W_PrepareExplosionByDamage
 
        // now throw around the debris
-       n = tokenize_console(self.debris);
+       n = tokenize_console(this.debris);
        for(i = 0; i < n; ++i)
-               LaunchDebris(argv(i), debrisforce);
+               LaunchDebris(this, argv(i), debrisforce);
 
-       func_breakable_destroyed();
+       func_breakable_destroyed(this);
 
-       if(self.noise)
-               _sound (self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM);
+       if(this.noise)
+               _sound (this, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM);
 
-       if(self.dmg)
-               RadiusDamage(self, activator, self.dmg, self.dmg_edge, self.dmg_radius, self, world, self.dmg_force, DEATH_HURTTRIGGER.m_id, world);
+       if(this.dmg)
+               RadiusDamage(this, act, this.dmg, this.dmg_edge, this.dmg_radius, this, world, this.dmg_force, DEATH_HURTTRIGGER.m_id, world);
 
-       if(self.cnt) // TODO
-               __pointparticles(self.cnt, self.absmin * 0.5 + self.absmax * 0.5, '0 0 0', self.count);
+       if(this.cnt) // TODO
+               __pointparticles(this.cnt, this.absmin * 0.5 + this.absmax * 0.5, '0 0 0', this.count);
 
-       if(self.respawntime)
+       if(this.respawntime)
        {
-               self.think = func_breakable_restore;
-               self.nextthink = time + self.respawntime + crandom() * self.respawntimejitter;
+               this.think = func_breakable_restore_self;
+               this.nextthink = time + this.respawntime + crandom() * this.respawntimejitter;
        }
 
-       oldmsg = self.message;
-       self.message = "";
-       SUB_UseTargets();
-       self.message = oldmsg;
+       oldmsg = this.message;
+       this.message = "";
+       SUB_UseTargets(this, act, trigger);
+       this.message = oldmsg;
+}
+
+void func_breakable_destroy_self()
+{SELFPARAM();
+       func_breakable_destroy(this, NULL, NULL);
 }
 
 void func_breakable_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
@@ -243,7 +253,7 @@ void func_breakable_damage(entity this, entity inflictor, entity attacker, float
                WaypointSprite_Ping(this.sprite);
                WaypointSprite_UpdateHealth(this.sprite, this.health);
        }
-       WITHSELF(this, func_breakable_colormod());
+       func_breakable_colormod(this);
 
        if(this.health <= 0)
        {
@@ -261,18 +271,18 @@ void func_breakable_damage(entity this, entity inflictor, entity attacker, float
                // do not explode NOW but in the NEXT FRAME!
                // because recursive calls to RadiusDamage are not allowed
                this.nextthink = time;
-               this.think = func_breakable_destroy;
+               this.think = func_breakable_destroy_self;
        }
 }
 
 void func_breakable_reset(entity this)
 {
        this.team = this.team_saved;
-       func_breakable_look_restore();
+       func_breakable_look_restore(this);
        if(this.spawnflags & 1)
-               func_breakable_behave_destroyed();
+               func_breakable_behave_destroyed(this);
        else
-               func_breakable_behave_restore();
+               func_breakable_behave_restore(this);
 
        CSQCMODEL_AUTOUPDATE(this);
 }
index e9ae0a5472042f24cfbada02a1ce52cdbd9fd07d..a1cabdc6c0326d2fa82bb766bfc1f5cd8c87abef 100644 (file)
@@ -9,8 +9,7 @@ void button_wait()
        self.state = STATE_TOP;
        self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait;
        self.SUB_THINK = button_return;
-       activator = self.enemy;
-       SUB_UseTargets();
+       SUB_UseTargets(self, self.enemy, NULL);
        self.frame = 1;                 // use alternate textures
 }
 
@@ -60,13 +59,13 @@ void button_reset()
                self.takedamage = DAMAGE_YES;   // can be shot again
 }
 
-void button_use()
-{SELFPARAM();
-       if(self.active != ACTIVE_ACTIVE)
+void button_use(entity this, entity actor, entity trigger)
+{
+       if(this.active != ACTIVE_ACTIVE)
                return;
 
-       self.enemy = activator;
-       button_fire ();
+       this.enemy = actor;
+       WITHSELF(this, button_fire());
 }
 
 void button_touch()
index 583c737438ac3fae10131e2497018df65789ca38..5cd17e7bfc3e1544cdeca427a884d09b5b542828 100644 (file)
@@ -58,11 +58,11 @@ void conveyor_think()
 
 #ifdef SVQC
 
-void conveyor_use()
-{SELFPARAM();
-       self.state = !self.state;
+void conveyor_use(entity this, entity actor, entity trigger)
+{
+       this.state = !this.state;
 
-       self.SendFlags |= 2;
+       this.SendFlags |= 2;
 }
 
 void conveyor_reset(entity this)
index 1e19dfafc7205e3e74d9c1aad7daa23f34adf567..30de40fa9c51874e28ef6f4b2290b9b6b146c1b8 100644 (file)
@@ -141,7 +141,7 @@ void door_go_up()
        string oldmessage;
        oldmessage = self.message;
        self.message = "";
-       SUB_UseTargets();
+       SUB_UseTargets(self, NULL, NULL);
        self.message = oldmessage;
 }
 
@@ -206,16 +206,15 @@ bool door_check_keys(entity door, entity player)
        return false;
 }
 
-void door_fire()
-{SELFPARAM();
-       entity  starte;
-
-       if (self.owner != self)
-               objerror ("door_fire: self.owner != self");
+void door_fire(entity this, entity actor, entity trigger)
+{
+       entity starte;
+       if (this.owner != this)
+               objerror ("door_fire: this.owner != this");
 
-       if (self.spawnflags & DOOR_TOGGLE)
+       if (this.spawnflags & DOOR_TOGGLE)
        {
-               if (self.state == STATE_UP || self.state == STATE_TOP)
+               if (this.state == STATE_UP || this.state == STATE_TOP)
                {
                        starte = self;
                        do
@@ -262,14 +261,12 @@ void door_fire()
        setself(this);
 }
 
-void door_use()
-{SELFPARAM();
+void door_use(entity this, entity actor, entity trigger)
+{
        //dprint("door_use (model: ");dprint(self.model);dprint(")\n");
 
-       if (self.owner)
-       {
-               WITHSELF(self.owner, door_fire());
-       }
+       if (this.owner)
+               WITHSELF(this.owner, door_fire(this.owner, actor, trigger));
 }
 
 void door_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
@@ -289,7 +286,7 @@ void door_damage(entity this, entity inflictor, entity attacker, float damage, i
        {
                this.owner.health = this.owner.max_health;
                this.owner.takedamage = DAMAGE_NO;      // wil be reset upon return
-               WITHSELF(this.owner, door_use());
+               door_use(this.owner, NULL, NULL);
        }
 }
 
@@ -415,7 +412,7 @@ void door_rotating_go_up()
        string oldmessage;
        oldmessage = self.message;
        self.message = "";
-       SUB_UseTargets();
+       SUB_UseTargets(self, NULL, other); // TODO: is other needed here?
        self.message = oldmessage;
 }
 
@@ -447,10 +444,7 @@ void door_trigger_touch()
 
        self.door_finished = time + 1;
 
-       activator = other;
-
-       setself(self.owner);
-       door_use ();
+       door_use(this.owner, other, NULL);
 }
 
 void door_spawnfield(vector fmins, vector fmaxs)
index 70b5a0a09e884f3a3aac039b42fb8a55e973ea02..3e45302040ca1f805e0e4681f1ae2fc3b4b580fa 100644 (file)
@@ -13,59 +13,59 @@ const float SECRET_1ST_DOWN = 4;            // 1st move is down from arrow
 const float SECRET_NO_SHOOT = 8;               // only opened by trigger
 const float SECRET_YES_SHOOT = 16;     // shootable even if targeted
 
-void fd_secret_use()
-{SELFPARAM();
+void fd_secret_use(entity this, entity actor, entity trigger)
+{
        float temp;
        string message_save;
 
-       self.health = 10000;
-       self.bot_attack = true;
+       this.health = 10000;
+       this.bot_attack = true;
 
        // exit if still moving around...
-       if (self.origin != self.oldorigin)
+       if (this.origin != this.oldorigin)
                return;
 
-       message_save = self.message;
-       self.message = ""; // no more message
-       SUB_UseTargets();                               // fire all targets / killtargets
-       self.message = message_save;
+       message_save = this.message;
+       this.message = ""; // no more message
+       SUB_UseTargets(this, actor, trigger);                           // fire all targets / killtargets
+       this.message = message_save;
 
-       self.velocity = '0 0 0';
+       this.velocity = '0 0 0';
 
        // Make a sound, wait a little...
 
-       if (self.noise1 != "")
-               _sound(self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
-       self.SUB_NEXTTHINK = self.SUB_LTIME + 0.1;
+       if (this.noise1 != "")
+               _sound(this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM);
+       this.SUB_NEXTTHINK = this.SUB_LTIME + 0.1;
 
-       temp = 1 - (self.spawnflags & SECRET_1ST_LEFT); // 1 or -1
-       makevectors(self.mangle);
+       temp = 1 - (this.spawnflags & SECRET_1ST_LEFT); // 1 or -1
+       makevectors(this.mangle);
 
-       if (!self.t_width)
+       if (!this.t_width)
        {
-               if (self.spawnflags & SECRET_1ST_DOWN)
-                       self.t_width = fabs(v_up * self.size);
+               if (this.spawnflags & SECRET_1ST_DOWN)
+                       this.t_width = fabs(v_up * this.size);
                else
-                       self.t_width = fabs(v_right * self.size);
+                       this.t_width = fabs(v_right * this.size);
        }
 
-       if (!self.t_length)
-               self.t_length = fabs(v_forward * self.size);
+       if (!this.t_length)
+               this.t_length = fabs(v_forward * this.size);
 
-       if (self.spawnflags & SECRET_1ST_DOWN)
-               self.dest1 = self.origin - v_up * self.t_width;
+       if (this.spawnflags & SECRET_1ST_DOWN)
+               this.dest1 = this.origin - v_up * this.t_width;
        else
-               self.dest1 = self.origin + v_right * (self.t_width * temp);
+               this.dest1 = this.origin + v_right * (this.t_width * temp);
 
-       self.dest2 = self.dest1 + v_forward * self.t_length;
-       SUB_CalcMove(self.dest1, TSPEED_LINEAR, self.speed, fd_secret_move1);
-       if (self.noise2 != "")
-               _sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
+       this.dest2 = this.dest1 + v_forward * this.t_length;
+       WITHSELF(this, SUB_CalcMove(this.dest1, TSPEED_LINEAR, this.speed, fd_secret_move1));
+       if (this.noise2 != "")
+               _sound(this, CH_TRIGGER_SINGLE, this.noise2, VOL_BASE, ATTEN_NORM);
 }
 
 void fd_secret_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 {
-       WITHSELF(this, fd_secret_use());
+       fd_secret_use(this, NULL, NULL);
 }
 
 // Wait after first movement...
index 62b4d5a3629e846bc063e1368f55c189e890df50..9cec88f99463f0563bce49a05d76457b77d06946 100644 (file)
@@ -87,10 +87,10 @@ bool pointparticles_SendEntity(entity this, entity to, float fl)
        return 1;
 }
 
-void pointparticles_use()
-{SELFPARAM();
-       self.state = !self.state;
-       self.SendFlags |= 2;
+void pointparticles_use(entity this, entity actor, entity trigger)
+{
+       this.state = !this.state;
+       this.SendFlags |= 2;
 }
 
 void pointparticles_think()
index be2c7ed9c3d3828c972cfb592d764223f69c9d87..3f481ae78f4d30ec5dff0c2394efca09bf8717c1 100644 (file)
@@ -1,21 +1,20 @@
 #ifdef SVQC
-void func_rotating_setactive(float astate)
-{SELFPARAM();
-
+void func_rotating_setactive(entity this, int astate)
+{
        if (astate == ACTIVE_TOGGLE)
        {
-               if(self.active == ACTIVE_ACTIVE)
-                       self.active = ACTIVE_NOT;
+               if(this.active == ACTIVE_ACTIVE)
+                       this.active = ACTIVE_NOT;
                else
-                       self.active = ACTIVE_ACTIVE;
+                       this.active = ACTIVE_ACTIVE;
        }
        else
-               self.active = astate;
+               this.active = astate;
 
-       if(self.active  == ACTIVE_NOT)
-               self.avelocity = '0 0 0';
+       if(this.active  == ACTIVE_NOT)
+               this.avelocity = '0 0 0';
        else
-               self.avelocity = self.pos1;
+               this.avelocity = this.pos1;
 }
 
 /*QUAKED spawnfunc_func_rotating (0 .5 .8) ? - - X_AXIS Y_AXIS
index 2b27c7355ce5b814bc1ceac5dff541aacee79a4e..013d4597fb8bf73d36773c00494a1887f41b7b61 100644 (file)
@@ -1,11 +1,11 @@
 .float train_wait_turning;
 void() train_next;
 #ifdef SVQC
-void train_use();
+void train_use(entity this, entity actor, entity trigger);
 #endif
 void train_wait()
 {SELFPARAM();
-       WITHSELF(self.enemy, SUB_UseTargets());
+       SUB_UseTargets(this.enemy, NULL, NULL);
        self.enemy = world;
 
        // if turning is enabled, the train will turn toward the next point while waiting
@@ -176,12 +176,11 @@ void train_link()
        //Net_LinkEntity(self, 0, false, train_send);
 }
 
-void train_use()
+void train_use(entity this, entity actor, entity trigger)
 {
-    SELFPARAM();
-       self.SUB_NEXTTHINK = self.SUB_LTIME + 1;
-       self.SUB_THINK = train_next;
-       self.use = func_null; // not again
+       this.SUB_NEXTTHINK = this.SUB_LTIME + 1;
+       this.SUB_THINK = train_next;
+       this.use = func_null; // not again
 }
 
 void func_train_find(entity this)
index 48e23a287d68de3c00eeeb1af9bf9a1531da0882..6e589eddf04bf4da822ce56e56699b7d3d79ed89 100644 (file)
@@ -10,42 +10,42 @@ REGISTER_NET_LINKED(ENT_CLIENT_LASER)
 
 #ifdef SVQC
 .float modelscale;
-void misc_laser_aim()
-{SELFPARAM();
+void misc_laser_aim(entity this)
+{
        vector a;
-       if(self.enemy)
+       if(this.enemy)
        {
-               if(self.spawnflags & 2)
+               if(this.spawnflags & 2)
                {
-                       if(self.enemy.origin != self.mangle)
+                       if(this.enemy.origin != this.mangle)
                        {
-                               self.mangle = self.enemy.origin;
-                               self.SendFlags |= 2;
+                               this.mangle = this.enemy.origin;
+                               this.SendFlags |= 2;
                        }
                }
                else
                {
-                       a = vectoangles(self.enemy.origin - self.origin);
+                       a = vectoangles(this.enemy.origin - this.origin);
                        a_x = -a_x;
-                       if(a != self.mangle)
+                       if(a != this.mangle)
                        {
-                               self.mangle = a;
-                               self.SendFlags |= 2;
+                               this.mangle = a;
+                               this.SendFlags |= 2;
                        }
                }
        }
        else
        {
-               if(self.angles != self.mangle)
+               if(this.angles != this.mangle)
                {
-                       self.mangle = self.angles;
-                       self.SendFlags |= 2;
+                       this.mangle = this.angles;
+                       this.SendFlags |= 2;
                }
        }
-       if(self.origin != self.oldorigin)
+       if(this.origin != this.oldorigin)
        {
-               self.SendFlags |= 1;
-               self.oldorigin = self.origin;
+               this.SendFlags |= 1;
+               this.oldorigin = this.origin;
        }
 }
 
@@ -67,7 +67,7 @@ void misc_laser_think()
        if(!self.state)
                return;
 
-       misc_laser_aim();
+       misc_laser_aim(this);
 
        if(self.enemy)
        {
@@ -97,8 +97,7 @@ void misc_laser_think()
                        {
                                self.count = 1;
 
-                               activator = self.enemy.pusher;
-                               WITHSELF(self.enemy, SUB_UseTargets());
+                               SUB_UseTargets(self.enemy, self.enemy.pusher, NULL);
                        }
                }
                else
@@ -107,8 +106,7 @@ void misc_laser_think()
                        {
                                self.count = 0;
 
-                               activator = self.enemy.pusher;
-                               WITHSELF(self.enemy, SUB_UseTargets());
+                               SUB_UseTargets(self.enemy, self.enemy.pusher, NULL);
                        }
                }
        }
@@ -188,11 +186,11 @@ Keys:
 "dmg"
  damage per second (-1 for a laser that kills immediately)
 */
-void laser_use()
-{SELFPARAM();
-       self.state = !self.state;
-       self.SendFlags |= 4;
-       misc_laser_aim();
+void laser_use(entity this, entity actor, entity trigger)
+{
+       this.state = !this.state;
+       this.SendFlags |= 4;
+       misc_laser_aim(this);
 }
 
 void laser_reset(entity this)
index a2efc1142e316aeee6e4cd5b4ab740cc72a924ea..7429f2b3550bfbf95db857da277f7b9f45d8d5fc 100644 (file)
@@ -133,16 +133,16 @@ void plat_outside_touch()
                plat_go_down ();
 }
 
-void plat_trigger_use()
-{SELFPARAM();
+void plat_trigger_use(entity this, entity actor, entity trigger)
+{
 #ifdef SVQC
-       if (self.think)
+       if (this.think)
                return;         // already activated
 #elif defined(CSQC)
-       if(self.move_think)
+       if(this.move_think)
                return;
 #endif
-       plat_go_down();
+       WITHSELF(this, plat_go_down());
 }
 
 
@@ -176,12 +176,12 @@ void plat_crush()
        }
 }
 
-void plat_use()
-{SELFPARAM();
-       self.use = func_null;
-       if (self.state != 4)
+void plat_use(entity this, entity actor, entity trigger)
+{
+       this.use = func_null;
+       if (this.state != 4)
                objerror ("plat_use: not in up state");
-       plat_go_down();
+       WITHSELF(this, plat_go_down());
 }
 
 .string sound1, sound2;
index e0a581b7cff7fa693abc6f07f24afb00b754cb9d..9a32e327a23fd324d2a21c34bf0a136c38f65dba 100644 (file)
@@ -5,7 +5,7 @@
 
 void() plat_center_touch;
 void() plat_outside_touch;
-void() plat_trigger_use;
+void plat_trigger_use(entity this, entity actor, entity trigger);
 void() plat_go_up;
 void() plat_go_down;
 void() plat_crush;
index 87c9c329099641e2c1cab962c2f5b8d55d4f26de..7d6ea9de981ce038ea9d9603e6cd1258e00946f1 100644 (file)
@@ -2,7 +2,6 @@ void SUB_NullThink() { }
 
 void()  SUB_CalcMoveDone;
 void() SUB_CalcAngleMoveDone;
-//void() SUB_UseTargets;
 
 /*
 ==================
index aebda5d0a33b5a9ac3709b157f2e21a22d69b893..6a844261379a971e3d76da1a371008aac2c3f63a 100644 (file)
@@ -36,6 +36,7 @@
 
 #endif
 
+
 void SUB_SetFade (entity ent, float when, float fading_time);
 void SUB_VanishOrRemove (entity ent);
 
@@ -55,7 +56,7 @@ void SUB_VanishOrRemove (entity ent);
 .string  platmovetype;
 .float platmovetype_start, platmovetype_end;
 
-entity activator;
+//entity activator;
 
 .string killtarget;
 
index 69f444073f16ce31432628d63cc95fa05dfb24fb..d4bc850de11eef0766ec3aeeefca3aca59ac75e6 100644 (file)
@@ -2,42 +2,40 @@
 .string chmap, gametype;
 .entity chlevel_targ;
 
-
-void target_changelevel_use()
+void target_changelevel_use(entity this, entity actor, entity trigger)
 {
-       SELFPARAM();
-       if(self.spawnflags & 2)
+       if(this.spawnflags & 2)
        {
                // simply don't react if a non-player triggers it
-               if(!IS_PLAYER(activator)) { return; }
+               if(!IS_PLAYER(actor)) { return; }
 
-               activator.chlevel_targ = self;
+               actor.chlevel_targ = this;
 
                int plnum = 0;
                int realplnum = 0;
                // let's not count bots
                FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
                        ++realplnum;
-                       if(it.chlevel_targ == self)
+                       if(it.chlevel_targ == this)
                                ++plnum;
                });
-               if(plnum < ceil(realplnum * min(1, self.count))) // 70% of players
+               if(plnum < ceil(realplnum * min(1, this.count))) // 70% of players
                        return;
        }
 
-       if(self.gametype != "")
-               MapInfo_SwitchGameType(MapInfo_Type_FromString(self.gametype));
+       if(this.gametype != "")
+               MapInfo_SwitchGameType(MapInfo_Type_FromString(this.gametype));
 
-       if (self.chmap == "")
+       if (this.chmap == "")
                localcmd("endmatch\n");
        else
-               localcmd(strcat("changelevel ", self.chmap, "\n"));
+               localcmd(strcat("changelevel ", this.chmap, "\n"));
 }
 
 spawnfunc(target_changelevel)
 {
-       self.use = target_changelevel_use;
+       this.use = target_changelevel_use;
 
-       if(!self.count) { self.count = 0.7; }
+       if(!this.count) { this.count = 0.7; }
 }
 #endif
index 5a4e86c48b370d0dd65baa1f0553abfc433eefb0..c48a0ba26b351270856be3c499e156fbdbd8c2dc 100644 (file)
@@ -44,16 +44,16 @@ void target_music_kill()
             WITHSELF(it, target_music_sendto(MSG_ALL, 0));
        });
 }
-void target_music_use()
+void target_music_use(entity this, entity actor, entity trigger)
 {
-       if(!activator)
+       if(!actor)
                return;
-       if(IS_REAL_CLIENT(activator))
+       if(IS_REAL_CLIENT(actor))
        {
-               msg_entity = activator;
+               msg_entity = actor;
                target_music_sendto(MSG_ONE, 1);
        }
-       FOREACH_CLIENT(IS_SPEC(it) && it.enemy == activator, {
+       FOREACH_CLIENT(IS_SPEC(it) && it.enemy == actor, {
                msg_entity = it;
                target_music_sendto(MSG_ONE, 1);
        });
@@ -132,10 +132,10 @@ void trigger_music_reset(entity this)
        this.cnt = !(this.spawnflags & 1);
        this.SendFlags |= 0x80;
 }
-void trigger_music_use()
-{SELFPARAM();
-       self.cnt = !self.cnt;
-       self.SendFlags |= 0x80;
+void trigger_music_use(entity this, entity actor, entity trigger)
+{
+       this.cnt = !this.cnt;
+       this.SendFlags |= 0x80;
 }
 spawnfunc(trigger_music)
 {
index 82793c9367f969c04b4ecc6a7361e84cc89d9923..74ac8fd99ad8899e6d556cbf9837929f0e2b2664 100644 (file)
@@ -31,13 +31,12 @@ void target_spawn_helper_setsize()
        setsize(self, self.mins, self.maxs);
 }
 
-void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity t3, entity t4, entity act)
-{SELFPARAM();
+void target_spawn_edit_entity(entity this, entity e, string msg, entity kt, entity t2, entity t3, entity t4, entity act, entity trigger)
+{
        float i, n, valuefieldpos;
        string key, value, valuefield, valueoffset, valueoffsetrandom;
        entity valueent;
        vector data, data2;
-       entity oldactivator;
 
        n = tokenize_console(msg);
 
@@ -97,7 +96,7 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity
 
                                if(value == "self")
                                {
-                                       valueent = self;
+                                       valueent = this;
                                        value = "";
                                }
                                else if(value == "activator")
@@ -107,7 +106,7 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity
                                }
                                else if(value == "other")
                                {
-                                       valueent = other;
+                                       valueent = trigger;
                                        value = "";
                                }
                                else if(value == "pusher")
@@ -218,11 +217,7 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity
                                value = strcat("target_spawn_helper", value);
                        putentityfieldstring(target_spawn_spawnfunc_field, e, value);
 
-                       oldactivator = activator;
-
-                       activator = act;
                        WITHSELF(e, e.target_spawn_spawnfunc(e));
-                       activator = oldactivator;
 
                        // We called an external function, so we have to re-tokenize msg.
                        n = tokenize_console(msg);
@@ -236,72 +231,72 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity
        }
 }
 
-void target_spawn_useon(entity e)
-{SELFPARAM();
-       self.target_spawn_activator = activator;
+void target_spawn_useon(entity e, entity this, entity actor, entity trigger)
+{
+       this.target_spawn_activator = actor;
        target_spawn_edit_entity(
+               this,
                e,
-               self.message,
-               find(world, targetname, self.killtarget),
-               find(world, targetname, self.target2),
-               find(world, targetname, self.target3),
-               find(world, targetname, self.target4),
-               activator
+               this.message,
+               find(world, targetname, this.killtarget),
+               find(world, targetname, this.target2),
+               find(world, targetname, this.target3),
+               find(world, targetname, this.target4),
+               actor,
+               trigger
        );
 }
 
-float target_spawn_cancreate()
-{SELFPARAM();
+bool target_spawn_cancreate(entity this)
+{
        float c;
        entity e;
 
-       c = self.count;
+       c = this.count;
        if(c == 0) // no limit?
-               return 1;
+               return true;
 
        ++c; // increase count to not include MYSELF
-       for(e = world; (e = findfloat(e, target_spawn_id, self.target_spawn_id)); --c)
+       for(e = world; (e = findfloat(e, target_spawn_id, this.target_spawn_id)); --c)
                ;
 
        // if c now is 0, we have AT LEAST the given count (maybe more), so don't spawn any more
        if(c == 0)
-               return 0;
-       return 1;
+               return false;
+       return true;
 }
 
-void target_spawn_use()
-{SELFPARAM();
-       entity e;
-
-       if(self.target == "")
+void target_spawn_use(entity this, entity actor, entity trigger)
+{
+       if(this.target == "")
        {
                // spawn new entity
-               if(!target_spawn_cancreate())
+               if(!target_spawn_cancreate(this))
                        return;
-               e = spawn();
+               entity e = spawn();
                e.spawnfunc_checked = true;
-               target_spawn_useon(e);
-               e.target_spawn_id = self.target_spawn_id;
+               target_spawn_useon(e, this, actor, trigger);
+               e.target_spawn_id = this.target_spawn_id;
        }
-       else if(self.target == "*activator")
+       else if(this.target == "*activator")
        {
                // edit entity
-               if(activator)
-                       target_spawn_useon(activator);
+               if(actor)
+                       target_spawn_useon(actor, this, actor, trigger);
        }
        else
        {
                // edit entity
-               for(e = world; (e = find(e, targetname, self.target)); )
-                       target_spawn_useon(e);
+               for(entity e = world; (e = find(e, targetname, this.target)); )
+                       target_spawn_useon(e, this, actor, trigger);
        }
 }
 
 void target_spawn_spawnfirst(entity this)
 {
-       activator = self.target_spawn_activator;
-       if(self.spawnflags & 2)
-               target_spawn_use();
+       entity act = this.target_spawn_activator;
+       if(this.spawnflags & 2)
+               target_spawn_use(this, act, NULL);
 }
 
 void initialize_field_db()
index 3c43b0e9ea590f7ed0528080d0bbaab65f80f327..046128f796d2cef4d353942496d952cb8d8c11c5 100644 (file)
@@ -1,21 +1,21 @@
 #ifdef SVQC
 // TODO add a way to do looped sounds with sound(); then complete this entity
-void target_speaker_use_off();
-void target_speaker_use_activator()
-{SELFPARAM();
-       if (!IS_REAL_CLIENT(activator))
+void target_speaker_use_off(entity this, entity actor, entity trigger);
+void target_speaker_use_activator(entity this, entity actor, entity trigger)
+{
+       if (!IS_REAL_CLIENT(actor))
                return;
        string snd;
-       if(substring(self.noise, 0, 1) == "*")
+       if(substring(this.noise, 0, 1) == "*")
        {
-               var .string sample = GetVoiceMessageSampleField(substring(self.noise, 1, -1));
+               var .string sample = GetVoiceMessageSampleField(substring(this.noise, 1, -1));
                if(GetPlayerSoundSampleField_notFound)
                        snd = SND(Null);
-               else if(activator.(sample) == "")
+               else if(actor.(sample) == "")
                        snd = SND(Null);
                else
                {
-                       tokenize_console(activator.(sample));
+                       tokenize_console(actor.(sample));
                        float n;
                        n = stof(argv(1));
                        if(n > 0)
@@ -25,23 +25,23 @@ void target_speaker_use_activator()
                }
        }
        else
-               snd = self.noise;
-       msg_entity = activator;
-       soundto(MSG_ONE, self, CH_TRIGGER, snd, VOL_BASE * self.volume, self.atten);
+               snd = this.noise;
+       msg_entity = actor;
+       soundto(MSG_ONE, this, CH_TRIGGER, snd, VOL_BASE * this.volume, this.atten);
 }
-void target_speaker_use_on()
-{SELFPARAM();
+void target_speaker_use_on(entity this, entity actor, entity trigger)
+{
        string snd;
-       if(substring(self.noise, 0, 1) == "*")
+       if(substring(this.noise, 0, 1) == "*")
        {
-               var .string sample = GetVoiceMessageSampleField(substring(self.noise, 1, -1));
+               var .string sample = GetVoiceMessageSampleField(substring(this.noise, 1, -1));
                if(GetPlayerSoundSampleField_notFound)
                        snd = SND(Null);
-               else if(activator.(sample) == "")
+               else if(actor.(sample) == "")
                        snd = SND(Null);
                else
                {
-                       tokenize_console(activator.(sample));
+                       tokenize_console(actor.(sample));
                        float n;
                        n = stof(argv(1));
                        if(n > 0)
@@ -51,27 +51,27 @@ void target_speaker_use_on()
                }
        }
        else
-               snd = self.noise;
-       _sound(self, CH_TRIGGER_SINGLE, snd, VOL_BASE * self.volume, self.atten);
-       if(self.spawnflags & 3)
-               self.use = target_speaker_use_off;
+               snd = this.noise;
+       _sound(this, CH_TRIGGER_SINGLE, snd, VOL_BASE * this.volume, this.atten);
+       if(this.spawnflags & 3)
+               this.use = target_speaker_use_off;
 }
-void target_speaker_use_off()
-{SELFPARAM();
-       sound(self, CH_TRIGGER_SINGLE, SND_Null, VOL_BASE * self.volume, self.atten);
-       self.use = target_speaker_use_on;
+void target_speaker_use_off(entity this, entity actor, entity trigger)
+{
+       sound(this, CH_TRIGGER_SINGLE, SND_Null, VOL_BASE * this.volume, this.atten);
+       this.use = target_speaker_use_on;
 }
 void target_speaker_reset(entity this)
 {
        if(this.spawnflags & 1) // LOOPED_ON
        {
                if(this.use == target_speaker_use_on)
-                       target_speaker_use_on();
+                       target_speaker_use_on(this, NULL, NULL);
        }
        else if(this.spawnflags & 2)
        {
                if(this.use == target_speaker_use_off)
-                       target_speaker_use_off();
+                       target_speaker_use_off(this, NULL, NULL);
        }
 }
 
@@ -101,7 +101,7 @@ spawnfunc(target_speaker)
                        self.use = target_speaker_use_activator;
                else if(self.spawnflags & 1) // LOOPED_ON
                {
-                       target_speaker_use_on();
+                       target_speaker_use_on(self, NULL, NULL);
                        self.reset = target_speaker_reset;
                }
                else if(self.spawnflags & 2) // LOOPED_OFF
index 1d1816a7741e988f46f9ee70f6773efc5843fe6f..e8433177094dfec0337a9e101f878bface1873c4 100644 (file)
@@ -9,13 +9,13 @@ void target_voicescript_clear(entity pl)
        pl.voicescript = world;
 }
 
-void target_voicescript_use()
-{SELFPARAM();
-       if(activator.voicescript != self)
+void target_voicescript_use(entity this, entity actor, entity trigger)
+{
+       if(actor.voicescript != this)
        {
-               activator.voicescript = self;
-               activator.voicescript_index = 0;
-               activator.voicescript_nextthink = time + self.delay;
+               actor.voicescript = this;
+               actor.voicescript_index = 0;
+               actor.voicescript_nextthink = time + this.delay;
        }
 }
 
index b0571dc310b4e2c333d8dab4142b62bf0a425f15..9366678b15c50dd79db5f194dcc3aadfec7d6a57 100644 (file)
@@ -30,7 +30,7 @@ entity teleport_first;
 
 #ifdef SVQC
 
-void trigger_teleport_use();
+void trigger_teleport_use(entity this, entity actor, entity trigger);
 
 #define TDEATHLOOP(o) \
        entity head; \
index d5811e479ed2bec89677d1d0bde1634ae28acfbf..5ada6805fc067ae7d4410ca29a5fb39f4ec8fd57 100644 (file)
@@ -1,25 +1,25 @@
 #ifdef SVQC
-void counter_use()
-{SELFPARAM();
-       self.count -= 1;
-       if (self.count < 0)
+void counter_use(entity this, entity actor, entity trigger)
+{
+       this.count -= 1;
+       if (this.count < 0)
                return;
 
-       if (self.count == 0)
+       if (this.count == 0)
        {
-               if(IS_PLAYER(activator) && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
-                       Send_Notification(NOTIF_ONE, activator, MSG_CENTER, CENTER_SEQUENCE_COMPLETED);
+               if(IS_PLAYER(actor) && (this.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
+                       Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_SEQUENCE_COMPLETED);
 
-               self.enemy = activator;
-               multi_trigger ();
+               this.enemy = actor;
+               WITHSELF(this, multi_trigger ());
        }
        else
        {
-               if(IS_PLAYER(activator) && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
-               if(self.count >= 4)
-                       Send_Notification(NOTIF_ONE, activator, MSG_CENTER, CENTER_SEQUENCE_COUNTER);
+               if(IS_PLAYER(actor) && (this.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
+               if(this.count >= 4)
+                       Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_SEQUENCE_COUNTER);
                else
-                       Send_Notification(NOTIF_ONE, activator, MSG_CENTER, CENTER_SEQUENCE_COUNTER_FEWMORE, self.count);
+                       Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_SEQUENCE_COUNTER_FEWMORE, this.count);
        }
 }
 
index fb341ebb77a124bb543dab8e2871dca5f0d7ede8..02c1aa968b7e14d302072f7d665e369fafcd9da3 100644 (file)
@@ -1,8 +1,8 @@
 #ifdef SVQC
-void delay_use()
-{SELFPARAM();
-    self.think = SUB_UseTargets;
-   self.nextthink = self.wait;
+void delay_use(entity this, entity actor, entity trigger)
+{
+   this.think = SUB_UseTargets_self;
+   this.nextthink = this.wait;
 }
 
 void delay_reset(entity this)
index a1f13d277e5f87e68d3391323596d0d9072cc659..a09e0ba09750a32cb4811116bd50f4bed1562d6b 100644 (file)
@@ -1,12 +1,9 @@
 #ifdef SVQC
-void trigger_disablerelay_use()
-{SELFPARAM();
-       entity e;
-
-       float a, b;
-       a = b = 0;
+void trigger_disablerelay_use(entity this, entity actor, entity trigger)
+{
+       int a = 0, b = 0;
 
-       for(e = world; (e = find(e, targetname, self.target)); )
+       for(entity e = world; (e = find(e, targetname, this.target)); )
        {
                if(e.use == SUB_UseTargets)
                {
@@ -26,6 +23,6 @@ void trigger_disablerelay_use()
 
 spawnfunc(trigger_disablerelay)
 {
-       self.use = trigger_disablerelay_use;
+       this.use = trigger_disablerelay_use;
 }
 #endif
index d2549f6c506b228500974313e3f13f5bab397597..e4923bdf545bdf8cb43740858ffc384071191539 100644 (file)
@@ -2,11 +2,11 @@
 /*QUAKED spawnfunc_trigger_flipflop (.5 .5 .5) (-8 -8 -8) (8 8 8) START_ENABLED
 "Flip-flop" trigger gate... lets only every second trigger event through
 */
-void flipflop_use()
-{SELFPARAM();
-    self.state = !self.state;
-    if(self.state)
-        SUB_UseTargets();
+void flipflop_use(entity this, entity actor, entity trigger)
+{
+    this.state = !this.state;
+    if(this.state)
+        SUB_UseTargets(this, actor, trigger);
 }
 
 spawnfunc(trigger_flipflop)
index 9c0c0791ab3443c3b25672c1dda77b42add84dba..5f3206a2af5bb470b16c388e306381e0b8aa8aae 100644 (file)
@@ -1,24 +1,28 @@
 #ifdef SVQC
-void gamestart_use(entity this)
+void gamestart_use(entity this, entity actor, entity trigger)
 {
-       activator = self;
-       SUB_UseTargets();
-       remove(self);
+       SUB_UseTargets(this, this, trigger);
+       remove(this);
+}
+
+void gamestart_use_this(entity this)
+{
+       gamestart_use(this, NULL, NULL);
 }
 
 void self_spawnfunc_trigger_gamestart();
 spawnfunc(trigger_gamestart)
 {
-       setuse(this, gamestart_use);
+       this.use = gamestart_use;
        this.reset2 = self_spawnfunc_trigger_gamestart;
 
        if(this.wait)
        {
-               this.think = this.use;
+               this.think = adaptor_think2use;
                this.nextthink = game_starttime + this.wait;
        }
        else
-               InitializeEntity(this, gamestart_use, INITPRIO_FINDTARGET);
+               InitializeEntity(this, gamestart_use_this, INITPRIO_FINDTARGET);
 }
 void self_spawnfunc_trigger_gamestart() { SELFPARAM(); spawnfunc_trigger_gamestart(this); }
 
index a6b3eedde651521db1a84c409b00940cec16c6a3..c7dd586cb3b3f266435bed42dd0a458be6511d7e 100644 (file)
@@ -32,9 +32,9 @@ void trigger_gravity_check_think()
        }
 }
 
-void trigger_gravity_use()
-{SELFPARAM();
-       self.state = !self.state;
+void trigger_gravity_use(entity this, entity actor, entity trigger)
+{
+       this.state = !this.state;
 }
 
 void trigger_gravity_touch()
index 771b4f0648d0c0cc42b636135cadf564312ca78a..a7ee567ebc08ec3c8a0615720e4cbe1fd35af98f 100644 (file)
@@ -1,10 +1,10 @@
 #ifdef SVQC
-void trigger_hurt_use()
-{SELFPARAM();
-       if(IS_PLAYER(activator))
-               self.enemy = activator;
+void trigger_hurt_use(entity this, entity actor, entity trigger)
+{
+       if(IS_PLAYER(actor))
+               this.enemy = actor;
        else
-               self.enemy = world; // let's just destroy it, if taking over is too much work
+               this.enemy = world; // let's just destroy it, if taking over is too much work
 }
 
 .float triggerhurttime;
index 8d08e968bdff08d9b419f8fef259df3d9035c840..44413a9c4b9171f8182c0cf8a04f9de0b08e8e24 100644 (file)
@@ -3,12 +3,12 @@
 #include "jumppads.qh"
 #include <common/physics/movetypes/movetypes.qh>
 
-void trigger_push_use()
-{SELFPARAM();
+void trigger_push_use(entity this, entity actor, entity trigger)
+{
        if(teamplay)
        {
-               self.team = activator.team;
-               self.SendFlags |= 2;
+               this.team = actor.team;
+               this.SendFlags |= 2;
        }
 }
 #endif
@@ -235,10 +235,7 @@ void trigger_push_touch()
        }
 
        if(this.enemy.target)
-       {
-               activator = other;
-               WITHSELF(this.enemy, SUB_UseTargets());
-       }
+               SUB_UseTargets(this.enemy, other, other); // TODO: do we need other as trigger too?
 
        if (other.flags & FL_PROJECTILE)
        {
index 07973614b88a23ae9a24ed8a6a70030706ede592..6fd61dc9da7561fb0bd684d30e50f95113267917 100644 (file)
@@ -15,8 +15,8 @@ const int NUM_JUMPPADSUSED = 3;
 float trigger_push_calculatevelocity_flighttime;
 
 #ifdef SVQC
-void() SUB_UseTargets;
-void trigger_push_use();
+void SUB_UseTargets(entity this, entity actor, entity trigger);
+void trigger_push_use(entity this, entity actor, entity trigger);
 #endif
 
 /*
index 182650ed5bed4aa74625fd94f21534aab9aacd13..311075aa0a0a0ed5c23cedc57d7194c4b6a0d937 100644 (file)
@@ -1,24 +1,11 @@
 /**
  * trigger given targets
  */
-void trigger_keylock_trigger(string s)
-{SELFPARAM();
-       entity otemp = other;
-       entity atemp = activator;
-
-       entity t;
-       for(t = world; (t = find(t, targetname, s)); )
+void trigger_keylock_trigger(entity this, entity actor, string s)
+{
+       for(entity t = world; (t = find(t, targetname, s)); )
                if(t.use)
-               {
-                       setself(t);
-                       other = this;
-                       activator = atemp;
-                       self.use();
-               }
-
-       setself(this);
-       other = otemp;
-       activator = atemp;
+                       t.use(t, actor, this);
 }
 
 /**
@@ -44,8 +31,6 @@ void trigger_keylock_touch()
        if(self.itemkeys)
                key_used = item_keys_usekey(self, other);
 
-       activator = other;
-
        if(self.itemkeys)
        {
 #ifdef SVQC
@@ -70,7 +55,7 @@ void trigger_keylock_touch()
                if(self.delay <= time || started_delay == true)
                if(self.target2)
                {
-                       trigger_keylock_trigger(self.target2);
+                       trigger_keylock_trigger(this, other, self.target2);
                        started_delay = true;
                        self.delay = time + self.wait;
                }
@@ -84,7 +69,7 @@ void trigger_keylock_touch()
 #endif
 
                if(self.target)
-                       trigger_keylock_trigger(self.target);
+                       trigger_keylock_trigger(this, other, self.target);
 
                if(self.killtarget)
                        trigger_keylock_kill(self.killtarget);
index f973c7a6fd42139053829d06117dcf229e406eec..2c94fa395db722bd944e73047d1ee259788587ae 100644 (file)
@@ -28,13 +28,10 @@ string trigger_magicear_processmessage(entity ear, entity source, float teamsay,
 
                if(dotrigger)
                {
-                       activator = source;
-                       setself(ear);
                        savemessage = self.message;
                        self.message = string_null;
-                       SUB_UseTargets();
+                       SUB_UseTargets(ear, source, NULL);
                        self.message = savemessage;
-                       setself(this);
                }
 
                if(ear.netname != "")
@@ -118,13 +115,10 @@ string trigger_magicear_processmessage(entity ear, entity source, float teamsay,
 
        if(dotrigger)
        {
-               activator = source;
-               setself(ear);
                savemessage = self.message;
                self.message = string_null;
-               SUB_UseTargets();
+               SUB_UseTargets(ear, source, NULL);
                self.message = savemessage;
-               setself(this);
        }
 
        if(ear.spawnflags & 16)
index 26975ab6d144885ff60efb777e6fe2f727b0e5bf..994d498c11e8b0a43056979fccd29ee5430542e7 100644 (file)
@@ -2,30 +2,29 @@
 /*QUAKED spawnfunc_trigger_monoflop (.5 .5 .5) (-8 -8 -8) (8 8 8)
 "Mono-flop" trigger gate... turns one trigger event into one "on" and one "off" event, separated by a delay of "wait"
 */
-void monoflop_use()
-{SELFPARAM();
-       self.nextthink = time + self.wait;
-       self.enemy = activator;
-       if(self.state)
+void monoflop_use(entity this, entity actor, entity trigger)
+{
+       this.nextthink = time + this.wait;
+       this.enemy = actor;
+       if(this.state)
                return;
-       self.state = 1;
-       SUB_UseTargets();
+       this.state = 1;
+       SUB_UseTargets(this, actor, trigger);
 }
-void monoflop_fixed_use()
-{SELFPARAM();
-       if(self.state)
+void monoflop_fixed_use(entity this, entity actor, entity trigger)
+{
+       if(this.state)
                return;
-       self.nextthink = time + self.wait;
-       self.state = 1;
-       self.enemy = activator;
-       SUB_UseTargets();
+       this.nextthink = time + this.wait;
+       this.state = 1;
+       this.enemy = actor;
+       SUB_UseTargets(this, actor, trigger);
 }
 
 void monoflop_think()
 {SELFPARAM();
-       self.state = 0;
-       activator = self.enemy;
-       SUB_UseTargets();
+       this.state = 0;
+       SUB_UseTargets(this, this.enemy, NULL);
 }
 
 void monoflop_reset(entity this)
@@ -36,14 +35,14 @@ void monoflop_reset(entity this)
 
 spawnfunc(trigger_monoflop)
 {
-       if(!self.wait)
-               self.wait = 1;
-       if(self.spawnflags & 1)
-               self.use = monoflop_fixed_use;
+       if(!this.wait)
+               this.wait = 1;
+       if(this.spawnflags & 1)
+               this.use = monoflop_fixed_use;
        else
-               self.use = monoflop_use;
-       self.think = monoflop_think;
-       self.state = 0;
-       self.reset = monoflop_reset;
+               this.use = monoflop_use;
+       this.think = monoflop_think;
+       this.state = 0;
+       this.reset = monoflop_reset;
 }
 #endif
index 3f0a4b27fef60d5058fba15f2298da394ae14950..ce7bba67321ce482a15c9f28bf414742029d9f49 100644 (file)
@@ -41,9 +41,7 @@ void multi_trigger()
 // don't trigger again until reset
        self.takedamage = DAMAGE_NO;
 
-       activator = self.enemy;
-       other = self.goalentity;
-       SUB_UseTargets();
+       SUB_UseTargets(self, self.enemy, self.goalentity);
 
        if (self.wait > 0)
        {
@@ -61,11 +59,11 @@ void multi_trigger()
        }
 }
 
-void multi_use()
-{SELFPARAM();
-       self.goalentity = other;
-       self.enemy = activator;
-       multi_trigger();
+void multi_use(entity this, entity actor, entity trigger)
+{
+       this.goalentity = trigger;
+       this.enemy = actor;
+       WITHSELF(this, multi_trigger());
 }
 
 void multi_touch()
index 78b3383fc0422f787fa68c075bd6bdd9c5514dd9..a50f62b7abd699f207746792a1693f7a07dd9c26 100644 (file)
@@ -8,9 +8,8 @@ void multivibrator_send()
 
        newstate = (time < cyclestart + self.wait);
 
-       activator = self;
        if(self.state != newstate)
-               SUB_UseTargets();
+               SUB_UseTargets(self, self, NULL);
        self.state = newstate;
 
        if(self.state)
@@ -19,20 +18,20 @@ void multivibrator_send()
                self.nextthink = cyclestart + self.wait + self.respawntime + 0.01;
 }
 
-void multivibrator_toggle()
-{SELFPARAM();
-       if(self.nextthink == 0)
+void multivibrator_toggle(entity this, entity actor, entity trigger)
+{
+       if(this.nextthink == 0)
        {
-               multivibrator_send();
+               WITHSELF(this, multivibrator_send());
        }
        else
        {
-               if(self.state)
+               if(this.state)
                {
-                       SUB_UseTargets();
-                       self.state = 0;
+                       SUB_UseTargets(this, actor, trigger);
+                       this.state = 0;
                }
-               self.nextthink = 0;
+               this.nextthink = 0;
        }
 }
 
index 147b6178a1e15abdeef8c6e924e295ce2137cfa1..dabbbd2d96b05acad53b2ee499377b7dc6383d6a 100644 (file)
@@ -1,11 +1,10 @@
 #ifdef SVQC
-void relay_activators_use()
-{SELFPARAM();
+void relay_activators_use(entity this, entity actor, entity trigger)
+{
        for(entity trg = world; (trg = find(trg, targetname, this.target)); )
        {
-               setself(trg);
                if (trg.setactive)
-                       trg.setactive(this.cnt);
+                       trg.setactive(trg, this.cnt);
                else
                {
                        //bprint("Not using setactive\n");
@@ -18,24 +17,23 @@ void relay_activators_use()
                                trg.active = this.cnt;
                }
        }
-       setself(this);
 }
 
 spawnfunc(relay_activate)
 {
-       self.cnt = ACTIVE_ACTIVE;
-       self.use = relay_activators_use;
+       this.cnt = ACTIVE_ACTIVE;
+       this.use = relay_activators_use;
 }
 
 spawnfunc(relay_deactivate)
 {
-       self.cnt = ACTIVE_NOT;
-       self.use = relay_activators_use;
+       this.cnt = ACTIVE_NOT;
+       this.use = relay_activators_use;
 }
 
 spawnfunc(relay_activatetoggle)
 {
-       self.cnt = ACTIVE_TOGGLE;
-       self.use = relay_activators_use;
+       this.cnt = ACTIVE_TOGGLE;
+       this.use = relay_activators_use;
 }
 #endif
index e45996bd855695593b1717e83e8b7f7551c700ad..ea90a06cb70d19865b24365bf582ebfbcadcfaee 100644 (file)
@@ -1,20 +1,19 @@
 #ifdef SVQC
-void trigger_relay_if_use()
-{SELFPARAM();
-       float n;
-       n = self.count;
+void trigger_relay_if_use(entity this, entity actor, entity trigger)
+{
+       int n = this.count;
 
        // TODO make this generic AND faster than nextent()ing through all, if somehow possible
-       n = (cvar_string(self.netname) == cvar_string(self.message));
-       if(self.spawnflags & 1)
+       n = (cvar_string(this.netname) == cvar_string(this.message));
+       if(this.spawnflags & 1)
                n = !n;
 
        if(n)
-               SUB_UseTargets();
+               SUB_UseTargets(this, actor, trigger);
 }
 
 spawnfunc(trigger_relay_if)
 {
-       self.use = trigger_relay_if_use;
+       this.use = trigger_relay_if_use;
 }
 #endif
index 193dba36825fe8ce1aefc43b06948c9d1a223277..2972d32bbf79b3e23fa6da66e4e9569e982a6824 100644 (file)
@@ -1,23 +1,23 @@
 #ifdef SVQC
-void trigger_relay_teamcheck_use()
-{SELFPARAM();
-       if(activator.team)
+void trigger_relay_teamcheck_use(entity this, entity actor, entity trigger)
+{
+       if(actor.team)
        {
-               if(self.spawnflags & 2)
+               if(this.spawnflags & 2)
                {
-                       if(DIFF_TEAM(activator, self))
-                               SUB_UseTargets();
+                       if(DIFF_TEAM(actor, this))
+                               SUB_UseTargets(this, actor, trigger);
                }
                else
                {
-                       if(SAME_TEAM(activator, self))
-                               SUB_UseTargets();
+                       if(SAME_TEAM(actor, this))
+                               SUB_UseTargets(this, actor, trigger);
                }
        }
        else
        {
-               if(self.spawnflags & 1)
-                       SUB_UseTargets();
+               if(this.spawnflags & 1)
+                       SUB_UseTargets(this, actor, trigger);
        }
 }
 
index 92ae805b5259641dd9e8cb3bd174b5df9b642a3e..c9b8147139aa8eb27b99a5b28694a41092e046ac 100644 (file)
@@ -1,12 +1,12 @@
 REGISTER_NET_LINKED(ENT_CLIENT_TRIGGER_TELEPORT)
 
 #ifdef SVQC
-void trigger_teleport_use()
-{SELFPARAM();
+void trigger_teleport_use(entity this, entity actor, entity trigger)
+{
        if(teamplay)
-               self.team = activator.team;
+               this.team = actor.team;
 #ifdef SVQC
-       self.SendFlags |= SF_TRIGGER_UPDATE;
+       this.SendFlags |= SF_TRIGGER_UPDATE;
 #endif
 }
 #endif
@@ -49,12 +49,11 @@ void Teleport_Touch ()
        e = Simple_TeleportPlayer(self, other);
 
 #ifdef SVQC
-       activator = other;
        string s = self.target; self.target = string_null;
-       SUB_UseTargets();
+       SUB_UseTargets(self, other, other); // TODO: should we be using other for trigger too?
        if (!self.target) self.target = s;
 
-       WITHSELF(e, SUB_UseTargets());
+       SUB_UseTargets(e, other, other);
 #endif
 }
 
index 1ca03fd4fefc819113b7b6aaae62ba1c9009d8aa..4493138d08dca032f149aaba09a4f8e5f2817f53 100644 (file)
@@ -1,11 +1,10 @@
-void SUB_DontUseTargets() { }
+void SUB_DontUseTargets(entity this, entity actor, entity trigger) { }
 
-void() SUB_UseTargets;
+void SUB_UseTargets(entity this, entity actor, entity trigger);
 
 void DelayThink()
 {SELFPARAM();
-       activator = this.enemy;
-       SUB_UseTargets ();
+       SUB_UseTargets (this, this.enemy, NULL);
        remove(this);
 }
 
@@ -184,22 +183,18 @@ match (string)self.target and call their .use function
 
 ==============================
 */
-void SUB_UseTargets()
-{SELFPARAM();
-       entity t, otemp, act;
-       string s;
-       float i;
-
+void SUB_UseTargets(entity this, entity actor, entity trigger)
+{
 //
 // check for a delay
 //
        if (this.delay)
        {
        // create a temp object to fire at a later time
-               t = new(DelayedUse);
+               entity t = new(DelayedUse);
                t.nextthink = time + this.delay;
                t.think = DelayThink;
-               t.enemy = activator;
+               t.enemy = actor;
                t.message = this.message;
                t.killtarget = this.killtarget;
                t.target = this.target;
@@ -209,18 +204,19 @@ void SUB_UseTargets()
                return;
        }
 
+       string s;
 
 //
 // print the message
 //
 #ifdef SVQC
        if(this)
-       if(IS_PLAYER(activator) && this.message != "")
-       if(IS_REAL_CLIENT(activator))
+       if(IS_PLAYER(actor) && this.message != "")
+       if(IS_REAL_CLIENT(actor))
        {
-               centerprint(activator, this.message);
+               centerprint(actor, this.message);
                if (this.noise == "")
-                       play2(activator, SND(TALK));
+                       play2(actor, SND(TALK));
        }
 
 //
@@ -229,7 +225,7 @@ void SUB_UseTargets()
        s = this.killtarget;
        if (s != "")
        {
-               for(t = world; (t = find(t, targetname, s)); )
+               for(entity t = world; (t = find(t, targetname, s)); )
                        remove(t);
        }
 #endif
@@ -237,13 +233,11 @@ void SUB_UseTargets()
 //
 // fire targets
 //
-       act = activator;
-       otemp = other;
 
        if(this.target_random)
                RandomSelection_Init();
 
-       for(i = 0; i < 4; ++i)
+       for(int i = 0; i < 4; ++i)
        {
                switch(i)
                {
@@ -257,38 +251,34 @@ void SUB_UseTargets()
                {
                        // Flag to set func_clientwall state
                        // 1 == deactivate, 2 == activate, 0 == do nothing
-                       float aw_flag = this.antiwall_flag;
-                       for(t = world; (t = find(t, targetname, s)); )
-                       if(t.use)
+                       int aw_flag = this.antiwall_flag;
+                       for(entity t = world; (t = find(t, targetname, s)); )
                        {
-                               if(this.target_random)
+                               if(t.use)
                                {
-                                       RandomSelection_Add(t, 0, string_null, 1, 0);
-                               }
-                               else
-                               {
-                                       if (t.classname == "func_clientwall" || t.classname == "func_clientillusionary")
-                                               t.antiwall_flag = aw_flag;
-                                       setself(t);
-                                       other = this;
-                                       activator = act;
-                                       self.use();
+                                       if(this.target_random)
+                                       {
+                                               RandomSelection_Add(t, 0, string_null, 1, 0);
+                                       }
+                                       else
+                                       {
+                                               if (t.classname == "func_clientwall" || t.classname == "func_clientillusionary")
+                                                       t.antiwall_flag = aw_flag;
+
+                                               t.use(t, actor, this);
+                                       }
                                }
                        }
                }
        }
 
        if(this.target_random && RandomSelection_chosen_ent)
-       {
-               setself(RandomSelection_chosen_ent);
-               other = this;
-               activator = act;
-               self.use();
-       }
+               RandomSelection_chosen_ent.use(RandomSelection_chosen_ent, actor, this);
+}
 
-       activator = act;
-       setself(this);
-       other = otemp;
+void SUB_UseTargets_self()
+{SELFPARAM();
+       SUB_UseTargets(this, NULL, NULL);
 }
 
 #ifdef CSQC
index 1502be25114f1ddfb5bf90192c796d9f37d2febb..2578c1e6dba117bc781648eb08e6bfa94f5aeccc 100644 (file)
@@ -455,7 +455,7 @@ void turret_projectile_damage(entity this, entity inflictor, entity attacker, fl
        this.health     -= damage;
        //this.realowner = attacker; // Dont change realowner, it does not make much sense for turrets
        if(this.health <= 0)
-               WITHSELF(this, W_PrepareExplosionByDamage(this.owner, turret_projectile_explode));
+               W_PrepareExplosionByDamage(this, this.owner, turret_projectile_explode);
 }
 
 entity turret_projectile(Sound _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim)
@@ -1179,16 +1179,16 @@ void turret_think()
        When .used a turret switch team to activator.team.
        If activator is world, the turret go inactive.
 */
-void turret_use()
-{SELFPARAM();
-       LOG_TRACE("Turret ",self.netname, " used by ", activator.classname, "\n");
+void turret_use(entity this, entity actor, entity trigger)
+{
+       LOG_TRACE("Turret ",this.netname, " used by ", actor.classname, "\n");
 
-       self.team = activator.team;
+       this.team = actor.team;
 
-       if(self.team == 0)
-               self.active = ACTIVE_NOT;
+       if(this.team == 0)
+               this.active = ACTIVE_NOT;
        else
-               self.active = ACTIVE_ACTIVE;
+               this.active = ACTIVE_ACTIVE;
 
 }
 
index 798e141ecd2e5caa4e12765eee020ab8830a0f6c..0bdfca46ed2cec92acc84a9f96d81f34114e4385 100644 (file)
@@ -50,7 +50,7 @@ void ewheel_move_path()
             if (self.pathgoal)
             {
                 if (self.pathgoal.use)
-                    self.pathgoal.use();
+                    self.pathgoal.use(self.pathgoal, NULL, NULL);
 
                 if (self.pathgoal.enemy)
                 {
index 918ce4ca3a1bbc91c1c14de41af6595399379855..51ace9a7d0ddab65889b3c062d587743cdc022e1 100644 (file)
@@ -109,7 +109,7 @@ void walker_rocket_damage(entity this, entity inflictor, entity attacker, float
     this.velocity = this.velocity + vforce;
 
     if (this.health <= 0)
-        WITHSELF(this, W_PrepareExplosionByDamage(this.owner, walker_rocket_explode));
+        W_PrepareExplosionByDamage(this, this.owner, walker_rocket_explode);
 }
 
 #define WALKER_ROCKET_MOVE movelib_move_simple(self, newdir, (autocvar_g_turrets_unit_walker_rocket_speed), (autocvar_g_turrets_unit_walker_rocket_turnrate)); UpdateCSQCProjectile(self)
@@ -313,7 +313,7 @@ void walker_move_path()
             if (self.pathgoal)
             {
                 if (self.pathgoal.use)
-                    self.pathgoal.use();
+                    self.pathgoal.use(self, NULL, NULL);
 
                 if (self.pathgoal.enemy)
                 {
index de2c32513b064f3c9e73dc116a7b75eea3b4e865..066033a175a1791a2ce05326b223de57db40d4ae 100644 (file)
@@ -2,6 +2,7 @@
 #define COMMON_UTIL_H
 
 #ifndef MENUQC
+
 vector real_origin(entity ent);
 #endif
 
index 35b6c677f957de6fbfe84ee53ad28a78ce4aa3e7..fc44613e5d111cbafd02f69700f9552b09fb7678 100644 (file)
@@ -208,7 +208,7 @@ void vehicles_projectile_damage(entity this, entity inflictor, entity attacker,
        {
                this.takedamage = DAMAGE_NO;
                this.event_damage = func_null;
-               this.think = this.use;
+               this.think = adaptor_think2use;
                this.nextthink = time;
        }
 }
@@ -232,6 +232,11 @@ void vehicles_projectile_explode()
        remove (self);
 }
 
+void vehicles_projectile_explode_use(entity this, entity actor, entity trigger)
+{
+       WITHSELF(this, vehicles_projectile_explode());
+}
+
 entity vehicles_projectile(entity this, string _mzlfx, Sound _mzlsound,
                                                   vector _org, vector _vel,
                                                   float _dmg, float _radi, float _force,  float _size,
@@ -257,7 +262,7 @@ entity vehicles_projectile(entity this, string _mzlfx, Sound _mzlsound,
        proj.bot_dodgerating  = _dmg;
        proj.velocity            = _vel;
        proj.touch                      = vehicles_projectile_explode;
-       proj.use                          = vehicles_projectile_explode;
+       proj.use                          = vehicles_projectile_explode_use;
        proj.owner                      = this;
        proj.realowner          = _owner;
        proj.think                      = SUB_Remove_self;
@@ -541,29 +546,29 @@ void vehicles_setreturn(entity veh)
 
 }
 
-void vehicle_use()
-{SELFPARAM();
-       LOG_TRACE("vehicle ",self.netname, " used by ", activator.classname, "\n");
+void vehicle_use(entity this, entity actor, entity trigger)
+{
+       LOG_TRACE("vehicle ",this.netname, " used by ", actor.classname, "\n");
 
-       self.tur_head.team = activator.team;
+       this.tur_head.team = actor.team;
 
-       if(self.tur_head.team == 0)
-               self.active = ACTIVE_NOT;
+       if(this.tur_head.team == 0)
+               this.active = ACTIVE_NOT;
        else
-               self.active = ACTIVE_ACTIVE;
+               this.active = ACTIVE_ACTIVE;
 
-       if(self.active == ACTIVE_ACTIVE && !IS_DEAD(self) && !gameover)
+       if(this.active == ACTIVE_ACTIVE && !IS_DEAD(this) && !gameover)
        {
-               LOG_TRACE("Respawning vehicle: ", self.netname, "\n");
-               if(self.effects & EF_NODRAW)
+               LOG_TRACE("Respawning vehicle: ", this.netname, "\n");
+               if(this.effects & EF_NODRAW)
                {
-                       self.think = vehicles_spawn;
-                       self.nextthink = time + 3;
+                       this.think = vehicles_spawn;
+                       this.nextthink = time + 3;
                }
                else
                {
-                       vehicles_setreturn(self);
-                       vehicles_reset_colors(self);
+                       vehicles_setreturn(this);
+                       vehicles_reset_colors(this);
                }
        }
 }
index ee86a622974ef0bff1fc37826730ff1978a69565..36655fd1de8a9bf56683ad17fb9df789ab42440a 100644 (file)
@@ -74,7 +74,7 @@ void racer_rocket_tracker()
 
     if (IS_DEAD(self.owner) || self.cnt < time)
     {
-        self.use();
+        self.use(self, NULL, NULL);
         return;
     }
 
@@ -126,7 +126,7 @@ void racer_rocket_groundhugger()
 
     if(IS_DEAD(self.owner) || self.cnt < time)
     {
-        self.use();
+        self.use(self, NULL, NULL);
         return;
     }
 
index afa57de2dad1f0fa328520996595a4892b716b0d..dd209676d49dce7f7206b02c9c286ddc145dc139 100644 (file)
@@ -23,7 +23,7 @@ void spiderbot_rocket_unguided()
     UpdateCSQCProjectile(self);
 
     if (IS_DEAD(self.owner) || self.cnt < time || vdist(self.pos1 - self.origin, <, 16))
-        self.use();
+        self.use(self, NULL, NULL);
 }
 
 void spiderbot_rocket_guided()
@@ -43,7 +43,7 @@ void spiderbot_rocket_guided()
     UpdateCSQCProjectile(self);
 
     if (IS_DEAD(self.owner) || self.cnt < time)
-        self.use();
+        self.use(self, NULL, NULL);
 }
 
 void spiderbot_guide_release(entity this)
index 3c23e33e779ffb64c059d6742210d6965514d91b..cf391b034a3e76807eab3187e41cb287e33f257b 100644 (file)
@@ -239,6 +239,11 @@ void W_Arc_Bolt_Explode()
        remove(self);
 }
 
+void W_Arc_Bolt_Explode_use(entity this, entity actor, entity trigger)
+{
+       WITHSELF(this, W_Arc_Bolt_Explode());
+}
+
 void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 {
        if(this.health <= 0)
@@ -251,13 +256,13 @@ void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float dam
        this.angles = vectoangles(this.velocity);
 
        if(this.health <= 0)
-               WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.think));
+               W_PrepareExplosionByDamage(this, attacker, this.think);
 }
 
 void W_Arc_Bolt_Touch()
 {SELFPARAM();
        PROJECTILE_TOUCH;
-       self.use();
+       self.use(this, NULL, NULL);
 }
 
 void W_Arc_Attack_Bolt(Weapon thiswep)
@@ -282,7 +287,7 @@ void W_Arc_Attack_Bolt(Weapon thiswep)
        missile.damagedbycontents = true;
 
        missile.touch = W_Arc_Bolt_Touch;
-       missile.use = W_Arc_Bolt_Explode;
+       missile.use = W_Arc_Bolt_Explode_use;
        missile.think = adaptor_think2use_hittype_splash;
        missile.nextthink = time + WEP_CVAR(arc, bolt_lifetime);
        PROJECTILE_MAKETRIGGER(missile);
index 2d930ad7212a8b83920e659e8b6992b0e81ef7c2..1cde73d4466bcb887976050518c74820d63c3a8e 100644 (file)
@@ -344,7 +344,7 @@ void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float d
        this.angles = vectoangles(this.velocity);
 
        if(this.health <= 0)
-               WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_Devastator_Explode));
+               W_PrepareExplosionByDamage(this, attacker, W_Devastator_Explode);
 }
 
 void W_Devastator_Attack(Weapon thiswep)
index b75106806269d839cd7af02118a72bbf9cc14a08..315ea5a5a470731d5f699df18ae81c1e1e4eeea0 100644 (file)
@@ -191,6 +191,11 @@ void W_Electro_Explode()
        remove(self);
 }
 
+void W_Electro_Explode_use(entity this, entity actor, entity trigger)
+{
+       WITHSELF(this, W_Electro_Explode());
+}
+
 void W_Electro_TouchExplode()
 {
        PROJECTILE_TOUCH;
@@ -201,7 +206,7 @@ void W_Electro_Bolt_Think()
 {SELFPARAM();
        if(time >= self.ltime)
        {
-               self.use();
+               this.use(this, NULL, NULL);
                return;
        }
 
@@ -242,7 +247,7 @@ void W_Electro_Bolt_Think()
 
                // if we triggered an orb, should we explode? if not, lets try again next time
                if(found && WEP_CVAR_PRI(electro, midaircombo_explode))
-                       { self.use(); }
+                       { this.use(this, NULL, NULL); }
                else
                        { self.nextthink = min(time + WEP_CVAR_PRI(electro, midaircombo_interval), self.ltime); }
        }
@@ -272,7 +277,7 @@ void W_Electro_Attack_Bolt(Weapon thiswep)
        proj.owner = proj.realowner = self;
        proj.bot_dodge = true;
        proj.bot_dodgerating = WEP_CVAR_PRI(electro, damage);
-       proj.use = W_Electro_Explode;
+       proj.use = W_Electro_Explode_use;
        proj.think = W_Electro_Bolt_Think;
        proj.nextthink = time;
        proj.ltime = time + WEP_CVAR_PRI(electro, lifetime);
@@ -342,7 +347,7 @@ void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float
                }
                else
                {
-                       this.use = W_Electro_Explode;
+                       this.use = W_Electro_Explode_use;
                        this.think = adaptor_think2use; // not _hittype_splash, as this runs "immediately"
                }
        }
@@ -369,7 +374,7 @@ void W_Electro_Attack_Orb(Weapon thiswep)
 
        entity proj = new(electro_orb);
        proj.owner = proj.realowner = self;
-       proj.use = W_Electro_Explode;
+       proj.use = W_Electro_Explode_use;
        proj.think = adaptor_think2use_hittype_splash;
        proj.bot_dodge = true;
        proj.bot_dodgerating = WEP_CVAR_SEC(electro, damage);
index a6db7c9b71ce578845d5058793ed29a1444a340b..4bbcdb68e50498af226bafb5a21f8bead1f2bf8b 100644 (file)
@@ -112,6 +112,11 @@ void W_Fireball_Explode()
        remove(self);
 }
 
+void W_Fireball_Explode_use(entity this, entity actor, entity trigger)
+{
+       WITHSELF(this, W_Fireball_Explode());
+}
+
 void W_Fireball_TouchExplode()
 {
        PROJECTILE_TOUCH;
@@ -179,7 +184,7 @@ void W_Fireball_Damage(entity this, entity inflictor, entity attacker, float dam
        if(this.health <= 0)
        {
                this.cnt = 1;
-               WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_Fireball_Explode));
+               W_PrepareExplosionByDamage(this, attacker, W_Fireball_Explode);
        }
 }
 
@@ -196,7 +201,7 @@ void W_Fireball_Attack1()
        proj.bot_dodge = true;
        proj.bot_dodgerating = WEP_CVAR_PRI(fireball, damage);
        proj.pushltime = time + WEP_CVAR_PRI(fireball, lifetime);
-       proj.use = W_Fireball_Explode;
+       proj.use = W_Fireball_Explode_use;
        proj.think = W_Fireball_Think;
        proj.nextthink = time;
        proj.health = WEP_CVAR_PRI(fireball, health);
index d1ce0578bd91e2db18eaa520b8ce2065ad917987..4b0367fb5e6478079b1fc6ddc91c9f5467821105 100644 (file)
@@ -71,6 +71,11 @@ void W_Hagar_Explode()
        remove(self);
 }
 
+void W_Hagar_Explode_use(entity this, entity actor, entity trigger)
+{
+       WITHSELF(this, W_Hagar_Explode());
+}
+
 void W_Hagar_Explode2()
 {SELFPARAM();
        self.event_damage = func_null;
@@ -79,6 +84,11 @@ void W_Hagar_Explode2()
        remove(self);
 }
 
+void W_Hagar_Explode2_use(entity this, entity actor, entity trigger)
+{
+       WITHSELF(this, W_Hagar_Explode2());
+}
+
 void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 {
        if(this.health <= 0)
@@ -100,13 +110,13 @@ void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage
        this.angles = vectoangles(this.velocity);
 
        if(this.health <= 0)
-               WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.think));
+               W_PrepareExplosionByDamage(this, attacker, this.think);
 }
 
 void W_Hagar_Touch()
 {SELFPARAM();
        PROJECTILE_TOUCH;
-       self.use();
+       this.use(this, NULL, NULL);
 }
 
 void W_Hagar_Touch2()
@@ -114,7 +124,7 @@ void W_Hagar_Touch2()
        PROJECTILE_TOUCH;
 
        if(self.cnt > 0 || other.takedamage == DAMAGE_AIM) {
-               self.use();
+               this.use(this, NULL, NULL);
        } else {
                self.cnt++;
                Send_Effect(EFFECT_HAGAR_BOUNCE, self.origin, self.velocity, 1);
@@ -146,7 +156,7 @@ void W_Hagar_Attack(Weapon thiswep)
        missile.damagedbycontents = true;
 
        missile.touch = W_Hagar_Touch;
-       missile.use = W_Hagar_Explode;
+       missile.use = W_Hagar_Explode_use;
        missile.think = adaptor_think2use_hittype_splash;
        missile.nextthink = time + WEP_CVAR_PRI(hagar, lifetime);
        PROJECTILE_MAKETRIGGER(missile);
@@ -189,7 +199,7 @@ void W_Hagar_Attack2(Weapon thiswep)
 
        missile.touch = W_Hagar_Touch2;
        missile.cnt = 0;
-       missile.use = W_Hagar_Explode2;
+       missile.use = W_Hagar_Explode2_use;
        missile.think = adaptor_think2use_hittype_splash;
        missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand);
        PROJECTILE_MAKETRIGGER(missile);
@@ -247,7 +257,7 @@ void W_Hagar_Attack2_Load_Release(.entity weaponentity)
                missile.damagedbycontents = true;
 
                missile.touch = W_Hagar_Touch; // not bouncy
-               missile.use = W_Hagar_Explode2;
+               missile.use = W_Hagar_Explode2_use;
                missile.think = adaptor_think2use_hittype_splash;
                missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand);
                PROJECTILE_MAKETRIGGER(missile);
index 91c2840e6d35e47fefeb0dc3a1a12905949f3c7c..fac16c48716422cdc800cb1e62cd3c999947ce13 100644 (file)
@@ -118,6 +118,11 @@ void W_Hook_Explode2()
        self.movetype = MOVETYPE_NONE;
 }
 
+void W_Hook_Explode2_use(entity this, entity actor, entity trigger)
+{
+       WITHSELF(this, W_Hook_Explode2());
+}
+
 void W_Hook_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 {
        if(this.health <= 0)
@@ -129,13 +134,13 @@ void W_Hook_Damage(entity this, entity inflictor, entity attacker, float damage,
        this.health = this.health - damage;
 
        if(this.health <= 0)
-               WITHSELF(this, W_PrepareExplosionByDamage(this.realowner, W_Hook_Explode2));
+               W_PrepareExplosionByDamage(this, this.realowner, W_Hook_Explode2);
 }
 
 void W_Hook_Touch2()
 {SELFPARAM();
        PROJECTILE_TOUCH;
-       self.use();
+       this.use(this, NULL, NULL);
 }
 
 void W_Hook_Attack2(Weapon thiswep, entity actor)
@@ -155,7 +160,7 @@ void W_Hook_Attack2(Weapon thiswep, entity actor)
 
        gren.nextthink = time + WEP_CVAR_SEC(hook, lifetime);
        gren.think = adaptor_think2use_hittype_splash;
-       gren.use = W_Hook_Explode2;
+       gren.use = W_Hook_Explode2_use;
        gren.touch = W_Hook_Touch2;
 
        gren.takedamage = DAMAGE_YES;
index c6e0fb86bce692d211e72ec39a24f89f29886060..9a02c850bbb88685170df7f2cb97fd97ddca7912 100644 (file)
@@ -308,7 +308,7 @@ void W_MineLayer_Damage(entity this, entity inflictor, entity attacker, float da
        this.angles = vectoangles(this.velocity);
 
        if(this.health <= 0)
-               WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_MineLayer_Explode));
+               W_PrepareExplosionByDamage(this, attacker, W_MineLayer_Explode);
 }
 
 void W_MineLayer_Attack(Weapon thiswep)
index 7c9b908947e31fd78e40e0613d7aa38147a68906..5fbacc7ba4b958cffef6f406d7b1ce53d76853d9 100644 (file)
@@ -84,6 +84,11 @@ void W_Mortar_Grenade_Explode()
        remove(self);
 }
 
+void W_Mortar_Grenade_Explode_use(entity this, entity actor, entity trigger)
+{
+       WITHSELF(this, W_Mortar_Grenade_Explode());
+}
+
 void W_Mortar_Grenade_Explode2()
 {SELFPARAM();
        if(other.takedamage == DAMAGE_AIM)
@@ -104,6 +109,10 @@ void W_Mortar_Grenade_Explode2()
        remove(self);
 }
 
+void W_Mortar_Grenade_Explode2_use(entity this, entity actor, entity trigger)
+{
+       WITHSELF(this, W_Mortar_Grenade_Explode2());
+}
 
 void W_Mortar_Grenade_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 {
@@ -116,7 +125,7 @@ void W_Mortar_Grenade_Damage(entity this, entity inflictor, entity attacker, flo
        this.health = this.health - damage;
 
        if(this.health <= 0)
-               WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.use));
+               W_PrepareExplosionByDamage(this, attacker, adaptor_think2use);
 }
 
 void W_Mortar_Grenade_Think1()
@@ -138,7 +147,7 @@ void W_Mortar_Grenade_Touch1()
        PROJECTILE_TOUCH;
        if(other.takedamage == DAMAGE_AIM || WEP_CVAR_PRI(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile
        {
-               self.use();
+               this.use(this, NULL, NULL);
        }
        else if(WEP_CVAR_PRI(mortar, type) == 1) // bounce
        {
@@ -170,7 +179,7 @@ void W_Mortar_Grenade_Touch2()
        PROJECTILE_TOUCH;
        if(other.takedamage == DAMAGE_AIM || WEP_CVAR_SEC(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile
        {
-               self.use();
+               this.use(this, NULL, NULL);
        }
        else if(WEP_CVAR_SEC(mortar, type) == 1) // bounce
        {
@@ -227,7 +236,7 @@ void W_Mortar_Attack(Weapon thiswep)
        gren.cnt = time + WEP_CVAR_PRI(mortar, lifetime);
        gren.nextthink = time;
        gren.think = W_Mortar_Grenade_Think1;
-       gren.use = W_Mortar_Grenade_Explode;
+       gren.use = W_Mortar_Grenade_Explode_use;
        gren.touch = W_Mortar_Grenade_Touch1;
 
        gren.takedamage = DAMAGE_YES;
@@ -274,7 +283,7 @@ void W_Mortar_Attack2(Weapon thiswep)
 
        gren.nextthink = time + WEP_CVAR_SEC(mortar, lifetime);
        gren.think = adaptor_think2use_hittype_splash;
-       gren.use = W_Mortar_Grenade_Explode2;
+       gren.use = W_Mortar_Grenade_Explode2_use;
        gren.touch = W_Mortar_Grenade_Touch2;
 
        gren.takedamage = DAMAGE_YES;
index 34b6e895f3af59977f130f90b9cd8ec3f83fcc90..6dffec39d3378eddba5453c46bc45e171cc4bb50 100644 (file)
@@ -220,7 +220,7 @@ void W_Seeker_Missile_Damage(entity this, entity inflictor, entity attacker, flo
                this.health = this.health - damage;
 
        if(this.health <= 0)
-               WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_Seeker_Missile_Explode));
+               W_PrepareExplosionByDamage(this, attacker, W_Seeker_Missile_Explode);
 }
 
 /*
@@ -313,6 +313,11 @@ void W_Seeker_Flac_Explode()
        remove(self);
 }
 
+void W_Seeker_Flac_Explode_use(entity this, entity actor, entity trigger)
+{
+       WITHSELF(this, W_Seeker_Flac_Explode());
+}
+
 void W_Seeker_Flac_Touch()
 {
        PROJECTILE_TOUCH;
@@ -355,7 +360,7 @@ void W_Seeker_Fire_Flac(Weapon thiswep)
        missile.bot_dodge               = true;
        missile.bot_dodgerating = WEP_CVAR(seeker, flac_damage);
        missile.touch                   = W_Seeker_Flac_Explode;
-       missile.use                     = W_Seeker_Flac_Explode;
+       missile.use                     = W_Seeker_Flac_Explode_use;
        missile.think                   = adaptor_think2use_hittype_splash;
        missile.nextthink               = time + WEP_CVAR(seeker, flac_lifetime) + WEP_CVAR(seeker, flac_lifetime_rand);
        missile.solid                   = SOLID_BBOX;
index 933124564c1c37d5c6a1e118b85aafa7d5855421..8ce6caadd546b337e0ccd88c3ade4cfcf5400b6d 100644 (file)
@@ -227,6 +227,11 @@ void W_RocketMinsta_Laser_Explode ()
        remove(self);
 }
 
+void W_RocketMinsta_Laser_Explode_use(entity this, entity actor, entity trigger)
+{
+       WITHSELF(this, W_RocketMinsta_Laser_Explode());
+}
+
 void W_RocketMinsta_Laser_Touch ()
 {SELFPARAM();
        PROJECTILE_TOUCH;
@@ -258,7 +263,7 @@ void W_RocketMinsta_Attack2()
         proj.owner = proj.realowner = self;
         proj.bot_dodge = true;
         proj.bot_dodgerating = autocvar_g_rm_laser_damage;
-        proj.use = W_RocketMinsta_Laser_Explode;
+        proj.use = W_RocketMinsta_Laser_Explode_use;
         proj.think = adaptor_think2use_hittype_splash;
         proj.nextthink = time + autocvar_g_rm_laser_lifetime;
         PROJECTILE_MAKETRIGGER(proj);
@@ -310,7 +315,7 @@ void W_RocketMinsta_Attack3 ()
         proj.owner = proj.realowner = self;
         proj.bot_dodge = true;
         proj.bot_dodgerating = autocvar_g_rm_laser_damage;
-        proj.use = W_RocketMinsta_Laser_Explode;
+        proj.use = W_RocketMinsta_Laser_Explode_use;
         proj.think = adaptor_think2use_hittype_splash;
         proj.nextthink = time + autocvar_g_rm_laser_lifetime;
         PROJECTILE_MAKETRIGGER(proj);
index ce39bca1bda2ff74ead4a9bb5d9a1399a120c132..d0125b5e315c83d2a11c57da8a54785b8157211d 100644 (file)
@@ -41,4 +41,7 @@
 
 #pragma noref 0
 
+#define use use1
+.void(entity this, entity actor, entity trigger) use;
+
 #endif
index 783ac036faf07c3e645cce833b78c3bb6ab5e1d1..e2668a54b7cc5173d2aad78b1b4681f0a54fbc30 100644 (file)
@@ -28,4 +28,7 @@ MACRO_END
 
 #pragma noref 0
 
+#define use use1
+.void(entity this, entity actor, entity trigger) use;
+
 #endif
index 31d7d07c80db730f1db4f376a71c3f6f6dae1de9..092a8945b7a25faf0286cef3a7234c315b837772 100644 (file)
@@ -37,9 +37,9 @@
 void touch_self() { SELFPARAM(); this.selftouch(this); }
 #define settouch(e, f) (e.touch = touch_self, e.selftouch = f)
 
-.void(entity this) selfuse;
-void use_self() { SELFPARAM(); this.selfuse(this); }
-#define setuse(e, f) (e.use = use_self, e.selfuse = f)
+//.void(entity this) selfuse;
+//void use_self() { SELFPARAM(); this.selfuse(this); }
+//#define setuse(e, f) (e.use = use_self, e.selfuse = f)
 
 .void(entity this) selfthink;
 void think_self() { SELFPARAM(); this.selfthink(this); }
index 2b860d6f4311283a905d8d48c760402513ba06e6..f8260b5ad0a7c3c2b7c4fb52bef6699efe7ade73 100644 (file)
@@ -241,21 +241,18 @@ void WarpZone_Touch ()
        {
 #ifdef SVQC
                string save1, save2;
-               activator = other;
 
                save1 = this.target; this.target = string_null;
                save2 = this.target3; this.target3 = string_null;
-               SUB_UseTargets();
+               SUB_UseTargets(this, other, other); // use other too?
                if (!this.target) this.target = save1;
                if (!this.target3) this.target3 = save2;
 
-               setself(this.enemy);
                save1 = this.target; this.target = string_null;
                save2 = this.target2; this.target2 = string_null;
-               SUB_UseTargets();
+               SUB_UseTargets(this.enemy, other, other); // use other too?
                if (!this.target) this.target = save1;
                if (!this.target2) this.target2 = save2;
-               setself(this);
 #endif
        }
        else
@@ -412,27 +409,19 @@ float WarpZone_CheckProjectileImpact(entity player)
        player.velvec = player.warpzone_oldvelocity;
        if(WarpZone_Teleport(wz, player, 0, 1))
        {
-               entity oldself;
                string save1, save2;
 
-               oldself = self;
-               self = wz;
-               other = player;
-               activator = player;
-
-               save1 = self.target; self.target = string_null;
-               save2 = self.target3; self.target3 = string_null;
-               SUB_UseTargets();
-               if (!self.target) self.target = save1;
-               if (!self.target3) self.target3 = save2;
-
-               self = self.enemy;
-               save1 = self.target; self.target = string_null;
-               save2 = self.target2; self.target2 = string_null;
-               SUB_UseTargets();
-               if (!self.target) self.target = save1;
-               if (!self.target2) self.target2 = save2;
-               self = oldself;
+               save1 = wz.target; wz.target = string_null;
+               save2 = wz.target3; wz.target3 = string_null;
+               SUB_UseTargets(wz, player, player);
+               if (!wz.target) wz.target = save1;
+               if (!wz.target3) wz.target3 = save2;
+
+               save1 = wz.enemy.target; wz.enemy.target = string_null;
+               save2 = wz.enemy.target2; wz.enemy.target2 = string_null;
+               SUB_UseTargets(wz.enemy, player, player);
+               if (!wz.enemy.target) wz.enemy.target = save1;
+               if (!wz.enemy.target2) wz.enemy.target2 = save2;
        }
        else
        {
@@ -906,8 +895,8 @@ bool visible_to_some_client(entity ent)
        ));
        return false;
 }
-void trigger_warpzone_reconnect_use()
-{SELFPARAM();
+void trigger_warpzone_reconnect_use(entity this, entity actor, entity trigger)
+{
        // NOTE: this matches for target, not targetname, but of course
        // targetname must be set too on the other entities
        for(entity e = warpzone_first; e; e = e.warpzone_next)
index e13678dce5995e6381c3dd248cdb275aecc174a8..add6d535564b5e9bd4a855cfede7582678436c24 100644 (file)
@@ -675,8 +675,7 @@ float CheatCommand(float argc)
                        IS_CHEAT(0, argc, 0);
                        setself(spawn());
                        self.target = argv(1);
-                       activator = this;
-                       SUB_UseTargets();
+                       SUB_UseTargets(self, this, NULL);
                        remove(self);
                        setself(this);
                        DID_CHEAT();
@@ -685,8 +684,7 @@ float CheatCommand(float argc)
                        IS_CHEAT(0, argc, 0);
                        setself(spawn());
                        self.killtarget = argv(1);
-                       activator = this;
-                       SUB_UseTargets();
+                       SUB_UseTargets(self, this, NULL);
                        remove(self);
                        setself(this);
                        DID_CHEAT();
index ffbb55087bef4ac48a98e36c8d9402fc9c7eb64c..c157530fa7d39b9cbbb1e7597ce03aba5db0aa58 100644 (file)
@@ -629,9 +629,7 @@ void PutClientInServer()
                {
                        string s = spot.target;
                        spot.target = string_null;
-                       WITH(entity, activator, this, LAMBDA(
-                               WITHSELF(spot, SUB_UseTargets())
-                       ));
+                       SUB_UseTargets(spot, this, NULL);
                        spot.target = s;
                }
 
index 7124e4468f3f6cf82878c23ec71b251cad460760..29374036cf4c4d5e7007b1d261ef1e2166e73563 100644 (file)
@@ -299,8 +299,8 @@ void W_Porto_Remove (entity p);
 .entity ballcarried; // Also used for keepaway
 float g_nexball_meter_period;
 
-void SUB_DontUseTargets();
-void SUB_UseTargets();
+void SUB_DontUseTargets(entity this, entity actor, entity trigger);
+void SUB_UseTargets(entity this, entity actor, entity trigger);
 
 .void(entity this) reset; // if set, an entity is reset using this
 .void() reset2; // if set, an entity is reset using this (after calling ALL the reset functions for other entities)
@@ -384,7 +384,7 @@ const float ACTIVE_IDLE     = 2;
 const float ACTIVE_BUSY        = 2;
 const float ACTIVE_TOGGLE      = 3;
 .float active;
-.void (float act_state) setactive;
+.void (entity this, int act_state) setactive;
 .entity realowner;
 
 //float serverflags;
index 5e9273f7cd43702f62592c461ea8ecabefe9ab66..352f0be430469aa3c10fa698918ee0f91b9f92dc 100644 (file)
@@ -82,13 +82,12 @@ void dynlight_find_target(entity this)
        self.think = dynlight_think;
        self.nextthink = time + 0.1;
 }
-void dynlight_use()
+void dynlight_use(entity this, entity actor, entity trigger)
 {
-    SELFPARAM();
-       if (self.light_lev == 0)
-               self.light_lev = self.lefty;
+       if (this.light_lev == 0)
+               this.light_lev = this.lefty;
        else
-               self.light_lev = 0;
+               this.light_lev = 0;
 }
 spawnfunc(dynlight)
 {
index baca561786a00bcf9da35e7883100fd622242951..6623a0778e7c41be3db9d3677dd696b19c8c2e96 100644 (file)
@@ -16,39 +16,39 @@ class(BGMScript) .float bgmscriptrelease;
 
 .float modelscale;
 
-void g_model_setcolormaptoactivator ()
-{SELFPARAM();
+void g_model_setcolormaptoactivator(entity this, entity actor, entity trigger)
+{
        if(teamplay)
        {
-               if(activator.team)
-                       self.colormap = (activator.team - 1) * 0x11;
+               if(actor.team)
+                       this.colormap = (actor.team - 1) * 0x11;
                else
-                       self.colormap = 0x00;
+                       this.colormap = 0x00;
        }
        else
-               self.colormap = floor(random() * 256);
-       self.colormap |= BIT(10); // RENDER_COLORMAPPED
+               this.colormap = floor(random() * 256);
+       this.colormap |= BIT(10); // RENDER_COLORMAPPED
 }
 
-void g_clientmodel_setcolormaptoactivator ()
-{SELFPARAM();
-       g_model_setcolormaptoactivator();
-       self.SendFlags |= (BIT(3) | BIT(0));
+void g_clientmodel_setcolormaptoactivator(entity this, entity actor, entity trigger)
+{
+       g_model_setcolormaptoactivator(this, actor, trigger);
+       this.SendFlags |= (BIT(3) | BIT(0));
 }
 
-void g_clientmodel_use()
-{SELFPARAM();
-       if (self.antiwall_flag == 1)
+void g_clientmodel_use(entity this, entity actor, entity trigger)
+{
+       if (this.antiwall_flag == 1)
        {
-               self.inactive = 1;
-               self.solid = SOLID_NOT;
+               this.inactive = 1;
+               this.solid = SOLID_NOT;
        }
-       else if (self.antiwall_flag == 2)
+       else if (this.antiwall_flag == 2)
        {
-               self.inactive = 0;
-               self.solid = self.default_solid;
+               this.inactive = 0;
+               this.solid = this.default_solid;
        }
-       g_clientmodel_setcolormaptoactivator();
+       g_clientmodel_setcolormaptoactivator(this, actor, trigger);
 }
 
 void g_model_dropbyspawnflags(entity this)
index 49bcd8904f86e7bf07a9e791d9835a4ef145aa4f..dc8ffe8c0dc875a4004cd99b7a568f2334fdf437 100644 (file)
@@ -4,7 +4,6 @@ void SUB_NullThink();
 
 void()  SUB_CalcMoveDone;
 void() SUB_CalcAngleMoveDone;
-//void() SUB_UseTargets;
 
 spawnfunc(info_null);
 
index 0230a21cbb4cb6dcef915e62e2436bead1c9942f..9688d51db107977f3e2fd42c6f8df036a33a6a81 100644 (file)
@@ -84,8 +84,7 @@ void item_key_touch()
 
        string oldmsg = self.message;
        self.message = "";
-       activator = other;
-       SUB_UseTargets();
+       SUB_UseTargets(self, other, other); // TODO: should we be using other for the trigger here?
        self.message = oldmsg;
 };
 
index 72747037dee0c8739223fe5f2ca1744351138841..9b5a279d55047cfa3b70e523e25d7484d4afe441 100644 (file)
@@ -969,21 +969,15 @@ void adaptor_think2touch()
 
 void adaptor_think2use()
 {SELFPARAM();
-    entity o, a;
-    o = other;
-    a = activator;
-    activator = world;
-    other = world;
-    self.use();
-    other = o;
-    activator = a;
+       if(this.use)
+       this.use(this, NULL, NULL);
 }
 
 void adaptor_think2use_hittype_splash() // for timed projectile detonation
 {SELFPARAM();
-       if(!(IS_ONGROUND(self))) // if onground, we ARE touching something, but HITTYPE_SPLASH is to be networked if the damage causing projectile is not touching ANYTHING
-               self.projectiledeathtype |= HITTYPE_SPLASH;
-       adaptor_think2use();
+       if(!(IS_ONGROUND(this))) // if onground, we ARE touching something, but HITTYPE_SPLASH is to be networked if the damage causing projectile is not touching ANYTHING
+               this.projectiledeathtype |= HITTYPE_SPLASH;
+       WITHSELF(this, adaptor_think2use());
 }
 
 // deferred dropping
index 634d3fb647185594e04001b18c1b1790ecf17942..2e947f29db24ca9bae03343c332df2c69c97a2a2 100644 (file)
@@ -116,6 +116,8 @@ void WarpZone_crosshair_trace(entity pl);
 
 void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
 
+void adaptor_think2use();
+
 #define IS_DEAD(s) ((s).deadflag != DEAD_NO)
 
 
index 34c19d425178a0d9c02e3f844d1aa6edb6730034..e7785c7d0a907e8e2d66f5c43eab081c19cd9b3b 100644 (file)
@@ -62,29 +62,27 @@ const float ST_ASSAULT_OBJECTIVES = 1;
 const float SP_ASSAULT_OBJECTIVES = 4;
 
 // predefined spawnfuncs
-void target_objective_decrease_activate();
+void target_objective_decrease_activate(entity this);
 #endif
 
 #ifdef IMPLEMENTATION
 .entity sprite;
 
 // random functions
-void assault_objective_use()
-{SELFPARAM();
+void assault_objective_use(entity this, entity actor, entity trigger)
+{
        // activate objective
-       self.health = 100;
-       //print("^2Activated objective ", self.targetname, "=", etos(self), "\n");
-       //print("Activator is ", activator.classname, "\n");
+       this.health = 100;
+       //print("^2Activated objective ", this.targetname, "=", etos(this), "\n");
+       //print("Activator is ", actor.classname, "\n");
 
        for (entity e = world; (e = find(e, target, this.targetname)); )
        {
                if (e.classname == "target_objective_decrease")
                {
-                       WITHSELF(e, target_objective_decrease_activate());
+                       target_objective_decrease_activate(e);
                }
        }
-
-       setself(this);
 }
 
 vector target_objective_spawn_evalfunc(entity player, entity spot, vector current)
@@ -102,47 +100,40 @@ void assault_objective_reset(entity this)
 }
 
 // decrease the health of targeted objectives
-void assault_objective_decrease_use()
-{SELFPARAM();
-       if(activator.team != assault_attacker_team)
+void assault_objective_decrease_use(entity this, entity actor, entity trigger)
+{
+       if(actor.team != assault_attacker_team)
        {
                // wrong team triggered decrease
                return;
        }
 
-       if(other.assault_sprite)
+       if(trigger.assault_sprite)
        {
-               WaypointSprite_Disown(other.assault_sprite, waypointsprite_deadlifetime);
-               if(other.classname == "func_assault_destructible")
-                       other.sprite = world;
+               WaypointSprite_Disown(trigger.assault_sprite, waypointsprite_deadlifetime);
+               if(trigger.classname == "func_assault_destructible")
+                       trigger.sprite = world; // TODO: just unsetting it?!
        }
        else
                return; // already activated! cannot activate again!
 
-       if(self.enemy.health < ASSAULT_VALUE_INACTIVE)
+       if(this.enemy.health < ASSAULT_VALUE_INACTIVE)
        {
-               if(self.enemy.health - self.dmg > 0.5)
+               if(this.enemy.health - this.dmg > 0.5)
                {
-                       PlayerTeamScore_Add(activator, SP_SCORE, ST_SCORE, self.dmg);
-                       self.enemy.health = self.enemy.health - self.dmg;
+                       PlayerTeamScore_Add(actor, SP_SCORE, ST_SCORE, this.dmg);
+                       this.enemy.health = this.enemy.health - this.dmg;
                }
                else
                {
-                       PlayerTeamScore_Add(activator, SP_SCORE, ST_SCORE, self.enemy.health);
-                       PlayerTeamScore_Add(activator, SP_ASSAULT_OBJECTIVES, ST_ASSAULT_OBJECTIVES, 1);
-                       self.enemy.health = -1;
-
-                       entity oldactivator;
+                       PlayerTeamScore_Add(actor, SP_SCORE, ST_SCORE, this.enemy.health);
+                       PlayerTeamScore_Add(actor, SP_ASSAULT_OBJECTIVES, ST_ASSAULT_OBJECTIVES, 1);
+                       this.enemy.health = -1;
 
-                       setself(this.enemy);
-                       if(self.message)
-                               FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(centerprint(it, self.message)));
+                       if(this.enemy.message)
+                               FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(centerprint(it, this.enemy.message)));
 
-                       oldactivator = activator;
-                       activator = this;
-                       SUB_UseTargets();
-                       activator = oldactivator;
-                       setself(this);
+                       SUB_UseTargets(this.enemy, this, trigger);
                }
        }
 }
@@ -150,19 +141,19 @@ void assault_objective_decrease_use()
 void assault_setenemytoobjective(entity this)
 {
        entity objective;
-       for(objective = world; (objective = find(objective, targetname, self.target)); )
+       for(objective = world; (objective = find(objective, targetname, this.target)); )
        {
                if(objective.classname == "target_objective")
                {
-                       if(self.enemy == world)
-                               self.enemy = objective;
+                       if(this.enemy == world)
+                               this.enemy = objective;
                        else
                                objerror("more than one objective as target - fix the map!");
                        break;
                }
        }
 
-       if(self.enemy == world)
+       if(this.enemy == world)
                objerror("no objective as target - fix the map!");
 }
 
@@ -178,21 +169,21 @@ float assault_decreaser_sprite_visible(entity e)
        return true;
 }
 
-void target_objective_decrease_activate()
-{SELFPARAM();
+void target_objective_decrease_activate(entity this)
+{
        entity ent, spr;
-       self.owner = world;
-       for(ent = world; (ent = find(ent, target, self.targetname)); )
+       this.owner = world;
+       for(ent = world; (ent = find(ent, target, this.targetname)); )
        {
                if(ent.assault_sprite != world)
                {
                        WaypointSprite_Disown(ent.assault_sprite, waypointsprite_deadlifetime);
                        if(ent.classname == "func_assault_destructible")
-                               ent.sprite = world;
+                               ent.sprite = world; // TODO: just unsetting it?!
                }
 
                spr = WaypointSprite_SpawnFixed(WP_Assault, 0.5 * (ent.absmin + ent.absmax), ent, assault_sprite, RADARICON_OBJECTIVE);
-               spr.assault_decreaser = self;
+               spr.assault_decreaser = this;
                spr.waypointsprite_visible_for_player = assault_decreaser_sprite_visible;
                spr.classname = "sprite_waypoint";
                WaypointSprite_UpdateRule(spr, assault_attacker_team, SPRITERULE_TEAMPLAY);
@@ -220,15 +211,14 @@ void target_assault_roundend_reset(entity this)
        this.winning = false; // up round
 }
 
-void target_assault_roundend_use()
-{SELFPARAM();
-       self.winning = 1; // round has been won by attackers
+void target_assault_roundend_use(entity this, entity actor, entity trigger)
+{
+       this.winning = 1; // round has been won by attackers
 }
 
-void assault_roundstart_use(entity this)
+void assault_roundstart_use(entity this, entity actor, entity trigger)
 {
-       activator = self;
-       SUB_UseTargets();
+       SUB_UseTargets(this, this, trigger);
 
        //(Re)spawn all turrets
        FOREACH_ENTITY_CLASS("turret_main", true, LAMBDA(
@@ -242,10 +232,14 @@ void assault_roundstart_use(entity this)
                WITHSELF(it, turret_respawn());
        ));
 }
+void assault_roundstart_use_this(entity this)
+{
+       assault_roundstart_use(this, NULL, NULL);
+}
 void assault_roundstart_use_self()
 {
     SELFPARAM();
-    assault_roundstart_use(this);
+    assault_roundstart_use(this, NULL, NULL);
 }
 
 void assault_wall_think()
@@ -276,13 +270,10 @@ void assault_new_round()
     FOREACH_CLIENT(IS_PLAYER(it) && it.vehicle, WITHSELF(it, vehicles_exit(VHEF_RELEASE)));
 
     FOREACH_ENTITY_FLAGS(vehicle_flags, VHF_ISVEHICLE, LAMBDA(
-       setself(it);
-        vehicles_clearreturn(self);
-        vehicles_spawn();
+        vehicles_clearreturn(it);
+        WITHSELF(it, vehicles_spawn());
     ));
 
-    setself(this);
-
        // up round counter
        self.winning = self.winning + 1;
 
@@ -348,17 +339,17 @@ int WinningCondition_Assault()
 // spawnfuncs
 spawnfunc(info_player_attacker)
 {
-       if (!g_assault) { remove(self); return; }
+       if (!g_assault) { remove(this); return; }
 
-       self.team = NUM_TEAM_1; // red, gets swapped every round
+       this.team = NUM_TEAM_1; // red, gets swapped every round
        spawnfunc_info_player_deathmatch(this);
 }
 
 spawnfunc(info_player_defender)
 {
-       if (!g_assault) { remove(self); return; }
+       if (!g_assault) { remove(this); return; }
 
-       self.team = NUM_TEAM_2; // blue, gets swapped every round
+       this.team = NUM_TEAM_2; // blue, gets swapped every round
        spawnfunc_info_player_deathmatch(this);
 }
 
@@ -375,71 +366,71 @@ spawnfunc(target_objective)
 
 spawnfunc(target_objective_decrease)
 {
-       if (!g_assault) { remove(self); return; }
+       if (!g_assault) { remove(this); return; }
 
-       self.classname = "target_objective_decrease";
+       this.classname = "target_objective_decrease";
 
-       if(!self.dmg)
-               self.dmg = 101;
+       if(!this.dmg)
+               this.dmg = 101;
 
-       self.use = assault_objective_decrease_use;
-       self.health = ASSAULT_VALUE_INACTIVE;
-       self.max_health = ASSAULT_VALUE_INACTIVE;
-       self.enemy = world;
+       this.use = assault_objective_decrease_use;
+       this.health = ASSAULT_VALUE_INACTIVE;
+       this.max_health = ASSAULT_VALUE_INACTIVE;
+       this.enemy = world;
 
-       InitializeEntity(self, target_objective_decrease_findtarget, INITPRIO_FINDTARGET);
+       InitializeEntity(this, target_objective_decrease_findtarget, INITPRIO_FINDTARGET);
 }
 
 // destructible walls that can be used to trigger target_objective_decrease
 spawnfunc(func_breakable);
 spawnfunc(func_assault_destructible)
 {
-       if (!g_assault) { remove(self); return; }
+       if (!g_assault) { remove(this); return; }
 
-       self.spawnflags = 3;
-       self.classname = "func_assault_destructible";
+       this.spawnflags = 3;
+       this.classname = "func_assault_destructible";
 
        if(assault_attacker_team == NUM_TEAM_1)
-               self.team = NUM_TEAM_2;
+               this.team = NUM_TEAM_2;
        else
-               self.team = NUM_TEAM_1;
+               this.team = NUM_TEAM_1;
 
        spawnfunc_func_breakable(this);
 }
 
 spawnfunc(func_assault_wall)
 {
-       if (!g_assault) { remove(self); return; }
+       if (!g_assault) { remove(this); return; }
 
-       self.classname = "func_assault_wall";
-       self.mdl = self.model;
-       _setmodel(self, self.mdl);
-       self.solid = SOLID_BSP;
-       self.think = assault_wall_think;
-       self.nextthink = time;
-       InitializeEntity(self, assault_setenemytoobjective, INITPRIO_FINDTARGET);
+       this.classname = "func_assault_wall";
+       this.mdl = this.model;
+       _setmodel(this, this.mdl);
+       this.solid = SOLID_BSP;
+       this.think = assault_wall_think;
+       this.nextthink = time;
+       InitializeEntity(this, assault_setenemytoobjective, INITPRIO_FINDTARGET);
 }
 
 spawnfunc(target_assault_roundend)
 {
-       if (!g_assault) { remove(self); return; }
+       if (!g_assault) { remove(this); return; }
 
-       self.winning = 0; // round not yet won by attackers
-       self.classname = "target_assault_roundend";
-       self.use = target_assault_roundend_use;
-       self.cnt = 0; // first round
-       self.reset = target_assault_roundend_reset;
+       this.winning = 0; // round not yet won by attackers
+       this.classname = "target_assault_roundend";
+       this.use = target_assault_roundend_use;
+       this.cnt = 0; // first round
+       this.reset = target_assault_roundend_reset;
 }
 
 spawnfunc(target_assault_roundstart)
 {
-       if (!g_assault) { remove(self); return; }
+       if (!g_assault) { remove(this); return; }
 
        assault_attacker_team = NUM_TEAM_1;
-       self.classname = "target_assault_roundstart";
-       self.use = assault_roundstart_use_self;
-       self.reset2 = assault_roundstart_use_self;
-       InitializeEntity(self, assault_roundstart_use, INITPRIO_FINDTARGET);
+       this.classname = "target_assault_roundstart";
+       this.use = assault_roundstart_use;
+       this.reset2 = assault_roundstart_use_self;
+       InitializeEntity(this, assault_roundstart_use_this, INITPRIO_FINDTARGET);
 }
 
 // legacy bot code
index 3a32c203140d754cc97eed98aefd38f1af99600d..141837c260071c9e71f3ce928fb1a10d82a98b10 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;
 
index 9fd6ca7b3f9d2f0db732ebcd6a673d7c9b0ea30a..d24a0769b5a4b1b7834c76ca04fca34d588c63ab 100644 (file)
@@ -580,10 +580,9 @@ void checkpoint_passed()
         */
        if (!((self.spawnflags & 2) && (IS_PLAYER(other))))
        {
-               activator = other;
                oldmsg = self.message;
                self.message = "";
-               SUB_UseTargets();
+               SUB_UseTargets(self, other, other); // TODO: should we be using other for the trigger here?
                self.message = oldmsg;
        }
 
@@ -652,10 +651,9 @@ void checkpoint_passed()
                 */
                if(self.spawnflags & 2)
                {
-                       activator = other;
                        oldmsg = self.message;
                        self.message = "";
-                       SUB_UseTargets();
+                       SUB_UseTargets(self, other, other); // TODO: should we be using other for the trigger here?
                        self.message = oldmsg;
                }
 
@@ -707,12 +705,12 @@ void checkpoint_touch()
        checkpoint_passed();
 }
 
-void checkpoint_use()
+void checkpoint_use(entity this, entity actor, entity trigger)
 {
-       if(other.classname == "info_player_deathmatch") // a spawn, a spawn
+       if(trigger.classname == "info_player_deathmatch") // a spawn, a spawn
                return;
 
-       other = activator;
+       other = actor;
        checkpoint_passed();
 }
 
@@ -1107,9 +1105,9 @@ void penalty_touch()
        }
 }
 
-void penalty_use()
-{SELFPARAM();
-       race_ImposePenaltyTime(activator, self.race_penalty, self.race_penalty_reason);
+void penalty_use(entity this, entity actor, entity trigger)
+{
+       race_ImposePenaltyTime(actor, this.race_penalty, this.race_penalty_reason);
 }
 
 spawnfunc(trigger_race_penalty)
index 51af4d16e311e4857e84e1572f2acd6acc2e8c39..711b15df560536d11057ff34b19ef5b506253559 100644 (file)
@@ -58,12 +58,12 @@ void spawnpoint_think()
        }
 }
 
-void spawnpoint_use()
-{SELFPARAM();
+void spawnpoint_use(entity this, entity actor, entity trigger)
+{
        if(teamplay)
        if(have_team_spawns > 0)
        {
-               self.team = activator.team;
+               this.team = actor.team;
                some_spawn_has_been_used = 1;
        }
        //LOG_INFO("spawnpoint was used!\n");
index b010350908550a976d0bf4ec3398e03cb90a11af..a22ebb60c82323c89b018d40447ccef70bd0710a 100644 (file)
@@ -6,4 +6,4 @@ bool SpawnEvent_Send(entity this, entity to, int sf);
 entity Spawn_FilterOutBadSpots(entity firstspot, float mindist, float teamcheck);
 entity SelectSpawnPoint (float anypoint);
 spawnfunc(info_player_deathmatch);
-void spawnpoint_use();
+void spawnpoint_use(entity this, entity actor, entity trigger);
index 2a439f3d9eeb26d5763b85349995a12937f65f63..4a06e16661027b650be469a327af68badd70b93d 100644 (file)
@@ -73,21 +73,21 @@ float W_CheckProjectileDamage(entity inflictor, entity projowner, int deathtype,
        return true; // if none of these return, then allow damage anyway.
 }
 
-void W_PrepareExplosionByDamage(entity attacker, void() explode)
-{SELFPARAM();
-       self.takedamage = DAMAGE_NO;
-       self.event_damage = func_null;
+void W_PrepareExplosionByDamage(entity this, entity attacker, void() explode)
+{
+       this.takedamage = DAMAGE_NO;
+       this.event_damage = func_null;
 
        if(IS_CLIENT(attacker) && !autocvar_g_projectiles_keep_owner)
        {
-               self.owner = attacker;
-               self.realowner = attacker;
+               this.owner = attacker;
+               this.realowner = attacker;
        }
 
-       MUTATOR_CALLHOOK(PrepareExplosionByDamage, self, attacker);
+       MUTATOR_CALLHOOK(PrepareExplosionByDamage, this, attacker);
 
        // do not explode NOW but in the NEXT FRAME!
        // because recursive calls to RadiusDamage are not allowed
-       self.nextthink = time;
-       self.think = explode;
+       this.nextthink = time;
+       this.think = explode;
 }
index 7633c386e77c247092350bcdff51be40f5400f63..2ab8ea5acca6832f9eda13b257ff006cf0f8cbee 100644 (file)
@@ -5,4 +5,4 @@ void W_GiveWeapon (entity e, float wep);
 .float prevstrengthsoundattempt;
 void W_PlayStrengthSound(entity player);
 float W_CheckProjectileDamage(entity inflictor, entity projowner, int deathtype, float exception);
-void W_PrepareExplosionByDamage(entity attacker, void() explode);
+void W_PrepareExplosionByDamage(entity this, entity attacker, void() explode);