Effect Gripple (#940)

* OK

* description

* undef

* format
This commit is contained in:
Derek Hensley 2022-07-19 09:32:00 -07:00 committed by GitHub
parent 215164738b
commit 6661b566a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 122 additions and 14 deletions

View File

@ -1041,8 +1041,8 @@
<DList Name="gEffHitmarkDL" Offset="0x35710" />
<Texture Name="gameplay_keep_Tex_0357B0" OutName="tex_0357B0" Format="ia8" Width="32" Height="64" Offset="0x357B0" />
<Texture Name="gameplay_keep_Tex_035FB0" OutName="tex_035FB0" Format="ia8" Width="32" Height="64" Offset="0x35FB0" />
<Texture Name="gameplay_keep_Tex_0367B0" OutName="tex_0367B0" Format="i8" Width="64" Height="64" Offset="0x367B0" />
<DList Name="gameplay_keep_DL_0377B0" Offset="0x377B0" />
<Texture Name="gEffWaterRippleTex" OutName="eff_water_ripple" Format="i8" Width="64" Height="64" Offset="0x367B0" />
<DList Name="gEffWaterRippleDL" Offset="0x377B0" />
<DList Name="gameplay_keep_DL_037850" Offset="0x37850" />
<Texture Name="gEffWaterSplash1Tex" OutName="eff_water_splash_1" Format="i8" Width="32" Height="40" Offset="0x378F0" />
<Texture Name="gEffWaterSplash2Tex" OutName="eff_water_splash_2" Format="i8" Width="32" Height="40" Offset="0x37DF0" />

3
spec
View File

@ -1810,8 +1810,7 @@ beginseg
name "ovl_Effect_Ss_G_Ripple"
compress
include "build/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.o"
include "build/data/ovl_Effect_Ss_G_Ripple/ovl_Effect_Ss_G_Ripple.data.o"
include "build/data/ovl_Effect_Ss_G_Ripple/ovl_Effect_Ss_G_Ripple.reloc.o"
include "build/src/overlays/effects/ovl_Effect_Ss_G_Ripple/ovl_Effect_Ss_G_Ripple_reloc.o"
endseg
beginseg

View File

@ -670,7 +670,7 @@ void EnTanron2_Draw(Actor* thisx, PlayState* play2) {
Matrix_Scale(D_80BB8454, 0.0f, D_80BB8454, 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_0377B0);
gSPDisplayList(POLY_XLU_DISP++, gEffWaterRippleDL);
}
tanron2 = tanron2->next;
}

View File

@ -1,29 +1,138 @@
/*
* File: z_eff_ss_g_ripple.c
* Overlay: ovl_Effect_Ss_G_Ripple
* Description:
* Description: Water Ripple
*/
#include "z_eff_ss_g_ripple.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#define rWaterBoxNum regs[0]
#define rRadius regs[1]
#define rRadiusMax regs[2]
#define rPrimColorR regs[3]
#define rPrimColorG regs[4]
#define rPrimColorB regs[5]
#define rPrimColorA regs[6]
#define rEnvColorR regs[7]
#define rEnvColorG regs[8]
#define rEnvColorB regs[9]
#define rEnvColorA regs[10]
#define rLifespan regs[11]
#define rBgId regs[12]
#define PARAMS ((EffectSsGRippleInitParams*)initParamsx)
s32 EffectSsGRipple_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
u32 EffectSsGRipple_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
void EffectSsGRipple_Update(PlayState* play, u32 index, EffectSs* this);
void EffectSsGRipple_Draw(PlayState* play, u32 index, EffectSs* this);
#if 0
const EffectSsInit Effect_Ss_G_Ripple_InitVars = {
EFFECT_SS_G_RIPPLE,
EffectSsGRipple_Init,
};
#endif
u32 EffectSsGRipple_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) {
EffectSsGRippleInitParams* initParams = PARAMS;
WaterBox* waterBox = NULL;
s32 pad;
s32 bgId;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_G_Ripple/EffectSsGRipple_Init.s")
Math_Vec3f_Copy(&this->velocity, &gZeroVec3f);
Math_Vec3f_Copy(&this->accel, &gZeroVec3f);
Math_Vec3f_Copy(&this->pos, &initParams->pos);
this->gfx = gEffWaterRippleDL;
this->life = initParams->life + 20;
this->flags = 0;
this->draw = EffectSsGRipple_Draw;
this->update = EffectSsGRipple_Update;
this->rRadius = initParams->radius;
this->rRadiusMax = initParams->radiusMax;
this->rLifespan = initParams->life;
this->rPrimColorR = 255;
this->rPrimColorG = 255;
this->rPrimColorB = 255;
this->rPrimColorA = 255;
this->rEnvColorR = 255;
this->rEnvColorG = 255;
this->rEnvColorB = 255;
this->rEnvColorA = 255;
this->rWaterBoxNum = WaterBox_GetSurface2(play, &play->colCtx, &initParams->pos, 3.0f, &waterBox, &bgId);
this->rBgId = bgId;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_G_Ripple/func_80979C38.s")
return 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_G_Ripple/EffectSsGRipple_Draw.s")
void EffectSsGRipple_DrawRipple(PlayState* play2, EffectSs* this, TexturePtr tex) {
PlayState* play = play2;
f32 radius;
GraphicsContext* gfxCtx = play->state.gfxCtx;
MtxF mfTrans;
MtxF mfScale;
MtxF mfResult;
Mtx* mtx;
f32 yPos;
CollisionHeader* colHeader;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_G_Ripple/EffectSsGRipple_Update.s")
OPEN_DISPS(gfxCtx);
radius = this->rRadius * 0.0025f;
colHeader = BgCheck_GetCollisionHeader(&play->colCtx, this->rBgId);
if ((this->rWaterBoxNum != -1) && (colHeader != NULL) && (this->rWaterBoxNum < colHeader->numWaterBoxes)) {
yPos = func_800CA568(&play->colCtx, this->rWaterBoxNum, this->rBgId);
} else {
yPos = this->pos.y;
}
SkinMatrix_SetTranslate(&mfTrans, this->pos.x, yPos, this->pos.z);
SkinMatrix_SetScale(&mfScale, radius, radius, radius);
SkinMatrix_MtxFMtxFMult(&mfTrans, &mfScale, &mfResult);
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult);
if (mtx != NULL) {
gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
func_8012C974(gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB,
this->rPrimColorA);
gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, this->rEnvColorA);
gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_NOISE);
gDPSetColorDither(POLY_XLU_DISP++, G_CD_NOISE);
gSPDisplayList(POLY_XLU_DISP++, this->gfx);
}
CLOSE_DISPS(gfxCtx);
}
void EffectSsGRipple_Draw(PlayState* play, u32 index, EffectSs* this) {
if (this->rLifespan == 0) {
EffectSsGRipple_DrawRipple(play, this, gEffWaterRippleTex);
}
}
void EffectSsGRipple_Update(PlayState* play, u32 index, EffectSs* this) {
f32 radius;
f32 primAlpha;
f32 envAlpha;
WaterBox* waterBox;
s32 bgId;
this->rWaterBoxNum = WaterBox_GetSurface2(play, &play->colCtx, &this->pos, 3.0f, &waterBox, &bgId);
this->rBgId = bgId;
if (DECR(this->rLifespan) == 0) {
radius = this->rRadius;
Math_SmoothStepToF(&radius, this->rRadiusMax, 0.2f, 30.0f, 1.0f);
this->rRadius = radius;
primAlpha = this->rPrimColorA;
envAlpha = this->rEnvColorA;
Math_SmoothStepToF(&primAlpha, 0.0f, 0.2f, 15.0f, 7.0f);
Math_SmoothStepToF(&envAlpha, 0.0f, 0.2f, 15.0f, 7.0f);
this->rPrimColorA = primAlpha;
this->rEnvColorA = envAlpha;
}
}

View File

@ -8155,7 +8155,7 @@
0x80979738:("EffectSsBubble_Draw",),
0x8097985C:("EffectSsBubble_Update",),
0x80979B30:("EffectSsGRipple_Init",),
0x80979C38:("func_80979C38",),
0x80979C38:("EffectSsGRipple_DrawRipple",),
0x80979E48:("EffectSsGRipple_Draw",),
0x80979E80:("EffectSsGRipple_Update",),
0x8097A050:("EffectSsGSplash_Init",),