-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
aaaaaaaaaaaaaaaaaaaaaaa polak
C++:
void movement_fix( c_user_cmd* cmd, qangle_t& wish_angle ) {
if ( cmd->m_view_angles.z != 0.f
&& !globals::m_local( )->get_flags( ).has( FL_ONGROUND ) )
cmd->m_side_move = 0.f;
vec3_t view_fwd, view_right, view_up, cmd_fwd, cmd_right, cmd_up;
math::angle_vectors( wish_angle, view_fwd, view_right, view_up );
math::angle_vectors( cmd->m_view_angles, cmd_fwd, cmd_right, cmd_up );
auto v8 = sqrtf( ( view_fwd.x * view_fwd.x ) + ( view_fwd.y * view_fwd.y ) );
auto v10 = sqrtf( ( view_right.x * view_right.x ) + ( view_right.y * view_right.y ) );
auto v12 = sqrtf( view_up.z * view_up.z );
vec3_t v13( ( 1.f / v8 ) * view_fwd.x, ( 1.f / v8 ) * view_fwd.y, 0.f );
vec3_t v14( ( 1.f / v10 ) * view_right.x, ( 1.f / v10 ) * view_right.y, 0.f );
vec3_t v15( 0.f, 0.f, ( 1.f / v12 ) * view_up.z );
auto v16 = sqrtf( ( cmd_fwd.x * cmd_fwd.x ) + ( cmd_fwd.y * cmd_fwd.y ) );
auto v17 = sqrtf( ( cmd_right.x * cmd_right.x ) + ( cmd_right.y * cmd_right.y ) );
auto v18 = sqrtf( cmd_up.z * cmd_up.z );
vec3_t v19( ( 1.f / v16 ) * cmd_fwd.x, ( 1.f / v16 ) * cmd_fwd.y, 0.f );
vec3_t v20( ( 1.f / v17 ) * cmd_right.x, ( 1.f / v17 ) * cmd_right.y, 0.f );
vec3_t v21( 0.f, 0.f, ( 1.f / v18 ) * cmd_up.z );
auto v22 = v13.x * cmd->m_forward_move;
auto v26 = v13.y * cmd->m_forward_move;
auto v28 = v13.z * cmd->m_forward_move;
auto v24 = v14.x * cmd->m_side_move;
auto v23 = v14.y * cmd->m_side_move;
auto v25 = v14.z * cmd->m_side_move;
auto v30 = v15.x * cmd->m_up_move;
auto v27 = v15.z * cmd->m_up_move;
auto v29 = v15.y * cmd->m_up_move;
cmd->m_forward_move = ((((v19.x * v24) + (v19.y * v23)) + (v19.z * v25))
+ (((v19.x * v22) + (v19.y * v26)) + (v19.z * v28)))
+ (((v19.y * v30) + (v19.x * v29)) + (v19.z * v27));
cmd->m_side_move = ((((v20.x * v24) + (v20.y * v23)) + (v20.z * v25))
+ (((v20.x * v22) + (v20.y * v26)) + (v20.z * v28)))
+ (((v20.x * v29) + (v20.y * v30)) + (v20.z * v27));
cmd->m_up_move = ((((norm_cmd_up.x * v23) + (v21.y * v24)) + (v21.z * v25))
+ (((v21.x * v26) + (v21.y * v22)) + (v21.z * v28)))
+ (((v21.x * v30) + (v21.y * v29)) + (v21.z * v27));
// clamp.
cmd->m_forward_move = clamp( cmd->m_forward_move, -450.f, 450.f );
cmd->m_side_move = clamp( cmd->m_side_move, -450.f, 450.f );
cmd->m_up_move = clamp( cmd->m_up_move, -320.f, 320.f );
}