mirror of https://github.com/zeldaret/mm.git
En_bubble OK (#995)
* bubble OK * fixing elfbulb * flag fix * PR comments * PR comments * missed a fix * PR fixes * don't know how this got in there * u to s * small fix
This commit is contained in:
parent
90ade1be9f
commit
3d430a5733
|
|
@ -1,6 +1,6 @@
|
|||
<Root>
|
||||
<File Name="object_bubble" Segment="6">
|
||||
<Texture Name="object_bubble_Tex_000000" OutName="tex_000000" Format="ia8" Width="64" Height="64" Offset="0x0" />
|
||||
<DList Name="object_bubble_DL_001000" Offset="0x1000" />
|
||||
<Texture Name="gBubbleTex" OutName="bubble" Format="ia8" Width="64" Height="64" Offset="0x0" />
|
||||
<DList Name="gBubbleDL" Offset="0x1000" />
|
||||
</File>
|
||||
</Root>
|
||||
|
|
|
|||
3
spec
3
spec
|
|
@ -883,8 +883,7 @@ beginseg
|
|||
name "ovl_En_Bubble"
|
||||
compress
|
||||
include "build/src/overlays/actors/ovl_En_Bubble/z_en_bubble.o"
|
||||
include "build/data/ovl_En_Bubble/ovl_En_Bubble.data.o"
|
||||
include "build/data/ovl_En_Bubble/ovl_En_Bubble.reloc.o"
|
||||
include "build/src/overlays/actors/ovl_En_Bubble/ovl_En_Bubble_reloc.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
|
|
|||
|
|
@ -649,7 +649,7 @@ void DemoKankyo_DrawMoonAndGiant(Actor* thisx, PlayState* play2) {
|
|||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
if (this->actor.params == DEMO_KANKYO_TYPE_GIANTS) {
|
||||
gSPDisplayList(POLY_XLU_DISP++, object_bubble_DL_001000);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gBubbleDL);
|
||||
} else {
|
||||
gSPDisplayList(POLY_XLU_DISP++, gLightOrbVtxDL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,11 +15,10 @@ void EnBubble_Destroy(Actor* thisx, PlayState* play);
|
|||
void EnBubble_Update(Actor* thisx, PlayState* play);
|
||||
void EnBubble_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
void func_808A029C(EnBubble* this, PlayState* play);
|
||||
void func_808A0350(EnBubble* this, PlayState* play);
|
||||
void func_808A03E8(EnBubble* this, PlayState* play);
|
||||
void EnBubble_Wait(EnBubble* this, PlayState* play);
|
||||
void EnBubble_Pop(EnBubble* this, PlayState* play);
|
||||
void EnBubble_Regrow(EnBubble* this, PlayState* play);
|
||||
|
||||
#if 0
|
||||
const ActorInit En_Bubble_InitVars = {
|
||||
ACTOR_EN_BUBBLE,
|
||||
ACTORCAT_ENEMY,
|
||||
|
|
@ -32,73 +31,396 @@ const ActorInit En_Bubble_InitVars = {
|
|||
(ActorFunc)EnBubble_Draw,
|
||||
};
|
||||
|
||||
// static ColliderJntSphElementInit sJntSphElementsInit[2] = {
|
||||
static ColliderJntSphElementInit D_808A0700[2] = {
|
||||
static ColliderJntSphElementInit sJntSphElementsInit[2] = {
|
||||
{
|
||||
{ ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x04 }, { 0xF7CFD757, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, },
|
||||
{
|
||||
ELEMTYPE_UNK0,
|
||||
{ 0x00000000, 0x00, 0x04 },
|
||||
{ 0xF7CFD757, 0x00, 0x00 },
|
||||
TOUCH_NONE | TOUCH_SFX_NORMAL,
|
||||
BUMP_ON,
|
||||
OCELEM_ON,
|
||||
},
|
||||
{ 0, { { 0, 0, 0 }, 16 }, 100 },
|
||||
},
|
||||
{
|
||||
{ ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00002820, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_NO_AT_INFO | BUMP_NO_DAMAGE | BUMP_NO_SWORD_SFX | BUMP_NO_HITMARK, OCELEM_NONE, },
|
||||
{
|
||||
ELEMTYPE_UNK0,
|
||||
{ 0x00000000, 0x00, 0x00 },
|
||||
{ 0x00002820, 0x00, 0x00 },
|
||||
TOUCH_NONE | TOUCH_SFX_NORMAL,
|
||||
BUMP_ON | BUMP_NO_AT_INFO | BUMP_NO_DAMAGE | BUMP_NO_SWORD_SFX | BUMP_NO_HITMARK,
|
||||
OCELEM_NONE,
|
||||
},
|
||||
{ 0, { { 0, 0, 0 }, 16 }, 100 },
|
||||
},
|
||||
};
|
||||
|
||||
// static ColliderJntSphInit sJntSphInit = {
|
||||
static ColliderJntSphInit D_808A0748 = {
|
||||
{ COLTYPE_HIT6, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_JNTSPH, },
|
||||
ARRAY_COUNT(sJntSphElementsInit), D_808A0700, // sJntSphElementsInit,
|
||||
static ColliderJntSphInit sJntSphInit = {
|
||||
{
|
||||
COLTYPE_HIT6,
|
||||
AT_ON | AT_TYPE_ENEMY,
|
||||
AC_ON | AC_TYPE_PLAYER,
|
||||
OC1_ON | OC1_TYPE_ALL,
|
||||
OC2_TYPE_1,
|
||||
COLSHAPE_JNTSPH,
|
||||
},
|
||||
ARRAY_COUNT(sJntSphElementsInit),
|
||||
sJntSphElementsInit,
|
||||
};
|
||||
|
||||
// sColChkInfoInit
|
||||
static CollisionCheckInfoInit2 D_808A0758 = { 1, 2, 25, 25, MASS_IMMOVABLE };
|
||||
static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 2, 25, 25, MASS_IMMOVABLE };
|
||||
|
||||
#endif
|
||||
void EnBubble_SetDimensions(EnBubble* this, f32 dim) {
|
||||
f32 x;
|
||||
f32 y;
|
||||
f32 z;
|
||||
f32 norm;
|
||||
|
||||
extern ColliderJntSphElementInit D_808A0700[2];
|
||||
extern ColliderJntSphInit D_808A0748;
|
||||
extern CollisionCheckInfoInit2 D_808A0758;
|
||||
this->actor.flags |= ACTOR_FLAG_1;
|
||||
Actor_SetScale(&this->actor, 1.0f);
|
||||
this->actor.shape.yOffset = 16.0f;
|
||||
this->modelRotSpeed = 16.0f;
|
||||
this->modelEllipticity = 0.08f;
|
||||
this->modelWidth = dim;
|
||||
this->modelHeight = dim;
|
||||
x = Rand_ZeroOne();
|
||||
y = Rand_ZeroOne();
|
||||
z = Rand_ZeroOne();
|
||||
this->unk_210 = 1.0f;
|
||||
this->unk_214 = 1.0f;
|
||||
norm = SQ(x) + SQ(y) + SQ(z);
|
||||
this->unk1F8.x = x / norm;
|
||||
this->unk1F8.y = y / norm;
|
||||
this->unk1F8.z = z / norm;
|
||||
}
|
||||
|
||||
extern UNK_TYPE D_06001000;
|
||||
s32 func_8089F59C(EnBubble* this) {
|
||||
ColliderInfo* info = &this->colliderSphere.elements[0].info;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089F4E0.s")
|
||||
info->toucher.dmgFlags = DMG_EXPLOSIVES;
|
||||
info->toucher.effect = 0;
|
||||
info->toucher.damage = 4;
|
||||
info->toucherFlags = TOUCH_ON;
|
||||
this->actor.velocity.y = 0.0f;
|
||||
return 6;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089F59C.s")
|
||||
s32 func_8089F5D0(EnBubble* this) {
|
||||
EnBubble_SetDimensions(this, -1.0f);
|
||||
return 12;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089F5D0.s")
|
||||
void EnBubble_DamagePlayer(EnBubble* this, PlayState* play) {
|
||||
play->damagePlayer(play, -this->colliderSphere.elements[0].info.toucher.damage);
|
||||
func_800B8E1C(play, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089F5F4.s")
|
||||
s32 EnBubble_Explosion(EnBubble* this, PlayState* play) {
|
||||
static Color_RGBA8 sEffectPrimColor = { 255, 255, 255, 255 };
|
||||
static Color_RGBA8 sEffectEnvColor = { 150, 150, 150, 0 };
|
||||
s32 i;
|
||||
Vec3f effectAccel = { 0.0f, -0.5f, 0.0f };
|
||||
Vec3f effectVel;
|
||||
Vec3f effectPos;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089F660.s")
|
||||
Math_SmoothStepToF(&this->modelWidth, 4.0f, 0.1f, 1000.0f, 0.0f);
|
||||
Math_SmoothStepToF(&this->modelHeight, 4.0f, 0.1f, 1000.0f, 0.0f);
|
||||
Math_SmoothStepToF(&this->modelRotSpeed, 54.0f, 0.1f, 1000.0f, 0.0f);
|
||||
Math_SmoothStepToF(&this->modelEllipticity, 0.2f, 0.1f, 1000.0f, 0.0f);
|
||||
this->actor.shape.yOffset = (this->modelHeight + 1.0f) * 16.0f;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089F8BC.s")
|
||||
if (DECR(this->explosionCountdown) != 0) {
|
||||
return -1;
|
||||
}
|
||||
effectPos.x = this->actor.world.pos.x;
|
||||
effectPos.y = this->actor.world.pos.y + this->actor.shape.yOffset;
|
||||
effectPos.z = this->actor.world.pos.z;
|
||||
for (i = 0; i < 20; i++) {
|
||||
effectVel.x = (Rand_ZeroOne() - 0.5f) * 7.0f;
|
||||
effectVel.y = Rand_ZeroOne() * 7.0f;
|
||||
effectVel.z = (Rand_ZeroOne() - 0.5f) * 7.0f;
|
||||
EffectSsDtBubble_SpawnCustomColor(play, &effectPos, &effectVel, &effectAccel, &sEffectPrimColor,
|
||||
&sEffectEnvColor, Rand_S16Offset(100, 50), 25, 0);
|
||||
}
|
||||
Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0x50);
|
||||
this->actor.flags &= ~ACTOR_FLAG_1;
|
||||
return Rand_S16Offset(90, 60);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089F908.s")
|
||||
s32 func_8089F8BC(EnBubble* this) {
|
||||
if (DECR(this->explosionCountdown) != 0) {
|
||||
return -1;
|
||||
} else {
|
||||
return func_8089F5D0(this);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089F95C.s")
|
||||
s32 func_8089F908(EnBubble* this) {
|
||||
this->modelWidth += 1.0f / 12.0f;
|
||||
this->modelHeight += 1.0f / 12.0f;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089F9E4.s")
|
||||
if (DECR(this->explosionCountdown) != 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089FA54.s")
|
||||
void EnBubble_Vec3fNormalizedReflect(Vec3f* vec1, Vec3f* vec2, Vec3f* dest) {
|
||||
f32 norm;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089FF30.s")
|
||||
func_80179F64(vec1, vec2, dest);
|
||||
norm = sqrtf(SQ(dest->x) + SQ(dest->y) + SQ(dest->z));
|
||||
if (norm != 0.0f) {
|
||||
dest->x /= norm;
|
||||
dest->y /= norm;
|
||||
dest->z /= norm;
|
||||
} else {
|
||||
dest->x = dest->y = dest->z = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089FFCC.s")
|
||||
void EnBubble_Vec3fNormalize(Vec3f* vec) {
|
||||
f32 norm = sqrtf(SQ(vec->x) + SQ(vec->y) + SQ(vec->z));
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_808A005C.s")
|
||||
if (norm != 0.0f) {
|
||||
vec->x /= norm;
|
||||
vec->y /= norm;
|
||||
vec->z /= norm;
|
||||
} else {
|
||||
vec->x = vec->y = vec->z = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/EnBubble_Init.s")
|
||||
void EnBubble_Fly(EnBubble* this, PlayState* play) {
|
||||
CollisionPoly* poly;
|
||||
Actor* bumpActor;
|
||||
Vec3f sp84;
|
||||
Vec3f sp78;
|
||||
Vec3f sp6C;
|
||||
Vec3f normal;
|
||||
Vec3f bounceDirection;
|
||||
f32 bounceSpeed;
|
||||
s32 bgId;
|
||||
u8 bounceCount;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/EnBubble_Destroy.s")
|
||||
if (this->colliderSphere.elements[1].info.bumperFlags & BUMP_HIT) {
|
||||
bumpActor = this->colliderSphere.base.ac;
|
||||
this->normalizedBumpVelocity = bumpActor->velocity;
|
||||
EnBubble_Vec3fNormalize(&this->normalizedBumpVelocity);
|
||||
this->velocityFromBump.x += this->normalizedBumpVelocity.x * 3.0f;
|
||||
this->velocityFromBump.y += this->normalizedBumpVelocity.y * 3.0f;
|
||||
this->velocityFromBump.z += this->normalizedBumpVelocity.z * 3.0f;
|
||||
}
|
||||
this->yVelocity -= 0.1f;
|
||||
if (this->yVelocity < this->actor.terminalVelocity) {
|
||||
this->yVelocity = this->actor.terminalVelocity;
|
||||
}
|
||||
bounceDirection.x = this->velocityFromBounce.x + this->velocityFromBump.x;
|
||||
bounceDirection.y = this->velocityFromBounce.y + this->velocityFromBump.y + this->yVelocity;
|
||||
bounceDirection.z = this->velocityFromBounce.z + this->velocityFromBump.z;
|
||||
EnBubble_Vec3fNormalize(&bounceDirection);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_808A029C.s")
|
||||
sp78.x = this->actor.world.pos.x;
|
||||
sp78.y = this->actor.world.pos.y + this->actor.shape.yOffset;
|
||||
sp78.z = this->actor.world.pos.z;
|
||||
sp6C = sp78;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_808A0350.s")
|
||||
sp6C.x += (bounceDirection.x * 24.0f);
|
||||
sp6C.y += (bounceDirection.y * 24.0f);
|
||||
sp6C.z += (bounceDirection.z * 24.0f);
|
||||
if (BgCheck_EntityLineTest1(&play->colCtx, &sp78, &sp6C, &sp84, &poly, true, true, true, false, &bgId)) {
|
||||
normal.x = COLPOLY_GET_NORMAL(poly->normal.x);
|
||||
normal.y = COLPOLY_GET_NORMAL(poly->normal.y);
|
||||
normal.z = COLPOLY_GET_NORMAL(poly->normal.z);
|
||||
EnBubble_Vec3fNormalizedReflect(&bounceDirection, &normal, &bounceDirection);
|
||||
this->bounceDirection = bounceDirection;
|
||||
bounceCount = this->bounceCount;
|
||||
this->bounceCount = ++bounceCount;
|
||||
if (bounceCount > (s16)(Rand_ZeroOne() * 10.0f)) {
|
||||
this->bounceCount = 0;
|
||||
}
|
||||
bounceSpeed = (this->bounceCount == 0) ? 3.6000001f : 3.0f;
|
||||
this->velocityFromBump.x = this->velocityFromBump.y = this->velocityFromBump.z = 0.0f;
|
||||
this->velocityFromBounce.x = this->bounceDirection.x * bounceSpeed;
|
||||
this->velocityFromBounce.y = this->bounceDirection.y * bounceSpeed;
|
||||
this->velocityFromBounce.z = this->bounceDirection.z * bounceSpeed;
|
||||
this->yVelocity = 0.0f;
|
||||
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AWA_BOUND);
|
||||
this->modelRotSpeed = 128.0f;
|
||||
this->modelEllipticity = 0.48f;
|
||||
} else if ((this->actor.bgCheckFlags & 0x20) && (bounceDirection.y < 0.0f)) {
|
||||
normal.x = normal.z = 0.0f;
|
||||
normal.y = 1.0f;
|
||||
EnBubble_Vec3fNormalizedReflect(&bounceDirection, &normal, &bounceDirection);
|
||||
this->bounceDirection = bounceDirection;
|
||||
bounceCount = this->bounceCount;
|
||||
this->bounceCount = ++bounceCount;
|
||||
if (bounceCount > (s16)(Rand_ZeroOne() * 10.0f)) {
|
||||
this->bounceCount = 0;
|
||||
}
|
||||
bounceSpeed = (this->bounceCount == 0) ? 3.6000001f : 3.0f;
|
||||
this->velocityFromBump.x = this->velocityFromBump.y = this->velocityFromBump.z = 0.0f;
|
||||
this->velocityFromBounce.x = (this->bounceDirection.x * bounceSpeed);
|
||||
this->velocityFromBounce.y = (this->bounceDirection.y * bounceSpeed);
|
||||
this->velocityFromBounce.z = (this->bounceDirection.z * bounceSpeed);
|
||||
this->yVelocity = 0.0f;
|
||||
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AWA_BOUND);
|
||||
this->modelRotSpeed = 128.0f;
|
||||
this->modelEllipticity = 0.48f;
|
||||
}
|
||||
this->actor.velocity.x = this->velocityFromBounce.x + this->velocityFromBump.x;
|
||||
this->actor.velocity.y = this->velocityFromBounce.y + this->velocityFromBump.y + this->yVelocity;
|
||||
this->actor.velocity.z = this->velocityFromBounce.z + this->velocityFromBump.z;
|
||||
Math_ApproachF(&this->velocityFromBump.x, 0.0f, 0.3f, 0.1f);
|
||||
Math_ApproachF(&this->velocityFromBump.y, 0.0f, 0.3f, 0.1f);
|
||||
Math_ApproachF(&this->velocityFromBump.z, 0.0f, 0.3f, 0.1f);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_808A03A0.s")
|
||||
s32 func_8089FF30(EnBubble* this) {
|
||||
if (((this->colliderSphere.base.acFlags & AC_HIT) != 0) == false) {
|
||||
return false;
|
||||
}
|
||||
this->colliderSphere.base.acFlags &= ~AC_HIT;
|
||||
if (this->colliderSphere.elements[1].info.bumperFlags & BUMP_HIT) {
|
||||
this->unk1F4.x = this->colliderSphere.base.ac->velocity.x / 10.0f;
|
||||
this->unk1F4.y = this->colliderSphere.base.ac->velocity.y / 10.0f;
|
||||
this->unk1F4.z = this->colliderSphere.base.ac->velocity.z / 10.0f;
|
||||
this->modelRotSpeed = 128.0f;
|
||||
this->modelEllipticity = 0.48f;
|
||||
return false;
|
||||
}
|
||||
this->timer = 8;
|
||||
return true;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_808A03E8.s")
|
||||
s32 EnBubble_IsPopped(EnBubble* this, PlayState* play) {
|
||||
if ((DECR(this->timer) != 0) || (this->actionFunc == EnBubble_Pop)) {
|
||||
return false;
|
||||
}
|
||||
if (this->colliderSphere.base.ocFlags2 & OC2_HIT_PLAYER) {
|
||||
this->colliderSphere.base.ocFlags2 &= ~OC2_HIT_PLAYER;
|
||||
EnBubble_DamagePlayer(this, play);
|
||||
this->timer = 8;
|
||||
return true;
|
||||
}
|
||||
return func_8089FF30(this);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/EnBubble_Update.s")
|
||||
void func_808A005C(EnBubble* this) {
|
||||
ColliderJntSphElementDim* dim = &this->colliderSphere.elements[0].dim;
|
||||
Vec3f src;
|
||||
Vec3f dest;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/EnBubble_Draw.s")
|
||||
src.x = dim->modelSphere.center.x;
|
||||
src.y = dim->modelSphere.center.y;
|
||||
src.z = dim->modelSphere.center.z;
|
||||
|
||||
Matrix_MultVec3f(&src, &dest);
|
||||
dim->worldSphere.center.x = dest.x;
|
||||
dim->worldSphere.center.y = dest.y;
|
||||
dim->worldSphere.center.z = dest.z;
|
||||
dim->worldSphere.radius = dim->modelSphere.radius * (1.0f + this->modelWidth);
|
||||
this->colliderSphere.elements[1].dim = *dim;
|
||||
}
|
||||
|
||||
void EnBubble_Init(Actor* thisx, PlayState* play) {
|
||||
s32 pad;
|
||||
EnBubble* this = THIS;
|
||||
|
||||
ActorShape_Init(&this->actor.shape, 16.0f, ActorShadow_DrawCircle, 0.2f);
|
||||
Collider_InitJntSph(play, &this->colliderSphere);
|
||||
Collider_SetJntSph(play, &this->colliderSphere, &this->actor, &sJntSphInit, this->colliderElements);
|
||||
CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(9), &sColChkInfoInit);
|
||||
this->actor.hintId = 0x16;
|
||||
this->bounceDirection.x = Rand_ZeroOne();
|
||||
this->bounceDirection.y = Rand_ZeroOne();
|
||||
this->bounceDirection.z = Rand_ZeroOne();
|
||||
EnBubble_Vec3fNormalize(&this->bounceDirection);
|
||||
this->velocityFromBounce.x = this->bounceDirection.x * 3.0f;
|
||||
this->velocityFromBounce.y = this->bounceDirection.y * 3.0f;
|
||||
this->velocityFromBounce.z = this->bounceDirection.z * 3.0f;
|
||||
EnBubble_SetDimensions(this, 0);
|
||||
this->actionFunc = EnBubble_Wait;
|
||||
}
|
||||
|
||||
void EnBubble_Destroy(Actor* thisx, PlayState* play) {
|
||||
EnBubble* this = (EnBubble*)thisx;
|
||||
|
||||
Collider_DestroyJntSph(play, &this->colliderSphere);
|
||||
}
|
||||
|
||||
void EnBubble_Wait(EnBubble* this, PlayState* play) {
|
||||
if (EnBubble_IsPopped(this, play)) {
|
||||
this->explosionCountdown = func_8089F59C(this);
|
||||
this->actionFunc = EnBubble_Pop;
|
||||
} else {
|
||||
EnBubble_Fly(this, play);
|
||||
this->actor.shape.yOffset = (this->modelHeight + 1.0f) * 16.0f;
|
||||
CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSphere.base);
|
||||
CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSphere.base);
|
||||
}
|
||||
}
|
||||
|
||||
void EnBubble_Pop(EnBubble* this, PlayState* play) {
|
||||
if (EnBubble_Explosion(this, play) > -1) {
|
||||
SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 60, NA_SE_EN_AWA_BREAK);
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
}
|
||||
}
|
||||
|
||||
void EnBubble_Disappear(EnBubble* this, PlayState* play) {
|
||||
s32 temp_v0 = func_8089F8BC(this);
|
||||
|
||||
if (temp_v0 >= 0) {
|
||||
this->actor.shape.shadowDraw = ActorShadow_DrawCircle;
|
||||
this->explosionCountdown = temp_v0;
|
||||
this->actionFunc = EnBubble_Regrow;
|
||||
}
|
||||
}
|
||||
|
||||
void EnBubble_Regrow(EnBubble* this, PlayState* play) {
|
||||
if (func_8089F908(this)) {
|
||||
this->actionFunc = EnBubble_Wait;
|
||||
}
|
||||
CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSphere.base);
|
||||
CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSphere.base);
|
||||
}
|
||||
|
||||
void EnBubble_Update(Actor* thisx, PlayState* play) {
|
||||
EnBubble* this = (EnBubble*)thisx;
|
||||
|
||||
Actor_UpdatePos(&this->actor);
|
||||
Actor_UpdateBgCheckInfo(play, &this->actor, 16.0f, 16.0f, 0.0f, 7);
|
||||
this->actionFunc(this, play);
|
||||
Actor_SetFocus(&this->actor, this->actor.shape.yOffset);
|
||||
}
|
||||
|
||||
void EnBubble_Draw(Actor* thisx, PlayState* play) {
|
||||
s32 pad;
|
||||
EnBubble* this = (EnBubble*)thisx;
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
if (this->actionFunc != EnBubble_Disappear) {
|
||||
func_8012C2DC(play->state.gfxCtx);
|
||||
Math_SmoothStepToF(&this->modelRotSpeed, 16.0f, 0.2f, 1000.0f, 0.0f);
|
||||
Math_SmoothStepToF(&this->modelEllipticity, 0.08f, 0.2f, 1000.0f, 0.0f);
|
||||
Matrix_ReplaceRotation(&play->billboardMtxF);
|
||||
Matrix_Scale(this->modelWidth + 1.0f, this->modelHeight + 1.0f, 1.0f, MTXMODE_APPLY);
|
||||
Matrix_RotateZF(DEGF_TO_RADF((f32)play->state.frames) * this->modelRotSpeed, MTXMODE_APPLY);
|
||||
Matrix_Scale(this->modelEllipticity + 1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
|
||||
Matrix_RotateZF(DEGF_TO_RADF(-(f32)play->state.frames) * this->modelRotSpeed, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
gSPDisplayList(POLY_XLU_DISP++, gBubbleDL);
|
||||
}
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
|
||||
if (this->actionFunc != EnBubble_Disappear) {
|
||||
this->actor.shape.shadowScale = (this->modelWidth + 1.0f) * 0.2f;
|
||||
func_808A005C(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#define Z_EN_BUBBLE_H
|
||||
|
||||
#include "global.h"
|
||||
#include "objects/object_bubble/object_bubble.h"
|
||||
|
||||
struct EnBubble;
|
||||
|
||||
|
|
@ -10,7 +11,25 @@ typedef void (*EnBubbleActionFunc)(struct EnBubble*, PlayState*);
|
|||
typedef struct EnBubble {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ EnBubbleActionFunc actionFunc;
|
||||
/* 0x148 */ char unk_148[0x110];
|
||||
/* 0x148 */ ColliderJntSph colliderSphere;
|
||||
/* 0x168 */ ColliderJntSphElement colliderElements[2];
|
||||
/* 0x1F4 */ Vec3f unk1F4; // set but never used
|
||||
/* 0x1F4 */ Vec3f unk1F8; // randomly generated, set but never used
|
||||
/* 0x200 */ s16 timer; // set to 8 when about to pop
|
||||
/* 0x202 */ s16 explosionCountdown;
|
||||
/* 0x204 */ UNK_TYPE1 pad204[4]; // unused
|
||||
/* 0x208 */ f32 modelRotSpeed;
|
||||
/* 0x20C */ f32 modelEllipticity;
|
||||
/* 0x210 */ f32 unk_210; // set to 1.0f, never used
|
||||
/* 0x214 */ f32 unk_214; // set to 1.0f, never used
|
||||
/* 0x218 */ f32 modelWidth;
|
||||
/* 0x21C */ f32 modelHeight;
|
||||
/* 0x220 */ u8 bounceCount;
|
||||
/* 0x224 */ Vec3f bounceDirection;
|
||||
/* 0x230 */ Vec3f velocityFromBounce;
|
||||
/* 0x23C */ Vec3f normalizedBumpVelocity;
|
||||
/* 0x248 */ Vec3f velocityFromBump;
|
||||
/* 0x254 */ f32 yVelocity;
|
||||
} EnBubble; // size = 0x258
|
||||
|
||||
extern const ActorInit En_Bubble_InitVars;
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ void EnElfbub_Draw(Actor* thisx, PlayState* play2) {
|
|||
Matrix_RotateZS(this->zRot * -1, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, object_bubble_DL_001000);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gBubbleDL);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5621,25 +5621,25 @@
|
|||
0x8089F2C4:("func_8089F2C4",),
|
||||
0x8089F380:("EnViewer_Update",),
|
||||
0x8089F3C8:("EnViewer_Draw",),
|
||||
0x8089F4E0:("func_8089F4E0",),
|
||||
0x8089F4E0:("EnBubble_SetDimensions",),
|
||||
0x8089F59C:("func_8089F59C",),
|
||||
0x8089F5D0:("func_8089F5D0",),
|
||||
0x8089F5F4:("func_8089F5F4",),
|
||||
0x8089F660:("func_8089F660",),
|
||||
0x8089F5F4:("EnBubble_DamagePlayer",),
|
||||
0x8089F660:("EnBubble_Explosion",),
|
||||
0x8089F8BC:("func_8089F8BC",),
|
||||
0x8089F908:("func_8089F908",),
|
||||
0x8089F95C:("func_8089F95C",),
|
||||
0x8089F9E4:("func_8089F9E4",),
|
||||
0x8089FA54:("func_8089FA54",),
|
||||
0x8089F95C:("EnBubble_Vec3fNormalizedReflect",),
|
||||
0x8089F9E4:("EnBubble_Vec3fNormalize",),
|
||||
0x8089FA54:("EnBubble_Fly",),
|
||||
0x8089FF30:("func_8089FF30",),
|
||||
0x8089FFCC:("func_8089FFCC",),
|
||||
0x8089FFCC:("EnBubble_IsPopped",),
|
||||
0x808A005C:("func_808A005C",),
|
||||
0x808A0170:("EnBubble_Init",),
|
||||
0x808A0270:("EnBubble_Destroy",),
|
||||
0x808A029C:("func_808A029C",),
|
||||
0x808A0350:("func_808A0350",),
|
||||
0x808A03A0:("func_808A03A0",),
|
||||
0x808A03E8:("func_808A03E8",),
|
||||
0x808A029C:("EnBubble_Wait",),
|
||||
0x808A0350:("EnBubble_Pop",),
|
||||
0x808A03A0:("EnBubble_Disappear",),
|
||||
0x808A03E8:("EnBubble_Regrow",),
|
||||
0x808A0458:("EnBubble_Update",),
|
||||
0x808A04D4:("EnBubble_Draw",),
|
||||
0x808A08F0:("DoorShutter_SetupAction",),
|
||||
|
|
|
|||
Loading…
Reference in New Issue