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 @@ -436,6 +436,7 @@ This page lists all the individual contributions to the project by their author.
- Fix the bug that `IsLocomotor=yes` warhead rendering hover units unselectable and undamageable on elevated bridge
- Fix the bug that Locomotor warhead won't stop working when firer (except for vehicle) stop firing
- Fix the bug that hover vehicle will sink if destroyed on bridge
- Spawns particle when spawns tiberium by terrain
- **Apollo** - Translucent SHP drawing patches
- **ststl**:
- Customizable `ShowTimer` priority of superweapons
Expand Down
1 change: 1 addition & 0 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -1518,6 +1518,7 @@ SpawnsTiberium.Type=0 ; tiberium/ore type index
SpawnsTiberium.Range=1 ; integer, radius in cells
SpawnsTiberium.GrowthStage=3 ; integer - single or comma-sep. range
SpawnsTiberium.CellsPerAnim=1 ; integer - single or comma-sep. range
SpawnsTiberium.Particle= ; particle
```

### Damaged frames and crumbling animation
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ New:
- [Additional attached animation position customizations](Fixed-or-Improved-Logics.md#attached-animation-position-customization) (by Starkku)
- Use `SkipCrushSlowdown=true` to avoid the bug related to `Accelerates=true` and `MovementZone=CrushAll` (by TaranDahl)
- Units can customize the attack voice that plays when using more weapons (by FlyStar)
- Spawns particle when spawns tiberium by terrain (by NetsuNegi)

Vanilla fixes:
- Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya)
Expand Down
5 changes: 3 additions & 2 deletions src/Ext/Techno/Hooks.WeaponEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,11 @@ DEFINE_HOOK(0x62B8BC, ParticleClass_CTOR_CoordAdjust, 0x6)
enum { SkipCoordAdjust = 0x62B8CB };

GET(ParticleClass*, pThis, ESI);
const auto pParticleSys = pThis->ParticleSystem;

if (pThis->ParticleSystem)
if (pParticleSys && pParticleSys->Type)
{
const auto behavesLike = pThis->ParticleSystem->Type->BehavesLike;
const auto behavesLike = pParticleSys->Type->BehavesLike;

if (behavesLike == BehavesLike::Railgun || behavesLike == BehavesLike::Fire)
return SkipCoordAdjust;
Expand Down
2 changes: 2 additions & 0 deletions src/Ext/TerrainType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ void TerrainTypeExt::ExtData::Serialize(T& Stm)
.Process(this->SpawnsTiberium_Range)
.Process(this->SpawnsTiberium_GrowthStage)
.Process(this->SpawnsTiberium_CellsPerAnim)
.Process(this->SpawnsTiberium_Particle)
.Process(this->DestroyAnim)
.Process(this->DestroySound)
.Process(this->MinimapColor)
Expand All @@ -73,6 +74,7 @@ void TerrainTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
this->SpawnsTiberium_Range.Read(exINI, pSection, "SpawnsTiberium.Range");
this->SpawnsTiberium_GrowthStage.Read(exINI, pSection, "SpawnsTiberium.GrowthStage");
this->SpawnsTiberium_CellsPerAnim.Read(exINI, pSection, "SpawnsTiberium.CellsPerAnim");
this->SpawnsTiberium_Particle.Read(exINI, pSection, "SpawnsTiberium.Particle");

this->DestroyAnim.Read(exINI, pSection, "DestroyAnim");
this->DestroySound.Read(exINI, pSection, "DestroySound");
Expand Down
2 changes: 2 additions & 0 deletions src/Ext/TerrainType/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class TerrainTypeExt
Valueable<int> SpawnsTiberium_Range;
Valueable<PartialVector2D<int>> SpawnsTiberium_GrowthStage;
Valueable<PartialVector2D<int>> SpawnsTiberium_CellsPerAnim;
ValueableIdx<ParticleTypeClass> SpawnsTiberium_Particle;
Valueable<AnimTypeClass*> DestroyAnim;
ValueableIdx<VocClass> DestroySound;
Nullable<ColorStruct> MinimapColor;
Expand All @@ -39,6 +40,7 @@ class TerrainTypeExt
, SpawnsTiberium_Range { 1 }
, SpawnsTiberium_GrowthStage { { 3, 0 } }
, SpawnsTiberium_CellsPerAnim { { 1, 0 } }
, SpawnsTiberium_Particle { -1 }
, DestroyAnim {}
, DestroySound {}
, MinimapColor {}
Expand Down
9 changes: 9 additions & 0 deletions src/Ext/TerrainType/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <TacticalClass.h>
#include <TiberiumClass.h>
#include <TerrainClass.h>
#include <ParticleSystemClass.h>

#include <Ext/Rules/Body.h>
#include <Utilities/GeneralUtils.h>
Expand Down Expand Up @@ -47,6 +48,14 @@ DEFINE_HOOK(0x71C84D, TerrainClass_AI_Animated, 0x6)
for (int i = 0; i < cellCount; i++)
pCell->SpreadTiberium(true);

const int particleIdx = pTypeExt->SpawnsTiberium_Particle;

if (particleIdx >= 0)
{
const auto particleSys = reinterpret_cast<ParticleSystemClass*>(0xA8ED78);
reinterpret_cast<ParticleClass*(__thiscall*)(void*, ParticleTypeClass*, const CoordStruct&)>(0x62E430)(particleSys, ParticleTypeClass::Array[particleIdx], pThis->Location);
Comment on lines +55 to +56
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reference and function definition should be added in YRpp instead of doing it like this.

}

// Unset context for CellClass hooks.
TerrainTypeTemp::pCurrentType = nullptr;
TerrainTypeTemp::pCurrentExt = nullptr;
Expand Down
1 change: 1 addition & 0 deletions src/Utilities/TemplateDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include <Powerups.h>
#include <VocClass.h>
#include <VoxClass.h>
#include <ParticleTypeClass.h>
#include <CRT.h>
#include <LocomotionClass.h>
#include <Locomotion/TestLocomotionClass.h>
Expand Down
Loading