Effect Dust OK (#1016)

* OK

* Some cleanup

* Description

* format

* Better name

* whoops

* Array count

* Name dust texture arrays

* Fix

* static

* Update dust tex outnames
This commit is contained in:
Derek Hensley 2022-09-24 10:04:03 -07:00 committed by GitHub
parent 2c6816ba77
commit f31056ef8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 245 additions and 61 deletions

View File

@ -905,7 +905,7 @@
<Blob Name="gameplay_keep_zeroes_unk_00022E78" Size="0xA8" Offset="0x22E78" />
<Animation Name="gameplay_keep_Anim_022FF0" Offset="0x22FF0" />
<Collision Name="gDoorCol" Offset="0x23100" />
<DList Name="gameplay_keep_DL_023130" Offset="0x23130" />
<DList Name="gEffDustDL" Offset="0x23130" />
<DList Name="gOwlStatueWhiteFlashDL" Offset="0x23210" />
<DList Name="gameplay_keep_DL_023288" Offset="0x23288" />
<DList Name="gLightOrb1DL" Offset="0x23348" />
@ -1427,14 +1427,14 @@
<Texture Name="gameplay_keep_Tex_08D3E0" OutName="tex_08D3E0" Format="i8" Width="64" Height="32" Offset="0x8D3E0" />
<!-- Dust Textures -->
<Texture Name="gDust1Tex" OutName="dust_1" Format="i8" Width="32" Height="32" Offset="0x8DBE0" />
<Texture Name="gDust2Tex" OutName="dust_2" Format="i8" Width="32" Height="32" Offset="0x8DFE0" />
<Texture Name="gDust3Tex" OutName="dust_3" Format="i8" Width="32" Height="32" Offset="0x8E3E0" />
<Texture Name="gDust4Tex" OutName="dust_4" Format="i8" Width="32" Height="32" Offset="0x8E7E0" />
<Texture Name="gDust5Tex" OutName="dust_5" Format="i8" Width="32" Height="32" Offset="0x8EBE0" />
<Texture Name="gDust6Tex" OutName="dust_6" Format="i8" Width="32" Height="32" Offset="0x8EFE0" />
<Texture Name="gDust7Tex" OutName="dust_7" Format="i8" Width="32" Height="32" Offset="0x8F3E0" />
<Texture Name="gDust8Tex" OutName="dust_8" Format="i8" Width="32" Height="32" Offset="0x8F7E0" />
<Texture Name="gEffDust1Tex" OutName="eff_dust_1" Format="i8" Width="32" Height="32" Offset="0x8DBE0" />
<Texture Name="gEffDust2Tex" OutName="eff_dust_2" Format="i8" Width="32" Height="32" Offset="0x8DFE0" />
<Texture Name="gEffDust3Tex" OutName="eff_dust_3" Format="i8" Width="32" Height="32" Offset="0x8E3E0" />
<Texture Name="gEffDust4Tex" OutName="eff_dust_4" Format="i8" Width="32" Height="32" Offset="0x8E7E0" />
<Texture Name="gEffDust5Tex" OutName="eff_dust_5" Format="i8" Width="32" Height="32" Offset="0x8EBE0" />
<Texture Name="gEffDust6Tex" OutName="eff_dust_6" Format="i8" Width="32" Height="32" Offset="0x8EFE0" />
<Texture Name="gEffDust7Tex" OutName="eff_dust_7" Format="i8" Width="32" Height="32" Offset="0x8F3E0" />
<Texture Name="gEffDust8Tex" OutName="eff_dust_8" Format="i8" Width="32" Height="32" Offset="0x8F7E0" />
<Texture Name="gameplay_keep_Tex_08FBE0" OutName="tex_08FBE0" Format="i8" Width="32" Height="64" Offset="0x8FBE0" />
<Texture Name="gameplay_keep_Tex_0903E0" OutName="tex_0903E0" Format="i8" Width="32" Height="64" Offset="0x903E0" />

3
spec
View File

@ -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

View File

@ -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,

View File

@ -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);

View File

@ -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();

View File

@ -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);
}
}

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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++;

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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",),

View File

@ -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),