mirror of
https://github.com/pret/pokeplatinum.git
synced 2026-03-21 17:55:13 -05:00
Start documenting spl behavior
This commit is contained in:
parent
8b8b1d8fda
commit
3406dcbb12
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "spl_list.h"
|
||||
#include "spl_random.h"
|
||||
#include "spl_behavior.h"
|
||||
|
||||
#define GX_RGB_R(RGB) (((RGB) >> GX_RGB_R_SHIFT) & 31)
|
||||
#define GX_RGB_G(RGB) (((RGB) >> GX_RGB_G_SHIFT) & 31)
|
||||
|
|
@ -388,44 +389,6 @@ typedef struct SPLManager_t {
|
|||
u16 unk_4A;
|
||||
} SPLManager; // size=0x4c
|
||||
|
||||
typedef struct SPLGravity {
|
||||
VecFx16 mag;
|
||||
u16 reserved0;
|
||||
} SPLGravity;
|
||||
|
||||
typedef struct SPLRandom {
|
||||
VecFx16 mag;
|
||||
u16 intvl;
|
||||
} SPLRandom;
|
||||
|
||||
typedef struct SPLMagnet {
|
||||
VecFx32 pos;
|
||||
fx16 mag;
|
||||
u16 reserved0;
|
||||
} SPLMagnet;
|
||||
|
||||
typedef struct SPLSpin {
|
||||
u16 radian;
|
||||
u16 axis_type;
|
||||
} SPLSpin;
|
||||
|
||||
typedef struct SPLSimpleCollisionField {
|
||||
fx32 y;
|
||||
fx16 coeff_bounce;
|
||||
|
||||
struct {
|
||||
u16 eventtype : 2;
|
||||
u16 global : 1;
|
||||
u16 reserved : 13;
|
||||
} etc;
|
||||
} SPLSimpleCollisionField;
|
||||
|
||||
typedef struct SPLConvergence {
|
||||
VecFx32 pos;
|
||||
fx16 ratio;
|
||||
u16 reserved0;
|
||||
} SPLConvergence;
|
||||
|
||||
typedef struct FieldFunc {
|
||||
void (*func)(SPLParticle *, UnkSPLStruct4 *, int);
|
||||
BOOL loop;
|
||||
|
|
@ -463,12 +426,7 @@ BOOL SPL_0209C8BC(SPLManager * param0, u32 (* param1)(u32, BOOL));
|
|||
void SPL_0209C988(SPLManager * param0, const void * param1);
|
||||
SPLManager * SPL_0209CD00(UnkFuncPtr_0209CD00 param0, u16 param1, u16 param2, u16 param3, u16 param4, u16 param5);
|
||||
|
||||
void SPL_020A1E30(const void * param0, SPLParticle * param1, VecFx32 * param2, struct SPLEmitter_t * param3);
|
||||
void SPL_020A1EC4(const void * param0, SPLParticle * param1, VecFx32 * param2, struct SPLEmitter_t * param3);
|
||||
void SPL_020A1FE0(const void * param0, SPLParticle * param1, VecFx32 * param2, struct SPLEmitter_t * param3);
|
||||
void SPL_020A20B8(const void * param0, SPLParticle * param1, VecFx32 * param2, struct SPLEmitter_t * param3);
|
||||
void SPL_020A213C(const void * param0, SPLParticle * param1, VecFx32 * param2, struct SPLEmitter_t * param3);
|
||||
void SPL_020A2204(const void * param0, SPLParticle * param1, VecFx32 * param2, struct SPLEmitter_t * param3);
|
||||
|
||||
|
||||
void sub_020A1DA0(SPLParticle *ptcl, UnkSPLStruct4 *res, int lifeRate); // spl_scl_in_out
|
||||
void sub_020A1BD4(SPLParticle *ptcl, UnkSPLStruct4 *res, int lifeRate); // spl_clr_in_out
|
||||
|
|
|
|||
54
lib/spl/include/spl_behavior.h
Normal file
54
lib/spl/include/spl_behavior.h
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
#ifndef SPL_BEHAVIOR_H
|
||||
#define SPL_BEHAVIOR_H
|
||||
|
||||
#include <nitro/types.h>
|
||||
|
||||
#include "spl.h"
|
||||
|
||||
typedef struct SPLGravityBehavior {
|
||||
VecFx16 mag;
|
||||
u16 reserved0;
|
||||
} SPLGravityBehavior;
|
||||
|
||||
typedef struct SPLRandomBehavior {
|
||||
VecFx16 mag;
|
||||
u16 intvl;
|
||||
} SPLRandomBehavior;
|
||||
|
||||
typedef struct SPLMagnetBehavior {
|
||||
VecFx32 pos;
|
||||
fx16 mag;
|
||||
u16 reserved0;
|
||||
} SPLMagnetBehavior;
|
||||
|
||||
typedef struct SPLSpinBehavior {
|
||||
u16 radian;
|
||||
u16 axis_type;
|
||||
} SPLSpinBehavior;
|
||||
|
||||
typedef struct SPLCollisionBehavior {
|
||||
fx32 y;
|
||||
fx16 coeff_bounce;
|
||||
|
||||
struct {
|
||||
u16 eventtype : 2;
|
||||
u16 global : 1;
|
||||
u16 reserved : 13;
|
||||
} etc;
|
||||
} SPLCollisionBehavior;
|
||||
|
||||
typedef struct SPLConvergenceBehavior {
|
||||
VecFx32 pos;
|
||||
fx16 ratio;
|
||||
u16 reserved0;
|
||||
} SPLConvergenceBehavior;
|
||||
|
||||
|
||||
void SPL_020A2204(const void *param0, SPLParticle *param1, VecFx32 *param2, struct SPLEmitter_t *param3);
|
||||
void SPL_020A213C(const void *param0, SPLParticle *param1, VecFx32 *param2, struct SPLEmitter_t *param3);
|
||||
void SPL_020A20B8(const void *param0, SPLParticle *param1, VecFx32 *param2, struct SPLEmitter_t *param3);
|
||||
void SPL_020A1FE0(const void *param0, SPLParticle *param1, VecFx32 *param2, struct SPLEmitter_t *param3);
|
||||
void SPL_020A1EC4(const void *param0, SPLParticle *param1, VecFx32 *param2, struct SPLEmitter_t *param3);
|
||||
void SPL_020A1E30(const void *param0, SPLParticle *param1, VecFx32 *param2, struct SPLEmitter_t *param3);
|
||||
|
||||
#endif // SPL_BEHAVIOR_H
|
||||
|
|
@ -20,7 +20,7 @@ libspl_srcs = files(
|
|||
'src/unk_0209DD54.c',
|
||||
'src/unk_020A05BC.c',
|
||||
'src/unk_020A19F0.c',
|
||||
'src/unk_020A1E30.c',
|
||||
'src/spl_behavior.c',
|
||||
'src/spl_list.c',
|
||||
'src/spl_random.c'
|
||||
)
|
||||
|
|
|
|||
|
|
@ -3,11 +3,12 @@
|
|||
#include <nitro/fx/fx_trig.h>
|
||||
|
||||
#include "spl.h"
|
||||
#include "spl_behavior.h"
|
||||
#include "spl_random.h"
|
||||
|
||||
void SPL_020A2204(const void *obj, SPLParticle *ptcl, VecFx32 *pos, SPLEmitter *emtr)
|
||||
{
|
||||
SPLGravity *gravity = (SPLGravity *)obj;
|
||||
SPLGravityBehavior *gravity = (SPLGravityBehavior *)obj;
|
||||
pos->x += gravity->mag.x;
|
||||
pos->y += gravity->mag.y;
|
||||
pos->z += gravity->mag.z;
|
||||
|
|
@ -15,7 +16,7 @@ void SPL_020A2204(const void *obj, SPLParticle *ptcl, VecFx32 *pos, SPLEmitter *
|
|||
|
||||
void SPL_020A213C(const void *obj, SPLParticle *ptcl, VecFx32 *acc, SPLEmitter *emtr)
|
||||
{
|
||||
SPLRandom *rng = (SPLRandom *)obj;
|
||||
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);
|
||||
|
|
@ -25,7 +26,7 @@ void SPL_020A213C(const void *obj, SPLParticle *ptcl, VecFx32 *acc, SPLEmitter *
|
|||
|
||||
void SPL_020A20B8(const void *obj, SPLParticle *ptcl, VecFx32 *pos, SPLEmitter *emtr)
|
||||
{
|
||||
SPLMagnet *magnet = (SPLMagnet *)obj;
|
||||
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;
|
||||
|
|
@ -33,7 +34,7 @@ void SPL_020A20B8(const void *obj, SPLParticle *ptcl, VecFx32 *pos, SPLEmitter *
|
|||
|
||||
void SPL_020A1FE0(const void *obj, SPLParticle *ptcl, VecFx32 *pos, SPLEmitter *emtr)
|
||||
{
|
||||
SPLSpin *spin = (SPLSpin *)obj;
|
||||
SPLSpinBehavior *spin = (SPLSpinBehavior *)obj;
|
||||
MtxFx33 rot;
|
||||
switch (spin->axis_type) {
|
||||
case 0:
|
||||
|
|
@ -50,9 +51,9 @@ void SPL_020A1FE0(const void *obj, SPLParticle *ptcl, VecFx32 *pos, SPLEmitter *
|
|||
MTX_MultVec33(&ptcl->unk_08, &rot, &ptcl->unk_08);
|
||||
}
|
||||
|
||||
void SPL_020A1EC4(const void *obj,SPLParticle *ptcl,VecFx32 *pos,SPLEmitter *emtr)
|
||||
void SPL_020A1EC4(const void *obj, SPLParticle *ptcl, VecFx32 *pos, SPLEmitter *emtr)
|
||||
{
|
||||
SPLSimpleCollisionField *fld = (SPLSimpleCollisionField *)obj;
|
||||
SPLCollisionBehavior *fld = (SPLCollisionBehavior *)obj;
|
||||
fx32 y = fld->y;
|
||||
fx32 ey;
|
||||
|
||||
|
|
@ -93,7 +94,7 @@ void SPL_020A1EC4(const void *obj,SPLParticle *ptcl,VecFx32 *pos,SPLEmitter *emt
|
|||
|
||||
void SPL_020A1E30(const void *obj, SPLParticle *ptcl, VecFx32 *pos, SPLEmitter *emtr)
|
||||
{
|
||||
SPLConvergence *conv = (SPLConvergence *)obj;
|
||||
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)));
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
#include "spl.h"
|
||||
#include "spl_behavior.h"
|
||||
|
||||
#include <nnsys/gfd/VramManager/gfd_PlttVramMan_Types.h>
|
||||
#include <nnsys/gfd/VramManager/gfd_TexVramMan_Types.h>
|
||||
|
|
@ -144,42 +145,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;
|
||||
offset += sizeof(SPLGravity);
|
||||
offset += sizeof(SPLGravityBehavior);
|
||||
fld++;
|
||||
}
|
||||
|
||||
if (flag.unk_07_1) {
|
||||
fld->unk_04 = (const void *)((u8 *)spa + offset);
|
||||
fld->unk_00 = SPL_020A213C;
|
||||
offset += sizeof(SPLRandom);
|
||||
offset += sizeof(SPLRandomBehavior);
|
||||
fld++;
|
||||
}
|
||||
|
||||
if (flag.unk_07_2) {
|
||||
fld->unk_04 = (const void *)((u8 *)spa + offset);
|
||||
fld->unk_00 = SPL_020A20B8;
|
||||
offset += sizeof(SPLMagnet);
|
||||
offset += sizeof(SPLMagnetBehavior);
|
||||
fld++;
|
||||
}
|
||||
|
||||
if (flag.unk_07_3) {
|
||||
fld->unk_04 = (const void *)((u8 *)spa + offset);
|
||||
fld->unk_00 = SPL_020A1FE0;
|
||||
offset += sizeof(SPLSpin);
|
||||
offset += sizeof(SPLSpinBehavior);
|
||||
fld++;
|
||||
}
|
||||
|
||||
if (flag.unk_07_4) {
|
||||
fld->unk_04 = (const void *)((u8 *)spa + offset);
|
||||
fld->unk_00 = SPL_020A1EC4;
|
||||
offset += sizeof(SPLSimpleCollisionField);
|
||||
offset += sizeof(SPLCollisionBehavior);
|
||||
fld++;
|
||||
}
|
||||
|
||||
if (flag.unk_07_5) {
|
||||
fld->unk_04 = (void *)((u8 *)spa + offset);
|
||||
fld->unk_00 = SPL_020A1E30;
|
||||
offset += sizeof(SPLConvergence);
|
||||
offset += sizeof(SPLConvergenceBehavior);
|
||||
}
|
||||
} else {
|
||||
p_res->unk_18 = NULL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user