@@ -381,10 +381,8 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
381381 // rotate the view up/down
382382 if (m_isPitching)
383383 {
384- const Real FACTOR = 0 .01f ;
385-
386- Real angle = FACTOR * (m_currentPos.y - m_anchor.y );
387-
384+ constexpr const Real Scale = 0 .01f ;
385+ const Real angle = Scale * (m_currentPos.y - m_anchor.y );
388386 TheTacticalView->setPitch ( TheTacticalView->getPitch () + angle );
389387 m_anchor = msg->getArgument ( 0 )->pixel ;
390388 }
@@ -393,10 +391,8 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
393391 // adjust the field of view
394392 if (m_isChangingFOV)
395393 {
396- const Real FACTOR = 0 .01f ;
397-
398- Real angle = FACTOR * (m_currentPos.y - m_anchor.y );
399-
394+ constexpr const Real Scale = 0 .01f ;
395+ const Real angle = Scale * (m_currentPos.y - m_anchor.y );
400396 TheTacticalView->setFieldOfView ( TheTacticalView->getFieldOfView () + angle );
401397 m_anchor = msg->getArgument ( 0 )->pixel ;
402398 }
@@ -409,18 +405,9 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
409405 {
410406 m_lastMouseMoveTimeMsec = timeGetTime ();
411407
412- Int spin = msg->getArgument ( 1 )->integer ;
413-
414- if (spin > 0 )
415- {
416- for ( ; spin > 0 ; spin--)
417- TheTacticalView->zoom ( -View::ZoomHeightPerSecond );
418- }
419- else
420- {
421- for ( ;spin < 0 ; spin++ )
422- TheTacticalView->zoom ( +View::ZoomHeightPerSecond );
423- }
408+ const Int spin = msg->getArgument ( 1 )->integer ;
409+ const Real zoom = -spin * View::ZoomHeightPerSecond;
410+ TheTacticalView->zoom (zoom);
424411
425412 break ;
426413 }
@@ -440,17 +427,15 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
440427 {
441428 Coord2D offset = {0 , 0 };
442429
443- // If we've been forced to stop scrolling (script action?) then stop
444430 if (m_isScrolling && !TheInGameUI->isScrolling ())
445431 {
432+ // If we've been forced to stop scrolling (script action?)
446433 TheInGameUI->setScrollAmount (offset);
447434 stopScrolling ();
448435 }
449- else
450- // scroll the view
451- if (m_isScrolling)
436+ else if (m_isScrolling)
452437 {
453-
438+ // Scroll the view
454439 // TheSuperHackers @bugfix Mauller 07/06/2025 The camera scrolling is now decoupled from the render update.
455440 const Real fpsRatio = TheFramePacer->getBaseOverUpdateFpsRatio ();
456441
@@ -532,8 +517,11 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
532517 TheInGameUI->setScrollAmount (offset);
533518 TheTacticalView->scrollBy ( &offset );
534519 }
535- else // not scrolling so reset amount
520+ else
521+ {
522+ // not scrolling so reset amount
536523 TheInGameUI->setScrollAmount (offset);
524+ }
537525
538526 // if (TheGlobalData->m_saveCameraInReplay /*&& TheRecorder->getMode() != RECORDERMODETYPE_PLAYBACK *//**/&& (TheGameLogic->isInSinglePlayerGame() || TheGameLogic->isInSkirmishGame())/**/)
539527 // if (TheGlobalData->m_saveCameraInReplay && (TheGameLogic->isInMultiplayerGame() || TheGameLogic->isInSinglePlayerGame() || TheGameLogic->isInSkirmishGame()))
0 commit comments