mirror of
https://github.com/pret/pokeplatinum.git
synced 2024-11-26 23:50:36 +00:00
Document spl behavior
This commit is contained in:
parent
2e821de16e
commit
f8ce64165f
@ -5,50 +5,63 @@
|
||||
|
||||
#include "spl_emitter.h"
|
||||
|
||||
#define SPL_SPIN_BEHAVIOR_AXIS_X 0
|
||||
#define SPL_SPIN_BEHAVIOR_AXIS_Y 1
|
||||
#define SPL_SPIN_BEHAVIOR_AXIS_Z 2
|
||||
|
||||
#define SPL_COLLISION_BEHAVIOR_TYPE_KILL 0 // Kills the particle when it collides with the plane
|
||||
#define SPL_COLLISION_BEHAVIOR_TYPE_BOUNCE 1 // Bounces the particle off the plane
|
||||
|
||||
// Applies a gravity behavior to particles
|
||||
typedef struct SPLGravityBehavior {
|
||||
VecFx16 mag;
|
||||
u16 reserved0;
|
||||
VecFx16 magnitude;
|
||||
u16 padding;
|
||||
} SPLGravityBehavior;
|
||||
|
||||
// Applies a random movement behavior to particles
|
||||
typedef struct SPLRandomBehavior {
|
||||
VecFx16 mag;
|
||||
u16 intvl;
|
||||
VecFx16 magnitude;
|
||||
u16 applyInterval; // The interval, in frames, at which the random behavior is applied
|
||||
} SPLRandomBehavior;
|
||||
|
||||
// Applies a magnetic force to particles
|
||||
typedef struct SPLMagnetBehavior {
|
||||
VecFx32 pos;
|
||||
fx16 mag;
|
||||
u16 reserved0;
|
||||
VecFx32 target;
|
||||
fx16 force;
|
||||
u16 padding;
|
||||
} SPLMagnetBehavior;
|
||||
|
||||
// Applies a rotational force to particles
|
||||
typedef struct SPLSpinBehavior {
|
||||
u16 radian;
|
||||
u16 axis_type;
|
||||
u16 angle; // The angle of rotation, in "index" units, where 0x10000 is a full rotation. Applied every frame
|
||||
u16 axis; // The axis of rotation
|
||||
} SPLSpinBehavior;
|
||||
|
||||
typedef struct SPLCollisionBehavior {
|
||||
fx32 y;
|
||||
fx16 coeff_bounce;
|
||||
// Applies a collision behavior to particles
|
||||
typedef struct SPLCollisionPlaneBehavior {
|
||||
fx32 y; // The Y position of the collision plane
|
||||
fx16 elasticity; // The elasticity of the collision, 1.0 being perfectly elastic and 0.0 being perfectly inelastic
|
||||
|
||||
struct {
|
||||
u16 eventtype : 2;
|
||||
u16 global : 1;
|
||||
u16 reserved : 13;
|
||||
} etc;
|
||||
} SPLCollisionBehavior;
|
||||
u16 collisionType : 2;
|
||||
u16 : 14;
|
||||
} flags;
|
||||
} SPLCollisionPlaneBehavior;
|
||||
|
||||
// Applies a convergence behavior to particles
|
||||
// Similar to SPLMagnetBehavior, but it acts directly on the particle's position instead of its acceleration
|
||||
typedef struct SPLConvergenceBehavior {
|
||||
VecFx32 pos;
|
||||
fx16 ratio;
|
||||
u16 reserved0;
|
||||
VecFx32 target;
|
||||
fx16 force;
|
||||
u16 padding;
|
||||
} SPLConvergenceBehavior;
|
||||
|
||||
|
||||
void SPL_020A2204(const void *param0, SPLParticle *param1, VecFx32 *param2, struct SPLEmitter *param3);
|
||||
void SPL_020A213C(const void *param0, SPLParticle *param1, VecFx32 *param2, struct SPLEmitter *param3);
|
||||
void SPL_020A20B8(const void *param0, SPLParticle *param1, VecFx32 *param2, struct SPLEmitter *param3);
|
||||
void SPL_020A1FE0(const void *param0, SPLParticle *param1, VecFx32 *param2, struct SPLEmitter *param3);
|
||||
void SPL_020A1EC4(const void *param0, SPLParticle *param1, VecFx32 *param2, struct SPLEmitter *param3);
|
||||
void SPL_020A1E30(const void *param0, SPLParticle *param1, VecFx32 *param2, struct SPLEmitter *param3);
|
||||
void SPLBehavior_ApplyGravity(const void *param0, SPLParticle *param1, VecFx32 *param2, struct SPLEmitter *param3);
|
||||
void SPLBehavior_ApplyRandom(const void *param0, SPLParticle *param1, VecFx32 *param2, struct SPLEmitter *param3);
|
||||
void SPLBehavior_ApplyMagnet(const void *param0, SPLParticle *param1, VecFx32 *param2, struct SPLEmitter *param3);
|
||||
void SPLBehavior_ApplySpin(const void *param0, SPLParticle *param1, VecFx32 *param2, struct SPLEmitter *param3);
|
||||
void SPLBehavior_ApplyCollisionPlane(const void *param0, SPLParticle *param1, VecFx32 *param2, struct SPLEmitter *param3);
|
||||
void SPLBehavior_ApplyConvergence(const void *param0, SPLParticle *param1, VecFx32 *param2, struct SPLEmitter *param3);
|
||||
|
||||
#endif // SPL_BEHAVIOR_H
|
||||
|
@ -45,7 +45,7 @@ typedef struct SPLEmitter {
|
||||
fx32 unk_DC;
|
||||
u16 unk_E0;
|
||||
GXRgb unk_E2;
|
||||
fx32 unk_E4;
|
||||
fx32 collisionPlaneHeight;
|
||||
fx16 unk_E8;
|
||||
fx16 unk_EA;
|
||||
fx16 unk_EC;
|
||||
|
@ -8,12 +8,12 @@
|
||||
typedef struct SPLParticle_t {
|
||||
struct SPLParticle_t *unk_00;
|
||||
struct SPLParticle_t *unk_04;
|
||||
VecFx32 unk_08;
|
||||
VecFx32 unk_14;
|
||||
VecFx32 position;
|
||||
VecFx32 velocity;
|
||||
u16 unk_20;
|
||||
s16 unk_22;
|
||||
u16 unk_24;
|
||||
u16 unk_26;
|
||||
u16 lifeTime;
|
||||
u16 age;
|
||||
u16 unk_28;
|
||||
u16 unk_2A;
|
||||
struct {
|
||||
@ -28,7 +28,7 @@ typedef struct SPLParticle_t {
|
||||
fx32 unk_30;
|
||||
fx16 unk_34;
|
||||
GXRgb unk_36;
|
||||
VecFx32 unk_38;
|
||||
VecFx32 emitterPos;
|
||||
} SPLParticle; // size=0x44
|
||||
|
||||
typedef struct UnkSPLStruct3_t {
|
||||
|
@ -6,96 +6,89 @@
|
||||
#include "spl_random.h"
|
||||
|
||||
|
||||
void SPL_020A2204(const void *obj, SPLParticle *ptcl, VecFx32 *pos, SPLEmitter *emtr)
|
||||
void SPLBehavior_ApplyGravity(const void *obj, SPLParticle *ptcl, VecFx32 *acc, SPLEmitter *emtr)
|
||||
{
|
||||
SPLGravityBehavior *gravity = (SPLGravityBehavior *)obj;
|
||||
pos->x += gravity->mag.x;
|
||||
pos->y += gravity->mag.y;
|
||||
pos->z += gravity->mag.z;
|
||||
acc->x += gravity->magnitude.x;
|
||||
acc->y += gravity->magnitude.y;
|
||||
acc->z += gravity->magnitude.z;
|
||||
}
|
||||
|
||||
void SPL_020A213C(const void *obj, SPLParticle *ptcl, VecFx32 *acc, SPLEmitter *emtr)
|
||||
void SPLBehavior_ApplyRandom(const void *obj, SPLParticle *ptcl, VecFx32 *acc, SPLEmitter *emtr)
|
||||
{
|
||||
SPLRandomBehavior *rng = (SPLRandomBehavior *)obj;
|
||||
if ((ptcl->unk_26 % rng->intvl) == 0) {
|
||||
acc->x += SPLRandom_RangeFX32(rng->mag.x);
|
||||
acc->y += SPLRandom_RangeFX32(rng->mag.y);
|
||||
acc->z += SPLRandom_RangeFX32(rng->mag.z);
|
||||
if ((ptcl->age % rng->applyInterval) == 0) {
|
||||
acc->x += SPLRandom_RangeFX32(rng->magnitude.x);
|
||||
acc->y += SPLRandom_RangeFX32(rng->magnitude.y);
|
||||
acc->z += SPLRandom_RangeFX32(rng->magnitude.z);
|
||||
}
|
||||
}
|
||||
|
||||
void SPL_020A20B8(const void *obj, SPLParticle *ptcl, VecFx32 *pos, SPLEmitter *emtr)
|
||||
void SPLBehavior_ApplyMagnet(const void *obj, SPLParticle *ptcl, VecFx32 *acc, SPLEmitter *emtr)
|
||||
{
|
||||
SPLMagnetBehavior *magnet = (SPLMagnetBehavior *)obj;
|
||||
pos->x += (magnet->mag * ((magnet->pos.x - ptcl->unk_08.x) - ptcl->unk_14.x)) >> FX32_SHIFT;
|
||||
pos->y += (magnet->mag * ((magnet->pos.y - ptcl->unk_08.y) - ptcl->unk_14.y)) >> FX32_SHIFT;
|
||||
pos->z += (magnet->mag * ((magnet->pos.z - ptcl->unk_08.z) - ptcl->unk_14.z)) >> FX32_SHIFT;
|
||||
acc->x += (magnet->force * ((magnet->target.x - ptcl->position.x) - ptcl->velocity.x)) >> FX32_SHIFT;
|
||||
acc->y += (magnet->force * ((magnet->target.y - ptcl->position.y) - ptcl->velocity.y)) >> FX32_SHIFT;
|
||||
acc->z += (magnet->force * ((magnet->target.z - ptcl->position.z) - ptcl->velocity.z)) >> FX32_SHIFT;
|
||||
}
|
||||
|
||||
void SPL_020A1FE0(const void *obj, SPLParticle *ptcl, VecFx32 *pos, SPLEmitter *emtr)
|
||||
void SPLBehavior_ApplySpin(const void *obj, SPLParticle *ptcl, VecFx32 *acc, SPLEmitter *emtr)
|
||||
{
|
||||
SPLSpinBehavior *spin = (SPLSpinBehavior *)obj;
|
||||
MtxFx33 rot;
|
||||
switch (spin->axis_type) {
|
||||
case 0:
|
||||
MTX_RotX33(&rot, FX_SinIdx(spin->radian), FX_CosIdx(spin->radian));
|
||||
switch (spin->axis) {
|
||||
case SPL_SPIN_BEHAVIOR_AXIS_X:
|
||||
MTX_RotX33(&rot, FX_SinIdx(spin->angle), FX_CosIdx(spin->angle));
|
||||
break;
|
||||
case 1:
|
||||
MTX_RotY33(&rot, FX_SinIdx(spin->radian), FX_CosIdx(spin->radian));
|
||||
case SPL_SPIN_BEHAVIOR_AXIS_Y:
|
||||
MTX_RotY33(&rot, FX_SinIdx(spin->angle), FX_CosIdx(spin->angle));
|
||||
break;
|
||||
case 2:
|
||||
MTX_RotZ33(&rot, FX_SinIdx(spin->radian), FX_CosIdx(spin->radian));
|
||||
case SPL_SPIN_BEHAVIOR_AXIS_Z:
|
||||
MTX_RotZ33(&rot, FX_SinIdx(spin->angle), FX_CosIdx(spin->angle));
|
||||
break;
|
||||
}
|
||||
|
||||
MTX_MultVec33(&ptcl->unk_08, &rot, &ptcl->unk_08);
|
||||
MTX_MultVec33(&ptcl->position, &rot, &ptcl->position);
|
||||
}
|
||||
|
||||
void SPL_020A1EC4(const void *obj, SPLParticle *ptcl, VecFx32 *pos, SPLEmitter *emtr)
|
||||
void SPLBehavior_ApplyCollisionPlane(const void *obj, SPLParticle *ptcl, VecFx32 *acc, SPLEmitter *emtr)
|
||||
{
|
||||
SPLCollisionBehavior *fld = (SPLCollisionBehavior *)obj;
|
||||
fx32 y = fld->y;
|
||||
SPLCollisionPlaneBehavior *plane = (SPLCollisionPlaneBehavior *)obj;
|
||||
fx32 y = plane->y;
|
||||
fx32 ey;
|
||||
|
||||
if (emtr->unk_E4 != FX32_MIN) {
|
||||
y = emtr->unk_E4;
|
||||
if (emtr->collisionPlaneHeight != FX32_MIN) {
|
||||
y = emtr->collisionPlaneHeight;
|
||||
}
|
||||
|
||||
switch (fld->etc.eventtype) {
|
||||
case 0:
|
||||
ey = ptcl->unk_38.y;
|
||||
if (ey < y && ey + ptcl->unk_08.y > y) {
|
||||
ptcl->unk_08.y = y - ey;
|
||||
ptcl->unk_26 = ptcl->unk_24;
|
||||
} else if (ey >= y) {
|
||||
if (ey + ptcl->unk_08.y < y) {
|
||||
ptcl->unk_08.y = y - ey;
|
||||
ptcl->unk_26 = ptcl->unk_24;
|
||||
}
|
||||
switch (plane->flags.collisionType) {
|
||||
case SPL_COLLISION_BEHAVIOR_TYPE_KILL:
|
||||
ey = ptcl->emitterPos.y;
|
||||
if (ey < y && ey + ptcl->position.y > y) {
|
||||
ptcl->position.y = y - ey;
|
||||
ptcl->age = ptcl->lifeTime;
|
||||
} else if (ey >= y && ey + ptcl->position.y < y) {
|
||||
ptcl->position.y = y - ey;
|
||||
ptcl->age = ptcl->lifeTime;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
ey = ptcl->unk_38.y;
|
||||
if (ey < y && ey + ptcl->unk_08.y > y) {
|
||||
ptcl->unk_08.y = y - ey;
|
||||
ptcl->unk_14.y = -FX32_CAST(FX_MUL(ptcl->unk_14.y, fld->coeff_bounce));
|
||||
return;
|
||||
}
|
||||
if (ey < y) {
|
||||
return;
|
||||
}
|
||||
if (ey + ptcl->unk_08.y < y) {
|
||||
ptcl->unk_08.y = y - ey;
|
||||
ptcl->unk_14.y = -FX32_CAST(FX_MUL(ptcl->unk_14.y, fld->coeff_bounce));
|
||||
case SPL_COLLISION_BEHAVIOR_TYPE_BOUNCE:
|
||||
ey = ptcl->emitterPos.y;
|
||||
if (ey < y && ey + ptcl->position.y > y) {
|
||||
ptcl->position.y = y - ey;
|
||||
ptcl->velocity.y = -FX32_CAST(FX_MUL(ptcl->velocity.y, plane->elasticity));
|
||||
} else if (ey >= y && ey + ptcl->position.y < y) {
|
||||
ptcl->position.y = y - ey;
|
||||
ptcl->velocity.y = -FX32_CAST(FX_MUL(ptcl->velocity.y, plane->elasticity));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SPL_020A1E30(const void *obj, SPLParticle *ptcl, VecFx32 *pos, SPLEmitter *emtr)
|
||||
void SPLBehavior_ApplyConvergence(const void *obj, SPLParticle *ptcl, VecFx32 *acc, SPLEmitter *emtr)
|
||||
{
|
||||
SPLConvergenceBehavior *conv = (SPLConvergenceBehavior *)obj;
|
||||
ptcl->unk_08.x += FX32_CAST(FX_MUL(conv->ratio, (conv->pos.x - ptcl->unk_08.x)));
|
||||
ptcl->unk_08.y += FX32_CAST(FX_MUL(conv->ratio, (conv->pos.y - ptcl->unk_08.y)));
|
||||
ptcl->unk_08.z += FX32_CAST(FX_MUL(conv->ratio, (conv->pos.z - ptcl->unk_08.z)));
|
||||
ptcl->position.x += FX32_CAST(FX_MUL(conv->force, (conv->target.x - ptcl->position.x)));
|
||||
ptcl->position.y += FX32_CAST(FX_MUL(conv->force, (conv->target.y - ptcl->position.y)));
|
||||
ptcl->position.z += FX32_CAST(FX_MUL(conv->force, (conv->target.z - ptcl->position.z)));
|
||||
}
|
||||
|
@ -153,42 +153,42 @@ void SPL_0209C988(SPLManager *mgr, const void *p_spa)
|
||||
|
||||
if (flag.unk_07_0) {
|
||||
fld->unk_04 = (const void *)((u8 *)spa + offset);
|
||||
fld->unk_00 = SPL_020A2204;
|
||||
fld->unk_00 = SPLBehavior_ApplyGravity;
|
||||
offset += sizeof(SPLGravityBehavior);
|
||||
fld++;
|
||||
}
|
||||
|
||||
if (flag.unk_07_1) {
|
||||
fld->unk_04 = (const void *)((u8 *)spa + offset);
|
||||
fld->unk_00 = SPL_020A213C;
|
||||
fld->unk_00 = SPLBehavior_ApplyRandom;
|
||||
offset += sizeof(SPLRandomBehavior);
|
||||
fld++;
|
||||
}
|
||||
|
||||
if (flag.unk_07_2) {
|
||||
fld->unk_04 = (const void *)((u8 *)spa + offset);
|
||||
fld->unk_00 = SPL_020A20B8;
|
||||
fld->unk_00 = SPLBehavior_ApplyMagnet;
|
||||
offset += sizeof(SPLMagnetBehavior);
|
||||
fld++;
|
||||
}
|
||||
|
||||
if (flag.unk_07_3) {
|
||||
fld->unk_04 = (const void *)((u8 *)spa + offset);
|
||||
fld->unk_00 = SPL_020A1FE0;
|
||||
fld->unk_00 = SPLBehavior_ApplySpin;
|
||||
offset += sizeof(SPLSpinBehavior);
|
||||
fld++;
|
||||
}
|
||||
|
||||
if (flag.unk_07_4) {
|
||||
fld->unk_04 = (const void *)((u8 *)spa + offset);
|
||||
fld->unk_00 = SPL_020A1EC4;
|
||||
offset += sizeof(SPLCollisionBehavior);
|
||||
fld->unk_00 = SPLBehavior_ApplyCollisionPlane;
|
||||
offset += sizeof(SPLCollisionPlaneBehavior);
|
||||
fld++;
|
||||
}
|
||||
|
||||
if (flag.unk_07_5) {
|
||||
fld->unk_04 = (void *)((u8 *)spa + offset);
|
||||
fld->unk_00 = SPL_020A1E30;
|
||||
fld->unk_00 = SPLBehavior_ApplyConvergence;
|
||||
offset += sizeof(SPLConvergenceBehavior);
|
||||
}
|
||||
} else {
|
||||
|
@ -89,7 +89,7 @@ void sub_0209D998(SPLEmitter *emtr, UnkSPLStruct4 *res, const VecFx32 *pos)
|
||||
emtr->unk_F0.unk_01_0 = emtr->p_res->unk_00->unk_48.unk_01_0;
|
||||
emtr->unk_F0.unk_02_0 = 0;
|
||||
emtr->unk_F0.unk_02_3 = 0;
|
||||
emtr->unk_E4 = FX32_MIN;
|
||||
emtr->collisionPlaneHeight = FX32_MIN;
|
||||
emtr->unk_E8 = FX32_ONE << emtr->p_res->unk_00->unk_48.unk_07_0;
|
||||
emtr->unk_EA = FX32_ONE << emtr->p_res->unk_00->unk_48.unk_07_2;
|
||||
|
||||
@ -180,8 +180,8 @@ void sub_0209D150(SPLManager *mgr, SPLEmitter *emtr)
|
||||
|
||||
for (ptcl = emtr->unk_08.unk_00; ptcl != NULL; ptcl = next) {
|
||||
next = ptcl->unk_00;
|
||||
lifeRates[0] = ptcl->unk_2A * ptcl->unk_26 >> 8;
|
||||
lifeRates[1] = ptcl->unk_2C.unk_01 + (ptcl->unk_28 * ptcl->unk_26 >> 8);
|
||||
lifeRates[0] = ptcl->unk_2A * ptcl->age >> 8;
|
||||
lifeRates[1] = ptcl->unk_2C.unk_01 + (ptcl->unk_28 * ptcl->age >> 8);
|
||||
|
||||
for (i = 0; i < fieldIndex; i++) {
|
||||
fieldFuncs[i].func(ptcl, res, lifeRates[fieldFuncs[i].loop]);
|
||||
@ -190,7 +190,7 @@ void sub_0209D150(SPLManager *mgr, SPLEmitter *emtr)
|
||||
vec.x = vec.y = vec.z = 0;
|
||||
|
||||
if (resFlags.unk_05_7) {
|
||||
ptcl->unk_38 = emtr->unk_98;
|
||||
ptcl->emitterPos = emtr->unk_98;
|
||||
}
|
||||
|
||||
for (i = 0; i < fldNum; i++) {
|
||||
@ -199,21 +199,21 @@ void sub_0209D150(SPLManager *mgr, SPLEmitter *emtr)
|
||||
|
||||
ptcl->unk_20 += ptcl->unk_22;
|
||||
|
||||
ptcl->unk_14.x = (ptcl->unk_14.x * airResistance >> 9);
|
||||
ptcl->unk_14.y = (ptcl->unk_14.y * airResistance >> 9);
|
||||
ptcl->unk_14.z = (ptcl->unk_14.z * airResistance >> 9);
|
||||
ptcl->velocity.x = (ptcl->velocity.x * airResistance >> 9);
|
||||
ptcl->velocity.y = (ptcl->velocity.y * airResistance >> 9);
|
||||
ptcl->velocity.z = (ptcl->velocity.z * airResistance >> 9);
|
||||
|
||||
ptcl->unk_14.x += vec.x;
|
||||
ptcl->unk_14.y += vec.y;
|
||||
ptcl->unk_14.z += vec.z;
|
||||
ptcl->velocity.x += vec.x;
|
||||
ptcl->velocity.y += vec.y;
|
||||
ptcl->velocity.z += vec.z;
|
||||
|
||||
ptcl->unk_08.x += ptcl->unk_14.x + emtr->unk_A4.x;
|
||||
ptcl->unk_08.y += ptcl->unk_14.y + emtr->unk_A4.y;
|
||||
ptcl->unk_08.z += ptcl->unk_14.z + emtr->unk_A4.z;
|
||||
ptcl->position.x += ptcl->velocity.x + emtr->unk_A4.x;
|
||||
ptcl->position.y += ptcl->velocity.y + emtr->unk_A4.y;
|
||||
ptcl->position.z += ptcl->velocity.z + emtr->unk_A4.z;
|
||||
|
||||
if (resFlags.unk_06_0) {
|
||||
fx32 x = FX_MUL((fx32)ptcl->unk_24 << FX32_SHIFT, (fx32)child->unk_0C.unk_01_0 << FX32_SHIFT);
|
||||
fx32 a = (fx32)ptcl->unk_26 * FX32_ONE;
|
||||
fx32 x = FX_MUL((fx32)ptcl->lifeTime << FX32_SHIFT, (fx32)child->unk_0C.unk_01_0 << FX32_SHIFT);
|
||||
fx32 a = (fx32)ptcl->age * FX32_ONE;
|
||||
fx32 diff = a - (x >> 8);
|
||||
|
||||
if (diff >= 0) {
|
||||
@ -234,9 +234,9 @@ void sub_0209D150(SPLManager *mgr, SPLEmitter *emtr)
|
||||
}
|
||||
}
|
||||
|
||||
ptcl->unk_26 += 1;
|
||||
ptcl->age += 1;
|
||||
|
||||
if (ptcl->unk_26 > ptcl->unk_24) {
|
||||
if (ptcl->age > ptcl->lifeTime) {
|
||||
SPLNode *node = SPLList_Erase((SPLList *)(&emtr->unk_08), (SPLNode *)ptcl);
|
||||
SPLList_PushFront((SPLList *)&mgr->unk_1C, node);
|
||||
}
|
||||
@ -260,7 +260,7 @@ void sub_0209D150(SPLManager *mgr, SPLEmitter *emtr)
|
||||
|
||||
for (ptcl = emtr->unk_4C.unk_00; ptcl != NULL; ptcl = next) {
|
||||
next = ptcl->unk_00;
|
||||
lifeRates[0] = (ptcl->unk_26 << 8) / ptcl->unk_24;
|
||||
lifeRates[0] = (ptcl->age << 8) / ptcl->lifeTime;
|
||||
for (i = 0; i < fieldIndex; i++) {
|
||||
u8 lifeRate = lifeRates[0];
|
||||
fieldFuncs2[i].func(ptcl, res, lifeRate);
|
||||
@ -269,7 +269,7 @@ void sub_0209D150(SPLManager *mgr, SPLEmitter *emtr)
|
||||
vec.x = vec.y = vec.z = 0;
|
||||
|
||||
if (child->unk_00.unk_02_5) {
|
||||
ptcl->unk_38 = emtr->unk_98;
|
||||
ptcl->emitterPos = emtr->unk_98;
|
||||
}
|
||||
|
||||
for (i = 0; i < fldNum; i++) {
|
||||
@ -278,17 +278,17 @@ void sub_0209D150(SPLManager *mgr, SPLEmitter *emtr)
|
||||
|
||||
ptcl->unk_20 += ptcl->unk_22;
|
||||
|
||||
ptcl->unk_14.x = ptcl->unk_14.x * airResistance >> 9;
|
||||
ptcl->unk_14.y = ptcl->unk_14.y * airResistance >> 9;
|
||||
ptcl->unk_14.z = ptcl->unk_14.z * airResistance >> 9;
|
||||
ptcl->velocity.x = ptcl->velocity.x * airResistance >> 9;
|
||||
ptcl->velocity.y = ptcl->velocity.y * airResistance >> 9;
|
||||
ptcl->velocity.z = ptcl->velocity.z * airResistance >> 9;
|
||||
|
||||
ptcl->unk_14.x += vec.x;
|
||||
ptcl->unk_14.y += vec.y;
|
||||
ptcl->unk_14.z += vec.z;
|
||||
ptcl->velocity.x += vec.x;
|
||||
ptcl->velocity.y += vec.y;
|
||||
ptcl->velocity.z += vec.z;
|
||||
|
||||
ptcl->unk_08.x += ptcl->unk_14.x + emtr->unk_A4.x;
|
||||
ptcl->unk_08.y += ptcl->unk_14.y + emtr->unk_A4.y;
|
||||
ptcl->unk_08.z += ptcl->unk_14.z + emtr->unk_A4.z;
|
||||
ptcl->position.x += ptcl->velocity.x + emtr->unk_A4.x;
|
||||
ptcl->position.y += ptcl->velocity.y + emtr->unk_A4.y;
|
||||
ptcl->position.z += ptcl->velocity.z + emtr->unk_A4.z;
|
||||
|
||||
if (emtr->p_res->unk_00->unk_00.unk_07_7) {
|
||||
ptcl->unk_2E.unk_01_2 = mgr->unk_38.unk_02_2;
|
||||
@ -301,9 +301,9 @@ void sub_0209D150(SPLManager *mgr, SPLEmitter *emtr)
|
||||
}
|
||||
}
|
||||
|
||||
ptcl->unk_26 += 1;
|
||||
ptcl->age += 1;
|
||||
|
||||
if (ptcl->unk_26 > ptcl->unk_24) {
|
||||
if (ptcl->age > ptcl->lifeTime) {
|
||||
SPLList_PushFront((SPLList *)&mgr->unk_1C, SPLList_Erase((SPLList *)(&emtr->unk_4C), (SPLNode *)ptcl));
|
||||
}
|
||||
}
|
||||
|
@ -169,9 +169,9 @@ void sub_0209FF0C(SPLManager *mgr, SPLParticle *ptcl)
|
||||
}
|
||||
|
||||
if (!mgr->unk_40.unk_00->p_res->unk_00->unk_00.unk_06_7) {
|
||||
trs.x = ptcl->unk_08.x + ptcl->unk_38.x;
|
||||
trs.y = ptcl->unk_08.y + ptcl->unk_38.y;
|
||||
trs.z = ptcl->unk_08.z + ptcl->unk_38.z;
|
||||
trs.x = ptcl->position.x + ptcl->emitterPos.x;
|
||||
trs.y = ptcl->position.y + ptcl->emitterPos.y;
|
||||
trs.z = ptcl->position.z + ptcl->emitterPos.z;
|
||||
MTX_MultVec43(&trs, cmr, &trs);
|
||||
|
||||
sin = FX_SinIdx(ptcl->unk_20);
|
||||
@ -192,9 +192,9 @@ void sub_0209FF0C(SPLManager *mgr, SPLParticle *ptcl)
|
||||
G3_Identity();
|
||||
G3_MultMtx43(&load);
|
||||
} else {
|
||||
trs.x = ptcl->unk_08.x + ptcl->unk_38.x - mgr->unk_40.unk_00->p_res->unk_00->unk_04.x;
|
||||
trs.y = ptcl->unk_08.y + ptcl->unk_38.y - mgr->unk_40.unk_00->p_res->unk_00->unk_04.y;
|
||||
trs.z = ptcl->unk_08.z + ptcl->unk_38.z - mgr->unk_40.unk_00->p_res->unk_00->unk_04.z;
|
||||
trs.x = ptcl->position.x + ptcl->emitterPos.x - mgr->unk_40.unk_00->p_res->unk_00->unk_04.x;
|
||||
trs.y = ptcl->position.y + ptcl->emitterPos.y - mgr->unk_40.unk_00->p_res->unk_00->unk_04.y;
|
||||
trs.z = ptcl->position.z + ptcl->emitterPos.z - mgr->unk_40.unk_00->p_res->unk_00->unk_04.z;
|
||||
MTX_MultVec43(&trs, cmr, &trs);
|
||||
|
||||
sin = FX_SinIdx(ptcl->unk_20);
|
||||
@ -275,9 +275,9 @@ void sub_0209FAB8(SPLManager *mgr, SPLParticle *ptcl)
|
||||
}
|
||||
|
||||
if (!mgr->unk_40.unk_00->p_res->unk_00->unk_00.unk_06_7) {
|
||||
trs.x = ptcl->unk_08.x + ptcl->unk_38.x;
|
||||
trs.y = ptcl->unk_08.y + ptcl->unk_38.y;
|
||||
trs.z = ptcl->unk_08.z + ptcl->unk_38.z;
|
||||
trs.x = ptcl->position.x + ptcl->emitterPos.x;
|
||||
trs.y = ptcl->position.y + ptcl->emitterPos.y;
|
||||
trs.z = ptcl->position.z + ptcl->emitterPos.z;
|
||||
MTX_MultVec43(&trs, cmr, &trs);
|
||||
|
||||
sin = FX_SinIdx(ptcl->unk_20);
|
||||
@ -298,9 +298,9 @@ void sub_0209FAB8(SPLManager *mgr, SPLParticle *ptcl)
|
||||
G3_Identity();
|
||||
G3_MultMtx43(&load);
|
||||
} else {
|
||||
trs.x = ptcl->unk_08.x + ptcl->unk_38.x - mgr->unk_40.unk_00->p_res->unk_00->unk_04.x;
|
||||
trs.y = ptcl->unk_08.y + ptcl->unk_38.y - mgr->unk_40.unk_00->p_res->unk_00->unk_04.y;
|
||||
trs.z = ptcl->unk_08.z + ptcl->unk_38.z - mgr->unk_40.unk_00->p_res->unk_00->unk_04.z;
|
||||
trs.x = ptcl->position.x + ptcl->emitterPos.x - mgr->unk_40.unk_00->p_res->unk_00->unk_04.x;
|
||||
trs.y = ptcl->position.y + ptcl->emitterPos.y - mgr->unk_40.unk_00->p_res->unk_00->unk_04.y;
|
||||
trs.z = ptcl->position.z + ptcl->emitterPos.z - mgr->unk_40.unk_00->p_res->unk_00->unk_04.z;
|
||||
MTX_MultVec43(&trs, cmr, &trs);
|
||||
|
||||
sin = FX_SinIdx(ptcl->unk_20);
|
||||
@ -386,11 +386,11 @@ void sub_0209F3D0(SPLManager *mgr, SPLParticle *ptcl)
|
||||
}
|
||||
|
||||
if (!mgr->unk_40.unk_00->p_res->unk_00->unk_00.unk_06_7) {
|
||||
trs.x = ptcl->unk_08.x + ptcl->unk_38.x;
|
||||
trs.y = ptcl->unk_08.y + ptcl->unk_38.y;
|
||||
trs.z = ptcl->unk_08.z + ptcl->unk_38.z;
|
||||
trs.x = ptcl->position.x + ptcl->emitterPos.x;
|
||||
trs.y = ptcl->position.y + ptcl->emitterPos.y;
|
||||
trs.z = ptcl->position.z + ptcl->emitterPos.z;
|
||||
|
||||
dir = ptcl->unk_14;
|
||||
dir = ptcl->velocity;
|
||||
|
||||
look.x = cmr->m[0][2];
|
||||
look.y = cmr->m[1][2];
|
||||
@ -406,7 +406,7 @@ void sub_0209F3D0(SPLManager *mgr, SPLParticle *ptcl)
|
||||
MTX_MultVec33(&dir, &mtx, &dir);
|
||||
MTX_MultVec43(&trs, cmr, &trs);
|
||||
|
||||
vel_dir = ptcl->unk_14;
|
||||
vel_dir = ptcl->velocity;
|
||||
VEC_Normalize(&vel_dir, &vel_dir);
|
||||
|
||||
dot = FX_MUL(vel_dir.x, -cmr->m[0][2]) + FX_MUL(vel_dir.y, -cmr->m[1][2]) + FX_MUL(vel_dir.z, -cmr->m[2][2]);
|
||||
@ -431,11 +431,11 @@ void sub_0209F3D0(SPLManager *mgr, SPLParticle *ptcl)
|
||||
G3_Identity();
|
||||
G3_MultMtx43(&load);
|
||||
} else {
|
||||
trs.x = ptcl->unk_08.x + ptcl->unk_38.x - mgr->unk_40.unk_00->p_res->unk_00->unk_04.x;
|
||||
trs.y = ptcl->unk_08.y + ptcl->unk_38.y - mgr->unk_40.unk_00->p_res->unk_00->unk_04.y;
|
||||
trs.z = ptcl->unk_08.z + ptcl->unk_38.z - mgr->unk_40.unk_00->p_res->unk_00->unk_04.z;
|
||||
trs.x = ptcl->position.x + ptcl->emitterPos.x - mgr->unk_40.unk_00->p_res->unk_00->unk_04.x;
|
||||
trs.y = ptcl->position.y + ptcl->emitterPos.y - mgr->unk_40.unk_00->p_res->unk_00->unk_04.y;
|
||||
trs.z = ptcl->position.z + ptcl->emitterPos.z - mgr->unk_40.unk_00->p_res->unk_00->unk_04.z;
|
||||
|
||||
dir = ptcl->unk_14;
|
||||
dir = ptcl->velocity;
|
||||
|
||||
look.x = cmr->m[0][2];
|
||||
look.y = cmr->m[1][2];
|
||||
@ -451,7 +451,7 @@ void sub_0209F3D0(SPLManager *mgr, SPLParticle *ptcl)
|
||||
MTX_MultVec33(&dir, &mtx, &dir);
|
||||
MTX_MultVec43(&trs, cmr, &trs);
|
||||
|
||||
vel_dir = ptcl->unk_14;
|
||||
vel_dir = ptcl->velocity;
|
||||
VEC_Normalize(&vel_dir, &vel_dir);
|
||||
|
||||
dot = FX_MUL(vel_dir.x, -cmr->m[0][2]) + FX_MUL(vel_dir.y, -cmr->m[1][2]) + FX_MUL(vel_dir.z, -cmr->m[2][2]);
|
||||
@ -541,11 +541,11 @@ void sub_0209ECF0(SPLManager *mgr, SPLParticle *ptcl)
|
||||
}
|
||||
|
||||
if (!mgr->unk_40.unk_00->p_res->unk_00->unk_00.unk_06_7) {
|
||||
trs.x = ptcl->unk_08.x + ptcl->unk_38.x;
|
||||
trs.y = ptcl->unk_08.y + ptcl->unk_38.y;
|
||||
trs.z = ptcl->unk_08.z + ptcl->unk_38.z;
|
||||
trs.x = ptcl->position.x + ptcl->emitterPos.x;
|
||||
trs.y = ptcl->position.y + ptcl->emitterPos.y;
|
||||
trs.z = ptcl->position.z + ptcl->emitterPos.z;
|
||||
|
||||
dir = ptcl->unk_14;
|
||||
dir = ptcl->velocity;
|
||||
|
||||
look.x = cmr->m[0][2];
|
||||
look.y = cmr->m[1][2];
|
||||
@ -561,7 +561,7 @@ void sub_0209ECF0(SPLManager *mgr, SPLParticle *ptcl)
|
||||
MTX_MultVec33(&dir, &mtx, &dir);
|
||||
MTX_MultVec43(&trs, cmr, &trs);
|
||||
|
||||
vel_dir = ptcl->unk_14;
|
||||
vel_dir = ptcl->velocity;
|
||||
VEC_Normalize(&vel_dir, &vel_dir);
|
||||
|
||||
dot = FX_MUL(vel_dir.x, -cmr->m[0][2]) + FX_MUL(vel_dir.y, -cmr->m[1][2]) + FX_MUL(vel_dir.z, -cmr->m[2][2]);
|
||||
@ -586,11 +586,11 @@ void sub_0209ECF0(SPLManager *mgr, SPLParticle *ptcl)
|
||||
G3_Identity();
|
||||
G3_MultMtx43(&load);
|
||||
} else {
|
||||
trs.x = ptcl->unk_08.x + ptcl->unk_38.x - mgr->unk_40.unk_00->p_res->unk_00->unk_04.x;
|
||||
trs.y = ptcl->unk_08.y + ptcl->unk_38.y - mgr->unk_40.unk_00->p_res->unk_00->unk_04.y;
|
||||
trs.z = ptcl->unk_08.z + ptcl->unk_38.z - mgr->unk_40.unk_00->p_res->unk_00->unk_04.z;
|
||||
trs.x = ptcl->position.x + ptcl->emitterPos.x - mgr->unk_40.unk_00->p_res->unk_00->unk_04.x;
|
||||
trs.y = ptcl->position.y + ptcl->emitterPos.y - mgr->unk_40.unk_00->p_res->unk_00->unk_04.y;
|
||||
trs.z = ptcl->position.z + ptcl->emitterPos.z - mgr->unk_40.unk_00->p_res->unk_00->unk_04.z;
|
||||
|
||||
dir = ptcl->unk_14;
|
||||
dir = ptcl->velocity;
|
||||
|
||||
look.x = cmr->m[0][2];
|
||||
look.y = cmr->m[1][2];
|
||||
@ -606,7 +606,7 @@ void sub_0209ECF0(SPLManager *mgr, SPLParticle *ptcl)
|
||||
MTX_MultVec33(&dir, &mtx, &dir);
|
||||
MTX_MultVec43(&trs, cmr, &trs);
|
||||
|
||||
vel_dir = ptcl->unk_14;
|
||||
vel_dir = ptcl->velocity;
|
||||
VEC_Normalize(&vel_dir, &vel_dir);
|
||||
|
||||
dot = FX_MUL(vel_dir.x, -cmr->m[0][2]) + FX_MUL(vel_dir.y, -cmr->m[1][2]) + FX_MUL(vel_dir.z, -cmr->m[2][2]);
|
||||
@ -698,15 +698,15 @@ void sub_0209E9A0(SPLManager *mgr, SPLParticle *ptcl)
|
||||
|
||||
// resBase = mgr->unk_40.unk_00->p_res->unk_00;
|
||||
if (!mgr->unk_40.unk_00->p_res->unk_00->unk_00.unk_06_7) {
|
||||
load.m[3][0] = ptcl->unk_08.x + ptcl->unk_38.x;
|
||||
load.m[3][1] = ptcl->unk_08.y + ptcl->unk_38.y;
|
||||
load.m[3][2] = ptcl->unk_08.z + ptcl->unk_38.z;
|
||||
load.m[3][0] = ptcl->position.x + ptcl->emitterPos.x;
|
||||
load.m[3][1] = ptcl->position.y + ptcl->emitterPos.y;
|
||||
load.m[3][2] = ptcl->position.z + ptcl->emitterPos.z;
|
||||
G3_LoadMtx43(mgr->unk_40.unk_04);
|
||||
G3_MultMtx43(&load);
|
||||
} else {
|
||||
load.m[3][0] = ptcl->unk_08.x + ptcl->unk_38.x - mgr->unk_40.unk_00->p_res->unk_00->unk_04.x;
|
||||
load.m[3][1] = ptcl->unk_08.y + ptcl->unk_38.y - mgr->unk_40.unk_00->p_res->unk_00->unk_04.y;
|
||||
load.m[3][2] = ptcl->unk_08.z + ptcl->unk_38.z - mgr->unk_40.unk_00->p_res->unk_00->unk_04.z;
|
||||
load.m[3][0] = ptcl->position.x + ptcl->emitterPos.x - mgr->unk_40.unk_00->p_res->unk_00->unk_04.x;
|
||||
load.m[3][1] = ptcl->position.y + ptcl->emitterPos.y - mgr->unk_40.unk_00->p_res->unk_00->unk_04.y;
|
||||
load.m[3][2] = ptcl->position.z + ptcl->emitterPos.z - mgr->unk_40.unk_00->p_res->unk_00->unk_04.z;
|
||||
|
||||
G3_Identity();
|
||||
|
||||
@ -780,15 +780,15 @@ void sub_0209E650(SPLManager *mgr, SPLParticle *ptcl)
|
||||
MTX_Concat43(&rotMtx, &sclMtx, &load);
|
||||
|
||||
if (!mgr->unk_40.unk_00->p_res->unk_00->unk_00.unk_06_7) {
|
||||
load.m[3][0] = ptcl->unk_08.x + ptcl->unk_38.x;
|
||||
load.m[3][1] = ptcl->unk_08.y + ptcl->unk_38.y;
|
||||
load.m[3][2] = ptcl->unk_08.z + ptcl->unk_38.z;
|
||||
load.m[3][0] = ptcl->position.x + ptcl->emitterPos.x;
|
||||
load.m[3][1] = ptcl->position.y + ptcl->emitterPos.y;
|
||||
load.m[3][2] = ptcl->position.z + ptcl->emitterPos.z;
|
||||
G3_LoadMtx43(mgr->unk_40.unk_04);
|
||||
G3_MultMtx43(&load);
|
||||
} else {
|
||||
load.m[3][0] = ptcl->unk_08.x + ptcl->unk_38.x - mgr->unk_40.unk_00->p_res->unk_00->unk_04.x;
|
||||
load.m[3][1] = ptcl->unk_08.y + ptcl->unk_38.y - mgr->unk_40.unk_00->p_res->unk_00->unk_04.y;
|
||||
load.m[3][2] = ptcl->unk_08.z + ptcl->unk_38.z - mgr->unk_40.unk_00->p_res->unk_00->unk_04.z;
|
||||
load.m[3][0] = ptcl->position.x + ptcl->emitterPos.x - mgr->unk_40.unk_00->p_res->unk_00->unk_04.x;
|
||||
load.m[3][1] = ptcl->position.y + ptcl->emitterPos.y - mgr->unk_40.unk_00->p_res->unk_00->unk_04.y;
|
||||
load.m[3][2] = ptcl->position.z + ptcl->emitterPos.z - mgr->unk_40.unk_00->p_res->unk_00->unk_04.z;
|
||||
|
||||
G3_Identity();
|
||||
|
||||
@ -842,9 +842,9 @@ void sub_0209E1D4(SPLManager *mgr, SPLParticle *ptcl)
|
||||
MTX_Identity43(&mat);
|
||||
|
||||
if (!mgr->unk_40.unk_00->p_res->unk_00->unk_48.unk_07_7) {
|
||||
VEC_Normalize(&ptcl->unk_14, &vec1);
|
||||
VEC_Normalize(&ptcl->velocity, &vec1);
|
||||
} else {
|
||||
VEC_Normalize(&ptcl->unk_08, &vec1);
|
||||
VEC_Normalize(&ptcl->position, &vec1);
|
||||
vec1.x = -vec1.x;
|
||||
vec1.y = -vec1.y;
|
||||
vec1.z = -vec1.z;
|
||||
@ -899,15 +899,15 @@ void sub_0209E1D4(SPLManager *mgr, SPLParticle *ptcl)
|
||||
|
||||
resBase = mgr->unk_40.unk_00->p_res->unk_00;
|
||||
if (!resBase->unk_00.unk_06_7) {
|
||||
transform.m[3][0] = ptcl->unk_08.x + ptcl->unk_38.x;
|
||||
transform.m[3][1] = ptcl->unk_08.y + ptcl->unk_38.y;
|
||||
transform.m[3][2] = ptcl->unk_08.z + ptcl->unk_38.z;
|
||||
transform.m[3][0] = ptcl->position.x + ptcl->emitterPos.x;
|
||||
transform.m[3][1] = ptcl->position.y + ptcl->emitterPos.y;
|
||||
transform.m[3][2] = ptcl->position.z + ptcl->emitterPos.z;
|
||||
G3_LoadMtx43(mgr->unk_40.unk_04);
|
||||
G3_MultMtx43(&transform);
|
||||
} else {
|
||||
transform.m[3][0] = ptcl->unk_08.x + ptcl->unk_38.x - resBase->unk_04.x;
|
||||
transform.m[3][1] = ptcl->unk_08.y + ptcl->unk_38.y - mgr->unk_40.unk_00->p_res->unk_00->unk_04.y;
|
||||
transform.m[3][2] = ptcl->unk_08.z + ptcl->unk_38.z - mgr->unk_40.unk_00->p_res->unk_00->unk_04.z;
|
||||
transform.m[3][0] = ptcl->position.x + ptcl->emitterPos.x - resBase->unk_04.x;
|
||||
transform.m[3][1] = ptcl->position.y + ptcl->emitterPos.y - mgr->unk_40.unk_00->p_res->unk_00->unk_04.y;
|
||||
transform.m[3][2] = ptcl->position.z + ptcl->emitterPos.z - mgr->unk_40.unk_00->p_res->unk_00->unk_04.z;
|
||||
|
||||
G3_Identity();
|
||||
|
||||
@ -960,9 +960,9 @@ void sub_0209DD54(SPLManager *mgr, SPLParticle *ptcl)
|
||||
MTX_Identity43(&mat);
|
||||
|
||||
if (!mgr->unk_40.unk_00->p_res->unk_14->unk_0C.unk_04_6) {
|
||||
VEC_Normalize(&ptcl->unk_14, &vec1);
|
||||
VEC_Normalize(&ptcl->velocity, &vec1);
|
||||
} else {
|
||||
VEC_Normalize(&ptcl->unk_08, &vec1);
|
||||
VEC_Normalize(&ptcl->position, &vec1);
|
||||
vec1.x = -vec1.x;
|
||||
vec1.y = -vec1.y;
|
||||
vec1.z = -vec1.z;
|
||||
@ -1017,15 +1017,15 @@ void sub_0209DD54(SPLManager *mgr, SPLParticle *ptcl)
|
||||
|
||||
resBase = mgr->unk_40.unk_00->p_res->unk_00;
|
||||
if (!resBase->unk_00.unk_06_7) {
|
||||
transform.m[3][0] = ptcl->unk_08.x + ptcl->unk_38.x;
|
||||
transform.m[3][1] = ptcl->unk_08.y + ptcl->unk_38.y;
|
||||
transform.m[3][2] = ptcl->unk_08.z + ptcl->unk_38.z;
|
||||
transform.m[3][0] = ptcl->position.x + ptcl->emitterPos.x;
|
||||
transform.m[3][1] = ptcl->position.y + ptcl->emitterPos.y;
|
||||
transform.m[3][2] = ptcl->position.z + ptcl->emitterPos.z;
|
||||
G3_LoadMtx43(mgr->unk_40.unk_04);
|
||||
G3_MultMtx43(&transform);
|
||||
} else {
|
||||
transform.m[3][0] = ptcl->unk_08.x + ptcl->unk_38.x - resBase->unk_04.x;
|
||||
transform.m[3][1] = ptcl->unk_08.y + ptcl->unk_38.y - mgr->unk_40.unk_00->p_res->unk_00->unk_04.y;
|
||||
transform.m[3][2] = ptcl->unk_08.z + ptcl->unk_38.z - mgr->unk_40.unk_00->p_res->unk_00->unk_04.z;
|
||||
transform.m[3][0] = ptcl->position.x + ptcl->emitterPos.x - resBase->unk_04.x;
|
||||
transform.m[3][1] = ptcl->position.y + ptcl->emitterPos.y - mgr->unk_40.unk_00->p_res->unk_00->unk_04.y;
|
||||
transform.m[3][2] = ptcl->position.z + ptcl->emitterPos.z - mgr->unk_40.unk_00->p_res->unk_00->unk_04.z;
|
||||
|
||||
G3_Identity();
|
||||
|
||||
|
@ -108,14 +108,14 @@ void sub_020A08DC(SPLEmitter *emtr, SPLList *list)
|
||||
|
||||
switch (resBase->unk_00.unk_04_0) {
|
||||
case 0:
|
||||
ptcl->unk_08.x = ptcl->unk_08.y = ptcl->unk_08.z = 0;
|
||||
ptcl->position.x = ptcl->position.y = ptcl->position.z = 0;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
SPLRandom_VecFx32(&ptcl->unk_08);
|
||||
ptcl->unk_08.x = FX_MUL(ptcl->unk_08.x, emtr->unk_CC);
|
||||
ptcl->unk_08.y = FX_MUL(ptcl->unk_08.y, emtr->unk_CC);
|
||||
ptcl->unk_08.z = FX_MUL(ptcl->unk_08.z, emtr->unk_CC);
|
||||
SPLRandom_VecFx32(&ptcl->position);
|
||||
ptcl->position.x = FX_MUL(ptcl->position.x, emtr->unk_CC);
|
||||
ptcl->position.y = FX_MUL(ptcl->position.y, emtr->unk_CC);
|
||||
ptcl->position.z = FX_MUL(ptcl->position.z, emtr->unk_CC);
|
||||
break;
|
||||
|
||||
case 2: {
|
||||
@ -124,7 +124,7 @@ void sub_020A08DC(SPLEmitter *emtr, SPLList *list)
|
||||
pos.x = FX_MUL(pos.x, emtr->unk_CC);
|
||||
pos.y = FX_MUL(pos.y, emtr->unk_CC);
|
||||
pos.z = 0;
|
||||
sub_020A1608(&ptcl->unk_08, &pos, emtr);
|
||||
sub_020A1608(&ptcl->position, &pos, emtr);
|
||||
} break;
|
||||
|
||||
case 3: {
|
||||
@ -136,14 +136,14 @@ void sub_020A08DC(SPLEmitter *emtr, SPLList *list)
|
||||
pos.x = FX_MUL(sin, emtr->unk_CC);
|
||||
pos.y = FX_MUL(cos, emtr->unk_CC);
|
||||
pos.z = 0;
|
||||
sub_020A1608(&ptcl->unk_08, &pos, emtr);
|
||||
sub_020A1608(&ptcl->position, &pos, emtr);
|
||||
} break;
|
||||
|
||||
case 4:
|
||||
SPLRandom_VecFx32(&ptcl->unk_08);
|
||||
ptcl->unk_08.x = FX_MUL(FX_MUL(ptcl->unk_08.x, emtr->unk_CC), SPLRandom_RangeFX32(FX32_ONE));
|
||||
ptcl->unk_08.y = FX_MUL(FX_MUL(ptcl->unk_08.y, emtr->unk_CC), SPLRandom_RangeFX32(FX32_ONE));
|
||||
ptcl->unk_08.z = FX_MUL(FX_MUL(ptcl->unk_08.z, emtr->unk_CC), SPLRandom_RangeFX32(FX32_ONE));
|
||||
SPLRandom_VecFx32(&ptcl->position);
|
||||
ptcl->position.x = FX_MUL(FX_MUL(ptcl->position.x, emtr->unk_CC), SPLRandom_RangeFX32(FX32_ONE));
|
||||
ptcl->position.y = FX_MUL(FX_MUL(ptcl->position.y, emtr->unk_CC), SPLRandom_RangeFX32(FX32_ONE));
|
||||
ptcl->position.z = FX_MUL(FX_MUL(ptcl->position.z, emtr->unk_CC), SPLRandom_RangeFX32(FX32_ONE));
|
||||
break;
|
||||
|
||||
case 5: {
|
||||
@ -151,63 +151,63 @@ void sub_020A08DC(SPLEmitter *emtr, SPLList *list)
|
||||
SPLRandom_VecFx32_XY(&pos);
|
||||
pos.x = FX_MUL(FX_MUL(pos.x, emtr->unk_CC), SPLRandom_RangeFX32(FX32_ONE));
|
||||
pos.y = FX_MUL(FX_MUL(pos.y, emtr->unk_CC), SPLRandom_RangeFX32(FX32_ONE));
|
||||
sub_020A1608(&ptcl->unk_08, &pos, emtr);
|
||||
sub_020A1608(&ptcl->position, &pos, emtr);
|
||||
} break;
|
||||
|
||||
case 8: {
|
||||
VecFx32 pos;
|
||||
VecFx16 tmpUnitVec;
|
||||
SPLRandom_VecFx32(&ptcl->unk_08);
|
||||
SPLRandom_VecFx32(&ptcl->position);
|
||||
VEC_Fx16CrossProduct(&emtr->unk_F4, &emtr->unk_FA, &tmpUnitVec);
|
||||
pos.x = tmpUnitVec.x;
|
||||
pos.y = tmpUnitVec.y;
|
||||
pos.z = tmpUnitVec.z;
|
||||
if (VEC_DotProduct(&pos, &ptcl->unk_08) <= 0) {
|
||||
ptcl->unk_08.x = -ptcl->unk_08.x;
|
||||
ptcl->unk_08.y = -ptcl->unk_08.y;
|
||||
ptcl->unk_08.z = -ptcl->unk_08.z;
|
||||
if (VEC_DotProduct(&pos, &ptcl->position) <= 0) {
|
||||
ptcl->position.x = -ptcl->position.x;
|
||||
ptcl->position.y = -ptcl->position.y;
|
||||
ptcl->position.z = -ptcl->position.z;
|
||||
}
|
||||
|
||||
ptcl->unk_08.x = FX_MUL(ptcl->unk_08.x, emtr->unk_CC);
|
||||
ptcl->unk_08.y = FX_MUL(ptcl->unk_08.y, emtr->unk_CC);
|
||||
ptcl->unk_08.z = FX_MUL(ptcl->unk_08.z, emtr->unk_CC);
|
||||
ptcl->position.x = FX_MUL(ptcl->position.x, emtr->unk_CC);
|
||||
ptcl->position.y = FX_MUL(ptcl->position.y, emtr->unk_CC);
|
||||
ptcl->position.z = FX_MUL(ptcl->position.z, emtr->unk_CC);
|
||||
} break;
|
||||
|
||||
case 9: {
|
||||
VecFx32 pos;
|
||||
VecFx16 tmpUnitVec;
|
||||
SPLRandom_VecFx32(&ptcl->unk_08);
|
||||
SPLRandom_VecFx32(&ptcl->position);
|
||||
VEC_Fx16CrossProduct(&emtr->unk_F4, &emtr->unk_FA, &tmpUnitVec);
|
||||
pos.x = tmpUnitVec.x;
|
||||
pos.y = tmpUnitVec.y;
|
||||
pos.z = tmpUnitVec.z;
|
||||
if (VEC_DotProduct(&pos, &ptcl->unk_08) < 0) {
|
||||
ptcl->unk_08.x = -ptcl->unk_08.x;
|
||||
ptcl->unk_08.y = -ptcl->unk_08.y;
|
||||
ptcl->unk_08.z = -ptcl->unk_08.z;
|
||||
if (VEC_DotProduct(&pos, &ptcl->position) < 0) {
|
||||
ptcl->position.x = -ptcl->position.x;
|
||||
ptcl->position.y = -ptcl->position.y;
|
||||
ptcl->position.z = -ptcl->position.z;
|
||||
}
|
||||
|
||||
ptcl->unk_08.x = FX_MUL(FX_MUL(ptcl->unk_08.x, emtr->unk_CC), (SPLRandom_RangeFX32(FX32_ONE) >> 1) + FX32_HALF);
|
||||
ptcl->unk_08.y = FX_MUL(FX_MUL(ptcl->unk_08.y, emtr->unk_CC), (SPLRandom_RangeFX32(FX32_ONE) >> 1) + FX32_HALF);
|
||||
ptcl->unk_08.z = FX_MUL(FX_MUL(ptcl->unk_08.z, emtr->unk_CC), (SPLRandom_RangeFX32(FX32_ONE) >> 1) + FX32_HALF);
|
||||
ptcl->position.x = FX_MUL(FX_MUL(ptcl->position.x, emtr->unk_CC), (SPLRandom_RangeFX32(FX32_ONE) >> 1) + FX32_HALF);
|
||||
ptcl->position.y = FX_MUL(FX_MUL(ptcl->position.y, emtr->unk_CC), (SPLRandom_RangeFX32(FX32_ONE) >> 1) + FX32_HALF);
|
||||
ptcl->position.z = FX_MUL(FX_MUL(ptcl->position.z, emtr->unk_CC), (SPLRandom_RangeFX32(FX32_ONE) >> 1) + FX32_HALF);
|
||||
} break;
|
||||
|
||||
case 6: {
|
||||
VecFx32 pos;
|
||||
SPLRandom_VecFx32_XY(&ptcl->unk_14);
|
||||
pos.x = FX_MUL(ptcl->unk_14.x, emtr->unk_CC);
|
||||
pos.y = FX_MUL(ptcl->unk_14.y, emtr->unk_CC);
|
||||
SPLRandom_VecFx32_XY(&ptcl->velocity);
|
||||
pos.x = FX_MUL(ptcl->velocity.x, emtr->unk_CC);
|
||||
pos.y = FX_MUL(ptcl->velocity.y, emtr->unk_CC);
|
||||
pos.z = SPLRandom_RangeFX32(emtr->unk_D0);
|
||||
sub_020A1608(&ptcl->unk_08, &pos, emtr);
|
||||
sub_020A1608(&ptcl->position, &pos, emtr);
|
||||
} break;
|
||||
|
||||
case 7: {
|
||||
VecFx32 pos;
|
||||
SPLRandom_VecFx32_XY(&ptcl->unk_14);
|
||||
pos.x = FX_MUL(FX_MUL(ptcl->unk_14.x, emtr->unk_CC), SPLRandom_RangeFX32(FX32_ONE));
|
||||
pos.y = FX_MUL(FX_MUL(ptcl->unk_14.y, emtr->unk_CC), SPLRandom_RangeFX32(FX32_ONE));
|
||||
SPLRandom_VecFx32_XY(&ptcl->velocity);
|
||||
pos.x = FX_MUL(FX_MUL(ptcl->velocity.x, emtr->unk_CC), SPLRandom_RangeFX32(FX32_ONE));
|
||||
pos.y = FX_MUL(FX_MUL(ptcl->velocity.y, emtr->unk_CC), SPLRandom_RangeFX32(FX32_ONE));
|
||||
pos.z = SPLRandom_RangeFX32(emtr->unk_D0);
|
||||
sub_020A1608(&ptcl->unk_08, &pos, emtr);
|
||||
sub_020A1608(&ptcl->position, &pos, emtr);
|
||||
} break;
|
||||
}
|
||||
|
||||
@ -217,22 +217,22 @@ void sub_020A08DC(SPLEmitter *emtr, SPLList *list)
|
||||
VecFx32 posNorm;
|
||||
if (resBase->unk_00.unk_04_0 == 6) {
|
||||
VecFx32 tmp;
|
||||
tmp.x = FX_MUL(ptcl->unk_14.x, emtr->unk_F4.x) + FX_MUL(ptcl->unk_14.y, emtr->unk_FA.x);
|
||||
tmp.y = FX_MUL(ptcl->unk_14.x, emtr->unk_F4.y) + FX_MUL(ptcl->unk_14.y, emtr->unk_FA.y);
|
||||
tmp.z = FX_MUL(ptcl->unk_14.x, emtr->unk_F4.z) + FX_MUL(ptcl->unk_14.y, emtr->unk_FA.z);
|
||||
tmp.x = FX_MUL(ptcl->velocity.x, emtr->unk_F4.x) + FX_MUL(ptcl->velocity.y, emtr->unk_FA.x);
|
||||
tmp.y = FX_MUL(ptcl->velocity.x, emtr->unk_F4.y) + FX_MUL(ptcl->velocity.y, emtr->unk_FA.y);
|
||||
tmp.z = FX_MUL(ptcl->velocity.x, emtr->unk_F4.z) + FX_MUL(ptcl->velocity.y, emtr->unk_FA.z);
|
||||
|
||||
VEC_Normalize(&tmp, &posNorm);
|
||||
} else if (ptcl->unk_08.x == 0 && ptcl->unk_08.y == 0 && ptcl->unk_08.z == 0) {
|
||||
} else if (ptcl->position.x == 0 && ptcl->position.y == 0 && ptcl->position.z == 0) {
|
||||
SPLRandom_VecFx32(&posNorm);
|
||||
} else {
|
||||
VEC_Normalize(&ptcl->unk_08, &posNorm);
|
||||
VEC_Normalize(&ptcl->position, &posNorm);
|
||||
}
|
||||
|
||||
ptcl->unk_14.x = FX_MUL(posNorm.x, magPos) + FX_MUL(emtr->unk_C0.x, magAxis) + emtr->unk_B0.x;
|
||||
ptcl->unk_14.y = FX_MUL(posNorm.y, magPos) + FX_MUL(emtr->unk_C0.y, magAxis) + emtr->unk_B0.y;
|
||||
ptcl->unk_14.z = FX_MUL(posNorm.z, magPos) + FX_MUL(emtr->unk_C0.z, magAxis) + emtr->unk_B0.z;
|
||||
ptcl->velocity.x = FX_MUL(posNorm.x, magPos) + FX_MUL(emtr->unk_C0.x, magAxis) + emtr->unk_B0.x;
|
||||
ptcl->velocity.y = FX_MUL(posNorm.y, magPos) + FX_MUL(emtr->unk_C0.y, magAxis) + emtr->unk_B0.y;
|
||||
ptcl->velocity.z = FX_MUL(posNorm.z, magPos) + FX_MUL(emtr->unk_C0.z, magAxis) + emtr->unk_B0.z;
|
||||
|
||||
ptcl->unk_38 = emtr->unk_98;
|
||||
ptcl->emitterPos = emtr->unk_98;
|
||||
|
||||
ptcl->unk_30 = SPLRandom_DoubleScaledRangeFX32(emtr->unk_DC, resBase->unk_44.unk_00_0);
|
||||
ptcl->unk_34 = FX32_ONE;
|
||||
@ -263,8 +263,8 @@ void sub_020A08DC(SPLEmitter *emtr, SPLList *list)
|
||||
ptcl->unk_22 = 0;
|
||||
}
|
||||
|
||||
ptcl->unk_24 = SPLRandom_ScaledRangeFX32(emtr->unk_E0, resBase->unk_44.unk_01_0) + 1;
|
||||
ptcl->unk_26 = 0;
|
||||
ptcl->lifeTime = SPLRandom_ScaledRangeFX32(emtr->unk_E0, resBase->unk_44.unk_01_0) + 1;
|
||||
ptcl->age = 0;
|
||||
|
||||
if (resBase->unk_00.unk_05_3 && res->unk_10->unk_08.unk_02_0) {
|
||||
ptcl->unk_2C.unk_00 = res->unk_10->unk_00[SPLRandom_U32(12) % res->unk_10->unk_08.unk_00_0];
|
||||
@ -275,7 +275,7 @@ void sub_020A08DC(SPLEmitter *emtr, SPLList *list)
|
||||
}
|
||||
|
||||
ptcl->unk_28 = 0xFFFF / res->unk_00->unk_48.unk_04_0;
|
||||
ptcl->unk_2A = 0xFFFF / ptcl->unk_24;
|
||||
ptcl->unk_2A = 0xFFFF / ptcl->lifeTime;
|
||||
|
||||
ptcl->unk_2C.unk_01 = 0;
|
||||
|
||||
@ -303,21 +303,21 @@ void sub_020A05BC(SPLParticle *ptcl, SPLEmitter *emtr, SPLList *list)
|
||||
}
|
||||
SPLList_PushFront((SPLList *)&emtr->unk_4C, (SPLNode *)chld);
|
||||
|
||||
chld->unk_08 = ptcl->unk_08;
|
||||
chld->position = ptcl->position;
|
||||
|
||||
velBase = FX_MUL(ptcl->unk_14.x, vel);
|
||||
velBase = FX_MUL(ptcl->velocity.x, vel);
|
||||
velRand = SPLRandom_RangeFX32(chldRes->unk_02);
|
||||
chld->unk_14.x = velBase + velRand;
|
||||
chld->velocity.x = velBase + velRand;
|
||||
|
||||
velBase = FX_MUL(ptcl->unk_14.y, vel);
|
||||
velBase = FX_MUL(ptcl->velocity.y, vel);
|
||||
velRand = SPLRandom_RangeFX32(chldRes->unk_02);
|
||||
chld->unk_14.y = velBase + velRand;
|
||||
chld->velocity.y = velBase + velRand;
|
||||
|
||||
velBase = FX_MUL(ptcl->unk_14.z, vel);
|
||||
velBase = FX_MUL(ptcl->velocity.z, vel);
|
||||
velRand = SPLRandom_RangeFX32(chldRes->unk_02);
|
||||
chld->unk_14.z = velBase + velRand;
|
||||
chld->velocity.z = velBase + velRand;
|
||||
|
||||
chld->unk_38 = ptcl->unk_38;
|
||||
chld->emitterPos = ptcl->emitterPos;
|
||||
|
||||
// `unk_08.unk_00_0` and `unk_08.unk_01_0` in `UnkSPLStruct14`
|
||||
// could just be `u8 unk_08;` and `u8 unk_09;`
|
||||
@ -351,12 +351,12 @@ void sub_020A05BC(SPLParticle *ptcl, SPLEmitter *emtr, SPLList *list)
|
||||
break;
|
||||
}
|
||||
|
||||
chld->unk_24 = chldRes->unk_06;
|
||||
chld->unk_26 = 0;
|
||||
chld->lifeTime = chldRes->unk_06;
|
||||
chld->age = 0;
|
||||
chld->unk_2C.unk_00 = chldRes->unk_0C.unk_03_0;
|
||||
|
||||
chld->unk_28 = 0xFFFF / (ptcl->unk_24 / 2);
|
||||
chld->unk_2A = 0xFFFF / ptcl->unk_24;
|
||||
chld->unk_28 = 0xFFFF / (ptcl->lifeTime / 2);
|
||||
chld->unk_2A = 0xFFFF / ptcl->lifeTime;
|
||||
chld->unk_2C.unk_01 = 0;
|
||||
}
|
||||
}
|
||||
|
@ -2873,8 +2873,8 @@ static BOOL ov12_02229A50(SPLEmitter *param0)
|
||||
v1 = param0->unk_08.unk_00;
|
||||
|
||||
while (v1 != NULL) {
|
||||
v2 = v1->unk_26;
|
||||
v3 = v1->unk_24;
|
||||
v2 = v1->age;
|
||||
v3 = v1->lifeTime;
|
||||
v1 = v1->unk_00;
|
||||
}
|
||||
|
||||
|
@ -684,32 +684,32 @@ static const void *sub_020147B8(SPLEmitter *param0, int param1)
|
||||
|
||||
switch (param1) {
|
||||
case SPL_FLD_TYPE_GRAVITY:
|
||||
if (v2->unk_00 == SPL_020A2204) {
|
||||
if (v2->unk_00 == SPLBehavior_ApplyGravity) {
|
||||
return v2->unk_04;
|
||||
}
|
||||
continue;
|
||||
case SPL_FLD_TYPE_RANDOM:
|
||||
if (v2->unk_00 == SPL_020A213C) {
|
||||
if (v2->unk_00 == SPLBehavior_ApplyRandom) {
|
||||
return v2->unk_04;
|
||||
}
|
||||
continue;
|
||||
case SPL_FLD_TYPE_MAGNET:
|
||||
if (v2->unk_00 == SPL_020A20B8) {
|
||||
if (v2->unk_00 == SPLBehavior_ApplyMagnet) {
|
||||
return v2->unk_04;
|
||||
}
|
||||
continue;
|
||||
case SPL_FLD_TYPE_SPIN:
|
||||
if (v2->unk_00 == SPL_020A1FE0) {
|
||||
if (v2->unk_00 == SPLBehavior_ApplySpin) {
|
||||
return v2->unk_04;
|
||||
}
|
||||
continue;
|
||||
case SPL_FLD_TYPE_SIMPLE_COLL:
|
||||
if (v2->unk_00 == SPL_020A1EC4) {
|
||||
if (v2->unk_00 == SPLBehavior_ApplyCollisionPlane) {
|
||||
return v2->unk_04;
|
||||
}
|
||||
break;
|
||||
case SPL_FLD_TYPE_CONVERGENCE:
|
||||
if (v2->unk_00 == SPL_020A1E30) {
|
||||
if (v2->unk_00 == SPLBehavior_ApplyConvergence) {
|
||||
return v2->unk_04;
|
||||
}
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user