]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix Sub_CalcMove calls for already moving entities
authorFreddy <schro.sb@gmail.com>
Sun, 4 Mar 2018 23:25:28 +0000 (00:25 +0100)
committerFreddy <schro.sb@gmail.com>
Sun, 4 Mar 2018 23:25:28 +0000 (00:25 +0100)
qcsrc/common/triggers/subs.qc
qcsrc/common/triggers/subs.qh

index 5b6182e0ab8574877e11f8432a316bcf41e94aa3..2a237fdcb79abdb5be234fd7e65b0dd4512134c4 100644 (file)
@@ -145,6 +145,8 @@ void SUB_CalcMove_controller_think (entity this)
                // derivative: delta + 2 * delta2 (e.g. for angle positioning)
                entity own = this.owner;
                setthink(own, this.think1);
+               // set the owner's reference to this entity to NULL
+               own.move_controller = NULL;
                delete(this);
                getthink(own)(own);
        }
@@ -220,8 +222,14 @@ void SUB_CalcMove_Bezier (entity this, vector tcontrol, vector tdest, float tspe
                return;
        }
 
+       // delete the previous controller, otherwise changing movement midway is glitchy
+       if (this.move_controller != NULL)
+       {
+               delete(this.move_controller);
+       }
        controller = new(SUB_CalcMove_controller);
        controller.owner = this;
+       this.move_controller = controller;
        controller.platmovetype = this.platmovetype;
        controller.platmovetype_start = this.platmovetype_start;
        controller.platmovetype_end = this.platmovetype_end;
index 04b9ecd0d3782132dfcb837ae96193b0b1e5f75e..d2d36a8d16c5058711850a15754f82735f8cc018 100644 (file)
@@ -41,6 +41,8 @@ void SUB_VanishOrRemove (entity ent);
 
 .vector dest1, dest2;
 
+.entity move_controller;
+
 #ifdef CSQC
 // this stuff is defined in the server side engine VM, so we must define it separately here
 .float takedamage;