Skip to content
Open
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
18 changes: 16 additions & 2 deletions Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2230,10 +2230,25 @@ void W3DView::setPitchToDefault()
//-------------------------------------------------------------------------------------------------
void W3DView::setDefaultView(Real pitch, Real angle, Real maxHeight)
{
// 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();
Real aspectRatioScale = 0.0f;

if (currentAspectRatio > baseAspectRatio)
{
aspectRatioScale = fabs((1 + (currentAspectRatio - baseAspectRatio)));
}
else
{
aspectRatioScale = fabs((1 - (baseAspectRatio - currentAspectRatio)));
}
Comment thread
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);
m_maxHeightAboveGround = TheGlobalData->m_maxCameraHeight*maxHeight;
m_maxHeightAboveGround = TheGlobalData->m_maxCameraHeight * aspectRatioScale * maxHeight;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I expect this implementation is not correct. m_maxCameraHeight is also used in getCameraOffsetZ.

m_minHeightAboveGround = TheGlobalData->m_minCameraHeight * aspectRatioScale;
if (m_minHeightAboveGround > m_maxHeightAboveGround)
m_maxHeightAboveGround = m_minHeightAboveGround;
}
Expand Down Expand Up @@ -2275,7 +2290,6 @@ void W3DView::setZoomToDefault()
m_heightAboveGround = m_maxHeightAboveGround;
m_zoom = getMaxZoom(m_pos.x, m_pos.y);

stopDoingScriptedCamera();
m_CameraArrivedAtWaypointOnPathFlag = false;
m_cameraAreaConstraintsValid = false;
m_recalcCamera = true;
Expand Down
3 changes: 3 additions & 0 deletions GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,11 @@ class GlobalData : public SubsystemInterface
#if PRESERVE_RETAIL_SCRIPTED_CAMERA
Real m_cameraHeight;
#endif

// TheSuperHackers @info Max and Min camera height for the original 4:3 view, these are then scaled for other aspect ratios.
Real m_maxCameraHeight;
Real m_minCameraHeight;
Comment thread
Mauller marked this conversation as resolved.

Real m_terrainHeightAtEdgeOfMap;
Real m_unitDamagedThresh;
Real m_unitReallyDamagedThresh;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,13 @@ static void saveOptions()

TheInGameUI->recreateControlBar();
TheInGameUI->refreshCustomUiResources();

// TheSuperHackers @info Update the view so the shellmap looks correct when changing resolution
TheTacticalView->setDefaultView(
DEG_TO_RADF(TheGlobalData->m_cameraPitch),
DEG_TO_RADF(TheGlobalData->m_cameraYaw),
1.0f);
TheTacticalView->setZoomToDefault();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2085,6 +2085,10 @@ void GameLogic::tryStartNewGame( Bool loadingSaveGame )
// update the loadscreen
updateLoadProgress(LOAD_PROGRESS_POST_PRELOAD_ASSETS);

TheTacticalView->setDefaultView(
DEG_TO_RADF(TheGlobalData->m_cameraPitch),
DEG_TO_RADF(TheGlobalData->m_cameraYaw),
1.0f);
TheTacticalView->setAngleToDefault();
TheTacticalView->setPitchToDefault();
TheTacticalView->setZoomToDefault();
Expand Down
Loading