summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_event.c2
-rw-r--r--src/cgame/cg_local.h3
-rw-r--r--src/cgame/cg_view.c19
3 files changed, 17 insertions, 7 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index e586777b..45ce026c 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -568,7 +568,7 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
VectorNormalize( rotAxis );
//add the op
- CG_addSmoothOp( rotAxis, 15.0f );
+ CG_addSmoothOp( rotAxis, 15.0f, 1.0f );
}
//copy the current normal to the lastNormal
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index c987dd56..1f1fe409 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -389,6 +389,7 @@ typedef struct
typedef struct
{
float time;
+ float timeMod;
vec3_t rotAxis;
float rotAngle;
@@ -1468,7 +1469,7 @@ void CG_BuildSpectatorString( );
//
// cg_view.c
//
-void CG_addSmoothOp( vec3_t rotAxis, float rotAngle ); //TA
+void CG_addSmoothOp( vec3_t rotAxis, float rotAngle, float timeMod ); //TA
void CG_TestModel_f( void );
void CG_TestGun_f( void );
void CG_TestModelNextFrame_f( void );
diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c
index 9a5b8aaf..29b55d71 100644
--- a/src/cgame/cg_view.c
+++ b/src/cgame/cg_view.c
@@ -913,7 +913,7 @@ static void CG_DrawSurfNormal( void )
CG_addSmoothOp
===============
*/
-void CG_addSmoothOp( vec3_t rotAxis, float rotAngle )
+void CG_addSmoothOp( vec3_t rotAxis, float rotAngle, float timeMod )
{
int i;
@@ -927,6 +927,7 @@ void CG_addSmoothOp( vec3_t rotAxis, float rotAngle )
VectorCopy( rotAxis, cg.sList[ i ].rotAxis );
cg.sList[ i ].rotAngle = rotAngle;
cg.sList[ i ].time = cg.time;
+ cg.sList[ i ].timeMod = timeMod;
return;
}
}
@@ -946,6 +947,7 @@ static void CG_smoothWWTransitions( playerState_t *ps, const vec3_t in, vec3_t o
vec3_t ceilingNormal = { 0.0f, 0.0f, -1.0f };
int i;
float stLocal, sFraction, rotAngle;
+ float smoothTime, timeMod;
qboolean performed = qfalse;
vec3_t inAxis[ 3 ], lastAxis[ 3 ], outAxis[ 3 ];
@@ -965,8 +967,11 @@ static void CG_smoothWWTransitions( playerState_t *ps, const vec3_t in, vec3_t o
if( VectorCompare( ceilingNormal, cg.lastNormal ) &&
VectorCompare( refNormal, surfNormal ) )
{
- AngleVectors( in, NULL, rotAxis, NULL );
+ AngleVectors( in, temp, NULL, NULL );
+ ProjectPointOnPlane( rotAxis, temp, refNormal );
+ VectorNormalize( rotAxis );
rotAngle = 180.0f;
+ timeMod = 1.5f;
}
else
{
@@ -985,19 +990,23 @@ static void CG_smoothWWTransitions( playerState_t *ps, const vec3_t in, vec3_t o
VectorAdd( rotAxis, temp, rotAxis );
VectorNormalize( rotAxis );
+
+ timeMod = 1.0f;
}
//add the op
- CG_addSmoothOp( rotAxis, rotAngle );
+ CG_addSmoothOp( rotAxis, rotAngle, timeMod );
}
//iterate through ops
for( i = MAXSMOOTHS - 1; i >= 0; i-- )
{
+ smoothTime = (int)( cg_wwSmoothTime.integer * cg.sList[ i ].timeMod );
+
//if this op has time remaining, perform it
- if( cg.time < cg.sList[ i ].time + cg_wwSmoothTime.integer )
+ if( cg.time < cg.sList[ i ].time + smoothTime )
{
- stLocal = 1.0f - ( ( ( cg.sList[ i ].time + cg_wwSmoothTime.integer ) - cg.time ) / cg_wwSmoothTime.integer );
+ stLocal = 1.0f - ( ( ( cg.sList[ i ].time + smoothTime ) - cg.time ) / smoothTime );
sFraction = -( cos( stLocal * M_PI ) + 1.0f ) / 2.0f;
RotatePointAroundVector( outAxis[ 0 ], cg.sList[ i ].rotAxis,