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
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -423,15 +423,15 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
m_anchor.y = m_currentPos.y - maxY;
}

offset.x = TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * (m_currentPos.x - m_anchor.x);
offset.y = TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * (m_currentPos.y - m_anchor.y);
// TheSuperHackers @fix Mauller 16/06/2025 fix RMB scrolling to allow it to scale with the user adjusted scroll factor
Coord2D vec;
vec.x = offset.x;
vec.y = offset.y;
vec.x = (m_currentPos.x - m_anchor.x);
vec.y = (m_currentPos.y - m_anchor.y);
// TheSuperHackers @info calculate the length of the vector to obtain the movement speed before the vector is normalized
float vecLength = vec.length();
vec.normalize();
// Add in the window scroll amount as the minimum.
offset.x += TheGlobalData->m_horizontalScrollSpeedFactor * vec.x * sqr(TheGlobalData->m_keyboardScrollFactor);
offset.y += TheGlobalData->m_verticalScrollSpeedFactor * vec.y * sqr(TheGlobalData->m_keyboardScrollFactor);
offset.x = TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.x * TheGlobalData->m_keyboardScrollFactor;
offset.y = TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.y * TheGlobalData->m_keyboardScrollFactor;
}
break;
case SCROLL_KEY:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,15 +422,15 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
m_anchor.y = m_currentPos.y - maxY;
}

offset.x = TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * (m_currentPos.x - m_anchor.x);
offset.y = TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * (m_currentPos.y - m_anchor.y);
// TheSuperHackers @fix Mauller 16/06/2025 fix RMB scrolling to allow it to scale with the user adjusted scroll factor
Coord2D vec;
vec.x = offset.x;
vec.y = offset.y;
vec.x = (m_currentPos.x - m_anchor.x);
vec.y = (m_currentPos.y - m_anchor.y);
// TheSuperHackers @info calculate the length of the vector to obtain the movement speed before the vector is normalized
float vecLength = vec.length();
vec.normalize();
// Add in the window scroll amount as the minimum.
offset.x += TheGlobalData->m_horizontalScrollSpeedFactor * vec.x * sqr(TheGlobalData->m_keyboardScrollFactor);
offset.y += TheGlobalData->m_verticalScrollSpeedFactor * vec.y * sqr(TheGlobalData->m_keyboardScrollFactor);
offset.x = TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.x * TheGlobalData->m_keyboardScrollFactor;
offset.y = TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.y * TheGlobalData->m_keyboardScrollFactor;
}
break;
case SCROLL_KEY:
Expand Down
Loading