X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmovelib.qc;h=acacba093a80dc2547da6206b6735dae9fa9ddab;hb=fb9267ffab37eae0bcbc4ac42a8a45a1ad864c0b;hp=de82b16a8ab1f793623514e24cb38639430deb4f;hpb=d83e03a366494037c020f4cebf474325de88e69e;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/movelib.qc b/qcsrc/server/movelib.qc index de82b16a8..acacba093 100644 --- a/qcsrc/server/movelib.qc +++ b/qcsrc/server/movelib.qc @@ -1,3 +1,5 @@ +#include "movelib.qh" + #ifdef SVQC .vector moveto; @@ -6,7 +8,7 @@ self.velocity = movelib_dragvec(self.velocity,0.02,0.5); **/ vector movelib_dragvec(float drag, float exp_) -{ +{SELFPARAM(); float lspeed,ldrag; lspeed = vlen(self.velocity); @@ -38,7 +40,7 @@ float movelib_dragflt(float fspeed,float drag,float exp_) self.velocity = movelib_inertmove_byspeed(self.velocity,newvel,1000,0.1,0.9); **/ vector movelib_inertmove_byspeed(vector vel_new, float vel_max,float newmin,float oldmax) -{ +{SELFPARAM(); float influense; influense = vlen(self.velocity) * (1 / vel_max); @@ -49,13 +51,12 @@ vector movelib_inertmove_byspeed(vector vel_new, float vel_max,float newmin,floa } vector movelib_inertmove(vector new_vel,float new_bias) -{ +{SELFPARAM(); return new_vel * new_bias + self.velocity * (1-new_bias); } -.float movelib_lastupdate; void movelib_move(vector force,float max_velocity,float drag,float theMass,float breakforce) -{ +{SELFPARAM(); float deltatime; float acceleration; float mspeed; @@ -162,24 +163,15 @@ void movelib_update(vector dir,float force) } */ -/* -void movelib_move_simple(vector newdir,float velo,float blendrate) -{ - self.velocity = self.velocity * (1 - blendrate) + (newdir * blendrate) * velo; -} -*/ -#define movelib_move_simple(newdir,velo,blendrate) \ - self.velocity = self.velocity * (1 - blendrate) + (newdir * blendrate) * velo - void movelib_beak_simple(float force) -{ +{SELFPARAM(); float mspeed; vector mdir; float vz; mspeed = max(0,vlen(self.velocity) - force); mdir = normalize(self.velocity); - vz = self.velocity_z; + vz = self.velocity.z; self.velocity = mdir * mspeed; self.velocity_z = vz; } @@ -191,16 +183,16 @@ 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(); vector a, b, c, d, e, r, push_angle, ahead, side; - push_angle_y = 0; + push_angle.y = 0; r = (self.absmax + self.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 * (self.maxs.x * 0.8); + side = v_right * (self.maxs.y * 0.8); a = r + ahead + side; b = r + ahead - side; @@ -208,36 +200,36 @@ void movelib_groundalign4point(float spring_length, float spring_up, float blend d = r - ahead - side; traceline(a, a - e,MOVE_NORMAL,self); - a_z = (1 - trace_fraction); + a.z = (1 - trace_fraction); r = trace_endpos; traceline(b, b - e,MOVE_NORMAL,self); - b_z = (1 - trace_fraction); + b.z = (1 - trace_fraction); r += trace_endpos; traceline(c, c - e,MOVE_NORMAL,self); - c_z = (1 - trace_fraction); + c.z = (1 - trace_fraction); r += trace_endpos; traceline(d, d - e,MOVE_NORMAL,self); - d_z = (1 - trace_fraction); + d.z = (1 - trace_fraction); r += trace_endpos; - a_x = r_z; + a.x = r.z; r = self.origin; - r_z = r_z; + r.z = r.z; - push_angle_x = (a_z - c_z) * _max; - push_angle_x += (b_z - d_z) * _max; + push_angle.x = (a.z - c.z) * _max; + push_angle.x += (b.z - d.z) * _max; - push_angle_z = (b_z - a_z) * _max; - push_angle_z += (d_z - c_z) * _max; + 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; - self.angles_x = ((1-blendrate) * self.angles_x) + (push_angle_x * blendrate); - self.angles_z = ((1-blendrate) * self.angles_z) + (push_angle_z * blendrate); + self.angles_x = ((1-blendrate) * self.angles.x) + (push_angle.x * blendrate); + self.angles_z = ((1-blendrate) * self.angles.z) + (push_angle.z * blendrate); //a = self.origin; setorigin(self,r);