Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void __fastcall Hooks::DrawModelExecute(void* ecx, void* edx, IMatRenderContext* context, const DrawModelState_t& state, const ModelRenderInfo_t& info, matrix3x4_t* matrix)
- {
- static auto oDrawModelExecute = g_Hooks.pModelHook->GetOriginal<DrawModelExecute_t>(vtable_indexes::dme);
- const char* ModelName = g_pModelInfo->GetModelName((model_t*)info.pModel);
- C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(info.index);
- static std::vector< IMaterial * > materials;
- static bool once{ false };
- if (!once) {
- materials.push_back(create_material(true, false, false)); // material.
- materials.push_back(create_material(false, false, false, 0)); // flat.
- materials.push_back(create_material(true, false, true)); // material zignore.
- materials.push_back(create_material(false, false, true)); // flat zignore.
- once = true;
- }
- /*
- IMaterial *materials[32];
- studiohdr_t* hdr = g_pModelInfo->GetStudiomodel(info.pModel);
- g_pModelInfo->GetModelMaterials(info.pModel, hdr->numtextures, materials);
- for (int i = 0; i < hdr->numtextures; i++)
- {
- IMaterial* mathands = materials[i];
- if (!mathands)
- continue;
- mathands->SetMaterialVarFlag(MATERIAL_VAR_WIREFRAME, c_config::get().wireframe_arms);
- }
- */
- static std::vector< IMaterial* > materials2;
- static bool once2{ false };
- if (!once2) {
- materials2.push_back(create_material(false, false, false, 0)); //Flat
- materials2.push_back(create_material(true, false, false)); // Material
- materials2.push_back(create_material(true, true, false)); // Wireframe
- materials2.push_back(g_pMaterialSys->FindMaterial("models/inventory_items/dogtags/dogtags_outline", "Model textures")); //Pulse
- materials2.push_back(g_pMaterialSys->FindMaterial("glowOverlay", "Model textures")); //eso
- once2 = true;
- }
- static IMaterial* pulse = g_pMaterialSys->FindMaterial("models/inventory_items/dogtags/dogtags_outline", "Model textures");
- float old_color[3] = { 0.f };
- float colorde[3] = { 0.f };
- colorde[0] = c_config::get().desync_chams_color_r / 255.f;
- colorde[1] = c_config::get().desync_chams_color_g / 255.f;
- colorde[2] = c_config::get().desync_chams_color_b / 255.f;
- float colorfl[3] = { c_config::get().lag_color_r / 255.f, c_config::get().lag_color_g / 255.f, c_config::get().lag_color_b / 255.f };
- IMaterial* matLocal = materials2.at(c_config::get().localmodel);
- float colorLocal[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 };
- IMaterial* matEnemy = materials2.at(c_config::get().chamsenemies_model);
- float vis_color[3] = { c_config::get().chams_esp_color_r / 255.f, c_config::get().chams_esp_color_g / 255.f, c_config::get().chams_esp_color_b / 255.f };
- float hid_color[3] = { c_config::get().chams_xqz_esp_color_r / 255.f, c_config::get().chams_xqz_esp_color_g / 255.f, c_config::get().chams_xqz_esp_color_b / 255.f };
- float hand_chams[3] = { c_config::get().hand_chams_color_r / 255.f, c_config::get().hand_chams_color_g / 255.f, c_config::get().hand_chams_color_b / 255.f };
- auto HandChams = c_config::get().hand_chams;
- IMaterial* matHands = materials2.at(HandChams);
- if (strstr(ModelName, "arms") && c_config::get().handchams && !strstr(ModelName, "v_sleeve")) {
- g_pRenderView->SetBlend(c_config::get().hand_chams_color_a / 255.f);
- g_pRenderView->SetColorModulation(hand_chams);
- g_pModelRender->ForcedMaterialOverride(matHands);
- oDrawModelExecute(ecx, context, state, info, matrix);
- }
- if (pPlayerEntity && pPlayerEntity->IsAlive() && !pPlayerEntity->IsDormant() && strstr(ModelName, "models/player") && Globals::LocalPlayer && pPlayerEntity == Globals::LocalPlayer) {
- if (Globals::LocalPlayer->IsScoped())
- {
- g_pRenderView->SetBlend(0.4f);
- }
- }
- if (info.index == g_pEngine->GetLocalPlayer() && strstr(ModelName, "models/player")) {
- g_pRenderView->GetColorModulation(old_color);
- if (c_config::get().fakechams) {
- g_pModelRender->ForcedMaterialOverride(pulse);
- g_pRenderView->SetColorModulation(colorfl);
- oDrawModelExecute(ecx, context, state, info, local_last_bone_matrix);
- g_pRenderView->SetColorModulation(old_color);
- g_pModelRender->ForcedMaterialOverride(NULL);
- }
- }
- if (c_config::get().removals[4]) {
- static IMaterial* flash = g_pMaterialSys->FindMaterial("effects\\flashbang", "ClientEffect textures");
- static IMaterial* flashWhite = g_pMaterialSys->FindMaterial("effects\\flashbang_white", "ClientEffect textures");
- flash->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
- flashWhite->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
- }
- float flColor[3] = { 0.f };
- bool gunchams = c_config::get().gunchams;
- int typamodel = c_config::get().modelgun;
- IMaterial* matGun = materials2.at(c_config::get().modelgun);
- float colorGun[3] = { c_config::get().gun_chams_color_r / 255.f, c_config::get().gun_chams_color_g / 255.f, c_config::get().gun_chams_color_b / 255.f };
- IMaterial* matSleeves = materials2.at(c_config::get().modelsleeves);
- float colorSleeves[3] = { c_config::get().sleeves_chams_color_r / 255.f, c_config::get().sleeves_chams_color_g / 255.f, c_config::get().sleeves_chams_color_b / 255.f };
- if (strstr(ModelName, "models/weapons/v_") && !strstr(ModelName, "arms") && gunchams) {
- g_pRenderView->SetBlend(c_config::get().gun_chams_color_a / 255.f);
- g_pRenderView->SetColorModulation(colorGun);
- g_pModelRender->ForcedMaterialOverride(matGun);
- oDrawModelExecute(ecx, context, state, info, matrix);
- }
- if (strstr(ModelName, "v_sleeve") && c_config::get().sleevechams) {
- g_pRenderView->SetBlend(c_config::get().sleeves_chams_color_a / 255.f);
- g_pRenderView->SetColorModulation(colorSleeves);
- g_pModelRender->ForcedMaterialOverride(matSleeves);
- oDrawModelExecute(ecx, context, state, info, matrix);
- }
- if (c_config::get().btchams2) {
- static IMaterial* btchammat = g_pMaterialSys->FindMaterial("models/inventory_items/dogtags/dogtags_outline", "Model textures");
- btchammat->AlphaModulate(0.30f);
- btchammat->ColorModulate(c_config::get().bta_color_r / 255.0f, c_config::get().bta_color_g / 255.0f, c_config::get().bta_color_b / 255.0f);
- btchammat->SetMaterialVarFlag(MATERIAL_VAR_IGNOREZ, true);
- C_BaseEntity* ent = g_pEntityList->GetClientEntity(info.index);
- if (Globals::LocalPlayer && ent && ent != Globals::LocalPlayer && !ent->IsDormant() && ent->IsAlive() && ent->GetTeam() != Globals::LocalPlayer->GetTeam() && Globals::LocalPlayer->IsAlive())
- {
- for (int t = 0; t < g_LagComp.PlayerRecord[ent->EntIndex()].size(); t++)
- {
- if (g_LagComp.PlayerRecord[ent->EntIndex()].at(t).Matrix && g_LagComp.PlayerRecord[ent->EntIndex()].at(t).SimTime && g_LagComp.PlayerRecord[ent->EntIndex()].at(t).Matrix)
- {
- if (g_LagComp.PlayerRecord[ent->EntIndex()].size() > 1 && ent->GetVelocity().Length() > 1)
- {
- g_pModelRender->ForcedMaterialOverride(btchammat);
- //Record = g_LagComp.PlayerRecord[info.index].size() - 1; //use this if u want 1 record and remove the for loop
- //if (g_LagComp.ShotTick[info.index] != -1)
- // Record = g_LagComp.ShotTick[info.index];
- oDrawModelExecute(ecx, context, state, info, g_LagComp.PlayerRecord[info.index].at(t).Matrix);
- g_pModelRender->ForcedMaterialOverride(nullptr);
- }
- }
- }
- }
- }
- oDrawModelExecute(ecx, context, state, info, matrix);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement