Skip to content

Commit

Permalink
[Dehardcode]Enable waypoint for buildings (#1343)
Browse files Browse the repository at this point in the history
### Waypoint for buildings

In `rulesmd.ini`:
```ini
[General]
BuildingWaypoint = false    ; boolean
```
  • Loading branch information
TaranDahl authored Feb 9, 2025
1 parent 521605c commit f5f3c9a
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ This page lists all the individual contributions to the project by their author.
- Skip anim delay for burst fire
- Type select for buildings (code)
- Raise alert when technos are taking damage
- Toggle waypoint for building
- **tyuah8** - Drive/Jumpjet/Ship/Teleport locomotor did not power on when it is un-piggybacked bugfix
- **Aephiex** - initial fix for Ares academy not working on the initial payloads of vehicles built from a war factory
- **Ares developers**
Expand Down
10 changes: 10 additions & 0 deletions docs/New-or-Enhanced-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -1584,6 +1584,16 @@ Convert.HumanToComputer = ; TechnoType
Convert.ComputerToHuman = ; TechnoType
```

### Waypoint for building

- In vanilla, building and aircraft is forbiddened to use waypoint. Now you can turn it on by the following flags.

In `rulesmd.ini`:
```ini
[General]
BuildingWaypoint=false ; boolean
```

## Terrain

### Destroy animation & sound
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ New:
- Type select for buildings (code by TaranDahl(航味麻酱), doc by Ollerus)
- Raise alert when technos are taking damage (by TaranDahl)
- Enhanced Bombard trajectory (by CrimRecya & Ollerus, based on knowledge of NaotoYuuki)
- Toggle waypoint for building (by TaranDahl)
Vanilla fixes:
- Aircraft will now behave as expected according to it's `MovementZone` and `SpeedType` when moving onto different surfaces. In particular, this fixes erratic behavior when vanilla aircraft is ordered to move onto water surface and instead the movement order changes to a shore nearby (by CrimRecya)
Expand Down
12 changes: 11 additions & 1 deletion src/Ext/Building/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,4 +703,14 @@ DEFINE_HOOK(0x44B630, BuildingClass_MissionAttack_AnimDelayedFire, 0x6)
return (pTypeExt && !pTypeExt->IsAnimDelayedBurst && pThis->CurrentBurstIndex != 0) ? JustFire : VanillaCheck;
}

#pragma endregion
#pragma endregion

#pragma region BuildingWaypoint

bool __fastcall BuildingTypeClass_CanUseWaypoint(BuildingTypeClass* pThis)
{
return RulesExt::Global()->BuildingWaypoint;
}
DEFINE_JUMP(VTABLE, 0x7E4610, GET_OFFSET(BuildingTypeClass_CanUseWaypoint))

#pragma endregion
3 changes: 3 additions & 0 deletions src/Ext/Rules/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ void RulesExt::ExtData::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI)
this->DropPodTrailer = droppod_trailer.Get(AnimTypeClass::Find("SMOKEY"));// Ares convention
this->PodImage = FileSystem::LoadSHPFile("POD.SHP");

this->BuildingWaypoint.Read(exINI, GameStrings::General, "BuildingWaypoint");

this->Buildings_DefaultDigitalDisplayTypes.Read(exINI, GameStrings::AudioVisual, "Buildings.DefaultDigitalDisplayTypes");
this->Infantry_DefaultDigitalDisplayTypes.Read(exINI, GameStrings::AudioVisual, "Infantry.DefaultDigitalDisplayTypes");
this->Vehicles_DefaultDigitalDisplayTypes.Read(exINI, GameStrings::AudioVisual, "Vehicles.DefaultDigitalDisplayTypes");
Expand Down Expand Up @@ -400,6 +402,7 @@ void RulesExt::ExtData::Serialize(T& Stm)
.Process(this->JumpjetLevelLightMultiplier)
.Process(this->VoxelLightSource)
// .Process(this->VoxelShadowLightSource)
.Process(this->BuildingWaypoint)
.Process(this->CombatAlert)
.Process(this->CombatAlert_IgnoreBuilding)
.Process(this->CombatAlert_SuppressIfInScreen)
Expand Down
2 changes: 2 additions & 0 deletions src/Ext/Rules/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ class RulesExt
Valueable<int> CombatLightDetailLevel;
Valueable<int> LightFlashAlphaImageDetailLevel;

Valueable<bool> BuildingWaypoint;
Valueable<bool> BuildingTypeSelectable;

ExtData(RulesClass* OwnerObject) : Extension<RulesClass>(OwnerObject)
Expand Down Expand Up @@ -317,6 +318,7 @@ class RulesExt
, WarheadParticleAlphaImageIsLightFlash { false }
, CombatLightDetailLevel { 0 }
, LightFlashAlphaImageDetailLevel { 0 }
, BuildingWaypoint { false }
, BuildingTypeSelectable { false }
{ }

Expand Down

0 comments on commit f5f3c9a

Please sign in to comment.