#include "Controls.h"
#include "Hooks.h" // for the unload meme
#include "Interfaces.h"
#define WINDOW_WIDTH 800
#define WINDOW_HEIGHT 600
AimWareWindow Menu::Window;
void UnLoadCallbk()
{
DoUnload = true;
}
void KnifeApplyCallbk()
{
static ConVar* Meme = Interfaces::CVar->FindVar("cl_fullupdate");
Meme->nFlags &= ~FCVAR_CHEAT;
Interfaces::Engine->ClientCmd_Unrestricted("cl_fullupdate");
}
void AimWareWindow::Setup()
{
SetPosition(50, 50);
SetSize(WINDOW_WIDTH, WINDOW_HEIGHT);
SetTitle(" PatrickHook-BestPrivateCheats);
RegisterTab(&RageBotTab);
RegisterTab(&LegitBotTab);
RegisterTab(&VisualsTab);
RegisterTab(&MiscTab);
RECT Client = GetClientArea();
Client.bottom -= 29;
RageBotTab.Setup();
LegitBotTab.Setup();
VisualsTab.Setup();
MiscTab.Setup();
#pragma region Bottom Buttons
UnloadButton.SetText("PANIC");
UnloadButton.SetCallback(UnLoadCallbk);
UnloadButton.SetPosition(16, Client.bottom - 42);
RageBotTab.RegisterControl(&UnloadButton);
LegitBotTab.RegisterControl(&UnloadButton);
VisualsTab.RegisterControl(&UnloadButton);
MiscTab.RegisterControl(&UnloadButton);
//SaveButton.SetText("Save Settings");
//SaveButton.SetCallback(Call);
//SaveButton.SetPosition(112, Client.bottom - 42);
//RageBotTab.RegisterControl(&SaveButton);
//LegitBotTab.RegisterControl(&SaveButton);
//VisualsTab.RegisterControl(&SaveButton);
//MiscTab.RegisterControl(&SaveButton);
#pragma endregion Setting up the settings buttons
}
void CRageBotTab::Setup()
{
SetTitle("Rage Aimbot");
ActiveLabel.SetPosition(16, 16);
ActiveLabel.SetText("Active");
RegisterControl(&ActiveLabel);
Active.SetFileId("active");
Active.SetPosition(66, 16);
RegisterControl(&Active);
#pragma region Aimbot
AimbotGroup.SetPosition(16, 48);
AimbotGroup.SetText("Aimbot");
AimbotGroup.SetSize(376, 280);
RegisterControl(&AimbotGroup);
AimbotEnable.SetFileId("aim_enable");
AimbotGroup.PlaceLabledControl("Enable", this, &AimbotEnable);
AimbotAutoFire.SetFileId("aim_autofire");
AimbotGroup.PlaceLabledControl("Auto Fire", this, &AimbotAutoFire);
AimbotFov.SetFileId("aim_fov");
AimbotFov.SetBoundaries(0.f, 180.f);
AimbotFov.SetValue(39.f);
AimbotGroup.PlaceLabledControl("FOV Range", this, &AimbotFov);
AimbotSilentAim.SetFileId("aim_silent");
AimbotGroup.PlaceLabledControl("Silent Aim", this, &AimbotSilentAim);
AimbotPSilent.SetFileId("aim_psilent");
AimbotGroup.PlaceLabledControl("Perfect Silent", this, &AimbotPSilent);
AimbotAutoPistol.SetFileId("aim_autopistol");
AimbotGroup.PlaceLabledControl("Auto Pistol", this, &AimbotAutoPistol);
AimbotAimStep.SetFileId("aim_aimstep");
AimbotGroup.PlaceLabledControl("Aim Step", this, &AimbotAimStep);
AimbotKeyPress.SetFileId("aim_usekey");
AimbotGroup.PlaceLabledControl("On Key Press", this, &AimbotKeyPress);
AimbotKeyBind.SetFileId("aim_key");
AimbotGroup.PlaceLabledControl("Key", this, &AimbotKeyBind);
AimbotChicken.SetFileId("aim_chicken");
AimbotGroup.PlaceLabledControl("Chikens", this, &AimbotChicken);
#pragma endregion Aimbot Controls Get Setup in here
#pragma region Target
TargetGroup.SetPosition(16, 344);
TargetGroup.SetText("Target");
TargetGroup.SetSize(376, 134);
RegisterControl(&TargetGroup);
TargetSelection.SetFileId("tgt_selection");
TargetSelection.AddItem("Closest To Crosshair");
TargetSelection.AddItem("Distance");
TargetSelection.AddItem("Lowest Health");
TargetGroup.PlaceLabledControl("Selection", this, &TargetSelection);
TargetFriendlyFire.SetFileId("tgt_friendlyfire");
TargetGroup.PlaceLabledControl("Friendly Fire", this, &TargetFriendlyFire);
TargetHitbox.SetFileId("tgt_hitbox");
TargetHitbox.AddItem("Head");
TargetHitbox.AddItem("Neck");
TargetHitbox.AddItem("Chest");
TargetHitbox.AddItem("Stomach");
TargetGroup.PlaceLabledControl("Hitbox", this, &TargetHitbox);
TargetHitscan.SetFileId("tgt_hitscan");
TargetHitscan.AddItem("Off"); //0
TargetHitscan.AddItem("Head / Body"); // 1
TargetHitscan.AddItem("All Basic"); // 2
TargetHitscan.AddItem("All Fucking Heaps"); // 3
TargetGroup.PlaceLabledControl("Hit Scan", this, &TargetHitscan);
#pragma endregion Targetting controls
#pragma region Accuracy
AccuracyGroup.SetPosition(408, 48);
AccuracyGroup.SetText("Accuracy");
AccuracyGroup.SetSize(360, 280);
RegisterControl(&AccuracyGroup);
AccuracySpread.SetFileId("acc_nospread");
AccuracyGroup.PlaceLabledControl("Anti Spread", this, &AccuracySpread);
AccuracyRecoil.SetFileId("acc_norecoil");
AccuracyGroup.PlaceLabledControl("Anti Recoil", this, &AccuracyRecoil);
AccuracyAutoWall.SetFileId("acc_awall");
AccuracyGroup.PlaceLabledControl("Auto Wall", this, &AccuracyAutoWall);
AccuracyMinimumDamage.SetFileId("acc_mindmg");
AccuracyMinimumDamage.SetBoundaries(1.f, 100.f);
AccuracyMinimumDamage.SetValue(1.f);
AccuracyGroup.PlaceLabledControl("Min AWall Damage", this, &AccuracyMinimumDamage);
AccuracyAutoStop.SetFileId("acc_stop");
AccuracyGroup.PlaceLabledControl("Auto Stop", this, &AccuracyAutoStop);
AccuracyAutoCrouch.SetFileId("acc_crouch");
AccuracyGroup.PlaceLabledControl("Auto Crouch", this, &AccuracyAutoCrouch);
AccuracyAutoScope.SetFileId("acc_scope");
AccuracyGroup.PlaceLabledControl("Auto Scope", this, &AccuracyAutoScope);
AccuracySpreadLimit.SetFileId("acc_spreadlimon");
AccuracyGroup.PlaceLabledControl("Spread Limit", this, &AccuracySpreadLimit);
AccuracyMinimumSpread.SetFileId("acc_spreadlim");
AccuracyMinimumSpread.SetBoundaries(0.f, 5.0f);
AccuracyMinimumSpread.SetValue(1.5f);
AccuracyGroup.PlaceLabledControl("Spread Limit Value", this, &AccuracyMinimumSpread);
AccuracyAngleFix.SetFileId("acc_aaa");
AccuracyGroup.PlaceLabledControl("AngleFix", this, &AccuracyAngleFix);
#pragma endregion Accuracy controls get Setup in here
#pragma region AntiAim
AntiAimGroup.SetPosition(408, 344);
AntiAimGroup.SetText("Anti-Aim");
AntiAimGroup.SetSize(360, 134);
RegisterControl(&AntiAimGroup);
AntiAimEnable.SetFileId("aa_enable");
AntiAimGroup.PlaceLabledControl("Enable", this, &AntiAimEnable);
AntiAimPitch.SetFileId("aa_x");
AntiAimPitch.AddItem("None");
AntiAimPitch.AddItem("Up");
AntiAimPitch.AddItem("Down");
AntiAimPitch.AddItem("Jitter");
AntiAimGroup.PlaceLabledControl("X", this, &AntiAimPitch);
AntiAimYaw.SetFileId("aa_y");
AntiAimYaw.AddItem("None");
AntiAimYaw.AddItem("Spin Fast");
AntiAimYaw.AddItem("Spin Slow");
AntiAimYaw.AddItem("Inverse");
AntiAimYaw.AddItem("Jitter");
AntiAimYaw.AddItem("Flip");
AntiAimGroup.PlaceLabledControl("Y", this, &AntiAimYaw);
#pragma endregion AntiAim controls get setup in here
}
void CLegitBotTab::Setup()
{
SetTitle("Legit Aimbot");
ActiveLabel.SetPosition(16, 16);
ActiveLabel.SetText("Active");
RegisterControl(&ActiveLabel);
Active.SetFileId("active");
Active.SetPosition(66, 16);
RegisterControl(&Active);
#pragma region Aimbot
AimbotGroup.SetPosition(16, 48);
AimbotGroup.SetText("Aimbot");
AimbotGroup.SetSize(240, 210);
RegisterControl(&AimbotGroup);
AimbotEnable.SetFileId("aim_enable");
AimbotGroup.PlaceLabledControl("Enable", this, &AimbotEnable);
AimbotAutoFire.SetFileId("aim_autofire");
AimbotGroup.PlaceLabledControl("Auto Fire", this, &AimbotAutoFire);
AimbotFriendlyFire.SetFileId("aim_friendfire");
AimbotGroup.PlaceLabledControl("Friendly Fire", this, &AimbotFriendlyFire);
AimbotKeyPress.SetFileId("aim_usekey");
AimbotGroup.PlaceLabledControl("On Key Press", this, &AimbotKeyPress);
AimbotKeyBind.SetFileId("aim_key");
AimbotGroup.PlaceLabledControl("Key Bind", this, &AimbotKeyBind);
AimbotAutoPistol.SetFileId("aim_apistol");
AimbotGroup.PlaceLabledControl("Auto Pistol", this, &AimbotAutoPistol);
#pragma endregion Aimbot shit
#pragma region Triggerbot
TriggerGroup.SetPosition(272, 48);
TriggerGroup.SetText("Triggerbot");
TriggerGroup.SetSize(240, 210);
RegisterControl(&TriggerGroup);
TriggerEnable.SetFileId("trig_enable");
TriggerGroup.PlaceLabledControl("Enable", this, &TriggerEnable);
TriggerKeyPress.SetFileId("trig_onkey");
TriggerGroup.PlaceLabledControl("On Key Press", this, &TriggerKeyPress);
TriggerKeyBind.SetFileId("trig_key");
TriggerGroup.PlaceLabledControl("Key Bind", this, &TriggerKeyBind);
TriggerDelay.SetFileId("trig_delay");
TriggerDelay.SetBoundaries(1, 1000);
TriggerDelay.SetValue(50);
TriggerGroup.PlaceLabledControl("Delay", this, &TriggerDelay);
#pragma endregion Triggerbot stuff
#pragma region Main Weapon
WeaponMainGroup.SetPosition(16, 274);
WeaponMainGroup.SetText("Rifles/Other");
WeaponMainGroup.SetSize(240, 210);
RegisterControl(&WeaponMainGroup);
WeaponMainSpeed.SetFileId("main_speed");
WeaponMainSpeed.SetBoundaries(0.1f, 2.f);
WeaponMainSpeed.SetValue(1.0f);
WeaponMainGroup.PlaceLabledControl("Max Speed", this, &WeaponMainSpeed);
WeaponMainFoV.SetFileId("main_fov");
WeaponMainFoV.SetBoundaries(0.1f, 30.f);
WeaponMainFoV.SetValue(5.f);
WeaponMainGroup.PlaceLabledControl("FOV", this, &WeaponMainFoV);
WeaponMainRecoil.SetFileId("main_recoil");
WeaponMainGroup.PlaceLabledControl("Recoil", this, &WeaponMainRecoil);
WeaponMainHitbox.SetFileId("main_hitbox");
WeaponMainHitbox.AddItem("Head");
WeaponMainHitbox.AddItem("Neck");
WeaponMainHitbox.AddItem("Chest");
WeaponMainHitbox.AddItem("Stomach");
WeaponMainGroup.PlaceLabledControl("Hitbox", this, &WeaponMainHitbox);
#pragma endregion
#pragma region Pistols
WeaponPistGroup.SetPosition(272, 274);
WeaponPistGroup.SetText("Pistols");
WeaponPistGroup.SetSize(240, 210);
RegisterControl(&WeaponPistGroup);
WeaponPistSpeed.SetFileId("pist_speed");
WeaponPistSpeed.SetBoundaries(0.1f, 2.f);
WeaponPistSpeed.SetValue(1.0f);
WeaponPistGroup.PlaceLabledControl("Max Speed", this, &WeaponPistSpeed);
WeaponPistFoV.SetFileId("pist_fov");
WeaponPistFoV.SetBoundaries(0.1f, 30.f);
WeaponPistFoV.SetValue(5.f);
WeaponPistGroup.PlaceLabledControl("FOV", this, &WeaponPistFoV);
WeaponPistRecoil.SetFileId("pist_recoil");
WeaponPistGroup.PlaceLabledControl("Recoil", this, &WeaponPistRecoil);
WeaponPistHitbox.SetFileId("pist_hitbox");
WeaponPistHitbox.AddItem("Head");
WeaponPistHitbox.AddItem("Neck");
WeaponPistHitbox.AddItem("Chest");
WeaponPistHitbox.AddItem("Stomach");
WeaponPistGroup.PlaceLabledControl("Hitbox", this, &WeaponPistHitbox);
#pragma endregion
#pragma region Snipers
WeaponSnipGroup.SetPosition(528, 274);
WeaponSnipGroup.SetText("Snipers");
WeaponSnipGroup.SetSize(240, 210);
RegisterControl(&WeaponSnipGroup);
WeaponSnipSpeed.SetFileId("snip_speed");
WeaponSnipSpeed.SetBoundaries(0.1f, 2.f);
WeaponSnipSpeed.SetValue(1.0f);
WeaponSnipGroup.PlaceLabledControl("Max Speed", this, &WeaponSnipSpeed);
WeaponSnipFoV.SetFileId("snip_fov");
WeaponSnipFoV.SetBoundaries(0.1f, 30.f);
WeaponSnipFoV.SetValue(5.f);
WeaponSnipGroup.PlaceLabledControl("FOV", this, &WeaponSnipFoV);
WeaponSnipRecoil.SetFileId("snip_recoil");
WeaponSnipGroup.PlaceLabledControl("Recoil", this, &WeaponSnipRecoil);
WeaponSnipHitbox.SetFileId("snip_hitbox");
WeaponSnipHitbox.AddItem("Head");
WeaponSnipHitbox.AddItem("Neck");
WeaponSnipHitbox.AddItem("Chest");
WeaponSnipHitbox.AddItem("Stomach");
WeaponSnipGroup.PlaceLabledControl("Hitbox", this, &WeaponSnipHitbox);
#pragma endregion
}
void CVisualTab::Setup()
{
SetTitle("Visuals & Misc");
ActiveLabel.SetPosition(16, 16);
ActiveLabel.SetText("Active");
RegisterControl(&ActiveLabel);
Active.SetFileId("active");
Active.SetPosition(66, 16);
RegisterControl(&Active);
#pragma region Options
OptionsGroup.SetText("Options");
OptionsGroup.SetPosition(16, 48);
OptionsGroup.SetSize(193, 430);
RegisterControl(&OptionsGroup);
OptionsBox.SetFileId("opt_box");
OptionsGroup.PlaceLabledControl("Box", this, &OptionsBox);
OptionsName.SetFileId("opt_name");
OptionsGroup.PlaceLabledControl("Name", this, &OptionsName);
OptionsHealth.SetFileId("opt_hp");
OptionsGroup.PlaceLabledControl("Health", this, &OptionsHealth);
OptionsWeapon.SetFileId("opt_weapon");
OptionsGroup.PlaceLabledControl("Weapon", this, &OptionsWeapon);
OptionsInfo.SetFileId("opt_info");
OptionsGroup.PlaceLabledControl("Info", this, &OptionsInfo);
OptionsChams.SetFileId("opt_chams");
OptionsChams.AddItem("Off");
OptionsChams.AddItem("Normal");
OptionsChams.AddItem("Flat");
OptionsGroup.PlaceLabledControl("Chams", this, &OptionsChams);
OptionsSkeleton.SetFileId("opt_bone");
OptionsGroup.PlaceLabledControl("Skeleton", this, &OptionsSkeleton);
OptionsAimSpot.SetFileId("opt_aimspot");
OptionsGroup.PlaceLabledControl("Aim Spot", this, &OptionsAimSpot);
OptionsCompRank.SetFileId("opt_comprank");
OptionsGroup.PlaceLabledControl("Competitive Rank", this, &OptionsCompRank);
#pragma endregion Setting up the Options controls
#pragma region Filters
FiltersGroup.SetText("Filters");
FiltersGroup.SetPosition(225, 48);
FiltersGroup.SetSize(193, 430);
RegisterControl(&FiltersGroup);
FiltersAll.SetFileId("ftr_all");
FiltersGroup.PlaceLabledControl("All", this, &FiltersAll);
FiltersPlayers.SetFileId("ftr_players");
FiltersGroup.PlaceLabledControl("Players", this, &FiltersPlayers);
FiltersEnemiesOnly.SetFileId("ftr_enemyonly");
FiltersGroup.PlaceLabledControl("Enemies Only", this, &FiltersEnemiesOnly);
FiltersWeapons.SetFileId("ftr_weaps");
FiltersGroup.PlaceLabledControl("Weapons", this, &FiltersWeapons);
FiltersChickens.SetFileId("ftr_chickens");
FiltersGroup.PlaceLabledControl("Chickens", this, &FiltersChickens);
FiltersC4.SetFileId("ftr_c4");
FiltersGroup.PlaceLabledControl("C4", this, &FiltersC4);
#pragma endregion Setting up the Filters controls
#pragma region Other
OtherGroup.SetText("Other");
OtherGroup.SetPosition(434, 48);
OtherGroup.SetSize(334, 430);
RegisterControl(&OtherGroup);
OtherCrosshair.SetFileId("otr_xhair");
OtherGroup.PlaceLabledControl("Crosshair", this, &OtherCrosshair);
OtherRecoilCrosshair.SetFileId("otr_recoilhair");
OtherRecoilCrosshair.AddItem("Off");
OtherRecoilCrosshair.AddItem("Recoil Position");
OtherRecoilCrosshair.AddItem("Radius");
OtherGroup.PlaceLabledControl("Recoil Crosshair", this, &OtherRecoilCrosshair);
OtherRadar.SetFileId("otr_radar");
OtherGroup.PlaceLabledControl("Radar", this, &OtherRadar);
OtherNoVisualRecoil.SetFileId("otr_visrecoil");
OtherGroup.PlaceLabledControl("No Visual Recoil", this, &OtherNoVisualRecoil);
OtherNoSky.SetFileId("otr_nosky");
OtherGroup.PlaceLabledControl("No Sky", this, &OtherNoSky);
OtherNoFlash.SetFileId("otr_noflash");
OtherGroup.PlaceLabledControl("No Flash", this, &OtherNoFlash);
OtherNoSmoke.SetFileId("otr_nosmoke");
OtherGroup.PlaceLabledControl("No Smoke", this, &OtherNoSmoke);
OtherNoHands.SetFileId("otr_hands");
OtherNoHands.AddItem("Off");
OtherNoHands.AddItem("None");
OtherNoHands.AddItem("Transparent");
OtherNoHands.AddItem("Chams");
OtherNoHands.AddItem("Rainbow");
OtherGroup.PlaceLabledControl("Hands", this, &OtherNoHands);
OtherAutoJump.SetFileId("otr_autojump");
OtherGroup.PlaceLabledControl("Auto Jump", this, &OtherAutoJump);
OtherAutoStrafe.SetFileId("otr_autostrafe");
OtherGroup.PlaceLabledControl("Auto Strafe", this, &OtherAutoStrafe);
OtherSafeMode.SetFileId("otr_safemode");
OtherSafeMode.SetState(true);
OtherGroup.PlaceLabledControl("Safe Mode", this, &OtherSafeMode);
OtherChatSpam.SetFileId("otr_spam");
OtherChatSpam.AddItem("Off");
OtherChatSpam.AddItem("Round-Say");
OtherChatSpam.AddItem("Regular");
OtherChatSpam.AddItem("Report Text Spam");
OtherGroup.PlaceLabledControl("Chat Spam", this, &OtherChatSpam);
OtherAirStuck.SetFileId("otr_astuck");
OtherGroup.PlaceLabledControl("Air Stuck", this, &OtherAirStuck);
OtherSpectators.SetFileId("otr_speclist");
OtherGroup.PlaceLabledControl("Spectators List", this, &OtherSpectators);
#pragma endregion Setting up the Other controls
}
void CMiscTab::Setup()
{
SetTitle("Skins");
#pragma region Knife
KnifeGroup.SetPosition(16, 16);
KnifeGroup.SetSize(360, 400);
KnifeGroup.SetText("Skin Changer");
RegisterControl(&KnifeGroup);
KnifeEnable.SetFileId("knife_enable");
KnifeGroup.PlaceLabledControl("Enable", this, &KnifeEnable);
KnifeModel.SetFileId("knife_model");
KnifeModel.AddItem("Karambit");
KnifeModel.AddItem("Bayonet");
KnifeModel.AddItem("Huntsman Knife");
KnifeModel.AddItem("Gut Knife");
KnifeModel.AddItem("Walmart Knife");
KnifeModel.AddItem("Shadow Daggers");
KnifeModel.AddItem("Butterfly Knife");
KnifeModel.AddItem("Flip Knife");
KnifeGroup.PlaceLabledControl("Knife", this, &KnifeModel);
KnifeSkin.SetFileId("knife_skin");
KnifeSkin.AddItem("Fade");
KnifeSkin.AddItem("Damascus Steel");
KnifeSkin.AddItem("Doppler Phase 1");
KnifeSkin.AddItem("Doppler Phase 2");
KnifeSkin.AddItem("Doppler Phase 3");
KnifeSkin.AddItem("Doppler Phase 4");
KnifeSkin.AddItem("Doppler (Ruby)");
KnifeSkin.AddItem("Doppler (Sapphire)");
KnifeSkin.AddItem("Doppler (Blackpearl)");
KnifeSkin.AddItem("Marble Fade");
KnifeSkin.AddItem("Tiger Tooth");
KnifeSkin.AddItem("Ultraviolet");
KnifeSkin.AddItem("Crimson Web");
KnifeSkin.AddItem("Slaughter");
KnifeSkin.AddItem("Night");
KnifeGroup.PlaceLabledControl("Skin", this, &KnifeSkin);
M41SSkin.SetFileId("m4a1s_skin");
M41SSkin.AddItem("Masterpiece");
M41SSkin.AddItem("Hyper Beast");
M41SSkin.AddItem("Cyrex");
M41SSkin.AddItem("Hot Rod");
KnifeGroup.PlaceLabledControl("M4A1-S", this, &M41SSkin);
M4A4Skin.SetFileId("m4a4_skin");
M4A4Skin.AddItem("Royal Paladin");
M4A4Skin.AddItem("Howl");
M4A4Skin.AddItem("Bullet Rain");
M4A4Skin.AddItem("Dragon King");
M4A4Skin.AddItem("Asiimov");
KnifeGroup.PlaceLabledControl("M4A4", this, &M4A4Skin);
AK47Skin.SetFileId("ak47_skin");
AK47Skin.AddItem("Point Disarray");
AK47Skin.AddItem("Aquamarine Revenge");
AK47Skin.AddItem("Vulcan");
AK47Skin.AddItem("Fire Serpent");
AK47Skin.AddItem("Jaguar");
KnifeGroup.PlaceLabledControl("AK-47", this, &AK47Skin);
AWPSkin.SetFileId("awp_skin");
AWPSkin.AddItem("Hyper Beast");
AWPSkin.AddItem("Asiimov");
AWPSkin.AddItem("Dragon Lore");
AWPSkin.AddItem("Lightning Strike");
KnifeGroup.PlaceLabledControl("AWP", this, &AWPSkin);
GLOCKSkin.SetFileId("glock_skin");
GLOCKSkin.AddItem("Water Elemental");
GLOCKSkin.AddItem("Fade");
GLOCKSkin.AddItem("Twilight Galaxy");
GLOCKSkin.AddItem("Bunsen Burner");
KnifeGroup.PlaceLabledControl("Glock", this, &GLOCKSkin);
USPSSkin.SetFileId("m4a1s_skin");
USPSSkin.AddItem("Kill Confirmed");
USPSSkin.AddItem("Caiman");
USPSSkin.AddItem("Orion");
USPSSkin.AddItem("Guardian");
KnifeGroup.PlaceLabledControl("USP-S", this, &USPSSkin);
MAGNUMSkin.SetFileId("357_skin");
MAGNUMSkin.AddItem("Crimson Web");
MAGNUMSkin.AddItem("Fade");
MAGNUMSkin.AddItem("Amber Fade");
KnifeGroup.PlaceLabledControl("R8 Revolver", this, &MAGNUMSkin);
KnifeApply.SetText("Apply Changes");
KnifeApply.SetCallback(KnifeApplyCallbk);
KnifeGroup.PlaceLabledControl("", this, &KnifeApply);
#pragma endregion
#pragma endregion other random options
}
void Menu::SetupMenu()
{
Window.Setup();
GUI.RegisterWindow(&Window);
GUI.BindWindow(VK_INSERT, &Window);
}
void Menu::DoUIFrame()
{
// General Processing
// If the "all filter is selected tick all the others
if (Window.VisualsTab.FiltersAll.GetState())
{
Window.VisualsTab.FiltersC4.SetState(true);
Window.VisualsTab.FiltersChickens.SetState(true);
Window.VisualsTab.FiltersPlayers.SetState(true);
Window.VisualsTab.FiltersWeapons.SetState(true);
}
GUI.Update();
GUI.Draw();
}
#include "GUI.h"
#include "RenderManager.h"
#include
#include "tinyxml2.h"
#include "Controls.h"
CGUI GUI;
CGUI::CGUI()
{
}
// Draws all windows
void CGUI::Draw()
{
bool ShouldDrawCursor = false;
for (auto window : Windows)
{
if (window->m_bIsOpen)
{
ShouldDrawCursor = true;
DrawWindow(window);
}
}
if (ShouldDrawCursor)
{
static Vertex_t MouseVt[3];
MouseVt[0].Init(Vector2D(Mouse.x, Mouse.y));
MouseVt[1].Init(Vector2D(Mouse.x + 16, Mouse.y));
MouseVt[2].Init(Vector2D(Mouse.x, Mouse.y + 16));
Render::PolygonOutline(3, MouseVt, Color(150, 0, 0, 230), Color(0, 0, 0, 150));
}
}
// Handle all input etc
void CGUI::Update()
{
//Key Array
std::copy(keys, keys + 255, oldKeys);
for (int x = 0; x < 255; x++)
{
//oldKeys[x] = oldKeys[x] & keys[x];
keys[x] = (GetAsyncKeyState(x));
}
// Mouse Location
POINT mp; GetCursorPos(&mp);
Mouse.x = mp.x; Mouse.y = mp.y;
RECT Screen = Render::GetViewport();
// Window Binds
for (auto & bind : WindowBinds)
{
if (GetKeyPress(bind.first))
{
bind.second->Toggle();
}
}
// Stop dragging
if (IsDraggingWindow && !GetKeyState(VK_LBUTTON))
{
IsDraggingWindow = false;
DraggingWindow = nullptr;
}
// If we are in the proccess of dragging a window
if (IsDraggingWindow && GetKeyState(VK_LBUTTON) && !GetKeyPress(VK_LBUTTON))
{
if (DraggingWindow)
{
DraggingWindow->m_x = Mouse.x - DragOffsetX;
DraggingWindow->m_y = Mouse.y - DragOffsetY;
}
}
// Process some windows
for (auto window : Windows)
{
if (window->m_bIsOpen)
{
// Used to tell the widget processing that there could be a click
bool bCheckWidgetClicks = false;
// If the user clicks inside the window
if (GetKeyPress(VK_LBUTTON))
{
if (IsMouseInRegion(window->m_x, window->m_y, window->m_x + window->m_iWidth, window->m_y + window->m_iHeight))
{
// Is it inside the client area?
if (IsMouseInRegion(window->GetClientArea()))
{
// User is selecting a new tab
if (IsMouseInRegion(window->GetTabArea()))
{
// Loose focus on the control
window->IsFocusingControl = false;
window->FocusedControl = nullptr;
int iTab = 0;
int TabCount = window->Tabs.size();
if (TabCount) // If there are some tabs
{
int TabSize = (window->m_iWidth - 4 - 12) / TabCount;
int Dist = Mouse.x - (window->m_x + 8);
while (Dist > TabSize)
{
if (Dist > TabSize)
{
iTab++;
Dist -= TabSize;
}
}
window->SelectedTab = window->Tabs[iTab];
}
}
else
bCheckWidgetClicks = true;
}
else
{
// Must be in the around the title or side of the window
// So we assume the user is trying to drag the window
IsDraggingWindow = true;
DraggingWindow = window;
DragOffsetX = Mouse.x - window->m_x;
DragOffsetY = Mouse.y - window->m_y;
// Loose focus on the control
window->IsFocusingControl = false;
window->FocusedControl = nullptr;
}
}
else
{
// Loose focus on the control
window->IsFocusingControl = false;
window->FocusedControl = nullptr;
}
}
// Controls
if (window->SelectedTab != nullptr)
{
// Focused widget
bool SkipWidget = false;
CControl* SkipMe = nullptr;
// this window is focusing on a widget??
if (window->IsFocusingControl)
{
if (window->FocusedControl != nullptr)
{
// We've processed it once, skip it later
SkipWidget = true;
SkipMe = window->FocusedControl;
POINT cAbs = window->FocusedControl->GetAbsolutePos();
RECT controlRect = { cAbs.x, cAbs.y, window->FocusedControl->m_iWidth, window->FocusedControl->m_iHeight };
window->FocusedControl->OnUpdate();
if (window->FocusedControl->Flag(UIFlags::UI_Clickable) && IsMouseInRegion(controlRect) && bCheckWidgetClicks)
{
window->FocusedControl->OnClick();
// If it gets clicked we loose focus
window->IsFocusingControl = false;
window->FocusedControl = nullptr;
bCheckWidgetClicks = false;
}
}
}
// Itterate over the rest of the control
for (auto control : window->SelectedTab->Controls)
{
if (control != nullptr)
{
if (SkipWidget && SkipMe == control)
continue;
POINT cAbs = control->GetAbsolutePos();
RECT controlRect = { cAbs.x, cAbs.y, control->m_iWidth, control->m_iHeight };
control->OnUpdate();
if (control->Flag(UIFlags::UI_Clickable) && IsMouseInRegion(controlRect) && bCheckWidgetClicks)
{
control->OnClick();
bCheckWidgetClicks = false;
// Change of focus
if (control->Flag(UIFlags::UI_Focusable))
{
window->IsFocusingControl = true;
window->FocusedControl = control;
}
else
{
window->IsFocusingControl = false;
window->FocusedControl = nullptr;
}
}
}
}
// We must have clicked whitespace
if (bCheckWidgetClicks)
{
// Loose focus on the control
window->IsFocusingControl = false;
window->FocusedControl = nullptr;
}
}
}
}
}
// Returns
bool CGUI::GetKeyPress(unsigned int key)
{
if (keys[key] == true && oldKeys[key] == false)
return true;
else
return false;
}
bool CGUI::GetKeyState(unsigned int key)
{
return keys[key];
}
bool CGUI::IsMouseInRegion(int x, int y, int x2, int y2)
{
if (Mouse.x > x && Mouse.y > y && Mouse.x < x2 && Mouse.y < y2)
return true;
else
return false;
}
bool CGUI::IsMouseInRegion(RECT region)
{
return IsMouseInRegion(region.left, region.top, region.left + region.right, region.top + region.bottom);
}
POINT CGUI::GetMouse()
{
return Mouse;
}
bool CGUI::DrawWindow(CWindow* window)
{
// Main Window
Render::Outline(window->m_x, window->m_y, window->m_iWidth, window->m_iHeight, Color(20, 20, 20, 80));
Render::GradientV(window->m_x + 2, window->m_y + 2, window->m_iWidth - 4, 26, Color(0, 0, 0, 255), Color(0, 0, 0, 255));
Render::Clear(window->m_x + 2, window->m_y + 2 + 26, window->m_iWidth - 4, window->m_iHeight - 4 - 26, Color(0, 0, 0, 255));
Render::Outline(window->m_x + 1, window->m_y + 1, window->m_iWidth - 2, window->m_iHeight - 2, Color(255, 0, 0, 255));
Render::Text(window->m_x + 8, window->m_y + 8, Color(255, 255, 255, 255), Render::Fonts::MenuBold, window->Title.c_str());
//Inner
Render::Outline(window->m_x + 7, window->m_y + 1 + 26, window->m_iWidth - 4 - 10, window->m_iHeight - 2 - 6 - 26, Color(255, 0, 0, 255));
Render::Clear(window->m_x + 8, window->m_y + 1 + 27, window->m_iWidth - 4 - 12, window->m_iHeight - 2 - 8 - 26, Color(255, 255, 255, 255));
//Tab
Render::GradientV(window->m_x + 8, window->m_y + 1 + 27, window->m_iWidth - 4 - 12, 29, Color(52, 52, 52, 255), Color(6, 6, 6, 255));
int TabCount = window->Tabs.size();
if (TabCount) // If there are some tabs
{
int TabSize = (window->m_iWidth - 4 - 12) / TabCount;
for (int i = 0; i < TabCount; i++)
{
RECT TabArea = { window->m_x + 8 + (i * TabSize), window->m_y + 1 + 27, TabSize, 29 };
CTab* tab = window->Tabs[i];
if (window->SelectedTab == tab)
{
Render::GradientV(window->m_x + 8 + (i * TabSize), window->m_y + 1 + 27, TabSize, 29, Color(52, 52, 52, 255), Color(106, 106, 106, 255));
}
else if (IsMouseInRegion(TabArea))
{
Render::GradientV(window->m_x + 8 + (i * TabSize), window->m_y + 1 + 27, TabSize, 29, Color(106, 106, 106, 255), Color(52, 52, 52, 255));
}
RECT TextSize = Render::GetTextSize(Render::Fonts::MenuBold, tab->Title.c_str());
Render::Text(TabArea.left + (TabSize / 2) - (TextSize.right / 2), TabArea.top + 8, Color(255, 255, 255, 255), Render::Fonts::MenuBold, tab->Title.c_str());
Render::Clear(window->m_x + 8, window->m_y + 1 + 27, window->m_iWidth - 4 - 12, 2, Color(66, 66, 66, 255));
}
}
// Controls
if (window->SelectedTab != nullptr)
{
// Focused widget
bool SkipWidget = false;
CControl* SkipMe = nullptr;
// this window is focusing on a widget??
if (window->IsFocusingControl)
{
if (window->FocusedControl != nullptr)
{
// We need to draw it last, so skip it in the regular loop
SkipWidget = true;
SkipMe = window->FocusedControl;
}
}
// Itterate over all the other controls
for (auto control : window->SelectedTab->Controls)
{
if (SkipWidget && SkipMe == control)
continue;
if (control != nullptr && control->Flag(UIFlags::UI_Drawable))
{
POINT cAbs = control->GetAbsolutePos();
RECT controlRect = { cAbs.x, cAbs.y, control->m_iWidth, control->m_iHeight };
bool hover = false;
if (IsMouseInRegion(controlRect))
{
hover = true;
}
control->Draw(hover);
}
}
// Draw the skipped widget last
if (SkipWidget)
{
auto control = window->FocusedControl;
if (control != nullptr && control->Flag(UIFlags::UI_Drawable))
{
POINT cAbs = control->GetAbsolutePos();
RECT controlRect = { cAbs.x, cAbs.y, control->m_iWidth, control->m_iHeight };
bool hover = false;
if (IsMouseInRegion(controlRect))
{
hover = true;
}
control->Draw(hover);
}
}
}
return true;
}
void CGUI::RegisterWindow(CWindow* window)
{
Windows.push_back(window);
// Resorting to put groupboxes at the start
for (auto tab : window->Tabs)
{
for (auto control : tab->Controls)
{
if (control->Flag(UIFlags::UI_RenderFirst))
{
CControl* c = control;
tab->Controls.erase(std::remove(tab->Controls.begin(), tab->Controls.end(), control), tab->Controls.end());
tab->Controls.insert(tab->Controls.begin(), control);
}
}
}
}
void CGUI::BindWindow(unsigned char Key, CWindow* window)
{
if (window)
WindowBinds[Key] = window;
else
WindowBinds.erase(Key);
}
void CGUI::SaveWindowState(CWindow* window, std::string Filename)
{
// Create a whole new document and we'll just save over top of the old one
tinyxml2::XMLDocument Doc;
// Root Element is called "ayy"
tinyxml2::XMLElement* Root = Doc.NewElement("ayy");
Doc.LinkEndChild(Root);
Utilities::Log("Saving Window %s", window->Title.c_str());
// If the window has some tabs..
if (Root && window->Tabs.size() > 0)
{
for (auto Tab : window->Tabs)
{
// Add a new section for this tab
tinyxml2::XMLElement* TabElement = Doc.NewElement(Tab->Title.c_str());
Root->LinkEndChild(TabElement);
Utilities::Log("Saving Tab %s", Tab->Title.c_str());
// Now we itterate the controls this tab contains
if (TabElement && Tab->Controls.size() > 0)
{
for (auto Control : Tab->Controls)
{
// If the control is ok to be saved
if (Control && Control->Flag(UIFlags::UI_SaveFile) && Control->FileIdentifier.length() > 1 && Control->FileControlType)
{
// Create an element for the control
tinyxml2::XMLElement* ControlElement = Doc.NewElement(Control->FileIdentifier.c_str());
TabElement->LinkEndChild(ControlElement);
Utilities::Log("Saving control %s", Control->FileIdentifier.c_str());
if (!ControlElement)
{
Utilities::Log("Errorino :(");
return;
}
CCheckBox* cbx = nullptr;
CComboBox* cbo = nullptr;
CKeyBind* key = nullptr;
CSlider* sld = nullptr;
// Figure out what kind of control and data this is
switch (Control->FileControlType)
{
case UIControlTypes::UIC_CheckBox:
cbx = (CCheckBox*)Control;
ControlElement->SetText(cbx->GetState());
break;
case UIControlTypes::UIC_ComboBox:
cbo = (CComboBox*)Control;
ControlElement->SetText(cbo->GetIndex());
break;
case UIControlTypes::UIC_KeyBind:
key = (CKeyBind*)Control;
ControlElement->SetText(key->GetKey());
break;
case UIControlTypes::UIC_Slider:
sld = (CSlider*)Control;
ControlElement->SetText(sld->GetValue());
break;
}
}
}
}
}
}
//Save the file
if (Doc.SaveFile(Filename.c_str()) != tinyxml2::XML_NO_ERROR)
{
MessageBox(NULL, "Failed To Save Config File!", "AyyWare", MB_OK);
}
}
void CGUI::LoadWindowState(CWindow* window, std::string Filename)
{
// Lets load our meme
tinyxml2::XMLDocument Doc;
if (Doc.LoadFile(Filename.c_str()) == tinyxml2::XML_NO_ERROR)
{
tinyxml2::XMLElement* Root = Doc.RootElement();
// The root "ayy" element
if (Root)
{
// If the window has some tabs..
if (Root && window->Tabs.size() > 0)
{
for (auto Tab : window->Tabs)
{
// We find the corresponding element for this tab
tinyxml2::XMLElement* TabElement = Root->FirstChildElement(Tab->Title.c_str());
if (TabElement)
{
// Now we itterate the controls this tab contains
if (TabElement && Tab->Controls.size() > 0)
{
for (auto Control : Tab->Controls)
{
// If the control is ok to be saved
if (Control && Control->Flag(UIFlags::UI_SaveFile) && Control->FileIdentifier.length() > 1 && Control->FileControlType)
{
// Get the controls element
tinyxml2::XMLElement* ControlElement = TabElement->FirstChildElement(Control->FileIdentifier.c_str());
if (ControlElement)
{
Utilities::Log("We tryin to load fam");
CCheckBox* cbx = nullptr;
CComboBox* cbo = nullptr;
CKeyBind* key = nullptr;
CSlider* sld = nullptr;
// Figure out what kind of control and data this is
switch (Control->FileControlType)
{
case UIControlTypes::UIC_CheckBox:
cbx = (CCheckBox*)Control;
cbx->SetState(ControlElement->GetText()[0] == '1' ? true : false);
break;
case UIControlTypes::UIC_ComboBox:
cbo = (CComboBox*)Control;
cbo->SelectIndex(atoi(ControlElement->GetText()));
break;
case UIControlTypes::UIC_KeyBind:
key = (CKeyBind*)Control;
key->SetKey(atoi(ControlElement->GetText()));
break;
case UIControlTypes::UIC_Slider:
sld = (CSlider*)Control;
sld->SetValue(atof(ControlElement->GetText()));
break;
}
}
}
}
}
}
}
}
}
}
}/*
Syn's AYYWAREFramework 2015
*/
// Credits to Valve and Shad0w
#include "Interfaces.h"
#include "Menu.h"
// Shad0ws Yaw fix
// (FIX ME UP LATER)
void FixY(const CRecvProxyData* pData, void* pStruct, void* pOut)
{
static Vector vLast[65];
static bool bShotLastTime[65];
static bool bJitterFix[65];
float* flPitch = (float*)((DWORD)pOut - 4);
float flYaw = pData->m_Value.m_Float;
bool bHasAA;
bool bSpinbot;
if (Menu::Window.RageBotTab.AccuracyAngleFix.GetState())
{
bHasAA = ((*flPitch == 90.0f) || (*flPitch == 270.0f));
bSpinbot = false;
if (!bShotLastTime[((IClientEntity*)(pStruct))->GetIndex()]
&& (fabsf(flYaw - vLast[((IClientEntity*)(pStruct))->GetIndex()].y) > 15.0f) && !bHasAA)
{
flYaw = vLast[((IClientEntity*)(pStruct))->GetIndex()].y;
bShotLastTime[((IClientEntity*)(pStruct))->GetIndex()] = true;
}
else
{
if (bShotLastTime[((IClientEntity*)(pStruct))->GetIndex()]
&& (fabsf(flYaw - vLast[((IClientEntity*)(pStruct))->GetIndex()].y) > 15.0f))
{
bShotLastTime[((IClientEntity*)(pStruct))->GetIndex()] = true;
bSpinbot = true;
}
else
{
bShotLastTime[((IClientEntity*)(pStruct))->GetIndex()] = false;
}
}
vLast[((IClientEntity*)(pStruct))->GetIndex()].y = flYaw;
bool bTmp = bJitterFix[((IClientEntity*)(pStruct))->GetIndex()];
bJitterFix[((IClientEntity*)(pStruct))->GetIndex()] = (flYaw >= 180.0f && flYaw <= 360.0f);
if (bTmp && (flYaw >= 0.0f && flYaw <= 180.0f))
{
flYaw += 359.0f;
}
}
*(float*)(pOut) = flYaw;
}
// Simple fix for some Fake-Downs
void FixX(const CRecvProxyData* pData, void* pStruct, void* pOut)
{
float* ang = (float*)pOut;
*ang = pData->m_Value.m_Float;
if (!Menu::Window.RageBotTab.AccuracyAngleFix.GetState()) return;
if (pData->m_Value.m_Float > 180.0f)
*ang -= 360.0f;
else if (pData->m_Value.m_Float < -180.0f)
*ang += 360.0f;
}
RecvVarProxyFn oRecvnModelIndex;
void Hooked_RecvProxy_Viewmodel(CRecvProxyData* pData, void* pStruct, void* pOut)
{
// Get the knife view model id's
static int default_t = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_default_t.mdl");
static int default_ct = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_default_ct.mdl");
int iBayonet = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_bayonet.mdl");
int iButterfly = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_butterfly.mdl");
int iFlip = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_flip.mdl");
int iGunGame = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_gg.mdl");
int iGut = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_gut.mdl");
int iKarambit = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_karam.mdl");
int iM9Bayonet = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_m9_bay.mdl");
int iHuntsman = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_tactical.mdl");
int iFalchion = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_falchion_advanced.mdl");
int iDagger = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_push.mdl");
// Get local player (just to stop replacing spectators knifes)
IClientEntity* pLocal = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
if (Menu::Window.MiscTab.KnifeEnable.GetState() && pLocal)
{
// If we are alive and holding a default knife(if we already have a knife don't worry about changing)
if (pLocal->IsAlive() && (pData->m_Value.m_Int == default_t || pData->m_Value.m_Int == default_ct))
{
// Set whatever knife we want
if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 0)
pData->m_Value.m_Int = iKarambit;
else if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 1)
pData->m_Value.m_Int = iBayonet;
else if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 2)
pData->m_Value.m_Int = iHuntsman;
else if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 3)
pData->m_Value.m_Int = iGut;
else if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 4)
pData->m_Value.m_Int = iFalchion;
else if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 5)
pData->m_Value.m_Int = iDagger;
else if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 6)
pData->m_Value.m_Int = iButterfly;
else if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 7)
pData->m_Value.m_Int = iFlip;
}
}
// Carry on the to original proxy
oRecvnModelIndex(pData, pStruct, pOut);
}
void ApplyAAAHooks()
{
ClientClass* pClass = Interfaces::Client->GetAllClasses();
while (pClass)
{
const char* pszName = pClass->m_pRecvTable->m_pNetTableName;
if (!strcmp(pszName, "DT_CSPlayer"))
{
for (int i = 0; i < pClass->m_pRecvTable->m_nProps; i++)
{
RecvProp* pProp = &(pClass->m_pRecvTable->m_pProps[i]);
const char* name = pProp->m_pVarName;
// Pitch Fix
if (!strcmp(name, "m_angEyeAngles[0]"))
{
pProp->m_ProxyFn = FixX;
}
// Yaw Fix
if (!strcmp(name, "m_angEyeAngles[1]"))
{
//Utilities::Log("Yaw Fix Applied");
pProp->m_ProxyFn = FixY;
}
}
}
else if (!strcmp(pszName, "DT_BaseViewModel"))
{
for (int i = 0; i < pClass->m_pRecvTable->m_nProps; i++)
{
RecvProp* pProp = &(pClass->m_pRecvTable->m_pProps[i]);
const char* name = pProp->m_pVarName;
// Knives
if (!strcmp(name, "m_nModelIndex"))
{
oRecvnModelIndex = (RecvVarProxyFn)pProp->m_ProxyFn;
pProp->m_ProxyFn = Hooked_RecvProxy_Viewmodel;
}
}
}
pClass = pClass->m_pNext;
}
}/*
Syn's AYYWAREFramework 2015
*/
// Credits to Valve and Shad0w
#pragma once
void ApplyAAAHooks();
#include "AutoWall.h"
#define HITGROUP_GENERIC 0
#define HITGROUP_HEAD 1
#define HITGROUP_CHEST 2
#define HITGROUP_STOMACH 3
#define HITGROUP_LEFTARM 4
#define HITGROUP_RIGHTARM 5
#define HITGROUP_LEFTLEG 6
#define HITGROUP_RIGHTLEG 7
#define HITGROUP_GEAR 10
inline bool CGameTrace::DidHitWorld() const
{
return m_pEnt->GetIndex() == 0;
}
inline bool CGameTrace::DidHitNonWorldEntity() const
{
return m_pEnt != NULL && !DidHitWorld();
}
bool HandleBulletPenetration(CSWeaponInfo* wpn_data, FireBulletData &data);
float GetHitgroupDamageMult(int iHitGroup)
{
switch (iHitGroup)
{
case HITGROUP_GENERIC:
return 1.0f;
case HITGROUP_HEAD:
return 2.0f;
case HITGROUP_CHEST:
return 1.0f;
case HITGROUP_STOMACH:
return 1.0f;
case HITGROUP_LEFTARM:
case HITGROUP_RIGHTARM:
return 1.0f;
case HITGROUP_LEFTLEG:
case HITGROUP_RIGHTLEG:
return 1.0f;
default:
return 1.0f;
}
}
void ScaleDamage(int hitgroup, IClientEntity* enemy, float weapon_armor_ratio, float ¤t_damage)
{
current_damage *= GetHitgroupDamageMult(hitgroup);
if (enemy->ArmorValue() > 0)
{
if (hitgroup == HITGROUP_HEAD)
{
if (enemy->HasHelmet())
current_damage *= (weapon_armor_ratio * .5f);
}
else
{
current_damage *= (weapon_armor_ratio * .5f);
}
}
}
bool SimulateFireBullet(IClientEntity* local, CBaseCombatWeapon* weapon, FireBulletData &data)
{
//Utils::ToLog("SimulateFireBullet");
data.penetrate_count = 4;
data.trace_length = 0.0f;
auto* wpn_data = weapon->GetCSWpnData();
data.current_damage = (float)wpn_data->m_iDamage;
while ((data.penetrate_count > 0) && (data.current_damage >= 1.0f))
{
data.trace_length_remaining = wpn_data->m_flRange - data.trace_length;
Vector end = data.src + data.direction * data.trace_length_remaining;
UTIL_TraceLine(data.src, end, 0x4600400B, local, 0, &data.enter_trace);
UTIL_ClipTraceToPlayers(data.src, end + data.direction * 40.f, 0x4600400B, &data.filter, &data.enter_trace);
if (data.enter_trace.fraction == 1.0f)
break;
if ((data.enter_trace.hitgroup <= 7)
&& (data.enter_trace.hitgroup > 0)
&& (local->GetTeamNum() != data.enter_trace.m_pEnt->GetTeamNum())
/*&& (DoesRayTouchHitbox(end, &data))*/)
{
data.trace_length += data.enter_trace.fraction * data.trace_length_remaining;
data.current_damage *= pow(wpn_data->m_flRangeModifier, data.trace_length * 0.002);
ScaleDamage(data.enter_trace.hitgroup, data.enter_trace.m_pEnt, wpn_data->m_flArmorRatio, data.current_damage);
return true;
}
if (!HandleBulletPenetration(wpn_data, data))
break;
}
return false;
}
bool HandleBulletPenetration(CSWeaponInfo* wpn_data, FireBulletData &data)
{
surfacedata_t* enter_surface_data = Interfaces::PhysProps->GetSurfaceData(data.enter_trace.surface.surfaceProps);
int enter_material = enter_surface_data->game.material;
float enter_surf_penetration_mod = enter_surface_data->game.flPenetrationModifier;
data.trace_length += data.enter_trace.fraction * data.trace_length_remaining;
data.current_damage *= pow(wpn_data->m_flRangeModifier, (data.trace_length * 0.002));
if ((data.trace_length > 3000.f) || (enter_surf_penetration_mod < 0.1f))
data.penetrate_count = 0;
if (data.penetrate_count <= 0)
return false;
Vector dummy;
trace_t trace_exit;
if (!TraceToExit(dummy, data.enter_trace, data.enter_trace.endpos, data.direction, &trace_exit))
return false;
surfacedata_t* exit_surface_data = Interfaces::PhysProps->GetSurfaceData(trace_exit.surface.surfaceProps);
int exit_material = exit_surface_data->game.material;
float exit_surf_penetration_mod = exit_surface_data->game.flPenetrationModifier;
float final_damage_modifier = 0.16f;
float combined_penetration_modifier = 0.0f;
if (((data.enter_trace.contents & CONTENTS_GRATE) != 0) || (enter_material == 89) || (enter_material == 71))
{
combined_penetration_modifier = 3.0f;
final_damage_modifier = 0.05f;
}
else
{
combined_penetration_modifier = (enter_surf_penetration_mod + exit_surf_penetration_mod) * 0.5f;
}
if (enter_material == exit_material)
{
if (exit_material == 87 || exit_material == 85)
combined_penetration_modifier = 3.0f;
else if (exit_material == 76)
combined_penetration_modifier = 2.0f;
}
float v34 = fmaxf(0.f, 1.0f / combined_penetration_modifier);
float v35 = (data.current_damage * final_damage_modifier) + v34 * 3.0f * fmaxf(0.0f, (3.0f / wpn_data->m_flPenetration) * 1.25f);
float thickness = VectorLength(trace_exit.endpos - data.enter_trace.endpos);
thickness *= thickness;
thickness *= v34;
thickness /= 24.0f;
float lost_damage = fmaxf(0.0f, v35 + thickness);
if (lost_damage > data.current_damage)
return false;
if (lost_damage >= 0.0f)
data.current_damage -= lost_damage;
if (data.current_damage < 1.0f)
return false;
data.src = trace_exit.endpos;
data.penetrate_count--;
return true;
}
/*
* CanHit() - example of how to use the code
* @in point: target hitbox vector
* @out damage_given: amount of damage the shot would do
*/
bool CanHit(const Vector &point, float* damage_given)
{
auto* local = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
auto data = FireBulletData(local->GetOrigin() + local->GetViewOffset());
data.filter = CTraceFilter();
data.filter.pSkip = local;
Vector angles;
CalcAngle(data.src, point, angles);
AngleVectors(angles, &data.direction);
VectorNormalize(data.direction);
if (SimulateFireBullet(local, (CBaseCombatWeapon*)Interfaces::EntList->GetClientEntityFromHandle((HANDLE)local->GetActiveWeaponHandle()), data))
{
*damage_given = data.current_damage;
return true;
}
return false;
}
#pragma once
# include "Hacks.h"
struct FireBulletData
{
FireBulletData(const Vector &eye_pos):src(eye_pos)
{
}
Vector src;
trace_t enter_trace;
Vector direction;
CTraceFilter filter;
float trace_length;
float trace_length_remaining;
float current_damage;
int penetrate_count;
};/*
Syn's AYYWAREFramework 2015
*/
#pragma once
#include "MiscDefinitions.h"
#include "ClientRecvProps.h"
#include "offsets.h"
class IBaseClientDLL
{
public:
ClientClass* GetAllClasses(void)
{
typedef ClientClass*(__thiscall * OriginalFn)(PVOID); //Anything inside a VTable is a __thiscall unless it completly disregards the thisptr. You can also call them as __stdcalls, but you won't have access to the __thisptr.
return call_vfunc
}
};//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $Workfile: $
// $Date: $
// $NoKeywords: $
//=============================================================================//
#ifndef BSPFLAGS_H
#define BSPFLAGS_H
#ifdef _WIN32
#pragma once
#endif
// contents flags are seperate bits
// a given brush can contribute multiple content bits
// multiple brushes can be in a single leaf
// these definitions also need to be in q_shared.h!
// lower bits are stronger, and will eat weaker brushes completely
#define CONTENTS_EMPTY 0 // No contents
#define CONTENTS_SOLID 0x1 // an eye is never valid in a solid
#define CONTENTS_WINDOW 0x2 // translucent, but not watery (glass)
#define CONTENTS_AUX 0x4
#define CONTENTS_GRATE 0x8 // alpha-tested "grate" textures. Bullets/sight pass through, but solids don't
#define CONTENTS_SLIME 0x10
#define CONTENTS_WATER 0x20
#define CONTENTS_BLOCKLOS 0x40 // block AI line of sight
#define CONTENTS_OPAQUE 0x80 // things that cannot be seen through (may be non-solid though)
#define LAST_VISIBLE_CONTENTS 0x80
#define ALL_VISIBLE_CONTENTS (LAST_VISIBLE_CONTENTS | (LAST_VISIBLE_CONTENTS-1))
#define CONTENTS_TESTFOGVOLUME 0x100
#define CONTENTS_UNUSED 0x200
// unused
// NOTE: If it's visible, grab from the top + update LAST_VISIBLE_CONTENTS
// if not visible, then grab from the bottom.
#define CONTENTS_UNUSED6 0x400
#define CONTENTS_TEAM1 0x800 // per team contents used to differentiate collisions
#define CONTENTS_TEAM2 0x1000 // between players and objects on different teams
// ignore CONTENTS_OPAQUE on surfaces that have SURF_NODRAW
#define CONTENTS_IGNORE_NODRAW_OPAQUE 0x2000
// hits entities which are MOVETYPE_PUSH (doors, plats, etc.)
#define CONTENTS_MOVEABLE 0x4000
// remaining contents are non-visible, and don't eat brushes
#define CONTENTS_AREAPORTAL 0x8000
#define CONTENTS_PLAYERCLIP 0x10000
#define CONTENTS_MONSTERCLIP 0x20000
// currents can be added to any other contents, and may be mixed
#define CONTENTS_CURRENT_0 0x40000
#define CONTENTS_CURRENT_90 0x80000
#define CONTENTS_CURRENT_180 0x100000
#define CONTENTS_CURRENT_270 0x200000
#define CONTENTS_CURRENT_UP 0x400000
#define CONTENTS_CURRENT_DOWN 0x800000
#define CONTENTS_ORIGIN 0x1000000 // removed before bsping an entity
#define CONTENTS_MONSTER 0x2000000 // should never be on a brush, only in game
#define CONTENTS_DEBRIS 0x4000000
#define CONTENTS_DETAIL 0x8000000 // brushes to be added after vis leafs
#define CONTENTS_TRANSLUCENT 0x10000000 // auto set if any surface has trans
#define CONTENTS_LADDER 0x20000000
#define CONTENTS_HITBOX 0x40000000 // use accurate hitboxes on trace
// NOTE: These are stored in a short in the engine now. Don't use more than 16 bits
#define SURF_LIGHT 0x0001 // value will hold the light strength
#define SURF_SKY2D 0x0002 // don't draw, indicates we should skylight + draw 2d sky but not draw the 3D skybox
#define SURF_SKY 0x0004 // don't draw, but add to skybox
#define SURF_WARP 0x0008 // turbulent water warp
#define SURF_TRANS 0x0010
#define SURF_NOPORTAL 0x0020 // the surface can not have a portal placed on it
#define SURF_TRIGGER 0x0040 // FIXME: This is an xbox hack to work around elimination of trigger surfaces, which breaks occluders
#define SURF_NODRAW 0x0080 // don't bother referencing the texture
#define SURF_HINT 0x0100 // make a primary bsp splitter
#define SURF_SKIP 0x0200 // completely ignore, allowing non-closed brushes
#define SURF_NOLIGHT 0x0400 // Don't calculate light
#define SURF_BUMPLIGHT 0x0800 // calculate three lightmaps for the surface for bumpmapping
#define SURF_NOSHADOWS 0x1000 // Don't receive shadows
#define SURF_NODECALS 0x2000 // Don't receive decals
#define SURF_NOCHOP 0x4000 // Don't subdivide patches on this surface
#define SURF_HITBOX 0x8000 // surface is part of a hitbox
// -----------------------------------------------------
// spatial content masks - used for spatial queries (traceline,etc.)
// -----------------------------------------------------
#define MASK_ALL (0xFFFFFFFF)
// everything that is normally solid
#define MASK_SOLID (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_MONSTER|CONTENTS_GRATE)
// everything that blocks player movement
#define MASK_PLAYERSOLID (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW|CONTENTS_MONSTER|CONTENTS_GRATE)
// blocks npc movement
#define MASK_NPCSOLID (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_MONSTERCLIP|CONTENTS_WINDOW|CONTENTS_MONSTER|CONTENTS_GRATE)
// water physics in these contents
#define MASK_WATER (CONTENTS_WATER|CONTENTS_MOVEABLE|CONTENTS_SLIME)
// everything that blocks lighting
#define MASK_OPAQUE (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_OPAQUE)
// everything that blocks lighting, but with monsters added.
#define MASK_OPAQUE_AND_NPCS (MASK_OPAQUE|CONTENTS_MONSTER)
// everything that blocks line of sight for AI
#define MASK_BLOCKLOS (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_BLOCKLOS)
// everything that blocks line of sight for AI plus NPCs
#define MASK_BLOCKLOS_AND_NPCS (MASK_BLOCKLOS|CONTENTS_MONSTER)
// everything that blocks line of sight for players
#define MASK_VISIBLE (MASK_OPAQUE|CONTENTS_IGNORE_NODRAW_OPAQUE)
// everything that blocks line of sight for players, but with monsters added.
#define MASK_VISIBLE_AND_NPCS (MASK_OPAQUE_AND_NPCS|CONTENTS_IGNORE_NODRAW_OPAQUE)
// bullets see these as solid
#define MASK_SHOT (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEBRIS|CONTENTS_HITBOX)
// non-raycasted weapons see this as solid (includes grates)
#define MASK_SHOT_HULL (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEBRIS|CONTENTS_GRATE)
// hits solids (not grates) and passes through everything else
#define MASK_SHOT_PORTAL (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_MONSTER)
// everything normally solid, except monsters (world+brush only)
#define MASK_SOLID_BRUSHONLY (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_GRATE)
// everything normally solid for player movement, except monsters (world+brush only)
#define MASK_PLAYERSOLID_BRUSHONLY (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_PLAYERCLIP|CONTENTS_GRATE)
// everything normally solid for npc movement, except monsters (world+brush only)
#define MASK_NPCSOLID_BRUSHONLY (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_MONSTERCLIP|CONTENTS_GRATE)
// just the world, used for route rebuilding
#define MASK_NPCWORLDSTATIC (CONTENTS_SOLID|CONTENTS_WINDOW|CONTENTS_MONSTERCLIP|CONTENTS_GRATE)
// These are things that can split areaportals
#define MASK_SPLITAREAPORTAL (CONTENTS_WATER|CONTENTS_SLIME)
// UNDONE: This is untested, any moving water
#define MASK_CURRENT (CONTENTS_CURRENT_0|CONTENTS_CURRENT_90|CONTENTS_CURRENT_180|CONTENTS_CURRENT_270|CONTENTS_CURRENT_UP|CONTENTS_CURRENT_DOWN)
// everything that blocks corpse movement
// UNDONE: Not used yet / may be deleted
#define MASK_DEADSOLID (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW|CONTENTS_GRATE)
#endif // BSPFLAGS_H
bool CanHit(const Vector &point, float* damage_given);
#include "Chams.h"
#include "offsets.h"
#include "SDK.h"
#include "Interfaces.h"
void InitKeyValues(KeyValues* keyValues, char* name)
{
DWORD dwFunction = (DWORD)Offsets::Functions::KeyValues_KeyValues;
__asm
{
push name
mov ecx, keyValues
call dwFunction
}
}
void LoadFromBuffer(KeyValues* keyValues, char const *resourceName, const char* pBuffer)
{
DWORD dwFunction = (DWORD)Offsets::Functions::KeyValues_LoadFromBuffer;
__asm
{
push 0
push 0
push 0
push pBuffer
push resourceName
mov ecx, keyValues
call dwFunction
}
}
IMaterial* CreateMaterial(bool shouldIgnoreZ, bool isLit, bool isWireframe) //credits to ph0ne
{
static int created = 0;
static const char tmp[] =
{
"\"%s\"\
\n{\
\n\t\"$basetexture\" \"vgui/white_additive\"\
\n\t\"$envmap\" \"\"\
\n\t\"$model\" \"1\"\
\n\t\"$flat\" \"1\"\
\n\t\"$nocull\" \"0\"\
\n\t\"$selfillum\" \"1\"\
\n\t\"$halflambert\" \"1\"\
\n\t\"$nofog\" \"0\"\
\n\t\"$ignorez\" \"%i\"\
\n\t\"$znearer\" \"0\"\
\n\t\"$wireframe\" \"%i\"\
\n}\n"
};
char* baseType = (isLit == true ? "VertexLitGeneric" : "UnlitGeneric");
char material[512];
sprintf_s(material, sizeof(material), tmp, baseType, (shouldIgnoreZ) ? 1 : 0, (isWireframe) ? 1 : 0);
char name[512];
sprintf_s(name, sizeof(name), "#ayy_meme_%i.vmt", created);
++created;
KeyValues* keyValues = (KeyValues*)malloc(sizeof(KeyValues));
InitKeyValues(keyValues, baseType);
LoadFromBuffer(keyValues, name, material);
IMaterial* createdMaterial = Interfaces::MaterialSystem->CreateMaterial(name, keyValues);
createdMaterial->IncrementReferenceCount();
return createdMaterial;
}
void ForceMaterial(Color color, IMaterial* material, bool useColor, bool forceMaterial)
{
if (useColor)
{
float temp[3] =
{
color.r(),
color.g(),
color.b()
};
temp[0] /= 255.f;
temp[1] /= 255.f;
temp[2] /= 255.f;
float alpha = color.a();
Interfaces::RenderView->SetBlend(1.0f);
Interfaces::RenderView->SetColorModulation(temp);
}
if (forceMaterial)
Interfaces::ModelRender->ForcedMaterialOverride(material);
else
Interfaces::ModelRender->ForcedMaterialOverride(NULL);
}/*
Syn's AYYWAREFramework 2015
*/
#pragma once
#include "SDK.h"
void InitKeyValues(KeyValues* keyValues, char* name);
void LoadFromBuffer(KeyValues* keyValues, char const *resourceName, const char* pBuffer);
void ForceMaterial(Color color, IMaterial* material, bool useColor = true, bool forceMaterial = true);
IMaterial* CreateMaterial(bool shouldIgnoreZ, bool isLit = true, bool isWireframe = false);
/*
Syn's AYYWAREFramework 2015
*/
// Credits to Valve and Shad0w
#pragma once
struct RecvProp;
class DVariant
{
public:
union
{
float m_Float;
long m_Int;
char* m_pString;
void* m_pData;
float m_Vector[3];
};
};
class CRecvProxyData
{
public:
const RecvProp* m_pRecvProp;
char _pad[4];//csgo ( for l4d keep it commented out :) )
DVariant m_Value;
int m_iElement;
int m_ObjectID;
};
typedef void(* RecvVarProxyFn)(const CRecvProxyData* pData, void* pStruct, void* pOut);
struct RecvTable
{
RecvProp* m_pProps;
int m_nProps;
void* m_pDecoder;
char* m_pNetTableName;
bool m_bInitialized;
bool m_bInMainList;
};
struct RecvProp
{
char* m_pVarName;
int m_RecvType;
int m_Flags;
int m_StringBufferSize;
bool m_bInsideArray;
const void* m_pExtraData;
RecvProp* m_pArrayProp;
void* m_ArrayLengthProxy;
void* m_ProxyFn;
void* m_DataTableProxyFn;
RecvTable* m_pDataTable;
int m_Offset;
int m_ElementStride;
int m_nElements;
const char* m_pParentArrayPropName;
};
class ClientClass
{
public:
void* m_pCreateFn;
void* m_pCreateEventFn;
char* m_pNetworkName;
RecvTable* m_pRecvTable;
ClientClass* m_pNext;
int m_ClassID;
};
#pragma once
#define _WINSOCKAPI_
// Includes
# include
# include
# include
# include
# include
# include
# include
#pragma once
#define _WINSOCKAPI_
// Includes
# include
# include
# include
# include
# include
# include
# include
/*
Syn's AYYWAREFramework 2015
*/
#pragma once
# include "GUI.h"
class CCheckBox : public CControl
{
public:
CCheckBox();
void SetState(bool s);
bool GetState();
protected:
bool Checked;
void Draw(bool hover);
void OnUpdate();
void OnClick();
};
class CLabel : public CControl
{
public:
CLabel();
void SetText(std::string text);
protected:
std::string Text;
void Draw(bool hover);
void OnUpdate();
void OnClick();
};
class CGroupBox : public CControl
{
public:
CGroupBox();
void SetText(std::string text);
void PlaceLabledControl(std::string Label, CTab* Tab, CControl* control);
protected:
int Items;
std::string Text;
void Draw(bool hover);
void OnUpdate();
void OnClick();
};
class CSlider : public CControl
{
public:
CSlider();
float GetValue();
void SetValue(float v);
void SetBoundaries(float min, float max);
protected:
float Value;
float Min;
float Max;
bool DoDrag;
void Draw(bool hover);
void OnUpdate();
void OnClick();
};
class CKeyBind : public CControl
{
public:
CKeyBind();
int GetKey();
void SetKey(int key);
protected:
int Key;
bool IsGettingKey;
void Draw(bool hover);
void OnUpdate();
void OnClick();
};
class CButton : public CControl
{
public:
typedef void(* ButtonCallback_t)(void);
CButton();
void SetCallback(ButtonCallback_t callback);
void SetText(std::string text);
protected:
ButtonCallback_t CallBack;
std::string Text;
void Draw(bool hover);
void OnUpdate();
void OnClick();
};
class CComboBox : public CControl
{
public:
CComboBox();
void AddItem(std::string text);
void SelectIndex(int idx);
int GetIndex();
std::string GetItem();
protected:
std::vector
int SelectedIndex;
bool IsOpen;
void Draw(bool hover);
void OnUpdate();
void OnClick();
};/*
Syn's AYYWAREFramework 2015
*/
#include "CRC32.h"
unsigned int uiCRC32_Table[256] = {
0x00000000L, 0x77073096L, 0xEE0E612CL,
0x990951BAL, 0x076DC419L, 0x706AF48FL,
0xE963A535L, 0x9E6495A3L, 0x0EDB8832L,
0x79DCB8A4L, 0xE0D5E91EL, 0x97D2D988L,
0x09B64C2BL, 0x7EB17CBDL, 0xE7B82D07L,
0x90BF1D91L, 0x1DB71064L, 0x6AB020F2L,
0xF3B97148L, 0x84BE41DEL, 0x1ADAD47DL,
0x6DDDE4EBL, 0xF4D4B551L, 0x83D385C7L,
0x136C9856L, 0x646BA8C0L, 0xFD62F97AL,
0x8A65C9ECL, 0x14015C4FL, 0x63066CD9L,
0xFA0F3D63L, 0x8D080DF5L, 0x3B6E20C8L,
0x4C69105EL, 0xD56041E4L, 0xA2677172L,
0x3C03E4D1L, 0x4B04D447L, 0xD20D85FDL,
0xA50AB56BL, 0x35B5A8FAL, 0x42B2986CL,
0xDBBBC9D6L, 0xACBCF940L, 0x32D86CE3L,
0x45DF5C75L, 0xDCD60DCFL, 0xABD13D59L,
0x26D930ACL, 0x51DE003AL, 0xC8D75180L,
0xBFD06116L, 0x21B4F4B5L, 0x56B3C423L,
0xCFBA9599L, 0xB8BDA50FL, 0x2802B89EL,
0x5F058808L, 0xC60CD9B2L, 0xB10BE924L,
0x2F6F7C87L, 0x58684C11L, 0xC1611DABL,
0xB6662D3DL, 0x76DC4190L, 0x01DB7106L,
0x98D220BCL, 0xEFD5102AL, 0x71B18589L,
0x06B6B51FL, 0x9FBFE4A5L, 0xE8B8D433L,
0x7807C9A2L, 0x0F00F934L, 0x9609A88EL,
0xE10E9818L, 0x7F6A0DBBL, 0x086D3D2DL,
0x91646C97L, 0xE6635C01L, 0x6B6B51F4L,
0x1C6C6162L, 0x856530D8L, 0xF262004EL,
0x6C0695EDL, 0x1B01A57BL, 0x8208F4C1L,
0xF50FC457L, 0x65B0D9C6L, 0x12B7E950L,
0x8BBEB8EAL, 0xFCB9887CL, 0x62DD1DDFL,
0x15DA2D49L, 0x8CD37CF3L, 0xFBD44C65L,
0x4DB26158L, 0x3AB551CEL, 0xA3BC0074L,
0xD4BB30E2L, 0x4ADFA541L, 0x3DD895D7L,
0xA4D1C46DL, 0xD3D6F4FBL, 0x4369E96AL,
0x346ED9FCL, 0xAD678846L, 0xDA60B8D0L,
0x44042D73L, 0x33031DE5L, 0xAA0A4C5FL,
0xDD0D7CC9L, 0x5005713CL, 0x270241AAL,
0xBE0B1010L, 0xC90C2086L, 0x5768B525L,
0x206F85B3L, 0xB966D409L, 0xCE61E49FL,
0x5EDEF90EL, 0x29D9C998L, 0xB0D09822L,
0xC7D7A8B4L, 0x59B33D17L, 0x2EB40D81L,
0xB7BD5C3BL, 0xC0BA6CADL, 0xEDB88320L,
0x9ABFB3B6L, 0x03B6E20CL, 0x74B1D29AL,
0xEAD54739L, 0x9DD277AFL, 0x04DB2615L,
0x73DC1683L, 0xE3630B12L, 0x94643B84L,
0x0D6D6A3EL, 0x7A6A5AA8L, 0xE40ECF0BL,
0x9309FF9DL, 0x0A00AE27L, 0x7D079EB1L,
0xF00F9344L, 0x8708A3D2L, 0x1E01F268L,
0x6906C2FEL, 0xF762575DL, 0x806567CBL,
0x196C3671L, 0x6E6B06E7L, 0xFED41B76L,
0x89D32BE0L, 0x10DA7A5AL, 0x67DD4ACCL,
0xF9B9DF6FL, 0x8EBEEFF9L, 0x17B7BE43L,
0x60B08ED5L, 0xD6D6A3E8L, 0xA1D1937EL,
0x38D8C2C4L, 0x4FDFF252L, 0xD1BB67F1L,
0xA6BC5767L, 0x3FB506DDL, 0x48B2364BL,
0xD80D2BDAL, 0xAF0A1B4CL, 0x36034AF6L,
0x41047A60L, 0xDF60EFC3L, 0xA867DF55L,
0x316E8EEFL, 0x4669BE79L, 0xCB61B38CL,
0xBC66831AL, 0x256FD2A0L, 0x5268E236L,
0xCC0C7795L, 0xBB0B4703L, 0x220216B9L,
0x5505262FL, 0xC5BA3BBEL, 0xB2BD0B28L,
0x2BB45A92L, 0x5CB36A04L, 0xC2D7FFA7L,
0xB5D0CF31L, 0x2CD99E8BL, 0x5BDEAE1DL,
0x9B64C2B0L, 0xEC63F226L, 0x756AA39CL,
0x026D930AL, 0x9C0906A9L, 0xEB0E363FL,
0x72076785L, 0x05005713L, 0x95BF4A82L,
0xE2B87A14L, 0x7BB12BAEL, 0x0CB61B38L,
0x92D28E9BL, 0xE5D5BE0DL, 0x7CDCEFB7L,
0x0BDBDF21L, 0x86D3D2D4L, 0xF1D4E242L,
0x68DDB3F8L, 0x1FDA836EL, 0x81BE16CDL,
0xF6B9265BL, 0x6FB077E1L, 0x18B74777L,
0x88085AE6L, 0xFF0F6A70L, 0x66063BCAL,
0x11010B5CL, 0x8F659EFFL, 0xF862AE69L,
0x616BFFD3L, 0x166CCF45L, 0xA00AE278L,
0xD70DD2EEL, 0x4E048354L, 0x3903B3C2L,
0xA7672661L, 0xD06016F7L, 0x4969474DL,
0x3E6E77DBL, 0xAED16A4AL, 0xD9D65ADCL,
0x40DF0B66L, 0x37D83BF0L, 0xA9BCAE53L,
0xDEBB9EC5L, 0x47B2CF7FL, 0x30B5FFE9L,
0xBDBDF21CL, 0xCABAC28AL, 0x53B39330L,
0x24B4A3A6L, 0xBAD03605L, 0xCDD70693L,
0x54DE5729L, 0x23D967BFL, 0xB3667A2EL,
0xC4614AB8L, 0x5D681B02L, 0x2A6F2B94L,
0xB40BBE37L, 0xC30C8EA1L, 0x5A05DF1BL,
0x2D02EF8DL };
unsigned int CRC32(void* pData, size_t iLen)
{
unsigned int uiCRC32 = 0xFFFFFFFF;
unsigned char* pszData = (unsigned char*)pData;
for (size_t i = 0; i < iLen; ++i)
uiCRC32 = ((uiCRC32 >> 8) & 0x00FFFFFF) ^ uiCRC32_Table[(uiCRC32 ^ (unsigned int)*pszData++) &0xFF];
return (uiCRC32 ^ 0xFFFFFFFF);
}/*
Syn's AYYWAREFramework 2015
*/
// Credits Valve / Shad0w
#pragma once
unsigned int CRC32(void* pData, size_t iLen);
/*
Syn's AYYWAREFramework 2015
*/
#include "Utilities.h"
// Stuff to initialise
#include "Offsets.h"
#include "Interfaces.h"
#include "Hooks.h"
#include "RenderManager.h"
#include "Hacks.h"
#include "Menu.h"
#include "AntiAntiAim.h"
#include "Dumping.h"
bool DoUnload;
HINSTANCE HThisModule;
// Our thread we use to setup everything we need
// Everything appart from code in hooks get's called from inside
// here.
int InitialThread(LPVOID lpArguments)
{
Utilities::OpenConsole("Cebula.dll");
//---------------------------------------------------------
// Initialise all our shit
Offsets::Initialise(); // Set our VMT offsets and do any pattern scans
Interfaces::Initialise(); // Get pointers to the valve classes
NetVar.RetrieveClasses(); // Setup our NetVar manager (thanks shad0w bby)
Render::Initialise();
Hacks::SetupHacks();
Menu::SetupMenu();
Hooks::Initialise();
ApplyAAAHooks();
// Dumping
//Dump::DumpClassIds();
//---------------------------------------------------------
Utilities::Log("Ready");
// While our cheat is running
while (DoUnload == false)
{
Sleep(1000);
}
Hooks::UndoHooks();
Sleep(2000); // Make sure none of our hooks are running
FreeLibraryAndExitThread(HThisModule, 0);
return 0;
}
// DllMain
// Entry point for our module
bool _stdcall DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID lpReserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)InitialThread, NULL, NULL, NULL);
}
return true;
}
#include "Dumping.h"
#define DUMPIDTOFILE
void Dump::DumpClassIds()
{
# ifdef DUMPIDTOFILE
Utilities::EnableLogFile("ClassID.txt");
#endif
ClientClass* cClass = Interfaces::Client->GetAllClasses();
while (cClass)
{
Utilities::Log("%s = %d,", cClass->m_pNetworkName, cClass->m_ClassID);
cClass = cClass->m_pNext;
}
}/*
Syn's AYYWAREFramework 2015
*/
#pragma once
#include "Interfaces.h"
#include "Utilities.h"
namespace Dump
{
void DumpClassIds();
};/*
Syn's AYYWAREFramework 2015
*/
#pragma once
#include "MiscDefinitions.h"
#include "ClientRecvProps.h"
#include "offsets.h"
#include "Vector.h"
// EngineClient
class IVEngineClient
{
public:
void GetScreenSize(int& width, int& height)
{
typedef void(__thiscall * oGetScreenSize)(PVOID, int &, int &);
return call_vfunc
}
bool GetPlayerInfo(int ent_num, player_info_t* pinfo)
{
typedef bool(__thiscall * oGetPlayerInfo)(PVOID, int, player_info_t *);
return call_vfunc
}
int GetLocalPlayer()
{
typedef int(__thiscall * oLocal)(PVOID);
return call_vfunc
}
float Time()
{
typedef float(__thiscall * oTime)(PVOID);
return call_vfunc
}
void GetViewAngles(Vector& vAngles)
{
typedef void(__thiscall * oSetViewAngles)(PVOID, Vector &);
return call_vfunc
}
void SetViewAngles(Vector& vAngles)
{
typedef void(__thiscall * oSetViewAngles)(PVOID, Vector &);
return call_vfunc
}
int GetMaxClients()
{
typedef bool(__thiscall * oGetMaxClients)(PVOID);
return call_vfunc
}
bool IsConnected()
{
typedef bool(__thiscall * oGetScreenSize)(PVOID);
return call_vfunc
}
bool IsInGame()
{
typedef bool(__thiscall * oLocal)(PVOID);
return call_vfunc
}
const matrix3x4& WorldToScreenMatrix()
{
typedef const matrix3x4&(__thiscall * oWorldToScreenMatrix)(PVOID);
return call_vfunc
}
void ClientCmd_Unrestricted(char const* cmd)
{
typedef void(__thiscall* oClientCmdUnres)(PVOID, const char*);
return call_vfunc
}
};/*
Syn's AyyWare Framework 2015
*/
#pragma once
#include "MiscDefinitions.h"
#include "ClientRecvProps.h"
#include "offsets.h"
#include "Vector.h"
#define TEAM_CS_T 2
#define TEAM_CS_CT 3
#define BONE_USED_BY_HITBOX 0x00000100
class IClientRenderable;
class IClientNetworkable;
class IClientUnknown;
class IClientThinkable;
class IClientEntity;
class CSWeaponInfo;
class CSWeaponInfo
{
public:
virtual void Function0(); //
virtual void Function1(); //
virtual void Parse(KeyValues* pKeyValuesData, const char* szWeaponName); //
virtual void RefreshDynamicParameters(void); //
virtual void Function4(); //
virtual void Function5(); //
virtual void Function6(); //
virtual void Function7(); //
virtual void Function8(); //
char pad_0x0004[0x2]; //0x0004
char m_pszName[32]; //0x0006
char pad_0x0026[0x7E]; //0x0026
__int16 N0000002E; //0x00A4
char m_pszModelName[32]; //0x00A6
char pad_0x00C6[0x6DE]; //0x00C6
BYTE m_IsFullAuto; //0x07A4
char pad_0x07A5[0x7]; //0x07A5
__int32 m_iPrice; //0x07AC
float m_flArmorRatio; //0x07B0
char pad_0x07B4[0x10]; //0x07B4
float m_flPenetration; //0x07C4
__int32 m_iDamage; //0x07C8
float m_flRange; //0x07CC
float m_flRangeModifier; //0x07D0
char pad_0x07D4[0x4]; //0x07D4
float m_flCycleTime; //0x07D8
};
enum class CSGOClassID
{
CTestTraceline = 189,
CTEWorldDecal = 190,
CTESpriteSpray = 187,
CTESprite = 186,
CTESparks = 185,
CTESmoke = 184,
CTEShowLine = 182,
CTEProjectedDecal = 179,
CTEPlayerDecal = 178,
CTEPhysicsProp = 175,
CTEParticleSystem = 174,
CTEMuzzleFlash = 173,
CTELargeFunnel = 171,
CTEKillPlayerAttachments = 170,
CTEImpact = 169,
CTEGlowSprite = 168,
CTEShatterSurface = 181,
CTEFootprintDecal = 165,
CTEFizz = 164,
CTEExplosion = 162,
CTEEnergySplash = 161,
CTEEffectDispatch = 160,
CTEDynamicLight = 159,
CTEDecal = 157,
CTEClientProjectile = 156,
CTEBubbleTrail = 155,
CTEBubbles = 154,
CTEBSPDecal = 153,
CTEBreakModel = 152,
CTEBloodStream = 151,
CTEBloodSprite = 150,
CTEBeamSpline = 149,
CTEBeamRingPoint = 148,
CTEBeamRing = 147,
CTEBeamPoints = 146,
CTEBeamLaser = 145,
CTEBeamFollow = 144,
CTEBeamEnts = 143,
CTEBeamEntPoint = 142,
CTEBaseBeam = 141,
CTEArmorRicochet = 140,
CTEMetalSparks = 172,
CSteamJet = 135,
CSmokeStack = 128,
DustTrail = 238,
CFireTrail = 62,
SporeTrail = 244,
SporeExplosion = 243,
RocketTrail = 241,
SmokeTrail = 242,
CPropVehicleDriveable = 117,
ParticleSmokeGrenade = 240,
CParticleFire = 96,
MovieExplosion = 239,
CTEGaussExplosion = 167,
CEnvQuadraticBeam = 55,
CEmbers = 45,
CEnvWind = 59,
CPrecipitation = 111,
CPrecipitationBlocker = 112,
CBaseTempEntity = 18,
NextBotCombatCharacter = 0,
CBaseAttributableItem = 4,
CEconEntity = 44,
CWeaponXM1014 = 236,
CWeaponTaser = 231,
CSmokeGrenade = 126,
CWeaponSG552 = 228,
CWeaponSawedoff = 224,
CWeaponNOVA = 220,
CIncendiaryGrenade = 85,
CMolotovGrenade = 93,
CWeaponM3 = 212,
CKnifeGG = 90,
CKnife = 89,
CHEGrenade = 82,
CFlashbang = 64,
CWeaponElite = 203,
CDecoyGrenade = 40,
CDEagle = 39,
CWeaponUSP = 235,
CWeaponM249 = 211,
CWeaponUMP45 = 234,
CWeaponTMP = 233,
CWeaponTec9 = 232,
CWeaponSSG08 = 230,
CWeaponSG556 = 229,
CWeaponSG550 = 227,
CWeaponScout = 226,
CWeaponSCAR20 = 225,
CSCAR17 = 122,
CWeaponP90 = 223,
CWeaponP250 = 222,
CWeaponP228 = 221,
CWeaponNegev = 219,
CWeaponMP9 = 218,
CWeaponMP7 = 217,
CWeaponMP5Navy = 216,
CWeaponMag7 = 215,
CWeaponMAC10 = 214,
CWeaponM4A1 = 213,
CWeaponHKP2000 = 210,
CWeaponGlock = 209,
CWeaponGalilAR = 208,
CWeaponGalil = 207,
CWeaponG3SG1 = 206,
CWeaponFiveSeven = 205,
CWeaponFamas = 204,
CWeaponBizon = 199,
CWeaponAWP = 198,
CWeaponAug = 197,
CAK47 = 1,
CWeaponCSBaseGun = 201,
CWeaponCSBase = 200,
CC4 = 29,
CBaseCSGrenade = 8,
CSmokeGrenadeProjectile = 127,
CMolotovProjectile = 94,
CDecoyProjectile = 41,
CFireCrackerBlast = 60,
CInferno = 86,
CChicken = 31,
CFootstepControl = 66,
CCSGameRulesProxy = 34,
CWeaponCubemap = 0,
CWeaponCycler = 202,
CTEPlantBomb = 176,
CTEFireBullets = 163,
CTERadioIcon = 180,
CPlantedC4 = 104,
CCSTeam = 38,
CCSPlayerResource = 36,
CCSPlayer = 35,
CCSRagdoll = 37,
CTEPlayerAnimEvent = 177,
CHostage = 83,
CHostageCarriableProp = 84,
CBaseCSGrenadeProjectile = 9,
CHandleTest = 81,
CTeamplayRoundBasedRulesProxy = 139,
CSpriteTrail = 133,
CSpriteOriented = 132,
CSprite = 131,
CRagdollPropAttached = 120,
CRagdollProp = 119,
CPredictedViewModel = 113,
CPoseController = 109,
CGameRulesProxy = 80,
CInfoLadderDismount = 87,
CFuncLadder = 72,
CTEFoundryHelpers = 166,
CEnvDetailController = 51,
CWorld = 237,
CWaterLODControl = 196,
CWaterBullet = 195,
CVoteController = 194,
CVGuiScreen = 193,
CPropJeep = 116,
CPropVehicleChoreoGeneric = 0,
CTriggerSoundOperator = 192,
CBaseVPhysicsTrigger = 22,
CTriggerPlayerMovement = 191,
CBaseTrigger = 20,
CTest_ProxyToggle_Networkable = 188,
CTesla = 183,
CBaseTeamObjectiveResource = 17,
CTeam = 138,
CSunlightShadowControl = 137,
CSun = 136,
CParticlePerformanceMonitor = 97,
CSpotlightEnd = 130,
CSpatialEntity = 129,
CSlideshowDisplay = 125,
CShadowControl = 124,
CSceneEntity = 123,
CRopeKeyframe = 121,
CRagdollManager = 118,
CPhysicsPropMultiplayer = 102,
CPhysBoxMultiplayer = 100,
CPropDoorRotating = 115,
CBasePropDoor = 16,
CDynamicProp = 43,
CProp_Hallucination = 114,
CPostProcessController = 110,
CPointCommentaryNode = 108,
CPointCamera = 107,
CPlayerResource = 106,
CPlasma = 105,
CPhysMagnet = 103,
CPhysicsProp = 101,
CStatueProp = 134,
CPhysBox = 99,
CParticleSystem = 98,
CMovieDisplay = 95,
CMaterialModifyControl = 92,
CLightGlow = 91,
CInfoOverlayAccessor = 88,
CFuncTrackTrain = 79,
CFuncSmokeVolume = 78,
CFuncRotating = 77,
CFuncReflectiveGlass = 76,
CFuncOccluder = 75,
CFuncMoveLinear = 74,
CFuncMonitor = 73,
CFunc_LOD = 68,
CTEDust = 158,
CFunc_Dust = 67,
CFuncConveyor = 71,
CFuncBrush = 70,
CBreakableSurface = 28,
CFuncAreaPortalWindow = 69,
CFish = 63,
CFireSmoke = 61,
CEnvTonemapController = 58,
CEnvScreenEffect = 56,
CEnvScreenOverlay = 57,
CEnvProjectedTexture = 54,
CEnvParticleScript = 53,
CFogController = 65,
CEnvDOFController = 52,
CCascadeLight = 30,
CEnvAmbientLight = 50,
CEntityParticleTrail = 49,
CEntityFreezing = 48,
CEntityFlame = 47,
CEntityDissolve = 46,
CDynamicLight = 42,
CColorCorrectionVolume = 33,
CColorCorrection = 32,
CBreakableProp = 27,
CBeamSpotlight = 25,
CBaseButton = 5,
CBaseToggle = 19,
CBasePlayer = 15,
CBaseFlex = 12,
CBaseEntity = 11,
CBaseDoor = 10,
CBaseCombatCharacter = 6,
CBaseAnimatingOverlay = 3,
CBoneFollower = 26,
CBaseAnimating = 2,
CAI_BaseNPC = 0,
CBeam = 24,
CBaseViewModel = 21,
CBaseParticleEntity = 14,
CBaseGrenade = 13,
CBaseCombatWeapon = 7,
CBaseWeaponWorldModel = 23
};
enum class CSGOHitboxID
{
Head = 0,
Neck,
NeckLower,
Pelvis,
Stomach,
LowerChest,
Chest,
UpperChest,
RightThigh,
LeftThigh,
RightShin,
LeftShin,
RightFoot,
LeftFoot,
RightHand,
LeftHand,
RightUpperArm,
RightLowerArm,
LeftUpperArm,
LeftLowerArm
};
class ScriptCreatedItem
{
public:
CPNETVAR_FUNC(int*, ItemDefinitionIndex, 0xE67AB3B8); //m_iItemDefinitionIndex
CPNETVAR_FUNC(int*, ItemIDHigh, 0x714778A); //m_iItemIDHigh
CPNETVAR_FUNC(int*, ItemIDLow, 0x3A3DFC74); //m_iItemIDLow
};
class AttributeContainer
{
public:
CPNETVAR_FUNC(ScriptCreatedItem*, m_Item, 0x7E029CE5);
};
class CBaseCombatWeapon
{
public:
CNETVAR_FUNC(float, GetNextPrimaryAttack, 0xDB7B106E); //m_flNextPrimaryAttack
CNETVAR_FUNC(int, GetAmmoInClip, 0x97B6F70C); //m_iClip1
CNETVAR_FUNC(HANDLE, GetOwnerHandle, 0xC32DF98D); //m_hOwner
CNETVAR_FUNC(Vector, GetOrigin, 0x1231CE10); //m_vecOrigin
CPNETVAR_FUNC(int*, FallbackPaintKit, 0xADE4C870); // m_nFallbackPaintKit
CPNETVAR_FUNC(int*, FallbackSeed, 0xC2D0683D); // m_nFallbackSeed
CPNETVAR_FUNC(float*, FallbackWear, 0xA263576C); //m_flFallbackWear
CPNETVAR_FUNC(int*, FallbackStatTrak, 0x1ED78768); //m_nFallbackStatTrak
CPNETVAR_FUNC(int*, OwnerXuidLow, 0xAD8D897F);
CPNETVAR_FUNC(int*, OwnerXuidHigh, 0x90511E77);
CPNETVAR_FUNC(int*, ViewModelIndex, 0x7F7C89C1);
CPNETVAR_FUNC(int*, WorldModelIndex, 0x4D8AD9F3);
CPNETVAR_FUNC(AttributeContainer*, m_AttributeManager, 0xCFFCE089);
float GetInaccuracy()
{
typedef float(__thiscall * oGetSpread)(PVOID);
return call_vfunc
}
float GetSpread()
{
typedef float(__thiscall * oGetInac)(PVOID);
return call_vfunc
}
void UpdateAccuracyPenalty()
{
typedef void(__thiscall * oUpdateAccuracyPenalty)(PVOID);
return call_vfunc
}
CSWeaponInfo* GetCSWpnData()
{
static DWORD GetCSWpnDataAddr = Utilities::Memory::FindPattern("client.dll", (PBYTE)"\x55\x8B\xEC\x81\xEC\x00\x00\x00\x00\xB8\x00\x00\x00\x00\x57", "xxxxx????x????x");
if (GetCSWpnDataAddr)
{
CSWeaponInfo* retData;
__asm
{
mov ecx, this
call GetCSWpnDataAddr
mov retData, eax
}
return retData;
}
else
{
return nullptr;
}
}
};
class CCSBomb
{
public:
CNETVAR_FUNC(HANDLE, GetOwnerHandle, 0xC32DF98D); //m_hOwner
CNETVAR_FUNC(float, GetC4BlowTime, 0xB5E0CA1C); //m_flC4Blow
CNETVAR_FUNC(float, GetC4DefuseCountDown, 0xB959B4A6); //m_flDefuseCountDown
};
class CLocalPlayerExclusive
{
public:
CNETVAR_FUNC(Vector, GetViewPunchAngle, 0x68F014C0);//m_viewPunchAngle
CNETVAR_FUNC(Vector, GetAimPunchAngle, 0xBF25C290);//m_aimPunchAngle
CNETVAR_FUNC(Vector, GetAimPunchAngleVel, 0x8425E045);//m_aimPunchAngleVel
};
class CollisionProperty
{
public:
CNETVAR_FUNC(Vector, GetMins, 0xF6F78BAB);//m_vecMins
CNETVAR_FUNC(Vector, GetMaxs, 0xE47C6FC4);//m_vecMaxs
CNETVAR_FUNC(unsigned char, GetSolidType, 0xB86722A1);//m_nSolidType
CNETVAR_FUNC(unsigned short, GetSolidFlags, 0x63BB24C1);//m_usSolidFlags
CNETVAR_FUNC(int, GetSurroundsType, 0xB677A0BB); //m_nSurroundType
bool IsSolid()
{
return (GetSolidType() != SOLID_NONE) && ((GetSolidFlags() & FSOLID_NOT_SOLID) == 0);
}
};
class IClientRenderable
{
public:
//virtual void* GetIClientUnknown() = 0;
virtual Vector const& GetRenderOrigin(void) = 0;
virtual Vector const& GetRenderAngles(void) = 0;
virtual bool ShouldDraw(void) = 0;
virtual bool IsTransparent(void) = 0;
virtual bool UsesPowerOfTwoFrameBufferTexture() = 0;
virtual bool UsesFullFrameBufferTexture() = 0;
virtual void GetShadowHandle() const = 0;
virtual void* RenderHandle() = 0;
virtual const model_t* GetModel() const = 0;
virtual int DrawModel(int flags) = 0;
virtual int GetBody() = 0;
virtual void ComputeFxBlend() = 0;
bool SetupBones(matrix3x4* pBoneToWorldOut, int nMaxBones, int boneMask, float currentTime)
{
typedef bool(__thiscall * oSetupBones)(PVOID, matrix3x4 *, int, int, float);
return call_vfunc
}
};
class IClientNetworkable
{
public:
virtual IClientUnknown* GetIClientUnknown() = 0;
virtual void Release() = 0;
virtual ClientClass* GetClientClass() = 0;// FOR NETVARS FIND YOURSELF ClientClass* stuffs
virtual void NotifyShouldTransmit( /* ShouldTransmitState_t state*/) = 0;
virtual void OnPreDataChanged( /*DataUpdateType_t updateType*/) = 0;
virtual void OnDataChanged( /*DataUpdateType_t updateType*/) = 0;
virtual void PreDataUpdate( /*DataUpdateType_t updateType*/) = 0;
virtual void PostDataUpdate( /*DataUpdateType_t updateType*/) = 0;
virtual void unknown();
virtual bool IsDormant(void) = 0;
virtual int GetIndex(void) const = 0;
virtual void ReceiveMessage(int classID /*, bf_read &msg*/) = 0;
virtual void* GetDataTableBasePtr() = 0;
virtual void SetDestroyedOnRecreateEntities(void) = 0;
};
class IClientUnknown
{
public:
virtual void* GetCollideable() = 0;
virtual IClientNetworkable* GetClientNetworkable() = 0;
virtual IClientRenderable* GetClientRenderable() = 0;
virtual IClientEntity* GetIClientEntity() = 0;
virtual IClientEntity* GetBaseEntity() = 0;
virtual IClientThinkable* GetClientThinkable() = 0;
};
class IClientThinkable
{
public:
virtual IClientUnknown* GetIClientUnknown() = 0;
virtual void ClientThink() = 0;
virtual void* GetThinkHandle() = 0;
virtual void SetThinkHandle(void* hThink) = 0;
virtual void Release() = 0;
};
class __declspec (novtable)IClientEntity : public IClientUnknown, public IClientRenderable, public IClientNetworkable, public IClientThinkable
{
public:
public:
virtual void Release(void) = 0;
virtual void blahblahpad(void) = 0;
virtual Vector& GetAbsOrigin(void) const = 0;//in broken place use GetOrigin Below
virtual const Vector& GetAbsAngles(void) const = 0;
//--- NetVars ---//
CPNETVAR_FUNC(CLocalPlayerExclusive*, localPlayerExclusive, 0x7177BC3E);// m_Local
CPNETVAR_FUNC(CollisionProperty*, collisionProperty, 0xE477CBD0);//m_Collision
CNETVAR_FUNC(int, GetFlags, 0xE456D580); //m_fFlags
CNETVAR_FUNC(Vector, GetOrigin, 0x1231CE10); //m_vecOrigin
CNETVAR_FUNC(Vector, GetRotation, 0x6BEA197A); //m_angRotation
CNETVAR_FUNC(int, GetTeamNum, 0xC08B6C6E); //m_iTeamNum
CNETVAR_FUNC(int, GetMaxHealth, 0xC52E1C28); //m_iMaxHealth
CNETVAR_FUNC(int, GetHealth, 0xA93054E3); //m_iHealth
CNETVAR_FUNC(unsigned char, GetLifeState, 0xD795CCFC); //m_lifeState
CNETVAR_FUNC(HANDLE, GetActiveWeaponHandle, 0xB4FECDA3); //m_hActiveWeapon
CNETVAR_FUNC(int, GetTickBase, 0xD472B079); //m_nTickBase
CNETVAR_FUNC(Vector, GetViewOffset, 0xA9F74931); //m_vecViewOffset[0]
CNETVAR_FUNC(Vector, GetVelocity, 0x40C1CA24); //m_vecVelocity[0]
CNETVAR_FUNC(bool, HasGunGameImmunity, 0x6AD6FA0D); //m_bGunGameImmunity
CNETVAR_FUNC(bool, IsDefusing, 0xA2C14106); //m_bIsDefusing
CNETVAR_FUNC(int, ArmorValue, 0x3898634); //m_ArmorValue
CNETVAR_FUNC(bool, HasHelmet, 0x7B97F18A); //m_bHasHelmet
CNETVAR_FUNC(bool, IsScoped, 0x61B9C22C); //m_bIsScoped
CNETVAR_FUNC(int, GetMoney, 0xF4B3E183); //m_iAccount
CNETVAR_FUNC(HANDLE, GetObserverTargetHandle, 0x8660FD83); //m_hObserverTarget
// ----------------------------------------------//
bool IsAlive()
{
return (GetLifeState() == LIFE_ALIVE && GetHealth() > 0);
}
Vector GetBonePos(int i)
{
matrix3x4 boneMatrix[128];
if (this->SetupBones(boneMatrix, 128, BONE_USED_BY_HITBOX, GetTickCount64()))
{
return Vector(boneMatrix[i][0][3], boneMatrix[i][1][3], boneMatrix[i][2][3]);
}
return Vector(0, 0, 0);
}
Vector GetHeadPos()
{
return this->GetBonePos(6);
}
};/*
Syn's AYYWAREFramework 2015
*/
#include "ESP.h"
#include "Interfaces.h"
#include "RenderManager.h"
void CEsp::Init()
{
BombCarrier = nullptr;
}
// Yeah dude we're defo gunna do some sick moves for the esp yeah
void CEsp::Move(CUserCmd* pCmd) { }
// Main ESP Drawing loop
void CEsp::Draw()
{
IClientEntity* pLocal = hackManager.pLocal();
// Loop through all active entitys
for (int i = 0; i < Interfaces::EntList->GetHighestEntityIndex(); i++)
{
// Get the entity
IClientEntity* pEntity = Interfaces::EntList->GetClientEntity(i);
player_info_t pinfo;
// The entity isn't some laggy peice of shit or something
if (pEntity && pEntity != pLocal && !pEntity->IsDormant())
{
// Is it a player?!
if (Menu::Window.VisualsTab.FiltersPlayers.GetState() && Interfaces::Engine->GetPlayerInfo(i, &pinfo) && pEntity->IsAlive())
{
DrawPlayer(pEntity, pinfo);
}
// ~ Other ESP's here (items and shit) ~ //
ClientClass* cClass = (ClientClass*)pEntity->GetClientClass();
// Dropped weapons
if (Menu::Window.VisualsTab.FiltersWeapons.GetState() && cClass->m_ClassID != (int)CSGOClassID::CBaseWeaponWorldModel && ((strstr(cClass->m_pNetworkName, "Weapon") || cClass->m_ClassID == (int)CSGOClassID::CDEagle || cClass->m_ClassID == (int)CSGOClassID::CAK47)))
{
DrawDrop(pEntity, cClass);
}
// If entity is the bomb
if (Menu::Window.VisualsTab.FiltersC4.GetState())
{
if (cClass->m_ClassID == (int)CSGOClassID::CPlantedC4)
DrawBombPlanted(pEntity, cClass);
if (cClass->m_ClassID == (int)CSGOClassID::CC4)
DrawBomb(pEntity, cClass);
}
// If entity is a chicken
if (Menu::Window.VisualsTab.FiltersChickens.GetState())
{
if (cClass->m_ClassID == (int)CSGOClassID::CChicken)
DrawChicken(pEntity, cClass);
}
}
}
}
// Yeah m8
void CEsp::DrawPlayer(IClientEntity* pEntity, player_info_t pinfo)
{
ESPBox Box;
Color Color;
// Show own team false? well gtfo teammate
if (Menu::Window.VisualsTab.FiltersEnemiesOnly.GetState() && (pEntity->GetTeamNum() == hackManager.pLocal()->GetTeamNum()))
return;
if (GetBox(pEntity, Box))
{
Color = GetPlayerColor(pEntity);
if (Menu::Window.VisualsTab.OptionsBox.GetState())
DrawBox(Box, Color);
if (Menu::Window.VisualsTab.OptionsName.GetState())
DrawName(pinfo, Box);
if (Menu::Window.VisualsTab.OptionsHealth.GetState())
DrawHealth(pEntity, Box);
if (Menu::Window.VisualsTab.OptionsInfo.GetState() || Menu::Window.VisualsTab.OptionsWeapon.GetState())
DrawInfo(pEntity, Box);
if (Menu::Window.VisualsTab.OptionsAimSpot.GetState())
DrawCross(pEntity);
if (Menu::Window.VisualsTab.OptionsSkeleton.GetState())
DrawSkeleton(pEntity);
}
}
// Gets the 2D bounding box for the entity
// Returns false on failure nigga don't fail me
bool CEsp::GetBox(IClientEntity* pEntity, CEsp::ESPBox &result)
{
// Variables
Vector vOrigin, min, max, sMin, sMax, sOrigin,
flb, brt, blb, frt, frb, brb, blt, flt;
float left, top, right, bottom;
// Get the locations
vOrigin = pEntity->GetOrigin();
min = pEntity->collisionProperty()->GetMins() + vOrigin;
max = pEntity->collisionProperty()->GetMaxs() + vOrigin;
// Points of a 3d bounding box
Vector points[] = { Vector(min.x, min.y, min.z),
Vector(min.x, max.y, min.z),
Vector(max.x, max.y, min.z),
Vector(max.x, min.y, min.z),
Vector(max.x, max.y, max.z),
Vector(min.x, max.y, max.z),
Vector(min.x, min.y, max.z),
Vector(max.x, min.y, max.z) };
// Get screen positions
if (!Render::WorldToScreen(points[3], flb) || !Render::WorldToScreen(points[5], brt)
|| !Render::WorldToScreen(points[0], blb) || !Render::WorldToScreen(points[4], frt)
|| !Render::WorldToScreen(points[2], frb) || !Render::WorldToScreen(points[1], brb)
|| !Render::WorldToScreen(points[6], blt) || !Render::WorldToScreen(points[7], flt))
return false;
// Put them in an array (maybe start them off in one later for speed?)
Vector arr[] = { flb, brt, blb, frt, frb, brb, blt, flt };
// Init this shit
left = flb.x;
top = flb.y;
right = flb.x;
bottom = flb.y;
// Find the bounding corners for our box
for (int i = 1; i < 8; i++)
{
if (left > arr[i].x)
left = arr[i].x;
if (bottom < arr[i].y)
bottom = arr[i].y;
if (right < arr[i].x)
right = arr[i].x;
if (top > arr[i].y)
top = arr[i].y;
}
// Width / height
result.x = left;
result.y = top;
result.w = right - left;
result.h = bottom - top;
return true;
}
// Get an entities color depending on team and vis ect
Color CEsp::GetPlayerColor(IClientEntity* pEntity)
{
int TeamNum = pEntity->GetTeamNum();
bool IsVis = GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::Head);
Color color;
if (TeamNum == TEAM_CS_T)
{
if (IsVis)
color = Color(235, 200, 0, 255);
else
color = Color(235, 50, 0, 255);
}
else
{
if (IsVis)
color = Color(120, 210, 26, 255);
else
color = Color(15, 110, 220, 255);
}
return color;
}
// 2D Esp box
void CEsp::DrawBox(CEsp::ESPBox size, Color color)
{
//if (PlayerBoxes->GetStringIndex() == 1)
//{
// // Full Box
// renderMan->Outline(size.x, size.y, size.w, size.h, color);
// renderMan->Outline(size.x - 1, size.y - 1, size.w + 2, size.h + 2, COLORCODE(10, 10, 10, 150));
// renderMan->Outline(size.x + 1, size.y + 1, size.w - 2, size.h - 2, COLORCODE(10, 10, 10, 150));
//}
//else
//{
// Corner Box
int VertLine = (((float)size.w) * (0.20f));
int HorzLine = (((float)size.h) * (0.20f));
Render::Clear(size.x, size.y - 1, VertLine, 1, Color(10, 10, 10, 150));
Render::Clear(size.x + size.w - VertLine, size.y - 1, VertLine, 1, Color(10, 10, 10, 150));
Render::Clear(size.x, size.y + size.h - 1, VertLine, 1, Color(10, 10, 10, 150));
Render::Clear(size.x + size.w - VertLine, size.y + size.h - 1, VertLine, 1, Color(10, 10, 10, 150));
Render::Clear(size.x - 1, size.y, 1, HorzLine, Color(10, 10, 10, 150));
Render::Clear(size.x - 1, size.y + size.h - HorzLine, 1, HorzLine, Color(10, 10, 10, 150));
Render::Clear(size.x + size.w - 1, size.y, 1, HorzLine, Color(10, 10, 10, 150));
Render::Clear(size.x + size.w - 1, size.y + size.h - HorzLine, 1, HorzLine, Color(10, 10, 10, 150));
Render::Clear(size.x, size.y, VertLine, 1, color);
Render::Clear(size.x + size.w - VertLine, size.y, VertLine, 1, color);
Render::Clear(size.x, size.y + size.h, VertLine, 1, color);
Render::Clear(size.x + size.w - VertLine, size.y + size.h, VertLine, 1, color);
Render::Clear(size.x, size.y, 1, HorzLine, color);
Render::Clear(size.x, size.y + size.h - HorzLine, 1, HorzLine, color);
Render::Clear(size.x + size.w, size.y, 1, HorzLine, color);
Render::Clear(size.x + size.w, size.y + size.h - HorzLine, 1, HorzLine, color);
//}
}
// Unicode Conversions
static wchar_t* CharToWideChar(const char* text)
{
size_t size = strlen(text) + 1;
wchar_t* wa = new wchar_t[size];
mbstowcs_s(NULL, wa, size / 4, text, size);
return wa;
}
// Player name
void CEsp::DrawName(player_info_t pinfo, CEsp::ESPBox size)
{
RECT nameSize = Render::GetTextSize(Render::Fonts::ESP, pinfo.name);
Render::Text(size.x + (size.w / 2) - (nameSize.right / 2), size.y - 16,
Color(255, 255, 255, 255), Render::Fonts::ESP, pinfo.name);
}
// Draw a health bar. For Tf2 when a bar is bigger than max health a second bar is displayed
void CEsp::DrawHealth(IClientEntity* pEntity, CEsp::ESPBox size)
{
ESPBox HealthBar = size;
HealthBar.y += (HealthBar.h + 6);
HealthBar.h = 4;
float HealthValue = pEntity->GetHealth();
float HealthPerc = HealthValue / 100.f;
float Width = (size.w * HealthPerc);
HealthBar.w = Width;
// -- Main Bar -- //
Vertex_t Verts[4];
Verts[0].Init(Vector2D(HealthBar.x, HealthBar.y));
Verts[1].Init(Vector2D(HealthBar.x + size.w + 5, HealthBar.y));
Verts[2].Init(Vector2D(HealthBar.x + size.w, HealthBar.y + 5));
Verts[3].Init(Vector2D(HealthBar.x - 5, HealthBar.y + 5));
Render::PolygonOutline(4, Verts, Color(10, 10, 10, 255), Color(255, 255, 255, 170));
Vertex_t Verts2[4];
Verts2[0].Init(Vector2D(HealthBar.x + 1, HealthBar.y + 1));
Verts2[1].Init(Vector2D(HealthBar.x + HealthBar.w + 4, HealthBar.y + 1));
Verts2[2].Init(Vector2D(HealthBar.x + HealthBar.w, HealthBar.y + 5));
Verts2[3].Init(Vector2D(HealthBar.x - 4, HealthBar.y + 5));
Color c = GetPlayerColor(pEntity);
Render::Polygon(4, Verts2, c);
Verts2[0].Init(Vector2D(HealthBar.x + 1, HealthBar.y + 1));
Verts2[1].Init(Vector2D(HealthBar.x + HealthBar.w + 2, HealthBar.y + 1));
Verts2[2].Init(Vector2D(HealthBar.x + HealthBar.w, HealthBar.y + 2));
Verts2[3].Init(Vector2D(HealthBar.x - 2, HealthBar.y + 2));
Render::Polygon(4, Verts2, Color(255, 255, 255, 40));
}
// Cleans the internal class name up to something human readable and nice
std::string CleanItemName(std::string name)
{
std::string Name = name;
// Tidy up the weapon Name
if (Name[0] == 'C')
Name.erase(Name.begin());
// Remove the word Weapon
auto startOfWeap = Name.find("Weapon");
if (startOfWeap != std::string::npos)
Name.erase(Name.begin() + startOfWeap, Name.begin() + startOfWeap + 6);
return Name;
}
// Anything else: weapons, class state? idk
void CEsp::DrawInfo(IClientEntity* pEntity, CEsp::ESPBox size)
{
std::vector < std::string> Info;
// Player Weapon ESP
IClientEntity* pWeapon = Interfaces::EntList->GetClientEntityFromHandle((HANDLE)pEntity->GetActiveWeaponHandle());
if (Menu::Window.VisualsTab.OptionsWeapon.GetState() && pWeapon)
{
ClientClass* cClass = (ClientClass*)pWeapon->GetClientClass();
if (cClass)
{
// Draw it
Info.push_back(CleanItemName(cClass->m_pNetworkName));
}
}
// Bomb Carrier
if (Menu::Window.VisualsTab.OptionsInfo.GetState() && pEntity == BombCarrier)
{
Info.push_back("Bomb Carrier");
}
// Comp Rank
if (Menu::Window.VisualsTab.OptionsInfo.GetState())
{
int CompRank = GameUtils::GetPlayerCompRank(pEntity);
static const char* Ranks[] =
{
"",
"Silver I",
"Silver II",
"Silver III",
"Silver IV",
"Silver Elite",
"Silver Elite Master",
"Gold Nova I",
"Gold Nova II",
"Gold Nova III",
"Gold Nova Master",
"Master Guardian I",
"Master Guardian II",
"Master Guardian Elite",
"Distinguished Master Guardian",
"Legendary Eagle",
"Legendary Eagle Master",
"Supreme Master First Class",
"Global Elite"
};
if (CompRank >= 0 && CompRank <= 18)
Info.push_back(Ranks[CompRank]);
}
static RECT Size = Render::GetTextSize(Render::Fonts::Default, "Hi");
int i = 0;
for (auto Text : Info)
{
Render::Text(size.x + size.w + 3, size.y + (i * (Size.bottom + 2)), Color(255, 255, 255, 255), Render::Fonts::ESP, Text.c_str());
i++;
}
}
// Little cross on their heads
void CEsp::DrawCross(IClientEntity* pEntity)
{
Vector cross = pEntity->GetHeadPos(), screen;
static int Scale = 2;
if (Render::WorldToScreen(cross, screen))
{
Render::Clear(screen.x - Scale, screen.y - (Scale * 2), (Scale * 2), (Scale * 4), Color(20, 20, 20, 160));
Render::Clear(screen.x - (Scale * 2), screen.y - Scale, (Scale * 4), (Scale * 2), Color(20, 20, 20, 160));
Render::Clear(screen.x - Scale - 1, screen.y - (Scale * 2) - 1, (Scale * 2) - 2, (Scale * 4) - 2, Color(250, 250, 250, 160));
Render::Clear(screen.x - (Scale * 2) - 1, screen.y - Scale - 1, (Scale * 4) - 2, (Scale * 2) - 2, Color(250, 250, 250, 160));
}
}
// Draws a dropped CS:GO Item
void CEsp::DrawDrop(IClientEntity* pEntity, ClientClass* cClass)
{
Vector Box;
CBaseCombatWeapon* Weapon = (CBaseCombatWeapon*)pEntity;
IClientEntity* plr = Interfaces::EntList->GetClientEntityFromHandle((HANDLE)Weapon->GetOwnerHandle());
if (!plr && Render::WorldToScreen(Weapon->GetOrigin(), Box))
{
if (Menu::Window.VisualsTab.OptionsBox.GetState())
{
Render::Outline(Box.x - 2, Box.y - 2, 4, 4, Color(255, 255, 255, 255));
Render::Outline(Box.x - 3, Box.y - 3, 6, 6, Color(10, 10, 10, 150));
}
if (Menu::Window.VisualsTab.OptionsInfo.GetState())
{
std::string ItemName = CleanItemName(cClass->m_pNetworkName);
RECT TextSize = Render::GetTextSize(Render::Fonts::ESP, ItemName.c_str());
Render::Text(Box.x - (TextSize.right / 2), Box.y - 16, Color(255, 255, 255, 255), Render::Fonts::ESP, ItemName.c_str());
}
}
}
// Draws a chicken
void CEsp::DrawChicken(IClientEntity* pEntity, ClientClass* cClass)
{
ESPBox Box;
if (GetBox(pEntity, Box))
{
player_info_t pinfo; strcpy_s(pinfo.name, "Chicken");
if (Menu::Window.VisualsTab.OptionsBox.GetState())
DrawBox(Box, Color(255, 255, 255, 255));
if (Menu::Window.VisualsTab.OptionsName.GetState())
DrawName(pinfo, Box);
}
}
// Draw the planted bomb and timer
void CEsp::DrawBombPlanted(IClientEntity* pEntity, ClientClass* cClass)
{
// Null it out incase bomb has been dropped or planted
BombCarrier = nullptr;
Vector vOrig; Vector vScreen;
vOrig = pEntity->GetOrigin();
CCSBomb* Bomb = (CCSBomb*)pEntity;
if (Render::WorldToScreen(vOrig, vScreen))
{
float flBlow = Bomb->GetC4BlowTime();
float TimeRemaining = flBlow - (Interfaces::Globals->interval_per_tick * hackManager.pLocal()->GetTickBase());
char buffer[64];
sprintf_s(buffer, "Bomb: %.1f", TimeRemaining);
Render::Text(vScreen.x, vScreen.y, Color(250, 42, 42, 255), Render::Fonts::ESP, buffer);
}
}
// Draw the bomb if it's dropped, or store the player who's carrying
void CEsp::DrawBomb(IClientEntity* pEntity, ClientClass* cClass)
{
// Null it out incase bomb has been dropped or planted
BombCarrier = nullptr;
CBaseCombatWeapon* BombWeapon = (CBaseCombatWeapon*)pEntity;
Vector vOrig; Vector vScreen;
vOrig = pEntity->GetOrigin();
bool adopted = true;
HANDLE parent = BombWeapon->GetOwnerHandle();
if (parent || (vOrig.x == 0 && vOrig.y == 0 && vOrig.z == 0))
{
IClientEntity* pParentEnt = (Interfaces::EntList->GetClientEntityFromHandle(parent));
if (pParentEnt && pParentEnt->IsAlive())
{
BombCarrier = pParentEnt;
adopted = false;
}
}
if (adopted)
{
if (Render::WorldToScreen(vOrig, vScreen))
{
Render::Text(vScreen.x, vScreen.y, Color(112, 230, 20, 255), Render::Fonts::ESP, "Bomb");
}
}
}
void DrawBoneArray(int* boneNumbers, int amount, IClientEntity* pEntity, Color color)
{
Vector LastBoneScreen;
for (int i = 0; i < amount; i++)
{
Vector Bone = pEntity->GetBonePos(boneNumbers[i]);
Vector BoneScreen;
if (Render::WorldToScreen(Bone, BoneScreen))
{
if (i > 0)
{
Render::Line(LastBoneScreen.x, LastBoneScreen.y, BoneScreen.x, BoneScreen.y, color);
}
}
LastBoneScreen = BoneScreen;
}
}
void DrawBoneTest(IClientEntity* pEntity)
{
for (int i = 0; i < 127; i++)
{
Vector BoneLoc = pEntity->GetBonePos(i);
Vector BoneScreen;
if (Render::WorldToScreen(BoneLoc, BoneScreen))
{
char buf[10];
_itoa_s(i, buf, 10);
Render::Text(BoneScreen.x, BoneScreen.y, Color(255, 255, 255, 180), Render::Fonts::ESP, buf);
}
}
}
void CEsp::DrawSkeleton(IClientEntity* pEntity)
{
studiohdr_t* pStudioHdr = Interfaces::ModelInfo->GetStudiomodel(pEntity->GetModel());
if (!pStudioHdr)
return;
Vector vParent, vChild, sParent, sChild;
for (int j = 0; j < pStudioHdr->numbones; j++)
{
mstudiobone_t* pBone = pStudioHdr->GetBone(j);
if (pBone && (pBone->flags & BONE_USED_BY_HITBOX) && (pBone->parent != -1))
{
vChild = pEntity->GetBonePos(j);
vParent = pEntity->GetBonePos(pBone->parent);
if (Render::WorldToScreen(vParent, sParent) && Render::WorldToScreen(vChild, sChild))
{
Render::Line(sParent[0], sParent[1], sChild[0], sChild[1], Color(255, 255, 255, 255));
}
}
}
}/*
Syn's AYYWAREFramework 2015
*/
#pragma once
#include "Hacks.h"
class CEsp : public CHack
{
public:
void Init();
void Draw();
void Move(CUserCmd* pCmd);
private:
// Other shit
IClientEntity* BombCarrier;
struct ESPBox
{
int x, y, w, h;
};
// Draw a player
void DrawPlayer(IClientEntity* pEntity, player_info_t pinfo);
// Get player info
Color GetPlayerColor(IClientEntity* pEntity);
bool GetBox(IClientEntity* pEntity, ESPBox &result);
// Draw shit about player
void DrawBox(ESPBox size, Color color);
void DrawName(player_info_t pinfo, ESPBox size);
void DrawHealth(IClientEntity* pEntity, ESPBox size);
void DrawInfo(IClientEntity* pEntity, ESPBox size);
void DrawCross(IClientEntity* pEntity);
void DrawSkeleton(IClientEntity* pEntity);
void DrawChicken(IClientEntity* pEntity, ClientClass* cClass);
void DrawDrop(IClientEntity* pEntity, ClientClass* cClass);
void DrawBombPlanted(IClientEntity* pEntity, ClientClass* cClass);
void DrawBomb(IClientEntity* pEntity, ClientClass* cClass);
};
#include "GUI.h"
#include "RenderManager.h"
#include
#include "tinyxml2.h"
#include "Controls.h"
CGUI GUI;
CGUI::CGUI()
{
}
// Draws all windows
void CGUI::Draw()
{
bool ShouldDrawCursor = false;
for (auto window : Windows)
{
if (window->m_bIsOpen)
{
ShouldDrawCursor = true;
DrawWindow(window);
}
}
if (ShouldDrawCursor)
{
static Vertex_t MouseVt[3];
MouseVt[0].Init(Vector2D(Mouse.x, Mouse.y));
MouseVt[1].Init(Vector2D(Mouse.x + 16, Mouse.y));
MouseVt[2].Init(Vector2D(Mouse.x, Mouse.y + 16));
Render::PolygonOutline(3, MouseVt, Color(255, 0, 0, 230), Color(0, 0, 0, 240));
}
}
// Handle all input etc
void CGUI::Update()
{
//Key Array
std::copy(keys, keys + 255, oldKeys);
for (int x = 0; x < 255; x++)
{
//oldKeys[x] = oldKeys[x] & keys[x];
keys[x] = (GetAsyncKeyState(x));
}
// Mouse Location
POINT mp; GetCursorPos(&mp);
Mouse.x = mp.x; Mouse.y = mp.y;
RECT Screen = Render::GetViewport();
// Window Binds
for (auto & bind : WindowBinds)
{
if (GetKeyPress(bind.first))
{
bind.second->Toggle();
}
}
// Stop dragging
if (IsDraggingWindow && !GetKeyState(VK_LBUTTON))
{
IsDraggingWindow = false;
DraggingWindow = nullptr;
}
// If we are in the proccess of dragging a window
if (IsDraggingWindow && GetKeyState(VK_LBUTTON) && !GetKeyPress(VK_LBUTTON))
{
if (DraggingWindow)
{
DraggingWindow->m_x = Mouse.x - DragOffsetX;
DraggingWindow->m_y = Mouse.y - DragOffsetY;
}
}
// Process some windows
for (auto window : Windows)
{
if (window->m_bIsOpen)
{
// Used to tell the widget processing that there could be a click
bool bCheckWidgetClicks = false;
// If the user clicks inside the window
if (GetKeyPress(VK_LBUTTON))
{
if (IsMouseInRegion(window->m_x, window->m_y, window->m_x + window->m_iWidth, window->m_y + window->m_iHeight))
{
// Is it inside the client area?
if (IsMouseInRegion(window->GetClientArea()))
{
// User is selecting a new tab
if (IsMouseInRegion(window->GetTabArea()))
{
// Loose focus on the control
window->IsFocusingControl = false;
window->FocusedControl = nullptr;
int iTab = 0;
int TabCount = window->Tabs.size();
if (TabCount) // If there are some tabs
{
int TabSize = (window->m_iWidth - 4 - 12) / TabCount;
int Dist = Mouse.x - (window->m_x + 8);
while (Dist > TabSize)
{
if (Dist > TabSize)
{
iTab++;
Dist -= TabSize;
}
}
window->SelectedTab = window->Tabs[iTab];
}
}
else
bCheckWidgetClicks = true;
}
else
{
// Must be in the around the title or side of the window
// So we assume the user is trying to drag the window
IsDraggingWindow = true;
DraggingWindow = window;
DragOffsetX = Mouse.x - window->m_x;
DragOffsetY = Mouse.y - window->m_y;
// Loose focus on the control
window->IsFocusingControl = false;
window->FocusedControl = nullptr;
}
}
else
{
// Loose focus on the control
window->IsFocusingControl = false;
window->FocusedControl = nullptr;
}
}
// Controls
if (window->SelectedTab != nullptr)
{
// Focused widget
bool SkipWidget = false;
CControl* SkipMe = nullptr;
// this window is focusing on a widget??
if (window->IsFocusingControl)
{
if (window->FocusedControl != nullptr)
{
// We've processed it once, skip it later
SkipWidget = true;
SkipMe = window->FocusedControl;
POINT cAbs = window->FocusedControl->GetAbsolutePos();
RECT controlRect = { cAbs.x, cAbs.y, window->FocusedControl->m_iWidth, window->FocusedControl->m_iHeight };
window->FocusedControl->OnUpdate();
if (window->FocusedControl->Flag(UIFlags::UI_Clickable) && IsMouseInRegion(controlRect) && bCheckWidgetClicks)
{
window->FocusedControl->OnClick();
// If it gets clicked we loose focus
window->IsFocusingControl = false;
window->FocusedControl = nullptr;
bCheckWidgetClicks = false;
}
}
}
// Itterate over the rest of the control
for (auto control : window->SelectedTab->Controls)
{
if (control != nullptr)
{
if (SkipWidget && SkipMe == control)
continue;
POINT cAbs = control->GetAbsolutePos();
RECT controlRect = { cAbs.x, cAbs.y, control->m_iWidth, control->m_iHeight };
control->OnUpdate();
if (control->Flag(UIFlags::UI_Clickable) && IsMouseInRegion(controlRect) && bCheckWidgetClicks)
{
control->OnClick();
bCheckWidgetClicks = false;
// Change of focus
if (control->Flag(UIFlags::UI_Focusable))
{
window->IsFocusingControl = true;
window->FocusedControl = control;
}
else
{
window->IsFocusingControl = false;
window->FocusedControl = nullptr;
}
}
}
}
// We must have clicked whitespace
if (bCheckWidgetClicks)
{
// Loose focus on the control
window->IsFocusingControl = false;
window->FocusedControl = nullptr;
}
}
}
}
}
// Returns
bool CGUI::GetKeyPress(unsigned int key)
{
if (keys[key] == true && oldKeys[key] == false)
return true;
else
return false;
}
bool CGUI::GetKeyState(unsigned int key)
{
return keys[key];
}
bool CGUI::IsMouseInRegion(int x, int y, int x2, int y2)
{
if (Mouse.x > x && Mouse.y > y && Mouse.x < x2 && Mouse.y < y2)
return true;
else
return false;
}
bool CGUI::IsMouseInRegion(RECT region)
{
return IsMouseInRegion(region.left, region.top, region.left + region.right, region.top + region.bottom);
}
POINT CGUI::GetMouse()
{
return Mouse;
}
bool CGUI::DrawWindow(CWindow* window)
{
// Main Window
Render::Outline(window->m_x, window->m_y, window->m_iWidth, window->m_iHeight, Color(20, 20, 20, 80));
Render::GradientV(window->m_x + 2, window->m_y + 2, window->m_iWidth - 4, 26, Color(0, 0, 0, 255), Color(0, 0, 0, 255));
Render::Clear(window->m_x + 2, window->m_y + 2 + 26, window->m_iWidth - 4, window->m_iHeight - 4 - 26, Color(0, 0, 0, 255));
Render::Outline(window->m_x + 1, window->m_y + 1, window->m_iWidth - 2, window->m_iHeight - 2, Color(255, 0, 0, 255));
Render::Text(window->m_x + 8, window->m_y + 8, Color(255, 255, 255, 255), Render::Fonts::MenuBold, window->Title.c_str());
//Inner
Render::Outline(window->m_x + 7, window->m_y + 1 + 26, window->m_iWidth - 4 - 10, window->m_iHeight - 2 - 6 - 26, Color(255, 0, 0, 255));
Render::Clear(window->m_x + 8, window->m_y + 1 + 27, window->m_iWidth - 4 - 12, window->m_iHeight - 2 - 8 - 26, Color(255, 255, 255, 255));
//Tab
Render::GradientV(window->m_x + 8, window->m_y + 1 + 27, window->m_iWidth - 4 - 12, 29, Color(52, 52, 52, 255), Color(6, 6, 6, 255));
int TabCount = window->Tabs.size();
if (TabCount) // If there are some tabs
{
int TabSize = (window->m_iWidth - 4 - 12) / TabCount;
for (int i = 0; i < TabCount; i++)
{
RECT TabArea = { window->m_x + 8 + (i * TabSize), window->m_y + 1 + 27, TabSize, 29 };
CTab* tab = window->Tabs[i];
if (window->SelectedTab == tab)
{
Render::GradientV(window->m_x + 8 + (i * TabSize), window->m_y + 1 + 27, TabSize, 29, Color(52, 52, 52, 255), Color(106, 106, 106, 255));
}
else if (IsMouseInRegion(TabArea))
{
Render::GradientV(window->m_x + 8 + (i * TabSize), window->m_y + 1 + 27, TabSize, 29, Color(106, 106, 106, 255), Color(52, 52, 52, 255));
}
RECT TextSize = Render::GetTextSize(Render::Fonts::MenuBold, tab->Title.c_str());
Render::Text(TabArea.left + (TabSize / 2) - (TextSize.right / 2), TabArea.top + 8, Color(255, 255, 255, 255), Render::Fonts::MenuBold, tab->Title.c_str());
Render::Clear(window->m_x + 8, window->m_y + 1 + 27, window->m_iWidth - 4 - 12, 2, Color(66, 66, 66, 255));
}
}
// Controls
if (window->SelectedTab != nullptr)
{
// Focused widget
bool SkipWidget = false;
CControl* SkipMe = nullptr;
// this window is focusing on a widget??
if (window->IsFocusingControl)
{
if (window->FocusedControl != nullptr)
{
// We need to draw it last, so skip it in the regular loop
SkipWidget = true;
SkipMe = window->FocusedControl;
}
}
// Itterate over all the other controls
for (auto control : window->SelectedTab->Controls)
{
if (SkipWidget && SkipMe == control)
continue;
if (control != nullptr && control->Flag(UIFlags::UI_Drawable))
{
POINT cAbs = control->GetAbsolutePos();
RECT controlRect = { cAbs.x, cAbs.y, control->m_iWidth, control->m_iHeight };
bool hover = false;
if (IsMouseInRegion(controlRect))
{
hover = true;
}
control->Draw(hover);
}
}
// Draw the skipped widget last
if (SkipWidget)
{
auto control = window->FocusedControl;
if (control != nullptr && control->Flag(UIFlags::UI_Drawable))
{
POINT cAbs = control->GetAbsolutePos();
RECT controlRect = { cAbs.x, cAbs.y, control->m_iWidth, control->m_iHeight };
bool hover = false;
if (IsMouseInRegion(controlRect))
{
hover = true;
}
control->Draw(hover);
}
}
}
return true;
}
void CGUI::RegisterWindow(CWindow* window)
{
Windows.push_back(window);
// Resorting to put groupboxes at the start
for (auto tab : window->Tabs)
{
for (auto control : tab->Controls)
{
if (control->Flag(UIFlags::UI_RenderFirst))
{
CControl* c = control;
tab->Controls.erase(std::remove(tab->Controls.begin(), tab->Controls.end(), control), tab->Controls.end());
tab->Controls.insert(tab->Controls.begin(), control);
}
}
}
}
void CGUI::BindWindow(unsigned char Key, CWindow* window)
{
if (window)
WindowBinds[Key] = window;
else
WindowBinds.erase(Key);
}
void CGUI::SaveWindowState(CWindow* window, std::string Filename)
{
// Create a whole new document and we'll just save over top of the old one
tinyxml2::XMLDocument Doc;
// Root Element is called "ayy"
tinyxml2::XMLElement* Root = Doc.NewElement("ayy");
Doc.LinkEndChild(Root);
Utilities::Log("Saving Window %s", window->Title.c_str());
// If the window has some tabs..
if (Root && window->Tabs.size() > 0)
{
for (auto Tab : window->Tabs)
{
// Add a new section for this tab
tinyxml2::XMLElement* TabElement = Doc.NewElement(Tab->Title.c_str());
Root->LinkEndChild(TabElement);
Utilities::Log("Saving Tab %s", Tab->Title.c_str());
// Now we itterate the controls this tab contains
if (TabElement && Tab->Controls.size() > 0)
{
for (auto Control : Tab->Controls)
{
// If the control is ok to be saved
if (Control && Control->Flag(UIFlags::UI_SaveFile) && Control->FileIdentifier.length() > 1 && Control->FileControlType)
{
// Create an element for the control
tinyxml2::XMLElement* ControlElement = Doc.NewElement(Control->FileIdentifier.c_str());
TabElement->LinkEndChild(ControlElement);
Utilities::Log("Saving control %s", Control->FileIdentifier.c_str());
if (!ControlElement)
{
Utilities::Log("Errorino :(");
return;
}
CCheckBox* cbx = nullptr;
CComboBox* cbo = nullptr;
CKeyBind* key = nullptr;
CSlider* sld = nullptr;
// Figure out what kind of control and data this is
switch (Control->FileControlType)
{
case UIControlTypes::UIC_CheckBox:
cbx = (CCheckBox*)Control;
ControlElement->SetText(cbx->GetState());
break;
case UIControlTypes::UIC_ComboBox:
cbo = (CComboBox*)Control;
ControlElement->SetText(cbo->GetIndex());
break;
case UIControlTypes::UIC_KeyBind:
key = (CKeyBind*)Control;
ControlElement->SetText(key->GetKey());
break;
case UIControlTypes::UIC_Slider:
sld = (CSlider*)Control;
ControlElement->SetText(sld->GetValue());
break;
}
}
}
}
}
}
//Save the file
if (Doc.SaveFile(Filename.c_str()) != tinyxml2::XML_NO_ERROR)
{
MessageBox(NULL, "Failed To Save Config File!", "AyyWare", MB_OK);
}
}
void CGUI::LoadWindowState(CWindow* window, std::string Filename)
{
// Lets load our meme
tinyxml2::XMLDocument Doc;
if (Doc.LoadFile(Filename.c_str()) == tinyxml2::XML_NO_ERROR)
{
tinyxml2::XMLElement* Root = Doc.RootElement();
// The root "ayy" element
if (Root)
{
// If the window has some tabs..
if (Root && window->Tabs.size() > 0)
{
for (auto Tab : window->Tabs)
{
// We find the corresponding element for this tab
tinyxml2::XMLElement* TabElement = Root->FirstChildElement(Tab->Title.c_str());
if (TabElement)
{
// Now we itterate the controls this tab contains
if (TabElement && Tab->Controls.size() > 0)
{
for (auto Control : Tab->Controls)
{
// If the control is ok to be saved
if (Control && Control->Flag(UIFlags::UI_SaveFile) && Control->FileIdentifier.length() > 1 && Control->FileControlType)
{
// Get the controls element
tinyxml2::XMLElement* ControlElement = TabElement->FirstChildElement(Control->FileIdentifier.c_str());
if (ControlElement)
{
Utilities::Log("We tryin to load fam");
CCheckBox* cbx = nullptr;
CComboBox* cbo = nullptr;
CKeyBind* key = nullptr;
CSlider* sld = nullptr;
// Figure out what kind of control and data this is
switch (Control->FileControlType)
{
case UIControlTypes::UIC_CheckBox:
cbx = (CCheckBox*)Control;
cbx->SetState(ControlElement->GetText()[0] == '1' ? true : false);
break;
case UIControlTypes::UIC_ComboBox:
cbo = (CComboBox*)Control;
cbo->SelectIndex(atoi(ControlElement->GetText()));
break;
case UIControlTypes::UIC_KeyBind:
key = (CKeyBind*)Control;
key->SetKey(atoi(ControlElement->GetText()));
break;
case UIControlTypes::UIC_Slider:
sld = (CSlider*)Control;
sld->SetValue(atof(ControlElement->GetText()));
break;
}
}
}
}
}
}
}
}
}
}
}/*
Syn's AYYWAREFramework 2015
*/
#pragma once
#include "CommonIncludes.h"
#include