]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Raptor gets flares
authorJakob MG <jakob_mg@hotmail.com>
Sat, 23 Jun 2012 19:07:31 +0000 (21:07 +0200)
committerJakob MG <jakob_mg@hotmail.com>
Sat, 23 Jun 2012 19:07:31 +0000 (21:07 +0200)
qcsrc/client/vehicles/vehicles.qc
qcsrc/common/constants.qh
qcsrc/server/vehicles/raptor.qc
vehicle_raptor.cfg

index 339de73facb3003b3873cf14579847ddb6f7b3dd..62ba5304d26e59c7d06a27ae81c268d992ccc434 100644 (file)
 #define SBRM_ARTILLERY 3
 #define SBRM_LAST 3
 
+#define RSM_FIRST 1
+#define RSM_BOMB 1
+#define RSM_FLARE 2
+#define RSM_LAST 2
+
 entity dropmark;
 float autocvar_cl_vehicles_hudscale;
 float autocvar_cl_vehicles_hudalpha;
 
+#define raptor_ico  "gfx/vehicles/raptor.tga"
+#define raptor_gun  "gfx/vehicles/raptor_guns.tga"
+#define raptor_bomb "gfx/vehicles/raptor_bombs.tga"
+#define raptor_drop "gfx/vehicles/axh-dropcross.tga"
+string raptor_xhair;
 
 void CSQC_WAKIZASHI_HUD();
 void CSQC_SPIDER_HUD();
@@ -497,11 +507,6 @@ void CSQC_SPIDER_HUD()
     }
 }
 
-#define raptor_ico  "gfx/vehicles/raptor.tga"
-#define raptor_gun  "gfx/vehicles/raptor_guns.tga"
-#define raptor_bomb "gfx/vehicles/raptor_bombs.tga"
-#define raptor_drop "gfx/vehicles/axh-dropcross.tga"
-#define raptor_xhair "gfx/vehicles/axh-ring.tga"
 void CSQC_RAPTOR_HUD()
 {
        if(autocvar_r_letterbox)
@@ -620,55 +625,64 @@ void CSQC_RAPTOR_HUD()
         drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
     else
         drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
-
-// Bombing crosshair
-    if(!dropmark)
+    
+    if(weapon2mode == RSM_FLARE)
     {
-        dropmark = spawn();
-        dropmark.owner = self;
-        dropmark.gravity = 1;
+        raptor_xhair =  "gfx/vehicles/axh-bracket.tga";
     }
-
-    if(reload2 == 100)
+    else
     {
-        vector where;
+        raptor_xhair =  "gfx/vehicles/axh-ring.tga";
+        
+        // Bombing crosshair
+        if(!dropmark)
+        {
+            dropmark = spawn();
+            dropmark.owner = self;
+            dropmark.gravity = 1;
+        }
 
-        setorigin(dropmark, pmove_org);
-        dropmark.velocity = pmove_vel;
-        tracetoss(dropmark, self);
+        if(reload2 == 100)
+        {
+            vector where;
 
-        where = project_3d_to_2d(trace_endpos);
+            setorigin(dropmark, pmove_org);
+            dropmark.velocity = pmove_vel;
+            tracetoss(dropmark, self);
 
-        setorigin(dropmark, trace_endpos);
-        picsize = draw_getimagesize(raptor_drop) * 0.2;
+            where = project_3d_to_2d(trace_endpos);
 
-        if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
-        {
-            where_x -= picsize_x * 0.5;
-            where_y -= picsize_y * 0.5;
-            where_z = 0;
-            drawpic(where, raptor_drop, picsize, '0 2 0', 1, DRAWFLAG_ADDITIVE);
-        }
-        dropmark.cnt = time + 5;
-    }
-    else
-    {
-        vector where;
-        if(dropmark.cnt > time)
-        {
-            where = project_3d_to_2d(dropmark.origin);
-            picsize = draw_getimagesize(raptor_drop) * 0.25;
+            setorigin(dropmark, trace_endpos);
+            picsize = draw_getimagesize(raptor_drop) * 0.2;
 
             if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
             {
                 where_x -= picsize_x * 0.5;
                 where_y -= picsize_y * 0.5;
                 where_z = 0;
-                drawpic(where, raptor_drop, picsize, '2 0 0', 1, DRAWFLAG_ADDITIVE);
+                drawpic(where, raptor_drop, picsize, '0 2 0', 1, DRAWFLAG_ADDITIVE);
+            }
+            dropmark.cnt = time + 5;
+        }
+        else
+        {
+            vector where;
+            if(dropmark.cnt > time)
+            {
+                where = project_3d_to_2d(dropmark.origin);
+                picsize = draw_getimagesize(raptor_drop) * 0.25;
+
+                if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
+                {
+                    where_x -= picsize_x * 0.5;
+                    where_y -= picsize_y * 0.5;
+                    where_z = 0;
+                    drawpic(where, raptor_drop, picsize, '2 0 0', 1, DRAWFLAG_ADDITIVE);
+                }
             }
         }
     }
-
+    
        if (scoreboard_showscores)
                HUD_DrawScoreboard();
     else
index 062b87a220a7cd93f54b1b2c71453a2bf7f0de5c..076de115e265c8c78aaf386d903737ce96609109 100644 (file)
@@ -46,8 +46,6 @@ const float TE_CSQC_NEX_SCOPE = 116;
 const float TE_CSQC_MINELAYER_MAXMINES = 117;
 const float TE_CSQC_HAGAR_MAXROCKETS = 118;
 const float TE_CSQC_VEHICLESETUP = 119;
-const float VEHICLESETUP_ENTER = 0;
-const float VEHICLESETUP_UPDATE = 1;
 const float TE_CSQC_SVNOTICE = 120;
 
 const float RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder
index 0054d54414f003c71de827f94c715637f0c31979..996fbc7c9b8f7c40700edadb5ebd7789ea0c560e 100644 (file)
@@ -1,7 +1,12 @@
-#ifdef SVQC
+#define RSM_FIRST 0
+#define RSM_BOMB 0
+#define RSM_FLARE 1
+#define RSM_LAST 1
+
 #define RAPTOR_MIN '-80 -80 0'
 #define RAPTOR_MAX '80 80 70'
 
+#ifdef SVQC
 float autocvar_g_vehicle_raptor_respawntime;
 float autocvar_g_vehicle_raptor_takeofftime;
 
@@ -27,6 +32,11 @@ float autocvar_g_vehicle_raptor_bomblet_force;
 float autocvar_g_vehicle_raptor_bomblet_explode_delay;
 float autocvar_g_vehicle_raptor_bombs_refire;
 
+float autocvar_g_vehicle_raptor_flare_refire;
+float autocvar_g_vehicle_raptor_flare_lifetime;
+float autocvar_g_vehicle_raptor_flare_chase;
+float autocvar_g_vehicle_raptor_flare_range;
+
 float autocvar_g_vehicle_raptor_cannon_turnspeed;
 float autocvar_g_vehicle_raptor_cannon_turnlimit;
 float autocvar_g_vehicle_raptor_cannon_pitchlimit_up;
@@ -195,7 +205,8 @@ void raptor_enter()
 
     if(self.owner.flagcarried)
        setorigin(self.owner.flagcarried, '-20 0 96');
-
+    
+    CSQCVehicleSetup(self.owner, 0);
 }
 
 void raptor_land()
@@ -309,6 +320,30 @@ float raptor_takeoff()
     return 1;
 }
 
+void raptor_flare_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
+{
+    self.health -= damage;
+    if(self.health <= 0)
+        remove(self);
+}
+
+void raptor_flare_think()
+{
+    self.nextthink = time + 0.1;
+    entity _missile = findchainentity(enemy, self.owner);
+    while(_missile)
+    {
+        if(_missile.flags & FL_PROJECTILE)
+        if(vlen(self.origin - _missile.origin) < autocvar_g_vehicle_raptor_flare_range)
+        if(random() > autocvar_g_vehicle_raptor_flare_chase)
+            _missile.enemy = self;
+        _missile = _missile.chain;
+    }
+    
+    if(self.tur_impacttime < time)
+        remove(self);
+}
+
 float raptor_frame()
 {
     entity player, raptor;
@@ -503,15 +538,48 @@ float raptor_frame()
     if(self.vehicle_flags  & VHF_ENERGYREGEN)
         vehicles_regen(cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, frametime);
 
-
-    if(time > raptor.delay)
-    if(player.BUTTON_ATCK2)
+    if(raptor.vehicle_weapon2mode == RSM_BOMB)
     {
-        raptor_bombdrop();
-        raptor.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
-        raptor.lip   = time;
+        if(time > raptor.lip + autocvar_g_vehicle_raptor_bombs_refire)
+        if(player.BUTTON_ATCK2)
+        {
+            raptor_bombdrop();
+            raptor.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
+            raptor.lip   = time;
+        }        
     }
-
+    else
+    {
+        if(time > raptor.lip + autocvar_g_vehicle_raptor_flare_refire)
+        if(player.BUTTON_ATCK2)
+        {
+            float i;
+            entity _flare;
+            
+            for(i = 0; i < 3; ++i)
+            {
+            _flare = spawn();
+            setmodel(_flare, "models/runematch/rune.mdl"); 
+            _flare.effects = EF_LOWPRECISION | EF_FLAME;
+            _flare.scale = 0.5;
+            setorigin(_flare, self.origin - '0 0 16');
+            _flare.movetype = MOVETYPE_TOSS;
+            _flare.gravity = 0.15;
+            _flare.velocity = 0.25 * raptor.velocity + (v_forward + randomvec() * 0.25)* -500;
+            _flare.think = raptor_flare_think;
+            _flare.nextthink = time;
+            _flare.owner = raptor;
+            _flare.solid = SOLID_CORPSE;
+            _flare.takedamage = DAMAGE_YES;
+            _flare.event_damage = raptor_flare_damage;
+            _flare.health = 20;
+            _flare.tur_impacttime = time + autocvar_g_vehicle_raptor_flare_lifetime;
+            }
+            raptor.delay = time + autocvar_g_vehicle_raptor_flare_refire;
+            raptor.lip   = time;
+        }
+    }
+    
     raptor.bomb1.alpha = raptor.bomb2.alpha = (time - raptor.lip) / (raptor.delay - raptor.lip);
     player.vehicle_reload2 = bound(0, raptor.bomb1.alpha * 100, 100);
 
@@ -610,6 +678,38 @@ void raptor_rotor_anglefix()
     self.gun2.angles_y = anglemods(self.gun2.angles_y);
     self.nextthink = time + 15;
 }
+float raptor_impulse(float _imp)
+{
+    switch(_imp)
+    {
+        case 10:
+        case 15:        
+        case 18:
+            self.vehicle.vehicle_weapon2mode += 1;
+            if(self.vehicle.vehicle_weapon2mode > RSM_LAST)
+                self.vehicle.vehicle_weapon2mode = RSM_FIRST;
+            
+            CSQCVehicleSetup(self, 0);
+            return TRUE;
+        case 12:
+        case 16:
+        case 19:
+            self.vehicle.vehicle_weapon2mode -= 1;
+            if(self.vehicle.vehicle_weapon2mode < RSM_FIRST)
+                self.vehicle.vehicle_weapon2mode = RSM_LAST;
+            
+            CSQCVehicleSetup(self, 0);
+            return TRUE;
+
+        /*                     
+        case 17: // toss gun, could be used to exit?
+            break;
+        case 20: // Manual minigun reload?
+            break;
+        */
+    }    
+    return FALSE;
+}
 
 void raptor_dinit()
 {
@@ -637,7 +737,9 @@ void raptor_dinit()
 
     //FIXME: Camera is in a bad place in HUD model.
     //setorigin(self.vehicle_viewport, '25 0 5');
-
+    
+    self.vehicles_impusle   = raptor_impulse;
+    
     self.frame = 0;
 
     self.bomb1 = spawn();
index 9ee72446f168d726af859c02318c1dc43e7106ec..96ba6a0cdcda8114e607df0ed9754154343a742a 100644 (file)
@@ -48,6 +48,11 @@ set g_vehicle_raptor_cannon_speed    12000
 set g_vehicle_raptor_cannon_spread   0.01
 set g_vehicle_raptor_cannon_force    25
 
+set g_vehicle_raptor_flare_refire 5
+set g_vehicle_raptor_flare_lifetime 10
+set g_vehicle_raptor_flare_chase 0.9
+set g_vehicle_raptor_flare_range 1500
+
 set g_vehicle_raptor_energy             30
 set g_vehicle_raptor_energy_regen       15
 set g_vehicle_raptor_energy_regen_pause 0.8