small crits update

This commit is contained in:
nullifiedcat 2017-11-28 19:35:35 +03:00
parent 506df2cccb
commit 441066f5a4

View File

@ -24,11 +24,14 @@ int find_next_random_crit_for_weapon(IClientEntity *weapon)
number = g_pUserCmd->command_number,
found = 0,
seed,
seed_md5;
seed_md5,
seed_backup;
crithack_saved_state state;
state.Save(weapon);
seed_backup = *g_PredictionRandomSeed;
while (!found && tries < 4096)
{
seed_md5 = MD5_PseudoRandom(number) & 0x7FFFFFFF;
@ -41,6 +44,7 @@ int find_next_random_crit_for_weapon(IClientEntity *weapon)
++number;
}
*g_PredictionRandomSeed = seed_backup;
state.Load(weapon);
if (found)
return number;
@ -83,7 +87,7 @@ bool force_crit(IClientEntity *weapon)
{
if (cached_calculation.init_command > g_pUserCmd->command_number ||
g_pUserCmd->command_number - cached_calculation.init_command > 4096 ||
cached_calculation.command_number < g_pUserCmd->command_number)
(g_pUserCmd->command_number && (cached_calculation.command_number < g_pUserCmd->command_number)))
cached_calculation.weapon_entity = 0;
if (cached_calculation.weapon_entity == weapon->entindex())
return bool(cached_calculation.command_number);