From: terencehill Date: Thu, 8 Oct 2015 20:47:08 +0000 (+0200) Subject: Port bumblebee and raptor HUD code from cl_vehicles.qc to the relative files X-Git-Tag: xonotic-v0.8.2~1799^2~11 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=17b5059740bc2908429cc3a48bb48fc0bf3526e1;p=xonotic%2Fxonotic-data.pk3dir.git Port bumblebee and raptor HUD code from cl_vehicles.qc to the relative files --- diff --git a/qcsrc/common/vehicles/cl_vehicles.qc b/qcsrc/common/vehicles/cl_vehicles.qc index 07a3cc9fd..52e84a210 100644 --- a/qcsrc/common/vehicles/cl_vehicles.qc +++ b/qcsrc/common/vehicles/cl_vehicles.qc @@ -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) { diff --git a/qcsrc/common/vehicles/cl_vehicles.qh b/qcsrc/common/vehicles/cl_vehicles.qh index bf96d95ea..646b6c9d8 100644 --- a/qcsrc/common/vehicles/cl_vehicles.qh +++ b/qcsrc/common/vehicles/cl_vehicles.qh @@ -1,6 +1,9 @@ #ifndef CL_VEHICLES_H #define CL_VEHICLES_H +vector hudSize; +vector hudPos; + void Net_AuXair2(float bIsNew); void Net_VehicleSetup(); diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qc b/qcsrc/common/vehicles/vehicle/bumblebee.qc index 7f5bfea3a..5b8df88c4 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qc @@ -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)) { diff --git a/qcsrc/common/vehicles/vehicle/raptor.qc b/qcsrc/common/vehicles/vehicle/raptor.qc index b170dd557..0cd426e51 100644 --- a/qcsrc/common/vehicles/vehicle/raptor.qc +++ b/qcsrc/common/vehicles/vehicle/raptor.qc @@ -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))