Skip to content

Commit e5e1762

Browse files
committed
feat: Add ability to snap building rotation to 45 degree angles
1 parent f099e4d commit e5e1762

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,6 +1415,13 @@ void InGameUI::handleBuildPlacements( void )
14151415
v.y = worldEnd.y - worldStart.y;
14161416
angle = v.toAngle();
14171417

1418+
// Use force attack mode to control snapping for convenience
1419+
if (isInForceAttackMode())
1420+
{
1421+
// TheSuperHackers @tweak Stubbjax 04/08/2025 Snap angle to nearest 45 degrees (pi/4 radians)
1422+
const Real snapRadians = PI / 4.0f;
1423+
angle = floor((angle / snapRadians) + 0.5f) * snapRadians;
1424+
}
14181425
} // end if
14191426

14201427
} // end if

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,6 +1470,13 @@ void InGameUI::handleBuildPlacements( void )
14701470
v.y = worldEnd.y - worldStart.y;
14711471
angle = v.toAngle();
14721472

1473+
// Use force attack mode to control snapping for convenience
1474+
if (isInForceAttackMode())
1475+
{
1476+
// TheSuperHackers @tweak Stubbjax 04/08/2025 Snap angle to nearest 45 degrees (pi/4 radians)
1477+
const Real snapRadians = PI / 4.0f;
1478+
angle = floor((angle / snapRadians) + 0.5f) * snapRadians;
1479+
}
14731480
} // end if
14741481

14751482
} // end if

0 commit comments

Comments
 (0)