Пользователь
-
Автор темы
- #1
Onetap v2 set angles
Возможно вронг.
Возможно вронг.
C++:
void OneTap::Features::AnimationSystem::Storage::Save(CCSPlayer* player, CAnimationData* m_pData)
{
m_pData->m_fFlags = player->m_fFlags();
m_pData->m_angEyeAngles = player->m_angEyeAngles();
m_pData->m_flDuckAmount = player->m_flDuckAmount();
m_pData->m_flLowerBodyYawTarget = player->m_flLowerBodyYawTarget();
m_pData->m_flFeetCycle = player->GetAnimationState()->m_flFeetCycle;
m_pData->m_flFeetYawRate = player->GetAnimationState()->m_flFeetYawRate;
}
void OneTap::Features::AnimationSystem::Storage::Apply(CCSPlayer* player, CAnimationData* m_pData)
{
player->m_fFlags() = m_pData->m_fFlags;
player->m_angEyeAngles() = m_pData->m_angEyeAngles;
player->m_flDuckAmount() = m_pData->m_flDuckAmount;
player->GetAnimationState()->m_flFeetCycle = m_pData->m_flFeetCycle;
player->GetAnimationState()->m_flFeetYawRate = m_pData->m_flFeetYawRate;
}
void OneTap::Features::AnimationSystem::SetAngles(CCSPlayer* player, CLagRecord* m_pLagRecord, CLagData* m_pLagData, CLagData* m_pPreviousLagData, int m_iSide)
{
float m_flAngle;
CAnimationData data;
OneTap::Features::AnimationSystem::Storage::Save(&data, player);
player->SetAbsOrigin(player->m_vecOrigin());
if (m_pLagData->m_fFlags & FL_ONGROUND)
{
player->GetAnimationState()->m_bOnGround = true;
player->GetAnimationState()->m_bInHitGroundAnimation = true;
}
if (!m_pPreviousLagData || m_pPreviousLagData->m_bIsDormant)
{
memcpy(player->GetAnimationLayers(), m_pLagData->m_aServerLayers, sizeof(CAnimationLayer) * 13);
}
else if (!m_pPreviousLagData->m_bIsDormant)
{
memcpy(player->GetAnimationLayers(), m_pPreviousLagData->m_aServerLayers, sizeof(CAnimationLayer) * 13);
player->GetAnimationState()->m_flFeetCycle = m_pPreviousLagData->m_flFeetCycle;
player->GetAnimationState()->m_flFeetYawRate = m_pPreviousLagData->m_flFeetYawRate;
}
if (m_pLagData->m_iLag == 1)
{
if (m_iSide)
{
if (!m_pPreviousLagData || m_pPreviousLagData->m_bIsDormant)
{
if (m_iSide <= 0)
m_flAngle = m_pLagData->m_angEyeAngles.yaw - 60.0;
else
m_flAngle = m_pLagData->m_angEyeAngles.yaw + 60.0;
}
else
{
if (m_iSide <= 0)
m_flAngle = m_pLagRecord->m_flAbsYaw;
else
m_flAngle = m_pLagRecord->m_flAbsYaw[1];
}
player->GetAnimationState()->m_flGoalFeetYaw = m_flAngle;
}
player->m_flDuckAmount() = m_pLagData->m_flDuckAmount;
m_pLagRecord->m_bUpdatingAnimations = true;
player->m_angEyeAngles() = m_pLagData->m_angEyeAngles;
player->m_angEyeAngles().roll = 0.0;
OneTap::Features::AnimationSystem::Update(player);
m_pLagRecord->m_bUpdatingAnimations = false;
}
else
{
int m_iLagIterator = 0;
if (m_pLagData->m_iLag > 0)
{
while (1)
{
if ((++m_iLagIterator < m_pLagData->m_iLag) && m_iSide)
{
if (m_iSide <= 0)
m_flAngle = m_pLagData->m_angEyeAngles.yaw - 60.0;
else
m_flAngle = m_pLagData->m_angEyeAngles.yaw + 60.0;
player->GetAnimationState->m_flGoalFeetYaw = m_flAngle;
}
player->m_flDuckAmount() = m_pLagRecord->m_pLegacyData->m_flDuckAmount;
m_pLagRecord->m_bUpdatingAnimations = true;
m_pLagRecord->m_vecEyePos = m_pLagRecord->m_pLegacyData->m_vecDesiredEyePos;
player->m_angEyeAngles() = m_pLagData->m_angEyeAngles;
OneTap::Features::AnimationSystem::Update(player);
m_pLagRecord->m_bUpdatingAnimations = false;
if (m_iLagIterator >= m_pLagData->m_iLag)
break;
}
}
}
OneTap::Features::AnimationSystem::Storage::Apply(&data, player);
player->InvalidatePhysicsRecursive(ANIMATION_CHANGED);
}