File tree Expand file tree Collapse file tree 4 files changed +20
-4
lines changed
GeneralsMD/Code/GameEngine
Source/GameClient/MessageStream
Source/GameClient/MessageStream Expand file tree Collapse file tree 4 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ class LookAtTranslator : public GameMessageTranslator
7171 ICoord2D m_anchor;
7272 ICoord2D m_originalAnchor;
7373 ICoord2D m_currentPos;
74+ Real m_anchorAngle;
7475 Bool m_isScrolling; // set to true if we are in the act of RMB scrolling
7576 Bool m_isRotating; // set to true if we are in the act of MMB rotating
7677 Bool m_isPitching; // set to true if we are in the act of ALT pitch rotation
Original file line number Diff line number Diff line change @@ -291,6 +291,7 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
291291
292292 m_isRotating = true ;
293293 m_anchor = msg->getArgument ( 0 )->pixel ;
294+ m_anchorAngle = TheTacticalView->getAngle ();
294295 m_originalAnchor = msg->getArgument ( 0 )->pixel ;
295296 m_currentPos = msg->getArgument ( 0 )->pixel ;
296297 m_timestamp = TheGameClient->getFrame ();
@@ -360,10 +361,16 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
360361 if (m_isRotating)
361362 {
362363 const Real FACTOR = 0 .01f ;
364+ Real angle = FACTOR * (m_currentPos.x - m_originalAnchor.x );
365+ Real targetAngle = m_anchorAngle + angle;
363366
364- Real angle = FACTOR * (m_currentPos.x - m_anchor.x );
367+ if (TheInGameUI->isInForceAttackMode ())
368+ {
369+ const Real snapRadians = DEG_TO_RADF (45 );
370+ targetAngle = WWMath::Round (targetAngle / snapRadians) * snapRadians;
371+ }
365372
366- TheTacticalView->setAngle ( TheTacticalView-> getAngle () + angle );
373+ TheTacticalView->setAngle (targetAngle );
367374 m_anchor = msg->getArgument ( 0 )->pixel ;
368375 }
369376
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ class LookAtTranslator : public GameMessageTranslator
7171 ICoord2D m_anchor;
7272 ICoord2D m_originalAnchor;
7373 ICoord2D m_currentPos;
74+ Real m_anchorAngle;
7475 Bool m_isScrolling; // set to true if we are in the act of RMB scrolling
7576 Bool m_isRotating; // set to true if we are in the act of MMB rotating
7677 Bool m_isPitching; // set to true if we are in the act of ALT pitch rotation
Original file line number Diff line number Diff line change @@ -290,6 +290,7 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
290290
291291 m_isRotating = true ;
292292 m_anchor = msg->getArgument ( 0 )->pixel ;
293+ m_anchorAngle = TheTacticalView->getAngle ();
293294 m_originalAnchor = msg->getArgument ( 0 )->pixel ;
294295 m_currentPos = msg->getArgument ( 0 )->pixel ;
295296 m_timestamp = TheGameClient->getFrame ();
@@ -359,10 +360,16 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
359360 if (m_isRotating)
360361 {
361362 const Real FACTOR = 0 .01f ;
363+ Real angle = FACTOR * (m_currentPos.x - m_originalAnchor.x );
364+ Real targetAngle = m_anchorAngle + angle;
362365
363- Real angle = FACTOR * (m_currentPos.x - m_anchor.x );
366+ if (TheInGameUI->isInForceAttackMode ())
367+ {
368+ const Real snapRadians = DEG_TO_RADF (45 );
369+ targetAngle = WWMath::Round (targetAngle / snapRadians) * snapRadians;
370+ }
364371
365- TheTacticalView->setAngle ( TheTacticalView-> getAngle () + angle );
372+ TheTacticalView->setAngle (targetAngle );
366373 m_anchor = msg->getArgument ( 0 )->pixel ;
367374 }
368375
You can’t perform that action at this time.
0 commit comments