instant heal (prototype), minor logic fixes

instant revive, rapidfire or anything timer based uses same logic
This commit is contained in:
explorer 2024-10-17 05:02:19 +03:00
parent d174b651c9
commit 1af4705b49
2 changed files with 46 additions and 6 deletions

View File

@ -179,7 +179,19 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
{ {
if (Extra_Commands < 1) if (Extra_Commands < 1)
{ {
*(__int32*)((unsigned __int32)Network_Channel + 8) += (*(__int32*)((unsigned __int32)Local_Player + 5324) + ~-150) / 150 * 150 + (Reserve * 150); if (Reserve == 0)
{
*(__int32*)((unsigned __int32)Network_Channel + 8) += 150;
}
else
{
__int32 Sequence_Shift = (*(__int32*)((unsigned __int32)Local_Player + 5324) + ~- 150) / 150 * 150 + (Reserve * 150);
if (Sequence_Shift > 0)
{
*(__int32*)((unsigned __int32)Network_Channel + 8) += Sequence_Shift;
}
}
} }
*(__int32*)((unsigned __int32)Local_Player + 20) = 1 + (Reserve > 0); *(__int32*)((unsigned __int32)Local_Player + 20) = 1 + (Reserve > 0);
@ -198,7 +210,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
{ {
if (*(void**)((unsigned __int32)Local_Player + 10008) != INVALID_HANDLE_VALUE) if (*(void**)((unsigned __int32)Local_Player + 10008) != INVALID_HANDLE_VALUE)
{ {
Sequence_Shift(0); Sequence_Shift(2);
} }
} }
} }
@ -351,7 +363,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
__int8 Is_Melee = *(__int32*)((unsigned __int32)Weapon_Data + 352) * (*(__int32*)((unsigned __int32)Weapon_Data + 348) ^ 1) <= 1; __int8 Is_Melee = *(__int32*)((unsigned __int32)Weapon_Data + 352) * (*(__int32*)((unsigned __int32)Weapon_Data + 348) ^ 1) <= 1;
__int8 Healing = *(void**)((unsigned __int32)Local_Player + 8076) != INVALID_HANDLE_VALUE; __int8 Healing = (*(__int32*)((unsigned __int32)Local_Player + 7080) == 1) + (*(void**)((unsigned __int32)Local_Player + 8076) != INVALID_HANDLE_VALUE);
__int8 Reloading = *(__int8*)((unsigned __int32)Weapon + 2493); __int8 Reloading = *(__int8*)((unsigned __int32)Weapon + 2493);
@ -387,7 +399,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
} }
} }
if ((Target->Identifier >= 263) + (Target->Identifier <= 270 - Is_Cold_Melee - (*(__int8*)((unsigned __int32)Local_Player + 8070) ^ 1)) == 2) if (((270 - Is_Cold_Melee - (*(__int8*)((unsigned __int32)Local_Player + 8070) ^ 1) - Target->Identifier) ^ Target->Identifier - 263) > 0)
{ {
Shove_Label: Shove_Label:
{ {
@ -480,7 +492,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 ^ 1) + (Weapon_Identifier == 96) + Healing == 0) if (Healing + (Can_Attack ^ 1) + (Weapon_Identifier == 96) == 0)
{ {
Target_Structure* Aim_Target = nullptr; Target_Structure* Aim_Target = nullptr;
@ -688,6 +700,34 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
} }
} }
} }
else
{
if (Weapon_Identifier == 73)
{
//ideally 150 commands should always be buffered beforehand
//at worst buffer them right before slot* command
//current solution without buffering takes (interval_per_tick*150) seconds to prepare itself
//reason why i'm not doing that now is because it'll take time to redesign prediction code to function properly
//specifically:
//ignoring network time updates for good period of time isn't good idea
//viewmodel animations will jitter at moment of centering around network time
//so is interpolation
//besides all that, it'll invoke clock correction on server's side and that's pretty unstable (especially on ~100 tickrate)
Global_Variables->Current_Time -= Global_Variables->Interval_Per_Tick * 150;
//leaving other ones of sanity for later
if (*(float*)((unsigned __int32)Weapon + 2400) <= Global_Variables->Current_Time)
{
if ((Command->Buttons & 2049) != 0)
{
Sequence_Shift(0);
Block_Buttons = 1;
}
}
}
}
if ((Command->Buttons & 1) == 1) if ((Command->Buttons & 1) == 1)
{ {

View File

@ -2,7 +2,7 @@ void* Original_Get_Glow_Color_Caller;
void __thiscall Redirected_Get_Glow_Color(void* Entity, void* Unknown_Parameter_1, void* Unknown_Parameter_2, void* Unknown_Parameter_3, void* Unknown_Parameter_4) void __thiscall Redirected_Get_Glow_Color(void* Entity, void* Unknown_Parameter_1, void* Unknown_Parameter_2, void* Unknown_Parameter_3, void* Unknown_Parameter_4)
{ {
if (Get_Identifier(Entity, 0, 0) != 232) if (Get_Identifier(Entity, 0, 0) == -1)
{ {
(decltype(&Redirected_Get_Glow_Color)(Original_Get_Glow_Color_Caller))(Entity, Unknown_Parameter_1, Unknown_Parameter_2, Unknown_Parameter_3, Unknown_Parameter_4); (decltype(&Redirected_Get_Glow_Color)(Original_Get_Glow_Color_Caller))(Entity, Unknown_Parameter_1, Unknown_Parameter_2, Unknown_Parameter_3, Unknown_Parameter_4);
} }