/
ifx.h
133 lines (96 loc) · 3.98 KB
/
ifx.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#pragma once
#include "ideclmanager.h"
#include "math/Vector3.h"
namespace fx
{
class IFxAction
{
public:
using Ptr = std::shared_ptr<IFxAction>;
enum class Type
{
Undefined = -1,
Light = 0,
Particle,
Decal,
Model,
Sound,
Shake,
AttachLight,
AttachEntity,
Launch,
Shockwave
};
virtual ~IFxAction() {}
virtual Type getType() = 0;
// Returns the name of this action (which might be an empty string)
virtual const std::string& getName() = 0;
// Returns the action delay in seconds
virtual float getDelay() = 0;
// Action duration in seconds, before it is killed or restarted
virtual float getDuration() = 0;
// True: Don't shake the entity this effect is attached to
virtual bool getIgnoreMaster() = 0;
// Shake parameters
virtual float getShakeTime() = 0;
virtual float getShakeAmplitude() = 0;
virtual float getShakeDistance() = 0;
virtual bool getShakeFalloff() = 0;
virtual float getShakeImpulse() = 0;
// True: The light in this effect doesn't cast shadows
virtual bool getNoShadows() = 0;
// Causes the sibling action to happen when this action does.
virtual const std::string& getFireSiblingAction() = 0;
// Let the delay be random between min and max (in seconds)
// If both are 0.0 no random delay is active and the regular delay is used instead
virtual std::pair<float, float> getRandomDelay() = 0;
// According to the docs this is not used
virtual float getRotate() = 0;
// Move around with the entity (vs stationary after spawning)
virtual bool getTrackOrigin() = 0;
// True: the action starts again after the 'duration' has run out
virtual bool getRestart() = 0;
// Fade in the RGB of the light or model over <time> seconds
virtual float getFadeInTimeInSeconds() = 0;
// Fade out the light/model. Ignored if fadeIn is set, you can use 2 seperate
// actions (tied together with uselight) if you want a light to fade in and out.
virtual float getFadeOutTimeInSeconds() = 0;
// Size of the decal (corresponds to "size" keyword)
virtual float getDecalSize() = 0;
// Offset from the origin of the entity (or bind point) this action is located at
virtual const Vector3& getOffset() = 0;
// Axis of the model, mutually exclusive with angle
virtual const Vector3& getAxis() = 0;
// Alternate way of setting the axis of the model
virtual const Vector3& getAngle() = 0;
// Returns the name of the action containing the light which should be used
virtual const std::string& getUseLight() = 0;
// Modify the model in a named sibling action. Can be used to fade out a particle in a sibling.
virtual const std::string& getUseModel() = 0;
// Attach to external light (a light not defined in the effect) for fading.
virtual const std::string& getAttachLight() = 0;
// Attach to an external entity
virtual const std::string& getAttachEntity() = 0;
// Launches a projectile of the given entityDef
virtual const std::string& getLaunchProjectileDef() = 0;
// If not empty, this action spawns a light with this material
virtual const std::string& getLightMaterialName() = 0;
// For Type::Light actions, this defines the RGB colour components
virtual const Vector3& getLightRgbColour() = 0;
// For Type::Light actions, this defines the radius of the spawned light
virtual float getLightRadius() = 0;
};
class IFxDeclaration :
public decl::IDeclaration
{
public:
using Ptr = std::shared_ptr<IFxDeclaration>;
// Returns the number of actions in this FX declaration
virtual std::size_t getNumActions() = 0;
// Returns the n-th action (based on the given 0-based index)
virtual IFxAction::Ptr getAction(std::size_t index) = 0;
// Returns the name of the joint this FX should bind to
// Evaluated to an empty string if "bindTo" is not set
virtual std::string getBindTo() = 0;
};
}