shove assist, shotgun shove (finished)

https://www.youtube.com/watch?v=FApMeI1KlVo

shoving is also beneficial during unholstering for ~266.667ms (depends on sequence_duration, z_gun_swing_interval)

that's amended commit (prototype -> finished)
This commit is contained in:
explorer 2024-12-15 12:14:18 +03:00
parent 0381620f7d
commit e2437349a0
4 changed files with 176 additions and 149 deletions

View File

@ -289,6 +289,24 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
}
else
{
__int8 Cancelable_Shove = 1 + (*(float*)((unsigned __int32)Local_Player + 7336) < Global_Variables->Current_Time);
__int32 Weapon_Identifier = Get_Identifier(Weapon, 1, 0);
__int32 Ammo = *(__int32*)((unsigned __int32)Weapon + 2436);
static void* Predicted_Shot;
using Get_Weapon_Data_Type = void*(__thiscall*)(void* Weapon);
void* Weapon_Data = Get_Weapon_Data_Type((unsigned __int32)Client_Module + 86432)(Weapon);
__int8 Is_Melee = *(__int32*)((unsigned __int32)Weapon_Data + 352) * (*(__int32*)((unsigned __int32)Weapon_Data + 348) ^ 1) <= 1;
__int8 Reloading = *(__int8*)((unsigned __int32)Weapon + 2493);
__int8 Can_Attack = (*(float*)((unsigned __int32)Weapon + 2400) <= Global_Variables->Current_Time) * (Ammo > 0 - Is_Melee * 2) * (Reloading ^ 1) * (*(float*)((unsigned __int32)Local_Player + 3872) <= Global_Variables->Current_Time);
__int32 Entity_Number = 1;
using Get_Interpolation_Time_Type = float(__cdecl*)();
@ -388,32 +406,36 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
size_t Target_Number = 0;
__int8 Reloading = *(__int8*)((unsigned __int32)Weapon + 2493);
using Get_Weapon_Data_Type = void*(__thiscall*)(void* Weapon);
void* Weapon_Data = Get_Weapon_Data_Type((unsigned __int32)Client_Module + 86432)(Weapon);
__int8 Is_Melee = *(__int32*)((unsigned __int32)Weapon_Data + 352) * (*(__int32*)((unsigned __int32)Weapon_Data + 348) ^ 1) <= 1;
__int8 Can_Attack = (*(float*)((unsigned __int32)Weapon + 2400) <= Global_Variables->Current_Time) * (*(__int32*)((unsigned __int32)Weapon + 2436) > 0 - Is_Melee * 2) * (Reloading ^ 1) * (*(float*)((unsigned __int32)Local_Player + 3872) <= Global_Variables->Current_Time);
__int8 Reviving = *(void**)((unsigned __int32)Local_Player + 8076) != INVALID_HANDLE_VALUE;
__int32 Weapon_Identifier = Get_Identifier(Weapon, 1, 0);
using Get_Eye_Position_Type = void(__thiscall*)(void* Entity, float* Eye_Position);
float Eye_Position[3];
Get_Eye_Position_Type((unsigned __int32)Client_Module + 108512)(Local_Player, Eye_Position);
__int8 Cancelable_Shove = 1 + (*(float*)((unsigned __int32)Local_Player + 7336) < Global_Variables->Current_Time);
Target_Structure* Shove_Target = nullptr;
//should be m_flLastShoveTime + z_gun_swing_duration (2704)
if (Cancelable_Shove + (*(float*)((unsigned __int32)Weapon + 2400) == *(float*)((unsigned __int32)Weapon + 2404)) > 1)
{
if (*(__int8*)((unsigned __int32)Local_Player + 8070) * (Weapon_Identifier == 231) == 0)
{
if (Interface_Shotgun_Shove.Integer == 1)
{
if ((Weapon_Identifier - 148) % 14 == 0)
{
if ((void*)((unsigned __int32)Weapon + Ammo) == Predicted_Shot)
{
Predicted_Shot = nullptr;
Command->Buttons |= 2048;
Block_Buttons = 1;
}
}
}
using Get_Sequence_Duration_Type = float(__thiscall*)(void* Entity, void* Studio_Header, __int32 Sequence);
using Select_Sequence_Type = __int32(__thiscall*)(void* Entity, __int32 Activity);
@ -424,8 +446,6 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
__int8 Holstering = (min(*(float*)((unsigned __int32)Local_Player + 3872), *(float*)((unsigned __int32)Weapon + 2412)) + Get_Sequence_Duration_Type((unsigned __int32)Client_Module + 180400)(Weapon, Get_Studio_Header(Weapon), Select_Sequence_Type((unsigned __int32)Client_Module + 202896)(Weapon, (*Translate_Activity_Type(*(unsigned __int32*)Weapon + 1692))(Weapon, (*Get_Deploy_Activity_Type(*(unsigned __int32*)Weapon + 1600))(Weapon)))) > Global_Variables->Current_Time) * (Can_Attack ^ 1);
__int8 Is_Cold_Melee = Weapon_Identifier == 231;
Shove_Traverse_Sorted_Target_List_Label:
{
if (Target_Number != Sorted_Target_List.size())
@ -434,7 +454,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
__int8 Forced = 0;
if ((Reloading + Holstering + Is_Melee * (Weapon_Identifier * (Command->Buttons & 1) != 39)) * (Action + Reviving ^ 1) != 0)
if (((Command->Buttons & 2048) + Reloading + Holstering + Is_Melee * (Weapon_Identifier * (Command->Buttons & 1) != 39)) * (Action + Reviving ^ 1) != 0)
{
if ((Target->Identifier ^ 72) % 348 >= 72)
{
@ -444,7 +464,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
}
}
if (((270 - Is_Cold_Melee - (*(__int8*)((unsigned __int32)Local_Player + 8070) ^ 1) - Target->Identifier) ^ Target->Identifier - 263) > 0)
if ((270 - Target->Identifier ^ Target->Identifier - 263) > 0)
{
Shove_Label:
{
@ -537,6 +557,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
}
}
}
}
if (Cancelable_Shove != 0)
{
@ -776,6 +797,8 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
Command->Angles[2] -= Recoil[2];
}
Predicted_Shot = (void*)((unsigned __int32)Weapon + Ammo - 1);
Block_Buttons = 2048;
}
}

View File

@ -15,6 +15,8 @@ Interface_Structure Interface_Interpolate_Extra_Commands;
Interface_Structure Interface_Target_On_Simulation;
Interface_Structure Interface_Shotgun_Shove;
Interface_Structure Interface_Riot_Deprioritize;
Interface_Structure Interface_Penetrate_Teammates;
@ -56,6 +58,8 @@ void Implement_Extended_Interface()
Create_Interface(Pointer_Name(Interface_Target_On_Simulation), (char*)"0", nullptr);
Create_Interface(Pointer_Name(Interface_Shotgun_Shove), (char*)"1", nullptr);
Create_Interface(Pointer_Name(Interface_Riot_Deprioritize), (char*)"0", nullptr);
Create_Interface(Pointer_Name(Interface_Penetrate_Teammates), (char*)"0", nullptr);

View File

@ -121,10 +121,10 @@ void __thiscall Redirected_Paint(void* Panel)
Hitbox_Vertices[7][Axis_Number] = Bones[*(__int32*)Hitbox][Axis_Number][0] * Hitbox_Maximum[0] + Bones[*(__int32*)Hitbox][Axis_Number][1] * Hitbox_Maximum[1] + Bones[*(__int32*)Hitbox][Axis_Number][2] * Hitbox_Maximum[2] + Bones[*(__int32*)Hitbox][Axis_Number][3];
if (Axis_Number != 2)
{
Axis_Number += 1;
if (Axis_Number != sizeof(Hitbox_Vertices[0]) / sizeof(float))
{
goto Initialize_Vertices_Label;
}
}
@ -162,10 +162,10 @@ void __thiscall Redirected_Paint(void* Panel)
return 0;
}
if (Vertex_Number != 7)
{
Vertex_Number += 1;
if (Vertex_Number != sizeof(Hitbox_Vertices) / sizeof(Hitbox_Vertices[0]))
{
goto Transform_Vertices_Label;
}
}
@ -252,10 +252,23 @@ void __thiscall Redirected_Paint(void* Panel)
Ghost = *(__int8*)((unsigned __int32)Target->Self + 7322);
}
auto Draw_Box = [&](__int32 From_X, __int32 From_Y, __int32 To_X, __int32 To_Y)
auto Draw_Box = [&](__int32 From_X, __int32 From_Y, __int32 To_X, __int32 To_Y) -> void
{
using Set_Color_Type = void(__thiscall**)(void* Surface, unsigned __int8 Red, unsigned __int8 Green, unsigned __int8 Blue, unsigned __int8 Alpha);
if (Ghost == 0)
{
(*Set_Color_Type(*(unsigned __int32*)Surface + 44))(Surface, (__int32)(Paint_Data->Color[0] / 2.f + 0.5f), (__int32)(Paint_Data->Color[1] / 2.f + 0.5f), (__int32)(Paint_Data->Color[2] / 2.f + 0.5f), 128);
}
else
{
(*Set_Color_Type(*(unsigned __int32*)Surface + 44))(Surface, 64, 64, 64, 128);
}
using Draw_Filled_Rect_Type = void(__thiscall**)(void* Surface, __int32 From_X, __int32 From_Y, __int32 To_X, __int32 To_Y);
(*Draw_Filled_Rect_Type(*(unsigned __int32*)Surface + 48))(Surface, From_X + 2, From_Y + 2, To_X - 2, To_Y - 2);
(*Set_Color_Type(*(unsigned __int32*)Surface + 44))(Surface, 0, 0, 0, 255);
using Draw_Rect_Type = void(__thiscall**)(void* Surface, __int32 From_X, __int32 From_Y, __int32 To_X, __int32 To_Y);
@ -274,19 +287,6 @@ void __thiscall Redirected_Paint(void* Panel)
}
(*Draw_Rect_Type(*(unsigned __int32*)Surface + 56))(Surface, From_X, From_Y, To_X, To_Y);
if (Ghost == 0)
{
(*Set_Color_Type(*(unsigned __int32*)Surface + 44))(Surface, (__int32)(Paint_Data->Color[0] / 2.f + 0.5f), (__int32)(Paint_Data->Color[1] / 2.f + 0.5f), (__int32)(Paint_Data->Color[2] / 2.f + 0.5f), 128);
}
else
{
(*Set_Color_Type(*(unsigned __int32*)Surface + 44))(Surface, 64, 64, 64, 128);
}
using Draw_Filled_Rect_Type = void(__thiscall**)(void* Surface, __int32 From_X, __int32 From_Y, __int32 To_X, __int32 To_Y);
(*Draw_Filled_Rect_Type(*(unsigned __int32*)Surface + 48))(Surface, From_X + 2, From_Y + 2, To_X - 2, To_Y - 2);
};
Draw_Box(Bounds[0], Bounds[2], Bounds[1], Bounds[3]);