Skip to content

[GEN][ZH] Fix up the right mouse button scrolling to properly normalize its movement and correctly apply the Scroll Speed modifier #1244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2025

Conversation

Mauller
Copy link

@Mauller Mauller commented Jul 8, 2025

This PR fixes the right mouse button scrolling which was not originally affected by adjusting the scroll options in the options menu.

It cleans up the original implementation and implemented the functionality properly. The original code never did what it was meant to do when it comes to scaling the RMB scroll speed.

The main factor that affects the movement in the code is the factor that measures the mouse position away from the anchor point.
The extra added factor in the original code added an insignificant addition to the movement that was not perceivable.

In the fixed code we take the length of the mouse position from anchor to get the magnitude of the movement, then normalise the mouses position vector from the acnchor point. This allows us to properly normalise the movement from the anchor. we then multiply it by a rescaled scrolling factor which sets the 50% position to replicate what the scroll speed at 30FPS was before the change.

@Mauller Mauller self-assigned this Jul 8, 2025
@Mauller Mauller added Bug Something is not working right, typically is user facing Major Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour labels Jul 8, 2025
Copy link

@xezon xezon left a comment

Choose a reason for hiding this comment

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

Behaviour feels good.

I suggest we make a follow up change and raise the upper ceiling of the Scroll Speed in the Options Menu, because some players perhaps still want fstr speed (originally they would get very fast scroll speeds with high FPS). The lower scroll speed ceiling seems fine.

@Mauller Mauller force-pushed the fix-rmb-scrolling branch from ad8cd17 to 98adba7 Compare July 9, 2025 19:22
@Mauller
Copy link
Author

Mauller commented Jul 9, 2025

I altered the rescaling factor to 0.5f so it relates to the default value instead of what i assumed was the default. this should mean that most people will see the game act like 30FPS retail if they have not altered the scroll speed.

The scroll speed should have a min of 0.5 an a max of 1.95 multiplications with this now when using the scroll adjustment

With how i currently have the code setup, the RMB scrolling should be equivalent to 30FPS in retail when the scroll speed is left at default. But people can then adjust it up to nearly twice the speed etc.

@Mauller Mauller force-pushed the fix-rmb-scrolling branch from 98adba7 to 78d7582 Compare July 10, 2025 18:38
@Mauller
Copy link
Author

Mauller commented Jul 10, 2025

rebased with main after scrolling fix was merged.

@Mauller Mauller force-pushed the fix-rmb-scrolling branch from 9d9303d to fedd09f Compare July 16, 2025 18:58
@Mauller
Copy link
Author

Mauller commented Jul 16, 2025

Tweaked this with the new SCROLL_MULTIPLIER constant of 2.0f that is applied to RMB scrolling.

So when at a scroll setting of 50, the RMB scrolling should match retail without limiting the minimum range.
It also doubles the max range of RMB scrolling, the only downside is that there is less granularity to the scroll speed.

But in the future i still think we want to decouple mouse, keyboard and edge scrolling settings from one another.
That will most likely want to come around when we start making menu changes as well etc.

@xezon
Copy link

xezon commented Jul 16, 2025

How about in this change we only fix the wrong scroll speed math, but do not add the scaling? And then in the follow up change we do apply the scaling to all scrolling. This way we decouple responsibilities of changes and have a clean history of what we did to scrolling step-by-step.

In the title of this change it says "normalize the movement". What does this mean?

@Mauller
Copy link
Author

Mauller commented Jul 16, 2025

How about in this change we only fix the wrong scroll speed math, but do not add the scaling? And then in the follow up change we do apply the scaling to all scrolling. This way we decouple responsibilities of changes and have a clean history of what we did to scrolling step-by-step.

In the title of this change it says "normalize the movement". What does this mean?

I can do that, i will strip out the scaling factor and push the change.

Normalising the movement means that all directions of movement have the same effect.
So we don't end up in a situation where the diagonal movement is faster like with the locomotor etc.

@Mauller Mauller force-pushed the fix-rmb-scrolling branch from fedd09f to 3b5c8ad Compare July 16, 2025 20:00
@Mauller
Copy link
Author

Mauller commented Jul 16, 2025

This should just be the changes for fixing the RMB scrolling calculation and allowing it to be affected by the scroll options.

@xezon xezon changed the title [GEN][ZH] Fix right mouse button scrolling to normalize the movement and make it adjustable by scroll speed [GEN][ZH] Properly normalize the right mouse button scrolling and make it adjustable by the Scroll Speed setting Jul 16, 2025
Copy link

@xezon xezon left a comment

Choose a reason for hiding this comment

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

Very good.

@xezon xezon changed the title [GEN][ZH] Properly normalize the right mouse button scrolling and make it adjustable by the Scroll Speed setting [GEN][ZH] Properly normalize the movement of the right mouse button scrolling and make it adjustable by the Scroll Speed setting Jul 16, 2025
@xezon xezon changed the title [GEN][ZH] Properly normalize the movement of the right mouse button scrolling and make it adjustable by the Scroll Speed setting [GEN][ZH] Fix up the right mouse button scrolling to properly normalize its movement and correctly apply the Scroll Speed modifier Jul 16, 2025
@xezon
Copy link

xezon commented Jul 16, 2025

I struggled with the title but I think it is ok now

@xezon xezon merged commit c1903b6 into TheSuperHackers:main Jul 16, 2025
17 checks passed
@xezon xezon deleted the fix-rmb-scrolling branch July 16, 2025 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is not working right, typically is user facing Gen Relates to Generals Major Severity: Minor < Major < Critical < Blocker ZH Relates to Zero Hour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants