Jump to content
  • Treść wyszukiwania
    Search In
    • More options...
    Find results that contain...
    Find results in...
  • Sign Up
Password for all archives on our forum: 123
Make sure that your threads are placed in the correct sections. It saves the Moderation team some work.
Reminder : All files uploaded before September 2020 are corrupted

shot record glow chams. // works good for weave. But same for legendware

Source code

Recommended Posts

void hit_chams::add_matrix(player_t* player, matrix3x4_t* bones)
{
    auto& hit = m_Hitmatrix.emplace_back();

    std::memcpy(hit.pBoneToWorld, bones, player->m_CachedBoneData().Count() * sizeof(matrix3x4_t));
    hit.time = m_globals()->m_realtime + 2.5f;

    static int m_nSkin = util::find_in_datamap(player->GetPredDescMap(), crypt_str("m_nSkin"));
    static int m_nBody = util::find_in_datamap(player->GetPredDescMap(), crypt_str("m_nBody"));

    hit.info.origin = player->GetAbsOrigin();
    hit.info.angles = player->GetAbsAngles();

    auto renderable = player->GetClientRenderable();

    if (!renderable)
        return;

    auto model = player->GetModel();

    if (!model)
        return;

    auto hdr = *(studiohdr_t**)(player->m_pStudioHdr());

    if (!hdr)
        return;

    hit.state.m_pStudioHdr = hdr;
    hit.state.m_pStudioHWData = m_modelcache()->GetHardwareData(model->studio);
    hit.state.m_pRenderable = renderable;
    hit.state.m_drawFlags = 0;

    hit.info.pRenderable = renderable;
    hit.info.pModel = model;
    hit.info.pLightingOffset = nullptr;
    hit.info.pLightingOrigin = nullptr;
    hit.info.hitboxset = player->m_nHitboxSet();
    hit.info.skin = (int)(uintptr_t(player) + m_nSkin);
    hit.info.body = (int)(uintptr_t(player) + m_nBody);
    hit.info.entity_index = player->EntIndex();
    hit.info.instance = call_virtual<ModelInstanceHandle_t(__thiscall*)(void*) >(renderable, 30u)(renderable);
    hit.info.flags = 0x1;

    hit.info.pModelToWorld = &hit.model_to_world;
    hit.state.m_pModelToWorld = &hit.model_to_world;

    hit.model_to_world.AngleMatrix(hit.info.angles, hit.info.origin);
}
C++:
void hit_chams::draw_hit_matrix()
{
    if (!g_ctx.available())
        m_Hitmatrix.clear();

    if (m_Hitmatrix.empty())
        return;

    if (!m_modelrender())
        return;

    auto ctx = m_materialsystem()->GetRenderContext();

    if (!ctx)
        return;

    auto it = m_Hitmatrix.begin();
    while (it != m_Hitmatrix.end()) {
        if (!it->state.m_pModelToWorld || !it->state.m_pRenderable || !it->state.m_pStudioHdr || !it->state.m_pStudioHWData ||
            !it->info.pRenderable || !it->info.pModelToWorld || !it->info.pModel) {
            ++it;
            continue;
        }

        auto alpha = 1.0f;
        auto delta = m_globals()->m_realtime -it->time;
        if (delta > 0.0f) {
            alpha -= delta;
            if (delta > 1.0f) {
                it = m_Hitmatrix.erase(it);
                continue;
            }
        }

        // your material, mb from combo
        auto material = m_materialsystem()->FindMaterial(crypt_str("dev/glow_armsrace.vmt"), nullptr);

        auto alpha_c = (float)g_cfg.player.lag_hitbox_color.a() / 255.0f;
        float normal_color[3] =
        {
            g_cfg.player.lag_hitbox_color[0] / 255.0f,
            g_cfg.player.lag_hitbox_color[1] / 255.0f,
            g_cfg.player.lag_hitbox_color[2] / 255.0f
        };

        m_renderview()->SetBlend(alpha_c * alpha);
        util::color_modulate(normal_color, material);

        material->IncrementReferenceCount();
        material->SetMaterialVarFlag(MATERIAL_VAR_IGNOREZ, false);

        m_modelrender()->ForcedMaterialOverride(material);
        m_modelrender()->DrawModelExecute(ctx, it->state, it->info, it->pBoneToWorld);
        m_modelrender()->ForcedMaterialOverride(nullptr);

        ++it;
    }
}

Структура model_t:
 

C++:
struct model_t
{
    void* fnHandle;
    char name[260];
    __int32 nLoadFlags;
    __int32 nServerCount;
    __int32 type;
    __int32 flags;
    Vector mins, maxs;
    float radius;
    void* m_pKeyValues;
    union
    {
        void* brush;
        MDLHandle_t studio;
        void* sprite;
    };
};

AngleMatrix:

C++:
template<typename T>
    T ToRadians(T degrees) {
        return (degrees * (static_cast<T>(RadPi) / static_cast<T>(DegPi)));
    }

    void AngleMatrix(const Vector& angles)
    {
        float sr, sp, sy, cr, cp, cy;
        DirectX::XMScalarSinCos(&sy, &cy, ToRadians(angles[1]));
        DirectX::XMScalarSinCos(&sp, &cp, ToRadians(angles[0]));
        DirectX::XMScalarSinCos(&sr, &cr, ToRadians(angles[2]));

        m_flMatVal[0][0] = cp * cy;
        m_flMatVal[1][0] = cp * sy;
        m_flMatVal[2][0] = -sp;

        float crcy = cr * cy;
        float crsy = cr * sy;
        float srcy = sr * cy;
        float srsy = sr * sy;
        m_flMatVal[0][1] = sp * srcy - crsy;
        m_flMatVal[1][1] = sp * srsy + crcy;
        m_flMatVal[2][1] = sr * cp;

        m_flMatVal[0][2] = (sp * crcy + srsy);
        m_flMatVal[1][2] = (sp * crsy - srcy);
        m_flMatVal[2][2] = cr * cp;

        m_flMatVal[0][3] = 0.0f;
        m_flMatVal[1][3] = 0.0f;
        m_flMatVal[2][3] = 0.0f;
    }

    void MatrixSetColumn(const Vector& in, int column)
    {
        m_flMatVal[0][column] = in.x;
        m_flMatVal[1][column] = in.y;
        m_flMatVal[2][column] = in.z;
    }

    void AngleMatrix(const Vector& angles, const Vector& position)
    {
        AngleMatrix(angles);
        MatrixSetColumn(position, 3);
    }
Link to post
Share on other sites
  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...