CnCNet / WorldAlteringEditor

Map editor for C&C: Red Alert 2, C&C: Tiberian Sun and Dawn of the Tiberium Age.
Other
76 stars 25 forks source link

Handling Individual Infantry in Cells #198

Closed Shushishtok closed 3 weeks ago

Shushishtok commented 4 weeks ago

Not to be confused with #199 , which allows handling entire infantry groups when holding a button.

This PR aims to address logic for handling individual infantry that reside in the same cell. Currently, WAE makes it impossible for the user to select and handle a specific infantry out of multiple that can reside in a cell; instead, it will always default to whichever infantry occupies the "first" cell. This means that moving specific infantry, rotating them, or assigning missions to them is not possible without isolating them in a different cell, then bringing them back.

The logic in this PR is changed to instead pass a relative position in a tile based on the cursor's position. This allows a specific cell that houses infantry to look at its sub cells and figure out which is closest to the cursor, allowing you to handle a specific infantry that is as close to the mouse as possible.

Also adjusts line draws slightly to address this change, showing the infantry that is being moved.

Showcase gif:

https://github.com/user-attachments/assets/e3bea3af-df7c-4720-8ddd-64a401cfd142