enforcing the [-127 127] usercmd range in trap_GetUserCmd

This commit is contained in:
myT 2017-06-20 07:41:39 +02:00
parent 49f7f8bbd8
commit b8e4413d2f
2 changed files with 8 additions and 1 deletions

View file

@ -311,7 +311,11 @@ int trap_GetCurrentCmdNumber( void ) {
}
qboolean trap_GetUserCmd( int cmdNumber, usercmd_t *ucmd ) {
return syscall( CG_GETUSERCMD, cmdNumber, ucmd );
const qboolean result = syscall( CG_GETUSERCMD, cmdNumber, ucmd );
ucmd->forwardmove = max( ucmd->forwardmove, -127 );
ucmd->rightmove = max( ucmd->rightmove, -127 );
ucmd->upmove = max( ucmd->upmove, -127 );
return result;
}
void trap_SetUserCmdValue( int stateValue, float sensitivityScale ) {

View file

@ -212,6 +212,9 @@ void trap_BotFreeClient( int clientNum ) {
void trap_GetUsercmd( int clientNum, usercmd_t *cmd ) {
syscall( G_GET_USERCMD, clientNum, cmd );
cmd->forwardmove = max( cmd->forwardmove, -127 );
cmd->rightmove = max( cmd->rightmove, -127 );
cmd->upmove = max( cmd->upmove, -127 );
}
qboolean trap_GetEntityToken( char *buffer, int bufferSize ) {