diff options
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_draw.c | 12 | ||||
-rw-r--r-- | src/cgame/cg_event.c | 26 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 4 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 6 | ||||
-rw-r--r-- | src/cgame/cg_servercmds.c | 26 | ||||
-rw-r--r-- | src/cgame/cg_view.c | 65 |
6 files changed, 122 insertions, 17 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index d9aff288..56bec3df 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -2686,6 +2686,8 @@ static void CG_DrawCrosshairNames( void ) //============================================================================== +//FIXME: both vote notes are hardcoded, change to ownerdrawn? + /* ================= CG_DrawVote @@ -2712,10 +2714,8 @@ static void CG_DrawVote( void ) if( sec < 0 ) sec = 0; - s = va( "VOTE(%i):%s yes:%i no:%i", sec, cgs.voteString, cgs.voteYes, cgs.voteNo ); - CG_Text_Paint( 0, 58, 0.3f, white, s, 0, 0, ITEM_TEXTSTYLE_NORMAL ); - s = "or press ESC then click Vote"; - CG_Text_Paint( 0, 78, 0.3f, white, s, 0, 0, ITEM_TEXTSTYLE_NORMAL ); + s = va( "VOTE(%i): \"%s\" Yes:%i No:%i", sec, cgs.voteString, cgs.voteYes, cgs.voteNo ); + CG_Text_Paint( 8, 340, 0.3f, white, s, 0, 0, ITEM_TEXTSTYLE_NORMAL ); } /* @@ -2751,10 +2751,10 @@ static void CG_DrawTeamVote( void ) if( sec < 0 ) sec = 0; - s = va( "TEAMVOTE(%i):%s yes:%i no:%i", sec, cgs.teamVoteString[ cs_offset ], + s = va( "TEAMVOTE(%i): \"%s\" Yes:%i No:%i", sec, cgs.teamVoteString[ cs_offset ], cgs.teamVoteYes[cs_offset], cgs.teamVoteNo[ cs_offset ] ); - CG_Text_Paint( 0, 90, 0.3f, white, s, 0, 0, ITEM_TEXTSTYLE_NORMAL ); + CG_Text_Paint( 8, 360, 0.3f, white, s, 0, 0, ITEM_TEXTSTYLE_NORMAL ); } diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index abf9e821..4a5dcef6 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -536,6 +536,32 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) case EV_JUMP: DEBUGNAME( "EV_JUMP" ); trap_S_StartSound( NULL, es->number, CHAN_VOICE, CG_CustomSound( es->number, "*jump1.wav" ) ); + + if( BG_ClassHasAbility( cg.predictedPlayerState.stats[ STAT_PCLASS ], SCA_WALLJUMPER ) ) + { + vec3_t surfNormal, refNormal = { 0.0f, 0.0f, 1.0f }; + vec3_t rotAxis; + + if( clientNum != cg.predictedPlayerState.clientNum ) + break; + + //set surfNormal + VectorCopy( cg.predictedPlayerState.grapplePoint, surfNormal ); + + //if we are moving from one surface to another smooth the transition + if( !VectorCompare( surfNormal, cg.lastNormal ) && surfNormal[ 2 ] != 1.0f ) + { + CrossProduct( refNormal, surfNormal, rotAxis ); + VectorNormalize( rotAxis ); + + //add the op + CG_addSmoothOp( rotAxis, 15.0f ); + } + + //copy the current normal to the lastNormal + VectorCopy( surfNormal, cg.lastNormal ); + } + break; case EV_TAUNT: diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 39d13c03..16649ab2 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1416,6 +1416,9 @@ extern vmCvar_t ui_carriage; extern vmCvar_t ui_stages; extern vmCvar_t ui_dialog; extern vmCvar_t ui_loading; +extern vmCvar_t ui_voteActive; +extern vmCvar_t ui_alienTeamVoteActive; +extern vmCvar_t ui_humanTeamVoteActive; // // cg_main.c @@ -1444,6 +1447,7 @@ void CG_BuildSpectatorString( ); // // cg_view.c // +void CG_addSmoothOp( vec3_t rotAxis, float rotAngle ); //TA void CG_TestModel_f( void ); void CG_TestGun_f( void ); void CG_TestModelNextFrame_f( void ); diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 5163e16e..7a024f4c 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -205,6 +205,9 @@ vmCvar_t ui_carriage; vmCvar_t ui_stages; vmCvar_t ui_dialog; vmCvar_t ui_loading; +vmCvar_t ui_voteActive; +vmCvar_t ui_alienTeamVoteActive; +vmCvar_t ui_humanTeamVoteActive; typedef struct @@ -300,6 +303,9 @@ static cvarTable_t cvarTable[ ] = { &ui_stages, "ui_stages", "0 0", 0 }, { &ui_dialog, "ui_dialog", "Text not set", 0 }, { &ui_loading, "ui_loading", "0", 0 }, + { &ui_voteActive, "ui_voteActive", "0", 0 }, + { &ui_humanTeamVoteActive, "ui_humanTeamVoteActive", "0", 0 }, + { &ui_alienTeamVoteActive, "ui_alienTeamVoteActive", "0", 0 }, // the following variables are created in other parts of the system, // but we also reference them here diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index 2539660b..90e65139 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -291,6 +291,11 @@ static void CG_ConfigStringModified( void ) { cgs.voteTime = atoi( str ); cgs.voteModified = qtrue; + + if( cgs.voteTime ) + trap_Cvar_Set( "ui_voteActive", "1" ); + else + trap_Cvar_Set( "ui_voteActive", "0" ); } else if( num == CS_VOTE_YES ) { @@ -306,8 +311,25 @@ static void CG_ConfigStringModified( void ) Q_strncpyz( cgs.voteString, str, sizeof( cgs.voteString ) ); else if( num >= CS_TEAMVOTE_TIME && num <= CS_TEAMVOTE_TIME + 1 ) { - cgs.teamVoteTime[ num - CS_TEAMVOTE_TIME ] = atoi( str ); - cgs.teamVoteModified[ num - CS_TEAMVOTE_TIME ] = qtrue; + int cs_offset = num - CS_TEAMVOTE_TIME; + + cgs.teamVoteTime[ cs_offset ] = atoi( str ); + cgs.teamVoteModified[ cs_offset ] = qtrue; + + if( cs_offset == 0 ) + { + if( cgs.teamVoteTime[ cs_offset ] ) + trap_Cvar_Set( "ui_humanTeamVoteActive", "1" ); + else + trap_Cvar_Set( "ui_humanTeamVoteActive", "0" ); + } + else if( cs_offset == 1 ) + { + if( cgs.teamVoteTime[ cs_offset ] ) + trap_Cvar_Set( "ui_alienTeamVoteActive", "1" ); + else + trap_Cvar_Set( "ui_alienTeamVoteActive", "0" ); + } } else if( num >= CS_TEAMVOTE_YES && num <= CS_TEAMVOTE_YES + 1 ) { diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c index 9baf32d1..1099b7a5 100644 --- a/src/cgame/cg_view.c +++ b/src/cgame/cg_view.c @@ -907,7 +907,7 @@ static void CG_DrawSurfNormal( void ) CG_addSmoothOp =============== */ -static void CG_addSmoothOp( vec3_t rotAxis, float rotAngle ) +void CG_addSmoothOp( vec3_t rotAxis, float rotAngle ) { int i; @@ -991,8 +991,8 @@ static void CG_smoothWWTransitions( playerState_t *ps, const vec3_t in, vec3_t o //if this op has time remaining, perform it if( cg.time < cg.sList[ i ].time + cg_wwSmoothTime.integer ) { - stLocal = 1.0 - ( ( ( cg.sList[ i ].time + cg_wwSmoothTime.integer ) - cg.time ) / cg_wwSmoothTime.integer ); - sFraction = -( cos( stLocal * M_PI ) + 1 ) / 2; + stLocal = 1.0f - ( ( ( cg.sList[ i ].time + cg_wwSmoothTime.integer ) - cg.time ) / cg_wwSmoothTime.integer ); + sFraction = -( cos( stLocal * M_PI ) + 1.0f ) / 2.0f; RotatePointAroundVector( outAxis[ 0 ], cg.sList[ i ].rotAxis, inAxis[ 0 ], sFraction * cg.sList[ i ].rotAngle ); @@ -1020,6 +1020,50 @@ static void CG_smoothWWTransitions( playerState_t *ps, const vec3_t in, vec3_t o /* =============== +CG_smoothWJTransitions +=============== +*/ +static void CG_smoothWJTransitions( playerState_t *ps, const vec3_t in, vec3_t out ) +{ + int i; + float stLocal, sFraction; + qboolean performed = qfalse; + vec3_t inAxis[ 3 ], outAxis[ 3 ]; + + AnglesToAxis( in, inAxis ); + + //iterate through ops + for( i = MAXSMOOTHS - 1; i >= 0; i-- ) + { + //if this op has time remaining, perform it + if( cg.time < cg.sList[ i ].time + cg_wwSmoothTime.integer ) + { + stLocal = ( ( cg.sList[ i ].time + cg_wwSmoothTime.integer ) - cg.time ) / cg_wwSmoothTime.integer; + sFraction = 1.0f - ( ( cos( stLocal * M_PI * 2.0f ) + 1.0f ) / 2.0f ); + + RotatePointAroundVector( outAxis[ 0 ], cg.sList[ i ].rotAxis, + inAxis[ 0 ], sFraction * cg.sList[ i ].rotAngle ); + RotatePointAroundVector( outAxis[ 1 ], cg.sList[ i ].rotAxis, + inAxis[ 1 ], sFraction * cg.sList[ i ].rotAngle ); + RotatePointAroundVector( outAxis[ 2 ], cg.sList[ i ].rotAxis, + inAxis[ 2 ], sFraction * cg.sList[ i ].rotAngle ); + + AxisCopy( outAxis, inAxis ); + performed = qtrue; + } + } + + //if we performed any ops then return the smoothed angles + //otherwise simply return the in angles + if( performed ) + AxisToAngles( outAxis, out ); + else + VectorCopy( in, out ); +} + + +/* +=============== CG_CalcViewValues Sets cg.refdef view values @@ -1031,10 +1075,6 @@ static int CG_CalcViewValues( void ) memset( &cg.refdef, 0, sizeof( cg.refdef ) ); - // strings for in game rendering - // Q_strncpyz( cg.refdef.text[0], "Park Ranger", sizeof(cg.refdef.text[0]) ); - // Q_strncpyz( cg.refdef.text[1], "19", sizeof(cg.refdef.text[1]) ); - // calculate size of 3D view CG_CalcVrect( ); @@ -1059,11 +1099,18 @@ static int CG_CalcViewValues( void ) if( BG_ClassHasAbility( ps->stats[ STAT_PCLASS ], SCA_WALLCLIMBER ) ) CG_smoothWWTransitions( ps, ps->viewangles, cg.refdefViewAngles ); + else if( BG_ClassHasAbility( ps->stats[ STAT_PCLASS ], SCA_WALLJUMPER ) ) + CG_smoothWJTransitions( ps, ps->viewangles, cg.refdefViewAngles ); else VectorCopy( ps->viewangles, cg.refdefViewAngles ); - if( !( ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) ) - VectorSet( cg.lastNormal, 0.0f, 0.0f, 1.0f ); + //clumsy logic, but it needs to be this way round because the CS propogation + //delay screws things up otherwise + if( !BG_ClassHasAbility( ps->stats[ STAT_PCLASS ], SCA_WALLJUMPER ) ) + { + if( !( ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) ) + VectorSet( cg.lastNormal, 0.0f, 0.0f, 1.0f ); + } // add error decay if( cg_errorDecay.value > 0 ) |