]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix trigger_push and trigger_impulse prediction
authorbones_was_here <bones_was_here@xonotic.au>
Sat, 3 Jun 2023 18:01:22 +0000 (04:01 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Sat, 3 Jun 2023 18:18:06 +0000 (04:18 +1000)
It's a bit awkward that some triggers require the model field unset and
others require it unchanged, so rather than having duplicated code that
restores it after it was unset, an argument is added to control that
behaviour.

This should have been included in 2b46f62db61e8ca869fc591d9ebe4053c3e876d7
and/or 0f843f8c9e7891ba3029ac5a18c6ebebde3a30da

See also: https://gitlab.com/xonotic/xonotic-data.pk3dir/-/issues/2838

qcsrc/common/mapobjects/func/ladder.qc
qcsrc/common/mapobjects/trigger/impulse.qc
qcsrc/common/mapobjects/trigger/jumppads.qc
qcsrc/lib/warpzone/common.qh
qcsrc/lib/warpzone/server.qc
qcsrc/lib/warpzone/util_server.qc
qcsrc/lib/warpzone/util_server.qh

index 09a2eb88145b32a7bc1e9ac93dacc92fb29f900d..3d94c1a2d13ecf51e87d1a7b3f9d8d66635d2710 100644 (file)
@@ -64,11 +64,7 @@ void func_ladder_link(entity this)
 
 void func_ladder_init(entity this)
 {
-       string m = this.model;
-       EXACTTRIGGER_INIT;
-       // restore the model string unset in WarpZoneLib_ExactTrigger_Init()
-       // see: https://gitlab.com/xonotic/xonotic-data.pk3dir/-/issues/2838
-       this.model = m;
+       WarpZoneLib_ExactTrigger_Init(this, false);
        BITSET_ASSIGN(this.effects, EF_NODEPTHTEST);
        func_ladder_link(this);
        setthink(this, func_ladder_think);
index 8cafdfa38461b48c5d0219442d67cd2fced631ea..7d7e16788dda4ac6e03355c2e9d6ddd7b0f902ca 100644 (file)
@@ -174,7 +174,7 @@ void trigger_impulse_link(entity this)
 spawnfunc(trigger_impulse)
 {
        this.active = ACTIVE_ACTIVE;
-       EXACTTRIGGER_INIT;
+       WarpZoneLib_ExactTrigger_Init(this, false);
        BITSET_ASSIGN(this.effects, EF_NODEPTHTEST);
 
        if(this.radius)
index 0ff3ba0a99c58d05de97458666ba703825b9d998..517a2d48414cdbca42039cfaccf5eaaa142ede38 100644 (file)
@@ -606,7 +606,7 @@ spawnfunc(trigger_push)
 {
        SetMovedir(this);
 
-       EXACTTRIGGER_INIT;
+       WarpZoneLib_ExactTrigger_Init(this, false);
        BITSET_ASSIGN(this.effects, EF_NODEPTHTEST);
        this.active = ACTIVE_ACTIVE;
        this.use = trigger_push_use;
index ea7619af4d884069811fa2f5019b6be8413fdea7..f73d079792af9f663775cb4b5294718a16bba03d 100644 (file)
@@ -110,8 +110,7 @@ bool WarpZoneLib_MoveOutOfSolid(entity e);
 #define move_out_of_solid(e) WarpZoneLib_MoveOutOfSolid(e)
 
 bool WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher, bool touchfunc);
-void WarpZoneLib_ExactTrigger_Init(entity this);
 
 // WARNING: this kills the trace globals
 #define EXACTTRIGGER_TOUCH(e,t) if(!WarpZoneLib_ExactTrigger_Touch((e), (t), true)) return // intended for use in touch funcs
-#define EXACTTRIGGER_INIT  WarpZoneLib_ExactTrigger_Init(this)
+#define EXACTTRIGGER_INIT  WarpZoneLib_ExactTrigger_Init(this, true)
index f58a9801b36ee7bd788d4ffe4641a27f27caf0c4..d444ee6e8ee73e737bef409904a8fc33050ba4af 100644 (file)
@@ -702,19 +702,9 @@ spawnfunc(trigger_warpzone)
                this.scale = this.modelscale;
        if(!this.scale)
                this.scale = 1;
-       string m;
-       m = this.model;
-       WarpZoneLib_ExactTrigger_Init(this);
-       if(m != "")
-       {
-               precache_model(m);
-               _setmodel(this, m); // no precision needed
-       }
-       setorigin(this, this.origin);
-       if(this.scale)
-               setsize(this, this.mins * this.scale, this.maxs * this.scale);
-       else
-               setsize(this, this.mins, this.maxs);
+
+       WarpZoneLib_ExactTrigger_Init(this, false);
+
        setSendEntity(this, WarpZone_Send);
        this.SendFlags = 0xFFFFFF;
        BITSET_ASSIGN(this.effects, EF_NODEPTHTEST);
index 5f1aebf490268365fdd74e3e6d1fd6da87417c2c..1c22ee3829c77ed701de9ed6f91667b5abbfa798 100644 (file)
@@ -9,7 +9,7 @@
 #endif
 #include "common.qh"
 
-void WarpZoneLib_ExactTrigger_Init(entity this)
+void WarpZoneLib_ExactTrigger_Init(entity this, bool unsetmodel)
 {
        vector mi, ma;
        if (this.movedir == '0 0 0')
@@ -46,5 +46,7 @@ void WarpZoneLib_ExactTrigger_Init(entity this)
        else
                setsize(this, this.mins, this.maxs);
        set_movetype(this, MOVETYPE_NONE);
-       this.model = "";
+
+       if (unsetmodel)
+               this.model = "";
 }
index c4799c662c52d4a32e56fb860c28d107b6172a88..fe5bf07d43654e9f8867913696490dcfce75ca10 100644 (file)
@@ -2,5 +2,5 @@
 
 bool WarpZoneLib_MoveOutOfSolid(entity e);
 #ifdef SVQC
-void WarpZoneLib_ExactTrigger_Init(entity this);
+void WarpZoneLib_ExactTrigger_Init(entity this, bool unsetmodel);
 #endif