partial un-static

This commit is contained in:
nullifiedcat 2017-05-11 18:34:50 +03:00
parent 6be676abde
commit 61189c1bce
16 changed files with 146 additions and 153 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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<EAimKeyMode>((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

View File

@ -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();

View File

@ -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);

View File

@ -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());

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -16,7 +16,7 @@
std::vector<ConVar*> 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);

View File

@ -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) {

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;
}

View File

@ -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;