Read Only
- Статус
- Оффлайн
- Регистрация
- 16 Май 2025
- Сообщения
- 244
- Реакции
- 51
c_move::air_strafe:
/* tbh dont forgot to add in ur create_move stuff to clear sub_tick_movies */
void c_move::air_strafe( valve::base_user_cmd_t& cmd )
{
if ( !g_menu->main( ).m_move.m_air_strafe.get( )
|| g_local_player->pawn( )->flags( ) & valve::e_ent_flags::on_ground )
return;
const auto move_services = g_local_player->pawn( )->movement_services( );
if ( !move_services )
return;
auto& abs_velocity = g_local_player->pawn( )->abs_velocity( );
const auto speed = abs_velocity.length( 2u );
const auto friction = move_services->surface_friction( );
const auto ticks = std::clamp( 12 - cmd.m_sub_tick_moves.size( ), 0, 12 );
const auto frame_time = valve::k_interval_per_tick / static_cast< float >( ticks );
auto move = move_services->last_movement_impulses( );
const auto last_move = cmd.m_move;
/* iterate all possible ticks for that shit */
for ( int i{}; i < ticks; ++i )
{
cmd.m_move = last_move;
/* predict next velocity via air_move */
abs_velocity.z( ) -= ( g_ctx->cvars( ).sv_gravity->get_float( ) * frame_time ) * 0.5f;
g_game_movement->air_accelerate( abs_velocity, friction, move, frame_time );
abs_velocity.z( ) += ( g_ctx->cvars( ).sv_gravity->get_float( ) * frame_time );
if ( const auto& sub_tick = valve::g_input->create_sub_tick( ); sub_tick )
{
sub_tick->m_when = ( static_cast< float >( i ) / static_cast< float >( ticks ) );
sub_tick->m_move.x( ) = ( cmd.m_move.x( ) - last_move.x( ) );
sub_tick->m_move.y( ) = ( cmd.m_move.y( ) - last_move.y( ) );
move.x( ) += sub_tick->m_move.x( );
move.y( ) += sub_tick->m_move.y( );
cmd.m_sub_tick_moves->add( sub_tick );
}
}
}
Последнее редактирование: