diff --git a/assets/xml/objects/gameplay_keep.xml b/assets/xml/objects/gameplay_keep.xml
index 856e3d92bd..ded5f8b677 100644
--- a/assets/xml/objects/gameplay_keep.xml
+++ b/assets/xml/objects/gameplay_keep.xml
@@ -1003,7 +1003,7 @@
-
+
@@ -1423,8 +1423,8 @@
-
-
+
+
diff --git a/spec b/spec
index 6771502b6e..8927e5dfd2 100644
--- a/spec
+++ b/spec
@@ -1860,8 +1860,7 @@ beginseg
name "ovl_Effect_Ss_Bubble"
compress
include "build/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.o"
- include "build/data/ovl_Effect_Ss_Bubble/ovl_Effect_Ss_Bubble.data.o"
- include "build/data/ovl_Effect_Ss_Bubble/ovl_Effect_Ss_Bubble.reloc.o"
+ include "build/src/overlays/effects/ovl_Effect_Ss_Bubble/ovl_Effect_Ss_Bubble_reloc.o"
endseg
beginseg
diff --git a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c
index 21b42c4a4a..5512b00b73 100644
--- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c
+++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c
@@ -1094,9 +1094,9 @@ void func_80B2ADB0(EnFish2* this, Vec3f* vec, s16 arg2) {
TexturePtr phi_v0;
if (Rand_ZeroOne() < 0.5f) {
- phi_v0 = gameplay_keep_Tex_091CE0;
+ phi_v0 = gEffBubble2Tex;
} else {
- phi_v0 = gameplay_keep_Tex_091BE0;
+ phi_v0 = gEffBubble1Tex;
}
ptr->unk_20 = VIRTUAL_TO_PHYSICAL(SEGMENTED_TO_VIRTUAL(phi_v0));
@@ -1168,7 +1168,7 @@ void func_80B2B180(EnFish2* this, GlobalContext* globalCtx) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255);
gDPSetEnvColor(POLY_OPA_DISP++, 150, 150, 150, 0);
gSPSegment(POLY_OPA_DISP++, 0x08, ptr->unk_20);
- gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_0301B0);
+ gSPDisplayList(POLY_OPA_DISP++, gEffBubbleDL);
}
}
diff --git a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c
index d18f57bb7c..41a8f92ff3 100644
--- a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c
+++ b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c
@@ -5,23 +5,103 @@
*/
#include "z_eff_ss_bubble.h"
+#include "objects/gameplay_keep/gameplay_keep.h"
+
+#define rScale regs[0]
+#define rVecAdjX regs[1]
+#define rVecAdjZ regs[2]
#define PARAMS ((EffectSsBubbleInitParams*)initParamsx)
-s32 EffectSsBubble_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx);
+u32 EffectSsBubble_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx);
void EffectSsBubble_Update(GlobalContext* globalCtx, u32 index, EffectSs* this);
void EffectSsBubble_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this);
-#if 0
const EffectSsInit Effect_Ss_Bubble_InitVars = {
EFFECT_SS_BUBBLE,
EffectSsBubble_Init,
};
-#endif
+static f32 sVecAdjMaximums[] = { 291.0f, 582.0f, 1600.0f };
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Bubble/EffectSsBubble_Init.s")
+u32 EffectSsBubble_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) {
+ EffectSsBubbleInitParams* initParams = (EffectSsBubbleInitParams*)initParamsx;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Bubble/EffectSsBubble_Draw.s")
+ {
+ TexturePtr tex = (Rand_ZeroOne() < 0.5f) ? gEffBubble1Tex : gEffBubble2Tex;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Bubble/EffectSsBubble_Update.s")
+ this->gfx = VIRTUAL_TO_PHYSICAL(SEGMENTED_TO_VIRTUAL(tex));
+ }
+
+ this->pos.x = ((Rand_ZeroOne() - 0.5f) * initParams->xzPosRandScale) + initParams->pos.x;
+ this->pos.y = (((Rand_ZeroOne() - 0.5f) * initParams->yPosRandScale) + initParams->yPosOffset) + initParams->pos.y;
+ this->pos.z = ((Rand_ZeroOne() - 0.5f) * initParams->xzPosRandScale) + initParams->pos.z;
+ Math_Vec3f_Copy(&this->vec, &this->pos);
+ this->life = 1;
+ this->rScale = (((Rand_ZeroOne() * 0.5f) + 1.0f) * initParams->scale) * 100.0f;
+ this->draw = EffectSsBubble_Draw;
+ this->update = EffectSsBubble_Update;
+
+ return 1;
+}
+
+void EffectSsBubble_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) {
+ GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
+ f32 scale = this->rScale / 100.0f;
+
+ OPEN_DISPS(gfxCtx);
+
+ Matrix_InsertTranslation(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, 255, 255, 255, 255);
+ gDPSetEnvColor(POLY_OPA_DISP++, 150, 150, 150, 0);
+ gSPSegment(POLY_OPA_DISP++, 0x08, this->gfx);
+ gSPDisplayList(POLY_OPA_DISP++, gEffBubbleDL);
+
+ CLOSE_DISPS(gfxCtx);
+}
+
+void EffectSsBubble_Update(GlobalContext* globalCtx2, u32 index, EffectSs* this) {
+ WaterBox* waterBox;
+ f32 waterSurfaceY = this->pos.y;
+ Vec3f ripplePos;
+ GlobalContext* globalCtx = globalCtx2;
+
+ if (!WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->pos.x, this->pos.z, &waterSurfaceY, &waterBox)) {
+ this->life = -1;
+ return;
+ }
+ if (waterSurfaceY < this->pos.y) {
+ ripplePos.x = this->pos.x;
+ ripplePos.y = waterSurfaceY;
+ ripplePos.z = this->pos.z;
+ EffectSsGRipple_Spawn(globalCtx, &ripplePos, 0, 80, 0);
+ this->life = -1;
+ label:
+ return;
+ }
+ if (((globalCtx->gameplayFrames + index) % 8) == 0) {
+ CollisionPoly* colPoly;
+ u32 speed;
+ s16 direction;
+ f32 rVecAdjMax;
+
+ BgCheck_EntityRaycastFloor2_1(globalCtx, &globalCtx->colCtx, &colPoly, &this->pos);
+ speed = SurfaceType_GetConveyorSpeed(&globalCtx->colCtx, colPoly, BGCHECK_SCENE);
+ if ((speed != 0) && !SurfaceType_GetConveyorType(&globalCtx->colCtx, colPoly, BGCHECK_SCENE)) {
+ direction = SurfaceType_GetConveyorDirection(&globalCtx->colCtx, colPoly, BGCHECK_SCENE) << 0xA;
+ rVecAdjMax = sVecAdjMaximums[speed - 1];
+ this->rVecAdjX = Math_SinS(direction) * rVecAdjMax;
+ this->rVecAdjZ = Math_CosS(direction) * rVecAdjMax;
+ }
+ }
+ this->vec.x += this->rVecAdjX / 100.0f;
+ this->vec.z += this->rVecAdjZ / 100.0f;
+ this->pos.x = ((Rand_ZeroOne() * 0.5f) - 0.25f) + this->vec.x;
+ this->accel.y = (Rand_ZeroOne() - 0.3f) * 0.2f;
+ this->pos.z = (Rand_ZeroOne() * 0.5f - 0.25f) + this->vec.z;
+ this->life++;
+}
diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt
index 7861cff5ab..f509fff707 100644
--- a/tools/disasm/variables.txt
+++ b/tools/disasm/variables.txt
@@ -9006,7 +9006,7 @@
0x80979560:("Effect_Ss_D_Fire_InitVars","UNK_TYPE1","",0x1),
0x80979568:("D_80979568","UNK_TYPE1","",0x1),
0x80979AB0:("Effect_Ss_Bubble_InitVars","UNK_TYPE1","",0x8),
- 0x80979AB8:("D_80979AB8","UNK_TYPE1","",0x1),
+ 0x80979AB8:("D_80979AB8","f32","[3]",0xC),
0x80979AD0:("D_80979AD0","f32","",0x4),
0x80979AD4:("D_80979AD4","f32","",0x4),
0x80979FF0:("Effect_Ss_G_Ripple_InitVars","UNK_TYPE1","",0x1),