Expand CInput class and add VerifyUserCmd to CUserCmd.

Signed-off-by: aixxe <me@aixxe.net>
This commit is contained in:
aixxe
2016-12-20 13:17:49 +00:00
parent 3b12e00ad1
commit 13f8d44aa7
3 changed files with 129 additions and 2 deletions

View File

@@ -18,6 +18,30 @@ class CUserCmd {
short mousedx;
short mousedy;
bool hasbeenpredicted;
inline CRC32_t GetChecksum() {
CRC32_t crc;
CRC32_Init(&crc);
CRC32_ProcessBuffer(&crc, &this->command_number, sizeof(this->command_number));
CRC32_ProcessBuffer(&crc, &this->tick_count, sizeof(this->tick_count));
CRC32_ProcessBuffer(&crc, &this->viewangles, sizeof(this->viewangles));
CRC32_ProcessBuffer(&crc, &this->forwardmove, sizeof(this->forwardmove));
CRC32_ProcessBuffer(&crc, &this->sidemove, sizeof(this->sidemove));
CRC32_ProcessBuffer(&crc, &this->upmove, sizeof(this->upmove));
CRC32_ProcessBuffer(&crc, &this->buttons, sizeof(this->buttons));
CRC32_ProcessBuffer(&crc, &this->impulse, sizeof(this->impulse));
CRC32_ProcessBuffer(&crc, &this->weaponselect, sizeof(this->weaponselect));
CRC32_ProcessBuffer(&crc, &this->weaponsubtype, sizeof(this->weaponsubtype));
CRC32_ProcessBuffer(&crc, &this->random_seed, sizeof(this->random_seed));
CRC32_ProcessBuffer(&crc, &this->mousedx, sizeof(this->mousedx));
CRC32_ProcessBuffer(&crc, &this->mousedy, sizeof(this->mousedy));
CRC32_Final(&crc);
return crc;
}
};
class CVerifiedUserCmd {