Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Generals/Code/GameEngine/Include/GameClient/LookAtXlat.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class LookAtTranslator : public GameMessageTranslator
ICoord2D m_anchor;
ICoord2D m_originalAnchor;
ICoord2D m_currentPos;
Real m_anchorAngle;
Bool m_isScrolling; // set to true if we are in the act of RMB scrolling
Bool m_isRotating; // set to true if we are in the act of MMB rotating
Bool m_isPitching; // set to true if we are in the act of ALT pitch rotation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage

m_isRotating = true;
m_anchor = msg->getArgument( 0 )->pixel;
m_anchorAngle = TheTacticalView->getAngle();
m_originalAnchor = msg->getArgument( 0 )->pixel;
m_currentPos = msg->getArgument( 0 )->pixel;
m_timestamp = TheGameClient->getFrame();
Expand Down Expand Up @@ -360,10 +361,18 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
if (m_isRotating)
{
const Real FACTOR = 0.01f;
const Real angle = FACTOR * (m_currentPos.x - m_originalAnchor.x);
Real targetAngle = m_anchorAngle + angle;

Real angle = FACTOR * (m_currentPos.x - m_anchor.x);
// TheSuperHackers @tweak Stubbjax 13/11/2025 Snap angle to nearest 45 degrees
// while using force attack mode for convenience.
if (TheInGameUI->isInForceAttackMode())
Comment thread
xezon marked this conversation as resolved.
{
const Real snapRadians = DEG_TO_RADF(45);
targetAngle = WWMath::Round(targetAngle / snapRadians) * snapRadians;
}

TheTacticalView->setAngle( TheTacticalView->getAngle() + angle );
TheTacticalView->setAngle(targetAngle);
m_anchor = msg->getArgument( 0 )->pixel;
}

Expand Down
1 change: 1 addition & 0 deletions GeneralsMD/Code/GameEngine/Include/GameClient/LookAtXlat.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class LookAtTranslator : public GameMessageTranslator
ICoord2D m_anchor;
ICoord2D m_originalAnchor;
ICoord2D m_currentPos;
Real m_anchorAngle;
Bool m_isScrolling; // set to true if we are in the act of RMB scrolling
Bool m_isRotating; // set to true if we are in the act of MMB rotating
Bool m_isPitching; // set to true if we are in the act of ALT pitch rotation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage

m_isRotating = true;
m_anchor = msg->getArgument( 0 )->pixel;
m_anchorAngle = TheTacticalView->getAngle();
m_originalAnchor = msg->getArgument( 0 )->pixel;
m_currentPos = msg->getArgument( 0 )->pixel;
m_timestamp = TheGameClient->getFrame();
Expand Down Expand Up @@ -359,10 +360,18 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
if (m_isRotating)
{
const Real FACTOR = 0.01f;
const Real angle = FACTOR * (m_currentPos.x - m_originalAnchor.x);
Real targetAngle = m_anchorAngle + angle;

Real angle = FACTOR * (m_currentPos.x - m_anchor.x);
// TheSuperHackers @tweak Stubbjax 13/11/2025 Snap angle to nearest 45 degrees
// while using force attack mode for convenience.
if (TheInGameUI->isInForceAttackMode())
{
const Real snapRadians = DEG_TO_RADF(45);
targetAngle = WWMath::Round(targetAngle / snapRadians) * snapRadians;
}

TheTacticalView->setAngle( TheTacticalView->getAngle() + angle );
TheTacticalView->setAngle(targetAngle);
m_anchor = msg->getArgument( 0 )->pixel;
}

Expand Down
Loading