-
Автор темы
- #1
pred.cpp
pred.hpp
Код:
#include "prediction_system.h"
void engineprediction::FixNetvarCompression(int time)
{
auto data = &netvars_data[time % MULTIPLAYER_BACKUP];
if (data->tickbase != g_ctx.local()->m_nTickBase())
return;
data->tickbase = g_ctx.local()->m_nTickBase();
data->m_vecOrigin = g_ctx.local()->m_vecOrigin();
data->m_aimPunchAngle = g_ctx.local()->m_aimPunchAngle();
data->m_aimPunchAngleVel = g_ctx.local()->m_aimPunchAngleVel();
data->m_viewPunchAngle = g_ctx.local()->m_viewPunchAngle();
data->m_vecViewOffset = g_ctx.local()->m_vecViewOffset();
data->m_flDuckAmount = g_ctx.local()->m_flDuckAmount();
data->m_flDuckSpeed = g_ctx.local()->m_flDuckSpeed();
data->m_flFallVelocity = g_ctx.local()->m_flFallVelocity();
data->m_flVelocityModifier = g_ctx.local()->m_flVelocityModifier();
const auto aim_punch_vel_diff = data->m_aimPunchAngleVel - g_ctx.local()->m_aimPunchAngleVel();
const auto aim_punch_diff = data->m_aimPunchAngle - g_ctx.local()->m_aimPunchAngle();
const auto viewpunch_diff = data->m_viewPunchAngle.x - g_ctx.local()->m_viewPunchAngle().x;
const auto velocity_diff = data->m_vecVelocity - g_ctx.local()->m_vecVelocity();
const auto origin_diff = data->m_vecOrigin - g_ctx.local()->m_vecOrigin();
if (std::abs(aim_punch_diff.x) <= 0.03125f && std::abs(aim_punch_diff.y) <= 0.03125f && std::abs(aim_punch_diff.z) <= 0.03125f)
g_ctx.local()->m_aimPunchAngle() = data->m_aimPunchAngle;
if (std::abs(aim_punch_vel_diff.x) <= 0.03125f && std::abs(aim_punch_vel_diff.y) <= 0.03125f && std::abs(aim_punch_vel_diff.z) <= 0.03125f)
g_ctx.local()->m_aimPunchAngleVel() = data->m_aimPunchAngleVel;
if (std::abs(g_ctx.local()->m_vecViewOffset().z - data->m_vecViewOffset.z) <= 0.25f)
g_ctx.local()->m_vecViewOffset().z = data->m_vecViewOffset.z;
if (std::abs(viewpunch_diff) <= 0.03125f)
g_ctx.local()->m_viewPunchAngle().x = data->m_viewPunchAngle.x;
if (abs(g_ctx.local()->m_flDuckAmount() - data->m_flDuckAmount) <= 0.03125f)
g_ctx.local()->m_flDuckAmount() = data->m_flDuckAmount;
if (std::abs(velocity_diff.x) <= 0.03125f && std::abs(velocity_diff.y) <= 0.03125f && std::abs(velocity_diff.z) <= 0.03125f)
g_ctx.local()->m_vecVelocity() = data->m_vecVelocity;
if (abs(origin_diff.x) <= 0.03125f && abs(origin_diff.y) <= 0.03125f && abs(origin_diff.z) <= 0.03125f) {
g_ctx.local()->m_vecOrigin() = data->m_vecOrigin;
g_ctx.local()->set_abs_origin(data->m_vecOrigin);
}
if (abs(g_ctx.local()->m_flDuckSpeed() - data->m_flDuckSpeed) <= 0.03125f)
g_ctx.local()->m_flDuckSpeed() = data->m_flDuckSpeed;
if (abs(g_ctx.local()->m_flFallVelocity() - data->m_flFallVelocity) <= 0.03125f)
g_ctx.local()->m_flFallVelocity() = data->m_flFallVelocity;
if (std::abs(g_ctx.local()->m_flVelocityModifier() - data->m_flVelocityModifier) <= 0.00625f)
g_ctx.local()->m_flVelocityModifier() = data->m_flVelocityModifier;
}
/*void engineprediction::store_netvars()
{
auto data = &netvars_data[m_clientstate()->iCommandAck % MULTIPLAYER_BACKUP]; //-V807
data->tickbase = g_ctx.local()->m_nTickBase(); //-V807
data->m_aimPunchAngle = g_ctx.local()->m_aimPunchAngle();
data->m_aimPunchAngleVel = g_ctx.local()->m_aimPunchAngleVel();
data->m_viewPunchAngle = g_ctx.local()->m_viewPunchAngle();
data->m_vecViewOffset = g_ctx.local()->m_vecViewOffset();
data->m_duckAmount = g_ctx.local()->m_flDuckAmount();
data->m_duckSpeed = g_ctx.local()->m_flDuckSpeed();
data->m_origin = g_ctx.local()->m_vecOrigin();
data->m_velocity = g_ctx.local()->m_vecVelocity();
data->m_fall_velocity = g_ctx.local()->m_flFallVelocity();
data->m_velocity_modifier = g_ctx.local()->m_flVelocityModifier();
}
void engineprediction::store_data()
{
int tickbase;
StoredData_t* data;
if (!g_ctx.local() && !g_ctx.local()->is_alive())
{
reset_data();
return;
}
tickbase = g_ctx.local()->m_nTickBase();
data = &m_data[tickbase % MULTIPLAYER_BACKUP];
data->m_tickbase = tickbase;
data->m_punch = g_ctx.local()->m_aimPunchAngle();
data->m_punch_vel = g_ctx.local()->m_aimPunchAngleVel();
data->m_view_offset = g_ctx.local()->m_vecViewOffset();
data->m_velocity_modifier = g_ctx.local()->m_flVelocityModifier();
}*/
void engineprediction::reset_data()
{
m_data.fill(StoredData_t());
}
/*void engineprediction::restore_netvars()
{
auto m_flRecoilIndex = 0;
auto m_flAccuracyPenalty = 0;
auto data = &netvars_data[(m_clientstate()->iCommandAck - 1) % MULTIPLAYER_BACKUP]; //-V807
if (data->tickbase != g_ctx.local()->m_nTickBase()) //-V807
return;
auto aim_punch_angle_delta = g_ctx.local()->m_aimPunchAngle() - data->m_aimPunchAngle;
auto aim_punch_angle_vel_delta = g_ctx.local()->m_aimPunchAngleVel() - data->m_aimPunchAngleVel;
auto view_punch_angle_delta = g_ctx.local()->m_viewPunchAngle() - data->m_viewPunchAngle;
auto view_offset_delta = g_ctx.local()->m_vecViewOffset() - data->m_vecViewOffset;
auto duck_amount = g_ctx.local()->m_flDuckAmount() - data->m_duckAmount;
const auto velocity_diff = data->m_velocity - g_ctx.local()->m_vecVelocity();
const auto origin_diff = data->m_origin - g_ctx.local()->m_vecOrigin();
if (fabs(aim_punch_angle_delta.x) < 0.03125f && fabs(aim_punch_angle_delta.y) < 0.03125f && fabs(aim_punch_angle_delta.z) < 0.03125f)
g_ctx.local()->m_aimPunchAngle() = data->m_aimPunchAngle;
if (fabs(aim_punch_angle_vel_delta.x) < 0.03125f && fabs(aim_punch_angle_vel_delta.y) < 0.03125f && fabs(aim_punch_angle_vel_delta.z) < 0.03125f)
g_ctx.local()->m_aimPunchAngleVel() = data->m_aimPunchAngleVel;
if (fabs(view_punch_angle_delta.x) < 0.03125f && fabs(view_punch_angle_delta.y) < 0.03125f && fabs(view_punch_angle_delta.z) < 0.03125f)
g_ctx.local()->m_viewPunchAngle() = data->m_viewPunchAngle;
if (fabs(view_offset_delta.x) < 0.03125f && fabs(view_offset_delta.y) < 0.03125f && fabs(view_offset_delta.z) < 0.03125f)
g_ctx.local()->m_vecViewOffset() = data->m_vecViewOffset;
if (fabs(duck_amount) < 0.03125f)
{
g_ctx.local()->m_flDuckAmount() = data->m_duckAmount;
g_ctx.local()->m_flDuckSpeed() = data->m_duckSpeed;
}
if (abs(g_ctx.local()->m_flFallVelocity() - data->m_fall_velocity) <= 0.03125f)
g_ctx.local()->m_flFallVelocity() = data->m_fall_velocity;
if (std::abs(g_ctx.local()->m_flVelocityModifier() - data->m_velocity_modifier) <= 0.00625f)
g_ctx.local()->m_flVelocityModifier() = data->m_velocity_modifier;
}*/
void engineprediction::update_incoming_sequences()
{
if (!m_clientstate()->pNetChannel)
return;
if (m_sequence.empty() || m_clientstate()->pNetChannel->m_nInSequenceNr > m_sequence.front().m_seq) {
// store new stuff.
m_sequence.emplace_front(m_globals()->m_realtime, m_clientstate()->pNetChannel->m_nInReliableState, m_clientstate()->pNetChannel->m_nInSequenceNr);
}
// do not save too many of these.
while (m_sequence.size() > 2048)
m_sequence.pop_back();
}
void engineprediction::update_vel()
{
static int m_iLastCmdAck = 0;
static float m_flNextCmdTime = 0.f;
if (m_clientstate() && (m_iLastCmdAck != m_clientstate()->nLastCommandAck || m_flNextCmdTime != m_clientstate()->flNextCmdTime))
{
if (g_ctx.globals.last_velocity_modifier != g_ctx.local()->m_flVelocityModifier())
{
*reinterpret_cast<int*>(reinterpret_cast<uintptr_t>(m_prediction() + 0x24)) = 1;
g_ctx.globals.last_velocity_modifier = g_ctx.local()->m_flVelocityModifier();
}
m_iLastCmdAck = m_clientstate()->nLastCommandAck;
m_flNextCmdTime = m_clientstate()->flNextCmdTime;
}
}
void engineprediction::setup()
{
if (prediction_data.prediction_stage != SETUP)
return;
if (!prediction_data.sv_footsteps)
prediction_data.sv_footsteps = m_cvar()->FindVar(crypt_str("sv_footsteps"));
if (!prediction_data.sv_min_jump_landing_sound)
prediction_data.sv_min_jump_landing_sound = m_cvar()->FindVar(crypt_str("sv_min_jump_landing_sound"));
backup_data.flags = g_ctx.local()->m_fFlags(); //-V807
backup_data.velocity = g_ctx.local()->m_vecVelocity();
backup_data.sv_footsteps_backup = *(float*)(uintptr_t(prediction_data.sv_footsteps) + 0x2C);
backup_data.sv_min_jump_landing_sound_backup = *(float*)(uintptr_t(prediction_data.sv_min_jump_landing_sound) + 0x2C);
prediction_data.old_curtime = m_globals()->m_curtime; //-V807
prediction_data.old_frametime = m_globals()->m_frametime;
m_globals()->m_curtime = TICKS_TO_TIME(g_ctx.globals.fixed_tickbase);
m_globals()->m_frametime = m_prediction()->EnginePaused ? 0.0f : m_globals()->m_intervalpertick;
prediction_data.prediction_stage = PREDICT;
}
void engineprediction::predict(CUserCmd* m_pcmd)
{
if (prediction_data.prediction_stage != PREDICT)
return;
bool prediction_need_to_recount = false;
if (m_clientstate()->iDeltaTick > 0) {
m_prediction()->Update(
m_clientstate()->iDeltaTick,
m_clientstate()->iDeltaTick > 1,
m_clientstate()->nLastCommandAck,
m_clientstate()->nLastOutgoingCommand + m_clientstate()->iChokedCommands);
}
if (prediction_need_to_recount) { // predict recount compression.
*(int*)((uintptr_t)m_prediction() + 0x1C) = 0;
*(bool*)((uintptr_t)m_prediction() + 0x24) = true;
}
// backup footsteps.
const auto backup_footsteps = backup_data.sv_footsteps_backup;
float value = 0.0f;
if (prediction_data.sv_footsteps)
*(float*)(uintptr_t(prediction_data.sv_footsteps) + 0x2C) = (uint32_t)prediction_data.sv_footsteps ^ uint32_t(value);
if (prediction_data.sv_min_jump_landing_sound)
*(float*)(uintptr_t(prediction_data.sv_min_jump_landing_sound) + 0x2C) = (uint32_t)prediction_data.sv_min_jump_landing_sound ^ 0x7F7FFFFF;
int m_nimpulse = util::find_in_datamap(g_ctx.local()->GetPredDescMap(), crypt_str("m_nImpulse"));
int get_buttons = util::find_in_datamap(g_ctx.local()->GetPredDescMap(), crypt_str("m_nButtons"));
int get_buttons_last = util::find_in_datamap(g_ctx.local()->GetPredDescMap(), crypt_str("m_afButtonLast"));
int get_buttons_pressed = util::find_in_datamap(g_ctx.local()->GetPredDescMap(), crypt_str("m_afButtonPressed"));
int get_buttons_released = util::find_in_datamap(g_ctx.local()->GetPredDescMap(), crypt_str("m_afButtonReleased"));
prediction_data.m_nServerCommandsAcknowledged = *(int*)(uintptr_t(m_prediction()) + 0x20);
prediction_data.m_bInPrediction = *(bool*)(uintptr_t(m_prediction()) + 8);
*reinterpret_cast<CUserCmd**>(reinterpret_cast<uintptr_t>(g_ctx.local()) + 0x3288) = m_pcmd;
if (!prediction_data.prediction_random_seed)
prediction_data.prediction_random_seed = *reinterpret_cast <int**> (util::FindSignature(crypt_str("client.dll"), crypt_str("A3 ? ? ? ? 66 0F 6E 86")) + 0x1);
*prediction_data.prediction_random_seed = MD5_PseudoRandom(m_pcmd->m_command_number) & INT_MAX;
if (!prediction_data.prediction_player)
prediction_data.prediction_player = *reinterpret_cast <int**> (util::FindSignature(crypt_str("client.dll"), crypt_str("89 35 ? ? ? ? F3 0F 10 48")) + 0x2);
*prediction_data.prediction_player = reinterpret_cast <int> (g_ctx.local());
auto buttons_forced = *reinterpret_cast<int*>(reinterpret_cast<uintptr_t>(g_ctx.local()) + 0x3334);
auto buttons_disabled = *reinterpret_cast<int*>(reinterpret_cast<uintptr_t>(g_ctx.local()) + 0x3330);
m_pcmd->m_buttons |= buttons_forced;
m_pcmd->m_buttons &= ~buttons_disabled;
m_gamemovement()->StartTrackPredictionErrors(g_ctx.local()); //-V807
m_movehelper()->set_host(g_ctx.local());
CMoveData move_data;
memset(&move_data, 0, sizeof(CMoveData));
if (g_ctx.globals.weapon)
{
g_ctx.globals.weapon->update_accuracy_penality();
g_ctx.globals.inaccuracy = g_ctx.globals.weapon->get_inaccuracy();
g_ctx.globals.spread = g_ctx.globals.weapon->get_spread();
auto is_special_weapon = g_ctx.globals.weapon->m_iItemDefinitionIndex() == WEAPON_AWP || g_ctx.globals.weapon->m_iItemDefinitionIndex() == WEAPON_G3SG1 || g_ctx.globals.weapon->m_iItemDefinitionIndex() == WEAPON_SCAR20 || g_ctx.globals.weapon->m_iItemDefinitionIndex() == WEAPON_SSG08;
auto inaccuracy = g_ctx.globals.weapon->get_csweapon_info()->flInaccuracyStand;
if (m_pcmd->m_weaponselect)
{
auto weapon = reinterpret_cast<weapon_t*>(m_entitylist()->GetClientEntity(m_pcmd->m_weaponselect));
if (weapon)
{
auto weapon_data = weapon->get_csweapon_info();
weapon_data ? g_ctx.local()->select_item(weapon_data->szWeaponName, m_pcmd->m_weaponsubtype) : 0;
}
}
if (g_ctx.local()->m_fFlags() & FL_DUCKING)
{
if (is_special_weapon)
g_ctx.globals.weap_inaccuracy = g_ctx.globals.weapon->get_csweapon_info()->flInaccuracyCrouchAlt;
else
g_ctx.globals.weap_inaccuracy = g_ctx.globals.weapon->get_csweapon_info()->flInaccuracyCrouch;
}
else if (is_special_weapon)
g_ctx.globals.weap_inaccuracy = g_ctx.globals.weapon->get_csweapon_info()->flInaccuracyStandAlt;
}
auto vehicle_handle = g_ctx.local()->m_hVehicle();
auto vehicle = vehicle_handle.IsValid() ? reinterpret_cast<entity_t*>(vehicle_handle.Get()) : nullptr;
if (m_pcmd->m_impulse
&& (!vehicle || g_ctx.local()->using_standard_weapons_in_vechile()))
m_nimpulse = m_pcmd->m_impulse;
auto buttons = m_pcmd->m_buttons;
auto buttons_changed = buttons ^ get_buttons;
get_buttons_last = get_buttons;
get_buttons = buttons;
get_buttons_pressed = buttons_changed & buttons;
get_buttons_released = buttons_changed & ~buttons;
m_prediction()->CheckMovingGround(g_ctx.local(), m_globals()->m_frametime);
g_ctx.local()->physics_run_think(0) ? g_ctx.local()->pre_think() : 0;
if (g_ctx.local()->get_next_think_tick() && g_ctx.local()->get_next_think_tick() != -1 && g_ctx.local()->get_next_think_tick() <= g_ctx.local()->m_nTickBase())
{
g_ctx.local()->get_next_think_tick() = -1;
g_ctx.local()->think();
}
if (g_ctx.local()->physics_run_think(0))
g_ctx.local()->pre_think();
auto thinktick = reinterpret_cast <int*> (reinterpret_cast <uint32_t> (g_ctx.local()) + 0x0FC);
if (*thinktick != -1 && *thinktick > 0 && *thinktick < TIME_TO_TICKS(m_globals()->m_curtime)) {
*thinktick = -1;
static auto fn = reinterpret_cast <void(__thiscall*)(int)> (util::FindSignature(crypt_str("client.dll"), crypt_str("55 8B EC 56 57 8B F9 8B B7 ? ? ? ? 8B C6 C1 E8 16 24 01 74 18")));
fn(0);
g_ctx.local()->think();
}
m_prediction()->SetupMove(g_ctx.local(), m_pcmd, m_movehelper(), &move_data);
m_gamemovement()->ProcessMovement(g_ctx.local(), &move_data);
m_prediction()->FinishMove(g_ctx.local(), m_pcmd, &move_data);
m_movehelper()->process_impacts();
m_gamemovement()->FinishTrackPredictionErrors(g_ctx.local());
m_movehelper()->set_host(nullptr);
if (prediction_data.sv_footsteps)
*(float*)(uintptr_t(prediction_data.sv_footsteps) + 0x2C) = backup_footsteps;
auto viewmodel = g_ctx.local()->m_hViewModel(). Get();
if (viewmodel)
{
viewmodel_data.weapon = viewmodel->m_hWeapon(). Get();
viewmodel_data.viewmodel_index = viewmodel->m_nViewModelIndex();
viewmodel_data.sequence = viewmodel->m_nSequence();
viewmodel_data.animation_parity = viewmodel->m_nAnimationParity();
viewmodel_data.cycle = viewmodel->m_flCycle();
viewmodel_data.animation_time = viewmodel->m_flAnimTime();
}
prediction_data.prediction_stage = FINISH;
}
void engineprediction::finish()
{
if (prediction_data.prediction_stage != FINISH)
return;
*prediction_data.prediction_random_seed = -1;
*prediction_data.prediction_player = 0;
*(int*)(uintptr_t(m_prediction()) + 0x20) = prediction_data.m_nServerCommandsAcknowledged; m_bPreviousAckHadErrors
*(bool*)(uintptr_t(m_prediction()) + 8) = prediction_data.m_bInPrediction; m_bInPrediction
m_globals()->m_curtime = prediction_data.old_curtime;
m_globals()->m_frametime = prediction_data.old_frametime;
}
void engineprediction::patch_attack_packet(CUserCmd* m_pcmd, bool m_bPredicted)
{
static bool m_bLastAttack = false;
static bool m_bInvalidCycle = false;
static float m_flLastCycle = 0.f;
if (m_bPredicted)
{
m_bLastAttack = m_pcmd->m_weaponselect || (m_pcmd->m_buttons & IN_ATTACK);
m_flLastCycle = g_ctx.local()->m_flCycle();
}
else if (m_bLastAttack && !m_bInvalidCycle)
m_bInvalidCycle = g_ctx.local()->m_flCycle() == 0.f && m_flLastCycle > 0.f;
if (m_bInvalidCycle)
g_ctx.local()->m_flCycle() = m_flLastCycle;
}
pred.hpp
Код:
#pragma once
#include "..\..\includes.hpp"
#include "..\..\sdk\structs.hpp"
enum Prediction_stage
{
SETUP,
PREDICT,
FINISH
};
struct m_player_data
{
m_player_data()
{
reset();
};
~m_player_data()
{
reset();
};
void reset()
{
m_aimPunchAngle.Zero();
m_aimPunchAngleVel.Zero();
m_viewPunchAngle.Zero();
m_vecViewOffset.Zero();
m_vecBaseVelocity.Zero();
m_vecVelocity.Zero();
m_vecOrigin.Zero();
m_flFallVelocity = 0.0f;
m_flVelocityModifier = 0.0f;
m_flDuckAmount = 0.0f;
m_flDuckSpeed = 0.0f;
m_fAccuracyPenalty = 0.0f;
m_flThirdpersonRecoil = 0.0f;
m_hGroundEntity = 0;
m_nMoveType = 0;
m_nFlags = 0;
m_nTickBase = 0;
m_flRecoilIndex = 0;
tick_count = 0;
command_number = INT_MAX;
is_filled = false;
}
Vector m_aimPunchAngle = {};
Vector m_aimPunchAngleVel = {};
Vector m_viewPunchAngle = {};
Vector m_vecViewOffset = {};
Vector m_vecBaseVelocity = {};
Vector m_vecVelocity = {};
Vector m_vecOrigin = {};
float m_flFallVelocity = 0.0f;
float m_flVelocityModifier = 0.0f;
float m_flThirdpersonRecoil = 0.0f;
float m_flDuckAmount = 0.0f;
float m_flDuckSpeed = 0.0f;
float m_fAccuracyPenalty = 0.0f;
int m_hGroundEntity = 0;
int m_nMoveType = 0;
int m_nFlags = 0;
int m_nTickBase = 0;
int m_flRecoilIndex = 0;
int tick_count = 0;
int command_number = INT_MAX;
bool is_filled = false;
};
struct c_tickbase_array
{
int command_num = -1;
int tickbase_original = 0;
int tickbase_this_tick = 0;
int extra_cmds = 0;
int extra_shift = 0;
bool m_set = false;
bool increace = false;
bool doubletap = false;
bool charge = false;
};
class StoredData_t
{
public:
int m_tickbase;
Vector m_punch;
Vector m_punch_vel;
Vector m_view_offset;
float m_velocity_modifier;
public:
__forceinline StoredData_t() : m_tickbase{ }, m_punch{ }, m_punch_vel{ }, m_view_offset{ }, m_velocity_modifier{ } {};
};
class engineprediction : public singleton <engineprediction>
{
struct Netvars_data
{
int tickbase = INT_MIN;
Vector m_vecVelocity = {};
Vector m_vecOrigin = {};
int get_move_type = 0;
float m_flFallVelocity = 0.0f;
float m_flVelocityModifier = 0.0f;
float m_flThirdpersonRecoil = 0.0f;
float m_flDuckAmount = 0.0f;
float m_flDuckSpeed = 0.0f;
float m_fAccuracyPenalty = 0.0f;
Vector m_aimPunchAngle = ZERO;
Vector m_aimPunchAngleVel = ZERO;
Vector m_viewPunchAngle = ZERO;
Vector m_vecViewOffset = ZERO;
Vector m_origin = ZERO;
Vector m_velocity = ZERO;
float m_duckAmount = 0.f;
float m_duckSpeed = 0.f;
float m_fall_velocity = 0.f;
float m_velocity_modifier = 0.f;
};
struct Backup_data
{
int flags = 0;
Vector velocity = ZERO;
float sv_footsteps_backup = 0.0f;
float sv_min_jump_landing_sound_backup = 0.0f;
};
class m_nsequence {
public:
float m_time;
int m_state;
int m_seq;
public:
__forceinline m_nsequence() : m_time{ }, m_state{ }, m_seq{ } {};
__forceinline m_nsequence(float time, int state, int seq) : m_time{ time }, m_state{ state }, m_seq{ seq } {};
};
std::array< StoredData_t, MULTIPLAYER_BACKUP > m_data;
struct Prediction_data
{
void reset()
{
prediction_stage = SETUP;
old_curtime = 0.0f;
old_frametime = 0.0f;
}
Prediction_stage prediction_stage = SETUP;
float old_curtime = 0.0f;
float old_frametime = 0.0f;
int* prediction_random_seed = nullptr;
int* prediction_player = nullptr;
ConVar* sv_footsteps = nullptr; m_cvar()->FindVar(m_xor_str("sv_footsteps"))
ConVar* sv_min_jump_landing_sound = nullptr; m_cvar()->FindVar(m_xor_str("sv_min_jump_landing_sound"))
int m_nServerCommandsAcknowledged;
bool m_bInPrediction;
};
struct Viewmodel_data
{
weapon_t* weapon = nullptr;
int viewmodel_index = 0;
int sequence = 0;
int animation_parity = 0;
float cycle = 0.0f;
float animation_time = 0.0f;
};
public:
Netvars_data netvars_data[MULTIPLAYER_BACKUP];
Backup_data backup_data;
Prediction_data prediction_data;
Viewmodel_data viewmodel_data;
std::deque< m_nsequence > m_sequence;
m_player_data m_Data[150] = { };
c_tickbase_array m_tickbase_array[150] = {};
void FixNetvarCompression(int time);
void store_netvars();
void store_data();
void reset_data();
void restore_netvars();
void update_vel();
void update_incoming_sequences();
void setup();
void predict(CUserCmd* m_pcmd);
void finish();
void patch_attack_packet(CUserCmd* m_pcmd, bool m_bPredicted);
};