Тьомчик
-
Автор темы
- #1
pixelsurf_data.hpp:
struct ps_data
{
Vector start_pos = Vector(0,0,0);
Vector end_pos = Vector(0, 0, 0);
bool first_placed = false;
bool line_done = false;
};
std::unordered_map<std::string, ps_data> ps_info;
void ps_database(const float& old_velocity_z, const Vector& old_origin);
void ps_draw_info();
C++:
void Movement::ps_database(const float& old_velocity_z, const Vector& old_origin)
{
if (!g_EngineClient->IsConnected() || !g_EngineClient->IsInGame() || !g_LocalPlayer || !g_LocalPlayer->IsAlive())
return;
// pisun
// перемести это в LevelInitPreEntity хук и возьми оттуда mapname
// вместо old_velocity_z и old_origin используй данные, которые ты получаешь для пс перед предиктом
std::string map_name = std::string(g_ClientState->m_szLevelName);
auto data = ps_info.find(map_name);
if (data == ps_info.end())
ps_info.insert({ map_name, ps_data{} });
if (old_velocity_z == -6.25f && g_LocalPlayer->m_vecVelocity().z == -6.25f && !data->second.first_placed)
{
data->second.start_pos = g_LocalPlayer->m_vecOrigin();
data->second.first_placed = true;
data->second.line_done = false;
}
else if (old_velocity_z == -6.25f && g_LocalPlayer->m_vecVelocity().z != -6.25f && data->second.first_placed)
{
data->second.end_pos = old_origin;
data->second.first_placed = false;
data->second.line_done = true;
}
}
void Movement::ps_draw_info()
{
if (!g_EngineClient->IsConnected() || !g_EngineClient->IsInGame() || !g_LocalPlayer || !g_LocalPlayer->IsAlive())
return;
if (ps_info.empty())
return;
for (auto&[map_name, data] : ps_info)
{
if (!data.line_done)
continue;
Vector start, end;
if (Math::WorldToScreen(data.start_pos, start) && Math::WorldToScreen(data.end_pos, end))
{
Render::Get().RenderLine(start.x, start.y, end.x, end.y, Color::White, 2.f);
}
}
}
thanks me for leak it