summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTony J. White <tjw@tjw.org>2007-04-12 17:03:14 +0000
committerTony J. White <tjw@tjw.org>2007-04-12 17:03:14 +0000
commit62a42bbf49500ef0f253e624a2ccc2423b97a61b (patch)
tree392cab67e5066dec39cb6ce316a3c91a0566bd95 /src
parent988e4b435bb8666afb18fadc7dfa472b1332c93b (diff)
* cg_drawCrosshair now has 3 settings:
0 - always off 1 - for long range weapons only (1.1.0 behaviour and also the new default) 2 - always on (if the weapon.cfg has one defined of course) * cg_drawCrosshair 0 no longer prevents crosshair names from drawing * added cg_drawCrosshair configuration in the ingame Options -> Game menu
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_draw.c11
-rw-r--r--src/cgame/cg_local.h6
-rw-r--r--src/cgame/cg_main.c2
-rw-r--r--src/game/bg_misc.c47
-rw-r--r--src/game/bg_public.h2
5 files changed, 63 insertions, 5 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index 89740c7c..82df413a 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -2464,9 +2464,15 @@ static void CG_DrawCrosshair( void )
float x, y;
weaponInfo_t *wi;
- if( !cg_drawCrosshair.integer )
+ if( cg_drawCrosshair.integer == CROSSHAIR_ALWAYSOFF )
return;
+ if( cg_drawCrosshair.integer == CROSSHAIR_RANGEDONLY &&
+ !BG_FindLongRangedForWeapon( cg.snap->ps.weapon ) )
+ {
+ return;
+ }
+
if( ( cg.snap->ps.persistant[ PERS_TEAM ] == TEAM_SPECTATOR ) ||
( cg.snap->ps.stats[ STAT_STATE ] & SS_INFESTING ) ||
( cg.snap->ps.stats[ STAT_STATE ] & SS_HOVELING ) )
@@ -2547,9 +2553,6 @@ static void CG_DrawCrosshairNames( rectDef_t *rect, float scale, int textStyle )
char *name;
float w, x;
- if( !cg_drawCrosshair.integer )
- return;
-
if( !cg_drawCrosshairNames.integer )
return;
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 1f0fa005..05cbcbdf 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -2063,3 +2063,9 @@ qboolean trap_GetEntityToken( char *buffer, int bufferSize );
int trap_GetDemoState( void );
int trap_GetDemoPos( void );
void trap_GetDemoName( char *buffer, int size );
+
+// cg_drawCrosshair settings
+#define CROSSHAIR_ALWAYSOFF 0
+#define CROSSHAIR_RANGEDONLY 1
+#define CROSSHAIR_ALWAYSON 2
+
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index 8d5929b5..1797b972 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -271,7 +271,7 @@ static cvarTable_t cvarTable[ ] =
{ &cg_drawIcons, "cg_drawIcons", "1", CVAR_ARCHIVE },
{ &cg_drawAmmoWarning, "cg_drawAmmoWarning", "1", CVAR_ARCHIVE },
{ &cg_drawAttacker, "cg_drawAttacker", "1", CVAR_ARCHIVE },
- { &cg_drawCrosshair, "cg_drawCrosshair", "4", CVAR_ARCHIVE },
+ { &cg_drawCrosshair, "cg_drawCrosshair", "1", CVAR_ARCHIVE },
{ &cg_drawCrosshairNames, "cg_drawCrosshairNames", "1", CVAR_ARCHIVE },
{ &cg_drawRewards, "cg_drawRewards", "1", CVAR_ARCHIVE },
{ &cg_crosshairX, "cg_crosshairX", "0", CVAR_ARCHIVE },
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index 1bc9333d..58e9fbdc 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -3054,6 +3054,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qfalse, //qboolean purchasable;
+ qtrue, //qboolean longRanged;
0, //int buildDelay;
WUT_HUMANS //WUTeam_t team;
},
@@ -3078,6 +3079,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qtrue, //qboolean purchasable;
+ qtrue, //qboolean longRanged;
0, //int buildDelay;
WUT_HUMANS //WUTeam_t team;
},
@@ -3102,6 +3104,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qtrue, //qboolean purchasable;
+ qtrue, //qboolean longRanged;
0, //int buildDelay;
WUT_HUMANS //WUTeam_t team;
},
@@ -3126,6 +3129,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qtrue, //qboolean purchasable;
+ qtrue, //qboolean longRanged;
0, //int buildDelay;
WUT_HUMANS //WUTeam_t team;
},
@@ -3150,6 +3154,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qtrue, //qboolean purchasable;
+ qtrue, //qboolean longRanged;
0, //int buildDelay;
WUT_HUMANS //WUTeam_t team;
},
@@ -3174,6 +3179,7 @@ weaponAttributes_t bg_weapons[ ] =
qtrue, //qboolean canZoom;
20.0f, //float zoomFov;
qtrue, //qboolean purchasable;
+ qtrue, //qboolean longRanged;
0, //int buildDelay;
WUT_HUMANS //WUTeam_t team;
},
@@ -3198,6 +3204,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qtrue, //qboolean purchasable;
+ qtrue, //qboolean longRanged;
0, //int buildDelay;
WUT_HUMANS //WUTeam_t team;
},
@@ -3222,6 +3229,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qtrue, //qboolean purchasable;
+ qtrue, //qboolean longRanged;
0, //int buildDelay;
WUT_HUMANS //WUTeam_t team;
},
@@ -3246,6 +3254,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qtrue, //qboolean purchasable;
+ qtrue, //qboolean longRanged;
0, //int buildDelay;
WUT_HUMANS //WUTeam_t team;
},
@@ -3270,6 +3279,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qtrue, //qboolean purchasable;
+ qfalse, //qboolean longRanged;
0, //int buildDelay;
WUT_HUMANS //WUTeam_t team;
},
@@ -3294,6 +3304,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qfalse, //qboolean purchasable;
+ qfalse, //qboolean longRanged;
0, //int buildDelay;
WUT_HUMANS //WUTeam_t team;
},
@@ -3318,6 +3329,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qtrue, //qboolean purchasable;
+ qfalse, //qboolean longRanged;
HBUILD_DELAY, //int buildDelay;
WUT_HUMANS //WUTeam_t team;
},
@@ -3342,6 +3354,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qtrue, //qboolean purchasable;
+ qfalse, //qboolean longRanged;
HBUILD2_DELAY, //int buildDelay;
WUT_HUMANS //WUTeam_t team;
},
@@ -3366,6 +3379,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qtrue, //qboolean purchasable;
+ qfalse, //qboolean longRanged;
ABUILDER_BASE_DELAY, //int buildDelay;
WUT_ALIENS //WUTeam_t team;
},
@@ -3390,6 +3404,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qtrue, //qboolean purchasable;
+ qfalse, //qboolean longRanged;
ABUILDER_ADV_DELAY, //int buildDelay;
WUT_ALIENS //WUTeam_t team;
},
@@ -3414,6 +3429,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qfalse, //qboolean purchasable;
+ qfalse, //qboolean longRanged;
0, //int buildDelay;
WUT_ALIENS //WUTeam_t team;
},
@@ -3438,6 +3454,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qfalse, //qboolean purchasable;
+ qfalse, //qboolean longRanged;
0, //int buildDelay;
WUT_ALIENS //WUTeam_t team;
},
@@ -3462,6 +3479,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qfalse, //qboolean purchasable;
+ qtrue, //qboolean longRanged;
0, //int buildDelay;
WUT_ALIENS //WUTeam_t team;
},
@@ -3486,6 +3504,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qfalse, //qboolean purchasable;
+ qfalse, //qboolean longRanged;
0, //int buildDelay;
WUT_ALIENS //WUTeam_t team;
},
@@ -3510,6 +3529,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qfalse, //qboolean purchasable;
+ qfalse, //qboolean longRanged;
0, //int buildDelay;
WUT_ALIENS //WUTeam_t team;
},
@@ -3534,6 +3554,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qfalse, //qboolean purchasable;
+ qfalse, //qboolean longRanged;
0, //int buildDelay;
WUT_ALIENS //WUTeam_t team;
},
@@ -3558,6 +3579,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qfalse, //qboolean purchasable;
+ qtrue, //qboolean longRanged;
0, //int buildDelay;
WUT_ALIENS //WUTeam_t team;
},
@@ -3582,6 +3604,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qfalse, //qboolean purchasable;
+ qfalse, //qboolean longRanged;
0, //int buildDelay;
WUT_ALIENS //WUTeam_t team;
},
@@ -3606,6 +3629,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qfalse, //qboolean purchasable;
+ qfalse, //qboolean longRanged;
0, //int buildDelay;
WUT_ALIENS //WUTeam_t team;
},
@@ -3630,6 +3654,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qfalse, //qboolean purchasable;
+ qfalse, //qboolean longRanged;
0, //int buildDelay;
WUT_ALIENS //WUTeam_t team;
},
@@ -3654,6 +3679,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qfalse, //qboolean purchasable;
+ qfalse, //qboolean longRanged;
0, //int buildDelay;
WUT_HUMANS //WUTeam_t team;
},
@@ -3678,6 +3704,7 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qfalse, //qboolean purchasable;
+ qfalse, //qboolean longRanged;
0, //int buildDelay;
WUT_HUMANS //WUTeam_t team;
}
@@ -4065,6 +4092,26 @@ qboolean BG_FindPurchasableForWeapon( int weapon )
/*
==============
+BG_FindLongRangeForWeapon
+==============
+*/
+qboolean BG_FindLongRangedForWeapon( int weapon )
+{
+ int i;
+
+ for( i = 0; i < bg_numWeapons; i++ )
+ {
+ if( bg_weapons[ i ].weaponNum == weapon )
+ {
+ return bg_weapons[ i ].longRanged;
+ }
+ }
+
+ return qfalse;
+}
+
+/*
+==============
BG_FindBuildDelayForWeapon
==============
*/
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index 0cc12e8f..bad2ffa4 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -1072,6 +1072,7 @@ typedef struct
float zoomFov;
qboolean purchasable;
+ qboolean longRanged;
int buildDelay;
@@ -1215,6 +1216,7 @@ qboolean BG_WeaponHasThirdMode( int weapon );
qboolean BG_WeaponCanZoom( int weapon );
float BG_FindZoomFovForWeapon( int weapon );
qboolean BG_FindPurchasableForWeapon( int weapon );
+qboolean BG_FindLongRangedForWeapon( int weapon );
int BG_FindBuildDelayForWeapon( int weapon );
WUTeam_t BG_FindTeamForWeapon( int weapon );