]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mapobjects/subs.qc
Merge branch 'master' into 'terencehill/nades_stuff'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mapobjects / subs.qc
index 847deca6e0e4c20578f48404022959ec4ecdde7b..09ceba21f0bb4caee58bc093bfb1ea6a11b5e8a6 100644 (file)
@@ -9,7 +9,7 @@ void SUB_CalcAngleMoveDone(entity this);
 spawnfunc(info_null)
 {
        delete(this);
-       // if anything breaks, tell the mapper to fix his map! info_null is meant to remove itself immediately.
+       // if anything breaks, tell the mapper to fix their map! info_null is meant to remove itself immediately.
 }
 #endif
 
@@ -102,6 +102,14 @@ void SUB_CalcMoveDone(entity this)
                this.think1 (this);
 }
 
+void SUB_CalcMovePause(entity this)
+{
+       if (!this.move_controller)
+               return;
+       this.move_controller.animstate_starttime += frametime;
+       this.move_controller.animstate_endtime += frametime;
+}
+
 .float platmovetype_turn;
 void SUB_CalcMove_controller_think (entity this)
 {
@@ -169,7 +177,8 @@ void SUB_CalcMove_controller_setbezier (entity controller, vector org, vector co
        // 2 * control * t - 2 * control * t * t + destin * t * t
        // 2 * control * t + (destin - 2 * control) * t * t
 
-       setorigin(controller, org);
+       //setorigin(controller, org); // don't link to the world
+       controller.origin = org;
        control -= org;
        destin -= org;
 
@@ -184,7 +193,8 @@ void SUB_CalcMove_controller_setlinear (entity controller, vector org, vector de
        // 2 * control * t - 2 * control * t * t + destin * t * t
        // 2 * control * t + (destin - 2 * control) * t * t
 
-       setorigin(controller, org);
+       //setorigin(controller, org); // don't link to the world
+       controller.origin = org;
        destin -= org;
 
        controller.destvec = destin; // end point
@@ -232,7 +242,8 @@ void SUB_CalcMove_Bezier (entity this, vector tcontrol, vector tdest, float tspe
        {
                delete(this.move_controller);
        }
-       controller = new(SUB_CalcMove_controller);
+       controller = new_pure(SUB_CalcMove_controller);
+       set_movetype(controller, MOVETYPE_NONE); // mark the entity as physics driven so that thinking is handled by QC
        controller.owner = this;
        this.move_controller = controller;
        controller.platmovetype = this.platmovetype;
@@ -287,6 +298,11 @@ void SUB_CalcMove (entity this, vector tdest, float tspeedtype, float tspeed, vo
                        break;
        }
 
+       // Q3 implements this fallback for all movers at the end of its InitMover()
+       // If .speed is negative this applies, instead of the mover-specific default speed.
+       if (traveltime <= 0)
+               traveltime = 0.001;
+
        // Very short animations don't really show off the effect
        // of controlled animation, so let's just use linear movement.
        // Alternatively entities can choose to specify non-controlled movement.
@@ -396,13 +412,15 @@ void ApplyMinMaxScaleAngles(entity e)
                e.mins_y = -e.maxs.x;
        }
        if(e.scale)
-               setsize(e, e.mins * e.scale, e.maxs * e.scale);
+               setsize(e, RoundPerfectVector(e.mins * e.scale), RoundPerfectVector(e.maxs * e.scale));
        else
                setsize(e, e.mins, e.maxs);
 }
 
 void SetBrushEntityModel(entity this, bool with_lod)
 {
+       // Ensure .solid is set correctly before calling this (for area grid linking/unlinking)
+
        if(this.model != "")
        {
                precache_model(this.model);
@@ -490,7 +508,7 @@ void LODmodel_attach(entity this)
                this.lodmodel1 = this.lodmodel2 = ""; // don't even initialize
        }
 
-       if(this.lodmodel1 != "")
+       if(this.lodmodel1 != "" && fexists(this.lodmodel1))
        {
                vector mi, ma;
                mi = this.mins;
@@ -500,7 +518,7 @@ void LODmodel_attach(entity this)
                _setmodel(this, this.lodmodel1);
                this.lodmodelindex1 = this.modelindex;
 
-               if(this.lodmodel2 != "")
+               if(this.lodmodel2 != "" && fexists(this.lodmodel2))
                {
                        precache_model(this.lodmodel2);
                        _setmodel(this, this.lodmodel2);