Skip to content

Commit 6eac2f4

Browse files
committed
bugfix(view): Fix and improve map border camera constraint behavior to allow see all areas of the map comfortably
1 parent a7e0c29 commit 6eac2f4

File tree

5 files changed

+196
-80
lines changed

5 files changed

+196
-80
lines changed

GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4342,9 +4342,8 @@ Bool InGameUI::areSelectedObjectsControllable() const
43424342
//------------------------------------------------------------------------------
43434343
void InGameUI::resetCamera()
43444344
{
4345-
ViewLocation currentView;
4346-
TheTacticalView->getLocation( &currentView );
4347-
TheTacticalView->resetCamera( &currentView.getPosition(), 1, 0.0f, 0.0f );
4345+
TheTacticalView->setAngleAndPitchToDefault();
4346+
TheTacticalView->setZoomToDefault();
43484347
}
43494348

43504349
//------------------------------------------------------------------------------

GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ void View::init( void )
101101
m_zoom = 1.0f;
102102
m_maxHeightAboveGround = TheGlobalData->m_maxCameraHeight;
103103
m_minHeightAboveGround = TheGlobalData->m_minCameraHeight;
104-
m_okToAdjustHeight = FALSE;
105104

106105
m_defaultAngle = 0.0f;
107106
m_defaultPitchAngle = 0.0f;

GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ class W3DView : public View, public SubsystemInterface
226226
virtual void set3DWireFrameMode(Bool enable); ///<enables custom wireframe rendering of 3D viewport
227227

228228
Bool updateCameraMovements(void);
229-
virtual void forceCameraAreaConstraintRecalc(void) { calcCameraAreaConstraints(); }
229+
virtual void forceCameraAreaConstraintRecalc(void) { m_cameraAreaConstraintsValid = false; }
230230

231231
virtual void setGuardBandBias( const Coord2D *gb ) { m_guardBandBias.x = gb->x; m_guardBandBias.y = gb->y; }
232232

@@ -278,10 +278,17 @@ class W3DView : public View, public SubsystemInterface
278278

279279
Region2D m_cameraAreaConstraints; ///< Camera should be constrained to be within this area
280280
Bool m_cameraAreaConstraintsValid; ///< If false, recalculates the camera area constraints in the next render update
281+
Bool m_clipIntoCameraConstraintsNow; ///< If true, clips the camera into the camera area constraints in the next render update
282+
Bool m_recalcCameraConstraintsAfterScrolling; ///< Recalculates the camera area constraints after the user has moved the camera
283+
Bool m_recalcCamera; ///< Recalculates the camera transform in the next render update
281284

282285
void setCameraTransform( void ); ///< set the transform matrix of m_3DCamera, based on m_pos & m_angle
283286
void buildCameraTransform( Matrix3D *transform ); ///< calculate (but do not set) the transform matrix of m_3DCamera, based on m_pos & m_angle
287+
void updateCameraAreaConstraints();
284288
void calcCameraAreaConstraints(); ///< Recalculates the camera area constraints
289+
void moveCameraIntoAreaConstraints();
290+
void clipCameraIntoAreaConstraints();
291+
Bool isWithinCameraAreaConstraints() const;
285292
Bool isWithinCameraHeightConstraints() const;
286293
void moveAlongWaypointPath(Real milliseconds); ///< Move camera along path.
287294
void getPickRay(const ICoord2D *screen, Vector3 *rayStart, Vector3 *rayEnd); ///<returns a line segment (ray) originating at the given screen position

0 commit comments

Comments
 (0)