General cleanup and naming fields

This commit is contained in:
Fexty12573 2024-08-02 22:09:50 +02:00
parent 327e781f54
commit 342bf9230b
3 changed files with 45 additions and 43 deletions

View File

@ -61,17 +61,19 @@ typedef struct SPLEmitter {
u32 emissionInterval : 8; // number of frames between particle emissions
u32 baseAlpha : 8;
u32 updateCycle : 3; // 0 = every frame, 1 = cycle A, 2 = cycle B, cycles A and B alternate
u32 unk_02_3 : 13;
u32 reserved : 13;
} misc;
VecFx16 crossAxis1;
VecFx16 crossAxis2;
SPLEmitterUpdateCallback updateCallback;
void * unk_104;
// Fields that the game can use for custom data
void *userDataPtr;
union {
u32 unk_108_val1;
u16 unk_108_val2[2];
u8 unk_108_val3[4];
} unk_108;
u32 u32;
u16 u16[2];
u8 u8[4];
} userData;
} SPLEmitter;
typedef struct SPLEmitterList {

View File

@ -124,18 +124,18 @@ typedef struct SPLResourceHeader {
SPLResourceFlags flags;
VecFx32 emitterBasePos;
fx32 emissionCount; // Number of particles to emit per emission interval
fx32 unk_14;
fx32 unk_18;
VecFx16 unk_1C;
fx32 radius; // Used for circle, sphere, and cylinder emissions
fx32 length; // Used for cylinder emission
VecFx16 axis;
GXRgb color;
fx32 unk_24;
fx32 unk_28;
fx32 unk_2C;
fx32 initVelPosAmplifier;
fx32 initVelAxisAmplifier;
fx32 baseScale;
fx16 aspectRatio;
u16 startDelay; // Delay, in frames, before the emitter starts emitting particles
s16 minRotation;
s16 maxRotation;
u16 unk_38;
u16 initAngle;
u16 reserved_3A;
u16 emitterLifeTime;
u16 particleLifeTime;
@ -151,18 +151,18 @@ typedef struct SPLResourceHeader {
} randomAttenuation;
struct {
u32 unk_00_0 : 8;
u32 unk_01_0 : 8;
u32 emissionInterval : 8;
u32 baseAlpha : 8;
u32 airResistance : 8;
u32 textureIndex : 8;
u32 loopFrames : 8;
u32 unk_05_0 : 16;
u32 unk_07_0 : 2;
u32 unk_07_2 : 2;
u32 textureTileCountS : 2; // Number of times to tile the texture in the S direction
u32 textureTileCountT : 2; // Number of times to tile the texture in the T direction
u32 scaleAnimDir : 3; // Maps to SPLScaleAnimDir
u32 unk_07_7 : 1;
u32 unk_08_0 : 1;
u32 unk_08_1 : 1;
u32 flipTextureS : 1;
u32 flipTextureT : 1;
u32 unk_08_2 : 3;
u32 unk_08_5 : 27;
} misc;
@ -242,10 +242,10 @@ typedef struct SPLChildResource {
u32 emissionDelay : 8; // Delay, as a fraction of the particle's lifetime, before the particle starts emitting
u32 emissionInterval : 8;
u32 textureIndex : 8;
u32 unk_04_0 : 2;
u32 unk_04_2 : 2;
u32 unk_04_4 : 1;
u32 unk_04_5 : 1;
u32 textureTileCountS : 2;
u32 textureTileCountT : 2;
u32 flipTextureS : 1;
u32 flipTextureT : 1;
u32 unk_04_6 : 1;
u32 reserved_04_7 : 25;
} misc;

View File

@ -75,42 +75,42 @@ void SPLEmitter_Init(SPLEmitter *emtr, SPLResource *res, const VecFx32 *pos)
emtr->age = 0;
emtr->emissionCountFractional = 0;
emtr->axis = emtr->resource->header->unk_1C;
emtr->initAngle = emtr->resource->header->unk_38;
emtr->axis = emtr->resource->header->axis;
emtr->initAngle = emtr->resource->header->initAngle;
emtr->emissionCount = emtr->resource->header->emissionCount;
emtr->radius = emtr->resource->header->unk_14;
emtr->length = emtr->resource->header->unk_18;
emtr->initVelPositionAmplifier = emtr->resource->header->unk_24;
emtr->initVelAxisAmplifier = emtr->resource->header->unk_28;
emtr->baseScale = emtr->resource->header->unk_2C;
emtr->radius = emtr->resource->header->radius;
emtr->length = emtr->resource->header->length;
emtr->initVelPositionAmplifier = emtr->resource->header->initVelPosAmplifier;
emtr->initVelAxisAmplifier = emtr->resource->header->initVelAxisAmplifier;
emtr->baseScale = emtr->resource->header->baseScale;
emtr->particleLifeTime = emtr->resource->header->particleLifeTime;
emtr->color = GX_RGB(31, 31, 31);
emtr->misc.emissionInterval = emtr->resource->header->misc.unk_00_0;
emtr->misc.baseAlpha = emtr->resource->header->misc.unk_01_0;
emtr->misc.emissionInterval = emtr->resource->header->misc.emissionInterval;
emtr->misc.baseAlpha = emtr->resource->header->misc.baseAlpha;
emtr->misc.updateCycle = 0;
emtr->misc.unk_02_3 = 0;
emtr->misc.reserved = 0;
emtr->collisionPlaneHeight = FX32_MIN;
emtr->textureS = FX32_ONE << emtr->resource->header->misc.unk_07_0;
emtr->textureT = FX32_ONE << emtr->resource->header->misc.unk_07_2;
emtr->textureS = FX32_ONE << emtr->resource->header->misc.textureTileCountS;
emtr->textureT = FX32_ONE << emtr->resource->header->misc.textureTileCountT;
if (emtr->resource->header->misc.unk_08_0) {
if (emtr->resource->header->misc.flipTextureS) {
emtr->textureS *= -1;
}
if (emtr->resource->header->misc.unk_08_1) {
if (emtr->resource->header->misc.flipTextureT) {
emtr->textureT *= -1;
}
if (emtr->resource->header->flags.hasChildResource) {
emtr->childTextureS = FX32_ONE << emtr->resource->childResource->misc.unk_04_0;
emtr->childTextureT = FX32_ONE << emtr->resource->childResource->misc.unk_04_2;
emtr->childTextureS = FX32_ONE << emtr->resource->childResource->misc.textureTileCountS;
emtr->childTextureT = FX32_ONE << emtr->resource->childResource->misc.textureTileCountT;
if (emtr->resource->childResource->misc.unk_04_4) {
if (emtr->resource->childResource->misc.flipTextureS) {
emtr->childTextureS *= -1;
}
if (emtr->resource->childResource->misc.unk_04_5) {
if (emtr->resource->childResource->misc.flipTextureT) {
emtr->childTextureT *= -1;
}
}
@ -119,8 +119,8 @@ void SPLEmitter_Init(SPLEmitter *emtr, SPLResource *res, const VecFx32 *pos)
emtr->particles.first = emtr->childParticles.first = NULL;
emtr->particles.count = emtr->childParticles.count = 0;
emtr->updateCallback = NULL;
emtr->unk_104 = NULL;
emtr->unk_108.unk_108_val1 = 0;
emtr->userDataPtr = NULL;
emtr->userData.u32 = 0;
}
void SPLEmitter_Update(SPLManager *mgr, SPLEmitter *emtr)