]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Mario/use1
authorMario <mario@smbclan.net>
Sun, 27 Mar 2016 11:53:07 +0000 (21:53 +1000)
committerMario <mario@smbclan.net>
Sun, 27 Mar 2016 11:53:07 +0000 (21:53 +1000)
# Conflicts:
# qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
# qcsrc/common/triggers/target/spawn.qc
# qcsrc/common/triggers/trigger/gamestart.qc
# qcsrc/lib/defer.qh
# qcsrc/server/mutators/mutator/gamemode_assault.qc

42 files changed:
qcsrc/client/hud/hud.qc
qcsrc/client/hud/hud.qh
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/net_notice.qc
qcsrc/common/t_items.qc
qcsrc/common/t_items.qh
qcsrc/common/triggers/func/door.qc
qcsrc/common/triggers/func/door_rotating.qc
qcsrc/common/triggers/func/plat.qc
qcsrc/common/triggers/func/train.qc
qcsrc/common/triggers/func/vectormamamam.qc
qcsrc/common/triggers/misc/follow.qc
qcsrc/common/triggers/misc/laser.qc
qcsrc/common/triggers/target/spawn.qc
qcsrc/common/triggers/teleporters.qc
qcsrc/common/triggers/teleporters.qh
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/triggers/trigger/jumppads.qh
qcsrc/common/triggers/trigger/viewloc.qc
qcsrc/common/turrets/turret/walker.qc
qcsrc/lib/defer.qh
qcsrc/lib/self.qh
qcsrc/server/cheats.qc
qcsrc/server/g_lights.qc
qcsrc/server/g_models.qc
qcsrc/server/g_subs.qc
qcsrc/server/g_subs.qh
qcsrc/server/miscfunctions.qc
qcsrc/server/miscfunctions.qh
qcsrc/server/mutators/mutator/gamemode_assault.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_domination.qc
qcsrc/server/mutators/mutator/gamemode_invasion.qc
qcsrc/server/mutators/mutator/gamemode_keepaway.qc
qcsrc/server/mutators/mutator/gamemode_tdm.qc
qcsrc/server/race.qc
qcsrc/server/t_quake3.qc
qcsrc/server/teamplay.qc
qcsrc/server/teamplay.qh
qcsrc/server/tests.qc

index 99605536018ba17e8a9fabe330b7af957079f938..d89f3106454f1a29abbc5d015438b9cdbd94a679 100644 (file)
@@ -243,9 +243,9 @@ void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float theA
        drawsubpic(pos + eX * mySize.x - eX * min(mySize.x * 0.5, mySize.y), eX * min(mySize.x * 0.5, mySize.y) + eY * mySize.y, pic, '0.75 0 0', '0.25 1 0', color, theAlpha, drawflag);
 }
 
-void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bool vertical, bool icon_right_align, vector color, float theAlpha, float fadelerp)
+void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bool vertical, int icon_right_align, vector color, float theAlpha, float fadelerp)
 {
-    TC(bool, vertical); TC(bool, icon_right_align);
+    TC(bool, vertical); TC(int, icon_right_align);
        vector newPos = '0 0 0', newSize = '0 0 0';
        vector picpos, numpos;
 
index 7664abc2f165359ad1b0a849f8feda2e3b322069..d46b11db571a7044d2acfec43562a8da05cbdb3f 100644 (file)
@@ -44,7 +44,7 @@ void HUD_Radar_Hide_Maximized();
 float HUD_GetRowCount(int item_count, vector size, float item_aspect);
 vector HUD_Get_Num_Color (float x, float maxvalue);
 void DrawNumIcon(vector myPos, vector mySize, float x, string icon, bool vertical, bool icon_right_align, vector color, float theAlpha);
-void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bool vertical, bool icon_right_align, vector color, float theAlpha, float fadelerp);
+void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bool vertical, int icon_right_align, vector color, float theAlpha, float fadelerp);
 void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float theAlpha, int drawflag);
 vector HUD_GetTableSize_BestItemAR(int item_count, vector psize, float item_aspect);
 
index 14ab8b470a4229d5b71deeae20e0a70e2791e4d9..1d500c1a6d601b067e37ee5fadb0666b2ff21816 100644 (file)
@@ -498,7 +498,7 @@ void nb_spawnteams()
        }
 }
 
-void nb_delayedinit()
+void nb_delayedinit(entity this)
 {
        if(find(world, classname, "nexball_team") == world)
                nb_spawnteams();
index 212420753dc1170498025cdcaa0eaac0a719ee1a..056d33a03d679882abd344aced5c7fe5e5280236 100644 (file)
@@ -414,8 +414,8 @@ void ons_Link_CheckUpdate()
        self.nextthink = time;
 }
 
-void ons_DelayedLinkSetup()
-{SELFPARAM();
+void ons_DelayedLinkSetup(entity this)
+{
        self.goalentity = find(world, targetname, self.target);
        self.enemy = find(world, targetname, self.target2);
        if(!self.goalentity) { objerror("can not find target\n"); }
@@ -845,8 +845,8 @@ void ons_ControlPoint_Reset(entity this)
        CSQCMODEL_AUTOUPDATE(this);
 }
 
-void ons_DelayedControlPoint_Setup()
-{SELFPARAM();
+void ons_DelayedControlPoint_Setup(entity this)
+{
        onslaught_updatelinks();
 
        // captureshield setup
@@ -1071,8 +1071,8 @@ void ons_GeneratorReset(entity this)
        onslaught_updatelinks();
 }
 
-void ons_DelayedGeneratorSetup()
-{SELFPARAM();
+void ons_DelayedGeneratorSetup(entity this)
+{
        // bot waypoints
        waypoint_spawnforitem_force(self, self.origin);
        self.nearestwaypointtimeout = 0; // activate waypointing again
@@ -1941,9 +1941,9 @@ MUTATOR_HOOKFUNCTION(ons, MonsterMove)
        return false;
 }
 
-void ons_MonsterSpawn_Delayed()
-{SELFPARAM();
-       entity own = this.owner;
+void ons_MonsterSpawn_Delayed(entity this)
+{
+       entity own = self.owner;
 
        if(!own) { remove(this); return; }
 
@@ -1970,8 +1970,8 @@ MUTATOR_HOOKFUNCTION(ons, MonsterSpawn)
        return false;
 }
 
-void ons_TurretSpawn_Delayed()
-{SELFPARAM();
+void ons_TurretSpawn_Delayed(entity this)
+{
        entity own = self.owner;
 
        if(!own) { remove(self); return; }
@@ -2241,7 +2241,7 @@ void ons_ScoreRules()
        ScoreRules_basics_end();
 }
 
-void ons_DelayedInit() // Do this check with a delay so we can wait for teams to be set up
+void ons_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up
 {
        ons_ScoreRules();
 
index 7de2a906201ff55964e6971440fc383ee8b7e838..15b725ee4b18d2bcd934728a6e0b2c2c8b233496 100644 (file)
@@ -82,7 +82,7 @@ const vector BUFF_MAX = ('16 16 20');
 #include <common/gamemodes/all.qh>
 
 .float buff_time = _STAT(BUFF_TIME);
-void buffs_DelayedInit();
+void buffs_DelayedInit(entity this);
 
 REGISTER_MUTATOR(buffs, cvar("g_buffs"))
 {
@@ -1045,7 +1045,7 @@ MUTATOR_HOOKFUNCTION(buffs, BuildMutatorsPrettyString)
        return false;
 }
 
-void buffs_DelayedInit()
+void buffs_DelayedInit(entity this)
 {
        if(autocvar_g_buffs_spawn_count > 0)
        if(find(world, classname, "item_buff") == world)
index d67a1de3d8f7a230d8620f1ffd9b815d834a8ddf..1e1726ae452fe716041d291f30581eb3a1d3cab9 100644 (file)
@@ -3,9 +3,8 @@
 REGISTER_NET_TEMP(TE_CSQC_SVNOTICE)
 
 #ifdef SVQC
-void sv_notice_join_think()
+void sv_notice_join_think(entity this)
 {
-    SELFPARAM();
     int argc = tokenizebyseparator(autocvar_sv_join_notices, "|");
     if (argc <= 0) return;
     for (int i = 0; i < argc; ++i)
index 8467576275a0e33ce0837c00e97bd16b4c1c9f60..2c1b2a8ddae23bca2b08d410db17196863afe040 100644 (file)
@@ -863,8 +863,8 @@ void Item_Reset(entity this)
 }
 void Item_Reset_self() { SELFPARAM(); Item_Reset(this); }
 
-void Item_FindTeam()
-{SELFPARAM();
+void Item_FindTeam(entity this)
+{
        entity e;
 
        if(self.effects & EF_NODRAW)
index 2259ead630a663ac3d350a1b2a995baf2f5783b9..ce8307821ca11b0faea0811529e153eb2614661c 100644 (file)
@@ -92,7 +92,7 @@ void Item_Touch();
 
 void Item_Reset(entity this);
 
-void Item_FindTeam();
+void Item_FindTeam(entity this);
 // Savage: used for item garbage-collection
 
 bool ItemSend(entity this, entity to, int sf);
index af7cd8e268e4950e3a46a2bc58c3ce5e4b165b2e..0546b2eae009f83316d4b83448dc8aa09bcad15e 100644 (file)
@@ -500,8 +500,8 @@ bool LinkDoors_isconnected(entity e1, entity e2, entity pass)
 #ifdef SVQC
 void door_link();
 #endif
-void LinkDoors()
-{SELFPARAM();
+void LinkDoors(entity this)
+{
        entity  t;
        vector  cmins, cmaxs;
 
@@ -687,8 +687,8 @@ void door_link()
 }
 #endif
 
-void door_init_startopen()
-{SELFPARAM();
+void door_init_startopen(entity this)
+{
        SUB_SETORIGIN(self, self.pos2);
        self.pos2 = self.pos1;
        self.pos1 = self.origin;
@@ -844,10 +844,10 @@ NET_HANDLE(ENT_CLIENT_DOOR, bool isnew)
                this.drawmask = MASK_NORMAL;
                this.use1 = door_use;
 
-               LinkDoors();
+               LinkDoors(this);
 
                if(this.spawnflags & DOOR_START_OPEN)
-                       door_init_startopen();
+                       door_init_startopen(this);
 
                this.move_time = time;
                this.move_origin = this.origin;
index d729c9339a37b3904b9695fd2c2b81ae585ada54..f552090e9a23116b7009def40029c0b61f960e57 100644 (file)
@@ -36,8 +36,8 @@ void door_rotating_reset(entity this)
        this.nextthink = 0;
 }
 
-void door_rotating_init_startopen()
-{SELFPARAM();
+void door_rotating_init_startopen(entity this)
+{
        self.angles = self.movedir;
        self.pos2 = '0 0 0';
        self.pos1 = self.movedir;
index fcdc6518b314e9ae8eacc96bf9ffb0a220b21987..badddf4cc626a75ee4c075fcfb29a4f0437367ab 100644 (file)
@@ -3,7 +3,7 @@ REGISTER_NET_LINKED(ENT_CLIENT_PLAT)
 #ifdef SVQC
 void plat_link();
 
-void plat_delayedinit()
+void plat_delayedinit(entity this)
 {
        plat_link();
        plat_spawn_inside_trigger(); // the "start moving" trigger
index 2a5a702117afc5be5d2abf9268416e46d7f3c87e..0fa3ed60126fb8567a0d3853c7779848760453a5 100644 (file)
@@ -183,8 +183,8 @@ void train_use(entity this, entity actor, entity trigger)
        this.use1 = func_null; // not again
 }
 
-void func_train_find()
-{SELFPARAM();
+void func_train_find(entity this)
+{
        entity targ;
        targ = find(world, targetname, self.target);
        self.target = targ.target;
index 5c2086477475abe8e6541374f1d6b12843a996a9..2dfa1ac98f9817d4b4cc07b1d245416db3ca00ee 100644 (file)
@@ -71,8 +71,8 @@ void func_vectormamamam_controller_think()
                self.owner.velocity = (self.owner.destvec + func_vectormamamam_origin(self.owner, 0.1) - self.owner.origin) * 10;
 }
 
-void func_vectormamamam_findtarget()
-{SELFPARAM();
+void func_vectormamamam_findtarget(entity this)
+{
        if(self.target != "")
                self.wp00 = find(world, targetname, self.target);
 
index 842248a4b31f0acc93a7b91f32a784dea7c1978c..2ac304a212d08fbfaa28183353538040cee7716f 100644 (file)
@@ -1,8 +1,8 @@
 // the way this entity works makes it no use to CSQC, as it removes itself instantly
 
 #ifdef SVQC
-void follow_init()
-{SELFPARAM();
+void follow_init(entity this)
+{
        entity src, dst;
        src = world;
        dst = world;
index 6ef45922fb6b0a8f4a1cff97ec7629fd8bcec376..9c388f6fc5ecbea418557657e5820972381c16a8 100644 (file)
@@ -49,8 +49,8 @@ void misc_laser_aim(entity this)
        }
 }
 
-void misc_laser_init()
-{SELFPARAM();
+void misc_laser_init(entity this)
+{
        if(self.target != "")
                self.enemy = find(world, targetname, self.target);
 }
index f02b2962573700803eab808837a1661aa51f8fdd..e6114a520a97bad61dd1564227bf2fd95595ad36 100644 (file)
@@ -292,10 +292,10 @@ void target_spawn_use(entity this, entity actor, entity trigger)
        }
 }
 
-void target_spawn_spawnfirst()
-{SELFPARAM();
-       entity act = self.target_spawn_activator;
-       if(self.spawnflags & 2)
+void target_spawn_spawnfirst(entity this)
+{
+       entity act = this.target_spawn_activator;
+       if(this.spawnflags & 2)
                target_spawn_use(this, act, NULL);
 }
 
index afeabfcddc3cba2cf3da9d779b5007a79176505c..04667f4cc228391eefab47954ab56695e99d3f10 100644 (file)
@@ -247,9 +247,8 @@ entity Simple_TeleportPlayer(entity teleporter, entity player)
        return e;
 }
 
-void teleport_findtarget()
+void teleport_findtarget(entity this)
 {
-    SELFPARAM();
        int n = 0;
        entity e;
        for(e = world; (e = find(e, targetname, self.target)); )
index 6f2fa28a4a1e2338efddadac175c674a86cd352c..9366678b15c50dd79db5f194dcc3aadfec7d6a57 100644 (file)
@@ -19,7 +19,7 @@ entity Simple_TeleportPlayer(entity teleporter, entity player);
 
 void Teleport_Touch ();
 
-void teleport_findtarget();
+void teleport_findtarget(entity this);
 
 entity Teleport_Find(vector mi, vector ma);
 
index e90f0bfc30bcb07a54c69a6ae61ef69be83f4329..db3905b64206af487a0b469051d3d7b1ee264512 100644 (file)
@@ -271,10 +271,10 @@ void trigger_push_touch()
 
 #ifdef SVQC
 void trigger_push_link();
-void trigger_push_updatelink();
+void trigger_push_updatelink(entity this);
 #endif
-void trigger_push_findtarget()
-{SELFPARAM();
+void trigger_push_findtarget(entity this)
+{
        entity t;
        vector org;
 
@@ -351,8 +351,8 @@ float trigger_push_send(entity this, entity to, float sf)
        return true;
 }
 
-void trigger_push_updatelink()
-{SELFPARAM();
+void trigger_push_updatelink(entity this)
+{
        this.SendFlags |= 1;
 }
 
index 5744c66d43e3a0623d3bd78c9d315303f3db3032..6fd61dc9da7561fb0bd684d30e50f95113267917 100644 (file)
@@ -38,7 +38,7 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht);
 void trigger_push_touch();
 
 .vector dest;
-void trigger_push_findtarget();
+void trigger_push_findtarget(entity this);
 
 /*
  * ENTITY PARAMETERS:
index f7e69495228b97987d3dbd636c93015c1ca2e4b8..db75434bfb6f98bd226f81bc72c07bbec718683b 100644 (file)
@@ -55,8 +55,8 @@ bool trigger_viewloc_send(entity this, entity to, int sf)
        return true;
 }
 
-void viewloc_init()
-{SELFPARAM();
+void viewloc_init(entity this)
+{
        entity e;
        for(e = world; (e = find(e, targetname, self.target)); )
                if(e.classname == "target_viewlocation_start")
index fb6d496bfe6bd3968fdb10884da6237f8dbb5ef4..d99479cb180a7efcfb8419e73f7c6fd80bb2c35c 100644 (file)
@@ -73,8 +73,8 @@ float walker_firecheck()
     return turret_firecheck();
 }
 
-void walker_melee_do_dmg()
-{SELFPARAM();
+void walker_melee_do_dmg(entity this)
+{
     vector where;
     entity e;
 
@@ -92,8 +92,8 @@ void walker_melee_do_dmg()
     }
 }
 
-void walker_setnoanim()
-{SELFPARAM();
+void walker_setnoanim(entity this)
+{
     turrets_setframe(ANIM_NO, false);
     self.animflag = self.frame;
 }
index 373e4325f84000bb0990f9977f5f432e1dcc71f3..d4c1eadac75db7a4dbbd87a738892b7e0f039565 100644 (file)
@@ -9,7 +9,6 @@
        class(Defer).entity owner;
        class(Defer).void() think;
        class(Defer).float nextthink;
-       class(Defer).void() defer_func;
 
        /** Remove self */
        void SUB_Remove(entity this)
                SELFPARAM();
                this.think     = SUB_Remove_self;
                this.nextthink = time;
-               WITHSELF(this.owner, this.defer_func());
+               WITHSELF(this.owner, this.selfthink(this));
        }
 
-/*
-    Execute func() after time + fdelay.
-    self when func is executed = self when defer is called
-*/
-       void defer(entity this, float fdelay, void() func)
+    /**
+     * Execute func() after time + fdelay.
+     * self when func is executed = self when defer is called
+     */
+       void defer(entity this, float fdelay, void(entity this) func)
        {
                entity e    = new_pure(deferred);
                e.owner     = this;
-               e.defer_func  = func;
+               setthink(e, func);
                e.think     = defer_think;
                e.nextthink = time + fdelay;
        }
index 5d53694c72294ed2c5b077f586ad1ee0e0ad422e..092a8945b7a25faf0286cef3a7234c315b837772 100644 (file)
 #endif
 
 // Step 6: Remove SELFPARAM in favor of a parameter
+
+.void(entity this) selftouch;
+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) selfthink;
+void think_self() { SELFPARAM(); this.selfthink(this); }
+#define setthink(e, f) (e.think = think_self, e.selfthink = f)
index 362f7aa8ef6073c92b41ae05224c02355f911dee..add6d535564b5e9bd4a855cfede7582678436c24 100644 (file)
@@ -104,8 +104,8 @@ float CheatsAllowed(float i, float argc, float fr) // the cheat gets passed as a
                break
 
 float num_autoscreenshot;
-void info_autoscreenshot_findtarget()
-{SELFPARAM();
+void info_autoscreenshot_findtarget(entity this)
+{
        entity e;
        e = find(world, targetname, self.target);
        if(!e)
@@ -694,7 +694,7 @@ float CheatCommand(float argc)
                        setself(new(cheattriggerteleport));
                        setorigin(self, self.origin);
                        self.target = argv(1);
-                       teleport_findtarget();
+                       teleport_findtarget(self);
                        if(!wasfreed(self))
                        {
                                Simple_TeleportPlayer(self, this);
index 68be5df137b16186b0227fc31e40e6fbedb60723..218f219645d8faa43a5e49746f74c7345b2bdce9 100644 (file)
@@ -42,9 +42,8 @@ void dynlight_think()
 
        self.nextthink = time + 0.1;
 }
-void dynlight_find_aiment()
+void dynlight_find_aiment(entity this)
 {
-    SELFPARAM();
        entity targ;
        if (!self.target)
                objerror ("dynlight: no target to follow");
@@ -59,9 +58,8 @@ void dynlight_find_aiment()
        self.think = dynlight_think;
        self.nextthink = time + 0.1;
 }
-void dynlight_find_path()
+void dynlight_find_path(entity this)
 {
-    SELFPARAM();
        entity targ;
        if (!self.target)
                objerror ("dynlight: no target to follow");
@@ -72,9 +70,8 @@ void dynlight_find_path()
        self.think = train_next;
        self.nextthink = time + 0.1;
 }
-void dynlight_find_target()
+void dynlight_find_target(entity this)
 {
-    SELFPARAM();
        entity targ;
        if (!self.target)
                objerror ("dynlight: no target to follow");
index 4f75e7beb87093ac7374cfc09c38016be05226d8..003b2efa97bede28379f45d50f84c7eaa163ded1 100644 (file)
@@ -51,8 +51,8 @@ void g_clientmodel_use(entity this, entity actor, entity trigger)
        g_clientmodel_setcolormaptoactivator(this, actor, trigger);
 }
 
-void g_model_dropbyspawnflags()
-{SELFPARAM();
+void g_model_dropbyspawnflags(entity this)
+{
        if((self.spawnflags & 3) == 1) // ALIGN_ORIGIN
        {
                traceline(self.origin, self.origin - '0 0 4096', MOVE_NOMONSTERS, self);
@@ -70,11 +70,11 @@ void g_model_dropbyspawnflags()
        }
 }
 
-void g_clientmodel_dropbyspawnflags()
-{SELFPARAM();
+void g_clientmodel_dropbyspawnflags(entity this)
+{
        vector o0;
        o0 = self.origin;
-       g_model_dropbyspawnflags();
+       g_model_dropbyspawnflags(self);
        if(self.origin != o0)
                self.SendFlags |= 2;
 }
index c6a9d787fe2c6b602c7f7d788ec211ca67fe6804..a2cbc5a431e4d2fd9ad6bb3ed462ac9d4c5dffc5 100644 (file)
@@ -265,8 +265,8 @@ void LOD_uncustomize()
        this.modelindex = this.lodmodelindex0;
 }
 
-void LODmodel_attach()
-{SELFPARAM();
+void LODmodel_attach(entity this)
+{
        entity e;
 
        if(!this.loddistance1)
index fe32e09e84d85fd50bb93b975f1268796a2eabf4..dc8ffe8c0dc875a4004cd99b7a568f2334fdf437 100644 (file)
@@ -142,7 +142,7 @@ float LOD_customize();
 
 void LOD_uncustomize();
 
-void LODmodel_attach();
+void LODmodel_attach(entity this);
 
 void ApplyMinMaxScaleAngles(entity e);
 
index 09837f20de5e6cc0816957de68a7713a20583647..ab3c204a3676222efb07416e274f85bcc13e5038 100644 (file)
@@ -851,7 +851,7 @@ void remove_safely(entity e)
     builtin_remove(e);
 }
 
-void InitializeEntity(entity e, void() func, float order)
+void InitializeEntity(entity e, void(entity this) func, float order)
 {
     entity prev, cur;
 
@@ -885,7 +885,7 @@ void InitializeEntity(entity e, void() func, float order)
     }
 }
 void InitializeEntitiesRun()
-{SELFPARAM();
+{
     entity startoflist = initialize_entity_first;
     initialize_entity_first = NULL;
     remove = remove_except_protected;
@@ -899,7 +899,7 @@ void InitializeEntitiesRun()
         e.initialize_entity_order = 0;
        entity next = e.initialize_entity_next;
         e.initialize_entity_next = NULL;
-        var void() func = e.initialize_entity;
+        var void(entity this) func = e.initialize_entity;
         e.initialize_entity = func_null;
         if (e.classname == "initialize_entity")
         {
@@ -910,7 +910,7 @@ void InitializeEntitiesRun()
         //dprint("Delayed initialization: ", e.classname, "\n");
         if (func)
         {
-               WITHSELF(e, func());
+               WITHSELF(e, func(e));
         }
         else
         {
@@ -981,8 +981,8 @@ void adaptor_think2use_hittype_splash() // for timed projectile detonation
 }
 
 // deferred dropping
-void DropToFloor_Handler()
-{SELFPARAM();
+void DropToFloor_Handler(entity this)
+{
     builtin_droptofloor();
     self.dropped_origin = self.origin;
 }
index d828d70f900257421daefaa973ceef1581b76b47..04221e439ef8f85fef2017e998cc26481e6b0c62 100644 (file)
@@ -357,7 +357,7 @@ const float INITPRIO_SETLOCATION            = 90;
 const float INITPRIO_LINKDOORS                         = 91;
 const float INITPRIO_LAST                              = 99;
 
-.void() initialize_entity;
+.void(entity this) initialize_entity;
 .float initialize_entity_order;
 .entity initialize_entity_next;
 entity initialize_entity_first;
@@ -367,5 +367,5 @@ entity initialize_entity_first;
 
 
 float sound_allowed(float dest, entity e);
-void InitializeEntity(entity e, void() func, float order);
+void InitializeEntity(entity e, void(entity this) func, float order);
 void SetCustomizer(entity e, float() customizer, void() uncustomizer);
index c2d5ed3b905771ec30d5d98e141e9c9a59acdf9e..e358f8fba71629318d2ca471542851221da4f716 100644 (file)
@@ -138,8 +138,8 @@ void assault_objective_decrease_use(entity this, entity actor, entity trigger)
        }
 }
 
-void assault_setenemytoobjective()
-{SELFPARAM();
+void assault_setenemytoobjective(entity this)
+{
        entity objective;
        for(objective = world; (objective = find(objective, targetname, self.target)); )
        {
@@ -199,9 +199,9 @@ void target_objective_decrease_activate(entity this)
        }
 }
 
-void target_objective_decrease_findtarget()
+void target_objective_decrease_findtarget(entity this)
 {
-       assault_setenemytoobjective();
+       assault_setenemytoobjective(this);
 }
 
 void target_assault_roundend_reset(entity this)
@@ -232,6 +232,11 @@ void assault_roundstart_use(entity this, entity actor, entity trigger)
                WITHSELF(it, turret_respawn());
        ));
 }
+void assault_roundstart_use_self()
+{
+    SELFPARAM();
+    assault_roundstart_use(this, NULL, NULL);
+}
 
 void assault_wall_think()
 {SELFPARAM();
@@ -422,9 +427,9 @@ spawnfunc(target_assault_roundstart)
 
        assault_attacker_team = NUM_TEAM_1;
        self.classname = "target_assault_roundstart";
-       self.use1 = assault_roundstart_use;
-       self.reset2 = adaptor_think2use;
-       InitializeEntity(self, adaptor_think2use, INITPRIO_FINDTARGET);
+       self.use = assault_roundstart_use;
+       self.reset2 = assault_roundstart_use_self;
+       InitializeEntity(self, assault_roundstart_use_self, INITPRIO_FINDTARGET);
 }
 
 // legacy bot code
index 9cd6e37726230d6ddfe5ff4d49469c888bce3793..a7d6fb2a1b26f7e6d1376b259ca5a5d91323ed93 100644 (file)
@@ -1158,8 +1158,8 @@ void ctf_Reset(entity this)
        ctf_RespawnFlag(this);
 }
 
-void ctf_DelayedFlagSetup() // called after a flag is placed on a map by ctf_FlagSetup()
-{SELFPARAM();
+void ctf_DelayedFlagSetup(entity this) // called after a flag is placed on a map by ctf_FlagSetup()
+{
        // bot waypoints
        waypoint_spawnforitem_force(self, self.origin);
        self.nearestwaypointtimeout = 0; // activate waypointing again
@@ -2554,7 +2554,7 @@ void ctf_SpawnTeam (string teamname, int teamcolor)
        WITHSELF(this, spawnfunc_ctf_team(this));
 }
 
-void ctf_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
+void ctf_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up.
 {
        ctf_teams = 2;
 
index 4954be26a70bee292778263fd2a4fc728cd116ba..18ca2f9dc4dcdec7220c03728a0e378d0f2d99bd 100644 (file)
@@ -680,7 +680,7 @@ void dom_spawnteams(int teams)
        dom_spawnteam("", 0, "models/domination/dom_unclaimed.md3", 0, SND_Null, "", "");
 }
 
-void dom_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
+void dom_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up.
 {
        // if no teams are found, spawn defaults
        if(find(world, classname, "dom_team") == world || autocvar_g_domination_teams_override >= 2)
index 7b2972c84c5b07be474e905fc62c06012e15e76d..efb6842e5dedb8137e9c6201f7d5e8f83e1c1d5f 100644 (file)
@@ -482,7 +482,7 @@ void invasion_ScoreRules(float inv_teams)
        ScoreRules_basics_end();
 }
 
-void invasion_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
+void invasion_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up.
 {
        if(autocvar_g_invasion_teams)
                invasion_teams = bound(2, autocvar_g_invasion_teams, 4);
index 4654795608ff7566a9461b12cc8c5ce7880b2d84..66ac8a80e38619e61012ce18b3185cda04556926 100644 (file)
@@ -82,8 +82,8 @@ void ka_EventLog(string mode, entity actor) // use an alias for easy changing an
 }
 
 void ka_TouchEvent();
-void ka_RespawnBall() // runs whenever the ball needs to be relocated
-{SELFPARAM();
+void ka_RespawnBall(entity this) // runs whenever the ball needs to be relocated
+{
        if(gameover) { return; }
        vector oldballorigin = self.origin;
 
@@ -100,7 +100,7 @@ void ka_RespawnBall() // runs whenever the ball needs to be relocated
        self.angles = '0 0 0';
        self.effects = autocvar_g_keepawayball_effects;
        self.touch = ka_TouchEvent;
-       self.think = ka_RespawnBall;
+       setthink(self, ka_RespawnBall);
        self.nextthink = time + autocvar_g_keepawayball_respawntime;
 
        Send_Effect(EFFECT_ELECTRO_COMBO, oldballorigin, '0 0 0', 1);
@@ -130,7 +130,7 @@ void ka_TouchEvent() // runs any time that the ball comes in contact with someth
        if(!self) { return; }
        if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
        { // The ball fell off the map, respawn it since players can't get to it
-               ka_RespawnBall();
+               ka_RespawnBall(self);
                return;
        }
        if(IS_DEAD(other)) { return; }
@@ -193,7 +193,7 @@ void ka_DropEvent(entity plyr) // runs any time that a player is supposed to los
        ball.movetype = MOVETYPE_BOUNCE;
        ball.wait = time + 1;
        ball.touch = ka_TouchEvent;
-       ball.think = ka_RespawnBall;
+       setthink(ball, ka_RespawnBall);
        ball.nextthink = time + autocvar_g_keepawayball_respawntime;
        ball.takedamage = DAMAGE_YES;
        ball.effects &= ~EF_NODRAW;
@@ -230,12 +230,12 @@ void ka_Reset(entity this)
 
        if(time < game_starttime)
        {
-               this.think = ka_RespawnBall;
+               setthink(this, ka_RespawnBall);
                this.touch = func_null;
                this.nextthink = game_starttime;
        }
        else
-               ka_RespawnBall();
+               ka_RespawnBall(this);
 }
 
 
index 2ba975c0da4f25141d569a8eaf1f182d665773db..078e3517d08bb5dcfdc42eee5db23236a657077c 100644 (file)
@@ -5,7 +5,7 @@
 int autocvar_g_tdm_point_limit;
 int autocvar_g_tdm_point_leadlimit;
 bool autocvar_g_tdm_team_spawns;
-void tdm_DelayedInit();
+void tdm_DelayedInit(entity this);
 
 REGISTER_MUTATOR(tdm, false)
 {
@@ -67,7 +67,7 @@ void tdm_SpawnTeam (string teamname, float teamcolor)
        WITHSELF(this, spawnfunc_tdm_team(this));
 }
 
-void tdm_DelayedInit()
+void tdm_DelayedInit(entity this)
 {
        // if no teams are found, spawn defaults
        if(find(world, classname, "tdm_team") == world)
index b32463c78c202a5d17797b5b2f42309697ed94bb..5a023a1dcc8224cecfdc6a4368bbd27761779c70 100644 (file)
@@ -724,67 +724,58 @@ float race_waypointsprite_visible_for_player(entity e)
                return false;
 }
 
-float have_verified;
-void trigger_race_checkpoint_verify()
-{SELFPARAM();
-       entity cp;
-       float i, p;
-       float qual;
-
-       if(have_verified)
-               return;
-       have_verified = 1;
+void trigger_race_checkpoint_verify(entity this)
+{
+    static bool have_verified;
+       if (have_verified) return;
+       have_verified = true;
 
-       qual = g_race_qualifying;
+       bool qual = g_race_qualifying;
 
-       setself(spawn());
-       TRANSMUTE(Player, self);
+       int pl_race_checkpoint = 0;
+       int pl_race_place = 0;
 
-       if(g_race)
-       {
-               for(i = 0; i <= race_highest_checkpoint; ++i)
-               {
-                       self.race_checkpoint = race_NextCheckpoint(i);
+       if (g_race) {
+               for (int i = 0; i <= race_highest_checkpoint; ++i) {
+                       pl_race_checkpoint = race_NextCheckpoint(i);
 
                        // race only (middle of the race)
-                       g_race_qualifying = 0;
-                       self.race_place = 0;
-                       if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false))
-                               error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for respawning in race) - bailing out"));
+                       g_race_qualifying = false;
+                       pl_race_place = 0;
+                       if (!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false)) {
+                               error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for respawning in race) - bailing out"));
+            }
 
-                       if(i == 0)
-                       {
+                       if (i == 0) {
                                // qualifying only
                                g_race_qualifying = 1;
-                               self.race_place = race_lowest_place_spawn;
-                               if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false))
-                                       error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for qualifying) - bailing out"));
+                               pl_race_place = race_lowest_place_spawn;
+                               if (!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false)) {
+                                       error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for qualifying) - bailing out"));
+                }
 
                                // race only (initial spawn)
                                g_race_qualifying = 0;
-                               for(p = 1; p <= race_highest_place_spawn; ++p)
-                               {
-                                       self.race_place = p;
-                                       if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false))
-                                               error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for initially spawning in race) - bailing out"));
+                               for (int p = 1; p <= race_highest_place_spawn; ++p) {
+                                       pl_race_place = p;
+                                       if (!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false)) {
+                                               error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for initially spawning in race) - bailing out"));
+                    }
                                }
                        }
                }
-       }
-       else if(!defrag_ents)
-       {
+       } else if (!defrag_ents) {
                // qualifying only
-               self.race_checkpoint = race_NextCheckpoint(0);
+               pl_race_checkpoint = race_NextCheckpoint(0);
                g_race_qualifying = 1;
-               self.race_place = race_lowest_place_spawn;
-               if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false))
-                       error(strcat("Checkpoint 0 misses a spawnpoint with race_place==", ftos(self.race_place), " (used for qualifying) - bailing out"));
-       }
-       else
-       {
-               self.race_checkpoint = race_NextCheckpoint(0);
+               pl_race_place = race_lowest_place_spawn;
+               if (!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false)) {
+                       error(strcat("Checkpoint 0 misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for qualifying) - bailing out"));
+        }
+       } else {
+               pl_race_checkpoint = race_NextCheckpoint(0);
                g_race_qualifying = 1;
-               self.race_place = 0; // there's only one spawn on defrag maps
+               pl_race_place = 0; // there's only one spawn on defrag maps
 
                // check if a defragcp file already exists, then read it and apply the checkpoint order
                float fh;
@@ -792,19 +783,18 @@ void trigger_race_checkpoint_verify()
                string l;
 
                defragcpexists = fh = fopen(strcat("maps/", GetMapname(), ".defragcp"), FILE_READ);
-               if(fh >= 0)
-               {
-                       while((l = fgets(fh)))
-                       {
+               if (fh >= 0) {
+                       while ((l = fgets(fh))) {
                                len = tokenize_console(l);
-                               if(len != 2)
-                               {
+                               if (len != 2) {
                                        defragcpexists = -1; // something's wrong in the defrag cp file, set defragcpexists to -1 so that it will be rewritten when someone finishes
                                        continue;
                                }
-                               for(cp = world; (cp = find(cp, classname, "target_checkpoint"));)
-                                       if(argv(0) == cp.targetname)
+                               for (entity cp = world; (cp = find(cp, classname, "target_checkpoint"));) {
+                                       if (argv(0) == cp.targetname) {
                                                cp.race_checkpoint = stof(argv(1));
+                    }
+                }
                        }
                        fclose(fh);
                }
@@ -812,60 +802,55 @@ void trigger_race_checkpoint_verify()
 
        g_race_qualifying = qual;
 
-       if(race_timed_checkpoint)
-       {
-               if(defrag_ents)
-               {
-                       for(cp = world; (cp = find(cp, classname, "target_startTimer"));)
+       if (race_timed_checkpoint) {
+               if (defrag_ents) {
+                       for (entity cp = world; (cp = find(cp, classname, "target_startTimer"));) {
                                WaypointSprite_UpdateSprites(cp.sprite, WP_RaceStart, WP_Null, WP_Null);
-                       for(cp = world; (cp = find(cp, classname, "target_stopTimer"));)
+            }
+                       for (entity cp = world; (cp = find(cp, classname, "target_stopTimer"));) {
                                WaypointSprite_UpdateSprites(cp.sprite, WP_RaceFinish, WP_Null, WP_Null);
-
-                       for(cp = world; (cp = find(cp, classname, "target_checkpoint"));)
-                       {
-                               if(cp.race_checkpoint == -2) // something's wrong with the defrag cp file or it has not been written yet, set defragcpexists to -1 so that it will be rewritten when someone finishes
+            }
+                       for (entity cp = world; (cp = find(cp, classname, "target_checkpoint"));) {
+                               if (cp.race_checkpoint == -2) { // something's wrong with the defrag cp file or it has not been written yet, set defragcpexists to -1 so that it will be rewritten when someone finishes
                                        defragcpexists = -1;
+                }
                        }
-
-                       if(defragcpexists != -1)
-                       {
+                       if (defragcpexists != -1) {
                                float largest_cp_id = 0;
-                               for(cp = world; (cp = find(cp, classname, "target_checkpoint"));)
-                                       if(cp.race_checkpoint > largest_cp_id)
+                               for (entity cp = world; (cp = find(cp, classname, "target_checkpoint"));) {
+                                       if (cp.race_checkpoint > largest_cp_id) {
                                                largest_cp_id = cp.race_checkpoint;
-                               for(cp = world; (cp = find(cp, classname, "target_stopTimer"));)
+                    }
+                }
+                               for (entity cp = world; (cp = find(cp, classname, "target_stopTimer"));) {
                                        cp.race_checkpoint = largest_cp_id + 1; // finish line
+                }
                                race_highest_checkpoint = largest_cp_id + 1;
                                race_timed_checkpoint = largest_cp_id + 1;
-                       }
-                       else
-                       {
-                               for(cp = world; (cp = find(cp, classname, "target_stopTimer"));)
+                       } else {
+                               for (entity cp = world; (cp = find(cp, classname, "target_stopTimer"));) {
                                        cp.race_checkpoint = 255; // finish line
+                }
                                race_highest_checkpoint = 255;
                                race_timed_checkpoint = 255;
                        }
-               }
-               else
-               {
-                       for(cp = world; (cp = find(cp, classname, "trigger_race_checkpoint")); )
-                               if(cp.sprite)
-                               {
-                                       if(cp.race_checkpoint == 0)
+               } else {
+                       for (entity cp = world; (cp = find(cp, classname, "trigger_race_checkpoint")); ) {
+                               if (cp.sprite) {
+                                       if (cp.race_checkpoint == 0) {
                                                WaypointSprite_UpdateSprites(cp.sprite, WP_RaceStart, WP_Null, WP_Null);
-                                       else if(cp.race_checkpoint == race_timed_checkpoint)
+                    } else if (cp.race_checkpoint == race_timed_checkpoint) {
                                                WaypointSprite_UpdateSprites(cp.sprite, WP_RaceFinish, WP_Null, WP_Null);
+                    }
                                }
+            }
                }
        }
 
-       if(defrag_ents)
-       {
-               entity trigger, targ;
-               for(trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); )
-                       for(targ = world; (targ = find(targ, targetname, trigger.target)); )
-                               if (targ.classname == "target_checkpoint" || targ.classname == "target_startTimer" || targ.classname == "target_stopTimer")
-                               {
+       if (defrag_ents) {
+               for (entity trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); ) {
+                       for (entity targ = world; (targ = find(targ, targetname, trigger.target)); ) {
+                               if (targ.classname == "target_checkpoint" || targ.classname == "target_startTimer" || targ.classname == "target_stopTimer") {
                                        trigger.wait = 0;
                                        trigger.delay = 0;
                                        targ.wait = 0;
@@ -883,9 +868,9 @@ void trigger_race_checkpoint_verify()
                                        //setorigin(targ, trigger.origin);
                                        //remove(trigger);
                                }
+            }
+        }
        }
-       remove(self);
-       setself(this);
 }
 
 vector trigger_race_checkpoint_spawn_evalfunc(entity player, entity spot, vector current)
index d6f3559cdc27f1ea69150e53d6397e9b00f8df6b..ef614c7ac3eaf55885ae4bb8d99246e8ac9d09f3 100644 (file)
@@ -68,7 +68,7 @@ spawnfunc(item_enviro)         { spawnfunc_item_invincible(this);     }
 .float delay;
 
 // weapon remove ent from df
-void target_init_verify()
+void target_init_verify(entity this)
 {
        entity trigger, targ;
        for(trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); )
@@ -95,8 +95,8 @@ spawnfunc(target_init)
 }
 
 // weapon give ent from defrag
-void target_give_init()
-{SELFPARAM();
+void target_give_init(entity this)
+{
        entity targ;
        for (targ = world; (targ = find(targ, targetname, self.target)); ) {
                if (targ.classname == "weapon_rocketlauncher" || targ.classname == "weapon_devastator") {
index fabeaeced96f4e41b2476aaad022b9e4176eac82..8dd4667117e8d745d12cc62e19fb2fef1add64ff 100644 (file)
@@ -31,7 +31,7 @@ void LogTeamchange(float player_id, float team_number, float type)
        GameLogEcho(strcat(":team:", ftos(player_id), ":", ftos(team_number), ":", ftos(type)));
 }
 
-void default_delayedinit()
+void default_delayedinit(entity this)
 {
        if(!scores_initialized)
                ScoreRules_generic();
index e24005a3211336bc53a8c082751df9bf82eeac74..2a3a528fea537dd16a59c839f5e6b373415c84e6 100644 (file)
@@ -16,7 +16,7 @@ void TeamchangeFrags(entity e);
 
 void LogTeamchange(float player_id, float team_number, float type);
 
-void default_delayedinit();
+void default_delayedinit(entity this);
 
 void ActivateTeamplay();
 
index b0e21e746f0cf39433ddeb1cd486f13146eaa8c8..7bbf00dc51c335262f6b3a757b3d97188d5692c5 100644 (file)
@@ -1,7 +1,7 @@
 #include "tests.qh"
 
-void test_weapons_hurt() {
-    SELFPARAM();
+void test_weapons_hurt(entity this)
+{
     EXPECT_NE(100, this.health);
     remove(this.enemy);
     remove(this);