diff --git a/assets/xml/code/eff_shield_particle.xml b/assets/xml/code/eff_shield_particle.xml new file mode 100644 index 0000000000..3ff5535062 --- /dev/null +++ b/assets/xml/code/eff_shield_particle.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/include/functions.h b/include/functions.h index d9d7972279..921e974b97 100644 --- a/include/functions.h +++ b/include/functions.h @@ -167,7 +167,7 @@ s32 PadSetup_Init(OSMesgQueue* mq, u8* outMask, OSContStatus* status); // void func_800867B4(void); // void func_800867D4(void); // void func_800867F4(void); -// void func_80086814(void); +f32 func_80086814(f32 x); // void func_80086834(void); // void func_80086880(void); // void func_800869A4(void); @@ -499,52 +499,37 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3 s32 func_800A8150(s32 index); s32 func_800A817C(s32 index); s32 func_800A81A4(GlobalContext* globalCtx, s32 a1, s32 a2); -void func_800A81F0(EffectBlure* this, Vec3f* p1, Vec3f* p2); -void func_800A8514(void* effectParams); -void EffectBlure_Initcommon(EffectBlure* params); -void EffectBlure_Init1(EffectBlure* params, EffBlureInit1* init); -void EffectBlure_Init2(EffectBlure* params, EffBlureInit2* init); -void EffectBlure_Destroy(EffectBlure* params); -s32 EffectBlure_Update(EffectBlure* params); -// void func_800A8C78(void); -// void func_800A8DE8(void); -// void func_800A92FC(void); -// void func_800A9330(void); -// void func_800A9804(void); -// void func_800AA190(void); -// void func_800AA460(void); -// void func_800AA498(void); -// void func_800AA700(void); -// void func_800AABE0(void); -void EffectBlure_Draw(EffectBlure* params, GraphicsContext* gfxCtx); -void EffectShieldParticle_Init(EffShieldParticleParams* params, EffShieldParticleInit* init); -void EffectShieldParticle_Destroy(EffShieldParticleParams* params); -s32 EffectShieldParticle_Update(EffShieldParticleParams* params); -void EffectShieldParticle_CalculateColors(EffShieldParticleParams* params, Color_RGBA8* primColor, Color_RGBA8* envColor); -void EffectShieldParticle_Draw(EffShieldParticleParams* params, GraphicsContext* gfxCtx); -void EffectSpark_Init(EffSparkParams* params, EffSparkParams* init); -void EffectSpark_Destroy(EffSparkParams* params); -s32 EffectSpark_Update(EffSparkParams* params); -void EffectSpark_Draw(EffSparkParams* params, GraphicsContext* gfxCtx); -void func_800AE2A0(GlobalContext* globalCtx, Color_RGBA8* arg1, s16 arg2, s16 arg3); -void func_800AE434(GlobalContext* globalCtx, Color_RGBA8* color, s16 sParm3, s16 sParm4); +void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2); +void EffectBlure_AddSpace(EffectBlure* this); +void EffectBlure_Init1(void* thisx, void* initParamsx); +void EffectBlure_Init2(void* thisx, void* initParamsx); +void EffectBlure_Destroy(void* thisx); +s32 EffectBlure_Update(void* thisx); +void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx); +void EffectShieldParticle_Init(void* thisx, void* initParamsx); +void EffectShieldParticle_Destroy(void* thisx); +s32 EffectShieldParticle_Update(void* thisx); +void EffectShieldParticle_Draw(void* thisx, GraphicsContext* gfxCtx); +void EffectSpark_Init(void* thisx, void* initParamsx); +void EffectSpark_Destroy(void* thisx); +s32 EffectSpark_Update(void* thisx); +void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx); +void func_800AE2A0(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3); +void func_800AE434(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3); void func_800AE5A0(GlobalContext* globalCtx); -void func_800AE5E4(GlobalContext* globalCtx, Color_RGBA8* arg1, s16 arg2, s16 arg3); -void func_800AE778(GlobalContext* globalCtx, Color_RGBA8* color, s16 param_3, s16 param_4); +void func_800AE5E4(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3); +void func_800AE778(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3); void func_800AE8EC(GlobalContext* globalCtx); -void func_800AE930(CollisionContext* colCtx, s32 param_2, Vec3f* param_3, f32 param_4, s16 param_5, CollisionPoly* param_6, s32 param_7); -void func_800AEF44(s32 arg0); -void EffectTireMark_InitParticle(EffTireMarkParticle* particle); -void EffectTireMark_Init(EffTireMarkParams* params, EffTireMarkInit* init); -void EffectTireMark_Destroy(EffTireMarkParams* params); -s32 EffectTireMark_Update(EffTireMarkParams* params); -void EffectTireMark_InitVertices(F3DVertexColor* vertices, EffTireMarkParticle* particle, s32 index, s32 alpha); -void EffectTireMark_Draw(EffTireMarkParams* params, GraphicsContext* gfxCtx); -GlobalContext* Effect_GetContext(void); -void* Effect_GetParams(s32 index); -void Effect_InitCommon(EffCommon* common); +void func_800AE930(CollisionContext* colCtx, EffectTireMark* this, Vec3f* pos, f32 arg3, s16 angle, CollisionPoly* colPoly, s32 arg6); +void func_800AEF44(EffectTireMark* this); +void EffectTireMark_Init(void* thisx, void* initParamsx); +void EffectTireMark_Destroy(void* thisx); +s32 EffectTireMark_Update(void* thisx); +void EffectTireMark_Draw(void* thisx, GraphicsContext* gfxCtx); +GlobalContext* Effect_GetGlobalCtx(void); +void* Effect_GetByIndex(s32 index); void Effect_Init(GlobalContext* globalCtx); -void Effect_Add(GlobalContext* globalCtx, s32* index, s32 type, u8 param_4, u8 param_5, void* initParams); +void Effect_Add(GlobalContext* globalCtx, s32* pIndex, s32 type, u8 arg3, u8 arg4, void* initParams); void Effect_DrawAll(GraphicsContext* gfxCtx); void Effect_UpdateAll(GlobalContext* globalCtx); void Effect_Destroy(GlobalContext* globalCtx, s32 index); @@ -3231,7 +3216,7 @@ f32 Rand_ZeroFloat(f32 scale); f32 randPlusMinusPoint5Scaled(f32 scale); f32 Math3D_Normalize(Vec3f* vec); s32 Math3D_PlaneVsLineSegClosestPoint(f32 planeAA, f32 planeAB, f32 planeAC, f32 planeADist, f32 planeBA, f32 planeBB, f32 planeBC, f32 planeBDist, Vec3f* linePointA, Vec3f* linePointB, Vec3f* closestPoint); -// UNK_TYPE4 func_80179798(Vec3f* param_1, Vec3f* param_2, Vec3f* param_3, Vec3f* param_4, Vec3f* param_5, Vec3f* param_6); +s32 func_80179798(Vec3f* param_1, Vec3f* param_2, Vec3f* param_3, Vec3f* param_4, Vec3f* param_5, Vec3f* param_6); // void func_80179A44(void); void func_80179B34(float fParm1, f32 fParm2, f32 fParm5, f32 fParm6, f32 param_5, f32 param_6, f32 param_7, float* param_8, float* param_9); // UNK_TYPE4 func_80179B94(f32 fParm1, f32 fParm2, f32 fParm5, f32 param_4, f32 param_5, f32 param_6, f32 param_7, f32 param_8, Vec3f* param_9); diff --git a/include/macros.h b/include/macros.h index 7b726e6a65..1afbde243b 100644 --- a/include/macros.h +++ b/include/macros.h @@ -102,6 +102,7 @@ extern GraphicsContext* __gfxCtx; s32 __dispPad #define CLOSE_DISPS(gfxCtx) \ + (void)0; \ } \ (void)0 diff --git a/include/variables.h b/include/variables.h index e9c3b8c300..05ea5c2592 100644 --- a/include/variables.h +++ b/include/variables.h @@ -382,8 +382,6 @@ extern UNK_PTR D_801AE260[3]; // extern UNK_TYPE4 D_801AE2BC; // extern UNK_TYPE4 D_801AE2CC; // extern UNK_TYPE4 D_801AE2DC; -extern F3DVertex sEffectShieldParticleVertices[4]; -extern EffInfo sEffInfoTable[5]; extern EffectSsInfo EffectSS2Info; // extern UNK_TYPE1 D_801AE3B0; // extern UNK_TYPE1 D_801AE3B4; @@ -870,8 +868,8 @@ extern ColChkVsFunc sOCVsFuncs[COLSHAPE_MAX][COLSHAPE_MAX]; extern CollisionCheckInfo defaultColChkInfo; extern ColChkApplyFunc sApplyDamageFuncs[COLSHAPE_MAX]; extern ColChkLineFunc sOCLineCheckFuncs[COLSHAPE_MAX]; -extern EffShieldParticleInit shieldParticleInitMetal; -extern EffShieldParticleInit shieldParticleInitWood; +extern EffectShieldParticleInit shieldParticleInitMetal; +extern EffectShieldParticleInit shieldParticleInitWood; // extern UNK_TYPE4 D_801BB090; // extern UNK_TYPE1 D_801BB094; // extern UNK_TYPE1 D_801BB0DC; @@ -3104,15 +3102,7 @@ extern u64 gJpegUCodeData[]; // extern UNK_TYPE1 D_801E3FA0; // bss -extern EffTables sEffTable; -// extern UNK_TYPE1 D_801E4514; -// extern UNK_TYPE1 D_801E4E08; -// extern UNK_TYPE1 D_801E531C; -// extern UNK_TYPE1 D_801E69E0; -// extern UNK_TYPE1 D_801E9AA0; -// extern UNK_TYPE1 D_801ED4C0; // extern UNK_TYPE1 D_801ED890; -// extern UNK_TYPE1 D_801ED894; // extern UNK_TYPE1 D_801ED8A0; // extern UNK_TYPE1 D_801ED8B0; // extern UNK_TYPE1 D_801ED8B4; @@ -3197,12 +3187,12 @@ extern Vec3f D_801EE1E0; extern Vec3f D_801EE1F0; // extern UNK_TYPE1 D_801EE1F4; // extern UNK_TYPE1 D_801EE1F8; -extern EffSparkParams D_801EE200; +extern EffectSparkInit D_801EE200; extern TriNorm D_801EE6C8; extern TriNorm D_801EE700; -extern EffSparkParams D_801EE738; -extern EffSparkParams D_801EEC00; -extern EffSparkParams D_801EF0C8; +extern EffectSparkInit D_801EE738; +extern EffectSparkInit D_801EEC00; +extern EffectSparkInit D_801EF0C8; extern TriNorm D_801EF590; extern TriNorm D_801EF5C8; extern TriNorm D_801EF600; @@ -3887,6 +3877,7 @@ extern Gfx D_04011BD0; // Gold Deku Flower display list extern SkeletonHeader D_040127E8; // Gold Deku Flower skeleton extern UNK_TYPE D_04012860; extern UNK_TYPE D_040128BC; +extern u64 D_04014570[]; extern UNK_TYPE D_04015FA0; extern UNK_TYPE D_04016360; extern UNK_TYPE D_0401A4D0; @@ -3950,6 +3941,7 @@ extern AnimationHeader D_0405140C; extern UNK_TYPE D_040527F0; extern UNK_TYPE D_040528B0; extern Gfx D_04054A90[]; +extern u64 D_04054F20[]; extern UNK_TYPE D_04055628; extern Gfx D_04057B10[]; extern Gfx D_04058BA0[]; diff --git a/include/z64effect.h b/include/z64effect.h index adb6907324..b095c89e90 100644 --- a/include/z64effect.h +++ b/include/z64effect.h @@ -10,14 +10,6 @@ struct GraphicsContext; struct GlobalContext; -typedef void(*eff_destroy_func)(void* params); - -typedef void(*eff_draw_func)(void* params, struct GraphicsContext* gfxCtx); - -typedef void(*eff_init_func)(void* params, void* init); - -typedef s32(*eff_update_func)(void* params); - #define SPARK_COUNT 3 #define BLURE_COUNT 25 #define SHIELD_PARTICLE_COUNT 3 @@ -41,37 +33,45 @@ typedef s32(*eff_update_func)(void* params); #define rgObjBankIdx regs[11] typedef struct { - /* 0x0 */ u8 active; - /* 0x1 */ u8 unk1; - /* 0x2 */ u8 unk2; - /* 0x3 */ UNK_TYPE1 pad3[0x1]; -} EffCommon; // size = 0x4 + /* 0x00 */ u8 active; + /* 0x01 */ u8 unk1; + /* 0x02 */ u8 unk2; +} EffectStatus; // size = 0x03 typedef struct { /* 0x00 */ Vec3f velocity; /* 0x0C */ Vec3f position; - /* 0x18 */ Vec3s unk18; - /* 0x1E */ Vec3s unk1E; -} EffSparkParticle; // size = 0x24 + /* 0x18 */ Vec3s unkVelocity; + /* 0x1E */ Vec3s unkPosition; +} EffectSparkElement; // size = 0x24 typedef struct { /* 0x000 */ Vec3s position; - /* 0x008 */ s32 numParticles; // Will be calculated as particleFactor1 * particleFactor2 + 2 - /* 0x00C */ EffSparkParticle particles[32]; - /* 0x48C */ f32 velocity; + /* 0x008 */ s32 numElements; // "table_size"; calculated as uDiv * vDiv + 2 + /* 0x00C */ EffectSparkElement elements[32]; + /* 0x48C */ f32 speed; /* 0x490 */ f32 gravity; - /* 0x494 */ u32 particleFactor1; - /* 0x498 */ u32 particleFactor2; + /* 0x494 */ u32 uDiv; // "u_div" + /* 0x498 */ u32 vDiv; // "v_div" /* 0x49C */ Color_RGBA8 colorStart[4]; /* 0x4AC */ Color_RGBA8 colorEnd[4]; - /* 0x4BC */ s32 age; + /* 0x4BC */ s32 timer; /* 0x4C0 */ s32 duration; -} EffSparkParams; // size = 0x4C4 +} EffectSparkInit; // size = 0x4C4 typedef struct { - /* 0x000 */ EffCommon base; - /* 0x004 */ EffSparkParams params; -} EffSpark; // size = 0x4C8 + /* 0x000 */ Vec3s position; + /* 0x008 */ s32 numElements; // "table_size"; calculated as uDiv * vDiv + 2 + /* 0x00C */ EffectSparkElement elements[32]; + /* 0x48C */ f32 speed; + /* 0x490 */ f32 gravity; + /* 0x494 */ u32 uDiv; // "u_div" + /* 0x498 */ u32 vDiv; // "v_div" + /* 0x49C */ Color_RGBA8 colorStart[4]; + /* 0x4AC */ Color_RGBA8 colorEnd[4]; + /* 0x4BC */ s32 timer; + /* 0x4C0 */ s32 duration; +} EffectSpark; // size = 0x4C4 typedef struct { /* 0x00 */ s32 state; @@ -82,13 +82,15 @@ typedef struct { } EffectBlureElement; // size = 0x18 typedef struct { - /* 0x000 */ UNK_TYPE1 pad0[0x184]; - /* 0x184 */ Color_RGBA8 unk184; - /* 0x188 */ Color_RGBA8 unk188; - /* 0x18C */ Color_RGBA8 unk18C; - /* 0x190 */ Color_RGBA8 unk190; - /* 0x194 */ UNK_TYPE1 pad194[0xC]; -} EffBlureInit1; // size = 0x1A0 + /* 0x000 */ char unk_00[0x184]; + /* 0x184 */ u8 p1StartColor[4]; + /* 0x188 */ u8 p2StartColor[4]; + /* 0x18C */ u8 p1EndColor[4]; + /* 0x190 */ u8 p2EndColor[4]; + /* 0x194 */ s32 elemDuration; + /* 0x198 */ s32 unkFlag; + /* 0x19C */ s32 calcMode; +} EffectBlureInit1; // size = 0x1A0 typedef struct { /* 0x00 */ s32 calcMode; @@ -104,7 +106,7 @@ typedef struct { /* 0x1B */ u8 mode4Param; /* 0x1C */ Color_RGBA8 altPrimColor; // used with drawMode 1 /* 0x20 */ Color_RGBA8 altEnvColor; // used with drawMode 1 -} EffBlureInit2; // size = 0x24 +} EffectBlureInit2; // size = 0x24 typedef struct { /* 0x000 */ EffectBlureElement elements[16]; @@ -117,31 +119,26 @@ typedef struct { /* 0x192 */ Color_RGBA8 p2StartColor; /* 0x196 */ Color_RGBA8 p1EndColor; /* 0x19A */ Color_RGBA8 p2EndColor; - /* 0x19E */ u8 numElements; + /* 0x19E */ u8 numElements; // "now_edge_num" /* 0x19F */ u8 elemDuration; /* 0x1A0 */ u8 unkFlag; /* 0x1A1 */ u8 drawMode; // 0: simple; 1: simple with alt colors; 2+: smooth - /* 0x1A2 */ Color_RGBA8 altPrimColor; - /* 0x1A6 */ Color_RGBA8 altEnvColor; + /* 0x1A2 */ Color_RGBA8 altPrimColor; // used with drawMode 1 + /* 0x1A6 */ Color_RGBA8 altEnvColor; // used with drawMode 1 } EffectBlure; // size = 0x1AC typedef struct { - /* 0x000 */ EffCommon base; - /* 0x004 */ EffectBlure params; -} EffBlure; // size = 0x1B0 - -typedef struct { - /* 0x00 */ f32 startSpeed; + /* 0x00 */ f32 initialSpeed; /* 0x04 */ f32 endXChange; /* 0x08 */ f32 endX; /* 0x0C */ f32 startXChange; /* 0x10 */ f32 startX; - /* 0x14 */ s16 rotationY; - /* 0x16 */ s16 rotationZ; -} EffShieldParticleParticle; // size = 0x18 + /* 0x14 */ s16 yaw; + /* 0x16 */ s16 pitch; +} EffectShieldParticleElement; // size = 0x18 typedef struct { - /* 0x00 */ u8 numParticles; + /* 0x00 */ u8 numElements; /* 0x02 */ Vec3s position; /* 0x08 */ Color_RGBA8 primColorStart; /* 0x0C */ Color_RGBA8 envColorStart; @@ -149,18 +146,17 @@ typedef struct { /* 0x14 */ Color_RGBA8 envColorMid; /* 0x18 */ Color_RGBA8 primColorEnd; /* 0x1C */ Color_RGBA8 envColorEnd; - /* 0x20 */ f32 acceleration; + /* 0x20 */ f32 deceleration; /* 0x24 */ f32 maxInitialSpeed; /* 0x28 */ f32 lengthCutoff; /* 0x2C */ u8 duration; /* 0x2E */ LightPoint lightPoint; - /* 0x3C */ s32 hasLight; -} EffShieldParticleInit; // size = 0x40 + /* 0x3C */ s32 lightDecay; // halves light radius every frame when set to 1 +} EffectShieldParticleInit; // size = 0x40 typedef struct { - /* 0x000 */ EffShieldParticleParticle particles[16]; - /* 0x180 */ u8 numParticles; - /* 0x181 */ UNK_TYPE1 pad181[0x1]; + /* 0x000 */ EffectShieldParticleElement elements[16]; + /* 0x180 */ u8 numElements; /* 0x182 */ Vec3s position; /* 0x188 */ Color_RGBA8 primColorStart; /* 0x18C */ Color_RGBA8 envColorStart; @@ -168,66 +164,75 @@ typedef struct { /* 0x194 */ Color_RGBA8 envColorMid; /* 0x198 */ Color_RGBA8 primColorEnd; /* 0x19C */ Color_RGBA8 envColorEnd; - /* 0x1A0 */ f32 acceleration; - /* 0x1A4 */ UNK_TYPE1 pad1A4[0x4]; + /* 0x1A0 */ f32 deceleration; + /* 0x1A4 */ char unk_1A4[0x04]; /* 0x1A8 */ f32 maxInitialSpeed; /* 0x1AC */ f32 lengthCutoff; /* 0x1B0 */ u8 duration; - /* 0x1B1 */ u8 age; + /* 0x1B1 */ u8 timer; /* 0x1B2 */ LightInfo lightInfo; - /* 0x1C0 */ LightNode* light; - /* 0x1C4 */ s32 hasLight; -} EffShieldParticleParams; // size = 0x1C8 + /* 0x1C0 */ LightNode* lightNode; + /* 0x1C4 */ s32 lightDecay; // halves light radius every frame when set to 1 +} EffectShieldParticle; // size = 0x1C8 typedef struct { - /* 0x000 */ EffCommon base; - /* 0x004 */ EffShieldParticleParams params; -} EffShieldParticle; // size = 0x1CC - -typedef struct { - /* 0x00 */ UNK_TYPE2 active; - /* 0x02 */ Vec3s position1; - /* 0x08 */ Vec3s position2; + /* 0x00 */ u16 flags; + /* 0x02 */ Vec3s p1; + /* 0x08 */ Vec3s p2; /* 0x0E */ s16 life; /* 0x10 */ UNK_TYPE1 pad10[0x4]; - /* 0x14 */ UNK_TYPE4 unk14; -} EffTireMarkParticle; // size = 0x18 + /* 0x14 */ CollisionPoly* colPoly; +} EffectTireMarkElement; // size = 0x18 typedef struct { /* 0x0 */ s16 unk0; - /* 0x2 */ s16 maxLife; + /* 0x2 */ s16 elemDuration; /* 0x4 */ Color_RGBA8 color; -} EffTireMarkInit; // size = 0x8 +} EffectTireMarkInit; // size = 0x8 typedef struct { - /* 0x000 */ EffTireMarkParticle particles[64]; + /* 0x000 */ EffectTireMarkElement elements[64]; /* 0x600 */ s16 unk600; - /* 0x602 */ s16 numParticles; - /* 0x604 */ s16 maxLife; + /* 0x602 */ s16 numElements; + /* 0x604 */ s16 elemDuration; /* 0x606 */ Color_RGBA8 color; - /* 0x60A */ UNK_TYPE1 pad60A[0x2]; -} EffTireMarkParams; // size = 0x60C - -typedef struct { - /* 0x000 */ EffCommon base; - /* 0x004 */ EffTireMarkParams params; -} EffTireMark; // size = 0x610 - -typedef struct { - /* 0x00 */ u32 paramsSize; - /* 0x04 */ eff_init_func init; - /* 0x08 */ eff_destroy_func destroy; - /* 0x0C */ eff_update_func update; - /* 0x10 */ eff_draw_func draw; -} EffInfo; // size = 0x14 +} EffectTireMark; // size = 0x60C typedef struct { /* 0x0000 */ struct GlobalContext* globalCtx; - /* 0x0004 */ EffSpark sparks[SPARK_COUNT]; - /* 0x0E5C */ EffBlure blures[BLURE_COUNT]; - /* 0x388C */ EffShieldParticle shieldParticles[SHIELD_PARTICLE_COUNT]; - /* 0x3DF0 */ EffTireMark tireMarks[TIRE_MARK_COUNT]; -} EffTables; // size = 0x98E0 + struct { + EffectStatus status; + EffectSpark effect; + } /* 0x0004 */ sparks[SPARK_COUNT]; + struct { + EffectStatus status; + EffectBlure effect; + } /* 0x0E5C */ blures[BLURE_COUNT]; + struct { + EffectStatus status; + EffectShieldParticle effect; + } /* 0x388C */ shieldParticles[SHIELD_PARTICLE_COUNT]; + struct { + EffectStatus status; + EffectTireMark effect; + } /* 0x3DF0 */ tireMarks[TIRE_MARK_COUNT]; +} EffectContext; // size = 0x98E0 + +typedef struct { + /* 0x00 */ u32 size; + /* 0x04 */ void (*init)(void* effect, void* initParams); + /* 0x08 */ void (*destroy)(void* effect); + /* 0x0C */ s32 (*update)(void* effect); + /* 0x10 */ void (*draw)(void* effect, struct GraphicsContext* gfxCtx); +} EffectInfo; // size = 0x14 + +typedef enum { + /* 0x00 */ EFFECT_SPARK, + /* 0x01 */ EFFECT_BLURE1, + /* 0x02 */ EFFECT_BLURE2, + /* 0x03 */ EFFECT_SHIELD_PARTICLE, + /* 0x04 */ EFFECT_TIRE_MARK +} EffectType; /* Effect Soft Sprites */ diff --git a/include/z64math.h b/include/z64math.h index 3caad91083..dff6699766 100644 --- a/include/z64math.h +++ b/include/z64math.h @@ -85,9 +85,10 @@ typedef struct { /* 0x06 */ s16 yaw; // azimuthal angle } VecSph; // size = 0x08 -#define F32_LERP(v0,v1,t) ((1.0f - (t)) * (v0) + (t) * (v1)) -#define F32_LERPIMP(v0, v1, t) (v0 + ((v1 - v0) * t)) -#define F32_LERPIMPINV(v0, v1, t) ((v0) + (((v1) - (v0)) / (t))) +#define LERPIMP(v0, v1, t) ((v0) + (((v1) - (v0)) * (t))) +#define F32_LERP(v0, v1, t) ((1.0f - (t)) * (f32)(v0) + (t) * (f32)(v1)) +#define F32_LERPIMP(v0, v1, t) ((f32)(v0) + (((f32)(v1) - (f32)(v0)) * (t))) +#define F32_LERPIMPINV(v0, v1, t) ((f32)(v0) + (((f32)(v1) - (f32)(v0)) / (t))) #define BINANG_LERPIMP(v0, v1, t) ((v0) + (s16)(BINANG_SUB((v1), (v0)) * (t))) #define BINANG_LERPIMPINV(v0, v1, t) ((v0) + BINANG_SUB((v1), (v0)) / (t)) diff --git a/spec b/spec index c34bbe73b5..305663172a 100644 --- a/spec +++ b/spec @@ -430,19 +430,17 @@ beginseg include "build/data/code/code_801E3FA0.bss.o" include "build/src/code/z_en_item00.o" include "build/src/code/z_eff_blure.o" - include "build/data/code/z_eff_blure.data.o" include "build/src/code/z_eff_shield_particle.o" - include "build/data/code/z_eff_shield_particle.data.o" include "build/src/code/z_eff_spark.o" include "build/src/code/z_eff_ss_dead.o" include "build/src/code/z_eff_tire_mark.o" include "build/src/code/z_effect.o" - include "build/data/code/z_effect.bss.o" include "build/src/code/z_effect_soft_sprite.o" include "build/data/code/z_effect_soft_sprite.data.o" include "build/src/code/z_effect_soft_sprite_old_init.o" include "build/data/code/z_effect_soft_sprite_old_init.data.o" include "build/src/code/flg_set.o" + include "build/data/code/flg_set.bss.o" include "build/src/code/pad_801DC9C0.o" include "build/src/code/z_DLF.o" include "build/src/code/z_actor.o" diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index e11e6cbd74..44885d6c77 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -27,12 +27,12 @@ Vec3f D_801EE1C0; Vec3f D_801EE1D0; Vec3f D_801EE1E0; Vec3f D_801EE1F0; -EffSparkParams D_801EE200; +EffectSparkInit D_801EE200; TriNorm D_801EE6C8; TriNorm D_801EE700; -EffSparkParams D_801EE738; -EffSparkParams D_801EEC00; -EffSparkParams D_801EF0C8; +EffectSparkInit D_801EE738; +EffectSparkInit D_801EEC00; +EffectSparkInit D_801EF0C8; TriNorm D_801EF590; TriNorm D_801EF5C8; TriNorm D_801EF600; @@ -1382,14 +1382,14 @@ void CollisionCheck_NoBlood(GlobalContext* globalCtx, Collider* collider, Vec3f* #ifdef NON_MATCHING // needs in-function static bss void CollisionCheck_BlueBlood(GlobalContext* globalCtx, Collider* collider, Vec3f* v) { - static EffSparkParams D_801EEC00; + static EffectSparkInit D_801EEC00; s32 effectIndex; D_801EEC00.position.x = v->x; D_801EEC00.position.x = v->y; D_801EEC00.position.x = v->z; - D_801EEC00.particleFactor1 = 5; - D_801EEC00.particleFactor2 = 5; + D_801EEC00.uDiv = 5; + D_801EEC00.vDiv = 5; D_801EEC00.colorStart[0].r = 10; D_801EEC00.colorStart[0].g = 10; D_801EEC00.colorStart[0].b = 200; @@ -1422,12 +1422,12 @@ void CollisionCheck_BlueBlood(GlobalContext* globalCtx, Collider* collider, Vec3 D_801EEC00.colorEnd[3].g = 0; D_801EEC00.colorEnd[3].b = 64; D_801EEC00.colorEnd[3].a = 0; - D_801EEC00.age = 0; + D_801EEC00.timer = 0; D_801EEC00.duration = 16; - D_801EEC00.velocity = 8.0f; + D_801EEC00.speed = 8.0f; D_801EEC00.gravity = -1.0f; - Effect_Add(globalCtx, &effectIndex, 0, 0, 1, &D_801EEC00); + Effect_Add(globalCtx, &effectIndex, EFFECT_SPARK, 0, 1, &D_801EEC00); } #else #pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/CollisionCheck_BlueBlood.s") @@ -1440,14 +1440,14 @@ void CollisionCheck_BlueBlood(GlobalContext* globalCtx, Collider* collider, Vec3 #ifdef NON_MATCHING // needs in-function static bss void CollisionCheck_GreenBlood(GlobalContext* globalCtx, Collider* collider, Vec3f* v) { - static EffSparkParams D_801EF0C8; + static EffectSparkInit D_801EF0C8; s32 effectIndex; D_801EF0C8.position.x = v->x; D_801EF0C8.position.x = v->y; D_801EF0C8.position.x = v->z; - D_801EF0C8.particleFactor1 = 5; - D_801EF0C8.particleFactor2 = 5; + D_801EF0C8.uDiv = 5; + D_801EF0C8.vDiv = 5; D_801EF0C8.colorStart[0].r = 10; D_801EF0C8.colorStart[0].g = 200; D_801EF0C8.colorStart[0].b = 10; @@ -1480,11 +1480,11 @@ void CollisionCheck_GreenBlood(GlobalContext* globalCtx, Collider* collider, Vec D_801EF0C8.colorEnd[3].g = 64; D_801EF0C8.colorEnd[3].b = 0; D_801EF0C8.colorEnd[3].a = 0; - D_801EF0C8.age = 0; + D_801EF0C8.timer = 0; D_801EF0C8.duration = 16; - D_801EF0C8.velocity = 8.0f; + D_801EF0C8.speed = 8.0f; D_801EF0C8.gravity = -1.0f; - Effect_Add(globalCtx, &effectIndex, 0, 0, 1, &D_801EF0C8); + Effect_Add(globalCtx, &effectIndex, EFFECT_SPARK, 0, 1, &D_801EF0C8); } #else #pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/CollisionCheck_GreenBlood.s") @@ -3751,14 +3751,14 @@ void Collider_UpdateSphere(s32 limb, ColliderSphere* collider) { #ifdef NON_MATCHING // needs in-function static bss void CollisionCheck_SpawnRedBlood(GlobalContext* globalCtx, Vec3f* v) { - static EffSparkParams D_801EE200; + static EffectSparkInit D_801EE200; s32 effectIndex; D_801EE200.position.x = v->x; D_801EE200.position.x = v->y; D_801EE200.position.x = v->z; - D_801EE200.particleFactor1 = 5; - D_801EE200.particleFactor2 = 5; + D_801EE200.uDiv = 5; + D_801EE200.vDiv = 5; D_801EE200.colorStart[0].r = 128; D_801EE200.colorStart[0].g = 0; D_801EE200.colorStart[0].b = 64; @@ -3791,12 +3791,12 @@ void CollisionCheck_SpawnRedBlood(GlobalContext* globalCtx, Vec3f* v) { D_801EE200.colorEnd[3].g = 0; D_801EE200.colorEnd[3].b = 64; D_801EE200.colorEnd[3].a = 0; - D_801EE200.age = 0; + D_801EE200.timer = 0; D_801EE200.duration = 16; - D_801EE200.velocity = 8.0f; + D_801EE200.speed = 8.0f; D_801EE200.gravity = -1.0f; - Effect_Add(globalCtx, &effectIndex, 0, 0, 1, &D_801EE200); + Effect_Add(globalCtx, &effectIndex, EFFECT_SPARK, 0, 1, &D_801EE200); } #else #pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/CollisionCheck_SpawnRedBlood.s") @@ -3809,14 +3809,14 @@ void CollisionCheck_SpawnRedBlood(GlobalContext* globalCtx, Vec3f* v) { #ifdef NON_MATCHING // needs in-function static bss void CollisionCheck_SpawnWaterDroplets(GlobalContext* globalCtx, Vec3f* v) { - static EffSparkParams D_801EE738; + static EffectSparkInit D_801EE738; s32 effectIndex; D_801EE738.position.x = v->x; D_801EE738.position.x = v->y; D_801EE738.position.x = v->z; - D_801EE738.particleFactor1 = 5; - D_801EE738.particleFactor2 = 5; + D_801EE738.uDiv = 5; + D_801EE738.vDiv = 5; D_801EE738.colorStart[0].r = 255; D_801EE738.colorStart[0].g = 255; D_801EE738.colorStart[0].b = 255; @@ -3849,12 +3849,12 @@ void CollisionCheck_SpawnWaterDroplets(GlobalContext* globalCtx, Vec3f* v) { D_801EE738.colorEnd[3].g = 0; D_801EE738.colorEnd[3].b = 0; D_801EE738.colorEnd[3].a = 0; - D_801EE738.age = 0; + D_801EE738.timer = 0; D_801EE738.duration = 16; - D_801EE738.velocity = 8.0f; + D_801EE738.speed = 8.0f; D_801EE738.gravity = -1.0f; - Effect_Add(globalCtx, &effectIndex, 0, 0, 1, &D_801EE738); + Effect_Add(globalCtx, &effectIndex, EFFECT_SPARK, 0, 1, &D_801EE738); } #else #pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/CollisionCheck_SpawnWaterDroplets.s") @@ -3864,7 +3864,7 @@ void CollisionCheck_SpawnWaterDroplets(GlobalContext* globalCtx, Vec3f* v) { * Spawns streaks of light from hits against solid objects */ void CollisionCheck_SpawnShieldParticles(GlobalContext* globalCtx, Vec3f* v) { - static EffShieldParticleInit shieldParticleInitMetal = { + static EffectShieldParticleInit shieldParticleInitMetal = { 16, { 0, 0, 0 }, { 0, 200, 255, 255 }, @@ -3889,7 +3889,7 @@ void CollisionCheck_SpawnShieldParticles(GlobalContext* globalCtx, Vec3f* v) { shieldParticleInitMetal.lightPoint.y = shieldParticleInitMetal.position.y; shieldParticleInitMetal.lightPoint.z = shieldParticleInitMetal.position.z; - Effect_Add(globalCtx, &effectIndex, 3, 0, 1, &shieldParticleInitMetal); + Effect_Add(globalCtx, &effectIndex, EFFECT_SHIELD_PARTICLE, 0, 1, &shieldParticleInitMetal); } /** @@ -3919,7 +3919,7 @@ void CollisionCheck_SpawnShieldParticlesMetal2(GlobalContext* globalCtx, Vec3f* * Spawns streaks of light and makes a wooden sound */ void CollisionCheck_SpawnShieldParticlesWood(GlobalContext* globalCtx, Vec3f* v, Vec3f* pos) { - static EffShieldParticleInit shieldParticleInitWood = { + static EffectShieldParticleInit shieldParticleInitWood = { 16, { 0, 0, 0 }, { 0, 200, 255, 255 }, @@ -3944,7 +3944,7 @@ void CollisionCheck_SpawnShieldParticlesWood(GlobalContext* globalCtx, Vec3f* v, shieldParticleInitWood.lightPoint.y = shieldParticleInitWood.position.y; shieldParticleInitWood.lightPoint.z = shieldParticleInitWood.position.z; - Effect_Add(globalCtx, &effectIndex, 3, 0, 1, &shieldParticleInitWood); + Effect_Add(globalCtx, &effectIndex, EFFECT_SHIELD_PARTICLE, 0, 1, &shieldParticleInitWood); func_8019F1C0(pos, NA_SE_IT_REFLECTION_WOOD); } diff --git a/src/code/z_eff_blure.c b/src/code/z_eff_blure.c index 17685de15d..5c890dd8d4 100644 --- a/src/code/z_eff_blure.c +++ b/src/code/z_eff_blure.c @@ -1,27 +1,18 @@ #include "global.h" -#ifdef NON_MATCHING -void func_800A81F0(EffectBlure* this, Vec3f* p1, Vec3f* p2) { +void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2) { EffectBlureElement* elem; s32 numElements; - Vec3f sp16C; - Vec3f sp160; - Vec3f sp154; - f32 scale; - MtxF sp110; - MtxF spD0; - MtxF sp90; - MtxF sp50; - Vec3f sp44; - Vec3f sp38; + + if (this) {} + if (this) {} if (this != NULL) { - numElements = this->numElements; - if (numElements >= 16) { + if (this->numElements >= ARRAY_COUNT(this->elements)) { return; } - elem = &this->elements[numElements]; + elem = &this->elements[this->numElements]; elem->state = 1; if (!(this->flags & 2)) { @@ -32,6 +23,17 @@ void func_800A81F0(EffectBlure* this, Vec3f* p1, Vec3f* p2) { elem->p2.y = p2->y; elem->p2.z = p2->z; } else { + Vec3f sp16C; + Vec3f sp160; + Vec3f sp154; + f32 scale; + MtxF sp110; + MtxF spD0; + MtxF sp90; + MtxF sp50; + Vec3f sp44; + Vec3f sp38; + sp16C.x = ((f32)(elem - 1)->p2.x + (f32)(elem - 1)->p1.x) * 0.5f; sp16C.y = ((f32)(elem - 1)->p2.y + (f32)(elem - 1)->p1.y) * 0.5f; sp16C.z = ((f32)(elem - 1)->p2.z + (f32)(elem - 1)->p1.z) * 0.5f; @@ -41,7 +43,7 @@ void func_800A81F0(EffectBlure* this, Vec3f* p1, Vec3f* p2) { Math_Vec3f_Diff(&sp160, &sp16C, &sp154); scale = Math3D_Vec3fMagnitude(&sp154); - if (!(fabsf(scale) < D_801DC080)) { + if (!(fabsf(scale) < 0.008f)) { scale = 1.0f / scale; Math_Vec3f_Scale(&sp154, scale); @@ -66,40 +68,977 @@ void func_800A81F0(EffectBlure* this, Vec3f* p1, Vec3f* p2) { this->numElements++; } } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_800A81F0.s") -#endif -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_800A8514.s") +void EffectBlure_AddSpace(EffectBlure* this) { + EffectBlureElement* elem; + s32 numElements; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/EffectBlure_Initcommon.s") + if (this != NULL) { + numElements = this->numElements; + if (numElements >= ARRAY_COUNT(this->elements)) { + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/EffectBlure_Init1.s") + elem = &this->elements[numElements]; + elem->state = 0; + elem->timer = 1; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/EffectBlure_Init2.s") + this->numElements++; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/EffectBlure_Destroy.s") +void EffectBlure_InitElements(EffectBlure* this) { + EffectBlureElement* elem; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/EffectBlure_Update.s") + this->numElements = 0; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_800A8C78.s") + for (i = 0; i < ARRAY_COUNT(this->elements); i++) { + elem = &this->elements[i]; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_800A8DE8.s") + elem->state = 2; + elem->p1.x = 0; + elem->p1.y = 0; + elem->p1.z = 0; + elem->p2.x = 0; + elem->p2.y = 0; + elem->p2.z = 0; + elem->timer = 0; + elem->flags = 0; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_800A92FC.s") +void EffectBlure_Init1(void* thisx, void* initParamsx) { + EffectBlure* this = (EffectBlure*)thisx; + EffectBlureInit1* initParams = (EffectBlureInit1*)initParamsx; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_800A9330.s") + if ((this != NULL) && (initParams != NULL)) { + EffectBlure_InitElements(this); + this->p1StartColor.r = initParams->p1StartColor[0]; + this->p2StartColor.r = initParams->p2StartColor[0]; + this->p1EndColor.r = initParams->p1EndColor[0]; + this->p2EndColor.r = initParams->p2EndColor[0]; + this->p1StartColor.g = initParams->p1StartColor[1]; + this->p2StartColor.g = initParams->p2StartColor[1]; + this->p1EndColor.g = initParams->p1EndColor[1]; + this->p2EndColor.g = initParams->p2EndColor[1]; + this->p1StartColor.b = initParams->p1StartColor[2]; + this->p2StartColor.b = initParams->p2StartColor[2]; + this->p1EndColor.b = initParams->p1EndColor[2]; + this->p2EndColor.b = initParams->p2EndColor[2]; + this->p1StartColor.a = initParams->p1StartColor[3]; + this->p2StartColor.a = initParams->p2StartColor[3]; + this->p1EndColor.a = initParams->p1EndColor[3]; + this->p2EndColor.a = initParams->p2EndColor[3]; + this->elemDuration = initParams->elemDuration; + this->unkFlag = initParams->unkFlag; + this->calcMode = initParams->calcMode; + this->flags = 0; + this->addAngleChange = 0; + this->addAngle = 0; + this->drawMode = 0; + this->altPrimColor.r = 0; + this->altPrimColor.g = 0; + this->altPrimColor.b = 0; + this->altPrimColor.a = 0; + this->altEnvColor.r = 0; + this->altEnvColor.g = 0; + this->altEnvColor.b = 0; + this->altEnvColor.a = 0; + this->mode4Param = 1.0f; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_800A9804.s") +void EffectBlure_Init2(void* thisx, void* initParamsx) { + EffectBlure* this = (EffectBlure*)thisx; + EffectBlureInit2* initParams = (EffectBlureInit2*)initParamsx; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_800AA190.s") + if ((this != NULL) && (initParams != NULL)) { + EffectBlure_InitElements(this); + this->p1StartColor.r = initParams->p1StartColor[0]; + this->p2StartColor.r = initParams->p2StartColor[0]; + this->p1EndColor.r = initParams->p1EndColor[0]; + this->p2EndColor.r = initParams->p2EndColor[0]; + this->p1StartColor.g = initParams->p1StartColor[1]; + this->p2StartColor.g = initParams->p2StartColor[1]; + this->p1EndColor.g = initParams->p1EndColor[1]; + this->p2EndColor.g = initParams->p2EndColor[1]; + this->p1StartColor.b = initParams->p1StartColor[2]; + this->p2StartColor.b = initParams->p2StartColor[2]; + this->p1EndColor.b = initParams->p1EndColor[2]; + this->p2EndColor.b = initParams->p2EndColor[2]; + this->p1StartColor.a = initParams->p1StartColor[3]; + this->p2StartColor.a = initParams->p2StartColor[3]; + this->p1EndColor.a = initParams->p1EndColor[3]; + this->p2EndColor.a = initParams->p2EndColor[3]; + this->elemDuration = initParams->elemDuration; + this->unkFlag = initParams->unkFlag; + this->calcMode = initParams->calcMode; + this->flags = initParams->flags; + this->drawMode = initParams->drawMode; + this->addAngleChange = initParams->addAngleChange; + this->addAngle = 0; + this->mode4Param = initParams->mode4Param; + this->altPrimColor = initParams->altPrimColor; + this->altEnvColor = initParams->altEnvColor; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_800AA460.s") +void EffectBlure_Destroy(void* thisx) { +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_800AA498.s") +s32 EffectBlure_Update(void* thisx) { + EffectBlure* this = (EffectBlure*)thisx; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_800AA700.s") + if (this == NULL) { + return 0; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_800AABE0.s") + if (this->numElements == 0) { + return 0; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/EffectBlure_Draw.s") + while (true) { + if (this->elements[0].state == 0) { + for (i = 0; i < ARRAY_COUNT(this->elements) - 1; i++) { + this->elements[i] = this->elements[i + 1]; + } + + this->elements[i].state = 2; + this->elements[i].p1.x = 0; + this->elements[i].p1.y = 0; + this->elements[i].p1.z = 0; + this->elements[i].p2.x = 0; + this->elements[i].p2.y = 0; + this->elements[i].p2.z = 0; + this->elements[i].flags = 0; + this->elements[i].timer = 0; + + this->numElements--; + if (this->numElements <= 0) { + this->numElements = 0; + return 0; + } + } else { + break; + } + } + + if (this->elements[0].state == 2) { + return 0; + } + + for (i = 0; i < this->numElements; i++) { + this->elements[i].timer++; + } + + if (this->elemDuration < this->elements[0].timer) { + for (i = 0; i < ARRAY_COUNT(this->elements) - 1; i++) { + this->elements[i] = this->elements[i + 1]; + if (this->elements[i].timer >= this->elemDuration) { + this->elements[i].timer = this->elemDuration; + } + } + + this->elements[i].state = 2; + this->elements[i].p1.x = 0; + this->elements[i].p1.y = 0; + this->elements[i].p1.z = 0; + this->elements[i].p2.x = 0; + this->elements[i].p2.y = 0; + this->elements[i].p2.z = 0; + this->elements[i].flags = 0; + this->elements[i].timer = 0; + + this->numElements--; + if (this->numElements <= 0) { + this->numElements = 0; + return 0; + } + return 0; + } + + for (i = 0; i < this->numElements; i++) { + if (this->elements[i].timer >= this->elemDuration) { + this->elements[i].timer = this->elemDuration; + } + } + + this->addAngle += this->addAngleChange; + return 0; +} + +void EffectBlure_UpdateFlags(EffectBlureElement* elem) { + Vec3f sp64; + Vec3f sp58; + Vec3f sp4C; + Vec3f sp40; + EffectBlureElement* prev = elem - 1; + EffectBlureElement* next = elem + 1; + f32 sp34; + f32 sp30; + f32 sp2C; + + if (((elem - 1)->state == 0) || ((elem + 1)->state == 0)) { + elem->flags &= ~3; + elem->flags |= 2; + } else { + Math_Vec3s_DiffToVec3f(&sp64, &elem->p1, &prev->p1); + Math_Vec3s_DiffToVec3f(&sp58, &elem->p2, &prev->p2); + Math_Vec3s_DiffToVec3f(&sp4C, &next->p1, &elem->p1); + Math_Vec3s_DiffToVec3f(&sp40, &next->p2, &elem->p2); + + if (Math3D_AngleBetweenVectors(&sp64, &sp4C, &sp34) || Math3D_AngleBetweenVectors(&sp58, &sp40, &sp30) || + Math3D_AngleBetweenVectors(&sp4C, &sp40, &sp2C)) { + elem->flags &= ~3; + elem->flags |= 0; + } else if ((sp34 <= -0.5f) || (sp30 <= -0.5f) || (sp2C <= 0.7071f)) { + elem->flags &= ~3; + elem->flags |= 0; + } else { + elem->flags &= ~3; + elem->flags |= 1; + } + } +} + +void EffectBlure_GetComputedValues(EffectBlure* this, s32 index, f32 ratio, Vec3s* vec1, Vec3s* vec2, + Color_RGBA8* color1, Color_RGBA8* color2) { + Vec3s sp30; + f32 mode4Param; + EffectBlureElement* elem = &this->elements[index]; + + switch (this->calcMode) { + case 1: + vec1->x = func_800B09D0(elem->p1.x, elem->p2.x, ratio); + vec1->y = func_800B09D0(elem->p1.y, elem->p2.y, ratio); + vec1->z = func_800B09D0(elem->p1.z, elem->p2.z, ratio); + vec2->x = elem->p2.x; + vec2->y = elem->p2.y; + vec2->z = elem->p2.z; + break; + + case 2: + vec1->x = elem->p1.x; + vec1->y = elem->p1.y; + vec1->z = elem->p1.z; + vec2->x = func_800B09D0(elem->p2.x, elem->p1.x, ratio); + vec2->y = func_800B09D0(elem->p2.y, elem->p1.y, ratio); + vec2->z = func_800B09D0(elem->p2.z, elem->p1.z, ratio); + break; + + case 3: + ratio *= 0.5f; + vec1->x = func_800B09D0(elem->p1.x, elem->p2.x, ratio); + vec1->y = func_800B09D0(elem->p1.y, elem->p2.y, ratio); + vec1->z = func_800B09D0(elem->p1.z, elem->p2.z, ratio); + vec2->x = func_800B09D0(elem->p2.x, elem->p1.x, ratio); + vec2->y = func_800B09D0(elem->p2.y, elem->p1.y, ratio); + vec2->z = func_800B09D0(elem->p2.z, elem->p1.z, ratio); + ratio *= 2.0f; + break; + + case 4: + sp30.x = elem->p1.x - elem->p2.x; + sp30.y = elem->p1.y - elem->p2.y; + sp30.z = elem->p1.z - elem->p2.z; + mode4Param = this->mode4Param - 1.0f; + + vec1->x = (sp30.x * 0.5f * mode4Param * ratio) + elem->p1.x; + vec1->y = (sp30.y * 0.5f * mode4Param * ratio) + elem->p1.y; + if (1) {} // Necessary to match + vec1->z = (sp30.z * 0.5f * mode4Param * ratio) + elem->p1.z; + + vec2->x = -(sp30.x * 0.5f * mode4Param * ratio) + elem->p2.x; + vec2->y = -(sp30.y * 0.5f * mode4Param * ratio) + elem->p2.y; + vec2->z = -(sp30.z * 0.5f * mode4Param * ratio) + elem->p2.z; + break; + + case 0: + default: + vec1->x = elem->p1.x; + vec1->y = elem->p1.y; + vec1->z = elem->p1.z; + vec2->x = elem->p2.x; + vec2->y = elem->p2.y; + vec2->z = elem->p2.z; + break; + } + + sp30 = sp30; // Optimized out but seems necessary to match stack usage + + if (this->flags & 0x10) { + color1->r = color1->g = color1->b = color1->a = 255; + color2->r = color2->g = color2->b = color2->a = 255; + } else { + color1->r = func_800B0A24(this->p1StartColor.r, this->p1EndColor.r, ratio); + color1->g = func_800B0A24(this->p1StartColor.g, this->p1EndColor.g, ratio); + color1->b = func_800B0A24(this->p1StartColor.b, this->p1EndColor.b, ratio); + color1->a = func_800B0A24(this->p1StartColor.a, this->p1EndColor.a, ratio); + color2->r = func_800B0A24(this->p2StartColor.r, this->p2EndColor.r, ratio); + color2->g = func_800B0A24(this->p2StartColor.g, this->p2EndColor.g, ratio); + color2->b = func_800B0A24(this->p2StartColor.b, this->p2EndColor.b, ratio); + color2->a = func_800B0A24(this->p2StartColor.a, this->p2EndColor.a, ratio); + } +} + +void EffectBlure_SetupSmooth(EffectBlure* this, GraphicsContext* gfxCtx) { + OPEN_DISPS(gfxCtx); + + POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x26); + + CLOSE_DISPS(gfxCtx); +} + +void EffectBlure_DrawElemNoInterpolation(EffectBlure* this, EffectBlureElement* elem, s32 index, + GraphicsContext* gfxCtx) { + static Vtx_t baseVtx = VTX_T(0, 0, 0, 0, 0, 255, 255, 255, 255); + Vtx* vtx; + Vec3s sp8C; + Vec3s sp84; + f32 ratio; + Color_RGBA8 sp7C; + Color_RGBA8 sp78; + Vec3f sp6C; + Vec3f sp60; + Vec3f sp54; + + OPEN_DISPS(gfxCtx); + + Math_Vec3s_ToVec3f(&sp6C, &this->elements[0].p2); + + vtx = GRAPH_ALLOC(gfxCtx, sizeof(Vtx[4])); + if (vtx == NULL) { + } else { + vtx[0].v = baseVtx; + vtx[1].v = baseVtx; + vtx[2].v = baseVtx; + vtx[3].v = baseVtx; + + ratio = (f32)elem->timer / (f32)this->elemDuration; + EffectBlure_GetComputedValues(this, index, ratio, &sp8C, &sp84, &sp7C, &sp78); + + sp60.x = sp84.x; + sp60.y = sp84.y; + sp60.z = sp84.z; + Math_Vec3f_Diff(&sp60, &sp6C, &sp54); + Math_Vec3f_Scale(&sp54, 10.0f); + vtx[0].v.ob[0] = sp54.x; + vtx[0].v.ob[1] = sp54.y; + vtx[0].v.ob[2] = sp54.z; + vtx[0].v.cn[0] = sp78.r; + vtx[0].v.cn[1] = sp78.g; + vtx[0].v.cn[2] = sp78.b; + vtx[0].v.cn[3] = sp78.a; + + sp60.x = sp8C.x; + sp60.y = sp8C.y; + sp60.z = sp8C.z; + Math_Vec3f_Diff(&sp60, &sp6C, &sp54); + Math_Vec3f_Scale(&sp54, 10.0f); + vtx[1].v.ob[0] = sp54.x; + vtx[1].v.ob[1] = sp54.y; + vtx[1].v.ob[2] = sp54.z; + vtx[1].v.cn[0] = sp7C.r; + vtx[1].v.cn[1] = sp7C.g; + vtx[1].v.cn[2] = sp7C.b; + vtx[1].v.cn[3] = sp7C.a; + + ratio = (f32)(elem + 1)->timer / (f32)this->elemDuration; + EffectBlure_GetComputedValues(this, index + 1, ratio, &sp8C, &sp84, &sp7C, &sp78); + + sp60.x = sp8C.x; + sp60.y = sp8C.y; + sp60.z = sp8C.z; + Math_Vec3f_Diff(&sp60, &sp6C, &sp54); + Math_Vec3f_Scale(&sp54, 10.0f); + vtx[2].v.ob[0] = sp54.x; + vtx[2].v.ob[1] = sp54.y; + vtx[2].v.ob[2] = sp54.z; + vtx[2].v.cn[0] = sp7C.r; + vtx[2].v.cn[1] = sp7C.g; + vtx[2].v.cn[2] = sp7C.b; + vtx[2].v.cn[3] = sp7C.a; + + sp60.x = sp84.x; + sp60.y = sp84.y; + sp60.z = sp84.z; + Math_Vec3f_Diff(&sp60, &sp6C, &sp54); + Math_Vec3f_Scale(&sp54, 10.0f); + vtx[3].v.ob[0] = sp54.x; + vtx[3].v.ob[1] = sp54.y; + vtx[3].v.ob[2] = sp54.z; + vtx[3].v.cn[0] = sp78.r; + vtx[3].v.cn[1] = sp78.g; + vtx[3].v.cn[2] = sp78.b; + vtx[3].v.cn[3] = sp78.a; + + gSPVertex(POLY_XLU_DISP++, vtx, 4, 0); + gSP2Triangles(POLY_XLU_DISP++, 0, 1, 2, 0, 0, 2, 3, 0); + } + + CLOSE_DISPS(gfxCtx); +} + +void EffectBlure_DrawElemHermiteInterpolation(EffectBlure* this, EffectBlureElement* elem, s32 index, + GraphicsContext* gfxCtx) { + static Vtx_t baseVtx = VTX_T(0, 0, 0, 0, 0, 255, 255, 255, 255); + Vtx* vtx; + Vec3s sp1EC; + Vec3s sp1E4; + f32 ratio; + Color_RGBA8 sp1DC; + Color_RGBA8 sp1D8; + Vec3f sp1CC; + Vec3f sp1C0; + Vec3f sp1B4; + Vec3f sp1A8; + Color_RGBA8 sp1A4; + Color_RGBA8 sp1A0; + Color_RGBA8 sp19C; + Color_RGBA8 sp198; + Vec3f sp18C; + Vec3f sp180; + Vec3f sp174; + Vec3f sp168; + s32 i; + Vec3f sp158; + Vec3f sp14C; + Color_RGBA8 sp148; + Color_RGBA8 sp144; + Vec3f sp138; + + OPEN_DISPS(gfxCtx); + + Math_Vec3s_ToVec3f(&sp138, &this->elements[0].p2); + + ratio = (f32)elem->timer / (f32)this->elemDuration; + EffectBlure_GetComputedValues(this, index, ratio, &sp1EC, &sp1E4, &sp1A4, &sp1A0); + Math_Vec3s_ToVec3f(&sp1CC, &sp1EC); + Math_Vec3s_ToVec3f(&sp1C0, &sp1E4); + + ratio = (f32)(elem + 1)->timer / (f32)this->elemDuration; + EffectBlure_GetComputedValues(this, index + 1, ratio, &sp1EC, &sp1E4, &sp19C, &sp198); + Math_Vec3s_ToVec3f(&sp18C, &sp1EC); + Math_Vec3s_ToVec3f(&sp180, &sp1E4); + + if ((elem->flags & 3) == 2) { + Math_Vec3f_Diff(&sp18C, &sp1CC, &sp1B4); + Math_Vec3f_Diff(&sp180, &sp1C0, &sp1A8); + } else { + Vec3f sp118; + Vec3f sp10C; + + ratio = (f32)(elem - 1)->timer / (f32)this->elemDuration; + EffectBlure_GetComputedValues(this, index - 1, ratio, &sp1EC, &sp1E4, &sp1DC, &sp1D8); + Math_Vec3s_ToVec3f(&sp118, &sp1EC); + Math_Vec3s_ToVec3f(&sp10C, &sp1E4); + Math_Vec3f_Diff(&sp18C, &sp118, &sp1B4); + Math_Vec3f_Diff(&sp180, &sp10C, &sp1A8); + } + + Math_Vec3f_Scale(&sp1B4, 0.5f); + Math_Vec3f_Scale(&sp1A8, 0.5f); + + if (((elem + 1)->flags & 3) == 2) { + Math_Vec3f_Diff(&sp18C, &sp1CC, &sp174); + Math_Vec3f_Diff(&sp180, &sp1C0, &sp168); + } else { + Vec3f sp100; + Vec3f spF4; + + ratio = (f32)(elem + 2)->timer / (f32)this->elemDuration; + EffectBlure_GetComputedValues(this, index + 2, ratio, &sp1EC, &sp1E4, &sp1DC, &sp1D8); + Math_Vec3s_ToVec3f(&sp100, &sp1EC); + Math_Vec3s_ToVec3f(&spF4, &sp1E4); + Math_Vec3f_Diff(&sp100, &sp1CC, &sp174); + Math_Vec3f_Diff(&spF4, &sp1C0, &sp168); + } + + Math_Vec3f_Scale(&sp174, 0.5f); + Math_Vec3f_Scale(&sp168, 0.5f); + + vtx = GRAPH_ALLOC(gfxCtx, sizeof(Vtx[16])); + if (vtx == NULL) { + } else { + Math_Vec3f_Diff(&sp1CC, &sp138, &sp158); + Math_Vec3f_Scale(&sp158, 10.0f); + Math_Vec3f_Diff(&sp1C0, &sp138, &sp14C); + Math_Vec3f_Scale(&sp14C, 10.0f); + + Color_RGBA8_Copy(&sp148, &sp1A4); + Color_RGBA8_Copy(&sp144, &sp1A0); + + vtx[0].v = baseVtx; + vtx[1].v = baseVtx; + + vtx[0].v.ob[0] = func_80086814(sp158.x); + vtx[0].v.ob[1] = func_80086814(sp158.y); + vtx[0].v.ob[2] = func_80086814(sp158.z); + vtx[0].v.cn[0] = sp148.r; + vtx[0].v.cn[1] = sp148.g; + vtx[0].v.cn[2] = sp148.b; + vtx[0].v.cn[3] = sp148.a; + vtx[1].v.ob[0] = func_80086814(sp14C.x); + vtx[1].v.ob[1] = func_80086814(sp14C.y); + vtx[1].v.ob[2] = func_80086814(sp14C.z); + vtx[1].v.cn[0] = sp144.r; + vtx[1].v.cn[1] = sp144.g; + vtx[1].v.cn[2] = sp144.b; + vtx[1].v.cn[3] = sp144.a; + + for (i = 1; i < 8; i++) { + s32 j1 = 2 * i; + s32 j2 = 2 * i + 1; + Vec3f spE0; + f32 temp_f28 = i / 7.0f; // t + f32 temp_f0 = SQ(temp_f28); // t^2 + f32 temp_f2 = temp_f0 * temp_f28; // t^3 + f32 temp_f20 = temp_f2 - temp_f0; // t^3 - t^2 + f32 temp_f22 = temp_f2 - 2.0f * temp_f0 + temp_f28; // t^3 - 2t^2 + t + f32 temp_f24 = 2.0f * temp_f2 - temp_f0 * 3.0f + 1.0f; // 2t^3 - 3t^2 + 1 + f32 temp_f26 = temp_f0 * 3.0f - 2.0f * temp_f2; // 3t^2 - 2t^3 + s32 pad1; + s32 pad2; + + // p = (2t^3 - 3t^2 + 1)p0 + (3t^2 - 2t^3)p1 + (t^3 - 2t^2 + t)m0 + (t^3 - t^2)m1 + spE0.x = (temp_f24 * sp1CC.x) + (temp_f26 * sp18C.x) + (temp_f22 * sp1B4.x) + (temp_f20 * sp174.x); + spE0.y = (temp_f24 * sp1CC.y) + (temp_f26 * sp18C.y) + (temp_f22 * sp1B4.y) + (temp_f20 * sp174.y); + spE0.z = (temp_f24 * sp1CC.z) + (temp_f26 * sp18C.z) + (temp_f22 * sp1B4.z) + (temp_f20 * sp174.z); + Math_Vec3f_Diff(&spE0, &sp138, &sp158); + Math_Vec3f_Scale(&sp158, 10.0f); + + spE0.x = (temp_f24 * sp1C0.x) + (temp_f26 * sp180.x) + (temp_f22 * sp1A8.x) + (temp_f20 * sp168.x); + spE0.y = (temp_f24 * sp1C0.y) + (temp_f26 * sp180.y) + (temp_f22 * sp1A8.y) + (temp_f20 * sp168.y); + spE0.z = (temp_f24 * sp1C0.z) + (temp_f26 * sp180.z) + (temp_f22 * sp1A8.z) + (temp_f20 * sp168.z); + Math_Vec3f_Diff(&spE0, &sp138, &sp14C); + Math_Vec3f_Scale(&sp14C, 10.0f); + + vtx[j1].v = baseVtx; + vtx[j2].v = baseVtx; + + vtx[j1].v.ob[0] = func_80086814(sp158.x); + vtx[j1].v.ob[1] = func_80086814(sp158.y); + vtx[j1].v.ob[2] = func_80086814(sp158.z); + vtx[j1].v.cn[0] = func_800B0A24(sp1A4.r, sp19C.r, temp_f28); + vtx[j1].v.cn[1] = func_800B0A24(sp1A4.g, sp19C.g, temp_f28); + vtx[j1].v.cn[2] = func_800B0A24(sp1A4.b, sp19C.b, temp_f28); + vtx[j1].v.cn[3] = func_800B0A24(sp1A4.a, sp19C.a, temp_f28); + + vtx[j2].v.ob[0] = func_80086814(sp14C.x); + vtx[j2].v.ob[1] = func_80086814(sp14C.y); + vtx[j2].v.ob[2] = func_80086814(sp14C.z); + vtx[j2].v.cn[0] = func_800B0A24(sp1A0.r, sp198.r, temp_f28); + vtx[j2].v.cn[1] = func_800B0A24(sp1A0.g, sp198.g, temp_f28); + vtx[j2].v.cn[2] = func_800B0A24(sp1A0.b, sp198.b, temp_f28); + vtx[j2].v.cn[3] = func_800B0A24(sp1A0.a, sp198.a, temp_f28); + } + + gSPVertex(POLY_XLU_DISP++, vtx, 16, 0); + gSP2Triangles(POLY_XLU_DISP++, 0, 1, 3, 0, 0, 3, 2, 0); + gSP2Triangles(POLY_XLU_DISP++, 2, 3, 5, 0, 2, 5, 4, 0); + gSP2Triangles(POLY_XLU_DISP++, 4, 5, 7, 0, 4, 7, 6, 0); + gSP2Triangles(POLY_XLU_DISP++, 6, 7, 9, 0, 6, 9, 8, 0); + gSP2Triangles(POLY_XLU_DISP++, 8, 9, 11, 0, 8, 11, 10, 0); + gSP2Triangles(POLY_XLU_DISP++, 10, 11, 13, 0, 10, 13, 12, 0); + gSP2Triangles(POLY_XLU_DISP++, 12, 13, 15, 0, 12, 15, 14, 0); + } + + CLOSE_DISPS(gfxCtx); +} + +void EffectBlure_DrawSmooth(EffectBlure* this2, GraphicsContext* gfxCtx) { + EffectBlure* this = this2; + EffectBlureElement* elem; + s32 i; + MtxF spDC; + MtxF sp9C; + MtxF sp5C; + Mtx* mtx; + + OPEN_DISPS(gfxCtx); + + if (this->numElements < 2) { + return; + } + + this->elements[0].flags &= ~3; + this->elements[0].flags |= 2; + + for (elem = &this->elements[1]; elem < this->elements + this->numElements - 1; elem++) { + EffectBlure_UpdateFlags(elem); + } + + this->elements[this->numElements - 1].flags &= ~3; + this->elements[this->numElements - 1].flags |= 2; + + EffectBlure_SetupSmooth(this, gfxCtx); + SkinMatrix_SetTranslate(&spDC, this->elements[0].p2.x, this->elements[0].p2.y, this->elements[0].p2.z); + SkinMatrix_SetScale(&sp9C, 0.1f, 0.1f, 0.1f); + SkinMatrix_MtxFMtxFMult(&spDC, &sp9C, &sp5C); + + mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &sp5C); + if (mtx == NULL) { + return; + } + + gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + for (i = 0, elem = &this->elements[0]; elem < this->elements + this->numElements - 1; i++, elem++) { + if ((elem->state == 0) || ((elem + 1)->state == 0)) { + continue; + } + if ((((elem->flags & 3) == 0) && (((elem + 1)->flags & 3) == 0)) || + (((elem->flags & 3) == 2) && (((elem + 1)->flags & 3) == 0)) || + (((elem->flags & 3) == 0) && (((elem + 1)->flags & 3) == 2)) || + (((elem->flags & 3) == 2) && (((elem + 1)->flags & 3) == 2))) { + EffectBlure_DrawElemNoInterpolation(this, elem, i, gfxCtx); + } else { + EffectBlure_DrawElemHermiteInterpolation(this, elem, i, gfxCtx); + } + } + + CLOSE_DISPS(gfxCtx); +} + +void EffectBlure_SetupSimple(GraphicsContext* gfxCtx, EffectBlure* this, Vtx* vtx) { + OPEN_DISPS(gfxCtx); + + POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x26); + + CLOSE_DISPS(gfxCtx); +} + +void EffectBlure_SetupSimpleAlt(GraphicsContext* gfxCtx, EffectBlure* this, Vtx* vtx) { + OPEN_DISPS(gfxCtx); + + gDPPipeSync(POLY_XLU_DISP++); + POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x26); + + gDPSetCycleType(POLY_XLU_DISP++, G_CYC_2CYCLE); + gDPSetTextureLUT(POLY_XLU_DISP++, G_TT_NONE); + gSPTexture(POLY_XLU_DISP++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); + + gDPLoadTextureBlock(POLY_XLU_DISP++, D_04014570, G_IM_FMT_I, G_IM_SIZ_8b, 64, 32, 0, G_TX_NOMIRROR | G_TX_CLAMP, + G_TX_NOMIRROR | G_TX_WRAP, 6, 5, G_TX_NOLOD, G_TX_NOLOD); + + gDPSetCombineLERP(POLY_XLU_DISP++, TEXEL0, PRIMITIVE, PRIM_LOD_FRAC, TEXEL0, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, + ENVIRONMENT, COMBINED, ENVIRONMENT, 0, 0, 0, COMBINED); + gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_ZB_CLD_SURF2); + gSPClearGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR); + gSPSetGeometryMode(POLY_XLU_DISP++, G_ZBUFFER | G_SHADE | G_SHADING_SMOOTH); + gDPPipeSync(POLY_XLU_DISP++); + + gDPSetEnvColor(POLY_XLU_DISP++, this->altEnvColor.r, this->altEnvColor.g, this->altEnvColor.b, this->altEnvColor.a); + + CLOSE_DISPS(gfxCtx); +} + +void (*sSetupHandlers[])(GraphicsContext* gfxCtx, EffectBlure* this, Vtx* vtx) = { + EffectBlure_SetupSimple, + EffectBlure_SetupSimpleAlt, +}; + +s32 D_801AE268 = 0; // unused + +void EffectBlure_DrawSimpleVertices(GraphicsContext* gfxCtx, EffectBlure* this, Vtx* vtx) { + Mtx* mtx; + + OPEN_DISPS(gfxCtx); + + sSetupHandlers[this->drawMode](gfxCtx, this, vtx); + gDPPipeSync(POLY_XLU_DISP++); + + { + Vec3f sp1B0; + Vec3f sp1A4; + Vec3f sp198; + f32 alphaRatio; + MtxF sp154; + MtxF sp114; + MtxF spD4; + MtxF sp94; + f32 scale; + s32 i; + s32 j; + + j = 0; + + for (i = 0; i < this->numElements - 1; i++) { + if (this->drawMode == 1) { + alphaRatio = (f32)this->elements[i].timer / (f32)this->elemDuration; + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, this->altPrimColor.r, this->altPrimColor.g, + this->altPrimColor.b, this->altPrimColor.a * (1.0f - alphaRatio)); + gDPPipeSync(POLY_XLU_DISP++); + } + + if (1) {} // Necessary to match + + gSPVertex(POLY_XLU_DISP++, &vtx[j], 4, 0); + gSP2Triangles(POLY_XLU_DISP++, 0, 1, 3, 0, 0, 3, 2, 0); + + if (this->flags & 4) { + sp1B0.x = ((f32)vtx[4 * i + 0].v.ob[0] + (f32)vtx[4 * i + 1].v.ob[0]) * 0.5f; + sp1B0.y = ((f32)vtx[4 * i + 0].v.ob[1] + (f32)vtx[4 * i + 1].v.ob[1]) * 0.5f; + sp1B0.z = ((f32)vtx[4 * i + 0].v.ob[2] + (f32)vtx[4 * i + 1].v.ob[2]) * 0.5f; + sp1A4.x = ((f32)vtx[4 * i + 2].v.ob[0] + (f32)vtx[4 * i + 3].v.ob[0]) * 0.5f; + sp1A4.y = ((f32)vtx[4 * i + 2].v.ob[1] + (f32)vtx[4 * i + 3].v.ob[1]) * 0.5f; + sp1A4.z = ((f32)vtx[4 * i + 2].v.ob[2] + (f32)vtx[4 * i + 3].v.ob[2]) * 0.5f; + + Math_Vec3f_Diff(&sp1A4, &sp1B0, &sp198); + scale = sqrtf(SQXYZ(sp198)); + + if (fabsf(scale) > 0.0005f) { + scale = 1.0f / scale; + Math_Vec3f_Scale(&sp198, scale); + + SkinMatrix_SetTranslate(&sp154, sp1B0.x, sp1B0.y, sp1B0.z); + SkinMatrix_SetRotateAroundVec(&sp114, 0x3FFF, sp198.x, sp198.y, sp198.z); + SkinMatrix_MtxFMtxFMult(&sp154, &sp114, &spD4); + SkinMatrix_SetTranslate(&sp154, -sp1B0.x, -sp1B0.y, -sp1B0.z); + SkinMatrix_MtxFMtxFMult(&spD4, &sp154, &sp94); + + mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &sp94); + if (mtx == NULL) { + break; + } + + gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPVertex(POLY_XLU_DISP++, &vtx[j], 4, 0); + gSP2Triangles(POLY_XLU_DISP++, 0, 1, 3, 0, 0, 3, 2, 0); + gSPMatrix(POLY_XLU_DISP++, &D_801D1DE0, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + } + } + + j += 4; + } + } + + CLOSE_DISPS(gfxCtx); +} + +Vtx_t D_801AE26C[] = { + VTX_T(0, 0, 0, 0, 1024, 255, 255, 255, 255), + VTX_T(0, 0, 0, 0, 0, 255, 255, 255, 255), + VTX_T(0, 0, 0, 2048, 1024, 255, 255, 255, 255), + VTX_T(0, 0, 0, 2048, 0, 255, 255, 255, 255), +}; + +Vtx_t D_801AE2AC[] = { + VTX_T(0, 0, 0, 2048, 1024, 255, 255, 255, 255), + VTX_T(0, 0, 0, 2048, 0, 255, 255, 255, 255), + VTX_T(0, 0, 0, 2048, 1024, 255, 255, 255, 255), + VTX_T(0, 0, 0, 2048, 0, 255, 255, 255, 255), +}; + +void EffectBlure_DrawSimple(EffectBlure* this2, GraphicsContext* gfxCtx) { + EffectBlure* this = this2; + Vtx* vtx; + Vtx* vtxIter; + EffectBlureElement* elem; + s32 vtxCount; + s32 i; + s32 j; + Vec3s sp74; + Vec3s sp6C; + f32 ratio; + Color_RGBA8 sp64; + Color_RGBA8 sp60; + + if (this->numElements >= 2) { + vtxCount = this->numElements * 4; + + vtx = GRAPH_ALLOC(gfxCtx, ALIGN16(vtxCount * sizeof(Vtx))); + if (vtx == NULL) { + return; + } + + vtxIter = vtx; + for (i = 0; i < 4; i++) { + vtxIter->v = D_801AE26C[i]; + vtxIter++; + } + + if (this->numElements >= 2) { + for (elem = this->elements; elem < this->elements + this->numElements - 2; elem++) { + for (i = 0; i < 4; i++) { + vtxIter->v = D_801AE2AC[i]; + vtxIter++; + } + } + } + + for (i = 0; i < this->numElements; i++) { + elem = &this->elements[i]; + + ratio = (f32)elem->timer / (f32)this->elemDuration; + EffectBlure_GetComputedValues(this, i, ratio, &sp74, &sp6C, &sp64, &sp60); + + j = i * 4 - 2; + if (j >= 0) { + vtx[j].v.ob[0] = sp74.x; + vtx[j].v.ob[1] = sp74.y; + vtx[j].v.ob[2] = sp74.z; + vtx[j].v.cn[0] = sp64.r; + vtx[j].v.cn[1] = sp64.g; + vtx[j].v.cn[2] = sp64.b; + vtx[j].v.cn[3] = sp64.a; + } + + j++; + if (j >= 0) { + vtx[j].v.ob[0] = sp6C.x; + vtx[j].v.ob[1] = sp6C.y; + vtx[j].v.ob[2] = sp6C.z; + vtx[j].v.cn[0] = sp60.r; + vtx[j].v.cn[1] = sp60.g; + vtx[j].v.cn[2] = sp60.b; + vtx[j].v.cn[3] = sp60.a; + } + + j++; + if (vtxCount >= j) { + vtx[j].v.ob[0] = sp74.x; + vtx[j].v.ob[1] = sp74.y; + vtx[j].v.ob[2] = sp74.z; + vtx[j].v.cn[0] = sp64.r; + vtx[j].v.cn[1] = sp64.g; + vtx[j].v.cn[2] = sp64.b; + vtx[j].v.cn[3] = sp64.a; + } + + j++; + if (vtxCount >= j) { + vtx[j].v.ob[0] = sp6C.x; + vtx[j].v.ob[1] = sp6C.y; + vtx[j].v.ob[2] = sp6C.z; + vtx[j].v.cn[0] = sp60.r; + vtx[j].v.cn[1] = sp60.g; + vtx[j].v.cn[2] = sp60.b; + vtx[j].v.cn[3] = sp60.a; + } + } + + EffectBlure_DrawSimpleVertices(gfxCtx, this, vtx); + } +} + +void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) { + EffectBlure* this = (EffectBlure*)thisx; + Vtx* vtx; + EffectBlureElement* elem; + s32 i; + s32 j; + s32 phi_t2; + + OPEN_DISPS(gfxCtx); + + gSPMatrix(POLY_XLU_DISP++, &D_801D1DE0, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + if (this->numElements != 0) { + if (this->flags == 0) { + func_8012C560(gfxCtx); + gDPPipeSync(POLY_XLU_DISP++); + + vtx = GRAPH_ALLOC(gfxCtx, sizeof(Vtx[32])); + if (vtx == NULL) { + } else { + j = 0; + for (i = 0; i < this->numElements; i++) { + elem = &this->elements[i]; + + if (elem->state == 1) { + f32 ratio = (f32)elem->timer / (f32)this->elemDuration; + + switch (this->calcMode) { + case 1: + vtx[j].v.ob[0] = func_800B09D0(elem->p1.x, elem->p2.x, ratio); + vtx[j].v.ob[1] = func_800B09D0(elem->p1.y, elem->p2.y, ratio); + vtx[j].v.ob[2] = func_800B09D0(elem->p1.z, elem->p2.z, ratio); + vtx[j + 1].v.ob[0] = elem->p2.x; + vtx[j + 1].v.ob[1] = elem->p2.y; + vtx[j + 1].v.ob[2] = elem->p2.z; + break; + case 2: + vtx[j].v.ob[0] = elem->p1.x; + vtx[j].v.ob[1] = elem->p1.y; + vtx[j].v.ob[2] = elem->p1.z; + vtx[j + 1].v.ob[0] = func_800B09D0(elem->p2.x, elem->p1.x, ratio); + vtx[j + 1].v.ob[1] = func_800B09D0(elem->p2.y, elem->p1.y, ratio); + vtx[j + 1].v.ob[2] = func_800B09D0(elem->p2.z, elem->p1.z, ratio); + break; + case 3: + ratio *= 0.5f; + vtx[j].v.ob[0] = func_800B09D0(elem->p1.x, elem->p2.x, ratio); + vtx[j].v.ob[1] = func_800B09D0(elem->p1.y, elem->p2.y, ratio); + vtx[j].v.ob[2] = func_800B09D0(elem->p1.z, elem->p2.z, ratio); + vtx[j + 1].v.ob[0] = func_800B09D0(elem->p2.x, elem->p1.x, ratio); + vtx[j + 1].v.ob[1] = func_800B09D0(elem->p2.y, elem->p1.y, ratio); + vtx[j + 1].v.ob[2] = func_800B09D0(elem->p2.z, elem->p1.z, ratio); + ratio *= 2.0f; + break; + case 0: + default: + vtx[j].v.ob[0] = elem->p1.x; + vtx[j].v.ob[1] = elem->p1.y; + vtx[j].v.ob[2] = elem->p1.z; + vtx[j + 1].v.ob[0] = elem->p2.x; + vtx[j + 1].v.ob[1] = elem->p2.y; + vtx[j + 1].v.ob[2] = elem->p2.z; + break; + } + + vtx[j].v.flag = 0; + vtx[j].v.tc[0] = 0; + vtx[j].v.tc[1] = 0; + vtx[j].v.cn[0] = func_800B0A24(this->p1StartColor.r, this->p1EndColor.r, ratio); + vtx[j].v.cn[1] = func_800B0A24(this->p1StartColor.g, this->p1EndColor.g, ratio); + vtx[j].v.cn[2] = func_800B0A24(this->p1StartColor.b, this->p1EndColor.b, ratio); + vtx[j].v.cn[3] = func_800B0A24(this->p1StartColor.a, this->p1EndColor.a, ratio); + j++; + + vtx[j].v.flag = 0; + vtx[j].v.tc[0] = 0; + vtx[j].v.tc[1] = 0; + vtx[j].v.cn[0] = func_800B0A24(this->p2StartColor.r, this->p2EndColor.r, ratio); + vtx[j].v.cn[1] = func_800B0A24(this->p2StartColor.g, this->p2EndColor.g, ratio); + vtx[j].v.cn[2] = func_800B0A24(this->p2StartColor.b, this->p2EndColor.b, ratio); + vtx[j].v.cn[3] = func_800B0A24(this->p2StartColor.a, this->p2EndColor.a, ratio); + j++; + } + } + + phi_t2 = 0; + j = 0; + + gSPVertex(POLY_XLU_DISP++, vtx, 32, 0); + + for (i = 0; i < this->numElements; i++) { + elem = &this->elements[i]; + + if (elem->state == 0) { + phi_t2 = 0; + } else { + if (phi_t2 == 0) { + phi_t2 = 1; + } else { + gSP1Quadrangle(POLY_XLU_DISP++, j - 2, j - 1, j + 1, j, 0); + + if (this->unkFlag == 1) { + phi_t2 = 0; + } + } + j += 2; + } + } + } + } else if (this->drawMode < 2) { + EffectBlure_DrawSimple(this, gfxCtx); + } else { + EffectBlure_DrawSmooth(this, gfxCtx); + } + } + + CLOSE_DISPS(gfxCtx); +} diff --git a/src/code/z_eff_shield_particle.c b/src/code/z_eff_shield_particle.c index 29d93a7159..05669d63ad 100644 --- a/src/code/z_eff_shield_particle.c +++ b/src/code/z_eff_shield_particle.c @@ -1,11 +1,207 @@ #include "global.h" +#include "vt.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_shield_particle/EffectShieldParticle_Init.s") +#include "assets/code/eff_shield_particle/eff_shield_particle.c" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_shield_particle/EffectShieldParticle_Destroy.s") +void EffectShieldParticle_Init(void* thisx, void* initParamsx) { + EffectShieldParticle* this = (EffectShieldParticle*)thisx; + EffectShieldParticleInit* initParams = (EffectShieldParticleInit*)initParamsx; + EffectShieldParticleElement* elem; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_shield_particle/EffectShieldParticle_Update.s") + if ((this != NULL) && (initParams != NULL)) { + this->numElements = initParams->numElements; + if (this->numElements > ARRAY_COUNT(this->elements)) { + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_shield_particle/EffectShieldParticle_CalculateColors.s") + this->position = initParams->position; + this->primColorStart = initParams->primColorStart; + this->envColorStart = initParams->envColorStart; + this->primColorMid = initParams->primColorMid; + this->envColorMid = initParams->envColorMid; + this->primColorEnd = initParams->primColorEnd; + this->envColorEnd = initParams->envColorEnd; + this->deceleration = initParams->deceleration; + this->maxInitialSpeed = initParams->maxInitialSpeed; + this->lengthCutoff = initParams->lengthCutoff; + this->duration = initParams->duration; + this->timer = 0; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_shield_particle/EffectShieldParticle_Draw.s") + for (elem = &this->elements[0]; elem < &this->elements[this->numElements]; elem++) { + elem->initialSpeed = (Rand_ZeroOne() * (this->maxInitialSpeed * 0.5f)) + (this->maxInitialSpeed * 0.5f); + elem->endX = 0.0f; + elem->startXChange = 0.0f; + elem->startX = 0.0f; + elem->endXChange = elem->initialSpeed; + elem->yaw = Rand_ZeroOne() * 65534.0f; + elem->pitch = Rand_ZeroOne() * 65534.0f; + } + + this->lightDecay = initParams->lightDecay; + if (this->lightDecay == true) { + this->lightInfo.type = LIGHT_POINT_NOGLOW; + this->lightInfo.params.point = initParams->lightPoint; + this->lightNode = + LightContext_InsertLight(Effect_GetGlobalCtx(), &Effect_GetGlobalCtx()->lightCtx, &this->lightInfo); + } else { + this->lightNode = NULL; + } + } +} + +void EffectShieldParticle_Destroy(void* thisx) { + EffectShieldParticle* this = (EffectShieldParticle*)thisx; + + if ((this != NULL) && (this->lightDecay == true)) { + if (this->lightNode == Effect_GetGlobalCtx()->lightCtx.listHead) { + Effect_GetGlobalCtx()->lightCtx.listHead = this->lightNode->next; + } + LightContext_RemoveLight(Effect_GetGlobalCtx(), &Effect_GetGlobalCtx()->lightCtx, this->lightNode); + } +} + +s32 EffectShieldParticle_Update(void* thisx) { + EffectShieldParticle* this = (EffectShieldParticle*)thisx; + EffectShieldParticleElement* elem; + + if (this == NULL) { + return 0; + } + + for (elem = &this->elements[0]; elem < &this->elements[this->numElements]; elem++) { + elem->endXChange -= this->deceleration; + if (elem->endXChange < 0.0f) { + elem->endXChange = 0.0f; + } + + if (elem->startXChange > 0.0f) { + elem->startXChange -= this->deceleration; + if (elem->startXChange < 0.0f) { + elem->startXChange = 0.0f; + } + } + + elem->endX += elem->endXChange; + elem->startX += elem->startXChange; + + if ((elem->startXChange == 0.0f) && (this->lengthCutoff < (elem->endX - elem->startX))) { + elem->startXChange = elem->initialSpeed; + } + } + + if (this->lightDecay == true) { + this->lightInfo.params.point.radius /= 2; + } + + this->timer++; + + if (this->duration < this->timer) { + return 1; + } + + return 0; +} + +void EffectShieldParticle_GetColors(EffectShieldParticle* this, Color_RGBA8* primColor, Color_RGBA8* envColor) { + s32 halfDuration = this->duration * 0.5f; + + if (halfDuration == 0) { + primColor->r = this->primColorStart.r; + primColor->g = this->primColorStart.g; + primColor->b = this->primColorStart.b; + primColor->a = this->primColorStart.a; + envColor->r = this->envColorStart.r; + envColor->g = this->envColorStart.g; + envColor->b = this->envColorStart.b; + envColor->a = this->envColorStart.a; + } else if (this->timer < halfDuration) { + f32 ratio = this->timer / (f32)halfDuration; + + primColor->r = LERPIMP(this->primColorStart.r, this->primColorMid.r, ratio); + primColor->g = LERPIMP(this->primColorStart.g, this->primColorMid.g, ratio); + primColor->b = LERPIMP(this->primColorStart.b, this->primColorMid.b, ratio); + primColor->a = LERPIMP(this->primColorStart.a, this->primColorMid.a, ratio); + envColor->r = LERPIMP(this->envColorStart.r, this->envColorMid.r, ratio); + envColor->g = LERPIMP(this->envColorStart.g, this->envColorMid.g, ratio); + envColor->b = LERPIMP(this->envColorStart.b, this->envColorMid.b, ratio); + envColor->a = LERPIMP(this->envColorStart.a, this->envColorMid.a, ratio); + } else { + f32 ratio = (this->timer - halfDuration) / (f32)halfDuration; + + primColor->r = LERPIMP(this->primColorMid.r, this->primColorEnd.r, ratio); + primColor->g = LERPIMP(this->primColorMid.g, this->primColorEnd.g, ratio); + primColor->b = LERPIMP(this->primColorMid.b, this->primColorEnd.b, ratio); + primColor->a = LERPIMP(this->primColorMid.a, this->primColorEnd.a, ratio); + envColor->r = LERPIMP(this->envColorMid.r, this->envColorEnd.r, ratio); + envColor->g = LERPIMP(this->envColorMid.g, this->envColorEnd.g, ratio); + envColor->b = LERPIMP(this->envColorMid.b, this->envColorEnd.b, ratio); + envColor->a = LERPIMP(this->envColorMid.a, this->envColorEnd.a, ratio); + } +} + +void EffectShieldParticle_Draw(void* thisx, GraphicsContext* gfxCtx) { + EffectShieldParticle* this = (EffectShieldParticle*)thisx; + EffectShieldParticleElement* elem; + Color_RGBA8 primColor; + Color_RGBA8 envColor; + + OPEN_DISPS(gfxCtx); + + if (this != NULL) { + POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x26); + + gDPSetCycleType(POLY_XLU_DISP++, G_CYC_2CYCLE); + gDPPipeSync(POLY_XLU_DISP++); + gSPTexture(POLY_XLU_DISP++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); + + gDPLoadTextureBlock(POLY_XLU_DISP++, D_04054F20, G_IM_FMT_I, G_IM_SIZ_8b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, 5, 5, G_TX_NOLOD, G_TX_NOLOD); + + gDPSetCombineLERP(POLY_XLU_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, 0, TEXEL0, 0, 0, 0, + 0, COMBINED, 0, 0, 0, COMBINED); + gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_ZB_CLD_SURF2); + gSPClearGeometryMode(POLY_XLU_DISP++, G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR); + gSPSetGeometryMode(POLY_XLU_DISP++, G_ZBUFFER | G_SHADE | G_SHADING_SMOOTH); + + EffectShieldParticle_GetColors(this, &primColor, &envColor); + + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, primColor.r, primColor.g, primColor.b, primColor.a); + gDPSetEnvColor(POLY_XLU_DISP++, envColor.r, envColor.g, envColor.b, envColor.a); + gDPPipeSync(POLY_XLU_DISP++); + + for (elem = &this->elements[0]; elem < &this->elements[this->numElements]; elem++) { + Mtx* mtx; + MtxF sp104; + MtxF spC4; + MtxF sp84; + f32 temp1 = (elem->endX + elem->startX) * 0.5f; + f32 temp2 = elem->endX - elem->startX; + f32 temp3 = (temp2 * (1.0f / 64.0f)) / 0.02f; + + if (temp3 < 1.0f) { + temp3 = 1.0f; + } + + SkinMatrix_SetTranslate(&spC4, this->position.x, this->position.y, this->position.z); + SkinMatrix_SetRotateRPY(&sp104, 0, elem->yaw, 0); + SkinMatrix_MtxFMtxFMult(&spC4, &sp104, &sp84); + SkinMatrix_SetRotateRPY(&sp104, 0, 0, elem->pitch); + SkinMatrix_MtxFMtxFMult(&sp84, &sp104, &spC4); + SkinMatrix_SetTranslate(&sp104, temp1, 0.0f, 0.0f); + SkinMatrix_MtxFMtxFMult(&spC4, &sp104, &sp84); + SkinMatrix_SetScale(&sp104, temp3 * 0.02f, 0.02f, 0.02f); + SkinMatrix_MtxFMtxFMult(&sp84, &sp104, &spC4); + + mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &spC4); + if (mtx == NULL) { + break; + } + + gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPVertex(POLY_XLU_DISP++, sEffShieldParticleVtx, 4, 0); + gSP2Triangles(POLY_XLU_DISP++, 0, 1, 2, 0, 0, 3, 1, 0); + } + } + + CLOSE_DISPS(gfxCtx); +} diff --git a/src/code/z_eff_spark.c b/src/code/z_eff_spark.c index d06bc4b276..b05ee2eca7 100644 --- a/src/code/z_eff_spark.c +++ b/src/code/z_eff_spark.c @@ -1,9 +1,265 @@ #include "global.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_spark/EffectSpark_Init.s") +void EffectSpark_Init(void* thisx, void* initParamsx) { + EffectSpark* this = (EffectSpark*)thisx; + EffectSparkInit* initParams = (EffectSparkInit*)initParamsx; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_spark/EffectSpark_Destroy.s") + f32 velocityNorm; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_spark/EffectSpark_Update.s") + if ((this != NULL) && (initParams != NULL)) { + if ((initParams->uDiv == 0) || (initParams->vDiv == 0)) { + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_spark/EffectSpark_Draw.s") + this->position = initParams->position; + this->speed = initParams->speed; + this->gravity = initParams->gravity; + this->uDiv = initParams->uDiv; + this->vDiv = initParams->vDiv; + this->colorStart[0].r = initParams->colorStart[0].r; + this->colorStart[0].g = initParams->colorStart[0].g; + this->colorStart[0].b = initParams->colorStart[0].b; + this->colorStart[0].a = initParams->colorStart[0].a; + this->colorStart[1].r = initParams->colorStart[1].r; + this->colorStart[1].g = initParams->colorStart[1].g; + this->colorStart[1].b = initParams->colorStart[1].b; + this->colorStart[1].a = initParams->colorStart[1].a; + this->colorStart[2].r = initParams->colorStart[2].r; + this->colorStart[2].g = initParams->colorStart[2].g; + this->colorStart[2].b = initParams->colorStart[2].b; + this->colorStart[2].a = initParams->colorStart[2].a; + this->colorStart[3].r = initParams->colorStart[3].r; + this->colorStart[3].g = initParams->colorStart[3].g; + this->colorStart[3].b = initParams->colorStart[3].b; + this->colorStart[3].a = initParams->colorStart[3].a; + this->colorEnd[0].r = initParams->colorEnd[0].r; + this->colorEnd[0].g = initParams->colorEnd[0].g; + this->colorEnd[0].b = initParams->colorEnd[0].b; + this->colorEnd[0].a = initParams->colorEnd[0].a; + this->colorEnd[1].r = initParams->colorEnd[1].r; + this->colorEnd[1].g = initParams->colorEnd[1].g; + this->colorEnd[1].b = initParams->colorEnd[1].b; + this->colorEnd[1].a = initParams->colorEnd[1].a; + this->colorEnd[2].r = initParams->colorEnd[2].r; + this->colorEnd[2].g = initParams->colorEnd[2].g; + this->colorEnd[2].b = initParams->colorEnd[2].b; + this->colorEnd[2].a = initParams->colorEnd[2].a; + this->colorEnd[3].r = initParams->colorEnd[3].r; + this->colorEnd[3].g = initParams->colorEnd[3].g; + this->colorEnd[3].b = initParams->colorEnd[3].b; + this->colorEnd[3].a = initParams->colorEnd[3].a; + this->duration = initParams->duration; + + this->numElements = (this->uDiv * this->vDiv) + 2; + if (this->numElements > ARRAY_COUNT(this->elements)) { + return; + } + + for (i = 0; i < this->numElements; i++) { + EffectSparkElement* elem = &this->elements[i]; + + elem->position.x = this->position.x; + elem->position.y = this->position.y; + elem->position.z = this->position.z; + elem->velocity.x = Rand_ZeroOne() - 0.5f; + elem->velocity.y = Rand_ZeroOne() - 0.5f; + elem->velocity.z = Rand_ZeroOne() - 0.5f; + + velocityNorm = sqrtf(SQXYZ(elem->velocity)); + + if (!(fabsf(velocityNorm) < 0.008f)) { + elem->velocity.x *= this->speed * (1.0f / velocityNorm); + elem->velocity.y *= this->speed * (1.0f / velocityNorm); + elem->velocity.z *= this->speed * (1.0f / velocityNorm); + } else { + elem->velocity.x = elem->velocity.z = 0.0f; + elem->velocity.y = this->speed; + } + + elem->unkVelocity.x = 30000.0f - Rand_ZeroOne() * 15000.0f; + elem->unkVelocity.y = 30000.0f - Rand_ZeroOne() * 15000.0f; + elem->unkVelocity.z = 30000.0f - Rand_ZeroOne() * 15000.0f; + elem->unkPosition.x = Rand_ZeroOne() * 65534.0f; + elem->unkPosition.y = Rand_ZeroOne() * 65534.0f; + elem->unkPosition.z = Rand_ZeroOne() * 65534.0f; + } + + this->timer = 0; + } +} + +void EffectSpark_Destroy(void* thisx) { +} + +s32 EffectSpark_Update(void* thisx) { + EffectSpark* this = (EffectSpark*)thisx; + EffectSparkElement* elem; + s32 i; + + for (i = 0; i < this->numElements; i++) { + elem = &this->elements[i]; + + elem->position.x += elem->velocity.x; + elem->position.y += elem->velocity.y; + elem->position.z += elem->velocity.z; + elem->velocity.y += this->gravity; + elem->unkPosition.x += elem->unkVelocity.x; + elem->unkPosition.y += elem->unkVelocity.y; + elem->unkPosition.z += elem->unkVelocity.z; + } + + this->timer++; + + if (this->duration < this->timer) { + return 1; + } else { + return 0; + } +} + +void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) { + Vtx* vertices; + EffectSpark* this = (EffectSpark*)thisx; + GlobalContext* globalCtx = Effect_GetGlobalCtx(); + s32 i; + s32 j; + u8 sp1D3; + u8 sp1D2; + u8 sp1D1; + u8 sp1D0; + u8 sp1CF; + u8 sp1CE; + u8 sp1CD; + u8 sp1CC; + u8 sp1CB; + u8 sp1CA; + u8 sp1C9; + u8 sp1C8; + u8 sp1C7; + u8 sp1C6; + u8 sp1C5; + u8 sp1C4; + f32 ratio; + + OPEN_DISPS(gfxCtx); + + if (this != NULL) { + gSPMatrix(POLY_XLU_DISP++, &D_801D1DE0, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x26); + gDPSetCycleType(POLY_XLU_DISP++, G_CYC_2CYCLE); + gDPPipeSync(POLY_XLU_DISP++); + + gSPTexture(POLY_XLU_DISP++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); + gDPLoadTextureBlock(POLY_XLU_DISP++, D_04054F20, G_IM_FMT_I, G_IM_SIZ_8b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, 5, 5, G_TX_NOLOD, G_TX_NOLOD); + + gDPSetCombineMode(POLY_XLU_DISP++, G_CC_SHADEDECALA, G_CC_PASS2); + gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_ZB_CLD_SURF2); + gSPClearGeometryMode(POLY_XLU_DISP++, G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR); + gSPSetGeometryMode(POLY_XLU_DISP++, G_ZBUFFER | G_SHADE | G_SHADING_SMOOTH); + gDPPipeSync(POLY_XLU_DISP++); + + vertices = GRAPH_ALLOC(gfxCtx, ALIGN16(this->numElements * sizeof(Vtx[4]))); + if (vertices == NULL) { + goto end; + } + + j = 0; + + ratio = (f32)this->timer / (f32)this->duration; + sp1D3 = F32_LERPIMP(this->colorStart[0].r, this->colorEnd[0].r, ratio); + sp1D2 = F32_LERPIMP(this->colorStart[0].g, this->colorEnd[0].g, ratio); + sp1D1 = F32_LERPIMP(this->colorStart[0].b, this->colorEnd[0].b, ratio); + sp1D0 = F32_LERPIMP(this->colorStart[0].a, this->colorEnd[0].a, ratio); + sp1CF = F32_LERPIMP(this->colorStart[1].r, this->colorEnd[1].r, ratio); + sp1CE = F32_LERPIMP(this->colorStart[1].g, this->colorEnd[1].g, ratio); + sp1CD = F32_LERPIMP(this->colorStart[1].b, this->colorEnd[1].b, ratio); + sp1CC = F32_LERPIMP(this->colorStart[1].a, this->colorEnd[1].a, ratio); + sp1CB = F32_LERPIMP(this->colorStart[2].r, this->colorEnd[2].r, ratio); + sp1CA = F32_LERPIMP(this->colorStart[2].g, this->colorEnd[2].g, ratio); + sp1C9 = F32_LERPIMP(this->colorStart[2].b, this->colorEnd[2].b, ratio); + sp1C8 = F32_LERPIMP(this->colorStart[2].a, this->colorEnd[2].a, ratio); + sp1C7 = F32_LERPIMP(this->colorStart[3].r, this->colorEnd[3].r, ratio); + sp1C6 = F32_LERPIMP(this->colorStart[3].g, this->colorEnd[3].g, ratio); + sp1C5 = F32_LERPIMP(this->colorStart[3].b, this->colorEnd[3].b, ratio); + sp1C4 = F32_LERPIMP(this->colorStart[3].a, this->colorEnd[3].a, ratio); + + for (i = 0; i < this->numElements; i++) { + MtxF sp12C; + MtxF spEC; + MtxF spAC; + MtxF sp6C; + EffectSparkElement* elem = &this->elements[i]; + Mtx* mtx; + f32 temp; + + SkinMatrix_SetTranslate(&spEC, elem->position.x, elem->position.y, elem->position.z); + temp = ((Rand_ZeroOne() * 2.5f) + 1.5f) / 64.0f; + SkinMatrix_SetScale(&spAC, temp, temp, 1.0f); + SkinMatrix_MtxFMtxFMult(&spEC, &globalCtx->billboardMtxF, &sp6C); + SkinMatrix_MtxFMtxFMult(&sp6C, &spAC, &sp12C); + + vertices[j].v.ob[0] = -32; + vertices[j].v.ob[1] = -32; + vertices[j].v.ob[2] = 0; + vertices[j].v.cn[0] = sp1D3; + vertices[j].v.cn[1] = sp1D2; + vertices[j].v.cn[2] = sp1D1; + vertices[j].v.cn[3] = sp1D0; + vertices[j].v.tc[0] = 0; + vertices[j].v.tc[1] = 1024; + vertices[j].v.flag = 0; + + vertices[j + 1].v.ob[0] = 32; + vertices[j + 1].v.ob[1] = 32; + vertices[j + 1].v.ob[2] = 0; + vertices[j + 1].v.cn[0] = sp1CF; + vertices[j + 1].v.cn[1] = sp1CE; + vertices[j + 1].v.cn[2] = sp1CD; + vertices[j + 1].v.cn[3] = sp1CC; + vertices[j + 1].v.tc[0] = 1024; + vertices[j + 1].v.tc[1] = 0; + vertices[j + 1].v.flag = 0; + + vertices[j + 2].v.ob[0] = -32; + vertices[j + 2].v.ob[1] = 32; + vertices[j + 2].v.ob[2] = 0; + vertices[j + 2].v.cn[0] = sp1CB; + vertices[j + 2].v.cn[1] = sp1CA; + vertices[j + 2].v.cn[2] = sp1C9; + vertices[j + 2].v.cn[3] = sp1C8; + vertices[j + 2].v.tc[0] = 0; + vertices[j + 2].v.tc[1] = 0; + vertices[j + 2].v.flag = 0; + + vertices[j + 3].v.ob[0] = 32; + vertices[j + 3].v.ob[1] = -32; + vertices[j + 3].v.ob[2] = 0; + vertices[j + 3].v.cn[0] = sp1C7; + vertices[j + 3].v.cn[1] = sp1C6; + vertices[j + 3].v.cn[2] = sp1C5; + vertices[j + 3].v.cn[3] = sp1C4; + vertices[j + 3].v.tc[0] = 1024; + vertices[j + 3].v.tc[1] = 1024; + vertices[j + 3].v.flag = 0; + + j += 4; + + mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &sp12C); + if (mtx == NULL) { + goto end; + } + + gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPVertex(POLY_XLU_DISP++, &vertices[4 * i], 4, 0); + gSP2Triangles(POLY_XLU_DISP++, 2, 0, 3, 0, 2, 3, 1, 0); + } + + gDPPipeSync(POLY_XLU_DISP++); + } + +end: + CLOSE_DISPS(gfxCtx); +} diff --git a/src/code/z_eff_ss_dead.c b/src/code/z_eff_ss_dead.c index 12665d6b2f..bd93f5eeda 100644 --- a/src/code/z_eff_ss_dead.c +++ b/src/code/z_eff_ss_dead.c @@ -1,13 +1,111 @@ #include "global.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_ss_dead/func_800AE2A0.s") +void func_800AE2A0(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) { + f32 cos; + Gfx* displayListHead; + f32 absCos; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_ss_dead/func_800AE434.s") + OPEN_DISPS(globalCtx->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_ss_dead/func_800AE5A0.s") + displayListHead = POLY_OPA_DISP; + cos = Math_CosS((0x8000 / arg3) * arg2); + absCos = fabsf(cos); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_ss_dead/func_800AE5E4.s") + gDPPipeSync(displayListHead++); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_ss_dead/func_800AE778.s") + if (color == NULL) { + gDPSetFogColor(displayListHead++, 255, 0, 0, 0); + } else { + gDPSetFogColor(displayListHead++, color->r, color->g, color->b, color->a); + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_ss_dead/func_800AE8EC.s") + gSPFogPosition(displayListHead++, 0, (s16)(absCos * 3000.0f) + 1500); + + POLY_OPA_DISP = displayListHead; + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} + +void func_800AE434(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) { + Gfx* displayListHead; + f32 cos; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + cos = Math_CosS((0x4000 / arg3) * arg2); + displayListHead = POLY_OPA_DISP; + + gDPPipeSync(displayListHead++); + gDPSetFogColor(displayListHead++, color->r, color->g, color->b, color->a); + gSPFogPosition(displayListHead++, 0, (s16)(2800.0f * fabsf(cos)) + 1700); + + POLY_OPA_DISP = displayListHead; + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} + +void func_800AE5A0(GlobalContext* globalCtx) { + s32 pad; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + gDPPipeSync(POLY_OPA_DISP++); + POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} + +void func_800AE5E4(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) { + f32 cos; + Gfx* displayListHead; + f32 absCos; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + displayListHead = POLY_XLU_DISP; + cos = Math_CosS((0x8000 / arg3) * arg2); + absCos = fabsf(cos); + + gDPPipeSync(displayListHead++); + + if (color == NULL) { + gDPSetFogColor(displayListHead++, 255, 0, 0, 0); + } else { + gDPSetFogColor(displayListHead++, color->r, color->g, color->b, color->a); + } + + gSPFogPosition(displayListHead++, 0, (s16)(absCos * 3000.0f) + 1500); + + POLY_XLU_DISP = displayListHead; + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} + +void func_800AE778(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) { + f32 cos; + Gfx* displayListHead; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + displayListHead = POLY_XLU_DISP; + cos = Math_CosS((0x4000 / arg3) * arg2); + + gDPPipeSync(displayListHead++); + gDPSetFogColor(displayListHead++, color->r, color->g, color->b, color->a); + gSPFogPosition(displayListHead++, 0, (s16)(2800.0f * fabsf(cos)) + 1700); + + POLY_XLU_DISP = displayListHead; + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} + +void func_800AE8EC(GlobalContext* globalCtx) { + s32 pad; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + gDPPipeSync(POLY_XLU_DISP++); + POLY_XLU_DISP = func_801660B8(globalCtx, POLY_XLU_DISP); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/code/z_eff_tire_mark.c b/src/code/z_eff_tire_mark.c index 0ae14c86f7..f8e3f11a81 100644 --- a/src/code/z_eff_tire_mark.c +++ b/src/code/z_eff_tire_mark.c @@ -1,17 +1,287 @@ #include "global.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_tire_mark/func_800AE930.s") +void func_800AE930(CollisionContext* colCtx, EffectTireMark* this, Vec3f* pos, f32 arg3, s16 arg4, + CollisionPoly* colPoly, s32 arg6) { + Vec3s spB8; + Vec3s spB0; + EffectTireMarkElement* spAC; + EffectTireMarkElement* spA8; + u32 spA4; + u32 spA0; + Vec3s* vtxList = colCtx->colHeader->vtxList; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_tire_mark/func_800AEF44.s") + if ((arg6 != 50) || (this->numElements >= (ARRAY_COUNT(this->elements) - 1)) || (colPoly == NULL)) { + func_800AEF44(this); + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_tire_mark/EffectTireMark_InitParticle.s") + spB8.x = (Math_SinS(arg4 - 0x4000) * arg3) + pos->x; + spB8.z = (Math_CosS(arg4 - 0x4000) * arg3) + pos->z; + spB8.y = func_800BFD84(colPoly, spB8.x, spB8.z) + 2.0f; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_tire_mark/EffectTireMark_Init.s") + spB0.x = (Math_SinS(arg4 + 0x4000) * arg3) + pos->x; + spB0.z = (Math_CosS(arg4 + 0x4000) * arg3) + pos->z; + spB0.y = func_800BFD84(colPoly, spB0.x, spB0.z) + 2.0f; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_tire_mark/EffectTireMark_Destroy.s") + spAC = &this->elements[this->numElements - 1]; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_tire_mark/EffectTireMark_Update.s") + if ((this->numElements != 0) && (spAC->colPoly != NULL) && (colPoly != spAC->colPoly) && + (func_800BFDEC(spAC->colPoly, colPoly, &spA4, &spA0) == 2)) { + Vec3f sp90; + Vec3f sp84; + Vec3f sp78; + Vec3f sp6C; + Vec3f sp60; + Vec3f sp54; + Vec3f sp48; + Vec3f sp3C; + Vec3f sp30; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_tire_mark/EffectTireMark_InitVertices.s") + sp84.x = vtxList[spA4].x; + sp84.y = vtxList[spA4].y; + sp84.z = vtxList[spA4].z; + sp90.x = vtxList[spA0].x; + sp90.y = vtxList[spA0].y; + sp90.z = vtxList[spA0].z; + sp54.x = spAC->p1.x; + sp54.y = spAC->p1.y; + sp54.z = spAC->p1.z; + sp60.x = spB0.x; + sp60.y = spB0.y; + sp60.z = spB0.z; + sp3C.x = spAC->p2.x; + sp3C.y = spAC->p2.y; + sp3C.z = spAC->p2.z; + sp48.x = spB8.x; + sp48.y = spB8.y; + sp48.z = spB8.z; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_tire_mark/EffectTireMark_Draw.s") + if ((func_80179798(&sp84, &sp90, &sp54, &sp60, &sp6C, &sp30) != 0) && + (func_80179798(&sp84, &sp90, &sp3C, &sp48, &sp78, &sp30) != 0)) { + if (!(spAC->flags & 2)) { + spAC->flags |= 1; + } + + spA8 = &this->elements[this->numElements]; + spA8->flags = 0; + spA8->p1.x = sp6C.x; + spA8->p1.y = sp6C.y; + spA8->p1.z = sp6C.z; + spA8->p2.x = sp78.x; + spA8->p2.y = sp78.y; + spA8->p2.z = sp78.z; + spA8->life = this->elemDuration; + spA8->colPoly = NULL; + this->numElements++; + + spAC = &this->elements[this->numElements - 1]; + if (!(spAC->flags & 2)) { + spAC->flags |= 1; + } + + if (spA8) {} // Necessary to match + + spA8 = &this->elements[this->numElements]; + spA8->flags = 0; + spA8->p1 = spB0; + spA8->p2 = spB8; + spA8->life = this->elemDuration; + spA8->colPoly = colPoly; + this->numElements++; + return; + } + + if (!(spAC->flags & 2)) { + spAC->flags |= 1; + } + + spA8 = &this->elements[this->numElements]; + spA8->flags = 0; + spA8->p1 = spB0; + spA8->p2 = spB8; + spA8->life = this->elemDuration; + spA8->colPoly = colPoly; + + this->numElements++; + return; + } + + if (!(spAC->flags & 2)) { + spAC->flags |= 1; + } + + spA8 = &this->elements[this->numElements]; + spA8->flags = 0; + spA8->p1 = spB0; + spA8->p2 = spB8; + spA8->life = this->elemDuration; + spA8->colPoly = colPoly; + + this->numElements++; +} + +void func_800AEF44(EffectTireMark* this) { + EffectTireMarkElement* elem = &this->elements[this->numElements - 1]; + + elem->flags |= 2; +} + +void EffectTireMark_InitElement(EffectTireMarkElement* elem) { + elem->flags = 0; + elem->life = 0; + elem->colPoly = NULL; + elem->p1.x = elem->p1.y = elem->p1.z = elem->p2.x = elem->p2.y = elem->p2.z = 0; +} + +void EffectTireMark_Init(void* thisx, void* initParamsx) { + EffectTireMark* this = (EffectTireMark*)thisx; + EffectTireMarkInit* initParams = (EffectTireMarkInit*)initParamsx; + s32 i; + + for (i = 0; i < ARRAY_COUNT(this->elements); i++) { + EffectTireMark_InitElement(&this->elements[i]); + } + + this->unk600 = initParams->unk0; + this->numElements = 0; + + if (initParams->elemDuration > 62) { + this->elemDuration = 62; + } else { + this->elemDuration = initParams->elemDuration; + } + + this->color = initParams->color; +} + +void EffectTireMark_Destroy(void* thisx) { +} + +s32 EffectTireMark_Update(void* thisx) { + EffectTireMark* this = (EffectTireMark*)thisx; + s32 i; + s32 j; + + if (this->numElements == 0) { + return 0; + } + + for (i = 0; i < this->numElements; i++) { + this->elements[i].life--; + } + + if (this->elements[0].life <= 0) { + for (j = 0; j < ARRAY_COUNT(this->elements) - 1; j++) { + this->elements[j] = this->elements[j + 1]; + } + + EffectTireMark_InitElement(&this->elements[j]); + + this->numElements--; + if (this->numElements < 0) { + this->numElements = 0; + } + return 0; + } + + return 0; +} + +void EffectTireMark_SetVertices(Vtx* vtx, EffectTireMarkElement* elem, s32 i, s32 alpha) { + s32 i1 = i * 2; + s32 i2 = i * 2 + 1; + + vtx[i1].v.ob[0] = elem->p1.x; + vtx[i1].v.ob[1] = elem->p1.y; + vtx[i1].v.ob[2] = elem->p1.z; + vtx[i1].v.tc[0] = 2048; + vtx[i1].v.tc[1] = 0; + vtx[i1].v.cn[0] = 255; + vtx[i1].v.cn[1] = 255; + vtx[i1].v.cn[2] = 255; + vtx[i1].v.cn[3] = alpha; + + vtx[i2].v.ob[0] = elem->p2.x; + vtx[i2].v.ob[1] = elem->p2.y; + vtx[i2].v.ob[2] = elem->p2.z; + vtx[i2].v.tc[0] = 2048; + vtx[i2].v.tc[1] = 1024; + vtx[i2].v.cn[0] = 255; + vtx[i2].v.cn[1] = 255; + vtx[i2].v.cn[2] = 255; + vtx[i2].v.cn[3] = alpha; +} + +void EffectTireMark_Draw(void* thisx, GraphicsContext* gfxCtx) { + EffectTireMark* this = (EffectTireMark*)thisx; + EffectTireMarkElement* elem; + Vtx* vtx; + s32 pad; + f32 sp34; + s32 i; + + sp34 = 1.0f / this->elemDuration; + + OPEN_DISPS(gfxCtx); + + if (this->numElements >= 2) { + vtx = GRAPH_ALLOC(gfxCtx, ALIGN16(this->numElements * sizeof(Vtx[2]))); + + if (vtx != NULL) { + gSPMatrix(POLY_OPA_DISP++, &D_801D1DE0, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + POLY_OPA_DISP = Gfx_CallSetupDL(POLY_OPA_DISP++, 0x2C); + gDPSetRenderMode(POLY_OPA_DISP++, G_RM_PASS, G_RM_ZB_CLD_SURF2); + + gDPLoadTextureBlock(POLY_OPA_DISP++, D_04014570, G_IM_FMT_I, G_IM_SIZ_8b, 64, 32, 0, + G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_WRAP, 6, 5, G_TX_NOLOD, G_TX_NOLOD); + + gDPSetCombineLERP(POLY_OPA_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, COMBINED, 0, 0, 0, + COMBINED); + gSPSetGeometryMode(POLY_OPA_DISP++, G_SHADE | G_SHADING_SMOOTH); + gSPClearGeometryMode(POLY_OPA_DISP++, G_CULL_BACK | G_LIGHTING); + + EffectTireMark_SetVertices(vtx, &this->elements[0], 0, 255); + + vtx[0].v.tc[0] = 0; + vtx[0].v.tc[1] = 0; + vtx[1].v.tc[0] = 0; + vtx[1].v.tc[1] = 1024; + + for (i = 1; i < this->numElements; i++) { + elem = &this->elements[i]; + + EffectTireMark_SetVertices(vtx, elem, i, 255); + + if ((elem - 1)->flags & 1) { + if (!(elem->flags & 1)) { + vtx[i * 2 + 0].v.tc[0] = 0; + vtx[i * 2 + 0].v.tc[1] = 0; + vtx[i * 2 + 1].v.tc[0] = 0; + vtx[i * 2 + 1].v.tc[1] = 1024; + dummy_label:; + } else if ((i >= 2) && !((elem - 2)->flags & 1)) { + vtx[i * 2 - 2].v.tc[0] = 0; + vtx[i * 2 - 2].v.tc[1] = 0; + vtx[i * 2 - 1].v.tc[0] = 0; + vtx[i * 2 - 1].v.tc[1] = 1024; + } + + if (i == (this->numElements - 1)) { + vtx[i * 2 + 0].v.tc[0] = 0; + vtx[i * 2 + 0].v.tc[1] = 0; + vtx[i * 2 + 1].v.tc[0] = 0; + vtx[i * 2 + 1].v.tc[1] = 1024; + } + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->color.r, this->color.g, this->color.b, + (s32)((f32)this->color.a * (f32)elem->life * sp34)); + gSPVertex(POLY_OPA_DISP++, &vtx[i * 2 - 2], 4, 0); + gSP2Triangles(POLY_OPA_DISP++, 0, 1, 3, 0, 0, 3, 2, 0); + } + } + } + } + + CLOSE_DISPS(gfxCtx); +} diff --git a/src/code/z_effect.c b/src/code/z_effect.c index 1c7ad38914..dd696393ff 100644 --- a/src/code/z_effect.c +++ b/src/code/z_effect.c @@ -1,55 +1,57 @@ #include "global.h" -EffInfo sEffInfoTable[] = { +EffectContext sEffectContext; + +EffectInfo sEffectInfoTable[] = { { - sizeof(EffSparkParams), - (eff_init_func)EffectSpark_Init, - (eff_destroy_func)EffectSpark_Destroy, - (eff_update_func)EffectSpark_Update, - (eff_draw_func)EffectSpark_Draw, + sizeof(EffectSpark), + EffectSpark_Init, + EffectSpark_Destroy, + EffectSpark_Update, + EffectSpark_Draw, }, { sizeof(EffectBlure), - (eff_init_func)EffectBlure_Init1, - (eff_destroy_func)EffectBlure_Destroy, - (eff_update_func)EffectBlure_Update, - (eff_draw_func)EffectBlure_Draw, + EffectBlure_Init1, + EffectBlure_Destroy, + EffectBlure_Update, + EffectBlure_Draw, }, { sizeof(EffectBlure), - (eff_init_func)EffectBlure_Init2, - (eff_destroy_func)EffectBlure_Destroy, - (eff_update_func)EffectBlure_Update, - (eff_draw_func)EffectBlure_Draw, + EffectBlure_Init2, + EffectBlure_Destroy, + EffectBlure_Update, + EffectBlure_Draw, }, { - sizeof(EffShieldParticleParams), - (eff_init_func)EffectShieldParticle_Init, - (eff_destroy_func)EffectShieldParticle_Destroy, - (eff_update_func)EffectShieldParticle_Update, - (eff_draw_func)EffectShieldParticle_Draw, + sizeof(EffectShieldParticle), + EffectShieldParticle_Init, + EffectShieldParticle_Destroy, + EffectShieldParticle_Update, + EffectShieldParticle_Draw, }, { - sizeof(EffTireMarkParams), - (eff_init_func)EffectTireMark_Init, - (eff_destroy_func)EffectTireMark_Destroy, - (eff_update_func)EffectTireMark_Update, - (eff_draw_func)EffectTireMark_Draw, + sizeof(EffectTireMark), + EffectTireMark_Init, + EffectTireMark_Destroy, + EffectTireMark_Update, + EffectTireMark_Draw, }, }; -GlobalContext* Effect_GetContext(void) { - return sEffTable.globalCtx; +GlobalContext* Effect_GetGlobalCtx(void) { + return sEffectContext.globalCtx; } -void* Effect_GetParams(s32 index) { +void* Effect_GetByIndex(s32 index) { if (index == TOTAL_EFFECT_COUNT) { return NULL; } if (index < SPARK_COUNT) { - if (sEffTable.sparks[index].base.active == 1) { - return &sEffTable.sparks[index].params; + if (sEffectContext.sparks[index].status.active == true) { + return &sEffectContext.sparks[index].effect; } else { return NULL; } @@ -57,8 +59,8 @@ void* Effect_GetParams(s32 index) { index -= SPARK_COUNT; if (index < BLURE_COUNT) { - if (sEffTable.blures[index].base.active == 1) { - return &sEffTable.blures[index].params; + if (sEffectContext.blures[index].status.active == true) { + return &sEffectContext.blures[index].effect; } else { return NULL; } @@ -66,8 +68,8 @@ void* Effect_GetParams(s32 index) { index -= BLURE_COUNT; if (index < SHIELD_PARTICLE_COUNT) { - if (sEffTable.shieldParticles[index].base.active == 1) { - return &sEffTable.shieldParticles[index].params; + if (sEffectContext.shieldParticles[index].status.active == true) { + return &sEffectContext.shieldParticles[index].effect; } else { return NULL; } @@ -75,8 +77,8 @@ void* Effect_GetParams(s32 index) { index -= SHIELD_PARTICLE_COUNT; if (index < TIRE_MARK_COUNT) { - if (sEffTable.tireMarks[index].base.active == 1) { - return &sEffTable.tireMarks[index].params; + if (sEffectContext.tireMarks[index].status.active == true) { + return &sEffectContext.tireMarks[index].effect; } else { return NULL; } @@ -85,89 +87,87 @@ void* Effect_GetParams(s32 index) { return NULL; } -void Effect_InitCommon(EffCommon* common) { - common->active = 0; - common->unk1 = 0; - common->unk2 = 0; +void Effect_InitStatus(EffectStatus* status) { + status->active = false; + status->unk1 = 0; + status->unk2 = 0; } void Effect_Init(GlobalContext* globalCtx) { s32 i; for (i = 0; i < SPARK_COUNT; i++) { - Effect_InitCommon(&sEffTable.sparks[i].base); + Effect_InitStatus(&sEffectContext.sparks[i].status); } for (i = 0; i < BLURE_COUNT; i++) { - Effect_InitCommon(&sEffTable.blures[i].base); + Effect_InitStatus(&sEffectContext.blures[i].status); } - //! @bug This is probably supposed to loop over shieldParticles, not blures again for (i = 0; i < SHIELD_PARTICLE_COUNT; i++) { - Effect_InitCommon(&sEffTable.blures[i].base); + //! @bug This is probably supposed to initialize shieldParticles, not blures again + Effect_InitStatus(&sEffectContext.blures[i].status); } for (i = 0; i < TIRE_MARK_COUNT; i++) { - Effect_InitCommon(&sEffTable.tireMarks[i].base); + Effect_InitStatus(&sEffectContext.tireMarks[i].status); } - sEffTable.globalCtx = globalCtx; + sEffectContext.globalCtx = globalCtx; } -void Effect_Add(GlobalContext* globalCtx, s32* index, s32 type, u8 param_4, u8 param_5, void* initParams) { +void Effect_Add(GlobalContext* globalCtx, s32* pIndex, s32 type, u8 arg3, u8 arg4, void* initParams) { u32 slotFound; s32 i; - void* params; - EffCommon* common; + void* effect = NULL; + EffectStatus* status = NULL; - params = NULL; - *index = TOTAL_EFFECT_COUNT; - common = NULL; + *pIndex = TOTAL_EFFECT_COUNT; if (FrameAdvance_IsEnabled(globalCtx) != true) { - slotFound = 0; + slotFound = false; switch (type) { - case 0: + case EFFECT_SPARK: for (i = 0; i < SPARK_COUNT; i++) { - if (sEffTable.sparks[i].base.active == 0) { - slotFound = 1; - *index = i; - params = &sEffTable.sparks[i].params; - common = &sEffTable.sparks[i].base; + if (sEffectContext.sparks[i].status.active == false) { + slotFound = true; + *pIndex = i; + effect = &sEffectContext.sparks[i].effect; + status = &sEffectContext.sparks[i].status; break; } } break; - case 1: - case 2: + case EFFECT_BLURE1: + case EFFECT_BLURE2: for (i = 0; i < BLURE_COUNT; i++) { - if (sEffTable.blures[i].base.active == 0) { - slotFound = 1; - *index = i + 3; - params = &sEffTable.blures[i].params; - common = &sEffTable.blures[i].base; + if (sEffectContext.blures[i].status.active == false) { + slotFound = true; + *pIndex = i + SPARK_COUNT; + effect = &sEffectContext.blures[i].effect; + status = &sEffectContext.blures[i].status; break; } } break; - case 3: + case EFFECT_SHIELD_PARTICLE: for (i = 0; i < SHIELD_PARTICLE_COUNT; i++) { - if (sEffTable.shieldParticles[i].base.active == 0) { - slotFound = 1; - *index = i + 28; - params = &sEffTable.shieldParticles[i].params; - common = &sEffTable.shieldParticles[i].base; + if (sEffectContext.shieldParticles[i].status.active == false) { + slotFound = true; + *pIndex = i + SPARK_COUNT + BLURE_COUNT; + effect = &sEffectContext.shieldParticles[i].effect; + status = &sEffectContext.shieldParticles[i].status; break; } } break; - case 4: + case EFFECT_TIRE_MARK: for (i = 0; i < TIRE_MARK_COUNT; i++) { - if (sEffTable.tireMarks[i].base.active == 0) { - slotFound = 1; - *index = i + 31; - params = &sEffTable.tireMarks[i].params; - common = &sEffTable.tireMarks[i].base; + if (sEffectContext.tireMarks[i].status.active == false) { + slotFound = true; + *pIndex = i + SPARK_COUNT + BLURE_COUNT + SHIELD_PARTICLE_COUNT; + effect = &sEffectContext.tireMarks[i].effect; + status = &sEffectContext.tireMarks[i].status; break; } } @@ -175,10 +175,10 @@ void Effect_Add(GlobalContext* globalCtx, s32* index, s32 type, u8 param_4, u8 p } if (slotFound) { - sEffInfoTable[type].init(params, initParams); - common->unk2 = param_4; - common->unk1 = param_5; - common->active = 1; + sEffectInfoTable[type].init(effect, initParams); + status->unk2 = arg3; + status->unk1 = arg4; + status->active = true; } } } @@ -188,8 +188,8 @@ void Effect_DrawAll(GraphicsContext* gfxCtx) { for (i = 0; i < SPARK_COUNT; i++) { if (1) {} // necessary to match - if (sEffTable.sparks[i].base.active) { - sEffInfoTable[0].draw(&sEffTable.sparks[i].params, gfxCtx); + if (sEffectContext.sparks[i].status.active) { + sEffectInfoTable[EFFECT_SPARK].draw(&sEffectContext.sparks[i].effect, gfxCtx); } } @@ -197,22 +197,22 @@ void Effect_DrawAll(GraphicsContext* gfxCtx) { if (1) { if (gfxCtx) {} } // necessary to match - if (sEffTable.blures[i].base.active) { - sEffInfoTable[1].draw(&sEffTable.blures[i].params, gfxCtx); + if (sEffectContext.blures[i].status.active) { + sEffectInfoTable[EFFECT_BLURE1].draw(&sEffectContext.blures[i].effect, gfxCtx); } } for (i = 0; i < SHIELD_PARTICLE_COUNT; i++) { if (1) {} // necessary to match - if (sEffTable.shieldParticles[i].base.active) { - sEffInfoTable[3].draw(&sEffTable.shieldParticles[i].params, gfxCtx); + if (sEffectContext.shieldParticles[i].status.active) { + sEffectInfoTable[EFFECT_SHIELD_PARTICLE].draw(&sEffectContext.shieldParticles[i].effect, gfxCtx); } } if (1) {} // necessary to match for (i = 0; i < TIRE_MARK_COUNT; i++) { - if (sEffTable.tireMarks[i].base.active) { - sEffInfoTable[4].draw(&sEffTable.tireMarks[i].params, gfxCtx); + if (sEffectContext.tireMarks[i].status.active) { + sEffectInfoTable[EFFECT_TIRE_MARK].draw(&sEffectContext.tireMarks[i].effect, gfxCtx); } } } @@ -222,8 +222,8 @@ void Effect_UpdateAll(GlobalContext* globalCtx) { for (i = 0; i < SPARK_COUNT; i++) { if (1) {} // necessary to match - if (sEffTable.sparks[i].base.active) { - if (sEffInfoTable[0].update(&sEffTable.sparks[i].params) == 1) { + if (sEffectContext.sparks[i].status.active) { + if (sEffectInfoTable[EFFECT_SPARK].update(&sEffectContext.sparks[i].effect) == 1) { Effect_Destroy(globalCtx, i); } } @@ -231,27 +231,27 @@ void Effect_UpdateAll(GlobalContext* globalCtx) { for (i = 0; i < BLURE_COUNT; i++) { if (1) {} // necessary to match - if (sEffTable.blures[i].base.active) { - if (sEffInfoTable[1].update(&sEffTable.blures[i].params) == 1) { - Effect_Destroy(globalCtx, i + 3); + if (sEffectContext.blures[i].status.active) { + if (sEffectInfoTable[EFFECT_BLURE1].update(&sEffectContext.blures[i].effect) == 1) { + Effect_Destroy(globalCtx, i + SPARK_COUNT); } } } for (i = 0; i < SHIELD_PARTICLE_COUNT; i++) { if (1) {} // necessary to match - if (sEffTable.shieldParticles[i].base.active) { - if (sEffInfoTable[3].update(&sEffTable.shieldParticles[i].params) == 1) { - Effect_Destroy(globalCtx, i + 28); + if (sEffectContext.shieldParticles[i].status.active) { + if (sEffectInfoTable[EFFECT_SHIELD_PARTICLE].update(&sEffectContext.shieldParticles[i].effect) == 1) { + Effect_Destroy(globalCtx, i + SPARK_COUNT + BLURE_COUNT); } } } for (i = 0; i < TIRE_MARK_COUNT; i++) { if (1) {} // necessary to match - if (sEffTable.tireMarks[i].base.active) { - if (sEffInfoTable[4].update(&sEffTable.tireMarks[i].params) == 1) { - Effect_Destroy(globalCtx, i + 31); + if (sEffectContext.tireMarks[i].status.active) { + if (sEffectInfoTable[EFFECT_TIRE_MARK].update(&sEffectContext.tireMarks[i].effect) == 1) { + Effect_Destroy(globalCtx, i + SPARK_COUNT + BLURE_COUNT + SHIELD_PARTICLE_COUNT); } } } @@ -263,29 +263,29 @@ void Effect_Destroy(GlobalContext* globalCtx, s32 index) { } if (index < SPARK_COUNT) { - sEffTable.sparks[index].base.active = 0; - sEffInfoTable[0].destroy(&sEffTable.sparks[index].params); + sEffectContext.sparks[index].status.active = false; + sEffectInfoTable[EFFECT_SPARK].destroy(&sEffectContext.sparks[index].effect); return; } index -= SPARK_COUNT; if (index < BLURE_COUNT) { - sEffTable.blures[index].base.active = 0; - sEffInfoTable[1].destroy(&sEffTable.blures[index].params); + sEffectContext.blures[index].status.active = false; + sEffectInfoTable[EFFECT_BLURE1].destroy(&sEffectContext.blures[index].effect); return; } index -= BLURE_COUNT; if (index < SHIELD_PARTICLE_COUNT) { - sEffTable.shieldParticles[index].base.active = 0; - sEffInfoTable[3].destroy(&sEffTable.shieldParticles[index].params); + sEffectContext.shieldParticles[index].status.active = false; + sEffectInfoTable[EFFECT_SHIELD_PARTICLE].destroy(&sEffectContext.shieldParticles[index].effect); return; } index -= SHIELD_PARTICLE_COUNT; if (index < TIRE_MARK_COUNT) { - sEffTable.tireMarks[index].base.active = 0; - sEffInfoTable[4].destroy(&sEffTable.tireMarks[index].params); + sEffectContext.tireMarks[index].status.active = false; + sEffectInfoTable[EFFECT_TIRE_MARK].destroy(&sEffectContext.tireMarks[index].effect); return; } } @@ -294,22 +294,22 @@ void Effect_DestroyAll(GlobalContext* globalCtx) { s32 i; for (i = 0; i < SPARK_COUNT; i++) { - sEffTable.sparks[i].base.active = 0; - sEffInfoTable[0].destroy(&sEffTable.sparks[i].params); + sEffectContext.sparks[i].status.active = false; + sEffectInfoTable[EFFECT_SPARK].destroy(&sEffectContext.sparks[i].effect); } for (i = 0; i < BLURE_COUNT; i++) { - sEffTable.blures[i].base.active = 0; - sEffInfoTable[1].destroy(&sEffTable.blures[i].params); + sEffectContext.blures[i].status.active = false; + sEffectInfoTable[EFFECT_BLURE1].destroy(&sEffectContext.blures[i].effect); } for (i = 0; i < SHIELD_PARTICLE_COUNT; i++) { - sEffTable.shieldParticles[i].base.active = 0; - sEffInfoTable[3].destroy(&sEffTable.shieldParticles[i].params); + sEffectContext.shieldParticles[i].status.active = false; + sEffectInfoTable[EFFECT_SHIELD_PARTICLE].destroy(&sEffectContext.shieldParticles[i].effect); } for (i = 0; i < TIRE_MARK_COUNT; i++) { - sEffTable.tireMarks[i].base.active = 0; - sEffInfoTable[4].destroy(&sEffTable.tireMarks[i].params); + sEffectContext.tireMarks[i].status.active = false; + sEffectInfoTable[EFFECT_TIRE_MARK].destroy(&sEffectContext.tireMarks[i].effect); } } diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c index bf0f977b74..bc4fbf7209 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -278,7 +278,7 @@ static InitChainEntry sInitChain[] = { void EnDinofos_Init(Actor* thisx, GlobalContext* globalCtx) { static s32 D_8089E364 = 0; - static EffBlureInit2 D_8089E368 = { + static EffectBlureInit2 D_8089E368 = { 0, 8, 0, { 255, 255, 255, 255 }, { 255, 255, 255, 64 }, { 255, 255, 255, 0 }, { 255, 255, 255, 0 }, 8, 0, 2, 0, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, }; @@ -288,7 +288,7 @@ void EnDinofos_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, func_800B42F8, 90.0f); - Effect_Add(globalCtx, &this->unk_2A0, 2, 0, 0, &D_8089E368); + Effect_Add(globalCtx, &this->unk_2A0, EFFECT_BLURE2, 0, 0, &D_8089E368); Collider_InitAndSetJntSph(globalCtx, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElement); Collider_InitAndSetQuad(globalCtx, &this->colliderQuad, &this->actor, &sQuadInit); @@ -936,7 +936,7 @@ void func_8089C56C(EnDinofos* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x800); this->actor.world.rot.y = this->actor.shape.rot.y; if (SkelAnime_Update(&this->skelAnime)) { - func_800A8514(Effect_GetParams(this->unk_2A0)); + EffectBlure_AddSpace(Effect_GetByIndex(this->unk_2A0)); this->colliderQuad.base.atFlags &= ~AT_ON; func_8089A9B0(this, globalCtx); } else if (Animation_OnFrame(&this->skelAnime, 7.0f)) { @@ -1454,7 +1454,7 @@ void func_8089DC84(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* Matrix_MultiplyVector3fByState(&D_8089E398, &sp5C); Collider_SetQuadVertices(&this->colliderQuad, &sp5C, &sp68, &sp74, &sp80); if (this->colliderQuad.base.atFlags & AT_ON) { - func_800A81F0(Effect_GetParams(this->unk_2A0), &sp68, &sp5C); + EffectBlure_AddVertex(Effect_GetByIndex(this->unk_2A0), &sp68, &sp5C); } this->unk_292 = this->unk_290; } diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c index 693ea4ec4f..c7a512552d 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -288,7 +288,7 @@ static InitChainEntry sInitChain[] = { }; void EnDodongo_Init(Actor* thisx, GlobalContext* globalCtx) { - static EffBlureInit2 D_80879308 = { + static EffectBlureInit2 D_80879308 = { 2, 8, 0, { 255, 255, 255, 255 }, { 255, 255, 255, 64 }, { 255, 255, 255, 0 }, { 255, 255, 255, 0 }, 8, 0, 0, 0, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, }; @@ -315,7 +315,7 @@ void EnDodongo_Init(Actor* thisx, GlobalContext* globalCtx) { this->collider2.elements[i].info.bumper.dmgFlags = 0x77C34FE6; } - Effect_Add(globalCtx, &this->unk_338, 2, 0, 0, &D_80879308); + Effect_Add(globalCtx, &this->unk_338, EFFECT_BLURE2, 0, 0, &D_80879308); if (this->actor.params == 0) { Actor_SetScale(&this->actor, 3.0f / 160.0f); this->unk_334 = 1.0f; @@ -1099,7 +1099,7 @@ void EnDodongo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList } if ((limbIndex == 30) && (this->actionFunc == func_80878424) && (this->timer != this->unk_304)) { - func_800A81F0(Effect_GetParams(this->unk_338), &this->unk_320, &this->unk_348[4]); + EffectBlure_AddVertex(Effect_GetByIndex(this->unk_338), &this->unk_320, &this->unk_348[4]); this->unk_304 = this->timer; } } diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index 92a2270197..3a74a8a5f5 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -1481,7 +1481,7 @@ void EnGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) { sp50.y = this->actor.floorHeight; sp50.z = this->actor.world.pos.z; sp4C = (((Rand_ZeroOne() * 36.0f) + 250.0f) * this->actor.scale.x) + 10.0f; - func_800AE930(&globalCtx->colCtx, Effect_GetParams(this->unk_248), &sp50, sp4C, + func_800AE930(&globalCtx->colCtx, Effect_GetByIndex(this->unk_248), &sp50, sp4C, this->actor.world.rot.y, this->actor.floorPoly, this->actor.floorBgId); } sp48 = false; @@ -1491,7 +1491,7 @@ void EnGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) { } if (sp48) { - func_800AEF44(Effect_GetParams(this->unk_248)); + func_800AEF44(Effect_GetByIndex(this->unk_248)); } this->actionFunc(this, globalCtx); diff --git a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c index be9d78aed2..db4363228d 100644 --- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c +++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c @@ -401,7 +401,7 @@ s32 func_80B41528(GlobalContext* globalCtx) { } void func_80B415A8(GlobalContext* globalCtx, Vec3f* arg1) { - static EffShieldParticleInit D_80B43298 = { + static EffectShieldParticleInit D_80B43298 = { 16, { 0, 0, 0 }, { 0, 200, 255, 255 }, @@ -426,7 +426,7 @@ void func_80B415A8(GlobalContext* globalCtx, Vec3f* arg1) { D_80B43298.lightPoint.y = D_80B43298.position.y; D_80B43298.lightPoint.z = D_80B43298.position.z; - Effect_Add(globalCtx, &effectIndex, 3, 0, 1, &D_80B43298); + Effect_Add(globalCtx, &effectIndex, EFFECT_SHIELD_PARTICLE, 0, 1, &D_80B43298); } void func_80B4163C(EnKgy* this, GlobalContext* globalCtx) { diff --git a/tools/actorfixer.py b/tools/actorfixer.py index 428c6dee5b..42d1c5bf8e 100755 --- a/tools/actorfixer.py +++ b/tools/actorfixer.py @@ -301,6 +301,9 @@ animdict = { "func_8017F9C0": "Math3D_XZInSphere", "func_8017FA34": "Math3D_XYInSphere", "func_8017FAA8": "Math3D_YZInSphere", + "func_800A81F0": "EffectBlure_AddVertex", + "func_800A8514": "EffectBlure_AddSpace", + "Effect_GetParams": "Effect_GetByIndex", "skelanime.unk03": "skelanime.taper", diff --git a/tools/disasm/files.txt b/tools/disasm/files.txt index 52d498397e..199e5ac148 100644 --- a/tools/disasm/files.txt +++ b/tools/disasm/files.txt @@ -678,6 +678,7 @@ # .bss section 0x801E3FA0 : "code_801E3FA0", 0x801E3FB0 : "z_effect", + 0x801ED890 : "flg_set", 0x801ED8A0 : "z_actor", 0x801ED930 : "z_actor_dlftbls", 0x801ED950 : "z_bgcheck", diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 933f34e68f..bfdce1e060 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -511,28 +511,28 @@ 0x800A8150:("func_800A8150",), 0x800A817C:("func_800A817C",), 0x800A81A4:("func_800A81A4",), - 0x800A81F0:("func_800A81F0",), - 0x800A8514:("func_800A8514",), - 0x800A8558:("EffectBlure_Initcommon",), + 0x800A81F0:("EffectBlure_AddVertex",), + 0x800A8514:("EffectBlure_AddSpace",), + 0x800A8558:("EffectBlure_InitElements",), 0x800A8610:("EffectBlure_Init1",), 0x800A8720:("EffectBlure_Init2",), 0x800A8854:("EffectBlure_Destroy",), 0x800A8860:("EffectBlure_Update",), - 0x800A8C78:("func_800A8C78",), - 0x800A8DE8:("func_800A8DE8",), - 0x800A92FC:("func_800A92FC",), - 0x800A9330:("func_800A9330",), - 0x800A9804:("func_800A9804",), - 0x800AA190:("func_800AA190",), - 0x800AA460:("func_800AA460",), - 0x800AA498:("func_800AA498",), - 0x800AA700:("func_800AA700",), - 0x800AABE0:("func_800AABE0",), + 0x800A8C78:("EffectBlure_UpdateFlags",), + 0x800A8DE8:("EffectBlure_GetComputedValues",), + 0x800A92FC:("EffectBlure_SetupSmooth",), + 0x800A9330:("EffectBlure_DrawElemNoInterpolation",), + 0x800A9804:("EffectBlure_DrawElemHermiteInterpolation",), + 0x800AA190:("EffectBlure_DrawSmooth",), + 0x800AA460:("EffectBlure_SetupSimple",), + 0x800AA498:("EffectBlure_SetupSimpleAlt",), + 0x800AA700:("EffectBlure_DrawSimpleVertices",), + 0x800AABE0:("EffectBlure_DrawSimple",), 0x800AB0EC:("EffectBlure_Draw",), 0x800AB5D0:("EffectShieldParticle_Init",), 0x800AB808:("EffectShieldParticle_Destroy",), 0x800AB894:("EffectShieldParticle_Update",), - 0x800AB9F8:("EffectShieldParticle_CalculateColors",), + 0x800AB9F8:("EffectShieldParticle_GetColors",), 0x800AC718:("EffectShieldParticle_Draw",), 0x800ACBF0:("EffectSpark_Init",), 0x800ACFCC:("EffectSpark_Destroy",), @@ -546,15 +546,15 @@ 0x800AE8EC:("func_800AE8EC",), 0x800AE930:("func_800AE930",), 0x800AEF44:("func_800AEF44",), - 0x800AEF70:("EffectTireMark_InitParticle",), + 0x800AEF70:("EffectTireMark_InitElement",), 0x800AEFA0:("EffectTireMark_Init",), 0x800AF044:("EffectTireMark_Destroy",), 0x800AF050:("EffectTireMark_Update",), - 0x800AF284:("EffectTireMark_InitVertices",), + 0x800AF284:("EffectTireMark_SetVertices",), 0x800AF310:("EffectTireMark_Draw",), - 0x800AF710:("Effect_GetContext",), - 0x800AF720:("Effect_GetParams",), - 0x800AF87C:("Effect_InitCommon",), + 0x800AF710:("Effect_GetGlobalCtx",), + 0x800AF720:("Effect_GetByIndex",), + 0x800AF87C:("Effect_InitStatus",), 0x800AF890:("Effect_Init",), 0x800AF960:("Effect_Add",), 0x800AFB24:("Effect_DrawAll",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 7c3a897acb..1dad67dbd7 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -397,7 +397,7 @@ 0x801AE2CC:("D_801AE2CC","UNK_TYPE4","",0x4), 0x801AE2DC:("D_801AE2DC","UNK_TYPE4","",0x4), 0x801AE2F0:("sEffectShieldParticleVertices","F3DVertex","[4]",0x40), - 0x801AE330:("sEffInfoTable","EffInfo","[5]",0x64), + 0x801AE330:("sEffectInfoTable","EffectInfo","[5]",0x64), 0x801AE3A0:("EffectSS2Info","EffectSsInfo","",0xc), 0x801AE3B0:("D_801AE3B0","Color_RGBA8","",0x4), 0x801AE3B4:("D_801AE3B4","Color_RGBA8","",0x4), @@ -882,8 +882,8 @@ 0x801BA484:("defaultColChkInfo","CollisionCheckInfo","",0x1c), 0x801BA4A0:("sApplyDamageFuncs","ColChkApplyFunc","",0x14), 0x801BA4B4:("sOCLineCheckFuncs","ColChkLineFunc","",0x14), - 0x801BA4C8:("shieldParticleInitMetal","EffShieldParticleInit","",0x40), - 0x801BA508:("shieldParticleInitWood","EffShieldParticleInit","",0x40), + 0x801BA4C8:("shieldParticleInitMetal","EffectShieldParticleInit","",0x40), + 0x801BA508:("shieldParticleInitWood","EffectShieldParticleInit","",0x40), 0x801BA550:("D_801BA550","UNK_TYPE1","",0x1), 0x801BA750:("D_801BA750","UNK_TYPE1","",0x1), 0x801BA790:("sDebugDisplay1DL","UNK_TYPE1","",0x1), @@ -3887,7 +3887,7 @@ 0x801E3BB0:("D_801E3BB0","UNK_TYPE1","",0x1), 0x801E3F40:("gJpegUCodeData","UNK_TYPE1","",0x1), 0x801E3FA0:("D_801E3FA0","UNK_TYPE1","",0x1), - 0x801E3FB0:("sEffTable","EffTables","",0x98E0), + 0x801E3FB0:("sEffectContext","EffectContext","",0x98E0), 0x801ED890:("D_801ED890","UNK_TYPE1","",0x1), 0x801ED894:("D_801ED894","UNK_TYPE1","",0x1), 0x801ED8A0:("D_801ED8A0","UNK_TYPE1","",0x1), @@ -3972,12 +3972,12 @@ 0x801EE1D0:("D_801EE1D0","Vec3f","",0xc), 0x801EE1E0:("D_801EE1E0","Vec3f","",0xc), 0x801EE1F0:("D_801EE1F0","Vec3f","",0xc), - 0x801EE200:("D_801EE200","EffSparkParams","",0x4c4), + 0x801EE200:("D_801EE200","EffectSparkInit","",0x4c4), 0x801EE6C8:("D_801EE6C8","TriNorm","",0x34), 0x801EE700:("D_801EE700","TriNorm","",0x34), - 0x801EE738:("D_801EE738","EffSparkParams","",0x4c4), - 0x801EEC00:("D_801EEC00","EffSparkParams","",0x4c4), - 0x801EF0C8:("D_801EF0C8","EffSparkParams","",0x4c4), + 0x801EE738:("D_801EE738","EffectSparkInit","",0x4c4), + 0x801EEC00:("D_801EEC00","EffectSparkInit","",0x4c4), + 0x801EF0C8:("D_801EF0C8","EffectSparkInit","",0x4c4), 0x801EF590:("D_801EF590","UNK_TYPE1","",0x1), 0x801EF5C8:("D_801EF5C8","UNK_TYPE1","",0x1), 0x801EF600:("D_801EF600","TriNorm","",0x34), @@ -5321,8 +5321,8 @@ 0x8085D2C0:("D_8085D2C0","ActorInitVar","",0x4), 0x8085D2C4:("D_8085D2C4","UNK_TYPE4","",0x4), 0x8085D2CC:("D_8085D2CC","UNK_PTR","",0x4), - 0x8085D30C:("D_8085D30C","EffBlureInit2","",0x24), - 0x8085D330:("D_8085D330","EffTireMarkInit","",0x8), + 0x8085D30C:("D_8085D30C","EffectBlureInit2","",0x24), + 0x8085D330:("D_8085D330","EffectTireMarkInit","",0x8), 0x8085D338:("D_8085D338","UNK_TYPE4","",0x4), 0x8085D33C:("D_8085D33C","UNK_TYPE4","",0x4), 0x8085D340:("D_8085D340","UNK_TYPE1","",0x1), @@ -5972,7 +5972,7 @@ 0x808792D4:("D_808792D4","UNK_TYPE1","",0x1), 0x808792F4:("D_808792F4","UNK_TYPE1","",0x1), 0x808792FC:("D_808792FC","UNK_TYPE1","",0x1), - 0x80879308:("D_80879308","EffBlureInit2","",0x24), + 0x80879308:("D_80879308","EffectBlureInit2","",0x24), 0x8087932C:("D_8087932C","UNK_TYPE1","",0x1), 0x80879330:("D_80879330","UNK_TYPE1","",0x1), 0x80879334:("D_80879334","UNK_TYPE1","",0x1), @@ -6197,10 +6197,10 @@ 0x8088C1C0:("En_Arrow_InitVars","UNK_TYPE1","",0x1), 0x8088C1E0:("D_8088C1E0","UNK_TYPE1","",0x1), 0x8088C230:("D_8088C230","UNK_TYPE1","",0x1), - 0x8088C234:("D_8088C234","EffBlureInit2","",0x24), - 0x8088C258:("D_8088C258","EffBlureInit2","",0x24), - 0x8088C27C:("D_8088C27C","EffBlureInit2","",0x24), - 0x8088C2A0:("D_8088C2A0","EffBlureInit2","",0x24), + 0x8088C234:("D_8088C234","EffectBlureInit2","",0x24), + 0x8088C258:("D_8088C258","EffectBlureInit2","",0x24), + 0x8088C27C:("D_8088C27C","EffectBlureInit2","",0x24), + 0x8088C2A0:("D_8088C2A0","EffectBlureInit2","",0x24), 0x8088C2C4:("D_8088C2C4","UNK_TYPE4","",0x4), 0x8088C2CC:("D_8088C2CC","UNK_TYPE1","",0x1), 0x8088C2D8:("D_8088C2D8","UNK_TYPE1","",0x1), @@ -6409,7 +6409,7 @@ 0x8089E350:("D_8089E350","UNK_TYPE4","",0x4), 0x8089E354:("D_8089E354","UNK_TYPE1","",0x1), 0x8089E364:("D_8089E364","UNK_TYPE4","",0x4), - 0x8089E368:("D_8089E368","EffBlureInit2","",0x24), + 0x8089E368:("D_8089E368","EffectBlureInit2","",0x24), 0x8089E38C:("D_8089E38C","UNK_TYPE1","",0x1), 0x8089E398:("D_8089E398","UNK_TYPE1","",0x1), 0x8089E3A4:("D_8089E3A4","UNK_TYPE1","",0x1), @@ -6896,7 +6896,7 @@ 0x808C99C0:("D_808C99C0","UNK_TYPE1","",0x1), 0x808C9A10:("D_808C9A10","UNK_TYPE1","",0x1), 0x808C9A30:("D_808C9A30","UNK_TYPE1","",0x1), - 0x808C9A3C:("D_808C9A3C","EffBlureInit2","",0x24), + 0x808C9A3C:("D_808C9A3C","EffectBlureInit2","",0x24), 0x808C9A60:("D_808C9A60","UNK_TYPE1","",0x1), 0x808C9A70:("D_808C9A70","UNK_TYPE1","",0x1), 0x808C9A7C:("D_808C9A7C","UNK_TYPE1","",0x1), @@ -7471,7 +7471,7 @@ 0x808F88C0:("En_Bom_Chu_InitVars","UNK_TYPE1","",0x1), 0x808F88E0:("D_808F88E0","UNK_TYPE1","",0x1), 0x808F8908:("D_808F8908","UNK_TYPE2","",0x2), - 0x808F8914:("D_808F8914","EffBlureInit2","",0x24), + 0x808F8914:("D_808F8914","EffectBlureInit2","",0x24), 0x808F8938:("D_808F8938","UNK_TYPE1","",0x1), 0x808F8944:("D_808F8944","UNK_TYPE1","",0x1), 0x808F8950:("D_808F8950","UNK_TYPE1","",0x1), @@ -8280,7 +8280,7 @@ 0x8092C140:("D_8092C140","UNK_TYPE1","",0x1), 0x8092C160:("D_8092C160","UNK_TYPE1","",0x1), 0x8092C168:("D_8092C168","UNK_TYPE1","",0x1), - 0x8092C174:("D_8092C174","EffBlureInit2","",0x24), + 0x8092C174:("D_8092C174","EffectBlureInit2","",0x24), 0x8092C198:("D_8092C198","UNK_TYPE4","",0x4), 0x8092C19C:("D_8092C19C","UNK_TYPE1","",0x1), 0x8092C1A8:("D_8092C1A8","UNK_TYPE1","",0x1), @@ -8592,7 +8592,7 @@ 0x80942E60:("D_80942E60","UNK_TYPE1","",0x1), 0x80942E6C:("D_80942E6C","UNK_TYPE1","",0x1), 0x80942E78:("D_80942E78","UNK_TYPE1","",0x1), - 0x80942E8C:("D_80942E8C","EffTireMarkInit","",0x8), + 0x80942E8C:("D_80942E8C","EffectTireMarkInit","",0x8), 0x80942E94:("D_80942E94","UNK_TYPE1","",0x1), 0x80942E9C:("D_80942E9C","UNK_TYPE1","",0x1), 0x80942EAC:("D_80942EAC","UNK_TYPE1","",0x1), @@ -10698,8 +10698,8 @@ 0x80A07F0C:("D_80A07F0C","UNK_TYPE1","",0x1), 0x80A07F3C:("D_80A07F3C","UNK_TYPE1","",0x1), 0x80A07F54:("D_80A07F54","UNK_TYPE2","",0x2), - 0x80A07F5C:("D_80A07F5C","EffTireMarkInit","",0x8), - 0x80A07F64:("D_80A07F64","EffTireMarkInit","",0x8), + 0x80A07F5C:("D_80A07F5C","EffectTireMarkInit","",0x8), + 0x80A07F64:("D_80A07F64","EffectTireMarkInit","",0x8), 0x80A07F6C:("D_80A07F6C","UNK_TYPE4","",0x4), 0x80A07FA8:("D_80A07FA8","UNK_TYPE4","",0x4), 0x80A07FB4:("D_80A07FB4","UNK_TYPE4","",0x4), @@ -11022,7 +11022,7 @@ 0x80A166B0:("D_80A166B0","UNK_TYPE1","",0x1), 0x80A166BC:("D_80A166BC","UNK_TYPE1","",0x1), 0x80A166D4:("D_80A166D4","UNK_TYPE1","",0x1), - 0x80A166DC:("D_80A166DC","EffTireMarkInit","",0x8), + 0x80A166DC:("D_80A166DC","EffectTireMarkInit","",0x8), 0x80A166E4:("D_80A166E4","UNK_TYPE4","",0x4), 0x80A16704:("D_80A16704","UNK_TYPE1","",0x1), 0x80A1670C:("D_80A1670C","UNK_TYPE1","",0x1), @@ -11683,8 +11683,8 @@ 0x80A4169C:("D_80A4169C","UNK_PTR","",0x4), 0x80A416C0:("D_80A416C0","UNK_PTR","",0x4), 0x80A416E0:("D_80A416E0","UNK_TYPE1","",0x1), - 0x80A417BC:("D_80A417BC","EffBlureInit2","",0x24), - 0x80A417E0:("D_80A417E0","EffTireMarkInit","",0x8), + 0x80A417BC:("D_80A417BC","EffectBlureInit2","",0x24), + 0x80A417E0:("D_80A417E0","EffectTireMarkInit","",0x8), 0x80A417E8:("D_80A417E8","UNK_TYPE1","",0x1), 0x80A417EC:("D_80A417EC","UNK_PTR","",0x4), 0x80A41828:("D_80A41828","UNK_TYPE1","",0x1), @@ -11990,7 +11990,7 @@ 0x80A5844C:("D_80A5844C","UNK_TYPE1","",0x1), 0x80A58454:("D_80A58454","UNK_TYPE4","",0x4), 0x80A58464:("D_80A58464","UNK_TYPE1","",0x1), - 0x80A58470:("D_80A58470","EffBlureInit2","",0x24), + 0x80A58470:("D_80A58470","EffectBlureInit2","",0x24), 0x80A58494:("D_80A58494","UNK_TYPE4","",0x4), 0x80A58498:("D_80A58498","UNK_TYPE1","",0x1), 0x80A584A4:("D_80A584A4","UNK_TYPE1","",0x1), @@ -14583,7 +14583,7 @@ 0x80B40780:("D_80B40780","UNK_TYPE1","",0x1), 0x80B43250:("En_Kgy_InitVars","UNK_TYPE1","",0x1), 0x80B43270:("D_80B43270","UNK_TYPE1","",0x1), - 0x80B43298:("D_80B43298","EffShieldParticleInit","",0x40), + 0x80B43298:("D_80B43298","EffectShieldParticleInit","",0x40), 0x80B432C6:("D_80B432C6","UNK_TYPE1","",0x1), 0x80B432C8:("D_80B432C8","UNK_TYPE1","",0x1), 0x80B432CA:("D_80B432CA","UNK_TYPE1","",0x1), @@ -15795,7 +15795,7 @@ 0x80BB3ED4:("D_80BB3ED4","UNK_TYPE1","",0x1), 0x80BB3EF4:("D_80BB3EF4","UNK_TYPE1","",0x1), 0x80BB4044:("D_80BB4044","UNK_TYPE1","",0x1), - 0x80BB405C:("D_80BB405C","EffTireMarkInit","",0x8), + 0x80BB405C:("D_80BB405C","EffectTireMarkInit","",0x8), 0x80BB4064:("D_80BB4064","UNK_TYPE4","",0x4), 0x80BB4070:("D_80BB4070","UNK_TYPE4","",0x4), 0x80BB407C:("D_80BB407C","UNK_TYPE1","",0x1), @@ -16447,7 +16447,7 @@ 0x80BF5954:("D_80BF5954","UNK_TYPE1","",0x1), 0x80BF5960:("D_80BF5960","UNK_TYPE1","",0x1), 0x80BF596C:("D_80BF596C","UNK_TYPE1","",0x1), - 0x80BF59F0:("D_80BF59F0","EffTireMarkInit","",0x8), + 0x80BF59F0:("D_80BF59F0","EffectTireMarkInit","",0x8), 0x80BF59F8:("D_80BF59F8","UNK_TYPE1","",0x1), 0x80BF5A10:("D_80BF5A10","f32","",0x4), 0x80BF5A14:("D_80BF5A14","f32","",0x4), diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 8a0090f845..b14278276d 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -25,28 +25,28 @@ asm/non_matchings/code/z_en_item00/Item_DropCollectibleRandom.s,Item_DropCollect asm/non_matchings/code/z_en_item00/func_800A8150.s,func_800A8150,0x800A8150,0xB asm/non_matchings/code/z_en_item00/func_800A817C.s,func_800A817C,0x800A817C,0xA asm/non_matchings/code/z_en_item00/func_800A81A4.s,func_800A81A4,0x800A81A4,0x13 -asm/non_matchings/code/z_eff_blure/func_800A81F0.s,func_800A81F0,0x800A81F0,0xC9 -asm/non_matchings/code/z_eff_blure/func_800A8514.s,func_800A8514,0x800A8514,0x11 -asm/non_matchings/code/z_eff_blure/EffectBlure_Initcommon.s,EffectBlure_Initcommon,0x800A8558,0x2E +asm/non_matchings/code/z_eff_blure/EffectBlure_AddVertex.s,EffectBlure_AddVertex,0x800A81F0,0xC9 +asm/non_matchings/code/z_eff_blure/EffectBlure_AddSpace.s,EffectBlure_AddSpace,0x800A8514,0x11 +asm/non_matchings/code/z_eff_blure/EffectBlure_InitElements.s,EffectBlure_InitElements,0x800A8558,0x2E asm/non_matchings/code/z_eff_blure/EffectBlure_Init1.s,EffectBlure_Init1,0x800A8610,0x44 asm/non_matchings/code/z_eff_blure/EffectBlure_Init2.s,EffectBlure_Init2,0x800A8720,0x4D asm/non_matchings/code/z_eff_blure/EffectBlure_Destroy.s,EffectBlure_Destroy,0x800A8854,0x3 asm/non_matchings/code/z_eff_blure/EffectBlure_Update.s,EffectBlure_Update,0x800A8860,0x106 -asm/non_matchings/code/z_eff_blure/func_800A8C78.s,func_800A8C78,0x800A8C78,0x5C -asm/non_matchings/code/z_eff_blure/func_800A8DE8.s,func_800A8DE8,0x800A8DE8,0x145 -asm/non_matchings/code/z_eff_blure/func_800A92FC.s,func_800A92FC,0x800A92FC,0xD -asm/non_matchings/code/z_eff_blure/func_800A9330.s,func_800A9330,0x800A9330,0x135 -asm/non_matchings/code/z_eff_blure/func_800A9804.s,func_800A9804,0x800A9804,0x263 -asm/non_matchings/code/z_eff_blure/func_800AA190.s,func_800AA190,0x800AA190,0xB4 -asm/non_matchings/code/z_eff_blure/func_800AA460.s,func_800AA460,0x800AA460,0xE -asm/non_matchings/code/z_eff_blure/func_800AA498.s,func_800AA498,0x800AA498,0x9A -asm/non_matchings/code/z_eff_blure/func_800AA700.s,func_800AA700,0x800AA700,0x138 -asm/non_matchings/code/z_eff_blure/func_800AABE0.s,func_800AABE0,0x800AABE0,0x143 +asm/non_matchings/code/z_eff_blure/EffectBlure_UpdateFlags.s,EffectBlure_UpdateFlags,0x800A8C78,0x5C +asm/non_matchings/code/z_eff_blure/EffectBlure_GetComputedValues.s,EffectBlure_GetComputedValues,0x800A8DE8,0x145 +asm/non_matchings/code/z_eff_blure/EffectBlure_SetupSmooth.s,EffectBlure_SetupSmooth,0x800A92FC,0xD +asm/non_matchings/code/z_eff_blure/EffectBlure_DrawElemNoInterpolation.s,EffectBlure_DrawElemNoInterpolation,0x800A9330,0x135 +asm/non_matchings/code/z_eff_blure/EffectBlure_DrawElemHermiteInterpolation.s,EffectBlure_DrawElemHermiteInterpolation,0x800A9804,0x263 +asm/non_matchings/code/z_eff_blure/EffectBlure_DrawSmooth.s,EffectBlure_DrawSmooth,0x800AA190,0xB4 +asm/non_matchings/code/z_eff_blure/EffectBlure_SetupSimple.s,EffectBlure_SetupSimple,0x800AA460,0xE +asm/non_matchings/code/z_eff_blure/EffectBlure_SetupSimpleAlt.s,EffectBlure_SetupSimpleAlt,0x800AA498,0x9A +asm/non_matchings/code/z_eff_blure/EffectBlure_DrawSimpleVertices.s,EffectBlure_DrawSimpleVertices,0x800AA700,0x138 +asm/non_matchings/code/z_eff_blure/EffectBlure_DrawSimple.s,EffectBlure_DrawSimple,0x800AABE0,0x143 asm/non_matchings/code/z_eff_blure/EffectBlure_Draw.s,EffectBlure_Draw,0x800AB0EC,0x139 asm/non_matchings/code/z_eff_shield_particle/EffectShieldParticle_Init.s,EffectShieldParticle_Init,0x800AB5D0,0x8E asm/non_matchings/code/z_eff_shield_particle/EffectShieldParticle_Destroy.s,EffectShieldParticle_Destroy,0x800AB808,0x23 asm/non_matchings/code/z_eff_shield_particle/EffectShieldParticle_Update.s,EffectShieldParticle_Update,0x800AB894,0x59 -asm/non_matchings/code/z_eff_shield_particle/EffectShieldParticle_CalculateColors.s,EffectShieldParticle_CalculateColors,0x800AB9F8,0x348 +asm/non_matchings/code/z_eff_shield_particle/EffectShieldParticle_GetColors.s,EffectShieldParticle_GetColors,0x800AB9F8,0x348 asm/non_matchings/code/z_eff_shield_particle/EffectShieldParticle_Draw.s,EffectShieldParticle_Draw,0x800AC718,0x136 asm/non_matchings/code/z_eff_spark/EffectSpark_Init.s,EffectSpark_Init,0x800ACBF0,0xF7 asm/non_matchings/code/z_eff_spark/EffectSpark_Destroy.s,EffectSpark_Destroy,0x800ACFCC,0x3 @@ -60,15 +60,15 @@ asm/non_matchings/code/z_eff_ss_dead/func_800AE778.s,func_800AE778,0x800AE778,0x asm/non_matchings/code/z_eff_ss_dead/func_800AE8EC.s,func_800AE8EC,0x800AE8EC,0x11 asm/non_matchings/code/z_eff_tire_mark/func_800AE930.s,func_800AE930,0x800AE930,0x185 asm/non_matchings/code/z_eff_tire_mark/func_800AEF44.s,func_800AEF44,0x800AEF44,0xB -asm/non_matchings/code/z_eff_tire_mark/EffectTireMark_InitParticle.s,EffectTireMark_InitParticle,0x800AEF70,0xC +asm/non_matchings/code/z_eff_tire_mark/EffectTireMark_InitElement.s,EffectTireMark_InitElement,0x800AEF70,0xC asm/non_matchings/code/z_eff_tire_mark/EffectTireMark_Init.s,EffectTireMark_Init,0x800AEFA0,0x29 asm/non_matchings/code/z_eff_tire_mark/EffectTireMark_Destroy.s,EffectTireMark_Destroy,0x800AF044,0x3 asm/non_matchings/code/z_eff_tire_mark/EffectTireMark_Update.s,EffectTireMark_Update,0x800AF050,0x8D -asm/non_matchings/code/z_eff_tire_mark/EffectTireMark_InitVertices.s,EffectTireMark_InitVertices,0x800AF284,0x23 +asm/non_matchings/code/z_eff_tire_mark/EffectTireMark_SetVertices.s,EffectTireMark_SetVertices,0x800AF284,0x23 asm/non_matchings/code/z_eff_tire_mark/EffectTireMark_Draw.s,EffectTireMark_Draw,0x800AF310,0x100 -asm/non_matchings/code/z_effect/Effect_GetContext.s,Effect_GetContext,0x800AF710,0x4 -asm/non_matchings/code/z_effect/Effect_GetParams.s,Effect_GetParams,0x800AF720,0x57 -asm/non_matchings/code/z_effect/Effect_InitCommon.s,Effect_InitCommon,0x800AF87C,0x5 +asm/non_matchings/code/z_effect/Effect_GetGlobalCtx.s,Effect_GetGlobalCtx,0x800AF710,0x4 +asm/non_matchings/code/z_effect/Effect_GetByIndex.s,Effect_GetByIndex,0x800AF720,0x57 +asm/non_matchings/code/z_effect/Effect_InitStatus.s,Effect_InitStatus,0x800AF87C,0x5 asm/non_matchings/code/z_effect/Effect_Init.s,Effect_Init,0x800AF890,0x34 asm/non_matchings/code/z_effect/Effect_Add.s,Effect_Add,0x800AF960,0x71 asm/non_matchings/code/z_effect/Effect_DrawAll.s,Effect_DrawAll,0x800AFB24,0x4F