diff --git a/src/game/client/c_baseplayer.cpp b/src/game/client/c_baseplayer.cpp index 21e5f5170f..72105cae34 100644 --- a/src/game/client/c_baseplayer.cpp +++ b/src/game/client/c_baseplayer.cpp @@ -2600,7 +2600,7 @@ void C_BasePlayer::PhysicsSimulate( void ) ctx->cmd.sidemove = 0; ctx->cmd.upmove = 0; ctx->cmd.impulse = 0; - ctx->cmd.buttons &= ~(IN_ATTACK | IN_ATTACK2 | IN_ATTACK3 | IN_JUMP | IN_ALT1 | IN_ALT2 | IN_ZOOM); + ctx->cmd.buttons &= ~(IN_ATTACK | IN_ATTACK2 | IN_ATTACK3 | IN_JUMP | IN_ALT1 | IN_ALT2 | IN_ZOOM | IN_JUMP2); } else if (static_cast(this)->GetNeoFlags() & NEO_FL_FREEZETIME) { @@ -2609,7 +2609,7 @@ void C_BasePlayer::PhysicsSimulate( void ) ctx->cmd.upmove = 0; ctx->cmd.impulse = 0; ctx->cmd.buttons &= ~(IN_ATTACK | IN_JUMP | IN_SPEED | - IN_ALT1 | IN_ALT2 | IN_BACK | IN_FORWARD | IN_MOVELEFT | IN_MOVERIGHT | IN_RUN); + IN_ALT1 | IN_ALT2 | IN_BACK | IN_FORWARD | IN_MOVELEFT | IN_MOVERIGHT | IN_RUN | IN_JUMP2); const bool isTachi = (dynamic_cast(GetActiveWeapon()) != NULL); if (!isTachi) { diff --git a/src/game/client/c_baseplayer.h b/src/game/client/c_baseplayer.h index 332e921a2b..f50ad38832 100644 --- a/src/game/client/c_baseplayer.h +++ b/src/game/client/c_baseplayer.h @@ -286,7 +286,11 @@ class C_BasePlayer : public C_BaseCombatCharacter, public CGameEventListener virtual void ViewPunch( const QAngle &angleOffset ); void ViewPunchReset( float tolerance = 0 ); +#ifdef NEO + void UpdateButtonState( int64 nUserCmdButtonMask ); +#else void UpdateButtonState( int nUserCmdButtonMask ); +#endif // NEO int GetImpulse( void ) const; virtual void Simulate(); @@ -442,11 +446,19 @@ class C_BasePlayer : public C_BaseCombatCharacter, public CGameEventListener char m_szAnimExtension[32]; +#ifdef NEO + int64 m_afButtonLast; + int64 m_afButtonPressed; + int64 m_afButtonReleased; + + int64 m_nButtons; +#else int m_afButtonLast; int m_afButtonPressed; int m_afButtonReleased; int m_nButtons; +#endif // NEO CUserCmd *m_pCurrentCommand; diff --git a/src/game/client/c_playerlocaldata.h b/src/game/client/c_playerlocaldata.h index 9994f79f7c..cdd8b50dcf 100644 --- a/src/game/client/c_playerlocaldata.h +++ b/src/game/client/c_playerlocaldata.h @@ -55,7 +55,11 @@ class CPlayerLocalData float m_flJumpTime; int m_nStepside; float m_flFallVelocity; +#ifdef NEO + int64 m_nOldButtons; +#else int m_nOldButtons; +#endif // NEO float m_flOldForwardMove; // Base velocity that was passed in to server physics so // client can predict conveyors correctly. Server zeroes it, so we need to store here, too. diff --git a/src/game/client/c_vguiscreen.cpp b/src/game/client/c_vguiscreen.cpp index 1be4702482..f436f5c125 100644 --- a/src/game/client/c_vguiscreen.cpp +++ b/src/game/client/c_vguiscreen.cpp @@ -743,7 +743,11 @@ void ActivateVguiScreen( C_BaseEntity *pVguiScreenEnt ) } } +#ifdef NEO +void SetVGuiScreenButtonState( C_BaseEntity *pVguiScreenEnt, int64 nButtonState ) +#else void SetVGuiScreenButtonState( C_BaseEntity *pVguiScreenEnt, int nButtonState ) +#endif // NEO { if (pVguiScreenEnt) { diff --git a/src/game/client/c_vguiscreen.h b/src/game/client/c_vguiscreen.h index e62cba1b31..8a8f010753 100644 --- a/src/game/client/c_vguiscreen.h +++ b/src/game/client/c_vguiscreen.h @@ -176,7 +176,11 @@ void DeactivateVguiScreen( C_BaseEntity *pVguiScreen ); //----------------------------------------------------------------------------- // Updates vgui screen button state //----------------------------------------------------------------------------- +#ifdef NEO +void SetVGuiScreenButtonState( C_BaseEntity *pVguiScreen, int64 nButtonState ); +#else void SetVGuiScreenButtonState( C_BaseEntity *pVguiScreen, int nButtonState ); +#endif // NEO #endif // C_VGUISCREEN_H diff --git a/src/game/client/hud.h b/src/game/client/hud.h index 30261fa90c..c983a4b01e 100644 --- a/src/game/client/hud.h +++ b/src/game/client/hud.h @@ -172,7 +172,11 @@ class CHud public: +#ifdef NEO + int64 m_iKeyBits; +#else int m_iKeyBits; +#endif // NEO #ifndef _XBOX float m_flMouseSensitivity; float m_flMouseSensitivityFactor; diff --git a/src/game/client/iinput.h b/src/game/client/iinput.h index bb4751200b..e6a9351c22 100644 --- a/src/game/client/iinput.h +++ b/src/game/client/iinput.h @@ -34,7 +34,11 @@ abstract_class IInput virtual void Init_All( void ) = 0; virtual void Shutdown_All( void ) = 0; // Latching button states +#ifdef NEO + virtual int64 GetButtonBits( int64 ) = 0; +#else virtual int GetButtonBits( int ) = 0; +#endif // NEO // Create movement command virtual void CreateMove ( int sequence_number, float input_sample_frametime, bool active ) = 0; virtual void ExtraMouseSample( float frametime, bool active ) = 0; @@ -109,7 +113,11 @@ abstract_class IInput virtual void LevelInit( void ) = 0; // Causes an input to have to be re-pressed to become active +#ifdef NEO + virtual void ClearInputButton( int64 bits ) = 0; +#else virtual void ClearInputButton( int bits ) = 0; +#endif // NEO virtual void CAM_SetCameraThirdData( CameraThirdData_t *pCameraData, const QAngle &vecCameraOffset ) = 0; virtual void CAM_CameraThirdThink( void ) = 0; diff --git a/src/game/client/in_main.cpp b/src/game/client/in_main.cpp index a414ab7b87..2ac16b0517 100644 --- a/src/game/client/in_main.cpp +++ b/src/game/client/in_main.cpp @@ -57,7 +57,11 @@ extern ConVar cam_idealyaw; // FIXME, tie to entity state parsing for player!!! int g_iAlive = 1; +#ifdef NEO +static int64 s_ClearInputState = 0; +#else static int s_ClearInputState = 0; +#endif // NEO // Defined in pm_math.c float anglemod( float a ); @@ -161,6 +165,7 @@ static kbutton_t in_thermoptic; static kbutton_t in_vision; static kbutton_t in_spec_next; static kbutton_t in_spec_prev; +static kbutton_t in_jump2; #endif /* @@ -649,6 +654,9 @@ void IN_Attack3Down( const CCommand &args ) { KeyDown(&in_attack3, args[1] );} void IN_Attack3Up( const CCommand &args ) { KeyUp(&in_attack3, args[1] );} #ifdef NEO +void IN_Jump2Down ( const CCommand &args ) {KeyDown(&in_jump2, args[1] );} +void IN_Jump2Up ( const CCommand &args ) {KeyUp(&in_jump2, args[1] );} + void IN_DropUp( const CCommand &args ) { KeyUp( &in_drop, args[1] ); } void IN_DropDown( const CCommand &args ) { KeyDown( &in_drop, args[1] ); } @@ -1668,7 +1676,11 @@ CUserCmd *CInput::GetUserCmd( int sequence_number ) // reset - // Output : static void //----------------------------------------------------------------------------- +#ifdef NEO +static void CalcButtonBits( int64& bits, int64 in_button, int64 in_ignore, kbutton_t *button, bool reset ) +#else static void CalcButtonBits( int& bits, int in_button, int in_ignore, kbutton_t *button, bool reset ) +#endif // NEO { // Down or still down? if ( button->state & 3 ) @@ -1699,9 +1711,17 @@ Returns appropriate button info for keyboard and mouse state Set bResetState to 1 to clear old state info ============ */ +#ifdef NEO +int64 CInput::GetButtonBits( int64 bResetState ) +#else int CInput::GetButtonBits( int bResetState ) +#endif // NEO { +#ifdef NEO + int64 bits = 0; +#else int bits = 0; +#endif // NEO CalcButtonBits( bits, IN_SPEED, s_ClearInputState, &in_speed, bResetState ); CalcButtonBits( bits, IN_WALK, s_ClearInputState, &in_walk, bResetState ); @@ -1732,6 +1752,7 @@ int CInput::GetButtonBits( int bResetState ) CalcButtonBits( bits, IN_LEAN_RIGHT, s_ClearInputState, &in_lean_right, bResetState ); CalcButtonBits( bits, IN_THERMOPTIC, s_ClearInputState, &in_thermoptic, bResetState); CalcButtonBits( bits, IN_VISION, s_ClearInputState, &in_vision, bResetState); + CalcButtonBits( bits, IN_JUMP2, s_ClearInputState, &in_jump2, bResetState ); if (KeyState(&in_speed) && !IsLocalPlayerSpectator()) { // Cancel walk toggle if sprinting @@ -1775,7 +1796,11 @@ int CInput::GetButtonBits( int bResetState ) //----------------------------------------------------------------------------- // Causes an input to have to be re-pressed to become active //----------------------------------------------------------------------------- +#ifdef NEO +void CInput::ClearInputButton( int64 bits ) +#else void CInput::ClearInputButton( int bits ) +#endif // NEO { s_ClearInputState |= bits; } @@ -1946,6 +1971,9 @@ static ConCommand endspecnextplayer("-specnextplayer", IN_SpecNextUp); static ConCommand startspecprevplayer("+specprevplayer", IN_SpecPrevDown); static ConCommand endspecprevplayer("-specprevplayer", IN_SpecPrevUp); + +static ConCommand startjump2("+jump2", IN_Jump2Down); +static ConCommand endjump2("-jump2", IN_Jump2Up); #endif /* diff --git a/src/game/client/input.h b/src/game/client/input.h index f84bf5b816..1d21516bc6 100644 --- a/src/game/client/input.h +++ b/src/game/client/input.h @@ -46,7 +46,11 @@ class CInput : public IInput virtual void Init_All( void ); virtual void Shutdown_All( void ); +#ifdef NEO + virtual int64 GetButtonBits( int64 ); +#else virtual int GetButtonBits( int ); +#endif // NEO virtual void CreateMove ( int sequence_number, float input_sample_frametime, bool active ); virtual void ExtraMouseSample( float frametime, bool active ); virtual bool WriteUsercmdDeltaToBuffer( bf_write *buf, int from, int to, bool isnewcommand ); @@ -83,7 +87,11 @@ class CInput : public IInput virtual float Joystick_GetSide( void ); virtual float Joystick_GetPitch( void ); virtual float Joystick_GetYaw( void ); +#ifdef NEO + virtual void ClearInputButton( int64 bits ); +#else virtual void ClearInputButton( int bits ); +#endif // NEO virtual void CAM_Think( void ); virtual int CAM_IsThirdPerson( void ); diff --git a/src/game/client/neo/c_neo_player.cpp b/src/game/client/neo/c_neo_player.cpp index 0b6563fae7..c6f80173a3 100644 --- a/src/game/client/neo/c_neo_player.cpp +++ b/src/game/client/neo/c_neo_player.cpp @@ -936,7 +936,7 @@ void C_NEO_Player::CalculateSpeed(void) void C_NEO_Player::HandleSpeedChangesLegacy() { - int buttonsChanged = m_afButtonPressed | m_afButtonReleased; + const int64 buttonsChanged = m_afButtonPressed | m_afButtonReleased; if( buttonsChanged & (IN_SPEED | IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT) || m_nButtons & IN_SPEED) { @@ -993,7 +993,7 @@ void C_NEO_Player::HandleSpeedChangesLegacy() #if 0 void C_NEO_Player::HandleSpeedChanges( CMoveData *mv ) { - int nChangedButtons = mv->m_nButtons ^ mv->m_nOldButtons; + const int64 nChangedButtons = mv->m_nButtons ^ mv->m_nOldButtons; bool bJustPressedSpeed = !!( nChangedButtons & IN_SPEED ); @@ -1525,7 +1525,7 @@ bool C_NEO_Player::IsAllowedToSuperJump(void) // Only superjump if we have a reasonable jump direction in mind // NEO TODO (Rain): should we support sideways superjumping? - if ((m_nButtons & (IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT)) == 0) + if ((m_nButtons & (IN_FORWARD | IN_BACK)) == 0) { return false; } diff --git a/src/game/server/CommentarySystem.cpp b/src/game/server/CommentarySystem.cpp index bac8089de2..14231acc61 100644 --- a/src/game/server/CommentarySystem.cpp +++ b/src/game/server/CommentarySystem.cpp @@ -411,8 +411,13 @@ class CCommentarySystem : public CAutoGameSystemPerFrame if ( pPlayer ) { // Has the player pressed down an attack button? +#ifdef NEO + const int64 buttonsChanged = m_afPlayersLastButtons ^ pUserCmds->buttons; + const int64 buttonsPressed = buttonsChanged & pUserCmds->buttons; +#else int buttonsChanged = m_afPlayersLastButtons ^ pUserCmds->buttons; int buttonsPressed = buttonsChanged & pUserCmds->buttons; +#endif // NEO m_afPlayersLastButtons = pUserCmds->buttons; if ( !(pUserCmds->buttons & COMMENTARY_BUTTONS) ) @@ -469,7 +474,11 @@ class CCommentarySystem : public CAutoGameSystemPerFrame if ( GetActiveNode() && GetActiveNode()->PreventsMovement() ) { +#ifdef NEO + pUserCmds->buttons &= ~(IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT | IN_JUMP | IN_DUCK | IN_JUMP2 ); +#else pUserCmds->buttons &= ~(IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT | IN_JUMP | IN_DUCK ); +#endif // NEO pUserCmds->upmove = 0; pUserCmds->sidemove = 0; pUserCmds->forwardmove = 0; @@ -785,10 +794,18 @@ class CCommentarySystem : public CAutoGameSystemPerFrame } private: +#ifdef NEO + int64 m_afPlayersLastButtons; +#else int m_afPlayersLastButtons; +#endif // NEO int m_iCommentaryNodeCount; bool m_bCommentaryConvarsChanging; +#ifdef NEO + int64 m_iClearPressedButtons; +#else int m_iClearPressedButtons; +#endif // NEO bool m_bCommentaryEnabledMidGame; float m_flNextTeleportTime; int m_iTeleportStage; diff --git a/src/game/server/NextBot/Player/NextBotPlayer.h b/src/game/server/NextBot/Player/NextBotPlayer.h index 2a90a830ec..05183ed8e8 100644 --- a/src/game/server/NextBot/Player/NextBotPlayer.h +++ b/src/game/server/NextBot/Player/NextBotPlayer.h @@ -297,8 +297,13 @@ class NextBotPlayer : public PlayerType, public INextBot, public INextBotPlayerI virtual void Update( void ); // (EXTEND) update internal state protected: +#ifdef NEO + int64 m_inputButtons; // this is still needed to guarantee each button press is captured at least once + int64 m_prevInputButtons; +#else int m_inputButtons; // this is still needed to guarantee each button press is captured at least once int m_prevInputButtons; +#endif // NEO CountdownTimer m_fireButtonTimer; CountdownTimer m_meleeButtonTimer; CountdownTimer m_specialFireButtonTimer; @@ -749,7 +754,11 @@ inline void NextBotPlayer< PlayerType >::Spawn( void ) //----------------------------------------------------------------------------------------------------- +#ifdef NEO +inline void _NextBot_BuildUserCommand( CUserCmd *cmd, const QAngle &viewangles, float forwardmove, float sidemove, float upmove, int64 buttons, byte impulse ) +#else inline void _NextBot_BuildUserCommand( CUserCmd *cmd, const QAngle &viewangles, float forwardmove, float sidemove, float upmove, int buttons, byte impulse ) +#endif // NEO { Q_memset( cmd, 0, sizeof( CUserCmd ) ); @@ -826,8 +835,10 @@ inline void NextBotPlayer< PlayerType >::PhysicsSimulate( void ) } } } -#endif // NEO + int64 inputButtons; +#else int inputButtons; +#endif // NEO // // Update bot behavior // @@ -971,7 +982,11 @@ inline void NextBotPlayer< PlayerType >::PhysicsSimulate( void ) if ( !NextBotPlayerMove.GetBool() ) { +#ifdef NEO + inputButtons &= ~(IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT | IN_JUMP | IN_JUMP2 ); +#else inputButtons &= ~(IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT | IN_JUMP ); +#endif // NEO forwardSpeed = 0.0f; strafeSpeed = 0.0f; verticalSpeed = 0.0f; diff --git a/src/game/server/episodic/vehicle_jeep_episodic.h b/src/game/server/episodic/vehicle_jeep_episodic.h index 70cb5894db..6812f2b1ca 100644 --- a/src/game/server/episodic/vehicle_jeep_episodic.h +++ b/src/game/server/episodic/vehicle_jeep_episodic.h @@ -66,7 +66,7 @@ class CPropJeepEpisodic : public CPropJeep void AddPropToCargoHold( CPhysicsProp *pProp ); virtual CBaseEntity *OnFailedPhysGunPickup( Vector vPhysgunPos ); - virtual void DriveVehicle( float flFrameTime, CUserCmd *ucmd, int iButtonsDown, int iButtonsReleased ); + virtual void DriveVehicle( float flFrameTime, CUserCmd *ucmd, int iButtonsDown, int iButtonsReleased ); // NEO TODO (Adam) change to int64 when building this virtual int DrawDebugTextOverlays( void ); DECLARE_DATADESC(); diff --git a/src/game/server/fourwheelvehiclephysics.cpp b/src/game/server/fourwheelvehiclephysics.cpp index 3a70d02d79..f3f350f93e 100644 --- a/src/game/server/fourwheelvehiclephysics.cpp +++ b/src/game/server/fourwheelvehiclephysics.cpp @@ -1054,7 +1054,11 @@ void CFourWheelVehiclePhysics::SteeringTurnAnalog( float carSpeed, const vehicle void CFourWheelVehiclePhysics::UpdateDriverControls( CUserCmd *cmd, float flFrameTime ) { const float SPEED_THROTTLE_AS_BRAKE = 2.0f; +#ifdef NEO + const int64 nButtons = cmd->buttons; +#else int nButtons = cmd->buttons; +#endif // NEO // Get vehicle data. const vehicle_operatingparams_t &carState = m_pVehicle->GetOperatingParams(); @@ -1341,7 +1345,11 @@ void CFourWheelVehiclePhysics::UpdateDriverControls( CUserCmd *cmd, float flFram } // Using has brakepedal for handbrake as well. +#ifdef NEO + if ( ( nButtons & (IN_JUMP | IN_JUMP2) ) && m_controls.bHasBrakePedal ) +#else if ( ( nButtons & IN_JUMP ) && m_controls.bHasBrakePedal ) +#endif // NEO { m_controls.handbrake = true; diff --git a/src/game/server/game_ui.cpp b/src/game/server/game_ui.cpp index a514a0f838..2b3147cdc6 100644 --- a/src/game/server/game_ui.cpp +++ b/src/game/server/game_ui.cpp @@ -68,7 +68,11 @@ class CGameUI : public CBaseEntity COutputFloat m_attack2axis; bool m_bForceUpdate; +#ifdef NEO + int64 m_nLastButtonState; +#else int m_nLastButtonState; +#endif // NEO CHandle m_player; }; @@ -295,14 +299,22 @@ void CGameUI::Think( void ) // Deactivate if they jump or press +use. // FIXME: prevent the use from going through in player.cpp if ((( pPlayer->m_afButtonPressed & IN_USE ) && ( m_spawnflags & SF_GAMEUI_USE_DEACTIVATES )) || +#ifdef NEO + (( pPlayer->m_afButtonPressed & (IN_JUMP | IN_JUMP2) ) && ( m_spawnflags & SF_GAMEUI_JUMP_DEACTIVATES ))) +#else (( pPlayer->m_afButtonPressed & IN_JUMP ) && ( m_spawnflags & SF_GAMEUI_JUMP_DEACTIVATES ))) +#endif // NEO { Deactivate( pPlayer ); return; } // Determine what's different +#ifdef NEO + const int64 nButtonsChanged = ( pPlayer->m_nButtons ^ m_nLastButtonState ); +#else int nButtonsChanged = ( pPlayer->m_nButtons ^ m_nLastButtonState ); +#endif // NEO // // Handle all our possible input triggers diff --git a/src/game/server/hl2/hl2_player.cpp b/src/game/server/hl2/hl2_player.cpp index 88f10a56f4..4f21c1fea7 100644 --- a/src/game/server/hl2/hl2_player.cpp +++ b/src/game/server/hl2/hl2_player.cpp @@ -3183,7 +3183,11 @@ void CHL2_Player::PlayerUse ( void ) else { // Start controlling the train! CBaseEntity *pTrain = GetGroundEntity(); +#ifdef NEO + if ( pTrain && !(m_nButtons & (IN_JUMP | IN_JUMP2)) && (GetFlags() & FL_ONGROUND) && (pTrain->ObjectCaps() & FCAP_DIRECTIONAL_USE) && pTrain->OnControls(this) ) +#else if ( pTrain && !(m_nButtons & IN_JUMP) && (GetFlags() & FL_ONGROUND) && (pTrain->ObjectCaps() & FCAP_DIRECTIONAL_USE) && pTrain->OnControls(this) ) +#endif // NEO { m_afPhysicsFlags |= PFLAG_DIROVERRIDE; m_iTrain = TrainSpeed(pTrain->m_flSpeed, ((CFuncTrackTrain*)pTrain)->GetMaxSpeed()); diff --git a/src/game/server/hl2/vehicle_airboat.cpp b/src/game/server/hl2/vehicle_airboat.cpp index b76b886ea2..c76b0cfefb 100644 --- a/src/game/server/hl2/vehicle_airboat.cpp +++ b/src/game/server/hl2/vehicle_airboat.cpp @@ -83,7 +83,11 @@ class CPropAirboat : public CPropVehicleDriveable // CPropVehicle virtual void ProcessMovement( CBasePlayer *pPlayer, CMoveData *pMoveData ); +#ifdef NEO + virtual void DriveVehicle( float flFrameTime, CUserCmd *ucmd, int64 iButtonsDown, int64 iButtonsReleased ); +#else virtual void DriveVehicle( float flFrameTime, CUserCmd *ucmd, int iButtonsDown, int iButtonsReleased ); +#endif // NEO void DampenEyePosition( Vector &vecVehicleEyePos, QAngle &vecVehicleEyeAngles ); bool ShouldThink() { return true; } @@ -1770,7 +1774,11 @@ void CPropAirboat::UpdateGunState( CUserCmd *ucmd ) //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- +#ifdef NEO +void CPropAirboat::DriveVehicle( float flFrameTime, CUserCmd *ucmd, int64 iButtonsDown, int64 iButtonsReleased ) +#else void CPropAirboat::DriveVehicle( float flFrameTime, CUserCmd *ucmd, int iButtonsDown, int iButtonsReleased ) +#endif // NEO { if ( ucmd->impulse == 100 ) { diff --git a/src/game/server/hl2/vehicle_apc.cpp b/src/game/server/hl2/vehicle_apc.cpp index 2445006785..b704877d48 100644 --- a/src/game/server/hl2/vehicle_apc.cpp +++ b/src/game/server/hl2/vehicle_apc.cpp @@ -710,13 +710,21 @@ void CPropAPC::AimSecondaryWeaponAt( CBaseEntity *pTarget ) //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- +#ifdef NEO +void CPropAPC::DriveVehicle( float flFrameTime, CUserCmd *ucmd, int64 iButtonsDown, int64 iButtonsReleased ) +#else void CPropAPC::DriveVehicle( float flFrameTime, CUserCmd *ucmd, int iButtonsDown, int iButtonsReleased ) +#endif // NEO { switch( m_lifeState ) { case LIFE_ALIVE: { +#ifdef NEO + const int64 iButtons = ucmd->buttons; +#else int iButtons = ucmd->buttons; +#endif // NEO if ( iButtons & IN_ATTACK ) { FireMachineGun(); diff --git a/src/game/server/hl2/vehicle_apc.h b/src/game/server/hl2/vehicle_apc.h index 5c7aa56146..55d94b62e9 100644 --- a/src/game/server/hl2/vehicle_apc.h +++ b/src/game/server/hl2/vehicle_apc.h @@ -53,7 +53,11 @@ class CPropAPC : public CPropVehicleDriveable // CPropVehicle virtual void CreateServerVehicle( void ); +#ifdef NEO + virtual void DriveVehicle( float flFrameTime, CUserCmd *ucmd, int64 iButtonsDown, int64 iButtonsReleased ); +#else virtual void DriveVehicle( float flFrameTime, CUserCmd *ucmd, int iButtonsDown, int iButtonsReleased ); +#endif // NEO virtual void ProcessMovement( CBasePlayer *pPlayer, CMoveData *pMoveData ); virtual Class_T ClassifyPassenger( CBaseCombatCharacter *pPassenger, Class_T defaultClassification ); virtual int OnTakeDamage( const CTakeDamageInfo &info ); diff --git a/src/game/server/hl2/vehicle_cannon.cpp b/src/game/server/hl2/vehicle_cannon.cpp index 4316802b57..fb0c523e22 100644 --- a/src/game/server/hl2/vehicle_cannon.cpp +++ b/src/game/server/hl2/vehicle_cannon.cpp @@ -122,7 +122,7 @@ class CPropCannon : public CBaseProp, public IDrivableVehicle virtual bool CreateVPhysics( void ); virtual void UpdateOnRemove( void ); - void DriveCannon( int iDriverButtons, int iButtonsPressed ); + void DriveCannon( int iDriverButtons, int iButtonsPressed ); // NEO TODO (Adam) change iDriverButtons and iButtonsPressed to int64 when building this void ResetUseKey( CBasePlayer *pPlayer ); void InitCannonSpeeds( void ); void RunCraneMovement( float flTime ); diff --git a/src/game/server/hl2/vehicle_crane.cpp b/src/game/server/hl2/vehicle_crane.cpp index c8e30b4ffb..b0c5354ac2 100644 --- a/src/game/server/hl2/vehicle_crane.cpp +++ b/src/game/server/hl2/vehicle_crane.cpp @@ -484,7 +484,11 @@ void CPropCrane::SetupMove( CBasePlayer *player, CUserCmd *ucmd, IMoveHelper *pH // If the player's entering/exiting the vehicle, prevent movement if ( !m_bEnterAnimOn && !m_bExitAnimOn ) { +#ifdef NEO + int64 buttons = ucmd->buttons; +#else int buttons = ucmd->buttons; +#endif // NEO if ( !(buttons & (IN_MOVELEFT|IN_MOVERIGHT)) ) { if ( ucmd->sidemove < 0 ) @@ -507,7 +511,11 @@ void CPropCrane::SetupMove( CBasePlayer *player, CUserCmd *ucmd, IMoveHelper *pH // Purpose: Crane rotates around with +left and +right, and extends/retracts // the cable with +forward and +back. //----------------------------------------------------------------------------- +#ifdef NEO +void CPropCrane::DriveCrane( int64 iDriverButtons, int64 iButtonsPressed, float flNPCSteering ) +#else void CPropCrane::DriveCrane( int iDriverButtons, int iButtonsPressed, float flNPCSteering ) +#endif // NEO { bool bWasExtending = m_bExtending; @@ -1004,7 +1012,11 @@ void CCraneServerVehicle::NPC_DriveVehicle( void ) { NDebugOverlay::Line( GetCrane()->GetAbsOrigin(), GetCrane()->GetAbsOrigin() + vecRight * 200, 0,255,0, true, 0.1 ); } +#ifdef NEO + if ( m_nNPCButtons & (IN_JUMP | IN_JUMP2) ) +#else if ( m_nNPCButtons & IN_JUMP ) +#endif // NEO { NDebugOverlay::Box( GetCrane()->GetAbsOrigin(), -Vector(20,20,20), Vector(20,20,20), 0,255,0, true, 0.1 ); } diff --git a/src/game/server/hl2/vehicle_crane.h b/src/game/server/hl2/vehicle_crane.h index 57d25e8164..915ba82e2a 100644 --- a/src/game/server/hl2/vehicle_crane.h +++ b/src/game/server/hl2/vehicle_crane.h @@ -141,7 +141,11 @@ class CPropCrane : public CBaseProp, public IDrivableVehicle void PlayerControlShutdown( void ); void ResetUseKey( CBasePlayer *pPlayer ); +#ifdef NEO + void DriveCrane( int64 iDriverButtons, int64 iButtonsPressed, float flNPCSteering = 0.0 ); +#else void DriveCrane( int iDriverButtons, int iButtonsPressed, float flNPCSteering = 0.0 ); +#endif // NEO void RunCraneMovement( float flTime ); void TurnMagnetOn( void ); @@ -201,7 +205,11 @@ class CPropCrane : public CBaseProp, public IDrivableVehicle // NPC Driving CHandle m_hNPCDriver; +#ifdef NEO + int64 m_nNPCButtons; +#else int m_nNPCButtons; +#endif // NEO // Entering / Exiting bool m_bLocked; diff --git a/src/game/server/hl2/vehicle_jeep.cpp b/src/game/server/hl2/vehicle_jeep.cpp index 80eb13683a..d05348e799 100644 --- a/src/game/server/hl2/vehicle_jeep.cpp +++ b/src/game/server/hl2/vehicle_jeep.cpp @@ -1322,7 +1322,7 @@ void CPropJeep::SetupMove( CBasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHe //----------------------------------------------------------------------------- void CPropJeep::DriveVehicle( float flFrameTime, CUserCmd *ucmd, int iButtonsDown, int iButtonsReleased ) { - int iButtons = ucmd->buttons; + int iButtons = ucmd->buttons; // NEO TODO (Adam) change to int64 when building this //Adrian: No headlights on Superfly. /* if ( ucmd->impulse == 100 ) diff --git a/src/game/server/hl2/vehicle_jeep.h b/src/game/server/hl2/vehicle_jeep.h index ba08c2c410..55bc0a61e5 100644 --- a/src/game/server/hl2/vehicle_jeep.h +++ b/src/game/server/hl2/vehicle_jeep.h @@ -41,7 +41,7 @@ class CPropJeep : public CPropVehicleDriveable // CPropVehicle virtual void ProcessMovement( CBasePlayer *pPlayer, CMoveData *pMoveData ); - virtual void DriveVehicle( float flFrameTime, CUserCmd *ucmd, int iButtonsDown, int iButtonsReleased ); + virtual void DriveVehicle( float flFrameTime, CUserCmd *ucmd, int iButtonsDown, int iButtonsReleased ); // NEO TODO (Adam) change to int64 when building this virtual void SetupMove( CBasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper, CMoveData *move ); virtual void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ); virtual void DampenEyePosition( Vector &vecVehicleEyePos, QAngle &vecVehicleEyeAngles ); diff --git a/src/game/server/hl2/weapon_physcannon.cpp b/src/game/server/hl2/weapon_physcannon.cpp index 7e49b7f4b5..01588edcfa 100644 --- a/src/game/server/hl2/weapon_physcannon.cpp +++ b/src/game/server/hl2/weapon_physcannon.cpp @@ -1344,7 +1344,7 @@ class CWeaponPhysCannon : public CBaseHLCombatWeapon int m_nChangeState; //For delayed state change of elements float m_flCheckSuppressTime; //Amount of time to suppress the checking for targets bool m_flLastDenySoundPlayed; //Debounce for deny sound - int m_nAttack2Debounce; + int m_nAttack2Debounce; // NEO TODO (Adam) change to int64 when building this? CNetworkVar( bool, m_bIsCurrentlyUpgrading ); CNetworkVar( float, m_flTimeForceView ); @@ -3308,7 +3308,7 @@ void CWeaponPhysCannon::ItemPostFrame() } // NOTE: Attack2 will be considered to be pressed until the first item is picked up. - int nAttack2Mask = pOwner->m_nButtons & (~m_nAttack2Debounce); + int nAttack2Mask = pOwner->m_nButtons & (~m_nAttack2Debounce); // NEO TODO (Adam) Change to int64 when building this? if ( nAttack2Mask & IN_ATTACK2 ) { SecondaryAttack(); diff --git a/src/game/server/neo/bot/behavior/neo_bot_behavior.cpp b/src/game/server/neo/bot/behavior/neo_bot_behavior.cpp index 32723f42c8..37eaf57e7b 100644 --- a/src/game/server/neo/bot/behavior/neo_bot_behavior.cpp +++ b/src/game/server/neo/bot/behavior/neo_bot_behavior.cpp @@ -351,7 +351,7 @@ void CNEOBotMainAction::ReconConsiderSuperJump( CNEOBot *me ) // Check that bot isn't only moving sideways which wastes aux power // Also determines a direction to jump towards // NEO Jank: We don't check sprint here because bots don't anticipate using sprint in a smart manner - const int nForwardBack = me->m_nButtons & ( IN_FORWARD | IN_BACK ); + const int64 nForwardBack = me->m_nButtons & ( IN_FORWARD | IN_BACK ); if ( nForwardBack == 0 || nForwardBack == ( IN_FORWARD | IN_BACK ) ) { // Remove this check if we add sideways super jump in the future diff --git a/src/game/server/neo/bot/behavior/neo_bot_command_follow.cpp b/src/game/server/neo/bot/behavior/neo_bot_command_follow.cpp index 02bdd2a772..dde612aea8 100644 --- a/src/game/server/neo/bot/behavior/neo_bot_command_follow.cpp +++ b/src/game/server/neo/bot/behavior/neo_bot_command_follow.cpp @@ -205,7 +205,7 @@ bool CNEOBotCommandFollow::FollowCommandChain(CNEOBot* me) // Urge bots to sneak when walk button is held commanderIsQuiet = true; } - else if ( !(pCommander->m_nButtons & (IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT | IN_JUMP | IN_SPEED | IN_RUN )) ) + else if ( !(pCommander->m_nButtons & (IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT | IN_JUMP | IN_SPEED | IN_RUN | IN_JUMP2 )) ) { // Standing still (or at least not pressing movement buttons) also implies quiet // Even while standing still, press IN_SPEED / IN_RUN to urge bots to move faster diff --git a/src/game/server/neo/neo_player.cpp b/src/game/server/neo/neo_player.cpp index 7e04b45bc1..0fefd1207f 100644 --- a/src/game/server/neo/neo_player.cpp +++ b/src/game/server/neo/neo_player.cpp @@ -969,7 +969,7 @@ void CNEO_Player::CalculateSpeed(void) void CNEO_Player::HandleSpeedChangesLegacy() { - int buttonsChanged = m_afButtonPressed | m_afButtonReleased; + const int64 buttonsChanged = m_afButtonPressed | m_afButtonReleased; bool bCanSprint = CanSprint(); bool bIsSprinting = IsSprinting(); @@ -1048,7 +1048,7 @@ void CNEO_Player::HandleSpeedChangesLegacy() #if 0 void CNEO_Player::HandleSpeedChanges( CMoveData *mv ) { - int nChangedButtons = mv->m_nButtons ^ mv->m_nOldButtons; + const int64 nChangedButtons = mv->m_nButtons ^ mv->m_nOldButtons; bool bJustPressedSpeed = !!( nChangedButtons & IN_SPEED ); @@ -1728,7 +1728,7 @@ bool CNEO_Player::IsAllowedToSuperJump(void) // Only superjump if we have a reasonable jump direction in mind // NEO TODO (Rain): should we support sideways superjumping? - if ((m_nButtons & (IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT)) == 0) + if ((m_nButtons & (IN_FORWARD | IN_BACK )) == 0) { return false; } diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp index 596f300be2..5f80032a65 100644 --- a/src/game/server/player.cpp +++ b/src/game/server/player.cpp @@ -2266,7 +2266,11 @@ void CBasePlayer::PlayerDeathThink(void) IncrementInterpolationFrame(); m_flPlaybackRate = 0.0; +#ifdef NEO + int64 fAnyButtonDown = (m_nButtons & ~IN_SCORE); +#else int fAnyButtonDown = (m_nButtons & ~IN_SCORE); +#endif // NEO // Strip out the duck key from this check if it's toggled if ( (fAnyButtonDown & IN_DUCK) && GetToggledDuckState()) @@ -3996,7 +4000,7 @@ void CBasePlayer::PlayerRunCommand(CUserCmd *ucmd, IMoveHelper *moveHelper) } ucmd->buttons &= ~(IN_ATTACK | IN_JUMP | IN_SPEED | - IN_ALT1 | IN_ALT2 | IN_BACK | IN_FORWARD | IN_MOVELEFT | IN_MOVERIGHT | IN_RUN); + IN_ALT1 | IN_ALT2 | IN_BACK | IN_FORWARD | IN_MOVELEFT | IN_MOVERIGHT | IN_RUN | IN_JUMP2); const bool isTachi = (dynamic_cast(GetActiveWeapon()) != NULL); if (!isTachi) { @@ -4049,7 +4053,7 @@ void CBasePlayer::PlayerRunCommand(CUserCmd *ucmd, IMoveHelper *moveHelper) ucmd->sidemove = 0; ucmd->upmove = 0; ucmd->impulse = 0; - ucmd->buttons &= ~(IN_ATTACK | IN_ATTACK2 | IN_ATTACK3 | IN_JUMP | IN_ALT1 | IN_ALT2 | IN_ZOOM); + ucmd->buttons &= ~(IN_ATTACK | IN_ATTACK2 | IN_ATTACK3 | IN_JUMP | IN_ALT1 | IN_ALT2 | IN_ZOOM | IN_JUMP2); } #endif @@ -4059,7 +4063,11 @@ void CBasePlayer::PlayerRunCommand(CUserCmd *ucmd, IMoveHelper *moveHelper) //----------------------------------------------------------------------------- // Purpose: Strips off IN_xxx flags from the player's input //----------------------------------------------------------------------------- +#ifdef NEO +void CBasePlayer::DisableButtons( int64 nButtons ) +#else void CBasePlayer::DisableButtons( int nButtons ) +#endif // NEO { m_afButtonDisabled |= nButtons; } @@ -4067,7 +4075,11 @@ void CBasePlayer::DisableButtons( int nButtons ) //----------------------------------------------------------------------------- // Purpose: Re-enables stripped IN_xxx flags to the player's input //----------------------------------------------------------------------------- +#ifdef NEO +void CBasePlayer::EnableButtons( int64 nButtons ) +#else void CBasePlayer::EnableButtons( int nButtons ) +#endif // NEO { m_afButtonDisabled &= ~nButtons; } @@ -4075,7 +4087,11 @@ void CBasePlayer::EnableButtons( int nButtons ) //----------------------------------------------------------------------------- // Purpose: Strips off IN_xxx flags from the player's input //----------------------------------------------------------------------------- +#ifdef NEO +void CBasePlayer::ForceButtons( int64 nButtons ) +#else void CBasePlayer::ForceButtons( int nButtons ) +#endif // NEO { m_afButtonForced |= nButtons; } @@ -4083,7 +4099,11 @@ void CBasePlayer::ForceButtons( int nButtons ) //----------------------------------------------------------------------------- // Purpose: Re-enables stripped IN_xxx flags to the player's input //----------------------------------------------------------------------------- +#ifdef NEO +void CBasePlayer::UnforceButtons( int64 nButtons ) +#else void CBasePlayer::UnforceButtons( int nButtons ) +#endif // NEO { m_afButtonForced &= ~nButtons; } @@ -4221,7 +4241,11 @@ void CBasePlayer::PreThink(void) HandleFuncTrain(); +#ifdef NEO + if (m_nButtons & (IN_JUMP | IN_JUMP2)) +#else if (m_nButtons & IN_JUMP) +#endif // NEO { // If on a ladder, jump off the ladder // else Jump @@ -4748,7 +4772,11 @@ void CBasePlayer::UpdatePlayerSound ( void ) iBodyVolume = 0; } +#ifdef NEO + if ( m_nButtons & (IN_JUMP | IN_JUMP2) ) +#else if ( m_nButtons & IN_JUMP ) +#endif // NEO { // Jumping is a little louder. iBodyVolume += 100; @@ -8318,7 +8346,11 @@ class CMovementSpeedMod : public CPointEntity void InputSpeedMod(inputdata_t &data); private: +#ifdef NEO + int64 GetDisabledButtonMask( void ); +#else int GetDisabledButtonMask( void ); +#endif // NEO DECLARE_DATADESC(); }; @@ -8328,14 +8360,26 @@ LINK_ENTITY_TO_CLASS( player_speedmod, CMovementSpeedMod ); BEGIN_DATADESC( CMovementSpeedMod ) DEFINE_INPUTFUNC( FIELD_FLOAT, "ModifySpeed", InputSpeedMod ), END_DATADESC() - + +#ifdef NEO +int64 CMovementSpeedMod::GetDisabledButtonMask( void ) +#else int CMovementSpeedMod::GetDisabledButtonMask( void ) +#endif // NEO { +#ifdef NEO + int64 nMask = 0; +#else int nMask = 0; +#endif // NEO if ( HasSpawnFlags( SF_SPEED_MOD_SUPPRESS_JUMP ) ) { +#ifdef NEO + nMask |= (IN_JUMP | IN_JUMP2); +#else nMask |= IN_JUMP; +#endif // NEO } if ( HasSpawnFlags( SF_SPEED_MOD_SUPPRESS_DUCK ) ) diff --git a/src/game/server/player.h b/src/game/server/player.h index 31380df8aa..1c2bd851f3 100644 --- a/src/game/server/player.h +++ b/src/game/server/player.h @@ -783,10 +783,17 @@ class CBasePlayer : public CBaseCombatCharacter float LastTimePlayerTalked() const { return m_fLastPlayerTalkTime; } bool ArePlayerTalkMessagesAvailable(); +#ifdef NEO + void DisableButtons( int64 nButtons ); + void EnableButtons( int64 nButtons ); + void ForceButtons( int64 nButtons ); + void UnforceButtons( int64 nButtons ); +#else void DisableButtons( int nButtons ); void EnableButtons( int nButtons ); void ForceButtons( int nButtons ); void UnforceButtons( int nButtons ); +#endif // NEO //--------------------------------- // Inputs @@ -889,12 +896,21 @@ class CBasePlayer : public CBaseCombatCharacter IMPLEMENT_NETWORK_VAR_FOR_DERIVED( m_vecVelocity ); IMPLEMENT_NETWORK_VAR_FOR_DERIVED( m_nWaterLevel ); +#ifdef NEO + int64 m_nButtons; + int64 m_afButtonPressed; + int64 m_afButtonReleased; + int64 m_afButtonLast; + int64 m_afButtonDisabled; // A mask of input flags that are cleared automatically + int64 m_afButtonForced; // These are forced onto the player's inputs +#else int m_nButtons; int m_afButtonPressed; int m_afButtonReleased; int m_afButtonLast; int m_afButtonDisabled; // A mask of input flags that are cleared automatically int m_afButtonForced; // These are forced onto the player's inputs +#endif // NEO CNetworkVar( bool, m_fOnTarget ); //Is the crosshair on a target? @@ -959,7 +975,11 @@ class CBasePlayer : public CBaseCombatCharacter int m_iVehicleAnalogBias; +#ifdef NEO + void UpdateButtonState( int64 nUserCmdButtonMask ); +#else void UpdateButtonState( int nUserCmdButtonMask ); +#endif // NEO bool m_bPauseBonusProgress; CNetworkVar( int, m_iBonusProgress ); diff --git a/src/game/server/playerlocaldata.h b/src/game/server/playerlocaldata.h index b4aa51a1bd..525288f60c 100644 --- a/src/game/server/playerlocaldata.h +++ b/src/game/server/playerlocaldata.h @@ -63,7 +63,11 @@ class CPlayerLocalData // Velocity at time when we hit ground CNetworkVar( float, m_flFallVelocity ); // Previous button state +#ifdef NEO + int64 m_nOldButtons; +#else int m_nOldButtons; +#endif // NEO float m_flOldForwardMove; class CSkyCamera *m_pOldSkyCamera; // Base velocity that was passed in to server physics so diff --git a/src/game/server/sdk/sdk_vehicle_jeep.cpp b/src/game/server/sdk/sdk_vehicle_jeep.cpp index e1617cfd81..e36cb345a3 100644 --- a/src/game/server/sdk/sdk_vehicle_jeep.cpp +++ b/src/game/server/sdk/sdk_vehicle_jeep.cpp @@ -107,7 +107,7 @@ class CPropJeep : public CPropVehicleDriveable // CPropVehicle virtual void ProcessMovement( CBasePlayer *pPlayer, CMoveData *pMoveData ); - virtual void DriveVehicle( float flFrameTime, CUserCmd *ucmd, int iButtonsDown, int iButtonsReleased ); + virtual void DriveVehicle( float flFrameTime, CUserCmd *ucmd, int iButtonsDown, int iButtonsReleased ); // NEO TODO (Adam) change to int64 when building this virtual void SetupMove( CBasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper, CMoveData *move ); virtual void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ); virtual void DampenEyePosition( Vector &vecVehicleEyePos, QAngle &vecVehicleEyeAngles ); @@ -1324,7 +1324,7 @@ void CPropJeep::SetupMove( CBasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHe //----------------------------------------------------------------------------- void CPropJeep::DriveVehicle( float flFrameTime, CUserCmd *ucmd, int iButtonsDown, int iButtonsReleased ) { - int iButtons = ucmd->buttons; + int iButtons = ucmd->buttons; // NEO TODO (Adam) change to int64 when building this //Adrian: No headlights on Superfly. /* if ( ucmd->impulse == 100 ) diff --git a/src/game/server/triggers.cpp b/src/game/server/triggers.cpp index 1014cfa268..3700baeb87 100644 --- a/src/game/server/triggers.cpp +++ b/src/game/server/triggers.cpp @@ -2906,7 +2906,11 @@ class CTriggerCamera : public CBaseEntity const static float kflPosInterpTime; // seconds #endif +#ifdef NEO + int64 m_nPlayerButtons; +#else int m_nPlayerButtons; +#endif // NEO int m_nOldTakeDamage; private: @@ -3376,7 +3380,11 @@ void CTriggerCamera::Move() if ( pPlayer ) { +#ifdef NEO + const int64 buttonsChanged = m_nPlayerButtons ^ pPlayer->m_nButtons; +#else int buttonsChanged = m_nPlayerButtons ^ pPlayer->m_nButtons; +#endif // NEO if ( buttonsChanged && pPlayer->m_nButtons ) { diff --git a/src/game/server/vehicle_base.cpp b/src/game/server/vehicle_base.cpp index dcd6ba74d3..3cf0acec63 100644 --- a/src/game/server/vehicle_base.cpp +++ b/src/game/server/vehicle_base.cpp @@ -671,9 +671,17 @@ void CPropVehicleDriveable::DriveVehicle( CBasePlayer *pPlayer, CUserCmd *ucmd ) //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- +#ifdef NEO +void CPropVehicleDriveable::DriveVehicle( float flFrameTime, CUserCmd *ucmd, int64 iButtonsDown, int64 iButtonsReleased ) +#else void CPropVehicleDriveable::DriveVehicle( float flFrameTime, CUserCmd *ucmd, int iButtonsDown, int iButtonsReleased ) +#endif // NEO { +#ifdef NEO + int64 iButtons = ucmd->buttons; +#else int iButtons = ucmd->buttons; +#endif // NEO m_VehiclePhysics.UpdateDriverControls( ucmd, flFrameTime ); diff --git a/src/game/server/vehicle_base.h b/src/game/server/vehicle_base.h index ab63005a7a..58181f26e7 100644 --- a/src/game/server/vehicle_base.h +++ b/src/game/server/vehicle_base.h @@ -198,7 +198,11 @@ class CPropVehicleDriveable : public CPropVehicle, public IDrivableVehicle, publ // Driving void DriveVehicle( CBasePlayer *pPlayer, CUserCmd *ucmd ); // Player driving entrypoint +#ifdef NEO + virtual void DriveVehicle( float flFrameTime, CUserCmd *ucmd, int64 iButtonsDown, int64 iButtonsReleased ); // Driving Button handling +#else virtual void DriveVehicle( float flFrameTime, CUserCmd *ucmd, int iButtonsDown, int iButtonsReleased ); // Driving Button handling +#endif // NEO virtual bool IsOverturned( void ); virtual bool IsVehicleBodyInWater( void ) { return false; } diff --git a/src/game/shared/baseplayer_shared.cpp b/src/game/shared/baseplayer_shared.cpp index 23e4d887bb..4e702e743f 100644 --- a/src/game/shared/baseplayer_shared.cpp +++ b/src/game/shared/baseplayer_shared.cpp @@ -809,14 +809,22 @@ void CBasePlayer::PlayStepSound( Vector &vecOrigin, surfacedata_t *psurface, flo OnEmitFootstepSound( params, vecOrigin, fvol ); } +#ifdef NEO +void CBasePlayer::UpdateButtonState( int64 nUserCmdButtonMask ) +#else void CBasePlayer::UpdateButtonState( int nUserCmdButtonMask ) +#endif // NEO { // Track button info so we can detect 'pressed' and 'released' buttons next frame m_afButtonLast = m_nButtons; // Get button states m_nButtons = nUserCmdButtonMask; +#ifdef NEO + const int64 buttonsChanged = m_afButtonLast ^ m_nButtons; +#else int buttonsChanged = m_afButtonLast ^ m_nButtons; +#endif // NEO // Debounced button codes for pressed/released // UNDONE: Do we need auto-repeat? @@ -1413,7 +1421,11 @@ void CBasePlayer::PlayerUse ( void ) else { // Start controlling the train! CBaseEntity *pTrain = GetGroundEntity(); +#ifdef NEO + if ( pTrain && !(m_nButtons & (IN_JUMP | IN_JUMP2)) && (GetFlags() & FL_ONGROUND) && (pTrain->ObjectCaps() & FCAP_DIRECTIONAL_USE) && pTrain->OnControls(this) ) +#else if ( pTrain && !(m_nButtons & IN_JUMP) && (GetFlags() & FL_ONGROUND) && (pTrain->ObjectCaps() & FCAP_DIRECTIONAL_USE) && pTrain->OnControls(this) ) +#endif // NEO { m_afPhysicsFlags |= PFLAG_DIROVERRIDE; m_iTrain = TrainSpeed(pTrain->m_flSpeed, ((CFuncTrackTrain*)pTrain)->GetMaxSpeed()); diff --git a/src/game/shared/gamemovement.cpp b/src/game/shared/gamemovement.cpp index 3767d2859b..f432c6ce3a 100644 --- a/src/game/shared/gamemovement.cpp +++ b/src/game/shared/gamemovement.cpp @@ -1378,7 +1378,12 @@ void CGameMovement::CheckWaterJump( void ) if ( ( tr.fraction < 1.0f ) && ( tr.plane.normal.z >= 0.7 ) ) { mv->m_vecVelocity[2] = 256.0f; // Push up +#ifdef NEO + const int64 jumpButtonsPressed = mv->m_nButtons & (IN_JUMP | IN_JUMP2); + mv->m_nOldButtons |= jumpButtonsPressed; // Don't jump again until released +#else mv->m_nOldButtons |= IN_JUMP; // Don't jump again until released +#endif // NEO player->AddFlag( FL_WATERJUMP ); player->m_flWaterJumpTime = 2000.0f; // Do this for 2 seconds } @@ -1435,7 +1440,11 @@ void CGameMovement::WaterMove( void ) } // if we have the jump key down, move us up as well +#ifdef NEO + if (mv->m_nButtons & (IN_JUMP | IN_JUMP2)) +#else if (mv->m_nButtons & IN_JUMP) +#endif // NEO { wishvel[2] += mv->m_flClientMaxSpeed; } @@ -2169,13 +2178,21 @@ void CGameMovement::FullWalkMove( ) } // Was jump button pressed? +#ifdef NEO + if (mv->m_nButtons & (IN_JUMP | IN_JUMP2)) +#else if (mv->m_nButtons & IN_JUMP) +#endif // NEO { CheckJumpButton(); } else { +#ifdef NEO + mv->m_nOldButtons &= ~(IN_JUMP | IN_JUMP2); +#else mv->m_nOldButtons &= ~IN_JUMP; +#endif // NEO } // Perform regular water movement @@ -2194,13 +2211,21 @@ void CGameMovement::FullWalkMove( ) // Not fully underwater { // Was jump button pressed? +#ifdef NEO + if (mv->m_nButtons & (IN_JUMP | IN_JUMP2)) +#else if (mv->m_nButtons & IN_JUMP) +#endif // NEO { CheckJumpButton(); } else { +#ifdef NEO + mv->m_nOldButtons &= ~(IN_JUMP | IN_JUMP2); +#else mv->m_nOldButtons &= ~IN_JUMP; +#endif // NEO } // Fricion is handled before we add in any base velocity. That way, if we are on a conveyor, @@ -2510,9 +2535,16 @@ void CGameMovement::PlaySwimSound() //----------------------------------------------------------------------------- bool CGameMovement::CheckJumpButton( void ) { +#ifdef NEO + const int64 jumpButtonsPressed = mv->m_nButtons & (IN_JUMP | IN_JUMP2); +#endif // NEO if (player->pl.deadflag) { +#ifdef NEO + mv->m_nOldButtons |= jumpButtonsPressed; // don't jump again until released +#else mv->m_nOldButtons |= IN_JUMP ; // don't jump again until released +#endif // NEO return false; } @@ -2554,15 +2586,20 @@ bool CGameMovement::CheckJumpButton( void ) #ifdef NEO if (sv_jumpbuffer.GetBool()) { - if (!(mv->m_nOldButtons & IN_JUMP)) + // both jump keys have to be released at the same time at some point before the next auto jump + if (!(mv->m_nOldButtons & (IN_JUMP | IN_JUMP2))) { - mv->m_nButtons &= ~IN_JUMP; + mv->m_nButtons &= ~(IN_JUMP | IN_JUMP2); } } else #endif { +#ifdef NEO + mv->m_nOldButtons |= jumpButtonsPressed; +#else mv->m_nOldButtons |= IN_JUMP; +#endif // NEO } return false; // in air, so no effect } @@ -2573,7 +2610,11 @@ bool CGameMovement::CheckJumpButton( void ) return false; #endif +#ifdef NEO + if (mv->m_nOldButtons & (IN_JUMP | IN_JUMP2)) +#else if ( mv->m_nOldButtons & IN_JUMP ) +#endif // NEO return false; // don't pogo stick // Cannot jump will in the unduck transition. @@ -2736,7 +2777,11 @@ bool CGameMovement::CheckJumpButton( void ) #endif // Flag that we jumped. +#ifdef NEO + mv->m_nOldButtons |= jumpButtonsPressed; // don't jump again until released +#else mv->m_nOldButtons |= IN_JUMP; // don't jump again until released +#endif // NEO return true; } @@ -2749,13 +2794,21 @@ void CGameMovement::FullLadderMove() CheckWater(); // Was jump button pressed? If so, set velocity to 270 away from ladder. +#ifdef NEO + if ( mv->m_nButtons & (IN_JUMP | IN_JUMP2) ) +#else if ( mv->m_nButtons & IN_JUMP ) +#endif // NEO { CheckJumpButton(); } else { +#ifdef NEO + mv->m_nOldButtons &= ~(IN_JUMP | IN_JUMP2); +#else mv->m_nOldButtons &= ~IN_JUMP; +#endif // NEO } // Perform the move accounting for any base velocity. @@ -3149,9 +3202,12 @@ bool CGameMovement::LadderMove( void ) forwardSpeed = mv->m_flUpMove > 0 ? climbSpeed : -climbSpeed; rightSpeed = 0; } -#endif // NEO + + if ( mv->m_nButtons & (IN_JUMP | IN_JUMP2) ) +#else if ( mv->m_nButtons & IN_JUMP ) +#endif // NEO { player->SetMoveType( MOVETYPE_WALK ); player->SetMoveCollide( MOVECOLLIDE_DEFAULT ); @@ -4690,9 +4746,15 @@ bool CGameMovement::CanUnDuckJump( trace_t &trace ) //----------------------------------------------------------------------------- void CGameMovement::Duck( void ) { +#ifdef NEO + const int64 buttonsChanged = ( mv->m_nOldButtons ^ mv->m_nButtons ); // These buttons have changed this frame + const int64 buttonsPressed = buttonsChanged & mv->m_nButtons; // The changed ones still down are "pressed" + const int64 buttonsReleased = buttonsChanged & mv->m_nOldButtons; // The changed ones which were previously down are "released" +#else int buttonsChanged = ( mv->m_nOldButtons ^ mv->m_nButtons ); // These buttons have changed this frame int buttonsPressed = buttonsChanged & mv->m_nButtons; // The changed ones still down are "pressed" int buttonsReleased = buttonsChanged & mv->m_nOldButtons; // The changed ones which were previously down are "released" +#endif // NEO // Check to see if we are in the air. bool bInAir = ( player->GetGroundEntity() == NULL ); diff --git a/src/game/shared/hl2/hl_gamemovement.cpp b/src/game/shared/hl2/hl_gamemovement.cpp index bd4a316ce9..288ccc3358 100644 --- a/src/game/shared/hl2/hl_gamemovement.cpp +++ b/src/game/shared/hl2/hl_gamemovement.cpp @@ -597,14 +597,23 @@ void CHL2GameMovement::FullLadderMove() CheckWater(); // Was jump button pressed? If so, don't do anything here +#ifdef NEO + if ( mv->m_nButtons & (IN_JUMP | IN_JUMP2) ) +#else if ( mv->m_nButtons & IN_JUMP ) +#endif // NEO { CheckJumpButton(); return; } else { +#ifdef NEO + const int64 jumpButtonsPressed = mv->m_nButtons & (IN_JUMP | IN_JUMP2); + mv->m_nOldButtons &= ~jumpButtonsPressed; +#else mv->m_nOldButtons &= ~IN_JUMP; +#endif // NEO } player->SetGroundEntity( NULL ); @@ -629,8 +638,13 @@ void CHL2GameMovement::FullLadderMove() VectorSubtract (mv->m_vecVelocity, player->GetBaseVelocity(), mv->m_vecVelocity); // Pressed buttons are "changed(xor)" and'ed with the mask of currently held buttons +#ifdef NEO + const int64 buttonsChanged = ( mv->m_nOldButtons ^ mv->m_nButtons ); // These buttons have changed this frame + const int64 buttonsPressed = buttonsChanged & mv->m_nButtons; +#else int buttonsChanged = ( mv->m_nOldButtons ^ mv->m_nButtons ); // These buttons have changed this frame int buttonsPressed = buttonsChanged & mv->m_nButtons; +#endif // NEO bool pressed_use = ( buttonsPressed & IN_USE ) ? true : false; bool pressing_forward_or_side = mv->m_flForwardMove != 0.0f || mv->m_flSideMove != 0.0f; @@ -1001,8 +1015,13 @@ bool CHL2GameMovement::LadderMove( void ) } #endif +#ifdef NEO + const int64 buttonsChanged = ( mv->m_nOldButtons ^ mv->m_nButtons ); // These buttons have changed this frame + const int64 buttonsPressed = buttonsChanged & mv->m_nButtons; +#else int buttonsChanged = ( mv->m_nOldButtons ^ mv->m_nButtons ); // These buttons have changed this frame int buttonsPressed = buttonsChanged & mv->m_nButtons; +#endif // NEO bool pressed_use = ( buttonsPressed & IN_USE ) ? true : false; // If I'm already moving on a ladder, use the previous ladder direction @@ -1095,7 +1114,11 @@ bool CHL2GameMovement::LadderMove( void ) rightSpeed += speed; } +#ifdef NEO + if ( mv->m_nButtons & (IN_JUMP | IN_JUMP2) ) +#else if ( mv->m_nButtons & IN_JUMP ) +#endif // NEO { player->SetMoveType( MOVETYPE_WALK ); // Remove from ladder diff --git a/src/game/shared/hl2mp/weapon_physcannon.cpp b/src/game/shared/hl2mp/weapon_physcannon.cpp index 1a25921c87..e14dc01732 100644 --- a/src/game/shared/hl2mp/weapon_physcannon.cpp +++ b/src/game/shared/hl2mp/weapon_physcannon.cpp @@ -2323,7 +2323,11 @@ void CWeaponPhysCannon::ItemPostFrame() } // NOTE: Attack2 will be considered to be pressed until the first item is picked up. +#ifdef NEO + const int64 nAttack2Mask = pOwner->m_nButtons & (~m_nAttack2Debounce); +#else int nAttack2Mask = pOwner->m_nButtons & (~m_nAttack2Debounce); +#endif // NEO if ( nAttack2Mask & IN_ATTACK2 ) { SecondaryAttack(); diff --git a/src/game/shared/hl2mp/weapon_physcannon.h b/src/game/shared/hl2mp/weapon_physcannon.h index 9b45d9d156..662f593a09 100644 --- a/src/game/shared/hl2mp/weapon_physcannon.h +++ b/src/game/shared/hl2mp/weapon_physcannon.h @@ -426,7 +426,11 @@ class CWeaponPhysCannon : public CBaseHL2MPCombatWeapon int m_nChangeState; // For delayed state change of elements float m_flCheckSuppressTime; // Amount of time to suppress the checking for targets bool m_flLastDenySoundPlayed; // Debounce for deny sound +#ifdef NEO + int64 m_nAttack2Debounce; +#else int m_nAttack2Debounce; +#endif // NEO CNetworkVar( bool, m_bActive ); CNetworkVar( int, m_EffectState ); // Current state of the effects on the gun diff --git a/src/game/shared/igamemovement.h b/src/game/shared/igamemovement.h index e5c9d239a0..f71f965343 100644 --- a/src/game/shared/igamemovement.h +++ b/src/game/shared/igamemovement.h @@ -46,8 +46,13 @@ class CMoveData int m_nImpulseCommand; // Impulse command issued. QAngle m_vecViewAngles; // Command view angles (local space) QAngle m_vecAbsViewAngles; // Command view angles (world space) +#ifdef NEO + int64 m_nButtons; // Attack buttons. + int64 m_nOldButtons; // From host_client->oldbuttons; +#else int m_nButtons; // Attack buttons. int m_nOldButtons; // From host_client->oldbuttons; +#endif // NEO float m_flForwardMove; float m_flOldForwardMove; float m_flSideMove; diff --git a/src/game/shared/in_buttons.h b/src/game/shared/in_buttons.h index 1897d07993..b7d191dd59 100644 --- a/src/game/shared/in_buttons.h +++ b/src/game/shared/in_buttons.h @@ -44,7 +44,8 @@ #define IN_LEAN_LEFT (1 << 28) #define IN_LEAN_RIGHT (1 << 29) #define IN_THERMOPTIC (1 << 30) // Thermoptic cloaking -#define IN_VISION (1 << 31) // Vision modes +#define IN_VISION ((int64)1 << 31) // Vision modes +#define IN_JUMP2 ((int64)1 << 32) // Non-super jump #endif #endif // IN_BUTTONS_H diff --git a/src/game/shared/usercmd.cpp b/src/game/shared/usercmd.cpp index 84ffa24314..f1cafd1c49 100644 --- a/src/game/shared/usercmd.cpp +++ b/src/game/shared/usercmd.cpp @@ -109,7 +109,11 @@ void WriteUsercmd( bf_write *buf, const CUserCmd *to, const CUserCmd *from ) if ( to->buttons != from->buttons ) { buf->WriteOneBit( 1 ); +#ifdef NEO + buf->WriteLongLong( to->buttons ); +#else buf->WriteUBitLong( to->buttons, 32 ); +#endif // NEO } else { @@ -258,7 +262,11 @@ void ReadUsercmd( bf_read *buf, CUserCmd *move, CUserCmd *from ) // read buttons if ( buf->ReadOneBit() ) { +#ifdef NEO + move->buttons = buf->ReadLongLong(); +#else move->buttons = buf->ReadUBitLong( 32 ); +#endif // NEO } if ( buf->ReadOneBit() ) diff --git a/src/game/shared/usercmd.h b/src/game/shared/usercmd.h index 0005bde99f..c59c835b1e 100644 --- a/src/game/shared/usercmd.h +++ b/src/game/shared/usercmd.h @@ -149,7 +149,11 @@ class CUserCmd // upward velocity. float upmove; // Attack button states +#ifdef NEO + int64 buttons; +#else int buttons; +#endif // NEO // Impulse command issued. byte impulse; // Current weapon id diff --git a/src/tier1/bitbuf.cpp b/src/tier1/bitbuf.cpp index d501cbe1f0..3e1a7eaaf3 100644 --- a/src/tier1/bitbuf.cpp +++ b/src/tier1/bitbuf.cpp @@ -1066,7 +1066,7 @@ int32 bf_read::ReadSignedVarInt32() int64 bf_read::ReadSignedVarInt64() { - uint32 value = ReadVarInt64(); + uint32 value = ReadVarInt64(); // NEO TODO (Adam) https://github.com/ValveSoftware/source-sdk-2013/issues/322 return bitbuf::ZigZagDecode64( value ); }