mirror of https://github.com/zeldaret/mm.git
ovl_En_Bh Decompiled (#906)
* ovl_En_Bh Decompiled * some minor things * Documentation * pr review * gEnBh - > gBh * noneSkel nonsense fix * pr review * pr review
This commit is contained in:
parent
9726a30109
commit
a2f78fbc44
|
@ -1,18 +1,18 @@
|
||||||
<Root>
|
<Root>
|
||||||
<File Name="object_bh" Segment="6">
|
<File Name="object_bh" Segment="6">
|
||||||
<Animation Name="object_bh_Anim_000074" Offset="0x74" />
|
<Animation Name="gBhFlyingAnim" Offset="0x74" />
|
||||||
<DList Name="object_bh_DL_0002B0" Offset="0x2B0" />
|
<DList Name="gBhBodyDL" Offset="0x2B0" />
|
||||||
<DList Name="object_bh_DL_0003A0" Offset="0x3A0" />
|
<DList Name="gBhRightWingToEdgeDL" Offset="0x3A0" />
|
||||||
<DList Name="object_bh_DL_000450" Offset="0x450" />
|
<DList Name="gBhRightWingToBodyDL" Offset="0x450" />
|
||||||
<DList Name="object_bh_DL_0004D8" Offset="0x4D8" />
|
<DList Name="gBhLeftWingToEdgeDL" Offset="0x4D8" />
|
||||||
<DList Name="object_bh_DL_000588" Offset="0x588" />
|
<DList Name="gBhLeftWingToBodyDL" Offset="0x588" />
|
||||||
<Texture Name="object_bh_Tex_000610" OutName="tex_000610" Format="rgba16" Width="32" Height="32" Offset="0x610" />
|
<Texture Name="gBhBodyTex" OutName="en_bh_body" Format="rgba16" Width="32" Height="32" Offset="0x610" />
|
||||||
<Texture Name="object_bh_Tex_000E10" OutName="tex_000E10" Format="rgba16" Width="64" Height="32" Offset="0xE10" />
|
<Texture Name="gBhWingTex" OutName="en_bh_wing" Format="rgba16" Width="64" Height="32" Offset="0xE10" />
|
||||||
<Limb Name="object_bh_Standardlimb_001E10" Type="Standard" EnumName="OBJECT_BH_LIMB_01" Offset="0x1E10" />
|
<Limb Name="gBhBodyLimb" Type="Standard" EnumName="OBJECT_BH_LIMB_BODY" Offset="0x1E10" />
|
||||||
<Limb Name="object_bh_Standardlimb_001E1C" Type="Standard" EnumName="OBJECT_BH_LIMB_02" Offset="0x1E1C" />
|
<Limb Name="gBhRightWingToBodyLimb" Type="Standard" EnumName="OBJECT_BH_LIMB_RIGHT_WING_TO_BODY" Offset="0x1E1C" />
|
||||||
<Limb Name="object_bh_Standardlimb_001E28" Type="Standard" EnumName="OBJECT_BH_LIMB_03" Offset="0x1E28" />
|
<Limb Name="gBhRightWingToEdgeLimb" Type="Standard" EnumName="OBJECT_BH_LIMB_RIGHT_WING_TO_EDGE" Offset="0x1E28" />
|
||||||
<Limb Name="object_bh_Standardlimb_001E34" Type="Standard" EnumName="OBJECT_BH_LIMB_04" Offset="0x1E34" />
|
<Limb Name="gBhLeftWingToBodyLimb" Type="Standard" EnumName="OBJECT_BH_LIMB_LEFT_WING_TO_BODY" Offset="0x1E34" />
|
||||||
<Limb Name="object_bh_Standardlimb_001E40" Type="Standard" EnumName="OBJECT_BH_LIMB_05" Offset="0x1E40" />
|
<Limb Name="gBhLeftWingToEdgeLimb" Type="Standard" EnumName="OBJECT_BH_LIMB_LEFT_WING_TO_EDGE" Offset="0x1E40" />
|
||||||
<Skeleton Name="object_bh_Skel_001E60" Type="Flex" LimbType="Standard" LimbNone="OBJECT_BH_LIMB_NONE" LimbMax="OBJECT_BH_LIMB_MAX" EnumName="object_bh_Limbs" Offset="0x1E60" />
|
<Skeleton Name="gBhSkel" Type="Flex" LimbType="Standard" LimbNone="OBJECT_BH_LIMB_NONE" LimbMax="OBJECT_BH_LIMB_MAX" EnumName="ObjectBhLimbs" Offset="0x1E60" />
|
||||||
</File>
|
</File>
|
||||||
</Root>
|
</Root>
|
||||||
|
|
3
spec
3
spec
|
@ -5154,8 +5154,7 @@ beginseg
|
||||||
name "ovl_En_Bh"
|
name "ovl_En_Bh"
|
||||||
compress
|
compress
|
||||||
include "build/src/overlays/actors/ovl_En_Bh/z_en_bh.o"
|
include "build/src/overlays/actors/ovl_En_Bh/z_en_bh.o"
|
||||||
include "build/data/ovl_En_Bh/ovl_En_Bh.data.o"
|
include "build/src/overlays/actors/ovl_En_Bh/ovl_En_Bh_reloc.o"
|
||||||
include "build/data/ovl_En_Bh/ovl_En_Bh.reloc.o"
|
|
||||||
endseg
|
endseg
|
||||||
|
|
||||||
beginseg
|
beginseg
|
||||||
|
|
|
@ -15,7 +15,8 @@ void EnBh_Destroy(Actor* thisx, PlayState* play);
|
||||||
void EnBh_Update(Actor* thisx, PlayState* play);
|
void EnBh_Update(Actor* thisx, PlayState* play);
|
||||||
void EnBh_Draw(Actor* thisx, PlayState* play);
|
void EnBh_Draw(Actor* thisx, PlayState* play);
|
||||||
|
|
||||||
#if 0
|
void func_80C22DEC(EnBh* this, PlayState* play);
|
||||||
|
|
||||||
const ActorInit En_Bh_InitVars = {
|
const ActorInit En_Bh_InitVars = {
|
||||||
ACTOR_EN_BH,
|
ACTOR_EN_BH,
|
||||||
ACTORCAT_ITEMACTION,
|
ACTORCAT_ITEMACTION,
|
||||||
|
@ -28,16 +29,93 @@ const ActorInit En_Bh_InitVars = {
|
||||||
(ActorFunc)EnBh_Draw,
|
(ActorFunc)EnBh_Draw,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
void EnBh_Init(Actor* thisx, PlayState* play) {
|
||||||
|
EnBh* this = THIS;
|
||||||
|
|
||||||
extern UNK_TYPE D_06000074;
|
this->actor.flags &= ~ACTOR_FLAG_1;
|
||||||
|
Actor_SetScale(&this->actor, 0.01f);
|
||||||
|
SkelAnime_InitFlex(play, &this->skelanime, &gBhSkel, &gBhFlyingAnim, this->jointTable, this->morphTable,
|
||||||
|
OBJECT_BH_LIMB_MAX);
|
||||||
|
Animation_PlayLoop(&this->skelanime, &gBhFlyingAnim);
|
||||||
|
this->actionFunc = func_80C22DEC;
|
||||||
|
}
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bh/EnBh_Init.s")
|
void EnBh_Destroy(Actor* thisx, PlayState* play) {
|
||||||
|
}
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bh/EnBh_Destroy.s")
|
void func_80C22DEC(EnBh* this, PlayState* play) {
|
||||||
|
f32 xDiff;
|
||||||
|
f32 yDiff;
|
||||||
|
f32 zDiff;
|
||||||
|
f32 xzDist;
|
||||||
|
s16 xRot;
|
||||||
|
s16 yRot;
|
||||||
|
s16 zRot;
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bh/func_80C22DEC.s")
|
this->actor.speedXZ = 3.0f;
|
||||||
|
xDiff = this->pos.x - this->actor.world.pos.x;
|
||||||
|
yDiff = this->pos.y - this->actor.world.pos.y;
|
||||||
|
zDiff = this->pos.z - this->actor.world.pos.z;
|
||||||
|
xzDist = sqrtf(SQ(xDiff) + SQ(zDiff));
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bh/EnBh_Update.s")
|
if ((this->timer2 == 0) || (xzDist < 100.0f)) {
|
||||||
|
this->pos.x = randPlusMinusPoint5Scaled(300.0f) + this->actor.home.pos.x;
|
||||||
|
this->pos.y = randPlusMinusPoint5Scaled(100.0f) + this->actor.home.pos.y;
|
||||||
|
this->pos.z = randPlusMinusPoint5Scaled(300.0f) + this->actor.home.pos.z;
|
||||||
|
this->timer2 = Rand_ZeroFloat(50.0f) + 30.0f;
|
||||||
|
this->step = 0;
|
||||||
|
}
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bh/EnBh_Draw.s")
|
yRot = Math_Atan2S(xDiff, zDiff);
|
||||||
|
xRot = Math_Atan2S(yDiff, xzDist);
|
||||||
|
zRot = Math_SmoothStepToS(&this->actor.world.rot.y, yRot, 0xA, this->step, 0);
|
||||||
|
|
||||||
|
if (zRot > 0x1000) {
|
||||||
|
zRot = 0x1000;
|
||||||
|
} else if (zRot < -0x1000) {
|
||||||
|
zRot = -0x1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
Math_ApproachS(&this->actor.world.rot.x, xRot, 0xA, this->step);
|
||||||
|
Math_ApproachS(&this->actor.world.rot.z, -zRot, 0xA, this->step);
|
||||||
|
Math_ApproachS(&this->step, 0x200, 1, 0x10);
|
||||||
|
|
||||||
|
if ((s32)this->skelanime.playSpeed == 0) {
|
||||||
|
if (this->timer == 0) {
|
||||||
|
this->skelanime.playSpeed = 1.0f;
|
||||||
|
this->timer = Rand_ZeroFloat(70.0f) + 50.0f;
|
||||||
|
} else if (((this->timer & 7) == 7) && (Rand_ZeroOne() < 0.5f)) {
|
||||||
|
this->unk1E4 = randPlusMinusPoint5Scaled(3000.0f);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
SkelAnime_Update(&this->skelanime);
|
||||||
|
if ((this->timer == 0) && (Animation_OnFrame(&this->skelanime, 6.0f))) {
|
||||||
|
this->skelanime.playSpeed = 0.0f;
|
||||||
|
this->timer = Rand_ZeroFloat(50.0f) + 50.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this->actor.shape.rot.x = -this->actor.world.rot.x;
|
||||||
|
this->actor.shape.rot.y = this->actor.world.rot.y;
|
||||||
|
this->actor.shape.rot.z = this->actor.world.rot.z;
|
||||||
|
Math_ApproachS(&this->unk1E2, this->unk1E4, 3, 0x3E8);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EnBh_Update(Actor* thisx, PlayState* play) {
|
||||||
|
EnBh* this = THIS;
|
||||||
|
|
||||||
|
Actor_MoveWithoutGravity(&this->actor);
|
||||||
|
DECR(this->timer2);
|
||||||
|
DECR(this->timer);
|
||||||
|
this->actionFunc(this, play);
|
||||||
|
Math_Vec3f_Copy(&this->actor.focus.pos, &this->actor.world.pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EnBh_Draw(Actor* thisx, PlayState* play) {
|
||||||
|
EnBh* this = THIS;
|
||||||
|
|
||||||
|
func_8012C28C(play->state.gfxCtx);
|
||||||
|
Matrix_RotateZS(this->unk1E2, MTXMODE_APPLY);
|
||||||
|
SkelAnime_DrawFlexOpa(play, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, NULL,
|
||||||
|
NULL, &this->actor);
|
||||||
|
}
|
||||||
|
|
|
@ -2,15 +2,24 @@
|
||||||
#define Z_EN_BH_H
|
#define Z_EN_BH_H
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
#include "objects/object_bh/object_bh.h"
|
||||||
|
|
||||||
struct EnBh;
|
struct EnBh;
|
||||||
|
|
||||||
typedef void (*EnBhActionFunc)(struct EnBh*, PlayState*);
|
typedef void (*EnBhActionFunc)(struct EnBh*, PlayState*);
|
||||||
|
|
||||||
typedef struct EnBh {
|
typedef struct EnBh {
|
||||||
/* 0x0000 */ Actor actor;
|
/* 0x000 */ Actor actor;
|
||||||
/* 0x0144 */ char unk_144[0xA4];
|
/* 0x144 */ SkelAnime skelanime;
|
||||||
/* 0x01E8 */ EnBhActionFunc actionFunc;
|
/* 0x188 */ Vec3s jointTable[OBJECT_BH_LIMB_MAX];
|
||||||
|
/* 0x1AC */ Vec3s morphTable[OBJECT_BH_LIMB_MAX];
|
||||||
|
/* 0x1D0 */ Vec3f pos;
|
||||||
|
/* 0x1DC */ s16 timer;
|
||||||
|
/* 0x1DE */ s16 timer2;
|
||||||
|
/* 0x1E0 */ s16 step;
|
||||||
|
/* 0x1E2 */ s16 unk1E2;
|
||||||
|
/* 0x1E4 */ s16 unk1E4;
|
||||||
|
/* 0x1E8 */ EnBhActionFunc actionFunc;
|
||||||
} EnBh; // size = 0x1EC
|
} EnBh; // size = 0x1EC
|
||||||
|
|
||||||
extern const ActorInit En_Bh_InitVars;
|
extern const ActorInit En_Bh_InitVars;
|
||||||
|
|
Loading…
Reference in New Issue