]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Clean up droptofloor() macro hacks and clarify naming
authorbones_was_here <bones_was_here@xonotic.au>
Sat, 13 Apr 2024 09:53:51 +0000 (19:53 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Wed, 17 Apr 2024 14:49:41 +0000 (00:49 +1000)
It wasn't clear at call sites that this had been changed to a delayed
function (in SVQC only), and that the return value was no longer
available. We can just use different names for the QC implementation,
with different names for delayed and direct calls, and leave the
original name for calling the builtin if required. The builtin's wrapper
macro for changing the self global to a parameter is retained and it now
works the same in SVQC and CSQC.

Removes another case of cc83c39c27ea0757cf169562428e443c5ab60fdc

12 files changed:
qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc
qcsrc/common/gamemodes/gamemode/domination/sv_domination.qc
qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc
qcsrc/common/mapobjects/misc/keys.qc
qcsrc/common/mutators/mutator/physical_items/sv_physical_items.qc
qcsrc/common/turrets/sv_turrets.qc
qcsrc/lib/self.qh
qcsrc/server/items/items.qc
qcsrc/server/sys-post.qh
qcsrc/server/sys-pre.qh
qcsrc/server/world.qc
qcsrc/server/world.qh

index 4bea0edf4e3bfe1d89d12c45904693245d80f5ac..747dbe88cbe46e1c79466685ea7b8a63524a11b5 100644 (file)
@@ -1387,7 +1387,7 @@ void ctf_FlagSetup(int teamnum, entity flag) // called when spawning a flag enti
        else // drop to floor, automatically find a platform and set that as spawn origin
        {
                flag.noalign = false;
-               droptofloor(flag);
+               DropToFloor_QC_DelayedInit(flag);
                set_movetype(flag, MOVETYPE_NONE);
        }
 
index 728915555f9aef3951af2e51f9f76c92d24a7ec8..e245ff92faf92d106c613493b8df1e49824b5375 100644 (file)
@@ -299,7 +299,7 @@ void dom_controlpoint_setup(entity this)
        this.flags = FL_ITEM;
        setsize(this, '-48 -48 -32', '48 48 32'); // 0.8.6 used '-32 -32 -32', '32 32 32' with sv_legacy_bbox_expand 1 and FL_ITEM
        setorigin(this, this.origin + '0 0 20');
-       droptofloor(this);
+       DropToFloor_QC_DelayedInit(this);
 
        waypoint_spawnforitem(this);
        WaypointSprite_SpawnFixed(WP_DomNeut, this.origin + '0 0 32', this, sprite, RADARICON_DOMPOINT);
index 370fda29d0f599a9cf40d6905568df2e06b3576d..8d9ad2e11b7c653effa52b745f8147b404d44146 100644 (file)
@@ -804,7 +804,7 @@ void ons_ControlPoint_Setup(entity cp)
        {
                setorigin(cp, cp.origin + '0 0 20');
                cp.noalign = false;
-               droptofloor(cp);
+               DropToFloor_QC_DelayedInit(cp);
                set_movetype(cp, MOVETYPE_TOSS);
        }
 
@@ -1104,7 +1104,7 @@ void ons_GeneratorSetup(entity gen) // called when spawning a generator entity o
        gen.colormap = 1024 + (teamnum - 1) * 17;
 
        // generator placement
-       droptofloor(gen);
+       DropToFloor_QC_DelayedInit(gen);
 
        // waypointsprites
        WaypointSprite_SpawnFixed(WP_Null, gen.origin + CPGEN_WAYPOINT_OFFSET, gen, sprite, RADARICON_NONE);
index df80bc03cba81e0c01debc9b5cb15444fe34ac24..6c52e6a1e7a4b0493cf8096fd4fbe5e2c2f42da3 100644 (file)
@@ -126,7 +126,7 @@ void spawn_item_key(entity this)
 
        // NOTE: this isn't an FL_ITEM so it doesn't get the special treatment in DropToFloor_QC()
        if (!this.noalign)
-               droptofloor(this);
+               DropToFloor_QC_DelayedInit(this);
 
        settouch(this, item_key_touch);
 }
index 328f79ac877519066b85c1de88107b4387aa1682..30f6a2808638ac03f348e562ae115fb894aaf7da 100644 (file)
@@ -124,11 +124,7 @@ MUTATOR_HOOKFUNCTION(physical_items, Item_Spawn)
        wep.event_damage = physical_item_damage;
 
        if(!wep.cnt)
-       {
-               // fix the spawn origin
-               setorigin(wep, wep.origin + '0 0 1');
-               droptofloor(wep);
-       }
+               DropToFloor_QC_DelayedInit(wep);
 
        wep.spawn_origin = wep.origin;
        wep.spawn_angles = item.angles;
index a42005f32a2a0af5fca32a41a671a0873e17844b..4c7ce5ab418a7bb6567ee2b6bcaeef2da5fc5f50 100644 (file)
@@ -1299,7 +1299,7 @@ bool turret_initialize(entity this, Turret tur)
        }
 
        if(!(this.spawnflags & TSF_SUSPENDED))
-               droptofloor(this);
+               DropToFloor_QC_DelayedInit(this);
 
        this.netname = tur.netname;
        load_unit_settings(this, 0);
index b057faee58bdc606a8a743c331febece5582f397..13f70579427e0191573c28da3b97d1a1e80313fd 100644 (file)
@@ -99,9 +99,7 @@ SELFWRAP(SendEntity, bool, (entity to, int sendflags), (entity this, entity to,
 
 #define ChangeYaw(e, ...) (__self = (e), builtin_ChangeYaw(__VA_ARGS__))
 #define checkclient(e, ...) (__self = (e), builtin_checkclient(__VA_ARGS__))
-#ifndef SVQC
-    #define droptofloor(e, ...) (__self = (e), builtin_droptofloor(__VA_ARGS__))
-#endif
+#define droptofloor(e, ...) (__self = (e), builtin_droptofloor(__VA_ARGS__))
 #define error(...) (__self = (NULL), builtin_error(__VA_ARGS__))
 #define movetogoal(e, ...) (__self = (e), builtin_movetogoal(__VA_ARGS__))
 #define walkmove(e, ...) (__self = (e), builtin_walkmove(__VA_ARGS__))
index b0b68fd920791b06b850cc3dabef1f047d78e844..825f003a5a0d249114bc7625e92b847d7b564445 100644 (file)
@@ -1125,9 +1125,8 @@ void StartItem(entity this, entity def)
                // do item filtering according to game mode and other things
                if (this.noalign <= 0)
                {
-                       // note droptofloor returns false if stuck/or would fall too far
                        if (!this.noalign)
-                               droptofloor(this);
+                               DropToFloor_QC_DelayedInit(this);
                        waypoint_spawnforitem(this);
                }
 
index 2d92f5dfea934572b5809160f7d5e3bdfb5a4d81..c4ff0fa58b40531cbbb7ca5f2f6a424c93782a31 100644 (file)
@@ -1,6 +1,5 @@
 #pragma once
 
-#undef droptofloor
 #undef sound
 
 var void delete_fn(entity e);
index 7e5e10421ac263729bf926a036c0555018eaa5ef..a00a1ac0a48d5cb13c4dedfbf51b2b72f5f62c14 100644 (file)
@@ -1,7 +1,5 @@
 #pragma once
 
-#define droptofloor builtin_droptofloor
-
 #define IT_SHOTGUN          _IT_SHOTGUN /* BIT(0) */
 #define IT_SUPER_SHOTGUN    _IT_SUPER_SHOTGUN /* BIT(1) */
 #define IT_NAILGUN          _IT_NAILGUN /* BIT(2) */
index 6d173d7973eb12f7c08612ac1a3d94eb1d99666b..4ce29a707f26338b3dd9f818362a04cf7b216318 100644 (file)
@@ -2414,7 +2414,7 @@ void DropToFloor_QC(entity this)
        setorigin(this, this.dropped_origin = this.origin);
 }
 
-void droptofloor(entity this)
+void DropToFloor_QC_DelayedInit(entity this)
 {
        InitializeEntity(this, DropToFloor_QC, INITPRIO_DROPTOFLOOR);
 }
index 09ee564cf9e6a169cbcb241a9416d2807a29e9ab..d76169e2dea054dd4a1bd35018784b5483afa25f 100644 (file)
@@ -161,7 +161,7 @@ void readplayerstartcvars();
 void readlevelcvars();
 
 .vector dropped_origin;
-void droptofloor(entity this);
+void DropToFloor_QC_DelayedInit(entity this);
 
 IntrusiveList g_moveables;
 STATIC_INIT(g_moveables) { g_moveables = IL_NEW(); }