mirror of
https://github.com/zeldaret/mm.git
synced 2024-11-27 06:40:36 +00:00
EffectSsBubble OK (#702)
* Decompile eff_ss_bubble * Document effBubble stuff in gameplay keep * newline * Formatting is hard * PR suggestions * Amplitude -> Max
This commit is contained in:
parent
59ec3f721a
commit
69c0e15a45
@ -1003,7 +1003,7 @@
|
|||||||
<Animation Name="gameplay_keep_Anim_02F0EC" Offset="0x2F0EC" />
|
<Animation Name="gameplay_keep_Anim_02F0EC" Offset="0x2F0EC" />
|
||||||
<Texture Name="gameplay_keep_Tex_02F100" OutName="tex_02F100" Format="i8" Width="64" Height="64" Offset="0x2F100" />
|
<Texture Name="gameplay_keep_Tex_02F100" OutName="tex_02F100" Format="i8" Width="64" Height="64" Offset="0x2F100" />
|
||||||
<DList Name="gameplay_keep_DL_030100" Offset="0x30100" /> <!-- Floor shockwave ring -->
|
<DList Name="gameplay_keep_DL_030100" Offset="0x30100" /> <!-- Floor shockwave ring -->
|
||||||
<DList Name="gameplay_keep_DL_0301B0" Offset="0x301B0" />
|
<DList Name="gEffBubbleDL" Offset="0x301B0" />
|
||||||
<Texture Name="gameplay_keep_Tex_030270" OutName="tex_030270" Format="ia8" Width="32" Height="32" Offset="0x30270" />
|
<Texture Name="gameplay_keep_Tex_030270" OutName="tex_030270" Format="ia8" Width="32" Height="32" Offset="0x30270" />
|
||||||
<Texture Name="gameplay_keep_Tex_030670" OutName="tex_030670" Format="ia8" Width="32" Height="32" Offset="0x30670" />
|
<Texture Name="gameplay_keep_Tex_030670" OutName="tex_030670" Format="ia8" Width="32" Height="32" Offset="0x30670" />
|
||||||
<Texture Name="gameplay_keep_Tex_030A70" OutName="tex_030A70" Format="ia8" Width="32" Height="32" Offset="0x30A70" />
|
<Texture Name="gameplay_keep_Tex_030A70" OutName="tex_030A70" Format="ia8" Width="32" Height="32" Offset="0x30A70" />
|
||||||
@ -1423,8 +1423,8 @@
|
|||||||
<Texture Name="gameplay_keep_Tex_0903E0" OutName="tex_0903E0" Format="i8" Width="32" Height="64" Offset="0x903E0" />
|
<Texture Name="gameplay_keep_Tex_0903E0" OutName="tex_0903E0" Format="i8" Width="32" Height="64" Offset="0x903E0" />
|
||||||
<Texture Name="gameplay_keep_Tex_090BE0" OutName="tex_090BE0" Format="i8" Width="32" Height="64" Offset="0x90BE0" />
|
<Texture Name="gameplay_keep_Tex_090BE0" OutName="tex_090BE0" Format="i8" Width="32" Height="64" Offset="0x90BE0" />
|
||||||
<Texture Name="gameplay_keep_Tex_0913E0" OutName="tex_0913E0" Format="i8" Width="32" Height="64" Offset="0x913E0" />
|
<Texture Name="gameplay_keep_Tex_0913E0" OutName="tex_0913E0" Format="i8" Width="32" Height="64" Offset="0x913E0" />
|
||||||
<Texture Name="gameplay_keep_Tex_091BE0" OutName="tex_091BE0" Format="ia8" Width="16" Height="16" Offset="0x91BE0" />
|
<Texture Name="gEffBubble1Tex" OutName="eff_bubble_1" Format="ia8" Width="16" Height="16" Offset="0x91BE0" />
|
||||||
<Texture Name="gameplay_keep_Tex_091CE0" OutName="tex_091CE0" Format="ia8" Width="16" Height="16" Offset="0x91CE0" />
|
<Texture Name="gEffBubble2Tex" OutName="eff_bubble_2" Format="ia8" Width="16" Height="16" Offset="0x91CE0" />
|
||||||
|
|
||||||
<!-- Electric spark textures from Zora-Form attack -->
|
<!-- Electric spark textures from Zora-Form attack -->
|
||||||
<Texture Name="gElectricSpark1Tex" OutName="electric_spark_1" Format="i4" Width="32" Height="32" Offset="0x91DE0" />
|
<Texture Name="gElectricSpark1Tex" OutName="electric_spark_1" Format="i4" Width="32" Height="32" Offset="0x91DE0" />
|
||||||
|
3
spec
3
spec
@ -1860,8 +1860,7 @@ beginseg
|
|||||||
name "ovl_Effect_Ss_Bubble"
|
name "ovl_Effect_Ss_Bubble"
|
||||||
compress
|
compress
|
||||||
include "build/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.o"
|
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/src/overlays/effects/ovl_Effect_Ss_Bubble/ovl_Effect_Ss_Bubble_reloc.o"
|
||||||
include "build/data/ovl_Effect_Ss_Bubble/ovl_Effect_Ss_Bubble.reloc.o"
|
|
||||||
endseg
|
endseg
|
||||||
|
|
||||||
beginseg
|
beginseg
|
||||||
|
@ -1094,9 +1094,9 @@ void func_80B2ADB0(EnFish2* this, Vec3f* vec, s16 arg2) {
|
|||||||
TexturePtr phi_v0;
|
TexturePtr phi_v0;
|
||||||
|
|
||||||
if (Rand_ZeroOne() < 0.5f) {
|
if (Rand_ZeroOne() < 0.5f) {
|
||||||
phi_v0 = gameplay_keep_Tex_091CE0;
|
phi_v0 = gEffBubble2Tex;
|
||||||
} else {
|
} else {
|
||||||
phi_v0 = gameplay_keep_Tex_091BE0;
|
phi_v0 = gEffBubble1Tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr->unk_20 = VIRTUAL_TO_PHYSICAL(SEGMENTED_TO_VIRTUAL(phi_v0));
|
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);
|
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255);
|
||||||
gDPSetEnvColor(POLY_OPA_DISP++, 150, 150, 150, 0);
|
gDPSetEnvColor(POLY_OPA_DISP++, 150, 150, 150, 0);
|
||||||
gSPSegment(POLY_OPA_DISP++, 0x08, ptr->unk_20);
|
gSPSegment(POLY_OPA_DISP++, 0x08, ptr->unk_20);
|
||||||
gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_0301B0);
|
gSPDisplayList(POLY_OPA_DISP++, gEffBubbleDL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,23 +5,103 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "z_eff_ss_bubble.h"
|
#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)
|
#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_Update(GlobalContext* globalCtx, u32 index, EffectSs* this);
|
||||||
void EffectSsBubble_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this);
|
void EffectSsBubble_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this);
|
||||||
|
|
||||||
#if 0
|
|
||||||
const EffectSsInit Effect_Ss_Bubble_InitVars = {
|
const EffectSsInit Effect_Ss_Bubble_InitVars = {
|
||||||
EFFECT_SS_BUBBLE,
|
EFFECT_SS_BUBBLE,
|
||||||
EffectSsBubble_Init,
|
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++;
|
||||||
|
}
|
||||||
|
@ -9006,7 +9006,7 @@
|
|||||||
0x80979560:("Effect_Ss_D_Fire_InitVars","UNK_TYPE1","",0x1),
|
0x80979560:("Effect_Ss_D_Fire_InitVars","UNK_TYPE1","",0x1),
|
||||||
0x80979568:("D_80979568","UNK_TYPE1","",0x1),
|
0x80979568:("D_80979568","UNK_TYPE1","",0x1),
|
||||||
0x80979AB0:("Effect_Ss_Bubble_InitVars","UNK_TYPE1","",0x8),
|
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),
|
0x80979AD0:("D_80979AD0","f32","",0x4),
|
||||||
0x80979AD4:("D_80979AD4","f32","",0x4),
|
0x80979AD4:("D_80979AD4","f32","",0x4),
|
||||||
0x80979FF0:("Effect_Ss_G_Ripple_InitVars","UNK_TYPE1","",0x1),
|
0x80979FF0:("Effect_Ss_G_Ripple_InitVars","UNK_TYPE1","",0x1),
|
||||||
|
Loading…
Reference in New Issue
Block a user