Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.37 KB | None | 0 0
  1. void __fastcall Hooks::DrawModelExecute(void* ecx, void* edx, IMatRenderContext* context, const DrawModelState_t& state, const ModelRenderInfo_t& info, matrix3x4_t* matrix)
  2. {
  3. static auto oDrawModelExecute = g_Hooks.pModelHook->GetOriginal<DrawModelExecute_t>(vtable_indexes::dme);
  4.  
  5. const char* ModelName = g_pModelInfo->GetModelName((model_t*)info.pModel);
  6.  
  7. C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(info.index);
  8.  
  9.  
  10. static std::vector< IMaterial * > materials;
  11.  
  12. static bool once{ false };
  13. if (!once) {
  14. materials.push_back(create_material(true, false, false)); // material.
  15. materials.push_back(create_material(false, false, false, 0)); // flat.
  16. materials.push_back(create_material(true, false, true)); // material zignore.
  17. materials.push_back(create_material(false, false, true)); // flat zignore.
  18. once = true;
  19. }
  20. /*
  21. IMaterial *materials[32];
  22. studiohdr_t* hdr = g_pModelInfo->GetStudiomodel(info.pModel);
  23. g_pModelInfo->GetModelMaterials(info.pModel, hdr->numtextures, materials);
  24.  
  25. for (int i = 0; i < hdr->numtextures; i++)
  26. {
  27. IMaterial* mathands = materials[i];
  28. if (!mathands)
  29. continue;
  30.  
  31. mathands->SetMaterialVarFlag(MATERIAL_VAR_WIREFRAME, c_config::get().wireframe_arms);
  32. }
  33. */
  34.  
  35. static std::vector< IMaterial* > materials2;
  36.  
  37. static bool once2{ false };
  38. if (!once2) {
  39. materials2.push_back(create_material(false, false, false, 0)); //Flat
  40. materials2.push_back(create_material(true, false, false)); // Material
  41. materials2.push_back(create_material(true, true, false)); // Wireframe
  42. materials2.push_back(g_pMaterialSys->FindMaterial("models/inventory_items/dogtags/dogtags_outline", "Model textures")); //Pulse
  43. materials2.push_back(g_pMaterialSys->FindMaterial("glowOverlay", "Model textures")); //eso
  44. once2 = true;
  45. }
  46.  
  47.  
  48. static IMaterial* pulse = g_pMaterialSys->FindMaterial("models/inventory_items/dogtags/dogtags_outline", "Model textures");
  49.  
  50. float old_color[3] = { 0.f };
  51.  
  52. float colorde[3] = { 0.f };
  53. colorde[0] = c_config::get().desync_chams_color_r / 255.f;
  54. colorde[1] = c_config::get().desync_chams_color_g / 255.f;
  55. colorde[2] = c_config::get().desync_chams_color_b / 255.f;
  56.  
  57. 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 };
  58.  
  59. IMaterial* matLocal = materials2.at(c_config::get().localmodel);
  60. 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 };
  61.  
  62. IMaterial* matEnemy = materials2.at(c_config::get().chamsenemies_model);
  63. 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 };
  64. 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 };
  65.  
  66.  
  67. 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 };
  68.  
  69.  
  70. auto HandChams = c_config::get().hand_chams;
  71. IMaterial* matHands = materials2.at(HandChams);
  72. if (strstr(ModelName, "arms") && c_config::get().handchams && !strstr(ModelName, "v_sleeve")) {
  73.  
  74. g_pRenderView->SetBlend(c_config::get().hand_chams_color_a / 255.f);
  75. g_pRenderView->SetColorModulation(hand_chams);
  76. g_pModelRender->ForcedMaterialOverride(matHands);
  77. oDrawModelExecute(ecx, context, state, info, matrix);
  78. }
  79.  
  80.  
  81.  
  82.  
  83.  
  84. if (pPlayerEntity && pPlayerEntity->IsAlive() && !pPlayerEntity->IsDormant() && strstr(ModelName, "models/player") && Globals::LocalPlayer && pPlayerEntity == Globals::LocalPlayer) {
  85. if (Globals::LocalPlayer->IsScoped())
  86. {
  87. g_pRenderView->SetBlend(0.4f);
  88. }
  89. }
  90.  
  91. if (info.index == g_pEngine->GetLocalPlayer() && strstr(ModelName, "models/player")) {
  92. g_pRenderView->GetColorModulation(old_color);
  93. if (c_config::get().fakechams) {
  94. g_pModelRender->ForcedMaterialOverride(pulse);
  95. g_pRenderView->SetColorModulation(colorfl);
  96. oDrawModelExecute(ecx, context, state, info, local_last_bone_matrix);
  97. g_pRenderView->SetColorModulation(old_color);
  98. g_pModelRender->ForcedMaterialOverride(NULL);
  99. }
  100. }
  101.  
  102. if (c_config::get().removals[4]) {
  103. static IMaterial* flash = g_pMaterialSys->FindMaterial("effects\\flashbang", "ClientEffect textures");
  104. static IMaterial* flashWhite = g_pMaterialSys->FindMaterial("effects\\flashbang_white", "ClientEffect textures");
  105.  
  106. flash->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
  107. flashWhite->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
  108. }
  109.  
  110. float flColor[3] = { 0.f };
  111.  
  112.  
  113.  
  114. bool gunchams = c_config::get().gunchams;
  115. int typamodel = c_config::get().modelgun;
  116.  
  117. IMaterial* matGun = materials2.at(c_config::get().modelgun);
  118. 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 };
  119. IMaterial* matSleeves = materials2.at(c_config::get().modelsleeves);
  120. 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 };
  121.  
  122. if (strstr(ModelName, "models/weapons/v_") && !strstr(ModelName, "arms") && gunchams) {
  123.  
  124. g_pRenderView->SetBlend(c_config::get().gun_chams_color_a / 255.f);
  125. g_pRenderView->SetColorModulation(colorGun);
  126. g_pModelRender->ForcedMaterialOverride(matGun);
  127. oDrawModelExecute(ecx, context, state, info, matrix);
  128. }
  129.  
  130. if (strstr(ModelName, "v_sleeve") && c_config::get().sleevechams) {
  131.  
  132. g_pRenderView->SetBlend(c_config::get().sleeves_chams_color_a / 255.f);
  133. g_pRenderView->SetColorModulation(colorSleeves);
  134. g_pModelRender->ForcedMaterialOverride(matSleeves);
  135. oDrawModelExecute(ecx, context, state, info, matrix);
  136.  
  137. }
  138.  
  139. if (c_config::get().btchams2) {
  140. static IMaterial* btchammat = g_pMaterialSys->FindMaterial("models/inventory_items/dogtags/dogtags_outline", "Model textures");
  141.  
  142. btchammat->AlphaModulate(0.30f);
  143. 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);
  144. btchammat->SetMaterialVarFlag(MATERIAL_VAR_IGNOREZ, true);
  145.  
  146. C_BaseEntity* ent = g_pEntityList->GetClientEntity(info.index);
  147.  
  148. if (Globals::LocalPlayer && ent && ent != Globals::LocalPlayer && !ent->IsDormant() && ent->IsAlive() && ent->GetTeam() != Globals::LocalPlayer->GetTeam() && Globals::LocalPlayer->IsAlive())
  149. {
  150. for (int t = 0; t < g_LagComp.PlayerRecord[ent->EntIndex()].size(); t++)
  151. {
  152. 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)
  153. {
  154. if (g_LagComp.PlayerRecord[ent->EntIndex()].size() > 1 && ent->GetVelocity().Length() > 1)
  155. {
  156. g_pModelRender->ForcedMaterialOverride(btchammat);
  157. //Record = g_LagComp.PlayerRecord[info.index].size() - 1; //use this if u want 1 record and remove the for loop
  158. //if (g_LagComp.ShotTick[info.index] != -1)
  159. // Record = g_LagComp.ShotTick[info.index];
  160. oDrawModelExecute(ecx, context, state, info, g_LagComp.PlayerRecord[info.index].at(t).Matrix);
  161. g_pModelRender->ForcedMaterialOverride(nullptr);
  162. }
  163. }
  164. }
  165. }
  166. }
  167.  
  168.  
  169. oDrawModelExecute(ecx, context, state, info, matrix);
  170. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement