120 lines
3.3 KiB
C++
120 lines
3.3 KiB
C++
#include "inc/include.h"
|
|
|
|
void draw_bar(Context* pctx, int r, int g, int b, int a,
|
|
float flX, float flY, float flW, float flH,
|
|
int current, const int max,
|
|
bool bg = true)
|
|
{
|
|
if (current < 0)
|
|
current = 0;
|
|
|
|
if (current > max)
|
|
current = max;
|
|
|
|
flY -= flH;
|
|
|
|
const float base = flH / static_cast<float>(max) * static_cast<float>(current);
|
|
const float delta = (flH - base);
|
|
|
|
const float bar_x = flX;
|
|
|
|
if (bg)
|
|
{
|
|
render::draw_set_color(pctx, 5, 5, 5, 255);
|
|
render::draw_filled_rect(pctx, bar_x, flY, bar_x + xf(0x40A00000), flY + flH);
|
|
}
|
|
render::draw_set_color(pctx, r, g, b, a);
|
|
render::draw_filled_rect(pctx, bar_x, flY + delta, bar_x + xf(0x40A00000), flY + flH);
|
|
|
|
if (bg)
|
|
{
|
|
render::draw_set_color(pctx, 5, 5, 5, 255);
|
|
render::draw_outlined_rect(pctx, bar_x, flY, bar_x + xf(0x40A00000), flY + flH);
|
|
}
|
|
}
|
|
|
|
void esp_process_object(Context* pctx, CachedEntity* prec)
|
|
{
|
|
if(prec->signifier == 0x726579616c70 && prec->is_ally == true)
|
|
return;
|
|
|
|
if(prec->dist_to_local >= xf(0x4C189680))
|
|
return;
|
|
|
|
if(!prec->rpts_avail)
|
|
return;
|
|
|
|
auto& rpts = prec->rpts;
|
|
|
|
render::draw_set_color(pctx, 5, 5, 5, 255);
|
|
render::draw_outlined_rect(pctx, rpts.x - xf(0x3F800000), rpts.y - xf(0x3F800000), rpts.x + rpts.w + xf(0x3F800000), rpts.y + rpts.h + xf(0x3F800000));
|
|
render::draw_set_color(pctx, 65, 65, 255, 255);
|
|
render::draw_outlined_rect(pctx, rpts.x, rpts.y, rpts.x + rpts.w, rpts.y + rpts.h);
|
|
render::draw_set_color(pctx, 5, 5, 5, 255);
|
|
render::draw_outlined_rect(pctx, rpts.x + xf(0x3F800000), rpts.y + xf(0x3F800000), rpts.x + rpts.w - xf(0x3F800000), rpts.y + rpts.h - xf(0x3F800000));
|
|
|
|
draw_bar( pctx, 65, 255, 65, 255,
|
|
rpts.x - ((xf(0x41200000) / xf(0x40000000)) + xf(0x40000000)),
|
|
rpts.y + rpts.h, rpts.w, rpts.h,
|
|
prec->health, 100);
|
|
|
|
int push_y = 0;
|
|
const auto draw_pos_top_x = prec->draw_pos_top[0];
|
|
const auto draw_pos_top_y = prec->draw_pos_top[1];
|
|
|
|
if (prec->signifier == 0x726579616c70)
|
|
{
|
|
if (prec->name != nullptr)
|
|
{
|
|
pctx->pfn_draw_colored_text(*pctx->mss_ptr, 2, 12,
|
|
draw_pos_top_x,
|
|
draw_pos_top_y - push_y,
|
|
255, 255, 255, 255,
|
|
0, prec->name);
|
|
push_y += 15;
|
|
}
|
|
|
|
pctx->pfn_draw_colored_text(*pctx->mss_ptr, 2, 12,
|
|
draw_pos_top_x,
|
|
draw_pos_top_y - push_y,
|
|
255, 255, 255, 255,
|
|
0, "%iLVL", prec->level);
|
|
push_y += 14;
|
|
}
|
|
|
|
pctx->pfn_draw_colored_text(*pctx->mss_ptr, 2, 12,
|
|
draw_pos_top_x,
|
|
draw_pos_top_y - push_y,
|
|
255, 255, 255, 255,
|
|
0, "[%.0f m]",
|
|
prec->dist_to_local / xf(0x47C35000));
|
|
push_y += 14;
|
|
}
|
|
|
|
void features::esp_tick(Context* pctx)
|
|
{
|
|
|
|
}
|
|
|
|
void features::esp(Context* pctx)
|
|
{
|
|
auto me = r5::local_player(pctx);
|
|
if(!me.is_valid())
|
|
return;
|
|
|
|
if(!me.is_alive())
|
|
return;
|
|
|
|
u64 entlist_base = pctx->game_base + OFF_ENTITY_LIST;
|
|
|
|
for(size_t i = 0ull; i < pctx->state.highest_eidx; i++)
|
|
{
|
|
auto rec = &pctx->state.entity_cache[ i ];
|
|
|
|
if(rec->is_valid == false)
|
|
continue;
|
|
|
|
esp_process_object( pctx, rec );
|
|
}
|
|
}
|