]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/vehicles/vehicle/raptor.qc
Merge branch 'master' into terencehill/hud_cleanups
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / vehicles / vehicle / raptor.qc
index cff7fe9cbb65813e826c51bb6fcdc61b6fa2d350..58a189a85074bf53fb6cce14fe5b0868271eaa6d 100644 (file)
@@ -524,7 +524,7 @@ void raptor_blowup()
 {SELFPARAM();
        self.deadflag   = DEAD_DEAD;
        self.vehicle_exit(VHEF_NORMAL);
-       RadiusDamage (self, self.enemy, 250, 15, 250, world, world, 250, DEATH_VH_RAPT_DEATH, world);
+       RadiusDamage (self, self.enemy, 250, 15, 250, world, world, 250, DEATH_VH_RAPT_DEATH.m_id, world);
 
        self.alpha                = -1;
        self.movetype      = MOVETYPE_NONE;
@@ -567,12 +567,10 @@ 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;
@@ -607,8 +605,8 @@ float raptor_impulse(float _imp)
        return false;
 }
 
-void spawnfunc_vehicle_raptor()
-{SELFPARAM();
+spawnfunc(vehicle_raptor)
+{
        if(!autocvar_g_vehicle_raptor) { remove(self); return; }
        if(!vehicle_initialize(VEH_RAPTOR, false)) { remove(self); return; }
 }
@@ -775,6 +773,12 @@ void spawnfunc_vehicle_raptor()
 #ifdef CSQC
 
                METHOD(Raptor, vr_hud, void(Raptor thisveh))
+               {
+                       Vehicles_drawHUD(VEH_RAPTOR.m_icon, "vehicle_raptor_weapon1", "vehicle_raptor_weapon2",
+                                                        "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
+                                                        "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
+               }
+               METHOD(Raptor, vr_crosshair, void(Raptor thisveh))
                {
                        string crosshair;
 
@@ -785,10 +789,60 @@ void spawnfunc_vehicle_raptor()
                                default:        crosshair = vCROSS_BURST;
                        }
 
-                       Vehicles_drawHUD(VEH_RAPTOR.m_icon, "vehicle_raptor_weapon1", "vehicle_raptor_weapon2",
-                                                        "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
-                                                        "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color,
-                                                        crosshair);
+                       vector tmpSize = '0 0 0';
+                       if(weapon2mode != RSM_FLARE)
+                       {
+                               vector where;
+
+                               if(!dropmark)
+                               {
+                                       dropmark = spawn();
+                                       dropmark.owner = self;
+                                       dropmark.gravity = 1;
+                               }
+
+                               float reload2 = getstati(STAT_VEHICLESTAT_RELOAD2) * 0.01;
+                               if(reload2 == 1)
+                               {
+                                       setorigin(dropmark, pmove_org);
+                                       dropmark.velocity = pmove_vel;
+                                       tracetoss(dropmark, self);
+
+                                       where = project_3d_to_2d(trace_endpos);
+
+                                       setorigin(dropmark, trace_endpos);
+                                       tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size;
+
+                                       if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
+                                       {
+                                               where.x -= tmpSize.x * 0.5;
+                                               where.y -= tmpSize.y * 0.5;
+                                               where.z = 0;
+                                               drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
+                                               drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
+                                       }
+                                       dropmark.cnt = time + 5;
+                               }
+                               else
+                               {
+                                       if(dropmark.cnt > time)
+                                       {
+                                               where = project_3d_to_2d(dropmark.origin);
+                                               tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size * 1.25;
+
+                                               if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
+                                               {
+                                                       where.x -= tmpSize.x * 0.5;
+                                                       where.y -= tmpSize.y * 0.5;
+                                                       where.z = 0;
+                                                       drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
+                                                       drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
+                                               }
+                                       }
+                               }
+                       }
+
+                       Vehicles_drawCrosshair(crosshair);
                }
                METHOD(Raptor, vr_setup, void(Raptor thisveh))
                {