From: bones_was_here Date: Sat, 3 Jun 2023 18:01:22 +0000 (+1000) Subject: Fix trigger_push and trigger_impulse prediction X-Git-Tag: xonotic-v0.8.6~31 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=927b760f9f7b29ca15195db9089779ee37c8791e;p=xonotic%2Fxonotic-data.pk3dir.git Fix trigger_push and trigger_impulse prediction 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 --- diff --git a/qcsrc/common/mapobjects/func/ladder.qc b/qcsrc/common/mapobjects/func/ladder.qc index 09a2eb881..3d94c1a2d 100644 --- a/qcsrc/common/mapobjects/func/ladder.qc +++ b/qcsrc/common/mapobjects/func/ladder.qc @@ -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); diff --git a/qcsrc/common/mapobjects/trigger/impulse.qc b/qcsrc/common/mapobjects/trigger/impulse.qc index 8cafdfa38..7d7e16788 100644 --- a/qcsrc/common/mapobjects/trigger/impulse.qc +++ b/qcsrc/common/mapobjects/trigger/impulse.qc @@ -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) diff --git a/qcsrc/common/mapobjects/trigger/jumppads.qc b/qcsrc/common/mapobjects/trigger/jumppads.qc index 0ff3ba0a9..517a2d484 100644 --- a/qcsrc/common/mapobjects/trigger/jumppads.qc +++ b/qcsrc/common/mapobjects/trigger/jumppads.qc @@ -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; diff --git a/qcsrc/lib/warpzone/common.qh b/qcsrc/lib/warpzone/common.qh index ea7619af4..f73d07979 100644 --- a/qcsrc/lib/warpzone/common.qh +++ b/qcsrc/lib/warpzone/common.qh @@ -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) diff --git a/qcsrc/lib/warpzone/server.qc b/qcsrc/lib/warpzone/server.qc index f58a9801b..d444ee6e8 100644 --- a/qcsrc/lib/warpzone/server.qc +++ b/qcsrc/lib/warpzone/server.qc @@ -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); diff --git a/qcsrc/lib/warpzone/util_server.qc b/qcsrc/lib/warpzone/util_server.qc index 5f1aebf49..1c22ee382 100644 --- a/qcsrc/lib/warpzone/util_server.qc +++ b/qcsrc/lib/warpzone/util_server.qc @@ -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 = ""; } diff --git a/qcsrc/lib/warpzone/util_server.qh b/qcsrc/lib/warpzone/util_server.qh index c4799c662..fe5bf07d4 100644 --- a/qcsrc/lib/warpzone/util_server.qh +++ b/qcsrc/lib/warpzone/util_server.qh @@ -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