mirror of
https://github.com/qwertyuiop3/Storm.git
synced 2025-01-09 18:59:02 +08:00
predicted chainsaw state 2/2
unfortunately there's no reliable way due to *::Deploy not being called in certain scenarios but that should serve as good foundation for later improvement. minor precision loss possibly due to addition being replaced with multiplication (ie. cycle + rate * interval -> ticks * rate * interval)
This commit is contained in:
parent
f5fb3e4d30
commit
519d56c138
@ -223,18 +223,17 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static __int32 Accumulative_Correction; //rem: deviation from clock-corrected tick (not "accumulative correction")
|
static __int32 Accumulative_Correction;
|
||||||
|
|
||||||
//rem: extra commands queued with no clock correction applied due to m_PacketDrop induced negation (not "absolute speed")
|
auto Disable_Clock_Correction = [&](__int32 Queue) -> void
|
||||||
auto Absolute_Speed = [&]() -> void
|
|
||||||
{
|
{
|
||||||
if (Interface_Extra_Commands_Action.Integer > 0)
|
if (Queue > 0)
|
||||||
{
|
{
|
||||||
if (Extended_Command == Initial_Extended_Command)
|
if (Extended_Command == Initial_Extended_Command)
|
||||||
{
|
{
|
||||||
Extended_Command->Extra_Commands = 0;
|
Extended_Command->Extra_Commands = 0;
|
||||||
|
|
||||||
Extra_Commands = max((__int32)(0.06f / Global_Variables->Interval_Per_Tick + 0.5f), Interface_Extra_Commands_Action.Integer);
|
Extra_Commands = max((__int32)(0.06f / Global_Variables->Interval_Per_Tick + 0.5f), Queue);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -274,7 +273,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
|||||||
{
|
{
|
||||||
Command->Buttons |= Is_Jockey_Victim * 2;
|
Command->Buttons |= Is_Jockey_Victim * 2;
|
||||||
|
|
||||||
Absolute_Speed();
|
Disable_Clock_Correction(Interface_Extra_Commands_Action.Integer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -306,7 +305,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
|||||||
{
|
{
|
||||||
if (Action + Reviving != 0)
|
if (Action + Reviving != 0)
|
||||||
{
|
{
|
||||||
Absolute_Speed();
|
Disable_Clock_Correction(Interface_Extra_Commands_Action.Integer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,16 +353,13 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
|||||||
|
|
||||||
if ((Weapon_Identifier == 105) + (Weapon_Identifier == 121) == 0)
|
if ((Weapon_Identifier == 105) + (Weapon_Identifier == 121) == 0)
|
||||||
{
|
{
|
||||||
if ((129 * (Weapon_Identifier != 120) - Weapon_Identifier ^ Weapon_Identifier - 106) >= 0)
|
static std::unordered_set<__int32> Grenades = { 106, 118, 129 };
|
||||||
{
|
|
||||||
using Is_Grenade_Type = __int8(__thiscall**)(void* Weapon);
|
|
||||||
|
|
||||||
if ((*Is_Grenade_Type(*(unsigned __int32*)Weapon + 1308))(Weapon) == 1)
|
if (Grenades.contains(Weapon_Identifier) == 1)
|
||||||
{
|
{
|
||||||
Cancelable_Shove = min((*(__int16*)((unsigned __int32)Weapon + 3304) == 0) + (*(float*)((unsigned __int32)Weapon + 3308) == 0.f), Cancelable_Shove);
|
Cancelable_Shove = min((*(__int16*)((unsigned __int32)Weapon + 3304) == 0) + (*(float*)((unsigned __int32)Weapon + 3308) == 0.f), Cancelable_Shove);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Cancelable_Shove = min(1 + (*(float*)((unsigned __int32)Weapon + 3312) == -1.f), Cancelable_Shove);
|
Cancelable_Shove = min(1 + (*(float*)((unsigned __int32)Weapon + 3312) == -1.f), Cancelable_Shove);
|
||||||
@ -392,13 +388,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
|||||||
|
|
||||||
if (Weapon_Identifier == 39)
|
if (Weapon_Identifier == 39)
|
||||||
{
|
{
|
||||||
void* Animation_Overlay = *(void**)((unsigned __int32)Weapon + 3408);
|
Can_Attack = (min(Chainsaw_Cycles * 0.46153846f * Global_Variables->Interval_Per_Tick, 1.f) > 0.95f) * (In_Shove ^ 1);
|
||||||
|
|
||||||
if (Animation_Overlay != nullptr) //1 tick behind. required until "weapon prediction" (misnomer) is implemented
|
|
||||||
{
|
|
||||||
Can_Attack = *(float*)(*(unsigned __int32*)((unsigned __int32)Animation_Overlay + 2392) + 28) > 0.95f;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -9,32 +9,7 @@ __int32 Get_Identifier(void* Entity, __int8 Raw, __int8 Equipment)
|
|||||||
return Identifier;
|
return Identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::unordered_set<__int32> Targets =
|
static std::unordered_set<__int32> Targets = { 0, 13, 99, 232, 263, 264, 265, 270, 272, 275, 276, 277 };
|
||||||
{
|
|
||||||
0,
|
|
||||||
|
|
||||||
13,
|
|
||||||
|
|
||||||
99,
|
|
||||||
|
|
||||||
232,
|
|
||||||
|
|
||||||
263,
|
|
||||||
|
|
||||||
264,
|
|
||||||
|
|
||||||
265,
|
|
||||||
|
|
||||||
270,
|
|
||||||
|
|
||||||
272,
|
|
||||||
|
|
||||||
275,
|
|
||||||
|
|
||||||
276,
|
|
||||||
|
|
||||||
277
|
|
||||||
};
|
|
||||||
|
|
||||||
if (Targets.contains(Identifier) == 1)
|
if (Targets.contains(Identifier) == 1)
|
||||||
{
|
{
|
||||||
@ -93,20 +68,7 @@ __int32 Get_Identifier(void* Entity, __int8 Raw, __int8 Equipment)
|
|||||||
{
|
{
|
||||||
if (Equipment == 1)
|
if (Equipment == 1)
|
||||||
{
|
{
|
||||||
static std::unordered_set<__int32> Equipment_List =
|
static std::unordered_set<__int32> Equipment_List = { 73, 105, 109, 121, 256, 260 };
|
||||||
{
|
|
||||||
73,
|
|
||||||
|
|
||||||
105,
|
|
||||||
|
|
||||||
109,
|
|
||||||
|
|
||||||
121,
|
|
||||||
|
|
||||||
256,
|
|
||||||
|
|
||||||
260
|
|
||||||
};
|
|
||||||
|
|
||||||
if (Equipment_List.contains(Identifier) == 1)
|
if (Equipment_List.contains(Identifier) == 1)
|
||||||
{
|
{
|
||||||
@ -144,12 +106,7 @@ void* Original_Estimate_Velocity_Caller;
|
|||||||
|
|
||||||
void __thiscall Redirected_Estimate_Velocity(void* Entity, float* Velocity)
|
void __thiscall Redirected_Estimate_Velocity(void* Entity, float* Velocity)
|
||||||
{
|
{
|
||||||
static std::unordered_set<__int32> Invalids =
|
static std::unordered_set<__int32> Invalids = { 264, 277 };
|
||||||
{
|
|
||||||
264,
|
|
||||||
|
|
||||||
277
|
|
||||||
};
|
|
||||||
|
|
||||||
if (Invalids.contains(Get_Identifier(Entity, 1, 0)) == 1)
|
if (Invalids.contains(Get_Identifier(Entity, 1, 0)) == 1)
|
||||||
{
|
{
|
||||||
@ -161,10 +118,6 @@ void __thiscall Redirected_Estimate_Velocity(void* Entity, float* Velocity)
|
|||||||
|
|
||||||
Calculate_Velocity_Type((unsigned __int32)Client_Module + 290704)(Entity);
|
Calculate_Velocity_Type((unsigned __int32)Client_Module + 290704)(Entity);
|
||||||
|
|
||||||
Velocity[0] = *(float*)((unsigned __int32)Entity + 136);
|
Byte_Manager::Copy_Bytes(1, Velocity, sizeof(float[3]), (float*)((unsigned __int32)Entity + 136));
|
||||||
|
|
||||||
Velocity[1] = *(float*)((unsigned __int32)Entity + 140);
|
|
||||||
|
|
||||||
Velocity[2] = *(float*)((unsigned __int32)Entity + 144);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
17
Move.hpp
17
Move.hpp
@ -1,12 +1,16 @@
|
|||||||
__int32 Extra_Commands;
|
__int32 Extra_Commands;
|
||||||
|
|
||||||
|
__int32 Chainsaw_Cycles;
|
||||||
|
|
||||||
void* Original_Move_Caller;
|
void* Original_Move_Caller;
|
||||||
|
|
||||||
void Redirected_Move(float Unknown_Parameter, __int8 Final)
|
void Redirected_Move(float Unknown_Parameter, __int8 Final)
|
||||||
{
|
{
|
||||||
|
void* Local_Player = *(void**)((unsigned __int32)Client_Module + 7498712);
|
||||||
|
|
||||||
using Run_Prediction_Type = void(__cdecl*)();
|
using Run_Prediction_Type = void(__cdecl*)();
|
||||||
|
|
||||||
if (*(void**)((unsigned __int32)Client_Module + 7498712) != nullptr)
|
if (Local_Player != nullptr)
|
||||||
{
|
{
|
||||||
Redirected_Read_Packets(Final);
|
Redirected_Read_Packets(Final);
|
||||||
|
|
||||||
@ -37,6 +41,17 @@ void Redirected_Move(float Unknown_Parameter, __int8 Final)
|
|||||||
|
|
||||||
Run_Prediction_Type((unsigned __int32)Engine_Module + 527776)();
|
Run_Prediction_Type((unsigned __int32)Engine_Module + 527776)();
|
||||||
|
|
||||||
|
if (Local_Player != nullptr)
|
||||||
|
{
|
||||||
|
Chainsaw_Cycles += 1 + (Chainsaw_Cycles == 0);
|
||||||
|
|
||||||
|
static float Deploy_Time;
|
||||||
|
|
||||||
|
Chainsaw_Cycles *= *(float*)((unsigned __int32)Local_Player + 3872) == Deploy_Time;
|
||||||
|
|
||||||
|
Deploy_Time = *(float*)((unsigned __int32)Local_Player + 3872);
|
||||||
|
}
|
||||||
|
|
||||||
if (Extra_Commands > 0)
|
if (Extra_Commands > 0)
|
||||||
{
|
{
|
||||||
Extra_Commands -= 1;
|
Extra_Commands -= 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user