-
Автор темы
- #1
C++:
void update_cursor_send( CUserCmd* cmd ) {
static QAngle delta_viewangles{};
QAngle delta = cmd->viewangles - delta_viewangles;
static ConVar* sensitivity = Source::m_pCvar->FindVar( "sensitivity" );
if ( delta.x != 0.f ) {
static ConVar* m_pitch = Source::m_pCvar->FindVar( "m_pitch" );
int final_dy = static_cast< int >( ( delta.x / m_pitch->GetFloat( ) ) / sensitivity->GetFloat( ) );
if ( final_dy <= 32767 ) {
if ( final_dy >= -32768 ) {
if ( final_dy >= 1 || final_dy < 0 ) {
if ( final_dy <= -1 || final_dy > 0 )
final_dy = final_dy;
else
final_dy = -1;
}
else {
final_dy = 1;
}
}
else {
final_dy = 32768;
}
}
else {
final_dy = 32767;
}
cmd->mousedy = static_cast< short >( final_dy );
}
if ( delta.y != 0.f ) {
static ConVar* m_yaw = Source::m_pCvar->FindVar( "m_yaw" );
int final_dx = static_cast< int >( ( delta.y / m_yaw->GetFloat( ) ) / sensitivity->GetFloat( ) );
if ( final_dx <= 32767 ) {
if ( final_dx >= -32768 ) {
if ( final_dx >= 1 || final_dx < 0 ) {
if ( final_dx <= -1 || final_dx > 0 )
final_dx = final_dx;
else
final_dx = -1;
}
else {
final_dx = 1;
}
}
else {
final_dx = 32768;
}
}
else {
final_dx = 32767;
}
cmd->mousedx = static_cast< short >( final_dx );
}
delta_viewangles = cmd->viewangles;
}