]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/vehicles/unit/spiderbot.qc
Merge branch 'master' into Mario/vehicles
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / vehicles / unit / spiderbot.qc
index 5e01cd53e1f39c12bede30c21df501e55695dd01..5e5720f68bc3d3982eb3051f2ac484a8dd2fd020 100644 (file)
@@ -13,6 +13,12 @@ REGISTER_VEHICLE(
 );
 #else
 
+const float SBRM_FIRST = 1;
+const float SBRM_VOLLY = 1;
+const float SBRM_GUIDE = 2;
+const float SBRM_ARTILLERY = 3;
+const float SBRM_LAST = 3;
+
 #ifdef SVQC
 float autocvar_g_vehicle_spiderbot;
 
@@ -51,8 +57,7 @@ float autocvar_g_vehicle_spiderbot_minigun_ammo_max;
 float autocvar_g_vehicle_spiderbot_minigun_ammo_regen;
 float autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause;
 float autocvar_g_vehicle_spiderbot_minigun_force;
-float autocvar_g_vehicle_spiderbot_minigun_speed;
-float autocvar_g_vehicle_spiderbot_minigun_bulletconstant;
+float autocvar_g_vehicle_spiderbot_minigun_solidpenetration;
 
 float autocvar_g_vehicle_spiderbot_rocket_damage;
 float autocvar_g_vehicle_spiderbot_rocket_force;
@@ -67,12 +72,6 @@ float autocvar_g_vehicle_spiderbot_rocket_noise;
 float autocvar_g_vehicle_spiderbot_rocket_turnrate;
 float autocvar_g_vehicle_spiderbot_rocket_lifetime;
 
-#define SBRM_FIRST 0
-#define SBRM_VOLLY 0
-#define SBRM_GUIDE 1
-#define SBRM_ARTILLERY 2
-#define SBRM_LAST 2
-
 vector autocvar_g_vehicle_spiderbot_bouncepain;
 
 void spiderbot_rocket_artillery()
@@ -103,7 +102,7 @@ void spiderbot_rocket_guided()
 
        self.nextthink  = time;
 
-       if not (self.realowner.vehicle)
+       if(!self.realowner.vehicle)
                self.think = spiderbot_rocket_unguided;
 
        crosshair_trace(self.realowner);
@@ -121,7 +120,7 @@ void spiderbot_guide_release()
 {
        entity rkt;
        rkt = findchainentity(realowner, self.owner);
-       if not (rkt)
+       if(!rkt)
                return;
 
        crosshair_trace(self.owner);
@@ -247,10 +246,12 @@ void spiderbot_rocket_do()
                self.wait = 0;
        }
 
-       if (self.wait != -10)
-               if not (self.owner.BUTTON_ATCK2)
-                       return;
-
+       if(self.wait != -10)
+       if(!self.owner.BUTTON_ATCK2)
+               return;
+               
+       if(forbidWeaponUse(self.owner))
+               return;
 
        v = gettaginfo(self.tur_head,gettagindex(self.tur_head,"tag_fire"));
 
@@ -326,7 +327,10 @@ float spiderbot_frame()
        float ftmp;
 
        if(intermission_running)
+       {
+               self.vehicle.velocity = '0 0 0';
                return 1;
+       }
 
        player = self;
        spider = self.vehicle;
@@ -337,6 +341,7 @@ float spiderbot_frame()
        player.BUTTON_ZOOM        = 0;
        player.BUTTON_CROUCH    = 0;
        player.switchweapon      = 0;
+       player.vehicle_weapon2mode = spider.vehicle_weapon2mode;
 
 
 #if 1 // 0 to enable per-gun impact aux crosshairs
@@ -477,6 +482,7 @@ float spiderbot_frame()
        self.angles_x = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles_x, autocvar_g_vehicle_spiderbot_tiltlimit);
        self.angles_z = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles_z, autocvar_g_vehicle_spiderbot_tiltlimit);
 
+       if(!forbidWeaponUse(player))
        if(player.BUTTON_ATCK)
        {
                spider.cnt = time;
@@ -493,15 +499,8 @@ float spiderbot_frame()
                        v_forward = normalize(v_forward);
                        v += v_forward * 50;
 
-//void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, float lifetime, float damage, float force, float dtype, float tracereffects, float gravityfactor, float bulletconstant)
-
-                       fireBallisticBullet(v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_speed,
-                                                               5, autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN, 0, autocvar_g_vehicle_spiderbot_minigun_bulletconstant);
-
-                       endFireBallisticBullet();
-
-//                     fireBullet (v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_damage,
-//                             autocvar_g_vehicle_spiderbot_minigun_spread, DEATH_VH_SPID_MINIGUN, 0);
+                       fireBullet(v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_solidpenetration,
+                                autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN, 0);
 
                        sound (gun, CH_WEAPON_A, "weapons/uzi_fire.wav", VOL_BASE, ATTEN_NORM);
                        //trailparticles(self, particleeffectnum("spiderbot_minigun_trail"), v, trace_endpos);
@@ -576,7 +575,7 @@ void spiderbot_exit(float eject)
        self.frame = 5;
        self.movetype = MOVETYPE_WALK;
 
-       if not(self.owner)
+       if(!self.owner)
                return;
 
        makevectors(self.angles);
@@ -739,8 +738,8 @@ float spiderbot_impulse(float _imp)
 
 void spawnfunc_vehicle_spiderbot()
 {
-       if not(autocvar_g_vehicle_spiderbot) { remove(self); return; }
-       if not(vehicle_initialize(VEH_SPIDERBOT, FALSE)) { remove(self); return; }
+       if(!autocvar_g_vehicle_spiderbot) { remove(self); return; }
+       if(!vehicle_initialize(VEH_SPIDERBOT, FALSE)) { remove(self); return; }
 }
 
 float v_spiderbot(float req)
@@ -792,12 +791,14 @@ float v_spiderbot(float req)
                        self.colormod                   = self.tur_head.colormod = '-1 -1 -1';
                        self.frame                              = 10;
                        self.movetype                   = MOVETYPE_TOSS;
+                       
+                       CSQCModel_UnlinkEntity(); // networking the death scene would be a nightmare
 
                        return TRUE;
                }
                case VR_SPAWN:
                {
-                       if not(self.gun1)
+                       if(!self.gun1)
                        {
                                self.vehicles_impulse = spiderbot_impulse;
                                self.gun1 = spawn();
@@ -843,6 +844,7 @@ float v_spiderbot(float req)
                        self.vehicle_health = autocvar_g_vehicle_spiderbot_health;
                        self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
                        self.max_health = self.vehicle_health;
+                       self.pushable = TRUE; // spiderbot can use jumppads
 
                        return TRUE;
                }
@@ -873,18 +875,14 @@ float v_spiderbot(float req)
 
 #endif // SVQC
 #ifdef CSQC
+var float autocvar_cl_vehicle_spiderbot_cross_alpha = 0.6;
+var float autocvar_cl_vehicle_spiderbot_cross_size = 1;
 
 #define spider_ico  "gfx/vehicles/sbot.tga"
 #define spider_rkt  "gfx/vehicles/sbot_rpods.tga"
 #define spider_mgun "gfx/vehicles/sbot_mguns.tga"
 string spider_xhair; // = "gfx/vehicles/axh-special1.tga";
 
-#define SBRM_FIRST 1
-#define SBRM_VOLLY 1
-#define SBRM_GUIDE 2
-#define SBRM_ARTILLERY 3
-#define SBRM_LAST 3
-
 float v_spiderbot(float req)
 {
        switch(req)
@@ -935,7 +933,7 @@ float v_spiderbot(float req)
                                if(alarm1time < time)
                                {
                                        alarm1time = time + 2;
-                                       sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
+                                       vehicle_alarm(self, CH_PAIN_SINGLE, "vehicles/alarm.wav");
                                }
                                drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
                        }
@@ -944,7 +942,7 @@ float v_spiderbot(float req)
                                drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
                                if(alarm1time)
                                {
-                                       sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
+                                       vehicle_alarm(self, CH_PAIN_SINGLE, "misc/null.wav");
                                        alarm1time = 0;
                                }
                        }
@@ -962,7 +960,7 @@ float v_spiderbot(float req)
                                if(alarm2time < time)
                                {
                                        alarm2time = time + 1;
-                                       sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
+                                       vehicle_alarm(self, CH_PAIN_SINGLE, "vehicles/alarm_shield.wav");
                                }
                                drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
                        }
@@ -971,7 +969,7 @@ float v_spiderbot(float req)
                                drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
                                if(alarm2time)
                                {
-                                       sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
+                                       vehicle_alarm(self, CH_PAIN_SINGLE, "misc/null.wav");
                                        alarm2time = 0;
                                }
                        }
@@ -1029,7 +1027,7 @@ float v_spiderbot(float req)
                                HUD_DrawScoreboard();
                        else
                        {
-                               switch(weapon2mode)
+                               switch(getstati(STAT_VEHICLESTAT_W2MODE))
                                {
                                        case SBRM_VOLLY:
                                                spider_xhair = "gfx/vehicles/axh-bracket.tga";