1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-09-20 12:36:05 +08:00

Updated CUserCmd further.

This commit is contained in:
Nicholas Hastings
2012-08-25 11:13:23 -04:00
parent c0af5a4ba6
commit df20126b95
2 changed files with 24 additions and 1 deletions

View File

@ -133,6 +133,10 @@ void WriteUsercmd( bf_write *buf, const CUserCmd *to, const CUserCmd *from )
WriteUserCmdDeltaFloat( buf, "viewangles[1]", from->viewangles[1], to->viewangles[1] );
WriteUserCmdDeltaFloat( buf, "viewangles[2]", from->viewangles[2], to->viewangles[2] );
WriteUserCmdDeltaFloat( buf, "aimdirection[0]", from->aimdirection[0], to->aimdirection[0] );
WriteUserCmdDeltaFloat( buf, "aimdirection[1]", from->aimdirection[1], to->aimdirection[1] );
WriteUserCmdDeltaFloat( buf, "aimdirection[2]", from->aimdirection[2], to->aimdirection[2] );
WriteUserCmdDeltaFloat( buf, "forwardmove", from->forwardmove, to->forwardmove );
WriteUserCmdDeltaFloat( buf, "sidemove", from->sidemove, to->sidemove );
WriteUserCmdDeltaFloat( buf, "upmove", from->upmove, to->upmove );
@ -319,6 +323,22 @@ void ReadUsercmd( bf_read *buf, CUserCmd *move, CUserCmd *from )
move->viewangles[2] = buf->ReadFloat();
}
// Read aim direction
if ( buf->ReadOneBit() )
{
move->aimdirection[0] = buf->ReadFloat();
}
if ( buf->ReadOneBit() )
{
move->aimdirection[1] = buf->ReadFloat();
}
if ( buf->ReadOneBit() )
{
move->aimdirection[2] = buf->ReadFloat();
}
// Read movement
if ( buf->ReadOneBit() )
{

View File

@ -43,6 +43,7 @@ public:
command_number = 0;
tick_count = 0;
viewangles.Init();
aimdirection.Init();
forwardmove = 0.0f;
sidemove = 0.0f;
upmove = 0.0f;
@ -88,6 +89,7 @@ public:
command_number = src.command_number;
tick_count = src.tick_count;
viewangles = src.viewangles;
aimdirection = src.aimdirection;
forwardmove = src.forwardmove;
sidemove = src.sidemove;
upmove = src.upmove;
@ -140,6 +142,7 @@ public:
CRC32_ProcessBuffer( &crc, &command_number, sizeof( command_number ) );
CRC32_ProcessBuffer( &crc, &tick_count, sizeof( tick_count ) );
CRC32_ProcessBuffer( &crc, &viewangles, sizeof( viewangles ) );
CRC32_ProcessBuffer( &crc, &aimdirection, sizeof( aimdirection ) );
CRC32_ProcessBuffer( &crc, &forwardmove, sizeof( forwardmove ) );
CRC32_ProcessBuffer( &crc, &sidemove, sizeof( sidemove ) );
CRC32_ProcessBuffer( &crc, &upmove, sizeof( upmove ) );