This commit is contained in:
Stephen 2023-02-18 23:50:39 -05:00 committed by LightCat
parent ae2e3feff6
commit 2dc50ca76d
14 changed files with 101 additions and 109 deletions

View File

@ -201,7 +201,6 @@ public:
bool m_bAnyHitboxVisible{ false }; bool m_bAnyHitboxVisible{ false };
bool m_bVisCheckComplete{ false }; bool m_bVisCheckComplete{ false };
k_EItemType m_ItemType() k_EItemType m_ItemType()
{ {
if (m_Type() == ENTITY_GENERIC) if (m_Type() == ENTITY_GENERIC)
@ -209,27 +208,20 @@ public:
else else
return ITEM_NONE; return ITEM_NONE;
}; };
unsigned long m_lSeenTicks{ 0 };
unsigned long m_lLastSeen{ 0 }; unsigned long m_lLastSeen{ 0 };
Vector m_vecVOrigin{ 0 };
Vector m_vecVelocity{ 0 }; Vector m_vecVelocity{ 0 };
Vector m_vecAcceleration{ 0 }; Vector m_vecAcceleration{ 0 };
float m_fLastUpdate{ 0.0f };
hitbox_cache::EntityHitboxCache hitboxes; hitbox_cache::EntityHitboxCache hitboxes;
player_info_s player_info{}; player_info_s *player_info = nullptr;
Averager<float> velocity_averager{ 8 };
void Reset() void Reset()
{ {
m_bAnyHitboxVisible = false; m_bAnyHitboxVisible = false;
m_bVisCheckComplete = false; m_bVisCheckComplete = false;
m_lLastSeen = 0; m_lLastSeen = 0;
m_lSeenTicks = 0; if (player_info)
memset(&player_info, 0, sizeof(player_info_s)); memset(player_info, 0, sizeof(player_info_s));
m_vecAcceleration.Zero(); m_vecAcceleration.Zero();
m_vecVOrigin.Zero();
m_vecVelocity.Zero(); m_vecVelocity.Zero();
m_fLastUpdate = 0;
} }
bool was_dormant() bool was_dormant()

View File

@ -55,7 +55,7 @@ function init() {
# #
function updateRepoURL() { function updateRepoURL() {
local URL="https://github.com/STEVE4git/cathook/" local URL="$(curl --max-time 10 -s -o /dev/null -w %{redirect_url} https://cathook.club/s/ch/git || echo error)"
local GIT_REMOTE=$(git config --get remote.origin.url || echo unknown) local GIT_REMOTE=$(git config --get remote.origin.url || echo unknown)
if [ "$URL" != "error" ] && [ "$GIT_REMOTE" != "$URL" ]; then if [ "$URL" != "error" ] && [ "$GIT_REMOTE" != "$URL" ]; then
git remote set-url origin "$URL" && echo -e "\033[1;33m\n\nMigrations: Updated remote URL to new repo! Welcome to $URL!\n\n\033[0m" || : git remote set-url origin "$URL" && echo -e "\033[1;33m\n\nMigrations: Updated remote URL to new repo! Welcome to $URL!\n\n\033[0m" || :

View File

@ -52,7 +52,7 @@ bool shouldTarget(CachedEntity *entity)
// Don't shoot players in truce // Don't shoot players in truce
if (isTruce()) if (isTruce())
return false; return false;
return shouldTargetSteamId(entity->player_info.friendsID); return shouldTargetSteamId(entity->player_info->friendsID);
} }
else if (entity->m_Type() == ENTITY_BUILDING) else if (entity->m_Type() == ENTITY_BUILDING)
// Don't shoot buildings in truce // Don't shoot buildings in truce
@ -75,7 +75,7 @@ bool shouldAlwaysRenderEsp(CachedEntity *entity)
{ {
if (entity->m_Type() == ENTITY_PLAYER) if (entity->m_Type() == ENTITY_PLAYER)
{ {
return shouldAlwaysRenderEspSteamId(entity->player_info.friendsID); return shouldAlwaysRenderEspSteamId(entity->player_info->friendsID);
} }
return false; return false;
@ -95,9 +95,9 @@ std::optional<colors::rgba_t> forceEspColorSteamId(unsigned id)
} }
std::optional<colors::rgba_t> forceEspColor(CachedEntity *entity) std::optional<colors::rgba_t> forceEspColor(CachedEntity *entity)
{ {
if (entity->m_Type() == ENTITY_PLAYER) if (entity->m_Type() == ENTITY_PLAYER && entity->player_info)
{ {
return forceEspColorSteamId(entity->player_info.friendsID); return forceEspColorSteamId(entity->player_info->friendsID);
} }
return std::nullopt; return std::nullopt;
@ -150,7 +150,7 @@ static CatCommand mark_betrayal("pl_mark_betrayal", "Mark a steamid32 as betraya
void onKilledBy(CachedEntity *entity) void onKilledBy(CachedEntity *entity)
{ {
onKilledBy(entity->player_info.friendsID); onKilledBy(entity->player_info->friendsID);
} }
class PlayerToolsEventListener : public IGameEventListener2 class PlayerToolsEventListener : public IGameEventListener2

View File

@ -20,7 +20,6 @@ inline void CachedEntity::Update()
return; return;
} }
#endif #endif
m_lSeenTicks = 0;
m_lLastSeen = 0; m_lLastSeen = 0;
hitboxes.InvalidateCache(); hitboxes.InvalidateCache();
m_bVisCheckComplete = false; m_bVisCheckComplete = false;
@ -31,10 +30,14 @@ inline CachedEntity::CachedEntity(u_int16_t idx) : m_IDX(idx), hitboxes(hitbox_c
#if PROXY_ENTITY != true #if PROXY_ENTITY != true
m_pEntity = nullptr; m_pEntity = nullptr;
#endif #endif
m_fLastUpdate = 0.0f;
} }
CachedEntity::~CachedEntity() inline CachedEntity::~CachedEntity()
{ {
if (player_info)
{
delete player_info;
player_info = 0;
}
} }
static settings::Float ve_window{ "debug.ve.window", "0" }; static settings::Float ve_window{ "debug.ve.window", "0" };
static settings::Boolean ve_smooth{ "debug.ve.smooth", "true" }; static settings::Boolean ve_smooth{ "debug.ve.smooth", "true" };
@ -75,6 +78,8 @@ void Update()
u_int16_t current_ents = g_IEntityList->NumberOfEntities(false); u_int16_t current_ents = g_IEntityList->NumberOfEntities(false);
valid_ents.clear(); // Reserving isn't necessary as this doesn't reallocate it valid_ents.clear(); // Reserving isn't necessary as this doesn't reallocate it
player_cache.clear(); player_cache.clear();
if (g_Settings.bInvalid)
return;
if (max >= MAX_ENTITIES) if (max >= MAX_ENTITIES)
max = MAX_ENTITIES - 1; max = MAX_ENTITIES - 1;
if (previous_max == max && previous_ent == current_ents) if (previous_max == max && previous_ent == current_ents)
@ -87,7 +92,7 @@ void Update()
valid_ents.emplace_back(&val); valid_ents.emplace_back(&val);
if (val.m_Type() == ENTITY_PLAYER) if (val.m_Type() == ENTITY_PLAYER)
{ {
GetPlayerInfo(val.m_IDX, &val.player_info); GetPlayerInfo(val.m_IDX, val.player_info);
if (val.m_bAlivePlayer()) [[likely]] if (val.m_bAlivePlayer()) [[likely]]
{ {
val.hitboxes.UpdateBones(); val.hitboxes.UpdateBones();
@ -104,7 +109,7 @@ void Update()
{ {
for (u_int16_t i = 0; i <= max; ++i) for (u_int16_t i = 0; i <= max; ++i)
{ {
if (g_Settings.bInvalid || !(g_IEntityList->GetClientEntity(i)) || !(g_IEntityList->GetClientEntity(i)->GetClientClass()->m_ClassID)) if (!g_IEntityList->GetClientEntity(i) || !g_IEntityList->GetClientEntity(i)->GetClientClass()->m_ClassID)
continue; continue;
CachedEntity &ent = array.try_emplace(i, CachedEntity{ i }).first->second; CachedEntity &ent = array.try_emplace(i, CachedEntity{ i }).first->second;
ent.Update(); ent.Update();
@ -113,7 +118,9 @@ void Update()
valid_ents.emplace_back(&ent); valid_ents.emplace_back(&ent);
if (ent.m_Type() == ENTITY_PLAYER) if (ent.m_Type() == ENTITY_PLAYER)
{ {
GetPlayerInfo(ent.m_IDX, &ent.player_info); if (!ent.player_info)
ent.player_info = new player_info_s;
GetPlayerInfo(ent.m_IDX, ent.player_info);
if (ent.m_bAlivePlayer()) [[likely]] if (ent.m_bAlivePlayer()) [[likely]]
{ {
ent.hitboxes.UpdateBones(); ent.hitboxes.UpdateBones();

View File

@ -1199,9 +1199,9 @@ bool Aim(CachedEntity *entity)
// Direct shots should just use normal vischeck // Direct shots should just use normal vischeck
if (30.0f < abs(z_vel)) if (30.0f < abs(z_vel))
{ {
float time = -1.0f * ((z_vel + fsqrt(z_vel * z_vel + 2.0f * diff * grav)) / grav); float time = -1.0f * ((z_vel + sqrt(z_vel * z_vel + 2.0f * diff * grav)) / grav);
if (!time) if (!time)
time = -1.0f * ((z_vel * fsqrt(z_vel * z_vel + 2 * (LOCAL_E->hitboxes.GetHitbox(14)->center.z - orig.z) * grav)) / grav); time = -1.0f * ((z_vel * sqrt(z_vel * z_vel + 2 * (LOCAL_E->hitboxes.GetHitbox(14)->center.z - orig.z) * grav)) / grav);
direction_vec *= time; direction_vec *= time;
direction_vec.z = z_vel * time + 0.5f * grav * time * time; direction_vec.z = z_vel * time + 0.5f * grav * time * time;
if (direction_vec.Length() * 1.2f < (orig.DistTo(entity->m_vecOrigin()))) if (direction_vec.Length() * 1.2f < (orig.DistTo(entity->m_vecOrigin())))
@ -1213,7 +1213,7 @@ bool Aim(CachedEntity *entity)
{ {
float pitch = ang.x * -1.0f; float pitch = ang.x * -1.0f;
float max_height = -1.0f * direction_vec.z * direction_vec.z * (sin(pitch) * sin(pitch)) / (2.0f * grav); float max_height = -1.0f * direction_vec.z * direction_vec.z * (sin(pitch) * sin(pitch)) / (2.0f * grav);
float time_2 = -1.0f * ((direction_vec.z + fsqrt(direction_vec.z * direction_vec.z + 2.0f * max_height * grav)) / grav); float time_2 = -1.0f * ((direction_vec.z + sqrt(direction_vec.z * direction_vec.z + 2.0f * max_height * grav)) / grav);
if (!time_2) if (!time_2)
return false; return false;
Vector res = direction_vec * time_2 + orig; Vector res = direction_vec * time_2 + orig;
@ -1689,8 +1689,7 @@ static void DrawText()
return; return;
for (auto const &ent : entity_cache::player_cache) for (auto const &ent : entity_cache::player_cache)
{ {
if (CE_GOOD(ent))
{
Vector screen; Vector screen;
Vector oscreen; Vector oscreen;
if (draw::WorldToScreen(cd.aim_position, screen) && draw::WorldToScreen(ent->m_vecOrigin(), oscreen)) if (draw::WorldToScreen(cd.aim_position, screen) && draw::WorldToScreen(ent->m_vecOrigin(), oscreen))
@ -1700,7 +1699,6 @@ static void DrawText()
} }
} }
} }
}
#endif #endif
void rvarCallback(settings::VariableBase<float> &, float after) void rvarCallback(settings::VariableBase<float> &, float after)
{ {

View File

@ -19,9 +19,9 @@ static inline void modifyAngles()
for (auto const &player : entity_cache::player_cache) for (auto const &player : entity_cache::player_cache)
{ {
if (CE_BAD(player) || !player->m_bAlivePlayer() || !player->m_bEnemy() || !player->player_info.friendsID) if (CE_BAD(player) || !player->m_bAlivePlayer() || !player->m_bEnemy() || !player->player_info->friendsID)
continue; continue;
auto &data = resolver_map[player->player_info.friendsID]; auto &data = resolver_map[player->player_info->friendsID];
auto &angle = CE_VECTOR(player, netvar.m_angEyeAngles); auto &angle = CE_VECTOR(player, netvar.m_angEyeAngles);
angle.x = data.new_angle.x; angle.x = data.new_angle.x;
angle.y = data.new_angle.y; angle.y = data.new_angle.y;
@ -142,9 +142,9 @@ static float resolveAnglePitch(float angle, brutedata &brute, CachedEntity *ent)
void increaseBruteNum(int idx) void increaseBruteNum(int idx)
{ {
auto ent = ENTITY(idx); auto ent = ENTITY(idx);
if (CE_BAD(ent) || !ent->player_info.friendsID) if (CE_BAD(ent) || !ent->player_info->friendsID)
return; return;
auto &data = hacks::shared::anti_anti_aim::resolver_map[ent->player_info.friendsID]; auto &data = hacks::shared::anti_anti_aim::resolver_map[ent->player_info->friendsID];
if (data.hits_in_a_row >= 4) if (data.hits_in_a_row >= 4)
data.hits_in_a_row = 2; data.hits_in_a_row = 2;
else if (data.hits_in_a_row >= 2) else if (data.hits_in_a_row >= 2)
@ -177,7 +177,7 @@ static void pitchHook(const CRecvProxyData *pData, void *pStruct, void *pOut)
auto client_ent = (IClientEntity *) (pStruct); auto client_ent = (IClientEntity *) (pStruct);
CachedEntity *ent = ENTITY(client_ent->entindex()); CachedEntity *ent = ENTITY(client_ent->entindex());
if (CE_GOOD(ent)) if (CE_GOOD(ent))
*flPitch_out = resolveAnglePitch(flPitch, resolver_map[ent->player_info.friendsID], ent); *flPitch_out = resolveAnglePitch(flPitch, resolver_map[ent->player_info->friendsID], ent);
} }
static void yawHook(const CRecvProxyData *pData, void *pStruct, void *pOut) static void yawHook(const CRecvProxyData *pData, void *pStruct, void *pOut)
@ -194,7 +194,7 @@ static void yawHook(const CRecvProxyData *pData, void *pStruct, void *pOut)
auto client_ent = (IClientEntity *) (pStruct); auto client_ent = (IClientEntity *) (pStruct);
CachedEntity *ent = ENTITY(client_ent->entindex()); CachedEntity *ent = ENTITY(client_ent->entindex());
if (CE_GOOD(ent)) if (CE_GOOD(ent))
*flYaw_out = resolveAngleYaw(flYaw, resolver_map[ent->player_info.friendsID]); *flYaw_out = resolveAngleYaw(flYaw, resolver_map[ent->player_info->friendsID]);
} }
// *_ptr points to what we need to modify while *_ProxyFn holds the old value // *_ptr points to what we need to modify while *_ProxyFn holds the old value

View File

@ -619,16 +619,16 @@ static void CreateMove()
{ {
CachedEntity *current_ent = ENTITY(CurrentHealingTargetIDX); CachedEntity *current_ent = ENTITY(CurrentHealingTargetIDX);
if (CE_GOOD(current_ent)) if (CE_GOOD(current_ent))
current_id = current_ent->player_info.friendsID; current_id = current_ent->player_info->friendsID;
} }
if (current_id != steamid) if (current_id != steamid)
{ {
for (auto const &ent : entity_cache::player_cache) for (auto const &ent : entity_cache::player_cache)
{ {
int i = ent->m_IDX; int i = ent->m_IDX;
if (!ent->player_info.friendsID) if (!ent->player_info->friendsID)
continue; continue;
if (ent->player_info.friendsID == steamid && CanHeal(i)) if (ent->player_info->friendsID == steamid && CanHeal(i))
{ {
CurrentHealingTargetIDX = i; CurrentHealingTargetIDX = i;
healing_steamid = true; healing_steamid = true;

View File

@ -67,7 +67,7 @@ static CatCommand steam_debug("debug_steamid", "Print steamids",
for (auto const &ent : entity_cache::player_cache) for (auto const &ent : entity_cache::player_cache)
{ {
logging::Info("%u", ent->player_info.friendsID); logging::Info("%u", ent->player_info->friendsID);
} }
}); });
@ -356,7 +356,7 @@ static void cm()
// Find a target with the steam id, as it is prioritized // Find a target with the steam id, as it is prioritized
if (steamid) if (steamid)
{ {
if (ENTITY(valid_target)->player_info.friendsID != steamid) if (ENTITY(valid_target)->player_info->friendsID != steamid)
{ {
for (auto const &entity : entity_cache::player_cache) for (auto const &entity : entity_cache::player_cache)
{ {
@ -364,7 +364,7 @@ static void cm()
if (!isValidTarget(entity)) if (!isValidTarget(entity))
continue; continue;
// No enemy check, since steamid is very specific // No enemy check, since steamid is very specific
if (steamid != entity->player_info.friendsID) // steamid check if (steamid != entity->player_info->friendsID) // steamid check
continue; continue;
if (startFollow(entity, isNavBotCM)) if (startFollow(entity, isNavBotCM))
{ {
@ -387,10 +387,10 @@ static void cm()
CSteamID steamid; CSteamID steamid;
pc->GetCurrentPartyLeader(steamid); pc->GetCurrentPartyLeader(steamid);
auto accountid = steamid.GetAccountID(); auto accountid = steamid.GetAccountID();
// if (steamid.GetAccountID() != ENTITY(follow_target)->player_info.friendsID) // if (steamid.GetAccountID() != ENTITY(follow_target)->player_info->friendsID)
// continue; // continue;
if (accountid != ENTITY(valid_target)->player_info.friendsID) if (accountid != ENTITY(valid_target)->player_info->friendsID)
{ {
for (auto const &entity : entity_cache::player_cache) for (auto const &entity : entity_cache::player_cache)
{ {
@ -399,7 +399,7 @@ static void cm()
continue; continue;
if (entity->m_bEnemy()) if (entity->m_bEnemy())
continue; continue;
if (accountid != entity->player_info.friendsID) if (accountid != entity->player_info->friendsID)
continue; continue;
if (startFollow(entity, isNavBotCM)) if (startFollow(entity, isNavBotCM))
{ {

View File

@ -57,7 +57,7 @@ void Paint()
int i = ent->m_IDX; int i = ent->m_IDX;
if (CE_BAD(ent)) if (CE_BAD(ent))
continue; continue;
if (ent->m_Type() != ENTITY_PLAYER || !ent->player_info.friendsID) if (ent->m_Type() != ENTITY_PLAYER || !ent->player_info->friendsID)
continue; continue;
// Update alive state // Update alive state
if (g_pPlayerResource->isAlive(i)) if (g_pPlayerResource->isAlive(i))
@ -121,7 +121,7 @@ void Paint()
if (i == g_IEngine->GetLocalPlayer()) if (i == g_IEngine->GetLocalPlayer())
color.b += 0.5f; color.b += 0.5f;
// tint CAT status people's names too // tint CAT status people's names too
if (playerlist::AccessData(ent->player_info.friendsID).state == playerlist::k_EState::CAT) if (playerlist::AccessData(ent->player_info->friendsID).state == playerlist::k_EState::CAT)
color.g = 0.8f; color.g = 0.8f;
// Calculate Player Level // Calculate Player Level
@ -132,9 +132,9 @@ void Paint()
level = max(level, 1); level = max(level, 1);
// String to draw, {Level} Cat for cathook users, else gotten from std::vector at random. // String to draw, {Level} Cat for cathook users, else gotten from std::vector at random.
if (choosen_entry[ent->player_info.friendsID].first == "" || choosen_entry[ent->player_info.friendsID].second != level) if (choosen_entry[ent->player_info->friendsID].first == "" || choosen_entry[ent->player_info->friendsID].second != level)
choosen_entry[ent->player_info.friendsID] = { random_mafia_entry(level, ent->player_info.friendsID), level }; choosen_entry[ent->player_info->friendsID] = { random_mafia_entry(level, ent->player_info->friendsID), level };
std::string to_display = (playerlist::AccessData(ent->player_info.friendsID).state == playerlist::k_EState::CAT ? format("Lv.", level, " Cat") : format("Lv.", level, " ", choosen_entry[ent->player_info.friendsID].first)); std::string to_display = (playerlist::AccessData(ent->player_info->friendsID).state == playerlist::k_EState::CAT ? format("Lv.", level, " Cat") : format("Lv.", level, " ", choosen_entry[ent->player_info->friendsID].first));
// Clamp to prevent oob // Clamp to prevent oob
color.g -= (float) (g_GlobalVars->curtime - death_timer[i]) / (3.0f); color.g -= (float) (g_GlobalVars->curtime - death_timer[i]) / (3.0f);

View File

@ -87,7 +87,7 @@ inline std::optional<rgba_t> getColor(CachedEntity *ent)
else else
{ {
auto state = playerlist::AccessData(ent->player_info.friendsID); auto state = playerlist::AccessData(ent->player_info->friendsID);
if (state.state == playerlist::k_EState::DEFAULT) if (state.state == playerlist::k_EState::DEFAULT)
{ {
if (!ent->m_vecDormantOrigin()) if (!ent->m_vecDormantOrigin())
@ -102,7 +102,7 @@ inline std::optional<rgba_t> getColor(CachedEntity *ent)
else if (*coloring_mode == 1) else if (*coloring_mode == 1)
return colors::EntityF(ent); return colors::EntityF(ent);
} }
if (!player_tools::shouldTargetSteamId(ent->player_info.friendsID)) if (!player_tools::shouldTargetSteamId(ent->player_info->friendsID))
{ {
if (*draw_friendlies == 1) if (*draw_friendlies == 1)
{ {
@ -115,7 +115,7 @@ inline std::optional<rgba_t> getColor(CachedEntity *ent)
} }
if (!ent->m_bEnemy()) if (!ent->m_bEnemy())
return std::nullopt; return std::nullopt;
return playerlist::Color(ent->player_info.friendsID); return playerlist::Color(ent->player_info->friendsID);
} }
} }

View File

@ -880,7 +880,6 @@ bool isRapidFire(IClientEntity *wep)
return ret || wep->GetClientClass()->m_ClassID == CL_CLASS(CTFMinigun); return ret || wep->GetClientClass()->m_ClassID == CL_CLASS(CTFMinigun);
} }
char GetUpperChar(ButtonCode_t button) char GetUpperChar(ButtonCode_t button)
{ {
switch (button) switch (button)
@ -1195,7 +1194,6 @@ float ProjGravMult(int class_id, float x_speed)
return 0.0f; return 0.0f;
default: default:
return 0.3f; return 0.3f;
} }
} }
weaponmode GetWeaponMode(CachedEntity *ent) weaponmode GetWeaponMode(CachedEntity *ent)
@ -1692,8 +1690,6 @@ float ATTRIB_HOOK_FLOAT(float base_value, const char *search_string, IClientEnti
return AttribHookFloat_fn(base_value, search_string, ent, buffer, is_global_const_string); return AttribHookFloat_fn(base_value, search_string, ent, buffer, is_global_const_string);
} }
void AimAt(Vector origin, Vector target, CUserCmd *cmd, bool compensate_punch) void AimAt(Vector origin, Vector target, CUserCmd *cmd, bool compensate_punch)
{ {
cmd->viewangles = GetAimAtAngles(origin, target, compensate_punch ? LOCAL_E : nullptr); cmd->viewangles = GetAimAtAngles(origin, target, compensate_punch ? LOCAL_E : nullptr);
@ -1976,7 +1972,6 @@ int SharedRandomInt(unsigned iseed, const char *sharedname, int iMinVal, int iMa
return g_pUniformStream->RandomInt(iMinVal, iMaxVal); return g_pUniformStream->RandomInt(iMinVal, iMaxVal);
} }
int GetPlayerForUserID(int userID) int GetPlayerForUserID(int userID)
{ {
for (auto const &ent : entity_cache::player_cache) for (auto const &ent : entity_cache::player_cache)

View File

@ -87,7 +87,7 @@ void OnHit(bool crit, int idx, bool is_sniper)
auto ent = ENTITY(idx); auto ent = ENTITY(idx);
if (CE_GOOD(ent)) if (CE_GOOD(ent))
{ {
hacks::shared::anti_anti_aim::resolver_map[ent->player_info.friendsID].hits_in_a_row++; hacks::shared::anti_anti_aim::resolver_map[ent->player_info->friendsID].hits_in_a_row++;
resolve_soon[idx] = false; resolve_soon[idx] = false;
} }
} }

View File

@ -185,7 +185,7 @@ static InitRoutine init(
if (new_val != 0) if (new_val != 0)
{ {
std::string new_name = GetNamestealName(g_ISteamUser->GetSteamID()); std::string new_name = GetNamestealName(g_ISteamUser->GetSteamID());
if (CE_BAD(LOCAL_E) || new_name.empty() || !strcmp(LOCAL_E->player_info.name, new_name.c_str())) if (CE_BAD(LOCAL_E) || new_name.empty() || !strcmp(LOCAL_E->player_info->name, new_name.c_str()))
return; return;
netvar_name = std::move(new_name); netvar_name = std::move(new_name);
NET_SetConVar setname("name", netvar_name.c_str()); NET_SetConVar setname("name", netvar_name.c_str());
@ -231,7 +231,7 @@ static void cm()
if (CE_BAD(LOCAL_E) || new_name.empty()) if (CE_BAD(LOCAL_E) || new_name.empty())
return; return;
// Didn't change name - update timer a bit // Didn't change name - update timer a bit
if (!strcmp(LOCAL_E->player_info.name, new_name.c_str())) if (!strcmp(LOCAL_E->player_info->name, new_name.c_str()))
{ {
set_name.last -= std::chrono::seconds(170); set_name.last -= std::chrono::seconds(170);
return; return;

View File

@ -132,7 +132,7 @@ rgba_t Color(unsigned steamid)
rgba_t Color(CachedEntity *player) rgba_t Color(CachedEntity *player)
{ {
if (CE_GOOD(player)) if (CE_GOOD(player))
return Color(player->player_info.friendsID); return Color(player->player_info->friendsID);
return colors::empty; return colors::empty;
} }
#endif #endif
@ -144,8 +144,8 @@ userdata &AccessData(unsigned steamid)
// Assume player is non-null // Assume player is non-null
userdata &AccessData(CachedEntity *player) userdata &AccessData(CachedEntity *player)
{ {
if (player && player->player_info.friendsID) if (player && player->player_info->friendsID)
return AccessData(player->player_info.friendsID); return AccessData(player->player_info->friendsID);
return AccessData(0U); return AccessData(0U);
} }
@ -160,8 +160,8 @@ bool IsDefault(unsigned steamid)
bool IsDefault(CachedEntity *entity) bool IsDefault(CachedEntity *entity)
{ {
if (entity && entity->player_info.friendsID) if (entity && entity->player_info->friendsID)
return IsDefault(entity->player_info.friendsID); return IsDefault(entity->player_info->friendsID);
return true; return true;
} }
@ -173,8 +173,8 @@ bool IsFriend(unsigned steamid)
bool IsFriend(CachedEntity *entity) bool IsFriend(CachedEntity *entity)
{ {
if (entity && entity->player_info.friendsID) if (entity && entity->player_info->friendsID)
return IsFriend(entity->player_info.friendsID); return IsFriend(entity->player_info->friendsID);
return false; return false;
} }
@ -238,8 +238,8 @@ bool ChangeState(unsigned int steamid, k_EState state, bool force)
bool ChangeState(CachedEntity *entity, k_EState state, bool force) bool ChangeState(CachedEntity *entity, k_EState state, bool force)
{ {
if (entity && entity->player_info.friendsID) if (entity && entity->player_info->friendsID)
return ChangeState(entity->player_info.friendsID, state, force); return ChangeState(entity->player_info->friendsID, state, force);
return false; return false;
} }