Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static auto original_fn = hlclient_hook.get_original<WriteUserCmd>(24);
- if (nTickbaseShift < 0)
- return original_fn(g_CHLClient, nSlot, buffer, from, to, isNewCommand);
- if (from != -1)
- return true;
- auto pNumBackupCommands = (int*)(reinterpret_cast <uintptr_t> (buffer) - 0x30);
- auto pNumNewCommands = (int*)(reinterpret_cast <uintptr_t> (buffer) - 0x2C);
- auto net_channel = *reinterpret_cast <INetChannel**> (reinterpret_cast <uintptr_t> (g_ClientState) + 0x9C);
- auto new_commands = *pNumNewCommands;
- auto next_cmdnr = g_ClientState->m_nLastOutgoingCommand + g_ClientState->m_NetChannel->m_nChokedPackets + 1;
- auto total_new_commands = std::min(nTickbaseShift, 17);
- nTickbaseShift -= total_new_commands;
- from = -1;
- *pNumNewCommands = total_new_commands;
- *pNumBackupCommands = 0;
- for (to = next_cmdnr - new_commands + 1; to <= next_cmdnr; to++)
- {
- if (!original_fn(g_CHLClient, nSlot, buffer, from, to, isNewCommand))
- return false;
- from = to;
- }
- auto last_realCmd = g_Input->GetUserCmd(nSlot, from);
- CUserCmd fromCmd;
- if (last_realCmd)
- fromCmd = *last_realCmd;
- auto toCmd = fromCmd;
- toCmd.command_number++;
- toCmd.tick_count += 200;
- for (auto i = new_commands; i <= total_new_commands; i++)
- {
- Utils::WriteUsercmd(buffer, &toCmd, &fromCmd);
- fromCmd = toCmd;
- toCmd.command_number++;
- toCmd.tick_count++;
- }
- return true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement