Advertisement
iBrooda

Untitled

Sep 21st, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.21 KB | None | 0 0
  1. void __fastcall Hooked_DrawModelExecute(void* thisptr, int edx, void* ctx, void* state, const ModelRenderInfo_t &pInfo, matrix3x4 *pCustomBoneToWorld, IClientEntity* pEntity)
  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. //float h = (size.h);
  16. int HPEnemy = 100;
  17. //float offset = (h / 4.f) + 5;
  18. //float w = h / 64.f;
  19. float health = pEntity->GetHealth();
  20. //UINT hp = h - (UINT)((h * health) / 100);
  21. int Red = 255 - (health*2.55);
  22. int Green = health*2.55;
  23.  
  24. {
  25. // Player Chams
  26. int ChamsStyle = Menu::Window.VisualsTab.OptionsChams.GetIndex();
  27. int HandsStyle = Menu::Window.VisualsTab.OtherNoHands.GetIndex();
  28. if (ChamsStyle != 0 && Menu::Window.VisualsTab.FiltersPlayers.GetState() && strstr(ModelName, "models/player"))
  29. {
  30. if (pLocal /* && (!Menu::Window.VisualsTab.FiltersEnemiesOnly.GetState() || pModelEntity->GetTeamNum() != pLocal->GetTeamNum())*/)
  31. {
  32. IMaterial *covered = ChamsStyle == 1 ? CoveredLit : CoveredFlat;
  33. IMaterial *open = ChamsStyle == 1 ? OpenLit : OpenFlat;
  34.  
  35. IClientEntity* pModelEntity = (IClientEntity*)Interfaces::EntList->GetClientEntity(pInfo.entity_index);
  36. if (pModelEntity)
  37. {
  38. IClientEntity *local = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
  39. if (local)
  40. {
  41. if (pModelEntity->IsAlive() && pModelEntity->GetHealth() > 0 /*&& pModelEntity->GetTeamNum() != local->GetTeamNum()*/)
  42. {
  43. float alpha = 1.f;
  44.  
  45. if (pModelEntity->HasGunGameImmunity())
  46. alpha = 0.5f;
  47.  
  48. if (pModelEntity->GetTeamNum() == 2)
  49. {
  50. flColor[0] = 255.f / 255.f; 255.f / 255.f;
  51. flColor[2] = 35.f / 255.f;
  52. }
  53. else
  54. {
  55. flColor[0] = 255.f / 255.f;
  56. flColor[1] = 255.f / 255.f;
  57. flColor[2] = 205.f / 255.f;
  58. }
  59.  
  60. Interfaces::RenderView->SetColorModulation(flColor);
  61. Interfaces::RenderView->SetBlend(alpha);
  62. Interfaces::ModelRender->ForcedMaterialOverride(covered);
  63. oDrawModelExecute(thisptr, ctx, state, pInfo, pCustomBoneToWorld);
  64.  
  65. if (pModelEntity->GetTeamNum() == 2)
  66. {
  67. flColor[0] = 255.f / 255.f;
  68. flColor[1] = 255.f / 255.f;
  69. flColor[2] = 0.f / 255.f;
  70. }
  71. else
  72. {
  73. flColor[0] = 0.f / 255.f;
  74. flColor[1] = 255.f / 255.f;
  75. flColor[2] = 100.f / 255.f;
  76. }
  77.  
  78. Interfaces::RenderView->SetColorModulation(flColor);
  79. Interfaces::RenderView->SetBlend(alpha);
  80. Interfaces::ModelRender->ForcedMaterialOverride(open);
  81. }
  82. else
  83. {
  84. color.SetColor(255, 255, 255, 255);
  85. ForceMaterial(color, open);
  86. }
  87. }
  88. }
  89. }
  90. }
  91. else if (HandsStyle != 0 && strstr(ModelName, "arms"))
  92. {
  93. if (HandsStyle == 1)
  94. {
  95. DontDraw = true;
  96. }
  97. else if (HandsStyle == 2)
  98. {
  99. Interfaces::RenderView->SetBlend(0.3);
  100. }
  101. else if (HandsStyle == 3)
  102. {
  103. IMaterial *covered = ChamsStyle == 1 ? CoveredLit : CoveredFlat;
  104. IMaterial *open = ChamsStyle == 1 ? OpenLit : OpenFlat;
  105. if (pLocal)
  106. {
  107. if (pLocal->IsAlive())
  108. {
  109. int alpha = pLocal->HasGunGameImmunity() ? 150 : 255;
  110.  
  111. if (pLocal->GetTeamNum() == 2)
  112. color.SetColor(240, 30, 35, alpha);
  113.  
  114. else
  115. color.SetColor(63, 72, 205, alpha);
  116.  
  117.  
  118. ForceMaterial(color, covered);
  119. oDrawModelExecute(thisptr, ctx, state, pInfo, pCustomBoneToWorld);
  120.  
  121. if (pLocal->GetTeamNum() == 2)
  122. color.SetColor(247, 180, 20, alpha);
  123. else
  124. color.SetColor(32, 180, 57, alpha);
  125. }
  126. else
  127. {
  128. color.SetColor(255, 255, 255, 255);
  129.  
  130. }
  131.  
  132. ForceMaterial(color, open);
  133. }
  134. }
  135. else
  136. {
  137. static int counter = 0;
  138. static float colors[3] = { 1.f, 0.f, 0.f };
  139.  
  140. if (colors[counter] >= 1.0f)
  141. {
  142.  
  143. colors[counter] = 1.0f;
  144. counter += 1;
  145. if (counter > 2)
  146. counter = 0;
  147. }
  148. else
  149. {
  150. int prev = counter - 1;
  151. if (prev < 0) prev = 2;
  152. colors[prev] -= 0.05f;
  153. colors[counter] += 0.05f;
  154. }
  155.  
  156. Interfaces::RenderView->SetColorModulation(colors);
  157. Interfaces::RenderView->SetBlend(0.3);
  158. Interfaces::ModelRender->ForcedMaterialOverride(OpenLit);
  159. }
  160. }
  161. else if (ChamsStyle != 0 && Menu::Window.VisualsTab.FiltersWeapons.GetState() && strstr(ModelName, "_dropped.mdl"))
  162. {
  163. IMaterial *covered = ChamsStyle == 1 ? CoveredLit : CoveredFlat;
  164. color.SetColor(255, 255, 255, 255);
  165. ForceMaterial(color, covered);
  166. }
  167. }
  168.  
  169. if (!DontDraw)
  170. oDrawModelExecute(thisptr, ctx, state, pInfo, pCustomBoneToWorld);
  171. Interfaces::ModelRender->ForcedMaterialOverride(NULL);
  172. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement