Effect Gsplash OK (#876)

* Ok

* Save?

* undef syms
This commit is contained in:
Derek Hensley 2022-07-11 18:51:56 -07:00 committed by GitHub
parent f85a398162
commit 0346fde02b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 123 additions and 12 deletions

View File

@ -19,9 +19,9 @@ struct PlayState;
/* G Effect Regs */
#define rgTexIdx regs[0]
#define rgTexIndex regs[0]
#define rgScale regs[1]
#define rgTexIdxStep regs[2]
#define rgTexIndexStep regs[2]
#define rgPrimColorR regs[3]
#define rgPrimColorG regs[4]
#define rgPrimColorB regs[5]
@ -30,7 +30,7 @@ struct PlayState;
#define rgEnvColorG regs[8]
#define rgEnvColorB regs[9]
#define rgEnvColorA regs[10]
#define rgObjBankIdx regs[11]
#define rgObjBankIndex regs[11]
typedef struct {
/* 0x00 */ u8 active;

3
spec
View File

@ -1828,8 +1828,7 @@ beginseg
name "ovl_Effect_Ss_G_Splash"
compress
include "build/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.o"
include "build/data/ovl_Effect_Ss_G_Splash/ovl_Effect_Ss_G_Splash.data.o"
include "build/data/ovl_Effect_Ss_G_Splash/ovl_Effect_Ss_G_Splash.reloc.o"
include "build/src/overlays/effects/ovl_Effect_Ss_G_Splash/ovl_Effect_Ss_G_Splash_reloc.o"
endseg
beginseg

View File

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

View File

@ -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,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_G_Splash/EffectSsGSplash_Init.s")
u32 EffectSsGSplash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) {
EffectSsGSplashInitParams* initParams = PARAMS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_G_Splash/EffectSsGSplash_Draw.s")
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;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_G_Splash/EffectSsGSplash_Update.s")
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;
}
}
void EffectSsGSplash_Update(PlayState* play, u32 index, EffectSs* this) {
Vec3f newSplashPos;
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);
}
this->rgTexIndex += this->rgTexIndexStep;
}