Page 1 of 1

Don't draw crosshair if centerstring

Posted: Mon Jun 23, 2014 6:03 am
by Baker
Quicky tutorial shows how to not draw a crosshair if there is centerprint that is going to print.

FitzQuake implementation: Add the yellow ...
gl_screen.c wrote:/*
==============
SCR_DrawCrosshair -- johnfitz
==============
*/
void SCR_DrawCrosshair (void)
{
qboolean will_draw_centerstring = !((scr_centertime_off - host_frametime <=0 && !cl.intermission) || key_dest != key_game || cl.paused);
if (will_draw_centerstring)
return; // Centerprint is going to print, so exit out and don't draw.


if (!crosshair.value)
return;

GL_SetCanvas (CANVAS_CROSSHAIR);
Draw_Character (-4, -4, '+'); //0,0 is center of viewport
}
Untested. Worst tutorial ever.

Re: Don't draw crosshair if centerstring

Posted: Mon Jun 23, 2014 6:36 am
by Spike
if you use TF's statusbar (which is set up via centerprints) this will make you unable to aim.

in FTE, centerprints of 4 lines or less are shifted up by a small amount to keep the text away from the cursor. this at least resolves the common case, but won't help mods that put essays in there.

Re: Don't draw crosshair if centerstring

Posted: Mon Jun 23, 2014 7:43 am
by Baker
Great point. Anything that uses an improvised on-screen "QuakeC" Hud or indicator.

A single player example: Quoth's flashlight battery indicator.