-
Автор темы
- #1
C++:
void Resolver::ResolveStand(AimPlayer* data, LagRecord* record) {
// Get predicted away angle for the player.
const float away = GetAwayAngle(record);
// Pointer for easy access.
LagRecord* move = &data->m_walk_record;
// Check if moving record is close.
if (move->IsValid() && (record->m_origin - move->m_origin).LengthSqr() <= 16384.f) {
// Indicate that we are using the moving lby.
data->m_moved = true;
}
const float diff = math::NormalizedAngle(record->m_body - move->m_body);
const float delta = record->m_anim_time - move->m_anim_time;
// Check if delta is within a valid range.
if (delta >= 0.22f && delta <= 0.3f) {
// Check if record's animation time is greater than or equal to the body update time.
if (record->m_anim_time >= data->m_body_update) {
if (data->m_body_index <= 3) {
// Always use the body yaw if the player's body index is less than or equal to 3.
record->m_eye_angles.y = record->m_body;
record->m_mode = Modes::RESOLVE_BODY;
data->m_body_update = record->m_anim_time + 1.1f;
}
else {
record->m_mode = Modes::RESOLVE_STAND1;
const auto curr = &record->m_layers[3];
const auto act = data->m_player->GetSequenceActivity(curr->m_sequence);
// Use moving yaw as base.
record->m_eye_angles.y = move->m_body;
// Add random offset to yaw if stand index is divisible by 3 with no remainder.
if (!(data->m_stand_index % 3)) {
record->m_eye_angles.y += g_csgo.RandomFloat(-35.f, 35.f);
}
// Flip yaw 180 degrees if stand index is greater than 6 and the activity is not 980.
if (data->m_stand_index > 6 && act != 980) {
record->m_eye_angles.y += 180.f;
}
else if (data->m_stand_index > 4 && act != 980) {
// Use predicted away angle if stand index is greater than 4 and the activity is not 980.
record->m_eye_angles.y = away + 180.f;
}
}
}
else {
// Use moving yaw if record's animation time is less than the body update time.
record->m_eye_angles.y = move->m_body;
record->m_mode = Modes::RESOLVE_STOPPED_MOVING;
}
}
else {
// Use predicted away angle if delta is not within a valid range.
record->m_eye_angles.y = away;
record->m_mode = Modes::RESOLVE_STAND2;
}
// Calculate the `m_eye_angles.y` value based on the `data->m_stand_index2 % 6` value.
switch (data->m_stand_index2 % 6) {
case 0:
// Use angle 180 degrees away from `away`.
record->m_eye_angles.y = away + 180.f;
break;
case 1:
// Use current body angle.
record->m_eye_angles.y = record->m_body;
break;
case 2:
record->m_eye_angles.y = record->m_body + 180.f; // The current body angle plus 180 degrees
break;
case 3:
record->m_eye_angles.y = record->m_body + 110.f; // The current body angle plus 110 degrees
break;
case 4:
record->m_eye_angles.y = record->m_body - 110.f; // The current body angle minus 110 degrees
break;
case 5:
record->m_eye_angles.y = away; // The `away` angle
break;
default:
break;
}
}