-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
C++:
int post_think(IBasePlayer* player) {
getvfunc<void(__thiscall*)(void*)>(interfaces.model_cache, 33)(interfaces.model_cache);
//hueta ebanay
if (player->isAlive()
|| *reinterpret_cast<int*>(reinterpret_cast<uintptr_t>(player) + 0x3A81)) {
getvfunc<void(__thiscall*)(void*)>(player, 339)(player);
player->GetFlags()& FL_ONGROUND ? player->GetFallVelocity() = 0.f : 0;
player->GetSequence() == -1 ? getvfunc<void(__thiscall*)(void*, int)>(player, 218)(player, 0) : 0;
getvfunc<void(__thiscall*)(void*)>(player, 219)(player);
static auto post_think_v_physics = reinterpret_cast <bool(__thiscall*)(IBasePlayer*)> (csgo->Utils.FindPatternIDA(GetModuleHandleA(g_Modules[fnv::hash(hs::client_dll::s().c_str())].c_str()),
hs::post_think_v_physics::s().c_str()));
post_think_v_physics(player);
}
static auto simulate_player_simulated_entities = reinterpret_cast <bool(__thiscall*)(IBasePlayer*)> (csgo->Utils.FindPatternIDA(GetModuleHandleA(g_Modules[fnv::hash(hs::client_dll::s().c_str())].c_str()),
hs::simulate_player_simulated_entities::s().c_str()));
simulate_player_simulated_entities(player);
return getvfunc<int(__thiscall*)(void*)>(interfaces.model_cache, 34)(interfaces.model_cache);
}
void CEnginePrediction::Start(CUserCmd* cmd, IBasePlayer* local) {
old_vars.curtime = interfaces.global_vars->curtime;
old_vars.frametime = interfaces.global_vars->frametime;
old_vars.tickcount = interfaces.global_vars->tickcount;
auto old_in_prediction = interfaces.prediction->bInPrediction;
auto old_first_prediction = interfaces.prediction->bIsFirstTimePredicted;
interfaces.global_vars->curtime = TICKS_TO_TIME(local->GetTickBase());
interfaces.global_vars->frametime = interfaces.global_vars->interval_per_tick;
interfaces.global_vars->tickcount = TIME_TO_TICKS(interfaces.global_vars->curtime);
//*reinterpret_cast<CUserCmd**>(uint32_t(local) + 0x3334) = cmd;
//*reinterpret_cast<CUserCmd**>(uint32_t(local) + 0x3288) = cmd;
interfaces.prediction->bIsFirstTimePredicted = false;
interfaces.prediction->bInPrediction = true;
if (cmd->impulse)
*reinterpret_cast<uint32_t*>(uint32_t(local) + 0x31FC) = cmd->impulse;
cmd->buttons |= *reinterpret_cast<uint32_t*>(uint32_t(local) + 0x3330);
auto v16 = cmd->buttons;
auto* unk02 = reinterpret_cast<int*>(uint32_t(local) + 0x31F8);
auto v17 = v16 ^ *unk02;
*reinterpret_cast<int*>(uint32_t(local) + 0x31EC) = *unk02;
*reinterpret_cast<int*>(uint32_t(local) + 0x31F8) = v16;
*reinterpret_cast<int*>(uint32_t(local) + 0x31F0) = v16 & v17;
*reinterpret_cast<int*>(uint32_t(local) + 0x31F4) = v17 & ~v16;
interfaces.prediction->CheckMovingGround(local, interfaces.global_vars->frametime);
interfaces.move_helper->SetHost(local);
interfaces.prediction->SetupMove(local, cmd, interfaces.move_helper, &data);
interfaces.game_movement->ProcessMovement(local, (CMoveData*)&data);
interfaces.prediction->FinishMove(local, cmd, &data);
interfaces.move_helper->ProcessImpacts();
}
void CEnginePrediction::Finish(IBasePlayer* local) {
interfaces.game_movement->FinishTrackPredictionErrors(local);
interfaces.move_helper->SetHost(nullptr);
interfaces.global_vars->curtime = old_vars.curtime;
interfaces.global_vars->frametime = old_vars.frametime;
interfaces.game_movement->FinishTrackPredictionErrors(local);
interfaces.move_helper->SetHost(nullptr);
interfaces.global_vars->curtime = old_vars.curtime;
interfaces.global_vars->frametime = old_vars.frametime;
interfaces.global_vars->tickcount = old_vars.tickcount;
interfaces.game_movement->Reset();
}
//we fix tickbase in our prediction so we can just use fixed curtime and the fix curtime help with other shit
int CEnginePrediction::GetTickbase(CUserCmd* pCmd, IBasePlayer* pLocal)
{
static int iTick = 0;
static CUserCmd* pLastCmd = nullptr;
if (pCmd != nullptr)
{
// if command was not predicted - increment tickbase
if (pLastCmd == nullptr || pLastCmd->hasbeenpredicted)
iTick = pLocal->GetTickBase();
else
iTick++;
pLastCmd = pCmd;
}
return iTick;
}