]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/vehicles/raptor.qc
Merge remote branch 'origin/master' into terencehill/centerprint_stuff
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / vehicles / raptor.qc
index 947fc639b3e6c373d854391c7f432ad5bfe727e4..201c186c37947d65ad983efd0b4c67c1f0484120 100644 (file)
@@ -1,7 +1,7 @@
 #ifdef SVQC
 #define RAPTOR_MIN '-80 -80 0'
 #define RAPTOR_MAX '80 80 70'
-//#define RAPTOR_ENGINE "sound/vehicles/raptor.wav"
+
 float autocvar_g_vehicle_raptor_respawntime;
 
 float autocvar_g_vehicle_raptor_movestyle;
@@ -129,11 +129,6 @@ void raptor_bomb_burst()
     remove(self);
 }
 
-void raptor_bomb_touch()
-{
-    raptor_bomb_burst();
-}
-
 void raptor_bombdrop()
 {
     entity bomb_1, bomb_2;
@@ -146,7 +141,7 @@ void raptor_bombdrop()
 
     bomb_1.movetype     = bomb_2.movetype   = MOVETYPE_BOUNCE;
     bomb_1.velocity     = bomb_2.velocity   = self.velocity;
-    bomb_1.touch        = bomb_2.touch      = raptor_bomb_touch;
+    bomb_1.touch        = bomb_2.touch      = raptor_bomb_burst;
     bomb_1.think        = bomb_2.think      = raptor_bomb_burst;
     bomb_1.cnt          = bomb_2.cnt        = time + 10;
 
@@ -165,17 +160,13 @@ void raptor_bombdrop()
 
     CSQCProjectile(bomb_1, TRUE, PROJECTILE_RAPTORBOMB, TRUE);
     CSQCProjectile(bomb_2, TRUE, PROJECTILE_RAPTORBOMB, TRUE);
-
 }
 
 
 void raptor_fire_cannon(entity gun, string tagname)
 {
-    entity bolt;
-    vector b_org;
-    b_org = gettaginfo(gun, gettagindex(gun, tagname));
-    bolt = vehicles_projectile("raptor_cannon_muzzleflash", "weapons/lasergun_fire.wav",
-                           b_org, normalize(v_forward + randomvec() * autocvar_g_vehicle_raptor_cannon_spread) * autocvar_g_vehicle_raptor_cannon_speed,
+    vehicles_projectile("raptor_cannon_muzzleflash", "weapons/lasergun_fire.wav",
+                           gettaginfo(gun, gettagindex(gun, tagname)), normalize(v_forward + randomvec() * autocvar_g_vehicle_raptor_cannon_spread) * autocvar_g_vehicle_raptor_cannon_speed,
                            autocvar_g_vehicle_raptor_cannon_damage, autocvar_g_vehicle_raptor_cannon_radius, autocvar_g_vehicle_raptor_cannon_force,  0,
                            DEATH_RAPTOR_CANNON, PROJECTILE_RAPTORCANNON, 0, TRUE, TRUE);
 }
@@ -267,11 +258,10 @@ float raptor_takeoff()
     player = self;
     raptor = self.vehicle;
     self   = raptor;
-    
     if(self.sound_nexttime < time)
     {        
         self.sound_nexttime = time + 7.955812; //soundlength("vehicles/raptor_fly.wav");
-        sound (self, CHAN_TRIGGER, "vehicles/raptor_speed.wav", VOL_VEHICLEENGINE, ATTN_NORM);
+        sound (self, CH_TRIGGER_SINGLE, "vehicles/raptor_speed.wav", VOL_VEHICLEENGINE, ATTN_NORM);
     }   
 
     // Takeoff sequense
@@ -315,12 +305,14 @@ float raptor_frame()
 {
     entity player, raptor;
     float ftmp, ftmp2;
-    vector df, ra;
+    vector df;
+    
+       if(intermission_running)
+               return 1;
 
     player = self;
     raptor = self.vehicle;
     self   = raptor;
-    
     vehicles_painframe();
     /*
     ftmp = vlen(self.velocity);
@@ -333,19 +325,18 @@ float raptor_frame()
     if(self.sound_nexttime < time)
     {        
         self.sound_nexttime = time + 7.955812; 
-        //sound (self.tur_head, CHAN_TRIGGER, "vehicles/raptor_fly.wav", 1 - ftmp,   ATTN_NORM );
-        sound (self, CHAN_TRIGGER, "vehicles/raptor_speed.wav", 1, ATTN_NORM);        
+        //sound (self.tur_head, CH_TRIGGER_SINGLE, "vehicles/raptor_fly.wav", 1 - ftmp,   ATTN_NORM );
+        sound (self, CH_TRIGGER_SINGLE, "vehicles/raptor_speed.wav", 1, ATTN_NORM);        
         self.wait = ftmp;
     }        
     /*
     else if(fabs(ftmp - self.wait) > 0.2)
     {
-        sound (self.tur_head, CHAN_TRIGGER, "", 1 - ftmp,   ATTN_NORM );
-        sound (self, CHAN_TRIGGER, "", ftmp, ATTN_NORM);        
+        sound (self.tur_head, CH_TRIGGER_SINGLE, "", 1 - ftmp,   ATTN_NORM );
+        sound (self, CH_TRIGGER_SINGLE, "", ftmp, ATTN_NORM);        
         self.wait = ftmp;
     }
     */
-
     
     if(raptor.deadflag != DEAD_NO)
     {
@@ -355,7 +346,6 @@ float raptor_frame()
     }
     crosshair_trace(player);
 
-
     vector vang;
     vang = raptor.angles;
     df = vectoangles(normalize(trace_endpos - self.origin + '0 0 32'));
@@ -383,7 +373,6 @@ float raptor_frame()
     raptor.angles_y = anglemods(raptor.angles_y);
     raptor.angles_z = anglemods(raptor.angles_z);
 
-
     if(autocvar_g_vehicle_raptor_movestyle == 1)
         makevectors('0 1 0' * raptor.angles_y);
     else
@@ -421,7 +410,6 @@ float raptor_frame()
         df +=  v_up * autocvar_g_vehicle_raptor_speed_up;
 
     raptor.velocity  += df * frametime;
-    //player.velocity = raptor.velocity;
     player.velocity = player.movement  = raptor.velocity;
     setorigin(player, raptor.origin + '0 0 32');
 
@@ -449,7 +437,6 @@ float raptor_frame()
                 ad = vf + raptor.lock_target.velocity * impact_time;
             }
             trace_endpos = ad;
-            //UpdateAuxiliaryXhair(player, trace_endpos, '1 1 1', 0);
         }
 
         if(self.lock_target)
@@ -463,23 +450,17 @@ float raptor_frame()
         }
     }
 
-    ra = raptor.angles;
-    ra_z = 0;
     // Aim the gunz
     ftmp2 = autocvar_g_vehicle_raptor_cannon_turnspeed * frametime;
     ftmp = -ftmp2;
 
     // Gun1
     df = gettaginfo(raptor.gun1, gettagindex(raptor.gun1, "fire1"));
-    ad = df;
-    vf = v_forward;
-    //if(self.lock_strength == 1)
-    //{
-        df = vectoangles(normalize(trace_endpos - df)); // Find the direction & angle
-        df = shortangle_vxy(df - (ra + raptor.gun1.angles), ra + raptor.gun1.angles);     // Find aim offset        
-    //}
-    //else    
-    //    df = '0 0 0';
+    //ad = df;
+    //vf = v_forward;
+    df = vectoangles(normalize(trace_endpos - df)); // Find the direction & angle    
+    df = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(raptor.angles), AnglesTransform_FromAngles(df))) - raptor.gun1.angles;
+    df = shortangle_vxy(df, raptor.gun1.angles);
         
     // Bind to aimspeed
     df_x = bound(ftmp, df_x, ftmp2);
@@ -490,16 +471,12 @@ float raptor_frame()
 
     // Gun2
     df = gettaginfo(raptor.gun2, gettagindex(raptor.gun2, "fire1"));
-    ad += df;
-    vf += v_forward;
-    //if(self.lock_strength == 1)
-    //{
-        df = vectoangles(normalize(trace_endpos - df)); // Find the direction & angle
-        df = shortangle_vxy(df - (ra + raptor.gun2.angles), ra + raptor.gun2.angles);     // Find aim offset        
-    //}
-    //else    
-    //    df = '0 0 0';
-        
+    //ad += df;
+    //vf += v_forward;
+    df = vectoangles(normalize(trace_endpos - df)); // Find the direction & angle    
+    df = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(raptor.angles), AnglesTransform_FromAngles(df))) - raptor.gun2.angles;
+    df = shortangle_vxy(df, raptor.gun2.angles);
+    
     // Bind to aimspeed
     df_x = bound(ftmp, df_x, ftmp2);
     df_y = bound(ftmp, df_y, ftmp2);
@@ -566,9 +543,6 @@ float raptor_frame()
 
 void raptor_blowup()
 {
-    sound (self, CHAN_PROJECTILE, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
-    pointparticles(particleeffectnum("explosion_big"), self.origin, '0 0 0', 1);
-
     self.deadflag    = DEAD_DEAD;
     self.vehicle_exit(VHEF_NORMAL);
     RadiusDamage (self, self, 250, 15, 250, world, 250, DEATH_WAKIBLOWUP, world);
@@ -587,12 +561,9 @@ void raptor_blowup()
 
 void raptor_diethink()
 {
-    //self.avelocity += '0 0.5 1' * (random() * 5);
-    //self.avelocity -= '0 0.5 1' * (random() * 5);
-
     if(random() < 0.1)
     {
-        sound (self, CHAN_PROJECTILE, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
+        sound (self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
         pointparticles(particleeffectnum("explosion_small"), randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1);
     }
     self.nextthink = time + 0.1;
@@ -602,7 +573,6 @@ void raptor_die()
 {
     self.health       = 0;
     self.event_damage = SUB_Null;
-    self.iscreature   = FALSE;
     self.solid        = SOLID_CORPSE;
     self.takedamage   = DAMAGE_NO;
     self.deadflag     = DEAD_DYING;
@@ -756,15 +726,18 @@ void spawnfunc_vehicle_raptor()
     precache_model ("models/vehicles/raptor_gun.dpm");
     precache_model ("models/vehicles/spinner.dpm");
     precache_model ("models/vehicles/raptor_cockpit.dpm");
-    precache_model ("models/vehicles/clusterbomb.md3");
+    //precache_model ("models/vehicles/clusterbomb.md3");
     precache_model ("models/vehicles/clusterbomb_folded.md3");
     precache_model ("models/vehicles/raptor_body.dpm");
     
     precache_sound ("vehicles/raptor_fly.wav");
     precache_sound ("vehicles/raptor_speed.wav");
-    precache_sound ("");
     
     self.think = raptor_dinit;
-    self.nextthink = time + (autocvar_g_vehicles_delayspawn ? autocvar_g_vehicle_raptor_respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter) : 0.5);
+    
+    if(g_assault)
+        self.nextthink = time + 0.5;
+    else
+        self.nextthink = time + (autocvar_g_vehicles_delayspawn ? autocvar_g_vehicle_raptor_respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter) : 0.5);
 }
 #endif // SVQC