]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Clean up/optimize racer code a bit. Make it use a simpler phys path when idle. Tweak...
authorJakob MG <jakob_mg@hotmail.com>
Sat, 19 May 2012 14:50:50 +0000 (16:50 +0200)
committerJakob MG <jakob_mg@hotmail.com>
Sat, 19 May 2012 14:50:50 +0000 (16:50 +0200)
qcsrc/server/vehicles/racer.qc
qcsrc/server/vehicles/vehicles.qc
vehicle_racer.cfg

index 777820e48c261c26f18cc8c9b093b42abfa71a85..6c256416a487f4b978a8e0047b28b7b6fcd2c91f 100644 (file)
@@ -72,36 +72,32 @@ vector autocvar_g_vehicle_racer_bouncepain;
 
 var vector racer_force_from_tag(string tag_name, float spring_length, float max_power);
 
-void racer_align4point()
+void racer_align4point(float _delta)
 {
-    vector push_vector, v_add;
+    vector push_vector;
     float fl_push, fr_push, bl_push, br_push;
 
-
     push_vector  = racer_force_from_tag("tag_engine_fr", autocvar_g_vehicle_racer_springlength, autocvar_g_vehicle_racer_hoverpower);
     fr_push      = force_fromtag_normpower;
-    //vehicles_sweap_collision(force_fromtag_origin, self.velocity, frametime, v_add, autocvar_g_vehicle_racer_collision_multiplier);
+    //vehicles_sweap_collision(force_fromtag_origin, self.velocity, _delta, v_add, autocvar_g_vehicle_racer_collision_multiplier);
 
     push_vector += racer_force_from_tag("tag_engine_fl", autocvar_g_vehicle_racer_springlength, autocvar_g_vehicle_racer_hoverpower);
     fl_push      = force_fromtag_normpower;
-    //vehicles_sweap_collision(force_fromtag_origin, self.velocity, frametime, v_add, autocvar_g_vehicle_racer_collision_multiplier);
+    //vehicles_sweap_collision(force_fromtag_origin, self.velocity, _delta, v_add, autocvar_g_vehicle_racer_collision_multiplier);
 
     push_vector += racer_force_from_tag("tag_engine_br", autocvar_g_vehicle_racer_springlength, autocvar_g_vehicle_racer_hoverpower);
     br_push      = force_fromtag_normpower;
-    //vehicles_sweap_collision(force_fromtag_origin, self.velocity, frametime, v_add, autocvar_g_vehicle_racer_collision_multiplier);
+    //vehicles_sweap_collision(force_fromtag_origin, self.velocity, _delta, v_add, autocvar_g_vehicle_racer_collision_multiplier);
 
     push_vector += racer_force_from_tag("tag_engine_bl", autocvar_g_vehicle_racer_springlength, autocvar_g_vehicle_racer_hoverpower);
     bl_push      = force_fromtag_normpower;
-    //vehicles_sweap_collision(force_fromtag_origin, self.velocity, frametime, v_add, autocvar_g_vehicle_racer_collision_multiplier);
+    //vehicles_sweap_collision(force_fromtag_origin, self.velocity, _delta, v_add, autocvar_g_vehicle_racer_collision_multiplier);
 
-    self.velocity += (push_vector * frametime);
+   self.velocity += push_vector * _delta;
 
     // Anti ocilation
-    if(self.velocity_z  > 0)
-        self.velocity_z *= 1 - (autocvar_g_vehicle_racer_upforcedamper * frametime);
-
-    self.velocity   += v_add;
-    //self.velocity_z -= autocvar_sv_gravity * frametime;
+    if(self.velocity_z > 0)
+        self.velocity_z *= 1 - autocvar_g_vehicle_racer_upforcedamper * _delta;
 
     push_vector_x =  (fl_push - bl_push);
     push_vector_x += (fr_push - br_push);
@@ -112,12 +108,12 @@ void racer_align4point()
     push_vector_z *= 360;
 
     // Apply angle diffrance
-    self.angles_z += push_vector_z * frametime;
-    self.angles_x += push_vector_x * frametime;
+    self.angles_z += push_vector_z * _delta;
+    self.angles_x += push_vector_x * _delta;
 
     // Apply stabilizer
-    self.angles_x *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * frametime);
-    self.angles_z *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * frametime);
+    self.angles_x *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * _delta);
+    self.angles_z *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * _delta);
 }
 
 void racer_fire_cannon(string tagname)
@@ -212,6 +208,9 @@ void racer_rocket_tracker()
     traceline(self.origin, self.origin + v_forward * 64 - '0 0 32', MOVE_NORMAL, self);
     newdir = normalize(self.enemy.origin - self.origin);
 
+    //vector
+       float height_diff = self.enemy.origin_z - self.origin_z;
+
     if(vlen(newdir - v_forward) > autocvar_g_vehicle_racer_rocket_locked_maxangle)
     {
         //bprint("Target lost!\n");
@@ -220,11 +219,12 @@ void racer_rocket_tracker()
         return;
     }
 
-    if(trace_fraction != 1.0)
+    if(trace_fraction != 1.0 && trace_ent != self.enemy)
         newdir_z += 16 * sys_frametime;
 
     self.velocity = normalize(olddir + newdir * autocvar_g_vehicle_racer_rocket_turnrate) * newvel;
-    self.velocity_z -= 800 * sys_frametime;
+    self.velocity_z -= 800 * sys_frametime ;
+    self.velocity_z += max(height_diff, cvar("bajs")) * sys_frametime ;
 
     UpdateCSQCProjectile(self);
     return;
@@ -232,11 +232,8 @@ void racer_rocket_tracker()
 
 void racer_fire_rocket(string tagname, entity trg)
 {
-    vector v;
-    entity rocket;
-
-    v = gettaginfo(self, gettagindex(self, tagname));
-    rocket = vehicles_projectile("wakizashi_rocket_launch", "weapons/rocket_fire.wav",
+    vector v = gettaginfo(self, gettagindex(self, tagname));
+    entity rocket = rocket = vehicles_projectile("wakizashi_rocket_launch", "weapons/rocket_fire.wav",
                            v, v_forward * autocvar_g_vehicle_racer_rocket_speed,
                            autocvar_g_vehicle_racer_rocket_damage, autocvar_g_vehicle_racer_rocket_radius, autocvar_g_vehicle_racer_rocket_force, 3,
                            DEATH_WAKIROCKET, PROJECTILE_WAKIROCKET, 20, FALSE, FALSE);
@@ -265,11 +262,11 @@ float racer_frame()
     player  = self;
     racer   = self.vehicle;
     self    = racer;
-    
+
     player.BUTTON_ZOOM = player.BUTTON_CROUCH = 0;
-    
+
     vehicles_painframe();
-    
+
     if(racer.deadflag != DEAD_NO)
     {
         self = player;
@@ -277,7 +274,7 @@ float racer_frame()
         return 1;
     }
 
-    racer_align4point();
+    racer_align4point(frametime);
 
     crosshair_trace(player);
 
@@ -299,84 +296,68 @@ float racer_frame()
     makevectors(racer.angles);
     racer.angles_x *= -1;
 
-
-    ftmp = racer.velocity_z;
+    //ftmp = racer.velocity_z;
     df = racer.velocity * -autocvar_g_vehicle_racer_friction;
-    racer.velocity_z = ftmp;
+    //racer.velocity_z = ftmp;
 
-    if(player.movement_x != 0)
-    {
-        if(player.movement_x > 0)
-            df += v_forward  * autocvar_g_vehicle_racer_speed_forward;
-        else if(player.movement_x < 0)
-            df -= v_forward  * autocvar_g_vehicle_racer_speed_forward;
-    }
-
-    if(player.movement_y != 0)
-    {
-        if(player.movement_y < 0)
-            df -= v_right * autocvar_g_vehicle_racer_speed_strafe;
-        else if(player.movement_y > 0)
-            df += v_right * autocvar_g_vehicle_racer_speed_strafe;
-    }
-    
     if(vlen(player.movement) != 0)
     {
+        if(player.movement_x)
+            df += v_forward * ((player.movement_x > 0) ? autocvar_g_vehicle_racer_speed_forward : -autocvar_g_vehicle_racer_speed_forward);
+
+        if(player.movement_y)
+            df += v_right * ((player.movement_y > 0) ? autocvar_g_vehicle_racer_speed_strafe : -autocvar_g_vehicle_racer_speed_strafe);
+
         if(self.sound_nexttime < time || self.sounds != 1)
-        {        
+        {
             self.sounds = 1;
             self.sound_nexttime = time + 10.922667; //soundlength("vehicles/racer_move.wav");
             sound (self, CH_TRIGGER_SINGLE, "vehicles/racer_move.wav", VOL_VEHICLEENGINE, ATTN_NORM);
         }
     }
     else
-    {        
+    {
         if(self.sound_nexttime < time || self.sounds != 0)
-        {        
+        {
             self.sounds = 0;
             self.sound_nexttime = time + 11.888604; //soundlength("vehicles/racer_idle.wav");
             sound (self, CH_TRIGGER_SINGLE, "vehicles/racer_idle.wav", VOL_VEHICLEENGINE, ATTN_NORM);
-        }        
+        }
     }
-    
+
     // Afterburn
     if (player.BUTTON_JUMP && racer.vehicle_energy >= (autocvar_g_vehicle_racer_afterburn_cost * frametime))
     {
         if(time - racer.wait > 0.2)
-            pointparticles(particleeffectnum("wakizashi_booster_smoke"), self.origin, '0 0 0', 1);            
-        
+            pointparticles(particleeffectnum("wakizashi_booster_smoke"), self.origin, '0 0 0', 1);
+
         racer.wait = time;
         racer.vehicle_energy -= autocvar_g_vehicle_racer_afterburn_cost * frametime;
         df += (v_forward * autocvar_g_vehicle_racer_speed_afterburn);
-        
-        if(self.invincible_finished < time)
-        {            
-            traceline(self.origin, self.origin - '0 0 256', MOVE_NORMAL, self);
+
+        if(racer.invincible_finished < time)
+        {
+            traceline(racer.origin, racer.origin - '0 0 256', MOVE_NORMAL, self);
             if(trace_fraction != 1.0)
                 pointparticles(particleeffectnum("smoke_small"), trace_endpos, '0 0 0', 1);
-            
-            self.invincible_finished = time + 0.1 + (random() * 0.1);
+
+            racer.invincible_finished = time + 0.1 + (random() * 0.1);
         }
 
-        if(self.strength_finished < time)
-        {        
-            //self.sounds = 2;
-            self.strength_finished = time + 10.922667; //soundlength("vehicles/racer_boost.wav");
-            sound (self.tur_head, CH_TRIGGER_SINGLE, "vehicles/racer_boost.wav", VOL_VEHICLEENGINE, ATTN_NORM);            
-        }        
+        if(racer.strength_finished < time)
+        {
+            racer.strength_finished = time + 10.922667; //soundlength("vehicles/racer_boost.wav");
+            sound (racer.tur_head, CH_TRIGGER_SINGLE, "vehicles/racer_boost.wav", VOL_VEHICLEENGINE, ATTN_NORM);
+        }
     }
     else
     {
-        self.strength_finished = 0;
-        sound (self.tur_head, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_VEHICLEENGINE, ATTN_NORM);
+        racer.strength_finished = 0;
+        sound (racer.tur_head, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_VEHICLEENGINE, ATTN_NORM);
     }
-        
 
-    racer.velocity  += df * frametime;
-
-    df = (vlen(racer.velocity) * autocvar_g_vehicle_racer_downforce * v_up) * frametime;
-    racer.velocity  = racer.velocity - df;
-    player.movement = racer.velocity;
+       df -= v_up * (vlen(racer.velocity) * autocvar_g_vehicle_racer_downforce);
+    player.movement = racer.velocity += df * frametime;
 
     if(player.BUTTON_ATCK)
     if(time > racer.attack_finished_single)
@@ -397,7 +378,6 @@ float racer_frame()
             racer.cnt = 1;
         }
         racer.attack_finished_single = time + autocvar_g_vehicle_racer_cannon_refire;
-        //self.owner.vehicle_energy = racer.vehicle_energy / autocvar_g_vehicle_racer_energy;
     }
 
     if(autocvar_g_vehicle_racer_rocket_locktarget)
@@ -420,16 +400,17 @@ float racer_frame()
     if(time > racer.delay)
     if(player.BUTTON_ATCK2)
     {
-        self.misc_bulletcounter += 1;
+        racer.misc_bulletcounter += 1;
         racer.delay = time + 0.3;
-        if(self.misc_bulletcounter == 1)
-            racer_fire_rocket("tag_rocket_r", (self.lock_strength == 1 && self.lock_target) ? self.lock_target : world);
-        else if(self.misc_bulletcounter == 2)
+
+        if(racer.misc_bulletcounter == 1)
+            racer_fire_rocket("tag_rocket_r", (racer.lock_strength == 1 && racer.lock_target) ? racer.lock_target : world);
+        else if(racer.misc_bulletcounter == 2)
         {
-            racer_fire_rocket("tag_rocket_l", (self.lock_strength == 1 && self.lock_target) ? self.lock_target : world);
-            self.lock_strength  = 0;
-            self.lock_target    = world;
-            self.misc_bulletcounter = 0;
+            racer_fire_rocket("tag_rocket_l", (racer.lock_strength == 1 && racer.lock_target) ? racer.lock_target : world);
+            racer.lock_strength  = 0;
+            racer.lock_target    = world;
+            racer.misc_bulletcounter = 0;
 
             racer.delay = time + autocvar_g_vehicle_racer_rocket_refire;
             racer.lip = time;
@@ -437,23 +418,22 @@ float racer_frame()
     }
     player.vehicle_reload1 = bound(0, 100 * ((time - racer.lip) / (racer.delay - racer.lip)), 100);
 
-    if(self.vehicle_flags  & VHF_SHIELDREGEN)
+    if(racer.vehicle_flags  & VHF_SHIELDREGEN)
         vehicles_regen(dmg_time, vehicle_shield, autocvar_g_vehicle_racer_shield, autocvar_g_vehicle_racer_shield_regen_pause, autocvar_g_vehicle_racer_shield_regen, frametime);
 
-    if(self.vehicle_flags  & VHF_HEALTHREGEN)
+    if(racer.vehicle_flags  & VHF_HEALTHREGEN)
         vehicles_regen(dmg_time, vehicle_health, autocvar_g_vehicle_racer_health, autocvar_g_vehicle_racer_health_regen_pause, autocvar_g_vehicle_racer_health_regen, frametime);
 
-    if(self.vehicle_flags  & VHF_ENERGYREGEN)
+    if(racer.vehicle_flags  & VHF_ENERGYREGEN)
         vehicles_regen(wait, vehicle_energy, autocvar_g_vehicle_racer_energy, autocvar_g_vehicle_racer_energy_regen_pause, autocvar_g_vehicle_racer_energy_regen, frametime);
 
 
     VEHICLE_UPDATE_PLAYER(health, racer);
     VEHICLE_UPDATE_PLAYER(energy, racer);
 
-    if(self.vehicle_flags & VHF_HASSHIELD)
+    if(racer.vehicle_flags & VHF_HASSHIELD)
         VEHICLE_UPDATE_PLAYER(shield, racer);
 
-
     player.BUTTON_ATCK = player.BUTTON_ATCK2 = 0;
     setorigin(player,racer.origin + '0 0 32');
     player.velocity = racer.velocity;
@@ -464,32 +444,24 @@ float racer_frame()
 
 void racer_think()
 {
-    /*
-    float a, b, c;a = autocvar_g_vehicle_racer_anglestabilizer;
-    b = autocvar_g_vehicle_racer_springlength;
-    c = autocvar_g_vehicle_racer_hoverpower;
-
-    autocvar_g_vehicle_racer_anglestabilizer = 36;
-    autocvar_g_vehicle_racer_springlength = 96;
-    autocvar_g_vehicle_racer_hoverpower = 300;
-    */
-
-    racer_align4point(); //time - self.nextthink);
-
-    /*
-    //if(self.velocity_z > 0)
-    //    self.velocity_z *= 0.95;
-
-    autocvar_g_vehicle_racer_anglestabilizer = a;
-    autocvar_g_vehicle_racer_springlength = b;
-    autocvar_g_vehicle_racer_hoverpower = c;
-    */
-
-    self.velocity_x *= 0.9;
-    self.velocity_y *= 0.9;
-    self.velocity_z *= 0.8;
-    self.velocity_z += sin(time * 2) * 16;
-    self.nextthink = time; // + 0.05;
+    self.nextthink = time;
+
+    float pushdeltatime = time - self.lastpushtime;
+    if (pushdeltatime > 0.15) pushdeltatime = 0;
+    self.lastpushtime = time;
+    if(!pushdeltatime) return;
+
+    tracebox(self.origin, self.mins, self.maxs, self.origin - ('0 0 1' * autocvar_g_vehicle_racer_springlength), MOVE_NORMAL, self);
+
+    vector df = self.velocity * -autocvar_g_vehicle_racer_friction;
+       df_z += (1 - trace_fraction) * autocvar_g_vehicle_racer_hoverpower + sin(time * 2) * (autocvar_g_vehicle_racer_springlength * 2);
+
+       self.velocity += df * pushdeltatime;
+    if(self.velocity_z > 0)
+        self.velocity_z *= 1 - autocvar_g_vehicle_racer_upforcedamper * pushdeltatime;
+
+    self.angles_x *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * pushdeltatime);
+    self.angles_z *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * pushdeltatime);
 }
 
 void racer_enter()
@@ -497,7 +469,7 @@ void racer_enter()
     self.movetype = MOVETYPE_BOUNCE;
     self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_racer_health)  * 100;
     self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_racer_shield)  * 100;
-    
+
     if(self.owner.flagcarried)
        setorigin(self.owner.flagcarried, '-190 0 96');
 }
@@ -505,12 +477,12 @@ void racer_enter()
 void racer_exit(float eject)
 {
     vector spot;
-    
+
     self.think      = racer_think;
     self.nextthink  = time;
-    self.movetype   = MOVETYPE_TOSS;
+    self.movetype   = MOVETYPE_BOUNCE;
     sound (self.tur_head, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_VEHICLEENGINE, ATTN_NORM);
-    
+
     if not (self.owner)
         return;
 
@@ -525,15 +497,27 @@ void racer_exit(float eject)
        }
        else
        {
-           self.owner.velocity = normalize(self.velocity) * autocvar_sv_maxairspeed;
+               if(vlen(self.velocity) > 2 * autocvar_sv_maxairspeed)
+               {
+                       self.owner.velocity = normalize(self.velocity) * autocvar_sv_maxairspeed * 2;
+                       self.owner.velocity_z += 200;
+                       spot = self.origin + v_forward * 32 + '0 0 32';
+                       spot = vehicles_findgoodexit(spot);
+               }
+               else
+               {
+                       self.owner.velocity = self.velocity * 0.5;
+                       self.owner.velocity_z += 10;
+                       spot = self.origin - v_forward * 200 + '0 0 32';
+                       spot = vehicles_findgoodexit(spot);
+               }
            self.owner.oldvelocity = self.owner.velocity;
-           spot = self.origin - v_forward * 200 + '0 0 64';
-           spot = vehicles_findgoodexit(spot);
            setorigin(self.owner , spot);
        }
        antilag_clear(self.owner);
     self.owner = world;
 }
+
 void racer_impact()
 {
     if(autocvar_g_vehicle_racer_bouncepain_x)
@@ -554,7 +538,7 @@ void racer_spawn()
 
     setsize(self, RACER_MIN * 0.5, RACER_MAX * 0.5);
     self.bouncefactor = autocvar_g_vehicle_racer_bouncefactor;
-    self.bouncestop = autocvar_g_vehicle_racer_bouncestop;    
+    self.bouncestop = autocvar_g_vehicle_racer_bouncestop;
     self.vehicle_impact = racer_impact;
     //self.destvec = autocvar_g_vehicle_racer_bouncepain;
 }
@@ -604,8 +588,8 @@ void racer_die()
     self.wait         = time;
     self.cnt          = 1 + random() * 2;
     self.touch        = racer_deadtouch;
-    
-    pointparticles(particleeffectnum("explosion_medium"), self.origin, '0 0 0', 1);    
+
+    pointparticles(particleeffectnum("explosion_medium"), self.origin, '0 0 0', 1);
 
     if(random() < 0.5)
         self.avelocity_z  = 32;
@@ -661,7 +645,7 @@ void spawnfunc_vehicle_racer()
 
     precache_sound ("weapons/lasergun_fire.wav");
     precache_sound ("weapons/rocket_fire.wav");
-    
+
     precache_sound ("vehicles/racer_idle.wav");
     precache_sound ("vehicles/racer_move.wav");
     precache_sound ("vehicles/racer_boost.wav");
@@ -685,7 +669,7 @@ void spawnfunc_vehicle_racer()
         self.vehicle_flags |= VHF_HEALTHREGEN;
 
     self.think = racer_dinit;
-    
+
     if(g_assault)
         self.nextthink = time + 0.5;
     else
index 20c74d3a17e24deb0012882c634c9d527d4747d0..7bbf7fe26ea3f47ea4be7c923a3ec797800b2c3f 100644 (file)
@@ -84,9 +84,9 @@ void SendAuxiliaryXhair2(entity own, vector loc, vector clr, float axh_id)
 // End AuxiliaryXhair
 
 /**
-    Notifies the client that he enterd a vehicle, and sends 
+    Notifies the client that he enterd a vehicle, and sends
     realavent data.
-    
+
     only sends vehicle_id atm (wich is a HUD_* constant, ex. HUD_SPIDERBOT)
 **/
 void CSQCVehicleSetup(entity own, float vehicle_id)
@@ -132,7 +132,7 @@ void vehicles_locktarget(float incr, float decr, float _lock_time)
             self.lock_soundtime = time + 0.5;
             play2(self.owner, "vehicles/locked.wav");
         }
-        
+
         return;
     }
 
@@ -150,22 +150,22 @@ void vehicles_locktarget(float incr, float decr, float _lock_time)
 
     if(self.lock_target == world && trace_ent != world)
         self.lock_target = trace_ent;
-    
-    if(self.lock_target && trace_ent == self.lock_target) 
-    {            
+
+    if(self.lock_target && trace_ent == self.lock_target)
+    {
         if(self.lock_strength != 1 && self.lock_strength + incr >= 1)
         {
             play2(self.owner, "vehicles/lock.wav");
             self.lock_soundtime = time + 0.8;
-        }        
+        }
         else if (self.lock_strength != 1 && self.lock_soundtime < time)
-        {            
+        {
             play2(self.owner, "vehicles/locking.wav");
             self.lock_soundtime = time + 0.3;
         }
-        
-    }    
-        
+
+    }
+
     // Have a locking target
     // Trace hit current target
     if(trace_ent == self.lock_target && trace_ent != world)
@@ -237,8 +237,8 @@ void vehicles_projectile_damage(entity inflictor, entity attacker, float damage,
 {
     // Ignore damage from oterh projectiles from my owner (dont mess up volly's)
     if(inflictor.owner == self.owner)
-        return; 
-    
+        return;
+
     self.health -= damage;
     self.velocity += force;
     if(self.health < 1)
@@ -377,21 +377,21 @@ float vehicles_crushable(entity e)
 }
 
 void vehilces_impact(float _minspeed, float _speedfac, float _maxpain)
-{    
+{
     if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
         return;
-    
+
     if(self.play_time < time)
-    {                    
+    {
         float wc = vlen(self.velocity - self.oldvelocity);
         //dprint("oldvel: ", vtos(self.oldvelocity), "\n");
         //dprint("vel: ", vtos(self.velocity), "\n");
         if(_minspeed < wc)
         {
-            float take = take = min(_speedfac * wc, _maxpain);
+            float take = min(_speedfac * wc, _maxpain);
             Damage (self, world, world, take, DEATH_FALL, self.origin, '0 0 0');
             self.play_time = time + 0.25;
-            
+
             //dprint("wc: ", ftos(wc), "\n");
             //dprint("take: ", ftos(take), "\n");
         }
@@ -409,14 +409,14 @@ void vehicles_touch()
         {
             if(vlen(self.velocity) != 0)
                 Damage(other, self, self.owner, autocvar_g_vehicles_crush_dmg, DEATH_VHCRUSH, '0 0 0', normalize(other.origin - self.origin) * autocvar_g_vehicles_crush_force);
-            
+
             return; // Dont do selfdamage when hitting "soft targets".
         }
-        
+
         if(self.play_time < time)
         if(self.vehicle_impact)
             self.vehicle_impact();
-        
+
         return;
     }
 
@@ -449,7 +449,7 @@ void vehicles_enter()
     if(self.team)
     if(self.team != other.team)
         return;
-        
+
     RemoveGrapplingHook(other);
 
     self.vehicle_ammo1   = 0;
@@ -519,19 +519,19 @@ void vehicles_enter()
     vehicles_clearrturn();
 
     CSQCVehicleSetup(self.owner, self.hud);
-    
+
     if(other.flagcarried)
     {
         if(!autocvar_g_vehicles_allow_flagcarry)
             DropFlag(other.flagcarried, world, world);
         else
-        {            
+        {
             other.flagcarried.scale = 1;
-            setattachment(other.flagcarried, self, ""); 
+            setattachment(other.flagcarried, self, "");
             setorigin(other, '0 0 96');
         }
     }
-    
+
     self.vehicle_enter();
     antilag_clear(other);
 }
@@ -545,17 +545,17 @@ vector vehicles_findgoodexit(vector prefer_spot)
 {
     //vector exitspot;
     float mysize;
-    
+
     tracebox(self.origin + '0 0 32', PL_MIN, PL_MAX, prefer_spot, MOVE_NORMAL, self.owner);
     if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid)
         return prefer_spot;
-    
+
     mysize = vlen(self.maxs - self.mins);
     float i;
     vector v, v2;
     v2 = 0.5 * (self.absmin + self.absmax);
     for(i = 0; i < 100; ++i)
-    {        
+    {
         v = randomvec();
         v_z = 0;
         v = v2 + normalize(v) * mysize;
@@ -563,13 +563,13 @@ vector vehicles_findgoodexit(vector prefer_spot)
         if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid)
             return v;
     }
-    
+
     /*
     exitspot = (self.origin + '0 0 48') + v_forward * mysize;
     tracebox(self.origin + '0 0 32', PL_MIN, PL_MAX, exitspot, MOVE_NORMAL, self.owner);
     if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid)
         return exitspot;
-    
+
     exitspot = (self.origin + '0 0 48') - v_forward * mysize;
     tracebox(self.origin + '0 0 32', PL_MIN, PL_MAX, exitspot, MOVE_NORMAL, self.owner);
     if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid)
@@ -579,13 +579,13 @@ vector vehicles_findgoodexit(vector prefer_spot)
     tracebox(self.origin + '0 0 32', PL_MIN, PL_MAX, exitspot, MOVE_NORMAL, self.owner);
     if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid)
         return exitspot;
-    
+
     exitspot = (self.origin + '0 0 48') - v_right * mysize;
     tracebox(self.origin + '0 0 32', PL_MIN, PL_MAX, exitspot, MOVE_NORMAL, self.owner);
     if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid)
         return exitspot;
     */
-    
+
     return self.origin;
 }
 
@@ -594,14 +594,14 @@ vector vehicles_findgoodexit(vector prefer_spot)
     custom code goes in self.vehicle_exit
 **/
 void vehicles_exit(float eject)
-{      
+{
     entity oldself;
     if(self.flags & FL_CLIENT)
     {
         oldself = self;
         self = self.vehicle;
     }
-    
+
        self.flags |= FL_NOTARGET;
 
     if (self.owner)
@@ -629,7 +629,7 @@ void vehicles_exit(float eject)
         self.owner.hud            = HUD_NORMAL;
         self.owner.switchweapon   = self.switchweapon;
         //self.owner.BUTTON_USE     = 0;
-        
+
         CSQCVehicleSetup(self.owner, HUD_NORMAL);
     }
 
@@ -646,19 +646,19 @@ void vehicles_exit(float eject)
         self.team = 0;
     else
         self.team = self.tur_head.team;
-    
+
     if(self.owner.flagcarried)
     {
         self.owner.flagcarried.scale = 0.6;
-        setattachment(self.owner.flagcarried, self.owner, ""); 
+        setattachment(self.owner.flagcarried, self.owner, "");
         setorigin(self.owner.flagcarried, FLAG_CARRY_POS);
     }
-    
+
     sound (self, CH_TRIGGER_SINGLE, "misc/null.wav", 1, ATTN_NORM);
     self.vehicle_exit(eject);
     self.owner = world;
     vehicles_reset_colors();
-    
+
     if(oldself)
         self = oldself;
 }
@@ -691,25 +691,25 @@ void shieldhit_think()
 }
 
 void vehicles_painframe()
-{    
+{
     if(self.owner.vehicle_health <= 50)
     if(self.pain_frame < time)
-    {  
-        float _ftmp;  
+    {
+        float _ftmp;
         _ftmp = self.owner.vehicle_health / 50;
         self.pain_frame = time + 0.1 + (random() * 0.5 * _ftmp);
         pointparticles(particleeffectnum("smoke_small"), (self.origin + (randomvec() * 80)), '0 0 0', 1);
-        
+
         if(self.vehicle_flags & VHF_DMGSHAKE)
             self.velocity += randomvec() * 30;
-        
+
         if(self.vehicle_flags & VHF_DMGROLL)
             if(self.vehicle_flags & VHF_DMGHEADROLL)
                 self.tur_head.angles += randomvec();
             else
                 self.angles += randomvec();
-        
-    }    
+
+    }
 }
 
 void vehicles_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
@@ -743,7 +743,7 @@ void vehicles_damage(entity inflictor, entity attacker, float damage, float deat
             self.vehicle_shieldent.colormod = '2 0 0';
             self.vehicle_shield             = 0;
             self.vehicle_shieldent.alpha    = 0.75;
-            
+
                if(sound_allowed(MSG_BROADCAST, attacker))
                 spamsound (self, CH_PAIN, "onslaught/ons_hit2.wav", VOL_BASE, ATTN_NORM);   // FIXME: PLACEHOLDER
         }
@@ -786,11 +786,11 @@ void vehicles_clearrturn()
         {
             ret.classname   = "";
             ret.think       = SUB_Remove;
-            ret.nextthink   = time + 0.1;            
-            
+            ret.nextthink   = time + 0.1;
+
             if(ret.waypointsprite_attached)
                 WaypointSprite_Kill(ret.waypointsprite_attached);
-            
+
             return;
         }
         ret = ret.chain;
@@ -806,7 +806,7 @@ void vehicles_return()
 
     if(self.waypointsprite_attached)
         WaypointSprite_Kill(self.waypointsprite_attached);
-            
+
     remove(self);
 }
 
@@ -814,50 +814,50 @@ void vehicles_showwp_goaway()
 {
     if(self.waypointsprite_attached)
         WaypointSprite_Kill(self.waypointsprite_attached);
-            
+
     remove(self);
-    
+
 }
 
 void vehicles_showwp()
 {
     entity oldself;
     vector rgb;
-    
+
     if(self.cnt)
-    {        
+    {
         self.think      = vehicles_return;
         self.nextthink  = self.cnt;
-    }    
+    }
     else
     {
         self.think      = vehicles_return;
         self.nextthink  = time +1;
-        
+
         oldself = self;
         self = spawn();
         setmodel(self, "null");
         self.team = oldself.enemy.team;
         self.enemy = oldself.enemy;
         setorigin(self, oldself.enemy.pos1);
-        
+
         self.nextthink = time + 5;
         self.think = vehicles_showwp_goaway;
     }
-    
+
     if(teamplay && self.team)
            rgb = TeamColor(self.team);
     else
            rgb = '1 1 1';
     WaypointSprite_Spawn("vehicle", 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, TRUE, RADARICON_POWERUP, rgb);
     if(self.waypointsprite_attached)
-    {        
-        WaypointSprite_UpdateRule(self.waypointsprite_attached, self.enemy.team, SPRITERULE_DEFAULT);        
+    {
+        WaypointSprite_UpdateRule(self.waypointsprite_attached, self.enemy.team, SPRITERULE_DEFAULT);
         if(oldself == world)
-            WaypointSprite_UpdateBuildFinished(self.waypointsprite_attached, self.nextthink);        
+            WaypointSprite_UpdateBuildFinished(self.waypointsprite_attached, self.nextthink);
         WaypointSprite_Ping(self.waypointsprite_attached);
-    }    
-    
+    }
+
     if(oldself != world)
         self = oldself;
 }
@@ -865,28 +865,28 @@ void vehicles_showwp()
 void vehicles_setreturn()
 {
     entity ret;
-    
+
     vehicles_clearrturn();
 
     ret = spawn();
     ret.classname   = "vehicle_return";
-    ret.enemy       = self;    
+    ret.enemy       = self;
     ret.team        = self.team;
     ret.think       = vehicles_showwp;
-    
+
     if(self.deadflag != DEAD_NO)
     {
         ret.cnt         = time + self.vehicle_respawntime;
-        ret.nextthink   = min(time + self.vehicle_respawntime, time + self.vehicle_respawntime - 5);        
-    }        
+        ret.nextthink   = min(time + self.vehicle_respawntime, time + self.vehicle_respawntime - 5);
+    }
     else
     {
-        ret.nextthink   = min(time + self.vehicle_respawntime, time + self.vehicle_respawntime - 1);        
+        ret.nextthink   = min(time + self.vehicle_respawntime, time + self.vehicle_respawntime - 1);
     }
-    
+
     setmodel(ret, "null");
     setorigin(ret, self.pos1 + '0 0 96');
-       
+
 }
 
 void vehicles_configcheck(string  configname, float check_cvar)
@@ -984,9 +984,9 @@ float vehicle_initialize(string  net_name,
 
     if(self.team && !teamplay)
         self.team = 0;
-        
+
     self.vehicle_flags |= VHF_ISVEHICLE;
-    
+
     setmodel(self, bodymodel);
 
     self.vehicle_viewport   = spawn();
@@ -1005,8 +1005,8 @@ float vehicle_initialize(string  net_name,
     self.PlayerPhysplug      = physproc;
     self.event_damage        = vehicles_damage;
     self.touch               = vehicles_touch;
-    self.think               = vehicles_spawn;    
-    self.nextthink           = time;        
+    self.think               = vehicles_spawn;
+    self.nextthink           = time;
     self.vehicle_respawntime = _respawntime;
     self.vehicle_spawn       = spawnproc;
 
@@ -1045,7 +1045,7 @@ float vehicle_initialize(string  net_name,
     self.pos1 = self.origin;
     self.pos2 = self.angles;
     self.tur_head.team = self.team;
-    
+
     return TRUE;
 }
 
index 33fb4140baa7b79a3938cb63029e745f781ab7ef..1c06048ce85db47d4b5cd7b3198b85cba681f89d 100644 (file)
@@ -4,27 +4,27 @@ set g_vehicle_racer_health              190
 set g_vehicle_racer_health_regen        0
 set g_vehicle_racer_health_regen_pause  0
 
-set g_vehicle_racer_shield              75
-set g_vehicle_racer_shield_regen        25
+set g_vehicle_racer_shield              70
+set g_vehicle_racer_shield_regen        30
 set g_vehicle_racer_shield_regen_pause  1
 
-set g_vehicle_racer_energy              125
+set g_vehicle_racer_energy              100
 set g_vehicle_racer_energy_regen        40
 set g_vehicle_racer_energy_regen_pause  1
 
-set g_vehicle_racer_speed_stop          2000
-set g_vehicle_racer_speed_forward       800
+set g_vehicle_racer_speed_stop          2500
+set g_vehicle_racer_speed_forward       500
 set g_vehicle_racer_speed_strafe        500
-set g_vehicle_racer_speed_afterburn     2000
-set g_vehicle_racer_friction            0.4
-set g_vehicle_racer_afterburn_cost      60      // energy consumed per second
+set g_vehicle_racer_speed_afterburn     3000
+set g_vehicle_racer_friction            0.3
+set g_vehicle_racer_afterburn_cost      50      // energy consumed per second
 
 set g_vehicle_racer_hovertype           0       // 0 = hover, != 0 = maglev
-set g_vehicle_racer_hoverpower          5000    // NOTE!! x 4 (4 engines)
+set g_vehicle_racer_hoverpower          7500    // NOTE!! x 4 (4 engines)
 set g_vehicle_racer_upforcedamper       10
 
 set g_vehicle_racer_downforce            0.01
-set g_vehicle_racer_springlength         65
+set g_vehicle_racer_springlength         70
 set g_vehicle_racer_collision_multiplier 0.05
 set g_vehicle_racer_anglestabilizer      1.75
 
@@ -34,24 +34,24 @@ set g_vehicle_racer_maxpitch           25
 set g_vehicle_racer_turnroll           32
 
 set g_vehicle_racer_cannon_speed        9000
-set g_vehicle_racer_cannon_damage       20
+set g_vehicle_racer_cannon_damage       25
 set g_vehicle_racer_cannon_radius       100
 set g_vehicle_racer_cannon_refire       0.1
-set g_vehicle_racer_cannon_cost         4
+set g_vehicle_racer_cannon_cost         10
 set g_vehicle_racer_cannon_spread       0.0125
 set g_vehicle_racer_cannon_force        50
 
 set g_vehicle_racer_rocket_speed       1000
 set g_vehicle_racer_rocket_accel       1400
-set g_vehicle_racer_rocket_turnrate    0.17
-set g_vehicle_racer_rocket_damage      160
+set g_vehicle_racer_rocket_turnrate    0.2
+set g_vehicle_racer_rocket_damage      165
 set g_vehicle_racer_rocket_force       350
 set g_vehicle_racer_rocket_radius      125
 set g_vehicle_racer_rocket_refire      6
 set g_vehicle_racer_rocket_cost        0
 
 set g_vehicle_racer_rocket_locktarget           1
-set g_vehicle_racer_rocket_locking_time         0.4
+set g_vehicle_racer_rocket_locking_time         0.5
 set g_vehicle_racer_rocket_locking_releasetime  1.6
 set g_vehicle_racer_rocket_locked_time          5
 set g_vehicle_racer_rocket_locked_maxangle      1.46
@@ -63,6 +63,6 @@ set g_vehicle_racer_blowup_forceintensity   250
 
 set g_vehicle_racer_bouncefactor 0.25   // Factor of old velocity to keep after colission
 set g_vehicle_racer_bouncestop 0        // if != 0, New veloctiy after bounce = 0 if new velocity < this
-set g_vehicle_racer_bouncepain "35 2 250" // "minspeed_for_pain speedchange_to_pain_factor max_damage"
+set g_vehicle_racer_bouncepain "60 0.75 300" // "minspeed_for_pain speedchange_to_pain_factor max_damage"
 
 set g_vehicle_racer_mass                    900