minor changes to crit system, cat_crit_info now shows accurate bucket
values
This commit is contained in:
parent
e86606867f
commit
9bb30739ab
@ -18,6 +18,7 @@ int* g_PredictionRandomSeed = nullptr;
|
|||||||
bool AllowAttacking() {
|
bool AllowAttacking() {
|
||||||
if (!(hacks::shared::misc::crit_hack || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee)) && !hacks::shared::misc::crit_suppress) return true;
|
if (!(hacks::shared::misc::crit_hack || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee)) && !hacks::shared::misc::crit_suppress) return true;
|
||||||
bool crit = IsAttackACrit(g_pUserCmd);
|
bool crit = IsAttackACrit(g_pUserCmd);
|
||||||
|
LoadSavedState();
|
||||||
if (hacks::shared::misc::crit_suppress && !(hacks::shared::misc::crit_hack || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee))) {
|
if (hacks::shared::misc::crit_suppress && !(hacks::shared::misc::crit_hack || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee))) {
|
||||||
if (crit && !IsPlayerCritBoosted(LOCAL_E)) {
|
if (crit && !IsPlayerCritBoosted(LOCAL_E)) {
|
||||||
return false;
|
return false;
|
||||||
@ -57,7 +58,7 @@ void crithack_saved_state::Save(IClientEntity* entity) {
|
|||||||
unknown2620 = *(int*)((uintptr_t)entity + 2620);
|
unknown2620 = *(int*)((uintptr_t)entity + 2620);
|
||||||
unknown2856 = *(float*)((uintptr_t)entity + 2856);
|
unknown2856 = *(float*)((uintptr_t)entity + 2856);
|
||||||
unknown2860 = *(float*)((uintptr_t)entity + 2860);
|
unknown2860 = *(float*)((uintptr_t)entity + 2860);
|
||||||
}
|
}
|
||||||
|
|
||||||
static crithack_saved_state state;
|
static crithack_saved_state state;
|
||||||
static bool state_saved { false };
|
static bool state_saved { false };
|
||||||
@ -109,12 +110,17 @@ bool IsAttackACrit(CUserCmd* cmd) {
|
|||||||
int md5seed = MD5_PseudoRandom(cmd->command_number) & 0x7fffffff;
|
int md5seed = MD5_PseudoRandom(cmd->command_number) & 0x7fffffff;
|
||||||
int rseed = md5seed;
|
int rseed = md5seed;
|
||||||
//float bucket = *(float*)((uintptr_t)RAW_ENT(LOCAL_W) + 2612u);
|
//float bucket = *(float*)((uintptr_t)RAW_ENT(LOCAL_W) + 2612u);
|
||||||
|
|
||||||
*g_PredictionRandomSeed = md5seed;
|
*g_PredictionRandomSeed = md5seed;
|
||||||
int c = LOCAL_W->m_IDX << 8;
|
int c = LOCAL_W->m_IDX << 8;
|
||||||
int b = LOCAL_E->m_IDX;
|
int b = LOCAL_E->m_IDX;
|
||||||
rseed = rseed ^ (b | c);
|
rseed = rseed ^ (b | c);
|
||||||
RandomSeed(rseed);
|
RandomSeed(rseed);
|
||||||
|
if (GetWeaponMode(LOCAL_E) == weapon_melee) {
|
||||||
|
*(float*)((uintptr_t)RAW_ENT(LOCAL_W) + 2612u) = 1000.0f;
|
||||||
|
}
|
||||||
state.Save(weapon);
|
state.Save(weapon);
|
||||||
|
|
||||||
state_saved = true;
|
state_saved = true;
|
||||||
//float saved_time = *(float*)(weapon + 2872ul);
|
//float saved_time = *(float*)(weapon + 2872ul);
|
||||||
//*(float*)(weapon + 2872ul) = 0.0f;
|
//*(float*)(weapon + 2872ul) = 0.0f;
|
||||||
|
@ -182,6 +182,27 @@ void CreateMove() {
|
|||||||
if (!AllowAttacking()) g_pUserCmd->buttons &= ~IN_ATTACK;
|
if (!AllowAttacking()) g_pUserCmd->buttons &= ~IN_ATTACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CE_GOOD(LOCAL_W)) {
|
||||||
|
IClientEntity* weapon = RAW_ENT(LOCAL_W);
|
||||||
|
float& bucket = *(float*)((uintptr_t)(weapon) + 2612);
|
||||||
|
static float last_bucket = 0.0f;
|
||||||
|
static IClientEntity* last_weapon = weapon;
|
||||||
|
static bool changed = false;
|
||||||
|
if (g_pUserCmd->command_number) {
|
||||||
|
changed = false;
|
||||||
|
}
|
||||||
|
if (bucket != last_bucket) {
|
||||||
|
if (changed && weapon == last_weapon) {
|
||||||
|
bucket = last_bucket;
|
||||||
|
} else {
|
||||||
|
//logging::Info("db: %.2f", g_pUserCmd->command_number, bucket - last_bucket);
|
||||||
|
}
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
last_weapon = weapon;
|
||||||
|
last_bucket = bucket;
|
||||||
|
}
|
||||||
|
|
||||||
if (flashlight_spam) {
|
if (flashlight_spam) {
|
||||||
if (flswitch && !g_pUserCmd->impulse) g_pUserCmd->impulse = 100;
|
if (flswitch && !g_pUserCmd->impulse) g_pUserCmd->impulse = 100;
|
||||||
flswitch = !flswitch;
|
flswitch = !flswitch;
|
||||||
|
Reference in New Issue
Block a user