Skip to content
Draft
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
19 changes: 16 additions & 3 deletions Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp

Copy link
Copy Markdown

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::isLetterBoxActive to act on regular campaign cinematics. Is logic bound.

Otherwise there also is View::m_isUserControlled to check whether the user was the last one to control the camera. Is client bound.

Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ Real W3DView::getCameraOffsetZ() const
}
#endif

return m_pos.z + TheGlobalData->m_maxCameraHeight;
return m_pos.z + m_maxHeightAboveGround;
}

//-------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -2233,10 +2233,24 @@ void W3DView::setPitchToDefault()
//-------------------------------------------------------------------------------------------------
void W3DView::setDefaultView(Real pitch, Real angle, Real 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.

maxHeight is ambiguous name. Maybe rename to maxHeightScale. It reaches from 0 to 1 (or higher)

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 suggest we clamp maxHeight at above 0. It should not become negative.

{
// 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();

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 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)));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

fabsf

const float nerf = 1.0f - (currentAspectRatio - baseAspectRatio) / 12.0f;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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;
}
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);

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 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;
Comment thread
xezon marked this conversation as resolved.
m_minHeightAboveGround = TheGlobalData->m_minCameraHeight * aspectRatioScale;
if (m_minHeightAboveGround > m_maxHeightAboveGround)
m_maxHeightAboveGround = m_minHeightAboveGround;
}
Expand Down Expand Up @@ -2278,7 +2292,6 @@ void W3DView::setZoomToDefault()
m_heightAboveGround = m_maxHeightAboveGround;
m_zoom = getMaxZoom(m_pos.x, m_pos.y);

stopDoingScriptedCamera();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If I am not mistaken right now all calls to stopDoingScriptedCamera in this file are as was originally. It would be nice if we can remove all these calls in this file except in W3DView::reset, but I am not sure if that is safe then. It depends on scripted calls I think. Maybe you can investigate this matter.

stopDoingScriptedCamera is already called extensively in View::doUserAction which we added and is verified to come through user input exclusively (good)!

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 @@ -190,8 +190,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 @@ -877,6 +877,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 @@ -2081,6 +2081,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