-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Здравствуйте.
Это актуальный парт предикшена сревершен с игры.
псевдо код -
отревершеный код -
Это актуальный парт предикшена сревершен с игры.
псевдо код -
C++:
int __userpurge CPrediction::RunCommand@<eax>(_BYTE *ThisIPrediction@<ecx>, __int128 _XMM1@<xmm1>, _DWORD *pPlayer, _DWORD *pCmd, _DWORD *pMoveHelper)
{
_BYTE *_IPrediction; // ebx
int _gpGlobals; // eax
float nTickBase; // xmm0_4
float v8; // xmm1_4
signed int cmd_weaponselect; // eax
int v10; // ecx
int v11; // eax
int v12; // eax
int v13; // ebx
unsigned int m_hVehicle; // ecx
int *v15; // eax
int v16; // ebx
int cmd_buttons; // edx
int v18; // ecx
int __gpGlobals; // eax
int v20; // eax
int result; // eax
_BYTE *__IPrediction; // [esp+48h] [ebp-8h]
int v23; // [esp+4Ch] [ebp-4h]
_IPrediction = ThisIPrediction;
__IPrediction = ThisIPrediction;
pPlayer[3282] = pCmd;
sub_102C1930((int)(pPlayer + 3238), (int)pCmd);
if ( pCmd )
PredictionRandomSeed = pCmd[0x10];
else
PredictionRandomSeed = -1;
_gpGlobals = gpGlobals;
nTickBase = (float)(signed int)pPlayer[3344];
PredictionPlayer = (int)pPlayer;
v8 = *(float *)(gpGlobals + 32);
*(float *)(gpGlobals + 16) = nTickBase * v8;
if ( _IPrediction[10] )
v8 = 0.0;
*(float *)(_gpGlobals + 20) = v8;
pCmd[0xC] |= pPlayer[3281];
pCmd[0xC] &= ~pPlayer[3280];
(*(void (__thiscall **)(int *, _DWORD *))(g_pGameMovement + 12))(&g_pGameMovement, pPlayer);
cmd_weaponselect = pCmd[0xE];
if ( cmd_weaponselect )
{
if ( cmd_weaponselect >= 0 && cmd_weaponselect < 0x2000 )
{
v10 = dword_14DBC5A4[4 * cmd_weaponselect];
if ( v10 )
{
v11 = (*(int (**)(void))(*(_DWORD *)v10 + 28))();
if ( v11 )
{
v12 = (*(int (__thiscall **)(int))(*(_DWORD *)v11 + 668))(v11);
v13 = v12;
if ( v12 )
{
if ( (*(int (__thiscall **)(int))(*(_DWORD *)v12 + 1128))(v12) == pCmd[0xF] )
(*(void (__thiscall **)(_DWORD *, int))(*pPlayer + 1316))(pPlayer, v13);
}
}
}
}
}
m_hVehicle = pPlayer[3264];
if ( m_hVehicle != -1
&& (v15 = &dword_14DBC5A4[4 * (unsigned __int16)m_hVehicle]) != 0
&& v15[1] == m_hVehicle >> 16
&& *v15 )
{
v16 = (*(int (**)(void))(*(_DWORD *)*v15 + 396))();
}
else
{
v16 = 0;
}
if ( *((_BYTE *)pCmd + 0x34) && (!v16 || (unsigned __int8)sub_101ABC60(pPlayer)) )
pPlayer[3203] = *((unsigned __int8 *)pCmd + 0x34);
cmd_buttons = pCmd[0xC];
v18 = cmd_buttons ^ pPlayer[0xC82];
pPlayer[0xC7F] = pPlayer[0xC82];
pPlayer[0xC82] = cmd_buttons;
pPlayer[0xC80] = cmd_buttons & v18;
__gpGlobals = gpGlobals;
pPlayer[0xC81] = v18 & ~cmd_buttons;
(*(void (__stdcall **)(_DWORD *, _DWORD, _DWORD))(*(_DWORD *)__IPrediction + 72))(
pPlayer,
COERCE_UNSIGNED_INT64(*(float *)(__gpGlobals + 20)),
COERCE_UNSIGNED_INT64(*(float *)(__gpGlobals + 20)) >> 32);
(*(void (__thiscall **)(_DWORD *, _DWORD *))(*pPlayer + 1492))(pPlayer, pCmd + 3);
if ( sub_10315850(pPlayer, 0) )
(*(void (__thiscall **)(_DWORD *))(*pPlayer + 1272))(pPlayer);
v20 = pPlayer[63];
if ( v20 != -1 && v20 > 0 && v20 <= pPlayer[3344] )
{
pPlayer[63] = -1;
sub_101A7EB0(0);
(*(void (__thiscall **)(_DWORD *))(*pPlayer + 556))(pPlayer);
}
(*(void (__stdcall **)(_DWORD *, _DWORD *, _DWORD *, void *))(*(_DWORD *)__IPrediction + 80))(
pPlayer,
pCmd,
pMoveHelper,
off_10D676A4);
v23 = *(_DWORD *)(g_VProfCurrentProfile + 4108);
if ( v23 )
CVProfile::EnterScope(
g_VProfCurrentProfile,
"CPrediction::ProcessMovement",
0,
"CPrediction::ProcessMovement",
0,
4);
if ( v16 )
(*(void (__thiscall **)(int, _DWORD *, void *))(*(_DWORD *)v16 + 20))(v16, pPlayer, off_10D676A4);
else
(*(void (__thiscall **)(int *, _DWORD *, void *))(g_pGameMovement + 4))(&g_pGameMovement, pPlayer, off_10D676A4);
if ( v23 )
CVProfile::ExitScope(g_VProfCurrentProfile);
(*(void (__thiscall **)(_BYTE *, _DWORD *, _DWORD *, void *))(*(_DWORD *)__IPrediction + 84))(
__IPrediction,
pPlayer,
pCmd,
off_10D676A4);
(*(void (**)(void))(*pMoveHelper + 16))();
(*(void (__thiscall **)(_DWORD *))(*pPlayer + 1276))(pPlayer);
(*(void (__thiscall **)(int *, _DWORD *))(g_pGameMovement + 16))(&g_pGameMovement, pPlayer);
pPlayer[3282] = 0;
PredictionRandomSeed = -1;
PredictionPlayer = 0;
result = (*(int (__thiscall **)(int *))(g_pGameMovement + 8))(&g_pGameMovement);
if ( !__IPrediction[10] )
{
result = gpGlobals;
if ( *(float *)(gpGlobals + 20) > 0.0 )
++pPlayer[3344];
}
return result
}
C++:
void c_engine_prediction::run_cmd( c_user_cmd* cmd, c_cs_player* player ) {
if ( !player || !player->is_alive( ) )
return;
player->get_current_cmd( ) = cmd;
if ( cmd )
player_random_seed = cmd->m_random_seed;
else
player_random_seed = -1;
globals = interfaces::global_vars;
tick_base = player->get_tick_base( );
player_prediction = ( int )player;
globals->m_cur_time = TICKS_TO_TIME( tick_base );
globals->m_frame_time = interfaces::preidction->m_engine_paused ? 0.f : globals->m_interval_per_tick;
cmd->m_buttons |= player->buttons_forced( );
cmd->m_buttons &= ~player->buttons_disabled( );
interfaces::game_movement->start_track_prediction_errors( player );
interfaces::move_helper->set_host( player );
if ( cmd->m_weapon_select >= 0 && cmd->m_weapon_select < 0x2000 ) {
auto weapon = reinterpret_cast< weapon_t* >( interfaces::entity_list->get_client_entity( cmd->m_weapon_select ) );
if ( weapon ) {
auto weapon_data = weapon->get_weapon_data();
if ( weapon_data )
player->select_item( weapon_data->m_sz_weapon_name, cmd->m_weapon_sub_type );
}
}
if ( cmd->m_impulse && ( !vehicle || player->using_standard_weapons_in_vehicle( ) ) )
player->get_impulse( ) = cmd->m_impulse;
auto v18 = cmd->m_buttons ^ player->get_buttons( );
player->get_last_buttons( ) = player->get_buttons( );
player->get_buttons( ) = cmd->m_buttons;
player->buttons_is_pressed( ) = cmd->m_buttons & v18;
player->buttons_released( ) = v18 & ~cmd->m_buttons;
interfaces::prediction->check_moving_on_ground( player, globals->m_frame_time );
player->set_local_view_ang( cmd->m_view_ang );
auto v20 = player->next_think_tick( );
if ( v20 != -1 && v20 > 0 && v20 <= tick_base ) {
v20 = -1;
player->run_think( player, TICK_INTERVAL );
}
interfaces::prediction->setup_move( player, cmd, interfaces::move_helper, &move_data );
interfaces::game_movement->process_movement( player, &move_data );
interfaces::prediction()->finish_move( player, cmd, &move_data );
interfaces::move_helper->process_impacts( );
run_post_think( player );
interfaces::move_helper->set_host( nullptr );
interfaces::game_movement->finish_track_prediction_errors( player );
interfaces::game_movement->reset( );
player->get_current_cmd( ) = nullptr;
player_random_seed = -1;
player_prediction = 0;
if ( !interfaces::prediction->m_engine_paused ) {
if ( globals->m_frame_time > 0 )
++tick_base;
}
}
Последнее редактирование: