Skip to content
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

Fix w3dview camera movement #1142

Merged
merged 2 commits into from
Aug 14, 2024

Conversation

xezon
Copy link
Contributor

@xezon xezon commented Aug 13, 2024

Left and right camera movement was previously inverted. This fixes it.

@@ -236,7 +236,7 @@ void CGraphicView::OnMouseMove(UINT nFlags, CPoint point)

v.X = (((float)point.x - (float)(r.right >> 1)) / (float)(r.right >> 1)
- ((float)m_mousePos.x - (float)(r.right >> 1)) / (float)(r.right >> 1))
* m_radius * -1.0f;
* m_radius;
Copy link
Contributor

Choose a reason for hiding this comment

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

The * -1.0f does exist in the original binary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can absolutely confirm that this * -1.0f causes inverted movement (camera moves left when moving right).

Copy link
Contributor

Choose a reason for hiding this comment

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

I tested the latest w3dview from the Thyme trunk alongside the original Westwood w3dview and when I hold down both mouse buttons and move left and right it behaves the same. But if I use the w3dview from this PR, it behaves differently.
That means the left and right movement currently in Thyme is correct to the original as far as I can tell.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. So the intent was to have inverted movement on both axis. Ok then I will test your proposal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tested and worked. Both axis are inverted now.

@@ -236,7 +236,7 @@ void CGraphicView::OnMouseMove(UINT nFlags, CPoint point)

v.X = (((float)point.x - (float)(r.right >> 1)) / (float)(r.right >> 1)
- ((float)m_mousePos.x - (float)(r.right >> 1)) / (float)(r.right >> 1))
* m_radius * -1.0f;
* m_radius;

v.Y = (((float)point.y - (float)(r.bottom >> 1)) / (float)(r.bottom >> 1)
- ((float)m_mousePos.y - (float)(r.bottom >> 1)) / (float)(r.bottom >> 1))
Copy link
Contributor

Choose a reason for hiding this comment

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

On this line, the expressions are ((float)(r.bottom >> 1) - (float)point.y) and ((float)(r.bottom >> 1) - (float)m_mousePos.y)

Copy link
Contributor

Choose a reason for hiding this comment

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

Up and down camera movement is incorrect in Thyme w3dview compared to stock w3dview, the above-mentioned change should fix that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@xezon xezon force-pushed the fix-w3dview-camera-movement branch from 35b5f68 to 3185148 Compare August 14, 2024 14:50
Copy link
Contributor

@jonwil jonwil left a comment

Choose a reason for hiding this comment

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

Looks good to me, approved.

@xezon xezon merged commit d135a52 into TheAssemblyArmada:develop Aug 14, 2024
7 checks passed
@xezon xezon deleted the fix-w3dview-camera-movement branch August 14, 2024 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants