- picname = va("gfx/crosshair%i.tga", num + 1);
- pic = Draw_CachePic(picname);
- if (pic)
- DrawQ_Pic((vid.conwidth - pic->width * crosshair_size.value) * 0.5f, (vid.conheight - pic->height * crosshair_size.value) * 0.5f, picname, pic->width * crosshair_size.value, pic->height * crosshair_size.value, color[0] * scale + base, color[1] * scale + base, color[2] * scale + base, crosshair_alpha.value, 0);
+
+ if (crosshair_static.integer)
+ {
+ char *picname;
+ cachepic_t *pic;
+
+ picname = va("gfx/crosshair%i.tga", num + 1);
+ pic = Draw_CachePic(picname);
+ if (pic)
+ DrawQ_Pic((vid.conwidth - pic->width * crosshair_size.value) * 0.5f, (vid.conheight - pic->height * crosshair_size.value) * 0.5f, picname, pic->width * crosshair_size.value, pic->height * crosshair_size.value, color[0] * scale + base, color[1] * scale + base, color[2] * scale + base, crosshair_alpha.value, 0);
+ }
+ else
+ {
+ // trace the shot path up to a certain distance
+ VectorCopy(cl_entities[cl.viewentity].render.origin, v1);
+ v1[2] += 16; // HACK: this depends on the QC
+ // get the forward vector for the gun (not the view)
+ AngleVectors(cl.viewangles, v2, NULL, NULL);
+ //VectorCopy(r_origin, v1);
+ VectorMA(v1, 8192, v2, v2);
+ spritescale = 4.0f + (CL_TraceLine(v1, v2, spriteorigin, NULL, 0, true) * 8192.0f) * (1.0f / 48.0f);
+ spritescale = bound(0.0f, spritescale, 32.0f);
+ //VectorMA(spriteorigin, -4, vpn, spriteorigin);
+
+ cr = color[0] * scale + base;
+ cg = color[1] * scale + base;
+ cb = color[2] * scale + base;
+ ca = crosshair_alpha.value;
+
+ // clamp the colors so they don't go negative
+ cr = max(0, cr);
+ cg = max(0, cg);
+ cb = max(0, cb);
+ // might as well clamp the alpha
+ ca = bound(0, ca, 1.0f);
+
+ // finally draw the sprite
+ R_DrawCrosshairSprite(crosshairtexture[num], spriteorigin, spritescale, cr, cg, cb, ca);
+ }