-
Автор темы
- #1
dont works, help
Animfix:
FrameStageNotify:
Animfix:
C++:
void Animfix::UpdateFakeMatrix() {
static bool initState = false;
static CCSGOPlayerAnimState* fakeState = nullptr;
static float oldSpawnTime;
if (oldSpawnTime != g_LocalPlayer->m_flSpawnTime()) {
initState = false;
oldSpawnTime = g_LocalPlayer->m_flSpawnTime();
}
if (!initState) {
auto state = reinterpret_cast<CCSGOPlayerAnimState*>(malloc(sizeof(CCSGOPlayerAnimState)));
if (state != nullptr)
g_LocalPlayer->CreateAnimationState(state);
fakeState = state;
initState = true;
}
if (!fakeState)
return;
if (g_LocalPlayer->m_flSimulationTime() != g_LocalPlayer->m_flOldSimulationTime()) {
AnimationLayer lastLayers[13];
std::memcpy(lastLayers, g_LocalPlayer->GetAnimOverlays(), sizeof(AnimationLayer) * 13);
g_LocalPlayer->UpdateAnimationState(fakeState, Antiaim::Get().fakeAngle);
g_LocalPlayer->InvalidateBoneCache();
g_LocalPlayer->SetAbsAngles(QAngle(0, fakeState->m_flGoalFeetYaw, 0));
g_LocalPlayer->SetupBones(fakeMatrix, 128, BONE_USED_BY_ANYTHING & ~BONE_USED_BY_ATTACHMENT, g_GlobalVars->curtime);
if (g_Options.chams_desync_enabled) {
for (auto& i : fakeMatrix) {
i[0][3] -= g_LocalPlayer->GetRenderOrigin().x;
i[1][3] -= g_LocalPlayer->GetRenderOrigin().y;
i[2][3] -= g_LocalPlayer->GetRenderOrigin().z;
}
}
std::memcpy(g_LocalPlayer->GetAnimOverlays(), lastLayers, sizeof(AnimationLayer) * 13);
}
}
void Animfix::UpdateLocalAnimations() {
const auto state = g_LocalPlayer->GetPlayerAnimState();
if (!state)
return;
static float feetYaw = g_LocalPlayer->GetPlayerAnimState()->m_flGoalFeetYaw;
static std::array<float, 24> sendPoseParameters = g_LocalPlayer->m_flPoseParameter();
static AnimationLayer backupLayers[15];
static int oldFramecount;
if (oldFramecount != g_GlobalVars->framecount) {
oldFramecount = g_GlobalVars->framecount;
std::memcpy(backupLayers, g_LocalPlayer->GetAnimOverlays(), (sizeof(AnimationLayer) * g_LocalPlayer->GetNumAnimOverlays()));
g_LocalPlayer->UpdateAnimationState(state, g_Cmd->viewangles);
if (state->m_iLastClientSideAnimationUpdateFramecount == g_GlobalVars->framecount)
state->m_iLastClientSideAnimationUpdateFramecount = g_GlobalVars->framecount - 1;
g_LocalPlayer->UpdateClientSideAnimation();
if (g_bSendPacket) {
feetYaw = state->m_flGoalFeetYaw;
sendPoseParameters = g_LocalPlayer->m_flPoseParameter();
}
}
g_LocalPlayer->SetAbsAngles(QAngle(0, feetYaw, 0));
if (state->speed_2d <= (g_LocalPlayer->m_fFlags() & IN_DUCK ? 2.94117647f : .505f))
state->m_flUnknownFraction = 0.f;
std::memcpy(g_LocalPlayer->GetAnimOverlays(), backupLayers, (sizeof(AnimationLayer) * g_LocalPlayer->GetNumAnimOverlays()));
g_LocalPlayer->m_flPoseParameter() = sendPoseParameters;
}
FrameStageNotify:
C++:
if (stage == FRAME_NET_UPDATE_END) {
if (g_LocalPlayer && g_LocalPlayer->IsAlive()) {
Animfix::Get().UpdateFakeMatrix();
}
}
if (stage == FRAME_RENDER_START) {
if (g_LocalPlayer && g_LocalPlayer->IsAlive()) {
Animfix::Get().UpdateLocalAnimations();
}
}