summaryrefslogtreecommitdiff
path: root/internal_rewrite/prediction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'internal_rewrite/prediction.cpp')
-rw-r--r--internal_rewrite/prediction.cpp19
1 files changed, 19 insertions, 0 deletions
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( ) {