]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Set self in vehicle frames as before (until we can purify weapon functions), fixes...
authorMario <mario@smbclan.net>
Sat, 26 Mar 2016 07:58:37 +0000 (17:58 +1000)
committerMario <mario@smbclan.net>
Sat, 26 Mar 2016 07:58:37 +0000 (17:58 +1000)
qcsrc/common/physics/movelib.qc
qcsrc/common/physics/movelib.qh
qcsrc/common/turrets/turret/walker.qc
qcsrc/common/vehicles/vehicle/bumblebee.qc
qcsrc/common/vehicles/vehicle/racer.qc
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/common/vehicles/vehicle/spiderbot.qc

index 26c70daf60f2690119e73a4b213f92ff91787c37..a27b8666eedf0a716c4f5743dd844bdfd2593c76 100644 (file)
@@ -182,41 +182,41 @@ Yed need to set v_up and v_forward (generally by calling makevectors) before cal
 **/
 #endif
 
-void movelib_groundalign4point(float spring_length, float spring_up, float blendrate, float _max)
-{SELFPARAM();
+void movelib_groundalign4point(entity this, float spring_length, float spring_up, float blendrate, float _max)
+{
     vector a, b, c, d, e, r, push_angle, ahead, side;
 
     push_angle.y = 0;
-    r = (self.absmax + self.absmin) * 0.5 + (v_up * spring_up);
+    r = (this.absmax + this.absmin) * 0.5 + (v_up * spring_up);
     e = v_up * spring_length;
 
     // Put springs slightly inside bbox
-    ahead = v_forward * (self.maxs.x * 0.8);
-    side  = v_right   * (self.maxs.y * 0.8);
+    ahead = v_forward * (this.maxs.x * 0.8);
+    side  = v_right   * (this.maxs.y * 0.8);
 
     a = r + ahead + side;
     b = r + ahead - side;
     c = r - ahead + side;
     d = r - ahead - side;
 
-    traceline(a, a - e,MOVE_NORMAL,self);
+    traceline(a, a - e,MOVE_NORMAL,this);
     a.z =  (1 - trace_fraction);
     r = trace_endpos;
 
-    traceline(b, b - e,MOVE_NORMAL,self);
+    traceline(b, b - e,MOVE_NORMAL,this);
     b.z =  (1 - trace_fraction);
     r += trace_endpos;
 
-    traceline(c, c - e,MOVE_NORMAL,self);
+    traceline(c, c - e,MOVE_NORMAL,this);
     c.z =  (1 - trace_fraction);
     r += trace_endpos;
 
-    traceline(d, d - e,MOVE_NORMAL,self);
+    traceline(d, d - e,MOVE_NORMAL,this);
     d.z =  (1 - trace_fraction);
     r += trace_endpos;
 
     a.x = r.z;
-    r = self.origin;
+    r = this.origin;
     r.z = r.z;
 
     push_angle.x = (a.z - c.z) * _max;
@@ -225,13 +225,13 @@ void movelib_groundalign4point(float spring_length, float spring_up, float blend
     push_angle.z = (b.z - a.z) * _max;
     push_angle.z += (d.z - c.z) * _max;
 
-    //self.angles_x += push_angle_x * 0.95;
-    //self.angles_z += push_angle_z * 0.95;
+    //this.angles_x += push_angle_x * 0.95;
+    //this.angles_z += push_angle_z * 0.95;
 
-    self.angles_x = ((1-blendrate) *  self.angles.x)  + (push_angle.x * blendrate);
-    self.angles_z = ((1-blendrate) *  self.angles.z)  + (push_angle.z * blendrate);
+    this.angles_x = ((1-blendrate) *  this.angles.x)  + (push_angle.x * blendrate);
+    this.angles_z = ((1-blendrate) *  this.angles.z)  + (push_angle.z * blendrate);
 
-    //a = self.origin;
-    setorigin(self,r);
+    //a = this.origin;
+    setorigin(this,r);
 }
 
index 86cb7338509c0dad21121f4af8b7d2cfd743190f..90ea4b4160e12d79ce24e4b00e60fc9582c424f0 100644 (file)
@@ -48,6 +48,6 @@ Yed need to set v_up and v_forward (generally by calling makevectors) before cal
 **/
 #endif
 
-void movelib_groundalign4point(float spring_length, float spring_up, float blendrate, float _max);
+void movelib_groundalign4point(entity this, float spring_length, float spring_up, float blendrate, float _max);
 
 #endif
index ca665d08d91de207aa45dde4bdf8bcc94008c220..118e1a4acdf98b026970b200c167153c9b9a9cb1 100644 (file)
@@ -641,7 +641,7 @@ void walker_draw(entity this)
         return;
 
     fixedmakevectors(this.angles);
-    movelib_groundalign4point(300, 100, 0.25, 45);
+    movelib_groundalign4point(this, 300, 100, 0.25, 45);
     setorigin(this, this.origin + this.velocity * dt);
     this.tur_head.angles += dt * this.tur_head.move_avelocity;
     this.angles_y = this.move_angles_y;
index fd6b19bf30aed777f43aa1844d485e50e8a3e0cf..138f60f82f1e45473ae9560ef36d588425b07865 100644 (file)
@@ -100,6 +100,8 @@ bool bumblebee_gunner_frame(entity this)
        entity gun = this.vehicle;
        return = true;
 
+       setself(vehic);
+
        // this isn't technically a vehicle (yet), let's not do frame functions on it (yet)
        //vehicles_frame(gun, player);
 
@@ -201,6 +203,8 @@ bool bumblebee_gunner_frame(entity this)
        vehic.solid = SOLID_BBOX;
        PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
        this.vehicle_energy = (gun.vehicle_energy / autocvar_g_vehicle_bumblebee_cannon_ammo) * 100;
+
+       setself(this);
 }
 
 vector bumblebee_gunner_findgoodexit(vector prefer_spot, entity gunner, entity player)
@@ -429,6 +433,8 @@ bool bumblebee_pilot_frame(entity this)
                return;
        }
 
+       setself(vehic);
+
        bumblebee_regen(vehic);
 
        crosshair_trace(this);
@@ -620,6 +626,8 @@ bool bumblebee_pilot_frame(entity this)
        setorigin(this, vehic.origin + v_up * 48 + v_forward * 160);
 
        PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
+
+       setself(this);
 }
 
 void bumblebee_land()
index 7f47c6b0873e0aed0d2080f48650526b5cec164e..e57acf95fa44a8937b45af35ae6301bb53fe058b 100644 (file)
@@ -191,6 +191,8 @@ bool racer_frame(entity this)
                return;
        }
 
+       setself(vehic);
+
        racer_align4point(vehic, PHYS_INPUT_TIMELENGTH);
 
        PHYS_INPUT_BUTTON_ZOOM(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
@@ -392,6 +394,8 @@ bool racer_frame(entity this)
 
        setorigin(this, vehic.origin + '0 0 32');
        this.velocity = vehic.velocity;
+
+       setself(this);
 }
 
 void racer_think()
index c13ec3eafa818485cb3de68df5e5af306d578a35..6fee43d4e7b9f384083464223d17557aab1cd875 100644 (file)
@@ -170,6 +170,8 @@ bool raptor_frame(entity this)
                return;
        }
 
+       setself(vehic);
+
        vehicles_frame(vehic, this);
 
        float ftmp = 0;
@@ -200,7 +202,7 @@ bool raptor_frame(entity this)
        if(IS_DEAD(vehic))
        {
                PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
-               return 1;
+               return;
        }
        crosshair_trace(this);
 
@@ -460,6 +462,8 @@ bool raptor_frame(entity this)
                VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
 
        PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
+
+       setself(this);
 }
 
 bool raptor_takeoff(entity this)
@@ -467,6 +471,8 @@ bool raptor_takeoff(entity this)
        entity vehic = this.vehicle;
        return = true;
 
+       setself(this);
+
        vehic.nextthink = time;
        CSQCMODEL_AUTOUPDATE(vehic);
        vehic.nextthink = 0; // will this work?
@@ -511,6 +517,8 @@ bool raptor_takeoff(entity this)
                VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
 
        PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
+
+       setself(vehic);
 }
 
 void raptor_blowup()
index 1fff96fb2ada4005524a065f6a033b18f097ec74..9d6602b5477b27ec3b2713bae03c9f85ddb18ac0 100644 (file)
@@ -80,6 +80,8 @@ bool spiderbot_frame(entity this)
                return;
        }
 
+       setself(vehic);
+
        vehicles_frame(vehic, this);
 
        PHYS_INPUT_BUTTON_ZOOM(this) = false;
@@ -128,7 +130,7 @@ bool spiderbot_frame(entity this)
        //fixedmakevectors(vehic.angles);
        makevectors(vehic.angles + '-2 0 0' * vehic.angles_x);
 
-       WITH(entity, self, vehic, movelib_groundalign4point(autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit));
+       movelib_groundalign4point(vehic, autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit);
 
        if(IS_ONGROUND(vehic))
                vehic.jump_delay = time; // reset now so movement can begin
@@ -333,6 +335,8 @@ bool spiderbot_frame(entity this)
 
        if(vehic.vehicle_flags & VHF_HASSHIELD)
                VEHICLE_UPDATE_PLAYER(this, vehic, shield, spiderbot);
+
+       setself(this);
 }
 
 void spiderbot_exit(float eject)