summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2006-06-18 14:57:08 +0000
committerTim Angus <tim@ngus.net>2006-06-18 14:57:08 +0000
commit60d41da2ac6e9c9965e73963522a90aa62863b5d (patch)
tree97b01cfaf0ab32853a1060aca070603bcf8a52f0 /src/cgame
parent579672760092292b7a9752899010ffa4ac6faf6f (diff)
* Move Mass Driver zoom control to secondary attack
* Remove +zoom and -zoom altogether
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_consolecmds.c2
-rw-r--r--src/cgame/cg_local.h2
-rw-r--r--src/cgame/cg_tutorial.c3
-rw-r--r--src/cgame/cg_view.c59
4 files changed, 31 insertions, 35 deletions
diff --git a/src/cgame/cg_consolecmds.c b/src/cgame/cg_consolecmds.c
index 44b135bb..68aab6c1 100644
--- a/src/cgame/cg_consolecmds.c
+++ b/src/cgame/cg_consolecmds.c
@@ -208,8 +208,6 @@ static consoleCommand_t commands[ ] =
{ "-scores", CG_ScoresUp_f },
{ "scoresUp", CG_scrollScoresUp_f },
{ "scoresDown", CG_scrollScoresDown_f },
- { "+zoom", CG_ZoomDown_f },
- { "-zoom", CG_ZoomUp_f },
{ "sizeup", CG_SizeUp_f },
{ "sizedown", CG_SizeDown_f },
{ "weapnext", CG_NextWeapon_f },
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 320e060d..7beadaac 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -1537,8 +1537,6 @@ void CG_TestModelNextFrame_f( void );
void CG_TestModelPrevFrame_f( void );
void CG_TestModelNextSkin_f( void );
void CG_TestModelPrevSkin_f( void );
-void CG_ZoomDown_f( void );
-void CG_ZoomUp_f( void );
void CG_AddBufferedSound( sfxHandle_t sfx );
void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demoPlayback );
diff --git a/src/cgame/cg_tutorial.c b/src/cgame/cg_tutorial.c
index 91df7864..1499daef 100644
--- a/src/cgame/cg_tutorial.c
+++ b/src/cgame/cg_tutorial.c
@@ -38,7 +38,6 @@ static bind_t bindings[ ] =
{ "boost", "Sprint", { -1, -1 } },
{ "+moveup", "Jump", { -1, -1 } },
{ "+movedown", "Crouch", { -1, -1 } },
- { "+zoom", "ZoomView", { -1, -1 } },
{ "+attack", "Primary Attack", { -1, -1 } },
{ "+button5", "Secondary Attack", { -1, -1 } },
{ "reload", "Reload", { -1, -1 } },
@@ -428,7 +427,7 @@ static void CG_HumanText( char *text, playerState_t *ps )
Q_strcat( text, MAX_TUTORIAL_TEXT,
va( "Hold %s to zoom\n",
- CG_KeyNameForCommand( "+zoom" ) ) );
+ CG_KeyNameForCommand( "+button5" ) ) );
break;
case WP_PAIN_SAW:
diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c
index 9fc2a145..8fc92b03 100644
--- a/src/cgame/cg_view.c
+++ b/src/cgame/cg_view.c
@@ -695,25 +695,6 @@ static void CG_OffsetFirstPersonView( void )
//======================================================================
-void CG_ZoomDown_f( void )
-{
- if( cg.zoomed )
- return;
-
- cg.zoomed = qtrue;
- cg.zoomTime = cg.time;
-}
-
-void CG_ZoomUp_f( void )
-{
- if( !cg.zoomed )
- return;
-
- cg.zoomed = qfalse;
- cg.zoomTime = cg.time;
-}
-
-
/*
====================
CG_CalcFov
@@ -728,15 +709,20 @@ Fixed fov at intermissions, otherwise account for fov variable and zooms.
static int CG_CalcFov( void )
{
- float x;
- float phase;
- float v;
- int contents;
- float fov_x, fov_y;
- float zoomFov;
- float f;
- int inwater;
- int attribFov;
+ float x;
+ float phase;
+ float v;
+ int contents;
+ float fov_x, fov_y;
+ float zoomFov;
+ float f;
+ int inwater;
+ int attribFov;
+ usercmd_t cmd;
+ int cmdNum;
+
+ cmdNum = trap_GetCurrentCmdNumber( );
+ trap_GetUserCmd( cmdNum, &cmd );
if( cg.predictedPlayerState.pm_type == PM_INTERMISSION ||
( cg.snap->ps.persistant[ PERS_TEAM ] == TEAM_SPECTATOR ) )
@@ -775,7 +761,8 @@ static int CG_CalcFov( void )
else if ( zoomFov > attribFov )
zoomFov = attribFov;
- //TA: only do all the zoom stuff if the client CAN zoom
+ // only do all the zoom stuff if the client CAN zoom
+ // FIXME: zoom control is currently hard coded to BUTTON_ATTACK2
if( BG_WeaponCanZoom( cg.predictedPlayerState.weapon ) )
{
if ( cg.zoomed )
@@ -786,6 +773,13 @@ static int CG_CalcFov( void )
fov_x = zoomFov;
else
fov_x = fov_x + f * ( zoomFov - fov_x );
+
+ // BUTTON_ATTACK2 isn't held so unzoom next time
+ if( !( cmd.buttons & BUTTON_ATTACK2 ) )
+ {
+ cg.zoomed = qfalse;
+ cg.zoomTime = cg.time;
+ }
}
else
{
@@ -795,6 +789,13 @@ static int CG_CalcFov( void )
fov_x = fov_x;
else
fov_x = zoomFov + f * ( fov_x - zoomFov );
+
+ // BUTTON_ATTACK2 is held so zoom next time
+ if( cmd.buttons & BUTTON_ATTACK2 )
+ {
+ cg.zoomed = qtrue;
+ cg.zoomTime = cg.time;
+ }
}
}
}