Пользователь
-
Автор темы
- #1
Ресольвер по леерам не работает.
Дельты right и zero равны, а на выходе сайд 0. Стенд ресольвер тоже выдает сайд 0.
Дельты right и zero равны, а на выходе сайд 0. Стенд ресольвер тоже выдает сайд 0.
resolver:
void resolver::resolve_via_layers(player_t* player, adjust_data* record, adjust_data* previous_record)
{
if (record && previous_record)
{
record->resolver_type = MODE_NONE;
if ((record->flags & FL_ONGROUND) && (previous_record->flags & FL_ONGROUND))
{
if (record->speed <= 0.1)
{
if (record->layers[3].m_flWeight == 0.0 && record->layers[3].m_flCycle == 0.0) // леер 3 цикл почти всегда равен 0.97
{
record->resolver_type = MODE_ANIMATION;
record->resolver_side = (2 * (math::angle_difference(record->angles.y, record->rotation_data.server) <= 0.0) - 1) > 0 ? RESOLVER_POSITIVE : RESOLVER_NEGATIVE;
}
}
else if (!(record->layers[12].m_flWeight * 1000.0)
&& int(record->layers[6].m_flWeight * 1000.0) == int(previous_record->layers[6].m_flWeight * 1000.0))
{
float zero = abs(record->layers[6].m_flPlaybackRate - record->resolver_layers[0][6].m_flPlaybackRate);
float left = abs(record->layers[6].m_flPlaybackRate - record->resolver_layers[1][6].m_flPlaybackRate);
float right = abs(record->layers[6].m_flPlaybackRate - record->resolver_layers[2][6].m_flPlaybackRate);
if (zero < left || right <= left || (left * 1000.0)) //
{
if (zero >= right && left > right && !(right * 1000.0)) // эта проверка фейлит
{
record->resolver_side = RESOLVER_POSITIVE;
record->resolver_type = MODE_ANIMATION;
}
}
else
{
record->resolver_side = RESOLVER_NEGATIVE;
record->resolver_type = MODE_ANIMATION;
}
}
}
}
}
layers setup:
original_player_data* player_data = new original_player_data;
std::memcpy(record->layers, player->get_animlayers(), sizeof(AnimationLayer) * 13);
std::memcpy(record->poses, &player->m_flPoseParameter(), sizeof(float) * 24);
player_data->update(e);
set_angles(player, record, previous_record, -1);
record->rotation_data.negative = player->get_animation_state()->m_flGoalFeetYaw;
std::memcpy(record->resolver_layers[2], player->get_animlayers(), sizeof(AnimationLayer) * 13);
update_network_layers(player, player_data);
set_angles(player, record, previous_record, 1);
record->rotation_data.positive = player->get_animation_state()->m_flGoalFeetYaw;
std::memcpy(record->resolver_layers[1], player->get_animlayers(), sizeof(AnimationLayer) * 13);
update_network_layers(player, player_data);
set_angles(player, record, previous_record, 1);
bool is_negative_left_side = math::normalize_yaw(player->get_animation_state()->m_flGoalFeetYaw - record->angles.y) < 0.0;
if (is_negative_left_side)
{
record->rotation_data.negative = player->get_animation_state()->m_flGoalFeetYaw;
std::memcpy(record->resolver_layers[2], player->get_animlayers(), sizeof(AnimationLayer) * 13);
}
else
{
record->rotation_data.positive = player->get_animation_state()->m_flGoalFeetYaw;
std::memcpy(record->resolver_layers[1], player->get_animlayers(), sizeof(AnimationLayer) * 13);
}
update_network_layers(player, player_data);
set_angles(player, record, previous_record, -1);
if (is_negative_left_side)
{
record->rotation_data.positive = player->get_animation_state()->m_flGoalFeetYaw;
std::memcpy(record->resolver_layers[1], player->get_animlayers(), sizeof(AnimationLayer) * 13);
}
else
{
record->rotation_data.negative = player->get_animation_state()->m_flGoalFeetYaw;
std::memcpy(record->resolver_layers[2], player->get_animlayers(), sizeof(AnimationLayer) * 13);
}
update_network_layers(player, player_data);
set_angles(player, record, previous_record, 0);
record->rotation_data.server = player->get_animation_state()->m_flGoalFeetYaw;
std::memcpy(record->resolver_layers[0], player->get_animlayers(), sizeof(AnimationLayer) * 13);
std::memcpy(player->get_animlayers(), record->layers, sizeof(AnimationLayer) * 13);
record->origin = player->m_vecOrigin();
resolver::get().resolve_via_layers(player, record, previous_record);
switch (record->side)
{
case RESOLVER_ORIGINAL:
set_angles(player, record, previous_record, 0);
break;
case RESOLVER_POSITIVE:
set_angles(player, record, previous_record, 1);
break;
case RESOLVER_NEGATIVE:
set_angles(player, record, previous_record, -1);
break;
}
record->right_direction = record->angles.y - 90.0;
record->left_direction = record->angles.y + 90.0;
std::memcpy(player->get_animlayers(), record->layers, sizeof(AnimationLayer) * 13);
std::memcpy(&player->m_flPoseParameter(), record->poses, sizeof(float) * 24);
update_animations(player);