Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.02 KB | None | 0 0
  1. void __fastcall Hooked_DrawModelExecute(void* thisptr, int edx, void* ctx, void* state, const ModelRenderInfo_t &pInfo, matrix3x4 *pCustomBoneToWorld)
  2. {
  3. Color color;
  4. float flColor[3] = { 0.f };
  5. static IMaterial* CoveredLit = CreateMaterial(true);
  6. static IMaterial* OpenLit = CreateMaterial(false);
  7. static IMaterial* CoveredFlat = CreateMaterial(true, false);
  8. static IMaterial* OpenFlat = CreateMaterial(false, false);
  9. bool DontDraw = false;
  10.  
  11. const char* ModelName = Interfaces::ModelInfo->GetModelName((model_t*)pInfo.pModel);
  12. IClientEntity* pModelEntity = (IClientEntity*)Interfaces::EntList->GetClientEntity(pInfo.entity_index);
  13. IClientEntity* pLocal = (IClientEntity*)Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
  14.  
  15. if (Menu::Window.VisualsTab.Active.GetState())
  16. {
  17. // Player Chams
  18. int ChamsStyle = Menu::Window.VisualsTab.OptionsChams.GetIndex();
  19. int HandsStyle = Menu::Window.VisualsTab.OtherNoHands.GetIndex();
  20. if (ChamsStyle != 0 && Menu::Window.VisualsTab.FiltersPlayers.GetState() && strstr(ModelName, "models/player"))
  21. {
  22. if (pLocal /* && (!Menu::Window.VisualsTab.FiltersEnemiesOnly.GetState() || pModelEntity->GetTeamNum() != pLocal->GetTeamNum())*/)
  23. {
  24. IMaterial *covered = ChamsStyle == 1 ? CoveredLit : CoveredFlat;
  25. IMaterial *open = ChamsStyle == 1 ? OpenLit : OpenFlat;
  26.  
  27. IClientEntity* pModelEntity = (IClientEntity*)Interfaces::EntList->GetClientEntity(pInfo.entity_index);
  28. if (pModelEntity)
  29. {
  30. IClientEntity *local = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
  31. if (local)
  32. {
  33. if (pModelEntity->IsAlive() && pModelEntity->GetHealth() > 0 /*&& pModelEntity->GetTeamNum() != local->GetTeamNum()*/)
  34. {
  35. float alpha = 1.f;
  36.  
  37. if (pModelEntity->HasGunGameImmunity())
  38. alpha = 0.5f;
  39.  
  40. if (pModelEntity->GetTeamNum() == 2)
  41. {
  42. flColor[0] = 240.f / 255.f;
  43. flColor[1] = 30.f / 255.f;
  44. flColor[2] = 35.f / 255.f;
  45. }
  46. else
  47. {
  48. flColor[0] = 63.f / 255.f;
  49. flColor[1] = 72.f / 255.f;
  50. flColor[2] = 205.f / 255.f;
  51. }
  52.  
  53. Interfaces::RenderView->SetColorModulation(flColor);
  54. Interfaces::RenderView->SetBlend(alpha);
  55. Interfaces::ModelRender->ForcedMaterialOverride(covered);
  56. oDrawModelExecute(thisptr, ctx, state, pInfo, pCustomBoneToWorld);
  57.  
  58. if (pModelEntity->GetTeamNum() == 2)
  59. {
  60. flColor[0] = 247.f / 255.f;
  61. flColor[1] = 180.f / 255.f;
  62. flColor[2] = 20.f / 255.f;
  63. }
  64. else
  65. {
  66. flColor[0] = 32.f / 255.f;
  67. flColor[1] = 180.f / 255.f;
  68. flColor[2] = 57.f / 255.f;
  69. }
  70.  
  71. Interfaces::RenderView->SetColorModulation(flColor);
  72. Interfaces::RenderView->SetBlend(alpha);
  73. Interfaces::ModelRender->ForcedMaterialOverride(open);
  74. }
  75. else
  76. {
  77. color.SetColor(255, 255, 255, 255);
  78. ForceMaterial(color, open);
  79. }
  80. }
  81. }
  82. }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement