Начинающий
-
Автор темы
- #1
Всем Привет,У меня не работает визуальная часть чита
Помогите пожалуйста, вот код:
ESP.cpp
ESP.h
PlayerESP.cpp
CustomVisuals.cpp
Помогите пожалуйста, вот код:
ESP.cpp
C++:
#include "Esp.h"
#include "../Setup.h"
void CEsp::Draw()
{
if (Enable)
{
CEntityPlayer* Local = GP_EntPlayers->EntityLocal;
auto LDraw = [&]()->void
{
if (SoundEspEnable)
SoundEsp.Draw(Local);
WorldEsp();
PlayerEsp(Local);
};
LDraw();
}
}
void CEsp::Reset()
{
if (SoundEsp.Sounds.size() > 0)
SoundEsp.Sounds.clear();
}
vector<Vector> AddedPos;
void CEsp::PlaySounds(Vector _Pos, int EntityIdx)
{
CEntityPlayer* Entity = GP_EntPlayers->FindByIdx(EntityIdx);
if (Entity)
{
if (!Entity->IsLocal)
{
for (size_t i(0); i < AddedPos.size(); i++)
if (AddedPos[i] == _Pos)
return;
if (AddedPos.size() > 100)
AddedPos.clear();
if (_Pos.DistTo(Entity->AbsOrigin) < 10.f)
{
GP_Esp->SoundEsp.Add(_Pos, Entity->Team, EntityIdx);
}
AddedPos.push_back(_Pos);
}
}
}
void CSoundEsp::Add(Vector _Pos, PLAYER_TEAM _Team, int idx)
{
SoundInfo Sound;
Sound.EndTime = I::GlobalVars()->curtime + 1.0f;
Sound.Pos = _Pos;
Sound.EntIdx = idx;
if (GP_Esp)
{
if (GP_Esp->SoundEspStyle == 1)
Sound.Size = 1.f;
else
Sound.Size = GP_Esp->SoundEspSize;
}
Sound.Team = _Team;
Sounds.push_back(Sound);
}
void CSoundEsp::Draw(CEntityPlayer* Local)
{
if (Local && GP_Esp)
{
for (size_t i = 0; i < Sounds.size(); i++)
{
Vector ScreenPos;
if (Sounds[i].Team != Local->Team ? GP_Esp->Enemy : GP_Esp->Team)
{
if (CGlobal::WorldToScreen(Sounds[i].Pos, ScreenPos))
{
float Size = GP_Esp->SoundEspSize;
switch (GP_Esp->SoundEspStyle)
{
case 0: GP_Render->DrawRing3D(Sounds[i].Pos.x, Sounds[i].Pos.y, Sounds[i].Pos.z, Size, 32, GP_Esp->SoundColor); break;
case 1:
{
if (Sounds[i].Size < Size)
Sounds[i].Size += 0.4f;
GP_Render->DrawRing3D(Sounds[i].Pos.x, Sounds[i].Pos.y, Sounds[i].Pos.z, Sounds[i].Size, 32, GP_Esp->SoundColor);
break;
}
case 2:
{
if (Sounds[i].Size > 1.f)
Sounds[i].Size -= 0.4f;
GP_Render->DrawRing3D(Sounds[i].Pos.x, Sounds[i].Pos.y, Sounds[i].Pos.z, Sounds[i].Size, 32, GP_Esp->SoundColor);
break;
}
case 3: GP_Render->DrawBox((int)ScreenPos.x - (Size / 2), (int)ScreenPos.y - (Size / 2), (int)Size, (int)Size, 1, GP_Esp->SoundColor); break;
case 4: GP_Render->DrawFilledBox((int)ScreenPos.x - (Size / 2), (int)ScreenPos.y - (Size / 2), (int)Size, (int)Size, GP_Esp->SoundColor); break;
case 5:
{
GP_Render->DrawLine((int)ScreenPos.x - (int)Size, (int)ScreenPos.y, (int)ScreenPos.x + (int)Size + 1, (int)ScreenPos.y, GP_Esp->SoundColor);
GP_Render->DrawLine((int)ScreenPos.x, (int)ScreenPos.y - (int)Size, (int)ScreenPos.x, (int)ScreenPos.y + (int)Size + 1, GP_Esp->SoundColor);
GP_Render->DrawLine((int)ScreenPos.x + (int)Size, (int)ScreenPos.y - (int)Size, (int)ScreenPos.x - (int)Size, (int)ScreenPos.y + Size, GP_Esp->SoundColor);
GP_Render->DrawLine((int)ScreenPos.x - (int)Size, (int)ScreenPos.y - (int)Size, (int)ScreenPos.x + (int)Size, (int)ScreenPos.y + Size, GP_Esp->SoundColor);
break;
}
default: break;
}
if (GP_Esp->SoundEspDistance)
{
GP_Render->DrawString(GP_Esp->TextSoundSize, Vec2((int)ScreenPos.x, (int)ScreenPos.y),
GP_Esp->SoundDistanceColor, true, true, XorStr("%6.1lfm"), Sounds[i].Pos.DistTo(Local->AbsOrigin) / 33);
}
}
}
if (Sounds[i].EndTime <= I::GlobalVars()->curtime)
if (CGlobal::IsGameReady)
Sounds.erase(Sounds.begin() + i);
}
}
}
void CEsp::SoundFrameStage(ClientFrameStage_t Stage)
{
if (Enable && SoundEspEnable)
{
if (Stage == FRAME_NET_UPDATE_END)
{
CUtlVector<SndInfo_t> sndList;
sndList.RemoveAll();
I::Sound()->GetActiveSounds(sndList);
if (sndList.Count() < 1)
return;
for (int i = 0; i < sndList.Count(); i++)
{
SndInfo_t& sound = sndList.Element(i);
if (sound.m_nSoundSource < 1)
continue;
if (!sndList[i].m_pOrigin || !sndList[i].m_nSoundSource || !sndList[i].m_bUpdatePositions || sndList[i].m_nChannel != 4)
continue;
if (CGlobal::LocalPlayer->GetAbsOrigin().DistTo(*sndList[i].m_pOrigin) > 900)
continue;
GP_Esp->PlaySounds(*sndList[i].m_pOrigin, sndList[i].m_nSoundSource);
}
}
}
}
void CEsp::InitMaterials()
{
if (!Texture)
Texture = I::MaterialSystem()->CreateMaterial("Texture", KeyValues::FromString("VertexLitGeneric", nullptr));
if (!Flat)
Flat = I::MaterialSystem()->CreateMaterial("Flat", KeyValues::FromString("UnlitGeneric", nullptr));
if (!Metallic)
Metallic = I::MaterialSystem()->CreateMaterial("Mettalic", KeyValues::FromString("VertexLitGeneric",
"$basetexture white $envmap env_cubemap $normalmapalphaenvmapmask 1 $envmapcontrast 1 $nofog 1 $model 1 $nocull 0 $selfillum 1 $halfambert 1 $znearer 0 $flat 1"));
if (!MetallicPlus)
MetallicPlus = I::MaterialSystem()->CreateMaterial("Mettalic", KeyValues::FromString("VertexLitGeneric",
"$envmap env_cubemap $envmapcontrast 1 $envmapsaturation 1.0 $phong 1 $phongexponent 15.0 $normalmapalphaenvmask 1 $phongboost 6.0"));
if (!Pearlescent)
Pearlescent = I::MaterialSystem()->CreateMaterial("Pearlescent", KeyValues::FromString("VertexLitGeneric",
"$ambientonly 1 $phong 1 $pearlescent 3 $basemapalphaphongmask 1"));
if (!Animated)
{
const auto kv = KeyValues::FromString("VertexLitGeneric",
"$basetexture white $envmap editor/cube_vertigo $envmapcontrast 1 $basetexture dev/zone_warning proxies\
{ texturescroll { texturescrollvar $basetexturetransform texturescrollrate 0.6 texturescrollangle 90 } }");
kv->SetString("$envmaptint", "[.7 .7 .7]");
Animated = I::MaterialSystem()->CreateMaterial("Animated", kv);
}
if (!GlowDef)
GlowDef = I::MaterialSystem()->CreateMaterial("GlowDefault", KeyValues::FromString("VertexLitGeneric",
"$additive 1 $envmap models/effects/cube_white $envmapfresnel 1"));
if (!GlowSPulse)
GlowSPulse = I::MaterialSystem()->FindMaterial("dev/glow_armsrace.vmt");
if (!GlowDPulse)
GlowDPulse = I::MaterialSystem()->CreateMaterial("GlowDPulse", KeyValues::FromString("VertexLitGeneric",
"$additive 1 $envmap models/effects/cube_white $envmapfresnel 1"));
}
void CEsp::OverrideMaterial(bool IgnoreZ, int dMaterial, int Type, Color RGBA, bool Glow, const float Pulse)
{
if (!Glow)
{
IMaterial* ChamsMaterial = nullptr;
switch (Type)
{
case 0: ChamsMaterial = Texture; break;
case 1: ChamsMaterial = Flat; break;
case 2: ChamsMaterial = Metallic; break;
case 3: ChamsMaterial = MetallicPlus; break;
case 4: ChamsMaterial = Pearlescent; break;
case 5: ChamsMaterial = Animated; break;
default:
break;
}
if (!ChamsMaterial || ChamsMaterial->IsErrorMaterial())
return;
if (ChamsMaterial == MetallicPlus)
{
static bool bFoundColor = false;
IMaterialVar* pMatColor = ChamsMaterial->FindVar("$envmaptint", &bFoundColor);
if (bFoundColor)
pMatColor->SetVecValue(RGBA.G1R(), RGBA.G1G(), RGBA.G1B());
}
else
ChamsMaterial->ColorModulate(RGBA.G1R(), RGBA.G1G(), RGBA.G1B());
ChamsMaterial->AlphaModulate(RGBA.G1A());
ChamsMaterial->SetMaterialVarFlag(MATERIAL_VAR_WIREFRAME, (dMaterial == 1) ? true : false);
ChamsMaterial->SetMaterialVarFlag(MATERIAL_VAR_IGNOREZ, IgnoreZ);
ChamsMaterial->IncrementReferenceCount();
I::ModelRender()->ForcedMaterialOverride(ChamsMaterial);
}
else
{
IMaterial* GlowMaterial = nullptr;
switch (Type)
{
case 0: GlowMaterial = GlowDef; break;
case 1: GlowMaterial = GlowSPulse; break;
case 2: GlowMaterial = GlowDPulse; break;
default:
break;
}
if (!GlowMaterial || GlowMaterial->IsErrorMaterial())
return;
if (GlowMaterial == GlowDPulse)
{
static bool bFoundPulse = false;
IMaterialVar* pMatPulse = GlowMaterial->FindVar("$envmapfresnelminmaxexp", &bFoundPulse);
if (bFoundPulse)
pMatPulse->SetVecComponentValue(0.5f * (1.2f - Pulse), 2);
}
static bool bFoundColor = false;
IMaterialVar* pMatColor = GlowMaterial->FindVar("$envmaptint", &bFoundColor);
if (bFoundColor)
pMatColor->SetVecValue(RGBA.G1R(), RGBA.G1G(), RGBA.G1B());
GlowMaterial->AlphaModulate(RGBA.G1A());
GlowMaterial->SetMaterialVarFlag(MATERIAL_VAR_IGNOREZ, IgnoreZ);
GlowMaterial->IncrementReferenceCount();
I::ModelRender()->ForcedMaterialOverride(GlowMaterial);
}
}
void CEsp::LoadVisuals(nlohmann::json &j)
{
#define LV(a,b) if(!j[XorStr("Esp")][XorStr("CustomVisuals")][MVItemList[i].Name][XorStr(a)].is_null()) {b = j[XorStr("Esp")][XorStr("CustomVisuals")][MVItemList[i].Name][XorStr(a)];}
if (!j[XorStr("Esp")].is_null())
{
if (!j[XorStr("Esp")][XorStr("CustomVisuals")].is_null())
{
for (int i(0); (MITypes)i < MI_MAX; i++)
{
LV("ZonePX", MVItemList[i].ZonePos.x);
LV("ZonePY", MVItemList[i].ZonePos.y);
LV("StartPX", MVItemList[i].StartPos.x);
LV("StartPY", MVItemList[i].StartPos.y);
LV("PositionPX", MVItemList[i].Position.x);
LV("PositionPY", MVItemList[i].Position.y);
LV("OffsetPX", MVItemList[i].Offset.x);
LV("OffsetPY", MVItemList[i].Offset.y);
LV("CorrectPX", MVItemList[i].Correct.x);
LV("CorrectPY", MVItemList[i].Correct.y);
LV("SizePX", MVItemList[i].Size.x);
LV("SizePY", MVItemList[i].Size.y);
LV("SizeVPX", MVItemList[i].SizeV.x);
LV("SizeVPY", MVItemList[i].SizeV.y);
LV("SizeHPX", MVItemList[i].SizeH.x);
LV("SizeHPY", MVItemList[i].SizeH.y);
LV("CenterPX", MVItemList[i].Center.x);
LV("CenterPY", MVItemList[i].Center.y);
LV("CorrectPaddingPX", MVItemList[i].CorrectPadding.x);
LV("CorrectPaddingPY", MVItemList[i].CorrectPadding.y);
LV("IsText", MVItemList[i].IsText);
if (!MVItemList[i].IsText)
{
LV("Color1R", MVItemList[i].Color1[0]);
LV("Color1G", MVItemList[i].Color1[1]);
LV("Color1B", MVItemList[i].Color1[2]);
LV("Color2R", MVItemList[i].Color2[0]);
LV("Color2G", MVItemList[i].Color2[1]);
LV("Color2B", MVItemList[i].Color2[2]);
LV("Color3R", MVItemList[i].Color3[0]);
LV("Color3G", MVItemList[i].Color3[1]);
LV("Color3B", MVItemList[i].Color3[2]);
LV("NumP1", MVItemList[i].NumParam1);
LV("NumP2", MVItemList[i].NumParam2);
LV("BoolP1", MVItemList[i].boolParam1);
LV("BoolP2", MVItemList[i].boolParam2);
LV("BoolP3", MVItemList[i].boolParam3);
}
else
{
LV("Color1R", MVItemList[i].Color1[0]);
LV("Color1G", MVItemList[i].Color1[1]);
LV("Color1B", MVItemList[i].Color1[2]);
}
LV("TexSZ", MVItemList[i].TextSize);
LV("IsEnabled", MVItemList[i].IsEnabled);
LV("Id", MVItemList[i].Id);
LV("CorrectOfstPX", MVItemList[i].CorrectOfst.x);
LV("CorrectOfstPY", MVItemList[i].CorrectOfst.y);
MVItemList[i].Side = (Sides)(int)j[XorStr("Esp")][XorStr("CustomVisuals")][MVItemList[i].Name][XorStr("Side")];
LV("ActiveIdx", MVItemList[i].ActiveIdx);
LV("LastActive", MVItemList[i].LastActive);
LV("InitMItems", MVItemList[i].InitMItems);
}
}
}
}
void CEsp::SaveVisuals(nlohmann::json &j)
{
#define SV(a,b) j[XorStr("Esp")][XorStr("CustomVisuals")][MVItemList[i].Name][XorStr(a)] = b;
for (int i(0); (MITypes)i < MI_MAX; i++)
{
SV("ZonePX", MVItemList[i].ZonePos.x);
SV("ZonePY", MVItemList[i].ZonePos.y);
SV("StartPX", MVItemList[i].StartPos.x);
SV("StartPY", MVItemList[i].StartPos.y);
SV("PositionPX", MVItemList[i].Position.x);
SV("PositionPY", MVItemList[i].Position.y);
SV("OffsetPX", MVItemList[i].Offset.x);
SV("OffsetPY", MVItemList[i].Offset.y);
SV("CorrectPX", MVItemList[i].Correct.x);
SV("CorrectPY", MVItemList[i].Correct.y);
SV("SizePX", MVItemList[i].Size.x);
SV("SizePY", MVItemList[i].Size.y);
SV("SizeVPX", MVItemList[i].SizeV.x);
SV("SizeVPY", MVItemList[i].SizeV.y);
SV("SizeHPX", MVItemList[i].SizeH.x);
SV("SizeHPY", MVItemList[i].SizeH.y);
SV("CenterPX", MVItemList[i].Center.x);
SV("CenterPY", MVItemList[i].Center.y);
SV("CorrectPaddingPX", MVItemList[i].CorrectPadding.x);
SV("CorrectPaddingPY", MVItemList[i].CorrectPadding.y);
SV("IsText", MVItemList[i].IsText);
if (!MVItemList[i].IsText)
{
SV("Color1R", MVItemList[i].Color1[0]);
SV("Color1G", MVItemList[i].Color1[1]);
SV("Color1B", MVItemList[i].Color1[2]);
SV("Color2R", MVItemList[i].Color2[0]);
SV("Color2G", MVItemList[i].Color2[1]);
SV("Color2B", MVItemList[i].Color2[2]);
SV("Color3R", MVItemList[i].Color3[0]);
SV("Color3G", MVItemList[i].Color3[1]);
SV("Color3B", MVItemList[i].Color3[2]);
SV("NumP1", MVItemList[i].NumParam1);
SV("NumP2", MVItemList[i].NumParam2);
SV("BoolP1", MVItemList[i].boolParam1);
SV("BoolP2", MVItemList[i].boolParam2);
SV("BoolP3", MVItemList[i].boolParam3);
}
else
{
SV("Color1R", MVItemList[i].Color1[0]);
SV("Color1G", MVItemList[i].Color1[1]);
SV("Color1B", MVItemList[i].Color1[2]);
}
SV("TexSZ", MVItemList[i].TextSize);
SV("IsEnabled", MVItemList[i].IsEnabled);
SV("Id", MVItemList[i].Id);
SV("CorrectOfstPX", MVItemList[i].CorrectOfst.x);
SV("CorrectOfstPY", MVItemList[i].CorrectOfst.y);
SV("Side", (int)MVItemList[i].Side);
SV("ActiveIdx", MVItemList[i].ActiveIdx);
SV("LastActive", MVItemList[i].LastActive);
SV("InitMItems", MVItemList[i].InitMItems);
}
}
C++:
#pragma once
#include "../../Engine/Engine.h"
#include "../../Render/DXOverlayManager.h"
#include "../Settings.h"
#include "../../X1API/MinHook/hook.h"
#define DORMANT_TIME 0.37f
namespace HookTables
{
using DrawModelExecuteFn = void(__thiscall*)(void*, IMatRenderContext*, const DrawModelState_t&,
const ModelRenderInfo_t&, matrix3x4_t*);
extern cDetour<DrawModelExecuteFn>* pDrawModelExecute;
}
class ISoundEsp
{
protected:
virtual void Add(Vector _Pos, PLAYER_TEAM _Team, int idx) = 0;
virtual void Draw(CEntityPlayer* Local) = 0;
};
class CSoundEsp : public ISoundEsp
{
public:
struct SoundInfo
{
Vector Pos;
float Size;
float EndTime;
int EntIdx;
PLAYER_TEAM Team;
};
vector<SoundInfo> Sounds;
virtual void Draw(CEntityPlayer* Local);
virtual void Add(Vector _Pos, PLAYER_TEAM _Team, int idx);
};
class IEsp
{
public:
virtual void SoundFrameStage(ClientFrameStage_t Stage) = 0;
virtual void Draw() = 0;
virtual void PlayerEsp(CEntityPlayer* Local) = 0;
virtual void SetPlayerAlpha(float NewAlph) = 0;
virtual void ResetPlayerAlpha() = 0;
virtual void DrawPlayerEx(CEntityPlayer* Entity, CEntityPlayer* Local, bool IsDormant) = 0;
virtual void DrawSkeletonLine(int point1, int point2, CEntityPlayer* Entity) = 0;
virtual void Draw3DBox(CEntityPlayer* Entity, Color color) = 0;
virtual void InitMaterials() = 0;
vector<float> OldAlphs;
};
class CEsp : public IEsp
{
public:
enum Sides
{
LEFT_S,
RIGHT_S,
TOP_S,
DOWN_S,
LEFT_TOP_S,
RIGHT_TOP_S,
LEFT_DOWN_S,
RIGHT_DOWN_S,
DOWN_LEFT_DOWN_S,
DOWN_RIGHT_DOWN_S,
CENTER_LEFT_S,
CENTER_RIGHT_S,
};
struct MoveStruct
{
Vec2 ZonePos;
Vec2 StartPos;
Vec2 Position;
Vec2 Offset;
Vec2 Correct;
Vec2 Size;
Vec2 SizeV;
Vec2 SizeH;
Vec2 Center;
Vec2 CorrectPadding;
string Name;
Color Color1;
Color Color2;
Color Color3;
int NumParam1 = 4;
int NumParam2 = 5;
int TextSize = 17;
bool boolParam1 = true;
bool boolParam2 = true;
bool boolParam3 = false;
bool IsHover = false;
bool Set = false;
bool IsText = false;
bool IsEnabled = false;
int Id = -2;
Vector CorrectOfst;
Sides Side = LEFT_S;
static int ActiveIdx;
static int LastActive;
static bool InitMItems;
};//переписать
enum MITypes : int
{
MI_HEALTH_BAR = 0,
MI_ARMOR_BAR = 1,
MI_NAME_TEXT = 2,
MI_WEAPON_TEXT = 3,
MI_AMMO_TEXT = 4,
MI_DISTANCE_TEXT = 5,
MI_MONEY_TEXT = 6,
MI_SCOPE_TEXT = 7,
MI_FLASHED_TEXT = 8,
MI_DEFUSING_TEXT = 9,
MI_HEALTH_TEXT = 10,
MI_ARMOR_TEXT = 11,
MI_MAX
};//переписать
vector<MoveStruct> MVItemList;
void Move(MoveStruct &Cont, bool IsPressed, Vec2 MouseP, Vec2 StartP, Vec2 CLines, bool IsText = false); //переписать
enum Orent
{
HORIZONTAL,
VERTICAL
};
CConfig Config = CConfig(XorStr("Esp"));
virtual void SoundFrameStage(ClientFrameStage_t Stage);
virtual void Draw();
virtual void PlayerEsp(CEntityPlayer* Local);
virtual void WorldEsp();
virtual void SetPlayerAlpha(float NewAlph);
virtual void ResetPlayerAlpha();
virtual void DrawPlayerEx(CEntityPlayer* Entity, CEntityPlayer* Local, bool IsDormant);
virtual void DrawSkeletonLine(int point1, int point2, CEntityPlayer* Entity);
virtual void Draw3DBox(CEntityPlayer* Entity, Color color);
virtual void InitMaterials();
virtual void OverrideMaterial(bool IgnoreZ, int dMaterial, int Type, Color RGBA, bool Glow = false, const float Pulse = 0);
virtual void DrawModelExecute(void* thisptr, IMatRenderContext* ctx, const DrawModelState_t& state, const ModelRenderInfo_t& pInfo, matrix3x4_t* pCustomBoneToWorld);
void PlaySounds(Vector _Pos, int EntityIdx);
void Reset();
void DrawBar(Orent O, float x, float y, float w, float h, float val, bool Outline, Color MainC1, Color cBack, bool bBack, int Razd, bool Revers, Color OutlineCol);//переписать
void InitVisuals();//переписать
void VisualPreview(); //переписать
void CustomVisuals(Vec2 Start); //переписать
virtual void DrawBombInfo(CBaseEntity* entity, CBaseEntity* Local);
void SaveVisuals(nlohmann::json &j);
void LoadVisuals(nlohmann::json &j);
void Menu();
/*Material for chams/glow*/
IMaterial* Texture = nullptr;
IMaterial* Flat = nullptr;
IMaterial* Metallic = nullptr;
IMaterial* MetallicPlus = nullptr;
IMaterial* Pearlescent = nullptr;
IMaterial* Animated = nullptr;
IMaterial* GlowDef = nullptr;
IMaterial* GlowSPulse = nullptr;
IMaterial* GlowDPulse = nullptr;
/*=======================*/
bool ShowPreview = true;
CBind BindEnable = CBind(0x4E);
CSoundEsp SoundEsp;
bool Enable = true;
bool Enemy = false;
bool Team = false;
bool BoxEnable = false;
bool BoxVisibleOnly = false;
int BoxStyle = 0;
int BoxSize = 10;
bool BoxOutline = false;
bool Glow = false;
bool GlowVisibleOnly = false;
int GlowStyle = 0;
int GlowPulseSpeed = 0;
float GlowPulseRange = 0;
bool Chams = false;
bool ChamsVisibleOnly = false;
int ChamsStyle = 0;
int ChamsDouble = 0;
bool FillBox = false;
bool HeadEsp = false;
bool Line = false;
bool Skeleton = false;
bool SoundEspEnable = false;
int SoundEspStyle = 0;
int SoundEspSize = 20;
bool SoundEspDistance = false;
bool WorldGrenade = false;
int WorldGrenadeStyle = 0;
bool WorldWeapons = false;
int WorldWeaponsStyle = 0;
bool WorldBomb = false;
int WorldBombStyle = 0;
bool WorldBombInfo = false;
bool GranadePrediction = false;
bool Health = false;
int HealthStyle = 0;
bool Armor = false;
int ArmorStyle = 0;
bool Distance = false;
bool Weapon = false;
int WeaponStyle = 0;
bool Ammo = false;
int AmmoStyle = 0;
bool Name = false;
bool NameBackground = false;
bool Money = false;
bool Flashing = false;
bool Defusing = false;
bool Scope = false;
int TextNameSize = 15;
int TextWeaponSize = 15;
int TextAmmoSize = 15;
int TextDistanceSize = 15;
int TextMoneySize = 15;
int TextScopedSize = 15;
int TextFlashedSize = 15;
int TextDefusingSize = 15;
int TextHealthSize = 15;
int TextArmorSize = 15;
int TextSoundSize = 15;
int TextGrenadeSize = 15;
int TextBombSize = 15;
int TextWorldWeaponSize = 15;
Color BoxCT = Color(255, 0, 0, 255);
Color BoxTT = Color(255, 0, 0, 255);
Color BoxVisibleCT = Color(0, 255, 0, 255);
Color BoxVisibleTT = Color(0, 255, 0, 255);
Color GlowCT = Color(255, 0, 0, 255);
Color GlowTT = Color(255, 0, 0, 255);
Color GlowVisibleCT = Color(0, 255, 0, 255);
Color GlowVisibleTT = Color(0, 255, 0, 255);
Color ChamsCT = Color(255, 0, 0, 255);
Color ChamsTT = Color(255, 0, 0, 255);
Color ChamsVisibleCT = Color(0, 255, 0, 255);
Color ChamsVisibleTT = Color(0, 255, 0, 255);
Color FillBoxColor = Color(10, 255, 10, 40);
Color HeadEspColor = Color(10, 255, 255, 255);
Color LineColor = Color(10, 255, 255, 255);
Color SkeletonColor = Color(100, 0, 255, 255);
Color SoundColor = Color(255, 255, 255, 255);
Color SoundDistanceColor = Color(255, 255, 255, 255);
Color HEGrenadeColor = Color(255, 164, 0, 255);
Color MolotovGrenadeColor = Color(255, 0, 0, 255);
Color FlashGrenadeColor = Color(255, 255, 0, 255);
Color IncGrenadeColor = Color(255, 0, 0, 255);
Color SmokeGrenadeColor = Color(0, 141, 255, 255);
Color DecoyGrenadeColor = Color(255, 255, 255, 255);
Color WorldWeaponsColor = Color(255, 255, 255, 255);
Color WorldBombColor = Color(50, 255, 0, 255);
Color GranadePredictionColor = Color(228, 255, 0, 255);
Color HealthColor = Color(0, 255, 0, 255);
Color HealthColor2 = Color(255, 0, 0, 255);
Color HealthColor3 = Color(0, 0, 0, 255);
Color ArmorColor = Color(255, 255, 255, 255);
Color ArmorColor2 = Color(255, 0, 0, 255);
Color ArmorColor3 = Color(0, 0, 0, 255);
Color DistanceColor = Color(255, 255, 255, 255);
Color WeaponColor = Color(255, 255, 255, 255);
Color AmmoColor = Color(255, 255, 255, 255);
Color NameColor = Color(255, 255, 255, 255);
Color NameColorBack = Color(10, 10, 10, 255);
Color MoneyColor = Color(255, 255, 255, 255);
Color FlashingColor = Color(255, 255, 255, 255);
Color DefusingColor = Color(255, 255, 255, 255);
Color ScopeColor = Color(255, 255, 255, 255);
CEsp()
{
for (int i(0); (MITypes)i < MI_MAX; i++)
MVItemList.push_back(MoveStruct());
RV(Enable, "Enable");
RV(BoxEnable, "BoxEnable");
RV(BoxSize, "BoxSize");
RV(BoxCT, "BoxCT");
RV(BoxTT, "BoxTT");
RV(BoxVisibleCT, "BoxVisibleCT");
RV(BoxVisibleTT, "BoxVisibleTT");
RV(GlowCT, "GlowCT");
RV(GlowTT, "GlowTT");
RV(GlowVisibleCT, "GlowVisbleCT");
RV(GlowVisibleTT, "GlowVisbleTT");
RV(ChamsCT, "ChamsCT");
RV(ChamsTT, "ChamsTT");
RV(ChamsVisibleCT, "ChamsVisibleCT");
RV(ChamsVisibleTT, "ChamsVisibleTT");
RV(FillBoxColor, "FillBoxColor");
RV(HeadEspColor, "HeadEspColor");
RV(LineColor, "LineColor");
RV(SkeletonColor, "SkeletonColor");
RV(SoundColor, "SoundColor");
RV(HEGrenadeColor, "HEGrenadeColor");
RV(MolotovGrenadeColor, "MolotovGrenadeColor");
RV(FlashGrenadeColor, "FlashGrenadeColor");
RV(IncGrenadeColor, "IncGrenadeColor");
RV(SmokeGrenadeColor, "SmokeGrenadeColor");
RV(DecoyGrenadeColor, "DecoyGrenadeColor");
RV(WorldWeaponsColor, "WorldWeaponsColor");
RV(WorldBombColor, "WorldBombColor");
RV(GranadePredictionColor, "GranadePredictionColor");
RV(HealthColor, "HealthColor");
RV(HealthColor2, "HealthColor2");
RV(HealthColor3, "HealthColor3");
RV(ArmorColor, "ArmorColor");
RV(ArmorColor2, "ArmorColor2");
RV(ArmorColor3, "ArmorColor3");
RV(DistanceColor, "DistanceColor");
RV(WeaponColor, "WeaponColor");
RV(AmmoColor, "AmmoColor");
RV(NameColor, "NameColor");
RV(NameColorBack, "NameColorBack");
RV(MoneyColor, "MoneyColor");
RV(FlashingColor, "FlashingColor");
RV(DefusingColor, "DefusingColor");
RV(ScopeColor, "ScopeColor");
RV(SoundDistanceColor, "SoundDistanceColor");
RV(Enemy, "Enemy");
RV(Team, "Team");
RV(BoxEnable, "BoxEnable");
RV(BoxVisibleOnly, "BoxVisbleOnly");
RV(BoxStyle, "BoxStyle");
RV(BoxSize, "BoxSize");
RV(BoxOutline, "BoxOutline");
RV(Glow, "Glow");
RV(GlowVisibleOnly, "GlowVisibleOnly");
RV(GlowStyle, "GlowStyle");
RV(GlowPulseSpeed, "GlowPulseSpeed");
RV(GlowPulseRange, "GlowPulseRange");
RV(Chams, "Chams");
RV(ChamsVisibleOnly, "ChamsVisbleOnly");
RV(ChamsStyle, "ChamsStyle");
RV(ChamsDouble, "ChamsDouble");
RV(FillBox, "FillBox");
RV(HeadEsp, "HeadEsp");
RV(Line, "Line");
RV(Skeleton, "Skeleton");
RV(SoundEspEnable, "SoundEspEnable");
RV(SoundEspStyle, "SoundEspStyle");
RV(SoundEspSize, "SoundEspSize");
RV(SoundEspDistance, "SoundEspDistance");
RV(WorldGrenade, "WorldGrenade");
RV(WorldGrenadeStyle, "WorldGrenadeStyle");
RV(WorldWeapons, "WorldWeapons");
RV(WorldWeaponsStyle, "WorldWeaponsStyle");
RV(WorldBomb, "WorldBomb");
RV(WorldBombStyle, "WorldBombStyle");
RV(WorldBombInfo, "WorldBombInfo");
RV(GranadePrediction, "GranadePrediction");
RV(Health, "Health");
RV(HealthStyle, "HealthStyle");
RV(Armor, "Armor");
RV(ArmorStyle, "ArmorStyle");
RV(Distance, "Distance");
RV(Weapon, "Weapon");
RV(WeaponStyle, "WeaponStyle");
RV(Ammo, "Ammo");
RV(AmmoStyle, "AmmoStyle");
RV(Name, "Name");
RV(NameBackground, "NameBackground");
RV(Money, "Money");
RV(Flashing, "Flashing");
RV(Defusing, "Defusing");
RV(Scope, "Scope");
RV(TextNameSize, "TextNameSize");
RV(TextWeaponSize, "TextWeaponSize");
RV(TextAmmoSize, "TextAmmoSize");
RV(TextDistanceSize, "TextDistanceSize");
RV(TextMoneySize, "TextMoneySize");
RV(TextScopedSize, "TextScopedSize");
RV(TextFlashedSize, "TextFlashedSize");
RV(TextDefusingSize, "TextDefusingSize");
RV(TextHealthSize, "TextHealthSize");
RV(TextArmorSize, "TextArmorSize");
RV(TextSoundSize, "TextSoundSize");
RV(TextGrenadeSize, "TextGrenadeSize");
RV(TextBombSize, "TextBombSize");
RV(TextWorldWeaponSize, "TextWorldWeaponSize");
RV(BindEnable, "BindEnable");
ADD_LOG("Setup: CEsp sucessful\n");
}
};
C++:
#include "Esp.h"
#include "../Setup.h"
using namespace HookTables;
void CEsp::DrawPlayerEx(CEntityPlayer* Entity, CEntityPlayer* Local, bool IsDormant)
{
auto LDrawPlayerEx = [&]()->void
{
Vector OriginScreen;
Vector HeadScreen, HeadScreenOrig;
Vector OrignWorld = Entity->RenderOrigin;
Vector HeadWorld, HeadWorldOrig;
HeadWorld = Entity->HitBoxes[HITBOX_HEAD];
if (HeadWorld.IsZero() && !IsDormant)
return;
if (IsDormant)
{
OrignWorld = Entity->OldRenderOrigin;
HeadWorld = Entity->OldHead;
}
else
{
Entity->OldRenderOrigin = OrignWorld;
Entity->OldHead = HeadWorld;
}
if (!Local->IsLocal)
return;
if (!Team && Entity->Team == Local->Team)
return;
if (!Enemy && Entity->Team != Local->Team)
return;
if ((BoxVisibleOnly && !Local->IsDead) && !Entity->IsVisble)
return;
HeadWorldOrig = HeadWorld;
HeadWorld.z += BoxSize;
OrignWorld.z -= BoxSize;
if (CGlobal::WorldToScreen(HeadWorld, HeadScreen) && CGlobal::WorldToScreen(OrignWorld, OriginScreen))
{
float Height = OriginScreen.y - HeadScreen.y;
if (Height < 18)
Height = 18;
float Width = Height / 2.f;
Vector BoxScreen = Vector(HeadScreen.x - (Width / 2.f), HeadScreen.y, 0);
if (Skeleton)
{
DrawSkeletonLine(0, 1, Entity);
DrawSkeletonLine(1, 6, Entity);
DrawSkeletonLine(6, 5, Entity);
DrawSkeletonLine(5, 4, Entity);
DrawSkeletonLine(4, 3, Entity);
DrawSkeletonLine(6, 15, Entity);
DrawSkeletonLine(15, 16, Entity);
DrawSkeletonLine(16, 13, Entity);
DrawSkeletonLine(6, 17, Entity);
DrawSkeletonLine(17, 18, Entity);
DrawSkeletonLine(18, 14, Entity);
DrawSkeletonLine(3, 8, Entity);
DrawSkeletonLine(8, 10, Entity);
DrawSkeletonLine(10, 12, Entity);
DrawSkeletonLine(3, 7, Entity);
DrawSkeletonLine(7, 9, Entity);
DrawSkeletonLine(9, 11, Entity);
}
if (Line)
GP_Render->DrawLine(CGlobal::iScreenWidth / 2.f, CGlobal::iScreenHeight, BoxScreen.x + Width / 2, OriginScreen.y, LineColor);
if (FillBox && BoxStyle != 2)
GP_Render->DrawFilledBox((int)BoxScreen.x, (int)BoxScreen.y, (int)Width, (int)Height, FillBoxColor, BoxStyle != 3 ? 0.0f : Width / 5.f);
if (BoxEnable)
{
Color BoxColor = Color::White();
if (Entity->IsVisble)
{
switch (Entity->Team)
{
case PLAYER_TEAM::TEAM_CT: BoxColor = BoxVisibleCT; break;
case PLAYER_TEAM::TEAM_TT: BoxColor = BoxVisibleTT; break;
default: break;
}
}
else
{
switch (Entity->Team)
{
case PLAYER_TEAM::TEAM_CT: BoxColor = BoxCT; break;
case PLAYER_TEAM::TEAM_TT: BoxColor = BoxTT; break;
default: break;
}
}
Color Black = Color::Black();
Black[3] = BoxColor[3];
switch (BoxStyle)
{
case 0:
{
GP_Render->DrawBox((int)BoxScreen.x, (int)BoxScreen.y, (int)Width, (int)Height, 1, BoxColor);
if (BoxOutline)
{
GP_Render->DrawBox((int)BoxScreen.x + 1, (int)BoxScreen.y + 1, (int)Width - 2, (int)Height - 2, 1, Black);
GP_Render->DrawBox((int)BoxScreen.x - 1, (int)BoxScreen.y - 1, (int)Width + 2, (int)Height + 2, 1, Black);
}
break;
}
case 1:
{
GP_Render->DrawCoalBox((int)BoxScreen.x, (int)BoxScreen.y, (int)Width, (int)Height, 1, BoxColor, BoxOutline);
break;
}
case 2:
{
Draw3DBox(Entity, BoxColor);
break;
}
case 3:
{
GP_Render->DrawBox((int)BoxScreen.x, (int)BoxScreen.y, (int)Width, (int)Height, 1, BoxColor, Width / 5.f);
if (BoxOutline)
{
GP_Render->DrawBox((int)BoxScreen.x + 1, (int)BoxScreen.y + 1, (int)Width - 2, (int)Height - 2, 1, Black, Width / 5.f);
GP_Render->DrawBox((int)BoxScreen.x - 1, (int)BoxScreen.y - 1, (int)Width + 2, (int)Height + 2, 1, Black, Width / 5.f);
}
break;
}
default:break;
}
}
if (HeadEsp)
{
float radius = (Height / 13.4);
if (radius >= 140)
radius = 140;
if (CGlobal::WorldToScreen(HeadWorldOrig, HeadScreenOrig))
GP_Render->DrawRing(HeadScreenOrig.x, HeadScreenOrig.y, radius, 64, HeadEspColor);
}
//��� ��� ���� ��������� ��� ��� ���
static MoveStruct *MV_Hp = &MVItemList[MI_HEALTH_BAR];
static MoveStruct *MV_Armor = &MVItemList[MI_ARMOR_BAR];
static MoveStruct *MV_Hp_Text = &MVItemList[MI_HEALTH_TEXT];
static MoveStruct *MV_Armor_Text = &MVItemList[MI_ARMOR_TEXT];
static MoveStruct *MV_Distance = &MVItemList[MI_DISTANCE_TEXT];
static MoveStruct *MV_Money = &MVItemList[MI_MONEY_TEXT];
static MoveStruct *MV_Weapon = &MVItemList[MI_WEAPON_TEXT];
static MoveStruct *MV_Ammo = &MVItemList[MI_AMMO_TEXT];
static MoveStruct *MV_Scoped = &MVItemList[MI_SCOPE_TEXT];
static MoveStruct *MV_Flashed = &MVItemList[MI_FLASHED_TEXT];
static MoveStruct *MV_Name = &MVItemList[MI_NAME_TEXT];
int y = BoxScreen.y;
int x = BoxScreen.x;
auto ChangeSidePosText = [](MoveStruct* Curt, Vec2 Size, Vec2 BoxPos, int boxSizeX, int boxSizeY) -> Vec2
{
switch (Curt->Side)
{
case LEFT_S: return Vec2(BoxPos.x - Size.x - Curt->CorrectPadding.x, BoxPos.y + Curt->CorrectPadding.y);
case RIGHT_S:return Vec2(BoxPos.x + boxSizeX + Curt->CorrectPadding.x, BoxPos.y + Curt->CorrectPadding.y);
case TOP_S: return Vec2(BoxPos.x + (boxSizeX / 2) - (Size.x / 2), BoxPos.y - Size.y - Curt->CorrectPadding.y);
case DOWN_S: return Vec2(BoxPos.x + (boxSizeX / 2) - (Size.x / 2), BoxPos.y + boxSizeY + Curt->CorrectPadding.y);
case LEFT_TOP_S: return Vec2(BoxPos.x, BoxPos.y - Size.y - Curt->CorrectPadding.y);
case RIGHT_TOP_S: return Vec2(BoxPos.x + boxSizeX - Size.x, BoxPos.y - Size.y - Curt->CorrectPadding.y);
case LEFT_DOWN_S: return Vec2(BoxPos.x, BoxPos.y + boxSizeY + Curt->CorrectPadding.y);
case RIGHT_DOWN_S:return Vec2(BoxPos.x + boxSizeX - Size.x, BoxPos.y + boxSizeY + Curt->CorrectPadding.y);
case CENTER_LEFT_S: return Vec2(BoxPos.x - Size.x - Curt->CorrectPadding.x, BoxPos.y + (boxSizeY / 2 + Curt->CorrectPadding.y));
case CENTER_RIGHT_S: return Vec2(BoxPos.x + boxSizeX + Curt->CorrectPadding.x, BoxPos.y + (boxSizeY / 2) + Curt->CorrectPadding.y);
case DOWN_LEFT_DOWN_S: return Vec2(BoxPos.x - Size.x - Curt->CorrectPadding.x, BoxPos.y + boxSizeY - Size.y + Curt->CorrectPadding.y);
case DOWN_RIGHT_DOWN_S:return Vec2(BoxPos.x + boxSizeX + Curt->CorrectPadding.x, BoxPos.y + boxSizeY - Size.y + Curt->CorrectPadding.y);
default: return Vec2(0, 0);
}
};
if (Name && MV_Name)
{
Color f1 = NameColorBack;
Color f2(255, 255, 255, 0);
float Name_X = 0;
float Name_Y = 0;
Vec2 TextPos = ChangeSidePosText(MV_Name, GP_Render->CalcTextSize(Entity->Name, GP_Render->SzFonts[TextNameSize]), Vec2(x, y), Width, Height);
TextPos.x -= (Width / MV_Name->CorrectOfst.x);
TextPos.y -= (Height / MV_Name->CorrectOfst.y);
TextPos.x = int(TextPos.x);
TextPos.y = int(TextPos.y);
if (NameBackground)
{
Vec2 TextSize = GP_Render->CalcTextSize(Entity->Name, GP_Render->SzFonts[TextNameSize]);
Rect BackLeft = Rect(Vec2(TextPos.x - 15, TextPos.y), Vec2(TextPos.x + TextSize.x / 3, TextPos.y + TextSize.y));
Rect BackCenter = Rect(Vec2(BackLeft.max.x, BackLeft.min.y), Vec2(BackLeft.max.x + TextSize.x / 3, BackLeft.max.y));
Rect BackRight = Rect(Vec2(BackCenter.max.x, BackLeft.min.y), Vec2(BackCenter.max.x + (TextSize.x / 3) + 15, BackLeft.max.y));
GP_Render->DrawGradientBox(BackLeft.min, BackLeft.max, Color(0, 0, 0, 0), NameColorBack, false);
GP_Render->DrawGradientBox(BackCenter.min, BackCenter.max, NameColorBack, NameColorBack, false);
GP_Render->DrawGradientBox(BackRight.min, BackRight.max, NameColorBack, Color(0, 0, 0, 0), false);
}
GP_Render->DrawString(TextPos.x, TextPos.y, TextNameSize, NameColor, true, false, Entity->Name.c_str());
}
if (Health && MV_Hp && MV_Hp_Text)
{
Color Minus;
Color DinColor;
int iHealth = Entity->Health;
if (iHealth)
{
float health_tik = MV_Hp->NumParam2;
int healthpos_X = 0;
int healthpos_Y = 0;
switch (MV_Hp->Side)
{
case LEFT_S:
healthpos_X = x - (Width / MV_Hp->CorrectOfst.x) - health_tik - MV_Hp->CorrectPadding.x;
healthpos_Y = y - (Height / MV_Hp->CorrectOfst.y);
break;
case RIGHT_S:
healthpos_X = x - (Width / MV_Hp->CorrectOfst.x) + MV_Hp->CorrectPadding.x;
healthpos_Y = y - (Height / MV_Hp->CorrectOfst.y);
break;
case TOP_S:
healthpos_X = x - (Width / MV_Hp->CorrectOfst.x);
healthpos_Y = y - (Height / MV_Hp->CorrectOfst.y) - health_tik - MV_Hp->CorrectPadding.y;
break;
case DOWN_S:
healthpos_X = x - (Width / MV_Hp->CorrectOfst.x);
healthpos_Y = y - (Height / MV_Hp->CorrectOfst.y) + Height + MV_Hp->CorrectPadding.y;
break;
}
switch (HealthStyle)
{
case 0:
{
bool vertical = (MV_Hp->Side == LEFT_S || MV_Hp->Side == RIGHT_S);
DrawBar(
vertical ? VERTICAL : HORIZONTAL, healthpos_X, healthpos_Y,
vertical ? health_tik : Width, vertical ? Height : health_tik,
iHealth, MV_Hp->boolParam2, HealthColor, HealthColor2,
MV_Hp->boolParam1, MV_Hp->NumParam1, MV_Hp->boolParam3, HealthColor3);
break;
}
case 1:
{
string HPText = to_string(iHealth) + XorStr("HP");
Vec2 TextPos = ChangeSidePosText(MV_Hp_Text, GP_Render->CalcTextSize(
HPText, GP_Render->SzFonts[TextHealthSize]), Vec2(x, y), Width, Height);
GP_Render->DrawString(
(int)TextPos.x - (Width / MV_Hp_Text->CorrectOfst.x),
(int)TextPos.y - (Height / MV_Hp_Text->CorrectOfst.y),
TextHealthSize, HealthColor, true, false, HPText.c_str());
break;
}
}
}
}
if (Armor && MV_Armor && MV_Armor_Text)
{
int iArmor = Entity->Armor;
if (iArmor)
{
float health_tik = MV_Armor->NumParam2;
int healthpos_X = 0;
int healthpos_Y = 0;
switch (MV_Armor->Side)
{
case LEFT_S:
healthpos_X = x - (Width / MV_Armor->CorrectOfst.x) - health_tik - MV_Armor->CorrectPadding.x;
healthpos_Y = y - (Height / MV_Armor->CorrectOfst.y);
break;
case RIGHT_S:
healthpos_X = x - (Width / MV_Armor->CorrectOfst.x) + MV_Armor->CorrectPadding.x;
healthpos_Y = y - (Height / MV_Armor->CorrectOfst.y);
break;
case TOP_S:
healthpos_X = x - (Width / MV_Armor->CorrectOfst.x);
healthpos_Y = y - (Height / MV_Armor->CorrectOfst.y) - health_tik - MV_Armor->CorrectPadding.y;
break;
case DOWN_S:
healthpos_X = x - (Width / MV_Armor->CorrectOfst.x);
healthpos_Y = y - (Height / MV_Armor->CorrectOfst.y) + Height + MV_Armor->CorrectPadding.y;
break;
}
switch (ArmorStyle)
{
case 0:
{
bool vertical = (MV_Armor->Side == LEFT_S || MV_Armor->Side == RIGHT_S);
DrawBar(
vertical ? VERTICAL : HORIZONTAL, healthpos_X, healthpos_Y,
vertical ? health_tik : Width, vertical ? Height : health_tik,
iArmor, MV_Armor->boolParam2, ArmorColor, ArmorColor2,
MV_Armor->boolParam1, MV_Armor->NumParam1, MV_Armor->boolParam3, ArmorColor3);
break;
}
case 1:
{
string AText = to_string(iArmor) + XorStr("A");
Vec2 TextPos = ChangeSidePosText(MV_Armor_Text, GP_Render->CalcTextSize(
AText, GP_Render->SzFonts[TextHealthSize]), Vec2(x, y), Width, Height);
GP_Render->DrawString(
(int)TextPos.x - (Width / MV_Armor_Text->CorrectOfst.x),
(int)TextPos.y - (Height / MV_Armor_Text->CorrectOfst.y),
TextHealthSize, ArmorColor, true, false, AText.c_str());
break;
}
}
}
}
if (Distance && MV_Distance)
{
char bufDist[246];
std::sprintf(bufDist, XorStr("%6.1lfm"), Entity->Distance);
string distm = bufDist;
Vec2 TextPos = ChangeSidePosText(MV_Distance, GP_Render->CalcTextSize(distm, GP_Render->SzFonts[TextDistanceSize]), Vec2(x, y), Width, Height);
GP_Render->DrawString((int)TextPos.x - 7 - (Width / MV_Distance->CorrectOfst.x),
(int)TextPos.y - (Height / MV_Distance->CorrectOfst.y), TextDistanceSize, DistanceColor, true, false, distm.c_str());
}
if (Weapon && MV_Weapon)
{
const char* WeaponStr = Entity->WeaponName.c_str();
Vec2 TextPos = ChangeSidePosText(MV_Weapon, GP_Render->CalcTextSize(WeaponStr, GP_Render->SzFonts[TextWeaponSize]), Vec2(x, y), Width, Height);
switch (WeaponStyle)
{
case 0:
{
GP_Render->DrawString((int)TextPos.x - (Width / MV_Weapon->CorrectOfst.x),
(int)TextPos.y - (Height / MV_Weapon->CorrectOfst.y), TextWeaponSize, WeaponColor, true, false, WeaponStr); break;
}
case 1:
{
string ico = XorStr("def");
if (strstr(WeaponStr, XorStr("HE_Grenade")))
ico = XorStr("j");
else if (strstr(WeaponStr, XorStr("Smoke_Grenade")))
ico = XorStr("k");
else if (strstr(WeaponStr, XorStr("FLASHBANG")))
ico = XorStr("i");
else if (strstr(WeaponStr, XorStr("MOLOTOV")))
ico = XorStr("l");
else if (strstr(WeaponStr, XorStr("DECOY")))
ico = XorStr("m");
else if (strstr(WeaponStr, XorStr("IncGrenade")))
ico = XorStr("n");
else if (strstr(WeaponStr, XorStr("Taser")))
ico = XorStr("h");
else if (strstr(WeaponStr, XorStr("Knife_T")))
ico = XorStr("[");
else if (strstr(WeaponStr, XorStr("Knife")))
ico = XorStr("]");
else if (strstr(WeaponStr, XorStr("C4")))
ico = XorStr("o");
else
{
switch (CGlobal::GetWeaponSettingsSelectID(Entity->WeaponIdx))
{
case 0: ico = XorStr("A"); break;
case 1: ico = XorStr("B"); break;
case 2: ico = XorStr("C"); break;
case 3: ico = XorStr("D"); break;
case 4: ico = XorStr("F"); break;
case 5: ico = XorStr("F"); break;
case 6: ico = XorStr("G"); break;
case 7: ico = XorStr("I"); break;
case 8: ico = XorStr("J"); break;
case 9: ico = XorStr("H"); break;
case 10: ico = XorStr("W"); break;
case 11: ico = XorStr("U"); break;
case 12: ico = XorStr("R"); break;
case 13: ico = XorStr("Q"); break;
case 14: ico = XorStr("g"); break;
case 15: ico = XorStr("S"); break;
case 16: ico = XorStr("T"); break;
case 17: ico = XorStr("K"); break;
case 18: ico = XorStr("P"); break;
case 19: ico = XorStr("L"); break;
case 20: ico = XorStr("L"); break;
case 21: ico = XorStr("b"); break;
case 22: ico = XorStr("M"); break;
case 23: ico = XorStr("d"); break;
case 24: ico = XorStr("f"); break;
case 25: ico = XorStr("c"); break;
case 26: ico = XorStr("N"); break;
case 27: ico = XorStr("O"); break;
case 28: ico = XorStr("e"); break;
case 29: ico = XorStr("V"); break;
case 30: ico = XorStr("X"); break;
case 31: ico = XorStr("Y"); break;
case 32: ico = XorStr("Z"); break;
case 33: ico = XorStr("a"); break;
default: break;
}
}
if (ico.length() == 1)
{
TextPos = ChangeSidePosText(MV_Weapon, GP_Render->CalcTextSize(ico, GP_Render->SzFontsIcon[TextWeaponSize]), Vec2(x, y), Width, Height);
GP_Render->DrawIcon((int)TextPos.x - (Width / MV_Weapon->CorrectOfst.x),
(int)TextPos.y - (Height / MV_Weapon->CorrectOfst.y), TextWeaponSize, WeaponColor, true, false, ico.c_str());
}
break;
}
default:
break;
}
}
if (Ammo && MV_Ammo)
{
char ammo_format[64];
switch (AmmoStyle)
{
case 0:sprintf(ammo_format, XorStr("[%i]"), Entity->Ammo1); break;
case 1:sprintf(ammo_format, XorStr("[%i\\%i]"), Entity->Ammo1, Entity->Ammo2); break;
case 2:sprintf(ammo_format, XorStr("[%i]"), Entity->Ammo1 + Entity->Ammo2); break;
default:
break;
}
string Ammo = string(ammo_format);
Vec2 TextPos = ChangeSidePosText(MV_Ammo, GP_Render->CalcTextSize(Ammo, GP_Render->SzFonts[TextAmmoSize]), Vec2(x, y), Width, Height);
GP_Render->DrawString((int)TextPos.x - (Width / MV_Ammo->CorrectOfst.x),
(int)TextPos.y - (Height / MV_Ammo->CorrectOfst.y), TextAmmoSize, AmmoColor, true, false, Ammo.c_str());
}
if (Money && MV_Money)
{
string MoneyStr = to_string(Entity->Money) + XorStr("$");
Vec2 TextPos = ChangeSidePosText(MV_Money, GP_Render->CalcTextSize(MoneyStr, GP_Render->SzFonts[TextMoneySize]), Vec2(x, y), Width, Height);
GP_Render->DrawString((int)TextPos.x - (Width / MV_Money->CorrectOfst.x),
(int)TextPos.y - (Height / MV_Money->CorrectOfst.y), TextMoneySize, MoneyColor, true, false, MoneyStr.c_str());
}
if (Scope && MV_Scoped)
{
if (Entity->ZoomLevel == 1 || Entity->ZoomLevel == 2)
{
string DefStr = XorStr("SCOPED");
Vec2 TextPos = ChangeSidePosText(MV_Scoped, GP_Render->CalcTextSize(DefStr, GP_Render->SzFonts[TextScopedSize]), Vec2(x, y), Width, Height);
GP_Render->DrawString((int)TextPos.x - (Width / MV_Scoped->CorrectOfst.x),
(int)TextPos.y - (Height / MV_Scoped->CorrectOfst.y), TextScopedSize, ScopeColor, true, false, DefStr.c_str());
}
}
if (Flashing && MV_Flashed)
{
if (Entity->IsFlashed)
{
string DefStr = XorStr("FLASHED");
Vec2 TextPos = ChangeSidePosText(MV_Flashed, GP_Render->CalcTextSize(DefStr, GP_Render->SzFonts[TextFlashedSize]), Vec2(x, y), Width, Height);
GP_Render->DrawString((int)TextPos.x - (Width / MV_Flashed->CorrectOfst.x),
(int)TextPos.y - (Height / MV_Flashed->CorrectOfst.y), TextFlashedSize, FlashingColor, true, false, DefStr.c_str());
}
}
}
};
LDrawPlayerEx();
}
void CEsp::PlayerEsp(CEntityPlayer* Local)
{
auto LPlayerEsp = [&]()->void
{
if ((Skeleton || FillBox || BoxEnable || HeadEsp ||
Name || Health || Armor || Ammo || Distance ||
Weapon || Money || Scope || Flashing || Line) && BindEnable.Check())
{
for (int EntIndex = 0; EntIndex < I::Engine()->GetMaxClients(); EntIndex++)
{
CEntityPlayer* Entity = &GP_EntPlayers->EntityPlayer[EntIndex];
if (!Entity->IsUpdated)
continue;
if (Entity->IsLocal)
continue;
if (!Entity->IsPlayer)
continue;
if (Entity->IsDead)
continue;
if (Entity->HitBoxes[HITBOX_HEAD].IsZero())
{
if (Entity->Alpha == 255.f)
{
Entity->HideEndTime = I::GlobalVars()->curtime + DORMANT_TIME;
Entity->Alpha -= 1.f;
}
if (Entity->Alpha != 0.f)
{
Entity->Alpha = (255.f * ((((Entity->HideEndTime - I::GlobalVars()->curtime) * 100.f) / DORMANT_TIME) / 100.f));
if (Entity->Alpha <= 1.f)
Entity->Alpha = 0.f;
}
}
SetPlayerAlpha(Entity->Alpha);
if (Entity->Alpha != 0.f)
{
DrawPlayerEx(Entity, Local, Entity->HitBoxes[HITBOX_HEAD].IsZero());
}
ResetPlayerAlpha();
}
}
};
LPlayerEsp();
}
void CEsp::SetPlayerAlpha(float NewAlph)
{
auto LSetPlayerAlpha = [&]()->void
{
OldAlphs.clear();
OldAlphs.push_back(BoxCT[3]);
OldAlphs.push_back(BoxTT[3]);
OldAlphs.push_back(BoxVisibleCT[3]);
OldAlphs.push_back(BoxVisibleTT[3]);
OldAlphs.push_back(FillBoxColor[3]);
OldAlphs.push_back(HeadEspColor[3]);
OldAlphs.push_back(LineColor[3]);
OldAlphs.push_back(SkeletonColor[3]);
OldAlphs.push_back(HealthColor[3]);
OldAlphs.push_back(HealthColor2[3]);
OldAlphs.push_back(HealthColor3[3]);
OldAlphs.push_back(ArmorColor[3]);
OldAlphs.push_back(ArmorColor2[3]);
OldAlphs.push_back(ArmorColor3[3]);
OldAlphs.push_back(DistanceColor[3]);
OldAlphs.push_back(WeaponColor[3]);
OldAlphs.push_back(AmmoColor[3]);
OldAlphs.push_back(NameColor[3]);
OldAlphs.push_back(NameColorBack[3]);
OldAlphs.push_back(MoneyColor[3]);
OldAlphs.push_back(FlashingColor[3]);
OldAlphs.push_back(DefusingColor[3]);
BoxCT.SetAlph(NewAlph);
BoxTT.SetAlph(NewAlph);
BoxVisibleCT.SetAlph(NewAlph);
BoxVisibleTT.SetAlph(NewAlph);
FillBoxColor.SetAlph(NewAlph);
HeadEspColor.SetAlph(NewAlph);
LineColor.SetAlph(NewAlph);
SkeletonColor.SetAlph(NewAlph);
HealthColor.SetAlph(NewAlph);
HealthColor2.SetAlph(NewAlph);
HealthColor3.SetAlph(NewAlph);
ArmorColor.SetAlph(NewAlph);
ArmorColor2.SetAlph(NewAlph);
ArmorColor3.SetAlph(NewAlph);
DistanceColor.SetAlph(NewAlph);
WeaponColor.SetAlph(NewAlph);
AmmoColor.SetAlph(NewAlph);
NameColor.SetAlph(NewAlph);
NameColorBack.SetAlph(NewAlph);
MoneyColor.SetAlph(NewAlph);
FlashingColor.SetAlph(NewAlph);
DefusingColor.SetAlph(NewAlph);
};
LSetPlayerAlpha();
}
void CEsp::ResetPlayerAlpha()
{
auto LResetPlayerAlpha = [&]()->void
{
BoxCT[3] = OldAlphs[0];
BoxTT[3] = OldAlphs[1];
BoxVisibleCT[3] = OldAlphs[2];
BoxVisibleTT[3] = OldAlphs[3];
FillBoxColor[3] = OldAlphs[4];
HeadEspColor[3] = OldAlphs[5];
LineColor[3] = OldAlphs[6];
SkeletonColor[3] = OldAlphs[7];
HealthColor[3] = OldAlphs[8];
HealthColor2[3] = OldAlphs[9];
HealthColor3[3] = OldAlphs[10];
ArmorColor[3] = OldAlphs[11];
ArmorColor2[3] = OldAlphs[12];
ArmorColor3[3] = OldAlphs[13];
DistanceColor[3] = OldAlphs[14];
WeaponColor[3] = OldAlphs[15];
AmmoColor[3] = OldAlphs[16];
NameColor[3] = OldAlphs[17];
NameColorBack[3] = OldAlphs[18];
MoneyColor[3] = OldAlphs[19];
FlashingColor[3] = OldAlphs[20];
DefusingColor[3] = OldAlphs[21];
};
LResetPlayerAlpha();
}
void CEsp::Draw3DBox(CEntityPlayer* Entity, Color color)
{
auto LDraw3DBox = [&]()->void
{
ICollideable* coll = Entity->BaseEntity->GetCollideable();
Vector min = coll->OBBMins();
Vector max = coll->OBBMaxs();
Vector corners[8] =
{
Vector(min.x,min.y,min.z + 10),
Vector(min.x,max.y,min.z + 10),
Vector(max.x,max.y,min.z + 10),
Vector(max.x,min.y,min.z + 10),
Vector(min.x,min.y,max.z + 10),
Vector(min.x,max.y,max.z + 10),
Vector(max.x,max.y,max.z + 10),
Vector(max.x,min.y,max.z + 10)
};
float ang = Entity->EyeAngle.y;
for (int i = 0; i <= 7; i++)
corners[i].Rotate2D(ang);
Vector _corners[8];
Vector bufCorners;
for (int i = 0; i <= 7; i++)
{
Vector Orig = Entity->RenderOrigin;
Orig.z -= 7;
if (CGlobal::WorldToScreen(Orig + corners[i], bufCorners))
{
_corners[i] = bufCorners;
}
}
float x1 = CGlobal::iScreenWidth * 2, y1 = CGlobal::iScreenHeight * 2, x2 = -CGlobal::iScreenWidth, y2 = -CGlobal::iScreenHeight;
for (int i = 0; i <= 7; i++)
{
x1 = (min(x1, _corners[i].x));
y1 = (min(y1, _corners[i].y));
x2 = (max(x2, _corners[i].x));
y2 = (max(y2, _corners[i].y));
}
float diff = x2 - x1;
float diff2 = y2 - y1;
for (int i = 1; i <= 4; i++)
{
if (BoxOutline)
{
GP_Render->DrawLine((float)(_corners[i - 1].x), (float)(_corners[i - 1].y) + 1, (float)(_corners[i % 4].x), (float)(_corners[i % 4].y) + 1, Color::Black());// ���
GP_Render->DrawLine((float)(_corners[i - 1].x), (float)(_corners[i - 1].y) - 1, (float)(_corners[i % 4].x), (float)(_corners[i % 4].y) - 1, Color::Black());// ���
GP_Render->DrawLine((float)(_corners[i + 3].x), (float)(_corners[i + 3].y) - 1, (float)(_corners[i % 4 + 4].x), (float)(_corners[i % 4 + 4].y) - 1, Color::Black());//����
GP_Render->DrawLine((float)(_corners[i + 3].x), (float)(_corners[i + 3].y) + 1, (float)(_corners[i % 4 + 4].x), (float)(_corners[i % 4 + 4].y) + 1, Color::Black());//����
GP_Render->DrawLine((float)(_corners[i - 1].x) - 1, (float)(_corners[i - 1].y), (float)(_corners[i + 3].x) - 1, (float)(_corners[i + 3].y), Color::Black());//��������
GP_Render->DrawLine((float)(_corners[i - 1].x) + 1, (float)(_corners[i - 1].y), (float)(_corners[i + 3].x) + 1, (float)(_corners[i + 3].y), Color::Black());//��������
}
GP_Render->DrawLine((_corners[i - 1].x), (_corners[i - 1].y), (_corners[i % 4].x), (_corners[i % 4].y), color);// ���
GP_Render->DrawLine((_corners[i + 3].x), (_corners[i + 3].y), (_corners[i % 4 + 4].x), (_corners[i % 4 + 4].y), color);//����
GP_Render->DrawLine((_corners[i - 1].x), (_corners[i - 1].y), (_corners[i + 3].x), (_corners[i + 3].y), color); //��������
}
};
LDraw3DBox();
}
void CEsp::DrawSkeletonLine(int point1, int point2, CEntityPlayer* Entity)
{
Vector HitBoxScreen1;
Vector HitBoxScreen2;
if (CGlobal::WorldToScreen(Entity->HitBoxes[point1], HitBoxScreen1) && CGlobal::WorldToScreen(Entity->HitBoxes[point2], HitBoxScreen2))
GP_Render->DrawLine(HitBoxScreen1.x, HitBoxScreen1.y, HitBoxScreen2.x, HitBoxScreen2.y, SkeletonColor);
}
void CEsp::DrawBar(Orent O, float x, float y, float w, float h, float val, bool Outline, Color MainC1, Color cBack, bool bBack, int Razd, bool Revers, Color OutlineCol)
{
auto LDrawBar = [&]()->void
{
if (val > 100) val = 100;
float size = (h * val) / 100;
x = (int)x;
y = (int)y;
w = (int)w;
h = (int)h;
if (bBack)
GP_Render->DrawFilledBox(x + 1, y + 1, w - 1, h - 1, cBack);
if (O == VERTICAL)
{
if (Revers)
GP_Render->DrawFilledBox(x + 1, y + 1, w - 1, size - 1, MainC1);
else
GP_Render->DrawFilledBox(x + 1, y + 1 + (h - size), w - 1, size, MainC1);
if (Razd != 0)
{
Razd += 1;
float DistL = h / Razd;
if (Razd == 1)
DistL = h / 2.f;
for (int i(1); i < Razd; i++)
GP_Render->DrawLine(int(x), int(y + h - (DistL*i)), int(x + w), int(y + h - (DistL*i)), OutlineCol);
}
}
else
{
size = (w * val) / 100;
if (Revers)
GP_Render->DrawFilledBox(x + 1, y + 1, size - 1, h - 1, MainC1);
else
GP_Render->DrawFilledBox(x + 1 + (w - size), y + 1, size - 1, h - 1, MainC1);
if (Razd != 0)
{
Razd += 1;
float DistL = w / Razd;
if (Razd == 1)
DistL = w / 2.f;
for (int i(1); i < Razd; i++)
GP_Render->DrawLine(int(x + w - (DistL*i)), int(y), int(x + w - (DistL*i)), int(y + h), OutlineCol);
}
}
if (Outline)
GP_Render->DrawBox(x, y, w + 1, h + 1, 1, OutlineCol);
};
LDrawBar();
}
void CEsp::DrawModelExecute(void* thisptr, IMatRenderContext* ctx, const DrawModelState_t& state, const ModelRenderInfo_t& pInfo, matrix3x4_t* pCustomBoneToWorld)
{
auto LDrawModelExecute = [&]()->void
{
if (Enable && Chams && BindEnable.Check())
{
static auto fnDME = HookTables::pDrawModelExecute->GetTrampoline();
const char* ModelName = I::ModelInfo()->GetModelName((model_t*)pInfo.pModel);
if (!ModelName)
return;
if (!strstr(ModelName, XorStr("models/player")))
return;
CEntityPlayer* Entity = GP_EntPlayers->GetByIdx(pInfo.entity_index);
CEntityPlayer* Local = GP_EntPlayers->EntityLocal;
if (!Entity || !Local)
return;
if (!Entity->IsUpdated)
return;
if (Entity->IsDead || Entity->Health <= 0)
return;
if (!Team && Entity->Team == Local->Team)
return;
if (!Enemy && Entity->Team != Local->Team)
return;
Color ChamsInvisColor = (Entity->Team == PLAYER_TEAM::TEAM_CT) ? ChamsCT : ChamsTT;
Color ChamsVisbleColor = (Entity->Team == PLAYER_TEAM::TEAM_CT) ? ChamsVisibleCT : ChamsVisibleTT;
if (!ChamsVisibleOnly)
{
ChamsInvisColor[4];
OverrideMaterial(true, ChamsDouble, ChamsStyle, ChamsInvisColor);
fnDME(thisptr, ctx, state, pInfo, pCustomBoneToWorld);
}
if (ChamsStyle >= 0)
{
ChamsVisbleColor[4];
OverrideMaterial(false, ChamsDouble, ChamsStyle, ChamsVisbleColor);
fnDME(thisptr, ctx, state, pInfo, pCustomBoneToWorld);
}
}
if (Enable && Glow && BindEnable.Check())
{
static auto fnDME = HookTables::pDrawModelExecute->GetTrampoline();
const char* ModelName = I::ModelInfo()->GetModelName((model_t*)pInfo.pModel);
if (!ModelName)
return;
if (!strstr(ModelName, XorStr("models/player")))
return;
CEntityPlayer* Entity = GP_EntPlayers->GetByIdx(pInfo.entity_index);
CEntityPlayer* Local = GP_EntPlayers->EntityLocal;
if (!Entity || !Local)
return;
if (!Entity->IsUpdated)
return;
if (Entity->IsDead || Entity->Health <= 0)
return;
if (!Team && Entity->Team == Local->Team)
return;
if (!Enemy && Entity->Team != Local->Team)
return;
Color GlowInvisColor = (Entity->Team == PLAYER_TEAM::TEAM_CT) ? GlowCT : GlowTT;
Color GlowVisbleColor = (Entity->Team == PLAYER_TEAM::TEAM_CT) ? GlowVisibleCT : GlowVisibleTT;
if (!GlowVisibleOnly)
{
GlowInvisColor[4];
const float Pulse = GlowInvisColor[3] * (std::sin(I::GlobalVars()->curtime * GlowPulseSpeed) * GlowPulseRange + 0.5f + 0.5f);
OverrideMaterial(true, 0, GlowStyle, GlowInvisColor, true, Pulse);
fnDME(thisptr, ctx, state, pInfo, pCustomBoneToWorld);
}
if (GlowStyle >= 0)
{
GlowVisbleColor[4];
const float Pulse = GlowVisbleColor[3] * (std::sin(I::GlobalVars()->curtime * GlowPulseSpeed) * GlowPulseRange + 0.5f + 0.5f);
OverrideMaterial(false, 0, GlowStyle, GlowVisbleColor, true, Pulse);
fnDME(thisptr, ctx, state, pInfo, pCustomBoneToWorld);
}
}
};
LDrawModelExecute();
}
C++:
#include "Esp.h"
#include "../../GUI/Gui.h"
#define IMAGE_X 110
#define IMAGE_Y 245
#define IMAGE_OUTLINE 50
#define LINES_X 70
#define LINES_Y 80
#define BOX_POS_X 45
#define BOX_POS_Y 20
#define BOX_SIZE_X 160
#define BOX_SIZE_Y 310
#define MV_HEALTH_TEXT XorStr("90HP")
#define MV_ARMOR_TEXT XorStr("90A")
#define MV_NAME_TEXT XorStr("Name")
#define MV_WEAPON_TEXT XorStr("M4A4")
#define MV_WEAPON_TEXT_ICO XorStr("S") //M4A4 Icon
#define MV_DISTANCE_TEXT XorStr("5m")
#define MV_MONEY_TEXT XorStr("1000$")
#define MV_SCOPE_TEXT XorStr("SCOPED")
#define MV_FLASHED_TEXT XorStr("FLASHED")
#define MV_DEFUSING_TEXT XorStr("DEFUSING")
#define FULL_BACK_SIZE_X 100
#define FULL_BACK_SIZE_Y 100
#define SELECTED_BORDER_SIZE 4
#define VIS_PREW_ZONE_X 350
#define VIS_PREW_ZONE_Y 400
bool IsMousPress = false;
bool IsMousClick = false;
int BoxSize_Y = 0;
int BoxSize_X = 0;
bool IsBlockMove = false;
int CEsp::MoveStruct::ActiveIdx = -1;
int CEsp::MoveStruct::LastActive = -1;
bool CEsp::MoveStruct::InitMItems = false;
LPDIRECT3DTEXTURE9 VisualBodyImage;
void CEsp::Move(MoveStruct &Cont, bool IsPressed, Vec2 MouseP, Vec2 StartP, Vec2 CLines, bool IsText)
{
GuiIO& g = X1Gui().GetIO();
bool ChangeSide = false;
if (MoveStruct::ActiveIdx == Cont.Id || MoveStruct::ActiveIdx == -1)
{
if (IsPressed && Cont.IsHover && Cont.Set)
{
MoveStruct::ActiveIdx = Cont.Id;
MoveStruct::LastActive = Cont.Id;
Cont.Offset.x = StartP.x - (MouseP.x - Cont.Correct.x);
Cont.Offset.y = StartP.y - (MouseP.y - Cont.Correct.y);
if (!IsText)
{
Sides OSide = Cont.Side;
if (Cont.Center.x > CLines.x) { Cont.Side = RIGHT_S; }
if (Cont.Center.x < CLines.x) { Cont.Side = LEFT_S; }
if (g.MousePos.y < CLines.y + (BoxSize_Y / 8)) { Cont.Side = TOP_S; }
if (g.MousePos.y > CLines.y + BoxSize_Y - (BoxSize_Y / 8)) { Cont.Side = DOWN_S; }
if (OSide != Cont.Side && ((OSide != LEFT_S || Cont.Side != RIGHT_S) && (OSide != RIGHT_S || Cont.Side != LEFT_S)))
ChangeSide = true;
}
else
{
if (Cont.Center.x > CLines.x) { Cont.Side = RIGHT_S; }
if (Cont.Center.x < CLines.x) { Cont.Side = LEFT_S; }
if (Cont.Center.x > CLines.x && Cont.Center.y > CLines.y + (BoxSize_Y / 3)) { Cont.Side = CENTER_RIGHT_S; }
if (Cont.Center.x < CLines.x && Cont.Center.y > CLines.y + (BoxSize_Y / 3)) { Cont.Side = CENTER_LEFT_S; }
if (Cont.Center.x > CLines.x && Cont.Center.y > CLines.y + BoxSize_Y - (BoxSize_Y / 3)) { Cont.Side = DOWN_RIGHT_DOWN_S; }
if (Cont.Center.x < CLines.x && Cont.Center.y > CLines.y + BoxSize_Y - (BoxSize_Y / 3)) { Cont.Side = DOWN_LEFT_DOWN_S; }
if (Cont.Center.y < CLines.y) { Cont.Side = TOP_S; }
if (Cont.Center.y < CLines.y && Cont.Center.x < CLines.x - (BoxSize_X / 4)) { Cont.Side = LEFT_TOP_S; }
if (Cont.Center.y < CLines.y && Cont.Center.x > CLines.x + (BoxSize_X / 4)) { Cont.Side = RIGHT_TOP_S; }
if (Cont.Center.y > CLines.y + BoxSize_Y) { Cont.Side = DOWN_S; }
if (Cont.Center.y > CLines.y + BoxSize_Y && Cont.Center.x < CLines.x - (BoxSize_X / 4)) { Cont.Side = LEFT_DOWN_S; }
if (Cont.Center.y > CLines.y + BoxSize_Y && Cont.Center.x > CLines.x + (BoxSize_X / 4)) { Cont.Side = RIGHT_DOWN_S; }
}
}
else
MoveStruct::ActiveIdx = -1;
Cont.Position = Vec2(StartP.x - Cont.Offset.x, StartP.y - Cont.Offset.y);
if ((MouseP.x < (Cont.Position.x + Cont.Size.x) && MouseP.x > Cont.Position.x) && (MouseP.y < (Cont.Position.y + Cont.Size.y) && MouseP.y > Cont.Position.y))
Cont.IsHover = true;
else
Cont.IsHover = false;
if (IsPressed && Cont.IsHover)
{
if (!Cont.Set && !IsBlockMove)
{
Cont.Set = true;
Cont.Correct.x = MouseP.x - Cont.Position.x;
Cont.Correct.y = MouseP.y - Cont.Position.y;
}
}
else
Cont.Set = false;
Cont.Center = Vec2(Cont.Position.x + Cont.Size.x / 2, Cont.Position.y + Cont.Size.y / 2);
if (!IsText)
{
if (Cont.Side == DOWN_S || Cont.Side == TOP_S)
Cont.Size = Cont.SizeH;
if (Cont.Side == LEFT_S || Cont.Side == RIGHT_S)
Cont.Size = Cont.SizeV;
if (ChangeSide)
{
Cont.Center = MouseP;
Cont.Offset.x = StartP.x - (MouseP.x - Cont.Size.x / 2);
Cont.Offset.y = StartP.y - (MouseP.y - Cont.Size.y / 2);
Cont.Position = Vec2(StartP.x - Cont.Offset.x, StartP.y - Cont.Offset.y);
Cont.Correct.x = MouseP.x - Cont.Position.x;
Cont.Correct.y = MouseP.y - Cont.Position.y;
}
}
}
}
void CEsp::CustomVisuals(Vec2 Start)
{
CGui* Draw = &X1Gui();
GuiIO& g = X1Gui().GetIO();
string MV_AMMO_TEXT = "";
if (AmmoStyle == 0)
{
MV_AMMO_TEXT = XorStr("[30]");
}
else if (AmmoStyle == 1)
{
MV_AMMO_TEXT = XorStr("[30\\90]");
}
else if (AmmoStyle == 2)
{
MV_AMMO_TEXT = XorStr("[120]");
}
static MoveStruct *MV_Hp = &MVItemList[MI_HEALTH_BAR];
static MoveStruct *MV_Armor = &MVItemList[MI_ARMOR_BAR];
static MoveStruct *MV_Hp_Text = &MVItemList[MI_HEALTH_TEXT];
static MoveStruct *MV_Armor_Text = &MVItemList[MI_ARMOR_TEXT];
static MoveStruct *MV_Name = &MVItemList[MI_NAME_TEXT];
static MoveStruct *MV_Weapon = &MVItemList[MI_WEAPON_TEXT];
static MoveStruct *MV_Ammo = &MVItemList[MI_AMMO_TEXT];
static MoveStruct *MV_Distance = &MVItemList[MI_DISTANCE_TEXT];
static MoveStruct *MV_Money = &MVItemList[MI_MONEY_TEXT];
static MoveStruct *MV_Scope = &MVItemList[MI_SCOPE_TEXT];
static MoveStruct *MV_Flashed = &MVItemList[MI_FLASHED_TEXT];
static MoveStruct *MV_Defusing = &MVItemList[MI_DEFUSING_TEXT];
MV_Hp_Text->Size = GP_Render->CalcTextSize(MV_HEALTH_TEXT, GP_Render->SzFonts[TextHealthSize]);
MV_Armor_Text->Size = GP_Render->CalcTextSize(MV_ARMOR_TEXT, GP_Render->SzFonts[TextArmorSize]);
MV_Name->Size = GP_Render->CalcTextSize(MV_NAME_TEXT, GP_Render->SzFonts[TextNameSize]);
MV_Ammo->Size = GP_Render->CalcTextSize(MV_AMMO_TEXT.c_str(), GP_Render->SzFonts[TextAmmoSize]);
MV_Distance->Size = GP_Render->CalcTextSize(MV_DISTANCE_TEXT, GP_Render->SzFonts[TextDistanceSize]);
MV_Money->Size = GP_Render->CalcTextSize(MV_MONEY_TEXT, GP_Render->SzFonts[TextMoneySize]);
MV_Flashed->Size = GP_Render->CalcTextSize(MV_FLASHED_TEXT, GP_Render->SzFonts[TextFlashedSize]);
MV_Scope->Size = GP_Render->CalcTextSize(MV_SCOPE_TEXT, GP_Render->SzFonts[TextScopedSize]);
MV_Defusing->Size = GP_Render->CalcTextSize(MV_DEFUSING_TEXT, GP_Render->SzFonts[TextDefusingSize]);
if (WeaponStyle == 0)
MV_Weapon->Size = GP_Render->CalcTextSize(MV_WEAPON_TEXT, GP_Render->SzFonts[TextWeaponSize]);
else if (WeaponStyle == 1)
MV_Weapon->Size = GP_Render->CalcTextSize(MV_WEAPON_TEXT_ICO, GP_Render->SzFontsIcon[TextWeaponSize]);
MV_Hp->IsEnabled = Health && HealthStyle == 0;
MV_Armor->IsEnabled = Armor && ArmorStyle == 0;
MV_Hp_Text->IsEnabled = Health && HealthStyle == 1;
MV_Armor_Text->IsEnabled = Armor && ArmorStyle == 1;
MV_Name->IsEnabled = Name;
MV_Weapon->IsEnabled = Weapon;
MV_Ammo->IsEnabled = Ammo;
MV_Distance->IsEnabled = Distance;
MV_Money->IsEnabled = Money;
MV_Scope->IsEnabled = Scope;
MV_Flashed->IsEnabled = Flashing;
MV_Defusing->IsEnabled = Defusing;
color_t LinesColor = color_t(1.f*255.f, 1.f*255.f, 1.f*255.f, 0.1f*255.f);
color_t OutLineColor = color_t(1.f*255.f, 1.f*255.f, 1.f*255.f, 0.3f*255.f);
color_t BackColor = color_t(0.5f*255.f, 0.5f*255.f, 0.5f*255.f, 0.5f*255.f);
IsMousPress = g.LMPressDur > 0.0f;
IsMousClick = g.LMClicked;
Vec2 MousePos = g.MousePos;
auto FixPos = [](Vec2 Max, Vec2 Min, Vec2& Cur)
{
if (Cur.x > Max.x - 5) { Cur.x = Max.x - 5; }
if (Cur.y > Max.y - 5) { Cur.y = Max.y - 5; }
if (Cur.x < Min.x + 5) { Cur.x = Min.x + 5; }
if (Cur.y < Min.y + 5) { Cur.y = Min.y + 5; }
};
auto DrawVBox = [Draw](Vec2 Pos, Vec2 Size, color_t Color)
{
Pos = Vec2(int(Pos.x), int(Pos.y));
Draw->DrawLine(Vec2(Pos.x - 0.5f, Pos.y), Vec2(Pos.x + Size.x, Pos.y), Color);
Draw->DrawLine(Vec2(Pos.x, Pos.y - 0.5f), Vec2(Pos.x, Pos.y + Size.y), Color);
Draw->DrawLine(Vec2(Pos.x, Pos.y + Size.y), Vec2(Pos.x + Size.x + 0.5f, Pos.y + Size.y), Color);
Draw->DrawLine(Vec2(Pos.x + Size.x, Pos.y), Vec2(Pos.x + Size.x, Pos.y + Size.y + 0.5f), Color);
};
auto DrawVBoxCorner = [Draw](Vec2 Pos, Vec2 Size, color_t Color)
{
Pos = Vec2(int(Pos.x), int(Pos.y));
/*
01-----------11
2 2
| |
| |
1 1
22-----------23
*/
int LSize_X = Size.x / 4;
int LSize_Y = Size.y / 4;
/*01*/
Draw->DrawLine(
Vec2(Pos.x, Pos.y),
Vec2(Pos.x + LSize_X, Pos.y),
Color);
/*02*/
Draw->DrawLine(
Vec2(Pos.x, Pos.y),
Vec2(Pos.x, Pos.y + LSize_Y),
Color);
/*11*/
Draw->DrawLine(
Vec2(Pos.x + Size.x - LSize_X, Pos.y),
Vec2(Pos.x + Size.x, Pos.y),
Color);
/*12*/
Draw->DrawLine(
Vec2(Pos.x + Size.x, Pos.y),
Vec2(Pos.x + Size.x, Pos.y + LSize_Y),
Color);
/*21*/
Draw->DrawLine(
Vec2(Pos.x, Pos.y + Size.y - LSize_Y),
Vec2(Pos.x, Pos.y + Size.y),
Color);
/*22*/
Draw->DrawLine(
Vec2(Pos.x, Pos.y + Size.y),
Vec2(Pos.x + LSize_X, Pos.y + Size.y),
Color);
/*31*/
Draw->DrawLine(
Vec2(Pos.x + Size.x, Pos.y + Size.y - LSize_Y),
Vec2(Pos.x + Size.x, Pos.y + Size.y),
Color);
/*32*/
Draw->DrawLine(
Vec2(Pos.x + Size.x - LSize_X, Pos.y + Size.y),
Vec2(Pos.x + Size.x, Pos.y + Size.y),
Color);
};
auto Background = [Draw, DrawVBox, LinesColor, OutLineColor, BackColor](Vec2 Min, Vec2 Max, Vec2 MenuPos)
{
Draw->DrawFilledBox(Min, Vec2(VIS_PREW_ZONE_X, VIS_PREW_ZONE_Y), BackColor);
for (int i(1); i <= LINES_Y; i++)
Draw->DrawLine(Vec2(Min.x, Min.y + (VIS_PREW_ZONE_Y / LINES_Y)*i), Vec2(Min.x + VIS_PREW_ZONE_X, Min.y + (VIS_PREW_ZONE_Y / LINES_Y)*i), LinesColor);
for (int i(1); i <= LINES_X; i++)
Draw->DrawLine(Vec2(Min.x + (VIS_PREW_ZONE_X / LINES_X)*i, Min.y), Vec2(Min.x + (VIS_PREW_ZONE_X / LINES_X)*i, Min.y + VIS_PREW_ZONE_Y), LinesColor);
DrawVBox(Min, Vec2(VIS_PREW_ZONE_X, VIS_PREW_ZONE_Y), OutLineColor);
};
auto DrawBarVertical = [Draw, DrawVBox](Vec2 Pos, Vec2 Size, color_t MainColor, color_t BackColor, color_t OutLineColor, int Lines, MoveStruct* Curt)
{
Pos = Vec2(int(Pos.x), int(Pos.y));
if (Curt->boolParam1)
Draw->DrawFilledBox(Vec2(Pos.x, Pos.y),
Vec2(Size.x, Size.y),
BackColor);
if (!Curt->boolParam3)
Draw->DrawFilledBox(Vec2(Pos.x, Pos.y + (Size.y / 10)),
Vec2(Size.x, Size.y - (Size.y / 10)),
MainColor);
else
Draw->DrawFilledBox(Vec2(Pos.x, Pos.y),
Vec2(Size.x, Size.y - (Size.y / 10)),
MainColor);
if (Lines != 0)
{
Lines += 1;
int DistL = Size.y / Lines;
if (Lines == 1)
DistL = Size.y / 2;
for (int i(1); i < Lines; i++)
Draw->DrawLine(Vec2(Pos.x, Pos.y + DistL * i), Vec2(Pos.x + Size.x, Pos.y + DistL * i), OutLineColor);
}
if (Curt->boolParam2)
DrawVBox(Pos, Size, OutLineColor);
};
auto DrawBarHorizontal = [Draw, DrawVBox](Vec2 Pos, Vec2 Size, color_t MainColor, color_t BackColor, color_t OutLineColor, int Lines, MoveStruct* Curt)
{
Pos = Vec2(int(Pos.x), int(Pos.y));
if (Curt->boolParam1)
Draw->DrawFilledBox(Vec2(Pos.x, Pos.y),
Vec2(Size.x, Size.y),
BackColor);
if (Curt->boolParam3)
Draw->DrawFilledBox(Vec2(Pos.x, Pos.y),
Vec2(Size.x - (Size.x / 10), Size.y),
MainColor);
else
Draw->DrawFilledBox(Vec2(Pos.x + (Size.x / 10), Pos.y),
Vec2(Size.x - (Size.x / 10), Size.y),
MainColor);
if (Lines != 0)
{
Lines += 1;
int DistL = Size.x / Lines;
if (Lines == 1)
DistL = Size.x / 2;
for (int i(1); i < Lines; i++)
Draw->DrawLine(Vec2(Pos.x + DistL * i, Pos.y), Vec2(Pos.x + DistL * i, Pos.y + Size.y), OutLineColor);
}
if (Curt->boolParam2)
DrawVBox(Pos, Size, OutLineColor);
};
Vec2 StartPos = X1Gui().GetCursorPos();
Vec2 StartPosScreen = X1Gui().GetCursorPos();
Vec2 TextOffset = Vec2(StartPosScreen.x - StartPos.x, StartPosScreen.y - StartPos.y);
auto _DrawText = [Draw, TextOffset](string text, MoveStruct* Curt, CFont* font)
{
Vec2 Pos = Vec2(Curt->Position.x - TextOffset.x, Curt->Position.y - TextOffset.y);
if (Curt->boolParam3)
{
Vec2 NSize = Curt->Size;
Vec2 NPos = Curt->Position;
NSize.x += 30;
NPos.x -= 15;
NPos.y += 1.5f;
float max = NSize.x / 3.f;
for (int i(0); i < max; i++)
Draw->DrawFilledBox(Vec2(NPos.x + i, NPos.y),
Vec2(NPos.x + i + 1, NPos.y + NSize.y),
color_t(Curt->Color2.G1R(), Curt->Color2.G1G(), Curt->Color2.G1B(), (((float)i / max) * 255) / 255.f));
Draw->DrawFilledBox(Vec2(NPos.x + max, NPos.y),
Vec2(NPos.x + (max * 2), NPos.y + NSize.y),
color_t(Curt->Color2.G1R(), Curt->Color2.G1G(), Curt->Color2.G1B(), 1.f));
for (int i(0); i < max; i++)
Draw->DrawFilledBox(Vec2(NPos.x + i + (max * 2), NPos.y),
Vec2(NPos.x + i + 1 + (max * 2), NPos.y + NSize.y),
color_t(Curt->Color2.G1R(), Curt->Color2.G1G(), Curt->Color2.G1B(), (255 - (((float)i / max) * 255)) / 255.f));
}
if (true)
{
Draw->DrawString(font, Pos.x + 1, Pos.y + 1, color_t(0.01f, 0.01f, 0.01f, 1.f), text.c_str());
}
Draw->DrawString(font, Pos.x, Pos.y, Curt->Color1, text.c_str());
};
Vec2 EndPosScreen = Vec2(StartPosScreen.x + VIS_PREW_ZONE_X, StartPosScreen.y + VIS_PREW_ZONE_Y);
if ((MousePos.x > StartPosScreen.x && MousePos.x < EndPosScreen.x) &&
(MousePos.y > StartPosScreen.y && MousePos.y < EndPosScreen.y))
{
}
int FixImgPos_X = ((VIS_PREW_ZONE_X - IMAGE_X) / 2);
int FixImgPos_Y = ((VIS_PREW_ZONE_Y - IMAGE_Y) / 2);
Vec2 ImgePos = Vec2(StartPos.x + FixImgPos_X, StartPos.y + FixImgPos_Y);
Vec2 ScreenImgePos = ImgePos;
Background(StartPosScreen, EndPosScreen, StartPos);
if (!VisualBodyImage)
D3DXCreateTextureFromFileEx(GP_Render->m_pDevice, (CGlobal::SystemDisk + XorStr("X1N3\\Resources\\Images\\Body.png")).c_str(), 222, 579,
D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, &VisualBodyImage);
if (VisualBodyImage)
Draw->DrawImage(VisualBodyImage, ImgePos, ImgePos + Vec2(IMAGE_X, IMAGE_Y));
Draw->DrawLine(Vec2(StartPosScreen.x + (VIS_PREW_ZONE_X / 2), StartPosScreen.y), Vec2(StartPosScreen.x + (VIS_PREW_ZONE_X / 2), StartPosScreen.y + VIS_PREW_ZONE_Y), OutLineColor);
Draw->DrawLine(Vec2(StartPosScreen.x, StartPosScreen.y + (VIS_PREW_ZONE_Y / 2)), Vec2(StartPosScreen.x + VIS_PREW_ZONE_X, StartPosScreen.y + (VIS_PREW_ZONE_Y / 2)), OutLineColor);
if (Skeleton)
{
Draw->DrawLine(Vec2(StartPosScreen.x + 152 + 20, StartPosScreen.y + 122), Vec2(StartPosScreen.x + 150 + 20, StartPosScreen.y + 103), SkeletonColor);
Draw->DrawLine(Vec2(StartPosScreen.x + 152 + 20, StartPosScreen.y + 122), Vec2(StartPosScreen.x + 157 + 20, StartPosScreen.y + 129), SkeletonColor);
Draw->DrawLine(Vec2(StartPosScreen.x + 157 + 20, StartPosScreen.y + 129), Vec2(StartPosScreen.x + 158 + 20, StartPosScreen.y + 163), SkeletonColor);
Draw->DrawLine(Vec2(StartPosScreen.x + 158 + 20, StartPosScreen.y + 163), Vec2(StartPosScreen.x + 159 + 20, StartPosScreen.y + 194), SkeletonColor);
Draw->DrawLine(Vec2(StartPosScreen.x + 159 + 20, StartPosScreen.y + 194), Vec2(StartPosScreen.x + 180 + 20, StartPosScreen.y + 219), SkeletonColor);
Draw->DrawLine(Vec2(StartPosScreen.x + 180 + 20, StartPosScreen.y + 219), Vec2(StartPosScreen.x + 195 + 20, StartPosScreen.y + 273), SkeletonColor);
Draw->DrawLine(Vec2(StartPosScreen.x + 195 + 20, StartPosScreen.y + 273), Vec2(StartPosScreen.x + 196 + 20, StartPosScreen.y + 306), SkeletonColor);
Draw->DrawLine(Vec2(StartPosScreen.x + 159 + 20, StartPosScreen.y + 194), Vec2(StartPosScreen.x + 139 + 20, StartPosScreen.y + 218), SkeletonColor);
Draw->DrawLine(Vec2(StartPosScreen.x + 139 + 20, StartPosScreen.y + 216), Vec2(StartPosScreen.x + 131 + 20, StartPosScreen.y + 267), SkeletonColor);
Draw->DrawLine(Vec2(StartPosScreen.x + 131 + 20, StartPosScreen.y + 267), Vec2(StartPosScreen.x + 134 + 20, StartPosScreen.y + 286), SkeletonColor);
Draw->DrawLine(Vec2(StartPosScreen.x + 157 + 20, StartPosScreen.y + 132), Vec2(StartPosScreen.x + 121 + 20, StartPosScreen.y + 142), SkeletonColor);
Draw->DrawLine(Vec2(StartPosScreen.x + 121 + 20, StartPosScreen.y + 142), Vec2(StartPosScreen.x + 126 + 20, StartPosScreen.y + 146), SkeletonColor);
Draw->DrawLine(Vec2(StartPosScreen.x + 125 + 20, StartPosScreen.y + 145), Vec2(StartPosScreen.x + 141 + 20, StartPosScreen.y + 134), SkeletonColor);
Draw->DrawLine(Vec2(StartPosScreen.x + 157 + 20, StartPosScreen.y + 132), Vec2(StartPosScreen.x + 183 + 20, StartPosScreen.y + 135), SkeletonColor);
Draw->DrawLine(Vec2(StartPosScreen.x + 181 + 20, StartPosScreen.y + 135), Vec2(StartPosScreen.x + 174 + 20, StartPosScreen.y + 141), SkeletonColor);
Draw->DrawLine(Vec2(StartPosScreen.x + 161 + 20, StartPosScreen.y + 122), Vec2(StartPosScreen.x + 174 + 20, StartPosScreen.y + 141), SkeletonColor);
}
Vec2 StartBoxPos = Vec2(int(ScreenImgePos.x + IMAGE_X / 2), int(ScreenImgePos.y + (IMAGE_Y / 13) - (BoxSize*2.9)));
Vec2 CLines = Vec2(StartPosScreen.x + (VIS_PREW_ZONE_X / 2), StartBoxPos.y);
BoxSize_Y = int(IMAGE_Y - (IMAGE_Y / 13) + (BoxSize * 4));
BoxSize_X = int(BoxSize_Y / 2);
StartBoxPos.x -= int(BoxSize_X / 2.f);
int HPTol = MV_Hp->NumParam2;
int ATol = MV_Armor->NumParam2;
for (int i(0); (MITypes)i < MI_MAX; i++)
MVItemList[i].Position = Vec2(int(StartPosScreen.x + MVItemList[i].ZonePos.x), int(StartPosScreen.y + MVItemList[i].ZonePos.y));
if (!MoveStruct::InitMItems)
{
MoveStruct::InitMItems = true;
MoveStruct::LastActive = MI_MAX;
/*=====================================================================================*/
MV_Hp_Text->Position = Vec2(StartBoxPos.x - MV_Hp_Text->Size.x, StartBoxPos.y);
MV_Hp_Text->StartPos = MV_Hp_Text->Position;
MV_Hp_Text->Id = MI_HEALTH_TEXT;
MV_Hp_Text->Side = LEFT_S;
MV_Hp_Text->TextSize = 17;
MV_Hp_Text->Offset = Vec2(5, 0);
MV_Hp_Text->IsText = true;
MV_Hp_Text->Name = XorStr("MV_HP_Text");
MV_Hp_Text->Color1 = Color(255, 255, 255, 255);
/*=====================================================================================*/
MV_Armor_Text->Position = Vec2(StartBoxPos.x - MV_Armor_Text->Size.x, StartBoxPos.y);
MV_Armor_Text->StartPos = MV_Armor_Text->Position;
MV_Armor_Text->Id = MI_ARMOR_TEXT;
MV_Armor_Text->Side = LEFT_S;
MV_Armor_Text->TextSize = 17;
MV_Armor_Text->Offset = Vec2(5, -10);
MV_Armor_Text->IsText = true;
MV_Armor_Text->Name = XorStr("MV_Arm_Text");
MV_Hp_Text->Color1 = Color(255, 255, 255, 255);
/*=====================================================================================*/
MV_Hp->Position = Vec2(StartBoxPos.x - HPTol, StartBoxPos.y);
MV_Hp->StartPos = MV_Hp->Position;
MV_Hp->Id = MI_HEALTH_BAR;
MV_Hp->Side = LEFT_S;
MV_Hp->Size = Vec2(HPTol, BoxSize_Y);
MV_Hp->Offset = Vec2(5, 0);
MV_Hp->Color1 = Color(10, 255, 10, 255);
MV_Hp->Color2 = Color(255, 0, 0, 255);
MV_Hp->Color3 = Color(0, 0, 0, 255);
MV_Hp->NumParam1 = 4;
MV_Hp->NumParam2 = 5;
MV_Hp->Name = XorStr("MV_HPBar");
MV_Hp->boolParam1 = true;
MV_Hp->boolParam2 = true;
MV_Hp->boolParam3 = false;
/*=====================================================================================*/
MV_Armor->Position = Vec2(StartBoxPos.x + BoxSize_X, StartBoxPos.y);
MV_Armor->StartPos = MV_Armor->Position;
MV_Armor->Id = MI_ARMOR_BAR;
MV_Armor->Side = RIGHT_S;
MV_Armor->Size = Vec2(ATol, BoxSize_Y);
MV_Armor->Offset = Vec2(-5, 0);
MV_Armor->Color1 = Color(255, 255, 255, 255);
MV_Armor->Color2 = Color(255, 0, 0, 255);
MV_Armor->Color3 = Color(0, 0, 0, 255);
MV_Armor->NumParam1 = 4;
MV_Armor->NumParam2 = 5;
MV_Armor->Name = XorStr("MV_ArmorBar");
MV_Armor->boolParam1 = true;
MV_Armor->boolParam2 = true;
MV_Armor->boolParam3 = false;
/*=====================================================================================*/
MV_Name->Position = Vec2(StartBoxPos.x + (BoxSize_X / 2) - (MV_Name->Size.x / 2), StartBoxPos.y - MV_Name->Size.y);
MV_Name->StartPos = MV_Name->Position;
MV_Name->Id = MI_NAME_TEXT;
MV_Name->Side = TOP_S;
MV_Name->TextSize = 17;
MV_Name->Offset = Vec2(0, 4);
MV_Name->IsText = true;
MV_Name->Name = XorStr("MV_Name");
MV_Name->boolParam1 = false;
MV_Name->Color1 = Color(255, 255, 255, 255);
/*=====================================================================================*/
MV_Weapon->Position = Vec2(StartBoxPos.x + (BoxSize_X / 2) - (MV_Weapon->Size.x / 2), StartBoxPos.y + BoxSize_Y);
MV_Weapon->StartPos = MV_Weapon->Position;
MV_Weapon->Id = MI_WEAPON_TEXT;
MV_Weapon->Side = DOWN_S;
MV_Weapon->TextSize = 17;
MV_Weapon->Offset = Vec2(0, -1);
MV_Weapon->IsText = true;
MV_Weapon->Name = XorStr("MV_Weapon");
MV_Weapon->Color1 = Color(255, 255, 255, 255);
/*=====================================================================================*/
MV_Ammo->Position = Vec2(StartBoxPos.x + (BoxSize_X / 2) - (MV_Ammo->Size.x / 2), StartBoxPos.y + BoxSize_Y);
MV_Ammo->StartPos = MV_Ammo->Position;
MV_Ammo->Id = MI_AMMO_TEXT;
MV_Ammo->Side = DOWN_S;
MV_Ammo->TextSize = 17;
MV_Ammo->Offset = Vec2(0, -10);
MV_Ammo->IsText = true;
MV_Ammo->Color1 = Color(255, 255, 255, 255);
/*=====================================================================================*/
MV_Distance->Position = Vec2(StartBoxPos.x + BoxSize_X, StartBoxPos.y + BoxSize_Y - MV_Distance->Size.y);
MV_Distance->StartPos = MV_Distance->Position;
MV_Distance->Id = MI_DISTANCE_TEXT;
MV_Distance->Side = DOWN_RIGHT_DOWN_S;
MV_Distance->TextSize = 17;
MV_Distance->Offset = Vec2(-7, 0);
MV_Distance->IsText = true;
MV_Distance->Name = XorStr("MV_Distance");
MV_Distance->Color1 = Color(255, 255, 255, 255);
/*=====================================================================================*/
MV_Money->Position = Vec2(StartBoxPos.x + BoxSize_X, StartBoxPos.y);
MV_Money->StartPos = MV_Money->Position;
MV_Money->Id = MI_MONEY_TEXT;
MV_Money->Side = RIGHT_S;
MV_Money->TextSize = 17;
MV_Money->Offset = Vec2(-7, 0);
MV_Money->IsText = true;
MV_Money->Name = XorStr("MV_Money");
MV_Money->Color1 = Color(255, 255, 255, 255);
/*=====================================================================================*/
MV_Scope->Position = Vec2(StartBoxPos.x + BoxSize_X, StartBoxPos.y);
MV_Scope->StartPos = MV_Scope->Position;
MV_Scope->Id = MI_SCOPE_TEXT;
MV_Scope->Side = RIGHT_S;
MV_Scope->TextSize = 17;
MV_Scope->Offset = Vec2(-7, -7);
MV_Scope->IsText = true;
MV_Scope->Name = XorStr("MV_Scope");
MV_Scope->Color1 = Color(255, 255, 255, 255);
/*=====================================================================================*/
MV_Flashed->Position = Vec2(StartBoxPos.x + BoxSize_X, StartBoxPos.y + BoxSize_Y / 2);
MV_Flashed->StartPos = MV_Flashed->Position;
MV_Flashed->Id = MI_FLASHED_TEXT;
MV_Flashed->Side = CENTER_RIGHT_S;
MV_Flashed->TextSize = 17;
MV_Flashed->Color1 = Color(255, 255, 255, 255);
MV_Flashed->Offset = Vec2(-7, 0);
MV_Flashed->IsText = true;
MV_Flashed->Name = XorStr("MV_Flashed");
/*=====================================================================================*/
MV_Defusing->Position = Vec2(StartBoxPos.x + BoxSize_X, StartBoxPos.y + BoxSize_Y / 2);
MV_Defusing->StartPos = MV_Defusing->Position;
MV_Defusing->Id = MI_DEFUSING_TEXT;
MV_Defusing->Side = CENTER_RIGHT_S;
MV_Defusing->TextSize = 17;
MV_Defusing->Color1 = Color(255, 255, 255, 255);
MV_Defusing->Offset = Vec2(-7, -7);
MV_Defusing->IsText = true;
MV_Defusing->Name = XorStr("MV_Defusing");
}
if (FillBox)
Draw->DrawFilledBox(StartBoxPos, Vec2(BoxSize_X, BoxSize_Y), FillBoxColor, BoxStyle == 3 ? BoxSize_X / 5.f : 0.0f);
if (BoxEnable)
{
color_t BoxOutLineColor = color_t(0.f, 0.f, 0.f, 255.f);
if (BoxStyle == 0)
{
DrawVBox(StartBoxPos, Vec2(BoxSize_X, BoxSize_Y), BoxVisibleCT);
if (BoxOutline)
{
DrawVBox(Vec2(StartBoxPos.x + 1, StartBoxPos.y + 1), Vec2(BoxSize_X - 2, BoxSize_Y - 2), BoxOutLineColor);
DrawVBox(Vec2(StartBoxPos.x - 1, StartBoxPos.y - 1), Vec2(BoxSize_X + 2, BoxSize_Y + 2), BoxOutLineColor);
}
}
else if (BoxStyle == 1)
{
DrawVBoxCorner(StartBoxPos, Vec2(BoxSize_X, BoxSize_Y), BoxVisibleCT);
if (BoxOutline)
{
DrawVBoxCorner(Vec2(StartBoxPos.x + 1, StartBoxPos.y + 1), Vec2(BoxSize_X - 2, BoxSize_Y - 2), BoxOutLineColor);
DrawVBoxCorner(Vec2(StartBoxPos.x - 1, StartBoxPos.y - 1), Vec2(BoxSize_X + 2, BoxSize_Y + 2), BoxOutLineColor);
int LSize_X = BoxSize_X / 4;
int LSize_Y = BoxSize_Y / 4;
Draw->DrawLine(Vec2(StartBoxPos.x + LSize_X + 0.5f, StartBoxPos.y - 1), Vec2(StartBoxPos.x + LSize_X + 0.5f, StartBoxPos.y + 1), BoxOutLineColor);
Draw->DrawLine(Vec2(StartBoxPos.x - 1, StartBoxPos.y + LSize_Y + 0.5f), Vec2(StartBoxPos.x + 1, StartBoxPos.y + LSize_Y + 0.5f), BoxOutLineColor);
Draw->DrawLine(Vec2(StartBoxPos.x + BoxSize_X - LSize_X - 0.5f, StartBoxPos.y - 1), Vec2(StartBoxPos.x + BoxSize_X - LSize_X - 0.5f, StartBoxPos.y + 1), BoxOutLineColor);
Draw->DrawLine(Vec2(StartBoxPos.x + BoxSize_X - 1, StartBoxPos.y + LSize_Y + 0.5f), Vec2(StartBoxPos.x + BoxSize_X + 1, StartBoxPos.y + LSize_Y + 0.5f), BoxOutLineColor);
Draw->DrawLine(Vec2(StartBoxPos.x + LSize_X + 0.5f, StartBoxPos.y + BoxSize_Y - 1), Vec2(StartBoxPos.x + LSize_X + 0.5f, StartBoxPos.y + BoxSize_Y + 1), BoxOutLineColor);
Draw->DrawLine(Vec2(StartBoxPos.x - 1, StartBoxPos.y + BoxSize_Y - LSize_Y - 0.5f), Vec2(StartBoxPos.x + 1, StartBoxPos.y + BoxSize_Y - LSize_Y - 0.5f), BoxOutLineColor);
Draw->DrawLine(Vec2(StartBoxPos.x + BoxSize_X - LSize_X - 0.5f, StartBoxPos.y + BoxSize_Y - 1), Vec2(StartBoxPos.x + BoxSize_X - LSize_X - 0.5f, StartBoxPos.y + BoxSize_Y + 1), BoxOutLineColor);
Draw->DrawLine(Vec2(StartBoxPos.x + BoxSize_X - 1, StartBoxPos.y + BoxSize_Y - LSize_Y - 0.5f), Vec2(StartBoxPos.x + BoxSize_X + 1, StartBoxPos.y + BoxSize_Y - LSize_Y - 0.5f), BoxOutLineColor);
}
}
else if (BoxStyle == 2)
{
}
else if (BoxStyle == 3)
{
Draw->DrawBox(StartBoxPos, Vec2(StartBoxPos.x + BoxSize_X, StartBoxPos.y + BoxSize_Y), BoxVisibleCT, BoxSize_X / 5.f);
if (BoxOutline)
{
Draw->DrawBox(Vec2(StartBoxPos.x + 1, StartBoxPos.y + 1), Vec2(StartBoxPos.x + BoxSize_X - 0.9f, StartBoxPos.y + BoxSize_Y - 0.9f), BoxOutLineColor, BoxSize_X / 5.f);
Draw->DrawBox(Vec2(StartBoxPos.x - 1, StartBoxPos.y - 1), Vec2(StartBoxPos.x + BoxSize_X + 0.9f, StartBoxPos.y + BoxSize_Y + 0.9f), BoxOutLineColor, BoxSize_X / 5.f);
}
}
}
if (HeadEsp)
{
Vec2 HeadCenterPos = Vec2(ScreenImgePos.x + 51, ScreenImgePos.y + 20);
Draw->DrawRing(HeadCenterPos.x, HeadCenterPos.y, 20, 64, HeadEspColor, 1);
}
auto ChangeSidePos = [StartBoxPos](MoveStruct* Curt, int fix) -> Vec2
{
switch (Curt->Side)
{
case LEFT_S: return Vec2(StartBoxPos.x - fix - Curt->CorrectPadding.x, StartBoxPos.y);
case RIGHT_S: return Vec2(StartBoxPos.x + BoxSize_X + Curt->CorrectPadding.x, StartBoxPos.y);
case TOP_S: return Vec2(StartBoxPos.x, StartBoxPos.y - fix - Curt->CorrectPadding.y);
case DOWN_S: return Vec2(StartBoxPos.x, StartBoxPos.y + BoxSize_Y + Curt->CorrectPadding.y);
default: return Vec2(0, 0);
}
};
auto ChangeSidePosText = [StartBoxPos](MoveStruct* Curt, Vec2 Size) -> Vec2
{
switch (Curt->Side)
{
case LEFT_S: return Vec2(StartBoxPos.x - Size.x - Curt->CorrectPadding.x, StartBoxPos.y + Curt->CorrectPadding.y);
case RIGHT_S:return Vec2(StartBoxPos.x + BoxSize_X + Curt->CorrectPadding.x, StartBoxPos.y + Curt->CorrectPadding.y);
case TOP_S: return Vec2(StartBoxPos.x + (BoxSize_X / 2) - (Size.x / 2), StartBoxPos.y - Size.y - Curt->CorrectPadding.y);
case DOWN_S: return Vec2(StartBoxPos.x + (BoxSize_X / 2) - (Size.x / 2), StartBoxPos.y + BoxSize_Y + Curt->CorrectPadding.y);
case LEFT_TOP_S: return Vec2(StartBoxPos.x, StartBoxPos.y - Size.y - Curt->CorrectPadding.y);
case RIGHT_TOP_S: return Vec2(StartBoxPos.x + BoxSize_X - Size.x, StartBoxPos.y - Size.y - Curt->CorrectPadding.y);
case LEFT_DOWN_S: return Vec2(StartBoxPos.x, StartBoxPos.y + BoxSize_Y + Curt->CorrectPadding.y);
case RIGHT_DOWN_S:return Vec2(StartBoxPos.x + BoxSize_X - Size.x, StartBoxPos.y + BoxSize_Y + Curt->CorrectPadding.y);
case CENTER_LEFT_S: return Vec2(StartBoxPos.x - Size.x - Curt->CorrectPadding.x, StartBoxPos.y + (BoxSize_Y / 2) + Curt->CorrectPadding.y);
case CENTER_RIGHT_S: return Vec2(StartBoxPos.x + BoxSize_X + Curt->CorrectPadding.x, StartBoxPos.y + (BoxSize_Y / 2) + Curt->CorrectPadding.y);
case DOWN_LEFT_DOWN_S: return Vec2(StartBoxPos.x - Size.x - Curt->CorrectPadding.x, StartBoxPos.y + BoxSize_Y - Size.y + Curt->CorrectPadding.y);
case DOWN_RIGHT_DOWN_S:return Vec2(StartBoxPos.x + BoxSize_X + Curt->CorrectPadding.x, StartBoxPos.y + BoxSize_Y - Size.y + Curt->CorrectPadding.y);
default: return Vec2(0, 0);
}
};
Vec2 HPStartPos = ChangeSidePos(MV_Hp, HPTol);
Vec2 ArmorStartPos = ChangeSidePos(MV_Armor, ATol);
Vec2 HPTextStartPos = ChangeSidePosText(MV_Hp_Text, MV_Hp_Text->Size);
Vec2 ArmorTextStartPos = ChangeSidePosText(MV_Armor_Text, MV_Armor_Text->Size);
Vec2 NameStartPos = ChangeSidePosText(MV_Name, MV_Name->Size);
Vec2 WeaponStartPos = ChangeSidePosText(MV_Weapon, MV_Weapon->Size);
Vec2 AmmoStartPos = ChangeSidePosText(MV_Ammo, MV_Ammo->Size);
Vec2 DistanceStartPos = ChangeSidePosText(MV_Distance, MV_Distance->Size);
Vec2 MoneyStartPos = ChangeSidePosText(MV_Money, MV_Money->Size);
Vec2 DefusingStartPos = ChangeSidePosText(MV_Defusing, MV_Defusing->Size);
Vec2 ScopeStartPos = ChangeSidePosText(MV_Scope, MV_Scope->Size);
Vec2 FlashedStartPos = ChangeSidePosText(MV_Flashed, MV_Flashed->Size);
MV_Hp->SizeV = Vec2(HPTol, BoxSize_Y);
MV_Armor->SizeV = Vec2(ATol, BoxSize_Y);
MV_Hp->SizeH = Vec2(BoxSize_X, HPTol);
MV_Armor->SizeH = Vec2(BoxSize_X, ATol);
auto IsPosTouch = [](MoveStruct& Curt, Vec2 Pos) -> bool
{
if ((Pos.x > Curt.Position.x && Pos.x < Curt.Position.x + Curt.Size.x) &&
(Pos.y > Curt.Position.y && Pos.y < Curt.Position.y + Curt.Size.y))
{
return true;
}
return false;
};
auto CalcPadding = [&](MoveStruct& Curt) -> void
{
bool CheckVert = true;
bool CheckHor = true;
Curt.CorrectPadding = Vec2(0, 0);
int TraceLenX = 25;
int TraceLenY = 30;
if (Curt.Side == RIGHT_S || Curt.Side == CENTER_RIGHT_S || Curt.Side == DOWN_RIGHT_DOWN_S)
{
for (MoveStruct MV : MVItemList)
{
if (MV.IsEnabled && Curt.IsEnabled && MV.Id != Curt.Id && (CheckHor || CheckVert) &&
(MoveStruct::LastActive == Curt.Id || MoveStruct::LastActive == MV.Id ? !IsPosTouch(MV, Curt.Center) : true) &&
(MV.Side != TOP_S && MV.Side != LEFT_TOP_S && MV.Side != RIGHT_TOP_S))
{
if (CheckVert)
{
for (int i(-3); i < TraceLenY; i++)
{
if (IsPosTouch(MV, Vec2(Curt.Center.x, Curt.Center.y - (Curt.Size.y / 2) - i)))
{
Curt.CorrectPadding.y = MV.CorrectPadding.y + MV.Size.y;
CheckVert = false;
}
}
}
if (CheckHor && (!MV.IsText ? true : Curt.Center.y > MV.Center.y))
{
for (int i(CheckVert ? -3 : 1); i < TraceLenX; i++)
{
if (IsPosTouch(MV, Vec2(Curt.Center.x - (Curt.Size.x / 2) - i, Curt.Center.y)))
{
Curt.CorrectPadding.x = MV.CorrectPadding.x + MV.Size.x;
CheckHor = false;
}
}
}
}
}
}
if (Curt.Side == LEFT_S || Curt.Side == CENTER_LEFT_S || Curt.Side == DOWN_LEFT_DOWN_S)
{
for (MoveStruct MV : MVItemList)
{
if (MV.IsEnabled && Curt.IsEnabled && MV.Id != Curt.Id && (CheckHor || CheckVert) &&
(MoveStruct::LastActive == Curt.Id || MoveStruct::LastActive == MV.Id ? !IsPosTouch(MV, Curt.Center) : true) &&
(MV.Side != TOP_S && MV.Side != LEFT_TOP_S && MV.Side != RIGHT_TOP_S))
{
if (CheckVert)
{
for (int i(-3); i < TraceLenY; i++)
{
if (IsPosTouch(MV, Vec2(Curt.Center.x, Curt.Center.y - (Curt.Size.y / 2) - i)))
{
Curt.CorrectPadding.y = MV.CorrectPadding.y + MV.Size.y;
CheckVert = false;
}
}
}
if (CheckHor && (!MV.IsText ? true : Curt.Center.y > MV.Center.y))
{
for (int i(CheckVert ? -3 : 1); i < TraceLenX; i++)
{
if (IsPosTouch(MV, Vec2(Curt.Center.x + (Curt.Size.x / 2) + i, Curt.Center.y)))
{
Curt.CorrectPadding.x = MV.CorrectPadding.x + MV.Size.x;
CheckHor = false;
}
}
}
}
}
}
if (Curt.Side == TOP_S || Curt.Side == LEFT_TOP_S || Curt.Side == RIGHT_TOP_S)
{
for (MoveStruct MV : MVItemList)
{
if (MV.IsEnabled && Curt.IsEnabled && MV.Id != Curt.Id && !IsPosTouch(MV, Curt.Center) &&
(MV.Side != LEFT_S && MV.Side != CENTER_LEFT_S && MV.Side != DOWN_LEFT_DOWN_S && MV.Side != RIGHT_S && MV.Side != CENTER_RIGHT_S && MV.Side != DOWN_RIGHT_DOWN_S))
{
for (int i(-3); i < TraceLenY; i++)
{
if (IsPosTouch(MV, Vec2(Curt.Center.x, Curt.Center.y + (Curt.Size.y / 2) + i)))
{
Curt.CorrectPadding.y = MV.CorrectPadding.y + MV.Size.y;
return;
}
}
}
}
}
if (Curt.Side == DOWN_S || Curt.Side == LEFT_DOWN_S || Curt.Side == RIGHT_DOWN_S)
{
for (MoveStruct MV : MVItemList)
{
if (MV.IsEnabled && Curt.IsEnabled && MV.Id != Curt.Id && !IsPosTouch(MV, Curt.Center) &&
(MV.Side != LEFT_S && MV.Side != CENTER_LEFT_S && MV.Side != DOWN_LEFT_DOWN_S && MV.Side != RIGHT_S && MV.Side != CENTER_RIGHT_S && MV.Side != DOWN_RIGHT_DOWN_S))
{
for (int i(-3); i < TraceLenY; i++)
{
if (IsPosTouch(MV, Vec2(Curt.Center.x, Curt.Center.y - (Curt.Size.y / 2) - i)))
{
Curt.CorrectPadding.y = MV.Size.y;
return;
}
}
}
}
}
};
if (Health)
{
MV_Hp->Color1 = HealthColor;
MV_Hp_Text->Color1 = HealthColor;
MV_Hp->Color2 = HealthColor2;
MV_Hp->Color3 = HealthColor3;
if (HealthStyle == 0)
{
Move(*MV_Hp, IsMousPress, MousePos, HPStartPos, CLines);
if (MV_Hp->Side == LEFT_S || MV_Hp->Side == RIGHT_S)
DrawBarVertical(MV_Hp->Position, MV_Hp->Size, MV_Hp->Color1, MV_Hp->Color2, MV_Hp->Color3, MV_Hp->NumParam1, MV_Hp);
else
DrawBarHorizontal(MV_Hp->Position, MV_Hp->Size, MV_Hp->Color1, MV_Hp->Color2, MV_Hp->Color3, MV_Hp->NumParam1, MV_Hp);
}
else if (HealthStyle == 1)
{
Move(*MV_Hp_Text, IsMousPress, MousePos, HPTextStartPos, CLines, true);
_DrawText(MV_HEALTH_TEXT, MV_Hp_Text, GP_Render->SzFonts[TextHealthSize]);
}
}
if (Armor)
{
MV_Armor->Color1 = ArmorColor;
MV_Armor_Text->Color1 = ArmorColor;
MV_Armor->Color2 = ArmorColor2;
MV_Armor->Color3 = ArmorColor3;
if (ArmorStyle == 0)
{
Move(*MV_Armor, IsMousPress, MousePos, ArmorStartPos, CLines);
if (MV_Armor->Side == LEFT_S || MV_Armor->Side == RIGHT_S)
DrawBarVertical(MV_Armor->Position, MV_Armor->Size, MV_Armor->Color1, MV_Armor->Color2, MV_Armor->Color3, MV_Armor->NumParam1, MV_Armor);
else
DrawBarHorizontal(MV_Armor->Position, MV_Armor->Size, MV_Armor->Color1, MV_Armor->Color2, MV_Armor->Color3, MV_Armor->NumParam1, MV_Armor);
}
else if (ArmorStyle == 1)
{
Move(*MV_Armor_Text, IsMousPress, MousePos, ArmorTextStartPos, CLines, true);
_DrawText(MV_ARMOR_TEXT, MV_Armor_Text, GP_Render->SzFonts[TextArmorSize]);
}
}
if (Name)
{
Move(*MV_Name, IsMousPress, MousePos, NameStartPos, CLines, true);
if (NameBackground)
{
Vec2 NSize = MV_Name->Size;
Vec2 NPos = MV_Name->Position;
NSize.x += 30;
NPos.x -= 15;
NPos.y += 1.5f;
float max = NSize.x / 3.f;
for (int i(0); i < max; i++)
Draw->DrawFilledBoxEx(Vec2(NPos.x + i, NPos.y),
Vec2(NPos.x + i + 1, NPos.y + NSize.y),
color_t(NameColorBack.r(), NameColorBack.g(), NameColorBack.b(), (((float)i / max) * 255)));
Draw->DrawFilledBoxEx(Vec2(NPos.x + max, NPos.y),
Vec2(NPos.x + (max * 2), NPos.y + NSize.y),
color_t(NameColorBack.r(), NameColorBack.g(), NameColorBack.b(), 255));
for (int i(0); i < max; i++)
Draw->DrawFilledBoxEx(Vec2(NPos.x + i + (max * 2), NPos.y),
Vec2(NPos.x + i + 1 + (max * 2), NPos.y + NSize.y),
color_t(NameColorBack.r(), NameColorBack.g(), NameColorBack.b(), (255 - (((float)i / max) * 255)) ));
}
MV_Name->Color1 = NameColor;
_DrawText(MV_NAME_TEXT, MV_Name, GP_Render->SzFonts[TextNameSize]);
}
if (Weapon)
{
CFont *wep_fnt = nullptr;
if (WeaponStyle == 0)
wep_fnt = GP_Render->SzFonts[TextWeaponSize];
else if (WeaponStyle == 1)
wep_fnt = GP_Render->SzFontsIcon[TextWeaponSize];
Move(*MV_Weapon, IsMousPress, MousePos, WeaponStartPos, CLines, true);
MV_Weapon->Color1 = WeaponColor;
if (WeaponStyle == 0)
_DrawText(MV_WEAPON_TEXT, MV_Weapon, wep_fnt);
else if (WeaponStyle == 1)
_DrawText(MV_WEAPON_TEXT_ICO, MV_Weapon, wep_fnt);
}
if (Ammo)
{
Move(*MV_Ammo, IsMousPress, MousePos, AmmoStartPos, CLines, true);
MV_Ammo->Color1 = AmmoColor;
_DrawText(MV_AMMO_TEXT, MV_Ammo, GP_Render->SzFonts[TextAmmoSize]);
}
if (Distance)
{
Move(*MV_Distance, IsMousPress, MousePos, DistanceStartPos, CLines, true);
MV_Distance->Color1 = DistanceColor;
_DrawText(MV_DISTANCE_TEXT, MV_Distance, GP_Render->SzFonts[TextDistanceSize]);
}
if (Money)
{
Move(*MV_Money, IsMousPress, MousePos, MoneyStartPos, CLines, true);
MV_Money->Color1 = MoneyColor;
_DrawText(MV_MONEY_TEXT, MV_Money, GP_Render->SzFonts[TextMoneySize]);
}
if (Defusing)
{
Move(*MV_Defusing, IsMousPress, MousePos, DefusingStartPos, CLines, true);
MV_Defusing->Color1 = DefusingColor;
_DrawText(MV_DEFUSING_TEXT, MV_Defusing, GP_Render->SzFonts[TextDefusingSize]);
}
if (Scope)
{
Move(*MV_Scope, IsMousPress, MousePos, ScopeStartPos, CLines, true);
MV_Scope->Color1 = ScopeColor;
_DrawText(MV_SCOPE_TEXT, MV_Scope, GP_Render->SzFonts[TextScopedSize]);
}
if (Flashing)
{
Move(*MV_Flashed, IsMousPress, MousePos, FlashedStartPos, CLines, true);
MV_Flashed->Color1 = FlashingColor;
_DrawText(MV_FLASHED_TEXT, MV_Flashed, GP_Render->SzFonts[TextFlashedSize]);
}
if (MoveStruct::LastActive != -1 && (MITypes)MoveStruct::LastActive <= MI_MAX && MoveStruct::ActiveIdx != -1)
{
MoveStruct *Selected = &MVItemList[MoveStruct::LastActive];
color_t SelColor = color_t(0, 255, 255, 102);
Vec2 SP = Selected->Position;
int Correct = 0;
if (!Selected->IsText)
Correct = 1;
Draw->DrawLine(Vec2(int(StartPosScreen.x), int(SP.y - Correct)), Vec2(int(StartPosScreen.x + VIS_PREW_ZONE_X), int(SP.y - Correct)), SelColor);
Draw->DrawLine(Vec2(int(SP.x - Correct), int(StartPosScreen.y)), Vec2(int(SP.x - Correct), int(StartPosScreen.y + VIS_PREW_ZONE_Y)), SelColor);
Draw->DrawLine(Vec2(int(StartPosScreen.x), int(SP.y + Selected->Size.y + Correct)), Vec2(int(StartPosScreen.x + VIS_PREW_ZONE_X), SP.y + int(Selected->Size.y + Correct)), SelColor);
Draw->DrawLine(Vec2(int(SP.x + Selected->Size.x + Correct), int(StartPosScreen.y)), Vec2(int(SP.x + Selected->Size.x + Correct), int(StartPosScreen.y + VIS_PREW_ZONE_Y)), SelColor);
}
auto CalcVisOffset = [StartBoxPos](MoveStruct& Curt, bool IsText = false)
{
float DisttX = 0.000000001;
float DisttY = 0.000000001;
if (!IsText)
{
if (Curt.Side == LEFT_S)
{
DisttX = ((StartBoxPos.x - Curt.CorrectPadding.x) - (Curt.Position.x + Curt.Size.x));
DisttY = (StartBoxPos.y - Curt.Position.y);
}
else if (Curt.Side == RIGHT_S)
{
DisttX = ((StartBoxPos.x + Curt.CorrectPadding.x) - Curt.Position.x);
DisttY = (StartBoxPos.y - Curt.Position.y);
}
else if (Curt.Side == TOP_S)
{
DisttX = (StartBoxPos.x - Curt.Position.x);
DisttY = ((StartBoxPos.y - Curt.CorrectPadding.y) - Curt.Position.y - Curt.Size.y);
}
else if (Curt.Side == DOWN_S)
{
DisttX = (StartBoxPos.x - Curt.Position.x);
DisttY = ((StartBoxPos.y + BoxSize_Y + Curt.CorrectPadding.y) - Curt.Position.y);
}
}
else
{
if (Curt.Side == LEFT_S)
{
DisttX = ((StartBoxPos.x - Curt.CorrectPadding.x - Curt.Size.x) - (Curt.Position.x));
DisttY = ((StartBoxPos.y + Curt.CorrectPadding.y) - Curt.Position.y);
}
else if (Curt.Side == RIGHT_S)
{
DisttX = ((StartBoxPos.x + BoxSize_X + Curt.CorrectPadding.x) - Curt.Position.x);
DisttY = ((StartBoxPos.y + Curt.CorrectPadding.y) - Curt.Position.y);
}
else if (Curt.Side == TOP_S)
{
DisttX = (StartBoxPos.x - Curt.Position.x + (BoxSize_X / 2) - (Curt.Size.x / 2));
DisttY = ((StartBoxPos.y - Curt.CorrectPadding.y) - Curt.Position.y - Curt.Size.y);
}
else if (Curt.Side == DOWN_S)
{
DisttX = (StartBoxPos.x - Curt.Position.x + (BoxSize_X / 2) - (Curt.Size.x / 2));
DisttY = ((StartBoxPos.y + BoxSize_Y + Curt.CorrectPadding.y) - Curt.Position.y);
}
}
if (Curt.Side == LEFT_TOP_S)
{
DisttX = (StartBoxPos.x - Curt.Position.x);
DisttY = ((StartBoxPos.y - Curt.Size.y - Curt.CorrectPadding.y) - Curt.Position.y);
}
else if (Curt.Side == RIGHT_TOP_S)
{
DisttX = ((StartBoxPos.x + BoxSize_X) - (Curt.Position.x + Curt.Size.x));
DisttY = ((StartBoxPos.y - Curt.Size.y - Curt.CorrectPadding.y) - Curt.Position.y);
}
else if (Curt.Side == LEFT_DOWN_S)
{
DisttX = (StartBoxPos.x - Curt.Position.x);
DisttY = ((StartBoxPos.y + BoxSize_Y + Curt.CorrectPadding.y) - Curt.Position.y);
}
else if (Curt.Side == RIGHT_DOWN_S)
{
DisttX = ((StartBoxPos.x + BoxSize_X - Curt.Size.x) - Curt.Position.x);
DisttY = ((StartBoxPos.y + BoxSize_Y + Curt.CorrectPadding.y) - Curt.Position.y);
}
else if (Curt.Side == CENTER_LEFT_S)
{
DisttX = ((StartBoxPos.x - Curt.CorrectPadding.x - Curt.Size.x) - (Curt.Position.x));
DisttY = ((StartBoxPos.y + (BoxSize_Y / 2) + Curt.CorrectPadding.y) - Curt.Position.y);
}
else if (Curt.Side == CENTER_RIGHT_S)
{
DisttX = ((StartBoxPos.x + BoxSize_X + Curt.CorrectPadding.y) - Curt.Position.x);
DisttY = ((StartBoxPos.y + (BoxSize_Y / 2) + Curt.CorrectPadding.y) - Curt.Position.y);
}
else if (Curt.Side == DOWN_LEFT_DOWN_S)
{
DisttX = ((StartBoxPos.x - Curt.CorrectPadding.x - Curt.Size.x) - (Curt.Position.x));
DisttY = ((StartBoxPos.y + BoxSize_Y - Curt.Size.y + Curt.CorrectPadding.y) - (Curt.Position.y));
}
else if (Curt.Side == DOWN_RIGHT_DOWN_S)
{
DisttX = ((StartBoxPos.x + BoxSize_X + Curt.CorrectPadding.x) - Curt.Position.x);
DisttY = ((StartBoxPos.y + BoxSize_Y - Curt.Size.y + Curt.CorrectPadding.y) - (Curt.Position.y));
}
if (DisttX == 0)
DisttX = 0.000000001;
if (DisttY == 0)
DisttY = 0.000000001;
Curt.CorrectOfst.x = (BoxSize_X / DisttX);
Curt.CorrectOfst.y = (BoxSize_Y / DisttY);
};
CalcPadding(*MV_Hp);
CalcPadding(*MV_Armor);
CalcPadding(*MV_Hp_Text);
CalcPadding(*MV_Armor_Text);
CalcPadding(*MV_Name);
CalcPadding(*MV_Weapon);
CalcPadding(*MV_Ammo);
CalcPadding(*MV_Distance);
CalcPadding(*MV_Money);
CalcPadding(*MV_Scope);
CalcPadding(*MV_Flashed);
CalcPadding(*MV_Defusing);
CalcVisOffset(*MV_Hp);
CalcVisOffset(*MV_Armor);
CalcVisOffset(*MV_Hp_Text, true);
CalcVisOffset(*MV_Armor_Text, true);
CalcVisOffset(*MV_Name, true);
CalcVisOffset(*MV_Weapon, true);
CalcVisOffset(*MV_Ammo, true);
CalcVisOffset(*MV_Distance, true);
CalcVisOffset(*MV_Money, true);
CalcVisOffset(*MV_Scope, true);
CalcVisOffset(*MV_Flashed, true);
CalcVisOffset(*MV_Defusing, true);
for (int i(0); (MITypes)i < MI_MAX; i++)
MVItemList[i].ZonePos = Vec2(MVItemList[i].Position.x - StartPosScreen.x, MVItemList[i].Position.y - StartPosScreen.y);
X1Gui().SetCursorPos(Vec2(StartPos.x, StartPos.y + VIS_PREW_ZONE_Y + 3) - X1Gui().GetThis()->Info.Pos,0);
}
void CEsp::InitVisuals()
{
auto LInitVisuals = [&]()->void
{
static MoveStruct *MV_Hp = &MVItemList[MI_HEALTH_BAR];
static MoveStruct *MV_Armor = &MVItemList[MI_ARMOR_BAR];
static MoveStruct *MV_Hp_Text = &MVItemList[MI_HEALTH_TEXT];
static MoveStruct *MV_Armor_Text = &MVItemList[MI_ARMOR_TEXT];
static MoveStruct *MV_Name = &MVItemList[MI_NAME_TEXT];
static MoveStruct *MV_Weapon = &MVItemList[MI_WEAPON_TEXT];
static MoveStruct *MV_Ammo = &MVItemList[MI_AMMO_TEXT];
static MoveStruct *MV_Distance = &MVItemList[MI_DISTANCE_TEXT];
static MoveStruct *MV_Money = &MVItemList[MI_MONEY_TEXT];
static MoveStruct *MV_Scope = &MVItemList[MI_SCOPE_TEXT];
static MoveStruct *MV_Flashed = &MVItemList[MI_FLASHED_TEXT];
static MoveStruct *MV_Defusing = &MVItemList[MI_DEFUSING_TEXT];
if (!MoveStruct::InitMItems)
{
MoveStruct::InitMItems = true;
MoveStruct::LastActive = MI_MAX;
/*=====================================================================================*/
MV_Hp_Text->StartPos = MV_Hp_Text->Position;
MV_Hp_Text->Id = MI_HEALTH_TEXT;
MV_Hp_Text->Side = LEFT_S;
MV_Hp_Text->TextSize = 17;
MV_Hp_Text->Offset = Vec2(5, 0);
MV_Hp_Text->IsText = true;
MV_Hp_Text->Name = XorStr("MV_HP_Text");
MV_Hp_Text->Color1[0] = 1.0f;
MV_Hp_Text->Color1[1] = 1.0f;
MV_Hp_Text->Color1[2] = 1.0f;
/*=====================================================================================*/
MV_Armor_Text->StartPos = MV_Armor_Text->Position;
MV_Armor_Text->Id = MI_ARMOR_TEXT;
MV_Armor_Text->Side = LEFT_S;
MV_Armor_Text->TextSize = 17;
MV_Armor_Text->Offset = Vec2(5, -10);
MV_Armor_Text->IsText = true;
MV_Armor_Text->Name = XorStr("MV_Arm_Text");
MV_Armor_Text->Color1[0] = 1.0f;
MV_Armor_Text->Color1[1] = 1.0f;
MV_Armor_Text->Color1[2] = 1.0f;
/*=====================================================================================*/
MV_Hp->StartPos = MV_Hp->Position;
MV_Hp->Id = MI_HEALTH_BAR;
MV_Hp->Side = LEFT_S;
MV_Hp->Offset = Vec2(5, 0);
MV_Hp->Color1[0] = 0.1f;
MV_Hp->Color1[1] = 1.0f;
MV_Hp->Color1[2] = 0.1f;
MV_Hp->Color2[0] = 1.0f;
MV_Hp->Color2[1] = 0.0f;
MV_Hp->Color2[2] = 0.0f;
MV_Hp->Color3[0] = 0.0f;
MV_Hp->Color3[1] = 0.0f;
MV_Hp->Color3[2] = 0.0f;
MV_Hp->NumParam1 = 4;
MV_Hp->NumParam2 = 5;
MV_Hp->Name = XorStr("MV_HPBar");
MV_Hp->boolParam1 = true;
MV_Hp->boolParam2 = true;
MV_Hp->boolParam3 = false;
/*=====================================================================================*/
MV_Armor->StartPos = MV_Armor->Position;
MV_Armor->Id = MI_ARMOR_BAR;
MV_Armor->Side = RIGHT_S;
MV_Armor->Offset = Vec2(-5, 0);
MV_Armor->Color1[0] = 1.0f;
MV_Armor->Color1[1] = 1.0f;
MV_Armor->Color1[2] = 1.0f;
MV_Armor->Color2[0] = 1.0f;
MV_Armor->Color2[1] = 0.0f;
MV_Armor->Color2[2] = 0.0f;
MV_Armor->Color3[0] = 0.0f;
MV_Armor->Color3[1] = 0.0f;
MV_Armor->Color3[2] = 0.0f;
MV_Armor->NumParam1 = 4;
MV_Armor->NumParam2 = 5;
MV_Armor->Name = XorStr("MV_ArmorBar");
MV_Armor->boolParam1 = true;
MV_Armor->boolParam2 = true;
MV_Armor->boolParam3 = false;
/*=====================================================================================*/
MV_Name->StartPos = MV_Name->Position;
MV_Name->Id = MI_NAME_TEXT;
MV_Name->Side = TOP_S;
MV_Name->TextSize = 17;
MV_Name->Offset = Vec2(0, 4);
MV_Name->IsText = true;
MV_Name->Name = XorStr("MV_Name");
MV_Name->boolParam1 = false;
MV_Name->Color2[0] = 0.09f;
MV_Name->Color2[1] = 0.09f;
MV_Name->Color2[2] = 0.09f;
/*=====================================================================================*/
MV_Weapon->StartPos = MV_Weapon->Position;
MV_Weapon->Id = MI_WEAPON_TEXT;
MV_Weapon->Side = DOWN_S;
MV_Weapon->TextSize = 17;
MV_Weapon->Offset = Vec2(0, -1);
MV_Weapon->IsText = true;
MV_Weapon->Name = XorStr("MV_Weapon");
/*=====================================================================================*/
MV_Ammo->StartPos = MV_Ammo->Position;
MV_Ammo->Id = MI_AMMO_TEXT;
MV_Ammo->Side = DOWN_S;
MV_Ammo->TextSize = 17;
MV_Ammo->Offset = Vec2(0, -10);
MV_Ammo->IsText = true;
MV_Ammo->Name = XorStr("MV_Ammo");
MV_Ammo->Color1[0] = 1.0f;
MV_Ammo->Color1[1] = 1.0f;
MV_Ammo->Color1[2] = 1.0f;
/*=====================================================================================*/
MV_Distance->StartPos = MV_Distance->Position;
MV_Distance->Id = MI_DISTANCE_TEXT;
MV_Distance->Side = DOWN_RIGHT_DOWN_S;
MV_Distance->TextSize = 17;
MV_Distance->Offset = Vec2(-7, 0);
MV_Distance->IsText = true;
MV_Distance->Name = XorStr("MV_Distance");
/*=====================================================================================*/
MV_Money->StartPos = MV_Money->Position;
MV_Money->Id = MI_MONEY_TEXT;
MV_Money->Side = RIGHT_S;
MV_Money->TextSize = 17;
MV_Money->Color1[0] = 1.0f;
MV_Money->Color1[1] = 1.0f;
MV_Money->Color1[2] = 1.0f;
MV_Money->Offset = Vec2(-7, 0);
MV_Money->IsText = true;
MV_Money->Name = XorStr("MV_Money");
/*=====================================================================================*/
MV_Scope->StartPos = MV_Scope->Position;
MV_Scope->Id = MI_SCOPE_TEXT;
MV_Scope->Side = RIGHT_S;
MV_Scope->TextSize = 17;
MV_Scope->Color1[0] = 1.0f;
MV_Scope->Color1[1] = 1.0f;
MV_Scope->Color1[2] = 1.0f;
MV_Scope->Offset = Vec2(-7, -7);
MV_Scope->IsText = true;
MV_Scope->Name = XorStr("MV_Scope");
/*=====================================================================================*/
MV_Flashed->StartPos = MV_Flashed->Position;
MV_Flashed->Id = MI_FLASHED_TEXT;
MV_Flashed->Side = CENTER_RIGHT_S;
MV_Flashed->TextSize = 17;
MV_Flashed->Color1[0] = 1.0f;
MV_Flashed->Color1[1] = 1.0f;
MV_Flashed->Color1[2] = 1.0f;
MV_Flashed->Offset = Vec2(-7, 0);
MV_Flashed->IsText = true;
MV_Flashed->Name = XorStr("MV_Flashed");
/*=====================================================================================*/
MV_Defusing->StartPos = MV_Defusing->Position;
MV_Defusing->Id = MI_DEFUSING_TEXT;
MV_Defusing->Side = CENTER_RIGHT_S;
MV_Defusing->TextSize = 17;
MV_Defusing->Color1[0] = 1.0f;
MV_Defusing->Color1[1] = 1.0f;
MV_Defusing->Color1[2] = 1.0f;
MV_Defusing->Offset = Vec2(-7, -7);
MV_Defusing->IsText = true;
MV_Defusing->Name = XorStr("MV_Defusing");
}
};
LInitVisuals();
}