Skip to content

Commit 304eb54

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into origin/ae-attach-discard-by-health-3
# Conflicts: # docs/Whats-New.md # src/Ext/Techno/Body.h # src/Ext/Techno/WeaponHelpers.cpp
2 parents 69146c7 + 4f27ca0 commit 304eb54

19 files changed

+645
-59
lines changed

CREDITS.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ This page lists all the individual contributions to the project by their author.
373373
- Fix the issue where some units crashed after the deployment transformation
374374
- Turretless vehicles with `Voxel=no` support use `FireUp` like infantry
375375
- Infantry support `IsGattling=yes`
376+
- Support for more optional weapons
376377
- **NetsuNegi**:
377378
- Forbidding parallel AI queues by type
378379
- Jumpjet crash speed fix when crashing onto building
@@ -417,6 +418,7 @@ This page lists all the individual contributions to the project by their author.
417418
- Fix the bug that damaged particle dont disappear after building has repaired by engineer
418419
- Display banner improvement
419420
- Electric/RadBeam trail for laser tails
421+
- Ground line for select box
420422
- **Apollo** - Translucent SHP drawing patches
421423
- **ststl**:
422424
- Customizable `ShowTimer` priority of superweapons
@@ -508,15 +510,15 @@ This page lists all the individual contributions to the project by their author.
508510
- Fix `DefaultDisguise` showing wrong house colors for different players
509511
- Fire weapon when Warhead kills something
510512
- Promotion animation deglobalization
511-
- Forcing specific weapon by range
513+
- Forcing specific weapon by range and target type
512514
- Passenger-based insignias
513515
- Use `InsigniaType` to set the properties of insignia in a batch
514516
- Allow player's self-healing effects to be benefited by allied or `PlayerControl=true` houses
515517
- Power plant damage factor
516518
- Allow faking digital display for `InfoType=Health` at disguise
517519
- Display banner improvement and doc
518520
- Attached effect attach/discard by health
519-
- Attached effect with `ExtraWarheads` and `FeedbackWeapon`
521+
- Attached effect with `ExtraWarheads`, `KillWeapon` and `FeedbackWeapon`
520522
- `AuxWeapon`
521523
- **NaotoYuuki** - Vertical & meteor trajectory projectile prototypes
522524
- **handama** - AI script action to `16005 Jump Back To Previous Script`

Phobos.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
</ItemGroup>
2020
<ItemGroup>
2121
<ClCompile Include="src\Ext\Infantry\Hooks.Firing.cpp" />
22+
<ClCompile Include="src\Ext\TechnoType\Hooks.MultiWeapon.cpp" />
2223
<ClCompile Include="src\Ext\Unit\Hooks.Firing.cpp" />
2324
<ClCompile Include="src\Ext\EBolt\Body.cpp" />
2425
<ClCompile Include="src\Ext\EBolt\Hooks.cpp" />

YRpp

docs/New-or-Enhanced-Logics.md

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,13 +1251,15 @@ AttackMove.PursuitTarget= ; boolean
12511251

12521252
- Now you can have some units following surrounding units when executing an attack move command. The follow behavior is equivalent to the behavior of follow command (`ctrl + alt`).
12531253
- Use `AttackMove.Follow.IncludeAir` to determine whether the follower will follow an air unit.
1254+
- Mind control units with `AttackMove.Follow.IfMindControlIsFull=true` set will follow if they reach the capacity.
12541255
- This feature should be useful for supportive units such as medics and repairers.
12551256

12561257
In `rulesmd.ini`:
12571258
```ini
1258-
[SOMETECHNO] ; TechnoType
1259-
AttackMove.Follow=false ; boolean
1260-
AttackMove.Follow.IncludeAir=false ; boolean
1259+
[SOMETECHNO] ; TechnoType
1260+
AttackMove.Follow=false ; boolean
1261+
AttackMove.Follow.IncludeAir=false ; boolean
1262+
AttackMove.Follow.IfMindControlIsFull=false ;boolean
12611263
```
12621264

12631265
### Attack move - without weapon
@@ -1538,29 +1540,43 @@ FLHKEY.BurstN= ; integer - Forward,Lateral,Height. FLHKey refers to weapon-spec
15381540
*Enemy behavior against EMP targets with `ForceWeapon.UnderEMP` in [C&C: Reloaded](https://www.moddb.com/mods/cncreloaded)*
15391541

15401542
- Can be used to override normal weapon selection logic to force specific weapons to use against certain targets. If multiple are set and target satisfies the conditions, the first one in listed order satisfied takes effect.
1541-
- `ForceWeapon.Naval.Decloaked` forces specified weapon to be used against uncloaked naval targets. Useful if your naval unit has one weapon only for underwater and another weapon for surface targets.
1543+
- `ForceWeapon.Naval.Decloaked` forces specified weapon to be used against uncloaked `Naval=yes` targets. Useful if your naval unit has one weapon only for underwater and another weapon for surface targets.
15421544
- `ForceWeapon.Cloaked` forces specified weapon to be used against any cloaked targets.
15431545
- `ForceWeapon.Disguised` forces specified weapon to be used against any disguised targets.
15441546
- `ForceWeapon.UnderEMP` forces specified weapon to be used if the target is under EMP effect.
15451547
- `ForceWeapon.InRange` forces specified a list of weapons to be used once the target is within their `Range`. If `ForceWeapon.InRange.TechnoOnly` set to true, it'll only be forced on TechnoTypes like other forced weapons, otherwise it'll also be forced when attacking empty grounds. The first weapon in the listed order satisfied will be selected. Can be applied to both ground and air target if `ForceAAWeapon.InRange` is not set.
15461548
- `ForceAAWeapon.InRange` does the same thing but only for air target. Taking priority to `ForceWeapon.InRange`, which means that it can only be applied to ground target when they're both set.
15471549
- `Force(AA)Weapon.InRange.Overrides` overrides the range when decides which weapon to use. Value from position matching the position from `Force(AA)Weapon.InRange` is used if found, or the weapon's own `Range` if not found or set to a value below 0.
15481550
- If `Force(AA)Weapon.InRange.ApplyRangeModifiers` is set to true, any applicable weapon range modifiers from the firer are applied to the decision range.
1551+
- A series of tags can force specified weapons based on the target's type.
1552+
- `ForceWeapon.Naval.Units` forces specified weapon to be used against `Naval=yes` units. Taking priority to `ForceWeapon.Units`.
1553+
- If `ForceWeapon.Defenses` is enabled, it'll be used if the target is a building with `BuildCat=Combat`. Otherwise it'll follow `ForceWeapon.Buildings`, if enabled.
1554+
- `ForceWeapon.Infantry/Units/Aircraft` can be applied to both ground and air target if `ForceAAWeapon.Infantry/Units/Aircraft` is not set.
1555+
- `ForceAAWeapon.Infantry/Units/Aircraft` do the same things but only for air target. Taking priority to `ForceWeapon.Infantry/Units/Naval.Units/Aircraft`, which means that they can only be applied to ground target when they're both set.
15491556

15501557
In `rulesmd.ini`:
15511558
```ini
15521559
[SOMETECHNO] ; TechnoType
1553-
ForceWeapon.Naval.Decloaked=-1 ; integer. 0 for primary weapon, 1 for secondary weapon, -1 to disable
1554-
ForceWeapon.Cloaked=-1 ; integer. 0 for primary weapon, 1 for secondary weapon, -1 to disable
1555-
ForceWeapon.Disguised=-1 ; integer. 0 for primary weapon, 1 for secondary weapon, -1 to disable
1556-
ForceWeapon.UnderEMP=-1 ; integer. 0 for primary weapon, 1 for secondary weapon, -1 to disable
1557-
ForceWeapon.InRange= ; List of integers. 0 for primary weapon, 1 for secondary weapon, -1 to disable
1560+
ForceWeapon.Naval.Decloaked=-1 ; integer, -1 to disable
1561+
ForceWeapon.Cloaked=-1 ; integer, -1 to disable
1562+
ForceWeapon.Disguised=-1 ; integer, -1 to disable
1563+
ForceWeapon.UnderEMP=-1 ; integer, -1 to disable
1564+
ForceWeapon.InRange= ; List of integers
15581565
ForceWeapon.InRange.Overrides= ; List of floating-point values
15591566
ForceWeapon.InRange.ApplyRangeModifiers=false ; boolean
15601567
ForceWeapon.InRange.TechnoOnly=true ; boolean
1561-
ForceAAWeapon.InRange= ; List of integers. 0 for primary weapon, 1 for secondary weapon, -1 to disable
1568+
ForceAAWeapon.InRange= ; List of integers
15621569
ForceAAWeapon.InRange.Overrides= ; List of floating-point values
15631570
ForceAAWeapon.InRange.ApplyRangeModifiers=false ; boolean
1571+
ForceWeapon.Buildings=-1 ; integer, -1 to disable
1572+
ForceWeapon.Defenses=-1 ; integer, -1 to disable
1573+
ForceWeapon.Infantry=-1 ; integer, -1 to disable
1574+
ForceWeapon.Naval.Units=-1 ; integer, -1 to disable
1575+
ForceWeapon.Units=-1 ; integer, -1 to disable
1576+
ForceWeapon.Aircraft=-1 ; integer, -1 to disable
1577+
ForceAAWeapon.Infantry=-1 ; integer, -1 to disable
1578+
ForceAAWeapon.Units=-1 ; integer, -1 to disable
1579+
ForceAAWeapon.Aircraft=-1 ; integer, -1 to disable
15641580
```
15651581

15661582
```{note}
@@ -1656,6 +1672,26 @@ MindControlLink.VisibleToHouse=all ; Affected House Enumeration (none|owner/s
16561672
MultiMindControl.ReleaseVictim=false ; boolean
16571673
```
16581674

1675+
### Multi Weapon
1676+
1677+
![image](_static/images/multiweapons.gif)
1678+
*Multi Weapon used to release different weapons against different targets in **Zero Boundary** by @[Stormsulfur](https://space.bilibili.com/11638715/lists/5358986)*
1679+
1680+
- You can now use `WeaponX` to enable more than 2 weapons for a TechnoType without hardcoded `Gunner=yes`, `IsGattling=yes` or `IsChargeTurret=yes` restriction.
1681+
- Set `MultiWeapon=yes` to enable this feature, be careful not to forget `WeaponCount`.
1682+
- `MultiWeapon.IsSecondary` specifies which weapons will be considered as `Secondary` when selecting weapons or triggering infantry's `SecondaryFire` settings. If not set, `Weapon1` will be considered as `Secondary`.
1683+
- `MultiWeapon.SelectCount` determines the number of weapons that can be selected by default weapon selection logic. Notice that higher number is bad for performance.
1684+
- If the number is smaller than the total amount of weapons, the ones with smaller indices will be picked.
1685+
- Other weapons can still be used for logic that specify a weapon index, such as [ForceWeapon](#forcing-specific-weapon-against-certain-targets).
1686+
1687+
In `rulesmd.ini`:
1688+
```ini
1689+
[SOMETECHNO] ; TechnoType
1690+
MultiWeapon=false ; boolean
1691+
MultiWeapon.IsSecondary= ; List of integers
1692+
MultiWeapon.SelectCount=2 ; integer
1693+
```
1694+
16591695
### No Manual Move
16601696

16611697
- You can now specify whether a TechnoType is unable to receive move command.

docs/User-Interface.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,16 @@ RealTimeTimers.Adaptive=false ; boolean
284284

285285
### Select Box
286286

287+
![selectbox](_static/images/selectbox.png)
288+
287289
- Now you can use and customize select box for infantry, vehicle and aircraft. No select box for buildings in default case, but you still can specific for some building if you want.
288290
- `Frames` can be used to list frames of `Shape` file that'll be drawn as a select box when the TechnoType's health is at or below full health/the percentage defined in `[AudioVisual] -> ConditionYellow/ConditionRed`, respectively.
289291
- If `Grounded` set to true, the select box will be drawn on the ground below the TechnoType.
290292
- Select box's translucency setting can be adjusted via `Translucency`.
291293
- `VisibleToHouses` and `VisibleToHouses.Observer` can limit visibility to specific players.
292294
- `DrawAboveTechno` specific whether the select box will be drawn before drawing the TechnoType. If set to false, the select box can be obscured by the TechnoType, and the draw location will ignore `PixelSelectionBracketDelta`.
295+
- You can now use `GroundShape` to specific a image which always draw on ground, it will only draw when techno is in air if set `Ground.AlwaysDraw=false`, this also affect on `GroundLine`.
296+
- If `GroundLine=true` , the game will draw a line from techno's position to its vertical projection, `GroundLine.Dashed=true` means the projection line is a dashed line.
293297

294298
In `rulesmd.ini`:
295299
```ini
@@ -304,12 +308,21 @@ DefaultUnitSelectBox= ; Select box for vehicle and aircraft
304308
Shape=select.shp ; filename with .shp extension
305309
Palette=palette.pal ; filename with .pal extension
306310
Frames= ; List of integer, default 1,1,1 for infantry, 0,0,0 for vehicle and aircraft
307-
Grounded=false ; boolean
308311
Offset=0,0 ; integers - horizontal, vertical
309312
Translucency=0 ; translucency level (0/25/50/75)
310313
VisibleToHouses=all ; Affected House Enumeration (none|owner/self|allies/ally|team|enemies/enemy|all)
311314
VisibleToHouses.Observer=true ; boolean
312315
DrawAboveTechno=true ; boolean
316+
GroundShape= ; filename with .shp extension
317+
GroundPalette=palette.pal ; filename with .pal extension
318+
GroundFrames= ; List of integer, default 1,1,1 for infantry, 0,0,0 for vehicle and aircraft
319+
GroundOffset=0,0 ; integers - horizontal, vertical
320+
Ground.AlwaysDraw=true ; boolean
321+
GroundLine=false ; boolean
322+
GroundLineColor=0,255,0 ; R, G, B
323+
GroundLineColor.ConditionYellow= ; R, G, B
324+
GroundLineColor.ConditionRed= ; R, G, B
325+
GroundLine.Dashed=false ; boolean
313326

314327
[SOMETECHNO] ; TechnoType
315328
SelectBox= ; Select box

docs/Whats-New.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ New:
365365
- [Customize overpower logic](Fixed-or-Improved-Logics.md#customize-overpower-logic) (by NetsuNegi)
366366
- [Promotion animation deglobalization](New-or-Enhanced-Logics.md#promotion-animation) (by Ollerus)
367367
- Enhanced [reveal](New-or-Enhanced-Logics.md#reveal-map-for-owner-on-impact) & [gap](New-or-Enhanced-Logics.md#shroud-map-for-enemies-on-impact) warhead (by NetsuNegi)
368-
- [Forcing specific weapon by range](New-or-Enhanced-Logics.md#forcing-specific-weapon-against-certain-targets) (by Ollerus)
368+
- [Forcing specific weapon by range and target type](New-or-Enhanced-Logics.md#forcing-specific-weapon-against-certain-targets) (by Ollerus)
369369
- [Jumpjet Tilts While Moving](New-or-Enhanced-Logics.md#jumpjet-tilts-while-moving) (by CrimRecya)
370370
- [Spawned aircraft facing to match turret toggle](New-or-Enhanced-Logics.md#aircraft-spawner-customizations) (by Starkku)
371371
- [Removed dependency on `blowfish.dll`](Miscellanous.md#blowfish-dependency) (by ZivDero)
@@ -408,8 +408,10 @@ New:
408408
- Electric/RadBeam trail for laser tails (by NetsuNegi)
409409
- Add `DebrisMinimums` to keep the count of debris within a certain range (by CrimRecya)
410410
- Several attackmove related enhancement (by TaranDahl)
411+
- Ground line for select box (by NetsuNegi)
412+
- Support for more optional weapons (by FlyStar)
411413
- Attached effect attach/discard by health (by Ollerus)
412-
- Attached effect with `ExtraWarheads` and `FeedbackWeapon` (by Ollerus)
414+
- Attached effect with `ExtraWarheads`, `KillWeapon` and `FeedbackWeapon` (by Ollerus)
413415
- [AuxWeapon](New-or-Enhanced-Logics.md#auxiliary-weapon) (by Ollerus)
414416
415417
Vanilla fixes:

docs/_static/images/multiweapons.gif

3.65 MB
Loading

docs/_static/images/selectbox.png

252 KB
Loading

src/Ext/Techno/Body.Update.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,7 @@ void TechnoExt::ExtData::ApplyMindControlRangeLimit()
13721372
auto const pCapturerExt = TechnoExt::ExtMap.Find(pCapturer)->TypeExtData;
13731373

13741374
if (pCapturerExt->MindControlRangeLimit.Get() > 0 &&
1375-
pThis->DistanceFrom(pCapturer) > pCapturerExt->MindControlRangeLimit.Get())
1375+
pCapturer->DistanceFrom(pThis) > pCapturerExt->MindControlRangeLimit.Get())
13761376
{
13771377
pCapturer->CaptureManager->FreeUnit(pThis);
13781378
}

src/Ext/Techno/Body.Visuals.cpp

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -350,50 +350,63 @@ void TechnoExt::DrawSelectBox(TechnoClass* pThis, const Point2D* pLocation, cons
350350
if (!pSelectBox || pSelectBox->DrawAboveTechno == drawBefore)
351351
return;
352352

353-
const auto pShape = pSelectBox->Shape.Get();
354-
355-
if (!pShape)
356-
return;
357-
358353
const bool canSee = HouseClass::IsCurrentPlayerObserver() ? pSelectBox->VisibleToHouses_Observer : EnumFunctions::CanTargetHouse(pSelectBox->VisibleToHouses, pThis->Owner, HouseClass::CurrentPlayer);
359354

360355
if (!canSee)
361356
return;
362357

363-
const auto pPalette = pSelectBox->Palette.GetOrDefaultConvert(FileSystem::PALETTE_PAL);
364-
365358
const double healthPercentage = pThis->GetHealthPercentage();
366-
const Vector3D<int> frames = pSelectBox->Frames.Get(whatAmI == AbstractType::Infantry ? CoordStruct { 1,1,1 } : CoordStruct { 0,0,0 });
367-
const int frame = healthPercentage > RulesClass::Instance->ConditionYellow ? frames.X : healthPercentage > RulesClass::Instance->ConditionRed ? frames.Y : frames.Z;
359+
const auto defaultFrame = whatAmI == InfantryClass::AbsID ? Vector3D<int> { 1, 1, 1 } : Vector3D<int> { 0, 0, 0 };
368360

369-
Point2D drawPoint = *pLocation;
361+
const auto pSurface = DSurface::Temp;
362+
const auto flags = (drawBefore ? BlitterFlags::Flat | BlitterFlags::Alpha : BlitterFlags::Nonzero | BlitterFlags::MultiPass) | BlitterFlags::Centered | pSelectBox->Translucency;
363+
const int zAdjust = drawBefore ? pThis->GetZAdjustment() - 2 : 0;
364+
const auto pGroundShape = pSelectBox->GroundShape.Get();
370365

371-
if (pSelectBox->Grounded && whatAmI != BuildingClass::AbsID)
366+
if ((pGroundShape || pSelectBox->GroundLine) && whatAmI != BuildingClass::AbsID && (pSelectBox->Ground_AlwaysDraw || pThis->IsInAir()))
372367
{
373368
CoordStruct coords = pThis->GetCenterCoords();
374369
coords.Z = MapClass::Instance.GetCellFloorHeight(coords);
370+
auto [point, visible] = TacticalClass::Instance->CoordsToClient(coords);
375371

376-
const auto& [outClient, visible] = TacticalClass::Instance->CoordsToClient(coords);
372+
if (visible && pGroundShape)
373+
{
374+
const auto pPalette = pSelectBox->GroundPalette.GetOrDefaultConvert(FileSystem::PALETTE_PAL);
377375

378-
if (!visible)
379-
return;
376+
const Vector3D<int> frames = pSelectBox->GroundFrames.Get(defaultFrame);
377+
const int frame = healthPercentage > RulesClass::Instance->ConditionYellow ? frames.X : healthPercentage > RulesClass::Instance->ConditionRed ? frames.Y : frames.Z;
378+
379+
const Point2D drawPoint = point + pSelectBox->GroundOffset;
380+
pSurface->DrawSHP(pPalette, pGroundShape, frame, &drawPoint, pBounds, flags, 0, zAdjust, ZGradient::Ground, 1000, 0, nullptr, 0, 0, 0);
381+
}
380382

381-
drawPoint = outClient;
383+
if (pSelectBox->GroundLine)
384+
{
385+
Point2D start = *pLocation; // Copy to prevent be modified
386+
const int color = Drawing::RGB_To_Int(pSelectBox->GroundLineColor.Get(healthPercentage));
387+
388+
if (pSelectBox->GroundLine_Dashed)
389+
pSurface->DrawDashed(&start, &point, color, 0);
390+
else
391+
pSurface->DrawLine(&start, &point, color);
392+
}
382393
}
383394

384-
drawPoint += pSelectBox->Offset;
395+
if (const auto pShape = pSelectBox->Shape.Get())
396+
{
397+
const auto pPalette = pSelectBox->Palette.GetOrDefaultConvert(FileSystem::PALETTE_PAL);
385398

386-
if (pSelectBox->DrawAboveTechno)
387-
drawPoint.Y += pType->PixelSelectionBracketDelta;
399+
const Vector3D<int> frames = pSelectBox->Frames.Get(defaultFrame);
400+
const int frame = healthPercentage > RulesClass::Instance->ConditionYellow ? frames.X : healthPercentage > RulesClass::Instance->ConditionRed ? frames.Y : frames.Z;
388401

389-
if (whatAmI == AbstractType::Infantry)
390-
drawPoint += { 8, -3 };
391-
else
392-
drawPoint += { 1, -4 };
402+
const Point2D offset = whatAmI == InfantryClass::AbsID ? Point2D { 8, -3 } : Point2D { 1, -4 };
403+
Point2D drawPoint = *pLocation + offset + pSelectBox->Offset;
393404

394-
const auto flags = BlitterFlags::Centered | BlitterFlags::Nonzero | BlitterFlags::MultiPass | pSelectBox->Translucency;
405+
if (pSelectBox->DrawAboveTechno)
406+
drawPoint.Y += pType->PixelSelectionBracketDelta;
395407

396-
DSurface::Composite->DrawSHP(pPalette, pShape, frame, &drawPoint, pBounds, flags, 0, 0, ZGradient::Ground, 1000, 0, nullptr, 0, 0, 0);
408+
pSurface->DrawSHP(pPalette, pShape, frame, &drawPoint, pBounds, flags, 0, zAdjust, ZGradient::Ground, 1000, 0, nullptr, 0, 0, 0);
409+
}
397410
}
398411

399412
void TechnoExt::ProcessDigitalDisplays(TechnoClass* pThis)

0 commit comments

Comments
 (0)