]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move a shared raptor function into the main vehicle file
authorMario <mario@smbclan.net>
Sat, 18 Jun 2016 23:49:18 +0000 (09:49 +1000)
committerMario <mario@smbclan.net>
Sat, 18 Jun 2016 23:49:18 +0000 (09:49 +1000)
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/sv_vehicles.qh
qcsrc/common/vehicles/vehicle/bumblebee.qc
qcsrc/common/vehicles/vehicle/bumblebee.qh
qcsrc/common/vehicles/vehicle/raptor.qc

index 16208ba635bf9026a7ecb9df118a5cefcaabba62..6eca93643c7eb59f44725fe1df20d701c50fcef8 100644 (file)
@@ -124,6 +124,12 @@ void vehicles_locktarget(entity this, float incr, float decr, float _lock_time)
        }
 }
 
+float vehicle_altitude(entity this, float amax)
+{
+       tracebox(this.origin, this.mins, this.maxs, this.origin - ('0 0 1' * amax), MOVE_WORLDONLY, this);
+       return vlen(this.origin - trace_endpos);
+}
+
 vector vehicles_force_fromtag_hover(entity this, string tag_name, float spring_length, float max_power)
 {
        force_fromtag_origin = gettaginfo(this, gettagindex(this, tag_name));
index 8dcf18dc338ae05cef5409462acfd42af0302e31..eded4f90bf4837be143e75e6e531eb20430bb07b 100644 (file)
@@ -106,6 +106,7 @@ void vehicles_exit(entity vehic, int eject);
 bool vehicle_initialize(entity this, Vehicle info, float nodrop);
 bool vehicle_impulse(entity this, int imp);
 bool vehicles_crushable(entity e);
+float vehicle_altitude(entity this, float amax);
 
 #endif
 #endif
index d65d061fbcc885572afdfa034b92c69636b1e432..2750621f2c5e427b11fc152ff01ad59e33ceca7a 100644 (file)
@@ -629,7 +629,7 @@ void bumblebee_land(entity this)
 {
        float hgt;
 
-       hgt = raptor_altitude(this, 512);
+       hgt = vehicle_altitude(this, 512);
        this.velocity = (this.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * sys_frametime);
        this.angles_x *= 0.95;
        this.angles_z *= 0.95;
index 7a9fc2ccbe684b1bfb1b90a6b8224c59590c6ffb..b043038921460bb2768aca34238932a49352e566 100644 (file)
@@ -6,8 +6,4 @@
 void CSQC_BUMBLE_GUN_HUD();
 #endif
 
-#ifdef SVQC
-float raptor_altitude(entity this, float amax);
-#endif
-
 #endif
index 28716fc2669beb3cab84ab078a9a34a2b27d9327..fe381d3c631b70fb8353b1d02372b38f6ce03315 100644 (file)
@@ -77,23 +77,16 @@ vector autocvar_g_vehicle_raptor_bouncepain = '1 4 1000';
 .entity bomb1;
 .entity bomb2;
 
-float raptor_altitude(entity this, float amax)
-{
-       tracebox(this.origin, this.mins, this.maxs, this.origin - ('0 0 1' * amax), MOVE_WORLDONLY, this);
-       return vlen(this.origin - trace_endpos);
-}
-
 void raptor_land(entity this)
 {
        float hgt;
 
-       hgt = raptor_altitude(this, 512);
+       hgt = vehicle_altitude(this, 512);
        this.velocity = (this.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * sys_frametime);
        this.angles_x *= 0.95;
        this.angles_z *= 0.95;
 
-       if(hgt < 128)
-       if(hgt > 0)
+       if(hgt < 128 && hgt > 0)
                this.frame = (hgt / 128) * 25;
 
        this.bomb1.gun1.avelocity_y = 90 + ((this.frame / 25) * 2000);
@@ -113,19 +106,19 @@ void raptor_land(entity this)
 
 void raptor_exit(entity this, int eject)
 {
-       vector spot;
        this.tur_head.exteriormodeltoclient = NULL;
 
        if(!IS_DEAD(this))
        {
                setthink(this, raptor_land);
-               this.nextthink  = time;
+               this.nextthink = time;
        }
 
        if(!this.owner)
                return;
 
        makevectors(this.angles);
+       vector spot;
        if(eject)
        {
                spot = this.origin + v_forward * 100 + '0 0 64';
@@ -172,7 +165,6 @@ bool raptor_frame(entity this)
 
        vehicles_frame(vehic, this);
 
-       float ftmp = 0;
        /*
        ftmp = vlen(vehic.velocity);
        if(ftmp > autocvar_g_vehicle_raptor_speed_forward)
@@ -226,7 +218,7 @@ bool raptor_frame(entity this)
        if(df_y > 180)  df_y -= 360;
        if(df_y < -180) df_y += 360;
 
-       ftmp = shortangle_f(this.v_angle_y - vang_y, vang_y);
+       float ftmp = shortangle_f(this.v_angle_y - vang_y, vang_y);
        if(ftmp > 180)  ftmp -= 360; if(ftmp < -180) ftmp += 360;
        vehic.avelocity_y = bound(-autocvar_g_vehicle_raptor_turnspeed, ftmp + vehic.avelocity_y * 0.9, autocvar_g_vehicle_raptor_turnspeed);