Advertisement
Guest User

Untitled

a guest
May 27th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. void CEsp::DrawGrenades(IClientEntity* pEntity)
  2. {
  3.  
  4.  
  5. Vector vGrenadePos2D = Vector(0.f, 0.f, 0.f);
  6. Vector vGrenadePos3D = Vector(0.f, 0.f, 0.f);
  7. float fGrenadeModelSize = 0.0f;
  8. Color colGrenadeColor = Color(0, 0, 0, 0);
  9. const model_t *model = pEntity->GetModel();
  10.  
  11. if (pEntity->GetClientClass())
  12. {
  13. if (model)
  14. {
  15. studiohdr_t* hdr = Interfaces::ModelInfo->GetStudiomodel(model);
  16. if (hdr)
  17. {
  18. std::string hdrName = hdr->name;
  19. if (hdrName.find("thrown") != std::string::npos)
  20. {
  21. vGrenadePos3D = pEntity->GetOrigin();
  22. fGrenadeModelSize = hdr->hull_max.DistTo(hdr->hull_min);
  23.  
  24. if (!Render::WorldToScreen(vGrenadePos3D, vGrenadePos2D))
  25. return;
  26.  
  27. if (hdrName.find("flash") != std::string::npos)
  28. {
  29. //Warning color
  30. colGrenadeColor = Color(0, 0, 200, 255);
  31. }
  32. else if (hdrName.find("incendiarygrenade") != std::string::npos || hdrName.find("molotov") != std::string::npos || hdrName.find("fraggrenade") != std::string::npos)
  33. {
  34. //Dangerous color
  35. colGrenadeColor = Color(200, 0, 0, 255);
  36. }
  37.  
  38. else if (hdrName.find("smoke") != std::string::npos || hdrName.find("decoy") != std::string::npos)
  39. {
  40. //Peaceful color
  41. colGrenadeColor = Color(0, 200, 0, 255);
  42. }
  43. DrawOutlinedCircleGranade(static_cast<int>(vGrenadePos2D.x), static_cast<int>(vGrenadePos2D.y), static_cast<int>(fGrenadeModelSize), colGrenadeColor);
  44. }
  45. }
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement