@@ -193,6 +193,11 @@ void W3DView::setHeight(Int height)
193193 m_3DCamera->Get_Viewport (vMin,vMax);
194194 vMax.Y =(Real)(m_originY+height)/(Real)TheDisplay->getHeight ();
195195 m_3DCamera->Set_Viewport (vMin,vMax);
196+
197+ // TheSuperHackers @bugfix Now recalculates the camera constraints because
198+ // showing or hiding the control bar will change the viewable area.
199+ m_cameraAreaConstraintsValid = false ;
200+ m_recalcCamera = true ;
196201}
197202
198203// -------------------------------------------------------------------------------------------------
@@ -212,6 +217,9 @@ void W3DView::setWidth(Int width)
212217 // we want to maintain the same scale, so we'll need to adjust the fov.
213218 // default W3D fov for full-screen is 50 degrees.
214219 m_3DCamera->Set_View_Plane ((Real)width/(Real)TheDisplay->getWidth ()*DEG_TO_RADF (50 .0f ),-1 );
220+
221+ m_cameraAreaConstraintsValid = false ;
222+ m_recalcCamera = true ;
215223}
216224
217225// -------------------------------------------------------------------------------------------------
@@ -1805,6 +1813,7 @@ void W3DView::scrollBy( Coord2D *delta )
18051813// -------------------------------------------------------------------------------------------------
18061814void W3DView::forceRedraw ()
18071815{
1816+ m_cameraAreaConstraintsValid = false ;
18081817 m_recalcCamera = true ;
18091818}
18101819
@@ -1837,6 +1846,9 @@ void W3DView::setPitch( Real radians )
18371846 m_doingPitchCamera = false ;
18381847 m_doingZoomCamera = false ;
18391848 m_doingScriptedCameraLock = false ;
1849+ // TheSuperHackers @fix Now recalculates the camera constraints because
1850+ // the camera pitch can change the camera distance towards the map border.
1851+ m_cameraAreaConstraintsValid = false ;
18401852 m_recalcCamera = true ;
18411853}
18421854
@@ -1859,6 +1871,9 @@ void W3DView::setPitchToDefault( void )
18591871
18601872 m_FXPitch = 1 .0f ;
18611873
1874+ // TheSuperHackers @fix Now recalculates the camera constraints because
1875+ // the camera pitch can change the camera distance towards the map border.
1876+ m_cameraAreaConstraintsValid = false ;
18621877 m_recalcCamera = true ;
18631878}
18641879
@@ -1948,6 +1963,7 @@ void W3DView::setFieldOfView( Real angle )
19481963#if defined(RTS_DEBUG)
19491964 // this is only for testing, and recalculating the
19501965 // camera every frame is wasteful
1966+ m_cameraAreaConstraintsValid = false ;
19511967 m_recalcCamera = true ;
19521968#endif
19531969}
0 commit comments