From c4e18b4e500dc603fb7546b7bc9bc574fb09e0a8 Mon Sep 17 00:00:00 2001 From: navewindre Date: Thu, 30 Aug 2018 15:32:54 +0200 Subject: epic hitchance --- internal_rewrite/prediction.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'internal_rewrite/prediction.cpp') diff --git a/internal_rewrite/prediction.cpp b/internal_rewrite/prediction.cpp index 1d643de..32a30ae 100644 --- a/internal_rewrite/prediction.cpp +++ b/internal_rewrite/prediction.cpp @@ -642,6 +642,13 @@ void c_prediction::run_command( user_cmd_t *ucmd ) { *reinterpret_cast< uint32_t * >( m_prediction_player ) = uint32_t( player ); // Copy user command to m_pCurrentCommand and m_pPlayerCommand. + int backup_buttons = ucmd->m_buttons; + float backup_forwardmove = ucmd->m_forwardmove; + float backup_sidemove = ucmd->m_sidemove; + + ucmd->m_forwardmove = ucmd->m_sidemove = 0.f; + ucmd->m_buttons &= ~( IN_BACK | IN_FORWARD | IN_MOVELEFT | IN_MOVERIGHT ); + *reinterpret_cast< uint32_t * >( uint32_t( player ) + 0x3314 ) = uint32_t( ucmd ); *reinterpret_cast< uint32_t * >( uint32_t( player ) + 0x326C ) = uint32_t( ucmd ); @@ -809,6 +816,18 @@ void c_prediction::run_command( user_cmd_t *ucmd ) { // IMLAZY: // I'd rather just restore this instead of fixing it everywhere in the cheat. player->m_vecVelocity( ) = m_velocity; + + ucmd->m_forwardmove = backup_forwardmove; + ucmd->m_sidemove = backup_sidemove; + + if( auto wep = g_ctx.m_local->get_weapon( ) ) { + wep->update_accuracy_penalty( ); + g_ctx.m_weapon_inaccuracy = wep->get_inaccuracy( ); + g_ctx.m_weapon_spread = wep->get_spread( ); + } + else { + g_ctx.m_weapon_inaccuracy = g_ctx.m_weapon_spread = 0.f; + } } void c_prediction::post_run_command( ) { -- cgit v1.2.3