mirror of
https://github.com/PrimeDecomp/prime.git
synced 2025-12-14 10:46:08 +00:00
CEmitterElement progress
This commit is contained in:
@@ -35,7 +35,6 @@ public:
|
|||||||
static CRelAngle FromRadians(float rad) { return CRelAngle(rad); }
|
static CRelAngle FromRadians(float rad) { return CRelAngle(rad); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
float x0_angle;
|
float x0_angle;
|
||||||
};
|
};
|
||||||
CHECK_SIZEOF(CRelAngle, 0x4)
|
CHECK_SIZEOF(CRelAngle, 0x4)
|
||||||
|
|||||||
@@ -42,6 +42,4 @@ void TOneStatic< T >::operator delete(void* ptr) {
|
|||||||
ReferenceCount()--;
|
ReferenceCount()--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _TONESTATIC
|
#endif // _TONESTATIC
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ public:
|
|||||||
|
|
||||||
static rstl::auto_ptr< CPVSAreaSet > MakeAreaSet(const char* data, int len);
|
static rstl::auto_ptr< CPVSAreaSet > MakeAreaSet(const char* data, int len);
|
||||||
CPVSVisSet GetLightSet(int) const;
|
CPVSVisSet GetLightSet(int) const;
|
||||||
|
int GetEntityIdByIndex(uint idx) const;
|
||||||
|
|
||||||
const CPVSVisOctree& GetVisOctree(const uint) const;
|
const CPVSVisOctree& GetVisOctree(const uint) const;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "Kyoto/Particles/CEmitterElement.hpp"
|
#include "Kyoto/Particles/CEmitterElement.hpp"
|
||||||
|
#pragma sym on
|
||||||
#include "Kyoto/CRandom16.hpp"
|
#include "Kyoto/CRandom16.hpp"
|
||||||
|
#include "Kyoto/Math/CMath.hpp"
|
||||||
#include "Kyoto/Math/CRelAngle.hpp"
|
#include "Kyoto/Math/CRelAngle.hpp"
|
||||||
#include "Kyoto/Math/CVector3f.hpp"
|
#include "Kyoto/Math/CVector3f.hpp"
|
||||||
|
|
||||||
@@ -31,22 +32,22 @@ CVESphere::~CVESphere() {
|
|||||||
delete x8_sphereRadius;
|
delete x8_sphereRadius;
|
||||||
delete xc_velocityMag;
|
delete xc_velocityMag;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVESphere::GetValue(int frame, CVector3f& pPos, CVector3f& pVel) const {
|
bool CVESphere::GetValue(int frame, CVector3f& pPos, CVector3f& pVel) const {
|
||||||
CVector3f a = CVector3f::Zero();
|
CVector3f origin = CVector3f::Zero();
|
||||||
x4_sphereOrigin->GetValue(frame, a);
|
float radius;
|
||||||
float b;
|
float mag;
|
||||||
x8_sphereRadius->GetValue(frame, b);
|
x4_sphereOrigin->GetValue(frame, origin);
|
||||||
|
x8_sphereRadius->GetValue(frame, radius);
|
||||||
|
|
||||||
CVector3f normVec1(float(CRandom16::GetRandomNumber()->Range(-100, 100)),
|
CVector3f normVec1 = CVector3f(CRandom16::GetRandomNumber()->Range(-100, 100),
|
||||||
float(CRandom16::GetRandomNumber()->Range(-100, 100)),
|
CRandom16::GetRandomNumber()->Range(-100, 100),
|
||||||
float(CRandom16::GetRandomNumber()->Range(-100, 100)));
|
CRandom16::GetRandomNumber()->Range(-100, 100));
|
||||||
pPos =
|
normVec1 = (normVec1.CanBeNormalized() ? (0.1f * normVec1).AsNormalized() : (0.1f * normVec1));
|
||||||
b * (normVec1.CanBeNormalized() ? (normVec1 * 0.01f).AsNormalized() : normVec1 * 0.01f) + a;
|
pPos = radius * normVec1 + origin;
|
||||||
CVector3f normVec2 = (pPos - a).CanBeNormalized() ? (pPos - a).AsNormalized() : (pPos - a);
|
CVector3f diff = (pPos - origin);
|
||||||
float c;
|
CVector3f normVec2 = diff.CanBeNormalized() ? diff.AsNormalized() : diff;
|
||||||
xc_velocityMag->GetValue(frame, c);
|
xc_velocityMag->GetValue(frame, mag);
|
||||||
pVel = c * normVec2;
|
pVel = mag * normVec2;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -75,33 +76,35 @@ CVEAngleSphere::~CVEAngleSphere() {
|
|||||||
|
|
||||||
bool CVEAngleSphere::GetValue(int frame, CVector3f& pPos, CVector3f& pVel) const {
|
bool CVEAngleSphere::GetValue(int frame, CVector3f& pPos, CVector3f& pVel) const {
|
||||||
CVector3f origin = CVector3f::Zero();
|
CVector3f origin = CVector3f::Zero();
|
||||||
x4_sphereOrigin->GetValue(frame, origin);
|
|
||||||
float radius;
|
float radius;
|
||||||
x8_sphereRadius->GetValue(frame, radius);
|
float mag;
|
||||||
float xBias;
|
float xBias;
|
||||||
x10_angleXBias->GetValue(frame, xBias);
|
|
||||||
float yBias;
|
|
||||||
x14_angleYBias->GetValue(frame, yBias);
|
|
||||||
float xRange;
|
float xRange;
|
||||||
x18_angleXRange->GetValue(frame, xRange);
|
float yBias;
|
||||||
float yRange;
|
float yRange;
|
||||||
|
x4_sphereOrigin->GetValue(frame, origin);
|
||||||
|
x8_sphereRadius->GetValue(frame, radius);
|
||||||
|
|
||||||
|
x10_angleXBias->GetValue(frame, xBias);
|
||||||
|
|
||||||
|
x14_angleYBias->GetValue(frame, yBias);
|
||||||
|
|
||||||
|
x18_angleXRange->GetValue(frame, xRange);
|
||||||
|
|
||||||
x1c_angleYRange->GetValue(frame, yRange);
|
x1c_angleYRange->GetValue(frame, yRange);
|
||||||
|
|
||||||
CRelAngle angleA =
|
xBias += ((0.5f * xRange) - (CRandom16::GetRandomNumber()->Float() * xRange));
|
||||||
CRelAngle::FromDegrees(xBias + (0.5f * xRange - xRange * CRandom16::GetRandomNumber()->Float()));
|
xBias *= (M_PIF / 180.f);
|
||||||
CRelAngle angleB =
|
|
||||||
CRelAngle::FromDegrees(yBias + (0.5f * yRange - yRange * CRandom16::GetRandomNumber()->Float()));
|
|
||||||
|
|
||||||
CRelAngle f29 = CMath::FastCosR(angleA.AsRadians()) * CMath::FastCosR(angleB.AsRadians());
|
yBias += ((0.5f * yRange) - (CRandom16::GetRandomNumber()->Float() * yRange));
|
||||||
CRelAngle f30 = CMath::FastSinR(angleA.AsRadians());
|
yBias *= (M_PIF / 180.f);
|
||||||
CRelAngle f31 = CMath::FastCosR(angleA.AsRadians());
|
|
||||||
CRelAngle f2 = -CMath::FastSinR(angleB.AsRadians());
|
|
||||||
|
|
||||||
pPos = origin+ CVector3f(radius * f2.AsRadians() * f31.AsRadians(), radius * f30.AsRadians(), radius * f29.AsRadians());
|
CVector3f vec(-CMath::FastSinR(yBias) * CMath::FastCosR(xBias), CMath::FastSinR(xBias),
|
||||||
|
CMath::FastCosR(xBias) * CMath::FastCosR(yBias));
|
||||||
|
pPos = origin + (radius * vec);
|
||||||
CVector3f dir = (pPos - origin).AsNormalized();
|
CVector3f dir = (pPos - origin).AsNormalized();
|
||||||
float g;
|
xc_velocityMag->GetValue(frame, mag);
|
||||||
xc_velocityMag->GetValue(frame, g);
|
pVel = mag * dir;
|
||||||
pVel = g * dir;
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,14 +152,12 @@ void CTweaks::RegisterResourceTweaks() {
|
|||||||
if (gpTweakGunRes == nullptr) {
|
if (gpTweakGunRes == nullptr) {
|
||||||
rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync(
|
rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync(
|
||||||
SObjectTag('CTWK', IDFromFactory(*resFactory, "GunRes")), nullptr);
|
SObjectTag('CTWK', IDFromFactory(*resFactory, "GunRes")), nullptr);
|
||||||
gpTweakGunRes = rs_new CTweakGunRes(*stream);
|
mTweakObjects[10] = gpTweakGunRes = rs_new CTweakGunRes(*stream);
|
||||||
mTweakObjects[10] = gpTweakGunRes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gpTweakPlayerRes == nullptr) {
|
if (gpTweakPlayerRes == nullptr) {
|
||||||
rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync(
|
rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync(
|
||||||
SObjectTag('CTWK', IDFromFactory(*resFactory, "PlayerRes")), nullptr);
|
SObjectTag('CTWK', IDFromFactory(*resFactory, "PlayerRes")), nullptr);
|
||||||
gpTweakPlayerRes = rs_new CTweakPlayerRes(*stream);
|
mTweakObjects[11] = gpTweakPlayerRes = rs_new CTweakPlayerRes(*stream);
|
||||||
mTweakObjects[11] = gpTweakPlayerRes;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,3 +40,7 @@ CPVSVisSet CPVSAreaSet::GetLightSet(int lightIdx) const {
|
|||||||
// return CPVSVisSet(x20_octree.GetNumObjects(), x20_octree.GetNumLights(),
|
// return CPVSVisSet(x20_octree.GetNumObjects(), x20_octree.GetNumLights(),
|
||||||
// x1c_lightLeaves + x10_leafSize * lightIdx);
|
// x1c_lightLeaves + x10_leafSize * lightIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CPVSAreaSet::GetEntityIdByIndex(uint idx) const {
|
||||||
|
return reinterpret_cast< const int* >(x18_)[idx];
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user