metaforce/Runtime/Particle/CIntElement.hpp

222 lines
6.8 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
#include <memory>
#include <vector>
#include "Runtime/Particle/IElement.hpp"
2016-02-05 08:34:14 +00:00
/* Documentation at: https://wiki.axiodl.com/w/Particle_Script#Int_Elements */
2016-02-28 06:55:05 +00:00
2018-12-08 05:30:43 +00:00
namespace urde {
class CIEKeyframeEmitter : public CIntElement {
u32 x4_percent;
u32 x8_unk1;
bool xc_loop;
bool xd_unk2;
u32 x10_loopEnd;
u32 x14_loopStart;
std::vector<int> x18_keys;
2016-02-05 08:34:14 +00:00
public:
explicit CIEKeyframeEmitter(CInputStream& in);
bool GetValue(int frame, int& valOut) const override;
int GetMaxValue() const override;
2016-02-05 08:34:14 +00:00
};
2018-12-08 05:30:43 +00:00
class CIEDeath : public CIntElement {
std::unique_ptr<CIntElement> x4_a;
std::unique_ptr<CIntElement> x8_b;
2016-02-05 08:34:14 +00:00
public:
2018-12-08 05:30:43 +00:00
CIEDeath(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, int& valOut) const override;
int GetMaxValue() const override;
2016-02-05 08:34:14 +00:00
};
2018-12-08 05:30:43 +00:00
class CIEClamp : public CIntElement {
std::unique_ptr<CIntElement> x4_min;
std::unique_ptr<CIntElement> x8_max;
std::unique_ptr<CIntElement> xc_val;
2016-02-05 08:34:14 +00:00
public:
2018-12-08 05:30:43 +00:00
CIEClamp(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b, std::unique_ptr<CIntElement>&& c)
: x4_min(std::move(a)), x8_max(std::move(b)), xc_val(std::move(c)) {}
bool GetValue(int frame, int& valOut) const override;
int GetMaxValue() const override;
2016-02-05 08:34:14 +00:00
};
2018-12-08 05:30:43 +00:00
class CIETimeChain : public CIntElement {
std::unique_ptr<CIntElement> x4_a;
std::unique_ptr<CIntElement> x8_b;
std::unique_ptr<CIntElement> xc_swFrame;
2016-02-05 08:34:14 +00:00
public:
2018-12-08 05:30:43 +00:00
CIETimeChain(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b, std::unique_ptr<CIntElement>&& c)
: x4_a(std::move(a)), x8_b(std::move(b)), xc_swFrame(std::move(c)) {}
bool GetValue(int frame, int& valOut) const override;
int GetMaxValue() const override;
2016-02-05 08:34:14 +00:00
};
2018-12-08 05:30:43 +00:00
class CIEAdd : public CIntElement {
std::unique_ptr<CIntElement> x4_a;
std::unique_ptr<CIntElement> x8_b;
2016-02-05 08:34:14 +00:00
public:
2018-12-08 05:30:43 +00:00
CIEAdd(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b) : x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, int& valOut) const override;
int GetMaxValue() const override;
2016-02-05 08:34:14 +00:00
};
2018-12-08 05:30:43 +00:00
class CIEConstant : public CIntElement {
int x4_val;
2016-02-05 08:34:14 +00:00
public:
explicit CIEConstant(int val) : x4_val(val) {}
bool GetValue(int frame, int& valOut) const override;
int GetMaxValue() const override;
2016-02-05 08:34:14 +00:00
};
2018-12-08 05:30:43 +00:00
class CIEImpulse : public CIntElement {
std::unique_ptr<CIntElement> x4_a;
2016-02-05 08:34:14 +00:00
public:
explicit CIEImpulse(std::unique_ptr<CIntElement>&& a) : x4_a(std::move(a)) {}
bool GetValue(int frame, int& valOut) const override;
int GetMaxValue() const override;
2016-02-05 08:34:14 +00:00
};
2018-12-08 05:30:43 +00:00
class CIELifetimePercent : public CIntElement {
std::unique_ptr<CIntElement> x4_percentVal;
2016-02-05 08:34:14 +00:00
public:
explicit CIELifetimePercent(std::unique_ptr<CIntElement>&& a) : x4_percentVal(std::move(a)) {}
bool GetValue(int frame, int& valOut) const override;
int GetMaxValue() const override;
2016-02-05 08:34:14 +00:00
};
2018-12-08 05:30:43 +00:00
class CIEInitialRandom : public CIntElement {
std::unique_ptr<CIntElement> x4_a;
std::unique_ptr<CIntElement> x8_b;
2016-02-05 08:34:14 +00:00
public:
2018-12-08 05:30:43 +00:00
CIEInitialRandom(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, int& valOut) const override;
int GetMaxValue() const override;
2016-02-05 08:34:14 +00:00
};
2018-12-08 05:30:43 +00:00
class CIEPulse : public CIntElement {
std::unique_ptr<CIntElement> x4_aDuration;
std::unique_ptr<CIntElement> x8_bDuration;
std::unique_ptr<CIntElement> xc_aVal;
std::unique_ptr<CIntElement> x10_bVal;
2016-02-05 08:34:14 +00:00
public:
2018-12-08 05:30:43 +00:00
CIEPulse(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b, std::unique_ptr<CIntElement>&& c,
std::unique_ptr<CIntElement>&& d)
: x4_aDuration(std::move(a)), x8_bDuration(std::move(b)), xc_aVal(std::move(c)), x10_bVal(std::move(d)) {}
bool GetValue(int frame, int& valOut) const override;
int GetMaxValue() const override;
2016-02-05 08:34:14 +00:00
};
2018-12-08 05:30:43 +00:00
class CIEMultiply : public CIntElement {
std::unique_ptr<CIntElement> x4_a;
std::unique_ptr<CIntElement> x8_b;
2016-02-05 08:34:14 +00:00
public:
2018-12-08 05:30:43 +00:00
CIEMultiply(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, int& valOut) const override;
int GetMaxValue() const override;
2016-02-05 08:34:14 +00:00
};
2018-12-08 05:30:43 +00:00
class CIESampleAndHold : public CIntElement {
std::unique_ptr<CIntElement> x4_sampleSource;
mutable int x8_nextSampleFrame = 0;
2018-12-08 05:30:43 +00:00
std::unique_ptr<CIntElement> xc_waitFramesMin;
std::unique_ptr<CIntElement> x10_waitFramesMax;
mutable int x14_holdVal = 0;
2018-12-08 05:30:43 +00:00
2016-02-05 08:34:14 +00:00
public:
2018-12-08 05:30:43 +00:00
CIESampleAndHold(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b, std::unique_ptr<CIntElement>&& c)
: x4_sampleSource(std::move(a)), xc_waitFramesMin(std::move(b)), x10_waitFramesMax(std::move(c)) {}
bool GetValue(int frame, int& valOut) const override;
int GetMaxValue() const override;
2016-02-05 08:34:14 +00:00
};
2018-12-08 05:30:43 +00:00
class CIERandom : public CIntElement {
std::unique_ptr<CIntElement> x4_min;
std::unique_ptr<CIntElement> x8_max;
2016-02-05 08:34:14 +00:00
public:
2018-12-08 05:30:43 +00:00
CIERandom(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b)
: x4_min(std::move(a)), x8_max(std::move(b)) {}
bool GetValue(int frame, int& valOut) const override;
int GetMaxValue() const override;
2016-02-05 08:34:14 +00:00
};
2018-12-08 05:30:43 +00:00
class CIETimeScale : public CIntElement {
std::unique_ptr<CRealElement> x4_a;
2016-02-05 08:34:14 +00:00
public:
explicit CIETimeScale(std::unique_ptr<CRealElement>&& a) : x4_a(std::move(a)) {}
bool GetValue(int frame, int& valOut) const override;
int GetMaxValue() const override;
2016-02-05 08:34:14 +00:00
};
2018-12-08 05:30:43 +00:00
class CIEGetCumulativeParticleCount : public CIntElement {
2016-02-05 08:34:14 +00:00
public:
bool GetValue(int frame, int& valOut) const override;
int GetMaxValue() const override;
2016-02-05 08:34:14 +00:00
};
2018-12-08 05:30:43 +00:00
class CIEGetActiveParticleCount : public CIntElement {
2016-02-11 20:32:42 +00:00
public:
bool GetValue(int frame, int& valOut) const override;
int GetMaxValue() const override;
2016-02-11 20:32:42 +00:00
};
2018-12-08 05:30:43 +00:00
class CIEGetEmitterTime : public CIntElement {
2016-02-11 20:32:42 +00:00
public:
bool GetValue(int frame, int& valOut) const override;
int GetMaxValue() const override;
2016-02-11 20:32:42 +00:00
};
2018-12-08 05:30:43 +00:00
class CIEModulo : public CIntElement {
std::unique_ptr<CIntElement> x4_a;
std::unique_ptr<CIntElement> x8_b;
2016-02-05 08:34:14 +00:00
public:
2018-12-08 05:30:43 +00:00
CIEModulo(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, int& valOut) const override;
int GetMaxValue() const override;
2016-02-05 08:34:14 +00:00
};
2018-12-08 05:30:43 +00:00
class CIESubtract : public CIntElement {
std::unique_ptr<CIntElement> x4_a;
std::unique_ptr<CIntElement> x8_b;
2016-02-05 08:34:14 +00:00
public:
2018-12-08 05:30:43 +00:00
CIESubtract(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, int& valOut) const override;
int GetMaxValue() const override;
};
class CIERealToInt final : public CIntElement {
std::unique_ptr<CRealElement> x4_a;
std::unique_ptr<CRealElement> x8_b;
public:
explicit CIERealToInt(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b)
: x4_a{std::move(a)}, x8_b{std::move(b)} {}
bool GetValue(int frame, int& valOut) const override;
int GetMaxValue() const override;
};
2018-12-08 05:30:43 +00:00
} // namespace urde