Effect DtBubble OK (#1017)

* OK

* Some cleanup

* Format

* Name enum
This commit is contained in:
Derek Hensley 2022-09-24 10:09:46 -07:00 committed by GitHub
parent f31056ef8a
commit fb4ca3fb17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 123 additions and 23 deletions

3
spec
View File

@ -1817,8 +1817,7 @@ beginseg
name "ovl_Effect_Ss_Dt_Bubble"
compress
include "build/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.o"
include "build/data/ovl_Effect_Ss_Dt_Bubble/ovl_Effect_Ss_Dt_Bubble.data.o"
include "build/data/ovl_Effect_Ss_Dt_Bubble/ovl_Effect_Ss_Dt_Bubble.reloc.o"
include "build/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/ovl_Effect_Ss_Dt_Bubble_reloc.o"
endseg
beginseg

View File

@ -505,7 +505,7 @@ void EffectSsDtBubble_SpawnColorProfile(PlayState* play, Vec3f* pos, Vec3f* velo
Math_Vec3f_Copy(&initParams.pos, pos);
Math_Vec3f_Copy(&initParams.velocity, velocity);
Math_Vec3f_Copy(&initParams.accel, accel);
initParams.customColor = 0;
initParams.customColor = false;
initParams.colorProfile = colorProfile;
initParams.scale = scale;
initParams.life = life;
@ -526,7 +526,7 @@ void EffectSsDtBubble_SpawnCustomColor(PlayState* play, Vec3f* pos, Vec3f* veloc
initParams.scale = scale;
initParams.life = life;
initParams.randXZ = randXZ;
initParams.customColor = 1;
initParams.customColor = true;
EffectSs_Spawn(play, EFFECT_SS_DT_BUBBLE, 128, &initParams);
}

View File

@ -443,7 +443,7 @@ void EnBigokuta_PlayDeathEffects(EnBigokuta* this, PlayState* play) {
bubblePos.z = this->picto.actor.world.pos.z + (2.0f * bubbleVel.z);
EffectSsDtBubble_SpawnCustomColor(play, &bubblePos, &bubbleVel, &D_80AC45A4, &D_80AC45B0,
&D_80AC45B8, Rand_S16Offset(150, 50), 25, 0);
&D_80AC45B8, Rand_S16Offset(150, 50), 25, false);
}
if (this->picto.actor.params != 0xFF) {

View File

@ -317,7 +317,8 @@ void EnDragon_SpawnBubbles(EnDragon* this, PlayState* play, Vec3f basePos) {
sBubbleAccel.y = Rand_ZeroFloat(1.0f) * 20.0f * 3.0f;
scale = Rand_S16Offset(380, 240);
EffectSsDtBubble_SpawnCustomColor(play, &bubblePos, &sBubbleVelocity, &sBubbleAccel,
&sBubblePrimColors[colorIndex], &sBubbleEnvColors[colorIndex], scale, 30, 0);
&sBubblePrimColors[colorIndex], &sBubbleEnvColors[colorIndex], scale, 30,
false);
}
}

View File

@ -113,7 +113,7 @@ void EnElfbub_Pop(EnElfbub* this, PlayState* play) {
velocity.y = Rand_ZeroOne() * 7.0f;
velocity.z = (Rand_ZeroOne() - 0.5f) * 7.0f;
EffectSsDtBubble_SpawnCustomColor(play, &pos, &velocity, &sAccel, &sPrimColor, &sEnvColor,
Rand_S16Offset(100, 50), 25, 0);
Rand_S16Offset(100, 50), 25, false);
}
SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 60, NA_SE_EN_AWA_BREAK);

View File

@ -297,9 +297,9 @@ void func_80B509A8(EnGk* this, PlayState* play) {
}
EffectSsDtBubble_SpawnCustomColor(play, &this->unk_2E8, &this->unk_300, &sp4C, &D_80B533A0, &D_80B533A4,
Rand_S16Offset(15, 15), phi_s1, 0);
Rand_S16Offset(15, 15), phi_s1, false);
EffectSsDtBubble_SpawnCustomColor(play, &this->unk_2F4, &this->unk_30C, &sp4C, &D_80B533A0, &D_80B533A4,
Rand_S16Offset(15, 15), phi_s1, 0);
Rand_S16Offset(15, 15), phi_s1, false);
}
void func_80B50B38(EnGk* this, PlayState* play) {

View File

@ -176,7 +176,8 @@ void func_80BDB2B8(EnHiddenNuts* this, PlayState* play) {
sp74.x += randPlusMinusPoint5Scaled(15.0f);
sp74.z += randPlusMinusPoint5Scaled(15.0f);
EffectSsDtBubble_SpawnCustomColor(play, &sp74, &sp94, &sp88, &sp84, &sp80, Rand_S16Offset(120, 90), 30, 1);
EffectSsDtBubble_SpawnCustomColor(play, &sp74, &sp94, &sp88, &sp84, &sp80, Rand_S16Offset(120, 90), 30,
true);
}
this->unk_218 = 30;
}
@ -218,7 +219,8 @@ void func_80BDB59C(EnHiddenNuts* this, PlayState* play) {
sp78.x += randPlusMinusPoint5Scaled(15.0f);
sp78.z += randPlusMinusPoint5Scaled(15.0f);
EffectSsDtBubble_SpawnCustomColor(play, &sp78, &sp98, &sp8C, &sp88, &sp84, Rand_S16Offset(120, 90), 30, 1);
EffectSsDtBubble_SpawnCustomColor(play, &sp78, &sp98, &sp8C, &sp88, &sp84, Rand_S16Offset(120, 90), 30,
true);
}
this->unk_218 = 30;
}

View File

@ -5,6 +5,7 @@
*/
#include "z_en_part.h"
#include "overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.h"
#define FLAGS (ACTOR_FLAG_10)
@ -96,7 +97,7 @@ void func_808654C4(EnPart* this, PlayState* play) {
effectVelocity.y = Rand_ZeroOne() + 1.0f;
effectScale = Rand_S16Offset(80, 100);
EffectSsDtBubble_SpawnColorProfile(play, &effectPos, &effectVelocity, &gZeroVec3f, effectScale, 25,
0, 1);
DTBUBBLE_COLOR_PROFILE_RED, true);
}
break;
}

View File

@ -285,7 +285,7 @@ void func_80A365EC(EnSyatekiOkuta* this, PlayState* play) {
sp84.y = Rand_ZeroOne() * 7.0f;
sp84.z = (Rand_ZeroOne() - 0.5f) * 7.0f;
EffectSsDtBubble_SpawnCustomColor(play, &this->actor.world.pos, &sp84, &D_80A37B98, &D_80A37BA4,
&D_80A37BA8, Rand_S16Offset(100, 50), 25, 0);
&D_80A37BA8, Rand_S16Offset(100, 50), 25, false);
}
func_80A362F8(this);

View File

@ -371,7 +371,7 @@ void func_80BB71C8(EnTanron2* this, PlayState* play) {
sp9C.z = spA8.z * -0.03f;
EffectSsDtBubble_SpawnCustomColor(play, &sp90, &spA8, &sp9C, &D_80BB81E8, &D_80BB81EC,
Rand_ZeroFloat(100.0f) + 200.0f, Rand_ZeroFloat(5.0f) + 15.0f, 0);
Rand_ZeroFloat(100.0f) + 200.0f, Rand_ZeroFloat(5.0f) + 15.0f, false);
}
}

View File

@ -142,7 +142,8 @@ void EnTanron3_SpawnBubbles(EnTanron3* this, PlayState* play) {
acceleration.y = velocity.y * -0.05f;
acceleration.z = velocity.z * -0.05f;
EffectSsDtBubble_SpawnCustomColor(play, &this->actor.world.pos, &velocity, &acceleration, &sPrimColor,
&sEnvColor, Rand_ZeroFloat(30.0f) + 70.0f, Rand_ZeroFloat(5.0f) + 15.0f, 0);
&sEnvColor, Rand_ZeroFloat(30.0f) + 70.0f, Rand_ZeroFloat(5.0f) + 15.0f,
false);
}
}

View File

@ -1,7 +1,7 @@
/*
* File: z_eff_ss_bubble.c
* Overlay: ovl_Effect_Ss_Bubble
* Description:
* Description: Water Bubbles
*/
#include "z_eff_ss_bubble.h"

View File

@ -1,27 +1,116 @@
/*
* File: z_eff_ss_dt_bubble.c
* Overlay: ovl_Effect_Ss_Dt_Bubble
* Description:
* Description: Non-Water Bubbles (a random mix of translucent and opaque)
*/
#include "z_eff_ss_dt_bubble.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 rRandXZ regs[8]
#define rScale regs[9]
#define rLifespan regs[10]
#define PARAMS ((EffectSsDtBubbleInitParams*)initParamsx)
s32 EffectSsDtBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
u32 EffectSsDtBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
void EffectSsDtBubble_Update(PlayState* play, u32 index, EffectSs* this);
void EffectSsDtBubble_Draw(PlayState* play, u32 index, EffectSs* this);
#if 0
static Color_RGBA8 sPrimColors[] = {
{ 255, 255, 100, 255 },
{ 150, 255, 255, 255 },
{ 100, 255, 255, 255 },
{ 255, 255, 255, 255 },
};
static Color_RGBA8 sEnvColors[] = {
{ 170, 0, 0, 255 },
{ 0, 100, 0, 255 },
{ 0, 0, 255, 255 },
{ 150, 150, 150, 0 },
};
const EffectSsInit Effect_Ss_Dt_Bubble_InitVars = {
EFFECT_SS_DT_BUBBLE,
EffectSsDtBubble_Init,
};
#endif
u32 EffectSsDtBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) {
EffectSsDtBubbleInitParams* initParams = PARAMS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dt_Bubble/EffectSsDtBubble_Init.s")
{
TexturePtr tex = (Rand_ZeroOne() < 0.5f) ? gEffBubble1Tex : gEffBubble2Tex;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dt_Bubble/EffectSsDtBubble_Draw.s")
this->gfx = VIRTUAL_TO_PHYSICAL(SEGMENTED_TO_VIRTUAL(tex));
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dt_Bubble/EffectSsDtBubble_Update.s")
Math_Vec3f_Copy(&this->pos, &initParams->pos);
Math_Vec3f_Copy(&this->velocity, &initParams->velocity);
Math_Vec3f_Copy(&this->accel, &initParams->accel);
this->life = initParams->life;
if (!initParams->customColor) {
this->rPrimColorR = sPrimColors[initParams->colorProfile].r;
this->rPrimColorG = sPrimColors[initParams->colorProfile].g;
this->rPrimColorB = sPrimColors[initParams->colorProfile].b;
this->rPrimColorA = sPrimColors[initParams->colorProfile].a;
this->rEnvColorR = sEnvColors[initParams->colorProfile].r;
this->rEnvColorG = sEnvColors[initParams->colorProfile].g;
this->rEnvColorB = sEnvColors[initParams->colorProfile].b;
this->rEnvColorA = sEnvColors[initParams->colorProfile].a;
} else {
this->rPrimColorR = initParams->primColor.r;
this->rPrimColorG = initParams->primColor.g;
this->rPrimColorB = initParams->primColor.b;
this->rPrimColorA = initParams->primColor.a;
this->rEnvColorR = initParams->envColor.r;
this->rEnvColorG = initParams->envColor.g;
this->rEnvColorB = initParams->envColor.b;
this->rEnvColorA = initParams->envColor.a;
}
this->rRandXZ = initParams->randXZ;
this->rScale = initParams->scale;
this->rLifespan = initParams->life;
this->draw = EffectSsDtBubble_Draw;
this->update = EffectSsDtBubble_Update;
return 1;
}
void EffectSsDtBubble_Draw(PlayState* play, u32 index, EffectSs* this) {
GraphicsContext* gfxCtx = play->state.gfxCtx;
f32 scale;
OPEN_DISPS(gfxCtx);
scale = this->rScale * 0.004f;
Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW);
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
func_8012C28C(gfxCtx);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB,
(this->rPrimColorA * this->life) / this->rLifespan);
gDPSetEnvColor(POLY_OPA_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB,
(this->rEnvColorA * this->life) / this->rLifespan);
gSPSegment(POLY_OPA_DISP++, 0x08, this->gfx);
gSPDisplayList(POLY_OPA_DISP++, gEffBubbleDL);
CLOSE_DISPS(gfxCtx);
}
void EffectSsDtBubble_Update(PlayState* play, u32 index, EffectSs* this) {
if (this->rRandXZ == true) {
this->pos.x += (Rand_ZeroOne() * 2.0f) - 1.0f;
this->pos.z += (Rand_ZeroOne() * 2.0f) - 1.0f;
}
}

View File

@ -3,6 +3,13 @@
#include "global.h"
typedef enum {
/* 0 */ DTBUBBLE_COLOR_PROFILE_RED,
/* 1 */ DTBUBBLE_COLOR_PROFILE_GREEN,
/* 2 */ DTBUBBLE_COLOR_PROFILE_BLUE,
/* 3 */ DTBUBBLE_COLOR_PROFILE_CLEAR
} DtBubbleColorProfile;
typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ Vec3f velocity;