Skip to content

Commit 9c39b18

Browse files
committed
Implement FXList nuggets
1 parent f18391c commit 9c39b18

File tree

2 files changed

+265
-3
lines changed

2 files changed

+265
-3
lines changed

src/game/client/fxlist.cpp

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ static const FieldParse s_theFXListFieldParse[] = {
4747
{ "TerrainScorch", reinterpret_cast<inifieldparse_t>(PICK_ADDRESS(0x004CAC80, 0x00760F20)) /*&TerrainScorchFXNugget::Parse */, nullptr, 0 },
4848
{ "ParticleSystem", reinterpret_cast<inifieldparse_t>(PICK_ADDRESS(0x004CAE10, 0x00761350)) /*&ParticleSystemFXNugget::Parse */, nullptr, 0 },
4949
{ "FXListAtBonePos", reinterpret_cast<inifieldparse_t>(PICK_ADDRESS(0x004CB8E0, 0x00761D00)) /*&FXListAtBonePosFXNugget::Parse */, nullptr, 0 },
50+
#else // DUMMIES
51+
// { "RayEffect", &RayEffectFXNugget::Parse, nullptr, 0 },
52+
{ "Tracer", &TracerFXNugget::Parse, nullptr, 0 },
53+
{ "LightPulse", &LightPulseFXNugget::Parse, nullptr, 0 },
54+
{ "ViewShake", &ViewShakeFXNugget::Parse, nullptr, 0 },
55+
{ "TerrainScorch", &TerrainScorchFXNugget::Parse, nullptr, 0 },
56+
{ "ParticleSystem", &ParticleSystemFXNugget::Parse, nullptr, 0 },
5057
#endif
5158
{ nullptr, nullptr, nullptr, 0 },
5259
};
@@ -132,3 +139,134 @@ void SoundFXNugget::Parse(INI *ini, void *formal, void *, const void *)
132139
ini->Init_From_INI(nugget, _fieldParse);
133140
reinterpret_cast<FXList *>(formal)->Add_FXNugget(nugget);
134141
}
142+
143+
void TracerFXNugget::Do_FX_Pos(
144+
const Coord3D *primary, const Matrix3D *primary_mtx, float primary_speed, const Coord3D *secondary, float radius) const
145+
{
146+
captainslog_dbgassert(false, "TracerFXNugget::Do_FX_Pos not implemented!");
147+
}
148+
149+
void TracerFXNugget::Do_FX_Obj(const Object *primary, const Object *secondary) const
150+
{
151+
captainslog_dbgassert(false, "TracerFXNugget::Do_FX_Obj not implemented!");
152+
}
153+
154+
void TracerFXNugget::Parse(INI *ini, void *formal, void *, const void *)
155+
{
156+
static const FieldParse _fieldParse[] = {
157+
{ "DecayAt", &INI::Parse_Int, nullptr, offsetof(TracerFXNugget, m_decayAt) },
158+
{ "Length", &INI::Parse_Int, nullptr, offsetof(TracerFXNugget, m_length) },
159+
{ "Width", &INI::Parse_Real, nullptr, offsetof(TracerFXNugget, m_width) },
160+
{ "Color", &INI::Parse_RGB_Color, nullptr, offsetof(TracerFXNugget, m_color) },
161+
{ "Speed", &INI::Parse_Int, nullptr, offsetof(TracerFXNugget, speed) },
162+
{ "Probability", &INI::Parse_Real, nullptr, offsetof(TracerFXNugget, probability) },
163+
{ nullptr, nullptr, nullptr, 0 },
164+
};
165+
166+
TracerFXNugget *nugget = new TracerFXNugget{};
167+
ini->Init_From_INI(nugget, _fieldParse);
168+
reinterpret_cast<FXList *>(formal)->Add_FXNugget(nugget);
169+
}
170+
171+
void LightPulseFXNugget::Do_FX_Pos(
172+
const Coord3D *primary, const Matrix3D *primary_mtx, float primary_speed, const Coord3D *secondary, float radius) const
173+
{
174+
captainslog_dbgassert(false, "LightPulseFXNugget::Do_FX_Pos not implemented!");
175+
}
176+
177+
void LightPulseFXNugget::Do_FX_Obj(const Object *primary, const Object *secondary) const
178+
{
179+
captainslog_dbgassert(false, "LightPulseFXNugget::Do_FX_Obj not implemented!");
180+
}
181+
182+
void LightPulseFXNugget::Parse(INI *ini, void *formal, void *, const void *)
183+
{
184+
static const FieldParse _fieldParse[] = {
185+
{ "Color", &INI::Parse_RGB_Color, nullptr, offsetof(LightPulseFXNugget, m_color) },
186+
{ "Radius", &INI::Parse_Int, nullptr, offsetof(LightPulseFXNugget, m_radius) },
187+
{ "IncreaseTime", &INI::Parse_Int, nullptr, offsetof(LightPulseFXNugget, m_increaseTime) },
188+
{ "DecreaseTime", &INI::Parse_Int, nullptr, offsetof(LightPulseFXNugget, m_decreaseTime) },
189+
{ nullptr, nullptr, nullptr, 0 },
190+
};
191+
192+
LightPulseFXNugget *nugget = new LightPulseFXNugget{};
193+
ini->Init_From_INI(nugget, _fieldParse);
194+
reinterpret_cast<FXList *>(formal)->Add_FXNugget(nugget);
195+
}
196+
197+
void ViewShakeFXNugget::Do_FX_Pos(
198+
const Coord3D *primary, const Matrix3D *primary_mtx, float primary_speed, const Coord3D *secondary, float radius) const
199+
{
200+
captainslog_dbgassert(false, "ViewShakeFXNugget::Do_FX_Pos not implemented!");
201+
}
202+
203+
void ViewShakeFXNugget::Do_FX_Obj(const Object *primary, const Object *secondary) const
204+
{
205+
captainslog_dbgassert(false, "ViewShakeFXNugget::Do_FX_Obj not implemented!");
206+
}
207+
208+
void ViewShakeFXNugget::Parse(INI *ini, void *formal, void *, const void *)
209+
{
210+
static const FieldParse _fieldParse[] = {
211+
{ "Type", &INI::Parse_Index_List, g_shakeIntensityNames, offsetof(ViewShakeFXNugget, m_type) },
212+
{ nullptr, nullptr, nullptr, 0 },
213+
};
214+
215+
ViewShakeFXNugget *nugget = new ViewShakeFXNugget{};
216+
ini->Init_From_INI(nugget, _fieldParse);
217+
reinterpret_cast<FXList *>(formal)->Add_FXNugget(nugget);
218+
}
219+
220+
void TerrainScorchFXNugget::Do_FX_Pos(
221+
const Coord3D *primary, const Matrix3D *primary_mtx, float primary_speed, const Coord3D *secondary, float radius) const
222+
{
223+
captainslog_dbgassert(false, "TerrainScorchFXNugget::Do_FX_Pos not implemented!");
224+
}
225+
226+
void TerrainScorchFXNugget::Do_FX_Obj(const Object *primary, const Object *secondary) const
227+
{
228+
captainslog_dbgassert(false, "TerrainScorchFXNugget::Do_FX_Obj not implemented!");
229+
}
230+
231+
void TerrainScorchFXNugget::Parse(INI *ini, void *formal, void *, const void *)
232+
{
233+
static const FieldParse _fieldParse[] = {
234+
{ "Type", &INI::Parse_AsciiString, nullptr, offsetof(TerrainScorchFXNugget, m_type) },
235+
{ "Radius", &INI::Parse_Int, nullptr, offsetof(TerrainScorchFXNugget, m_radius) },
236+
{ nullptr, nullptr, nullptr, 0 },
237+
};
238+
239+
TerrainScorchFXNugget *nugget = new TerrainScorchFXNugget{};
240+
ini->Init_From_INI(nugget, _fieldParse);
241+
reinterpret_cast<FXList *>(formal)->Add_FXNugget(nugget);
242+
}
243+
244+
void ParticleSystemFXNugget::Do_FX_Pos(
245+
const Coord3D *primary, const Matrix3D *primary_mtx, float primary_speed, const Coord3D *secondary, float radius) const
246+
{
247+
captainslog_dbgassert(false, "ParticleSystemFXNugget::Do_FX_Pos not implemented!");
248+
}
249+
250+
void ParticleSystemFXNugget::Do_FX_Obj(const Object *primary, const Object *secondary) const
251+
{
252+
captainslog_dbgassert(false, "ParticleSystemFXNugget::Do_FX_Obj not implemented!");
253+
}
254+
255+
void ParticleSystemFXNugget::Parse(INI *ini, void *formal, void *, const void *)
256+
{
257+
static const FieldParse _fieldParse[] = {
258+
{ "Name", &INI::Parse_AsciiString, nullptr, offsetof(ParticleSystemFXNugget, m_sysName) },
259+
{ "InitialDelay", &GameClientRandomVariable::Parse, nullptr, offsetof(ParticleSystemFXNugget, m_initialDelay) },
260+
{ "Offset", &INI::Parse_Coord3D, nullptr, offsetof(ParticleSystemFXNugget, m_offset) },
261+
{ "Height", &GameClientRandomVariable::Parse, nullptr, offsetof(ParticleSystemFXNugget, m_height) },
262+
{ "OrientToObject", &INI::Parse_Bool, nullptr, offsetof(ParticleSystemFXNugget, m_orientToObject) },
263+
{ "Ricochet", &INI::Parse_Bool, nullptr, offsetof(ParticleSystemFXNugget, m_ricochet) },
264+
{ "CreateAtGroundHeight", &INI::Parse_Bool, nullptr, offsetof(ParticleSystemFXNugget, m_createAtGroundHeight) },
265+
{ "UseCallersRadius", &INI::Parse_Bool, nullptr, offsetof(ParticleSystemFXNugget, m_useCallersRadius) },
266+
{ nullptr, nullptr, nullptr, 0 },
267+
};
268+
269+
ParticleSystemFXNugget *nugget = new ParticleSystemFXNugget{};
270+
ini->Init_From_INI(nugget, _fieldParse);
271+
reinterpret_cast<FXList *>(formal)->Add_FXNugget(nugget);
272+
}

src/game/client/fxlist.h

Lines changed: 127 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
#pragma once
1616

1717
#include "always.h"
18+
#include "color.h"
19+
#include "coord.h"
1820
#include "namekeygenerator.h"
21+
#include "randomvalue.h"
1922
#include "rtsutils.h"
2023
#include "subsysteminterface.h"
2124
#include <list>
@@ -36,7 +39,7 @@ class FXNugget : public MemoryPoolObject
3639
IMPLEMENT_ABSTRACT_POOL(FXNugget);
3740

3841
public:
39-
virtual ~FXNugget(){};
42+
virtual ~FXNugget() {};
4043
virtual void Do_FX_Pos(const Coord3D *primary,
4144
const Matrix3D *primary_mtx,
4245
float primary_speed,
@@ -103,8 +106,8 @@ class SoundFXNugget : public FXNugget
103106
IMPLEMENT_POOL(SoundFXNugget);
104107

105108
public:
106-
SoundFXNugget(){};
107-
virtual ~SoundFXNugget() override{};
109+
SoundFXNugget() {};
110+
virtual ~SoundFXNugget() override {};
108111

109112
virtual void Do_FX_Pos(const Coord3D *primary,
110113
const Matrix3D *primary_mtx,
@@ -118,3 +121,124 @@ class SoundFXNugget : public FXNugget
118121
private:
119122
Utf8String m_soundName;
120123
};
124+
125+
class TracerFXNugget : public FXNugget
126+
{
127+
IMPLEMENT_POOL(TracerFXNugget);
128+
129+
public:
130+
TracerFXNugget() {};
131+
virtual ~TracerFXNugget() override {};
132+
133+
virtual void Do_FX_Pos(const Coord3D *primary,
134+
const Matrix3D *primary_mtx,
135+
float primary_speed,
136+
const Coord3D *secondary,
137+
float radius) const override;
138+
virtual void Do_FX_Obj(const Object *primary, const Object *secondary) const override;
139+
140+
static void Parse(INI *ini, void *formal, void *, const void *);
141+
142+
private:
143+
int m_decayAt;
144+
int m_length;
145+
float m_width;
146+
RGBColor m_color;
147+
int speed;
148+
float probability;
149+
};
150+
151+
class LightPulseFXNugget : public FXNugget
152+
{
153+
IMPLEMENT_POOL(LightPulseFXNugget);
154+
155+
public:
156+
LightPulseFXNugget() {};
157+
virtual ~LightPulseFXNugget() override {};
158+
159+
virtual void Do_FX_Pos(const Coord3D *primary,
160+
const Matrix3D *primary_mtx,
161+
float primary_speed,
162+
const Coord3D *secondary,
163+
float radius) const override;
164+
virtual void Do_FX_Obj(const Object *primary, const Object *secondary) const override;
165+
166+
static void Parse(INI *ini, void *formal, void *, const void *);
167+
168+
private:
169+
RGBColor m_color;
170+
int m_radius;
171+
int m_increaseTime;
172+
int m_decreaseTime;
173+
};
174+
175+
class ViewShakeFXNugget : public FXNugget
176+
{
177+
IMPLEMENT_POOL(ViewShakeFXNugget);
178+
179+
public:
180+
ViewShakeFXNugget() {};
181+
virtual ~ViewShakeFXNugget() override {};
182+
183+
virtual void Do_FX_Pos(const Coord3D *primary,
184+
const Matrix3D *primary_mtx,
185+
float primary_speed,
186+
const Coord3D *secondary,
187+
float radius) const override;
188+
virtual void Do_FX_Obj(const Object *primary, const Object *secondary) const override;
189+
190+
static void Parse(INI *ini, void *formal, void *, const void *);
191+
192+
private:
193+
ShakeIntensities m_type;
194+
};
195+
196+
class TerrainScorchFXNugget : public FXNugget
197+
{
198+
IMPLEMENT_POOL(TerrainScorchFXNugget);
199+
200+
public:
201+
TerrainScorchFXNugget() {};
202+
virtual ~TerrainScorchFXNugget() override {};
203+
204+
virtual void Do_FX_Pos(const Coord3D *primary,
205+
const Matrix3D *primary_mtx,
206+
float primary_speed,
207+
const Coord3D *secondary,
208+
float radius) const override;
209+
virtual void Do_FX_Obj(const Object *primary, const Object *secondary) const override;
210+
211+
static void Parse(INI *ini, void *formal, void *, const void *);
212+
213+
private:
214+
Utf8String m_type;
215+
int m_radius;
216+
};
217+
218+
class ParticleSystemFXNugget : public FXNugget
219+
{
220+
IMPLEMENT_POOL(ParticleSystemFXNugget);
221+
222+
public:
223+
ParticleSystemFXNugget() {};
224+
virtual ~ParticleSystemFXNugget() override {};
225+
226+
virtual void Do_FX_Pos(const Coord3D *primary,
227+
const Matrix3D *primary_mtx,
228+
float primary_speed,
229+
const Coord3D *secondary,
230+
float radius) const override;
231+
virtual void Do_FX_Obj(const Object *primary, const Object *secondary) const override;
232+
233+
static void Parse(INI *ini, void *formal, void *, const void *);
234+
235+
private:
236+
Utf8String m_sysName;
237+
GameClientRandomVariable m_initialDelay;
238+
Coord3D m_offset;
239+
GameClientRandomVariable m_height;
240+
bool m_orientToObject;
241+
bool m_ricochet;
242+
bool m_createAtGroundHeight;
243+
bool m_useCallersRadius;
244+
};

0 commit comments

Comments
 (0)