Skip to content

Conversation

@TaranDahl
Copy link
Contributor

@TaranDahl TaranDahl commented Dec 8, 2025

Reopen #1453 again.
Documents:

[ ] Distribution Mode Spread / Filter / Enable

  • Now you can change the click action by using AllowSwitchNoMoveCommand hotkey. If the behavior to be executed by the current techno is different from the behavior displayed by the mouse, and the behavior to be executed will make the techno move near the target, the behavior will be replaced with area guard. Regardless of whether or not switch hotkey is used, default behavior can be changed through DefaultApplyNoMoveCommand.
  • Now you can also change the click action when hold down the specific hotkey if enabled AllowDistributionCommand. The new behavior is like using the selected objects one by one to click on each target within the range.
  • AllowDistributionCommand.SpreadMode & AllowDistributionCommand.FilterMode allow you to set spread range and target filter by hotkeys, which default to DefaultDistributionSpreadMode and DefaultDistributionFilterMode.
    • When the range is 0, it is the original default behavior of the game. The range can be adjusted to 4, 8 or 16 cells by another shortcut key. You can also adjust this by using the mouse wheel while holding down the specific hotkey if AllowDistributionCommand.SpreadModeScroll set to true;
      • The targets within the range will be allocated equally to the selected technos. Only when the behavior to be performed by the current techno is the same as that displayed by the mouse will it be allocated. Otherwise, it will return to the original default behavior of the game (it will not be effective for technos in the air). This will display a range ring.
    • When the filter is None, it is the default behavior of the game. If the range is not zero at this time, a green ring will be displayed. You can adjust the filter mode to:
      • Like - only targets with the same armor type (Completely identical Armor) will be selected among the targets allocated in the range. At this time, a blue ring will be displayed.
      • Type - only targets of the same type (like infantries, vehicles or buildings) will be selected among the targets allocated in the range. At this time, a yellow ring will be displayed.
      • Name - only targets of the same name (or with the same GroupAs) will be selected among the targets allocated in the range. At this time, a red ring will be displayed.
  • AllowDistributionCommand.AffectsAllies & AllowDistributionCommand.AffectsEnemies allow the distribution command to work on allies (including owner) or enemies target. If picking a target that's not eligible, it'll fallback to vanilla command.
  • It's possible to add a button for distribution mode in the bottom bar by adding DistributionMode in the ButtonList of AdvancedCommandBar and MultiplayerAdvancedCommandBar.
    • The positions of each button are hardcoded, so it'll only decide whether enable this button or not. Distribute Mode button is now always listed after all the vanilla ones.
    • The asset of these buttons should be added in sidec0x.mix files which correspond to different sides, with the name button12.shp.
  • For localization add TXT_SWITCH_NOMOVE, TXT_DISTR_SPREAD, TXT_DISTR_FILTER, TXT_DISTR_HOLDDOWN, TXT_SWITCH_NOMOVE_DESC, TXT_DISTR_SPREAD_DESC, TXT_DISTR_FILTER_DESC, TXT_DISTR_HOLDDOWN_DESC, MSG:DistributionModeOn, MSG:DistributionModeOff, TIP:DistributionMode into your .csf file.

In rulesmd.ini:

[GlobalControls]
AllowSwitchNoMoveCommand=false                      ; boolean
AllowDistributionCommand=false                      ; boolean
AllowDistributionCommand.SpreadMode=true            ; boolean
AllowDistributionCommand.SpreadModeScroll=true      ; boolean
AllowDistributionCommand.FilterMode=true            ; boolean
AllowDistributionCommand.AffectsAllies=true         ; boolean
AllowDistributionCommand.AffectsEnemies=true        ; boolean

[AudioVisual]
StartDistributionModeSound=                         ; sound entry
EndDistributionModeSound=                           ; sound entry
AddDistributionModeCommandSound=                    ; sound entry

In ra2md.ini:

[Phobos]
DefaultApplyNoMoveCommand=true                      ; boolean
DefaultDistributionSpreadMode=2                     ; integer, 0 - r=0 , 1 - r=4 , 2 - r=8 , 3 - r=16
DefaultDistributionFilterMode=2                     ; integer, 0 - None , 1 - Like , 2 - Type , 3 - Name

In uimd.ini:

[AdvancedCommandBar]
ButtonList=[Button1],DistributionMode,[ButtonX]     ; List of button entry

[MultiplayerAdvancedCommandBar]
ButtonList=[Button1],DistributionMode,[ButtonX]     ; List of button entry

CrimRecya and others added 30 commits December 16, 2024 00:48
…tion

# Conflicts:
#	CREDITS.md
#	docs/Whats-New.md
#	src/Commands/Commands.cpp
#	src/Phobos.INI.cpp
#	src/Phobos.h
…tion

# Conflicts:
#	CREDITS.md
#	docs/Whats-New.md
@github-actions
Copy link

github-actions bot commented Dec 8, 2025

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

@TaranDahl
Copy link
Contributor Author

@Metadorius Any issue other than #1949 (review)?

@TaranDahl
Copy link
Contributor Author

TaranDahl commented Dec 8, 2025

TODO:
(Summarized from #1949 (review))

  • Create independent file for AdvancedCommandBarButtonClass.
  • Allow registering new AdvancedCommandBarButtonClass like MakeCommand.

@Metadorius Please confirm the above summary, or supplement/correct the incorrect parts.

@Metadorius
Copy link
Member

@TaranDahl yeah, correct, there was also a comment about implementing press-and-drag mode (and not sure if the "same type" (infantry/buildings/vehicles/etc) is needed, since we have "same armor" mode). CrimRecya said it's too problematic, however I don't really see why, since we already have drag selection and we could reuse drag selection to calculate the radius.

@TaranDahl
Copy link
Contributor Author

TaranDahl commented Dec 10, 2025

there was also a comment about implementing press-and-drag mode (and not sure if the "same type" (infantry/buildings/vehicles/etc) is needed

I think there is not enough labor force to add more features.
I think the existing work is sufficient in terms of completion. We should just perfect the existing features and then merge them.
As for more features, they should be another work, and can be implemented later, by anyone who wants them.
Breaking it into two PR can also help avoid the problem of having an excessive amount of code piled up in one PR, which may lead to no one willing to review it.

@Metadorius
Copy link
Member

I think there is not enough labor force to add more features. I think the existing work is sufficient in terms of completion. We should just perfect the existing features and then merge them. As for more features, they should be another work, and can be implemented later, by anyone who wants them. Breaking it into two PR can also help avoid the problem of having an excessive amount of code piled up in one PR, which may lead to no one willing to review it.

This isn't a feature though? It is just a somewhat small improvement that brings it in line with how modern games do it.

  • 0x6D2280 (exists in YRpp) for transforming screen coords into world coords (though Z is 0, maybe would want to account for that)
  • 0x4AC4CC is where the drag-selection band is set and the mouse hold is done
  • 0x4ABCEB is where the drag-selection release is handled
  • 0xD90 in TacticalClass is Rect that contains X, Y, Width, Height

From that you could calculate 2 points, get world coords via function above, use this info to draw a corresponding circle and set the mode to such. I am not sure what is complex here. If needed I can send my decompile for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants