diff options
| author | Derek Hensley <hensley.derek58@gmail.com> | 2022-07-11 18:51:56 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-11 21:51:56 -0400 |
| commit | 0346fde02b58174ed7f9a4644af8329b522f2bc9 (patch) | |
| tree | 16a0827e9de809a7857ee0ecae4fc30ed725bd43 /src | |
| parent | f85a398162c2aef25e732cdea9741b52ab64c57f (diff) | |
Effect Gsplash OK (#876)
* Ok
* Save?
* undef syms
Diffstat (limited to 'src')
| -rw-r--r-- | src/code/z_effect_soft_sprite_old_init.c | 2 | ||||
| -rw-r--r-- | src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c | 124 |
2 files changed, 119 insertions, 7 deletions
diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index 2608d22e5..c14d424e0 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -41,7 +41,7 @@ void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, void* texture) { MtxF mfTrans11DA0; s32 pad1; Mtx* mtx; - void* object = play->objectCtx.status[this->rgObjBankIdx].segment; + void* object = play->objectCtx.status[this->rgObjBankIndex].segment; OPEN_DISPS(gfxCtx); diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c b/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c index 210ede8f6..78bee9835 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c @@ -5,23 +5,135 @@ */ #include "z_eff_ss_g_splash.h" +#include "objects/gameplay_keep/gameplay_keep.h" + +//! @bug the reuse of regs[11] means that EffectSs_DrawGEffect will treat the type as an object bank index +// this ends up having no effect because the texture provided does not use segment 6 +#define rType regs[11] #define PARAMS ((EffectSsGSplashInitParams*)initParamsx) -s32 EffectSsGSplash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +u32 EffectSsGSplash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); void EffectSsGSplash_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsGSplash_Draw(PlayState* play, u32 index, EffectSs* this); -#if 0 const EffectSsInit Effect_Ss_G_Splash_InitVars = { EFFECT_SS_G_SPLASH, EffectSsGSplash_Init, }; -#endif +static TexturePtr waterSplashTextures[] = { + gEffWaterSplash1Tex, gEffWaterSplash2Tex, gEffWaterSplash3Tex, gEffWaterSplash4Tex, + gEffWaterSplash5Tex, gEffWaterSplash6Tex, gEffWaterSplash7Tex, gEffWaterSplash8Tex, +}; + +u32 EffectSsGSplash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { + EffectSsGSplashInitParams* initParams = PARAMS; + + Math_Vec3f_Copy(&this->velocity, &gZeroVec3f); + Math_Vec3f_Copy(&this->accel, &gZeroVec3f); + Math_Vec3f_Copy(&this->pos, &initParams->pos); + this->draw = EffectSsGSplash_Draw; + this->update = EffectSsGSplash_Update; + + if (initParams->scale == 0) { + initParams->scale = 600; + } + + this->gfx = gEffWaterSplashDL; + this->life = 8; + this->rgScale = initParams->scale; + this->rgTexIndex = 0; + this->rgTexIndexStep = 100; + + if (initParams->customColor) { + this->rgPrimColorR = initParams->primColor.r; + this->rgPrimColorG = initParams->primColor.g; + this->rgPrimColorB = initParams->primColor.b; + this->rgPrimColorA = initParams->primColor.a; + this->rgEnvColorR = initParams->envColor.r; + this->rgEnvColorG = initParams->envColor.g; + this->rgEnvColorB = initParams->envColor.b; + this->rgEnvColorA = initParams->envColor.a; + this->rType = initParams->type; + } else { + switch (initParams->type) { + case 0: + this->rgPrimColorR = 255; + this->rgPrimColorG = 255; + this->rgPrimColorB = 255; + this->rgPrimColorA = 200; + this->rgEnvColorR = 255; + this->rgEnvColorG = 255; + this->rgEnvColorB = 255; + this->rgEnvColorA = 200; + this->rType = 0; + break; + case 1: + this->rgPrimColorR = 255; + this->rgPrimColorG = 255; + this->rgPrimColorB = 255; + this->rgPrimColorA = 255; + this->rgEnvColorR = 255; + this->rgEnvColorG = 255; + this->rgEnvColorB = 255; + this->rgEnvColorA = 255; + this->rType = 1; + break; + case 2: + this->rgPrimColorR = 255; + this->rgPrimColorG = 255; + this->rgPrimColorB = 255; + this->rgPrimColorA = 200; + this->rgEnvColorR = 255; + this->rgEnvColorG = 255; + this->rgEnvColorB = 255; + this->rgEnvColorA = 200; + this->rType = 2; + break; + } + } + return 1; +} + +void EffectSsGSplash_Draw(PlayState* play, u32 index, EffectSs* this) { + s16 texIndex; + + switch (this->rType) { + case 0: + texIndex = this->rgTexIndex / 100; + if (texIndex > 7) { + texIndex = 7; + } + EffectSs_DrawGEffect(play, this, waterSplashTextures[texIndex]); + break; + + case 1: + texIndex = this->rgTexIndex / 100; + if (texIndex > 7) { + texIndex = 7; + } + EffectSs_DrawGEffect(play, this, waterSplashTextures[texIndex]); + break; + + case 2: + texIndex = this->rgTexIndex / 100; + if (texIndex > 7) { + texIndex = 7; + } + EffectSs_DrawGEffect(play, this, waterSplashTextures[texIndex]); + break; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_G_Splash/EffectSsGSplash_Init.s") +void EffectSsGSplash_Update(PlayState* play, u32 index, EffectSs* this) { + Vec3f newSplashPos; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_G_Splash/EffectSsGSplash_Draw.s") + if ((this->rType == 1) && (this->life == 5)) { + newSplashPos = this->pos; + newSplashPos.y += ((this->rgScale * 20) * 0.002f); + EffectSsGSplash_Spawn(play, &newSplashPos, 0, 0, 2, this->rgScale / 2); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_G_Splash/EffectSsGSplash_Update.s") + this->rgTexIndex += this->rgTexIndexStep; +} |
