Checking rendering items out of bounds when looking at the ground & removed handle hijack because of not working properly
This commit is contained in:
@@ -12,3 +12,8 @@ void Utils::update_console_title() {
|
||||
|
||||
SetConsoleTitle(title.c_str());
|
||||
}
|
||||
|
||||
|
||||
bool Utils::is_in_bounds(const Vector3& pos, int width, int heigh) {
|
||||
return pos.x >= 0 && pos.x <= width && pos.y >= 0 && pos.y <= heigh;
|
||||
}
|
||||
@@ -3,11 +3,13 @@
|
||||
#include <string>
|
||||
|
||||
#include "config.hpp"
|
||||
#include "vector.hpp"
|
||||
|
||||
class Utils {
|
||||
private:
|
||||
public:
|
||||
void update_console_title();
|
||||
bool is_in_bounds(const Vector3& pos, int width, int heigh);
|
||||
};
|
||||
|
||||
inline Utils utils;
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "../classes/globals.hpp"
|
||||
|
||||
namespace hack {
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> boneConnections = {
|
||||
{"neck_0", "spine_1"},
|
||||
{"spine_1", "spine_2"},
|
||||
@@ -27,7 +26,7 @@ namespace hack {
|
||||
|
||||
void loop() {
|
||||
|
||||
std::lock_guard<std::mutex> lock(dataMutex);
|
||||
std::lock_guard<std::mutex> lock(reader_mutex);
|
||||
|
||||
if (g_game.isC4Planted)
|
||||
{
|
||||
@@ -73,7 +72,12 @@ namespace hack {
|
||||
const Vector3 screenPos = g_game.world_to_screen(&player->origin);
|
||||
const Vector3 screenHead = g_game.world_to_screen(&player->head);
|
||||
|
||||
if (screenPos.z >= 0.01f) {
|
||||
if (
|
||||
screenPos.z < 0.01f ||
|
||||
!utils.is_in_bounds(screenPos, g_game.game_bounds.right, g_game.game_bounds.bottom)
|
||||
)
|
||||
continue;
|
||||
|
||||
const float height = screenPos.y - screenHead.y;
|
||||
const float width = height / 2.4f;
|
||||
|
||||
@@ -234,7 +238,6 @@ namespace hack {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ void CGame::init() {
|
||||
std::cout << "[cs2] Waiting for cs2.exe..." << std::endl;
|
||||
|
||||
process = std::make_shared<pProcess>();
|
||||
while (!process->AttachProcessHj("cs2.exe"))
|
||||
while (!process->AttachProcess("cs2.exe"))
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
|
||||
std::cout << "[cs2] Attached to cs2.exe\n" << std::endl;
|
||||
@@ -68,8 +68,7 @@ void CGame::close() {
|
||||
}
|
||||
|
||||
void CGame::loop() {
|
||||
|
||||
std::lock_guard<std::mutex> lock(dataMutex);
|
||||
std::lock_guard<std::mutex> lock(reader_mutex);
|
||||
|
||||
if (updater::offsets::dwLocalPlayerController == 0x0)
|
||||
throw std::runtime_error("Offsets have not been corretly set, cannot proceed.");
|
||||
|
||||
@@ -77,4 +77,4 @@ private:
|
||||
|
||||
inline CGame g_game;
|
||||
|
||||
inline std::mutex dataMutex;
|
||||
inline std::mutex reader_mutex;
|
||||
Reference in New Issue
Block a user