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
1 change: 1 addition & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ This page lists all the individual contributions to the project by their author.
- **Joshy** - Original FlyingStrings implementation
- **CnCVK** - Original custom locomotors experiment
- **ZΞPHYɌUS** - win/lose themes code
- **Codex** - SuperWeapon theme playback feature
- **Neargye (Daniil Goncharov)** - [nameof library](https://github.com/Neargye/nameof) (MIT)
- **ayylmao** - help with docs, extensive and thorough testing
- **SMxReaver** - help with docs, extensive and thorough testing
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 @@ -1032,6 +1032,16 @@ In `rulesmd.ini`:
TabIndex=1 ; integer
```

### SuperWeapon theme playback

- `PlayTheme` can be used to specify a soundtrack theme that will start playing when the Super Weapon is fired.

In `rulesmd.ini`:
```ini
[SOMESW] ; SuperWeaponType
PlayTheme= ; 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
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ New:
- Custom `SlavesFreeSound` (by TwinkleStar)
- Allows jumpjet to crash without rotation (by TwinkleStar)
- Customizable priority of superweapons timer sorting(by ststl)
- SuperWeapon theme playback on firing (by Codex)
- Customizable aircraft spawner spawn delay (by Starkku)
- Customizable `Cluster` scatter distance (by Starkku)
- Customizable `FlakScatter` distance (by Starkku)
Expand Down
16 changes: 9 additions & 7 deletions src/Ext/SWType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ 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->ShowDesignatorRange)
.Process(this->TabIndex)
.Process(this->SW_Next_RandomWeightsData)
.Process(this->SW_Next_RollChances)
.Process(this->ShowTimer_Priority)
.Process(this->PlayTheme)
.Process(this->Convert_Pairs)
.Process(this->ShowDesignatorRange)
.Process(this->TabIndex)
.Process(this->UseWeeds)
.Process(this->UseWeeds_Amount)
.Process(this->UseWeeds_StorageTimer)
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->PlayTheme = pINI->ReadTheme(pSection, "PlayTheme", this->PlayTheme);

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

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

Valueable<WarheadTypeClass*> Detonate_Warhead;
Valueable<WeaponTypeClass*> Detonate_Weapon;
Expand Down Expand Up @@ -119,7 +120,8 @@ class SWTypeExt
, SW_Next_IgnoreDesignators { true }
, SW_Next_RollChances {}
, SW_Next_RandomWeightsData {}
, ShowTimer_Priority { 0 }
, ShowTimer_Priority { 0 }
, PlayTheme { -1 }
, Convert_Pairs {}
, ShowDesignatorRange { true }
, TabIndex { 1 }
Expand Down
8 changes: 6 additions & 2 deletions 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 Down Expand Up @@ -34,8 +35,11 @@ void SWTypeExt::FireSuperWeaponExt(SuperClass* pSW, const CellStruct& cell)
if (pTypeExt->Convert_Pairs.size() > 0)
pTypeExt->ApplyTypeConversion(pSW);

if (static_cast<int>(pSW->Type->Type) == 28 && !pTypeExt->EMPulse_TargetSelf) // Ares' Type=EMPulse SW
pTypeExt->HandleEMPulseLaunch(pSW, cell);
if (static_cast<int>(pSW->Type->Type) == 28 && !pTypeExt->EMPulse_TargetSelf) // Ares' Type=EMPulse SW
pTypeExt->HandleEMPulseLaunch(pSW, cell);

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

auto& sw_ext = HouseExt::ExtMap.Find(pSW->Owner)->SuperExts[pSW->Type->ArrayIndex];
sw_ext.ShotCount++;
Expand Down