Skip to content

Commit 750c4ab

Browse files
committed
Implement FXList nuggets
1 parent f18391c commit 750c4ab

File tree

2 files changed

+327
-3
lines changed

2 files changed

+327
-3
lines changed

src/game/client/fxlist.cpp

+172
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ 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 },
57+
{ "FXListAtBonePos", &FXListAtBonePosFXNugget::Parse, nullptr, 0 },
5058
#endif
5159
{ nullptr, nullptr, nullptr, 0 },
5260
};
@@ -132,3 +140,167 @@ void SoundFXNugget::Parse(INI *ini, void *formal, void *, const void *)
132140
ini->Init_From_INI(nugget, _fieldParse);
133141
reinterpret_cast<FXList *>(formal)->Add_FXNugget(nugget);
134142
}
143+
144+
void TracerFXNugget::Do_FX_Pos(
145+
const Coord3D *primary, const Matrix3D *primary_mtx, float primary_speed, const Coord3D *secondary, float radius) const
146+
{
147+
captainslog_dbgassert(false, "TracerFXNugget::Do_FX_Pos not implemented!");
148+
}
149+
150+
void TracerFXNugget::Do_FX_Obj(const Object *primary, const Object *secondary) const
151+
{
152+
captainslog_dbgassert(false, "TracerFXNugget::Do_FX_Obj not implemented!");
153+
}
154+
155+
void TracerFXNugget::Parse(INI *ini, void *formal, void *, const void *)
156+
{
157+
static const FieldParse _fieldParse[] = {
158+
{ "DecayAt", &INI::Parse_Int, nullptr, offsetof(TracerFXNugget, m_decayAt) },
159+
{ "Length", &INI::Parse_Int, nullptr, offsetof(TracerFXNugget, m_length) },
160+
{ "Width", &INI::Parse_Real, nullptr, offsetof(TracerFXNugget, m_width) },
161+
{ "Color", &INI::Parse_RGB_Color, nullptr, offsetof(TracerFXNugget, m_color) },
162+
{ "Speed", &INI::Parse_Int, nullptr, offsetof(TracerFXNugget, speed) },
163+
{ "Probability", &INI::Parse_Real, nullptr, offsetof(TracerFXNugget, probability) },
164+
{ nullptr, nullptr, nullptr, 0 },
165+
};
166+
167+
TracerFXNugget *nugget = new TracerFXNugget{};
168+
ini->Init_From_INI(nugget, _fieldParse);
169+
reinterpret_cast<FXList *>(formal)->Add_FXNugget(nugget);
170+
}
171+
172+
void LightPulseFXNugget::Do_FX_Pos(
173+
const Coord3D *primary, const Matrix3D *primary_mtx, float primary_speed, const Coord3D *secondary, float radius) const
174+
{
175+
captainslog_dbgassert(false, "LightPulseFXNugget::Do_FX_Pos not implemented!");
176+
}
177+
178+
void LightPulseFXNugget::Do_FX_Obj(const Object *primary, const Object *secondary) const
179+
{
180+
captainslog_dbgassert(false, "LightPulseFXNugget::Do_FX_Obj not implemented!");
181+
}
182+
183+
void LightPulseFXNugget::Parse(INI *ini, void *formal, void *, const void *)
184+
{
185+
static const FieldParse _fieldParse[] = {
186+
{ "Color", &INI::Parse_RGB_Color, nullptr, offsetof(LightPulseFXNugget, m_color) },
187+
{ "Radius", &INI::Parse_Int, nullptr, offsetof(LightPulseFXNugget, m_radius) },
188+
{ "RadiusAsPercentOfObjectSize",
189+
&INI::Parse_Percent_To_Real,
190+
nullptr,
191+
offsetof(LightPulseFXNugget, m_radiusAsPercentOfObjectSize) },
192+
{ "IncreaseTime", &INI::Parse_Int, nullptr, offsetof(LightPulseFXNugget, m_increaseTime) },
193+
{ "DecreaseTime", &INI::Parse_Int, nullptr, offsetof(LightPulseFXNugget, m_decreaseTime) },
194+
{ nullptr, nullptr, nullptr, 0 },
195+
};
196+
197+
LightPulseFXNugget *nugget = new LightPulseFXNugget{};
198+
ini->Init_From_INI(nugget, _fieldParse);
199+
reinterpret_cast<FXList *>(formal)->Add_FXNugget(nugget);
200+
}
201+
202+
void ViewShakeFXNugget::Do_FX_Pos(
203+
const Coord3D *primary, const Matrix3D *primary_mtx, float primary_speed, const Coord3D *secondary, float radius) const
204+
{
205+
captainslog_dbgassert(false, "ViewShakeFXNugget::Do_FX_Pos not implemented!");
206+
}
207+
208+
void ViewShakeFXNugget::Do_FX_Obj(const Object *primary, const Object *secondary) const
209+
{
210+
captainslog_dbgassert(false, "ViewShakeFXNugget::Do_FX_Obj not implemented!");
211+
}
212+
213+
void ViewShakeFXNugget::Parse(INI *ini, void *formal, void *, const void *)
214+
{
215+
static const FieldParse _fieldParse[] = {
216+
{ "Type", &INI::Parse_Index_List, g_shakeIntensityNames, offsetof(ViewShakeFXNugget, m_type) },
217+
{ nullptr, nullptr, nullptr, 0 },
218+
};
219+
220+
ViewShakeFXNugget *nugget = new ViewShakeFXNugget{};
221+
ini->Init_From_INI(nugget, _fieldParse);
222+
reinterpret_cast<FXList *>(formal)->Add_FXNugget(nugget);
223+
}
224+
225+
void TerrainScorchFXNugget::Do_FX_Pos(
226+
const Coord3D *primary, const Matrix3D *primary_mtx, float primary_speed, const Coord3D *secondary, float radius) const
227+
{
228+
captainslog_dbgassert(false, "TerrainScorchFXNugget::Do_FX_Pos not implemented!");
229+
}
230+
231+
void TerrainScorchFXNugget::Do_FX_Obj(const Object *primary, const Object *secondary) const
232+
{
233+
captainslog_dbgassert(false, "TerrainScorchFXNugget::Do_FX_Obj not implemented!");
234+
}
235+
236+
void TerrainScorchFXNugget::Parse(INI *ini, void *formal, void *, const void *)
237+
{
238+
static const FieldParse _fieldParse[] = {
239+
{ "Type", &INI::Parse_AsciiString, nullptr, offsetof(TerrainScorchFXNugget, m_type) },
240+
{ "Radius", &INI::Parse_Int, nullptr, offsetof(TerrainScorchFXNugget, m_radius) },
241+
{ nullptr, nullptr, nullptr, 0 },
242+
};
243+
244+
TerrainScorchFXNugget *nugget = new TerrainScorchFXNugget{};
245+
ini->Init_From_INI(nugget, _fieldParse);
246+
reinterpret_cast<FXList *>(formal)->Add_FXNugget(nugget);
247+
}
248+
249+
void ParticleSystemFXNugget::Do_FX_Pos(
250+
const Coord3D *primary, const Matrix3D *primary_mtx, float primary_speed, const Coord3D *secondary, float radius) const
251+
{
252+
captainslog_dbgassert(false, "ParticleSystemFXNugget::Do_FX_Pos not implemented!");
253+
}
254+
255+
void ParticleSystemFXNugget::Do_FX_Obj(const Object *primary, const Object *secondary) const
256+
{
257+
captainslog_dbgassert(false, "ParticleSystemFXNugget::Do_FX_Obj not implemented!");
258+
}
259+
260+
void ParticleSystemFXNugget::Parse(INI *ini, void *formal, void *, const void *)
261+
{
262+
static const FieldParse _fieldParse[] = {
263+
{ "Name", &INI::Parse_AsciiString, nullptr, offsetof(ParticleSystemFXNugget, m_sysName) },
264+
{ "Count", &INI::Parse_Int, nullptr, offsetof(ParticleSystemFXNugget, m_count) },
265+
{ "Radius", &GameClientRandomVariable::Parse, nullptr, offsetof(ParticleSystemFXNugget, m_radius) },
266+
{ "InitialDelay", &GameClientRandomVariable::Parse, nullptr, offsetof(ParticleSystemFXNugget, m_initialDelay) },
267+
{ "AttachToObject", &INI::Parse_Bool, nullptr, offsetof(ParticleSystemFXNugget, m_attachToObject) },
268+
{ "Offset", &INI::Parse_Coord3D, nullptr, offsetof(ParticleSystemFXNugget, m_offset) },
269+
{ "Height", &GameClientRandomVariable::Parse, nullptr, offsetof(ParticleSystemFXNugget, m_height) },
270+
{ "OrientToObject", &INI::Parse_Bool, nullptr, offsetof(ParticleSystemFXNugget, m_orientToObject) },
271+
{ "RotateY", &INI::Parse_Angle_Real, nullptr, offsetof(ParticleSystemFXNugget, m_rotateY) },
272+
{ "Ricochet", &INI::Parse_Bool, nullptr, offsetof(ParticleSystemFXNugget, m_ricochet) },
273+
{ "CreateAtGroundHeight", &INI::Parse_Bool, nullptr, offsetof(ParticleSystemFXNugget, m_createAtGroundHeight) },
274+
{ "UseCallersRadius", &INI::Parse_Bool, nullptr, offsetof(ParticleSystemFXNugget, m_useCallersRadius) },
275+
{ nullptr, nullptr, nullptr, 0 },
276+
};
277+
278+
ParticleSystemFXNugget *nugget = new ParticleSystemFXNugget{};
279+
ini->Init_From_INI(nugget, _fieldParse);
280+
reinterpret_cast<FXList *>(formal)->Add_FXNugget(nugget);
281+
}
282+
283+
void FXListAtBonePosFXNugget::Do_FX_Pos(
284+
const Coord3D *primary, const Matrix3D *primary_mtx, float primary_speed, const Coord3D *secondary, float radius) const
285+
{
286+
captainslog_dbgassert(false, "FXListAtBonePosFXNugget::Do_FX_Pos not implemented!");
287+
}
288+
289+
void FXListAtBonePosFXNugget::Do_FX_Obj(const Object *primary, const Object *secondary) const
290+
{
291+
captainslog_dbgassert(false, "FXListAtBonePosFXNugget::Do_FX_Obj not implemented!");
292+
}
293+
294+
void FXListAtBonePosFXNugget::Parse(INI *ini, void *formal, void *, const void *)
295+
{
296+
static const FieldParse _fieldParse[] = {
297+
{ "FX", &FXList::Parse, nullptr, offsetof(FXListAtBonePosFXNugget, m_fx) },
298+
{ "BoneName", &INI::Parse_AsciiString, nullptr, offsetof(FXListAtBonePosFXNugget, m_boneName) },
299+
{ "OrientToBone", &INI::Parse_Bool, nullptr, offsetof(FXListAtBonePosFXNugget, m_orientToBone) },
300+
{ nullptr, nullptr, nullptr, 0 },
301+
};
302+
303+
FXListAtBonePosFXNugget *nugget = new FXListAtBonePosFXNugget{};
304+
ini->Init_From_INI(nugget, _fieldParse);
305+
reinterpret_cast<FXList *>(formal)->Add_FXNugget(nugget);
306+
}

src/game/client/fxlist.h

+155-3
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,152 @@ 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() : m_radiusAsPercentOfObjectSize(0.0f) {};
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+
float m_radiusAsPercentOfObjectSize;
172+
int m_increaseTime;
173+
int m_decreaseTime;
174+
};
175+
176+
class ViewShakeFXNugget : public FXNugget
177+
{
178+
IMPLEMENT_POOL(ViewShakeFXNugget);
179+
180+
public:
181+
ViewShakeFXNugget() {};
182+
virtual ~ViewShakeFXNugget() override {};
183+
184+
virtual void Do_FX_Pos(const Coord3D *primary,
185+
const Matrix3D *primary_mtx,
186+
float primary_speed,
187+
const Coord3D *secondary,
188+
float radius) const override;
189+
virtual void Do_FX_Obj(const Object *primary, const Object *secondary) const override;
190+
191+
static void Parse(INI *ini, void *formal, void *, const void *);
192+
193+
private:
194+
ShakeIntensities m_type;
195+
};
196+
197+
class TerrainScorchFXNugget : public FXNugget
198+
{
199+
IMPLEMENT_POOL(TerrainScorchFXNugget);
200+
201+
public:
202+
TerrainScorchFXNugget() {};
203+
virtual ~TerrainScorchFXNugget() override {};
204+
205+
virtual void Do_FX_Pos(const Coord3D *primary,
206+
const Matrix3D *primary_mtx,
207+
float primary_speed,
208+
const Coord3D *secondary,
209+
float radius) const override;
210+
virtual void Do_FX_Obj(const Object *primary, const Object *secondary) const override;
211+
212+
static void Parse(INI *ini, void *formal, void *, const void *);
213+
214+
private:
215+
Utf8String m_type;
216+
int m_radius;
217+
};
218+
219+
class ParticleSystemFXNugget : public FXNugget
220+
{
221+
IMPLEMENT_POOL(ParticleSystemFXNugget);
222+
223+
public:
224+
ParticleSystemFXNugget() {};
225+
virtual ~ParticleSystemFXNugget() override {};
226+
227+
virtual void Do_FX_Pos(const Coord3D *primary,
228+
const Matrix3D *primary_mtx,
229+
float primary_speed,
230+
const Coord3D *secondary,
231+
float radius) const override;
232+
virtual void Do_FX_Obj(const Object *primary, const Object *secondary) const override;
233+
234+
static void Parse(INI *ini, void *formal, void *, const void *);
235+
236+
private:
237+
Utf8String m_sysName;
238+
int m_count;
239+
GameClientRandomVariable m_radius;
240+
Coord3D m_offset;
241+
GameClientRandomVariable m_height;
242+
bool m_attachToObject;
243+
GameClientRandomVariable m_initialDelay;
244+
bool m_orientToObject;
245+
float m_rotateY;
246+
bool m_ricochet;
247+
bool m_createAtGroundHeight;
248+
bool m_useCallersRadius;
249+
};
250+
251+
struct FXListAtBonePosFXNugget : public FXNugget
252+
{
253+
IMPLEMENT_POOL(FXListAtBonePosFXNugget);
254+
255+
public:
256+
FXListAtBonePosFXNugget() {};
257+
virtual ~FXListAtBonePosFXNugget() override {};
258+
259+
virtual void Do_FX_Pos(const Coord3D *primary,
260+
const Matrix3D *primary_mtx,
261+
float primary_speed,
262+
const Coord3D *secondary,
263+
float radius) const override;
264+
virtual void Do_FX_Obj(const Object *primary, const Object *secondary) const override;
265+
266+
static void Parse(INI *ini, void *formal, void *, const void *);
267+
268+
private:
269+
FXList *m_fx;
270+
Utf8String m_boneName;
271+
bool m_orientToBone;
272+
};

0 commit comments

Comments
 (0)