Edgebug for L4D2 on C++ | .cpp file

niggaOct 10th, 2026edited 1 hour agoNever expires Public60 views
edgebug l4d2Scripts
C++1.54 KB | 61 lines
void CGameMovement::AddGravity( void )
{
    float ent_gravity;

    if ( player->m_flWaterJumpTime )
        return;

    if (player->GetGravity())
        ent_gravity = player->GetGravity();
    else
        ent_gravity = 1.0;

    // Add gravity incorrectly
    mv->m_vecVelocity[2] -= (ent_gravity * GetCurrentGravity() * gpGlobals->frametime);
    mv->m_vecVelocity[2] += player->GetBaseVelocity()[2] * gpGlobals->frametime;
    Vector temp = player->GetBaseVelocity();
    temp[2] = 0;
    player->SetBaseVelocity( temp );
    
    CheckVelocity();
}

void CGameMovement::StartGravity( void )
{
    float ent_gravity;
    
    if (player->GetGravity())
        ent_gravity = player->GetGravity();
    else
        ent_gravity = 1.0;

    // Add gravity so they'll be in the correct position during movement
    // yes, this 0.5 looks wrong, but it's not.  
    mv->m_vecVelocity[2] -= (ent_gravity * GetCurrentGravity() * 0.5 * gpGlobals->frametime );
    mv->m_vecVelocity[2] += player->GetBaseVelocity()[2] * gpGlobals->frametime;

    Vector temp = player->GetBaseVelocity();
    temp[ 2 ] = 0;
    player->SetBaseVelocity( temp );

    CheckVelocity();
}


void CGameMovement::FinishGravity( void )
{
    float ent_gravity;

    if ( player->m_flWaterJumpTime )
        return;

    if ( player->GetGravity() )
        ent_gravity = player->GetGravity();
    else
        ent_gravity = 1.0;

    // Get the correct velocity for the end of the dt
      mv->m_vecVelocity[2] -= (ent_gravity * GetCurrentGravity() * gpGlobals->frametime * 0.5);

    CheckVelocity();
}