From 72f8656b3d63e27cd2921c4905fc81ca6276d7d4 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Fri, 14 Oct 2022 01:29:23 +1000 Subject: [PATCH] func_plat: don't spawn a "start moving" trigger when .targetname is set on Q3 maps --- qcsrc/common/mapobjects/func/plat.qc | 7 +++++-- qcsrc/common/mapobjects/platforms.qc | 10 +++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/qcsrc/common/mapobjects/func/plat.qc b/qcsrc/common/mapobjects/func/plat.qc index 2376c5956d..ae9c121ab3 100644 --- a/qcsrc/common/mapobjects/func/plat.qc +++ b/qcsrc/common/mapobjects/func/plat.qc @@ -7,7 +7,9 @@ void plat_link(entity this); void plat_delayedinit(entity this) { plat_link(this); - plat_spawn_inside_trigger(this); // the "start moving" trigger + // Q3 uses only a truth check of .targetname to decide whether to spawn a trigger + if(!Q3COMPAT_COMMON || this.targetname == "") + plat_spawn_inside_trigger(this); // the "start moving" trigger } float plat_send(entity this, entity to, float sf) @@ -186,7 +188,8 @@ NET_HANDLE(ENT_CLIENT_PLAT, bool isnew) set_movetype(this, MOVETYPE_PUSH); this.move_time = time; - plat_spawn_inside_trigger(this); + if(!Q3COMPAT_COMMON || this.targetname == "") + plat_spawn_inside_trigger(this); } if(sf & SF_TRIGGER_RESET) diff --git a/qcsrc/common/mapobjects/platforms.qc b/qcsrc/common/mapobjects/platforms.qc index 2773845334..9e1f635b32 100644 --- a/qcsrc/common/mapobjects/platforms.qc +++ b/qcsrc/common/mapobjects/platforms.qc @@ -173,6 +173,14 @@ void plat_use(entity this, entity actor, entity trigger) plat_go_down(this); } +void plat_target_use(entity this, entity actor, entity trigger) +{ + if (this.state == STATE_TOP) + this.nextthink = this.ltime + 1; + else if (this.state != STATE_UP) + plat_go_up(this); +} + // WARNING: backwards compatibility because people don't use already existing fields :( // TODO: Check if any maps use these fields and remove these fields if it doesn't break maps .string sound1, sound2; @@ -189,7 +197,7 @@ void plat_reset(entity this) { setorigin(this, this.pos2); this.state = STATE_BOTTOM; - this.use = plat_trigger_use; + this.use = (this.targetname != "" && Q3COMPAT_COMMON) ? plat_target_use : plat_trigger_use; } #ifdef SVQC -- 2.39.2