Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ This page lists all the individual contributions to the project by their author.
- Build area customizations
- `Scorch` / `Flamer` fire animation customization
- EM Pulse cannon logic improvements
- `<Player @ X>` as owner for pre-placed objects
- **Morton (MortonPL)**:
- `XDrawOffset` for animations
- Shield passthrough & absorption
Expand Down Expand Up @@ -363,7 +364,6 @@ This page lists all the individual contributions to the project by their author.
- Flashing Technos on selecting
- Promotion animation
- **ZivDero**
- Allow giving ownership of buildings to players in Skirmish and MP using <Player @ A-H>
- Re-enable the Veinhole Monster and Weeds from TS
- Recreate the weed-charging of SWs like the TS Chemical Missile
- Allow to change the speed of gas particles
Expand Down
3 changes: 1 addition & 2 deletions Phobos.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Ext\TechnoType\Hooks.MatrixOp.cpp" />
<ClCompile Include="src\New\Entity\AttachEffectClass.cpp" />
<ClCompile Include="src\New\Type\AttachEffectTypeClass.cpp" />
<ClCompile Include="src\Commands\Commands.cpp" />
Expand Down Expand Up @@ -62,7 +63,6 @@
<ClCompile Include="src\Ext\Trigger\Hooks.cpp" />
<ClCompile Include="src\Ext\Unit\Hooks.Crushing.cpp" />
<ClCompile Include="src\Locomotion\TestLocomotionClass.cpp" />
<ClCompile Include="src\Misc\Hooks.AssignHouses.cpp" />
<ClCompile Include="src\Misc\Hooks.Gamespeed.cpp" />
<ClCompile Include="src\Misc\Hooks.Ares.cpp" />
<ClCompile Include="src\Misc\Hooks.Crates.cpp" />
Expand Down Expand Up @@ -114,7 +114,6 @@
<ClCompile Include="src\Ext\Side\Hooks.SidebarGDIPositions.cpp" />
<ClCompile Include="src\Ext\TechnoType\Body.cpp" />
<ClCompile Include="src\Ext\TechnoType\Hooks.Teleport.cpp" />
<ClCompile Include="src\Ext\TechnoType\Hooks.Drawing.cpp" />
<ClCompile Include="src\Ext\TechnoType\Hooks.cpp" />
<ClCompile Include="src\Ext\Techno\Body.cpp" />
<ClCompile Include="src\Ext\Techno\Body.Internal.cpp" />
Expand Down
2 changes: 1 addition & 1 deletion YRpp
28 changes: 20 additions & 8 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
- Fixed `DeployToFire` not considering building placement rules for `DeploysInto` buildings and as a result not working properly with `WaterBound` buildings.
- Fixed `DeployToFire` not recalculating firer's position on land if it cannot currently deploy.
- `Arcing=true` projectile elevation inaccuracy can now be fixed by setting `Arcing.AllowElevationInaccuracy=false`.
- You can now specify houses named `<Player @ A>` through `<Player @ H>` as the owner of TechnoTypes preplaced on the map in the editor, and they will be correctly given to players starting on points 1-8. Originally, it was only possible to use these house names in events, actions and teams.
- Wall overlays are now drawn with the custom palette defined in `Palette` in `artmd.ini` if possible.
- `Secondary` will now be used against walls if `Primary` weapon Warhead has `Wall=false`, `Secondary` has `Wall=true` and the firer does not have `NoSecondaryWeaponFallback` set to true.
- Setting `ReloadInTransport` to true on units with `Ammo` will allow the ammo to be reloaded according to `Reload` or `EmptyReload` timers even while the unit is inside a transport.
Expand Down Expand Up @@ -174,6 +173,8 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
- Certain global tileset indices (`ShorePieces`, `WaterSet`, `CliffSet`, `WaterCliffs`, `WaterBridge`, `BridgeSet` and `WoodBridgeSet`) are now correctly parsed for Lunar theater.
- Fixed infantry `SecondaryFire` / `SecondaryProne` sequences being displayed in water instead of `WetAttack`.
- Fixed objects with ally target and `AttackFriendlies=true` having their target reset every frame, particularly AI-owned buildings.
- `<Player @ X>` can now be used as owner for pre-placed objects on skirmish and multiplayer maps.
- Follower vehicle index for preplaced vehicles in maps is now explicitly constrained to `[Units]` list in map files and is no longer thrown off by vehicles that could not be created or created vehicles having other vehicles as initial passengers.

## Fixes / interactions with other extensions

Expand Down Expand Up @@ -342,20 +343,20 @@ AircraftDockingDir(N)= ; Direction type (integers from 0-255)

### Unit repair customization

- It is now possible to customize the repairing of units by `UnitRepair=true` and `UnitReload=true` buildings.
- It is now possible to customize the repairing of units by `UnitRepair=true`, `UnitReload=true` and `Hospital=true` buildings.
- `Units.RepairRate` customizes the rate at which the units are repaired. This defaults to `[General]`->`ReloadRate` if `UnitReload=true` and if overridden per AircraftType (Ares feature) can tick at different time for each docked aircraft. Setting this overrides that behaviour. For `UnitRepair=true` buildings this defaults to `[General]`->`URepairRate`.
- On `UnitReload=true` building setting this to negative value will fully disable the repair functionality.
- `Units.RepairStep` how much `Strength` is restored per repair tick. Defaults to `[General]`->`RepairStep`.
- `Units.RepairPercent` is a multiplier to cost of repairing (cost / (maximum health / repair step)). Defaults to `[General]`->`RepairPercent`. Note that the final cost is set to 1 if it is less than that.
- `Units.DisableRepairCost` if set to true disables the repair cost entirely.
- `Units.UseRepairCost` can be used to customize if repair cost is applied at all. Defaults to false for infantry, true for everything else.

In `rulesmd.ini`:
```ini
[SOMEBUILDING] ; BuildingType
Units.RepairRate= ; floating point value, ingame minutes
Units.RepairStep= ; integer
Units.RepairPercent= ; floating point value, percents or absolute
Units.DisableRepairCost=false ; boolean
[SOMEBUILDING] ; BuildingType
Units.RepairRate= ; floating point value, ingame minutes
Units.RepairStep= ; integer
Units.RepairPercent= ; floating point value, percents or absolute
Units.UseRepairCost= ; boolean
```

### Airstrike target eligibility
Expand Down Expand Up @@ -1454,6 +1455,17 @@ AmbientDamage.Warhead= ; WarheadType
AmbientDamage.IgnoreTarget=false ; boolean
```

### Charge turret delays

- It is now possible to customize the delay of `IsChargeTurret=true` unit turret animation per weapon, per `Burst` shot instead of defaulting to weapon's rearm timer (`ROF`, `BurstDelays` etc). Delay in the list corresponding to burst shot is used, or last delay listed if number of listed values is lower than the current burst index. Delay of 0 or less means previous delay, if applicable, is not restarted.
- Note that unlike the default rearm timer that uses `ROF`, any modifiers are not applied to explicitly set charge turret delays.

In `rulesmd.ini`:
```ini
[SOMEWEAPON] ; WeaponType
ChargeTurret.Delays= ; list of integers - game frames
```

### Customizable disk laser radius

![image](_static/images/disklaser-radius-values-01.gif)
Expand Down
5 changes: 4 additions & 1 deletion docs/New-or-Enhanced-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ This page describes all the engine features that are either new and introduced b
- `Tint.Color` & `Tint.Intensity` can be used to set a color tint effect and additive lighting increase/decrease on the object the effect is attached to, respectively.
- `Tint.VisibleToHouses` can be used to control which houses can see the tint effect.
- `FirepowerMultiplier`, `ArmorMultiplier`, `SpeedMultiplier` and `ROFMultiplier` can be used to modify the object's firepower, armor strength, movement speed and weapon reload rate, respectively.
- If `ROFMultiplier.ApplyOnCurrentTimer` is set to true, `ROFMultiplier` is applied on currently running reload timer (if any) when the effect is first applied.
- `ArmorMultiplier.AllowWarheads` and `ArmorMultiplier.DisallowWarheads` can be used to restrict which Warheads the armor multiplier is applied to when dealing damage.
- If `ROFMultiplier.ApplyOnCurrentTimer` is set to true, `ROFMultiplier` is applied on currently running reload timer (if any) when the effect is first applied.
- If `Cloakable` is set to true, the object the effect is attached to is granted ability to cloak itself for duration of the effect.
- `ForceDecloak`, if set to true, will uncloak and make the object the effect is attached to unable to cloak itself for duration of the effect.
- `WeaponRange.Multiplier` and `WeaponRange.ExtraRange` can be used to multiply the weapon firing range of the object the effect is attached to, or give it an increase / decrease (measured in cells), respectively. `ExtraRange` is cumulatively applied from all attached effects after all `Multiplier` values have been applied.
Expand Down Expand Up @@ -103,6 +104,8 @@ Tint.Intensity= ; floating point value
Tint.VisibleToHouses=all ; list of Affected House Enumeration (none|owner/self|allies/ally|team|enemies/enemy|all)
FirepowerMultiplier=1.0 ; floating point value
ArmorMultiplier=1.0 ; floating point value
ArmorMultiplier.AllowWarheads= ; list of WarheadTypes
ArmorMultiplier.DisallowWarheads= ; list of WarheadTypes
SpeedMultiplier=1.0 ; floating point value
ROFMultiplier=1.0 ; floating point value
ROFMultiplier.ApplyOnCurrentTimer=true ; boolean
Expand Down
5 changes: 4 additions & 1 deletion docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ You can use the migration utility (can be found on [Phobos supplementaries repo]

#### From post-0.3 devbuilds

- `Units.DisableRepairCost` was changed to `Units.UseRepairCost` (note inverted expected value) as it no longer has discrete default value and affects `Hospital=true` buildings, infantry do not have repair cost by default.
- Critical hit animations created by `Crit.AnimOnAffectedTargets=true` Warheads no longer default to `AnimList.PickRandom` if `Crit.AnimList.PickRandom` is not set.
- `SelfHealGainType` value `none` has been changed to `noheal` due to `none` being treated as a blank string and not parsed by the game.
- Affected target enum (`CanTarget`, `Crit.Affects` et al) now considers buildings considered vehicles (`ConsideredVehicle=true` or not set in conjunction with `UndeploysInto` & 1x1 foundation) as units instead of buildings.
Expand Down Expand Up @@ -373,7 +374,6 @@ New:
- Unhardcoded timer blinking color scheme (by Starkku)
- Customizing shield self-healing timer restart when shield is damaged (by Starkku)
- Customizing minimum & maximum amount of damage shield can take from a single hit (by Starkku)
- Players can now be given ownership of preplaced buildings in Skirmish and Multiplayer in maps using houses of the format <Player @ X> where X goes from A to H for spawn positions 1-8 (by ZivDero)
- `AutoDeath.Technos(Dont)Exist` can optionally track limboed (not physically on map, e.g transports etc) technos (by Starkku)
- Wall overlay `Palette` support (by Starkku)
- Show designator & inhibitor range (by Morton)
Expand Down Expand Up @@ -466,6 +466,8 @@ New:
- `Scorch` / `Flamer` fire animation customization (by Starkku)
- Warheads parasite removal customization (by Starkku)
- Allow infantry to use land sequences in water (by Starkku)
- `<Player @ X>` can now be used as owner for pre-placed objects on skirmish and multiplayer maps (by Starkku)
- Allow customizing charge turret delays per burst on a weapon (by Starkku)

Vanilla fixes:
- Allow AI to repair structures built from base nodes/trigger action 125/SW delivery in single player missions (by Trsdy)
Expand Down Expand Up @@ -546,6 +548,7 @@ Vanilla fixes:
- Certain global tileset indices (`ShorePieces`, `WaterSet`, `CliffSet`, `WaterCliffs`, `WaterBridge`, `BridgeSet` and `WoodBridgeSet`) are now correctly parsed for Lunar theater (by Starkku)
- Fixed infantry `SecondaryFire` / `SecondaryProne` sequences being displayed in water instead of `WetAttack` (by Starkku)
- Fixed objects with ally target and `AttackFriendlies=true` having their target reset every frame, particularly AI-owned buildings (by Starkku)
- Follower vehicle index for preplaced vehicles in maps is now explicitly constrained to `[Units]` list in map files and is no longer thrown off by vehicles that could not be created or created vehicles having other vehicles as initial passengers (by Starkku)

Phobos fixes:
- Fixed a few errors of calling for superweapon launch by `LaunchSW` or building infiltration (by Trsdy)
Expand Down
132 changes: 8 additions & 124 deletions src/Commands/FrameStep.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,93 +17,16 @@ class FrameStepCommandClass : public CommandClass
template<size_t Frame>
inline const char* FrameStepCommandClass<Frame>::GetName() const
{
// "StepXXFrames"
class to_string_t
{
public:
char buffer[Frame >= 10 ? 13 : 12];

public:
constexpr to_string_t() noexcept
: buffer { "Step" }
{
size_t idx = 4;
if constexpr (Frame < 10)
{
buffer[idx++] = Frame + '0';
buffer[idx++] = 'F';
buffer[idx++] = 'r';
buffer[idx++] = 'a';
buffer[idx++] = 'm';
buffer[idx++] = 'e';
buffer[idx++] = 's';
buffer[idx++] = '\0';
}
else
{
buffer[idx++] = Frame / 10 + '0';
buffer[idx++] = Frame % 10 + '0';
buffer[idx++] = 'F';
buffer[idx++] = 'r';
buffer[idx++] = 'a';
buffer[idx++] = 'm';
buffer[idx++] = 'e';
buffer[idx++] = 's';
buffer[idx++] = '\0';
}
}

constexpr operator char* () noexcept { return buffer; }
};
static to_string_t ret;
return ret;
_snprintf_s(Phobos::readBuffer, Phobos::readLength, "Step%dFrames", Frame);
return Phobos::readBuffer;
}

template<size_t Frame>
inline const wchar_t* FrameStepCommandClass<Frame>::GetUIName() const
{
// L"Step forward XX frames."
class to_string_t
{
public:
wchar_t buffer[Frame >= 10 ? 23 : 22];

public:
constexpr to_string_t() noexcept
: buffer { L"Step forward " }
{
size_t idx = 13;
if constexpr (Frame < 10)
{
buffer[idx++] = Frame + '0';
buffer[idx++] = ' ';
buffer[idx++] = 'f';
buffer[idx++] = 'r';
buffer[idx++] = 'a';
buffer[idx++] = 'm';
buffer[idx++] = 'e';
buffer[idx++] = 's';
buffer[idx++] = '\0';
}
else
{
buffer[idx++] = Frame / 10 + '0';
buffer[idx++] = Frame % 10 + '0';
buffer[idx++] = ' ';
buffer[idx++] = 'f';
buffer[idx++] = 'r';
buffer[idx++] = 'a';
buffer[idx++] = 'm';
buffer[idx++] = 'e';
buffer[idx++] = 's';
buffer[idx++] = '\0';
}
}

constexpr operator wchar_t* () noexcept { return buffer; }
};
static to_string_t ret;
return StringTable::TryFetchString("TXT_STEP_XX_FORWARD", ret);
const wchar_t* csfString = StringTable::TryFetchString("TXT_STEP_XX_FORWARD", L"Step Forward %d Frames");
_snwprintf_s(Phobos::wideBuffer, std::size(Phobos::wideBuffer), csfString, Frame);
return Phobos::wideBuffer;
}

template<size_t Frame>
Expand All @@ -115,48 +38,9 @@ inline const wchar_t* FrameStepCommandClass<Frame>::GetUICategory() const
template<size_t Frame>
inline const wchar_t* FrameStepCommandClass<Frame>::GetUIDescription() const
{
// L"Frame Step Only: Step forward XX frames."
class to_string_t
{
public:
wchar_t buffer[Frame >= 10 ? 41 : 40];

public:
constexpr to_string_t() noexcept
: buffer { L"Frame Step Only: Step forward " }
{
size_t idx = 30;
if constexpr (Frame < 10)
{
buffer[idx++] = Frame + '0';
buffer[idx++] = ' ';
buffer[idx++] = 'f';
buffer[idx++] = 'r';
buffer[idx++] = 'a';
buffer[idx++] = 'm';
buffer[idx++] = 'e';
buffer[idx++] = 's';
buffer[idx++] = '\0';
}
else
{
buffer[idx++] = Frame / 10 + '0';
buffer[idx++] = Frame % 10 + '0';
buffer[idx++] = ' ';
buffer[idx++] = 'f';
buffer[idx++] = 'r';
buffer[idx++] = 'a';
buffer[idx++] = 'm';
buffer[idx++] = 'e';
buffer[idx++] = 's';
buffer[idx++] = '\0';
}
}

constexpr operator wchar_t* () noexcept { return buffer; }
};
static to_string_t ret;
return StringTable::TryFetchString("TXT_STEP_XX_FORWARD_DESC", ret);
const wchar_t* csfString = StringTable::TryFetchString("TXT_STEP_XX_FORWARD_DESC", L"Frame Step Only: Step forward %d frames.");
_snwprintf_s(Phobos::wideBuffer, std::size(Phobos::wideBuffer), csfString, Frame);
return Phobos::wideBuffer;
}

template<size_t Frame>
Expand Down
25 changes: 0 additions & 25 deletions src/Ext/Aircraft/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,31 +298,6 @@ DEFINE_HOOK(0x44402E, BuildingClass_ExitObject_PoseDir2, 0x5)

#pragma endregion

DEFINE_HOOK(0x4CF68D, FlyLocomotionClass_DrawMatrix_OnAirport, 0x5)
{
GET(ILocomotion*, iloco, ESI);
__assume(iloco != nullptr);
auto loco = static_cast<FlyLocomotionClass*>(iloco);
auto pThis = static_cast<AircraftClass*>(loco->LinkedTo);
if (pThis->GetHeight() <= 0)
{
REF_STACK(Matrix3D, mat, STACK_OFFSET(0x38, -0x30));
auto slope_idx = MapClass::Instance->GetCellAt(pThis->Location)->SlopeIndex;
mat = Matrix3D::VoxelRampMatrix[slope_idx] * mat;
float ars = pThis->AngleRotatedSideways;
float arf = pThis->AngleRotatedForwards;
if (std::abs(ars) > 0.005 || std::abs(arf) > 0.005)
{
mat.TranslateZ(float(std::abs(Math::sin(ars)) * pThis->Type->VoxelScaleX
+ std::abs(Math::sin(arf)) * pThis->Type->VoxelScaleY));
R->ECX(pThis);
return 0x4CF6AD;
}
}

return 0x4CF6A0;
}

DEFINE_HOOK(0x415EEE, AircraftClass_Fire_KickOutPassengers, 0x6)
{
enum { SkipKickOutPassengers = 0x415F08 };
Expand Down
Loading