autoshove logic (on reload)

This commit is contained in:
explorer 2024-10-13 05:42:41 +03:00
parent 3dab45c4aa
commit 319fed21a4
5 changed files with 101 additions and 122 deletions

View File

@ -294,7 +294,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
{ {
if (Identifier == 277) if (Identifier == 277)
{ {
//if (*(float*)((unsigned __int32)Entity + 4844) == 1) if (*(float*)((unsigned __int32)Entity + 4844) == 1)
{ {
Sorted_Target_List.push_back(Target); Sorted_Target_List.push_back(Target);
} }
@ -346,6 +346,8 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
__int8 Healing = *(void**)((unsigned __int32)Local_Player + 8076) != INVALID_HANDLE_VALUE; __int8 Healing = *(void**)((unsigned __int32)Local_Player + 8076) != INVALID_HANDLE_VALUE;
__int8 Reloading = *(__int8*)((unsigned __int32)Weapon + 2493);
__int32 Weapon_Identifier = Get_Identifier(Weapon, 1, 0); __int32 Weapon_Identifier = Get_Identifier(Weapon, 1, 0);
__int8 Is_Cold_Melee = Weapon_Identifier == 231; __int8 Is_Cold_Melee = Weapon_Identifier == 231;
@ -368,7 +370,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
__int8 Forced = 0; __int8 Forced = 0;
if (Is_Melee + Healing != 0) //zero clip? if (Is_Melee + Healing + Reloading != 0)
{ {
if ((Target->Identifier ^ 72) % 348 >= 72) if ((Target->Identifier ^ 72) % 348 >= 72)
{ {
@ -417,6 +419,8 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
Perform_Shove_Trace((unsigned __int32)Client_Module + 3220512)(Weapon, Direction); Perform_Shove_Trace((unsigned __int32)Client_Module + 3220512)(Weapon, Direction);
Perform_Trace_Target = nullptr;
if (Perform_Trace_Damage == 1) if (Perform_Trace_Damage == 1)
{ {
Command->Tick_Number = Target->Tick_Number; Command->Tick_Number = Target->Tick_Number;
@ -469,7 +473,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
{ {
__int8 Can_Attack = (*(float*)((unsigned __int32)Weapon + 2400) <= Global_Variables->Current_Time) * (*(__int32*)((unsigned __int32)Weapon + 2436) > 0 - Is_Melee * 2) * (*(float*)((unsigned __int32)Local_Player + 3872) <= Global_Variables->Current_Time); __int8 Can_Attack = (*(float*)((unsigned __int32)Weapon + 2400) <= Global_Variables->Current_Time) * (*(__int32*)((unsigned __int32)Weapon + 2436) > 0 - Is_Melee * 2) * (*(float*)((unsigned __int32)Local_Player + 3872) <= Global_Variables->Current_Time);
if ((Can_Attack == 0) + (Weapon_Identifier == 96) + Healing == 0) if ((Can_Attack ^ 1) + (Weapon_Identifier == 96) + Healing == 0)
{ {
Target_Structure* Aim_Target = nullptr; Target_Structure* Aim_Target = nullptr;
@ -576,11 +580,9 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
*(void**)((unsigned __int32)Engine_Module + 5050008) = Previous_Audio_Device; *(void**)((unsigned __int32)Engine_Module + 5050008) = Previous_Audio_Device;
*(__int32*)((unsigned __int32)Weapon_Data + 2520) = Bullets;
Perform_Trace_Target = nullptr; Perform_Trace_Target = nullptr;
wprintf(L"%f\n", Perform_Trace_Damage); *(__int32*)((unsigned __int32)Weapon_Data + 2520) = Bullets;
return (Perform_Trace_Damage >= Interface_Penetration_Damage.Floating_Point) * (Perform_Trace_Damage != 0); return (Perform_Trace_Damage >= Interface_Penetration_Damage.Floating_Point) * (Perform_Trace_Damage != 0);
}; };
@ -652,13 +654,13 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
0 0
}; };
if (Perform_Trace(Command->Angles) == 1) if (Perform_Trace(Angles) == 1)
{ {
Command->Tick_Number = Target->Tick_Number; Command->Tick_Number = Target->Tick_Number;
//Byte_Manager::Copy_Bytes(0, Command->Angles, sizeof(Angles), Angles); Byte_Manager::Copy_Bytes(0, Command->Angles, sizeof(Angles), Angles);
//Command->Buttons |= 1; Command->Buttons |= 1;
*(float*)((unsigned __int32)Target->Self + 16) = Get_Target_Time(Target); *(float*)((unsigned __int32)Target->Self + 16) = Get_Target_Time(Target);

View File

@ -181,14 +181,6 @@ __int32 __stdcall DllMain(HMODULE This_Module, unsigned __int32 Call_Reason, voi
Client_Module = GetModuleHandleW(L"client.dll"); Client_Module = GetModuleHandleW(L"client.dll");
//DEBUG
{
*(__int32*)((unsigned __int32)Client_Module + 0x7B25A8 + 0x14) &= ~0xA;
*(__int32*)((unsigned __int32)Client_Module + 0x782838 + 0x14) &= ~0xA;
*(__int32*)((unsigned __int32)Client_Module + 0x7803D8 + 0x14) &= ~0xA;
*(__int32*)((unsigned __int32)Engine_Module + 0x679538 + 0x14) &= ~0xA;
}
_putws(L"[ + ] Events"); _putws(L"[ + ] Events");
{ {
Redirection_Manager::Redirect_Function(Original_Post_Network_Data_Received_Caller, 0, (void*)((unsigned __int32)Client_Module + 1555264), 1, (void*)Redirected_Post_Network_Data_Received); Redirection_Manager::Redirect_Function(Original_Post_Network_Data_Received_Caller, 0, (void*)((unsigned __int32)Client_Module + 1555264), 1, (void*)Redirected_Post_Network_Data_Received);

View File

@ -1,10 +1,6 @@
struct Interface_Structure struct Interface_Structure
{ {
__int8 Additional_Bytes_1[36]; __int8 Additional_Bytes_1[44];
char* String;
__int8 Additional_Bytes_2[4];
float Floating_Point; float Floating_Point;
@ -66,7 +62,7 @@ void Implement_Extended_Interface()
Create_Console_Interface(Pointer_Name(Interface_Aim_Intersection), (char*)"1", nullptr); Create_Console_Interface(Pointer_Name(Interface_Aim_Intersection), (char*)"1", nullptr);
Create_Console_Interface(Pointer_Name(Interface_Penetration_Damage), (char*)"25", nullptr); Create_Console_Interface(Pointer_Name(Interface_Penetration_Damage), (char*)"20", nullptr);
Create_Console_Interface(Pointer_Name(Interface_Equipment_Distance), (char*)"2048", nullptr); Create_Console_Interface(Pointer_Name(Interface_Equipment_Distance), (char*)"2048", nullptr);

View File

@ -4,8 +4,6 @@ void __thiscall Perform_Shove_Trace(void* Stack)
if (Entity == Perform_Trace_Target) if (Entity == Perform_Trace_Target)
{ {
Perform_Trace_Target = nullptr;
Perform_Trace_Damage = 1; Perform_Trace_Damage = 1;
} }
} }

View File

@ -71,15 +71,22 @@ void __thiscall Perform_Trace(void* Stack)
static void* Calculate_Damage = (void*)((unsigned __int32)GetModuleHandleW(L"server.dll") + 3950416); static void* Calculate_Damage = (void*)((unsigned __int32)GetModuleHandleW(L"server.dll") + 3950416);
{ {
asm("pushal"); //temporary. just in case
asm("movl %0, %%esi" : : "m"(Weapon_Data) : "esi"); asm("movl %0, %%esi" : : "m"(Weapon_Data) : "esi");
asm("subl $16, %esp"); asm("subl $16, %esp");
asm("movss %0, %%xmm0" : : "m"(Distance) : "esp"); asm("movss %0, %%xmm0" : : "m"(Distance) : "esp");
asm("movdqu %xmm0, (%esp)"); asm("movdqu %xmm0, (%esp)");
asm("calll *%0" : : "m"(Calculate_Damage)); asm("calll *%0" : : "m"(Calculate_Damage) : "eax", "ecx", "edx");
asm("movd %%xmm0, %0" : "=m"(Damage)); asm("movd %%xmm0, %0" : "=m"(Damage));
asm("addl $16, %esp"); asm("addl $16, %esp");
asm("popal"); }
__int32 Bullet_Type = *(__int32*)((unsigned __int32)Weapon_Data + 2128);
__int8 Is_Shotgun = (Bullet_Type ^ 12) % 7 == 4;
if (Upgrade_Type * Is_Shotgun == 1)
{
Damage *= *(__int32*)((unsigned __int32)Weapon_Data + 2520);
} }
__int32 Identifier = Get_Identifier(Entity, 1, 0); __int32 Identifier = Get_Identifier(Entity, 1, 0);
@ -93,39 +100,53 @@ void __thiscall Perform_Trace(void* Stack)
Damage *= Multipliers[Get_Difficulty_Type((unsigned __int32)Client_Module + 2650448)()]; Damage *= Multipliers[Get_Difficulty_Type((unsigned __int32)Client_Module + 2650448)()];
}; };
__int32 Bullet_Type = *(__int32*)((unsigned __int32)Weapon_Data + 2128); char* Mode = *(char**)((unsigned __int32)Client_Module + 8145092);
__int8 Is_Shotgun = (Bullet_Type ^ 12) % 7 == 4; __int8 Realism = Mode[0] == 'r';
//should make sure it's not mutation8, mutation12, realism
auto Apply_Shotgun_Scaling = [&]() -> void auto Apply_Shotgun_Scaling = [&]() -> void
{ {
if (Is_Shotgun == 1) if (Is_Shotgun == 1)
{ {
using Compute_Bounds_Type = void(__thiscall*)(void* Collision, float* Start, float* Bounds); __int8 Casual_Mode = 1;
using Get_Center_Type = float*(__thiscall*)(void* Entity); char* Mode = *(char**)((unsigned __int32)Client_Module + 8145092);
void* Local_Player = *(void**)Trace_Information; if (__builtin_strlen(Mode) > 8)
float Bounds[3];
Compute_Bounds_Type((unsigned __int32)Client_Module + 878528)((void*)((unsigned __int32)Entity + 540), Get_Center_Type((unsigned __int32)Client_Module + 114400)(Local_Player), Bounds);
using Calculate_Distance_Type = float(__thiscall*)(void* Collision, float* Bounds);
float Distance = Calculate_Distance_Type((unsigned __int32)Client_Module + 878608)((void*)((unsigned __int32)Local_Player + 540), Bounds);
if (Distance < 100)
{ {
Damage += (4.f * Damage) * __builtin_powf(1.f - Distance / 100.f, 2); Casual_Mode = (Mode[8] != '8') + (Mode[9] != '2');
}
else
{
Casual_Mode += Realism ^ 1;
}
if (Casual_Mode == 2)
{
using Get_Bounds_Type = void(__thiscall*)(void* Collision, float* Start, float* Bounds);
using Get_Center_Type = float* (__thiscall*)(void* Entity);
void* Local_Player = *(void**)Trace_Information;
float Bounds[3];
Get_Bounds_Type((unsigned __int32)Client_Module + 878528)((void*)((unsigned __int32)Entity + 540), Get_Center_Type((unsigned __int32)Client_Module + 114400)(Local_Player), Bounds);
using Calculate_Distance_Type = float(__thiscall*)(void* Collision, float* Bounds);
float Distance = Calculate_Distance_Type((unsigned __int32)Client_Module + 878608)((void*)((unsigned __int32)Local_Player + 540), Bounds);
if (Distance < 100)
{
Damage += (4.f * Damage) * __builtin_powf(1.f - Distance / 100.f, 2);
}
} }
} }
}; };
if (Identifier == 277) if (Identifier == 277)
{ {
//nb_delete_all;z_spawn witch
if (Group != 1) if (Group != 1)
{ {
Apply_Difficulty_Scaling(); Apply_Difficulty_Scaling();
@ -137,88 +158,69 @@ void __thiscall Perform_Trace(void* Stack)
{ {
if (Identifier == 264) if (Identifier == 264)
{ {
//nb_delete_all;ent_create commentary_zombie_spawner; ent_fire commentary_zombie_spawner spawnzombie common_male_fallen_survivor; ent_fire commentary_zombie_spawner kill if ((Upgrade_Type == 1) + (Bullet_Type == 6))
//id: 14
//nb_delete_all;ent_create commentary_zombie_spawner; ent_fire commentary_zombie_spawner spawnzombie common_male_jimmy; ent_fire commentary_zombie_spawner kill
//id: 17
if (Bullet_Type == 6)
{ {
Damage = __builtin_inff(); Damage = __builtin_inff();
} }
else else
{ {
if (Upgrade_Type == 1) Apply_Shotgun_Scaling();
{
Damage = __builtin_inff();
}
else
{
Apply_Shotgun_Scaling();
__int8 Is_Sniper_Rifle = Bullet_Type == 9 || Bullet_Type == 10; __int8 Is_Sniper_Rifle = (Bullet_Type - 8) > 0;
if (Group == 1) if (Group == 1)
{
if (Gender == 14)
{ {
if (Gender == 14) auto Is_Neutral = [&]() -> __int8
{ {
auto Is_Neutral = [&]() -> __int8 __int32 Sequence_Activity = *(__int32*)((unsigned __int32)Entity + 4688);
unsigned __int32 Absolute_Sequence_Activity = Sequence_Activity - 563;
if (Absolute_Sequence_Activity <= 29)
{ {
__int32 Sequence_Activity = *(__int32*)((unsigned __int32)Entity + 4688); return (536870929 & (1 << (Absolute_Sequence_Activity & 31))) != 0;
unsigned __int32 Absolute_Sequence_Activity = Sequence_Activity - 563;
if (Absolute_Sequence_Activity <= 29)
{
return (536870929 & (1 << (Absolute_Sequence_Activity & 31))) != 0;
}
return (Sequence_Activity == 600) + (Sequence_Activity == 648);
};
if (Is_Neutral() == 1)
{
Damage = __builtin_inff();
} }
}
else return (Sequence_Activity == 600) + (Sequence_Activity == 648);
};
if (Is_Neutral() == 1)
{ {
if (Gender != 17) Damage = __builtin_inff();
{
Damage = __builtin_inff();
}
} }
} }
else else
{ {
if (Gender != 17)
if (Is_Shotgun * (Group == 3) == 1)
{ {
Damage = __builtin_inff(); Damage = __builtin_inff();
} }
else }
{ }
Apply_Difficulty_Scaling(); else
{
if (Group * (Gender != 14) * (Gender != 17) * Is_Shotgun == 3)
{
Damage = __builtin_inff();
}
else
{
Apply_Difficulty_Scaling();
if (Bullet_Type == 2 || Is_Sniper_Rifle == 1) if ((Bullet_Type == 2) + Is_Sniper_Rifle != 0)
{
if (Gender == 14)
{ {
if (Gender == 14) if (Is_Sniper_Rifle * Realism == 0)
{ {
Damage = 450; Damage = 450;
} }
else
{
Damage = __builtin_inff();
}
} }
else else
{ {
if (Bullet_Type >= 6) Damage = __builtin_inff();
{
if ((Bullet_Type - 3) % 4 > 1)
{
Damage = __builtin_inff();
}
}
} }
} }
} }
@ -229,40 +231,29 @@ void __thiscall Perform_Trace(void* Stack)
{ {
if (Identifier != 13) if (Identifier != 13)
{ {
//nb_delete_all;z_spawn tank
if (Identifier + Bullet_Type == 284) if (Identifier + Bullet_Type == 284)
{ {
Damage *= 0.85f; Damage *= 0.85f;
} }
if (Upgrade_Type != 1) if ((Identifier != 276) + (Upgrade_Type != 1) == 2)
{ {
if (Identifier != 276) float Multipliers[8] = { 1.f, 4.f, 1.f, 1.25f, 1.f, 1.f, 0.75f, 0.75f };
{
Damage *= 1.f + 3.f * (Group == 1) + 0.25f * ((Group == 3) + -(Group == 7));
if (Identifier * Group == 270) Damage *= Multipliers[Group];
{
if (*(void**)((unsigned __int32)Entity + 8040) != INVALID_HANDLE_VALUE)
{
Damage = __builtin_inff();
}
}
}
} }
Damage = (__int32)(Damage + 1.f * (Damage < 1)); //CTerrorPlayer::OnTakeDamage
//"AI controlled Chargers take 66% less damage while charging." (CTerrorPlayer::IsCustomAbilityActive)
if (Damage != __builtin_inff())
{
Damage = (__int32)(Damage + 1.f * (Damage < 1));
}
} }
} }
} }
if (Is_Shotgun * Upgrade_Type == 1)
{
Damage *= *(__int32*)((unsigned __int32)Weapon_Data + 2520);
}
wprintf(L"[%d] type %d, %d\n", Group, Bullet_Type, Upgrade_Type);
Perform_Trace_Damage += Damage; Perform_Trace_Damage += Damage;
} }
}; };