Skip to content

Jump 2 - #2039

Open
AdamTadeusz wants to merge 6 commits into
NeotokyoRebuild:masterfrom
AdamTadeusz:369_jump2
Open

Jump 2#2039
AdamTadeusz wants to merge 6 commits into
NeotokyoRebuild:masterfrom
AdamTadeusz:369_jump2

Conversation

@AdamTadeusz

Copy link
Copy Markdown
Contributor

Description

+jump2 command that does a normal jump without doing a superjump. Personally I bind mwheelup to +jump2 and mwheeldown to +jump

Decided to extend m_nButtons to 64 bits so the PR is a bit involved

Toolchain

  • Windows MSVC VS2022

Linked Issues

  • fixes #

@AdamTadeusz
AdamTadeusz marked this pull request as draft July 30, 2026 22:32
@AdamTadeusz

AdamTadeusz commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

There are a lot of places where IN_JUMP is used like CommentarySystem, fourwheelvehiclephysics etc. I'm not going to touch those that we don't use right now

(Edit) only if its not built?

@AdamTadeusz
AdamTadeusz marked this pull request as ready for review July 31, 2026 13:20
@AdamTadeusz
AdamTadeusz requested a review from a team July 31, 2026 13:20
@Rainyan
Rainyan self-requested a review August 8, 2026 15:36
Rainyan
Rainyan previously approved these changes Aug 8, 2026

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: maybe instead of commenting this, add a NEO-ifdef guarded Assert(false) in the impl, so whoever touches this in the future cannot miss the comment without hitting an assert?

Comment thread src/game/server/hl2/vehicle_cannon.cpp Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: would maybe prefer a hard Assert(false) in the implementation so we don't rely on the comment being seen but rather fail loudly

Comment thread src/game/server/hl2/vehicle_jeep.cpp Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe ifdef NEO Assert(false) here so this cannot work without the coder noticing & fixing this in the future


// 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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assert(false) so whoever hits this has to deal with it?

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto on maybe doing Assert(false) or similar here to force a fix for whoever tries to use it

Comment thread src/tier1/bitbuf.cpp Outdated
int64 bf_read::ReadSignedVarInt64()
{
uint32 value = ReadVarInt64();
uint32 value = ReadVarInt64(); // NEO TODO (Adam) https://github.com/ValveSoftware/source-sdk-2013/issues/322

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to fix this retval type 32->64 here as part of this PR, while we're at it modifying this stuff anyway?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a little test, writing the button state twice, once using writelonglong and once using writesignedvarint64

	if ( to->buttons != from->buttons )
	{
		buf->WriteOneBit( 1 );
#ifdef NEO
	  	buf->WriteLongLong( to->buttons );
	  	buf->WriteSignedVarInt64( to->buttons );
#else
	  	buf->WriteUBitLong( to->buttons, 32 );
#endif // NEO
 	}
	// read buttons
	if ( buf->ReadOneBit() )
	{
#ifdef NEO
		move->buttons = buf->ReadLongLong();
		int64 buttons2 = buf->ReadSignedVarInt64();
		Assert(move->buttons == buttons2);
#else
		move->buttons = buf->ReadUBitLong( 32 );
#endif // NEO
	}

using jump2 triggers the Assert before the fix and doesn't trigger the Assert after the fix

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

of course this isn't an exhaustive test, ReadSignedVarInt64 exists separate to writeLongLong for a reason, probably handles a sign bit, but i'm also confident the fix is fine

@AdamTadeusz AdamTadeusz Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll mention the issue in a github comment for posterity ValveSoftware/source-sdk-2013#322

@Rainyan
Rainyan requested a review from a team August 8, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants