void CASW_Drone_Movement::ProcessMovement( CAI_BaseNPC *pNPC, CMoveData *pMove, float flInterval) { Assert( pMove && pNPC ); m_pNPC = pNPC; mv = pMove; m_flInterval = flInterval; mv->m_outWishVel.Init(); mv->m_outJumpVel.Init(); Vector start = pMove->GetAbsOrigin(); CategorizePosition(); StartGravity(); WalkMove(); FinishGravity(); // pushes him down by gravity CategorizePosition(); }
void CMomentumGameMovement::FullWalkMove() { if (!CheckWater()) { StartGravity(); } // If we are leaping out of the water, just update the counters. if (player->m_flWaterJumpTime) { WaterJump(); TryPlayerMove(); // See if we are still in water? CheckWater(); return; } // If we are swimming in the water, see if we are nudging against a place we can jump up out // of, and, if so, start out jump. Otherwise, if we are not moving up, then reset jump timer to 0 if (player->GetWaterLevel() >= WL_Waist) { if (player->GetWaterLevel() == WL_Waist) { CheckWaterJump(); } // If we are falling again, then we must not trying to jump out of water any more. if (mv->m_vecVelocity[2] < 0 && player->m_flWaterJumpTime) { player->m_flWaterJumpTime = 0; } // Was jump button pressed? if (mv->m_nButtons & IN_JUMP) { CheckJumpButton(); } else { mv->m_nOldButtons &= ~IN_JUMP; } // Perform regular water movement WaterMove(); // Redetermine position vars CategorizePosition(); // If we are on ground, no downward velocity. if (player->GetGroundEntity() != NULL) { mv->m_vecVelocity[2] = 0; } } else // Not fully underwater { // Was jump button pressed? if (mv->m_nButtons & IN_JUMP) { CheckJumpButton(); } else { mv->m_nOldButtons &= ~IN_JUMP; } // Fricion is handled before we add in any base velocity. That way, if we are on a conveyor, // we don't slow when standing still, relative to the conveyor. if (player->GetGroundEntity() != NULL) { mv->m_vecVelocity[2] = 0.0; Friction(); } // Make sure velocity is valid. CheckVelocity(); // By default assume we did the reflect for WalkMove() flReflectNormal = 1.0f; if (player->GetGroundEntity() != NULL) { WalkMove(); } else { AirMove(); // Take into account movement when in air. } // Set final flags. CategorizePosition(flReflectNormal); // Make sure velocity is valid. CheckVelocity(); // Add any remaining gravitational component. if (!CheckWater()) { FinishGravity(); } // If we are on ground, no downward velocity. if (player->GetGroundEntity() != NULL) { mv->m_vecVelocity[2] = 0; } CheckFalling(); } if ((m_nOldWaterLevel == WL_NotInWater && player->GetWaterLevel() != WL_NotInWater) || (m_nOldWaterLevel != WL_NotInWater && player->GetWaterLevel() == WL_NotInWater)) { PlaySwimSound(); #if !defined( CLIENT_DLL ) player->Splash(); #endif } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFGameMovement::FullWalkMove() { if ( !InWater() ) { StartGravity(); } // If we are leaping out of the water, just update the counters. if ( player->m_flWaterJumpTime ) { // Try to jump out of the water (and check to see if we still are). WaterJump(); TryPlayerMove(); CheckWater(); return; } // If we are swimming in the water, see if we are nudging against a place we can jump up out // of, and, if so, start out jump. Otherwise, if we are not moving up, then reset jump timer to 0 if ( InWater() ) { FullWalkMoveUnderwater(); return; } if (mv->m_nButtons & IN_JUMP) { CheckJumpButton(); } else { mv->m_nOldButtons &= ~IN_JUMP; } // Make sure velocity is valid. CheckVelocity(); if (player->GetGroundEntity() != NULL) { mv->m_vecVelocity[2] = 0.0; Friction(); WalkMove(); } else { AirMove(); } // Set final flags. CategorizePosition(); // Add any remaining gravitational component if we are not in water. if ( !InWater() ) { FinishGravity(); } // If we are on ground, no downward velocity. if ( player->GetGroundEntity() != NULL ) { mv->m_vecVelocity[2] = 0; } // Handling falling. CheckFalling(); // Make sure velocity is valid. CheckVelocity(); }