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
11 changes: 11 additions & 0 deletions docs/New-or-Enhanced-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,17 @@ In `rulesmd.ini`:
TabIndex=1 ; integer
```

### Play theme on superweapon launch

- Superweapons can now trigger a soundtrack theme when fired using `LaunchTheme`.
- Provide a soundtrack theme ID to play immediately upon activation.

In `rulesmd.ini`:
```ini
[SOMESW] ; SuperWeaponType
LaunchTheme= ; Soundtrack theme ID
```

### EMPulse settings

- It is possible to customize which weapon a building with `EMPulseCannon=true` fires when an associated `Type=EMPulse` superweapon (**only** if `EMPulse.TargetSelf=false` or omitted) is fired by setting `EMPulse.WeaponIndex`.
Expand Down
12 changes: 7 additions & 5 deletions src/Ext/SWType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ void SWTypeExt::ExtData::Serialize(T& Stm)
.Process(this->SW_Next_RealLaunch)
.Process(this->SW_Next_IgnoreInhibitors)
.Process(this->SW_Next_IgnoreDesignators)
.Process(this->SW_Next_RandomWeightsData)
.Process(this->SW_Next_RollChances)
.Process(this->ShowTimer_Priority)
.Process(this->Convert_Pairs)
.Process(this->SW_Next_RandomWeightsData)
.Process(this->SW_Next_RollChances)
.Process(this->ShowTimer_Priority)
.Process(this->LaunchTheme)
.Process(this->Convert_Pairs)
.Process(this->ShowDesignatorRange)
.Process(this->TabIndex)
.Process(this->UseWeeds)
Expand Down Expand Up @@ -108,7 +109,8 @@ void SWTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
this->SW_Next_IgnoreDesignators.Read(exINI, pSection, "SW.Next.IgnoreDesignators");
this->SW_Next_RollChances.Read(exINI, pSection, "SW.Next.RollChances");

this->ShowTimer_Priority.Read(exINI, pSection, "ShowTimer.Priority");
this->ShowTimer_Priority.Read(exINI, pSection, "ShowTimer.Priority");
this->LaunchTheme = pINI->ReadTheme(pSection, "LaunchTheme", this->LaunchTheme);

this->EMPulse_WeaponIndex.Read(exINI, pSection, "EMPulse.WeaponIndex");
this->EMPulse_SuspendOthers.Read(exINI, pSection, "EMPulse.SuspendOthers");
Expand Down
13 changes: 8 additions & 5 deletions src/Ext/SWType/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ class SWTypeExt
Valueable<bool> SW_Next_IgnoreDesignators;
ValueableVector<float> SW_Next_RollChances;

Valueable<int> ShowTimer_Priority;
Valueable<int> ShowTimer_Priority;

Valueable<int> LaunchTheme;

Valueable<WarheadTypeClass*> Detonate_Warhead;
Valueable<WeaponTypeClass*> Detonate_Weapon;
Expand Down Expand Up @@ -118,10 +120,11 @@ class SWTypeExt
, SW_Next_IgnoreInhibitors { false }
, SW_Next_IgnoreDesignators { true }
, SW_Next_RollChances {}
, SW_Next_RandomWeightsData {}
, ShowTimer_Priority { 0 }
, Convert_Pairs {}
, ShowDesignatorRange { true }
, SW_Next_RandomWeightsData {}
, ShowTimer_Priority { 0 }
, LaunchTheme { -1 }
, Convert_Pairs {}
, ShowDesignatorRange { true }
, TabIndex { 1 }
, UseWeeds { false }
, UseWeeds_Amount { RulesClass::Instance->WeedCapacity }
Expand Down
6 changes: 5 additions & 1 deletion src/Ext/SWType/FireSuperWeapon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <BuildingClass.h>
#include <HouseClass.h>
#include <ScenarioClass.h>
#include <ThemeClass.h>

#include <Utilities/EnumFunctions.h>
#include <Utilities/GeneralUtils.h>
Expand All @@ -17,7 +18,10 @@

void SWTypeExt::FireSuperWeaponExt(SuperClass* pSW, const CellStruct& cell)
{
auto const pTypeExt = SWTypeExt::ExtMap.Find(pSW->Type);
auto const pTypeExt = SWTypeExt::ExtMap.Find(pSW->Type);

if(pTypeExt->LaunchTheme >= 0)
ThemeClass::Instance.Play(pTypeExt->LaunchTheme);

if (pTypeExt->LimboDelivery_Types.size() > 0)
pTypeExt->ApplyLimboDelivery(pSW->Owner);
Expand Down