From 06ef79f6cbdf7c5ff8378973ce32863f5325a4f8 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 17 Jun 2017 15:26:18 +0200 Subject: [PATCH] Minor optimizations + minor fix --- qcsrc/common/vehicles/cl_vehicles.qc | 7 ++++--- qcsrc/common/vehicles/vehicle/raptor.qc | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/qcsrc/common/vehicles/cl_vehicles.qc b/qcsrc/common/vehicles/cl_vehicles.qc index afb48c918..b2f87821e 100644 --- a/qcsrc/common/vehicles/cl_vehicles.qc +++ b/qcsrc/common/vehicles/cl_vehicles.qc @@ -33,13 +33,14 @@ void AuxiliaryXhair_Draw2D(entity this) if (scoreboard_active) return; - vector size = draw_getimagesize(this.axh_image) * autocvar_cl_vehicles_crosshair_size; - vector pos = project_3d_to_2d(this.origin) - 0.5 * size; + vector pos = project_3d_to_2d(this.origin); if (!(pos.z < 0 || pos.x < 0 || pos.y < 0 || pos.x > vid_conwidth || pos.y > vid_conheight)) { + vector size = draw_getimagesize(this.axh_image) * autocvar_cl_vehicles_crosshair_size; + pos.x -= 0.5 * size.x; + pos.y -= 0.5 * size.y; pos.z = 0; - size.z = 0; drawpic(pos, this.axh_image, size, this.colormod, autocvar_crosshair_alpha * this.alpha, this.axh_drawflag); } diff --git a/qcsrc/common/vehicles/vehicle/raptor.qc b/qcsrc/common/vehicles/vehicle/raptor.qc index 5424d1cdf..d2839faa8 100644 --- a/qcsrc/common/vehicles/vehicle/raptor.qc +++ b/qcsrc/common/vehicles/vehicle/raptor.qc @@ -794,10 +794,10 @@ METHOD(Raptor, vr_crosshair, void(Raptor thisveh, entity player)) 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)) { + tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size; where.x -= tmpSize.x * 0.5; where.y -= tmpSize.y * 0.5; where.z = 0; @@ -811,10 +811,10 @@ METHOD(Raptor, vr_crosshair, void(Raptor thisveh, entity player)) 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)) { + tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size * 1.25; where.x -= tmpSize.x * 0.5; where.y -= tmpSize.y * 0.5; where.z = 0; -- 2.39.2