From d17493562fbe7352d9416ecc9160d04101cae0f3 Mon Sep 17 00:00:00 2001 From: navewindre Date: Mon, 26 Nov 2018 17:50:04 +0100 Subject: dsad --- internal_rewrite/extra.cpp | 41 +++++------------------------------------ 1 file changed, 5 insertions(+), 36 deletions(-) (limited to 'internal_rewrite/extra.cpp') diff --git a/internal_rewrite/extra.cpp b/internal_rewrite/extra.cpp index 36a4e21..2408e7f 100644 --- a/internal_rewrite/extra.cpp +++ b/internal_rewrite/extra.cpp @@ -79,50 +79,19 @@ namespace features } void c_extra::update_netchannel( ) { - if( !g_csgo.m_engine( )->IsInGame( ) || !g_ctx.m_local || - !g_ctx.m_local->is_valid( ) ) { - return; - } - switch( g_settings.misc.net_fakelag ) { - case 0: - g_settings.misc.net_fakeping_active = false; - break; - case 1: - g_settings.misc.net_fakeping_active = g_input.is_key_pressed( g_settings.misc.net_fakeping_key ); - break; - case 2: { - static bool held = false; - bool pressed = g_input.is_key_pressed( g_settings.misc.net_fakeping_key ); - if( pressed ) { - if( !held ) - g_settings.misc.net_fakeping_active ^= 1; - held = true; - } - else held = false; - } - break; - case 3: - g_settings.misc.net_fakeping_active = true; - break; - default: - g_settings.misc.net_fakeping_active = false; - break; - } } void c_extra::add_latency( INetChannel* channel ) { if ( g_ctx.m_local && g_ctx.m_local->is_valid( ) ) { - float latency = g_settings.misc.net_fakeping_amount( ) * 0.001f; - + auto nci = g_csgo.m_engine( )->GetNetChannelInfo( ); - if( g_settings.misc.net_fakeping_active ) { - // I doubt that the code below is actually necessary to accomplish fake latency. - // In fact, it might be the thing that is breaking it. + float in_latency = nci->GetLatency( 0 ); - // float latency_floor = std::floorf( nci->GetLatency( 1 ) * 10.f ) * 0.1f; - // if( g_csgo.m_globals->m_frametime > TICK_INTERVAL( ) || latency_floor <= latency + g_csgo.m_globals->m_frametime * 2.f ) + //arbitrary number much + float latency = 0.15f - ( in_latency + g_csgo.m_globals->m_frametime ) - TICK_INTERVAL( ); + if( g_settings.misc.net_fakeping_active && latency > 0.f ) { channel->m_nInSequenceNr += 2 * 64 - ( 63 * latency ); } } -- cgit v1.2.3