-
Notifications
You must be signed in to change notification settings - Fork 250
fix(view): Adjust default camera height to compensate for screen aspect ratio #1711
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -674,7 +674,7 @@ Real W3DView::getCameraOffsetZ() const | |
| } | ||
| #endif | ||
|
|
||
| return m_pos.z + TheGlobalData->m_maxCameraHeight; | ||
| return m_pos.z + m_maxHeightAboveGround; | ||
| } | ||
|
|
||
| //------------------------------------------------------------------------------------------------- | ||
|
|
@@ -2233,10 +2233,24 @@ void W3DView::setPitchToDefault() | |
| //------------------------------------------------------------------------------------------------- | ||
| void W3DView::setDefaultView(Real pitch, Real angle, Real maxHeight) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest we clamp |
||
| { | ||
| // TheSuperHackers @fix Mauller 08/05/2026 Adjust the maximum camera height to compensate for screen aspect ratio | ||
| Real baseAspectRatio = (Real)DEFAULT_DISPLAY_WIDTH / (Real)DEFAULT_DISPLAY_HEIGHT; | ||
| Real currentAspectRatio = (Real)TheTacticalView->getWidth() / (Real)TheTacticalView->getHeight(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like us to implement a define to clamp the max aspect ratio scaling here and set that to 1.7777 for 16:9 in GameDefines.h That is also what GenTool did. It is then up to the Game Design Committee to decide what the actual limit should be for multiplayer. |
||
| Real aspectRatioScale = 1.0f; | ||
|
|
||
| if (currentAspectRatio > baseAspectRatio) | ||
| { | ||
| aspectRatioScale = fabs((1.0f + (currentAspectRatio - baseAspectRatio))); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fabsf |
||
| const float nerf = 1.0f - (currentAspectRatio - baseAspectRatio) / 12.0f; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can add comment here that this nerf replicates what GenTool originally did as well. The purpose was to artificially nerf the widescreen bonus a bit. |
||
|
|
||
| aspectRatioScale *= nerf; | ||
| } | ||
|
greptile-apps[bot] marked this conversation as resolved.
|
||
|
|
||
| // MDC - we no longer want to rotate maps (design made all of them right to begin with) | ||
| // m_defaultAngle = angle * M_PI/180.0f; | ||
| setDefaultPitch(pitch); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest keep this line at the top of the function to have the things separated. |
||
| m_maxHeightAboveGround = TheGlobalData->m_maxCameraHeight*maxHeight; | ||
| m_maxHeightAboveGround = TheGlobalData->m_maxCameraHeight * aspectRatioScale * maxHeight; | ||
|
xezon marked this conversation as resolved.
|
||
| m_minHeightAboveGround = TheGlobalData->m_minCameraHeight * aspectRatioScale; | ||
| if (m_minHeightAboveGround > m_maxHeightAboveGround) | ||
| m_maxHeightAboveGround = m_minHeightAboveGround; | ||
| } | ||
|
|
@@ -2278,7 +2292,6 @@ void W3DView::setZoomToDefault() | |
| m_heightAboveGround = m_maxHeightAboveGround; | ||
| m_zoom = getMaxZoom(m_pos.x, m_pos.y); | ||
|
|
||
| stopDoingScriptedCamera(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I am not mistaken right now all calls to
|
||
| m_CameraArrivedAtWaypointOnPathFlag = false; | ||
| m_cameraAreaConstraintsValid = false; | ||
| m_recalcCamera = true; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For camera height in cinematics:
After #3003 is merged, there will be
ScriptEngine::isLetterBoxActiveto act on regular campaign cinematics. Is logic bound.Otherwise there also is
View::m_isUserControlledto check whether the user was the last one to control the camera. Is client bound.