Skip to content
Open

Jump 2 #2039

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
4 changes: 2 additions & 2 deletions src/game/client/c_baseplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<C_NEO_Player*>(this)->GetNeoFlags() & NEO_FL_FREEZETIME)
{
Expand All @@ -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<CWeaponTachi*>(GetActiveWeapon()) != NULL);
if (!isTachi)
{
Expand Down
12 changes: 12 additions & 0 deletions src/game/client/c_baseplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;

Expand Down
4 changes: 4 additions & 0 deletions src/game/client/c_playerlocaldata.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions src/game/client/c_vguiscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
4 changes: 4 additions & 0 deletions src/game/client/c_vguiscreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/game/client/hud.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions src/game/client/iinput.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
28 changes: 28 additions & 0 deletions src/game/client/in_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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

/*
Expand Down Expand Up @@ -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] ); }

Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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

/*
Expand Down
8 changes: 8 additions & 0 deletions src/game/client/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
Expand Down
6 changes: 3 additions & 3 deletions src/game/client/neo/c_neo_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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 );

Expand Down Expand Up @@ -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;
}
Expand Down
17 changes: 17 additions & 0 deletions src/game/server/CommentarySystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) )
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
17 changes: 16 additions & 1 deletion src/game/server/NextBot/Player/NextBotPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 ) );

Expand Down Expand Up @@ -826,8 +835,10 @@ inline void NextBotPlayer< PlayerType >::PhysicsSimulate( void )
}
}
}
#endif // NEO
int64 inputButtons;
#else
int inputButtons;
#endif // NEO
//
// Update bot behavior
//
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/game/server/episodic/vehicle_jeep_episodic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 8 additions & 0 deletions src/game/server/fourwheelvehiclephysics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;

Expand Down
Loading