diff --git a/assets/xml/objects/gameplay_keep.xml b/assets/xml/objects/gameplay_keep.xml index 4f1ad1841a..e042feda0c 100644 --- a/assets/xml/objects/gameplay_keep.xml +++ b/assets/xml/objects/gameplay_keep.xml @@ -905,7 +905,7 @@ - + @@ -1427,14 +1427,14 @@ - - - - - - - - + + + + + + + + diff --git a/spec b/spec index cc7babd858..493bc01818 100644 --- a/spec +++ b/spec @@ -1737,8 +1737,7 @@ beginseg name "ovl_Effect_Ss_Dust" compress include "build/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.o" - include "build/data/ovl_Effect_Ss_Dust/ovl_Effect_Ss_Dust.data.o" - include "build/data/ovl_Effect_Ss_Dust/ovl_Effect_Ss_Dust.reloc.o" + include "build/src/overlays/effects/ovl_Effect_Ss_Dust/ovl_Effect_Ss_Dust_reloc.o" endseg beginseg diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index 5258c2ecf6..9bdb0f9a4d 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -91,63 +91,76 @@ void EffectSsDust_Spawn(PlayState* play, u16 drawFlags, Vec3f* pos, Vec3f* veloc void func_800B0DE0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep) { - EffectSsDust_Spawn(play, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 0); + EffectSsDust_Spawn(play, DUST_DRAWFLAG0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, + DUST_UPDATE_NORMAL); } void func_800B0E48(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep) { - EffectSsDust_Spawn(play, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 0); + EffectSsDust_Spawn(play, DUST_DRAWFLAG1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, + DUST_UPDATE_NORMAL); } void func_800B0EB0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life) { - EffectSsDust_Spawn(play, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0); + EffectSsDust_Spawn(play, DUST_DRAWFLAG0, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, + DUST_UPDATE_NORMAL); } void func_800B0F18(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life) { - EffectSsDust_Spawn(play, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0); + EffectSsDust_Spawn(play, DUST_DRAWFLAG1, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, + DUST_UPDATE_NORMAL); } void func_800B0F80(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life) { - EffectSsDust_Spawn(play, 2, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0); + EffectSsDust_Spawn(play, DUST_DRAWFLAG2, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, + DUST_UPDATE_NORMAL); } void func_800B0FE8(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep) { - EffectSsDust_Spawn(play, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 1); + EffectSsDust_Spawn(play, DUST_DRAWFLAG0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, + DUST_UPDATE_FIRE); } void func_800B1054(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep) { - EffectSsDust_Spawn(play, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 1); + EffectSsDust_Spawn(play, DUST_DRAWFLAG1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, + DUST_UPDATE_FIRE); } static Color_RGBA8 sDustBrownPrim = { 170, 130, 90, 255 }; static Color_RGBA8 sDustBrownEnv = { 100, 60, 20, 255 }; void func_800B10C0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { - EffectSsDust_Spawn(play, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0); + EffectSsDust_Spawn(play, DUST_DRAWFLAG_RAND_COLOR_OFFSET | DUST_DRAWFLAG0, pos, velocity, accel, &sDustBrownPrim, + &sDustBrownEnv, 100, 5, 10, DUST_UPDATE_NORMAL); } void func_800B1130(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { - EffectSsDust_Spawn(play, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0); + EffectSsDust_Spawn(play, DUST_DRAWFLAG_RAND_COLOR_OFFSET | DUST_DRAWFLAG1, pos, velocity, accel, &sDustBrownPrim, + &sDustBrownEnv, 100, 5, 10, DUST_UPDATE_NORMAL); } void func_800B11A0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) { - EffectSsDust_Spawn(play, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, 10, 0); + EffectSsDust_Spawn(play, DUST_DRAWFLAG_RAND_COLOR_OFFSET | DUST_DRAWFLAG0, pos, velocity, accel, &sDustBrownPrim, + &sDustBrownEnv, scale, scaleStep, 10, DUST_UPDATE_NORMAL); } void func_800B1210(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) { - EffectSsDust_Spawn(play, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, 10, 0); + EffectSsDust_Spawn(play, DUST_DRAWFLAG_RAND_COLOR_OFFSET | DUST_DRAWFLAG1, pos, velocity, accel, &sDustBrownPrim, + &sDustBrownEnv, scale, scaleStep, 10, DUST_UPDATE_NORMAL); } void func_800B1280(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life) { - EffectSsDust_Spawn(play, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, life, 0); + EffectSsDust_Spawn(play, DUST_DRAWFLAG_RAND_COLOR_OFFSET | DUST_DRAWFLAG0, pos, velocity, accel, &sDustBrownPrim, + &sDustBrownEnv, scale, scaleStep, life, DUST_UPDATE_NORMAL); } void func_800B12F0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life) { - EffectSsDust_Spawn(play, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, life, 0); + EffectSsDust_Spawn(play, DUST_DRAWFLAG_RAND_COLOR_OFFSET | DUST_DRAWFLAG1, pos, velocity, accel, &sDustBrownPrim, + &sDustBrownEnv, scale, scaleStep, life, DUST_UPDATE_NORMAL); } void func_800B1360(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.c b/src/overlays/actors/ovl_Boss_03/z_boss_03.c index 84987a9f5c..23aa023dac 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c @@ -2428,7 +2428,7 @@ void Boss03_DrawEffects(PlayState* play) { if (!flag) { POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0); - gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gDust1Tex)); + gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gEffDust1Tex)); gSPDisplayList(POLY_XLU_DISP++, object_water_effect_DL_004260); gDPSetEnvColor(POLY_XLU_DISP++, 250, 250, 255, 0); @@ -2462,7 +2462,7 @@ void Boss03_DrawEffects(PlayState* play) { if (!flag) { func_8012C448(gfxCtx); - gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gDust1Tex)); + gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gEffDust1Tex)); gDPSetEnvColor(POLY_XLU_DISP++, 250, 250, 255, 0); gSPDisplayList(POLY_XLU_DISP++, object_water_effect_DL_004260); diff --git a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c index 3b4ab74ae1..d663bcf740 100644 --- a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c +++ b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c @@ -252,8 +252,8 @@ s32 func_80A5086C(EnDnbUnkStruct* arg0) { } s32 func_80A50950(EnDnbUnkStruct* arg0, PlayState* play2) { - static TexturePtr D_80A50CBC[] = { - gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex, + static TexturePtr sDustTextures[] = { + gEffDust8Tex, gEffDust7Tex, gEffDust6Tex, gEffDust5Tex, gEffDust4Tex, gEffDust3Tex, gEffDust2Tex, gEffDust1Tex, }; PlayState* play = play2; s32 isGfxSetup = false; @@ -286,7 +286,7 @@ s32 func_80A50950(EnDnbUnkStruct* arg0, PlayState* play2) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); idx = (arg0->unk_01 / (f32)arg0->unk_02) * 8.0f; - gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A50CBC[idx])); + gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sDustTextures[idx])); gSPDisplayList(POLY_XLU_DISP++, object_hanareyama_obj_DL_000020); Matrix_Pop(); diff --git a/src/overlays/actors/ovl_En_Fg/z_en_fg.c b/src/overlays/actors/ovl_En_Fg/z_en_fg.c index 8ad22ff53d..cacc2e728f 100644 --- a/src/overlays/actors/ovl_En_Fg/z_en_fg.c +++ b/src/overlays/actors/ovl_En_Fg/z_en_fg.c @@ -444,8 +444,8 @@ void EnFg_UpdateDust(EnFgEffectDust* dustEffect) { } } -TexturePtr sDustTex[] = { - gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex, +static TexturePtr sDustTextures[] = { + gEffDust8Tex, gEffDust7Tex, gEffDust6Tex, gEffDust5Tex, gEffDust4Tex, gEffDust3Tex, gEffDust2Tex, gEffDust1Tex, }; void EnFg_DrawDust(PlayState* play, EnFgEffectDust* dustEffect) { @@ -475,7 +475,7 @@ void EnFg_DrawDust(PlayState* play, EnFgEffectDust* dustEffect) { Matrix_Scale(dustEffect->xyScale, dustEffect->xyScale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); index = 0.5f * dustEffect->timer; - gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sDustTex[index])); + gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sDustTextures[index])); gSPDisplayList(POLY_XLU_DISP++, object_fr_DL_00B338); } } diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 491e1c95e5..976489fd9e 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -299,8 +299,8 @@ void func_80A1143C(EnGoStruct* ptr, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32 arg4 } void func_80A115B4(EnGoStruct* ptr, PlayState* play) { - static TexturePtr D_80A16644[] = { - gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex, + static TexturePtr sDustTextures[] = { + gEffDust8Tex, gEffDust7Tex, gEffDust6Tex, gEffDust5Tex, gEffDust4Tex, gEffDust3Tex, gEffDust2Tex, gEffDust1Tex, }; static Color_RGBA8 D_80A16664[] = { { 255, 255, 255, 0 }, @@ -341,7 +341,7 @@ void func_80A115B4(EnGoStruct* ptr, PlayState* play) { Matrix_ReplaceRotation(&play->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A16644[(s32)(temp * 7.0f)])); + gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sDustTextures[(s32)(temp * 7.0f)])); gSPDisplayList(POLY_XLU_DISP++, gGoronDustModelDL); Matrix_Pop(); diff --git a/src/overlays/actors/ovl_En_Rg/z_en_rg.c b/src/overlays/actors/ovl_En_Rg/z_en_rg.c index 896947fa60..2d976bdd5c 100644 --- a/src/overlays/actors/ovl_En_Rg/z_en_rg.c +++ b/src/overlays/actors/ovl_En_Rg/z_en_rg.c @@ -123,8 +123,8 @@ AnimationInfoS D_80BF5914[] = { { &gGoronUnrollAnim, -2.0f, 0, -1, ANIMMODE_ONCE, 0 }, }; -TexturePtr D_80BF5934[] = { - gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex, +static TexturePtr sDustTextures[] = { + gEffDust8Tex, gEffDust7Tex, gEffDust6Tex, gEffDust5Tex, gEffDust4Tex, gEffDust3Tex, gEffDust2Tex, gEffDust1Tex, }; Color_RGBA8 D_80BF5954[] = { @@ -190,7 +190,7 @@ void func_80BF3920(EnRgStruct* ptr, PlayState* play) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); idx = temp_f20 * 7.0f; - gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80BF5934[idx])); + gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sDustTextures[idx])); gSPDisplayList(POLY_XLU_DISP++, gGoronDustModelDL); Matrix_Pop(); diff --git a/src/overlays/actors/ovl_En_Tru/z_en_tru.c b/src/overlays/actors/ovl_En_Tru/z_en_tru.c index 996a32befe..42cbdc22a1 100644 --- a/src/overlays/actors/ovl_En_Tru/z_en_tru.c +++ b/src/overlays/actors/ovl_En_Tru/z_en_tru.c @@ -80,8 +80,8 @@ static Color_RGBA8 D_80A8B25C[] = { static f32 D_80A8B274[] = { 60.0f, 255.0f, 60.0f }; -static TexturePtr D_80A8B280[] = { - gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex, +static TexturePtr sDustTextures[] = { + gEffDust8Tex, gEffDust7Tex, gEffDust6Tex, gEffDust5Tex, gEffDust4Tex, gEffDust3Tex, gEffDust2Tex, gEffDust1Tex, }; static ColliderSphereInit sSphereInit = { @@ -307,7 +307,7 @@ void func_80A85F84(EnTruUnkStruct* arg0, PlayState* play) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); idx = ((f32)arg0->unk_02 / arg0->unk_01) * 8.0f; - gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A8B280[idx])); + gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sDustTextures[idx])); gSPDisplayList(POLY_XLU_DISP++, object_tru_DL_01A830); Matrix_Pop(); diff --git a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c index 499ca365f2..92bec240eb 100644 --- a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c +++ b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c @@ -285,7 +285,7 @@ void EnWaterEffect_Draw(Actor* thisx, PlayState* play2) { if (!phi_s4) { POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0); - gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gDust1Tex)); + gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gEffDust1Tex)); gSPDisplayList(POLY_XLU_DISP++, object_water_effect_DL_004260); gDPSetEnvColor(POLY_XLU_DISP++, 250, 250, 255, 0); phi_s4++; @@ -317,7 +317,7 @@ void EnWaterEffect_Draw(Actor* thisx, PlayState* play2) { if (!phi_s4) { func_8012C448(gfxCtx); - gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gDust1Tex)); + gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gEffDust1Tex)); gDPSetEnvColor(POLY_XLU_DISP++, 250, 250, 255, 0); gSPDisplayList(POLY_XLU_DISP++, object_water_effect_DL_004260); phi_s4++; @@ -678,7 +678,7 @@ void func_80A5A6B8(Actor* thisx, PlayState* play2) { if (!phi_s4) { func_8012C448(play->state.gfxCtx); - gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gDust1Tex)); + gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gEffDust1Tex)); gDPSetEnvColor(POLY_XLU_DISP++, 250, 250, 255, 0); gSPDisplayList(POLY_XLU_DISP++, object_water_effect_DL_004260); phi_s4++; diff --git a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index 0247cd23a7..4057ff8175 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -554,7 +554,7 @@ void func_808DD3C8(Actor* thisx, PlayState* play2) { gDPSetRenderMode(POLY_XLU_DISP++, G_RM_FOG_SHADE_A, G_RM_ZB_CLD_SURF2); gSPSetGeometryMode(POLY_XLU_DISP++, G_FOG); - gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gDust5Tex)); + gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gEffDust5Tex)); } Matrix_Translate(worldPos.x, worldPos.y, worldPos.z, MTXMODE_NEW); @@ -569,7 +569,7 @@ void func_808DD3C8(Actor* thisx, PlayState* play2) { Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_023130); + gSPDisplayList(POLY_XLU_DISP++, gEffDustDL); } } @@ -629,14 +629,14 @@ void func_808DD970(Actor* thisx, PlayState* play2) { Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gDust5Tex)); + gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gEffDust5Tex)); gSPClearGeometryMode(POLY_XLU_DISP++, G_LIGHTING); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0); gDPSetRenderMode(POLY_XLU_DISP++, G_RM_FOG_SHADE_A, G_RM_ZB_CLD_SURF2); gSPSetGeometryMode(POLY_XLU_DISP++, G_FOG); - gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_023130); + gSPDisplayList(POLY_XLU_DISP++, gEffDustDL); } } diff --git a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c index c3a72bb7fb..7a2274a5df 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c @@ -1,30 +1,192 @@ /* * File: z_eff_ss_dust.c * Overlay: ovl_Effect_Ss_Dust - * Description: + * Description: Dust Particle Effect */ #include "z_eff_ss_dust.h" +#include "objects/gameplay_keep/gameplay_keep.h" + +#define rPrimColorR regs[0] +#define rPrimColorG regs[1] +#define rPrimColorB regs[2] +#define rPrimColorA regs[3] +#define rEnvColorR regs[4] +#define rEnvColorG regs[5] +#define rEnvColorB regs[6] +#define rEnvColorA regs[7] +#define rTexIndex regs[8] // this reg is also used to set specific colors in the fire update function +#define rScale regs[9] +#define rScaleStep regs[10] +#define rDrawFlags regs[11] +#define rLifespan regs[12] #define PARAMS ((EffectSsDustInitParams*)initParamsx) -s32 EffectSsDust_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); -void func_809776BC(PlayState* play, u32 index, EffectSs* this); -void func_809777B4(PlayState* play, u32 index, EffectSs* this); +u32 EffectSsDust_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsDust_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsDust_UpdateFire(PlayState* play, u32 index, EffectSs* this); void EffectSsDust_Draw(PlayState* play, u32 index, EffectSs* this); -#if 0 const EffectSsInit Effect_Ss_Dust_InitVars = { EFFECT_SS_DUST, EffectSsDust_Init, }; -#endif +static EffectSsUpdateFunc sUpdateFuncs[] = { + EffectSsDust_Update, + EffectSsDust_UpdateFire, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dust/EffectSsDust_Init.s") +static TexturePtr sDustTextures[] = { + gEffDust1Tex, gEffDust2Tex, gEffDust3Tex, gEffDust4Tex, gEffDust5Tex, gEffDust6Tex, gEffDust7Tex, gEffDust8Tex, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dust/EffectSsDust_Draw.s") +u32 EffectSsDust_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { + EffectSsDustInitParams* initParams = PARAMS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dust/func_809776BC.s") + Math_Vec3f_Copy(&this->pos, &initParams->pos); + Math_Vec3f_Copy(&this->velocity, &initParams->velocity); + Math_Vec3f_Copy(&this->accel, &initParams->accel); + this->gfx = gEffDustDL; + this->life = initParams->life; + this->update = sUpdateFuncs[initParams->updateMode]; + this->draw = EffectSsDust_Draw; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dust/func_809777B4.s") + if (initParams->drawFlags & DUST_DRAWFLAG_RAND_COLOR_OFFSET) { + s32 randColorOffset = Rand_ZeroOne() * 20.0f - 10.0f; + + this->rPrimColorR = initParams->primColor.r + randColorOffset; + this->rPrimColorG = initParams->primColor.g + randColorOffset; + this->rPrimColorB = initParams->primColor.b + randColorOffset; + this->rEnvColorR = initParams->envColor.r + randColorOffset; + this->rEnvColorG = initParams->envColor.g + randColorOffset; + this->rEnvColorB = initParams->envColor.b + randColorOffset; + } else { + this->rPrimColorR = initParams->primColor.r; + this->rPrimColorG = initParams->primColor.g; + this->rPrimColorB = initParams->primColor.b; + this->rEnvColorR = initParams->envColor.r; + this->rEnvColorG = initParams->envColor.g; + this->rEnvColorB = initParams->envColor.b; + } + + this->rPrimColorA = initParams->primColor.a; + this->rEnvColorA = initParams->envColor.a; + this->rTexIndex = 0; + this->rScale = initParams->scale; + this->rScaleStep = initParams->scaleStep; + this->rLifespan = initParams->life; + this->rDrawFlags = initParams->drawFlags; + + return 1; +} + +void EffectSsDust_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; + MtxF mfTrans; + MtxF mfScale; + MtxF mfResult; + MtxF mfTransBillboard; + s32 pad; + Mtx* mtx; + f32 scale; + + OPEN_DISPS(gfxCtx); + + scale = this->rScale * 0.0025f; + SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); + SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard); + SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult); + gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); + + if (mtx != NULL) { + gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPPipeSync(POLY_XLU_DISP++); + gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sDustTextures[this->rTexIndex])); + POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0); + gDPPipeSync(POLY_XLU_DISP++); + + if (this->rDrawFlags & DUST_DRAWFLAG1) { + gDPSetCombineLERP(POLY_XLU_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, 0, TEXEL0, 0, + COMBINED, 0, SHADE, 0, 0, 0, 0, COMBINED); + gDPSetRenderMode(POLY_XLU_DISP++, G_RM_FOG_SHADE_A, G_RM_ZB_CLD_SURF2); + gSPSetGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING); + } else if (this->rDrawFlags & DUST_DRAWFLAG2) { + gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_ZB_CLD_SURF2); + gSPClearGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING); + } else { // DUST_DRAWFLAG0 + gSPClearGeometryMode(POLY_XLU_DISP++, G_LIGHTING); + } + + gDPPipeSync(POLY_XLU_DISP++); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, 255); + gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, this->rEnvColorA); + gSPDisplayList(POLY_XLU_DISP++, this->gfx); + } + + CLOSE_DISPS(gfxCtx); +} + +void EffectSsDust_Update(PlayState* play, u32 index, EffectSs* this) { + this->accel.x = (Rand_ZeroOne() * 0.4f) - 0.2f; + this->accel.z = (Rand_ZeroOne() * 0.4f) - 0.2f; + + if ((this->life <= this->rLifespan) && (this->life >= (this->rLifespan - 7))) { + if (this->rLifespan >= 5) { + this->rTexIndex = this->rLifespan - this->life; + } else { + this->rTexIndex = ((this->rLifespan - this->life) * (ARRAY_COUNT(sDustTextures) / this->rLifespan)); + } + } else { + this->rTexIndex = ARRAY_COUNT(sDustTextures) - 1; + } + + this->rScale += this->rScaleStep; +} + +// this update mode is unused in the original game +void EffectSsDust_UpdateFire(PlayState* play, u32 index, EffectSs* this) { + this->accel.x = (Rand_ZeroOne() * 0.4f) - 0.2f; + this->accel.z = (Rand_ZeroOne() * 0.4f) - 0.2f; + + switch (this->rTexIndex) { + case 0: + this->rPrimColorR = 255; + this->rPrimColorG = 150; + this->rPrimColorB = 0; + this->rEnvColorR = 150; + this->rEnvColorG = 50; + this->rEnvColorB = 0; + break; + case 1: + this->rPrimColorR = 200; + this->rPrimColorG = 50; + this->rPrimColorB = 0; + this->rEnvColorR = 100; + this->rEnvColorG = 0; + this->rEnvColorB = 0; + break; + case 2: + this->rPrimColorR = 50; + this->rPrimColorG = 0; + this->rPrimColorB = 0; + this->rEnvColorR = 0; + this->rEnvColorG = 0; + this->rEnvColorB = 0; + break; + case 3: + this->rPrimColorR = 50; + this->rEnvColorR = this->rPrimColorG = this->rEnvColorG = this->rPrimColorB = this->rEnvColorB = 0; + break; + } + + if (this->rTexIndex < (ARRAY_COUNT(sDustTextures) - 1)) { + this->rTexIndex++; + } + + this->rScale += this->rScaleStep; +} diff --git a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h index 7e8bfbfb8e..410a143521 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h +++ b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h @@ -3,6 +3,16 @@ #include "global.h" +#define DUST_DRAWFLAG0 (0) +#define DUST_DRAWFLAG1 (1 << 0) +#define DUST_DRAWFLAG2 (1 << 1) +#define DUST_DRAWFLAG_RAND_COLOR_OFFSET (1 << 2) + +typedef enum { + /* 0 */ DUST_UPDATE_NORMAL, + /* 1 */ DUST_UPDATE_FIRE +} DustUpdateMode; + typedef struct { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 52e28708d8..be488e0d97 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -8129,8 +8129,8 @@ 0x809765A0:("OceffWipe_Draw",), 0x80977210:("EffectSsDust_Init",), 0x80977394:("EffectSsDust_Draw",), - 0x809776BC:("func_809776BC",), - 0x809777B4:("func_809777B4",), + 0x809776BC:("EffectSsDust_Update",), + 0x809777B4:("EffectSsDust_UpdateFire",), 0x80977A00:("EffectSsKirakira_Init",), 0x80977B5C:("EffectSsKirakira_Draw",), 0x80977DB4:("func_80977DB4",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index ab53189360..94a59d6954 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -12339,7 +12339,7 @@ 0x80A8B188:("D_80A8B188","UNK_TYPE1","",0x1), 0x80A8B250:("D_80A8B250","UNK_TYPE4","",0x4), 0x80A8B25C:("D_80A8B25C","Color_RGBA8","[6]",0x18), - 0x80A8B280:("D_80A8B280","UNK_TYPE1","",0x1), + 0x80A8B280:("sDustTextures","UNK_TYPE1","",0x1), 0x80A8B2A0:("D_80A8B2A0","UNK_TYPE1","",0x1), 0x80A8B2CC:("D_80A8B2CC","UNK_TYPE1","",0x1), 0x80A8B2D8:("sAnimationInfo","UNK_TYPE1","",0x1),