void CHLPlayerMove::FinishMove( CBasePlayer *player, CUserCmd *ucmd, CMoveData *move ) { // Call the default FinishMove code. BaseClass::FinishMove( player, ucmd, move ); IServerVehicle *pVehicle = player->GetVehicle(); if (pVehicle && gpGlobals->frametime != 0) { pVehicle->FinishMove( player, ucmd, move ); } }
void CHLPlayerMove::FinishMove( CBasePlayer *player, CUserCmd *ucmd, CMoveData *move ) { // Call the default FinishMove code. BaseClass::FinishMove( player, ucmd, move ); if ( gpGlobals->frametime != 0 ) { float distance = 0.0f; IServerVehicle *pVehicle = player->GetVehicle(); if ( pVehicle ) { pVehicle->FinishMove( player, ucmd, move ); IPhysicsObject *obj = player->GetVehicleEntity()->VPhysicsGetObject(); if ( obj ) { Vector newPos; obj->GetPosition( &newPos, NULL ); distance = VectorLength( newPos - m_vecSaveOrigin ); if ( m_vecSaveOrigin == vec3_origin || distance > 100.0f ) distance = 0.0f; m_vecSaveOrigin = newPos; } CPropVehicleDriveable *driveable = dynamic_cast< CPropVehicleDriveable * >( player->GetVehicleEntity() ); if ( driveable ) { // Overturned and at rest (if still moving it can fix itself) bool bFlipped = driveable->IsOverturned() && ( distance < 0.5f ); if ( m_bVehicleFlipped != bFlipped ) { if ( bFlipped ) { gamestats->Event_FlippedVehicle( player, driveable ); } m_bVehicleFlipped = bFlipped; } } else { m_bVehicleFlipped = false; } } else { m_bVehicleFlipped = false; distance = VectorLength( player->GetAbsOrigin() - m_vecSaveOrigin ); } if ( distance > 0 ) { gamestats->Event_PlayerTraveled( player, distance, pVehicle ? true : false, !pVehicle && static_cast< CHL2_Player * >( player )->IsSprinting() ); } } bool bGodMode = ( player->GetFlags() & FL_GODMODE ) ? true : false; if ( m_bInGodMode != bGodMode ) { m_bInGodMode = bGodMode; if ( bGodMode ) { gamestats->Event_PlayerEnteredGodMode( player ); } } bool bNoClip = ( player->GetMoveType() == MOVETYPE_NOCLIP ); if ( m_bInNoClip != bNoClip ) { m_bInNoClip = bNoClip; if ( bNoClip ) { gamestats->Event_PlayerEnteredNoClip( player ); } } }