fix: Sometimes C4 Position bugged if you look behind the C4, or C4 Screen Pos not in Screen Area

This commit is contained in:
tokinaa
2023-10-24 14:55:24 +07:00
parent aa163a178b
commit c6031adcce
+28 -20
View File
@@ -40,29 +40,37 @@ namespace hack {
const Vector3 c4ScreenPos = c4Origin.world_to_screen(view_matrix); const Vector3 c4ScreenPos = c4Origin.world_to_screen(view_matrix);
float distance = localOrigin.calculate_distance(c4Origin); /**
float roundedDistance = std::round(distance / 500.f); * Sometimes C4 Position bugged if you look behind the C4, or C4 Screen Pos not in Screen Area
*
* Tested in my side
*/
float height = 10 - roundedDistance; if (c4ScreenPos.z >= 0.01f) {
float width = height * 1.4f; float distance = localOrigin.calculate_distance(c4Origin);
float roundedDistance = std::round(distance / 500.f);
render::DrawFilledBox( float height = 10 - roundedDistance;
g::hdcBuffer, float width = height * 1.4f;
c4ScreenPos.x - (width / 2),
c4ScreenPos.y - (height / 2),
width,
height,
config::esp_box_color_enemy
);
render::RenderText( render::DrawFilledBox(
g::hdcBuffer, g::hdcBuffer,
c4ScreenPos.x + (width / 2 + 5), c4ScreenPos.x - (width / 2),
c4ScreenPos.y, c4ScreenPos.y - (height / 2),
"C4", width,
config::esp_name_color, height,
10 config::esp_box_color_enemy
); );
render::RenderText(
g::hdcBuffer,
c4ScreenPos.x + (width / 2 + 5),
c4ScreenPos.y,
"C4",
config::esp_name_color,
10
);
}
} }
int playerIndex = 0; int playerIndex = 0;