From fde0d8d949cbd85575dfb357751b46a90c8979ff Mon Sep 17 00:00:00 2001 From: user <97338859+Viceroyy@users.noreply.github.com> Date: Thu, 4 Sep 2025 19:49:22 +0300 Subject: [PATCH 1/2] QoL changes (C++ castings etc.) --- .idea/.gitignore | 8 + .idea/editor.xml | 344 ++++ .idea/misc.xml | 18 + .idea/vcs.xml | 6 + classes/building.hpp | 56 +- classes/convar.hpp | 13 +- classes/entity.hpp | 252 ++- classes/keyvalues.hpp | 68 +- classes/material.hpp | 60 +- classes/player.hpp | 739 ++++---- classes/sniper_dot.hpp | 9 +- classes/weapon.hpp | 1665 ++++++++--------- gui/config.hpp | 177 +- gui/imgui/dearimgui.hpp | 4 +- gui/menu.cpp | 452 ++--- hacks/aimbot/aimbot.cpp | 301 +-- hacks/aimbot/aimbot.hpp | 2 +- hacks/bhop/bhop.cpp | 77 +- hacks/chams/chams.cpp | 144 +- hacks/engine_prediction/engine_prediction.cpp | 92 +- hacks/esp/esp.hpp | 76 +- hacks/esp/esp_entity.cpp | 408 ++-- hacks/esp/esp_player.cpp | 273 +-- hacks/thirdperson/thirdperson.cpp | 88 +- hooks/cl_move.cpp | 2 +- hooks/client_create_move.cpp | 54 +- hooks/client_mode_create_move.cpp | 80 +- hooks/draw_model_execute.cpp | 29 +- hooks/draw_view_model.cpp | 12 +- hooks/draw_view_models.cpp | 6 +- hooks/get_user_cmd.cpp | 4 +- hooks/hooks.cpp | 147 +- hooks/in_cond.cpp | 14 +- hooks/load_white_list.cpp | 12 +- hooks/override_view.cpp | 32 +- hooks/paint_traverse.cpp | 160 +- hooks/sdl.cpp | 131 +- hooks/should_draw_local_player.cpp | 18 +- hooks/should_draw_this_player.cpp | 10 +- hooks/vulkan.cpp | 9 +- interfaces/attribute_manager.hpp | 10 +- interfaces/client.hpp | 104 +- interfaces/client_state.hpp | 104 +- interfaces/convar_system.hpp | 15 +- interfaces/debug_overlay.hpp | 17 +- interfaces/engine.hpp | 55 +- interfaces/engine_trace.hpp | 272 +-- interfaces/entity_list.hpp | 59 +- interfaces/game_movement.hpp | 89 +- interfaces/global_vars.hpp | 32 +- interfaces/input.hpp | 63 +- interfaces/material_system.hpp | 26 +- interfaces/model_render.hpp | 16 +- interfaces/move_helper.hpp | 12 +- interfaces/prediction.hpp | 132 +- interfaces/render_view.hpp | 124 +- interfaces/steam_client.hpp | 40 +- interfaces/steam_friends.hpp | 129 +- interfaces/surface.hpp | 174 +- main.cpp | 562 +++--- math.hpp | 48 +- memory.hpp | 63 +- print.hpp | 20 +- random_seed.hpp | 2 +- vec.hpp | 242 +-- 65 files changed, 4461 insertions(+), 4001 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/editor.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/editor.xml b/.idea/editor.xml new file mode 100644 index 0000000..963c96f --- /dev/null +++ b/.idea/editor.xml @@ -0,0 +1,344 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..53624c9 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,18 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/classes/building.hpp b/classes/building.hpp index 7b80054..68981b5 100644 --- a/classes/building.hpp +++ b/classes/building.hpp @@ -6,34 +6,34 @@ // Maybe make Building a base class for the different buildings class Building : public Entity { public: - int get_health(void) { - return *(int*)(this + 0x1388); - } - - int get_max_health(void) { - return *(int*)(this + 0x138C); - } - - bool is_sapped(void) { - return *(bool*)(this + 0x1380); - } - - bool is_carried(void) { - return *(bool*)(this + 0x1396) || this->is_carried_deploy(); - } - - bool is_carried_deploy(void) { - return *(bool*)(this + 0x1397); - } - - // Sentry - bool is_mini_sentry(void) { - return *(bool*)(this + 0x1399); - } - - int get_building_level(void) { - return *(int*)(this + 0x1334); - } + int get_health(void) { + return *reinterpret_cast(this + 0x1388); + } + + int get_max_health(void) { + return *reinterpret_cast(this + 0x138C); + } + + bool is_sapped(void) { + return *reinterpret_cast(this + 0x1380); + } + + bool is_carried(void) { + return *reinterpret_cast(this + 0x1396) || this->is_carried_deploy(); + } + + bool is_carried_deploy(void) { + return *reinterpret_cast(this + 0x1397); + } + + // Sentry + bool is_mini_sentry(void) { + return *reinterpret_cast(this + 0x1399); + } + + int get_building_level(void) { + return *reinterpret_cast(this + 0x1334); + } }; #endif diff --git a/classes/convar.hpp b/classes/convar.hpp index ec62c72..6ebcd65 100644 --- a/classes/convar.hpp +++ b/classes/convar.hpp @@ -3,14 +3,13 @@ class Convar { public: - void set_int(int value) { - *(int*)(this + 0x58) = value; - } - - int get_int() { - return *(int*)(this + 0x58); - } + void set_int(int value) { + *reinterpret_cast(this + 0x58) = value; + } + int get_int() { + return *reinterpret_cast(this + 0x58); + } }; #endif diff --git a/classes/entity.hpp b/classes/entity.hpp index 9d58e76..42e58ad 100644 --- a/classes/entity.hpp +++ b/classes/entity.hpp @@ -1,8 +1,7 @@ #ifndef ENTITY_HPP #define ENTITY_HPP -#include -#include +#include #include #include "../vec.hpp" @@ -11,23 +10,23 @@ // https://github.com/rei-2/Amalgam/blob/c1c6bf64d739538b48a301ddc5e1a988cb9b479c/Amalgam/src/SDK/Definitions/Definitions.h#L1032 enum class_id { - AMMO_OR_HEALTH_PACK = 1, - DISPENSER = 86, - SENTRY = 88, - TELEPORTER = 89, - ARROW = 122, - PLAYER = 247, - ROCKET = 264, - PILL_OR_STICKY = 217, - FLARE = 257, - CROSSBOW_BOLT = 259, - SNIPER_DOT = 118 + AMMO_OR_HEALTH_PACK = 1, + DISPENSER = 86, + SENTRY = 88, + TELEPORTER = 89, + ARROW = 122, + PLAYER = 247, + ROCKET = 264, + PILL_OR_STICKY = 217, + FLARE = 257, + CROSSBOW_BOLT = 259, + SNIPER_DOT = 118 }; enum pickup_type { - UNKNOWN, - MEDKIT, - AMMOPACK, + UNKNOWN, + MEDKIT, + AMMOPACK, }; enum entity_flags { @@ -65,118 +64,117 @@ enum entity_flags { }; class Entity { -public: - int get_owner_entity_handle(void) { - return *(int*)(this + 0x754); - } - - Entity* get_owner_entity(void) { - return entity_list->entity_from_handle(this->get_owner_entity_handle()); - } - - Vec3 get_origin(void) { - // x + 0x328, y + 0x332, z + 0x346 - return *(Vec3*)(this + 0x328); - } - - int get_ent_flags(void) { - return *(int*)(this + 0x460); - } - - // TODO: Substitute "void*" with real class type - void* get_networkable(void) { - return (void*)(this + 0x10); - } - - void* get_renderable(void) { - return (void*)(this + 0x8); - } - - int get_team(void) { - return *(int*)(this + 0xDC); - } - - int get_index(void) { - void* networkable = get_networkable(); - void** vtable = *(void***)networkable; - - int (*get_index_fn)(void*) = (int (*)(void*))vtable[9]; - - return get_index_fn(networkable); - } - - const char* get_model_name(void) { - uintptr_t base_class = *(uintptr_t*)(this + 0x88); - if (base_class == NULL) return ""; - - return (const char*)*(unsigned long*)(base_class + 0x8); - } - - enum pickup_type get_pickup_type(void) { - const char* model_name = get_model_name(); - - if (strstr(model_name, "models/items/ammopack")) { - return pickup_type::AMMOPACK; - } - - if (strstr(model_name, "models/items/medkit") || - strstr(model_name, "models/props_medieval/medieval_meat.mdl") || - strstr(model_name, "models/props_halloween/halloween_medkit") - ) - { - return pickup_type::MEDKIT; - } - - return pickup_type::UNKNOWN; - } - - bool is_dormant(void) { - void* networkable = get_networkable(); - void** vtable = *(void ***)networkable; - - bool (*is_dormant_fn)(void*) = (bool (*)(void*))vtable[8]; - - return is_dormant_fn(networkable); - } - - void* get_client_class(void) { - void* networkable = get_networkable(); - void** vtable = *(void ***)networkable; - - void* (*get_client_class_fn)(void*) = (void* (*)(void*))vtable[2]; - - return get_client_class_fn(networkable); - } - - int get_class_id(void) { - void* client_class = get_client_class(); - return *(int*)((unsigned long)(client_class) + 0x28); - } - - int get_tickbase(void) { - return *(int*)(this + 0x1718); - } - - void set_tickbase(int tickbase) { - *(int*)(this + 0x1718) = tickbase; - } - - - float get_simulation_time(void) { - return *(float*)(this + 0x98); - } - - bool is_building(void) { - switch (this->get_class_id()) { - case class_id::SENTRY: - case class_id::DISPENSER: - case class_id::TELEPORTER: - return true; - } - - return false; - } +public: + int get_owner_entity_handle(void) { + return *reinterpret_cast(this + 0x754); + } + + Entity *get_owner_entity(void) { + return entity_list->entity_from_handle(this->get_owner_entity_handle()); + } + + Vec3 get_origin(void) { + // x + 0x328, y + 0x332, z + 0x346 + return *reinterpret_cast(this + 0x328); + } + + int get_ent_flags(void) { + return *reinterpret_cast(this + 0x460); + } + + // TODO: Substitute "void*" with real class type + void *get_networkable(void) { + return (void *) (this + 0x10); + } + + void *get_renderable(void) { + return (void *) (this + 0x8); + } + + int get_team(void) { + return *reinterpret_cast(this + 0xDC); + } + + int get_index(void) { + void *networkable = get_networkable(); + void **vtable = *static_cast(networkable); + + int (*get_index_fn)(void *) = (int (*)(void *)) vtable[9]; + + return get_index_fn(networkable); + } + + const char *get_model_name(void) { + uintptr_t base_class = *reinterpret_cast(this + 0x88); + if (!base_class) return ""; + + return (const char *) *(unsigned long *) (base_class + 0x8); + } + + enum pickup_type get_pickup_type(void) { + const char *model_name = get_model_name(); + + if (strstr(model_name, "models/items/ammopack")) { + return pickup_type::AMMOPACK; + } + if (strstr(model_name, "models/items/medkit") || + strstr(model_name, "models/props_medieval/medieval_meat.mdl") || + strstr(model_name, "models/props_halloween/halloween_medkit") + ) { + return pickup_type::MEDKIT; + } + + return pickup_type::UNKNOWN; + } + + bool is_dormant(void) { + void *networkable = get_networkable(); + void **vtable = *static_cast(networkable); + + bool (*is_dormant_fn)(void *) = (bool (*)(void *)) vtable[8]; + + return is_dormant_fn(networkable); + } + + void *get_client_class(void) { + void *networkable = get_networkable(); + void **vtable = *static_cast(networkable); + + void * (*get_client_class_fn)(void *) = (void* (*)(void *)) vtable[2]; + + return get_client_class_fn(networkable); + } + + int get_class_id(void) { + void *client_class = get_client_class(); + return *reinterpret_cast(reinterpret_cast(client_class) + 0x28); + } + + int get_tickbase(void) { + return *reinterpret_cast(this + 0x1718); + } + + void set_tickbase(int tickbase) { + *reinterpret_cast(this + 0x1718) = tickbase; + } + + + float get_simulation_time(void) { + return *reinterpret_cast(this + 0x98); + } + + bool is_building(void) { + switch (this->get_class_id()) { + case class_id::SENTRY: + case class_id::DISPENSER: + case class_id::TELEPORTER: + return true; + default: return false; + } + + return false; + } }; #endif diff --git a/classes/keyvalues.hpp b/classes/keyvalues.hpp index f96b131..dbe1c47 100644 --- a/classes/keyvalues.hpp +++ b/classes/keyvalues.hpp @@ -4,46 +4,46 @@ #include enum types_t { - TYPE_NONE = 0, - TYPE_STRING, - TYPE_INT, - TYPE_FLOAT, - TYPE_PTR, - TYPE_WSTRING, - TYPE_COLOR, - TYPE_UINT64, - TYPE_NUMTYPES, + TYPE_NONE = 0, + TYPE_STRING, + TYPE_INT, + TYPE_FLOAT, + TYPE_PTR, + TYPE_WSTRING, + TYPE_COLOR, + TYPE_UINT64, + TYPE_NUMTYPES, }; class KeyValues; -static KeyValues* (*key_values_constructor_original)(void*, const char*); + +static KeyValues * (*key_values_constructor_original)(void *, const char *); class KeyValues { - KeyValues(const char* name) { - key_values_constructor_original(this, name); - } - - + KeyValues(const char *name) { + key_values_constructor_original(this, name); + } + private: - int m_iKeyName; - char* m_sValue; - wchar_t* m_wsValue; - - union { - int m_iValue; - float m_flValue; - void* m_pValue; - unsigned char m_Color[4]; - }; - - char m_iDataType; - char m_bHasEscapeSequences; - char m_bEvaluateConditionals; - char unused[1]; - - KeyValues* m_pPeer; - KeyValues* m_pSub; - KeyValues* m_pChain; + int m_iKeyName; + char *m_sValue; + wchar_t *m_wsValue; + + union { + int m_iValue; + float m_flValue; + void *m_pValue; + unsigned char m_Color[4]; + }; + + char m_iDataType; + char m_bHasEscapeSequences; + char m_bEvaluateConditionals; + char unused[1]; + + KeyValues *m_pPeer; + KeyValues *m_pSub; + KeyValues *m_pChain; }; #endif diff --git a/classes/material.hpp b/classes/material.hpp index 273684e..c9e244c 100644 --- a/classes/material.hpp +++ b/classes/material.hpp @@ -3,50 +3,50 @@ class Material { public: - void alpha_modulate(float alpha) { - void** vtable = *(void ***)this; + void alpha_modulate(float alpha) { + void **vtable = *reinterpret_cast(this); - void (*alpha_modulate_fn)(void*, float) = (void (*)(void*, float))vtable[27]; + void (*alpha_modulate_fn)(void *, float) = (void (*)(void *, float)) vtable[27]; - alpha_modulate_fn(this, alpha); - } - - void color_modulate(float r, float g, float b) { - void** vtable = *(void ***)this; + alpha_modulate_fn(this, alpha); + } - void (*color_modulate_fn)(void*, float, float, float) = (void (*)(void*, float, float, float))vtable[28]; + void color_modulate(float r, float g, float b) { + void **vtable = *reinterpret_cast(this); - color_modulate_fn(this, r, g, b); - } + void (*color_modulate_fn)(void *, float, float, float) = (void (*)(void *, float, float, float)) vtable[28]; - void set_material_flag(int flag, bool on) { - void** vtable = *(void ***)this; + color_modulate_fn(this, r, g, b); + } - void (*set_material_flag_fn)(void*, int, bool) = (void (*)(void*, int, bool))vtable[29]; - - set_material_flag_fn(this, flag, on); - } + void set_material_flag(int flag, bool on) { + void **vtable = *reinterpret_cast(this); - bool get_material_flag(int flag) { - void** vtable = *(void ***)this; + void (*set_material_flag_fn)(void *, int, bool) = (void (*)(void *, int, bool)) vtable[29]; - bool (*get_material_flag_fn)(void*, int) = (bool (*)(void*, int))vtable[30]; + set_material_flag_fn(this, flag, on); + } - return get_material_flag_fn(this, flag); - } + bool get_material_flag(int flag) { + void **vtable = *reinterpret_cast(this); + + bool (*get_material_flag_fn)(void *, int) = (bool (*)(void *, int)) vtable[30]; + + return get_material_flag_fn(this, flag); + } }; struct Material_t { - Material* m_pMaterial; + Material *m_pMaterial; - const char* m_sName; - const char* m_sVMT; - bool m_bLocked = false; + const char *m_sName; + const char *m_sVMT; + bool m_bLocked = false; - bool m_bStored = false; - void* m_phongtint = nullptr; //IMaterialVar - void* m_envmaptint = nullptr; //IMaterialVar - bool m_bInvertCull = false; + bool m_bStored = false; + void *m_phongtint = nullptr; //IMaterialVar + void *m_envmaptint = nullptr; //IMaterialVar + bool m_bInvertCull = false; }; #endif diff --git a/classes/player.hpp b/classes/player.hpp index 816b0fb..a8407a9 100644 --- a/classes/player.hpp +++ b/classes/player.hpp @@ -25,392 +25,391 @@ struct user_cmd; #define PLAYER_FLAG_BITS 32 enum { - CLASS_UNDEFINED = 0, - CLASS_SCOUT, - CLASS_SNIPER, - CLASS_SOLDIER, - CLASS_DEMOMAN, - CLASS_MEDIC, - CLASS_HEAVYWEAPONS, - CLASS_PYRO, - CLASS_SPY, - CLASS_ENGINEER + CLASS_UNDEFINED = 0, + CLASS_SCOUT, + CLASS_SNIPER, + CLASS_SOLDIER, + CLASS_DEMOMAN, + CLASS_MEDIC, + CLASS_HEAVYWEAPONS, + CLASS_PYRO, + CLASS_SPY, + CLASS_ENGINEER }; struct player_info { - char name[32]; - int user_id; - char guid[33]; - unsigned long friends_id; - char friends_name[32]; - bool fakeplayer; - bool ishltv; - unsigned long custom_files[4]; - unsigned char files_downloaded; + char name[32]; + int user_id; + char guid[33]; + unsigned long friends_id; + char friends_name[32]; + bool fakeplayer; + bool ishltv; + unsigned long custom_files[4]; + unsigned char files_downloaded; }; enum { - TF_COND_INVALID = -1, - TF_COND_AIMING = 0, // Sniper aiming, Heavy minigun. - TF_COND_ZOOMED = 1, - TF_COND_DISGUISING = 2, - TF_COND_DISGUISED = 3, - TF_COND_STEALTHED = 4, // Spy specific - TF_COND_INVULNERABLE = 5, - TF_COND_TELEPORTED = 6, - TF_COND_TAUNTING = 7, - TF_COND_INVULNERABLE_WEARINGOFF = 8, - TF_COND_STEALTHED_BLINK = 9, - TF_COND_SELECTED_TO_TELEPORT = 10, - TF_COND_CRITBOOSTED = 11, // DO NOT RE-USE THIS -- THIS IS FOR KRITZKRIEG AND REVENGE CRITS ONLY - TF_COND_TMPDAMAGEBONUS = 12, - TF_COND_FEIGN_DEATH = 13, - TF_COND_PHASE = 14, - TF_COND_STUNNED = 15, // Any type of stun. Check iStunFlags for more info. - TF_COND_OFFENSEBUFF = 16, - TF_COND_SHIELD_CHARGE = 17, - TF_COND_DEMO_BUFF = 18, - TF_COND_ENERGY_BUFF = 19, - TF_COND_RADIUSHEAL = 20, - TF_COND_HEALTH_BUFF = 21, - TF_COND_BURNING = 22, - TF_COND_HEALTH_OVERHEALED = 23, - TF_COND_URINE = 24, - TF_COND_BLEEDING = 25, - TF_COND_DEFENSEBUFF = 26, // 35% defense! No crit damage. - TF_COND_MAD_MILK = 27, - TF_COND_MEGAHEAL = 28, - TF_COND_REGENONDAMAGEBUFF = 29, - TF_COND_MARKEDFORDEATH = 30, - TF_COND_NOHEALINGDAMAGEBUFF = 31, - TF_COND_SPEED_BOOST = 32, // = 32 - TF_COND_CRITBOOSTED_PUMPKIN = 33, // Brandon hates bits - TF_COND_CRITBOOSTED_USER_BUFF = 34, - TF_COND_CRITBOOSTED_DEMO_CHARGE = 35, - TF_COND_SODAPOPPER_HYPE = 36, - TF_COND_CRITBOOSTED_FIRST_BLOOD = 37, // arena mode first blood - TF_COND_CRITBOOSTED_BONUS_TIME = 38, - TF_COND_CRITBOOSTED_CTF_CAPTURE = 39, - TF_COND_CRITBOOSTED_ON_KILL = 40, // =40. KGB, etc. - TF_COND_CANNOT_SWITCH_FROM_MELEE = 41, - TF_COND_DEFENSEBUFF_NO_CRIT_BLOCK = 42, // 35% defense! Still damaged by crits. - TF_COND_REPROGRAMMED = 43, // Bots only - TF_COND_CRITBOOSTED_RAGE_BUFF = 44, - TF_COND_DEFENSEBUFF_HIGH = 45, // 75% defense! Still damaged by crits. - TF_COND_SNIPERCHARGE_RAGE_BUFF = 46, // Sniper Rage - Charge time speed up - TF_COND_DISGUISE_WEARINGOFF = 47, // Applied for half-second post-disguise - TF_COND_MARKEDFORDEATH_SILENT = 48, // Sans sound - TF_COND_DISGUISED_AS_DISPENSER = 49, - TF_COND_SAPPED = 50, // =50. Bots only - TF_COND_INVULNERABLE_HIDE_UNLESS_DAMAGED = 51, - TF_COND_INVULNERABLE_USER_BUFF = 52, - TF_COND_HALLOWEEN_BOMB_HEAD = 53, - TF_COND_HALLOWEEN_THRILLER = 54, - TF_COND_RADIUSHEAL_ON_DAMAGE = 55, - TF_COND_CRITBOOSTED_CARD_EFFECT = 56, - TF_COND_INVULNERABLE_CARD_EFFECT = 57, - TF_COND_MEDIGUN_UBER_BULLET_RESIST = 58, - TF_COND_MEDIGUN_UBER_BLAST_RESIST = 59, - TF_COND_MEDIGUN_UBER_FIRE_RESIST = 60, // =60 - TF_COND_MEDIGUN_SMALL_BULLET_RESIST = 61, - TF_COND_MEDIGUN_SMALL_BLAST_RESIST = 62, - TF_COND_MEDIGUN_SMALL_FIRE_RESIST = 63, - TF_COND_STEALTHED_USER_BUFF = 64, // Any class can have this - TF_COND_MEDIGUN_DEBUFF = 65, - TF_COND_STEALTHED_USER_BUFF_FADING = 66, - TF_COND_BULLET_IMMUNE = 67, - TF_COND_BLAST_IMMUNE = 68, - TF_COND_FIRE_IMMUNE = 69, - TF_COND_PREVENT_DEATH = 70, // =70 - TF_COND_MVM_BOT_STUN_RADIOWAVE = 71, // Bots only - TF_COND_HALLOWEEN_SPEED_BOOST = 72, - TF_COND_HALLOWEEN_QUICK_HEAL = 73, - TF_COND_HALLOWEEN_GIANT = 74, - TF_COND_HALLOWEEN_TINY = 75, - TF_COND_HALLOWEEN_IN_HELL = 76, - TF_COND_HALLOWEEN_GHOST_MODE = 77, // =77 - TF_COND_MINICRITBOOSTED_ON_KILL = 78, - TF_COND_OBSCURED_SMOKE = 79, - TF_COND_PARACHUTE_ACTIVE = 80, // actively being used (not retracted) - TF_COND_BLASTJUMPING = 81, - TF_COND_HALLOWEEN_KART = 82, - TF_COND_HALLOWEEN_KART_DASH = 83, - TF_COND_BALLOON_HEAD = 84, // =84 larger head, lower-gravity-feeling jumps - TF_COND_MELEE_ONLY = 85, // =85 melee only - TF_COND_SWIMMING_CURSE = 86, // player movement become swimming movement - TF_COND_FREEZE_INPUT = 87, // freezes player input - TF_COND_HALLOWEEN_KART_CAGE = 88, // attach cage model to player while in kart - TF_COND_DONOTUSE_0 = 89, - TF_COND_RUNE_STRENGTH = 90, - TF_COND_RUNE_HASTE = 91, - TF_COND_RUNE_REGEN = 92, - TF_COND_RUNE_RESIST = 93, - TF_COND_RUNE_VAMPIRE = 94, - TF_COND_RUNE_REFLECT = 95, - TF_COND_RUNE_PRECISION = 96, - TF_COND_RUNE_AGILITY = 97, - TF_COND_GRAPPLINGHOOK = 98, - TF_COND_GRAPPLINGHOOK_SAFEFALL = 99, - TF_COND_GRAPPLINGHOOK_LATCHED = 100, - TF_COND_GRAPPLINGHOOK_BLEEDING = 101, - TF_COND_AFTERBURN_IMMUNE = 102, - TF_COND_RUNE_KNOCKOUT = 103, - TF_COND_RUNE_IMBALANCE = 104, - TF_COND_CRITBOOSTED_RUNE_TEMP = 105, - TF_COND_PASSTIME_INTERCEPTION = 106, - TF_COND_SWIMMING_NO_EFFECTS = 107, // =107_DNOC_FT - TF_COND_PURGATORY = 108, - TF_COND_RUNE_KING = 109, - TF_COND_RUNE_PLAGUE = 110, - TF_COND_RUNE_SUPERNOVA = 111, - TF_COND_PLAGUE = 112, - TF_COND_KING_BUFFED = 113, - TF_COND_TEAM_GLOWS = 114, // used to show team glows to living players - TF_COND_KNOCKED_INTO_AIR = 115, - TF_COND_COMPETITIVE_WINNER = 116, - TF_COND_COMPETITIVE_LOSER = 117, - TF_COND_HEALING_DEBUFF = 118, - TF_COND_PASSTIME_PENALTY_DEBUFF = 119, // when carrying the ball without any teammates nearby - TF_COND_GRAPPLED_TO_PLAYER = 120, - TF_COND_GRAPPLED_BY_PLAYER = 121, - TF_COND_PARACHUTE_DEPLOYED = 122, // activated at least once while player's been airborne, but not does mean it's active now (see TF_COND_PARACHUTE_ACTIVE) - TF_COND_GAS = 123, - TF_COND_BURNING_PYRO = 124, - TF_COND_ROCKETPACK = 125, - // Players who lose their footing have lessened friction and don't re-stick to the ground unless they're below a - // tf_movement_lost_footing_restick speed - TF_COND_LOST_FOOTING = 126, - // When in the air, slide up/along surfaces with momentum as if caught up in a... blast of air of some sort. - // Reduces air control as well. See tf_movement_aircurrent convars. Removed upon touching ground. - TF_COND_AIR_CURRENT = 127, - TF_COND_HALLOWEEN_HELL_HEAL = 128, - TF_COND_POWERUPMODE_DOMINANT = 129, - TF_COND_IMMUNE_TO_PUSHBACK = 130, - TF_COND_LAST + TF_COND_INVALID = -1, + TF_COND_AIMING = 0, // Sniper aiming, Heavy minigun. + TF_COND_ZOOMED = 1, + TF_COND_DISGUISING = 2, + TF_COND_DISGUISED = 3, + TF_COND_STEALTHED = 4, // Spy specific + TF_COND_INVULNERABLE = 5, + TF_COND_TELEPORTED = 6, + TF_COND_TAUNTING = 7, + TF_COND_INVULNERABLE_WEARINGOFF = 8, + TF_COND_STEALTHED_BLINK = 9, + TF_COND_SELECTED_TO_TELEPORT = 10, + TF_COND_CRITBOOSTED = 11, // DO NOT RE-USE THIS -- THIS IS FOR KRITZKRIEG AND REVENGE CRITS ONLY + TF_COND_TMPDAMAGEBONUS = 12, + TF_COND_FEIGN_DEATH = 13, + TF_COND_PHASE = 14, + TF_COND_STUNNED = 15, // Any type of stun. Check iStunFlags for more info. + TF_COND_OFFENSEBUFF = 16, + TF_COND_SHIELD_CHARGE = 17, + TF_COND_DEMO_BUFF = 18, + TF_COND_ENERGY_BUFF = 19, + TF_COND_RADIUSHEAL = 20, + TF_COND_HEALTH_BUFF = 21, + TF_COND_BURNING = 22, + TF_COND_HEALTH_OVERHEALED = 23, + TF_COND_URINE = 24, + TF_COND_BLEEDING = 25, + TF_COND_DEFENSEBUFF = 26, // 35% defense! No crit damage. + TF_COND_MAD_MILK = 27, + TF_COND_MEGAHEAL = 28, + TF_COND_REGENONDAMAGEBUFF = 29, + TF_COND_MARKEDFORDEATH = 30, + TF_COND_NOHEALINGDAMAGEBUFF = 31, + TF_COND_SPEED_BOOST = 32, // = 32 + TF_COND_CRITBOOSTED_PUMPKIN = 33, // Brandon hates bits + TF_COND_CRITBOOSTED_USER_BUFF = 34, + TF_COND_CRITBOOSTED_DEMO_CHARGE = 35, + TF_COND_SODAPOPPER_HYPE = 36, + TF_COND_CRITBOOSTED_FIRST_BLOOD = 37, // arena mode first blood + TF_COND_CRITBOOSTED_BONUS_TIME = 38, + TF_COND_CRITBOOSTED_CTF_CAPTURE = 39, + TF_COND_CRITBOOSTED_ON_KILL = 40, // =40. KGB, etc. + TF_COND_CANNOT_SWITCH_FROM_MELEE = 41, + TF_COND_DEFENSEBUFF_NO_CRIT_BLOCK = 42, // 35% defense! Still damaged by crits. + TF_COND_REPROGRAMMED = 43, // Bots only + TF_COND_CRITBOOSTED_RAGE_BUFF = 44, + TF_COND_DEFENSEBUFF_HIGH = 45, // 75% defense! Still damaged by crits. + TF_COND_SNIPERCHARGE_RAGE_BUFF = 46, // Sniper Rage - Charge time speed up + TF_COND_DISGUISE_WEARINGOFF = 47, // Applied for half-second post-disguise + TF_COND_MARKEDFORDEATH_SILENT = 48, // Sans sound + TF_COND_DISGUISED_AS_DISPENSER = 49, + TF_COND_SAPPED = 50, // =50. Bots only + TF_COND_INVULNERABLE_HIDE_UNLESS_DAMAGED = 51, + TF_COND_INVULNERABLE_USER_BUFF = 52, + TF_COND_HALLOWEEN_BOMB_HEAD = 53, + TF_COND_HALLOWEEN_THRILLER = 54, + TF_COND_RADIUSHEAL_ON_DAMAGE = 55, + TF_COND_CRITBOOSTED_CARD_EFFECT = 56, + TF_COND_INVULNERABLE_CARD_EFFECT = 57, + TF_COND_MEDIGUN_UBER_BULLET_RESIST = 58, + TF_COND_MEDIGUN_UBER_BLAST_RESIST = 59, + TF_COND_MEDIGUN_UBER_FIRE_RESIST = 60, // =60 + TF_COND_MEDIGUN_SMALL_BULLET_RESIST = 61, + TF_COND_MEDIGUN_SMALL_BLAST_RESIST = 62, + TF_COND_MEDIGUN_SMALL_FIRE_RESIST = 63, + TF_COND_STEALTHED_USER_BUFF = 64, // Any class can have this + TF_COND_MEDIGUN_DEBUFF = 65, + TF_COND_STEALTHED_USER_BUFF_FADING = 66, + TF_COND_BULLET_IMMUNE = 67, + TF_COND_BLAST_IMMUNE = 68, + TF_COND_FIRE_IMMUNE = 69, + TF_COND_PREVENT_DEATH = 70, // =70 + TF_COND_MVM_BOT_STUN_RADIOWAVE = 71, // Bots only + TF_COND_HALLOWEEN_SPEED_BOOST = 72, + TF_COND_HALLOWEEN_QUICK_HEAL = 73, + TF_COND_HALLOWEEN_GIANT = 74, + TF_COND_HALLOWEEN_TINY = 75, + TF_COND_HALLOWEEN_IN_HELL = 76, + TF_COND_HALLOWEEN_GHOST_MODE = 77, // =77 + TF_COND_MINICRITBOOSTED_ON_KILL = 78, + TF_COND_OBSCURED_SMOKE = 79, + TF_COND_PARACHUTE_ACTIVE = 80, // actively being used (not retracted) + TF_COND_BLASTJUMPING = 81, + TF_COND_HALLOWEEN_KART = 82, + TF_COND_HALLOWEEN_KART_DASH = 83, + TF_COND_BALLOON_HEAD = 84, // =84 larger head, lower-gravity-feeling jumps + TF_COND_MELEE_ONLY = 85, // =85 melee only + TF_COND_SWIMMING_CURSE = 86, // player movement become swimming movement + TF_COND_FREEZE_INPUT = 87, // freezes player input + TF_COND_HALLOWEEN_KART_CAGE = 88, // attach cage model to player while in kart + TF_COND_DONOTUSE_0 = 89, + TF_COND_RUNE_STRENGTH = 90, + TF_COND_RUNE_HASTE = 91, + TF_COND_RUNE_REGEN = 92, + TF_COND_RUNE_RESIST = 93, + TF_COND_RUNE_VAMPIRE = 94, + TF_COND_RUNE_REFLECT = 95, + TF_COND_RUNE_PRECISION = 96, + TF_COND_RUNE_AGILITY = 97, + TF_COND_GRAPPLINGHOOK = 98, + TF_COND_GRAPPLINGHOOK_SAFEFALL = 99, + TF_COND_GRAPPLINGHOOK_LATCHED = 100, + TF_COND_GRAPPLINGHOOK_BLEEDING = 101, + TF_COND_AFTERBURN_IMMUNE = 102, + TF_COND_RUNE_KNOCKOUT = 103, + TF_COND_RUNE_IMBALANCE = 104, + TF_COND_CRITBOOSTED_RUNE_TEMP = 105, + TF_COND_PASSTIME_INTERCEPTION = 106, + TF_COND_SWIMMING_NO_EFFECTS = 107, // =107_DNOC_FT + TF_COND_PURGATORY = 108, + TF_COND_RUNE_KING = 109, + TF_COND_RUNE_PLAGUE = 110, + TF_COND_RUNE_SUPERNOVA = 111, + TF_COND_PLAGUE = 112, + TF_COND_KING_BUFFED = 113, + TF_COND_TEAM_GLOWS = 114, // used to show team glows to living players + TF_COND_KNOCKED_INTO_AIR = 115, + TF_COND_COMPETITIVE_WINNER = 116, + TF_COND_COMPETITIVE_LOSER = 117, + TF_COND_HEALING_DEBUFF = 118, + TF_COND_PASSTIME_PENALTY_DEBUFF = 119, // when carrying the ball without any teammates nearby + TF_COND_GRAPPLED_TO_PLAYER = 120, + TF_COND_GRAPPLED_BY_PLAYER = 121, + TF_COND_PARACHUTE_DEPLOYED = 122, + // activated at least once while player's been airborne, but not does mean it's active now (see TF_COND_PARACHUTE_ACTIVE) + TF_COND_GAS = 123, + TF_COND_BURNING_PYRO = 124, + TF_COND_ROCKETPACK = 125, + // Players who lose their footing have lessened friction and don't re-stick to the ground unless they're below a + // tf_movement_lost_footing_restick speed + TF_COND_LOST_FOOTING = 126, + // When in the air, slide up/along surfaces with momentum as if caught up in a... blast of air of some sort. + // Reduces air control as well. See tf_movement_aircurrent convars. Removed upon touching ground. + TF_COND_AIR_CURRENT = 127, + TF_COND_HALLOWEEN_HELL_HEAL = 128, + TF_COND_POWERUPMODE_DOMINANT = 129, + TF_COND_IMMUNE_TO_PUSHBACK = 130, + TF_COND_LAST }; //Original of a hooked class function -static bool (*in_cond_original)(void*, int); +static bool (*in_cond_original)(void *, int); //TODO/NOTE: Something useful would be a network variable helper. // There are a lot of magical offsets to specific structures, and those offsets have a string key associated with them. class Player : public Entity { public: + int get_weapon_handle(void) { + return *reinterpret_cast(this + 0x11D0); + } + + Weapon *get_weapon(void) { + return (Weapon *) entity_list->entity_from_handle(get_weapon_handle()); + } + + bool is_friend(void) { + player_info pinfo{}; + if (!engine->get_player_info(this->get_index(), &pinfo)) return false; + if (pinfo.friends_id == 0) return false; //bot usually + + return steam_friends->is_friend(pinfo.friends_id); + } + + int get_health(void) { + return *reinterpret_cast(this + 0xD4); + } + + int get_max_health(void) { + return *reinterpret_cast(this + 0x1DF8); + } + + int get_default_fov(void) { + return *reinterpret_cast(this + 0x15E4); + } + + int get_fov(void) { + return *reinterpret_cast(this + 0x15DC); + } + + void set_head_size(float size) { + *reinterpret_cast(this + 0x39D8) = size; + } + + void set_torso_length(float length) { + *reinterpret_cast(this + 0x39DC) = length; + } + + void set_taunt_cam(bool value) { + *reinterpret_cast(this + 0x2414) = value; + } + + bool get_lifestate(void) { + return *reinterpret_cast(this + 0x746); + } + + Vec3 get_shoot_pos(void) { + void **vtable = *reinterpret_cast(this); + + Vec3 (*get_shoot_pos_fn)(void *) = (Vec3 (*)(void *)) vtable[303]; + + return get_shoot_pos_fn(this); + } + + int get_tf_class(void) { + return *reinterpret_cast(this + 0x1BA0); + } + + Vec3 get_bone_pos(int bone_num) { + // 128 bones, 3x4 matrix + float bone_to_world_out[128][3][4]; + if (this->setup_bones(bone_to_world_out, 128, 0x100, this->get_simulation_time())) { + // Saw this in the source leak, don't know how it works + return (Vec3){ + bone_to_world_out[bone_num][0][3], bone_to_world_out[bone_num][1][3], bone_to_world_out[bone_num][2][3] + }; + } + + return (Vec3){0.0f, 0.0f, 0.0f}; + } + + int get_head_bone(void) { + switch (this->get_tf_class()) { + case CLASS_SCOUT: + case CLASS_PYRO: + case CLASS_SPY: + case CLASS_MEDIC: + case CLASS_HEAVYWEAPONS: + case CLASS_SNIPER: + case CLASS_SOLDIER: + return 6; + case CLASS_DEMOMAN: + return 16; + case CLASS_ENGINEER: + return 8; + default: return 0; + } + } + + int setup_bones(void *bone_to_world_out, int max_bones, int bone_mask, float current_time) { + void **vtable = *reinterpret_cast(this); + + int (*setup_bones_fn)(void *, void *, int, int, float) = (int (*)(void *, void *, int, int, float)) vtable[96]; + + return setup_bones_fn(this, bone_to_world_out, max_bones, bone_mask, current_time); + } - int get_weapon_handle(void) { - return *(int*)(this + 0x11D0); - } - - Weapon* get_weapon(void) { - return (Weapon*)entity_list->entity_from_handle(get_weapon_handle()); - } - - bool is_friend(void) { - player_info pinfo; - if (!engine->get_player_info(this->get_index(), &pinfo)) return false; - if (pinfo.friends_id == 0) return false; //bot usually - - return steam_friends->is_friend(pinfo.friends_id); - } - - int get_health(void) { - return *(int*)(this + 0xD4); - } - - int get_max_health(void) { - return *(int*)(this + 0x1DF8); - } - - int get_default_fov(void) { - return *(int*)(this + 0x15E4); - } - - int get_fov(void) { - return *(int*)(this + 0x15DC); - } - - void set_head_size(float size) { - *(float*)(this + 0x39D8) = size; - } - - void set_torso_length(float length) { - *(float*)(this + 0x39DC) = length; - } - - void set_taunt_cam(bool value) { - *(bool*)(this + 0x2414) = value; - } - - bool get_lifestate(void) { - return *(bool*)(this + 0x746); - } - - Vec3 get_shoot_pos(void) { - void** vtable = *(void ***)this; - - Vec3 (*get_shoot_pos_fn)(void*) = (Vec3 (*)(void*))vtable[303]; - - return get_shoot_pos_fn(this); - } - - int get_tf_class(void) { - return *(int*)(this + 0x1BA0); - } - - Vec3 get_bone_pos(int bone_num) { - // 128 bones, 3x4 matrix - float bone_to_world_out[128][3][4]; - if (this->setup_bones(bone_to_world_out, 128, 0x100, this->get_simulation_time())) { - // Saw this in the source leak, don't know how it works - return (Vec3){bone_to_world_out[bone_num][0][3], bone_to_world_out[bone_num][1][3], bone_to_world_out[bone_num][2][3]}; - } - - return (Vec3){0.0f, 0.0f, 0.0f}; - } - - int get_head_bone(void) { - switch (this->get_tf_class()) { - case CLASS_SCOUT: - case CLASS_PYRO: - case CLASS_SPY: - case CLASS_MEDIC: - case CLASS_HEAVYWEAPONS: - case CLASS_SNIPER: - case CLASS_SOLDIER: - return 6; - case CLASS_DEMOMAN: - return 16; - case CLASS_ENGINEER: - return 8; - } - - return 0; - } - - int setup_bones(void *bone_to_world_out, int max_bones, int bone_mask, float current_time) { - void** vtable = *(void ***)this; - - int (*setup_bones_fn)(void*, void*, int, int, float) = (int (*)(void*, void*, int, int, float))vtable[96]; - - return setup_bones_fn(this, bone_to_world_out, max_bones, bone_mask, current_time); - } - - void set_thirdperson(bool value) { - *(bool*)(this + 0x240C) = value; - } - - void switch_thirdperson(void) { - void** vtable = *(void ***)this; - - void (*switch_thirdperson_fn)(void*) = (void (*)(void*))vtable[256]; - - return switch_thirdperson_fn(this); - } - - bool is_thirdperson(void) { - return *(bool*)(this + 0x240C); - } - - void* get_shared(void) { - return (void*)(this + 0x1E78); - } - - bool in_cond(int condition) { - return in_cond_original(get_shared(), condition); - } - - bool is_scoped(void) { - return in_cond_original(get_shared(), TF_COND_ZOOMED); - } - - bool is_ducking(void) { - return this->get_flags() & FL_DUCKING; - } - - bool is_invulnerable(void) { - if (this->in_cond(TF_COND_INVULNERABLE) || - //this->in_cond(TF_COND_INVULNERABLE_USER_BUFF) || - this->in_cond(TF_COND_INVULNERABLE_WEARINGOFF) || - this->in_cond(TF_COND_INVULNERABLE_CARD_EFFECT) || - this->in_cond(TF_COND_INVULNERABLE_HIDE_UNLESS_DAMAGED) || - this->in_cond(TF_COND_PHASE)) - { - return true; - } - - return false; - } - - int get_ground_entity_handle(void) { - return *(int*)(this + 0x31C); - } - - Entity* get_ground_entity(void) { - return entity_list->entity_from_handle(this->get_ground_entity_handle()); - } - - int get_flags(void) { - return *(int*)(this + 0x460); - } - - float get_fov_time(void) { - return *(float*)(this + 0x15E0); - } - - float get_next_attack(void) { - return *(float*)(this + 0x1088); - } - - bool can_shoot(Player* target_player) { - Weapon* weapon = this->get_weapon(); - if (!weapon) - return false; - - if (attribute_manager->attrib_hook_value(0, "no_attack", this)) - return false; - - if (!this->is_scoped() && weapon->get_def_id() == Sniper_m_TheMachina) - return false; - - // Can we headshot? Is it advantageous to headshot? - // If not, maybe it would be better to not shoot at all. - if (weapon->is_headshot_weapon()) { - if (this->get_tf_class() == CLASS_SPY) { - if (weapon->can_ambassador_headshot()) { - return true; - } else { - return false; - } - } - - if (this->get_tf_class() == CLASS_SNIPER) { - if (this->is_scoped()) { - float charge_time = (this->get_tickbase() * TICK_INTERVAL) - this->get_fov_time(); - if (target_player->get_health() <= 50 || charge_time >= 0.2f) { - return true; - } else { - return false; - } - } - } - } - - return true; - } - - user_cmd* get_current_cmd(void) { - return (user_cmd*)*(void**)(this + (1628 - 8)); - } - - void set_current_cmd(user_cmd* user_cmd) { - *(void**)(this + (1628 - 8)) = user_cmd; - } - - Entity* to_entity(void) { - return (Entity*)this; - } + void set_thirdperson(bool value) { + *reinterpret_cast(this + 0x240C) = value; + } + + void switch_thirdperson(void) { + void **vtable = *reinterpret_cast(this); + + void (*switch_thirdperson_fn)(void *) = (void (*)(void *)) vtable[256]; + + return switch_thirdperson_fn(this); + } + + bool is_thirdperson(void) { + return *reinterpret_cast(this + 0x240C); + } + + void *get_shared(void) { + return this + 0x1E78; + } + + bool in_cond(int condition) { + return in_cond_original(get_shared(), condition); + } + + bool is_scoped(void) { + return in_cond_original(get_shared(), TF_COND_ZOOMED); + } + + bool is_ducking(void) { + return this->get_flags() & FL_DUCKING; + } + + bool is_invulnerable(void) { + if (this->in_cond(TF_COND_INVULNERABLE) || + //this->in_cond(TF_COND_INVULNERABLE_USER_BUFF) || + this->in_cond(TF_COND_INVULNERABLE_WEARINGOFF) || + this->in_cond(TF_COND_INVULNERABLE_CARD_EFFECT) || + this->in_cond(TF_COND_INVULNERABLE_HIDE_UNLESS_DAMAGED) || + this->in_cond(TF_COND_PHASE)) { + return true; + } + + return false; + } + + int get_ground_entity_handle(void) { + return *reinterpret_cast(this + 0x31C); + } + + Entity *get_ground_entity(void) { + return entity_list->entity_from_handle(this->get_ground_entity_handle()); + } + + int get_flags(void) { + return *reinterpret_cast(this + 0x460); + } + + float get_fov_time(void) { + return *reinterpret_cast(this + 0x15E0); + } + + float get_next_attack(void) { + return *reinterpret_cast(this + 0x1088); + } + + bool can_shoot(Player *target_player) { + Weapon *weapon = this->get_weapon(); + if (!weapon) + return false; + + if (attribute_manager->attrib_hook_value(0, "no_attack", this)) + return false; + + if (!this->is_scoped() && weapon->get_def_id() == Sniper_m_TheMachina) + return false; + + // Can we headshot? Is it advantageous to headshot? + // If not, maybe it would be better to not shoot at all. + if (weapon->is_headshot_weapon()) { + if (this->get_tf_class() == CLASS_SPY) { + if (weapon->can_ambassador_headshot()) { + return true; + } else { + return false; + } + } + + if (this->get_tf_class() == CLASS_SNIPER) { + if (this->is_scoped()) { + if (const float charge_time = (this->get_tickbase() * TICK_INTERVAL) - this->get_fov_time(); + target_player->get_health() <= 50 || charge_time >= 0.2f) { + return true; + } else { + return false; + } + } + } + } + + return true; + } + + user_cmd *get_current_cmd(void) { + return static_cast(*reinterpret_cast(this + (1628 - 8))); + } + + void set_current_cmd(user_cmd *user_cmd) { + *reinterpret_cast(this + (1628 - 8)) = user_cmd; + } + + Entity *to_entity(void) { + return this; + } }; #endif - diff --git a/classes/sniper_dot.hpp b/classes/sniper_dot.hpp index 6303a15..42d7593 100644 --- a/classes/sniper_dot.hpp +++ b/classes/sniper_dot.hpp @@ -1,12 +1,11 @@ #ifndef SNIPER_DOT_HPP #define SNIPER_DOT_HPP -class SniperDot { +class SniperDot { public: - float get_charge_start_time(void) { - return *(float*)(this + 0x7E0); - } + float get_charge_start_time(void) { + return *reinterpret_cast(this + 0x7E0); + } }; #endif - diff --git a/classes/weapon.hpp b/classes/weapon.hpp index 59edc3e..4412188 100644 --- a/classes/weapon.hpp +++ b/classes/weapon.hpp @@ -9,865 +9,860 @@ //https://github.com/Fedoraware/Fedoraware/blob/888d9338dbf08f6c55816c86d5887dd58cc28d98/Fedoraware/Fedoraware-TF2/src/SDK/Includes/Enums.h#L1081 enum { - Scout_m_Scattergun = 13, - Scout_m_ScattergunR = 200, - Scout_m_ForceANature = 45, - Scout_m_TheShortstop = 220, - Scout_m_TheSodaPopper = 448, - Scout_m_FestiveScattergun = 669, - Scout_m_BabyFacesBlaster = 772, - Scout_m_SilverBotkillerScattergunMkI = 799, - Scout_m_GoldBotkillerScattergunMkI = 808, - Scout_m_RustBotkillerScattergunMkI = 888, - Scout_m_BloodBotkillerScattergunMkI = 897, - Scout_m_CarbonadoBotkillerScattergunMkI = 906, - Scout_m_DiamondBotkillerScattergunMkI = 915, - Scout_m_SilverBotkillerScattergunMkII = 964, - Scout_m_GoldBotkillerScattergunMkII = 973, - Scout_m_FestiveForceANature = 1078, - Scout_m_TheBackScatter = 1103, - Scout_m_NightTerror = 15002, - Scout_m_TartanTorpedo = 15015, - Scout_m_CountryCrusher = 15021, - Scout_m_BackcountryBlaster = 15029, - Scout_m_SpruceDeuce = 15036, - Scout_m_CurrentEvent = 15053, - Scout_m_MacabreWeb = 15065, - Scout_m_Nutcracker = 15069, - Scout_m_BlueMew = 15106, - Scout_m_FlowerPower = 15107, - Scout_m_ShottoHell = 15108, - Scout_m_CoffinNail = 15131, - Scout_m_KillerBee = 15151, - Scout_m_Corsair = 15157, - Scout_s_ScoutsPistol = 23, - Scout_s_PistolR = 209, - Scout_s_BonkAtomicPunch = 46, - Scout_s_VintageLugermorph = 160, - Scout_s_CritaCola = 163, - Scout_s_MadMilk = 222, - Scout_s_Lugermorph = 294, - Scout_s_TheWinger = 449, - Scout_s_PrettyBoysPocketPistol = 773, - Scout_s_TheFlyingGuillotine = 812, - Scout_s_TheFlyingGuillotineG = 833, - Scout_s_MutatedMilk = 1121, - Scout_s_FestiveBonk = 1145, - Scout_s_RedRockRoscoe = 15013, - Scout_s_HomemadeHeater = 15018, - Scout_s_HickoryHolepuncher = 15035, - Scout_s_LocalHero = 15041, - Scout_s_BlackDahlia = 15046, - Scout_s_SandstoneSpecial = 15056, - Scout_s_MacabreWeb = 15060, - Scout_s_Nutcracker = 15061, - Scout_s_BlueMew = 15100, - Scout_s_BrainCandy = 15101, - Scout_s_ShottoHell = 15102, - Scout_s_DressedToKill = 15126, - Scout_s_Blitzkrieg = 15148, - Scout_s_TheCAPPER = 30666, - Scout_t_Bat = 0, - Scout_t_BatR = 190, - Scout_t_TheSandman = 44, - Scout_t_TheHolyMackerel = 221, - Scout_t_TheCandyCane = 317, - Scout_t_TheBostonBasher = 325, - Scout_t_SunonaStick = 349, - Scout_t_TheFanOWar = 355, - Scout_t_TheAtomizer = 450, - Scout_t_ThreeRuneBlade = 452, - Scout_t_TheConscientiousObjector = 474, - Scout_t_UnarmedCombat = 572, - Scout_t_TheWrapAssassin = 648, - Scout_t_FestiveBat = 660, - Scout_t_TheFreedomStaff = 880, - Scout_t_TheBatOuttaHell = 939, - Scout_t_TheMemoryMaker = 954, - Scout_t_FestiveHolyMackerel = 999, - Scout_t_TheHamShank = 1013, - Scout_t_TheNecroSmasher = 1123, - Scout_t_TheCrossingGuard = 1127, - Scout_t_Batsaber = 30667, - Scout_t_PrinnyMachete = 30758, - Soldier_m_RocketLauncher = 18, - Soldier_m_RocketLauncherR = 205, - Soldier_m_TheDirectHit = 127, - Soldier_m_TheBlackBox = 228, - Soldier_m_RocketJumper = 237, - Soldier_m_TheLibertyLauncher = 414, - Soldier_m_TheCowMangler5000 = 441, - Soldier_m_TheOriginal = 513, - Soldier_m_FestiveRocketLauncher = 658, - Soldier_m_TheBeggarsBazooka = 730, - Soldier_m_SilverBotkillerRocketLauncherMkI = 800, - Soldier_m_GoldBotkillerRocketLauncherMkI = 809, - Soldier_m_RustBotkillerRocketLauncherMkI = 889, - Soldier_m_BloodBotkillerRocketLauncherMkI = 898, - Soldier_m_CarbonadoBotkillerRocketLauncherMkI = 907, - Soldier_m_DiamondBotkillerRocketLauncherMkI = 916, - Soldier_m_SilverBotkillerRocketLauncherMkII = 965, - Soldier_m_GoldBotkillerRocketLauncherMkII = 974, - Soldier_m_FestiveBlackBox = 1085, - Soldier_m_TheAirStrike = 1104, - Soldier_m_WoodlandWarrior = 15006, - Soldier_m_SandCannon = 15014, - Soldier_m_AmericanPastoral = 15028, - Soldier_m_SmalltownBringdown = 15043, - Soldier_m_ShellShocker = 15052, - Soldier_m_AquaMarine = 15057, - Soldier_m_Autumn = 15081, - Soldier_m_BlueMew = 15104, - Soldier_m_BrainCandy = 15105, - Soldier_m_CoffinNail = 15129, - Soldier_m_HighRollers = 15130, - Soldier_m_Warhawk = 15150, - Soldier_s_SoldiersShotgun = 10, - Soldier_s_ShotgunR = 199, - Soldier_s_TheBuffBanner = 129, - Soldier_s_Gunboats = 133, - Soldier_s_TheBattalionsBackup = 226, - Soldier_s_TheConcheror = 354, - Soldier_s_TheReserveShooter = 415, - Soldier_s_TheRighteousBison = 442, - Soldier_s_TheMantreads = 444, - Soldier_s_FestiveBuffBanner = 1001, - Soldier_s_TheBASEJumper = 1101, - Soldier_s_FestiveShotgun = 1141, - Soldier_s_PanicAttack = 1153, - Soldier_s_BackwoodsBoomstick = 15003, - Soldier_s_RusticRuiner = 15016, - Soldier_s_CivicDuty = 15044, - Soldier_s_LightningRod = 15047, - Soldier_s_Autumn = 15085, - Soldier_s_FlowerPower = 15109, - Soldier_s_CoffinNail = 15132, - Soldier_s_DressedtoKill = 15133, - Soldier_s_RedBear = 15152, - Soldier_t_Shovel = 6, - Soldier_t_ShovelR = 196, - Soldier_t_TheEqualizer = 128, - Soldier_t_ThePainTrain = 154, - Soldier_t_TheHalfZatoichi = 357, - Soldier_t_TheMarketGardener = 416, - Soldier_t_TheDisciplinaryAction = 447, - Soldier_t_TheConscientiousObjector = 474, - Soldier_t_TheEscapePlan = 775, - Soldier_t_TheFreedomStaff = 880, - Soldier_t_TheBatOuttaHell = 939, - Soldier_t_TheMemoryMaker = 954, - Soldier_t_TheHamShank = 1013, - Soldier_t_TheNecroSmasher = 1123, - Soldier_t_TheCrossingGuard = 1127, - Soldier_t_PrinnyMachete = 30758, - Pyro_m_FlameThrower = 21, - Pyro_m_FlameThrowerR = 208, - Pyro_m_TheBackburner = 40, - Pyro_m_TheDegreaser = 215, - Pyro_m_ThePhlogistinator = 594, - Pyro_m_FestiveFlameThrower = 659, - Pyro_m_TheRainblower = 741, - Pyro_m_SilverBotkillerFlameThrowerMkI = 798, - Pyro_m_GoldBotkillerFlameThrowerMkI = 807, - Pyro_m_RustBotkillerFlameThrowerMkI = 887, - Pyro_m_BloodBotkillerFlameThrowerMkI = 896, - Pyro_m_CarbonadoBotkillerFlameThrowerMkI = 905, - Pyro_m_DiamondBotkillerFlameThrowerMkI = 914, - Pyro_m_SilverBotkillerFlameThrowerMkII = 963, - Pyro_m_GoldBotkillerFlameThrowerMkII = 972, - Pyro_m_FestiveBackburner = 1146, - Pyro_m_DragonsFury = 1178, - Pyro_m_ForestFire = 15005, - Pyro_m_BarnBurner = 15017, - Pyro_m_BovineBlazemaker = 15030, - Pyro_m_EarthSkyandFire = 15034, - Pyro_m_FlashFryer = 15049, - Pyro_m_TurbineTorcher = 15054, - Pyro_m_Autumn = 15066, - Pyro_m_PumpkinPatch = 15067, - Pyro_m_Nutcracker = 15068, - Pyro_m_Balloonicorn = 15089, - Pyro_m_Rainbow = 15090, - Pyro_m_CoffinNail = 15115, - Pyro_m_Warhawk = 15141, - Pyro_m_NostromoNapalmer = 30474, - Pyro_s_PyrosShotgun = 12, - Pyro_s_ShotgunR = 199, - Pyro_s_TheFlareGun = 39, - Pyro_s_TheDetonator = 351, - Pyro_s_TheReserveShooter = 415, - Pyro_s_TheManmelter = 595, - Pyro_s_TheScorchShot = 740, - Pyro_s_FestiveFlareGun = 1081, - Pyro_s_FestiveShotgun = 1141, - Pyro_s_PanicAttack = 1153, - Pyro_s_ThermalThruster = 1179, - Pyro_s_GasPasser = 1180, - Pyro_s_BackwoodsBoomstick = 15003, - Pyro_s_RusticRuiner = 15016, - Pyro_s_CivicDuty = 15044, - Pyro_s_LightningRod = 15047, - Pyro_s_Autumn = 15085, - Pyro_s_FlowerPower = 15109, - Pyro_s_CoffinNail = 15132, - Pyro_s_DressedtoKill = 15133, - Pyro_s_RedBear = 15152, - Pyro_t_FireAxe = 2, - Pyro_t_FireAxeR = 192, - Pyro_t_TheAxtinguisher = 38, - Pyro_t_Homewrecker = 153, - Pyro_t_ThePowerjack = 214, - Pyro_t_TheBackScratcher = 326, - Pyro_t_SharpenedVolcanoFragment = 348, - Pyro_t_ThePostalPummeler = 457, - Pyro_t_TheMaul = 466, - Pyro_t_TheConscientiousObjector = 474, - Pyro_t_TheThirdDegree = 593, - Pyro_t_TheLollichop = 739, - Pyro_t_NeonAnnihilator = 813, - Pyro_t_NeonAnnihilatorG = 834, - Pyro_t_TheFreedomStaff = 880, - Pyro_t_TheBatOuttaHell = 939, - Pyro_t_TheMemoryMaker = 954, - Pyro_t_TheFestiveAxtinguisher = 1000, - Pyro_t_TheHamShank = 1013, - Pyro_t_TheNecroSmasher = 1123, - Pyro_t_TheCrossingGuard = 1127, - Pyro_t_HotHand = 1181, - Pyro_t_PrinnyMachete = 30758, - Demoman_m_GrenadeLauncher = 19, - Demoman_m_GrenadeLauncherR = 206, - Demoman_m_TheLochnLoad = 308, - Demoman_m_AliBabasWeeBooties = 405, - Demoman_m_TheBootlegger = 608, - Demoman_m_TheLooseCannon = 996, - Demoman_m_FestiveGrenadeLauncher = 1007, - Demoman_m_TheBASEJumper = 1101, - Demoman_m_TheIronBomber = 1151, - Demoman_m_Autumn = 15077, - Demoman_m_MacabreWeb = 15079, - Demoman_m_Rainbow = 15091, - Demoman_m_SweetDreams = 15092, - Demoman_m_CoffinNail = 15116, - Demoman_m_TopShelf = 15117, - Demoman_m_Warhawk = 15142, - Demoman_m_ButcherBird = 15158, - Demoman_s_StickybombLauncher = 20, - Demoman_s_StickybombLauncherR = 207, - Demoman_s_TheScottishResistance = 130, - Demoman_s_TheCharginTarge = 131, - Demoman_s_StickyJumper = 265, - Demoman_s_TheSplendidScreen = 406, - Demoman_s_FestiveStickybombLauncher = 661, - Demoman_s_SilverBotkillerStickybombLauncherMkI = 797, - Demoman_s_GoldBotkillerStickybombLauncherMkI = 806, - Demoman_s_RustBotkillerStickybombLauncherMkI = 886, - Demoman_s_BloodBotkillerStickybombLauncherMkI = 895, - Demoman_s_CarbonadoBotkillerStickybombLauncherMkI = 904, - Demoman_s_DiamondBotkillerStickybombLauncherMkI = 913, - Demoman_s_SilverBotkillerStickybombLauncherMkII = 962, - Demoman_s_GoldBotkillerStickybombLauncherMkII = 971, - Demoman_s_TheTideTurner = 1099, - Demoman_s_FestiveTarge = 1144, - Demoman_s_TheQuickiebombLauncher = 1150, - Demoman_s_SuddenFlurry = 15009, - Demoman_s_CarpetBomber = 15012, - Demoman_s_BlastedBombardier = 15024, - Demoman_s_RooftopWrangler = 15038, - Demoman_s_LiquidAsset = 15045, - Demoman_s_PinkElephant = 15048, - Demoman_s_Autumn = 15082, - Demoman_s_PumpkinPatch = 15083, - Demoman_s_MacabreWeb = 15084, - Demoman_s_SweetDreams = 15113, - Demoman_s_CoffinNail = 15137, - Demoman_s_DressedtoKill = 15138, - Demoman_s_Blitzkrieg = 15155, - Demoman_t_Bottle = 1, - Demoman_t_BottleR = 191, - Demoman_t_TheEyelander = 132, - Demoman_t_ThePainTrain = 154, - Demoman_t_TheScotsmansSkullcutter = 172, - Demoman_t_HorselessHeadlessHorsemannsHeadtaker = 266, - Demoman_t_UllapoolCaber = 307, - Demoman_t_TheClaidheamhMor = 327, - Demoman_t_TheHalfZatoichi = 357, - Demoman_t_ThePersianPersuader = 404, - Demoman_t_TheConscientiousObjector = 474, - Demoman_t_NessiesNineIron = 482, - Demoman_t_TheScottishHandshake = 609, - Demoman_t_TheFreedomStaff = 880, - Demoman_t_TheBatOuttaHell = 939, - Demoman_t_TheMemoryMaker = 954, - Demoman_t_TheHamShank = 1013, - Demoman_t_FestiveEyelander = 1082, - Demoman_t_TheNecroSmasher = 1123, - Demoman_t_TheCrossingGuard = 1127, - Demoman_t_PrinnyMachete = 30758, - Heavy_m_Minigun = 15, - Heavy_m_MinigunR = 202, - Heavy_m_Natascha = 41, - Heavy_m_IronCurtain = 298, - Heavy_m_TheBrassBeast = 312, - Heavy_m_Tomislav = 424, - Heavy_m_FestiveMinigun = 654, - Heavy_m_SilverBotkillerMinigunMkI = 793, - Heavy_m_GoldBotkillerMinigunMkI = 802, - Heavy_m_TheHuoLongHeater = 811, - Heavy_m_TheHuoLongHeaterG = 832, - Heavy_m_Deflector_mvm = 850, - Heavy_m_RustBotkillerMinigunMkI = 882, - Heavy_m_BloodBotkillerMinigunMkI = 891, - Heavy_m_CarbonadoBotkillerMinigunMkI = 900, - Heavy_m_DiamondBotkillerMinigunMkI = 909, - Heavy_m_SilverBotkillerMinigunMkII = 958, - Heavy_m_GoldBotkillerMinigunMkII = 967, - Heavy_m_KingoftheJungle = 15004, - Heavy_m_IronWood = 15020, - Heavy_m_AntiqueAnnihilator = 15026, - Heavy_m_WarRoom = 15031, - Heavy_m_CitizenPain = 15040, - Heavy_m_BrickHouse = 15055, - Heavy_m_MacabreWeb = 15086, - Heavy_m_PumpkinPatch = 15087, - Heavy_m_Nutcracker = 15088, - Heavy_m_BrainCandy = 15098, - Heavy_m_MisterCuddles = 15099, - Heavy_m_CoffinNail = 15123, - Heavy_m_DressedtoKill = 15124, - Heavy_m_TopShelf = 15125, - Heavy_m_ButcherBird = 15147, - Heavy_s_HeavysShotgun = 11, - Heavy_s_ShotgunR = 199, - Heavy_s_Sandvich = 42, - Heavy_s_TheDalokohsBar = 159, - Heavy_s_TheBuffaloSteakSandvich = 311, - Heavy_s_TheFamilyBusiness = 425, - Heavy_s_Fishcake = 433, - Heavy_s_RoboSandvich = 863, - Heavy_s_FestiveSandvich = 1002, - Heavy_s_FestiveShotgun = 1141, - Heavy_s_PanicAttack = 1153, - Heavy_s_SecondBanana = 1190, - Heavy_s_BackwoodsBoomstick = 15003, - Heavy_s_RusticRuiner = 15016, - Heavy_s_CivicDuty = 15044, - Heavy_s_LightningRod = 15047, - Heavy_s_Autumn = 15085, - Heavy_s_FlowerPower = 15109, - Heavy_s_CoffinNail = 15132, - Heavy_s_DressedtoKill = 15133, - Heavy_s_RedBear = 15152, - Heavy_t_Fists = 5, - Heavy_t_FistsR = 195, - Heavy_t_TheKillingGlovesofBoxing = 43, - Heavy_t_GlovesofRunningUrgently = 239, - Heavy_t_WarriorsSpirit = 310, - Heavy_t_FistsofSteel = 331, - Heavy_t_TheEvictionNotice = 426, - Heavy_t_TheConscientiousObjector = 474, - Heavy_t_ApocoFists = 587, - Heavy_t_TheHolidayPunch = 656, - Heavy_t_TheFreedomStaff = 880, - Heavy_t_TheBatOuttaHell = 939, - Heavy_t_TheMemoryMaker = 954, - Heavy_t_TheHamShank = 1013, - Heavy_t_FestiveGlovesofRunningUrgently = 1084, - Heavy_t_TheBreadBite = 1100, - Heavy_t_TheNecroSmasher = 1123, - Heavy_t_TheCrossingGuard = 1127, - Heavy_t_GlovesofRunningUrgentlyMvM = 1184, - Heavy_t_PrinnyMachete = 30758, - Engi_m_EngineersShotgun = 9, - Engi_m_ShotgunR = 199, - Engi_m_TheFrontierJustice = 141, - Engi_m_TheWidowmaker = 527, - Engi_m_ThePomson6000 = 588, - Engi_m_TheRescueRanger = 997, - Engi_m_FestiveFrontierJustice = 1004, - Engi_m_FestiveShotgun = 1141, - Engi_m_PanicAttack = 1153, - Engi_m_BackwoodsBoomstick = 15003, - Engi_m_RusticRuiner = 15016, - Engi_m_CivicDuty = 15044, - Engi_m_LightningRod = 15047, - Engi_m_Autumn = 15085, - Engi_m_FlowerPower = 15109, - Engi_m_CoffinNail = 15132, - Engi_m_DressedtoKill = 15133, - Engi_m_RedBear = 15152, - Engi_s_EngineersPistol = 22, - Engi_s_PistolR = 209, - Engi_s_TheWrangler = 140, - Engi_s_VintageLugermorph = 160, - Engi_s_Lugermorph = 294, - Engi_s_TheShortCircuit = 528, - Engi_s_FestiveWrangler = 1086, - Engi_s_RedRockRoscoe = 15013, - Engi_s_HomemadeHeater = 15018, - Engi_s_HickoryHolepuncher = 15035, - Engi_s_LocalHero = 15041, - Engi_s_BlackDahlia = 15046, - Engi_s_SandstoneSpecial = 15056, - Engi_s_MacabreWeb = 15060, - Engi_s_Nutcracker = 15061, - Engi_s_BlueMew = 15100, - Engi_s_BrainCandy = 15101, - Engi_s_ShottoHell = 15102, - Engi_s_DressedToKill = 15126, - Engi_s_Blitzkrieg = 15148, - Engi_s_TheCAPPER = 30666, - Engi_s_TheGigarCounter = 30668, - Engi_t_Wrench = 7, - Engi_t_WrenchR = 197, - Engi_t_TheGunslinger = 142, - Engi_t_TheSouthernHospitality = 155, - Engi_t_GoldenWrench = 169, - Engi_t_TheJag = 329, - Engi_t_TheEurekaEffect = 589, - Engi_t_FestiveWrench = 662, - Engi_t_SilverBotkillerWrenchMkI = 795, - Engi_t_GoldBotkillerWrenchMkI = 804, - Engi_t_RustBotkillerWrenchMkI = 884, - Engi_t_BloodBotkillerWrenchMkI = 893, - Engi_t_CarbonadoBotkillerWrenchMkI = 902, - Engi_t_DiamondBotkillerWrenchMkI = 911, - Engi_t_SilverBotkillerWrenchMkII = 960, - Engi_t_GoldBotkillerWrenchMkII = 969, - Engi_t_TheNecroSmasher = 1123, - Engi_t_Nutcracker = 15073, - Engi_t_Autumn = 15074, - Engi_t_Boneyard = 15075, - Engi_t_DressedtoKill = 15139, - Engi_t_TopShelf = 15140, - Engi_t_TorquedtoHell = 15114, - Engi_t_Airwolf = 15156, - Engi_t_PrinnyMachete = 30758, - Engi_p_ConstructionPDA = 25, - Engi_p_ConstructionPDAR = 737, - Engi_p_DestructionPDA = 26, - Engi_p_PDA = 28, - Medic_m_SyringeGun = 17, - Medic_m_SyringeGunR = 204, - Medic_m_TheBlutsauger = 36, - Medic_m_CrusadersCrossbow = 305, - Medic_m_TheOverdose = 412, - Medic_m_FestiveCrusadersCrossbow = 1079, - Medic_s_MediGun = 29, - Medic_s_MediGunR = 211, - Medic_s_TheKritzkrieg = 35, - Medic_s_TheQuickFix = 411, - Medic_s_FestiveMediGun = 663, - Medic_s_SilverBotkillerMediGunMkI = 796, - Medic_s_GoldBotkillerMediGunMkI = 805, - Medic_s_RustBotkillerMediGunMkI = 885, - Medic_s_BloodBotkillerMediGunMkI = 894, - Medic_s_CarbonadoBotkillerMediGunMkI = 903, - Medic_s_DiamondBotkillerMediGunMkI = 912, - Medic_s_SilverBotkillerMediGunMkII = 961, - Medic_s_GoldBotkillerMediGunMkII = 970, - Medic_s_TheVaccinator = 998, - Medic_s_MaskedMender = 15008, - Medic_s_WrappedReviver = 15010, - Medic_s_ReclaimedReanimator = 15025, - Medic_s_CivilServant = 15039, - Medic_s_SparkofLife = 15050, - Medic_s_Wildwood = 15078, - Medic_s_FlowerPower = 15097, - Medic_s_DressedToKill = 15121, - Medic_s_HighRollers = 15122, - Medic_s_CoffinNail = 15123, - Medic_s_Blitzkrieg = 15145, - Medic_s_Corsair = 15146, - Medic_t_Bonesaw = 8, - Medic_t_BonesawR = 198, - Medic_t_TheUbersaw = 37, - Medic_t_TheVitaSaw = 173, - Medic_t_Amputator = 304, - Medic_t_TheSolemnVow = 413, - Medic_t_TheConscientiousObjector = 474, - Medic_t_TheFreedomStaff = 880, - Medic_t_TheBatOuttaHell = 939, - Medic_t_TheMemoryMaker = 954, - Medic_t_FestiveUbersaw = 1003, - Medic_t_TheHamShank = 1013, - Medic_t_TheNecroSmasher = 1123, - Medic_t_TheCrossingGuard = 1127, - Medic_t_FestiveBonesaw = 1143, - Medic_t_PrinnyMachete = 30758, - Sniper_m_SniperRifle = 14, - Sniper_m_SniperRifleR = 201, - Sniper_m_TheHuntsman = 56, - Sniper_m_TheSydneySleeper = 230, - Sniper_m_TheBazaarBargain = 402, - Sniper_m_TheMachina = 526, - Sniper_m_FestiveSniperRifle = 664, - Sniper_m_TheHitmansHeatmaker = 752, - Sniper_m_SilverBotkillerSniperRifleMkI = 792, - Sniper_m_GoldBotkillerSniperRifleMkI = 801, - Sniper_m_TheAWPerHand = 851, - Sniper_m_RustBotkillerSniperRifleMkI = 881, - Sniper_m_BloodBotkillerSniperRifleMkI = 890, - Sniper_m_CarbonadoBotkillerSniperRifleMkI = 899, - Sniper_m_DiamondBotkillerSniperRifleMkI = 908, - Sniper_m_SilverBotkillerSniperRifleMkII = 957, - Sniper_m_GoldBotkillerSniperRifleMkII = 966, - Sniper_m_FestiveHuntsman = 1005, - Sniper_m_TheFortifiedCompound = 1092, - Sniper_m_TheClassic = 1098, - Sniper_m_NightOwl = 15000, - Sniper_m_PurpleRange = 15007, - Sniper_m_LumberFromDownUnder = 15019, - Sniper_m_ShotintheDark = 15023, - Sniper_m_Bogtrotter = 15033, - Sniper_m_Thunderbolt = 15059, - Sniper_m_PumpkinPatch = 15070, - Sniper_m_Boneyard = 15071, - Sniper_m_Wildwood = 15072, - Sniper_m_Balloonicorn = 15111, - Sniper_m_Rainbow = 15112, - Sniper_m_CoffinNail = 15135, - Sniper_m_DressedtoKill = 15136, - Sniper_m_Airwolf = 15154, - Sniper_m_ShootingStar = 30665, - Sniper_s_SMG = 16, - Sniper_s_SMGR = 203, - Sniper_s_TheRazorback = 57, - Sniper_s_Jarate = 58, - Sniper_s_DarwinsDangerShield = 231, - Sniper_s_CozyCamper = 642, - Sniper_s_TheCleanersCarbine = 751, - Sniper_s_FestiveJarate = 1083, - Sniper_s_TheSelfAwareBeautyMark = 1105, - Sniper_s_FestiveSMG = 1149, - Sniper_s_WoodsyWidowmaker = 15001, - Sniper_s_PlaidPotshotter = 15022, - Sniper_s_TreadplateTormenter = 15032, - Sniper_s_TeamSprayer = 15037, - Sniper_s_LowProfile = 15058, - Sniper_s_Wildwood = 15076, - Sniper_s_BlueMew = 15110, - Sniper_s_HighRollers = 15134, - Sniper_s_Blitzkrieg = 15153, - Sniper_t_Kukri = 3, - Sniper_t_KukriR = 193, - Sniper_t_TheTribalmansShiv = 171, - Sniper_t_TheBushwacka = 232, - Sniper_t_TheShahanshah = 401, - Sniper_t_TheConscientiousObjector = 474, - Sniper_t_TheFreedomStaff = 880, - Sniper_t_TheBatOuttaHell = 939, - Sniper_t_TheMemoryMaker = 954, - Sniper_t_TheHamShank = 1013, - Sniper_t_TheNecroSmasher = 1123, - Sniper_t_TheCrossingGuard = 1127, - Sniper_t_PrinnyMachete = 30758, - Spy_m_Revolver = 24, - Spy_m_RevolverR = 210, - Spy_m_TheAmbassador = 61, - Spy_m_BigKill = 161, - Spy_m_LEtranger = 224, - Spy_m_TheEnforcer = 460, - Spy_m_TheDiamondback = 525, - Spy_m_FestiveAmbassador = 1006, - Spy_m_FestiveRevolver = 1142, - Spy_m_PsychedelicSlugger = 15011, - Spy_m_OldCountry = 15027, - Spy_m_Mayor = 15042, - Spy_m_DeadReckoner = 15051, - Spy_m_Boneyard = 15062, - Spy_m_Wildwood = 15063, - Spy_m_MacabreWeb = 15064, - Spy_m_FlowerPower = 15103, - Spy_m_TopShelf = 15128, - Spy_m_CoffinNail = 15129, - Spy_m_Blitzkrieg = 15149, - Spy_s_Sapper = 735, - Spy_s_SapperR = 736, - Spy_s_TheRedTapeRecorder = 810, - Spy_s_TheRedTapeRecorderG = 831, - Spy_s_TheApSapG = 933, - Spy_s_FestiveSapper = 1080, - Spy_s_TheSnackAttack = 1102, - Spy_t_Knife = 4, - Spy_t_KnifeR = 194, - Spy_t_YourEternalReward = 225, - Spy_t_ConniversKunai = 356, - Spy_t_TheBigEarner = 461, - Spy_t_TheWangaPrick = 574, - Spy_t_TheSharpDresser = 638, - Spy_t_TheSpycicle = 649, - Spy_t_FestiveKnife = 665, - Spy_t_TheBlackRose = 727, - Spy_t_SilverBotkillerKnifeMkI = 794, - Spy_t_GoldBotkillerKnifeMkI = 803, - Spy_t_RustBotkillerKnifeMkI = 883, - Spy_t_BloodBotkillerKnifeMkI = 892, - Spy_t_CarbonadoBotkillerKnifeMkI = 901, - Spy_t_DiamondBotkillerKnifeMkI = 910, - Spy_t_SilverBotkillerKnifeMkII = 959, - Spy_t_GoldBotkillerKnifeMkII = 968, - Spy_t_Boneyard = 15062, - Spy_t_BlueMew = 15094, - Spy_t_BrainCandy = 15095, - Spy_t_StabbedtoHell = 15096, - Spy_t_DressedtoKill = 15118, - Spy_t_TopShelf = 15119, - Spy_t_Blitzkrieg = 15143, - Spy_t_Airwolf = 15144, - Spy_t_PrinnyMachete = 30758, - Spy_d_DisguiseKitPDA = 27, - Spy_w_InvisWatch = 30, - Spy_w_InvisWatchR = 212, - Spy_w_TheDeadRinger = 59, - Spy_w_TheCloakandDagger = 60, - Spy_w_EnthusiastsTimepiece = 297, - Spy_w_TheQuackenbirdt = 947, - Misc_t_FryingPan = 264, - Misc_t_GoldFryingPan = 1071, - Misc_t_Saxxy = 423 + Scout_m_Scattergun = 13, + Scout_m_ScattergunR = 200, + Scout_m_ForceANature = 45, + Scout_m_TheShortstop = 220, + Scout_m_TheSodaPopper = 448, + Scout_m_FestiveScattergun = 669, + Scout_m_BabyFacesBlaster = 772, + Scout_m_SilverBotkillerScattergunMkI = 799, + Scout_m_GoldBotkillerScattergunMkI = 808, + Scout_m_RustBotkillerScattergunMkI = 888, + Scout_m_BloodBotkillerScattergunMkI = 897, + Scout_m_CarbonadoBotkillerScattergunMkI = 906, + Scout_m_DiamondBotkillerScattergunMkI = 915, + Scout_m_SilverBotkillerScattergunMkII = 964, + Scout_m_GoldBotkillerScattergunMkII = 973, + Scout_m_FestiveForceANature = 1078, + Scout_m_TheBackScatter = 1103, + Scout_m_NightTerror = 15002, + Scout_m_TartanTorpedo = 15015, + Scout_m_CountryCrusher = 15021, + Scout_m_BackcountryBlaster = 15029, + Scout_m_SpruceDeuce = 15036, + Scout_m_CurrentEvent = 15053, + Scout_m_MacabreWeb = 15065, + Scout_m_Nutcracker = 15069, + Scout_m_BlueMew = 15106, + Scout_m_FlowerPower = 15107, + Scout_m_ShottoHell = 15108, + Scout_m_CoffinNail = 15131, + Scout_m_KillerBee = 15151, + Scout_m_Corsair = 15157, + Scout_s_ScoutsPistol = 23, + Scout_s_PistolR = 209, + Scout_s_BonkAtomicPunch = 46, + Scout_s_VintageLugermorph = 160, + Scout_s_CritaCola = 163, + Scout_s_MadMilk = 222, + Scout_s_Lugermorph = 294, + Scout_s_TheWinger = 449, + Scout_s_PrettyBoysPocketPistol = 773, + Scout_s_TheFlyingGuillotine = 812, + Scout_s_TheFlyingGuillotineG = 833, + Scout_s_MutatedMilk = 1121, + Scout_s_FestiveBonk = 1145, + Scout_s_RedRockRoscoe = 15013, + Scout_s_HomemadeHeater = 15018, + Scout_s_HickoryHolepuncher = 15035, + Scout_s_LocalHero = 15041, + Scout_s_BlackDahlia = 15046, + Scout_s_SandstoneSpecial = 15056, + Scout_s_MacabreWeb = 15060, + Scout_s_Nutcracker = 15061, + Scout_s_BlueMew = 15100, + Scout_s_BrainCandy = 15101, + Scout_s_ShottoHell = 15102, + Scout_s_DressedToKill = 15126, + Scout_s_Blitzkrieg = 15148, + Scout_s_TheCAPPER = 30666, + Scout_t_Bat = 0, + Scout_t_BatR = 190, + Scout_t_TheSandman = 44, + Scout_t_TheHolyMackerel = 221, + Scout_t_TheCandyCane = 317, + Scout_t_TheBostonBasher = 325, + Scout_t_SunonaStick = 349, + Scout_t_TheFanOWar = 355, + Scout_t_TheAtomizer = 450, + Scout_t_ThreeRuneBlade = 452, + Scout_t_TheConscientiousObjector = 474, + Scout_t_UnarmedCombat = 572, + Scout_t_TheWrapAssassin = 648, + Scout_t_FestiveBat = 660, + Scout_t_TheFreedomStaff = 880, + Scout_t_TheBatOuttaHell = 939, + Scout_t_TheMemoryMaker = 954, + Scout_t_FestiveHolyMackerel = 999, + Scout_t_TheHamShank = 1013, + Scout_t_TheNecroSmasher = 1123, + Scout_t_TheCrossingGuard = 1127, + Scout_t_Batsaber = 30667, + Scout_t_PrinnyMachete = 30758, + Soldier_m_RocketLauncher = 18, + Soldier_m_RocketLauncherR = 205, + Soldier_m_TheDirectHit = 127, + Soldier_m_TheBlackBox = 228, + Soldier_m_RocketJumper = 237, + Soldier_m_TheLibertyLauncher = 414, + Soldier_m_TheCowMangler5000 = 441, + Soldier_m_TheOriginal = 513, + Soldier_m_FestiveRocketLauncher = 658, + Soldier_m_TheBeggarsBazooka = 730, + Soldier_m_SilverBotkillerRocketLauncherMkI = 800, + Soldier_m_GoldBotkillerRocketLauncherMkI = 809, + Soldier_m_RustBotkillerRocketLauncherMkI = 889, + Soldier_m_BloodBotkillerRocketLauncherMkI = 898, + Soldier_m_CarbonadoBotkillerRocketLauncherMkI = 907, + Soldier_m_DiamondBotkillerRocketLauncherMkI = 916, + Soldier_m_SilverBotkillerRocketLauncherMkII = 965, + Soldier_m_GoldBotkillerRocketLauncherMkII = 974, + Soldier_m_FestiveBlackBox = 1085, + Soldier_m_TheAirStrike = 1104, + Soldier_m_WoodlandWarrior = 15006, + Soldier_m_SandCannon = 15014, + Soldier_m_AmericanPastoral = 15028, + Soldier_m_SmalltownBringdown = 15043, + Soldier_m_ShellShocker = 15052, + Soldier_m_AquaMarine = 15057, + Soldier_m_Autumn = 15081, + Soldier_m_BlueMew = 15104, + Soldier_m_BrainCandy = 15105, + Soldier_m_CoffinNail = 15129, + Soldier_m_HighRollers = 15130, + Soldier_m_Warhawk = 15150, + Soldier_s_SoldiersShotgun = 10, + Soldier_s_ShotgunR = 199, + Soldier_s_TheBuffBanner = 129, + Soldier_s_Gunboats = 133, + Soldier_s_TheBattalionsBackup = 226, + Soldier_s_TheConcheror = 354, + Soldier_s_TheReserveShooter = 415, + Soldier_s_TheRighteousBison = 442, + Soldier_s_TheMantreads = 444, + Soldier_s_FestiveBuffBanner = 1001, + Soldier_s_TheBASEJumper = 1101, + Soldier_s_FestiveShotgun = 1141, + Soldier_s_PanicAttack = 1153, + Soldier_s_BackwoodsBoomstick = 15003, + Soldier_s_RusticRuiner = 15016, + Soldier_s_CivicDuty = 15044, + Soldier_s_LightningRod = 15047, + Soldier_s_Autumn = 15085, + Soldier_s_FlowerPower = 15109, + Soldier_s_CoffinNail = 15132, + Soldier_s_DressedtoKill = 15133, + Soldier_s_RedBear = 15152, + Soldier_t_Shovel = 6, + Soldier_t_ShovelR = 196, + Soldier_t_TheEqualizer = 128, + Soldier_t_ThePainTrain = 154, + Soldier_t_TheHalfZatoichi = 357, + Soldier_t_TheMarketGardener = 416, + Soldier_t_TheDisciplinaryAction = 447, + Soldier_t_TheConscientiousObjector = 474, + Soldier_t_TheEscapePlan = 775, + Soldier_t_TheFreedomStaff = 880, + Soldier_t_TheBatOuttaHell = 939, + Soldier_t_TheMemoryMaker = 954, + Soldier_t_TheHamShank = 1013, + Soldier_t_TheNecroSmasher = 1123, + Soldier_t_TheCrossingGuard = 1127, + Soldier_t_PrinnyMachete = 30758, + Pyro_m_FlameThrower = 21, + Pyro_m_FlameThrowerR = 208, + Pyro_m_TheBackburner = 40, + Pyro_m_TheDegreaser = 215, + Pyro_m_ThePhlogistinator = 594, + Pyro_m_FestiveFlameThrower = 659, + Pyro_m_TheRainblower = 741, + Pyro_m_SilverBotkillerFlameThrowerMkI = 798, + Pyro_m_GoldBotkillerFlameThrowerMkI = 807, + Pyro_m_RustBotkillerFlameThrowerMkI = 887, + Pyro_m_BloodBotkillerFlameThrowerMkI = 896, + Pyro_m_CarbonadoBotkillerFlameThrowerMkI = 905, + Pyro_m_DiamondBotkillerFlameThrowerMkI = 914, + Pyro_m_SilverBotkillerFlameThrowerMkII = 963, + Pyro_m_GoldBotkillerFlameThrowerMkII = 972, + Pyro_m_FestiveBackburner = 1146, + Pyro_m_DragonsFury = 1178, + Pyro_m_ForestFire = 15005, + Pyro_m_BarnBurner = 15017, + Pyro_m_BovineBlazemaker = 15030, + Pyro_m_EarthSkyandFire = 15034, + Pyro_m_FlashFryer = 15049, + Pyro_m_TurbineTorcher = 15054, + Pyro_m_Autumn = 15066, + Pyro_m_PumpkinPatch = 15067, + Pyro_m_Nutcracker = 15068, + Pyro_m_Balloonicorn = 15089, + Pyro_m_Rainbow = 15090, + Pyro_m_CoffinNail = 15115, + Pyro_m_Warhawk = 15141, + Pyro_m_NostromoNapalmer = 30474, + Pyro_s_PyrosShotgun = 12, + Pyro_s_ShotgunR = 199, + Pyro_s_TheFlareGun = 39, + Pyro_s_TheDetonator = 351, + Pyro_s_TheReserveShooter = 415, + Pyro_s_TheManmelter = 595, + Pyro_s_TheScorchShot = 740, + Pyro_s_FestiveFlareGun = 1081, + Pyro_s_FestiveShotgun = 1141, + Pyro_s_PanicAttack = 1153, + Pyro_s_ThermalThruster = 1179, + Pyro_s_GasPasser = 1180, + Pyro_s_BackwoodsBoomstick = 15003, + Pyro_s_RusticRuiner = 15016, + Pyro_s_CivicDuty = 15044, + Pyro_s_LightningRod = 15047, + Pyro_s_Autumn = 15085, + Pyro_s_FlowerPower = 15109, + Pyro_s_CoffinNail = 15132, + Pyro_s_DressedtoKill = 15133, + Pyro_s_RedBear = 15152, + Pyro_t_FireAxe = 2, + Pyro_t_FireAxeR = 192, + Pyro_t_TheAxtinguisher = 38, + Pyro_t_Homewrecker = 153, + Pyro_t_ThePowerjack = 214, + Pyro_t_TheBackScratcher = 326, + Pyro_t_SharpenedVolcanoFragment = 348, + Pyro_t_ThePostalPummeler = 457, + Pyro_t_TheMaul = 466, + Pyro_t_TheConscientiousObjector = 474, + Pyro_t_TheThirdDegree = 593, + Pyro_t_TheLollichop = 739, + Pyro_t_NeonAnnihilator = 813, + Pyro_t_NeonAnnihilatorG = 834, + Pyro_t_TheFreedomStaff = 880, + Pyro_t_TheBatOuttaHell = 939, + Pyro_t_TheMemoryMaker = 954, + Pyro_t_TheFestiveAxtinguisher = 1000, + Pyro_t_TheHamShank = 1013, + Pyro_t_TheNecroSmasher = 1123, + Pyro_t_TheCrossingGuard = 1127, + Pyro_t_HotHand = 1181, + Pyro_t_PrinnyMachete = 30758, + Demoman_m_GrenadeLauncher = 19, + Demoman_m_GrenadeLauncherR = 206, + Demoman_m_TheLochnLoad = 308, + Demoman_m_AliBabasWeeBooties = 405, + Demoman_m_TheBootlegger = 608, + Demoman_m_TheLooseCannon = 996, + Demoman_m_FestiveGrenadeLauncher = 1007, + Demoman_m_TheBASEJumper = 1101, + Demoman_m_TheIronBomber = 1151, + Demoman_m_Autumn = 15077, + Demoman_m_MacabreWeb = 15079, + Demoman_m_Rainbow = 15091, + Demoman_m_SweetDreams = 15092, + Demoman_m_CoffinNail = 15116, + Demoman_m_TopShelf = 15117, + Demoman_m_Warhawk = 15142, + Demoman_m_ButcherBird = 15158, + Demoman_s_StickybombLauncher = 20, + Demoman_s_StickybombLauncherR = 207, + Demoman_s_TheScottishResistance = 130, + Demoman_s_TheCharginTarge = 131, + Demoman_s_StickyJumper = 265, + Demoman_s_TheSplendidScreen = 406, + Demoman_s_FestiveStickybombLauncher = 661, + Demoman_s_SilverBotkillerStickybombLauncherMkI = 797, + Demoman_s_GoldBotkillerStickybombLauncherMkI = 806, + Demoman_s_RustBotkillerStickybombLauncherMkI = 886, + Demoman_s_BloodBotkillerStickybombLauncherMkI = 895, + Demoman_s_CarbonadoBotkillerStickybombLauncherMkI = 904, + Demoman_s_DiamondBotkillerStickybombLauncherMkI = 913, + Demoman_s_SilverBotkillerStickybombLauncherMkII = 962, + Demoman_s_GoldBotkillerStickybombLauncherMkII = 971, + Demoman_s_TheTideTurner = 1099, + Demoman_s_FestiveTarge = 1144, + Demoman_s_TheQuickiebombLauncher = 1150, + Demoman_s_SuddenFlurry = 15009, + Demoman_s_CarpetBomber = 15012, + Demoman_s_BlastedBombardier = 15024, + Demoman_s_RooftopWrangler = 15038, + Demoman_s_LiquidAsset = 15045, + Demoman_s_PinkElephant = 15048, + Demoman_s_Autumn = 15082, + Demoman_s_PumpkinPatch = 15083, + Demoman_s_MacabreWeb = 15084, + Demoman_s_SweetDreams = 15113, + Demoman_s_CoffinNail = 15137, + Demoman_s_DressedtoKill = 15138, + Demoman_s_Blitzkrieg = 15155, + Demoman_t_Bottle = 1, + Demoman_t_BottleR = 191, + Demoman_t_TheEyelander = 132, + Demoman_t_ThePainTrain = 154, + Demoman_t_TheScotsmansSkullcutter = 172, + Demoman_t_HorselessHeadlessHorsemannsHeadtaker = 266, + Demoman_t_UllapoolCaber = 307, + Demoman_t_TheClaidheamhMor = 327, + Demoman_t_TheHalfZatoichi = 357, + Demoman_t_ThePersianPersuader = 404, + Demoman_t_TheConscientiousObjector = 474, + Demoman_t_NessiesNineIron = 482, + Demoman_t_TheScottishHandshake = 609, + Demoman_t_TheFreedomStaff = 880, + Demoman_t_TheBatOuttaHell = 939, + Demoman_t_TheMemoryMaker = 954, + Demoman_t_TheHamShank = 1013, + Demoman_t_FestiveEyelander = 1082, + Demoman_t_TheNecroSmasher = 1123, + Demoman_t_TheCrossingGuard = 1127, + Demoman_t_PrinnyMachete = 30758, + Heavy_m_Minigun = 15, + Heavy_m_MinigunR = 202, + Heavy_m_Natascha = 41, + Heavy_m_IronCurtain = 298, + Heavy_m_TheBrassBeast = 312, + Heavy_m_Tomislav = 424, + Heavy_m_FestiveMinigun = 654, + Heavy_m_SilverBotkillerMinigunMkI = 793, + Heavy_m_GoldBotkillerMinigunMkI = 802, + Heavy_m_TheHuoLongHeater = 811, + Heavy_m_TheHuoLongHeaterG = 832, + Heavy_m_Deflector_mvm = 850, + Heavy_m_RustBotkillerMinigunMkI = 882, + Heavy_m_BloodBotkillerMinigunMkI = 891, + Heavy_m_CarbonadoBotkillerMinigunMkI = 900, + Heavy_m_DiamondBotkillerMinigunMkI = 909, + Heavy_m_SilverBotkillerMinigunMkII = 958, + Heavy_m_GoldBotkillerMinigunMkII = 967, + Heavy_m_KingoftheJungle = 15004, + Heavy_m_IronWood = 15020, + Heavy_m_AntiqueAnnihilator = 15026, + Heavy_m_WarRoom = 15031, + Heavy_m_CitizenPain = 15040, + Heavy_m_BrickHouse = 15055, + Heavy_m_MacabreWeb = 15086, + Heavy_m_PumpkinPatch = 15087, + Heavy_m_Nutcracker = 15088, + Heavy_m_BrainCandy = 15098, + Heavy_m_MisterCuddles = 15099, + Heavy_m_CoffinNail = 15123, + Heavy_m_DressedtoKill = 15124, + Heavy_m_TopShelf = 15125, + Heavy_m_ButcherBird = 15147, + Heavy_s_HeavysShotgun = 11, + Heavy_s_ShotgunR = 199, + Heavy_s_Sandvich = 42, + Heavy_s_TheDalokohsBar = 159, + Heavy_s_TheBuffaloSteakSandvich = 311, + Heavy_s_TheFamilyBusiness = 425, + Heavy_s_Fishcake = 433, + Heavy_s_RoboSandvich = 863, + Heavy_s_FestiveSandvich = 1002, + Heavy_s_FestiveShotgun = 1141, + Heavy_s_PanicAttack = 1153, + Heavy_s_SecondBanana = 1190, + Heavy_s_BackwoodsBoomstick = 15003, + Heavy_s_RusticRuiner = 15016, + Heavy_s_CivicDuty = 15044, + Heavy_s_LightningRod = 15047, + Heavy_s_Autumn = 15085, + Heavy_s_FlowerPower = 15109, + Heavy_s_CoffinNail = 15132, + Heavy_s_DressedtoKill = 15133, + Heavy_s_RedBear = 15152, + Heavy_t_Fists = 5, + Heavy_t_FistsR = 195, + Heavy_t_TheKillingGlovesofBoxing = 43, + Heavy_t_GlovesofRunningUrgently = 239, + Heavy_t_WarriorsSpirit = 310, + Heavy_t_FistsofSteel = 331, + Heavy_t_TheEvictionNotice = 426, + Heavy_t_TheConscientiousObjector = 474, + Heavy_t_ApocoFists = 587, + Heavy_t_TheHolidayPunch = 656, + Heavy_t_TheFreedomStaff = 880, + Heavy_t_TheBatOuttaHell = 939, + Heavy_t_TheMemoryMaker = 954, + Heavy_t_TheHamShank = 1013, + Heavy_t_FestiveGlovesofRunningUrgently = 1084, + Heavy_t_TheBreadBite = 1100, + Heavy_t_TheNecroSmasher = 1123, + Heavy_t_TheCrossingGuard = 1127, + Heavy_t_GlovesofRunningUrgentlyMvM = 1184, + Heavy_t_PrinnyMachete = 30758, + Engi_m_EngineersShotgun = 9, + Engi_m_ShotgunR = 199, + Engi_m_TheFrontierJustice = 141, + Engi_m_TheWidowmaker = 527, + Engi_m_ThePomson6000 = 588, + Engi_m_TheRescueRanger = 997, + Engi_m_FestiveFrontierJustice = 1004, + Engi_m_FestiveShotgun = 1141, + Engi_m_PanicAttack = 1153, + Engi_m_BackwoodsBoomstick = 15003, + Engi_m_RusticRuiner = 15016, + Engi_m_CivicDuty = 15044, + Engi_m_LightningRod = 15047, + Engi_m_Autumn = 15085, + Engi_m_FlowerPower = 15109, + Engi_m_CoffinNail = 15132, + Engi_m_DressedtoKill = 15133, + Engi_m_RedBear = 15152, + Engi_s_EngineersPistol = 22, + Engi_s_PistolR = 209, + Engi_s_TheWrangler = 140, + Engi_s_VintageLugermorph = 160, + Engi_s_Lugermorph = 294, + Engi_s_TheShortCircuit = 528, + Engi_s_FestiveWrangler = 1086, + Engi_s_RedRockRoscoe = 15013, + Engi_s_HomemadeHeater = 15018, + Engi_s_HickoryHolepuncher = 15035, + Engi_s_LocalHero = 15041, + Engi_s_BlackDahlia = 15046, + Engi_s_SandstoneSpecial = 15056, + Engi_s_MacabreWeb = 15060, + Engi_s_Nutcracker = 15061, + Engi_s_BlueMew = 15100, + Engi_s_BrainCandy = 15101, + Engi_s_ShottoHell = 15102, + Engi_s_DressedToKill = 15126, + Engi_s_Blitzkrieg = 15148, + Engi_s_TheCAPPER = 30666, + Engi_s_TheGigarCounter = 30668, + Engi_t_Wrench = 7, + Engi_t_WrenchR = 197, + Engi_t_TheGunslinger = 142, + Engi_t_TheSouthernHospitality = 155, + Engi_t_GoldenWrench = 169, + Engi_t_TheJag = 329, + Engi_t_TheEurekaEffect = 589, + Engi_t_FestiveWrench = 662, + Engi_t_SilverBotkillerWrenchMkI = 795, + Engi_t_GoldBotkillerWrenchMkI = 804, + Engi_t_RustBotkillerWrenchMkI = 884, + Engi_t_BloodBotkillerWrenchMkI = 893, + Engi_t_CarbonadoBotkillerWrenchMkI = 902, + Engi_t_DiamondBotkillerWrenchMkI = 911, + Engi_t_SilverBotkillerWrenchMkII = 960, + Engi_t_GoldBotkillerWrenchMkII = 969, + Engi_t_TheNecroSmasher = 1123, + Engi_t_Nutcracker = 15073, + Engi_t_Autumn = 15074, + Engi_t_Boneyard = 15075, + Engi_t_DressedtoKill = 15139, + Engi_t_TopShelf = 15140, + Engi_t_TorquedtoHell = 15114, + Engi_t_Airwolf = 15156, + Engi_t_PrinnyMachete = 30758, + Engi_p_ConstructionPDA = 25, + Engi_p_ConstructionPDAR = 737, + Engi_p_DestructionPDA = 26, + Engi_p_PDA = 28, + Medic_m_SyringeGun = 17, + Medic_m_SyringeGunR = 204, + Medic_m_TheBlutsauger = 36, + Medic_m_CrusadersCrossbow = 305, + Medic_m_TheOverdose = 412, + Medic_m_FestiveCrusadersCrossbow = 1079, + Medic_s_MediGun = 29, + Medic_s_MediGunR = 211, + Medic_s_TheKritzkrieg = 35, + Medic_s_TheQuickFix = 411, + Medic_s_FestiveMediGun = 663, + Medic_s_SilverBotkillerMediGunMkI = 796, + Medic_s_GoldBotkillerMediGunMkI = 805, + Medic_s_RustBotkillerMediGunMkI = 885, + Medic_s_BloodBotkillerMediGunMkI = 894, + Medic_s_CarbonadoBotkillerMediGunMkI = 903, + Medic_s_DiamondBotkillerMediGunMkI = 912, + Medic_s_SilverBotkillerMediGunMkII = 961, + Medic_s_GoldBotkillerMediGunMkII = 970, + Medic_s_TheVaccinator = 998, + Medic_s_MaskedMender = 15008, + Medic_s_WrappedReviver = 15010, + Medic_s_ReclaimedReanimator = 15025, + Medic_s_CivilServant = 15039, + Medic_s_SparkofLife = 15050, + Medic_s_Wildwood = 15078, + Medic_s_FlowerPower = 15097, + Medic_s_DressedToKill = 15121, + Medic_s_HighRollers = 15122, + Medic_s_CoffinNail = 15123, + Medic_s_Blitzkrieg = 15145, + Medic_s_Corsair = 15146, + Medic_t_Bonesaw = 8, + Medic_t_BonesawR = 198, + Medic_t_TheUbersaw = 37, + Medic_t_TheVitaSaw = 173, + Medic_t_Amputator = 304, + Medic_t_TheSolemnVow = 413, + Medic_t_TheConscientiousObjector = 474, + Medic_t_TheFreedomStaff = 880, + Medic_t_TheBatOuttaHell = 939, + Medic_t_TheMemoryMaker = 954, + Medic_t_FestiveUbersaw = 1003, + Medic_t_TheHamShank = 1013, + Medic_t_TheNecroSmasher = 1123, + Medic_t_TheCrossingGuard = 1127, + Medic_t_FestiveBonesaw = 1143, + Medic_t_PrinnyMachete = 30758, + Sniper_m_SniperRifle = 14, + Sniper_m_SniperRifleR = 201, + Sniper_m_TheHuntsman = 56, + Sniper_m_TheSydneySleeper = 230, + Sniper_m_TheBazaarBargain = 402, + Sniper_m_TheMachina = 526, + Sniper_m_FestiveSniperRifle = 664, + Sniper_m_TheHitmansHeatmaker = 752, + Sniper_m_SilverBotkillerSniperRifleMkI = 792, + Sniper_m_GoldBotkillerSniperRifleMkI = 801, + Sniper_m_TheAWPerHand = 851, + Sniper_m_RustBotkillerSniperRifleMkI = 881, + Sniper_m_BloodBotkillerSniperRifleMkI = 890, + Sniper_m_CarbonadoBotkillerSniperRifleMkI = 899, + Sniper_m_DiamondBotkillerSniperRifleMkI = 908, + Sniper_m_SilverBotkillerSniperRifleMkII = 957, + Sniper_m_GoldBotkillerSniperRifleMkII = 966, + Sniper_m_FestiveHuntsman = 1005, + Sniper_m_TheFortifiedCompound = 1092, + Sniper_m_TheClassic = 1098, + Sniper_m_NightOwl = 15000, + Sniper_m_PurpleRange = 15007, + Sniper_m_LumberFromDownUnder = 15019, + Sniper_m_ShotintheDark = 15023, + Sniper_m_Bogtrotter = 15033, + Sniper_m_Thunderbolt = 15059, + Sniper_m_PumpkinPatch = 15070, + Sniper_m_Boneyard = 15071, + Sniper_m_Wildwood = 15072, + Sniper_m_Balloonicorn = 15111, + Sniper_m_Rainbow = 15112, + Sniper_m_CoffinNail = 15135, + Sniper_m_DressedtoKill = 15136, + Sniper_m_Airwolf = 15154, + Sniper_m_ShootingStar = 30665, + Sniper_s_SMG = 16, + Sniper_s_SMGR = 203, + Sniper_s_TheRazorback = 57, + Sniper_s_Jarate = 58, + Sniper_s_DarwinsDangerShield = 231, + Sniper_s_CozyCamper = 642, + Sniper_s_TheCleanersCarbine = 751, + Sniper_s_FestiveJarate = 1083, + Sniper_s_TheSelfAwareBeautyMark = 1105, + Sniper_s_FestiveSMG = 1149, + Sniper_s_WoodsyWidowmaker = 15001, + Sniper_s_PlaidPotshotter = 15022, + Sniper_s_TreadplateTormenter = 15032, + Sniper_s_TeamSprayer = 15037, + Sniper_s_LowProfile = 15058, + Sniper_s_Wildwood = 15076, + Sniper_s_BlueMew = 15110, + Sniper_s_HighRollers = 15134, + Sniper_s_Blitzkrieg = 15153, + Sniper_t_Kukri = 3, + Sniper_t_KukriR = 193, + Sniper_t_TheTribalmansShiv = 171, + Sniper_t_TheBushwacka = 232, + Sniper_t_TheShahanshah = 401, + Sniper_t_TheConscientiousObjector = 474, + Sniper_t_TheFreedomStaff = 880, + Sniper_t_TheBatOuttaHell = 939, + Sniper_t_TheMemoryMaker = 954, + Sniper_t_TheHamShank = 1013, + Sniper_t_TheNecroSmasher = 1123, + Sniper_t_TheCrossingGuard = 1127, + Sniper_t_PrinnyMachete = 30758, + Spy_m_Revolver = 24, + Spy_m_RevolverR = 210, + Spy_m_TheAmbassador = 61, + Spy_m_BigKill = 161, + Spy_m_LEtranger = 224, + Spy_m_TheEnforcer = 460, + Spy_m_TheDiamondback = 525, + Spy_m_FestiveAmbassador = 1006, + Spy_m_FestiveRevolver = 1142, + Spy_m_PsychedelicSlugger = 15011, + Spy_m_OldCountry = 15027, + Spy_m_Mayor = 15042, + Spy_m_DeadReckoner = 15051, + Spy_m_Boneyard = 15062, + Spy_m_Wildwood = 15063, + Spy_m_MacabreWeb = 15064, + Spy_m_FlowerPower = 15103, + Spy_m_TopShelf = 15128, + Spy_m_CoffinNail = 15129, + Spy_m_Blitzkrieg = 15149, + Spy_s_Sapper = 735, + Spy_s_SapperR = 736, + Spy_s_TheRedTapeRecorder = 810, + Spy_s_TheRedTapeRecorderG = 831, + Spy_s_TheApSapG = 933, + Spy_s_FestiveSapper = 1080, + Spy_s_TheSnackAttack = 1102, + Spy_t_Knife = 4, + Spy_t_KnifeR = 194, + Spy_t_YourEternalReward = 225, + Spy_t_ConniversKunai = 356, + Spy_t_TheBigEarner = 461, + Spy_t_TheWangaPrick = 574, + Spy_t_TheSharpDresser = 638, + Spy_t_TheSpycicle = 649, + Spy_t_FestiveKnife = 665, + Spy_t_TheBlackRose = 727, + Spy_t_SilverBotkillerKnifeMkI = 794, + Spy_t_GoldBotkillerKnifeMkI = 803, + Spy_t_RustBotkillerKnifeMkI = 883, + Spy_t_BloodBotkillerKnifeMkI = 892, + Spy_t_CarbonadoBotkillerKnifeMkI = 901, + Spy_t_DiamondBotkillerKnifeMkI = 910, + Spy_t_SilverBotkillerKnifeMkII = 959, + Spy_t_GoldBotkillerKnifeMkII = 968, + Spy_t_Boneyard = 15062, + Spy_t_BlueMew = 15094, + Spy_t_BrainCandy = 15095, + Spy_t_StabbedtoHell = 15096, + Spy_t_DressedtoKill = 15118, + Spy_t_TopShelf = 15119, + Spy_t_Blitzkrieg = 15143, + Spy_t_Airwolf = 15144, + Spy_t_PrinnyMachete = 30758, + Spy_d_DisguiseKitPDA = 27, + Spy_w_InvisWatch = 30, + Spy_w_InvisWatchR = 212, + Spy_w_TheDeadRinger = 59, + Spy_w_TheCloakandDagger = 60, + Spy_w_EnthusiastsTimepiece = 297, + Spy_w_TheQuackenbirdt = 947, + Misc_t_FryingPan = 264, + Misc_t_GoldFryingPan = 1071, + Misc_t_Saxxy = 423 }; enum { - TF_WEAPON_NONE = 0, - TF_WEAPON_BAT, - TF_WEAPON_BAT_WOOD, - TF_WEAPON_BOTTLE, - TF_WEAPON_FIREAXE, - TF_WEAPON_CLUB, - TF_WEAPON_CROWBAR, - TF_WEAPON_KNIFE, - TF_WEAPON_FISTS, - TF_WEAPON_SHOVEL, - TF_WEAPON_WRENCH, - TF_WEAPON_BONESAW, - TF_WEAPON_SHOTGUN_PRIMARY, - TF_WEAPON_SHOTGUN_SOLDIER, - TF_WEAPON_SHOTGUN_HWG, - TF_WEAPON_SHOTGUN_PYRO, - TF_WEAPON_SCATTERGUN, - TF_WEAPON_SNIPERRIFLE, - TF_WEAPON_MINIGUN, - TF_WEAPON_SMG, - TF_WEAPON_SYRINGEGUN_MEDIC, - TF_WEAPON_TRANQ, - TF_WEAPON_ROCKETLAUNCHER, - TF_WEAPON_GRENADELAUNCHER, - TF_WEAPON_PIPEBOMBLAUNCHER, - TF_WEAPON_FLAMETHROWER, - TF_WEAPON_GRENADE_NORMAL, - TF_WEAPON_GRENADE_CONCUSSION, - TF_WEAPON_GRENADE_NAIL, - TF_WEAPON_GRENADE_MIRV, - TF_WEAPON_GRENADE_MIRV_DEMOMAN, - TF_WEAPON_GRENADE_NAPALM, - TF_WEAPON_GRENADE_GAS, - TF_WEAPON_GRENADE_EMP, - TF_WEAPON_GRENADE_CALTROP, - TF_WEAPON_GRENADE_PIPEBOMB, - TF_WEAPON_GRENADE_SMOKE_BOMB, - TF_WEAPON_GRENADE_HEAL, - TF_WEAPON_GRENADE_STUNBALL, - TF_WEAPON_GRENADE_JAR, - TF_WEAPON_GRENADE_JAR_MILK, - TF_WEAPON_PISTOL, - TF_WEAPON_PISTOL_SCOUT, - TF_WEAPON_REVOLVER, - TF_WEAPON_NAILGUN, - TF_WEAPON_PDA, - TF_WEAPON_PDA_ENGINEER_BUILD, - TF_WEAPON_PDA_ENGINEER_DESTROY, - TF_WEAPON_PDA_SPY, - TF_WEAPON_BUILDER, - TF_WEAPON_MEDIGUN, - TF_WEAPON_GRENADE_MIRVBOMB, - TF_WEAPON_FLAMETHROWER_ROCKET, - TF_WEAPON_GRENADE_DEMOMAN, - TF_WEAPON_SENTRY_BULLET, - TF_WEAPON_SENTRY_ROCKET, - TF_WEAPON_DISPENSER, - TF_WEAPON_INVIS, - TF_WEAPON_FLAREGUN, - TF_WEAPON_LUNCHBOX, - TF_WEAPON_JAR, - TF_WEAPON_COMPOUND_BOW, - TF_WEAPON_BUFF_ITEM, - TF_WEAPON_PUMPKIN_BOMB, - TF_WEAPON_SWORD, - TF_WEAPON_ROCKETLAUNCHER_DIRECTHIT, - TF_WEAPON_LIFELINE, - TF_WEAPON_LASER_POINTER, - TF_WEAPON_DISPENSER_GUN, - TF_WEAPON_SENTRY_REVENGE, - TF_WEAPON_JAR_MILK, - TF_WEAPON_HANDGUN_SCOUT_PRIMARY, - TF_WEAPON_BAT_FISH, - TF_WEAPON_CROSSBOW, - TF_WEAPON_STICKBOMB, - TF_WEAPON_HANDGUN_SCOUT_SECONDARY, - TF_WEAPON_SODA_POPPER, - TF_WEAPON_SNIPERRIFLE_DECAP, - TF_WEAPON_RAYGUN, - TF_WEAPON_PARTICLE_CANNON, - TF_WEAPON_MECHANICAL_ARM, - TF_WEAPON_DRG_POMSON, - TF_WEAPON_BAT_GIFTWRAP, - TF_WEAPON_GRENADE_ORNAMENT_BALL, - TF_WEAPON_FLAREGUN_REVENGE, - TF_WEAPON_PEP_BRAWLER_BLASTER, - TF_WEAPON_CLEAVER, - TF_WEAPON_GRENADE_CLEAVER, - TF_WEAPON_STICKY_BALL_LAUNCHER, - TF_WEAPON_GRENADE_STICKY_BALL, - TF_WEAPON_SHOTGUN_BUILDING_RESCUE, - TF_WEAPON_CANNON, - TF_WEAPON_THROWABLE, - TF_WEAPON_GRENADE_THROWABLE, - TF_WEAPON_PDA_SPY_BUILD, - TF_WEAPON_GRENADE_WATERBALLOON, - TF_WEAPON_HARVESTER_SAW, - TF_WEAPON_SPELLBOOK, - TF_WEAPON_SPELLBOOK_PROJECTILE, - TF_WEAPON_SNIPERRIFLE_CLASSIC, - TF_WEAPON_PARACHUTE, - TF_WEAPON_GRAPPLINGHOOK, - TF_WEAPON_PASSTIME_GUN, - TF_WEAPON_CHARGED_SMG, - TF_WEAPON_COUNT + TF_WEAPON_NONE = 0, + TF_WEAPON_BAT, + TF_WEAPON_BAT_WOOD, + TF_WEAPON_BOTTLE, + TF_WEAPON_FIREAXE, + TF_WEAPON_CLUB, + TF_WEAPON_CROWBAR, + TF_WEAPON_KNIFE, + TF_WEAPON_FISTS, + TF_WEAPON_SHOVEL, + TF_WEAPON_WRENCH, + TF_WEAPON_BONESAW, + TF_WEAPON_SHOTGUN_PRIMARY, + TF_WEAPON_SHOTGUN_SOLDIER, + TF_WEAPON_SHOTGUN_HWG, + TF_WEAPON_SHOTGUN_PYRO, + TF_WEAPON_SCATTERGUN, + TF_WEAPON_SNIPERRIFLE, + TF_WEAPON_MINIGUN, + TF_WEAPON_SMG, + TF_WEAPON_SYRINGEGUN_MEDIC, + TF_WEAPON_TRANQ, + TF_WEAPON_ROCKETLAUNCHER, + TF_WEAPON_GRENADELAUNCHER, + TF_WEAPON_PIPEBOMBLAUNCHER, + TF_WEAPON_FLAMETHROWER, + TF_WEAPON_GRENADE_NORMAL, + TF_WEAPON_GRENADE_CONCUSSION, + TF_WEAPON_GRENADE_NAIL, + TF_WEAPON_GRENADE_MIRV, + TF_WEAPON_GRENADE_MIRV_DEMOMAN, + TF_WEAPON_GRENADE_NAPALM, + TF_WEAPON_GRENADE_GAS, + TF_WEAPON_GRENADE_EMP, + TF_WEAPON_GRENADE_CALTROP, + TF_WEAPON_GRENADE_PIPEBOMB, + TF_WEAPON_GRENADE_SMOKE_BOMB, + TF_WEAPON_GRENADE_HEAL, + TF_WEAPON_GRENADE_STUNBALL, + TF_WEAPON_GRENADE_JAR, + TF_WEAPON_GRENADE_JAR_MILK, + TF_WEAPON_PISTOL, + TF_WEAPON_PISTOL_SCOUT, + TF_WEAPON_REVOLVER, + TF_WEAPON_NAILGUN, + TF_WEAPON_PDA, + TF_WEAPON_PDA_ENGINEER_BUILD, + TF_WEAPON_PDA_ENGINEER_DESTROY, + TF_WEAPON_PDA_SPY, + TF_WEAPON_BUILDER, + TF_WEAPON_MEDIGUN, + TF_WEAPON_GRENADE_MIRVBOMB, + TF_WEAPON_FLAMETHROWER_ROCKET, + TF_WEAPON_GRENADE_DEMOMAN, + TF_WEAPON_SENTRY_BULLET, + TF_WEAPON_SENTRY_ROCKET, + TF_WEAPON_DISPENSER, + TF_WEAPON_INVIS, + TF_WEAPON_FLAREGUN, + TF_WEAPON_LUNCHBOX, + TF_WEAPON_JAR, + TF_WEAPON_COMPOUND_BOW, + TF_WEAPON_BUFF_ITEM, + TF_WEAPON_PUMPKIN_BOMB, + TF_WEAPON_SWORD, + TF_WEAPON_ROCKETLAUNCHER_DIRECTHIT, + TF_WEAPON_LIFELINE, + TF_WEAPON_LASER_POINTER, + TF_WEAPON_DISPENSER_GUN, + TF_WEAPON_SENTRY_REVENGE, + TF_WEAPON_JAR_MILK, + TF_WEAPON_HANDGUN_SCOUT_PRIMARY, + TF_WEAPON_BAT_FISH, + TF_WEAPON_CROSSBOW, + TF_WEAPON_STICKBOMB, + TF_WEAPON_HANDGUN_SCOUT_SECONDARY, + TF_WEAPON_SODA_POPPER, + TF_WEAPON_SNIPERRIFLE_DECAP, + TF_WEAPON_RAYGUN, + TF_WEAPON_PARTICLE_CANNON, + TF_WEAPON_MECHANICAL_ARM, + TF_WEAPON_DRG_POMSON, + TF_WEAPON_BAT_GIFTWRAP, + TF_WEAPON_GRENADE_ORNAMENT_BALL, + TF_WEAPON_FLAREGUN_REVENGE, + TF_WEAPON_PEP_BRAWLER_BLASTER, + TF_WEAPON_CLEAVER, + TF_WEAPON_GRENADE_CLEAVER, + TF_WEAPON_STICKY_BALL_LAUNCHER, + TF_WEAPON_GRENADE_STICKY_BALL, + TF_WEAPON_SHOTGUN_BUILDING_RESCUE, + TF_WEAPON_CANNON, + TF_WEAPON_THROWABLE, + TF_WEAPON_GRENADE_THROWABLE, + TF_WEAPON_PDA_SPY_BUILD, + TF_WEAPON_GRENADE_WATERBALLOON, + TF_WEAPON_HARVESTER_SAW, + TF_WEAPON_SPELLBOOK, + TF_WEAPON_SPELLBOOK_PROJECTILE, + TF_WEAPON_SNIPERRIFLE_CLASSIC, + TF_WEAPON_PARACHUTE, + TF_WEAPON_GRAPPLINGHOOK, + TF_WEAPON_PASSTIME_GUN, + TF_WEAPON_CHARGED_SMG, + TF_WEAPON_COUNT }; class Weapon : Entity { public: - short get_def_id(void) { - return *(short*)(this+0xc30+0x90+0x44); - } + short get_def_id(void) { + return *reinterpret_cast(this + 0xc30 + 0x90 + 0x44); + } - int get_type_id(void) { - void** vtable = *(void***)this; + int get_type_id(void) { + void **vtable = *reinterpret_cast(this); - int (*get_type_id_fn)(void*) = (int (*)(void*))vtable[449]; - - return get_type_id_fn(this); - } + int (*get_type_id_fn)(void *) = (int (*)(void *)) vtable[449]; - bool is_melee(void) { - switch (this->get_type_id()) { - case TF_WEAPON_BAT: - case TF_WEAPON_BAT_WOOD: - case TF_WEAPON_SWORD: - case TF_WEAPON_FIREAXE: - case TF_WEAPON_FISTS: - case TF_WEAPON_BAT_FISH: - case TF_WEAPON_BAT_GIFTWRAP: - case TF_WEAPON_BONESAW: - case TF_WEAPON_BOTTLE: - case TF_WEAPON_CLUB: - case TF_WEAPON_CROWBAR: - case TF_WEAPON_KNIFE: - case TF_WEAPON_WRENCH: - return true; + return get_type_id_fn(this); } - return false; - } + bool is_melee(void) { + switch (this->get_type_id()) { + case TF_WEAPON_BAT: + case TF_WEAPON_BAT_WOOD: + case TF_WEAPON_SWORD: + case TF_WEAPON_FIREAXE: + case TF_WEAPON_FISTS: + case TF_WEAPON_BAT_FISH: + case TF_WEAPON_BAT_GIFTWRAP: + case TF_WEAPON_BONESAW: + case TF_WEAPON_BOTTLE: + case TF_WEAPON_CLUB: + case TF_WEAPON_CROWBAR: + case TF_WEAPON_KNIFE: + case TF_WEAPON_WRENCH: + return true; + default: return false; + } + } - bool is_automatic(void) { - switch (this->get_def_id()) { - case TF_WEAPON_PISTOL: - case TF_WEAPON_PISTOL_SCOUT: - case TF_WEAPON_SMG: - case TF_WEAPON_MINIGUN: - case TF_WEAPON_CHARGED_SMG: - return true; + bool is_automatic(void) { + switch (this->get_def_id()) { + case TF_WEAPON_PISTOL: + case TF_WEAPON_PISTOL_SCOUT: + case TF_WEAPON_SMG: + case TF_WEAPON_MINIGUN: + case TF_WEAPON_CHARGED_SMG: + return true; + default: return false; + } } - return false; - } - - bool is_headshot_weapon(void) { - int weapon_type_id = this->get_type_id(); - if (weapon_type_id == TF_WEAPON_SNIPERRIFLE || - weapon_type_id == TF_WEAPON_SNIPERRIFLE_CLASSIC || - weapon_type_id == TF_WEAPON_SNIPERRIFLE_DECAP) - { - return true; - } + bool is_headshot_weapon(void) { + int weapon_type_id = this->get_type_id(); + if (weapon_type_id == TF_WEAPON_SNIPERRIFLE || + weapon_type_id == TF_WEAPON_SNIPERRIFLE_CLASSIC || + weapon_type_id == TF_WEAPON_SNIPERRIFLE_DECAP) { + return true; + } - int weapon_def_id = this->get_def_id(); - if (weapon_def_id == Spy_m_TheAmbassador || - weapon_def_id == Spy_m_FestiveAmbassador || - weapon_def_id == Sniper_m_SniperRifle || - weapon_def_id == Sniper_m_SniperRifleR || - weapon_def_id == Sniper_m_TheBazaarBargain || - weapon_def_id == Sniper_m_TheHitmansHeatmaker || - weapon_def_id == Sniper_m_TheClassic || - weapon_def_id == Sniper_m_FestiveSniperRifle || - weapon_def_id == Sniper_m_BloodBotkillerSniperRifleMkI || - weapon_def_id == Sniper_m_CarbonadoBotkillerSniperRifleMkI || - weapon_def_id == Sniper_m_DiamondBotkillerSniperRifleMkI || - weapon_def_id == Sniper_m_GoldBotkillerSniperRifleMkI || - weapon_def_id == Sniper_m_RustBotkillerSniperRifleMkI || - weapon_def_id == Sniper_m_SilverBotkillerSniperRifleMkI || - weapon_def_id == Sniper_m_GoldBotkillerSniperRifleMkII || - weapon_def_id == Sniper_m_SilverBotkillerSniperRifleMkII || - weapon_def_id == Sniper_m_ShootingStar || - weapon_def_id == Sniper_m_TheAWPerHand || - weapon_def_id == Sniper_m_TheMachina) - { - return true; - } + int weapon_def_id = this->get_def_id(); + if (weapon_def_id == Spy_m_TheAmbassador || + weapon_def_id == Spy_m_FestiveAmbassador || + weapon_def_id == Sniper_m_SniperRifle || + weapon_def_id == Sniper_m_SniperRifleR || + weapon_def_id == Sniper_m_TheBazaarBargain || + weapon_def_id == Sniper_m_TheHitmansHeatmaker || + weapon_def_id == Sniper_m_TheClassic || + weapon_def_id == Sniper_m_FestiveSniperRifle || + weapon_def_id == Sniper_m_BloodBotkillerSniperRifleMkI || + weapon_def_id == Sniper_m_CarbonadoBotkillerSniperRifleMkI || + weapon_def_id == Sniper_m_DiamondBotkillerSniperRifleMkI || + weapon_def_id == Sniper_m_GoldBotkillerSniperRifleMkI || + weapon_def_id == Sniper_m_RustBotkillerSniperRifleMkI || + weapon_def_id == Sniper_m_SilverBotkillerSniperRifleMkI || + weapon_def_id == Sniper_m_GoldBotkillerSniperRifleMkII || + weapon_def_id == Sniper_m_SilverBotkillerSniperRifleMkII || + weapon_def_id == Sniper_m_ShootingStar || + weapon_def_id == Sniper_m_TheAWPerHand || + weapon_def_id == Sniper_m_TheMachina) { + return true; + } - return false; - } + return false; + } - bool can_ambassador_headshot() { - Entity* owner = this->get_owner_entity(); - if (owner == nullptr) - return false; + bool can_ambassador_headshot() { + Entity *owner = this->get_owner_entity(); + if (owner == nullptr) + return false; - return (owner->get_tickbase() * TICK_INTERVAL) - this->get_last_attack() > 1.f; - } - - float get_charged_damage(void) { - return *(float*)(this + 0x109C); - } - - float get_last_attack(void) { - return *(float*)(this + 0x1064); - } - - float get_next_primary_attack(void) { - return *(float*)(this + 0xE94); - } + return (owner->get_tickbase() * TICK_INTERVAL) - this->get_last_attack() > 1.f; + } - float get_next_secondary_attack(void) { - return *(float*)(this + 0xE98); - } + float get_charged_damage(void) { + return *reinterpret_cast(this + 0x109C); + } - bool can_primary_attack() { - Entity* owner = this->get_owner_entity(); - if (owner == nullptr) - return false; + float get_last_attack(void) { + return *reinterpret_cast(this + 0x1064); + } - float next_attack = *(float*)(owner + 0x1088); - float next_primary_attack = this->get_next_primary_attack(); - float time = owner->get_tickbase() * global_vars->interval_per_tick; - - return (next_primary_attack <= time && next_attack <= time); - } + float get_next_primary_attack(void) { + return *reinterpret_cast(this + 0xE94); + } - bool can_secondary_attack() { - Entity* owner = this->get_owner_entity(); - if (owner == nullptr) - return false; - - float next_attack = *(float*)(owner + 0x1088); - float next_secondary_attack = this->get_next_secondary_attack(); - float time = owner->get_tickbase() * global_vars->interval_per_tick; - - return (next_secondary_attack <= time && next_attack <= time); - } + float get_next_secondary_attack(void) { + return *reinterpret_cast(this + 0xE98); + } + bool can_primary_attack() { + Entity *owner = this->get_owner_entity(); + if (owner == nullptr) + return false; + + float next_attack = *reinterpret_cast(owner + 0x1088); + float next_primary_attack = this->get_next_primary_attack(); + float time = owner->get_tickbase() * global_vars->interval_per_tick; + + return (next_primary_attack <= time && next_attack <= time); + } + + bool can_secondary_attack() { + Entity *owner = this->get_owner_entity(); + if (owner == nullptr) + return false; + + float next_attack = *reinterpret_cast(owner + 0x1088); + float next_secondary_attack = this->get_next_secondary_attack(); + float time = owner->get_tickbase() * global_vars->interval_per_tick; + + return (next_secondary_attack <= time && next_attack <= time); + } }; #endif diff --git a/gui/config.hpp b/gui/config.hpp index 47f1494..1eaa6d6 100644 --- a/gui/config.hpp +++ b/gui/config.hpp @@ -9,123 +9,122 @@ #include "../vec.hpp" struct button { - int button; - bool waiting = false; + int button; + bool waiting = false; }; struct Aim { - bool master = true; - - bool auto_shoot = true; - - bool silent = true; - - struct button key = {.button = -SDL_BUTTON_X1}; - bool use_key = true; - - float fov = 45; - bool draw_fov = false; - - bool auto_scope = false; - - bool ignore_friends = true; + bool master = true; + + bool auto_shoot = true; + + bool silent = true; + + struct button key = {.button = -SDL_BUTTON_X1}; + bool use_key = true; + + float fov = 45; + bool draw_fov = false; + + bool auto_scope = false; + + bool ignore_friends = true; }; struct Esp { - bool master = true; - - struct Player { - RGBA_float enemy_color = {.r = 1, .g = 0.501960784, .b = 0, .a = 1}; - RGBA_float team_color = {.r = 1, .g = 1, .b = 1, .a = 1}; - RGBA_float friend_color = {.r = 0, .g = 0.862745098, .b = 0.31372549, .a = 1}; - - bool box = true; - bool health_bar = true; - bool name = true; - - struct Flags { - bool target_indicator = true; - bool friend_indicator = true; - } flags; - - bool friends = true; - bool team = false; - } player; - - struct Pickup { - bool box = false; - bool name = true; - } pickup; - - struct Buildings { - bool box = true; - bool health_bar = true; - bool name = true; - - bool team = false; - } buildings; + bool master = true; + + struct Player { + RGBA_float enemy_color = {.r = 1, .g = 0.501960784, .b = 0, .a = 1}; + RGBA_float team_color = {.r = 1, .g = 1, .b = 1, .a = 1}; + RGBA_float friend_color = {.r = 0, .g = 0.862745098, .b = 0.31372549, .a = 1}; + + bool box = true; + bool health_bar = true; + bool name = true; + + struct Flags { + bool target_indicator = true; + bool friend_indicator = true; + } flags; + + bool friends = true; + bool team = false; + } player; + + struct Pickup { + bool box = false; + bool name = true; + } pickup; + + struct Buildings { + bool box = true; + bool health_bar = true; + bool name = true; + + bool team = false; + } buildings; }; struct Visuals { - - struct Removals { - bool scope = false; - bool zoom = false; - } removals; - - struct Thirdperson { - struct button key = {.button = SDL_SCANCODE_LALT}; - bool enabled = false; - float z = 150.0f; - float y = 20.0f; - float x = 0; - } thirdperson; - - bool override_fov = false; - float custom_fov = 90; + struct Removals { + bool scope = false; + bool zoom = false; + } removals; + + struct Thirdperson { + struct button key = {.button = SDL_SCANCODE_LALT}; + bool enabled = false; + float z = 150.0f; + float y = 20.0f; + float x = 0; + } thirdperson; + + bool override_fov = false; + float custom_fov = 90; }; struct Misc { - bool bhop = true; - bool bypasspure = true; - bool no_push = false; + bool bhop = true; + bool bypasspure = true; + bool no_push = false; }; struct Debug { - int font_height = 14; - int font_weight = 400; - bool debug_render_all_entities = false; + int font_height = 14; + int font_weight = 400; + bool debug_render_all_entities = false; }; struct Config { - Aim aimbot; - Esp esp; - Visuals visuals; - Misc misc; - Debug debug; + Aim aimbot; + Esp esp; + Visuals visuals; + Misc misc; + Debug debug; }; inline static Config config; static bool is_button_down(struct button button) { - if (button.button >= 0) { - const uint8_t* keys = SDL_GetKeyboardState(NULL); - - if (keys[button.button] == 1) - return true; + if (button.button >= 0) { + const uint8_t *keys = SDL_GetKeyboardState(NULL); - return false; - } else { - Uint32 mouse_state = SDL_GetMouseState(NULL, NULL); + if (keys[button.button] == 1) + return true; - if (mouse_state & SDL_BUTTON(-button.button)) - return true; + return false; + } else { + Uint32 mouse_state = SDL_GetMouseState(NULL, NULL); - return false; - } + if (mouse_state & SDL_BUTTON(-button.button)) + return true; - return false; + return false; + } + + return false; } #endif diff --git a/gui/imgui/dearimgui.hpp b/gui/imgui/dearimgui.hpp index f394a7b..c52a4fc 100644 --- a/gui/imgui/dearimgui.hpp +++ b/gui/imgui/dearimgui.hpp @@ -46,14 +46,14 @@ namespace ImGui { } } - static void KeybindBox(bool* waitingFlag, int* keycode) { + static void KeybindBox(bool* waitingFlag, const int* keycode) { std::string buttonLabel; if (*waitingFlag) buttonLabel = "..."; else if (*keycode == SDLK_UNKNOWN) buttonLabel = " "; else - buttonLabel = GetKeyName((SDL_Scancode)*keycode); + buttonLabel = GetKeyName(static_cast(*keycode)); if (ImGui::Button(buttonLabel.c_str(), ImVec2(90, 20))) { *waitingFlag = true; diff --git a/gui/menu.cpp b/gui/menu.cpp index acb31ea..22db9da 100644 --- a/gui/menu.cpp +++ b/gui/menu.cpp @@ -5,269 +5,273 @@ #include "imgui/dearimgui.hpp" -#include - inline static bool menu_focused = false; -void get_input(SDL_Event* event) { - ImGui::KeybindEvent(event, &config.aimbot.key.waiting, &config.aimbot.key.button); - ImGui::KeybindEvent(event, &config.visuals.thirdperson.key.waiting, &config.visuals.thirdperson.key.button); +void get_input(SDL_Event *event) { + ImGui::KeybindEvent(event, &config.aimbot.key.waiting, &config.aimbot.key.button); + ImGui::KeybindEvent(event, &config.visuals.thirdperson.key.waiting, &config.visuals.thirdperson.key.button); } void draw_aim_tab() { - ImGui::SetCursorPosY(ImGui::GetWindowHeight() - 27); - - ImGui::Checkbox("Master", &config.aimbot.master); + ImGui::SetCursorPosY(ImGui::GetWindowHeight() - 27); + + ImGui::Checkbox("Master", &config.aimbot.master); + + + ImGui::EndGroup(); + + ImGui::SameLine(); + ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); + ImGui::SameLine(); + + ImGui::BeginGroup(); - ImGui::EndGroup(); + ImGui::Checkbox("Auto Shoot", &config.aimbot.auto_shoot); - ImGui::SameLine(); - ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); - ImGui::SameLine(); + ImGui::Text("Aimbot Key: "); + ImGui::SameLine(); + ImGui::KeybindBox(&config.aimbot.key.waiting, &config.aimbot.key.button); + ImGui::SameLine(); + ImGui::Checkbox("Use Key", &config.aimbot.use_key); + ImGui::Checkbox("Silent", &config.aimbot.silent); - ImGui::BeginGroup(); + ImGui::Text("FOV: "); + ImGui::SameLine(); + ImGui::SliderFloatHeightPad(" ", &config.aimbot.fov, 0.1f, 180.0f, 1, "%.0f\xC2\xB0"); - ImGui::Checkbox("Auto Shoot", &config.aimbot.auto_shoot); + ImGui::Checkbox("Draw FOV", &config.aimbot.draw_fov); - ImGui::Text("Aimbot botton: "); - ImGui::SameLine(); - ImGui::KeybindBox(&config.aimbot.key.waiting, &config.aimbot.key.button); - ImGui::SameLine(); - ImGui::Checkbox("Use Button", &config.aimbot.use_key); + ImGui::Checkbox("Sniper Auto Scope", &config.aimbot.auto_scope); - ImGui::Checkbox("Silent", &config.aimbot.silent); - - ImGui::Text("FOV: "); - ImGui::SameLine(); - ImGui::SliderFloatHeightPad(" ", &config.aimbot.fov, 0.1f, 180.0f, 1, "%.0f\xC2\xB0"); - - ImGui::Checkbox("Draw FOV", &config.aimbot.draw_fov); + ImGui::Checkbox("Ignore Friends", &config.aimbot.ignore_friends); - ImGui::Checkbox("Sniper auto scope", &config.aimbot.auto_scope); - - ImGui::Checkbox("Ignore Friends", &config.aimbot.ignore_friends); - - ImGui::EndGroup(); + ImGui::EndGroup(); } -void draw_esp_tab() { - ImGui::SetCursorPosY(ImGui::GetWindowHeight() - 27); - - ImGui::Checkbox("Master", &config.esp.master); - - ImGui::EndGroup(); - - ImGui::SameLine(); - ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); - ImGui::SameLine(); - - /* ESP */ - ImGui::BeginGroup(); - - //Player - ImGui::BeginGroup(); - ImGui::Text("Player"); - ImGui::ColorEdit4("Enemy Color##Player", config.esp.player.enemy_color.to_arr(), ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_NoInputs); - ImGui::ColorEdit4("Team Color##Player", config.esp.player.team_color.to_arr(), ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_NoInputs); - ImGui::ColorEdit4("Friend Color##Player", config.esp.player.friend_color.to_arr(), ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_NoInputs); - ImGui::Checkbox("Box##Player", &config.esp.player.box); - ImGui::Checkbox("Health Bar##Player", &config.esp.player.health_bar); - ImGui::Checkbox("Name##Player", &config.esp.player.name); - ImGui::NewLine(); - ImGui::Text("Flags"); - ImGui::Checkbox("Target##Player", &config.esp.player.flags.target_indicator); - ImGui::Checkbox("Friend##Player", &config.esp.player.flags.friend_indicator); - ImGui::NewLine(); - ImGui::Text("Misc"); - ImGui::Checkbox("Friends##Player", &config.esp.player.friends); - ImGui::Checkbox("Team##Player", &config.esp.player.team); - ImGui::EndGroup(); - - ImGui::SameLine(); - ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); - ImGui::SameLine(); - - //Pickups (health and ammo etc) - ImGui::BeginGroup(); - ImGui::Text("Pickup"); - ImGui::Checkbox("Box##Pickup", &config.esp.pickup.box); - ImGui::Checkbox("Name##Pickup", &config.esp.pickup.name); - ImGui::EndGroup(); - - ImGui::SameLine(); - ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); - ImGui::SameLine(); - - //Buildings - ImGui::BeginGroup(); - ImGui::Text("Buildings"); - ImGui::Checkbox("Box##Buildings", &config.esp.buildings.box); - ImGui::Checkbox("Health Bar##Buildings", &config.esp.buildings.health_bar); - ImGui::Checkbox("Name##Buildings", &config.esp.buildings.name); - ImGui::NewLine(); - ImGui::Text("Misc"); - ImGui::Checkbox("Team##Buildings", &config.esp.buildings.team); - ImGui::EndGroup(); - - ImGui::EndGroup(); +void draw_esp_tab() { + ImGui::SetCursorPosY(ImGui::GetWindowHeight() - 27); + + ImGui::Checkbox("Master", &config.esp.master); + + ImGui::EndGroup(); + + ImGui::SameLine(); + ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); + ImGui::SameLine(); + + /* ESP */ + ImGui::BeginGroup(); + + //Player + ImGui::BeginGroup(); + ImGui::Text("Player"); + ImGui::ColorEdit4("Enemy Color##Player", config.esp.player.enemy_color.to_arr(), + ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_NoInputs); + ImGui::ColorEdit4("Team Color##Player", config.esp.player.team_color.to_arr(), + ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_NoInputs); + ImGui::ColorEdit4("Friend Color##Player", config.esp.player.friend_color.to_arr(), + ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_NoInputs); + ImGui::Checkbox("Box##Player", &config.esp.player.box); + ImGui::Checkbox("Health Bar##Player", &config.esp.player.health_bar); + ImGui::Checkbox("Name##Player", &config.esp.player.name); + ImGui::NewLine(); + ImGui::Text("Flags"); + ImGui::Checkbox("Target##Player", &config.esp.player.flags.target_indicator); + ImGui::Checkbox("Friend##Player", &config.esp.player.flags.friend_indicator); + ImGui::NewLine(); + ImGui::Text("Misc"); + ImGui::Checkbox("Friends##Player", &config.esp.player.friends); + ImGui::Checkbox("Team##Player", &config.esp.player.team); + ImGui::EndGroup(); + + ImGui::SameLine(); + ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); + ImGui::SameLine(); + + //Pickups (health and ammo etc) + ImGui::BeginGroup(); + ImGui::Text("Pickup"); + ImGui::Checkbox("Box##Pickup", &config.esp.pickup.box); + ImGui::Checkbox("Name##Pickup", &config.esp.pickup.name); + ImGui::EndGroup(); + + ImGui::SameLine(); + ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); + ImGui::SameLine(); + + //Buildings + ImGui::BeginGroup(); + ImGui::Text("Buildings"); + ImGui::Checkbox("Box##Buildings", &config.esp.buildings.box); + ImGui::Checkbox("Health Bar##Buildings", &config.esp.buildings.health_bar); + ImGui::Checkbox("Name##Buildings", &config.esp.buildings.name); + ImGui::NewLine(); + ImGui::Text("Misc"); + ImGui::Checkbox("Team##Buildings", &config.esp.buildings.team); + ImGui::EndGroup(); + + ImGui::EndGroup(); } void draw_visuals_tab() { - ImGui::SetCursorPosY(ImGui::GetWindowHeight() - 21); - - ImGui::Text(" "); - - ImGui::EndGroup(); - - ImGui::SameLine(); - ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); - ImGui::SameLine(); - - /* Visuals */ - ImGui::BeginGroup(); - - /* Removals */ //maybe make me a drop down - ImGui::BeginGroup(); - ImGui::Text("Removals"); - ImGui::Checkbox("Scope", &config.visuals.removals.scope); - ImGui::Checkbox("Zoom", &config.visuals.removals.zoom); - - ImGui::NewLine(); - ImGui::NewLine(); - ImGui::NewLine(); - ImGui::NewLine(); - - ImGui::EndGroup(); - - ImGui::SameLine(); - ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); - ImGui::SameLine(); - - /* Camera */ - ImGui::BeginGroup(); - ImGui::Text("Camera"); - ImGui::Text("Key: "); ImGui::SameLine(); - ImGui::KeybindBox(&config.visuals.thirdperson.key.waiting, &config.visuals.thirdperson.key.button); ImGui::SameLine(); - ImGui::Checkbox("Thirdperson", &config.visuals.thirdperson.enabled); - ImGui::SliderFloatHeightPad("Z##CameraZ", &config.visuals.thirdperson.z, 20.0f, 500.0f, 0, "%.1f"); - ImGui::SliderFloatHeightPad("Y##CameraY", &config.visuals.thirdperson.y, -50.0f, 50.0f, 0, "%.1f"); - ImGui::SliderFloatHeightPad("X##CameraX", &config.visuals.thirdperson.x, -50.0f, 50.0f, 0, "%.1f"); - - - ImGui::NewLine(); - ImGui::NewLine(); - - ImGui::Checkbox("Override FOV", &config.visuals.override_fov); - ImGui::SliderFloat(" ", &config.visuals.custom_fov, 30.1f, 150.0f, "%.0f\xC2\xB0"); - ImGui::EndGroup(); - - ImGui::EndGroup(); + ImGui::SetCursorPosY(ImGui::GetWindowHeight() - 21); + + ImGui::Text(" "); + + ImGui::EndGroup(); + + ImGui::SameLine(); + ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); + ImGui::SameLine(); + + /* Visuals */ + ImGui::BeginGroup(); + + /* Removals */ //maybe make me a drop down + ImGui::BeginGroup(); + ImGui::Text("Removals"); + ImGui::Checkbox("Scope", &config.visuals.removals.scope); + ImGui::Checkbox("Zoom", &config.visuals.removals.zoom); + + ImGui::NewLine(); + ImGui::NewLine(); + ImGui::NewLine(); + ImGui::NewLine(); + + ImGui::EndGroup(); + + ImGui::SameLine(); + ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); + ImGui::SameLine(); + + /* Camera */ + ImGui::BeginGroup(); + ImGui::Text("Camera"); + ImGui::Text("Key: "); + ImGui::SameLine(); + ImGui::KeybindBox(&config.visuals.thirdperson.key.waiting, &config.visuals.thirdperson.key.button); + ImGui::SameLine(); + ImGui::Checkbox("Thirdperson", &config.visuals.thirdperson.enabled); + ImGui::SliderFloatHeightPad("Z##CameraZ", &config.visuals.thirdperson.z, 20.0f, 500.0f, 0, "%.1f"); + ImGui::SliderFloatHeightPad("Y##CameraY", &config.visuals.thirdperson.y, -50.0f, 50.0f, 0, "%.1f"); + ImGui::SliderFloatHeightPad("X##CameraX", &config.visuals.thirdperson.x, -50.0f, 50.0f, 0, "%.1f"); + + + ImGui::NewLine(); + ImGui::NewLine(); + + ImGui::Checkbox("Override FOV", &config.visuals.override_fov); + ImGui::SliderFloat(" ", &config.visuals.custom_fov, 30.1f, 150.0f, "%.0f\xC2\xB0"); + ImGui::EndGroup(); + + ImGui::EndGroup(); } void draw_misc_tab() { - ImGui::SetCursorPosY(ImGui::GetWindowHeight() - 21); + ImGui::SetCursorPosY(ImGui::GetWindowHeight() - 21); - ImGui::Text(" "); + ImGui::Text(" "); - ImGui::EndGroup(); + ImGui::EndGroup(); - ImGui::SameLine(); - ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); - ImGui::SameLine(); + ImGui::SameLine(); + ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); + ImGui::SameLine(); - ImGui::BeginGroup(); - - ImGui::Text("General"); - ImGui::Checkbox("Bhop", &config.misc.bhop); - ImGui::Checkbox("Bypass sv_pure", &config.misc.bypasspure); - ImGui::Checkbox("No Push", &config.misc.no_push); + ImGui::BeginGroup(); - ImGui::EndGroup(); + ImGui::Text("General"); + ImGui::Checkbox("Bhop", &config.misc.bhop); + ImGui::Checkbox("Bypass sv_pure", &config.misc.bypasspure); + ImGui::Checkbox("No Push", &config.misc.no_push); + + ImGui::EndGroup(); } void draw_debug_tab() { - ImGui::SetCursorPosY(ImGui::GetWindowHeight() - 21); + ImGui::SetCursorPosY(ImGui::GetWindowHeight() - 21); + + ImGui::Text(" "); + + ImGui::EndGroup(); - ImGui::Text(" "); + ImGui::SameLine(); + ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); + ImGui::SameLine(); - ImGui::EndGroup(); + ImGui::BeginGroup(); - ImGui::SameLine(); - ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); - ImGui::SameLine(); - - ImGui::BeginGroup(); + ImGui::SliderInt("Font Height", &config.debug.font_height, 6, 60); + ImGui::SliderInt("Font Weight", &config.debug.font_weight, 50, 800); + ImGui::Checkbox("Draw All Entities", &config.debug.debug_render_all_entities); - ImGui::SliderInt("Font Height", &config.debug.font_height, 6, 60); - ImGui::SliderInt("Font Weight", &config.debug.font_weight, 50, 800); - ImGui::Checkbox("Draw All Entities", &config.debug.debug_render_all_entities); - - ImGui::EndGroup(); + ImGui::EndGroup(); } -void draw_tab(ImGuiStyle* style, const char* name, int* tab, int index) { - ImVec4 orig_box_color = ImVec4(0.15, 0.15, 0.15, 1); - - if (*tab == index) { - style->Colors[ImGuiCol_Button] = ImVec4(orig_box_color.x + 0.15, orig_box_color.y + 0.15, orig_box_color.z + 0.15, 1.00f); - } else { +void draw_tab(ImGuiStyle *style, const char *name, int *tab, int index) { + constexpr ImVec4 orig_box_color = ImVec4(0.15, 0.15, 0.15, 1); + + if (*tab == index) { + style->Colors[ImGuiCol_Button] = ImVec4(orig_box_color.x + 0.15, orig_box_color.y + 0.15, + orig_box_color.z + 0.15, 1.00f); + } else { + style->Colors[ImGuiCol_Button] = ImVec4(0.15, 0.15, 0.15, 1); + } + + if (ImGui::Button(name, ImVec2(80, 30))) { + *tab = index; + } style->Colors[ImGuiCol_Button] = ImVec4(0.15, 0.15, 0.15, 1); - } - - if (ImGui::Button(name, ImVec2(80, 30))) { - *tab = index; - } - style->Colors[ImGuiCol_Button] = ImVec4(0.15, 0.15, 0.15, 1); } void draw_menu() { - ImGui::SetNextWindowSize(ImVec2(600, 350)); - if (ImGui::Begin("Team Fortress 2 GNU/Linux", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse)) { - static int tab = 0; - - ImGuiStyle* style = &ImGui::GetStyle(); - - style->Colors[ImGuiCol_WindowBg] = ImVec4(0.1, 0.1, 0.1, 1); - style->Colors[ImGuiCol_TitleBgActive] = ImVec4(0.05, 0.05, 0.05, 1); - style->Colors[ImGuiCol_TitleBg] = ImVec4(0.05, 0.05, 0.05, 1); - style->Colors[ImGuiCol_CheckMark] = ImVec4(0.869346734, 0.450980392, 0.211764706, 1); - style->Colors[ImGuiCol_FrameBg] = ImVec4(0.15, 0.15, 0.15, 1); - style->Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.869346734, 0.450980392, 0.211764706, 0.5); - style->Colors[ImGuiCol_FrameBgActive] = ImVec4(0.919346734, 0.500980392, 0.261764706, 0.6); - style->Colors[ImGuiCol_ButtonHovered] = ImVec4(0.869346734, 0.450980392, 0.211764706, 0.5); - style->Colors[ImGuiCol_ButtonActive] = ImVec4(0.919346734, 0.500980392, 0.261764706, 0.6); - style->Colors[ImGuiCol_SliderGrab] = ImVec4(0.869346734, 0.450980392, 0.211764706, 1); - style->Colors[ImGuiCol_SliderGrabActive] = ImVec4(0.899346734, 0.480980392, 0.241764706, 1); - style->GrabMinSize = 2; - - ImGui::BeginGroup(); - draw_tab(style, "Aimbot", &tab, 0); - draw_tab(style, "ESP", &tab, 1); - draw_tab(style, "Visuals", &tab, 2); - draw_tab(style, "Misc", &tab, 3); - draw_tab(style, "Debug", &tab, 4); - - switch (tab) { - case 0: - draw_aim_tab(); - break; - case 1: - draw_esp_tab(); - break; - case 2: - draw_visuals_tab(); - break; - case 3: - draw_misc_tab(); - break; - case 4: - draw_debug_tab(); - break; + ImGui::SetNextWindowSize(ImVec2(600, 350)); + if (ImGui::Begin("Team Fortress 2 GNU/Linux", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse)) { + static int tab = 0; + + ImGuiStyle *style = &ImGui::GetStyle(); + + style->Colors[ImGuiCol_WindowBg] = ImVec4(0.1, 0.1, 0.1, 1); + style->Colors[ImGuiCol_TitleBgActive] = ImVec4(0.05, 0.05, 0.05, 1); + style->Colors[ImGuiCol_TitleBg] = ImVec4(0.05, 0.05, 0.05, 1); + style->Colors[ImGuiCol_CheckMark] = ImVec4(0.869346734, 0.450980392, 0.211764706, 1); + style->Colors[ImGuiCol_FrameBg] = ImVec4(0.15, 0.15, 0.15, 1); + style->Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.869346734, 0.450980392, 0.211764706, 0.5); + style->Colors[ImGuiCol_FrameBgActive] = ImVec4(0.919346734, 0.500980392, 0.261764706, 0.6); + style->Colors[ImGuiCol_ButtonHovered] = ImVec4(0.869346734, 0.450980392, 0.211764706, 0.5); + style->Colors[ImGuiCol_ButtonActive] = ImVec4(0.919346734, 0.500980392, 0.261764706, 0.6); + style->Colors[ImGuiCol_SliderGrab] = ImVec4(0.869346734, 0.450980392, 0.211764706, 1); + style->Colors[ImGuiCol_SliderGrabActive] = ImVec4(0.899346734, 0.480980392, 0.241764706, 1); + style->GrabMinSize = 2; + + ImGui::BeginGroup(); + draw_tab(style, "Aimbot", &tab, 0); + draw_tab(style, "ESP", &tab, 1); + draw_tab(style, "Visuals", &tab, 2); + draw_tab(style, "Misc", &tab, 3); + draw_tab(style, "Debug", &tab, 4); + + switch (tab) { + case 0: + draw_aim_tab(); + break; + case 1: + draw_esp_tab(); + break; + case 2: + draw_visuals_tab(); + break; + case 3: + draw_misc_tab(); + break; + case 4: + draw_debug_tab(); + break; + default: break; + } } - } - - ImGui::End(); -} + ImGui::End(); +} diff --git a/hacks/aimbot/aimbot.cpp b/hacks/aimbot/aimbot.cpp index 47ad015..7fed474 100644 --- a/hacks/aimbot/aimbot.cpp +++ b/hacks/aimbot/aimbot.cpp @@ -13,162 +13,167 @@ #include "../../print.hpp" -bool is_player_visible(Player* localplayer, Player* entity, int bone) { - Vec3 target_pos = entity->get_bone_pos(bone); - Vec3 start_pos = localplayer->get_shoot_pos(); - - struct ray_t ray = engine_trace->init_ray(&start_pos, &target_pos); - struct trace_filter filter; - engine_trace->init_trace_filter(&filter, localplayer); - - struct trace_t trace; - engine_trace->trace_ray(&ray, 0x4200400b, &filter, &trace); - - if (trace.entity == entity || trace.fraction > 0.97f) { - return true; - } - - return false; +bool is_player_visible(Player *localplayer, Player *entity, int bone) { + Vec3 target_pos = entity->get_bone_pos(bone); + Vec3 start_pos = localplayer->get_shoot_pos(); + + struct ray_t ray = engine_trace->init_ray(&start_pos, &target_pos); + struct trace_filter filter; + engine_trace->init_trace_filter(&filter, localplayer); + + struct trace_t trace; + engine_trace->trace_ray(&ray, 0x4200400b, &filter, &trace); + + if (trace.entity == entity || trace.fraction > 0.97f) { + return true; + } + + return false; } -void movement_fix(user_cmd* user_cmd, Vec3 original_view_angle, float original_forward_move, float original_side_move) { - float yaw_delta = user_cmd->view_angles.y - original_view_angle.y; - float original_yaw_correction = 0; - float current_yaw_correction = 0; - - if (original_view_angle.y < 0.0f) { - original_yaw_correction = 360.0f + original_view_angle.y; - } else { - original_yaw_correction = original_view_angle.y; - } - - if (user_cmd->view_angles.y < 0.0f) { - current_yaw_correction = 360.0f + user_cmd->view_angles.y; - } else { - current_yaw_correction = user_cmd->view_angles.y; - } - - if (current_yaw_correction < original_yaw_correction) { - yaw_delta = abs(current_yaw_correction - original_yaw_correction); - } else { - yaw_delta = 360.0f - abs(original_yaw_correction - current_yaw_correction); - } - yaw_delta = 360.0f - yaw_delta; - - user_cmd->forwardmove = cos((yaw_delta) * (M_PI/180)) * original_forward_move + cos((yaw_delta + 90.f) * (M_PI/180)) * original_side_move; - user_cmd->sidemove = sin((yaw_delta) * (M_PI/180)) * original_forward_move + sin((yaw_delta + 90.f) * (M_PI/180)) * original_side_move; +void movement_fix(user_cmd *user_cmd, Vec3 original_view_angle, float original_forward_move, float original_side_move) { + float yaw_delta = user_cmd->view_angles.y - original_view_angle.y; + float original_yaw_correction = 0; + float current_yaw_correction = 0; + + if (original_view_angle.y < 0.0f) { + original_yaw_correction = 360.0f + original_view_angle.y; + } else { + original_yaw_correction = original_view_angle.y; + } + + if (user_cmd->view_angles.y < 0.0f) { + current_yaw_correction = 360.0f + user_cmd->view_angles.y; + } else { + current_yaw_correction = user_cmd->view_angles.y; + } + + if (current_yaw_correction < original_yaw_correction) { + yaw_delta = abs(current_yaw_correction - original_yaw_correction); + } else { + yaw_delta = 360.0f - abs(original_yaw_correction - current_yaw_correction); + } + yaw_delta = 360.0f - yaw_delta; + + user_cmd->forwardmove = cos((yaw_delta) * (M_PI / 180)) * original_forward_move + cos( + (yaw_delta + 90.f) * (M_PI / 180)) * original_side_move; + user_cmd->sidemove = sin((yaw_delta) * (M_PI / 180)) * original_forward_move + sin( + (yaw_delta + 90.f) * (M_PI / 180)) * original_side_move; } -void aimbot(user_cmd* user_cmd) { - if (config.aimbot.master == false) { - target_player = nullptr; - return; - } - - Player* localplayer = entity_list->get_localplayer(); - if (localplayer->get_lifestate() != 1) { - target_player = nullptr; - return; - } - - Weapon* weapon = localplayer->get_weapon(); - if (weapon == nullptr) { - target_player = nullptr; - return; - } - - if (target_player != nullptr && target_player->is_friend() && config.aimbot.ignore_friends == true) { - target_player = nullptr; - } - - Vec3 original_view_angle = user_cmd->view_angles; - float original_side_move = user_cmd->sidemove; - float original_forward_move = user_cmd->forwardmove; - - bool friendlyfire = false; - static Convar* friendlyfirevar = convar_system->find_var("mp_friendlyfire"); - if (friendlyfirevar != nullptr) { - if (friendlyfirevar->get_int() != 0) { - friendlyfire = true; +void aimbot(user_cmd *user_cmd) { + if (!config.aimbot.master) { + target_player = nullptr; + return; } - } - - float smallest_fov_angle = __FLT_MAX__; - - for (unsigned int i = 1; i <= entity_list->get_max_entities(); ++i) { - Player* player = entity_list->player_from_index(i); - - if (player == nullptr || - player == localplayer || - player->is_dormant() == true || - (player->get_team() == localplayer->get_team() && friendlyfire == false) || - player->get_lifestate() != 1 || - player->is_invulnerable() == true || - (config.aimbot.ignore_friends == true && player->is_friend())) - { - continue; - } - - int bone = player->get_tf_class() == CLASS_ENGINEER ? 5 : 2; // Aim at body by default - - // Aim for head - if (localplayer->get_tf_class() == CLASS_SNIPER) { - if (localplayer->is_scoped() && player->get_health() > 50) - bone = player->get_head_bone(); - } else if (localplayer->get_tf_class() == CLASS_SPY) { - if (weapon->is_headshot_weapon()) - bone = player->get_head_bone(); + + Player *localplayer = entity_list->get_localplayer(); + if (localplayer->get_lifestate() != 1) { + target_player = nullptr; + return; + } + + Weapon *weapon = localplayer->get_weapon(); + if (weapon == nullptr) { + target_player = nullptr; + return; } - - Vec3 diff = {player->get_bone_pos(bone).x - localplayer->get_shoot_pos().x, - player->get_bone_pos(bone).y - localplayer->get_shoot_pos().y, - player->get_bone_pos(bone).z - localplayer->get_shoot_pos().z}; - - float yaw_hyp = sqrt((diff.x * diff.x) + (diff.y * diff.y)); - - float pitch_angle = atan2(diff.z, yaw_hyp) * 180 / M_PI; - float yaw_angle = atan2(diff.y, diff.x) * 180 / M_PI; - - Vec3 view_angles = { - .x = -pitch_angle, - .y = yaw_angle, - .z = 0 - }; - - float x_diff = view_angles.x - original_view_angle.x; - float y_diff = view_angles.y - original_view_angle.y; - - float x = remainderf(x_diff, 360.0f); - float y = remainderf(y_diff, 360.0f); - - float clamped_x = x > 89.0f ? 89.0f : x < -89.0f ? -89.0f : x; - float clamped_y = y > 180.0f ? 180.0f : y < -180.0f ? -180.0f : y; - - float fov = hypotf(clamped_x, clamped_y); - - bool visible = is_player_visible(localplayer, player, bone); - - if (visible == true && fov <= config.aimbot.fov && fov < smallest_fov_angle) { - target_player = player; - smallest_fov_angle = fov; + + if (target_player && target_player->is_friend() && config.aimbot.ignore_friends) { + target_player = nullptr; } - - if (target_player == player && (fov > config.aimbot.fov || visible == false)) - target_player = nullptr; - - - if (((is_button_down(config.aimbot.key) && config.aimbot.use_key) || !config.aimbot.use_key) && config.aimbot.auto_shoot == true && target_player == player && localplayer->can_shoot(target_player)) { - if (config.aimbot.auto_scope == true && localplayer->get_tf_class() == CLASS_SNIPER && !localplayer->is_scoped() && weapon->can_primary_attack()) - user_cmd->buttons |= IN_ATTACK2; - - user_cmd->buttons |= IN_ATTACK; + + Vec3 original_view_angle = user_cmd->view_angles; + float original_side_move = user_cmd->sidemove; + float original_forward_move = user_cmd->forwardmove; + + bool friendlyfire = false; + static Convar *friendlyfirevar = convar_system->find_var("mp_friendlyfire"); + if (friendlyfirevar) { + if (friendlyfirevar->get_int() != 0) { + friendlyfire = true; + } } - - - if (((is_button_down(config.aimbot.key) && config.aimbot.use_key) || !config.aimbot.use_key) && weapon->can_primary_attack() && target_player == player) - user_cmd->view_angles = view_angles; - } + float smallest_fov_angle = __FLT_MAX__; + + for (unsigned int i = 1; i <= entity_list->get_max_entities(); ++i) { + Player *player = entity_list->player_from_index(i); + + if (player == nullptr || + player == localplayer || + player->is_dormant() || + (player->get_team() == localplayer->get_team() && !friendlyfire) || + player->get_lifestate() != 1 || + player->is_invulnerable() || + (config.aimbot.ignore_friends && player->is_friend())) { + continue; + } + + int bone = player->get_tf_class() == CLASS_ENGINEER ? 5 : 2; // Aim at body by default + + // Aim for head + if (localplayer->get_tf_class() == CLASS_SNIPER) { + if (localplayer->is_scoped() && player->get_health() > 50) + bone = player->get_head_bone(); + } else if (localplayer->get_tf_class() == CLASS_SPY) { + if (weapon->is_headshot_weapon()) + bone = player->get_head_bone(); + } + + Vec3 diff = { + player->get_bone_pos(bone).x - localplayer->get_shoot_pos().x, + player->get_bone_pos(bone).y - localplayer->get_shoot_pos().y, + player->get_bone_pos(bone).z - localplayer->get_shoot_pos().z + }; + + float yaw_hyp = sqrt((diff.x * diff.x) + (diff.y * diff.y)); + + float pitch_angle = atan2(diff.z, yaw_hyp) * 180 / M_PI; + float yaw_angle = atan2(diff.y, diff.x) * 180 / M_PI; + + Vec3 view_angles = { + .x = -pitch_angle, + .y = yaw_angle, + .z = 0 + }; + + float x_diff = view_angles.x - original_view_angle.x; + float y_diff = view_angles.y - original_view_angle.y; + + float x = remainderf(x_diff, 360.0f); + float y = remainderf(y_diff, 360.0f); + + float clamped_x = x > 89.0f ? 89.0f : x < -89.0f ? -89.0f : x; + float clamped_y = y > 180.0f ? 180.0f : y < -180.0f ? -180.0f : y; + + float fov = hypotf(clamped_x, clamped_y); + + bool visible = is_player_visible(localplayer, player, bone); + + if (visible && fov <= config.aimbot.fov && fov < smallest_fov_angle) { + target_player = player; + smallest_fov_angle = fov; + } + + if (target_player == player && (fov > config.aimbot.fov || !visible)) + target_player = nullptr; + + + if (((is_button_down(config.aimbot.key) && config.aimbot.use_key) || !config.aimbot.use_key) && config.aimbot. + auto_shoot && target_player == player && localplayer->can_shoot(target_player)) { + if (config.aimbot.auto_scope && localplayer->get_tf_class() == CLASS_SNIPER && !localplayer-> + is_scoped() && weapon->can_primary_attack()) + user_cmd->buttons |= IN_ATTACK2; + + user_cmd->buttons |= IN_ATTACK; + } + + + if (((is_button_down(config.aimbot.key) && config.aimbot.use_key) || !config.aimbot.use_key) && weapon-> + can_primary_attack() && target_player == player) + user_cmd->view_angles = view_angles; + } - movement_fix(user_cmd, original_view_angle, original_forward_move, original_side_move); + movement_fix(user_cmd, original_view_angle, original_forward_move, original_side_move); } diff --git a/hacks/aimbot/aimbot.hpp b/hacks/aimbot/aimbot.hpp index 9f05603..984297b 100644 --- a/hacks/aimbot/aimbot.hpp +++ b/hacks/aimbot/aimbot.hpp @@ -3,6 +3,6 @@ #include "../../classes/player.hpp" -inline static Player* target_player = nullptr; +inline static Player *target_player = nullptr; #endif diff --git a/hacks/bhop/bhop.cpp b/hacks/bhop/bhop.cpp index 55a9505..b0a73ae 100644 --- a/hacks/bhop/bhop.cpp +++ b/hacks/bhop/bhop.cpp @@ -5,45 +5,42 @@ #include "../../classes/player.hpp" -void bhop(user_cmd* user_cmd) { - if (config.misc.bhop == false) return; - - Player* localplayer = entity_list->get_localplayer(); - if (localplayer == nullptr) return; - - /* - static bool static_jump = false, static_grounded = false, last_attempted = false; - const bool last_jump = static_jump; - const bool last_grounded = static_grounded; - - static_jump = user_cmd->buttons & IN_JUMP; - const bool cur_jump = static_jump; - - static_grounded = localplayer->get_ground_entity(); - const bool cur_grounded = static_grounded; - - if (cur_jump == true && last_jump == true && (cur_grounded ? !localplayer->is_ducking() : true)) { - if (!(cur_grounded && !last_grounded)) - user_cmd->buttons &= ~IN_JUMP; - - if (!(user_cmd->buttons & IN_JUMP) && cur_grounded && !last_attempted) - user_cmd->buttons |= IN_JUMP; - } - */ - - static bool was_jumping = false; - bool on_ground = (localplayer->get_flags() & FL_ONGROUND); - - if(user_cmd->buttons & IN_JUMP) { - - if(!was_jumping && !on_ground) { - user_cmd->buttons &= ~IN_JUMP; - } else if(was_jumping) { - was_jumping = false; +void bhop(user_cmd *user_cmd) { + if (!config.misc.bhop) return; + + Player *localplayer = entity_list->get_localplayer(); + if (localplayer == nullptr) return; + + /* + static bool static_jump = false, static_grounded = false, last_attempted = false; + const bool last_jump = static_jump; + const bool last_grounded = static_grounded; + + static_jump = user_cmd->buttons & IN_JUMP; + const bool cur_jump = static_jump; + + static_grounded = localplayer->get_ground_entity(); + const bool cur_grounded = static_grounded; + + if (cur_jump && last_jump && (cur_grounded ? !localplayer->is_ducking() : true)) { + if (!(cur_grounded && !last_grounded)) + user_cmd->buttons &= ~IN_JUMP; + + if (!(user_cmd->buttons & IN_JUMP) && cur_grounded && !last_attempted) + user_cmd->buttons |= IN_JUMP; + } + */ + + static bool was_jumping = false; + bool on_ground = (localplayer->get_flags() & FL_ONGROUND); + + if (user_cmd->buttons & IN_JUMP) { + if (!was_jumping && !on_ground) { + user_cmd->buttons &= ~IN_JUMP; + } else if (was_jumping) { + was_jumping = false; + } + } else if (!was_jumping) { + was_jumping = true; } - - } else if(!was_jumping) { - was_jumping = true; - } - } diff --git a/hacks/chams/chams.cpp b/hacks/chams/chams.cpp index adcfdd8..74c51cb 100644 --- a/hacks/chams/chams.cpp +++ b/hacks/chams/chams.cpp @@ -9,66 +9,66 @@ struct model_t { - void* handle; - char* name; - int load_flags; - int server_count; - int type; - int flags; - Vec3 vec_mins; - Vec3 vec_maxs; - float radius; + void *handle; + char *name; + int load_flags; + int server_count; + int type; + int flags; + Vec3 vec_mins; + Vec3 vec_maxs; + float radius; }; typedef struct { - Vec3 origin; - Vec3 angles; - void* pRenderable; - const model_t* model; - const VMatrix* model_to_world; - const VMatrix* lighting_offset; - const Vec3* lighting_origin; - int flags; - int entity_index; - int skin; - int body; - int hitboxset; - short instance; + Vec3 origin; + Vec3 angles; + void *pRenderable; + const model_t *model; + const VMatrix *model_to_world; + const VMatrix *lighting_offset; + const Vec3 *lighting_origin; + int flags; + int entity_index; + int skin; + int body; + int hitboxset; + short instance; } ModelRenderInfo_t; enum MaterialVarFlags_t { - MATERIAL_VAR_DEBUG = (1 << 0), - MATERIAL_VAR_NO_DEBUG_OVERRIDE = (1 << 1), - MATERIAL_VAR_NO_DRAW = (1 << 2), - MATERIAL_VAR_USE_IN_FILLRATE_MODE = (1 << 3), - MATERIAL_VAR_VERTEXCOLOR = (1 << 4), - MATERIAL_VAR_VERTEXALPHA = (1 << 5), - MATERIAL_VAR_SELFILLUM = (1 << 6), - MATERIAL_VAR_ADDITIVE = (1 << 7), - MATERIAL_VAR_ALPHATEST = (1 << 8), - MATERIAL_VAR_MULTIPASS = (1 << 9), - MATERIAL_VAR_ZNEARER = (1 << 10), - MATERIAL_VAR_MODEL = (1 << 11), - MATERIAL_VAR_FLAT = (1 << 12), - MATERIAL_VAR_NOCULL = (1 << 13), - MATERIAL_VAR_NOFOG = (1 << 14), - MATERIAL_VAR_IGNOREZ = (1 << 15), - MATERIAL_VAR_DECAL = (1 << 16), - MATERIAL_VAR_ENVMAPSPHERE = (1 << 17), - MATERIAL_VAR_NOALPHAMOD = (1 << 18), - MATERIAL_VAR_ENVMAPCAMERASPACE = (1 << 19), - MATERIAL_VAR_BASEALPHAENVMAPMASK = (1 << 20), - MATERIAL_VAR_TRANSLUCENT = (1 << 21), - MATERIAL_VAR_NORMALMAPALPHAENVMAPMASK = (1 << 22), - MATERIAL_VAR_NEEDS_SOFTWARE_SKINNING = (1 << 23), - MATERIAL_VAR_OPAQUETEXTURE = (1 << 24), - MATERIAL_VAR_ENVMAPMODE = (1 << 25), - MATERIAL_VAR_SUPPRESS_DECALS = (1 << 26), - MATERIAL_VAR_HALFLAMBERT = (1 << 27), - MATERIAL_VAR_WIREFRAME = (1 << 28), - MATERIAL_VAR_ALLOWALPHATOCOVERAGE = (1 << 29), - MATERIAL_VAR_IGNORE_ALPHA_MODULATION = (1 << 30), + MATERIAL_VAR_DEBUG = (1 << 0), + MATERIAL_VAR_NO_DEBUG_OVERRIDE = (1 << 1), + MATERIAL_VAR_NO_DRAW = (1 << 2), + MATERIAL_VAR_USE_IN_FILLRATE_MODE = (1 << 3), + MATERIAL_VAR_VERTEXCOLOR = (1 << 4), + MATERIAL_VAR_VERTEXALPHA = (1 << 5), + MATERIAL_VAR_SELFILLUM = (1 << 6), + MATERIAL_VAR_ADDITIVE = (1 << 7), + MATERIAL_VAR_ALPHATEST = (1 << 8), + MATERIAL_VAR_MULTIPASS = (1 << 9), + MATERIAL_VAR_ZNEARER = (1 << 10), + MATERIAL_VAR_MODEL = (1 << 11), + MATERIAL_VAR_FLAT = (1 << 12), + MATERIAL_VAR_NOCULL = (1 << 13), + MATERIAL_VAR_NOFOG = (1 << 14), + MATERIAL_VAR_IGNOREZ = (1 << 15), + MATERIAL_VAR_DECAL = (1 << 16), + MATERIAL_VAR_ENVMAPSPHERE = (1 << 17), + MATERIAL_VAR_NOALPHAMOD = (1 << 18), + MATERIAL_VAR_ENVMAPCAMERASPACE = (1 << 19), + MATERIAL_VAR_BASEALPHAENVMAPMASK = (1 << 20), + MATERIAL_VAR_TRANSLUCENT = (1 << 21), + MATERIAL_VAR_NORMALMAPALPHAENVMAPMASK = (1 << 22), + MATERIAL_VAR_NEEDS_SOFTWARE_SKINNING = (1 << 23), + MATERIAL_VAR_OPAQUETEXTURE = (1 << 24), + MATERIAL_VAR_ENVMAPMODE = (1 << 25), + MATERIAL_VAR_SUPPRESS_DECALS = (1 << 26), + MATERIAL_VAR_HALFLAMBERT = (1 << 27), + MATERIAL_VAR_WIREFRAME = (1 << 28), + MATERIAL_VAR_ALLOWALPHATOCOVERAGE = (1 << 29), + MATERIAL_VAR_IGNORE_ALPHA_MODULATION = (1 << 30), }; enum OverrideType_t { @@ -78,32 +78,30 @@ enum OverrideType_t { OVERRIDE_SSAO_DEPTH_WRITE, }; -void (*draw_model_execute_original)(void*, void*, ModelRenderInfo_t*, VMatrix*); +void (*draw_model_execute_original)(void *, void *, ModelRenderInfo_t *, VMatrix *); -void override_material(bool ignorez, bool wireframe, RGBA_float color, const char* mat_name) { - Material* material = material_system->find_material(mat_name, "Model textures", true, NULL); +void override_material(bool ignorez, bool wireframe, RGBA_float color, const char *mat_name) { + Material *material = material_system->find_material(mat_name, "Model textures", true, NULL); - if (!material) - return; + if (!material) + return; - print("%p\n", material); - - render_view->set_color_modulation(&color); - render_view->set_blend(color.a); + print("%p\n", material); - material->set_material_flag(MATERIAL_VAR_IGNOREZ, ignorez); - material->set_material_flag(MATERIAL_VAR_WIREFRAME, wireframe); + render_view->set_color_modulation(&color); + render_view->set_blend(color.a); - model_render->forced_material_override(material, OVERRIDE_NORMAL); -} - -void chams(void* me, void* state, ModelRenderInfo_t* pinfo, VMatrix* bone_to_world) { - if (pinfo->entity_index < 1 || pinfo->entity_index >= entity_list->get_max_entities()) { + material->set_material_flag(MATERIAL_VAR_IGNOREZ, ignorez); + material->set_material_flag(MATERIAL_VAR_WIREFRAME, wireframe); - RGBA_float color = {1, 0, 1, 1}; + model_render->forced_material_override(material, OVERRIDE_NORMAL); +} - override_material(false, false, color, "dev/glow_color"); - return; - } +void chams(void *me, void *state, ModelRenderInfo_t *pinfo, VMatrix *bone_to_world) { + if (pinfo->entity_index < 1 || pinfo->entity_index >= entity_list->get_max_entities()) { + RGBA_float color = {1, 0, 1, 1}; + override_material(false, false, color, "dev/glow_color"); + return; + } } diff --git a/hacks/engine_prediction/engine_prediction.cpp b/hacks/engine_prediction/engine_prediction.cpp index 81524ff..5260b59 100644 --- a/hacks/engine_prediction/engine_prediction.cpp +++ b/hacks/engine_prediction/engine_prediction.cpp @@ -8,77 +8,77 @@ #include "../../random_seed.hpp" -int get_pred_tickbase(user_cmd* user_cmd, Player* localplayer) { - static int tick = 0; - static struct user_cmd* last_cmd = nullptr; +int get_pred_tickbase(user_cmd *user_cmd, Player *localplayer) { + static int tick = 0; + static struct user_cmd *last_cmd = nullptr; - if (user_cmd) { - if (!last_cmd || last_cmd->has_been_predicted) - tick = localplayer->get_tickbase(); + if (user_cmd) { + if (!last_cmd || last_cmd->has_been_predicted) + tick = localplayer->get_tickbase(); - else tick++; + else tick++; - last_cmd = user_cmd; + last_cmd = user_cmd; } - return tick; + return tick; } MoveData move_data = {}; float old_curtime; float old_frametime; int old_tickcount; -void start_engine_prediction(user_cmd* user_cmd) { - Player* localplayer = entity_list->get_localplayer(); - old_curtime = global_vars->curtime; - old_frametime = global_vars->frametime; - old_tickcount = global_vars->tickcount; +void start_engine_prediction(user_cmd *user_cmd) { + Player *localplayer = entity_list->get_localplayer(); - const int old_tickbase = localplayer->get_tickbase(); - const bool old_first_time_predicted = prediction->first_time_predicted; - const bool old_in_prediction = prediction->in_prediction; + old_curtime = global_vars->curtime; + old_frametime = global_vars->frametime; + old_tickcount = global_vars->tickcount; - //move_helper->set_host(localplayer); - - //localplayer->set_current_cmd(user_cmd); + const int old_tickbase = localplayer->get_tickbase(); + const bool old_first_time_predicted = prediction->first_time_predicted; + const bool old_in_prediction = prediction->in_prediction; - //*random_seed = MD5_PseudoRandom(user_cmd->command_number) & INT_MAX; + //move_helper->set_host(localplayer); - global_vars->curtime = get_pred_tickbase(user_cmd, localplayer) * TICK_INTERVAL; - global_vars->frametime = (prediction->engine_paused ? 0.0f : TICK_INTERVAL); - global_vars->tickcount = get_pred_tickbase(user_cmd, localplayer); + //localplayer->set_current_cmd(user_cmd); - prediction->first_time_predicted = false; - prediction->in_prediction = true; + //*random_seed = MD5_PseudoRandom(user_cmd->command_number) & INT_MAX; - //prediction->set_local_view_angles(user_cmd->view_angles); - - /* - prediction->setup_move(localplayer, user_cmd, move_helper, &move_data); - game_movement->process_movement(localplayer, &move_data); - prediction->finish_move(localplayer, user_cmd, &move_data); - */ + global_vars->curtime = get_pred_tickbase(user_cmd, localplayer) * TICK_INTERVAL; + global_vars->frametime = (prediction->engine_paused ? 0.0f : TICK_INTERVAL); + global_vars->tickcount = get_pred_tickbase(user_cmd, localplayer); - /* - prediction->run_command(localplayer, user_cmd, move_helper); - */ - - //move_helper->set_host(nullptr); + prediction->first_time_predicted = false; + prediction->in_prediction = true; - //localplayer->set_tickbase(old_tickbase); + //prediction->set_local_view_angles(user_cmd->view_angles); - prediction->in_prediction = old_in_prediction; - prediction->first_time_predicted = old_first_time_predicted; + /* + prediction->setup_move(localplayer, user_cmd, move_helper, &move_data); + game_movement->process_movement(localplayer, &move_data); + prediction->finish_move(localplayer, user_cmd, &move_data); + */ + /* + prediction->run_command(localplayer, user_cmd, move_helper); + */ + + //move_helper->set_host(nullptr); + + //localplayer->set_tickbase(old_tickbase); + + prediction->in_prediction = old_in_prediction; + prediction->first_time_predicted = old_first_time_predicted; } void end_engine_prediction() { - //localplayer->set_current_cmd(nullptr); + //localplayer->set_current_cmd(nullptr); - global_vars->curtime = old_curtime; - global_vars->frametime = old_frametime; - global_vars->tickcount = old_tickcount; + global_vars->curtime = old_curtime; + global_vars->frametime = old_frametime; + global_vars->tickcount = old_tickcount; - //*random_seed = -1; + //*random_seed = -1; } diff --git a/hacks/esp/esp.hpp b/hacks/esp/esp.hpp index 2804c5c..b8b374b 100644 --- a/hacks/esp/esp.hpp +++ b/hacks/esp/esp.hpp @@ -7,44 +7,44 @@ inline static unsigned long esp_player_font; inline static unsigned long esp_entity_font; static void draw_outline_rectangle(Vec3 screen, Vec3 screen_offset, float width_fraction, RGBA color) { - float box_offset = (screen.y - screen_offset.y)*width_fraction; - - /* shadow box */ - surface->set_rgba(0, 0, 0, 255); - - //right side - surface->draw_line(screen.x + box_offset + 1, screen.y + 1, screen.x + box_offset + 1, screen_offset.y - 1); - surface->draw_line(screen.x + box_offset - 1, screen.y + 1, screen.x + box_offset - 1, screen_offset.y - 1); - - //left side - surface->draw_line(screen.x - box_offset + 1, screen.y + 1, screen.x - box_offset + 1, screen_offset.y - 1); - surface->draw_line(screen.x - box_offset - 1, screen.y + 1, screen.x - box_offset - 1, screen_offset.y - 1); - - //top - surface->draw_line(screen.x - box_offset - 1, screen_offset.y + 1, screen.x + box_offset + 2, screen_offset.y + 1); - surface->draw_line(screen.x - box_offset - 1, screen_offset.y - 1, screen.x + box_offset + 2, screen_offset.y - 1); - - //bottom - surface->draw_line(screen.x - box_offset - 1, screen.y + 1, screen.x + box_offset + 1, screen.y + 1); - surface->draw_line(screen.x - box_offset - 1, screen.y - 1, screen.x + box_offset + 1, screen.y - 1); - /* shadow box */ - - - /* actual box */ - surface->set_rgba(color.r, color.g, color.b, color.a); - - //right side - surface->draw_line(screen.x + box_offset, screen.y, screen.x + box_offset, screen_offset.y); - - //left side - surface->draw_line(screen.x - box_offset, screen.y, screen.x - box_offset, screen_offset.y); - - //top - surface->draw_line(screen.x - box_offset, screen_offset.y, screen.x + box_offset + 1, screen_offset.y); - - //bottom - surface->draw_line(screen.x - box_offset, screen.y, screen.x + box_offset, screen.y); - /* actual box */ + float box_offset = (screen.y - screen_offset.y) * width_fraction; + + /* shadow box */ + surface->set_rgba(0, 0, 0, 255); + + //right side + surface->draw_line(screen.x + box_offset + 1, screen.y + 1, screen.x + box_offset + 1, screen_offset.y - 1); + surface->draw_line(screen.x + box_offset - 1, screen.y + 1, screen.x + box_offset - 1, screen_offset.y - 1); + + //left side + surface->draw_line(screen.x - box_offset + 1, screen.y + 1, screen.x - box_offset + 1, screen_offset.y - 1); + surface->draw_line(screen.x - box_offset - 1, screen.y + 1, screen.x - box_offset - 1, screen_offset.y - 1); + + //top + surface->draw_line(screen.x - box_offset - 1, screen_offset.y + 1, screen.x + box_offset + 2, screen_offset.y + 1); + surface->draw_line(screen.x - box_offset - 1, screen_offset.y - 1, screen.x + box_offset + 2, screen_offset.y - 1); + + //bottom + surface->draw_line(screen.x - box_offset - 1, screen.y + 1, screen.x + box_offset + 1, screen.y + 1); + surface->draw_line(screen.x - box_offset - 1, screen.y - 1, screen.x + box_offset + 1, screen.y - 1); + /* shadow box */ + + + /* actual box */ + surface->set_rgba(color.r, color.g, color.b, color.a); + + //right side + surface->draw_line(screen.x + box_offset, screen.y, screen.x + box_offset, screen_offset.y); + + //left side + surface->draw_line(screen.x - box_offset, screen.y, screen.x - box_offset, screen_offset.y); + + //top + surface->draw_line(screen.x - box_offset, screen_offset.y, screen.x + box_offset + 1, screen_offset.y); + + //bottom + surface->draw_line(screen.x - box_offset, screen.y, screen.x + box_offset, screen.y); + /* actual box */ } #endif diff --git a/hacks/esp/esp_entity.cpp b/hacks/esp/esp_entity.cpp index adf71c2..03f50ca 100644 --- a/hacks/esp/esp_entity.cpp +++ b/hacks/esp/esp_entity.cpp @@ -1,8 +1,8 @@ #include "esp.hpp" -#include +#include #include - + #include "../../classes/player.hpp" #include "../../classes/building.hpp" @@ -15,225 +15,227 @@ #include "../../print.hpp" -void box_esp_entity(Vec3 screen, Entity* entity, Player* localplayer) { - if (config.esp.pickup.box == true && entity->get_pickup_type() != pickup_type::UNKNOWN) { - surface->set_rgba(255, 255, 255, 255); - surface->draw_outlined_rect(screen.x-5, screen.y-5, screen.x+5, screen.y+5); - } - - if (config.esp.buildings.box == true && entity->is_building() && (entity->get_team() != localplayer->get_team() || (entity->get_team() == localplayer->get_team() && config.esp.buildings.team == true))) { - Building* building = (Building*)entity; - if (building->is_carried()) return; - - Vec3 screen_offset; - float box_offset_fraction = 0; - - switch (building->get_class_id()) { - case class_id::DISPENSER: - { - Vec3 location = building->get_origin(); - Vec3 location_offset = {location.x, location.y, location.z + 58}; - render_view->world_to_screen(&location_offset, &screen_offset); - - box_offset_fraction = 0.25; - break; - } - case class_id::SENTRY: - { - - Vec3 location = building->get_origin(); - - float z_offset = 0; - switch (building->get_building_level()) { - case 1: - z_offset = 45; - box_offset_fraction = 0.30; - break; - case 2: - z_offset = 55; - box_offset_fraction = 0.60; - break; - case 3: - z_offset = 75; - box_offset_fraction = 0.50; - break; - } - - Vec3 location_offset = {location.x, location.y, location.z + z_offset}; - render_view->world_to_screen(&location_offset, &screen_offset);\ - break; - } - case class_id::TELEPORTER: - { - Vec3 location = building->get_origin(); - Vec3 location_offset = {location.x, location.y, location.z + 15}; - render_view->world_to_screen(&location_offset, &screen_offset); - - box_offset_fraction = 1.8; - break; - } +void box_esp_entity(Vec3 screen, Entity *entity, Player *localplayer) { + if (config.esp.pickup.box && entity->get_pickup_type() != pickup_type::UNKNOWN) { + surface->set_rgba(255, 255, 255, 255); + surface->draw_outlined_rect(screen.x - 5, screen.y - 5, screen.x + 5, screen.y + 5); } - RGBA color = config.esp.player.enemy_color.to_RGBA(); // Use player color for now - if (building->get_team() == localplayer->get_team()) color = config.esp.player.team_color.to_RGBA(); - - draw_outline_rectangle(screen, screen_offset, box_offset_fraction, color); - } -} - -void health_bar_esp_entity(Vec3 screen, Entity* entity, Player* localplayer) { - if (config.esp.buildings.health_bar == true && entity->is_building() && (entity->get_team() != localplayer->get_team() || (entity->get_team() == localplayer->get_team() && config.esp.buildings.team == true))) { - Building* building = (Building*)entity; - if (building->is_carried()) return; - - float box_offset = 0; - switch (building->get_class_id()) { - case class_id::SENTRY: - { - Vec3 location = building->get_origin(); - - float z_offset = 0; - float box_offset_fraction = 0; - switch (building->get_building_level()) { - case 1: - z_offset = 45; - box_offset_fraction = 0.30; - break; - case 2: - z_offset = 55; - box_offset_fraction = 0.60; - break; - case 3: - z_offset = 75; - box_offset_fraction = 0.50; - break; - } - - Vec3 location_offset = {location.x, location.y, location.z + z_offset}; - Vec3 screen_offset; - render_view->world_to_screen(&location_offset, &screen_offset); - - box_offset = (screen.y - screen_offset.y)*box_offset_fraction; - break; - } - case class_id::DISPENSER: - { - Vec3 location = building->get_origin(); - Vec3 location_offset = {location.x, location.y, location.z + 58}; - Vec3 screen_offset; - render_view->world_to_screen(&location_offset, &screen_offset); - - box_offset = (screen.y - screen_offset.y)*0.25; - break; - } - case class_id::TELEPORTER: - { - - Vec3 location = building->get_origin(); - Vec3 location_offset = {location.x, location.y, location.z + 15}; - Vec3 screen_offset; - render_view->world_to_screen(&location_offset, &screen_offset); - - box_offset = (screen.y - screen_offset.y)*1.8; - break; - } + if (config.esp.buildings.box && entity->is_building() && ( + entity->get_team() != localplayer->get_team() || ( + entity->get_team() == localplayer->get_team() && config.esp.buildings.team))) { + Building *building = static_cast(entity); + if (building->is_carried()) return; + + Vec3 screen_offset; + float box_offset_fraction = 0; + + switch (building->get_class_id()) { + case class_id::DISPENSER: { + Vec3 location = building->get_origin(); + Vec3 location_offset = {location.x, location.y, location.z + 58}; + render_view->world_to_screen(&location_offset, &screen_offset); + + box_offset_fraction = 0.25; + break; + } + case class_id::SENTRY: { + Vec3 location = building->get_origin(); + + float z_offset = 0; + switch (building->get_building_level()) { + case 1: + z_offset = 45; + box_offset_fraction = 0.30; + break; + case 2: + z_offset = 55; + box_offset_fraction = 0.60; + break; + case 3: + z_offset = 75; + box_offset_fraction = 0.50; + break; + default: break; + } + + Vec3 location_offset = {location.x, location.y, location.z + z_offset}; + render_view->world_to_screen(&location_offset, &screen_offset);\ + break; + } + case class_id::TELEPORTER: { + Vec3 location = building->get_origin(); + Vec3 location_offset = {location.x, location.y, location.z + 15}; + render_view->world_to_screen(&location_offset, &screen_offset); + + box_offset_fraction = 1.8; + break; + } + default: break; + } + + RGBA color = config.esp.player.enemy_color.to_RGBA(); // Use player color for now + if (building->get_team() == localplayer->get_team()) color = config.esp.player.team_color.to_RGBA(); + + draw_outline_rectangle(screen, screen_offset, box_offset_fraction, color); } +} - surface->set_rgba(0, 0, 0, 255); - surface->draw_line(screen.x - box_offset - 1, screen.y + 3, screen.x + box_offset + 2, screen.y + 3); - surface->draw_line(screen.x - box_offset - 1, screen.y + 4, screen.x + box_offset + 2, screen.y + 4); - surface->draw_line(screen.x - box_offset - 1, screen.y + 5, screen.x + box_offset + 2, screen.y + 5); - - int xdelta = (box_offset*2) * (1.f - (float(building->get_health()) / building->get_max_health())); - - if (building->get_health() > building->get_max_health()) { // over healed (the building some how???) - surface->set_rgba(0, 255, 255, 255); - xdelta = 0; +void health_bar_esp_entity(Vec3 screen, Entity *entity, Player *localplayer) { + if (config.esp.buildings.health_bar && entity->is_building() && ( + entity->get_team() != localplayer->get_team() || ( + entity->get_team() == localplayer->get_team() && config.esp.buildings.team))) { + Building *building = static_cast(entity); + if (building->is_carried()) return; + + float box_offset = 0; + switch (building->get_class_id()) { + case class_id::SENTRY: { + Vec3 location = building->get_origin(); + + float z_offset = 0; + float box_offset_fraction = 0; + switch (building->get_building_level()) { + case 1: + z_offset = 45; + box_offset_fraction = 0.30; + break; + case 2: + z_offset = 55; + box_offset_fraction = 0.60; + break; + case 3: + z_offset = 75; + box_offset_fraction = 0.50; + break; + } + + Vec3 location_offset = {location.x, location.y, location.z + z_offset}; + Vec3 screen_offset; + render_view->world_to_screen(&location_offset, &screen_offset); + + box_offset = (screen.y - screen_offset.y) * box_offset_fraction; + break; + } + case class_id::DISPENSER: { + Vec3 location = building->get_origin(); + Vec3 location_offset = {location.x, location.y, location.z + 58}; + Vec3 screen_offset; + render_view->world_to_screen(&location_offset, &screen_offset); + + box_offset = (screen.y - screen_offset.y) * 0.25; + break; + } + case class_id::TELEPORTER: { + Vec3 location = building->get_origin(); + Vec3 location_offset = {location.x, location.y, location.z + 15}; + Vec3 screen_offset; + render_view->world_to_screen(&location_offset, &screen_offset); + + box_offset = (screen.y - screen_offset.y) * 1.8; + break; + } + default: break; + } + + surface->set_rgba(0, 0, 0, 255); + surface->draw_line(screen.x - box_offset - 1, screen.y + 3, screen.x + box_offset + 2, screen.y + 3); + surface->draw_line(screen.x - box_offset - 1, screen.y + 4, screen.x + box_offset + 2, screen.y + 4); + surface->draw_line(screen.x - box_offset - 1, screen.y + 5, screen.x + box_offset + 2, screen.y + 5); + + int xdelta = box_offset * 2 * (1.f - static_cast(building->get_health()) / building->get_max_health()); + + if (building->get_health() > building->get_max_health()) { + // over healed (the building some how???) + surface->set_rgba(0, 255, 255, 255); + xdelta = 0; + } else if (building->get_health() <= building->get_max_health() && building->get_health() >= ( + building->get_max_health() * .9)) + surface->set_rgba(0, 255, 0, 255); + else if (building->get_health() < (building->get_max_health() * .9) && building->get_health() > ( + building->get_max_health() * .6)) + surface->set_rgba(90, 255, 0, 255); + else if (building->get_health() <= (building->get_max_health() * .6) && building->get_health() > ( + building->get_max_health() * .35)) + surface->set_rgba(255, 100, 0, 255); + else if (building->get_health() <= (building->get_max_health() * .35)) + surface->set_rgba(255, 0, 0, 255); + + surface->draw_line(screen.x - box_offset, screen.y + 4, screen.x + box_offset - xdelta + 1, screen.y + 4); } - else if (building->get_health() <= building->get_max_health() && building->get_health() >= (building->get_max_health()*.9)) - surface->set_rgba(0, 255, 0, 255); - else if (building->get_health() < (building->get_max_health()*.9) && building->get_health() > (building->get_max_health()*.6)) - surface->set_rgba(90, 255, 0, 255); - else if (building->get_health() <= (building->get_max_health()*.6) && building->get_health() > (building->get_max_health()*.35)) - surface->set_rgba(255, 100, 0, 255); - else if (building->get_health() <= (building->get_max_health()*.35)) - surface->set_rgba(255, 0, 0, 255); - - surface->draw_line(screen.x - box_offset, screen.y + 4, screen.x + box_offset - xdelta + 1, screen.y + 4); - } } -void name_esp_entity(Vec3 screen, Entity* entity, Player* localplayer) { +void name_esp_entity(Vec3 screen, Entity *entity, Player *localplayer) { + if (config.esp.pickup.name && entity->get_pickup_type() != pickup_type::UNKNOWN) { + surface->draw_set_text_color(255, 255, 255, 255); - if (config.esp.pickup.name == true && entity->get_pickup_type() != pickup_type::UNKNOWN) { - surface->draw_set_text_color(255, 255, 255, 255); - - if (entity->get_pickup_type() == pickup_type::AMMOPACK) { - surface->draw_set_text_pos(screen.x - (surface->get_string_width(esp_entity_font, L"AMMO")*0.5), screen.y); - surface->draw_print_text(L"AMMO", wcslen(L"AMMO")); - } else if (entity->get_pickup_type() == pickup_type::MEDKIT) { - surface->draw_set_text_pos(screen.x - (surface->get_string_width(esp_entity_font, L"HEALTH")*0.5), screen.y); - surface->draw_print_text(L"HEALTH", wcslen(L"HEALTH")); - } - } - - - if (config.esp.buildings.name == true && entity->is_building() && (entity->get_team() != localplayer->get_team() || (entity->get_team() == localplayer->get_team() && config.esp.buildings.team == true))) { - Building* building = (Building*)entity; - if (building->is_carried()) return; - - surface->draw_set_text_color(255, 255, 255, 255); - switch (building->get_class_id()) { - case class_id::DISPENSER: - { - surface->draw_set_text_pos(screen.x - (surface->get_string_width(esp_entity_font, L"DISPENSER")*0.5), screen.y + (config.esp.buildings.health_bar ? 5 : 0)); - surface->draw_print_text(L"DISPENSER", wcslen(L"DISPENSER")); - break; - } - case class_id::SENTRY: - { - surface->draw_set_text_pos(screen.x - (surface->get_string_width(esp_entity_font, L"SENTRY")*0.5), screen.y + (config.esp.buildings.health_bar ? 5 : 0)); - surface->draw_print_text(L"SENTRY", wcslen(L"SENTRY")); - break; - } - case class_id::TELEPORTER: - { - surface->draw_set_text_pos(screen.x - (surface->get_string_width(esp_entity_font, L"TELEPORTER")*0.5), screen.y + (config.esp.buildings.health_bar ? 5 : 0)); - surface->draw_print_text(L"TELEPORTER", wcslen(L"TELEPORTER")); - break; - } + if (entity->get_pickup_type() == pickup_type::AMMOPACK) { + surface->draw_set_text_pos(screen.x - (surface->get_string_width(esp_entity_font, L"AMMO") * 0.5), + screen.y); + surface->draw_print_text(L"AMMO", wcslen(L"AMMO")); + } else if (entity->get_pickup_type() == pickup_type::MEDKIT) { + surface->draw_set_text_pos(screen.x - (surface->get_string_width(esp_entity_font, L"HEALTH") * 0.5), + screen.y); + surface->draw_print_text(L"HEALTH", wcslen(L"HEALTH")); + } } - } - - if (config.debug.debug_render_all_entities == true) { - std::string model_name = entity->get_model_name(); - - wchar_t model_name_w[64]; - size_t len = std::mbstowcs(model_name_w, model_name.c_str(), 64); - if (len == (size_t)-1) return; - std::wstring a = std::wstring(model_name_w); + if (config.esp.buildings.name && entity->is_building() && ( + entity->get_team() != localplayer->get_team() || ( + entity->get_team() == localplayer->get_team() && config.esp.buildings.team))) { + Building *building = static_cast(entity); + if (building->is_carried()) return; + + surface->draw_set_text_color(255, 255, 255, 255); + switch (building->get_class_id()) { + case class_id::DISPENSER: { + surface->draw_set_text_pos(screen.x - (surface->get_string_width(esp_entity_font, L"DISPENSER") * 0.5), + screen.y + (config.esp.buildings.health_bar ? 5 : 0)); + surface->draw_print_text(L"DISPENSER", wcslen(L"DISPENSER")); + break; + } + case class_id::SENTRY: { + surface->draw_set_text_pos(screen.x - (surface->get_string_width(esp_entity_font, L"SENTRY") * 0.5), + screen.y + (config.esp.buildings.health_bar ? 5 : 0)); + surface->draw_print_text(L"SENTRY", wcslen(L"SENTRY")); + break; + } + case class_id::TELEPORTER: { + surface->draw_set_text_pos(screen.x - (surface->get_string_width(esp_entity_font, L"TELEPORTER") * 0.5), + screen.y + (config.esp.buildings.health_bar ? 5 : 0)); + surface->draw_print_text(L"TELEPORTER", wcslen(L"TELEPORTER")); + break; + } + default: break; + } + } + + if (config.debug.debug_render_all_entities) { + std::string model_name = entity->get_model_name(); - a += L" " + std::to_wstring(entity->get_class_id()); + wchar_t model_name_w[64]; + if (const size_t len = std::mbstowcs(model_name_w, model_name.c_str(), 64); len == -1u) return; - surface->draw_set_text_pos(screen.x, screen.y); - surface->draw_print_text(a.c_str(), wcslen(a.c_str())); + std::wstring a = std::wstring(model_name_w); - } + a += L" " + std::to_wstring(entity->get_class_id()); + surface->draw_set_text_pos(screen.x, screen.y); + surface->draw_print_text(a.c_str(), wcslen(a.c_str())); + } } -void esp_entity(unsigned int i, Entity* entity) { - Player* localplayer = entity_list->get_localplayer(); - if (localplayer == nullptr) return; +void esp_entity(unsigned int i, Entity *entity) { + Player *localplayer = entity_list->get_localplayer(); + if (localplayer == nullptr) return; - Vec3 location = entity->get_origin(); - Vec3 screen; - if (!render_view->world_to_screen(&location, &screen)) return; + Vec3 location = entity->get_origin(); + Vec3 screen; + if (!render_view->world_to_screen(&location, &screen)) return; - box_esp_entity(screen, entity, localplayer); - health_bar_esp_entity(screen, entity, localplayer); - name_esp_entity(screen, entity, localplayer); + box_esp_entity(screen, entity, localplayer); + health_bar_esp_entity(screen, entity, localplayer); + name_esp_entity(screen, entity, localplayer); } diff --git a/hacks/esp/esp_player.cpp b/hacks/esp/esp_player.cpp index 47f9aea..5355964 100644 --- a/hacks/esp/esp_player.cpp +++ b/hacks/esp/esp_player.cpp @@ -17,154 +17,167 @@ #include "../../print.hpp" -void box_esp_player(Vec3 screen, Vec3 screen_offset, Player* player, Player* localplayer) { - if (config.esp.player.box == true) { - RGBA color = config.esp.player.enemy_color.to_RGBA(); - if (player->get_team() == localplayer->get_team()) color = config.esp.player.team_color.to_RGBA(); - if (config.esp.player.friends == true && player->is_friend() == true) color = config.esp.player.friend_color.to_RGBA(); - - draw_outline_rectangle(screen, screen_offset, 0.25, color); - } +void box_esp_player(Vec3 screen, Vec3 screen_offset, Player *player, Player *localplayer) { + if (config.esp.player.box) { + RGBA color = config.esp.player.enemy_color.to_RGBA(); + if (player->get_team() == localplayer->get_team()) color = config.esp.player.team_color.to_RGBA(); + if (config.esp.player.friends && player->is_friend()) + color = config.esp.player.friend_color.to_RGBA(); + + draw_outline_rectangle(screen, screen_offset, 0.25, color); + } +} + +void health_bar_esp_player(Vec3 screen, Vec3 screen_offset, Player *player) { + if (config.esp.player.health_bar) { + float health_offset = (screen.y - screen_offset.y) / 4; + + //shadow + surface->set_rgba(0, 0, 0, 255); + surface->draw_line(screen.x - health_offset - 5, screen.y + 1, screen.x - health_offset - 5, + screen_offset.y - 2); + surface->draw_line(screen.x - health_offset - 4, screen.y + 1, screen.x - health_offset - 4, + screen_offset.y - 2); + surface->draw_line(screen.x - health_offset - 3, screen.y + 1, screen.x - health_offset - 3, + screen_offset.y - 2); + + surface->set_rgba(0, 255, 0, 255); + int ydelta = (screen_offset.y - screen.y) * ( + 1.f - static_cast(player->get_health()) / player->get_max_health()); + + if (player->get_health() > player->get_max_health()) { + // over healed + surface->set_rgba(0, 255, 255, 255); + ydelta = 0; + } else if (player->get_health() <= player->get_max_health() && player->get_health() >= ( + player->get_max_health() * .9)) + surface->set_rgba(0, 255, 0, 255); + else if (player->get_health() < (player->get_max_health() * .9) && player->get_health() > ( + player->get_max_health() * .6)) + surface->set_rgba(90, 255, 0, 255); + else if (player->get_health() <= (player->get_max_health() * .6) && player->get_health() > ( + player->get_max_health() * .35)) + surface->set_rgba(255, 100, 0, 255); + else if (player->get_health() <= (player->get_max_health() * .35)) + surface->set_rgba(255, 0, 0, 255); + + surface->draw_line(screen.x - health_offset - 4, screen.y, screen.x - health_offset - 4, + screen_offset.y - ydelta - 1); + } } -void health_bar_esp_player(Vec3 screen, Vec3 screen_offset, Player* player) { - if (config.esp.player.health_bar == true) { - float health_offset = (screen.y - screen_offset.y)/4; +void name_esp_player(Vec3 screen, Vec3 screen_offset, Player *player, unsigned int i) { + if (config.esp.player.name) { + player_info pinfo; + if (!engine->get_player_info(i, &pinfo)) return; + + + wchar_t name[32]; + if (const size_t len = mbstowcs(name, pinfo.name, 32); len == -1u) return; - //shadow - surface->set_rgba(0, 0, 0, 255); - surface->draw_line(screen.x - health_offset - 5, screen.y + 1, screen.x - health_offset - 5, screen_offset.y - 2); - surface->draw_line(screen.x - health_offset - 4, screen.y + 1, screen.x - health_offset - 4, screen_offset.y - 2); - surface->draw_line(screen.x - health_offset - 3, screen.y + 1, screen.x - health_offset - 3, screen_offset.y - 2); + const unsigned int name_length = surface->get_string_width(esp_player_font, name); - surface->set_rgba(0, 255, 0, 255); - int ydelta = (screen_offset.y - screen.y) * (1.f - (float(player->get_health()) / player->get_max_health())); + surface->draw_set_text_color(255, 255, 255, 255); + surface->draw_set_text_pos(screen.x - (name_length / 2.f), + screen_offset.y - surface->get_font_height(esp_player_font)); - if (player->get_health() > player->get_max_health()) { // over healed - surface->set_rgba(0, 255, 255, 255); - ydelta = 0; + surface->draw_print_text(name, wcslen(name)); } - else if (player->get_health() <= player->get_max_health() && player->get_health() >= (player->get_max_health()*.9)) - surface->set_rgba(0, 255, 0, 255); - else if (player->get_health() < (player->get_max_health()*.9) && player->get_health() > (player->get_max_health()*.6)) - surface->set_rgba(90, 255, 0, 255); - else if (player->get_health() <= (player->get_max_health()*.6) && player->get_health() > (player->get_max_health()*.35)) - surface->set_rgba(255, 100, 0, 255); - else if (player->get_health() <= (player->get_max_health()*.35)) - surface->set_rgba(255, 0, 0, 255); - - surface->draw_line(screen.x - health_offset - 4, screen.y, screen.x - health_offset - 4, screen_offset.y - ydelta - 1); - } } -void name_esp_player(Vec3 screen, Vec3 screen_offset, Player* player, unsigned int i) { - if (config.esp.player.name == true) { - player_info pinfo; - if (!engine->get_player_info(i, &pinfo)) return; - +void flags_esp_player(const Vec3 screen, const Vec3 screen_offset, Player *player, unsigned int i) { + float flags_x_offset = (screen.y - screen_offset.y) / 4; + float flags_y_offset = 0; - wchar_t name[32]; - size_t len = mbstowcs(name, pinfo.name, 32); - if (len == (size_t)-1) return; + if (config.esp.player.flags.target_indicator && player == target_player) { + surface->draw_set_text_color(255, 0, 0, 255); + surface->draw_set_text_pos( + screen.x + flags_x_offset + surface->get_character_width(esp_player_font, L"TARGET"[0]), + screen_offset.y + flags_y_offset); - unsigned int name_length = surface->get_string_width(esp_player_font, name); - - surface->draw_set_text_color(255, 255, 255, 255); - surface->draw_set_text_pos(screen.x - (name_length/2.f), screen_offset.y - surface->get_font_height(esp_player_font)); + surface->draw_print_text(L"TARGET", wcslen(L"TARGET")); - surface->draw_print_text(name, wcslen(name)); - } -} + flags_y_offset += surface->get_font_height(esp_player_font); + } + + if (config.esp.player.flags.friend_indicator && player->is_friend()) { + surface->draw_set_text_color(0, 220, 80, 255); + surface->draw_set_text_pos( + screen.x + flags_x_offset + surface->get_character_width(esp_player_font, L"FRIEND"[0]), + screen_offset.y + flags_y_offset); -void flags_esp_player(Vec3 screen, Vec3 screen_offset, Player* player, unsigned int i) { - float flags_x_offset = (screen.y - screen_offset.y)/4; - float flags_y_offset = 0; - - if (config.esp.player.flags.target_indicator == true && player == target_player) { - surface->draw_set_text_color(255, 0, 0, 255); - surface->draw_set_text_pos(screen.x + flags_x_offset + surface->get_character_width(esp_player_font, L"TARGET"[0]), screen_offset.y + flags_y_offset); - - surface->draw_print_text(L"TARGET", wcslen(L"TARGET")); - - flags_y_offset += surface->get_font_height(esp_player_font); - } - - if (config.esp.player.flags.friend_indicator == true && player->is_friend()) { - surface->draw_set_text_color(0, 220, 80, 255); - surface->draw_set_text_pos(screen.x + flags_x_offset + surface->get_character_width(esp_player_font, L"FRIEND"[0]), screen_offset.y + flags_y_offset); - - surface->draw_print_text(L"FRIEND", wcslen(L"FRIEND")); - - flags_y_offset += surface->get_font_height(esp_player_font); - } - - /* - if (true) { - player_info pinfo; - if (!engine->get_player_info(i, &pinfo)) return; - std::wstring friend_id = std::to_wstring(pinfo.friends_id); - - surface->draw_set_text_color(255, 255, 255, 255); - surface->draw_set_text_pos(screen.x + flags_x_offset + surface->get_character_width(esp_player_font, friend_id[0]), screen_offset.y + flags_y_offset); - - surface->draw_print_text(friend_id.c_str(), wcslen(friend_id.c_str())); - - flags_y_offset += surface->get_font_height(esp_player_font); - } - */ + surface->draw_print_text(L"FRIEND", wcslen(L"FRIEND")); + + flags_y_offset += surface->get_font_height(esp_player_font); + } + + /* + if (true) { + player_info pinfo; + if (!engine->get_player_info(i, &pinfo)) return; + std::wstring friend_id = std::to_wstring(pinfo.friends_id); + + surface->draw_set_text_color(255, 255, 255, 255); + surface->draw_set_text_pos(screen.x + flags_x_offset + surface->get_character_width(esp_player_font, friend_id[0]), screen_offset.y + flags_y_offset); + + surface->draw_print_text(friend_id.c_str(), wcslen(friend_id.c_str())); + + flags_y_offset += surface->get_font_height(esp_player_font); + } + */ } -void skeleton_esp_player(Player* player) { - //todo +void skeleton_esp_player(Player *player) { + //todo } -void esp_player(unsigned int i, Player* player) { +void esp_player(unsigned int i, Player *player) { + bool friendlyfire = false; + static Convar *friendlyfirevar = convar_system->find_var("mp_friendlyfire"); + if (friendlyfirevar) { + if (friendlyfirevar->get_int() != 0) { + friendlyfire = true; + } + } - bool friendlyfire = false; - static Convar* friendlyfirevar = convar_system->find_var("mp_friendlyfire"); - if (friendlyfirevar != nullptr) { - if (friendlyfirevar->get_int() != 0) { - friendlyfire = true; + Player *localplayer = entity_list->get_localplayer(); + if (player == localplayer || // Ignore Local Player + player->is_dormant() || // Ignore Dormant (TODO: Add fading effect to dormant players) + player->get_lifestate() != 1 || // Ignore Dead + (player->get_team() == localplayer->get_team() && !config.esp.player.team && !player->is_friend()) || + // Ignore Team + (player->is_friend() && !config.esp.player.friends && ( + !config.esp.player.team && player->get_team() == localplayer->get_team())) // Ignore Friends + ) { + return; } - } - - Player* localplayer = entity_list->get_localplayer(); - if (player == localplayer || // Ignore Local Player - player->is_dormant() || // Ignore Dormat (TODO: Add fading effect to dormat players) - player->get_lifestate() != 1 || // Ignore Dead - (player->get_team() == localplayer->get_team() && config.esp.player.team == false && !player->is_friend()) || // Ignore Team - (player->is_friend() && config.esp.player.friends == false && (config.esp.player.team == false && player->get_team() == localplayer->get_team())) // Ignore Friends - ) - { - return; + + /* + //bone draw ID debug + surface->set_rgba(255, 255, 255, 255); + for (unsigned int h = 0; h < 128; ++h) { + Vec3 bone = player->get_bone_pos(h); + Vec3 bone_screen; + if(!render_view->world_to_screen(&bone, &bone_screen)) continue; + surface->draw_set_text_pos(bone_screen.x, bone_screen.y); + std::wstring a = std::to_wstring(h); + surface->draw_print_text(a.c_str(), wcslen(a.c_str())); } + */ + + Vec3 location = player->get_origin(); + Vec3 screen; + if (!render_view->world_to_screen(&location, &screen)) return; + + float distance = distance_3d(localplayer->get_origin(), player->get_origin()); + + Vec3 location_offset = {location.x, location.y, player->get_bone_pos(player->get_head_bone()).z + 10}; + Vec3 screen_offset; + render_view->world_to_screen(&location_offset, &screen_offset); - /* - //bone draw ID debug - surface->set_rgba(255, 255, 255, 255); - for (unsigned int h = 0; h < 128; ++h) { - Vec3 bone = player->get_bone_pos(h); - Vec3 bone_screen; - if(!render_view->world_to_screen(&bone, &bone_screen)) continue; - surface->draw_set_text_pos(bone_screen.x, bone_screen.y); - std::wstring a = std::to_wstring(h); - surface->draw_print_text(a.c_str(), wcslen(a.c_str())); - } - */ - - Vec3 location = player->get_origin(); - Vec3 screen; - if (!render_view->world_to_screen(&location, &screen)) return; - - float distance = distance_3d(localplayer->get_origin(), player->get_origin()); - - Vec3 location_offset = {location.x, location.y, player->get_bone_pos(player->get_head_bone()).z + 10}; - Vec3 screen_offset; - render_view->world_to_screen(&location_offset, &screen_offset); - - box_esp_player(screen, screen_offset, player, localplayer); - health_bar_esp_player(screen, screen_offset, player); - flags_esp_player(screen, screen_offset, player, i); - name_esp_player(screen, screen_offset, player, i); - skeleton_esp_player(player); + box_esp_player(screen, screen_offset, player, localplayer); + health_bar_esp_player(screen, screen_offset, player); + flags_esp_player(screen, screen_offset, player, i); + name_esp_player(screen, screen_offset, player, i); + skeleton_esp_player(player); } diff --git a/hacks/thirdperson/thirdperson.cpp b/hacks/thirdperson/thirdperson.cpp index 5a9e0f4..d7c24d7 100644 --- a/hacks/thirdperson/thirdperson.cpp +++ b/hacks/thirdperson/thirdperson.cpp @@ -8,63 +8,63 @@ #include "../../interfaces/engine_trace.hpp" void trace_hull(Vec3 vecStart, Vec3 vecEnd, Vec3 vecHullMin, Vec3 vecHullMax, unsigned int mask) { - ray_t ray = engine_trace->init_ray(&vecStart, &vecEnd, &vecHullMin, &vecHullMax); - struct trace_filter filter; - struct trace_t trace; + ray_t ray = engine_trace->init_ray(&vecStart, &vecEnd, &vecHullMin, &vecHullMax); + struct trace_filter filter; + struct trace_t trace; - engine_trace->trace_ray(&ray, mask, &filter, &trace); + engine_trace->trace_ray(&ray, mask, &filter, &trace); } // Doesn't transition smoothly between first and third. // Using the input interface with a properly hooked ShouldDraw methods would be better. -void thirdperson(view_setup* setup) { - Player* localplayer = entity_list->get_localplayer(); - if (localplayer == nullptr) return; +void thirdperson(view_setup *setup) { + Player *localplayer = entity_list->get_localplayer(); + if (localplayer == nullptr) return; - if (config.visuals.thirdperson.enabled == false) { - localplayer->set_thirdperson(false); - return; - } - - static bool was_pressed = false; - static bool do_thirdperson = false; - if (config.visuals.thirdperson.enabled == true) { - if (!was_pressed && is_button_down(config.visuals.thirdperson.key)) { - do_thirdperson = !do_thirdperson; - was_pressed = true; - } else if (was_pressed && !is_button_down(config.visuals.thirdperson.key)) { - was_pressed = false; + if (!config.visuals.thirdperson.enabled) { + localplayer->set_thirdperson(false); + return; } - } - if (do_thirdperson == true) localplayer->set_thirdperson(true); - else localplayer->set_thirdperson(false); + static bool was_pressed = false; + static bool do_thirdperson = false; + if (config.visuals.thirdperson.enabled) { + if (!was_pressed && is_button_down(config.visuals.thirdperson.key)) { + do_thirdperson = !do_thirdperson; + was_pressed = true; + } else if (was_pressed && !is_button_down(config.visuals.thirdperson.key)) { + was_pressed = false; + } + } - if (input->is_thirdperson()) { - Vec3 forward, right, up; angle_vectors(setup->angles, &forward, &right, &up); + if (do_thirdperson) localplayer->set_thirdperson(true); + else localplayer->set_thirdperson(false); - Vec3 offset; - offset += right * config.visuals.thirdperson.x; - offset += up * config.visuals.thirdperson.y; - offset -= forward * config.visuals.thirdperson.z; + if (input->is_thirdperson()) { + Vec3 forward, right, up; + angle_vectors(setup->angles, &forward, &right, &up); - Vec3 origin = localplayer->get_shoot_pos(); //pView->origin - Vec3 start = origin; - Vec3 end = origin + offset; + Vec3 offset; + offset += right * config.visuals.thirdperson.x; + offset += up * config.visuals.thirdperson.y; + offset -= forward * config.visuals.thirdperson.z; - /* - if (Vars::Visuals::Thirdperson::Collide.Value) - { - float hull = 9.f; - Vec3 mins = { -hull, -hull, -hull }, maxs = { hull, hull, hull }; + Vec3 origin = localplayer->get_shoot_pos(); //pView->origin + Vec3 start = origin; + Vec3 end = origin + offset; - struct trace_t trace; - engine_trace->trace_hull(start, end, mins, maxs, MASK_SOLID, &trace); - end = trace.endpos; - } - */ + /* + if (Vars::Visuals::Thirdperson::Collide.Value) + { + float hull = 9.f; + Vec3 mins = { -hull, -hull, -hull }, maxs = { hull, hull, hull }; - setup->origin = end; - } + struct trace_t trace; + engine_trace->trace_hull(start, end, mins, maxs, MASK_SOLID, &trace); + end = trace.endpos; + } + */ + setup->origin = end; + } } diff --git a/hooks/cl_move.cpp b/hooks/cl_move.cpp index 0ea1854..0e904fd 100644 --- a/hooks/cl_move.cpp +++ b/hooks/cl_move.cpp @@ -3,5 +3,5 @@ void (*cl_move_original)(float, bool); void cl_move_hook(float accumulated_extra_samples, bool final_tick) { - cl_move_original(accumulated_extra_samples, final_tick); + cl_move_original(accumulated_extra_samples, final_tick); } diff --git a/hooks/client_create_move.cpp b/hooks/client_create_move.cpp index 868c641..893a5b2 100644 --- a/hooks/client_create_move.cpp +++ b/hooks/client_create_move.cpp @@ -4,31 +4,31 @@ #include "../print.hpp" -void (*client_create_move_original)(void*, int, float, bool); - -void client_create_move_hook(void* me, int sequence_number, float input_sample_frametime, bool active) { - client_create_move_original(me, sequence_number, input_sample_frametime, active); - - /* - user_cmd* user_cmd = input->get_user_cmd(sequence_number); - if (user_cmd == nullptr) { - print("user_cmd == nullptr\n"); - return; - } - */ - - /* - prediction->update(client_state->m_nDeltaTick, client_state->m_nDeltaTick > 0, client_state->last_command_ack, - client_state->lastoutgoingcommand + client_state->chokedcommands); - */ - - //print("%p - %d - %d - %d - %f - %d\n", user_cmd, user_cmd->tick_count, sequence_number, sequence_number%90, input_sample_frametime, active); - - //user_cmd->random_seed = MD5_PseudoRandom(user_cmd->command_number) & 0x7FFFFFFF; - - //bhop(user_cmd); - - //print("%d\n", user_cmd->buttons); - - //print("client create move hooked!\n"); +void (*client_create_move_original)(void *, int, float, bool); + +void client_create_move_hook(void *me, int sequence_number, float input_sample_frametime, bool active) { + client_create_move_original(me, sequence_number, input_sample_frametime, active); + + /* + user_cmd* user_cmd = input->get_user_cmd(sequence_number); + if (user_cmd == nullptr) { + print("user_cmd == nullptr\n"); + return; + } + */ + + /* + prediction->update(client_state->m_nDeltaTick, client_state->m_nDeltaTick > 0, client_state->last_command_ack, + client_state->lastoutgoingcommand + client_state->chokedcommands); + */ + + //print("%p - %d - %d - %d - %f - %d\n", user_cmd, user_cmd->tick_count, sequence_number, sequence_number%90, input_sample_frametime, active); + + //user_cmd->random_seed = MD5_PseudoRandom(user_cmd->command_number) & 0x7FFFFFFF; + + //bhop(user_cmd); + + //print("%d\n", user_cmd->buttons); + + //print("client create move hooked!\n"); } diff --git a/hooks/client_mode_create_move.cpp b/hooks/client_mode_create_move.cpp index deb4f8c..7644b04 100644 --- a/hooks/client_mode_create_move.cpp +++ b/hooks/client_mode_create_move.cpp @@ -15,51 +15,51 @@ #include "../hacks/aimbot/aimbot.cpp" #include "../hacks/bhop/bhop.cpp" -bool (*client_mode_create_move_original)(void*, float, user_cmd*); +bool (*client_mode_create_move_original)(void *, float, user_cmd *); -bool client_mode_create_move_hook(void* me, float sample_time, user_cmd* user_cmd) { - bool rc = client_mode_create_move_original(me, sample_time, user_cmd); - - if (user_cmd == nullptr || user_cmd->command_number == 0) { - return rc; - } +bool client_mode_create_move_hook(void *me, float sample_time, user_cmd *user_cmd) { + bool rc = client_mode_create_move_original(me, sample_time, user_cmd); - if (!engine->is_in_game()) { - return rc; - } + if (user_cmd == nullptr || user_cmd->command_number == 0) { + return rc; + } + + if (!engine->is_in_game()) { + return rc; + } + + Player *localplayer = entity_list->get_localplayer(); + + if (localplayer->get_lifestate() != 1) { + return rc; + } + + if (localplayer == nullptr) { + print("localplayer is NULL\n"); + return rc; + } - Player* localplayer = entity_list->get_localplayer(); + if (user_cmd->tick_count > 1) { + bhop(user_cmd); - if (localplayer->get_lifestate() != 1) { - return rc; - } + aimbot(user_cmd); - if (localplayer == nullptr) { - print("localplayer is NULL\n"); - return rc; - } - - if (user_cmd->tick_count > 1) { - bhop(user_cmd); - - aimbot(user_cmd); - - //no push - static Convar* nopush = convar_system->find_var("tf_avoidteammates_pushaway"); - if (nopush != nullptr && config.misc.no_push == true) { - if (nopush->get_int() != 0) { - nopush->set_int(0); - } - } else if (nopush != nullptr && config.misc.no_push == false) { - if (nopush->get_int() != 1) { - nopush->set_int(1); - } + //no push + if (Convar *nopush = convar_system->find_var("tf_avoidteammates_pushaway")) { + if (config.misc.no_push) { + if (nopush->get_int() != 0) { + nopush->set_int(0); + } + } else { + if (nopush->get_int() != 1) { + nopush->set_int(1); + } + } + } } - } - - if (config.aimbot.silent == true) - return false; - else - return rc; + if (config.aimbot.silent) + return false; + else + return rc; } diff --git a/hooks/draw_model_execute.cpp b/hooks/draw_model_execute.cpp index 5c826c8..bb25119 100644 --- a/hooks/draw_model_execute.cpp +++ b/hooks/draw_model_execute.cpp @@ -12,22 +12,21 @@ #include "../hacks/chams/chams.cpp" -void draw_model_execute_hook(void* me, void* state, ModelRenderInfo_t* pinfo, VMatrix* bone_to_world) { +void draw_model_execute_hook(void *me, void *state, ModelRenderInfo_t *pinfo, VMatrix *bone_to_world) { + /* + static RGBA_float original_color; + render_view->get_color_modulation(&original_color); + original_color.a = render_view->get_blend(); + */ - /* - static RGBA_float original_color; - render_view->get_color_modulation(&original_color); - original_color.a = render_view->get_blend(); - */ - - chams(me, state, pinfo, bone_to_world); - - draw_model_execute_original(me, state, pinfo, bone_to_world); + chams(me, state, pinfo, bone_to_world); - /* - render_view->set_color_modulation(&original_color); - render_view->set_blend(original_color.a); + draw_model_execute_original(me, state, pinfo, bone_to_world); - model_render->forced_material_override(NULL, 0); - */ + /* + render_view->set_color_modulation(&original_color); + render_view->set_blend(original_color.a); + + model_render->forced_material_override(NULL, 0); + */ } diff --git a/hooks/draw_view_model.cpp b/hooks/draw_view_model.cpp index e54358a..e4d46bb 100644 --- a/hooks/draw_view_model.cpp +++ b/hooks/draw_view_model.cpp @@ -1,10 +1,10 @@ #include "../gui/config.hpp" -bool (*draw_view_model_original)(void*); +bool (*draw_view_model_original)(void *); -bool draw_view_model_hook(void* me) { - if (config.visuals.removals.scope == true) - return true; - else - return draw_view_model_original(me); +bool draw_view_model_hook(void *me) { + if (config.visuals.removals.scope) + return true; + else + return draw_view_model_original(me); } diff --git a/hooks/draw_view_models.cpp b/hooks/draw_view_models.cpp index c799c6a..c5db48e 100644 --- a/hooks/draw_view_models.cpp +++ b/hooks/draw_view_models.cpp @@ -2,8 +2,8 @@ #include "../print.hpp" -void (*draw_view_models_original)(void*, view_setup*, bool); +void (*draw_view_models_original)(void *, view_setup *, bool); -void draw_view_models_hook(void* me, view_setup* setup, bool draw_view_models) { - draw_view_models_original(me, setup, draw_view_models); +void draw_view_models_hook(void *me, view_setup *setup, bool draw_view_models) { + draw_view_models_original(me, setup, draw_view_models); } diff --git a/hooks/get_user_cmd.cpp b/hooks/get_user_cmd.cpp index 1606660..83a0430 100644 --- a/hooks/get_user_cmd.cpp +++ b/hooks/get_user_cmd.cpp @@ -1,5 +1,5 @@ #include "../interfaces/input.hpp" -user_cmd* get_user_cmd(void* me, int sequence_number) { - return input->get_user_cmd(sequence_number); +user_cmd *get_user_cmd(void *me, int sequence_number) { + return input->get_user_cmd(sequence_number); } diff --git a/hooks/hooks.cpp b/hooks/hooks.cpp index 9d9fc5e..3696116 100644 --- a/hooks/hooks.cpp +++ b/hooks/hooks.cpp @@ -3,98 +3,97 @@ #include "../print.hpp" -void* get_interface(const char* lib_path, const char* version) { - void* lib_handle = dlopen(lib_path, RTLD_NOLOAD | RTLD_NOW); - if (!lib_handle) { - print("Failed to load %s\n", lib_path); - return NULL; - } - - print("%s loaded at %p\n", lib_path, lib_handle); - - typedef void* (*CreateInterface)(const char*, int*); - - CreateInterface create_interface = (CreateInterface)dlsym(lib_handle, "CreateInterface"); - dlclose(lib_handle); - - if (!create_interface) { - print("Failed to get CreateInterface\n"); - return NULL; - } - - print("%s factory found at %p\n", lib_path, create_interface); - - void* interface = create_interface(version, NULL); - - if (!interface) { - print("Failed to get %s interface\n", version); - return NULL; - } - - print("%s interface found at %p\n", version, interface); - - return interface; -} +void *get_interface(const char *lib_path, const char *version) { + void *lib_handle = dlopen(lib_path, RTLD_NOLOAD | RTLD_NOW); + if (!lib_handle) { + print("Failed to load %s\n", lib_path); + return nullptr; + } + + print("%s loaded at %p\n", lib_path, lib_handle); + + typedef void * (*CreateInterface)(const char *, int *); + + CreateInterface create_interface = CreateInterface(dlsym(lib_handle, "CreateInterface")); + dlclose(lib_handle); + + if (!create_interface) { + print("Failed to get CreateInterface\n"); + return nullptr; + } -bool write_to_table(void** vtable, int index, void* func) { + print("%s factory found at %p\n", lib_path, create_interface); + + void *interface = create_interface(version, nullptr); + + if (!interface) { + print("Failed to get %s interface\n", version); + return nullptr; + } + + print("%s interface found at %p\n", version, interface); + + return interface; +} - const long page_size = sysconf(_SC_PAGESIZE); +bool write_to_table(void **vtable, int index, void *func) { + const long page_size = sysconf(_SC_PAGESIZE); - // Sets last three digits to zero - void* table_page = (void*)((__uint64_t)vtable & ~(page_size - 1)); - print("vfunc table page found at %p\n", table_page); + // Sets last three digits to zero + void *table_page = reinterpret_cast(reinterpret_cast<__uint64_t>(vtable) & ~(page_size - 1)); + print("vfunc table page found at %p\n", table_page); - if (mprotect(table_page, page_size, PROT_READ | PROT_WRITE) != 0) { - print("mprotect failed to change page protection\n"); - return false; - } + if (mprotect(table_page, page_size, PROT_READ | PROT_WRITE) != 0) { + print("mprotect failed to change page protection\n"); + return false; + } - vtable[index] = func; + vtable[index] = func; - if (mprotect(table_page, page_size, PROT_READ) != 0) { - print("mprotect failed to reset page protection\n"); - return false; - } + if (mprotect(table_page, page_size, PROT_READ) != 0) { + print("mprotect failed to reset page protection\n"); + return false; + } - return true; + return true; } -bool sdl_hook(void* lib_handle, const char* func_name, void* hook, void** original) { - void* func = dlsym(lib_handle, func_name); +bool sdl_hook(void *lib_handle, const char *func_name, void *hook, void **original) { + void *func = dlsym(lib_handle, func_name); - if (!func) { - print("Failed to get %s\n", func_name); - return false; - } + if (!func) { + print("Failed to get %s\n", func_name); + return false; + } - print("%s wrapper found at %p\n", func_name, func); + print("%s wrapper found at %p\n", func_name, func); - /* The symbols resolve to a wrapper function. They are a just a 2 byte - * `jmp` and then a SIGNED (?) 4 byte offset relative to the instruction - * pointer. Adding `ip + the offset` is a pointer to the address of the - * function that is wrapped. We save the orignal and call it in the hook. */ - int offset = *(int *)((unsigned long)func + 2); - void** ptr_to_func = (void **)((unsigned long)func + 6 + offset); - *original = *ptr_to_func; + /* The symbols resolve to a wrapper function. They are a just a 2 byte + * `jmp` and then a SIGNED (?) 4 byte offset relative to the instruction + * pointer. Adding `ip + the offset` is a pointer to the address of the + * function that is wrapped. We save the orignal and call it in the hook. */ + const int offset = *reinterpret_cast(reinterpret_cast(func) + 2); + void **ptr_to_func = reinterpret_cast(reinterpret_cast(func) + 6 + offset); + *original = *ptr_to_func; - print("Original %s at %p\n", func_name, *original); + print("Original %s at %p\n", func_name, *original); - // The page should have rw perms already! No mprotect needed - *ptr_to_func = hook; + // The page should have rw perms already! No mprotect needed + *ptr_to_func = hook; - return true; + return true; } -bool restore_sdl_hook(void* lib_handle, const char* func_name, void* original) { - void *func = dlsym(lib_handle, func_name); +bool restore_sdl_hook(void *lib_handle, const char *func_name, void *original) { + void *func = dlsym(lib_handle, func_name); - if (!func) { - print("Failed to get %s\n", func_name); - return false; - } + if (!func) { + print("Failed to get %s\n", func_name); + return false; + } - int offset = *(int*)((unsigned long)func + 2); - *(void **)((unsigned long)func + 6 + offset) = original; + int offset = *reinterpret_cast(reinterpret_cast(func) + 2); + *reinterpret_cast(reinterpret_cast(func) + 6 + offset) = original; - return true; + return true; } diff --git a/hooks/in_cond.cpp b/hooks/in_cond.cpp index 74e58c8..4180f80 100644 --- a/hooks/in_cond.cpp +++ b/hooks/in_cond.cpp @@ -2,13 +2,13 @@ #include "../classes/player.hpp" -bool in_cond_hook(void* me, int mask) { +bool in_cond_hook(void *me, int mask) { + if (mask == TF_COND_ZOOMED && config.visuals.removals.scope) { + //if they player is scoped + return false; + } - if (mask == TF_COND_ZOOMED && config.visuals.removals.scope == true) { //if they player is scoped - return false; - } + bool re = in_cond_original(me, mask); - bool re = in_cond_original(me, mask); - - return re; + return re; } diff --git a/hooks/load_white_list.cpp b/hooks/load_white_list.cpp index a61bdf0..e7bef73 100644 --- a/hooks/load_white_list.cpp +++ b/hooks/load_white_list.cpp @@ -1,11 +1,11 @@ #include "../gui/config.hpp" -void* (*load_white_list_original)(void*, const char*); +void * (*load_white_list_original)(void *, const char *); -void* load_white_list_hook(void* me, const char* str) { - if (config.misc.bypasspure == true) { - return nullptr; - } +void *load_white_list_hook(void *me, const char *str) { + if (config.misc.bypasspure) { + return nullptr; + } - return load_white_list_original(me, str); + return load_white_list_original(me, str); } diff --git a/hooks/override_view.cpp b/hooks/override_view.cpp index 9f89a92..63c9a1a 100644 --- a/hooks/override_view.cpp +++ b/hooks/override_view.cpp @@ -8,20 +8,20 @@ #include "../hacks/thirdperson/thirdperson.cpp" -void (*override_view_original)(void*, view_setup*); - -void override_view_hook(void* me, view_setup* setup) { - override_view_original(me, setup); - - Player* localplayer = entity_list->get_localplayer(); - if (localplayer == nullptr) return; - - if (config.visuals.removals.zoom == true) { - setup->fov = config.visuals.override_fov ? config.visuals.custom_fov : localplayer->get_default_fov(); - } else { - if (config.visuals.override_fov == true && localplayer->is_scoped() == false) - setup->fov = config.visuals.custom_fov; - } - - thirdperson(setup); +void (*override_view_original)(void *, view_setup *); + +void override_view_hook(void *me, view_setup *setup) { + override_view_original(me, setup); + + Player *localplayer = entity_list->get_localplayer(); + if (localplayer == nullptr) return; + + if (config.visuals.removals.zoom) { + setup->fov = config.visuals.override_fov ? config.visuals.custom_fov : localplayer->get_default_fov(); + } else { + if (config.visuals.override_fov && !localplayer->is_scoped()) + setup->fov = config.visuals.custom_fov; + } + + thirdperson(setup); } diff --git a/hooks/paint_traverse.cpp b/hooks/paint_traverse.cpp index 5dad8b3..960ac99 100644 --- a/hooks/paint_traverse.cpp +++ b/hooks/paint_traverse.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include "../interfaces/engine.hpp" @@ -16,91 +16,97 @@ #include "../hacks/esp/esp_player.cpp" #include "../hacks/esp/esp_entity.cpp" -void (*paint_traverse_original)(void*, void*, __int8_t, __int8_t) = NULL; +void (*paint_traverse_original)(void *, void *, __int8_t, __int8_t) = NULL; -void* vgui; -const char* get_panel_name(void* panel) { - void** vtable = *(void ***)vgui; +void *vgui; - const char* (*get_panel_name_fn)(void*, void*) = (const char* (*)(void*, void*))vtable[37]; +const char *get_panel_name(void *panel) { + void **vtable = *static_cast(vgui); + + const char * (*get_panel_name_fn)(void *, void *) = (const char* (*)(void *, void *)) vtable[37]; return get_panel_name_fn(vgui, panel); } -void paint_traverse_hook(void* me, void* panel, __int8_t force_repaint, __int8_t allow_force) { - std::string panel_name = get_panel_name(panel); - - // skip the original function to hide elements - if (config.visuals.removals.scope == true && panel_name == "HudScope") { - return; - } - - paint_traverse_original(me, panel, force_repaint, allow_force); - - //print("%s\n", panel_name.c_str()); - - if (panel_name != "MatSystemTopPanel") { - return; - } - - if (!engine->is_in_game()) { - return; - } - - static int old_font_height = config.debug.font_height; - static int old_font_weight = config.debug.font_weight; - - if (esp_player_font == 0 || old_font_height != config.debug.font_height || old_font_weight != config.debug.font_weight) { - esp_player_font = surface->text_create_font(); - surface->text_set_font_glyph_set(esp_player_font, "ProggySquare", config.debug.font_height, config.debug.font_weight, 0, 0, 0x0); - } - - if (esp_entity_font == 0 || old_font_height != config.debug.font_height || old_font_weight != config.debug.font_weight) { - old_font_height = config.debug.font_height; - old_font_weight = config.debug.font_weight; - esp_entity_font = surface->text_create_font(); - surface->text_set_font_glyph_set(esp_entity_font, "ProggySquare", config.debug.font_height, config.debug.font_weight, 0, 0, 0x0); - } - - - if (config.aimbot.draw_fov == true && config.aimbot.master == true) { - Vec2 screen_size = engine->get_screen_size(); - - Player* localplayer = entity_list->get_localplayer(); - - //very poor practice. - float local_fov = localplayer->get_fov(); - if (config.visuals.override_fov == true && (localplayer->is_scoped()) == false) { - local_fov = config.visuals.custom_fov; +void paint_traverse_hook(void *me, void *panel, __int8_t force_repaint, __int8_t allow_force) { + const std::string panel_name = get_panel_name(panel); + + // skip the original function to hide elements + if (config.visuals.removals.scope && panel_name == "HudScope") { + return; + } + + paint_traverse_original(me, panel, force_repaint, allow_force); + + //print("%s\n", panel_name.c_str()); + + if (panel_name != "MatSystemTopPanel") { + return; } - if (config.visuals.removals.zoom == true) { - local_fov = localplayer->get_default_fov(); + + if (!engine->is_in_game()) { + return; + } + + static int old_font_height = config.debug.font_height; + static int old_font_weight = config.debug.font_weight; + + if (esp_player_font == 0 || old_font_height != config.debug.font_height || old_font_weight != config.debug. + font_weight) { + esp_player_font = surface->text_create_font(); + surface->text_set_font_glyph_set(esp_player_font, "ProggySquare", config.debug.font_height, + config.debug.font_weight, 0, 0, 0x0); } - if (config.visuals.override_fov == true && config.visuals.removals.zoom == true) { - local_fov = config.visuals.custom_fov; + + if (esp_entity_font == 0 || old_font_height != config.debug.font_height || old_font_weight != config.debug. + font_weight) { + old_font_height = config.debug.font_height; + old_font_weight = config.debug.font_weight; + esp_entity_font = surface->text_create_font(); + surface->text_set_font_glyph_set(esp_entity_font, "ProggySquare", config.debug.font_height, + config.debug.font_weight, 0, 0, 0x0); } - - - int radius = (tan(config.aimbot.fov / 180 * M_PI) / tan((local_fov / 2) / 180 * M_PI) * (float(screen_size.x) / 2))/1.35; - - surface->set_rgba(255, 255, 255, 255); - surface->draw_circle(screen_size.x / 2, screen_size.y /2, radius, 55); - } - - - for (unsigned int i = 1; i <= entity_list->get_max_entities(); ++i) { - if (config.esp.master == false) continue; - - Player* player = entity_list->player_from_index(i); - if (player == nullptr) continue; - - if (player->get_class_id() == class_id::PLAYER) { - surface->draw_set_text_font(esp_player_font); - esp_player(i, player); - } else { - surface->draw_set_text_font(esp_entity_font); - esp_entity(i, player->to_entity()); + + + if (config.aimbot.draw_fov && config.aimbot.master) { + Vec2 screen_size = engine->get_screen_size(); + + Player *localplayer = entity_list->get_localplayer(); + + //very poor practice. + float local_fov = localplayer->get_fov(); + if (config.visuals.override_fov && !localplayer->is_scoped()) { + local_fov = config.visuals.custom_fov; + } + if (config.visuals.removals.zoom) { + local_fov = localplayer->get_default_fov(); + } + if (config.visuals.override_fov && config.visuals.removals.zoom) { + local_fov = config.visuals.custom_fov; + } + + + const int radius = tan(config.aimbot.fov / 180 * M_PI) / tan(local_fov / 2 / 180 * M_PI) * ( + static_cast(screen_size.x) / 2) / 1.35; + + surface->set_rgba(255, 255, 255, 255); + surface->draw_circle(screen_size.x / 2, screen_size.y / 2, radius, 55); + } + + + for (unsigned int i = 1; i <= entity_list->get_max_entities(); ++i) { + if (!config.esp.master) continue; + + Player *player = entity_list->player_from_index(i); + if (player == nullptr) continue; + + if (player->get_class_id() == class_id::PLAYER) { + surface->draw_set_text_font(esp_player_font); + esp_player(i, player); + } else { + surface->draw_set_text_font(esp_entity_font); + esp_entity(i, player->to_entity()); + } } - } } diff --git a/hooks/sdl.cpp b/hooks/sdl.cpp index 252e467..b912a5b 100644 --- a/hooks/sdl.cpp +++ b/hooks/sdl.cpp @@ -9,80 +9,79 @@ #include "../gui/menu.cpp" -void (*swap_window_original)(void*) = NULL; -bool (*poll_event_original)(SDL_Event*) = NULL; +void (*swap_window_original)(void *) = NULL; +bool (*poll_event_original)(SDL_Event *) = NULL; -bool poll_event_hook(SDL_Event* event) { - bool ret = poll_event_original(event); +bool poll_event_hook(SDL_Event *event) { + bool ret = poll_event_original(event); - if (ret) - ImGui_ImplSDL2_ProcessEvent(event); - - get_input(event); - - return ret; + if (ret) + ImGui_ImplSDL2_ProcessEvent(event); + + get_input(event); + + return ret; } void watermark() { - { - ImGui::SetNextWindowPos(ImVec2(10, 10)); - ImGui::SetNextWindowSize(ImVec2(150, 30)); - ImGui::Begin("a", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize); - - ImGui::TextCentered("I Use Arch BTW!!!"); - ImGui::End(); - - } + { + ImGui::SetNextWindowPos(ImVec2(10, 10)); + ImGui::SetNextWindowSize(ImVec2(150, 30)); + ImGui::Begin("a", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize); + + ImGui::TextCentered("I Use Arch BTW!!!"); + ImGui::End(); + } } -void swap_window_hook(SDL_Window* window) { - static SDL_GLContext original_context = NULL, new_context = NULL; - - if (!new_context) { - original_context = SDL_GL_GetCurrentContext(); - new_context = SDL_GL_CreateContext(window); - - GLenum err = glewInit(); - if (err != GLEW_OK) { - print("Failed to initialize GLEW: %s\n", glewGetErrorString(err)); - swap_window_original(window); - return; +void swap_window_hook(SDL_Window *window) { + static SDL_GLContext original_context = NULL, new_context = NULL; + + if (!new_context) { + original_context = SDL_GL_GetCurrentContext(); + new_context = SDL_GL_CreateContext(window); + + GLenum err = glewInit(); + if (err != GLEW_OK) { + print("Failed to initialize GLEW: %s\n", glewGetErrorString(err)); + swap_window_original(window); + return; + } + + ImGui::CreateContext(); + ImGui::StyleColorsDark(); + ImGui_ImplOpenGL3_Init("#version 100"); + ImGui_ImplSDL2_InitForOpenGL(window, nullptr); + ImGuiIO &io = ImGui::GetIO(); + io.ConfigWindowsMoveFromTitleBarOnly = true; + + orig_style = ImGui::GetStyle(); } - - ImGui::CreateContext(); - ImGui::StyleColorsDark(); - ImGui_ImplOpenGL3_Init("#version 100"); - ImGui_ImplSDL2_InitForOpenGL(window, nullptr); - ImGuiIO& io = ImGui::GetIO(); - io.ConfigWindowsMoveFromTitleBarOnly = true; - - orig_style = ImGui::GetStyle(); - } - - - SDL_GL_MakeCurrent(window, new_context); - - if (ImGui::IsKeyPressed(ImGuiKey_Insert, false)) { - menu_focused = !menu_focused; - surface->set_cursor_visible(menu_focused); - } - - ImGui_ImplOpenGL3_NewFrame(); - ImGui_ImplSDL2_NewFrame(); - ImGui::NewFrame(); - - if (menu_focused) { - draw_menu(); - } - - watermark(); - - ImGui::Render(); - ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); - - SDL_GL_MakeCurrent(window, original_context); - - swap_window_original(window); + + + SDL_GL_MakeCurrent(window, new_context); + + if (ImGui::IsKeyPressed(ImGuiKey_Insert, false)) { + menu_focused = !menu_focused; + surface->set_cursor_visible(menu_focused); + } + + ImGui_ImplOpenGL3_NewFrame(); + ImGui_ImplSDL2_NewFrame(); + ImGui::NewFrame(); + + if (menu_focused) { + draw_menu(); + } + + watermark(); + + ImGui::Render(); + ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); + + SDL_GL_MakeCurrent(window, original_context); + + swap_window_original(window); } diff --git a/hooks/should_draw_local_player.cpp b/hooks/should_draw_local_player.cpp index 2e92863..4ba19be 100644 --- a/hooks/should_draw_local_player.cpp +++ b/hooks/should_draw_local_player.cpp @@ -4,16 +4,16 @@ #include "../classes/player.hpp" -bool (*should_draw_local_player_original)(void*); +bool (*should_draw_local_player_original)(void *); -bool should_draw_local_player_hook(void* me) { - Player* localplayer = entity_list->get_localplayer(); +bool should_draw_local_player_hook(void *me) { + /*Player *localplayer = entity_list->get_localplayer(); - //return true; - /* - if (localplayer != nullptr && me == localplayer) - return true; - else - */ + //return true; + + if (localplayer && me == localplayer) + return true; + else + */ return should_draw_local_player_original(me); } diff --git a/hooks/should_draw_this_player.cpp b/hooks/should_draw_this_player.cpp index 2207890..d1bd8e9 100644 --- a/hooks/should_draw_this_player.cpp +++ b/hooks/should_draw_this_player.cpp @@ -5,10 +5,10 @@ #include "../print.hpp" -bool (*should_draw_this_player_original)(void*); +bool (*should_draw_this_player_original)(void *); -bool should_draw_this_player_hook(void* me) { - //if (me == entity_list->get_localplayer()) return true; - - return should_draw_this_player_original(me); +bool should_draw_this_player_hook(void *me) { + //if (me == entity_list->get_localplayer()) return true; + + return should_draw_this_player_original(me); } diff --git a/hooks/vulkan.cpp b/hooks/vulkan.cpp index 5893cb9..53e3fe7 100644 --- a/hooks/vulkan.cpp +++ b/hooks/vulkan.cpp @@ -2,11 +2,10 @@ #include "print.hpp" -VkResult (*queue_present_original)(VkQueue, const VkPresentInfoKHR*); +VkResult (*queue_present_original)(VkQueue, const VkPresentInfoKHR *); -VkResult queue_present_hook(VkQueue queue, const VkPresentInfoKHR* present_info) { +VkResult queue_present_hook(VkQueue queue, const VkPresentInfoKHR *present_info) { + print("QueuePresent hooked :3\n"); - print("QueuePresent hooked :3\n"); - - return queue_present_original(queue, present_info); + return queue_present_original(queue, present_info); } diff --git a/interfaces/attribute_manager.hpp b/interfaces/attribute_manager.hpp index 409eccf..201411a 100644 --- a/interfaces/attribute_manager.hpp +++ b/interfaces/attribute_manager.hpp @@ -3,15 +3,15 @@ class Entity; -static float (*attribute_hook_value_float_original)(float, const char*, Entity*, void*, bool); +static float (*attribute_hook_value_float_original)(float, const char *, Entity *, void *, bool); class AttributeManager { public: - float attrib_hook_value(float value, const char* attrib_name, Entity* entity) { - return attribute_hook_value_float_original(value, attrib_name, entity, nullptr, true); - } + float attrib_hook_value(float value, const char *attrib_name, Entity *entity) { + return attribute_hook_value_float_original(value, attrib_name, entity, nullptr, true); + } }; -inline static AttributeManager* attribute_manager = new AttributeManager(); +inline static AttributeManager *attribute_manager = new AttributeManager(); #endif diff --git a/interfaces/client.hpp b/interfaces/client.hpp index c526ed2..10c23a5 100644 --- a/interfaces/client.hpp +++ b/interfaces/client.hpp @@ -4,70 +4,70 @@ #include "../vec.hpp" struct user_cmd { - void *vmt; - int command_number; - int tick_count; - Vec3 view_angles; - float forwardmove; - float sidemove; - float upmove; - int buttons; - unsigned char impulse; - int weapon_select; - int weapon_subtype; - int random_seed; - short mouse_dx; - short mouse_dy; - bool has_been_predicted; + void *vmt; + int command_number; + int tick_count; + Vec3 view_angles; + float forwardmove; + float sidemove; + float upmove; + int buttons; + unsigned char impulse; + int weapon_select; + int weapon_subtype; + int random_seed; + short mouse_dx; + short mouse_dy; + bool has_been_predicted; }; enum in_buttons { - IN_ATTACK = (1 << 0), - IN_JUMP = (1 << 1), - IN_DUCK = (1 << 2), - IN_FORWARD = (1 << 3), - IN_BACK = (1 << 4), - IN_USE = (1 << 5), - IN_CANCEL = (1 << 6), - IN_LEFT = (1 << 7), - IN_RIGHT = (1 << 8), - IN_MOVELEFT = (1 << 9), - IN_MOVERIGHT = (1 << 10), - IN_ATTACK2 = (1 << 11), - IN_RUN = (1 << 12), - IN_RELOAD = (1 << 13), - IN_ALT1 = (1 << 14), - IN_ALT2 = (1 << 15), - IN_SCORE = (1 << 16), - IN_SPEED = (1 << 17), - IN_WALK = (1 << 18), - IN_ZOOM = (1 << 19), - IN_WEAPON1 = (1 << 20), - IN_WEAPON2 = (1 << 21), - IN_BULLRUSH = (1 << 22), - IN_GRENADE1 = (1 << 23), - IN_GRENADE2 = (1 << 24), - IN_ATTACK3 = (1 << 25), + IN_ATTACK = (1 << 0), + IN_JUMP = (1 << 1), + IN_DUCK = (1 << 2), + IN_FORWARD = (1 << 3), + IN_BACK = (1 << 4), + IN_USE = (1 << 5), + IN_CANCEL = (1 << 6), + IN_LEFT = (1 << 7), + IN_RIGHT = (1 << 8), + IN_MOVELEFT = (1 << 9), + IN_MOVERIGHT = (1 << 10), + IN_ATTACK2 = (1 << 11), + IN_RUN = (1 << 12), + IN_RELOAD = (1 << 13), + IN_ALT1 = (1 << 14), + IN_ALT2 = (1 << 15), + IN_SCORE = (1 << 16), + IN_SPEED = (1 << 17), + IN_WALK = (1 << 18), + IN_ZOOM = (1 << 19), + IN_WEAPON1 = (1 << 20), + IN_WEAPON2 = (1 << 21), + IN_BULLRUSH = (1 << 22), + IN_GRENADE1 = (1 << 23), + IN_GRENADE2 = (1 << 24), + IN_ATTACK3 = (1 << 25), }; class Client { public: - bool get_player_view(view_setup& player_view) { - void** vtable = *(void ***)this; + bool get_player_view(view_setup &player_view) { + void **vtable = *reinterpret_cast(this); - bool (*get_player_view_fn)(void*, view_setup&) = (bool (*)(void*, view_setup&))vtable[59]; + bool (*get_player_view_fn)(void *, view_setup &) = (bool (*)(void *, view_setup &)) vtable[59]; - return get_player_view_fn(this, player_view); - } + return get_player_view_fn(this, player_view); + } - float get_fov(void) { - view_setup local_view = {}; - get_player_view(local_view); + float get_fov(void) { + view_setup local_view = {}; + get_player_view(local_view); - return local_view.fov; - } + return local_view.fov; + } }; -inline static Client* client; +inline static Client *client; #endif diff --git a/interfaces/client_state.hpp b/interfaces/client_state.hpp index 13c655f..fee269a 100644 --- a/interfaces/client_state.hpp +++ b/interfaces/client_state.hpp @@ -4,63 +4,63 @@ #include struct ClockDriftMgr { - float m_ClockOffsets[16]; - int m_iCurClockOffset; - int m_nServerTick; - int m_nClientTick; + float m_ClockOffsets[16]; + int m_iCurClockOffset; + int m_nServerTick; + int m_nClientTick; }; class ClientState { public: - uint8_t pad0[24]; - int m_Socket; - void* m_NetChannel; //INetChannel - unsigned int m_nChallengeNr; - double m_flConnectTime; - int m_nRetryNumber; - char m_szRetryAddress[260]; - char* m_sRetrySourceTag; - int m_retryChallenge; - int m_nSignonState; - double m_flNextCmdTime; - int m_nServerCount; - uint64_t m_ulGameServerSteamID; - int m_nCurrentSequence; - ClockDriftMgr m_ClockDriftMgr; - int m_nDeltaTick; - bool m_bPaused; - float m_flPausedExpireTime; - int m_nViewEntity; - int m_nPlayerSlot; - char m_szLevelFileName[128]; - uint8_t pad1[132]; - char m_szLevelBaseName[128]; - uint8_t pad2[132]; - int m_nMaxClients; - void* m_pEntityBaselines[2][0x800]; //PackedEntity - uint8_t pad3[2068]; - void* m_StringTableContainer; - bool m_bRestrictServerCommands; - bool m_bRestrictClientCommands; - uint8_t pad4[106]; - bool insimulation; - int oldtickcount; - float m_tickRemainder; - float m_frameTime; - int lastoutgoingcommand; - int chokedcommands; - int last_command_ack; - int command_ack; - int m_nSoundSequence; - bool ishltv; - bool isreplay; - uint8_t pad5[278]; - int demonum; - char* demos[32]; - uint8_t pad6[344184]; - bool m_bMarkedCRCsUnverified; + uint8_t pad0[24]; + int m_Socket; + void *m_NetChannel; //INetChannel + unsigned int m_nChallengeNr; + double m_flConnectTime; + int m_nRetryNumber; + char m_szRetryAddress[260]; + char *m_sRetrySourceTag; + int m_retryChallenge; + int m_nSignonState; + double m_flNextCmdTime; + int m_nServerCount; + uint64_t m_ulGameServerSteamID; + int m_nCurrentSequence; + ClockDriftMgr m_ClockDriftMgr; + int m_nDeltaTick; + bool m_bPaused; + float m_flPausedExpireTime; + int m_nViewEntity; + int m_nPlayerSlot; + char m_szLevelFileName[128]; + uint8_t pad1[132]; + char m_szLevelBaseName[128]; + uint8_t pad2[132]; + int m_nMaxClients; + void *m_pEntityBaselines[2][0x800]; //PackedEntity + uint8_t pad3[2068]; + void *m_StringTableContainer; + bool m_bRestrictServerCommands; + bool m_bRestrictClientCommands; + uint8_t pad4[106]; + bool insimulation; + int oldtickcount; + float m_tickRemainder; + float m_frameTime; + int lastoutgoingcommand; + int chokedcommands; + int last_command_ack; + int command_ack; + int m_nSoundSequence; + bool ishltv; + bool isreplay; + uint8_t pad5[278]; + int demonum; + char *demos[32]; + uint8_t pad6[344184]; + bool m_bMarkedCRCsUnverified; }; -inline static ClientState* client_state; +inline static ClientState *client_state; #endif diff --git a/interfaces/convar_system.hpp b/interfaces/convar_system.hpp index a3a5340..5e49372 100644 --- a/interfaces/convar_system.hpp +++ b/interfaces/convar_system.hpp @@ -5,16 +5,15 @@ class ConvarSystem { public: - Convar* find_var(const char* var_name) { - void** vtable = *(void ***)this; - - Convar* (*find_var_fn)(void*, const char*) = (Convar* (*)(void*, const char*))vtable[12]; - - return find_var_fn(this, var_name); - } + Convar *find_var(const char *var_name) { + void **vtable = *reinterpret_cast(this); + Convar * (*find_var_fn)(void *, const char *) = (Convar* (*)(void *, const char *)) vtable[12]; + + return find_var_fn(this, var_name); + } }; -inline static ConvarSystem* convar_system; +inline static ConvarSystem *convar_system; #endif diff --git a/interfaces/debug_overlay.hpp b/interfaces/debug_overlay.hpp index 843192b..bc81d91 100644 --- a/interfaces/debug_overlay.hpp +++ b/interfaces/debug_overlay.hpp @@ -5,17 +5,16 @@ class DebugOverlay { public: - bool world_to_screen(Vec3* point, Vec3* screen) { - void** vtable = *(void ***)this; - - int (*world_to_screen_fn)(void *, Vec3*, Vec3*) = (int (*)(void*, Vec3*, Vec3*))vtable[9]; - int success = world_to_screen_fn(this, point, screen); - - return (success == 0); - } + bool world_to_screen(Vec3 *point, Vec3 *screen) { + void **vtable = *reinterpret_cast(this); + int (*world_to_screen_fn)(void *, Vec3 *, Vec3 *) = (int (*)(void *, Vec3 *, Vec3 *)) vtable[9]; + int success = world_to_screen_fn(this, point, screen); + + return (success == 0); + } }; -static inline DebugOverlay* overlay; +static inline DebugOverlay *overlay; #endif diff --git a/interfaces/engine.hpp b/interfaces/engine.hpp index 3547eb0..23b7c3e 100644 --- a/interfaces/engine.hpp +++ b/interfaces/engine.hpp @@ -8,44 +8,43 @@ struct player_info; class Engine { public: - int get_localplayer_index(void) { - void** vtable = *(void ***)this; - int (*get_localplayer_index_fn)(void*) = (int (*)(void*))vtable[12]; - - return get_localplayer_index_fn(this); - } - - Vec2 get_screen_size(void) { - void** vtable = *(void ***)this; + int get_localplayer_index(void) { + void **vtable = *reinterpret_cast(this); + int (*get_localplayer_index_fn)(void *) = (int (*)(void *)) vtable[12]; - void (*get_screen_size_fn)(void*, int*, int*) = (void (*)(void*, int*, int*))vtable[5]; - - int width; - int height; - - get_screen_size_fn(this, &width, &height); + return get_localplayer_index_fn(this); + } - return Vec2{width, height}; - } + Vec2 get_screen_size(void) { + void **vtable = *reinterpret_cast(this); - bool is_in_game(void) { - void** vtable = *(void ***)this; - bool (*is_in_game_fn)(void*) = (bool (*)(void*))vtable[26]; + void (*get_screen_size_fn)(void *, int *, int *) = (void (*)(void *, int *, int *)) vtable[5]; - return is_in_game_fn(this); - } + int width; + int height; + get_screen_size_fn(this, &width, &height); - bool get_player_info(int entity_index, player_info* pinfo) { - void** vtable = *(void ***)this; - bool (*get_player_info_fn)(void*, int, player_info*) = (bool (*)(void*, int, player_info*))vtable[8]; + return Vec2{width, height}; + } - return get_player_info_fn(this, entity_index, pinfo); - } + bool is_in_game(void) { + void **vtable = *reinterpret_cast(this); + bool (*is_in_game_fn)(void *) = (bool (*)(void *)) vtable[26]; + return is_in_game_fn(this); + } + + + bool get_player_info(int entity_index, player_info *pinfo) { + void **vtable = *reinterpret_cast(this); + bool (*get_player_info_fn)(void *, int, player_info *) = (bool (*)(void *, int, player_info *)) vtable[8]; + + return get_player_info_fn(this, entity_index, pinfo); + } }; -static inline Engine* engine; +static inline Engine *engine; #endif diff --git a/interfaces/engine_trace.hpp b/interfaces/engine_trace.hpp index 4073fc0..dbbc7b2 100644 --- a/interfaces/engine_trace.hpp +++ b/interfaces/engine_trace.hpp @@ -4,58 +4,57 @@ #include "../vec.hpp" enum trace_type_t { - TRACE_EVERYTHING = 0, - TRACE_WORLD_ONLY, - TRACE_ENTITIES_ONLY, - TRACE_EVERYTHING_FILTER_PROPS, + TRACE_EVERYTHING = 0, + TRACE_WORLD_ONLY, + TRACE_ENTITIES_ONLY, + TRACE_EVERYTHING_FILTER_PROPS, }; -struct ray_t -{ - struct Vec3_aligned start; // starting point, centered within the extents - struct Vec3_aligned delta; // direction + length of the ray - struct Vec3_aligned start_offset; // Add this to m_Start to get the actual ray start - struct Vec3_aligned extents; // Describes an axis aligned box extruded along a ray - bool is_ray; // are the extents zero? - bool is_swept; // is delta != 0? +struct ray_t { + struct Vec3_aligned start; // starting point, centered within the extents + struct Vec3_aligned delta; // direction + length of the ray + struct Vec3_aligned start_offset; // Add this to m_Start to get the actual ray start + struct Vec3_aligned extents; // Describes an axis aligned box extruded along a ray + bool is_ray; // are the extents zero? + bool is_swept; // is delta != 0? }; struct trace_filter { - void** vtable; - void* skip; + void **vtable; + void *skip; }; struct cplane_t { - Vec3 normal; - float dist; - unsigned char type; - unsigned char signbits; - unsigned char pad[2]; + Vec3 normal; + float dist; + unsigned char type; + unsigned char signbits; + unsigned char pad[2]; }; struct csurface_t { - const char* name; - short surface_props; - unsigned short flags; + const char *name; + short surface_props; + unsigned short flags; }; struct trace_t { - Vec3 startpos; - Vec3 endpos; - struct cplane_t plane; - float fraction; - int contents; - unsigned short disp_flags; - bool all_solid; - bool start_solid; - float fraction_left_solid; - struct csurface_t surface; - int hit_group; - short physics_bone; - void* entity; - int hitbox; - - // bool did_hit() const { return m_fraction < 1.f || m_allsolid || m_start_solid; } + Vec3 startpos; + Vec3 endpos; + struct cplane_t plane; + float fraction; + int contents; + unsigned short disp_flags; + bool all_solid; + bool start_solid; + float fraction_left_solid; + struct csurface_t surface; + int hit_group; + short physics_bone; + void *entity; + int hitbox; + + // bool did_hit() const { return m_fraction < 1.f || m_allsolid || m_start_solid; } }; #define CONTENTS_EMPTY 0 // No contents @@ -73,14 +72,14 @@ struct trace_t { #define ALL_VISIBLE_CONTENTS (LAST_VISIBLE_CONTENTS | (LAST_VISIBLE_CONTENTS-1)) #define CONTENTS_TESTFOGVOLUME 0x100 -#define CONTENTS_UNUSED 0x200 +#define CONTENTS_UNUSED 0x200 -// unused +// 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_TEAM1 0x800 // per team contents used to differentiate collisions #define CONTENTS_TEAM2 0x1000 // between players and objects on different teams #define CONTENTS_REDTEAM CONTENTS_TEAM1 #define CONTENTS_BLUETEAM CONTENTS_TEAM2 @@ -118,114 +117,115 @@ struct trace_t { #define MASK_SOLID (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_MONSTER|CONTENTS_GRATE) //add a namespace or class for these functions and vars -bool should_hit_entity(struct trace_filter* interface, void* entity, int contents_mask) { - return entity != interface->skip; +bool should_hit_entity(struct trace_filter *interface, void *entity, int contents_mask) { + return entity != interface->skip; } enum trace_type_t trace_type = TRACE_EVERYTHING; + void set_type(enum trace_type_t new_trace_type) { - trace_type = new_trace_type; + trace_type = new_trace_type; } -enum trace_type_t get_type(struct trace_filter* interface) { - return trace_type; +enum trace_type_t get_type(struct trace_filter *interface) { + return trace_type; } -static void* trace_filter_vtable[2] = { (void*)should_hit_entity, (void*)get_type }; +static void *trace_filter_vtable[2] = {(void *) should_hit_entity, (void *) get_type}; class EngineTrace { public: - struct Vec3_aligned Vec3_aligned_subtract(Vec3* a, Vec3* b) { - struct Vec3_aligned result = { - .x = a->x - b->x, - .y = a->y - b->y, - .z = a->z - b->z - }; - - return result; - } - - struct Vec3_aligned Vec3_aligned_add(Vec3* a, Vec3* b) { - struct Vec3_aligned result = { - .x = a->x + b->x, - .y = a->y + b->y, - .z = a->z + b->z - }; - - return result; - } - - - struct ray_t init_ray(Vec3* start, Vec3* end) { - struct Vec3_aligned delta = Vec3_aligned_subtract(end, start); - bool is_swept = (delta.x != 0.0f || delta.y != 0.0f || delta.z != 0.0f); - - struct ray_t ray = { - .start = { start->x, start->y, start->z }, - .delta = { delta.x, delta.y, delta.z }, - .start_offset = { 0.0f, 0.0f, 0.0f }, - .extents = { 0.0f, 0.0f, 0.0f }, - .is_ray = true, - .is_swept = is_swept - }; - - return ray; - } - - struct ray_t init_ray(Vec3* start, Vec3* end, Vec3* mins, Vec3* maxs) { - struct Vec3_aligned delta = Vec3_aligned_subtract(end, start); - bool is_swept = (delta.x != 0.0f || delta.y != 0.0f || delta.z != 0.0f); - - struct ray_t ray = { - .start = { 0, 0, 0 }, - .delta = { delta.x, delta.y, delta.z }, - .start_offset = Vec3_aligned_add(mins, maxs), - .extents = Vec3_aligned_subtract(maxs, mins), - .is_ray = true, - .is_swept = is_swept - }; - - ray.extents.x *= 0.5f; - ray.extents.y *= 0.5f; - ray.extents.z *= 0.5f; - - ray.start_offset.x *= 0.5f; - ray.start_offset.y *= 0.5f; - ray.start_offset.z *= 0.5f; - - Vec3 start_offset_tmp = Vec3{ray.start_offset.x, ray.start_offset.y, ray.start_offset.z}; - ray.start = Vec3_aligned_add(start, &start_offset_tmp); - - ray.start_offset.x *= -1.0f; - ray.start_offset.y *= -1.0f; - ray.start_offset.z *= -1.0f; - - return ray; - } - - void init_trace_filter(struct trace_filter* filter, void* skip) { - filter->vtable = trace_filter_vtable; - filter->skip = skip; - } - - void trace_ray(struct ray_t* ray, unsigned int f_mask, struct trace_filter* p_trace_filter, struct trace_t* p_trace) { - void** vtable = *(void ***)this; - void (*trace_ray_fn)(void*, struct ray_t*, unsigned int, struct trace_filter*, struct trace_t*) = - (void (*)(void*, struct ray_t*, unsigned int, struct trace_filter*, struct trace_t*))vtable[4]; - - trace_ray_fn(this, ray, f_mask, p_trace_filter, p_trace); - } - - void trace_hull(Vec3 start, Vec3 end, Vec3 hull_min, Vec3 hull_max, unsigned int mask, struct trace_t* trace) { - struct ray_t ray = this->init_ray(&start, &end, &hull_min, &hull_max); - struct trace_filter filter; - - this->trace_ray(&ray, mask, &filter, trace); - } - + static struct Vec3_aligned Vec3_aligned_subtract(Vec3 *a, Vec3 *b) { + const struct Vec3_aligned result = { + .x = a->x - b->x, + .y = a->y - b->y, + .z = a->z - b->z + }; + + return result; + } + + static struct Vec3_aligned Vec3_aligned_add(Vec3 *a, Vec3 *b) { + const struct Vec3_aligned result = { + .x = a->x + b->x, + .y = a->y + b->y, + .z = a->z + b->z + }; + + return result; + } + + + static struct ray_t init_ray(Vec3 *start, Vec3 *end) { + struct Vec3_aligned delta = Vec3_aligned_subtract(end, start); + const bool is_swept = (delta.x != 0.0f || delta.y != 0.0f || delta.z != 0.0f); + + struct ray_t ray = { + .start = {start->x, start->y, start->z}, + .delta = {delta.x, delta.y, delta.z}, + .start_offset = {0.0f, 0.0f, 0.0f}, + .extents = {0.0f, 0.0f, 0.0f}, + .is_ray = true, + .is_swept = is_swept + }; + + return ray; + } + + static struct ray_t init_ray(Vec3 *start, Vec3 *end, Vec3 *mins, Vec3 *maxs) { + struct Vec3_aligned delta = Vec3_aligned_subtract(end, start); + const bool is_swept = (delta.x != 0.0f || delta.y != 0.0f || delta.z != 0.0f); + + struct ray_t ray = { + .start = {0, 0, 0}, + .delta = {delta.x, delta.y, delta.z}, + .start_offset = Vec3_aligned_add(mins, maxs), + .extents = Vec3_aligned_subtract(maxs, mins), + .is_ray = true, + .is_swept = is_swept + }; + + ray.extents.x *= 0.5f; + ray.extents.y *= 0.5f; + ray.extents.z *= 0.5f; + + ray.start_offset.x *= 0.5f; + ray.start_offset.y *= 0.5f; + ray.start_offset.z *= 0.5f; + + Vec3 start_offset_tmp = Vec3{ray.start_offset.x, ray.start_offset.y, ray.start_offset.z}; + ray.start = Vec3_aligned_add(start, &start_offset_tmp); + + ray.start_offset.x *= -1.0f; + ray.start_offset.y *= -1.0f; + ray.start_offset.z *= -1.0f; + + return ray; + } + + static void init_trace_filter(struct trace_filter *filter, void *skip) { + filter->vtable = trace_filter_vtable; + filter->skip = skip; + } + + void trace_ray(struct ray_t *ray, unsigned int f_mask, struct trace_filter *p_trace_filter, + struct trace_t *p_trace) { + void **vtable = *reinterpret_cast(this); + void (*trace_ray_fn)(void *, struct ray_t *, unsigned int, struct trace_filter *, struct trace_t *) = + (void (*)(void *, struct ray_t *, unsigned int, struct trace_filter *, struct trace_t *)) vtable[4]; + + trace_ray_fn(this, ray, f_mask, p_trace_filter, p_trace); + } + + void trace_hull(Vec3 start, Vec3 end, Vec3 hull_min, Vec3 hull_max, unsigned int mask, struct trace_t *trace) { + struct ray_t ray = init_ray(&start, &end, &hull_min, &hull_max); + struct trace_filter filter; + + this->trace_ray(&ray, mask, &filter, trace); + } }; -inline static EngineTrace* engine_trace; +inline static EngineTrace *engine_trace; #endif diff --git a/interfaces/entity_list.hpp b/interfaces/entity_list.hpp index b8ab5e4..8ebedd9 100644 --- a/interfaces/entity_list.hpp +++ b/interfaces/entity_list.hpp @@ -8,36 +8,37 @@ class Player; class EntityList { public: - Entity* entity_from_index(unsigned int index) { - void** vtable = *(void ***)this; - - Entity* (*entity_from_index_fn)(void*, unsigned int) = (Entity* (*)(void*, unsigned int))vtable[3]; - - return entity_from_index_fn(this, index); - } - - Player* player_from_index(unsigned int index) { - return (Player*)entity_from_index(index); - } - - Entity* entity_from_handle(int handle) { - return entity_from_index((handle & (( 1 << 16) - 1))); // Convert handle to index https://github.com/ValveSoftware/source-sdk-2013/blob/39f6dde8fbc238727c020d13b05ecadd31bda4c0/src/public/const.h#L83 - } - - - Player* get_localplayer(void) { - return player_from_index(engine->get_localplayer_index()); - } - - int get_max_entities(void) { - void** vtable = *(void ***)this; - - int (*get_max_entities_fn)(void*) = (int (*)(void*))vtable[8]; - - return get_max_entities_fn(this); - } + Entity *entity_from_index(unsigned int index) { + void **vtable = *reinterpret_cast(this); + + Entity * (*entity_from_index_fn)(void *, unsigned int) = (Entity* (*)(void *, unsigned int)) vtable[3]; + + return entity_from_index_fn(this, index); + } + + Player *player_from_index(unsigned int index) { + return reinterpret_cast(entity_from_index(index)); + } + + Entity *entity_from_handle(int handle) { + return entity_from_index((handle & ((1 << 16) - 1))); + // Convert handle to index https://github.com/ValveSoftware/source-sdk-2013/blob/39f6dde8fbc238727c020d13b05ecadd31bda4c0/src/public/const.h#L83 + } + + + Player *get_localplayer(void) { + return player_from_index(engine->get_localplayer_index()); + } + + int get_max_entities(void) { + void **vtable = *reinterpret_cast(this); + + int (*get_max_entities_fn)(void *) = (int (*)(void *)) vtable[8]; + + return get_max_entities_fn(this); + } }; -static inline EntityList* entity_list; +static inline EntityList *entity_list; #endif diff --git a/interfaces/game_movement.hpp b/interfaces/game_movement.hpp index ed042e3..b89ed03 100644 --- a/interfaces/game_movement.hpp +++ b/interfaces/game_movement.hpp @@ -7,60 +7,61 @@ class Player; class MoveData { public: - bool m_bFirstRunOfFunctions : 1; - bool m_bGameCodeMovedPlayer : 1; - - int m_nPlayerHandle; // edict index on server, client entity handle on client - - int m_nImpulseCommand; // Impulse command issued. - Vec3 m_vecViewAngles; // Command view angles (local space) - Vec3 m_vecAbsViewAngles; // Command view angles (world space) - int m_nButtons; // Attack buttons. - int m_nOldButtons; // From host_client->oldbuttons; - float m_flForwardMove; - float m_flOldForwardMove; - float m_flSideMove; - float m_flUpMove; - - float m_flMaxSpeed; - float m_flClientMaxSpeed; - - // Variables from the player edict (sv_player) or entvars on the client. - // These are copied in here before calling and copied out after calling. - Vec3 m_vecVelocity; // edict::velocity // Current movement direction. - Vec3 m_vecAngles; // edict::angles - Vec3 m_vecOldAngles; - - // Output only - float m_outStepHeight; // how much you climbed this move - Vec3 m_outWishVel; // This is where you tried - Vec3 m_outJumpVel; // This is your jump velocity - - // Movement constraints (radius 0 means no constraint) - Vec3 m_vecConstraintCenter; - float m_flConstraintRadius; - float m_flConstraintWidth; - float m_flConstraintSpeedFactor; - - void SetAbsOrigin( const Vec3 &vec ); - const Vec3 &GetAbsOrigin() const; + bool m_bFirstRunOfFunctions: 1; + bool m_bGameCodeMovedPlayer: 1; + + int m_nPlayerHandle; // edict index on server, client entity handle on client + + int m_nImpulseCommand; // Impulse command issued. + Vec3 m_vecViewAngles; // Command view angles (local space) + Vec3 m_vecAbsViewAngles; // Command view angles (world space) + int m_nButtons; // Attack buttons. + int m_nOldButtons; // From host_client->oldbuttons; + float m_flForwardMove; + float m_flOldForwardMove; + float m_flSideMove; + float m_flUpMove; + + float m_flMaxSpeed; + float m_flClientMaxSpeed; + + // Variables from the player edict (sv_player) or entvars on the client. + // These are copied in here before calling and copied out after calling. + Vec3 m_vecVelocity; // edict::velocity // Current movement direction. + Vec3 m_vecAngles; // edict::angles + Vec3 m_vecOldAngles; + + // Output only + float m_outStepHeight; // how much you climbed this move + Vec3 m_outWishVel; // This is where you tried + Vec3 m_outJumpVel; // This is your jump velocity + + // Movement constraints (radius 0 means no constraint) + Vec3 m_vecConstraintCenter; + float m_flConstraintRadius; + float m_flConstraintWidth; + float m_flConstraintSpeedFactor; + + void SetAbsOrigin(const Vec3 &vec); + + const Vec3 &GetAbsOrigin() const; private: - Vec3 m_vecAbsOrigin; // edict::origin + Vec3 m_vecAbsOrigin; // edict::origin }; class GameMovement { public: - void process_movement(Player* player, MoveData* move) { - void** vtable = *(void***)this; + void process_movement(Player *player, MoveData *move) { + void **vtable = *reinterpret_cast(this); - void (*process_movement_fn)(void*, Player*, MoveData*) = (void (*)(void*, Player*, MoveData*))vtable[1]; + void (*process_movement_fn)(void *, Player *, MoveData *) = (void (*)(void *, Player *, MoveData *)) vtable[1]; - process_movement_fn(this, player, move); - } + process_movement_fn(this, player, move); + } }; -inline static GameMovement* game_movement; +inline static GameMovement *game_movement; #endif diff --git a/interfaces/global_vars.hpp b/interfaces/global_vars.hpp index ead9dd6..98a6e92 100644 --- a/interfaces/global_vars.hpp +++ b/interfaces/global_vars.hpp @@ -3,23 +3,23 @@ class GlobalVars { public: - float realtime; - int framecount; - float absolute_frametime; - float curtime; - float frametime; - int max_clients; - int tickcount; - float interval_per_tick; - float interpolation_amount; - int sim_ticks_this_frame; - int network_protocol; - void* save_data; //CSaveRestoreData - bool client; - int nTimestampNetworkingBase; - int nTimestampRandomizeWindow; + float realtime; + int framecount; + float absolute_frametime; + float curtime; + float frametime; + int max_clients; + int tickcount; + float interval_per_tick; + float interpolation_amount; + int sim_ticks_this_frame; + int network_protocol; + void *save_data; //CSaveRestoreData + bool client; + int nTimestampNetworkingBase; + int nTimestampRandomizeWindow; }; -inline static GlobalVars* global_vars; +inline static GlobalVars *global_vars; #endif diff --git a/interfaces/input.hpp b/interfaces/input.hpp index 000f63d..317f2bc 100644 --- a/interfaces/input.hpp +++ b/interfaces/input.hpp @@ -4,55 +4,54 @@ #include "client.hpp" struct CameraThirdData_t { - float pitch; - float yaw; - float dist; - float lag; - Vec3 hull_min; - Vec3 hull_max; + float pitch; + float yaw; + float dist; + float lag; + Vec3 hull_min; + Vec3 hull_max; }; -static user_cmd* (*get_user_cmd_original)(void*, int sequence_number); +static user_cmd * (*get_user_cmd_original)(void *, int sequence_number); class Input { public: + user_cmd *get_user_cmd(int sequence_number) { + user_cmd *usercmd = &this->commands[sequence_number % 90]; - user_cmd* get_user_cmd(int sequence_number) { - user_cmd* usercmd = &this->commands[sequence_number % 90]; + return usercmd; + } - return usercmd; - } - - void to_thirdperson(void) { - void** vtable = *(void***)this; + void to_thirdperson(void) { + void **vtable = *reinterpret_cast(this); - void (*to_thirdperson_fn)(void*) = (void (*)(void*))vtable[32]; + void (*to_thirdperson_fn)(void *) = (void (*)(void *)) vtable[32]; - to_thirdperson_fn(this); - } + to_thirdperson_fn(this); + } - bool is_thirdperson(void) { - void** vtable = *(void***)this; + bool is_thirdperson(void) { + void **vtable = *reinterpret_cast(this); - bool (*is_thirdperson_fn)(void*) = (bool (*)(void*))vtable[31]; + bool (*is_thirdperson_fn)(void *) = (bool (*)(void *)) vtable[31]; - return is_thirdperson_fn(this); - } - - void to_firstperson(void) { - void** vtable = *(void***)this; + return is_thirdperson_fn(this); + } - void (*to_firstperson_fn)(void*) = (void (*)(void*))vtable[33]; + void to_firstperson(void) { + void **vtable = *reinterpret_cast(this); - to_firstperson_fn(this); - } + void (*to_firstperson_fn)(void *) = (void (*)(void *)) vtable[33]; + + to_firstperson_fn(this); + } public: - char pad0[0x100]; - - user_cmd* commands; + char pad0[0x100]; + + user_cmd *commands; }; -inline static Input* input; +inline static Input *input; #endif diff --git a/interfaces/material_system.hpp b/interfaces/material_system.hpp index 95bab49..c34012e 100644 --- a/interfaces/material_system.hpp +++ b/interfaces/material_system.hpp @@ -6,24 +6,26 @@ class MaterialSystem { public: - Material* find_material(char const* material_name, const char* texture_group_name, bool complain, const char* complain_prefix) { - void** vtable = *(void ***)this; + Material *find_material(char const *material_name, const char *texture_group_name, bool complain, + const char *complain_prefix) { + void **vtable = *reinterpret_cast(this); - Material* (*find_material_fn)(void*, const char*, const char*, bool, const char*) = - (Material* (*)(void*, const char*, const char*, bool, const char*))vtable[73]; + Material * (*find_material_fn)(void *, const char *, const char *, bool, const char *) = + (Material* (*)(void *, const char *, const char *, bool, const char *)) vtable[73]; - return find_material_fn(this, material_name, texture_group_name, complain, complain_prefix); - } + return find_material_fn(this, material_name, texture_group_name, complain, complain_prefix); + } - Material* create_material(const char* name, KeyValues* key_value) { - void** vtable = *(void ***)this; + Material *create_material(const char *name, KeyValues *key_value) { + void **vtable = *reinterpret_cast(this); - Material* (*create_material_fn)(void*, const char*, void*) = (Material* (*)(void*, const char*, void*))vtable[72]; + Material * (*create_material_fn)(void *, const char *, void *) = (Material* (*)(void *, const char *, void *)) + vtable[72]; - return create_material_fn(this, name, key_value); - } + return create_material_fn(this, name, key_value); + } }; -inline static MaterialSystem* material_system; +inline static MaterialSystem *material_system; #endif diff --git a/interfaces/model_render.hpp b/interfaces/model_render.hpp index f458f67..35a4ec4 100644 --- a/interfaces/model_render.hpp +++ b/interfaces/model_render.hpp @@ -5,18 +5,16 @@ class ModelRender { public: - void forced_material_override(Material* new_material, int override_type) { - void** vtable = *(void ***)this; + void forced_material_override(Material *new_material, int override_type) { + void **vtable = *reinterpret_cast(this); - void (*forced_material_override_fn)(void*, Material*, int) = - (void (*)(void*, Material*, int))vtable[1]; + void (*forced_material_override_fn)(void *, Material *, int) = + (void (*)(void *, Material *, int)) vtable[1]; - forced_material_override_fn(this, new_material, override_type); - } - - + forced_material_override_fn(this, new_material, override_type); + } }; -inline static ModelRender* model_render; +inline static ModelRender *model_render; #endif diff --git a/interfaces/move_helper.hpp b/interfaces/move_helper.hpp index 8869a33..a287975 100644 --- a/interfaces/move_helper.hpp +++ b/interfaces/move_helper.hpp @@ -5,15 +5,15 @@ class Player; class MoveHelper { public: - void set_host(Player* player) { - void** vtable = *(void***)this; + void set_host(Player *player) { + void **vtable = *reinterpret_cast(this); - void (*set_host_fn)(void*, Player*) = (void (*)(void*, Player*))vtable[12]; + void (*set_host_fn)(void *, Player *) = (void (*)(void *, Player *)) vtable[12]; - set_host_fn(this, player); - } + set_host_fn(this, player); + } }; -inline static MoveHelper* move_helper; +inline static MoveHelper *move_helper; #endif diff --git a/interfaces/prediction.hpp b/interfaces/prediction.hpp index 04292d7..c1d62f8 100644 --- a/interfaces/prediction.hpp +++ b/interfaces/prediction.hpp @@ -11,62 +11,98 @@ struct user_cmd; // https://github.com/rei-2/Amalgam/blob/f246c3dbbe9fc82db015087b752ac91db65a107e/Amalgam/src/SDK/Definitions/Interfaces/Prediction.h#L9 class IPrediction { public: - virtual ~IPrediction(void) {}; - virtual void init(void) = 0; - virtual void shutdown(void) = 0; - virtual void update(int startframe, bool validframe, int incoming_acknowledged, int outgoing_command) = 0; - virtual void pre_entity_packet_received(int commands_acknowledged, int current_world_update_packet) = 0; - virtual void post_entity_packet_received(void) = 0; - virtual void post_network_data_received(int commands_acknowledged) = 0; - virtual void on_received_uncompressed_packet(void) = 0; - virtual void get_view_origin(Vec3& org) = 0; - virtual void set_view_origin(Vec3& org) = 0; - virtual void get_view_angles(Vec3& ang) = 0; - virtual void set_view_angles(Vec3& ang) = 0; - virtual void get_local_view_angles(Vec3& ang) = 0; - virtual void set_local_view_angles(Vec3& ang) = 0; + virtual ~IPrediction(void) { + }; + + virtual void init(void) = 0; + + virtual void shutdown(void) = 0; + + virtual void update(int startframe, bool validframe, int incoming_acknowledged, int outgoing_command) = 0; + + virtual void pre_entity_packet_received(int commands_acknowledged, int current_world_update_packet) = 0; + + virtual void post_entity_packet_received(void) = 0; + + virtual void post_network_data_received(int commands_acknowledged) = 0; + + virtual void on_received_uncompressed_packet(void) = 0; + + virtual void get_view_origin(Vec3 &org) = 0; + + virtual void set_view_origin(Vec3 &org) = 0; + + virtual void get_view_angles(Vec3 &ang) = 0; + + virtual void set_view_angles(Vec3 &ang) = 0; + + virtual void get_local_view_angles(Vec3 &ang) = 0; + + virtual void set_local_view_angles(Vec3 &ang) = 0; }; class Prediction : public IPrediction { public: - virtual ~Prediction() {}; - virtual void init() = 0; - virtual void shutdown() = 0; - virtual void update(int startframe, bool validframe, int incoming_acknowledged, int outgoing_command) = 0; - virtual void on_received_uncompressed_packet() = 0; - virtual void pre_entity_packet_received(int commands_acknowledged, int current_world_update_packet) = 0; - virtual void post_entity_packet_received() = 0; - virtual void post_network_data_received(int commands_acknowledged) = 0; - virtual bool is_in_prediction() = 0; - virtual bool is_first_time_predicted() = 0; - virtual int get_incoming_packet_number() = 0; - virtual void get_view_origin(Vec3& org) = 0; - virtual void set_view_origin(Vec3& org) = 0; - virtual void get_view_angles(Vec3& ang) = 0; - virtual void set_view_angles(Vec3& ang) = 0; - virtual void get_local_view_angles(Vec3& ang) = 0; - virtual void set_local_view_angles(Vec3& ang) = 0; - virtual void run_command(Player* player, user_cmd* ucmd, MoveHelper* moveHelper) = 0; - virtual void setup_move(Player* player, user_cmd* ucmd, MoveHelper* pHelper, MoveData* move) = 0; - virtual void finish_move(Player* player, user_cmd* ucmd, MoveData* move) = 0; - virtual void setideal_pitch(Player* player, const Vec3& origin, const Vec3& angles, const Vec3& viewheight) = 0; - virtual void _update(bool received_new_world_update, bool validframe, int incoming_acknowledged, int outgoing_command) = 0; + virtual ~Prediction() { + }; + + virtual void init() = 0; + + virtual void shutdown() = 0; + + virtual void update(int startframe, bool validframe, int incoming_acknowledged, int outgoing_command) = 0; + + virtual void on_received_uncompressed_packet() = 0; + + virtual void pre_entity_packet_received(int commands_acknowledged, int current_world_update_packet) = 0; + + virtual void post_entity_packet_received() = 0; + + virtual void post_network_data_received(int commands_acknowledged) = 0; + + virtual bool is_in_prediction() = 0; + + virtual bool is_first_time_predicted() = 0; + + virtual int get_incoming_packet_number() = 0; + + virtual void get_view_origin(Vec3 &org) = 0; + + virtual void set_view_origin(Vec3 &org) = 0; + + virtual void get_view_angles(Vec3 &ang) = 0; + + virtual void set_view_angles(Vec3 &ang) = 0; + + virtual void get_local_view_angles(Vec3 &ang) = 0; + + virtual void set_local_view_angles(Vec3 &ang) = 0; + + virtual void run_command(Player *player, user_cmd *ucmd, MoveHelper *moveHelper) = 0; + + virtual void setup_move(Player *player, user_cmd *ucmd, MoveHelper *pHelper, MoveData *move) = 0; + + virtual void finish_move(Player *player, user_cmd *ucmd, MoveData *move) = 0; + + virtual void setideal_pitch(Player *player, const Vec3 &origin, const Vec3 &angles, const Vec3 &viewheight) = 0; + virtual void _update(bool received_new_world_update, bool validframe, int incoming_acknowledged, + int outgoing_command) = 0; public: - int last_ground; - bool in_prediction; - bool first_time_predicted; - bool old_cl_predict_value; - bool engine_paused; - int previous_start_frame; - int commands_predicted; - int server_commands_acknowledged; - int previous_ack_had_errors; - int incoming_packet_number; - float ideal_pitch; + int last_ground; + bool in_prediction; + bool first_time_predicted; + bool old_cl_predict_value; + bool engine_paused; + int previous_start_frame; + int commands_predicted; + int server_commands_acknowledged; + int previous_ack_had_errors; + int incoming_packet_number; + float ideal_pitch; }; -inline static Prediction* prediction; +inline static Prediction *prediction; #endif diff --git a/interfaces/render_view.hpp b/interfaces/render_view.hpp index cb23620..244ee06 100644 --- a/interfaces/render_view.hpp +++ b/interfaces/render_view.hpp @@ -8,87 +8,89 @@ class RenderView { public: - void get_matrices_for_view(const view_setup& view, VMatrix* world_to_screen, VMatrix* view_to_projection, VMatrix* world_to_projection, VMatrix* world_to_pixels) { - void** vtable = *(void ***)this; + void get_matrices_for_view(const view_setup &view, VMatrix *world_to_screen, VMatrix *view_to_projection, + VMatrix *world_to_projection, VMatrix *world_to_pixels) { + void **vtable = *reinterpret_cast(this); - void (*get_matrices_for_view_fn)(void*, const view_setup&, VMatrix*, VMatrix*, VMatrix*, VMatrix*) = - (void (*)(void*, const view_setup&, VMatrix*, VMatrix*, VMatrix*, VMatrix*))vtable[50]; + void (*get_matrices_for_view_fn)(void *, const view_setup &, VMatrix *, VMatrix *, VMatrix *, VMatrix *) = + (void (*)(void *, const view_setup &, VMatrix *, VMatrix *, VMatrix *, VMatrix *)) vtable[50]; - get_matrices_for_view_fn(this, view, world_to_screen, view_to_projection, world_to_projection, world_to_pixels); - } - - bool world_to_screen(Vec3* point, Vec3* screen) { - view_setup local_view = {}; - client->get_player_view(local_view); + get_matrices_for_view_fn(this, view, world_to_screen, view_to_projection, world_to_projection, world_to_pixels); + } - VMatrix world_to_screen = {}; - VMatrix view_to_pojection = {}; - VMatrix world_to_projection = {}; - VMatrix world_to_pixels = {}; - get_matrices_for_view(local_view, &world_to_screen, &view_to_pojection, &world_to_projection, &world_to_pixels); + bool world_to_screen(Vec3 *point, Vec3 *screen) { + view_setup local_view = {}; + client->get_player_view(local_view); - Vec2 screen_size = engine->get_screen_size(); - - float w = world_to_projection[3][0] * point->x + world_to_projection[3][1] * point->y + world_to_projection[3][2] * point->z + world_to_projection[3][3]; + VMatrix world_to_screen = {}; + VMatrix view_to_pojection = {}; + VMatrix world_to_projection = {}; + VMatrix world_to_pixels = {}; + get_matrices_for_view(local_view, &world_to_screen, &view_to_pojection, &world_to_projection, &world_to_pixels); - if (w < 0.1f) return false; + Vec2 screen_size = engine->get_screen_size(); - float vOutTmp[2]; - - vOutTmp[0] = world_to_projection[0][0] * point->x + world_to_projection[0][1] * point->y + world_to_projection[0][2] * point->z + world_to_projection[0][3]; - vOutTmp[1] = world_to_projection[1][0] * point->x + world_to_projection[1][1] * point->y + world_to_projection[1][2] * point->z + world_to_projection[1][3]; - float invw = 1.0f / w; + float w = world_to_projection[3][0] * point->x + world_to_projection[3][1] * point->y + world_to_projection[3][ + 2] * point->z + world_to_projection[3][3]; - vOutTmp[0] *= invw; - vOutTmp[1] *= invw; + if (w < 0.1f) return false; - float x = screen_size.x / 2.0f; - float y = screen_size.y / 2.0f; + float vOutTmp[2]; - x += 0.5f * vOutTmp[0] * screen_size.x + 0.5f; - y -= 0.5f * vOutTmp[1] * screen_size.y + 0.5f; - - screen->x = x * 100.f / 100.f; - screen->y = y * 100.f / 100.f; - - return true; - } + vOutTmp[0] = world_to_projection[0][0] * point->x + world_to_projection[0][1] * point->y + world_to_projection[ + 0][2] * point->z + world_to_projection[0][3]; + vOutTmp[1] = world_to_projection[1][0] * point->x + world_to_projection[1][1] * point->y + world_to_projection[ + 1][2] * point->z + world_to_projection[1][3]; + const float invw = 1.0f / w; - void set_color_modulation(const RGBA_float* blend) { - void** vtable = *(void ***)this; + vOutTmp[0] *= invw; + vOutTmp[1] *= invw; - void (*set_color_modulation_fn)(void*, const RGBA_float*) = (void (*)(void*, const RGBA_float*))vtable[6]; + float x = screen_size.x / 2.0f; + float y = screen_size.y / 2.0f; - set_color_modulation_fn(this, blend); - } + x += 0.5f * vOutTmp[0] * screen_size.x + 0.5f; + y -= 0.5f * vOutTmp[1] * screen_size.y + 0.5f; - void get_color_modulation(RGBA_float* blend) { - void** vtable = *(void ***)this; + screen->x = x * 100.f / 100.f; + screen->y = y * 100.f / 100.f; - void (*get_color_modulation_fn)(void*, RGBA_float*) = (void (*)(void*, RGBA_float*))vtable[7]; + return true; + } - get_color_modulation_fn(this, blend); - } - - void set_blend(float blend) { - void** vtable = *(void ***)this; + void set_color_modulation(const RGBA_float *blend) { + void **vtable = *reinterpret_cast(this); - void (*set_blend_fn)(void*, float) = (void (*)(void*, float))vtable[4]; + void (*set_color_modulation_fn)(void *, const RGBA_float *) = (void (*)(void *, const RGBA_float *)) vtable[6]; - set_blend_fn(this, blend); - } - - float get_blend() { - void** vtable = *(void ***)this; + set_color_modulation_fn(this, blend); + } - float (*get_blend_fn)(void*) = (float (*)(void*))vtable[5]; + void get_color_modulation(RGBA_float *blend) { + void **vtable = *reinterpret_cast(this); - return get_blend_fn(this); - } - + void (*get_color_modulation_fn)(void *, RGBA_float *) = (void (*)(void *, RGBA_float *)) vtable[7]; + + get_color_modulation_fn(this, blend); + } + + void set_blend(float blend) { + void **vtable = *reinterpret_cast(this); + + void (*set_blend_fn)(void *, float) = (void (*)(void *, float)) vtable[4]; + + set_blend_fn(this, blend); + } + + float get_blend() { + void **vtable = *reinterpret_cast(this); + + float (*get_blend_fn)(void *) = (float (*)(void *)) vtable[5]; + + return get_blend_fn(this); + } }; -inline static RenderView* render_view; +inline static RenderView *render_view; #endif - diff --git a/interfaces/steam_client.hpp b/interfaces/steam_client.hpp index 432fa3a..57a9939 100644 --- a/interfaces/steam_client.hpp +++ b/interfaces/steam_client.hpp @@ -3,31 +3,35 @@ class SteamClient { public: - /* Steam Pipe Handle */ int create_steam_pipe(void) { - void** vtable = *(void***)this; + /* Steam Pipe Handle */ + int create_steam_pipe(void) { + void **vtable = *reinterpret_cast(this); - int (*create_steam_pipe_fn)(void*) = (int (*)(void*))vtable[0]; - - return create_steam_pipe_fn(this); - } + int (*create_steam_pipe_fn)(void *) = (int (*)(void *)) vtable[0]; - /* Steam User Handle */ int connect_to_global_user(int steam_pipe) { - void** vtable = *(void***)this; + return create_steam_pipe_fn(this); + } - int (*connect_to_global_user_fn)(void*, int) = (int (*)(void*, int))vtable[2]; + /* Steam User Handle */ + int connect_to_global_user(int steam_pipe) { + void **vtable = *reinterpret_cast(this); - return connect_to_global_user_fn(this, steam_pipe); - } + int (*connect_to_global_user_fn)(void *, int) = (int (*)(void *, int)) vtable[2]; - /* Steam Friends Interface */ void* get_steam_friends_interface(int steam_user, int steam_pipe, const char* version) { - void** vtable = *(void***)this; + return connect_to_global_user_fn(this, steam_pipe); + } - void* (*get_steam_friends_interface_fn)(void*, int, int, const char*) = (void* (*)(void*, int, int, const char*))vtable[8]; + /* Steam Friends Interface */ + void *get_steam_friends_interface(int steam_user, int steam_pipe, const char *version) { + void **vtable = *reinterpret_cast(this); - return get_steam_friends_interface_fn(this, steam_user, steam_pipe, version); - } + void * (*get_steam_friends_interface_fn)(void *, int, int, const char *) = (void* (*)( + void *, int, int, const char *)) vtable[8]; + + return get_steam_friends_interface_fn(this, steam_user, steam_pipe, version); + } }; -inline static SteamClient* steam_client; +inline static SteamClient *steam_client; -#endif +#endif diff --git a/interfaces/steam_friends.hpp b/interfaces/steam_friends.hpp index f9de5cc..dfaff35 100644 --- a/interfaces/steam_friends.hpp +++ b/interfaces/steam_friends.hpp @@ -3,95 +3,94 @@ // https://github.com/rei-2/Amalgam/blob/c1c6bf64d739538b48a301ddc5e1a988cb9b479c/Amalgam/src/SDK/Definitions/Steam/SteamClientPublic.h#L224 enum EAccountType { - k_EAccountTypeInvalid = 0, - k_EAccountTypeIndividual = 1, // single user account - k_EAccountTypeMultiseat = 2, // multiseat (e.g. cybercafe) account - k_EAccountTypeGameServer = 3, // game server account - k_EAccountTypeAnonGameServer = 4, // anonymous game server account - k_EAccountTypePending = 5, // pending - k_EAccountTypeContentServer = 6, // content server - k_EAccountTypeClan = 7, - k_EAccountTypeChat = 8, - k_EAccountTypeConsoleUser = 9, // Fake SteamID for local PSN account on PS3 or Live account on 360, etc. - k_EAccountTypeAnonUser = 10, + k_EAccountTypeInvalid = 0, + k_EAccountTypeIndividual = 1, // single user account + k_EAccountTypeMultiseat = 2, // multiseat (e.g. cybercafe) account + k_EAccountTypeGameServer = 3, // game server account + k_EAccountTypeAnonGameServer = 4, // anonymous game server account + k_EAccountTypePending = 5, // pending + k_EAccountTypeContentServer = 6, // content server + k_EAccountTypeClan = 7, + k_EAccountTypeChat = 8, + k_EAccountTypeConsoleUser = 9, // Fake SteamID for local PSN account on PS3 or Live account on 360, etc. + k_EAccountTypeAnonUser = 10, - // Max of 16 items in this field - k_EAccountTypeMax + // Max of 16 items in this field + k_EAccountTypeMax }; // https://github.com/rei-2/Amalgam/blob/c1c6bf64d739538b48a301ddc5e1a988cb9b479c/Amalgam/src/SDK/Definitions/Steam/ISteamFriends.h#L68 enum EFriendFlags { - k_EFriendFlagNone = 0x00, - k_EFriendFlagBlocked = 0x01, - k_EFriendFlagFriendshipRequested = 0x02, - k_EFriendFlagImmediate = 0x04, // "regular" friend - k_EFriendFlagClanMember = 0x08, - k_EFriendFlagOnGameServer = 0x10, - // k_EFriendFlagHasPlayedWith = 0x20, // not currently used - // k_EFriendFlagFriendOfFriend = 0x40, // not currently used - k_EFriendFlagRequestingFriendship = 0x80, - k_EFriendFlagRequestingInfo = 0x100, - k_EFriendFlagIgnored = 0x200, - k_EFriendFlagIgnoredFriend = 0x400, - // k_EFriendFlagSuggested = 0x800, // not used - k_EFriendFlagChatMember = 0x1000, - k_EFriendFlagAll = 0xFFFF, + k_EFriendFlagNone = 0x00, + k_EFriendFlagBlocked = 0x01, + k_EFriendFlagFriendshipRequested = 0x02, + k_EFriendFlagImmediate = 0x04, // "regular" friend + k_EFriendFlagClanMember = 0x08, + k_EFriendFlagOnGameServer = 0x10, + // k_EFriendFlagHasPlayedWith = 0x20, // not currently used + // k_EFriendFlagFriendOfFriend = 0x40, // not currently used + k_EFriendFlagRequestingFriendship = 0x80, + k_EFriendFlagRequestingInfo = 0x100, + k_EFriendFlagIgnored = 0x200, + k_EFriendFlagIgnoredFriend = 0x400, + // k_EFriendFlagSuggested = 0x800, // not used + k_EFriendFlagChatMember = 0x1000, + k_EFriendFlagAll = 0xFFFF, }; // https://github.com/rei-2/Amalgam/blob/c1c6bf64d739538b48a301ddc5e1a988cb9b479c/Amalgam/src/SDK/Definitions/Steam/SteamUniverse.h#L15 enum EUniverse { - k_EUniverseInvalid = 0, - k_EUniversePublic = 1, - k_EUniverseBeta = 2, - k_EUniverseInternal = 3, - k_EUniverseDev = 4, - // k_EUniverseRC = 5, // no such universe anymore - k_EUniverseMax + k_EUniverseInvalid = 0, + k_EUniversePublic = 1, + k_EUniverseBeta = 2, + k_EUniverseInternal = 3, + k_EUniverseDev = 4, + // k_EUniverseRC = 5, // no such universe anymore + k_EUniverseMax }; // https://github.com/rei-2/Amalgam/blob/c1c6bf64d739538b48a301ddc5e1a988cb9b479c/Amalgam/src/SDK/Definitions/Steam/SteamClientPublic.h#L467 class SteamID { public: - - SteamID(int unAccountID, unsigned int unAccountInstance, EUniverse eUniverse, EAccountType eAccountType) { - InstancedSet( unAccountID, unAccountInstance, eUniverse, eAccountType ); - } + SteamID(int unAccountID, unsigned int unAccountInstance, EUniverse eUniverse, EAccountType eAccountType) { + InstancedSet(unAccountID, unAccountInstance, eUniverse, eAccountType); + } - void InstancedSet(int unAccountID, int unInstance, EUniverse eUniverse, EAccountType eAccountType) { - m_steamid.m_comp.m_unAccountID = unAccountID; - m_steamid.m_comp.m_EUniverse = eUniverse; - m_steamid.m_comp.m_EAccountType = eAccountType; - m_steamid.m_comp.m_unAccountInstance = unInstance; - } - - union SteamID_t { - struct SteamIDComponent_t { - int m_unAccountID : 32; // unique account identifier - unsigned int m_unAccountInstance : 20; // dynamic instance ID - unsigned int m_EAccountType : 4; // type of account - can't show as EAccountType, due to signed / unsigned difference - EUniverse m_EUniverse : 8; // universe this account belongs to - } m_comp; + void InstancedSet(int unAccountID, int unInstance, EUniverse eUniverse, EAccountType eAccountType) { + m_steamid.m_comp.m_unAccountID = unAccountID; + m_steamid.m_comp.m_EUniverse = eUniverse; + m_steamid.m_comp.m_EAccountType = eAccountType; + m_steamid.m_comp.m_unAccountInstance = unInstance; + } - unsigned long m_unAll64Bits; - } m_steamid; + union SteamID_t { + struct SteamIDComponent_t { + int m_unAccountID: 32; // unique account identifier + unsigned int m_unAccountInstance: 20; // dynamic instance ID + unsigned int m_EAccountType: 4; + // type of account - can't show as EAccountType, due to signed / unsigned difference + EUniverse m_EUniverse: 8; // universe this account belongs to + } m_comp; + + unsigned long m_unAll64Bits; + } m_steamid; }; class SteamFriends { public: + bool has_friend(SteamID steam_friend_id, int friend_flags) { + void **vtable = *reinterpret_cast(this); - bool has_friend(SteamID steam_friend_id, int friend_flags) { - void** vtable = *(void***)this; - - bool (*has_friend_fn)(void*, SteamID, int) = (bool (*)(void*, SteamID, int))vtable[17]; + bool (*has_friend_fn)(void *, SteamID, int) = (bool (*)(void *, SteamID, int)) vtable[17]; - return has_friend_fn(this, steam_friend_id, friend_flags); - } + return has_friend_fn(this, steam_friend_id, friend_flags); + } - bool is_friend(int friend_id) { - return has_friend({friend_id, 1, k_EUniversePublic, k_EAccountTypeIndividual}, k_EFriendFlagImmediate); - } + bool is_friend(int friend_id) { + return has_friend({friend_id, 1, k_EUniversePublic, k_EAccountTypeIndividual}, k_EFriendFlagImmediate); + } }; -inline static SteamFriends* steam_friends; +inline static SteamFriends *steam_friends; #endif diff --git a/interfaces/surface.hpp b/interfaces/surface.hpp index f07b671..9173627 100644 --- a/interfaces/surface.hpp +++ b/interfaces/surface.hpp @@ -9,136 +9,138 @@ class Surface { public: - void set_rgba(int r, int g, int b, int a) { - void** vtable = *(void ***)this; + void set_rgba(int r, int g, int b, int a) { + void **vtable = *reinterpret_cast(this); - void (*set_rgba_fn)(void*, int, int, int, int) = (void (*)(void*, int, int, int, int))vtable[10]; + void (*set_rgba_fn)(void *, int, int, int, int) = (void (*)(void *, int, int, int, int)) vtable[10]; - set_rgba_fn(this, r, g, b, a); - } + set_rgba_fn(this, r, g, b, a); + } - void set_rgba(RGBA color) { - void** vtable = *(void ***)this; + void set_rgba(RGBA color) { + void **vtable = *reinterpret_cast(this); - void (*set_rgba_fn)(void*, int, int, int, int) = (void (*)(void*, int, int, int, int))vtable[10]; + void (*set_rgba_fn)(void *, int, int, int, int) = (void (*)(void *, int, int, int, int)) vtable[10]; - set_rgba_fn(this, color.r, color.g, color.b, color.a); - } + set_rgba_fn(this, color.r, color.g, color.b, color.a); + } - - void draw_line(int x1, int y1, int x2, int y2) { - void** vtable = *(void ***)this; - void (*draw_line_fn)(void*, int, int, int, int) = (void (*)(void*, int, int, int, int))vtable[15]; + void draw_line(int x1, int y1, int x2, int y2) { + void **vtable = *reinterpret_cast(this); - draw_line_fn(this, x1, y1, x2, y2); - } + void (*draw_line_fn)(void *, int, int, int, int) = (void (*)(void *, int, int, int, int)) vtable[15]; - - void draw_filled_rect(int x1, int y1, int x2, int y2) { - void** vtable = *(void ***)this; + draw_line_fn(this, x1, y1, x2, y2); + } - void (*draw_filled_rect_fn)(void*, int, int, int, int) = (void (*)(void*, int, int, int, int))vtable[12]; - draw_filled_rect_fn(this, x1, y1, x2, y2); - } + void draw_filled_rect(int x1, int y1, int x2, int y2) { + void **vtable = *reinterpret_cast(this); - void draw_outlined_rect(int x1, int y1, int x2, int y2) { - void** vtable = *(void ***)this; + void (*draw_filled_rect_fn)(void *, int, int, int, int) = (void (*)(void *, int, int, int, int)) vtable[12]; - void (*draw_outlined_rect_fn)(void*, int, int, int, int) = (void (*)(void*, int, int, int, int))vtable[14]; + draw_filled_rect_fn(this, x1, y1, x2, y2); + } - draw_outlined_rect_fn(this, x1, y1, x2, y2); - } - - unsigned long text_create_font(void) { - void** vtable = *(void ***)this; + void draw_outlined_rect(int x1, int y1, int x2, int y2) { + void **vtable = *reinterpret_cast(this); - unsigned long (*text_create_font_fn)(void*) = (unsigned long (*)(void*))vtable[66]; + void (*draw_outlined_rect_fn)(void *, int, int, int, int) = (void (*)(void *, int, int, int, int)) vtable[14]; - return text_create_font_fn(this); - } + draw_outlined_rect_fn(this, x1, y1, x2, y2); + } - char text_set_font_glyph_set(unsigned long font, const char *name, int tall, int weight, int blur, int scanlines, int flags) { - void** vtable = *(void ***)this; + unsigned long text_create_font(void) { + void **vtable = *reinterpret_cast(this); - char (*text_set_font_glyph_set_fn)(void*, unsigned long, const char*, int, int, int, int, int, int, int) = - (char (*)(void*, unsigned long, const char*, int, int, int, int, int, int, int))vtable[67]; + unsigned long (*text_create_font_fn)(void *) = (unsigned long (*)(void *)) vtable[66]; - return text_set_font_glyph_set_fn(this, font, name, tall, weight, blur, scanlines, flags, 0, 0); - } + return text_create_font_fn(this); + } - int get_font_height(unsigned long font) { - return config.debug.font_height; //CHANGE ME: use virtual function GetFontTall instead - } - - int get_character_width(unsigned long font, int character) { - void** vtable = *(void ***)this; + char text_set_font_glyph_set(unsigned long font, const char *name, int tall, int weight, int blur, int scanlines, + int flags) { + void **vtable = *reinterpret_cast(this); - int (*draw_set_text_font_fn)(void*, unsigned long, int) = (int (*)(void*, unsigned long, int))vtable[74]; + char (*text_set_font_glyph_set_fn)(void *, unsigned long, const char *, int, int, int, int, int, int, int) = + (char (*)(void *, unsigned long, const char *, int, int, int, int, int, int, int)) vtable[67]; - return draw_set_text_font_fn(this, font, character); - } + return text_set_font_glyph_set_fn(this, font, name, tall, weight, blur, scanlines, flags, 0, 0); + } - unsigned int get_string_width(unsigned long font, const wchar_t* string) { - unsigned int string_width = 0; - for (unsigned int i = 0; i < wcslen(string); ++i) { - string_width += get_character_width(font, string[i]); + int get_font_height(unsigned long font) { + return config.debug.font_height; //CHANGE ME: use virtual function GetFontTall instead } - return string_width; - } - - void draw_set_text_font(unsigned long font) { - void** vtable = *(void ***)this; + int get_character_width(unsigned long font, int character) { + void **vtable = *reinterpret_cast(this); - void (*draw_set_text_font_fn)(void*, unsigned long) = (void (*)(void*, unsigned long))vtable[17]; + int (*draw_set_text_font_fn)(void *, unsigned long, int) = (int (*)(void *, unsigned long, int)) vtable[74]; - draw_set_text_font_fn(this, font); - } + return draw_set_text_font_fn(this, font, character); + } - void draw_set_text_color(int r, int g, int b, int a) { - void** vtable = *(void ***)this; + unsigned int get_string_width(unsigned long font, const wchar_t *string) { + unsigned int string_width = 0; + for (unsigned int i = 0; i < wcslen(string); ++i) { + string_width += get_character_width(font, string[i]); + } - void (*draw_set_text_color_fn)(void*, int, int, int, int) = (void (*)(void*, int, int, int, int))vtable[18]; + return string_width; + } - draw_set_text_color_fn(this, r, g, b, a); - } + void draw_set_text_font(unsigned long font) { + void **vtable = *reinterpret_cast(this); - void draw_set_text_pos(unsigned int x, unsigned int y) { - void** vtable = *(void ***)this; + void (*draw_set_text_font_fn)(void *, unsigned long) = (void (*)(void *, unsigned long)) vtable[17]; - void (*draw_set_text_pos_fn)(void*, unsigned int, unsigned int) = (void (*)(void*, unsigned int, unsigned int))vtable[20]; + draw_set_text_font_fn(this, font); + } - draw_set_text_pos_fn(this, x, y); - } + void draw_set_text_color(int r, int g, int b, int a) { + void **vtable = *reinterpret_cast(this); - void draw_print_text(const wchar_t *text, int text_len) { - void** vtable = *(void ***)this; + void (*draw_set_text_color_fn)(void *, int, int, int, int) = (void (*)(void *, int, int, int, int)) vtable[18]; - void (*draw_print_text_fn)(void*, const wchar_t*, int, int) = (void (*)(void*, const wchar_t*, int, int))vtable[22]; + draw_set_text_color_fn(this, r, g, b, a); + } - draw_print_text_fn(this, text, text_len, 0); - } + void draw_set_text_pos(unsigned int x, unsigned int y) { + void **vtable = *reinterpret_cast(this); - void set_cursor_visible(bool visible) { - void** vtable = *(void ***)this; + void (*draw_set_text_pos_fn)(void *, unsigned int, unsigned int) = (void ( + *)(void *, unsigned int, unsigned int)) vtable[20]; - void (*set_cursor_visible_fn)(void*, bool) = (void (*)(void*, bool))vtable[52]; + draw_set_text_pos_fn(this, x, y); + } - set_cursor_visible_fn(this, visible); - } + void draw_print_text(const wchar_t *text, int text_len) { + void **vtable = *reinterpret_cast(this); - void draw_circle(int x, int y, int radius, int segments) { - void** vtable = *(void ***)this; + void (*draw_print_text_fn)(void *, const wchar_t *, int, int) = (void (*)(void *, const wchar_t *, int, int)) + vtable[22]; - void (*draw_circle_fn)(void*, int, int, int, int) = (void (*)(void*, int, int, int, int))vtable[99]; + draw_print_text_fn(this, text, text_len, 0); + } - draw_circle_fn(this, x, y, radius, segments); - } + void set_cursor_visible(bool visible) { + void **vtable = *reinterpret_cast(this); + void (*set_cursor_visible_fn)(void *, bool) = (void (*)(void *, bool)) vtable[52]; + + set_cursor_visible_fn(this, visible); + } + + void draw_circle(int x, int y, int radius, int segments) { + void **vtable = *reinterpret_cast(this); + + void (*draw_circle_fn)(void *, int, int, int, int) = (void (*)(void *, int, int, int, int)) vtable[99]; + + draw_circle_fn(this, x, y, radius, segments); + } }; -static inline Surface* surface; +static inline Surface *surface; #endif diff --git a/main.cpp b/main.cpp index a6f55e4..51fcb14 100644 --- a/main.cpp +++ b/main.cpp @@ -48,285 +48,303 @@ #include "vec.hpp" -void** client_mode_vtable; -void** vgui_vtable; -void** client_vtable; -void** model_render_vtable; +void **client_mode_vtable; +void **vgui_vtable; +void **client_vtable; +void **model_render_vtable; -funchook_t* funchook; +funchook_t *funchook; __attribute__((constructor)) void entry() { - // Interfaces - client = (Client*)get_interface("./tf/bin/linux64/client.so", "VClient017"); - engine = (Engine*)get_interface("./bin/linux64/engine.so", "VEngineClient014"); - - vgui = get_interface("./bin/linux64/vgui2.so", "VGUI_Panel009"); - surface = (Surface*)get_interface("./bin/linux64/vguimatsurface.so", "VGUI_Surface030"); - - unsigned long func_address = (unsigned long)sigscan_module("client.so", "48 8D 05 ? ? ? ? 48 8B 38 48 8B 07 FF 90 ? ? ? ? 48 8D 15 ? ? ? ? 84 C0"); - unsigned int input_eaddr = *(unsigned int*)(func_address + 0x3); - unsigned long next_instruction = (unsigned long)(func_address + 0x7); - input = (Input*)(*(void**)(next_instruction + input_eaddr)); - - unsigned long check_stuck_address = (unsigned long)sigscan_module("client.so", "48 8D 05 ? ? ? ? 48 89 85 ? ? ? ? 74 ? 48 8B 38"); - unsigned int move_helper_eaddr = *(unsigned int*)(check_stuck_address + 0x3); - unsigned long check_stuck_next_instruction = (unsigned long)(check_stuck_address + 0x7); - move_helper = (MoveHelper*)(*(void**)(check_stuck_next_instruction + move_helper_eaddr)); - - unsigned long rcon_addr_change_address = (unsigned long)sigscan_module("engine.so", "48 8D 05 ? ? ? ? 4C 8B 40"); - unsigned int client_state_eaddr = *(unsigned int*)(rcon_addr_change_address + 0x3); - unsigned long rcon_addr_change_next_instruction = (unsigned long)(rcon_addr_change_address + 0x7); - client_state = (ClientState*)((void*)(rcon_addr_change_next_instruction + client_state_eaddr)); - - prediction = (Prediction*)get_interface("./tf/bin/linux64/client.so", "VClientPrediction001"); - - game_movement = (GameMovement*)get_interface("./tf/bin/linux64/client.so", "GameMovement001"); - - overlay = (DebugOverlay*)get_interface("./bin/linux64/engine.so", "VDebugOverlay003"); - - entity_list = (EntityList*)get_interface("./tf/bin/linux64/client.so", "VClientEntityList003"); - - render_view = (RenderView*)get_interface("./bin/linux64/engine.so", "VEngineRenderView014"); - - engine_trace = (EngineTrace*)get_interface("./bin/linux64/engine.so", "EngineTraceClient003"); - - model_render = (ModelRender*)get_interface("./bin/linux64/engine.so", "VEngineModel016"); - - material_system = (MaterialSystem*)get_interface("./bin/linux64/materialsystem.so", "VMaterialSystem082"); - - convar_system = (ConvarSystem*)get_interface("./bin/linux64/libvstdlib.so", "VEngineCvar004"); - - prediction = (Prediction*)get_interface("./tf/bin/linux64/client.so", "VClientPrediction001"); - - steam_client = (SteamClient*)get_interface("../../../linux64/steamclient.so", "SteamClient020"); - - int steam_pipe = steam_client->create_steam_pipe(); - int steam_user = steam_client->connect_to_global_user(steam_pipe); - steam_friends = (SteamFriends*)steam_client->get_steam_friends_interface(steam_user, steam_pipe, "SteamFriends017"); - - client_vtable = *(void ***)client; - void* hud_process_input_addr = client_vtable[10]; - __uint32_t client_mode_eaddr = *(__uint32_t *)((__uint64_t)(hud_process_input_addr) + 0x3); - void* client_mode_next_instruction = (void *)((__uint64_t)(hud_process_input_addr) + 0x7); - void* client_mode_interface = *(void **)((__uint64_t)(client_mode_next_instruction) + client_mode_eaddr); - - unsigned long hud_update = (unsigned long)client_vtable[11]; - unsigned int global_vars_eaddr = *(unsigned int *)(hud_update + 0x16); - unsigned long global_vars_next_instruction = (unsigned long)(hud_update + 0x1A); - global_vars = (GlobalVars*)(*(void **)(global_vars_next_instruction + global_vars_eaddr)); - - // VMT Function Hooks - client_mode_vtable = *(void***)client_mode_interface; - client_mode_create_move_original = (bool (*)(void*, float, user_cmd*))client_mode_vtable[22]; - if (!write_to_table(client_mode_vtable, 22, (void*)client_mode_create_move_hook)) { - print("ClientModeShared::CreateMove hook failed\n"); - } else { - print("ClientModeShared::CreateMove hooked\n"); - } - - client_create_move_original = (void (*)(void*, int, float, bool))client_vtable[21]; - if (!write_to_table(client_vtable, 21, (void*)client_create_move_hook)) { - print("Client::CreateMove hook failed\n"); - } else { - print("Client::CreateMove hooked\n"); - } - - override_view_original = (void (*)(void*, view_setup*))client_mode_vtable[17]; - if (!write_to_table(client_mode_vtable, 17, (void*)override_view_hook)) { - print("OverrideView hook failed\n"); - } else { - print("OverrideView hooked\n"); - } - - draw_view_model_original = (bool (*)(void*))client_mode_vtable[25]; - if (!write_to_table(client_mode_vtable, 25, (void*)draw_view_model_hook)) { - print("ShouldDrawViewModel hook failed\n"); - } else { - print("ShouldDrawViewModel hooked\n"); - } - - vgui_vtable = *(void ***)vgui; - - paint_traverse_original = (void (*)(void*, void*, __int8_t, __int8_t))vgui_vtable[42]; - if (!write_to_table(vgui_vtable, 42, (void*)paint_traverse_hook)) { - print("PaintTraverse hook failed\n"); - } else { - print("PaintTraverse hooked\n"); - } - - model_render_vtable = *(void ***)model_render; - - draw_model_execute_original = (void (*)(void*, void*, ModelRenderInfo_t*, VMatrix*))model_render_vtable[19]; - if (!write_to_table(model_render_vtable, 19, (void*)draw_model_execute_hook)) { - print("DrawModelExecute hook failed\n"); - } else { - print("DrawModelExecute hooked\n"); - } - - // Non-VMT Function hooks - funchook = funchook_create(); - - in_cond_original = (bool (*)(void*, int))sigscan_module("client.so", "55 83 FE ? 48 89 E5 41 54 41 89 F4"); - - load_white_list_original = (void* (*)(void*, const char*))sigscan_module("engine.so", "55 48 89 E5 41 55 41 54 49 89 FC 48 83 EC ? 48 8B 07 FF 50"); - - cl_move_original = (void (*)(float, bool))sigscan_module("engine.so", "55 48 89 E5 41 57 41 56 41 55 41 54 53 48 83 EC ? 83 3D ? ? ? ? ? F3 0F 11 85"); - - should_draw_local_player_original = (bool (*)(void*))sigscan_module("client.so", "55 48 89 E5 41 54 48 83 EC ? 48 8D 05 ? ? ? ? 48 8B 38 48 85 FF 74 ? 48 8B 07 FF 50"); - - should_draw_this_player_original = (bool (*)(void*))sigscan_module("client.so", "55 48 89 E5 41 54 53 E8 ? ? ? ? 84 C0 75"); - - draw_view_models_original = (void (*)(void*, view_setup*, bool))sigscan_module("client.so", "55 31 C0 48 89 E5 41 57 41 56 41 55 41 89 D5 41 54 49 89 FC 53 48 89 F3 48 81 EC"); - - attribute_hook_value_float_original = (float (*)(float, const char*, Entity*, void*, bool))sigscan_module("client.so", "55 31 C0 48 89 E5 41 57 41 56 41 55 49 89 F5 41 54 49 89 FC 53 89 CB"); - - int rv; - - rv = funchook_prepare(funchook, (void**)&in_cond_original, (void*)in_cond_hook); - if (rv != 0) { - } - - rv = funchook_prepare(funchook, (void**)&load_white_list_original, (void*)load_white_list_hook); - if (rv != 0) { - } - - rv = funchook_prepare(funchook, (void**)&cl_move_original, (void*)cl_move_hook); - if (rv != 0) { - } - - rv = funchook_prepare(funchook, (void**)&should_draw_local_player_original, (void*)should_draw_local_player_hook); - if (rv != 0) { - } - - rv = funchook_prepare(funchook, (void**)&should_draw_this_player_original, (void*)should_draw_this_player_hook); - if (rv != 0) { - } - - rv = funchook_prepare(funchook, (void**)&draw_view_models_original, (void*)draw_view_models_hook); - if (rv != 0) { - } - - key_values_constructor_original = (KeyValues* (*)(void*, const char*))sigscan_module("client.so", "55 31 C0 66 0F EF C0 48 89 E5 53"); - - rv = funchook_install(funchook, 0); - if (rv != 0) { - print("Non-VMT related hooks failed\n"); - } else { - print("InCond hooked\n"); - print("LoadWhiteList hooked\n"); - print("CL_Move hooked\n"); - //print("vkQueuePresentKHR hooked\n"); - } - - // Bespoke SDL hooking - void* lib_sdl_handle = dlopen("/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0", RTLD_LAZY | RTLD_NOLOAD); - - if (!lib_sdl_handle) { - print("Failed to load SDL2\n"); - return; - } - - print("SDL2 loaded at %p\n", lib_sdl_handle); - - if (!sdl_hook(lib_sdl_handle, "SDL_PollEvent", (void*)poll_event_hook, (void **)&poll_event_original)) { - print("Failed to hook SDL_PollEvent\n"); - return; - } - - if (!sdl_hook(lib_sdl_handle, "SDL_GL_SwapWindow", (void*)swap_window_hook, (void **)&swap_window_original)) { - print("Failed to hook SDL_GL_SwapWindow\n"); - return; - } - - dlclose(lib_sdl_handle); - - // TODO: Hook vulkan - /* - void* lib_vulkan_handle = dlopen("/run/host/usr/lib/libvulkan.so.1.4.313", RTLD_LAZY | RTLD_NOLOAD); - - if (!lib_vulkan_handle) { - print("Failed to load vulkan\n"); - return; - } - - queue_present_original = (VkResult (*)(VkQueue, const VkPresentInfoKHR*))dlsym(lib_vulkan_handle, "vkQueuePresentKHR"); - - if (!queue_present_original) { - print("Failed to locate vkQueuePresentKHR\n"); - } else { - print("vkQueuePresentKHR located at %p\n", queue_present_original); - } - - rv = funchook_prepare(funchook, (void**)&queue_present_original, (void*)queue_present_hook); - if (rv != 0) { - } - */ - - //dlclose(lib_vulkan_handle); - - - // Misc static variables and hookable things - unsigned long func_address_2 = (unsigned long)sigscan_module("client.so", "48 8D 05 ? ? ? ? BA ? ? ? ? 89 10"); // credz: vannie / @clsendmove on github - unsigned int random_seed_eaddr = *(unsigned int*)(func_address_2 + 0x3); - unsigned long func_address_2_next_instruction = (unsigned long)(func_address_2 + 0x7); - random_seed = (uint32_t*)((void*)(func_address_2_next_instruction + random_seed_eaddr)); - - return; + // Interfaces + client = static_cast(get_interface("./tf/bin/linux64/client.so", "VClient017")); + engine = static_cast(get_interface("./bin/linux64/engine.so", "VEngineClient014")); + + vgui = get_interface("./bin/linux64/vgui2.so", "VGUI_Panel009"); + surface = static_cast(get_interface("./bin/linux64/vguimatsurface.so", "VGUI_Surface030")); + + unsigned long func_address = reinterpret_cast(sigscan_module("client.so", + "48 8D 05 ? ? ? ? 48 8B 38 48 8B 07 FF 90 ? ? ? ? 48 8D 15 ? ? ? ? 84 C0")); + unsigned int input_eaddr = *reinterpret_cast(func_address + 0x3); + unsigned long next_instruction = func_address + 0x7; + input = static_cast(*reinterpret_cast(next_instruction + input_eaddr)); + + unsigned long check_stuck_address = reinterpret_cast(sigscan_module( + "client.so", "48 8D 05 ? ? ? ? 48 89 85 ? ? ? ? 74 ? 48 8B 38")); + unsigned int move_helper_eaddr = *reinterpret_cast(check_stuck_address + 0x3); + unsigned long check_stuck_next_instruction = check_stuck_address + 0x7; + move_helper = static_cast(*reinterpret_cast( + check_stuck_next_instruction + move_helper_eaddr)); + + unsigned long rcon_addr_change_address = reinterpret_cast(sigscan_module( + "engine.so", "48 8D 05 ? ? ? ? 4C 8B 40")); + unsigned int client_state_eaddr = *reinterpret_cast(rcon_addr_change_address + 0x3); + unsigned long rcon_addr_change_next_instruction = rcon_addr_change_address + 0x7; + client_state = static_cast(reinterpret_cast( + rcon_addr_change_next_instruction + client_state_eaddr)); + + prediction = static_cast(get_interface("./tf/bin/linux64/client.so", "VClientPrediction001")); + + game_movement = static_cast(get_interface("./tf/bin/linux64/client.so", "GameMovement001")); + + overlay = static_cast(get_interface("./bin/linux64/engine.so", "VDebugOverlay003")); + + entity_list = static_cast(get_interface("./tf/bin/linux64/client.so", "VClientEntityList003")); + + render_view = static_cast(get_interface("./bin/linux64/engine.so", "VEngineRenderView014")); + + engine_trace = static_cast(get_interface("./bin/linux64/engine.so", "EngineTraceClient003")); + + model_render = static_cast(get_interface("./bin/linux64/engine.so", "VEngineModel016")); + + material_system = static_cast(get_interface("./bin/linux64/materialsystem.so", + "VMaterialSystem082")); + + convar_system = static_cast(get_interface("./bin/linux64/libvstdlib.so", "VEngineCvar004")); + + prediction = static_cast(get_interface("./tf/bin/linux64/client.so", "VClientPrediction001")); + + steam_client = static_cast(get_interface("../../../linux64/steamclient.so", "SteamClient020")); + + int steam_pipe = steam_client->create_steam_pipe(); + int steam_user = steam_client->connect_to_global_user(steam_pipe); + steam_friends = static_cast(steam_client->get_steam_friends_interface( + steam_user, steam_pipe, "SteamFriends017")); + + client_vtable = *reinterpret_cast(client); + void *hud_process_input_addr = client_vtable[10]; + __uint32_t client_mode_eaddr = *reinterpret_cast<__uint32_t *>( + reinterpret_cast<__uint64_t>(hud_process_input_addr) + 0x3); + void *client_mode_next_instruction = reinterpret_cast( + reinterpret_cast<__uint64_t>(hud_process_input_addr) + 0x7); + void *client_mode_interface = *reinterpret_cast( + reinterpret_cast<__uint64_t>(client_mode_next_instruction) + client_mode_eaddr); + + unsigned long hud_update = reinterpret_cast(client_vtable[11]); + unsigned int global_vars_eaddr = *reinterpret_cast(hud_update + 0x16); + unsigned long global_vars_next_instruction = hud_update + 0x1A; + global_vars = static_cast(*reinterpret_cast( + global_vars_next_instruction + global_vars_eaddr)); + + // VMT Function Hooks + client_mode_vtable = *static_cast(client_mode_interface); + client_mode_create_move_original = (bool (*)(void *, float, user_cmd *)) client_mode_vtable[22]; + if (!write_to_table(client_mode_vtable, 22, (void *) client_mode_create_move_hook)) { + print("ClientModeShared::CreateMove hook failed\n"); + } else { + print("ClientModeShared::CreateMove hooked\n"); + } + + client_create_move_original = (void (*)(void *, int, float, bool)) client_vtable[21]; + if (!write_to_table(client_vtable, 21, (void *) client_create_move_hook)) { + print("Client::CreateMove hook failed\n"); + } else { + print("Client::CreateMove hooked\n"); + } + + override_view_original = (void (*)(void *, view_setup *)) client_mode_vtable[17]; + if (!write_to_table(client_mode_vtable, 17, (void *) override_view_hook)) { + print("OverrideView hook failed\n"); + } else { + print("OverrideView hooked\n"); + } + + draw_view_model_original = (bool (*)(void *)) client_mode_vtable[25]; + if (!write_to_table(client_mode_vtable, 25, (void *) draw_view_model_hook)) { + print("ShouldDrawViewModel hook failed\n"); + } else { + print("ShouldDrawViewModel hooked\n"); + } + + vgui_vtable = *static_cast(vgui); + + paint_traverse_original = (void (*)(void *, void *, __int8_t, __int8_t)) vgui_vtable[42]; + if (!write_to_table(vgui_vtable, 42, (void *) paint_traverse_hook)) { + print("PaintTraverse hook failed\n"); + } else { + print("PaintTraverse hooked\n"); + } + + model_render_vtable = *(void ***) model_render; + + draw_model_execute_original = (void (*)(void *, void *, ModelRenderInfo_t *, VMatrix *)) model_render_vtable[19]; + if (!write_to_table(model_render_vtable, 19, (void *) draw_model_execute_hook)) { + print("DrawModelExecute hook failed\n"); + } else { + print("DrawModelExecute hooked\n"); + } + + // Non-VMT Function hooks + funchook = funchook_create(); + + in_cond_original = (bool (*)(void *, int)) sigscan_module("client.so", "55 83 FE ? 48 89 E5 41 54 41 89 F4"); + + load_white_list_original = (void* (*)(void *, const char *)) sigscan_module( + "engine.so", "55 48 89 E5 41 55 41 54 49 89 FC 48 83 EC ? 48 8B 07 FF 50"); + + cl_move_original = (void (*)(float, bool)) sigscan_module("engine.so", + "55 48 89 E5 41 57 41 56 41 55 41 54 53 48 83 EC ? 83 3D ? ? ? ? ? F3 0F 11 85"); + + should_draw_local_player_original = (bool (*)(void *)) sigscan_module( + "client.so", "55 48 89 E5 41 54 48 83 EC ? 48 8D 05 ? ? ? ? 48 8B 38 48 85 FF 74 ? 48 8B 07 FF 50"); + + should_draw_this_player_original = (bool (*)(void *)) sigscan_module( + "client.so", "55 48 89 E5 41 54 53 E8 ? ? ? ? 84 C0 75"); + + draw_view_models_original = (void (*)(void *, view_setup *, bool)) sigscan_module( + "client.so", "55 31 C0 48 89 E5 41 57 41 56 41 55 41 89 D5 41 54 49 89 FC 53 48 89 F3 48 81 EC"); + + attribute_hook_value_float_original = (float (*)(float, const char *, Entity *, void *, bool)) sigscan_module( + "client.so", "55 31 C0 48 89 E5 41 57 41 56 41 55 49 89 F5 41 54 49 89 FC 53 89 CB"); + + int rv = funchook_prepare(funchook, reinterpret_cast(&in_cond_original), (void *) in_cond_hook); + if (rv != 0) { + } + + rv = funchook_prepare(funchook, reinterpret_cast(&load_white_list_original), + (void *) load_white_list_hook); + if (rv != 0) { + } + + rv = funchook_prepare(funchook, reinterpret_cast(&cl_move_original), (void *) cl_move_hook); + if (rv != 0) { + } + + rv = funchook_prepare(funchook, reinterpret_cast(&should_draw_local_player_original), + (void *) should_draw_local_player_hook); + if (rv != 0) { + } + + rv = funchook_prepare(funchook, reinterpret_cast(&should_draw_this_player_original), + (void *) should_draw_this_player_hook); + if (rv != 0) { + } + + rv = funchook_prepare(funchook, reinterpret_cast(&draw_view_models_original), + (void *) draw_view_models_hook); + if (rv != 0) { + } + + key_values_constructor_original = (KeyValues* (*)(void *, const char *)) sigscan_module( + "client.so", "55 31 C0 66 0F EF C0 48 89 E5 53"); + + rv = funchook_install(funchook, 0); + if (rv != 0) { + print("Non-VMT related hooks failed\n"); + } else { + print("InCond hooked\n"); + print("LoadWhiteList hooked\n"); + print("CL_Move hooked\n"); + //print("vkQueuePresentKHR hooked\n"); + } + + // Bespoke SDL hooking + void *lib_sdl_handle = dlopen("/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0", RTLD_LAZY | RTLD_NOLOAD); + + if (!lib_sdl_handle) { + print("Failed to load SDL2\n"); + return; + } + + print("SDL2 loaded at %p\n", lib_sdl_handle); + + if (!sdl_hook(lib_sdl_handle, "SDL_PollEvent", (void *) poll_event_hook, (void **) &poll_event_original)) { + print("Failed to hook SDL_PollEvent\n"); + return; + } + + if (!sdl_hook(lib_sdl_handle, "SDL_GL_SwapWindow", (void *) swap_window_hook, (void **) &swap_window_original)) { + print("Failed to hook SDL_GL_SwapWindow\n"); + return; + } + + dlclose(lib_sdl_handle); + + // TODO: Hook vulkan + /* + void* lib_vulkan_handle = dlopen("/run/host/usr/lib/libvulkan.so.1.4.313", RTLD_LAZY | RTLD_NOLOAD); + + if (!lib_vulkan_handle) { + print("Failed to load vulkan\n"); + return; + } + + queue_present_original = (VkResult (*)(VkQueue, const VkPresentInfoKHR*))dlsym(lib_vulkan_handle, "vkQueuePresentKHR"); + + if (!queue_present_original) { + print("Failed to locate vkQueuePresentKHR\n"); + } else { + print("vkQueuePresentKHR located at %p\n", queue_present_original); + } + + rv = funchook_prepare(funchook, (void**)&queue_present_original, (void*)queue_present_hook); + if (rv != 0) { + } + */ + + //dlclose(lib_vulkan_handle); + + + // Misc static variables and hookable things + unsigned long func_address_2 = reinterpret_cast(sigscan_module( + "client.so", "48 8D 05 ? ? ? ? BA ? ? ? ? 89 10")); // credz: vannie / @clsendmove on github + unsigned int random_seed_eaddr = *reinterpret_cast(func_address_2 + 0x3); + unsigned long func_address_2_next_instruction = func_address_2 + 0x7; + random_seed = static_cast(reinterpret_cast( + func_address_2_next_instruction + random_seed_eaddr)); } __attribute__((destructor)) void exit() { + // Unhook VMT Functions + if (!write_to_table(client_mode_vtable, 22, (void *) client_mode_create_move_original)) { + print("ClientMode::CreateMove failed to restore hook\n"); + } - // Unhook VMT Functions - if (!write_to_table(client_mode_vtable, 22, (void*)client_mode_create_move_original)) { - print("ClientMode::CreateMove failed to restore hook\n"); - } - - if (!write_to_table(client_vtable, 21, (void*)client_create_move_original)) { - print("Client::CreateMove failed to restore hook\n"); - } - - if (!write_to_table(client_mode_vtable, 17, (void*)override_view_original)) { - print("OverrideView failed to restore hook\n"); - } - - if (!write_to_table(client_mode_vtable, 25, (void*)draw_view_model_original)) { - print("ShouldDrawViewModel failed to restore hook\n"); - } - - if (!write_to_table(vgui_vtable, 42, (void*)paint_traverse_original)) { - print("PaintTraverse failed to restore hook\n"); - } - - if (!write_to_table(model_render_vtable, 19, (void*)draw_model_execute_original)) { - print("DrawModelExecute failed to restore hook\n"); - } - - // Unhook Non-VMT Functions - funchook_uninstall(funchook, 0); - - // Unhook SDL - void *lib_sdl_handle = dlopen("/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0", RTLD_LAZY | RTLD_NOLOAD); - - if (!restore_sdl_hook(lib_sdl_handle, "SDL_GL_SwapWindow", (void*)swap_window_original)) { - print("Failed to restore SDL_GL_SwapWindow\n"); - } - - if (!restore_sdl_hook(lib_sdl_handle, "SDL_PollEvent", (void*)poll_event_original)) { - print("Failed to restore SDL_PollEvent\n"); - } - - dlclose(lib_sdl_handle); - - // Fix thirdperson hack still being enabled when not injected - { - Player* localplayer = entity_list->get_localplayer(); - localplayer->set_thirdperson(false); - } - - // Fix cursor visibility when we've removed/unhooked the menu - if (menu_focused == true) - surface->set_cursor_visible(!menu_focused); -} + if (!write_to_table(client_vtable, 21, (void *) client_create_move_original)) { + print("Client::CreateMove failed to restore hook\n"); + } + + if (!write_to_table(client_mode_vtable, 17, (void *) override_view_original)) { + print("OverrideView failed to restore hook\n"); + } + + if (!write_to_table(client_mode_vtable, 25, (void *) draw_view_model_original)) { + print("ShouldDrawViewModel failed to restore hook\n"); + } + + if (!write_to_table(vgui_vtable, 42, (void *) paint_traverse_original)) { + print("PaintTraverse failed to restore hook\n"); + } + + if (!write_to_table(model_render_vtable, 19, (void *) draw_model_execute_original)) { + print("DrawModelExecute failed to restore hook\n"); + } + + // Unhook Non-VMT Functions + funchook_uninstall(funchook, 0); + // Unhook SDL + void *lib_sdl_handle = dlopen("/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0", RTLD_LAZY | RTLD_NOLOAD); + + if (!restore_sdl_hook(lib_sdl_handle, "SDL_GL_SwapWindow", (void *) swap_window_original)) { + print("Failed to restore SDL_GL_SwapWindow\n"); + } + + if (!restore_sdl_hook(lib_sdl_handle, "SDL_PollEvent", (void *) poll_event_original)) { + print("Failed to restore SDL_PollEvent\n"); + } + + dlclose(lib_sdl_handle); + + // Fix thirdperson hack still being enabled when not injected + { + Player *localplayer = entity_list->get_localplayer(); + localplayer->set_thirdperson(false); + } + + // Fix cursor visibility when we've removed/unhooked the menu + if (menu_focused) + surface->set_cursor_visible(!menu_focused); +} diff --git a/math.hpp b/math.hpp index 398fb9b..a4d5b9c 100644 --- a/math.hpp +++ b/math.hpp @@ -12,37 +12,37 @@ #define pideg 0.017453293f inline static float distance_3d(Vec3 location_one, Vec3 location_two) { - return sqrt(((location_one.y - location_two.y)*(location_one.y - location_two.y)) + - ((location_one.x - location_two.x)*(location_one.x - location_two.x)) + - ((location_one.z - location_two.z)*(location_one.z - location_two.z))); + return sqrt(((location_one.y - location_two.y) * (location_one.y - location_two.y)) + + ((location_one.x - location_two.x) * (location_one.x - location_two.x)) + + ((location_one.z - location_two.z) * (location_one.z - location_two.z))); } -inline static void angle_vectors(Vec3 angles, Vec3* forward, Vec3* right, Vec3* up) { - double sp, sy, sr, cp, cy, cr; - sincos(angles.x * pideg, &sp, &cp); - sincos(angles.y * pideg, &sy, &cy); +inline static void angle_vectors(Vec3 angles, Vec3 *forward, Vec3 *right, Vec3 *up) { + double sp, sy, sr, cp, cy, cr; + sincos(angles.x * pideg, &sp, &cp); + sincos(angles.y * pideg, &sy, &cy); - if (forward) { - forward->x = cp * cy; - forward->y = cp * sy; - forward->z = -sp; - } + if (forward) { + forward->x = cp * cy; + forward->y = cp * sy; + forward->z = -sp; + } - if (right || up) { - sincos(angles.z * pideg, &sr, &cr); + if (right || up) { + sincos(angles.z * pideg, &sr, &cr); - if (right) { - right->x = (-1 * sr * sp * cy + -1 * cr * -sy); - right->y = (-1 * sr * sp * sy + -1 * cr * cy); - right->z = -1 * sr * cp; - } + if (right) { + right->x = (-1 * sr * sp * cy + -1 * cr * -sy); + right->y = (-1 * sr * sp * sy + -1 * cr * cy); + right->z = -1 * sr * cp; + } - if (up) { - up->x = (cr * sp * cy + -sr * -sy); - up->y = (cr * sp * sy + -sr * cy); - up->z = cr * cp; + if (up) { + up->x = (cr * sp * cy + -sr * -sy); + up->y = (cr * sp * sy + -sr * cy); + up->z = cr * cp; + } } - } } #endif diff --git a/memory.hpp b/memory.hpp index 3ee5db0..a41068f 100644 --- a/memory.hpp +++ b/memory.hpp @@ -7,41 +7,44 @@ #include "print.hpp" -static void* get_module_base_address(std::string module_name) { - std::ifstream file; - file.open("/proc/self/maps"); - - bool found = false; - - std::string line; - std::string concat_line; - while (std::getline(file, line)) { - for (int i = 0; i < line.length(); i++) { - concat_line = ""; - for (int h = 0; i+h < line.length() && h < module_name.length(); h++) { - concat_line += line[i+h]; - } - if (concat_line == module_name) { found = true; break; } +static void *get_module_base_address(std::string module_name) { + std::ifstream file; + file.open("/proc/self/maps"); + + bool found = false; + + std::string line; + std::string concat_line; + while (std::getline(file, line)) { + for (int i = 0; i < line.length(); i++) { + concat_line = ""; + for (int h = 0; i + h < line.length() && h < module_name.length(); h++) { + concat_line += line[i + h]; + } + if (concat_line == module_name) { + found = true; + break; + } + } + + if (found) { break; } } - if (found == true) {break;} - } - - concat_line = ""; - for (int i = 0; i <= line.length(); i++) { - if (line[i] == '-') { break; } - concat_line += line[i]; - } + concat_line = ""; + for (int i = 0; i <= line.length(); i++) { + if (line[i] == '-') { break; } + concat_line += line[i]; + } - // Use stringstream for conversion - std::stringstream ss; - ss << std::hex << "0x"+concat_line; + // Use stringstream for conversion + std::stringstream ss; + ss << std::hex << "0x" + concat_line; - // Store the result - unsigned long result; - ss >> result; + // Store the result + unsigned long result; + ss >> result; - return (void*)result; + return reinterpret_cast(result); } #endif diff --git a/print.hpp b/print.hpp index 57c2afb..49f8dbb 100644 --- a/print.hpp +++ b/print.hpp @@ -5,22 +5,22 @@ #include #include -static FILE* log_file = NULL; -static void print(const char* fmt, ...) { +static FILE *log_file = NULL; - if (!log_file) { - log_file = fopen("/tmp/tf2.log", "w"); - } +static void print(const char *fmt, ...) { + if (!log_file) { + log_file = fopen("/tmp/tf2.log", "w"); + } - va_list args; + va_list args; - va_start(args, fmt); + va_start(args, fmt); - vfprintf(log_file, fmt, args); + vfprintf(log_file, fmt, args); - fflush(log_file); + fflush(log_file); - va_end(args); + va_end(args); } #endif diff --git a/random_seed.hpp b/random_seed.hpp index d664fa2..4574cf2 100644 --- a/random_seed.hpp +++ b/random_seed.hpp @@ -3,6 +3,6 @@ #include -static uint32_t* random_seed; +static uint32_t *random_seed; #endif diff --git a/vec.hpp b/vec.hpp index f189a5e..b1e825c 100644 --- a/vec.hpp +++ b/vec.hpp @@ -2,139 +2,151 @@ #define VEC_HPP struct Vec2 { - int x = 0, y = 0; + int x = 0, y = 0; }; struct Vec3 { - float x = 0.0, y = 0.0, z = 0.0; - - Vec3 operator+(const Vec3 v) { - return Vec3{x + v.x, y + v.y, z + v.z}; - } - - Vec3 operator*(const Vec3 v) { - return Vec3{x * v.x, y * v.y, z * v.z}; - } - - Vec3 operator*(float v) { - return Vec3{x * v, y * v, z * v}; - } - - Vec3 operator*(int v) { - return Vec3{x * v, y * v, z * v}; - } - - Vec3& operator-=(const Vec3 v) { - x -= v.x; y -= v.y; z -= v.z; return *this; - } - - Vec3& operator+=(const Vec3 v) { - x += v.x; y += v.y; z += v.z; return *this; - } - - Vec3& operator+=(float v) { - x += v; y += v; z += v; return *this; - } - - Vec3 operator-(const Vec3 v) { - return Vec3{x - v.x, y - v.y, z - v.z}; - } + float x = 0.0, y = 0.0, z = 0.0; + + Vec3 operator+(const Vec3 v) { + return Vec3{x + v.x, y + v.y, z + v.z}; + } + + Vec3 operator*(const Vec3 v) { + return Vec3{x * v.x, y * v.y, z * v.z}; + } + + Vec3 operator*(float v) { + return Vec3{x * v, y * v, z * v}; + } + + Vec3 operator*(int v) { + return Vec3{x * v, y * v, z * v}; + } + + Vec3 &operator-=(const Vec3 v) { + x -= v.x; + y -= v.y; + z -= v.z; + return *this; + } + + Vec3 &operator+=(const Vec3 v) { + x += v.x; + y += v.y; + z += v.z; + return *this; + } + + Vec3 &operator+=(float v) { + x += v; + y += v; + z += v; + return *this; + } + + Vec3 operator-(const Vec3 v) { + return Vec3{x - v.x, y - v.y, z - v.z}; + } }; struct __attribute__((aligned(16))) Vec3_aligned { - float x = 0.0, y = 0.0, z = 0.0; + float x = 0.0, y = 0.0, z = 0.0; }; struct RGBA { - int r = 255, g = 255, b = 255, a = 255; + int r = 255, g = 255, b = 255, a = 255; }; struct RGBA_float { - float r = 1.0, g = 1.0, b = 1.0, a = 1.0; - - RGBA to_RGBA() { - return RGBA{.r = int(r * 255), .g = int(g * 255), .b = int(b * 255), .a = int(a * 255)}; - } - - float* to_arr() { - return (float*)this; - } + float r = 1.0, g = 1.0, b = 1.0, a = 1.0; + + RGBA to_RGBA() { + return RGBA{ + .r = static_cast(r * 255), .g = static_cast(g * 255), .b = static_cast(b * 255), + .a = static_cast(a * 255) + }; + } + + float *to_arr() { + return reinterpret_cast(this); + } }; typedef float VMatrix[4][4]; struct view_setup { - // left side of view window - int x; - int m_nUnscaledX; - // top side of view window - int y; - int m_nUnscaledY; - // width of view window - int width; - int m_nUnscaledWidth; - // height of view window - int height; - // which eye are we rendering? - int m_eStereoEye; - int m_nUnscaledHeight; - - // the rest are only used by 3D views - - // Orthographic projection? - bool m_bOrtho; - // View-space rectangle for ortho projection. - float m_OrthoLeft; - float m_OrthoTop; - float m_OrthoRight; - float m_OrthoBottom; - - // horizontal FOV in degrees - float fov; - // horizontal FOV in degrees for in-view model - float fovViewmodel; - - // 3D origin of camera - Vec3 origin; - - // heading of camera (pitch, yaw, roll) - Vec3 angles; - // local Z coordinate of near plane of camera - float zNear; - // local Z coordinate of far plane of camera - float zFar; - - // local Z coordinate of near plane of camera ( when rendering view model ) - float zNearViewmodel; - // local Z coordinate of far plane of camera ( when rendering view model ) - float zFarViewmodel; - - // set to true if this is to draw into a subrect of the larger screen - // this really is a hack, but no more than the rest of the way this class is used - bool m_bRenderToSubrectOfLargerScreen; - - // The aspect ratio to use for computing the perspective projection matrix - // (0.0f means use the viewport) - float m_flAspectRatio; - - // Controls for off-center projection (needed for poster rendering) - bool m_bOffCenter; - float m_flOffCenterTop; - float m_flOffCenterBottom; - float m_flOffCenterLeft; - float m_flOffCenterRight; - - // Control that the SFM needs to tell the engine not to do certain post-processing steps - bool m_bDoBloomAndToneMapping; - - // Cached mode for certain full-scene per-frame varying state such as sun entity coverage - bool m_bCacheFullSceneState; - - // If using VR, the headset calibration will feed you a projection matrix per-eye. - // This does NOT override the Z range - that will be set up as normal (i.e. the values in this matrix will be ignored). - bool m_bViewToProjectionOverride; - VMatrix m_ViewToProjection; + // left side of view window + int x; + int m_nUnscaledX; + // top side of view window + int y; + int m_nUnscaledY; + // width of view window + int width; + int m_nUnscaledWidth; + // height of view window + int height; + // which eye are we rendering? + int m_eStereoEye; + int m_nUnscaledHeight; + + // the rest are only used by 3D views + + // Orthographic projection? + bool m_bOrtho; + // View-space rectangle for ortho projection. + float m_OrthoLeft; + float m_OrthoTop; + float m_OrthoRight; + float m_OrthoBottom; + + // horizontal FOV in degrees + float fov; + // horizontal FOV in degrees for in-view model + float fovViewmodel; + + // 3D origin of camera + Vec3 origin; + + // heading of camera (pitch, yaw, roll) + Vec3 angles; + // local Z coordinate of near plane of camera + float zNear; + // local Z coordinate of far plane of camera + float zFar; + + // local Z coordinate of near plane of camera ( when rendering view model ) + float zNearViewmodel; + // local Z coordinate of far plane of camera ( when rendering view model ) + float zFarViewmodel; + + // set to true if this is to draw into a subrect of the larger screen + // this really is a hack, but no more than the rest of the way this class is used + bool m_bRenderToSubrectOfLargerScreen; + + // The aspect ratio to use for computing the perspective projection matrix + // (0.0f means use the viewport) + float m_flAspectRatio; + + // Controls for off-center projection (needed for poster rendering) + bool m_bOffCenter; + float m_flOffCenterTop; + float m_flOffCenterBottom; + float m_flOffCenterLeft; + float m_flOffCenterRight; + + // Control that the SFM needs to tell the engine not to do certain post-processing steps + bool m_bDoBloomAndToneMapping; + + // Cached mode for certain full-scene per-frame varying state such as sun entity coverage + bool m_bCacheFullSceneState; + + // If using VR, the headset calibration will feed you a projection matrix per-eye. + // This does NOT override the Z range - that will be set up as normal (i.e. the values in this matrix will be ignored). + bool m_bViewToProjectionOverride; + VMatrix m_ViewToProjection; }; #endif From e656c26a58b457d03f06c910bc55626b69ae9b51 Mon Sep 17 00:00:00 2001 From: Viceroy <97338859+Viceroyy@users.noreply.github.com> Date: Sat, 6 Sep 2025 20:56:16 +0300 Subject: [PATCH 2/2] even more changes incl. enginevgui_paint hook and engine pred (very poggers) --- classes/entity.hpp | 82 ++++---- classes/keyvalues.hpp | 3 +- classes/player.hpp | 4 +- classes/weapon.hpp | 30 +-- funchook/funchook.h | 2 +- gui/config.hpp | 38 ++-- gui/imgui/dearimgui.hpp | 116 +++++------ gui/menu.cpp | 18 +- hacks/aimbot/aimbot.cpp | 74 ++++--- hacks/bhop/bhop.cpp | 67 ++++--- hacks/chams/chams.cpp | 70 +++---- hacks/engine_prediction/engine_prediction.cpp | 42 ++-- hacks/esp/esp.hpp | 28 +-- hacks/esp/esp_entity.cpp | 40 ++-- hacks/esp/esp_player.cpp | 12 +- hacks/thirdperson/thirdperson.cpp | 16 +- hooks/cl_move.cpp | 2 +- hooks/client_create_move.cpp | 6 +- hooks/client_mode_create_move.cpp | 28 ++- hooks/draw_model_execute.cpp | 6 +- hooks/draw_view_models.cpp | 2 +- hooks/enginevgui_paint.cpp | 108 +++++++++++ hooks/override_view.cpp | 2 +- hooks/paint_traverse.cpp | 85 +------- hooks/sdl.cpp | 9 +- hooks/should_draw_local_player.cpp | 4 +- hooks/should_draw_this_player.cpp | 4 +- interfaces/client.hpp | 52 ++--- interfaces/debug_overlay.hpp | 4 +- interfaces/engine_trace.hpp | 58 +++--- interfaces/entity_list.hpp | 2 +- interfaces/input.hpp | 1 - interfaces/prediction.hpp | 5 +- interfaces/render_view.hpp | 9 +- interfaces/surface.hpp | 28 ++- libsigscan/libsigscan.c | 6 +- libsigscan/libsigscan.h | 2 +- main.cpp | 47 +++-- math.hpp | 18 +- md5.cpp | 182 ++++++++++++++++++ md5.hpp | 46 +++++ memory.hpp | 2 +- print.hpp | 6 +- vec.hpp | 41 +++- 44 files changed, 846 insertions(+), 561 deletions(-) create mode 100644 hooks/enginevgui_paint.cpp create mode 100644 md5.cpp create mode 100644 md5.hpp diff --git a/classes/entity.hpp b/classes/entity.hpp index 42e58ad..5b6a9b2 100644 --- a/classes/entity.hpp +++ b/classes/entity.hpp @@ -30,37 +30,37 @@ enum pickup_type { }; enum entity_flags { - FL_ONGROUND = (1 << 0), - FL_DUCKING = (1 << 1), - FL_WATERJUMP = (1 << 2), - FL_ONTRAIN = (1 << 3), - FL_INRAIN = (1 << 4), - FL_FROZEN = (1 << 5), - FL_ATCONTROLS = (1 << 6), - FL_CLIENT = (1 << 7), - FL_FAKECLIENT = (1 << 8), - FL_INWATER = (1 << 9), - FL_FLY = (1 << 10), - FL_SWIM = (1 << 11), - FL_CONVEYOR = (1 << 12), - FL_NPC = (1 << 13), - FL_GODMODE = (1 << 14), - FL_NOTARGET = (1 << 15), - FL_AIMTARGET = (1 << 16), - FL_PARTIALGROUND = (1 << 17), - FL_STATICPROP = (1 << 18), - FL_GRAPHED = (1 << 19), - FL_GRENADE = (1 << 20), - FL_STEPMOVEMENT = (1 << 21), - FL_DONTTOUCH = (1 << 22), - FL_BASEVELOCITY = (1 << 23), - FL_WORLDBRUSH = (1 << 24), - FL_OBJECT = (1 << 25), - FL_KILLME = (1 << 26), - FL_ONFIRE = (1 << 27), - FL_DISSOLVING = (1 << 28), - FL_TRANSRAGDOLL = (1 << 29), - FL_UNBLOCKABLE_BY_PLAYER = (1 << 30) + FL_ONGROUND = 1 << 0, + FL_DUCKING = 1 << 1, + FL_WATERJUMP = 1 << 2, + FL_ONTRAIN = 1 << 3, + FL_INRAIN = 1 << 4, + FL_FROZEN = 1 << 5, + FL_ATCONTROLS = 1 << 6, + FL_CLIENT = 1 << 7, + FL_FAKECLIENT = 1 << 8, + FL_INWATER = 1 << 9, + FL_FLY = 1 << 10, + FL_SWIM = 1 << 11, + FL_CONVEYOR = 1 << 12, + FL_NPC = 1 << 13, + FL_GODMODE = 1 << 14, + FL_NOTARGET = 1 << 15, + FL_AIMTARGET = 1 << 16, + FL_PARTIALGROUND = 1 << 17, + FL_STATICPROP = 1 << 18, + FL_GRAPHED = 1 << 19, + FL_GRENADE = 1 << 20, + FL_STEPMOVEMENT = 1 << 21, + FL_DONTTOUCH = 1 << 22, + FL_BASEVELOCITY = 1 << 23, + FL_WORLDBRUSH = 1 << 24, + FL_OBJECT = 1 << 25, + FL_KILLME = 1 << 26, + FL_ONFIRE = 1 << 27, + FL_DISSOLVING = 1 << 28, + FL_TRANSRAGDOLL = 1 << 29, + FL_UNBLOCKABLE_BY_PLAYER = 1 << 30 }; class Entity { @@ -84,11 +84,11 @@ class Entity { // TODO: Substitute "void*" with real class type void *get_networkable(void) { - return (void *) (this + 0x10); + return this + 0x10; } void *get_renderable(void) { - return (void *) (this + 0x8); + return this + 0x8; } int get_team(void) { @@ -111,21 +111,21 @@ class Entity { return (const char *) *(unsigned long *) (base_class + 0x8); } - enum pickup_type get_pickup_type(void) { + pickup_type get_pickup_type(void) { const char *model_name = get_model_name(); if (strstr(model_name, "models/items/ammopack")) { - return pickup_type::AMMOPACK; + return AMMOPACK; } if (strstr(model_name, "models/items/medkit") || strstr(model_name, "models/props_medieval/medieval_meat.mdl") || strstr(model_name, "models/props_halloween/halloween_medkit") ) { - return pickup_type::MEDKIT; + return MEDKIT; } - return pickup_type::UNKNOWN; + return UNKNOWN; } bool is_dormant(void) { @@ -166,14 +166,12 @@ class Entity { bool is_building(void) { switch (this->get_class_id()) { - case class_id::SENTRY: - case class_id::DISPENSER: - case class_id::TELEPORTER: + case SENTRY: + case DISPENSER: + case TELEPORTER: return true; default: return false; } - - return false; } }; diff --git a/classes/keyvalues.hpp b/classes/keyvalues.hpp index dbe1c47..b8f83e1 100644 --- a/classes/keyvalues.hpp +++ b/classes/keyvalues.hpp @@ -1,7 +1,7 @@ #ifndef KEYVALUES_HPP #define KEYVALUES_HPP -#include +//#include enum types_t { TYPE_NONE = 0, @@ -24,7 +24,6 @@ class KeyValues { key_values_constructor_original(this, name); } -private: int m_iKeyName; char *m_sValue; wchar_t *m_wsValue; diff --git a/classes/player.hpp b/classes/player.hpp index a8407a9..7633fb8 100644 --- a/classes/player.hpp +++ b/classes/player.hpp @@ -258,7 +258,7 @@ class Player : public Entity { return *reinterpret_cast(this + 0x1BA0); } - Vec3 get_bone_pos(int bone_num) { + Vec3 get_bone_pos(const int bone_num) { // 128 bones, 3x4 matrix float bone_to_world_out[128][3][4]; if (this->setup_bones(bone_to_world_out, 128, 0x100, this->get_simulation_time())) { @@ -386,7 +386,7 @@ class Player : public Entity { if (this->get_tf_class() == CLASS_SNIPER) { if (this->is_scoped()) { - if (const float charge_time = (this->get_tickbase() * TICK_INTERVAL) - this->get_fov_time(); + if (const float charge_time = this->get_tickbase() * TICK_INTERVAL - this->get_fov_time(); target_player->get_health() <= 50 || charge_time >= 0.2f) { return true; } else { diff --git a/classes/weapon.hpp b/classes/weapon.hpp index 4412188..253e4e2 100644 --- a/classes/weapon.hpp +++ b/classes/weapon.hpp @@ -5,7 +5,7 @@ #include "../interfaces/global_vars.hpp" -#define TICK_INTERVAL 0.015 +#define TICK_INTERVAL global_vars->interval_per_tick //https://github.com/Fedoraware/Fedoraware/blob/888d9338dbf08f6c55816c86d5887dd58cc28d98/Fedoraware/Fedoraware-TF2/src/SDK/Includes/Enums.h#L1081 enum { @@ -783,14 +783,14 @@ class Weapon : Entity { } bool is_headshot_weapon(void) { - int weapon_type_id = this->get_type_id(); + const int weapon_type_id = this->get_type_id(); if (weapon_type_id == TF_WEAPON_SNIPERRIFLE || weapon_type_id == TF_WEAPON_SNIPERRIFLE_CLASSIC || weapon_type_id == TF_WEAPON_SNIPERRIFLE_DECAP) { return true; } - int weapon_def_id = this->get_def_id(); + const int weapon_def_id = this->get_def_id(); if (weapon_def_id == Spy_m_TheAmbassador || weapon_def_id == Spy_m_FestiveAmbassador || weapon_def_id == Sniper_m_SniperRifle || @@ -818,10 +818,10 @@ class Weapon : Entity { bool can_ambassador_headshot() { Entity *owner = this->get_owner_entity(); - if (owner == nullptr) + if (!owner) return false; - return (owner->get_tickbase() * TICK_INTERVAL) - this->get_last_attack() > 1.f; + return owner->get_tickbase() * TICK_INTERVAL - this->get_last_attack() > 1.f; } float get_charged_damage(void) { @@ -842,26 +842,26 @@ class Weapon : Entity { bool can_primary_attack() { Entity *owner = this->get_owner_entity(); - if (owner == nullptr) + if (!owner) return false; - float next_attack = *reinterpret_cast(owner + 0x1088); - float next_primary_attack = this->get_next_primary_attack(); - float time = owner->get_tickbase() * global_vars->interval_per_tick; + const float next_attack = *reinterpret_cast(owner + 0x1088); + const float next_primary_attack = this->get_next_primary_attack(); + const float time = owner->get_tickbase() * TICK_INTERVAL; - return (next_primary_attack <= time && next_attack <= time); + return next_primary_attack <= time && next_attack <= time; } bool can_secondary_attack() { Entity *owner = this->get_owner_entity(); - if (owner == nullptr) + if (!owner) return false; - float next_attack = *reinterpret_cast(owner + 0x1088); - float next_secondary_attack = this->get_next_secondary_attack(); - float time = owner->get_tickbase() * global_vars->interval_per_tick; + const float next_attack = *reinterpret_cast(owner + 0x1088); + const float next_secondary_attack = this->get_next_secondary_attack(); + const float time = owner->get_tickbase() * TICK_INTERVAL; - return (next_secondary_attack <= time && next_attack <= time); + return next_secondary_attack <= time && next_attack <= time; } }; diff --git a/funchook/funchook.h b/funchook/funchook.h index 0df118b..a8f7a71 100644 --- a/funchook/funchook.h +++ b/funchook/funchook.h @@ -104,7 +104,7 @@ FUNCHOOK_EXPORT funchook_t *funchook_create(void); FUNCHOOK_EXPORT int funchook_prepare(funchook_t *funchook, void **target_func, void *hook_func); FUNCHOOK_EXPORT int funchook_prepare_with_params(funchook_t *funchook, - void **target_func, const funchook_params_t *params); + void **target_func, const funchook_params_t *params); /** * Install hooks prepared by funchook_prepare(). diff --git a/gui/config.hpp b/gui/config.hpp index 1eaa6d6..291a351 100644 --- a/gui/config.hpp +++ b/gui/config.hpp @@ -9,7 +9,7 @@ #include "../vec.hpp" struct button { - int button; + int ibutton; bool waiting = false; }; @@ -20,11 +20,11 @@ struct Aim { bool silent = true; - struct button key = {.button = -SDL_BUTTON_X1}; + button key = {.ibutton = -SDL_BUTTON_X2}; bool use_key = true; - float fov = 45; - bool draw_fov = false; + float fov = 20; + bool draw_fov = true; bool auto_scope = false; @@ -68,31 +68,31 @@ struct Esp { struct Visuals { struct Removals { - bool scope = false; + bool scope = true; bool zoom = false; } removals; struct Thirdperson { - struct button key = {.button = SDL_SCANCODE_LALT}; - bool enabled = false; - float z = 150.0f; + button key = {.ibutton = -SDL_BUTTON_X1}; + bool enabled = true; + float z = 250.0f; float y = 20.0f; float x = 0; } thirdperson; - bool override_fov = false; - float custom_fov = 90; + bool override_fov = true; + float custom_fov = 110; }; struct Misc { bool bhop = true; bool bypasspure = true; - bool no_push = false; + bool no_push = true; }; struct Debug { - int font_height = 14; - int font_weight = 400; + int font_height = 12; + int font_weight = 0; bool debug_render_all_entities = false; }; @@ -107,18 +107,14 @@ struct Config { inline static Config config; -static bool is_button_down(struct button button) { - if (button.button >= 0) { - const uint8_t *keys = SDL_GetKeyboardState(NULL); - - if (keys[button.button] == 1) +static bool is_button_down(const button button) { + if (button.ibutton >= 0) { + if (const uint8_t *keys = SDL_GetKeyboardState(nullptr); keys[button.ibutton] == 1) return true; return false; } else { - Uint32 mouse_state = SDL_GetMouseState(NULL, NULL); - - if (mouse_state & SDL_BUTTON(-button.button)) + if (const Uint32 mouse_state = SDL_GetMouseState(nullptr, nullptr); mouse_state & SDL_BUTTON(-button.ibutton)) return true; return false; diff --git a/gui/imgui/dearimgui.hpp b/gui/imgui/dearimgui.hpp index c52a4fc..82689a8 100644 --- a/gui/imgui/dearimgui.hpp +++ b/gui/imgui/dearimgui.hpp @@ -13,70 +13,70 @@ static ImGuiStyle orig_style; // Defined in /hooks/sdl.cpp swap_window_hook namespace ImGui { - static void TextCentered(std::string text) { - auto windowWidth = ImGui::GetWindowSize().x; - auto textWidth = ImGui::CalcTextSize(text.c_str()).x; - - ImGui::SetCursorPosX((windowWidth - textWidth) * 0.5f); - ImGui::Text(text.c_str()); - } - - static void SliderFloatHeightPad(const char* label, float* v, float v_min, float v_max, float height, const char* format = "%.3f", ImGuiSliderFlags flags = 0) { - int orig_x = orig_style.FramePadding.x; - ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(orig_x, height)); - ImGui::SliderFloat(label, v, v_min, v_max, format, flags); - ImGui::PopStyleVar(1); - } - - - - static std::string GetKeyName(SDL_Scancode key) { - if (key >= 0) { - const char* name = SDL_GetKeyName(SDL_GetKeyFromScancode(key)); - return name ? std::string(name) : "Unknown"; + static void TextCentered(const std::string &text) { + const auto windowWidth = GetWindowSize().x; + const auto textWidth = CalcTextSize(text.c_str()).x; + + SetCursorPosX((windowWidth - textWidth) * 0.5f); + Text(text.c_str()); } - switch (-key) { - case SDL_BUTTON_LEFT: return "Mouse Left"; - case SDL_BUTTON_RIGHT: return "Mouse Right"; - case SDL_BUTTON_MIDDLE: return "Mouse Middle"; - case SDL_BUTTON_X1: return "Mouse X1"; - case SDL_BUTTON_X2: return "Mouse X2"; - default: return "Mouse Button " + std::to_string(-key); + static void SliderFloatHeightPad(const char *label, float *v, const float v_min, const float v_max, + const float height, const char *format = "%.3f", + const ImGuiSliderFlags flags = 0) { + const int orig_x = orig_style.FramePadding.x; + PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(orig_x, height)); + SliderFloat(label, v, v_min, v_max, format, flags); + PopStyleVar(1); } - } - - static void KeybindBox(bool* waitingFlag, const int* keycode) { - std::string buttonLabel; - if (*waitingFlag) - buttonLabel = "..."; - else if (*keycode == SDLK_UNKNOWN) - buttonLabel = " "; - else - buttonLabel = GetKeyName(static_cast(*keycode)); - - if (ImGui::Button(buttonLabel.c_str(), ImVec2(90, 20))) { - *waitingFlag = true; + + + static std::string GetKeyName(const SDL_Scancode key) { + if (key >= 0) { + const char *name = SDL_GetKeyName(SDL_GetKeyFromScancode(key)); + return name ? std::string(name) : "Unknown"; + } + + switch (-key) { + case SDL_BUTTON_LEFT: return "Mouse Left"; + case SDL_BUTTON_RIGHT: return "Mouse Right"; + case SDL_BUTTON_MIDDLE: return "Mouse Middle"; + case SDL_BUTTON_X1: return "Mouse X1"; + case SDL_BUTTON_X2: return "Mouse X2"; + default: return "Mouse Button " + std::to_string(-key); + } } - } - - static void KeybindEvent(const SDL_Event* event, bool* waitingFlag, int* keycode) { - if (!*waitingFlag) - return; - - if (event->type == SDL_KEYDOWN && event->key.repeat == 0) { - if (event->key.keysym.sym == SDLK_ESCAPE) { - *waitingFlag = false; // cancel binding - } else { - *keycode = event->key.keysym.scancode; - *waitingFlag = false; - } - } else if (event->type == SDL_MOUSEBUTTONDOWN) { - *keycode = -event->button.button; - *waitingFlag = false; + + static void KeybindBox(bool *waitingFlag, const int *keycode) { + std::string buttonLabel; + if (*waitingFlag) + buttonLabel = "..."; + else if (*keycode == SDLK_UNKNOWN) + buttonLabel = " "; + else + buttonLabel = GetKeyName(static_cast(*keycode)); + + if (Button(buttonLabel.c_str(), ImVec2(90, 20))) { + *waitingFlag = true; + } } - } + static void KeybindEvent(const SDL_Event *event, bool *waitingFlag, int *keycode) { + if (!*waitingFlag) + return; + + if (event->type == SDL_KEYDOWN && event->key.repeat == 0) { + if (event->key.keysym.sym == SDLK_ESCAPE) { + *waitingFlag = false; // cancel binding + } else { + *keycode = event->key.keysym.scancode; + *waitingFlag = false; + } + } else if (event->type == SDL_MOUSEBUTTONDOWN) { + *keycode = -event->button.button; + *waitingFlag = false; + } + } } diff --git a/gui/menu.cpp b/gui/menu.cpp index 22db9da..86cfef1 100644 --- a/gui/menu.cpp +++ b/gui/menu.cpp @@ -7,9 +7,9 @@ inline static bool menu_focused = false; -void get_input(SDL_Event *event) { - ImGui::KeybindEvent(event, &config.aimbot.key.waiting, &config.aimbot.key.button); - ImGui::KeybindEvent(event, &config.visuals.thirdperson.key.waiting, &config.visuals.thirdperson.key.button); +void get_input(const SDL_Event *event) { + ImGui::KeybindEvent(event, &config.aimbot.key.waiting, &config.aimbot.key.ibutton); + ImGui::KeybindEvent(event, &config.visuals.thirdperson.key.waiting, &config.visuals.thirdperson.key.ibutton); } void draw_aim_tab() { @@ -31,7 +31,7 @@ void draw_aim_tab() { ImGui::Text("Aimbot Key: "); ImGui::SameLine(); - ImGui::KeybindBox(&config.aimbot.key.waiting, &config.aimbot.key.button); + ImGui::KeybindBox(&config.aimbot.key.waiting, &config.aimbot.key.ibutton); ImGui::SameLine(); ImGui::Checkbox("Use Key", &config.aimbot.use_key); @@ -90,7 +90,7 @@ void draw_esp_tab() { ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); ImGui::SameLine(); - //Pickups (health and ammo etc) + //Pickups (health and ammo etc.) ImGui::BeginGroup(); ImGui::Text("Pickup"); ImGui::Checkbox("Box##Pickup", &config.esp.pickup.box); @@ -129,7 +129,7 @@ void draw_visuals_tab() { /* Visuals */ ImGui::BeginGroup(); - /* Removals */ //maybe make me a drop down + /* Removals */ //maybe make me a drop-down ImGui::BeginGroup(); ImGui::Text("Removals"); ImGui::Checkbox("Scope", &config.visuals.removals.scope); @@ -151,9 +151,9 @@ void draw_visuals_tab() { ImGui::Text("Camera"); ImGui::Text("Key: "); ImGui::SameLine(); - ImGui::KeybindBox(&config.visuals.thirdperson.key.waiting, &config.visuals.thirdperson.key.button); + ImGui::KeybindBox(&config.visuals.thirdperson.key.waiting, &config.visuals.thirdperson.key.ibutton); ImGui::SameLine(); - ImGui::Checkbox("Thirdperson", &config.visuals.thirdperson.enabled); + ImGui::Checkbox("Third Person", &config.visuals.thirdperson.enabled); ImGui::SliderFloatHeightPad("Z##CameraZ", &config.visuals.thirdperson.z, 20.0f, 500.0f, 0, "%.1f"); ImGui::SliderFloatHeightPad("Y##CameraY", &config.visuals.thirdperson.y, -50.0f, 50.0f, 0, "%.1f"); ImGui::SliderFloatHeightPad("X##CameraX", &config.visuals.thirdperson.x, -50.0f, 50.0f, 0, "%.1f"); @@ -210,7 +210,7 @@ void draw_debug_tab() { ImGui::EndGroup(); } -void draw_tab(ImGuiStyle *style, const char *name, int *tab, int index) { +void draw_tab(ImGuiStyle *style, const char *name, int *tab, const int index) { constexpr ImVec4 orig_box_color = ImVec4(0.15, 0.15, 0.15, 1); if (*tab == index) { diff --git a/hacks/aimbot/aimbot.cpp b/hacks/aimbot/aimbot.cpp index 7fed474..4f1cc7c 100644 --- a/hacks/aimbot/aimbot.cpp +++ b/hacks/aimbot/aimbot.cpp @@ -11,17 +11,15 @@ #include "../../gui/config.hpp" #include "../../classes/player.hpp" -#include "../../print.hpp" - -bool is_player_visible(Player *localplayer, Player *entity, int bone) { +bool is_player_visible(Player *localplayer, Player *entity, const int bone) { Vec3 target_pos = entity->get_bone_pos(bone); Vec3 start_pos = localplayer->get_shoot_pos(); - struct ray_t ray = engine_trace->init_ray(&start_pos, &target_pos); - struct trace_filter filter; + ray_t ray = engine_trace->init_ray(&start_pos, &target_pos); + trace_filter filter{}; engine_trace->init_trace_filter(&filter, localplayer); - struct trace_t trace; + trace_t trace; engine_trace->trace_ray(&ray, 0x4200400b, &filter, &trace); if (trace.entity == entity || trace.fraction > 0.97f) { @@ -31,10 +29,11 @@ bool is_player_visible(Player *localplayer, Player *entity, int bone) { return false; } -void movement_fix(user_cmd *user_cmd, Vec3 original_view_angle, float original_forward_move, float original_side_move) { +void movement_fix(user_cmd *user_cmd, const Vec3 original_view_angle, const float original_forward_move, + const float original_side_move) { float yaw_delta = user_cmd->view_angles.y - original_view_angle.y; - float original_yaw_correction = 0; - float current_yaw_correction = 0; + float original_yaw_correction = 0.f; + float current_yaw_correction = 0.f; if (original_view_angle.y < 0.0f) { original_yaw_correction = 360.0f + original_view_angle.y; @@ -55,10 +54,10 @@ void movement_fix(user_cmd *user_cmd, Vec3 original_view_angle, float original_f } yaw_delta = 360.0f - yaw_delta; - user_cmd->forwardmove = cos((yaw_delta) * (M_PI / 180)) * original_forward_move + cos( - (yaw_delta + 90.f) * (M_PI / 180)) * original_side_move; - user_cmd->sidemove = sin((yaw_delta) * (M_PI / 180)) * original_forward_move + sin( - (yaw_delta + 90.f) * (M_PI / 180)) * original_side_move; + user_cmd->forwardmove = cos(yaw_delta * (M_PIf / 180.f)) * original_forward_move + cos( + (yaw_delta + 90.f) * (M_PIf / 180.f)) * original_side_move; + user_cmd->sidemove = sin(yaw_delta * (M_PIf / 180.0f)) * original_forward_move + sin( + (yaw_delta + 90.f) * (M_PIf / 180.f)) * original_side_move; } void aimbot(user_cmd *user_cmd) { @@ -74,7 +73,7 @@ void aimbot(user_cmd *user_cmd) { } Weapon *weapon = localplayer->get_weapon(); - if (weapon == nullptr) { + if (!weapon) { target_player = nullptr; return; } @@ -83,24 +82,20 @@ void aimbot(user_cmd *user_cmd) { target_player = nullptr; } - Vec3 original_view_angle = user_cmd->view_angles; - float original_side_move = user_cmd->sidemove; - float original_forward_move = user_cmd->forwardmove; + const Vec3 original_view_angle = user_cmd->view_angles; + const float original_side_move = user_cmd->sidemove; + const float original_forward_move = user_cmd->forwardmove; bool friendlyfire = false; - static Convar *friendlyfirevar = convar_system->find_var("mp_friendlyfire"); - if (friendlyfirevar) { - if (friendlyfirevar->get_int() != 0) { - friendlyfire = true; - } - } + if (static Convar *friendlyfirevar = convar_system->find_var("mp_friendlyfire"); friendlyfirevar->get_int()) + friendlyfire = true; - float smallest_fov_angle = __FLT_MAX__; + float smallest_fov_angle = std::numeric_limits::max(); for (unsigned int i = 1; i <= entity_list->get_max_entities(); ++i) { Player *player = entity_list->player_from_index(i); - if (player == nullptr || + if (!player || player == localplayer || player->is_dormant() || (player->get_team() == localplayer->get_team() && !friendlyfire) || @@ -121,35 +116,35 @@ void aimbot(user_cmd *user_cmd) { bone = player->get_head_bone(); } - Vec3 diff = { + const Vec3 diff = { player->get_bone_pos(bone).x - localplayer->get_shoot_pos().x, player->get_bone_pos(bone).y - localplayer->get_shoot_pos().y, player->get_bone_pos(bone).z - localplayer->get_shoot_pos().z }; - float yaw_hyp = sqrt((diff.x * diff.x) + (diff.y * diff.y)); + const float yaw_hyp = sqrt(diff.x * diff.x + diff.y * diff.y); - float pitch_angle = atan2(diff.z, yaw_hyp) * 180 / M_PI; - float yaw_angle = atan2(diff.y, diff.x) * 180 / M_PI; + const float pitch_angle = atan2(diff.z, yaw_hyp) * 180.f / M_PIf; + const float yaw_angle = atan2(diff.y, diff.x) * 180.f / M_PIf; - Vec3 view_angles = { + const Vec3 view_angles = { .x = -pitch_angle, .y = yaw_angle, - .z = 0 + .z = 0.f }; - float x_diff = view_angles.x - original_view_angle.x; - float y_diff = view_angles.y - original_view_angle.y; + const float x_diff = view_angles.x - original_view_angle.x; + const float y_diff = view_angles.y - original_view_angle.y; - float x = remainderf(x_diff, 360.0f); - float y = remainderf(y_diff, 360.0f); + const float x = remainderf(x_diff, 360.0f); + const float y = remainderf(y_diff, 360.0f); - float clamped_x = x > 89.0f ? 89.0f : x < -89.0f ? -89.0f : x; - float clamped_y = y > 180.0f ? 180.0f : y < -180.0f ? -180.0f : y; + const float clamped_x = x > 89.0f ? 89.0f : x < -89.0f ? -89.0f : x; + const float clamped_y = y > 180.0f ? 180.0f : y < -180.0f ? -180.0f : y; - float fov = hypotf(clamped_x, clamped_y); + const float fov = hypotf(clamped_x, clamped_y); - bool visible = is_player_visible(localplayer, player, bone); + const bool visible = is_player_visible(localplayer, player, bone); if (visible && fov <= config.aimbot.fov && fov < smallest_fov_angle) { target_player = player; @@ -169,7 +164,6 @@ void aimbot(user_cmd *user_cmd) { user_cmd->buttons |= IN_ATTACK; } - if (((is_button_down(config.aimbot.key) && config.aimbot.use_key) || !config.aimbot.use_key) && weapon-> can_primary_attack() && target_player == player) user_cmd->view_angles = view_angles; diff --git a/hacks/bhop/bhop.cpp b/hacks/bhop/bhop.cpp index b0a73ae..3d98236 100644 --- a/hacks/bhop/bhop.cpp +++ b/hacks/bhop/bhop.cpp @@ -5,42 +5,51 @@ #include "../../classes/player.hpp" +//#include "../../math.hpp" + void bhop(user_cmd *user_cmd) { if (!config.misc.bhop) return; Player *localplayer = entity_list->get_localplayer(); - if (localplayer == nullptr) return; + if (!localplayer) return; - /* static bool static_jump = false, static_grounded = false, last_attempted = false; - const bool last_jump = static_jump; - const bool last_grounded = static_grounded; - - static_jump = user_cmd->buttons & IN_JUMP; - const bool cur_jump = static_jump; - - static_grounded = localplayer->get_ground_entity(); - const bool cur_grounded = static_grounded; - + const bool last_jump = static_jump, last_grounded = static_grounded; + const bool cur_jump = static_jump = user_cmd->buttons & IN_JUMP, cur_grounded = + static_grounded = localplayer->get_ground_entity(); + if (cur_jump && last_jump && (cur_grounded ? !localplayer->is_ducking() : true)) { - if (!(cur_grounded && !last_grounded)) - user_cmd->buttons &= ~IN_JUMP; - - if (!(user_cmd->buttons & IN_JUMP) && cur_grounded && !last_attempted) - user_cmd->buttons |= IN_JUMP; - } - */ - - static bool was_jumping = false; - bool on_ground = (localplayer->get_flags() & FL_ONGROUND); - - if (user_cmd->buttons & IN_JUMP) { - if (!was_jumping && !on_ground) { + if (!(cur_grounded && !last_grounded)) user_cmd->buttons &= ~IN_JUMP; - } else if (was_jumping) { - was_jumping = false; - } - } else if (!was_jumping) { - was_jumping = true; + + if (!(user_cmd->buttons & IN_JUMP) && cur_grounded && !last_attempted) + user_cmd->buttons |= IN_JUMP; } + last_attempted = user_cmd->buttons & IN_JUMP; } +/* +void autostrafe(user_cmd *user_cmd) { + Player *localplayer = entity_list->get_localplayer(); + if (!localplayer) return; + + if (!(user_cmd->buttons & (IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT))) + return; + + const float flForward = user_cmd->forwardmove, flSide = user_cmd->sidemove; + + Vec3 vForward, vRight; angle_vectors(user_cmd->view_angles, &vForward, &vRight, nullptr); + vForward.normalize2d(), vRight.normalize2d(); + + const Vec3 vWishDir = vector_angles({ vForward.x * flForward + vRight.x * flSide, vForward.y * flForward + vRight.y * flSide, 0.f }); + const Vec3 vCurDir = vector_angles(localplayer->velocity()); + const float flDirDelta = normalize_angle(vWishDir.y - vCurDir.y); + if (fabsf(flDirDelta) > 180.f) + return;; + + const float flTurnScale = remap_val(0.7f, 0.f, 1.f, 0.9f, 1.f); + const float flRotation = DEG2RAD((flDirDelta > 0.f ? -90.f : 90.f) + flDirDelta * flTurnScale); + const float flCosRot = cosf(flRotation), flSinRot = sinf(flRotation); + + user_cmd->forwardmove = flCosRot * flForward - flSinRot * flSide; + user_cmd->sidemove = flSinRot * flForward + flCosRot * flSide; +}*/ diff --git a/hacks/chams/chams.cpp b/hacks/chams/chams.cpp index 74c51cb..a4bc3b9 100644 --- a/hacks/chams/chams.cpp +++ b/hacks/chams/chams.cpp @@ -38,37 +38,37 @@ typedef struct { } ModelRenderInfo_t; enum MaterialVarFlags_t { - MATERIAL_VAR_DEBUG = (1 << 0), - MATERIAL_VAR_NO_DEBUG_OVERRIDE = (1 << 1), - MATERIAL_VAR_NO_DRAW = (1 << 2), - MATERIAL_VAR_USE_IN_FILLRATE_MODE = (1 << 3), - MATERIAL_VAR_VERTEXCOLOR = (1 << 4), - MATERIAL_VAR_VERTEXALPHA = (1 << 5), - MATERIAL_VAR_SELFILLUM = (1 << 6), - MATERIAL_VAR_ADDITIVE = (1 << 7), - MATERIAL_VAR_ALPHATEST = (1 << 8), - MATERIAL_VAR_MULTIPASS = (1 << 9), - MATERIAL_VAR_ZNEARER = (1 << 10), - MATERIAL_VAR_MODEL = (1 << 11), - MATERIAL_VAR_FLAT = (1 << 12), - MATERIAL_VAR_NOCULL = (1 << 13), - MATERIAL_VAR_NOFOG = (1 << 14), - MATERIAL_VAR_IGNOREZ = (1 << 15), - MATERIAL_VAR_DECAL = (1 << 16), - MATERIAL_VAR_ENVMAPSPHERE = (1 << 17), - MATERIAL_VAR_NOALPHAMOD = (1 << 18), - MATERIAL_VAR_ENVMAPCAMERASPACE = (1 << 19), - MATERIAL_VAR_BASEALPHAENVMAPMASK = (1 << 20), - MATERIAL_VAR_TRANSLUCENT = (1 << 21), - MATERIAL_VAR_NORMALMAPALPHAENVMAPMASK = (1 << 22), - MATERIAL_VAR_NEEDS_SOFTWARE_SKINNING = (1 << 23), - MATERIAL_VAR_OPAQUETEXTURE = (1 << 24), - MATERIAL_VAR_ENVMAPMODE = (1 << 25), - MATERIAL_VAR_SUPPRESS_DECALS = (1 << 26), - MATERIAL_VAR_HALFLAMBERT = (1 << 27), - MATERIAL_VAR_WIREFRAME = (1 << 28), - MATERIAL_VAR_ALLOWALPHATOCOVERAGE = (1 << 29), - MATERIAL_VAR_IGNORE_ALPHA_MODULATION = (1 << 30), + MATERIAL_VAR_DEBUG = 1 << 0, + MATERIAL_VAR_NO_DEBUG_OVERRIDE = 1 << 1, + MATERIAL_VAR_NO_DRAW = 1 << 2, + MATERIAL_VAR_USE_IN_FILLRATE_MODE = 1 << 3, + MATERIAL_VAR_VERTEXCOLOR = 1 << 4, + MATERIAL_VAR_VERTEXALPHA = 1 << 5, + MATERIAL_VAR_SELFILLUM = 1 << 6, + MATERIAL_VAR_ADDITIVE = 1 << 7, + MATERIAL_VAR_ALPHATEST = 1 << 8, + MATERIAL_VAR_MULTIPASS = 1 << 9, + MATERIAL_VAR_ZNEARER = 1 << 10, + MATERIAL_VAR_MODEL = 1 << 11, + MATERIAL_VAR_FLAT = 1 << 12, + MATERIAL_VAR_NOCULL = 1 << 13, + MATERIAL_VAR_NOFOG = 1 << 14, + MATERIAL_VAR_IGNOREZ = 1 << 15, + MATERIAL_VAR_DECAL = 1 << 16, + MATERIAL_VAR_ENVMAPSPHERE = 1 << 17, + MATERIAL_VAR_NOALPHAMOD = 1 << 18, + MATERIAL_VAR_ENVMAPCAMERASPACE = 1 << 19, + MATERIAL_VAR_BASEALPHAENVMAPMASK = 1 << 20, + MATERIAL_VAR_TRANSLUCENT = 1 << 21, + MATERIAL_VAR_NORMALMAPALPHAENVMAPMASK = 1 << 22, + MATERIAL_VAR_NEEDS_SOFTWARE_SKINNING = 1 << 23, + MATERIAL_VAR_OPAQUETEXTURE = 1 << 24, + MATERIAL_VAR_ENVMAPMODE = 1 << 25, + MATERIAL_VAR_SUPPRESS_DECALS = 1 << 26, + MATERIAL_VAR_HALFLAMBERT = 1 << 27, + MATERIAL_VAR_WIREFRAME = 1 << 28, + MATERIAL_VAR_ALLOWALPHATOCOVERAGE = 1 << 29, + MATERIAL_VAR_IGNORE_ALPHA_MODULATION = 1 << 30, }; enum OverrideType_t { @@ -80,8 +80,8 @@ enum OverrideType_t { void (*draw_model_execute_original)(void *, void *, ModelRenderInfo_t *, VMatrix *); -void override_material(bool ignorez, bool wireframe, RGBA_float color, const char *mat_name) { - Material *material = material_system->find_material(mat_name, "Model textures", true, NULL); +void override_material(const bool ignorez, const bool wireframe, const RGBA_float color, const char *mat_name) { + Material *material = material_system->find_material(mat_name, "Model textures", true, nullptr); if (!material) return; @@ -99,9 +99,9 @@ void override_material(bool ignorez, bool wireframe, RGBA_float color, const cha void chams(void *me, void *state, ModelRenderInfo_t *pinfo, VMatrix *bone_to_world) { if (pinfo->entity_index < 1 || pinfo->entity_index >= entity_list->get_max_entities()) { - RGBA_float color = {1, 0, 1, 1}; + constexpr RGBA_float color = {1, 0, 1, 1}; - override_material(false, false, color, "dev/glow_color"); + override_material(false, true, color, "dev/glow_color"); return; } } diff --git a/hacks/engine_prediction/engine_prediction.cpp b/hacks/engine_prediction/engine_prediction.cpp index 5260b59..dd2c3c5 100644 --- a/hacks/engine_prediction/engine_prediction.cpp +++ b/hacks/engine_prediction/engine_prediction.cpp @@ -1,5 +1,8 @@ +#include + #include "../../interfaces/global_vars.hpp" #include "../../interfaces/prediction.hpp" +#include "../../interfaces/move_helper.hpp" #include "../../interfaces/entity_list.hpp" #include "../../interfaces/client.hpp" #include "../../interfaces/game_movement.hpp" @@ -7,6 +10,7 @@ #include "../../classes/player.hpp" #include "../../random_seed.hpp" +#include "../../md5.hpp" int get_pred_tickbase(user_cmd *user_cmd, Player *localplayer) { static int tick = 0; @@ -15,7 +19,6 @@ int get_pred_tickbase(user_cmd *user_cmd, Player *localplayer) { if (user_cmd) { if (!last_cmd || last_cmd->has_been_predicted) tick = localplayer->get_tickbase(); - else tick++; last_cmd = user_cmd; @@ -31,6 +34,8 @@ int old_tickcount; void start_engine_prediction(user_cmd *user_cmd) { Player *localplayer = entity_list->get_localplayer(); + if (!localplayer || localplayer->get_lifestate() != 0) + return; old_curtime = global_vars->curtime; old_frametime = global_vars->frametime; @@ -40,45 +45,44 @@ void start_engine_prediction(user_cmd *user_cmd) { const bool old_first_time_predicted = prediction->first_time_predicted; const bool old_in_prediction = prediction->in_prediction; - //move_helper->set_host(localplayer); + move_helper->set_host(localplayer); - //localplayer->set_current_cmd(user_cmd); + localplayer->set_current_cmd(user_cmd); - //*random_seed = MD5_PseudoRandom(user_cmd->command_number) & INT_MAX; + *random_seed = md5_pseudo_random(user_cmd->command_number) & std::numeric_limits::max(); global_vars->curtime = get_pred_tickbase(user_cmd, localplayer) * TICK_INTERVAL; - global_vars->frametime = (prediction->engine_paused ? 0.0f : TICK_INTERVAL); + global_vars->frametime = prediction->engine_paused ? 0.0f : TICK_INTERVAL; global_vars->tickcount = get_pred_tickbase(user_cmd, localplayer); prediction->first_time_predicted = false; prediction->in_prediction = true; - //prediction->set_local_view_angles(user_cmd->view_angles); - - /* - prediction->setup_move(localplayer, user_cmd, move_helper, &move_data); - game_movement->process_movement(localplayer, &move_data); - prediction->finish_move(localplayer, user_cmd, &move_data); - */ + prediction->set_local_view_angles(user_cmd->view_angles); - /* - prediction->run_command(localplayer, user_cmd, move_helper); - */ + prediction->setup_move(localplayer, user_cmd, move_helper, &move_data); + game_movement->process_movement(localplayer, &move_data); + prediction->finish_move(localplayer, user_cmd, &move_data); - //move_helper->set_host(nullptr); + prediction->run_command(localplayer, user_cmd, move_helper); - //localplayer->set_tickbase(old_tickbase); + move_helper->set_host(nullptr); + localplayer->set_tickbase(old_tickbase); prediction->in_prediction = old_in_prediction; prediction->first_time_predicted = old_first_time_predicted; } void end_engine_prediction() { - //localplayer->set_current_cmd(nullptr); + Player *localplayer = entity_list->get_localplayer(); + if (!localplayer || localplayer->get_lifestate() != 0) + return; + + localplayer->set_current_cmd(nullptr); global_vars->curtime = old_curtime; global_vars->frametime = old_frametime; global_vars->tickcount = old_tickcount; - //*random_seed = -1; + *random_seed = -1; } diff --git a/hacks/esp/esp.hpp b/hacks/esp/esp.hpp index b8b374b..f1c0f24 100644 --- a/hacks/esp/esp.hpp +++ b/hacks/esp/esp.hpp @@ -6,45 +6,25 @@ inline static unsigned long esp_player_font; inline static unsigned long esp_entity_font; -static void draw_outline_rectangle(Vec3 screen, Vec3 screen_offset, float width_fraction, RGBA color) { - float box_offset = (screen.y - screen_offset.y) * width_fraction; +static void draw_outline_rectangle(const Vec3 screen, const Vec3 screen_offset, const float width_fraction, + const RGBA color) { + const float box_offset = (screen.y - screen_offset.y) * width_fraction; - /* shadow box */ surface->set_rgba(0, 0, 0, 255); - - //right side surface->draw_line(screen.x + box_offset + 1, screen.y + 1, screen.x + box_offset + 1, screen_offset.y - 1); surface->draw_line(screen.x + box_offset - 1, screen.y + 1, screen.x + box_offset - 1, screen_offset.y - 1); - - //left side surface->draw_line(screen.x - box_offset + 1, screen.y + 1, screen.x - box_offset + 1, screen_offset.y - 1); surface->draw_line(screen.x - box_offset - 1, screen.y + 1, screen.x - box_offset - 1, screen_offset.y - 1); - - //top surface->draw_line(screen.x - box_offset - 1, screen_offset.y + 1, screen.x + box_offset + 2, screen_offset.y + 1); surface->draw_line(screen.x - box_offset - 1, screen_offset.y - 1, screen.x + box_offset + 2, screen_offset.y - 1); - - //bottom surface->draw_line(screen.x - box_offset - 1, screen.y + 1, screen.x + box_offset + 1, screen.y + 1); surface->draw_line(screen.x - box_offset - 1, screen.y - 1, screen.x + box_offset + 1, screen.y - 1); - /* shadow box */ - - /* actual box */ surface->set_rgba(color.r, color.g, color.b, color.a); - - //right side surface->draw_line(screen.x + box_offset, screen.y, screen.x + box_offset, screen_offset.y); - - //left side surface->draw_line(screen.x - box_offset, screen.y, screen.x - box_offset, screen_offset.y); - - //top - surface->draw_line(screen.x - box_offset, screen_offset.y, screen.x + box_offset + 1, screen_offset.y); - - //bottom + surface->draw_line(screen.x - box_offset, screen_offset.y, screen.x + box_offset, screen_offset.y); surface->draw_line(screen.x - box_offset, screen.y, screen.x + box_offset, screen.y); - /* actual box */ } #endif diff --git a/hacks/esp/esp_entity.cpp b/hacks/esp/esp_entity.cpp index 03f50ca..1282ca9 100644 --- a/hacks/esp/esp_entity.cpp +++ b/hacks/esp/esp_entity.cpp @@ -16,7 +16,7 @@ #include "../../print.hpp" void box_esp_entity(Vec3 screen, Entity *entity, Player *localplayer) { - if (config.esp.pickup.box && entity->get_pickup_type() != pickup_type::UNKNOWN) { + if (config.esp.pickup.box && entity->get_pickup_type() != UNKNOWN) { surface->set_rgba(255, 255, 255, 255); surface->draw_outlined_rect(screen.x - 5, screen.y - 5, screen.x + 5, screen.y + 5); } @@ -24,14 +24,14 @@ void box_esp_entity(Vec3 screen, Entity *entity, Player *localplayer) { if (config.esp.buildings.box && entity->is_building() && ( entity->get_team() != localplayer->get_team() || ( entity->get_team() == localplayer->get_team() && config.esp.buildings.team))) { - Building *building = static_cast(entity); + Building *building = (Building *) entity; if (building->is_carried()) return; Vec3 screen_offset; float box_offset_fraction = 0; switch (building->get_class_id()) { - case class_id::DISPENSER: { + case DISPENSER: { Vec3 location = building->get_origin(); Vec3 location_offset = {location.x, location.y, location.z + 58}; render_view->world_to_screen(&location_offset, &screen_offset); @@ -39,7 +39,7 @@ void box_esp_entity(Vec3 screen, Entity *entity, Player *localplayer) { box_offset_fraction = 0.25; break; } - case class_id::SENTRY: { + case SENTRY: { Vec3 location = building->get_origin(); float z_offset = 0; @@ -63,7 +63,7 @@ void box_esp_entity(Vec3 screen, Entity *entity, Player *localplayer) { render_view->world_to_screen(&location_offset, &screen_offset);\ break; } - case class_id::TELEPORTER: { + case TELEPORTER: { Vec3 location = building->get_origin(); Vec3 location_offset = {location.x, location.y, location.z + 15}; render_view->world_to_screen(&location_offset, &screen_offset); @@ -85,12 +85,12 @@ void health_bar_esp_entity(Vec3 screen, Entity *entity, Player *localplayer) { if (config.esp.buildings.health_bar && entity->is_building() && ( entity->get_team() != localplayer->get_team() || ( entity->get_team() == localplayer->get_team() && config.esp.buildings.team))) { - Building *building = static_cast(entity); + Building *building = (Building *) entity; if (building->is_carried()) return; float box_offset = 0; switch (building->get_class_id()) { - case class_id::SENTRY: { + case SENTRY: { Vec3 location = building->get_origin(); float z_offset = 0; @@ -108,6 +108,7 @@ void health_bar_esp_entity(Vec3 screen, Entity *entity, Player *localplayer) { z_offset = 75; box_offset_fraction = 0.50; break; + default: break; } Vec3 location_offset = {location.x, location.y, location.z + z_offset}; @@ -117,7 +118,7 @@ void health_bar_esp_entity(Vec3 screen, Entity *entity, Player *localplayer) { box_offset = (screen.y - screen_offset.y) * box_offset_fraction; break; } - case class_id::DISPENSER: { + case DISPENSER: { Vec3 location = building->get_origin(); Vec3 location_offset = {location.x, location.y, location.z + 58}; Vec3 screen_offset; @@ -126,7 +127,7 @@ void health_bar_esp_entity(Vec3 screen, Entity *entity, Player *localplayer) { box_offset = (screen.y - screen_offset.y) * 0.25; break; } - case class_id::TELEPORTER: { + case TELEPORTER: { Vec3 location = building->get_origin(); Vec3 location_offset = {location.x, location.y, location.z + 15}; Vec3 screen_offset; @@ -143,10 +144,10 @@ void health_bar_esp_entity(Vec3 screen, Entity *entity, Player *localplayer) { surface->draw_line(screen.x - box_offset - 1, screen.y + 4, screen.x + box_offset + 2, screen.y + 4); surface->draw_line(screen.x - box_offset - 1, screen.y + 5, screen.x + box_offset + 2, screen.y + 5); - int xdelta = box_offset * 2 * (1.f - static_cast(building->get_health()) / building->get_max_health()); + int xdelta = (box_offset * 2) * (1.f - (float(building->get_health()) / building->get_max_health())); if (building->get_health() > building->get_max_health()) { - // over healed (the building some how???) + // over healed (the building somehow???) surface->set_rgba(0, 255, 255, 255); xdelta = 0; } else if (building->get_health() <= building->get_max_health() && building->get_health() >= ( @@ -167,14 +168,14 @@ void health_bar_esp_entity(Vec3 screen, Entity *entity, Player *localplayer) { void name_esp_entity(Vec3 screen, Entity *entity, Player *localplayer) { - if (config.esp.pickup.name && entity->get_pickup_type() != pickup_type::UNKNOWN) { + if (config.esp.pickup.name && entity->get_pickup_type() != UNKNOWN) { surface->draw_set_text_color(255, 255, 255, 255); - if (entity->get_pickup_type() == pickup_type::AMMOPACK) { + if (entity->get_pickup_type() == AMMOPACK) { surface->draw_set_text_pos(screen.x - (surface->get_string_width(esp_entity_font, L"AMMO") * 0.5), screen.y); surface->draw_print_text(L"AMMO", wcslen(L"AMMO")); - } else if (entity->get_pickup_type() == pickup_type::MEDKIT) { + } else if (entity->get_pickup_type() == MEDKIT) { surface->draw_set_text_pos(screen.x - (surface->get_string_width(esp_entity_font, L"HEALTH") * 0.5), screen.y); surface->draw_print_text(L"HEALTH", wcslen(L"HEALTH")); @@ -185,24 +186,24 @@ void name_esp_entity(Vec3 screen, Entity *entity, Player *localplayer) { if (config.esp.buildings.name && entity->is_building() && ( entity->get_team() != localplayer->get_team() || ( entity->get_team() == localplayer->get_team() && config.esp.buildings.team))) { - Building *building = static_cast(entity); + Building *building = (Building *) entity; if (building->is_carried()) return; surface->draw_set_text_color(255, 255, 255, 255); switch (building->get_class_id()) { - case class_id::DISPENSER: { + case DISPENSER: { surface->draw_set_text_pos(screen.x - (surface->get_string_width(esp_entity_font, L"DISPENSER") * 0.5), screen.y + (config.esp.buildings.health_bar ? 5 : 0)); surface->draw_print_text(L"DISPENSER", wcslen(L"DISPENSER")); break; } - case class_id::SENTRY: { + case SENTRY: { surface->draw_set_text_pos(screen.x - (surface->get_string_width(esp_entity_font, L"SENTRY") * 0.5), screen.y + (config.esp.buildings.health_bar ? 5 : 0)); surface->draw_print_text(L"SENTRY", wcslen(L"SENTRY")); break; } - case class_id::TELEPORTER: { + case TELEPORTER: { surface->draw_set_text_pos(screen.x - (surface->get_string_width(esp_entity_font, L"TELEPORTER") * 0.5), screen.y + (config.esp.buildings.health_bar ? 5 : 0)); surface->draw_print_text(L"TELEPORTER", wcslen(L"TELEPORTER")); @@ -216,7 +217,8 @@ void name_esp_entity(Vec3 screen, Entity *entity, Player *localplayer) { std::string model_name = entity->get_model_name(); wchar_t model_name_w[64]; - if (const size_t len = std::mbstowcs(model_name_w, model_name.c_str(), 64); len == -1u) return; + size_t len = std::mbstowcs(model_name_w, model_name.c_str(), 64); + if (len == (size_t) -1) return; std::wstring a = std::wstring(model_name_w); diff --git a/hacks/esp/esp_player.cpp b/hacks/esp/esp_player.cpp index 5355964..0b44fc7 100644 --- a/hacks/esp/esp_player.cpp +++ b/hacks/esp/esp_player.cpp @@ -42,8 +42,7 @@ void health_bar_esp_player(Vec3 screen, Vec3 screen_offset, Player *player) { screen_offset.y - 2); surface->set_rgba(0, 255, 0, 255); - int ydelta = (screen_offset.y - screen.y) * ( - 1.f - static_cast(player->get_health()) / player->get_max_health()); + int ydelta = (screen_offset.y - screen.y) * (1.f - (float(player->get_health()) / player->get_max_health())); if (player->get_health() > player->get_max_health()) { // over healed @@ -73,9 +72,10 @@ void name_esp_player(Vec3 screen, Vec3 screen_offset, Player *player, unsigned i wchar_t name[32]; - if (const size_t len = mbstowcs(name, pinfo.name, 32); len == -1u) return; + size_t len = mbstowcs(name, pinfo.name, 32); + if (len == (size_t) -1) return; - const unsigned int name_length = surface->get_string_width(esp_player_font, name); + unsigned int name_length = surface->get_string_width(esp_player_font, name); surface->draw_set_text_color(255, 255, 255, 255); surface->draw_set_text_pos(screen.x - (name_length / 2.f), @@ -85,7 +85,7 @@ void name_esp_player(Vec3 screen, Vec3 screen_offset, Player *player, unsigned i } } -void flags_esp_player(const Vec3 screen, const Vec3 screen_offset, Player *player, unsigned int i) { +void flags_esp_player(Vec3 screen, Vec3 screen_offset, Player *player, unsigned int i) { float flags_x_offset = (screen.y - screen_offset.y) / 4; float flags_y_offset = 0; @@ -142,7 +142,7 @@ void esp_player(unsigned int i, Player *player) { Player *localplayer = entity_list->get_localplayer(); if (player == localplayer || // Ignore Local Player - player->is_dormant() || // Ignore Dormant (TODO: Add fading effect to dormant players) + player->is_dormant() || // Ignore Dormat (TODO: Add fading effect to dormat players) player->get_lifestate() != 1 || // Ignore Dead (player->get_team() == localplayer->get_team() && !config.esp.player.team && !player->is_friend()) || // Ignore Team diff --git a/hacks/thirdperson/thirdperson.cpp b/hacks/thirdperson/thirdperson.cpp index d7c24d7..fcdf8eb 100644 --- a/hacks/thirdperson/thirdperson.cpp +++ b/hacks/thirdperson/thirdperson.cpp @@ -7,10 +7,10 @@ #include "../../interfaces/input.hpp" #include "../../interfaces/engine_trace.hpp" -void trace_hull(Vec3 vecStart, Vec3 vecEnd, Vec3 vecHullMin, Vec3 vecHullMax, unsigned int mask) { +void trace_hull(Vec3 vecStart, Vec3 vecEnd, Vec3 vecHullMin, Vec3 vecHullMax, const unsigned int mask) { ray_t ray = engine_trace->init_ray(&vecStart, &vecEnd, &vecHullMin, &vecHullMax); - struct trace_filter filter; - struct trace_t trace; + trace_filter filter{}; + trace_t trace; engine_trace->trace_ray(&ray, mask, &filter, &trace); } @@ -19,7 +19,7 @@ void trace_hull(Vec3 vecStart, Vec3 vecEnd, Vec3 vecHullMin, Vec3 vecHullMax, un // Using the input interface with a properly hooked ShouldDraw methods would be better. void thirdperson(view_setup *setup) { Player *localplayer = entity_list->get_localplayer(); - if (localplayer == nullptr) return; + if (!localplayer) return; if (!config.visuals.thirdperson.enabled) { localplayer->set_thirdperson(false); @@ -49,9 +49,9 @@ void thirdperson(view_setup *setup) { offset += up * config.visuals.thirdperson.y; offset -= forward * config.visuals.thirdperson.z; - Vec3 origin = localplayer->get_shoot_pos(); //pView->origin - Vec3 start = origin; - Vec3 end = origin + offset; + const Vec3 origin = localplayer->get_shoot_pos(); //pView->origin + //Vec3 start = origin; + const Vec3 end = origin + offset; /* if (Vars::Visuals::Thirdperson::Collide.Value) @@ -62,7 +62,7 @@ void thirdperson(view_setup *setup) { struct trace_t trace; engine_trace->trace_hull(start, end, mins, maxs, MASK_SOLID, &trace); end = trace.endpos; - } + } */ setup->origin = end; diff --git a/hooks/cl_move.cpp b/hooks/cl_move.cpp index 0e904fd..06ac84d 100644 --- a/hooks/cl_move.cpp +++ b/hooks/cl_move.cpp @@ -1,4 +1,4 @@ -#include "../print.hpp" +//#include "../print.hpp" void (*cl_move_original)(float, bool); diff --git a/hooks/client_create_move.cpp b/hooks/client_create_move.cpp index 893a5b2..9de9f3d 100644 --- a/hooks/client_create_move.cpp +++ b/hooks/client_create_move.cpp @@ -1,8 +1,8 @@ -#include "../interfaces/input.hpp" +/*#include "../interfaces/input.hpp" #include "../interfaces/prediction.hpp" #include "../interfaces/client_state.hpp" -#include "../print.hpp" +#include "../print.hpp"*/ void (*client_create_move_original)(void *, int, float, bool); @@ -11,7 +11,7 @@ void client_create_move_hook(void *me, int sequence_number, float input_sample_f /* user_cmd* user_cmd = input->get_user_cmd(sequence_number); - if (user_cmd == nullptr) { + if (!user_cmd) { print("user_cmd == nullptr\n"); return; } diff --git a/hooks/client_mode_create_move.cpp b/hooks/client_mode_create_move.cpp index 7644b04..ea684dc 100644 --- a/hooks/client_mode_create_move.cpp +++ b/hooks/client_mode_create_move.cpp @@ -2,25 +2,26 @@ #include "../interfaces/engine.hpp" #include "../interfaces/entity_list.hpp" #include "../interfaces/convar_system.hpp" -#include "../interfaces/prediction.hpp" +/*#include "../interfaces/prediction.hpp" #include "../interfaces/move_helper.hpp" -#include "../interfaces/game_movement.hpp" +#include "../interfaces/game_movement.hpp"*/ #include "../gui/config.hpp" #include "../classes/player.hpp" -#include "../print.hpp" +//#include "../print.hpp" #include "../hacks/aimbot/aimbot.cpp" #include "../hacks/bhop/bhop.cpp" +#include "../hacks/engine_prediction/engine_prediction.cpp" bool (*client_mode_create_move_original)(void *, float, user_cmd *); bool client_mode_create_move_hook(void *me, float sample_time, user_cmd *user_cmd) { bool rc = client_mode_create_move_original(me, sample_time, user_cmd); - if (user_cmd == nullptr || user_cmd->command_number == 0) { + if (!user_cmd || user_cmd->command_number == 0) { return rc; } @@ -30,30 +31,27 @@ bool client_mode_create_move_hook(void *me, float sample_time, user_cmd *user_cm Player *localplayer = entity_list->get_localplayer(); - if (localplayer->get_lifestate() != 1) { - return rc; - } - - if (localplayer == nullptr) { - print("localplayer is NULL\n"); + if (!localplayer || localplayer->get_lifestate() != 1) { return rc; } if (user_cmd->tick_count > 1) { bhop(user_cmd); - aimbot(user_cmd); + start_engine_prediction(user_cmd); + { + aimbot(user_cmd); + } + end_engine_prediction(); //no push if (Convar *nopush = convar_system->find_var("tf_avoidteammates_pushaway")) { if (config.misc.no_push) { - if (nopush->get_int() != 0) { + if (nopush->get_int() != 0) nopush->set_int(0); - } } else { - if (nopush->get_int() != 1) { + if (nopush->get_int() != 1) nopush->set_int(1); - } } } } diff --git a/hooks/draw_model_execute.cpp b/hooks/draw_model_execute.cpp index bb25119..8dbd387 100644 --- a/hooks/draw_model_execute.cpp +++ b/hooks/draw_model_execute.cpp @@ -1,14 +1,14 @@ -#include +//#include #include "../vec.hpp" -#include "../interfaces/entity_list.hpp" +/*#include "../interfaces/entity_list.hpp" #include "../interfaces/material_system.hpp" #include "../classes/material.hpp" #include "../interfaces/model_render.hpp" -#include "../interfaces/render_view.hpp" +#include "../interfaces/render_view.hpp"*/ #include "../hacks/chams/chams.cpp" diff --git a/hooks/draw_view_models.cpp b/hooks/draw_view_models.cpp index c5db48e..25c3be0 100644 --- a/hooks/draw_view_models.cpp +++ b/hooks/draw_view_models.cpp @@ -1,6 +1,6 @@ #include "../vec.hpp" -#include "../print.hpp" +//#include "../print.hpp" void (*draw_view_models_original)(void *, view_setup *, bool); diff --git a/hooks/enginevgui_paint.cpp b/hooks/enginevgui_paint.cpp new file mode 100644 index 0000000..d5428ff --- /dev/null +++ b/hooks/enginevgui_paint.cpp @@ -0,0 +1,108 @@ +#include "../gui/config.hpp" + +#include "../interfaces/entity_list.hpp" +#include "../interfaces/surface.hpp" +#include "../interfaces/engine.hpp" + +#include "../classes/player.hpp" + +#include "../hacks/esp/esp_player.cpp" +#include "../hacks/esp/esp_entity.cpp" + +void (*enginevgui_paint_original)(void *, int); + +enum paint_mode { + paint_uipanels = 1 << 0, + paint_ingamepanels = 1 << 1, + paint_cursor = 1 << 2 +}; + +void enginevgui_paint_hook(void *me, paint_mode mode) { + if (mode & paint_ingamepanels) { + surface->start_drawing(); + /*{ + // font init + static int old_font_height = config.debug.font_height; + static int old_font_weight = config.debug.font_weight; + + if (esp_player_font == 0 || old_font_height != config.debug.font_height || old_font_weight != config.debug. + font_weight) { + esp_player_font = surface->text_create_font(); + surface->text_set_font_glyph_set(esp_player_font, "Noto Sans", config.debug.font_height, + config.debug.font_weight, 0, 0, 0x010); + } + + if (esp_entity_font == 0 || old_font_height != config.debug.font_height || old_font_weight != config.debug. + font_weight) { + old_font_height = config.debug.font_height; + old_font_weight = config.debug.font_weight; + esp_entity_font = surface->text_create_font(); + surface->text_set_font_glyph_set(esp_entity_font, "Noto Sans", config.debug.font_height, + config.debug.font_weight, 0, 0, 0x010); + } + }*/ + if (Player *localplayer = entity_list->get_localplayer(); engine->is_in_game()) { + static int old_font_height = config.debug.font_height; + static int old_font_weight = config.debug.font_weight; + + if (esp_player_font == 0 || old_font_height != config.debug.font_height || old_font_weight != config.debug. + font_weight) { + esp_player_font = surface->text_create_font(); + surface->text_set_font_glyph_set(esp_player_font, "ProggySquare", config.debug.font_height, + config.debug.font_weight, 0, 0, 0x0); + } + + if (esp_entity_font == 0 || old_font_height != config.debug.font_height || old_font_weight != config.debug. + font_weight) { + old_font_height = config.debug.font_height; + old_font_weight = config.debug.font_weight; + esp_entity_font = surface->text_create_font(); + surface->text_set_font_glyph_set(esp_entity_font, "ProggySquare", config.debug.font_height, + config.debug.font_weight, 0, 0, 0x0); + } + + + if (config.aimbot.draw_fov == true && config.aimbot.master == true) { + Vec2 screen_size = engine->get_screen_size(); + + //very poor practice. + float local_fov = localplayer->get_fov(); + if (config.visuals.override_fov == true && (localplayer->is_scoped()) == false) { + local_fov = config.visuals.custom_fov; + } + if (config.visuals.removals.zoom == true) { + local_fov = localplayer->get_default_fov(); + } + if (config.visuals.override_fov == true && config.visuals.removals.zoom == true) { + local_fov = config.visuals.custom_fov; + } + + + int radius = (tan(config.aimbot.fov / 180 * M_PI) / tan((local_fov / 2) / 180 * M_PI) * ( + float(screen_size.x) / 2)) / 1.35; + + surface->set_rgba(255, 255, 255, 255); + surface->draw_circle(screen_size.x / 2, screen_size.y / 2, radius, 55); + } + + + for (unsigned int i = 1; i <= entity_list->get_max_entities(); ++i) { + if (!config.esp.master) continue; + + Player *player = entity_list->player_from_index(i); + if (!player) continue; + + if (player->get_class_id() == PLAYER) { + surface->draw_set_text_font(esp_player_font); + esp_player(i, player); + } else { + surface->draw_set_text_font(esp_entity_font); + esp_entity(i, player->to_entity()); + } + } + } + surface->finish_drawing(); + } + + enginevgui_paint_original(me, mode); +} diff --git a/hooks/override_view.cpp b/hooks/override_view.cpp index 63c9a1a..3b8ee13 100644 --- a/hooks/override_view.cpp +++ b/hooks/override_view.cpp @@ -14,7 +14,7 @@ void override_view_hook(void *me, view_setup *setup) { override_view_original(me, setup); Player *localplayer = entity_list->get_localplayer(); - if (localplayer == nullptr) return; + if (!localplayer) return; if (config.visuals.removals.zoom) { setup->fov = config.visuals.override_fov ? config.visuals.custom_fov : localplayer->get_default_fov(); diff --git a/hooks/paint_traverse.cpp b/hooks/paint_traverse.cpp index 960ac99..9fab27d 100644 --- a/hooks/paint_traverse.cpp +++ b/hooks/paint_traverse.cpp @@ -1,22 +1,8 @@ -#include "../hacks/esp/esp.hpp" - #include "../gui/config.hpp" -#include -#include -#include #include -#include "../interfaces/engine.hpp" -#include "../interfaces/surface.hpp" -#include "../interfaces/entity_list.hpp" - -#include "../classes/player.hpp" - -#include "../hacks/esp/esp_player.cpp" -#include "../hacks/esp/esp_entity.cpp" - -void (*paint_traverse_original)(void *, void *, __int8_t, __int8_t) = NULL; +void (*paint_traverse_original)(void *, void *, __int8_t, __int8_t) = nullptr; void *vgui; @@ -40,73 +26,4 @@ void paint_traverse_hook(void *me, void *panel, __int8_t force_repaint, __int8_t paint_traverse_original(me, panel, force_repaint, allow_force); //print("%s\n", panel_name.c_str()); - - if (panel_name != "MatSystemTopPanel") { - return; - } - - if (!engine->is_in_game()) { - return; - } - - static int old_font_height = config.debug.font_height; - static int old_font_weight = config.debug.font_weight; - - if (esp_player_font == 0 || old_font_height != config.debug.font_height || old_font_weight != config.debug. - font_weight) { - esp_player_font = surface->text_create_font(); - surface->text_set_font_glyph_set(esp_player_font, "ProggySquare", config.debug.font_height, - config.debug.font_weight, 0, 0, 0x0); - } - - if (esp_entity_font == 0 || old_font_height != config.debug.font_height || old_font_weight != config.debug. - font_weight) { - old_font_height = config.debug.font_height; - old_font_weight = config.debug.font_weight; - esp_entity_font = surface->text_create_font(); - surface->text_set_font_glyph_set(esp_entity_font, "ProggySquare", config.debug.font_height, - config.debug.font_weight, 0, 0, 0x0); - } - - - if (config.aimbot.draw_fov && config.aimbot.master) { - Vec2 screen_size = engine->get_screen_size(); - - Player *localplayer = entity_list->get_localplayer(); - - //very poor practice. - float local_fov = localplayer->get_fov(); - if (config.visuals.override_fov && !localplayer->is_scoped()) { - local_fov = config.visuals.custom_fov; - } - if (config.visuals.removals.zoom) { - local_fov = localplayer->get_default_fov(); - } - if (config.visuals.override_fov && config.visuals.removals.zoom) { - local_fov = config.visuals.custom_fov; - } - - - const int radius = tan(config.aimbot.fov / 180 * M_PI) / tan(local_fov / 2 / 180 * M_PI) * ( - static_cast(screen_size.x) / 2) / 1.35; - - surface->set_rgba(255, 255, 255, 255); - surface->draw_circle(screen_size.x / 2, screen_size.y / 2, radius, 55); - } - - - for (unsigned int i = 1; i <= entity_list->get_max_entities(); ++i) { - if (!config.esp.master) continue; - - Player *player = entity_list->player_from_index(i); - if (player == nullptr) continue; - - if (player->get_class_id() == class_id::PLAYER) { - surface->draw_set_text_font(esp_player_font); - esp_player(i, player); - } else { - surface->draw_set_text_font(esp_entity_font); - esp_entity(i, player->to_entity()); - } - } } diff --git a/hooks/sdl.cpp b/hooks/sdl.cpp index b912a5b..0173cd1 100644 --- a/hooks/sdl.cpp +++ b/hooks/sdl.cpp @@ -9,9 +9,9 @@ #include "../gui/menu.cpp" -void (*swap_window_original)(void *) = NULL; +void (*swap_window_original)(void *) = nullptr; -bool (*poll_event_original)(SDL_Event *) = NULL; +bool (*poll_event_original)(SDL_Event *) = nullptr; bool poll_event_hook(SDL_Event *event) { @@ -37,14 +37,13 @@ void watermark() { } void swap_window_hook(SDL_Window *window) { - static SDL_GLContext original_context = NULL, new_context = NULL; + static SDL_GLContext original_context = nullptr, new_context = nullptr; if (!new_context) { original_context = SDL_GL_GetCurrentContext(); new_context = SDL_GL_CreateContext(window); - GLenum err = glewInit(); - if (err != GLEW_OK) { + if (GLenum err = glewInit(); err != GLEW_OK) { print("Failed to initialize GLEW: %s\n", glewGetErrorString(err)); swap_window_original(window); return; diff --git a/hooks/should_draw_local_player.cpp b/hooks/should_draw_local_player.cpp index 4ba19be..8eb22b1 100644 --- a/hooks/should_draw_local_player.cpp +++ b/hooks/should_draw_local_player.cpp @@ -1,8 +1,8 @@ -#include "../interfaces/entity_list.hpp" +/*#include "../interfaces/entity_list.hpp" #include "../interfaces/input.hpp" -#include "../classes/player.hpp" +#include "../classes/player.hpp"*/ bool (*should_draw_local_player_original)(void *); diff --git a/hooks/should_draw_this_player.cpp b/hooks/should_draw_this_player.cpp index d1bd8e9..29eede3 100644 --- a/hooks/should_draw_this_player.cpp +++ b/hooks/should_draw_this_player.cpp @@ -1,9 +1,9 @@ -#include "../interfaces/entity_list.hpp" +/*#include "../interfaces/entity_list.hpp" #include "../interfaces/input.hpp" #include "../classes/player.hpp" -#include "../print.hpp" +#include "../print.hpp"*/ bool (*should_draw_this_player_original)(void *); diff --git a/interfaces/client.hpp b/interfaces/client.hpp index 10c23a5..6f97514 100644 --- a/interfaces/client.hpp +++ b/interfaces/client.hpp @@ -22,32 +22,32 @@ struct user_cmd { }; enum in_buttons { - IN_ATTACK = (1 << 0), - IN_JUMP = (1 << 1), - IN_DUCK = (1 << 2), - IN_FORWARD = (1 << 3), - IN_BACK = (1 << 4), - IN_USE = (1 << 5), - IN_CANCEL = (1 << 6), - IN_LEFT = (1 << 7), - IN_RIGHT = (1 << 8), - IN_MOVELEFT = (1 << 9), - IN_MOVERIGHT = (1 << 10), - IN_ATTACK2 = (1 << 11), - IN_RUN = (1 << 12), - IN_RELOAD = (1 << 13), - IN_ALT1 = (1 << 14), - IN_ALT2 = (1 << 15), - IN_SCORE = (1 << 16), - IN_SPEED = (1 << 17), - IN_WALK = (1 << 18), - IN_ZOOM = (1 << 19), - IN_WEAPON1 = (1 << 20), - IN_WEAPON2 = (1 << 21), - IN_BULLRUSH = (1 << 22), - IN_GRENADE1 = (1 << 23), - IN_GRENADE2 = (1 << 24), - IN_ATTACK3 = (1 << 25), + IN_ATTACK = 1 << 0, + IN_JUMP = 1 << 1, + IN_DUCK = 1 << 2, + IN_FORWARD = 1 << 3, + IN_BACK = 1 << 4, + IN_USE = 1 << 5, + IN_CANCEL = 1 << 6, + IN_LEFT = 1 << 7, + IN_RIGHT = 1 << 8, + IN_MOVELEFT = 1 << 9, + IN_MOVERIGHT = 1 << 10, + IN_ATTACK2 = 1 << 11, + IN_RUN = 1 << 12, + IN_RELOAD = 1 << 13, + IN_ALT1 = 1 << 14, + IN_ALT2 = 1 << 15, + IN_SCORE = 1 << 16, + IN_SPEED = 1 << 17, + IN_WALK = 1 << 18, + IN_ZOOM = 1 << 19, + IN_WEAPON1 = 1 << 20, + IN_WEAPON2 = 1 << 21, + IN_BULLRUSH = 1 << 22, + IN_GRENADE1 = 1 << 23, + IN_GRENADE2 = 1 << 24, + IN_ATTACK3 = 1 << 25, }; class Client { diff --git a/interfaces/debug_overlay.hpp b/interfaces/debug_overlay.hpp index bc81d91..29c8345 100644 --- a/interfaces/debug_overlay.hpp +++ b/interfaces/debug_overlay.hpp @@ -9,9 +9,9 @@ class DebugOverlay { void **vtable = *reinterpret_cast(this); int (*world_to_screen_fn)(void *, Vec3 *, Vec3 *) = (int (*)(void *, Vec3 *, Vec3 *)) vtable[9]; - int success = world_to_screen_fn(this, point, screen); + const int success = world_to_screen_fn(this, point, screen); - return (success == 0); + return success == 0; } }; diff --git a/interfaces/engine_trace.hpp b/interfaces/engine_trace.hpp index dbbc7b2..bf48bdc 100644 --- a/interfaces/engine_trace.hpp +++ b/interfaces/engine_trace.hpp @@ -11,10 +11,10 @@ enum trace_type_t { }; struct ray_t { - struct Vec3_aligned start; // starting point, centered within the extents - struct Vec3_aligned delta; // direction + length of the ray - struct Vec3_aligned start_offset; // Add this to m_Start to get the actual ray start - struct Vec3_aligned extents; // Describes an axis aligned box extruded along a ray + Vec3_aligned start; // starting point, centered within the extents + Vec3_aligned delta; // direction + length of the ray + Vec3_aligned start_offset; // Add this to m_Start to get the actual ray start + Vec3_aligned extents; // Describes an axis aligned box extruded along a ray bool is_ray; // are the extents zero? bool is_swept; // is delta != 0? }; @@ -41,14 +41,14 @@ struct csurface_t { struct trace_t { Vec3 startpos; Vec3 endpos; - struct cplane_t plane; + cplane_t plane; float fraction; int contents; unsigned short disp_flags; bool all_solid; bool start_solid; float fraction_left_solid; - struct csurface_t surface; + csurface_t surface; int hit_group; short physics_bone; void *entity; @@ -117,17 +117,17 @@ struct trace_t { #define MASK_SOLID (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_MONSTER|CONTENTS_GRATE) //add a namespace or class for these functions and vars -bool should_hit_entity(struct trace_filter *interface, void *entity, int contents_mask) { +bool should_hit_entity(trace_filter *interface, void *entity, int contents_mask) { return entity != interface->skip; } -enum trace_type_t trace_type = TRACE_EVERYTHING; +trace_type_t trace_type = TRACE_EVERYTHING; -void set_type(enum trace_type_t new_trace_type) { +void set_type(trace_type_t new_trace_type) { trace_type = new_trace_type; } -enum trace_type_t get_type(struct trace_filter *interface) { +trace_type_t get_type(trace_filter *interface) { return trace_type; } @@ -136,8 +136,8 @@ static void *trace_filter_vtable[2] = {(void *) should_hit_entity, (void *) get_ class EngineTrace { public: - static struct Vec3_aligned Vec3_aligned_subtract(Vec3 *a, Vec3 *b) { - const struct Vec3_aligned result = { + static Vec3_aligned Vec3_aligned_subtract(Vec3 *a, Vec3 *b) { + const Vec3_aligned result = { .x = a->x - b->x, .y = a->y - b->y, .z = a->z - b->z @@ -146,8 +146,8 @@ class EngineTrace { return result; } - static struct Vec3_aligned Vec3_aligned_add(Vec3 *a, Vec3 *b) { - const struct Vec3_aligned result = { + static Vec3_aligned Vec3_aligned_add(Vec3 *a, Vec3 *b) { + const Vec3_aligned result = { .x = a->x + b->x, .y = a->y + b->y, .z = a->z + b->z @@ -157,11 +157,11 @@ class EngineTrace { } - static struct ray_t init_ray(Vec3 *start, Vec3 *end) { - struct Vec3_aligned delta = Vec3_aligned_subtract(end, start); - const bool is_swept = (delta.x != 0.0f || delta.y != 0.0f || delta.z != 0.0f); + static ray_t init_ray(Vec3 *start, Vec3 *end) { + Vec3_aligned delta = Vec3_aligned_subtract(end, start); + const bool is_swept = delta.x != 0.0f || delta.y != 0.0f || delta.z != 0.0f; - struct ray_t ray = { + const ray_t ray = { .start = {start->x, start->y, start->z}, .delta = {delta.x, delta.y, delta.z}, .start_offset = {0.0f, 0.0f, 0.0f}, @@ -173,11 +173,11 @@ class EngineTrace { return ray; } - static struct ray_t init_ray(Vec3 *start, Vec3 *end, Vec3 *mins, Vec3 *maxs) { - struct Vec3_aligned delta = Vec3_aligned_subtract(end, start); - const bool is_swept = (delta.x != 0.0f || delta.y != 0.0f || delta.z != 0.0f); + static ray_t init_ray(Vec3 *start, Vec3 *end, Vec3 *mins, Vec3 *maxs) { + Vec3_aligned delta = Vec3_aligned_subtract(end, start); + const bool is_swept = delta.x != 0.0f || delta.y != 0.0f || delta.z != 0.0f; - struct ray_t ray = { + ray_t ray = { .start = {0, 0, 0}, .delta = {delta.x, delta.y, delta.z}, .start_offset = Vec3_aligned_add(mins, maxs), @@ -204,23 +204,23 @@ class EngineTrace { return ray; } - static void init_trace_filter(struct trace_filter *filter, void *skip) { + static void init_trace_filter(trace_filter *filter, void *skip) { filter->vtable = trace_filter_vtable; filter->skip = skip; } - void trace_ray(struct ray_t *ray, unsigned int f_mask, struct trace_filter *p_trace_filter, - struct trace_t *p_trace) { + void trace_ray(ray_t *ray, unsigned int f_mask, trace_filter *p_trace_filter, + trace_t *p_trace) { void **vtable = *reinterpret_cast(this); - void (*trace_ray_fn)(void *, struct ray_t *, unsigned int, struct trace_filter *, struct trace_t *) = + void (*trace_ray_fn)(void *, ray_t *, unsigned int, trace_filter *, trace_t *) = (void (*)(void *, struct ray_t *, unsigned int, struct trace_filter *, struct trace_t *)) vtable[4]; trace_ray_fn(this, ray, f_mask, p_trace_filter, p_trace); } - void trace_hull(Vec3 start, Vec3 end, Vec3 hull_min, Vec3 hull_max, unsigned int mask, struct trace_t *trace) { - struct ray_t ray = init_ray(&start, &end, &hull_min, &hull_max); - struct trace_filter filter; + void trace_hull(Vec3 start, Vec3 end, Vec3 hull_min, Vec3 hull_max, const unsigned int mask, trace_t *trace) { + ray_t ray = init_ray(&start, &end, &hull_min, &hull_max); + trace_filter filter{}; this->trace_ray(&ray, mask, &filter, trace); } diff --git a/interfaces/entity_list.hpp b/interfaces/entity_list.hpp index 8ebedd9..3b1726f 100644 --- a/interfaces/entity_list.hpp +++ b/interfaces/entity_list.hpp @@ -21,7 +21,7 @@ class EntityList { } Entity *entity_from_handle(int handle) { - return entity_from_index((handle & ((1 << 16) - 1))); + return entity_from_index(handle & (1 << 16) - 1); // Convert handle to index https://github.com/ValveSoftware/source-sdk-2013/blob/39f6dde8fbc238727c020d13b05ecadd31bda4c0/src/public/const.h#L83 } diff --git a/interfaces/input.hpp b/interfaces/input.hpp index 317f2bc..1efbccc 100644 --- a/interfaces/input.hpp +++ b/interfaces/input.hpp @@ -46,7 +46,6 @@ class Input { to_firstperson_fn(this); } -public: char pad0[0x100]; user_cmd *commands; diff --git a/interfaces/prediction.hpp b/interfaces/prediction.hpp index c1d62f8..8b78921 100644 --- a/interfaces/prediction.hpp +++ b/interfaces/prediction.hpp @@ -12,7 +12,7 @@ struct user_cmd; class IPrediction { public: virtual ~IPrediction(void) { - }; + } virtual void init(void) = 0; @@ -44,7 +44,7 @@ class IPrediction { class Prediction : public IPrediction { public: virtual ~Prediction() { - }; + } virtual void init() = 0; @@ -89,7 +89,6 @@ class Prediction : public IPrediction { virtual void _update(bool received_new_world_update, bool validframe, int incoming_acknowledged, int outgoing_command) = 0; -public: int last_ground; bool in_prediction; bool first_time_predicted; diff --git a/interfaces/render_view.hpp b/interfaces/render_view.hpp index 244ee06..0bdd6de 100644 --- a/interfaces/render_view.hpp +++ b/interfaces/render_view.hpp @@ -18,7 +18,7 @@ class RenderView { get_matrices_for_view_fn(this, view, world_to_screen, view_to_projection, world_to_projection, world_to_pixels); } - bool world_to_screen(Vec3 *point, Vec3 *screen) { + bool world_to_screen(const Vec3 *point, Vec3 *screen) { view_setup local_view = {}; client->get_player_view(local_view); @@ -28,10 +28,11 @@ class RenderView { VMatrix world_to_pixels = {}; get_matrices_for_view(local_view, &world_to_screen, &view_to_pojection, &world_to_projection, &world_to_pixels); - Vec2 screen_size = engine->get_screen_size(); + const Vec2 screen_size = engine->get_screen_size(); - float w = world_to_projection[3][0] * point->x + world_to_projection[3][1] * point->y + world_to_projection[3][ - 2] * point->z + world_to_projection[3][3]; + const float w = world_to_projection[3][0] * point->x + world_to_projection[3][1] * point->y + + world_to_projection[3][ + 2] * point->z + world_to_projection[3][3]; if (w < 0.1f) return false; diff --git a/interfaces/surface.hpp b/interfaces/surface.hpp index 9173627..b10d41b 100644 --- a/interfaces/surface.hpp +++ b/interfaces/surface.hpp @@ -1,10 +1,10 @@ #ifndef SURFACE_HPP #define SURFACE_HPP -#include +#include #include "../vec.hpp" - +#include "../libsigscan/libsigscan.h" #include "../gui/config.hpp" class Surface { @@ -139,6 +139,30 @@ class Surface { draw_circle_fn(this, x, y, radius, segments); } + + void disable_clipping(bool disable) { + void **vtable = *reinterpret_cast(this); + + void (*disable_clipping_fn)(void *, bool) = (void (*)(void *, bool)) vtable[156]; + + disable_clipping_fn(this, disable); + } + + void set_clipping_rect(int left, int top, int right, int bottom) { + void **vtable = *reinterpret_cast(this); + + void (*set_clipping_rect_fn)(void *, int, int, int, int) = (void (*)(void *, int, int, int, int)) vtable[158]; + + set_clipping_rect_fn(this, left, top, right, bottom); + } + + void start_drawing(void) { + reinterpret_cast(sigscan_module("./bin/linux64/vguimatsurface.so", "55 48 89 E5 41 54 53 48 89 FB 48 83 EC ? 80 3D")); + } + + void finish_drawing(void) { + reinterpret_cast(sigscan_module("./bin/linux64/vguimatsurface.so", "55 31 FF 48 89 E5 41 54")); + } }; static inline Surface *surface; diff --git a/libsigscan/libsigscan.c b/libsigscan/libsigscan.c index e56392b..129962d 100644 --- a/libsigscan/libsigscan.c +++ b/libsigscan/libsigscan.c @@ -234,7 +234,7 @@ static void* do_scan(int pid, uintptr_t start, uintptr_t end, const char* ida) { size_t buf_pos = 0; size_t match_start = 0; - while ((chunk_start + buf_pos) < end && mask[pat_pos] != '\0') { + while (chunk_start + buf_pos < end && mask[pat_pos] != '\0') { if (buf_pos >= buf_sz) { if (match_start == buf_pos) { chunk_start += buf_sz; @@ -269,7 +269,7 @@ static void* do_scan(int pid, uintptr_t start, uintptr_t end, const char* ida) { * Otherwise, NULL. */ void* ret = - (mask[pat_pos] == '\0') ? (void*)(chunk_start + match_start) : NULL; + mask[pat_pos] == '\0' ? (void*)(chunk_start + match_start) : NULL; free(buf); free(mask); @@ -380,7 +380,7 @@ SigscanModuleBounds* sigscan_get_module_bounds(int pid, const char* regex) { void* end_addr = (void*)end_num; /* Parse "rwxp". For now we only care about read permissions. */ - const bool is_readable = (rwxp[0] == 'r'); + const bool is_readable = rwxp[0] == 'r'; /* * First, we make sure we got a name, and that it doesn't start with diff --git a/libsigscan/libsigscan.h b/libsigscan/libsigscan.h index 9e1b0ae..201d715 100644 --- a/libsigscan/libsigscan.h +++ b/libsigscan/libsigscan.h @@ -88,7 +88,7 @@ static inline void* sigscan_pid(int pid, const char* ida_pattern) { * Search for `ida_pattern' in all the modules loaded by the current process, * whose name matches `regex'. */ -static inline void* sigscan_module(const char* regex, const char* ida_pattern) { +static inline void* sigscan_module(const char *regex, const char *ida_pattern) { return sigscan_pid_module(SIGSCAN_PID_SELF, regex, ida_pattern); } diff --git a/main.cpp b/main.cpp index 51fcb14..c02800a 100644 --- a/main.cpp +++ b/main.cpp @@ -45,6 +45,7 @@ #include "hooks/should_draw_local_player.cpp" #include "hooks/should_draw_this_player.cpp" #include "hooks/draw_view_models.cpp" +#include "hooks/enginevgui_paint.cpp" #include "vec.hpp" @@ -64,23 +65,23 @@ void entry() { vgui = get_interface("./bin/linux64/vgui2.so", "VGUI_Panel009"); surface = static_cast(get_interface("./bin/linux64/vguimatsurface.so", "VGUI_Surface030")); - unsigned long func_address = reinterpret_cast(sigscan_module("client.so", + const unsigned long func_address = reinterpret_cast(sigscan_module("client.so", "48 8D 05 ? ? ? ? 48 8B 38 48 8B 07 FF 90 ? ? ? ? 48 8D 15 ? ? ? ? 84 C0")); - unsigned int input_eaddr = *reinterpret_cast(func_address + 0x3); - unsigned long next_instruction = func_address + 0x7; + const unsigned int input_eaddr = *reinterpret_cast(func_address + 0x3); + const unsigned long next_instruction = func_address + 0x7; input = static_cast(*reinterpret_cast(next_instruction + input_eaddr)); - unsigned long check_stuck_address = reinterpret_cast(sigscan_module( + const unsigned long check_stuck_address = reinterpret_cast(sigscan_module( "client.so", "48 8D 05 ? ? ? ? 48 89 85 ? ? ? ? 74 ? 48 8B 38")); - unsigned int move_helper_eaddr = *reinterpret_cast(check_stuck_address + 0x3); - unsigned long check_stuck_next_instruction = check_stuck_address + 0x7; + const unsigned int move_helper_eaddr = *reinterpret_cast(check_stuck_address + 0x3); + const unsigned long check_stuck_next_instruction = check_stuck_address + 0x7; move_helper = static_cast(*reinterpret_cast( check_stuck_next_instruction + move_helper_eaddr)); - unsigned long rcon_addr_change_address = reinterpret_cast(sigscan_module( + const unsigned long rcon_addr_change_address = reinterpret_cast(sigscan_module( "engine.so", "48 8D 05 ? ? ? ? 4C 8B 40")); - unsigned int client_state_eaddr = *reinterpret_cast(rcon_addr_change_address + 0x3); - unsigned long rcon_addr_change_next_instruction = rcon_addr_change_address + 0x7; + const unsigned int client_state_eaddr = *reinterpret_cast(rcon_addr_change_address + 0x3); + const unsigned long rcon_addr_change_next_instruction = rcon_addr_change_address + 0x7; client_state = static_cast(reinterpret_cast( rcon_addr_change_next_instruction + client_state_eaddr)); @@ -107,23 +108,23 @@ void entry() { steam_client = static_cast(get_interface("../../../linux64/steamclient.so", "SteamClient020")); - int steam_pipe = steam_client->create_steam_pipe(); - int steam_user = steam_client->connect_to_global_user(steam_pipe); + const int steam_pipe = steam_client->create_steam_pipe(); + const int steam_user = steam_client->connect_to_global_user(steam_pipe); steam_friends = static_cast(steam_client->get_steam_friends_interface( steam_user, steam_pipe, "SteamFriends017")); client_vtable = *reinterpret_cast(client); void *hud_process_input_addr = client_vtable[10]; - __uint32_t client_mode_eaddr = *reinterpret_cast<__uint32_t *>( + const __uint32_t client_mode_eaddr = *reinterpret_cast<__uint32_t *>( reinterpret_cast<__uint64_t>(hud_process_input_addr) + 0x3); void *client_mode_next_instruction = reinterpret_cast( reinterpret_cast<__uint64_t>(hud_process_input_addr) + 0x7); void *client_mode_interface = *reinterpret_cast( reinterpret_cast<__uint64_t>(client_mode_next_instruction) + client_mode_eaddr); - unsigned long hud_update = reinterpret_cast(client_vtable[11]); - unsigned int global_vars_eaddr = *reinterpret_cast(hud_update + 0x16); - unsigned long global_vars_next_instruction = hud_update + 0x1A; + const unsigned long hud_update = reinterpret_cast(client_vtable[11]); + const unsigned int global_vars_eaddr = *reinterpret_cast(hud_update + 0x16); + const unsigned long global_vars_next_instruction = hud_update + 0x1A; global_vars = static_cast(*reinterpret_cast( global_vars_next_instruction + global_vars_eaddr)); @@ -166,7 +167,7 @@ void entry() { print("PaintTraverse hooked\n"); } - model_render_vtable = *(void ***) model_render; + model_render_vtable = *reinterpret_cast(model_render); draw_model_execute_original = (void (*)(void *, void *, ModelRenderInfo_t *, VMatrix *)) model_render_vtable[19]; if (!write_to_table(model_render_vtable, 19, (void *) draw_model_execute_hook)) { @@ -183,6 +184,9 @@ void entry() { load_white_list_original = (void* (*)(void *, const char *)) sigscan_module( "engine.so", "55 48 89 E5 41 55 41 54 49 89 FC 48 83 EC ? 48 8B 07 FF 50"); + enginevgui_paint_original = (void (*)(void *, int)) sigscan_module( + "engine.so", "55 31 C0 48 89 E5 41 57 41 89 F7 41 56 41 55 41 54 53 48 89 FB 48 83 EC"); + cl_move_original = (void (*)(float, bool)) sigscan_module("engine.so", "55 48 89 E5 41 57 41 56 41 55 41 54 53 48 83 EC ? 83 3D ? ? ? ? ? F3 0F 11 85"); @@ -207,6 +211,11 @@ void entry() { if (rv != 0) { } + rv = funchook_prepare(funchook, reinterpret_cast(&enginevgui_paint_original), + (void *) enginevgui_paint_hook); + if (rv != 0) { + } + rv = funchook_prepare(funchook, reinterpret_cast(&cl_move_original), (void *) cl_move_hook); if (rv != 0) { } @@ -287,10 +296,10 @@ void entry() { // Misc static variables and hookable things - unsigned long func_address_2 = reinterpret_cast(sigscan_module( + const unsigned long func_address_2 = reinterpret_cast(sigscan_module( "client.so", "48 8D 05 ? ? ? ? BA ? ? ? ? 89 10")); // credz: vannie / @clsendmove on github - unsigned int random_seed_eaddr = *reinterpret_cast(func_address_2 + 0x3); - unsigned long func_address_2_next_instruction = func_address_2 + 0x7; + const unsigned int random_seed_eaddr = *reinterpret_cast(func_address_2 + 0x3); + const unsigned long func_address_2_next_instruction = func_address_2 + 0x7; random_seed = static_cast(reinterpret_cast( func_address_2_next_instruction + random_seed_eaddr)); } diff --git a/math.hpp b/math.hpp index a4d5b9c..1186939 100644 --- a/math.hpp +++ b/math.hpp @@ -11,13 +11,13 @@ //pi/180 #define pideg 0.017453293f -inline static float distance_3d(Vec3 location_one, Vec3 location_two) { - return sqrt(((location_one.y - location_two.y) * (location_one.y - location_two.y)) + - ((location_one.x - location_two.x) * (location_one.x - location_two.x)) + - ((location_one.z - location_two.z) * (location_one.z - location_two.z))); +static float distance_3d(const Vec3 location_one, const Vec3 location_two) { + return sqrt((location_one.y - location_two.y) * (location_one.y - location_two.y) + + (location_one.x - location_two.x) * (location_one.x - location_two.x) + + (location_one.z - location_two.z) * (location_one.z - location_two.z)); } -inline static void angle_vectors(Vec3 angles, Vec3 *forward, Vec3 *right, Vec3 *up) { +static void angle_vectors(const Vec3 angles, Vec3 *forward, Vec3 *right, Vec3 *up) { double sp, sy, sr, cp, cy, cr; sincos(angles.x * pideg, &sp, &cp); sincos(angles.y * pideg, &sy, &cy); @@ -32,14 +32,14 @@ inline static void angle_vectors(Vec3 angles, Vec3 *forward, Vec3 *right, Vec3 * sincos(angles.z * pideg, &sr, &cr); if (right) { - right->x = (-1 * sr * sp * cy + -1 * cr * -sy); - right->y = (-1 * sr * sp * sy + -1 * cr * cy); + right->x = -1 * sr * sp * cy + -1 * cr * -sy; + right->y = -1 * sr * sp * sy + -1 * cr * cy; right->z = -1 * sr * cp; } if (up) { - up->x = (cr * sp * cy + -sr * -sy); - up->y = (cr * sp * sy + -sr * cy); + up->x = cr * sp * cy + -sr * -sy; + up->y = cr * sp * sy + -sr * cy; up->z = cr * cp; } } diff --git a/md5.cpp b/md5.cpp new file mode 100644 index 0000000..b8f5c5f --- /dev/null +++ b/md5.cpp @@ -0,0 +1,182 @@ +//TODO: find this file a home -Viceroy +#include "md5.hpp" +#include +#include +#include + +#define f1(x, y, z) (z ^ (x & (y ^ z))) +#define f2(x, y, z) f1(z, x, y) +#define f3(x, y, z) (x ^ y ^ z) +#define f4(x, y, z) (y ^ (x | ~z)) + +#define md5_step(f, w, x, y, z, data, s) ( w += f(x, y, z) + data, w = (w << s) | (w >> (32 - s)), w += x ) + +static void md5_transform(uint32_t buf[4], const uint32_t in[16]) { + uint32_t a, b, c, d; + + a = buf[0]; + b = buf[1]; + c = buf[2]; + d = buf[3]; + + md5_step(f1, a, b, c, d, in[0] + 0xd76aa478, 7); + md5_step(f1, d, a, b, c, in[1] + 0xe8c7b756, 12); + md5_step(f1, c, d, a, b, in[2] + 0x242070db, 17); + md5_step(f1, b, c, d, a, in[3] + 0xc1bdceee, 22); + md5_step(f1, a, b, c, d, in[4] + 0xf57c0faf, 7); + md5_step(f1, d, a, b, c, in[5] + 0x4787c62a, 12); + md5_step(f1, c, d, a, b, in[6] + 0xa8304613, 17); + md5_step(f1, b, c, d, a, in[7] + 0xfd469501, 22); + md5_step(f1, a, b, c, d, in[8] + 0x698098d8, 7); + md5_step(f1, d, a, b, c, in[9] + 0x8b44f7af, 12); + md5_step(f1, c, d, a, b, in[10] + 0xffff5bb1, 17); + md5_step(f1, b, c, d, a, in[11] + 0x895cd7be, 22); + md5_step(f1, a, b, c, d, in[12] + 0x6b901122, 7); + md5_step(f1, d, a, b, c, in[13] + 0xfd987193, 12); + md5_step(f1, c, d, a, b, in[14] + 0xa679438e, 17); + md5_step(f1, b, c, d, a, in[15] + 0x49b40821, 22); + + md5_step(f2, a, b, c, d, in[1] + 0xf61e2562, 5); + md5_step(f2, d, a, b, c, in[6] + 0xc040b340, 9); + md5_step(f2, c, d, a, b, in[11] + 0x265e5a51, 14); + md5_step(f2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); + md5_step(f2, a, b, c, d, in[5] + 0xd62f105d, 5); + md5_step(f2, d, a, b, c, in[10] + 0x02441453, 9); + md5_step(f2, c, d, a, b, in[15] + 0xd8a1e681, 14); + md5_step(f2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); + md5_step(f2, a, b, c, d, in[9] + 0x21e1cde6, 5); + md5_step(f2, d, a, b, c, in[14] + 0xc33707d6, 9); + md5_step(f2, c, d, a, b, in[3] + 0xf4d50d87, 14); + md5_step(f2, b, c, d, a, in[8] + 0x455a14ed, 20); + md5_step(f2, a, b, c, d, in[13] + 0xa9e3e905, 5); + md5_step(f2, d, a, b, c, in[2] + 0xfcefa3f8, 9); + md5_step(f2, c, d, a, b, in[7] + 0x676f02d9, 14); + md5_step(f2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); + + md5_step(f3, a, b, c, d, in[5] + 0xfffa3942, 4); + md5_step(f3, d, a, b, c, in[8] + 0x8771f681, 11); + md5_step(f3, c, d, a, b, in[11] + 0x6d9d6122, 16); + md5_step(f3, b, c, d, a, in[14] + 0xfde5380c, 23); + md5_step(f3, a, b, c, d, in[1] + 0xa4beea44, 4); + md5_step(f3, d, a, b, c, in[4] + 0x4bdecfa9, 11); + md5_step(f3, c, d, a, b, in[7] + 0xf6bb4b60, 16); + md5_step(f3, b, c, d, a, in[10] + 0xbebfbc70, 23); + md5_step(f3, a, b, c, d, in[13] + 0x289b7ec6, 4); + md5_step(f3, d, a, b, c, in[0] + 0xeaa127fa, 11); + md5_step(f3, c, d, a, b, in[3] + 0xd4ef3085, 16); + md5_step(f3, b, c, d, a, in[6] + 0x04881d05, 23); + md5_step(f3, a, b, c, d, in[9] + 0xd9d4d039, 4); + md5_step(f3, d, a, b, c, in[12] + 0xe6db99e5, 11); + md5_step(f3, c, d, a, b, in[15] + 0x1fa27cf8, 16); + md5_step(f3, b, c, d, a, in[2] + 0xc4ac5665, 23); + + md5_step(f4, a, b, c, d, in[0] + 0xf4292244, 6); + md5_step(f4, d, a, b, c, in[7] + 0x432aff97, 10); + md5_step(f4, c, d, a, b, in[14] + 0xab9423a7, 15); + md5_step(f4, b, c, d, a, in[5] + 0xfc93a039, 21); + md5_step(f4, a, b, c, d, in[12] + 0x655b59c3, 6); + md5_step(f4, d, a, b, c, in[3] + 0x8f0ccc92, 10); + md5_step(f4, c, d, a, b, in[10] + 0xffeff47d, 15); + md5_step(f4, b, c, d, a, in[1] + 0x85845dd1, 21); + md5_step(f4, a, b, c, d, in[8] + 0x6fa87e4f, 6); + md5_step(f4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); + md5_step(f4, c, d, a, b, in[6] + 0xa3014314, 15); + md5_step(f4, b, c, d, a, in[13] + 0x4e0811a1, 21); + md5_step(f4, a, b, c, d, in[4] + 0xf7537e82, 6); + md5_step(f4, d, a, b, c, in[11] + 0xbd3af235, 10); + md5_step(f4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); + md5_step(f4, b, c, d, a, in[9] + 0xeb86d391, 21); + + buf[0] += a; + buf[1] += b; + buf[2] += c; + buf[3] += d; +} + +void md5_init(md5_context_t *context) { + context->buf[0] = 0x67452301; + context->buf[1] = 0xefcdab89; + context->buf[2] = 0x98badcfe; + context->buf[3] = 0x10325476; + + context->bits[0] = 0; + context->bits[1] = 0; +} + +void md5_update(md5_context_t *context, const unsigned char *buf, uint32_t len) { + uint32_t t = context->bits[0]; + + if ((context->bits[0] = t + (len << 3)) < t) + context->bits[1]++; + + context->bits[1] += len >> 29; + + t = (t >> 3) & 0x3f; + + if (t) { + unsigned char *p = context->in + t; + + t = 64 - t; + if (len < t) { + memcpy(p, buf, len); + return; + } + memcpy(p, buf, t); + md5_transform(context->buf, reinterpret_cast(context->in)); + buf += t; + len -= t; + } + + while (len >= 64) { + memcpy(context->in, buf, 64); + md5_transform(context->buf, reinterpret_cast(context->in)); + buf += 64; + len -= 64; + } + + memcpy(context->in, buf, len); +} + +void md5_final(unsigned char digest[md5_digest_length], md5_context_t *context) { + unsigned count = (context->bits[0] >> 3) & 0x3F; + unsigned char *p = context->in + count; + *p++ = 0x80; + + count = 64 - 1 - count; + + if (count < 8) { + memset(p, 0, count); + md5_transform(context->buf, reinterpret_cast(context->in)); + memset(context->in, 0, 56); + } else { + memset(p, 0, count - 8); + } + + reinterpret_cast(context->in)[14] = context->bits[0]; + reinterpret_cast(context->in)[15] = context->bits[1]; + + md5_transform(context->buf, reinterpret_cast(context->in)); + memcpy(digest, context->buf, md5_digest_length); + memset(context, 0, sizeof(*context)); +} + +uint32_t md5_pseudo_random(uint32_t seed) { + md5_context_t ctx; + unsigned char digest[md5_digest_length]; + + memset(&ctx, 0, sizeof(ctx)); + + md5_init(&ctx); + md5_update(&ctx, reinterpret_cast(&seed), sizeof(seed)); + md5_final(digest, &ctx); + + return *reinterpret_cast(digest + 6); +} + +bool md5_compare(const md5_value_t &data, const md5_value_t &compare) { + return memcmp(data.bits, compare.bits, md5_digest_length) == 0; +} + +void md5_value_t::zero() { + memset(bits, 0, sizeof(bits)); +} diff --git a/md5.hpp b/md5.hpp new file mode 100644 index 0000000..b456a48 --- /dev/null +++ b/md5.hpp @@ -0,0 +1,46 @@ +#pragma once + +#include + +#define md5_digest_length 16 +#define md5_bit_length (md5_digest_length * sizeof(unsigned char)) + +struct md5_value_t { + unsigned char bits[md5_digest_length]; + + void zero(); + + bool is_zero() const; + + bool operator==(const md5_value_t &src) const; + + bool operator!=(const md5_value_t &src) const; +}; + +struct md5_context_t { + uint32_t buf[4]; + uint32_t bits[2]; + unsigned char in[64]; +}; + +void md5_init(md5_context_t *context); + +void md5_update(md5_context_t *context, const unsigned char *buf, uint32_t len); + +void md5_final(unsigned char digest[md5_digest_length], md5_context_t *context); + +char *md5_print(unsigned char *digest, int hash_len); + +void md5_process_single_buffer(const void *p, int len, md5_value_t &md5_result); + +uint32_t md5_pseudo_random(uint32_t seed); + +bool md5_compare(const md5_value_t &data, const md5_value_t &compare); + +inline bool md5_value_t::operator==(const md5_value_t &src) const { + return md5_compare(*this, src); +} + +inline bool md5_value_t::operator!=(const md5_value_t &src) const { + return !md5_compare(*this, src); +} diff --git a/memory.hpp b/memory.hpp index a41068f..ba37241 100644 --- a/memory.hpp +++ b/memory.hpp @@ -5,7 +5,7 @@ #include #include -#include "print.hpp" +//#include "print.hpp" static void *get_module_base_address(std::string module_name) { std::ifstream file; diff --git a/print.hpp b/print.hpp index 49f8dbb..146ead2 100644 --- a/print.hpp +++ b/print.hpp @@ -1,11 +1,11 @@ #ifndef PRINT_HPP #define PRINT_HPP -#include -#include +#include +#include #include -static FILE *log_file = NULL; +static FILE *log_file = nullptr; static void print(const char *fmt, ...) { if (!log_file) { diff --git a/vec.hpp b/vec.hpp index b1e825c..af3eefd 100644 --- a/vec.hpp +++ b/vec.hpp @@ -1,26 +1,28 @@ #ifndef VEC_HPP #define VEC_HPP +#include +#include struct Vec2 { int x = 0, y = 0; }; struct Vec3 { - float x = 0.0, y = 0.0, z = 0.0; + float x = 0.0f, y = 0.0f, z = 0.0f; - Vec3 operator+(const Vec3 v) { + Vec3 operator+(const Vec3 v) const { return Vec3{x + v.x, y + v.y, z + v.z}; } - Vec3 operator*(const Vec3 v) { + Vec3 operator*(const Vec3 v) const { return Vec3{x * v.x, y * v.y, z * v.z}; } - Vec3 operator*(float v) { + Vec3 operator*(const float v) const { return Vec3{x * v, y * v, z * v}; } - Vec3 operator*(int v) { + Vec3 operator*(const int v) const { return Vec3{x * v, y * v, z * v}; } @@ -38,20 +40,39 @@ struct Vec3 { return *this; } - Vec3 &operator+=(float v) { + Vec3 &operator+=(const float v) { x += v; y += v; z += v; return *this; } - Vec3 operator-(const Vec3 v) { + Vec3 operator-(const Vec3 v) const { return Vec3{x - v.x, y - v.y, z - v.z}; + + } + + float length2d(void) const + { + return sqrtf(x * x + y * y); + } + + float normalize2d() + { + const float length = length2d(); + + const float length_normal = 1.f / (std::numeric_limits::epsilon() + length); + + x *= length_normal; + y *= length_normal; + z = 0.f; + + return length; } }; struct __attribute__((aligned(16))) Vec3_aligned { - float x = 0.0, y = 0.0, z = 0.0; + float x = 0.0f, y = 0.0f, z = 0.0f; }; struct RGBA { @@ -59,9 +80,9 @@ struct RGBA { }; struct RGBA_float { - float r = 1.0, g = 1.0, b = 1.0, a = 1.0; + float r = 1.0f, g = 1.0f, b = 1.0f, a = 1.0f; - RGBA to_RGBA() { + [[nodiscard]] RGBA to_RGBA() const { return RGBA{ .r = static_cast(r * 255), .g = static_cast(g * 255), .b = static_cast(b * 255), .a = static_cast(a * 255)