Local animfix lw

Статус
В этой теме нельзя размещать новые ответы.
like amiri in my mind
Пользователь
Статус
Оффлайн
Регистрация
4 Дек 2022
Сообщения
308
Реакции[?]
54
Поинты[?]
1K
2.15. Запрещено редактировать название темы или своё сообщение на «/del» во всех случаях (продажа аккаунта, получение ответа на свой вопрос и так далее), кроме флуда.
есть баг, как например неверное отображение угла при использовании десинка, это будет вам в дз, остальное +- норм работает надеюсь

нету обновы фейка, сами сделаете

пример использования:
ресетаете дату при раундстарте, также ресетаете при !g_ctx.available() в фреймстейдже
вызов instance вконце hk_createmove

local_anims.cpp:
#include "local_anims.h"
#include "BoneManager.h"
#include "../misc/prediction_system.h"
#include "../../utils/EnrageMath.h"
#include "local_animations.h"


void C_LocalAnimations::Instance(CUserCmd* m_pcmd) {

    int32_t iFlags = g_ctx.local()->m_fFlags();
    float_t flLowerBodyYaw = g_ctx.local()->m_flLowerBodyYawTarget();
    float_t flDuckSpeed = g_ctx.local()->m_flDuckSpeed();
    float_t flDuckAmount = g_ctx.local()->m_flDuckAmount();
    Vector angVisualAngles = g_ctx.local()->m_angVisualAngles();

    g_ctx.local()->m_vecAbsVelocity() = g_ctx.local()->m_vecVelocity();

    g_ctx.local()->m_angVisualAngles() = m_pcmd->m_viewangles;
    g_ctx.local()->m_angVisualAngles().z = 0.0f;

    g_ctx.local()->m_flLowerBodyYawTarget() = LocalData.m_flLowerBodyYaw;
    if (g_ctx.local()->m_fFlags() & FL_FROZEN)
        g_ctx.local()->m_flLowerBodyYawTarget() = flLowerBodyYaw;

    bool m_bClientSideAnimation= g_ctx.local()->m_bClientSideAnimation();
    g_ctx.local()->m_bClientSideAnimation() = true;

    g_ctx.globals.updating_animation = true;
    g_ctx.local()->update_clientside_animation();
    g_ctx.globals.updating_animation = false;

    g_ctx.local()->m_bClientSideAnimation() = m_bClientSideAnimation;

    std::memcpy(LocalData.m_PoseParameters.data(), g_ctx.local()->m_flPoseParameter().data(), sizeof(float_t) * 24);
    std::memcpy(LocalData.m_AnimationLayers.data(), g_ctx.local()->get_animlayers(), sizeof(AnimationLayer) * ANIMATION_LAYER_COUNT);

    if (g_ctx.send_packet)
    {
        g_BoneManager->BuildMatrix(g_ctx.local(), LocalData.m_aMainBones.data(), false);

        // move matrixes
        for (int i = 0; i < MAXSTUDIOBONES; i++)
            LocalData.m_vecBoneOrigins[i] = g_ctx.local()->GetAbsOrigin() - LocalData.m_aMainBones[i].GetOrigin();

    }

    g_ctx.local()->m_fFlags() = iFlags;
    g_ctx.local()->m_flDuckAmount() = flDuckAmount;
    g_ctx.local()->m_flDuckSpeed() = flDuckSpeed;
    g_ctx.local()->m_flLowerBodyYawTarget() = flLowerBodyYaw;
    g_ctx.local()->m_angVisualAngles() = angVisualAngles;
}

bool C_LocalAnimations::GetCachedMatrix(matrix3x4_t* aMatrix) {
    return std::memcpy(aMatrix, LocalData.m_aMainBones.data(), sizeof(matrix3x4_t) * g_ctx.local()->m_CachedBoneData().Count());
}

void C_LocalAnimations::OnUpdateClientSideAnimation() {
    for (int i = 0; i < MAXSTUDIOBONES; i++)
        LocalData.m_aMainBones[i].SetOrigin(g_ctx.local()->GetAbsOrigin() - LocalData.m_vecBoneOrigins[i]);

    std::memcpy(g_ctx.local()->m_CachedBoneData().Base(), LocalData.m_aMainBones.data(), sizeof(matrix3x4_t) * g_ctx.local()->m_CachedBoneData().Count());
    //fix flying weapons
    return g_ctx.local()->AttachmentHelper();
}

std::array< AnimationLayer, 13 > C_LocalAnimations::GetAnimationLayers() {
    std::array< AnimationLayer, 13 > aOutput;

    std::memcpy(aOutput.data(), g_ctx.local()->get_animlayers(), sizeof(AnimationLayer) * ANIMATION_LAYER_COUNT);
    std::memcpy(&aOutput.at(ANIMATION_LAYER_MOVEMENT_JUMP_OR_FALL), &LocalData.m_AnimationLayers.at(ANIMATION_LAYER_MOVEMENT_JUMP_OR_FALL), sizeof(AnimationLayer));
    std::memcpy(&aOutput.at(ANIMATION_LAYER_MOVEMENT_LAND_OR_CLIMB), &LocalData.m_AnimationLayers.at(ANIMATION_LAYER_MOVEMENT_LAND_OR_CLIMB), sizeof(AnimationLayer));
    std::memcpy(&aOutput.at(ANIMATION_LAYER_ALIVELOOP), &LocalData.m_AnimationLayers.at(ANIMATION_LAYER_ALIVELOOP), sizeof(AnimationLayer));
    std::memcpy(&aOutput.at(ANIMATION_LAYER_LEAN), &LocalData.m_AnimationLayers.at(ANIMATION_LAYER_LEAN), sizeof(AnimationLayer));

    return aOutput;
}
local_anims.h:
#pragma once
#include "..\..\..\includes.hpp"



class C_LocalAnimations
{
private:
    struct
    {
        std::array < matrix3x4_t, MAXSTUDIOBONES > m_aMainBones;
        std::array < Vector, MAXSTUDIOBONES > m_vecBoneOrigins;

        std::array < AnimationLayer, 13 > m_AnimationLayers;
        std::array < float_t, 24 > m_PoseParameters;

        float_t m_flLowerBodyYaw = 0.0f;


    } LocalData;



public:
    virtual void Instance(CUserCmd* m_pcmd);

    virtual bool GetCachedMatrix(matrix3x4_t* aMatrix);
    virtual void OnUpdateClientSideAnimation();
    virtual std::array < AnimationLayer, 13 > GetAnimationLayers();
    Vector m_angRealAngles = Vector(0, 0, 0);
    Vector m_angStoredAngles = Vector(0, 0, 0);

    virtual void ResetData()
    {
        LocalData.m_aMainBones = { };
        LocalData.m_vecBoneOrigins.fill(Vector(0, 0, 0));

        LocalData.m_AnimationLayers.fill(AnimationLayer());
        LocalData.m_PoseParameters.fill(0.0f);

        m_angRealAngles = Vector(0, 0, 0);
        m_angStoredAngles = Vector(0, 0, 0);

        LocalData.m_flLowerBodyYaw = 0.0f;

    }




};



inline C_LocalAnimations* g_LocalAnimations = new C_LocalAnimations();
setup_bones hook part:
if (g_ctx.globals.setuping_bones)
                result = ((SetupBonesFn)original_setupbones)(ecx, bone_world_out, max_bones, bone_mask, current_time);
            else if (g_cfg.legitbot.enabled && player != g_ctx.local())
                result = ((SetupBonesFn)original_setupbones)(ecx, bone_world_out, max_bones, bone_mask, current_time);
            else if (!g_ctx.local()->is_alive())
                result = ((SetupBonesFn)original_setupbones)(ecx, bone_world_out, max_bones, bone_mask, current_time);
            else if (!player->m_CachedBoneData().Count())
                result = ((SetupBonesFn)original_setupbones)(ecx, bone_world_out, max_bones, bone_mask, current_time);
            else if (bone_world_out) {
                if (player == g_ctx.local())
                    result = g_LocalAnimations->GetCachedMatrix(bone_world_out);
                else
                    memcpy(bone_world_out, player->m_CachedBoneData().Base(), player->m_CachedBoneData().Count() * sizeof(matrix3x4_t));

            }
upd clientside hook full:
    if (!player->valid(false, !g_cfg.ragebot.dormant_aimbot))
        return ((UpdateClientSideAnimationFn)original_updateclientsideanimation)(player);

    if (player == g_ctx.local())
        g_LocalAnimations->OnUpdateClientSideAnimation();

    if (g_ctx.globals.updating_animation)
        return ((UpdateClientSideAnimationFn)original_updateclientsideanimation)(player);
 
Последнее редактирование:
Статус
В этой теме нельзя размещать новые ответы.
Сверху Снизу