From 9f0eefd4a82f643540940fb086955ef8afb7eb19 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 22 Jul 2023 17:04:32 +0200 Subject: [PATCH] Fix #2814 "trigger_push division by zero errors when starting map AMT-Freestyle6". Also fix a warning on the same map when a door squashes the player --- qcsrc/common/mapobjects/subs.qc | 2 ++ qcsrc/common/mapobjects/trigger/jumppads.qc | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/qcsrc/common/mapobjects/subs.qc b/qcsrc/common/mapobjects/subs.qc index fbcb4b39a..f89ab21e2 100644 --- a/qcsrc/common/mapobjects/subs.qc +++ b/qcsrc/common/mapobjects/subs.qc @@ -104,6 +104,8 @@ void SUB_CalcMoveDone(entity this) void SUB_CalcMovePause(entity this) { + if (!this.move_controller) + return; this.move_controller.animstate_starttime += frametime; this.move_controller.animstate_endtime += frametime; } diff --git a/qcsrc/common/mapobjects/trigger/jumppads.qc b/qcsrc/common/mapobjects/trigger/jumppads.qc index f7281e5e4..98498de1c 100644 --- a/qcsrc/common/mapobjects/trigger/jumppads.qc +++ b/qcsrc/common/mapobjects/trigger/jumppads.qc @@ -588,7 +588,10 @@ bool trigger_push_test(entity this, entity item) } else { - if (trigger_push_testorigin(e, t, this, org)) + // optimization: if horizontal velocity is 0 then target is not good since the trajectory + // will definitely go back to the jumppad (horizontal velocity of best_vel can't be 0 anyway) + if ((e.velocity.x != 0 || e.velocity.y != 0) + && trigger_push_testorigin(e, t, this, org)) { best_target = trace_endpos; best_org = org; -- 2.39.2