Skip to content
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
325989f
Core
CrimRecya Dec 15, 2024
4875c49
Merge branch 'develop' into develop-Distribution
CrimRecya Jan 26, 2025
6edc48e
Update Whats-New.md
CrimRecya Jan 26, 2025
73a6c0b
Draw at mouse
CrimRecya Jan 26, 2025
97c070d
Show range ring
CrimRecya Jan 26, 2025
e242669
Fix a typo
CrimRecya Jan 26, 2025
ab9c046
Fix target cloaked units
CrimRecya Feb 2, 2025
97f0e11
Merge branch 'develop' into develop-Distribution
CrimRecya Feb 2, 2025
32c90bd
")"
DeathFishAtEase Feb 2, 2025
82ea77c
Add a hold down key to enable
CrimRecya Feb 3, 2025
957b2ef
Merge branch 'develop' into develop-Distribution
CrimRecya Feb 3, 2025
d279944
Doc
CrimRecya Feb 3, 2025
4444222
Fix target shrouded units
CrimRecya Feb 3, 2025
40051d9
Fix target disguised units
CrimRecya Feb 3, 2025
2e38594
Fix target outside units
CrimRecya Feb 3, 2025
55723f3
Global toggle
CrimRecya Feb 13, 2025
dab3385
Merge branch 'develop' into develop-Distribution
CrimRecya Feb 13, 2025
1c47634
Message, sound and scroll action
CrimRecya Mar 6, 2025
90556bd
Merge remote-tracking branch 'upstream/develop' into develop-Distribu…
CrimRecya Mar 6, 2025
f4ae01b
Merge remote-tracking branch 'upstream/develop' into develop-Distribu…
CrimRecya Mar 25, 2025
6ce7407
Fix merge
CrimRecya Mar 25, 2025
685d456
Low distance first
CrimRecya Mar 25, 2025
1bb257d
...
CrimRecya Mar 25, 2025
ce16654
Merge remote-tracking branch 'upstream/develop' into develop-Distribu…
Coronia Jul 5, 2025
96c6a06
Merge branch 'develop' into develop-Distribution
Coronia Jul 5, 2025
25574cc
Code style
CrimRecya Jul 5, 2025
cd1b12f
Merge remote-tracking branch 'upstream/develop' into develop-Distribu…
Coronia Jul 15, 2025
3191dab
remove unnecessary Grinder process
Coronia Jul 16, 2025
55b7208
Merge branch 'develop' into develop-Distribution
Coronia Jul 16, 2025
4d1c883
Merge remote-tracking branch 'upstream/develop' into develop-Distribu…
CrimRecya Aug 6, 2025
b55908a
Refactor
CrimRecya Aug 6, 2025
6525feb
Remove useless
CrimRecya Aug 6, 2025
09bae51
Fix default value
CrimRecya Aug 6, 2025
aa509d0
Separate functions
CrimRecya Aug 6, 2025
e0bbe02
Fix include
CrimRecya Aug 6, 2025
573d8f8
Fit with FakeOf
CrimRecya Aug 26, 2025
fdd82ac
Merge branch 'develop' into develop-Distribution
CrimRecya Aug 26, 2025
4ab9876
TODO
CrimRecya Aug 28, 2025
2892caf
Merge branch 'develop' into develop-Distribution
CrimRecya Sep 13, 2025
e49a75f
Update YRpp
CrimRecya Sep 13, 2025
eb552f1
Button on bottom
CrimRecya Sep 13, 2025
27ca512
update doc
Coronia Oct 18, 2025
88c6cbe
Merge branch 'develop' into develop-Distribution
Coronia Oct 18, 2025
9dcbd2c
revert YRpp
Coronia Oct 18, 2025
744bf42
Merge branch 'develop' into develop-Distribution
Coronia Oct 29, 2025
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 CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ This page lists all the individual contributions to the project by their author.
- Fix an issue that jumpjet harvester will overlap when manually entering refinery buildings and cause game crashes
- Fix an issue that `Spawned` aircraft will fly towards the edge of the map when its `Spawner` is under EMP
- Burst without delay
- Distribution click action mode
- **Ollerus**:
- Build limit group enhancement
- Customizable rocker amplitude
Expand Down
2 changes: 2 additions & 0 deletions Phobos.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
<ClCompile Include="src\Commands\ToggleDesignatorRange.cpp" />
<ClCompile Include="src\Commands\ToggleDigitalDisplay.cpp" />
<ClCompile Include="src\Commands\SaveVariablesToFile.cpp" />
<ClCompile Include="src\Commands\DistributionMode.cpp" />
<ClCompile Include="src\Ext\Anim\Body.cpp" />
<ClCompile Include="src\Ext\Anim\Hooks.cpp" />
<ClCompile Include="src\Ext\Anim\Hooks.AnimCreateUnit.cpp" />
Expand Down Expand Up @@ -235,6 +236,7 @@
<ClInclude Include="src\Commands\ToggleDesignatorRange.h" />
<ClInclude Include="src\Commands\ToggleDigitalDisplay.h" />
<ClInclude Include="src\Commands\SaveVariablesToFile.h" />
<ClInclude Include="src\Commands\DistributionMode.h" />
<ClInclude Include="src\Ext\Bullet\Trajectories\BombardTrajectory.h" />
<ClInclude Include="src\Ext\Bullet\Trajectories\PhobosTrajectory.h" />
<ClInclude Include="src\Ext\Bullet\Trajectories\StraightTrajectory.h" />
Expand Down
36 changes: 36 additions & 0 deletions docs/User-Interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,42 @@ DisplayIncome.Offset=0,0 ; X,Y, pixels relative to default
- These vanilla CSF entries will be used: `TXT_SAVING_GAME`, `TXT_GAME_WAS_SAVED` and `TXT_ERROR_SAVING_GAME`.
- The save should be looks like `Allied Mission 25: Esther's Money - QuickSaved`.

### `[ ]` Distribution Mode Spread / Filter / Enable

- Change the click action when hold down the specific hotkey if enabled `AllowDistributionCommand`.
- `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:
- `Auto` - 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. At this time, a blue ring will be displayed.
- `Type` - on the basis of `Auto`, 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` - on the basis of `Type`, 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.
- For localization add `TXT_DISTR_SPREAD`, `TXT_DISTR_FILTER`, `TXT_DISTR_HOLDDOWN`, `TXT_DISTR_SPREAD_DESC`, `TXT_DISTR_FILTER_DESC`, `TXT_DISTR_HOLDDOWN_DESC`, `MSG:DistributionModeOn`, `MSG:DistributionModeOff` into your `.csf` file.

In `rulesmd.ini`:
```ini
[GlobalControls]
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`:
```ini
[Phobos]
DefaultDistributionSpreadMode=2 ; integer, 0 - r=0 , 1 - r=4 , 2 - r=8 , 3 - r=16
DefaultDistributionFilterMode=0 ; integer, 0 - None , 1 - Auto , 2 - Type , 3 - Name
```

## Loading screen

- PCX files can now be used as loadscreen images.
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ New:
- [Damaged aircraft image changes](New-or-Enhanced-Logics.md#damaged-aircraft-image-changes) (by Fryone)
- [Additional attached animation position customizations](Fixed-or-Improved-Logics.md#attached-animation-position-customization) (by Starkku)
- Use `SkipCrushSlowdown=true` to avoid the bug related to `Accelerates=true` and `MovementZone=CrushAll` (by TaranDahl)
- Distribution click action mode (by CrimRecya)

Vanilla fixes:
- Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya)
Expand Down
54 changes: 53 additions & 1 deletion src/Commands/Commands.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <CCINIClass.h>
#include "Commands.h"

#include "ObjectInfo.h"
Expand All @@ -10,8 +9,11 @@
#include "ToggleDigitalDisplay.h"
#include "ToggleDesignatorRange.h"
#include "SaveVariablesToFile.h"
#include "DistributionMode.h"
#include "ToggleSWSidebar.h"
#include "FireTacticalSW.h"
#include <CCINIClass.h>
#include <Utilities/Macro.h>
#include <Ext/Sidebar/SWSidebar/SWSidebarClass.h>

DEFINE_HOOK(0x533066, CommandClassCallback_Register, 0x6)
Expand All @@ -38,6 +40,17 @@ DEFINE_HOOK(0x533066, CommandClassCallback_Register, 0x6)
SWSidebarClass::Commands[9] = MakeCommand<FireTacticalSWCommandClass<9>>();
}

if (Phobos::Config::AllowDistributionCommand)
{
if (Phobos::Config::AllowDistributionCommand_SpreadMode)
MakeCommand<DistributionModeSpreadCommandClass>();

if (Phobos::Config::AllowDistributionCommand_FilterMode)
MakeCommand<DistributionModeFilterCommandClass>();

MakeCommand<DistributionModeHoldDownCommandClass>();
}

if (Phobos::Config::DevelopmentCommands)
{
MakeCommand<DamageDisplayCommandClass>();
Expand All @@ -54,3 +67,42 @@ DEFINE_HOOK(0x533066, CommandClassCallback_Register, 0x6)

return 0;
}

static void MouseWheelDownCommand()
{
// Debug::LogAndMessage("[Frame: %d] Mouse Wheel Down", Unsorted::CurrentFrame());

if (DistributionModeHoldDownCommandClass::Enabled && Phobos::Config::AllowDistributionCommand_SpreadModeScroll)
DistributionModeHoldDownCommandClass::DistributionSpreadModeReduce();
}

static void MouseWheelUpCommand()
{
// Debug::LogAndMessage("[Frame: %d] Mouse Wheel Up", Unsorted::CurrentFrame());

if (DistributionModeHoldDownCommandClass::Enabled && Phobos::Config::AllowDistributionCommand_SpreadModeScroll)
DistributionModeHoldDownCommandClass::DistributionSpreadModeExpand();
}

DEFINE_HOOK(0x777998, Game_WndProc_ScrollMouseWheel, 0x6)
{
GET(const WPARAM, WParam, ECX);

if (WParam & 0x80000000u)
MouseWheelDownCommand();
else
MouseWheelUpCommand();

return 0;
}

static inline bool CheckSkipScrollSidebar()
{
return DistributionModeHoldDownCommandClass::Enabled;
}

DEFINE_HOOK(0x533F50, Game_ScrollSidebar_Skip, 0x5)
{
enum { SkipScrollSidebar = 0x533FC3 };
return CheckSkipScrollSidebar() ? SkipScrollSidebar : 0;
}
Loading