summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_event.c2
-rw-r--r--src/cgame/cg_local.h3
-rw-r--r--src/cgame/cg_view.c19
-rw-r--r--src/game/bg_misc.c8
-rw-r--r--src/game/bg_pmove.c34
5 files changed, 46 insertions, 20 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,
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index 413ab89f..de83ee5f 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -4656,14 +4656,10 @@ qboolean BG_rotateAxis( vec3_t surfNormal, vec3_t inAxis[ 3 ],
VectorNormalize( xNormal );
}
- //if we're a wall climber.. and we're climbing rotate the axis
+ //can't rotate with no rotation vector
if( VectorLength( xNormal ) != 0.0f )
{
- //if the normal pointing straight down then the rotAngle will always be 180deg
- if( surfNormal[ 2 ] == -1.0f )
- rotAngle = 180.0f;
- else
- rotAngle = RAD2DEG( acos( DotProduct( localNormal, refNormal ) ) );
+ rotAngle = RAD2DEG( acos( DotProduct( localNormal, refNormal ) ) );
if( inverse )
rotAngle = -rotAngle;
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c
index 77692398..fdfc1074 100644
--- a/src/game/bg_pmove.c
+++ b/src/game/bg_pmove.c
@@ -1962,6 +1962,19 @@ static void PM_GroundClimbTrace( void )
pml.walking = qfalse;
pm->ps->eFlags &= ~EF_WALLCLIMB;
+ //just transided from ceiling to floor... apply delta correction
+ if( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING )
+ {
+ vec3_t forward, rotated, angles;
+
+ AngleVectors( pm->ps->viewangles, forward, NULL, NULL );
+
+ RotatePointAroundVector( rotated, pm->ps->grapplePoint, forward, 180.0f );
+ vectoangles( rotated, angles );
+
+ pm->ps->delta_angles[ YAW ] -= ANGLE2SHORT( angles[ YAW ] - pm->ps->viewangles[ YAW ] );
+ }
+
pm->ps->stats[ STAT_STATE ] &= ~SS_WALLCLIMBINGCEILING;
//we get very bizarre effects if we don't do this :0
@@ -2024,8 +2037,21 @@ static void PM_GroundTrace( void )
PM_GroundClimbTrace( );
return;
}
- }
+ //just transided from ceiling to floor... apply delta correction
+ if( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING )
+ {
+ vec3_t forward, rotated, angles;
+
+ AngleVectors( pm->ps->viewangles, forward, NULL, NULL );
+
+ RotatePointAroundVector( rotated, pm->ps->grapplePoint, forward, 180.0f );
+ vectoangles( rotated, angles );
+
+ pm->ps->delta_angles[ YAW ] -= ANGLE2SHORT( angles[ YAW ] - pm->ps->viewangles[ YAW ] );
+ }
+ }
+
pm->ps->stats[ STAT_STATE ] &= ~SS_WALLCLIMBING;
pm->ps->stats[ STAT_STATE ] &= ~SS_WALLCLIMBINGCEILING;
pm->ps->eFlags &= ~EF_WALLCLIMB;
@@ -2035,12 +2061,6 @@ static void PM_GroundTrace( void )
point[ 2 ] = pm->ps->origin[ 2 ] - 0.25f;
pm->trace( &trace, pm->ps->origin, pm->mins, pm->maxs, point, pm->ps->clientNum, pm->tracemask );
-/* if( trace.fraction < 1.0f && VectorCompare( trace.plane.normal, vec3_origin ) )
- {
- Com_Printf( "\n%v %d\n", trace.plane.normal, trace.entityNum );
- Com_Printf( "%v %v\n", pm->ps->origin, point );
- Com_Printf( "%d %d\n", trace.allsolid, trace.startsolid );
- }*/
pml.groundTrace = trace;