Fixes #572. Changed MoveCameraToTarget so that for minimap scrolling it will ignore changes in Y position, to maintain previous zoom level as expected (constraint keeps the new view from being inappropriate)
This was SVN commit r8676.
This commit is contained in:
parent
2963422173
commit
47246c8155
@ -826,7 +826,7 @@ void CGameView::Update(float DeltaTime)
|
||||
m->ViewCamera.UpdateFrustum();
|
||||
}
|
||||
|
||||
void CGameView::MoveCameraTarget(const CVector3D& target)
|
||||
void CGameView::MoveCameraTarget(const CVector3D& target, bool minimap)
|
||||
{
|
||||
// Maintain the same orientation and level of zoom, if we can
|
||||
// (do this by working out the point the camera is looking at, saving
|
||||
@ -841,8 +841,13 @@ void CGameView::MoveCameraTarget(const CVector3D& target)
|
||||
|
||||
CVector3D pivot = targetCam.GetFocus();
|
||||
CVector3D delta = target - pivot;
|
||||
|
||||
//If minimap movement, maintain previous zoom level by not changing Y position
|
||||
// - this prevents strange behavior when moving across changes in terrain height
|
||||
if (!minimap)
|
||||
m->PosY.SetValueSmoothly(delta.Y + m->PosY.GetValue());
|
||||
|
||||
m->PosX.SetValueSmoothly(delta.X + m->PosX.GetValue());
|
||||
m->PosY.SetValueSmoothly(delta.Y + m->PosY.GetValue());
|
||||
m->PosZ.SetValueSmoothly(delta.Z + m->PosZ.GetValue());
|
||||
|
||||
ClampDistance(m, false);
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
|
||||
InReaction HandleEvent(const SDL_Event_* ev);
|
||||
|
||||
void MoveCameraTarget(const CVector3D& target);
|
||||
void MoveCameraTarget(const CVector3D& target, bool minimap = false);
|
||||
void ResetCameraTarget(const CVector3D& target);
|
||||
void ResetCameraAngleZoom();
|
||||
void CameraFollow(entity_id_t entity, bool firstPerson);
|
||||
|
@ -153,7 +153,7 @@ void CMiniMap::SetCameraPos()
|
||||
CVector3D target;
|
||||
GetMouseWorldCoordinates(target.X, target.Z);
|
||||
target.Y = terrain->GetExactGroundLevel(target.X, target.Z);
|
||||
g_Game->GetView()->MoveCameraTarget(target);
|
||||
g_Game->GetView()->MoveCameraTarget(target, true);
|
||||
}
|
||||
|
||||
float CMiniMap::GetAngle()
|
||||
|
Loading…
Reference in New Issue
Block a user