]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Port bumblebee and raptor HUD code from cl_vehicles.qc to the relative files
authorterencehill <piuntn@gmail.com>
Thu, 8 Oct 2015 20:47:08 +0000 (22:47 +0200)
committerterencehill <piuntn@gmail.com>
Thu, 8 Oct 2015 20:47:08 +0000 (22:47 +0200)
qcsrc/common/vehicles/cl_vehicles.qc
qcsrc/common/vehicles/cl_vehicles.qh
qcsrc/common/vehicles/vehicle/bumblebee.qc
qcsrc/common/vehicles/vehicle/raptor.qc

index 07a3cc9fdc7f20f68b4751e9ed28bca56181b61e..52e84a210516220929cd5b80c82b0f33819ff329 100644 (file)
@@ -126,8 +126,6 @@ void Vehicles_drawHUD(
                return;
 
        // Initialize
-       vector hudSize = '0 0 0';
-       vector hudPos  = '0 0 0';
        vector tmpSize = '0 0 0';
        vector tmpPos  = '0 0 0';
 
@@ -292,25 +290,6 @@ void Vehicles_drawHUD(
                else
                        drawpic_skin(tmpPos, iconAmmo2, tmpSize, '1 1 1', hudAlpha * 0.2, DRAWFLAG_NORMAL);
        }
-
-       // Bumblebee gunner crosshairs
-       if(hud == VEH_BUMBLEBEE.vehicleid)
-       {
-               tmpSize = '1 1 1' * hud_fontsize;
-               tmpPos.x = hudPos.x + hudSize.x * (520/768);
-
-               if(!AuxiliaryXhair[1].draw2d)
-               {
-                       tmpPos.y = hudPos.y + hudSize.y * (96/256) - tmpSize.y;
-                       drawstring(tmpPos, _("No right gunner!"), tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL);
-               }
-
-               if(!AuxiliaryXhair[2].draw2d)
-               {
-                       tmpPos.y = hudPos.y + hudSize.y * (160/256);
-                       drawstring(tmpPos, _("No left gunner!"), tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL);
-               }
-       }
 }
 
 void Vehicles_drawCrosshair(string crosshair)
@@ -319,59 +298,6 @@ void Vehicles_drawCrosshair(string crosshair)
        vector tmpSize = '0 0 0';
        vector tmpPos  = '0 0 0';
 
-       // Raptor bomb crosshair
-       if(hud == VEH_RAPTOR.vehicleid && 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
-                               }
-                       }
-               }
-       }
-
        // Crosshair
        if(crosshair)
        {
index bf96d95ea367bbad6641f4343ba75a86a9ff04ab..646b6c9d8b94cf583883967cbb41ad47bcf900e2 100644 (file)
@@ -1,6 +1,9 @@
 #ifndef CL_VEHICLES_H
 #define CL_VEHICLES_H
 
+vector hudSize;
+vector hudPos;
+
 void Net_AuXair2(float bIsNew);
 
 void Net_VehicleSetup();
index 7f5bfea3a40a5f3f559e48daa1ab8d1ea3fd0266..5b8df88c49dde0c51dce0a720fefe9b236861879 100644 (file)
@@ -961,6 +961,24 @@ void CSQC_BUMBLE_GUN_HUD()
                        Vehicles_drawHUD(VEH_BUMBLEBEE.m_icon, "vehicle_bumble_weapon1", "vehicle_bumble_weapon2",
                                                         "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
                                                         "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color);
+
+                       float hudAlpha = autocvar_hud_panel_fg_alpha;
+                       float blinkValue = 0.55 + sin(time * 7) * 0.45;
+                       vector tmpPos  = '0 0 0';
+                       vector tmpSize = '1 1 1' * hud_fontsize;
+                       tmpPos.x = hudPos.x + hudSize.x * (520/768);
+
+                       if(!AuxiliaryXhair[1].draw2d)
+                       {
+                               tmpPos.y = hudPos.y + hudSize.y * (96/256) - tmpSize.y;
+                               drawstring(tmpPos, _("No right gunner!"), tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL);
+                       }
+
+                       if(!AuxiliaryXhair[2].draw2d)
+                       {
+                               tmpPos.y = hudPos.y + hudSize.y * (160/256);
+                               drawstring(tmpPos, _("No left gunner!"), tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL);
+                       }
                }
                METHOD(Bumblebee, vr_crosshair, void(Bumblebee thisveh))
                {
index b170dd557de43e9eb802e085570fec75396231e5..0cd426e518ffb9b9565bf5e70271bddd083d91e8 100644 (file)
@@ -789,6 +789,59 @@ spawnfunc(vehicle_raptor)
                                default:        crosshair = vCROSS_BURST;
                        }
 
+                       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))