Fix crashes caused by tf2 update and fix punch angle
This commit is contained in:
parent
59a0e4b8a4
commit
2e5a2ae82f
@ -42,19 +42,19 @@ public:
|
|||||||
}
|
}
|
||||||
void Load(IClientEntity *weapon)
|
void Load(IClientEntity *weapon)
|
||||||
{
|
{
|
||||||
crit_bucket = *(float *) ((uintptr_t) weapon + 0xa38);
|
crit_bucket = *(float *) ((uintptr_t) weapon + 0xa3c);
|
||||||
weapon_seed = *(unsigned int *) ((uintptr_t) weapon + 0xb3c);
|
weapon_seed = *(unsigned int *) ((uintptr_t) weapon + 0xb40);
|
||||||
unknown1 = *(unsigned int *) ((uintptr_t) weapon + 0xb30);
|
unknown1 = *(unsigned int *) ((uintptr_t) weapon + 0xb34);
|
||||||
unknown2 = *(unsigned int *) ((uintptr_t) weapon + 0xb34);
|
unknown2 = *(unsigned int *) ((uintptr_t) weapon + 0xb38);
|
||||||
unknown3 = *(bool *) ((uintptr_t) weapon + 0xb17);
|
unknown3 = *(bool *) ((uintptr_t) weapon + 0xb1b);
|
||||||
m_flCritTime = *(float *) ((uintptr_t) weapon + 0xb40);
|
m_flCritTime = *(float *) ((uintptr_t) weapon + 0xb44);
|
||||||
crit_attempts = *(int *) ((uintptr_t) weapon + 0xa3c);
|
crit_attempts = *(int *) ((uintptr_t) weapon + 0xa40);
|
||||||
crit_count = *(int *) ((uintptr_t) weapon + 0xa40);
|
crit_count = *(int *) ((uintptr_t) weapon + 0xa44);
|
||||||
observed_crit_chance = *(float *) ((uintptr_t) weapon + 0xbfc);
|
observed_crit_chance = *(float *) ((uintptr_t) weapon + 0xc00);
|
||||||
unknown7 = *(bool *) ((uintptr_t) weapon + 0xb18);
|
unknown7 = *(bool *) ((uintptr_t) weapon + 0xb1c);
|
||||||
// No need to restore
|
// No need to restore
|
||||||
weapon_mode = *(int *) ((uintptr_t) weapon + 0xb04);
|
weapon_mode = *(int *) ((uintptr_t) weapon + 0xb08);
|
||||||
weapon_data = *(int *) ((uintptr_t) weapon + 0xb10);
|
weapon_data = *(int *) ((uintptr_t) weapon + 0xb14);
|
||||||
}
|
}
|
||||||
weapon_info(IClientEntity *weapon)
|
weapon_info(IClientEntity *weapon)
|
||||||
{
|
{
|
||||||
@ -62,16 +62,16 @@ public:
|
|||||||
}
|
}
|
||||||
void restore_data(IClientEntity *weapon)
|
void restore_data(IClientEntity *weapon)
|
||||||
{
|
{
|
||||||
*(float *) ((uintptr_t) weapon + 0xa38) = crit_bucket;
|
*(float *) ((uintptr_t) weapon + 0xa3c) = crit_bucket;
|
||||||
*(unsigned int *) ((uintptr_t) weapon + 0xb3c) = weapon_seed;
|
*(unsigned int *) ((uintptr_t) weapon + 0xb40) = weapon_seed;
|
||||||
*(unsigned int *) ((uintptr_t) weapon + 0xb30) = unknown1;
|
*(unsigned int *) ((uintptr_t) weapon + 0xb34) = unknown1;
|
||||||
*(unsigned int *) ((uintptr_t) weapon + 0xb34) = unknown2;
|
*(unsigned int *) ((uintptr_t) weapon + 0xb38) = unknown2;
|
||||||
*(bool *) ((uintptr_t) weapon + 0xb17) = unknown3;
|
*(bool *) ((uintptr_t) weapon + 0xb1b) = unknown3;
|
||||||
*(float *) ((uintptr_t) weapon + 0xb40) = m_flCritTime;
|
*(float *) ((uintptr_t) weapon + 0xb44) = m_flCritTime;
|
||||||
*(int *) ((uintptr_t) weapon + 0xa3c) = crit_attempts;
|
*(int *) ((uintptr_t) weapon + 0xa40) = crit_attempts;
|
||||||
*(int *) ((uintptr_t) weapon + 0xa40) = crit_count;
|
*(int *) ((uintptr_t) weapon + 0xa44) = crit_count;
|
||||||
*(float *) ((uintptr_t) weapon + 0xbfc) = observed_crit_chance;
|
*(float *) ((uintptr_t) weapon + 0xc00) = observed_crit_chance;
|
||||||
*(bool *) ((uintptr_t) weapon + 0xb18) = unknown7;
|
*(bool *) ((uintptr_t) weapon + 0xb1c) = unknown7;
|
||||||
}
|
}
|
||||||
bool operator==(const weapon_info &B) const
|
bool operator==(const weapon_info &B) const
|
||||||
{
|
{
|
||||||
|
@ -1157,6 +1157,24 @@ static CatCommand debug_print_crit_info("debug_print_crit_info", "Print a bunch
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
static CatCommand debug_data("debug_data", "debug",
|
||||||
|
[]()
|
||||||
|
{
|
||||||
|
IClientEntity *wep = RAW_ENT(LOCAL_W);
|
||||||
|
weapon_info info(wep);
|
||||||
|
logging::Info("%f", info.crit_bucket);
|
||||||
|
logging::Info("%d", info.weapon_seed);
|
||||||
|
logging::Info("%d", info.unknown1);
|
||||||
|
logging::Info("%d", info.unknown2);
|
||||||
|
logging::Info("%d", info.unknown3);
|
||||||
|
logging::Info("%f", info.m_flCritTime);
|
||||||
|
logging::Info("%d", info.crit_attempts);
|
||||||
|
logging::Info("%d", info.crit_count);
|
||||||
|
logging::Info("%f", info.observed_crit_chance);
|
||||||
|
logging::Info("%d", info.unknown7);
|
||||||
|
logging::Info("%d", info.weapon_mode);
|
||||||
|
logging::Info("%d", info.weapon_data);
|
||||||
|
});
|
||||||
static InitRoutine init(
|
static InitRoutine init(
|
||||||
[]()
|
[]()
|
||||||
{
|
{
|
||||||
|
@ -1118,7 +1118,7 @@ void Aim(CachedEntity *entity)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Get angles from eye to target
|
// Get angles from eye to target
|
||||||
Vector angles = GetAimAtAngles(g_pLocalPlayer->v_Eye, PredictEntity(entity, false));
|
Vector angles = GetAimAtAngles(g_pLocalPlayer->v_Eye, PredictEntity(entity, false), LOCAL_E);
|
||||||
|
|
||||||
// Slow aim
|
// Slow aim
|
||||||
if (slow_aim)
|
if (slow_aim)
|
||||||
|
@ -1104,7 +1104,7 @@ static InitRoutine init(
|
|||||||
|
|
||||||
static BytePatch stealth_kill{ gSignatures.GetClientSignature, "84 C0 75 28 A1", 2, { 0x90, 0x90 } }; // stealth kill patch
|
static BytePatch stealth_kill{ gSignatures.GetClientSignature, "84 C0 75 28 A1", 2, { 0x90, 0x90 } }; // stealth kill patch
|
||||||
stealth_kill.Patch();
|
stealth_kill.Patch();
|
||||||
static BytePatch cyoa_patch{ gSignatures.GetClientSignature, "74 20 A1 ? ? ? ? 8B 10 C7 44 24 ? ? ? ? ? 89 04 24", 0, { 0xEB } };
|
static BytePatch cyoa_patch{ gSignatures.GetClientSignature, "75 ? 80 BB ? ? ? ? 00 74 ? A1 ? ? ? ? 8B 10 C7 44 24", 0, { 0xEB } };
|
||||||
cyoa_patch.Patch();
|
cyoa_patch.Patch();
|
||||||
EC::Register(
|
EC::Register(
|
||||||
EC::Shutdown,
|
EC::Shutdown,
|
||||||
|
@ -1515,7 +1515,7 @@ Vector GetForwardVector(Vector origin, Vector viewangles, float distance, Cached
|
|||||||
QAngle angle = VectorToQAngle(viewangles);
|
QAngle angle = VectorToQAngle(viewangles);
|
||||||
// Compensate for punch angle
|
// Compensate for punch angle
|
||||||
if (punch_entity && should_correct_punch)
|
if (punch_entity && should_correct_punch)
|
||||||
angle += VectorToQAngle(CE_VECTOR(punch_entity, netvar.vecPunchAngle));
|
angle -= VectorToQAngle(CE_VECTOR(punch_entity, netvar.vecPunchAngle));
|
||||||
|
|
||||||
sy = sinf(DEG2RAD(angle[1]));
|
sy = sinf(DEG2RAD(angle[1]));
|
||||||
cy = cosf(DEG2RAD(angle[1]));
|
cy = cosf(DEG2RAD(angle[1]));
|
||||||
|
Reference in New Issue
Block a user