:roflanBuldiga:
-
Автор темы
- #1
Криво отрисовываются десинк чамсы (путаются чамсы с моделью игрока).
Пастил с хейдеса.
(Это в drawmodelexecute)
Пастил с хейдеса.
C++:
auto entity = dynamic_cast<C_BaseEntity*> (g_pEntityList->GetClientEntity(info.index));
if (entity && entity->IsPlayer() && entity == Globals::LocalPlayer)
{
if (!g_Animations.m_got_real_matrix)
return;
if (!matrix)
return;
memcpy(matrix, g_Animations.m_real_matrix, sizeof(g_Animations.m_real_matrix));
for (auto i = 0; i < maxstudiobones; i++)
{
matrix[i][0][3] += info.origin.x;
matrix[i][1][3] += info.origin.y;
matrix[i][2][3] += info.origin.z;
}
}
g_Chams.OnDrawModelExecute(context, state, info, matrix);
g_pModelRender->ForcedMaterialOverride(nullptr);
g_pRenderView->SetBlend(1.f);
C++:
void Chams::OnDrawModelExecute(IMatRenderContext* ctx, const DrawModelState_t& state, const ModelRenderInfo_t& info, matrix3x4_t* matrix) const
{
static auto oDrawModelExecute = g_Hooks.pModelHook->GetOriginal<DrawModelExecute_t>(vtable_indexes::dme);
auto entity = dynamic_cast<C_BaseEntity*> (g_pEntityList->GetClientEntity(info.index));
if (!entity || entity->IsDormant() || !Globals::LocalPlayer || !matrix)
return oDrawModelExecute(g_pModelRender, ctx, state, info, matrix);
auto local = static_cast<C_BaseEntity*> (Globals::LocalPlayer);
static IMaterial* material;
static bool once1{ false };
if (!once1)
{
std::ofstream("csgo\\materials\\nonflat.vmt") << R"#("VertexLitGeneric"
{
"$basetexture" "vgui/white_additive"
"$ignorez" "1"
"$envmap" ""
"$nofog" "1"
"$model" "1"
"$nocull" "0"
"$selfillum" "1"
"$halflambert" "1"
"$znearer" "0"
"$flat" "1"
"$reflectivity" "[1 1 1]"
} )#";
material = g_pMaterialSys->FindMaterial("nonflat.vmt", nullptr);
once1 = true;
}
float desync_color[3] = { c_config::get().desync_chams_color_r / 255.f, c_config::get().desync_chams_color_g / 255.f, c_config::get().desync_chams_color_b / 255.f };
float fakelag_color[3] = { c_config::get().fakelag_chams_color_r / 255.f, c_config::get().fakelag_chams_color_g / 255.f, c_config::get().fakelag_chams_color_b / 255.f };
float local_color[3] = { c_config::get().local_chams_color_r / 255.f, c_config::get().local_chams_color_g / 255.f, c_config::get().local_chams_color_b / 255.f };
if (entity->IsPlayer())
{
const auto player = dynamic_cast<C_BaseEntity*> (entity);
if (!player)
return;
if (local && player == local && local->IsAlive() && g_pGlobalVars->curtime - local->SpawnTime() > 3.f)
{
if (c_config::get().desync_chams && g_Animations.init_fake_anim)
{
if (g_Animations.m_got_fake_matrix)
{
for (auto& i : g_Animations.m_fake_matrix)
{
i[0][3] += info.origin.x;
i[1][3] += info.origin.y;
i[2][3] += info.origin.z;
}
g_pModelRender->ForcedMaterialOverride(material);
g_pRenderView->SetBlend(c_config::get().desync_chams_color_a / 255);
g_pRenderView->SetColorModulation(desync_color);
oDrawModelExecute(g_pModelRender, ctx, state, info, g_Animations.m_fake_matrix);
g_pModelRender->ForcedMaterialOverride(nullptr);
g_pRenderView->SetBlend(1.f);
for (auto& i : g_Animations.m_fake_matrix)
{
i[0][3] -= info.origin.x;
i[1][3] -= info.origin.y;
i[2][3] -= info.origin.z;
}
}
}
if (c_config::get().fakelag_chams && g_Animations.m_got_fake_matrix)
{
g_pRenderView->SetBlend(c_config::get().fakelag_chams_color_a / 255);
g_pRenderView->SetColorModulation(fakelag_color);
g_pModelRender->ForcedMaterialOverride(material);
oDrawModelExecute(g_pModelRender, ctx, state, info, g_Animations.m_fake_position_matrix);
g_pModelRender->ForcedMaterialOverride(nullptr);
g_pRenderView->SetBlend(1.f);
}
oDrawModelExecute(g_pModelRender, ctx, state, info, matrix);
}
else
{
if (player->IsAlive())
{
if (player->IsEnemy())
{
}
}
oDrawModelExecute(g_pModelRender, ctx, state, info, matrix);
}
}
else
oDrawModelExecute(g_pModelRender, ctx, state, info, matrix);
}