mirror of
https://github.com/pret/pokeplatinum.git
synced 2026-03-21 17:55:13 -05:00
last bits of spl code + fix function layout
This commit is contained in:
parent
5c92991c51
commit
b233b392b9
|
|
@ -438,17 +438,16 @@ typedef struct SPLList {
|
|||
} SPLList;
|
||||
|
||||
typedef struct FieldFunc {
|
||||
void(*func)(SPLParticle *, UnkSPLStruct4 *, int);
|
||||
void (*func)(SPLParticle *, UnkSPLStruct4 *, int);
|
||||
BOOL loop;
|
||||
} FieldFunc;
|
||||
|
||||
typedef struct FieldFunc8 {
|
||||
void(*func)(SPLParticle *, UnkSPLStruct4 *, u8);
|
||||
void (*func)(SPLParticle *, UnkSPLStruct4 *, u8);
|
||||
BOOL loop;
|
||||
} FieldFunc8;
|
||||
|
||||
typedef struct SPLArcHdr
|
||||
{
|
||||
typedef struct SPLArcHdr {
|
||||
u32 id;
|
||||
u32 ver;
|
||||
u16 res_num;
|
||||
|
|
@ -460,6 +459,8 @@ typedef struct SPLArcHdr
|
|||
u32 reserved1;
|
||||
} SPLArcHdr;
|
||||
|
||||
typedef void (*UnkSPLFuncPtr0)(SPLEmitter *, void *);
|
||||
|
||||
void SPL_0209C400(SPLManager * param0);
|
||||
void SPL_0209C444(SPLManager * param0, SPLEmitter * param1);
|
||||
SPLEmitter * SPL_0209C4D8(SPLManager * param0, int param1, void (* param2)(struct SPLEmitter_t *));
|
||||
|
|
@ -496,7 +497,6 @@ void sub_020A1608(VecFx32 *ptclPos, VecFx32 *pos, SPLEmitter *emtr);
|
|||
void sub_020A2354(VecFx32 *vec);
|
||||
void sub_020A23B0(VecFx32 *vec);
|
||||
|
||||
|
||||
void sub_0209D998(SPLEmitter *emtr, UnkSPLStruct4 *res, const VecFx32 *param2);
|
||||
void sub_0209CF00(SPLManager *mgr);
|
||||
void sub_0209D150(SPLManager *mgr, SPLEmitter *emtr);
|
||||
|
|
@ -533,6 +533,8 @@ void sub_020A0398(fx32 sin, fx32 cos, MtxFx43 *mat);
|
|||
void sub_020A0444(fx16 s, fx16 t, fx16 offsetX, fx16 offsetZ);
|
||||
void sub_020A0500(fx16 s, fx16 t, fx16 offsetX, fx16 offsetY);
|
||||
|
||||
void spl_generate(SPLEmitter *emtr, SPLList *list);
|
||||
|
||||
static inline void SPL_UnkInline1 (SPLEmitter * param0, const VecFx32 * param1)
|
||||
{
|
||||
param0->unk_98.x = param1->x + param0->p_res->unk_00->unk_04.x;
|
||||
|
|
@ -568,6 +570,11 @@ static inline u32 rng_next(u32 shift)
|
|||
return Unk_021C3A38 >> shift;
|
||||
}
|
||||
|
||||
static inline s32 rng_next_s32(u32 shift)
|
||||
{
|
||||
return (s32)rng_next(shift);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,7 +1,22 @@
|
|||
|
||||
libspl_c_args = [
|
||||
'-nothumb',
|
||||
'-wrap:ver', '1.2/base_b73'
|
||||
]
|
||||
|
||||
libspl_link_args = [
|
||||
'-library',
|
||||
'-nothumb',
|
||||
'-main', '""',
|
||||
'-nostdlib',
|
||||
]
|
||||
|
||||
libspl_public_includes = include_directories('include')
|
||||
|
||||
libspl_srcs = files(
|
||||
'src/unk_0209C400.c',
|
||||
'src/unk_0209CF00.c',
|
||||
'asm/unk_0209DD54.s',
|
||||
'src/unk_0209DD54.c',
|
||||
'src/unk_020A05BC.c',
|
||||
'src/unk_020A19F0.c',
|
||||
'src/unk_020A1E30.c',
|
||||
|
|
@ -9,11 +24,11 @@ libspl_srcs = files(
|
|||
'src/unk_020A2354.c'
|
||||
)
|
||||
|
||||
libspl_public_includes = include_directories('include')
|
||||
|
||||
libspl = static_library('spl',
|
||||
sources: libspl_srcs,
|
||||
nasm_args: asm_args,
|
||||
c_args: libspl_c_args,
|
||||
link_args: libspl_link_args,
|
||||
include_directories: [public_includes, libspl_public_includes],
|
||||
dependencies: [ nitrosdk_dep, nitrosystem_dep ],
|
||||
pic: false
|
||||
|
|
|
|||
|
|
@ -6,200 +6,68 @@
|
|||
|
||||
#define DECODE_WH(X) ((u16)(1 << ((X) + 3)))
|
||||
|
||||
void SPL_0209C400(SPLManager *p0)
|
||||
u32 sub_0209CEC8(u32 size, BOOL is4x4)
|
||||
{
|
||||
SPLEmitter *next;
|
||||
SPLEmitter *emtr = p0->unk_04.unk_00;
|
||||
|
||||
while (emtr != NULL) {
|
||||
next = emtr->unk_00;
|
||||
SPL_0209C444(p0, emtr);
|
||||
emtr = next;
|
||||
}
|
||||
return (NNS_GfdAllocTexVram(size, is4x4, 0) & 0xFFFF) * 8;
|
||||
}
|
||||
|
||||
void SPL_0209C444(SPLManager *p0, SPLEmitter *p1)
|
||||
u32 sub_0209CE90(u32 size, BOOL is4Pltt)
|
||||
{
|
||||
SPLEmitter *v0 = (SPLEmitter *)sub_020A22B8((SPLList *)&p1->unk_08);
|
||||
if (v0 != NULL) {
|
||||
do {
|
||||
sub_020A2304((SPLList *)&p0->unk_1C, (SPLNode *)v0);
|
||||
v0 = (SPLEmitter *)sub_020A22B8((SPLList *)&p1->unk_08);
|
||||
} while (v0 != NULL);
|
||||
}
|
||||
v0 = (SPLEmitter *)sub_020A22B8((SPLList *)&p1->unk_4C);
|
||||
if (v0 != NULL) {
|
||||
do {
|
||||
sub_020A2304((SPLList *)&p0->unk_1C, (SPLNode *)v0);
|
||||
v0 = (SPLEmitter *)sub_020A22B8((SPLList *)&p1->unk_4C);
|
||||
} while (v0 != NULL);
|
||||
}
|
||||
sub_020A2238((SPLList *)&p0->unk_04, (SPLNode *)p1);
|
||||
sub_020A2304((SPLList *)&p0->unk_10, (SPLNode *)p1);
|
||||
return (NNS_GfdAllocPlttVram(size, is4Pltt, 0) & 0xFFFF) * 8;
|
||||
}
|
||||
|
||||
SPLEmitter * SPL_0209C4D8(SPLManager *mgr, int resno, void(*fpcb)(SPLEmitter*))
|
||||
SPLManager *SPL_0209CD00(void *(*alloc)(u32), u16 max_emtr, u16 max_ptcl, u16 fixPolyID, u16 minPolyID, u16 maxPolyID)
|
||||
{
|
||||
SPLManager *mgr;
|
||||
SPLEmitter *emtr;
|
||||
|
||||
emtr = NULL;
|
||||
if (mgr->unk_10.unk_00 != NULL) {
|
||||
VecFx32 v0 = { 0, 0, 0 };
|
||||
emtr = (SPLEmitter*)sub_020A22B8((SPLList *)&mgr->unk_10);
|
||||
sub_0209D998(emtr, mgr->unk_28 + resno, &v0);
|
||||
if (fpcb != NULL) {
|
||||
fpcb(emtr);
|
||||
}
|
||||
sub_020A2304((SPLList *)&mgr->unk_04, (SPLNode *)emtr);
|
||||
if (emtr->p_res->unk_00->unk_00.unk_05_6) {
|
||||
emtr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return emtr;
|
||||
}
|
||||
|
||||
SPLEmitter *SPL_0209C56C(SPLManager *mgr, int resno, const VecFx32 *pos)
|
||||
{
|
||||
SPLEmitter *emtr = NULL;
|
||||
|
||||
if (mgr->unk_10.unk_00 != NULL) {
|
||||
emtr = (SPLEmitter *)sub_020A22B8((SPLList *)&mgr->unk_10);
|
||||
sub_0209D998(emtr, mgr->unk_28 + resno, pos);
|
||||
sub_020A2304((SPLList *)&mgr->unk_04, (SPLNode *)emtr);
|
||||
if (emtr->p_res->unk_00->unk_00.unk_05_6) {
|
||||
emtr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return emtr;
|
||||
}
|
||||
|
||||
void SPL_0209C5E0(SPLManager *mgr, const MtxFx43 *cmr)
|
||||
{
|
||||
SPLEmitter *emtr;
|
||||
|
||||
reg_G3X_DISP3DCNT = (reg_G3X_DISP3DCNT & ~(REG_G3X_DISP3DCNT_GO_MASK | REG_G3X_DISP3DCNT_RO_MASK)) | REG_G3X_DISP3DCNT_ABE_MASK;
|
||||
mgr->unk_40.unk_04 = cmr;
|
||||
if (!mgr->unk_38.unk_03_0) {
|
||||
emtr = mgr->unk_04.unk_00;
|
||||
|
||||
while (emtr != NULL) {
|
||||
mgr->unk_40.unk_00 = emtr;
|
||||
if (!emtr->unk_94.stop_draw) {
|
||||
sub_0209CF00(mgr);
|
||||
}
|
||||
emtr = emtr->unk_00;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
emtr = mgr->unk_04.unk_08;
|
||||
while (emtr != NULL) {
|
||||
mgr->unk_40.unk_00 = emtr;
|
||||
if (!emtr->unk_94.stop_draw) {
|
||||
sub_0209CF00(mgr);
|
||||
}
|
||||
emtr = emtr->unk_04;
|
||||
}
|
||||
}
|
||||
|
||||
void SPL_0209C6A8(SPLManager *mgr)
|
||||
{
|
||||
SPLEmitter *emtr;
|
||||
SPLEmitter *next;
|
||||
|
||||
emtr = mgr->unk_04.unk_00;
|
||||
while (emtr != NULL) {
|
||||
UnkSPLStruct9 *base = emtr->p_res->unk_00;
|
||||
next = emtr->unk_00;
|
||||
|
||||
if (!emtr->unk_94.started && emtr->unk_BC >= base->unk_32) {
|
||||
emtr->unk_94.started = TRUE;
|
||||
emtr->unk_BC = 0;
|
||||
}
|
||||
|
||||
if (!emtr->unk_94.stop_calc) {
|
||||
if (emtr->unk_F0.unk_02_0 == 0 || mgr->unk_48 == emtr->unk_F0.unk_02_0 - 1) {
|
||||
sub_0209D150(mgr, emtr);
|
||||
}
|
||||
}
|
||||
|
||||
if (((base->unk_00.unk_05_6 && base->unk_3C != 0 && emtr->unk_94.started && emtr->unk_BC > base->unk_3C)
|
||||
|| emtr->unk_94.terminate) && emtr->unk_08.unk_04 == 0 && emtr->unk_4C.unk_04 == 0) {
|
||||
SPLEmitter *e0 = (SPLEmitter *)sub_020A2238((SPLList *)&mgr->unk_04, (SPLNode *)emtr);
|
||||
sub_020A2304((SPLList *)&mgr->unk_10, (SPLNode *)e0);
|
||||
}
|
||||
|
||||
emtr = next;
|
||||
}
|
||||
|
||||
mgr->unk_48 += 1;
|
||||
if (mgr->unk_48 > 1) {
|
||||
mgr->unk_48 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int SPL_0209C7E0(SPLManager *mgr)
|
||||
{
|
||||
return SPL_0209C808(mgr, sub_0209CE90);
|
||||
}
|
||||
|
||||
int SPL_0209C7F4(SPLManager *mgr)
|
||||
{
|
||||
return SPL_0209C8BC(mgr, sub_0209CEC8);
|
||||
}
|
||||
|
||||
BOOL SPL_0209C808(SPLManager *mgr, u32 (*func)(u32, BOOL))
|
||||
{
|
||||
s32 i;
|
||||
UnkSPLStruct5 *tex;
|
||||
UnkSPLStruct15 *hdr;
|
||||
u32 ofs;
|
||||
|
||||
GX_BeginLoadTexPltt();
|
||||
|
||||
for (i = 0; i < mgr->unk_32; i++) {
|
||||
ofs = 0;
|
||||
tex = &mgr->unk_2C[i];
|
||||
hdr = (UnkSPLStruct15 *)tex->unk_00;
|
||||
|
||||
if (hdr->unk_10 != 0) {
|
||||
ofs = func(hdr->unk_10, hdr->unk_04.val2_00_0 == 2);
|
||||
GX_LoadTexPltt((u8 *)tex->unk_00 + hdr->unk_0C, ofs, hdr->unk_10);
|
||||
}
|
||||
|
||||
tex->unk_08 = ofs;
|
||||
}
|
||||
|
||||
GX_EndLoadTexPltt();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL SPL_0209C8BC(SPLManager *mgr, u32 (*func)(u32, BOOL))
|
||||
{
|
||||
SPLParticle *ptcl;
|
||||
int i;
|
||||
u32 addr;
|
||||
|
||||
GX_BeginLoadTex();
|
||||
|
||||
for (i = 0; i < mgr->unk_32; i++) {
|
||||
UnkSPLStruct5 *textures = mgr->unk_2C;
|
||||
UnkSPLStruct5 *tex = &textures[i];
|
||||
UnkSPLStruct15 *hdr = (UnkSPLStruct15 *)tex->unk_00;
|
||||
|
||||
if (hdr->unk_04.val2_02_1) {
|
||||
tex->unk_04 = textures[hdr->unk_04.val2_02_2].unk_04;
|
||||
} else {
|
||||
addr = func(hdr->unk_08, hdr->unk_04.val2_00_0 == 5);
|
||||
GX_LoadTex(((UnkSPLStruct15 *)tex->unk_00) + 1, addr, hdr->unk_08);
|
||||
tex->unk_04 = addr;
|
||||
}
|
||||
mgr = alloc(sizeof(SPLManager));
|
||||
MI_CpuFill8(mgr, 0, sizeof(SPLManager));
|
||||
|
||||
mgr->unk_34 = max_emtr;
|
||||
mgr->unk_36 = max_ptcl;
|
||||
|
||||
mgr->unk_38.unk_00_0 = minPolyID;
|
||||
mgr->unk_38.unk_00_6 = maxPolyID;
|
||||
mgr->unk_38.unk_01_4 = mgr->unk_38.unk_00_0;
|
||||
mgr->unk_38.unk_02_2 = fixPolyID;
|
||||
mgr->unk_38.unk_03_0 = FALSE;
|
||||
mgr->unk_38.unk_03_7 = 0;
|
||||
|
||||
mgr->unk_00 = alloc;
|
||||
|
||||
mgr->unk_04.unk_04 = 0;
|
||||
mgr->unk_10.unk_04 = 0;
|
||||
mgr->unk_1C.unk_04 = 0;
|
||||
|
||||
mgr->unk_04.unk_00 = NULL;
|
||||
mgr->unk_10.unk_00 = NULL;
|
||||
mgr->unk_1C.unk_00 = NULL;
|
||||
|
||||
mgr->unk_3C = 0;
|
||||
mgr->unk_48 = 0;
|
||||
|
||||
emtr = alloc(max_emtr * sizeof(SPLEmitter));
|
||||
MI_CpuFill8(emtr, 0, max_emtr * sizeof(SPLEmitter));
|
||||
|
||||
for (i = 0; i < max_emtr; ++i) {
|
||||
sub_020A2304((SPLList *)&mgr->unk_10, (SPLNode *)&emtr[i]);
|
||||
}
|
||||
|
||||
GX_EndLoadTex();
|
||||
return TRUE;
|
||||
ptcl = alloc(max_ptcl * sizeof(SPLParticle));
|
||||
MI_CpuFill8(ptcl, 0, max_ptcl * sizeof(SPLParticle));
|
||||
|
||||
for (i = 0; i < max_ptcl; ++i) {
|
||||
sub_020A2304((SPLList *)&mgr->unk_1C, (SPLNode *)&ptcl[i]);
|
||||
}
|
||||
|
||||
mgr->unk_28 = NULL;
|
||||
mgr->unk_2C = NULL;
|
||||
mgr->unk_30 = mgr->unk_32 = 0;
|
||||
|
||||
return mgr;
|
||||
}
|
||||
|
||||
void SPL_0209C988(SPLManager *mgr, const void *p_spa)
|
||||
|
|
@ -226,10 +94,10 @@ void SPL_0209C988(SPLManager *mgr, const void *p_spa)
|
|||
for (i = 0; i < mgr->unk_30; ++i) {
|
||||
p_res = mgr->unk_28 + i;
|
||||
p_res->unk_00 = (UnkSPLStruct9 *)((u8 *)spa + offset);
|
||||
|
||||
|
||||
offset += sizeof(UnkSPLStruct9);
|
||||
flag = p_res->unk_00->unk_00;
|
||||
|
||||
|
||||
if (flag.unk_05_0) { // Has scaleAnim
|
||||
p_res->unk_04 = (UnkSPLStruct10 *)((u8 *)spa + offset);
|
||||
offset += sizeof(UnkSPLStruct10);
|
||||
|
|
@ -266,7 +134,7 @@ void SPL_0209C988(SPLManager *mgr, const void *p_spa)
|
|||
}
|
||||
|
||||
// Sum up all fields
|
||||
p_res->unk_1C = flag.unk_07_0 + flag.unk_07_1 + flag.unk_07_2
|
||||
p_res->unk_1C = flag.unk_07_0 + flag.unk_07_1 + flag.unk_07_2
|
||||
+ flag.unk_07_3 + flag.unk_07_4 + flag.unk_07_5;
|
||||
|
||||
if (p_res->unk_1C != 0) {
|
||||
|
|
@ -333,66 +201,233 @@ void SPL_0209C988(SPLManager *mgr, const void *p_spa)
|
|||
}
|
||||
}
|
||||
|
||||
SPLManager *SPL_0209CD00(void *(*alloc)(u32), u16 max_emtr, u16 max_ptcl, u16 fixPolyID, u16 minPolyID, u16 maxPolyID)
|
||||
BOOL SPL_0209C8BC(SPLManager *mgr, u32 (*func)(u32, BOOL))
|
||||
{
|
||||
SPLManager *mgr;
|
||||
SPLEmitter *emtr;
|
||||
SPLParticle *ptcl;
|
||||
int i;
|
||||
u32 addr;
|
||||
|
||||
mgr = alloc(sizeof(SPLManager));
|
||||
MI_CpuFill8(mgr, 0, sizeof(SPLManager));
|
||||
GX_BeginLoadTex();
|
||||
|
||||
mgr->unk_34 = max_emtr;
|
||||
mgr->unk_36 = max_ptcl;
|
||||
for (i = 0; i < mgr->unk_32; i++) {
|
||||
UnkSPLStruct5 *textures = mgr->unk_2C;
|
||||
UnkSPLStruct5 *tex = &textures[i];
|
||||
UnkSPLStruct15 *hdr = (UnkSPLStruct15 *)tex->unk_00;
|
||||
|
||||
mgr->unk_38.unk_00_0 = minPolyID;
|
||||
mgr->unk_38.unk_00_6 = maxPolyID;
|
||||
mgr->unk_38.unk_01_4 = mgr->unk_38.unk_00_0;
|
||||
mgr->unk_38.unk_02_2 = fixPolyID;
|
||||
mgr->unk_38.unk_03_0 = FALSE;
|
||||
mgr->unk_38.unk_03_7 = 0;
|
||||
|
||||
mgr->unk_00 = alloc;
|
||||
|
||||
mgr->unk_04.unk_04 = 0;
|
||||
mgr->unk_10.unk_04 = 0;
|
||||
mgr->unk_1C.unk_04 = 0;
|
||||
|
||||
mgr->unk_04.unk_00 = NULL;
|
||||
mgr->unk_10.unk_00 = NULL;
|
||||
mgr->unk_1C.unk_00 = NULL;
|
||||
|
||||
mgr->unk_3C = 0;
|
||||
mgr->unk_48 = 0;
|
||||
|
||||
emtr = alloc(max_emtr * sizeof(SPLEmitter));
|
||||
MI_CpuFill8(emtr, 0, max_emtr * sizeof(SPLEmitter));
|
||||
|
||||
for (i = 0; i < max_emtr; ++i) {
|
||||
sub_020A2304((SPLList *)&mgr->unk_10, (SPLNode *)&emtr[i]);
|
||||
if (hdr->unk_04.val2_02_1) {
|
||||
tex->unk_04 = textures[hdr->unk_04.val2_02_2].unk_04;
|
||||
} else {
|
||||
addr = func(hdr->unk_08, hdr->unk_04.val2_00_0 == 5);
|
||||
GX_LoadTex(((UnkSPLStruct15 *)tex->unk_00) + 1, addr, hdr->unk_08);
|
||||
tex->unk_04 = addr;
|
||||
}
|
||||
}
|
||||
|
||||
ptcl = alloc(max_ptcl * sizeof(SPLParticle));
|
||||
MI_CpuFill8(ptcl, 0, max_ptcl * sizeof(SPLParticle));
|
||||
GX_EndLoadTex();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
for (i = 0; i < max_ptcl; ++i) {
|
||||
sub_020A2304((SPLList *)&mgr->unk_1C, (SPLNode *)&ptcl[i]);
|
||||
BOOL SPL_0209C808(SPLManager *mgr, u32 (*func)(u32, BOOL))
|
||||
{
|
||||
s32 i;
|
||||
UnkSPLStruct5 *tex;
|
||||
UnkSPLStruct15 *hdr;
|
||||
u32 ofs;
|
||||
|
||||
GX_BeginLoadTexPltt();
|
||||
|
||||
for (i = 0; i < mgr->unk_32; i++) {
|
||||
ofs = 0;
|
||||
tex = &mgr->unk_2C[i];
|
||||
hdr = (UnkSPLStruct15 *)tex->unk_00;
|
||||
|
||||
if (hdr->unk_10 != 0) {
|
||||
ofs = func(hdr->unk_10, hdr->unk_04.val2_00_0 == 2);
|
||||
GX_LoadTexPltt((u8 *)tex->unk_00 + hdr->unk_0C, ofs, hdr->unk_10);
|
||||
}
|
||||
|
||||
tex->unk_08 = ofs;
|
||||
}
|
||||
|
||||
mgr->unk_28 = NULL;
|
||||
mgr->unk_2C = NULL;
|
||||
mgr->unk_30 = mgr->unk_32 = 0;
|
||||
|
||||
return mgr;
|
||||
GX_EndLoadTexPltt();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
u32 sub_0209CE90(u32 size, BOOL is4Pltt)
|
||||
int SPL_0209C7F4(SPLManager *mgr)
|
||||
{
|
||||
return (NNS_GfdAllocPlttVram(size, is4Pltt, 0) & 0xFFFF) * 8;
|
||||
return SPL_0209C8BC(mgr, sub_0209CEC8);
|
||||
}
|
||||
|
||||
u32 sub_0209CEC8(u32 size, BOOL is4x4)
|
||||
int SPL_0209C7E0(SPLManager *mgr)
|
||||
{
|
||||
return (NNS_GfdAllocTexVram(size, is4x4, 0) & 0xFFFF) * 8;
|
||||
return SPL_0209C808(mgr, sub_0209CE90);
|
||||
}
|
||||
|
||||
void SPL_0209C6A8(SPLManager *mgr)
|
||||
{
|
||||
SPLEmitter *emtr;
|
||||
SPLEmitter *next;
|
||||
|
||||
emtr = mgr->unk_04.unk_00;
|
||||
while (emtr != NULL) {
|
||||
UnkSPLStruct9 *base = emtr->p_res->unk_00;
|
||||
next = emtr->unk_00;
|
||||
|
||||
if (!emtr->unk_94.started && emtr->unk_BC >= base->unk_32) {
|
||||
emtr->unk_94.started = TRUE;
|
||||
emtr->unk_BC = 0;
|
||||
}
|
||||
|
||||
if (!emtr->unk_94.stop_calc) {
|
||||
if (emtr->unk_F0.unk_02_0 == 0 || mgr->unk_48 == emtr->unk_F0.unk_02_0 - 1) {
|
||||
sub_0209D150(mgr, emtr);
|
||||
}
|
||||
}
|
||||
|
||||
if (((base->unk_00.unk_05_6 && base->unk_3C != 0 && emtr->unk_94.started && emtr->unk_BC > base->unk_3C)
|
||||
|| emtr->unk_94.terminate)
|
||||
&& emtr->unk_08.unk_04 == 0 && emtr->unk_4C.unk_04 == 0) {
|
||||
SPLEmitter *e0 = (SPLEmitter *)sub_020A2238((SPLList *)&mgr->unk_04, (SPLNode *)emtr);
|
||||
sub_020A2304((SPLList *)&mgr->unk_10, (SPLNode *)e0);
|
||||
}
|
||||
|
||||
emtr = next;
|
||||
}
|
||||
|
||||
mgr->unk_48 += 1;
|
||||
if (mgr->unk_48 > 1) {
|
||||
mgr->unk_48 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void SPL_0209C5E0(SPLManager *mgr, const MtxFx43 *cmr)
|
||||
{
|
||||
SPLEmitter *emtr;
|
||||
|
||||
reg_G3X_DISP3DCNT = (reg_G3X_DISP3DCNT & ~(REG_G3X_DISP3DCNT_GO_MASK | REG_G3X_DISP3DCNT_RO_MASK)) | REG_G3X_DISP3DCNT_ABE_MASK;
|
||||
mgr->unk_40.unk_04 = cmr;
|
||||
if (!mgr->unk_38.unk_03_0) {
|
||||
emtr = mgr->unk_04.unk_00;
|
||||
|
||||
while (emtr != NULL) {
|
||||
mgr->unk_40.unk_00 = emtr;
|
||||
if (!emtr->unk_94.stop_draw) {
|
||||
sub_0209CF00(mgr);
|
||||
}
|
||||
emtr = emtr->unk_00;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
emtr = mgr->unk_04.unk_08;
|
||||
while (emtr != NULL) {
|
||||
mgr->unk_40.unk_00 = emtr;
|
||||
if (!emtr->unk_94.stop_draw) {
|
||||
sub_0209CF00(mgr);
|
||||
}
|
||||
emtr = emtr->unk_04;
|
||||
}
|
||||
}
|
||||
|
||||
SPLEmitter *SPL_0209C56C(SPLManager *mgr, int resno, const VecFx32 *pos)
|
||||
{
|
||||
SPLEmitter *emtr = NULL;
|
||||
|
||||
if (mgr->unk_10.unk_00 != NULL) {
|
||||
emtr = (SPLEmitter *)sub_020A22B8((SPLList *)&mgr->unk_10);
|
||||
sub_0209D998(emtr, mgr->unk_28 + resno, pos);
|
||||
sub_020A2304((SPLList *)&mgr->unk_04, (SPLNode *)emtr);
|
||||
if (emtr->p_res->unk_00->unk_00.unk_05_6) {
|
||||
emtr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return emtr;
|
||||
}
|
||||
|
||||
SPLEmitter *SPL_0209C4D8(SPLManager *mgr, int resno, void (*fpcb)(SPLEmitter *))
|
||||
{
|
||||
SPLEmitter *emtr;
|
||||
|
||||
emtr = NULL;
|
||||
if (mgr->unk_10.unk_00 != NULL) {
|
||||
VecFx32 v0 = { 0, 0, 0 };
|
||||
emtr = (SPLEmitter *)sub_020A22B8((SPLList *)&mgr->unk_10);
|
||||
sub_0209D998(emtr, mgr->unk_28 + resno, &v0);
|
||||
if (fpcb != NULL) {
|
||||
fpcb(emtr);
|
||||
}
|
||||
sub_020A2304((SPLList *)&mgr->unk_04, (SPLNode *)emtr);
|
||||
if (emtr->p_res->unk_00->unk_00.unk_05_6) {
|
||||
emtr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return emtr;
|
||||
}
|
||||
|
||||
SPLEmitter *SPL_CreateWithInitializeEx(SPLManager *mgr, int resNo, VecFx32 *pos, void *pvoid, UnkSPLFuncPtr0 cb)
|
||||
{
|
||||
SPLEmitter *emtr;
|
||||
|
||||
emtr = NULL;
|
||||
if (mgr->unk_10.unk_00 != NULL) {
|
||||
emtr = (SPLEmitter *)sub_020A22B8((SPLList *)&mgr->unk_10);
|
||||
sub_0209D998(emtr, mgr->unk_28 + resNo, pos);
|
||||
if (cb != NULL) {
|
||||
cb(emtr, pvoid);
|
||||
}
|
||||
|
||||
sub_020A2304((SPLList *)&mgr->unk_04, (SPLNode *)emtr);
|
||||
if (emtr->p_res->unk_00->unk_00.unk_05_6) {
|
||||
emtr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return emtr;
|
||||
}
|
||||
|
||||
void SPL_0209C444(SPLManager *p0, SPLEmitter *p1)
|
||||
{
|
||||
SPLEmitter *v0 = (SPLEmitter *)sub_020A22B8((SPLList *)&p1->unk_08);
|
||||
if (v0 != NULL) {
|
||||
do {
|
||||
sub_020A2304((SPLList *)&p0->unk_1C, (SPLNode *)v0);
|
||||
v0 = (SPLEmitter *)sub_020A22B8((SPLList *)&p1->unk_08);
|
||||
} while (v0 != NULL);
|
||||
}
|
||||
v0 = (SPLEmitter *)sub_020A22B8((SPLList *)&p1->unk_4C);
|
||||
if (v0 != NULL) {
|
||||
do {
|
||||
sub_020A2304((SPLList *)&p0->unk_1C, (SPLNode *)v0);
|
||||
v0 = (SPLEmitter *)sub_020A22B8((SPLList *)&p1->unk_4C);
|
||||
} while (v0 != NULL);
|
||||
}
|
||||
sub_020A2238((SPLList *)&p0->unk_04, (SPLNode *)p1);
|
||||
sub_020A2304((SPLList *)&p0->unk_10, (SPLNode *)p1);
|
||||
}
|
||||
|
||||
void SPL_0209C400(SPLManager *p0)
|
||||
{
|
||||
SPLEmitter *next;
|
||||
SPLEmitter *emtr = p0->unk_04.unk_00;
|
||||
|
||||
while (emtr != NULL) {
|
||||
next = emtr->unk_00;
|
||||
SPL_0209C444(p0, emtr);
|
||||
emtr = next;
|
||||
}
|
||||
}
|
||||
|
||||
void SPL_Emit(SPLManager *mgr, SPLEmitter *emtr)
|
||||
{
|
||||
spl_generate(emtr, (SPLList *)&mgr->unk_1C);
|
||||
}
|
||||
|
||||
void SPL_EmitAt(SPLManager *mgr, SPLEmitter *emtr, VecFx32 *pos)
|
||||
{
|
||||
emtr->unk_98.x = pos->x + emtr->p_res->unk_00->unk_04.x;
|
||||
emtr->unk_98.y = pos->y + emtr->p_res->unk_00->unk_04.y;
|
||||
emtr->unk_98.z = pos->z + emtr->p_res->unk_00->unk_04.z;
|
||||
spl_generate(emtr, (SPLList *)&mgr->unk_1C);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,92 +1,98 @@
|
|||
#include "spl.h"
|
||||
|
||||
#include <nitro/fx/fx.h>
|
||||
#include <nitro/fx/fx_const.h>
|
||||
#include <nitro/gx/g3.h>
|
||||
#include <nitro/gx/g3imm.h>
|
||||
|
||||
void sub_0209CF00(SPLManager *mgr)
|
||||
#include "spl.h"
|
||||
|
||||
void sub_0209DC68(UnkSPLStruct5 *tex)
|
||||
{
|
||||
UnkSPLStruct9 *resBase;
|
||||
UnkSPLUnion5 param = tex->unk_0C;
|
||||
|
||||
resBase = mgr->unk_40.unk_00->p_res->unk_00;
|
||||
if (resBase->unk_00.unk_06_5) {
|
||||
sub_0209CF7C(mgr);
|
||||
G3_TexImageParam(
|
||||
param.val2_00_0,
|
||||
GX_TEXGEN_TEXCOORD,
|
||||
param.val2_00_4,
|
||||
param.val2_01_0,
|
||||
param.val2_01_4,
|
||||
param.val2_01_6,
|
||||
param.val2_02_0,
|
||||
tex->unk_04);
|
||||
|
||||
if (!resBase->unk_00.unk_06_6) {
|
||||
sub_0209D064(mgr);
|
||||
}
|
||||
} else {
|
||||
if (!resBase->unk_00.unk_06_6) {
|
||||
sub_0209D064(mgr);
|
||||
}
|
||||
|
||||
sub_0209CF7C(mgr);
|
||||
}
|
||||
G3_TexPlttBase(tex->unk_08, param.val2_00_0);
|
||||
G3_MtxMode(GX_MTXMODE_TEXTURE);
|
||||
G3_Identity();
|
||||
G3_Scale(tex->unk_10 * FX32_ONE, tex->unk_12 * FX32_ONE, 0);
|
||||
G3_MtxMode(GX_MTXMODE_POSITION);
|
||||
}
|
||||
|
||||
void sub_0209CF7C(SPLManager *mgr)
|
||||
void sub_0209DC64(UnkSPLStruct5 *tex)
|
||||
{
|
||||
SPLEmitter *emtr;
|
||||
UnkSPLStruct4 *res;
|
||||
DrawFunc drawFunc;
|
||||
SPLParticle *ptcl;
|
||||
|
||||
emtr = mgr->unk_40.unk_00;
|
||||
drawFunc = NULL;
|
||||
res = emtr->p_res;
|
||||
|
||||
if (!res->unk_00->unk_00.unk_06_0) {
|
||||
return;
|
||||
}
|
||||
|
||||
sub_0209DC68(mgr->unk_2C + res->unk_14->unk_0C.unk_03_0);
|
||||
|
||||
switch (res->unk_14->unk_00.unk_02_7) {
|
||||
case 0: drawFunc = sub_0209FAB8; break;
|
||||
case 1: drawFunc = sub_0209ECF0; break;
|
||||
case 2: drawFunc = sub_0209E650; break;
|
||||
case 3: drawFunc = sub_0209DD54; break;
|
||||
case 4: drawFunc = sub_0209DD54; break;
|
||||
}
|
||||
|
||||
ptcl = emtr->unk_4C.unk_00;
|
||||
while (ptcl != NULL) {
|
||||
drawFunc(mgr, ptcl);
|
||||
ptcl = ptcl->unk_00;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0209D064(SPLManager *mgr)
|
||||
void sub_0209D998(SPLEmitter *emtr, UnkSPLStruct4 *res, const VecFx32 *pos)
|
||||
{
|
||||
SPLEmitter *emtr;
|
||||
UnkSPLStruct9 *resBase;
|
||||
SPLParticle *ptcl;
|
||||
DrawFunc drawFunc;
|
||||
SetTexFunc setTexFunc;
|
||||
emtr->p_res = res;
|
||||
emtr->unk_94.all = 0;
|
||||
|
||||
emtr = mgr->unk_40.unk_00;
|
||||
resBase = emtr->p_res->unk_00;
|
||||
drawFunc = NULL;
|
||||
emtr->unk_98.x = pos->x + emtr->p_res->unk_00->unk_04.x;
|
||||
emtr->unk_98.y = pos->y + emtr->p_res->unk_00->unk_04.y;
|
||||
emtr->unk_98.z = pos->z + emtr->p_res->unk_00->unk_04.z;
|
||||
|
||||
sub_0209DC68(mgr->unk_2C + resBase->unk_48.unk_03_0);
|
||||
emtr->unk_B0.x = 0;
|
||||
emtr->unk_B0.y = 0;
|
||||
emtr->unk_B0.z = 0;
|
||||
emtr->unk_A4.x = emtr->unk_A4.y = emtr->unk_A4.z = 0;
|
||||
|
||||
switch (resBase->unk_00.unk_04_4) {
|
||||
case 0: drawFunc = sub_0209FF0C; break;
|
||||
case 1: drawFunc = sub_0209F3D0; break;
|
||||
case 2: drawFunc = sub_0209E9A0; break;
|
||||
case 3: drawFunc = sub_0209E1D4; break;
|
||||
case 4: drawFunc = sub_0209E1D4; break;
|
||||
emtr->unk_BC = 0;
|
||||
emtr->unk_BE = 0;
|
||||
|
||||
emtr->unk_C0 = emtr->p_res->unk_00->unk_1C;
|
||||
emtr->unk_C6 = emtr->p_res->unk_00->unk_38;
|
||||
emtr->unk_C8 = emtr->p_res->unk_00->unk_10;
|
||||
emtr->unk_CC = emtr->p_res->unk_00->unk_14;
|
||||
emtr->unk_D0 = emtr->p_res->unk_00->unk_18;
|
||||
emtr->unk_D4 = emtr->p_res->unk_00->unk_24;
|
||||
emtr->unk_D8 = emtr->p_res->unk_00->unk_28;
|
||||
emtr->unk_DC = emtr->p_res->unk_00->unk_2C;
|
||||
emtr->unk_E0 = emtr->p_res->unk_00->unk_40;
|
||||
|
||||
emtr->unk_E2 = GX_RGB(31, 31, 31);
|
||||
emtr->unk_F0.unk_00_0 = emtr->p_res->unk_00->unk_48.unk_00_0;
|
||||
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->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;
|
||||
|
||||
if (emtr->p_res->unk_00->unk_48.unk_08_0) {
|
||||
emtr->unk_E8 *= -1;
|
||||
}
|
||||
|
||||
setTexFunc = resBase->unk_00.unk_05_3 ? sub_0209DC68 : sub_0209DC64;
|
||||
ptcl = emtr->unk_08.unk_00;
|
||||
|
||||
while (ptcl != NULL) {
|
||||
setTexFunc(mgr->unk_2C + ptcl->unk_2C.unk_00);
|
||||
drawFunc(mgr, ptcl);
|
||||
ptcl = ptcl->unk_00;
|
||||
if (emtr->p_res->unk_00->unk_48.unk_08_1) {
|
||||
emtr->unk_EA *= -1;
|
||||
}
|
||||
|
||||
if (emtr->p_res->unk_00->unk_00.unk_06_0) {
|
||||
emtr->unk_EC = FX32_ONE << emtr->p_res->unk_14->unk_0C.unk_04_0;
|
||||
emtr->unk_EE = FX32_ONE << emtr->p_res->unk_14->unk_0C.unk_04_2;
|
||||
|
||||
if (emtr->p_res->unk_14->unk_0C.unk_04_4) {
|
||||
emtr->unk_EC *= -1;
|
||||
}
|
||||
|
||||
if (emtr->p_res->unk_14->unk_0C.unk_04_5) {
|
||||
emtr->unk_EE *= -1;
|
||||
}
|
||||
}
|
||||
|
||||
emtr->unk_00 = emtr->unk_04 = NULL;
|
||||
emtr->unk_08.unk_00 = emtr->unk_4C.unk_00 = NULL;
|
||||
emtr->unk_08.unk_04 = emtr->unk_4C.unk_04 = 0;
|
||||
emtr->unk_100 = NULL;
|
||||
emtr->unk_104 = NULL;
|
||||
emtr->unk_108.unk_108_val1 = 0;
|
||||
}
|
||||
|
||||
void sub_0209D150(SPLManager *mgr, SPLEmitter *emtr)
|
||||
|
|
@ -145,7 +151,6 @@ void sub_0209D150(SPLManager *mgr, SPLEmitter *emtr)
|
|||
fieldFuncs[fieldIndex++].loop = res->unk_10->unk_08.unk_02_1;
|
||||
}
|
||||
|
||||
|
||||
for (ptcl = emtr->unk_08.unk_00; ptcl != NULL; ptcl = next) {
|
||||
next = ptcl->unk_00;
|
||||
lifeRates[0] = ptcl->unk_2A * ptcl->unk_26 >> 8;
|
||||
|
|
@ -253,24 +258,24 @@ void sub_0209D150(SPLManager *mgr, SPLEmitter *emtr)
|
|||
ptcl->unk_14.x += vec.x;
|
||||
ptcl->unk_14.y += vec.y;
|
||||
ptcl->unk_14.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;
|
||||
|
||||
|
||||
if (emtr->p_res->unk_00->unk_00.unk_07_7) {
|
||||
ptcl->unk_2E.unk_01_2 = mgr->unk_38.unk_02_2;
|
||||
} else {
|
||||
ptcl->unk_2E.unk_01_2 = mgr->unk_38.unk_01_4;
|
||||
mgr->unk_38.unk_01_4 += 1;
|
||||
|
||||
|
||||
if (mgr->unk_38.unk_01_4 > mgr->unk_38.unk_00_6) {
|
||||
mgr->unk_38.unk_01_4 = mgr->unk_38.unk_00_0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ptcl->unk_26 += 1;
|
||||
|
||||
|
||||
if (ptcl->unk_26 > ptcl->unk_24) {
|
||||
sub_020A2304((SPLList *)&mgr->unk_1C, sub_020A2238((SPLList *)(&emtr->unk_4C), (SPLNode *)ptcl));
|
||||
}
|
||||
|
|
@ -284,91 +289,132 @@ void sub_0209D150(SPLManager *mgr, SPLEmitter *emtr)
|
|||
}
|
||||
}
|
||||
|
||||
void sub_0209D998(SPLEmitter *emtr, UnkSPLStruct4 *res, const VecFx32 *pos)
|
||||
void sub_0209D064(SPLManager *mgr)
|
||||
{
|
||||
emtr->p_res = res;
|
||||
emtr->unk_94.all = 0;
|
||||
|
||||
emtr->unk_98.x = pos->x + emtr->p_res->unk_00->unk_04.x;
|
||||
emtr->unk_98.y = pos->y + emtr->p_res->unk_00->unk_04.y;
|
||||
emtr->unk_98.z = pos->z + emtr->p_res->unk_00->unk_04.z;
|
||||
SPLEmitter *emtr;
|
||||
UnkSPLStruct9 *resBase;
|
||||
SPLParticle *ptcl;
|
||||
DrawFunc drawFunc;
|
||||
SetTexFunc setTexFunc;
|
||||
|
||||
emtr->unk_B0.x = 0;
|
||||
emtr->unk_B0.y = 0;
|
||||
emtr->unk_B0.z = 0;
|
||||
emtr->unk_A4.x = emtr->unk_A4.y = emtr->unk_A4.z = 0;
|
||||
emtr = mgr->unk_40.unk_00;
|
||||
resBase = emtr->p_res->unk_00;
|
||||
drawFunc = NULL;
|
||||
|
||||
emtr->unk_BC = 0;
|
||||
emtr->unk_BE = 0;
|
||||
sub_0209DC68(mgr->unk_2C + resBase->unk_48.unk_03_0);
|
||||
|
||||
emtr->unk_C0 = emtr->p_res->unk_00->unk_1C;
|
||||
emtr->unk_C6 = emtr->p_res->unk_00->unk_38;
|
||||
emtr->unk_C8 = emtr->p_res->unk_00->unk_10;
|
||||
emtr->unk_CC = emtr->p_res->unk_00->unk_14;
|
||||
emtr->unk_D0 = emtr->p_res->unk_00->unk_18;
|
||||
emtr->unk_D4 = emtr->p_res->unk_00->unk_24;
|
||||
emtr->unk_D8 = emtr->p_res->unk_00->unk_28;
|
||||
emtr->unk_DC = emtr->p_res->unk_00->unk_2C;
|
||||
emtr->unk_E0 = emtr->p_res->unk_00->unk_40;
|
||||
|
||||
emtr->unk_E2 = GX_RGB(31, 31, 31);
|
||||
emtr->unk_F0.unk_00_0 = emtr->p_res->unk_00->unk_48.unk_00_0;
|
||||
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->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;
|
||||
|
||||
if (emtr->p_res->unk_00->unk_48.unk_08_0) {
|
||||
emtr->unk_E8 *= -1;
|
||||
switch (resBase->unk_00.unk_04_4) {
|
||||
case 0:
|
||||
drawFunc = sub_0209FF0C;
|
||||
break;
|
||||
case 1:
|
||||
drawFunc = sub_0209F3D0;
|
||||
break;
|
||||
case 2:
|
||||
drawFunc = sub_0209E9A0;
|
||||
break;
|
||||
case 3:
|
||||
drawFunc = sub_0209E1D4;
|
||||
break;
|
||||
case 4:
|
||||
drawFunc = sub_0209E1D4;
|
||||
break;
|
||||
}
|
||||
|
||||
if (emtr->p_res->unk_00->unk_48.unk_08_1) {
|
||||
emtr->unk_EA *= -1;
|
||||
setTexFunc = resBase->unk_00.unk_05_3 ? sub_0209DC68 : sub_0209DC64;
|
||||
ptcl = emtr->unk_08.unk_00;
|
||||
|
||||
while (ptcl != NULL) {
|
||||
setTexFunc(mgr->unk_2C + ptcl->unk_2C.unk_00);
|
||||
drawFunc(mgr, ptcl);
|
||||
ptcl = ptcl->unk_00;
|
||||
}
|
||||
|
||||
if (emtr->p_res->unk_00->unk_00.unk_06_0) {
|
||||
emtr->unk_EC = FX32_ONE << emtr->p_res->unk_14->unk_0C.unk_04_0;
|
||||
emtr->unk_EE = FX32_ONE << emtr->p_res->unk_14->unk_0C.unk_04_2;
|
||||
|
||||
if (emtr->p_res->unk_14->unk_0C.unk_04_4) {
|
||||
emtr->unk_EC *= -1;
|
||||
}
|
||||
|
||||
if (emtr->p_res->unk_14->unk_0C.unk_04_5) {
|
||||
emtr->unk_EE *= -1;
|
||||
}
|
||||
}
|
||||
|
||||
emtr->unk_00 = emtr->unk_04 = NULL;
|
||||
emtr->unk_08.unk_00 = emtr->unk_4C.unk_00 = NULL;
|
||||
emtr->unk_08.unk_04 = emtr->unk_4C.unk_04 = 0;
|
||||
emtr->unk_100 = NULL;
|
||||
emtr->unk_104 = NULL;
|
||||
emtr->unk_108.unk_108_val1 = 0;
|
||||
}
|
||||
|
||||
void sub_0209DC64(UnkSPLStruct5 *tex) { }
|
||||
|
||||
void sub_0209DC68(UnkSPLStruct5 *tex)
|
||||
void sub_0209CF7C(SPLManager *mgr)
|
||||
{
|
||||
UnkSPLUnion5 param = tex->unk_0C;
|
||||
SPLEmitter *emtr;
|
||||
UnkSPLStruct4 *res;
|
||||
DrawFunc drawFunc;
|
||||
SPLParticle *ptcl;
|
||||
|
||||
G3_TexImageParam(
|
||||
param.val2_00_0,
|
||||
GX_TEXGEN_TEXCOORD,
|
||||
param.val2_00_4,
|
||||
param.val2_01_0,
|
||||
param.val2_01_4,
|
||||
param.val2_01_6,
|
||||
param.val2_02_0,
|
||||
tex->unk_04
|
||||
);
|
||||
emtr = mgr->unk_40.unk_00;
|
||||
drawFunc = NULL;
|
||||
res = emtr->p_res;
|
||||
|
||||
G3_TexPlttBase(tex->unk_08, param.val2_00_0);
|
||||
G3_MtxMode(GX_MTXMODE_TEXTURE);
|
||||
G3_Identity();
|
||||
G3_Scale(tex->unk_10 * FX32_ONE, tex->unk_12 * FX32_ONE, 0);
|
||||
G3_MtxMode(GX_MTXMODE_POSITION);
|
||||
if (!res->unk_00->unk_00.unk_06_0) {
|
||||
return;
|
||||
}
|
||||
|
||||
sub_0209DC68(mgr->unk_2C + res->unk_14->unk_0C.unk_03_0);
|
||||
|
||||
switch (res->unk_14->unk_00.unk_02_7) {
|
||||
case 0:
|
||||
drawFunc = sub_0209FAB8;
|
||||
break;
|
||||
case 1:
|
||||
drawFunc = sub_0209ECF0;
|
||||
break;
|
||||
case 2:
|
||||
drawFunc = sub_0209E650;
|
||||
break;
|
||||
case 3:
|
||||
drawFunc = sub_0209DD54;
|
||||
break;
|
||||
case 4:
|
||||
drawFunc = sub_0209DD54;
|
||||
break;
|
||||
}
|
||||
|
||||
ptcl = emtr->unk_4C.unk_00;
|
||||
while (ptcl != NULL) {
|
||||
drawFunc(mgr, ptcl);
|
||||
ptcl = ptcl->unk_00;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0209CF00(SPLManager *mgr)
|
||||
{
|
||||
UnkSPLStruct9 *resBase;
|
||||
|
||||
resBase = mgr->unk_40.unk_00->p_res->unk_00;
|
||||
if (resBase->unk_00.unk_06_5) {
|
||||
sub_0209CF7C(mgr);
|
||||
|
||||
if (!resBase->unk_00.unk_06_6) {
|
||||
sub_0209D064(mgr);
|
||||
}
|
||||
} else {
|
||||
if (!resBase->unk_00.unk_06_6) {
|
||||
sub_0209D064(mgr);
|
||||
}
|
||||
|
||||
sub_0209CF7C(mgr);
|
||||
}
|
||||
}
|
||||
|
||||
void spl_generate(SPLEmitter *emtr, SPLList *list)
|
||||
{
|
||||
sub_020A08DC(emtr, list);
|
||||
}
|
||||
|
||||
void SPL_Util_SetCylinderEmiterDirection(SPLEmitter *emtr, VecFx32 *p1, VecFx32 *p2)
|
||||
{
|
||||
VecFx32 vex;
|
||||
|
||||
if (emtr->p_res->unk_00->unk_00.unk_04_0 == 6 || emtr->p_res->unk_00->unk_00.unk_04_0 == 7) {
|
||||
emtr->unk_98.x = (p2->x + p1->x) / 2;
|
||||
emtr->unk_98.y = (p2->y + p1->y) / 2;
|
||||
emtr->unk_98.z = (p2->z + p1->z) / 2;
|
||||
emtr->unk_D0 = VEC_Distance(p1, p2) / 2;
|
||||
|
||||
vex.x = p2->x - p1->x;
|
||||
vex.y = p2->y - p1->y;
|
||||
vex.z = p2->z - p1->z;
|
||||
VEC_Normalize(&vex, &vex);
|
||||
|
||||
emtr->unk_C0.x = (fx16)vex.x;
|
||||
emtr->unk_C0.y = (fx16)vex.y;
|
||||
emtr->unk_C0.z = (fx16)vex.z;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -4,324 +4,6 @@
|
|||
|
||||
#include "spl.h"
|
||||
|
||||
void sub_020A05BC(SPLParticle *ptcl, SPLEmitter *emtr, SPLList *list)
|
||||
{
|
||||
SPLParticle *chld;
|
||||
fx32 velBase, velRand;
|
||||
u32 rng;
|
||||
int i;
|
||||
UnkSPLStruct14 *chldRes = emtr->p_res->unk_14;
|
||||
fx32 vel = FX_MUL((fx32)(chldRes->unk_08.unk_00_0 << FX32_SHIFT), FX32_CONST(1 / 256.0f));
|
||||
|
||||
for (i = 0; i < chldRes->unk_0C.unk_00_0; i++) {
|
||||
chld = (SPLParticle *)sub_020A22B8(list);
|
||||
if (chld == NULL) {
|
||||
return;
|
||||
}
|
||||
sub_020A2304((SPLList *)&emtr->unk_4C, (SPLNode *)chld);
|
||||
|
||||
chld->unk_08 = ptcl->unk_08;
|
||||
|
||||
velBase = FX_MUL(ptcl->unk_14.x, vel);
|
||||
velRand = (fx32)(chldRes->unk_02 * rng_next(0x17) - chldRes->unk_02 * 256) >> 8;
|
||||
chld->unk_14.x = velBase + velRand;
|
||||
|
||||
velBase = FX_MUL(ptcl->unk_14.y, vel);
|
||||
velRand = (fx32)(chldRes->unk_02 * rng_next(0x17) - chldRes->unk_02 * 256) >> 8;
|
||||
chld->unk_14.y = velBase + velRand;
|
||||
|
||||
velBase = FX_MUL(ptcl->unk_14.z, vel);
|
||||
velRand = (fx32)(chldRes->unk_02 * rng_next(0x17) - chldRes->unk_02 * 256) >> 8;
|
||||
chld->unk_14.z = velBase + velRand;
|
||||
|
||||
chld->unk_38 = ptcl->unk_38;
|
||||
|
||||
// `unk_08.unk_00_0` and `unk_08.unk_01_0` in `UnkSPLStruct14`
|
||||
// could just be `u8 unk_08;` and `u8 unk_09;`
|
||||
// instead of an inner struct
|
||||
int idk = ptcl->unk_30 * ptcl->unk_34 >> FX32_SHIFT;
|
||||
chld->unk_30 = idk * (chldRes->unk_08.unk_01_0 + 1) >> 6;
|
||||
|
||||
chld->unk_34 = FX32_ONE;
|
||||
|
||||
if (chldRes->unk_00.unk_02_6) {
|
||||
chld->unk_36 = chldRes->unk_0A;
|
||||
} else {
|
||||
chld->unk_36 = ptcl->unk_36;
|
||||
}
|
||||
|
||||
chld->unk_2E.unk_00_0 = (ptcl->unk_2E.unk_00_0 * (ptcl->unk_2E.unk_00_5 + 1)) >> 5;
|
||||
chld->unk_2E.unk_00_5 = 31;
|
||||
|
||||
switch (chldRes->unk_00.unk_02_3) {
|
||||
case 0:
|
||||
chld->unk_20 = 0;
|
||||
chld->unk_22 = 0;
|
||||
break;
|
||||
case 1:
|
||||
chld->unk_20 = ptcl->unk_20;
|
||||
chld->unk_22 = 0;
|
||||
break;
|
||||
case 2:
|
||||
chld->unk_20 = ptcl->unk_20;
|
||||
chld->unk_22 = ptcl->unk_22;
|
||||
break;
|
||||
}
|
||||
|
||||
chld->unk_24 = chldRes->unk_06;
|
||||
chld->unk_26 = 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_2C.unk_01 = 0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void sub_020A08DC(SPLEmitter *emtr, SPLList *list)
|
||||
{
|
||||
UnkSPLStruct4 *res;
|
||||
UnkSPLStruct9 *resBase;
|
||||
//fx32 genNum;
|
||||
int i, curGenNum;
|
||||
SPLParticle *ptcl;
|
||||
|
||||
fx32 magPos;
|
||||
fx32 magAxis;
|
||||
res = emtr->p_res;
|
||||
resBase = res->unk_00;
|
||||
|
||||
int temp = emtr->unk_C8 + FX32_CAST(emtr->unk_BE);
|
||||
curGenNum = temp >> FX32_SHIFT;
|
||||
emtr->unk_BE = (temp & FX32_DEC_MASK);
|
||||
|
||||
u32 initType = resBase->unk_00.unk_04_0;
|
||||
if (initType == 2 || initType == 3 || (initType - 5 <= 4)) {
|
||||
sub_020A1768(emtr);
|
||||
}
|
||||
|
||||
i = 0;
|
||||
if (i < curGenNum) {
|
||||
fx32 genNum = 0;
|
||||
do {
|
||||
ptcl = (SPLParticle *)sub_020A22B8(list);
|
||||
|
||||
if (ptcl == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
sub_020A2304((SPLList *)&emtr->unk_08, (SPLNode *)ptcl);
|
||||
|
||||
switch (resBase->unk_00.unk_04_0) {
|
||||
case 0:
|
||||
ptcl->unk_08.x = ptcl->unk_08.y = ptcl->unk_08.z = 0;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
sub_020A23B0(&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);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
{
|
||||
VecFx32 pos;
|
||||
sub_020A2354(&pos);
|
||||
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);
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
{
|
||||
VecFx32 pos;
|
||||
int idx = genNum / curGenNum;
|
||||
genNum += 0x10000;
|
||||
fx32 sin = FX_SinIdx(idx);
|
||||
fx32 cos = FX_CosIdx(idx);
|
||||
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);
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
sub_020A23B0(&ptcl->unk_08);
|
||||
ptcl->unk_08.x = FX_MUL(FX_MUL(ptcl->unk_08.x, emtr->unk_CC), rng_next(0x17) * FX32_ONE - 0x100000 >> 8);
|
||||
ptcl->unk_08.y = FX_MUL(FX_MUL(ptcl->unk_08.y, emtr->unk_CC), rng_next(0x17) * FX32_ONE - 0x100000 >> 8);
|
||||
ptcl->unk_08.z = FX_MUL(FX_MUL(ptcl->unk_08.z, emtr->unk_CC), rng_next(0x17) * FX32_ONE - 0x100000 >> 8);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
{
|
||||
VecFx32 pos;
|
||||
sub_020A2354(&pos);
|
||||
pos.x = FX_MUL(FX_MUL(pos.x, emtr->unk_CC), (fx32)rng_next(0x17) * FX32_ONE - 0x100000 >> 8);
|
||||
pos.y = FX_MUL(FX_MUL(pos.y, emtr->unk_CC), (fx32)rng_next(0x17) * FX32_ONE - 0x100000 >> 8);
|
||||
sub_020A1608(&ptcl->unk_08, &pos, emtr);
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
{
|
||||
VecFx32 pos;
|
||||
VecFx16 tmpUnitVec;
|
||||
sub_020A23B0(&ptcl->unk_08);
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
break;
|
||||
|
||||
case 9:
|
||||
{
|
||||
VecFx32 pos;
|
||||
VecFx16 tmpUnitVec;
|
||||
sub_020A23B0(&ptcl->unk_08);
|
||||
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;
|
||||
}
|
||||
|
||||
ptcl->unk_08.x = FX_MUL(FX_MUL(ptcl->unk_08.x, emtr->unk_CC), ((fx32)rng_next(0x17) * FX32_ONE - 0x100000 >> 9) + 0x800);
|
||||
ptcl->unk_08.y = FX_MUL(FX_MUL(ptcl->unk_08.y, emtr->unk_CC), ((fx32)rng_next(0x17) * FX32_ONE - 0x100000 >> 9) + 0x800);
|
||||
ptcl->unk_08.z = FX_MUL(FX_MUL(ptcl->unk_08.z, emtr->unk_CC), ((fx32)rng_next(0x17) * FX32_ONE - 0x100000 >> 9) + 0x800);
|
||||
}
|
||||
break;
|
||||
|
||||
case 6:
|
||||
{
|
||||
VecFx32 pos;
|
||||
sub_020A2354(&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);
|
||||
pos.z = (emtr->unk_D0 * rng_next(0x17) - emtr->unk_D0 * 256) >> 8;
|
||||
sub_020A1608(&ptcl->unk_08, &pos, emtr);
|
||||
}
|
||||
break;
|
||||
|
||||
case 7:
|
||||
{
|
||||
VecFx32 pos;
|
||||
sub_020A2354(&ptcl->unk_14);
|
||||
pos.x = FX_MUL(FX_MUL(ptcl->unk_14.x, emtr->unk_CC), (fx32)rng_next(0x17) * FX32_ONE - 0x100000 >> 8);
|
||||
pos.y = FX_MUL(FX_MUL(ptcl->unk_14.y, emtr->unk_CC), (fx32)rng_next(0x17) * FX32_ONE - 0x100000 >> 8);
|
||||
pos.z = (emtr->unk_D0 * (fx32)rng_next(0x17) - emtr->unk_D0 * 256) >> 8;
|
||||
sub_020A1608(&ptcl->unk_08, &pos, emtr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
magPos = emtr->unk_D4 * ((resBase->unk_44.unk_02_0 + 0xFF) - ((fx32)(resBase->unk_44.unk_02_0 * rng_next(0x18)) >> 7)) >> 8;
|
||||
magAxis = emtr->unk_D8 * ((resBase->unk_44.unk_02_0 + 0xFF) - ((fx32)(resBase->unk_44.unk_02_0 * rng_next(0x18)) >> 7)) >> 8;
|
||||
|
||||
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);
|
||||
|
||||
VEC_Normalize(&tmp, &posNorm);
|
||||
} else if (ptcl->unk_08.x == 0 && ptcl->unk_08.y == 0 && ptcl->unk_08.z == 0) {
|
||||
sub_020A23B0(&posNorm);
|
||||
} else {
|
||||
VEC_Normalize(&ptcl->unk_08, &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->unk_38 = emtr->unk_98;
|
||||
|
||||
ptcl->unk_30 = emtr->unk_DC * ((resBase->unk_44.unk_00_0 + 0xFF) - ((resBase->unk_44.unk_00_0 * (fx32)rng_next(0x18)) >> 7)) >> 8;
|
||||
ptcl->unk_34 = FX32_ONE;
|
||||
|
||||
if (resBase->unk_00.unk_05_1 && res->unk_08->unk_08.unk_00_0) {
|
||||
u16 clr[3];
|
||||
u32 indxx = rng_next(0x14);
|
||||
clr[0] = res->unk_08->unk_00;
|
||||
clr[1] = resBase->unk_22;
|
||||
clr[2] = res->unk_08->unk_02;
|
||||
ptcl->unk_36 = clr[indxx % 3];
|
||||
} else {
|
||||
ptcl->unk_36 = resBase->unk_22;
|
||||
}
|
||||
|
||||
ptcl->unk_2E.unk_00_0 = emtr->unk_F0.unk_01_0;
|
||||
ptcl->unk_2E.unk_00_5 = 31;
|
||||
|
||||
if (resBase->unk_00.unk_05_5) {
|
||||
ptcl->unk_20 = rng_next(0);
|
||||
} else {
|
||||
ptcl->unk_20 = emtr->unk_C6;
|
||||
}
|
||||
|
||||
if (resBase->unk_00.unk_05_4) {
|
||||
ptcl->unk_22 = ((resBase->unk_36 - resBase->unk_34) * (u32)rng_next(0x14) + (fx32)resBase->unk_34 * FX32_ONE) >> FX32_SHIFT;
|
||||
} else {
|
||||
ptcl->unk_22 = 0;
|
||||
}
|
||||
|
||||
ptcl->unk_24 = (emtr->unk_E0 * (0xFF - ((resBase->unk_44.unk_01_0 * rng_next(0x18) >> 8))) >> 8) + 1;
|
||||
ptcl->unk_26 = 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[rng_next(0x14) % res->unk_10->unk_08.unk_00_0];
|
||||
} else 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[0];
|
||||
} else {
|
||||
ptcl->unk_2C.unk_00 = resBase->unk_48.unk_03_0;
|
||||
}
|
||||
|
||||
ptcl->unk_28 = 0xFFFF / res->unk_00->unk_48.unk_04_0;
|
||||
ptcl->unk_2A = 0xFFFF / ptcl->unk_24;
|
||||
|
||||
ptcl->unk_2C.unk_01 = 0;
|
||||
|
||||
if (resBase->unk_00.unk_06_4) {
|
||||
ptcl->unk_2C.unk_01 = (u8)rng_next(0x18);
|
||||
}
|
||||
i++;
|
||||
} while (i < curGenNum);
|
||||
}
|
||||
for (i = 0; i < curGenNum; i++) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void sub_020A1608(VecFx32 *ptclPos, VecFx32 *pos, SPLEmitter *emtr)
|
||||
{
|
||||
VecFx16 vec;
|
||||
VEC_Fx16CrossProduct(&emtr->unk_F4, &emtr->unk_FA, &vec);
|
||||
VEC_Fx16Normalize(&vec, &vec);
|
||||
|
||||
ptclPos->x = FX_MUL(pos->x, emtr->unk_F4.x) + FX_MUL(pos->y, emtr->unk_FA.x) + FX_MUL(pos->z, vec.x);
|
||||
ptclPos->y = FX_MUL(pos->x, emtr->unk_F4.y) + FX_MUL(pos->y, emtr->unk_FA.y) + FX_MUL(pos->z, vec.y);
|
||||
ptclPos->z = FX_MUL(pos->x, emtr->unk_F4.z) + FX_MUL(pos->y, emtr->unk_FA.z) + FX_MUL(pos->z, vec.z);
|
||||
}
|
||||
|
||||
VecFx16 Unk_02100DB0 = { 0, 0, FX16_ONE };
|
||||
|
||||
void sub_020A1768(SPLEmitter *emtr)
|
||||
|
|
@ -329,7 +11,7 @@ void sub_020A1768(SPLEmitter *emtr)
|
|||
VecFx16 vec, axis;
|
||||
|
||||
vec = Unk_02100DB0;
|
||||
|
||||
|
||||
switch (emtr->p_res->unk_00->unk_00.unk_04_6) {
|
||||
case 2:
|
||||
axis.x = FX32_ONE;
|
||||
|
|
@ -369,3 +51,303 @@ void sub_020A1768(SPLEmitter *emtr)
|
|||
VEC_Fx16Normalize(&emtr->unk_F4, &emtr->unk_F4);
|
||||
VEC_Fx16Normalize(&emtr->unk_FA, &emtr->unk_FA);
|
||||
}
|
||||
|
||||
void sub_020A1608(VecFx32 *ptclPos, VecFx32 *pos, SPLEmitter *emtr)
|
||||
{
|
||||
VecFx16 vec;
|
||||
VEC_Fx16CrossProduct(&emtr->unk_F4, &emtr->unk_FA, &vec);
|
||||
VEC_Fx16Normalize(&vec, &vec);
|
||||
|
||||
ptclPos->x = FX_MUL(pos->x, emtr->unk_F4.x) + FX_MUL(pos->y, emtr->unk_FA.x) + FX_MUL(pos->z, vec.x);
|
||||
ptclPos->y = FX_MUL(pos->x, emtr->unk_F4.y) + FX_MUL(pos->y, emtr->unk_FA.y) + FX_MUL(pos->z, vec.y);
|
||||
ptclPos->z = FX_MUL(pos->x, emtr->unk_F4.z) + FX_MUL(pos->y, emtr->unk_FA.z) + FX_MUL(pos->z, vec.z);
|
||||
}
|
||||
|
||||
void sub_020A08DC(SPLEmitter *emtr, SPLList *list)
|
||||
{
|
||||
UnkSPLStruct4 *res;
|
||||
UnkSPLStruct9 *resBase;
|
||||
// fx32 genNum;
|
||||
int i, curGenNum;
|
||||
SPLParticle *ptcl;
|
||||
|
||||
fx32 magPos;
|
||||
fx32 magAxis;
|
||||
res = emtr->p_res;
|
||||
resBase = res->unk_00;
|
||||
|
||||
int temp = emtr->unk_C8 + FX32_CAST(emtr->unk_BE);
|
||||
curGenNum = temp >> FX32_SHIFT;
|
||||
emtr->unk_BE = (temp & FX32_DEC_MASK);
|
||||
|
||||
u32 initType = resBase->unk_00.unk_04_0;
|
||||
if (initType == 2 || initType == 3 || (initType - 5 <= 4)) {
|
||||
sub_020A1768(emtr);
|
||||
}
|
||||
|
||||
i = 0;
|
||||
if (i < curGenNum) {
|
||||
fx32 genNum = 0;
|
||||
do {
|
||||
ptcl = (SPLParticle *)sub_020A22B8(list);
|
||||
|
||||
if (ptcl == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
sub_020A2304((SPLList *)&emtr->unk_08, (SPLNode *)ptcl);
|
||||
|
||||
switch (resBase->unk_00.unk_04_0) {
|
||||
case 0:
|
||||
ptcl->unk_08.x = ptcl->unk_08.y = ptcl->unk_08.z = 0;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
sub_020A23B0(&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);
|
||||
break;
|
||||
|
||||
case 2: {
|
||||
VecFx32 pos;
|
||||
sub_020A2354(&pos);
|
||||
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);
|
||||
} break;
|
||||
|
||||
case 3: {
|
||||
VecFx32 pos;
|
||||
int idx = genNum / curGenNum;
|
||||
genNum += 0x10000;
|
||||
fx32 sin = FX_SinIdx(idx);
|
||||
fx32 cos = FX_CosIdx(idx);
|
||||
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);
|
||||
} break;
|
||||
|
||||
case 4:
|
||||
sub_020A23B0(&ptcl->unk_08);
|
||||
ptcl->unk_08.x = FX_MUL(FX_MUL(ptcl->unk_08.x, emtr->unk_CC), (rng_next_s32(0x17) * FX32_ONE - 0x100000) >> 8);
|
||||
ptcl->unk_08.y = FX_MUL(FX_MUL(ptcl->unk_08.y, emtr->unk_CC), (rng_next_s32(0x17) * FX32_ONE - 0x100000) >> 8);
|
||||
ptcl->unk_08.z = FX_MUL(FX_MUL(ptcl->unk_08.z, emtr->unk_CC), (rng_next_s32(0x17) * FX32_ONE - 0x100000) >> 8);
|
||||
break;
|
||||
|
||||
case 5: {
|
||||
VecFx32 pos;
|
||||
sub_020A2354(&pos);
|
||||
pos.x = FX_MUL(FX_MUL(pos.x, emtr->unk_CC), ((fx32)rng_next_s32(0x17) * FX32_ONE - 0x100000) >> 8);
|
||||
pos.y = FX_MUL(FX_MUL(pos.y, emtr->unk_CC), ((fx32)rng_next_s32(0x17) * FX32_ONE - 0x100000) >> 8);
|
||||
sub_020A1608(&ptcl->unk_08, &pos, emtr);
|
||||
} break;
|
||||
|
||||
case 8: {
|
||||
VecFx32 pos;
|
||||
VecFx16 tmpUnitVec;
|
||||
sub_020A23B0(&ptcl->unk_08);
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
} break;
|
||||
|
||||
case 9: {
|
||||
VecFx32 pos;
|
||||
VecFx16 tmpUnitVec;
|
||||
sub_020A23B0(&ptcl->unk_08);
|
||||
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;
|
||||
}
|
||||
|
||||
ptcl->unk_08.x = FX_MUL(FX_MUL(ptcl->unk_08.x, emtr->unk_CC), (((fx32)rng_next_s32(0x17) * FX32_ONE - 0x100000) >> 9) + 0x800);
|
||||
ptcl->unk_08.y = FX_MUL(FX_MUL(ptcl->unk_08.y, emtr->unk_CC), (((fx32)rng_next_s32(0x17) * FX32_ONE - 0x100000) >> 9) + 0x800);
|
||||
ptcl->unk_08.z = FX_MUL(FX_MUL(ptcl->unk_08.z, emtr->unk_CC), (((fx32)rng_next_s32(0x17) * FX32_ONE - 0x100000) >> 9) + 0x800);
|
||||
} break;
|
||||
|
||||
case 6: {
|
||||
VecFx32 pos;
|
||||
sub_020A2354(&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);
|
||||
pos.z = (emtr->unk_D0 * rng_next_s32(0x17) - emtr->unk_D0 * 256) >> 8;
|
||||
sub_020A1608(&ptcl->unk_08, &pos, emtr);
|
||||
} break;
|
||||
|
||||
case 7: {
|
||||
VecFx32 pos;
|
||||
sub_020A2354(&ptcl->unk_14);
|
||||
pos.x = FX_MUL(FX_MUL(ptcl->unk_14.x, emtr->unk_CC), ((fx32)rng_next_s32(0x17) * FX32_ONE - 0x100000) >> 8);
|
||||
pos.y = FX_MUL(FX_MUL(ptcl->unk_14.y, emtr->unk_CC), ((fx32)rng_next_s32(0x17) * FX32_ONE - 0x100000) >> 8);
|
||||
pos.z = (emtr->unk_D0 * (fx32)rng_next_s32(0x17) - emtr->unk_D0 * 256) >> 8;
|
||||
sub_020A1608(&ptcl->unk_08, &pos, emtr);
|
||||
} break;
|
||||
}
|
||||
|
||||
magPos = emtr->unk_D4 * ((resBase->unk_44.unk_02_0 + 0xFF) - ((fx32)(resBase->unk_44.unk_02_0 * rng_next_s32(0x18)) >> 7)) >> 8;
|
||||
magAxis = emtr->unk_D8 * ((resBase->unk_44.unk_02_0 + 0xFF) - ((fx32)(resBase->unk_44.unk_02_0 * rng_next_s32(0x18)) >> 7)) >> 8;
|
||||
|
||||
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);
|
||||
|
||||
VEC_Normalize(&tmp, &posNorm);
|
||||
} else if (ptcl->unk_08.x == 0 && ptcl->unk_08.y == 0 && ptcl->unk_08.z == 0) {
|
||||
sub_020A23B0(&posNorm);
|
||||
} else {
|
||||
VEC_Normalize(&ptcl->unk_08, &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->unk_38 = emtr->unk_98;
|
||||
|
||||
ptcl->unk_30 = emtr->unk_DC * ((resBase->unk_44.unk_00_0 + 0xFF) - ((resBase->unk_44.unk_00_0 * (fx32)rng_next_s32(0x18)) >> 7)) >> 8;
|
||||
ptcl->unk_34 = FX32_ONE;
|
||||
|
||||
if (resBase->unk_00.unk_05_1 && res->unk_08->unk_08.unk_00_0) {
|
||||
u16 clr[3];
|
||||
u32 indxx = rng_next_s32(0x14);
|
||||
clr[0] = res->unk_08->unk_00;
|
||||
clr[1] = resBase->unk_22;
|
||||
clr[2] = res->unk_08->unk_02;
|
||||
ptcl->unk_36 = clr[indxx % 3];
|
||||
} else {
|
||||
ptcl->unk_36 = resBase->unk_22;
|
||||
}
|
||||
|
||||
ptcl->unk_2E.unk_00_0 = emtr->unk_F0.unk_01_0;
|
||||
ptcl->unk_2E.unk_00_5 = 31;
|
||||
|
||||
if (resBase->unk_00.unk_05_5) {
|
||||
ptcl->unk_20 = rng_next_s32(0);
|
||||
} else {
|
||||
ptcl->unk_20 = emtr->unk_C6;
|
||||
}
|
||||
|
||||
if (resBase->unk_00.unk_05_4) {
|
||||
ptcl->unk_22 = ((resBase->unk_36 - resBase->unk_34) * (u32)rng_next_s32(0x14) + (fx32)resBase->unk_34 * FX32_ONE) >> FX32_SHIFT;
|
||||
} else {
|
||||
ptcl->unk_22 = 0;
|
||||
}
|
||||
|
||||
ptcl->unk_24 = (emtr->unk_E0 * (0xFF - (resBase->unk_44.unk_01_0 * rng_next_s32(0x18) >> 8)) >> 8) + 1;
|
||||
ptcl->unk_26 = 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[rng_next_s32(0x14) % res->unk_10->unk_08.unk_00_0];
|
||||
} else 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[0];
|
||||
} else {
|
||||
ptcl->unk_2C.unk_00 = resBase->unk_48.unk_03_0;
|
||||
}
|
||||
|
||||
ptcl->unk_28 = 0xFFFF / res->unk_00->unk_48.unk_04_0;
|
||||
ptcl->unk_2A = 0xFFFF / ptcl->unk_24;
|
||||
|
||||
ptcl->unk_2C.unk_01 = 0;
|
||||
|
||||
if (resBase->unk_00.unk_06_4) {
|
||||
ptcl->unk_2C.unk_01 = (u8)rng_next_s32(0x18);
|
||||
}
|
||||
i++;
|
||||
} while (i < curGenNum);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_020A05BC(SPLParticle *ptcl, SPLEmitter *emtr, SPLList *list)
|
||||
{
|
||||
SPLParticle *chld;
|
||||
fx32 velBase, velRand;
|
||||
u32 rng;
|
||||
int i;
|
||||
UnkSPLStruct14 *chldRes = emtr->p_res->unk_14;
|
||||
fx32 vel = FX_MUL((fx32)(chldRes->unk_08.unk_00_0 << FX32_SHIFT), FX32_CONST(1 / 256.0f));
|
||||
|
||||
for (i = 0; i < chldRes->unk_0C.unk_00_0; i++) {
|
||||
chld = (SPLParticle *)sub_020A22B8(list);
|
||||
if (chld == NULL) {
|
||||
return;
|
||||
}
|
||||
sub_020A2304((SPLList *)&emtr->unk_4C, (SPLNode *)chld);
|
||||
|
||||
chld->unk_08 = ptcl->unk_08;
|
||||
|
||||
velBase = FX_MUL(ptcl->unk_14.x, vel);
|
||||
velRand = (fx32)(chldRes->unk_02 * rng_next_s32(0x17) - chldRes->unk_02 * 256) >> 8;
|
||||
chld->unk_14.x = velBase + velRand;
|
||||
|
||||
velBase = FX_MUL(ptcl->unk_14.y, vel);
|
||||
velRand = (fx32)(chldRes->unk_02 * rng_next_s32(0x17) - chldRes->unk_02 * 256) >> 8;
|
||||
chld->unk_14.y = velBase + velRand;
|
||||
|
||||
velBase = FX_MUL(ptcl->unk_14.z, vel);
|
||||
velRand = (fx32)(chldRes->unk_02 * rng_next_s32(0x17) - chldRes->unk_02 * 256) >> 8;
|
||||
chld->unk_14.z = velBase + velRand;
|
||||
|
||||
chld->unk_38 = ptcl->unk_38;
|
||||
|
||||
// `unk_08.unk_00_0` and `unk_08.unk_01_0` in `UnkSPLStruct14`
|
||||
// could just be `u8 unk_08;` and `u8 unk_09;`
|
||||
// instead of an inner struct
|
||||
int idk = ptcl->unk_30 * ptcl->unk_34 >> FX32_SHIFT;
|
||||
chld->unk_30 = idk * (chldRes->unk_08.unk_01_0 + 1) >> 6;
|
||||
|
||||
chld->unk_34 = FX32_ONE;
|
||||
|
||||
if (chldRes->unk_00.unk_02_6) {
|
||||
chld->unk_36 = chldRes->unk_0A;
|
||||
} else {
|
||||
chld->unk_36 = ptcl->unk_36;
|
||||
}
|
||||
|
||||
chld->unk_2E.unk_00_0 = (ptcl->unk_2E.unk_00_0 * (ptcl->unk_2E.unk_00_5 + 1)) >> 5;
|
||||
chld->unk_2E.unk_00_5 = 31;
|
||||
|
||||
switch (chldRes->unk_00.unk_02_3) {
|
||||
case 0:
|
||||
chld->unk_20 = 0;
|
||||
chld->unk_22 = 0;
|
||||
break;
|
||||
case 1:
|
||||
chld->unk_20 = ptcl->unk_20;
|
||||
chld->unk_22 = 0;
|
||||
break;
|
||||
case 2:
|
||||
chld->unk_20 = ptcl->unk_20;
|
||||
chld->unk_22 = ptcl->unk_22;
|
||||
break;
|
||||
}
|
||||
|
||||
chld->unk_24 = chldRes->unk_06;
|
||||
chld->unk_26 = 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_2C.unk_01 = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,45 +3,27 @@
|
|||
|
||||
#include "spl.h"
|
||||
|
||||
void sub_020A19F0(SPLParticle *ptcl, UnkSPLStruct4 *res, int lifeRate)
|
||||
void sub_020A1DA0(SPLParticle *ptcl, UnkSPLStruct4 *res, int lifeRate)
|
||||
{
|
||||
ptcl->unk_2E.unk_00_5 = ((255 - lifeRate) * 31) / 255;
|
||||
}
|
||||
UnkSPLStruct10 *scaleAnim;
|
||||
int in, out;
|
||||
fx16 start, n, end;
|
||||
|
||||
void sub_020A1A48(SPLParticle *ptcl, UnkSPLStruct4 *res, int lifeRate)
|
||||
{
|
||||
ptcl->unk_34 = res->unk_14->unk_04 + ((res->unk_14->unk_04 - FX16_ONE) * (lifeRate - 255)) / 255;
|
||||
}
|
||||
scaleAnim = res->unk_04;
|
||||
in = scaleAnim->unk_06.val2_00;
|
||||
out = scaleAnim->unk_06.val2_01;
|
||||
|
||||
void sub_020A1A94(SPLParticle *ptcl, UnkSPLStruct4 *res, int lifeRate)
|
||||
{
|
||||
UnkSPLStruct13 *texAnim = res->unk_10;
|
||||
for (int i = 0; i < texAnim->unk_08.unk_00_0; i++) {
|
||||
if (lifeRate < texAnim->unk_08.unk_01_0 * (i + 1)) {
|
||||
ptcl->unk_2C.unk_00 = texAnim->unk_00[i];
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_020A1AF8(SPLParticle *ptcl, UnkSPLStruct4 *res, int lifeRate)
|
||||
{
|
||||
u32 x;
|
||||
UnkSPLStruct12 *alphaAnim = res->unk_0C;
|
||||
int maxA = alphaAnim->unk_04.val2_00;
|
||||
int maxB = alphaAnim->unk_04.val2_01;
|
||||
|
||||
if (lifeRate < maxA) {
|
||||
x = ((lifeRate * (alphaAnim->unk_00.val2_00_5 - alphaAnim->unk_00.val2_00_0)) / alphaAnim->unk_04.val2_00);
|
||||
x += alphaAnim->unk_00.val2_00_0;
|
||||
} else if (lifeRate < maxB) {
|
||||
x = alphaAnim->unk_00.val2_00_5;
|
||||
if (lifeRate < in) {
|
||||
start = scaleAnim->unk_00;
|
||||
n = scaleAnim->unk_02;
|
||||
ptcl->unk_34 = start + ((lifeRate * (n - start)) / in);
|
||||
} else if (lifeRate >= out) {
|
||||
end = scaleAnim->unk_04;
|
||||
n = scaleAnim->unk_02;
|
||||
ptcl->unk_34 = end + (((lifeRate - 255) * (end - n)) / (255 - out));
|
||||
} else {
|
||||
x = ((lifeRate - 255) * (alphaAnim->unk_00.val2_01_2 - alphaAnim->unk_00.val2_00_5)) / (255 - alphaAnim->unk_04.val2_01);
|
||||
x += alphaAnim->unk_00.val2_01_2;
|
||||
ptcl->unk_34 = scaleAnim->unk_02;
|
||||
}
|
||||
|
||||
ptcl->unk_2E.unk_00_5 = x * (255 - ((int)(alphaAnim->unk_02.unk_00_0 * rng_next(0x18)) >> 8)) >> 8;
|
||||
}
|
||||
|
||||
void sub_020A1BD4(SPLParticle *ptcl, UnkSPLStruct4 *res, int lifeRate)
|
||||
|
|
@ -107,25 +89,43 @@ void sub_020A1BD4(SPLParticle *ptcl, UnkSPLStruct4 *res, int lifeRate)
|
|||
}
|
||||
}
|
||||
|
||||
void sub_020A1DA0(SPLParticle *ptcl, UnkSPLStruct4 *res, int lifeRate)
|
||||
void sub_020A1AF8(SPLParticle *ptcl, UnkSPLStruct4 *res, int lifeRate)
|
||||
{
|
||||
UnkSPLStruct10 *scaleAnim;
|
||||
int in, out;
|
||||
fx16 start, n, end;
|
||||
u32 x;
|
||||
UnkSPLStruct12 *alphaAnim = res->unk_0C;
|
||||
int maxA = alphaAnim->unk_04.val2_00;
|
||||
int maxB = alphaAnim->unk_04.val2_01;
|
||||
|
||||
scaleAnim = res->unk_04;
|
||||
in = scaleAnim->unk_06.val2_00;
|
||||
out = scaleAnim->unk_06.val2_01;
|
||||
|
||||
if (lifeRate < in) {
|
||||
start = scaleAnim->unk_00;
|
||||
n = scaleAnim->unk_02;
|
||||
ptcl->unk_34 = start + ((lifeRate * (n - start)) / in);
|
||||
} else if (lifeRate >= out) {
|
||||
end = scaleAnim->unk_04;
|
||||
n = scaleAnim->unk_02;
|
||||
ptcl->unk_34 = end + (((lifeRate - 255) * (end - n)) / (255 - out));
|
||||
if (lifeRate < maxA) {
|
||||
x = ((lifeRate * (alphaAnim->unk_00.val2_00_5 - alphaAnim->unk_00.val2_00_0)) / alphaAnim->unk_04.val2_00);
|
||||
x += alphaAnim->unk_00.val2_00_0;
|
||||
} else if (lifeRate < maxB) {
|
||||
x = alphaAnim->unk_00.val2_00_5;
|
||||
} else {
|
||||
ptcl->unk_34 = scaleAnim->unk_02;
|
||||
x = ((lifeRate - 255) * (alphaAnim->unk_00.val2_01_2 - alphaAnim->unk_00.val2_00_5)) / (255 - alphaAnim->unk_04.val2_01);
|
||||
x += alphaAnim->unk_00.val2_01_2;
|
||||
}
|
||||
|
||||
ptcl->unk_2E.unk_00_5 = x * (255 - ((int)(alphaAnim->unk_02.unk_00_0 * rng_next(0x18)) >> 8)) >> 8;
|
||||
}
|
||||
|
||||
void sub_020A1A94(SPLParticle *ptcl, UnkSPLStruct4 *res, int lifeRate)
|
||||
{
|
||||
UnkSPLStruct13 *texAnim = res->unk_10;
|
||||
for (int i = 0; i < texAnim->unk_08.unk_00_0; i++) {
|
||||
if (lifeRate < texAnim->unk_08.unk_01_0 * (i + 1)) {
|
||||
ptcl->unk_2C.unk_00 = texAnim->unk_00[i];
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_020A1A48(SPLParticle *ptcl, UnkSPLStruct4 *res, int lifeRate)
|
||||
{
|
||||
ptcl->unk_34 = res->unk_14->unk_04 + ((res->unk_14->unk_04 - FX16_ONE) * (lifeRate - 255)) / 255;
|
||||
}
|
||||
|
||||
void sub_020A19F0(SPLParticle *ptcl, UnkSPLStruct4 *res, int lifeRate)
|
||||
{
|
||||
ptcl->unk_2E.unk_00_5 = ((255 - lifeRate) * 31) / 255;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,52 @@
|
|||
#include <nitro/fx/fx.h>
|
||||
#include <nitro/fx/fx_mtx33.h>
|
||||
#include <nitro/fx/fx_trig.h>
|
||||
|
||||
#include "spl.h"
|
||||
|
||||
#include <nitro/fx/fx.h>
|
||||
#include <nitro/fx/fx_trig.h>
|
||||
#include <nitro/fx/fx_mtx33.h>
|
||||
|
||||
void SPL_020A1E30(const void *obj, SPLParticle *ptcl, VecFx32 *pos, SPLEmitter *emtr)
|
||||
void SPL_020A2204(const void *obj, SPLParticle *ptcl, VecFx32 *pos, SPLEmitter *emtr)
|
||||
{
|
||||
SPLConvergence *conv = (SPLConvergence *)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)));
|
||||
SPLGravity *gravity = (SPLGravity *)obj;
|
||||
pos->x += gravity->mag.x;
|
||||
pos->y += gravity->mag.y;
|
||||
pos->z += gravity->mag.z;
|
||||
}
|
||||
|
||||
void SPL_020A213C(const void *obj, SPLParticle *ptcl, VecFx32 *acc, SPLEmitter *emtr)
|
||||
{
|
||||
SPLRandom *rng = (SPLRandom *)obj;
|
||||
if ((ptcl->unk_26 % rng->intvl) == 0) {
|
||||
acc->x += (((fx32)(rng->mag.x * rng_next(0x17))) - rng->mag.x * 256) >> 8;
|
||||
acc->y += (((fx32)(rng->mag.y * rng_next(0x17))) - rng->mag.y * 256) >> 8;
|
||||
acc->z += (((fx32)(rng->mag.z * rng_next(0x17))) - rng->mag.z * 256) >> 8;
|
||||
}
|
||||
}
|
||||
|
||||
void SPL_020A20B8(const void *obj, SPLParticle *ptcl, VecFx32 *pos, SPLEmitter *emtr)
|
||||
{
|
||||
SPLMagnet *magnet = (SPLMagnet *)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;
|
||||
}
|
||||
|
||||
void SPL_020A1FE0(const void *obj, SPLParticle *ptcl, VecFx32 *pos, SPLEmitter *emtr)
|
||||
{
|
||||
SPLSpin *spin = (SPLSpin *)obj;
|
||||
MtxFx33 rot;
|
||||
switch (spin->axis_type) {
|
||||
case 0:
|
||||
MTX_RotX33(&rot, FX_SinIdx(spin->radian), FX_CosIdx(spin->radian));
|
||||
break;
|
||||
case 1:
|
||||
MTX_RotY33(&rot, FX_SinIdx(spin->radian), FX_CosIdx(spin->radian));
|
||||
break;
|
||||
case 2:
|
||||
MTX_RotZ33(&rot, FX_SinIdx(spin->radian), FX_CosIdx(spin->radian));
|
||||
break;
|
||||
}
|
||||
|
||||
MTX_MultVec33(&ptcl->unk_08, &rot, &ptcl->unk_08);
|
||||
}
|
||||
|
||||
void SPL_020A1EC4(const void *obj,SPLParticle *ptcl,VecFx32 *pos,SPLEmitter *emtr)
|
||||
|
|
@ -53,41 +90,10 @@ void SPL_020A1EC4(const void *obj,SPLParticle *ptcl,VecFx32 *pos,SPLEmitter *emt
|
|||
}
|
||||
}
|
||||
|
||||
void SPL_020A1FE0(const void *obj, SPLParticle *ptcl, VecFx32 *pos, SPLEmitter *emtr)
|
||||
void SPL_020A1E30(const void *obj, SPLParticle *ptcl, VecFx32 *pos, SPLEmitter *emtr)
|
||||
{
|
||||
SPLSpin *spin = (SPLSpin *)obj;
|
||||
MtxFx33 rot;
|
||||
switch (spin->axis_type) {
|
||||
case 0: MTX_RotX33(&rot, FX_SinIdx(spin->radian), FX_CosIdx(spin->radian)); break;
|
||||
case 1: MTX_RotY33(&rot, FX_SinIdx(spin->radian), FX_CosIdx(spin->radian)); break;
|
||||
case 2: MTX_RotZ33(&rot, FX_SinIdx(spin->radian), FX_CosIdx(spin->radian)); break;
|
||||
}
|
||||
|
||||
MTX_MultVec33(&ptcl->unk_08, &rot, &ptcl->unk_08);
|
||||
}
|
||||
|
||||
void SPL_020A20B8(const void *obj, SPLParticle *ptcl, VecFx32 *pos, SPLEmitter *emtr)
|
||||
{
|
||||
SPLMagnet *magnet = (SPLMagnet *)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;
|
||||
}
|
||||
|
||||
void SPL_020A213C(const void *obj, SPLParticle *ptcl, VecFx32 *acc, SPLEmitter *emtr)
|
||||
{
|
||||
SPLRandom *rng = (SPLRandom *)obj;
|
||||
if ((ptcl->unk_26 % rng->intvl) == 0) {
|
||||
acc->x += (((fx32)(rng->mag.x * rng_next(0x17))) - rng->mag.x * 256) >> 8;
|
||||
acc->y += (((fx32)(rng->mag.y * rng_next(0x17))) - rng->mag.y * 256) >> 8;
|
||||
acc->z += (((fx32)(rng->mag.z * rng_next(0x17))) - rng->mag.z * 256) >> 8;
|
||||
}
|
||||
}
|
||||
|
||||
void SPL_020A2204(const void *obj,SPLParticle *ptcl,VecFx32 *pos, SPLEmitter *emtr)
|
||||
{
|
||||
SPLGravity *gravity = (SPLGravity *)obj;
|
||||
pos->x += gravity->mag.x;
|
||||
pos->y += gravity->mag.y;
|
||||
pos->z += gravity->mag.z;
|
||||
SPLConvergence *conv = (SPLConvergence *)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)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,27 +2,26 @@
|
|||
|
||||
#include <nitro/fx/fx.h>
|
||||
|
||||
SPLNode *sub_020A2238(SPLList *list, SPLNode *node)
|
||||
void sub_020A2304(SPLList *list, SPLNode *node)
|
||||
{
|
||||
SPLNode *next = node->p_next;
|
||||
if (next == NULL) {
|
||||
if (list->p_begin == node) {
|
||||
list->p_begin = NULL;
|
||||
list->p_end = NULL;
|
||||
} else {
|
||||
node->p_prev->p_next = NULL;
|
||||
list->p_end = list->p_end->p_prev;
|
||||
}
|
||||
} else if (list->p_begin == node) {
|
||||
list->p_begin = next;
|
||||
list->p_begin->p_prev = NULL;
|
||||
if (list->p_begin == NULL) {
|
||||
list->p_begin = node;
|
||||
list->p_end = node;
|
||||
node->p_next = NULL;
|
||||
node->p_prev = node->p_next;
|
||||
} else {
|
||||
next->p_prev = node->p_prev;
|
||||
node->p_prev->p_next = node->p_next;
|
||||
node->p_next = list->p_begin;
|
||||
node->p_prev = NULL;
|
||||
list->p_begin->p_prev = node;
|
||||
list->p_begin = node;
|
||||
}
|
||||
|
||||
list->node_num -= 1;
|
||||
return node;
|
||||
list->node_num += 1;
|
||||
}
|
||||
|
||||
void spl_push_back(SPLList *list, SPLNode *node)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SPLNode *sub_020A22B8(SPLList *list)
|
||||
|
|
@ -49,19 +48,30 @@ SPLNode *sub_020A22B8(SPLList *list)
|
|||
return node;
|
||||
}
|
||||
|
||||
void sub_020A2304(SPLList *list, SPLNode *node)
|
||||
SPLNode *spl_pop_back(SPLList *list)
|
||||
{
|
||||
if (list->p_begin == NULL) {
|
||||
list->p_begin = node;
|
||||
list->p_end = node;
|
||||
node->p_next = NULL;
|
||||
node->p_prev = node->p_next;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SPLNode *sub_020A2238(SPLList *list, SPLNode *node)
|
||||
{
|
||||
SPLNode *next = node->p_next;
|
||||
if (next == NULL) {
|
||||
if (list->p_begin == node) {
|
||||
list->p_begin = NULL;
|
||||
list->p_end = NULL;
|
||||
} else {
|
||||
node->p_prev->p_next = NULL;
|
||||
list->p_end = list->p_end->p_prev;
|
||||
}
|
||||
} else if (list->p_begin == node) {
|
||||
list->p_begin = next;
|
||||
list->p_begin->p_prev = NULL;
|
||||
} else {
|
||||
node->p_next = list->p_begin;
|
||||
node->p_prev = NULL;
|
||||
list->p_begin->p_prev = node;
|
||||
list->p_begin = node;
|
||||
next->p_prev = node->p_prev;
|
||||
node->p_prev->p_next = node->p_next;
|
||||
}
|
||||
|
||||
list->node_num += 1;
|
||||
list->node_num -= 1;
|
||||
return node;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,14 +4,6 @@
|
|||
|
||||
u32 Unk_021C3A38;
|
||||
|
||||
void sub_020A2354(VecFx32 *vec)
|
||||
{
|
||||
vec->x = rng_next(8);
|
||||
vec->y = rng_next(8);
|
||||
vec->z = 0;
|
||||
VEC_Normalize(vec, vec);
|
||||
}
|
||||
|
||||
void sub_020A23B0(VecFx32 *vec)
|
||||
{
|
||||
vec->x = rng_next(8);
|
||||
|
|
@ -19,3 +11,11 @@ void sub_020A23B0(VecFx32 *vec)
|
|||
vec->z = rng_next(8);
|
||||
VEC_Normalize(vec, vec);
|
||||
}
|
||||
|
||||
void sub_020A2354(VecFx32 *vec)
|
||||
{
|
||||
vec->x = rng_next(8);
|
||||
vec->y = rng_next(8);
|
||||
vec->z = 0;
|
||||
VEC_Normalize(vec, vec);
|
||||
}
|
||||
|
|
|
|||
BIN
tools/cw/1.2/base_b73/lmgr8c.dll
Normal file
BIN
tools/cw/1.2/base_b73/lmgr8c.dll
Normal file
Binary file not shown.
BIN
tools/cw/1.2/base_b73/mwasmarm.exe
Normal file
BIN
tools/cw/1.2/base_b73/mwasmarm.exe
Normal file
Binary file not shown.
BIN
tools/cw/1.2/base_b73/mwccarm.exe
Normal file
BIN
tools/cw/1.2/base_b73/mwccarm.exe
Normal file
Binary file not shown.
BIN
tools/cw/1.2/base_b73/mwldarm.exe
Normal file
BIN
tools/cw/1.2/base_b73/mwldarm.exe
Normal file
Binary file not shown.
|
|
@ -465,6 +465,25 @@ char *replace_str(char *str, char *orig, char *rep, int start)
|
|||
return str;
|
||||
}
|
||||
|
||||
void remove_ipa_arguments(int *argc, _TCHAR **argv)
|
||||
{
|
||||
int new_argc = 0;
|
||||
for (int i = 0; i < *argc; i++) {
|
||||
if (argv[i] && _tcscmp(argv[i], _T("-ipa")) == 0 && (i + 1) < *argc) {
|
||||
// Skip the current "-ipa" argument and the following argument.
|
||||
i++; // Increment to skip the next argument.
|
||||
} else {
|
||||
// Keep this argument, by moving it down if necessary.
|
||||
argv[new_argc] = argv[i];
|
||||
new_argc++;
|
||||
}
|
||||
}
|
||||
|
||||
// Update the original argc to the new count of arguments.
|
||||
*argc = new_argc;
|
||||
argv[*argc] = NULL;
|
||||
}
|
||||
|
||||
int _tmain(int argc, _TCHAR *argv[])
|
||||
{
|
||||
if (argc < 2) {
|
||||
|
|
@ -490,6 +509,10 @@ int _tmain(int argc, _TCHAR *argv[])
|
|||
|
||||
if (args.wrap_ver) tool_ver = args.wrap_ver;
|
||||
|
||||
if (_tcscmp(tool_ver, _T("1.2/base_b73")) == 0) {
|
||||
remove_ipa_arguments(&new_argc, new_argv);
|
||||
}
|
||||
|
||||
// Make a path of the chosen tool
|
||||
size_t tool_size = _tcslen(tool_dir) + 1 + _tcslen(tool_ver) + 1 +
|
||||
_tcslen(tool_bin) + 5;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user