mirror of
https://github.com/qwertyuiop3/Storm.git
synced 2026-10-10 04:53:06 +08:00
optimize shotgun seeds, pellet arrangement;
credits: god (for providing the algorithm in a dream), noop (for having NASA computer, spending ~4.5 hours on the algorithm)
This commit is contained in:
+56
-53
@@ -82,12 +82,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
||||
{
|
||||
Command->Buttons |= 4194304 * (Command->Command_Number % 2);
|
||||
|
||||
float Move_Angles[3] =
|
||||
{
|
||||
Command->Angles[0],
|
||||
|
||||
Command->Angles[1]
|
||||
};
|
||||
float Move_Angles[3] = { Command->Angles[0], Command->Angles[1] };
|
||||
|
||||
static float Previous_Move_Angle_Y;
|
||||
|
||||
@@ -142,10 +137,6 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
||||
Previous_Move_Angle_Y = Move_Angles[1];
|
||||
}
|
||||
|
||||
float Previous_Move[2];
|
||||
|
||||
Byte_Manager::Copy_Bytes(1, Previous_Move, sizeof(Previous_Move), Command->Move);
|
||||
|
||||
float Desired_Move_Forward[3];
|
||||
|
||||
float Desired_Move_Right[3];
|
||||
@@ -412,9 +403,9 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
||||
|
||||
struct Target_Time_Structure
|
||||
{
|
||||
float Server[2];
|
||||
float Server;
|
||||
|
||||
__int32 Client[2];
|
||||
__int32 Client;
|
||||
};
|
||||
|
||||
static std::unordered_map<__int32, Target_Time_Structure> Target_Times;
|
||||
@@ -464,7 +455,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
||||
|
||||
if (Target.Priority == 0)
|
||||
{
|
||||
__int8 Dormant = 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);
|
||||
__int8 Dormant = Target_Times[Entity_Number].Server * (Target_Times[Entity_Number].Client + (__int32)(0.5f / Global_Variables->Interval_Per_Tick + 0.5f) > *(__int32*)((unsigned __int32)Engine_Module + 6905340)) == Get_Target_Time(&Target);
|
||||
|
||||
if (Weapon_Identifier * Dormant == 153)
|
||||
{
|
||||
@@ -523,28 +514,15 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
||||
|
||||
Get_Eye_Position_Type((unsigned __int32)Client_Module + 108512)(Local_Player, Eye_Position);
|
||||
|
||||
auto Set_Target_Time = [&](Target_Structure* Target, __int8 Restore) -> void
|
||||
auto Set_Target_Time = [&](Target_Structure* Target) -> void
|
||||
{
|
||||
Target_Time_Structure* Time = &Target_Times[*(__int32*)((unsigned __int32)Target->Self + 88)];
|
||||
|
||||
if (Restore == 0)
|
||||
if (Time->Server != Get_Target_Time(Target))
|
||||
{
|
||||
Time->Server[1] = Time->Server[0];
|
||||
Time->Server = Get_Target_Time(Target);
|
||||
|
||||
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];
|
||||
Time->Client = *(__int32*)((unsigned __int32)Engine_Module + 6905340);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -674,8 +652,6 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
||||
|
||||
Cancelable_Shove = (Gender * Interface_Riot_Deprioritize.Integer * (Forced ^ 1)) == 15;
|
||||
|
||||
Set_Target_Time(Target, 0);
|
||||
|
||||
goto Shove_Found_Target_Label;
|
||||
}
|
||||
|
||||
@@ -705,6 +681,8 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
||||
{
|
||||
if (Reviving + (Can_Attack ^ 1) == 0)
|
||||
{
|
||||
float Pellet_Offset[2] = { };
|
||||
|
||||
Target_Structure* Aim_Target = nullptr;
|
||||
|
||||
if (Is_Melee == 0)
|
||||
@@ -713,17 +691,25 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
||||
|
||||
if (Weapon_Identifier == 2)
|
||||
{
|
||||
Command->Command_Number = -2134739495;
|
||||
Command->Command_Number = 681986290;
|
||||
|
||||
Command->Random_Seed = 11144000;
|
||||
Command->Random_Seed = 2012120776;
|
||||
|
||||
Pellet_Offset[0] = -0.60609853f;
|
||||
|
||||
Pellet_Offset[1] = -0.08457297f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Weapon_Identifier == 148)
|
||||
{
|
||||
Command->Command_Number = -2139542887;
|
||||
Command->Command_Number = 1304344125;
|
||||
|
||||
Command->Random_Seed = 1246243990;
|
||||
Command->Random_Seed = 1948230308;
|
||||
|
||||
Pellet_Offset[0] = -0.301083f;
|
||||
|
||||
Pellet_Offset[1] = -0.49009472f;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -735,11 +721,28 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((163 - Weapon_Identifier ^ Weapon_Identifier - 162) == 1)
|
||||
if (Weapon_Identifier == 162)
|
||||
{
|
||||
Command->Command_Number = -847029837;
|
||||
|
||||
Command->Random_Seed = 74353963;
|
||||
|
||||
Pellet_Offset[0] = -0.02511403;
|
||||
|
||||
Pellet_Offset[1] = 0.1230706f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Weapon_Identifier == 163)
|
||||
{
|
||||
Command->Command_Number = -2139097805;
|
||||
|
||||
Command->Random_Seed = 494641349;
|
||||
|
||||
Pellet_Offset[0] = -0.23628435f;
|
||||
|
||||
Pellet_Offset[1] = -0.09043737f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -874,25 +877,25 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
||||
Target_Origin[2] - Eye_Position[2]
|
||||
};
|
||||
|
||||
Vector_Normalize(Direction);
|
||||
|
||||
float Angles[3] =
|
||||
{
|
||||
__builtin_atan2f(-Direction[2], __builtin_hypotf(Direction[0], Direction[1])) * 180.f / 3.1415927f,
|
||||
__builtin_atan2f(-Direction[2], __builtin_hypotf(Direction[0], Direction[1])) * 180.f / 3.1415927f - Pellet_Offset[0],
|
||||
|
||||
__builtin_atan2f(Direction[1], Direction[0]) * 180.f / 3.1415927f
|
||||
__builtin_atan2f(Direction[1], Direction[0]) * 180.f / 3.1415927f - Pellet_Offset[1]
|
||||
};
|
||||
|
||||
if (Perform_Trace(Angles) == 1)
|
||||
{
|
||||
Command->Tick_Number = Target->Tick_Number;
|
||||
|
||||
Byte_Manager::Copy_Bytes(1, Command->Angles, sizeof(Angles), Angles);
|
||||
Command->Angles[0] = Angles[0] + Pellet_Offset[0];
|
||||
|
||||
Command->Angles[1] = Angles[1] + Pellet_Offset[1];
|
||||
|
||||
Command->Angles[2] = Angles[2];
|
||||
|
||||
Command->Buttons |= 1;
|
||||
|
||||
Set_Target_Time(Target, 0);
|
||||
|
||||
goto Aim_Found_Target_Label;
|
||||
}
|
||||
}
|
||||
@@ -912,14 +915,11 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
||||
|
||||
if ((Command->Buttons & 1) == 1)
|
||||
{
|
||||
if (Shove_Target != nullptr)
|
||||
{
|
||||
Set_Target_Time(Shove_Target, 1);
|
||||
Shove_Target = nullptr;
|
||||
|
||||
if (Aim_Target != nullptr)
|
||||
{
|
||||
Set_Target_Time(Aim_Target, 0);
|
||||
}
|
||||
Set_Target_Time(Aim_Target);
|
||||
}
|
||||
|
||||
if (Is_Melee == 0)
|
||||
@@ -932,9 +932,9 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
||||
|
||||
float* Recoil = (float*)((unsigned __int32)Local_Player + 4612);
|
||||
|
||||
Command->Angles[0] -= Random_Type((unsigned __int32)Client_Module + 1756592)((char*)"CTerrorGun::FireBullet HorizSpread", -Maximum_Spread, Maximum_Spread, nullptr) + Recoil[0];
|
||||
Command->Angles[0] -= Random_Type((unsigned __int32)Client_Module + 1756592)((char*)"CTerrorGun::FireBullet HorizSpread", -Maximum_Spread, Maximum_Spread, nullptr) + Pellet_Offset[0] + Recoil[0];
|
||||
|
||||
Command->Angles[1] -= Random_Type((unsigned __int32)Client_Module + 1756592)((char*)"CTerrorGun::FireBullet VertSpread", -Maximum_Spread, Maximum_Spread, nullptr) + Recoil[1];
|
||||
Command->Angles[1] -= Random_Type((unsigned __int32)Client_Module + 1756592)((char*)"CTerrorGun::FireBullet VertSpread", -Maximum_Spread, Maximum_Spread, nullptr) + Pellet_Offset[1] + Recoil[1];
|
||||
|
||||
Command->Angles[2] -= Recoil[2];
|
||||
}
|
||||
@@ -950,6 +950,11 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
||||
Block_Buttons = 2048 * (Cancelable_Shove == 1) + (Can_Attack ^ 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (Shove_Target != nullptr)
|
||||
{
|
||||
Set_Target_Time(Shove_Target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -957,8 +962,6 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
||||
|
||||
Command->Buttons &= ~Block_Buttons;
|
||||
|
||||
Byte_Manager::Copy_Bytes(1, Command->Move, sizeof(Previous_Move), Previous_Move);
|
||||
|
||||
Correct_Movement();
|
||||
|
||||
*(__int8*)((unsigned __int32)__builtin_frame_address(0) + 235) = max(Extra_Commands <= 0, *(__int32*)((unsigned __int32)Network_Channel + 16) == -1);
|
||||
|
||||
@@ -45,7 +45,7 @@ void __thiscall Redirected_Paint(void* Panel)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__builtin_sqrtf(Target.Distance) <= Interface_Equipment_Distance.Floating_Point)
|
||||
if (Target.Distance <= __builtin_powf(Interface_Equipment_Distance.Floating_Point, 2.f))
|
||||
{
|
||||
Sorted_Target_List.push_back(Target);
|
||||
}
|
||||
|
||||
+1
-5
@@ -4,11 +4,7 @@ void __thiscall Redirected_Spawn_Grenade(void* Entity)
|
||||
{
|
||||
using Set_Size_Type = void(__thiscall*)(void* Entity, float* Minimum, float* Maximum);
|
||||
|
||||
float Minimum[3] = { -16.f, -16.f, -16.f };
|
||||
|
||||
float Maximum[3] = { 16.f, 16.f, 16.f };
|
||||
|
||||
Set_Size_Type((unsigned __int32)Client_Module + 281664)(Entity, Minimum, Maximum);
|
||||
Set_Size_Type((unsigned __int32)Client_Module + 281664)(Entity, (float[3]){ -16.f, -16.f, -16.f }, (float[3]){ 16.f, 16.f, 16.f });
|
||||
|
||||
(decltype(&Redirected_Spawn_Grenade)(Original_Spawn_Grenade_Caller))(Entity);
|
||||
}
|
||||
Reference in New Issue
Block a user