]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge new vehicle stuff from combined updates
authorMario <zacjardine@y7mail.com>
Fri, 13 Mar 2015 08:53:10 +0000 (19:53 +1100)
committerMario <zacjardine@y7mail.com>
Fri, 13 Mar 2015 08:53:10 +0000 (19:53 +1100)
qcsrc/client/main.qc
qcsrc/common/vehicles/cl_vehicles.qh
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/sv_vehicles.qh
qcsrc/common/vehicles/unit/bumblebee.qh [new file with mode: 0644]
qcsrc/common/vehicles/unit/racer.qc
qcsrc/common/vehicles/unit/raptor.qc
qcsrc/common/vehicles/unit/spiderbot.qc
qcsrc/common/vehicles/vehicles.qh

index cabb13e16a622ac5a08171ce86b439ef6398b5a3..aa7a1836b913ae9538cdf6355dfb42277f5ac13f 100644 (file)
@@ -9,8 +9,9 @@
 #include "wall.qh"
 #include "waypointsprites.qh"
 
-#include "../common/vehicles/vehicles.qh"
+#include "../common/vehicles/unit/bumblebee.qh"
 #include "../common/vehicles/cl_vehicles.qh"
+#include "../common/vehicles/vehicles.qh"
 
 #include "../common/net_notice.qh"
 
index 3f0d8cfb20b5efd4202b85f0243db4ec2a8e3cd4..f91add3f1e81d970859c3d3a912c68017eb5300a 100644 (file)
@@ -6,9 +6,8 @@ bool autocvar_cl_vehicles_alarm = 1;
 bool autocvar_cl_vehicles_hud_tactical = 1;
 
 void Net_AuXair2(float bIsNew);
-void bumble_raygun_read(float bIsNew);
+
 void Net_VehicleSetup();
-void CSQC_BUMBLE_GUN_HUD();
 
 void RaptorCBShellfragDraw();
 void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang);
index 9ffb1775383552f4c0601a93abdae458d83688c3..be0a1deaeeb8f5bffd752a6e7c8618d485122f61 100644 (file)
@@ -632,6 +632,9 @@ void vehicles_damage(entity inflictor, entity attacker, float damage, float deat
        if(DEATH_ISWEAPON(deathtype, WEP_SEEKER))
                damage *= autocvar_g_vehicles_tag_damagerate;
 
+       if(DEATH_WEAPONOFWEAPONDEATH(deathtype))
+               damage *= autocvar_g_vehicles_weapon_damagerate;
+
        self.enemy = attacker;
 
        self.pain_finished = time;
index 8ef077d73fedad56ce48bc40d99a562162b0c4ce..36b4f5f3e970431cda92d07acf5068382bcadc1b 100644 (file)
@@ -3,6 +3,7 @@
 #ifdef SVQC
 
 #include "../server/tturrets/include/turrets_early.qh"
+#include "sv_vehicles.qh"
 
 // #define VEHICLES_USE_ODE
 
@@ -19,11 +20,12 @@ float autocvar_g_vehicles_delayspawn_jitter;
 float autocvar_g_vehicles_allow_bots;
 float autocvar_g_vehicles_teams;
 float autocvar_g_vehicles_teleportable;
-var float autocvar_g_vehicles_vortex_damagerate = 0.5;
-var float autocvar_g_vehicles_machinegun_damagerate = 0.5;
-var float autocvar_g_vehicles_rifle_damagerate = 0.75;
-var float autocvar_g_vehicles_vaporizer_damagerate = 0.001;
-var float autocvar_g_vehicles_tag_damagerate = 5;
+float autocvar_g_vehicles_vortex_damagerate = 0.5;
+float autocvar_g_vehicles_machinegun_damagerate = 0.5;
+float autocvar_g_vehicles_rifle_damagerate = 0.75;
+float autocvar_g_vehicles_vaporizer_damagerate = 0.001;
+float autocvar_g_vehicles_tag_damagerate = 5;
+float autocvar_g_vehicles_weapon_damagerate = 1;
 
 // flags:
 .int vehicle_flags;
@@ -92,6 +94,10 @@ vector force_fromtag_origin;
 
 float vehicles_exit_running;
 
+// macros
+#define VEHICLE_UPDATE_PLAYER(ply,fld,vhname) \
+       ply.vehicle_##fld = (self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
+
 #ifdef VEHICLES_USE_ODE
 void(entity e, float physics_enabled) physics_enable = #540; // enable or disable physics on object
 void(entity e, vector force, vector force_pos) physics_addforce = #541; // apply a force from certain origin, length of force vector is power of force
@@ -100,18 +106,9 @@ void(entity e, vector torque) physics_addtorque = #542; // add relative torque
 
 .float vehicle_enter_delay; // prevent players jumping to and from vehicles instantly
 
-// macros
-#define VEHICLE_UPDATE_PLAYER(ply,fld,vhname) \
-       ply.vehicle_##fld = (self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
-
-#if 0
-#define vehicles_sweap_collision(orig,vel,dt,acm,mult) \
-       traceline(orig, orig + vel * dt, MOVE_NORMAL, self); \
-       if(trace_fraction != 1) \
-               acm += normalize(self.origin - trace_endpos) * (vlen(vel) * mult)
-#endif
-
 void vehicles_exit(float eject);
+float vehicle_initialize(float vehicle_id, float nodrop);
 
 #endif
+
 #endif
diff --git a/qcsrc/common/vehicles/unit/bumblebee.qh b/qcsrc/common/vehicles/unit/bumblebee.qh
new file mode 100644 (file)
index 0000000..2373e98
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef BUMBLEBEE_H
+#define BUMBLEBEE_H
+
+void bumble_raygun_read(bool bIsNew);
+
+void CSQC_BUMBLE_GUN_HUD();
+
+#endif
\ No newline at end of file
index ca3c76a9f7a0a6a4b3138cfedd6568e566dad021..fbcb5397025e53b8639c21f3eade0dee6fd0d0e1 100644 (file)
@@ -24,6 +24,11 @@ float autocvar_g_vehicle_racer_waterburn_speed;
 float autocvar_g_vehicle_racer_water_speed_forward;
 float autocvar_g_vehicle_racer_water_speed_strafe;
 
+float autocvar_g_vehicle_racer_pitchlimit = 30;
+
+float autocvar_g_vehicle_racer_water_downforce = 0.03;
+float autocvar_g_vehicle_racer_water_upforcedamper = 15;
+
 float autocvar_g_vehicle_racer_anglestabilizer;
 float autocvar_g_vehicle_racer_downforce;
 
@@ -88,6 +93,8 @@ float autocvar_g_vehicle_racer_bouncefactor;
 float autocvar_g_vehicle_racer_bouncestop;
 vector autocvar_g_vehicle_racer_bouncepain;
 
+.float racer_watertime;
+
 var vector racer_force_from_tag(string tag_name, float spring_length, float max_power);
 
 void racer_align4point(float _delta)
@@ -112,16 +119,24 @@ void racer_align4point(float _delta)
        //vehicles_sweap_collision(force_fromtag_origin, self.velocity, _delta, v_add, autocvar_g_vehicle_racer_collision_multiplier);
 
        self.velocity += push_vector * _delta;
+
+       float uforce = autocvar_g_vehicle_racer_upforcedamper;
+       
+       int cont = pointcontents(self.origin - '0 0 64');
+       if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
+       {
+               uforce = autocvar_g_vehicle_racer_water_upforcedamper;
+
+               if(self.owner.BUTTON_CROUCH && time < self.air_finished)
+                       self.velocity_z += 30;
+               else
+                       self.velocity_z += 200;
+       }
        
-       if(pointcontents(self.origin - '0 0 64') == CONTENT_WATER)
-       if(self.owner.BUTTON_CROUCH && time < self.air_finished)
-               self.velocity_z += 30;
-       else
-               self.velocity_z += 200;
 
        // Anti ocilation
        if(self.velocity_z > 0)
-               self.velocity_z *= 1 - autocvar_g_vehicle_racer_upforcedamper * _delta;
+               self.velocity_z *= 1 - uforce * _delta;
 
        push_vector_x =  (fl_push - bl_push);
        push_vector_x += (fr_push - br_push);
@@ -201,7 +216,8 @@ void racer_rocket_groundhugger()
                self.velocity_z -= 1600 * sys_frametime; // 2x grav looks better for this one
        }
        
-       if(pointcontents(self.origin - '0 0 32') == CONTENT_WATER)
+       int cont = pointcontents(self.origin - '0 0 32');
+       if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
                self.velocity_z += 200;
 
        UpdateCSQCProjectile(self);
@@ -328,7 +344,7 @@ float racer_frame()
        // Pitch
        ftmp = autocvar_g_vehicle_racer_pitchspeed  * frametime;
        ftmp = bound(-ftmp, shortangle_f(player.v_angle_x - racer.angles_x, racer.angles_x), ftmp);
-       racer.angles_x = bound(-30, anglemods(racer.angles_x + ftmp), 30);
+       racer.angles_x = bound(-autocvar_g_vehicle_racer_pitchlimit, anglemods(racer.angles_x + ftmp), autocvar_g_vehicle_racer_pitchlimit);
 
        makevectors(racer.angles);
        racer.angles_x *= -1;
@@ -337,9 +353,10 @@ float racer_frame()
        df = racer.velocity * -autocvar_g_vehicle_racer_friction;
        //racer.velocity_z = ftmp;
 
+       int cont = pointcontents(racer.origin);
        if(vlen(player.movement) != 0)
        {
-               if(pointcontents(racer.origin) == CONTENT_WATER)
+               if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
                {
                        if(player.movement_x) { df += v_forward * ((player.movement_x > 0) ? autocvar_g_vehicle_racer_water_speed_forward : -autocvar_g_vehicle_racer_water_speed_forward); }
                        if(player.movement_y) { df += v_right * ((player.movement_y > 0) ? autocvar_g_vehicle_racer_water_speed_strafe : -autocvar_g_vehicle_racer_water_speed_strafe); }
@@ -375,7 +392,7 @@ float racer_frame()
 
                racer.wait = time;
 
-               if(pointcontents(racer.origin) == CONTENT_WATER)
+               if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
                {
                        racer.vehicle_energy -= autocvar_g_vehicle_racer_waterburn_cost * frametime;
                        df += (v_forward * autocvar_g_vehicle_racer_waterburn_speed);
@@ -407,7 +424,14 @@ float racer_frame()
                sound (racer.tur_head, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_VEHICLEENGINE, ATTEN_NORM);
        }
 
-       df -= v_up * (vlen(racer.velocity) * autocvar_g_vehicle_racer_downforce);
+       if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
+               racer.racer_watertime = time;
+
+       float dforce = autocvar_g_vehicle_racer_downforce;
+       if(time - racer.racer_watertime <= 3)
+               dforce = autocvar_g_vehicle_racer_water_downforce;
+
+       df -= v_up * (vlen(racer.velocity) * dforce);
        player.movement = racer.velocity += df * frametime;
 
        if(!forbidWeaponUse(player))
@@ -509,12 +533,18 @@ void racer_think()
        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);
 
-       if(pointcontents(self.origin - '0 0 64') == CONTENT_WATER)
+       float forced = autocvar_g_vehicle_racer_upforcedamper;
+
+       int cont = pointcontents(self.origin - '0 0 64');
+       if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
+       {
+               forced = autocvar_g_vehicle_racer_water_upforcedamper;
                self.velocity_z += 200;
+       }
 
        self.velocity += df * pushdeltatime;
        if(self.velocity_z > 0)
-               self.velocity_z *= 1 - autocvar_g_vehicle_racer_upforcedamper * pushdeltatime;
+               self.velocity_z *= 1 - forced * pushdeltatime;
 
        self.angles_x *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * pushdeltatime);
        self.angles_z *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * pushdeltatime);
index d78456db117221235f7f5d7c7be62c0e1973e125..b8cf0d2a558b1a6cde12ccce596a01487f536e9b 100644 (file)
@@ -728,6 +728,17 @@ float raptor_impulse(float _imp)
 {
        switch(_imp)
        {
+               case 1:
+               case 230:
+                       self.vehicle.vehicle_weapon2mode = RSM_BOMB;
+                       CSQCVehicleSetup(self, 0);
+                       return true;
+               case 2:
+               case 231:
+                       self.vehicle.vehicle_weapon2mode = RSM_FLARE;
+                       CSQCVehicleSetup(self, 0);
+                       return true;
+
                case 10:
                case 15:
                case 18:
@@ -737,6 +748,7 @@ float raptor_impulse(float _imp)
 
                        CSQCVehicleSetup(self, 0);
                        return true;
+               case 11:
                case 12:
                case 16:
                case 19:
index 01c0caeacf898a8aafe6bb3e28a68da4ef110557..8e0904d821fc7f0d0226f312ae81976bb2ce036a 100644 (file)
@@ -27,6 +27,7 @@ float autocvar_g_vehicle_spiderbot_respawntime;
 float autocvar_g_vehicle_spiderbot_speed_stop;
 float autocvar_g_vehicle_spiderbot_speed_strafe;
 float autocvar_g_vehicle_spiderbot_speed_walk;
+float autocvar_g_vehicle_spiderbot_speed_run = 700;
 float autocvar_g_vehicle_spiderbot_turnspeed;
 float autocvar_g_vehicle_spiderbot_turnspeed_strafe;
 float autocvar_g_vehicle_spiderbot_movement_inertia;
@@ -320,6 +321,7 @@ void spiderbot_rocket_do()
        self.gun2.cnt = time + self.attack_finished_single;
 }
 
+.float jump_delay;
 float spiderbot_frame()
 {
        vector ad, vf;
@@ -388,37 +390,63 @@ float spiderbot_frame()
        movelib_groundalign4point(autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit);
 
        if(spider.flags & FL_ONGROUND)
+               spider.jump_delay = time; // reset now so movement can begin
+
+       //if(spider.flags & FL_ONGROUND)
        {
+               if(spider.flags & FL_ONGROUND)
                if(spider.frame == 4 && self.tur_head.wait != 0)
                {
                        sound (self, CH_TRIGGER_SINGLE, "vehicles/spiderbot_land.wav", VOL_VEHICLEENGINE, ATTEN_NORM);
                        spider.frame = 5;
                }
 
-               if(player.BUTTON_JUMP && self.tur_head.wait < time)
+               if(!player.BUTTON_JUMP)
+                       spider.BUTTON_JUMP = 0;
+
+               if((spider.flags & FL_ONGROUND) && player.BUTTON_JUMP && !spider.BUTTON_JUMP && self.tur_head.wait < time)
                {
                        sound (self, CH_TRIGGER_SINGLE, "vehicles/spiderbot_jump.wav", VOL_VEHICLEENGINE, ATTEN_NORM);
                        //dprint("spiderbot_jump:", ftos(soundlength("vehicles/spiderbot_jump.wav")), "\n");
                        self.delay = 0;
 
                        self.tur_head.wait = time + 2;
-                       player.BUTTON_JUMP = 0;
-                       spider.velocity   = v_forward * 700 + v_up * 600;
+                       spider.jump_delay = time + 2;
+                       spider.BUTTON_JUMP = 1; // set spider's jump
+                       //player.BUTTON_JUMP = 0;
+
+                       vector movefix = '0 0 0';
+                       if(player.movement_x > 0) movefix_x = 1;
+                       if(player.movement_x < 0) movefix_x = -1;
+                       if(player.movement_y > 0) movefix_y = 1;
+                       if(player.movement_y < 0) movefix_y = -1;
+
+                       vector rt = movefix_y * v_right;
+                       vector sd = movefix_x * v_forward;
+                       if(movefix_y == 0 && movefix_x == 0)
+                               sd = v_forward; // always do forward
+
+                       spider.flags &= ~FL_ONGROUND;
+
+                       spider.velocity = sd * 700 + rt * 600 + v_up * 600;
                        spider.frame = 4;
                }
-               else
+               else if(time >= spider.jump_delay)
                {
                        if(vlen(player.movement) == 0)
                        {
-                               if(self.sound_nexttime < time || self.delay != 3)
+                               if(spider.flags & FL_ONGROUND)
                                {
-                                       self.delay = 3;
-                                       self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_idle.wav");
-                                       //dprint("spiderbot_idle:", ftos(soundlength("vehicles/spiderbot_idle.wav")), "\n");
-                                       sound (self, CH_TRIGGER_SINGLE, "vehicles/spiderbot_idle.wav", VOL_VEHICLEENGINE, ATTEN_NORM);
+                                       if(self.sound_nexttime < time || self.delay != 3)
+                                       {
+                                               self.delay = 3;
+                                               self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_idle.wav");
+                                               //dprint("spiderbot_idle:", ftos(soundlength("vehicles/spiderbot_idle.wav")), "\n");
+                                               sound (self, CH_TRIGGER_SINGLE, "vehicles/spiderbot_idle.wav", VOL_VEHICLEENGINE, ATTEN_NORM);
+                                       }
+                                       movelib_beak_simple(autocvar_g_vehicle_spiderbot_speed_stop);
+                                       spider.frame = 5;
                                }
-                               movelib_beak_simple(autocvar_g_vehicle_spiderbot_speed_stop);
-                               spider.frame = 5;
                        }
                        else
                        {
@@ -437,16 +465,23 @@ float spiderbot_frame()
                                        if(player.movement_x > 0)
                                        {
                                                player.movement_x = 1;
-                                               spider.frame = 0;
+                                               if(spider.flags & FL_ONGROUND)
+                                                       spider.frame = 0;
                                        }
                                        else if(player.movement_x < 0)
                                        {
                                                player.movement_x = -1;
-                                               spider.frame = 1;
+                                               if(spider.flags & FL_ONGROUND)
+                                                       spider.frame = 1;
                                        }
                                        player.movement_y = 0;
-                                       movelib_move_simple(normalize(v_forward * player.movement_x),autocvar_g_vehicle_spiderbot_speed_walk,autocvar_g_vehicle_spiderbot_movement_inertia);
-
+                                       float oldvelz = spider.velocity_z;
+                                       movelib_move_simple(normalize(v_forward * player.movement_x),((player.BUTTON_JUMP) ? autocvar_g_vehicle_spiderbot_speed_run : autocvar_g_vehicle_spiderbot_speed_walk),autocvar_g_vehicle_spiderbot_movement_inertia);
+                                       spider.velocity_z = oldvelz;
+                                       float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
+                                       if(spider.velocity_z <= 20) // not while jumping
+                                               spider.velocity_z -= g * sys_frametime * autocvar_sv_gravity;
+                                       if(spider.flags & FL_ONGROUND)
                                        if(self.sound_nexttime < time || self.delay != 1)
                                        {
                                                self.delay = 1;
@@ -460,14 +495,23 @@ float spiderbot_frame()
                                        if(player.movement_y < 0)
                                        {
                                                player.movement_y = -1;
-                                               spider.frame = 2;
+                                               if(spider.flags & FL_ONGROUND)
+                                                       spider.frame = 2;
                                        }
                                        else if(player.movement_y > 0)
                                        {
                                                player.movement_y = 1;
-                                               spider.frame = 3;
+                                               if(spider.flags & FL_ONGROUND)
+                                                       spider.frame = 3;
                                        }
+
+                                       float oldvelz = spider.velocity_z;
                                        movelib_move_simple(normalize(v_right * player.movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia);
+                                       spider.velocity_z = oldvelz;
+                                       float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
+                                       if(spider.velocity_z <= 20) // not while jumping
+                                               spider.velocity_z -= g * sys_frametime * autocvar_sv_gravity;
+                                       if(spider.flags & FL_ONGROUND)
                                        if(self.sound_nexttime < time || self.delay != 2)
                                        {
                                                self.delay = 2;
@@ -703,10 +747,27 @@ void spiderbot_blowup()
        self.vehicle_hudmodel.viewmodelforclient = self;
 }
 
-float spiderbot_impulse(float _imp)
+bool spiderbot_impulse(int _imp)
 {
        switch(_imp)
        {
+               case 1:
+               case 230:
+                       self.vehicle.vehicle_weapon2mode = SBRM_VOLLY;
+                       CSQCVehicleSetup(self, 0);
+                       return true;
+               case 2:
+               case 231:
+                       self.vehicle.vehicle_weapon2mode = SBRM_GUIDE;
+                       CSQCVehicleSetup(self, 0);
+                       return true;
+               case 3:
+               case 232:
+               case 251:
+                       self.vehicle.vehicle_weapon2mode = SBRM_ARTILLERY;
+                       CSQCVehicleSetup(self, 0);
+                       return true;
+
                case 10:
                case 15:
                case 18:
@@ -717,6 +778,7 @@ float spiderbot_impulse(float _imp)
                        //centerprint(self, strcat("Rocket mode is ", ftos(self.vehicle.vehicle_weapon2mode)));
                        CSQCVehicleSetup(self, 0);
                        return true;
+               case 11:
                case 12:
                case 16:
                case 19:
index d5b7e8fe9cc45652fccef952e59700dd9e789376..c803adeb03832f43014e62fa466e67585f7cda9b 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef VEHICLES_H
 #define VEHICLES_H
 
+#include "sv_vehicles.qh"
+
 // vehicle requests
 const int VR_SETUP          = 1; // (BOTH) setup vehicle data
 const int VR_THINK                     = 2; // (SERVER) logic to run every frame