diff --git a/include/functypes/funcptr_020146F4.h b/include/functypes/funcptr_020146F4.h index b0ad1f17d..925fa5927 100644 --- a/include/functypes/funcptr_020146F4.h +++ b/include/functypes/funcptr_020146F4.h @@ -3,6 +3,6 @@ #include "spl.h" -typedef void (*UnkFuncPtr_020146F4)(UnkSPLStruct6 *); +typedef void (*UnkFuncPtr_020146F4)(SPLEmitter *); #endif // POKEPLATINUM_FUNCPTR_020146F4_H diff --git a/include/overlay012/ov12_0221FC20.h b/include/overlay012/ov12_0221FC20.h index 5cfdbc57a..3df1cfbc5 100644 --- a/include/overlay012/ov12_0221FC20.h +++ b/include/overlay012/ov12_0221FC20.h @@ -41,7 +41,7 @@ u16 ov12_02220240(UnkStruct_ov12_0221FCDC *param0); u16 ov12_02220248(UnkStruct_ov12_0221FCDC *param0); UnkStruct_02014014 *ov12_02220250(UnkStruct_ov12_0221FCDC *param0); UnkStruct_02014014 *ov12_02220260(UnkStruct_ov12_0221FCDC *param0, int param1); -UnkSPLStruct6 *ov12_0222026C(UnkStruct_ov12_0221FCDC *param0, int param1); +SPLEmitter *ov12_0222026C(UnkStruct_ov12_0221FCDC *param0, int param1); BGL *ov12_02220278(UnkStruct_ov12_0221FCDC *param0); s32 ov12_02220280(UnkStruct_ov12_0221FCDC *param0, int param1); CellActorData *ov12_02220298(UnkStruct_ov12_0221FCDC *param0, int param1); diff --git a/include/overlay012/ov12_022237EC.h b/include/overlay012/ov12_022237EC.h index e3ad3c1bc..b747de2f7 100644 --- a/include/overlay012/ov12_022237EC.h +++ b/include/overlay012/ov12_022237EC.h @@ -10,7 +10,7 @@ UnkStruct_02014014 *ov12_022237F0(int param0, int param1, int param2); UnkStruct_02014014 *ov12_02223818(int param0, int param1, int param2, int param3); void *ov12_02223844(NARC *param0, int param1, int param2); UnkStruct_02014014 *ov12_0222384C(NARC *param0, int param1, int param2, int param3); -UnkSPLStruct6 *ov12_02223880(UnkStruct_02014014 *param0, int param1, int param2, void *param3); +SPLEmitter *ov12_02223880(UnkStruct_02014014 *param0, int param1, int param2, void *param3); void ov12_02223894(UnkStruct_02014014 *param0); #endif // POKEPLATINUM_OV12_022237EC_H diff --git a/include/overlay012/ov12_0222389C.h b/include/overlay012/ov12_0222389C.h index dd518ef8c..0ed1caef6 100644 --- a/include/overlay012/ov12_0222389C.h +++ b/include/overlay012/ov12_0222389C.h @@ -3,26 +3,26 @@ #include "spl.h" -void ov12_022238DC(UnkSPLStruct6 *param0); -void ov12_022238E0(UnkSPLStruct6 *param0); -void ov12_02223998(UnkSPLStruct6 *param0); -void ov12_022239F4(UnkSPLStruct6 *param0); -void ov12_02223A38(UnkSPLStruct6 *param0); -void ov12_02223A7C(UnkSPLStruct6 *param0); -void ov12_02223AC8(UnkSPLStruct6 *param0); -void ov12_02223B30(UnkSPLStruct6 *param0); -void ov12_02223B98(UnkSPLStruct6 *param0); -void ov12_02224168(UnkSPLStruct6 *param0); -void ov12_02224174(UnkSPLStruct6 *param0); -void ov12_02224180(UnkSPLStruct6 *param0); -void ov12_0222418C(UnkSPLStruct6 *param0); -void ov12_02224198(UnkSPLStruct6 *param0); -void ov12_022241A4(UnkSPLStruct6 *param0); -void ov12_022241B0(UnkSPLStruct6 *param0); -void ov12_022241BC(UnkSPLStruct6 *param0); -void ov12_022241C8(UnkSPLStruct6 *param0); -void ov12_022241D4(UnkSPLStruct6 *param0); -void ov12_022241E0(UnkSPLStruct6 *param0); -void ov12_022241EC(UnkSPLStruct6 *param0); +void ov12_022238DC(SPLEmitter *param0); +void ov12_022238E0(SPLEmitter *param0); +void ov12_02223998(SPLEmitter *param0); +void ov12_022239F4(SPLEmitter *param0); +void ov12_02223A38(SPLEmitter *param0); +void ov12_02223A7C(SPLEmitter *param0); +void ov12_02223AC8(SPLEmitter *param0); +void ov12_02223B30(SPLEmitter *param0); +void ov12_02223B98(SPLEmitter *param0); +void ov12_02224168(SPLEmitter *param0); +void ov12_02224174(SPLEmitter *param0); +void ov12_02224180(SPLEmitter *param0); +void ov12_0222418C(SPLEmitter *param0); +void ov12_02224198(SPLEmitter *param0); +void ov12_022241A4(SPLEmitter *param0); +void ov12_022241B0(SPLEmitter *param0); +void ov12_022241BC(SPLEmitter *param0); +void ov12_022241C8(SPLEmitter *param0); +void ov12_022241D4(SPLEmitter *param0); +void ov12_022241E0(SPLEmitter *param0); +void ov12_022241EC(SPLEmitter *param0); #endif // POKEPLATINUM_OV12_0222389C_H diff --git a/include/overlay012/ov12_0222421C.h b/include/overlay012/ov12_0222421C.h index fd604b2e1..ac1d7af0f 100644 --- a/include/overlay012/ov12_0222421C.h +++ b/include/overlay012/ov12_0222421C.h @@ -5,7 +5,7 @@ #include "spl.h" -void ov12_02224F14(UnkSPLStruct6 *param0); +void ov12_02224F14(SPLEmitter *param0); s8 ov12_02224FC4(UnkStruct_ov12_02225640 *param0); #endif // POKEPLATINUM_OV12_0222421C_H diff --git a/include/overlay012/ov12_02225104.h b/include/overlay012/ov12_02225104.h index 1f78d2478..b8abd60cf 100644 --- a/include/overlay012/ov12_02225104.h +++ b/include/overlay012/ov12_02225104.h @@ -5,7 +5,7 @@ #include "spl.h" -void ov12_022255D4(int param0, UnkSPLStruct6 *param1, UnkStruct_ov12_02225640 *param2); +void ov12_022255D4(int param0, SPLEmitter *param1, UnkStruct_ov12_02225640 *param2); int ov12_022255EC(int param0); int ov12_02225614(void); diff --git a/include/overlay012/ov12_02225640.h b/include/overlay012/ov12_02225640.h index 4406cf689..a31dc4546 100644 --- a/include/overlay012/ov12_02225640.h +++ b/include/overlay012/ov12_02225640.h @@ -5,6 +5,6 @@ #include "spl.h" -void ov12_0222584C(int param0, UnkSPLStruct6 *param1, UnkStruct_ov12_02225640 *param2); +void ov12_0222584C(int param0, SPLEmitter *param1, UnkStruct_ov12_02225640 *param2); #endif // POKEPLATINUM_OV12_02225640_H diff --git a/include/overlay077/ov77_021D6C70.h b/include/overlay077/ov77_021D6C70.h index ef11cf651..84f043c08 100644 --- a/include/overlay077/ov77_021D6C70.h +++ b/include/overlay077/ov77_021D6C70.h @@ -9,7 +9,7 @@ const int ov77_021D6CB8(void); UnkStruct_02014014 *ov77_021D6CBC(UnkStruct_ov77_021D6CFC *param0); -UnkSPLStruct6 *ov77_021D6CD0(UnkStruct_ov77_021D6CFC *param0, int param1); +SPLEmitter *ov77_021D6CD0(UnkStruct_ov77_021D6CFC *param0, int param1); void ov77_021D6CFC(UnkStruct_ov77_021D6CFC *param0); void ov77_021D6E28(UnkStruct_ov77_021D6CFC *param0); void ov77_021D6E40(UnkStruct_ov77_021D6CFC *param0); diff --git a/include/overlay119/struct_ov119_021D14DC.h b/include/overlay119/struct_ov119_021D14DC.h index 1e4c4ec76..8e5a06dbc 100644 --- a/include/overlay119/struct_ov119_021D14DC.h +++ b/include/overlay119/struct_ov119_021D14DC.h @@ -9,7 +9,7 @@ typedef struct { UnkStruct_ov119_021D1930 unk_00; - UnkSPLStruct6 *unk_08; + SPLEmitter *unk_08; UnkStruct_02014014 *unk_0C; } UnkStruct_ov119_021D14DC; diff --git a/include/struct_defs/struct_020147B8.h b/include/struct_defs/struct_020147B8.h index 8ae22c433..8fd2d6c59 100644 --- a/include/struct_defs/struct_020147B8.h +++ b/include/struct_defs/struct_020147B8.h @@ -3,11 +3,11 @@ #include -typedef struct UnkSPLStruct8_t UnkSPLStruct8; -struct UnkSPLStruct6_t; +typedef struct SPLParticle_t SPLParticle; +struct SPLEmitter_t; typedef struct { - void (*unk_00)(const void *, UnkSPLStruct8 *, VecFx32 *, struct UnkSPLStruct6_t *); + void (*unk_00)(const void *, SPLParticle *, VecFx32 *, struct SPLEmitter_t *); const void *unk_04; } UnkStruct_020147B8; diff --git a/include/struct_defs/struct_0207C8C4.h b/include/struct_defs/struct_0207C8C4.h index 2ec4f0149..5bd688f75 100644 --- a/include/struct_defs/struct_0207C8C4.h +++ b/include/struct_defs/struct_0207C8C4.h @@ -8,7 +8,7 @@ typedef struct { UnkStruct_0207C894 unk_00; - UnkSPLStruct6 *unk_08; + SPLEmitter *unk_08; UnkStruct_02014014 *unk_0C; } UnkStruct_0207C8C4; diff --git a/include/unk_02014000.h b/include/unk_02014000.h index 30b672d09..897379029 100644 --- a/include/unk_02014000.h +++ b/include/unk_02014000.h @@ -25,11 +25,11 @@ void sub_02014674(UnkStruct_02014014 *param0); int sub_02014680(void); int sub_0201469C(void); int sub_020146C0(void); -UnkSPLStruct6 *sub_020146E4(UnkStruct_02014014 *param0, int param1, const VecFx32 *param2); -UnkSPLStruct6 *sub_020146F4(UnkStruct_02014014 *param0, int param1, UnkFuncPtr_020146F4 param2, void *param3); +SPLEmitter *sub_020146E4(UnkStruct_02014014 *param0, int param1, const VecFx32 *param2); +SPLEmitter *sub_020146F4(UnkStruct_02014014 *param0, int param1, UnkFuncPtr_020146F4 param2, void *param3); s32 sub_02014710(UnkStruct_02014014 *param0); void sub_02014718(UnkStruct_02014014 *param0); -void sub_02014724(UnkStruct_02014014 *param0, UnkSPLStruct6 *param1); +void sub_02014724(UnkStruct_02014014 *param0, SPLEmitter *param1); void *sub_02014730(UnkStruct_02014014 *param0); void sub_02014734(UnkStruct_02014014 *param0, VecFx32 *param1); void sub_02014744(UnkStruct_02014014 *param0, const VecFx32 *param1); @@ -38,20 +38,20 @@ void sub_02014770(VecFx32 *param0); Camera *sub_02014784(UnkStruct_02014014 *param0); void sub_02014788(UnkStruct_02014014 *param0, int param1); u8 sub_02014790(UnkStruct_02014014 *param0); -void sub_02014798(UnkSPLStruct6 *param0, VecFx16 *param1); -void sub_020147B0(UnkSPLStruct6 *param0, fx32 param1); -void sub_02014874(UnkSPLStruct6 *param0, VecFx16 *param1); -void sub_02014890(UnkSPLStruct6 *param0, VecFx32 *param1); -void sub_020148A8(UnkSPLStruct6 *param0, VecFx32 *param1); -void sub_020148DC(UnkSPLStruct6 *param0, fx16 *param1); -void sub_020148F4(UnkSPLStruct6 *param0, fx16 *param1); -void sub_02014910(UnkSPLStruct6 *param0, u16 *param1); -void sub_02014924(UnkSPLStruct6 *param0, u16 *param1); -void sub_02014940(UnkSPLStruct6 *param0, u16 *param1); -void sub_02014954(UnkSPLStruct6 *param0, u16 *param1); -void sub_02014970(UnkSPLStruct6 *param0, VecFx32 *param1); -void sub_02014988(UnkSPLStruct6 *param0, VecFx32 *param1); -void sub_020149BC(UnkSPLStruct6 *param0, fx16 *param1); -void sub_020149D4(UnkSPLStruct6 *param0, fx16 *param1); +void sub_02014798(SPLEmitter *param0, VecFx16 *param1); +void sub_020147B0(SPLEmitter *param0, fx32 param1); +void sub_02014874(SPLEmitter *param0, VecFx16 *param1); +void sub_02014890(SPLEmitter *param0, VecFx32 *param1); +void sub_020148A8(SPLEmitter *param0, VecFx32 *param1); +void sub_020148DC(SPLEmitter *param0, fx16 *param1); +void sub_020148F4(SPLEmitter *param0, fx16 *param1); +void sub_02014910(SPLEmitter *param0, u16 *param1); +void sub_02014924(SPLEmitter *param0, u16 *param1); +void sub_02014940(SPLEmitter *param0, u16 *param1); +void sub_02014954(SPLEmitter *param0, u16 *param1); +void sub_02014970(SPLEmitter *param0, VecFx32 *param1); +void sub_02014988(SPLEmitter *param0, VecFx32 *param1); +void sub_020149BC(SPLEmitter *param0, fx16 *param1); +void sub_020149D4(SPLEmitter *param0, fx16 *param1); #endif // POKEPLATINUM_UNK_02014000_H diff --git a/lib/spl/include/spl.h b/lib/spl/include/spl.h index 949dc66eb..f2ad9a923 100644 --- a/lib/spl/include/spl.h +++ b/lib/spl/include/spl.h @@ -1,6 +1,7 @@ #ifndef POKEPLATINUM_SPL_H #define POKEPLATINUM_SPL_H +#include "nitro/types.h" #ifdef __cplusplus extern "C" { #endif @@ -90,9 +91,9 @@ typedef union { }; } UnkSPLUnion5; -typedef struct UnkSPLStruct8_t { - struct UnkSPLStruct8_t * unk_00; - struct UnkSPLStruct8_t * unk_04; +typedef struct SPLParticle_t { + struct SPLParticle_t * unk_00; + struct SPLParticle_t * unk_04; VecFx32 unk_08; VecFx32 unk_14; u16 unk_20; @@ -114,15 +115,29 @@ typedef struct UnkSPLStruct8_t { fx16 unk_34; GXRgb unk_36; VecFx32 unk_38; -} UnkSPLStruct8; // size=0x44 +} SPLParticle; // size=0x44 typedef struct UnkSPLStruct3_t { - UnkSPLStruct8 * unk_00; - u8 padding_04[8]; + SPLParticle * unk_00; + int unk_04; + SPLParticle * unk_08; } UnkSPLStruct3; // size=0xc typedef struct { - u8 padding_00[4]; + union + { + u32 all; + u8 padding_00[4]; + struct + { + u32 terminate:1; + u32 stop_generate:1; + u32 stop_calc:1; + u32 stop_draw:1; + u32 started: 1 ; + u32 reserved0:27; + }; + }; } UnkSPLStruct7; typedef struct UnkSPLStruct9_t { @@ -286,12 +301,12 @@ typedef struct UnkSPLStruct5_t { u16 unk_12; } UnkSPLStruct5; -typedef struct UnkSPLStruct6_t { - struct UnkSPLStruct6_t * unk_00; - struct UnkSPLStruct6_t * unk_04; +typedef struct SPLEmitter_t { + struct SPLEmitter_t * unk_00; + struct SPLEmitter_t * unk_04; UnkSPLStruct3 unk_08; UnkSPLStruct3 unk_4C; - UnkSPLStruct4 * unk_90; + UnkSPLStruct4 * p_res; UnkSPLStruct7 unk_94; VecFx32 unk_98; VecFx32 unk_A4; @@ -321,22 +336,22 @@ typedef struct UnkSPLStruct6_t { } unk_F0; VecFx16 unk_F4; VecFx16 unk_FA; - void (* unk_100)(struct UnkSPLStruct6_t *, unsigned int); + void (* unk_100)(struct SPLEmitter_t *, unsigned int); void * unk_104; union { u32 unk_108_val1; u16 unk_108_val2[2]; u8 unk_108_val3[4]; } unk_108; -} UnkSPLStruct6; +} SPLEmitter; typedef struct UnkSPLStruct2_t { - UnkSPLStruct6 * unk_00; + SPLEmitter * unk_00; int unk_04; - UnkSPLStruct6 * unk_08; + SPLEmitter * unk_08; } UnkSPLStruct2; // size=0xc -typedef struct UnkSPLStruct1_t { +typedef struct SPLManager_t { UnkFuncPtr_0209CD00 unk_00; UnkSPLStruct2 unk_04; UnkSPLStruct2 unk_10; @@ -357,60 +372,146 @@ typedef struct UnkSPLStruct1_t { } unk_38; s32 unk_3C; struct { - UnkSPLStruct6 * unk_00; + SPLEmitter * unk_00; const MtxFx43 * unk_04; } unk_40; u16 unk_48; u16 unk_4A; -} UnkSPLStruct1; // size=0x4c +} SPLManager; // size=0x4c -void SPL_0209C400(UnkSPLStruct1 * param0); -void SPL_0209C444(UnkSPLStruct1 * param0, UnkSPLStruct6 * param1); -UnkSPLStruct6 * SPL_0209C4D8(UnkSPLStruct1 * param0, int param1, void (* param2)(struct UnkSPLStruct6_t *)); -void SPL_0209C5E0(UnkSPLStruct1 * param0, const MtxFx43 * param1); -UnkSPLStruct6 * SPL_0209C56C(UnkSPLStruct1 * param0, int param1, const VecFx32 * param2); -void SPL_0209C6A8(UnkSPLStruct1 * param0); -BOOL SPL_0209C7E0(UnkSPLStruct1 * param0); -BOOL SPL_0209C7F4(UnkSPLStruct1 * param0); -BOOL SPL_0209C808(UnkSPLStruct1 * param0, u32 (* param1)(u32, BOOL)); -BOOL SPL_0209C8BC(UnkSPLStruct1 * param0, u32 (* param1)(u32, BOOL)); -void SPL_0209C988(UnkSPLStruct1 * param0, const void * param1); -UnkSPLStruct1 * SPL_0209CD00(UnkFuncPtr_0209CD00 param0, u16 param1, u16 param2, u16 param3, u16 param4, u16 param5); +typedef struct SPLGravity { + VecFx16 mag; + u16 reserved0; +} SPLGravity; -void SPL_020A1E30(const void * param0, UnkSPLStruct8 * param1, VecFx32 * param2, struct UnkSPLStruct6_t * param3); -void SPL_020A1EC4(const void * param0, UnkSPLStruct8 * param1, VecFx32 * param2, struct UnkSPLStruct6_t * param3); -void SPL_020A1FE0(const void * param0, UnkSPLStruct8 * param1, VecFx32 * param2, struct UnkSPLStruct6_t * param3); -void SPL_020A20B8(const void * param0, UnkSPLStruct8 * param1, VecFx32 * param2, struct UnkSPLStruct6_t * param3); -void SPL_020A213C(const void * param0, UnkSPLStruct8 * param1, VecFx32 * param2, struct UnkSPLStruct6_t * param3); -void SPL_020A2204(const void * param0, UnkSPLStruct8 * param1, VecFx32 * param2, struct UnkSPLStruct6_t * param3); +typedef struct SPLRandom { + VecFx16 mag; + u16 intvl; +} SPLRandom; -static inline void SPL_UnkInline1 (UnkSPLStruct6 * param0, const VecFx32 * param1) +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 SPLNode { + struct SPLNode* p_next; + struct SPLNode* p_prev; +} SPLNode; + +typedef struct SPLList { + SPLNode* p_begin; + int node_num; + SPLNode* p_end; +} SPLList; + +void SPL_0209C400(SPLManager * param0); +void SPL_0209C444(SPLManager * param0, SPLEmitter * param1); +SPLEmitter * SPL_0209C4D8(SPLManager * param0, int param1, void (* param2)(struct SPLEmitter_t *)); +void SPL_0209C5E0(SPLManager * param0, const MtxFx43 * param1); +SPLEmitter * SPL_0209C56C(SPLManager * param0, int param1, const VecFx32 * param2); +void SPL_0209C6A8(SPLManager * param0); +BOOL SPL_0209C7E0(SPLManager * param0); +BOOL SPL_0209C7F4(SPLManager * param0); +BOOL SPL_0209C808(SPLManager * param0, u32 (* param1)(u32, BOOL)); +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_0209D998(SPLEmitter *emtr, UnkSPLStruct4 *res, const VecFx32 *param2); +void sub_0209CF00(SPLManager *mgr); +void sub_0209D150(SPLManager *mgr, SPLEmitter *emtr); + +SPLNode *sub_020A22B8(SPLList *list); +void sub_020A2304(SPLList *list, SPLNode *node); +SPLNode *sub_020A2238(SPLList *list, SPLNode *node); + +u32 sub_0209CE90(u32 param0, BOOL param1); +u32 sub_0209CEB4(u32 param0, BOOL param1); + +void sub_0209D064(SPLManager *mgr); +void sub_0209CF7C(SPLManager *mgr); + +typedef void(*DrawFunc)(SPLManager *mgr, SPLParticle *ptcl); +typedef void(*SetTexFunc)(UnkSPLStruct5 *tex); + +void sub_0209FAB8(SPLManager *mgr, SPLParticle *ptcl); // spl_draw_chld_bb +void sub_0209ECF0(SPLManager *mgr, SPLParticle *ptcl); // spl_draw_chld_dbb +void sub_0209E650(SPLManager *mgr, SPLParticle *ptcl); // spl_draw_chld_pol +void sub_0209DD54(SPLManager *mgr, SPLParticle *ptcl); // spl_draw_chld_dpl + +void sub_0209FF0C(SPLManager *mgr, SPLParticle *ptcl); // spl_draw_bb +void sub_0209F3D0(SPLManager *mgr, SPLParticle *ptcl); // spl_draw_dbb +void sub_0209E9A0(SPLManager *mgr, SPLParticle *ptcl); // spl_draw_pol +void sub_0209E1D4(SPLManager *mgr, SPLParticle *ptcl); // spl_draw_dpl + +void sub_0209DC68(UnkSPLStruct5 *tex); // spl_set_tex +void sub_0209DC64(UnkSPLStruct5 *tex); // spl_set_tex_dummy + +static inline void SPL_UnkInline1 (SPLEmitter * param0, const VecFx32 * param1) { - param0->unk_98.x = param1->x + param0->unk_90->unk_00->unk_04.x; - param0->unk_98.y = param1->y + param0->unk_90->unk_00->unk_04.y; - param0->unk_98.z = param1->z + param0->unk_90->unk_00->unk_04.z; + param0->unk_98.x = param1->x + param0->p_res->unk_00->unk_04.x; + param0->unk_98.y = param1->y + param0->p_res->unk_00->unk_04.y; + param0->unk_98.z = param1->z + param0->p_res->unk_00->unk_04.z; } -static inline void SPL_UnkInline2 (UnkSPLStruct6 * param0, fx32 param1) +static inline void SPL_UnkInline2 (SPLEmitter * param0, fx32 param1) { - param0->unk_98.x = param1 + param0->unk_90->unk_00->unk_04.x; + param0->unk_98.x = param1 + param0->p_res->unk_00->unk_04.x; } -static inline void SPL_UnkInline3 (UnkSPLStruct6 * param0, fx32 param1) +static inline void SPL_UnkInline3 (SPLEmitter * param0, fx32 param1) { - param0->unk_98.y = param1 + param0->unk_90->unk_00->unk_04.y; + param0->unk_98.y = param1 + param0->p_res->unk_00->unk_04.y; } -static inline void SPL_UnkInline4 (UnkSPLStruct6 * param0, fx32 param1) +static inline void SPL_UnkInline4 (SPLEmitter * param0, fx32 param1) { - param0->unk_98.z = param1 + param0->unk_90->unk_00->unk_04.z; + param0->unk_98.z = param1 + param0->p_res->unk_00->unk_04.z; } -static inline void SPL_UnkInline5 (UnkSPLStruct6 * param0, const VecFx16 * param1) +static inline void SPL_UnkInline5 (SPLEmitter * param0, const VecFx16 * param1) { param0->unk_C0 = *param1; } +extern u32 Unk_021C3A38; + +static inline u32 rng_next(u32 shift) +{ + Unk_021C3A38 = Unk_021C3A38 * 0x5eedf715 + 0x1b0cb173; + return Unk_021C3A38 >> shift; +} #ifdef __cplusplus } diff --git a/lib/spl/meson.build b/lib/spl/meson.build index 6c2a76c9d..e1679daf8 100644 --- a/lib/spl/meson.build +++ b/lib/spl/meson.build @@ -1,12 +1,12 @@ libspl_srcs = files( - 'asm/unk_0209C400.s', - 'asm/unk_0209CF00.s', + 'src/unk_0209C400.c', + 'src/unk_0209CF00.c', 'asm/unk_0209DD54.s', - 'asm/unk_020A05BC.s', - 'asm/unk_020A19F0.s', - 'asm/unk_020A1E30.s', - 'asm/unk_020A2238.s', - 'asm/unk_020A2354.s' + 'src/unk_020A05BC.c', + 'src/unk_020A19F0.c', + 'src/unk_020A1E30.c', + 'src/unk_020A2238.c', + 'src/unk_020A2354.c' ) libspl_public_includes = include_directories('include') diff --git a/lib/spl/src/unk_0209C400.c b/lib/spl/src/unk_0209C400.c new file mode 100644 index 000000000..4ffaafe6d --- /dev/null +++ b/lib/spl/src/unk_0209C400.c @@ -0,0 +1,495 @@ +#include "spl.h" + +#include +#include +#include + +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_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); +} + +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_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_0209CEB4); +} + +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)) +{ + 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; + } + } + + GX_EndLoadTex(); + return TRUE; +} + +asm static void SPL_0209C988(SPLManager *mgr, void *spa) +{ + stmfd sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} + sub sp, sp, #0x2c + mov sb, r1 + ldrh r1, [sb, #8] + mov sl, r0 + mov r8, #0x20 + strh r1, [sl, #0x30] + ldrh r0, [sb, #0xa] + strh r0, [sl, #0x32] + ldrh r0, [sl, #0x30] + ldr r1, [sl] + mov r0, r0, lsl #5 + blx r1 + str r0, [sl, #0x28] + ldrh r2, [sl, #0x30] + ldr r0, [sl, #0x28] + mov r1, #0 + mov r2, r2, lsl #5 + bl MI_CpuFill8 + ldrh r1, [sl, #0x30] + mov r0, #0 + str r0, [sp] + cmp r1, #0 + ble _0209CC28 + mov r6, r0 + str r0, [sp, #0x10] + str r0, [sp, #0x14] + str r0, [sp, #0x18] + str r0, [sp, #0x1c] + str r0, [sp, #0x20] + str r0, [sp, #0x24] +_0209CA04: + ldr r1, [sl, #0x28] + add r0, sb, r8 + str r0, [r1, r6] + ldr r0, [r1, r6] + add r8, r8, #0x58 + ldr r0, [r0, #0] + add r7, r1, r6 + str r0, [sp, #0x28] + mov r0, r0, lsl #0x17 + movs r0, r0, lsr #0x1f + addne r0, sb, r8 + strne r0, [r7, #4] + ldreq r0, [sp, #0x10] + addne r8, r8, #0xc + streq r0, [r7, #4] + ldr r0, [sp, #0x28] + mov r0, r0, lsl #0x16 + movs r0, r0, lsr #0x1f + addne r0, sb, r8 + strne r0, [r7, #8] + ldreq r0, [sp, #0x14] + addne r8, r8, #0xc + streq r0, [r7, #8] + ldr r0, [sp, #0x28] + mov r0, r0, lsl #0x15 + movs r0, r0, lsr #0x1f + addne r0, sb, r8 + strne r0, [r7, #0xc] + ldreq r0, [sp, #0x18] + addne r8, r8, #8 + streq r0, [r7, #0xc] + ldr r0, [sp, #0x28] + mov r0, r0, lsl #0x14 + movs r0, r0, lsr #0x1f + addne r0, sb, r8 + strne r0, [r7, #0x10] + ldreq r0, [sp, #0x1c] + addne r8, r8, #0xc + streq r0, [r7, #0x10] + ldr r0, [sp, #0x28] + mov r0, r0, lsl #0xf + movs r0, r0, lsr #0x1f + addne r0, sb, r8 + strne r0, [r7, #0x14] + ldreq r0, [sp, #0x20] + addne r8, r8, #0x14 + streq r0, [r7, #0x14] + ldr r0, [sp, #0x28] + mov r1, r0, lsl #7 + mov r2, r0, lsl #6 + mov r5, r1, lsr #0x1f + mov r4, r2, lsr #0x1f + add r1, r5, r2, lsr #31 + mov r2, r0, lsl #5 + add r1, r1, r2, lsr #31 + mov r3, r0, lsl #4 + mov fp, r2, lsr #0x1f + add r2, r1, r3, lsr #31 + mov r1, r3, lsr #0x1f + mov ip, r0, lsl #3 + str r1, [sp, #4] + mov r3, r0, lsl #2 + mov r0, ip, lsr #0x1f + add r1, r2, ip, lsr #31 + str r0, [sp, #8] + add r0, r1, r3, lsr #31 + strh r0, [r7, #0x1c] + mov r0, r3, lsr #0x1f + str r0, [sp, #0xc] + ldrh r0, [r7, #0x1c] + cmp r0, #0 + beq _0209CC04 + mov r0, r0, lsl #3 + ldr r1, [sl] + blx r1 + str r0, [r7, #0x18] + cmp r5, #0 + ldr r0, [r7, #0x18] + beq _0209CB58 + add r1, sb, r8 + str r1, [r0, #4] + ldr r1, _0209CCE8 + add r8, r8, #8 + str r1, [r0, #0] + add r0, r0, #8 +_0209CB58: + cmp r4, #0 + beq _0209CB78 + add r1, sb, r8 + str r1, [r0, #4] + ldr r1, _0209CCEC + add r8, r8, #8 + str r1, [r0, #0] + add r0, r0, #8 +_0209CB78: + cmp fp, #0 + beq _0209CB98 + add r1, sb, r8 + str r1, [r0, #4] + ldr r1, _0209CCF0 + add r8, r8, #0x10 + str r1, [r0, #0] + add r0, r0, #8 +_0209CB98: + ldr r1, [sp, #4] + cmp r1, #0 + beq _0209CBBC + add r1, sb, r8 + str r1, [r0, #4] + ldr r1, _0209CCF4 + add r8, r8, #4 + str r1, [r0, #0] + add r0, r0, #8 +_0209CBBC: + ldr r1, [sp, #8] + cmp r1, #0 + beq _0209CBE0 + add r1, sb, r8 + str r1, [r0, #4] + ldr r1, _0209CCF8 + add r8, r8, #8 + str r1, [r0, #0] + add r0, r0, #8 +_0209CBE0: + ldr r1, [sp, #0xc] + cmp r1, #0 + beq _0209CC0C + add r1, sb, r8 + str r1, [r0, #4] + ldr r1, _0209CCFC + add r8, r8, #0x10 + str r1, [r0, #0] + b _0209CC0C +_0209CC04: + ldr r0, [sp, #0x24] + str r0, [r7, #0x18] +_0209CC0C: + ldr r0, [sp] + ldrh r1, [sl, #0x30] + add r0, r0, #1 + add r6, r6, #0x20 + str r0, [sp] + cmp r0, r1 + blt _0209CA04 +_0209CC28: + ldrh r2, [sl, #0x32] + mov r0, #0x14 + ldr r1, [sl] + mul r0, r2, r0 + blx r1 + str r0, [sl, #0x2c] + ldrh r3, [sl, #0x32] + mov r1, #0x14 + ldr r0, [sl, #0x2c] + mul r2, r3, r1 + mov r1, #0 + bl MI_CpuFill8 + ldrh r0, [sl, #0x32] + mov r3, #0 + cmp r0, #0 + addle sp, sp, #0x2c + ldmleia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} + bxle lr + mov r4, r3 + mov r0, #1 +_0209CC78: + ldr r2, [sl, #0x2c] + add r1, sb, r8 + str r1, [r2, r4] + ldr r5, [r1, #4] + add r2, r2, r4 + mov r5, r5, lsl #0x18 + mov r5, r5, lsr #0x1c + add r5, r5, #3 + mov r5, r0, lsl r5 + strh r5, [r2, #0x10] + ldr r5, [r1, #4] + add r3, r3, #1 + mov r5, r5, lsl #0x14 + mov r5, r5, lsr #0x1c + add r5, r5, #3 + mov r5, r0, lsl r5 + strh r5, [r2, #0x12] + ldr r5, [r1, #4] + add r4, r4, #0x14 + str r5, [r2, #0xc] + ldrh r2, [sl, #0x32] + ldr r1, [r1, #0x1c] + cmp r3, r2 + add r8, r8, r1 + blt _0209CC78 + add sp, sp, #0x2c + ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} + bx lr +} + +SPLManager *SPL_0209CD00(void *(*alloc)(u32), u16 max_emtr, u16 max_ptcl, u16 fixPolyID, u16 minPolyID, u16 maxPolyID) +{ + SPLManager *mgr; + SPLEmitter *emtr; + SPLParticle *ptcl; + int i; + + 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]); + } + + 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; +} + +u32 sub_0209CE90(u32 size, BOOL is4Pltt) +{ + return (NNS_GfdAllocPlttVram(size, is4Pltt, 0) & 0xFFFF) * 8; +} + +u32 sub_0209CEC8(u32 size, BOOL is4x4) +{ + return (NNS_GfdAllocTexVram(size, is4x4, 0) & 0xFFFF) * 8; +} diff --git a/lib/spl/src/unk_0209CF00.c b/lib/spl/src/unk_0209CF00.c new file mode 100644 index 000000000..9c81f4146 --- /dev/null +++ b/lib/spl/src/unk_0209CF00.c @@ -0,0 +1,780 @@ +#include "spl.h" + +#include + + +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 sub_0209CF7C(SPLManager *mgr) +{ + 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) +{ + SPLEmitter *emtr; + UnkSPLStruct9 *resBase; + SPLParticle *ptcl; + DrawFunc drawFunc; + SetTexFunc setTexFunc; + + emtr = mgr->unk_40.unk_00; + resBase = emtr->p_res->unk_00; + drawFunc = NULL; + + sub_0209DC68(mgr->unk_2C + resBase->unk_48.unk_03_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; + } + + 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; + } +} + +asm void sub_0209D150(SPLManager *mgr, SPLEmitter *emtr) +{ + stmfd sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} + sub sp, sp, #0x74 + mov sb, r1 + ldr r8, [sb, #0x20] + mov sl, r0 + ldr r0, [r8, #0x14] + ldr r4, [r8] + str r0, [sp, #4] + ldr r0, [r4, #0] + mov r6, #0 + str r0, [sp, #0x24] + ldrb r0, [r4, #0x46] + ldr r2, [sb, #0x90] + ldrh r7, [r8, #0x1c] + add r0, r0, #0x180 + cmp r2, #0 + str r0, [sp, #8] + beq _0209D1A4 + mov r0, sb + mov r1, r6 + blx r2 +_0209D1A4: + ldrh r1, [r4, #0x3c] + cmp r1, #0 + beq _0209D1BC + ldrh r0, [sb, #0x4c] + cmp r0, r1 + bhs _0209D204 +_0209D1BC: + ldrh r0, [sb, #0x4c] + ldrb r1, [sb, #0x80] + bl _s32_div_f + cmp r1, #0 + bne _0209D204 + ldr r1, [sb, #0x24] + mov r0, r1, lsl #0x1f + movs r0, r0, lsr #0x1f + bne _0209D204 + mov r0, r1, lsl #0x1e + movs r0, r0, lsr #0x1f + bne _0209D204 + mov r0, r1, lsl #0x1b + movs r0, r0, lsr #0x1f + beq _0209D204 + mov r0, sb + add r1, sl, #0x1c + bl sub_020A08DC +_0209D204: + ldr r0, [sp, #0x24] + mov r0, r0, lsl #0x17 + movs r0, r0, lsr #0x1f + beq _0209D234 + ldr r0, _0209D980 // =sub_020A1DA0 + add r6, r6, #1 + str r0, [sp, #0x28] + ldr r0, [r8, #4] + ldrh r0, [r0, #8] + mov r0, r0, lsl #0x1f + mov r0, r0, lsr #0x1f + str r0, [sp, #0x2c] +_0209D234: + ldr r0, [sp, #0x24] + mov r0, r0, lsl #0x16 + movs r0, r0, lsr #0x1f + beq _0209D280 + ldr r3, [r8, #8] + ldrh r0, [r3, #8] + mov r0, r0, lsl #0x1f + movs r0, r0, lsr #0x1f + bne _0209D280 + ldr r2, _0209D984 // =sub_020A1BD4 + add r1, sp, #0x28 + str r2, [r1, r6, lsl #3] + ldrh r1, [r3, #8] + mov r2, r6, lsl #3 + add r0, sp, #0x2c + mov r1, r1, lsl #0x1e + mov r1, r1, lsr #0x1f + add r6, r6, #1 + str r1, [r0, r2] +_0209D280: + ldr r0, [sp, #0x24] + mov r0, r0, lsl #0x15 + movs r0, r0, lsr #0x1f + beq _0209D2BC + ldr r2, _0209D988 // =sub_020A1AF8 + add r1, sp, #0x28 + str r2, [r1, r6, lsl #3] + ldr r1, [r8, #0xc] + mov r2, r6, lsl #3 + ldrh r1, [r1, #2] + add r0, sp, #0x2c + add r6, r6, #1 + mov r1, r1, lsl #0x17 + mov r1, r1, lsr #0x1f + str r1, [r0, r2] +_0209D2BC: + ldr r0, [sp, #0x24] + mov r0, r0, lsl #0x14 + movs r0, r0, lsr #0x1f + beq _0209D304 + ldr r3, [r8, #0x10] + ldr r0, [r3, #8] + mov r0, r0, lsl #0xf + movs r0, r0, lsr #0x1f + bne _0209D304 + ldr r2, _0209D98C // =sub_020A1A94 + add r1, sp, #0x28 + str r2, [r1, r6, lsl #3] + ldr r1, [r3, #8] + add r0, sp, #0x2c + mov r1, r1, lsl #0xe + mov r1, r1, lsr #0x1f + str r1, [r0, r6, lsl #3] + add r6, r6, #1 +_0209D304: + ldr r4, [sb, #8] + cmp r4, #0 + beq _0209D640 + ldr r0, [sp, #0x24] + add fp, sp, #0x28 + mov r2, r0, lsl #0x10 + mov r1, r0, lsl #0xf + mov r0, r2, lsr #0x1f + str r0, [sp, #0xc] + mov r0, r1, lsr #0x1f + str r0, [sp, #0x10] + mov r0, #0 + str r0, [sp, #0x18] +_0209D338: + ldr r0, [r4, #0] + ldrh r1, [r4, #0x2a] + str r0, [sp] + ldrh r0, [r4, #0x26] + cmp r6, #0 + ldr r5, [sp, #0x18] + mul r2, r1, r0 + mov r1, r2, asr #8 + strb r1, [sp, #0x20] + ldrh r1, [r4, #0x28] + ldrb r2, [r4, #0x2d] + mul r0, r1, r0 + add r0, r2, r0, asr #8 + strb r0, [sp, #0x21] + ble _0209D3A0 +_0209D374: + add r2, fp, r5, lsl #3 + ldr ip, [r2, #4] + add r2, sp, #0x20 + ldrb r2, [r2, ip] + ldr r3, [fp, r5, lsl #3] + mov r0, r4 + mov r1, r8 + blx r3 + add r5, r5, #1 + cmp r5, r6 + blt _0209D374 +_0209D3A0: + ldr r0, [sp, #0x18] + ldr r5, [sp, #0x18] + str r0, [sp, #0x70] + str r0, [sp, #0x6c] + str r0, [sp, #0x68] + ldr r0, [sp, #0xc] + cmp r0, #0 + addne r0, sb, #0x28 + addne r3, r4, #0x38 + ldmneia r0, {r0, r1, r2} + stmneia r3, {r0, r1, r2} + cmp r7, #0 + ble _0209D400 +_0209D3D4: + ldr r2, [r8, #0x18] + mov r1, r4 + add r0, r2, r5, lsl #3 + ldr ip, [r2, r5, lsl #3] + ldr r0, [r0, #4] + add r2, sp, #0x68 + mov r3, sb + blx ip + add r5, r5, #1 + cmp r5, r7 + blt _0209D3D4 +_0209D400: + ldr r0, [sp, #0x10] + ldrh r1, [r4, #0x20] + cmp r0, #0 + ldrsh r0, [r4, #0x22] + add r0, r1, r0 + strh r0, [r4, #0x20] + ldr r1, [r4, #0x14] + ldr r0, [sp, #8] + mul r0, r1, r0 + mov r0, r0, asr #9 + str r0, [r4, #0x14] + ldr r1, [r4, #0x18] + ldr r0, [sp, #8] + mul r0, r1, r0 + mov r0, r0, asr #9 + str r0, [r4, #0x18] + ldr r1, [r4, #0x1c] + ldr r0, [sp, #8] + mul r0, r1, r0 + mov r0, r0, asr #9 + str r0, [r4, #0x1c] + ldr r1, [r4, #0x14] + ldr r0, [sp, #0x68] + add r0, r1, r0 + str r0, [r4, #0x14] + ldr r1, [r4, #0x18] + ldr r0, [sp, #0x6c] + add r0, r1, r0 + str r0, [r4, #0x18] + ldr r1, [r4, #0x1c] + ldr r0, [sp, #0x70] + add r0, r1, r0 + str r0, [r4, #0x1c] + ldr r1, [r4, #0x14] + ldr r0, [sb, #0x34] + ldr r2, [r4, #8] + add r0, r1, r0 + add r0, r2, r0 + str r0, [r4, #8] + ldr r1, [r4, #0x18] + ldr r0, [sb, #0x38] + ldr r2, [r4, #0xc] + add r0, r1, r0 + add r0, r2, r0 + str r0, [r4, #0xc] + ldr r1, [r4, #0x1c] + ldr r0, [sb, #0x3c] + ldr r2, [r4, #0x10] + add r0, r1, r0 + add r0, r2, r0 + str r0, [r4, #0x10] + beq _0209D538 + ldr r0, [sp, #4] + ldrh r2, [r4, #0x24] + ldrb r1, [r0, #0xd] + ldrh r3, [r4, #0x26] + mov r2, r2, lsl #0xc + mov r1, r1, lsl #0xc + mov r0, r3, lsl #0xc + smull r5, r3, r2, r1 + mov r1, #0x800 + adds r2, r5, r1 + adc r1, r3, #0 + mov r2, r2, lsr #0xc + orr r2, r2, r1, lsl #20 + mov r1, r2, asr #8 + subs r0, r0, r1 + bmi _0209D538 + ldr r1, [sp, #4] + mov r0, r0, asr #0xc + ldrb r1, [r1, #0xe] + bl _s32_div_f + cmp r1, #0 + bne _0209D538 + mov r0, r4 + mov r1, sb + add r2, sl, #0x1c + bl sub_020A05BC +_0209D538: + ldr r0, [sb, #0x20] + ldr r0, [r0, #0] + ldr r0, [r0, #0] + mov r0, r0, lsl #1 + movs r0, r0, lsr #0x1f + beq _0209D57C + ldrh r0, [r4, #0x2e] + ldr r1, [sl, #0x38] + bic r0, r0, #0xfc00 + mov r1, r1, lsl #8 + mov r1, r1, lsr #0x1a + mov r1, r1, lsl #0x10 + mov r1, r1, lsr #0x10 + and r1, r1, #0x3f + orr r0, r0, r1, lsl #10 + strh r0, [r4, #0x2e] + b _0209D5FC +_0209D57C: + ldrh r0, [r4, #0x2e] + ldr r2, [sl, #0x38] + add r1, sl, #0x38 + bic r0, r0, #0xfc00 + mov r2, r2, lsl #0xe + mov r2, r2, lsr #0x1a + mov r2, r2, lsl #0x10 + mov r2, r2, lsr #0x10 + and r2, r2, #0x3f + orr r0, r0, r2, lsl #10 + strh r0, [r4, #0x2e] + ldr r2, [sl, #0x38] + bic r0, r2, #0x3f000 + mov r2, r2, lsl #0xe + mov r2, r2, lsr #0x1a + add r2, r2, #1 + and r2, r2, #0x3f + orr r0, r0, r2, lsl #12 + str r0, [sl, #0x38] + ldr r2, [sl, #0x38] + mov r0, r2, lsl #0xe + mov r3, r0, lsr #0x1a + mov r0, r2, lsl #0x14 + cmp r3, r0, lsr #26 + bls _0209D5FC + mov r0, r2, lsl #0x1a + mov r0, r0, lsr #0x1a + and r0, r0, #0x3f + ldr r2, [r1, #0] + bic r2, r2, #0x3f000 + orr r0, r2, r0, lsl #12 + str r0, [r1, #0] +_0209D5FC: + ldrh r0, [r4, #0x26] + add r0, r0, #1 + strh r0, [r4, #0x26] + ldrh r1, [r4, #0x26] + ldrh r0, [r4, #0x24] + cmp r1, r0 + bls _0209D630 + mov r1, r4 + add r0, sb, #8 + bl sub_020A2238 + mov r1, r0 + add r0, sl, #0x1c + bl sub_020A2304 +_0209D630: + ldr r0, [sp] + cmp r0, #0 + mov r4, r0 + bne _0209D338 +_0209D640: + ldr r0, [sp, #0x24] + mov r0, r0, lsl #0xf + movs r0, r0, lsr #0x1f + beq _0209D948 + ldr r0, [sp, #4] + mov r6, #0 + ldrh r0, [r0] + mov r0, r0, lsl #0x1e + movs r0, r0, lsr #0x1f + ldrne r0, _0209D990 // =sub_020A1A48 + strne r6, [sp, #0x4c] + strne r0, [sp, #0x48] + ldr r0, [sp, #4] + addne r6, r6, #1 + ldrh r0, [r0] + mov r0, r0, lsl #0x1d + movs r0, r0, lsr #0x1f + beq _0209D6A4 + ldr r2, _0209D994 // =sub_020A19F0 + add r1, sp, #0x48 + str r2, [r1, r6, lsl #3] + add r0, sp, #0x4c + mov r1, #0 + str r1, [r0, r6, lsl #3] + add r6, r6, #1 +_0209D6A4: + ldr r0, [sp, #4] + ldr r5, [sb, #0x14] + ldrh r0, [r0] + mov r0, r0, lsl #0x1f + movs r0, r0, lsr #0x1f + moveq r7, #0 + cmp r5, #0 + beq _0209D948 + mov r0, #0 + str r0, [sp, #0x1c] +_0209D6CC: + ldrh r2, [r5, #0x26] + ldr r0, [r5, #0] + ldrh r1, [r5, #0x24] + str r0, [sp, #0x14] + mov r0, r2, lsl #8 + bl _s32_div_f + ldr r4, [sp, #0x1c] + strb r0, [sp, #0x20] + cmp r6, #0 + ble _0209D71C + ldrb fp, [sp, #0x20] +_0209D6F8: + add r3, sp, #0x48 + ldr r3, [r3, r4, lsl #3] + mov r0, r5 + mov r1, r8 + mov r2, fp + blx r3 + add r4, r4, #1 + cmp r4, r6 + blt _0209D6F8 +_0209D71C: + ldr r0, [sp, #0x1c] + ldr r4, [sp, #0x1c] + str r0, [sp, #0x70] + str r0, [sp, #0x6c] + str r0, [sp, #0x68] + ldr r0, [sp, #4] + ldrh r0, [r0] + mov r0, r0, lsl #0x1a + movs r0, r0, lsr #0x1f + addne r0, sb, #0x28 + addne r3, r5, #0x38 + ldmneia r0, {r0, r1, r2} + stmneia r3, {r0, r1, r2} + cmp r7, #0 + ble _0209D784 +_0209D758: + ldr r2, [r8, #0x18] + mov r1, r5 + add r0, r2, r4, lsl #3 + ldr fp, [r2, r4, lsl #3] + ldr r0, [r0, #4] + add r2, sp, #0x68 + mov r3, sb + blx fp + add r4, r4, #1 + cmp r4, r7 + blt _0209D758 +_0209D784: + ldrh r1, [r5, #0x20] + ldrsh r0, [r5, #0x22] + add r0, r1, r0 + strh r0, [r5, #0x20] + ldr r1, [r5, #0x14] + ldr r0, [sp, #8] + mul r0, r1, r0 + mov r0, r0, asr #9 + str r0, [r5, #0x14] + ldr r1, [r5, #0x18] + ldr r0, [sp, #8] + mul r0, r1, r0 + mov r0, r0, asr #9 + str r0, [r5, #0x18] + ldr r1, [r5, #0x1c] + ldr r0, [sp, #8] + mul r0, r1, r0 + mov r0, r0, asr #9 + str r0, [r5, #0x1c] + ldr r1, [r5, #0x14] + ldr r0, [sp, #0x68] + add r0, r1, r0 + str r0, [r5, #0x14] + ldr r1, [r5, #0x18] + ldr r0, [sp, #0x6c] + add r0, r1, r0 + str r0, [r5, #0x18] + ldr r1, [r5, #0x1c] + ldr r0, [sp, #0x70] + add r0, r1, r0 + str r0, [r5, #0x1c] + ldr r1, [r5, #0x14] + ldr r0, [sb, #0x34] + ldr r2, [r5, #8] + add r0, r1, r0 + add r0, r2, r0 + str r0, [r5, #8] + ldr r1, [r5, #0x18] + ldr r0, [sb, #0x38] + ldr r2, [r5, #0xc] + add r0, r1, r0 + add r0, r2, r0 + str r0, [r5, #0xc] + ldr r1, [r5, #0x1c] + ldr r0, [sb, #0x3c] + ldr r2, [r5, #0x10] + add r0, r1, r0 + add r0, r2, r0 + str r0, [r5, #0x10] + ldr r0, [sb, #0x20] + ldr r0, [r0, #0] + ldr r0, [r0, #0] + movs r0, r0, lsr #0x1f + beq _0209D888 + ldr r0, [sl, #0x38] + ldrh r1, [r5, #0x2e] + mov r0, r0, lsl #8 + mov r0, r0, lsr #0x1a + bic r1, r1, #0xfc00 + mov r0, r0, lsl #0x10 + mov r0, r0, lsr #0x10 + and r0, r0, #0x3f + orr r0, r1, r0, lsl #10 + strh r0, [r5, #0x2e] + b _0209D908 +_0209D888: + ldr r0, [sl, #0x38] + ldrh r1, [r5, #0x2e] + mov r0, r0, lsl #0xe + mov r0, r0, lsr #0x1a + bic r1, r1, #0xfc00 + mov r0, r0, lsl #0x10 + mov r0, r0, lsr #0x10 + and r0, r0, #0x3f + orr r0, r1, r0, lsl #10 + strh r0, [r5, #0x2e] + ldr r1, [sl, #0x38] + add r0, sl, #0x38 + bic r2, r1, #0x3f000 + mov r1, r1, lsl #0xe + mov r1, r1, lsr #0x1a + add r1, r1, #1 + and r1, r1, #0x3f + orr r1, r2, r1, lsl #12 + str r1, [sl, #0x38] + ldr r2, [sl, #0x38] + mov r1, r2, lsl #0xe + mov r3, r1, lsr #0x1a + mov r1, r2, lsl #0x14 + cmp r3, r1, lsr #26 + bls _0209D908 + mov r1, r2, lsl #0x1a + mov r1, r1, lsr #0x1a + and r1, r1, #0x3f + ldr r2, [r0, #0] + bic r2, r2, #0x3f000 + orr r1, r2, r1, lsl #12 + str r1, [r0, #0] +_0209D908: + ldrh r0, [r5, #0x26] + add r0, r0, #1 + strh r0, [r5, #0x26] + ldrh r1, [r5, #0x26] + ldrh r0, [r5, #0x24] + cmp r1, r0 + bls _0209D93C + mov r1, r5 + add r0, sb, #0x14 + bl sub_020A2238 + mov r1, r0 + add r0, sl, #0x1c + bl sub_020A2304 +_0209D93C: + ldr r5, [sp, #0x14] + movs r0, r5 + bne _0209D6CC +_0209D948: + ldrh r0, [sb, #0x4c] + add r0, r0, #1 + strh r0, [sb, #0x4c] + ldr r2, [sb, #0x90] + cmp r2, #0 + addeq sp, sp, #0x74 + ldmeqia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} + bxeq lr + mov r0, sb + mov r1, #1 + blx r2 + add sp, sp, #0x74 + ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} + bx lr +_0209D980: .word sub_020A1DA0 +_0209D984: .word sub_020A1BD4 +_0209D988: .word sub_020A1AF8 +_0209D98C: .word sub_020A1A94 +_0209D990: .word sub_020A1A48 +_0209D994: .word sub_020A19F0 +} + +void sub_0209D998(SPLEmitter *emtr, UnkSPLStruct4 *res, const VecFx32 *pos) +{ + 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; + + 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->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; + } + + 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_0209DC64(UnkSPLStruct5 *tex) { } + +asm void sub_0209DC68(UnkSPLStruct5 *tex) +{ + stmfd sp!, {r4, r5, r6, r7, lr} + sub sp, sp, #4 + ldr r7, [r0, #0xc] + ldr r3, _0209DD40 // =0x040004A8 + str r7, [sp] + ldr r1, [r0, #4] + mov r2, r7, lsl #0x1c + mov lr, r2, lsr #0x1c + mov r1, r1, lsr #3 + orr ip, r1, lr, lsl #26 + mov r4, r7, lsl #0x18 + mov r5, r7, lsl #0x14 + mov r2, r7, lsl #0xf + mov r4, r4, lsr #0x1c + orr ip, ip, #0x40000000 + mov r6, r7, lsl #0x12 + orr ip, ip, r4, lsl #20 + mov r5, r5, lsr #0x1c + mov r1, r7, lsl #0x10 + orr ip, ip, r5, lsl #23 + mov r4, r6, lsr #0x1e + mov r5, r1, lsr #0x1e + orr r1, ip, r4, lsl #16 + mov r2, r2, lsr #0x1f + orr r1, r1, r5, lsl #18 + orr r1, r1, r2, lsl #29 + str r1, [r3, #0] + cmp lr, #2 + moveq r1, #1 + movne r1, #0 + ldr r2, [r0, #8] + rsb r1, r1, #4 + mov r2, r2, lsr r1 + ldr r1, _0209DD44 // =0x040004AC + ldr ip, _0209DD48 // =0x04000440 + str r2, [r1, #0] + mov r2, #3 + ldr r1, _0209DD4C // =0x04000454 + str r2, [ip] + mov r3, #0 + str r3, [r1, #0] + ldrh r1, [r0, #0x10] + ldrh r2, [r0, #0x12] + ldr r0, _0209DD50 // =0x0400046C + mov r1, r1, lsl #0xc + str r1, [r0, #0] + mov r1, r2, lsl #0xc + str r1, [r0, #0] + str r3, [r0, #0] + mov r0, #1 + str r0, [ip] + add sp, sp, #4 + ldmia sp!, {r4, r5, r6, r7, lr} + bx lr + // .align 2, 0 +_0209DD40: .word 0x040004A8 +_0209DD44: .word 0x040004AC +_0209DD48: .word 0x04000440 +_0209DD4C: .word 0x04000454 +_0209DD50: .word 0x0400046C +} diff --git a/lib/spl/src/unk_020A05BC.c b/lib/spl/src/unk_020A05BC.c new file mode 100644 index 000000000..61a2b2676 --- /dev/null +++ b/lib/spl/src/unk_020A05BC.c @@ -0,0 +1,1003 @@ +#include "spl.h" + +#include + + +void sub_020A05BC(SPLParticle *ptcl, SPLEmitter *emtr, void *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; + + } +} + +asm static void sub_020A08DC(SPLEmitter *emtr, SPLList *list) +{ + stmfd sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} + sub sp, sp, #0xc4 + mov sb, r0 + ldr r0, [sb, #0x20] + ldrsh r3, [sb, #0x4e] + str r0, [sp, #4] + ldr r0, [sb, #0x58] + ldr r2, _020A15E8 + add r3, r0, r3 + ldr r0, [sp, #4] + str r1, [sp] + ldr r8, [r0] + and r0, r3, r2 + strh r0, [sb, #0x4e] + ldr r0, [r8] + mov r0, r0, lsl #0x1c + mov r1, r0, lsr #0x1c + mov r0, r3, asr #0xc + cmp r1, #2 + str r0, [sp, #0xc] + beq _020A0944 + cmp r1, #3 + beq _020A0944 + sub r0, r1, #5 + cmp r0, #4 + bhi _020A094C +_020A0944: + mov r0, sb + bl sub_020A1768 +_020A094C: + ldr r0, [sp, #0xc] + cmp r0, #0 + mov r0, #0 + str r0, [sp, #8] + addle sp, sp, #0xc4 + ldmleia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} + bxle lr + str r0, [sp, #0x18] + str r0, [sp, #0x24] + str r0, [sp, #0x20] + str r0, [sp, #0x1c] + mov r0, #0x1000 + str r0, [sp, #0x34] + ldr r0, [sp, #8] + ldr r6, _020A15EC + ldr r4, _020A15F0 + ldr r5, _020A15F4 + str r0, [sp, #0x38] + str r0, [sp, #0x3c] + str r0, [sp, #0x40] +_020A099C: + ldr r0, [sp] + bl sub_020A22B8 + movs r7, r0 + addeq sp, sp, #0xc4 + ldmeqia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} + bxeq lr + add r0, sb, #8 + mov r1, r7 + bl sub_020A2304 + ldr r0, [r8] + mov r0, r0, lsl #0x1c + mov r0, r0, lsr #0x1c + cmp r0, #9 + addls pc, pc, r0, lsl #2 + b _020A10DC +_020A09D8: + b _020A0A00 + b _020A0A1C + b _020A0A8C + b _020A0AF4 + b _020A0B88 + b _020A0C88 + b _020A0F80 + b _020A1004 + b _020A0D44 + b _020A0E14 +_020A0A00: + ldr r0, [sp, #0x1c] + str r0, [r7, #0x10] + ldr r0, [r7, #0x10] + str r0, [r7, #0xc] + ldr r0, [r7, #0xc] + str r0, [r7, #8] + b _020A10DC +_020A0A1C: + add r0, r7, #8 + bl sub_020A23B0 + ldr r2, [r7, #8] + ldr r1, [sb, #0x5c] + mov r0, #0x800 + smull r3, r1, r2, r1 + adds r2, r3, r0 + adc r1, r1, #0 + mov r2, r2, lsr #0xc + orr r2, r2, r1, lsl #20 + str r2, [r7, #8] + ldr r2, [r7, #0xc] + ldr r1, [sb, #0x5c] + smull r3, r1, r2, r1 + adds r2, r3, r0 + adc r1, r1, #0 + mov r2, r2, lsr #0xc + orr r2, r2, r1, lsl #20 + str r2, [r7, #0xc] + ldr r2, [r7, #0x10] + ldr r1, [sb, #0x5c] + smull r3, r1, r2, r1 + adds r2, r3, r0 + adc r0, r1, #0 + mov r1, r2, lsr #0xc + orr r1, r1, r0, lsl #20 + str r1, [r7, #0x10] + b _020A10DC +_020A0A8C: + add r0, sp, #0x58 + bl sub_020A2354 + ldr r2, [sp, #0x58] + ldr r0, [sb, #0x5c] + mov r1, #0x800 + smull r3, r0, r2, r0 + adds r2, r3, r1 + adc r0, r0, #0 + mov r2, r2, lsr #0xc + orr r2, r2, r0, lsl #20 + str r2, [sp, #0x58] + ldr r3, [sp, #0x5c] + ldr r2, [sb, #0x5c] + add r0, r7, #8 + smull sl, r2, r3, r2 + adds r3, sl, r1 + adc r1, r2, #0 + mov r2, r3, lsr #0xc + orr r2, r2, r1, lsl #20 + ldr r1, [sp, #0x20] + str r2, [sp, #0x5c] + str r1, [sp, #0x60] + add r1, sp, #0x58 + mov r2, sb + bl sub_020A1608 + b _020A10DC +_020A0AF4: + ldr r0, [sp, #0x18] + ldr r1, [sp, #0xc] + bl _s32_div_f + ldr r1, [sp, #0x18] + mov r0, r0, asr #4 + add r1, r1, #0x10000 + mov r2, r0, lsl #1 + str r1, [sp, #0x18] + ldr r0, _020A15F8 + mov r1, r2, lsl #1 + ldrsh r0, [r0, r1] + add r1, r2, #1 + mov r2, r1, lsl #1 + ldr r1, _020A15F8 + ldrsh r3, [r1, r2] + ldr r2, [sb, #0x5c] + mov r1, #0x800 + smull sl, r2, r0, r2 + adds sl, sl, r1 + adc r0, r2, #0 + mov r2, sl, lsr #0xc + orr r2, r2, r0, lsl #20 + str r2, [sp, #0x64] + ldr r2, [sb, #0x5c] + add r0, r7, #8 + smull sl, r2, r3, r2 + adds r3, sl, r1 + adc r1, r2, #0 + mov r2, r3, lsr #0xc + orr r2, r2, r1, lsl #20 + ldr r1, [sp, #0x24] + str r2, [sp, #0x68] + str r1, [sp, #0x6c] + add r1, sp, #0x64 + mov r2, sb + bl sub_020A1608 + b _020A10DC +_020A0B88: + add r0, r7, #8 + bl sub_020A23B0 + ldr r1, [r6, #0] + mov r0, #0x800 + mla r2, r1, r4, r5 + str r2, [r6, #0] + mov r1, r2, lsr #0x17 + mov r1, r1, lsl #0xc + sub r1, r1, #0x100000 + mov r1, r1, asr #8 + ldr r3, [r7, #8] + ldr r2, [sb, #0x5c] + smull sl, r2, r3, r2 + adds r3, sl, r0 + adc r2, r2, #0 + mov r3, r3, lsr #0xc + orr r3, r3, r2, lsl #20 + smull r2, r1, r3, r1 + adds r2, r2, r0 + adc r1, r1, #0 + mov r2, r2, lsr #0xc + orr r2, r2, r1, lsl #20 + str r2, [r7, #8] + ldr r1, [r6, #0] + mla r2, r1, r4, r5 + str r2, [r6, #0] + mov r1, r2, lsr #0x17 + mov r1, r1, lsl #0xc + sub r1, r1, #0x100000 + mov r1, r1, asr #8 + ldr r3, [r7, #0xc] + ldr r2, [sb, #0x5c] + smull sl, r2, r3, r2 + adds r3, sl, r0 + adc r2, r2, #0 + mov r3, r3, lsr #0xc + orr r3, r3, r2, lsl #20 + smull r2, r1, r3, r1 + adds r2, r2, r0 + adc r1, r1, #0 + mov r2, r2, lsr #0xc + orr r2, r2, r1, lsl #20 + str r2, [r7, #0xc] + ldr r1, [r6, #0] + mla r2, r1, r4, r5 + str r2, [r6, #0] + mov r1, r2, lsr #0x17 + mov r1, r1, lsl #0xc + sub r1, r1, #0x100000 + mov r1, r1, asr #8 + ldr r3, [r7, #0x10] + ldr r2, [sb, #0x5c] + smull sl, r2, r3, r2 + adds r3, sl, r0 + adc r2, r2, #0 + mov r3, r3, lsr #0xc + orr r3, r3, r2, lsl #20 + smull r2, r1, r3, r1 + adds r2, r2, r0 + adc r0, r1, #0 + mov r1, r2, lsr #0xc + orr r1, r1, r0, lsl #20 + str r1, [r7, #0x10] + b _020A10DC +_020A0C88: + add r0, sp, #0x70 + bl sub_020A2354 + ldr r0, [r6, #0] + ldr r3, [sp, #0x70] + mla r1, r0, r4, r5 + str r1, [r6, #0] + ldr r0, [sb, #0x5c] + mov r2, #0x800 + smull sl, r0, r3, r0 + adds sl, sl, r2 + adc r3, r0, #0 + mov r0, sl, lsr #0xc + orr r0, r0, r3, lsl #20 + mov r3, r1, lsr #0x17 + mov r3, r3, lsl #0xc + sub r3, r3, #0x100000 + mov r3, r3, asr #8 + smull sl, r3, r0, r3 + adds sl, sl, r2 + adc r0, r3, #0 + mov r3, sl, lsr #0xc + orr r3, r3, r0, lsl #20 + mla r0, r1, r4, r5 + str r0, [r6, #0] + str r3, [sp, #0x70] + mov r0, r0, lsr #0x17 + mov r0, r0, lsl #0xc + sub r0, r0, #0x100000 + mov r1, r0, asr #8 + ldr sl, [sp, #0x74] + ldr r3, [sb, #0x5c] + add r0, r7, #8 + smull fp, r3, sl, r3 + adds sl, fp, r2 + adc r3, r3, #0 + mov sl, sl, lsr #0xc + orr sl, sl, r3, lsl #20 + smull r3, r1, sl, r1 + adds r2, r3, r2 + adc r1, r1, #0 + mov r2, r2, lsr #0xc + orr r2, r2, r1, lsl #20 + str r2, [sp, #0x74] + add r1, sp, #0x70 + mov r2, sb + bl sub_020A1608 + b _020A10DC +_020A0D44: + add r0, r7, #8 + bl sub_020A23B0 + add r0, sb, #0x84 + add r1, sb, #0x8a + add r2, sp, #0x44 + bl VEC_Fx16CrossProduct + ldrsh r1, [sp, #0x46] + ldrsh r0, [sp, #0x48] + ldrsh r2, [sp, #0x44] + str r1, [sp, #0x80] + str r0, [sp, #0x84] + add r0, sp, #0x7c + add r1, r7, #8 + str r2, [sp, #0x7c] + bl VEC_DotProduct + cmp r0, #0 + bgt _020A0DAC + ldr r0, [r7, #8] + rsb r0, r0, #0 + str r0, [r7, #8] + ldr r0, [r7, #0xc] + rsb r0, r0, #0 + str r0, [r7, #0xc] + ldr r0, [r7, #0x10] + rsb r0, r0, #0 + str r0, [r7, #0x10] +_020A0DAC: + ldr r2, [r7, #8] + ldr r1, [sb, #0x5c] + mov r0, #0x800 + smull r3, r1, r2, r1 + adds r2, r3, r0 + adc r1, r1, #0 + mov r2, r2, lsr #0xc + orr r2, r2, r1, lsl #20 + str r2, [r7, #8] + ldr r2, [r7, #0xc] + ldr r1, [sb, #0x5c] + smull r3, r1, r2, r1 + adds r2, r3, r0 + adc r1, r1, #0 + mov r2, r2, lsr #0xc + orr r2, r2, r1, lsl #20 + str r2, [r7, #0xc] + ldr r2, [r7, #0x10] + ldr r1, [sb, #0x5c] + smull r3, r1, r2, r1 + adds r2, r3, r0 + adc r0, r1, #0 + mov r1, r2, lsr #0xc + orr r1, r1, r0, lsl #20 + str r1, [r7, #0x10] + b _020A10DC +_020A0E14: + add r0, r7, #8 + bl sub_020A23B0 + add r0, sb, #0x84 + add r1, sb, #0x8a + add r2, sp, #0x4a + bl VEC_Fx16CrossProduct + ldrsh r1, [sp, #0x4c] + ldrsh r0, [sp, #0x4e] + ldrsh r2, [sp, #0x4a] + str r1, [sp, #0x8c] + str r0, [sp, #0x90] + add r0, sp, #0x88 + add r1, r7, #8 + str r2, [sp, #0x88] + bl VEC_DotProduct + cmp r0, #0 + bge _020A0E7C + ldr r0, [r7, #8] + rsb r0, r0, #0 + str r0, [r7, #8] + ldr r0, [r7, #0xc] + rsb r0, r0, #0 + str r0, [r7, #0xc] + ldr r0, [r7, #0x10] + rsb r0, r0, #0 + str r0, [r7, #0x10] +_020A0E7C: + ldr r1, [r6, #0] + mov r0, #0x800 + mla r2, r1, r4, r5 + str r2, [r6, #0] + mov r1, r2, lsr #0x17 + mov r1, r1, lsl #0xc + sub r1, r1, #0x100000 + mov r1, r1, asr #9 + add r1, r1, #0x800 + ldr r3, [r7, #8] + ldr r2, [sb, #0x5c] + smull sl, r2, r3, r2 + adds r3, sl, r0 + adc r2, r2, #0 + mov r3, r3, lsr #0xc + orr r3, r3, r2, lsl #20 + smull r2, r1, r3, r1 + adds r2, r2, r0 + adc r1, r1, #0 + mov r2, r2, lsr #0xc + orr r2, r2, r1, lsl #20 + str r2, [r7, #8] + ldr r1, [r6, #0] + mla r2, r1, r4, r5 + str r2, [r6, #0] + mov r1, r2, lsr #0x17 + mov r1, r1, lsl #0xc + sub r1, r1, #0x100000 + mov r1, r1, asr #9 + add r1, r1, #0x800 + ldr r3, [r7, #0xc] + ldr r2, [sb, #0x5c] + smull sl, r2, r3, r2 + adds r3, sl, r0 + adc r2, r2, #0 + mov r3, r3, lsr #0xc + orr r3, r3, r2, lsl #20 + smull r2, r1, r3, r1 + adds r2, r2, r0 + adc r1, r1, #0 + mov r2, r2, lsr #0xc + orr r2, r2, r1, lsl #20 + str r2, [r7, #0xc] + ldr r1, [r6, #0] + mla r2, r1, r4, r5 + str r2, [r6, #0] + mov r1, r2, lsr #0x17 + mov r1, r1, lsl #0xc + sub r1, r1, #0x100000 + mov r1, r1, asr #9 + add r1, r1, #0x800 + ldr r3, [r7, #0x10] + ldr r2, [sb, #0x5c] + smull sl, r2, r3, r2 + adds r3, sl, r0 + adc r2, r2, #0 + mov r3, r3, lsr #0xc + orr r3, r3, r2, lsl #20 + smull r2, r1, r3, r1 + adds r2, r2, r0 + adc r0, r1, #0 + mov r1, r2, lsr #0xc + orr r1, r1, r0, lsl #20 + str r1, [r7, #0x10] + b _020A10DC +_020A0F80: + add r0, r7, #0x14 + bl sub_020A2354 + ldr r2, [r7, #0x14] + ldr r1, [sb, #0x5c] + mov r0, #0x800 + smull r3, r1, r2, r1 + adds r2, r3, r0 + adc r1, r1, #0 + mov r2, r2, lsr #0xc + orr r2, r2, r1, lsl #20 + str r2, [sp, #0x94] + ldr r3, [r7, #0x18] + ldr r2, [sb, #0x5c] + ldr r1, [r6, #0] + smull sl, r2, r3, r2 + adds r3, sl, r0 + adc r0, r2, #0 + mov r2, r3, lsr #0xc + orr r2, r2, r0, lsl #20 + mla r0, r1, r4, r5 + str r0, [r6, #0] + str r2, [sp, #0x98] + mov r1, r0, lsr #0x17 + ldr r2, [sb, #0x60] + add r0, r7, #8 + mul r1, r2, r1 + sub r1, r1, r2, lsl #8 + mov r1, r1, asr #8 + str r1, [sp, #0x9c] + add r1, sp, #0x94 + mov r2, sb + bl sub_020A1608 + b _020A10DC +_020A1004: + add r0, r7, #0x14 + bl sub_020A2354 + ldr r0, [r6, #0] + mov r3, #0x800 + mla r2, r0, r4, r5 + str r2, [r6, #0] + ldr sl, [r7, #0x14] + ldr r0, [sb, #0x5c] + mov r1, r2, lsr #0x17 + smull fp, r0, sl, r0 + adds fp, fp, r3 + mov r1, r1, lsl #0xc + adc sl, r0, #0 + mov r0, fp, lsr #0xc + sub r1, r1, #0x100000 + orr r0, r0, sl, lsl #20 + mov r1, r1, asr #8 + smull sl, r1, r0, r1 + adds sl, sl, r3 + adc r0, r1, #0 + mov r1, sl, lsr #0xc + orr r1, r1, r0, lsl #20 + str r1, [sp, #0xa0] + mla r1, r2, r4, r5 + str r1, [r6, #0] + mov r2, r1, lsr #0x17 + mov r2, r2, lsl #0xc + sub r2, r2, #0x100000 + ldr sl, [r7, #0x18] + ldr r0, [sb, #0x5c] + mov r2, r2, asr #8 + smull fp, r0, sl, r0 + adds fp, fp, r3 + adc sl, r0, #0 + mov r0, fp, lsr #0xc + orr r0, r0, sl, lsl #20 + smull sl, r2, r0, r2 + adds r3, sl, r3 + adc r0, r2, #0 + mov r2, r3, lsr #0xc + orr r2, r2, r0, lsl #20 + mla r0, r1, r4, r5 + str r0, [r6, #0] + str r2, [sp, #0xa4] + mov r1, r0, lsr #0x17 + ldr r2, [sb, #0x60] + add r0, r7, #8 + mul r1, r2, r1 + sub r1, r1, r2, lsl #8 + mov r1, r1, asr #8 + str r1, [sp, #0xa8] + add r1, sp, #0xa0 + mov r2, sb + bl sub_020A1608 +_020A10DC: + ldr r1, [r6, #0] + mla r0, r1, r4, r5 + str r0, [r6, #0] + ldrb r2, [r8, #0x42] + mov r1, r0, lsr #0x18 + ldr r3, [sb, #0x64] + mul r1, r2, r1 + add r2, r2, #0xff + sub r1, r2, r1, asr #7 + mul r1, r3, r1 + mov r1, r1, asr #8 + str r1, [sp, #0x10] + mla r1, r0, r4, r5 + str r1, [r6, #0] + mov r0, r1, lsr #0x18 + ldrb r2, [r8, #0x42] + ldr r3, [sb, #0x68] + ldr r1, [r8] + mul r0, r2, r0 + add r2, r2, #0xff + sub r0, r2, r0, asr #7 + mul r0, r3, r0 + mov r0, r0, asr #8 + str r0, [sp, #0x14] + mov r0, r1, lsl #0x1c + mov r0, r0, lsr #0x1c + cmp r0, #6 + bne _020A1228 + ldrsh r0, [sb, #0x84] + ldr r1, [r7, #0x14] + mov r2, #0x800 + smull r3, r0, r1, r0 + adds r1, r3, r2 + ldrsh r3, [sb, #0x8a] + ldr lr, [r7, #0x18] + mov ip, r1, lsr #0xc + smull sl, r3, lr, r3 + adc r0, r0, #0 + adds sl, sl, r2 + orr ip, ip, r0, lsl #20 + adc r3, r3, #0 + mov sl, sl, lsr #0xc + orr sl, sl, r3, lsl #20 + add r3, ip, sl + str r3, [sp, #0xb8] + ldrsh sl, [sb, #0x86] + ldr r3, [r7, #0x14] + ldrsh lr, [sb, #0x8c] + smull ip, sl, r3, sl + adds ip, ip, r2 + ldr fp, [r7, #0x18] + adc sl, sl, #0 + smull r3, lr, fp, lr + mov ip, ip, lsr #0xc + adds r3, r3, r2 + orr ip, ip, sl, lsl #20 + adc sl, lr, #0 + mov r3, r3, lsr #0xc + orr r3, r3, sl, lsl #20 + add r3, ip, r3 + str r3, [sp, #0xbc] + ldr sl, [r7, #0x18] + ldrsh fp, [sb, #0x88] + ldr r3, [r7, #0x14] + str sl, [sp, #0x28] + smull ip, fp, r3, fp + ldrsh sl, [sb, #0x8e] + ldr r3, [sp, #0x28] + adds ip, ip, r2 + smull sl, lr, r3, sl + adc r3, fp, #0 + adds r2, sl, r2 + mov sl, ip, lsr #0xc + orr sl, sl, r3, lsl #20 + adc r3, lr, #0 + mov r2, r2, lsr #0xc + orr r2, r2, r3, lsl #20 + add r2, sl, r2 + add r0, sp, #0xb8 + add r1, sp, #0xac + str r2, [sp, #0xc0] + bl VEC_Normalize + b _020A1264 +_020A1228: + ldr r0, [r7, #8] + cmp r0, #0 + bne _020A1258 + ldr r0, [r7, #0xc] + cmp r0, #0 + bne _020A1258 + ldr r0, [r7, #0x10] + cmp r0, #0 + bne _020A1258 + add r0, sp, #0xac + bl sub_020A23B0 + b _020A1264 +_020A1258: + add r0, r7, #8 + add r1, sp, #0xac + bl VEC_Normalize +_020A1264: + ldr r2, [sp, #0xac] + ldr r1, [sp, #0x10] + mov r0, #0x800 + smull sl, r1, r2, r1 + adds r2, sl, r0 + add sl, sb, #0x28 + str sl, [sp, #0x2c] + add sl, r7, #0x38 + str sl, [sp, #0x30] + adc r1, r1, #0 + mov r2, r2, lsr #0xc + orr r2, r2, r1, lsl #20 + ldrsh r1, [sb, #0x50] + ldr sl, [sp, #0x14] + ldr r3, [sb, #0x40] + smull fp, sl, r1, sl + adds fp, fp, r0 + adc r1, sl, #0 + mov sl, fp, lsr #0xc + orr sl, sl, r1, lsl #20 + add r1, r2, sl + add r1, r3, r1 + str r1, [r7, #0x14] + ldr r3, [sp, #0xb0] + ldr r1, [sp, #0x10] + ldrsh sl, [sb, #0x52] + smull fp, r1, r3, r1 + adds fp, fp, r0 + adc r3, r1, #0 + mov r1, fp, lsr #0xc + orr r1, r1, r3, lsl #20 + ldr r3, [sp, #0x14] + ldr r2, [sb, #0x44] + smull fp, r3, sl, r3 + adds sl, fp, r0 + adc r3, r3, #0 + mov sl, sl, lsr #0xc + orr sl, sl, r3, lsl #20 + add r1, r1, sl + add r1, r2, r1 + str r1, [r7, #0x18] + ldr r1, [sp, #0xb4] + ldr r2, [sp, #0x10] + ldrsh lr, [sb, #0x54] + smull sl, r3, r1, r2 + ldr r1, [sp, #0x14] + adds sl, sl, r0 + smull r2, r1, lr, r1 + adc r3, r3, #0 + adds r0, r2, r0 + mov r2, sl, lsr #0xc + orr r2, r2, r3, lsl #20 + adc r1, r1, #0 + mov r0, r0, lsr #0xc + orr r0, r0, r1, lsl #20 + ldr ip, [sb, #0x48] + add r0, r2, r0 + add r0, ip, r0 + str r0, [r7, #0x1c] + ldr r0, [sp, #0x2c] + ldr r3, [sp, #0x30] + ldmia r0, {r0, r1, r2} + stmia r3, {r0, r1, r2} + ldr r0, [r6, #0] + mla r1, r0, r4, r5 + str r1, [r6, #0] + mov r0, r1, lsr #0x18 + ldrb r1, [r8, #0x40] + ldr r2, [sb, #0x6c] + mul r0, r1, r0 + add r1, r1, #0xff + sub r0, r1, r0, asr #7 + mul r0, r2, r0 + mov r0, r0, asr #8 + str r0, [r7, #0x30] + ldr r0, [sp, #0x34] + strh r0, [r7, #0x34] + ldr r0, [r8] + mov r0, r0, lsl #0x16 + movs r0, r0, lsr #0x1f + beq _020A141C + ldr r0, [sp, #4] + ldr r0, [r0, #8] + ldrh r0, [r0, #8] + mov r0, r0, lsl #0x1f + movs r0, r0, lsr #0x1f + beq _020A141C + ldr r0, [r6, #0] + ldr r3, _020A15FC + mla r1, r0, r4, r5 + str r1, [r6, #0] + mov r0, r1, lsr #0x14 + ldr r1, [sp, #4] + ldr r2, [r1, #8] + ldr r1, _020A1600 + umull r1, sl, r0, r1 + mov sl, sl, lsr #1 + umull sl, fp, r3, sl + ldrh r1, [r2] + sub sl, r0, sl + strh r1, [sp, #0x50] + ldrh r0, [r8, #0x22] + mov r1, sl, lsl #1 + strh r0, [sp, #0x52] + ldrh r0, [r2, #2] + strh r0, [sp, #0x54] + add r0, sp, #0x50 + ldrh r0, [r0, r1] + strh r0, [r7, #0x36] + b _020A1424 +_020A141C: + ldrh r0, [r8, #0x22] + strh r0, [r7, #0x36] +_020A1424: + ldrh r1, [r7, #0x2e] + ldrb r0, [sb, #0x81] + bic r1, r1, #0x1f + and r0, r0, #0x1f + orr r0, r1, r0 + strh r0, [r7, #0x2e] + ldrh r0, [r7, #0x2e] + bic r0, r0, #0x3e0 + orr r0, r0, #0x3e0 + strh r0, [r7, #0x2e] + ldr r0, [r8] + mov r0, r0, lsl #0x12 + movs r0, r0, lsr #0x1f + ldrne r0, [r6] + mlane r1, r0, r4, r5 + strne r1, [r6] + strneh r1, [r7, #0x20] + ldreqh r0, [sb, #0x56] + streqh r0, [r7, #0x20] + ldr r0, [r8] + mov r0, r0, lsl #0x13 + movs r0, r0, lsr #0x1f + ldreq r0, [sp, #0x38] + streqh r0, [r7, #0x22] + beq _020A14B4 + ldr r0, [r6, #0] + mla r1, r0, r4, r5 + str r1, [r6, #0] + mov r0, r1, lsr #0x14 + ldrsh r2, [r8, #0x34] + ldrsh r1, [r8, #0x36] + sub r1, r1, r2 + mul r0, r1, r0 + add r0, r0, r2, lsl #12 + mov r0, r0, lsr #0xc + strh r0, [r7, #0x22] +_020A14B4: + ldr r0, [r6, #0] + mla r1, r0, r4, r5 + str r1, [r6, #0] + mov r0, r1, lsr #0x18 + ldrb r1, [r8, #0x41] + ldrh r2, [sb, #0x70] + mul r0, r1, r0 + mov r0, r0, asr #8 + rsb r0, r0, #0xff + mul r0, r2, r0 + mov r0, r0, asr #8 + add r0, r0, #1 + strh r0, [r7, #0x24] + ldr r0, [sp, #0x3c] + strh r0, [r7, #0x26] + ldr r0, [r8] + mov r0, r0, lsl #0x14 + movs r1, r0, lsr #0x1f + beq _020A1544 + ldr r0, [sp, #4] + ldr r0, [r0, #0x10] + ldr r0, [r0, #8] + mov r0, r0, lsl #0xf + movs r0, r0, lsr #0x1f + beq _020A1544 + ldr r0, [r6, #0] + mla r1, r0, r4, r5 + str r1, [r6, #0] + mov r0, r1, lsr #0x14 + ldr r1, [sp, #4] + ldr sl, [r1, #0x10] + ldrb r1, [sl, #8] + bl _u32_div_f + ldrb r0, [sl, r1] + strb r0, [r7, #0x2c] + b _020A1574 +_020A1544: + cmp r1, #0 + beq _020A156C + ldr r0, [sp, #4] + ldr r1, [r0, #0x10] + ldr r0, [r1, #8] + mov r0, r0, lsl #0xf + movs r0, r0, lsr #0x1f + ldreqb r0, [r1] + streqb r0, [r7, #0x2c] + beq _020A1574 +_020A156C: + ldrb r0, [r8, #0x47] + strb r0, [r7, #0x2c] +_020A1574: + ldr r1, [sp, #4] + ldr r0, _020A1604 + ldr r1, [r1, #0] + ldrb r1, [r1, #0x48] + bl _s32_div_f + strh r0, [r7, #0x28] + ldrh r1, [r7, #0x24] + ldr r0, _020A1604 + bl _s32_div_f + strh r0, [r7, #0x2a] + ldr r0, [sp, #0x40] + strb r0, [r7, #0x2d] + ldr r0, [r8] + mov r0, r0, lsl #0xb + movs r0, r0, lsr #0x1f + ldrne r0, [r6] + mlane r1, r0, r4, r5 + strne r1, [r6] + movne r0, r1, lsr #0x18 + strneb r0, [r7, #0x2d] + ldr r0, [sp, #8] + add r1, r0, #1 + ldr r0, [sp, #0xc] + str r1, [sp, #8] + cmp r1, r0 + blt _020A099C + add sp, sp, #0xc4 + ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} + bx lr +} + +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); +} + +extern VecFx16 Unk_02100DB0; + +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; + axis.y = 0; + axis.z = 0; + break; + case 1: + axis.x = 0; + axis.y = FX32_ONE; + axis.z = 0; + break; + case 0: + axis.x = 0; + axis.y = 0; + axis.z = FX32_ONE; + break; + default: + VEC_Fx16Normalize(&emtr->unk_C0, &axis); + break; + } + + fx32 dot = VEC_Fx16DotProduct(&vec, &axis); + if (dot == FX32_ONE || dot == -FX32_ONE) { + vec.x = FX32_ONE; + vec.y = 0; + vec.z = 0; + } + + emtr->unk_F4.x = FX_MUL(axis.y, vec.z) - FX_MUL(axis.z, vec.y); + emtr->unk_F4.y = FX_MUL(axis.z, vec.x) - FX_MUL(axis.x, vec.z); + emtr->unk_F4.z = FX_MUL(axis.x, vec.y) - FX_MUL(axis.y, vec.x); + + emtr->unk_FA.x = FX_MUL(axis.y, emtr->unk_F4.z) - FX_MUL(axis.z, emtr->unk_F4.y); + emtr->unk_FA.y = FX_MUL(axis.z, emtr->unk_F4.x) - FX_MUL(axis.x, emtr->unk_F4.z); + emtr->unk_FA.z = FX_MUL(axis.x, emtr->unk_F4.y) - FX_MUL(axis.y, emtr->unk_F4.x); + + VEC_Fx16Normalize(&emtr->unk_F4, &emtr->unk_F4); + VEC_Fx16Normalize(&emtr->unk_FA, &emtr->unk_FA); +} diff --git a/lib/spl/src/unk_020A19F0.c b/lib/spl/src/unk_020A19F0.c new file mode 100644 index 000000000..3c5818f57 --- /dev/null +++ b/lib/spl/src/unk_020A19F0.c @@ -0,0 +1,134 @@ +#include "spl.h" + +#include + +void sub_020A19F0(SPLParticle *ptcl, UnkSPLStruct4 *res, int lifeRate) +{ + ptcl->unk_2E.unk_00_5 = ((255 - lifeRate) * 31) / 255; +} + +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_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; + } 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_2E.unk_00_5 = x * (255 - ((int)(alphaAnim->unk_02.unk_00_0 * rng_next(0x18)) >> 8)) >> 8; +} + +#define GX_RGB_R(RGB) (((RGB) >> GX_RGB_R_SHIFT) & 31) +#define GX_RGB_G(RGB) (((RGB) >> GX_RGB_G_SHIFT) & 31) +#define GX_RGB_B(RGB) (((RGB) >> GX_RGB_B_SHIFT) & 31) + +void sub_020A1BD4(SPLParticle *ptcl, UnkSPLStruct4 *res, int lifeRate) +{ + UnkSPLStruct9 *resBase; + UnkSPLStruct11 *colorAnim; + int in, peak, out; + + colorAnim = res->unk_08; + resBase = res->unk_00; + peak = colorAnim->unk_04.unk_05_0; + out = colorAnim->unk_04.unk_06_0; + in = colorAnim->unk_04.unk_04_0; + + if (lifeRate < in) { + ptcl->unk_36 = colorAnim->unk_00; + } else if (lifeRate < peak) { + int peakR = GX_RGB_R(resBase->unk_22); + int startR = GX_RGB_R(colorAnim->unk_00); + + int peakG = GX_RGB_G(resBase->unk_22); + int startG = GX_RGB_G(colorAnim->unk_00); + + int peakB = GX_RGB_B(resBase->unk_22); + int startB = GX_RGB_B(colorAnim->unk_00); + + if (colorAnim->unk_08.unk_00_2) { // interpolate + int a = lifeRate - in; + int b = peak - in; + + ptcl->unk_36 = GX_RGB( + startR + (a * (int)(peakR - startR)) / b, + startG + (a * (int)(peakG - startG)) / b, + startB + (a * (int)(peakB - startB)) / b + ); + } else { + ptcl->unk_36 = GX_RGB(peakR, peakG, peakB); + } + } else if (lifeRate < out) { + int peakR = GX_RGB_R(resBase->unk_22); + int endR = GX_RGB_R(colorAnim->unk_02); + + int peakG = GX_RGB_G(resBase->unk_22); + int endG = GX_RGB_G(colorAnim->unk_02); + + int peakB = GX_RGB_B(resBase->unk_22); + int endB = GX_RGB_B(colorAnim->unk_02); + + if (colorAnim->unk_08.unk_00_2) { // interpolate + int a = lifeRate - peak; + int b = out - peak; + + ptcl->unk_36 = GX_RGB( + peakR + (a * (int)(endR - peakR)) / b, + peakG + (a * (int)(endG - peakG)) / b, + peakB + (a * (int)(endB - peakB)) / b + ); + } else { + ptcl->unk_36 = GX_RGB(endR, endG, endB); + } + } else { + ptcl->unk_36 = colorAnim->unk_02; + } +} + +void sub_020A1DA0(SPLParticle *ptcl, UnkSPLStruct4 *res, int lifeRate) +{ + UnkSPLStruct10 *scaleAnim; + int in, out; + fx16 start, n, end; + + 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)); + } else { + ptcl->unk_34 = scaleAnim->unk_02; + } +} diff --git a/lib/spl/src/unk_020A1E30.c b/lib/spl/src/unk_020A1E30.c new file mode 100644 index 000000000..640e2c70f --- /dev/null +++ b/lib/spl/src/unk_020A1E30.c @@ -0,0 +1,92 @@ +#include "spl.h" + +#include + + +void SPL_020A1E30(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))); +} + +void SPL_020A1EC4(const void *obj,SPLParticle *ptcl,VecFx32 *pos,SPLEmitter *emtr) +{ + SPLSimpleCollisionField *fld = (SPLSimpleCollisionField *)obj; + fx32 y = fld->y; + fx32 ey; + + if (emtr->unk_E4 != FX32_MIN) { + y = emtr->unk_E4; + } + + 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; + } + } + 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)); + } + break; + } +} + +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_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; +} diff --git a/lib/spl/src/unk_020A2238.c b/lib/spl/src/unk_020A2238.c new file mode 100644 index 000000000..db35d3127 --- /dev/null +++ b/lib/spl/src/unk_020A2238.c @@ -0,0 +1,67 @@ +#include "spl.h" + +#include + +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 { + next->p_prev = node->p_prev; + node->p_prev->p_next = node->p_next; + } + + list->node_num -= 1; + return node; +} + +SPLNode *sub_020A22B8(SPLList *list) +{ + SPLNode *begin; + SPLNode *node; + + node = NULL; + begin = list->p_begin; + + if (begin != NULL) { + node = begin; + list->p_begin = begin->p_next; + if (list->p_begin != NULL) { + begin->p_next->p_prev = NULL; + } else { + list->p_begin = NULL; + list->p_end = NULL; + } + + list->node_num -= 1; + } + + return node; +} + +void sub_020A2304(SPLList *list, SPLNode *node) +{ + if (list->p_begin == NULL) { + list->p_begin = node; + list->p_end = node; + node->p_next = NULL; + node->p_prev = node->p_next; + } else { + node->p_next = list->p_begin; + node->p_prev = NULL; + list->p_begin->p_prev = node; + list->p_begin = node; + } + + list->node_num += 1; +} diff --git a/lib/spl/src/unk_020A2354.c b/lib/spl/src/unk_020A2354.c new file mode 100644 index 000000000..9a4c5455b --- /dev/null +++ b/lib/spl/src/unk_020A2354.c @@ -0,0 +1,19 @@ +#include "spl.h" + +#include + +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); + vec->y = rng_next(8); + vec->z = rng_next(8); + VEC_Normalize(vec, vec); +} diff --git a/src/overlay012/ov12_0221FC20.c b/src/overlay012/ov12_0221FC20.c index 2a2e2f77c..27b8c2619 100644 --- a/src/overlay012/ov12_0221FC20.c +++ b/src/overlay012/ov12_0221FC20.c @@ -71,7 +71,7 @@ typedef struct UnkStruct_ov12_02223178_t { u16 unk_16; int unk_18; UnkStruct_02014014 *unk_1C[16]; - UnkSPLStruct6 *unk_5C[20]; + SPLEmitter *unk_5C[20]; SpriteRenderer *unk_AC; UnkStruct_ov16_0223E0C8 *unk_B0[4]; u8 unk_C0[4]; @@ -729,9 +729,9 @@ UnkStruct_02014014 *ov12_02220260(UnkStruct_ov12_0221FCDC *param0, int param1) return param0->unk_BC->unk_1C[param1]; } -UnkSPLStruct6 *ov12_0222026C(UnkStruct_ov12_0221FCDC *param0, int param1) +SPLEmitter *ov12_0222026C(UnkStruct_ov12_0221FCDC *param0, int param1) { - UnkSPLStruct6 *v0; + SPLEmitter *v0; v0 = param0->unk_BC->unk_5C[param1]; return v0; diff --git a/src/overlay012/ov12_022237EC.c b/src/overlay012/ov12_022237EC.c index dbca03f65..8e0685b3c 100644 --- a/src/overlay012/ov12_022237EC.c +++ b/src/overlay012/ov12_022237EC.c @@ -15,7 +15,7 @@ #include "spl.h" #include "unk_02014000.h" -static void ov12_022237EC(UnkSPLStruct6 *param0); +static void ov12_022237EC(SPLEmitter *param0); static const UnkFuncPtr_020146F4 Unk_ov12_02238DB0[] = { ov12_022237EC, @@ -43,7 +43,7 @@ static const UnkFuncPtr_020146F4 Unk_ov12_02238DB0[] = { ov12_022238DC }; -static void ov12_022237EC(UnkSPLStruct6 *param0) +static void ov12_022237EC(SPLEmitter *param0) { return; } @@ -94,7 +94,7 @@ UnkStruct_02014014 *ov12_0222384C(NARC *param0, int param1, int param2, int para return v0; } -UnkSPLStruct6 *ov12_02223880(UnkStruct_02014014 *param0, int param1, int param2, void *param3) +SPLEmitter *ov12_02223880(UnkStruct_02014014 *param0, int param1, int param2, void *param3) { return sub_020146F4(param0, param1, Unk_ov12_02238DB0[param2], param3); } diff --git a/src/overlay012/ov12_0222389C.c b/src/overlay012/ov12_0222389C.c index 9daf27bcb..6c7d75ade 100644 --- a/src/overlay012/ov12_0222389C.c +++ b/src/overlay012/ov12_0222389C.c @@ -58,12 +58,12 @@ static s8 ov12_0222389C(UnkStruct_ov12_0221FCDC *param0, int param1, int param2) return v0; } -void ov12_022238DC(UnkSPLStruct6 *param0) +void ov12_022238DC(SPLEmitter *param0) { return; } -void ov12_022238E0(UnkSPLStruct6 *param0) +void ov12_022238E0(SPLEmitter *param0) { UnkStruct_ov12_0221FCDC *v0; UnkStruct_02014014 *v1; @@ -122,7 +122,7 @@ void ov12_022238E0(UnkSPLStruct6 *param0) } } -void ov12_02223998(UnkSPLStruct6 *param0) +void ov12_02223998(SPLEmitter *param0) { UnkStruct_ov12_0221FCDC *v0; UnkStruct_02014014 *v1; @@ -143,7 +143,7 @@ void ov12_02223998(UnkSPLStruct6 *param0) sub_02014744(v1, &v4); } -void ov12_022239F4(UnkSPLStruct6 *param0) +void ov12_022239F4(SPLEmitter *param0) { UnkStruct_ov12_0221FCDC *v0; int v1; @@ -159,7 +159,7 @@ void ov12_022239F4(UnkSPLStruct6 *param0) SPL_UnkInline4(param0, v2.z); } -void ov12_02223A38(UnkSPLStruct6 *param0) +void ov12_02223A38(SPLEmitter *param0) { UnkStruct_ov12_0221FCDC *v0; int v1; @@ -175,7 +175,7 @@ void ov12_02223A38(UnkSPLStruct6 *param0) SPL_UnkInline4(param0, v2.z); } -void ov12_02223A7C(UnkSPLStruct6 *param0) +void ov12_02223A7C(SPLEmitter *param0) { UnkStruct_ov12_0221FCDC *v0; int v1; @@ -193,7 +193,7 @@ void ov12_02223A7C(UnkSPLStruct6 *param0) SPL_UnkInline4(param0, v3.z); } -void ov12_02223AC8(UnkSPLStruct6 *param0) +void ov12_02223AC8(SPLEmitter *param0) { UnkStruct_ov12_0221FCDC *v0; VecFx32 v1; @@ -222,7 +222,7 @@ void ov12_02223AC8(UnkSPLStruct6 *param0) SPL_UnkInline4(param0, v1.z); } -void ov12_02223B30(UnkSPLStruct6 *param0) +void ov12_02223B30(SPLEmitter *param0) { UnkStruct_ov12_0221FCDC *v0; VecFx32 v1; @@ -252,7 +252,7 @@ void ov12_02223B30(UnkSPLStruct6 *param0) SPL_UnkInline4(param0, v1.z); } -void ov12_02223B98(UnkSPLStruct6 *param0) +void ov12_02223B98(SPLEmitter *param0) { UnkStruct_ov12_0221FCDC *v0; int v1; @@ -333,7 +333,7 @@ static void ov12_02223C40(int param0, s8 param1, VecFx32 *param2) } } -static void ov12_02223CD4(UnkStruct_ov12_0221FCDC *param0, UnkSPLStruct6 *param1, int param2, int param3, int param4, s8 param5, VecFx32 *param6) +static void ov12_02223CD4(UnkStruct_ov12_0221FCDC *param0, SPLEmitter *param1, int param2, int param3, int param4, s8 param5, VecFx32 *param6) { VecFx32 v0 = { 0, 0, 0 }; @@ -373,7 +373,7 @@ static void ov12_02223CD4(UnkStruct_ov12_0221FCDC *param0, UnkSPLStruct6 *param1 sub_02014970(param1, &v0); } -static void ov12_02223DA4(UnkStruct_ov12_0221FCDC *param0, UnkSPLStruct6 *param1, int param2, int param3, int param4, s8 param5, VecFx32 *param6) +static void ov12_02223DA4(UnkStruct_ov12_0221FCDC *param0, SPLEmitter *param1, int param2, int param3, int param4, s8 param5, VecFx32 *param6) { VecFx32 v0 = { 0, 0, 0 }; @@ -413,7 +413,7 @@ static void ov12_02223DA4(UnkStruct_ov12_0221FCDC *param0, UnkSPLStruct6 *param1 sub_02014890(param1, &v0); } -static void ov12_02223E74(UnkStruct_ov12_0221FCDC *param0, UnkSPLStruct6 *param1, int param2, int param3, int param4, int param5) +static void ov12_02223E74(UnkStruct_ov12_0221FCDC *param0, SPLEmitter *param1, int param2, int param3, int param4, int param5) { UnkStruct_02014014 *v0; VecFx32 v1; @@ -536,7 +536,7 @@ static void ov12_02223E74(UnkStruct_ov12_0221FCDC *param0, UnkSPLStruct6 *param1 SPL_UnkInline5(param1, &v4); } -static void ov12_02224138(UnkSPLStruct6 *param0, int param1, int param2) +static void ov12_02224138(SPLEmitter *param0, int param1, int param2) { int v0, v1; UnkStruct_ov12_0221FCDC *v2; @@ -548,62 +548,62 @@ static void ov12_02224138(UnkSPLStruct6 *param0, int param1, int param2) ov12_02223E74(v2, param0, v0, v1, param1, param2); } -void ov12_02224168(UnkSPLStruct6 *param0) +void ov12_02224168(SPLEmitter *param0) { ov12_02224138(param0, 0, 0); } -void ov12_02224174(UnkSPLStruct6 *param0) +void ov12_02224174(SPLEmitter *param0) { ov12_02224138(param0, 1, 1); } -void ov12_02224180(UnkSPLStruct6 *param0) +void ov12_02224180(SPLEmitter *param0) { ov12_02224138(param0, 1, 2); } -void ov12_0222418C(UnkSPLStruct6 *param0) +void ov12_0222418C(SPLEmitter *param0) { ov12_02224138(param0, 1, 3); } -void ov12_02224198(UnkSPLStruct6 *param0) +void ov12_02224198(SPLEmitter *param0) { ov12_02224138(param0, 1, 4); } -void ov12_022241A4(UnkSPLStruct6 *param0) +void ov12_022241A4(SPLEmitter *param0) { ov12_02224138(param0, 1, 5); } -void ov12_022241B0(UnkSPLStruct6 *param0) +void ov12_022241B0(SPLEmitter *param0) { ov12_02224138(param0, 2, 1); } -void ov12_022241BC(UnkSPLStruct6 *param0) +void ov12_022241BC(SPLEmitter *param0) { ov12_02224138(param0, 2, 2); } -void ov12_022241C8(UnkSPLStruct6 *param0) +void ov12_022241C8(SPLEmitter *param0) { ov12_02224138(param0, 2, 3); } -void ov12_022241D4(UnkSPLStruct6 *param0) +void ov12_022241D4(SPLEmitter *param0) { ov12_02224138(param0, 2, 4); } -void ov12_022241E0(UnkSPLStruct6 *param0) +void ov12_022241E0(SPLEmitter *param0) { ov12_02224138(param0, 2, 5); } -void ov12_022241EC(UnkSPLStruct6 *param0) +void ov12_022241EC(SPLEmitter *param0) { int v0, v1; UnkStruct_ov12_0221FCDC *v2; diff --git a/src/overlay012/ov12_0222421C.c b/src/overlay012/ov12_0222421C.c index 5fc50a03d..eea9ffa88 100644 --- a/src/overlay012/ov12_0222421C.c +++ b/src/overlay012/ov12_0222421C.c @@ -23,16 +23,16 @@ typedef struct { int unk_08; } UnkStruct_ov12_022396AC; -static void ov12_0222421C(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static void ov12_022242E0(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static void ov12_02224614(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static void ov12_02224E74(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static void ov12_02224EA8(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static void ov12_02224EB8(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); +static void ov12_0222421C(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static void ov12_022242E0(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static void ov12_02224614(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static void ov12_02224E74(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static void ov12_02224EA8(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static void ov12_02224EB8(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); static void ov12_02225008(UnkStruct_ov12_02225640 *param0, int param1, VecFx32 *param2); static void ov12_02225094(UnkStruct_ov12_02225640 *param0, VecFx32 *param1); -static void ov12_0222421C(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static void ov12_0222421C(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { if (param1->unk_0C[2] != 0) { ov12_022242E0(param0, param1); @@ -53,7 +53,7 @@ static void ov12_0222421C(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1 } } -static void ov12_02224260(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1, VecFx32 *param2) +static void ov12_02224260(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1, VecFx32 *param2) { UnkStruct_ov12_0221FCDC *v0; UnkStruct_02014014 *v1; @@ -78,7 +78,7 @@ static void ov12_02224260(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1 ov12_02235448(v3, param2, ov12_0221FDD4(v0), v2); } -static void ov12_022242A0(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1, VecFx32 *param2) +static void ov12_022242A0(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1, VecFx32 *param2) { UnkStruct_ov12_0221FCDC *v0; UnkStruct_02014014 *v1; @@ -103,7 +103,7 @@ static void ov12_022242A0(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1 ov12_02235448(v4, param2, ov12_0221FDD4(v0), v3); } -static void ov12_022242E0(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static void ov12_022242E0(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { VecFx32 v0; @@ -296,7 +296,7 @@ static const UnkStruct_ov12_022396AC Unk_ov12_0223934C[6][6]; static const UnkStruct_ov12_022396AC Unk_ov12_02239A0C[6][6]; static const UnkStruct_ov12_022396AC Unk_ov12_02239BBC[6][6]; -static void ov12_02224614(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static void ov12_02224614(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { int v0; int v1; @@ -599,7 +599,7 @@ static void ov12_02224614(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1 SPL_UnkInline5(param0, &v2); } -static void ov12_02224E74(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static void ov12_02224E74(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { int v0; int v1; @@ -618,12 +618,12 @@ static void ov12_02224E74(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1 } } -static void ov12_02224EA8(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static void ov12_02224EA8(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { ov12_0222584C(param1->unk_0C[5], param0, param1); } -static void ov12_02224EB8(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static void ov12_02224EB8(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { fx32 v0; int v1; @@ -670,7 +670,7 @@ static void ov12_02224EB8(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1 SPL_UnkInline4(param0, v0); } -void ov12_02224F14(UnkSPLStruct6 *param0) +void ov12_02224F14(SPLEmitter *param0) { UnkStruct_ov12_0221FCDC *v0; UnkStruct_ov12_02225640 *v1; diff --git a/src/overlay012/ov12_02225104.c b/src/overlay012/ov12_02225104.c index 2ed4c1676..a8cea3a39 100644 --- a/src/overlay012/ov12_02225104.c +++ b/src/overlay012/ov12_02225104.c @@ -12,22 +12,22 @@ #include "unk_02014000.h" static void ov12_02225104(UnkStruct_ov12_02225640 *param0, int param1[]); -static BOOL ov12_02225110(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static BOOL ov12_02225114(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static BOOL ov12_022251F8(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static BOOL ov12_022251FC(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static BOOL ov12_02225200(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static BOOL ov12_022252C8(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static BOOL ov12_0222534C(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static BOOL ov12_022253CC(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static BOOL ov12_02225434(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static BOOL ov12_02225438(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static BOOL ov12_0222543C(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static BOOL ov12_02225440(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static BOOL ov12_02225444(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static BOOL ov12_02225550(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); +static BOOL ov12_02225110(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static BOOL ov12_02225114(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static BOOL ov12_022251F8(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static BOOL ov12_022251FC(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static BOOL ov12_02225200(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static BOOL ov12_022252C8(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static BOOL ov12_0222534C(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static BOOL ov12_022253CC(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static BOOL ov12_02225434(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static BOOL ov12_02225438(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static BOOL ov12_0222543C(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static BOOL ov12_02225440(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static BOOL ov12_02225444(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static BOOL ov12_02225550(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); -static BOOL (*const Unk_ov12_02239D6C[])(UnkSPLStruct6 *, UnkStruct_ov12_02225640 *) = { +static BOOL (*const Unk_ov12_02239D6C[])(SPLEmitter *, UnkStruct_ov12_02225640 *) = { ov12_02225110, ov12_02225114, ov12_022251F8, @@ -49,12 +49,12 @@ static void ov12_02225104(UnkStruct_ov12_02225640 *param0, int param1[]) ov12_0222325C(param0->unk_00, param1, 5); } -static BOOL ov12_02225110(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static BOOL ov12_02225110(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { return 1; } -static BOOL ov12_02225114(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static BOOL ov12_02225114(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { int v0[5]; VecFx16 v1 = { 0, 0, 0 }; @@ -98,17 +98,17 @@ static BOOL ov12_02225114(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1 return 1; } -static BOOL ov12_022251F8(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static BOOL ov12_022251F8(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { return 1; } -static BOOL ov12_022251FC(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static BOOL ov12_022251FC(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { return 1; } -static BOOL ov12_02225200(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static BOOL ov12_02225200(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { int v0[5]; VecFx32 v1 = { 0, 0, 0 }; @@ -152,7 +152,7 @@ static BOOL ov12_02225200(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1 return 1; } -static BOOL ov12_022252C8(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static BOOL ov12_022252C8(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { int v0[5]; fx16 v1 = 0; @@ -183,7 +183,7 @@ static BOOL ov12_022252C8(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1 return 1; } -static BOOL ov12_0222534C(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static BOOL ov12_0222534C(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { int v0[5]; u16 v1 = 0; @@ -214,7 +214,7 @@ static BOOL ov12_0222534C(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1 return 1; } -static BOOL ov12_022253CC(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static BOOL ov12_022253CC(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { int v0[5]; u16 v1 = 0; @@ -243,27 +243,27 @@ static BOOL ov12_022253CC(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1 return 1; } -static BOOL ov12_02225434(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static BOOL ov12_02225434(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { return 1; } -static BOOL ov12_02225438(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static BOOL ov12_02225438(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { return 1; } -static BOOL ov12_0222543C(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static BOOL ov12_0222543C(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { return 1; } -static BOOL ov12_02225440(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static BOOL ov12_02225440(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { return 1; } -static BOOL ov12_02225444(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static BOOL ov12_02225444(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { int v0[5]; VecFx32 v1 = { 0, 0, 0 }; @@ -314,7 +314,7 @@ static BOOL ov12_02225444(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1 return 1; } -static BOOL ov12_02225550(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static BOOL ov12_02225550(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { int v0[5]; fx16 v1 = 0; @@ -345,7 +345,7 @@ static BOOL ov12_02225550(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1 return 1; } -void ov12_022255D4(int param0, UnkSPLStruct6 *param1, UnkStruct_ov12_02225640 *param2) +void ov12_022255D4(int param0, SPLEmitter *param1, UnkStruct_ov12_02225640 *param2) { BOOL v0; diff --git a/src/overlay012/ov12_02225640.c b/src/overlay012/ov12_02225640.c index e86ccfd56..b514922be 100644 --- a/src/overlay012/ov12_02225640.c +++ b/src/overlay012/ov12_02225640.c @@ -13,17 +13,17 @@ #include "unk_02014000.h" static void ov12_02225640(UnkStruct_ov12_02225640 *param0, int param1[]); -static BOOL ov12_0222564C(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static BOOL ov12_02225670(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static BOOL ov12_022256AC(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static BOOL ov12_022256E8(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static BOOL ov12_02225724(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static BOOL ov12_02225784(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static BOOL ov12_022257C0(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static BOOL ov12_022257FC(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); -static BOOL ov12_02225824(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1); +static BOOL ov12_0222564C(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static BOOL ov12_02225670(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static BOOL ov12_022256AC(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static BOOL ov12_022256E8(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static BOOL ov12_02225724(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static BOOL ov12_02225784(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static BOOL ov12_022257C0(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static BOOL ov12_022257FC(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); +static BOOL ov12_02225824(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1); -static BOOL (*const Unk_ov12_02239E10[])(UnkSPLStruct6 *, UnkStruct_ov12_02225640 *) = { +static BOOL (*const Unk_ov12_02239E10[])(SPLEmitter *, UnkStruct_ov12_02225640 *) = { ov12_0222564C, ov12_02225670, ov12_022256AC, @@ -40,7 +40,7 @@ static void ov12_02225640(UnkStruct_ov12_02225640 *param0, int param1[]) ov12_0222325C(param0->unk_00, param1, 4); } -static BOOL ov12_0222564C(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static BOOL ov12_0222564C(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { Camera *camera; CameraAngle v1 = { 0, 0, 0 }; @@ -51,7 +51,7 @@ static BOOL ov12_0222564C(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1 return 1; } -static BOOL ov12_02225670(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static BOOL ov12_02225670(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { Camera *camera; CameraAngle v1 = { (0x1000 * 2), (0x1000 * 2), 0 }; @@ -64,7 +64,7 @@ static BOOL ov12_02225670(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1 return 1; } -static BOOL ov12_022256AC(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static BOOL ov12_022256AC(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { int v0[4]; CameraAngle v1 = { 0, 0, 0, 0 }; @@ -82,7 +82,7 @@ static BOOL ov12_022256AC(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1 return 1; } -static BOOL ov12_022256E8(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static BOOL ov12_022256E8(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { Camera *camera; CameraAngle v1 = { -(0x1000 * 3), (0x1000 * 2), 0x1000 }; @@ -95,7 +95,7 @@ static BOOL ov12_022256E8(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1 return 1; } -static BOOL ov12_02225724(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static BOOL ov12_02225724(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { Camera *camera; CameraAngle v1 = { 49664, 5952, 4096 }; @@ -113,7 +113,7 @@ static BOOL ov12_02225724(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1 return 1; } -static BOOL ov12_02225784(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static BOOL ov12_02225784(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { Camera *camera; CameraAngle v1 = { 49664, 5952, 4096 }; @@ -126,7 +126,7 @@ static BOOL ov12_02225784(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1 return 1; } -static BOOL ov12_022257C0(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static BOOL ov12_022257C0(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { Camera *camera; CameraAngle v1 = { 0, 0, -6000 }; @@ -139,7 +139,7 @@ static BOOL ov12_022257C0(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1 return 1; } -static BOOL ov12_022257FC(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static BOOL ov12_022257FC(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { VecFx32 v0; Camera *camera; @@ -152,7 +152,7 @@ static BOOL ov12_022257FC(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1 return 1; } -static BOOL ov12_02225824(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1) +static BOOL ov12_02225824(SPLEmitter *param0, UnkStruct_ov12_02225640 *param1) { VecFx32 v0; Camera *camera; @@ -165,7 +165,7 @@ static BOOL ov12_02225824(UnkSPLStruct6 *param0, UnkStruct_ov12_02225640 *param1 return 1; } -void ov12_0222584C(int param0, UnkSPLStruct6 *param1, UnkStruct_ov12_02225640 *param2) +void ov12_0222584C(int param0, SPLEmitter *param1, UnkStruct_ov12_02225640 *param2) { BOOL v0; diff --git a/src/overlay012/ov12_02226B84.c b/src/overlay012/ov12_02226B84.c index 78d5d51b7..6bda6e349 100644 --- a/src/overlay012/ov12_02226B84.c +++ b/src/overlay012/ov12_02226B84.c @@ -351,7 +351,7 @@ typedef struct { int unk_2C; int unk_30; UnkStruct_02014014 *unk_34; - UnkSPLStruct6 *unk_38; + SPLEmitter *unk_38; UnkStruct_ov12_0223595C unk_3C; UnkStruct_ov12_02235998 unk_58[4]; UnkStruct_ov12_02225F6C unk_A8[2]; @@ -373,7 +373,7 @@ typedef struct { int unk_2C; int unk_30; UnkStruct_02014014 *unk_34; - UnkSPLStruct6 *unk_38; + SPLEmitter *unk_38; UnkStruct_ov12_0223595C unk_3C; UnkStruct_ov12_02225F6C unk_58; VecFx32 unk_7C; @@ -2859,14 +2859,14 @@ static void ov12_02229980(UnkStruct_ov12_0221FCDC *param0, UnkStruct_ov12_022299 } } -static BOOL ov12_02229A50(UnkSPLStruct6 *param0) +static BOOL ov12_02229A50(SPLEmitter *param0) { BOOL v0; v0 = 0; { - UnkSPLStruct8 *v1; + SPLParticle *v1; int v2; int v3; diff --git a/src/overlay012/ov12_02235E94.c b/src/overlay012/ov12_02235E94.c index 38a8b086a..37f12837a 100644 --- a/src/overlay012/ov12_02235E94.c +++ b/src/overlay012/ov12_02235E94.c @@ -58,7 +58,7 @@ typedef struct UnkStruct_ov12_02235FE0_t { UnkStruct_02014014 *unk_14[9]; UnkStruct_0202CA64 *unk_38[9]; BOOL unk_5C[9]; - UnkSPLStruct6 *unk_80; + SPLEmitter *unk_80; SysTask *unk_84; BOOL unk_88; NARC *unk_8C; @@ -71,7 +71,7 @@ typedef struct UnkStruct_ov12_02235FE0_t { typedef struct UnkStruct_ov12_02236648_t { UnkStruct_ov12_02236690 unk_00; - UnkSPLStruct6 *unk_14; + SPLEmitter *unk_14; UnkStruct_02014014 *unk_18; int unk_1C; int unk_20; @@ -116,8 +116,8 @@ typedef struct BallRotation { static void ov12_022363CC(SysTask *param0, void *param1); static void ov12_0223646C(UnkStruct_ov12_02235FE0 *param0, UnkFuncPtr_020146F4 param1); -static void ov12_02236598(UnkSPLStruct6 *param0); -static void ov12_022365D4(UnkSPLStruct6 *param0); +static void ov12_02236598(SPLEmitter *param0); +static void ov12_022365D4(SPLEmitter *param0); static void ov12_02237C54(BallRotation *param0); static void ov12_02237D8C(BallRotation *param0); static void ov12_022378A0(BallRotation *param0); @@ -755,7 +755,7 @@ static void ov12_02236520(int param0, VecFx32 *param1) } } -static void ov12_02236598(UnkSPLStruct6 *param0) +static void ov12_02236598(SPLEmitter *param0) { int v0; UnkStruct_ov12_02235FE0 *v1; @@ -771,7 +771,7 @@ static void ov12_02236598(UnkSPLStruct6 *param0) } } -static void ov12_022365D4(UnkSPLStruct6 *param0) +static void ov12_022365D4(SPLEmitter *param0) { VecFx32 v0; int v1; @@ -824,7 +824,7 @@ static void ov12_022365D4(UnkSPLStruct6 *param0) SPL_UnkInline1(param0, &v0); } -static void ov12_02236648(UnkSPLStruct6 *param0) +static void ov12_02236648(SPLEmitter *param0) { UnkStruct_ov12_02236648 *v0 = sub_02014764(); diff --git a/src/overlay012/ov12_02237EFC.c b/src/overlay012/ov12_02237EFC.c index 02a7124ad..3b5265b5b 100644 --- a/src/overlay012/ov12_02237EFC.c +++ b/src/overlay012/ov12_02237EFC.c @@ -22,7 +22,7 @@ typedef struct UnkStruct_ov12_02238004_t { int unk_04; UnkStruct_ov12_02237F38 unk_08; UnkStruct_02014014 *unk_10; - UnkSPLStruct6 *unk_14; + SPLEmitter *unk_14; SysTask *unk_18; int unk_1C; BOOL unk_20; @@ -36,7 +36,7 @@ typedef struct UnkStruct_ov12_02237F98_t { static void ov12_02238030(SysTask *param0, void *param1); static void ov12_02238054(UnkStruct_ov12_02238004 *param0, UnkFuncPtr_020146F4 param1); -static void ov12_02238080(UnkSPLStruct6 *param0); +static void ov12_02238080(SPLEmitter *param0); static int ov12_02238088(int param0); UnkStruct_ov12_02237F98 *ov12_02237EFC(int param0, UnkStruct_ov12_02237EFC *param1) @@ -195,7 +195,7 @@ static void ov12_02238054(UnkStruct_ov12_02238004 *param0, UnkFuncPtr_020146F4 p sub_02014788(param0->unk_10, param0->unk_08.unk_04); } -static void ov12_02238080(UnkSPLStruct6 *param0) +static void ov12_02238080(SPLEmitter *param0) { UnkStruct_ov12_02238004 *v0; diff --git a/src/overlay017/ov17_02247A48.c b/src/overlay017/ov17_02247A48.c index 45c1e61a6..5dd1e397b 100644 --- a/src/overlay017/ov17_02247A48.c +++ b/src/overlay017/ov17_02247A48.c @@ -976,7 +976,7 @@ static void ov17_02248860(SysTask *param0, void *param1) } } -static void ov17_02248990(UnkSPLStruct6 *param0) +static void ov17_02248990(SPLEmitter *param0) { { VecFx32 v0 = { 0, 0, 0 }; diff --git a/src/overlay017/ov17_0224A0FC.c b/src/overlay017/ov17_0224A0FC.c index bd47802f6..6fb36434b 100644 --- a/src/overlay017/ov17_0224A0FC.c +++ b/src/overlay017/ov17_0224A0FC.c @@ -105,7 +105,7 @@ static void ov17_0224AE84(SysTask *param0, void *param1); static void ov17_0224C718(SysTask *param0, void *param1); void ov17_0224C89C(UnkStruct_ov17_0224DF54 *param0, const UnkStruct_ov17_0224EDE0 *param1); static void ov17_0224CA28(SysTask *param0, void *param1); -static void ov17_0224CAC0(UnkSPLStruct6 *param0); +static void ov17_0224CAC0(SPLEmitter *param0); static void ov17_0224CB00(UnkStruct_ov17_0224DF54 *param0, int param1, int param2); static void ov17_0224CB80(UnkStruct_ov17_0224DF54 *param0, int param1); void ov17_0224CD84(UnkStruct_ov17_0224DF54 *param0, u32 param1, u32 param2, int param3, int param4, u16 param5); @@ -2391,7 +2391,7 @@ void ov17_0224CA90(UnkStruct_ov17_0224DF54 *param0, u32 param1, s32 param2, s32 sub_020146F4(param0->unk_0C, param1, ov17_0224CAC0, param0); } -static void ov17_0224CAC0(UnkSPLStruct6 *param0) +static void ov17_0224CAC0(SPLEmitter *param0) { UnkStruct_ov17_0224DF54 *v0; UnkStruct_ov17_0224CAC0 *v1; diff --git a/src/overlay077/ov77_021D6C70.c b/src/overlay077/ov77_021D6C70.c index 37415708a..e48c0714e 100644 --- a/src/overlay077/ov77_021D6C70.c +++ b/src/overlay077/ov77_021D6C70.c @@ -41,7 +41,7 @@ typedef struct { } UnkStruct_ov77_021D7940; static void ov77_021D725C(void); -static void ov77_021D7268(UnkSPLStruct6 *param0); +static void ov77_021D7268(SPLEmitter *param0); static BOOL ov77_021D7004(UnkStruct_ov77_021D6CFC *param0, const u8 param1); static BOOL ov77_021D7074(UnkStruct_ov77_021D6CFC *param0, const u8 param1); static BOOL ov77_021D70CC(UnkStruct_ov77_021D6CFC *param0, const u8 param1); @@ -99,7 +99,7 @@ UnkStruct_02014014 *ov77_021D6CBC(UnkStruct_ov77_021D6CFC *param0) return param0->unk_18; } -UnkSPLStruct6 *ov77_021D6CD0(UnkStruct_ov77_021D6CFC *param0, int param1) +SPLEmitter *ov77_021D6CD0(UnkStruct_ov77_021D6CFC *param0, int param1) { GF_ASSERT(param0 != NULL && param0->unk_18 != NULL); @@ -376,7 +376,7 @@ static void ov77_021D725C(void) sub_020146C0(); } -static void ov77_021D7268(UnkSPLStruct6 *param0) +static void ov77_021D7268(SPLEmitter *param0) { Sprite *v0 = sub_02014764(); VecFx32 v1 = { 0, 0, 0 }; diff --git a/src/overlay104/ov104_02237378.c b/src/overlay104/ov104_02237378.c index eeadc5677..af7ba2d28 100644 --- a/src/overlay104/ov104_02237378.c +++ b/src/overlay104/ov104_02237378.c @@ -72,7 +72,7 @@ BOOL ov104_022360A8(UnkStruct_ov104_0222E930 *param0); BOOL ov104_022360C0(UnkStruct_ov104_0222E930 *param0); BOOL ov104_02237D84(UnkStruct_ov104_0222E930 *param0); BOOL ov104_02237D98(UnkStruct_ov104_0222E930 *param0); -static void ov104_02237C30(UnkSPLStruct6 *param0); +static void ov104_02237C30(SPLEmitter *param0); static void ov104_02237C0C(UnkStruct_ov104_0222E930 *param0, UnkStruct_ov104_0223BFFC *param1, u16 param2); static void ov104_0223770C(void *param0); @@ -580,7 +580,7 @@ static void ov104_02237C0C(UnkStruct_ov104_0222E930 *param0, UnkStruct_ov104_022 return; } -static void ov104_02237C30(UnkSPLStruct6 *param0) +static void ov104_02237C30(SPLEmitter *param0) { VecFx32 v0; VecFx16 v1; diff --git a/src/overlay118/ov118_021D0D80.c b/src/overlay118/ov118_021D0D80.c index 43e0f71d5..08b9b5cc9 100644 --- a/src/overlay118/ov118_021D0D80.c +++ b/src/overlay118/ov118_021D0D80.c @@ -45,7 +45,7 @@ static int ov118_021D10E8(void); static void ov118_021D110C(OverlayMetadata *param0); static u32 ov118_021D1128(u32 param0, BOOL param1); static u32 ov118_021D114C(u32 param0, BOOL param1); -static void ov118_021D10B0(UnkSPLStruct6 *param0); +static void ov118_021D10B0(SPLEmitter *param0); static const fx32 Unk_ov118_021D1170[][2] = { { 0xFFFFFFFFFFFFBF8C, 0x2EE0 }, @@ -217,7 +217,7 @@ static void ov118_021D1028(OverlayMetadata *param0) } } -static void ov118_021D10B0(UnkSPLStruct6 *param0) +static void ov118_021D10B0(SPLEmitter *param0) { OverlayMetadata *v0; diff --git a/src/overlay119/ov119_021D0D80.c b/src/overlay119/ov119_021D0D80.c index 63f5faa25..efa5cc387 100644 --- a/src/overlay119/ov119_021D0D80.c +++ b/src/overlay119/ov119_021D0D80.c @@ -59,7 +59,7 @@ static u32 ov119_021D13B4(u32 param0, BOOL param1); static u32 ov119_021D13D0(u32 param0, BOOL param1); static UnkStruct_02014014 *ov119_021D13EC(int param0); static UnkStruct_02014014 *ov119_021D1434(int param0, int param1, int param2); -static void ov119_021D1474(UnkSPLStruct6 *param0); +static void ov119_021D1474(SPLEmitter *param0); void ov119_021D0D80(void) { @@ -474,7 +474,7 @@ void ov119_021D145C(UnkStruct_02014014 *param0) Heap_FreeToHeap(v0); } -static void ov119_021D1474(UnkSPLStruct6 *param0) +static void ov119_021D1474(SPLEmitter *param0) { VecFx32 v0 = { 0, 0, 0 }; diff --git a/src/unk_02014000.c b/src/unk_02014000.c index fce907d82..ce8411c54 100644 --- a/src/unk_02014000.c +++ b/src/unk_02014000.c @@ -29,9 +29,9 @@ enum { }; typedef struct UnkStruct_02014014_t { - UnkSPLStruct1 *unk_00; + SPLManager *unk_00; void *unk_04; - UnkSPLStruct6 *unk_08; + SPLEmitter *unk_08; void *unk_0C; void *unk_10; void *unk_14; @@ -566,9 +566,9 @@ int sub_020146C0(void) return count; } -UnkSPLStruct6 *sub_020146E4(UnkStruct_02014014 *param0, int param1, const VecFx32 *param2) +SPLEmitter *sub_020146E4(UnkStruct_02014014 *param0, int param1, const VecFx32 *param2) { - UnkSPLStruct6 *v0; + SPLEmitter *v0; v0 = SPL_0209C56C(param0->unk_00, param1, param2); param0->unk_08 = v0; @@ -576,9 +576,9 @@ UnkSPLStruct6 *sub_020146E4(UnkStruct_02014014 *param0, int param1, const VecFx3 return v0; } -UnkSPLStruct6 *sub_020146F4(UnkStruct_02014014 *param0, int param1, UnkFuncPtr_020146F4 param2, void *param3) +SPLEmitter *sub_020146F4(UnkStruct_02014014 *param0, int param1, UnkFuncPtr_020146F4 param2, void *param3) { - UnkSPLStruct6 *v0; + SPLEmitter *v0; Unk_021BF614 = param3; v0 = SPL_0209C4D8(param0->unk_00, param1, param2); @@ -598,7 +598,7 @@ void sub_02014718(UnkStruct_02014014 *param0) SPL_0209C400(param0->unk_00); } -void sub_02014724(UnkStruct_02014014 *param0, UnkSPLStruct6 *param1) +void sub_02014724(UnkStruct_02014014 *param0, SPLEmitter *param1) { SPL_0209C444(param0->unk_00, param1); } @@ -644,14 +644,14 @@ u8 sub_02014790(UnkStruct_02014014 *param0) return param0->unk_DB; } -void sub_02014798(UnkSPLStruct6 *param0, VecFx16 *param1) +void sub_02014798(SPLEmitter *param0, VecFx16 *param1) { *param1 = param0->unk_C0; } -void sub_020147B0(UnkSPLStruct6 *param0, fx32 param1) +void sub_020147B0(SPLEmitter *param0, fx32 param1) { - param0->unk_90->unk_00->unk_10 = param1; + param0->p_res->unk_00->unk_10 = param1; } enum { @@ -663,20 +663,20 @@ enum { SPL_FLD_TYPE_CONVERGENCE, }; -static const void *sub_020147B8(UnkSPLStruct6 *param0, int param1) +static const void *sub_020147B8(SPLEmitter *param0, int param1) { int v0; int v1; UnkStruct_020147B8 *v2; - v1 = param0->unk_90->unk_1C; + v1 = param0->p_res->unk_1C; if (v1 == 0) { return NULL; } for (v0 = 0; v0 < v1; v0++) { - v2 = ¶m0->unk_90->unk_18[v0]; + v2 = ¶m0->p_res->unk_18[v0]; if (v2 == NULL) { continue; @@ -721,7 +721,7 @@ static const void *sub_020147B8(UnkSPLStruct6 *param0, int param1) return NULL; } -void sub_02014874(UnkSPLStruct6 *param0, VecFx16 *param1) +void sub_02014874(SPLEmitter *param0, VecFx16 *param1) { UnkStruct_02014874 *v0; @@ -734,7 +734,7 @@ void sub_02014874(UnkSPLStruct6 *param0, VecFx16 *param1) v0->unk_00 = *param1; } -void sub_02014890(UnkSPLStruct6 *param0, VecFx32 *param1) +void sub_02014890(SPLEmitter *param0, VecFx32 *param1) { UnkStruct_02014890 *v0; @@ -747,7 +747,7 @@ void sub_02014890(UnkSPLStruct6 *param0, VecFx32 *param1) v0->unk_00 = *param1; } -void sub_020148A8(UnkSPLStruct6 *param0, VecFx32 *param1) +void sub_020148A8(SPLEmitter *param0, VecFx32 *param1) { UnkStruct_02014890 *v0; @@ -762,7 +762,7 @@ void sub_020148A8(UnkSPLStruct6 *param0, VecFx32 *param1) *param1 = v0->unk_00; } -void sub_020148DC(UnkSPLStruct6 *param0, fx16 *param1) +void sub_020148DC(SPLEmitter *param0, fx16 *param1) { UnkStruct_02014890 *v0; @@ -775,7 +775,7 @@ void sub_020148DC(UnkSPLStruct6 *param0, fx16 *param1) v0->unk_0C = *param1; } -void sub_020148F4(UnkSPLStruct6 *param0, fx16 *param1) +void sub_020148F4(SPLEmitter *param0, fx16 *param1) { UnkStruct_02014890 *v0; @@ -789,7 +789,7 @@ void sub_020148F4(UnkSPLStruct6 *param0, fx16 *param1) *param1 = v0->unk_0C; } -void sub_02014910(UnkSPLStruct6 *param0, u16 *param1) +void sub_02014910(SPLEmitter *param0, u16 *param1) { UnkStruct_02014910 *v0; @@ -802,7 +802,7 @@ void sub_02014910(UnkSPLStruct6 *param0, u16 *param1) v0->unk_00 = *param1; } -void sub_02014924(UnkSPLStruct6 *param0, u16 *param1) +void sub_02014924(SPLEmitter *param0, u16 *param1) { UnkStruct_02014910 *v0; @@ -816,7 +816,7 @@ void sub_02014924(UnkSPLStruct6 *param0, u16 *param1) *param1 = v0->unk_00; } -void sub_02014940(UnkSPLStruct6 *param0, u16 *param1) +void sub_02014940(SPLEmitter *param0, u16 *param1) { UnkStruct_02014910 *v0; @@ -829,7 +829,7 @@ void sub_02014940(UnkSPLStruct6 *param0, u16 *param1) v0->unk_02 = *param1; } -void sub_02014954(UnkSPLStruct6 *param0, u16 *param1) +void sub_02014954(SPLEmitter *param0, u16 *param1) { UnkStruct_02014910 *v0; @@ -843,7 +843,7 @@ void sub_02014954(UnkSPLStruct6 *param0, u16 *param1) *param1 = v0->unk_02; } -void sub_02014970(UnkSPLStruct6 *param0, VecFx32 *param1) +void sub_02014970(SPLEmitter *param0, VecFx32 *param1) { UnkStruct_02014970 *v0; @@ -856,7 +856,7 @@ void sub_02014970(UnkSPLStruct6 *param0, VecFx32 *param1) v0->unk_00 = *param1; } -void sub_02014988(UnkSPLStruct6 *param0, VecFx32 *param1) +void sub_02014988(SPLEmitter *param0, VecFx32 *param1) { UnkStruct_02014970 *v0; @@ -871,7 +871,7 @@ void sub_02014988(UnkSPLStruct6 *param0, VecFx32 *param1) *param1 = v0->unk_00; } -void sub_020149BC(UnkSPLStruct6 *param0, fx16 *param1) +void sub_020149BC(SPLEmitter *param0, fx16 *param1) { UnkStruct_02014970 *v0; @@ -884,7 +884,7 @@ void sub_020149BC(UnkSPLStruct6 *param0, fx16 *param1) v0->unk_0C = *param1; } -void sub_020149D4(UnkSPLStruct6 *param0, fx16 *param1) +void sub_020149D4(SPLEmitter *param0, fx16 *param1) { UnkStruct_02014970 *v0; diff --git a/src/unk_0207C63C.c b/src/unk_0207C63C.c index 78a7926ed..391b761d7 100644 --- a/src/unk_0207C63C.c +++ b/src/unk_0207C63C.c @@ -30,7 +30,7 @@ static u32 sub_0207C7B0(u32 param0, BOOL param1); static UnkStruct_02014014 *sub_0207C7CC(int param0); static UnkStruct_02014014 *sub_0207C814(int param0, int param1, int param2); static void sub_0207C83C(UnkStruct_02014014 *param0); -static void sub_0207C854(UnkSPLStruct6 *param0); +static void sub_0207C854(SPLEmitter *param0); void sub_0207C63C(void) { @@ -170,7 +170,7 @@ void sub_0207C83C(UnkStruct_02014014 *param0) Heap_FreeToHeap(v0); } -static void sub_0207C854(UnkSPLStruct6 *param0) +static void sub_0207C854(SPLEmitter *param0) { VecFx32 v0 = { 0, 0, 0 };