diff --git a/Copy_Command.hpp b/Copy_Command.hpp index 5b85043..740aeda 100644 --- a/Copy_Command.hpp +++ b/Copy_Command.hpp @@ -223,7 +223,9 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu } }; - //td: m_nServerTick should be used inside of Set_Move_Type, on restoration + static __int32 Accumulative_Correction; + + //td: m_nServerTick should be used inside of Set_Move_Type auto Absolute_Speed = [&]() -> void { if (Interface_Extra_Commands_Action.Integer > 0) @@ -232,7 +234,11 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu { Extended_Command->Extra_Commands = 0; - Extra_Commands = Interface_Extra_Commands_Action.Integer; + Extra_Commands = max((__int32)(0.06f / Global_Variables->Interval_Per_Tick + 0.5f), Interface_Extra_Commands_Action.Integer); + } + else + { + Accumulative_Correction += 1; } if (Initial_Extended_Command->Extra_Commands == 0) @@ -244,6 +250,18 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu } }; + auto Correct_Extended_Command = [&]() -> void + { + if (*(__int32*)((unsigned __int32)Network_Channel + 16) != -1) + { + Extended_Command->Extra_Commands += Accumulative_Correction; + + Accumulative_Correction = 0; + } + + Extended_Command->Sequence_Shift = Initial_Extended_Command->Sequence_Shift; + }; + if (*(__int32*)((unsigned __int32)Local_Player + 228) == 3) { if (*(__int8*)((unsigned __int32)Local_Player + 7322) == 0) @@ -272,7 +290,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu } } - Extended_Command->Sequence_Shift = Initial_Extended_Command->Sequence_Shift; + Correct_Extended_Command(); } else { @@ -286,13 +304,13 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu } else { - if (Action + Reviving != 0) + if (Action + Reviving != 0) //rem: use predicted values instead? (to preserve clock-corrected timers) { Absolute_Speed(); } } - Extended_Command->Sequence_Shift = Initial_Extended_Command->Sequence_Shift; + Correct_Extended_Command(); *(__int32*)((unsigned __int32)Local_Player + 5620) = Command->Command_Number; diff --git a/Entry_Point.cpp b/Entry_Point.cpp index 67e95bf..ec39a77 100755 --- a/Entry_Point.cpp +++ b/Entry_Point.cpp @@ -196,7 +196,7 @@ __int32 __stdcall DllMain(HMODULE This_Module, unsigned __int32 Call_Reason, voi _putws(L"[ + ] Animations"); { - Redirection_Manager::Redirect_Function(1, (void*)((unsigned __int32)Client_Module + 205296), (void*)Redirected_Update_Animations); + Redirection_Manager::Redirect_Function((void*)((unsigned __int32)Client_Module + 205296), (void*)Redirected_Update_Animations); Original_Estimate_Velocity_Caller = Redirection_Manager::Redirect_Function(0, (void*)((unsigned __int32)Client_Module + 311856), (void*)Redirected_Estimate_Velocity); @@ -247,7 +247,7 @@ __int32 __stdcall DllMain(HMODULE This_Module, unsigned __int32 Call_Reason, voi Original_Perform_Shove_Trace_Caller = (void*)((unsigned __int32)Client_Module + 3221111); - Redirection_Manager::Redirect_Function(1, (void*)((unsigned __int32)Client_Module + 3221102), (void*)Redirected_Perform_Shove_Trace); + Redirection_Manager::Redirect_Function((void*)((unsigned __int32)Client_Module + 3221102), (void*)Redirected_Perform_Shove_Trace); } _putws(L"[ + ] Network"); @@ -256,7 +256,7 @@ __int32 __stdcall DllMain(HMODULE This_Module, unsigned __int32 Call_Reason, voi Original_Move_Caller = Redirection_Manager::Redirect_Function(3, (void*)((unsigned __int32)Engine_Module + 512288), (void*)Redirected_Move); - Redirection_Manager::Redirect_Function(1, (void*)((unsigned __int32)Engine_Module + 511680), (void*)Redirected_Send_Move); + Redirection_Manager::Redirect_Function((void*)((unsigned __int32)Engine_Module + 511680), (void*)Redirected_Send_Move); } _putws(L"[ + ] Input"); @@ -289,19 +289,17 @@ __int32 __stdcall DllMain(HMODULE This_Module, unsigned __int32 Call_Reason, voi { Original_Write_Texture_Caller = Redirection_Manager::Redirect_Function(0, (void*)((unsigned __int32)GetModuleHandleW(L"vguimatsurface.dll") + 100592), (void*)Redirected_Write_Texture); - Redirection_Manager::Redirect_Function(1, (void*)((unsigned __int32)Client_Module + 2913504), (void*)Redirected_Paint); + Redirection_Manager::Redirect_Function((void*)((unsigned __int32)Client_Module + 2913504), (void*)Redirected_Paint); Original_Get_Glow_Color_Caller = Redirection_Manager::Redirect_Function(1, (void*)((unsigned __int32)Client_Module + 2455600), (void*)Redirected_Get_Glow_Color); Byte_Manager::Set_Bytes(0, (void*)((unsigned __int32)Client_Module + 3244715), 1, 49); - Redirection_Manager::Redirect_Function(1, (void*)((unsigned __int32)Client_Module + 2301184), (void*)Redirected_Draw_Crosshair); + Redirection_Manager::Redirect_Function((void*)((unsigned __int32)Client_Module + 2301184), (void*)Redirected_Draw_Crosshair); Byte_Manager::Set_Bytes(0, (void*)((unsigned __int32)Client_Module + 2930985), 1, 235); - Redirection_Manager::Redirect_Function(1, (void*)((unsigned __int32)Client_Module + 3118720), (void*)Redirected_Draw_Crosshair); - - //rem: vehicle crosshair + Redirection_Manager::Redirect_Function((void*)((unsigned __int32)Client_Module + 3118720), (void*)Redirected_Draw_Crosshair); } } }