mirror of https://github.com/AxioDL/metaforce.git
BNCE variable names and some doc-links
This commit is contained in:
parent
4405af9925
commit
accc593102
|
@ -4,6 +4,8 @@
|
|||
#include "CRandom16.hpp"
|
||||
#include <math.h>
|
||||
|
||||
/* Documentation at: http://www.metroid2002.com/retromodding/wiki/Particle_Script#Color_Elements */
|
||||
|
||||
namespace pshag
|
||||
{
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "IElement.hpp"
|
||||
|
||||
/* Documentation at: http://www.metroid2002.com/retromodding/wiki/Particle_Script#Color_Elements */
|
||||
|
||||
namespace pshag
|
||||
{
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "CEmitterElement.hpp"
|
||||
#include "CRandom16.hpp"
|
||||
|
||||
/* Documentation at: http://www.metroid2002.com/retromodding/wiki/Particle_Script#Emitter_Elements */
|
||||
|
||||
namespace pshag
|
||||
{
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "IElement.hpp"
|
||||
|
||||
/* Documentation at: http://www.metroid2002.com/retromodding/wiki/Particle_Script#Emitter_Elements */
|
||||
|
||||
namespace pshag
|
||||
{
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#include "CParticleGlobals.hpp"
|
||||
#include "CRandom16.hpp"
|
||||
|
||||
/* Documentation at: http://www.metroid2002.com/retromodding/wiki/Particle_Script#Int_Elements */
|
||||
|
||||
namespace pshag
|
||||
{
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "IElement.hpp"
|
||||
|
||||
/* Documentation at: http://www.metroid2002.com/retromodding/wiki/Particle_Script#Int_Elements */
|
||||
|
||||
namespace pshag
|
||||
{
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include "CRandom16.hpp"
|
||||
#include <math.h>
|
||||
|
||||
/* Documentation at: http://www.metroid2002.com/retromodding/wiki/Particle_Script#Mod_Vector_Elements */
|
||||
|
||||
namespace pshag
|
||||
{
|
||||
|
||||
|
@ -97,60 +99,65 @@ bool CMVETimeChain::GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f&
|
|||
return x4_a->GetValue(frame, pVel, pPos);
|
||||
}
|
||||
|
||||
CMVEBounce::CMVEBounce(CVectorElement *a, CVectorElement *b, CRealElement *c, CRealElement *d, bool f)
|
||||
: x4_a(a), x8_b(b), xc_c(c), x10_d(d), x14_e(false), x15_f(f), x24_j(0.0)
|
||||
CMVEBounce::CMVEBounce(CVectorElement* a, CVectorElement* b, CRealElement* c, CRealElement* d, bool f)
|
||||
: x4_planePoint(a), x8_planeNormal(b), xc_friction(c), x10_restitution(d), x14_planePrecomputed(false), x15_dieOnPenetrate(f), x24_planeD(0.0)
|
||||
{
|
||||
if (x4_a && x8_b && x4_a->IsFastConstant() && x8_b->IsFastConstant())
|
||||
if (x4_planePoint && x8_planeNormal && x4_planePoint->IsFastConstant() && x8_planeNormal->IsFastConstant())
|
||||
{
|
||||
x14_e = true;
|
||||
x8_b->GetValue(0, x18_g);
|
||||
/* Precompute Hesse normal form of plane (for penetration testing)
|
||||
* https://en.wikipedia.org/wiki/Hesse_normal_form */
|
||||
x14_planePrecomputed = true;
|
||||
x8_planeNormal->GetValue(0, x18_planeValidatedNormal);
|
||||
|
||||
if (x18_g.magSquared() > 0.0)
|
||||
x18_g.normalize();
|
||||
if (x18_planeValidatedNormal.magSquared() > 0.0)
|
||||
x18_planeValidatedNormal.normalize();
|
||||
Zeus::CVector3f a;
|
||||
x4_a->GetValue(0, a);
|
||||
x24_j = x18_g.dot(a);
|
||||
x4_planePoint->GetValue(0, a);
|
||||
x24_planeD = x18_planeValidatedNormal.dot(a);
|
||||
}
|
||||
}
|
||||
|
||||
bool CMVEBounce::GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const
|
||||
{
|
||||
if (!x14_e)
|
||||
if (!x14_planePrecomputed)
|
||||
{
|
||||
x8_b->GetValue(frame, ((Zeus::CVector3f&)x18_g));
|
||||
((Zeus::CVector3f&)x18_g).normalize();
|
||||
/* Compute Hesse normal form of plane (for penetration testing) */
|
||||
x8_planeNormal->GetValue(frame, ((Zeus::CVector3f&)x18_planeValidatedNormal));
|
||||
((Zeus::CVector3f&)x18_planeValidatedNormal).normalize();
|
||||
|
||||
Zeus::CVector3f a;
|
||||
x4_a->GetValue(frame, a);
|
||||
x4_planePoint->GetValue(frame, a);
|
||||
|
||||
(float&)(x24_j) = x18_g.dot(a);
|
||||
(float&)(x24_planeD) = x18_planeValidatedNormal.dot(a);
|
||||
}
|
||||
|
||||
float dot = x18_g.dot(pPos);
|
||||
if ((dot - x24_j) <= 0.0f)
|
||||
float dot = x18_planeValidatedNormal.dot(pPos);
|
||||
if ((dot - x24_planeD) <= 0.0f)
|
||||
{
|
||||
if (x15_f)
|
||||
if (x15_dieOnPenetrate)
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
/* Deflection event */
|
||||
|
||||
if (pVel.magSquared() > 0.0f)
|
||||
return false;
|
||||
|
||||
Zeus::CVector3f delta = pPos - pVel;
|
||||
pPos += Zeus::CVector3f{(-((((delta.z * ((delta.x * (delta.y * x18_g.y))
|
||||
+ ((pVel.x * (x18_g.y * pVel.y)) + x18_g.x))) + x18_g.z) - x24_j)) /
|
||||
((pVel.z * ((pVel.x * (x18_g.y * pVel.y)) + x18_g.x)) + x18_g.z)) - (
|
||||
(x18_g.z * ((x18_g.x * (x18_g.y * pVel.y)) + pVel.x)) + pVel.z)} * pVel;
|
||||
pPos += Zeus::CVector3f{(-((((delta.z * ((delta.x * (delta.y * x18_planeValidatedNormal.y))
|
||||
+ ((pVel.x * (x18_planeValidatedNormal.y * pVel.y)) + x18_planeValidatedNormal.x))) + x18_planeValidatedNormal.z) - x24_planeD)) /
|
||||
((pVel.z * ((pVel.x * (x18_planeValidatedNormal.y * pVel.y)) + x18_planeValidatedNormal.x)) + x18_planeValidatedNormal.z)) - (
|
||||
(x18_planeValidatedNormal.z * ((x18_planeValidatedNormal.x * (x18_planeValidatedNormal.y * pVel.y)) + pVel.x)) + pVel.z)} * pVel;
|
||||
|
||||
float d = 0.0f;
|
||||
x10_d->GetValue(frame, d);
|
||||
x10_restitution->GetValue(frame, d);
|
||||
pVel -= d * pVel;
|
||||
|
||||
float c = 0.0f;
|
||||
xc_c->GetValue(frame, c);
|
||||
pVel -= Zeus::CVector3f{(1.0f + c) * ((x18_g.z * (x18_g.x * (x18_g.y * pVel.y)) + pVel.x) + pVel.x)} * x18_g;
|
||||
xc_friction->GetValue(frame, c);
|
||||
pVel -= Zeus::CVector3f{(1.0f + c) * ((x18_planeValidatedNormal.z * (x18_planeValidatedNormal.x * (x18_planeValidatedNormal.y * pVel.y)) + pVel.x) + pVel.x)} * x18_planeValidatedNormal;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "IElement.hpp"
|
||||
|
||||
/* Documentation at: http://www.metroid2002.com/retromodding/wiki/Particle_Script#Mod_Vector_Elements */
|
||||
|
||||
namespace pshag
|
||||
{
|
||||
|
||||
|
@ -58,14 +60,14 @@ public:
|
|||
|
||||
class CMVEBounce : public CModVectorElement
|
||||
{
|
||||
std::unique_ptr<CVectorElement> x4_a;
|
||||
std::unique_ptr<CVectorElement> x8_b;
|
||||
std::unique_ptr<CRealElement> xc_c;
|
||||
std::unique_ptr<CRealElement> x10_d;
|
||||
bool x14_e;
|
||||
bool x15_f;
|
||||
Zeus::CVector3f x18_g;
|
||||
float x24_j;
|
||||
std::unique_ptr<CVectorElement> x4_planePoint;
|
||||
std::unique_ptr<CVectorElement> x8_planeNormal;
|
||||
std::unique_ptr<CRealElement> xc_friction;
|
||||
std::unique_ptr<CRealElement> x10_restitution;
|
||||
bool x14_planePrecomputed;
|
||||
bool x15_dieOnPenetrate;
|
||||
Zeus::CVector3f x18_planeValidatedNormal;
|
||||
float x24_planeD;
|
||||
public:
|
||||
CMVEBounce(CVectorElement* a, CVectorElement* b, CRealElement* c, CRealElement* d, bool e);
|
||||
bool GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const;
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
#include "CRealElement.hpp"
|
||||
#include "CParticleGlobals.hpp"
|
||||
#include "CRandom16.hpp"
|
||||
#include "CElementGen.hpp"
|
||||
#include <math.h>
|
||||
|
||||
/* Documentation at: http://www.metroid2002.com/retromodding/wiki/Particle_Script#Real_Elements */
|
||||
|
||||
namespace pshag
|
||||
{
|
||||
|
||||
|
@ -278,13 +281,13 @@ bool CREParticleAccessParam8::GetValue(int frame, float& valOut) const
|
|||
|
||||
bool CREPSLL::GetValue(int frame, float& valOut) const
|
||||
{
|
||||
//valOut = CParticleGlobals::g_particleMetrics->x2c_psll;
|
||||
valOut = CElementGen::g_currentParticle->x2c_lineLengthOrSize;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CREPRLW::GetValue(int frame, float& valOut) const
|
||||
{
|
||||
//valOut = CParticleGlobals::g_particleMetrics->x30_prlw;
|
||||
valOut = CElementGen::g_currentParticle->x30_lineWidthOrRota;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "IElement.hpp"
|
||||
|
||||
/* Documentation at: http://www.metroid2002.com/retromodding/wiki/Particle_Script#Real_Elements */
|
||||
|
||||
namespace pshag
|
||||
{
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "CUVElement.hpp"
|
||||
|
||||
/* Documentation at: http://www.metroid2002.com/retromodding/wiki/Particle_Script#UV_Elements */
|
||||
|
||||
namespace pshag
|
||||
{
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#include "CToken.hpp"
|
||||
#include "CTexture.hpp"
|
||||
|
||||
/* Documentation at: http://www.metroid2002.com/retromodding/wiki/Particle_Script#UV_Elements */
|
||||
|
||||
namespace pshag
|
||||
{
|
||||
class CToken;
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include "CElementGen.hpp"
|
||||
#include <math.h>
|
||||
|
||||
/* Documentation at: http://www.metroid2002.com/retromodding/wiki/Particle_Script#Vector_Elements */
|
||||
|
||||
namespace pshag
|
||||
{
|
||||
|
||||
|
@ -192,7 +194,7 @@ bool CVEFastConstant::GetValue(int frame, Zeus::CVector3f& valOut) const
|
|||
}
|
||||
|
||||
CVECircle::CVECircle(CVectorElement* a, CVectorElement* b, CRealElement* c, CRealElement* d, CRealElement* e)
|
||||
: x4_direction(a), x20_angleConstant(c), x24_angleLinear(d), x28_magnitude(e)
|
||||
: x4_direction(a), x20_angleConstant(c), x24_angleLinear(d), x28_radius(e)
|
||||
{
|
||||
Zeus::CVector3f bv;
|
||||
b->GetValue(0, bv);
|
||||
|
@ -210,7 +212,7 @@ bool CVECircle::GetValue(int frame, Zeus::CVector3f& valOut) const
|
|||
float c, d, e;
|
||||
x20_angleConstant->GetValue(frame, c);
|
||||
x24_angleLinear->GetValue(frame, d);
|
||||
x28_magnitude->GetValue(frame, e);
|
||||
x28_radius->GetValue(frame, e);
|
||||
|
||||
float curAngle = (d * frame + c) * M_PI / 180.f;
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "IElement.hpp"
|
||||
|
||||
/* Documentation at: http://www.metroid2002.com/retromodding/wiki/Particle_Script#Vector_Elements */
|
||||
|
||||
namespace pshag
|
||||
{
|
||||
|
||||
|
@ -104,7 +106,7 @@ class CVECircle : public CVectorElement
|
|||
Zeus::CVector3f x14_yVec;
|
||||
std::unique_ptr<CRealElement> x20_angleConstant;
|
||||
std::unique_ptr<CRealElement> x24_angleLinear;
|
||||
std::unique_ptr<CRealElement> x28_magnitude;
|
||||
std::unique_ptr<CRealElement> x28_radius;
|
||||
public:
|
||||
CVECircle(CVectorElement* a, CVectorElement* b, CRealElement* c, CRealElement* d, CRealElement* e);
|
||||
bool GetValue(int frame, Zeus::CVector3f& valOut) const;
|
||||
|
|
Loading…
Reference in New Issue