File: FxManagerInterface.h

package info (click to toggle)
darkradiant 3.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 41,080 kB
  • sloc: cpp: 264,743; ansic: 10,659; python: 1,852; xml: 1,650; sh: 92; makefile: 21
file content (242 lines) | stat: -rw-r--r-- 5,017 bytes parent folder | download | duplicates (3)
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
#pragma once

#include "ifx.h"
#include "DeclarationManagerInterface.h"

namespace script
{

class ScriptFxAction
{
private:
    fx::IFxAction::Ptr _action;

public:
    ScriptFxAction(const fx::IFxAction::Ptr& action) :
        _action(action)
    {}

    fx::IFxAction::Type getActionType()
    {
        return _action ? _action->getActionType() : fx::IFxAction::Type::Undefined;
    }

    std::string getName()
    {
        return _action ? _action->getName() : std::string();
    }

    float getDelayInSeconds()
    {
        return _action ? _action->getDelayInSeconds() : 0;
    }

    float getDurationInSeconds()
    {
        return _action ? _action->getDurationInSeconds() : 0;
    }

    bool getIgnoreMaster()
    {
        return _action ? _action->getIgnoreMaster() : false;
    }

    float getShakeTimeInSeconds()
    {
        return _action ? _action->getShakeTimeInSeconds() : 0;
    }

    float getShakeAmplitude()
    {
        return _action ? _action->getShakeAmplitude() : 0;
    }

    float getShakeDistance()
    {
        return _action ? _action->getShakeDistance() : 0;
    }

    bool getShakeFalloff()
    {
        return _action ? _action->getShakeFalloff() : false;
    }

    float getShakeImpulse()
    {
        return _action ? _action->getShakeImpulse() : 0;
    }

    bool getNoShadows()
    {
        return _action ? _action->getNoShadows() : false;
    }

    std::string getFireSiblingAction()
    {
        return _action ? _action->getFireSiblingAction() : std::string();
    }

    std::pair<float, float> getRandomDelay()
    {
        return _action ? _action->getRandomDelay() : std::pair<float, float>();
    }

    float getRotate()
    {
        return _action ? _action->getRotate() : 0;
    }

    bool getTrackOrigin()
    {
        return _action ? _action->getTrackOrigin() : false;
    }

    bool getRestart()
    {
        return _action ? _action->getRestart() : false;
    }

    float getFadeInTimeInSeconds()
    {
        return _action ? _action->getFadeInTimeInSeconds() : 0;
    }

    float getFadeOutTimeInSeconds()
    {
        return _action ? _action->getFadeOutTimeInSeconds() : 0;
    }

    float getDecalSize()
    {
        return _action ? _action->getDecalSize() : 0;
    }

    Vector3 getOffset()
    {
        return _action ? _action->getOffset() : Vector3(0,0,0);
    }

    Vector3 getAxis()
    {
        return _action ? _action->getAxis() : Vector3(0,0,0);
    }

    Vector3 getAngle()
    {
        return _action ? _action->getAngle() : Vector3(0,0,0);
    }

    std::string getUseLight()
    {
        return _action ? _action->getUseLight() : std::string();
    }

    std::string getUseModel()
    {
        return _action ? _action->getUseModel() : std::string();
    }

    std::string getAttachLight()
    {
        return _action ? _action->getAttachLight() : std::string();
    }

    std::string getAttachEntity()
    {
        return _action ? _action->getAttachEntity() : std::string();
    }

    std::string getLaunchProjectileDef()
    {
        return _action ? _action->getLaunchProjectileDef() : std::string();
    }

    std::string getLightMaterialName()
    {
        return _action ? _action->getLightMaterialName() : std::string();
    }

    Vector3 getLightRgbColour()
    {
        return _action ? _action->getLightRgbColour() : Vector3(0,0,0);
    }

    float getLightRadius()
    {
        return _action ? _action->getLightRadius() : 0;
    }

    std::string getModelName()
    {
        return _action ? _action->getModelName() : std::string();
    }

    std::string getDecalMaterialName()
    {
        return _action ? _action->getDecalMaterialName() : std::string();
    }

    bool getParticleTrackVelocity()
    {
        return _action ? _action->getParticleTrackVelocity() : false;
    }

    std::string getSoundShaderName()
    {
        return _action ? _action->getSoundShaderName() : std::string();
    }

    std::string getShockwaveDefName()
    {
        return _action ? _action->getShockwaveDefName() : std::string();
    }
};

class ScriptFxDeclaration :
    public ScriptDeclaration
{
private:
    fx::IFxDeclaration::Ptr _fx;

public:
    ScriptFxDeclaration(const fx::IFxDeclaration::Ptr& fx) :
        ScriptDeclaration(fx),
        _fx(fx)
    {}

    bool isNull()
    {
        return !_fx;
    }

    std::size_t getNumActions()
    {
        return _fx ? _fx->getNumActions() : 0;
    }

    ScriptFxAction getAction(std::size_t index)
    {
        return ScriptFxAction(_fx ? _fx->getAction(index) : fx::IFxAction::Ptr());
    }

    std::string getBindTo()
    {
        return _fx ? _fx->getBindTo() : std::string();
    }
};

/**
* Exposes the GlobalFxManager interface to scripts
*/
class FxManagerInterface :
    public IScriptInterface
{
public:
    // Mapped methods
    ScriptFxDeclaration findFx(const std::string& name);

    // IScriptInterface implementation
    void registerInterface(py::module& scope, py::dict& globals) override;
};

}