Skip to content

Commit

Permalink
Implement FXList nuggets
Browse files Browse the repository at this point in the history
  • Loading branch information
feliwir committed Sep 13, 2024
1 parent f18391c commit 813e4de
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 3 deletions.
28 changes: 28 additions & 0 deletions src/game/client/fxlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ static const FieldParse s_theFXListFieldParse[] = {
{ "TerrainScorch", reinterpret_cast<inifieldparse_t>(PICK_ADDRESS(0x004CAC80, 0x00760F20)) /*&TerrainScorchFXNugget::Parse */, nullptr, 0 },
{ "ParticleSystem", reinterpret_cast<inifieldparse_t>(PICK_ADDRESS(0x004CAE10, 0x00761350)) /*&ParticleSystemFXNugget::Parse */, nullptr, 0 },
{ "FXListAtBonePos", reinterpret_cast<inifieldparse_t>(PICK_ADDRESS(0x004CB8E0, 0x00761D00)) /*&FXListAtBonePosFXNugget::Parse */, nullptr, 0 },
#else
{ "ParticleSystem", &ParticleSystemFXNugget::Parse, nullptr, 0 },
#endif
{ nullptr, nullptr, nullptr, 0 },
};
Expand Down Expand Up @@ -132,3 +134,29 @@ void SoundFXNugget::Parse(INI *ini, void *formal, void *, const void *)
ini->Init_From_INI(nugget, _fieldParse);
reinterpret_cast<FXList *>(formal)->Add_FXNugget(nugget);
}

void ParticleSystemFXNugget::Do_FX_Pos(
const Coord3D *primary, const Matrix3D *primary_mtx, float primary_speed, const Coord3D *secondary, float radius) const
{
captainslog_dbgassert(false, "ParticleSystemFXNugget::Do_FX_Pos not implemented!");
}

void ParticleSystemFXNugget::Do_FX_Obj(const Object *primary, const Object *secondary) const
{
captainslog_dbgassert(false, "ParticleSystemFXNugget::Do_FX_Obj not implemented!");
}

void ParticleSystemFXNugget::Parse(INI *ini, void *formal, void *, const void *)
{
static const FieldParse _fieldParse[] = {
{ "Name", INI::Parse_AsciiString, nullptr, offsetof(ParticleSystemFXNugget, m_sysName) },
{ "Height", &GameClientRandomVariable::Parse, nullptr, offsetof(ParticleSystemFXNugget, m_height) },
{ "OrientToObject", INI::Parse_Bool, nullptr, offsetof(ParticleSystemFXNugget, m_orientToObject) },
{ "Ricochet", INI::Parse_Bool, nullptr, offsetof(ParticleSystemFXNugget, m_ricochet) },
{ nullptr, nullptr, nullptr, 0 },
};

ParticleSystemFXNugget *nugget = new ParticleSystemFXNugget{};
ini->Init_From_INI(nugget, _fieldParse);
reinterpret_cast<FXList *>(formal)->Add_FXNugget(nugget);
}
56 changes: 53 additions & 3 deletions src/game/client/fxlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
#pragma once

#include "always.h"
#include "color.h"
#include "namekeygenerator.h"
#include "randomvalue.h"
#include "rtsutils.h"
#include "subsysteminterface.h"
#include <list>
Expand All @@ -36,7 +38,7 @@ class FXNugget : public MemoryPoolObject
IMPLEMENT_ABSTRACT_POOL(FXNugget);

public:
virtual ~FXNugget(){};
virtual ~FXNugget() {};
virtual void Do_FX_Pos(const Coord3D *primary,
const Matrix3D *primary_mtx,
float primary_speed,
Expand Down Expand Up @@ -103,8 +105,8 @@ class SoundFXNugget : public FXNugget
IMPLEMENT_POOL(SoundFXNugget);

public:
SoundFXNugget(){};
virtual ~SoundFXNugget() override{};
SoundFXNugget() {};
virtual ~SoundFXNugget() override {};

virtual void Do_FX_Pos(const Coord3D *primary,
const Matrix3D *primary_mtx,
Expand All @@ -118,3 +120,51 @@ class SoundFXNugget : public FXNugget
private:
Utf8String m_soundName;
};

class LightPulseFXNugget : public FXNugget
{
IMPLEMENT_POOL(LightPulseFXNugget);

public:
LightPulseFXNugget() {};
virtual ~LightPulseFXNugget() override {};

virtual void Do_FX_Pos(const Coord3D *primary,
const Matrix3D *primary_mtx,
float primary_speed,
const Coord3D *secondary,
float radius) const override;
virtual void Do_FX_Obj(const Object *primary, const Object *secondary) const override;

static void Parse(INI *ini, void *formal, void *, const void *);

private:
RGBColor m_color;
int m_radius;
int m_increaseTime;
int m_decreaseTime;
};

class ParticleSystemFXNugget : public FXNugget
{
IMPLEMENT_POOL(ParticleSystemFXNugget);

public:
ParticleSystemFXNugget() {};
virtual ~ParticleSystemFXNugget() override {};

virtual void Do_FX_Pos(const Coord3D *primary,
const Matrix3D *primary_mtx,
float primary_speed,
const Coord3D *secondary,
float radius) const override;
virtual void Do_FX_Obj(const Object *primary, const Object *secondary) const override;

static void Parse(INI *ini, void *formal, void *, const void *);

private:
Utf8String m_sysName;
GameClientRandomVariable m_height;
bool m_orientToObject;
bool m_ricochet;
};

0 comments on commit 813e4de

Please sign in to comment.