summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Tetelman <kevlarman@gmail.com>2009-10-03 12:02:11 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:15:37 +0000
commitdc94850a57da6e2eba3d0dfcb57265c883438d92 (patch)
tree624bb0db80abc1517d01b0da09b07ab128552c53
parent49068a11006c30cb814104f2a9c5ea5629fc8487 (diff)
* crosshairs now use the center of the rectangle defined by the hud for their position, instead of cg_crosshairX/cg_crosshairY
-rw-r--r--src/cgame/cg_draw.c8
-rw-r--r--src/cgame/cg_local.h2
-rw-r--r--src/cgame/cg_main.c4
-rw-r--r--ui/tremulous_common_hud.h1
4 files changed, 5 insertions, 10 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index 0e79fcef..5f28cc57 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -2176,10 +2176,10 @@ static void CG_DrawCrosshair( rectDef_t *rect, vec4_t color )
w = h = wi->crossHairSize * cg_crosshairSize.value;
w *= cgDC.aspectScale;
- //FIXME: find a way to use rect from the hud instead of cg_crosshair[XY]
- //the different sizes of the crosshairs make this a pain
- x = 320 + cg_crosshairX.integer - ( w / 2 );
- y = 240 + cg_crosshairY.integer - ( h / 2 );
+ //FIXME: this still ignores the width/height of the rect, but at least it's
+ //neater than cg_crosshairX/cg_crosshairY
+ x = rect->x + ( rect->w / 2 ) - ( w / 2 );
+ y = rect->y + ( rect->h / 2 ) - ( h / 2 );
hShader = wi->crossHair;
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 72a61fc2..6301919f 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -1444,8 +1444,6 @@ extern vmCvar_t cg_drawSnapshot;
extern vmCvar_t cg_drawChargeBar;
extern vmCvar_t cg_drawCrosshair;
extern vmCvar_t cg_drawCrosshairNames;
-extern vmCvar_t cg_crosshairX;
-extern vmCvar_t cg_crosshairY;
extern vmCvar_t cg_crosshairSize;
extern vmCvar_t cg_draw2D;
extern vmCvar_t cg_drawStatus;
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index 4abe55f1..7925b659 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -116,8 +116,6 @@ vmCvar_t cg_drawSnapshot;
vmCvar_t cg_drawChargeBar;
vmCvar_t cg_drawCrosshair;
vmCvar_t cg_drawCrosshairNames;
-vmCvar_t cg_crosshairX;
-vmCvar_t cg_crosshairY;
vmCvar_t cg_crosshairSize;
vmCvar_t cg_draw2D;
vmCvar_t cg_drawStatus;
@@ -241,8 +239,6 @@ static cvarTable_t cvarTable[ ] =
{ &cg_drawChargeBar, "cg_drawChargeBar", "1", CVAR_ARCHIVE },
{ &cg_drawCrosshair, "cg_drawCrosshair", "1", CVAR_ARCHIVE },
{ &cg_drawCrosshairNames, "cg_drawCrosshairNames", "1", CVAR_ARCHIVE },
- { &cg_crosshairX, "cg_crosshairX", "0", CVAR_ARCHIVE },
- { &cg_crosshairY, "cg_crosshairY", "0", CVAR_ARCHIVE },
{ &cg_crosshairSize, "cg_crosshairSize", "1", CVAR_ARCHIVE },
{ &cg_brassTime, "cg_brassTime", "2500", CVAR_ARCHIVE },
{ &cg_addMarks, "cg_marks", "1", CVAR_ARCHIVE },
diff --git a/ui/tremulous_common_hud.h b/ui/tremulous_common_hud.h
index e9ddf06c..acdf5120 100644
--- a/ui/tremulous_common_hud.h
+++ b/ui/tremulous_common_hud.h
@@ -185,6 +185,7 @@ itemDef
name "crosshair"
visible MENU_TRUE
decoration
+ rect 320 240 0 0
forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B .35
ownerdraw CG_PLAYER_CROSSHAIR
}