mirror of
https://github.com/nzp-team/dquakeplus.git
synced 2025-01-19 14:20:50 +00:00
Add cl_crosshair_debug and fix crosshair offset
This commit is contained in:
parent
7332872ef4
commit
ef7b59b0b0
2 changed files with 22 additions and 8 deletions
|
@ -1282,8 +1282,15 @@ Draw_Crosshair
|
|||
*/
|
||||
|
||||
extern float crosshair_opacity;
|
||||
extern cvar_t cl_crosshair_debug;
|
||||
void Draw_Crosshair (void)
|
||||
{
|
||||
if (cl_crosshair_debug.value) {
|
||||
Draw_FillByColor(vid.width/2, 0, 1, 272, GU_RGBA(255, 0, 0, 255));
|
||||
Draw_FillByColor(0, vid.height/2, 480, 1, GU_RGBA(0, 255, 0, 255));
|
||||
}
|
||||
|
||||
|
||||
if (cl.stats[STAT_HEALTH] < 20)
|
||||
return;
|
||||
|
||||
|
@ -1326,6 +1333,11 @@ void Draw_Crosshair (void)
|
|||
else if (crosshair.value == 1 && cl.stats[STAT_ZOOM] != 1 && cl.stats[STAT_ZOOM] != 2 && cl.stats[STAT_ACTIVEWEAPON] != W_PANZER)
|
||||
{
|
||||
int x_value, y_value;
|
||||
int x_center, y_center;
|
||||
|
||||
x_center = vid.width/2;
|
||||
y_center = vid.height/2;
|
||||
|
||||
int crosshair_offset = CrossHairWeapon() + cur_spread;
|
||||
if (CrossHairMaxSpread() < crosshair_offset || croshhairmoving)
|
||||
crosshair_offset = CrossHairMaxSpread();
|
||||
|
@ -1339,23 +1351,23 @@ void Draw_Crosshair (void)
|
|||
crosshair_offset_step += (crosshair_offset - crosshair_offset_step) * 0.5;
|
||||
|
||||
// Left
|
||||
x_value = (vid.width - 8)/2 - crosshair_offset_step;
|
||||
y_value = (vid.height - 8)/2;
|
||||
x_value = x_center - crosshair_offset_step;
|
||||
y_value = y_center;
|
||||
Draw_FillByColor(x_value, y_value, 3, 1, GU_RGBA(255, (int)col, (int)col, (int)crosshair_opacity));
|
||||
|
||||
// Right
|
||||
x_value = (vid.width - 8)/2 + crosshair_offset_step - 2;
|
||||
y_value = (vid.height - 8)/2;
|
||||
x_value = x_center + crosshair_offset_step - 3;
|
||||
y_value = y_center;
|
||||
Draw_FillByColor(x_value, y_value, 3, 1, GU_RGBA(255, (int)col, (int)col, (int)crosshair_opacity));
|
||||
|
||||
// Top
|
||||
x_value = (vid.width - 8)/2;
|
||||
y_value = (vid.height - 8)/2 - crosshair_offset_step;
|
||||
x_value = x_center;
|
||||
y_value = y_center - crosshair_offset;
|
||||
Draw_FillByColor(x_value, y_value, 1, 3, GU_RGBA(255, (int)col, (int)col, (int)crosshair_opacity));
|
||||
|
||||
// Bottom
|
||||
x_value = (vid.width - 8)/2;
|
||||
y_value = (vid.height - 8)/2 + crosshair_offset_step - 2;
|
||||
x_value = x_center;
|
||||
y_value = y_center + crosshair_offset - 3;
|
||||
Draw_FillByColor(x_value, y_value, 1, 3, GU_RGBA(255, (int)col, (int)col, (int)crosshair_opacity));
|
||||
}
|
||||
else if (crosshair.value && cl.stats[STAT_ZOOM] != 1 && cl.stats[STAT_ZOOM] != 2)
|
||||
|
|
|
@ -98,6 +98,7 @@ cvar_t scr_showpause = {"showpause","1"};
|
|||
cvar_t scr_printspeed = {"scr_printspeed","8"};
|
||||
cvar_t scr_conheight = {"scr_conheight", "0.5"};
|
||||
cvar_t scr_loadscreen = {"scr_loadscreen","1", qtrue};
|
||||
cvar_t cl_crosshair_debug = {"cl_crosshair_debug", "0", qtrue};
|
||||
|
||||
|
||||
cvar_t r_dithering = {"r_dithering","1",qtrue};
|
||||
|
@ -638,6 +639,7 @@ void SCR_Init (void)
|
|||
Cvar_RegisterVariable (&scr_conheight);
|
||||
Cvar_RegisterVariable (&r_dithering);
|
||||
Cvar_RegisterVariable (&scr_coloredtext);
|
||||
Cvar_RegisterVariable (&cl_crosshair_debug);
|
||||
|
||||
//
|
||||
// register our commands
|
||||
|
|
Loading…
Reference in a new issue