- Статус
- Оффлайн
- Регистрация
- 25 Авг 2020
- Сообщения
- 187
- Реакции
- 51
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
C++:
float flInterval = 0.0f;
int nSimulationTick = 1;
if (g_pPrediction->m_bEnginePaused)
flInterval = 0.0f;
else
flInterval = 0.015625f;
// 0x15B4 or C_BasePlayerPawn->m_nLastExecutedCommandTick
int nLastExecutedCommandTick = pPlayerPawn->GetLastExecutedCommandTick();
if (nLastExecutedCommandTick >= 0)
nSimulationTick = g_pGlobalVarsBase->m_nTickCount - nLastExecutedCommandTick;
float flComputedAnimationTime = g_pGlobalVarsBase->m_flCurTime - (float)((float)nSimulationTick * flInterval);
int nSequenceNumber = pUserCmdManager->m_nSequenceNumber; // nSequenceNumber = *(_DWORD *)(pUserCmdManager + 0x59A8);
if (pUserCmd && pUserCmd->m_nSequenceNumber == nSequenceNumber)
--nSequenceNumber;
// 0x15B0 or C_BasePlayerPawn->m_nLastExecutedCommandNumber
int nLastExecutedCommandNumber = pPlayerPawn->GetLastExecutedCommandNumber();
int nNextLastExecutedCommandNumber = nLastExecutedCommandNumber + 1;
if (nLastExecutedCommandNumber < 0)
nNextLastExecutedCommandNumber = nSequenceNumber;
int nNextProcessedSimulationTick = nSequenceNumber - nSimulationTick + 1;
if (nNextLastExecutedCommandNumber > nNextProcessedSimulationTick)
nNextProcessedSimulationTick = nNextLastExecutedCommandNumber;
if (nSimulationTick > 0)
{
while (true)
{
// here a game apply some shit for CGlobalBaseVars shit
/*
v17 = (float *)g_pGlobalVarsBase;
v18 = *((_DWORD *)g_pGlobalVarsBase + 0xC);
v19 = *((_DWORD *)g_pGlobalVarsBase + 0x14);
v20 = *((_DWORD *)g_pGlobalVarsBase + 0xD);
v34 = *((_DWORD *)g_pGlobalVarsBase + 0x11);
*((float *)g_pGlobalVarsBase + 0xC) = flComputedAnimationTime;
v17[0xD] = flInterval;
v17[0x14] = 0.0;
*((_DWORD *)v17 + 0x11) = (int)(float)((float)(flComputedAnimationTime * 64.0) + 0.5);
*/
g_pGlobalVarsBase->m_flCurTime = flComputedAnimationTime;
g_pGlobalVars->m_flFrameTime = flInterval;
g_pGlobalVars->m_flTickRemainderFraction = 0.0f;
g_pGlobalVars->m_nTickCount = (int)(float)((float)(flComputedAnimationTime * 64.0) + 0.5);
if (nNextProcessedSimulationTick <= nSequenceNumber)
{
if (nNextProcessedSimulationTick > 0)
{
auto v23 = pUserCmdManager->GetUserCmd( nNextProcessedSimulationTick % 150 );
if (v23->m_nSequenceNumber == nNextProcessedSimulationTick)
break;
}
}
/*
if ( v15 )
{
if ( !v26 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v15 + 48LL))(v15);
sub_180543E10(v27, v15 + 16);
v26 = *(_DWORD *)(v15 + 8);
v24 = (void (__fastcall *)(void ***))v25[7];
if ( (char *)v24 == (char *)sub_180643240 )
sub_180643240(&v25);
else
v24(&v25);
v29 = *(_DWORD *)(v15 + 120);
v30 = *(_QWORD *)(v15 + 128);
v31 = *(_DWORD *)(v15 + 136);
v32 = *(_BYTE *)(v15 + 140);
v33 = *(_QWORD *)(v15 + 144);
sub_1802F0840(v28);
}
v23 = &v25;
goto LABEL_29;
}
*/
flComputedAnimationTime = flComputedAnimationTime + flInterval;
++nNextProcessedSimulationTick;
// here a game restore CGlobalBaseVars shit
/*
*((_DWORD *)v17 + 12) = v18;
*((_DWORD *)v17 + 13) = v20;
*((_DWORD *)v17 + 20) = v19;
*((_DWORD *)v17 + 17) = v34;
*/
if (!nSimulationTick)
goto LABEL_32;
}
// PrePhysicsSimulate -> 316
if (pPlayerPawn->PrePhysicsSimulate())
{
auto pPredictedUserCmd = pUserCmdManager->GetUserCmd( nNextProcessedSimulationTick % 150 );
if ( pPredictedUserCmd )
pMovementServices->RunCommand( pPredictedUserCmd );
}
LABEL_32:
pPlayerPawn->GetLastExecutedCommandTick() = g_pGlobalVarsBase->m_nTickCount;
pPlayerPawn->GetLastExecutedCommandNumber() = nSequenceNumber;
}