Skip to content

Commit

Permalink
Implements NaturalParticleSystem2 and NaturalParticleSystem3 for Tech…
Browse files Browse the repository at this point in the history
…noTypes.
  • Loading branch information
CCHyper committed Apr 6, 2022
1 parent 2e757b1 commit e882f1a
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/extensions/techno/technoext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ TechnoClassExtension::TechnoClassExtension(TechnoClass *this_ptr) :
//EXT_DEBUG_TRACE("TechnoClassExtension constructor - Name: %s (0x%08X)\n", ThisPtr->Name(), (uintptr_t)(ThisPtr));
//EXT_DEBUG_WARNING("TechnoClassExtension constructor - Name: %s (0x%08X)\n", ThisPtr->Name(), (uintptr_t)(ThisPtr));

for (int index = 0; index < EXT_ATTACHED_PARTICLE_COUNT; ++index) {
ParticleSystems[index] = nullptr;
}

IsInitialized = true;
}

Expand Down Expand Up @@ -110,6 +114,10 @@ HRESULT TechnoClassExtension::Load(IStream *pStm)
new (this) TechnoClassExtension(NoInitClass());

ElectricBolt = nullptr;

for (int index = 0; index < EXT_ATTACHED_PARTICLE_COUNT; ++index) {
SWIZZLE_REQUEST_POINTER_REMAP(ParticleSystems[index]);
}

return hr;
}
Expand Down Expand Up @@ -378,4 +386,36 @@ void TechnoClassExtension::Spawn_Natural_Particle_System()
technotype->NaturalParticleSystem, where, &Map[ThisPtr->Get_Coord()]
);
}

/**
* Spawn NaturalParticleSystem2.
*/
if (!ParticleSystems[ATTACHED_PARTICLE_NATURAL2] && technotypeext->NaturalParticleSystem2) {

where = ThisPtr->Get_Coord();

where.X += technotypeext->NaturalParticleSystemLocation2.X;
where.Y += technotypeext->NaturalParticleSystemLocation2.Y;
where.Z += technotypeext->NaturalParticleSystemLocation2.Z;

ParticleSystems[ATTACHED_PARTICLE_NATURAL2] = new ParticleSystemClass(
technotypeext->NaturalParticleSystem2, where, &Map[ThisPtr->Get_Coord()]
);
}

/**
* Spawn NaturalParticleSystem3.
*/
if (!ParticleSystems[ATTACHED_PARTICLE_NATURAL3] && technotypeext->NaturalParticleSystem3) {

where = ThisPtr->Get_Coord();

where.X += technotypeext->NaturalParticleSystemLocation3.X;
where.Y += technotypeext->NaturalParticleSystemLocation3.Y;
where.Z += technotypeext->NaturalParticleSystemLocation3.Z;

ParticleSystems[ATTACHED_PARTICLE_NATURAL3] = new ParticleSystemClass(
technotypeext->NaturalParticleSystem3, where, &Map[ThisPtr->Get_Coord()]
);
}
}
14 changes: 14 additions & 0 deletions src/extensions/techno/technoext.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,19 @@


class EBoltClass;
class ParticleSystemClass;


class TechnoClassExtension final : public Extension<TechnoClass>
{
private:
enum {
ATTACHED_PARTICLE_NATURAL2,
ATTACHED_PARTICLE_NATURAL3,

EXT_ATTACHED_PARTICLE_COUNT
};

public:
TechnoClassExtension(TechnoClass *this_ptr);
TechnoClassExtension(const NoInitClass &noinit);
Expand Down Expand Up @@ -64,6 +73,11 @@ class TechnoClassExtension final : public Extension<TechnoClass>
* The current electric bolt instance fired by this object.
*/
EBoltClass *ElectricBolt;

/**
* Additional attached particle system trackers for this object.
*/
ParticleSystemClass *ParticleSystems[EXT_ATTACHED_PARTICLE_COUNT];
};


Expand Down

0 comments on commit e882f1a

Please sign in to comment.