Skip to content

Commit

Permalink
HeadSkeleton
Browse files Browse the repository at this point in the history
- PlayerScreen definition method
  • Loading branch information
Izocel committed Dec 29, 2024
1 parent eb5435f commit b6c6bba
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 41 deletions.
9 changes: 8 additions & 1 deletion Application/Instances/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class Player

std::string name;
Vector3 position, viewCamPos;
Position feetScreen, eyeScreen;
Position screenFeet, screenEye, esp_p;
Dimension screen_d, esp_d;

uintptr_t listEntry, ctrl, pawnCtrl, entity, pawn;

Expand Down Expand Up @@ -90,6 +91,12 @@ class Player
return Read<T>(pawn + ptr_diff);
};

void GetEsp(Position &posOut, Dimension &dimOut)
{
posOut = this->esp_p;
dimOut = this->esp_d;
}

const bool IsAlive()
{
return health > 0;
Expand Down
49 changes: 17 additions & 32 deletions Application/Modules/EspModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,18 @@ class EspModule : public Module
this->UpdatePointers(this->rootModule);
}

void GetEspBox(const Position &TOP, const Position &BOTTOM, Position &ESP_P, Dimension &ESP_D)
void RenderPlayerSkeleton(Player &player)
{
const float HEIGHT = (BOTTOM.y - TOP.y);
const float WIDTH = HEIGHT * 0.777f;

ESP_D.h = HEIGHT * 1.1777f;
ESP_D.w = WIDTH;

ESP_P.x = BOTTOM.x - (ESP_D.w * 0.5f);
ESP_P.y = BOTTOM.y - ESP_D.h;
}

void RenderPlayerBox(const Player &player)
{
Position ESP_P;
Dimension ESP_D;
GetEspBox(player.eyeScreen, player.feetScreen, ESP_P, ESP_D);

Gui::DrawRectangle(ESP_P, ESP_D, White50);
Gui::DrawTextual(ESP_P + Position{ESP_D.w + 4, 0}, player.name.data(), 8);
Gui::DrawTextual(ESP_P + Position{ESP_D.w + 4, 16}, std::to_string(player.health).append(" HP").data(), 8, Red64);

if (player.armor)
{
Gui::DrawTextual(ESP_P + Position{ESP_D.w + 4, 32}, std::to_string(player.armor).append(" AP").data(), 8, Blue64);
}
const float headRadius = player.screen_d.h / 16;
Gui::DrawFilledCircle(player.screenEye, headRadius, Green25);
Gui::DrawCircle(player.screenEye, headRadius, White50);
}

void RenderPlayerBoxStats(const Player &player)
void RenderPlayerBoxStats(Player &player)
{
Position ESP_P;
Dimension ESP_D;
GetEspBox(player.eyeScreen, player.feetScreen, ESP_P, ESP_D);
player.GetEsp(ESP_P, ESP_D);

const float healthRatio = (float)player.health / player.maxHealth;
const float armorRatio = (float)player.armor / 100.0f;
Expand All @@ -74,14 +53,20 @@ class EspModule : public Module
Gui::DrawRectangle(BORDER_POS, BORDER_D);
}

void RenderPlayerSkeleton(const Player &player)
void RenderPlayerBox(Player &player)
{
Position ESP_P;
Dimension ESP_D;
GetEspBox(player.eyeScreen, player.feetScreen, ESP_P, ESP_D);
player.GetEsp(ESP_P, ESP_D);

Gui::DrawRectangle(ESP_P, ESP_D, White50);
Gui::DrawTextual(ESP_P + Position{ESP_D.w + 4, 0}, player.name.data(), 8);
Gui::DrawTextual(ESP_P + Position{ESP_D.w + 4, 16}, std::to_string(player.health).append(" HP").data(), 8, Red64);

Gui::DrawFilledCircle(player.eyeScreen, 32, Green25);
Gui::DrawCircle(player.eyeScreen, 32, White50);
if (player.armor)
{
Gui::DrawTextual(ESP_P + Position{ESP_D.w + 4, 32}, std::to_string(player.armor).append(" AP").data(), 8, Blue64);
}
}

public:
Expand All @@ -93,8 +78,8 @@ class EspModule : public Module
continue;

RenderPlayerSkeleton(player);
RenderPlayerBox(player);
RenderPlayerBoxStats(player);
RenderPlayerBox(player);
}

const Dimension half = GetClientDimension() / 2;
Expand Down
23 changes: 15 additions & 8 deletions Application/Modules/RootModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class RootModule : public Module
if (!player.isInitialized)
continue;

SetPlayerScreenPos(VM, player);
SetPlayerScreenDef(VM, player);

if (GetLocalPlayer_T() == player.entity)
{
Expand Down Expand Up @@ -62,17 +62,24 @@ class RootModule : public Module
FRIENDLIES = bF;
};

void SetPlayerScreenPos(const ViewMatrix &VM, Player &player)
void SetPlayerScreenDef(const ViewMatrix &VM, Player &player)
{
Position FEET, EYES;
if (Geo::Get2DVector(player.position, FEET, VM.matrix, GetClientDimension()))
{
player.feetScreen = FEET;
}

if (Geo::Get2DVector(player.viewCamPos, EYES, VM.matrix, GetClientDimension()))
{
player.eyeScreen = EYES;
player.screenEye = EYES;
if (Geo::Get2DVector(player.position, FEET, VM.matrix, GetClientDimension()))
{
player.screenFeet = FEET;
player.screen_d.h = (player.screenFeet.y - player.screenEye.y) * 1.1777f;
player.screen_d.w = player.screen_d.h * 0.777f;

player.esp_d = player.screen_d;
player.esp_p = Position{
player.screenFeet.x - (player.esp_d.w * 0.5f),
player.screenFeet.y - player.esp_d.h,
};
}
}
};

Expand Down

0 comments on commit b6c6bba

Please sign in to comment.