From 09be698c71c8cbfea128f1c7cbb069fb9590bd96 Mon Sep 17 00:00:00 2001 From: squeek Date: Fri, 3 Jan 2014 23:55:47 +0000 Subject: [PATCH] Fixed trimping not working with cl_jumpqueue 0 when holding jump continuously (from initial jump to touching the ramp) --- mp/src/game/shared/ff/ff_sh_gamemovement.cpp | 28 +++++++++++++------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/mp/src/game/shared/ff/ff_sh_gamemovement.cpp b/mp/src/game/shared/ff/ff_sh_gamemovement.cpp index bec44181..2eeac5d9 100644 --- a/mp/src/game/shared/ff/ff_sh_gamemovement.cpp +++ b/mp/src/game/shared/ff/ff_sh_gamemovement.cpp @@ -203,33 +203,43 @@ bool CFF_SH_GameMovement::CanJump( void ) return false; } + + bool bUseJumpQueue; +#ifdef CLIENT_DLL + bUseJumpQueue = cl_jumpqueue.GetBool(); +#else + bUseJumpQueue = (Q_atoi( engine->GetClientConVarValue( player->entindex(), "cl_jumpqueue" ) ) ) != 0; +#endif // No more effect if (player->GetGroundEntity() == NULL) { // FF --> Allow holding jump in the air to make you jump when you land - if(!(mv->m_nOldButtons & IN_JUMP)) + if( bUseJumpQueue && !(mv->m_nOldButtons & IN_JUMP) ) { // FF Port Note: For only allowing holding jump while in the downward part of a jump, do a (mv->m_vecVelocity[2] < 0.0f) check here + // Jump wasn't held last frame, so act like jump isn't held for the rest of the airtime + // FF TODO: Potentially add a jump-specific button-held-state variable to handle jump queueing, since manipulating the button states directly is rather hacky mv->m_nButtons &= ~IN_JUMP; } + else if (!bUseJumpQueue) + { + // act like the jump key was never held last frame; this is needed because of how the trimping code interacts with the rampslide code + mv->m_nOldButtons &= ~IN_JUMP; + } // FF <-- return false; // in air, so no effect } - + // Don't allow jumping when the player is in a stasis field. #ifndef HL2_EPISODIC if ( player->m_Local.m_bSlowMovement ) return false; #endif - -#ifdef CLIENT_DLL - if ( mv->m_nOldButtons & IN_JUMP && cl_jumpqueue.GetBool() ) + + // If jump queue is enabled and we have been holding jump since we last jumped, then don't allow jumping again until it's been released for at least one frame + if ( bUseJumpQueue && mv->m_nOldButtons & IN_JUMP ) return false; // don't pogo stick -#else - if ( mv->m_nOldButtons & IN_JUMP && (Q_atoi( engine->GetClientConVarValue( player->entindex(), "cl_jumpqueue" ) ) ) ) - return false; // don't pogo stick -#endif return true; }