shotgun seeds (dumped from aw. noop), mindamage (almost)

This commit is contained in:
explorer 2024-10-12 05:19:00 +03:00
parent 9e8f4ae26e
commit 3dab45c4aa
9 changed files with 455 additions and 274 deletions

View File

@ -33,7 +33,9 @@ void* Original_Copy_Command_Caller;
void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structure* Command)
{
Extended_Command_Structure* Extended_Command = &Extended_Commands[Command->Command_Number % 150];
Command->Frame_Number = Command->Command_Number % 150;
Extended_Command_Structure* Extended_Command = &Extended_Commands[Command->Frame_Number];
Extended_Command->Extra_Commands = 0;
@ -292,7 +294,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
{
if (Identifier == 277)
{
if (*(float*)((unsigned __int32)Entity + 4844) == 1)
//if (*(float*)((unsigned __int32)Entity + 4844) == 1)
{
Sorted_Target_List.push_back(Target);
}
@ -366,7 +368,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
__int8 Forced = 0;
if (Is_Melee + Healing != 0)
if (Is_Melee + Healing != 0) //zero clip?
{
if ((Target->Identifier ^ 72) % 348 >= 72)
{
@ -409,11 +411,13 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
*(__int32*)((unsigned __int32)Weapon + 3248) = 0;
Perform_Trace_Target = (void*)((unsigned __int32)Target->Self ^ 1);
Perform_Trace_Target = Target->Self;
Perform_Trace_Damage = 0;
Perform_Shove_Trace((unsigned __int32)Client_Module + 3220512)(Weapon, Direction);
if (Perform_Trace_Target == Target->Self)
if (Perform_Trace_Damage == 1)
{
Command->Tick_Number = Target->Tick_Number;
@ -465,158 +469,12 @@ 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);
if (Can_Attack == 1)
if ((Can_Attack == 0) + (Weapon_Identifier == 96) + Healing == 0)
{
if (Weapon_Identifier != 96)
Target_Structure* Aim_Target = nullptr;
if (Is_Melee == 0)
{
Target_Structure* Aim_Target = nullptr;
if (Is_Melee + Healing == 0)
{
Target_Number = 0;
Aim_Traverse_Sorted_Target_List_Label:
{
if (Target_Number != Sorted_Target_List.size())
{
Target_Structure* Target = &Sorted_Target_List.at(Target_Number);
float Bones[128][3][4];
void* Hitbox_Set = Get_Hitbox_Set(Target, Bones, Global_Variables->Current_Time);
if (Hitbox_Set != nullptr)
{
auto Perform_Trace = [&](float* Angles) -> __int8
{
using Fire_Bullet_Type = void(__thiscall*)(void* Player, float X, float Y, float Z, float* Angles, __int32 Identifier, void* Unknown_Parameter);
__int32 Bullets = *(__int32*)((unsigned __int32)Weapon_Data + 2520);
*(__int32*)((unsigned __int32)Weapon_Data + 2520) = 1;
Perform_Trace_Target = (void*)((unsigned __int32)Target->Self ^ 1);
void* Previous_Audio_Device = *(void**)((unsigned __int32)Engine_Module + 5050008);
*(void**)((unsigned __int32)Engine_Module + 5050008) = nullptr;
*(__int32*)((unsigned __int32)Client_Module + 7683464) = 1;
*(__int32*)((unsigned __int32)Client_Module + 8175320) = 0;
*(__int32*)((unsigned __int32)Client_Module + 8175392) = 0;
using Get_Weapon_Identifier_Type = __int32(__thiscall**)(void* Weapon);
Fire_Bullet_Type((unsigned __int32)Client_Module + 3103776)(Local_Player, Eye_Position[0], Eye_Position[1], Eye_Position[2], Angles, (*Get_Weapon_Identifier_Type(*(unsigned __int32*)Weapon + 1532))(Weapon), nullptr);
*(__int32*)((unsigned __int32)Client_Module + 8175392) = 1;
*(__int32*)((unsigned __int32)Client_Module + 8175320) = 1;
*(__int32*)((unsigned __int32)Client_Module + 7683464) = 0;
*(void**)((unsigned __int32)Engine_Module + 5050008) = Previous_Audio_Device;
*(__int32*)((unsigned __int32)Weapon_Data + 2520) = Bullets;
return Perform_Trace_Target == Target->Self;
};
static std::unordered_map<__int32, __int32> Hitboxes =
{
{ 0, 10 },
{ 13, 0 },
{ 99, 9 },
{ 263, 10 },
{ 264, 15 },
{ 265, 4 },
{ 270, 10 },
{ 272, 4 },
{ 276, 12 },
{ 277, 10 }
};
void* Hitbox = (void*)((unsigned __int32)Hitbox_Set + 12 + Hitboxes[Target->Identifier] * 68);
float* Hitbox_Minimum = (float*)((unsigned __int32)Hitbox + 8);
float* Hitbox_Maximum = (float*)((unsigned __int32)Hitbox + 20);
float Hitbox_Center[3]
{
(Hitbox_Minimum[0] + Hitbox_Maximum[0]) / 2,
(Hitbox_Minimum[1] + Hitbox_Maximum[1]) / 2,
(Hitbox_Minimum[2] + Hitbox_Maximum[2]) / 2
};
float Target_Origin[3] =
{
Bones[*(__int32*)Hitbox][0][0] * Hitbox_Center[0] + Bones[*(__int32*)Hitbox][0][1] * Hitbox_Center[1] + Bones[*(__int32*)Hitbox][0][2] * Hitbox_Center[2] + Bones[*(__int32*)Hitbox][0][3],
Bones[*(__int32*)Hitbox][1][0] * Hitbox_Center[0] + Bones[*(__int32*)Hitbox][1][1] * Hitbox_Center[1] + Bones[*(__int32*)Hitbox][1][2] * Hitbox_Center[2] + Bones[*(__int32*)Hitbox][1][3],
Bones[*(__int32*)Hitbox][2][0] * Hitbox_Center[0] + Bones[*(__int32*)Hitbox][2][1] * Hitbox_Center[1] + Bones[*(__int32*)Hitbox][2][2] * Hitbox_Center[2] + Bones[*(__int32*)Hitbox][2][3]
};
float Direction[3] =
{
Target_Origin[0] - Eye_Position[0],
Target_Origin[1] - Eye_Position[1],
Target_Origin[2] - Eye_Position[2]
};
Vector_Normalize(Direction);
float Angles[3] =
{
__builtin_atan2f(-Direction[2], __builtin_hypotf(Direction[0], Direction[1])) * 180 / 3.1415927f,
__builtin_atan2f(Direction[1], Direction[0]) * 180 / 3.1415927f,
0
};
if (Perform_Trace(Angles) == 1)
{
Command->Tick_Number = Target->Tick_Number;
Byte_Manager::Copy_Bytes(0, Command->Angles, sizeof(Angles), Angles);
Command->Buttons |= 1;
*(float*)((unsigned __int32)Target->Self + 16) = Get_Target_Time(Target);
goto Aim_Found_Target_Label;
}
}
Target_Number += 1;
goto Aim_Traverse_Sorted_Target_List_Label;
Aim_Found_Target_Label:
{
Aim_Target = Target;
}
}
}
}
__int8 Compensate_Burst = 0;
if (Weapon_Identifier == 153)
@ -629,44 +487,227 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
}
}
if ((Command->Buttons & 1) == 1)
if (Weapon_Identifier == 2)
{
if (Shove_Target != nullptr)
{
*(float*)((unsigned __int32)Shove_Target->Self + 16) = 0;
Command->Command_Number = -2134739495;
if (Aim_Target != nullptr)
{
*(float*)((unsigned __int32)Aim_Target->Self + 16) = Get_Target_Time(Aim_Target);
}
}
if (Is_Melee == 0)
{
*(__int32*)((unsigned __int32)Client_Module + 7075944) = Command->Random_Seed;
using Random_Type = float(__cdecl*)(char* Name, float Minimum, float Maximum, void* Unknown_Parameter);
using Update_Spread_Type = void(__thiscall*)(void* Weapon);
if (Compensate_Burst == 0)
{
Update_Spread_Type((unsigned __int32)Client_Module + 3197648)(Weapon);
}
float Maximum_Spread = *(float*)((unsigned __int32)Weapon + 3340);
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[1] -= Random_Type((unsigned __int32)Client_Module + 1756592)((char*)"CTerrorGun::FireBullet VertSpread", -Maximum_Spread, Maximum_Spread, nullptr) + Recoil[1];
Command->Angles[2] -= Recoil[2];
}
Block_Buttons = 2048;
Command->Random_Seed = 11144000;
}
else
{
if (Weapon_Identifier == 148)
{
Command->Command_Number = -2139542887;
Command->Random_Seed = 1246243990;
}
else
{
if ((163 - Weapon_Identifier ^ Weapon_Identifier - 162) == 1)
{
Command->Command_Number = -2139097805;
Command->Random_Seed = 494641349;
}
}
}
using Update_Spread_Type = void(__thiscall*)(void* Weapon);
if (Compensate_Burst == 0)
{
Update_Spread_Type((unsigned __int32)Client_Module + 3197648)(Weapon);
}
Target_Number = 0;
Aim_Traverse_Sorted_Target_List_Label:
{
if (Target_Number != Sorted_Target_List.size())
{
Target_Structure* Target = &Sorted_Target_List.at(Target_Number);
float Bones[128][3][4];
void* Hitbox_Set = Get_Hitbox_Set(Target, Bones, Global_Variables->Current_Time);
if (Hitbox_Set != nullptr)
{
auto Perform_Trace = [&](float* Angles) -> __int8
{
using Fire_Bullet_Type = void(__thiscall*)(void* Player, float X, float Y, float Z, float* Angles, __int32 Identifier, void* Unknown_Parameter);
__int32 Bullets = *(__int32*)((unsigned __int32)Weapon_Data + 2520);
if (Interface_Penetration_Damage.Floating_Point == 0)
{
*(__int32*)((unsigned __int32)Weapon_Data + 2520) = 1;
}
Perform_Trace_Target = Target->Self;
Perform_Trace_Damage = 0;
void* Previous_Audio_Device = *(void**)((unsigned __int32)Engine_Module + 5050008);
*(void**)((unsigned __int32)Engine_Module + 5050008) = nullptr;
*(__int32*)((unsigned __int32)Client_Module + 7075944) = Command->Random_Seed;
*(__int32*)((unsigned __int32)Client_Module + 7683464) = 1;
*(__int32*)((unsigned __int32)Client_Module + 7689576) = 0;
*(__int32*)((unsigned __int32)Client_Module + 8175320) = 0;
*(__int32*)((unsigned __int32)Client_Module + 8175392) = 0;
using Get_Weapon_Identifier_Type = __int32(__thiscall**)(void* Weapon);
Fire_Bullet_Type((unsigned __int32)Client_Module + 3103776)(Local_Player, Eye_Position[0], Eye_Position[1], Eye_Position[2], Angles, (*Get_Weapon_Identifier_Type(*(unsigned __int32*)Weapon + 1532))(Weapon), nullptr);
*(__int32*)((unsigned __int32)Client_Module + 8175392) = 1;
*(__int32*)((unsigned __int32)Client_Module + 8175320) = 1;
*(__int32*)((unsigned __int32)Client_Module + 7689576) = 1;
*(__int32*)((unsigned __int32)Client_Module + 7683464) = 0;
*(void**)((unsigned __int32)Engine_Module + 5050008) = Previous_Audio_Device;
*(__int32*)((unsigned __int32)Weapon_Data + 2520) = Bullets;
Perform_Trace_Target = nullptr;
wprintf(L"%f\n", Perform_Trace_Damage);
return (Perform_Trace_Damage >= Interface_Penetration_Damage.Floating_Point) * (Perform_Trace_Damage != 0);
};
static std::unordered_map<__int32, __int32> Hitboxes =
{
{ 0, 10 },
{ 13, 0 },
{ 99, 9 },
{ 263, 10 },
{ 264, 15 },
{ 265, 4 },
{ 270, 10 },
{ 272, 4 },
{ 276, 12 },
{ 277, 10 }
};
void* Hitbox = (void*)((unsigned __int32)Hitbox_Set + 12 + Hitboxes[Target->Identifier] * 68);
float* Hitbox_Minimum = (float*)((unsigned __int32)Hitbox + 8);
float* Hitbox_Maximum = (float*)((unsigned __int32)Hitbox + 20);
float Hitbox_Center[3]
{
(Hitbox_Minimum[0] + Hitbox_Maximum[0]) / 2,
(Hitbox_Minimum[1] + Hitbox_Maximum[1]) / 2,
(Hitbox_Minimum[2] + Hitbox_Maximum[2]) / 2
};
float Target_Origin[3] =
{
Bones[*(__int32*)Hitbox][0][0] * Hitbox_Center[0] + Bones[*(__int32*)Hitbox][0][1] * Hitbox_Center[1] + Bones[*(__int32*)Hitbox][0][2] * Hitbox_Center[2] + Bones[*(__int32*)Hitbox][0][3],
Bones[*(__int32*)Hitbox][1][0] * Hitbox_Center[0] + Bones[*(__int32*)Hitbox][1][1] * Hitbox_Center[1] + Bones[*(__int32*)Hitbox][1][2] * Hitbox_Center[2] + Bones[*(__int32*)Hitbox][1][3],
Bones[*(__int32*)Hitbox][2][0] * Hitbox_Center[0] + Bones[*(__int32*)Hitbox][2][1] * Hitbox_Center[1] + Bones[*(__int32*)Hitbox][2][2] * Hitbox_Center[2] + Bones[*(__int32*)Hitbox][2][3]
};
float Direction[3] =
{
Target_Origin[0] - Eye_Position[0],
Target_Origin[1] - Eye_Position[1],
Target_Origin[2] - Eye_Position[2]
};
Vector_Normalize(Direction);
float Angles[3] =
{
__builtin_atan2f(-Direction[2], __builtin_hypotf(Direction[0], Direction[1])) * 180 / 3.1415927f,
__builtin_atan2f(Direction[1], Direction[0]) * 180 / 3.1415927f,
0
};
if (Perform_Trace(Command->Angles) == 1)
{
Command->Tick_Number = Target->Tick_Number;
//Byte_Manager::Copy_Bytes(0, Command->Angles, sizeof(Angles), Angles);
//Command->Buttons |= 1;
*(float*)((unsigned __int32)Target->Self + 16) = Get_Target_Time(Target);
goto Aim_Found_Target_Label;
}
}
Target_Number += 1;
goto Aim_Traverse_Sorted_Target_List_Label;
Aim_Found_Target_Label:
{
Aim_Target = Target;
}
}
}
}
if ((Command->Buttons & 1) == 1)
{
if (Shove_Target != nullptr)
{
*(float*)((unsigned __int32)Shove_Target->Self + 16) = 0;
if (Aim_Target != nullptr)
{
*(float*)((unsigned __int32)Aim_Target->Self + 16) = Get_Target_Time(Aim_Target);
}
}
if (Is_Melee == 0)
{
*(__int32*)((unsigned __int32)Client_Module + 7075944) = Command->Random_Seed;
using Random_Type = float(__cdecl*)(char* Name, float Minimum, float Maximum, void* Unknown_Parameter);
float Maximum_Spread = *(float*)((unsigned __int32)Weapon + 3340);
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[1] -= Random_Type((unsigned __int32)Client_Module + 1756592)((char*)"CTerrorGun::FireBullet VertSpread", -Maximum_Spread, Maximum_Spread, nullptr) + Recoil[1];
Command->Angles[2] -= Recoil[2];
}
Block_Buttons = 2048;
}
}

View File

@ -181,6 +181,14 @@ __int32 __stdcall DllMain(HMODULE This_Module, unsigned __int32 Call_Reason, voi
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");
{
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

@ -42,6 +42,8 @@ __int32 Get_Identifier(void* Entity, __int8 Raw, __int8 Equipment)
if (Identifier == 13)
{
*(__int32*)((unsigned __int32)Entity + 228) = 1;
Valid = *(__int8*)((unsigned __int32)Entity + 324) == 5;
}
else

View File

@ -79,7 +79,7 @@ void __thiscall Redirected_Paint(void* Panel)
{
Target_Structure* Target = &Sorted_Target_List.at(Target_Number);
float Bounds[4] = { FLT_MAX, FLT_MIN, FLT_MAX, FLT_MIN };
float Bounds[4] = { __builtin_inff(), -__builtin_inff(), __builtin_inff(), -__builtin_inff()};
auto Get_Bounds = [&]() -> __int8
{

View File

@ -2,9 +2,11 @@ void __thiscall Perform_Shove_Trace(void* Stack)
{
void* Entity = *(void**)((unsigned __int32)Stack - 276);
if (Entity == (void*)((unsigned __int32)Perform_Trace_Target ^ 1))
if (Entity == Perform_Trace_Target)
{
Perform_Trace_Target = Entity;
Perform_Trace_Target = nullptr;
Perform_Trace_Damage = 1;
}
}

View File

@ -1,24 +1,5 @@
void* Perform_Trace_Target;
__declspec(noinline) float Calculate_Damage(void* Weapon_Data, float Distance)
{
static void* Calculate_Damage = (void*)((unsigned __int32)GetModuleHandleW(L"server.dll") + 3950416);
float Damage;
asm("pushl %esi");
asm("movl %0, %%esi" : : "m"(Weapon_Data));
asm("subl $16, %esp");
asm("movss %0, %%xmm0" : : "m"(Distance) : "esp");
asm("movdqu %xmm0, (%esp)");
asm("calll *%0" : : "m"(Calculate_Damage));
asm("movd %%xmm0, %0" : "=m"(Damage));
asm("addl $16, %esp");
asm("popl %esi");
return Damage;
}
float Vector_Normalize(float* Vector)
{
using Vector_Normalize_Type = float(__thiscall*)(float* Vector);
@ -33,6 +14,8 @@ void Angle_Vectors(float* Angles, float* Forward, float* Right, float* Up)
Angle_Vectors_Type((unsigned __int32)Client_Module + 3539376)(Angles, Forward, Right, Up);
};
float Perform_Trace_Damage;
void __thiscall Perform_Trace(void* Stack)
{
void* Entity = *(void**)((unsigned __int32)Stack + 312);
@ -50,7 +33,7 @@ void __thiscall Perform_Trace(void* Stack)
}
}
if (Entity == (void*)((unsigned __int32)Perform_Trace_Target ^ 1))
if (Entity == Perform_Trace_Target)
{
__int32 Group = *(__int32*)((unsigned __int32)Stack + 304);
@ -62,84 +45,229 @@ void __thiscall Perform_Trace(void* Stack)
}
}
float* End = (float*)((unsigned __int32)Stack + 248);
void* Trace_Information = *(void**)((unsigned __int32)Stack + 36);
if (Interface_Penetration_Damage.Integer != 0) //that's very cutted version of actual function [*::TraceAttack]
void* Weapon_Data = *(void**)((unsigned __int32)Trace_Information + 4);
float* End = (float*)((unsigned __int32)Stack + 248);
__int32 Upgrade_Type = (*(__int32*)((unsigned __int32)Trace_Information + 36) & 255) % 5;
__int32 Gender = *(__int32*)((unsigned __int32)Entity + 52);
auto Compute_Damage = [&]() -> void
{
float* Start = (float*)((unsigned __int32)Stack + 236);
float Damage = Calculate_Damage(*(void**)((unsigned __int32)Trace_Information + 4), __builtin_sqrtf(__builtin_powf(End[0] - Start[0], 2) + __builtin_powf(End[1] - Start[1], 2) + __builtin_powf(End[2] - Start[2], 2)));
__int32 Identifier = Get_Identifier(Entity, 1, 0);
auto Apply_Difficulty_Scaling = [&]() -> void
if (Interface_Penetration_Damage.Integer == 0)
{
using Get_Difficulty_Type = __int32(__cdecl*)();
//z_non_head_damage_factor_* (non-replicated unfortunately)
//assuming "z_use_next_difficulty_damage_factor" is "1" and "maxplayers" is not "1"
float Multipliers[4] = { 0.8f, 0.7f, 0.6f, 1.f };
Damage *= Multipliers[Get_Difficulty_Type((unsigned __int32)Client_Module + 2650448)()];
};
if (Identifier == 277) //special scaling used by witches
{
if (Group != 1)
{
Apply_Difficulty_Scaling();
}
Perform_Trace_Damage = 1;
}
else
{
if (Identifier == 264) //special scaling used by common infected
float* Start = (float*)((unsigned __int32)Stack + 236);
float Distance = __builtin_sqrtf(__builtin_powf(End[0] - Start[0], 2) + __builtin_powf(End[1] - Start[1], 2) + __builtin_powf(End[2] - Start[2], 2));
float Damage;
static void* Calculate_Damage = (void*)((unsigned __int32)GetModuleHandleW(L"server.dll") + 3950416);
{
if (Identifier * Group == 264) //these are killed instantly on headshot
asm("pushal"); //temporary. just in case
asm("movl %0, %%esi" : : "m"(Weapon_Data) : "esi");
asm("subl $16, %esp");
asm("movss %0, %%xmm0" : : "m"(Distance) : "esp");
asm("movdqu %xmm0, (%esp)");
asm("calll *%0" : : "m"(Calculate_Damage));
asm("movd %%xmm0, %0" : "=m"(Damage));
asm("addl $16, %esp");
asm("popal");
}
__int32 Identifier = Get_Identifier(Entity, 1, 0);
auto Apply_Difficulty_Scaling = [&]() -> void
{
using Get_Difficulty_Type = __int32(__cdecl*)();
float Multipliers[3] = { 0.8f, 0.7f, 0.6f };
Damage *= Multipliers[Get_Difficulty_Type((unsigned __int32)Client_Module + 2650448)()];
};
__int32 Bullet_Type = *(__int32*)((unsigned __int32)Weapon_Data + 2128);
__int8 Is_Shotgun = (Bullet_Type ^ 12) % 7 == 4;
//should make sure it's not mutation8, mutation12, realism
auto Apply_Shotgun_Scaling = [&]() -> void
{
if (Is_Shotgun == 1)
{
Damage = FLT_MAX;
using Compute_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];
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);
}
}
else
};
if (Identifier == 277)
{
//nb_delete_all;z_spawn witch
if (Group != 1)
{
Apply_Difficulty_Scaling();
//tbi: some guns are using special scaling (e.g. deagle)
}
}
else //special scaling used by non-common infected
{
if (*(__int32*)((unsigned __int32)Trace_Information + 36) != -2139094974) //explosives are doing "radial" damage instead
{
if (Identifier != 276) //tanks aren't scaled
{
Damage *= 1.f + 3.f * (Group == 1) + 0.25f * (Group == 3) - 0.25f * (Group == 7); //or: 0.25f * ((Group == 3) + -(Group == 7))
if (Identifier * Group == 270) //killed instantly on **hooked** headshot
Apply_Shotgun_Scaling();
}
else
{
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
//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();
}
else
{
if (Upgrade_Type == 1)
{
if (*(void**)((unsigned __int32)Entity + 8040) != INVALID_HANDLE_VALUE)
Damage = __builtin_inff();
}
else
{
Apply_Shotgun_Scaling();
__int8 Is_Sniper_Rifle = Bullet_Type == 9 || Bullet_Type == 10;
if (Group == 1)
{
Damage = FLT_MAX;
if (Gender == 14)
{
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)
{
return (536870929 & (1 << (Absolute_Sequence_Activity & 31))) != 0;
}
return (Sequence_Activity == 600) + (Sequence_Activity == 648);
};
if (Is_Neutral() == 1)
{
Damage = __builtin_inff();
}
}
else
{
if (Gender != 17)
{
Damage = __builtin_inff();
}
}
}
else
{
if (Is_Shotgun * (Group == 3) == 1)
{
Damage = __builtin_inff();
}
else
{
Apply_Difficulty_Scaling();
if (Bullet_Type == 2 || Is_Sniper_Rifle == 1)
{
if (Gender == 14)
{
Damage = 450;
}
else
{
Damage = __builtin_inff();
}
}
else
{
if (Bullet_Type >= 6)
{
if ((Bullet_Type - 3) % 4 > 1)
{
Damage = __builtin_inff();
}
}
}
}
}
}
}
}
else
{
if (Identifier != 13)
{
//nb_delete_all;z_spawn tank
if (Identifier + Bullet_Type == 284)
{
Damage *= 0.85f;
}
Damage = (__int32)(Damage + 1.f * (Damage < 1)); //rounding isn't applied to common infected or witches. make sure damage isn't zero before rounding
if (Upgrade_Type != 1)
{
if (Identifier != 276)
{
Damage *= 1.f + 3.f * (Group == 1) + 0.25f * ((Group == 3) + -(Group == 7));
if (Identifier * Group == 270)
{
if (*(void**)((unsigned __int32)Entity + 8040) != INVALID_HANDLE_VALUE)
{
Damage = __builtin_inff();
}
}
}
}
Damage = (__int32)(Damage + 1.f * (Damage < 1));
}
}
}
//actual shotgun multiplications (z_shotgun_bonus_damage_multiplier, z_shotgun_bonus_damage_range) would require extraneous tracing... so they're not here for moment
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;
}
};
wprintf(L"hitgroup %d -> damage %f\n", Group, Damage); //compared to 'picker' output (along with nb_stop 1), since it's unfinished feature
if (Damage < Interface_Penetration_Damage.Floating_Point)
{
return;
}
}
if ((*(__int32*)((unsigned __int32)Trace_Information + 36) & 255) + *(__int32*)((unsigned __int32)Entity + 52) == 17)
if (Upgrade_Type + Gender == 17)
{
float Inflictor_Direction[3];
@ -169,12 +297,12 @@ void __thiscall Perform_Trace(void* Stack)
if (Inflictor_Direction[0] * Victim_Direction[0] + Inflictor_Direction[1] * Victim_Direction[1] + Inflictor_Direction[2] * Victim_Direction[2] >= 0)
{
Perform_Trace_Target = Entity;
Compute_Damage();
}
}
else
{
Perform_Trace_Target = Entity;
Compute_Damage();
}
}
}

View File

@ -8,7 +8,9 @@ struct Command_Structure
float Angles[3];
float Move[3];
float Move[2];
__int32 Frame_Number;
__int32 Buttons;
@ -28,7 +30,7 @@ void* Original_Run_Command_Caller;
void __thiscall Redirected_Run_Command(void* Prediction, void* Player, Command_Structure* Command, void* Unknown_Parameter)
{
Extended_Command_Structure* Extended_Command = &Extended_Commands[Command->Command_Number % 150];
Extended_Command_Structure* Extended_Command = &Extended_Commands[Command->Frame_Number];
*(__int32*)((unsigned __int32)Player + 5324) -= Extended_Command->Extra_Commands;

View File

@ -2,8 +2,6 @@ void* Original_Spawn_Grenade_Caller;
void __thiscall Redirected_Spawn_Grenade(void* Entity)
{
*(__int32*)((unsigned __int32)Entity + 228) = 3;
using Set_Size_Type = void(__thiscall*)(void* Entity, float* Minimum, float* Maximum);
float Minimum[3] =

View File

@ -24,12 +24,12 @@ void __cdecl Redirected_Update_Animations()
if ((*(__int8*)((unsigned __int32)Animation_List + 8 * Entity_Number + 4) & 1) != 0)
{
using Update_Animation_Type = void(__thiscall**)(void* Entity);
void* Entity = *(void**)((unsigned __int32)Animation_List + 8 * Entity_Number);
*(float*)((unsigned __int32)Entity + 328) = Update_Animation_Time - Global_Variables->Frame_Time;
using Update_Animation_Type = void(__thiscall**)(void* Entity);
(*Update_Animation_Type(*(unsigned __int32*)Entity + 808))(Entity);
}