From 99c37b13348a92278308810d670ca7bfe8251b26 Mon Sep 17 00:00:00 2001 From: Andrei Drexler Date: Tue, 23 Jun 2009 11:00:02 +0000 Subject: [PATCH] --- reaction/cgame/cg_draw.c | 3 ++- reaction/ta_ui/ui_main.c | 31 ++++++++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/reaction/cgame/cg_draw.c b/reaction/cgame/cg_draw.c index 4780009d..8453a1b4 100644 --- a/reaction/cgame/cg_draw.c +++ b/reaction/cgame/cg_draw.c @@ -1984,7 +1984,8 @@ static void CG_DrawCrosshair(void) w = cg_RQ3_ssgCrosshairSize.integer; if ( (hShader = cgs.media.ssgCrosshair[zoomMag]) ) { - CG_DrawPic(x - h, y - h, w, w, hShader); + float dim = cg_RQ3_ssgCrosshairSize.integer * cg.refdef.height / SCREEN_HEIGHT; + trap_R_DrawStretchPic((cg.refdef.width - dim) * 0.5f, (cg.refdef.height - dim) * 0.5f, dim, dim, 0.f, 0.f, 1.f, 1.f, hShader); } trap_R_SetColor(NULL); diff --git a/reaction/ta_ui/ui_main.c b/reaction/ta_ui/ui_main.c index 511536f9..f3025a1e 100644 --- a/reaction/ta_ui/ui_main.c +++ b/reaction/ta_ui/ui_main.c @@ -3041,12 +3041,15 @@ static void UI_DrawRedBlue(rectDef_t * rect, float scale, vec4_t color, int text static void UI_DrawCrosshair(rectDef_t * rect, float scale) { vec4_t color; + float size; color[0] = trap_Cvar_VariableValue("cg_RQ3_crosshairColorR"); color[1] = trap_Cvar_VariableValue("cg_RQ3_crosshairColorG"); color[2] = trap_Cvar_VariableValue("cg_RQ3_crosshairColorB"); color[3] = trap_Cvar_VariableValue("cg_RQ3_crosshairColorA"); + size = trap_Cvar_VariableValue("cg_crosshairSize"); + trap_R_SetColor(color); if (uiInfo.currentCrosshair < 0 || uiInfo.currentCrosshair >= NUM_CROSSHAIRS) { @@ -3056,10 +3059,30 @@ static void UI_DrawCrosshair(rectDef_t * rect, float scale) if (uiInfo.currentCrosshair != 0) { if (rect->hasVectors) - UI_DrawAngledPic(rect->x, rect->y - rect->h, rect->w, rect->h, rect->u, rect->v, color, - 0.f, 0.f, 1.f, 1.f, uiInfo.uiDC.Assets.crosshairShader[uiInfo.currentCrosshair]); + { + float pt[2]; + float mx, my; + + vec4_t black = { 0, 0, 0, 1}; + + pt[0] = rect->x; + pt[1] = rect->y; + + + UI_DrawAngledPic(pt[0], pt[1], rect->w, rect->h, rect->u, rect->v, black, + 0.f, 0.f, 1.f, 1.f, /*uiInfo.uiDC.Assets.crosshairShader[uiInfo.currentCrosshair]*/ uiInfo.uiDC.whiteShader); + + mx = (rect->w - size) * 0.5f; + my = (rect->h - size) * 0.5f; + + Vector2MA(pt, mx, rect->u, pt); + Vector2MA(pt, my, rect->v, pt); + + UI_DrawAngledPic(pt[0], pt[1], size, size, rect->u, rect->v, color, + 0.f, 0.f, 1.f, 1.f, /*uiInfo.uiDC.Assets.crosshairShader[uiInfo.currentCrosshair]*/ uiInfo.uiDC.whiteShader); + } else - UI_DrawHandlePic(rect->x, rect->y - rect->h, rect->w, rect->h, + UI_DrawHandlePic(rect->x + (rect->w - size) * 0.5f, rect->y + (rect->h - size) * 0.5f, size, size, uiInfo.uiDC.Assets.crosshairShader[uiInfo.currentCrosshair]); } trap_R_SetColor(NULL); @@ -3888,7 +3911,9 @@ static void UI_OwnerDraw(itemDef_t *item, float x, float y, float w, float h, fl Vector2MA(p, text_y, rect.v, p); rect.x = p[0]; rect.y = p[1]; + rect.hasVectors = qtrue; } else { + rect.hasVectors = qfalse; rect.x = x + text_x; rect.y = y + text_y; }