From: Mario Date: Sat, 26 Mar 2016 07:58:37 +0000 (+1000) Subject: Set self in vehicle frames as before (until we can purify weapon functions), fixes... X-Git-Tag: xonotic-v0.8.2~1014 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=791f076d8048e98861a7b0580ea295dd8d355f73;p=xonotic%2Fxonotic-data.pk3dir.git Set self in vehicle frames as before (until we can purify weapon functions), fixes infinite vehicle ammo --- diff --git a/qcsrc/common/physics/movelib.qc b/qcsrc/common/physics/movelib.qc index 26c70daf6..a27b8666e 100644 --- a/qcsrc/common/physics/movelib.qc +++ b/qcsrc/common/physics/movelib.qc @@ -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); } diff --git a/qcsrc/common/physics/movelib.qh b/qcsrc/common/physics/movelib.qh index 86cb73385..90ea4b416 100644 --- a/qcsrc/common/physics/movelib.qh +++ b/qcsrc/common/physics/movelib.qh @@ -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 diff --git a/qcsrc/common/turrets/turret/walker.qc b/qcsrc/common/turrets/turret/walker.qc index ca665d08d..118e1a4ac 100644 --- a/qcsrc/common/turrets/turret/walker.qc +++ b/qcsrc/common/turrets/turret/walker.qc @@ -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; diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qc b/qcsrc/common/vehicles/vehicle/bumblebee.qc index fd6b19bf3..138f60f82 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qc @@ -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() diff --git a/qcsrc/common/vehicles/vehicle/racer.qc b/qcsrc/common/vehicles/vehicle/racer.qc index 7f47c6b08..e57acf95f 100644 --- a/qcsrc/common/vehicles/vehicle/racer.qc +++ b/qcsrc/common/vehicles/vehicle/racer.qc @@ -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() diff --git a/qcsrc/common/vehicles/vehicle/raptor.qc b/qcsrc/common/vehicles/vehicle/raptor.qc index c13ec3eaf..6fee43d4e 100644 --- a/qcsrc/common/vehicles/vehicle/raptor.qc +++ b/qcsrc/common/vehicles/vehicle/raptor.qc @@ -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() diff --git a/qcsrc/common/vehicles/vehicle/spiderbot.qc b/qcsrc/common/vehicles/vehicle/spiderbot.qc index 1fff96fb2..9d6602b54 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot.qc +++ b/qcsrc/common/vehicles/vehicle/spiderbot.qc @@ -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)