improve target_on_simulation logic

timeout logic (defaults to ~0.5s)
This commit is contained in:
explorer
2025-10-01 23:25:03 +03:00
parent 6c8f182ebe
commit 416be104f5
10 changed files with 77 additions and 52 deletions
+43 -9
View File
@@ -183,11 +183,11 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
Vector_Normalize(Move_Right); Vector_Normalize(Move_Right);
float Divider = Move_Forward[0] * Move_Right[1] - Move_Right[0] * Move_Forward[1]; float Divisor = Move_Forward[0] * Move_Right[1] - Move_Right[0] * Move_Forward[1];
Command->Move[0] = (Desired_Move[0] * Move_Right[1] - Move_Right[0] * Desired_Move[1]) / Divider; Command->Move[0] = (Desired_Move[0] * Move_Right[1] - Move_Right[0] * Desired_Move[1]) / Divisor;
Command->Move[1] = (Move_Forward[0] * Desired_Move[1] - Desired_Move[0] * Move_Forward[1]) / Divider; Command->Move[1] = (Move_Forward[0] * Desired_Move[1] - Desired_Move[0] * Move_Forward[1]) / Divisor;
}; };
Correct_Movement(); Correct_Movement();
@@ -390,7 +390,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
if (Weapon_Identifier == 39) if (Weapon_Identifier == 39)
{ {
Can_Attack = (min(Chainsaw_Cycles * 0.46153846f * Global_Variables->Interval_Per_Tick, 1.f) > 0.95f) * (In_Shove ^ 1); Can_Attack = (min(Chainsaw_Cycle * 0.46153846f * Global_Variables->Interval_Per_Tick, 1.f) > 0.95f) * (In_Shove ^ 1);
} }
else else
{ {
@@ -410,6 +410,15 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
Sorted_Target_List.clear(); Sorted_Target_List.clear();
struct Target_Time_Structure
{
float Server[2];
__int32 Client[2];
};
static std::unordered_map<__int32, Target_Time_Structure> Target_Times;
auto Get_Target_Time = [&](Target_Structure* Target) -> float auto Get_Target_Time = [&](Target_Structure* Target) -> float
{ {
if (Interface_Target_On_Simulation.Integer == 0) if (Interface_Target_On_Simulation.Integer == 0)
@@ -453,7 +462,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
(__int32)(Time / Global_Variables->Interval_Per_Tick + 0.5f) (__int32)(Time / Global_Variables->Interval_Per_Tick + 0.5f)
}; };
if (*(float*)((unsigned __int32)Entity + 16) != Get_Target_Time(&Target)) if (Target_Times[Entity_Number].Server[0] * (Target_Times[Entity_Number].Client[0] + (__int32)(0.5f / Global_Variables->Interval_Per_Tick + 0.5f) > *(__int32*)((unsigned __int32)Engine_Module + 6905340)) != Get_Target_Time(&Target))
{ {
if (Identifier == 277) if (Identifier == 277)
{ {
@@ -500,6 +509,31 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
Get_Eye_Position_Type((unsigned __int32)Client_Module + 108512)(Local_Player, Eye_Position); Get_Eye_Position_Type((unsigned __int32)Client_Module + 108512)(Local_Player, Eye_Position);
auto Set_Target_Time = [&](Target_Structure* Target, __int8 Restore) -> void
{
Target_Time_Structure* Time = &Target_Times[*(__int32*)((unsigned __int32)Target->Self + 88)];
if (Restore == 0)
{
Time->Server[1] = Time->Server[0];
Time->Client[1] = Time->Client[0];
if (Time->Server[0] != Get_Target_Time(Target))
{
Time->Server[0] = Get_Target_Time(Target);
Time->Client[0] = *(__int32*)((unsigned __int32)Engine_Module + 6905340);
}
}
else
{
Time->Server[0] = Time->Server[1];
Time->Client[0] = Time->Client[1];
}
};
Target_Structure* Shove_Target = nullptr; Target_Structure* Shove_Target = nullptr;
if (Cancelable_Shove + In_Shove > 1) if (Cancelable_Shove + In_Shove > 1)
@@ -626,7 +660,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
Cancelable_Shove = (Gender * Interface_Riot_Deprioritize.Integer * (Forced ^ 1)) == 15; Cancelable_Shove = (Gender * Interface_Riot_Deprioritize.Integer * (Forced ^ 1)) == 15;
*(float*)((unsigned __int32)Target->Self + 16) = Get_Target_Time(Target); Set_Target_Time(Target, 0);
goto Shove_Found_Target_Label; goto Shove_Found_Target_Label;
} }
@@ -843,7 +877,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
Command->Buttons |= 1; Command->Buttons |= 1;
*(float*)((unsigned __int32)Target->Self + 16) = Get_Target_Time(Target); Set_Target_Time(Target, 0);
goto Aim_Found_Target_Label; goto Aim_Found_Target_Label;
} }
@@ -866,11 +900,11 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
{ {
if (Shove_Target != nullptr) if (Shove_Target != nullptr)
{ {
*(float*)((unsigned __int32)Shove_Target->Self + 16) = 0.f; Set_Target_Time(Shove_Target, 1);
if (Aim_Target != nullptr) if (Aim_Target != nullptr)
{ {
*(float*)((unsigned __int32)Aim_Target->Self + 16) = Get_Target_Time(Aim_Target); Set_Target_Time(Aim_Target, 0);
} }
} }
+5 -5
View File
@@ -2,7 +2,7 @@ void Redirected_Draw_Crosshair()
{ {
static float Rotation_Angle; static float Rotation_Angle;
auto Draw_Storm = [&](__int32 X, __int32 Y, __int32 Additional_Rotation_Angle) auto Storm = [&](__int32 X, __int32 Additional_Angle, __int32 Y)
{ {
using Set_Color_Type = void(__thiscall**)(void* Surface, unsigned __int8 Red, unsigned __int8 Green, unsigned __int8 Blue, unsigned __int8 Alpha); using Set_Color_Type = void(__thiscall**)(void* Surface, unsigned __int8 Red, unsigned __int8 Green, unsigned __int8 Blue, unsigned __int8 Alpha);
@@ -12,9 +12,9 @@ void Redirected_Draw_Crosshair()
using Draw_Circle_Type = void(__thiscall**)(void* Surface, __int32 X, __int32 Y, __int32 Radius, __int32 Segments); using Draw_Circle_Type = void(__thiscall**)(void* Surface, __int32 X, __int32 Y, __int32 Radius, __int32 Segments);
X += Interface_Storm_Rotation_Radius.Integer * __builtin_cosf(__builtin_remainderf(Rotation_Angle + Additional_Rotation_Angle, 360.f) * 3.1415927f / 180.f); X += Interface_Storm_Rotation_Radius.Integer * __builtin_cosf((Rotation_Angle + Additional_Angle) * 3.1415927f / 180.f);
Y += Interface_Storm_Rotation_Radius.Integer * __builtin_sinf(__builtin_remainderf(Rotation_Angle + Additional_Rotation_Angle, 360.f) * 3.1415927f / 180.f); Y += Interface_Storm_Rotation_Radius.Integer * __builtin_sinf((Rotation_Angle + Additional_Angle) * 3.1415927f / 180.f);
(*Draw_Circle_Type(*(unsigned __int32*)Surface + 384))(Surface, X - 1, Y, Interface_Storm_Radius.Integer, Interface_Storm_Segments.Integer); (*Draw_Circle_Type(*(unsigned __int32*)Surface + 384))(Surface, X - 1, Y, Interface_Storm_Radius.Integer, Interface_Storm_Segments.Integer);
@@ -55,7 +55,7 @@ void Redirected_Draw_Crosshair()
{ {
if (Storm_Number < Interface_Storm_Iterations.Integer) if (Storm_Number < Interface_Storm_Iterations.Integer)
{ {
Draw_Storm(Screen_Width, Screen_Height, Storm_Number * 360 / Interface_Storm_Iterations.Integer); Storm(Screen_Width, Storm_Number * 360 / Interface_Storm_Iterations.Integer, Screen_Height);
Storm_Number += 1; Storm_Number += 1;
@@ -63,7 +63,7 @@ void Redirected_Draw_Crosshair()
} }
} }
Rotation_Angle = __builtin_remainderf(Rotation_Angle + (*(Global_Variables_Structure**)((unsigned __int32)Client_Module + 7096744))->Frame_Time * Interface_Storm_Speed.Integer, 360.f); Rotation_Angle = __builtin_remainderf(Rotation_Angle + (*(Global_Variables_Structure**)((unsigned __int32)Client_Module + 7096744))->Frame_Time * Interface_Storm_Speed.Floating_Point, 360.f);
using Get_Display_Type = void*(__cdecl*)(); using Get_Display_Type = void*(__cdecl*)();
+2 -2
View File
@@ -60,7 +60,7 @@ void Implement_Extended_Interface()
Create_Interface(Pointer_Name(Interface_Interpolate_Extra_Commands), (char*)"1", nullptr); Create_Interface(Pointer_Name(Interface_Interpolate_Extra_Commands), (char*)"1", nullptr);
Create_Interface(Pointer_Name(Interface_Target_On_Simulation), (char*)"0", nullptr); Create_Interface(Pointer_Name(Interface_Target_On_Simulation), (char*)"1", nullptr);
Create_Interface(Pointer_Name(Interface_Shotgun_Shove), (char*)"1", nullptr); Create_Interface(Pointer_Name(Interface_Shotgun_Shove), (char*)"1", nullptr);
@@ -82,5 +82,5 @@ void Implement_Extended_Interface()
Create_Interface(Pointer_Name(Interface_Storm_Iterations), (char*)"16", nullptr); Create_Interface(Pointer_Name(Interface_Storm_Iterations), (char*)"16", nullptr);
Create_Interface(Pointer_Name(Interface_Storm_Speed), (char*)"512", nullptr); Create_Interface(Pointer_Name(Interface_Storm_Speed), (char*)"540", nullptr);
} }
+3 -5
View File
@@ -1,6 +1,6 @@
__int32 Extra_Commands; __int32 Extra_Commands;
__int32 Chainsaw_Cycles; __int32 Chainsaw_Cycle;
void* Original_Move_Caller; void* Original_Move_Caller;
@@ -24,8 +24,6 @@ void Redirected_Move(float Unknown_Parameter, __int8 Final)
Fire_Events_Type((unsigned __int32)Engine_Module + 521648)(); Fire_Events_Type((unsigned __int32)Engine_Module + 521648)();
Update_Animation_Time = (*(Global_Variables_Structure**)((unsigned __int32)Client_Module + 7096744))->Time;
Update_Animation_Type = 1; Update_Animation_Type = 1;
Redirected_Update_Animations(); Redirected_Update_Animations();
@@ -43,11 +41,11 @@ void Redirected_Move(float Unknown_Parameter, __int8 Final)
if (Local_Player != nullptr) if (Local_Player != nullptr)
{ {
Chainsaw_Cycles += 1 + (Chainsaw_Cycles == 0); Chainsaw_Cycle += 1 + (Chainsaw_Cycle == 0);
static float Deploy_Time; static float Deploy_Time;
Chainsaw_Cycles *= *(float*)((unsigned __int32)Local_Player + 3872) == Deploy_Time; Chainsaw_Cycle *= *(float*)((unsigned __int32)Local_Player + 3872) == Deploy_Time;
Deploy_Time = *(float*)((unsigned __int32)Local_Player + 3872); Deploy_Time = *(float*)((unsigned __int32)Local_Player + 3872);
} }
+4 -4
View File
@@ -331,9 +331,9 @@ void __thiscall Redirected_Paint(void* Panel)
size_t Character_Number = 0; size_t Character_Number = 0;
unsigned __int32 Width = 0; __int32 Width = 0;
unsigned __int32 Height = 0; __int32 Height = 0;
__int32 Offset_Y = 0; __int32 Offset_Y = 0;
@@ -341,13 +341,13 @@ void __thiscall Redirected_Paint(void* Panel)
Calculate_Text_Bounds_Label: Calculate_Text_Bounds_Label:
{ {
unsigned __int32* Character_Bounds = Characters_Bounds[Paint_Data->Name[Character_Number]]; __int32* Character_Bounds = Characters_Bounds[Paint_Data->Name[Character_Number]];
Width += Character_Bounds[1] + 1; Width += Character_Bounds[1] + 1;
Height = max(Height, Character_Bounds[3]); Height = max(Height, Character_Bounds[3]);
Offset_Y = max(Offset_Y, 3 - (__int32)Character_Bounds[2]); Offset_Y = max(Offset_Y, 3 - Character_Bounds[2]);
Character_Number += 1; Character_Number += 1;
+5 -5
View File
@@ -156,11 +156,7 @@ void __thiscall Perform_Trace(void* Stack)
{ {
if (Identifier == 264) if (Identifier == 264)
{ {
if ((Upgrade_Type == 1) + (Bullet_Type == 6)) if ((Upgrade_Type == 1) + (Bullet_Type == 6) == 0)
{
Damage = __builtin_inff();
}
else
{ {
Apply_Shotgun_Scaling(); Apply_Shotgun_Scaling();
@@ -212,6 +208,10 @@ void __thiscall Perform_Trace(void* Stack)
} }
} }
} }
else
{
Damage = __builtin_inff();
}
} }
else else
{ {
+2 -1
View File
@@ -10,7 +10,8 @@ d3x (for telling me that i don't have to bruteforce prediction frame)
polak (for strafe deltas) polak (for strafe deltas)
ucuser0 (for his post regarding backup commands) ucuser0 (for his post regarding backup commands)
kamay (for crossproducts of movement) kamay (for crossproducts of movement)
deniz (for being friend) deniz (for hosting video)
dr_p3pp3r (for his rediscovery of sequence manipulation)
songs: songs:
david bowie - art decade david bowie - art decade
+1 -1
View File
@@ -54,7 +54,7 @@
<BufferSecurityCheck>false</BufferSecurityCheck> <BufferSecurityCheck>false</BufferSecurityCheck>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet> <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<FloatingPointModel>Fast</FloatingPointModel> <FloatingPointModel>Fast</FloatingPointModel>
<AdditionalOptions>/Zc:threadSafeInit- /clang:-fno-unwind-tables -Wno-microsoft-goto %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/Zc:threadSafeInit- /clang:-fno-unwind-tables -Wno-microsoft-goto -Wno-nan-infinity-disabled %(AdditionalOptions)</AdditionalOptions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<ControlFlowGuard>false</ControlFlowGuard> <ControlFlowGuard>false</ControlFlowGuard>
<FloatingPointExceptions>false</FloatingPointExceptions> <FloatingPointExceptions>false</FloatingPointExceptions>
+2 -10
View File
@@ -11,18 +11,12 @@ struct Global_Variables_Structure
float Interval_Per_Tick; float Interval_Per_Tick;
}; };
float Update_Animation_Time;
__int8 Update_Animation_Type; __int8 Update_Animation_Type;
void Redirected_Update_Animations() void Redirected_Update_Animations()
{ {
Global_Variables_Structure* Global_Variables = *(Global_Variables_Structure**)((unsigned __int32)Client_Module + 7096744); Global_Variables_Structure* Global_Variables = *(Global_Variables_Structure**)((unsigned __int32)Client_Module + 7096744);
float Previous_Time = Global_Variables->Time;
Global_Variables->Time = Update_Animation_Time;
float Previous_Frame_Time = Global_Variables->Frame_Time; float Previous_Frame_Time = Global_Variables->Frame_Time;
Global_Variables->Frame_Time = Global_Variables->Interval_Per_Tick * Update_Animation_Type; Global_Variables->Frame_Time = Global_Variables->Interval_Per_Tick * Update_Animation_Type;
@@ -35,13 +29,13 @@ void Redirected_Update_Animations()
{ {
void* Animation_List = *(void**)((unsigned __int32)Client_Module + 7479612); void* Animation_List = *(void**)((unsigned __int32)Client_Module + 7479612);
if ((*(__int8*)((unsigned __int32)Animation_List + 8 * Entity_Number + 4) & 1) != 0) if ((*(__int8*)((unsigned __int32)Animation_List + 8 * Entity_Number + 4) & 1) == 1)
{ {
using Update_Animation_Type = void(__thiscall**)(void* Entity); using Update_Animation_Type = void(__thiscall**)(void* Entity);
void* Entity = *(void**)((unsigned __int32)Animation_List + 8 * Entity_Number); void* Entity = *(void**)((unsigned __int32)Animation_List + 8 * Entity_Number);
*(float*)((unsigned __int32)Entity + 328) = Update_Animation_Time - Global_Variables->Frame_Time; *(float*)((unsigned __int32)Entity + 328) = Global_Variables->Time - Global_Variables->Frame_Time;
(*Update_Animation_Type(*(unsigned __int32*)Entity + 808))(Entity); (*Update_Animation_Type(*(unsigned __int32*)Entity + 808))(Entity);
} }
@@ -53,6 +47,4 @@ void Redirected_Update_Animations()
} }
Global_Variables->Frame_Time = Previous_Frame_Time; Global_Variables->Frame_Time = Previous_Frame_Time;
Global_Variables->Time = Previous_Time;
} }
+10 -10
View File
@@ -2,31 +2,31 @@ void* Original_Write_Texture_Caller;
wchar_t Write_Character; wchar_t Write_Character;
std::unordered_map<wchar_t, unsigned __int32[4]> Characters_Bounds; std::unordered_map<wchar_t, __int32[4]> Characters_Bounds;
void __thiscall Redirected_Write_Texture(void* Unknown_Parameter_1, void* Unknown_Parameter_2, unsigned __int32 Width, unsigned __int32 Height, void* Texture) void __thiscall Redirected_Write_Texture(void* Unknown_Parameter_1, void* Unknown_Parameter_2, __int32 Width, __int32 Height, void* Texture)
{ {
(decltype(&Redirected_Write_Texture)(Original_Write_Texture_Caller))(Unknown_Parameter_1, Unknown_Parameter_2, Width, Height, Texture); (decltype(&Redirected_Write_Texture)(Original_Write_Texture_Caller))(Unknown_Parameter_1, Unknown_Parameter_2, Width, Height, Texture);
if (Write_Character != 0) if (Write_Character != 0)
{ {
unsigned __int32 X = 0; __int32 X = 0;
unsigned __int32 Offset_X = Width; __int32 Offset_X = Width;
unsigned __int32 Character_Width = 0; __int32 Character_Width = 0;
unsigned __int32 Offset_Y = Height; __int32 Offset_Y = Height;
unsigned __int32 Character_Height = 0; __int32 Character_Height = 0;
Traverse_Horizontal_Label: Traverse_Horizontal_Label:
{ {
unsigned __int32 Y = 0; __int32 Y = 0;
Traverse_Vertical_Label: Traverse_Vertical_Label:
{ {
if (*(unsigned __int32*)((unsigned __int32)Texture + X * 4 + Y * 4 * Width) != 0) if (*(__int32*)((unsigned __int32)Texture + X * 4 + Y * 4 * Width) != 0)
{ {
Offset_X = min(X, Offset_X); Offset_X = min(X, Offset_X);
@@ -53,7 +53,7 @@ void __thiscall Redirected_Write_Texture(void* Unknown_Parameter_1, void* Unknow
} }
} }
unsigned __int32* Character_Bounds = Characters_Bounds[Write_Character]; __int32* Character_Bounds = Characters_Bounds[Write_Character];
Character_Bounds[0] = Offset_X; Character_Bounds[0] = Offset_X;