-
-
Notifications
You must be signed in to change notification settings - Fork 23
fix(view): integrate PR1711 camera defaults and backport to Generals #47
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
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 | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1895,6 +1895,31 @@ void W3DView::setPitchToDefault() | |||||||||||||||||
| m_recalcCamera = true; | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| //------------------------------------------------------------------------------------------------- | ||||||||||||||||||
| //------------------------------------------------------------------------------------------------- | ||||||||||||||||||
| void W3DView::setCameraHeightAboveGroundLimitsToDefault(Real heightScale) | ||||||||||||||||||
| { | ||||||||||||||||||
| // TheSuperHackers @fix Mauller Adjust the camera height to compensate for the screen aspect ratio | ||||||||||||||||||
| Real baseAspectRatio = (Real)DEFAULT_DISPLAY_WIDTH / (Real)DEFAULT_DISPLAY_HEIGHT; | ||||||||||||||||||
| Real currentAspectRatio = (Real)TheTacticalView->getWidth() / (Real)TheTacticalView->getHeight(); | ||||||||||||||||||
|
||||||||||||||||||
| Real currentAspectRatio = (Real)TheTacticalView->getWidth() / (Real)TheTacticalView->getHeight(); | |
| // GeneralsX @bugfix copilot 24/03/2026 Use this view's dimensions and guard against zero height. | |
| Real currentAspectRatio; | |
| if (getHeight() > 0) { | |
| currentAspectRatio = (Real)getWidth() / (Real)getHeight(); | |
| } else { | |
| currentAspectRatio = baseAspectRatio; | |
| } |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -111,7 +111,7 @@ class ScriptActions : public ScriptActionsInterface | |||||||
|
|
||||||||
| void doCameraTetherNamed(const AsciiString& unit, Bool snapToUnit, Real play); | ||||||||
| void doCameraStopTetherNamed(); | ||||||||
| void doCameraSetDefault(Real pitch, Real angle, Real maxHeight); | ||||||||
| void doCameraSetDefault(Real pitch, Real angle, Real heighScale); | ||||||||
|
||||||||
| void doCameraSetDefault(Real pitch, Real angle, Real heighScale); | |
| // GeneralsX @bugfix assistant 24/03/2026 Fix typo in parameter name to use heightScale for consistency with W3DView API. | |
| void doCameraSetDefault(Real pitch, Real angle, Real heightScale); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4270,9 +4270,12 @@ void ScriptActions::doCameraStopTetherNamed() | |
| //------------------------------------------------------------------------------------------------- | ||
| /** doCameraSetDefault */ | ||
| //------------------------------------------------------------------------------------------------- | ||
| void ScriptActions::doCameraSetDefault(Real pitch, Real angle, Real maxHeight) | ||
| void ScriptActions::doCameraSetDefault(Real pitch, Real angle, Real heighScale) | ||
| { | ||
| TheTacticalView->setDefaultView(pitch, angle, maxHeight); | ||
| // GeneralsX @tweak Copilot 23/03/2026 Mirror ZH scripted camera defaults for aspect-ratio-aware limits. | ||
| TheTacticalView->setCameraHeightAboveGroundLimitsToDefault(heighScale); | ||
| TheTacticalView->setPitch(pitch); | ||
| TheTacticalView->setAngle(angle); | ||
|
Comment on lines
+4273
to
+4278
|
||
| } | ||
|
|
||
| //------------------------------------------------------------------------------------------------- | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -111,7 +111,7 @@ class ScriptActions : public ScriptActionsInterface | |||||||
|
|
||||||||
| void doCameraTetherNamed(const AsciiString& unit, Bool snapToUnit, Real play); | ||||||||
| void doCameraStopTetherNamed(); | ||||||||
| void doCameraSetDefault(Real pitch, Real angle, Real maxHeight); | ||||||||
| void doCameraSetDefault(Real pitch, Real angle, Real heighScale); | ||||||||
|
||||||||
| void doCameraSetDefault(Real pitch, Real angle, Real heighScale); | |
| // GeneralsX @bugfix Copilot 24/03/2026 Fix typo in camera default height scale parameter name for scripting API clarity | |
| void doCameraSetDefault(Real pitch, Real angle, Real heightScale); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4601,9 +4601,11 @@ void ScriptActions::doCameraStopTetherNamed() | |
| //------------------------------------------------------------------------------------------------- | ||
| /** doCameraSetDefault */ | ||
| //------------------------------------------------------------------------------------------------- | ||
| void ScriptActions::doCameraSetDefault(Real pitch, Real angle, Real maxHeight) | ||
| void ScriptActions::doCameraSetDefault(Real pitch, Real angle, Real heighScale) | ||
| { | ||
| TheTacticalView->setDefaultView(pitch, angle, maxHeight); | ||
| TheTacticalView->setCameraHeightAboveGroundLimitsToDefault(heighScale); | ||
| TheTacticalView->setPitch(pitch); | ||
| TheTacticalView->setAngle(angle); | ||
|
Comment on lines
+4604
to
+4608
|
||
| } | ||
|
|
||
| //------------------------------------------------------------------------------------------------- | ||
|
|
||
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.
View::setZoomToMax()currently addsm_maxHeightAboveGroundto the current height. Ifm_zoomLimitedis false (no clamping), this can overshoot the intended max. Setting the height directly tom_maxHeightAboveGroundwould better match the method name/intent and be consistent withW3DView::setZoomToMax()semantics.