Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/game/client/c_baseplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,13 @@ END_RECV_TABLE()
RecvPropBool ( RECVINFO( m_bInTriggerFall ) ),
#endif

#ifdef MAPBASE_MP
// These are transmitted so that prediction is aware of what buttons are disabled
// (e.g. weapons don't fire when +attack is disabled)
RecvPropInt ( RECVINFO( m_afButtonDisabled ) ),
RecvPropInt ( RECVINFO( m_afButtonForced ) ),
#endif

END_RECV_TABLE()


Expand Down
5 changes: 5 additions & 0 deletions src/game/client/c_baseplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,11 @@ class C_BasePlayer : public C_BaseCombatCharacter, public CGameEventListener

int m_nButtons;

#ifdef MAPBASE_MP
int m_afButtonDisabled; // A mask of input flags that are cleared automatically
int m_afButtonForced; // These are forced onto the player's inputs
#endif

CUserCmd *m_pCurrentCommand;

// Movement constraints
Expand Down
6 changes: 6 additions & 0 deletions src/game/client/prediction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,12 @@ void CPrediction::RunCommand( C_BasePlayer *player, CUserCmd *ucmd, IMoveHelper
gpGlobals->curtime = player->m_nTickBase * TICK_INTERVAL;
gpGlobals->frametime = m_bEnginePaused ? 0 : TICK_INTERVAL;

#ifdef MAPBASE_MP
// Add and subtract buttons we're forcing on the player
ucmd->buttons |= player->m_afButtonForced;
ucmd->buttons &= ~player->m_afButtonDisabled;
#endif

g_pGameMovement->StartTrackPredictionErrors( player );

// TODO
Expand Down
8 changes: 8 additions & 0 deletions src/game/server/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9106,6 +9106,14 @@ void SendProxy_ShiftPlayerSpawnflags( const SendProp *pProp, const void *pStruct
SendPropBool ( SENDINFO( m_bInTriggerFall ) ),
#endif

#ifdef MAPBASE_MP
// These are transmitted so that prediction is aware of what buttons are disabled
// (e.g. weapons don't fire when +attack is disabled)
// Number of bits is based on in_buttons.h
SendPropInt ( SENDINFO( m_afButtonDisabled ), 27, SPROP_UNSIGNED ),
SendPropInt ( SENDINFO( m_afButtonForced ), 27, SPROP_UNSIGNED ),
#endif

END_SEND_TABLE()


Expand Down
7 changes: 7 additions & 0 deletions src/game/server/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -959,8 +959,15 @@ class CBasePlayer : public CBaseCombatCharacter
int m_afButtonPressed;
int m_afButtonReleased;
int m_afButtonLast;
#ifdef MAPBASE_MP
// These are transmitted so that prediction is aware of what buttons are disabled
// (e.g. weapons don't fire when +attack is disabled)
CNetworkVar( int, m_afButtonDisabled ); // A mask of input flags that are cleared automatically
CNetworkVar( int, m_afButtonForced ); // These are forced onto the player's inputs
#else
int m_afButtonDisabled; // A mask of input flags that are cleared automatically
int m_afButtonForced; // These are forced onto the player's inputs
#endif

CNetworkVar( bool, m_fOnTarget ); //Is the crosshair on a target?

Expand Down
Loading