From 61189c1bce6b43ff268b1a556ff071a8b1b5efc8 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Thu, 11 May 2017 18:34:50 +0300 Subject: [PATCH] partial un-static --- src/drawing.cpp | 32 ++++++------- src/entityhitboxcache.cpp | 10 ++--- src/hacks/Aimbot.cpp | 42 ++++++++--------- src/hacks/AntiBackstab.cpp | 14 +++--- src/hacks/AntiDisguise.cpp | 2 +- src/hacks/AutoSticky.cpp | 2 +- src/hacks/ESP.cpp | 30 ++++++------- src/hacks/SkinChanger.cpp | 17 +++---- src/hacks/SpyAlert.cpp | 6 +-- src/helpers.cpp | 92 +++++++++++++++++--------------------- src/hooks/CreateMove.cpp | 10 ++--- src/hoovy.cpp | 4 +- src/localplayer.cpp | 4 +- src/playerresource.cpp | 16 +++---- src/prediction.cpp | 6 +-- src/trace.cpp | 12 ++--- 16 files changed, 146 insertions(+), 153 deletions(-) diff --git a/src/drawing.cpp b/src/drawing.cpp index 7ecb6ef5..99556a90 100644 --- a/src/drawing.cpp +++ b/src/drawing.cpp @@ -56,8 +56,8 @@ int draw::width = 0; int draw::height = 0; int colors::EntityF(CachedEntity* ent) { - static int result, skin, plclr; - static k_EItemType type; + int result, skin, plclr; + k_EItemType type; using namespace colors; result = white; @@ -123,8 +123,8 @@ int colors::RainbowCurrent() { } int colors::FromHSL(float h, float s, float v) { - static double hh, p, q, t, ff; - static long i; + double hh, p, q, t, ff; + long i; if(s <= 0.0) { // < is bogus, just shuts up warnings return colors::Create(v * 255, v * 255, v * 255, 255); @@ -157,7 +157,7 @@ int colors::FromHSL(float h, float s, float v) { } int colors::Health(int health, int max) { - static float hf; + float hf; hf = (float)health / (float)max; if (hf > 1) { return colors::Create(64, 128, 255, 255); @@ -218,8 +218,8 @@ void draw::DrawLine(int x, int y, int dx, int dy, int color) { } bool draw::EntityCenterToScreen(CachedEntity* entity, Vector& out) { - static Vector world, min, max; - static bool succ; + Vector world, min, max; + bool succ; if (!entity) return false; RAW_ENT(entity)->GetRenderBounds(min, max); @@ -230,7 +230,7 @@ bool draw::EntityCenterToScreen(CachedEntity* entity, Vector& out) { } bool draw::WorldToScreen(Vector& origin, Vector& screen) { - static float w, odw; + float w, odw; const VMatrix& wts = g_IEngine->WorldToScreenMatrix(); screen.z = 0; @@ -250,18 +250,18 @@ void draw::OutlineRect(int x, int y, int w, int h, int color) { } void draw::GetStringLength(unsigned long font, char* string, int& length, int& height) { - static wchar_t buf[512]; + wchar_t buf[512]; memset(buf, 0, sizeof(wchar_t) * 512); mbstowcs(buf, string, strlen(string)); g_ISurface->GetTextSize(font, buf, length, height); } void draw::String (unsigned long font, int x, int y, int color, int shadow, const char* text) { - static bool newlined; - static int w, h, s, n; - static char ch[512]; - static wchar_t string[512]; - static size_t len; + bool newlined; + int w, h, s, n; + char ch[512]; + wchar_t string[512]; + size_t len; newlined = false; len = strlen(text); @@ -297,8 +297,8 @@ void draw::String(unsigned long font, int x, int y, int color, int shadow, std:: } CatVar fast_outline(CV_SWITCH, "fast_outline", "0", "Fast font outline", "Use only single repaint to increase performance"); void draw::WString(unsigned long font, int x, int y, int color, int shadow, const wchar_t* text) { - static unsigned char alpha; - static int black_t; + unsigned char alpha; + int black_t; if (shadow) { alpha = (color >> 24); diff --git a/src/entityhitboxcache.cpp b/src/entityhitboxcache.cpp index 38e0c39c..8c3ee827 100644 --- a/src/entityhitboxcache.cpp +++ b/src/entityhitboxcache.cpp @@ -37,9 +37,9 @@ void EntityHitboxCache::Update() { } void EntityHitboxCache::Init() { - static model_t *model; - static studiohdr_t *shdr; - static mstudiohitboxset_t *set; + model_t *model; + studiohdr_t *shdr; + mstudiohitboxset_t *set; m_bInit = true; model = 0; @@ -64,7 +64,7 @@ void EntityHitboxCache::Init() { } bool EntityHitboxCache::VisibilityCheck(int id) { - static CachedHitbox *hitbox; + CachedHitbox *hitbox; if (!m_bInit) Init(); if (id < 0 || id >= m_nNumHitboxes) return 0; @@ -92,7 +92,7 @@ void EntityHitboxCache::Reset() { } CachedHitbox* EntityHitboxCache::GetHitbox(int id) { - static mstudiobbox_t *box; + mstudiobbox_t *box; if (!m_bInit) Init(); if (id < 0 || id >= m_nNumHitboxes) return 0; diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index ee7c63f0..3d9e4560 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -120,8 +120,8 @@ CachedEntity* CurrentTarget() { int ClosestHitbox(CachedEntity* target) { // FIXME this will break multithreading if it will be ever implemented. When implementing it, these should be made non-static - static int closest; - static float closest_fov, fov; + int closest; + float closest_fov, fov; //If you can see the spine, no need to check for another hitbox if ((int)hitbox_mode == 0) { @@ -140,11 +140,11 @@ int ClosestHitbox(CachedEntity* target) { } void CreateMove() { - static EAimbotLocalState local_state; - static float target_highest_score, scr, begincharge, charge; - static CachedEntity* ent; - static EAimbotTargetState tg; - static int huntsman_ticks = 0; + EAimbotLocalState local_state; + float target_highest_score, scr, begincharge, charge; + CachedEntity* ent; + EAimbotTargetState tg; + int huntsman_ticks = 0; target_highest = 0; if (!enabled) { @@ -307,11 +307,11 @@ bool VischeckPredictedEntity(CachedEntity* entity) { } EAimbotTargetState TargetState(CachedEntity* entity) { - static float bdmg; - static weaponmode mode; - static Vector resultAim; - static int hitbox; - static int team; + float bdmg; + weaponmode mode; + Vector resultAim; + int hitbox; + int team; if (entity->m_Type == ENTITY_PLAYER) { if (entity == LOCAL_E) return EAimbotTargetState::LOCAL; @@ -458,9 +458,9 @@ void slowAim(Vector &inputAngle, Vector userAngle) { } bool Aim(CachedEntity* entity) { - static Vector angles, tr; - static int hitbox, weapon_class; - static bool attack; + Vector angles, tr; + int hitbox, weapon_class; + bool attack; static int forbiddenWeapons[] = { g_pClassID->CTFCompoundBow, g_pClassID->CTFKnife }; state = EAimbotState::AIMING; @@ -544,7 +544,7 @@ void UpdateAutoShootTimer() { bool UpdateAimkey() { static bool aimkey_flip = false; static bool pressed_last_tick = false; - static bool key_down; + bool key_down; if (aimkey && aimkey_mode) { key_down = g_IInputSystem->IsButtonDown((ButtonCode_t)(int)aimkey); switch (static_cast((int)aimkey_mode)) { @@ -582,8 +582,8 @@ float EffectiveShootingRange() { } EAimbotLocalState ShouldAim() { - static bool do_minigun_checks; - static int weapon_state; + bool do_minigun_checks; + int weapon_state; // Checks should be in order: cheap -> expensive if (attack_only && !(g_pUserCmd->buttons & IN_ATTACK)) { return EAimbotLocalState::NOT_ATTACKING; @@ -658,9 +658,9 @@ EAimbotLocalState ShouldAim() { } int BestHitbox(CachedEntity* target) { - static int preferred, ci, flags, bdmg; - static float cdmg; - static bool ground; + int preferred, ci, flags, bdmg; + float cdmg; + bool ground; preferred = hitbox; switch ((int)hitbox_mode) { case 0: { // AUTO-HEAD diff --git a/src/hacks/AntiBackstab.cpp b/src/hacks/AntiBackstab.cpp index 6c64fc80..43257891 100644 --- a/src/hacks/AntiBackstab.cpp +++ b/src/hacks/AntiBackstab.cpp @@ -25,8 +25,8 @@ void SayNope() { } float GetAngle(CachedEntity* spy) { - static float yaw, yaw2, anglediff; - static Vector diff; + float yaw, yaw2, anglediff; + Vector diff; yaw = g_pLocalPlayer->v_OrigViewangles.y; const Vector& A = LOCAL_E->m_vecOrigin; const Vector& B = spy->m_vecOrigin; @@ -41,8 +41,8 @@ float GetAngle(CachedEntity* spy) { } CachedEntity* ClosestSpy() { - static CachedEntity *closest, *ent; - static float closest_dist, dist; + CachedEntity *closest, *ent; + float closest_dist, dist; closest = nullptr; closest_dist = 0.0f; @@ -68,9 +68,9 @@ CachedEntity* ClosestSpy() { } void CreateMove() { - static CachedEntity *spy; - static Vector diff; - static float yaw2, resultangle; + CachedEntity *spy; + Vector diff; + float yaw2, resultangle; if (!enabled) return; spy = ClosestSpy(); diff --git a/src/hacks/AntiDisguise.cpp b/src/hacks/AntiDisguise.cpp index f8745ea1..9b5ff8dc 100644 --- a/src/hacks/AntiDisguise.cpp +++ b/src/hacks/AntiDisguise.cpp @@ -15,7 +15,7 @@ namespace hacks { namespace tf2 { namespace antidisguise { CatVar enabled(CV_SWITCH, "antidisguise", "0", "Remove spy disguise", "Removes the disguise from spys\nUsefull for aimbot"); void Draw() { - static CachedEntity *ent; + CachedEntity *ent; if (!enabled) return; for (int i = 0; i < 32 && i < HIGHEST_ENTITY; i++) { ent = ENTITY(i); diff --git a/src/hacks/AutoSticky.cpp b/src/hacks/AutoSticky.cpp index 5c4775d8..2b23ad7e 100644 --- a/src/hacks/AutoSticky.cpp +++ b/src/hacks/AutoSticky.cpp @@ -40,7 +40,7 @@ bool IsTarget(CachedEntity* ent) { } bool stickyVisable(CachedEntity* targetTrace, CachedEntity* bombTrace) { - static trace_t trace; + trace_t trace; trace::filter_default.SetSelf(RAW_ENT(bombTrace)); Ray_t ray; ray.Init(bombTrace->m_vecOrigin, RAW_ENT(targetTrace)->GetCollideable()->GetCollisionOrigin()); diff --git a/src/hacks/ESP.cpp b/src/hacks/ESP.cpp index d6aa07c0..ea57f350 100644 --- a/src/hacks/ESP.cpp +++ b/src/hacks/ESP.cpp @@ -68,9 +68,9 @@ void AddEntityString(CachedEntity* entity, const std::string& string, int color) } void CreateMove() { - static int limit; + int limit; static int max_clients = g_IEngine->GetMaxClients(); - static CachedEntity* ent; + CachedEntity* ent; ResetEntityStrings(); limit = HIGHEST_ENTITY; @@ -88,7 +88,7 @@ void CreateMove() { } void Draw() { - static int limit; + int limit; static int max_clients = g_IEngine->GetMaxClients(); limit = HIGHEST_ENTITY; if (!buildings && !proj_esp && !item_esp) limit = min(max_clients, HIGHEST_ENTITY); @@ -109,13 +109,13 @@ static CatVar esp_3d_box_nodraw(CV_SWITCH, "esp_3d_box_nodraw", "0", "Invisible static CatVar esp_3d_box_healthbar(CV_SWITCH, "esp_3d_box_healthbar", "1", "Health bar", "Adds a health bar to the esp"); void Draw3DBox(CachedEntity* ent, int clr, bool healthbar, int health, int healthmax) { - static Vector mins, maxs; - static Vector points_r[8]; - static Vector points[8]; - static bool set, success, cloak; - static float x, y, z; - static int hbh, max_x, max_y, min_x, min_y; - static CachedHitbox* hb; + Vector mins, maxs; + Vector points_r[8]; + Vector points[8]; + bool set, success, cloak; + float x, y, z; + int hbh, max_x, max_y, min_x, min_y; + CachedHitbox* hb; set = false; success = true; @@ -228,11 +228,11 @@ static CatVar box_nodraw(CV_SWITCH, "esp_box_nodraw", "0", "Invisible 2D Box", " static CatVar box_expand(CV_INT, "esp_box_expand", "0", "Expand 2D Box", "Expand 2D box by N units"); void DrawBox(CachedEntity* ent, int clr, float widthFactor, float addHeight, bool healthbar, int health, int healthmax) { - static Vector min, max, origin, so, omin, omax, smin, smax; - static float height, width, trf; - static bool cloak; - static int min_x, min_y, max_x, max_y, border, hp, hbh; - static unsigned char alpha; + Vector min, max, origin, so, omin, omax, smin, smax; + float height, width, trf; + bool cloak; + int min_x, min_y, max_x, max_y, border, hp, hbh; + unsigned char alpha; if (CE_BAD(ent)) return; diff --git a/src/hacks/SkinChanger.cpp b/src/hacks/SkinChanger.cpp index ddd63716..be86c1c4 100644 --- a/src/hacks/SkinChanger.cpp +++ b/src/hacks/SkinChanger.cpp @@ -142,7 +142,8 @@ static CatCommand invalidate_cookies("skinchanger_bite_cookie", "Bite Cookie", I void FrameStageNotify(int stage) { static int my_weapon, handle, eid, *weapon_list; - static IClientEntity *entity, *my_weapon_ptr, *last_weapon_out = nullptr; + static IClientEntity *entity, *my_weapon_ptr; + static IClientEntity *last_weapon_out = nullptr; if (stage != FRAME_NET_UPDATE_POSTDATAUPDATE_START) return; if (!enabled) return; @@ -184,7 +185,7 @@ void FrameStageNotify(int stage) { static CatVar show_debug_info(CV_SWITCH, "skinchanger_debug", "1", "Debug Skinchanger"); void PaintTraverse() { - static CAttributeList *list; + CAttributeList *list; if (!enabled) return; if (!show_debug_info) return; @@ -310,8 +311,8 @@ void InvalidateCookie() { patched_weapon_cookie::patched_weapon_cookie(int entity) {} void patched_weapon_cookie::Update(int entity) { - static IClientEntity *ent; - static CAttributeList *list; + IClientEntity *ent; + CAttributeList *list; ent = g_IEntityList->GetClientEntity(entity); if (!ent || ent->IsDormant()) return; @@ -326,8 +327,8 @@ void patched_weapon_cookie::Update(int entity) { } bool patched_weapon_cookie::Check() { - static IClientEntity *ent; - static CAttributeList *list; + IClientEntity *ent; + CAttributeList *list; if (!valid) return false; ent = g_IEntityList->GetClientEntity(eidx); @@ -355,8 +356,8 @@ bool def_attribute_modifier::Default() const { } void def_attribute_modifier::Apply(int entity) { - static IClientEntity *ent; - static CAttributeList *list; + IClientEntity *ent; + CAttributeList *list; ent = g_IEntityList->GetClientEntity(entity); if (!ent) return; diff --git a/src/hacks/SpyAlert.cpp b/src/hacks/SpyAlert.cpp index 4404e381..79eb6d63 100644 --- a/src/hacks/SpyAlert.cpp +++ b/src/hacks/SpyAlert.cpp @@ -25,9 +25,9 @@ float last_say = 0.0f; void Draw() { - static CachedEntity *closest_spy, *ent; - static float closest_spy_distance, distance; - static int spy_count; + CachedEntity *closest_spy, *ent; + float closest_spy_distance, distance; + int spy_count; if (!enabled) return; if (g_pLocalPlayer->life_state) return; diff --git a/src/helpers.cpp b/src/helpers.cpp index ac4d76dd..e10b2dbc 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -16,7 +16,7 @@ std::vector g_ConVars; FILE* hConVarsFile = 0; void BeginConVars() { - static FILE *hAutoexec, *hMatchexec; + FILE *hAutoexec, *hMatchexec; hConVarsFile = fopen(strfmt("%scfg/cat_defaults.cfg", g_pszTFPath), "w"); hAutoexec = fopen(strfmt("%scfg/cat_autoexec.cfg", g_pszTFPath), "r+"); @@ -52,10 +52,10 @@ void EndConVars() { // StackOverflow copypasta xddd void ReplaceString(char* target, char* what, char* with_what) { - static char buffer[1024] = { 0 }; - static char *insert_point; - static const char *tmp, *p; - static size_t needle_len, repl_len; + char buffer[1024] = { 0 }; + char *insert_point; + const char *tmp, *p; + size_t needle_len, repl_len; buffer[0] = 0; insert_point = &buffer[0]; tmp = target; @@ -109,17 +109,9 @@ const char* GetBuildingName(CachedEntity* ent) { void format_internal(std::stringstream& stream) {} std::string WordWrap(std::string& in, int max, unsigned long font) { - static std::stringstream result, line, wordstream, next; - static std::string word; - static char ch; - result.str(""); - result.clear(); - line.str(""); - line.clear(); - wordstream.str(""); - wordstream.clear(); - next.str(""); - next.clear(); + std::stringstream result, line, wordstream, next; + std::string word; + char ch; for (int i = 0; i < in.size(); i++) { ch = in.at(i); if (ch == ' ' || ch == '\n') { @@ -151,7 +143,7 @@ std::string WordWrap(std::string& in, int max, unsigned long font) { } void ReplaceString(std::string& input, const std::string& what, const std::string& with_what) { - static size_t index; + size_t index; index = input.find(what); while (index != std::string::npos) { input.replace(index, what.size(), with_what); @@ -177,7 +169,7 @@ powerup_type GetPowerupOnPlayer(CachedEntity* player) { } bool HasDarwins(CachedEntity* ent) { - static int *hWeapons; + int *hWeapons; if (CE_INT(ent, netvar.iClass) != tf_sniper) return false; hWeapons = (int*)((unsigned)(RAW_ENT(ent) + netvar.hMyWeapons)); for (int i = 0; i < 4; i++) { @@ -194,7 +186,7 @@ void VectorTransform (const float *in1, const matrix3x4_t& in2, float *out) { } bool GetHitbox(CachedEntity* entity, int hb, Vector& out) { - static CachedHitbox *box; + CachedHitbox *box; if (CE_BAD(entity)) return false; box = entity->hitboxes.GetHitbox(hb); @@ -204,7 +196,7 @@ bool GetHitbox(CachedEntity* entity, int hb, Vector& out) { } void VectorAngles(Vector &forward, Vector &angles) { - static float tmp, yaw, pitch; + float tmp, yaw, pitch; if(forward[1] == 0 && forward[0] == 0) { @@ -303,8 +295,8 @@ char GetChar(ButtonCode_t button) { } void FixMovement(CUserCmd& cmd, Vector& viewangles) { - static Vector movement, ang; - static float speed, yaw; + Vector movement, ang; + float speed, yaw; movement.x = cmd.forwardmove; movement.y = cmd.sidemove; movement.z = cmd.upmove; @@ -329,7 +321,7 @@ float RandFloatRange(float min, float max) { } bool IsEntityVisible(CachedEntity* entity, int hb) { - static Vector hit; + Vector hit; if (g_Settings.bInvalid) return false; if (entity == g_pLocalPlayer->entity) return true; if (hb == -1) { @@ -341,8 +333,8 @@ bool IsEntityVisible(CachedEntity* entity, int hb) { } bool IsEntityVectorVisible(CachedEntity* entity, Vector endpos) { - static trace_t trace_object; - static Ray_t ray; + trace_t trace_object; + Ray_t ray; if (g_Settings.bInvalid) return false; if (entity == g_pLocalPlayer->entity) return true; @@ -358,7 +350,7 @@ bool IsEntityVectorVisible(CachedEntity* entity, Vector endpos) { } Vector GetBuildingPosition(CachedEntity* ent) { - static Vector res; + Vector res; res = ent->m_vecOrigin; if (ent->m_iClassID == g_pClassID->CObjectDispenser) res.z += 30; if (ent->m_iClassID == g_pClassID->CObjectTeleporter) res.z += 8; @@ -439,8 +431,8 @@ bool IsProjectileCrit(CachedEntity* ent) { } weaponmode GetWeaponMode(CachedEntity* player) { - static int weapon_handle, slot; - static CachedEntity *weapon; + int weapon_handle, slot; + CachedEntity *weapon; if (CE_BAD(player)) return weapon_invalid; weapon_handle = CE_INT(player, netvar.hActiveWeapon); @@ -490,7 +482,7 @@ bool LineIntersectsBox(Vector& bmin, Vector& bmax, Vector& lmin, Vector& lmax) { // TODO FIX this function bool GetProjectileData(CachedEntity* weapon, float& speed, float& gravity) { - static float rspeed, rgrav; + float rspeed, rgrav; if (CE_BAD(weapon)) return false; rspeed = 0.0f; @@ -558,8 +550,8 @@ bool Developer(CachedEntity* ent) { }*/ bool IsVectorVisible(Vector origin, Vector target) { - static trace_t trace_visible; - static Ray_t ray; + trace_t trace_visible; + Ray_t ray; trace::filter_no_player.SetSelf(RAW_ENT(g_pLocalPlayer->entity)); ray.Init(origin, target); @@ -568,11 +560,11 @@ bool IsVectorVisible(Vector origin, Vector target) { } void WhatIAmLookingAt(int* result_eindex, Vector* result_pos) { - static Ray_t ray; - static Vector forward; - static float sp, sy, cp, cy; - static QAngle angle; - static trace_t trace; + Ray_t ray; + Vector forward; + float sp, sy, cp, cy; + QAngle angle; + trace_t trace; trace::filter_default.SetSelf(RAW_ENT(g_pLocalPlayer->entity)); g_IEngine->GetViewAngles(angle); @@ -611,8 +603,8 @@ bool IsAmbassador(CachedEntity* entity) { // F1 c&p Vector CalcAngle(Vector src, Vector dst) { - static Vector AimAngles, delta; - static float hyp; + Vector AimAngles, delta; + float hyp; delta = src - dst; hyp = sqrtf((delta.x * delta.x) + (delta.y * delta.y)); //SUPER SECRET IMPROVEMENT CODE NAME DONUT STEEL AimAngles.x = atanf(delta.z / hyp) * RADPI; @@ -624,7 +616,7 @@ Vector CalcAngle(Vector src, Vector dst) { } void MakeVector(Vector angle, Vector& vector) { - static float pitch, yaw, tmp; + float pitch, yaw, tmp; pitch = float(angle[0] * PI / 180); yaw = float(angle[1] * PI / 180); tmp = float(cos(pitch)); @@ -634,8 +626,8 @@ void MakeVector(Vector angle, Vector& vector) { } float GetFov(Vector angle, Vector src, Vector dst) { - static Vector ang, aim; - static float mag, u_dot_v; + Vector ang, aim; + float mag, u_dot_v; ang = CalcAngle(src, dst); MakeVector(angle, aim); @@ -652,7 +644,7 @@ bool CanHeadshot() { } bool CanShoot() { - static float servertime, nextattack; + float servertime, nextattack; servertime = (float)(CE_INT(g_pLocalPlayer->entity, netvar.nTickBase)) * g_GlobalVars->interval_per_tick; nextattack = CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flNextPrimaryAttack); @@ -668,7 +660,7 @@ Vector QAngleToVector(QAngle in) { } void AimAt(Vector origin, Vector target, CUserCmd* cmd) { - static Vector angles, tr; + Vector angles, tr; tr = (target - origin); VectorAngles(tr, angles); fClampAngle(angles); @@ -676,19 +668,19 @@ void AimAt(Vector origin, Vector target, CUserCmd* cmd) { } void AimAtHitbox(CachedEntity* ent, int hitbox, CUserCmd* cmd) { - static Vector r; + Vector r; r = ent->m_vecOrigin; GetHitbox(ent, hitbox, r); AimAt(g_pLocalPlayer->v_Eye, r, cmd); } bool IsEntityVisiblePenetration(CachedEntity* entity, int hb) { - static trace_t trace_visible; - static Ray_t ray; - static Vector hit; - static int ret; - static bool correct_entity; - static IClientEntity *ent; + trace_t trace_visible; + Ray_t ray; + Vector hit; + int ret; + bool correct_entity; + IClientEntity *ent; trace::filter_penetration.SetSelf(RAW_ENT(g_pLocalPlayer->entity)); trace::filter_penetration.Reset(); ret = GetHitbox(entity, hb, hit); diff --git a/src/hooks/CreateMove.cpp b/src/hooks/CreateMove.cpp index 4ea53646..9d023db5 100644 --- a/src/hooks/CreateMove.cpp +++ b/src/hooks/CreateMove.cpp @@ -65,10 +65,10 @@ void End() { bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) { static CreateMove_t original_method = (CreateMove_t)hooks::clientmode.GetMethod(offsets::CreateMove()); - static bool time_replaced, ret, speedapplied; - static float curtime_old, servertime, speed, yaw; - static Vector vsilent, ang; - static INetChannel* ch; + bool time_replaced, ret, speedapplied; + float curtime_old, servertime, speed, yaw; + Vector vsilent, ang; + INetChannel* ch; SEGV_BEGIN; tickcount++; @@ -143,7 +143,7 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) { #ifdef IPC_ENABLED static int team_joining_state = 0; static float last_jointeam_try = 0; - static CachedEntity *found_entity, *ent; + CachedEntity *found_entity, *ent; if (hacks::shared::followbot::bot) { diff --git a/src/hoovy.cpp b/src/hoovy.cpp index 938850c6..b4805662 100644 --- a/src/hoovy.cpp +++ b/src/hoovy.cpp @@ -10,8 +10,8 @@ static bool hoovy_list[32] = { 0 }; bool HasSandvichOut(CachedEntity* entity) { - static int weapon_idx; - static CachedEntity *weapon; + int weapon_idx; + CachedEntity *weapon; weapon_idx = CE_INT(entity, netvar.hActiveWeapon) & 0xFFF; if (!(weapon_idx > 0 && weapon_idx < HIGHEST_ENTITY)) return false; diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 4d4af4eb..7aef072b 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -9,7 +9,7 @@ #include "sdk.h" void LocalPlayer::Update() { - static CachedEntity *wep; + CachedEntity *wep; entity_idx = g_IEngine->GetLocalPlayer(); entity = ENTITY(entity_idx); @@ -39,7 +39,7 @@ void LocalPlayer::Update() { } CachedEntity* LocalPlayer::weapon() { - static int handle, eid; + int handle, eid; if (CE_BAD(entity)) return 0; handle = CE_INT(entity, netvar.hActiveWeapon); diff --git a/src/playerresource.cpp b/src/playerresource.cpp index f2ed32db..416da85a 100644 --- a/src/playerresource.cpp +++ b/src/playerresource.cpp @@ -8,7 +8,7 @@ #include "common.h" void TFPlayerResource::Update() { - static IClientEntity *ent; + IClientEntity *ent; entity = 0; for (int i = 0; i < HIGHEST_ENTITY; i++) { @@ -21,8 +21,8 @@ void TFPlayerResource::Update() { } int TFPlayerResource::GetMaxHealth(CachedEntity* player) { - static IClientEntity *ent; - static int idx; + IClientEntity *ent; + int idx; if (HL2DM) return 100; ent = g_IEntityList->GetClientEntity(entity); @@ -33,8 +33,8 @@ int TFPlayerResource::GetMaxHealth(CachedEntity* player) { } int TFPlayerResource::GetMaxBuffedHealth(CachedEntity* player) { - static IClientEntity *ent; - static int idx; + IClientEntity *ent; + int idx; if (!TF2) return GetMaxHealth(player); ent = g_IEntityList->GetClientEntity(entity); @@ -45,7 +45,7 @@ int TFPlayerResource::GetMaxBuffedHealth(CachedEntity* player) { } int TFPlayerResource::GetTeam(int idx) { - static IClientEntity *ent; + IClientEntity *ent; if (idx >= 64 || idx < 0) return 0; ent = g_IEntityList->GetClientEntity(entity); @@ -54,8 +54,8 @@ int TFPlayerResource::GetTeam(int idx) { } int TFPlayerResource::GetClass(CachedEntity* player) { - static IClientEntity *ent; - static int idx; + IClientEntity *ent; + int idx; ent = g_IEntityList->GetClientEntity(entity); if (!ent || ent->GetClientClass()->m_ClassID != (TF ? g_pClassID->CTFPlayerResource : g_pClassID->CPlayerResource)) return 0; diff --git a/src/prediction.cpp b/src/prediction.cpp index 9fb416e2..2add7539 100644 --- a/src/prediction.cpp +++ b/src/prediction.cpp @@ -97,11 +97,11 @@ float DistanceToGround(CachedEntity* ent) { } float DistanceToGround(Vector origin) { - static trace_t* ground_trace = new trace_t(); + trace_t ground_trace; Ray_t ray; Vector endpos = origin; endpos.z -= 8192; ray.Init(origin, endpos); - g_ITrace->TraceRay(ray, MASK_PLAYERSOLID, &trace::filter_no_player, ground_trace); - return 8192.0f * ground_trace->fraction; + g_ITrace->TraceRay(ray, MASK_PLAYERSOLID, &trace::filter_no_player, &ground_trace); + return 8192.0f * ground_trace.fraction; } diff --git a/src/trace.cpp b/src/trace.cpp index 103e41a4..1f041cdf 100644 --- a/src/trace.cpp +++ b/src/trace.cpp @@ -30,8 +30,8 @@ void trace::FilterDefault::SetSelf(IClientEntity* self) { } bool trace::FilterDefault::ShouldHitEntity(IHandleEntity* handle, int mask) { - static IClientEntity *entity; - static ClientClass *clazz; + IClientEntity *entity; + ClientClass *clazz; if (!handle) return false; entity = (IClientEntity*) handle; @@ -70,8 +70,8 @@ void trace::FilterNoPlayer::SetSelf(IClientEntity* self) { } bool trace::FilterNoPlayer::ShouldHitEntity(IHandleEntity* handle, int mask) { - static IClientEntity *entity; - static ClientClass *clazz; + IClientEntity *entity; + ClientClass *clazz; if (!handle) return false; entity = (IClientEntity*) handle; @@ -110,8 +110,8 @@ void trace::FilterPenetration::SetSelf(IClientEntity* self) { } bool trace::FilterPenetration::ShouldHitEntity(IHandleEntity* handle, int mask) { - static IClientEntity *entity; - static ClientClass *clazz; + IClientEntity *entity; + ClientClass *clazz; if (!handle) return false; entity = (IClientEntity*) handle;